From 9e43e2ac1373d5be5c6500c1bc3b1dd6ee9584b4 Mon Sep 17 00:00:00 2001 From: ryker <> Date: Mon, 5 Oct 1998 20:13:16 +0000 Subject: Import of SSLeay-0.9.0b with RSA and IDEA stubbed + OpenBSD build functionality for shared libs. Note that routines such as sslv2_init and friends that use RSA will not work due to lack of RSA in this library. Needs documentation and help from ports for easy upgrade to full functionality where legally possible. --- src/lib/libcrypto/asn1/a_bmp.c | 90 + src/lib/libcrypto/asn1/asn1.err | 182 ++ src/lib/libcrypto/asn1/d2i_dhp.c | 108 + src/lib/libcrypto/asn1/d2i_dsap.c | 101 + src/lib/libcrypto/asn1/d2i_r_pr.c | 129 + src/lib/libcrypto/asn1/d2i_r_pu.c | 100 + src/lib/libcrypto/asn1/d2i_s_pr.c | 113 + src/lib/libcrypto/asn1/d2i_s_pu.c | 124 + src/lib/libcrypto/asn1/i2d_dhp.c | 128 + src/lib/libcrypto/asn1/i2d_dsap.c | 121 + src/lib/libcrypto/asn1/i2d_r_pr.c | 132 + src/lib/libcrypto/asn1/i2d_r_pu.c | 118 + src/lib/libcrypto/asn1/i2d_s_pr.c | 128 + src/lib/libcrypto/asn1/i2d_s_pu.c | 133 + src/lib/libcrypto/asn1/p7_dgst.c | 130 + src/lib/libcrypto/asn1/p7_enc.c | 120 + src/lib/libcrypto/asn1/p7_enc_c.c | 127 + src/lib/libcrypto/asn1/p7_evp.c | 125 + src/lib/libcrypto/asn1/p7_i_s.c | 120 + src/lib/libcrypto/asn1/p7_lib.c | 299 ++ src/lib/libcrypto/asn1/p7_recip.c | 132 + src/lib/libcrypto/asn1/p7_s_e.c | 146 + src/lib/libcrypto/asn1/p7_signd.c | 140 + src/lib/libcrypto/asn1/p7_signi.c | 149 + src/lib/libcrypto/asn1/pkcs8.c | 142 + src/lib/libcrypto/bf/Makefile.uni | 169 ++ src/lib/libcrypto/bf/asm/b-win32.asm | 906 ++++++ src/lib/libcrypto/bf/asm/bx86unix.cpp | 976 +++++++ src/lib/libcrypto/bf/bf_locl.org | 242 ++ src/lib/libcrypto/bio/bio.err | 46 + src/lib/libcrypto/bn/asm/bn-win32.asm | 689 +++++ src/lib/libcrypto/bn/asm/bn86unix.cpp | 752 +++++ src/lib/libcrypto/bn/asm/sparc.s | 462 +++ src/lib/libcrypto/bn/asm/x86w16.asm | 297 ++ src/lib/libcrypto/bn/asm/x86w32.asm | 362 +++ src/lib/libcrypto/bn/bn.err | 27 + src/lib/libcrypto/bn/bn.org | 502 ++++ src/lib/libcrypto/bn/bn_m.c | 169 ++ src/lib/libcrypto/bn/bn_mulw.c | 366 +++ src/lib/libcrypto/bn/bn_sub.c | 180 ++ src/lib/libcrypto/buffer/buffer.err | 9 + src/lib/libcrypto/cast/Makefile.uni | 123 + src/lib/libcrypto/cast/asm/c-win32.asm | 940 ++++++ src/lib/libcrypto/cast/asm/cx86unix.cpp | 1010 +++++++ src/lib/libcrypto/conf/conf.c | 727 +++++ src/lib/libcrypto/conf/conf.err | 12 + src/lib/libcrypto/conf/conf_lcl.h | 102 + src/lib/libcrypto/cryptall.h | 110 + src/lib/libcrypto/crypto.c | 575 ++++ src/lib/libcrypto/crypto.err | 8 + src/lib/libcrypto/date.h | 1 + src/lib/libcrypto/des/DES.pod | 16 + src/lib/libcrypto/des/MODES.DES | 84 + src/lib/libcrypto/des/Makefile.PL | 14 + src/lib/libcrypto/des/Makefile.lit | 250 ++ src/lib/libcrypto/des/Makefile.uni | 263 ++ src/lib/libcrypto/des/PC1 | 28 + src/lib/libcrypto/des/PC2 | 57 + src/lib/libcrypto/des/asm/d-win32.asm | 3132 ++++++++++++++++++++ src/lib/libcrypto/des/asm/dx86unix.cpp | 3202 +++++++++++++++++++++ src/lib/libcrypto/des/asm/y-win32.asm | 929 ++++++ src/lib/libcrypto/des/asm/yx86unix.cpp | 976 +++++++ src/lib/libcrypto/des/des.man | 186 ++ src/lib/libcrypto/des/des.org | 301 ++ src/lib/libcrypto/des/des.pl | 552 ++++ src/lib/libcrypto/des/des_crypt.man | 508 ++++ src/lib/libcrypto/des/des_locl.org | 516 ++++ src/lib/libcrypto/des/doIP | 46 + src/lib/libcrypto/des/doPC1 | 110 + src/lib/libcrypto/des/doPC2 | 94 + src/lib/libcrypto/des/ede_enc.c | 190 ++ src/lib/libcrypto/des/podd.h | 75 + src/lib/libcrypto/des/ranlib.sh | 23 + src/lib/libcrypto/des/shifts.pl | 198 ++ src/lib/libcrypto/des/sk.h | 204 ++ src/lib/libcrypto/des/supp.c | 109 + src/lib/libcrypto/des/testdes.pl | 167 ++ src/lib/libcrypto/des/vms.com | 90 + src/lib/libcrypto/dh/dh.err | 12 + src/lib/libcrypto/dsa/dsa.err | 15 + src/lib/libcrypto/err/err_code.pl | 105 + src/lib/libcrypto/err/err_genc.pl | 198 ++ src/lib/libcrypto/err/error.err | 13 + src/lib/libcrypto/err/ssleay.ec | 57 + src/lib/libcrypto/evp/e_cbc_3d.c | 163 ++ src/lib/libcrypto/evp/e_cbc_bf.c | 119 + src/lib/libcrypto/evp/e_cbc_c.c | 119 + src/lib/libcrypto/evp/e_cbc_d.c | 116 + src/lib/libcrypto/evp/e_cbc_i.c | 131 + src/lib/libcrypto/evp/e_cbc_r2.c | 136 + src/lib/libcrypto/evp/e_cbc_r5.c | 120 + src/lib/libcrypto/evp/e_cfb_3d.c | 166 ++ src/lib/libcrypto/evp/e_cfb_bf.c | 121 + src/lib/libcrypto/evp/e_cfb_c.c | 121 + src/lib/libcrypto/evp/e_cfb_d.c | 118 + src/lib/libcrypto/evp/e_cfb_i.c | 121 + src/lib/libcrypto/evp/e_cfb_r2.c | 122 + src/lib/libcrypto/evp/e_cfb_r5.c | 122 + src/lib/libcrypto/evp/e_ecb_3d.c | 161 ++ src/lib/libcrypto/evp/e_ecb_bf.c | 122 + src/lib/libcrypto/evp/e_ecb_c.c | 122 + src/lib/libcrypto/evp/e_ecb_d.c | 118 + src/lib/libcrypto/evp/e_ecb_i.c | 133 + src/lib/libcrypto/evp/e_ecb_r2.c | 123 + src/lib/libcrypto/evp/e_ecb_r5.c | 123 + src/lib/libcrypto/evp/e_ofb_3d.c | 165 ++ src/lib/libcrypto/evp/e_ofb_bf.c | 122 + src/lib/libcrypto/evp/e_ofb_c.c | 122 + src/lib/libcrypto/evp/e_ofb_d.c | 118 + src/lib/libcrypto/evp/e_ofb_i.c | 121 + src/lib/libcrypto/evp/e_ofb_r2.c | 123 + src/lib/libcrypto/evp/e_ofb_r5.c | 123 + src/lib/libcrypto/evp/evp.err | 24 + src/lib/libcrypto/evp/pk_lib.c | 82 + src/lib/libcrypto/libvms.com | 31 + src/lib/libcrypto/md2/md2.org | 106 + src/lib/libcrypto/md5/Makefile.uni | 109 + src/lib/libcrypto/md5/asm/m5-win32.asm | 686 +++++ src/lib/libcrypto/md5/asm/mx86unix.cpp | 730 +++++ src/lib/libcrypto/objects/objects.err | 12 + src/lib/libcrypto/pem/ctx_size.c | 122 + src/lib/libcrypto/pem/pem.err | 38 + src/lib/libcrypto/pem/pem.org | 562 ++++ src/lib/libcrypto/pkcs7/README | 5 + src/lib/libcrypto/pkcs7/mf.p7 | 18 + src/lib/libcrypto/pkcs7/p7.tst | 33 + src/lib/libcrypto/pkcs7/pkcs7.err | 26 + src/lib/libcrypto/ranlib.sh | 23 + src/lib/libcrypto/rc2/Makefile.uni | 72 + src/lib/libcrypto/rc2/rc2.org | 118 + src/lib/libcrypto/rc4/Makefile.uni | 102 + src/lib/libcrypto/rc4/asm/r4-win32.asm | 314 ++ src/lib/libcrypto/rc4/asm/rx86unix.cpp | 358 +++ src/lib/libcrypto/rc4/rc4.org | 103 + src/lib/libcrypto/rc4/rc4_locl.org | 70 + src/lib/libcrypto/rc5/Makefile.uni | 72 + src/lib/libcrypto/rc5/asm/r5-win32.asm | 574 ++++ src/lib/libcrypto/rc5/asm/r586unix.cpp | 628 ++++ src/lib/libcrypto/ripemd/Makefile.uni | 109 + src/lib/libcrypto/ripemd/asm/rm-win32.asm | 1972 +++++++++++++ src/lib/libcrypto/ripemd/asm/rm86unix.cpp | 2016 +++++++++++++ src/lib/libcrypto/rsa/rsa.err | 45 + src/lib/libcrypto/sha/Makefile.uni | 122 + src/lib/libcrypto/sha/asm/s1-win32.asm | 1664 +++++++++++ src/lib/libcrypto/sha/asm/sx86unix.cpp | 1948 +++++++++++++ src/lib/libcrypto/sha/sha_sgst.c | 246 ++ src/lib/libcrypto/util/mklink.sh | 35 + src/lib/libcrypto/util/ranlib.sh | 23 + src/lib/libcrypto/util/sep_lib.sh | 37 + src/lib/libcrypto/util/ssldir.pl | 52 + src/lib/libcrypto/util/up_ver.pl | 79 + src/lib/libcrypto/x509/attrib | 38 + src/lib/libcrypto/x509/v3_net.c | 87 + src/lib/libcrypto/x509/v3_x509.c | 253 ++ src/lib/libcrypto/x509/x509.doc | 27 + src/lib/libcrypto/x509/x509.err | 46 + src/lib/libcrypto/x509/x509pack.c | 157 + src/lib/libcrypto/x509/x509v3.doc | 24 + src/lib/libcrypto/x509v3/format | 92 + src/lib/libcrypto/x509v3/header | 6 + src/lib/libcrypto/x509v3/v3_ku.c | 318 ++ src/lib/libssl/Makefile | 12 + src/lib/libssl/Makefile.bsd-wrapper | 82 + src/lib/libssl/README.OPENBSD | 66 + src/lib/libssl/crypto-patent/Makefile | 170 ++ src/lib/libssl/crypto-patent/shlib_version | 2 + src/lib/libssl/crypto/Makefile | 170 ++ src/lib/libssl/crypto/shlib_version | 2 + src/lib/libssl/src/COPYRIGHT | 65 + src/lib/libssl/src/HISTORY | 316 ++ src/lib/libssl/src/HISTORY.066 | 443 +++ src/lib/libssl/src/MICROSOFT | 146 + src/lib/libssl/src/MINFO | 968 +++++++ src/lib/libssl/src/PATENTS | 9 + src/lib/libssl/src/README.066 | 27 + src/lib/libssl/src/README.080 | 147 + src/lib/libssl/src/README.090 | 71 + src/lib/libssl/src/TODO | 28 + src/lib/libssl/src/VERSION | 24 + src/lib/libssl/src/apps/eay.c | 130 + src/lib/libssl/src/apps/ext.v3 | 2 + src/lib/libssl/src/apps/g_ssleay.pl | 114 + src/lib/libssl/src/apps/mklinks | 7 + src/lib/libssl/src/apps/pem_mail.c | 170 ++ src/lib/libssl/src/apps/rmlinks | 6 + src/lib/libssl/src/apps/ssleay.c | 342 +++ src/lib/libssl/src/apps/ssleay.cnf | 116 + src/lib/libssl/src/apps/tkca | 66 + src/lib/libssl/src/certs/rsa-ssca.pem | 19 + src/lib/libssl/src/certs/vsign4.pem | 16 + src/lib/libssl/src/crypto/asn1/a_bmp.c | 90 + src/lib/libssl/src/crypto/asn1/asn1.err | 182 ++ src/lib/libssl/src/crypto/asn1/d2i_dhp.c | 108 + src/lib/libssl/src/crypto/asn1/d2i_dsap.c | 101 + src/lib/libssl/src/crypto/asn1/d2i_r_pr.c | 129 + src/lib/libssl/src/crypto/asn1/d2i_r_pu.c | 100 + src/lib/libssl/src/crypto/asn1/d2i_s_pr.c | 113 + src/lib/libssl/src/crypto/asn1/d2i_s_pu.c | 124 + src/lib/libssl/src/crypto/asn1/i2d_dhp.c | 128 + src/lib/libssl/src/crypto/asn1/i2d_dsap.c | 121 + src/lib/libssl/src/crypto/asn1/i2d_r_pr.c | 132 + src/lib/libssl/src/crypto/asn1/i2d_r_pu.c | 118 + src/lib/libssl/src/crypto/asn1/i2d_s_pr.c | 128 + src/lib/libssl/src/crypto/asn1/i2d_s_pu.c | 133 + src/lib/libssl/src/crypto/asn1/p7_dgst.c | 130 + src/lib/libssl/src/crypto/asn1/p7_enc.c | 120 + src/lib/libssl/src/crypto/asn1/p7_enc_c.c | 127 + src/lib/libssl/src/crypto/asn1/p7_evp.c | 125 + src/lib/libssl/src/crypto/asn1/p7_i_s.c | 120 + src/lib/libssl/src/crypto/asn1/p7_lib.c | 299 ++ src/lib/libssl/src/crypto/asn1/p7_recip.c | 132 + src/lib/libssl/src/crypto/asn1/p7_s_e.c | 146 + src/lib/libssl/src/crypto/asn1/p7_signd.c | 140 + src/lib/libssl/src/crypto/asn1/p7_signi.c | 149 + src/lib/libssl/src/crypto/asn1/pkcs8.c | 142 + src/lib/libssl/src/crypto/bf/Makefile.uni | 169 ++ src/lib/libssl/src/crypto/bf/asm/b-win32.asm | 906 ++++++ src/lib/libssl/src/crypto/bf/asm/bx86unix.cpp | 976 +++++++ src/lib/libssl/src/crypto/bf/bf_locl.org | 242 ++ src/lib/libssl/src/crypto/bio/bio.err | 46 + src/lib/libssl/src/crypto/bn/asm/bn-win32.asm | 689 +++++ src/lib/libssl/src/crypto/bn/asm/bn86unix.cpp | 752 +++++ src/lib/libssl/src/crypto/bn/asm/sparc.s | 462 +++ src/lib/libssl/src/crypto/bn/asm/x86w16.asm | 297 ++ src/lib/libssl/src/crypto/bn/asm/x86w32.asm | 362 +++ src/lib/libssl/src/crypto/bn/bn.err | 27 + src/lib/libssl/src/crypto/bn/bn.org | 502 ++++ src/lib/libssl/src/crypto/bn/bn_m.c | 169 ++ src/lib/libssl/src/crypto/bn/bn_mulw.c | 366 +++ src/lib/libssl/src/crypto/bn/bn_sub.c | 180 ++ src/lib/libssl/src/crypto/buffer/buffer.err | 9 + src/lib/libssl/src/crypto/cast/Makefile.uni | 123 + src/lib/libssl/src/crypto/cast/asm/c-win32.asm | 940 ++++++ src/lib/libssl/src/crypto/cast/asm/cx86unix.cpp | 1010 +++++++ src/lib/libssl/src/crypto/conf/conf.c | 727 +++++ src/lib/libssl/src/crypto/conf/conf.err | 12 + src/lib/libssl/src/crypto/conf/conf_lcl.h | 102 + src/lib/libssl/src/crypto/cryptall.h | 110 + src/lib/libssl/src/crypto/crypto.c | 575 ++++ src/lib/libssl/src/crypto/crypto.err | 8 + src/lib/libssl/src/crypto/date.h | 1 + src/lib/libssl/src/crypto/des/DES.pod | 16 + src/lib/libssl/src/crypto/des/MODES.DES | 84 + src/lib/libssl/src/crypto/des/Makefile.PL | 14 + src/lib/libssl/src/crypto/des/Makefile.lit | 250 ++ src/lib/libssl/src/crypto/des/Makefile.uni | 263 ++ src/lib/libssl/src/crypto/des/PC1 | 28 + src/lib/libssl/src/crypto/des/PC2 | 57 + src/lib/libssl/src/crypto/des/asm/d-win32.asm | 3132 ++++++++++++++++++++ src/lib/libssl/src/crypto/des/asm/dx86unix.cpp | 3202 +++++++++++++++++++++ src/lib/libssl/src/crypto/des/asm/y-win32.asm | 929 ++++++ src/lib/libssl/src/crypto/des/asm/yx86unix.cpp | 976 +++++++ src/lib/libssl/src/crypto/des/des.man | 186 ++ src/lib/libssl/src/crypto/des/des.org | 301 ++ src/lib/libssl/src/crypto/des/des.pl | 552 ++++ src/lib/libssl/src/crypto/des/des_crypt.man | 508 ++++ src/lib/libssl/src/crypto/des/des_locl.org | 516 ++++ src/lib/libssl/src/crypto/des/doIP | 46 + src/lib/libssl/src/crypto/des/doPC1 | 110 + src/lib/libssl/src/crypto/des/doPC2 | 94 + src/lib/libssl/src/crypto/des/ede_enc.c | 190 ++ src/lib/libssl/src/crypto/des/podd.h | 75 + src/lib/libssl/src/crypto/des/ranlib.sh | 23 + src/lib/libssl/src/crypto/des/shifts.pl | 198 ++ src/lib/libssl/src/crypto/des/sk.h | 204 ++ src/lib/libssl/src/crypto/des/supp.c | 109 + src/lib/libssl/src/crypto/des/testdes.pl | 167 ++ src/lib/libssl/src/crypto/des/vms.com | 90 + src/lib/libssl/src/crypto/dh/dh.err | 12 + src/lib/libssl/src/crypto/dsa/dsa.err | 15 + src/lib/libssl/src/crypto/err/err_code.pl | 105 + src/lib/libssl/src/crypto/err/err_genc.pl | 198 ++ src/lib/libssl/src/crypto/err/error.err | 13 + src/lib/libssl/src/crypto/err/ssleay.ec | 57 + src/lib/libssl/src/crypto/evp/e_cbc_3d.c | 163 ++ src/lib/libssl/src/crypto/evp/e_cbc_bf.c | 119 + src/lib/libssl/src/crypto/evp/e_cbc_c.c | 119 + src/lib/libssl/src/crypto/evp/e_cbc_d.c | 116 + src/lib/libssl/src/crypto/evp/e_cbc_i.c | 131 + src/lib/libssl/src/crypto/evp/e_cbc_r2.c | 136 + src/lib/libssl/src/crypto/evp/e_cbc_r5.c | 120 + src/lib/libssl/src/crypto/evp/e_cfb_3d.c | 166 ++ src/lib/libssl/src/crypto/evp/e_cfb_bf.c | 121 + src/lib/libssl/src/crypto/evp/e_cfb_c.c | 121 + src/lib/libssl/src/crypto/evp/e_cfb_d.c | 118 + src/lib/libssl/src/crypto/evp/e_cfb_i.c | 121 + src/lib/libssl/src/crypto/evp/e_cfb_r2.c | 122 + src/lib/libssl/src/crypto/evp/e_cfb_r5.c | 122 + src/lib/libssl/src/crypto/evp/e_ecb_3d.c | 161 ++ src/lib/libssl/src/crypto/evp/e_ecb_bf.c | 122 + src/lib/libssl/src/crypto/evp/e_ecb_c.c | 122 + src/lib/libssl/src/crypto/evp/e_ecb_d.c | 118 + src/lib/libssl/src/crypto/evp/e_ecb_i.c | 133 + src/lib/libssl/src/crypto/evp/e_ecb_r2.c | 123 + src/lib/libssl/src/crypto/evp/e_ecb_r5.c | 123 + src/lib/libssl/src/crypto/evp/e_ofb_3d.c | 165 ++ src/lib/libssl/src/crypto/evp/e_ofb_bf.c | 122 + src/lib/libssl/src/crypto/evp/e_ofb_c.c | 122 + src/lib/libssl/src/crypto/evp/e_ofb_d.c | 118 + src/lib/libssl/src/crypto/evp/e_ofb_i.c | 121 + src/lib/libssl/src/crypto/evp/e_ofb_r2.c | 123 + src/lib/libssl/src/crypto/evp/e_ofb_r5.c | 123 + src/lib/libssl/src/crypto/evp/evp.err | 24 + src/lib/libssl/src/crypto/evp/pk_lib.c | 82 + src/lib/libssl/src/crypto/libvms.com | 31 + src/lib/libssl/src/crypto/md2/md2.org | 106 + src/lib/libssl/src/crypto/md5/Makefile.uni | 109 + src/lib/libssl/src/crypto/md5/asm/m5-win32.asm | 686 +++++ src/lib/libssl/src/crypto/md5/asm/mx86unix.cpp | 730 +++++ src/lib/libssl/src/crypto/objects/objects.err | 12 + src/lib/libssl/src/crypto/pem/ctx_size.c | 122 + src/lib/libssl/src/crypto/pem/pem.err | 38 + src/lib/libssl/src/crypto/pem/pem.org | 562 ++++ src/lib/libssl/src/crypto/pkcs7/README | 5 + src/lib/libssl/src/crypto/pkcs7/mf.p7 | 18 + src/lib/libssl/src/crypto/pkcs7/p7.tst | 33 + src/lib/libssl/src/crypto/pkcs7/pkcs7.err | 26 + src/lib/libssl/src/crypto/ranlib.sh | 23 + src/lib/libssl/src/crypto/rc2/Makefile.uni | 72 + src/lib/libssl/src/crypto/rc2/rc2.org | 118 + src/lib/libssl/src/crypto/rc4/Makefile.uni | 102 + src/lib/libssl/src/crypto/rc4/asm/r4-win32.asm | 314 ++ src/lib/libssl/src/crypto/rc4/asm/rx86unix.cpp | 358 +++ src/lib/libssl/src/crypto/rc4/rc4.org | 103 + src/lib/libssl/src/crypto/rc4/rc4_locl.org | 70 + src/lib/libssl/src/crypto/rc5/Makefile.uni | 72 + src/lib/libssl/src/crypto/rc5/asm/r5-win32.asm | 574 ++++ src/lib/libssl/src/crypto/rc5/asm/r586unix.cpp | 628 ++++ src/lib/libssl/src/crypto/ripemd/Makefile.uni | 109 + src/lib/libssl/src/crypto/ripemd/asm/rm-win32.asm | 1972 +++++++++++++ src/lib/libssl/src/crypto/ripemd/asm/rm86unix.cpp | 2016 +++++++++++++ src/lib/libssl/src/crypto/rsa/rsa.err | 45 + src/lib/libssl/src/crypto/sha/Makefile.uni | 122 + src/lib/libssl/src/crypto/sha/asm/s1-win32.asm | 1664 +++++++++++ src/lib/libssl/src/crypto/sha/asm/sx86unix.cpp | 1948 +++++++++++++ src/lib/libssl/src/crypto/sha/sha_sgst.c | 246 ++ src/lib/libssl/src/crypto/x509/attrib | 38 + src/lib/libssl/src/crypto/x509/v3_net.c | 87 + src/lib/libssl/src/crypto/x509/v3_x509.c | 253 ++ src/lib/libssl/src/crypto/x509/x509.doc | 27 + src/lib/libssl/src/crypto/x509/x509.err | 46 + src/lib/libssl/src/crypto/x509/x509pack.c | 157 + src/lib/libssl/src/crypto/x509/x509v3.doc | 24 + src/lib/libssl/src/crypto/x509v3/format | 92 + src/lib/libssl/src/crypto/x509v3/header | 6 + src/lib/libssl/src/crypto/x509v3/v3_ku.c | 318 ++ src/lib/libssl/src/dep/crypto.txt | 1043 +++++++ src/lib/libssl/src/dep/files | 574 ++++ src/lib/libssl/src/dep/gen.pl | 113 + src/lib/libssl/src/dep/ssl.txt | 156 + src/lib/libssl/src/doc/API.doc | 24 + src/lib/libssl/src/doc/a_verify.doc | 85 + src/lib/libssl/src/doc/apps.doc | 53 + src/lib/libssl/src/doc/asn1.doc | 401 +++ src/lib/libssl/src/doc/bio.doc | 423 +++ src/lib/libssl/src/doc/blowfish.doc | 146 + src/lib/libssl/src/doc/bn.doc | 381 +++ src/lib/libssl/src/doc/ca.1 | 121 + src/lib/libssl/src/doc/callback.doc | 240 ++ src/lib/libssl/src/doc/cipher.doc | 345 +++ src/lib/libssl/src/doc/cipher.m | 128 + src/lib/libssl/src/doc/conf.doc | 89 + src/lib/libssl/src/doc/des.doc | 505 ++++ src/lib/libssl/src/doc/digest.doc | 94 + src/lib/libssl/src/doc/encode.doc | 15 + src/lib/libssl/src/doc/envelope.doc | 67 + src/lib/libssl/src/doc/error.doc | 115 + src/lib/libssl/src/doc/legal.doc | 117 + src/lib/libssl/src/doc/lhash.doc | 151 + src/lib/libssl/src/doc/md2.doc | 49 + src/lib/libssl/src/doc/md5.doc | 50 + src/lib/libssl/src/doc/memory.doc | 27 + src/lib/libssl/src/doc/ms3-ca.doc | 398 +++ src/lib/libssl/src/doc/ns-ca.doc | 154 + src/lib/libssl/src/doc/obj.doc | 69 + src/lib/libssl/src/doc/rand.doc | 141 + src/lib/libssl/src/doc/rc2.doc | 165 ++ src/lib/libssl/src/doc/rc4.doc | 44 + src/lib/libssl/src/doc/readme | 6 + src/lib/libssl/src/doc/ref.doc | 48 + src/lib/libssl/src/doc/req.1 | 137 + src/lib/libssl/src/doc/rsa.doc | 135 + src/lib/libssl/src/doc/rsaref.doc | 35 + src/lib/libssl/src/doc/s_mult.doc | 17 + src/lib/libssl/src/doc/session.doc | 297 ++ src/lib/libssl/src/doc/sha.doc | 52 + src/lib/libssl/src/doc/speed.doc | 96 + src/lib/libssl/src/doc/ssl-ciph.doc | 84 + src/lib/libssl/src/doc/ssl.doc | 172 ++ src/lib/libssl/src/doc/ssl_ctx.doc | 68 + src/lib/libssl/src/doc/ssleay.doc | 213 ++ src/lib/libssl/src/doc/ssluse.doc | 45 + src/lib/libssl/src/doc/stack.doc | 96 + src/lib/libssl/src/doc/threads.doc | 90 + src/lib/libssl/src/doc/txt_db.doc | 4 + src/lib/libssl/src/doc/verify | 22 + src/lib/libssl/src/doc/why.doc | 79 + src/lib/libssl/src/makefile.one | 1781 ++++++++++++ src/lib/libssl/src/ms/cipher.out | 93 + src/lib/libssl/src/ms/clear.out | 93 + src/lib/libssl/src/ms/libeay16.def | 987 +++++++ src/lib/libssl/src/ms/libeay32.def | 1035 +++++++ src/lib/libssl/src/ms/ntdll.mak | 1853 ++++++++++++ src/lib/libssl/src/ms/ssleay16.def | 171 ++ src/lib/libssl/src/ms/ssleay32.def | 164 ++ src/lib/libssl/src/ms/w31dll.mak | 2295 +++++++++++++++ src/lib/libssl/src/mt/README | 14 + src/lib/libssl/src/mt/mttest.c | 1115 +++++++ src/lib/libssl/src/mt/profile.sh | 4 + src/lib/libssl/src/mt/ptest.bat | 4 + src/lib/libssl/src/mt/pthread.sh | 9 + src/lib/libssl/src/mt/purify.sh | 4 + src/lib/libssl/src/mt/solaris.sh | 4 + src/lib/libssl/src/mt/win32.bat | 4 + src/lib/libssl/src/perl/MANIFEST | 17 + src/lib/libssl/src/perl/Makefile.PL | 25 + src/lib/libssl/src/perl/SSLeay.pm | 78 + src/lib/libssl/src/perl/SSLeay.xs | 63 + src/lib/libssl/src/perl/b.pl | 21 + src/lib/libssl/src/perl/bio.pl | 28 + src/lib/libssl/src/perl/bio.txt | 36 + src/lib/libssl/src/perl/bio.xs | 448 +++ src/lib/libssl/src/perl/bn.pl | 23 + src/lib/libssl/src/perl/bn.txt | 38 + src/lib/libssl/src/perl/bn.xs | 589 ++++ src/lib/libssl/src/perl/callback.c | 103 + src/lib/libssl/src/perl/cipher.pl | 39 + src/lib/libssl/src/perl/cipher.txt | 10 + src/lib/libssl/src/perl/cipher.xs | 152 + src/lib/libssl/src/perl/dh.pl | 40 + src/lib/libssl/src/perl/digest.txt | 7 + src/lib/libssl/src/perl/digest.xs | 83 + src/lib/libssl/src/perl/err.txt | 2 + src/lib/libssl/src/perl/err.xs | 46 + src/lib/libssl/src/perl/f.pl | 25 + src/lib/libssl/src/perl/g.pl | 18 + src/lib/libssl/src/perl/gen_rsa.pl | 49 + src/lib/libssl/src/perl/mul.pl | 56 + src/lib/libssl/src/perl/p5SSLeay.h | 96 + src/lib/libssl/src/perl/r.pl | 56 + src/lib/libssl/src/perl/s.pl | 72 + src/lib/libssl/src/perl/s2.pl | 49 + src/lib/libssl/src/perl/server.pem | 369 +++ src/lib/libssl/src/perl/ss.pl | 64 + src/lib/libssl/src/perl/ssl.pl | 71 + src/lib/libssl/src/perl/ssl.txt | 43 + src/lib/libssl/src/perl/ssl.xs | 474 +++ src/lib/libssl/src/perl/ssl_srvr.pl | 35 + src/lib/libssl/src/perl/sslbio.pl | 40 + src/lib/libssl/src/perl/t.pl | 12 + src/lib/libssl/src/perl/test | 32 + src/lib/libssl/src/perl/test.pl | 30 + src/lib/libssl/src/perl/test.txt | 36 + src/lib/libssl/src/perl/test2.pl | 28 + src/lib/libssl/src/perl/test3.pl | 19 + src/lib/libssl/src/perl/test8.pl | 19 + src/lib/libssl/src/perl/test9.pl | 38 + src/lib/libssl/src/perl/testbn.pl | 23 + src/lib/libssl/src/perl/testdec.pl | 14 + src/lib/libssl/src/perl/testmd.pl | 26 + src/lib/libssl/src/perl/tt.pl | 15 + src/lib/libssl/src/perl/typemap | 96 + src/lib/libssl/src/perl/x509.txt | 6 + src/lib/libssl/src/perl/x509.xs | 74 + src/lib/libssl/src/perl/xstmp.c | 102 + src/lib/libssl/src/perl/y.pl | 7 + src/lib/libssl/src/perl/yy.pl | 19 + src/lib/libssl/src/perl/z.pl | 32 + src/lib/libssl/src/perl/zz.pl | 22 + src/lib/libssl/src/shlib/linux.sh | 76 + src/lib/libssl/src/ssl/readme | 277 ++ src/lib/libssl/src/ssl/ssl.c | 172 ++ src/lib/libssl/src/ssl/ssl.err | 290 ++ src/lib/libssl/src/test/.rnd | Bin 0 -> 1024 bytes src/lib/libssl/src/test/certCA.srl | 1 + src/lib/libssl/src/test/demoCA/index.txt | 0 src/lib/libssl/src/test/demoCA/private/cakey.pem | 2 + src/lib/libssl/src/test/demoCA/serial | 1 + src/lib/libssl/src/test/dsa-ca.pem | 43 + src/lib/libssl/src/test/dsa-pca.pem | 49 + src/lib/libssl/src/test/p | 294 ++ src/lib/libssl/src/test/riptest | Bin 0 -> 13325 bytes src/lib/libssl/src/test/test.txt | 31 + src/lib/libssl/src/test/testkey.pem | 2 + src/lib/libssl/src/test/testreq.pem | 9 + src/lib/libssl/src/util/mklink.sh | 35 + src/lib/libssl/src/util/ranlib.sh | 23 + src/lib/libssl/src/util/sep_lib.sh | 37 + src/lib/libssl/src/util/ssldir.pl | 52 + src/lib/libssl/src/util/up_ver.pl | 79 + src/lib/libssl/ssl-patent/Makefile | 45 + src/lib/libssl/ssl-patent/shlib_version | 2 + src/lib/libssl/ssl/Makefile | 45 + src/lib/libssl/ssl/shlib_version | 2 + src/lib/libssl/ssleay/Makefile | 38 + src/lib/libssl/test/.rnd | Bin 0 -> 1024 bytes src/lib/libssl/test/certCA.srl | 1 + src/lib/libssl/test/demoCA/index.txt | 0 src/lib/libssl/test/demoCA/private/cakey.pem | 2 + src/lib/libssl/test/demoCA/serial | 1 + src/lib/libssl/test/dsa-ca.pem | 43 + src/lib/libssl/test/dsa-pca.pem | 49 + src/lib/libssl/test/p | 294 ++ src/lib/libssl/test/riptest | Bin 0 -> 13325 bytes src/lib/libssl/test/test.txt | 31 + src/lib/libssl/test/testkey.pem | 2 + src/lib/libssl/test/testreq.pem | 9 + 507 files changed, 115019 insertions(+) create mode 100644 src/lib/libcrypto/asn1/a_bmp.c create mode 100644 src/lib/libcrypto/asn1/asn1.err create mode 100644 src/lib/libcrypto/asn1/d2i_dhp.c create mode 100644 src/lib/libcrypto/asn1/d2i_dsap.c create mode 100644 src/lib/libcrypto/asn1/d2i_r_pr.c create mode 100644 src/lib/libcrypto/asn1/d2i_r_pu.c create mode 100644 src/lib/libcrypto/asn1/d2i_s_pr.c create mode 100644 src/lib/libcrypto/asn1/d2i_s_pu.c create mode 100644 src/lib/libcrypto/asn1/i2d_dhp.c create mode 100644 src/lib/libcrypto/asn1/i2d_dsap.c create mode 100644 src/lib/libcrypto/asn1/i2d_r_pr.c create mode 100644 src/lib/libcrypto/asn1/i2d_r_pu.c create mode 100644 src/lib/libcrypto/asn1/i2d_s_pr.c create mode 100644 src/lib/libcrypto/asn1/i2d_s_pu.c create mode 100644 src/lib/libcrypto/asn1/p7_dgst.c create mode 100644 src/lib/libcrypto/asn1/p7_enc.c create mode 100644 src/lib/libcrypto/asn1/p7_enc_c.c create mode 100644 src/lib/libcrypto/asn1/p7_evp.c create mode 100644 src/lib/libcrypto/asn1/p7_i_s.c create mode 100644 src/lib/libcrypto/asn1/p7_lib.c create mode 100644 src/lib/libcrypto/asn1/p7_recip.c create mode 100644 src/lib/libcrypto/asn1/p7_s_e.c create mode 100644 src/lib/libcrypto/asn1/p7_signd.c create mode 100644 src/lib/libcrypto/asn1/p7_signi.c create mode 100644 src/lib/libcrypto/asn1/pkcs8.c create mode 100644 src/lib/libcrypto/bf/Makefile.uni create mode 100644 src/lib/libcrypto/bf/asm/b-win32.asm create mode 100644 src/lib/libcrypto/bf/asm/bx86unix.cpp create mode 100644 src/lib/libcrypto/bf/bf_locl.org create mode 100644 src/lib/libcrypto/bio/bio.err create mode 100644 src/lib/libcrypto/bn/asm/bn-win32.asm create mode 100644 src/lib/libcrypto/bn/asm/bn86unix.cpp create mode 100644 src/lib/libcrypto/bn/asm/sparc.s create mode 100644 src/lib/libcrypto/bn/asm/x86w16.asm create mode 100644 src/lib/libcrypto/bn/asm/x86w32.asm create mode 100644 src/lib/libcrypto/bn/bn.err create mode 100644 src/lib/libcrypto/bn/bn.org create mode 100644 src/lib/libcrypto/bn/bn_m.c create mode 100644 src/lib/libcrypto/bn/bn_mulw.c create mode 100644 src/lib/libcrypto/bn/bn_sub.c create mode 100644 src/lib/libcrypto/buffer/buffer.err create mode 100644 src/lib/libcrypto/cast/Makefile.uni create mode 100644 src/lib/libcrypto/cast/asm/c-win32.asm create mode 100644 src/lib/libcrypto/cast/asm/cx86unix.cpp create mode 100644 src/lib/libcrypto/conf/conf.c create mode 100644 src/lib/libcrypto/conf/conf.err create mode 100644 src/lib/libcrypto/conf/conf_lcl.h create mode 100644 src/lib/libcrypto/cryptall.h create mode 100644 src/lib/libcrypto/crypto.c create mode 100644 src/lib/libcrypto/crypto.err create mode 100644 src/lib/libcrypto/date.h create mode 100644 src/lib/libcrypto/des/DES.pod create mode 100644 src/lib/libcrypto/des/MODES.DES create mode 100644 src/lib/libcrypto/des/Makefile.PL create mode 100644 src/lib/libcrypto/des/Makefile.lit create mode 100644 src/lib/libcrypto/des/Makefile.uni create mode 100644 src/lib/libcrypto/des/PC1 create mode 100644 src/lib/libcrypto/des/PC2 create mode 100644 src/lib/libcrypto/des/asm/d-win32.asm create mode 100644 src/lib/libcrypto/des/asm/dx86unix.cpp create mode 100644 src/lib/libcrypto/des/asm/y-win32.asm create mode 100644 src/lib/libcrypto/des/asm/yx86unix.cpp create mode 100644 src/lib/libcrypto/des/des.man create mode 100644 src/lib/libcrypto/des/des.org create mode 100644 src/lib/libcrypto/des/des.pl create mode 100644 src/lib/libcrypto/des/des_crypt.man create mode 100644 src/lib/libcrypto/des/des_locl.org create mode 100644 src/lib/libcrypto/des/doIP create mode 100644 src/lib/libcrypto/des/doPC1 create mode 100644 src/lib/libcrypto/des/doPC2 create mode 100644 src/lib/libcrypto/des/ede_enc.c create mode 100644 src/lib/libcrypto/des/podd.h create mode 100644 src/lib/libcrypto/des/ranlib.sh create mode 100644 src/lib/libcrypto/des/shifts.pl create mode 100644 src/lib/libcrypto/des/sk.h create mode 100644 src/lib/libcrypto/des/supp.c create mode 100644 src/lib/libcrypto/des/testdes.pl create mode 100644 src/lib/libcrypto/des/vms.com create mode 100644 src/lib/libcrypto/dh/dh.err create mode 100644 src/lib/libcrypto/dsa/dsa.err create mode 100644 src/lib/libcrypto/err/err_code.pl create mode 100644 src/lib/libcrypto/err/err_genc.pl create mode 100644 src/lib/libcrypto/err/error.err create mode 100644 src/lib/libcrypto/err/ssleay.ec create mode 100644 src/lib/libcrypto/evp/e_cbc_3d.c create mode 100644 src/lib/libcrypto/evp/e_cbc_bf.c create mode 100644 src/lib/libcrypto/evp/e_cbc_c.c create mode 100644 src/lib/libcrypto/evp/e_cbc_d.c create mode 100644 src/lib/libcrypto/evp/e_cbc_i.c create mode 100644 src/lib/libcrypto/evp/e_cbc_r2.c create mode 100644 src/lib/libcrypto/evp/e_cbc_r5.c create mode 100644 src/lib/libcrypto/evp/e_cfb_3d.c create mode 100644 src/lib/libcrypto/evp/e_cfb_bf.c create mode 100644 src/lib/libcrypto/evp/e_cfb_c.c create mode 100644 src/lib/libcrypto/evp/e_cfb_d.c create mode 100644 src/lib/libcrypto/evp/e_cfb_i.c create mode 100644 src/lib/libcrypto/evp/e_cfb_r2.c create mode 100644 src/lib/libcrypto/evp/e_cfb_r5.c create mode 100644 src/lib/libcrypto/evp/e_ecb_3d.c create mode 100644 src/lib/libcrypto/evp/e_ecb_bf.c create mode 100644 src/lib/libcrypto/evp/e_ecb_c.c create mode 100644 src/lib/libcrypto/evp/e_ecb_d.c create mode 100644 src/lib/libcrypto/evp/e_ecb_i.c create mode 100644 src/lib/libcrypto/evp/e_ecb_r2.c create mode 100644 src/lib/libcrypto/evp/e_ecb_r5.c create mode 100644 src/lib/libcrypto/evp/e_ofb_3d.c create mode 100644 src/lib/libcrypto/evp/e_ofb_bf.c create mode 100644 src/lib/libcrypto/evp/e_ofb_c.c create mode 100644 src/lib/libcrypto/evp/e_ofb_d.c create mode 100644 src/lib/libcrypto/evp/e_ofb_i.c create mode 100644 src/lib/libcrypto/evp/e_ofb_r2.c create mode 100644 src/lib/libcrypto/evp/e_ofb_r5.c create mode 100644 src/lib/libcrypto/evp/evp.err create mode 100644 src/lib/libcrypto/evp/pk_lib.c create mode 100644 src/lib/libcrypto/libvms.com create mode 100644 src/lib/libcrypto/md2/md2.org create mode 100644 src/lib/libcrypto/md5/Makefile.uni create mode 100644 src/lib/libcrypto/md5/asm/m5-win32.asm create mode 100644 src/lib/libcrypto/md5/asm/mx86unix.cpp create mode 100644 src/lib/libcrypto/objects/objects.err create mode 100644 src/lib/libcrypto/pem/ctx_size.c create mode 100644 src/lib/libcrypto/pem/pem.err create mode 100644 src/lib/libcrypto/pem/pem.org create mode 100644 src/lib/libcrypto/pkcs7/README create mode 100644 src/lib/libcrypto/pkcs7/mf.p7 create mode 100644 src/lib/libcrypto/pkcs7/p7.tst create mode 100644 src/lib/libcrypto/pkcs7/pkcs7.err create mode 100644 src/lib/libcrypto/ranlib.sh create mode 100644 src/lib/libcrypto/rc2/Makefile.uni create mode 100644 src/lib/libcrypto/rc2/rc2.org create mode 100644 src/lib/libcrypto/rc4/Makefile.uni create mode 100644 src/lib/libcrypto/rc4/asm/r4-win32.asm create mode 100644 src/lib/libcrypto/rc4/asm/rx86unix.cpp create mode 100644 src/lib/libcrypto/rc4/rc4.org create mode 100644 src/lib/libcrypto/rc4/rc4_locl.org create mode 100644 src/lib/libcrypto/rc5/Makefile.uni create mode 100644 src/lib/libcrypto/rc5/asm/r5-win32.asm create mode 100644 src/lib/libcrypto/rc5/asm/r586unix.cpp create mode 100644 src/lib/libcrypto/ripemd/Makefile.uni create mode 100644 src/lib/libcrypto/ripemd/asm/rm-win32.asm create mode 100644 src/lib/libcrypto/ripemd/asm/rm86unix.cpp create mode 100644 src/lib/libcrypto/rsa/rsa.err create mode 100644 src/lib/libcrypto/sha/Makefile.uni create mode 100644 src/lib/libcrypto/sha/asm/s1-win32.asm create mode 100644 src/lib/libcrypto/sha/asm/sx86unix.cpp create mode 100644 src/lib/libcrypto/sha/sha_sgst.c create mode 100644 src/lib/libcrypto/util/mklink.sh create mode 100644 src/lib/libcrypto/util/ranlib.sh create mode 100644 src/lib/libcrypto/util/sep_lib.sh create mode 100644 src/lib/libcrypto/util/ssldir.pl create mode 100644 src/lib/libcrypto/util/up_ver.pl create mode 100644 src/lib/libcrypto/x509/attrib create mode 100644 src/lib/libcrypto/x509/v3_net.c create mode 100644 src/lib/libcrypto/x509/v3_x509.c create mode 100644 src/lib/libcrypto/x509/x509.doc create mode 100644 src/lib/libcrypto/x509/x509.err create mode 100644 src/lib/libcrypto/x509/x509pack.c create mode 100644 src/lib/libcrypto/x509/x509v3.doc create mode 100644 src/lib/libcrypto/x509v3/format create mode 100644 src/lib/libcrypto/x509v3/header create mode 100644 src/lib/libcrypto/x509v3/v3_ku.c create mode 100644 src/lib/libssl/Makefile create mode 100644 src/lib/libssl/Makefile.bsd-wrapper create mode 100644 src/lib/libssl/README.OPENBSD create mode 100644 src/lib/libssl/crypto-patent/Makefile create mode 100644 src/lib/libssl/crypto-patent/shlib_version create mode 100644 src/lib/libssl/crypto/Makefile create mode 100644 src/lib/libssl/crypto/shlib_version create mode 100644 src/lib/libssl/src/COPYRIGHT create mode 100644 src/lib/libssl/src/HISTORY create mode 100644 src/lib/libssl/src/HISTORY.066 create mode 100644 src/lib/libssl/src/MICROSOFT create mode 100644 src/lib/libssl/src/MINFO create mode 100644 src/lib/libssl/src/PATENTS create mode 100644 src/lib/libssl/src/README.066 create mode 100644 src/lib/libssl/src/README.080 create mode 100644 src/lib/libssl/src/README.090 create mode 100644 src/lib/libssl/src/TODO create mode 100644 src/lib/libssl/src/VERSION create mode 100644 src/lib/libssl/src/apps/eay.c create mode 100644 src/lib/libssl/src/apps/ext.v3 create mode 100644 src/lib/libssl/src/apps/g_ssleay.pl create mode 100644 src/lib/libssl/src/apps/mklinks create mode 100644 src/lib/libssl/src/apps/pem_mail.c create mode 100644 src/lib/libssl/src/apps/rmlinks create mode 100644 src/lib/libssl/src/apps/ssleay.c create mode 100644 src/lib/libssl/src/apps/ssleay.cnf create mode 100644 src/lib/libssl/src/apps/tkca create mode 100644 src/lib/libssl/src/certs/rsa-ssca.pem create mode 100644 src/lib/libssl/src/certs/vsign4.pem create mode 100644 src/lib/libssl/src/crypto/asn1/a_bmp.c create mode 100644 src/lib/libssl/src/crypto/asn1/asn1.err create mode 100644 src/lib/libssl/src/crypto/asn1/d2i_dhp.c create mode 100644 src/lib/libssl/src/crypto/asn1/d2i_dsap.c create mode 100644 src/lib/libssl/src/crypto/asn1/d2i_r_pr.c create mode 100644 src/lib/libssl/src/crypto/asn1/d2i_r_pu.c create mode 100644 src/lib/libssl/src/crypto/asn1/d2i_s_pr.c create mode 100644 src/lib/libssl/src/crypto/asn1/d2i_s_pu.c create mode 100644 src/lib/libssl/src/crypto/asn1/i2d_dhp.c create mode 100644 src/lib/libssl/src/crypto/asn1/i2d_dsap.c create mode 100644 src/lib/libssl/src/crypto/asn1/i2d_r_pr.c create mode 100644 src/lib/libssl/src/crypto/asn1/i2d_r_pu.c create mode 100644 src/lib/libssl/src/crypto/asn1/i2d_s_pr.c create mode 100644 src/lib/libssl/src/crypto/asn1/i2d_s_pu.c create mode 100644 src/lib/libssl/src/crypto/asn1/p7_dgst.c create mode 100644 src/lib/libssl/src/crypto/asn1/p7_enc.c create mode 100644 src/lib/libssl/src/crypto/asn1/p7_enc_c.c create mode 100644 src/lib/libssl/src/crypto/asn1/p7_evp.c create mode 100644 src/lib/libssl/src/crypto/asn1/p7_i_s.c create mode 100644 src/lib/libssl/src/crypto/asn1/p7_lib.c create mode 100644 src/lib/libssl/src/crypto/asn1/p7_recip.c create mode 100644 src/lib/libssl/src/crypto/asn1/p7_s_e.c create mode 100644 src/lib/libssl/src/crypto/asn1/p7_signd.c create mode 100644 src/lib/libssl/src/crypto/asn1/p7_signi.c create mode 100644 src/lib/libssl/src/crypto/asn1/pkcs8.c create mode 100644 src/lib/libssl/src/crypto/bf/Makefile.uni create mode 100644 src/lib/libssl/src/crypto/bf/asm/b-win32.asm create mode 100644 src/lib/libssl/src/crypto/bf/asm/bx86unix.cpp create mode 100644 src/lib/libssl/src/crypto/bf/bf_locl.org create mode 100644 src/lib/libssl/src/crypto/bio/bio.err create mode 100644 src/lib/libssl/src/crypto/bn/asm/bn-win32.asm create mode 100644 src/lib/libssl/src/crypto/bn/asm/bn86unix.cpp create mode 100644 src/lib/libssl/src/crypto/bn/asm/sparc.s create mode 100644 src/lib/libssl/src/crypto/bn/asm/x86w16.asm create mode 100644 src/lib/libssl/src/crypto/bn/asm/x86w32.asm create mode 100644 src/lib/libssl/src/crypto/bn/bn.err create mode 100644 src/lib/libssl/src/crypto/bn/bn.org create mode 100644 src/lib/libssl/src/crypto/bn/bn_m.c create mode 100644 src/lib/libssl/src/crypto/bn/bn_mulw.c create mode 100644 src/lib/libssl/src/crypto/bn/bn_sub.c create mode 100644 src/lib/libssl/src/crypto/buffer/buffer.err create mode 100644 src/lib/libssl/src/crypto/cast/Makefile.uni create mode 100644 src/lib/libssl/src/crypto/cast/asm/c-win32.asm create mode 100644 src/lib/libssl/src/crypto/cast/asm/cx86unix.cpp create mode 100644 src/lib/libssl/src/crypto/conf/conf.c create mode 100644 src/lib/libssl/src/crypto/conf/conf.err create mode 100644 src/lib/libssl/src/crypto/conf/conf_lcl.h create mode 100644 src/lib/libssl/src/crypto/cryptall.h create mode 100644 src/lib/libssl/src/crypto/crypto.c create mode 100644 src/lib/libssl/src/crypto/crypto.err create mode 100644 src/lib/libssl/src/crypto/date.h create mode 100644 src/lib/libssl/src/crypto/des/DES.pod create mode 100644 src/lib/libssl/src/crypto/des/MODES.DES create mode 100644 src/lib/libssl/src/crypto/des/Makefile.PL create mode 100644 src/lib/libssl/src/crypto/des/Makefile.lit create mode 100644 src/lib/libssl/src/crypto/des/Makefile.uni create mode 100644 src/lib/libssl/src/crypto/des/PC1 create mode 100644 src/lib/libssl/src/crypto/des/PC2 create mode 100644 src/lib/libssl/src/crypto/des/asm/d-win32.asm create mode 100644 src/lib/libssl/src/crypto/des/asm/dx86unix.cpp create mode 100644 src/lib/libssl/src/crypto/des/asm/y-win32.asm create mode 100644 src/lib/libssl/src/crypto/des/asm/yx86unix.cpp create mode 100644 src/lib/libssl/src/crypto/des/des.man create mode 100644 src/lib/libssl/src/crypto/des/des.org create mode 100644 src/lib/libssl/src/crypto/des/des.pl create mode 100644 src/lib/libssl/src/crypto/des/des_crypt.man create mode 100644 src/lib/libssl/src/crypto/des/des_locl.org create mode 100644 src/lib/libssl/src/crypto/des/doIP create mode 100644 src/lib/libssl/src/crypto/des/doPC1 create mode 100644 src/lib/libssl/src/crypto/des/doPC2 create mode 100644 src/lib/libssl/src/crypto/des/ede_enc.c create mode 100644 src/lib/libssl/src/crypto/des/podd.h create mode 100644 src/lib/libssl/src/crypto/des/ranlib.sh create mode 100644 src/lib/libssl/src/crypto/des/shifts.pl create mode 100644 src/lib/libssl/src/crypto/des/sk.h create mode 100644 src/lib/libssl/src/crypto/des/supp.c create mode 100644 src/lib/libssl/src/crypto/des/testdes.pl create mode 100644 src/lib/libssl/src/crypto/des/vms.com create mode 100644 src/lib/libssl/src/crypto/dh/dh.err create mode 100644 src/lib/libssl/src/crypto/dsa/dsa.err create mode 100644 src/lib/libssl/src/crypto/err/err_code.pl create mode 100644 src/lib/libssl/src/crypto/err/err_genc.pl create mode 100644 src/lib/libssl/src/crypto/err/error.err create mode 100644 src/lib/libssl/src/crypto/err/ssleay.ec create mode 100644 src/lib/libssl/src/crypto/evp/e_cbc_3d.c create mode 100644 src/lib/libssl/src/crypto/evp/e_cbc_bf.c create mode 100644 src/lib/libssl/src/crypto/evp/e_cbc_c.c create mode 100644 src/lib/libssl/src/crypto/evp/e_cbc_d.c create mode 100644 src/lib/libssl/src/crypto/evp/e_cbc_i.c create mode 100644 src/lib/libssl/src/crypto/evp/e_cbc_r2.c create mode 100644 src/lib/libssl/src/crypto/evp/e_cbc_r5.c create mode 100644 src/lib/libssl/src/crypto/evp/e_cfb_3d.c create mode 100644 src/lib/libssl/src/crypto/evp/e_cfb_bf.c create mode 100644 src/lib/libssl/src/crypto/evp/e_cfb_c.c create mode 100644 src/lib/libssl/src/crypto/evp/e_cfb_d.c create mode 100644 src/lib/libssl/src/crypto/evp/e_cfb_i.c create mode 100644 src/lib/libssl/src/crypto/evp/e_cfb_r2.c create mode 100644 src/lib/libssl/src/crypto/evp/e_cfb_r5.c create mode 100644 src/lib/libssl/src/crypto/evp/e_ecb_3d.c create mode 100644 src/lib/libssl/src/crypto/evp/e_ecb_bf.c create mode 100644 src/lib/libssl/src/crypto/evp/e_ecb_c.c create mode 100644 src/lib/libssl/src/crypto/evp/e_ecb_d.c create mode 100644 src/lib/libssl/src/crypto/evp/e_ecb_i.c create mode 100644 src/lib/libssl/src/crypto/evp/e_ecb_r2.c create mode 100644 src/lib/libssl/src/crypto/evp/e_ecb_r5.c create mode 100644 src/lib/libssl/src/crypto/evp/e_ofb_3d.c create mode 100644 src/lib/libssl/src/crypto/evp/e_ofb_bf.c create mode 100644 src/lib/libssl/src/crypto/evp/e_ofb_c.c create mode 100644 src/lib/libssl/src/crypto/evp/e_ofb_d.c create mode 100644 src/lib/libssl/src/crypto/evp/e_ofb_i.c create mode 100644 src/lib/libssl/src/crypto/evp/e_ofb_r2.c create mode 100644 src/lib/libssl/src/crypto/evp/e_ofb_r5.c create mode 100644 src/lib/libssl/src/crypto/evp/evp.err create mode 100644 src/lib/libssl/src/crypto/evp/pk_lib.c create mode 100644 src/lib/libssl/src/crypto/libvms.com create mode 100644 src/lib/libssl/src/crypto/md2/md2.org create mode 100644 src/lib/libssl/src/crypto/md5/Makefile.uni create mode 100644 src/lib/libssl/src/crypto/md5/asm/m5-win32.asm create mode 100644 src/lib/libssl/src/crypto/md5/asm/mx86unix.cpp create mode 100644 src/lib/libssl/src/crypto/objects/objects.err create mode 100644 src/lib/libssl/src/crypto/pem/ctx_size.c create mode 100644 src/lib/libssl/src/crypto/pem/pem.err create mode 100644 src/lib/libssl/src/crypto/pem/pem.org create mode 100644 src/lib/libssl/src/crypto/pkcs7/README create mode 100644 src/lib/libssl/src/crypto/pkcs7/mf.p7 create mode 100644 src/lib/libssl/src/crypto/pkcs7/p7.tst create mode 100644 src/lib/libssl/src/crypto/pkcs7/pkcs7.err create mode 100644 src/lib/libssl/src/crypto/ranlib.sh create mode 100644 src/lib/libssl/src/crypto/rc2/Makefile.uni create mode 100644 src/lib/libssl/src/crypto/rc2/rc2.org create mode 100644 src/lib/libssl/src/crypto/rc4/Makefile.uni create mode 100644 src/lib/libssl/src/crypto/rc4/asm/r4-win32.asm create mode 100644 src/lib/libssl/src/crypto/rc4/asm/rx86unix.cpp create mode 100644 src/lib/libssl/src/crypto/rc4/rc4.org create mode 100644 src/lib/libssl/src/crypto/rc4/rc4_locl.org create mode 100644 src/lib/libssl/src/crypto/rc5/Makefile.uni create mode 100644 src/lib/libssl/src/crypto/rc5/asm/r5-win32.asm create mode 100644 src/lib/libssl/src/crypto/rc5/asm/r586unix.cpp create mode 100644 src/lib/libssl/src/crypto/ripemd/Makefile.uni create mode 100644 src/lib/libssl/src/crypto/ripemd/asm/rm-win32.asm create mode 100644 src/lib/libssl/src/crypto/ripemd/asm/rm86unix.cpp create mode 100644 src/lib/libssl/src/crypto/rsa/rsa.err create mode 100644 src/lib/libssl/src/crypto/sha/Makefile.uni create mode 100644 src/lib/libssl/src/crypto/sha/asm/s1-win32.asm create mode 100644 src/lib/libssl/src/crypto/sha/asm/sx86unix.cpp create mode 100644 src/lib/libssl/src/crypto/sha/sha_sgst.c create mode 100644 src/lib/libssl/src/crypto/x509/attrib create mode 100644 src/lib/libssl/src/crypto/x509/v3_net.c create mode 100644 src/lib/libssl/src/crypto/x509/v3_x509.c create mode 100644 src/lib/libssl/src/crypto/x509/x509.doc create mode 100644 src/lib/libssl/src/crypto/x509/x509.err create mode 100644 src/lib/libssl/src/crypto/x509/x509pack.c create mode 100644 src/lib/libssl/src/crypto/x509/x509v3.doc create mode 100644 src/lib/libssl/src/crypto/x509v3/format create mode 100644 src/lib/libssl/src/crypto/x509v3/header create mode 100644 src/lib/libssl/src/crypto/x509v3/v3_ku.c create mode 100644 src/lib/libssl/src/dep/crypto.txt create mode 100644 src/lib/libssl/src/dep/files create mode 100644 src/lib/libssl/src/dep/gen.pl create mode 100644 src/lib/libssl/src/dep/ssl.txt create mode 100644 src/lib/libssl/src/doc/API.doc create mode 100644 src/lib/libssl/src/doc/a_verify.doc create mode 100644 src/lib/libssl/src/doc/apps.doc create mode 100644 src/lib/libssl/src/doc/asn1.doc create mode 100644 src/lib/libssl/src/doc/bio.doc create mode 100644 src/lib/libssl/src/doc/blowfish.doc create mode 100644 src/lib/libssl/src/doc/bn.doc create mode 100644 src/lib/libssl/src/doc/ca.1 create mode 100644 src/lib/libssl/src/doc/callback.doc create mode 100644 src/lib/libssl/src/doc/cipher.doc create mode 100644 src/lib/libssl/src/doc/cipher.m create mode 100644 src/lib/libssl/src/doc/conf.doc create mode 100644 src/lib/libssl/src/doc/des.doc create mode 100644 src/lib/libssl/src/doc/digest.doc create mode 100644 src/lib/libssl/src/doc/encode.doc create mode 100644 src/lib/libssl/src/doc/envelope.doc create mode 100644 src/lib/libssl/src/doc/error.doc create mode 100644 src/lib/libssl/src/doc/legal.doc create mode 100644 src/lib/libssl/src/doc/lhash.doc create mode 100644 src/lib/libssl/src/doc/md2.doc create mode 100644 src/lib/libssl/src/doc/md5.doc create mode 100644 src/lib/libssl/src/doc/memory.doc create mode 100644 src/lib/libssl/src/doc/ms3-ca.doc create mode 100644 src/lib/libssl/src/doc/ns-ca.doc create mode 100644 src/lib/libssl/src/doc/obj.doc create mode 100644 src/lib/libssl/src/doc/rand.doc create mode 100644 src/lib/libssl/src/doc/rc2.doc create mode 100644 src/lib/libssl/src/doc/rc4.doc create mode 100644 src/lib/libssl/src/doc/readme create mode 100644 src/lib/libssl/src/doc/ref.doc create mode 100644 src/lib/libssl/src/doc/req.1 create mode 100644 src/lib/libssl/src/doc/rsa.doc create mode 100644 src/lib/libssl/src/doc/rsaref.doc create mode 100644 src/lib/libssl/src/doc/s_mult.doc create mode 100644 src/lib/libssl/src/doc/session.doc create mode 100644 src/lib/libssl/src/doc/sha.doc create mode 100644 src/lib/libssl/src/doc/speed.doc create mode 100644 src/lib/libssl/src/doc/ssl-ciph.doc create mode 100644 src/lib/libssl/src/doc/ssl.doc create mode 100644 src/lib/libssl/src/doc/ssl_ctx.doc create mode 100644 src/lib/libssl/src/doc/ssleay.doc create mode 100644 src/lib/libssl/src/doc/ssluse.doc create mode 100644 src/lib/libssl/src/doc/stack.doc create mode 100644 src/lib/libssl/src/doc/threads.doc create mode 100644 src/lib/libssl/src/doc/txt_db.doc create mode 100644 src/lib/libssl/src/doc/verify create mode 100644 src/lib/libssl/src/doc/why.doc create mode 100644 src/lib/libssl/src/makefile.one create mode 100644 src/lib/libssl/src/ms/cipher.out create mode 100644 src/lib/libssl/src/ms/clear.out create mode 100644 src/lib/libssl/src/ms/libeay16.def create mode 100644 src/lib/libssl/src/ms/libeay32.def create mode 100644 src/lib/libssl/src/ms/ntdll.mak create mode 100644 src/lib/libssl/src/ms/ssleay16.def create mode 100644 src/lib/libssl/src/ms/ssleay32.def create mode 100644 src/lib/libssl/src/ms/w31dll.mak create mode 100644 src/lib/libssl/src/mt/README create mode 100644 src/lib/libssl/src/mt/mttest.c create mode 100644 src/lib/libssl/src/mt/profile.sh create mode 100644 src/lib/libssl/src/mt/ptest.bat create mode 100644 src/lib/libssl/src/mt/pthread.sh create mode 100644 src/lib/libssl/src/mt/purify.sh create mode 100644 src/lib/libssl/src/mt/solaris.sh create mode 100644 src/lib/libssl/src/mt/win32.bat create mode 100644 src/lib/libssl/src/perl/MANIFEST create mode 100644 src/lib/libssl/src/perl/Makefile.PL create mode 100644 src/lib/libssl/src/perl/SSLeay.pm create mode 100644 src/lib/libssl/src/perl/SSLeay.xs create mode 100644 src/lib/libssl/src/perl/b.pl create mode 100644 src/lib/libssl/src/perl/bio.pl create mode 100644 src/lib/libssl/src/perl/bio.txt create mode 100644 src/lib/libssl/src/perl/bio.xs create mode 100644 src/lib/libssl/src/perl/bn.pl create mode 100644 src/lib/libssl/src/perl/bn.txt create mode 100644 src/lib/libssl/src/perl/bn.xs create mode 100644 src/lib/libssl/src/perl/callback.c create mode 100644 src/lib/libssl/src/perl/cipher.pl create mode 100644 src/lib/libssl/src/perl/cipher.txt create mode 100644 src/lib/libssl/src/perl/cipher.xs create mode 100644 src/lib/libssl/src/perl/dh.pl create mode 100644 src/lib/libssl/src/perl/digest.txt create mode 100644 src/lib/libssl/src/perl/digest.xs create mode 100644 src/lib/libssl/src/perl/err.txt create mode 100644 src/lib/libssl/src/perl/err.xs create mode 100644 src/lib/libssl/src/perl/f.pl create mode 100644 src/lib/libssl/src/perl/g.pl create mode 100644 src/lib/libssl/src/perl/gen_rsa.pl create mode 100644 src/lib/libssl/src/perl/mul.pl create mode 100644 src/lib/libssl/src/perl/p5SSLeay.h create mode 100644 src/lib/libssl/src/perl/r.pl create mode 100644 src/lib/libssl/src/perl/s.pl create mode 100644 src/lib/libssl/src/perl/s2.pl create mode 100644 src/lib/libssl/src/perl/server.pem create mode 100644 src/lib/libssl/src/perl/ss.pl create mode 100644 src/lib/libssl/src/perl/ssl.pl create mode 100644 src/lib/libssl/src/perl/ssl.txt create mode 100644 src/lib/libssl/src/perl/ssl.xs create mode 100644 src/lib/libssl/src/perl/ssl_srvr.pl create mode 100644 src/lib/libssl/src/perl/sslbio.pl create mode 100644 src/lib/libssl/src/perl/t.pl create mode 100644 src/lib/libssl/src/perl/test create mode 100644 src/lib/libssl/src/perl/test.pl create mode 100644 src/lib/libssl/src/perl/test.txt create mode 100644 src/lib/libssl/src/perl/test2.pl create mode 100644 src/lib/libssl/src/perl/test3.pl create mode 100644 src/lib/libssl/src/perl/test8.pl create mode 100644 src/lib/libssl/src/perl/test9.pl create mode 100644 src/lib/libssl/src/perl/testbn.pl create mode 100644 src/lib/libssl/src/perl/testdec.pl create mode 100644 src/lib/libssl/src/perl/testmd.pl create mode 100644 src/lib/libssl/src/perl/tt.pl create mode 100644 src/lib/libssl/src/perl/typemap create mode 100644 src/lib/libssl/src/perl/x509.txt create mode 100644 src/lib/libssl/src/perl/x509.xs create mode 100644 src/lib/libssl/src/perl/xstmp.c create mode 100644 src/lib/libssl/src/perl/y.pl create mode 100644 src/lib/libssl/src/perl/yy.pl create mode 100644 src/lib/libssl/src/perl/z.pl create mode 100644 src/lib/libssl/src/perl/zz.pl create mode 100644 src/lib/libssl/src/shlib/linux.sh create mode 100644 src/lib/libssl/src/ssl/readme create mode 100644 src/lib/libssl/src/ssl/ssl.c create mode 100644 src/lib/libssl/src/ssl/ssl.err create mode 100644 src/lib/libssl/src/test/.rnd create mode 100644 src/lib/libssl/src/test/certCA.srl create mode 100644 src/lib/libssl/src/test/demoCA/index.txt create mode 100644 src/lib/libssl/src/test/demoCA/private/cakey.pem create mode 100644 src/lib/libssl/src/test/demoCA/serial create mode 100644 src/lib/libssl/src/test/dsa-ca.pem create mode 100644 src/lib/libssl/src/test/dsa-pca.pem create mode 100644 src/lib/libssl/src/test/p create mode 100644 src/lib/libssl/src/test/riptest create mode 100644 src/lib/libssl/src/test/test.txt create mode 100644 src/lib/libssl/src/test/testkey.pem create mode 100644 src/lib/libssl/src/test/testreq.pem create mode 100644 src/lib/libssl/src/util/mklink.sh create mode 100644 src/lib/libssl/src/util/ranlib.sh create mode 100644 src/lib/libssl/src/util/sep_lib.sh create mode 100644 src/lib/libssl/src/util/ssldir.pl create mode 100644 src/lib/libssl/src/util/up_ver.pl create mode 100644 src/lib/libssl/ssl-patent/Makefile create mode 100644 src/lib/libssl/ssl-patent/shlib_version create mode 100644 src/lib/libssl/ssl/Makefile create mode 100644 src/lib/libssl/ssl/shlib_version create mode 100644 src/lib/libssl/ssleay/Makefile create mode 100644 src/lib/libssl/test/.rnd create mode 100644 src/lib/libssl/test/certCA.srl create mode 100644 src/lib/libssl/test/demoCA/index.txt create mode 100644 src/lib/libssl/test/demoCA/private/cakey.pem create mode 100644 src/lib/libssl/test/demoCA/serial create mode 100644 src/lib/libssl/test/dsa-ca.pem create mode 100644 src/lib/libssl/test/dsa-pca.pem create mode 100644 src/lib/libssl/test/p create mode 100644 src/lib/libssl/test/riptest create mode 100644 src/lib/libssl/test/test.txt create mode 100644 src/lib/libssl/test/testkey.pem create mode 100644 src/lib/libssl/test/testreq.pem diff --git a/src/lib/libcrypto/asn1/a_bmp.c b/src/lib/libcrypto/asn1/a_bmp.c new file mode 100644 index 0000000000..774502b1fc --- /dev/null +++ b/src/lib/libcrypto/asn1/a_bmp.c @@ -0,0 +1,90 @@ +/* crypto/asn1/a_bmp.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1.h" + +/* ASN1err(ASN1_F_D2I_ASN1_INTEGER,ASN1_R_EXPECTING_AN_INTEGER); + */ + +int i2d_ASN1_BMPSTRING(a, pp) +ASN1_BMPSTRING *a; +unsigned char **pp; + { + return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, + V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL)); + } + +ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(a, pp, length) +ASN1_BMPSTRING **a; +unsigned char **pp; +long length; + { + ASN1_BMPSTRING *ret=NULL; + + ret=(ASN1_BMPSTRING *)d2i_ASN1_bytes((ASN1_STRING **)a, + pp,length,V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL); + if (ret == NULL) + { + ASN1err(ASN1_F_D2I_ASN1_BMPSTRING,ASN1_R_ERROR_STACK); + return(NULL); + } + return(ret); + } + diff --git a/src/lib/libcrypto/asn1/asn1.err b/src/lib/libcrypto/asn1/asn1.err new file mode 100644 index 0000000000..c8b7011488 --- /dev/null +++ b/src/lib/libcrypto/asn1/asn1.err @@ -0,0 +1,182 @@ +/* Error codes for the ASN1 functions. */ + +/* Function codes. */ +#define ASN1_F_A2D_ASN1_OBJECT 100 +#define ASN1_F_A2I_ASN1_INTEGER 101 +#define ASN1_F_A2I_ASN1_STRING 102 +#define ASN1_F_ASN1_COLLATE_PRIMATIVE 103 +#define ASN1_F_ASN1_D2I_BIO 104 +#define ASN1_F_ASN1_D2I_FP 105 +#define ASN1_F_ASN1_DUP 106 +#define ASN1_F_ASN1_GET_OBJECT 107 +#define ASN1_F_ASN1_HEADER_NEW 108 +#define ASN1_F_ASN1_I2D_BIO 109 +#define ASN1_F_ASN1_I2D_FP 110 +#define ASN1_F_ASN1_INTEGER_SET 111 +#define ASN1_F_ASN1_INTEGER_TO_BN 112 +#define ASN1_F_ASN1_OBJECT_NEW 113 +#define ASN1_F_ASN1_SIGN 114 +#define ASN1_F_ASN1_STRING_NEW 115 +#define ASN1_F_ASN1_STRING_TYPE_NEW 116 +#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 117 +#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 118 +#define ASN1_F_ASN1_TYPE_NEW 119 +#define ASN1_F_ASN1_UTCTIME_NEW 120 +#define ASN1_F_ASN1_VERIFY 121 +#define ASN1_F_BN_TO_ASN1_INTEGER 122 +#define ASN1_F_D2I_ASN1_BIT_STRING 123 +#define ASN1_F_D2I_ASN1_BMPSTRING 124 +#define ASN1_F_D2I_ASN1_BOOLEAN 125 +#define ASN1_F_D2I_ASN1_BYTES 126 +#define ASN1_F_D2I_ASN1_HEADER 127 +#define ASN1_F_D2I_ASN1_INTEGER 128 +#define ASN1_F_D2I_ASN1_OBJECT 129 +#define ASN1_F_D2I_ASN1_OCTET_STRING 130 +#define ASN1_F_D2I_ASN1_PRINT_TYPE 131 +#define ASN1_F_D2I_ASN1_SET 132 +#define ASN1_F_D2I_ASN1_TYPE 133 +#define ASN1_F_D2I_ASN1_TYPE_BYTES 134 +#define ASN1_F_D2I_ASN1_UTCTIME 135 +#define ASN1_F_D2I_DHPARAMS 136 +#define ASN1_F_D2I_DSAPARAMS 137 +#define ASN1_F_D2I_DSAPRIVATEKEY 138 +#define ASN1_F_D2I_DSAPUBLICKEY 139 +#define ASN1_F_D2I_NETSCAPE_PKEY 140 +#define ASN1_F_D2I_NETSCAPE_RSA 141 +#define ASN1_F_D2I_NETSCAPE_RSA_2 142 +#define ASN1_F_D2I_NETSCAPE_SPKAC 143 +#define ASN1_F_D2I_NETSCAPE_SPKI 144 +#define ASN1_F_D2I_PKCS7 145 +#define ASN1_F_D2I_PKCS7_DIGEST 146 +#define ASN1_F_D2I_PKCS7_ENCRYPT 147 +#define ASN1_F_D2I_PKCS7_ENC_CONTENT 148 +#define ASN1_F_D2I_PKCS7_ENVELOPE 149 +#define ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL 150 +#define ASN1_F_D2I_PKCS7_RECIP_INFO 151 +#define ASN1_F_D2I_PKCS7_SIGNED 152 +#define ASN1_F_D2I_PKCS7_SIGNER_INFO 153 +#define ASN1_F_D2I_PKCS7_SIGN_ENVELOPE 154 +#define ASN1_F_D2I_PRIVATEKEY 155 +#define ASN1_F_D2I_PUBLICKEY 156 +#define ASN1_F_D2I_RSAPRIVATEKEY 157 +#define ASN1_F_D2I_RSAPUBLICKEY 158 +#define ASN1_F_D2I_X509 159 +#define ASN1_F_D2I_X509_ALGOR 160 +#define ASN1_F_D2I_X509_ATTRIBUTE 161 +#define ASN1_F_D2I_X509_CINF 162 +#define ASN1_F_D2I_X509_CRL 163 +#define ASN1_F_D2I_X509_CRL_INFO 164 +#define ASN1_F_D2I_X509_EXTENSION 165 +#define ASN1_F_D2I_X509_KEY 166 +#define ASN1_F_D2I_X509_NAME 167 +#define ASN1_F_D2I_X509_NAME_ENTRY 168 +#define ASN1_F_D2I_X509_PKEY 169 +#define ASN1_F_D2I_X509_PUBKEY 170 +#define ASN1_F_D2I_X509_REQ 171 +#define ASN1_F_D2I_X509_REQ_INFO 172 +#define ASN1_F_D2I_X509_REVOKED 173 +#define ASN1_F_D2I_X509_SIG 174 +#define ASN1_F_D2I_X509_VAL 175 +#define ASN1_F_I2D_ASN1_HEADER 176 +#define ASN1_F_I2D_DHPARAMS 177 +#define ASN1_F_I2D_DSAPARAMS 178 +#define ASN1_F_I2D_DSAPRIVATEKEY 179 +#define ASN1_F_I2D_DSAPUBLICKEY 180 +#define ASN1_F_I2D_NETSCAPE_RSA 181 +#define ASN1_F_I2D_PKCS7 182 +#define ASN1_F_I2D_PRIVATEKEY 183 +#define ASN1_F_I2D_PUBLICKEY 184 +#define ASN1_F_I2D_RSAPRIVATEKEY 185 +#define ASN1_F_I2D_RSAPUBLICKEY 186 +#define ASN1_F_I2D_X509_ATTRIBUTE 187 +#define ASN1_F_I2T_ASN1_OBJECT 188 +#define ASN1_F_NETSCAPE_PKEY_NEW 189 +#define ASN1_F_NETSCAPE_SPKAC_NEW 190 +#define ASN1_F_NETSCAPE_SPKI_NEW 191 +#define ASN1_F_PKCS7_DIGEST_NEW 192 +#define ASN1_F_PKCS7_ENCRYPT_NEW 193 +#define ASN1_F_PKCS7_ENC_CONTENT_NEW 194 +#define ASN1_F_PKCS7_ENVELOPE_NEW 195 +#define ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW 196 +#define ASN1_F_PKCS7_NEW 197 +#define ASN1_F_PKCS7_RECIP_INFO_NEW 198 +#define ASN1_F_PKCS7_SIGNED_NEW 199 +#define ASN1_F_PKCS7_SIGNER_INFO_NEW 200 +#define ASN1_F_PKCS7_SIGN_ENVELOPE_NEW 201 +#define ASN1_F_X509_ALGOR_NEW 202 +#define ASN1_F_X509_ATTRIBUTE_NEW 203 +#define ASN1_F_X509_CINF_NEW 204 +#define ASN1_F_X509_CRL_INFO_NEW 205 +#define ASN1_F_X509_CRL_NEW 206 +#define ASN1_F_X509_DHPARAMS_NEW 207 +#define ASN1_F_X509_EXTENSION_NEW 208 +#define ASN1_F_X509_INFO_NEW 209 +#define ASN1_F_X509_KEY_NEW 210 +#define ASN1_F_X509_NAME_ENTRY_NEW 211 +#define ASN1_F_X509_NAME_NEW 212 +#define ASN1_F_X509_NEW 213 +#define ASN1_F_X509_PKEY_NEW 214 +#define ASN1_F_X509_PUBKEY_NEW 215 +#define ASN1_F_X509_REQ_INFO_NEW 216 +#define ASN1_F_X509_REQ_NEW 217 +#define ASN1_F_X509_REVOKED_NEW 218 +#define ASN1_F_X509_SIG_NEW 219 +#define ASN1_F_X509_VAL_FREE 220 +#define ASN1_F_X509_VAL_NEW 221 + +/* Reason codes. */ +#define ASN1_R_BAD_CLASS 100 +#define ASN1_R_BAD_GET_OBJECT 101 +#define ASN1_R_BAD_OBJECT_HEADER 102 +#define ASN1_R_BAD_PASSWORD_READ 103 +#define ASN1_R_BAD_PKCS7_CONTENT 104 +#define ASN1_R_BAD_PKCS7_TYPE 105 +#define ASN1_R_BAD_TAG 106 +#define ASN1_R_BAD_TYPE 107 +#define ASN1_R_BN_LIB 108 +#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 109 +#define ASN1_R_BUFFER_TOO_SMALL 110 +#define ASN1_R_DATA_IS_WRONG 111 +#define ASN1_R_DECODING_ERROR 112 +#define ASN1_R_ERROR_STACK 113 +#define ASN1_R_EXPECTING_AN_INTEGER 114 +#define ASN1_R_EXPECTING_AN_OBJECT 115 +#define ASN1_R_EXPECTING_AN_OCTET_STRING 116 +#define ASN1_R_EXPECTING_A_BIT_STRING 117 +#define ASN1_R_EXPECTING_A_BOOLEAN 118 +#define ASN1_R_EXPECTING_A_SEQUENCE 119 +#define ASN1_R_EXPECTING_A_UTCTIME 120 +#define ASN1_R_FIRST_NUM_TOO_LARGE 121 +#define ASN1_R_HEADER_TOO_LONG 122 +#define ASN1_R_INVALID_DIGIT 123 +#define ASN1_R_INVALID_SEPARATOR 124 +#define ASN1_R_INVALID_TIME_FORMAT 125 +#define ASN1_R_IV_TOO_LARGE 126 +#define ASN1_R_LENGTH_ERROR 127 +#define ASN1_R_LENGTH_MISMATCH 128 +#define ASN1_R_MISSING_EOS 129 +#define ASN1_R_MISSING_SECOND_NUMBER 130 +#define ASN1_R_NON_HEX_CHARACTERS 131 +#define ASN1_R_NOT_ENOUGH_DATA 132 +#define ASN1_R_ODD_NUMBER_OF_CHARS 133 +#define ASN1_R_PARSING 134 +#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 135 +#define ASN1_R_SECOND_NUMBER_TOO_LARGE 136 +#define ASN1_R_SHORT_LINE 137 +#define ASN1_R_STRING_TOO_SHORT 138 +#define ASN1_R_TAG_VALUE_TOO_HIGH 139 +#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 140 +#define ASN1_R_TOO_LONG 141 +#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 142 +#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 143 +#define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 144 +#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 145 +#define ASN1_R_UNKNOWN_OBJECT_TYPE 146 +#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 147 +#define ASN1_R_UNSUPPORTED_CIPHER 148 +#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 149 +#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 150 +#define ASN1_R_UTCTIME_TOO_LONG 151 +#define ASN1_R_WRONG_PRINTABLE_TYPE 152 +#define ASN1_R_WRONG_TAG 153 +#define ASN1_R_WRONG_TYPE 154 diff --git a/src/lib/libcrypto/asn1/d2i_dhp.c b/src/lib/libcrypto/asn1/d2i_dhp.c new file mode 100644 index 0000000000..616a308100 --- /dev/null +++ b/src/lib/libcrypto/asn1/d2i_dhp.c @@ -0,0 +1,108 @@ +/* crypto/asn1/d2i_dhp.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "dh.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_D2I_DHPARAMS,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_I2D_DHPARAMS,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + */ + +DH *d2i_DHparams(a,pp,length) +DH **a; +unsigned char **pp; +long length; + { + int i=ASN1_R_ERROR_STACK; + ASN1_INTEGER *bs=NULL; + long v=0; + M_ASN1_D2I_vars(a,DH *,DH_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) goto err_bn; + + if (!M_ASN1_D2I_end_sequence()) + { + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + for (i=0; i<bs->length; i++) + v=(v<<8)|(bs->data[i]); + ret->length=(int)v; + } + + ASN1_BIT_STRING_free(bs); + + M_ASN1_D2I_Finish_2(a); + +err_bn: + i=ERR_R_BN_LIB; +err: + ASN1err(ASN1_F_D2I_DHPARAMS,i); + if ((ret != NULL) && ((a == NULL) || (*a != ret))) DH_free(ret); + if (bs != NULL) ASN1_BIT_STRING_free(bs); + return(NULL); + } + diff --git a/src/lib/libcrypto/asn1/d2i_dsap.c b/src/lib/libcrypto/asn1/d2i_dsap.c new file mode 100644 index 0000000000..2c8ac7bbcf --- /dev/null +++ b/src/lib/libcrypto/asn1/d2i_dsap.c @@ -0,0 +1,101 @@ +/* crypto/asn1/d2i_dsap.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "dsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_D2I_DSAPARAMS,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_I2D_DSAPARAMS,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + */ + +DSA *d2i_DSAparams(a,pp,length) +DSA **a; +unsigned char **pp; +long length; + { + int i=ASN1_R_ERROR_STACK; + ASN1_INTEGER *bs=NULL; + M_ASN1_D2I_vars(a,DSA *,DSA_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) goto err_bn; + + ASN1_BIT_STRING_free(bs); + + M_ASN1_D2I_Finish_2(a); + +err_bn: + i=ERR_R_BN_LIB; +err: + ASN1err(ASN1_F_D2I_DSAPARAMS,i); + if ((ret != NULL) && ((a == NULL) || (*a != ret))) DSA_free(ret); + if (bs != NULL) ASN1_BIT_STRING_free(bs); + return(NULL); + } + diff --git a/src/lib/libcrypto/asn1/d2i_r_pr.c b/src/lib/libcrypto/asn1/d2i_r_pr.c new file mode 100644 index 0000000000..0c53aa94bf --- /dev/null +++ b/src/lib/libcrypto/asn1/d2i_r_pr.c @@ -0,0 +1,129 @@ +/* crypto/asn1/d2i_r_pr.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "rsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_PARSING); + */ + +static ASN1_METHOD method={ + (int (*)()) i2d_RSAPrivateKey, + (char *(*)())d2i_RSAPrivateKey, + (char *(*)())RSA_new, + (void (*)()) RSA_free}; + +ASN1_METHOD *RSAPrivateKey_asn1_meth() + { + return(&method); + } + +RSA *d2i_RSAPrivateKey(a,pp,length) +RSA **a; +unsigned char **pp; +long length; + { + int i=ASN1_R_PARSING; + ASN1_INTEGER *bs=NULL; + M_ASN1_D2I_vars(a,RSA *,RSA_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if (bs->length == 0) + ret->version=0; + else ret->version=bs->data[0]; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->n=BN_bin2bn(bs->data,bs->length,ret->n)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->e=BN_bin2bn(bs->data,bs->length,ret->e)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->d=BN_bin2bn(bs->data,bs->length,ret->d)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->dmp1=BN_bin2bn(bs->data,bs->length,ret->dmp1)) == NULL) + goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->dmq1=BN_bin2bn(bs->data,bs->length,ret->dmq1)) == NULL) + goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->iqmp=BN_bin2bn(bs->data,bs->length,ret->iqmp)) == NULL) + goto err_bn; + + ASN1_INTEGER_free(bs); + + M_ASN1_D2I_Finish_2(a); +err_bn: + i=ERR_R_BN_LIB; +err: + ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,i); + if ((ret != NULL) && ((a == NULL) || (*a != ret))) RSA_free(ret); + if (bs != NULL) ASN1_INTEGER_free(bs); + return(NULL); + } + diff --git a/src/lib/libcrypto/asn1/d2i_r_pu.c b/src/lib/libcrypto/asn1/d2i_r_pu.c new file mode 100644 index 0000000000..778b792b1e --- /dev/null +++ b/src/lib/libcrypto/asn1/d2i_r_pu.c @@ -0,0 +1,100 @@ +/* crypto/asn1/d2i_r_pu.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "rsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_D2I_RSAPUBLICKEY,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_I2D_RSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + */ + +RSA *d2i_RSAPublicKey(a,pp,length) +RSA **a; +unsigned char **pp; +long length; + { + int i=ASN1_R_PARSING; + ASN1_INTEGER *bs=NULL; + M_ASN1_D2I_vars(a,RSA *,RSA_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->n=BN_bin2bn(bs->data,bs->length,ret->n)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->e=BN_bin2bn(bs->data,bs->length,ret->e)) == NULL) goto err_bn; + + ASN1_INTEGER_free(bs); + bs=NULL; + + M_ASN1_D2I_Finish_2(a); + +err_bn: + i=ERR_R_BN_LIB; +err: + ASN1err(ASN1_F_D2I_RSAPUBLICKEY,i); + if ((ret != NULL) && ((a == NULL) || (*a != ret))) RSA_free(ret); + if (bs != NULL) ASN1_INTEGER_free(bs); + return(NULL); + } + diff --git a/src/lib/libcrypto/asn1/d2i_s_pr.c b/src/lib/libcrypto/asn1/d2i_s_pr.c new file mode 100644 index 0000000000..32ff8ba4b3 --- /dev/null +++ b/src/lib/libcrypto/asn1/d2i_s_pr.c @@ -0,0 +1,113 @@ +/* crypto/asn1/d2i_s_pr.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* Origional version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "dsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_D2I_DSAPRIVATEKEY,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + * ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ASN1_R_PARSING); + */ + +DSA *d2i_DSAPrivateKey(a,pp,length) +DSA **a; +unsigned char **pp; +long length; + { + int i=ASN1_R_PARSING; + ASN1_INTEGER *bs=NULL; + M_ASN1_D2I_vars(a,DSA *,DSA_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if (bs->length == 0) + ret->version=0; + else ret->version=bs->data[0]; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->pub_key=BN_bin2bn(bs->data,bs->length,ret->pub_key)) + == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->priv_key=BN_bin2bn(bs->data,bs->length,ret->priv_key)) + == NULL) goto err_bn; + + ASN1_INTEGER_free(bs); + + M_ASN1_D2I_Finish_2(a); +err_bn: + i=ERR_R_BN_LIB; +err: + ASN1err(ASN1_F_D2I_DSAPRIVATEKEY,i); + if ((ret != NULL) && ((a == NULL) || (*a != ret))) DSA_free(ret); + if (bs != NULL) ASN1_INTEGER_free(bs); + return(NULL); + } + diff --git a/src/lib/libcrypto/asn1/d2i_s_pu.c b/src/lib/libcrypto/asn1/d2i_s_pu.c new file mode 100644 index 0000000000..1002f41cd8 --- /dev/null +++ b/src/lib/libcrypto/asn1/d2i_s_pu.c @@ -0,0 +1,124 @@ +/* crypto/asn1/d2i_s_pu.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* Origional version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "dsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_D2I_DSAPUBLICKEY,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_I2D_DSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + */ + +DSA *d2i_DSAPublicKey(a,pp,length) +DSA **a; +unsigned char **pp; +long length; + { + int i=ASN1_R_PARSING; + ASN1_INTEGER *bs=NULL; + M_ASN1_D2I_vars(a,DSA *,DSA_new); + + M_ASN1_D2I_Init(); + if ((length != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) + == (V_ASN1_UNIVERSAL|(V_ASN1_INTEGER)))) + { + c.slen=length; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->pub_key=BN_bin2bn(bs->data,bs->length,ret->pub_key)) + == NULL) + goto err_bn; + ret->write_params=0; + } + else + { + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->pub_key=BN_bin2bn(bs->data,bs->length,ret->pub_key)) + == NULL) + goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) + goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) + goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) + goto err_bn; + + ret->write_params=1; + } + + ASN1_INTEGER_free(bs); + bs=NULL; + M_ASN1_D2I_Finish_2(a); +err_bn: + i=ERR_R_BN_LIB; +err: + ASN1err(ASN1_F_D2I_DSAPUBLICKEY,i); + if ((ret != NULL) && ((a == NULL) || (*a != ret))) DSA_free(ret); + if (bs != NULL) ASN1_INTEGER_free(bs); + return(NULL); + } + diff --git a/src/lib/libcrypto/asn1/i2d_dhp.c b/src/lib/libcrypto/asn1/i2d_dhp.c new file mode 100644 index 0000000000..a454025ce3 --- /dev/null +++ b/src/lib/libcrypto/asn1/i2d_dhp.c @@ -0,0 +1,128 @@ +/* crypto/asn1/i2d_dhp.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "asn1_mac.h" +#include "dh.h" + +/* + * ASN1err(ASN1_F_D2I_DHPARAMS,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_X509_DHPARAMS_NEW,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_DHparams(a,pp) +DH *a; +unsigned char **pp; + { + BIGNUM *num[3]; + ASN1_INTEGER bs; + unsigned int j,i,tot=0,len,max=0; + int t,ret= -1; + unsigned char *p; + + if (a == NULL) return(0); + num[0]=a->p; + num[1]=a->g; + if (a->length != 0) + { + if ((num[2]=BN_new()) == NULL) goto err; + if (!BN_set_word(num[2],a->length)) goto err; + } + else + num[2]=NULL; + + for (i=0; i<3; i++) + { + if (num[i] == NULL) continue; + j=BN_num_bits(num[i]); + len=((j == 0)?0:((j/8)+1)); + if (len > max) max=len; + len=ASN1_object_size(0,len, + (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); + tot+=len; + } + + t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); + if (pp == NULL) return(t); + + p= *pp; + ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + + bs.type=V_ASN1_INTEGER; + bs.data=(unsigned char *)Malloc(max+4); + if (bs.data == NULL) + { + ASN1err(ASN1_F_I2D_DHPARAMS,ERR_R_MALLOC_FAILURE); + goto err; + } + + for (i=0; i<3; i++) + { + if (num[i] == NULL) continue; + bs.length=BN_bn2bin(num[i],bs.data); + i2d_ASN1_INTEGER(&bs,&p); + } + Free((char *)bs.data); + ret=t; +err: + if (num[2] != NULL) BN_free(num[2]); + *pp=p; + return(ret); + } diff --git a/src/lib/libcrypto/asn1/i2d_dsap.c b/src/lib/libcrypto/asn1/i2d_dsap.c new file mode 100644 index 0000000000..94ecff1525 --- /dev/null +++ b/src/lib/libcrypto/asn1/i2d_dsap.c @@ -0,0 +1,121 @@ +/* crypto/asn1/i2d_dsap.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "asn1_mac.h" +#include "dsa.h" + +/* + * ASN1err(ASN1_F_D2I_DSAPARAMS,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_DSAparams(a,pp) +DSA *a; +unsigned char **pp; + { + BIGNUM *num[3]; + ASN1_INTEGER bs; + unsigned int j,i,tot=0,len,max=0; + int t,ret= -1; + unsigned char *p; + + if (a == NULL) return(0); + num[0]=a->p; + num[1]=a->q; + num[2]=a->g; + + for (i=0; i<3; i++) + { + if (num[i] == NULL) continue; + j=BN_num_bits(num[i]); + len=((j == 0)?0:((j/8)+1)); + if (len > max) max=len; + len=ASN1_object_size(0,len, + (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); + tot+=len; + } + + t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); + if (pp == NULL) return(t); + + p= *pp; + ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + + bs.type=V_ASN1_INTEGER; + bs.data=(unsigned char *)Malloc(max+4); + if (bs.data == NULL) + { + ASN1err(ASN1_F_I2D_DSAPARAMS,ERR_R_MALLOC_FAILURE); + goto err; + } + + for (i=0; i<3; i++) + { + if (num[i] == NULL) continue; + bs.length=BN_bn2bin(num[i],bs.data); + i2d_ASN1_INTEGER(&bs,&p); + } + Free((char *)bs.data); + ret=t; +err: + *pp=p; + return(ret); + } + diff --git a/src/lib/libcrypto/asn1/i2d_r_pr.c b/src/lib/libcrypto/asn1/i2d_r_pr.c new file mode 100644 index 0000000000..aadbb92d8e --- /dev/null +++ b/src/lib/libcrypto/asn1/i2d_r_pr.c @@ -0,0 +1,132 @@ +/* crypto/asn1/i2d_r_pr.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "rsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + */ + +int i2d_RSAPrivateKey(a,pp) +RSA *a; +unsigned char **pp; + { + BIGNUM *num[9]; + unsigned char data[1]; + ASN1_INTEGER bs; + unsigned int j,i,tot,t,len,max=0; + unsigned char *p; + + if (a == NULL) return(0); + + num[1]=a->n; + num[2]=a->e; + num[3]=a->d; + num[4]=a->p; + num[5]=a->q; + num[6]=a->dmp1; + num[7]=a->dmq1; + num[8]=a->iqmp; + + bs.length=1; + bs.data=data; + bs.type=V_ASN1_INTEGER; + data[0]=a->version&0x7f; + + tot=i2d_ASN1_INTEGER(&(bs),NULL); + for (i=1; i<9; i++) + { + j=BN_num_bits(num[i]); + len=((j == 0)?0:((j/8)+1)); + if (len > max) max=len; + len=ASN1_object_size(0,len, + (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); + tot+=len; + } + + t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); + if (pp == NULL) return(t); + + p= *pp; + ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + + i2d_ASN1_INTEGER(&bs,&p); + + bs.data=(unsigned char *)Malloc(max+4); + if (bs.data == NULL) + { + ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ERR_R_MALLOC_FAILURE); + return(-1); + } + + for (i=1; i<9; i++) + { + bs.length=BN_bn2bin(num[i],bs.data); + i2d_ASN1_INTEGER(&bs,&p); + } + Free((char *)bs.data); + *pp=p; + return(t); + } + diff --git a/src/lib/libcrypto/asn1/i2d_r_pu.c b/src/lib/libcrypto/asn1/i2d_r_pu.c new file mode 100644 index 0000000000..3c54f6709d --- /dev/null +++ b/src/lib/libcrypto/asn1/i2d_r_pu.c @@ -0,0 +1,118 @@ +/* crypto/asn1/i2d_r_pu.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "rsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_D2I_RSAPUBLICKEY,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_I2D_RSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + */ + +int i2d_RSAPublicKey(a,pp) +RSA *a; +unsigned char **pp; + { + BIGNUM *num[2]; + ASN1_INTEGER bs; + unsigned int j,i,tot=0,len,max=0,t; + unsigned char *p; + + if (a == NULL) return(0); + + num[0]=a->n; + num[1]=a->e; + + for (i=0; i<2; i++) + { + j=BN_num_bits(num[i]); + len=((j == 0)?0:((j/8)+1)); + if (len > max) max=len; + len=ASN1_object_size(0,len, + (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); + tot+=len; + } + + t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); + if (pp == NULL) return(t); + + p= *pp; + ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + + bs.type=V_ASN1_INTEGER; + bs.data=(unsigned char *)Malloc(max+4); + if (bs.data == NULL) + { + ASN1err(ASN1_F_I2D_RSAPUBLICKEY,ERR_R_MALLOC_FAILURE); + return(-1); + } + + for (i=0; i<2; i++) + { + bs.length=BN_bn2bin(num[i],bs.data); + i2d_ASN1_INTEGER(&bs,&p); + } + Free((char *)bs.data); + *pp=p; + return(t); + } + diff --git a/src/lib/libcrypto/asn1/i2d_s_pr.c b/src/lib/libcrypto/asn1/i2d_s_pr.c new file mode 100644 index 0000000000..6e95305548 --- /dev/null +++ b/src/lib/libcrypto/asn1/i2d_s_pr.c @@ -0,0 +1,128 @@ +/* crypto/asn1/i2d_s_pr.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "dsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + */ + +int i2d_DSAPrivateKey(a,pp) +DSA *a; +unsigned char **pp; + { + BIGNUM *num[6]; + unsigned char data[1]; + ASN1_INTEGER bs; + unsigned int j,i,tot,t,len,max=0; + unsigned char *p; + + if (a == NULL) return(0); + + num[1]=a->p; + num[2]=a->q; + num[3]=a->g; + num[4]=a->pub_key; + num[5]=a->priv_key; + + bs.length=1; + bs.data=data; + bs.type=V_ASN1_INTEGER; + data[0]=a->version&0x7f; + + tot=i2d_ASN1_INTEGER(&(bs),NULL); + for (i=1; i<6; i++) + { + j=BN_num_bits(num[i]); + len=((j == 0)?0:((j/8)+1)); + if (len > max) max=len; + len=ASN1_object_size(0,len, + (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); + tot+=len; + } + + t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); + if (pp == NULL) return(t); + + p= *pp; + ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + + i2d_ASN1_INTEGER(&bs,&p); + + bs.data=(unsigned char *)Malloc(max+4); + if (bs.data == NULL) + { + ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ERR_R_MALLOC_FAILURE); + return(-1); + } + + for (i=1; i<6; i++) + { + bs.length=BN_bn2bin(num[i],bs.data); + i2d_ASN1_INTEGER(&bs,&p); + } + Free((char *)bs.data); + *pp=p; + return(t); + } + diff --git a/src/lib/libcrypto/asn1/i2d_s_pu.c b/src/lib/libcrypto/asn1/i2d_s_pu.c new file mode 100644 index 0000000000..5cf2877069 --- /dev/null +++ b/src/lib/libcrypto/asn1/i2d_s_pu.c @@ -0,0 +1,133 @@ +/* crypto/asn1/i2d_s_pu.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "dsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_I2D_DSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + */ + +int i2d_DSAPublicKey(a,pp) +DSA *a; +unsigned char **pp; + { + BIGNUM *num[4]; + ASN1_INTEGER bs; + unsigned int j,i,tot=0,len,max=0,t=0,all,n=1; + unsigned char *p; + + if (a == NULL) return(0); + + all=a->write_params; + + num[0]=a->pub_key; + if (all) + { + num[1]=a->p; + num[2]=a->q; + num[3]=a->g; + n=4; + } + + for (i=0; i<n; i++) + { + j=BN_num_bits(num[i]); + len=((j == 0)?0:((j/8)+1)); + if (len > max) max=len; + len=ASN1_object_size(0,len, + (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); + tot+=len; + } + + if (all) + { + t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); + if (pp == NULL) return(t); + } + else + { + if (pp == NULL) return(tot); + } + + p= *pp; + if (all) + ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + + bs.type=V_ASN1_INTEGER; + bs.data=(unsigned char *)Malloc(max+4); + if (bs.data == NULL) + { + ASN1err(ASN1_F_I2D_DSAPUBLICKEY,ERR_R_MALLOC_FAILURE); + return(-1); + } + + for (i=0; i<n; i++) + { + bs.length=BN_bn2bin(num[i],bs.data); + i2d_ASN1_INTEGER(&bs,&p); + } + Free((char *)bs.data); + *pp=p; + return(t); + } + diff --git a/src/lib/libcrypto/asn1/p7_dgst.c b/src/lib/libcrypto/asn1/p7_dgst.c new file mode 100644 index 0000000000..f71ed8eb1d --- /dev/null +++ b/src/lib/libcrypto/asn1/p7_dgst.c @@ -0,0 +1,130 @@ +/* crypto/asn1/p7_dgst.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_DIGEST_NEW,ASN1_R_MISSING_EOS); + * ASN1err(ASN1_F_D2I_PKCS7_DIGEST,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_DIGEST(a,pp) +PKCS7_DIGEST *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_len(a->md,i2d_X509_ALGOR); + M_ASN1_I2D_len(a->contents,i2d_PKCS7); + M_ASN1_I2D_len(a->digest,i2d_ASN1_OCTET_STRING); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_put(a->md,i2d_X509_ALGOR); + M_ASN1_I2D_put(a->contents,i2d_PKCS7); + M_ASN1_I2D_put(a->digest,i2d_ASN1_OCTET_STRING); + + M_ASN1_I2D_finish(); + } + +PKCS7_DIGEST *d2i_PKCS7_DIGEST(a,pp,length) +PKCS7_DIGEST **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_DIGEST *,PKCS7_DIGEST_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); + M_ASN1_D2I_get(ret->md,d2i_X509_ALGOR); + M_ASN1_D2I_get(ret->contents,d2i_PKCS7); + M_ASN1_D2I_get(ret->digest,d2i_ASN1_OCTET_STRING); + + M_ASN1_D2I_Finish(a,PKCS7_DIGEST_free,ASN1_F_D2I_PKCS7_DIGEST); + } + +PKCS7_DIGEST *PKCS7_DIGEST_new() + { + PKCS7_DIGEST *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_DIGEST); + M_ASN1_New(ret->version,ASN1_INTEGER_new); + M_ASN1_New(ret->md,X509_ALGOR_new); + M_ASN1_New(ret->contents,PKCS7_new); + M_ASN1_New(ret->digest,ASN1_OCTET_STRING_new); + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_DIGEST_NEW); + } + +void PKCS7_DIGEST_free(a) +PKCS7_DIGEST *a; + { + if (a == NULL) return; + ASN1_INTEGER_free(a->version); + X509_ALGOR_free(a->md); + PKCS7_free(a->contents); + ASN1_OCTET_STRING_free(a->digest); + Free((char *)a); + } + diff --git a/src/lib/libcrypto/asn1/p7_enc.c b/src/lib/libcrypto/asn1/p7_enc.c new file mode 100644 index 0000000000..874dd78389 --- /dev/null +++ b/src/lib/libcrypto/asn1/p7_enc.c @@ -0,0 +1,120 @@ +/* crypto/asn1/p7_enc.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_ENCRYPT_NEW,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_D2I_PKCS7_ENCRYPT,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_ENCRYPT(a,pp) +PKCS7_ENCRYPT *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); + + M_ASN1_I2D_finish(); + } + +PKCS7_ENCRYPT *d2i_PKCS7_ENCRYPT(a,pp,length) +PKCS7_ENCRYPT **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_ENCRYPT *,PKCS7_ENCRYPT_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); + M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); + + M_ASN1_D2I_Finish(a,PKCS7_ENCRYPT_free,ASN1_F_D2I_PKCS7_ENCRYPT); + } + +PKCS7_ENCRYPT *PKCS7_ENCRYPT_new() + { + PKCS7_ENCRYPT *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_ENCRYPT); + M_ASN1_New(ret->version,ASN1_INTEGER_new); + M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_ENCRYPT_NEW); + } + +void PKCS7_ENCRYPT_free(a) +PKCS7_ENCRYPT *a; + { + if (a == NULL) return; + ASN1_INTEGER_free(a->version); + PKCS7_ENC_CONTENT_free(a->enc_data); + Free((char *)a); + } + diff --git a/src/lib/libcrypto/asn1/p7_enc_c.c b/src/lib/libcrypto/asn1/p7_enc_c.c new file mode 100644 index 0000000000..2860d3e925 --- /dev/null +++ b/src/lib/libcrypto/asn1/p7_enc_c.c @@ -0,0 +1,127 @@ +/* crypto/asn1/p7_enc_c.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_ENC_CONTENT_NEW,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_D2I_PKCS7_ENC_CONTENT,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_ENC_CONTENT(a,pp) +PKCS7_ENC_CONTENT *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->content_type,i2d_ASN1_OBJECT); + M_ASN1_I2D_len(a->algorithm,i2d_X509_ALGOR); + M_ASN1_I2D_len_IMP_opt(a->enc_data,i2d_ASN1_OCTET_STRING); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->content_type,i2d_ASN1_OBJECT); + M_ASN1_I2D_put(a->algorithm,i2d_X509_ALGOR); + M_ASN1_I2D_put_IMP_opt(a->enc_data,i2d_ASN1_OCTET_STRING,0); + + M_ASN1_I2D_finish(); + } + +PKCS7_ENC_CONTENT *d2i_PKCS7_ENC_CONTENT(a,pp,length) +PKCS7_ENC_CONTENT **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_ENC_CONTENT *,PKCS7_ENC_CONTENT_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->content_type,d2i_ASN1_OBJECT); + M_ASN1_D2I_get(ret->algorithm,d2i_X509_ALGOR); + M_ASN1_D2I_get_IMP_opt(ret->enc_data,d2i_ASN1_OCTET_STRING,0, + V_ASN1_OCTET_STRING); + + M_ASN1_D2I_Finish(a,PKCS7_ENC_CONTENT_free, + ASN1_F_D2I_PKCS7_ENC_CONTENT); + } + +PKCS7_ENC_CONTENT *PKCS7_ENC_CONTENT_new() + { + PKCS7_ENC_CONTENT *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_ENC_CONTENT); + M_ASN1_New(ret->content_type,ASN1_OBJECT_new); + M_ASN1_New(ret->algorithm,X509_ALGOR_new); + ret->enc_data=NULL; + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_ENC_CONTENT_NEW); + } + +void PKCS7_ENC_CONTENT_free(a) +PKCS7_ENC_CONTENT *a; + { + if (a == NULL) return; + ASN1_OBJECT_free(a->content_type); + X509_ALGOR_free(a->algorithm); + ASN1_OCTET_STRING_free(a->enc_data); + Free((char *)a); + } + diff --git a/src/lib/libcrypto/asn1/p7_evp.c b/src/lib/libcrypto/asn1/p7_evp.c new file mode 100644 index 0000000000..4db0a7fe62 --- /dev/null +++ b/src/lib/libcrypto/asn1/p7_evp.c @@ -0,0 +1,125 @@ +/* crypto/asn1/p7_evp.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_ENVELOPE_NEW,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_D2I_PKCS7_ENVELOPE,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_ENVELOPE(a,pp) +PKCS7_ENVELOPE *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_len_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); + M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_put_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); + M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); + + M_ASN1_I2D_finish(); + } + +PKCS7_ENVELOPE *d2i_PKCS7_ENVELOPE(a,pp,length) +PKCS7_ENVELOPE **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_ENVELOPE *,PKCS7_ENVELOPE_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); + M_ASN1_D2I_get_set(ret->recipientinfo,d2i_PKCS7_RECIP_INFO); + M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); + + M_ASN1_D2I_Finish(a,PKCS7_ENVELOPE_free,ASN1_F_D2I_PKCS7_ENVELOPE); + } + +PKCS7_ENVELOPE *PKCS7_ENVELOPE_new() + { + PKCS7_ENVELOPE *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_ENVELOPE); + M_ASN1_New(ret->version,ASN1_INTEGER_new); + M_ASN1_New(ret->recipientinfo,sk_new_null); + M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_ENVELOPE_NEW); + } + +void PKCS7_ENVELOPE_free(a) +PKCS7_ENVELOPE *a; + { + if (a == NULL) return; + ASN1_INTEGER_free(a->version); + sk_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free); + PKCS7_ENC_CONTENT_free(a->enc_data); + Free((char *)a); + } + diff --git a/src/lib/libcrypto/asn1/p7_i_s.c b/src/lib/libcrypto/asn1/p7_i_s.c new file mode 100644 index 0000000000..9b00c556d9 --- /dev/null +++ b/src/lib/libcrypto/asn1/p7_i_s.c @@ -0,0 +1,120 @@ +/* crypto/asn1/p7_i_s.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_ISSUER_AND_SERIAL(a,pp) +PKCS7_ISSUER_AND_SERIAL *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->issuer,i2d_X509_NAME); + M_ASN1_I2D_len(a->serial,i2d_ASN1_INTEGER); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->issuer,i2d_X509_NAME); + M_ASN1_I2D_put(a->serial,i2d_ASN1_INTEGER); + + M_ASN1_I2D_finish(); + } + +PKCS7_ISSUER_AND_SERIAL *d2i_PKCS7_ISSUER_AND_SERIAL(a,pp,length) +PKCS7_ISSUER_AND_SERIAL **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_ISSUER_AND_SERIAL *,PKCS7_ISSUER_AND_SERIAL_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->issuer,d2i_X509_NAME); + M_ASN1_D2I_get(ret->serial,d2i_ASN1_INTEGER); + M_ASN1_D2I_Finish(a,PKCS7_ISSUER_AND_SERIAL_free, + ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL); + } + +PKCS7_ISSUER_AND_SERIAL *PKCS7_ISSUER_AND_SERIAL_new() + { + PKCS7_ISSUER_AND_SERIAL *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_ISSUER_AND_SERIAL); + M_ASN1_New(ret->issuer,X509_NAME_new); + M_ASN1_New(ret->serial,ASN1_INTEGER_new); + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW); + } + +void PKCS7_ISSUER_AND_SERIAL_free(a) +PKCS7_ISSUER_AND_SERIAL *a; + { + if (a == NULL) return; + X509_NAME_free(a->issuer); + ASN1_INTEGER_free(a->serial); + Free((char *)a); + } + diff --git a/src/lib/libcrypto/asn1/p7_lib.c b/src/lib/libcrypto/asn1/p7_lib.c new file mode 100644 index 0000000000..2134e0974a --- /dev/null +++ b/src/lib/libcrypto/asn1/p7_lib.c @@ -0,0 +1,299 @@ +/* crypto/asn1/p7_lib.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "objects.h" + +/* ASN1err(ASN1_F_D2I_PKCS7,ASN1_R_BAD_PKCS7_CONTENT); + * ASN1err(ASN1_F_I2D_PKCS7,ASN1_R_BAD_PKCS7_TYPE); + * ASN1err(ASN1_F_PKCS7_NEW,ASN1_R_BAD_PKCS7_TYPE); + */ + +int i2d_PKCS7(a,pp) +PKCS7 *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + if (a->asn1 != NULL) + { + if (pp == NULL) + return((int)a->length); + memcpy(*pp,a->asn1,(int)a->length); + *pp+=a->length; + return((int)a->length); + } + + ret+=4; /* sequence, BER header plus '0 0' end padding */ + M_ASN1_I2D_len(a->type,i2d_ASN1_OBJECT); + if (a->d.ptr != NULL) + { + ret+=4; /* explicit tag [ 0 ] BER plus '0 0' */ + switch (OBJ_obj2nid(a->type)) + { + case NID_pkcs7_data: + M_ASN1_I2D_len(a->d.data,i2d_ASN1_OCTET_STRING); + break; + case NID_pkcs7_signed: + M_ASN1_I2D_len(a->d.sign,i2d_PKCS7_SIGNED); + break; + case NID_pkcs7_enveloped: + M_ASN1_I2D_len(a->d.enveloped,i2d_PKCS7_ENVELOPE); + break; + case NID_pkcs7_signedAndEnveloped: + M_ASN1_I2D_len(a->d.signed_and_enveloped, + i2d_PKCS7_SIGN_ENVELOPE); + break; + case NID_pkcs7_digest: + M_ASN1_I2D_len(a->d.digest,i2d_PKCS7_DIGEST); + break; + case NID_pkcs7_encrypted: + M_ASN1_I2D_len(a->d.encrypted,i2d_PKCS7_ENCRYPT); + break; + default: + break; + } + } + r=ret; + if (pp == NULL) return(r); + p= *pp; + M_ASN1_I2D_INF_seq_start(V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + M_ASN1_I2D_put(a->type,i2d_ASN1_OBJECT); + + if (a->d.ptr != NULL) + { + M_ASN1_I2D_INF_seq_start(0,V_ASN1_CONTEXT_SPECIFIC); + switch (OBJ_obj2nid(a->type)) + { + case NID_pkcs7_data: + M_ASN1_I2D_put(a->d.data,i2d_ASN1_OCTET_STRING); + break; + case NID_pkcs7_signed: + M_ASN1_I2D_put(a->d.sign,i2d_PKCS7_SIGNED); + break; + case NID_pkcs7_enveloped: + M_ASN1_I2D_put(a->d.enveloped,i2d_PKCS7_ENVELOPE); + break; + case NID_pkcs7_signedAndEnveloped: + M_ASN1_I2D_put(a->d.signed_and_enveloped, + i2d_PKCS7_SIGN_ENVELOPE); + break; + case NID_pkcs7_digest: + M_ASN1_I2D_put(a->d.digest,i2d_PKCS7_DIGEST); + break; + case NID_pkcs7_encrypted: + M_ASN1_I2D_put(a->d.encrypted,i2d_PKCS7_ENCRYPT); + break; + default: + break; + } + M_ASN1_I2D_INF_seq_end(); + } + M_ASN1_I2D_INF_seq_end(); + M_ASN1_I2D_finish(); + } + +PKCS7 *d2i_PKCS7(a,pp,length) +PKCS7 **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7 *,PKCS7_new); + + if ((a != NULL) && ((*a) != NULL)) + { + if ((*a)->asn1 != NULL) + { + Free((char *)(*a)->asn1); + (*a)->asn1=NULL; + } + (*a)->length=0; + } + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->type,d2i_ASN1_OBJECT); + if (!M_ASN1_D2I_end_sequence()) + { + int Tinf,Ttag,Tclass; + long Tlen; + + if (M_ASN1_next != (V_ASN1_CONSTRUCTED| + V_ASN1_CONTEXT_SPECIFIC|0)) + { + c.error=ASN1_R_BAD_PKCS7_CONTENT; + goto err; + } + + ret->detached=0; + + c.q=c.p; + Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass, + (c.inf & 1)?(length+ *pp-c.q):c.slen); + if (Tinf & 0x80) goto err; + c.slen-=(c.p-c.q); + + switch (OBJ_obj2nid(ret->type)) + { + case NID_pkcs7_data: + M_ASN1_D2I_get(ret->d.data,d2i_ASN1_OCTET_STRING); + break; + case NID_pkcs7_signed: + M_ASN1_D2I_get(ret->d.sign,d2i_PKCS7_SIGNED); + if (ret->d.sign->contents->d.ptr == NULL) + ret->detached=1; + break; + case NID_pkcs7_enveloped: + M_ASN1_D2I_get(ret->d.enveloped,d2i_PKCS7_ENVELOPE); + break; + case NID_pkcs7_signedAndEnveloped: + M_ASN1_D2I_get(ret->d.signed_and_enveloped, + d2i_PKCS7_SIGN_ENVELOPE); + break; + case NID_pkcs7_digest: + M_ASN1_D2I_get(ret->d.digest,d2i_PKCS7_DIGEST); + break; + case NID_pkcs7_encrypted: + M_ASN1_D2I_get(ret->d.encrypted,d2i_PKCS7_ENCRYPT); + break; + default: + c.error=ASN1_R_BAD_PKCS7_TYPE; + goto err; + break; + } + if (Tinf == (1|V_ASN1_CONSTRUCTED)) + { + if (!ASN1_check_infinite_end(&c.p,c.slen)) + { + c.error=ASN1_R_MISSING_EOS; + goto err; + } + } + } + else + ret->detached=1; + + M_ASN1_D2I_Finish(a,PKCS7_free,ASN1_F_D2I_PKCS7); + } + +PKCS7 *PKCS7_new() + { + PKCS7 *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7); + ret->type=ASN1_OBJECT_new(); + ret->asn1=NULL; + ret->length=0; + ret->detached=0; + ret->d.ptr=NULL; + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_NEW); + } + +void PKCS7_free(a) +PKCS7 *a; + { + if (a == NULL) return; + + PKCS7_content_free(a); + if (a->type != NULL) + { + ASN1_OBJECT_free(a->type); + } + Free((char *)(char *)a); + } + +void PKCS7_content_free(a) +PKCS7 *a; + { + if (a->asn1 != NULL) Free((char *)a->asn1); + + if (a->d.ptr != NULL) + { + if (a->type == NULL) return; + + switch (OBJ_obj2nid(a->type)) + { + case NID_pkcs7_data: + ASN1_OCTET_STRING_free(a->d.data); + break; + case NID_pkcs7_signed: + PKCS7_SIGNED_free(a->d.sign); + break; + case NID_pkcs7_enveloped: + PKCS7_ENVELOPE_free(a->d.enveloped); + break; + case NID_pkcs7_signedAndEnveloped: + PKCS7_SIGN_ENVELOPE_free(a->d.signed_and_enveloped); + break; + case NID_pkcs7_digest: + PKCS7_DIGEST_free(a->d.digest); + break; + case NID_pkcs7_encrypted: + PKCS7_ENCRYPT_free(a->d.encrypted); + break; + default: + /* MEMORY LEAK */ + break; + } + } + a->d.ptr=NULL; + } + diff --git a/src/lib/libcrypto/asn1/p7_recip.c b/src/lib/libcrypto/asn1/p7_recip.c new file mode 100644 index 0000000000..f02233f5a8 --- /dev/null +++ b/src/lib/libcrypto/asn1/p7_recip.c @@ -0,0 +1,132 @@ +/* crypto/asn1/p7_recip.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_RECIP_INFO_NEW,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_D2I_PKCS7_RECIP_INFO,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_RECIP_INFO(a,pp) +PKCS7_RECIP_INFO *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_len(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); + M_ASN1_I2D_len(a->key_enc_algor,i2d_X509_ALGOR); + M_ASN1_I2D_len(a->enc_key,i2d_ASN1_OCTET_STRING); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_put(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); + M_ASN1_I2D_put(a->key_enc_algor,i2d_X509_ALGOR); + M_ASN1_I2D_put(a->enc_key,i2d_ASN1_OCTET_STRING); + + M_ASN1_I2D_finish(); + } + +PKCS7_RECIP_INFO *d2i_PKCS7_RECIP_INFO(a,pp,length) +PKCS7_RECIP_INFO **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_RECIP_INFO *,PKCS7_RECIP_INFO_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); + M_ASN1_D2I_get(ret->issuer_and_serial,d2i_PKCS7_ISSUER_AND_SERIAL); + M_ASN1_D2I_get(ret->key_enc_algor,d2i_X509_ALGOR); + M_ASN1_D2I_get(ret->enc_key,d2i_ASN1_OCTET_STRING); + + M_ASN1_D2I_Finish(a,PKCS7_RECIP_INFO_free,ASN1_F_D2I_PKCS7_RECIP_INFO); + } + +PKCS7_RECIP_INFO *PKCS7_RECIP_INFO_new() + { + PKCS7_RECIP_INFO *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_RECIP_INFO); + M_ASN1_New(ret->version,ASN1_INTEGER_new); + M_ASN1_New(ret->issuer_and_serial,PKCS7_ISSUER_AND_SERIAL_new); + M_ASN1_New(ret->key_enc_algor,X509_ALGOR_new); + M_ASN1_New(ret->enc_key,ASN1_OCTET_STRING_new); + ret->cert=NULL; + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_RECIP_INFO_NEW); + } + +void PKCS7_RECIP_INFO_free(a) +PKCS7_RECIP_INFO *a; + { + if (a == NULL) return; + ASN1_INTEGER_free(a->version); + PKCS7_ISSUER_AND_SERIAL_free(a->issuer_and_serial); + X509_ALGOR_free(a->key_enc_algor); + ASN1_OCTET_STRING_free(a->enc_key); + if (a->cert != NULL) X509_free(a->cert); + Free((char *)a); + } + diff --git a/src/lib/libcrypto/asn1/p7_s_e.c b/src/lib/libcrypto/asn1/p7_s_e.c new file mode 100644 index 0000000000..d344211456 --- /dev/null +++ b/src/lib/libcrypto/asn1/p7_s_e.c @@ -0,0 +1,146 @@ +/* crypto/asn1/p7_s_e.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_SIGN_ENVELOPE_NEW,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_D2I_PKCS7_SIGN_ENVELOPE,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_SIGN_ENVELOPE(a,pp) +PKCS7_SIGN_ENVELOPE *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_len_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); + M_ASN1_I2D_len_SET(a->md_algs,i2d_X509_ALGOR); + M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); + M_ASN1_I2D_len_IMP_set_opt(a->cert,i2d_X509,0); + M_ASN1_I2D_len_IMP_set_opt(a->crl,i2d_X509_CRL,1); + M_ASN1_I2D_len_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_put_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); + M_ASN1_I2D_put_SET(a->md_algs,i2d_X509_ALGOR); + M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); + M_ASN1_I2D_put_IMP_set_opt(a->cert,i2d_X509,0); + M_ASN1_I2D_put_IMP_set_opt(a->crl,i2d_X509_CRL,1); + M_ASN1_I2D_put_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); + + M_ASN1_I2D_finish(); + } + +PKCS7_SIGN_ENVELOPE *d2i_PKCS7_SIGN_ENVELOPE(a,pp,length) +PKCS7_SIGN_ENVELOPE **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_SIGN_ENVELOPE *,PKCS7_SIGN_ENVELOPE_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); + M_ASN1_D2I_get_set(ret->recipientinfo,d2i_PKCS7_RECIP_INFO); + M_ASN1_D2I_get_set(ret->md_algs,d2i_X509_ALGOR); + M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); + M_ASN1_D2I_get_IMP_set_opt(ret->cert,d2i_X509,0); + M_ASN1_D2I_get_IMP_set_opt(ret->crl,d2i_X509_CRL,1); + M_ASN1_D2I_get_set(ret->signer_info,d2i_PKCS7_SIGNER_INFO); + + M_ASN1_D2I_Finish(a,PKCS7_SIGN_ENVELOPE_free, + ASN1_F_D2I_PKCS7_SIGN_ENVELOPE); + } + +PKCS7_SIGN_ENVELOPE *PKCS7_SIGN_ENVELOPE_new() + { + PKCS7_SIGN_ENVELOPE *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_SIGN_ENVELOPE); + M_ASN1_New(ret->version,ASN1_INTEGER_new); + M_ASN1_New(ret->recipientinfo,sk_new_null); + M_ASN1_New(ret->md_algs,sk_new_null); + M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); + ret->cert=NULL; + ret->crl=NULL; + M_ASN1_New(ret->signer_info,sk_new_null); + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_SIGN_ENVELOPE_NEW); + } + +void PKCS7_SIGN_ENVELOPE_free(a) +PKCS7_SIGN_ENVELOPE *a; + { + if (a == NULL) return; + ASN1_INTEGER_free(a->version); + sk_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free); + sk_pop_free(a->md_algs,X509_ALGOR_free); + PKCS7_ENC_CONTENT_free(a->enc_data); + sk_pop_free(a->cert,X509_free); + sk_pop_free(a->crl,X509_CRL_free); + sk_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free); + Free((char *)a); + } + diff --git a/src/lib/libcrypto/asn1/p7_signd.c b/src/lib/libcrypto/asn1/p7_signd.c new file mode 100644 index 0000000000..40f9a44fa8 --- /dev/null +++ b/src/lib/libcrypto/asn1/p7_signd.c @@ -0,0 +1,140 @@ +/* crypto/asn1/p7_signd.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_SIGNED_NEW,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_D2I_PKCS7_SIGNED,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_SIGNED(a,pp) +PKCS7_SIGNED *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_len_SET(a->md_algs,i2d_X509_ALGOR); + M_ASN1_I2D_len(a->contents,i2d_PKCS7); + M_ASN1_I2D_len_IMP_set_opt(a->cert,i2d_X509,0); + M_ASN1_I2D_len_IMP_set_opt(a->crl,i2d_X509_CRL,1); + M_ASN1_I2D_len_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_put_SET(a->md_algs,i2d_X509_ALGOR); + M_ASN1_I2D_put(a->contents,i2d_PKCS7); + M_ASN1_I2D_put_IMP_set_opt(a->cert,i2d_X509,0); + M_ASN1_I2D_put_IMP_set_opt(a->crl,i2d_X509_CRL,1); + M_ASN1_I2D_put_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); + + M_ASN1_I2D_finish(); + } + +PKCS7_SIGNED *d2i_PKCS7_SIGNED(a,pp,length) +PKCS7_SIGNED **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_SIGNED *,PKCS7_SIGNED_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); + M_ASN1_D2I_get_set(ret->md_algs,d2i_X509_ALGOR); + M_ASN1_D2I_get(ret->contents,d2i_PKCS7); + M_ASN1_D2I_get_IMP_set_opt(ret->cert,d2i_X509,0); + M_ASN1_D2I_get_IMP_set_opt(ret->crl,d2i_X509_CRL,1); + M_ASN1_D2I_get_set(ret->signer_info,d2i_PKCS7_SIGNER_INFO); + + M_ASN1_D2I_Finish(a,PKCS7_SIGNED_free,ASN1_F_D2I_PKCS7_SIGNED); + } + +PKCS7_SIGNED *PKCS7_SIGNED_new() + { + PKCS7_SIGNED *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_SIGNED); + M_ASN1_New(ret->version,ASN1_INTEGER_new); + M_ASN1_New(ret->md_algs,sk_new_null); + M_ASN1_New(ret->contents,PKCS7_new); + ret->cert=NULL; + ret->crl=NULL; + M_ASN1_New(ret->signer_info,sk_new_null); + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_SIGNED_NEW); + } + +void PKCS7_SIGNED_free(a) +PKCS7_SIGNED *a; + { + if (a == NULL) return; + ASN1_INTEGER_free(a->version); + sk_pop_free(a->md_algs,X509_ALGOR_free); + PKCS7_free(a->contents); + sk_pop_free(a->cert,X509_free); + sk_pop_free(a->crl,X509_CRL_free); + sk_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free); + Free((char *)a); + } + diff --git a/src/lib/libcrypto/asn1/p7_signi.c b/src/lib/libcrypto/asn1/p7_signi.c new file mode 100644 index 0000000000..0da92169fc --- /dev/null +++ b/src/lib/libcrypto/asn1/p7_signi.c @@ -0,0 +1,149 @@ +/* crypto/asn1/p7_signi.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_SIGNER_INFO_NEW,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_D2I_PKCS7_SIGNER_INFO,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_SIGNER_INFO(a,pp) +PKCS7_SIGNER_INFO *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_len(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); + M_ASN1_I2D_len(a->digest_alg,i2d_X509_ALGOR); + M_ASN1_I2D_len_IMP_set_opt(a->auth_attr,i2d_X509_ATTRIBUTE,0); + M_ASN1_I2D_len(a->digest_enc_alg,i2d_X509_ALGOR); + M_ASN1_I2D_len(a->enc_digest,i2d_ASN1_OCTET_STRING); + M_ASN1_I2D_len_IMP_set_opt(a->unauth_attr,i2d_X509_ATTRIBUTE,1); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_put(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); + M_ASN1_I2D_put(a->digest_alg,i2d_X509_ALGOR); + M_ASN1_I2D_put_IMP_set_opt(a->auth_attr,i2d_X509_ATTRIBUTE,0); + M_ASN1_I2D_put(a->digest_enc_alg,i2d_X509_ALGOR); + M_ASN1_I2D_put(a->enc_digest,i2d_ASN1_OCTET_STRING); + M_ASN1_I2D_put_IMP_set_opt(a->unauth_attr,i2d_X509_ATTRIBUTE,1); + + M_ASN1_I2D_finish(); + } + +PKCS7_SIGNER_INFO *d2i_PKCS7_SIGNER_INFO(a,pp,length) +PKCS7_SIGNER_INFO **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_SIGNER_INFO *,PKCS7_SIGNER_INFO_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); + M_ASN1_D2I_get(ret->issuer_and_serial,d2i_PKCS7_ISSUER_AND_SERIAL); + M_ASN1_D2I_get(ret->digest_alg,d2i_X509_ALGOR); + M_ASN1_D2I_get_IMP_set_opt(ret->auth_attr,d2i_X509_ATTRIBUTE,0); + M_ASN1_D2I_get(ret->digest_enc_alg,d2i_X509_ALGOR); + M_ASN1_D2I_get(ret->enc_digest,d2i_ASN1_OCTET_STRING); + M_ASN1_D2I_get_IMP_set_opt(ret->unauth_attr,d2i_X509_ATTRIBUTE,1); + + M_ASN1_D2I_Finish(a,PKCS7_SIGNER_INFO_free, + ASN1_F_D2I_PKCS7_SIGNER_INFO); + } + +PKCS7_SIGNER_INFO *PKCS7_SIGNER_INFO_new() + { + PKCS7_SIGNER_INFO *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_SIGNER_INFO); + M_ASN1_New(ret->version,ASN1_INTEGER_new); + M_ASN1_New(ret->issuer_and_serial,PKCS7_ISSUER_AND_SERIAL_new); + M_ASN1_New(ret->digest_alg,X509_ALGOR_new); + ret->auth_attr=NULL; + M_ASN1_New(ret->digest_enc_alg,X509_ALGOR_new); + M_ASN1_New(ret->enc_digest,ASN1_OCTET_STRING_new); + ret->unauth_attr=NULL; + ret->pkey=NULL; + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_SIGNER_INFO_NEW); + } + +void PKCS7_SIGNER_INFO_free(a) +PKCS7_SIGNER_INFO *a; + { + if (a == NULL) return; + ASN1_INTEGER_free(a->version); + PKCS7_ISSUER_AND_SERIAL_free(a->issuer_and_serial); + X509_ALGOR_free(a->digest_alg); + sk_pop_free(a->auth_attr,X509_ATTRIBUTE_free); + X509_ALGOR_free(a->digest_enc_alg); + ASN1_OCTET_STRING_free(a->enc_digest); + sk_pop_free(a->unauth_attr,X509_ATTRIBUTE_free); + if (a->pkey != NULL) + EVP_PKEY_free(a->pkey); + Free((char *)a); + } + diff --git a/src/lib/libcrypto/asn1/pkcs8.c b/src/lib/libcrypto/asn1/pkcs8.c new file mode 100644 index 0000000000..03fdadd51a --- /dev/null +++ b/src/lib/libcrypto/asn1/pkcs8.c @@ -0,0 +1,142 @@ +/* crypto/asn1/pkcs8.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "objects.h" + +/* + * ASN1err(ASN1_F_D2I_X509_KEY,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_X509_KEY_NEW,ASN1_R_BAD_GET_OBJECT); + */ + +int i2d_X509_KEY(a,pp) +X509 *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->cert_info, i2d_X509_CINF); + M_ASN1_I2D_len(a->sig_alg, i2d_X509_ALGOR); + M_ASN1_I2D_len(a->signature, i2d_ASN1_BIT_STRING); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->cert_info, i2d_X509_CINF); + M_ASN1_I2D_put(a->sig_alg, i2d_X509_ALGOR); + M_ASN1_I2D_put(a->signature, i2d_ASN1_BIT_STRING); + + M_ASN1_I2D_finish(); + } + +X509 *d2i_X509_KEY(a,pp,length) +X509 **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,X509 *,X509_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->cert_info,d2i_X509_CINF); + M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR); + M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING); + M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509); + } + +X509 *X509_KEY_new() + { + X509_KEY *ret=NULL; + + M_ASN1_New_Malloc(ret,X509_KEY); + ret->references=1; + ret->type=NID + M_ASN1_New(ret->cert_info,X509_CINF_new); + M_ASN1_New(ret->sig_alg,X509_ALGOR_new); + M_ASN1_New(ret->signature,ASN1_BIT_STRING_new); + return(ret); + M_ASN1_New_Error(ASN1_F_X509_NEW); + } + +void X509_KEY_free(a) +X509 *a; + { + int i; + + if (a == NULL) return; + + i=CRYPTO_add_lock(&a->references,-1,CRYPTO_LOCK_X509_KEY); +#ifdef REF_PRINT + REF_PRINT("X509_KEY",a); +#endif + if (i > 0) return; +#ifdef REF_CHECK + if (i < 0) + { + fprintf(stderr,"X509_KEY_free, bad reference count\n"); + abort(); + } +#endif + + X509_CINF_free(a->cert_info); + X509_ALGOR_free(a->sig_alg); + ASN1_BIT_STRING_free(a->signature); + Free((char *)a); + } + diff --git a/src/lib/libcrypto/bf/Makefile.uni b/src/lib/libcrypto/bf/Makefile.uni new file mode 100644 index 0000000000..9ba5b0c854 --- /dev/null +++ b/src/lib/libcrypto/bf/Makefile.uni @@ -0,0 +1,169 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +DIR= bf +TOP= . +# use BF_PTR2 for intel boxes, +# BF_PTR for sparc and MIPS/SGI +# use nothing for Alpha and HP. + +# There are 3 possible performance options, experiment :-) +#OPTS= -DBF_PTR # usr for sparc and MIPS/SGI +#OPTS= -DBF_PTR2 # use for pentium +OPTS= # use for pentium pro, Alpha and HP + +MAKE=make -f Makefile +#CC=cc +#CFLAG= -O + +CC=gcc +#CFLAG= -O4 -funroll-loops -fomit-frame-pointer +CFLAG= -O3 -fomit-frame-pointer + +CFLAGS=$(OPTS) $(CFLAG) +CPP=$(CC) -E +AS=as + +# Assember version of bf_encrypt(). +BF_ENC=bf_enc.o # normal C version +#BF_ENC=asm/bx86-elf.o # elf format x86 +#BF_ENC=asm/bx86-out.o # a.out format x86 +#BF_ENC=asm/bx86-sol.o # solaris format x86 +#BF_ENC=asm/bx86bsdi.o # bsdi format x86 + +LIBDIR=/usr/local/lib +BINDIR=/usr/local/bin +INCDIR=/usr/local/include +MANDIR=/usr/local/man +MAN1=1 +MAN3=3 +SHELL=/bin/sh +LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cfb64.o bf_ofb64.o +LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c + +GENERAL=Makefile Makefile.ssl Makefile.uni asm bf_locl.org README \ + COPYRIGHT blowfish.doc INSTALL + +TESTING= bftest bfspeed bf_opts +TESTING_SRC=bftest.c bfspeed.c bf_opts.c +HEADERS=bf_locl.h blowfish.h bf_pi.h + +ALL= $(GENERAL) $(TESTING_SRC) $(LIBSRC) $(HEADERS) + +BLIB= libblowfish.a + +all: $(BLIB) $(TESTING) + +cc: + $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all + +gcc: + $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all + +x86-elf: + $(MAKE) BF_ENC='asm/bx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all + +x86-out: + $(MAKE) BF_ENC='asm/bx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all + +x86-solaris: + $(MAKE) BF_ENC='asm/bx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all + +x86-bsdi: + $(MAKE) BF_ENC='asm/bx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all + +# elf +asm/bx86-elf.o: asm/bx86unix.cpp + $(CPP) -DELF asm/bx86unix.cpp | $(AS) -o asm/bx86-elf.o + +# solaris +asm/bx86-sol.o: asm/bx86unix.cpp + $(CC) -E -DSOL asm/bx86unix.cpp | sed 's/^#.*//' > asm/bx86-sol.s + as -o asm/bx86-sol.o asm/bx86-sol.s + rm -f asm/bx86-sol.s + +# a.out +asm/bx86-out.o: asm/bx86unix.cpp + $(CPP) -DOUT asm/bx86unix.cpp | $(AS) -o asm/bx86-out.o + +# bsdi +asm/bx86bsdi.o: asm/bx86unix.cpp + $(CPP) -DBSDI asm/bx86unix.cpp | $(AS) -o asm/bx86bsdi.o + +asm/bx86unix.cpp: + (cd asm; perl bf-586.pl cpp >bx86unix.cpp) + +test: all + ./bftest + +$(BLIB): $(LIBOBJ) + /bin/rm -f $(BLIB) + ar cr $(BLIB) $(LIBOBJ) + -if test -s /bin/ranlib; then /bin/ranlib $(BLIB); \ + else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(BLIB); \ + else exit 0; fi; fi + +bftest: bftest.o $(BLIB) + $(CC) $(CFLAGS) -o bftest bftest.o $(BLIB) + +bfspeed: bfspeed.o $(BLIB) + $(CC) $(CFLAGS) -o bfspeed bfspeed.o $(BLIB) + +bf_opts: bf_opts.o $(BLIB) + $(CC) $(CFLAGS) -o bf_opts bf_opts.o $(BLIB) + +tags: + ctags $(TESTING_SRC) $(LIBBF) + +tar: + tar chf libbf.tar $(ALL) + +shar: + shar $(ALL) >libbf.shar + +depend: + makedepend $(LIBBF) $(TESTING_SRC) + +clean: + /bin/rm -f *.o tags core $(TESTING) $(BLIB) .nfs* *.old *.bak asm/*.o + +dclean: + sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new + mv -f Makefile.new Makefile + +# Eric is probably going to choke when he next looks at this --tjh +install: $(BLIB) + if test $(INSTALLTOP); then \ + echo SSL style install; \ + cp $(BLIB) $(INSTALLTOP)/lib; \ + if test -s /bin/ranlib; then \ + /bin/ranlib $(INSTALLTOP)/lib/$(BLIB); \ + else \ + if test -s /usr/bin/ranlib; then \ + /usr/bin/ranlib $(INSTALLTOP)/lib/$(BLIB); \ + fi; fi; \ + chmod 644 $(INSTALLTOP)/lib/$(BLIB); \ + cp blowfish.h $(INSTALLTOP)/include; \ + chmod 644 $(INSTALLTOP)/include/blowfish.h; \ + else \ + echo Standalone install; \ + cp $(BLIB) $(LIBDIR)/$(BLIB); \ + if test -s /bin/ranlib; then \ + /bin/ranlib $(LIBDIR)/$(BLIB); \ + else \ + if test -s /usr/bin/ranlib; then \ + /usr/bin/ranlib $(LIBDIR)/$(BLIB); \ + fi; \ + fi; \ + chmod 644 $(LIBDIR)/$(BLIB); \ + cp blowfish.h $(INCDIR)/blowfish.h; \ + chmod 644 $(INCDIR)/blowfish.h; \ + fi + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/bf/asm/b-win32.asm b/src/lib/libcrypto/bf/asm/b-win32.asm new file mode 100644 index 0000000000..138c99d0aa --- /dev/null +++ b/src/lib/libcrypto/bf/asm/b-win32.asm @@ -0,0 +1,906 @@ + ; Don't even think of reading this code + ; It was automatically generated by bf-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE bf-586.asm + .486 +.model FLAT +_TEXT SEGMENT +PUBLIC _BF_encrypt + +_BF_encrypt PROC NEAR + ; + push ebp + push ebx + mov ebx, DWORD PTR 12[esp] + mov ebp, DWORD PTR 16[esp] + push esi + push edi + ; Load the 2 words + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + xor eax, eax + mov ebx, DWORD PTR [ebp] + xor ecx, ecx + xor edi, ebx + ; + ; Round 0 + mov edx, DWORD PTR 4[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 1 + mov edx, DWORD PTR 8[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 2 + mov edx, DWORD PTR 12[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 3 + mov edx, DWORD PTR 16[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 4 + mov edx, DWORD PTR 20[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 5 + mov edx, DWORD PTR 24[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 6 + mov edx, DWORD PTR 28[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 7 + mov edx, DWORD PTR 32[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 8 + mov edx, DWORD PTR 36[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 9 + mov edx, DWORD PTR 40[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 10 + mov edx, DWORD PTR 44[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 11 + mov edx, DWORD PTR 48[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 12 + mov edx, DWORD PTR 52[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 13 + mov edx, DWORD PTR 56[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 14 + mov edx, DWORD PTR 60[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 15 + mov edx, DWORD PTR 64[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + ; Load parameter 0 (16) enc=1 + mov eax, DWORD PTR 20[esp] + xor edi, ebx + mov edx, DWORD PTR 68[ebp] + xor esi, edx + mov DWORD PTR 4[eax],edi + mov DWORD PTR [eax],esi + pop edi + pop esi + pop ebx + pop ebp + ret +_BF_encrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _BF_decrypt + +_BF_decrypt PROC NEAR + ; + push ebp + push ebx + mov ebx, DWORD PTR 12[esp] + mov ebp, DWORD PTR 16[esp] + push esi + push edi + ; Load the 2 words + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + xor eax, eax + mov ebx, DWORD PTR 68[ebp] + xor ecx, ecx + xor edi, ebx + ; + ; Round 16 + mov edx, DWORD PTR 64[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 15 + mov edx, DWORD PTR 60[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 14 + mov edx, DWORD PTR 56[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 13 + mov edx, DWORD PTR 52[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 12 + mov edx, DWORD PTR 48[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 11 + mov edx, DWORD PTR 44[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 10 + mov edx, DWORD PTR 40[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 9 + mov edx, DWORD PTR 36[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 8 + mov edx, DWORD PTR 32[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 7 + mov edx, DWORD PTR 28[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 6 + mov edx, DWORD PTR 24[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 5 + mov edx, DWORD PTR 20[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 4 + mov edx, DWORD PTR 16[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 3 + mov edx, DWORD PTR 12[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 2 + mov edx, DWORD PTR 8[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 1 + mov edx, DWORD PTR 4[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + ; Load parameter 0 (1) enc=0 + mov eax, DWORD PTR 20[esp] + xor edi, ebx + mov edx, DWORD PTR [ebp] + xor esi, edx + mov DWORD PTR 4[eax],edi + mov DWORD PTR [eax],esi + pop edi + pop esi + pop ebx + pop ebp + ret +_BF_decrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _BF_cbc_encrypt + +_BF_cbc_encrypt PROC NEAR + ; + push ebp + push ebx + push esi + push edi + mov ebp, DWORD PTR 28[esp] + ; getting iv ptr from parameter 4 + mov ebx, DWORD PTR 36[esp] + mov esi, DWORD PTR [ebx] + mov edi, DWORD PTR 4[ebx] + push edi + push esi + push edi + push esi + mov ebx, esp + mov esi, DWORD PTR 36[esp] + mov edi, DWORD PTR 40[esp] + ; getting encrypt flag from parameter 5 + mov ecx, DWORD PTR 56[esp] + ; get and push parameter 3 + mov eax, DWORD PTR 48[esp] + push eax + push ebx + cmp ecx, 0 + jz $L000decrypt + and ebp, 4294967288 + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + jz $L001encrypt_finish +L002encrypt_loop: + mov ecx, DWORD PTR [esi] + mov edx, DWORD PTR 4[esi] + xor eax, ecx + xor ebx, edx + bswap eax + bswap ebx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _BF_encrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + bswap eax + bswap ebx + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L002encrypt_loop +$L001encrypt_finish: + mov ebp, DWORD PTR 52[esp] + and ebp, 7 + jz $L003finish + xor ecx, ecx + xor edx, edx + mov ebp, DWORD PTR $L004cbc_enc_jmp_table[ebp*4] + jmp ebp +L005ej7: + mov dh, BYTE PTR 6[esi] + shl edx, 8 +L006ej6: + mov dh, BYTE PTR 5[esi] +L007ej5: + mov dl, BYTE PTR 4[esi] +L008ej4: + mov ecx, DWORD PTR [esi] + jmp $L009ejend +L010ej3: + mov ch, BYTE PTR 2[esi] + shl ecx, 8 +L011ej2: + mov ch, BYTE PTR 1[esi] +L012ej1: + mov cl, BYTE PTR [esi] +$L009ejend: + xor eax, ecx + xor ebx, edx + bswap eax + bswap ebx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _BF_encrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + bswap eax + bswap ebx + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + jmp $L003finish +$L000decrypt: + and ebp, 4294967288 + mov eax, DWORD PTR 16[esp] + mov ebx, DWORD PTR 20[esp] + jz $L013decrypt_finish +L014decrypt_loop: + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + bswap eax + bswap ebx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _BF_decrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + bswap eax + bswap ebx + mov ecx, DWORD PTR 16[esp] + mov edx, DWORD PTR 20[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR [edi],ecx + mov DWORD PTR 4[edi],edx + mov DWORD PTR 16[esp],eax + mov DWORD PTR 20[esp],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L014decrypt_loop +$L013decrypt_finish: + mov ebp, DWORD PTR 52[esp] + and ebp, 7 + jz $L003finish + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + bswap eax + bswap ebx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _BF_decrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + bswap eax + bswap ebx + mov ecx, DWORD PTR 16[esp] + mov edx, DWORD PTR 20[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] +L015dj7: + ror edx, 16 + mov BYTE PTR 6[edi],dl + shr edx, 16 +L016dj6: + mov BYTE PTR 5[edi],dh +L017dj5: + mov BYTE PTR 4[edi],dl +L018dj4: + mov DWORD PTR [edi],ecx + jmp $L019djend +L020dj3: + ror ecx, 16 + mov BYTE PTR 2[edi],cl + shl ecx, 16 +L021dj2: + mov BYTE PTR 1[esi],ch +L022dj1: + mov BYTE PTR [esi], cl +$L019djend: + jmp $L003finish +$L003finish: + mov ecx, DWORD PTR 60[esp] + add esp, 24 + mov DWORD PTR [ecx],eax + mov DWORD PTR 4[ecx],ebx + pop edi + pop esi + pop ebx + pop ebp + ret +$L004cbc_enc_jmp_table: + DD 0 + DD L012ej1 + DD L011ej2 + DD L010ej3 + DD L008ej4 + DD L007ej5 + DD L006ej6 + DD L005ej7 +L023cbc_dec_jmp_table: + DD 0 + DD L022dj1 + DD L021dj2 + DD L020dj3 + DD L018dj4 + DD L017dj5 + DD L016dj6 + DD L015dj7 +_BF_cbc_encrypt ENDP +_TEXT ENDS +END diff --git a/src/lib/libcrypto/bf/asm/bx86unix.cpp b/src/lib/libcrypto/bf/asm/bx86unix.cpp new file mode 100644 index 0000000000..cdaa269378 --- /dev/null +++ b/src/lib/libcrypto/bf/asm/bx86unix.cpp @@ -0,0 +1,976 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define BF_encrypt _BF_encrypt +#define BF_decrypt _BF_decrypt +#define BF_cbc_encrypt _BF_cbc_encrypt + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by bf-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "bf-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl BF_encrypt + TYPE(BF_encrypt,@function) +BF_encrypt: + + pushl %ebp + pushl %ebx + movl 12(%esp), %ebx + movl 16(%esp), %ebp + pushl %esi + pushl %edi + /* Load the 2 words */ + movl (%ebx), %edi + movl 4(%ebx), %esi + xorl %eax, %eax + movl (%ebp), %ebx + xorl %ecx, %ecx + xorl %ebx, %edi + + /* Round 0 */ + movl 4(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 1 */ + movl 8(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 2 */ + movl 12(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 3 */ + movl 16(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 4 */ + movl 20(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 5 */ + movl 24(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 6 */ + movl 28(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 7 */ + movl 32(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 8 */ + movl 36(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 9 */ + movl 40(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 10 */ + movl 44(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 11 */ + movl 48(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 12 */ + movl 52(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 13 */ + movl 56(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 14 */ + movl 60(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 15 */ + movl 64(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + /* Load parameter 0 (16) enc=1 */ + movl 20(%esp), %eax + xorl %ebx, %edi + movl 68(%ebp), %edx + xorl %edx, %esi + movl %edi, 4(%eax) + movl %esi, (%eax) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.BF_encrypt_end: + SIZE(BF_encrypt,.BF_encrypt_end-BF_encrypt) +.ident "BF_encrypt" +.text + .align ALIGN +.globl BF_decrypt + TYPE(BF_decrypt,@function) +BF_decrypt: + + pushl %ebp + pushl %ebx + movl 12(%esp), %ebx + movl 16(%esp), %ebp + pushl %esi + pushl %edi + /* Load the 2 words */ + movl (%ebx), %edi + movl 4(%ebx), %esi + xorl %eax, %eax + movl 68(%ebp), %ebx + xorl %ecx, %ecx + xorl %ebx, %edi + + /* Round 16 */ + movl 64(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 15 */ + movl 60(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 14 */ + movl 56(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 13 */ + movl 52(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 12 */ + movl 48(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 11 */ + movl 44(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 10 */ + movl 40(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 9 */ + movl 36(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 8 */ + movl 32(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 7 */ + movl 28(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 6 */ + movl 24(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 5 */ + movl 20(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 4 */ + movl 16(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 3 */ + movl 12(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 2 */ + movl 8(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 1 */ + movl 4(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + /* Load parameter 0 (1) enc=0 */ + movl 20(%esp), %eax + xorl %ebx, %edi + movl (%ebp), %edx + xorl %edx, %esi + movl %edi, 4(%eax) + movl %esi, (%eax) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.BF_decrypt_end: + SIZE(BF_decrypt,.BF_decrypt_end-BF_decrypt) +.ident "BF_decrypt" +.text + .align ALIGN +.globl BF_cbc_encrypt + TYPE(BF_cbc_encrypt,@function) +BF_cbc_encrypt: + + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + movl 28(%esp), %ebp + /* getting iv ptr from parameter 4 */ + movl 36(%esp), %ebx + movl (%ebx), %esi + movl 4(%ebx), %edi + pushl %edi + pushl %esi + pushl %edi + pushl %esi + movl %esp, %ebx + movl 36(%esp), %esi + movl 40(%esp), %edi + /* getting encrypt flag from parameter 5 */ + movl 56(%esp), %ecx + /* get and push parameter 3 */ + movl 48(%esp), %eax + pushl %eax + pushl %ebx + cmpl $0, %ecx + jz .L000decrypt + andl $4294967288, %ebp + movl 8(%esp), %eax + movl 12(%esp), %ebx + jz .L001encrypt_finish +.L002encrypt_loop: + movl (%esi), %ecx + movl 4(%esi), %edx + xorl %ecx, %eax + xorl %edx, %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call BF_encrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, (%edi) + movl %ebx, 4(%edi) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L002encrypt_loop +.L001encrypt_finish: + movl 52(%esp), %ebp + andl $7, %ebp + jz .L003finish + xorl %ecx, %ecx + xorl %edx, %edx + movl .L004cbc_enc_jmp_table(,%ebp,4),%ebp + jmp *%ebp +.L005ej7: + movb 6(%esi), %dh + sall $8, %edx +.L006ej6: + movb 5(%esi), %dh +.L007ej5: + movb 4(%esi), %dl +.L008ej4: + movl (%esi), %ecx + jmp .L009ejend +.L010ej3: + movb 2(%esi), %ch + sall $8, %ecx +.L011ej2: + movb 1(%esi), %ch +.L012ej1: + movb (%esi), %cl +.L009ejend: + xorl %ecx, %eax + xorl %edx, %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call BF_encrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, (%edi) + movl %ebx, 4(%edi) + jmp .L003finish +.align ALIGN +.L000decrypt: + andl $4294967288, %ebp + movl 16(%esp), %eax + movl 20(%esp), %ebx + jz .L013decrypt_finish +.L014decrypt_loop: + movl (%esi), %eax + movl 4(%esi), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call BF_decrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl 16(%esp), %ecx + movl 20(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx + movl %ecx, (%edi) + movl %edx, 4(%edi) + movl %eax, 16(%esp) + movl %ebx, 20(%esp) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L014decrypt_loop +.L013decrypt_finish: + movl 52(%esp), %ebp + andl $7, %ebp + jz .L003finish + movl (%esi), %eax + movl 4(%esi), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call BF_decrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl 16(%esp), %ecx + movl 20(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx +.L015dj7: + rorl $16, %edx + movb %dl, 6(%edi) + shrl $16, %edx +.L016dj6: + movb %dh, 5(%edi) +.L017dj5: + movb %dl, 4(%edi) +.L018dj4: + movl %ecx, (%edi) + jmp .L019djend +.L020dj3: + rorl $16, %ecx + movb %cl, 2(%edi) + sall $16, %ecx +.L021dj2: + movb %ch, 1(%esi) +.L022dj1: + movb %cl, (%esi) +.L019djend: + jmp .L003finish +.align ALIGN +.L003finish: + movl 60(%esp), %ecx + addl $24, %esp + movl %eax, (%ecx) + movl %ebx, 4(%ecx) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.align ALIGN +.L004cbc_enc_jmp_table: + .long 0 + .long .L012ej1 + .long .L011ej2 + .long .L010ej3 + .long .L008ej4 + .long .L007ej5 + .long .L006ej6 + .long .L005ej7 +.align ALIGN +.L023cbc_dec_jmp_table: + .long 0 + .long .L022dj1 + .long .L021dj2 + .long .L020dj3 + .long .L018dj4 + .long .L017dj5 + .long .L016dj6 + .long .L015dj7 +.BF_cbc_encrypt_end: + SIZE(BF_cbc_encrypt,.BF_cbc_encrypt_end-BF_cbc_encrypt) +.ident "desasm.pl" diff --git a/src/lib/libcrypto/bf/bf_locl.org b/src/lib/libcrypto/bf/bf_locl.org new file mode 100644 index 0000000000..a5663de8ca --- /dev/null +++ b/src/lib/libcrypto/bf/bf_locl.org @@ -0,0 +1,242 @@ +/* crypto/bf/bf_locl.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify bf_locl.org since bf_locl.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined( sun ) /* Newer Sparc's */ +# define BF_PTR +#elif defined( __ultrix ) /* Older MIPS */ +# define BF_PTR +#elif defined( __osf1__ ) /* Alpha */ + /* None */ +#elif defined ( _AIX ) /* RS6000 */ + /* Unknown */ +#elif defined( __hpux ) /* HP-PA */ + /* None */ +#elif defined( __aux ) /* 68K */ + /* Unknown */ +#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ + /* Unknown */ +#elif defined( __sgi ) /* Newer MIPS */ +# define BF_PTR +#elif defined( i386 ) /* x86 boxes, should be gcc */ +#elif defined( _MSC_VER ) /* x86 boxes, Visual C */ +#endif /* Systems-specific speed defines */ + +#undef c2l +#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ + l|=((unsigned long)(*((c)++)))<< 8L, \ + l|=((unsigned long)(*((c)++)))<<16L, \ + l|=((unsigned long)(*((c)++)))<<24L) + +/* NOTE - c is not incremented as per c2l */ +#undef c2ln +#define c2ln(c,l1,l2,n) { \ + c+=n; \ + l1=l2=0; \ + switch (n) { \ + case 8: l2 =((unsigned long)(*(--(c))))<<24L; \ + case 7: l2|=((unsigned long)(*(--(c))))<<16L; \ + case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \ + case 5: l2|=((unsigned long)(*(--(c)))); \ + case 4: l1 =((unsigned long)(*(--(c))))<<24L; \ + case 3: l1|=((unsigned long)(*(--(c))))<<16L; \ + case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \ + case 1: l1|=((unsigned long)(*(--(c)))); \ + } \ + } + +#undef l2c +#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>24L)&0xff)) + +/* NOTE - c is not incremented as per l2c */ +#undef l2cn +#define l2cn(l1,l2,c,n) { \ + c+=n; \ + switch (n) { \ + case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ + case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ + case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ + case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ + case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ + case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ + case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ + case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ + } \ + } + +/* NOTE - c is not incremented as per n2l */ +#define n2ln(c,l1,l2,n) { \ + c+=n; \ + l1=l2=0; \ + switch (n) { \ + case 8: l2 =((unsigned long)(*(--(c)))) ; \ + case 7: l2|=((unsigned long)(*(--(c))))<< 8; \ + case 6: l2|=((unsigned long)(*(--(c))))<<16; \ + case 5: l2|=((unsigned long)(*(--(c))))<<24; \ + case 4: l1 =((unsigned long)(*(--(c)))) ; \ + case 3: l1|=((unsigned long)(*(--(c))))<< 8; \ + case 2: l1|=((unsigned long)(*(--(c))))<<16; \ + case 1: l1|=((unsigned long)(*(--(c))))<<24; \ + } \ + } + +/* NOTE - c is not incremented as per l2n */ +#define l2nn(l1,l2,c,n) { \ + c+=n; \ + switch (n) { \ + case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ + case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ + case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ + case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ + case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ + case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ + case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ + case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ + } \ + } + +#undef n2l +#define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \ + l|=((unsigned long)(*((c)++)))<<16L, \ + l|=((unsigned long)(*((c)++)))<< 8L, \ + l|=((unsigned long)(*((c)++)))) + +#undef l2n +#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ + *((c)++)=(unsigned char)(((l) )&0xff)) + +/* This is actually a big endian algorithm, the most significate byte + * is used to lookup array 0 */ + +/* use BF_PTR2 for intel boxes, + * BF_PTR for sparc and MIPS/SGI + * use nothing for Alpha and HP. + */ +#if !defined(BF_PTR) && !defined(BF_PTR2) +#undef BF_PTR +#endif + +#define BF_M 0x3fc +#define BF_0 22L +#define BF_1 14L +#define BF_2 6L +#define BF_3 2L /* left shift */ + +#if defined(BF_PTR2) + +/* This is basically a special pentium verson */ +#define BF_ENC(LL,R,S,P) \ + { \ + BF_LONG t,u,v; \ + u=R>>BF_0; \ + v=R>>BF_1; \ + u&=BF_M; \ + v&=BF_M; \ + t= *(BF_LONG *)((unsigned char *)&(S[ 0])+u); \ + u=R>>BF_2; \ + t+= *(BF_LONG *)((unsigned char *)&(S[256])+v); \ + v=R<<BF_3; \ + u&=BF_M; \ + v&=BF_M; \ + t^= *(BF_LONG *)((unsigned char *)&(S[512])+u); \ + LL^=P; \ + t+= *(BF_LONG *)((unsigned char *)&(S[768])+v); \ + LL^=t; \ + } + +#elif defined(BF_PTR) + +/* This is normally very good */ + +#define BF_ENC(LL,R,S,P) \ + LL^=P; \ + LL^= (((*(BF_LONG *)((unsigned char *)&(S[ 0])+((R>>BF_0)&BF_M))+ \ + *(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \ + *(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \ + *(BF_LONG *)((unsigned char *)&(S[768])+((R<<BF_3)&BF_M))); +#else + +/* This will always work, even on 64 bit machines and strangly enough, + * on the Alpha it is faster than the pointer versions (both 32 and 64 + * versions of BF_LONG) */ + +#define BF_ENC(LL,R,S,P) \ + LL^=P; \ + LL^=((( S[ (int)(R>>24L) ] + \ + S[0x0100+((int)(R>>16L)&0xff)])^ \ + S[0x0200+((int)(R>> 8L)&0xff)])+ \ + S[0x0300+((int)(R )&0xff)])&0xffffffffL; +#endif diff --git a/src/lib/libcrypto/bio/bio.err b/src/lib/libcrypto/bio/bio.err new file mode 100644 index 0000000000..6e2f2b63ca --- /dev/null +++ b/src/lib/libcrypto/bio/bio.err @@ -0,0 +1,46 @@ +/* Error codes for the BIO functions. */ + +/* Function codes. */ +#define BIO_F_ACPT_STATE 100 +#define BIO_F_BIO_ACCEPT 101 +#define BIO_F_BIO_CTRL 102 +#define BIO_F_BIO_GETS 103 +#define BIO_F_BIO_GET_ACCEPT_SOCKET 104 +#define BIO_F_BIO_GET_HOST_IP 105 +#define BIO_F_BIO_GET_PORT 106 +#define BIO_F_BIO_NEW 107 +#define BIO_F_BIO_NEW_FILE 108 +#define BIO_F_BIO_PUTS 109 +#define BIO_F_BIO_READ 110 +#define BIO_F_BIO_SOCK_INIT 111 +#define BIO_F_BIO_WRITE 112 +#define BIO_F_BUFFER_CTRL 113 +#define BIO_F_CONN_STATE 114 +#define BIO_F_FILE_CTRL 115 +#define BIO_F_MEM_WRITE 116 +#define BIO_F_SSL_NEW 117 +#define BIO_F_WSASTARTUP 118 + +/* Reason codes. */ +#define BIO_R_ACCEPT_ERROR 100 +#define BIO_R_BAD_FOPEN_MODE 101 +#define BIO_R_BAD_HOSTNAME_LOOKUP 102 +#define BIO_R_CONNECT_ERROR 103 +#define BIO_R_ERROR_SETTING_NBIO 104 +#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105 +#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106 +#define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 +#define BIO_R_INVALID_IP_ADDRESS 108 +#define BIO_R_KEEPALIVE 109 +#define BIO_R_NBIO_CONNECT_ERROR 110 +#define BIO_R_NO_ACCEPT_PORT_SPECIFIED 111 +#define BIO_R_NO_HOSTHNAME_SPECIFIED 112 +#define BIO_R_NO_PORT_DEFINED 113 +#define BIO_R_NO_PORT_SPECIFIED 114 +#define BIO_R_NULL_PARAMETER 115 +#define BIO_R_UNABLE_TO_BIND_SOCKET 116 +#define BIO_R_UNABLE_TO_CREATE_SOCKET 117 +#define BIO_R_UNABLE_TO_LISTEN_SOCKET 118 +#define BIO_R_UNINITALISED 119 +#define BIO_R_UNSUPPORTED_METHOD 120 +#define BIO_R_WSASTARTUP 121 diff --git a/src/lib/libcrypto/bn/asm/bn-win32.asm b/src/lib/libcrypto/bn/asm/bn-win32.asm new file mode 100644 index 0000000000..017ea462b0 --- /dev/null +++ b/src/lib/libcrypto/bn/asm/bn-win32.asm @@ -0,0 +1,689 @@ + ; Don't even think of reading this code + ; It was automatically generated by bn-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE bn-586.asm + .386 +.model FLAT +_TEXT SEGMENT +PUBLIC _bn_mul_add_words + +_bn_mul_add_words PROC NEAR + push ebp + push ebx + push esi + push edi + ; + xor esi, esi + mov edi, DWORD PTR 20[esp] + mov ecx, DWORD PTR 28[esp] + mov ebx, DWORD PTR 24[esp] + and ecx, 4294967288 + mov ebp, DWORD PTR 32[esp] + push ecx + jz $L000maw_finish +L001maw_loop: + mov DWORD PTR [esp],ecx + ; Round 0 + mov eax, DWORD PTR [ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR [edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR [edi],eax + mov esi, edx + ; Round 4 + mov eax, DWORD PTR 4[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 4[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR 4[edi],eax + mov esi, edx + ; Round 8 + mov eax, DWORD PTR 8[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 8[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR 8[edi],eax + mov esi, edx + ; Round 12 + mov eax, DWORD PTR 12[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 12[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR 12[edi],eax + mov esi, edx + ; Round 16 + mov eax, DWORD PTR 16[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 16[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR 16[edi],eax + mov esi, edx + ; Round 20 + mov eax, DWORD PTR 20[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 20[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR 20[edi],eax + mov esi, edx + ; Round 24 + mov eax, DWORD PTR 24[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 24[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR 24[edi],eax + mov esi, edx + ; Round 28 + mov eax, DWORD PTR 28[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 28[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR 28[edi],eax + mov esi, edx + ; + mov ecx, DWORD PTR [esp] + add ebx, 32 + add edi, 32 + sub ecx, 8 + jnz L001maw_loop +$L000maw_finish: + mov ecx, DWORD PTR 32[esp] + and ecx, 7 + jnz $L002maw_finish2 + jmp $L003maw_end +$L002maw_finish2: + ; Tail Round 0 + mov eax, DWORD PTR [ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR [edi] + adc edx, 0 + add eax, esi + adc edx, 0 + dec ecx + mov DWORD PTR [edi],eax + mov esi, edx + jz $L003maw_end + ; Tail Round 1 + mov eax, DWORD PTR 4[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 4[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + dec ecx + mov DWORD PTR 4[edi],eax + mov esi, edx + jz $L003maw_end + ; Tail Round 2 + mov eax, DWORD PTR 8[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 8[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + dec ecx + mov DWORD PTR 8[edi],eax + mov esi, edx + jz $L003maw_end + ; Tail Round 3 + mov eax, DWORD PTR 12[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 12[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + dec ecx + mov DWORD PTR 12[edi],eax + mov esi, edx + jz $L003maw_end + ; Tail Round 4 + mov eax, DWORD PTR 16[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 16[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + dec ecx + mov DWORD PTR 16[edi],eax + mov esi, edx + jz $L003maw_end + ; Tail Round 5 + mov eax, DWORD PTR 20[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 20[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + dec ecx + mov DWORD PTR 20[edi],eax + mov esi, edx + jz $L003maw_end + ; Tail Round 6 + mov eax, DWORD PTR 24[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 24[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR 24[edi],eax + mov esi, edx +$L003maw_end: + mov eax, esi + pop ecx + pop edi + pop esi + pop ebx + pop ebp + ret +_bn_mul_add_words ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _bn_mul_words + +_bn_mul_words PROC NEAR + push ebp + push ebx + push esi + push edi + ; + xor esi, esi + mov edi, DWORD PTR 20[esp] + mov ebx, DWORD PTR 24[esp] + mov ebp, DWORD PTR 28[esp] + mov ecx, DWORD PTR 32[esp] + and ebp, 4294967288 + jz $L004mw_finish +L005mw_loop: + ; Round 0 + mov eax, DWORD PTR [ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR [edi],eax + mov esi, edx + ; Round 4 + mov eax, DWORD PTR 4[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 4[edi],eax + mov esi, edx + ; Round 8 + mov eax, DWORD PTR 8[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 8[edi],eax + mov esi, edx + ; Round 12 + mov eax, DWORD PTR 12[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 12[edi],eax + mov esi, edx + ; Round 16 + mov eax, DWORD PTR 16[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 16[edi],eax + mov esi, edx + ; Round 20 + mov eax, DWORD PTR 20[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 20[edi],eax + mov esi, edx + ; Round 24 + mov eax, DWORD PTR 24[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 24[edi],eax + mov esi, edx + ; Round 28 + mov eax, DWORD PTR 28[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 28[edi],eax + mov esi, edx + ; + add ebx, 32 + add edi, 32 + sub ebp, 8 + jz $L004mw_finish + jmp L005mw_loop +$L004mw_finish: + mov ebp, DWORD PTR 28[esp] + and ebp, 7 + jnz $L006mw_finish2 + jmp $L007mw_end +$L006mw_finish2: + ; Tail Round 0 + mov eax, DWORD PTR [ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR [edi],eax + mov esi, edx + dec ebp + jz $L007mw_end + ; Tail Round 1 + mov eax, DWORD PTR 4[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 4[edi],eax + mov esi, edx + dec ebp + jz $L007mw_end + ; Tail Round 2 + mov eax, DWORD PTR 8[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 8[edi],eax + mov esi, edx + dec ebp + jz $L007mw_end + ; Tail Round 3 + mov eax, DWORD PTR 12[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 12[edi],eax + mov esi, edx + dec ebp + jz $L007mw_end + ; Tail Round 4 + mov eax, DWORD PTR 16[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 16[edi],eax + mov esi, edx + dec ebp + jz $L007mw_end + ; Tail Round 5 + mov eax, DWORD PTR 20[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 20[edi],eax + mov esi, edx + dec ebp + jz $L007mw_end + ; Tail Round 6 + mov eax, DWORD PTR 24[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 24[edi],eax + mov esi, edx +$L007mw_end: + mov eax, esi + pop edi + pop esi + pop ebx + pop ebp + ret +_bn_mul_words ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _bn_sqr_words + +_bn_sqr_words PROC NEAR + push ebp + push ebx + push esi + push edi + ; + mov esi, DWORD PTR 20[esp] + mov edi, DWORD PTR 24[esp] + mov ebx, DWORD PTR 28[esp] + and ebx, 4294967288 + jz $L008sw_finish +L009sw_loop: + ; Round 0 + mov eax, DWORD PTR [edi] + mul eax + mov DWORD PTR [esi],eax + mov DWORD PTR 4[esi],edx + ; Round 4 + mov eax, DWORD PTR 4[edi] + mul eax + mov DWORD PTR 8[esi],eax + mov DWORD PTR 12[esi],edx + ; Round 8 + mov eax, DWORD PTR 8[edi] + mul eax + mov DWORD PTR 16[esi],eax + mov DWORD PTR 20[esi],edx + ; Round 12 + mov eax, DWORD PTR 12[edi] + mul eax + mov DWORD PTR 24[esi],eax + mov DWORD PTR 28[esi],edx + ; Round 16 + mov eax, DWORD PTR 16[edi] + mul eax + mov DWORD PTR 32[esi],eax + mov DWORD PTR 36[esi],edx + ; Round 20 + mov eax, DWORD PTR 20[edi] + mul eax + mov DWORD PTR 40[esi],eax + mov DWORD PTR 44[esi],edx + ; Round 24 + mov eax, DWORD PTR 24[edi] + mul eax + mov DWORD PTR 48[esi],eax + mov DWORD PTR 52[esi],edx + ; Round 28 + mov eax, DWORD PTR 28[edi] + mul eax + mov DWORD PTR 56[esi],eax + mov DWORD PTR 60[esi],edx + ; + add edi, 32 + add esi, 64 + sub ebx, 8 + jnz L009sw_loop +$L008sw_finish: + mov ebx, DWORD PTR 28[esp] + and ebx, 7 + jz $L010sw_end + ; Tail Round 0 + mov eax, DWORD PTR [edi] + mul eax + mov DWORD PTR [esi],eax + dec ebx + mov DWORD PTR 4[esi],edx + jz $L010sw_end + ; Tail Round 1 + mov eax, DWORD PTR 4[edi] + mul eax + mov DWORD PTR 8[esi],eax + dec ebx + mov DWORD PTR 12[esi],edx + jz $L010sw_end + ; Tail Round 2 + mov eax, DWORD PTR 8[edi] + mul eax + mov DWORD PTR 16[esi],eax + dec ebx + mov DWORD PTR 20[esi],edx + jz $L010sw_end + ; Tail Round 3 + mov eax, DWORD PTR 12[edi] + mul eax + mov DWORD PTR 24[esi],eax + dec ebx + mov DWORD PTR 28[esi],edx + jz $L010sw_end + ; Tail Round 4 + mov eax, DWORD PTR 16[edi] + mul eax + mov DWORD PTR 32[esi],eax + dec ebx + mov DWORD PTR 36[esi],edx + jz $L010sw_end + ; Tail Round 5 + mov eax, DWORD PTR 20[edi] + mul eax + mov DWORD PTR 40[esi],eax + dec ebx + mov DWORD PTR 44[esi],edx + jz $L010sw_end + ; Tail Round 6 + mov eax, DWORD PTR 24[edi] + mul eax + mov DWORD PTR 48[esi],eax + mov DWORD PTR 52[esi],edx +$L010sw_end: + pop edi + pop esi + pop ebx + pop ebp + ret +_bn_sqr_words ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _bn_div64 + +_bn_div64 PROC NEAR + push ebp + push ebx + push esi + push edi + mov edx, DWORD PTR 20[esp] + mov eax, DWORD PTR 24[esp] + mov ebx, DWORD PTR 28[esp] + div ebx + pop edi + pop esi + pop ebx + pop ebp + ret +_bn_div64 ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _bn_add_words + +_bn_add_words PROC NEAR + push ebp + push ebx + push esi + push edi + ; + mov ebx, DWORD PTR 20[esp] + mov esi, DWORD PTR 24[esp] + mov edi, DWORD PTR 28[esp] + mov ebp, DWORD PTR 32[esp] + xor eax, eax + and ebp, 4294967288 + jz $L011aw_finish +L012aw_loop: + ; Round 0 + mov ecx, DWORD PTR [esi] + mov edx, DWORD PTR [edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR [ebx],ecx + ; Round 1 + mov ecx, DWORD PTR 4[esi] + mov edx, DWORD PTR 4[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR 4[ebx],ecx + ; Round 2 + mov ecx, DWORD PTR 8[esi] + mov edx, DWORD PTR 8[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR 8[ebx],ecx + ; Round 3 + mov ecx, DWORD PTR 12[esi] + mov edx, DWORD PTR 12[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR 12[ebx],ecx + ; Round 4 + mov ecx, DWORD PTR 16[esi] + mov edx, DWORD PTR 16[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR 16[ebx],ecx + ; Round 5 + mov ecx, DWORD PTR 20[esi] + mov edx, DWORD PTR 20[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR 20[ebx],ecx + ; Round 6 + mov ecx, DWORD PTR 24[esi] + mov edx, DWORD PTR 24[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR 24[ebx],ecx + ; Round 7 + mov ecx, DWORD PTR 28[esi] + mov edx, DWORD PTR 28[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR 28[ebx],ecx + ; + add esi, 32 + add edi, 32 + add ebx, 32 + sub ebp, 8 + jnz L012aw_loop +$L011aw_finish: + mov ebp, DWORD PTR 32[esp] + and ebp, 7 + jz $L013aw_end + ; Tail Round 0 + mov ecx, DWORD PTR [esi] + mov edx, DWORD PTR [edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + dec ebp + mov DWORD PTR [ebx],ecx + jz $L013aw_end + ; Tail Round 1 + mov ecx, DWORD PTR 4[esi] + mov edx, DWORD PTR 4[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + dec ebp + mov DWORD PTR 4[ebx],ecx + jz $L013aw_end + ; Tail Round 2 + mov ecx, DWORD PTR 8[esi] + mov edx, DWORD PTR 8[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + dec ebp + mov DWORD PTR 8[ebx],ecx + jz $L013aw_end + ; Tail Round 3 + mov ecx, DWORD PTR 12[esi] + mov edx, DWORD PTR 12[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + dec ebp + mov DWORD PTR 12[ebx],ecx + jz $L013aw_end + ; Tail Round 4 + mov ecx, DWORD PTR 16[esi] + mov edx, DWORD PTR 16[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + dec ebp + mov DWORD PTR 16[ebx],ecx + jz $L013aw_end + ; Tail Round 5 + mov ecx, DWORD PTR 20[esi] + mov edx, DWORD PTR 20[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + dec ebp + mov DWORD PTR 20[ebx],ecx + jz $L013aw_end + ; Tail Round 6 + mov ecx, DWORD PTR 24[esi] + mov edx, DWORD PTR 24[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR 24[ebx],ecx +$L013aw_end: + mov eax, eax + pop edi + pop esi + pop ebx + pop ebp + ret +_bn_add_words ENDP +_TEXT ENDS +END diff --git a/src/lib/libcrypto/bn/asm/bn86unix.cpp b/src/lib/libcrypto/bn/asm/bn86unix.cpp new file mode 100644 index 0000000000..64702201ea --- /dev/null +++ b/src/lib/libcrypto/bn/asm/bn86unix.cpp @@ -0,0 +1,752 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define bn_mul_add_words _bn_mul_add_words +#define bn_mul_words _bn_mul_words +#define bn_sqr_words _bn_sqr_words +#define bn_div64 _bn_div64 +#define bn_add_words _bn_add_words + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by bn-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "bn-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl bn_mul_add_words + TYPE(bn_mul_add_words,@function) +bn_mul_add_words: + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + + + xorl %esi, %esi + movl 20(%esp), %edi + movl 28(%esp), %ecx + movl 24(%esp), %ebx + andl $4294967288, %ecx + movl 32(%esp), %ebp + pushl %ecx + jz .L000maw_finish +.L001maw_loop: + movl %ecx, (%esp) + /* Round 0 */ + movl (%ebx), %eax + mull %ebp + addl %esi, %eax + movl (%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, (%edi) + movl %edx, %esi + /* Round 4 */ + movl 4(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 4(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, 4(%edi) + movl %edx, %esi + /* Round 8 */ + movl 8(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 8(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, 8(%edi) + movl %edx, %esi + /* Round 12 */ + movl 12(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 12(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, 12(%edi) + movl %edx, %esi + /* Round 16 */ + movl 16(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 16(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, 16(%edi) + movl %edx, %esi + /* Round 20 */ + movl 20(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 20(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, 20(%edi) + movl %edx, %esi + /* Round 24 */ + movl 24(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 24(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, 24(%edi) + movl %edx, %esi + /* Round 28 */ + movl 28(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 28(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, 28(%edi) + movl %edx, %esi + + movl (%esp), %ecx + addl $32, %ebx + addl $32, %edi + subl $8, %ecx + jnz .L001maw_loop +.L000maw_finish: + movl 32(%esp), %ecx + andl $7, %ecx + jnz .L002maw_finish2 + jmp .L003maw_end +.align ALIGN +.L002maw_finish2: + /* Tail Round 0 */ + movl (%ebx), %eax + mull %ebp + addl %esi, %eax + movl (%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + decl %ecx + movl %eax, (%edi) + movl %edx, %esi + jz .L003maw_end + /* Tail Round 1 */ + movl 4(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 4(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + decl %ecx + movl %eax, 4(%edi) + movl %edx, %esi + jz .L003maw_end + /* Tail Round 2 */ + movl 8(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 8(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + decl %ecx + movl %eax, 8(%edi) + movl %edx, %esi + jz .L003maw_end + /* Tail Round 3 */ + movl 12(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 12(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + decl %ecx + movl %eax, 12(%edi) + movl %edx, %esi + jz .L003maw_end + /* Tail Round 4 */ + movl 16(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 16(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + decl %ecx + movl %eax, 16(%edi) + movl %edx, %esi + jz .L003maw_end + /* Tail Round 5 */ + movl 20(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 20(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + decl %ecx + movl %eax, 20(%edi) + movl %edx, %esi + jz .L003maw_end + /* Tail Round 6 */ + movl 24(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 24(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, 24(%edi) + movl %edx, %esi +.L003maw_end: + movl %esi, %eax + popl %ecx + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.bn_mul_add_words_end: + SIZE(bn_mul_add_words,.bn_mul_add_words_end-bn_mul_add_words) +.ident "bn_mul_add_words" +.text + .align ALIGN +.globl bn_mul_words + TYPE(bn_mul_words,@function) +bn_mul_words: + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + + + xorl %esi, %esi + movl 20(%esp), %edi + movl 24(%esp), %ebx + movl 28(%esp), %ebp + movl 32(%esp), %ecx + andl $4294967288, %ebp + jz .L004mw_finish +.L005mw_loop: + /* Round 0 */ + movl (%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, (%edi) + movl %edx, %esi + /* Round 4 */ + movl 4(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 4(%edi) + movl %edx, %esi + /* Round 8 */ + movl 8(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 8(%edi) + movl %edx, %esi + /* Round 12 */ + movl 12(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 12(%edi) + movl %edx, %esi + /* Round 16 */ + movl 16(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 16(%edi) + movl %edx, %esi + /* Round 20 */ + movl 20(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 20(%edi) + movl %edx, %esi + /* Round 24 */ + movl 24(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 24(%edi) + movl %edx, %esi + /* Round 28 */ + movl 28(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 28(%edi) + movl %edx, %esi + + addl $32, %ebx + addl $32, %edi + subl $8, %ebp + jz .L004mw_finish + jmp .L005mw_loop +.L004mw_finish: + movl 28(%esp), %ebp + andl $7, %ebp + jnz .L006mw_finish2 + jmp .L007mw_end +.align ALIGN +.L006mw_finish2: + /* Tail Round 0 */ + movl (%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, (%edi) + movl %edx, %esi + decl %ebp + jz .L007mw_end + /* Tail Round 1 */ + movl 4(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 4(%edi) + movl %edx, %esi + decl %ebp + jz .L007mw_end + /* Tail Round 2 */ + movl 8(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 8(%edi) + movl %edx, %esi + decl %ebp + jz .L007mw_end + /* Tail Round 3 */ + movl 12(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 12(%edi) + movl %edx, %esi + decl %ebp + jz .L007mw_end + /* Tail Round 4 */ + movl 16(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 16(%edi) + movl %edx, %esi + decl %ebp + jz .L007mw_end + /* Tail Round 5 */ + movl 20(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 20(%edi) + movl %edx, %esi + decl %ebp + jz .L007mw_end + /* Tail Round 6 */ + movl 24(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 24(%edi) + movl %edx, %esi +.L007mw_end: + movl %esi, %eax + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.bn_mul_words_end: + SIZE(bn_mul_words,.bn_mul_words_end-bn_mul_words) +.ident "bn_mul_words" +.text + .align ALIGN +.globl bn_sqr_words + TYPE(bn_sqr_words,@function) +bn_sqr_words: + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + + + movl 20(%esp), %esi + movl 24(%esp), %edi + movl 28(%esp), %ebx + andl $4294967288, %ebx + jz .L008sw_finish +.L009sw_loop: + /* Round 0 */ + movl (%edi), %eax + mull %eax + movl %eax, (%esi) + movl %edx, 4(%esi) + /* Round 4 */ + movl 4(%edi), %eax + mull %eax + movl %eax, 8(%esi) + movl %edx, 12(%esi) + /* Round 8 */ + movl 8(%edi), %eax + mull %eax + movl %eax, 16(%esi) + movl %edx, 20(%esi) + /* Round 12 */ + movl 12(%edi), %eax + mull %eax + movl %eax, 24(%esi) + movl %edx, 28(%esi) + /* Round 16 */ + movl 16(%edi), %eax + mull %eax + movl %eax, 32(%esi) + movl %edx, 36(%esi) + /* Round 20 */ + movl 20(%edi), %eax + mull %eax + movl %eax, 40(%esi) + movl %edx, 44(%esi) + /* Round 24 */ + movl 24(%edi), %eax + mull %eax + movl %eax, 48(%esi) + movl %edx, 52(%esi) + /* Round 28 */ + movl 28(%edi), %eax + mull %eax + movl %eax, 56(%esi) + movl %edx, 60(%esi) + + addl $32, %edi + addl $64, %esi + subl $8, %ebx + jnz .L009sw_loop +.L008sw_finish: + movl 28(%esp), %ebx + andl $7, %ebx + jz .L010sw_end + /* Tail Round 0 */ + movl (%edi), %eax + mull %eax + movl %eax, (%esi) + decl %ebx + movl %edx, 4(%esi) + jz .L010sw_end + /* Tail Round 1 */ + movl 4(%edi), %eax + mull %eax + movl %eax, 8(%esi) + decl %ebx + movl %edx, 12(%esi) + jz .L010sw_end + /* Tail Round 2 */ + movl 8(%edi), %eax + mull %eax + movl %eax, 16(%esi) + decl %ebx + movl %edx, 20(%esi) + jz .L010sw_end + /* Tail Round 3 */ + movl 12(%edi), %eax + mull %eax + movl %eax, 24(%esi) + decl %ebx + movl %edx, 28(%esi) + jz .L010sw_end + /* Tail Round 4 */ + movl 16(%edi), %eax + mull %eax + movl %eax, 32(%esi) + decl %ebx + movl %edx, 36(%esi) + jz .L010sw_end + /* Tail Round 5 */ + movl 20(%edi), %eax + mull %eax + movl %eax, 40(%esi) + decl %ebx + movl %edx, 44(%esi) + jz .L010sw_end + /* Tail Round 6 */ + movl 24(%edi), %eax + mull %eax + movl %eax, 48(%esi) + movl %edx, 52(%esi) +.L010sw_end: + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.bn_sqr_words_end: + SIZE(bn_sqr_words,.bn_sqr_words_end-bn_sqr_words) +.ident "bn_sqr_words" +.text + .align ALIGN +.globl bn_div64 + TYPE(bn_div64,@function) +bn_div64: + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + + movl 20(%esp), %edx + movl 24(%esp), %eax + movl 28(%esp), %ebx + divl %ebx + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.bn_div64_end: + SIZE(bn_div64,.bn_div64_end-bn_div64) +.ident "bn_div64" +.text + .align ALIGN +.globl bn_add_words + TYPE(bn_add_words,@function) +bn_add_words: + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + + + movl 20(%esp), %ebx + movl 24(%esp), %esi + movl 28(%esp), %edi + movl 32(%esp), %ebp + xorl %eax, %eax + andl $4294967288, %ebp + jz .L011aw_finish +.L012aw_loop: + /* Round 0 */ + movl (%esi), %ecx + movl (%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, (%ebx) + /* Round 1 */ + movl 4(%esi), %ecx + movl 4(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, 4(%ebx) + /* Round 2 */ + movl 8(%esi), %ecx + movl 8(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, 8(%ebx) + /* Round 3 */ + movl 12(%esi), %ecx + movl 12(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, 12(%ebx) + /* Round 4 */ + movl 16(%esi), %ecx + movl 16(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, 16(%ebx) + /* Round 5 */ + movl 20(%esi), %ecx + movl 20(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, 20(%ebx) + /* Round 6 */ + movl 24(%esi), %ecx + movl 24(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, 24(%ebx) + /* Round 7 */ + movl 28(%esi), %ecx + movl 28(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, 28(%ebx) + + addl $32, %esi + addl $32, %edi + addl $32, %ebx + subl $8, %ebp + jnz .L012aw_loop +.L011aw_finish: + movl 32(%esp), %ebp + andl $7, %ebp + jz .L013aw_end + /* Tail Round 0 */ + movl (%esi), %ecx + movl (%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + decl %ebp + movl %ecx, (%ebx) + jz .L013aw_end + /* Tail Round 1 */ + movl 4(%esi), %ecx + movl 4(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + decl %ebp + movl %ecx, 4(%ebx) + jz .L013aw_end + /* Tail Round 2 */ + movl 8(%esi), %ecx + movl 8(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + decl %ebp + movl %ecx, 8(%ebx) + jz .L013aw_end + /* Tail Round 3 */ + movl 12(%esi), %ecx + movl 12(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + decl %ebp + movl %ecx, 12(%ebx) + jz .L013aw_end + /* Tail Round 4 */ + movl 16(%esi), %ecx + movl 16(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + decl %ebp + movl %ecx, 16(%ebx) + jz .L013aw_end + /* Tail Round 5 */ + movl 20(%esi), %ecx + movl 20(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + decl %ebp + movl %ecx, 20(%ebx) + jz .L013aw_end + /* Tail Round 6 */ + movl 24(%esi), %ecx + movl 24(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, 24(%ebx) +.L013aw_end: + movl %eax, %eax + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.bn_add_words_end: + SIZE(bn_add_words,.bn_add_words_end-bn_add_words) +.ident "bn_add_words" diff --git a/src/lib/libcrypto/bn/asm/sparc.s b/src/lib/libcrypto/bn/asm/sparc.s new file mode 100644 index 0000000000..f9e533caa8 --- /dev/null +++ b/src/lib/libcrypto/bn/asm/sparc.s @@ -0,0 +1,462 @@ + .file "bn_mulw.c" +gcc2_compiled.: +.section ".text" + .align 4 + .global bn_mul_add_words + .type bn_mul_add_words,#function + .proc 016 +bn_mul_add_words: + !#PROLOGUE# 0 + save %sp,-112,%sp + !#PROLOGUE# 1 + mov %i0,%o0 + mov %i1,%o2 + mov %i2,%g1 + mov %i3,%o1 + mov 0,%i4 + add %o0,12,%g4 + add %o2,12,%o7 +.LL2: + mov %i4,%i3 + mov 0,%i2 + ld [%o0],%g2 + mov %g2,%i1 + ld [%o2],%g2 + mov 0,%i0 + umul %o1,%g2,%g3 + rd %y,%g2 + addcc %g3,%i1,%g3 + addx %g2,%i0,%g2 + addcc %g3,%i3,%g3 + addx %g2,%i2,%g2 + st %g3,[%o0] + mov %g2,%i5 + mov 0,%i4 + addcc %g1,-1,%g1 + be .LL3 + mov %i5,%i4 + mov %i4,%i3 + mov 0,%i2 + ld [%g4-8],%g2 + mov %g2,%i1 + ld [%o7-8],%g2 + mov 0,%i0 + umul %o1,%g2,%g3 + rd %y,%g2 + addcc %g3,%i1,%g3 + addx %g2,%i0,%g2 + addcc %g3,%i3,%g3 + addx %g2,%i2,%g2 + st %g3,[%g4-8] + mov %g2,%i5 + mov 0,%i4 + addcc %g1,-1,%g1 + be .LL3 + mov %i5,%i4 + mov %i4,%i3 + mov 0,%i2 + ld [%g4-4],%g2 + mov %g2,%i1 + ld [%o7-4],%g2 + mov 0,%i0 + umul %o1,%g2,%g3 + rd %y,%g2 + addcc %g3,%i1,%g3 + addx %g2,%i0,%g2 + addcc %g3,%i3,%g3 + addx %g2,%i2,%g2 + st %g3,[%g4-4] + mov %g2,%i5 + mov 0,%i4 + addcc %g1,-1,%g1 + be .LL3 + mov %i5,%i4 + mov %i4,%i3 + mov 0,%i2 + ld [%g4],%g2 + mov %g2,%i1 + ld [%o7],%g2 + mov 0,%i0 + umul %o1,%g2,%g3 + rd %y,%g2 + addcc %g3,%i1,%g3 + addx %g2,%i0,%g2 + addcc %g3,%i3,%g3 + addx %g2,%i2,%g2 + st %g3,[%g4] + mov %g2,%i5 + mov 0,%i4 + addcc %g1,-1,%g1 + be .LL3 + mov %i5,%i4 + add %o7,16,%o7 + add %o2,16,%o2 + add %g4,16,%g4 + b .LL2 + add %o0,16,%o0 +.LL3: + ret + restore %g0,%i4,%o0 +.LLfe1: + .size bn_mul_add_words,.LLfe1-bn_mul_add_words + .align 4 + .global bn_mul_words + .type bn_mul_words,#function + .proc 016 +bn_mul_words: + !#PROLOGUE# 0 + save %sp,-112,%sp + !#PROLOGUE# 1 + mov %i0,%o7 + mov %i1,%o0 + mov %i2,%i4 + mov %i3,%g4 + mov 0,%i0 + add %o7,12,%g1 + add %o0,12,%i5 +.LL18: + mov %i0,%g3 + mov 0,%g2 + ld [%o0],%i2 + umul %g4,%i2,%i3 + rd %y,%i2 + addcc %i3,%g3,%i3 + addx %i2,%g2,%i2 + st %i3,[%o7] + mov %i2,%i1 + mov 0,%i0 + addcc %i4,-1,%i4 + be .LL19 + mov %i1,%i0 + mov %i0,%g3 + mov 0,%g2 + ld [%i5-8],%i2 + umul %g4,%i2,%i3 + rd %y,%i2 + addcc %i3,%g3,%i3 + addx %i2,%g2,%i2 + st %i3,[%g1-8] + mov %i2,%i1 + mov 0,%i0 + addcc %i4,-1,%i4 + be .LL19 + mov %i1,%i0 + mov %i0,%g3 + mov 0,%g2 + ld [%i5-4],%i2 + umul %g4,%i2,%i3 + rd %y,%i2 + addcc %i3,%g3,%i3 + addx %i2,%g2,%i2 + st %i3,[%g1-4] + mov %i2,%i1 + mov 0,%i0 + addcc %i4,-1,%i4 + be .LL19 + mov %i1,%i0 + mov %i0,%g3 + mov 0,%g2 + ld [%i5],%i2 + umul %g4,%i2,%i3 + rd %y,%i2 + addcc %i3,%g3,%i3 + addx %i2,%g2,%i2 + st %i3,[%g1] + mov %i2,%i1 + mov 0,%i0 + addcc %i4,-1,%i4 + be .LL19 + mov %i1,%i0 + add %i5,16,%i5 + add %o0,16,%o0 + add %g1,16,%g1 + b .LL18 + add %o7,16,%o7 +.LL19: + ret + restore +.LLfe2: + .size bn_mul_words,.LLfe2-bn_mul_words + .align 4 + .global bn_sqr_words + .type bn_sqr_words,#function + .proc 020 +bn_sqr_words: + !#PROLOGUE# 0 + !#PROLOGUE# 1 + mov %o0,%g4 + add %g4,28,%o3 + add %o1,12,%g1 +.LL34: + ld [%o1],%o0 + addcc %o2,-1,%o2 + umul %o0,%o0,%o5 + rd %y,%o4 + st %o5,[%g4] + mov %o4,%g3 + mov 0,%g2 + be .LL35 + st %g3,[%o3-24] + ld [%g1-8],%o0 + addcc %o2,-1,%o2 + umul %o0,%o0,%o5 + rd %y,%o4 + st %o5,[%o3-20] + mov %o4,%g3 + mov 0,%g2 + be .LL35 + st %g3,[%o3-16] + ld [%g1-4],%o0 + addcc %o2,-1,%o2 + umul %o0,%o0,%o5 + rd %y,%o4 + st %o5,[%o3-12] + mov %o4,%g3 + mov 0,%g2 + be .LL35 + st %g3,[%o3-8] + ld [%g1],%o0 + addcc %o2,-1,%o2 + umul %o0,%o0,%o5 + rd %y,%o4 + st %o5,[%o3-4] + mov %o4,%g3 + mov 0,%g2 + be .LL35 + st %g3,[%o3] + add %g1,16,%g1 + add %o1,16,%o1 + add %o3,32,%o3 + b .LL34 + add %g4,32,%g4 +.LL35: + retl + nop +.LLfe3: + .size bn_sqr_words,.LLfe3-bn_sqr_words + .align 4 + .global bn_add_words + .type bn_add_words,#function + .proc 016 +bn_add_words: + !#PROLOGUE# 0 + save %sp,-112,%sp + !#PROLOGUE# 1 + mov %i0,%o2 + mov %i1,%o3 + mov %i2,%o4 + mov %i3,%i5 + mov 0,%o0 + mov 0,%o1 + add %o2,12,%o7 + add %o4,12,%g4 + b .LL42 + add %o3,12,%g1 +.LL45: + add %i5,-1,%i5 + mov %i4,%g3 + ld [%g4-8],%i4 + mov 0,%g2 + mov %i4,%i1 + mov 0,%i0 + addcc %g3,%i1,%g3 + addx %g2,%i0,%g2 + addcc %o1,%g3,%o1 + addx %o0,%g2,%o0 + st %o1,[%o7-8] + mov %o0,%i3 + mov 0,%i2 + mov %i2,%o0 + mov %i3,%o1 + cmp %i5,0 + ble .LL43 + add %i5,-1,%i5 + ld [%g1-4],%i4 + mov %i4,%g3 + ld [%g4-4],%i4 + mov 0,%g2 + mov %i4,%i1 + mov 0,%i0 + addcc %g3,%i1,%g3 + addx %g2,%i0,%g2 + addcc %o1,%g3,%o1 + addx %o0,%g2,%o0 + st %o1,[%o7-4] + mov %o0,%i3 + mov 0,%i2 + mov %i2,%o0 + mov %i3,%o1 + cmp %i5,0 + ble .LL43 + add %i5,-1,%i5 + ld [%g1],%i4 + mov %i4,%g3 + ld [%g4],%i4 + mov 0,%g2 + mov %i4,%i1 + mov 0,%i0 + addcc %g3,%i1,%g3 + addx %g2,%i0,%g2 + addcc %o1,%g3,%o1 + addx %o0,%g2,%o0 + st %o1,[%o7] + mov %o0,%i3 + mov 0,%i2 + mov %i2,%o0 + mov %i3,%o1 + cmp %i5,0 + ble .LL43 + add %g1,16,%g1 + add %o3,16,%o3 + add %g4,16,%g4 + add %o4,16,%o4 + add %o7,16,%o7 + add %o2,16,%o2 +.LL42: + ld [%o3],%i4 + add %i5,-1,%i5 + mov %i4,%g3 + ld [%o4],%i4 + mov 0,%g2 + mov %i4,%i1 + mov 0,%i0 + addcc %g3,%i1,%g3 + addx %g2,%i0,%g2 + addcc %o1,%g3,%o1 + addx %o0,%g2,%o0 + st %o1,[%o2] + mov %o0,%i3 + mov 0,%i2 + mov %i2,%o0 + mov %i3,%o1 + cmp %i5,0 + bg,a .LL45 + ld [%g1-8],%i4 +.LL43: + ret + restore %g0,%o1,%o0 +.LLfe4: + .size bn_add_words,.LLfe4-bn_add_words +.section ".rodata" + .align 8 +.LLC0: + .asciz "Division would overflow (%d)\n" +.section ".text" + .align 4 + .global bn_div64 + .type bn_div64,#function + .proc 016 +bn_div64: + !#PROLOGUE# 0 + save %sp,-112,%sp + !#PROLOGUE# 1 + mov 0,%l1 + cmp %i2,0 + bne .LL51 + mov 2,%l0 + b .LL68 + mov -1,%i0 +.LL51: + call BN_num_bits_word,0 + mov %i2,%o0 + mov %o0,%o2 + cmp %o2,32 + be .LL52 + mov 1,%o0 + sll %o0,%o2,%o0 + cmp %i0,%o0 + bleu .LL69 + mov 32,%o0 + sethi %hi(__iob+32),%o0 + or %o0,%lo(__iob+32),%o0 + sethi %hi(.LLC0),%o1 + call fprintf,0 + or %o1,%lo(.LLC0),%o1 + call abort,0 + nop +.LL52: + mov 32,%o0 +.LL69: + cmp %i0,%i2 + blu .LL53 + sub %o0,%o2,%o2 + sub %i0,%i2,%i0 +.LL53: + cmp %o2,0 + be .LL54 + sll %i0,%o2,%o1 + sll %i2,%o2,%i2 + sub %o0,%o2,%o0 + srl %i1,%o0,%o0 + or %o1,%o0,%i0 + sll %i1,%o2,%i1 +.LL54: + srl %i2,16,%g2 + sethi %hi(65535),%o0 + or %o0,%lo(65535),%o1 + and %i2,%o1,%g3 + mov %o0,%g4 + sethi %hi(-65536),%o7 + mov %o1,%g1 +.LL55: + srl %i0,16,%o0 + cmp %o0,%g2 + be .LL59 + or %g4,%lo(65535),%o3 + wr %g0,%g0,%y + nop + nop + nop + udiv %i0,%g2,%o3 +.LL59: + and %i1,%o7,%o0 + srl %o0,16,%o5 + smul %o3,%g3,%o4 + smul %o3,%g2,%o2 +.LL60: + sub %i0,%o2,%o1 + andcc %o1,%o7,%g0 + bne .LL61 + sll %o1,16,%o0 + add %o0,%o5,%o0 + cmp %o4,%o0 + bleu .LL61 + sub %o4,%g3,%o4 + sub %o2,%g2,%o2 + b .LL60 + add %o3,-1,%o3 +.LL61: + smul %o3,%g2,%o2 + smul %o3,%g3,%o0 + srl %o0,16,%o1 + sll %o0,16,%o0 + and %o0,%o7,%o0 + cmp %i1,%o0 + bgeu .LL65 + add %o2,%o1,%o2 + add %o2,1,%o2 +.LL65: + cmp %i0,%o2 + bgeu .LL66 + sub %i1,%o0,%i1 + add %i0,%i2,%i0 + add %o3,-1,%o3 +.LL66: + addcc %l0,-1,%l0 + be .LL56 + sub %i0,%o2,%i0 + sll %o3,16,%l1 + sll %i0,16,%o0 + srl %i1,16,%o1 + or %o0,%o1,%i0 + and %i1,%g1,%o0 + b .LL55 + sll %o0,16,%i1 +.LL56: + or %l1,%o3,%i0 +.LL68: + ret + restore +.LLfe5: + .size bn_div64,.LLfe5-bn_div64 + .ident "GCC: (GNU) 2.7.2.3" diff --git a/src/lib/libcrypto/bn/asm/x86w16.asm b/src/lib/libcrypto/bn/asm/x86w16.asm new file mode 100644 index 0000000000..74a933a8cd --- /dev/null +++ b/src/lib/libcrypto/bn/asm/x86w16.asm @@ -0,0 +1,297 @@ +; Static Name Aliases +; + TITLE bn_mulw.c + .8087 +F_TEXT SEGMENT WORD PUBLIC 'CODE' +F_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS +DGROUP GROUP CONST, _BSS, _DATA + ASSUME DS: DGROUP, SS: DGROUP +F_TEXT SEGMENT + ASSUME CS: F_TEXT + PUBLIC _bn_mul_add_words +_bn_mul_add_words PROC FAR +; Line 58 + push bp + push bx + push si + push di + push ds + push es + mov bp,sp +; w = 26 +; num = 24 +; ap = 20 +; rp = 16 + xor si,si ;c=0; + mov di,WORD PTR [bp+16] ; load r + mov ds,WORD PTR [bp+18] ; load r + mov bx,WORD PTR [bp+20] ; load a + mov es,WORD PTR [bp+22] ; load a + mov cx,WORD PTR [bp+26] ; load w + mov bp,WORD PTR [bp+24] ; load num + + shr bp,1 ; div count by 4 and do groups of 4 + shr bp,1 + je $L555 + +$L546: + mov ax,cx + mul WORD PTR es:[bx] ; w* *a + add ax,WORD PTR ds:[di] ; + *r + adc dx,0 + adc ax,si + adc dx,0 + mov WORD PTR ds:[di],ax + mov si,dx + ; + mov ax,cx + mul WORD PTR es:[bx+2] ; w* *a + add ax,WORD PTR ds:[di+2] ; + *r + adc dx,0 + adc ax,si + adc dx,0 + mov WORD PTR ds:[di+2],ax + mov si,dx + ; + mov ax,cx + mul WORD PTR es:[bx+4] ; w* *a + add ax,WORD PTR ds:[di+4] ; + *r + adc dx,0 + adc ax,si + adc dx,0 + mov WORD PTR ds:[di+4],ax + mov si,dx + ; + mov ax,cx + mul WORD PTR es:[bx+6] ; w* *a + add ax,WORD PTR ds:[di+6] ; + *r + adc dx,0 + adc ax,si + adc dx,0 + mov WORD PTR ds:[di+6],ax + mov si,dx + ; + add bx,8 + add di,8 + ; + dec bp + je $L555 + jmp $L546 +; +; +$L555: + mov bp,sp + mov bp,WORD PTR [bp+24] ; load num + and bp,3 + dec bp + js $L547 + + mov ax,cx + mul WORD PTR es:[bx] ; w* *a + add ax,WORD PTR ds:[di] ; + *r + adc dx,0 + adc ax,si + adc dx,0 + mov WORD PTR ds:[di],ax + mov si,dx + dec bp + js $L547 ; Note that we are now testing for -1 + ; + mov ax,cx + mul WORD PTR es:[bx+2] ; w* *a + add ax,WORD PTR ds:[di+2] ; + *r + adc dx,0 + adc ax,si + adc dx,0 + mov WORD PTR ds:[di+2],ax + mov si,dx + dec bp + js $L547 + ; + mov ax,cx + mul WORD PTR es:[bx+4] ; w* *a + add ax,WORD PTR ds:[di+4] ; + *r + adc dx,0 + adc ax,si + adc dx,0 + mov WORD PTR ds:[di+4],ax + mov si,dx +$L547: + mov ax,si + pop es + pop ds + pop di + pop si + pop bx + pop bp + ret + nop + +_bn_mul_add_words ENDP + PUBLIC _bn_mul_words +_bn_mul_words PROC FAR +; Line 76 + push bp + push bx + push si + push di + push ds + push es + xor si,si + mov bp,sp + mov di,WORD PTR [bp+16] ; r + mov ds,WORD PTR [bp+18] + mov bx,WORD PTR [bp+20] ; a + mov es,WORD PTR [bp+22] + mov cx,WORD PTR [bp+26] ; w + mov bp,WORD PTR [bp+24] ; num +$FC743: + mov ax,cx + mul WORD PTR es:[bx] + add ax,si + adc dx,0 + mov WORD PTR ds:[di],ax + mov si,dx + dec bp + je $L764 + ; + mov ax,cx + mul WORD PTR es:[bx+2] + add ax,si + adc dx,0 + mov WORD PTR ds:[di+2],ax + mov si,dx + dec bp + je $L764 + ; + mov ax,cx + mul WORD PTR es:[bx+4] + add ax,si + adc dx,0 + mov WORD PTR ds:[di+4],ax + mov si,dx + dec bp + je $L764 + ; + mov ax,cx + mul WORD PTR es:[bx+6] + add ax,si + adc dx,0 + mov WORD PTR ds:[di+6],ax + mov si,dx + dec bp + je $L764 + ; + add bx,8 + add di,8 + jmp $FC743 + nop +$L764: + mov ax,si + pop es + pop ds + pop di + pop si + pop bx + pop bp + ret + nop +_bn_mul_words ENDP + PUBLIC _bn_sqr_words +_bn_sqr_words PROC FAR +; Line 92 + push bp + push bx + push si + push di + push ds + push es + mov bp,sp + mov si,WORD PTR [bp+16] + mov ds,WORD PTR [bp+18] + mov di,WORD PTR [bp+20] + mov es,WORD PTR [bp+22] + mov bx,WORD PTR [bp+24] + + mov bp,bx ; save a memory lookup later + shr bx,1 ; div count by 4 and do groups of 4 + shr bx,1 + je $L666 + +$L765: + mov ax,WORD PTR es:[di] + mul ax + mov WORD PTR ds:[si],ax + mov WORD PTR ds:[si+2],dx + ; + mov ax,WORD PTR es:[di+2] + mul ax + mov WORD PTR ds:[si+4],ax + mov WORD PTR ds:[si+6],dx + ; + mov ax,WORD PTR es:[di+4] + mul ax + mov WORD PTR ds:[si+8],ax + mov WORD PTR ds:[si+10],dx + ; + mov ax,WORD PTR es:[di+6] + mul ax + mov WORD PTR ds:[si+12],ax + mov WORD PTR ds:[si+14],dx + ; + add di,8 + add si,16 + dec bx + je $L666 + jmp $L765 +$L666: + and bp,3 + dec bp ; The copied value of bx (num) + js $L645 + ; + mov ax,WORD PTR es:[di] + mul ax + mov WORD PTR ds:[si],ax + mov WORD PTR ds:[si+2],dx + dec bp + js $L645 + ; + mov ax,WORD PTR es:[di+2] + mul ax + mov WORD PTR ds:[si+4],ax + mov WORD PTR ds:[si+6],dx + dec bp + js $L645 + ; + mov ax,WORD PTR es:[di+4] + mul ax + mov WORD PTR ds:[si+8],ax + mov WORD PTR ds:[si+10],dx +$L645: + pop es + pop ds + pop di + pop si + pop bx + pop bp + ret + +_bn_sqr_words ENDP + PUBLIC _bn_div64 +_bn_div64 PROC FAR + push bp + mov bp,sp + mov dx, WORD PTR [bp+6] + mov ax, WORD PTR [bp+8] + div WORD PTR [bp+10] + pop bp + ret +_bn_div64 ENDP +F_TEXT ENDS +END diff --git a/src/lib/libcrypto/bn/asm/x86w32.asm b/src/lib/libcrypto/bn/asm/x86w32.asm new file mode 100644 index 0000000000..fc6f917714 --- /dev/null +++ b/src/lib/libcrypto/bn/asm/x86w32.asm @@ -0,0 +1,362 @@ +; Static Name Aliases +; + TITLE bn_mulw.c + .386 +F_TEXT SEGMENT WORD USE16 PUBLIC 'CODE' +F_TEXT ENDS +_DATA SEGMENT WORD USE16 PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD USE16 PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD USE16 PUBLIC 'BSS' +_BSS ENDS +DGROUP GROUP CONST, _BSS, _DATA + ASSUME DS: DGROUP, SS: DGROUP +F_TEXT SEGMENT + ASSUME CS: F_TEXT + PUBLIC _bn_mul_add_words +_bn_mul_add_words PROC FAR +; Line 58 + push bp + push bx + push esi + push di + push ds + push es + mov bp,sp +; w = 28 +; num = 26 +; ap = 22 +; rp = 18 + xor esi,esi ;c=0; + mov di,WORD PTR [bp+18] ; load r + mov ds,WORD PTR [bp+20] ; load r + mov bx,WORD PTR [bp+22] ; load a + mov es,WORD PTR [bp+24] ; load a + mov ecx,DWORD PTR [bp+28] ; load w + mov bp,WORD PTR [bp+26] ; load num + shr bp,1 ; div count by 4 and do groups of 4 + shr bp,1 + je $L555 + +$L546: + mov eax,ecx + mul DWORD PTR es:[bx] ; w* *a + add eax,DWORD PTR ds:[di] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di],eax + mov esi,edx + ; + mov eax,ecx + mul DWORD PTR es:[bx+4] ; w* *a + add eax,DWORD PTR ds:[di+4] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di+4],eax + mov esi,edx + ; + mov eax,ecx + mul DWORD PTR es:[bx+8] ; w* *a + add eax,DWORD PTR ds:[di+8] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di+8],eax + mov esi,edx + ; + mov eax,ecx + mul DWORD PTR es:[bx+12] ; w* *a + add eax,DWORD PTR ds:[di+12] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di+12],eax + mov esi,edx + ; + add bx,16 + add di,16 + ; + dec bp + je $L555 + jmp $L546 +; +; +$L555: + mov bp,sp + mov bp,WORD PTR [bp+26] ; load num + and bp,3 + dec bp + js $L547 + + mov eax,ecx + mul DWORD PTR es:[bx] ; w* *a + add eax,DWORD PTR ds:[di] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di],eax + mov esi,edx + dec bp + js $L547 ; Note that we are now testing for -1 + ; + mov eax,ecx + mul DWORD PTR es:[bx+4] ; w* *a + add eax,DWORD PTR ds:[di+4] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di+4],eax + mov esi,edx + dec bp + js $L547 + ; + mov eax,ecx + mul DWORD PTR es:[bx+8] ; w* *a + add eax,DWORD PTR ds:[di+8] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di+8],eax + mov esi,edx +$L547: + mov eax,esi + mov edx,esi + shr edx,16 + pop es + pop ds + pop di + pop esi + pop bx + pop bp + ret + nop +_bn_mul_add_words ENDP + + PUBLIC _bn_mul_words +_bn_mul_words PROC FAR +; Line 76 + push bp + push bx + push esi + push di + push ds + push es + xor esi,esi + mov bp,sp + mov di,WORD PTR [bp+18] ; r + mov ds,WORD PTR [bp+20] + mov bx,WORD PTR [bp+22] ; a + mov es,WORD PTR [bp+24] + mov ecx,DWORD PTR [bp+28] ; w + mov bp,WORD PTR [bp+26] ; num + +$FC743: + mov eax,ecx + mul DWORD PTR es:[bx] + add eax,esi + adc edx,0 + mov DWORD PTR ds:[di],eax + mov esi,edx + dec bp + je $L764 + ; + mov eax,ecx + mul DWORD PTR es:[bx+4] + add eax,esi + adc edx,0 + mov DWORD PTR ds:[di+4],eax + mov esi,edx + dec bp + je $L764 + ; + mov eax,ecx + mul DWORD PTR es:[bx+8] + add eax,esi + adc edx,0 + mov DWORD PTR ds:[di+8],eax + mov esi,edx + dec bp + je $L764 + ; + mov eax,ecx + mul DWORD PTR es:[bx+12] + add eax,esi + adc edx,0 + mov DWORD PTR ds:[di+12],eax + mov esi,edx + dec bp + je $L764 + ; + add bx,16 + add di,16 + jmp $FC743 + nop +$L764: + mov eax,esi + mov edx,esi + shr edx,16 + pop es + pop ds + pop di + pop esi + pop bx + pop bp + ret + nop +_bn_mul_words ENDP + PUBLIC _bn_sqr_words +_bn_sqr_words PROC FAR +; Line 92 + push bp + push bx + push si + push di + push ds + push es + mov bp,sp + mov si,WORD PTR [bp+16] + mov ds,WORD PTR [bp+18] + mov di,WORD PTR [bp+20] + mov es,WORD PTR [bp+22] + mov bx,WORD PTR [bp+24] + + mov bp,bx ; save a memory lookup later + shr bx,1 ; div count by 4 and do groups of 4 + shr bx,1 + je $L666 + +$L765: + mov eax,DWORD PTR es:[di] + mul eax + mov DWORD PTR ds:[si],eax + mov DWORD PTR ds:[si+4],edx + ; + mov eax,DWORD PTR es:[di+4] + mul eax + mov DWORD PTR ds:[si+8],eax + mov DWORD PTR ds:[si+12],edx + ; + mov eax,DWORD PTR es:[di+8] + mul eax + mov DWORD PTR ds:[si+16],eax + mov DWORD PTR ds:[si+20],edx + ; + mov eax,DWORD PTR es:[di+12] + mul eax + mov DWORD PTR ds:[si+24],eax + mov DWORD PTR ds:[si+28],edx + ; + add di,16 + add si,32 + dec bx + je $L666 + jmp $L765 +$L666: + and bp,3 + dec bp ; The copied value of bx (num) + js $L645 + ; + mov eax,DWORD PTR es:[di] + mul eax + mov DWORD PTR ds:[si],eax + mov DWORD PTR ds:[si+4],edx + dec bp + js $L645 + ; + mov eax,DWORD PTR es:[di+4] + mul eax + mov DWORD PTR ds:[si+8],eax + mov DWORD PTR ds:[si+12],edx + dec bp + js $L645 + ; + mov eax,DWORD PTR es:[di+8] + mul eax + mov DWORD PTR ds:[si+16],eax + mov DWORD PTR ds:[si+20],edx +$L645: + pop es + pop ds + pop di + pop si + pop bx + pop bp + ret +_bn_sqr_words ENDP + + PUBLIC _bn_div64 +_bn_div64 PROC FAR + push bp + mov bp,sp + mov edx, DWORD PTR [bp+6] + mov eax, DWORD PTR [bp+10] + div DWORD PTR [bp+14] + mov edx,eax + shr edx,16 + pop bp + ret +_bn_div64 ENDP + + PUBLIC _bn_add_words +_bn_add_words PROC FAR +; Line 58 + push bp + push bx + push esi + push di + push ds + push es + mov bp,sp +; w = 28 +; num = 26 +; ap = 22 +; rp = 18 + xor esi,esi ;c=0; + mov si,WORD PTR [bp+22] ; load a + mov es,WORD PTR [bp+24] ; load a + mov di,WORD PTR [bp+26] ; load b + mov ds,WORD PTR [bp+28] ; load b + + mov dx,WORD PTR [bp+30] ; load num + dec dx + js $L547 + xor ecx,ecx + +$L5477: + xor ebx,ebx + mov eax,DWORD PTR es:[si] ; *a + add eax,ecx + adc ebx,0 + add si,4 ; a++ + add eax,DWORD PTR ds:[di] ; + *b + mov ecx,ebx + adc ecx,0 + add di,4 + mov bx,WORD PTR [bp+18] + mov ds,WORD PTR [bp+20] + mov DWORD PTR ds:[bx],eax + add bx,4 + mov ds,WORD PTR [bp+28] + mov WORD PTR [bp+18],bx + dec dx + js $L547 ; Note that we are now testing for -1 + jmp $L5477 + ; +$L547: + mov eax,ecx + mov edx,ecx + shr edx,16 + pop es + pop ds + pop di + pop esi + pop bx + pop bp + ret + nop +_bn_add_words ENDP +F_TEXT ENDS +END diff --git a/src/lib/libcrypto/bn/bn.err b/src/lib/libcrypto/bn/bn.err new file mode 100644 index 0000000000..7ccc247c41 --- /dev/null +++ b/src/lib/libcrypto/bn/bn.err @@ -0,0 +1,27 @@ +/* Error codes for the BN functions. */ + +/* Function codes. */ +#define BN_F_BN_BLINDING_CONVERT 100 +#define BN_F_BN_BLINDING_INVERT 101 +#define BN_F_BN_BLINDING_NEW 102 +#define BN_F_BN_BLINDING_UPDATE 103 +#define BN_F_BN_BN2DEC 104 +#define BN_F_BN_BN2HEX 105 +#define BN_F_BN_CTX_NEW 106 +#define BN_F_BN_DIV 107 +#define BN_F_BN_EXPAND2 108 +#define BN_F_BN_MOD_EXP_MONT 109 +#define BN_F_BN_MOD_INVERSE 110 +#define BN_F_BN_MOD_MUL_RECIPROCAL 111 +#define BN_F_BN_MPI2BN 112 +#define BN_F_BN_NEW 113 +#define BN_F_BN_RAND 114 + +/* Reason codes. */ +#define BN_R_BAD_RECIPROCAL 100 +#define BN_R_CALLED_WITH_EVEN_MODULUS 101 +#define BN_R_DIV_BY_ZERO 102 +#define BN_R_ENCODING_ERROR 103 +#define BN_R_INVALID_LENGTH 104 +#define BN_R_NOT_INITALISED 105 +#define BN_R_NO_INVERSE 106 diff --git a/src/lib/libcrypto/bn/bn.org b/src/lib/libcrypto/bn/bn.org new file mode 100644 index 0000000000..66dde285d6 --- /dev/null +++ b/src/lib/libcrypto/bn/bn.org @@ -0,0 +1,502 @@ +/* crypto/bn/bn.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify bn.org since bn.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +#ifndef HEADER_BN_H +#define HEADER_BN_H + +#ifdef __cplusplus +extern "C" { +#endif + +#undef BN_LLONG + +#ifdef WIN32 +#define BN_LLONG /* This comment stops Configure mutilating things */ +#endif + +#define RECP_MUL_MOD +#define MONT_MUL_MOD + +/* This next option uses the C libraries (2 word)/(1 word) function. + * If it is not defined, I use my C version (which is slower). + * The reason for this flag is that when the particular C compiler + * library routine is used, and the library is linked with a different + * compiler, the library is missing. This mostly happens when the + * library is built with gcc and then linked using nornal cc. This would + * be a common occurance because gcc normally produces code that is + * 2 times faster than system compilers for the big number stuff. + * For machines with only one compiler (or shared libraries), this should + * be on. Again this in only really a problem on machines + * using "long long's", are 32bit, and are not using my assember code. */ +#if defined(MSDOS) || defined(WINDOWS) || defined(linux) +#define BN_DIV2W +#endif + +/* Only one for the following should be defined */ +/* The prime number generation stuff may not work when + * EIGHT_BIT but I don't care since I've only used this mode + * for debuging the bignum libraries */ +#undef SIXTY_FOUR_BIT_LONG +#undef SIXTY_FOUR_BIT +#define THIRTY_TWO_BIT +#undef SIXTEEN_BIT +#undef EIGHT_BIT + +/* assuming long is 64bit - this is the DEC Alpha + * unsigned long long is only 64 bits :-(, don't define + * BN_LLONG for the DEC Alpha */ +#ifdef SIXTY_FOUR_BIT_LONG +#define BN_ULLONG unsigned long long +#define BN_ULONG unsigned long +#define BN_LONG long +#define BN_BITS 128 +#define BN_BYTES 8 +#define BN_BITS2 64 +#define BN_BITS4 32 +#define BN_MASK2 (0xffffffffffffffffL) +#define BN_MASK2l (0xffffffffL) +#define BN_MASK2h (0xffffffff00000000L) +#define BN_MASK2h1 (0xffffffff80000000L) +#define BN_TBIT (0x8000000000000000L) +#define BN_DEC_CONV (10000000000000000000L) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%019lu" +#define BN_DEC_NUM 19 +#endif + +#ifdef SIXTY_FOUR_BIT +#undef BN_LLONG +/* #define BN_ULLONG unsigned long long */ +#define BN_ULONG unsigned long long +#define BN_LONG long long +#define BN_BITS 128 +#define BN_BYTES 8 +#define BN_BITS2 64 +#define BN_BITS4 32 +#define BN_MASK2 (0xffffffffffffffffLL) +#define BN_MASK2l (0xffffffffL) +#define BN_MASK2h (0xffffffff00000000LL) +#define BN_MASK2h1 (0xffffffff80000000LL) +#define BN_TBIT (0x8000000000000000LL) +#define BN_DEC_CONV (10000000000000000000L) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%019lu" +#define BN_DEC_NUM 19 +#endif + +#ifdef THIRTY_TWO_BIT +#ifdef WIN32 +#define BN_ULLONG unsigned _int64 +#else +#define BN_ULLONG unsigned long long +#endif +#define BN_ULONG unsigned long +#define BN_LONG long +#define BN_BITS 64 +#define BN_BYTES 4 +#define BN_BITS2 32 +#define BN_BITS4 16 +#define BN_MASK2 (0xffffffffL) +#define BN_MASK2l (0xffff) +#define BN_MASK2h1 (0xffff8000L) +#define BN_MASK2h (0xffff0000L) +#define BN_TBIT (0x80000000L) +#define BN_DEC_CONV (1000000000L) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%09lu" +#define BN_DEC_NUM 9 +#endif + +#ifdef SIXTEEN_BIT +#ifndef BN_DIV2W +#define BN_DIV2W +#endif +#define BN_ULLONG unsigned long +#define BN_ULONG unsigned short +#define BN_LONG short +#define BN_BITS 32 +#define BN_BYTES 2 +#define BN_BITS2 16 +#define BN_BITS4 8 +#define BN_MASK2 (0xffff) +#define BN_MASK2l (0xff) +#define BN_MASK2h1 (0xff80) +#define BN_MASK2h (0xff00) +#define BN_TBIT (0x8000) +#define BN_DEC_CONV (100000) +#define BN_DEC_FMT1 "%u" +#define BN_DEC_FMT2 "%05u" +#define BN_DEC_NUM 5 +#endif + +#ifdef EIGHT_BIT +#ifndef BN_DIV2W +#define BN_DIV2W +#endif +#define BN_ULLONG unsigned short +#define BN_ULONG unsigned char +#define BN_LONG char +#define BN_BITS 16 +#define BN_BYTES 1 +#define BN_BITS2 8 +#define BN_BITS4 4 +#define BN_MASK2 (0xff) +#define BN_MASK2l (0xf) +#define BN_MASK2h1 (0xf8) +#define BN_MASK2h (0xf0) +#define BN_TBIT (0x80) +#define BN_DEC_CONV (100) +#define BN_DEC_FMT1 "%u" +#define BN_DEC_FMT2 "%02u" +#define BN_DEC_NUM 2 +#endif + +#define BN_DEFAULT_BITS 1280 + +#ifdef BIGNUM +#undef BIGNUM +#endif + +typedef struct bignum_st + { + BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ + int top; /* Index of last used d +1. */ + /* The next are internal book keeping for bn_expand. */ + int max; /* Size of the d array. */ + int neg; /* one if the number is negative */ + } BIGNUM; + +/* Used for temp variables */ +#define BN_CTX_NUM 12 +typedef struct bignum_ctx + { + int tos; + BIGNUM *bn[BN_CTX_NUM+1]; + } BN_CTX; + +typedef struct bn_blinding_st + { + int init; + BIGNUM *A; + BIGNUM *Ai; + BIGNUM *mod; /* just a reference */ + } BN_BLINDING; + +/* Used for montgomery multiplication */ +typedef struct bn_mont_ctx_st + { + int ri; /* number of bits in R */ + BIGNUM *RR; /* used to convert to montgomery form */ + BIGNUM *N; /* The modulus */ + BIGNUM *Ni; /* The inverse of N */ + BN_ULONG n0; /* word form of inverse, normally only one of + * Ni or n0 is defined */ + } BN_MONT_CTX; + +#define BN_to_montgomery(r,a,mont,ctx) BN_mod_mul_montgomery(\ + r,a,(mont)->RR,(mont),ctx) + +#define BN_prime_checks (5) + +#define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) +#define BN_is_word(a,w) (((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) +#define BN_is_zero(a) (((a)->top <= 1) && ((a)->d[0] == (BN_ULONG)0)) +#define BN_is_one(a) (BN_is_word((a),1)) +#define BN_is_odd(a) ((a)->d[0] & 1) +#define BN_one(a) (BN_set_word((a),1)) +#define BN_zero(a) (BN_set_word((a),0)) + +#define BN_ascii2bn(a) BN_hex2bn(a) +#define BN_bn2ascii(a) BN_bn2hex(a) + +#define bn_fix_top(a) \ + { \ + BN_ULONG *fix_top_l; \ + for (fix_top_l= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \ + if (*(fix_top_l--)) break; \ + } + +#define bn_expand(n,b) ((((b)/BN_BITS2) <= (n)->max)?\ + (n):bn_expand2((n),(b)/BN_BITS2)) +#define bn_wexpand(n,b) (((b) <= (n)->max)?(n):bn_expand2((n),(b))) + + +#ifndef NOPROTO +BIGNUM *BN_value_one(void); +char * BN_options(void); +BN_CTX *BN_CTX_new(void); +void BN_CTX_free(BN_CTX *c); +int BN_rand(BIGNUM *rnd, int bits, int top,int bottom); +int BN_num_bits(BIGNUM *a); +int BN_num_bits_word(BN_ULONG); +BIGNUM *BN_new(void); +void BN_clear_free(BIGNUM *a); +BIGNUM *BN_copy(BIGNUM *a, BIGNUM *b); +BIGNUM *BN_bin2bn(unsigned char *s,int len,BIGNUM *ret); +int BN_bn2bin(BIGNUM *a, unsigned char *to); +BIGNUM *BN_mpi2bn(unsigned char *s,int len,BIGNUM *ret); +int BN_bn2mpi(BIGNUM *a, unsigned char *to); +int BN_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b); +void bn_qsub(BIGNUM *r, BIGNUM *a, BIGNUM *b); +void bn_qadd(BIGNUM *r, BIGNUM *a, BIGNUM *b); +int BN_add(BIGNUM *r, BIGNUM *a, BIGNUM *b); +int BN_mod(BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx); +int BN_div(BIGNUM *dv, BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx); +int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b); +int BN_sqr(BIGNUM *r, BIGNUM *a,BN_CTX *ctx); +BN_ULONG BN_mod_word(BIGNUM *a, unsigned long w); +BN_ULONG BN_div_word(BIGNUM *a, unsigned long w); +int BN_mul_word(BIGNUM *a, unsigned long w); +int BN_add_word(BIGNUM *a, unsigned long w); +int BN_sub_word(BIGNUM *a, unsigned long w); +int BN_set_word(BIGNUM *a, unsigned long w); +unsigned long BN_get_word(BIGNUM *a); +int BN_cmp(BIGNUM *a, BIGNUM *b); +void BN_free(BIGNUM *a); +int BN_is_bit_set(BIGNUM *a, int n); +int BN_lshift(BIGNUM *r, BIGNUM *a, int n); +int BN_lshift1(BIGNUM *r, BIGNUM *a); +int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p,BN_CTX *ctx); +int BN_mod_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,BN_CTX *ctx); +int BN_mod_exp_mont(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,BN_CTX *ctx, + BN_MONT_CTX *m_ctx); +int BN_mod_exp_recp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,BN_CTX *ctx); +int BN_mod_exp_simple(BIGNUM *r, BIGNUM *a, BIGNUM *p, + BIGNUM *m,BN_CTX *ctx); +int BN_mask_bits(BIGNUM *a,int n); +int BN_mod_mul_reciprocal(BIGNUM *r, BIGNUM *x, BIGNUM *y, BIGNUM *m, + BIGNUM *i, int nb, BN_CTX *ctx); +int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, BIGNUM *m, + BN_CTX *ctx); +#ifndef WIN16 +int BN_print_fp(FILE *fp, BIGNUM *a); +#endif +#ifdef HEADER_BIO_H +int BN_print(BIO *fp, BIGNUM *a); +#else +int BN_print(char *fp, BIGNUM *a); +#endif +int BN_reciprocal(BIGNUM *r, BIGNUM *m, BN_CTX *ctx); +int BN_rshift(BIGNUM *r, BIGNUM *a, int n); +int BN_rshift1(BIGNUM *r, BIGNUM *a); +void BN_clear(BIGNUM *a); +BIGNUM *bn_expand2(BIGNUM *b, int bits); +BIGNUM *BN_dup(BIGNUM *a); +int BN_ucmp(BIGNUM *a, BIGNUM *b); +int BN_set_bit(BIGNUM *a, int n); +int BN_clear_bit(BIGNUM *a, int n); +char * BN_bn2hex(BIGNUM *a); +char * BN_bn2dec(BIGNUM *a); +int BN_hex2bn(BIGNUM **a,char *str); +int BN_dec2bn(BIGNUM **a,char *str); +int BN_gcd(BIGNUM *r,BIGNUM *in_a,BIGNUM *in_b,BN_CTX *ctx); +BIGNUM *BN_mod_inverse(BIGNUM *a, BIGNUM *n,BN_CTX *ctx); +BIGNUM *BN_generate_prime(int bits,int strong,BIGNUM *add, + BIGNUM *rem,void (*callback)(int,int,char *),char *cb_arg); +int BN_is_prime(BIGNUM *p,int nchecks,void (*callback)(int,int,char *), + BN_CTX *ctx,char *cb_arg); +void ERR_load_BN_strings(void ); + +BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w); +BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w); +void bn_sqr_words(BN_ULONG *rp, BN_ULONG *ap, int num); +BN_ULONG bn_div64(BN_ULONG h, BN_ULONG l, BN_ULONG d); +BN_ULONG bn_add_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int num); + +BN_MONT_CTX *BN_MONT_CTX_new(void ); +int BN_mod_mul_montgomery(BIGNUM *r,BIGNUM *a,BIGNUM *b,BN_MONT_CTX *mont, + BN_CTX *ctx); +int BN_from_montgomery(BIGNUM *r,BIGNUM *a,BN_MONT_CTX *mont,BN_CTX *ctx); +void BN_MONT_CTX_free(BN_MONT_CTX *mont); +int BN_MONT_CTX_set(BN_MONT_CTX *mont,BIGNUM *modulus,BN_CTX *ctx); + +BN_BLINDING *BN_BLINDING_new(BIGNUM *A,BIGNUM *Ai,BIGNUM *mod); +void BN_BLINDING_free(BN_BLINDING *b); +int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx); +int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *r, BN_CTX *ctx); +int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); + +#else + +BIGNUM *BN_value_one(); +char * BN_options(); +BN_CTX *BN_CTX_new(); +void BN_CTX_free(); +int BN_rand(); +int BN_num_bits(); +int BN_num_bits_word(); +BIGNUM *BN_new(); +void BN_clear_free(); +BIGNUM *BN_copy(); +BIGNUM *BN_bin2bn(); +int BN_bn2bin(); +BIGNUM *BN_mpi2bn(); +int BN_bn2mpi(); +int BN_sub(); +void bn_qsub(); +void bn_qadd(); +int BN_add(); +int BN_mod(); +int BN_div(); +int BN_mul(); +int BN_sqr(); +BN_ULONG BN_mod_word(); +BN_ULONG BN_div_word(); +int BN_add_word(); +int BN_sub_word(); +int BN_mul_word(); +int BN_set_word(); +unsigned long BN_get_word(); +int BN_cmp(); +void BN_free(); +int BN_is_bit_set(); +int BN_lshift(); +int BN_lshift1(); +int BN_exp(); +int BN_mod_exp(); +int BN_mod_exp_mont(); +int BN_mod_exp_recp(); +int BN_mod_exp_simple(); +int BN_mask_bits(); +int BN_mod_mul_reciprocal(); +int BN_mod_mul(); +#ifndef WIN16 +int BN_print_fp(); +#endif +int BN_print(); +int BN_reciprocal(); +int BN_rshift(); +int BN_rshift1(); +void BN_clear(); +BIGNUM *bn_expand2(); +BIGNUM *BN_dup(); +int BN_ucmp(); +int BN_set_bit(); +int BN_clear_bit(); +char * BN_bn2hex(); +char * BN_bn2dec(); +int BN_hex2bn(); +int BN_dec2bn(); +int BN_gcd(); +BIGNUM *BN_mod_inverse(); +BIGNUM *BN_generate_prime(); +int BN_is_prime(); +void ERR_load_BN_strings(); + +BN_ULONG bn_mul_add_words(); +BN_ULONG bn_mul_words(); +void bn_sqr_words(); +BN_ULONG bn_div64(); +BN_ULONG bn_add_words(); + +int BN_mod_mul_montgomery(); +int BN_from_montgomery(); +BN_MONT_CTX *BN_MONT_CTX_new(); +void BN_MONT_CTX_free(); +int BN_MONT_CTX_set(); + +BN_BLINDING *BN_BLINDING_new(); +void BN_BLINDING_free(); +int BN_BLINDING_update(); +int BN_BLINDING_convert(); +int BN_BLINDING_invert(); + +#endif + +/* BEGIN ERROR CODES */ +/* Error codes for the BN functions. */ + +/* Function codes. */ +#define BN_F_BN_BLINDING_CONVERT 100 +#define BN_F_BN_BLINDING_INVERT 101 +#define BN_F_BN_BLINDING_NEW 102 +#define BN_F_BN_BLINDING_UPDATE 103 +#define BN_F_BN_BN2DEC 104 +#define BN_F_BN_BN2HEX 105 +#define BN_F_BN_CTX_NEW 106 +#define BN_F_BN_DIV 107 +#define BN_F_BN_EXPAND2 108 +#define BN_F_BN_MOD_EXP_MONT 109 +#define BN_F_BN_MOD_INVERSE 110 +#define BN_F_BN_MOD_MUL_RECIPROCAL 111 +#define BN_F_BN_MPI2BN 112 +#define BN_F_BN_NEW 113 +#define BN_F_BN_RAND 114 + +/* Reason codes. */ +#define BN_R_BAD_RECIPROCAL 100 +#define BN_R_CALLED_WITH_EVEN_MODULUS 101 +#define BN_R_DIV_BY_ZERO 102 +#define BN_R_ENCODING_ERROR 103 +#define BN_R_INVALID_LENGTH 104 +#define BN_R_NOT_INITALISED 105 +#define BN_R_NO_INVERSE 106 + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/src/lib/libcrypto/bn/bn_m.c b/src/lib/libcrypto/bn/bn_m.c new file mode 100644 index 0000000000..5166daaeec --- /dev/null +++ b/src/lib/libcrypto/bn/bn_m.c @@ -0,0 +1,169 @@ +/* crypto/bn/bn_m.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn_lcl.h" +#include "stack.h" + +int limit=16; + +typedef struct bn_pool_st + { + int used; + int tos; + STACK *sk; + } BN_POOL; + +BIGNUM *BN_POOL_push(bp) +BN_POOL *bp; + { + BIGNUM *ret; + + if (bp->used >= bp->tos) + { + ret=BN_new(); + sk_push(bp->sk,(char *)ret); + bp->tos++; + bp->used++; + } + else + { + ret=(BIGNUM *)sk_value(bp->sk,bp->used); + bp->used++; + } + return(ret); + } + +void BN_POOL_pop(bp,num) +BN_POOL *bp; +int num; + { + bp->used-=num; + } + +int BN_m(r,a,b) +BIGNUM *r,*a,*b; + { + static BN_POOL bp; + static init=1; + + if (init) + { + bp.used=0; + bp.tos=0; + bp.sk=sk_new_null(); + init=0; + } + return(BN_mm(r,a,b,&bp)); + } + +/* r must be different to a and b */ +int BN_mm(m, A, B, bp) +BIGNUM *m,*A,*B; +BN_POOL *bp; + { + int i,num; + int an,bn; + BIGNUM *a,*b,*c,*d,*ac,*bd; + + an=A->top; + bn=B->top; + if ((an <= limit) || (bn <= limit)) + { + return(BN_mul(m,A,B)); + } + + a=BN_POOL_push(bp); + b=BN_POOL_push(bp); + c=BN_POOL_push(bp); + d=BN_POOL_push(bp); + ac=BN_POOL_push(bp); + bd=BN_POOL_push(bp); + + num=(an <= bn)?an:bn; + num=1<<(BN_num_bits_word(num-1)-1); + + /* Are going to now chop things into 'num' word chunks. */ + num*=BN_BITS2; + + BN_copy(a,A); + BN_mask_bits(a,num); + BN_rshift(b,A,num); + + BN_copy(c,B); + BN_mask_bits(c,num); + BN_rshift(d,B,num); + + BN_sub(ac ,b,a); + BN_sub(bd,c,d); + BN_mm(m,ac,bd,bp); + BN_mm(ac,a,c,bp); + BN_mm(bd,b,d,bp); + + BN_add(m,m,ac); + BN_add(m,m,bd); + BN_lshift(m,m,num); + BN_lshift(bd,bd,num*2); + + BN_add(m,m,ac); + BN_add(m,m,bd); + BN_POOL_pop(bp,6); + return(1); + } + diff --git a/src/lib/libcrypto/bn/bn_mulw.c b/src/lib/libcrypto/bn/bn_mulw.c new file mode 100644 index 0000000000..abfc7e4d6c --- /dev/null +++ b/src/lib/libcrypto/bn/bn_mulw.c @@ -0,0 +1,366 @@ +/* crypto/bn/bn_mulw.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn_lcl.h" + +#ifdef BN_LLONG + +BN_ULONG bn_mul_add_words(rp,ap,num,w) +BN_ULONG *rp,*ap; +int num; +BN_ULONG w; + { + BN_ULONG c1=0; + + for (;;) + { + mul_add(rp[0],ap[0],w,c1); + if (--num == 0) break; + mul_add(rp[1],ap[1],w,c1); + if (--num == 0) break; + mul_add(rp[2],ap[2],w,c1); + if (--num == 0) break; + mul_add(rp[3],ap[3],w,c1); + if (--num == 0) break; + ap+=4; + rp+=4; + } + + return(c1); + } + +BN_ULONG bn_mul_words(rp,ap,num,w) +BN_ULONG *rp,*ap; +int num; +BN_ULONG w; + { + BN_ULONG c1=0; + + for (;;) + { + mul(rp[0],ap[0],w,c1); + if (--num == 0) break; + mul(rp[1],ap[1],w,c1); + if (--num == 0) break; + mul(rp[2],ap[2],w,c1); + if (--num == 0) break; + mul(rp[3],ap[3],w,c1); + if (--num == 0) break; + ap+=4; + rp+=4; + } + return(c1); + } + +void bn_sqr_words(r,a,n) +BN_ULONG *r,*a; +int n; + { + for (;;) + { + BN_ULLONG t; + + t=(BN_ULLONG)(a[0])*(a[0]); + r[0]=Lw(t); r[1]=Hw(t); + if (--n == 0) break; + + t=(BN_ULLONG)(a[1])*(a[1]); + r[2]=Lw(t); r[3]=Hw(t); + if (--n == 0) break; + + t=(BN_ULLONG)(a[2])*(a[2]); + r[4]=Lw(t); r[5]=Hw(t); + if (--n == 0) break; + + t=(BN_ULLONG)(a[3])*(a[3]); + r[6]=Lw(t); r[7]=Hw(t); + if (--n == 0) break; + + a+=4; + r+=8; + } + } + +BN_ULONG bn_add_words(r,a,b,n) +BN_ULONG *r,*a,*b; +int n; + { + BN_ULLONG ll; + + ll=0; + for (;;) + { + ll+= (BN_ULLONG)a[0]+b[0]; + r[0]=(BN_ULONG)ll&BN_MASK2; + ll>>=BN_BITS2; + if (--n <= 0) break; + + ll+= (BN_ULLONG)a[1]+b[1]; + r[1]=(BN_ULONG)ll&BN_MASK2; + ll>>=BN_BITS2; + if (--n <= 0) break; + + ll+= (BN_ULLONG)a[2]+b[2]; + r[2]=(BN_ULONG)ll&BN_MASK2; + ll>>=BN_BITS2; + if (--n <= 0) break; + + ll+= (BN_ULLONG)a[3]+b[3]; + r[3]=(BN_ULONG)ll&BN_MASK2; + ll>>=BN_BITS2; + if (--n <= 0) break; + + a+=4; + b+=4; + r+=4; + } + return(ll&BN_MASK2); + } + +#else + +BN_ULONG bn_mul_add_words(rp,ap,num,w) +BN_ULONG *rp,*ap; +int num; +BN_ULONG w; + { + BN_ULONG c=0; + BN_ULONG bl,bh; + + bl=LBITS(w); + bh=HBITS(w); + + for (;;) + { + mul_add(rp[0],ap[0],bl,bh,c); + if (--num == 0) break; + mul_add(rp[1],ap[1],bl,bh,c); + if (--num == 0) break; + mul_add(rp[2],ap[2],bl,bh,c); + if (--num == 0) break; + mul_add(rp[3],ap[3],bl,bh,c); + if (--num == 0) break; + ap+=4; + rp+=4; + } + return(c); + } + +BN_ULONG bn_mul_words(rp,ap,num,w) +BN_ULONG *rp,*ap; +int num; +BN_ULONG w; + { + BN_ULONG carry=0; + BN_ULONG bl,bh; + + bl=LBITS(w); + bh=HBITS(w); + + for (;;) + { + mul(rp[0],ap[0],bl,bh,carry); + if (--num == 0) break; + mul(rp[1],ap[1],bl,bh,carry); + if (--num == 0) break; + mul(rp[2],ap[2],bl,bh,carry); + if (--num == 0) break; + mul(rp[3],ap[3],bl,bh,carry); + if (--num == 0) break; + ap+=4; + rp+=4; + } + return(carry); + } + +void bn_sqr_words(r,a,n) +BN_ULONG *r,*a; +int n; + { + for (;;) + { + sqr64(r[0],r[1],a[0]); + if (--n == 0) break; + + sqr64(r[2],r[3],a[1]); + if (--n == 0) break; + + sqr64(r[4],r[5],a[2]); + if (--n == 0) break; + + sqr64(r[6],r[7],a[3]); + if (--n == 0) break; + + a+=4; + r+=8; + } + } + +BN_ULONG bn_add_words(r,a,b,n) +BN_ULONG *r,*a,*b; +int n; + { + BN_ULONG t1,t2; + int carry,i; + + carry=0; + for (i=0; i<n; i++) + { + t1= *(a++); + t2= *(b++); + if (carry) + { + carry=(t2 >= ((~t1)&BN_MASK2)); + t2=(t1+t2+1)&BN_MASK2; + } + else + { + t2=(t1+t2)&BN_MASK2; + carry=(t2<t1); + } + *(r++)=t2; + } + return(carry); + } + +#endif + +#if defined(BN_LLONG) && defined(BN_DIV2W) + +BN_ULONG bn_div64(h,l,d) +BN_ULONG h,l,d; + { + return((BN_ULONG)(((((BN_ULLONG)h)<<BN_BITS2)|l)/(BN_ULLONG)d)); + } + +#else + +/* Divide h-l by d and return the result. */ +/* I need to test this some more :-( */ +BN_ULONG bn_div64(h,l,d) +BN_ULONG h,l,d; + { + BN_ULONG dh,dl,q,ret=0,th,tl,t; + int i,count=2; + + if (d == 0) return(BN_MASK2); + + i=BN_num_bits_word(d); + if ((i != BN_BITS2) && (h > (BN_ULONG)1<<i)) + { +#if !defined(NO_STDIO) && !defined(WIN16) + fprintf(stderr,"Division would overflow (%d)\n",i); +#endif + abort(); + } + i=BN_BITS2-i; + if (h >= d) h-=d; + + if (i) + { + d<<=i; + h=(h<<i)|(l>>(BN_BITS2-i)); + l<<=i; + } + dh=(d&BN_MASK2h)>>BN_BITS4; + dl=(d&BN_MASK2l); + for (;;) + { + if ((h>>BN_BITS4) == dh) + q=BN_MASK2l; + else + q=h/dh; + + for (;;) + { + t=(h-q*dh); + if ((t&BN_MASK2h) || + ((dl*q) <= ( + (t<<BN_BITS4)+ + ((l&BN_MASK2h)>>BN_BITS4)))) + break; + q--; + } + th=q*dh; + tl=q*dl; + t=(tl>>BN_BITS4); + tl=(tl<<BN_BITS4)&BN_MASK2h; + th+=t; + + if (l < tl) th++; + l-=tl; + if (h < th) + { + h+=d; + q--; + } + h-=th; + + if (--count == 0) break; + + ret=q<<BN_BITS4; + h=((h<<BN_BITS4)|(l>>BN_BITS4))&BN_MASK2; + l=(l&BN_MASK2l)<<BN_BITS4; + } + ret|=q; + return(ret); + } +#endif + diff --git a/src/lib/libcrypto/bn/bn_sub.c b/src/lib/libcrypto/bn/bn_sub.c new file mode 100644 index 0000000000..bba80f8afb --- /dev/null +++ b/src/lib/libcrypto/bn/bn_sub.c @@ -0,0 +1,180 @@ +/* crypto/bn/bn_sub.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn_lcl.h" + +/* unsigned subtraction of b from a, a must be larger than b. */ +void bn_qsub(r, a, b) +BIGNUM *r; +BIGNUM *a; +BIGNUM *b; + { + int max,min; + register BN_ULONG t1,t2,*ap,*bp,*rp; + int i,carry; +#if defined(IRIX_CC_BUG) && !defined(LINT) + int dummy; +#endif + + max=a->top; + min=b->top; + ap=a->d; + bp=b->d; + rp=r->d; + + carry=0; + for (i=0; i<min; i++) + { + t1= *(ap++); + t2= *(bp++); + if (carry) + { + carry=(t1 <= t2); + t1=(t1-t2-1)&BN_MASK2; + } + else + { + carry=(t1 < t2); + t1=(t1-t2)&BN_MASK2; + } +#if defined(IRIX_CC_BUG) && !defined(LINT) + dummy=t1; +#endif + *(rp++)=t1&BN_MASK2; + } + if (carry) /* subtracted */ + { + while (i < max) + { + i++; + t1= *(ap++); + t2=(t1-1)&BN_MASK2; + *(rp++)=t2; + if (t1 > t2) break; + } + } +#if 0 + memcpy(rp,ap,sizeof(*rp)*(max-i)); +#else + for (; i<max; i++) + *(rp++)= *(ap++); +#endif + + r->top=max; + bn_fix_top(r); + } + +int BN_sub(r, a, b) +BIGNUM *r; +BIGNUM *a; +BIGNUM *b; + { + int max,i; + int add=0,neg=0; + BIGNUM *tmp; + + /* a - b a-b + * a - -b a+b + * -a - b -(a+b) + * -a - -b b-a + */ + if (a->neg) + { + if (b->neg) + { tmp=a; a=b; b=tmp; } + else + { add=1; neg=1; } + } + else + { + if (b->neg) { add=1; neg=0; } + } + + if (add) + { + /* As a fast max size, do a a->top | b->top */ + i=(a->top | b->top)+1; + if (bn_wexpand(r,i) == NULL) + return(0); + if (i) + bn_qadd(r,a,b); + else + bn_qadd(r,b,a); + r->neg=neg; + return(1); + } + + /* We are actually doing a - b :-) */ + + max=(a->top > b->top)?a->top:b->top; + if (bn_wexpand(r,max) == NULL) return(0); + if (BN_ucmp(a,b) < 0) + { + bn_qsub(r,b,a); + r->neg=1; + } + else + { + bn_qsub(r,a,b); + r->neg=0; + } + return(1); + } + diff --git a/src/lib/libcrypto/buffer/buffer.err b/src/lib/libcrypto/buffer/buffer.err new file mode 100644 index 0000000000..62b775e637 --- /dev/null +++ b/src/lib/libcrypto/buffer/buffer.err @@ -0,0 +1,9 @@ +/* Error codes for the BUF functions. */ + +/* Function codes. */ +#define BUF_F_BUF_MEM_GROW 100 +#define BUF_F_BUF_MEM_NEW 101 +#define BUF_F_BUF_STRDUP 102 +#define BUF_F_PXYCLNT_READ 103 + +/* Reason codes. */ diff --git a/src/lib/libcrypto/cast/Makefile.uni b/src/lib/libcrypto/cast/Makefile.uni new file mode 100644 index 0000000000..780073e75b --- /dev/null +++ b/src/lib/libcrypto/cast/Makefile.uni @@ -0,0 +1,123 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +# There are 3 possible performance options, experiment :-) +#OPTS= -DBF_PTR +#OPTS= -DBF_PTR2 +OPTS= + +DIR= cast +TOP= . +CC= gcc +CFLAG= -O3 -fomit-frame-pointer + +CPP= $(CC) -E +INCLUDES= +INSTALLTOP=/usr/local/lib +MAKE= make +MAKEDEPEND= makedepend +MAKEFILE= Makefile.uni +AR= ar r + +CAST_ENC=c_enc.o +# or use +#CAST_ENC=asm/cx86-elf.o +#CAST_ENC=asm/cx86-out.o +#CAST_ENC=asm/cx86-sol.o +#CAST_ENC=asm/cx86bdsi.o + +CFLAGS= $(OPTS) $(INCLUDES) $(CFLAG) -DFULL_TEST + +GENERAL=Makefile +TEST=casttest +APP1=cast_spd +APP2=castopts +APPS=$(APP1) $(APP2) + +LIB=libcast.a +LIBSRC=c_skey.c c_ecb.c c_enc.c c_cfb64.c c_ofb64.c +LIBOBJ=c_skey.o c_ecb.o $(CAST_ENC) c_cfb64.o c_ofb64.o + +SRC= $(LIBSRC) + +EXHEADER= cast.h +HEADER= cast_lcl.h $(EXHEADER) + +ALL= $(GENERAL) $(SRC) $(HEADER) + +all: $(LIB) $(TEST) $(APPS) + +$(LIB): $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) + sh $(TOP)/ranlib.sh $(LIB) +# elf +asm/cx86-elf.o: asm/cx86unix.cpp + $(CPP) -DELF asm/cx86unix.cpp | as -o asm/cx86-elf.o + +# solaris +asm/cx86-sol.o: asm/cx86unix.cpp + $(CC) -E -DSOL asm/cx86unix.cpp | sed 's/^#.*//' > asm/cx86-sol.s + as -o asm/cx86-sol.o asm/cx86-sol.s + rm -f asm/cx86-sol.s + +# a.out +asm/cx86-out.o: asm/cx86unix.cpp + $(CPP) -DOUT asm/cx86unix.cpp | as -o asm/cx86-out.o + +# bsdi +asm/cx86bsdi.o: asm/cx86unix.cpp + $(CPP) -DBSDI asm/cx86unix.cpp | as -o asm/cx86bsdi.o + +asm/cx86unix.cpp: + (cd asm; perl cast-586.pl cpp >cx86unix.cpp) + +test: $(TEST) + ./$(TEST) + +$(TEST): $(TEST).c $(LIB) + $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) + +$(APP1): $(APP1).c $(LIB) + $(CC) -o $(APP1) $(CFLAGS) $(APP1).c $(LIB) + +$(APP2): $(APP2).c $(LIB) + $(CC) -o $(APP2) $(CFLAGS) $(APP2).c $(LIB) + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + +dclean: + perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff + +cc: + $(MAKE) CC="cc" CFLAG="-O" all + +gcc: + $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all + +x86-elf: + $(MAKE) CAST_ENC="asm/cx86-elf.o" CFLAG="-DELF $(CFLAGS)" all + +x86-out: + $(MAKE) CAST_ENC="asm/cx86-out.o" CFLAG="-DOUT $(CFLAGS)" all + +x86-solaris: + $(MAKE) CAST_ENC="asm/cx86-sol.o" CFLAG="-DSOL $(CFLAGS)" all + +x86-bdsi: + $(MAKE) CAST_ENC="asm/cx86-bdsi.o" CFLAG="-DBDSI $(CFLAGS)" all + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/cast/asm/c-win32.asm b/src/lib/libcrypto/cast/asm/c-win32.asm new file mode 100644 index 0000000000..a1d8a2671a --- /dev/null +++ b/src/lib/libcrypto/cast/asm/c-win32.asm @@ -0,0 +1,940 @@ + ; Don't even think of reading this code + ; It was automatically generated by cast-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE cast-586.asm + .486 +.model FLAT +_TEXT SEGMENT +PUBLIC _CAST_encrypt +EXTERN _CAST_S_table0:DWORD +EXTERN _CAST_S_table1:DWORD +EXTERN _CAST_S_table2:DWORD +EXTERN _CAST_S_table3:DWORD + +_CAST_encrypt PROC NEAR + ; + push ebp + push ebx + mov ebx, DWORD PTR 12[esp] + mov ebp, DWORD PTR 16[esp] + push esi + push edi + ; Load the 2 words + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + xor eax, eax + ; round 0 + mov edx, DWORD PTR [ebp] + mov ecx, DWORD PTR 4[ebp] + add edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor edi, ecx + ; round 1 + mov edx, DWORD PTR 8[ebp] + mov ecx, DWORD PTR 12[ebp] + xor edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor esi, ecx + ; round 2 + mov edx, DWORD PTR 16[ebp] + mov ecx, DWORD PTR 20[ebp] + sub edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor edi, ecx + ; round 3 + mov edx, DWORD PTR 24[ebp] + mov ecx, DWORD PTR 28[ebp] + add edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor esi, ecx + ; round 4 + mov edx, DWORD PTR 32[ebp] + mov ecx, DWORD PTR 36[ebp] + xor edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor edi, ecx + ; round 5 + mov edx, DWORD PTR 40[ebp] + mov ecx, DWORD PTR 44[ebp] + sub edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor esi, ecx + ; round 6 + mov edx, DWORD PTR 48[ebp] + mov ecx, DWORD PTR 52[ebp] + add edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor edi, ecx + ; round 7 + mov edx, DWORD PTR 56[ebp] + mov ecx, DWORD PTR 60[ebp] + xor edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor esi, ecx + ; round 8 + mov edx, DWORD PTR 64[ebp] + mov ecx, DWORD PTR 68[ebp] + sub edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor edi, ecx + ; round 9 + mov edx, DWORD PTR 72[ebp] + mov ecx, DWORD PTR 76[ebp] + add edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor esi, ecx + ; round 10 + mov edx, DWORD PTR 80[ebp] + mov ecx, DWORD PTR 84[ebp] + xor edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor edi, ecx + ; round 11 + mov edx, DWORD PTR 88[ebp] + mov ecx, DWORD PTR 92[ebp] + sub edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor esi, ecx + ; round 12 + mov edx, DWORD PTR 96[ebp] + mov ecx, DWORD PTR 100[ebp] + add edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor edi, ecx + ; round 13 + mov edx, DWORD PTR 104[ebp] + mov ecx, DWORD PTR 108[ebp] + xor edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor esi, ecx + ; round 14 + mov edx, DWORD PTR 112[ebp] + mov ecx, DWORD PTR 116[ebp] + sub edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor edi, ecx + ; round 15 + mov edx, DWORD PTR 120[ebp] + mov ecx, DWORD PTR 124[ebp] + add edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + mov eax, DWORD PTR 20[esp] + xor esi, ecx + nop + mov DWORD PTR 4[eax],edi + mov DWORD PTR [eax],esi + pop edi + pop esi + pop ebx + pop ebp + ret +_CAST_encrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _CAST_decrypt +EXTERN _CAST_S_table0:DWORD +EXTERN _CAST_S_table1:DWORD +EXTERN _CAST_S_table2:DWORD +EXTERN _CAST_S_table3:DWORD + +_CAST_decrypt PROC NEAR + ; + push ebp + push ebx + mov ebx, DWORD PTR 12[esp] + mov ebp, DWORD PTR 16[esp] + push esi + push edi + ; Load the 2 words + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + xor eax, eax + ; round 15 + mov edx, DWORD PTR 120[ebp] + mov ecx, DWORD PTR 124[ebp] + add edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor edi, ecx + ; round 14 + mov edx, DWORD PTR 112[ebp] + mov ecx, DWORD PTR 116[ebp] + sub edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor esi, ecx + ; round 13 + mov edx, DWORD PTR 104[ebp] + mov ecx, DWORD PTR 108[ebp] + xor edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor edi, ecx + ; round 12 + mov edx, DWORD PTR 96[ebp] + mov ecx, DWORD PTR 100[ebp] + add edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor esi, ecx + ; round 11 + mov edx, DWORD PTR 88[ebp] + mov ecx, DWORD PTR 92[ebp] + sub edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor edi, ecx + ; round 10 + mov edx, DWORD PTR 80[ebp] + mov ecx, DWORD PTR 84[ebp] + xor edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor esi, ecx + ; round 9 + mov edx, DWORD PTR 72[ebp] + mov ecx, DWORD PTR 76[ebp] + add edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor edi, ecx + ; round 8 + mov edx, DWORD PTR 64[ebp] + mov ecx, DWORD PTR 68[ebp] + sub edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor esi, ecx + ; round 7 + mov edx, DWORD PTR 56[ebp] + mov ecx, DWORD PTR 60[ebp] + xor edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor edi, ecx + ; round 6 + mov edx, DWORD PTR 48[ebp] + mov ecx, DWORD PTR 52[ebp] + add edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor esi, ecx + ; round 5 + mov edx, DWORD PTR 40[ebp] + mov ecx, DWORD PTR 44[ebp] + sub edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor edi, ecx + ; round 4 + mov edx, DWORD PTR 32[ebp] + mov ecx, DWORD PTR 36[ebp] + xor edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor esi, ecx + ; round 3 + mov edx, DWORD PTR 24[ebp] + mov ecx, DWORD PTR 28[ebp] + add edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor edi, ecx + ; round 2 + mov edx, DWORD PTR 16[ebp] + mov ecx, DWORD PTR 20[ebp] + sub edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor esi, ecx + ; round 1 + mov edx, DWORD PTR 8[ebp] + mov ecx, DWORD PTR 12[ebp] + xor edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor edi, ecx + ; round 0 + mov edx, DWORD PTR [ebp] + mov ecx, DWORD PTR 4[ebp] + add edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + mov eax, DWORD PTR 20[esp] + xor esi, ecx + nop + mov DWORD PTR 4[eax],edi + mov DWORD PTR [eax],esi + pop edi + pop esi + pop ebx + pop ebp + ret +_CAST_decrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _CAST_cbc_encrypt + +_CAST_cbc_encrypt PROC NEAR + ; + push ebp + push ebx + push esi + push edi + mov ebp, DWORD PTR 28[esp] + ; getting iv ptr from parameter 4 + mov ebx, DWORD PTR 36[esp] + mov esi, DWORD PTR [ebx] + mov edi, DWORD PTR 4[ebx] + push edi + push esi + push edi + push esi + mov ebx, esp + mov esi, DWORD PTR 36[esp] + mov edi, DWORD PTR 40[esp] + ; getting encrypt flag from parameter 5 + mov ecx, DWORD PTR 56[esp] + ; get and push parameter 3 + mov eax, DWORD PTR 48[esp] + push eax + push ebx + cmp ecx, 0 + jz $L000decrypt + and ebp, 4294967288 + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + jz $L001encrypt_finish +L002encrypt_loop: + mov ecx, DWORD PTR [esi] + mov edx, DWORD PTR 4[esi] + xor eax, ecx + xor ebx, edx + bswap eax + bswap ebx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _CAST_encrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + bswap eax + bswap ebx + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L002encrypt_loop +$L001encrypt_finish: + mov ebp, DWORD PTR 52[esp] + and ebp, 7 + jz $L003finish + xor ecx, ecx + xor edx, edx + mov ebp, DWORD PTR $L004cbc_enc_jmp_table[ebp*4] + jmp ebp +L005ej7: + xor edx, edx + mov dh, BYTE PTR 6[esi] + shl edx, 8 +L006ej6: + mov dh, BYTE PTR 5[esi] +L007ej5: + mov dl, BYTE PTR 4[esi] +L008ej4: + mov ecx, DWORD PTR [esi] + jmp $L009ejend +L010ej3: + mov ch, BYTE PTR 2[esi] + xor ecx, ecx + shl ecx, 8 +L011ej2: + mov ch, BYTE PTR 1[esi] +L012ej1: + mov cl, BYTE PTR [esi] +$L009ejend: + xor eax, ecx + xor ebx, edx + bswap eax + bswap ebx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _CAST_encrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + bswap eax + bswap ebx + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + jmp $L003finish +$L000decrypt: + and ebp, 4294967288 + mov eax, DWORD PTR 16[esp] + mov ebx, DWORD PTR 20[esp] + jz $L013decrypt_finish +L014decrypt_loop: + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + bswap eax + bswap ebx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _CAST_decrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + bswap eax + bswap ebx + mov ecx, DWORD PTR 16[esp] + mov edx, DWORD PTR 20[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR [edi],ecx + mov DWORD PTR 4[edi],edx + mov DWORD PTR 16[esp],eax + mov DWORD PTR 20[esp],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L014decrypt_loop +$L013decrypt_finish: + mov ebp, DWORD PTR 52[esp] + and ebp, 7 + jz $L003finish + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + bswap eax + bswap ebx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _CAST_decrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + bswap eax + bswap ebx + mov ecx, DWORD PTR 16[esp] + mov edx, DWORD PTR 20[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] +L015dj7: + ror edx, 16 + mov BYTE PTR 6[edi],dl + shr edx, 16 +L016dj6: + mov BYTE PTR 5[edi],dh +L017dj5: + mov BYTE PTR 4[edi],dl +L018dj4: + mov DWORD PTR [edi],ecx + jmp $L019djend +L020dj3: + ror ecx, 16 + mov BYTE PTR 2[edi],cl + shl ecx, 16 +L021dj2: + mov BYTE PTR 1[esi],ch +L022dj1: + mov BYTE PTR [esi], cl +$L019djend: + jmp $L003finish +$L003finish: + mov ecx, DWORD PTR 60[esp] + add esp, 24 + mov DWORD PTR [ecx],eax + mov DWORD PTR 4[ecx],ebx + pop edi + pop esi + pop ebx + pop ebp + ret +$L004cbc_enc_jmp_table: + DD 0 + DD L012ej1 + DD L011ej2 + DD L010ej3 + DD L008ej4 + DD L007ej5 + DD L006ej6 + DD L005ej7 +L023cbc_dec_jmp_table: + DD 0 + DD L022dj1 + DD L021dj2 + DD L020dj3 + DD L018dj4 + DD L017dj5 + DD L016dj6 + DD L015dj7 +_CAST_cbc_encrypt ENDP +_TEXT ENDS +END diff --git a/src/lib/libcrypto/cast/asm/cx86unix.cpp b/src/lib/libcrypto/cast/asm/cx86unix.cpp new file mode 100644 index 0000000000..035692a5af --- /dev/null +++ b/src/lib/libcrypto/cast/asm/cx86unix.cpp @@ -0,0 +1,1010 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define CAST_S_table0 _CAST_S_table0 +#define CAST_S_table1 _CAST_S_table1 +#define CAST_S_table2 _CAST_S_table2 +#define CAST_S_table3 _CAST_S_table3 +#define CAST_encrypt _CAST_encrypt +#define CAST_S_table0 _CAST_S_table0 +#define CAST_S_table1 _CAST_S_table1 +#define CAST_S_table2 _CAST_S_table2 +#define CAST_S_table3 _CAST_S_table3 +#define CAST_decrypt _CAST_decrypt +#define CAST_cbc_encrypt _CAST_cbc_encrypt + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by cast-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "cast-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl CAST_encrypt + TYPE(CAST_encrypt,@function) +CAST_encrypt: + + pushl %ebp + pushl %ebx + movl 12(%esp), %ebx + movl 16(%esp), %ebp + pushl %esi + pushl %edi + /* Load the 2 words */ + movl (%ebx), %edi + movl 4(%ebx), %esi + xorl %eax, %eax + /* round 0 */ + movl (%ebp), %edx + movl 4(%ebp), %ecx + addl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %edi + /* round 1 */ + movl 8(%ebp), %edx + movl 12(%ebp), %ecx + xorl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %esi + /* round 2 */ + movl 16(%ebp), %edx + movl 20(%ebp), %ecx + subl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %edi + /* round 3 */ + movl 24(%ebp), %edx + movl 28(%ebp), %ecx + addl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %esi + /* round 4 */ + movl 32(%ebp), %edx + movl 36(%ebp), %ecx + xorl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %edi + /* round 5 */ + movl 40(%ebp), %edx + movl 44(%ebp), %ecx + subl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %esi + /* round 6 */ + movl 48(%ebp), %edx + movl 52(%ebp), %ecx + addl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %edi + /* round 7 */ + movl 56(%ebp), %edx + movl 60(%ebp), %ecx + xorl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %esi + /* round 8 */ + movl 64(%ebp), %edx + movl 68(%ebp), %ecx + subl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %edi + /* round 9 */ + movl 72(%ebp), %edx + movl 76(%ebp), %ecx + addl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %esi + /* round 10 */ + movl 80(%ebp), %edx + movl 84(%ebp), %ecx + xorl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %edi + /* round 11 */ + movl 88(%ebp), %edx + movl 92(%ebp), %ecx + subl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %esi + /* round 12 */ + movl 96(%ebp), %edx + movl 100(%ebp), %ecx + addl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %edi + /* round 13 */ + movl 104(%ebp), %edx + movl 108(%ebp), %ecx + xorl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %esi + /* round 14 */ + movl 112(%ebp), %edx + movl 116(%ebp), %ecx + subl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %edi + /* round 15 */ + movl 120(%ebp), %edx + movl 124(%ebp), %ecx + addl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + movl 20(%esp), %eax + xorl %ecx, %esi + nop + movl %edi, 4(%eax) + movl %esi, (%eax) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.CAST_encrypt_end: + SIZE(CAST_encrypt,.CAST_encrypt_end-CAST_encrypt) +.ident "CAST_encrypt" +.text + .align ALIGN +.globl CAST_decrypt + TYPE(CAST_decrypt,@function) +CAST_decrypt: + + pushl %ebp + pushl %ebx + movl 12(%esp), %ebx + movl 16(%esp), %ebp + pushl %esi + pushl %edi + /* Load the 2 words */ + movl (%ebx), %edi + movl 4(%ebx), %esi + xorl %eax, %eax + /* round 15 */ + movl 120(%ebp), %edx + movl 124(%ebp), %ecx + addl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %edi + /* round 14 */ + movl 112(%ebp), %edx + movl 116(%ebp), %ecx + subl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %esi + /* round 13 */ + movl 104(%ebp), %edx + movl 108(%ebp), %ecx + xorl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %edi + /* round 12 */ + movl 96(%ebp), %edx + movl 100(%ebp), %ecx + addl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %esi + /* round 11 */ + movl 88(%ebp), %edx + movl 92(%ebp), %ecx + subl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %edi + /* round 10 */ + movl 80(%ebp), %edx + movl 84(%ebp), %ecx + xorl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %esi + /* round 9 */ + movl 72(%ebp), %edx + movl 76(%ebp), %ecx + addl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %edi + /* round 8 */ + movl 64(%ebp), %edx + movl 68(%ebp), %ecx + subl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %esi + /* round 7 */ + movl 56(%ebp), %edx + movl 60(%ebp), %ecx + xorl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %edi + /* round 6 */ + movl 48(%ebp), %edx + movl 52(%ebp), %ecx + addl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %esi + /* round 5 */ + movl 40(%ebp), %edx + movl 44(%ebp), %ecx + subl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %edi + /* round 4 */ + movl 32(%ebp), %edx + movl 36(%ebp), %ecx + xorl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %esi + /* round 3 */ + movl 24(%ebp), %edx + movl 28(%ebp), %ecx + addl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %edi + /* round 2 */ + movl 16(%ebp), %edx + movl 20(%ebp), %ecx + subl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %esi + /* round 1 */ + movl 8(%ebp), %edx + movl 12(%ebp), %ecx + xorl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %edi + /* round 0 */ + movl (%ebp), %edx + movl 4(%ebp), %ecx + addl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + movl 20(%esp), %eax + xorl %ecx, %esi + nop + movl %edi, 4(%eax) + movl %esi, (%eax) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.CAST_decrypt_end: + SIZE(CAST_decrypt,.CAST_decrypt_end-CAST_decrypt) +.ident "CAST_decrypt" +.text + .align ALIGN +.globl CAST_cbc_encrypt + TYPE(CAST_cbc_encrypt,@function) +CAST_cbc_encrypt: + + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + movl 28(%esp), %ebp + /* getting iv ptr from parameter 4 */ + movl 36(%esp), %ebx + movl (%ebx), %esi + movl 4(%ebx), %edi + pushl %edi + pushl %esi + pushl %edi + pushl %esi + movl %esp, %ebx + movl 36(%esp), %esi + movl 40(%esp), %edi + /* getting encrypt flag from parameter 5 */ + movl 56(%esp), %ecx + /* get and push parameter 3 */ + movl 48(%esp), %eax + pushl %eax + pushl %ebx + cmpl $0, %ecx + jz .L000decrypt + andl $4294967288, %ebp + movl 8(%esp), %eax + movl 12(%esp), %ebx + jz .L001encrypt_finish +.L002encrypt_loop: + movl (%esi), %ecx + movl 4(%esi), %edx + xorl %ecx, %eax + xorl %edx, %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call CAST_encrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, (%edi) + movl %ebx, 4(%edi) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L002encrypt_loop +.L001encrypt_finish: + movl 52(%esp), %ebp + andl $7, %ebp + jz .L003finish + xorl %ecx, %ecx + xorl %edx, %edx + movl .L004cbc_enc_jmp_table(,%ebp,4),%ebp + jmp *%ebp +.L005ej7: + xorl %edx, %edx + movb 6(%esi), %dh + sall $8, %edx +.L006ej6: + movb 5(%esi), %dh +.L007ej5: + movb 4(%esi), %dl +.L008ej4: + movl (%esi), %ecx + jmp .L009ejend +.L010ej3: + movb 2(%esi), %ch + xorl %ecx, %ecx + sall $8, %ecx +.L011ej2: + movb 1(%esi), %ch +.L012ej1: + movb (%esi), %cl +.L009ejend: + xorl %ecx, %eax + xorl %edx, %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call CAST_encrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, (%edi) + movl %ebx, 4(%edi) + jmp .L003finish +.align ALIGN +.L000decrypt: + andl $4294967288, %ebp + movl 16(%esp), %eax + movl 20(%esp), %ebx + jz .L013decrypt_finish +.L014decrypt_loop: + movl (%esi), %eax + movl 4(%esi), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call CAST_decrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl 16(%esp), %ecx + movl 20(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx + movl %ecx, (%edi) + movl %edx, 4(%edi) + movl %eax, 16(%esp) + movl %ebx, 20(%esp) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L014decrypt_loop +.L013decrypt_finish: + movl 52(%esp), %ebp + andl $7, %ebp + jz .L003finish + movl (%esi), %eax + movl 4(%esi), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call CAST_decrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl 16(%esp), %ecx + movl 20(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx +.L015dj7: + rorl $16, %edx + movb %dl, 6(%edi) + shrl $16, %edx +.L016dj6: + movb %dh, 5(%edi) +.L017dj5: + movb %dl, 4(%edi) +.L018dj4: + movl %ecx, (%edi) + jmp .L019djend +.L020dj3: + rorl $16, %ecx + movb %cl, 2(%edi) + sall $16, %ecx +.L021dj2: + movb %ch, 1(%esi) +.L022dj1: + movb %cl, (%esi) +.L019djend: + jmp .L003finish +.align ALIGN +.L003finish: + movl 60(%esp), %ecx + addl $24, %esp + movl %eax, (%ecx) + movl %ebx, 4(%ecx) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.align ALIGN +.L004cbc_enc_jmp_table: + .long 0 + .long .L012ej1 + .long .L011ej2 + .long .L010ej3 + .long .L008ej4 + .long .L007ej5 + .long .L006ej6 + .long .L005ej7 +.align ALIGN +.L023cbc_dec_jmp_table: + .long 0 + .long .L022dj1 + .long .L021dj2 + .long .L020dj3 + .long .L018dj4 + .long .L017dj5 + .long .L016dj6 + .long .L015dj7 +.CAST_cbc_encrypt_end: + SIZE(CAST_cbc_encrypt,.CAST_cbc_encrypt_end-CAST_cbc_encrypt) +.ident "desasm.pl" diff --git a/src/lib/libcrypto/conf/conf.c b/src/lib/libcrypto/conf/conf.c new file mode 100644 index 0000000000..9e84300c5e --- /dev/null +++ b/src/lib/libcrypto/conf/conf.c @@ -0,0 +1,727 @@ +/* crypto/conf/conf.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include <errno.h> +#include "cryptlib.h" +#include "stack.h" +#include "lhash.h" +#include "conf.h" +#include "buffer.h" +#include "err.h" + +#include "conf_lcl.h" + +#ifndef NOPROTO +static void value_free_hash(CONF_VALUE *a, LHASH *conf); +static void value_free_stack(CONF_VALUE *a,LHASH *conf); +static unsigned long hash(CONF_VALUE *v); +static int cmp(CONF_VALUE *a,CONF_VALUE *b); +static char *eat_ws(char *p); +static char *eat_alpha_numeric(char *p); +static void clear_comments(char *p); +static int str_copy(LHASH *conf,char *section,char **to, char *from); +static char *scan_quote(char *p); +static CONF_VALUE *new_section(LHASH *conf,char *section); +static CONF_VALUE *get_section(LHASH *conf,char *section); +#else +static void value_free_hash(); +static void value_free_stack(); +static unsigned long hash(); +static int cmp(); +static char *eat_ws(); +static char *eat_alpha_numeric(); +static void clear_comments(); +static int str_copy(); +static char *scan_quote(); +static CONF_VALUE *new_section(); +static CONF_VALUE *get_section(); +#endif + +#define scan_esc(p) ((*(++p) == '\0')?(p):(++p)) + +char *CONF_version="CONF part of SSLeay 0.9.0b 29-Jun-1998"; + +LHASH *CONF_load(h,file,line) +LHASH *h; +char *file; +long *line; + { + LHASH *ret=NULL; + FILE *in=NULL; +#define BUFSIZE 512 + int bufnum=0,i,ii; + BUF_MEM *buff=NULL; + char *s,*p,*end; + int again,n,eline=0; + CONF_VALUE *v=NULL,*vv,*tv; + CONF_VALUE *sv=NULL; + char *section=NULL,*buf; + STACK *section_sk=NULL,*ts; + char *start,*psection,*pname; + + if ((buff=BUF_MEM_new()) == NULL) + { + CONFerr(CONF_F_CONF_LOAD,ERR_R_BUF_LIB); + goto err; + } + + in=fopen(file,"rb"); + if (in == NULL) + { + SYSerr(SYS_F_FOPEN,get_last_sys_error()); + ERR_set_error_data(BUF_strdup(file), + ERR_TXT_MALLOCED|ERR_TXT_STRING); + CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB); + goto err; + } + + section=(char *)Malloc(10); + if (section == NULL) + { + CONFerr(CONF_F_CONF_LOAD,ERR_R_MALLOC_FAILURE); + goto err; + } + strcpy(section,"default"); + + if (h == NULL) + { + if ((ret=lh_new(hash,cmp)) == NULL) + { + CONFerr(CONF_F_CONF_LOAD,ERR_R_MALLOC_FAILURE); + goto err; + } + } + else + ret=h; + + sv=new_section(ret,section); + if (sv == NULL) + { + CONFerr(CONF_F_CONF_LOAD,CONF_R_UNABLE_TO_CREATE_NEW_SECTION); + goto err; + } + section_sk=(STACK *)sv->value; + + bufnum=0; + for (;;) + { + again=0; + if (!BUF_MEM_grow(buff,bufnum+BUFSIZE)) + { + CONFerr(CONF_F_CONF_LOAD,ERR_R_BUF_LIB); + goto err; + } + p= &(buff->data[bufnum]); + *p='\0'; + fgets(p,BUFSIZE-1,in); + p[BUFSIZE-1]='\0'; + ii=i=strlen(p); + if (i == 0) break; + while (i > 0) + { + if ((p[i-1] != '\r') && (p[i-1] != '\n')) + break; + else + i--; + } + /* we removed some trailing stuff so there is a new + * line on the end. */ + if (i == ii) + again=1; /* long line */ + else + { + p[i]='\0'; + eline++; /* another input line */ + } + + /* we now have a line with trailing \r\n removed */ + + /* i is the number of bytes */ + bufnum+=i; + + v=NULL; + /* check for line continuation */ + if (bufnum >= 1) + { + /* If we have bytes and the last char '\\' and + * second last char is not '\\' */ + p= &(buff->data[bufnum-1]); + if ( IS_ESC(p[0]) && + ((bufnum <= 1) || !IS_ESC(p[-1]))) + { + bufnum--; + again=1; + } + } + if (again) continue; + bufnum=0; + buf=buff->data; + + clear_comments(buf); + n=strlen(buf); + s=eat_ws(buf); + if (IS_EOF(*s)) continue; /* blank line */ + if (*s == '[') + { + s++; + start=eat_ws(s); + end=eat_alpha_numeric(start); + p=eat_ws(end); + if (*p != ']') + { + CONFerr(CONF_F_CONF_LOAD,CONF_R_MISSING_CLOSE_SQUARE_BRACKET); + goto err; + } + *end='\0'; + if (!str_copy(ret,NULL,§ion,start)) goto err; + if ((sv=get_section(ret,section)) == NULL) + sv=new_section(ret,section); + if (sv == NULL) + { + CONFerr(CONF_F_CONF_LOAD,CONF_R_UNABLE_TO_CREATE_NEW_SECTION); + goto err; + } + section_sk=(STACK *)sv->value; + continue; + } + else + { + pname=s; + psection=NULL; + end=eat_alpha_numeric(s); + if ((end[0] == ':') && (end[1] == ':')) + { + *end='\0'; + end+=2; + psection=pname; + pname=end; + end=eat_alpha_numeric(end); + } + p=eat_ws(end); + if (*p != '=') + { + CONFerr(CONF_F_CONF_LOAD,CONF_R_MISSING_EQUAL_SIGN); + goto err; + } + *end='\0'; + p++; + start=eat_ws(p); + while (!IS_EOF(*p)) + p++; + p--; + while ((p != start) && (IS_WS(*p))) + p--; + p++; + *p='\0'; + + if ((v=(CONF_VALUE *)Malloc(sizeof(CONF_VALUE))) == NULL) + { + CONFerr(CONF_F_CONF_LOAD,ERR_R_MALLOC_FAILURE); + goto err; + } + if (psection == NULL) psection=section; + v->name=(char *)Malloc(strlen(pname)+1); + v->value=NULL; + if (v->name == NULL) + { + CONFerr(CONF_F_CONF_LOAD,ERR_R_MALLOC_FAILURE); + goto err; + } + strcpy(v->name,pname); + if (!str_copy(ret,psection,&(v->value),start)) goto err; + + if (strcmp(psection,section) != 0) + { + if ((tv=get_section(ret,psection)) + == NULL) + tv=new_section(ret,psection); + if (tv == NULL) + { + CONFerr(CONF_F_CONF_LOAD,CONF_R_UNABLE_TO_CREATE_NEW_SECTION); + goto err; + } + ts=(STACK *)tv->value; + } + else + { + tv=sv; + ts=section_sk; + } + v->section=tv->section; + if (!sk_push(ts,(char *)v)) + { + CONFerr(CONF_F_CONF_LOAD,ERR_R_MALLOC_FAILURE); + goto err; + } + vv=(CONF_VALUE *)lh_insert(ret,(char *)v); + if (vv != NULL) + { + sk_delete_ptr(ts,(char *)vv); + Free(vv->name); + Free(vv->value); + Free(vv); + } + v=NULL; + } + } + if (buff != NULL) BUF_MEM_free(buff); + if (section != NULL) Free(section); + if (in != NULL) fclose(in); + return(ret); +err: + if (buff != NULL) BUF_MEM_free(buff); + if (section != NULL) Free(section); + if (line != NULL) *line=eline; + if (in != NULL) fclose(in); + if ((h != ret) && (ret != NULL)) CONF_free(ret); + if (v != NULL) + { + if (v->name != NULL) Free(v->name); + if (v->value != NULL) Free(v->value); + if (v != NULL) Free(v); + } + return(NULL); + } + +char *CONF_get_string(conf,section,name) +LHASH *conf; +char *section; +char *name; + { + CONF_VALUE *v,vv; + char *p; + + if (name == NULL) return(NULL); + if (conf != NULL) + { + if (section != NULL) + { + vv.name=name; + vv.section=section; + v=(CONF_VALUE *)lh_retrieve(conf,(char *)&vv); + if (v != NULL) return(v->value); + if (strcmp(section,"ENV") == 0) + { + p=Getenv(name); + if (p != NULL) return(p); + } + } + vv.section="default"; + vv.name=name; + v=(CONF_VALUE *)lh_retrieve(conf,(char *)&vv); + if (v != NULL) + return(v->value); + else + return(NULL); + } + else + return(Getenv(name)); + } + +static CONF_VALUE *get_section(conf,section) +LHASH *conf; +char *section; + { + CONF_VALUE *v,vv; + + if ((conf == NULL) || (section == NULL)) return(NULL); + vv.name=NULL; + vv.section=section; + v=(CONF_VALUE *)lh_retrieve(conf,(char *)&vv); + return(v); + } + +STACK *CONF_get_section(conf,section) +LHASH *conf; +char *section; + { + CONF_VALUE *v; + + v=get_section(conf,section); + if (v != NULL) + return((STACK *)v->value); + else + return(NULL); + } + +long CONF_get_number(conf,section,name) +LHASH *conf; +char *section; +char *name; + { + char *str; + long ret=0; + + str=CONF_get_string(conf,section,name); + if (str == NULL) return(0); + for (;;) + { + if (IS_NUMER(*str)) + ret=ret*10+(*str -'0'); + else + return(ret); + str++; + } + } + +void CONF_free(conf) +LHASH *conf; + { + if (conf == NULL) return; + + conf->down_load=0; /* evil thing to make sure the 'Free()' + * works as expected */ + lh_doall_arg(conf,(void (*)())value_free_hash,(char *)conf); + + /* We now have only 'section' entries in the hash table. + * Due to problems with */ + + lh_doall_arg(conf,(void (*)())value_free_stack,(char *)conf); + lh_free(conf); + } + +static void value_free_hash(a,conf) +CONF_VALUE *a; +LHASH *conf; + { + if (a->name != NULL) + { + a=(CONF_VALUE *)lh_delete(conf,(char *)a); + } + } + +static void value_free_stack(a,conf) +CONF_VALUE *a; +LHASH *conf; + { + CONF_VALUE *vv; + STACK *sk; + int i; + + if (a->name != NULL) return; + + sk=(STACK *)a->value; + for (i=sk_num(sk)-1; i>=0; i--) + { + vv=(CONF_VALUE *)sk_value(sk,i); + Free(vv->value); + Free(vv->name); + Free(vv); + } + if (sk != NULL) sk_free(sk); + Free(a->section); + Free(a); + } + +static void clear_comments(p) +char *p; + { + char *to; + + to=p; + for (;;) + { + if (IS_COMMENT(*p)) + { + *p='\0'; + return; + } + if (IS_QUOTE(*p)) + { + p=scan_quote(p); + continue; + } + if (IS_ESC(*p)) + { + p=scan_esc(p); + continue; + } + if (IS_EOF(*p)) + return; + else + p++; + } + } + +static int str_copy(conf,section,pto,from) +LHASH *conf; +char *section; +char **pto,*from; + { + int q,r,rr=0,to=0,len=0; + char *s,*e,*rp,*p,*rrp,*np,*cp,v; + BUF_MEM *buf; + + if ((buf=BUF_MEM_new()) == NULL) return(0); + + len=strlen(from)+1; + if (!BUF_MEM_grow(buf,len)) goto err; + + for (;;) + { + if (IS_QUOTE(*from)) + { + q= *from; + from++; + while ((*from != '\0') && (*from != q)) + { + if (*from == '\\') + { + from++; + if (*from == '\0') break; + } + buf->data[to++]= *(from++); + } + } + else if (*from == '\\') + { + from++; + v= *(from++); + if (v == '\0') break; + else if (v == 'r') v='\r'; + else if (v == 'n') v='\n'; + else if (v == 'b') v='\b'; + else if (v == 't') v='\t'; + buf->data[to++]= v; + } + else if (*from == '\0') + break; + else if (*from == '$') + { + /* try to expand it */ + rrp=NULL; + s= &(from[1]); + if (*s == '{') + q='}'; + else if (*s == '(') + q=')'; + else q=0; + + if (q) s++; + cp=section; + e=np=s; + while (IS_ALPHA_NUMERIC(*e)) + e++; + if ((e[0] == ':') && (e[1] == ':')) + { + cp=np; + rrp=e; + rr= *e; + *rrp='\0'; + e+=2; + np=e; + while (IS_ALPHA_NUMERIC(*e)) + e++; + } + r= *e; + *e='\0'; + rp=e; + if (q) + { + if (r != q) + { + CONFerr(CONF_F_STR_COPY,CONF_R_NO_CLOSE_BRACE); + goto err; + } + e++; + } + /* So at this point we have + * ns which is the start of the name string which is + * '\0' terminated. + * cs which is the start of the section string which is + * '\0' terminated. + * e is the 'next point after'. + * r and s are the chars replaced by the '\0' + * rp and sp is where 'r' and 's' came from. + */ + p=CONF_get_string(conf,cp,np); + if (rrp != NULL) *rrp=rr; + *rp=r; + if (p == NULL) + { + CONFerr(CONF_F_STR_COPY,CONF_R_VARIABLE_HAS_NO_VALUE); + goto err; + } + BUF_MEM_grow(buf,(strlen(p)+len-(e-from))); + while (*p) + buf->data[to++]= *(p++); + from=e; + } + else + buf->data[to++]= *(from++); + } + buf->data[to]='\0'; + if (*pto != NULL) Free(*pto); + *pto=buf->data; + Free(buf); + return(1); +err: + if (buf != NULL) BUF_MEM_free(buf); + return(0); + } + +static char *eat_ws(p) +char *p; + { + while (IS_WS(*p) && (!IS_EOF(*p))) + p++; + return(p); + } + +static char *eat_alpha_numeric(p) +char *p; + { + for (;;) + { + if (IS_ESC(*p)) + { + p=scan_esc(p); + continue; + } + if (!IS_ALPHA_NUMERIC_PUNCT(*p)) + return(p); + p++; + } + } + +static unsigned long hash(v) +CONF_VALUE *v; + { + return((lh_strhash(v->section)<<2)^lh_strhash(v->name)); + } + +static int cmp(a,b) +CONF_VALUE *a,*b; + { + int i; + + if (a->section != b->section) + { + i=strcmp(a->section,b->section); + if (i) return(i); + } + + if ((a->name != NULL) && (b->name != NULL)) + { + i=strcmp(a->name,b->name); + return(i); + } + else if (a->name == b->name) + return(0); + else + return((a->name == NULL)?-1:1); + } + +static char *scan_quote(p) +char *p; + { + int q= *p; + + p++; + while (!(IS_EOF(*p)) && (*p != q)) + { + if (IS_ESC(*p)) + { + p++; + if (IS_EOF(*p)) return(p); + } + p++; + } + if (*p == q) p++; + return(p); + } + +static CONF_VALUE *new_section(conf,section) +LHASH *conf; +char *section; + { + STACK *sk=NULL; + int ok=0,i; + CONF_VALUE *v=NULL,*vv; + + if ((sk=sk_new_null()) == NULL) + goto err; + if ((v=(CONF_VALUE *)Malloc(sizeof(CONF_VALUE))) == NULL) + goto err; + i=strlen(section)+1; + if ((v->section=(char *)Malloc(i)) == NULL) + goto err; + + memcpy(v->section,section,i); + v->name=NULL; + v->value=(char *)sk; + + vv=(CONF_VALUE *)lh_insert(conf,(char *)v); + if (vv != NULL) + { +#if !defined(NO_STDIO) && !defined(WIN16) + fprintf(stderr,"internal fault\n"); +#endif + abort(); + } + ok=1; +err: + if (!ok) + { + if (sk != NULL) sk_free(sk); + if (v != NULL) Free(v); + v=NULL; + } + return(v); + } diff --git a/src/lib/libcrypto/conf/conf.err b/src/lib/libcrypto/conf/conf.err new file mode 100644 index 0000000000..933d3d692a --- /dev/null +++ b/src/lib/libcrypto/conf/conf.err @@ -0,0 +1,12 @@ +/* Error codes for the CONF functions. */ + +/* Function codes. */ +#define CONF_F_CONF_LOAD 100 +#define CONF_F_STR_COPY 101 + +/* Reason codes. */ +#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 +#define CONF_R_MISSING_EQUAL_SIGN 101 +#define CONF_R_NO_CLOSE_BRACE 102 +#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 +#define CONF_R_VARIABLE_HAS_NO_VALUE 104 diff --git a/src/lib/libcrypto/conf/conf_lcl.h b/src/lib/libcrypto/conf/conf_lcl.h new file mode 100644 index 0000000000..4e5644ed79 --- /dev/null +++ b/src/lib/libcrypto/conf/conf_lcl.h @@ -0,0 +1,102 @@ +/* crypto/conf/conf_lcl.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#define CONF_NUMBER 1 +#define CONF_UPPER 2 +#define CONF_LOWER 4 +#define CONF_UNDER 256 +#define CONF_PUNCTUATION 512 +#define CONF_WS 16 +#define CONF_ESC 32 +#define CONF_QUOTE 64 +#define CONF_COMMENT 128 +#define CONF_EOF 8 +#define CONF_ALPHA (CONF_UPPER|CONF_LOWER) +#define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER) +#define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \ + CONF_PUNCTUATION) + +#define IS_COMMENT(a) (CONF_COMMENT&(CONF_type[(a)&0x7f])) +#define IS_EOF(a) ((a) == '\0') +#define IS_ESC(a) ((a) == '\\') +#define IS_NUMER(a) (CONF_type[(a)&0x7f]&CONF_NUMBER) +#define IS_WS(a) (CONF_type[(a)&0x7f]&CONF_WS) +#define IS_ALPHA_NUMERIC(a) (CONF_type[(a)&0x7f]&CONF_ALPHA_NUMERIC) +#define IS_ALPHA_NUMERIC_PUNCT(a) \ + (CONF_type[(a)&0x7f]&CONF_ALPHA_NUMERIC_PUNCT) +#define IS_QUOTE(a) (CONF_type[(a)&0x7f]&CONF_QUOTE) + +static unsigned short CONF_type[128]={ + 0x008,0x000,0x000,0x000,0x000,0x000,0x000,0x000, + 0x000,0x010,0x010,0x000,0x000,0x010,0x000,0x000, + 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000, + 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000, + 0x010,0x200,0x040,0x080,0x000,0x200,0x200,0x040, + 0x000,0x000,0x200,0x200,0x200,0x200,0x200,0x200, + 0x001,0x001,0x001,0x001,0x001,0x001,0x001,0x001, + 0x001,0x001,0x000,0x200,0x000,0x000,0x000,0x200, + 0x200,0x002,0x002,0x002,0x002,0x002,0x002,0x002, + 0x002,0x002,0x002,0x002,0x002,0x002,0x002,0x002, + 0x002,0x002,0x002,0x002,0x002,0x002,0x002,0x002, + 0x002,0x002,0x002,0x000,0x020,0x000,0x200,0x100, + 0x040,0x004,0x004,0x004,0x004,0x004,0x004,0x004, + 0x004,0x004,0x004,0x004,0x004,0x004,0x004,0x004, + 0x004,0x004,0x004,0x004,0x004,0x004,0x004,0x004, + 0x004,0x004,0x004,0x000,0x200,0x000,0x200,0x000, + }; + diff --git a/src/lib/libcrypto/cryptall.h b/src/lib/libcrypto/cryptall.h new file mode 100644 index 0000000000..65a46452a8 --- /dev/null +++ b/src/lib/libcrypto/cryptall.h @@ -0,0 +1,110 @@ +/* crypto/cryptall.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_CRYPTOALL_H +#define HEADER_CRYPTOALL_H + +#include "buffer.h" +#include "stack.h" +#include "lhash.h" + +#include "err.h" + +#ifdef NO_MD2 +#include <md2.h> +#else +#include "md2.h" +#endif +#ifdef NO_MD5 +#include <md5.h> +#else +#include "md5.h" +#endif +#include "sha.h" + +#ifdef NO_DES +#include <des.h> +#else +#include "des.h" +#endif +#include "rc2.h" +#include "rc4.h" +#include "idea.h" + +#include "bn.h" +#include "dh.h" +#include "rsa.h" +#include "dsa.h" + +#include "rand.h" +#include "conf.h" +#include "txt_db.h" + +#include "err.h" +#include "evp.h" + +#include "meth.h" +#include "x509.h" +#include "pkcs7.h" +#include "pem.h" +#include "asn1.h" +#include "objects.h" + +#include "crypto.h" + +#endif diff --git a/src/lib/libcrypto/crypto.c b/src/lib/libcrypto/crypto.c new file mode 100644 index 0000000000..366e25c939 --- /dev/null +++ b/src/lib/libcrypto/crypto.c @@ -0,0 +1,575 @@ +/* crypto/crypto.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* If you are happy to use the assmbler version of bn/bn_mulw.c, define + * BN_ASM */ +#ifndef BN_ASM +#undef BN_ASM +#define X86_ASM +#endif + +#ifndef DES_ASM +#undef DES_ASM +#endif + +#ifndef BF_ASM +#undef BF_ASM +#endif + +/* The following defines are only to break the compiles into chunks. + * If you wish to not compile some sections, use the 'NO_XXX' macros + */ +#ifndef CRYPTO_SUBSET +/* Define all subset symbols. */ +#define CRYPTO_LIB_SUBSET +#define CRYPTO_ASN1_SUBSET +#define CRYPTO_BN_SUBSET +#define CRYPTO_BUFFER_SUBSET +#define CRYPTO_BIO_SUBSET +#define CRYPTO_CONF_SUBSET +#define CRYPTO_DES_SUBSET +#define CRYPTO_DH_SUBSET +#define CRYPTO_DSA_SUBSET +#define CRYPTO_ERROR_SUBSET +#define CRYPTO_EVP_SUBSET +#define CRYPTO_IDEA_SUBSET +#define CRYPTO_LHASH_SUBSET +#define CRYPTO_MD_SUBSET +#define CRYPTO_MDC2_SUBSET +#define CRYPTO_METH_SUBSET +#define CRYPTO_OBJECTS_SUBSET +#define CRYPTO_PEM_SUBSET +#define CRYPTO_RAND_SUBSET +#define CRYPTO_RC_SUBSET +#define CRYPTO_BLOWFISH_SUBSET +#define CRYPTO_CAST_SUBSET +#define CRYPTO_RSA_SUBSET +#define CRYPTO_SHA_SUBSET +#define CRYPTO_HMAC_SUBSET +#define CRYPTO_SHA1_SUBSET +#define CRYPTO_STACK_SUBSET +#define CRYPTO_TXT_DB_SUBSET +#define CRYPTO_X509_SUBSET +#define CRYPTO_PKCS7_SUBSET +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define USE_SOCKETS +#include "../e_os.h" + +#include "buffer.h" +#include "bio.h" +#include "stack.h" +#include "lhash.h" + +#include "err.h" + +#include "bn.h" +#include "evp.h" + +#include "rand.h" +#include "conf.h" +#include "txt_db.h" + +#include "x509.h" +#include "pkcs7.h" +#include "pem.h" +#include "asn1.h" +#include "objects.h" + +#ifdef CRYPTO_LIB_SUBSET +#include "cryptlib.c" +#include "mem.c" +#include "cversion.c" +#endif + +#ifdef CRYPTO_ASN1_SUBSET +#include "asn1/a_meth.c" +#include "asn1/a_bitstr.c" +#include "asn1/a_d2i_fp.c" +#include "asn1/a_dup.c" +#include "asn1/a_hdr.c" +#include "asn1/a_i2d_fp.c" +#include "asn1/a_int.c" +#include "asn1/a_bool.c" +#include "asn1/a_bytes.c" +#include "asn1/a_object.c" +#include "asn1/a_octet.c" +#include "asn1/a_print.c" +#include "asn1/a_set.c" +#include "asn1/a_sign.c" +#include "asn1/a_type.c" +#include "asn1/a_utctm.c" +#include "asn1/a_verify.c" +#include "asn1/a_digest.c" +#include "asn1/asn1_err.c" +#include "asn1/asn1_lib.c" +#include "asn1/asn1_par.c" +#ifndef NO_DH +#include "asn1/d2i_dhp.c" +#include "asn1/i2d_dhp.c" +#endif +#ifndef NO_DSA +#include "asn1/d2i_dsap.c" +#include "asn1/i2d_dsap.c" +#include "asn1/d2i_s_pr.c" +#include "asn1/i2d_s_pr.c" +#include "asn1/d2i_s_pu.c" +#include "asn1/i2d_s_pu.c" +#endif +#ifndef NO_RSA +#include "asn1/d2i_r_pr.c" +#include "asn1/i2d_r_pr.c" +#include "asn1/d2i_r_pu.c" +#include "asn1/i2d_r_pu.c" +#include "asn1/n_pkey.c" +#endif +#include "asn1/d2i_pr.c" +#include "asn1/d2i_pu.c" +#include "asn1/i2d_pr.c" +#include "asn1/i2d_pu.c" +#include "asn1/f_int.c" +#include "asn1/f_string.c" +#include "asn1/p7_dgst.c" +#include "asn1/p7_enc.c" +#include "asn1/p7_enc_c.c" +#include "asn1/p7_evp.c" +#include "asn1/p7_i_s.c" +#include "asn1/p7_lib.c" +#include "asn1/p7_recip.c" +#include "asn1/p7_s_e.c" +#include "asn1/p7_signd.c" +#include "asn1/p7_signi.c" +#include "asn1/t_pkey.c" +#include "asn1/t_req.c" +#include "asn1/t_x509.c" +#include "asn1/x_algor.c" +#include "asn1/x_attrib.c" +#include "asn1/x_exten.c" +#include "asn1/x_cinf.c" +#include "asn1/x_crl.c" +#include "asn1/x_info.c" +#include "asn1/x_name.c" +#include "asn1/x_pkey.c" +#include "asn1/x_pubkey.c" +#include "asn1/x_req.c" +#include "asn1/x_sig.c" +#include "asn1/x_spki.c" +#include "asn1/x_val.c" +#include "asn1/x_x509.c" +#endif + +#ifdef CRYPTO_BN_SUBSET +#include "bn/bn_add.c" +#include "bn/bn_div.c" +#include "bn/bn_exp.c" +#include "bn/bn_mont.c" +#include "bn/bn_recp.c" +#include "bn/bn_gcd.c" +#include "bn/bn_lib.c" +#include "bn/bn_mod.c" +#include "bn/bn_mul.c" +#ifndef BN_ASM +#include "bn/bn_mulw.c" +#endif +#include "bn/bn_prime.c" +#include "bn/bn_rand.c" +#include "bn/bn_shift.c" +#include "bn/bn_sqr.c" +#include "bn/bn_sub.c" +#include "bn/bn_word.c" +#include "bn/bn_print.c" +#include "bn/bn_err.c" +#include "bn/bn_blind.c" +#endif + +#ifdef CRYPTO_BIO_SUBSET +#include "bio/bf_buff.c" +#include "bio/bf_null.c" +#include "bio/bf_nbio.c" +#include "bio/bio_cb.c" +#include "bio/bio_lib.c" +#include "bio/bss_fd.c" +#include "bio/bss_file.c" +#include "bio/bss_mem.c" +#include "bio/bss_null.c" +#ifdef VMS +#include "bio/bss_rtcp.c" +#endif +#include "bio/bss_sock.c" +#include "bio/bss_conn.c" +#include "bio/bss_acpt.c" +#include "bio/b_sock.c" +#include "bio/b_print.c" +#include "bio/b_dump.c" +#include "bio/bio_err.c" +#endif + +#ifdef CRYPTO_BUFFER_SUBSET +#include "buffer/buf_err.c" +#include "buffer/buffer.c" +#endif + +#ifdef CRYPTO_CONF_SUBSET +#include "conf/conf.c" +#include "conf/conf_err.c" +#endif + +#ifdef CRYPTO_DES_SUBSET +#include "des/read_pwd.c" +#ifndef NO_DES +#ifndef DES_ASM +#include "des/fcrypt_b.c" +#include "des/des_enc.c" +#endif +#include "des/cbc_cksm.c" +#include "des/xcbc_enc.c" +#include "des/cbc_enc.c" +#include "des/cfb64ede.c" +#include "des/cfb64enc.c" +#include "des/cfb_enc.c" +#include "des/ecb3_enc.c" +#include "des/ecb_enc.c" +#include "des/enc_read.c" +#include "des/enc_writ.c" +#include "des/fcrypt.c" +#include "des/ofb64ede.c" +#include "des/ofb64enc.c" +#include "des/ofb_enc.c" +#include "des/pcbc_enc.c" +#include "des/qud_cksm.c" +#include "des/rand_key.c" +#include "des/read2pwd.c" +#include "des/rpc_enc.c" +#include "des/set_key.c" +#include "des/str2key.c" +#include "des/supp.c" +#endif +#endif + +#ifdef CRYPTO_DH_SUBSET +#ifndef NO_DH +#include "dh/dh_check.c" +#include "dh/dh_err.c" +#include "dh/dh_gen.c" +#include "dh/dh_key.c" +#include "dh/dh_lib.c" +#endif +#endif + +#ifdef CRYPTO_DSA_SUBSET +#ifndef NO_DSA +#include "dsa/dsa_gen.c" +#include "dsa/dsa_key.c" +#include "dsa/dsa_lib.c" +#include "dsa/dsa_sign.c" +#include "dsa/dsa_vrf.c" +#include "dsa/dsa_err.c" +#endif +#endif + +#ifdef CRYPTO_ERROR_SUBSET +#include "err/err.c" +#include "err/err_all.c" +#include "err/err_prn.c" +#endif + +#ifdef CRYPTO_EVP_SUBSET +#include "evp/bio_md.c" +#include "evp/bio_b64.c" +#include "evp/bio_enc.c" +#include "evp/c_all.c" +#include "evp/digest.c" +#ifndef NO_DES +#include "evp/e_cbc_3d.c" +#include "evp/e_cfb_3d.c" +#include "evp/e_ecb_3d.c" +#include "evp/e_ofb_3d.c" +#include "evp/e_cbc_d.c" +#include "evp/e_cfb_d.c" +#include "evp/e_xcbc_d.c" +#include "evp/e_ecb_d.c" +#include "evp/e_ofb_d.c" +#endif +#ifndef NO_IDEA +#include "evp/e_cbc_i.c" +#include "evp/e_cfb_i.c" +#include "evp/e_ecb_i.c" +#include "evp/e_ofb_i.c" +#endif +#ifndef NO_RC2 +#include "evp/e_cbc_r2.c" +#include "evp/e_cfb_r2.c" +#include "evp/e_ecb_r2.c" +#include "evp/e_ofb_r2.c" +#endif +#ifndef NO_BLOWFISH +#include "evp/e_cbc_bf.c" +#include "evp/e_cfb_bf.c" +#include "evp/e_ecb_bf.c" +#include "evp/e_ofb_bf.c" +#endif +#ifndef NO_CAST +#include "evp/e_cbc_c.c" +#include "evp/e_cfb_c.c" +#include "evp/e_ecb_c.c" +#include "evp/e_ofb_c.c" +#endif +#ifndef NO_RC4 +#include "evp/e_rc4.c" +#endif +#include "rc5/rc5_enc.c" +#include "rc5/rc5cfb64.c" +#include "rc5/rc5_ecb.c" +#include "rc5/rc5_skey.c" +#include "rc5/rc5ofb64.c" +#include "ripemd/rmd160.c" +#include "ripemd/rmd_dgst.c" +#include "ripemd/rmd_one.c" +#include "evp/evp_lib.c" + +#include "evp/names.c" +#include "evp/e_null.c" +#include "evp/encode.c" +#include "evp/evp_enc.c" +#include "evp/evp_err.c" +#include "evp/evp_key.c" +#include "evp/m_null.c" +#include "evp/p_lib.c" +#ifndef NO_RSA +#include "evp/p_open.c" +#include "evp/p_seal.c" +#endif +#include "evp/p_sign.c" +#include "evp/p_verify.c" +#endif + +#ifdef CRYPTO_IDEA_SUBSET +#ifndef NO_IDEA +#include "idea/i_cbc.c" +#include "idea/i_cfb64.c" +#include "idea/i_ecb.c" +#include "idea/i_ofb64.c" +#include "idea/i_skey.c" +#endif +#endif + +#ifdef CRYPTO_BLOWFISH_SUBSET +#ifndef NO_BLOWFISH +#include "bf/bf_cfb64.c" +#include "bf/bf_ecb.c" +#ifndef BF_ASM +#include "bf/bf_enc.c" +#endif +#include "bf/bf_ofb64.c" +#include "bf/bf_skey.c" +#endif +#endif + +#ifdef CRYPTO_CAST_SUBSET +#ifndef NO_CAST +#include "cast/c_cfb64.c" +#include "cast/c_ecb.c" +#ifndef CAST_ASM +#include "cast/c_enc.c" +#endif +#include "cast/c_ofb64.c" +#include "cast/c_skey.c" +#endif +#endif + +#ifdef CRYPTO_LHASH_SUBSET +#include "lhash/lh_stats.c" +#include "lhash/lhash.c" +#endif + +#ifdef CRYPTO_MD_SUBSET +#ifndef NO_MD2 +#include "md2/md2_dgst.c" +#include "md2/md2_one.c" +#include "evp/m_md2.c" +#endif +#ifndef NO_MD5 +#include "md5/md5_dgst.c" +#include "md5/md5_one.c" +#include "evp/m_md5.c" +#endif +#endif + +#ifdef CRYPTO_MDC2_SUBSET +#ifndef NO_MDC2 +#include "mdc2/mdc2dgst.c" +#include "mdc2/mdc2_one.c" +#include "evp/m_mdc2.c" +#endif +#endif + +#ifdef CRYPTO_OBJECTS_SUBSET +#include "objects/obj_dat.c" +#include "objects/obj_err.c" +#include "objects/obj_lib.c" +#endif + +#ifdef CRYPTO_PEM_SUBSET +#include "pem/pem_err.c" +#include "pem/pem_info.c" +#include "pem/pem_lib.c" +#include "pem/pem_all.c" +#ifndef NO_RSA +#include "pem/pem_seal.c" +#include "pem/pem_sign.c" +#endif +#endif + +#ifdef CRYPTO_RAND_SUBSET +#include "rand/md_rand.c" +#include "rand/randfile.c" +#endif + +#ifdef CRYPTO_RC_SUBSET +#ifndef NO_RC2 +#include "rc2/rc2_cbc.c" +#include "rc2/rc2_ecb.c" +#include "rc2/rc2_skey.c" +#include "rc2/rc2cfb64.c" +#include "rc2/rc2ofb64.c" +#endif +#ifndef NO_RC4 +#include "rc4/rc4_skey.c" +#ifndef RC4_ASM +#include "rc4/rc4_enc.c" +#endif +#endif +#endif + +#ifdef CRYPTO_HMAC_SUBSET +#include "hmac/hmac.c" +#endif + +#ifdef CRYPTO_RSA_SUBSET +#ifndef NO_RSA +#include "rsa/rsa_eay.c" +#include "rsa/rsa_err.c" +#include "rsa/rsa_gen.c" +#include "rsa/rsa_lib.c" +#include "rsa/rsa_sign.c" +#include "rsa/rsa_saos.c" +#endif +#endif + +#ifdef CRYPTO_SHA1_SUBSET +#ifndef NO_SHA1 +#include "sha/sha1_one.c" +#include "sha/sha1dgst.c" +#include "evp/m_dss1.c" +#include "evp/m_sha1.c" +#endif +#endif + +#ifdef CRYPTO_SHA_SUBSET +#ifndef NO_SHA +#include "evp/m_dss.c" +#include "sha/sha_dgst.c" +#include "sha/sha_one.c" +#include "evp/m_sha.c" +#endif +#endif + +#ifdef CRYPTO_STACK_SUBSET +#include "stack/stack.c" +#endif + +#ifdef CRYPTO_TXT_DB_SUBSET +#include "txt_db/txt_db.c" +#endif + +#ifdef CRYPTO_X509_SUBSET +#include "x509/x509_cmp.c" +#include "x509/x509_d2.c" +#include "x509/x509_def.c" +#include "x509/x509_err.c" +#include "x509/x509_ext.c" +#include "x509/x509_lu.c" +#include "x509/x509_obj.c" +#include "x509/x509_r2x.c" +#include "x509/x509_req.c" +#include "x509/x509_set.c" +#include "x509/x509_v3.c" +#include "x509/x509_vfy.c" +#include "x509/x509name.c" +#include "x509/x509pack.c" +#include "x509/x509rset.c" +#include "x509/x509type.c" +#include "x509/x_all.c" +#include "x509/x509_txt.c" +#include "x509/by_dir.c" +#include "x509/by_file.c" +#include "x509/v3_net.c" +#include "x509/v3_x509.c" +#endif + + +#ifdef CRYPTO_PKCS7_SUBSET /* I have an explicit removal of 7 lines */ +#include "pkcs7/pk7_lib.c" +#include "pkcs7/pkcs7err.c" +#include "pkcs7/pk7_doit.c" +#endif /* CRYPTO_PKCS7_SUBSET */ + diff --git a/src/lib/libcrypto/crypto.err b/src/lib/libcrypto/crypto.err new file mode 100644 index 0000000000..4ea3385e73 --- /dev/null +++ b/src/lib/libcrypto/crypto.err @@ -0,0 +1,8 @@ +/* Error codes for the CRYPTO functions. */ + +/* Function codes. */ +#define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 +#define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101 +#define CRYPTO_F_CRYPTO_SET_EX_DATA 102 + +/* Reason codes. */ diff --git a/src/lib/libcrypto/date.h b/src/lib/libcrypto/date.h new file mode 100644 index 0000000000..dbb71bd1b7 --- /dev/null +++ b/src/lib/libcrypto/date.h @@ -0,0 +1 @@ +#define DATE "Sun Jul 12 21:04:32 MDT 1998" diff --git a/src/lib/libcrypto/des/DES.pod b/src/lib/libcrypto/des/DES.pod new file mode 100644 index 0000000000..8a739e7ca0 --- /dev/null +++ b/src/lib/libcrypto/des/DES.pod @@ -0,0 +1,16 @@ +crypt <= crypt(buf,salt) +key <= set_odd_parity(key) +int <= is_weak_key(key) +keysched<= set_key(key) +key <= ecb_encrypt(string8,ks,enc) +key <= ecb3_encrypt(input,ks1,ks2,enc) +string <= cbc_encrypt(input,ks,ivec,enc) => ivec +string <= cbc3_encrypt(input,ks1,ks2,ivec1,ivec2,enc) => ivec1&ivec2 +ck1,ck2 <= cbc_cksum(input,ks,ivec) => ivec +string <= pcbc_encrypt(input,ks,ivec,enc) => ivec +string <= ofb_encrypt(input,numbits,ks,ivec) => ivec +string <= cfb_encrypt(input,numbits,ks,ivec,enc) => ivec +key <= random_key() +key <= string_to_key(string) +key1,key2<= string_to_2keys(string) + diff --git a/src/lib/libcrypto/des/MODES.DES b/src/lib/libcrypto/des/MODES.DES new file mode 100644 index 0000000000..0cbc44f51d --- /dev/null +++ b/src/lib/libcrypto/des/MODES.DES @@ -0,0 +1,84 @@ +Modes of DES +Quite a bit of the following information has been taken from + AS 2805.5.2 + Australian Standard + Electronic funds transfer - Requirements for interfaces, + Part 5.2: Modes of operation for an n-bit block cipher algorithm + Appendix A + +There are several different modes in which DES can be used, they are +as follows. + +Electronic Codebook Mode (ECB) (des_ecb_encrypt()) +- 64 bits are enciphered at a time. +- The order of the blocks can be rearranged without detection. +- The same plaintext block always produces the same ciphertext block + (for the same key) making it vulnerable to a 'dictionary attack'. +- An error will only affect one ciphertext block. + +Cipher Block Chaining Mode (CBC) (des_cbc_encrypt()) +- a multiple of 64 bits are enciphered at a time. +- The CBC mode produces the same ciphertext whenever the same + plaintext is encrypted using the same key and starting variable. +- The chaining operation makes the ciphertext blocks dependent on the + current and all preceding plaintext blocks and therefore blocks can not + be rearranged. +- The use of different starting variables prevents the same plaintext + enciphering to the same ciphertext. +- An error will affect the current and the following ciphertext blocks. + +Cipher Feedback Mode (CFB) (des_cfb_encrypt()) +- a number of bits (j) <= 64 are enciphered at a time. +- The CFB mode produces the same ciphertext whenever the same + plaintext is encrypted using the same key and starting variable. +- The chaining operation makes the ciphertext variables dependent on the + current and all preceding variables and therefore j-bit variables are + chained together and con not be rearranged. +- The use of different starting variables prevents the same plaintext + enciphering to the same ciphertext. +- The strength of the CFB mode depends on the size of k (maximal if + j == k). In my implementation this is always the case. +- Selection of a small value for j will require more cycles through + the encipherment algorithm per unit of plaintext and thus cause + greater processing overheads. +- Only multiples of j bits can be enciphered. +- An error will affect the current and the following ciphertext variables. + +Output Feedback Mode (OFB) (des_ofb_encrypt()) +- a number of bits (j) <= 64 are enciphered at a time. +- The OFB mode produces the same ciphertext whenever the same + plaintext enciphered using the same key and starting variable. More + over, in the OFB mode the same key stream is produced when the same + key and start variable are used. Consequently, for security reasons + a specific start variable should be used only once for a given key. +- The absence of chaining makes the OFB more vulnerable to specific attacks. +- The use of different start variables values prevents the same + plaintext enciphering to the same ciphertext, by producing different + key streams. +- Selection of a small value for j will require more cycles through + the encipherment algorithm per unit of plaintext and thus cause + greater processing overheads. +- Only multiples of j bits can be enciphered. +- OFB mode of operation does not extend ciphertext errors in the + resultant plaintext output. Every bit error in the ciphertext causes + only one bit to be in error in the deciphered plaintext. +- OFB mode is not self-synchronising. If the two operation of + encipherment and decipherment get out of synchronism, the system needs + to be re-initialised. +- Each re-initialisation should use a value of the start variable +different from the start variable values used before with the same +key. The reason for this is that an identical bit stream would be +produced each time from the same parameters. This would be +susceptible to a 'known plaintext' attack. + +Triple ECB Mode (des_ecb3_encrypt()) +- Encrypt with key1, decrypt with key2 and encrypt with key1 again. +- As for ECB encryption but increases the effective key length to 112 bits. +- If both keys are the same it is equivalent to encrypting once with + just one key. + +Triple CBC Mode (des_3cbc_encrypt()) +- Encrypt with key1, decrypt with key2 and encrypt with key1 again. +- As for CBC encryption but increases the effective key length to 112 bits. +- If both keys are the same it is equivalent to encrypting once with + just one key. diff --git a/src/lib/libcrypto/des/Makefile.PL b/src/lib/libcrypto/des/Makefile.PL new file mode 100644 index 0000000000..b54a24387c --- /dev/null +++ b/src/lib/libcrypto/des/Makefile.PL @@ -0,0 +1,14 @@ +use ExtUtils::MakeMaker; +# See lib/ExtUtils/MakeMaker.pm for details of how to influence +# the contents of the Makefile being created. +&writeMakefile( + 'potential_libs' => '', # e.g., '-lm' + 'INC' => '', # e.g., '-I/usr/include/other' + 'DISTNAME' => 'DES', + 'VERSION' => '0.1', + 'DEFINE' => '-DPERL5', + 'OBJECT' => 'DES.o cbc_cksm.o cbc_enc.o ecb_enc.o pcbc_enc.o \ + rand_key.o set_key.o str2key.o \ + enc_read.o enc_writ.o fcrypt.o cfb_enc.o \ + ecb3_enc.o ofb_enc.o cbc3_enc.o des_enc.o', + ); diff --git a/src/lib/libcrypto/des/Makefile.lit b/src/lib/libcrypto/des/Makefile.lit new file mode 100644 index 0000000000..c09f6969da --- /dev/null +++ b/src/lib/libcrypto/des/Makefile.lit @@ -0,0 +1,250 @@ +# You must select the correct terminal control system to be used to +# turn character echo off when reading passwords. There a 5 systems +# SGTTY - the old BSD system +# TERMIO - most system V boxes +# TERMIOS - SGI (ala IRIX). +# VMS - the DEC operating system +# MSDOS - we all know what it is :-) +# read_pwd.c makes a reasonable guess at what is correct. + +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +# If you are on a DEC Alpha, edit des.h and change the DES_LONG +# define to 'unsigned int'. I have seen this give a %20 speedup. + +OPTS0= -DLIBDES_LIT -DRAND -DTERMIO #-DNOCONST + +# Version 1.94 has changed the strings_to_key function so that it is +# now compatible with MITs when the string is longer than 8 characters. +# If you wish to keep the old version, uncomment the following line. +# This will affect the -E/-D options on des(1). +#OPTS1= -DOLD_STR_TO_KEY + +# There are 4 possible performance options +# -DDES_PTR +# -DDES_RISC1 +# -DDES_RISC2 (only one of DES_RISC1 and DES_RISC2) +# -DDES_UNROLL +# after the initial build, run 'des_opts' to see which options are best +# for your platform. There are some listed in options.txt +#OPTS2= -DDES_PTR +#OPTS3= -DDES_RISC1 # or DES_RISC2 +#OPTS4= -DDES_UNROLL + +OPTS= $(OPTS0) $(OPTS1) $(OPTS2) $(OPTS3) $(OPTS4) + +MAKE=make -f Makefile +#CC=cc +#CFLAG= -O + +CC=gcc +#CFLAG= -O4 -funroll-loops -fomit-frame-pointer +CFLAG= -O3 -fomit-frame-pointer + +CFLAGS=$(OPTS) $(CFLAG) +CPP=$(CC) -E +AS=as + +# Assember version of des_encrypt*(). +DES_ENC=des_enc.o fcrypt_b.o # normal C version +#DES_ENC=asm/dx86-elf.o asm/yx86-elf.o # elf format x86 +#DES_ENC=asm/dx86-out.o asm/yx86-out.o # a.out format x86 +#DES_ENC=asm/dx86-sol.o asm/yx86-sol.o # solaris format x86 +#DES_ENC=asm/dx86bsdi.o asm/yx86basi.o # bsdi format x86 + +LIBDIR=/usr/local/lib +BINDIR=/usr/local/bin +INCDIR=/usr/local/include +MANDIR=/usr/local/man +MAN1=1 +MAN3=3 +SHELL=/bin/sh +OBJ_LIT=cbc_enc.o ecb_enc.o $(DES_ENC) fcrypt.o set_key.o +OBJ_FULL=cbc_cksm.o $(OBJ_LIT) pcbc_enc.o \ + xcbc_enc.o qud_cksm.o \ + cfb64ede.o cfb64enc.o cfb_enc.o ecb3_enc.o \ + enc_read.o enc_writ.o ofb64ede.o ofb64enc.o ofb_enc.o \ + rand_key.o read_pwd.o read2pwd.o rpc_enc.o str2key.o supp.o + +GENERAL_LIT=COPYRIGHT INSTALL README VERSION Makefile des_crypt.man \ + des.doc options.txt asm +GENERAL_FULL=$(GENERAL_LIT) FILES Imakefile times vms.com KERBEROS MODES.DES \ + des.man DES.pm DES.pod DES.xs Makefile.PL dess.cpp des3s.cpp \ + Makefile.uni typemap t Makefile.ssl makefile.bc Makefile.lit \ + des.org des_locl.org +TESTING_LIT= destest speed des_opts +TESTING_FULL= rpw $(TESTING_LIT) +TESTING_SRC_LIT=destest.c speed.c des_opts.c +TESTING_SRC_FULL=rpw.c $(TESTING_SRC_LIT) +HEADERS_LIT=des_ver.h des.h des_locl.h podd.h sk.h spr.h +HEADERS_FULL= $(HEADERS_LIT) rpc_des.h +LIBDES_LIT=cbc_enc.c ecb_enc.c fcrypt.c set_key.c des_enc.c fcrypt_b.c +LIBDES_FULL= cbc_cksm.c pcbc_enc.c qud_cksm.c \ + cfb64ede.c cfb64enc.c cfb_enc.c ecb3_enc.c \ + enc_read.c enc_writ.c ofb64ede.c ofb64enc.c ofb_enc.c \ + rand_key.c rpc_enc.c str2key.c supp.c \ + xcbc_enc.c $(LIBDES_LIT) read_pwd.c read2pwd.c + +PERL= des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl + +OBJ= $(OBJ_LIT) +GENERAL=$(GENERAL_LIT) +TESTING=$(TESTING_LIT) +TESTING_SRC=$(TESTING_SRC_LIT) +HEADERS=$(HEADERS_LIT) +LIBDES= $(LIBDES_LIT) + +ALL= $(GENERAL) $(TESTING_SRC) $(LIBDES) $(PERL) $(HEADERS) + +DLIB= libdes.a + +all: $(DLIB) $(TESTING) + +cc: + $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all + +gcc: + $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all + +x86-elf: + $(MAKE) DES_ENC='asm/dx86-elf.o asm/yx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all + +x86-out: + $(MAKE) DES_ENC='asm/dx86-out.o asm/yx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all + +x86-solaris: + $(MAKE) DES_ENC='asm/dx86-sol.o asm/yx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all + +x86-bsdi: + $(MAKE) DES_ENC='asm/dx86bsdi.o asm/yx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all + +# elf +asm/dx86-elf.o: asm/dx86unix.cpp + $(CPP) -DELF asm/dx86unix.cpp | $(AS) -o asm/dx86-elf.o + +asm/yx86-elf.o: asm/yx86unix.cpp + $(CPP) -DELF asm/yx86unix.cpp | $(AS) -o asm/yx86-elf.o + +# solaris +asm/dx86-sol.o: asm/dx86unix.cpp + $(CC) -E -DSOL asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s + as -o asm/dx86-sol.o asm/dx86-sol.s + rm -f asm/dx86-sol.s + +asm/yx86-sol.o: asm/yx86unix.cpp + $(CC) -E -DSOL asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s + as -o asm/yx86-sol.o asm/yx86-sol.s + rm -f asm/yx86-sol.s + +# a.out +asm/dx86-out.o: asm/dx86unix.cpp + $(CPP) -DOUT asm/dx86unix.cpp | $(AS) -o asm/dx86-out.o + +asm/yx86-out.o: asm/yx86unix.cpp + $(CPP) -DOUT asm/yx86unix.cpp | $(AS) -o asm/yx86-out.o + +# bsdi +asm/dx86bsdi.o: asm/dx86unix.cpp + $(CPP) -DBSDI asm/dx86unix.cpp | $(AS) -o asm/dx86bsdi.o + +asm/yx86bsdi.o: asm/yx86unix.cpp + $(CPP) -DBSDI asm/yx86unix.cpp | $(AS) -o asm/yx86bsdi.o + +asm/dx86unix.cpp: + (cd asm; perl des-586.pl cpp >dx86unix.cpp) + +asm/yx86unix.cpp: + (cd asm; perl crypt586.pl cpp >yx86unix.cpp) + +test: all + ./destest + +$(DLIB): $(OBJ) + /bin/rm -f $(DLIB) + ar cr $(DLIB) $(OBJ) + -if test -s /bin/ranlib; then /bin/ranlib $(DLIB); \ + else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(DLIB); \ + else exit 0; fi; fi + +des_opts: des_opts.o $(DLIB) + $(CC) $(CFLAGS) -o des_opts des_opts.o $(DLIB) + +destest: destest.o $(DLIB) + $(CC) $(CFLAGS) -o destest destest.o $(DLIB) + +rpw: rpw.o $(DLIB) + $(CC) $(CFLAGS) -o rpw rpw.o $(DLIB) + +speed: speed.o $(DLIB) + $(CC) $(CFLAGS) -o speed speed.o $(DLIB) + +des: des.o $(DLIB) + $(CC) $(CFLAGS) -o des des.o $(DLIB) + +tags: + ctags $(TESTING_SRC) $(LIBDES) + +tar_lit: + /bin/mv Makefile Makefile.tmp + /bin/cp Makefile.lit Makefile + tar chf libdes-l.tar $(LIBDES_LIT) $(HEADERS_LIT) \ + $(GENERAL_LIT) $(TESTING_SRC_LIT) + /bin/rm -f Makefile + /bin/mv Makefile.tmp Makefile + +tar: + tar chf libdes.tar $(ALL) + +shar: + shar $(ALL) >libdes.shar + +depend: + makedepend $(LIBDES) $(TESTING_SRC) + +clean: + /bin/rm -f *.o tags core $(TESTING) $(DLIB) .nfs* *.old *.bak asm/*.o + +dclean: + sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new + mv -f Makefile.new Makefile + +# Eric is probably going to choke when he next looks at this --tjh +install: + if test $(INSTALLTOP); then \ + echo SSL style install; \ + cp $(DLIB) $(INSTALLTOP)/lib; \ + if test -s /bin/ranlib; then \ + /bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ + else \ + if test -s /usr/bin/ranlib; then \ + /usr/bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ + fi; fi; \ + chmod 644 $(INSTALLTOP)/lib/$(DLIB); \ + cp des.h $(INSTALLTOP)/include; \ + chmod 644 $(INSTALLTOP)/include/des.h; \ + else \ + echo Standalone install; \ + cp $(DLIB) $(LIBDIR)/$(DLIB); \ + if test -s /bin/ranlib; then \ + /bin/ranlib $(LIBDIR)/$(DLIB); \ + else \ + if test -s /usr/bin/ranlib; then \ + /usr/bin/ranlib $(LIBDIR)/$(DLIB); \ + fi; \ + fi; \ + chmod 644 $(LIBDIR)/$(DLIB); \ + cp des_crypt.man $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ + chmod 644 $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ + cp des.man $(MANDIR)/man$(MAN1)/des.$(MAN1); \ + chmod 644 $(MANDIR)/man$(MAN1)/des.$(MAN1); \ + cp des.h $(INCDIR)/des.h; \ + chmod 644 $(INCDIR)/des.h; \ + fi +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/des/Makefile.uni b/src/lib/libcrypto/des/Makefile.uni new file mode 100644 index 0000000000..8f1759748a --- /dev/null +++ b/src/lib/libcrypto/des/Makefile.uni @@ -0,0 +1,263 @@ +# You must select the correct terminal control system to be used to +# turn character echo off when reading passwords. There a 5 systems +# SGTTY - the old BSD system +# TERMIO - most system V boxes +# TERMIOS - SGI (ala IRIX). +# VMS - the DEC operating system +# MSDOS - we all know what it is :-) +# read_pwd.c makes a reasonable guess at what is correct. + +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +# If you are on a DEC Alpha, edit des.h and change the DES_LONG +# define to 'unsigned int'. I have seen this give a %20 speedup. + +OPTS0= -DRAND -DTERMIO #-DNOCONST + +# Version 1.94 has changed the strings_to_key function so that it is +# now compatible with MITs when the string is longer than 8 characters. +# If you wish to keep the old version, uncomment the following line. +# This will affect the -E/-D options on des(1). +#OPTS1= -DOLD_STR_TO_KEY + +# There are 4 possible performance options +# -DDES_PTR +# -DDES_RISC1 +# -DDES_RISC2 (only one of DES_RISC1 and DES_RISC2) +# -DDES_UNROLL +# after the initial build, run 'des_opts' to see which options are best +# for your platform. There are some listed in options.txt +#OPTS2= -DDES_PTR +#OPTS3= -DDES_RISC1 # or DES_RISC2 +#OPTS4= -DDES_UNROLL + +OPTS= $(OPTS0) $(OPTS1) $(OPTS2) $(OPTS3) $(OPTS4) + +MAKE=make -f Makefile +#CC=cc +#CFLAG= -O + +CC=gcc +#CFLAG= -O4 -funroll-loops -fomit-frame-pointer +CFLAG= -O3 -fomit-frame-pointer + +CFLAGS=$(OPTS) $(CFLAG) +CPP=$(CC) -E +AS=as + +# Assember version of des_encrypt*(). +DES_ENC=des_enc.o fcrypt_b.o # normal C version +#DES_ENC=asm/dx86-elf.o asm/yx86-elf.o # elf format x86 +#DES_ENC=asm/dx86-out.o asm/yx86-out.o # a.out format x86 +#DES_ENC=asm/dx86-sol.o asm/yx86-sol.o # solaris format x86 +#DES_ENC=asm/dx86bsdi.o asm/yx86basi.o # bsdi format x86 + +LIBDIR=/usr/local/lib +BINDIR=/usr/local/bin +INCDIR=/usr/local/include +MANDIR=/usr/local/man +MAN1=1 +MAN3=3 +SHELL=/bin/sh +OBJ_LIT=cbc_enc.o ecb_enc.o $(DES_ENC) fcrypt.o set_key.o +OBJ_FULL=cbc_cksm.o $(OBJ_LIT) pcbc_enc.o \ + xcbc_enc.o qud_cksm.o cbc3_enc.o \ + cfb64ede.o cfb64enc.o cfb_enc.o ecb3_enc.o \ + enc_read.o enc_writ.o ofb64ede.o ofb64enc.o ofb_enc.o \ + rand_key.o read_pwd.o read2pwd.o rpc_enc.o str2key.o supp.o + +GENERAL_LIT=COPYRIGHT INSTALL README VERSION Makefile des_crypt.man \ + des.doc options.txt asm +GENERAL_FULL=$(GENERAL_LIT) FILES Imakefile times vms.com KERBEROS MODES.DES \ + des.man DES.pm DES.pod DES.xs Makefile.PL dess.cpp des3s.cpp \ + Makefile.uni typemap t Makefile.ssl makefile.bc Makefile.lit \ + des.org des_locl.org +TESTING_LIT= destest speed des_opts +TESTING_FULL= rpw des $(TESTING_LIT) +TESTING_SRC_LIT=destest.c speed.c des_opts.c +TESTING_SRC_FULL=rpw.c des.c $(TESTING_SRC_LIT) +HEADERS_LIT=des_ver.h des.h des_locl.h podd.h sk.h spr.h +HEADERS_FULL= $(HEADERS_LIT) rpc_des.h +LIBDES_LIT=cbc_enc.c ecb_enc.c fcrypt.c set_key.c des_enc.c fcrypt_b.c +LIBDES_FULL= cbc_cksm.c pcbc_enc.c qud_cksm.c cbc3_enc.c \ + cfb64ede.c cfb64enc.c cfb_enc.c ecb3_enc.c \ + enc_read.c enc_writ.c ofb64ede.c ofb64enc.c ofb_enc.c \ + rand_key.c rpc_enc.c str2key.c supp.c \ + xcbc_enc.c $(LIBDES_LIT) read_pwd.c read2pwd.c + +PERL= des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl + +OBJ= $(OBJ_FULL) +GENERAL=$(GENERAL_FULL) +TESTING=$(TESTING_FULL) +TESTING_SRC=$(TESTING_SRC_FULL) +HEADERS=$(HEADERS_FULL) +LIBDES= $(LIBDES_FULL) + +ALL= $(GENERAL) $(TESTING_SRC) $(LIBDES) $(PERL) $(HEADERS) + +DLIB= libdes.a + +all: $(DLIB) $(TESTING) + +cc: + $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all + +gcc: + $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all + +x86-elf: + $(MAKE) DES_ENC='asm/dx86-elf.o asm/yx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all + +x86-out: + $(MAKE) DES_ENC='asm/dx86-out.o asm/yx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all + +x86-solaris: + $(MAKE) DES_ENC='asm/dx86-sol.o asm/yx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all + +x86-bsdi: + $(MAKE) DES_ENC='asm/dx86bsdi.o asm/yx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all + +# elf +asm/dx86-elf.o: asm/dx86unix.cpp + $(CPP) -DELF asm/dx86unix.cpp | $(AS) -o asm/dx86-elf.o + +asm/yx86-elf.o: asm/yx86unix.cpp + $(CPP) -DELF asm/yx86unix.cpp | $(AS) -o asm/yx86-elf.o + +# solaris +asm/dx86-sol.o: asm/dx86unix.cpp + $(CC) -E -DSOL asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s + as -o asm/dx86-sol.o asm/dx86-sol.s + rm -f asm/dx86-sol.s + +asm/yx86-sol.o: asm/yx86unix.cpp + $(CC) -E -DSOL asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s + as -o asm/yx86-sol.o asm/yx86-sol.s + rm -f asm/yx86-sol.s + +# a.out +asm/dx86-out.o: asm/dx86unix.cpp + $(CPP) -DOUT asm/dx86unix.cpp | $(AS) -o asm/dx86-out.o + +asm/yx86-out.o: asm/yx86unix.cpp + $(CPP) -DOUT asm/yx86unix.cpp | $(AS) -o asm/yx86-out.o + +# bsdi +asm/dx86bsdi.o: asm/dx86unix.cpp + $(CPP) -DBSDI asm/dx86unix.cpp | $(AS) -o asm/dx86bsdi.o + +asm/yx86bsdi.o: asm/yx86unix.cpp + $(CPP) -DBSDI asm/yx86unix.cpp | $(AS) -o asm/yx86bsdi.o + +asm/dx86unix.cpp: + (cd asm; perl des-586.pl cpp >dx86unix.cpp) + +asm/yx86unix.cpp: + (cd asm; perl crypt586.pl cpp >yx86unix.cpp) + +test: all + ./destest + +$(DLIB): $(OBJ) + /bin/rm -f $(DLIB) + ar cr $(DLIB) $(OBJ) + -if test -s /bin/ranlib; then /bin/ranlib $(DLIB); \ + else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(DLIB); \ + else exit 0; fi; fi + +des_opts: des_opts.o $(DLIB) + $(CC) $(CFLAGS) -o des_opts des_opts.o $(DLIB) + +destest: destest.o $(DLIB) + $(CC) $(CFLAGS) -o destest destest.o $(DLIB) + +rpw: rpw.o $(DLIB) + $(CC) $(CFLAGS) -o rpw rpw.o $(DLIB) + +speed: speed.o $(DLIB) + $(CC) $(CFLAGS) -o speed speed.o $(DLIB) + +des: des.o $(DLIB) + $(CC) $(CFLAGS) -o des des.o $(DLIB) + +tags: + ctags $(TESTING_SRC) $(LIBDES) + +tar_lit: + /bin/mv Makefile Makefile.tmp + /bin/cp Makefile.lit Makefile + for i in $(HEADERS_LIT) $(LIBDES_LIT) $(GENERAL_LIT) $(TESTING_SRC_LIT) ;\ + do \ + n="$$n des/$$i"; \ + done; \ + ( cd .. ; tar chf - $$n )| gzip > libdes-l.tgz + /bin/rm -f Makefile + /bin/mv Makefile.tmp Makefile + +tar: + mv Makefile Makefile.tmp + /bin/cp Makefile.uni Makefile + for i in $(ALL) ;\ + do \ + n="$$n des/$$i"; \ + done; \ + ( cd .. ; tar chf - $$n )| gzip > libdes.tgz + /bin/rm -f Makefile + /bin/mv Makefile.tmp Makefile + +shar: + shar $(ALL) >libdes.shar + +depend: + makedepend $(LIBDES) $(TESTING_SRC) + +clean: + /bin/rm -f *.o tags core $(TESTING) $(DLIB) .nfs* *.old *.bak asm/*.o + +dclean: + sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new + mv -f Makefile.new Makefile + +# Eric is probably going to choke when he next looks at this --tjh +install: des + if test $(INSTALLTOP); then \ + echo SSL style install; \ + cp $(DLIB) $(INSTALLTOP)/lib; \ + if test -s /bin/ranlib; then \ + /bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ + else \ + if test -s /usr/bin/ranlib; then \ + /usr/bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ + fi; fi; \ + chmod 644 $(INSTALLTOP)/lib/$(DLIB); \ + cp des.h $(INSTALLTOP)/include; \ + chmod 644 $(INSTALLTOP)/include/des.h; \ + else \ + echo Standalone install; \ + cp $(DLIB) $(LIBDIR)/$(DLIB); \ + if test -s /bin/ranlib; then \ + /bin/ranlib $(LIBDIR)/$(DLIB); \ + else \ + if test -s /usr/bin/ranlib; then \ + /usr/bin/ranlib $(LIBDIR)/$(DLIB); \ + fi; \ + fi; \ + chmod 644 $(LIBDIR)/$(DLIB); \ + cp des $(BINDIR)/des; \ + chmod 711 $(BINDIR)/des; \ + cp des_crypt.man $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ + chmod 644 $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ + cp des.man $(MANDIR)/man$(MAN1)/des.$(MAN1); \ + chmod 644 $(MANDIR)/man$(MAN1)/des.$(MAN1); \ + cp des.h $(INCDIR)/des.h; \ + chmod 644 $(INCDIR)/des.h; \ + fi +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/des/PC1 b/src/lib/libcrypto/des/PC1 new file mode 100644 index 0000000000..efb8348b72 --- /dev/null +++ b/src/lib/libcrypto/des/PC1 @@ -0,0 +1,28 @@ +#!/usr/local/bin/perl + +@PC1=( 57,49,41,33,25,17, 9, + 1,58,50,42,34,26,18, + 10, 2,59,51,43,35,27, + 19,11, 3,60,52,44,36, + "-","-","-","-", + 63,55,47,39,31,23,15, + 7,62,54,46,38,30,22, + 14, 6,61,53,45,37,29, + 21,13, 5,28,20,12, 4, + "-","-","-","-", + ); + +foreach (@PC1) + { + if ($_ ne "-") + { + $_--; + $_=int($_/8)*8+7-($_%8); + printf "%2d ",$_; + } + else + { print "-- "; } + print "\n" if (((++$i) % 8) == 0); + print "\n" if ((($i) % 32) == 0); + } + diff --git a/src/lib/libcrypto/des/PC2 b/src/lib/libcrypto/des/PC2 new file mode 100644 index 0000000000..2d560270ec --- /dev/null +++ b/src/lib/libcrypto/des/PC2 @@ -0,0 +1,57 @@ +#!/usr/local/bin/perl + +@PC2_C=(14,17,11,24, 1, 5, + 3,28,15, 6,21,10, + 23,19,12, 4,26, 8, + 16, 7,27,20,13, 2, + ); + +@PC2_D=(41,52,31,37,47,55, + 30,40,51,45,33,48, + 44,49,39,56,34,53, + 46,42,50,36,29,32, + ); + +foreach (@PC2_C) { + if ($_ ne "-") + { + $_--; + printf "%2d ",$_; } + else { print "-- "; } + $C{$_}=1; + print "\n" if (((++$i) % 8) == 0); + } +$i=0; +print "\n"; +foreach (@PC2_D) { + if ($_ ne "-") + { + $_-=29; + printf "%2d ",$_; } + else { print "-- "; } + $D{$_}=1; + print "\n" if (((++$i) % 8) == 0); } + +print "\n"; +foreach $i (0 .. 27) + { + $_=$C{$i}; + if ($_ ne "-") {printf "%2d ",$_;} + else { print "-- "; } + print "\n" if (((++$i) % 8) == 0); + } +print "\n"; + +print "\n"; +foreach $i (0 .. 27) + { + $_=$D{$i}; + if ($_ ne "-") {printf "%2d ",$_;} + else { print "-- "; } + print "\n" if (((++$i) % 8) == 0); + } +print "\n"; +sub numsort + { + $a-$b; + } diff --git a/src/lib/libcrypto/des/asm/d-win32.asm b/src/lib/libcrypto/des/asm/d-win32.asm new file mode 100644 index 0000000000..9e3dc9cd87 --- /dev/null +++ b/src/lib/libcrypto/des/asm/d-win32.asm @@ -0,0 +1,3132 @@ + ; Don't even think of reading this code + ; It was automatically generated by des-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE des-586.asm + .386 +.model FLAT +_TEXT SEGMENT +PUBLIC _des_encrypt +EXTRN _des_SPtrans:DWORD +_des_encrypt PROC NEAR + push esi + push edi + ; + ; Load the 2 words + mov esi, DWORD PTR 12[esp] + xor ecx, ecx + push ebx + push ebp + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 28[esp] + mov edi, DWORD PTR 4[esi] + ; + ; IP + rol eax, 4 + mov esi, eax + xor eax, edi + and eax, 0f0f0f0f0h + xor esi, eax + xor edi, eax + ; + rol edi, 20 + mov eax, edi + xor edi, esi + and edi, 0fff0000fh + xor eax, edi + xor esi, edi + ; + rol eax, 14 + mov edi, eax + xor eax, esi + and eax, 033333333h + xor edi, eax + xor esi, eax + ; + rol esi, 22 + mov eax, esi + xor esi, edi + and esi, 003fc03fch + xor eax, esi + xor edi, esi + ; + rol eax, 9 + mov esi, eax + xor eax, edi + and eax, 0aaaaaaaah + xor esi, eax + xor edi, eax + ; + rol edi, 1 + mov ebp, DWORD PTR 24[esp] + cmp ebx, 0 + je $L000start_decrypt + ; + ; Round 0 + mov eax, DWORD PTR [ebp] + xor ebx, ebx + mov edx, DWORD PTR 4[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 1 + mov eax, DWORD PTR 8[ebp] + xor ebx, ebx + mov edx, DWORD PTR 12[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 2 + mov eax, DWORD PTR 16[ebp] + xor ebx, ebx + mov edx, DWORD PTR 20[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 3 + mov eax, DWORD PTR 24[ebp] + xor ebx, ebx + mov edx, DWORD PTR 28[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 4 + mov eax, DWORD PTR 32[ebp] + xor ebx, ebx + mov edx, DWORD PTR 36[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 5 + mov eax, DWORD PTR 40[ebp] + xor ebx, ebx + mov edx, DWORD PTR 44[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 6 + mov eax, DWORD PTR 48[ebp] + xor ebx, ebx + mov edx, DWORD PTR 52[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 7 + mov eax, DWORD PTR 56[ebp] + xor ebx, ebx + mov edx, DWORD PTR 60[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 8 + mov eax, DWORD PTR 64[ebp] + xor ebx, ebx + mov edx, DWORD PTR 68[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 9 + mov eax, DWORD PTR 72[ebp] + xor ebx, ebx + mov edx, DWORD PTR 76[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 10 + mov eax, DWORD PTR 80[ebp] + xor ebx, ebx + mov edx, DWORD PTR 84[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 11 + mov eax, DWORD PTR 88[ebp] + xor ebx, ebx + mov edx, DWORD PTR 92[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 12 + mov eax, DWORD PTR 96[ebp] + xor ebx, ebx + mov edx, DWORD PTR 100[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 13 + mov eax, DWORD PTR 104[ebp] + xor ebx, ebx + mov edx, DWORD PTR 108[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 14 + mov eax, DWORD PTR 112[ebp] + xor ebx, ebx + mov edx, DWORD PTR 116[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 15 + mov eax, DWORD PTR 120[ebp] + xor ebx, ebx + mov edx, DWORD PTR 124[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + jmp $L001end +$L000start_decrypt: + ; + ; Round 15 + mov eax, DWORD PTR 120[ebp] + xor ebx, ebx + mov edx, DWORD PTR 124[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 14 + mov eax, DWORD PTR 112[ebp] + xor ebx, ebx + mov edx, DWORD PTR 116[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 13 + mov eax, DWORD PTR 104[ebp] + xor ebx, ebx + mov edx, DWORD PTR 108[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 12 + mov eax, DWORD PTR 96[ebp] + xor ebx, ebx + mov edx, DWORD PTR 100[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 11 + mov eax, DWORD PTR 88[ebp] + xor ebx, ebx + mov edx, DWORD PTR 92[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 10 + mov eax, DWORD PTR 80[ebp] + xor ebx, ebx + mov edx, DWORD PTR 84[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 9 + mov eax, DWORD PTR 72[ebp] + xor ebx, ebx + mov edx, DWORD PTR 76[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 8 + mov eax, DWORD PTR 64[ebp] + xor ebx, ebx + mov edx, DWORD PTR 68[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 7 + mov eax, DWORD PTR 56[ebp] + xor ebx, ebx + mov edx, DWORD PTR 60[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 6 + mov eax, DWORD PTR 48[ebp] + xor ebx, ebx + mov edx, DWORD PTR 52[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 5 + mov eax, DWORD PTR 40[ebp] + xor ebx, ebx + mov edx, DWORD PTR 44[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 4 + mov eax, DWORD PTR 32[ebp] + xor ebx, ebx + mov edx, DWORD PTR 36[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 3 + mov eax, DWORD PTR 24[ebp] + xor ebx, ebx + mov edx, DWORD PTR 28[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 2 + mov eax, DWORD PTR 16[ebp] + xor ebx, ebx + mov edx, DWORD PTR 20[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 1 + mov eax, DWORD PTR 8[ebp] + xor ebx, ebx + mov edx, DWORD PTR 12[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 0 + mov eax, DWORD PTR [ebp] + xor ebx, ebx + mov edx, DWORD PTR 4[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx +$L001end: + ; + ; FP + mov edx, DWORD PTR 20[esp] + ror esi, 1 + mov eax, edi + xor edi, esi + and edi, 0aaaaaaaah + xor eax, edi + xor esi, edi + ; + rol eax, 23 + mov edi, eax + xor eax, esi + and eax, 003fc03fch + xor edi, eax + xor esi, eax + ; + rol edi, 10 + mov eax, edi + xor edi, esi + and edi, 033333333h + xor eax, edi + xor esi, edi + ; + rol esi, 18 + mov edi, esi + xor esi, eax + and esi, 0fff0000fh + xor edi, esi + xor eax, esi + ; + rol edi, 12 + mov esi, edi + xor edi, eax + and edi, 0f0f0f0f0h + xor esi, edi + xor eax, edi + ; + ror eax, 4 + mov DWORD PTR [edx],eax + mov DWORD PTR 4[edx],esi + pop ebp + pop ebx + pop edi + pop esi + ret +_des_encrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _des_encrypt2 +EXTRN _des_SPtrans:DWORD +_des_encrypt2 PROC NEAR + push esi + push edi + ; + ; Load the 2 words + mov eax, DWORD PTR 12[esp] + xor ecx, ecx + push ebx + push ebp + mov esi, DWORD PTR [eax] + mov ebx, DWORD PTR 28[esp] + rol esi, 3 + mov edi, DWORD PTR 4[eax] + rol edi, 3 + mov ebp, DWORD PTR 24[esp] + cmp ebx, 0 + je $L002start_decrypt + ; + ; Round 0 + mov eax, DWORD PTR [ebp] + xor ebx, ebx + mov edx, DWORD PTR 4[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 1 + mov eax, DWORD PTR 8[ebp] + xor ebx, ebx + mov edx, DWORD PTR 12[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 2 + mov eax, DWORD PTR 16[ebp] + xor ebx, ebx + mov edx, DWORD PTR 20[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 3 + mov eax, DWORD PTR 24[ebp] + xor ebx, ebx + mov edx, DWORD PTR 28[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 4 + mov eax, DWORD PTR 32[ebp] + xor ebx, ebx + mov edx, DWORD PTR 36[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 5 + mov eax, DWORD PTR 40[ebp] + xor ebx, ebx + mov edx, DWORD PTR 44[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 6 + mov eax, DWORD PTR 48[ebp] + xor ebx, ebx + mov edx, DWORD PTR 52[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 7 + mov eax, DWORD PTR 56[ebp] + xor ebx, ebx + mov edx, DWORD PTR 60[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 8 + mov eax, DWORD PTR 64[ebp] + xor ebx, ebx + mov edx, DWORD PTR 68[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 9 + mov eax, DWORD PTR 72[ebp] + xor ebx, ebx + mov edx, DWORD PTR 76[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 10 + mov eax, DWORD PTR 80[ebp] + xor ebx, ebx + mov edx, DWORD PTR 84[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 11 + mov eax, DWORD PTR 88[ebp] + xor ebx, ebx + mov edx, DWORD PTR 92[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 12 + mov eax, DWORD PTR 96[ebp] + xor ebx, ebx + mov edx, DWORD PTR 100[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 13 + mov eax, DWORD PTR 104[ebp] + xor ebx, ebx + mov edx, DWORD PTR 108[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 14 + mov eax, DWORD PTR 112[ebp] + xor ebx, ebx + mov edx, DWORD PTR 116[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 15 + mov eax, DWORD PTR 120[ebp] + xor ebx, ebx + mov edx, DWORD PTR 124[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + jmp $L003end +$L002start_decrypt: + ; + ; Round 15 + mov eax, DWORD PTR 120[ebp] + xor ebx, ebx + mov edx, DWORD PTR 124[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 14 + mov eax, DWORD PTR 112[ebp] + xor ebx, ebx + mov edx, DWORD PTR 116[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 13 + mov eax, DWORD PTR 104[ebp] + xor ebx, ebx + mov edx, DWORD PTR 108[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 12 + mov eax, DWORD PTR 96[ebp] + xor ebx, ebx + mov edx, DWORD PTR 100[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 11 + mov eax, DWORD PTR 88[ebp] + xor ebx, ebx + mov edx, DWORD PTR 92[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 10 + mov eax, DWORD PTR 80[ebp] + xor ebx, ebx + mov edx, DWORD PTR 84[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 9 + mov eax, DWORD PTR 72[ebp] + xor ebx, ebx + mov edx, DWORD PTR 76[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 8 + mov eax, DWORD PTR 64[ebp] + xor ebx, ebx + mov edx, DWORD PTR 68[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 7 + mov eax, DWORD PTR 56[ebp] + xor ebx, ebx + mov edx, DWORD PTR 60[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 6 + mov eax, DWORD PTR 48[ebp] + xor ebx, ebx + mov edx, DWORD PTR 52[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 5 + mov eax, DWORD PTR 40[ebp] + xor ebx, ebx + mov edx, DWORD PTR 44[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 4 + mov eax, DWORD PTR 32[ebp] + xor ebx, ebx + mov edx, DWORD PTR 36[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 3 + mov eax, DWORD PTR 24[ebp] + xor ebx, ebx + mov edx, DWORD PTR 28[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 2 + mov eax, DWORD PTR 16[ebp] + xor ebx, ebx + mov edx, DWORD PTR 20[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 1 + mov eax, DWORD PTR 8[ebp] + xor ebx, ebx + mov edx, DWORD PTR 12[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 0 + mov eax, DWORD PTR [ebp] + xor ebx, ebx + mov edx, DWORD PTR 4[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx +$L003end: + ; + ; Fixup + ror edi, 3 + mov eax, DWORD PTR 20[esp] + ror esi, 3 + mov DWORD PTR [eax],edi + mov DWORD PTR 4[eax],esi + pop ebp + pop ebx + pop edi + pop esi + ret +_des_encrypt2 ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _des_encrypt3 + +_des_encrypt3 PROC NEAR + push ebx + mov ebx, DWORD PTR 8[esp] + push ebp + push esi + push edi + ; + ; Load the data words + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + sub esp, 12 + ; + ; IP + rol edi, 4 + mov edx, edi + xor edi, esi + and edi, 0f0f0f0f0h + xor edx, edi + xor esi, edi + ; + rol esi, 20 + mov edi, esi + xor esi, edx + and esi, 0fff0000fh + xor edi, esi + xor edx, esi + ; + rol edi, 14 + mov esi, edi + xor edi, edx + and edi, 033333333h + xor esi, edi + xor edx, edi + ; + rol edx, 22 + mov edi, edx + xor edx, esi + and edx, 003fc03fch + xor edi, edx + xor esi, edx + ; + rol edi, 9 + mov edx, edi + xor edi, esi + and edi, 0aaaaaaaah + xor edx, edi + xor esi, edi + ; + ror edx, 3 + ror esi, 2 + mov DWORD PTR 4[ebx],esi + mov eax, DWORD PTR 36[esp] + mov DWORD PTR [ebx],edx + mov edi, DWORD PTR 40[esp] + mov esi, DWORD PTR 44[esp] + mov DWORD PTR 8[esp],1 + mov DWORD PTR 4[esp],eax + mov DWORD PTR [esp],ebx + call _des_encrypt2 + mov DWORD PTR 8[esp],0 + mov DWORD PTR 4[esp],edi + mov DWORD PTR [esp],ebx + call _des_encrypt2 + mov DWORD PTR 8[esp],1 + mov DWORD PTR 4[esp],esi + mov DWORD PTR [esp],ebx + call _des_encrypt2 + add esp, 12 + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + ; + ; FP + rol esi, 2 + rol edi, 3 + mov eax, edi + xor edi, esi + and edi, 0aaaaaaaah + xor eax, edi + xor esi, edi + ; + rol eax, 23 + mov edi, eax + xor eax, esi + and eax, 003fc03fch + xor edi, eax + xor esi, eax + ; + rol edi, 10 + mov eax, edi + xor edi, esi + and edi, 033333333h + xor eax, edi + xor esi, edi + ; + rol esi, 18 + mov edi, esi + xor esi, eax + and esi, 0fff0000fh + xor edi, esi + xor eax, esi + ; + rol edi, 12 + mov esi, edi + xor edi, eax + and edi, 0f0f0f0f0h + xor esi, edi + xor eax, edi + ; + ror eax, 4 + mov DWORD PTR [ebx],eax + mov DWORD PTR 4[ebx],esi + pop edi + pop esi + pop ebp + pop ebx + ret +_des_encrypt3 ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _des_decrypt3 + +_des_decrypt3 PROC NEAR + push ebx + mov ebx, DWORD PTR 8[esp] + push ebp + push esi + push edi + ; + ; Load the data words + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + sub esp, 12 + ; + ; IP + rol edi, 4 + mov edx, edi + xor edi, esi + and edi, 0f0f0f0f0h + xor edx, edi + xor esi, edi + ; + rol esi, 20 + mov edi, esi + xor esi, edx + and esi, 0fff0000fh + xor edi, esi + xor edx, esi + ; + rol edi, 14 + mov esi, edi + xor edi, edx + and edi, 033333333h + xor esi, edi + xor edx, edi + ; + rol edx, 22 + mov edi, edx + xor edx, esi + and edx, 003fc03fch + xor edi, edx + xor esi, edx + ; + rol edi, 9 + mov edx, edi + xor edi, esi + and edi, 0aaaaaaaah + xor edx, edi + xor esi, edi + ; + ror edx, 3 + ror esi, 2 + mov DWORD PTR 4[ebx],esi + mov esi, DWORD PTR 36[esp] + mov DWORD PTR [ebx],edx + mov edi, DWORD PTR 40[esp] + mov eax, DWORD PTR 44[esp] + mov DWORD PTR 8[esp],0 + mov DWORD PTR 4[esp],eax + mov DWORD PTR [esp],ebx + call _des_encrypt2 + mov DWORD PTR 8[esp],1 + mov DWORD PTR 4[esp],edi + mov DWORD PTR [esp],ebx + call _des_encrypt2 + mov DWORD PTR 8[esp],0 + mov DWORD PTR 4[esp],esi + mov DWORD PTR [esp],ebx + call _des_encrypt2 + add esp, 12 + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + ; + ; FP + rol esi, 2 + rol edi, 3 + mov eax, edi + xor edi, esi + and edi, 0aaaaaaaah + xor eax, edi + xor esi, edi + ; + rol eax, 23 + mov edi, eax + xor eax, esi + and eax, 003fc03fch + xor edi, eax + xor esi, eax + ; + rol edi, 10 + mov eax, edi + xor edi, esi + and edi, 033333333h + xor eax, edi + xor esi, edi + ; + rol esi, 18 + mov edi, esi + xor esi, eax + and esi, 0fff0000fh + xor edi, esi + xor eax, esi + ; + rol edi, 12 + mov esi, edi + xor edi, eax + and edi, 0f0f0f0f0h + xor esi, edi + xor eax, edi + ; + ror eax, 4 + mov DWORD PTR [ebx],eax + mov DWORD PTR 4[ebx],esi + pop edi + pop esi + pop ebp + pop ebx + ret +_des_decrypt3 ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _des_ncbc_encrypt + +_des_ncbc_encrypt PROC NEAR + ; + push ebp + push ebx + push esi + push edi + mov ebp, DWORD PTR 28[esp] + ; getting iv ptr from parameter 4 + mov ebx, DWORD PTR 36[esp] + mov esi, DWORD PTR [ebx] + mov edi, DWORD PTR 4[ebx] + push edi + push esi + push edi + push esi + mov ebx, esp + mov esi, DWORD PTR 36[esp] + mov edi, DWORD PTR 40[esp] + ; getting encrypt flag from parameter 5 + mov ecx, DWORD PTR 56[esp] + ; get and push parameter 5 + push ecx + ; get and push parameter 3 + mov eax, DWORD PTR 52[esp] + push eax + push ebx + cmp ecx, 0 + jz $L004decrypt + and ebp, 4294967288 + mov eax, DWORD PTR 12[esp] + mov ebx, DWORD PTR 16[esp] + jz $L005encrypt_finish +L006encrypt_loop: + mov ecx, DWORD PTR [esi] + mov edx, DWORD PTR 4[esi] + xor eax, ecx + xor ebx, edx + mov DWORD PTR 12[esp],eax + mov DWORD PTR 16[esp],ebx + call _des_encrypt + mov eax, DWORD PTR 12[esp] + mov ebx, DWORD PTR 16[esp] + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L006encrypt_loop +$L005encrypt_finish: + mov ebp, DWORD PTR 56[esp] + and ebp, 7 + jz $L007finish + xor ecx, ecx + xor edx, edx + mov ebp, DWORD PTR $L008cbc_enc_jmp_table[ebp*4] + jmp ebp +L009ej7: + mov dh, BYTE PTR 6[esi] + shl edx, 8 +L010ej6: + mov dh, BYTE PTR 5[esi] +L011ej5: + mov dl, BYTE PTR 4[esi] +L012ej4: + mov ecx, DWORD PTR [esi] + jmp $L013ejend +L014ej3: + mov ch, BYTE PTR 2[esi] + shl ecx, 8 +L015ej2: + mov ch, BYTE PTR 1[esi] +L016ej1: + mov cl, BYTE PTR [esi] +$L013ejend: + xor eax, ecx + xor ebx, edx + mov DWORD PTR 12[esp],eax + mov DWORD PTR 16[esp],ebx + call _des_encrypt + mov eax, DWORD PTR 12[esp] + mov ebx, DWORD PTR 16[esp] + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + jmp $L007finish +$L004decrypt: + and ebp, 4294967288 + mov eax, DWORD PTR 20[esp] + mov ebx, DWORD PTR 24[esp] + jz $L017decrypt_finish +L018decrypt_loop: + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR 12[esp],eax + mov DWORD PTR 16[esp],ebx + call _des_encrypt + mov eax, DWORD PTR 12[esp] + mov ebx, DWORD PTR 16[esp] + mov ecx, DWORD PTR 20[esp] + mov edx, DWORD PTR 24[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR [edi],ecx + mov DWORD PTR 4[edi],edx + mov DWORD PTR 20[esp],eax + mov DWORD PTR 24[esp],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L018decrypt_loop +$L017decrypt_finish: + mov ebp, DWORD PTR 56[esp] + and ebp, 7 + jz $L007finish + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR 12[esp],eax + mov DWORD PTR 16[esp],ebx + call _des_encrypt + mov eax, DWORD PTR 12[esp] + mov ebx, DWORD PTR 16[esp] + mov ecx, DWORD PTR 20[esp] + mov edx, DWORD PTR 24[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] +L019dj7: + ror edx, 16 + mov BYTE PTR 6[edi],dl + shr edx, 16 +L020dj6: + mov BYTE PTR 5[edi],dh +L021dj5: + mov BYTE PTR 4[edi],dl +L022dj4: + mov DWORD PTR [edi],ecx + jmp $L023djend +L024dj3: + ror ecx, 16 + mov BYTE PTR 2[edi],cl + shl ecx, 16 +L025dj2: + mov BYTE PTR 1[esi],ch +L026dj1: + mov BYTE PTR [esi], cl +$L023djend: + jmp $L007finish +$L007finish: + mov ecx, DWORD PTR 64[esp] + add esp, 28 + mov DWORD PTR [ecx],eax + mov DWORD PTR 4[ecx],ebx + pop edi + pop esi + pop ebx + pop ebp + ret +$L008cbc_enc_jmp_table: + DD 0 + DD L016ej1 + DD L015ej2 + DD L014ej3 + DD L012ej4 + DD L011ej5 + DD L010ej6 + DD L009ej7 +L027cbc_dec_jmp_table: + DD 0 + DD L026dj1 + DD L025dj2 + DD L024dj3 + DD L022dj4 + DD L021dj5 + DD L020dj6 + DD L019dj7 +_des_ncbc_encrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _des_ede3_cbc_encrypt + +_des_ede3_cbc_encrypt PROC NEAR + ; + push ebp + push ebx + push esi + push edi + mov ebp, DWORD PTR 28[esp] + ; getting iv ptr from parameter 6 + mov ebx, DWORD PTR 44[esp] + mov esi, DWORD PTR [ebx] + mov edi, DWORD PTR 4[ebx] + push edi + push esi + push edi + push esi + mov ebx, esp + mov esi, DWORD PTR 36[esp] + mov edi, DWORD PTR 40[esp] + ; getting encrypt flag from parameter 7 + mov ecx, DWORD PTR 64[esp] + ; get and push parameter 5 + mov eax, DWORD PTR 56[esp] + push eax + ; get and push parameter 4 + mov eax, DWORD PTR 56[esp] + push eax + ; get and push parameter 3 + mov eax, DWORD PTR 56[esp] + push eax + push ebx + cmp ecx, 0 + jz $L028decrypt + and ebp, 4294967288 + mov eax, DWORD PTR 16[esp] + mov ebx, DWORD PTR 20[esp] + jz $L029encrypt_finish +L030encrypt_loop: + mov ecx, DWORD PTR [esi] + mov edx, DWORD PTR 4[esi] + xor eax, ecx + xor ebx, edx + mov DWORD PTR 16[esp],eax + mov DWORD PTR 20[esp],ebx + call _des_encrypt3 + mov eax, DWORD PTR 16[esp] + mov ebx, DWORD PTR 20[esp] + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L030encrypt_loop +$L029encrypt_finish: + mov ebp, DWORD PTR 60[esp] + and ebp, 7 + jz $L031finish + xor ecx, ecx + xor edx, edx + mov ebp, DWORD PTR $L032cbc_enc_jmp_table[ebp*4] + jmp ebp +L033ej7: + mov dh, BYTE PTR 6[esi] + shl edx, 8 +L034ej6: + mov dh, BYTE PTR 5[esi] +L035ej5: + mov dl, BYTE PTR 4[esi] +L036ej4: + mov ecx, DWORD PTR [esi] + jmp $L037ejend +L038ej3: + mov ch, BYTE PTR 2[esi] + shl ecx, 8 +L039ej2: + mov ch, BYTE PTR 1[esi] +L040ej1: + mov cl, BYTE PTR [esi] +$L037ejend: + xor eax, ecx + xor ebx, edx + mov DWORD PTR 16[esp],eax + mov DWORD PTR 20[esp],ebx + call _des_encrypt3 + mov eax, DWORD PTR 16[esp] + mov ebx, DWORD PTR 20[esp] + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + jmp $L031finish +$L028decrypt: + and ebp, 4294967288 + mov eax, DWORD PTR 24[esp] + mov ebx, DWORD PTR 28[esp] + jz $L041decrypt_finish +L042decrypt_loop: + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR 16[esp],eax + mov DWORD PTR 20[esp],ebx + call _des_decrypt3 + mov eax, DWORD PTR 16[esp] + mov ebx, DWORD PTR 20[esp] + mov ecx, DWORD PTR 24[esp] + mov edx, DWORD PTR 28[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR [edi],ecx + mov DWORD PTR 4[edi],edx + mov DWORD PTR 24[esp],eax + mov DWORD PTR 28[esp],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L042decrypt_loop +$L041decrypt_finish: + mov ebp, DWORD PTR 60[esp] + and ebp, 7 + jz $L031finish + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR 16[esp],eax + mov DWORD PTR 20[esp],ebx + call _des_decrypt3 + mov eax, DWORD PTR 16[esp] + mov ebx, DWORD PTR 20[esp] + mov ecx, DWORD PTR 24[esp] + mov edx, DWORD PTR 28[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] +L043dj7: + ror edx, 16 + mov BYTE PTR 6[edi],dl + shr edx, 16 +L044dj6: + mov BYTE PTR 5[edi],dh +L045dj5: + mov BYTE PTR 4[edi],dl +L046dj4: + mov DWORD PTR [edi],ecx + jmp $L047djend +L048dj3: + ror ecx, 16 + mov BYTE PTR 2[edi],cl + shl ecx, 16 +L049dj2: + mov BYTE PTR 1[esi],ch +L050dj1: + mov BYTE PTR [esi], cl +$L047djend: + jmp $L031finish +$L031finish: + mov ecx, DWORD PTR 76[esp] + add esp, 32 + mov DWORD PTR [ecx],eax + mov DWORD PTR 4[ecx],ebx + pop edi + pop esi + pop ebx + pop ebp + ret +$L032cbc_enc_jmp_table: + DD 0 + DD L040ej1 + DD L039ej2 + DD L038ej3 + DD L036ej4 + DD L035ej5 + DD L034ej6 + DD L033ej7 +L051cbc_dec_jmp_table: + DD 0 + DD L050dj1 + DD L049dj2 + DD L048dj3 + DD L046dj4 + DD L045dj5 + DD L044dj6 + DD L043dj7 +_des_ede3_cbc_encrypt ENDP +_TEXT ENDS +END diff --git a/src/lib/libcrypto/des/asm/dx86unix.cpp b/src/lib/libcrypto/des/asm/dx86unix.cpp new file mode 100644 index 0000000000..6fca9afa16 --- /dev/null +++ b/src/lib/libcrypto/des/asm/dx86unix.cpp @@ -0,0 +1,3202 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define des_SPtrans _des_SPtrans +#define des_encrypt _des_encrypt +#define des_encrypt2 _des_encrypt2 +#define des_encrypt3 _des_encrypt3 +#define des_decrypt3 _des_decrypt3 +#define des_ncbc_encrypt _des_ncbc_encrypt +#define des_ede3_cbc_encrypt _des_ede3_cbc_encrypt + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by des-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "des-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl des_encrypt + TYPE(des_encrypt,@function) +des_encrypt: + pushl %esi + pushl %edi + + /* Load the 2 words */ + movl 12(%esp), %esi + xorl %ecx, %ecx + pushl %ebx + pushl %ebp + movl (%esi), %eax + movl 28(%esp), %ebx + movl 4(%esi), %edi + + /* IP */ + roll $4, %eax + movl %eax, %esi + xorl %edi, %eax + andl $0xf0f0f0f0, %eax + xorl %eax, %esi + xorl %eax, %edi + + roll $20, %edi + movl %edi, %eax + xorl %esi, %edi + andl $0xfff0000f, %edi + xorl %edi, %eax + xorl %edi, %esi + + roll $14, %eax + movl %eax, %edi + xorl %esi, %eax + andl $0x33333333, %eax + xorl %eax, %edi + xorl %eax, %esi + + roll $22, %esi + movl %esi, %eax + xorl %edi, %esi + andl $0x03fc03fc, %esi + xorl %esi, %eax + xorl %esi, %edi + + roll $9, %eax + movl %eax, %esi + xorl %edi, %eax + andl $0xaaaaaaaa, %eax + xorl %eax, %esi + xorl %eax, %edi + +.byte 209 +.byte 199 /* roll $1 %edi */ + movl 24(%esp), %ebp + cmpl $0, %ebx + je .L000start_decrypt + + /* Round 0 */ + movl (%ebp), %eax + xorl %ebx, %ebx + movl 4(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 1 */ + movl 8(%ebp), %eax + xorl %ebx, %ebx + movl 12(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 2 */ + movl 16(%ebp), %eax + xorl %ebx, %ebx + movl 20(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 3 */ + movl 24(%ebp), %eax + xorl %ebx, %ebx + movl 28(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 4 */ + movl 32(%ebp), %eax + xorl %ebx, %ebx + movl 36(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 5 */ + movl 40(%ebp), %eax + xorl %ebx, %ebx + movl 44(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 6 */ + movl 48(%ebp), %eax + xorl %ebx, %ebx + movl 52(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 7 */ + movl 56(%ebp), %eax + xorl %ebx, %ebx + movl 60(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 8 */ + movl 64(%ebp), %eax + xorl %ebx, %ebx + movl 68(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 9 */ + movl 72(%ebp), %eax + xorl %ebx, %ebx + movl 76(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 10 */ + movl 80(%ebp), %eax + xorl %ebx, %ebx + movl 84(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 11 */ + movl 88(%ebp), %eax + xorl %ebx, %ebx + movl 92(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 12 */ + movl 96(%ebp), %eax + xorl %ebx, %ebx + movl 100(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 13 */ + movl 104(%ebp), %eax + xorl %ebx, %ebx + movl 108(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 14 */ + movl 112(%ebp), %eax + xorl %ebx, %ebx + movl 116(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 15 */ + movl 120(%ebp), %eax + xorl %ebx, %ebx + movl 124(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + jmp .L001end +.L000start_decrypt: + + /* Round 15 */ + movl 120(%ebp), %eax + xorl %ebx, %ebx + movl 124(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 14 */ + movl 112(%ebp), %eax + xorl %ebx, %ebx + movl 116(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 13 */ + movl 104(%ebp), %eax + xorl %ebx, %ebx + movl 108(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 12 */ + movl 96(%ebp), %eax + xorl %ebx, %ebx + movl 100(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 11 */ + movl 88(%ebp), %eax + xorl %ebx, %ebx + movl 92(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 10 */ + movl 80(%ebp), %eax + xorl %ebx, %ebx + movl 84(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 9 */ + movl 72(%ebp), %eax + xorl %ebx, %ebx + movl 76(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 8 */ + movl 64(%ebp), %eax + xorl %ebx, %ebx + movl 68(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 7 */ + movl 56(%ebp), %eax + xorl %ebx, %ebx + movl 60(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 6 */ + movl 48(%ebp), %eax + xorl %ebx, %ebx + movl 52(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 5 */ + movl 40(%ebp), %eax + xorl %ebx, %ebx + movl 44(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 4 */ + movl 32(%ebp), %eax + xorl %ebx, %ebx + movl 36(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 3 */ + movl 24(%ebp), %eax + xorl %ebx, %ebx + movl 28(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 2 */ + movl 16(%ebp), %eax + xorl %ebx, %ebx + movl 20(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 1 */ + movl 8(%ebp), %eax + xorl %ebx, %ebx + movl 12(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 0 */ + movl (%ebp), %eax + xorl %ebx, %ebx + movl 4(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi +.L001end: + + /* FP */ + movl 20(%esp), %edx +.byte 209 +.byte 206 /* rorl $1 %esi */ + movl %edi, %eax + xorl %esi, %edi + andl $0xaaaaaaaa, %edi + xorl %edi, %eax + xorl %edi, %esi + + roll $23, %eax + movl %eax, %edi + xorl %esi, %eax + andl $0x03fc03fc, %eax + xorl %eax, %edi + xorl %eax, %esi + + roll $10, %edi + movl %edi, %eax + xorl %esi, %edi + andl $0x33333333, %edi + xorl %edi, %eax + xorl %edi, %esi + + roll $18, %esi + movl %esi, %edi + xorl %eax, %esi + andl $0xfff0000f, %esi + xorl %esi, %edi + xorl %esi, %eax + + roll $12, %edi + movl %edi, %esi + xorl %eax, %edi + andl $0xf0f0f0f0, %edi + xorl %edi, %esi + xorl %edi, %eax + + rorl $4, %eax + movl %eax, (%edx) + movl %esi, 4(%edx) + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +.des_encrypt_end: + SIZE(des_encrypt,.des_encrypt_end-des_encrypt) +.ident "desasm.pl" +.text + .align ALIGN +.globl des_encrypt2 + TYPE(des_encrypt2,@function) +des_encrypt2: + pushl %esi + pushl %edi + + /* Load the 2 words */ + movl 12(%esp), %eax + xorl %ecx, %ecx + pushl %ebx + pushl %ebp + movl (%eax), %esi + movl 28(%esp), %ebx + roll $3, %esi + movl 4(%eax), %edi + roll $3, %edi + movl 24(%esp), %ebp + cmpl $0, %ebx + je .L002start_decrypt + + /* Round 0 */ + movl (%ebp), %eax + xorl %ebx, %ebx + movl 4(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 1 */ + movl 8(%ebp), %eax + xorl %ebx, %ebx + movl 12(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 2 */ + movl 16(%ebp), %eax + xorl %ebx, %ebx + movl 20(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 3 */ + movl 24(%ebp), %eax + xorl %ebx, %ebx + movl 28(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 4 */ + movl 32(%ebp), %eax + xorl %ebx, %ebx + movl 36(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 5 */ + movl 40(%ebp), %eax + xorl %ebx, %ebx + movl 44(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 6 */ + movl 48(%ebp), %eax + xorl %ebx, %ebx + movl 52(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 7 */ + movl 56(%ebp), %eax + xorl %ebx, %ebx + movl 60(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 8 */ + movl 64(%ebp), %eax + xorl %ebx, %ebx + movl 68(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 9 */ + movl 72(%ebp), %eax + xorl %ebx, %ebx + movl 76(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 10 */ + movl 80(%ebp), %eax + xorl %ebx, %ebx + movl 84(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 11 */ + movl 88(%ebp), %eax + xorl %ebx, %ebx + movl 92(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 12 */ + movl 96(%ebp), %eax + xorl %ebx, %ebx + movl 100(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 13 */ + movl 104(%ebp), %eax + xorl %ebx, %ebx + movl 108(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 14 */ + movl 112(%ebp), %eax + xorl %ebx, %ebx + movl 116(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 15 */ + movl 120(%ebp), %eax + xorl %ebx, %ebx + movl 124(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + jmp .L003end +.L002start_decrypt: + + /* Round 15 */ + movl 120(%ebp), %eax + xorl %ebx, %ebx + movl 124(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 14 */ + movl 112(%ebp), %eax + xorl %ebx, %ebx + movl 116(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 13 */ + movl 104(%ebp), %eax + xorl %ebx, %ebx + movl 108(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 12 */ + movl 96(%ebp), %eax + xorl %ebx, %ebx + movl 100(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 11 */ + movl 88(%ebp), %eax + xorl %ebx, %ebx + movl 92(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 10 */ + movl 80(%ebp), %eax + xorl %ebx, %ebx + movl 84(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 9 */ + movl 72(%ebp), %eax + xorl %ebx, %ebx + movl 76(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 8 */ + movl 64(%ebp), %eax + xorl %ebx, %ebx + movl 68(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 7 */ + movl 56(%ebp), %eax + xorl %ebx, %ebx + movl 60(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 6 */ + movl 48(%ebp), %eax + xorl %ebx, %ebx + movl 52(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 5 */ + movl 40(%ebp), %eax + xorl %ebx, %ebx + movl 44(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 4 */ + movl 32(%ebp), %eax + xorl %ebx, %ebx + movl 36(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 3 */ + movl 24(%ebp), %eax + xorl %ebx, %ebx + movl 28(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 2 */ + movl 16(%ebp), %eax + xorl %ebx, %ebx + movl 20(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 1 */ + movl 8(%ebp), %eax + xorl %ebx, %ebx + movl 12(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 0 */ + movl (%ebp), %eax + xorl %ebx, %ebx + movl 4(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi +.L003end: + + /* Fixup */ + rorl $3, %edi + movl 20(%esp), %eax + rorl $3, %esi + movl %edi, (%eax) + movl %esi, 4(%eax) + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +.des_encrypt2_end: + SIZE(des_encrypt2,.des_encrypt2_end-des_encrypt2) +.ident "desasm.pl" +.text + .align ALIGN +.globl des_encrypt3 + TYPE(des_encrypt3,@function) +des_encrypt3: + pushl %ebx + movl 8(%esp), %ebx + pushl %ebp + pushl %esi + pushl %edi + + /* Load the data words */ + movl (%ebx), %edi + movl 4(%ebx), %esi + subl $12, %esp + + /* IP */ + roll $4, %edi + movl %edi, %edx + xorl %esi, %edi + andl $0xf0f0f0f0, %edi + xorl %edi, %edx + xorl %edi, %esi + + roll $20, %esi + movl %esi, %edi + xorl %edx, %esi + andl $0xfff0000f, %esi + xorl %esi, %edi + xorl %esi, %edx + + roll $14, %edi + movl %edi, %esi + xorl %edx, %edi + andl $0x33333333, %edi + xorl %edi, %esi + xorl %edi, %edx + + roll $22, %edx + movl %edx, %edi + xorl %esi, %edx + andl $0x03fc03fc, %edx + xorl %edx, %edi + xorl %edx, %esi + + roll $9, %edi + movl %edi, %edx + xorl %esi, %edi + andl $0xaaaaaaaa, %edi + xorl %edi, %edx + xorl %edi, %esi + + rorl $3, %edx + rorl $2, %esi + movl %esi, 4(%ebx) + movl 36(%esp), %eax + movl %edx, (%ebx) + movl 40(%esp), %edi + movl 44(%esp), %esi + movl $1, 8(%esp) + movl %eax, 4(%esp) + movl %ebx, (%esp) + call des_encrypt2 + movl $0, 8(%esp) + movl %edi, 4(%esp) + movl %ebx, (%esp) + call des_encrypt2 + movl $1, 8(%esp) + movl %esi, 4(%esp) + movl %ebx, (%esp) + call des_encrypt2 + addl $12, %esp + movl (%ebx), %edi + movl 4(%ebx), %esi + + /* FP */ + roll $2, %esi + roll $3, %edi + movl %edi, %eax + xorl %esi, %edi + andl $0xaaaaaaaa, %edi + xorl %edi, %eax + xorl %edi, %esi + + roll $23, %eax + movl %eax, %edi + xorl %esi, %eax + andl $0x03fc03fc, %eax + xorl %eax, %edi + xorl %eax, %esi + + roll $10, %edi + movl %edi, %eax + xorl %esi, %edi + andl $0x33333333, %edi + xorl %edi, %eax + xorl %edi, %esi + + roll $18, %esi + movl %esi, %edi + xorl %eax, %esi + andl $0xfff0000f, %esi + xorl %esi, %edi + xorl %esi, %eax + + roll $12, %edi + movl %edi, %esi + xorl %eax, %edi + andl $0xf0f0f0f0, %edi + xorl %edi, %esi + xorl %edi, %eax + + rorl $4, %eax + movl %eax, (%ebx) + movl %esi, 4(%ebx) + popl %edi + popl %esi + popl %ebp + popl %ebx + ret +.des_encrypt3_end: + SIZE(des_encrypt3,.des_encrypt3_end-des_encrypt3) +.ident "desasm.pl" +.text + .align ALIGN +.globl des_decrypt3 + TYPE(des_decrypt3,@function) +des_decrypt3: + pushl %ebx + movl 8(%esp), %ebx + pushl %ebp + pushl %esi + pushl %edi + + /* Load the data words */ + movl (%ebx), %edi + movl 4(%ebx), %esi + subl $12, %esp + + /* IP */ + roll $4, %edi + movl %edi, %edx + xorl %esi, %edi + andl $0xf0f0f0f0, %edi + xorl %edi, %edx + xorl %edi, %esi + + roll $20, %esi + movl %esi, %edi + xorl %edx, %esi + andl $0xfff0000f, %esi + xorl %esi, %edi + xorl %esi, %edx + + roll $14, %edi + movl %edi, %esi + xorl %edx, %edi + andl $0x33333333, %edi + xorl %edi, %esi + xorl %edi, %edx + + roll $22, %edx + movl %edx, %edi + xorl %esi, %edx + andl $0x03fc03fc, %edx + xorl %edx, %edi + xorl %edx, %esi + + roll $9, %edi + movl %edi, %edx + xorl %esi, %edi + andl $0xaaaaaaaa, %edi + xorl %edi, %edx + xorl %edi, %esi + + rorl $3, %edx + rorl $2, %esi + movl %esi, 4(%ebx) + movl 36(%esp), %esi + movl %edx, (%ebx) + movl 40(%esp), %edi + movl 44(%esp), %eax + movl $0, 8(%esp) + movl %eax, 4(%esp) + movl %ebx, (%esp) + call des_encrypt2 + movl $1, 8(%esp) + movl %edi, 4(%esp) + movl %ebx, (%esp) + call des_encrypt2 + movl $0, 8(%esp) + movl %esi, 4(%esp) + movl %ebx, (%esp) + call des_encrypt2 + addl $12, %esp + movl (%ebx), %edi + movl 4(%ebx), %esi + + /* FP */ + roll $2, %esi + roll $3, %edi + movl %edi, %eax + xorl %esi, %edi + andl $0xaaaaaaaa, %edi + xorl %edi, %eax + xorl %edi, %esi + + roll $23, %eax + movl %eax, %edi + xorl %esi, %eax + andl $0x03fc03fc, %eax + xorl %eax, %edi + xorl %eax, %esi + + roll $10, %edi + movl %edi, %eax + xorl %esi, %edi + andl $0x33333333, %edi + xorl %edi, %eax + xorl %edi, %esi + + roll $18, %esi + movl %esi, %edi + xorl %eax, %esi + andl $0xfff0000f, %esi + xorl %esi, %edi + xorl %esi, %eax + + roll $12, %edi + movl %edi, %esi + xorl %eax, %edi + andl $0xf0f0f0f0, %edi + xorl %edi, %esi + xorl %edi, %eax + + rorl $4, %eax + movl %eax, (%ebx) + movl %esi, 4(%ebx) + popl %edi + popl %esi + popl %ebp + popl %ebx + ret +.des_decrypt3_end: + SIZE(des_decrypt3,.des_decrypt3_end-des_decrypt3) +.ident "desasm.pl" +.text + .align ALIGN +.globl des_ncbc_encrypt + TYPE(des_ncbc_encrypt,@function) +des_ncbc_encrypt: + + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + movl 28(%esp), %ebp + /* getting iv ptr from parameter 4 */ + movl 36(%esp), %ebx + movl (%ebx), %esi + movl 4(%ebx), %edi + pushl %edi + pushl %esi + pushl %edi + pushl %esi + movl %esp, %ebx + movl 36(%esp), %esi + movl 40(%esp), %edi + /* getting encrypt flag from parameter 5 */ + movl 56(%esp), %ecx + /* get and push parameter 5 */ + pushl %ecx + /* get and push parameter 3 */ + movl 52(%esp), %eax + pushl %eax + pushl %ebx + cmpl $0, %ecx + jz .L004decrypt + andl $4294967288, %ebp + movl 12(%esp), %eax + movl 16(%esp), %ebx + jz .L005encrypt_finish +.L006encrypt_loop: + movl (%esi), %ecx + movl 4(%esi), %edx + xorl %ecx, %eax + xorl %edx, %ebx + movl %eax, 12(%esp) + movl %ebx, 16(%esp) + call des_encrypt + movl 12(%esp), %eax + movl 16(%esp), %ebx + movl %eax, (%edi) + movl %ebx, 4(%edi) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L006encrypt_loop +.L005encrypt_finish: + movl 56(%esp), %ebp + andl $7, %ebp + jz .L007finish + xorl %ecx, %ecx + xorl %edx, %edx + movl .L008cbc_enc_jmp_table(,%ebp,4),%ebp + jmp *%ebp +.L009ej7: + movb 6(%esi), %dh + sall $8, %edx +.L010ej6: + movb 5(%esi), %dh +.L011ej5: + movb 4(%esi), %dl +.L012ej4: + movl (%esi), %ecx + jmp .L013ejend +.L014ej3: + movb 2(%esi), %ch + sall $8, %ecx +.L015ej2: + movb 1(%esi), %ch +.L016ej1: + movb (%esi), %cl +.L013ejend: + xorl %ecx, %eax + xorl %edx, %ebx + movl %eax, 12(%esp) + movl %ebx, 16(%esp) + call des_encrypt + movl 12(%esp), %eax + movl 16(%esp), %ebx + movl %eax, (%edi) + movl %ebx, 4(%edi) + jmp .L007finish +.align ALIGN +.L004decrypt: + andl $4294967288, %ebp + movl 20(%esp), %eax + movl 24(%esp), %ebx + jz .L017decrypt_finish +.L018decrypt_loop: + movl (%esi), %eax + movl 4(%esi), %ebx + movl %eax, 12(%esp) + movl %ebx, 16(%esp) + call des_encrypt + movl 12(%esp), %eax + movl 16(%esp), %ebx + movl 20(%esp), %ecx + movl 24(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx + movl %ecx, (%edi) + movl %edx, 4(%edi) + movl %eax, 20(%esp) + movl %ebx, 24(%esp) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L018decrypt_loop +.L017decrypt_finish: + movl 56(%esp), %ebp + andl $7, %ebp + jz .L007finish + movl (%esi), %eax + movl 4(%esi), %ebx + movl %eax, 12(%esp) + movl %ebx, 16(%esp) + call des_encrypt + movl 12(%esp), %eax + movl 16(%esp), %ebx + movl 20(%esp), %ecx + movl 24(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx +.L019dj7: + rorl $16, %edx + movb %dl, 6(%edi) + shrl $16, %edx +.L020dj6: + movb %dh, 5(%edi) +.L021dj5: + movb %dl, 4(%edi) +.L022dj4: + movl %ecx, (%edi) + jmp .L023djend +.L024dj3: + rorl $16, %ecx + movb %cl, 2(%edi) + sall $16, %ecx +.L025dj2: + movb %ch, 1(%esi) +.L026dj1: + movb %cl, (%esi) +.L023djend: + jmp .L007finish +.align ALIGN +.L007finish: + movl 64(%esp), %ecx + addl $28, %esp + movl %eax, (%ecx) + movl %ebx, 4(%ecx) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.align ALIGN +.L008cbc_enc_jmp_table: + .long 0 + .long .L016ej1 + .long .L015ej2 + .long .L014ej3 + .long .L012ej4 + .long .L011ej5 + .long .L010ej6 + .long .L009ej7 +.align ALIGN +.L027cbc_dec_jmp_table: + .long 0 + .long .L026dj1 + .long .L025dj2 + .long .L024dj3 + .long .L022dj4 + .long .L021dj5 + .long .L020dj6 + .long .L019dj7 +.des_ncbc_encrypt_end: + SIZE(des_ncbc_encrypt,.des_ncbc_encrypt_end-des_ncbc_encrypt) +.ident "desasm.pl" +.text + .align ALIGN +.globl des_ede3_cbc_encrypt + TYPE(des_ede3_cbc_encrypt,@function) +des_ede3_cbc_encrypt: + + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + movl 28(%esp), %ebp + /* getting iv ptr from parameter 6 */ + movl 44(%esp), %ebx + movl (%ebx), %esi + movl 4(%ebx), %edi + pushl %edi + pushl %esi + pushl %edi + pushl %esi + movl %esp, %ebx + movl 36(%esp), %esi + movl 40(%esp), %edi + /* getting encrypt flag from parameter 7 */ + movl 64(%esp), %ecx + /* get and push parameter 5 */ + movl 56(%esp), %eax + pushl %eax + /* get and push parameter 4 */ + movl 56(%esp), %eax + pushl %eax + /* get and push parameter 3 */ + movl 56(%esp), %eax + pushl %eax + pushl %ebx + cmpl $0, %ecx + jz .L028decrypt + andl $4294967288, %ebp + movl 16(%esp), %eax + movl 20(%esp), %ebx + jz .L029encrypt_finish +.L030encrypt_loop: + movl (%esi), %ecx + movl 4(%esi), %edx + xorl %ecx, %eax + xorl %edx, %ebx + movl %eax, 16(%esp) + movl %ebx, 20(%esp) + call des_encrypt3 + movl 16(%esp), %eax + movl 20(%esp), %ebx + movl %eax, (%edi) + movl %ebx, 4(%edi) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L030encrypt_loop +.L029encrypt_finish: + movl 60(%esp), %ebp + andl $7, %ebp + jz .L031finish + xorl %ecx, %ecx + xorl %edx, %edx + movl .L032cbc_enc_jmp_table(,%ebp,4),%ebp + jmp *%ebp +.L033ej7: + movb 6(%esi), %dh + sall $8, %edx +.L034ej6: + movb 5(%esi), %dh +.L035ej5: + movb 4(%esi), %dl +.L036ej4: + movl (%esi), %ecx + jmp .L037ejend +.L038ej3: + movb 2(%esi), %ch + sall $8, %ecx +.L039ej2: + movb 1(%esi), %ch +.L040ej1: + movb (%esi), %cl +.L037ejend: + xorl %ecx, %eax + xorl %edx, %ebx + movl %eax, 16(%esp) + movl %ebx, 20(%esp) + call des_encrypt3 + movl 16(%esp), %eax + movl 20(%esp), %ebx + movl %eax, (%edi) + movl %ebx, 4(%edi) + jmp .L031finish +.align ALIGN +.L028decrypt: + andl $4294967288, %ebp + movl 24(%esp), %eax + movl 28(%esp), %ebx + jz .L041decrypt_finish +.L042decrypt_loop: + movl (%esi), %eax + movl 4(%esi), %ebx + movl %eax, 16(%esp) + movl %ebx, 20(%esp) + call des_decrypt3 + movl 16(%esp), %eax + movl 20(%esp), %ebx + movl 24(%esp), %ecx + movl 28(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx + movl %ecx, (%edi) + movl %edx, 4(%edi) + movl %eax, 24(%esp) + movl %ebx, 28(%esp) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L042decrypt_loop +.L041decrypt_finish: + movl 60(%esp), %ebp + andl $7, %ebp + jz .L031finish + movl (%esi), %eax + movl 4(%esi), %ebx + movl %eax, 16(%esp) + movl %ebx, 20(%esp) + call des_decrypt3 + movl 16(%esp), %eax + movl 20(%esp), %ebx + movl 24(%esp), %ecx + movl 28(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx +.L043dj7: + rorl $16, %edx + movb %dl, 6(%edi) + shrl $16, %edx +.L044dj6: + movb %dh, 5(%edi) +.L045dj5: + movb %dl, 4(%edi) +.L046dj4: + movl %ecx, (%edi) + jmp .L047djend +.L048dj3: + rorl $16, %ecx + movb %cl, 2(%edi) + sall $16, %ecx +.L049dj2: + movb %ch, 1(%esi) +.L050dj1: + movb %cl, (%esi) +.L047djend: + jmp .L031finish +.align ALIGN +.L031finish: + movl 76(%esp), %ecx + addl $32, %esp + movl %eax, (%ecx) + movl %ebx, 4(%ecx) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.align ALIGN +.L032cbc_enc_jmp_table: + .long 0 + .long .L040ej1 + .long .L039ej2 + .long .L038ej3 + .long .L036ej4 + .long .L035ej5 + .long .L034ej6 + .long .L033ej7 +.align ALIGN +.L051cbc_dec_jmp_table: + .long 0 + .long .L050dj1 + .long .L049dj2 + .long .L048dj3 + .long .L046dj4 + .long .L045dj5 + .long .L044dj6 + .long .L043dj7 +.des_ede3_cbc_encrypt_end: + SIZE(des_ede3_cbc_encrypt,.des_ede3_cbc_encrypt_end-des_ede3_cbc_encrypt) +.ident "desasm.pl" diff --git a/src/lib/libcrypto/des/asm/y-win32.asm b/src/lib/libcrypto/des/asm/y-win32.asm new file mode 100644 index 0000000000..af5c102422 --- /dev/null +++ b/src/lib/libcrypto/des/asm/y-win32.asm @@ -0,0 +1,929 @@ + ; Don't even think of reading this code + ; It was automatically generated by crypt586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE crypt586.asm + .386 +.model FLAT +_TEXT SEGMENT +PUBLIC _fcrypt_body +EXTRN _des_SPtrans:DWORD +_fcrypt_body PROC NEAR + push ebp + push ebx + push esi + push edi + ; + ; Load the 2 words + xor edi, edi + xor esi, esi + mov ebp, DWORD PTR 24[esp] + push 25 +L000start: + ; + ; Round 0 + mov eax, DWORD PTR 32[esp] + mov edx, esi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, esi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR [ebp] + xor eax, ebx + mov ecx, DWORD PTR 4[ebp] + xor eax, esi + xor edx, esi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 1 + mov eax, DWORD PTR 32[esp] + mov edx, edi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, edi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 8[ebp] + xor eax, ebx + mov ecx, DWORD PTR 12[ebp] + xor eax, edi + xor edx, edi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 2 + mov eax, DWORD PTR 32[esp] + mov edx, esi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, esi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 16[ebp] + xor eax, ebx + mov ecx, DWORD PTR 20[ebp] + xor eax, esi + xor edx, esi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 3 + mov eax, DWORD PTR 32[esp] + mov edx, edi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, edi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 24[ebp] + xor eax, ebx + mov ecx, DWORD PTR 28[ebp] + xor eax, edi + xor edx, edi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 4 + mov eax, DWORD PTR 32[esp] + mov edx, esi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, esi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 32[ebp] + xor eax, ebx + mov ecx, DWORD PTR 36[ebp] + xor eax, esi + xor edx, esi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 5 + mov eax, DWORD PTR 32[esp] + mov edx, edi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, edi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 40[ebp] + xor eax, ebx + mov ecx, DWORD PTR 44[ebp] + xor eax, edi + xor edx, edi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 6 + mov eax, DWORD PTR 32[esp] + mov edx, esi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, esi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 48[ebp] + xor eax, ebx + mov ecx, DWORD PTR 52[ebp] + xor eax, esi + xor edx, esi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 7 + mov eax, DWORD PTR 32[esp] + mov edx, edi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, edi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 56[ebp] + xor eax, ebx + mov ecx, DWORD PTR 60[ebp] + xor eax, edi + xor edx, edi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 8 + mov eax, DWORD PTR 32[esp] + mov edx, esi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, esi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 64[ebp] + xor eax, ebx + mov ecx, DWORD PTR 68[ebp] + xor eax, esi + xor edx, esi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 9 + mov eax, DWORD PTR 32[esp] + mov edx, edi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, edi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 72[ebp] + xor eax, ebx + mov ecx, DWORD PTR 76[ebp] + xor eax, edi + xor edx, edi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 10 + mov eax, DWORD PTR 32[esp] + mov edx, esi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, esi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 80[ebp] + xor eax, ebx + mov ecx, DWORD PTR 84[ebp] + xor eax, esi + xor edx, esi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 11 + mov eax, DWORD PTR 32[esp] + mov edx, edi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, edi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 88[ebp] + xor eax, ebx + mov ecx, DWORD PTR 92[ebp] + xor eax, edi + xor edx, edi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 12 + mov eax, DWORD PTR 32[esp] + mov edx, esi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, esi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 96[ebp] + xor eax, ebx + mov ecx, DWORD PTR 100[ebp] + xor eax, esi + xor edx, esi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 13 + mov eax, DWORD PTR 32[esp] + mov edx, edi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, edi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 104[ebp] + xor eax, ebx + mov ecx, DWORD PTR 108[ebp] + xor eax, edi + xor edx, edi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 14 + mov eax, DWORD PTR 32[esp] + mov edx, esi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, esi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 112[ebp] + xor eax, ebx + mov ecx, DWORD PTR 116[ebp] + xor eax, esi + xor edx, esi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 15 + mov eax, DWORD PTR 32[esp] + mov edx, edi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, edi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 120[ebp] + xor eax, ebx + mov ecx, DWORD PTR 124[ebp] + xor eax, edi + xor edx, edi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + mov ebx, DWORD PTR [esp] + mov eax, edi + dec ebx + mov edi, esi + mov esi, eax + mov DWORD PTR [esp],ebx + jnz L000start + ; + ; FP + mov edx, DWORD PTR 24[esp] + ror edi, 1 + mov eax, esi + xor esi, edi + and esi, 0aaaaaaaah + xor eax, esi + xor edi, esi + ; + rol eax, 23 + mov esi, eax + xor eax, edi + and eax, 003fc03fch + xor esi, eax + xor edi, eax + ; + rol esi, 10 + mov eax, esi + xor esi, edi + and esi, 033333333h + xor eax, esi + xor edi, esi + ; + rol edi, 18 + mov esi, edi + xor edi, eax + and edi, 0fff0000fh + xor esi, edi + xor eax, edi + ; + rol esi, 12 + mov edi, esi + xor esi, eax + and esi, 0f0f0f0f0h + xor edi, esi + xor eax, esi + ; + ror eax, 4 + mov DWORD PTR [edx],eax + mov DWORD PTR 4[edx],edi + pop ecx + pop edi + pop esi + pop ebx + pop ebp + ret +_fcrypt_body ENDP +_TEXT ENDS +END diff --git a/src/lib/libcrypto/des/asm/yx86unix.cpp b/src/lib/libcrypto/des/asm/yx86unix.cpp new file mode 100644 index 0000000000..8719e38607 --- /dev/null +++ b/src/lib/libcrypto/des/asm/yx86unix.cpp @@ -0,0 +1,976 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define des_SPtrans _des_SPtrans +#define fcrypt_body _fcrypt_body + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by crypt586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "crypt586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl fcrypt_body + TYPE(fcrypt_body,@function) +fcrypt_body: + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + + + /* Load the 2 words */ + xorl %edi, %edi + xorl %esi, %esi + movl 24(%esp), %ebp + pushl $25 +.L000start: + + /* Round 0 */ + movl 32(%esp), %eax + movl %esi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %esi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl (%ebp), %ebx + xorl %ebx, %eax + movl 4(%ebp), %ecx + xorl %esi, %eax + xorl %esi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 1 */ + movl 32(%esp), %eax + movl %edi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %edi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 8(%ebp), %ebx + xorl %ebx, %eax + movl 12(%ebp), %ecx + xorl %edi, %eax + xorl %edi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 2 */ + movl 32(%esp), %eax + movl %esi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %esi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 16(%ebp), %ebx + xorl %ebx, %eax + movl 20(%ebp), %ecx + xorl %esi, %eax + xorl %esi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 3 */ + movl 32(%esp), %eax + movl %edi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %edi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 24(%ebp), %ebx + xorl %ebx, %eax + movl 28(%ebp), %ecx + xorl %edi, %eax + xorl %edi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 4 */ + movl 32(%esp), %eax + movl %esi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %esi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 32(%ebp), %ebx + xorl %ebx, %eax + movl 36(%ebp), %ecx + xorl %esi, %eax + xorl %esi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 5 */ + movl 32(%esp), %eax + movl %edi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %edi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 40(%ebp), %ebx + xorl %ebx, %eax + movl 44(%ebp), %ecx + xorl %edi, %eax + xorl %edi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 6 */ + movl 32(%esp), %eax + movl %esi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %esi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 48(%ebp), %ebx + xorl %ebx, %eax + movl 52(%ebp), %ecx + xorl %esi, %eax + xorl %esi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 7 */ + movl 32(%esp), %eax + movl %edi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %edi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 56(%ebp), %ebx + xorl %ebx, %eax + movl 60(%ebp), %ecx + xorl %edi, %eax + xorl %edi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 8 */ + movl 32(%esp), %eax + movl %esi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %esi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 64(%ebp), %ebx + xorl %ebx, %eax + movl 68(%ebp), %ecx + xorl %esi, %eax + xorl %esi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 9 */ + movl 32(%esp), %eax + movl %edi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %edi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 72(%ebp), %ebx + xorl %ebx, %eax + movl 76(%ebp), %ecx + xorl %edi, %eax + xorl %edi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 10 */ + movl 32(%esp), %eax + movl %esi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %esi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 80(%ebp), %ebx + xorl %ebx, %eax + movl 84(%ebp), %ecx + xorl %esi, %eax + xorl %esi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 11 */ + movl 32(%esp), %eax + movl %edi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %edi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 88(%ebp), %ebx + xorl %ebx, %eax + movl 92(%ebp), %ecx + xorl %edi, %eax + xorl %edi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 12 */ + movl 32(%esp), %eax + movl %esi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %esi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 96(%ebp), %ebx + xorl %ebx, %eax + movl 100(%ebp), %ecx + xorl %esi, %eax + xorl %esi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 13 */ + movl 32(%esp), %eax + movl %edi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %edi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 104(%ebp), %ebx + xorl %ebx, %eax + movl 108(%ebp), %ecx + xorl %edi, %eax + xorl %edi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 14 */ + movl 32(%esp), %eax + movl %esi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %esi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 112(%ebp), %ebx + xorl %ebx, %eax + movl 116(%ebp), %ecx + xorl %esi, %eax + xorl %esi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 15 */ + movl 32(%esp), %eax + movl %edi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %edi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 120(%ebp), %ebx + xorl %ebx, %eax + movl 124(%ebp), %ecx + xorl %edi, %eax + xorl %edi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + movl (%esp), %ebx + movl %edi, %eax + decl %ebx + movl %esi, %edi + movl %eax, %esi + movl %ebx, (%esp) + jnz .L000start + + /* FP */ + movl 24(%esp), %edx +.byte 209 +.byte 207 /* rorl $1 %edi */ + movl %esi, %eax + xorl %edi, %esi + andl $0xaaaaaaaa, %esi + xorl %esi, %eax + xorl %esi, %edi + + roll $23, %eax + movl %eax, %esi + xorl %edi, %eax + andl $0x03fc03fc, %eax + xorl %eax, %esi + xorl %eax, %edi + + roll $10, %esi + movl %esi, %eax + xorl %edi, %esi + andl $0x33333333, %esi + xorl %esi, %eax + xorl %esi, %edi + + roll $18, %edi + movl %edi, %esi + xorl %eax, %edi + andl $0xfff0000f, %edi + xorl %edi, %esi + xorl %edi, %eax + + roll $12, %esi + movl %esi, %edi + xorl %eax, %esi + andl $0xf0f0f0f0, %esi + xorl %esi, %edi + xorl %esi, %eax + + rorl $4, %eax + movl %eax, (%edx) + movl %edi, 4(%edx) + popl %ecx + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.fcrypt_body_end: + SIZE(fcrypt_body,.fcrypt_body_end-fcrypt_body) +.ident "fcrypt_body" diff --git a/src/lib/libcrypto/des/des.man b/src/lib/libcrypto/des/des.man new file mode 100644 index 0000000000..7e06a1851a --- /dev/null +++ b/src/lib/libcrypto/des/des.man @@ -0,0 +1,186 @@ +.TH DES 1 +.SH NAME +des - encrypt or decrypt data using Data Encryption Standard +.SH SYNOPSIS +.B des +( +.B \-e +| +.B \-E +) | ( +.B \-d +| +.B \-D +) | ( +.B \-\fR[\fPcC\fR][\fPckname\fR]\fP +) | +[ +.B \-b3hfs +] [ +.B \-k +.I key +] +] [ +.B \-u\fR[\fIuuname\fR] +[ +.I input-file +[ +.I output-file +] ] +.SH DESCRIPTION +.B des +encrypts and decrypts data using the +Data Encryption Standard algorithm. +One of +.B \-e, \-E +(for encrypt) or +.B \-d, \-D +(for decrypt) must be specified. +It is also possible to use +.B \-c +or +.B \-C +in conjunction or instead of the a encrypt/decrypt option to generate +a 16 character hexadecimal checksum, generated via the +.I des_cbc_cksum. +.LP +Two standard encryption modes are supported by the +.B des +program, Cipher Block Chaining (the default) and Electronic Code Book +(specified with +.B \-b +). +.LP +The key used for the DES +algorithm is obtained by prompting the user unless the +.B `\-k +.I key' +option is given. +If the key is an argument to the +.B des +command, it is potentially visible to users executing +.BR ps (1) +or a derivative. To minimise this possibility, +.B des +takes care to destroy the key argument immediately upon entry. +If your shell keeps a history file be careful to make sure it is not +world readable. +.LP +Since this program attempts to maintain compatability with sunOS's +des(1) command, there are 2 different methods used to convert the user +supplied key to a des key. +Whenever and one or more of +.B \-E, \-D, \-C +or +.B \-3 +options are used, the key conversion procedure will not be compatible +with the sunOS des(1) version but will use all the user supplied +character to generate the des key. +.B des +command reads from standard input unless +.I input-file +is specified and writes to standard output unless +.I output-file +is given. +.SH OPTIONS +.TP +.B \-b +Select ECB +(eight bytes at a time) encryption mode. +.TP +.B \-3 +Encrypt using triple encryption. +By default triple cbc encryption is used but if the +.B \-b +option is used then triple ecb encryption is performed. +If the key is less than 8 characters long, the flag has no effect. +.TP +.B \-e +Encrypt data using an 8 byte key in a manner compatible with sunOS +des(1). +.TP +.B \-E +Encrypt data using a key of nearly unlimited length (1024 bytes). +This will product a more secure encryption. +.TP +.B \-d +Decrypt data that was encrypted with the \-e option. +.TP +.B \-D +Decrypt data that was encrypted with the \-E option. +.TP +.B \-c +Generate a 16 character hexadecimal cbc checksum and output this to +stderr. +If a filename was specified after the +.B \-c +option, the checksum is output to that file. +The checksum is generated using a key generated in a sunOS compatible +manner. +.TP +.B \-C +A cbc checksum is generated in the same manner as described for the +.B \-c +option but the DES key is generated in the same manner as used for the +.B \-E +and +.B \-D +options +.TP +.B \-f +Does nothing - allowed for compatibility with sunOS des(1) command. +.TP +.B \-s +Does nothing - allowed for compatibility with sunOS des(1) command. +.TP +.B "\-k \fIkey\fP" +Use the encryption +.I key +specified. +.TP +.B "\-h" +The +.I key +is assumed to be a 16 character hexadecimal number. +If the +.B "\-3" +option is used the key is assumed to be a 32 character hexadecimal +number. +.TP +.B \-u +This flag is used to read and write uuencoded files. If decrypting, +the input file is assumed to contain uuencoded, DES encrypted data. +If encrypting, the characters following the -u are used as the name of +the uuencoded file to embed in the begin line of the uuencoded +output. If there is no name specified after the -u, the name text.des +will be embedded in the header. +.SH SEE ALSO +.B ps (1) +.B des_crypt(3) +.SH BUGS +.LP +The problem with using the +.B -e +option is the short key length. +It would be better to use a real 56-bit key rather than an +ASCII-based 56-bit pattern. Knowing that the key was derived from ASCII +radically reduces the time necessary for a brute-force cryptographic attack. +My attempt to remove this problem is to add an alternative text-key to +DES-key function. This alternative function (accessed via +.B -E, -D, -S +and +.B -3 +) +uses DES to help generate the key. +.LP +Be carefully when using the -u option. Doing des -ud <filename> will +not decrypt filename (the -u option will gobble the d option). +.LP +The VMS operating system operates in a world where files are always a +multiple of 512 bytes. This causes problems when encrypted data is +send from unix to VMS since a 88 byte file will suddenly be padded +with 424 null bytes. To get around this problem, use the -u option +to uuencode the data before it is send to the VMS system. +.SH AUTHOR +.LP +Eric Young (eay@cryptsoft.com) diff --git a/src/lib/libcrypto/des/des.org b/src/lib/libcrypto/des/des.org new file mode 100644 index 0000000000..a4cf5c8770 --- /dev/null +++ b/src/lib/libcrypto/des/des.org @@ -0,0 +1,301 @@ +/* crypto/des/des.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify des.org since des.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +#ifndef HEADER_DES_H +#define HEADER_DES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdio.h> + +/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a + * %20 speed up (longs are 8 bytes, int's are 4). */ +#ifndef DES_LONG +#define DES_LONG unsigned long +#endif + +typedef unsigned char des_cblock[8]; +typedef struct des_ks_struct + { + union { + des_cblock _; + /* make sure things are correct size on machines with + * 8 byte longs */ + DES_LONG pad[2]; + } ks; +#undef _ +#define _ ks._ + } des_key_schedule[16]; + +#define DES_KEY_SZ (sizeof(des_cblock)) +#define DES_SCHEDULE_SZ (sizeof(des_key_schedule)) + +#define DES_ENCRYPT 1 +#define DES_DECRYPT 0 + +#define DES_CBC_MODE 0 +#define DES_PCBC_MODE 1 + +#define des_ecb2_encrypt(i,o,k1,k2,e) \ + des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) + +#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ + des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) + +#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ + des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) + +#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ + des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) + +#define C_Block des_cblock +#define Key_schedule des_key_schedule +#ifdef KERBEROS +#define ENCRYPT DES_ENCRYPT +#define DECRYPT DES_DECRYPT +#endif +#define KEY_SZ DES_KEY_SZ +#define string_to_key des_string_to_key +#define read_pw_string des_read_pw_string +#define random_key des_random_key +#define pcbc_encrypt des_pcbc_encrypt +#define set_key des_set_key +#define key_sched des_key_sched +#define ecb_encrypt des_ecb_encrypt +#define cbc_encrypt des_cbc_encrypt +#define ncbc_encrypt des_ncbc_encrypt +#define xcbc_encrypt des_xcbc_encrypt +#define cbc_cksum des_cbc_cksum +#define quad_cksum des_quad_cksum + +/* For compatibility with the MIT lib - eay 20/05/92 */ +typedef des_key_schedule bit_64; +#define des_fixup_key_parity des_set_odd_parity +#define des_check_key_parity check_parity + +extern int des_check_key; /* defaults to false */ +extern int des_rw_mode; /* defaults to DES_PCBC_MODE */ + +/* The next line is used to disable full ANSI prototypes, if your + * compiler has problems with the prototypes, make sure this line always + * evaluates to true :-) */ +#if defined(MSDOS) || defined(__STDC__) +#undef NOPROTO +#endif +#ifndef NOPROTO +char *des_options(void); +void des_ecb3_encrypt(des_cblock *input,des_cblock *output, + des_key_schedule ks1,des_key_schedule ks2, + des_key_schedule ks3, int enc); +DES_LONG des_cbc_cksum(des_cblock *input,des_cblock *output, + long length,des_key_schedule schedule,des_cblock *ivec); +void des_cbc_encrypt(des_cblock *input,des_cblock *output,long length, + des_key_schedule schedule,des_cblock *ivec,int enc); +void des_ncbc_encrypt(des_cblock *input,des_cblock *output,long length, + des_key_schedule schedule,des_cblock *ivec,int enc); +void des_xcbc_encrypt(des_cblock *input,des_cblock *output,long length, + des_key_schedule schedule,des_cblock *ivec, + des_cblock *inw,des_cblock *outw,int enc); +void des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits, + long length,des_key_schedule schedule,des_cblock *ivec,int enc); +void des_ecb_encrypt(des_cblock *input,des_cblock *output, + des_key_schedule ks,int enc); +void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc); +void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc); +void des_encrypt3(DES_LONG *data, des_key_schedule ks1, + des_key_schedule ks2, des_key_schedule ks3); +void des_decrypt3(DES_LONG *data, des_key_schedule ks1, + des_key_schedule ks2, des_key_schedule ks3); +void des_ede3_cbc_encrypt(des_cblock *input, des_cblock *output, + long length, des_key_schedule ks1, des_key_schedule ks2, + des_key_schedule ks3, des_cblock *ivec, int enc); +void des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, + long length, des_key_schedule ks1, des_key_schedule ks2, + des_key_schedule ks3, des_cblock *ivec, int *num, int enc); +void des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, + long length, des_key_schedule ks1, des_key_schedule ks2, + des_key_schedule ks3, des_cblock *ivec, int *num); + +void des_xwhite_in2out(des_cblock (*des_key), des_cblock (*in_white), + des_cblock (*out_white)); + +int des_enc_read(int fd,char *buf,int len,des_key_schedule sched, + des_cblock *iv); +int des_enc_write(int fd,char *buf,int len,des_key_schedule sched, + des_cblock *iv); +char *des_fcrypt(const char *buf,const char *salt, char *ret); +#ifdef PERL5 +char *des_crypt(const char *buf,const char *salt); +#else +/* some stupid compilers complain because I have declared char instead + * of const char */ +#ifdef HEADER_DES_LOCL_H +char *crypt(const char *buf,const char *salt); +#else +char *crypt(); +#endif +#endif +void des_ofb_encrypt(unsigned char *in,unsigned char *out, + int numbits,long length,des_key_schedule schedule,des_cblock *ivec); +void des_pcbc_encrypt(des_cblock *input,des_cblock *output,long length, + des_key_schedule schedule,des_cblock *ivec,int enc); +DES_LONG des_quad_cksum(des_cblock *input,des_cblock *output, + long length,int out_count,des_cblock *seed); +void des_random_seed(des_cblock key); +void des_random_key(des_cblock ret); +int des_read_password(des_cblock *key,char *prompt,int verify); +int des_read_2passwords(des_cblock *key1,des_cblock *key2, + char *prompt,int verify); +int des_read_pw_string(char *buf,int length,char *prompt,int verify); +void des_set_odd_parity(des_cblock *key); +int des_is_weak_key(des_cblock *key); +int des_set_key(des_cblock *key,des_key_schedule schedule); +int des_key_sched(des_cblock *key,des_key_schedule schedule); +void des_string_to_key(char *str,des_cblock *key); +void des_string_to_2keys(char *str,des_cblock *key1,des_cblock *key2); +void des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, + des_key_schedule schedule, des_cblock *ivec, int *num, int enc); +void des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, + des_key_schedule schedule, des_cblock *ivec, int *num); +int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify); + +/* Extra functions from Mark Murray <mark@grondar.za> */ +void des_cblock_print_file(des_cblock *cb, FILE *fp); +/* The following functions are not in the normal unix build or the + * SSLeay build. When using the SSLeay build, use RAND_seed() + * and RAND_bytes() instead. */ +int des_new_random_key(des_cblock *key); +void des_init_random_number_generator(des_cblock *key); +void des_set_random_generator_seed(des_cblock *key); +void des_set_sequence_number(des_cblock new_sequence_number); +void des_generate_random_block(des_cblock *block); + +#else + +char *des_options(); +void des_ecb3_encrypt(); +DES_LONG des_cbc_cksum(); +void des_cbc_encrypt(); +void des_ncbc_encrypt(); +void des_xcbc_encrypt(); +void des_cfb_encrypt(); +void des_ede3_cfb64_encrypt(); +void des_ede3_ofb64_encrypt(); +void des_ecb_encrypt(); +void des_encrypt(); +void des_encrypt2(); +void des_encrypt3(); +void des_decrypt3(); +void des_ede3_cbc_encrypt(); +int des_enc_read(); +int des_enc_write(); +char *des_fcrypt(); +#ifdef PERL5 +char *des_crypt(); +#else +char *crypt(); +#endif +void des_ofb_encrypt(); +void des_pcbc_encrypt(); +DES_LONG des_quad_cksum(); +void des_random_seed(); +void des_random_key(); +int des_read_password(); +int des_read_2passwords(); +int des_read_pw_string(); +void des_set_odd_parity(); +int des_is_weak_key(); +int des_set_key(); +int des_key_sched(); +void des_string_to_key(); +void des_string_to_2keys(); +void des_cfb64_encrypt(); +void des_ofb64_encrypt(); +int des_read_pw(); +void des_xwhite_in2out(); + +/* Extra functions from Mark Murray <mark@grondar.za> */ +void des_cblock_print_file(); +/* The following functions are not in the normal unix build or the + * SSLeay build. When using the SSLeay build, use RAND_seed() + * and RAND_bytes() instead. */ +#ifdef FreeBSD +int des_new_random_key(); +void des_init_random_number_generator(); +void des_set_random_generator_seed(); +void des_set_sequence_number(); +void des_generate_random_block(); +#endif + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/lib/libcrypto/des/des.pl b/src/lib/libcrypto/des/des.pl new file mode 100644 index 0000000000..935eacb504 --- /dev/null +++ b/src/lib/libcrypto/des/des.pl @@ -0,0 +1,552 @@ +#!/usr/bin/perl +# des.pl - eric young 22/11/1991 eay@cryptsoft.com +# +# Copyright (C) 1993 Eric Young +# +# 11 April 1996 - patched to circumvent Perl 5 (through 5.002) problem +# with sign-extension on right shift operations. +# Ed Kubaitis - ejk@uiuc.edu +# +# eay - 92/08/31 - I think I have fixed all problems for 64bit +# versions of perl but I could be wrong since I have not tested it yet :-). +# +# This is an implementation of DES in perl. +# The two routines (des_set_key and des_ecb_encrypt) +# take 8 byte objects as arguments. +# +# des_set_key takes an 8 byte string as a key and returns a key schedule +# for use in calls to des_ecb_encrypt. +# des_ecb_encrypt takes three arguments, the first is a key schedule +# (make sure to pass it by reference with the *), the second is 1 +# to encrypt, 0 to decrypt. The third argument is an 8 byte object +# to encrypt. The function returns an 8 byte object that has been +# DES encrypted. +# +# example: +# require 'des.pl' +# +# $key =pack("C8",0x12,0x23,0x45,0x67,0x89,0xab,0xcd,0xef); +# @ks= &des_set_key($key); +# +# $outbytes= &des_ecb_encrypt(*ks,1,$data); +# @enc =unpack("C8",$outbytes); +# + +package des; + +eval("use integer;") if (int($]) > 4); + +# The following 8 arrays are used in des_set_key +@skb0=( +# for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 +0x00000000,0x00000010,0x20000000,0x20000010, +0x00010000,0x00010010,0x20010000,0x20010010, +0x00000800,0x00000810,0x20000800,0x20000810, +0x00010800,0x00010810,0x20010800,0x20010810, +0x00000020,0x00000030,0x20000020,0x20000030, +0x00010020,0x00010030,0x20010020,0x20010030, +0x00000820,0x00000830,0x20000820,0x20000830, +0x00010820,0x00010830,0x20010820,0x20010830, +0x00080000,0x00080010,0x20080000,0x20080010, +0x00090000,0x00090010,0x20090000,0x20090010, +0x00080800,0x00080810,0x20080800,0x20080810, +0x00090800,0x00090810,0x20090800,0x20090810, +0x00080020,0x00080030,0x20080020,0x20080030, +0x00090020,0x00090030,0x20090020,0x20090030, +0x00080820,0x00080830,0x20080820,0x20080830, +0x00090820,0x00090830,0x20090820,0x20090830, +); +@skb1=( +# for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 +0x00000000,0x02000000,0x00002000,0x02002000, +0x00200000,0x02200000,0x00202000,0x02202000, +0x00000004,0x02000004,0x00002004,0x02002004, +0x00200004,0x02200004,0x00202004,0x02202004, +0x00000400,0x02000400,0x00002400,0x02002400, +0x00200400,0x02200400,0x00202400,0x02202400, +0x00000404,0x02000404,0x00002404,0x02002404, +0x00200404,0x02200404,0x00202404,0x02202404, +0x10000000,0x12000000,0x10002000,0x12002000, +0x10200000,0x12200000,0x10202000,0x12202000, +0x10000004,0x12000004,0x10002004,0x12002004, +0x10200004,0x12200004,0x10202004,0x12202004, +0x10000400,0x12000400,0x10002400,0x12002400, +0x10200400,0x12200400,0x10202400,0x12202400, +0x10000404,0x12000404,0x10002404,0x12002404, +0x10200404,0x12200404,0x10202404,0x12202404, +); +@skb2=( +# for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 +0x00000000,0x00000001,0x00040000,0x00040001, +0x01000000,0x01000001,0x01040000,0x01040001, +0x00000002,0x00000003,0x00040002,0x00040003, +0x01000002,0x01000003,0x01040002,0x01040003, +0x00000200,0x00000201,0x00040200,0x00040201, +0x01000200,0x01000201,0x01040200,0x01040201, +0x00000202,0x00000203,0x00040202,0x00040203, +0x01000202,0x01000203,0x01040202,0x01040203, +0x08000000,0x08000001,0x08040000,0x08040001, +0x09000000,0x09000001,0x09040000,0x09040001, +0x08000002,0x08000003,0x08040002,0x08040003, +0x09000002,0x09000003,0x09040002,0x09040003, +0x08000200,0x08000201,0x08040200,0x08040201, +0x09000200,0x09000201,0x09040200,0x09040201, +0x08000202,0x08000203,0x08040202,0x08040203, +0x09000202,0x09000203,0x09040202,0x09040203, +); +@skb3=( +# for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 +0x00000000,0x00100000,0x00000100,0x00100100, +0x00000008,0x00100008,0x00000108,0x00100108, +0x00001000,0x00101000,0x00001100,0x00101100, +0x00001008,0x00101008,0x00001108,0x00101108, +0x04000000,0x04100000,0x04000100,0x04100100, +0x04000008,0x04100008,0x04000108,0x04100108, +0x04001000,0x04101000,0x04001100,0x04101100, +0x04001008,0x04101008,0x04001108,0x04101108, +0x00020000,0x00120000,0x00020100,0x00120100, +0x00020008,0x00120008,0x00020108,0x00120108, +0x00021000,0x00121000,0x00021100,0x00121100, +0x00021008,0x00121008,0x00021108,0x00121108, +0x04020000,0x04120000,0x04020100,0x04120100, +0x04020008,0x04120008,0x04020108,0x04120108, +0x04021000,0x04121000,0x04021100,0x04121100, +0x04021008,0x04121008,0x04021108,0x04121108, +); +@skb4=( +# for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 +0x00000000,0x10000000,0x00010000,0x10010000, +0x00000004,0x10000004,0x00010004,0x10010004, +0x20000000,0x30000000,0x20010000,0x30010000, +0x20000004,0x30000004,0x20010004,0x30010004, +0x00100000,0x10100000,0x00110000,0x10110000, +0x00100004,0x10100004,0x00110004,0x10110004, +0x20100000,0x30100000,0x20110000,0x30110000, +0x20100004,0x30100004,0x20110004,0x30110004, +0x00001000,0x10001000,0x00011000,0x10011000, +0x00001004,0x10001004,0x00011004,0x10011004, +0x20001000,0x30001000,0x20011000,0x30011000, +0x20001004,0x30001004,0x20011004,0x30011004, +0x00101000,0x10101000,0x00111000,0x10111000, +0x00101004,0x10101004,0x00111004,0x10111004, +0x20101000,0x30101000,0x20111000,0x30111000, +0x20101004,0x30101004,0x20111004,0x30111004, +); +@skb5=( +# for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 +0x00000000,0x08000000,0x00000008,0x08000008, +0x00000400,0x08000400,0x00000408,0x08000408, +0x00020000,0x08020000,0x00020008,0x08020008, +0x00020400,0x08020400,0x00020408,0x08020408, +0x00000001,0x08000001,0x00000009,0x08000009, +0x00000401,0x08000401,0x00000409,0x08000409, +0x00020001,0x08020001,0x00020009,0x08020009, +0x00020401,0x08020401,0x00020409,0x08020409, +0x02000000,0x0A000000,0x02000008,0x0A000008, +0x02000400,0x0A000400,0x02000408,0x0A000408, +0x02020000,0x0A020000,0x02020008,0x0A020008, +0x02020400,0x0A020400,0x02020408,0x0A020408, +0x02000001,0x0A000001,0x02000009,0x0A000009, +0x02000401,0x0A000401,0x02000409,0x0A000409, +0x02020001,0x0A020001,0x02020009,0x0A020009, +0x02020401,0x0A020401,0x02020409,0x0A020409, +); +@skb6=( +# for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 +0x00000000,0x00000100,0x00080000,0x00080100, +0x01000000,0x01000100,0x01080000,0x01080100, +0x00000010,0x00000110,0x00080010,0x00080110, +0x01000010,0x01000110,0x01080010,0x01080110, +0x00200000,0x00200100,0x00280000,0x00280100, +0x01200000,0x01200100,0x01280000,0x01280100, +0x00200010,0x00200110,0x00280010,0x00280110, +0x01200010,0x01200110,0x01280010,0x01280110, +0x00000200,0x00000300,0x00080200,0x00080300, +0x01000200,0x01000300,0x01080200,0x01080300, +0x00000210,0x00000310,0x00080210,0x00080310, +0x01000210,0x01000310,0x01080210,0x01080310, +0x00200200,0x00200300,0x00280200,0x00280300, +0x01200200,0x01200300,0x01280200,0x01280300, +0x00200210,0x00200310,0x00280210,0x00280310, +0x01200210,0x01200310,0x01280210,0x01280310, +); +@skb7=( +# for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 +0x00000000,0x04000000,0x00040000,0x04040000, +0x00000002,0x04000002,0x00040002,0x04040002, +0x00002000,0x04002000,0x00042000,0x04042000, +0x00002002,0x04002002,0x00042002,0x04042002, +0x00000020,0x04000020,0x00040020,0x04040020, +0x00000022,0x04000022,0x00040022,0x04040022, +0x00002020,0x04002020,0x00042020,0x04042020, +0x00002022,0x04002022,0x00042022,0x04042022, +0x00000800,0x04000800,0x00040800,0x04040800, +0x00000802,0x04000802,0x00040802,0x04040802, +0x00002800,0x04002800,0x00042800,0x04042800, +0x00002802,0x04002802,0x00042802,0x04042802, +0x00000820,0x04000820,0x00040820,0x04040820, +0x00000822,0x04000822,0x00040822,0x04040822, +0x00002820,0x04002820,0x00042820,0x04042820, +0x00002822,0x04002822,0x00042822,0x04042822, +); + +@shifts2=(0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0); + +# used in ecb_encrypt +@SP0=( +0x00410100, 0x00010000, 0x40400000, 0x40410100, +0x00400000, 0x40010100, 0x40010000, 0x40400000, +0x40010100, 0x00410100, 0x00410000, 0x40000100, +0x40400100, 0x00400000, 0x00000000, 0x40010000, +0x00010000, 0x40000000, 0x00400100, 0x00010100, +0x40410100, 0x00410000, 0x40000100, 0x00400100, +0x40000000, 0x00000100, 0x00010100, 0x40410000, +0x00000100, 0x40400100, 0x40410000, 0x00000000, +0x00000000, 0x40410100, 0x00400100, 0x40010000, +0x00410100, 0x00010000, 0x40000100, 0x00400100, +0x40410000, 0x00000100, 0x00010100, 0x40400000, +0x40010100, 0x40000000, 0x40400000, 0x00410000, +0x40410100, 0x00010100, 0x00410000, 0x40400100, +0x00400000, 0x40000100, 0x40010000, 0x00000000, +0x00010000, 0x00400000, 0x40400100, 0x00410100, +0x40000000, 0x40410000, 0x00000100, 0x40010100, +); +@SP1=( +0x08021002, 0x00000000, 0x00021000, 0x08020000, +0x08000002, 0x00001002, 0x08001000, 0x00021000, +0x00001000, 0x08020002, 0x00000002, 0x08001000, +0x00020002, 0x08021000, 0x08020000, 0x00000002, +0x00020000, 0x08001002, 0x08020002, 0x00001000, +0x00021002, 0x08000000, 0x00000000, 0x00020002, +0x08001002, 0x00021002, 0x08021000, 0x08000002, +0x08000000, 0x00020000, 0x00001002, 0x08021002, +0x00020002, 0x08021000, 0x08001000, 0x00021002, +0x08021002, 0x00020002, 0x08000002, 0x00000000, +0x08000000, 0x00001002, 0x00020000, 0x08020002, +0x00001000, 0x08000000, 0x00021002, 0x08001002, +0x08021000, 0x00001000, 0x00000000, 0x08000002, +0x00000002, 0x08021002, 0x00021000, 0x08020000, +0x08020002, 0x00020000, 0x00001002, 0x08001000, +0x08001002, 0x00000002, 0x08020000, 0x00021000, +); +@SP2=( +0x20800000, 0x00808020, 0x00000020, 0x20800020, +0x20008000, 0x00800000, 0x20800020, 0x00008020, +0x00800020, 0x00008000, 0x00808000, 0x20000000, +0x20808020, 0x20000020, 0x20000000, 0x20808000, +0x00000000, 0x20008000, 0x00808020, 0x00000020, +0x20000020, 0x20808020, 0x00008000, 0x20800000, +0x20808000, 0x00800020, 0x20008020, 0x00808000, +0x00008020, 0x00000000, 0x00800000, 0x20008020, +0x00808020, 0x00000020, 0x20000000, 0x00008000, +0x20000020, 0x20008000, 0x00808000, 0x20800020, +0x00000000, 0x00808020, 0x00008020, 0x20808000, +0x20008000, 0x00800000, 0x20808020, 0x20000000, +0x20008020, 0x20800000, 0x00800000, 0x20808020, +0x00008000, 0x00800020, 0x20800020, 0x00008020, +0x00800020, 0x00000000, 0x20808000, 0x20000020, +0x20800000, 0x20008020, 0x00000020, 0x00808000, +); +@SP3=( +0x00080201, 0x02000200, 0x00000001, 0x02080201, +0x00000000, 0x02080000, 0x02000201, 0x00080001, +0x02080200, 0x02000001, 0x02000000, 0x00000201, +0x02000001, 0x00080201, 0x00080000, 0x02000000, +0x02080001, 0x00080200, 0x00000200, 0x00000001, +0x00080200, 0x02000201, 0x02080000, 0x00000200, +0x00000201, 0x00000000, 0x00080001, 0x02080200, +0x02000200, 0x02080001, 0x02080201, 0x00080000, +0x02080001, 0x00000201, 0x00080000, 0x02000001, +0x00080200, 0x02000200, 0x00000001, 0x02080000, +0x02000201, 0x00000000, 0x00000200, 0x00080001, +0x00000000, 0x02080001, 0x02080200, 0x00000200, +0x02000000, 0x02080201, 0x00080201, 0x00080000, +0x02080201, 0x00000001, 0x02000200, 0x00080201, +0x00080001, 0x00080200, 0x02080000, 0x02000201, +0x00000201, 0x02000000, 0x02000001, 0x02080200, +); +@SP4=( +0x01000000, 0x00002000, 0x00000080, 0x01002084, +0x01002004, 0x01000080, 0x00002084, 0x01002000, +0x00002000, 0x00000004, 0x01000004, 0x00002080, +0x01000084, 0x01002004, 0x01002080, 0x00000000, +0x00002080, 0x01000000, 0x00002004, 0x00000084, +0x01000080, 0x00002084, 0x00000000, 0x01000004, +0x00000004, 0x01000084, 0x01002084, 0x00002004, +0x01002000, 0x00000080, 0x00000084, 0x01002080, +0x01002080, 0x01000084, 0x00002004, 0x01002000, +0x00002000, 0x00000004, 0x01000004, 0x01000080, +0x01000000, 0x00002080, 0x01002084, 0x00000000, +0x00002084, 0x01000000, 0x00000080, 0x00002004, +0x01000084, 0x00000080, 0x00000000, 0x01002084, +0x01002004, 0x01002080, 0x00000084, 0x00002000, +0x00002080, 0x01002004, 0x01000080, 0x00000084, +0x00000004, 0x00002084, 0x01002000, 0x01000004, +); +@SP5=( +0x10000008, 0x00040008, 0x00000000, 0x10040400, +0x00040008, 0x00000400, 0x10000408, 0x00040000, +0x00000408, 0x10040408, 0x00040400, 0x10000000, +0x10000400, 0x10000008, 0x10040000, 0x00040408, +0x00040000, 0x10000408, 0x10040008, 0x00000000, +0x00000400, 0x00000008, 0x10040400, 0x10040008, +0x10040408, 0x10040000, 0x10000000, 0x00000408, +0x00000008, 0x00040400, 0x00040408, 0x10000400, +0x00000408, 0x10000000, 0x10000400, 0x00040408, +0x10040400, 0x00040008, 0x00000000, 0x10000400, +0x10000000, 0x00000400, 0x10040008, 0x00040000, +0x00040008, 0x10040408, 0x00040400, 0x00000008, +0x10040408, 0x00040400, 0x00040000, 0x10000408, +0x10000008, 0x10040000, 0x00040408, 0x00000000, +0x00000400, 0x10000008, 0x10000408, 0x10040400, +0x10040000, 0x00000408, 0x00000008, 0x10040008, +); +@SP6=( +0x00000800, 0x00000040, 0x00200040, 0x80200000, +0x80200840, 0x80000800, 0x00000840, 0x00000000, +0x00200000, 0x80200040, 0x80000040, 0x00200800, +0x80000000, 0x00200840, 0x00200800, 0x80000040, +0x80200040, 0x00000800, 0x80000800, 0x80200840, +0x00000000, 0x00200040, 0x80200000, 0x00000840, +0x80200800, 0x80000840, 0x00200840, 0x80000000, +0x80000840, 0x80200800, 0x00000040, 0x00200000, +0x80000840, 0x00200800, 0x80200800, 0x80000040, +0x00000800, 0x00000040, 0x00200000, 0x80200800, +0x80200040, 0x80000840, 0x00000840, 0x00000000, +0x00000040, 0x80200000, 0x80000000, 0x00200040, +0x00000000, 0x80200040, 0x00200040, 0x00000840, +0x80000040, 0x00000800, 0x80200840, 0x00200000, +0x00200840, 0x80000000, 0x80000800, 0x80200840, +0x80200000, 0x00200840, 0x00200800, 0x80000800, +); +@SP7=( +0x04100010, 0x04104000, 0x00004010, 0x00000000, +0x04004000, 0x00100010, 0x04100000, 0x04104010, +0x00000010, 0x04000000, 0x00104000, 0x00004010, +0x00104010, 0x04004010, 0x04000010, 0x04100000, +0x00004000, 0x00104010, 0x00100010, 0x04004000, +0x04104010, 0x04000010, 0x00000000, 0x00104000, +0x04000000, 0x00100000, 0x04004010, 0x04100010, +0x00100000, 0x00004000, 0x04104000, 0x00000010, +0x00100000, 0x00004000, 0x04000010, 0x04104010, +0x00004010, 0x04000000, 0x00000000, 0x00104000, +0x04100010, 0x04004010, 0x04004000, 0x00100010, +0x04104000, 0x00000010, 0x00100010, 0x04004000, +0x04104010, 0x00100000, 0x04100000, 0x04000010, +0x00104000, 0x00004010, 0x04004010, 0x04100000, +0x00000010, 0x04104000, 0x00104010, 0x00000000, +0x04000000, 0x04100010, 0x00004000, 0x00104010, +); + +sub main'des_set_key + { + local($param)=@_; + local(@key); + local($c,$d,$i,$s,$t); + local(@ks)=(); + + # Get the bytes in the order we want. + @key=unpack("C8",$param); + + $c= ($key[0] )| + ($key[1]<< 8)| + ($key[2]<<16)| + ($key[3]<<24); + $d= ($key[4] )| + ($key[5]<< 8)| + ($key[6]<<16)| + ($key[7]<<24); + + &doPC1(*c,*d); + + for $i (@shifts2) + { + if ($i) + { + $c=($c>>2)|($c<<26); + $d=($d>>2)|($d<<26); + } + else + { + $c=($c>>1)|($c<<27); + $d=($d>>1)|($d<<27); + } + $c&=0x0fffffff; + $d&=0x0fffffff; + $s= $skb0[ ($c )&0x3f ]| + $skb1[(($c>> 6)&0x03)|(($c>> 7)&0x3c)]| + $skb2[(($c>>13)&0x0f)|(($c>>14)&0x30)]| + $skb3[(($c>>20)&0x01)|(($c>>21)&0x06) | + (($c>>22)&0x38)]; + $t= $skb4[ ($d )&0x3f ]| + $skb5[(($d>> 7)&0x03)|(($d>> 8)&0x3c)]| + $skb6[ ($d>>15)&0x3f ]| + $skb7[(($d>>21)&0x0f)|(($d>>22)&0x30)]; + push(@ks,(($t<<16)|($s&0x0000ffff))&0xffffffff); + $s= (($s>>16)&0x0000ffff)|($t&0xffff0000) ; + push(@ks,(($s<<4)|(($s>>28)&0xf))&0xffffffff); + } + @ks; + } + +sub doPC1 + { + local(*a,*b)=@_; + local($t); + + $t=(($b>>4)^$a)&0x0f0f0f0f; + $b^=($t<<4); $a^=$t; + # do $a first + $t=(($a<<18)^$a)&0xcccc0000; + $a=$a^$t^(($t>>18)&0x00003fff); + $t=(($a<<17)^$a)&0xaaaa0000; + $a=$a^$t^(($t>>17)&0x00007fff); + $t=(($a<< 8)^$a)&0x00ff0000; + $a=$a^$t^(($t>> 8)&0x00ffffff); + $t=(($a<<17)^$a)&0xaaaa0000; + $a=$a^$t^(($t>>17)&0x00007fff); + + # now do $b + $t=(($b<<24)^$b)&0xff000000; + $b=$b^$t^(($t>>24)&0x000000ff); + $t=(($b<< 8)^$b)&0x00ff0000; + $b=$b^$t^(($t>> 8)&0x00ffffff); + $t=(($b<<14)^$b)&0x33330000; + $b=$b^$t^(($t>>14)&0x0003ffff); + $b=(($b&0x00aa00aa)<<7)|(($b&0x55005500)>>7)|($b&0xaa55aa55); + $b=(($b>>8)&0x00ffffff)|((($a&0xf0000000)>>4)&0x0fffffff); + $a&=0x0fffffff; + } + +sub doIP + { + local(*a,*b)=@_; + local($t); + + $t=(($b>> 4)^$a)&0x0f0f0f0f; + $b^=($t<< 4); $a^=$t; + $t=(($a>>16)^$b)&0x0000ffff; + $a^=($t<<16); $b^=$t; + $t=(($b>> 2)^$a)&0x33333333; + $b^=($t<< 2); $a^=$t; + $t=(($a>> 8)^$b)&0x00ff00ff; + $a^=($t<< 8); $b^=$t; + $t=(($b>> 1)^$a)&0x55555555; + $b^=($t<< 1); $a^=$t; + $t=$a; + $a=$b&0xffffffff; + $b=$t&0xffffffff; + } + +sub doFP + { + local(*a,*b)=@_; + local($t); + + $t=(($b>> 1)^$a)&0x55555555; + $b^=($t<< 1); $a^=$t; + $t=(($a>> 8)^$b)&0x00ff00ff; + $a^=($t<< 8); $b^=$t; + $t=(($b>> 2)^$a)&0x33333333; + $b^=($t<< 2); $a^=$t; + $t=(($a>>16)^$b)&0x0000ffff; + $a^=($t<<16); $b^=$t; + $t=(($b>> 4)^$a)&0x0f0f0f0f; + $b^=($t<< 4); $a^=$t; + $a&=0xffffffff; + $b&=0xffffffff; + } + +sub main'des_ecb_encrypt + { + local(*ks,$encrypt,$in)=@_; + local($l,$r,$i,$t,$u,@input); + + @input=unpack("C8",$in); + # Get the bytes in the order we want. + $l= ($input[0] )| + ($input[1]<< 8)| + ($input[2]<<16)| + ($input[3]<<24); + $r= ($input[4] )| + ($input[5]<< 8)| + ($input[6]<<16)| + ($input[7]<<24); + + $l&=0xffffffff; + $r&=0xffffffff; + &doIP(*l,*r); + if ($encrypt) + { + for ($i=0; $i<32; $i+=4) + { + $t=((($r&0x7fffffff)<<1)|(($r>>31)&0x00000001)); + $u=$t^$ks[$i ]; + $t=$t^$ks[$i+1]; + $t2=(($t&0x0000000f)<<28); + + $t=((($t>>4)&0x0fffffff)|(($t&0x0000000f)<<28)); + $l^= $SP1[ $t &0x3f]| + $SP3[($t>> 8)&0x3f]| + $SP5[($t>>16)&0x3f]| + $SP7[($t>>24)&0x3f]| + $SP0[ $u &0x3f]| + $SP2[($u>> 8)&0x3f]| + $SP4[($u>>16)&0x3f]| + $SP6[($u>>24)&0x3f]; + + $t=(($l<<1)|(($l>>31)&0x1))&0xffffffff; + $u=$t^$ks[$i+2]; + $t=$t^$ks[$i+3]; + $t=((($t>>4)&0x0fffffff)|($t<<28))&0xffffffff; + $r^= $SP1[ $t &0x3f]| + $SP3[($t>> 8)&0x3f]| + $SP5[($t>>16)&0x3f]| + $SP7[($t>>24)&0x3f]| + $SP0[ $u &0x3f]| + $SP2[($u>> 8)&0x3f]| + $SP4[($u>>16)&0x3f]| + $SP6[($u>>24)&0x3f]; + } + } + else + { + for ($i=30; $i>0; $i-=4) + { + $t=(($r<<1)|(($r>>31)&0x1))&0xffffffff; + $u=$t^$ks[$i ]; + $t=$t^$ks[$i+1]; + $t=((($t>>4)&0x0fffffff)|($t<<28))&0xffffffff; + $l^= $SP1[ $t &0x3f]| + $SP3[($t>> 8)&0x3f]| + $SP5[($t>>16)&0x3f]| + $SP7[($t>>24)&0x3f]| + $SP0[ $u &0x3f]| + $SP2[($u>> 8)&0x3f]| + $SP4[($u>>16)&0x3f]| + $SP6[($u>>24)&0x3f]; + + $t=(($l<<1)|(($l>>31)&0x1))&0xffffffff; + $u=$t^$ks[$i-2]; + $t=$t^$ks[$i-1]; + $t=((($t>>4)&0x0fffffff)|($t<<28))&0xffffffff; + $r^= $SP1[ $t &0x3f]| + $SP3[($t>> 8)&0x3f]| + $SP5[($t>>16)&0x3f]| + $SP7[($t>>24)&0x3f]| + $SP0[ $u &0x3f]| + $SP2[($u>> 8)&0x3f]| + $SP4[($u>>16)&0x3f]| + $SP6[($u>>24)&0x3f]; + } + } + &doFP(*l,*r); + pack("C8",$l&0xff, + ($l>> 8)&0x00ffffff, + ($l>>16)&0x0000ffff, + ($l>>24)&0x000000ff, + $r&0xff, + ($r>> 8)&0x00ffffff, + ($r>>16)&0x0000ffff, + ($r>>24)&0x000000ff); + } diff --git a/src/lib/libcrypto/des/des_crypt.man b/src/lib/libcrypto/des/des_crypt.man new file mode 100644 index 0000000000..0ecc416877 --- /dev/null +++ b/src/lib/libcrypto/des/des_crypt.man @@ -0,0 +1,508 @@ +.TH DES_CRYPT 3 +.SH NAME +des_read_password, des_read_2password, +des_string_to_key, des_string_to_2key, des_read_pw_string, +des_random_key, des_set_key, +des_key_sched, des_ecb_encrypt, des_ecb3_encrypt, des_cbc_encrypt, +des_3cbc_encrypt, +des_pcbc_encrypt, des_cfb_encrypt, des_ofb_encrypt, +des_cbc_cksum, des_quad_cksum, +des_enc_read, des_enc_write, des_set_odd_parity, +des_is_weak_key, crypt \- (non USA) DES encryption +.SH SYNOPSIS +.nf +.nj +.ft B +#include <des.h> +.PP +.B int des_read_password(key,prompt,verify) +des_cblock *key; +char *prompt; +int verify; +.PP +.B int des_read_2password(key1,key2,prompt,verify) +des_cblock *key1,*key2; +char *prompt; +int verify; +.PP +.B int des_string_to_key(str,key) +char *str; +des_cblock *key; +.PP +.B int des_string_to_2keys(str,key1,key2) +char *str; +des_cblock *key1,*key2; +.PP +.B int des_read_pw_string(buf,length,prompt,verify) +char *buf; +int length; +char *prompt; +int verify; +.PP +.B int des_random_key(key) +des_cblock *key; +.PP +.B int des_set_key(key,schedule) +des_cblock *key; +des_key_schedule schedule; +.PP +.B int des_key_sched(key,schedule) +des_cblock *key; +des_key_schedule schedule; +.PP +.B int des_ecb_encrypt(input,output,schedule,encrypt) +des_cblock *input; +des_cblock *output; +des_key_schedule schedule; +int encrypt; +.PP +.B int des_ecb3_encrypt(input,output,ks1,ks2,encrypt) +des_cblock *input; +des_cblock *output; +des_key_schedule ks1,ks2; +int encrypt; +.PP +.B int des_cbc_encrypt(input,output,length,schedule,ivec,encrypt) +des_cblock *input; +des_cblock *output; +long length; +des_key_schedule schedule; +des_cblock *ivec; +int encrypt; +.PP +.B int des_3cbc_encrypt(input,output,length,sk1,sk2,ivec1,ivec2,encrypt) +des_cblock *input; +des_cblock *output; +long length; +des_key_schedule sk1; +des_key_schedule sk2; +des_cblock *ivec1; +des_cblock *ivec2; +int encrypt; +.PP +.B int des_pcbc_encrypt(input,output,length,schedule,ivec,encrypt) +des_cblock *input; +des_cblock *output; +long length; +des_key_schedule schedule; +des_cblock *ivec; +int encrypt; +.PP +.B int des_cfb_encrypt(input,output,numbits,length,schedule,ivec,encrypt) +unsigned char *input; +unsigned char *output; +int numbits; +long length; +des_key_schedule schedule; +des_cblock *ivec; +int encrypt; +.PP +.B int des_ofb_encrypt(input,output,numbits,length,schedule,ivec) +unsigned char *input,*output; +int numbits; +long length; +des_key_schedule schedule; +des_cblock *ivec; +.PP +.B unsigned long des_cbc_cksum(input,output,length,schedule,ivec) +des_cblock *input; +des_cblock *output; +long length; +des_key_schedule schedule; +des_cblock *ivec; +.PP +.B unsigned long des_quad_cksum(input,output,length,out_count,seed) +des_cblock *input; +des_cblock *output; +long length; +int out_count; +des_cblock *seed; +.PP +.B int des_check_key; +.PP +.B int des_enc_read(fd,buf,len,sched,iv) +int fd; +char *buf; +int len; +des_key_schedule sched; +des_cblock *iv; +.PP +.B int des_enc_write(fd,buf,len,sched,iv) +int fd; +char *buf; +int len; +des_key_schedule sched; +des_cblock *iv; +.PP +.B extern int des_rw_mode; +.PP +.B void des_set_odd_parity(key) +des_cblock *key; +.PP +.B int des_is_weak_key(key) +des_cblock *key; +.PP +.B char *crypt(passwd,salt) +char *passwd; +char *salt; +.PP +.fi +.SH DESCRIPTION +This library contains a fast implementation of the DES encryption +algorithm. +.PP +There are two phases to the use of DES encryption. +The first is the generation of a +.I des_key_schedule +from a key, +the second is the actual encryption. +A des key is of type +.I des_cblock. +This type is made from 8 characters with odd parity. +The least significant bit in the character is the parity bit. +The key schedule is an expanded form of the key; it is used to speed the +encryption process. +.PP +.I des_read_password +writes the string specified by prompt to the standard output, +turns off echo and reads an input string from standard input +until terminated with a newline. +If verify is non-zero, it prompts and reads the input again and verifies +that both entered passwords are the same. +The entered string is converted into a des key by using the +.I des_string_to_key +routine. +The new key is placed in the +.I des_cblock +that was passed (by reference) to the routine. +If there were no errors, +.I des_read_password +returns 0, +-1 is returned if there was a terminal error and 1 is returned for +any other error. +.PP +.I des_read_2password +operates in the same way as +.I des_read_password +except that it generates 2 keys by using the +.I des_string_to_2key +function. +.PP +.I des_read_pw_string +is called by +.I des_read_password +to read and verify a string from a terminal device. +The string is returned in +.I buf. +The size of +.I buf +is passed to the routine via the +.I length +parameter. +.PP +.I des_string_to_key +converts a string into a valid des key. +.PP +.I des_string_to_2key +converts a string into 2 valid des keys. +This routine is best suited for used to generate keys for use with +.I des_ecb3_encrypt. +.PP +.I des_random_key +returns a random key that is made of a combination of process id, +time and an increasing counter. +.PP +Before a des key can be used it is converted into a +.I des_key_schedule +via the +.I des_set_key +routine. +If the +.I des_check_key +flag is non-zero, +.I des_set_key +will check that the key passed is of odd parity and is not a week or +semi-weak key. +If the parity is wrong, +then -1 is returned. +If the key is a weak key, +then -2 is returned. +If an error is returned, +the key schedule is not generated. +.PP +.I des_key_sched +is another name for the +.I des_set_key +function. +.PP +The following routines mostly operate on an input and output stream of +.I des_cblock's. +.PP +.I des_ecb_encrypt +is the basic DES encryption routine that encrypts or decrypts a single 8-byte +.I des_cblock +in +.I electronic code book +mode. +It always transforms the input data, pointed to by +.I input, +into the output data, +pointed to by the +.I output +argument. +If the +.I encrypt +argument is non-zero (DES_ENCRYPT), +the +.I input +(cleartext) is encrypted in to the +.I output +(ciphertext) using the key_schedule specified by the +.I schedule +argument, +previously set via +.I des_set_key. +If +.I encrypt +is zero (DES_DECRYPT), +the +.I input +(now ciphertext) +is decrypted into the +.I output +(now cleartext). +Input and output may overlap. +No meaningful value is returned. +.PP +.I des_ecb3_encrypt +encrypts/decrypts the +.I input +block by using triple ecb DES encryption. +This involves encrypting the input with +.I ks1, +decryption with the key schedule +.I ks2, +and then encryption with the first again. +This routine greatly reduces the chances of brute force breaking of +DES and has the advantage of if +.I ks1 +and +.I ks2 +are the same, it is equivalent to just encryption using ecb mode and +.I ks1 +as the key. +.PP +.I des_cbc_encrypt +encrypts/decrypts using the +.I cipher-block-chaining +mode of DES. +If the +.I encrypt +argument is non-zero, +the routine cipher-block-chain encrypts the cleartext data pointed to by the +.I input +argument into the ciphertext pointed to by the +.I output +argument, +using the key schedule provided by the +.I schedule +argument, +and initialisation vector provided by the +.I ivec +argument. +If the +.I length +argument is not an integral multiple of eight bytes, +the last block is copied to a temporary area and zero filled. +The output is always +an integral multiple of eight bytes. +To make multiple cbc encrypt calls on a large amount of data appear to +be one +.I des_cbc_encrypt +call, the +.I ivec +of subsequent calls should be the last 8 bytes of the output. +.PP +.I des_3cbc_encrypt +encrypts/decrypts the +.I input +block by using triple cbc DES encryption. +This involves encrypting the input with key schedule +.I ks1, +decryption with the key schedule +.I ks2, +and then encryption with the first again. +2 initialisation vectors are required, +.I ivec1 +and +.I ivec2. +Unlike +.I des_cbc_encrypt, +these initialisation vectors are modified by the subroutine. +This routine greatly reduces the chances of brute force breaking of +DES and has the advantage of if +.I ks1 +and +.I ks2 +are the same, it is equivalent to just encryption using cbc mode and +.I ks1 +as the key. +.PP +.I des_pcbc_encrypt +encrypt/decrypts using a modified block chaining mode. +It provides better error propagation characteristics than cbc +encryption. +.PP +.I des_cfb_encrypt +encrypt/decrypts using cipher feedback mode. This method takes an +array of characters as input and outputs and array of characters. It +does not require any padding to 8 character groups. Note: the ivec +variable is changed and the new changed value needs to be passed to +the next call to this function. Since this function runs a complete +DES ecb encryption per numbits, this function is only suggested for +use when sending small numbers of characters. +.PP +.I des_ofb_encrypt +encrypt using output feedback mode. This method takes an +array of characters as input and outputs and array of characters. It +does not require any padding to 8 character groups. Note: the ivec +variable is changed and the new changed value needs to be passed to +the next call to this function. Since this function runs a complete +DES ecb encryption per numbits, this function is only suggested for +use when sending small numbers of characters. +.PP +.I des_cbc_cksum +produces an 8 byte checksum based on the input stream (via cbc encryption). +The last 4 bytes of the checksum is returned and the complete 8 bytes is +placed in +.I output. +.PP +.I des_quad_cksum +returns a 4 byte checksum from the input bytes. +The algorithm can be iterated over the input, +depending on +.I out_count, +1, 2, 3 or 4 times. +If +.I output +is non-NULL, +the 8 bytes generated by each pass are written into +.I output. +.PP +.I des_enc_write +is used to write +.I len +bytes +to file descriptor +.I fd +from buffer +.I buf. +The data is encrypted via +.I pcbc_encrypt +(default) using +.I sched +for the key and +.I iv +as a starting vector. +The actual data send down +.I fd +consists of 4 bytes (in network byte order) containing the length of the +following encrypted data. The encrypted data then follows, padded with random +data out to a multiple of 8 bytes. +.PP +.I des_enc_read +is used to read +.I len +bytes +from file descriptor +.I fd +into buffer +.I buf. +The data being read from +.I fd +is assumed to have come from +.I des_enc_write +and is decrypted using +.I sched +for the key schedule and +.I iv +for the initial vector. +The +.I des_enc_read/des_enc_write +pair can be used to read/write to files, pipes and sockets. +I have used them in implementing a version of rlogin in which all +data is encrypted. +.PP +.I des_rw_mode +is used to specify the encryption mode to use with +.I des_enc_read +and +.I des_end_write. +If set to +.I DES_PCBC_MODE +(the default), des_pcbc_encrypt is used. +If set to +.I DES_CBC_MODE +des_cbc_encrypt is used. +These two routines and the variable are not part of the normal MIT library. +.PP +.I des_set_odd_parity +sets the parity of the passed +.I key +to odd. This routine is not part of the standard MIT library. +.PP +.I des_is_weak_key +returns 1 is the passed key is a weak key (pick again :-), +0 if it is ok. +This routine is not part of the standard MIT library. +.PP +.I crypt +is a replacement for the normal system crypt. +It is much faster than the system crypt. +.PP +.SH FILES +/usr/include/des.h +.br +/usr/lib/libdes.a +.PP +The encryption routines have been tested on 16bit, 32bit and 64bit +machines of various endian and even works under VMS. +.PP +.SH BUGS +.PP +If you think this manual is sparse, +read the des_crypt(3) manual from the MIT kerberos (or bones outside +of the USA) distribution. +.PP +.I des_cfb_encrypt +and +.I des_ofb_encrypt +operates on input of 8 bits. What this means is that if you set +numbits to 12, and length to 2, the first 12 bits will come from the 1st +input byte and the low half of the second input byte. The second 12 +bits will have the low 8 bits taken from the 3rd input byte and the +top 4 bits taken from the 4th input byte. The same holds for output. +This function has been implemented this way because most people will +be using a multiple of 8 and because once you get into pulling bytes input +bytes apart things get ugly! +.PP +.I des_read_pw_string +is the most machine/OS dependent function and normally generates the +most problems when porting this code. +.PP +.I des_string_to_key +is probably different from the MIT version since there are lots +of fun ways to implement one-way encryption of a text string. +.PP +The routines are optimised for 32 bit machines and so are not efficient +on IBM PCs. +.PP +NOTE: extensive work has been done on this library since this document +was origionally written. Please try to read des.doc from the libdes +distribution since it is far more upto date and documents more of the +functions. Libdes is now also being shipped as part of SSLeay, a +general cryptographic library that amonst other things implements +netscapes SSL protocoll. The most recent version can be found in +SSLeay distributions. +.SH AUTHOR +Eric Young (eay@cryptsoft.com) diff --git a/src/lib/libcrypto/des/des_locl.org b/src/lib/libcrypto/des/des_locl.org new file mode 100644 index 0000000000..e2e503cbed --- /dev/null +++ b/src/lib/libcrypto/des/des_locl.org @@ -0,0 +1,516 @@ +/* crypto/des/des_locl.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify des_locl.org since des_locl.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +#ifndef HEADER_DES_LOCL_H +#define HEADER_DES_LOCL_H + +#if defined(WIN32) || defined(WIN16) +#ifndef MSDOS +#define MSDOS +#endif +#endif + +#include <stdio.h> +#include <stdlib.h> +#ifndef MSDOS +#include <unistd.h> +#endif +#include "des.h" + +#ifndef DES_DEFAULT_OPTIONS +/* the following is tweaked from a config script, that is why it is a + * protected undef/define */ +#ifndef DES_PTR +#undef DES_PTR +#endif + +/* This helps C compiler generate the correct code for multiple functional + * units. It reduces register dependancies at the expense of 2 more + * registers */ +#ifndef DES_RISC1 +#undef DES_RISC1 +#endif + +#ifndef DES_RISC2 +#undef DES_RISC2 +#endif + +#if defined(DES_RISC1) && defined(DES_RISC2) +YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! +#endif + +/* Unroll the inner loop, this sometimes helps, sometimes hinders. + * Very mucy CPU dependant */ +#ifndef DES_UNROLL +#undef DES_UNROLL +#endif + +/* These default values were supplied by + * Peter Gutman <pgut001@cs.auckland.ac.nz> + * They are only used if nothing else has been defined */ +#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined( sun ) /* Newer Sparc's */ + #define DES_PTR + #define DES_RISC1 + #define DES_UNROLL +#elif defined( __ultrix ) /* Older MIPS */ + #define DES_PTR + #define DES_RISC2 + #define DES_UNROLL +#elif defined( __osf1__ ) /* Alpha */ + #define DES_PTR + #define DES_RISC2 +#elif defined ( _AIX ) /* RS6000 */ + /* Unknown */ +#elif defined( __hpux ) /* HP-PA */ + /* Unknown */ +#elif defined( __aux ) /* 68K */ + /* Unknown */ +#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ + #define DES_UNROLL +#elif defined( __sgi ) /* Newer MIPS */ + #define DES_PTR + #define DES_RISC2 + #define DES_UNROLL +#elif defined( i386 ) /* x86 boxes, should be gcc */ + #define DES_PTR + #define DES_RISC1 + #define DES_UNROLL +#endif /* Systems-specific speed defines */ +#endif + +#endif /* DES_DEFAULT_OPTIONS */ + +#ifdef MSDOS /* Visual C++ 2.1 (Windows NT/95) */ +#include <stdlib.h> +#include <errno.h> +#include <time.h> +#include <io.h> +#ifndef RAND +#define RAND +#endif +#undef NOPROTO +#endif + +#if defined(__STDC__) || defined(VMS) || defined(M_XENIX) || defined(MSDOS) +#include <string.h> +#endif + +#ifndef RAND +#define RAND +#endif + +#ifdef linux +#undef RAND +#endif + +#ifdef MSDOS +#define getpid() 2 +#define RAND +#undef NOPROTO +#endif + +#if defined(NOCONST) +#define const +#endif + +#ifdef __STDC__ +#undef NOPROTO +#endif + +#ifdef RAND +#define srandom(s) srand(s) +#define random rand +#endif + +#define ITERATIONS 16 +#define HALF_ITERATIONS 8 + +/* used in des_read and des_write */ +#define MAXWRITE (1024*16) +#define BSIZE (MAXWRITE+4) + +#define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \ + l|=((DES_LONG)(*((c)++)))<< 8L, \ + l|=((DES_LONG)(*((c)++)))<<16L, \ + l|=((DES_LONG)(*((c)++)))<<24L) + +/* NOTE - c is not incremented as per c2l */ +#define c2ln(c,l1,l2,n) { \ + c+=n; \ + l1=l2=0; \ + switch (n) { \ + case 8: l2 =((DES_LONG)(*(--(c))))<<24L; \ + case 7: l2|=((DES_LONG)(*(--(c))))<<16L; \ + case 6: l2|=((DES_LONG)(*(--(c))))<< 8L; \ + case 5: l2|=((DES_LONG)(*(--(c)))); \ + case 4: l1 =((DES_LONG)(*(--(c))))<<24L; \ + case 3: l1|=((DES_LONG)(*(--(c))))<<16L; \ + case 2: l1|=((DES_LONG)(*(--(c))))<< 8L; \ + case 1: l1|=((DES_LONG)(*(--(c)))); \ + } \ + } + +#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>24L)&0xff)) + +/* replacements for htonl and ntohl since I have no idea what to do + * when faced with machines with 8 byte longs. */ +#define HDRSIZE 4 + +#define n2l(c,l) (l =((DES_LONG)(*((c)++)))<<24L, \ + l|=((DES_LONG)(*((c)++)))<<16L, \ + l|=((DES_LONG)(*((c)++)))<< 8L, \ + l|=((DES_LONG)(*((c)++)))) + +#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ + *((c)++)=(unsigned char)(((l) )&0xff)) + +/* NOTE - c is not incremented as per l2c */ +#define l2cn(l1,l2,c,n) { \ + c+=n; \ + switch (n) { \ + case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ + case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ + case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ + case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ + case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ + case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ + case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ + case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ + } \ + } + +#if defined(WIN32) +#define ROTATE(a,n) (_lrotr(a,n)) +#else +#define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) +#endif + +/* Don't worry about the LOAD_DATA() stuff, that is used by + * fcrypt() to add it's little bit to the front */ + +#ifdef DES_FCRYPT + +#define LOAD_DATA_tmp(R,S,u,t,E0,E1) \ + { DES_LONG tmp; LOAD_DATA(R,S,u,t,E0,E1,tmp); } + +#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ + t=R^(R>>16L); \ + u=t&E0; t&=E1; \ + tmp=(u<<16); u^=R^s[S ]; u^=tmp; \ + tmp=(t<<16); t^=R^s[S+1]; t^=tmp +#else +#define LOAD_DATA_tmp(a,b,c,d,e,f) LOAD_DATA(a,b,c,d,e,f,g) +#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ + u=R^s[S ]; \ + t=R^s[S+1] +#endif + +/* The changes to this macro may help or hinder, depending on the + * compiler and the achitecture. gcc2 always seems to do well :-). + * Inspired by Dana How <how@isl.stanford.edu> + * DO NOT use the alternative version on machines with 8 byte longs. + * It does not seem to work on the Alpha, even when DES_LONG is 4 + * bytes, probably an issue of accessing non-word aligned objects :-( */ +#ifdef DES_PTR + +/* It recently occured to me that 0^0^0^0^0^0^0 == 0, so there + * is no reason to not xor all the sub items together. This potentially + * saves a register since things can be xored directly into L */ + +#if defined(DES_RISC1) || defined(DES_RISC2) +#ifdef DES_RISC1 +#define D_ENCRYPT(LL,R,S) { \ + unsigned int u1,u2,u3; \ + LOAD_DATA(R,S,u,t,E0,E1,u1); \ + u2=(int)u>>8L; \ + u1=(int)u&0xfc; \ + u2&=0xfc; \ + t=ROTATE(t,4); \ + u>>=16L; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \ + u3=(int)(u>>8L); \ + u1=(int)u&0xfc; \ + u3&=0xfc; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+u3); \ + u2=(int)t>>8L; \ + u1=(int)t&0xfc; \ + u2&=0xfc; \ + t>>=16L; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \ + u3=(int)t>>8L; \ + u1=(int)t&0xfc; \ + u3&=0xfc; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+u3); } +#endif +#ifdef DES_RISC2 +#define D_ENCRYPT(LL,R,S) { \ + unsigned int u1,u2,s1,s2; \ + LOAD_DATA(R,S,u,t,E0,E1,u1); \ + u2=(int)u>>8L; \ + u1=(int)u&0xfc; \ + u2&=0xfc; \ + t=ROTATE(t,4); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \ + s1=(int)(u>>16L); \ + s2=(int)(u>>24L); \ + s1&=0xfc; \ + s2&=0xfc; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+s1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+s2); \ + u2=(int)t>>8L; \ + u1=(int)t&0xfc; \ + u2&=0xfc; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \ + s1=(int)(t>>16L); \ + s2=(int)(t>>24L); \ + s1&=0xfc; \ + s2&=0xfc; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+s1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+s2); } +#endif +#else +#define D_ENCRYPT(LL,R,S) { \ + LOAD_DATA_tmp(R,S,u,t,E0,E1); \ + t=ROTATE(t,4); \ + LL^= \ + *(DES_LONG *)((unsigned char *)des_SP +((u )&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x200+((u>> 8L)&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x400+((u>>16L)&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x600+((u>>24L)&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x100+((t )&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x300+((t>> 8L)&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x500+((t>>16L)&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x700+((t>>24L)&0xfc)); } +#endif + +#else /* original version */ + +#if defined(DES_RISC1) || defined(DES_RISC2) +#ifdef DES_RISC1 +#define D_ENCRYPT(LL,R,S) {\ + unsigned int u1,u2,u3; \ + LOAD_DATA(R,S,u,t,E0,E1,u1); \ + u>>=2L; \ + t=ROTATE(t,6); \ + u2=(int)u>>8L; \ + u1=(int)u&0x3f; \ + u2&=0x3f; \ + u>>=16L; \ + LL^=des_SPtrans[0][u1]; \ + LL^=des_SPtrans[2][u2]; \ + u3=(int)u>>8L; \ + u1=(int)u&0x3f; \ + u3&=0x3f; \ + LL^=des_SPtrans[4][u1]; \ + LL^=des_SPtrans[6][u3]; \ + u2=(int)t>>8L; \ + u1=(int)t&0x3f; \ + u2&=0x3f; \ + t>>=16L; \ + LL^=des_SPtrans[1][u1]; \ + LL^=des_SPtrans[3][u2]; \ + u3=(int)t>>8L; \ + u1=(int)t&0x3f; \ + u3&=0x3f; \ + LL^=des_SPtrans[5][u1]; \ + LL^=des_SPtrans[7][u3]; } +#endif +#ifdef DES_RISC2 +#define D_ENCRYPT(LL,R,S) {\ + unsigned int u1,u2,s1,s2; \ + LOAD_DATA(R,S,u,t,E0,E1,u1); \ + u>>=2L; \ + t=ROTATE(t,6); \ + u2=(int)u>>8L; \ + u1=(int)u&0x3f; \ + u2&=0x3f; \ + LL^=des_SPtrans[0][u1]; \ + LL^=des_SPtrans[2][u2]; \ + s1=(int)u>>16L; \ + s2=(int)u>>24L; \ + s1&=0x3f; \ + s2&=0x3f; \ + LL^=des_SPtrans[4][s1]; \ + LL^=des_SPtrans[6][s2]; \ + u2=(int)t>>8L; \ + u1=(int)t&0x3f; \ + u2&=0x3f; \ + LL^=des_SPtrans[1][u1]; \ + LL^=des_SPtrans[3][u2]; \ + s1=(int)t>>16; \ + s2=(int)t>>24L; \ + s1&=0x3f; \ + s2&=0x3f; \ + LL^=des_SPtrans[5][s1]; \ + LL^=des_SPtrans[7][s2]; } +#endif + +#else + +#define D_ENCRYPT(LL,R,S) {\ + LOAD_DATA_tmp(R,S,u,t,E0,E1); \ + t=ROTATE(t,4); \ + LL^=\ + des_SPtrans[0][(u>> 2L)&0x3f]^ \ + des_SPtrans[2][(u>>10L)&0x3f]^ \ + des_SPtrans[4][(u>>18L)&0x3f]^ \ + des_SPtrans[6][(u>>26L)&0x3f]^ \ + des_SPtrans[1][(t>> 2L)&0x3f]^ \ + des_SPtrans[3][(t>>10L)&0x3f]^ \ + des_SPtrans[5][(t>>18L)&0x3f]^ \ + des_SPtrans[7][(t>>26L)&0x3f]; } +#endif +#endif + + /* IP and FP + * The problem is more of a geometric problem that random bit fiddling. + 0 1 2 3 4 5 6 7 62 54 46 38 30 22 14 6 + 8 9 10 11 12 13 14 15 60 52 44 36 28 20 12 4 + 16 17 18 19 20 21 22 23 58 50 42 34 26 18 10 2 + 24 25 26 27 28 29 30 31 to 56 48 40 32 24 16 8 0 + + 32 33 34 35 36 37 38 39 63 55 47 39 31 23 15 7 + 40 41 42 43 44 45 46 47 61 53 45 37 29 21 13 5 + 48 49 50 51 52 53 54 55 59 51 43 35 27 19 11 3 + 56 57 58 59 60 61 62 63 57 49 41 33 25 17 9 1 + + The output has been subject to swaps of the form + 0 1 -> 3 1 but the odd and even bits have been put into + 2 3 2 0 + different words. The main trick is to remember that + t=((l>>size)^r)&(mask); + r^=t; + l^=(t<<size); + can be used to swap and move bits between words. + + So l = 0 1 2 3 r = 16 17 18 19 + 4 5 6 7 20 21 22 23 + 8 9 10 11 24 25 26 27 + 12 13 14 15 28 29 30 31 + becomes (for size == 2 and mask == 0x3333) + t = 2^16 3^17 -- -- l = 0 1 16 17 r = 2 3 18 19 + 6^20 7^21 -- -- 4 5 20 21 6 7 22 23 + 10^24 11^25 -- -- 8 9 24 25 10 11 24 25 + 14^28 15^29 -- -- 12 13 28 29 14 15 28 29 + + Thanks for hints from Richard Outerbridge - he told me IP&FP + could be done in 15 xor, 10 shifts and 5 ands. + When I finally started to think of the problem in 2D + I first got ~42 operations without xors. When I remembered + how to use xors :-) I got it to its final state. + */ +#define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\ + (b)^=(t),\ + (a)^=((t)<<(n))) + +#define IP(l,r) \ + { \ + register DES_LONG tt; \ + PERM_OP(r,l,tt, 4,0x0f0f0f0fL); \ + PERM_OP(l,r,tt,16,0x0000ffffL); \ + PERM_OP(r,l,tt, 2,0x33333333L); \ + PERM_OP(l,r,tt, 8,0x00ff00ffL); \ + PERM_OP(r,l,tt, 1,0x55555555L); \ + } + +#define FP(l,r) \ + { \ + register DES_LONG tt; \ + PERM_OP(l,r,tt, 1,0x55555555L); \ + PERM_OP(r,l,tt, 8,0x00ff00ffL); \ + PERM_OP(l,r,tt, 2,0x33333333L); \ + PERM_OP(r,l,tt,16,0x0000ffffL); \ + PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \ + } + +extern const DES_LONG des_SPtrans[8][64]; + +#ifndef NOPROTO +void fcrypt_body(DES_LONG *out,des_key_schedule ks, + DES_LONG Eswap0, DES_LONG Eswap1); +#else +void fcrypt_body(); +#endif + +#endif diff --git a/src/lib/libcrypto/des/doIP b/src/lib/libcrypto/des/doIP new file mode 100644 index 0000000000..18cf231303 --- /dev/null +++ b/src/lib/libcrypto/des/doIP @@ -0,0 +1,46 @@ +#!/usr/local/bin/perl + +@l=( + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23, + 24,25,26,27,28,29,30,31 + ); +@r=( + 32,33,34,35,36,37,38,39, + 40,41,42,43,44,45,46,47, + 48,49,50,51,52,53,54,55, + 56,57,58,59,60,61,62,63 + ); + +require 'shifts.pl'; + +sub PERM_OP + { + local(*a,*b,*t,$n,$m)=@_; + + @z=&shift(*a,-$n); + @z=&xor(*b,*z); + @z=&and(*z,$m); + @b=&xor(*b,*z); + @z=&shift(*z,$n); + @a=&xor(*a,*z); + } + + +@L=@l; +@R=@r; +&PERM_OP(*R,*L,*T,4,0x0f0f0f0f); +&PERM_OP(*L,*R,*T,16,0x0000ffff); +&PERM_OP(*R,*L,*T,2,0x33333333); +&PERM_OP(*L,*R,*T,8,0x00ff00ff); +&PERM_OP(*R,*L,*T,1,0x55555555); + &printit(@L); + &printit(@R); +&PERM_OP(*R,*L,*T,1,0x55555555); +&PERM_OP(*L,*R,*T,8,0x00ff00ff); +&PERM_OP(*R,*L,*T,2,0x33333333); +&PERM_OP(*L,*R,*T,16,0x0000ffff); +&PERM_OP(*R,*L,*T,4,0x0f0f0f0f); + &printit(@L); + &printit(@R); diff --git a/src/lib/libcrypto/des/doPC1 b/src/lib/libcrypto/des/doPC1 new file mode 100644 index 0000000000..096afd8c46 --- /dev/null +++ b/src/lib/libcrypto/des/doPC1 @@ -0,0 +1,110 @@ +#!/usr/local/bin/perl + +@l=( + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23, + 24,25,26,27,28,29,30,31 + ); +@r=( + 32,33,34,35,36,37,38,39, + 40,41,42,43,44,45,46,47, + 48,49,50,51,52,53,54,55, + 56,57,58,59,60,61,62,63 + ); + +require 'shifts.pl'; + +sub PERM_OP + { + local(*a,*b,*t,$n,$m)=@_; + + @z=&shift(*a,-$n); + @z=&xor(*b,*z); + @z=&and(*z,$m); + @b=&xor(*b,*z); + @z=&shift(*z,$n); + @a=&xor(*a,*z); + } + +sub HPERM_OP2 + { + local(*a,*t,$n,$m)=@_; + local(@x,@y,$i); + + @z=&shift(*a,16-$n); + @z=&xor(*a,*z); + @z=&and(*z,$m); + @a=&xor(*a,*z); + @z=&shift(*z,$n-16); + @a=&xor(*a,*z); + } + +sub HPERM_OP + { + local(*a,*t,$n,$m)=@_; + local(@x,@y,$i); + + for ($i=0; $i<16; $i++) + { + $x[$i]=$a[$i]; + $y[$i]=$a[16+$i]; + } + @z=&shift(*x,-$n); + @z=&xor(*y,*z); + @z=&and(*z,$m); + @y=&xor(*y,*z); + @z=&shift(*z,$n); + @x=&xor(*x,*z); + for ($i=0; $i<16; $i++) + { + $a[$i]=$x[$i]; + $a[16+$i]=$y[$i]; + } + } + +@L=@l; +@R=@r; + + print "---\n"; &printit(@R); +&PERM_OP(*R,*L,*T,4,0x0f0f0f0f); + print "---\n"; &printit(@R); +&HPERM_OP2(*L,*T,-2,0xcccc0000); +&HPERM_OP2(*R,*T,-2,0xcccc0000); + print "---\n"; &printit(@R); +&PERM_OP(*R,*L,*T,1,0x55555555); + print "---\n"; &printit(@R); +&PERM_OP(*L,*R,*T,8,0x00ff00ff); + print "---\n"; &printit(@R); +&PERM_OP(*R,*L,*T,1,0x55555555); + print "---\n"; &printit(@R); +# &printit(@L); + &printit(@R); +print <<"EOF"; +============================== +63 55 47 39 31 23 15 7 +62 54 46 38 30 22 14 6 +61 53 45 37 29 21 13 5 +60 52 44 36 -- -- -- -- + +57 49 41 33 25 17 9 1 +58 50 42 34 26 18 10 2 +59 51 43 35 27 19 11 3 +28 20 12 4 -- -- -- -- +EOF +exit(1); +@A=&and(*R,0x000000ff); +@A=&shift(*A,16); +@B=&and(*R,0x0000ff00); +@C=&and(*R,0x00ff0000); +@C=&shift(*C,-16); +@D=&and(*L,0xf0000000); +@D=&shift(*D,-4); +@A=&or(*A,*B); +@B=&or(*D,*C); +@R=&or(*A,*B); +@L=&and(*L,0x0fffffff); + + &printit(@L); + &printit(@R); + diff --git a/src/lib/libcrypto/des/doPC2 b/src/lib/libcrypto/des/doPC2 new file mode 100644 index 0000000000..fa5cf74cf7 --- /dev/null +++ b/src/lib/libcrypto/des/doPC2 @@ -0,0 +1,94 @@ +#!/usr/local/bin/perl + +@PC2_C=(14,17,11,24, 1, 5, + 3,28,15, 6,21,10, + 23,19,12, 4,26, 8, + 16, 7,27,20,13, 2, + ); + +@PC2_D=(41,52,31,37,47,55, + 30,40,51,45,33,48, + 44,49,39,56,34,53, + 46,42,50,36,29,32, + ); + +$i=0; +foreach (@PC2_C) { + $_--; +# printf "%2d,",$_; + $C{$_}=$i; + ++$i; +# print "\n" if ((($i) % 8) == 0); + } +$i=0; +#print "\n"; +foreach (@PC2_D) { + $_-=28; + $_--; +# printf "%2d,",$_; + $D{$_}=$i; + $i++; +# print "\n" if ((($i) % 8) == 0); + } + +#print "\n"; +foreach $i (0 .. 27) + { + $_=$C{$i}; +# printf "%2d,",$_; + $i++; +# print "\n" if ((($i) % 8) == 0); + } +#print "\n"; + +#print "\n"; +foreach $i (0 .. 27) + { + $_=$D{$i}; +# printf "%2d,",$_; + $i++; +# print "\n" if ((($i) % 8) == 0); + } +#print "\n"; + +print "static ulong skb[8][64]={\n"; +&doit("C",*C, 0, 1, 2, 3, 4, 5); +&doit("C",*C, 6, 7, 9,10,11,12); +&doit("C",*C,13,14,15,16,18,19); +&doit("C",*C,20,22,23,25,26,27); + +&doit("D",*D, 0, 1, 2, 3, 4, 5); +&doit("D",*D, 7, 8,10,11,12,13); +&doit("D",*D,15,16,17,18,19,20); +&doit("D",*D,21,22,23,24,26,27); +print "};\n"; + +sub doit + { + local($l,*A,@b)=@_; + local(@out); + + printf("/* for $l bits (numbered as per FIPS 46) %d %d %d %d %d %d */\n", + $b[0]+1, $b[1]+1, $b[2]+1, $b[3]+1, $b[4]+1, $b[5]+1); + for ($i=0; $i<64; $i++) + { + $out[$i]=0; + $j=1; +#print "\n"; + for ($k=0; $k<6; $k++) + { + $l=$A{$b[$k]}; +#print"$l - "; + if ((1<<$k) & $i) + { + $ll=int($l/6)*8+($l%6); + $out[$i]|=1<<($ll); + } + } + $pp=$out[$i]; + $pp=($pp&0xff0000ff)| (($pp&0x00ff0000)>>8)| + (($pp&0x0000ff00)<<8); + printf("0x%08X,",$pp); + print "\n" if (($i+1) % 4 == 0); + } + } diff --git a/src/lib/libcrypto/des/ede_enc.c b/src/lib/libcrypto/des/ede_enc.c new file mode 100644 index 0000000000..9f75dd1037 --- /dev/null +++ b/src/lib/libcrypto/des/ede_enc.c @@ -0,0 +1,190 @@ +/* crypto/des/ede_enc.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include "des_locl.h" + +void des_ede3_cbc_encrypt(input, output, length, ks1, ks2, ks3, ivec, enc) +des_cblock (*input); +des_cblock (*output); +long length; +des_key_schedule ks1; +des_key_schedule ks2; +des_key_schedule ks3; +des_cblock (*ivec); +int enc; + { + register DES_LONG tin0,tin1; + register DES_LONG tout0,tout1,xor0,xor1; + register unsigned char *in,*out; + register long l=length; + DES_LONG tin[2]; + unsigned char *iv; + + in=(unsigned char *)input; + out=(unsigned char *)output; + iv=(unsigned char *)ivec; + + if (enc) + { + c2l(iv,tout0); + c2l(iv,tout1); + for (l-=8; l>=0; l-=8) + { + c2l(in,tin0); + c2l(in,tin1); + tin0^=tout0; + tin1^=tout1; + + tin[0]=tin0; + tin[1]=tin1; + des_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); + tout0=tin[0]; + tout1=tin[1]; + + l2c(tout0,out); + l2c(tout1,out); + } + if (l != -8) + { + c2ln(in,tin0,tin1,l+8); + tin0^=tout0; + tin1^=tout1; + + tin[0]=tin0; + tin[1]=tin1; + des_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); + tout0=tin[0]; + tout1=tin[1]; + + l2c(tout0,out); + l2c(tout1,out); + } + iv=(unsigned char *)ivec; + l2c(tout0,iv); + l2c(tout1,iv); + } + else + { + register DES_LONG t0,t1; + + c2l(iv,xor0); + c2l(iv,xor1); + for (l-=8; l>=0; l-=8) + { + c2l(in,tin0); + c2l(in,tin1); + + t0=tin0; + t1=tin1; + + tin[0]=tin0; + tin[1]=tin1; + des_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); + tout0=tin[0]; + tout1=tin[1]; + + tout0^=xor0; + tout1^=xor1; + l2c(tout0,out); + l2c(tout1,out); + xor0=t0; + xor1=t1; + } + if (l != -8) + { + c2l(in,tin0); + c2l(in,tin1); + + t0=tin0; + t1=tin1; + + tin[0]=tin0; + tin[1]=tin1; + des_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); + tout0=tin[0]; + tout1=tin[1]; + + tout0^=xor0; + tout1^=xor1; + l2cn(tout0,tout1,out,l+8); + xor0=t0; + xor1=t1; + } + + iv=(unsigned char *)ivec; + l2c(xor0,iv); + l2c(xor1,iv); + } + tin0=tin1=tout0=tout1=xor0=xor1=0; + tin[0]=tin[1]=0; + } + +#ifdef undef /* MACRO */ +void des_ede2_cbc_encrypt(input, output, length, ks1, ks2, ivec, enc) +des_cblock (*input); +des_cblock (*output); +long length; +des_key_schedule ks1; +des_key_schedule ks2; +des_cblock (*ivec); +int enc; + { + des_ede3_cbc_encrypt(input,output,length,ks1,ks2,ks1,ivec,enc); + } +#endif + diff --git a/src/lib/libcrypto/des/podd.h b/src/lib/libcrypto/des/podd.h new file mode 100644 index 0000000000..1b2bfe0843 --- /dev/null +++ b/src/lib/libcrypto/des/podd.h @@ -0,0 +1,75 @@ +/* crypto/des/podd.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +static const unsigned char odd_parity[256]={ + 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, + 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31, + 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47, + 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62, + 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79, + 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94, + 97, 97, 98, 98,100,100,103,103,104,104,107,107,109,109,110,110, +112,112,115,115,117,117,118,118,121,121,122,122,124,124,127,127, +128,128,131,131,133,133,134,134,137,137,138,138,140,140,143,143, +145,145,146,146,148,148,151,151,152,152,155,155,157,157,158,158, +161,161,162,162,164,164,167,167,168,168,171,171,173,173,174,174, +176,176,179,179,181,181,182,182,185,185,186,186,188,188,191,191, +193,193,194,194,196,196,199,199,200,200,203,203,205,205,206,206, +208,208,211,211,213,213,214,214,217,217,218,218,220,220,223,223, +224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239, +241,241,242,242,244,244,247,247,248,248,251,251,253,253,254,254}; diff --git a/src/lib/libcrypto/des/ranlib.sh b/src/lib/libcrypto/des/ranlib.sh new file mode 100644 index 0000000000..543f712c6b --- /dev/null +++ b/src/lib/libcrypto/des/ranlib.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +cwd=`pwd` +cd /tmp + +if [ -s /bin/ranlib ] ; then + RL=/bin/ranlib +else if [ -s /usr/bin/ranlib ] ; then + RL=/usr/bin/ranlib +fi +fi + +if [ "x$RL" != "x" ] +then + case "$1" in + /*) + $RL "$1" + ;; + *) + $RL "$cwd/$1" + ;; + esac +fi diff --git a/src/lib/libcrypto/des/shifts.pl b/src/lib/libcrypto/des/shifts.pl new file mode 100644 index 0000000000..d8a240c1ba --- /dev/null +++ b/src/lib/libcrypto/des/shifts.pl @@ -0,0 +1,198 @@ +#!/usr/bin/perl + +sub lab_shift + { + local(*a,$n)=@_; + local(@r,$i,$j,$k,$d,@z); + + @r=&shift(*a,$n); + foreach $i (0 .. 31) + { + @z=split(/\^/,$r[$i]); + for ($j=0; $j <= $#z; $j++) + { + ($d)=($z[$j] =~ /^(..)/); + ($k)=($z[$j] =~ /\[(.*)\]$/); + $k.=",$n" if ($k ne ""); + $k="$n" if ($k eq ""); + $d="$d[$k]"; + $z[$j]=$d; + } + $r[$i]=join('^',@z); + } + return(@r); + } + +sub shift + { + local(*a,$n)=@_; + local(@f); + + if ($n > 0) + { + @f=&shiftl(*a,$n); + } + else + { + @f=&shiftr(*a,-$n); + } + return(@f); + } + +sub rotate + { + local(*a,$n)=@_; + local(@f); + + if ($n > 0) + { @f=&rotatel(*a,$n); } + else + { @f=&rotater(*a,-$n); } + return(@f); + } + +sub rotater + { + local(*a,$n)=@_; + local(@f,@g); + + @f=&shiftr(*a,$n); + @g=&shiftl(*a,32-$n); + $#f=31; + $#g=31; + return(&or(*f,*g)); + } + +sub rotatel + { + local(*a,$n)=@_; + local(@f,@g); + + @f=&shiftl(*a,$n); + @g=&shiftr(*a,32-$n); + $#f=31; + $#g=31; + return(&or(*f,*g)); + } + +sub shiftr + { + local(*a,$n)=@_; + local(@r,$i); + + $#r=31; + foreach $i (0 .. 31) + { + if (($i+$n) > 31) + { + $r[$i]="--"; + } + else + { + $r[$i]=$a[$i+$n]; + } + } + return(@r); + } + +sub shiftl + { + local(*a,$n)=@_; + local(@r,$i); + + $#r=31; + foreach $i (0 .. 31) + { + if ($i < $n) + { + $r[$i]="--"; + } + else + { + $r[$i]=$a[$i-$n]; + } + } + return(@r); + } + +sub printit + { + local(@a)=@_; + local($i); + + foreach $i (0 .. 31) + { + printf "%2s ",$a[$i]; + print "\n" if (($i%8) == 7); + } + print "\n"; + } + +sub xor + { + local(*a,*b)=@_; + local(@r,$i); + + $#r=31; + foreach $i (0 .. 31) + { + $r[$i]=&compress($a[$i].'^'.$b[$i]); +# $r[$i]=$a[$i]."^".$b[$i]; + } + return(@r); + } + +sub and + { + local(*a,$m)=@_; + local(@r,$i); + + $#r=31; + foreach $i (0 .. 31) + { + $r[$i]=(($m & (1<<$i))?($a[$i]):('--')); + } + return(@r); + } + +sub or + { + local(*a,*b)=@_; + local(@r,$i); + + $#r=31; + foreach $i (0 .. 31) + { + $r[$i]='--' if (($a[$i] eq '--') && ($b[$i] eq '--')); + $r[$i]=$a[$i] if (($a[$i] ne '--') && ($b[$i] eq '--')); + $r[$i]=$b[$i] if (($a[$i] eq '--') && ($b[$i] ne '--')); + $r[$i]='++' if (($a[$i] ne '--') && ($b[$i] ne '--')); + } + return(@r); + } + +sub compress + { + local($s)=@_; + local($_,$i,@a,%a,$r); + + $s =~ s/\^\^/\^/g; + $s =~ s/^\^//; + $s =~ s/\^$//; + @a=split(/\^/,$s); + + while ($#a >= 0) + { + $_=shift(@a); + next unless /\d/; + $a{$_}++; + } + foreach $i (sort keys %a) + { + next if ($a{$i}%2 == 0); + $r.="$i^"; + } + chop($r); + return($r); + } +1; diff --git a/src/lib/libcrypto/des/sk.h b/src/lib/libcrypto/des/sk.h new file mode 100644 index 0000000000..f2ade88c7c --- /dev/null +++ b/src/lib/libcrypto/des/sk.h @@ -0,0 +1,204 @@ +/* crypto/des/sk.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +static const DES_LONG des_skb[8][64]={ +{ +/* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ +0x00000000L,0x00000010L,0x20000000L,0x20000010L, +0x00010000L,0x00010010L,0x20010000L,0x20010010L, +0x00000800L,0x00000810L,0x20000800L,0x20000810L, +0x00010800L,0x00010810L,0x20010800L,0x20010810L, +0x00000020L,0x00000030L,0x20000020L,0x20000030L, +0x00010020L,0x00010030L,0x20010020L,0x20010030L, +0x00000820L,0x00000830L,0x20000820L,0x20000830L, +0x00010820L,0x00010830L,0x20010820L,0x20010830L, +0x00080000L,0x00080010L,0x20080000L,0x20080010L, +0x00090000L,0x00090010L,0x20090000L,0x20090010L, +0x00080800L,0x00080810L,0x20080800L,0x20080810L, +0x00090800L,0x00090810L,0x20090800L,0x20090810L, +0x00080020L,0x00080030L,0x20080020L,0x20080030L, +0x00090020L,0x00090030L,0x20090020L,0x20090030L, +0x00080820L,0x00080830L,0x20080820L,0x20080830L, +0x00090820L,0x00090830L,0x20090820L,0x20090830L, +},{ +/* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ +0x00000000L,0x02000000L,0x00002000L,0x02002000L, +0x00200000L,0x02200000L,0x00202000L,0x02202000L, +0x00000004L,0x02000004L,0x00002004L,0x02002004L, +0x00200004L,0x02200004L,0x00202004L,0x02202004L, +0x00000400L,0x02000400L,0x00002400L,0x02002400L, +0x00200400L,0x02200400L,0x00202400L,0x02202400L, +0x00000404L,0x02000404L,0x00002404L,0x02002404L, +0x00200404L,0x02200404L,0x00202404L,0x02202404L, +0x10000000L,0x12000000L,0x10002000L,0x12002000L, +0x10200000L,0x12200000L,0x10202000L,0x12202000L, +0x10000004L,0x12000004L,0x10002004L,0x12002004L, +0x10200004L,0x12200004L,0x10202004L,0x12202004L, +0x10000400L,0x12000400L,0x10002400L,0x12002400L, +0x10200400L,0x12200400L,0x10202400L,0x12202400L, +0x10000404L,0x12000404L,0x10002404L,0x12002404L, +0x10200404L,0x12200404L,0x10202404L,0x12202404L, +},{ +/* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ +0x00000000L,0x00000001L,0x00040000L,0x00040001L, +0x01000000L,0x01000001L,0x01040000L,0x01040001L, +0x00000002L,0x00000003L,0x00040002L,0x00040003L, +0x01000002L,0x01000003L,0x01040002L,0x01040003L, +0x00000200L,0x00000201L,0x00040200L,0x00040201L, +0x01000200L,0x01000201L,0x01040200L,0x01040201L, +0x00000202L,0x00000203L,0x00040202L,0x00040203L, +0x01000202L,0x01000203L,0x01040202L,0x01040203L, +0x08000000L,0x08000001L,0x08040000L,0x08040001L, +0x09000000L,0x09000001L,0x09040000L,0x09040001L, +0x08000002L,0x08000003L,0x08040002L,0x08040003L, +0x09000002L,0x09000003L,0x09040002L,0x09040003L, +0x08000200L,0x08000201L,0x08040200L,0x08040201L, +0x09000200L,0x09000201L,0x09040200L,0x09040201L, +0x08000202L,0x08000203L,0x08040202L,0x08040203L, +0x09000202L,0x09000203L,0x09040202L,0x09040203L, +},{ +/* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ +0x00000000L,0x00100000L,0x00000100L,0x00100100L, +0x00000008L,0x00100008L,0x00000108L,0x00100108L, +0x00001000L,0x00101000L,0x00001100L,0x00101100L, +0x00001008L,0x00101008L,0x00001108L,0x00101108L, +0x04000000L,0x04100000L,0x04000100L,0x04100100L, +0x04000008L,0x04100008L,0x04000108L,0x04100108L, +0x04001000L,0x04101000L,0x04001100L,0x04101100L, +0x04001008L,0x04101008L,0x04001108L,0x04101108L, +0x00020000L,0x00120000L,0x00020100L,0x00120100L, +0x00020008L,0x00120008L,0x00020108L,0x00120108L, +0x00021000L,0x00121000L,0x00021100L,0x00121100L, +0x00021008L,0x00121008L,0x00021108L,0x00121108L, +0x04020000L,0x04120000L,0x04020100L,0x04120100L, +0x04020008L,0x04120008L,0x04020108L,0x04120108L, +0x04021000L,0x04121000L,0x04021100L,0x04121100L, +0x04021008L,0x04121008L,0x04021108L,0x04121108L, +},{ +/* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ +0x00000000L,0x10000000L,0x00010000L,0x10010000L, +0x00000004L,0x10000004L,0x00010004L,0x10010004L, +0x20000000L,0x30000000L,0x20010000L,0x30010000L, +0x20000004L,0x30000004L,0x20010004L,0x30010004L, +0x00100000L,0x10100000L,0x00110000L,0x10110000L, +0x00100004L,0x10100004L,0x00110004L,0x10110004L, +0x20100000L,0x30100000L,0x20110000L,0x30110000L, +0x20100004L,0x30100004L,0x20110004L,0x30110004L, +0x00001000L,0x10001000L,0x00011000L,0x10011000L, +0x00001004L,0x10001004L,0x00011004L,0x10011004L, +0x20001000L,0x30001000L,0x20011000L,0x30011000L, +0x20001004L,0x30001004L,0x20011004L,0x30011004L, +0x00101000L,0x10101000L,0x00111000L,0x10111000L, +0x00101004L,0x10101004L,0x00111004L,0x10111004L, +0x20101000L,0x30101000L,0x20111000L,0x30111000L, +0x20101004L,0x30101004L,0x20111004L,0x30111004L, +},{ +/* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ +0x00000000L,0x08000000L,0x00000008L,0x08000008L, +0x00000400L,0x08000400L,0x00000408L,0x08000408L, +0x00020000L,0x08020000L,0x00020008L,0x08020008L, +0x00020400L,0x08020400L,0x00020408L,0x08020408L, +0x00000001L,0x08000001L,0x00000009L,0x08000009L, +0x00000401L,0x08000401L,0x00000409L,0x08000409L, +0x00020001L,0x08020001L,0x00020009L,0x08020009L, +0x00020401L,0x08020401L,0x00020409L,0x08020409L, +0x02000000L,0x0A000000L,0x02000008L,0x0A000008L, +0x02000400L,0x0A000400L,0x02000408L,0x0A000408L, +0x02020000L,0x0A020000L,0x02020008L,0x0A020008L, +0x02020400L,0x0A020400L,0x02020408L,0x0A020408L, +0x02000001L,0x0A000001L,0x02000009L,0x0A000009L, +0x02000401L,0x0A000401L,0x02000409L,0x0A000409L, +0x02020001L,0x0A020001L,0x02020009L,0x0A020009L, +0x02020401L,0x0A020401L,0x02020409L,0x0A020409L, +},{ +/* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ +0x00000000L,0x00000100L,0x00080000L,0x00080100L, +0x01000000L,0x01000100L,0x01080000L,0x01080100L, +0x00000010L,0x00000110L,0x00080010L,0x00080110L, +0x01000010L,0x01000110L,0x01080010L,0x01080110L, +0x00200000L,0x00200100L,0x00280000L,0x00280100L, +0x01200000L,0x01200100L,0x01280000L,0x01280100L, +0x00200010L,0x00200110L,0x00280010L,0x00280110L, +0x01200010L,0x01200110L,0x01280010L,0x01280110L, +0x00000200L,0x00000300L,0x00080200L,0x00080300L, +0x01000200L,0x01000300L,0x01080200L,0x01080300L, +0x00000210L,0x00000310L,0x00080210L,0x00080310L, +0x01000210L,0x01000310L,0x01080210L,0x01080310L, +0x00200200L,0x00200300L,0x00280200L,0x00280300L, +0x01200200L,0x01200300L,0x01280200L,0x01280300L, +0x00200210L,0x00200310L,0x00280210L,0x00280310L, +0x01200210L,0x01200310L,0x01280210L,0x01280310L, +},{ +/* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ +0x00000000L,0x04000000L,0x00040000L,0x04040000L, +0x00000002L,0x04000002L,0x00040002L,0x04040002L, +0x00002000L,0x04002000L,0x00042000L,0x04042000L, +0x00002002L,0x04002002L,0x00042002L,0x04042002L, +0x00000020L,0x04000020L,0x00040020L,0x04040020L, +0x00000022L,0x04000022L,0x00040022L,0x04040022L, +0x00002020L,0x04002020L,0x00042020L,0x04042020L, +0x00002022L,0x04002022L,0x00042022L,0x04042022L, +0x00000800L,0x04000800L,0x00040800L,0x04040800L, +0x00000802L,0x04000802L,0x00040802L,0x04040802L, +0x00002800L,0x04002800L,0x00042800L,0x04042800L, +0x00002802L,0x04002802L,0x00042802L,0x04042802L, +0x00000820L,0x04000820L,0x00040820L,0x04040820L, +0x00000822L,0x04000822L,0x00040822L,0x04040822L, +0x00002820L,0x04002820L,0x00042820L,0x04042820L, +0x00002822L,0x04002822L,0x00042822L,0x04042822L, +}}; diff --git a/src/lib/libcrypto/des/supp.c b/src/lib/libcrypto/des/supp.c new file mode 100644 index 0000000000..f8e5833f69 --- /dev/null +++ b/src/lib/libcrypto/des/supp.c @@ -0,0 +1,109 @@ +/* crypto/des/supp.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* + * Copyright (c) 1995 + * Mark Murray. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Mark Murray + * 4. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MARK MURRAY AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: supp.c,v 1.1.1.1 1998/10/05 20:12:45 ryker Exp $ + */ + +#include <stdio.h> +#include "des_locl.h" + +void des_cblock_print_file(cb, fp) + des_cblock *cb; + FILE *fp; +{ + int i; + unsigned int *p = (unsigned int *)cb; + + fprintf(fp, " 0x { "); + for (i = 0; i < 8; i++) { + fprintf(fp, "%x", p[i]); + if (i != 7) fprintf(fp, ", "); + } + fprintf(fp, " }"); +} diff --git a/src/lib/libcrypto/des/testdes.pl b/src/lib/libcrypto/des/testdes.pl new file mode 100644 index 0000000000..67fbd47f36 --- /dev/null +++ b/src/lib/libcrypto/des/testdes.pl @@ -0,0 +1,167 @@ +#!/usr/bin/perl + +# des.pl tesing code + +require 'des.pl'; + +$num_tests=34; +@key_data=( + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10, + 0x7C,0xA1,0x10,0x45,0x4A,0x1A,0x6E,0x57, + 0x01,0x31,0xD9,0x61,0x9D,0xC1,0x37,0x6E, + 0x07,0xA1,0x13,0x3E,0x4A,0x0B,0x26,0x86, + 0x38,0x49,0x67,0x4C,0x26,0x02,0x31,0x9E, + 0x04,0xB9,0x15,0xBA,0x43,0xFE,0xB5,0xB6, + 0x01,0x13,0xB9,0x70,0xFD,0x34,0xF2,0xCE, + 0x01,0x70,0xF1,0x75,0x46,0x8F,0xB5,0xE6, + 0x43,0x29,0x7F,0xAD,0x38,0xE3,0x73,0xFE, + 0x07,0xA7,0x13,0x70,0x45,0xDA,0x2A,0x16, + 0x04,0x68,0x91,0x04,0xC2,0xFD,0x3B,0x2F, + 0x37,0xD0,0x6B,0xB5,0x16,0xCB,0x75,0x46, + 0x1F,0x08,0x26,0x0D,0x1A,0xC2,0x46,0x5E, + 0x58,0x40,0x23,0x64,0x1A,0xBA,0x61,0x76, + 0x02,0x58,0x16,0x16,0x46,0x29,0xB0,0x07, + 0x49,0x79,0x3E,0xBC,0x79,0xB3,0x25,0x8F, + 0x4F,0xB0,0x5E,0x15,0x15,0xAB,0x73,0xA7, + 0x49,0xE9,0x5D,0x6D,0x4C,0xA2,0x29,0xBF, + 0x01,0x83,0x10,0xDC,0x40,0x9B,0x26,0xD6, + 0x1C,0x58,0x7F,0x1C,0x13,0x92,0x4F,0xEF, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x1F,0x1F,0x1F,0x1F,0x0E,0x0E,0x0E,0x0E, + 0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10, + ); + +@plain_data=( + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x01,0xA1,0xD6,0xD0,0x39,0x77,0x67,0x42, + 0x5C,0xD5,0x4C,0xA8,0x3D,0xEF,0x57,0xDA, + 0x02,0x48,0xD4,0x38,0x06,0xF6,0x71,0x72, + 0x51,0x45,0x4B,0x58,0x2D,0xDF,0x44,0x0A, + 0x42,0xFD,0x44,0x30,0x59,0x57,0x7F,0xA2, + 0x05,0x9B,0x5E,0x08,0x51,0xCF,0x14,0x3A, + 0x07,0x56,0xD8,0xE0,0x77,0x47,0x61,0xD2, + 0x76,0x25,0x14,0xB8,0x29,0xBF,0x48,0x6A, + 0x3B,0xDD,0x11,0x90,0x49,0x37,0x28,0x02, + 0x26,0x95,0x5F,0x68,0x35,0xAF,0x60,0x9A, + 0x16,0x4D,0x5E,0x40,0x4F,0x27,0x52,0x32, + 0x6B,0x05,0x6E,0x18,0x75,0x9F,0x5C,0xCA, + 0x00,0x4B,0xD6,0xEF,0x09,0x17,0x60,0x62, + 0x48,0x0D,0x39,0x00,0x6E,0xE7,0x62,0xF2, + 0x43,0x75,0x40,0xC8,0x69,0x8F,0x3C,0xFA, + 0x07,0x2D,0x43,0xA0,0x77,0x07,0x52,0x92, + 0x02,0xFE,0x55,0x77,0x81,0x17,0xF1,0x2A, + 0x1D,0x9D,0x5C,0x50,0x18,0xF7,0x28,0xC2, + 0x30,0x55,0x32,0x28,0x6D,0x6F,0x29,0x5A, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF); + +@cipher_data=( + 0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7, + 0x73,0x59,0xB2,0x16,0x3E,0x4E,0xDC,0x58, + 0x95,0x8E,0x6E,0x62,0x7A,0x05,0x55,0x7B, + 0xF4,0x03,0x79,0xAB,0x9E,0x0E,0xC5,0x33, + 0x17,0x66,0x8D,0xFC,0x72,0x92,0x53,0x2D, + 0x8A,0x5A,0xE1,0xF8,0x1A,0xB8,0xF2,0xDD, + 0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7, + 0xED,0x39,0xD9,0x50,0xFA,0x74,0xBC,0xC4, + 0x69,0x0F,0x5B,0x0D,0x9A,0x26,0x93,0x9B, + 0x7A,0x38,0x9D,0x10,0x35,0x4B,0xD2,0x71, + 0x86,0x8E,0xBB,0x51,0xCA,0xB4,0x59,0x9A, + 0x71,0x78,0x87,0x6E,0x01,0xF1,0x9B,0x2A, + 0xAF,0x37,0xFB,0x42,0x1F,0x8C,0x40,0x95, + 0x86,0xA5,0x60,0xF1,0x0E,0xC6,0xD8,0x5B, + 0x0C,0xD3,0xDA,0x02,0x00,0x21,0xDC,0x09, + 0xEA,0x67,0x6B,0x2C,0xB7,0xDB,0x2B,0x7A, + 0xDF,0xD6,0x4A,0x81,0x5C,0xAF,0x1A,0x0F, + 0x5C,0x51,0x3C,0x9C,0x48,0x86,0xC0,0x88, + 0x0A,0x2A,0xEE,0xAE,0x3F,0xF4,0xAB,0x77, + 0xEF,0x1B,0xF0,0x3E,0x5D,0xFA,0x57,0x5A, + 0x88,0xBF,0x0D,0xB6,0xD7,0x0D,0xEE,0x56, + 0xA1,0xF9,0x91,0x55,0x41,0x02,0x0B,0x56, + 0x6F,0xBF,0x1C,0xAF,0xCF,0xFD,0x05,0x56, + 0x2F,0x22,0xE4,0x9B,0xAB,0x7C,0xA1,0xAC, + 0x5A,0x6B,0x61,0x2C,0xC2,0x6C,0xCE,0x4A, + 0x5F,0x4C,0x03,0x8E,0xD1,0x2B,0x2E,0x41, + 0x63,0xFA,0xC0,0xD0,0x34,0xD9,0xF7,0x93, + 0x61,0x7B,0x3A,0x0C,0xE8,0xF0,0x71,0x00, + 0xDB,0x95,0x86,0x05,0xF8,0xC8,0xC6,0x06, + 0xED,0xBF,0xD1,0xC6,0x6C,0x29,0xCC,0xC7, + 0x35,0x55,0x50,0xB2,0x15,0x0E,0x24,0x51, + 0xCA,0xAA,0xAF,0x4D,0xEA,0xF1,0xDB,0xAE, + 0xD5,0xD4,0x4F,0xF7,0x20,0x68,0x3D,0x0D, + 0x2A,0x2B,0xB0,0x08,0xDF,0x97,0xC2,0xF2); + +print "Doing ecb tests\n"; +for ($i=0; $i<$num_tests; $i++) + { + printf "Doing test $i\n"; + $key =pack("C8",splice(@key_data ,0,8)); + $data=pack("C8",splice(@plain_data ,0,8)); + $res =pack("C8",splice(@cipher_data,0,8)); + + @ks= &des_set_key($key); + $out1= &des_ecb_encrypt(*ks,1,$data); + $out2= &des_ecb_encrypt(*ks,0,$out1); + $out3= &des_ecb_encrypt(*ks,0,$res); + &eprint("encryption failure",$res,$out1) + if ($out1 ne $res); + &eprint("encryption/decryption failure",$data,$out2) + if ($out2 ne $data); + &eprint("decryption failure",$data,$out3) + if ($data ne $out3); + } +print "Done\n"; + +print "doing speed test over 30 seconds\n"; +$SIG{'ALRM'}='done'; +sub done {$done=1;} +$done=0; + +$count=0; +$d=pack("C8",0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef); +@ks= &des_set_key($d); +alarm(30); +$start=(times)[0]; +while (!$done) + { + $count++; + $d=&des_ecb_encrypt(*ks,1,$d); + } +$end=(times)[0]; +$t=$end-$start; +printf "$count DESs in %.2f seconds is %.2f DESs/sec or %.2f bytes/sec\n", + 1.0*$t,1.0*$count/$t,$count*8.0/$t; + +sub eprint + { + local($s,$c,$e)=@_; + local(@k); + + @k=unpack("C8",$c); + printf "%02x%02x%02x%02x %02x%02x%02x%02x - ",unpack("C8",$c); + printf "%02x%02x%02x%02x %02x%02x%02x%02x :",unpack("C8",$e); + print " $s\n"; + } diff --git a/src/lib/libcrypto/des/vms.com b/src/lib/libcrypto/des/vms.com new file mode 100644 index 0000000000..62ca1fbda4 --- /dev/null +++ b/src/lib/libcrypto/des/vms.com @@ -0,0 +1,90 @@ +$! --- VMS.com --- +$! +$ GoSub defines +$ GoSub linker_options +$ If (P1 .nes. "") +$ Then +$ GoSub 'P1' +$ Else +$ GoSub lib +$ GoSub destest +$ GoSub rpw +$ GoSub speed +$ GoSub des +$ EndIF +$! +$ Exit +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$DEFINES: +$ OPT_FILE := "VAX_LINKER_OPTIONS.OPT" +$! +$ CC_OPTS := "/NODebug/OPTimize/NOWarn" +$! +$ LINK_OPTS := "/NODebug/NOTraceback/Contiguous" +$! +$ OBJS = "cbc_cksm.obj,cbc_enc.obj,ecb_enc.obj,pcbc_enc.obj," + - + "qud_cksm.obj,rand_key.obj,read_pwd.obj,set_key.obj," + - + "str2key.obj,enc_read.obj,enc_writ.obj,fcrypt.obj," + - + "cfb_enc.obj,ecb3_enc.obj,ofb_enc.obj" + + +$! +$ LIBDES = "cbc_cksm.c,cbc_enc.c,ecb_enc.c,enc_read.c," + - + "enc_writ.c,pcbc_enc.c,qud_cksm.c,rand_key.c," + - + "read_pwd.c,set_key.c,str2key.c,fcrypt.c," + - + "cfb_enc.c,ecb3_enc.c,ofb_enc.c" +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$LINKER_OPTIONS: +$ If (f$search(OPT_FILE) .eqs. "") +$ Then +$ Create 'OPT_FILE' +$DECK +! Default system options file to link against the sharable C runtime library +! +Sys$Share:VAXcRTL.exe/Share +$EOD +$ EndIF +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$LIB: +$ CC 'CC_OPTS' 'LIBDES' +$ If (f$search("LIBDES.OLB") .nes. "") +$ Then Library /Object /Replace libdes 'OBJS' +$ Else Library /Create /Object libdes 'OBJS' +$ EndIF +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$DESTEST: +$ CC 'CC_OPTS' destest +$ Link 'link_opts' /Exec=destest destest.obj,libdes/LIBRARY,'opt_file'/Option +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$RPW: +$ CC 'CC_OPTS' rpw +$ Link 'link_opts' /Exec=rpw rpw.obj,libdes/LIBRARY,'opt_file'/Option +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$SPEED: +$ CC 'CC_OPTS' speed +$ Link 'link_opts' /Exec=speed speed.obj,libdes/LIBRARY,'opt_file'/Option +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$DES: +$ CC 'CC_OPTS' des +$ Link 'link_opts' /Exec=des des.obj,libdes/LIBRARY,'opt_file'/Option +$ Return diff --git a/src/lib/libcrypto/dh/dh.err b/src/lib/libcrypto/dh/dh.err new file mode 100644 index 0000000000..a4fe746985 --- /dev/null +++ b/src/lib/libcrypto/dh/dh.err @@ -0,0 +1,12 @@ +/* Error codes for the DH functions. */ + +/* Function codes. */ +#define DH_F_DHPARAMS_PRINT 100 +#define DH_F_DHPARAMS_PRINT_FP 101 +#define DH_F_DH_COMPUTE_KEY 102 +#define DH_F_DH_GENERATE_KEY 103 +#define DH_F_DH_GENERATE_PARAMETERS 104 +#define DH_F_DH_NEW 105 + +/* Reason codes. */ +#define DH_R_NO_PRIVATE_VALUE 100 diff --git a/src/lib/libcrypto/dsa/dsa.err b/src/lib/libcrypto/dsa/dsa.err new file mode 100644 index 0000000000..1131e9fa74 --- /dev/null +++ b/src/lib/libcrypto/dsa/dsa.err @@ -0,0 +1,15 @@ +/* Error codes for the DSA functions. */ + +/* Function codes. */ +#define DSA_F_DSAPARAMS_PRINT 100 +#define DSA_F_DSAPARAMS_PRINT_FP 101 +#define DSA_F_DSA_IS_PRIME 102 +#define DSA_F_DSA_NEW 103 +#define DSA_F_DSA_PRINT 104 +#define DSA_F_DSA_PRINT_FP 105 +#define DSA_F_DSA_SIGN 106 +#define DSA_F_DSA_SIGN_SETUP 107 +#define DSA_F_DSA_VERIFY 108 + +/* Reason codes. */ +#define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100 diff --git a/src/lib/libcrypto/err/err_code.pl b/src/lib/libcrypto/err/err_code.pl new file mode 100644 index 0000000000..ebc8eef913 --- /dev/null +++ b/src/lib/libcrypto/err/err_code.pl @@ -0,0 +1,105 @@ +#!/usr/bin/perl + +while (@ARGV) + { + $in=shift(@ARGV); + if ($in =~ /^-conf$/) + { + $in=shift(@ARGV); + open(IN,"<$in") || die "unable to open '$in'\n"; + while (<IN>) + { + s/#.*$//; + s/\s+$//; + next if (/^$/); + if (/^L\s+(\S+)\s+(\S+)$/) + { $errfile{$1}=$2; } + elsif (/^F\s+(\S+)$/) + { $function{$1}=1; } + elsif (/^R\s+(\S+)\s+(\S+)$/) + { $r_value{$1}=$2; } + else { die "bad input line: $in:$.\n"; } + } + close(IN); + next; + } + + open(IN,"<$in") || die "unable to open '$in'\n"; + $last=""; + while (<IN>) + { + if (/err\(([A-Z0-9]+_F_[0-9A-Z_]+)\s*,\s*([0-9A-Z]+_R_[0-9A-Z_]+)\s*\)/) + { + if ($1 != $last) + { + if ($function{$1} == 0) + { + printf STDERR "$. $1 is bad\n"; + } + } + $function{$1}++; + $last=$1; + $reason{$2}++; + } + } + close(IN); + } + +foreach (keys %function,keys %reason) + { + /^([A-Z0-9]+)_/; + $prefix{$1}++; + } + +@F=sort keys %function; +@R=sort keys %reason; +foreach $j (sort keys %prefix) + { + next if $errfile{$j} eq "NONE"; + printf STDERR "doing %-6s - ",$j; + if (defined($errfile{$j})) + { + open(OUT,">$errfile{$j}") || + die "unable to open '$errfile{$j}':$!\n"; + $close_file=1; + } + else + { + *OUT=*STDOUT; + $close=0; + } + @f=grep(/^${j}_/,@F); + @r=grep(/^${j}_/,@R); + $num=100; + print OUT "/* Error codes for the $j functions. */\n\n"; + print OUT "/* Function codes. */\n"; + $f_count=0; + foreach $i (@f) + { + $z=6-int(length($i)/8); + printf OUT "#define $i%s $num\n","\t" x $z; + $num++; + $f_count++; + } + $num=100; + print OUT "\n/* Reason codes. */\n"; + $r_count=0; + foreach $i (@r) + { + $z=6-int(length($i)/8); + if (defined($r_value{$i})) + { + printf OUT "#define $i%s $r_value{$i}\n","\t" x $z; + } + else + { + printf OUT "#define $i%s $num\n","\t" x $z; + $num++; + } + $r_count++; + } + close(OUT) if $close_file; + + printf STDERR "%3d functions, %3d reasons\n",$f_count,$r_count; + } + diff --git a/src/lib/libcrypto/err/err_genc.pl b/src/lib/libcrypto/err/err_genc.pl new file mode 100644 index 0000000000..a8e36c2f0c --- /dev/null +++ b/src/lib/libcrypto/err/err_genc.pl @@ -0,0 +1,198 @@ +#!/usr/bin/perl + +if ($ARGV[0] eq "-s") { $static=1; shift @ARGV; } + +($#ARGV == 1) || die "usage: $0 [-s] <header file> <output C file>\n"; +open(IN,"<$ARGV[0]") || die "unable to open $ARGV[0]:$!\n"; +open(STDOUT,">$ARGV[1]") || die "unable to open $ARGV[1]:$!\n"; + +$Func=0; +$Reas=0; +$fuction{'FOPEN'}='fopen'; +while (<IN>) + { + if (/(\S+)\s*\(\);/) + { + $t=$1; + $t =~ s/\*//; + ($upper=$t) =~ tr/a-z/A-Z/; + $fuction{$upper}=$t; + } + next unless (/^#define\s+(\S+)\s/); + + $o=$1; + if ($o =~ /^([^_]+)_F_(.*)/) + { + $type=$1; + $Func++; + $n=$2; + $n=$fuction{$n} if (defined($fuction{$n})); + $out{$1."_str_functs"}.= + sprintf("{ERR_PACK(0,%s,0),\t\"$n\"},\n",$o); + } + elsif ($o =~ /^([^_]+)_R_(.*)/) + { + $type=$1; + $Reas++; + $r=$2; + $r =~ tr/A-Z_/a-z /; + $pkg{$type."_str_reasons"}=$type; + $out{$type."_str_reasons"}.=sprintf("{%-40s,\"$r\"},\n",$o); + } + elsif ($ARGV[0] =~ /rsaref/ && $o =~ /^RE_(.*)/) + { + $type="RSAREF"; + $Reas++; + $r=$1; + $r =~ tr/A-Z_/a-z /; + $pkg{$type."_str_reasons"}=$type; + $out{$type."_str_reasons"}.=sprintf("{%-40s,\"$r\"},\n",$o); + } + } +close(IN); + +&header($type,$ARGV[0]); + +foreach (sort keys %out) + { + print "static ERR_STRING_DATA ${_}[]=\n\t{\n"; + print $out{$_}; + print "{0,NULL},\n"; + print "\t};\n\n"; + } +print "#endif\n"; + +if ($static) + { $lib="ERR_LIB_$type"; } +else + { $lib="${type}_lib_error_code"; } + +$str=""; +$str.="#ifndef NO_ERR\n"; +$str.="\t\tERR_load_strings($lib,${type}_str_functs);\n" if $Func; +$str.="\t\tERR_load_strings($lib,${type}_str_reasons);\n" if $Reas; +$str.="#endif\n"; + +if (!$static) + { +print <<"EOF"; + +static int ${type}_lib_error_code=0; + +void ERR_load_${type}_strings() + { + static int init=1; + + if (${type}_lib_error_code == 0) + ${type}_lib_error_code=ERR_get_next_error_library(); + + if (init); + {; + init=0; +$str + } + } + +void ERR_${type}_error(function,reason,file,line) +int function; +int reason; +char *file; +int line; + { + if (${type}_lib_error_code == 0) + ${type}_lib_error_code=ERR_get_next_error_library(); + ERR_PUT_error(${type}_lib_error_code,function,reason,file,line); + } +EOF + } +else # $static + { + print <<"EOF"; + +void ERR_load_${type}_strings() + { + static int init=1; + + if (init); + {; + init=0; +$str + } + } +EOF + } + +sub header + { + ($type,$header)=@_; + + ($lc=$type) =~ tr/A-Z/a-z/; + $header =~ s/^.*\///; + + print "/* lib/$lc/${lc}\_err.c */\n"; + print <<'EOF'; +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +EOF + + print "#include <stdio.h>\n"; + print "#include \"err.h\"\n"; + print "#include \"$header\"\n"; + print "\n/* BEGIN ERROR CODES */\n"; + print "#ifndef NO_ERR\n"; + } + diff --git a/src/lib/libcrypto/err/error.err b/src/lib/libcrypto/err/error.err new file mode 100644 index 0000000000..f09557d8d9 --- /dev/null +++ b/src/lib/libcrypto/err/error.err @@ -0,0 +1,13 @@ +/* Error codes for the ERR functions. */ + +/* Function codes. */ + +/* Reason codes. */ +#define ERR_R_BN_LIB 100 +#define ERR_R_DER_LIB 101 +#define ERR_R_MALLOC_FAILURE 102 +#define ERR_R_PEM_LIB 103 +#define ERR_R_RSA_LIB 104 +#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED 105 +#define ERR_R_SYS_LIB 106 +#define ERR_R_X509_LIB 107 diff --git a/src/lib/libcrypto/err/ssleay.ec b/src/lib/libcrypto/err/ssleay.ec new file mode 100644 index 0000000000..10b5dbb59d --- /dev/null +++ b/src/lib/libcrypto/err/ssleay.ec @@ -0,0 +1,57 @@ +L ERR NONE +L CRYPTO crypto.err +L BN bn/bn.err +L RSA rsa/rsa.err +L DSA dsa/dsa.err +L DH dh/dh.err +L EVP evp/evp.err +L BUF buffer/buffer.err +L BIO bio/bio.err +L OBJ objects/objects.err +L PEM pem/pem.err +L X509 x509/x509.err +L METH meth/meth.err +L ASN1 asn1/asn1.err +L CONF conf/conf.err +L PROXY proxy/proxy.err +L PKCS7 pkcs7/pkcs7.err +L RSAREF ../rsaref/rsaref.err +L SSL ../ssl/ssl.err +L SSL2 ../ssl/ssl2.err +L SSL3 ../ssl/ssl3.err +L SSL23 ../ssl/ssl23.err + +F RSAREF_F_RSA_BN2BIN +F RSAREF_F_RSA_PRIVATE_DECRYPT +F RSAREF_F_RSA_PRIVATE_ENCRYPT +F RSAREF_F_RSA_PUBLIC_DECRYPT +F RSAREF_F_RSA_PUBLIC_ENCRYPT +#F SSL_F_CLIENT_CERTIFICATE + +R SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 +R SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 +R SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 +R SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 +R SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 +R SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 +R SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 +R SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 +R SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 +R SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 +R SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 + +R RSAREF_R_CONTENT_ENCODING 0x0400 +R RSAREF_R_DATA 0x0401 +R RSAREF_R_DIGEST_ALGORITHM 0x0402 +R RSAREF_R_ENCODING 0x0403 +R RSAREF_R_KEY 0x0404 +R RSAREF_R_KEY_ENCODING 0x0405 +R RSAREF_R_LEN 0x0406 +R RSAREF_R_MODULUS_LEN 0x0407 +R RSAREF_R_NEED_RANDOM 0x0408 +R RSAREF_R_PRIVATE_KEY 0x0409 +R RSAREF_R_PUBLIC_KEY 0x040a +R RSAREF_R_SIGNATURE 0x040b +R RSAREF_R_SIGNATURE_ENCODING 0x040c +R RSAREF_R_ENCRYPTION_ALGORITHM 0x040d + diff --git a/src/lib/libcrypto/evp/e_cbc_3d.c b/src/lib/libcrypto/evp/e_cbc_3d.c new file mode 100644 index 0000000000..5761bf186a --- /dev/null +++ b/src/lib/libcrypto/evp/e_cbc_3d.c @@ -0,0 +1,163 @@ +/* crypto/evp/e_cbc_3d.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void des_cbc_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_cbc_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_cbc_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void des_cbc_ede_init_key(); +static void des_cbc_ede3_init_key(); +static void des_cbc_ede_cipher(); +#endif + +static EVP_CIPHER d_cbc_ede_cipher2= + { + NID_des_ede_cbc, + 8,16,8, + des_cbc_ede_init_key, + des_cbc_ede_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), + EVP_CIPHER_get_asn1_iv, + EVP_CIPHER_set_asn1_iv, + }; + +static EVP_CIPHER d_cbc_ede_cipher3= + { + NID_des_ede3_cbc, + 8,24,8, + des_cbc_ede3_init_key, + des_cbc_ede_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_des_ede_cbc() + { + return(&d_cbc_ede_cipher2); + } + +EVP_CIPHER *EVP_des_ede3_cbc() + { + return(&d_cbc_ede_cipher3); + } + +static void des_cbc_ede_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + + if (key != NULL) + { + des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); + des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + memcpy( (char *)ctx->c.des_ede.ks3, + (char *)ctx->c.des_ede.ks1, + sizeof(ctx->c.des_ede.ks1)); + } + } + +static void des_cbc_ede3_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + + if (key != NULL) + { + des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); + des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); + } + } + +static void des_cbc_ede_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + des_ede3_cbc_encrypt( + (des_cblock *)in,(des_cblock *)out, + (long)inl, ctx->c.des_ede.ks1, + ctx->c.des_ede.ks2,ctx->c.des_ede.ks3, + (des_cblock *)&(ctx->iv[0]), + ctx->encrypt); + } diff --git a/src/lib/libcrypto/evp/e_cbc_bf.c b/src/lib/libcrypto/evp/e_cbc_bf.c new file mode 100644 index 0000000000..be605f4a13 --- /dev/null +++ b/src/lib/libcrypto/evp/e_cbc_bf.c @@ -0,0 +1,119 @@ +/* crypto/evp/e_cbc_bf.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_BLOWFISH + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void bf_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void bf_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void bf_cbc_init_key(); +static void bf_cbc_cipher(); +#endif + +static EVP_CIPHER bfish_cbc_cipher= + { + NID_bf_cbc, + 8,EVP_BLOWFISH_KEY_SIZE,8, + bf_cbc_init_key, + bf_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), + EVP_CIPHER_get_asn1_iv, + EVP_CIPHER_set_asn1_iv, + }; + +EVP_CIPHER *EVP_bf_cbc() + { + return(&bfish_cbc_cipher); + } + +static void bf_cbc_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + BF_set_key(&(ctx->c.bf_ks),EVP_BLOWFISH_KEY_SIZE,key); + } + +static void bf_cbc_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + BF_cbc_encrypt( + in,out,(long)inl, + &(ctx->c.bf_ks),&(ctx->iv[0]), + ctx->encrypt); + } + +#endif diff --git a/src/lib/libcrypto/evp/e_cbc_c.c b/src/lib/libcrypto/evp/e_cbc_c.c new file mode 100644 index 0000000000..b50c7874b3 --- /dev/null +++ b/src/lib/libcrypto/evp/e_cbc_c.c @@ -0,0 +1,119 @@ +/* crypto/evp/e_cbc_c.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_CAST + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void cast_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void cast_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void cast_cbc_init_key(); +static void cast_cbc_cipher(); +#endif + +static EVP_CIPHER cast5_cbc_cipher= + { + NID_cast5_cbc, + 8,EVP_CAST5_KEY_SIZE,8, + cast_cbc_init_key, + cast_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), + EVP_CIPHER_get_asn1_iv, + EVP_CIPHER_set_asn1_iv, + }; + +EVP_CIPHER *EVP_cast5_cbc() + { + return(&cast5_cbc_cipher); + } + +static void cast_cbc_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + CAST_set_key(&(ctx->c.cast_ks),EVP_CAST5_KEY_SIZE,key); + } + +static void cast_cbc_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + CAST_cbc_encrypt( + in,out,(long)inl, + &(ctx->c.cast_ks),&(ctx->iv[0]), + ctx->encrypt); + } + +#endif diff --git a/src/lib/libcrypto/evp/e_cbc_d.c b/src/lib/libcrypto/evp/e_cbc_d.c new file mode 100644 index 0000000000..c67706e3a0 --- /dev/null +++ b/src/lib/libcrypto/evp/e_cbc_d.c @@ -0,0 +1,116 @@ +/* crypto/evp/e_cbc_d.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void des_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void des_cbc_init_key(); +static void des_cbc_cipher(); +#endif + +static EVP_CIPHER d_cbc_cipher= + { + NID_des_cbc, + 8,8,8, + des_cbc_init_key, + des_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), + EVP_CIPHER_get_asn1_iv, + EVP_CIPHER_set_asn1_iv, + }; + +EVP_CIPHER *EVP_des_cbc() + { + return(&d_cbc_cipher); + } + +static void des_cbc_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + des_set_key((des_cblock *)key,ctx->c.des_ks); + } + +static void des_cbc_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + des_ncbc_encrypt( + (des_cblock *)in,(des_cblock *)out, + (long)inl, ctx->c.des_ks, + (des_cblock *)&(ctx->iv[0]), + ctx->encrypt); + } diff --git a/src/lib/libcrypto/evp/e_cbc_i.c b/src/lib/libcrypto/evp/e_cbc_i.c new file mode 100644 index 0000000000..312ffcb721 --- /dev/null +++ b/src/lib/libcrypto/evp/e_cbc_i.c @@ -0,0 +1,131 @@ +/* crypto/evp/e_cbc_i.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_IDEA + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void idea_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void idea_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void idea_cbc_init_key(); +static void idea_cbc_cipher(); +#endif + +static EVP_CIPHER i_cbc_cipher= + { + NID_idea_cbc, + 8,16,8, + idea_cbc_init_key, + idea_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), + EVP_CIPHER_get_asn1_iv, + EVP_CIPHER_set_asn1_iv, + }; + +EVP_CIPHER *EVP_idea_cbc() + { + return(&i_cbc_cipher); + } + +static void idea_cbc_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + { + if (enc) + idea_set_encrypt_key(key,&(ctx->c.idea_ks)); + else + { + IDEA_KEY_SCHEDULE tmp; + + idea_set_encrypt_key(key,&tmp); + idea_set_decrypt_key(&tmp,&(ctx->c.idea_ks)); + memset((unsigned char *)&tmp,0, + sizeof(IDEA_KEY_SCHEDULE)); + } + } + } + +static void idea_cbc_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + idea_cbc_encrypt( + in,out,(long)inl, + &(ctx->c.idea_ks),&(ctx->iv[0]), + ctx->encrypt); + } + +#endif diff --git a/src/lib/libcrypto/evp/e_cbc_r2.c b/src/lib/libcrypto/evp/e_cbc_r2.c new file mode 100644 index 0000000000..4f8002f16d --- /dev/null +++ b/src/lib/libcrypto/evp/e_cbc_r2.c @@ -0,0 +1,136 @@ +/* crypto/evp/e_cbc_r2.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC2 + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void rc2_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void rc2_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void rc2_cbc_init_key(); +static void rc2_cbc_cipher(); +#endif + +static EVP_CIPHER r2_cbc_cipher= + { + NID_rc2_cbc, + 8,EVP_RC2_KEY_SIZE,8, + rc2_cbc_init_key, + rc2_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), + EVP_CIPHER_get_asn1_iv, + EVP_CIPHER_set_asn1_iv, + }; + +static EVP_CIPHER r2_40_cbc_cipher= + { + NID_rc2_40_cbc, + 8,5 /* 40 bit */,8, + rc2_cbc_init_key, + rc2_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), + }; + +EVP_CIPHER *EVP_rc2_cbc() + { + return(&r2_cbc_cipher); + } + +EVP_CIPHER *EVP_rc2_40_cbc() + { + return(&r2_40_cbc_cipher); + } + +static void rc2_cbc_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + RC2_set_key(&(ctx->c.rc2_ks),EVP_CIPHER_CTX_key_length(ctx), + key,EVP_CIPHER_CTX_key_length(ctx)*8); + } + +static void rc2_cbc_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + RC2_cbc_encrypt( + in,out,(long)inl, + &(ctx->c.rc2_ks),&(ctx->iv[0]), + ctx->encrypt); + } + +#endif diff --git a/src/lib/libcrypto/evp/e_cbc_r5.c b/src/lib/libcrypto/evp/e_cbc_r5.c new file mode 100644 index 0000000000..f7d46ca91f --- /dev/null +++ b/src/lib/libcrypto/evp/e_cbc_r5.c @@ -0,0 +1,120 @@ +/* crypto/evp/e_cbc_r5.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC5 + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void r_32_12_16_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void r_32_12_16_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void r_32_12_16_cbc_init_key(); +static void r_32_12_16_cbc_cipher(); +#endif + +static EVP_CIPHER rc5_32_12_16_cbc_cipher= + { + NID_rc5_cbc, + 8,EVP_RC5_32_12_16_KEY_SIZE,8, + r_32_12_16_cbc_init_key, + r_32_12_16_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5_ks)), + NULL, + NULL, + }; + +EVP_CIPHER *EVP_rc5_32_12_16_cbc() + { + return(&rc5_32_12_16_cbc_cipher); + } + +static void r_32_12_16_cbc_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE, + key,RC5_12_ROUNDS); + } + +static void r_32_12_16_cbc_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + RC5_32_cbc_encrypt( + in,out,(long)inl, + &(ctx->c.rc5_ks),&(ctx->iv[0]), + ctx->encrypt); + } + +#endif diff --git a/src/lib/libcrypto/evp/e_cfb_3d.c b/src/lib/libcrypto/evp/e_cfb_3d.c new file mode 100644 index 0000000000..e7e3419411 --- /dev/null +++ b/src/lib/libcrypto/evp/e_cfb_3d.c @@ -0,0 +1,166 @@ +/* crypto/evp/e_cfb_3d.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void des_ede_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_ede3_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void des_ede_cfb_init_key(); +static void des_ede3_cfb_init_key(); +static void des_ede_cfb_cipher(); +#endif + +static EVP_CIPHER d_ede_cfb_cipher2= + { + NID_des_ede_cfb64, + 1,16,8, + des_ede_cfb_init_key, + des_ede_cfb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +static EVP_CIPHER d_ede3_cfb_cipher3= + { + NID_des_ede3_cfb64, + 1,24,8, + des_ede3_cfb_init_key, + des_ede_cfb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_des_ede_cfb() + { + return(&d_ede_cfb_cipher2); + } + +EVP_CIPHER *EVP_des_ede3_cfb() + { + return(&d_ede3_cfb_cipher3); + } + +static void des_ede_cfb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + { + des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); + des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + memcpy( (char *)ctx->c.des_ede.ks3, + (char *)ctx->c.des_ede.ks1, + sizeof(ctx->c.des_ede.ks1)); + } + } + +static void des_ede3_cfb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + { + des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); + des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); + } + } + +static void des_ede_cfb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + des_ede3_cfb64_encrypt( + in,out,(long)inl, + ctx->c.des_ede.ks1, + ctx->c.des_ede.ks2, + ctx->c.des_ede.ks3, + (des_cblock *)&(ctx->iv[0]), + &ctx->num,ctx->encrypt); + } diff --git a/src/lib/libcrypto/evp/e_cfb_bf.c b/src/lib/libcrypto/evp/e_cfb_bf.c new file mode 100644 index 0000000000..8aba2564b8 --- /dev/null +++ b/src/lib/libcrypto/evp/e_cfb_bf.c @@ -0,0 +1,121 @@ +/* crypto/evp/e_cfb_bf.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_BLOWFISH + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void bf_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void bf_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void bf_cfb_init_key(); +static void bf_cfb_cipher(); +#endif + +static EVP_CIPHER bfish_cfb_cipher= + { + NID_bf_cfb64, + 1,EVP_BLOWFISH_KEY_SIZE,8, + bf_cfb_init_key, + bf_cfb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_bf_cfb() + { + return(&bfish_cfb_cipher); + } + +static void bf_cfb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + BF_set_key(&(ctx->c.bf_ks),EVP_BLOWFISH_KEY_SIZE,key); + } + +static void bf_cfb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + BF_cfb64_encrypt( + in,out, + (long)inl, &(ctx->c.bf_ks), + &(ctx->iv[0]), + &ctx->num,ctx->encrypt); + } +#endif diff --git a/src/lib/libcrypto/evp/e_cfb_c.c b/src/lib/libcrypto/evp/e_cfb_c.c new file mode 100644 index 0000000000..936df55fd8 --- /dev/null +++ b/src/lib/libcrypto/evp/e_cfb_c.c @@ -0,0 +1,121 @@ +/* crypto/evp/e_cfb_c.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_CAST + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void cast_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void cast_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void cast_cfb_init_key(); +static void cast_cfb_cipher(); +#endif + +static EVP_CIPHER cast5_cfb_cipher= + { + NID_cast5_cfb64, + 1,EVP_CAST5_KEY_SIZE,8, + cast_cfb_init_key, + cast_cfb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_cast5_cfb() + { + return(&cast5_cfb_cipher); + } + +static void cast_cfb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + CAST_set_key(&(ctx->c.cast_ks),EVP_CAST5_KEY_SIZE,key); + } + +static void cast_cfb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + CAST_cfb64_encrypt( + in,out, + (long)inl, &(ctx->c.cast_ks), + &(ctx->iv[0]), + &ctx->num,ctx->encrypt); + } +#endif diff --git a/src/lib/libcrypto/evp/e_cfb_d.c b/src/lib/libcrypto/evp/e_cfb_d.c new file mode 100644 index 0000000000..9ae4558f51 --- /dev/null +++ b/src/lib/libcrypto/evp/e_cfb_d.c @@ -0,0 +1,118 @@ +/* crypto/evp/e_cfb_d.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void des_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void des_cfb_init_key(); +static void des_cfb_cipher(); +#endif + +static EVP_CIPHER d_cfb_cipher= + { + NID_des_cfb64, + 1,8,8, + des_cfb_init_key, + des_cfb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_des_cfb() + { + return(&d_cfb_cipher); + } + +static void des_cfb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + des_set_key((des_cblock *)key,ctx->c.des_ks); + } + +static void des_cfb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + des_cfb64_encrypt( + in,out, + (long)inl, ctx->c.des_ks, + (des_cblock *)&(ctx->iv[0]), + &ctx->num,ctx->encrypt); + } diff --git a/src/lib/libcrypto/evp/e_cfb_i.c b/src/lib/libcrypto/evp/e_cfb_i.c new file mode 100644 index 0000000000..9225efaa86 --- /dev/null +++ b/src/lib/libcrypto/evp/e_cfb_i.c @@ -0,0 +1,121 @@ +/* crypto/evp/e_cfb_i.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_IDEA + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void idea_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void idea_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void idea_cfb_init_key(); +static void idea_cfb_cipher(); +#endif + +static EVP_CIPHER i_cfb_cipher= + { + NID_idea_cfb64, + 1,IDEA_KEY_LENGTH,IDEA_BLOCK, + idea_cfb_init_key, + idea_cfb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_idea_cfb() + { + return(&i_cfb_cipher); + } + +static void idea_cfb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + idea_set_encrypt_key(key,&(ctx->c.idea_ks)); + } + +static void idea_cfb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + idea_cfb64_encrypt( + in,out,(long)inl, + &(ctx->c.idea_ks),&(ctx->iv[0]), + &ctx->num,ctx->encrypt); + } + +#endif diff --git a/src/lib/libcrypto/evp/e_cfb_r2.c b/src/lib/libcrypto/evp/e_cfb_r2.c new file mode 100644 index 0000000000..af5a39d1f4 --- /dev/null +++ b/src/lib/libcrypto/evp/e_cfb_r2.c @@ -0,0 +1,122 @@ +/* crypto/evp/e_cfb_r2.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC2 + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void rc2_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void rc2_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void rc2_cfb_init_key(); +static void rc2_cfb_cipher(); +#endif + +static EVP_CIPHER r2_cfb_cipher= + { + NID_rc2_cfb64, + 1,EVP_RC2_KEY_SIZE,8, + rc2_cfb_init_key, + rc2_cfb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_rc2_cfb() + { + return(&r2_cfb_cipher); + } + +static void rc2_cfb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + RC2_set_key(&(ctx->c.rc2_ks),EVP_RC2_KEY_SIZE,key, + EVP_RC2_KEY_SIZE*8); + } + +static void rc2_cfb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + RC2_cfb64_encrypt( + in,out, + (long)inl, &(ctx->c.rc2_ks), + &(ctx->iv[0]), + &ctx->num,ctx->encrypt); + } +#endif diff --git a/src/lib/libcrypto/evp/e_cfb_r5.c b/src/lib/libcrypto/evp/e_cfb_r5.c new file mode 100644 index 0000000000..a2fddaedc0 --- /dev/null +++ b/src/lib/libcrypto/evp/e_cfb_r5.c @@ -0,0 +1,122 @@ +/* crypto/evp/e_cfb_r5.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC5 + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void rc5_32_12_16_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void rc5_32_12_16_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void rc5_32_12_16_cfb_init_key(); +static void rc5_32_12_16_cfb_cipher(); +#endif + +static EVP_CIPHER rc5_cfb_cipher= + { + NID_rc5_cfb64, + 1,EVP_RC5_32_12_16_KEY_SIZE,8, + rc5_32_12_16_cfb_init_key, + rc5_32_12_16_cfb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_rc5_32_12_16_cfb() + { + return(&rc5_cfb_cipher); + } + +static void rc5_32_12_16_cfb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE,key, + RC5_12_ROUNDS); + } + +static void rc5_32_12_16_cfb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + RC5_32_cfb64_encrypt( + in,out, + (long)inl, &(ctx->c.rc5_ks), + &(ctx->iv[0]), + &ctx->num,ctx->encrypt); + } +#endif diff --git a/src/lib/libcrypto/evp/e_ecb_3d.c b/src/lib/libcrypto/evp/e_ecb_3d.c new file mode 100644 index 0000000000..908fc0760a --- /dev/null +++ b/src/lib/libcrypto/evp/e_ecb_3d.c @@ -0,0 +1,161 @@ +/* crypto/evp/e_ecb_3d.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void des_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void des_ede_init_key(); +static void des_ede3_init_key(); +static void des_ede_cipher(); +#endif + +static EVP_CIPHER d_ede_cipher2= + { + NID_des_ede, + 8,16,0, + des_ede_init_key, + des_ede_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), + NULL, + NULL, + }; + +static EVP_CIPHER d_ede3_cipher3= + { + NID_des_ede3, + 8,24,0, + des_ede3_init_key, + des_ede_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), + NULL, + }; + +EVP_CIPHER *EVP_des_ede() + { + return(&d_ede_cipher2); + } + +EVP_CIPHER *EVP_des_ede3() + { + return(&d_ede3_cipher3); + } + +static void des_ede_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (key != NULL) + { + des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); + des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + memcpy( (char *)ctx->c.des_ede.ks3, + (char *)ctx->c.des_ede.ks1, + sizeof(ctx->c.des_ede.ks1)); + } + } + +static void des_ede3_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (key != NULL) + { + des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); + des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); + } + } + +static void des_ede_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + unsigned int i; + + if (inl < 8) return; + inl-=8; + for (i=0; i<=inl; i+=8) + { + des_ecb3_encrypt( + (des_cblock *)&(in[i]),(des_cblock *)&(out[i]), + ctx->c.des_ede.ks1, + ctx->c.des_ede.ks2, + ctx->c.des_ede.ks3, + ctx->encrypt); + } + } diff --git a/src/lib/libcrypto/evp/e_ecb_bf.c b/src/lib/libcrypto/evp/e_ecb_bf.c new file mode 100644 index 0000000000..142a9d3123 --- /dev/null +++ b/src/lib/libcrypto/evp/e_ecb_bf.c @@ -0,0 +1,122 @@ +/* crypto/evp/e_ecb_bf.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_BLOWFISH + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void bf_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void bf_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void bf_ecb_init_key(); +static void bf_ecb_cipher(); +#endif + +static EVP_CIPHER bfish_ecb_cipher= + { + NID_bf_ecb, + 8,EVP_BLOWFISH_KEY_SIZE,0, + bf_ecb_init_key, + bf_ecb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), + NULL, + NULL, + }; + +EVP_CIPHER *EVP_bf_ecb() + { + return(&bfish_ecb_cipher); + } + +static void bf_ecb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (key != NULL) + BF_set_key(&(ctx->c.bf_ks),EVP_BLOWFISH_KEY_SIZE,key); + } + +static void bf_ecb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + unsigned int i; + + if (inl < 8) return; + inl-=8; + for (i=0; i<=inl; i+=8) + { + BF_ecb_encrypt( + &(in[i]),&(out[i]), + &(ctx->c.bf_ks),ctx->encrypt); + } + } + +#endif diff --git a/src/lib/libcrypto/evp/e_ecb_c.c b/src/lib/libcrypto/evp/e_ecb_c.c new file mode 100644 index 0000000000..34e0c18296 --- /dev/null +++ b/src/lib/libcrypto/evp/e_ecb_c.c @@ -0,0 +1,122 @@ +/* crypto/evp/e_ecb_c.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_CAST + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void cast_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void cast_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void cast_ecb_init_key(); +static void cast_ecb_cipher(); +#endif + +static EVP_CIPHER cast5_ecb_cipher= + { + NID_cast5_ecb, + 8,EVP_CAST5_KEY_SIZE,0, + cast_ecb_init_key, + cast_ecb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), + NULL, + NULL, + }; + +EVP_CIPHER *EVP_cast5_ecb() + { + return(&cast5_ecb_cipher); + } + +static void cast_ecb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (key != NULL) + CAST_set_key(&(ctx->c.cast_ks),EVP_CAST5_KEY_SIZE,key); + } + +static void cast_ecb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + unsigned int i; + + if (inl < 8) return; + inl-=8; + for (i=0; i<=inl; i+=8) + { + CAST_ecb_encrypt( + &(in[i]),&(out[i]), + &(ctx->c.cast_ks),ctx->encrypt); + } + } + +#endif diff --git a/src/lib/libcrypto/evp/e_ecb_d.c b/src/lib/libcrypto/evp/e_ecb_d.c new file mode 100644 index 0000000000..7a409d6459 --- /dev/null +++ b/src/lib/libcrypto/evp/e_ecb_d.c @@ -0,0 +1,118 @@ +/* crypto/evp/e_ecb_d.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void des_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void des_ecb_init_key(); +static void des_ecb_cipher(); +#endif + +static EVP_CIPHER d_ecb_cipher= + { + NID_des_ecb, + 8,8,0, + des_ecb_init_key, + des_ecb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), + NULL, + NULL, + }; + +EVP_CIPHER *EVP_des_ecb() + { + return(&d_ecb_cipher); + } + +static void des_ecb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (key != NULL) + des_set_key((des_cblock *)key,ctx->c.des_ks); + } + +static void des_ecb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + unsigned int i; + + if (inl < 8) return; + inl-=8; + for (i=0; i<=inl; i+=8) + { + des_ecb_encrypt( + (des_cblock *)&(in[i]),(des_cblock *)&(out[i]), + ctx->c.des_ks,ctx->encrypt); + } + } diff --git a/src/lib/libcrypto/evp/e_ecb_i.c b/src/lib/libcrypto/evp/e_ecb_i.c new file mode 100644 index 0000000000..e24022a12c --- /dev/null +++ b/src/lib/libcrypto/evp/e_ecb_i.c @@ -0,0 +1,133 @@ +/* crypto/evp/e_ecb_i.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_IDEA + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void idea_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void idea_ecb_init_key(); +static void idea_ecb_cipher(); +#endif + +static EVP_CIPHER i_ecb_cipher= + { + NID_idea_ecb, + 8,16,0, + idea_ecb_init_key, + idea_ecb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), + NULL, + NULL, + }; + +EVP_CIPHER *EVP_idea_ecb() + { + return(&i_ecb_cipher); + } + +static void idea_ecb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (key != NULL) + { + if (enc) + idea_set_encrypt_key(key,&(ctx->c.idea_ks)); + else + { + IDEA_KEY_SCHEDULE tmp; + + idea_set_encrypt_key(key,&tmp); + idea_set_decrypt_key(&tmp, &(ctx->c.idea_ks)); + memset((unsigned char *)&tmp,0, + sizeof(IDEA_KEY_SCHEDULE)); + } + } + } + +static void idea_ecb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + unsigned int i; + + if (inl < 8) return; + inl-=8; + for (i=0; i<=inl; i+=8) + { + idea_ecb_encrypt( + &(in[i]),&(out[i]),&(ctx->c.idea_ks)); + } + } + +#endif diff --git a/src/lib/libcrypto/evp/e_ecb_r2.c b/src/lib/libcrypto/evp/e_ecb_r2.c new file mode 100644 index 0000000000..e35b06dc6d --- /dev/null +++ b/src/lib/libcrypto/evp/e_ecb_r2.c @@ -0,0 +1,123 @@ +/* crypto/evp/e_ecb_r2.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC2 + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void rc2_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void rc2_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void rc2_ecb_init_key(); +static void rc2_ecb_cipher(); +#endif + +static EVP_CIPHER r2_ecb_cipher= + { + NID_rc2_ecb, + 8,EVP_RC2_KEY_SIZE,0, + rc2_ecb_init_key, + rc2_ecb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), + NULL, + NULL, + }; + +EVP_CIPHER *EVP_rc2_ecb() + { + return(&r2_ecb_cipher); + } + +static void rc2_ecb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (key != NULL) + RC2_set_key(&(ctx->c.rc2_ks),EVP_RC2_KEY_SIZE,key, + EVP_RC2_KEY_SIZE*8); + } + +static void rc2_ecb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + unsigned int i; + + if (inl < 8) return; + inl-=8; + for (i=0; i<=inl; i+=8) + { + RC2_ecb_encrypt( + &(in[i]),&(out[i]), + &(ctx->c.rc2_ks),ctx->encrypt); + } + } + +#endif diff --git a/src/lib/libcrypto/evp/e_ecb_r5.c b/src/lib/libcrypto/evp/e_ecb_r5.c new file mode 100644 index 0000000000..08f4a82651 --- /dev/null +++ b/src/lib/libcrypto/evp/e_ecb_r5.c @@ -0,0 +1,123 @@ +/* crypto/evp/e_ecb_r5.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC5 + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void rc5_32_12_16_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void rc5_32_12_16_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void rc5_32_12_16_ecb_init_key(); +static void rc5_32_12_16_ecb_cipher(); +#endif + +static EVP_CIPHER rc5_ecb_cipher= + { + NID_rc5_ecb, + 8,EVP_RC5_32_12_16_KEY_SIZE,0, + rc5_32_12_16_ecb_init_key, + rc5_32_12_16_ecb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5_ks)), + NULL, + NULL, + }; + +EVP_CIPHER *EVP_rc5_32_12_16_ecb() + { + return(&rc5_ecb_cipher); + } + +static void rc5_32_12_16_ecb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (key != NULL) + RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE,key, + RC5_12_ROUNDS); + } + +static void rc5_32_12_16_ecb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + unsigned int i; + + if (inl < 8) return; + inl-=8; + for (i=0; i<=inl; i+=8) + { + RC5_32_ecb_encrypt( + &(in[i]),&(out[i]), + &(ctx->c.rc5_ks),ctx->encrypt); + } + } + +#endif diff --git a/src/lib/libcrypto/evp/e_ofb_3d.c b/src/lib/libcrypto/evp/e_ofb_3d.c new file mode 100644 index 0000000000..c3add18e93 --- /dev/null +++ b/src/lib/libcrypto/evp/e_ofb_3d.c @@ -0,0 +1,165 @@ +/* crypto/evp/e_ofb_3d.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void des_ede_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_ede3_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void des_ede_ofb_init_key(); +static void des_ede3_ofb_init_key(); +static void des_ede_ofb_cipher(); +#endif + +static EVP_CIPHER d_ede_ofb_cipher2= + { + NID_des_ede_ofb64, + 1,16,8, + des_ede_ofb_init_key, + des_ede_ofb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +static EVP_CIPHER d_ede3_ofb_cipher3= + { + NID_des_ede3_ofb64, + 1,24,8, + des_ede3_ofb_init_key, + des_ede_ofb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_des_ede_ofb() + { + return(&d_ede_ofb_cipher2); + } + +EVP_CIPHER *EVP_des_ede3_ofb() + { + return(&d_ede3_ofb_cipher3); + } + +static void des_ede_ofb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + { + des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); + des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + memcpy( (char *)ctx->c.des_ede.ks3, + (char *)ctx->c.des_ede.ks1, + sizeof(ctx->c.des_ede.ks1)); + } + } + +static void des_ede3_ofb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + { + des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); + des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); + } + } + +static void des_ede_ofb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + des_ede3_ofb64_encrypt( + in,out, + (long)inl, + ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, + (des_cblock *)&(ctx->iv[0]), + &ctx->num); + } diff --git a/src/lib/libcrypto/evp/e_ofb_bf.c b/src/lib/libcrypto/evp/e_ofb_bf.c new file mode 100644 index 0000000000..492f9b9082 --- /dev/null +++ b/src/lib/libcrypto/evp/e_ofb_bf.c @@ -0,0 +1,122 @@ +/* crypto/evp/e_ofb_bf.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_BLOWFISH + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void bf_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void bf_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void bf_ofb_init_key(); +static void bf_ofb_cipher(); +#endif + +static EVP_CIPHER bfish_ofb_cipher= + { + NID_bf_ofb64, + 1,EVP_BLOWFISH_KEY_SIZE,8, + bf_ofb_init_key, + bf_ofb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_bf_ofb() + { + return(&bfish_ofb_cipher); + } + +static void bf_ofb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + BF_set_key(&(ctx->c.bf_ks),EVP_BLOWFISH_KEY_SIZE,key); + } + +static void bf_ofb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + BF_ofb64_encrypt( + in,out, + (long)inl, &(ctx->c.bf_ks), + &(ctx->iv[0]), + &ctx->num); + } + +#endif diff --git a/src/lib/libcrypto/evp/e_ofb_c.c b/src/lib/libcrypto/evp/e_ofb_c.c new file mode 100644 index 0000000000..f1eef4469c --- /dev/null +++ b/src/lib/libcrypto/evp/e_ofb_c.c @@ -0,0 +1,122 @@ +/* crypto/evp/e_ofb_c.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_CAST + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void cast_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void cast_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void cast_ofb_init_key(); +static void cast_ofb_cipher(); +#endif + +static EVP_CIPHER cast5_ofb_cipher= + { + NID_cast5_ofb64, + 1,EVP_CAST5_KEY_SIZE,8, + cast_ofb_init_key, + cast_ofb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_cast5_ofb() + { + return(&cast5_ofb_cipher); + } + +static void cast_ofb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + CAST_set_key(&(ctx->c.cast_ks),EVP_CAST5_KEY_SIZE,key); + } + +static void cast_ofb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + CAST_ofb64_encrypt( + in,out, + (long)inl, &(ctx->c.cast_ks), + &(ctx->iv[0]), + &ctx->num); + } + +#endif diff --git a/src/lib/libcrypto/evp/e_ofb_d.c b/src/lib/libcrypto/evp/e_ofb_d.c new file mode 100644 index 0000000000..09d4b4139d --- /dev/null +++ b/src/lib/libcrypto/evp/e_ofb_d.c @@ -0,0 +1,118 @@ +/* crypto/evp/e_ofb_d.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void des_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void des_ofb_init_key(); +static void des_ofb_cipher(); +#endif + +static EVP_CIPHER d_ofb_cipher= + { + NID_des_ofb64, + 1,8,8, + des_ofb_init_key, + des_ofb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_des_ofb() + { + return(&d_ofb_cipher); + } + +static void des_ofb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + des_set_key((des_cblock *)key,ctx->c.des_ks); + } + +static void des_ofb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + des_ofb64_encrypt( + in,out, + (long)inl, ctx->c.des_ks, + (des_cblock *)&(ctx->iv[0]), + &ctx->num); + } diff --git a/src/lib/libcrypto/evp/e_ofb_i.c b/src/lib/libcrypto/evp/e_ofb_i.c new file mode 100644 index 0000000000..96c8afd9c8 --- /dev/null +++ b/src/lib/libcrypto/evp/e_ofb_i.c @@ -0,0 +1,121 @@ +/* crypto/evp/e_ofb_i.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_IDEA + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void idea_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void idea_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void idea_ofb_init_key(); +static void idea_ofb_cipher(); +#endif + +static EVP_CIPHER i_ofb_cipher= + { + NID_idea_ofb64, + 1,IDEA_KEY_LENGTH,IDEA_BLOCK, + idea_ofb_init_key, + idea_ofb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_idea_ofb() + { + return(&i_ofb_cipher); + } + +static void idea_ofb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + idea_set_encrypt_key(key,&(ctx->c.idea_ks)); + } + +static void idea_ofb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + idea_ofb64_encrypt( + in,out,(long)inl, + &(ctx->c.idea_ks),&(ctx->iv[0]), + &ctx->num); + } + +#endif diff --git a/src/lib/libcrypto/evp/e_ofb_r2.c b/src/lib/libcrypto/evp/e_ofb_r2.c new file mode 100644 index 0000000000..0f6d729988 --- /dev/null +++ b/src/lib/libcrypto/evp/e_ofb_r2.c @@ -0,0 +1,123 @@ +/* crypto/evp/e_ofb_r2.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC2 + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void rc2_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void rc2_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void rc2_ofb_init_key(); +static void rc2_ofb_cipher(); +#endif + +static EVP_CIPHER r2_ofb_cipher= + { + NID_rc2_ofb64, + 1,EVP_RC2_KEY_SIZE,8, + rc2_ofb_init_key, + rc2_ofb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_rc2_ofb() + { + return(&r2_ofb_cipher); + } + +static void rc2_ofb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + RC2_set_key(&(ctx->c.rc2_ks),EVP_RC2_KEY_SIZE,key, + EVP_RC2_KEY_SIZE*8); + } + +static void rc2_ofb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + RC2_ofb64_encrypt( + in,out, + (long)inl, &(ctx->c.rc2_ks), + &(ctx->iv[0]), + &ctx->num); + } + +#endif diff --git a/src/lib/libcrypto/evp/e_ofb_r5.c b/src/lib/libcrypto/evp/e_ofb_r5.c new file mode 100644 index 0000000000..db28d6c317 --- /dev/null +++ b/src/lib/libcrypto/evp/e_ofb_r5.c @@ -0,0 +1,123 @@ +/* crypto/evp/e_ofb_r5.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC5 + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void rc5_32_12_16_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void rc5_32_12_16_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void rc5_32_12_16_ofb_init_key(); +static void rc5_32_12_16_ofb_cipher(); +#endif + +static EVP_CIPHER rc5_ofb_cipher= + { + NID_rc5_ofb64, + 1,EVP_RC5_32_12_16_KEY_SIZE,8, + rc5_32_12_16_ofb_init_key, + rc5_32_12_16_ofb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_rc5_32_12_16_ofb() + { + return(&rc5_ofb_cipher); + } + +static void rc5_32_12_16_ofb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE,key, + RC5_12_ROUNDS); + } + +static void rc5_32_12_16_ofb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + RC5_32_ofb64_encrypt( + in,out, + (long)inl, &(ctx->c.rc5_ks), + &(ctx->iv[0]), + &ctx->num); + } + +#endif diff --git a/src/lib/libcrypto/evp/evp.err b/src/lib/libcrypto/evp/evp.err new file mode 100644 index 0000000000..cfc17437bc --- /dev/null +++ b/src/lib/libcrypto/evp/evp.err @@ -0,0 +1,24 @@ +/* Error codes for the EVP functions. */ + +/* Function codes. */ +#define EVP_F_D2I_PKEY 100 +#define EVP_F_EVP_DECRYPTFINAL 101 +#define EVP_F_EVP_OPENINIT 102 +#define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 +#define EVP_F_EVP_PKEY_DECRYPT 104 +#define EVP_F_EVP_PKEY_ENCRYPT 105 +#define EVP_F_EVP_PKEY_NEW 106 +#define EVP_F_EVP_SIGNFINAL 107 +#define EVP_F_EVP_VERIFYFINAL 108 + +/* Reason codes. */ +#define EVP_R_BAD_DECRYPT 100 +#define EVP_R_DIFFERENT_KEY_TYPES 101 +#define EVP_R_IV_TOO_LARGE 102 +#define EVP_R_MISSING_PARMATERS 103 +#define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104 +#define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 +#define EVP_R_PUBLIC_KEY_NOT_RSA 106 +#define EVP_R_UNSUPPORTED_CIPHER 107 +#define EVP_R_WRONG_FINAL_BLOCK_LENGTH 108 +#define EVP_R_WRONG_PUBLIC_KEY_TYPE 109 diff --git a/src/lib/libcrypto/evp/pk_lib.c b/src/lib/libcrypto/evp/pk_lib.c new file mode 100644 index 0000000000..08f9fabbae --- /dev/null +++ b/src/lib/libcrypto/evp/pk_lib.c @@ -0,0 +1,82 @@ +/* crypto/evp/pk_lib.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +static LHASH *pk_md=NULL; + +static LHASH *pk_md=NULL; + +int EVP_add_pkey_md(oid,pkm,md) +int oid; +EVP_PKEY_METHOD *pkm; +EVP_MD *md; + { + } + +EVP_add_pkey(pkm) +EVP_PKEY_METHOD *pkm; + { + } + +EVP_PKEY_METHOD:q + + diff --git a/src/lib/libcrypto/libvms.com b/src/lib/libcrypto/libvms.com new file mode 100644 index 0000000000..44f90c65b0 --- /dev/null +++ b/src/lib/libcrypto/libvms.com @@ -0,0 +1,31 @@ +$! +$! Compile crypto.c as several subset modules and insert in crypto-xxx.olb. +$! If P1 is specifed, it specifies alternate list of subsets to compile. +$! +$ libname = "CRYPTO-AXP.OLB" +$ subset_list = "LIB,ASN1,BN,BUFFER,CONF,DES,DH,DSA,ERROR,EVP,IDEA,LHASH,MD," + - + "METH,OBJECTS,PEM,RAND,RC,RSA,SHA,STACK,TXT_DB,X509" +$ if p1 .nes. "" then subset_list = p1 +$! +$ if f$getsyi("CPU") .lt. 128 then libname = "CRYPTO-VAX.OLB" +$ if f$search(libname) .eqs. "" then library/create/object/log 'libname' +$! +$ cc = "cc/include=[-.include]/prefix=all" + P2 +$! +$ i = 0 +$ next_subset: +$ subset = f$element(i,",",subset_list) +$ if subset .eqs. "," then goto done +$ i = i + 1 +$ create crypto_'subset'.subset +#include "crypto.c" +$ ofile = "sys$disk:[]crypto_" + subset + ".obj" +$ on warning then goto next_subset +$ write sys$output "Compiling ", ofile +$ cc /object='ofile' crypto_'subset'.subset - + /define=(CRYPTO_SUBSET,CRYPTO_'subset'_SUBSET) +$ library/replace/log 'libname'/module=CRYPTO_'subset' 'ofile' +$ goto next_subset +$! +$ done: +$ exit diff --git a/src/lib/libcrypto/md2/md2.org b/src/lib/libcrypto/md2/md2.org new file mode 100644 index 0000000000..9f39933790 --- /dev/null +++ b/src/lib/libcrypto/md2/md2.org @@ -0,0 +1,106 @@ +/* crypto/md/md2.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify md2.org since md2.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + + +#ifndef HEADER_MD2_H +#define HEADER_MD2_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define MD2_DIGEST_LENGTH 16 +#define MD2_BLOCK 16 + +#define MD2_INT unsigned int + +typedef struct MD2state_st + { + int num; + unsigned char data[MD2_BLOCK]; + MD2_INT cksm[MD2_BLOCK]; + MD2_INT state[MD2_BLOCK]; + } MD2_CTX; + +#ifndef NOPROTO +char *MD2_options(void); +void MD2_Init(MD2_CTX *c); +void MD2_Update(MD2_CTX *c, register unsigned char *data, unsigned long len); +void MD2_Final(unsigned char *md, MD2_CTX *c); +unsigned char *MD2(unsigned char *d, unsigned long n,unsigned char *md); +#else +char *MD2_options(); +void MD2_Init(); +void MD2_Update(); +void MD2_Final(); +unsigned char *MD2(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/lib/libcrypto/md5/Makefile.uni b/src/lib/libcrypto/md5/Makefile.uni new file mode 100644 index 0000000000..54685712db --- /dev/null +++ b/src/lib/libcrypto/md5/Makefile.uni @@ -0,0 +1,109 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +DIR= md5 +TOP= . +CC= gcc +CFLAG= -O3 -fomit-frame-pointer + +CPP= $(CC) -E +INCLUDES= +INSTALLTOP=/usr/local/lib +MAKE= make +MAKEDEPEND= makedepend +MAKEFILE= Makefile.uni +AR= ar r + +MD5_ASM_OBJ= + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile +TEST=md5test +APPS=md5 + +LIB=libmd5.a +LIBSRC=md5_dgst.c md5_one.c +LIBOBJ=md5_dgst.o md5_one.o $(MD5_ASM_OBJ) + +SRC= $(LIBSRC) + +EXHEADER= md5.h +HEADER= md5_locl.h $(EXHEADER) + +ALL= $(GENERAL) $(SRC) $(HEADER) + +all: $(LIB) $(TEST) $(APPS) + +$(LIB): $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) + sh $(TOP)/ranlib.sh $(LIB) + +# elf +asm/mx86-elf.o: asm/mx86unix.cpp + $(CPP) -DELF asm/mx86unix.cpp | as -o asm/mx86-elf.o + +# solaris +asm/mx86-sol.o: asm/mx86unix.cpp + $(CC) -E -DSOL asm/mx86unix.cpp | sed 's/^#.*//' > asm/mx86-sol.s + as -o asm/mx86-sol.o asm/mx86-sol.s + rm -f asm/mx86-sol.s + +# a.out +asm/mx86-out.o: asm/mx86unix.cpp + $(CPP) -DOUT asm/mx86unix.cpp | as -o asm/mx86-out.o + +# bsdi +asm/mx86bsdi.o: asm/mx86unix.cpp + $(CPP) -DBSDI asm/mx86unix.cpp | as -o asm/mx86bsdi.o + +asm/mx86unix.cpp: + (cd asm; perl md5-586.pl cpp >mx86unix.cpp) + +test: $(TEST) + ./$(TEST) + +$(TEST): $(TEST).c $(LIB) + $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) + +$(APPS): $(APPS).c $(LIB) + $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + +dclean: + perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff + +cc: + $(MAKE) MD5_ASM_OBJ="" CC="cc" CFLAG="-O" all + +gcc: + $(MAKE) MD5_ASM_OBJ="" CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all + +x86-elf: + $(MAKE) MD5_ASM_OBJ="asm/mx86-elf.o" CFLAG="-DELF -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-out: + $(MAKE) MD5_ASM_OBJ="asm/mx86-out.o" CFLAG="-DOUT -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-solaris: + $(MAKE) MD5_ASM_OBJ="asm/mx86-sol.o" CFLAG="-DSOL -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-bdsi: + $(MAKE) MD5_ASM_OBJ="asm/mx86-bdsi.o" CFLAG="-DBDSI -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/md5/asm/m5-win32.asm b/src/lib/libcrypto/md5/asm/m5-win32.asm new file mode 100644 index 0000000000..c2081da746 --- /dev/null +++ b/src/lib/libcrypto/md5/asm/m5-win32.asm @@ -0,0 +1,686 @@ + ; Don't even think of reading this code + ; It was automatically generated by md5-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE md5-586.asm + .386 +.model FLAT +_TEXT SEGMENT +PUBLIC _md5_block_x86 + +_md5_block_x86 PROC NEAR + push esi + push edi + mov edi, DWORD PTR 12[esp] + mov esi, DWORD PTR 16[esp] + mov ecx, DWORD PTR 20[esp] + push ebp + push ebx + add ecx, esi + sub ecx, 64 + mov eax, DWORD PTR [edi] + push ecx + mov ebx, DWORD PTR 4[edi] + mov ecx, DWORD PTR 8[edi] + mov edx, DWORD PTR 12[edi] +L000start: + ; + ; R0 section + mov edi, ecx + mov ebp, DWORD PTR [esi] + ; R0 0 + xor edi, edx + and edi, ebx + lea eax, DWORD PTR 3614090360[ebp*1+eax] + mov ebp, DWORD PTR 4[esi] + xor edi, edx + add eax, edi + mov edi, ebx + rol eax, 7 + add eax, ebx + ; R0 1 + xor edi, ecx + and edi, eax + lea edx, DWORD PTR 3905402710[ebp*1+edx] + mov ebp, DWORD PTR 8[esi] + xor edi, ecx + add edx, edi + mov edi, eax + rol edx, 12 + add edx, eax + ; R0 2 + xor edi, ebx + and edi, edx + lea ecx, DWORD PTR 606105819[ebp*1+ecx] + mov ebp, DWORD PTR 12[esi] + xor edi, ebx + add ecx, edi + mov edi, edx + rol ecx, 17 + add ecx, edx + ; R0 3 + xor edi, eax + and edi, ecx + lea ebx, DWORD PTR 3250441966[ebp*1+ebx] + mov ebp, DWORD PTR 16[esi] + xor edi, eax + add ebx, edi + mov edi, ecx + rol ebx, 22 + add ebx, ecx + ; R0 4 + xor edi, edx + and edi, ebx + lea eax, DWORD PTR 4118548399[ebp*1+eax] + mov ebp, DWORD PTR 20[esi] + xor edi, edx + add eax, edi + mov edi, ebx + rol eax, 7 + add eax, ebx + ; R0 5 + xor edi, ecx + and edi, eax + lea edx, DWORD PTR 1200080426[ebp*1+edx] + mov ebp, DWORD PTR 24[esi] + xor edi, ecx + add edx, edi + mov edi, eax + rol edx, 12 + add edx, eax + ; R0 6 + xor edi, ebx + and edi, edx + lea ecx, DWORD PTR 2821735955[ebp*1+ecx] + mov ebp, DWORD PTR 28[esi] + xor edi, ebx + add ecx, edi + mov edi, edx + rol ecx, 17 + add ecx, edx + ; R0 7 + xor edi, eax + and edi, ecx + lea ebx, DWORD PTR 4249261313[ebp*1+ebx] + mov ebp, DWORD PTR 32[esi] + xor edi, eax + add ebx, edi + mov edi, ecx + rol ebx, 22 + add ebx, ecx + ; R0 8 + xor edi, edx + and edi, ebx + lea eax, DWORD PTR 1770035416[ebp*1+eax] + mov ebp, DWORD PTR 36[esi] + xor edi, edx + add eax, edi + mov edi, ebx + rol eax, 7 + add eax, ebx + ; R0 9 + xor edi, ecx + and edi, eax + lea edx, DWORD PTR 2336552879[ebp*1+edx] + mov ebp, DWORD PTR 40[esi] + xor edi, ecx + add edx, edi + mov edi, eax + rol edx, 12 + add edx, eax + ; R0 10 + xor edi, ebx + and edi, edx + lea ecx, DWORD PTR 4294925233[ebp*1+ecx] + mov ebp, DWORD PTR 44[esi] + xor edi, ebx + add ecx, edi + mov edi, edx + rol ecx, 17 + add ecx, edx + ; R0 11 + xor edi, eax + and edi, ecx + lea ebx, DWORD PTR 2304563134[ebp*1+ebx] + mov ebp, DWORD PTR 48[esi] + xor edi, eax + add ebx, edi + mov edi, ecx + rol ebx, 22 + add ebx, ecx + ; R0 12 + xor edi, edx + and edi, ebx + lea eax, DWORD PTR 1804603682[ebp*1+eax] + mov ebp, DWORD PTR 52[esi] + xor edi, edx + add eax, edi + mov edi, ebx + rol eax, 7 + add eax, ebx + ; R0 13 + xor edi, ecx + and edi, eax + lea edx, DWORD PTR 4254626195[ebp*1+edx] + mov ebp, DWORD PTR 56[esi] + xor edi, ecx + add edx, edi + mov edi, eax + rol edx, 12 + add edx, eax + ; R0 14 + xor edi, ebx + and edi, edx + lea ecx, DWORD PTR 2792965006[ebp*1+ecx] + mov ebp, DWORD PTR 60[esi] + xor edi, ebx + add ecx, edi + mov edi, edx + rol ecx, 17 + add ecx, edx + ; R0 15 + xor edi, eax + and edi, ecx + lea ebx, DWORD PTR 1236535329[ebp*1+ebx] + mov ebp, DWORD PTR 4[esi] + xor edi, eax + add ebx, edi + mov edi, ecx + rol ebx, 22 + add ebx, ecx + ; + ; R1 section + ; R1 16 + lea eax, DWORD PTR 4129170786[ebp*1+eax] + xor edi, ebx + and edi, edx + mov ebp, DWORD PTR 24[esi] + xor edi, ecx + add eax, edi + mov edi, ebx + rol eax, 5 + add eax, ebx + ; R1 17 + lea edx, DWORD PTR 3225465664[ebp*1+edx] + xor edi, eax + and edi, ecx + mov ebp, DWORD PTR 44[esi] + xor edi, ebx + add edx, edi + mov edi, eax + rol edx, 9 + add edx, eax + ; R1 18 + lea ecx, DWORD PTR 643717713[ebp*1+ecx] + xor edi, edx + and edi, ebx + mov ebp, DWORD PTR [esi] + xor edi, eax + add ecx, edi + mov edi, edx + rol ecx, 14 + add ecx, edx + ; R1 19 + lea ebx, DWORD PTR 3921069994[ebp*1+ebx] + xor edi, ecx + and edi, eax + mov ebp, DWORD PTR 20[esi] + xor edi, edx + add ebx, edi + mov edi, ecx + rol ebx, 20 + add ebx, ecx + ; R1 20 + lea eax, DWORD PTR 3593408605[ebp*1+eax] + xor edi, ebx + and edi, edx + mov ebp, DWORD PTR 40[esi] + xor edi, ecx + add eax, edi + mov edi, ebx + rol eax, 5 + add eax, ebx + ; R1 21 + lea edx, DWORD PTR 38016083[ebp*1+edx] + xor edi, eax + and edi, ecx + mov ebp, DWORD PTR 60[esi] + xor edi, ebx + add edx, edi + mov edi, eax + rol edx, 9 + add edx, eax + ; R1 22 + lea ecx, DWORD PTR 3634488961[ebp*1+ecx] + xor edi, edx + and edi, ebx + mov ebp, DWORD PTR 16[esi] + xor edi, eax + add ecx, edi + mov edi, edx + rol ecx, 14 + add ecx, edx + ; R1 23 + lea ebx, DWORD PTR 3889429448[ebp*1+ebx] + xor edi, ecx + and edi, eax + mov ebp, DWORD PTR 36[esi] + xor edi, edx + add ebx, edi + mov edi, ecx + rol ebx, 20 + add ebx, ecx + ; R1 24 + lea eax, DWORD PTR 568446438[ebp*1+eax] + xor edi, ebx + and edi, edx + mov ebp, DWORD PTR 56[esi] + xor edi, ecx + add eax, edi + mov edi, ebx + rol eax, 5 + add eax, ebx + ; R1 25 + lea edx, DWORD PTR 3275163606[ebp*1+edx] + xor edi, eax + and edi, ecx + mov ebp, DWORD PTR 12[esi] + xor edi, ebx + add edx, edi + mov edi, eax + rol edx, 9 + add edx, eax + ; R1 26 + lea ecx, DWORD PTR 4107603335[ebp*1+ecx] + xor edi, edx + and edi, ebx + mov ebp, DWORD PTR 32[esi] + xor edi, eax + add ecx, edi + mov edi, edx + rol ecx, 14 + add ecx, edx + ; R1 27 + lea ebx, DWORD PTR 1163531501[ebp*1+ebx] + xor edi, ecx + and edi, eax + mov ebp, DWORD PTR 52[esi] + xor edi, edx + add ebx, edi + mov edi, ecx + rol ebx, 20 + add ebx, ecx + ; R1 28 + lea eax, DWORD PTR 2850285829[ebp*1+eax] + xor edi, ebx + and edi, edx + mov ebp, DWORD PTR 8[esi] + xor edi, ecx + add eax, edi + mov edi, ebx + rol eax, 5 + add eax, ebx + ; R1 29 + lea edx, DWORD PTR 4243563512[ebp*1+edx] + xor edi, eax + and edi, ecx + mov ebp, DWORD PTR 28[esi] + xor edi, ebx + add edx, edi + mov edi, eax + rol edx, 9 + add edx, eax + ; R1 30 + lea ecx, DWORD PTR 1735328473[ebp*1+ecx] + xor edi, edx + and edi, ebx + mov ebp, DWORD PTR 48[esi] + xor edi, eax + add ecx, edi + mov edi, edx + rol ecx, 14 + add ecx, edx + ; R1 31 + lea ebx, DWORD PTR 2368359562[ebp*1+ebx] + xor edi, ecx + and edi, eax + mov ebp, DWORD PTR 20[esi] + xor edi, edx + add ebx, edi + mov edi, ecx + rol ebx, 20 + add ebx, ecx + ; + ; R2 section + ; R2 32 + xor edi, edx + xor edi, ebx + lea eax, DWORD PTR 4294588738[ebp*1+eax] + add eax, edi + mov ebp, DWORD PTR 32[esi] + rol eax, 4 + mov edi, ebx + ; R2 33 + lea edx, DWORD PTR 2272392833[ebp*1+edx] + add eax, ebx + xor edi, ecx + xor edi, eax + mov ebp, DWORD PTR 44[esi] + add edx, edi + mov edi, eax + rol edx, 11 + add edx, eax + ; R2 34 + xor edi, ebx + xor edi, edx + lea ecx, DWORD PTR 1839030562[ebp*1+ecx] + add ecx, edi + mov ebp, DWORD PTR 56[esi] + rol ecx, 16 + mov edi, edx + ; R2 35 + lea ebx, DWORD PTR 4259657740[ebp*1+ebx] + add ecx, edx + xor edi, eax + xor edi, ecx + mov ebp, DWORD PTR 4[esi] + add ebx, edi + mov edi, ecx + rol ebx, 23 + add ebx, ecx + ; R2 36 + xor edi, edx + xor edi, ebx + lea eax, DWORD PTR 2763975236[ebp*1+eax] + add eax, edi + mov ebp, DWORD PTR 16[esi] + rol eax, 4 + mov edi, ebx + ; R2 37 + lea edx, DWORD PTR 1272893353[ebp*1+edx] + add eax, ebx + xor edi, ecx + xor edi, eax + mov ebp, DWORD PTR 28[esi] + add edx, edi + mov edi, eax + rol edx, 11 + add edx, eax + ; R2 38 + xor edi, ebx + xor edi, edx + lea ecx, DWORD PTR 4139469664[ebp*1+ecx] + add ecx, edi + mov ebp, DWORD PTR 40[esi] + rol ecx, 16 + mov edi, edx + ; R2 39 + lea ebx, DWORD PTR 3200236656[ebp*1+ebx] + add ecx, edx + xor edi, eax + xor edi, ecx + mov ebp, DWORD PTR 52[esi] + add ebx, edi + mov edi, ecx + rol ebx, 23 + add ebx, ecx + ; R2 40 + xor edi, edx + xor edi, ebx + lea eax, DWORD PTR 681279174[ebp*1+eax] + add eax, edi + mov ebp, DWORD PTR [esi] + rol eax, 4 + mov edi, ebx + ; R2 41 + lea edx, DWORD PTR 3936430074[ebp*1+edx] + add eax, ebx + xor edi, ecx + xor edi, eax + mov ebp, DWORD PTR 12[esi] + add edx, edi + mov edi, eax + rol edx, 11 + add edx, eax + ; R2 42 + xor edi, ebx + xor edi, edx + lea ecx, DWORD PTR 3572445317[ebp*1+ecx] + add ecx, edi + mov ebp, DWORD PTR 24[esi] + rol ecx, 16 + mov edi, edx + ; R2 43 + lea ebx, DWORD PTR 76029189[ebp*1+ebx] + add ecx, edx + xor edi, eax + xor edi, ecx + mov ebp, DWORD PTR 36[esi] + add ebx, edi + mov edi, ecx + rol ebx, 23 + add ebx, ecx + ; R2 44 + xor edi, edx + xor edi, ebx + lea eax, DWORD PTR 3654602809[ebp*1+eax] + add eax, edi + mov ebp, DWORD PTR 48[esi] + rol eax, 4 + mov edi, ebx + ; R2 45 + lea edx, DWORD PTR 3873151461[ebp*1+edx] + add eax, ebx + xor edi, ecx + xor edi, eax + mov ebp, DWORD PTR 60[esi] + add edx, edi + mov edi, eax + rol edx, 11 + add edx, eax + ; R2 46 + xor edi, ebx + xor edi, edx + lea ecx, DWORD PTR 530742520[ebp*1+ecx] + add ecx, edi + mov ebp, DWORD PTR 8[esi] + rol ecx, 16 + mov edi, edx + ; R2 47 + lea ebx, DWORD PTR 3299628645[ebp*1+ebx] + add ecx, edx + xor edi, eax + xor edi, ecx + mov ebp, DWORD PTR [esi] + add ebx, edi + mov edi, -1 + rol ebx, 23 + add ebx, ecx + ; + ; R3 section + ; R3 48 + xor edi, edx + or edi, ebx + lea eax, DWORD PTR 4096336452[ebp*1+eax] + xor edi, ecx + mov ebp, DWORD PTR 28[esi] + add eax, edi + mov edi, -1 + rol eax, 6 + xor edi, ecx + add eax, ebx + ; R3 49 + or edi, eax + lea edx, DWORD PTR 1126891415[ebp*1+edx] + xor edi, ebx + mov ebp, DWORD PTR 56[esi] + add edx, edi + mov edi, -1 + rol edx, 10 + xor edi, ebx + add edx, eax + ; R3 50 + or edi, edx + lea ecx, DWORD PTR 2878612391[ebp*1+ecx] + xor edi, eax + mov ebp, DWORD PTR 20[esi] + add ecx, edi + mov edi, -1 + rol ecx, 15 + xor edi, eax + add ecx, edx + ; R3 51 + or edi, ecx + lea ebx, DWORD PTR 4237533241[ebp*1+ebx] + xor edi, edx + mov ebp, DWORD PTR 48[esi] + add ebx, edi + mov edi, -1 + rol ebx, 21 + xor edi, edx + add ebx, ecx + ; R3 52 + or edi, ebx + lea eax, DWORD PTR 1700485571[ebp*1+eax] + xor edi, ecx + mov ebp, DWORD PTR 12[esi] + add eax, edi + mov edi, -1 + rol eax, 6 + xor edi, ecx + add eax, ebx + ; R3 53 + or edi, eax + lea edx, DWORD PTR 2399980690[ebp*1+edx] + xor edi, ebx + mov ebp, DWORD PTR 40[esi] + add edx, edi + mov edi, -1 + rol edx, 10 + xor edi, ebx + add edx, eax + ; R3 54 + or edi, edx + lea ecx, DWORD PTR 4293915773[ebp*1+ecx] + xor edi, eax + mov ebp, DWORD PTR 4[esi] + add ecx, edi + mov edi, -1 + rol ecx, 15 + xor edi, eax + add ecx, edx + ; R3 55 + or edi, ecx + lea ebx, DWORD PTR 2240044497[ebp*1+ebx] + xor edi, edx + mov ebp, DWORD PTR 32[esi] + add ebx, edi + mov edi, -1 + rol ebx, 21 + xor edi, edx + add ebx, ecx + ; R3 56 + or edi, ebx + lea eax, DWORD PTR 1873313359[ebp*1+eax] + xor edi, ecx + mov ebp, DWORD PTR 60[esi] + add eax, edi + mov edi, -1 + rol eax, 6 + xor edi, ecx + add eax, ebx + ; R3 57 + or edi, eax + lea edx, DWORD PTR 4264355552[ebp*1+edx] + xor edi, ebx + mov ebp, DWORD PTR 24[esi] + add edx, edi + mov edi, -1 + rol edx, 10 + xor edi, ebx + add edx, eax + ; R3 58 + or edi, edx + lea ecx, DWORD PTR 2734768916[ebp*1+ecx] + xor edi, eax + mov ebp, DWORD PTR 52[esi] + add ecx, edi + mov edi, -1 + rol ecx, 15 + xor edi, eax + add ecx, edx + ; R3 59 + or edi, ecx + lea ebx, DWORD PTR 1309151649[ebp*1+ebx] + xor edi, edx + mov ebp, DWORD PTR 16[esi] + add ebx, edi + mov edi, -1 + rol ebx, 21 + xor edi, edx + add ebx, ecx + ; R3 60 + or edi, ebx + lea eax, DWORD PTR 4149444226[ebp*1+eax] + xor edi, ecx + mov ebp, DWORD PTR 44[esi] + add eax, edi + mov edi, -1 + rol eax, 6 + xor edi, ecx + add eax, ebx + ; R3 61 + or edi, eax + lea edx, DWORD PTR 3174756917[ebp*1+edx] + xor edi, ebx + mov ebp, DWORD PTR 8[esi] + add edx, edi + mov edi, -1 + rol edx, 10 + xor edi, ebx + add edx, eax + ; R3 62 + or edi, edx + lea ecx, DWORD PTR 718787259[ebp*1+ecx] + xor edi, eax + mov ebp, DWORD PTR 36[esi] + add ecx, edi + mov edi, -1 + rol ecx, 15 + xor edi, eax + add ecx, edx + ; R3 63 + or edi, ecx + lea ebx, DWORD PTR 3951481745[ebp*1+ebx] + xor edi, edx + mov ebp, DWORD PTR 24[esp] + add ebx, edi + add esi, 64 + rol ebx, 21 + mov edi, DWORD PTR [ebp] + add ebx, ecx + add eax, edi + mov edi, DWORD PTR 4[ebp] + add ebx, edi + mov edi, DWORD PTR 8[ebp] + add ecx, edi + mov edi, DWORD PTR 12[ebp] + add edx, edi + mov DWORD PTR [ebp],eax + mov DWORD PTR 4[ebp],ebx + mov edi, DWORD PTR [esp] + mov DWORD PTR 8[ebp],ecx + mov DWORD PTR 12[ebp],edx + cmp edi, esi + jge L000start + pop eax + pop ebx + pop ebp + pop edi + pop esi + ret +_md5_block_x86 ENDP +_TEXT ENDS +END diff --git a/src/lib/libcrypto/md5/asm/mx86unix.cpp b/src/lib/libcrypto/md5/asm/mx86unix.cpp new file mode 100644 index 0000000000..5d399122b6 --- /dev/null +++ b/src/lib/libcrypto/md5/asm/mx86unix.cpp @@ -0,0 +1,730 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define md5_block_x86 _md5_block_x86 + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by md5-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "md5-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl md5_block_x86 + TYPE(md5_block_x86,@function) +md5_block_x86: + pushl %esi + pushl %edi + movl 12(%esp), %edi + movl 16(%esp), %esi + movl 20(%esp), %ecx + pushl %ebp + pushl %ebx + addl %esi, %ecx + subl $64, %ecx + movl (%edi), %eax + pushl %ecx + movl 4(%edi), %ebx + movl 8(%edi), %ecx + movl 12(%edi), %edx +.L000start: + + /* R0 section */ + movl %ecx, %edi + movl (%esi), %ebp + /* R0 0 */ + xorl %edx, %edi + andl %ebx, %edi + leal 3614090360(%eax,%ebp,1),%eax + movl 4(%esi), %ebp + xorl %edx, %edi + addl %edi, %eax + movl %ebx, %edi + roll $7, %eax + addl %ebx, %eax + /* R0 1 */ + xorl %ecx, %edi + andl %eax, %edi + leal 3905402710(%edx,%ebp,1),%edx + movl 8(%esi), %ebp + xorl %ecx, %edi + addl %edi, %edx + movl %eax, %edi + roll $12, %edx + addl %eax, %edx + /* R0 2 */ + xorl %ebx, %edi + andl %edx, %edi + leal 606105819(%ecx,%ebp,1),%ecx + movl 12(%esi), %ebp + xorl %ebx, %edi + addl %edi, %ecx + movl %edx, %edi + roll $17, %ecx + addl %edx, %ecx + /* R0 3 */ + xorl %eax, %edi + andl %ecx, %edi + leal 3250441966(%ebx,%ebp,1),%ebx + movl 16(%esi), %ebp + xorl %eax, %edi + addl %edi, %ebx + movl %ecx, %edi + roll $22, %ebx + addl %ecx, %ebx + /* R0 4 */ + xorl %edx, %edi + andl %ebx, %edi + leal 4118548399(%eax,%ebp,1),%eax + movl 20(%esi), %ebp + xorl %edx, %edi + addl %edi, %eax + movl %ebx, %edi + roll $7, %eax + addl %ebx, %eax + /* R0 5 */ + xorl %ecx, %edi + andl %eax, %edi + leal 1200080426(%edx,%ebp,1),%edx + movl 24(%esi), %ebp + xorl %ecx, %edi + addl %edi, %edx + movl %eax, %edi + roll $12, %edx + addl %eax, %edx + /* R0 6 */ + xorl %ebx, %edi + andl %edx, %edi + leal 2821735955(%ecx,%ebp,1),%ecx + movl 28(%esi), %ebp + xorl %ebx, %edi + addl %edi, %ecx + movl %edx, %edi + roll $17, %ecx + addl %edx, %ecx + /* R0 7 */ + xorl %eax, %edi + andl %ecx, %edi + leal 4249261313(%ebx,%ebp,1),%ebx + movl 32(%esi), %ebp + xorl %eax, %edi + addl %edi, %ebx + movl %ecx, %edi + roll $22, %ebx + addl %ecx, %ebx + /* R0 8 */ + xorl %edx, %edi + andl %ebx, %edi + leal 1770035416(%eax,%ebp,1),%eax + movl 36(%esi), %ebp + xorl %edx, %edi + addl %edi, %eax + movl %ebx, %edi + roll $7, %eax + addl %ebx, %eax + /* R0 9 */ + xorl %ecx, %edi + andl %eax, %edi + leal 2336552879(%edx,%ebp,1),%edx + movl 40(%esi), %ebp + xorl %ecx, %edi + addl %edi, %edx + movl %eax, %edi + roll $12, %edx + addl %eax, %edx + /* R0 10 */ + xorl %ebx, %edi + andl %edx, %edi + leal 4294925233(%ecx,%ebp,1),%ecx + movl 44(%esi), %ebp + xorl %ebx, %edi + addl %edi, %ecx + movl %edx, %edi + roll $17, %ecx + addl %edx, %ecx + /* R0 11 */ + xorl %eax, %edi + andl %ecx, %edi + leal 2304563134(%ebx,%ebp,1),%ebx + movl 48(%esi), %ebp + xorl %eax, %edi + addl %edi, %ebx + movl %ecx, %edi + roll $22, %ebx + addl %ecx, %ebx + /* R0 12 */ + xorl %edx, %edi + andl %ebx, %edi + leal 1804603682(%eax,%ebp,1),%eax + movl 52(%esi), %ebp + xorl %edx, %edi + addl %edi, %eax + movl %ebx, %edi + roll $7, %eax + addl %ebx, %eax + /* R0 13 */ + xorl %ecx, %edi + andl %eax, %edi + leal 4254626195(%edx,%ebp,1),%edx + movl 56(%esi), %ebp + xorl %ecx, %edi + addl %edi, %edx + movl %eax, %edi + roll $12, %edx + addl %eax, %edx + /* R0 14 */ + xorl %ebx, %edi + andl %edx, %edi + leal 2792965006(%ecx,%ebp,1),%ecx + movl 60(%esi), %ebp + xorl %ebx, %edi + addl %edi, %ecx + movl %edx, %edi + roll $17, %ecx + addl %edx, %ecx + /* R0 15 */ + xorl %eax, %edi + andl %ecx, %edi + leal 1236535329(%ebx,%ebp,1),%ebx + movl 4(%esi), %ebp + xorl %eax, %edi + addl %edi, %ebx + movl %ecx, %edi + roll $22, %ebx + addl %ecx, %ebx + + /* R1 section */ + /* R1 16 */ + leal 4129170786(%eax,%ebp,1),%eax + xorl %ebx, %edi + andl %edx, %edi + movl 24(%esi), %ebp + xorl %ecx, %edi + addl %edi, %eax + movl %ebx, %edi + roll $5, %eax + addl %ebx, %eax + /* R1 17 */ + leal 3225465664(%edx,%ebp,1),%edx + xorl %eax, %edi + andl %ecx, %edi + movl 44(%esi), %ebp + xorl %ebx, %edi + addl %edi, %edx + movl %eax, %edi + roll $9, %edx + addl %eax, %edx + /* R1 18 */ + leal 643717713(%ecx,%ebp,1),%ecx + xorl %edx, %edi + andl %ebx, %edi + movl (%esi), %ebp + xorl %eax, %edi + addl %edi, %ecx + movl %edx, %edi + roll $14, %ecx + addl %edx, %ecx + /* R1 19 */ + leal 3921069994(%ebx,%ebp,1),%ebx + xorl %ecx, %edi + andl %eax, %edi + movl 20(%esi), %ebp + xorl %edx, %edi + addl %edi, %ebx + movl %ecx, %edi + roll $20, %ebx + addl %ecx, %ebx + /* R1 20 */ + leal 3593408605(%eax,%ebp,1),%eax + xorl %ebx, %edi + andl %edx, %edi + movl 40(%esi), %ebp + xorl %ecx, %edi + addl %edi, %eax + movl %ebx, %edi + roll $5, %eax + addl %ebx, %eax + /* R1 21 */ + leal 38016083(%edx,%ebp,1),%edx + xorl %eax, %edi + andl %ecx, %edi + movl 60(%esi), %ebp + xorl %ebx, %edi + addl %edi, %edx + movl %eax, %edi + roll $9, %edx + addl %eax, %edx + /* R1 22 */ + leal 3634488961(%ecx,%ebp,1),%ecx + xorl %edx, %edi + andl %ebx, %edi + movl 16(%esi), %ebp + xorl %eax, %edi + addl %edi, %ecx + movl %edx, %edi + roll $14, %ecx + addl %edx, %ecx + /* R1 23 */ + leal 3889429448(%ebx,%ebp,1),%ebx + xorl %ecx, %edi + andl %eax, %edi + movl 36(%esi), %ebp + xorl %edx, %edi + addl %edi, %ebx + movl %ecx, %edi + roll $20, %ebx + addl %ecx, %ebx + /* R1 24 */ + leal 568446438(%eax,%ebp,1),%eax + xorl %ebx, %edi + andl %edx, %edi + movl 56(%esi), %ebp + xorl %ecx, %edi + addl %edi, %eax + movl %ebx, %edi + roll $5, %eax + addl %ebx, %eax + /* R1 25 */ + leal 3275163606(%edx,%ebp,1),%edx + xorl %eax, %edi + andl %ecx, %edi + movl 12(%esi), %ebp + xorl %ebx, %edi + addl %edi, %edx + movl %eax, %edi + roll $9, %edx + addl %eax, %edx + /* R1 26 */ + leal 4107603335(%ecx,%ebp,1),%ecx + xorl %edx, %edi + andl %ebx, %edi + movl 32(%esi), %ebp + xorl %eax, %edi + addl %edi, %ecx + movl %edx, %edi + roll $14, %ecx + addl %edx, %ecx + /* R1 27 */ + leal 1163531501(%ebx,%ebp,1),%ebx + xorl %ecx, %edi + andl %eax, %edi + movl 52(%esi), %ebp + xorl %edx, %edi + addl %edi, %ebx + movl %ecx, %edi + roll $20, %ebx + addl %ecx, %ebx + /* R1 28 */ + leal 2850285829(%eax,%ebp,1),%eax + xorl %ebx, %edi + andl %edx, %edi + movl 8(%esi), %ebp + xorl %ecx, %edi + addl %edi, %eax + movl %ebx, %edi + roll $5, %eax + addl %ebx, %eax + /* R1 29 */ + leal 4243563512(%edx,%ebp,1),%edx + xorl %eax, %edi + andl %ecx, %edi + movl 28(%esi), %ebp + xorl %ebx, %edi + addl %edi, %edx + movl %eax, %edi + roll $9, %edx + addl %eax, %edx + /* R1 30 */ + leal 1735328473(%ecx,%ebp,1),%ecx + xorl %edx, %edi + andl %ebx, %edi + movl 48(%esi), %ebp + xorl %eax, %edi + addl %edi, %ecx + movl %edx, %edi + roll $14, %ecx + addl %edx, %ecx + /* R1 31 */ + leal 2368359562(%ebx,%ebp,1),%ebx + xorl %ecx, %edi + andl %eax, %edi + movl 20(%esi), %ebp + xorl %edx, %edi + addl %edi, %ebx + movl %ecx, %edi + roll $20, %ebx + addl %ecx, %ebx + + /* R2 section */ + /* R2 32 */ + xorl %edx, %edi + xorl %ebx, %edi + leal 4294588738(%eax,%ebp,1),%eax + addl %edi, %eax + movl 32(%esi), %ebp + roll $4, %eax + movl %ebx, %edi + /* R2 33 */ + leal 2272392833(%edx,%ebp,1),%edx + addl %ebx, %eax + xorl %ecx, %edi + xorl %eax, %edi + movl 44(%esi), %ebp + addl %edi, %edx + movl %eax, %edi + roll $11, %edx + addl %eax, %edx + /* R2 34 */ + xorl %ebx, %edi + xorl %edx, %edi + leal 1839030562(%ecx,%ebp,1),%ecx + addl %edi, %ecx + movl 56(%esi), %ebp + roll $16, %ecx + movl %edx, %edi + /* R2 35 */ + leal 4259657740(%ebx,%ebp,1),%ebx + addl %edx, %ecx + xorl %eax, %edi + xorl %ecx, %edi + movl 4(%esi), %ebp + addl %edi, %ebx + movl %ecx, %edi + roll $23, %ebx + addl %ecx, %ebx + /* R2 36 */ + xorl %edx, %edi + xorl %ebx, %edi + leal 2763975236(%eax,%ebp,1),%eax + addl %edi, %eax + movl 16(%esi), %ebp + roll $4, %eax + movl %ebx, %edi + /* R2 37 */ + leal 1272893353(%edx,%ebp,1),%edx + addl %ebx, %eax + xorl %ecx, %edi + xorl %eax, %edi + movl 28(%esi), %ebp + addl %edi, %edx + movl %eax, %edi + roll $11, %edx + addl %eax, %edx + /* R2 38 */ + xorl %ebx, %edi + xorl %edx, %edi + leal 4139469664(%ecx,%ebp,1),%ecx + addl %edi, %ecx + movl 40(%esi), %ebp + roll $16, %ecx + movl %edx, %edi + /* R2 39 */ + leal 3200236656(%ebx,%ebp,1),%ebx + addl %edx, %ecx + xorl %eax, %edi + xorl %ecx, %edi + movl 52(%esi), %ebp + addl %edi, %ebx + movl %ecx, %edi + roll $23, %ebx + addl %ecx, %ebx + /* R2 40 */ + xorl %edx, %edi + xorl %ebx, %edi + leal 681279174(%eax,%ebp,1),%eax + addl %edi, %eax + movl (%esi), %ebp + roll $4, %eax + movl %ebx, %edi + /* R2 41 */ + leal 3936430074(%edx,%ebp,1),%edx + addl %ebx, %eax + xorl %ecx, %edi + xorl %eax, %edi + movl 12(%esi), %ebp + addl %edi, %edx + movl %eax, %edi + roll $11, %edx + addl %eax, %edx + /* R2 42 */ + xorl %ebx, %edi + xorl %edx, %edi + leal 3572445317(%ecx,%ebp,1),%ecx + addl %edi, %ecx + movl 24(%esi), %ebp + roll $16, %ecx + movl %edx, %edi + /* R2 43 */ + leal 76029189(%ebx,%ebp,1),%ebx + addl %edx, %ecx + xorl %eax, %edi + xorl %ecx, %edi + movl 36(%esi), %ebp + addl %edi, %ebx + movl %ecx, %edi + roll $23, %ebx + addl %ecx, %ebx + /* R2 44 */ + xorl %edx, %edi + xorl %ebx, %edi + leal 3654602809(%eax,%ebp,1),%eax + addl %edi, %eax + movl 48(%esi), %ebp + roll $4, %eax + movl %ebx, %edi + /* R2 45 */ + leal 3873151461(%edx,%ebp,1),%edx + addl %ebx, %eax + xorl %ecx, %edi + xorl %eax, %edi + movl 60(%esi), %ebp + addl %edi, %edx + movl %eax, %edi + roll $11, %edx + addl %eax, %edx + /* R2 46 */ + xorl %ebx, %edi + xorl %edx, %edi + leal 530742520(%ecx,%ebp,1),%ecx + addl %edi, %ecx + movl 8(%esi), %ebp + roll $16, %ecx + movl %edx, %edi + /* R2 47 */ + leal 3299628645(%ebx,%ebp,1),%ebx + addl %edx, %ecx + xorl %eax, %edi + xorl %ecx, %edi + movl (%esi), %ebp + addl %edi, %ebx + movl $-1, %edi + roll $23, %ebx + addl %ecx, %ebx + + /* R3 section */ + /* R3 48 */ + xorl %edx, %edi + orl %ebx, %edi + leal 4096336452(%eax,%ebp,1),%eax + xorl %ecx, %edi + movl 28(%esi), %ebp + addl %edi, %eax + movl $-1, %edi + roll $6, %eax + xorl %ecx, %edi + addl %ebx, %eax + /* R3 49 */ + orl %eax, %edi + leal 1126891415(%edx,%ebp,1),%edx + xorl %ebx, %edi + movl 56(%esi), %ebp + addl %edi, %edx + movl $-1, %edi + roll $10, %edx + xorl %ebx, %edi + addl %eax, %edx + /* R3 50 */ + orl %edx, %edi + leal 2878612391(%ecx,%ebp,1),%ecx + xorl %eax, %edi + movl 20(%esi), %ebp + addl %edi, %ecx + movl $-1, %edi + roll $15, %ecx + xorl %eax, %edi + addl %edx, %ecx + /* R3 51 */ + orl %ecx, %edi + leal 4237533241(%ebx,%ebp,1),%ebx + xorl %edx, %edi + movl 48(%esi), %ebp + addl %edi, %ebx + movl $-1, %edi + roll $21, %ebx + xorl %edx, %edi + addl %ecx, %ebx + /* R3 52 */ + orl %ebx, %edi + leal 1700485571(%eax,%ebp,1),%eax + xorl %ecx, %edi + movl 12(%esi), %ebp + addl %edi, %eax + movl $-1, %edi + roll $6, %eax + xorl %ecx, %edi + addl %ebx, %eax + /* R3 53 */ + orl %eax, %edi + leal 2399980690(%edx,%ebp,1),%edx + xorl %ebx, %edi + movl 40(%esi), %ebp + addl %edi, %edx + movl $-1, %edi + roll $10, %edx + xorl %ebx, %edi + addl %eax, %edx + /* R3 54 */ + orl %edx, %edi + leal 4293915773(%ecx,%ebp,1),%ecx + xorl %eax, %edi + movl 4(%esi), %ebp + addl %edi, %ecx + movl $-1, %edi + roll $15, %ecx + xorl %eax, %edi + addl %edx, %ecx + /* R3 55 */ + orl %ecx, %edi + leal 2240044497(%ebx,%ebp,1),%ebx + xorl %edx, %edi + movl 32(%esi), %ebp + addl %edi, %ebx + movl $-1, %edi + roll $21, %ebx + xorl %edx, %edi + addl %ecx, %ebx + /* R3 56 */ + orl %ebx, %edi + leal 1873313359(%eax,%ebp,1),%eax + xorl %ecx, %edi + movl 60(%esi), %ebp + addl %edi, %eax + movl $-1, %edi + roll $6, %eax + xorl %ecx, %edi + addl %ebx, %eax + /* R3 57 */ + orl %eax, %edi + leal 4264355552(%edx,%ebp,1),%edx + xorl %ebx, %edi + movl 24(%esi), %ebp + addl %edi, %edx + movl $-1, %edi + roll $10, %edx + xorl %ebx, %edi + addl %eax, %edx + /* R3 58 */ + orl %edx, %edi + leal 2734768916(%ecx,%ebp,1),%ecx + xorl %eax, %edi + movl 52(%esi), %ebp + addl %edi, %ecx + movl $-1, %edi + roll $15, %ecx + xorl %eax, %edi + addl %edx, %ecx + /* R3 59 */ + orl %ecx, %edi + leal 1309151649(%ebx,%ebp,1),%ebx + xorl %edx, %edi + movl 16(%esi), %ebp + addl %edi, %ebx + movl $-1, %edi + roll $21, %ebx + xorl %edx, %edi + addl %ecx, %ebx + /* R3 60 */ + orl %ebx, %edi + leal 4149444226(%eax,%ebp,1),%eax + xorl %ecx, %edi + movl 44(%esi), %ebp + addl %edi, %eax + movl $-1, %edi + roll $6, %eax + xorl %ecx, %edi + addl %ebx, %eax + /* R3 61 */ + orl %eax, %edi + leal 3174756917(%edx,%ebp,1),%edx + xorl %ebx, %edi + movl 8(%esi), %ebp + addl %edi, %edx + movl $-1, %edi + roll $10, %edx + xorl %ebx, %edi + addl %eax, %edx + /* R3 62 */ + orl %edx, %edi + leal 718787259(%ecx,%ebp,1),%ecx + xorl %eax, %edi + movl 36(%esi), %ebp + addl %edi, %ecx + movl $-1, %edi + roll $15, %ecx + xorl %eax, %edi + addl %edx, %ecx + /* R3 63 */ + orl %ecx, %edi + leal 3951481745(%ebx,%ebp,1),%ebx + xorl %edx, %edi + movl 24(%esp), %ebp + addl %edi, %ebx + addl $64, %esi + roll $21, %ebx + movl (%ebp), %edi + addl %ecx, %ebx + addl %edi, %eax + movl 4(%ebp), %edi + addl %edi, %ebx + movl 8(%ebp), %edi + addl %edi, %ecx + movl 12(%ebp), %edi + addl %edi, %edx + movl %eax, (%ebp) + movl %ebx, 4(%ebp) + movl (%esp), %edi + movl %ecx, 8(%ebp) + movl %edx, 12(%ebp) + cmpl %esi, %edi + jge .L000start + popl %eax + popl %ebx + popl %ebp + popl %edi + popl %esi + ret +.md5_block_x86_end: + SIZE(md5_block_x86,.md5_block_x86_end-md5_block_x86) +.ident "desasm.pl" diff --git a/src/lib/libcrypto/objects/objects.err b/src/lib/libcrypto/objects/objects.err new file mode 100644 index 0000000000..8bec3eaea2 --- /dev/null +++ b/src/lib/libcrypto/objects/objects.err @@ -0,0 +1,12 @@ +/* Error codes for the OBJ functions. */ + +/* Function codes. */ +#define OBJ_F_OBJ_CREATE 100 +#define OBJ_F_OBJ_DUP 101 +#define OBJ_F_OBJ_NID2LN 102 +#define OBJ_F_OBJ_NID2OBJ 103 +#define OBJ_F_OBJ_NID2SN 104 + +/* Reason codes. */ +#define OBJ_R_MALLOC_FAILURE 100 +#define OBJ_R_UNKNOWN_NID 101 diff --git a/src/lib/libcrypto/pem/ctx_size.c b/src/lib/libcrypto/pem/ctx_size.c new file mode 100644 index 0000000000..87469bc4af --- /dev/null +++ b/src/lib/libcrypto/pem/ctx_size.c @@ -0,0 +1,122 @@ +/* crypto/pem/ctx_size.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" + +int main(argc,argv) +int argc; +char *argv[]; + { + int i,j; + char buf[256]; + + for (;;) + { + char *str; + buf[0]='\0'; + fgets(buf,256,stdin); + if (buf[0] == '\0') break; + + str="#define EVP_ENCODE_CTX_SIZE "; + if (strncmp(buf,str,strlen(str)) == 0) + { + printf("%s %d\n",str,(int)sizeof(EVP_ENCODE_CTX)); + continue; + } + str="#define EVP_MD_SIZE "; + if (strncmp(buf,str,strlen(str)) == 0) + { + printf("%s %d\n",str,(int)sizeof(EVP_MD)); + continue; + } + str="#define EVP_MD_CTX_SIZE "; + if (strncmp(buf,str,strlen(str)) == 0) + { + printf("%s %d\n",str,(int)sizeof(EVP_MD_CTX)); + continue; + } + str="#define EVP_CIPHER_SIZE "; + if (strncmp(buf,str,strlen(str)) == 0) + { + printf("%s %d\n",str,(int)sizeof(EVP_CIPHER)); + continue; + } + str="#define EVP_CIPHER_CTX_SIZE "; + if (strncmp(buf,str,strlen(str)) == 0) + { + printf("%s %d\n",str,(int)sizeof(EVP_CIPHER_CTX)); + continue; + } + + str="#define EVP_MAX_MD_SIZE "; + if (strncmp(buf,str,strlen(str)) == 0) + { + i=MD2_DIGEST_LENGTH; + j=MD5_DIGEST_LENGTH; + if (j > i) i=j; + j=SHA_DIGEST_LENGTH; + if (j > i) i=j; + printf("%s %d\n",str,i); + continue; + } + fputs(buf,stdout); + } + exit(0); + } diff --git a/src/lib/libcrypto/pem/pem.err b/src/lib/libcrypto/pem/pem.err new file mode 100644 index 0000000000..0e523abf82 --- /dev/null +++ b/src/lib/libcrypto/pem/pem.err @@ -0,0 +1,38 @@ +/* Error codes for the PEM functions. */ + +/* Function codes. */ +#define PEM_F_DEF_CALLBACK 100 +#define PEM_F_LOAD_IV 101 +#define PEM_F_PEM_ASN1_READ 102 +#define PEM_F_PEM_ASN1_READ_BIO 103 +#define PEM_F_PEM_ASN1_WRITE 104 +#define PEM_F_PEM_ASN1_WRITE_BIO 105 +#define PEM_F_PEM_DO_HEADER 106 +#define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 +#define PEM_F_PEM_READ 108 +#define PEM_F_PEM_READ_BIO 109 +#define PEM_F_PEM_SEALFINAL 110 +#define PEM_F_PEM_SEALINIT 111 +#define PEM_F_PEM_SIGNFINAL 112 +#define PEM_F_PEM_WRITE 113 +#define PEM_F_PEM_WRITE_BIO 114 +#define PEM_F_PEM_X509_INFO_READ 115 +#define PEM_F_PEM_X509_INFO_READ_BIO 116 +#define PEM_F_PEM_X509_INFO_WRITE_BIO 117 + +/* Reason codes. */ +#define PEM_R_BAD_BASE64_DECODE 100 +#define PEM_R_BAD_DECRYPT 101 +#define PEM_R_BAD_END_LINE 102 +#define PEM_R_BAD_IV_CHARS 103 +#define PEM_R_BAD_PASSWORD_READ 104 +#define PEM_R_NOT_DEK_INFO 105 +#define PEM_R_NOT_ENCRYPTED 106 +#define PEM_R_NOT_PROC_TYPE 107 +#define PEM_R_NO_START_LINE 108 +#define PEM_R_PROBLEMS_GETTING_PASSWORD 109 +#define PEM_R_PUBLIC_KEY_NO_RSA 110 +#define PEM_R_READ_KEY 111 +#define PEM_R_SHORT_HEADER 112 +#define PEM_R_UNSUPPORTED_CIPHER 113 +#define PEM_R_UNSUPPORTED_ENCRYPTION 114 diff --git a/src/lib/libcrypto/pem/pem.org b/src/lib/libcrypto/pem/pem.org new file mode 100644 index 0000000000..38952509dd --- /dev/null +++ b/src/lib/libcrypto/pem/pem.org @@ -0,0 +1,562 @@ +/* crypto/pem/pem.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify pem.org since pem.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +#ifndef HEADER_PEM_H +#define HEADER_PEM_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "evp.h" +#include "x509.h" + +#define PEM_OBJ_UNDEF 0 +#define PEM_OBJ_X509 1 +#define PEM_OBJ_X509_REQ 2 +#define PEM_OBJ_CRL 3 +#define PEM_OBJ_SSL_SESSION 4 +#define PEM_OBJ_PRIV_KEY 10 +#define PEM_OBJ_PRIV_RSA 11 +#define PEM_OBJ_PRIV_DSA 12 +#define PEM_OBJ_PRIV_DH 13 +#define PEM_OBJ_PUB_RSA 14 +#define PEM_OBJ_PUB_DSA 15 +#define PEM_OBJ_PUB_DH 16 +#define PEM_OBJ_DHPARAMS 17 +#define PEM_OBJ_DSAPARAMS 18 +#define PEM_OBJ_PRIV_RSA_PUBLIC 19 + +#define PEM_ERROR 30 +#define PEM_DEK_DES_CBC 40 +#define PEM_DEK_IDEA_CBC 45 +#define PEM_DEK_DES_EDE 50 +#define PEM_DEK_DES_ECB 60 +#define PEM_DEK_RSA 70 +#define PEM_DEK_RSA_MD2 80 +#define PEM_DEK_RSA_MD5 90 + +#define PEM_MD_MD2 NID_md2 +#define PEM_MD_MD5 NID_md5 +#define PEM_MD_SHA NID_sha +#define PEM_MD_MD2_RSA NID_md2WithRSAEncryption +#define PEM_MD_MD5_RSA NID_md5WithRSAEncryption +#define PEM_MD_SHA_RSA NID_sha1WithRSAEncryption + +#define PEM_STRING_X509_OLD "X509 CERTIFICATE" +#define PEM_STRING_X509 "CERTIFICATE" +#define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" +#define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" +#define PEM_STRING_X509_CRL "X509 CRL" +#define PEM_STRING_EVP_PKEY "PRIVATE KEY" +#define PEM_STRING_RSA "RSA PRIVATE KEY" +#define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" +#define PEM_STRING_DSA "DSA PRIVATE KEY" +#define PEM_STRING_PKCS7 "PKCS7" +#define PEM_STRING_DHPARAMS "DH PARAMETERS" +#define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" +#define PEM_STRING_DSAPARAMS "DSA PARAMETERS" + +#ifndef HEADER_ENVELOPE_H + +#define EVP_ENCODE_CTX_SIZE 92 +#define EVP_MD_SIZE 48 +#define EVP_MD_CTX_SIZE 152 +#define EVP_CIPHER_SIZE 28 +#define EVP_CIPHER_CTX_SIZE 4212 +#define EVP_MAX_MD_SIZE 20 + +typedef struct evp_encode_ctx_st + { + char data[EVP_ENCODE_CTX_SIZE]; + } EVP_ENCODE_CTX; + +typedef struct env_md_ctx_st + { + char data[EVP_MD_CTX_SIZE]; + } EVP_MD_CTX; + +typedef struct evp_cipher_st + { + char data[EVP_CIPHER_SIZE]; + } EVP_CIPHER; + +typedef struct evp_cipher_ctx_st + { + char data[EVP_CIPHER_CTX_SIZE]; + } EVP_CIPHER_CTX; +#endif + + +typedef struct PEM_Encode_Seal_st + { + EVP_ENCODE_CTX encode; + EVP_MD_CTX md; + EVP_CIPHER_CTX cipher; + } PEM_ENCODE_SEAL_CTX; + +/* enc_type is one off */ +#define PEM_TYPE_ENCRYPTED 10 +#define PEM_TYPE_MIC_ONLY 20 +#define PEM_TYPE_MIC_CLEAR 30 +#define PEM_TYPE_CLEAR 40 + +typedef struct pem_recip_st + { + char *name; + X509_NAME *dn; + + int cipher; + int key_enc; + char iv[8]; + } PEM_USER; + +typedef struct pem_ctx_st + { + int type; /* what type of object */ + + struct { + int version; + int mode; + } proc_type; + + char *domain; + + struct { + int cipher; + unsigned char iv[8]; + } DEK_info; + + PEM_USER *originator; + + int num_recipient; + PEM_USER **recipient; + +#ifdef HEADER_STACK_H + STACK *x509_chain; /* certificate chain */ +#else + char *x509_chain; /* certificate chain */ +#endif + EVP_MD *md; /* signature type */ + + int md_enc; /* is the md encrypted or not? */ + int md_len; /* length of md_data */ + char *md_data; /* message digest, could be pkey encrypted */ + + EVP_CIPHER *dec; /* date encryption cipher */ + int key_len; /* key length */ + unsigned char *key; /* key */ + unsigned char iv[8]; /* the iv */ + + + int data_enc; /* is the data encrypted */ + int data_len; + unsigned char *data; + } PEM_CTX; + +#ifdef SSLEAY_MACROS + +#define PEM_write_SSL_SESSION(fp,x) \ + PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \ + PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL) +#define PEM_write_X509(fp,x) \ + PEM_ASN1_write((int (*)())i2d_X509,PEM_STRING_X509,fp, \ + (char *)x, NULL,NULL,0,NULL) +#define PEM_write_X509_REQ(fp,x) PEM_ASN1_write( \ + (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,fp,(char *)x, \ + NULL,NULL,0,NULL) +#define PEM_write_X509_CRL(fp,x) \ + PEM_ASN1_write((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL, \ + fp,(char *)x, NULL,NULL,0,NULL) +#define PEM_write_RSAPrivateKey(fp,x,enc,kstr,klen,cb) \ + PEM_ASN1_write((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,fp,\ + (char *)x,enc,kstr,klen,cb) +#define PEM_write_RSAPublicKey(fp,x) \ + PEM_ASN1_write((int (*)())i2d_RSAPublicKey,\ + PEM_STRING_RSA_PUBLIC,fp,(char *)x,NULL,NULL,0,NULL) +#define PEM_write_DSAPrivateKey(fp,x,enc,kstr,klen,cb) \ + PEM_ASN1_write((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,fp,\ + (char *)x,enc,kstr,klen,cb) +#define PEM_write_PrivateKey(bp,x,enc,kstr,klen,cb) \ + PEM_ASN1_write((int (*)())i2d_PrivateKey,\ + (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\ + bp,(char *)x,enc,kstr,klen,cb) +#define PEM_write_PKCS7(fp,x) \ + PEM_ASN1_write((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,fp, \ + (char *)x, NULL,NULL,0,NULL) +#define PEM_write_DHparams(fp,x) \ + PEM_ASN1_write((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,fp,\ + (char *)x,NULL,NULL,0,NULL) + +#define PEM_read_SSL_SESSION(fp,x,cb) (SSL_SESSION *)PEM_ASN1_read( \ + (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb) +#define PEM_read_X509(fp,x,cb) (X509 *)PEM_ASN1_read( \ + (char *(*)())d2i_X509,PEM_STRING_X509,fp,(char **)x,cb) +#define PEM_read_X509_REQ(fp,x,cb) (X509_REQ *)PEM_ASN1_read( \ + (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,fp,(char **)x,cb) +#define PEM_read_X509_CRL(fp,x,cb) (X509_CRL *)PEM_ASN1_read( \ + (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,fp,(char **)x,cb) +#define PEM_read_RSAPrivateKey(fp,x,cb) (RSA *)PEM_ASN1_read( \ + (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,fp,(char **)x,cb) +#define PEM_read_RSAPublicKey(fp,x,cb) (RSA *)PEM_ASN1_read( \ + (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,fp,(char **)x,cb) +#define PEM_read_DSAPrivateKey(fp,x,cb) (DSA *)PEM_ASN1_read( \ + (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,fp,(char **)x,cb) +#define PEM_read_PrivateKey(fp,x,cb) (EVP_PKEY *)PEM_ASN1_read( \ + (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,fp,(char **)x,cb) +#define PEM_read_PKCS7(fp,x,cb) (PKCS7 *)PEM_ASN1_read( \ + (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,fp,(char **)x,cb) +#define PEM_read_DHparams(fp,x,cb) (DH *)PEM_ASN1_read( \ + (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,fp,(char **)x,cb) + +#define PEM_write_bio_SSL_SESSION(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_SSL_SESSION, \ + PEM_STRING_SSL_SESSION,bp, (char *)x, NULL,NULL,0,NULL) +#define PEM_write_bio_X509(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \ + (char *)x, NULL,NULL,0,NULL) +#define PEM_write_bio_X509_REQ(bp,x) PEM_ASN1_write_bio( \ + (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,bp,(char *)x, \ + NULL,NULL,0,NULL) +#define PEM_write_bio_X509_CRL(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL,\ + bp,(char *)x, NULL,NULL,0,NULL) +#define PEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb) \ + PEM_ASN1_write_bio((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,\ + bp,(char *)x,enc,kstr,klen,cb) +#define PEM_write_bio_RSAPublicKey(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_RSAPublicKey, \ + PEM_STRING_RSA_PUBLIC,\ + bp,(char *)x,NULL,NULL,0,NULL) +#define PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb) \ + PEM_ASN1_write_bio((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,\ + bp,(char *)x,enc,kstr,klen,cb) +#define PEM_write_bio_PrivateKey(bp,x,enc,kstr,klen,cb) \ + PEM_ASN1_write_bio((int (*)())i2d_PrivateKey,\ + (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\ + bp,(char *)x,enc,kstr,klen,cb) +#define PEM_write_bio_PKCS7(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,bp, \ + (char *)x, NULL,NULL,0,NULL) +#define PEM_write_bio_DHparams(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,\ + bp,(char *)x,NULL,NULL,0,NULL) +#define PEM_write_bio_DSAparams(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_DSAparams, \ + PEM_STRING_DSAPARAMS,bp,(char *)x,NULL,NULL,0,NULL) + +#define PEM_read_bio_SSL_SESSION(bp,x,cb) (SSL_SESSION *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,(char **)x,cb) +#define PEM_read_bio_X509(bp,x,cb) (X509 *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb) +#define PEM_read_bio_X509_REQ(bp,x,cb) (X509_REQ *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,bp,(char **)x,cb) +#define PEM_read_bio_X509_CRL(bp,x,cb) (X509_CRL *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,bp,(char **)x,cb) +#define PEM_read_bio_RSAPrivateKey(bp,x,cb) (RSA *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,bp,(char **)x,cb) +#define PEM_read_bio_RSAPublicKey(bp,x,cb) (RSA *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,bp,(char **)x,cb) +#define PEM_read_bio_DSAPrivateKey(bp,x,cb) (DSA *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,bp,(char **)x,cb) +#define PEM_read_bio_PrivateKey(bp,x,cb) (EVP_PKEY *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,bp,(char **)x,cb) + +#define PEM_read_bio_PKCS7(bp,x,cb) (PKCS7 *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,bp,(char **)x,cb) +#define PEM_read_bio_DHparams(bp,x,cb) (DH *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,bp,(char **)x,cb) +#define PEM_read_bio_DSAparams(bp,x,cb) (DSA *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_DSAparams,PEM_STRING_DSAPARAMS,bp,(char **)x,cb) + +#endif + +#ifndef NOPROTO +int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); +int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len, + int (*callback)()); + +#ifdef HEADER_BIO_H +int PEM_read_bio(BIO *bp, char **name, char **header, + unsigned char **data,long *len); +int PEM_write_bio(BIO *bp,char *name,char *hdr,unsigned char *data, + long len); +char * PEM_ASN1_read_bio(char *(*d2i)(),char *name,BIO *bp,char **x, + int (*cb)()); +int PEM_ASN1_write_bio(int (*i2d)(),char *name,BIO *bp,char *x, + EVP_CIPHER *enc,unsigned char *kstr,int klen,int (*callback)()); +STACK * PEM_X509_INFO_read_bio(BIO *bp, STACK *sk, int (*cb)()); +int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, + unsigned char *kstr, int klen, int (*cb)()); +#endif + +#ifndef WIN16 +int PEM_read(FILE *fp, char **name, char **header, + unsigned char **data,long *len); +int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len); +char * PEM_ASN1_read(char *(*d2i)(),char *name,FILE *fp,char **x, + int (*cb)()); +int PEM_ASN1_write(int (*i2d)(),char *name,FILE *fp,char *x, + EVP_CIPHER *enc,unsigned char *kstr,int klen,int (*callback)()); +STACK * PEM_X509_INFO_read(FILE *fp, STACK *sk, int (*cb)()); +#endif + +int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, + EVP_MD *md_type, unsigned char **ek, int *ekl, + unsigned char *iv, EVP_PKEY **pubk, int npubk); +void PEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl, + unsigned char *in, int inl); +int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig,int *sigl, + unsigned char *out, int *outl, EVP_PKEY *priv); + +void PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); +void PEM_SignUpdate(EVP_MD_CTX *ctx,unsigned char *d,unsigned int cnt); +int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, + unsigned int *siglen, EVP_PKEY *pkey); + +void ERR_load_PEM_strings(void); + +void PEM_proc_type(char *buf, int type); +void PEM_dek_info(char *buf, char *type, int len, char *str); + +#ifndef SSLEAY_MACROS + +#ifndef WIN16 +X509 *PEM_read_X509(FILE *fp,X509 **x,int (*cb)()); +X509_REQ *PEM_read_X509_REQ(FILE *fp,X509_REQ **x,int (*cb)()); +X509_CRL *PEM_read_X509_CRL(FILE *fp,X509_CRL **x,int (*cb)()); +RSA *PEM_read_RSAPrivateKey(FILE *fp,RSA **x,int (*cb)()); +RSA *PEM_read_RSAPublicKey(FILE *fp,RSA **x,int (*cb)()); +DSA *PEM_read_DSAPrivateKey(FILE *fp,DSA **x,int (*cb)()); +EVP_PKEY *PEM_read_PrivateKey(FILE *fp,EVP_PKEY **x,int (*cb)()); +PKCS7 *PEM_read_PKCS7(FILE *fp,PKCS7 **x,int (*cb)()); +DH *PEM_read_DHparams(FILE *fp,DH **x,int (*cb)()); +DSA *PEM_read_DSAparams(FILE *fp,DSA **x,int (*cb)()); +int PEM_write_X509(FILE *fp,X509 *x); +int PEM_write_X509_REQ(FILE *fp,X509_REQ *x); +int PEM_write_X509_CRL(FILE *fp,X509_CRL *x); +int PEM_write_RSAPrivateKey(FILE *fp,RSA *x,EVP_CIPHER *enc,unsigned char *kstr, + int klen,int (*cb)()); +int PEM_write_RSAPublicKey(FILE *fp,RSA *x); +int PEM_write_DSAPrivateKey(FILE *fp,DSA *x,EVP_CIPHER *enc,unsigned char *kstr, + int klen,int (*cb)()); +int PEM_write_PrivateKey(FILE *fp,EVP_PKEY *x,EVP_CIPHER *enc, + unsigned char *kstr,int klen,int (*cb)()); +int PEM_write_PKCS7(FILE *fp,PKCS7 *x); +int PEM_write_DHparams(FILE *fp,DH *x); +int PEM_write_DSAparams(FILE *fp,DSA *x); +#endif + +#ifdef HEADER_BIO_H +X509 *PEM_read_bio_X509(BIO *bp,X509 **x,int (*cb)()); +X509_REQ *PEM_read_bio_X509_REQ(BIO *bp,X509_REQ **x,int (*cb)()); +X509_CRL *PEM_read_bio_X509_CRL(BIO *bp,X509_CRL **x,int (*cb)()); +RSA *PEM_read_bio_RSAPrivateKey(BIO *bp,RSA **x,int (*cb)()); +RSA *PEM_read_bio_RSAPublicKey(BIO *bp,RSA **x,int (*cb)()); +DSA *PEM_read_bio_DSAPrivateKey(BIO *bp,DSA **x,int (*cb)()); +EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp,EVP_PKEY **x,int (*cb)()); +PKCS7 *PEM_read_bio_PKCS7(BIO *bp,PKCS7 **x,int (*cb)()); +DH *PEM_read_bio_DHparams(BIO *bp,DH **x,int (*cb)()); +DSA *PEM_read_bio_DSAparams(BIO *bp,DSA **x,int (*cb)()); +int PEM_write_bio_X509(BIO *bp,X509 *x); +int PEM_write_bio_X509_REQ(BIO *bp,X509_REQ *x); +int PEM_write_bio_X509_CRL(BIO *bp,X509_CRL *x); +int PEM_write_bio_RSAPrivateKey(BIO *fp,RSA *x,EVP_CIPHER *enc, + unsigned char *kstr,int klen,int (*cb)()); +int PEM_write_bio_RSAPublicKey(BIO *fp,RSA *x); +int PEM_write_bio_DSAPrivateKey(BIO *fp,DSA *x,EVP_CIPHER *enc, + unsigned char *kstr,int klen,int (*cb)()); +int PEM_write_bio_PrivateKey(BIO *fp,EVP_PKEY *x,EVP_CIPHER *enc, + unsigned char *kstr,int klen,int (*cb)()); +int PEM_write_bio_PKCS7(BIO *bp,PKCS7 *x); +int PEM_write_bio_DHparams(BIO *bp,DH *x); +int PEM_write_bio_DSAparams(BIO *bp,DSA *x); +#endif + +#endif /* SSLEAY_MACROS */ + + +#else + +int PEM_get_EVP_CIPHER_INFO(); +int PEM_do_header(); +int PEM_read_bio(); +int PEM_write_bio(); +#ifndef WIN16 +int PEM_read(); +int PEM_write(); +STACK * PEM_X509_INFO_read(); +char * PEM_ASN1_read(); +int PEM_ASN1_write(); +#endif +STACK * PEM_X509_INFO_read_bio(); +int PEM_X509_INFO_write_bio(); +char * PEM_ASN1_read_bio(); +int PEM_ASN1_write_bio(); +int PEM_SealInit(); +void PEM_SealUpdate(); +int PEM_SealFinal(); +int PEM_SignFinal(); + +void ERR_load_PEM_strings(); + +void PEM_proc_type(); +void PEM_dek_info(); + +#ifndef SSLEAY_MACROS +#ifndef WIN16 +X509 *PEM_read_X509(); +X509_REQ *PEM_read_X509_REQ(); +X509_CRL *PEM_read_X509_CRL(); +RSA *PEM_read_RSAPrivateKey(); +RSA *PEM_read_RSAPublicKey(); +DSA *PEM_read_DSAPrivateKey(); +EVP_PKEY *PEM_read_PrivateKey(); +PKCS7 *PEM_read_PKCS7(); +DH *PEM_read_DHparams(); +DSA *PEM_read_DSAparams(); +int PEM_write_X509(); +int PEM_write_X509_REQ(); +int PEM_write_X509_CRL(); +int PEM_write_RSAPrivateKey(); +int PEM_write_RSAPublicKey(); +int PEM_write_DSAPrivateKey(); +int PEM_write_PrivateKey(); +int PEM_write_PKCS7(); +int PEM_write_DHparams(); +int PEM_write_DSAparams(); +#endif + +X509 *PEM_read_bio_X509(); +X509_REQ *PEM_read_bio_X509_REQ(); +X509_CRL *PEM_read_bio_X509_CRL(); +RSA *PEM_read_bio_RSAPrivateKey(); +RSA *PEM_read_bio_RSAPublicKey(); +DSA *PEM_read_bio_DSAPrivateKey(); +EVP_PKEY *PEM_read_bio_PrivateKey(); +PKCS7 *PEM_read_bio_PKCS7(); +DH *PEM_read_bio_DHparams(); +DSA *PEM_read_bio_DSAparams(); +int PEM_write_bio_X509(); +int PEM_write_bio_X509_REQ(); +int PEM_write_bio_X509_CRL(); +int PEM_write_bio_RSAPrivateKey(); +int PEM_write_bio_RSAPublicKey(); +int PEM_write_bio_DSAPrivateKey(); +int PEM_write_bio_PrivateKey(); +int PEM_write_bio_PKCS7(); +int PEM_write_bio_DHparams(); +int PEM_write_bio_DSAparams(); + +#endif /* SSLEAY_MACROS */ + +#endif + +/* BEGIN ERROR CODES */ +/* Error codes for the PEM functions. */ + +/* Function codes. */ +#define PEM_F_DEF_CALLBACK 100 +#define PEM_F_LOAD_IV 101 +#define PEM_F_PEM_ASN1_READ 102 +#define PEM_F_PEM_ASN1_READ_BIO 103 +#define PEM_F_PEM_ASN1_WRITE 104 +#define PEM_F_PEM_ASN1_WRITE_BIO 105 +#define PEM_F_PEM_DO_HEADER 106 +#define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 +#define PEM_F_PEM_READ 108 +#define PEM_F_PEM_READ_BIO 109 +#define PEM_F_PEM_SEALFINAL 110 +#define PEM_F_PEM_SEALINIT 111 +#define PEM_F_PEM_SIGNFINAL 112 +#define PEM_F_PEM_WRITE 113 +#define PEM_F_PEM_WRITE_BIO 114 +#define PEM_F_PEM_X509_INFO_READ 115 +#define PEM_F_PEM_X509_INFO_READ_BIO 116 +#define PEM_F_PEM_X509_INFO_WRITE_BIO 117 + +/* Reason codes. */ +#define PEM_R_BAD_BASE64_DECODE 100 +#define PEM_R_BAD_DECRYPT 101 +#define PEM_R_BAD_END_LINE 102 +#define PEM_R_BAD_IV_CHARS 103 +#define PEM_R_BAD_PASSWORD_READ 104 +#define PEM_R_NOT_DEK_INFO 105 +#define PEM_R_NOT_ENCRYPTED 106 +#define PEM_R_NOT_PROC_TYPE 107 +#define PEM_R_NO_START_LINE 108 +#define PEM_R_PROBLEMS_GETTING_PASSWORD 109 +#define PEM_R_PUBLIC_KEY_NO_RSA 110 +#define PEM_R_READ_KEY 111 +#define PEM_R_SHORT_HEADER 112 +#define PEM_R_UNSUPPORTED_CIPHER 113 +#define PEM_R_UNSUPPORTED_ENCRYPTION 114 + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/src/lib/libcrypto/pkcs7/README b/src/lib/libcrypto/pkcs7/README new file mode 100644 index 0000000000..27001c6970 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/README @@ -0,0 +1,5 @@ +WARNING + +Everything in this directory is experimental and is subject to change. + +Do not rely on the stuff in here not changing in the next release diff --git a/src/lib/libcrypto/pkcs7/mf.p7 b/src/lib/libcrypto/pkcs7/mf.p7 new file mode 100644 index 0000000000..524335b4b3 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/mf.p7 @@ -0,0 +1,18 @@ +-----BEGIN PKCS7----- +MIAGCSqGSIb3DQEHAqCAMIIC2QIBATEMMAoGCCqGSIb3DQIFMIAGCSqGSIb3DQEH +AQAAoIIB7TCCAekwggFSAgEAMA0GCSqGSIb3DQEBBAUAMFsxCzAJBgNVBAYTAkFV +MRMwEQYDVQQIEwpRdWVlbnNsYW5kMRowGAYDVQQKExFDcnlwdFNvZnQgUHR5IEx0 +ZDEbMBkGA1UEAxMSVGVzdCBDQSAoMTAyNCBiaXQpMB4XDTk3MDYwOTEzNTc0NloX +DTk4MDYwOTEzNTc0NlowYzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xh +bmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMSMwIQYDVQQDExpTZXJ2ZXIg +dGVzdCBjZXJ0ICg1MTIgYml0KTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCfs8OE +J5X/EjFSDxXvRhHErYDmNlsP3YDXYY3g/HJFCTT+VWZFQ0xol2r+qKCl3194/+7X +ZLg/BMtv/yr+/rntAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAeEzEdgr2nChPcALL +vY8gl/GIlpoAjPmKD+pLeGZI9s+SEX5u1q8nCrJ6ZzkfrRnqgI5Anmev9+qPZfdU +bz5zdVSf4sUL9nX9ChXjK9NCJA3UzQHSFqhZErGUwGNkAHYHp2+zAdY6Ho6rmMzt +g0CDu/sKR4qzm6REsQGS8kgpjz4xgcUwgcICAQEwYDBbMQswCQYDVQQGEwJBVTET +MBEGA1UECBMKUXVlZW5zbGFuZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQx +GzAZBgNVBAMTElRlc3QgQ0EgKDEwMjQgYml0KQIBADAKBggqhkiG9w0CBTANBgkq +hkiG9w0BAQQFAARALnrxJiOX9XZf2D+3vL8SKMQmMq55LltomwOLGUru/q1uVXzi +ARg7FSCegOpA1nunsTURMUGgrPXKK4XmL4IseQAAAAA= +-----END PKCS7----- diff --git a/src/lib/libcrypto/pkcs7/p7.tst b/src/lib/libcrypto/pkcs7/p7.tst new file mode 100644 index 0000000000..6d14dce163 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/p7.tst @@ -0,0 +1,33 @@ +-----BEGIN PKCS7----- +MIAGCSqGSIb3DQEHAqCAMIIFsQIBATELMAkGBSsOAwIaBQAwgAYJKoZIhvcNAQcB +AACgggQdMIICJTCCAc+gAwIBAgIBIjANBgkqhkiG9w0BAQQFADCBgjELMAkGA1UE +BhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5lMRow +GAYDVQQKExFDcnlwdFNvZnQgUHR5IEx0ZDEUMBIGA1UECxMLZGV2ZWxvcG1lbnQx +GTAXBgNVBAMTEENyeXB0U29mdCBEZXYgQ0EwHhcNOTcwNjEzMTgxMDE3WhcNOTgw +NjEzMTgxMDE3WjCBiDELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQx +ETAPBgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdFNvZnQgUHR5IEx0ZDEU +MBIGA1UECxMLSUlTIHRlc3RpbmcxDjAMBgNVBAMTBXRlc3QxMQ8wDQYJKoZIhvcN +AQkBFgAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAxtWiv59VH42+rotrmFAyDxTc +J2osFt5uy/zEllx3vvjtwewqQxGUOwf6cjqFOTrnpEdVvwywpEhIQ5364bJqIwID +AQABoygwJjAkBglghkgBhvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0G +CSqGSIb3DQEBBAUAA0EAMnYkNV2AdpeHPy/qlcdZx6MDGIJgrLhklhcn6Or6KiAP +t9+nv9XdOGHyMyQr9ufsweuQfAgJ9yjKPZR2/adTjTCCAfAwggGaAgEAMA0GCSqG +SIb3DQEBBAUAMIGCMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDER +MA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRQw +EgYDVQQLEwtkZXZlbG9wbWVudDEZMBcGA1UEAxMQQ3J5cHRTb2Z0IERldiBDQTAe +Fw05NzAzMjIxMzM0MDRaFw05ODAzMjIxMzM0MDRaMIGCMQswCQYDVQQGEwJBVTET +MBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoT +EUNyeXB0U29mdCBQdHkgTHRkMRQwEgYDVQQLEwtkZXZlbG9wbWVudDEZMBcGA1UE +AxMQQ3J5cHRTb2Z0IERldiBDQTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDgDgKq +IBuUMAJi4c8juAqEZ8f8FcuDWT+HcScvNztRJy9K8DnbGpiSrzzix4El6N4A7vbl +crwn/0CZmQJguZpfAgMBAAEwDQYJKoZIhvcNAQEEBQADQQA0UUvxlXXe6wKkVukn +ZoCyXbjlNsqt2rwbvfZEam6fQP3S7uq+o1Pnj+KDgE33WxWbQAA9h8fY1LWN7X3a +yTm/MYIBbTCCAWkCAQEwgYgwgYIxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVl +bnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0 +eSBMdGQxFDASBgNVBAsTC2RldmVsb3BtZW50MRkwFwYDVQQDExBDcnlwdFNvZnQg +RGV2IENBAgEiMAkGBSsOAwIaBQCgfTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcB +MCMGCSqGSIb3DQEJBDEWBBSUVhbGkNE+KGqpOK13+FkfOkaoizAcBgkqhkiG9w0B +CQUxDxcNOTcwNzAxMDE0MzM0WjAeBgkqhkiG9w0BCQ8xETAPMA0GCCqGSIb3DQMC +AgEoMA0GCSqGSIb3DQEBAQUABECa9Jpo4w/fZOc3Vy78wZFAVF8kvpn7il99Ldsr +AQ4JiBmcfiSwEBBY6WuKT+/SYtFwZl1oXkTwB5AVCFIC/IFNAAAAAA== +-----END PKCS7----- diff --git a/src/lib/libcrypto/pkcs7/pkcs7.err b/src/lib/libcrypto/pkcs7/pkcs7.err new file mode 100644 index 0000000000..91413aae43 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/pkcs7.err @@ -0,0 +1,26 @@ +/* Error codes for the PKCS7 functions. */ + +/* Function codes. */ +#define PKCS7_F_PKCS7_ADD_CERTIFICATE 100 +#define PKCS7_F_PKCS7_ADD_CRL 101 +#define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102 +#define PKCS7_F_PKCS7_ADD_SIGNER 103 +#define PKCS7_F_PKCS7_CTRL 104 +#define PKCS7_F_PKCS7_DATAINIT 105 +#define PKCS7_F_PKCS7_DATASIGN 106 +#define PKCS7_F_PKCS7_DATAVERIFY 107 +#define PKCS7_F_PKCS7_SET_CIPHER 108 +#define PKCS7_F_PKCS7_SET_CONTENT 109 +#define PKCS7_F_PKCS7_SET_TYPE 110 + +/* Reason codes. */ +#define PKCS7_R_INTERNAL_ERROR 100 +#define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 101 +#define PKCS7_R_SIGNATURE_FAILURE 102 +#define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 103 +#define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 104 +#define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 105 +#define PKCS7_R_UNKNOWN_DIGEST_TYPE 106 +#define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 107 +#define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 108 +#define PKCS7_R_WRONG_CONTENT_TYPE 109 diff --git a/src/lib/libcrypto/ranlib.sh b/src/lib/libcrypto/ranlib.sh new file mode 100644 index 0000000000..543f712c6b --- /dev/null +++ b/src/lib/libcrypto/ranlib.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +cwd=`pwd` +cd /tmp + +if [ -s /bin/ranlib ] ; then + RL=/bin/ranlib +else if [ -s /usr/bin/ranlib ] ; then + RL=/usr/bin/ranlib +fi +fi + +if [ "x$RL" != "x" ] +then + case "$1" in + /*) + $RL "$1" + ;; + *) + $RL "$cwd/$1" + ;; + esac +fi diff --git a/src/lib/libcrypto/rc2/Makefile.uni b/src/lib/libcrypto/rc2/Makefile.uni new file mode 100644 index 0000000000..e50b3f2d19 --- /dev/null +++ b/src/lib/libcrypto/rc2/Makefile.uni @@ -0,0 +1,72 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options + +DIR= rc2 +TOP= . +CC= gcc +CFLAG= -O3 -fomit-frame-pointer + +CPP= $(CC) -E +INCLUDES= +INSTALLTOP=/usr/local/lib +MAKE= make +MAKEDEPEND= makedepend +MAKEFILE= Makefile.uni +AR= ar r + +IDEA_ENC=rc2_cbc.o + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile +TEST=rc2test +APPS=rc2speed + +LIB=librc2.a +LIBSRC=rc2_skey.c rc2_ecb.c rc2_cbc.c rc2cfb64.c rc2ofb64.c +LIBOBJ=rc2_skey.o rc2_ecb.o $(IDEA_ENC) rc2cfb64.o rc2ofb64.o + +SRC= $(LIBSRC) + +EXHEADER= rc2.h +HEADER= rc2_locl.h $(EXHEADER) + +ALL= $(GENERAL) $(SRC) $(HEADER) + +all: $(LIB) $(TEST) $(APPS) + +$(LIB): $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) + sh $(TOP)/ranlib.sh $(LIB) + +test: $(TEST) + ./$(TEST) + +$(TEST): $(TEST).c $(LIB) + $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) + +$(APPS): $(APPS).c $(LIB) + $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + +dclean: + perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff + +cc: + $(MAKE) CC="cc" CFLAG="-O" all + +gcc: + $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/rc2/rc2.org b/src/lib/libcrypto/rc2/rc2.org new file mode 100644 index 0000000000..37354cfa62 --- /dev/null +++ b/src/lib/libcrypto/rc2/rc2.org @@ -0,0 +1,118 @@ +/* crypto/rc2/rc2.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify rc2.org since rc2.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +#ifndef HEADER_RC2_H +#define HEADER_RC2_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define RC2_ENCRYPT 1 +#define RC2_DECRYPT 0 + +/* I need to put in a mod for the alpha - eay */ +#define RC2_INT unsigned short + +#define RC2_BLOCK 8 +#define RC2_KEY_LENGTH 16 + +typedef struct rc2_key_st + { + RC2_INT data[64]; + } RC2_KEY; + +#ifndef NOPROTO + +void RC2_set_key(RC2_KEY *key, int len, unsigned char *data,int bits); +void RC2_ecb_encrypt(unsigned char *in,unsigned char *out,RC2_KEY *key, + int enc); +void RC2_encrypt(unsigned long *data,RC2_KEY *key); +void RC2_decrypt(unsigned long *data,RC2_KEY *key); +void RC2_cbc_encrypt(unsigned char *in, unsigned char *out, long length, + RC2_KEY *ks, unsigned char *iv, int enc); +void RC2_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, + RC2_KEY *schedule, unsigned char *ivec, int *num, int enc); +void RC2_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, + RC2_KEY *schedule, unsigned char *ivec, int *num); + +#else + +void RC2_set_key(); +void RC2_ecb_encrypt(); +void RC2_encrypt(); +void RC2_decrypt(); +void RC2_cbc_encrypt(); +void RC2_cfb64_encrypt(); +void RC2_ofb64_encrypt(); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/lib/libcrypto/rc4/Makefile.uni b/src/lib/libcrypto/rc4/Makefile.uni new file mode 100644 index 0000000000..79dc17b8d1 --- /dev/null +++ b/src/lib/libcrypto/rc4/Makefile.uni @@ -0,0 +1,102 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +DIR= rc4 +TOP= . +CC= gcc +CFLAG= -O3 -fomit-frame-pointer + +CPP= $(CC) -E +INCLUDES= +INSTALLTOP=/usr/local/lib +MAKE= make +MAKEDEPEND= makedepend +MAKEFILE= Makefile.uni +AR= ar r + +RC4_ENC=rc4_enc.o +# or use +#RC4_ENC=asm/rx86-elf.o +#RC4_ENC=asm/rx86-out.o +#RC4_ENC=asm/rx86-sol.o +#RC4_ENC=asm/rx86bdsi.o + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile +TEST=rc4test +APPS=rc4speed + +LIB=librc4.a +LIBSRC=rc4_skey.c rc4_enc.c +LIBOBJ=rc4_skey.o $(RC4_ENC) + +SRC= $(LIBSRC) + +EXHEADER= rc4.h +HEADER= $(EXHEADER) rc4_locl.h + +ALL= $(GENERAL) $(SRC) $(HEADER) + +all: $(LIB) $(TEST) $(APPS) + +$(LIB): $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) + sh $(TOP)/ranlib.sh $(LIB) + +# elf +asm/rx86-elf.o: asm/rx86unix.cpp + $(CPP) -DELF asm/rx86unix.cpp | as -o asm/rx86-elf.o + +# solaris +asm/rx86-sol.o: asm/rx86unix.cpp + $(CC) -E -DSOL asm/rx86unix.cpp | sed 's/^#.*//' > asm/rx86-sol.s + as -o asm/rx86-sol.o asm/rx86-sol.s + rm -f asm/rx86-sol.s + +# a.out +asm/rx86-out.o: asm/rx86unix.cpp + $(CPP) -DOUT asm/rx86unix.cpp | as -o asm/rx86-out.o + +# bsdi +asm/rx86bsdi.o: asm/rx86unix.cpp + $(CPP) -DBSDI asm/rx86unix.cpp | as -o asm/rx86bsdi.o + +asm/rx86unix.cpp: + (cd asm; perl rc4-586.pl cpp >rx86unix.cpp) + +test: $(TEST) + ./$(TEST) + +$(TEST): $(TEST).c $(LIB) + $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) + +$(APPS): $(APPS).c $(LIB) + $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + +dclean: + perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff + +cc: + $(MAKE) CC="cc" CFLAG="-O" all + +gcc: + $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/rc4/asm/r4-win32.asm b/src/lib/libcrypto/rc4/asm/r4-win32.asm new file mode 100644 index 0000000000..70b0f7484c --- /dev/null +++ b/src/lib/libcrypto/rc4/asm/r4-win32.asm @@ -0,0 +1,314 @@ + ; Don't even think of reading this code + ; It was automatically generated by rc4-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE rc4-586.asm + .386 +.model FLAT +_TEXT SEGMENT +PUBLIC _RC4 + +_RC4 PROC NEAR + ; + push ebp + push ebx + mov ebp, DWORD PTR 12[esp] + mov ebx, DWORD PTR 16[esp] + push esi + push edi + mov ecx, DWORD PTR [ebp] + mov edx, DWORD PTR 4[ebp] + mov esi, DWORD PTR 28[esp] + inc ecx + sub esp, 12 + add ebp, 8 + and ecx, 255 + lea ebx, DWORD PTR [esi+ebx-8] + mov edi, DWORD PTR 44[esp] + mov DWORD PTR 8[esp],ebx + mov eax, DWORD PTR [ecx*4+ebp] + cmp ebx, esi + jl $L000end +L001start: + add esi, 8 + ; Round 0 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR [esp], bl + ; Round 1 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 1[esp],bl + ; Round 2 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 2[esp],bl + ; Round 3 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 3[esp],bl + ; Round 4 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 4[esp],bl + ; Round 5 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 5[esp],bl + ; Round 6 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 6[esp],bl + ; Round 7 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + add edi, 8 + mov BYTE PTR 7[esp],bl + ; apply the cipher text + mov eax, DWORD PTR [esp] + mov ebx, DWORD PTR [esi-8] + xor eax, ebx + mov ebx, DWORD PTR [esi-4] + mov DWORD PTR [edi-8],eax + mov eax, DWORD PTR 4[esp] + xor eax, ebx + mov ebx, DWORD PTR 8[esp] + mov DWORD PTR [edi-4],eax + mov eax, DWORD PTR [ecx*4+ebp] + cmp esi, ebx + jle L001start +$L000end: + ; Round 0 + add ebx, 8 + inc esi + cmp ebx, esi + jl $L002finished + mov DWORD PTR 8[esp],ebx + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR [edi], bl + ; Round 1 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 1[edi],bl + ; Round 2 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 2[edi],bl + ; Round 3 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 3[edi],bl + ; Round 4 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 4[edi],bl + ; Round 5 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 5[edi],bl + ; Round 6 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 6[edi],bl +$L002finished: + dec ecx + add esp, 12 + mov DWORD PTR [ebp-4],edx + mov BYTE PTR [ebp-8],cl + pop edi + pop esi + pop ebx + pop ebp + ret +_RC4 ENDP +_TEXT ENDS +END diff --git a/src/lib/libcrypto/rc4/asm/rx86unix.cpp b/src/lib/libcrypto/rc4/asm/rx86unix.cpp new file mode 100644 index 0000000000..ec1d72a110 --- /dev/null +++ b/src/lib/libcrypto/rc4/asm/rx86unix.cpp @@ -0,0 +1,358 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define RC4 _RC4 + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by rc4-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "rc4-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl RC4 + TYPE(RC4,@function) +RC4: + + pushl %ebp + pushl %ebx + movl 12(%esp), %ebp + movl 16(%esp), %ebx + pushl %esi + pushl %edi + movl (%ebp), %ecx + movl 4(%ebp), %edx + movl 28(%esp), %esi + incl %ecx + subl $12, %esp + addl $8, %ebp + andl $255, %ecx + leal -8(%ebx,%esi,), %ebx + movl 44(%esp), %edi + movl %ebx, 8(%esp) + movl (%ebp,%ecx,4), %eax + cmpl %esi, %ebx + jl .L000end +.L001start: + addl $8, %esi + /* Round 0 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, (%esp) + /* Round 1 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 1(%esp) + /* Round 2 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 2(%esp) + /* Round 3 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 3(%esp) + /* Round 4 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 4(%esp) + /* Round 5 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 5(%esp) + /* Round 6 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 6(%esp) + /* Round 7 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + addl $8, %edi + movb %bl, 7(%esp) + /* apply the cipher text */ + movl (%esp), %eax + movl -8(%esi), %ebx + xorl %ebx, %eax + movl -4(%esi), %ebx + movl %eax, -8(%edi) + movl 4(%esp), %eax + xorl %ebx, %eax + movl 8(%esp), %ebx + movl %eax, -4(%edi) + movl (%ebp,%ecx,4), %eax + cmpl %ebx, %esi + jle .L001start +.L000end: + /* Round 0 */ + addl $8, %ebx + incl %esi + cmpl %esi, %ebx + jl .L002finished + movl %ebx, 8(%esp) + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, (%edi) + /* Round 1 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 1(%edi) + /* Round 2 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 2(%edi) + /* Round 3 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 3(%edi) + /* Round 4 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 4(%edi) + /* Round 5 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 5(%edi) + /* Round 6 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 6(%edi) +.L002finished: + decl %ecx + addl $12, %esp + movl %edx, -4(%ebp) + movb %cl, -8(%ebp) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.RC4_end: + SIZE(RC4,.RC4_end-RC4) +.ident "RC4" diff --git a/src/lib/libcrypto/rc4/rc4.org b/src/lib/libcrypto/rc4/rc4.org new file mode 100644 index 0000000000..c558651af8 --- /dev/null +++ b/src/lib/libcrypto/rc4/rc4.org @@ -0,0 +1,103 @@ +/* crypto/rc4/rc4.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify rc4.org since rc4.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +#ifndef HEADER_RC4_H +#define HEADER_RC4_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* using int types make the structure larger but make the code faster + * on most boxes I have tested - up to %20 faster. */ +#define RC4_INT unsigned int + +typedef struct rc4_key_st + { + RC4_INT x,y; + RC4_INT data[256]; + } RC4_KEY; + +#ifndef NOPROTO + +char *RC4_options(void); +void RC4_set_key(RC4_KEY *key, int len, unsigned char *data); +void RC4(RC4_KEY *key, unsigned long len, unsigned char *indata, + unsigned char *outdata); + +#else + +char *RC4_options(); +void RC4_set_key(); +void RC4(); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/lib/libcrypto/rc4/rc4_locl.org b/src/lib/libcrypto/rc4/rc4_locl.org new file mode 100644 index 0000000000..1ef4455fb7 --- /dev/null +++ b/src/lib/libcrypto/rc4/rc4_locl.org @@ -0,0 +1,70 @@ +/* crypto/rc4/rc4_locl.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify bf_locl.org since bf_locl.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +/* if this is defined data[i] is used instead of *data, this is a %20 + * speedup on x86 */ +#undef RC4_INDEX + diff --git a/src/lib/libcrypto/rc5/Makefile.uni b/src/lib/libcrypto/rc5/Makefile.uni new file mode 100644 index 0000000000..e50b3f2d19 --- /dev/null +++ b/src/lib/libcrypto/rc5/Makefile.uni @@ -0,0 +1,72 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options + +DIR= rc2 +TOP= . +CC= gcc +CFLAG= -O3 -fomit-frame-pointer + +CPP= $(CC) -E +INCLUDES= +INSTALLTOP=/usr/local/lib +MAKE= make +MAKEDEPEND= makedepend +MAKEFILE= Makefile.uni +AR= ar r + +IDEA_ENC=rc2_cbc.o + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile +TEST=rc2test +APPS=rc2speed + +LIB=librc2.a +LIBSRC=rc2_skey.c rc2_ecb.c rc2_cbc.c rc2cfb64.c rc2ofb64.c +LIBOBJ=rc2_skey.o rc2_ecb.o $(IDEA_ENC) rc2cfb64.o rc2ofb64.o + +SRC= $(LIBSRC) + +EXHEADER= rc2.h +HEADER= rc2_locl.h $(EXHEADER) + +ALL= $(GENERAL) $(SRC) $(HEADER) + +all: $(LIB) $(TEST) $(APPS) + +$(LIB): $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) + sh $(TOP)/ranlib.sh $(LIB) + +test: $(TEST) + ./$(TEST) + +$(TEST): $(TEST).c $(LIB) + $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) + +$(APPS): $(APPS).c $(LIB) + $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + +dclean: + perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff + +cc: + $(MAKE) CC="cc" CFLAG="-O" all + +gcc: + $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/rc5/asm/r5-win32.asm b/src/lib/libcrypto/rc5/asm/r5-win32.asm new file mode 100644 index 0000000000..f43d3711f0 --- /dev/null +++ b/src/lib/libcrypto/rc5/asm/r5-win32.asm @@ -0,0 +1,574 @@ + ; Don't even think of reading this code + ; It was automatically generated by rc5-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE rc5-586.asm + .386 +.model FLAT +_TEXT SEGMENT +PUBLIC _RC5_32_encrypt + +_RC5_32_encrypt PROC NEAR + ; + push ebp + push esi + push edi + mov edx, DWORD PTR 16[esp] + mov ebp, DWORD PTR 20[esp] + ; Load the 2 words + mov edi, DWORD PTR [edx] + mov esi, DWORD PTR 4[edx] + push ebx + mov ebx, DWORD PTR [ebp] + add edi, DWORD PTR 4[ebp] + add esi, DWORD PTR 8[ebp] + xor edi, esi + mov eax, DWORD PTR 12[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 16[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 20[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 24[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 28[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 32[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 36[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 40[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 44[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 48[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 52[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 56[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 60[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 64[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 68[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 72[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + cmp ebx, 8 + je $L000rc5_exit + xor edi, esi + mov eax, DWORD PTR 76[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 80[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 84[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 88[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 92[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 96[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 100[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 104[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + cmp ebx, 12 + je $L000rc5_exit + xor edi, esi + mov eax, DWORD PTR 108[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 112[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 116[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 120[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 124[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 128[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 132[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 136[ebp] + mov ecx, edi + rol esi, cl + add esi, eax +$L000rc5_exit: + mov DWORD PTR [edx],edi + mov DWORD PTR 4[edx],esi + pop ebx + pop edi + pop esi + pop ebp + ret +_RC5_32_encrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _RC5_32_decrypt + +_RC5_32_decrypt PROC NEAR + ; + push ebp + push esi + push edi + mov edx, DWORD PTR 16[esp] + mov ebp, DWORD PTR 20[esp] + ; Load the 2 words + mov edi, DWORD PTR [edx] + mov esi, DWORD PTR 4[edx] + push ebx + mov ebx, DWORD PTR [ebp] + cmp ebx, 12 + je $L001rc5_dec_12 + cmp ebx, 8 + je $L002rc5_dec_8 + mov eax, DWORD PTR 136[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 132[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 128[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 124[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 120[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 116[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 112[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 108[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi +$L001rc5_dec_12: + mov eax, DWORD PTR 104[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 100[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 96[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 92[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 88[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 84[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 80[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 76[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi +$L002rc5_dec_8: + mov eax, DWORD PTR 72[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 68[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 64[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 60[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 56[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 52[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 48[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 44[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 40[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 36[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 32[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 28[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 24[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 20[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 16[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 12[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + sub esi, DWORD PTR 8[ebp] + sub edi, DWORD PTR 4[ebp] +L003rc5_exit: + mov DWORD PTR [edx],edi + mov DWORD PTR 4[edx],esi + pop ebx + pop edi + pop esi + pop ebp + ret +_RC5_32_decrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _RC5_32_cbc_encrypt + +_RC5_32_cbc_encrypt PROC NEAR + ; + push ebp + push ebx + push esi + push edi + mov ebp, DWORD PTR 28[esp] + ; getting iv ptr from parameter 4 + mov ebx, DWORD PTR 36[esp] + mov esi, DWORD PTR [ebx] + mov edi, DWORD PTR 4[ebx] + push edi + push esi + push edi + push esi + mov ebx, esp + mov esi, DWORD PTR 36[esp] + mov edi, DWORD PTR 40[esp] + ; getting encrypt flag from parameter 5 + mov ecx, DWORD PTR 56[esp] + ; get and push parameter 3 + mov eax, DWORD PTR 48[esp] + push eax + push ebx + cmp ecx, 0 + jz $L004decrypt + and ebp, 4294967288 + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + jz $L005encrypt_finish +L006encrypt_loop: + mov ecx, DWORD PTR [esi] + mov edx, DWORD PTR 4[esi] + xor eax, ecx + xor ebx, edx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _RC5_32_encrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L006encrypt_loop +$L005encrypt_finish: + mov ebp, DWORD PTR 52[esp] + and ebp, 7 + jz $L007finish + xor ecx, ecx + xor edx, edx + mov ebp, DWORD PTR $L008cbc_enc_jmp_table[ebp*4] + jmp ebp +L009ej7: + mov dh, BYTE PTR 6[esi] + shl edx, 8 +L010ej6: + mov dh, BYTE PTR 5[esi] +L011ej5: + mov dl, BYTE PTR 4[esi] +L012ej4: + mov ecx, DWORD PTR [esi] + jmp $L013ejend +L014ej3: + mov ch, BYTE PTR 2[esi] + shl ecx, 8 +L015ej2: + mov ch, BYTE PTR 1[esi] +L016ej1: + mov cl, BYTE PTR [esi] +$L013ejend: + xor eax, ecx + xor ebx, edx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _RC5_32_encrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + jmp $L007finish +$L004decrypt: + and ebp, 4294967288 + mov eax, DWORD PTR 16[esp] + mov ebx, DWORD PTR 20[esp] + jz $L017decrypt_finish +L018decrypt_loop: + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _RC5_32_decrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + mov ecx, DWORD PTR 16[esp] + mov edx, DWORD PTR 20[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR [edi],ecx + mov DWORD PTR 4[edi],edx + mov DWORD PTR 16[esp],eax + mov DWORD PTR 20[esp],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L018decrypt_loop +$L017decrypt_finish: + mov ebp, DWORD PTR 52[esp] + and ebp, 7 + jz $L007finish + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _RC5_32_decrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + mov ecx, DWORD PTR 16[esp] + mov edx, DWORD PTR 20[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] +L019dj7: + ror edx, 16 + mov BYTE PTR 6[edi],dl + shr edx, 16 +L020dj6: + mov BYTE PTR 5[edi],dh +L021dj5: + mov BYTE PTR 4[edi],dl +L022dj4: + mov DWORD PTR [edi],ecx + jmp $L023djend +L024dj3: + ror ecx, 16 + mov BYTE PTR 2[edi],cl + shl ecx, 16 +L025dj2: + mov BYTE PTR 1[esi],ch +L026dj1: + mov BYTE PTR [esi], cl +$L023djend: + jmp $L007finish +$L007finish: + mov ecx, DWORD PTR 60[esp] + add esp, 24 + mov DWORD PTR [ecx],eax + mov DWORD PTR 4[ecx],ebx + pop edi + pop esi + pop ebx + pop ebp + ret +$L008cbc_enc_jmp_table: + DD 0 + DD L016ej1 + DD L015ej2 + DD L014ej3 + DD L012ej4 + DD L011ej5 + DD L010ej6 + DD L009ej7 +L027cbc_dec_jmp_table: + DD 0 + DD L026dj1 + DD L025dj2 + DD L024dj3 + DD L022dj4 + DD L021dj5 + DD L020dj6 + DD L019dj7 +_RC5_32_cbc_encrypt ENDP +_TEXT ENDS +END diff --git a/src/lib/libcrypto/rc5/asm/r586unix.cpp b/src/lib/libcrypto/rc5/asm/r586unix.cpp new file mode 100644 index 0000000000..a25dd5a9a4 --- /dev/null +++ b/src/lib/libcrypto/rc5/asm/r586unix.cpp @@ -0,0 +1,628 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define RC5_32_encrypt _RC5_32_encrypt +#define RC5_32_decrypt _RC5_32_decrypt +#define RC5_32_cbc_encrypt _RC5_32_cbc_encrypt + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by rc5-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "rc5-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl RC5_32_encrypt + TYPE(RC5_32_encrypt,@function) +RC5_32_encrypt: + + pushl %ebp + pushl %esi + pushl %edi + movl 16(%esp), %edx + movl 20(%esp), %ebp + /* Load the 2 words */ + movl (%edx), %edi + movl 4(%edx), %esi + pushl %ebx + movl (%ebp), %ebx + addl 4(%ebp), %edi + addl 8(%ebp), %esi + xorl %esi, %edi + movl 12(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 16(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 20(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 24(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 28(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 32(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 36(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 40(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 44(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 48(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 52(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 56(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 60(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 64(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 68(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 72(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + cmpl $8, %ebx + je .L000rc5_exit + xorl %esi, %edi + movl 76(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 80(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 84(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 88(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 92(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 96(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 100(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 104(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + cmpl $12, %ebx + je .L000rc5_exit + xorl %esi, %edi + movl 108(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 112(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 116(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 120(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 124(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 128(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 132(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 136(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi +.L000rc5_exit: + movl %edi, (%edx) + movl %esi, 4(%edx) + popl %ebx + popl %edi + popl %esi + popl %ebp + ret +.RC5_32_encrypt_end: + SIZE(RC5_32_encrypt,.RC5_32_encrypt_end-RC5_32_encrypt) +.ident "desasm.pl" +.text + .align ALIGN +.globl RC5_32_decrypt + TYPE(RC5_32_decrypt,@function) +RC5_32_decrypt: + + pushl %ebp + pushl %esi + pushl %edi + movl 16(%esp), %edx + movl 20(%esp), %ebp + /* Load the 2 words */ + movl (%edx), %edi + movl 4(%edx), %esi + pushl %ebx + movl (%ebp), %ebx + cmpl $12, %ebx + je .L001rc5_dec_12 + cmpl $8, %ebx + je .L002rc5_dec_8 + movl 136(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 132(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 128(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 124(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 120(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 116(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 112(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 108(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi +.L001rc5_dec_12: + movl 104(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 100(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 96(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 92(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 88(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 84(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 80(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 76(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi +.L002rc5_dec_8: + movl 72(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 68(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 64(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 60(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 56(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 52(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 48(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 44(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 40(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 36(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 32(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 28(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 24(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 20(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 16(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 12(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + subl 8(%ebp), %esi + subl 4(%ebp), %edi +.L003rc5_exit: + movl %edi, (%edx) + movl %esi, 4(%edx) + popl %ebx + popl %edi + popl %esi + popl %ebp + ret +.RC5_32_decrypt_end: + SIZE(RC5_32_decrypt,.RC5_32_decrypt_end-RC5_32_decrypt) +.ident "desasm.pl" +.text + .align ALIGN +.globl RC5_32_cbc_encrypt + TYPE(RC5_32_cbc_encrypt,@function) +RC5_32_cbc_encrypt: + + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + movl 28(%esp), %ebp + /* getting iv ptr from parameter 4 */ + movl 36(%esp), %ebx + movl (%ebx), %esi + movl 4(%ebx), %edi + pushl %edi + pushl %esi + pushl %edi + pushl %esi + movl %esp, %ebx + movl 36(%esp), %esi + movl 40(%esp), %edi + /* getting encrypt flag from parameter 5 */ + movl 56(%esp), %ecx + /* get and push parameter 3 */ + movl 48(%esp), %eax + pushl %eax + pushl %ebx + cmpl $0, %ecx + jz .L004decrypt + andl $4294967288, %ebp + movl 8(%esp), %eax + movl 12(%esp), %ebx + jz .L005encrypt_finish +.L006encrypt_loop: + movl (%esi), %ecx + movl 4(%esi), %edx + xorl %ecx, %eax + xorl %edx, %ebx + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call RC5_32_encrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx + movl %eax, (%edi) + movl %ebx, 4(%edi) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L006encrypt_loop +.L005encrypt_finish: + movl 52(%esp), %ebp + andl $7, %ebp + jz .L007finish + xorl %ecx, %ecx + xorl %edx, %edx + movl .L008cbc_enc_jmp_table(,%ebp,4),%ebp + jmp *%ebp +.L009ej7: + movb 6(%esi), %dh + sall $8, %edx +.L010ej6: + movb 5(%esi), %dh +.L011ej5: + movb 4(%esi), %dl +.L012ej4: + movl (%esi), %ecx + jmp .L013ejend +.L014ej3: + movb 2(%esi), %ch + sall $8, %ecx +.L015ej2: + movb 1(%esi), %ch +.L016ej1: + movb (%esi), %cl +.L013ejend: + xorl %ecx, %eax + xorl %edx, %ebx + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call RC5_32_encrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx + movl %eax, (%edi) + movl %ebx, 4(%edi) + jmp .L007finish +.align ALIGN +.L004decrypt: + andl $4294967288, %ebp + movl 16(%esp), %eax + movl 20(%esp), %ebx + jz .L017decrypt_finish +.L018decrypt_loop: + movl (%esi), %eax + movl 4(%esi), %ebx + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call RC5_32_decrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx + movl 16(%esp), %ecx + movl 20(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx + movl %ecx, (%edi) + movl %edx, 4(%edi) + movl %eax, 16(%esp) + movl %ebx, 20(%esp) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L018decrypt_loop +.L017decrypt_finish: + movl 52(%esp), %ebp + andl $7, %ebp + jz .L007finish + movl (%esi), %eax + movl 4(%esi), %ebx + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call RC5_32_decrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx + movl 16(%esp), %ecx + movl 20(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx +.L019dj7: + rorl $16, %edx + movb %dl, 6(%edi) + shrl $16, %edx +.L020dj6: + movb %dh, 5(%edi) +.L021dj5: + movb %dl, 4(%edi) +.L022dj4: + movl %ecx, (%edi) + jmp .L023djend +.L024dj3: + rorl $16, %ecx + movb %cl, 2(%edi) + sall $16, %ecx +.L025dj2: + movb %ch, 1(%esi) +.L026dj1: + movb %cl, (%esi) +.L023djend: + jmp .L007finish +.align ALIGN +.L007finish: + movl 60(%esp), %ecx + addl $24, %esp + movl %eax, (%ecx) + movl %ebx, 4(%ecx) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.align ALIGN +.L008cbc_enc_jmp_table: + .long 0 + .long .L016ej1 + .long .L015ej2 + .long .L014ej3 + .long .L012ej4 + .long .L011ej5 + .long .L010ej6 + .long .L009ej7 +.align ALIGN +.L027cbc_dec_jmp_table: + .long 0 + .long .L026dj1 + .long .L025dj2 + .long .L024dj3 + .long .L022dj4 + .long .L021dj5 + .long .L020dj6 + .long .L019dj7 +.RC5_32_cbc_encrypt_end: + SIZE(RC5_32_cbc_encrypt,.RC5_32_cbc_encrypt_end-RC5_32_cbc_encrypt) +.ident "desasm.pl" diff --git a/src/lib/libcrypto/ripemd/Makefile.uni b/src/lib/libcrypto/ripemd/Makefile.uni new file mode 100644 index 0000000000..54685712db --- /dev/null +++ b/src/lib/libcrypto/ripemd/Makefile.uni @@ -0,0 +1,109 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +DIR= md5 +TOP= . +CC= gcc +CFLAG= -O3 -fomit-frame-pointer + +CPP= $(CC) -E +INCLUDES= +INSTALLTOP=/usr/local/lib +MAKE= make +MAKEDEPEND= makedepend +MAKEFILE= Makefile.uni +AR= ar r + +MD5_ASM_OBJ= + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile +TEST=md5test +APPS=md5 + +LIB=libmd5.a +LIBSRC=md5_dgst.c md5_one.c +LIBOBJ=md5_dgst.o md5_one.o $(MD5_ASM_OBJ) + +SRC= $(LIBSRC) + +EXHEADER= md5.h +HEADER= md5_locl.h $(EXHEADER) + +ALL= $(GENERAL) $(SRC) $(HEADER) + +all: $(LIB) $(TEST) $(APPS) + +$(LIB): $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) + sh $(TOP)/ranlib.sh $(LIB) + +# elf +asm/mx86-elf.o: asm/mx86unix.cpp + $(CPP) -DELF asm/mx86unix.cpp | as -o asm/mx86-elf.o + +# solaris +asm/mx86-sol.o: asm/mx86unix.cpp + $(CC) -E -DSOL asm/mx86unix.cpp | sed 's/^#.*//' > asm/mx86-sol.s + as -o asm/mx86-sol.o asm/mx86-sol.s + rm -f asm/mx86-sol.s + +# a.out +asm/mx86-out.o: asm/mx86unix.cpp + $(CPP) -DOUT asm/mx86unix.cpp | as -o asm/mx86-out.o + +# bsdi +asm/mx86bsdi.o: asm/mx86unix.cpp + $(CPP) -DBSDI asm/mx86unix.cpp | as -o asm/mx86bsdi.o + +asm/mx86unix.cpp: + (cd asm; perl md5-586.pl cpp >mx86unix.cpp) + +test: $(TEST) + ./$(TEST) + +$(TEST): $(TEST).c $(LIB) + $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) + +$(APPS): $(APPS).c $(LIB) + $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + +dclean: + perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff + +cc: + $(MAKE) MD5_ASM_OBJ="" CC="cc" CFLAG="-O" all + +gcc: + $(MAKE) MD5_ASM_OBJ="" CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all + +x86-elf: + $(MAKE) MD5_ASM_OBJ="asm/mx86-elf.o" CFLAG="-DELF -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-out: + $(MAKE) MD5_ASM_OBJ="asm/mx86-out.o" CFLAG="-DOUT -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-solaris: + $(MAKE) MD5_ASM_OBJ="asm/mx86-sol.o" CFLAG="-DSOL -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-bdsi: + $(MAKE) MD5_ASM_OBJ="asm/mx86-bdsi.o" CFLAG="-DBDSI -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/ripemd/asm/rm-win32.asm b/src/lib/libcrypto/ripemd/asm/rm-win32.asm new file mode 100644 index 0000000000..bd38791c13 --- /dev/null +++ b/src/lib/libcrypto/ripemd/asm/rm-win32.asm @@ -0,0 +1,1972 @@ + ; Don't even think of reading this code + ; It was automatically generated by rmd-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE rmd-586.asm + .386 +.model FLAT +_TEXT SEGMENT +PUBLIC _ripemd160_block_x86 + +_ripemd160_block_x86 PROC NEAR + push esi + mov ecx, DWORD PTR 16[esp] + push edi + mov esi, DWORD PTR 16[esp] + push ebp + add ecx, esi + push ebx + sub ecx, 64 + sub esp, 88 + mov DWORD PTR [esp],ecx + mov edi, DWORD PTR 108[esp] +L000start: + ; + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR 4[esp],eax + mov DWORD PTR 8[esp],ebx + mov eax, DWORD PTR 8[esi] + mov ebx, DWORD PTR 12[esi] + mov DWORD PTR 12[esp],eax + mov DWORD PTR 16[esp],ebx + mov eax, DWORD PTR 16[esi] + mov ebx, DWORD PTR 20[esi] + mov DWORD PTR 20[esp],eax + mov DWORD PTR 24[esp],ebx + mov eax, DWORD PTR 24[esi] + mov ebx, DWORD PTR 28[esi] + mov DWORD PTR 28[esp],eax + mov DWORD PTR 32[esp],ebx + mov eax, DWORD PTR 32[esi] + mov ebx, DWORD PTR 36[esi] + mov DWORD PTR 36[esp],eax + mov DWORD PTR 40[esp],ebx + mov eax, DWORD PTR 40[esi] + mov ebx, DWORD PTR 44[esi] + mov DWORD PTR 44[esp],eax + mov DWORD PTR 48[esp],ebx + mov eax, DWORD PTR 48[esi] + mov ebx, DWORD PTR 52[esi] + mov DWORD PTR 52[esp],eax + mov DWORD PTR 56[esp],ebx + mov eax, DWORD PTR 56[esi] + mov ebx, DWORD PTR 60[esi] + mov DWORD PTR 60[esp],eax + mov DWORD PTR 64[esp],ebx + add esi, 64 + mov eax, DWORD PTR [edi] + mov DWORD PTR 112[esp],esi + mov ebx, DWORD PTR 4[edi] + mov ecx, DWORD PTR 8[edi] + mov edx, DWORD PTR 12[edi] + mov ebp, DWORD PTR 16[edi] + ; 0 + mov esi, ecx + xor esi, edx + mov edi, DWORD PTR 4[esp] + xor esi, ebx + add eax, edi + rol ecx, 10 + add eax, esi + mov esi, ebx + rol eax, 11 + add eax, ebp + ; 1 + xor esi, ecx + mov edi, DWORD PTR 8[esp] + xor esi, eax + add ebp, esi + mov esi, eax + rol ebx, 10 + add ebp, edi + xor esi, ebx + rol ebp, 14 + add ebp, edx + ; 2 + mov edi, DWORD PTR 12[esp] + xor esi, ebp + add edx, edi + rol eax, 10 + add edx, esi + mov esi, ebp + rol edx, 15 + add edx, ecx + ; 3 + xor esi, eax + mov edi, DWORD PTR 16[esp] + xor esi, edx + add ecx, esi + mov esi, edx + rol ebp, 10 + add ecx, edi + xor esi, ebp + rol ecx, 12 + add ecx, ebx + ; 4 + mov edi, DWORD PTR 20[esp] + xor esi, ecx + add ebx, edi + rol edx, 10 + add ebx, esi + mov esi, ecx + rol ebx, 5 + add ebx, eax + ; 5 + xor esi, edx + mov edi, DWORD PTR 24[esp] + xor esi, ebx + add eax, esi + mov esi, ebx + rol ecx, 10 + add eax, edi + xor esi, ecx + rol eax, 8 + add eax, ebp + ; 6 + mov edi, DWORD PTR 28[esp] + xor esi, eax + add ebp, edi + rol ebx, 10 + add ebp, esi + mov esi, eax + rol ebp, 7 + add ebp, edx + ; 7 + xor esi, ebx + mov edi, DWORD PTR 32[esp] + xor esi, ebp + add edx, esi + mov esi, ebp + rol eax, 10 + add edx, edi + xor esi, eax + rol edx, 9 + add edx, ecx + ; 8 + mov edi, DWORD PTR 36[esp] + xor esi, edx + add ecx, edi + rol ebp, 10 + add ecx, esi + mov esi, edx + rol ecx, 11 + add ecx, ebx + ; 9 + xor esi, ebp + mov edi, DWORD PTR 40[esp] + xor esi, ecx + add ebx, esi + mov esi, ecx + rol edx, 10 + add ebx, edi + xor esi, edx + rol ebx, 13 + add ebx, eax + ; 10 + mov edi, DWORD PTR 44[esp] + xor esi, ebx + add eax, edi + rol ecx, 10 + add eax, esi + mov esi, ebx + rol eax, 14 + add eax, ebp + ; 11 + xor esi, ecx + mov edi, DWORD PTR 48[esp] + xor esi, eax + add ebp, esi + mov esi, eax + rol ebx, 10 + add ebp, edi + xor esi, ebx + rol ebp, 15 + add ebp, edx + ; 12 + mov edi, DWORD PTR 52[esp] + xor esi, ebp + add edx, edi + rol eax, 10 + add edx, esi + mov esi, ebp + rol edx, 6 + add edx, ecx + ; 13 + xor esi, eax + mov edi, DWORD PTR 56[esp] + xor esi, edx + add ecx, esi + mov esi, edx + rol ebp, 10 + add ecx, edi + xor esi, ebp + rol ecx, 7 + add ecx, ebx + ; 14 + mov edi, DWORD PTR 60[esp] + xor esi, ecx + add ebx, edi + rol edx, 10 + add ebx, esi + mov esi, ecx + rol ebx, 9 + add ebx, eax + ; 15 + xor esi, edx + mov edi, DWORD PTR 64[esp] + xor esi, ebx + add eax, esi + mov esi, -1 + rol ecx, 10 + add eax, edi + mov edi, DWORD PTR 32[esp] + rol eax, 8 + add eax, ebp + ; 16 + add ebp, edi + mov edi, ebx + sub esi, eax + and edi, eax + and esi, ecx + or edi, esi + mov esi, DWORD PTR 20[esp] + rol ebx, 10 + lea ebp, DWORD PTR 1518500249[edi*1+ebp] + mov edi, -1 + rol ebp, 7 + add ebp, edx + ; 17 + add edx, esi + mov esi, eax + sub edi, ebp + and esi, ebp + and edi, ebx + or esi, edi + mov edi, DWORD PTR 56[esp] + rol eax, 10 + lea edx, DWORD PTR 1518500249[esi*1+edx] + mov esi, -1 + rol edx, 6 + add edx, ecx + ; 18 + add ecx, edi + mov edi, ebp + sub esi, edx + and edi, edx + and esi, eax + or edi, esi + mov esi, DWORD PTR 8[esp] + rol ebp, 10 + lea ecx, DWORD PTR 1518500249[edi*1+ecx] + mov edi, -1 + rol ecx, 8 + add ecx, ebx + ; 19 + add ebx, esi + mov esi, edx + sub edi, ecx + and esi, ecx + and edi, ebp + or esi, edi + mov edi, DWORD PTR 44[esp] + rol edx, 10 + lea ebx, DWORD PTR 1518500249[esi*1+ebx] + mov esi, -1 + rol ebx, 13 + add ebx, eax + ; 20 + add eax, edi + mov edi, ecx + sub esi, ebx + and edi, ebx + and esi, edx + or edi, esi + mov esi, DWORD PTR 28[esp] + rol ecx, 10 + lea eax, DWORD PTR 1518500249[edi*1+eax] + mov edi, -1 + rol eax, 11 + add eax, ebp + ; 21 + add ebp, esi + mov esi, ebx + sub edi, eax + and esi, eax + and edi, ecx + or esi, edi + mov edi, DWORD PTR 64[esp] + rol ebx, 10 + lea ebp, DWORD PTR 1518500249[esi*1+ebp] + mov esi, -1 + rol ebp, 9 + add ebp, edx + ; 22 + add edx, edi + mov edi, eax + sub esi, ebp + and edi, ebp + and esi, ebx + or edi, esi + mov esi, DWORD PTR 16[esp] + rol eax, 10 + lea edx, DWORD PTR 1518500249[edi*1+edx] + mov edi, -1 + rol edx, 7 + add edx, ecx + ; 23 + add ecx, esi + mov esi, ebp + sub edi, edx + and esi, edx + and edi, eax + or esi, edi + mov edi, DWORD PTR 52[esp] + rol ebp, 10 + lea ecx, DWORD PTR 1518500249[esi*1+ecx] + mov esi, -1 + rol ecx, 15 + add ecx, ebx + ; 24 + add ebx, edi + mov edi, edx + sub esi, ecx + and edi, ecx + and esi, ebp + or edi, esi + mov esi, DWORD PTR 4[esp] + rol edx, 10 + lea ebx, DWORD PTR 1518500249[edi*1+ebx] + mov edi, -1 + rol ebx, 7 + add ebx, eax + ; 25 + add eax, esi + mov esi, ecx + sub edi, ebx + and esi, ebx + and edi, edx + or esi, edi + mov edi, DWORD PTR 40[esp] + rol ecx, 10 + lea eax, DWORD PTR 1518500249[esi*1+eax] + mov esi, -1 + rol eax, 12 + add eax, ebp + ; 26 + add ebp, edi + mov edi, ebx + sub esi, eax + and edi, eax + and esi, ecx + or edi, esi + mov esi, DWORD PTR 24[esp] + rol ebx, 10 + lea ebp, DWORD PTR 1518500249[edi*1+ebp] + mov edi, -1 + rol ebp, 15 + add ebp, edx + ; 27 + add edx, esi + mov esi, eax + sub edi, ebp + and esi, ebp + and edi, ebx + or esi, edi + mov edi, DWORD PTR 12[esp] + rol eax, 10 + lea edx, DWORD PTR 1518500249[esi*1+edx] + mov esi, -1 + rol edx, 9 + add edx, ecx + ; 28 + add ecx, edi + mov edi, ebp + sub esi, edx + and edi, edx + and esi, eax + or edi, esi + mov esi, DWORD PTR 60[esp] + rol ebp, 10 + lea ecx, DWORD PTR 1518500249[edi*1+ecx] + mov edi, -1 + rol ecx, 11 + add ecx, ebx + ; 29 + add ebx, esi + mov esi, edx + sub edi, ecx + and esi, ecx + and edi, ebp + or esi, edi + mov edi, DWORD PTR 48[esp] + rol edx, 10 + lea ebx, DWORD PTR 1518500249[esi*1+ebx] + mov esi, -1 + rol ebx, 7 + add ebx, eax + ; 30 + add eax, edi + mov edi, ecx + sub esi, ebx + and edi, ebx + and esi, edx + or edi, esi + mov esi, DWORD PTR 36[esp] + rol ecx, 10 + lea eax, DWORD PTR 1518500249[edi*1+eax] + mov edi, -1 + rol eax, 13 + add eax, ebp + ; 31 + add ebp, esi + mov esi, ebx + sub edi, eax + and esi, eax + and edi, ecx + or esi, edi + mov edi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1518500249[esi*1+ebp] + sub edi, eax + rol ebp, 12 + add ebp, edx + ; 32 + mov esi, DWORD PTR 16[esp] + or edi, ebp + add edx, esi + xor edi, ebx + mov esi, -1 + rol eax, 10 + lea edx, DWORD PTR 1859775393[edi*1+edx] + sub esi, ebp + rol edx, 11 + add edx, ecx + ; 33 + mov edi, DWORD PTR 44[esp] + or esi, edx + add ecx, edi + xor esi, eax + mov edi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1859775393[esi*1+ecx] + sub edi, edx + rol ecx, 13 + add ecx, ebx + ; 34 + mov esi, DWORD PTR 60[esp] + or edi, ecx + add ebx, esi + xor edi, ebp + mov esi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1859775393[edi*1+ebx] + sub esi, ecx + rol ebx, 6 + add ebx, eax + ; 35 + mov edi, DWORD PTR 20[esp] + or esi, ebx + add eax, edi + xor esi, edx + mov edi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1859775393[esi*1+eax] + sub edi, ebx + rol eax, 7 + add eax, ebp + ; 36 + mov esi, DWORD PTR 40[esp] + or edi, eax + add ebp, esi + xor edi, ecx + mov esi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1859775393[edi*1+ebp] + sub esi, eax + rol ebp, 14 + add ebp, edx + ; 37 + mov edi, DWORD PTR 64[esp] + or esi, ebp + add edx, edi + xor esi, ebx + mov edi, -1 + rol eax, 10 + lea edx, DWORD PTR 1859775393[esi*1+edx] + sub edi, ebp + rol edx, 9 + add edx, ecx + ; 38 + mov esi, DWORD PTR 36[esp] + or edi, edx + add ecx, esi + xor edi, eax + mov esi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1859775393[edi*1+ecx] + sub esi, edx + rol ecx, 13 + add ecx, ebx + ; 39 + mov edi, DWORD PTR 8[esp] + or esi, ecx + add ebx, edi + xor esi, ebp + mov edi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1859775393[esi*1+ebx] + sub edi, ecx + rol ebx, 15 + add ebx, eax + ; 40 + mov esi, DWORD PTR 12[esp] + or edi, ebx + add eax, esi + xor edi, edx + mov esi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1859775393[edi*1+eax] + sub esi, ebx + rol eax, 14 + add eax, ebp + ; 41 + mov edi, DWORD PTR 32[esp] + or esi, eax + add ebp, edi + xor esi, ecx + mov edi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1859775393[esi*1+ebp] + sub edi, eax + rol ebp, 8 + add ebp, edx + ; 42 + mov esi, DWORD PTR 4[esp] + or edi, ebp + add edx, esi + xor edi, ebx + mov esi, -1 + rol eax, 10 + lea edx, DWORD PTR 1859775393[edi*1+edx] + sub esi, ebp + rol edx, 13 + add edx, ecx + ; 43 + mov edi, DWORD PTR 28[esp] + or esi, edx + add ecx, edi + xor esi, eax + mov edi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1859775393[esi*1+ecx] + sub edi, edx + rol ecx, 6 + add ecx, ebx + ; 44 + mov esi, DWORD PTR 56[esp] + or edi, ecx + add ebx, esi + xor edi, ebp + mov esi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1859775393[edi*1+ebx] + sub esi, ecx + rol ebx, 5 + add ebx, eax + ; 45 + mov edi, DWORD PTR 48[esp] + or esi, ebx + add eax, edi + xor esi, edx + mov edi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1859775393[esi*1+eax] + sub edi, ebx + rol eax, 12 + add eax, ebp + ; 46 + mov esi, DWORD PTR 24[esp] + or edi, eax + add ebp, esi + xor edi, ecx + mov esi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1859775393[edi*1+ebp] + sub esi, eax + rol ebp, 7 + add ebp, edx + ; 47 + mov edi, DWORD PTR 52[esp] + or esi, ebp + add edx, edi + xor esi, ebx + mov edi, -1 + rol eax, 10 + lea edx, DWORD PTR 1859775393[esi*1+edx] + mov esi, eax + rol edx, 5 + add edx, ecx + ; 48 + sub edi, eax + and esi, edx + and edi, ebp + or edi, esi + mov esi, DWORD PTR 8[esp] + rol ebp, 10 + lea ecx, DWORD PTR 2400959708[edi+ecx] + mov edi, -1 + add ecx, esi + mov esi, ebp + rol ecx, 11 + add ecx, ebx + ; 49 + sub edi, ebp + and esi, ecx + and edi, edx + or edi, esi + mov esi, DWORD PTR 40[esp] + rol edx, 10 + lea ebx, DWORD PTR 2400959708[edi+ebx] + mov edi, -1 + add ebx, esi + mov esi, edx + rol ebx, 12 + add ebx, eax + ; 50 + sub edi, edx + and esi, ebx + and edi, ecx + or edi, esi + mov esi, DWORD PTR 48[esp] + rol ecx, 10 + lea eax, DWORD PTR 2400959708[edi+eax] + mov edi, -1 + add eax, esi + mov esi, ecx + rol eax, 14 + add eax, ebp + ; 51 + sub edi, ecx + and esi, eax + and edi, ebx + or edi, esi + mov esi, DWORD PTR 44[esp] + rol ebx, 10 + lea ebp, DWORD PTR 2400959708[edi+ebp] + mov edi, -1 + add ebp, esi + mov esi, ebx + rol ebp, 15 + add ebp, edx + ; 52 + sub edi, ebx + and esi, ebp + and edi, eax + or edi, esi + mov esi, DWORD PTR 4[esp] + rol eax, 10 + lea edx, DWORD PTR 2400959708[edi+edx] + mov edi, -1 + add edx, esi + mov esi, eax + rol edx, 14 + add edx, ecx + ; 53 + sub edi, eax + and esi, edx + and edi, ebp + or edi, esi + mov esi, DWORD PTR 36[esp] + rol ebp, 10 + lea ecx, DWORD PTR 2400959708[edi+ecx] + mov edi, -1 + add ecx, esi + mov esi, ebp + rol ecx, 15 + add ecx, ebx + ; 54 + sub edi, ebp + and esi, ecx + and edi, edx + or edi, esi + mov esi, DWORD PTR 52[esp] + rol edx, 10 + lea ebx, DWORD PTR 2400959708[edi+ebx] + mov edi, -1 + add ebx, esi + mov esi, edx + rol ebx, 9 + add ebx, eax + ; 55 + sub edi, edx + and esi, ebx + and edi, ecx + or edi, esi + mov esi, DWORD PTR 20[esp] + rol ecx, 10 + lea eax, DWORD PTR 2400959708[edi+eax] + mov edi, -1 + add eax, esi + mov esi, ecx + rol eax, 8 + add eax, ebp + ; 56 + sub edi, ecx + and esi, eax + and edi, ebx + or edi, esi + mov esi, DWORD PTR 56[esp] + rol ebx, 10 + lea ebp, DWORD PTR 2400959708[edi+ebp] + mov edi, -1 + add ebp, esi + mov esi, ebx + rol ebp, 9 + add ebp, edx + ; 57 + sub edi, ebx + and esi, ebp + and edi, eax + or edi, esi + mov esi, DWORD PTR 16[esp] + rol eax, 10 + lea edx, DWORD PTR 2400959708[edi+edx] + mov edi, -1 + add edx, esi + mov esi, eax + rol edx, 14 + add edx, ecx + ; 58 + sub edi, eax + and esi, edx + and edi, ebp + or edi, esi + mov esi, DWORD PTR 32[esp] + rol ebp, 10 + lea ecx, DWORD PTR 2400959708[edi+ecx] + mov edi, -1 + add ecx, esi + mov esi, ebp + rol ecx, 5 + add ecx, ebx + ; 59 + sub edi, ebp + and esi, ecx + and edi, edx + or edi, esi + mov esi, DWORD PTR 64[esp] + rol edx, 10 + lea ebx, DWORD PTR 2400959708[edi+ebx] + mov edi, -1 + add ebx, esi + mov esi, edx + rol ebx, 6 + add ebx, eax + ; 60 + sub edi, edx + and esi, ebx + and edi, ecx + or edi, esi + mov esi, DWORD PTR 60[esp] + rol ecx, 10 + lea eax, DWORD PTR 2400959708[edi+eax] + mov edi, -1 + add eax, esi + mov esi, ecx + rol eax, 8 + add eax, ebp + ; 61 + sub edi, ecx + and esi, eax + and edi, ebx + or edi, esi + mov esi, DWORD PTR 24[esp] + rol ebx, 10 + lea ebp, DWORD PTR 2400959708[edi+ebp] + mov edi, -1 + add ebp, esi + mov esi, ebx + rol ebp, 6 + add ebp, edx + ; 62 + sub edi, ebx + and esi, ebp + and edi, eax + or edi, esi + mov esi, DWORD PTR 28[esp] + rol eax, 10 + lea edx, DWORD PTR 2400959708[edi+edx] + mov edi, -1 + add edx, esi + mov esi, eax + rol edx, 5 + add edx, ecx + ; 63 + sub edi, eax + and esi, edx + and edi, ebp + or edi, esi + mov esi, DWORD PTR 12[esp] + rol ebp, 10 + lea ecx, DWORD PTR 2400959708[edi+ecx] + mov edi, -1 + add ecx, esi + sub edi, ebp + rol ecx, 12 + add ecx, ebx + ; 64 + mov esi, DWORD PTR 20[esp] + or edi, edx + add ebx, esi + xor edi, ecx + mov esi, -1 + rol edx, 10 + lea ebx, DWORD PTR 2840853838[edi*1+ebx] + sub esi, edx + rol ebx, 9 + add ebx, eax + ; 65 + mov edi, DWORD PTR 4[esp] + or esi, ecx + add eax, edi + xor esi, ebx + mov edi, -1 + rol ecx, 10 + lea eax, DWORD PTR 2840853838[esi*1+eax] + sub edi, ecx + rol eax, 15 + add eax, ebp + ; 66 + mov esi, DWORD PTR 24[esp] + or edi, ebx + add ebp, esi + xor edi, eax + mov esi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 2840853838[edi*1+ebp] + sub esi, ebx + rol ebp, 5 + add ebp, edx + ; 67 + mov edi, DWORD PTR 40[esp] + or esi, eax + add edx, edi + xor esi, ebp + mov edi, -1 + rol eax, 10 + lea edx, DWORD PTR 2840853838[esi*1+edx] + sub edi, eax + rol edx, 11 + add edx, ecx + ; 68 + mov esi, DWORD PTR 32[esp] + or edi, ebp + add ecx, esi + xor edi, edx + mov esi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 2840853838[edi*1+ecx] + sub esi, ebp + rol ecx, 6 + add ecx, ebx + ; 69 + mov edi, DWORD PTR 52[esp] + or esi, edx + add ebx, edi + xor esi, ecx + mov edi, -1 + rol edx, 10 + lea ebx, DWORD PTR 2840853838[esi*1+ebx] + sub edi, edx + rol ebx, 8 + add ebx, eax + ; 70 + mov esi, DWORD PTR 12[esp] + or edi, ecx + add eax, esi + xor edi, ebx + mov esi, -1 + rol ecx, 10 + lea eax, DWORD PTR 2840853838[edi*1+eax] + sub esi, ecx + rol eax, 13 + add eax, ebp + ; 71 + mov edi, DWORD PTR 44[esp] + or esi, ebx + add ebp, edi + xor esi, eax + mov edi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 2840853838[esi*1+ebp] + sub edi, ebx + rol ebp, 12 + add ebp, edx + ; 72 + mov esi, DWORD PTR 60[esp] + or edi, eax + add edx, esi + xor edi, ebp + mov esi, -1 + rol eax, 10 + lea edx, DWORD PTR 2840853838[edi*1+edx] + sub esi, eax + rol edx, 5 + add edx, ecx + ; 73 + mov edi, DWORD PTR 8[esp] + or esi, ebp + add ecx, edi + xor esi, edx + mov edi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 2840853838[esi*1+ecx] + sub edi, ebp + rol ecx, 12 + add ecx, ebx + ; 74 + mov esi, DWORD PTR 16[esp] + or edi, edx + add ebx, esi + xor edi, ecx + mov esi, -1 + rol edx, 10 + lea ebx, DWORD PTR 2840853838[edi*1+ebx] + sub esi, edx + rol ebx, 13 + add ebx, eax + ; 75 + mov edi, DWORD PTR 36[esp] + or esi, ecx + add eax, edi + xor esi, ebx + mov edi, -1 + rol ecx, 10 + lea eax, DWORD PTR 2840853838[esi*1+eax] + sub edi, ecx + rol eax, 14 + add eax, ebp + ; 76 + mov esi, DWORD PTR 48[esp] + or edi, ebx + add ebp, esi + xor edi, eax + mov esi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 2840853838[edi*1+ebp] + sub esi, ebx + rol ebp, 11 + add ebp, edx + ; 77 + mov edi, DWORD PTR 28[esp] + or esi, eax + add edx, edi + xor esi, ebp + mov edi, -1 + rol eax, 10 + lea edx, DWORD PTR 2840853838[esi*1+edx] + sub edi, eax + rol edx, 8 + add edx, ecx + ; 78 + mov esi, DWORD PTR 64[esp] + or edi, ebp + add ecx, esi + xor edi, edx + mov esi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 2840853838[edi*1+ecx] + sub esi, ebp + rol ecx, 5 + add ecx, ebx + ; 79 + mov edi, DWORD PTR 56[esp] + or esi, edx + add ebx, edi + xor esi, ecx + mov edi, DWORD PTR 108[esp] + rol edx, 10 + lea ebx, DWORD PTR 2840853838[esi*1+ebx] + mov DWORD PTR 68[esp],eax + rol ebx, 6 + add ebx, eax + mov eax, DWORD PTR [edi] + mov DWORD PTR 72[esp],ebx + mov DWORD PTR 76[esp],ecx + mov ebx, DWORD PTR 4[edi] + mov DWORD PTR 80[esp],edx + mov ecx, DWORD PTR 8[edi] + mov DWORD PTR 84[esp],ebp + mov edx, DWORD PTR 12[edi] + mov ebp, DWORD PTR 16[edi] + ; 80 + mov edi, -1 + sub edi, edx + mov esi, DWORD PTR 24[esp] + or edi, ecx + add eax, esi + xor edi, ebx + mov esi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1352829926[edi*1+eax] + sub esi, ecx + rol eax, 8 + add eax, ebp + ; 81 + mov edi, DWORD PTR 60[esp] + or esi, ebx + add ebp, edi + xor esi, eax + mov edi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1352829926[esi*1+ebp] + sub edi, ebx + rol ebp, 9 + add ebp, edx + ; 82 + mov esi, DWORD PTR 32[esp] + or edi, eax + add edx, esi + xor edi, ebp + mov esi, -1 + rol eax, 10 + lea edx, DWORD PTR 1352829926[edi*1+edx] + sub esi, eax + rol edx, 9 + add edx, ecx + ; 83 + mov edi, DWORD PTR 4[esp] + or esi, ebp + add ecx, edi + xor esi, edx + mov edi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1352829926[esi*1+ecx] + sub edi, ebp + rol ecx, 11 + add ecx, ebx + ; 84 + mov esi, DWORD PTR 40[esp] + or edi, edx + add ebx, esi + xor edi, ecx + mov esi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1352829926[edi*1+ebx] + sub esi, edx + rol ebx, 13 + add ebx, eax + ; 85 + mov edi, DWORD PTR 12[esp] + or esi, ecx + add eax, edi + xor esi, ebx + mov edi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1352829926[esi*1+eax] + sub edi, ecx + rol eax, 15 + add eax, ebp + ; 86 + mov esi, DWORD PTR 48[esp] + or edi, ebx + add ebp, esi + xor edi, eax + mov esi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1352829926[edi*1+ebp] + sub esi, ebx + rol ebp, 15 + add ebp, edx + ; 87 + mov edi, DWORD PTR 20[esp] + or esi, eax + add edx, edi + xor esi, ebp + mov edi, -1 + rol eax, 10 + lea edx, DWORD PTR 1352829926[esi*1+edx] + sub edi, eax + rol edx, 5 + add edx, ecx + ; 88 + mov esi, DWORD PTR 56[esp] + or edi, ebp + add ecx, esi + xor edi, edx + mov esi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1352829926[edi*1+ecx] + sub esi, ebp + rol ecx, 7 + add ecx, ebx + ; 89 + mov edi, DWORD PTR 28[esp] + or esi, edx + add ebx, edi + xor esi, ecx + mov edi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1352829926[esi*1+ebx] + sub edi, edx + rol ebx, 7 + add ebx, eax + ; 90 + mov esi, DWORD PTR 64[esp] + or edi, ecx + add eax, esi + xor edi, ebx + mov esi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1352829926[edi*1+eax] + sub esi, ecx + rol eax, 8 + add eax, ebp + ; 91 + mov edi, DWORD PTR 36[esp] + or esi, ebx + add ebp, edi + xor esi, eax + mov edi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1352829926[esi*1+ebp] + sub edi, ebx + rol ebp, 11 + add ebp, edx + ; 92 + mov esi, DWORD PTR 8[esp] + or edi, eax + add edx, esi + xor edi, ebp + mov esi, -1 + rol eax, 10 + lea edx, DWORD PTR 1352829926[edi*1+edx] + sub esi, eax + rol edx, 14 + add edx, ecx + ; 93 + mov edi, DWORD PTR 44[esp] + or esi, ebp + add ecx, edi + xor esi, edx + mov edi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1352829926[esi*1+ecx] + sub edi, ebp + rol ecx, 14 + add ecx, ebx + ; 94 + mov esi, DWORD PTR 16[esp] + or edi, edx + add ebx, esi + xor edi, ecx + mov esi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1352829926[edi*1+ebx] + sub esi, edx + rol ebx, 12 + add ebx, eax + ; 95 + mov edi, DWORD PTR 52[esp] + or esi, ecx + add eax, edi + xor esi, ebx + mov edi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1352829926[esi*1+eax] + mov esi, ecx + rol eax, 6 + add eax, ebp + ; 96 + sub edi, ecx + and esi, eax + and edi, ebx + or edi, esi + mov esi, DWORD PTR 28[esp] + rol ebx, 10 + lea ebp, DWORD PTR 1548603684[edi+ebp] + mov edi, -1 + add ebp, esi + mov esi, ebx + rol ebp, 9 + add ebp, edx + ; 97 + sub edi, ebx + and esi, ebp + and edi, eax + or edi, esi + mov esi, DWORD PTR 48[esp] + rol eax, 10 + lea edx, DWORD PTR 1548603684[edi+edx] + mov edi, -1 + add edx, esi + mov esi, eax + rol edx, 13 + add edx, ecx + ; 98 + sub edi, eax + and esi, edx + and edi, ebp + or edi, esi + mov esi, DWORD PTR 16[esp] + rol ebp, 10 + lea ecx, DWORD PTR 1548603684[edi+ecx] + mov edi, -1 + add ecx, esi + mov esi, ebp + rol ecx, 15 + add ecx, ebx + ; 99 + sub edi, ebp + and esi, ecx + and edi, edx + or edi, esi + mov esi, DWORD PTR 32[esp] + rol edx, 10 + lea ebx, DWORD PTR 1548603684[edi+ebx] + mov edi, -1 + add ebx, esi + mov esi, edx + rol ebx, 7 + add ebx, eax + ; 100 + sub edi, edx + and esi, ebx + and edi, ecx + or edi, esi + mov esi, DWORD PTR 4[esp] + rol ecx, 10 + lea eax, DWORD PTR 1548603684[edi+eax] + mov edi, -1 + add eax, esi + mov esi, ecx + rol eax, 12 + add eax, ebp + ; 101 + sub edi, ecx + and esi, eax + and edi, ebx + or edi, esi + mov esi, DWORD PTR 56[esp] + rol ebx, 10 + lea ebp, DWORD PTR 1548603684[edi+ebp] + mov edi, -1 + add ebp, esi + mov esi, ebx + rol ebp, 8 + add ebp, edx + ; 102 + sub edi, ebx + and esi, ebp + and edi, eax + or edi, esi + mov esi, DWORD PTR 24[esp] + rol eax, 10 + lea edx, DWORD PTR 1548603684[edi+edx] + mov edi, -1 + add edx, esi + mov esi, eax + rol edx, 9 + add edx, ecx + ; 103 + sub edi, eax + and esi, edx + and edi, ebp + or edi, esi + mov esi, DWORD PTR 44[esp] + rol ebp, 10 + lea ecx, DWORD PTR 1548603684[edi+ecx] + mov edi, -1 + add ecx, esi + mov esi, ebp + rol ecx, 11 + add ecx, ebx + ; 104 + sub edi, ebp + and esi, ecx + and edi, edx + or edi, esi + mov esi, DWORD PTR 60[esp] + rol edx, 10 + lea ebx, DWORD PTR 1548603684[edi+ebx] + mov edi, -1 + add ebx, esi + mov esi, edx + rol ebx, 7 + add ebx, eax + ; 105 + sub edi, edx + and esi, ebx + and edi, ecx + or edi, esi + mov esi, DWORD PTR 64[esp] + rol ecx, 10 + lea eax, DWORD PTR 1548603684[edi+eax] + mov edi, -1 + add eax, esi + mov esi, ecx + rol eax, 7 + add eax, ebp + ; 106 + sub edi, ecx + and esi, eax + and edi, ebx + or edi, esi + mov esi, DWORD PTR 36[esp] + rol ebx, 10 + lea ebp, DWORD PTR 1548603684[edi+ebp] + mov edi, -1 + add ebp, esi + mov esi, ebx + rol ebp, 12 + add ebp, edx + ; 107 + sub edi, ebx + and esi, ebp + and edi, eax + or edi, esi + mov esi, DWORD PTR 52[esp] + rol eax, 10 + lea edx, DWORD PTR 1548603684[edi+edx] + mov edi, -1 + add edx, esi + mov esi, eax + rol edx, 7 + add edx, ecx + ; 108 + sub edi, eax + and esi, edx + and edi, ebp + or edi, esi + mov esi, DWORD PTR 20[esp] + rol ebp, 10 + lea ecx, DWORD PTR 1548603684[edi+ecx] + mov edi, -1 + add ecx, esi + mov esi, ebp + rol ecx, 6 + add ecx, ebx + ; 109 + sub edi, ebp + and esi, ecx + and edi, edx + or edi, esi + mov esi, DWORD PTR 40[esp] + rol edx, 10 + lea ebx, DWORD PTR 1548603684[edi+ebx] + mov edi, -1 + add ebx, esi + mov esi, edx + rol ebx, 15 + add ebx, eax + ; 110 + sub edi, edx + and esi, ebx + and edi, ecx + or edi, esi + mov esi, DWORD PTR 8[esp] + rol ecx, 10 + lea eax, DWORD PTR 1548603684[edi+eax] + mov edi, -1 + add eax, esi + mov esi, ecx + rol eax, 13 + add eax, ebp + ; 111 + sub edi, ecx + and esi, eax + and edi, ebx + or edi, esi + mov esi, DWORD PTR 12[esp] + rol ebx, 10 + lea ebp, DWORD PTR 1548603684[edi+ebp] + mov edi, -1 + add ebp, esi + sub edi, eax + rol ebp, 11 + add ebp, edx + ; 112 + mov esi, DWORD PTR 64[esp] + or edi, ebp + add edx, esi + xor edi, ebx + mov esi, -1 + rol eax, 10 + lea edx, DWORD PTR 1836072691[edi*1+edx] + sub esi, ebp + rol edx, 9 + add edx, ecx + ; 113 + mov edi, DWORD PTR 24[esp] + or esi, edx + add ecx, edi + xor esi, eax + mov edi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1836072691[esi*1+ecx] + sub edi, edx + rol ecx, 7 + add ecx, ebx + ; 114 + mov esi, DWORD PTR 8[esp] + or edi, ecx + add ebx, esi + xor edi, ebp + mov esi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1836072691[edi*1+ebx] + sub esi, ecx + rol ebx, 15 + add ebx, eax + ; 115 + mov edi, DWORD PTR 16[esp] + or esi, ebx + add eax, edi + xor esi, edx + mov edi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1836072691[esi*1+eax] + sub edi, ebx + rol eax, 11 + add eax, ebp + ; 116 + mov esi, DWORD PTR 32[esp] + or edi, eax + add ebp, esi + xor edi, ecx + mov esi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1836072691[edi*1+ebp] + sub esi, eax + rol ebp, 8 + add ebp, edx + ; 117 + mov edi, DWORD PTR 60[esp] + or esi, ebp + add edx, edi + xor esi, ebx + mov edi, -1 + rol eax, 10 + lea edx, DWORD PTR 1836072691[esi*1+edx] + sub edi, ebp + rol edx, 6 + add edx, ecx + ; 118 + mov esi, DWORD PTR 28[esp] + or edi, edx + add ecx, esi + xor edi, eax + mov esi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1836072691[edi*1+ecx] + sub esi, edx + rol ecx, 6 + add ecx, ebx + ; 119 + mov edi, DWORD PTR 40[esp] + or esi, ecx + add ebx, edi + xor esi, ebp + mov edi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1836072691[esi*1+ebx] + sub edi, ecx + rol ebx, 14 + add ebx, eax + ; 120 + mov esi, DWORD PTR 48[esp] + or edi, ebx + add eax, esi + xor edi, edx + mov esi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1836072691[edi*1+eax] + sub esi, ebx + rol eax, 12 + add eax, ebp + ; 121 + mov edi, DWORD PTR 36[esp] + or esi, eax + add ebp, edi + xor esi, ecx + mov edi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1836072691[esi*1+ebp] + sub edi, eax + rol ebp, 13 + add ebp, edx + ; 122 + mov esi, DWORD PTR 52[esp] + or edi, ebp + add edx, esi + xor edi, ebx + mov esi, -1 + rol eax, 10 + lea edx, DWORD PTR 1836072691[edi*1+edx] + sub esi, ebp + rol edx, 5 + add edx, ecx + ; 123 + mov edi, DWORD PTR 12[esp] + or esi, edx + add ecx, edi + xor esi, eax + mov edi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1836072691[esi*1+ecx] + sub edi, edx + rol ecx, 14 + add ecx, ebx + ; 124 + mov esi, DWORD PTR 44[esp] + or edi, ecx + add ebx, esi + xor edi, ebp + mov esi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1836072691[edi*1+ebx] + sub esi, ecx + rol ebx, 13 + add ebx, eax + ; 125 + mov edi, DWORD PTR 4[esp] + or esi, ebx + add eax, edi + xor esi, edx + mov edi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1836072691[esi*1+eax] + sub edi, ebx + rol eax, 13 + add eax, ebp + ; 126 + mov esi, DWORD PTR 20[esp] + or edi, eax + add ebp, esi + xor edi, ecx + mov esi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1836072691[edi*1+ebp] + sub esi, eax + rol ebp, 7 + add ebp, edx + ; 127 + mov edi, DWORD PTR 56[esp] + or esi, ebp + add edx, edi + xor esi, ebx + mov edi, DWORD PTR 36[esp] + rol eax, 10 + lea edx, DWORD PTR 1836072691[esi*1+edx] + mov esi, -1 + rol edx, 5 + add edx, ecx + ; 128 + add ecx, edi + mov edi, ebp + sub esi, edx + and edi, edx + and esi, eax + or edi, esi + mov esi, DWORD PTR 28[esp] + rol ebp, 10 + lea ecx, DWORD PTR 2053994217[edi*1+ecx] + mov edi, -1 + rol ecx, 15 + add ecx, ebx + ; 129 + add ebx, esi + mov esi, edx + sub edi, ecx + and esi, ecx + and edi, ebp + or esi, edi + mov edi, DWORD PTR 20[esp] + rol edx, 10 + lea ebx, DWORD PTR 2053994217[esi*1+ebx] + mov esi, -1 + rol ebx, 5 + add ebx, eax + ; 130 + add eax, edi + mov edi, ecx + sub esi, ebx + and edi, ebx + and esi, edx + or edi, esi + mov esi, DWORD PTR 8[esp] + rol ecx, 10 + lea eax, DWORD PTR 2053994217[edi*1+eax] + mov edi, -1 + rol eax, 8 + add eax, ebp + ; 131 + add ebp, esi + mov esi, ebx + sub edi, eax + and esi, eax + and edi, ecx + or esi, edi + mov edi, DWORD PTR 16[esp] + rol ebx, 10 + lea ebp, DWORD PTR 2053994217[esi*1+ebp] + mov esi, -1 + rol ebp, 11 + add ebp, edx + ; 132 + add edx, edi + mov edi, eax + sub esi, ebp + and edi, ebp + and esi, ebx + or edi, esi + mov esi, DWORD PTR 48[esp] + rol eax, 10 + lea edx, DWORD PTR 2053994217[edi*1+edx] + mov edi, -1 + rol edx, 14 + add edx, ecx + ; 133 + add ecx, esi + mov esi, ebp + sub edi, edx + and esi, edx + and edi, eax + or esi, edi + mov edi, DWORD PTR 64[esp] + rol ebp, 10 + lea ecx, DWORD PTR 2053994217[esi*1+ecx] + mov esi, -1 + rol ecx, 14 + add ecx, ebx + ; 134 + add ebx, edi + mov edi, edx + sub esi, ecx + and edi, ecx + and esi, ebp + or edi, esi + mov esi, DWORD PTR 4[esp] + rol edx, 10 + lea ebx, DWORD PTR 2053994217[edi*1+ebx] + mov edi, -1 + rol ebx, 6 + add ebx, eax + ; 135 + add eax, esi + mov esi, ecx + sub edi, ebx + and esi, ebx + and edi, edx + or esi, edi + mov edi, DWORD PTR 24[esp] + rol ecx, 10 + lea eax, DWORD PTR 2053994217[esi*1+eax] + mov esi, -1 + rol eax, 14 + add eax, ebp + ; 136 + add ebp, edi + mov edi, ebx + sub esi, eax + and edi, eax + and esi, ecx + or edi, esi + mov esi, DWORD PTR 52[esp] + rol ebx, 10 + lea ebp, DWORD PTR 2053994217[edi*1+ebp] + mov edi, -1 + rol ebp, 6 + add ebp, edx + ; 137 + add edx, esi + mov esi, eax + sub edi, ebp + and esi, ebp + and edi, ebx + or esi, edi + mov edi, DWORD PTR 12[esp] + rol eax, 10 + lea edx, DWORD PTR 2053994217[esi*1+edx] + mov esi, -1 + rol edx, 9 + add edx, ecx + ; 138 + add ecx, edi + mov edi, ebp + sub esi, edx + and edi, edx + and esi, eax + or edi, esi + mov esi, DWORD PTR 56[esp] + rol ebp, 10 + lea ecx, DWORD PTR 2053994217[edi*1+ecx] + mov edi, -1 + rol ecx, 12 + add ecx, ebx + ; 139 + add ebx, esi + mov esi, edx + sub edi, ecx + and esi, ecx + and edi, ebp + or esi, edi + mov edi, DWORD PTR 40[esp] + rol edx, 10 + lea ebx, DWORD PTR 2053994217[esi*1+ebx] + mov esi, -1 + rol ebx, 9 + add ebx, eax + ; 140 + add eax, edi + mov edi, ecx + sub esi, ebx + and edi, ebx + and esi, edx + or edi, esi + mov esi, DWORD PTR 32[esp] + rol ecx, 10 + lea eax, DWORD PTR 2053994217[edi*1+eax] + mov edi, -1 + rol eax, 12 + add eax, ebp + ; 141 + add ebp, esi + mov esi, ebx + sub edi, eax + and esi, eax + and edi, ecx + or esi, edi + mov edi, DWORD PTR 44[esp] + rol ebx, 10 + lea ebp, DWORD PTR 2053994217[esi*1+ebp] + mov esi, -1 + rol ebp, 5 + add ebp, edx + ; 142 + add edx, edi + mov edi, eax + sub esi, ebp + and edi, ebp + and esi, ebx + or edi, esi + mov esi, DWORD PTR 60[esp] + rol eax, 10 + lea edx, DWORD PTR 2053994217[edi*1+edx] + mov edi, -1 + rol edx, 15 + add edx, ecx + ; 143 + add ecx, esi + mov esi, ebp + sub edi, edx + and esi, edx + and edi, eax + or edi, esi + mov esi, edx + rol ebp, 10 + lea ecx, DWORD PTR 2053994217[edi*1+ecx] + xor esi, ebp + rol ecx, 8 + add ecx, ebx + ; 144 + mov edi, DWORD PTR 52[esp] + xor esi, ecx + add ebx, edi + rol edx, 10 + add ebx, esi + mov esi, ecx + rol ebx, 8 + add ebx, eax + ; 145 + xor esi, edx + mov edi, DWORD PTR 64[esp] + xor esi, ebx + add eax, esi + mov esi, ebx + rol ecx, 10 + add eax, edi + xor esi, ecx + rol eax, 5 + add eax, ebp + ; 146 + mov edi, DWORD PTR 44[esp] + xor esi, eax + add ebp, edi + rol ebx, 10 + add ebp, esi + mov esi, eax + rol ebp, 12 + add ebp, edx + ; 147 + xor esi, ebx + mov edi, DWORD PTR 20[esp] + xor esi, ebp + add edx, esi + mov esi, ebp + rol eax, 10 + add edx, edi + xor esi, eax + rol edx, 9 + add edx, ecx + ; 148 + mov edi, DWORD PTR 8[esp] + xor esi, edx + add ecx, edi + rol ebp, 10 + add ecx, esi + mov esi, edx + rol ecx, 12 + add ecx, ebx + ; 149 + xor esi, ebp + mov edi, DWORD PTR 24[esp] + xor esi, ecx + add ebx, esi + mov esi, ecx + rol edx, 10 + add ebx, edi + xor esi, edx + rol ebx, 5 + add ebx, eax + ; 150 + mov edi, DWORD PTR 36[esp] + xor esi, ebx + add eax, edi + rol ecx, 10 + add eax, esi + mov esi, ebx + rol eax, 14 + add eax, ebp + ; 151 + xor esi, ecx + mov edi, DWORD PTR 32[esp] + xor esi, eax + add ebp, esi + mov esi, eax + rol ebx, 10 + add ebp, edi + xor esi, ebx + rol ebp, 6 + add ebp, edx + ; 152 + mov edi, DWORD PTR 28[esp] + xor esi, ebp + add edx, edi + rol eax, 10 + add edx, esi + mov esi, ebp + rol edx, 8 + add edx, ecx + ; 153 + xor esi, eax + mov edi, DWORD PTR 12[esp] + xor esi, edx + add ecx, esi + mov esi, edx + rol ebp, 10 + add ecx, edi + xor esi, ebp + rol ecx, 13 + add ecx, ebx + ; 154 + mov edi, DWORD PTR 56[esp] + xor esi, ecx + add ebx, edi + rol edx, 10 + add ebx, esi + mov esi, ecx + rol ebx, 6 + add ebx, eax + ; 155 + xor esi, edx + mov edi, DWORD PTR 60[esp] + xor esi, ebx + add eax, esi + mov esi, ebx + rol ecx, 10 + add eax, edi + xor esi, ecx + rol eax, 5 + add eax, ebp + ; 156 + mov edi, DWORD PTR 4[esp] + xor esi, eax + add ebp, edi + rol ebx, 10 + add ebp, esi + mov esi, eax + rol ebp, 15 + add ebp, edx + ; 157 + xor esi, ebx + mov edi, DWORD PTR 16[esp] + xor esi, ebp + add edx, esi + mov esi, ebp + rol eax, 10 + add edx, edi + xor esi, eax + rol edx, 13 + add edx, ecx + ; 158 + mov edi, DWORD PTR 40[esp] + xor esi, edx + add ecx, edi + rol ebp, 10 + add ecx, esi + mov esi, edx + rol ecx, 11 + add ecx, ebx + ; 159 + xor esi, ebp + mov edi, DWORD PTR 48[esp] + xor esi, ecx + add ebx, esi + rol edx, 10 + add ebx, edi + mov edi, DWORD PTR 108[esp] + rol ebx, 11 + add ebx, eax + mov esi, DWORD PTR 4[edi] + add edx, esi + mov esi, DWORD PTR 76[esp] + add edx, esi + mov esi, DWORD PTR 8[edi] + add ebp, esi + mov esi, DWORD PTR 80[esp] + add ebp, esi + mov esi, DWORD PTR 12[edi] + add eax, esi + mov esi, DWORD PTR 84[esp] + add eax, esi + mov esi, DWORD PTR 16[edi] + add ebx, esi + mov esi, DWORD PTR 68[esp] + add ebx, esi + mov esi, DWORD PTR [edi] + add ecx, esi + mov esi, DWORD PTR 72[esp] + add ecx, esi + mov DWORD PTR [edi],edx + mov DWORD PTR 4[edi],ebp + mov DWORD PTR 8[edi],eax + mov DWORD PTR 12[edi],ebx + mov DWORD PTR 16[edi],ecx + mov edi, DWORD PTR [esp] + mov esi, DWORD PTR 112[esp] + cmp edi, esi + mov edi, DWORD PTR 108[esp] + jge L000start + add esp, 88 + pop ebx + pop ebp + pop edi + pop esi + ret +_ripemd160_block_x86 ENDP +_TEXT ENDS +END diff --git a/src/lib/libcrypto/ripemd/asm/rm86unix.cpp b/src/lib/libcrypto/ripemd/asm/rm86unix.cpp new file mode 100644 index 0000000000..f90f6f2fd6 --- /dev/null +++ b/src/lib/libcrypto/ripemd/asm/rm86unix.cpp @@ -0,0 +1,2016 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define ripemd160_block_x86 _ripemd160_block_x86 + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by rmd-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "rmd-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl ripemd160_block_x86 + TYPE(ripemd160_block_x86,@function) +ripemd160_block_x86: + pushl %esi + movl 16(%esp), %ecx + pushl %edi + movl 16(%esp), %esi + pushl %ebp + addl %esi, %ecx + pushl %ebx + subl $64, %ecx + subl $88, %esp + movl %ecx, (%esp) + movl 108(%esp), %edi +.L000start: + + movl (%esi), %eax + movl 4(%esi), %ebx + movl %eax, 4(%esp) + movl %ebx, 8(%esp) + movl 8(%esi), %eax + movl 12(%esi), %ebx + movl %eax, 12(%esp) + movl %ebx, 16(%esp) + movl 16(%esi), %eax + movl 20(%esi), %ebx + movl %eax, 20(%esp) + movl %ebx, 24(%esp) + movl 24(%esi), %eax + movl 28(%esi), %ebx + movl %eax, 28(%esp) + movl %ebx, 32(%esp) + movl 32(%esi), %eax + movl 36(%esi), %ebx + movl %eax, 36(%esp) + movl %ebx, 40(%esp) + movl 40(%esi), %eax + movl 44(%esi), %ebx + movl %eax, 44(%esp) + movl %ebx, 48(%esp) + movl 48(%esi), %eax + movl 52(%esi), %ebx + movl %eax, 52(%esp) + movl %ebx, 56(%esp) + movl 56(%esi), %eax + movl 60(%esi), %ebx + movl %eax, 60(%esp) + movl %ebx, 64(%esp) + addl $64, %esi + movl (%edi), %eax + movl %esi, 112(%esp) + movl 4(%edi), %ebx + movl 8(%edi), %ecx + movl 12(%edi), %edx + movl 16(%edi), %ebp + /* 0 */ + movl %ecx, %esi + xorl %edx, %esi + movl 4(%esp), %edi + xorl %ebx, %esi + addl %edi, %eax + roll $10, %ecx + addl %esi, %eax + movl %ebx, %esi + roll $11, %eax + addl %ebp, %eax + /* 1 */ + xorl %ecx, %esi + movl 8(%esp), %edi + xorl %eax, %esi + addl %esi, %ebp + movl %eax, %esi + roll $10, %ebx + addl %edi, %ebp + xorl %ebx, %esi + roll $14, %ebp + addl %edx, %ebp + /* 2 */ + movl 12(%esp), %edi + xorl %ebp, %esi + addl %edi, %edx + roll $10, %eax + addl %esi, %edx + movl %ebp, %esi + roll $15, %edx + addl %ecx, %edx + /* 3 */ + xorl %eax, %esi + movl 16(%esp), %edi + xorl %edx, %esi + addl %esi, %ecx + movl %edx, %esi + roll $10, %ebp + addl %edi, %ecx + xorl %ebp, %esi + roll $12, %ecx + addl %ebx, %ecx + /* 4 */ + movl 20(%esp), %edi + xorl %ecx, %esi + addl %edi, %ebx + roll $10, %edx + addl %esi, %ebx + movl %ecx, %esi + roll $5, %ebx + addl %eax, %ebx + /* 5 */ + xorl %edx, %esi + movl 24(%esp), %edi + xorl %ebx, %esi + addl %esi, %eax + movl %ebx, %esi + roll $10, %ecx + addl %edi, %eax + xorl %ecx, %esi + roll $8, %eax + addl %ebp, %eax + /* 6 */ + movl 28(%esp), %edi + xorl %eax, %esi + addl %edi, %ebp + roll $10, %ebx + addl %esi, %ebp + movl %eax, %esi + roll $7, %ebp + addl %edx, %ebp + /* 7 */ + xorl %ebx, %esi + movl 32(%esp), %edi + xorl %ebp, %esi + addl %esi, %edx + movl %ebp, %esi + roll $10, %eax + addl %edi, %edx + xorl %eax, %esi + roll $9, %edx + addl %ecx, %edx + /* 8 */ + movl 36(%esp), %edi + xorl %edx, %esi + addl %edi, %ecx + roll $10, %ebp + addl %esi, %ecx + movl %edx, %esi + roll $11, %ecx + addl %ebx, %ecx + /* 9 */ + xorl %ebp, %esi + movl 40(%esp), %edi + xorl %ecx, %esi + addl %esi, %ebx + movl %ecx, %esi + roll $10, %edx + addl %edi, %ebx + xorl %edx, %esi + roll $13, %ebx + addl %eax, %ebx + /* 10 */ + movl 44(%esp), %edi + xorl %ebx, %esi + addl %edi, %eax + roll $10, %ecx + addl %esi, %eax + movl %ebx, %esi + roll $14, %eax + addl %ebp, %eax + /* 11 */ + xorl %ecx, %esi + movl 48(%esp), %edi + xorl %eax, %esi + addl %esi, %ebp + movl %eax, %esi + roll $10, %ebx + addl %edi, %ebp + xorl %ebx, %esi + roll $15, %ebp + addl %edx, %ebp + /* 12 */ + movl 52(%esp), %edi + xorl %ebp, %esi + addl %edi, %edx + roll $10, %eax + addl %esi, %edx + movl %ebp, %esi + roll $6, %edx + addl %ecx, %edx + /* 13 */ + xorl %eax, %esi + movl 56(%esp), %edi + xorl %edx, %esi + addl %esi, %ecx + movl %edx, %esi + roll $10, %ebp + addl %edi, %ecx + xorl %ebp, %esi + roll $7, %ecx + addl %ebx, %ecx + /* 14 */ + movl 60(%esp), %edi + xorl %ecx, %esi + addl %edi, %ebx + roll $10, %edx + addl %esi, %ebx + movl %ecx, %esi + roll $9, %ebx + addl %eax, %ebx + /* 15 */ + xorl %edx, %esi + movl 64(%esp), %edi + xorl %ebx, %esi + addl %esi, %eax + movl $-1, %esi + roll $10, %ecx + addl %edi, %eax + movl 32(%esp), %edi + roll $8, %eax + addl %ebp, %eax + /* 16 */ + addl %edi, %ebp + movl %ebx, %edi + subl %eax, %esi + andl %eax, %edi + andl %ecx, %esi + orl %esi, %edi + movl 20(%esp), %esi + roll $10, %ebx + leal 1518500249(%ebp,%edi,1),%ebp + movl $-1, %edi + roll $7, %ebp + addl %edx, %ebp + /* 17 */ + addl %esi, %edx + movl %eax, %esi + subl %ebp, %edi + andl %ebp, %esi + andl %ebx, %edi + orl %edi, %esi + movl 56(%esp), %edi + roll $10, %eax + leal 1518500249(%edx,%esi,1),%edx + movl $-1, %esi + roll $6, %edx + addl %ecx, %edx + /* 18 */ + addl %edi, %ecx + movl %ebp, %edi + subl %edx, %esi + andl %edx, %edi + andl %eax, %esi + orl %esi, %edi + movl 8(%esp), %esi + roll $10, %ebp + leal 1518500249(%ecx,%edi,1),%ecx + movl $-1, %edi + roll $8, %ecx + addl %ebx, %ecx + /* 19 */ + addl %esi, %ebx + movl %edx, %esi + subl %ecx, %edi + andl %ecx, %esi + andl %ebp, %edi + orl %edi, %esi + movl 44(%esp), %edi + roll $10, %edx + leal 1518500249(%ebx,%esi,1),%ebx + movl $-1, %esi + roll $13, %ebx + addl %eax, %ebx + /* 20 */ + addl %edi, %eax + movl %ecx, %edi + subl %ebx, %esi + andl %ebx, %edi + andl %edx, %esi + orl %esi, %edi + movl 28(%esp), %esi + roll $10, %ecx + leal 1518500249(%eax,%edi,1),%eax + movl $-1, %edi + roll $11, %eax + addl %ebp, %eax + /* 21 */ + addl %esi, %ebp + movl %ebx, %esi + subl %eax, %edi + andl %eax, %esi + andl %ecx, %edi + orl %edi, %esi + movl 64(%esp), %edi + roll $10, %ebx + leal 1518500249(%ebp,%esi,1),%ebp + movl $-1, %esi + roll $9, %ebp + addl %edx, %ebp + /* 22 */ + addl %edi, %edx + movl %eax, %edi + subl %ebp, %esi + andl %ebp, %edi + andl %ebx, %esi + orl %esi, %edi + movl 16(%esp), %esi + roll $10, %eax + leal 1518500249(%edx,%edi,1),%edx + movl $-1, %edi + roll $7, %edx + addl %ecx, %edx + /* 23 */ + addl %esi, %ecx + movl %ebp, %esi + subl %edx, %edi + andl %edx, %esi + andl %eax, %edi + orl %edi, %esi + movl 52(%esp), %edi + roll $10, %ebp + leal 1518500249(%ecx,%esi,1),%ecx + movl $-1, %esi + roll $15, %ecx + addl %ebx, %ecx + /* 24 */ + addl %edi, %ebx + movl %edx, %edi + subl %ecx, %esi + andl %ecx, %edi + andl %ebp, %esi + orl %esi, %edi + movl 4(%esp), %esi + roll $10, %edx + leal 1518500249(%ebx,%edi,1),%ebx + movl $-1, %edi + roll $7, %ebx + addl %eax, %ebx + /* 25 */ + addl %esi, %eax + movl %ecx, %esi + subl %ebx, %edi + andl %ebx, %esi + andl %edx, %edi + orl %edi, %esi + movl 40(%esp), %edi + roll $10, %ecx + leal 1518500249(%eax,%esi,1),%eax + movl $-1, %esi + roll $12, %eax + addl %ebp, %eax + /* 26 */ + addl %edi, %ebp + movl %ebx, %edi + subl %eax, %esi + andl %eax, %edi + andl %ecx, %esi + orl %esi, %edi + movl 24(%esp), %esi + roll $10, %ebx + leal 1518500249(%ebp,%edi,1),%ebp + movl $-1, %edi + roll $15, %ebp + addl %edx, %ebp + /* 27 */ + addl %esi, %edx + movl %eax, %esi + subl %ebp, %edi + andl %ebp, %esi + andl %ebx, %edi + orl %edi, %esi + movl 12(%esp), %edi + roll $10, %eax + leal 1518500249(%edx,%esi,1),%edx + movl $-1, %esi + roll $9, %edx + addl %ecx, %edx + /* 28 */ + addl %edi, %ecx + movl %ebp, %edi + subl %edx, %esi + andl %edx, %edi + andl %eax, %esi + orl %esi, %edi + movl 60(%esp), %esi + roll $10, %ebp + leal 1518500249(%ecx,%edi,1),%ecx + movl $-1, %edi + roll $11, %ecx + addl %ebx, %ecx + /* 29 */ + addl %esi, %ebx + movl %edx, %esi + subl %ecx, %edi + andl %ecx, %esi + andl %ebp, %edi + orl %edi, %esi + movl 48(%esp), %edi + roll $10, %edx + leal 1518500249(%ebx,%esi,1),%ebx + movl $-1, %esi + roll $7, %ebx + addl %eax, %ebx + /* 30 */ + addl %edi, %eax + movl %ecx, %edi + subl %ebx, %esi + andl %ebx, %edi + andl %edx, %esi + orl %esi, %edi + movl 36(%esp), %esi + roll $10, %ecx + leal 1518500249(%eax,%edi,1),%eax + movl $-1, %edi + roll $13, %eax + addl %ebp, %eax + /* 31 */ + addl %esi, %ebp + movl %ebx, %esi + subl %eax, %edi + andl %eax, %esi + andl %ecx, %edi + orl %edi, %esi + movl $-1, %edi + roll $10, %ebx + leal 1518500249(%ebp,%esi,1),%ebp + subl %eax, %edi + roll $12, %ebp + addl %edx, %ebp + /* 32 */ + movl 16(%esp), %esi + orl %ebp, %edi + addl %esi, %edx + xorl %ebx, %edi + movl $-1, %esi + roll $10, %eax + leal 1859775393(%edx,%edi,1),%edx + subl %ebp, %esi + roll $11, %edx + addl %ecx, %edx + /* 33 */ + movl 44(%esp), %edi + orl %edx, %esi + addl %edi, %ecx + xorl %eax, %esi + movl $-1, %edi + roll $10, %ebp + leal 1859775393(%ecx,%esi,1),%ecx + subl %edx, %edi + roll $13, %ecx + addl %ebx, %ecx + /* 34 */ + movl 60(%esp), %esi + orl %ecx, %edi + addl %esi, %ebx + xorl %ebp, %edi + movl $-1, %esi + roll $10, %edx + leal 1859775393(%ebx,%edi,1),%ebx + subl %ecx, %esi + roll $6, %ebx + addl %eax, %ebx + /* 35 */ + movl 20(%esp), %edi + orl %ebx, %esi + addl %edi, %eax + xorl %edx, %esi + movl $-1, %edi + roll $10, %ecx + leal 1859775393(%eax,%esi,1),%eax + subl %ebx, %edi + roll $7, %eax + addl %ebp, %eax + /* 36 */ + movl 40(%esp), %esi + orl %eax, %edi + addl %esi, %ebp + xorl %ecx, %edi + movl $-1, %esi + roll $10, %ebx + leal 1859775393(%ebp,%edi,1),%ebp + subl %eax, %esi + roll $14, %ebp + addl %edx, %ebp + /* 37 */ + movl 64(%esp), %edi + orl %ebp, %esi + addl %edi, %edx + xorl %ebx, %esi + movl $-1, %edi + roll $10, %eax + leal 1859775393(%edx,%esi,1),%edx + subl %ebp, %edi + roll $9, %edx + addl %ecx, %edx + /* 38 */ + movl 36(%esp), %esi + orl %edx, %edi + addl %esi, %ecx + xorl %eax, %edi + movl $-1, %esi + roll $10, %ebp + leal 1859775393(%ecx,%edi,1),%ecx + subl %edx, %esi + roll $13, %ecx + addl %ebx, %ecx + /* 39 */ + movl 8(%esp), %edi + orl %ecx, %esi + addl %edi, %ebx + xorl %ebp, %esi + movl $-1, %edi + roll $10, %edx + leal 1859775393(%ebx,%esi,1),%ebx + subl %ecx, %edi + roll $15, %ebx + addl %eax, %ebx + /* 40 */ + movl 12(%esp), %esi + orl %ebx, %edi + addl %esi, %eax + xorl %edx, %edi + movl $-1, %esi + roll $10, %ecx + leal 1859775393(%eax,%edi,1),%eax + subl %ebx, %esi + roll $14, %eax + addl %ebp, %eax + /* 41 */ + movl 32(%esp), %edi + orl %eax, %esi + addl %edi, %ebp + xorl %ecx, %esi + movl $-1, %edi + roll $10, %ebx + leal 1859775393(%ebp,%esi,1),%ebp + subl %eax, %edi + roll $8, %ebp + addl %edx, %ebp + /* 42 */ + movl 4(%esp), %esi + orl %ebp, %edi + addl %esi, %edx + xorl %ebx, %edi + movl $-1, %esi + roll $10, %eax + leal 1859775393(%edx,%edi,1),%edx + subl %ebp, %esi + roll $13, %edx + addl %ecx, %edx + /* 43 */ + movl 28(%esp), %edi + orl %edx, %esi + addl %edi, %ecx + xorl %eax, %esi + movl $-1, %edi + roll $10, %ebp + leal 1859775393(%ecx,%esi,1),%ecx + subl %edx, %edi + roll $6, %ecx + addl %ebx, %ecx + /* 44 */ + movl 56(%esp), %esi + orl %ecx, %edi + addl %esi, %ebx + xorl %ebp, %edi + movl $-1, %esi + roll $10, %edx + leal 1859775393(%ebx,%edi,1),%ebx + subl %ecx, %esi + roll $5, %ebx + addl %eax, %ebx + /* 45 */ + movl 48(%esp), %edi + orl %ebx, %esi + addl %edi, %eax + xorl %edx, %esi + movl $-1, %edi + roll $10, %ecx + leal 1859775393(%eax,%esi,1),%eax + subl %ebx, %edi + roll $12, %eax + addl %ebp, %eax + /* 46 */ + movl 24(%esp), %esi + orl %eax, %edi + addl %esi, %ebp + xorl %ecx, %edi + movl $-1, %esi + roll $10, %ebx + leal 1859775393(%ebp,%edi,1),%ebp + subl %eax, %esi + roll $7, %ebp + addl %edx, %ebp + /* 47 */ + movl 52(%esp), %edi + orl %ebp, %esi + addl %edi, %edx + xorl %ebx, %esi + movl $-1, %edi + roll $10, %eax + leal 1859775393(%edx,%esi,1),%edx + movl %eax, %esi + roll $5, %edx + addl %ecx, %edx + /* 48 */ + subl %eax, %edi + andl %edx, %esi + andl %ebp, %edi + orl %esi, %edi + movl 8(%esp), %esi + roll $10, %ebp + leal 2400959708(%ecx,%edi,),%ecx + movl $-1, %edi + addl %esi, %ecx + movl %ebp, %esi + roll $11, %ecx + addl %ebx, %ecx + /* 49 */ + subl %ebp, %edi + andl %ecx, %esi + andl %edx, %edi + orl %esi, %edi + movl 40(%esp), %esi + roll $10, %edx + leal 2400959708(%ebx,%edi,),%ebx + movl $-1, %edi + addl %esi, %ebx + movl %edx, %esi + roll $12, %ebx + addl %eax, %ebx + /* 50 */ + subl %edx, %edi + andl %ebx, %esi + andl %ecx, %edi + orl %esi, %edi + movl 48(%esp), %esi + roll $10, %ecx + leal 2400959708(%eax,%edi,),%eax + movl $-1, %edi + addl %esi, %eax + movl %ecx, %esi + roll $14, %eax + addl %ebp, %eax + /* 51 */ + subl %ecx, %edi + andl %eax, %esi + andl %ebx, %edi + orl %esi, %edi + movl 44(%esp), %esi + roll $10, %ebx + leal 2400959708(%ebp,%edi,),%ebp + movl $-1, %edi + addl %esi, %ebp + movl %ebx, %esi + roll $15, %ebp + addl %edx, %ebp + /* 52 */ + subl %ebx, %edi + andl %ebp, %esi + andl %eax, %edi + orl %esi, %edi + movl 4(%esp), %esi + roll $10, %eax + leal 2400959708(%edx,%edi,),%edx + movl $-1, %edi + addl %esi, %edx + movl %eax, %esi + roll $14, %edx + addl %ecx, %edx + /* 53 */ + subl %eax, %edi + andl %edx, %esi + andl %ebp, %edi + orl %esi, %edi + movl 36(%esp), %esi + roll $10, %ebp + leal 2400959708(%ecx,%edi,),%ecx + movl $-1, %edi + addl %esi, %ecx + movl %ebp, %esi + roll $15, %ecx + addl %ebx, %ecx + /* 54 */ + subl %ebp, %edi + andl %ecx, %esi + andl %edx, %edi + orl %esi, %edi + movl 52(%esp), %esi + roll $10, %edx + leal 2400959708(%ebx,%edi,),%ebx + movl $-1, %edi + addl %esi, %ebx + movl %edx, %esi + roll $9, %ebx + addl %eax, %ebx + /* 55 */ + subl %edx, %edi + andl %ebx, %esi + andl %ecx, %edi + orl %esi, %edi + movl 20(%esp), %esi + roll $10, %ecx + leal 2400959708(%eax,%edi,),%eax + movl $-1, %edi + addl %esi, %eax + movl %ecx, %esi + roll $8, %eax + addl %ebp, %eax + /* 56 */ + subl %ecx, %edi + andl %eax, %esi + andl %ebx, %edi + orl %esi, %edi + movl 56(%esp), %esi + roll $10, %ebx + leal 2400959708(%ebp,%edi,),%ebp + movl $-1, %edi + addl %esi, %ebp + movl %ebx, %esi + roll $9, %ebp + addl %edx, %ebp + /* 57 */ + subl %ebx, %edi + andl %ebp, %esi + andl %eax, %edi + orl %esi, %edi + movl 16(%esp), %esi + roll $10, %eax + leal 2400959708(%edx,%edi,),%edx + movl $-1, %edi + addl %esi, %edx + movl %eax, %esi + roll $14, %edx + addl %ecx, %edx + /* 58 */ + subl %eax, %edi + andl %edx, %esi + andl %ebp, %edi + orl %esi, %edi + movl 32(%esp), %esi + roll $10, %ebp + leal 2400959708(%ecx,%edi,),%ecx + movl $-1, %edi + addl %esi, %ecx + movl %ebp, %esi + roll $5, %ecx + addl %ebx, %ecx + /* 59 */ + subl %ebp, %edi + andl %ecx, %esi + andl %edx, %edi + orl %esi, %edi + movl 64(%esp), %esi + roll $10, %edx + leal 2400959708(%ebx,%edi,),%ebx + movl $-1, %edi + addl %esi, %ebx + movl %edx, %esi + roll $6, %ebx + addl %eax, %ebx + /* 60 */ + subl %edx, %edi + andl %ebx, %esi + andl %ecx, %edi + orl %esi, %edi + movl 60(%esp), %esi + roll $10, %ecx + leal 2400959708(%eax,%edi,),%eax + movl $-1, %edi + addl %esi, %eax + movl %ecx, %esi + roll $8, %eax + addl %ebp, %eax + /* 61 */ + subl %ecx, %edi + andl %eax, %esi + andl %ebx, %edi + orl %esi, %edi + movl 24(%esp), %esi + roll $10, %ebx + leal 2400959708(%ebp,%edi,),%ebp + movl $-1, %edi + addl %esi, %ebp + movl %ebx, %esi + roll $6, %ebp + addl %edx, %ebp + /* 62 */ + subl %ebx, %edi + andl %ebp, %esi + andl %eax, %edi + orl %esi, %edi + movl 28(%esp), %esi + roll $10, %eax + leal 2400959708(%edx,%edi,),%edx + movl $-1, %edi + addl %esi, %edx + movl %eax, %esi + roll $5, %edx + addl %ecx, %edx + /* 63 */ + subl %eax, %edi + andl %edx, %esi + andl %ebp, %edi + orl %esi, %edi + movl 12(%esp), %esi + roll $10, %ebp + leal 2400959708(%ecx,%edi,),%ecx + movl $-1, %edi + addl %esi, %ecx + subl %ebp, %edi + roll $12, %ecx + addl %ebx, %ecx + /* 64 */ + movl 20(%esp), %esi + orl %edx, %edi + addl %esi, %ebx + xorl %ecx, %edi + movl $-1, %esi + roll $10, %edx + leal 2840853838(%ebx,%edi,1),%ebx + subl %edx, %esi + roll $9, %ebx + addl %eax, %ebx + /* 65 */ + movl 4(%esp), %edi + orl %ecx, %esi + addl %edi, %eax + xorl %ebx, %esi + movl $-1, %edi + roll $10, %ecx + leal 2840853838(%eax,%esi,1),%eax + subl %ecx, %edi + roll $15, %eax + addl %ebp, %eax + /* 66 */ + movl 24(%esp), %esi + orl %ebx, %edi + addl %esi, %ebp + xorl %eax, %edi + movl $-1, %esi + roll $10, %ebx + leal 2840853838(%ebp,%edi,1),%ebp + subl %ebx, %esi + roll $5, %ebp + addl %edx, %ebp + /* 67 */ + movl 40(%esp), %edi + orl %eax, %esi + addl %edi, %edx + xorl %ebp, %esi + movl $-1, %edi + roll $10, %eax + leal 2840853838(%edx,%esi,1),%edx + subl %eax, %edi + roll $11, %edx + addl %ecx, %edx + /* 68 */ + movl 32(%esp), %esi + orl %ebp, %edi + addl %esi, %ecx + xorl %edx, %edi + movl $-1, %esi + roll $10, %ebp + leal 2840853838(%ecx,%edi,1),%ecx + subl %ebp, %esi + roll $6, %ecx + addl %ebx, %ecx + /* 69 */ + movl 52(%esp), %edi + orl %edx, %esi + addl %edi, %ebx + xorl %ecx, %esi + movl $-1, %edi + roll $10, %edx + leal 2840853838(%ebx,%esi,1),%ebx + subl %edx, %edi + roll $8, %ebx + addl %eax, %ebx + /* 70 */ + movl 12(%esp), %esi + orl %ecx, %edi + addl %esi, %eax + xorl %ebx, %edi + movl $-1, %esi + roll $10, %ecx + leal 2840853838(%eax,%edi,1),%eax + subl %ecx, %esi + roll $13, %eax + addl %ebp, %eax + /* 71 */ + movl 44(%esp), %edi + orl %ebx, %esi + addl %edi, %ebp + xorl %eax, %esi + movl $-1, %edi + roll $10, %ebx + leal 2840853838(%ebp,%esi,1),%ebp + subl %ebx, %edi + roll $12, %ebp + addl %edx, %ebp + /* 72 */ + movl 60(%esp), %esi + orl %eax, %edi + addl %esi, %edx + xorl %ebp, %edi + movl $-1, %esi + roll $10, %eax + leal 2840853838(%edx,%edi,1),%edx + subl %eax, %esi + roll $5, %edx + addl %ecx, %edx + /* 73 */ + movl 8(%esp), %edi + orl %ebp, %esi + addl %edi, %ecx + xorl %edx, %esi + movl $-1, %edi + roll $10, %ebp + leal 2840853838(%ecx,%esi,1),%ecx + subl %ebp, %edi + roll $12, %ecx + addl %ebx, %ecx + /* 74 */ + movl 16(%esp), %esi + orl %edx, %edi + addl %esi, %ebx + xorl %ecx, %edi + movl $-1, %esi + roll $10, %edx + leal 2840853838(%ebx,%edi,1),%ebx + subl %edx, %esi + roll $13, %ebx + addl %eax, %ebx + /* 75 */ + movl 36(%esp), %edi + orl %ecx, %esi + addl %edi, %eax + xorl %ebx, %esi + movl $-1, %edi + roll $10, %ecx + leal 2840853838(%eax,%esi,1),%eax + subl %ecx, %edi + roll $14, %eax + addl %ebp, %eax + /* 76 */ + movl 48(%esp), %esi + orl %ebx, %edi + addl %esi, %ebp + xorl %eax, %edi + movl $-1, %esi + roll $10, %ebx + leal 2840853838(%ebp,%edi,1),%ebp + subl %ebx, %esi + roll $11, %ebp + addl %edx, %ebp + /* 77 */ + movl 28(%esp), %edi + orl %eax, %esi + addl %edi, %edx + xorl %ebp, %esi + movl $-1, %edi + roll $10, %eax + leal 2840853838(%edx,%esi,1),%edx + subl %eax, %edi + roll $8, %edx + addl %ecx, %edx + /* 78 */ + movl 64(%esp), %esi + orl %ebp, %edi + addl %esi, %ecx + xorl %edx, %edi + movl $-1, %esi + roll $10, %ebp + leal 2840853838(%ecx,%edi,1),%ecx + subl %ebp, %esi + roll $5, %ecx + addl %ebx, %ecx + /* 79 */ + movl 56(%esp), %edi + orl %edx, %esi + addl %edi, %ebx + xorl %ecx, %esi + movl 108(%esp), %edi + roll $10, %edx + leal 2840853838(%ebx,%esi,1),%ebx + movl %eax, 68(%esp) + roll $6, %ebx + addl %eax, %ebx + movl (%edi), %eax + movl %ebx, 72(%esp) + movl %ecx, 76(%esp) + movl 4(%edi), %ebx + movl %edx, 80(%esp) + movl 8(%edi), %ecx + movl %ebp, 84(%esp) + movl 12(%edi), %edx + movl 16(%edi), %ebp + /* 80 */ + movl $-1, %edi + subl %edx, %edi + movl 24(%esp), %esi + orl %ecx, %edi + addl %esi, %eax + xorl %ebx, %edi + movl $-1, %esi + roll $10, %ecx + leal 1352829926(%eax,%edi,1),%eax + subl %ecx, %esi + roll $8, %eax + addl %ebp, %eax + /* 81 */ + movl 60(%esp), %edi + orl %ebx, %esi + addl %edi, %ebp + xorl %eax, %esi + movl $-1, %edi + roll $10, %ebx + leal 1352829926(%ebp,%esi,1),%ebp + subl %ebx, %edi + roll $9, %ebp + addl %edx, %ebp + /* 82 */ + movl 32(%esp), %esi + orl %eax, %edi + addl %esi, %edx + xorl %ebp, %edi + movl $-1, %esi + roll $10, %eax + leal 1352829926(%edx,%edi,1),%edx + subl %eax, %esi + roll $9, %edx + addl %ecx, %edx + /* 83 */ + movl 4(%esp), %edi + orl %ebp, %esi + addl %edi, %ecx + xorl %edx, %esi + movl $-1, %edi + roll $10, %ebp + leal 1352829926(%ecx,%esi,1),%ecx + subl %ebp, %edi + roll $11, %ecx + addl %ebx, %ecx + /* 84 */ + movl 40(%esp), %esi + orl %edx, %edi + addl %esi, %ebx + xorl %ecx, %edi + movl $-1, %esi + roll $10, %edx + leal 1352829926(%ebx,%edi,1),%ebx + subl %edx, %esi + roll $13, %ebx + addl %eax, %ebx + /* 85 */ + movl 12(%esp), %edi + orl %ecx, %esi + addl %edi, %eax + xorl %ebx, %esi + movl $-1, %edi + roll $10, %ecx + leal 1352829926(%eax,%esi,1),%eax + subl %ecx, %edi + roll $15, %eax + addl %ebp, %eax + /* 86 */ + movl 48(%esp), %esi + orl %ebx, %edi + addl %esi, %ebp + xorl %eax, %edi + movl $-1, %esi + roll $10, %ebx + leal 1352829926(%ebp,%edi,1),%ebp + subl %ebx, %esi + roll $15, %ebp + addl %edx, %ebp + /* 87 */ + movl 20(%esp), %edi + orl %eax, %esi + addl %edi, %edx + xorl %ebp, %esi + movl $-1, %edi + roll $10, %eax + leal 1352829926(%edx,%esi,1),%edx + subl %eax, %edi + roll $5, %edx + addl %ecx, %edx + /* 88 */ + movl 56(%esp), %esi + orl %ebp, %edi + addl %esi, %ecx + xorl %edx, %edi + movl $-1, %esi + roll $10, %ebp + leal 1352829926(%ecx,%edi,1),%ecx + subl %ebp, %esi + roll $7, %ecx + addl %ebx, %ecx + /* 89 */ + movl 28(%esp), %edi + orl %edx, %esi + addl %edi, %ebx + xorl %ecx, %esi + movl $-1, %edi + roll $10, %edx + leal 1352829926(%ebx,%esi,1),%ebx + subl %edx, %edi + roll $7, %ebx + addl %eax, %ebx + /* 90 */ + movl 64(%esp), %esi + orl %ecx, %edi + addl %esi, %eax + xorl %ebx, %edi + movl $-1, %esi + roll $10, %ecx + leal 1352829926(%eax,%edi,1),%eax + subl %ecx, %esi + roll $8, %eax + addl %ebp, %eax + /* 91 */ + movl 36(%esp), %edi + orl %ebx, %esi + addl %edi, %ebp + xorl %eax, %esi + movl $-1, %edi + roll $10, %ebx + leal 1352829926(%ebp,%esi,1),%ebp + subl %ebx, %edi + roll $11, %ebp + addl %edx, %ebp + /* 92 */ + movl 8(%esp), %esi + orl %eax, %edi + addl %esi, %edx + xorl %ebp, %edi + movl $-1, %esi + roll $10, %eax + leal 1352829926(%edx,%edi,1),%edx + subl %eax, %esi + roll $14, %edx + addl %ecx, %edx + /* 93 */ + movl 44(%esp), %edi + orl %ebp, %esi + addl %edi, %ecx + xorl %edx, %esi + movl $-1, %edi + roll $10, %ebp + leal 1352829926(%ecx,%esi,1),%ecx + subl %ebp, %edi + roll $14, %ecx + addl %ebx, %ecx + /* 94 */ + movl 16(%esp), %esi + orl %edx, %edi + addl %esi, %ebx + xorl %ecx, %edi + movl $-1, %esi + roll $10, %edx + leal 1352829926(%ebx,%edi,1),%ebx + subl %edx, %esi + roll $12, %ebx + addl %eax, %ebx + /* 95 */ + movl 52(%esp), %edi + orl %ecx, %esi + addl %edi, %eax + xorl %ebx, %esi + movl $-1, %edi + roll $10, %ecx + leal 1352829926(%eax,%esi,1),%eax + movl %ecx, %esi + roll $6, %eax + addl %ebp, %eax + /* 96 */ + subl %ecx, %edi + andl %eax, %esi + andl %ebx, %edi + orl %esi, %edi + movl 28(%esp), %esi + roll $10, %ebx + leal 1548603684(%ebp,%edi,),%ebp + movl $-1, %edi + addl %esi, %ebp + movl %ebx, %esi + roll $9, %ebp + addl %edx, %ebp + /* 97 */ + subl %ebx, %edi + andl %ebp, %esi + andl %eax, %edi + orl %esi, %edi + movl 48(%esp), %esi + roll $10, %eax + leal 1548603684(%edx,%edi,),%edx + movl $-1, %edi + addl %esi, %edx + movl %eax, %esi + roll $13, %edx + addl %ecx, %edx + /* 98 */ + subl %eax, %edi + andl %edx, %esi + andl %ebp, %edi + orl %esi, %edi + movl 16(%esp), %esi + roll $10, %ebp + leal 1548603684(%ecx,%edi,),%ecx + movl $-1, %edi + addl %esi, %ecx + movl %ebp, %esi + roll $15, %ecx + addl %ebx, %ecx + /* 99 */ + subl %ebp, %edi + andl %ecx, %esi + andl %edx, %edi + orl %esi, %edi + movl 32(%esp), %esi + roll $10, %edx + leal 1548603684(%ebx,%edi,),%ebx + movl $-1, %edi + addl %esi, %ebx + movl %edx, %esi + roll $7, %ebx + addl %eax, %ebx + /* 100 */ + subl %edx, %edi + andl %ebx, %esi + andl %ecx, %edi + orl %esi, %edi + movl 4(%esp), %esi + roll $10, %ecx + leal 1548603684(%eax,%edi,),%eax + movl $-1, %edi + addl %esi, %eax + movl %ecx, %esi + roll $12, %eax + addl %ebp, %eax + /* 101 */ + subl %ecx, %edi + andl %eax, %esi + andl %ebx, %edi + orl %esi, %edi + movl 56(%esp), %esi + roll $10, %ebx + leal 1548603684(%ebp,%edi,),%ebp + movl $-1, %edi + addl %esi, %ebp + movl %ebx, %esi + roll $8, %ebp + addl %edx, %ebp + /* 102 */ + subl %ebx, %edi + andl %ebp, %esi + andl %eax, %edi + orl %esi, %edi + movl 24(%esp), %esi + roll $10, %eax + leal 1548603684(%edx,%edi,),%edx + movl $-1, %edi + addl %esi, %edx + movl %eax, %esi + roll $9, %edx + addl %ecx, %edx + /* 103 */ + subl %eax, %edi + andl %edx, %esi + andl %ebp, %edi + orl %esi, %edi + movl 44(%esp), %esi + roll $10, %ebp + leal 1548603684(%ecx,%edi,),%ecx + movl $-1, %edi + addl %esi, %ecx + movl %ebp, %esi + roll $11, %ecx + addl %ebx, %ecx + /* 104 */ + subl %ebp, %edi + andl %ecx, %esi + andl %edx, %edi + orl %esi, %edi + movl 60(%esp), %esi + roll $10, %edx + leal 1548603684(%ebx,%edi,),%ebx + movl $-1, %edi + addl %esi, %ebx + movl %edx, %esi + roll $7, %ebx + addl %eax, %ebx + /* 105 */ + subl %edx, %edi + andl %ebx, %esi + andl %ecx, %edi + orl %esi, %edi + movl 64(%esp), %esi + roll $10, %ecx + leal 1548603684(%eax,%edi,),%eax + movl $-1, %edi + addl %esi, %eax + movl %ecx, %esi + roll $7, %eax + addl %ebp, %eax + /* 106 */ + subl %ecx, %edi + andl %eax, %esi + andl %ebx, %edi + orl %esi, %edi + movl 36(%esp), %esi + roll $10, %ebx + leal 1548603684(%ebp,%edi,),%ebp + movl $-1, %edi + addl %esi, %ebp + movl %ebx, %esi + roll $12, %ebp + addl %edx, %ebp + /* 107 */ + subl %ebx, %edi + andl %ebp, %esi + andl %eax, %edi + orl %esi, %edi + movl 52(%esp), %esi + roll $10, %eax + leal 1548603684(%edx,%edi,),%edx + movl $-1, %edi + addl %esi, %edx + movl %eax, %esi + roll $7, %edx + addl %ecx, %edx + /* 108 */ + subl %eax, %edi + andl %edx, %esi + andl %ebp, %edi + orl %esi, %edi + movl 20(%esp), %esi + roll $10, %ebp + leal 1548603684(%ecx,%edi,),%ecx + movl $-1, %edi + addl %esi, %ecx + movl %ebp, %esi + roll $6, %ecx + addl %ebx, %ecx + /* 109 */ + subl %ebp, %edi + andl %ecx, %esi + andl %edx, %edi + orl %esi, %edi + movl 40(%esp), %esi + roll $10, %edx + leal 1548603684(%ebx,%edi,),%ebx + movl $-1, %edi + addl %esi, %ebx + movl %edx, %esi + roll $15, %ebx + addl %eax, %ebx + /* 110 */ + subl %edx, %edi + andl %ebx, %esi + andl %ecx, %edi + orl %esi, %edi + movl 8(%esp), %esi + roll $10, %ecx + leal 1548603684(%eax,%edi,),%eax + movl $-1, %edi + addl %esi, %eax + movl %ecx, %esi + roll $13, %eax + addl %ebp, %eax + /* 111 */ + subl %ecx, %edi + andl %eax, %esi + andl %ebx, %edi + orl %esi, %edi + movl 12(%esp), %esi + roll $10, %ebx + leal 1548603684(%ebp,%edi,),%ebp + movl $-1, %edi + addl %esi, %ebp + subl %eax, %edi + roll $11, %ebp + addl %edx, %ebp + /* 112 */ + movl 64(%esp), %esi + orl %ebp, %edi + addl %esi, %edx + xorl %ebx, %edi + movl $-1, %esi + roll $10, %eax + leal 1836072691(%edx,%edi,1),%edx + subl %ebp, %esi + roll $9, %edx + addl %ecx, %edx + /* 113 */ + movl 24(%esp), %edi + orl %edx, %esi + addl %edi, %ecx + xorl %eax, %esi + movl $-1, %edi + roll $10, %ebp + leal 1836072691(%ecx,%esi,1),%ecx + subl %edx, %edi + roll $7, %ecx + addl %ebx, %ecx + /* 114 */ + movl 8(%esp), %esi + orl %ecx, %edi + addl %esi, %ebx + xorl %ebp, %edi + movl $-1, %esi + roll $10, %edx + leal 1836072691(%ebx,%edi,1),%ebx + subl %ecx, %esi + roll $15, %ebx + addl %eax, %ebx + /* 115 */ + movl 16(%esp), %edi + orl %ebx, %esi + addl %edi, %eax + xorl %edx, %esi + movl $-1, %edi + roll $10, %ecx + leal 1836072691(%eax,%esi,1),%eax + subl %ebx, %edi + roll $11, %eax + addl %ebp, %eax + /* 116 */ + movl 32(%esp), %esi + orl %eax, %edi + addl %esi, %ebp + xorl %ecx, %edi + movl $-1, %esi + roll $10, %ebx + leal 1836072691(%ebp,%edi,1),%ebp + subl %eax, %esi + roll $8, %ebp + addl %edx, %ebp + /* 117 */ + movl 60(%esp), %edi + orl %ebp, %esi + addl %edi, %edx + xorl %ebx, %esi + movl $-1, %edi + roll $10, %eax + leal 1836072691(%edx,%esi,1),%edx + subl %ebp, %edi + roll $6, %edx + addl %ecx, %edx + /* 118 */ + movl 28(%esp), %esi + orl %edx, %edi + addl %esi, %ecx + xorl %eax, %edi + movl $-1, %esi + roll $10, %ebp + leal 1836072691(%ecx,%edi,1),%ecx + subl %edx, %esi + roll $6, %ecx + addl %ebx, %ecx + /* 119 */ + movl 40(%esp), %edi + orl %ecx, %esi + addl %edi, %ebx + xorl %ebp, %esi + movl $-1, %edi + roll $10, %edx + leal 1836072691(%ebx,%esi,1),%ebx + subl %ecx, %edi + roll $14, %ebx + addl %eax, %ebx + /* 120 */ + movl 48(%esp), %esi + orl %ebx, %edi + addl %esi, %eax + xorl %edx, %edi + movl $-1, %esi + roll $10, %ecx + leal 1836072691(%eax,%edi,1),%eax + subl %ebx, %esi + roll $12, %eax + addl %ebp, %eax + /* 121 */ + movl 36(%esp), %edi + orl %eax, %esi + addl %edi, %ebp + xorl %ecx, %esi + movl $-1, %edi + roll $10, %ebx + leal 1836072691(%ebp,%esi,1),%ebp + subl %eax, %edi + roll $13, %ebp + addl %edx, %ebp + /* 122 */ + movl 52(%esp), %esi + orl %ebp, %edi + addl %esi, %edx + xorl %ebx, %edi + movl $-1, %esi + roll $10, %eax + leal 1836072691(%edx,%edi,1),%edx + subl %ebp, %esi + roll $5, %edx + addl %ecx, %edx + /* 123 */ + movl 12(%esp), %edi + orl %edx, %esi + addl %edi, %ecx + xorl %eax, %esi + movl $-1, %edi + roll $10, %ebp + leal 1836072691(%ecx,%esi,1),%ecx + subl %edx, %edi + roll $14, %ecx + addl %ebx, %ecx + /* 124 */ + movl 44(%esp), %esi + orl %ecx, %edi + addl %esi, %ebx + xorl %ebp, %edi + movl $-1, %esi + roll $10, %edx + leal 1836072691(%ebx,%edi,1),%ebx + subl %ecx, %esi + roll $13, %ebx + addl %eax, %ebx + /* 125 */ + movl 4(%esp), %edi + orl %ebx, %esi + addl %edi, %eax + xorl %edx, %esi + movl $-1, %edi + roll $10, %ecx + leal 1836072691(%eax,%esi,1),%eax + subl %ebx, %edi + roll $13, %eax + addl %ebp, %eax + /* 126 */ + movl 20(%esp), %esi + orl %eax, %edi + addl %esi, %ebp + xorl %ecx, %edi + movl $-1, %esi + roll $10, %ebx + leal 1836072691(%ebp,%edi,1),%ebp + subl %eax, %esi + roll $7, %ebp + addl %edx, %ebp + /* 127 */ + movl 56(%esp), %edi + orl %ebp, %esi + addl %edi, %edx + xorl %ebx, %esi + movl 36(%esp), %edi + roll $10, %eax + leal 1836072691(%edx,%esi,1),%edx + movl $-1, %esi + roll $5, %edx + addl %ecx, %edx + /* 128 */ + addl %edi, %ecx + movl %ebp, %edi + subl %edx, %esi + andl %edx, %edi + andl %eax, %esi + orl %esi, %edi + movl 28(%esp), %esi + roll $10, %ebp + leal 2053994217(%ecx,%edi,1),%ecx + movl $-1, %edi + roll $15, %ecx + addl %ebx, %ecx + /* 129 */ + addl %esi, %ebx + movl %edx, %esi + subl %ecx, %edi + andl %ecx, %esi + andl %ebp, %edi + orl %edi, %esi + movl 20(%esp), %edi + roll $10, %edx + leal 2053994217(%ebx,%esi,1),%ebx + movl $-1, %esi + roll $5, %ebx + addl %eax, %ebx + /* 130 */ + addl %edi, %eax + movl %ecx, %edi + subl %ebx, %esi + andl %ebx, %edi + andl %edx, %esi + orl %esi, %edi + movl 8(%esp), %esi + roll $10, %ecx + leal 2053994217(%eax,%edi,1),%eax + movl $-1, %edi + roll $8, %eax + addl %ebp, %eax + /* 131 */ + addl %esi, %ebp + movl %ebx, %esi + subl %eax, %edi + andl %eax, %esi + andl %ecx, %edi + orl %edi, %esi + movl 16(%esp), %edi + roll $10, %ebx + leal 2053994217(%ebp,%esi,1),%ebp + movl $-1, %esi + roll $11, %ebp + addl %edx, %ebp + /* 132 */ + addl %edi, %edx + movl %eax, %edi + subl %ebp, %esi + andl %ebp, %edi + andl %ebx, %esi + orl %esi, %edi + movl 48(%esp), %esi + roll $10, %eax + leal 2053994217(%edx,%edi,1),%edx + movl $-1, %edi + roll $14, %edx + addl %ecx, %edx + /* 133 */ + addl %esi, %ecx + movl %ebp, %esi + subl %edx, %edi + andl %edx, %esi + andl %eax, %edi + orl %edi, %esi + movl 64(%esp), %edi + roll $10, %ebp + leal 2053994217(%ecx,%esi,1),%ecx + movl $-1, %esi + roll $14, %ecx + addl %ebx, %ecx + /* 134 */ + addl %edi, %ebx + movl %edx, %edi + subl %ecx, %esi + andl %ecx, %edi + andl %ebp, %esi + orl %esi, %edi + movl 4(%esp), %esi + roll $10, %edx + leal 2053994217(%ebx,%edi,1),%ebx + movl $-1, %edi + roll $6, %ebx + addl %eax, %ebx + /* 135 */ + addl %esi, %eax + movl %ecx, %esi + subl %ebx, %edi + andl %ebx, %esi + andl %edx, %edi + orl %edi, %esi + movl 24(%esp), %edi + roll $10, %ecx + leal 2053994217(%eax,%esi,1),%eax + movl $-1, %esi + roll $14, %eax + addl %ebp, %eax + /* 136 */ + addl %edi, %ebp + movl %ebx, %edi + subl %eax, %esi + andl %eax, %edi + andl %ecx, %esi + orl %esi, %edi + movl 52(%esp), %esi + roll $10, %ebx + leal 2053994217(%ebp,%edi,1),%ebp + movl $-1, %edi + roll $6, %ebp + addl %edx, %ebp + /* 137 */ + addl %esi, %edx + movl %eax, %esi + subl %ebp, %edi + andl %ebp, %esi + andl %ebx, %edi + orl %edi, %esi + movl 12(%esp), %edi + roll $10, %eax + leal 2053994217(%edx,%esi,1),%edx + movl $-1, %esi + roll $9, %edx + addl %ecx, %edx + /* 138 */ + addl %edi, %ecx + movl %ebp, %edi + subl %edx, %esi + andl %edx, %edi + andl %eax, %esi + orl %esi, %edi + movl 56(%esp), %esi + roll $10, %ebp + leal 2053994217(%ecx,%edi,1),%ecx + movl $-1, %edi + roll $12, %ecx + addl %ebx, %ecx + /* 139 */ + addl %esi, %ebx + movl %edx, %esi + subl %ecx, %edi + andl %ecx, %esi + andl %ebp, %edi + orl %edi, %esi + movl 40(%esp), %edi + roll $10, %edx + leal 2053994217(%ebx,%esi,1),%ebx + movl $-1, %esi + roll $9, %ebx + addl %eax, %ebx + /* 140 */ + addl %edi, %eax + movl %ecx, %edi + subl %ebx, %esi + andl %ebx, %edi + andl %edx, %esi + orl %esi, %edi + movl 32(%esp), %esi + roll $10, %ecx + leal 2053994217(%eax,%edi,1),%eax + movl $-1, %edi + roll $12, %eax + addl %ebp, %eax + /* 141 */ + addl %esi, %ebp + movl %ebx, %esi + subl %eax, %edi + andl %eax, %esi + andl %ecx, %edi + orl %edi, %esi + movl 44(%esp), %edi + roll $10, %ebx + leal 2053994217(%ebp,%esi,1),%ebp + movl $-1, %esi + roll $5, %ebp + addl %edx, %ebp + /* 142 */ + addl %edi, %edx + movl %eax, %edi + subl %ebp, %esi + andl %ebp, %edi + andl %ebx, %esi + orl %esi, %edi + movl 60(%esp), %esi + roll $10, %eax + leal 2053994217(%edx,%edi,1),%edx + movl $-1, %edi + roll $15, %edx + addl %ecx, %edx + /* 143 */ + addl %esi, %ecx + movl %ebp, %esi + subl %edx, %edi + andl %edx, %esi + andl %eax, %edi + orl %esi, %edi + movl %edx, %esi + roll $10, %ebp + leal 2053994217(%ecx,%edi,1),%ecx + xorl %ebp, %esi + roll $8, %ecx + addl %ebx, %ecx + /* 144 */ + movl 52(%esp), %edi + xorl %ecx, %esi + addl %edi, %ebx + roll $10, %edx + addl %esi, %ebx + movl %ecx, %esi + roll $8, %ebx + addl %eax, %ebx + /* 145 */ + xorl %edx, %esi + movl 64(%esp), %edi + xorl %ebx, %esi + addl %esi, %eax + movl %ebx, %esi + roll $10, %ecx + addl %edi, %eax + xorl %ecx, %esi + roll $5, %eax + addl %ebp, %eax + /* 146 */ + movl 44(%esp), %edi + xorl %eax, %esi + addl %edi, %ebp + roll $10, %ebx + addl %esi, %ebp + movl %eax, %esi + roll $12, %ebp + addl %edx, %ebp + /* 147 */ + xorl %ebx, %esi + movl 20(%esp), %edi + xorl %ebp, %esi + addl %esi, %edx + movl %ebp, %esi + roll $10, %eax + addl %edi, %edx + xorl %eax, %esi + roll $9, %edx + addl %ecx, %edx + /* 148 */ + movl 8(%esp), %edi + xorl %edx, %esi + addl %edi, %ecx + roll $10, %ebp + addl %esi, %ecx + movl %edx, %esi + roll $12, %ecx + addl %ebx, %ecx + /* 149 */ + xorl %ebp, %esi + movl 24(%esp), %edi + xorl %ecx, %esi + addl %esi, %ebx + movl %ecx, %esi + roll $10, %edx + addl %edi, %ebx + xorl %edx, %esi + roll $5, %ebx + addl %eax, %ebx + /* 150 */ + movl 36(%esp), %edi + xorl %ebx, %esi + addl %edi, %eax + roll $10, %ecx + addl %esi, %eax + movl %ebx, %esi + roll $14, %eax + addl %ebp, %eax + /* 151 */ + xorl %ecx, %esi + movl 32(%esp), %edi + xorl %eax, %esi + addl %esi, %ebp + movl %eax, %esi + roll $10, %ebx + addl %edi, %ebp + xorl %ebx, %esi + roll $6, %ebp + addl %edx, %ebp + /* 152 */ + movl 28(%esp), %edi + xorl %ebp, %esi + addl %edi, %edx + roll $10, %eax + addl %esi, %edx + movl %ebp, %esi + roll $8, %edx + addl %ecx, %edx + /* 153 */ + xorl %eax, %esi + movl 12(%esp), %edi + xorl %edx, %esi + addl %esi, %ecx + movl %edx, %esi + roll $10, %ebp + addl %edi, %ecx + xorl %ebp, %esi + roll $13, %ecx + addl %ebx, %ecx + /* 154 */ + movl 56(%esp), %edi + xorl %ecx, %esi + addl %edi, %ebx + roll $10, %edx + addl %esi, %ebx + movl %ecx, %esi + roll $6, %ebx + addl %eax, %ebx + /* 155 */ + xorl %edx, %esi + movl 60(%esp), %edi + xorl %ebx, %esi + addl %esi, %eax + movl %ebx, %esi + roll $10, %ecx + addl %edi, %eax + xorl %ecx, %esi + roll $5, %eax + addl %ebp, %eax + /* 156 */ + movl 4(%esp), %edi + xorl %eax, %esi + addl %edi, %ebp + roll $10, %ebx + addl %esi, %ebp + movl %eax, %esi + roll $15, %ebp + addl %edx, %ebp + /* 157 */ + xorl %ebx, %esi + movl 16(%esp), %edi + xorl %ebp, %esi + addl %esi, %edx + movl %ebp, %esi + roll $10, %eax + addl %edi, %edx + xorl %eax, %esi + roll $13, %edx + addl %ecx, %edx + /* 158 */ + movl 40(%esp), %edi + xorl %edx, %esi + addl %edi, %ecx + roll $10, %ebp + addl %esi, %ecx + movl %edx, %esi + roll $11, %ecx + addl %ebx, %ecx + /* 159 */ + xorl %ebp, %esi + movl 48(%esp), %edi + xorl %ecx, %esi + addl %esi, %ebx + roll $10, %edx + addl %edi, %ebx + movl 108(%esp), %edi + roll $11, %ebx + addl %eax, %ebx + movl 4(%edi), %esi + addl %esi, %edx + movl 76(%esp), %esi + addl %esi, %edx + movl 8(%edi), %esi + addl %esi, %ebp + movl 80(%esp), %esi + addl %esi, %ebp + movl 12(%edi), %esi + addl %esi, %eax + movl 84(%esp), %esi + addl %esi, %eax + movl 16(%edi), %esi + addl %esi, %ebx + movl 68(%esp), %esi + addl %esi, %ebx + movl (%edi), %esi + addl %esi, %ecx + movl 72(%esp), %esi + addl %esi, %ecx + movl %edx, (%edi) + movl %ebp, 4(%edi) + movl %eax, 8(%edi) + movl %ebx, 12(%edi) + movl %ecx, 16(%edi) + movl (%esp), %edi + movl 112(%esp), %esi + cmpl %esi, %edi + movl 108(%esp), %edi + jge .L000start + addl $88, %esp + popl %ebx + popl %ebp + popl %edi + popl %esi + ret +.ripemd160_block_x86_end: + SIZE(ripemd160_block_x86,.ripemd160_block_x86_end-ripemd160_block_x86) +.ident "desasm.pl" diff --git a/src/lib/libcrypto/rsa/rsa.err b/src/lib/libcrypto/rsa/rsa.err new file mode 100644 index 0000000000..5ded1b5fa2 --- /dev/null +++ b/src/lib/libcrypto/rsa/rsa.err @@ -0,0 +1,45 @@ +/* Error codes for the RSA functions. */ + +/* Function codes. */ +#define RSA_F_RSA_EAY_PRIVATE_DECRYPT 100 +#define RSA_F_RSA_EAY_PRIVATE_ENCRYPT 101 +#define RSA_F_RSA_EAY_PUBLIC_DECRYPT 102 +#define RSA_F_RSA_EAY_PUBLIC_ENCRYPT 103 +#define RSA_F_RSA_GENERATE_KEY 104 +#define RSA_F_RSA_NEW_METHOD 105 +#define RSA_F_RSA_PADDING_ADD_NONE 106 +#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 107 +#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 108 +#define RSA_F_RSA_PADDING_ADD_SSLV23 109 +#define RSA_F_RSA_PADDING_CHECK_NONE 110 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 111 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 112 +#define RSA_F_RSA_PADDING_CHECK_SSLV23 113 +#define RSA_F_RSA_PRINT 114 +#define RSA_F_RSA_PRINT_FP 115 +#define RSA_F_RSA_SIGN 116 +#define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 117 +#define RSA_F_RSA_VERIFY 118 +#define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 119 + +/* Reason codes. */ +#define RSA_R_ALGORITHM_MISMATCH 100 +#define RSA_R_BAD_E_VALUE 101 +#define RSA_R_BAD_FIXED_HEADER_DECRYPT 102 +#define RSA_R_BAD_PAD_BYTE_COUNT 103 +#define RSA_R_BAD_SIGNATURE 104 +#define RSA_R_BAD_ZERO_BYTE 105 +#define RSA_R_BLOCK_TYPE_IS_NOT_01 106 +#define RSA_R_BLOCK_TYPE_IS_NOT_02 107 +#define RSA_R_DATA_GREATER_THAN_MOD_LEN 108 +#define RSA_R_DATA_TOO_LARGE 109 +#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110 +#define RSA_R_DATA_TOO_SMALL 111 +#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112 +#define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 +#define RSA_R_PADDING_CHECK_FAILED 114 +#define RSA_R_SSLV3_ROLLBACK_ATTACK 115 +#define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 +#define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 +#define RSA_R_UNKNOWN_PADDING_TYPE 118 +#define RSA_R_WRONG_SIGNATURE_LENGTH 119 diff --git a/src/lib/libcrypto/sha/Makefile.uni b/src/lib/libcrypto/sha/Makefile.uni new file mode 100644 index 0000000000..f3236755b2 --- /dev/null +++ b/src/lib/libcrypto/sha/Makefile.uni @@ -0,0 +1,122 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +DIR= sha +TOP= . +CC= gcc +CFLAG= -O3 -fomit-frame-pointer + +CPP= $(CC) -E +INCLUDES= +INSTALLTOP=/usr/local/lib +MAKE= make +MAKEDEPEND= makedepend +MAKEFILE= Makefile.uni +AR= ar r + +SHA_ASM_OBJ= + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile + +TEST1=shatest +TEST2=sha1test +APP1=sha +APP2=sha1 + +TEST=$(TEST1) $(TEST2) +APPS=$(APP1) $(APP2) + +LIB=libsha.a +LIBSRC=sha_dgst.c sha1dgst.c sha_one.c sha1_one.c +LIBOBJ=sha_dgst.o sha1dgst.o sha_one.o sha1_one.o $(SHA_ASM_OBJ) + +SRC= $(LIBSRC) + +EXHEADER= sha.h +HEADER= sha_locl.h $(EXHEADER) + +ALL= $(GENERAL) $(SRC) $(HEADER) + +all: $(LIB) $(TEST) $(APPS) + +$(LIB): $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) + sh $(TOP)/ranlib.sh $(LIB) + +# elf +asm/sx86-elf.o: asm/sx86unix.cpp + $(CPP) -DELF asm/sx86unix.cpp | as -o asm/sx86-elf.o + +# solaris +asm/sx86-sol.o: asm/sx86unix.cpp + $(CC) -E -DSOL asm/sx86unix.cpp | sed 's/^#.*//' > asm/sx86-sol.s + as -o asm/sx86-sol.o asm/sx86-sol.s + rm -f asm/sx86-sol.s + +# a.out +asm/sx86-out.o: asm/sx86unix.cpp + $(CPP) -DOUT asm/sx86unix.cpp | as -o asm/sx86-out.o + +# bsdi +asm/sx86bsdi.o: asm/sx86unix.cpp + $(CPP) -DBSDI asm/sx86unix.cpp | as -o asm/sx86bsdi.o + +asm/sx86unix.cpp: + (cd asm; perl sha1-586.pl cpp >sx86unix.cpp) + +test: $(TEST) + ./$(TEST1) + ./$(TEST2) + +$(TEST1): $(TEST1).c $(LIB) + $(CC) -o $(TEST1) $(CFLAGS) $(TEST1).c $(LIB) + +$(TEST2): $(TEST2).c $(LIB) + $(CC) -o $(TEST2) $(CFLAGS) $(TEST2).c $(LIB) + +$(APP1): $(APP1).c $(LIB) + $(CC) -o $(APP1) $(CFLAGS) $(APP1).c $(LIB) + +$(APP2): $(APP2).c $(LIB) + $(CC) -o $(APP2) $(CFLAGS) $(APP2).c $(LIB) + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + +dclean: + perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff + +cc: + $(MAKE) SHA_ASM_OBJ="" CC="cc" CFLAG="-O" all + +gcc: + $(MAKE) SHA_ASM_OBJ="" CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all + +x86-elf: + $(MAKE) SHA_ASM_OBJ="asm/sx86-elf.o" CFLAG="-DELF -DSHA1_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-out: + $(MAKE) SHA_ASM_OBJ="asm/sx86-out.o" CFLAG="-DOUT -DSHA1_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-solaris: + $(MAKE) SHA_ASM_OBJ="asm/sx86-sol.o" CFLAG="-DSOL -DSHA1_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-bdsi: + $(MAKE) SHA_ASM_OBJ="asm/sx86-bdsi.o" CFLAG="-DBDSI -DSHA1_ASM -DL_ENDIAN $(CFLAGS)" all + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/sha/asm/s1-win32.asm b/src/lib/libcrypto/sha/asm/s1-win32.asm new file mode 100644 index 0000000000..61335666b9 --- /dev/null +++ b/src/lib/libcrypto/sha/asm/s1-win32.asm @@ -0,0 +1,1664 @@ + ; Don't even think of reading this code + ; It was automatically generated by sha1-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE sha1-586.asm + .486 +.model FLAT +_TEXT SEGMENT +PUBLIC _sha1_block_x86 + +_sha1_block_x86 PROC NEAR + push esi + push ebp + mov eax, DWORD PTR 20[esp] + mov esi, DWORD PTR 16[esp] + add eax, esi + mov ebp, DWORD PTR 12[esp] + push ebx + sub eax, 64 + push edi + mov ebx, DWORD PTR 4[ebp] + sub esp, 72 + mov edx, DWORD PTR 12[ebp] + mov edi, DWORD PTR 16[ebp] + mov ecx, DWORD PTR 8[ebp] + mov DWORD PTR 68[esp],eax + ; First we need to setup the X array + mov eax, DWORD PTR [esi] +L000start: + ; First, load the words onto the stack in network byte order + bswap eax + mov DWORD PTR [esp],eax + mov eax, DWORD PTR 4[esi] + bswap eax + mov DWORD PTR 4[esp],eax + mov eax, DWORD PTR 8[esi] + bswap eax + mov DWORD PTR 8[esp],eax + mov eax, DWORD PTR 12[esi] + bswap eax + mov DWORD PTR 12[esp],eax + mov eax, DWORD PTR 16[esi] + bswap eax + mov DWORD PTR 16[esp],eax + mov eax, DWORD PTR 20[esi] + bswap eax + mov DWORD PTR 20[esp],eax + mov eax, DWORD PTR 24[esi] + bswap eax + mov DWORD PTR 24[esp],eax + mov eax, DWORD PTR 28[esi] + bswap eax + mov DWORD PTR 28[esp],eax + mov eax, DWORD PTR 32[esi] + bswap eax + mov DWORD PTR 32[esp],eax + mov eax, DWORD PTR 36[esi] + bswap eax + mov DWORD PTR 36[esp],eax + mov eax, DWORD PTR 40[esi] + bswap eax + mov DWORD PTR 40[esp],eax + mov eax, DWORD PTR 44[esi] + bswap eax + mov DWORD PTR 44[esp],eax + mov eax, DWORD PTR 48[esi] + bswap eax + mov DWORD PTR 48[esp],eax + mov eax, DWORD PTR 52[esi] + bswap eax + mov DWORD PTR 52[esp],eax + mov eax, DWORD PTR 56[esi] + bswap eax + mov DWORD PTR 56[esp],eax + mov eax, DWORD PTR 60[esi] + bswap eax + mov DWORD PTR 60[esp],eax + ; We now have the X array on the stack + ; starting at sp-4 + mov DWORD PTR 64[esp],esi + ; + ; Start processing + mov eax, DWORD PTR [ebp] + ; 00_15 0 + mov esi, ecx + mov ebp, eax + xor esi, edx + rol ebp, 5 + and esi, ebx + add ebp, edi + ror ebx, 1 + mov edi, DWORD PTR [esp] + ror ebx, 1 + xor esi, edx + lea ebp, DWORD PTR 1518500249[edi*1+ebp] + mov edi, ebx + add esi, ebp + xor edi, ecx + mov ebp, esi + and edi, eax + rol ebp, 5 + add ebp, edx + mov edx, DWORD PTR 4[esp] + ror eax, 1 + xor edi, ecx + ror eax, 1 + lea ebp, DWORD PTR 1518500249[edx*1+ebp] + add edi, ebp + ; 00_15 2 + mov edx, eax + mov ebp, edi + xor edx, ebx + rol ebp, 5 + and edx, esi + add ebp, ecx + ror esi, 1 + mov ecx, DWORD PTR 8[esp] + ror esi, 1 + xor edx, ebx + lea ebp, DWORD PTR 1518500249[ecx*1+ebp] + mov ecx, esi + add edx, ebp + xor ecx, eax + mov ebp, edx + and ecx, edi + rol ebp, 5 + add ebp, ebx + mov ebx, DWORD PTR 12[esp] + ror edi, 1 + xor ecx, eax + ror edi, 1 + lea ebp, DWORD PTR 1518500249[ebx*1+ebp] + add ecx, ebp + ; 00_15 4 + mov ebx, edi + mov ebp, ecx + xor ebx, esi + rol ebp, 5 + and ebx, edx + add ebp, eax + ror edx, 1 + mov eax, DWORD PTR 16[esp] + ror edx, 1 + xor ebx, esi + lea ebp, DWORD PTR 1518500249[eax*1+ebp] + mov eax, edx + add ebx, ebp + xor eax, edi + mov ebp, ebx + and eax, ecx + rol ebp, 5 + add ebp, esi + mov esi, DWORD PTR 20[esp] + ror ecx, 1 + xor eax, edi + ror ecx, 1 + lea ebp, DWORD PTR 1518500249[esi*1+ebp] + add eax, ebp + ; 00_15 6 + mov esi, ecx + mov ebp, eax + xor esi, edx + rol ebp, 5 + and esi, ebx + add ebp, edi + ror ebx, 1 + mov edi, DWORD PTR 24[esp] + ror ebx, 1 + xor esi, edx + lea ebp, DWORD PTR 1518500249[edi*1+ebp] + mov edi, ebx + add esi, ebp + xor edi, ecx + mov ebp, esi + and edi, eax + rol ebp, 5 + add ebp, edx + mov edx, DWORD PTR 28[esp] + ror eax, 1 + xor edi, ecx + ror eax, 1 + lea ebp, DWORD PTR 1518500249[edx*1+ebp] + add edi, ebp + ; 00_15 8 + mov edx, eax + mov ebp, edi + xor edx, ebx + rol ebp, 5 + and edx, esi + add ebp, ecx + ror esi, 1 + mov ecx, DWORD PTR 32[esp] + ror esi, 1 + xor edx, ebx + lea ebp, DWORD PTR 1518500249[ecx*1+ebp] + mov ecx, esi + add edx, ebp + xor ecx, eax + mov ebp, edx + and ecx, edi + rol ebp, 5 + add ebp, ebx + mov ebx, DWORD PTR 36[esp] + ror edi, 1 + xor ecx, eax + ror edi, 1 + lea ebp, DWORD PTR 1518500249[ebx*1+ebp] + add ecx, ebp + ; 00_15 10 + mov ebx, edi + mov ebp, ecx + xor ebx, esi + rol ebp, 5 + and ebx, edx + add ebp, eax + ror edx, 1 + mov eax, DWORD PTR 40[esp] + ror edx, 1 + xor ebx, esi + lea ebp, DWORD PTR 1518500249[eax*1+ebp] + mov eax, edx + add ebx, ebp + xor eax, edi + mov ebp, ebx + and eax, ecx + rol ebp, 5 + add ebp, esi + mov esi, DWORD PTR 44[esp] + ror ecx, 1 + xor eax, edi + ror ecx, 1 + lea ebp, DWORD PTR 1518500249[esi*1+ebp] + add eax, ebp + ; 00_15 12 + mov esi, ecx + mov ebp, eax + xor esi, edx + rol ebp, 5 + and esi, ebx + add ebp, edi + ror ebx, 1 + mov edi, DWORD PTR 48[esp] + ror ebx, 1 + xor esi, edx + lea ebp, DWORD PTR 1518500249[edi*1+ebp] + mov edi, ebx + add esi, ebp + xor edi, ecx + mov ebp, esi + and edi, eax + rol ebp, 5 + add ebp, edx + mov edx, DWORD PTR 52[esp] + ror eax, 1 + xor edi, ecx + ror eax, 1 + lea ebp, DWORD PTR 1518500249[edx*1+ebp] + add edi, ebp + ; 00_15 14 + mov edx, eax + mov ebp, edi + xor edx, ebx + rol ebp, 5 + and edx, esi + add ebp, ecx + ror esi, 1 + mov ecx, DWORD PTR 56[esp] + ror esi, 1 + xor edx, ebx + lea ebp, DWORD PTR 1518500249[ecx*1+ebp] + mov ecx, esi + add edx, ebp + xor ecx, eax + mov ebp, edx + and ecx, edi + rol ebp, 5 + add ebp, ebx + mov ebx, DWORD PTR 60[esp] + ror edi, 1 + xor ecx, eax + ror edi, 1 + lea ebp, DWORD PTR 1518500249[ebx*1+ebp] + add ecx, ebp + ; 16_19 16 + nop + mov ebp, DWORD PTR [esp] + mov ebx, DWORD PTR 8[esp] + xor ebx, ebp + mov ebp, DWORD PTR 32[esp] + xor ebx, ebp + mov ebp, DWORD PTR 52[esp] + xor ebx, ebp + mov ebp, edi + rol ebx, 1 + xor ebp, esi + mov DWORD PTR [esp],ebx + and ebp, edx + lea ebx, DWORD PTR 1518500249[eax*1+ebx] + xor ebp, esi + mov eax, ecx + add ebx, ebp + rol eax, 5 + ror edx, 1 + add ebx, eax + mov eax, DWORD PTR 4[esp] + mov ebp, DWORD PTR 12[esp] + xor eax, ebp + mov ebp, DWORD PTR 36[esp] + xor eax, ebp + mov ebp, DWORD PTR 56[esp] + ror edx, 1 + xor eax, ebp + rol eax, 1 + mov ebp, edx + xor ebp, edi + mov DWORD PTR 4[esp],eax + and ebp, ecx + lea eax, DWORD PTR 1518500249[esi*1+eax] + xor ebp, edi + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add eax, esi + ror ecx, 1 + add eax, ebp + ; 16_19 18 + mov ebp, DWORD PTR 8[esp] + mov esi, DWORD PTR 16[esp] + xor esi, ebp + mov ebp, DWORD PTR 40[esp] + xor esi, ebp + mov ebp, DWORD PTR 60[esp] + xor esi, ebp + mov ebp, ecx + rol esi, 1 + xor ebp, edx + mov DWORD PTR 8[esp],esi + and ebp, ebx + lea esi, DWORD PTR 1518500249[edi*1+esi] + xor ebp, edx + mov edi, eax + add esi, ebp + rol edi, 5 + ror ebx, 1 + add esi, edi + mov edi, DWORD PTR 12[esp] + mov ebp, DWORD PTR 20[esp] + xor edi, ebp + mov ebp, DWORD PTR 44[esp] + xor edi, ebp + mov ebp, DWORD PTR [esp] + ror ebx, 1 + xor edi, ebp + rol edi, 1 + mov ebp, ebx + xor ebp, ecx + mov DWORD PTR 12[esp],edi + and ebp, eax + lea edi, DWORD PTR 1518500249[edx*1+edi] + xor ebp, ecx + mov edx, esi + rol edx, 5 + ror eax, 1 + add edi, edx + ror eax, 1 + add edi, ebp + ; 20_39 20 + mov edx, DWORD PTR 16[esp] + mov ebp, DWORD PTR 24[esp] + xor edx, ebp + mov ebp, DWORD PTR 48[esp] + xor edx, ebp + mov ebp, DWORD PTR 4[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + xor ebp, eax + mov DWORD PTR 16[esp],edx + xor ebp, ebx + lea edx, DWORD PTR 1859775393[ecx*1+edx] + mov ecx, edi + rol ecx, 5 + ror esi, 1 + add ecx, ebp + ror esi, 1 + add edx, ecx + ; 20_39 21 + mov ecx, DWORD PTR 20[esp] + mov ebp, DWORD PTR 28[esp] + xor ecx, ebp + mov ebp, DWORD PTR 52[esp] + xor ecx, ebp + mov ebp, DWORD PTR 8[esp] + xor ecx, ebp + mov ebp, edi + rol ecx, 1 + xor ebp, esi + mov DWORD PTR 20[esp],ecx + xor ebp, eax + lea ecx, DWORD PTR 1859775393[ebx*1+ecx] + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebx, ebp + ror edi, 1 + add ecx, ebx + ; 20_39 22 + mov ebx, DWORD PTR 24[esp] + mov ebp, DWORD PTR 32[esp] + xor ebx, ebp + mov ebp, DWORD PTR 56[esp] + xor ebx, ebp + mov ebp, DWORD PTR 12[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + xor ebp, edi + mov DWORD PTR 24[esp],ebx + xor ebp, esi + lea ebx, DWORD PTR 1859775393[eax*1+ebx] + mov eax, ecx + rol eax, 5 + ror edx, 1 + add eax, ebp + ror edx, 1 + add ebx, eax + ; 20_39 23 + mov eax, DWORD PTR 28[esp] + mov ebp, DWORD PTR 36[esp] + xor eax, ebp + mov ebp, DWORD PTR 60[esp] + xor eax, ebp + mov ebp, DWORD PTR 16[esp] + xor eax, ebp + mov ebp, ecx + rol eax, 1 + xor ebp, edx + mov DWORD PTR 28[esp],eax + xor ebp, edi + lea eax, DWORD PTR 1859775393[esi*1+eax] + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add esi, ebp + ror ecx, 1 + add eax, esi + ; 20_39 24 + mov esi, DWORD PTR 32[esp] + mov ebp, DWORD PTR 40[esp] + xor esi, ebp + mov ebp, DWORD PTR [esp] + xor esi, ebp + mov ebp, DWORD PTR 20[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + xor ebp, ecx + mov DWORD PTR 32[esp],esi + xor ebp, edx + lea esi, DWORD PTR 1859775393[edi*1+esi] + mov edi, eax + rol edi, 5 + ror ebx, 1 + add edi, ebp + ror ebx, 1 + add esi, edi + ; 20_39 25 + mov edi, DWORD PTR 36[esp] + mov ebp, DWORD PTR 44[esp] + xor edi, ebp + mov ebp, DWORD PTR 4[esp] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + xor edi, ebp + mov ebp, eax + rol edi, 1 + xor ebp, ebx + mov DWORD PTR 36[esp],edi + xor ebp, ecx + lea edi, DWORD PTR 1859775393[edx*1+edi] + mov edx, esi + rol edx, 5 + ror eax, 1 + add edx, ebp + ror eax, 1 + add edi, edx + ; 20_39 26 + mov edx, DWORD PTR 40[esp] + mov ebp, DWORD PTR 48[esp] + xor edx, ebp + mov ebp, DWORD PTR 8[esp] + xor edx, ebp + mov ebp, DWORD PTR 28[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + xor ebp, eax + mov DWORD PTR 40[esp],edx + xor ebp, ebx + lea edx, DWORD PTR 1859775393[ecx*1+edx] + mov ecx, edi + rol ecx, 5 + ror esi, 1 + add ecx, ebp + ror esi, 1 + add edx, ecx + ; 20_39 27 + mov ecx, DWORD PTR 44[esp] + mov ebp, DWORD PTR 52[esp] + xor ecx, ebp + mov ebp, DWORD PTR 12[esp] + xor ecx, ebp + mov ebp, DWORD PTR 32[esp] + xor ecx, ebp + mov ebp, edi + rol ecx, 1 + xor ebp, esi + mov DWORD PTR 44[esp],ecx + xor ebp, eax + lea ecx, DWORD PTR 1859775393[ebx*1+ecx] + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebx, ebp + ror edi, 1 + add ecx, ebx + ; 20_39 28 + mov ebx, DWORD PTR 48[esp] + mov ebp, DWORD PTR 56[esp] + xor ebx, ebp + mov ebp, DWORD PTR 16[esp] + xor ebx, ebp + mov ebp, DWORD PTR 36[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + xor ebp, edi + mov DWORD PTR 48[esp],ebx + xor ebp, esi + lea ebx, DWORD PTR 1859775393[eax*1+ebx] + mov eax, ecx + rol eax, 5 + ror edx, 1 + add eax, ebp + ror edx, 1 + add ebx, eax + ; 20_39 29 + mov eax, DWORD PTR 52[esp] + mov ebp, DWORD PTR 60[esp] + xor eax, ebp + mov ebp, DWORD PTR 20[esp] + xor eax, ebp + mov ebp, DWORD PTR 40[esp] + xor eax, ebp + mov ebp, ecx + rol eax, 1 + xor ebp, edx + mov DWORD PTR 52[esp],eax + xor ebp, edi + lea eax, DWORD PTR 1859775393[esi*1+eax] + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add esi, ebp + ror ecx, 1 + add eax, esi + ; 20_39 30 + mov esi, DWORD PTR 56[esp] + mov ebp, DWORD PTR [esp] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + xor esi, ebp + mov ebp, DWORD PTR 44[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + xor ebp, ecx + mov DWORD PTR 56[esp],esi + xor ebp, edx + lea esi, DWORD PTR 1859775393[edi*1+esi] + mov edi, eax + rol edi, 5 + ror ebx, 1 + add edi, ebp + ror ebx, 1 + add esi, edi + ; 20_39 31 + mov edi, DWORD PTR 60[esp] + mov ebp, DWORD PTR 4[esp] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + xor edi, ebp + mov ebp, DWORD PTR 48[esp] + xor edi, ebp + mov ebp, eax + rol edi, 1 + xor ebp, ebx + mov DWORD PTR 60[esp],edi + xor ebp, ecx + lea edi, DWORD PTR 1859775393[edx*1+edi] + mov edx, esi + rol edx, 5 + ror eax, 1 + add edx, ebp + ror eax, 1 + add edi, edx + ; 20_39 32 + mov edx, DWORD PTR [esp] + mov ebp, DWORD PTR 8[esp] + xor edx, ebp + mov ebp, DWORD PTR 32[esp] + xor edx, ebp + mov ebp, DWORD PTR 52[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + xor ebp, eax + mov DWORD PTR [esp],edx + xor ebp, ebx + lea edx, DWORD PTR 1859775393[ecx*1+edx] + mov ecx, edi + rol ecx, 5 + ror esi, 1 + add ecx, ebp + ror esi, 1 + add edx, ecx + ; 20_39 33 + mov ecx, DWORD PTR 4[esp] + mov ebp, DWORD PTR 12[esp] + xor ecx, ebp + mov ebp, DWORD PTR 36[esp] + xor ecx, ebp + mov ebp, DWORD PTR 56[esp] + xor ecx, ebp + mov ebp, edi + rol ecx, 1 + xor ebp, esi + mov DWORD PTR 4[esp],ecx + xor ebp, eax + lea ecx, DWORD PTR 1859775393[ebx*1+ecx] + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebx, ebp + ror edi, 1 + add ecx, ebx + ; 20_39 34 + mov ebx, DWORD PTR 8[esp] + mov ebp, DWORD PTR 16[esp] + xor ebx, ebp + mov ebp, DWORD PTR 40[esp] + xor ebx, ebp + mov ebp, DWORD PTR 60[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + xor ebp, edi + mov DWORD PTR 8[esp],ebx + xor ebp, esi + lea ebx, DWORD PTR 1859775393[eax*1+ebx] + mov eax, ecx + rol eax, 5 + ror edx, 1 + add eax, ebp + ror edx, 1 + add ebx, eax + ; 20_39 35 + mov eax, DWORD PTR 12[esp] + mov ebp, DWORD PTR 20[esp] + xor eax, ebp + mov ebp, DWORD PTR 44[esp] + xor eax, ebp + mov ebp, DWORD PTR [esp] + xor eax, ebp + mov ebp, ecx + rol eax, 1 + xor ebp, edx + mov DWORD PTR 12[esp],eax + xor ebp, edi + lea eax, DWORD PTR 1859775393[esi*1+eax] + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add esi, ebp + ror ecx, 1 + add eax, esi + ; 20_39 36 + mov esi, DWORD PTR 16[esp] + mov ebp, DWORD PTR 24[esp] + xor esi, ebp + mov ebp, DWORD PTR 48[esp] + xor esi, ebp + mov ebp, DWORD PTR 4[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + xor ebp, ecx + mov DWORD PTR 16[esp],esi + xor ebp, edx + lea esi, DWORD PTR 1859775393[edi*1+esi] + mov edi, eax + rol edi, 5 + ror ebx, 1 + add edi, ebp + ror ebx, 1 + add esi, edi + ; 20_39 37 + mov edi, DWORD PTR 20[esp] + mov ebp, DWORD PTR 28[esp] + xor edi, ebp + mov ebp, DWORD PTR 52[esp] + xor edi, ebp + mov ebp, DWORD PTR 8[esp] + xor edi, ebp + mov ebp, eax + rol edi, 1 + xor ebp, ebx + mov DWORD PTR 20[esp],edi + xor ebp, ecx + lea edi, DWORD PTR 1859775393[edx*1+edi] + mov edx, esi + rol edx, 5 + ror eax, 1 + add edx, ebp + ror eax, 1 + add edi, edx + ; 20_39 38 + mov edx, DWORD PTR 24[esp] + mov ebp, DWORD PTR 32[esp] + xor edx, ebp + mov ebp, DWORD PTR 56[esp] + xor edx, ebp + mov ebp, DWORD PTR 12[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + xor ebp, eax + mov DWORD PTR 24[esp],edx + xor ebp, ebx + lea edx, DWORD PTR 1859775393[ecx*1+edx] + mov ecx, edi + rol ecx, 5 + ror esi, 1 + add ecx, ebp + ror esi, 1 + add edx, ecx + ; 20_39 39 + mov ecx, DWORD PTR 28[esp] + mov ebp, DWORD PTR 36[esp] + xor ecx, ebp + mov ebp, DWORD PTR 60[esp] + xor ecx, ebp + mov ebp, DWORD PTR 16[esp] + xor ecx, ebp + mov ebp, edi + rol ecx, 1 + xor ebp, esi + mov DWORD PTR 28[esp],ecx + xor ebp, eax + lea ecx, DWORD PTR 1859775393[ebx*1+ecx] + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebx, ebp + ror edi, 1 + add ecx, ebx + ; 40_59 40 + mov ebx, DWORD PTR 32[esp] + mov ebp, DWORD PTR 40[esp] + xor ebx, ebp + mov ebp, DWORD PTR [esp] + xor ebx, ebp + mov ebp, DWORD PTR 20[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + or ebp, edi + mov DWORD PTR 32[esp],ebx + and ebp, esi + lea ebx, DWORD PTR 2400959708[eax*1+ebx] + mov eax, edx + ror edx, 1 + and eax, edi + or ebp, eax + mov eax, ecx + rol eax, 5 + add ebp, eax + mov eax, DWORD PTR 36[esp] + add ebx, ebp + mov ebp, DWORD PTR 44[esp] + xor eax, ebp + mov ebp, DWORD PTR 4[esp] + xor eax, ebp + mov ebp, DWORD PTR 24[esp] + ror edx, 1 + xor eax, ebp + rol eax, 1 + mov ebp, ecx + mov DWORD PTR 36[esp],eax + or ebp, edx + lea eax, DWORD PTR 2400959708[esi*1+eax] + mov esi, ecx + and ebp, edi + and esi, edx + or ebp, esi + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add ebp, esi + ror ecx, 1 + add eax, ebp + ; 40_59 41 + ; 40_59 42 + mov esi, DWORD PTR 40[esp] + mov ebp, DWORD PTR 48[esp] + xor esi, ebp + mov ebp, DWORD PTR 8[esp] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + or ebp, ecx + mov DWORD PTR 40[esp],esi + and ebp, edx + lea esi, DWORD PTR 2400959708[edi*1+esi] + mov edi, ebx + ror ebx, 1 + and edi, ecx + or ebp, edi + mov edi, eax + rol edi, 5 + add ebp, edi + mov edi, DWORD PTR 44[esp] + add esi, ebp + mov ebp, DWORD PTR 52[esp] + xor edi, ebp + mov ebp, DWORD PTR 12[esp] + xor edi, ebp + mov ebp, DWORD PTR 32[esp] + ror ebx, 1 + xor edi, ebp + rol edi, 1 + mov ebp, eax + mov DWORD PTR 44[esp],edi + or ebp, ebx + lea edi, DWORD PTR 2400959708[edx*1+edi] + mov edx, eax + and ebp, ecx + and edx, ebx + or ebp, edx + mov edx, esi + rol edx, 5 + ror eax, 1 + add ebp, edx + ror eax, 1 + add edi, ebp + ; 40_59 43 + ; 40_59 44 + mov edx, DWORD PTR 48[esp] + mov ebp, DWORD PTR 56[esp] + xor edx, ebp + mov ebp, DWORD PTR 16[esp] + xor edx, ebp + mov ebp, DWORD PTR 36[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + or ebp, eax + mov DWORD PTR 48[esp],edx + and ebp, ebx + lea edx, DWORD PTR 2400959708[ecx*1+edx] + mov ecx, esi + ror esi, 1 + and ecx, eax + or ebp, ecx + mov ecx, edi + rol ecx, 5 + add ebp, ecx + mov ecx, DWORD PTR 52[esp] + add edx, ebp + mov ebp, DWORD PTR 60[esp] + xor ecx, ebp + mov ebp, DWORD PTR 20[esp] + xor ecx, ebp + mov ebp, DWORD PTR 40[esp] + ror esi, 1 + xor ecx, ebp + rol ecx, 1 + mov ebp, edi + mov DWORD PTR 52[esp],ecx + or ebp, esi + lea ecx, DWORD PTR 2400959708[ebx*1+ecx] + mov ebx, edi + and ebp, eax + and ebx, esi + or ebp, ebx + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebp, ebx + ror edi, 1 + add ecx, ebp + ; 40_59 45 + ; 40_59 46 + mov ebx, DWORD PTR 56[esp] + mov ebp, DWORD PTR [esp] + xor ebx, ebp + mov ebp, DWORD PTR 24[esp] + xor ebx, ebp + mov ebp, DWORD PTR 44[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + or ebp, edi + mov DWORD PTR 56[esp],ebx + and ebp, esi + lea ebx, DWORD PTR 2400959708[eax*1+ebx] + mov eax, edx + ror edx, 1 + and eax, edi + or ebp, eax + mov eax, ecx + rol eax, 5 + add ebp, eax + mov eax, DWORD PTR 60[esp] + add ebx, ebp + mov ebp, DWORD PTR 4[esp] + xor eax, ebp + mov ebp, DWORD PTR 28[esp] + xor eax, ebp + mov ebp, DWORD PTR 48[esp] + ror edx, 1 + xor eax, ebp + rol eax, 1 + mov ebp, ecx + mov DWORD PTR 60[esp],eax + or ebp, edx + lea eax, DWORD PTR 2400959708[esi*1+eax] + mov esi, ecx + and ebp, edi + and esi, edx + or ebp, esi + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add ebp, esi + ror ecx, 1 + add eax, ebp + ; 40_59 47 + ; 40_59 48 + mov esi, DWORD PTR [esp] + mov ebp, DWORD PTR 8[esp] + xor esi, ebp + mov ebp, DWORD PTR 32[esp] + xor esi, ebp + mov ebp, DWORD PTR 52[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + or ebp, ecx + mov DWORD PTR [esp],esi + and ebp, edx + lea esi, DWORD PTR 2400959708[edi*1+esi] + mov edi, ebx + ror ebx, 1 + and edi, ecx + or ebp, edi + mov edi, eax + rol edi, 5 + add ebp, edi + mov edi, DWORD PTR 4[esp] + add esi, ebp + mov ebp, DWORD PTR 12[esp] + xor edi, ebp + mov ebp, DWORD PTR 36[esp] + xor edi, ebp + mov ebp, DWORD PTR 56[esp] + ror ebx, 1 + xor edi, ebp + rol edi, 1 + mov ebp, eax + mov DWORD PTR 4[esp],edi + or ebp, ebx + lea edi, DWORD PTR 2400959708[edx*1+edi] + mov edx, eax + and ebp, ecx + and edx, ebx + or ebp, edx + mov edx, esi + rol edx, 5 + ror eax, 1 + add ebp, edx + ror eax, 1 + add edi, ebp + ; 40_59 49 + ; 40_59 50 + mov edx, DWORD PTR 8[esp] + mov ebp, DWORD PTR 16[esp] + xor edx, ebp + mov ebp, DWORD PTR 40[esp] + xor edx, ebp + mov ebp, DWORD PTR 60[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + or ebp, eax + mov DWORD PTR 8[esp],edx + and ebp, ebx + lea edx, DWORD PTR 2400959708[ecx*1+edx] + mov ecx, esi + ror esi, 1 + and ecx, eax + or ebp, ecx + mov ecx, edi + rol ecx, 5 + add ebp, ecx + mov ecx, DWORD PTR 12[esp] + add edx, ebp + mov ebp, DWORD PTR 20[esp] + xor ecx, ebp + mov ebp, DWORD PTR 44[esp] + xor ecx, ebp + mov ebp, DWORD PTR [esp] + ror esi, 1 + xor ecx, ebp + rol ecx, 1 + mov ebp, edi + mov DWORD PTR 12[esp],ecx + or ebp, esi + lea ecx, DWORD PTR 2400959708[ebx*1+ecx] + mov ebx, edi + and ebp, eax + and ebx, esi + or ebp, ebx + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebp, ebx + ror edi, 1 + add ecx, ebp + ; 40_59 51 + ; 40_59 52 + mov ebx, DWORD PTR 16[esp] + mov ebp, DWORD PTR 24[esp] + xor ebx, ebp + mov ebp, DWORD PTR 48[esp] + xor ebx, ebp + mov ebp, DWORD PTR 4[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + or ebp, edi + mov DWORD PTR 16[esp],ebx + and ebp, esi + lea ebx, DWORD PTR 2400959708[eax*1+ebx] + mov eax, edx + ror edx, 1 + and eax, edi + or ebp, eax + mov eax, ecx + rol eax, 5 + add ebp, eax + mov eax, DWORD PTR 20[esp] + add ebx, ebp + mov ebp, DWORD PTR 28[esp] + xor eax, ebp + mov ebp, DWORD PTR 52[esp] + xor eax, ebp + mov ebp, DWORD PTR 8[esp] + ror edx, 1 + xor eax, ebp + rol eax, 1 + mov ebp, ecx + mov DWORD PTR 20[esp],eax + or ebp, edx + lea eax, DWORD PTR 2400959708[esi*1+eax] + mov esi, ecx + and ebp, edi + and esi, edx + or ebp, esi + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add ebp, esi + ror ecx, 1 + add eax, ebp + ; 40_59 53 + ; 40_59 54 + mov esi, DWORD PTR 24[esp] + mov ebp, DWORD PTR 32[esp] + xor esi, ebp + mov ebp, DWORD PTR 56[esp] + xor esi, ebp + mov ebp, DWORD PTR 12[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + or ebp, ecx + mov DWORD PTR 24[esp],esi + and ebp, edx + lea esi, DWORD PTR 2400959708[edi*1+esi] + mov edi, ebx + ror ebx, 1 + and edi, ecx + or ebp, edi + mov edi, eax + rol edi, 5 + add ebp, edi + mov edi, DWORD PTR 28[esp] + add esi, ebp + mov ebp, DWORD PTR 36[esp] + xor edi, ebp + mov ebp, DWORD PTR 60[esp] + xor edi, ebp + mov ebp, DWORD PTR 16[esp] + ror ebx, 1 + xor edi, ebp + rol edi, 1 + mov ebp, eax + mov DWORD PTR 28[esp],edi + or ebp, ebx + lea edi, DWORD PTR 2400959708[edx*1+edi] + mov edx, eax + and ebp, ecx + and edx, ebx + or ebp, edx + mov edx, esi + rol edx, 5 + ror eax, 1 + add ebp, edx + ror eax, 1 + add edi, ebp + ; 40_59 55 + ; 40_59 56 + mov edx, DWORD PTR 32[esp] + mov ebp, DWORD PTR 40[esp] + xor edx, ebp + mov ebp, DWORD PTR [esp] + xor edx, ebp + mov ebp, DWORD PTR 20[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + or ebp, eax + mov DWORD PTR 32[esp],edx + and ebp, ebx + lea edx, DWORD PTR 2400959708[ecx*1+edx] + mov ecx, esi + ror esi, 1 + and ecx, eax + or ebp, ecx + mov ecx, edi + rol ecx, 5 + add ebp, ecx + mov ecx, DWORD PTR 36[esp] + add edx, ebp + mov ebp, DWORD PTR 44[esp] + xor ecx, ebp + mov ebp, DWORD PTR 4[esp] + xor ecx, ebp + mov ebp, DWORD PTR 24[esp] + ror esi, 1 + xor ecx, ebp + rol ecx, 1 + mov ebp, edi + mov DWORD PTR 36[esp],ecx + or ebp, esi + lea ecx, DWORD PTR 2400959708[ebx*1+ecx] + mov ebx, edi + and ebp, eax + and ebx, esi + or ebp, ebx + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebp, ebx + ror edi, 1 + add ecx, ebp + ; 40_59 57 + ; 40_59 58 + mov ebx, DWORD PTR 40[esp] + mov ebp, DWORD PTR 48[esp] + xor ebx, ebp + mov ebp, DWORD PTR 8[esp] + xor ebx, ebp + mov ebp, DWORD PTR 28[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + or ebp, edi + mov DWORD PTR 40[esp],ebx + and ebp, esi + lea ebx, DWORD PTR 2400959708[eax*1+ebx] + mov eax, edx + ror edx, 1 + and eax, edi + or ebp, eax + mov eax, ecx + rol eax, 5 + add ebp, eax + mov eax, DWORD PTR 44[esp] + add ebx, ebp + mov ebp, DWORD PTR 52[esp] + xor eax, ebp + mov ebp, DWORD PTR 12[esp] + xor eax, ebp + mov ebp, DWORD PTR 32[esp] + ror edx, 1 + xor eax, ebp + rol eax, 1 + mov ebp, ecx + mov DWORD PTR 44[esp],eax + or ebp, edx + lea eax, DWORD PTR 2400959708[esi*1+eax] + mov esi, ecx + and ebp, edi + and esi, edx + or ebp, esi + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add ebp, esi + ror ecx, 1 + add eax, ebp + ; 40_59 59 + ; 20_39 60 + mov esi, DWORD PTR 48[esp] + mov ebp, DWORD PTR 56[esp] + xor esi, ebp + mov ebp, DWORD PTR 16[esp] + xor esi, ebp + mov ebp, DWORD PTR 36[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + xor ebp, ecx + mov DWORD PTR 48[esp],esi + xor ebp, edx + lea esi, DWORD PTR 3395469782[edi*1+esi] + mov edi, eax + rol edi, 5 + ror ebx, 1 + add edi, ebp + ror ebx, 1 + add esi, edi + ; 20_39 61 + mov edi, DWORD PTR 52[esp] + mov ebp, DWORD PTR 60[esp] + xor edi, ebp + mov ebp, DWORD PTR 20[esp] + xor edi, ebp + mov ebp, DWORD PTR 40[esp] + xor edi, ebp + mov ebp, eax + rol edi, 1 + xor ebp, ebx + mov DWORD PTR 52[esp],edi + xor ebp, ecx + lea edi, DWORD PTR 3395469782[edx*1+edi] + mov edx, esi + rol edx, 5 + ror eax, 1 + add edx, ebp + ror eax, 1 + add edi, edx + ; 20_39 62 + mov edx, DWORD PTR 56[esp] + mov ebp, DWORD PTR [esp] + xor edx, ebp + mov ebp, DWORD PTR 24[esp] + xor edx, ebp + mov ebp, DWORD PTR 44[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + xor ebp, eax + mov DWORD PTR 56[esp],edx + xor ebp, ebx + lea edx, DWORD PTR 3395469782[ecx*1+edx] + mov ecx, edi + rol ecx, 5 + ror esi, 1 + add ecx, ebp + ror esi, 1 + add edx, ecx + ; 20_39 63 + mov ecx, DWORD PTR 60[esp] + mov ebp, DWORD PTR 4[esp] + xor ecx, ebp + mov ebp, DWORD PTR 28[esp] + xor ecx, ebp + mov ebp, DWORD PTR 48[esp] + xor ecx, ebp + mov ebp, edi + rol ecx, 1 + xor ebp, esi + mov DWORD PTR 60[esp],ecx + xor ebp, eax + lea ecx, DWORD PTR 3395469782[ebx*1+ecx] + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebx, ebp + ror edi, 1 + add ecx, ebx + ; 20_39 64 + mov ebx, DWORD PTR [esp] + mov ebp, DWORD PTR 8[esp] + xor ebx, ebp + mov ebp, DWORD PTR 32[esp] + xor ebx, ebp + mov ebp, DWORD PTR 52[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + xor ebp, edi + mov DWORD PTR [esp],ebx + xor ebp, esi + lea ebx, DWORD PTR 3395469782[eax*1+ebx] + mov eax, ecx + rol eax, 5 + ror edx, 1 + add eax, ebp + ror edx, 1 + add ebx, eax + ; 20_39 65 + mov eax, DWORD PTR 4[esp] + mov ebp, DWORD PTR 12[esp] + xor eax, ebp + mov ebp, DWORD PTR 36[esp] + xor eax, ebp + mov ebp, DWORD PTR 56[esp] + xor eax, ebp + mov ebp, ecx + rol eax, 1 + xor ebp, edx + mov DWORD PTR 4[esp],eax + xor ebp, edi + lea eax, DWORD PTR 3395469782[esi*1+eax] + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add esi, ebp + ror ecx, 1 + add eax, esi + ; 20_39 66 + mov esi, DWORD PTR 8[esp] + mov ebp, DWORD PTR 16[esp] + xor esi, ebp + mov ebp, DWORD PTR 40[esp] + xor esi, ebp + mov ebp, DWORD PTR 60[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + xor ebp, ecx + mov DWORD PTR 8[esp],esi + xor ebp, edx + lea esi, DWORD PTR 3395469782[edi*1+esi] + mov edi, eax + rol edi, 5 + ror ebx, 1 + add edi, ebp + ror ebx, 1 + add esi, edi + ; 20_39 67 + mov edi, DWORD PTR 12[esp] + mov ebp, DWORD PTR 20[esp] + xor edi, ebp + mov ebp, DWORD PTR 44[esp] + xor edi, ebp + mov ebp, DWORD PTR [esp] + xor edi, ebp + mov ebp, eax + rol edi, 1 + xor ebp, ebx + mov DWORD PTR 12[esp],edi + xor ebp, ecx + lea edi, DWORD PTR 3395469782[edx*1+edi] + mov edx, esi + rol edx, 5 + ror eax, 1 + add edx, ebp + ror eax, 1 + add edi, edx + ; 20_39 68 + mov edx, DWORD PTR 16[esp] + mov ebp, DWORD PTR 24[esp] + xor edx, ebp + mov ebp, DWORD PTR 48[esp] + xor edx, ebp + mov ebp, DWORD PTR 4[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + xor ebp, eax + mov DWORD PTR 16[esp],edx + xor ebp, ebx + lea edx, DWORD PTR 3395469782[ecx*1+edx] + mov ecx, edi + rol ecx, 5 + ror esi, 1 + add ecx, ebp + ror esi, 1 + add edx, ecx + ; 20_39 69 + mov ecx, DWORD PTR 20[esp] + mov ebp, DWORD PTR 28[esp] + xor ecx, ebp + mov ebp, DWORD PTR 52[esp] + xor ecx, ebp + mov ebp, DWORD PTR 8[esp] + xor ecx, ebp + mov ebp, edi + rol ecx, 1 + xor ebp, esi + mov DWORD PTR 20[esp],ecx + xor ebp, eax + lea ecx, DWORD PTR 3395469782[ebx*1+ecx] + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebx, ebp + ror edi, 1 + add ecx, ebx + ; 20_39 70 + mov ebx, DWORD PTR 24[esp] + mov ebp, DWORD PTR 32[esp] + xor ebx, ebp + mov ebp, DWORD PTR 56[esp] + xor ebx, ebp + mov ebp, DWORD PTR 12[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + xor ebp, edi + mov DWORD PTR 24[esp],ebx + xor ebp, esi + lea ebx, DWORD PTR 3395469782[eax*1+ebx] + mov eax, ecx + rol eax, 5 + ror edx, 1 + add eax, ebp + ror edx, 1 + add ebx, eax + ; 20_39 71 + mov eax, DWORD PTR 28[esp] + mov ebp, DWORD PTR 36[esp] + xor eax, ebp + mov ebp, DWORD PTR 60[esp] + xor eax, ebp + mov ebp, DWORD PTR 16[esp] + xor eax, ebp + mov ebp, ecx + rol eax, 1 + xor ebp, edx + mov DWORD PTR 28[esp],eax + xor ebp, edi + lea eax, DWORD PTR 3395469782[esi*1+eax] + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add esi, ebp + ror ecx, 1 + add eax, esi + ; 20_39 72 + mov esi, DWORD PTR 32[esp] + mov ebp, DWORD PTR 40[esp] + xor esi, ebp + mov ebp, DWORD PTR [esp] + xor esi, ebp + mov ebp, DWORD PTR 20[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + xor ebp, ecx + mov DWORD PTR 32[esp],esi + xor ebp, edx + lea esi, DWORD PTR 3395469782[edi*1+esi] + mov edi, eax + rol edi, 5 + ror ebx, 1 + add edi, ebp + ror ebx, 1 + add esi, edi + ; 20_39 73 + mov edi, DWORD PTR 36[esp] + mov ebp, DWORD PTR 44[esp] + xor edi, ebp + mov ebp, DWORD PTR 4[esp] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + xor edi, ebp + mov ebp, eax + rol edi, 1 + xor ebp, ebx + mov DWORD PTR 36[esp],edi + xor ebp, ecx + lea edi, DWORD PTR 3395469782[edx*1+edi] + mov edx, esi + rol edx, 5 + ror eax, 1 + add edx, ebp + ror eax, 1 + add edi, edx + ; 20_39 74 + mov edx, DWORD PTR 40[esp] + mov ebp, DWORD PTR 48[esp] + xor edx, ebp + mov ebp, DWORD PTR 8[esp] + xor edx, ebp + mov ebp, DWORD PTR 28[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + xor ebp, eax + mov DWORD PTR 40[esp],edx + xor ebp, ebx + lea edx, DWORD PTR 3395469782[ecx*1+edx] + mov ecx, edi + rol ecx, 5 + ror esi, 1 + add ecx, ebp + ror esi, 1 + add edx, ecx + ; 20_39 75 + mov ecx, DWORD PTR 44[esp] + mov ebp, DWORD PTR 52[esp] + xor ecx, ebp + mov ebp, DWORD PTR 12[esp] + xor ecx, ebp + mov ebp, DWORD PTR 32[esp] + xor ecx, ebp + mov ebp, edi + rol ecx, 1 + xor ebp, esi + mov DWORD PTR 44[esp],ecx + xor ebp, eax + lea ecx, DWORD PTR 3395469782[ebx*1+ecx] + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebx, ebp + ror edi, 1 + add ecx, ebx + ; 20_39 76 + mov ebx, DWORD PTR 48[esp] + mov ebp, DWORD PTR 56[esp] + xor ebx, ebp + mov ebp, DWORD PTR 16[esp] + xor ebx, ebp + mov ebp, DWORD PTR 36[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + xor ebp, edi + mov DWORD PTR 48[esp],ebx + xor ebp, esi + lea ebx, DWORD PTR 3395469782[eax*1+ebx] + mov eax, ecx + rol eax, 5 + ror edx, 1 + add eax, ebp + ror edx, 1 + add ebx, eax + ; 20_39 77 + mov eax, DWORD PTR 52[esp] + mov ebp, DWORD PTR 60[esp] + xor eax, ebp + mov ebp, DWORD PTR 20[esp] + xor eax, ebp + mov ebp, DWORD PTR 40[esp] + xor eax, ebp + mov ebp, ecx + rol eax, 1 + xor ebp, edx + mov DWORD PTR 52[esp],eax + xor ebp, edi + lea eax, DWORD PTR 3395469782[esi*1+eax] + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add esi, ebp + ror ecx, 1 + add eax, esi + ; 20_39 78 + mov esi, DWORD PTR 56[esp] + mov ebp, DWORD PTR [esp] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + xor esi, ebp + mov ebp, DWORD PTR 44[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + xor ebp, ecx + mov DWORD PTR 56[esp],esi + xor ebp, edx + lea esi, DWORD PTR 3395469782[edi*1+esi] + mov edi, eax + rol edi, 5 + ror ebx, 1 + add edi, ebp + ror ebx, 1 + add esi, edi + ; 20_39 79 + mov edi, DWORD PTR 60[esp] + mov ebp, DWORD PTR 4[esp] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + xor edi, ebp + mov ebp, DWORD PTR 48[esp] + xor edi, ebp + mov ebp, eax + rol edi, 1 + xor ebp, ebx + mov DWORD PTR 60[esp],edi + xor ebp, ecx + lea edi, DWORD PTR 3395469782[edx*1+edi] + mov edx, esi + rol edx, 5 + add edx, ebp + mov ebp, DWORD PTR 92[esp] + ror eax, 1 + add edi, edx + ror eax, 1 + ; End processing + ; + mov edx, DWORD PTR 12[ebp] + add edx, ebx + mov ebx, DWORD PTR 4[ebp] + add ebx, esi + mov esi, eax + mov eax, DWORD PTR [ebp] + mov DWORD PTR 12[ebp],edx + add eax, edi + mov edi, DWORD PTR 16[ebp] + add edi, ecx + mov ecx, DWORD PTR 8[ebp] + add ecx, esi + mov DWORD PTR [ebp],eax + mov esi, DWORD PTR 64[esp] + mov DWORD PTR 8[ebp],ecx + add esi, 64 + mov eax, DWORD PTR 68[esp] + mov DWORD PTR 16[ebp],edi + cmp eax, esi + mov DWORD PTR 4[ebp],ebx + jl $L001end + mov eax, DWORD PTR [esi] + jmp L000start +$L001end: + add esp, 72 + pop edi + pop ebx + pop ebp + pop esi + ret +_sha1_block_x86 ENDP +_TEXT ENDS +END diff --git a/src/lib/libcrypto/sha/asm/sx86unix.cpp b/src/lib/libcrypto/sha/asm/sx86unix.cpp new file mode 100644 index 0000000000..8366664a39 --- /dev/null +++ b/src/lib/libcrypto/sha/asm/sx86unix.cpp @@ -0,0 +1,1948 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define sha1_block_x86 _sha1_block_x86 + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by sha1-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "sha1-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl sha1_block_x86 + TYPE(sha1_block_x86,@function) +sha1_block_x86: + pushl %esi + pushl %ebp + movl 20(%esp), %eax + movl 16(%esp), %esi + addl %esi, %eax + movl 12(%esp), %ebp + pushl %ebx + subl $64, %eax + pushl %edi + movl 4(%ebp), %ebx + subl $72, %esp + movl 12(%ebp), %edx + movl 16(%ebp), %edi + movl 8(%ebp), %ecx + movl %eax, 68(%esp) + /* First we need to setup the X array */ + movl (%esi), %eax +.L000start: + /* First, load the words onto the stack in network byte order */ +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, (%esp) + movl 4(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 4(%esp) + movl 8(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 8(%esp) + movl 12(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 12(%esp) + movl 16(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 16(%esp) + movl 20(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 20(%esp) + movl 24(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 24(%esp) + movl 28(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 28(%esp) + movl 32(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 32(%esp) + movl 36(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 36(%esp) + movl 40(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 40(%esp) + movl 44(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 44(%esp) + movl 48(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 48(%esp) + movl 52(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 52(%esp) + movl 56(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 56(%esp) + movl 60(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 60(%esp) + /* We now have the X array on the stack */ + /* starting at sp-4 */ + movl %esi, 64(%esp) + + /* Start processing */ + movl (%ebp), %eax + /* 00_15 0 */ + movl %ecx, %esi + movl %eax, %ebp + xorl %edx, %esi + roll $5, %ebp + andl %ebx, %esi + addl %edi, %ebp +.byte 209 +.byte 203 /* rorl $1 %ebx */ + movl (%esp), %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + xorl %edx, %esi + leal 1518500249(%ebp,%edi,1),%ebp + movl %ebx, %edi + addl %ebp, %esi + xorl %ecx, %edi + movl %esi, %ebp + andl %eax, %edi + roll $5, %ebp + addl %edx, %ebp + movl 4(%esp), %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + xorl %ecx, %edi +.byte 209 +.byte 200 /* rorl $1 %eax */ + leal 1518500249(%ebp,%edx,1),%ebp + addl %ebp, %edi + /* 00_15 2 */ + movl %eax, %edx + movl %edi, %ebp + xorl %ebx, %edx + roll $5, %ebp + andl %esi, %edx + addl %ecx, %ebp +.byte 209 +.byte 206 /* rorl $1 %esi */ + movl 8(%esp), %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + xorl %ebx, %edx + leal 1518500249(%ebp,%ecx,1),%ebp + movl %esi, %ecx + addl %ebp, %edx + xorl %eax, %ecx + movl %edx, %ebp + andl %edi, %ecx + roll $5, %ebp + addl %ebx, %ebp + movl 12(%esp), %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + xorl %eax, %ecx +.byte 209 +.byte 207 /* rorl $1 %edi */ + leal 1518500249(%ebp,%ebx,1),%ebp + addl %ebp, %ecx + /* 00_15 4 */ + movl %edi, %ebx + movl %ecx, %ebp + xorl %esi, %ebx + roll $5, %ebp + andl %edx, %ebx + addl %eax, %ebp +.byte 209 +.byte 202 /* rorl $1 %edx */ + movl 16(%esp), %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + xorl %esi, %ebx + leal 1518500249(%ebp,%eax,1),%ebp + movl %edx, %eax + addl %ebp, %ebx + xorl %edi, %eax + movl %ebx, %ebp + andl %ecx, %eax + roll $5, %ebp + addl %esi, %ebp + movl 20(%esp), %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + xorl %edi, %eax +.byte 209 +.byte 201 /* rorl $1 %ecx */ + leal 1518500249(%ebp,%esi,1),%ebp + addl %ebp, %eax + /* 00_15 6 */ + movl %ecx, %esi + movl %eax, %ebp + xorl %edx, %esi + roll $5, %ebp + andl %ebx, %esi + addl %edi, %ebp +.byte 209 +.byte 203 /* rorl $1 %ebx */ + movl 24(%esp), %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + xorl %edx, %esi + leal 1518500249(%ebp,%edi,1),%ebp + movl %ebx, %edi + addl %ebp, %esi + xorl %ecx, %edi + movl %esi, %ebp + andl %eax, %edi + roll $5, %ebp + addl %edx, %ebp + movl 28(%esp), %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + xorl %ecx, %edi +.byte 209 +.byte 200 /* rorl $1 %eax */ + leal 1518500249(%ebp,%edx,1),%ebp + addl %ebp, %edi + /* 00_15 8 */ + movl %eax, %edx + movl %edi, %ebp + xorl %ebx, %edx + roll $5, %ebp + andl %esi, %edx + addl %ecx, %ebp +.byte 209 +.byte 206 /* rorl $1 %esi */ + movl 32(%esp), %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + xorl %ebx, %edx + leal 1518500249(%ebp,%ecx,1),%ebp + movl %esi, %ecx + addl %ebp, %edx + xorl %eax, %ecx + movl %edx, %ebp + andl %edi, %ecx + roll $5, %ebp + addl %ebx, %ebp + movl 36(%esp), %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + xorl %eax, %ecx +.byte 209 +.byte 207 /* rorl $1 %edi */ + leal 1518500249(%ebp,%ebx,1),%ebp + addl %ebp, %ecx + /* 00_15 10 */ + movl %edi, %ebx + movl %ecx, %ebp + xorl %esi, %ebx + roll $5, %ebp + andl %edx, %ebx + addl %eax, %ebp +.byte 209 +.byte 202 /* rorl $1 %edx */ + movl 40(%esp), %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + xorl %esi, %ebx + leal 1518500249(%ebp,%eax,1),%ebp + movl %edx, %eax + addl %ebp, %ebx + xorl %edi, %eax + movl %ebx, %ebp + andl %ecx, %eax + roll $5, %ebp + addl %esi, %ebp + movl 44(%esp), %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + xorl %edi, %eax +.byte 209 +.byte 201 /* rorl $1 %ecx */ + leal 1518500249(%ebp,%esi,1),%ebp + addl %ebp, %eax + /* 00_15 12 */ + movl %ecx, %esi + movl %eax, %ebp + xorl %edx, %esi + roll $5, %ebp + andl %ebx, %esi + addl %edi, %ebp +.byte 209 +.byte 203 /* rorl $1 %ebx */ + movl 48(%esp), %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + xorl %edx, %esi + leal 1518500249(%ebp,%edi,1),%ebp + movl %ebx, %edi + addl %ebp, %esi + xorl %ecx, %edi + movl %esi, %ebp + andl %eax, %edi + roll $5, %ebp + addl %edx, %ebp + movl 52(%esp), %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + xorl %ecx, %edi +.byte 209 +.byte 200 /* rorl $1 %eax */ + leal 1518500249(%ebp,%edx,1),%ebp + addl %ebp, %edi + /* 00_15 14 */ + movl %eax, %edx + movl %edi, %ebp + xorl %ebx, %edx + roll $5, %ebp + andl %esi, %edx + addl %ecx, %ebp +.byte 209 +.byte 206 /* rorl $1 %esi */ + movl 56(%esp), %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + xorl %ebx, %edx + leal 1518500249(%ebp,%ecx,1),%ebp + movl %esi, %ecx + addl %ebp, %edx + xorl %eax, %ecx + movl %edx, %ebp + andl %edi, %ecx + roll $5, %ebp + addl %ebx, %ebp + movl 60(%esp), %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + xorl %eax, %ecx +.byte 209 +.byte 207 /* rorl $1 %edi */ + leal 1518500249(%ebp,%ebx,1),%ebp + addl %ebp, %ecx + /* 16_19 16 */ + nop + movl (%esp), %ebp + movl 8(%esp), %ebx + xorl %ebp, %ebx + movl 32(%esp), %ebp + xorl %ebp, %ebx + movl 52(%esp), %ebp + xorl %ebp, %ebx + movl %edi, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + xorl %esi, %ebp + movl %ebx, (%esp) + andl %edx, %ebp + leal 1518500249(%ebx,%eax,1),%ebx + xorl %esi, %ebp + movl %ecx, %eax + addl %ebp, %ebx + roll $5, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %eax, %ebx + movl 4(%esp), %eax + movl 12(%esp), %ebp + xorl %ebp, %eax + movl 36(%esp), %ebp + xorl %ebp, %eax + movl 56(%esp), %ebp +.byte 209 +.byte 202 /* rorl $1 %edx */ + xorl %ebp, %eax +.byte 209 +.byte 192 /* roll $1 %eax */ + movl %edx, %ebp + xorl %edi, %ebp + movl %eax, 4(%esp) + andl %ecx, %ebp + leal 1518500249(%eax,%esi,1),%eax + xorl %edi, %ebp + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %eax +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %eax + /* 16_19 18 */ + movl 8(%esp), %ebp + movl 16(%esp), %esi + xorl %ebp, %esi + movl 40(%esp), %ebp + xorl %ebp, %esi + movl 60(%esp), %ebp + xorl %ebp, %esi + movl %ecx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + xorl %edx, %ebp + movl %esi, 8(%esp) + andl %ebx, %ebp + leal 1518500249(%esi,%edi,1),%esi + xorl %edx, %ebp + movl %eax, %edi + addl %ebp, %esi + roll $5, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %edi, %esi + movl 12(%esp), %edi + movl 20(%esp), %ebp + xorl %ebp, %edi + movl 44(%esp), %ebp + xorl %ebp, %edi + movl (%esp), %ebp +.byte 209 +.byte 203 /* rorl $1 %ebx */ + xorl %ebp, %edi +.byte 209 +.byte 199 /* roll $1 %edi */ + movl %ebx, %ebp + xorl %ecx, %ebp + movl %edi, 12(%esp) + andl %eax, %ebp + leal 1518500249(%edi,%edx,1),%edi + xorl %ecx, %ebp + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %edi +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edi + /* 20_39 20 */ + movl 16(%esp), %edx + movl 24(%esp), %ebp + xorl %ebp, %edx + movl 48(%esp), %ebp + xorl %ebp, %edx + movl 4(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + xorl %eax, %ebp + movl %edx, 16(%esp) + xorl %ebx, %ebp + leal 1859775393(%edx,%ecx,1),%edx + movl %edi, %ecx + roll $5, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ebp, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ecx, %edx + /* 20_39 21 */ + movl 20(%esp), %ecx + movl 28(%esp), %ebp + xorl %ebp, %ecx + movl 52(%esp), %ebp + xorl %ebp, %ecx + movl 8(%esp), %ebp + xorl %ebp, %ecx + movl %edi, %ebp +.byte 209 +.byte 193 /* roll $1 %ecx */ + xorl %esi, %ebp + movl %ecx, 20(%esp) + xorl %eax, %ebp + leal 1859775393(%ecx,%ebx,1),%ecx + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ecx + /* 20_39 22 */ + movl 24(%esp), %ebx + movl 32(%esp), %ebp + xorl %ebp, %ebx + movl 56(%esp), %ebp + xorl %ebp, %ebx + movl 12(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + xorl %edi, %ebp + movl %ebx, 24(%esp) + xorl %esi, %ebp + leal 1859775393(%ebx,%eax,1),%ebx + movl %ecx, %eax + roll $5, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %ebp, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %eax, %ebx + /* 20_39 23 */ + movl 28(%esp), %eax + movl 36(%esp), %ebp + xorl %ebp, %eax + movl 60(%esp), %ebp + xorl %ebp, %eax + movl 16(%esp), %ebp + xorl %ebp, %eax + movl %ecx, %ebp +.byte 209 +.byte 192 /* roll $1 %eax */ + xorl %edx, %ebp + movl %eax, 28(%esp) + xorl %edi, %ebp + leal 1859775393(%eax,%esi,1),%eax + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %eax + /* 20_39 24 */ + movl 32(%esp), %esi + movl 40(%esp), %ebp + xorl %ebp, %esi + movl (%esp), %ebp + xorl %ebp, %esi + movl 20(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + xorl %ecx, %ebp + movl %esi, 32(%esp) + xorl %edx, %ebp + leal 1859775393(%esi,%edi,1),%esi + movl %eax, %edi + roll $5, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %ebp, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %edi, %esi + /* 20_39 25 */ + movl 36(%esp), %edi + movl 44(%esp), %ebp + xorl %ebp, %edi + movl 4(%esp), %ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + xorl %ebp, %edi + movl %eax, %ebp +.byte 209 +.byte 199 /* roll $1 %edi */ + xorl %ebx, %ebp + movl %edi, 36(%esp) + xorl %ecx, %ebp + leal 1859775393(%edi,%edx,1),%edi + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %edi + /* 20_39 26 */ + movl 40(%esp), %edx + movl 48(%esp), %ebp + xorl %ebp, %edx + movl 8(%esp), %ebp + xorl %ebp, %edx + movl 28(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + xorl %eax, %ebp + movl %edx, 40(%esp) + xorl %ebx, %ebp + leal 1859775393(%edx,%ecx,1),%edx + movl %edi, %ecx + roll $5, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ebp, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ecx, %edx + /* 20_39 27 */ + movl 44(%esp), %ecx + movl 52(%esp), %ebp + xorl %ebp, %ecx + movl 12(%esp), %ebp + xorl %ebp, %ecx + movl 32(%esp), %ebp + xorl %ebp, %ecx + movl %edi, %ebp +.byte 209 +.byte 193 /* roll $1 %ecx */ + xorl %esi, %ebp + movl %ecx, 44(%esp) + xorl %eax, %ebp + leal 1859775393(%ecx,%ebx,1),%ecx + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ecx + /* 20_39 28 */ + movl 48(%esp), %ebx + movl 56(%esp), %ebp + xorl %ebp, %ebx + movl 16(%esp), %ebp + xorl %ebp, %ebx + movl 36(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + xorl %edi, %ebp + movl %ebx, 48(%esp) + xorl %esi, %ebp + leal 1859775393(%ebx,%eax,1),%ebx + movl %ecx, %eax + roll $5, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %ebp, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %eax, %ebx + /* 20_39 29 */ + movl 52(%esp), %eax + movl 60(%esp), %ebp + xorl %ebp, %eax + movl 20(%esp), %ebp + xorl %ebp, %eax + movl 40(%esp), %ebp + xorl %ebp, %eax + movl %ecx, %ebp +.byte 209 +.byte 192 /* roll $1 %eax */ + xorl %edx, %ebp + movl %eax, 52(%esp) + xorl %edi, %ebp + leal 1859775393(%eax,%esi,1),%eax + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %eax + /* 20_39 30 */ + movl 56(%esp), %esi + movl (%esp), %ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + xorl %ebp, %esi + movl 44(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + xorl %ecx, %ebp + movl %esi, 56(%esp) + xorl %edx, %ebp + leal 1859775393(%esi,%edi,1),%esi + movl %eax, %edi + roll $5, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %ebp, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %edi, %esi + /* 20_39 31 */ + movl 60(%esp), %edi + movl 4(%esp), %ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + xorl %ebp, %edi + movl 48(%esp), %ebp + xorl %ebp, %edi + movl %eax, %ebp +.byte 209 +.byte 199 /* roll $1 %edi */ + xorl %ebx, %ebp + movl %edi, 60(%esp) + xorl %ecx, %ebp + leal 1859775393(%edi,%edx,1),%edi + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %edi + /* 20_39 32 */ + movl (%esp), %edx + movl 8(%esp), %ebp + xorl %ebp, %edx + movl 32(%esp), %ebp + xorl %ebp, %edx + movl 52(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + xorl %eax, %ebp + movl %edx, (%esp) + xorl %ebx, %ebp + leal 1859775393(%edx,%ecx,1),%edx + movl %edi, %ecx + roll $5, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ebp, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ecx, %edx + /* 20_39 33 */ + movl 4(%esp), %ecx + movl 12(%esp), %ebp + xorl %ebp, %ecx + movl 36(%esp), %ebp + xorl %ebp, %ecx + movl 56(%esp), %ebp + xorl %ebp, %ecx + movl %edi, %ebp +.byte 209 +.byte 193 /* roll $1 %ecx */ + xorl %esi, %ebp + movl %ecx, 4(%esp) + xorl %eax, %ebp + leal 1859775393(%ecx,%ebx,1),%ecx + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ecx + /* 20_39 34 */ + movl 8(%esp), %ebx + movl 16(%esp), %ebp + xorl %ebp, %ebx + movl 40(%esp), %ebp + xorl %ebp, %ebx + movl 60(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + xorl %edi, %ebp + movl %ebx, 8(%esp) + xorl %esi, %ebp + leal 1859775393(%ebx,%eax,1),%ebx + movl %ecx, %eax + roll $5, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %ebp, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %eax, %ebx + /* 20_39 35 */ + movl 12(%esp), %eax + movl 20(%esp), %ebp + xorl %ebp, %eax + movl 44(%esp), %ebp + xorl %ebp, %eax + movl (%esp), %ebp + xorl %ebp, %eax + movl %ecx, %ebp +.byte 209 +.byte 192 /* roll $1 %eax */ + xorl %edx, %ebp + movl %eax, 12(%esp) + xorl %edi, %ebp + leal 1859775393(%eax,%esi,1),%eax + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %eax + /* 20_39 36 */ + movl 16(%esp), %esi + movl 24(%esp), %ebp + xorl %ebp, %esi + movl 48(%esp), %ebp + xorl %ebp, %esi + movl 4(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + xorl %ecx, %ebp + movl %esi, 16(%esp) + xorl %edx, %ebp + leal 1859775393(%esi,%edi,1),%esi + movl %eax, %edi + roll $5, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %ebp, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %edi, %esi + /* 20_39 37 */ + movl 20(%esp), %edi + movl 28(%esp), %ebp + xorl %ebp, %edi + movl 52(%esp), %ebp + xorl %ebp, %edi + movl 8(%esp), %ebp + xorl %ebp, %edi + movl %eax, %ebp +.byte 209 +.byte 199 /* roll $1 %edi */ + xorl %ebx, %ebp + movl %edi, 20(%esp) + xorl %ecx, %ebp + leal 1859775393(%edi,%edx,1),%edi + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %edi + /* 20_39 38 */ + movl 24(%esp), %edx + movl 32(%esp), %ebp + xorl %ebp, %edx + movl 56(%esp), %ebp + xorl %ebp, %edx + movl 12(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + xorl %eax, %ebp + movl %edx, 24(%esp) + xorl %ebx, %ebp + leal 1859775393(%edx,%ecx,1),%edx + movl %edi, %ecx + roll $5, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ebp, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ecx, %edx + /* 20_39 39 */ + movl 28(%esp), %ecx + movl 36(%esp), %ebp + xorl %ebp, %ecx + movl 60(%esp), %ebp + xorl %ebp, %ecx + movl 16(%esp), %ebp + xorl %ebp, %ecx + movl %edi, %ebp +.byte 209 +.byte 193 /* roll $1 %ecx */ + xorl %esi, %ebp + movl %ecx, 28(%esp) + xorl %eax, %ebp + leal 1859775393(%ecx,%ebx,1),%ecx + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ecx + /* 40_59 40 */ + movl 32(%esp), %ebx + movl 40(%esp), %ebp + xorl %ebp, %ebx + movl (%esp), %ebp + xorl %ebp, %ebx + movl 20(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + orl %edi, %ebp + movl %ebx, 32(%esp) + andl %esi, %ebp + leal 2400959708(%ebx,%eax,1),%ebx + movl %edx, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + andl %edi, %eax + orl %eax, %ebp + movl %ecx, %eax + roll $5, %eax + addl %eax, %ebp + movl 36(%esp), %eax + addl %ebp, %ebx + movl 44(%esp), %ebp + xorl %ebp, %eax + movl 4(%esp), %ebp + xorl %ebp, %eax + movl 24(%esp), %ebp +.byte 209 +.byte 202 /* rorl $1 %edx */ + xorl %ebp, %eax +.byte 209 +.byte 192 /* roll $1 %eax */ + movl %ecx, %ebp + movl %eax, 36(%esp) + orl %edx, %ebp + leal 2400959708(%eax,%esi,1),%eax + movl %ecx, %esi + andl %edi, %ebp + andl %edx, %esi + orl %esi, %ebp + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %ebp +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %eax + /* 40_59 41 */ + /* 40_59 42 */ + movl 40(%esp), %esi + movl 48(%esp), %ebp + xorl %ebp, %esi + movl 8(%esp), %ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + orl %ecx, %ebp + movl %esi, 40(%esp) + andl %edx, %ebp + leal 2400959708(%esi,%edi,1),%esi + movl %ebx, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + andl %ecx, %edi + orl %edi, %ebp + movl %eax, %edi + roll $5, %edi + addl %edi, %ebp + movl 44(%esp), %edi + addl %ebp, %esi + movl 52(%esp), %ebp + xorl %ebp, %edi + movl 12(%esp), %ebp + xorl %ebp, %edi + movl 32(%esp), %ebp +.byte 209 +.byte 203 /* rorl $1 %ebx */ + xorl %ebp, %edi +.byte 209 +.byte 199 /* roll $1 %edi */ + movl %eax, %ebp + movl %edi, 44(%esp) + orl %ebx, %ebp + leal 2400959708(%edi,%edx,1),%edi + movl %eax, %edx + andl %ecx, %ebp + andl %ebx, %edx + orl %edx, %ebp + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %ebp +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edi + /* 40_59 43 */ + /* 40_59 44 */ + movl 48(%esp), %edx + movl 56(%esp), %ebp + xorl %ebp, %edx + movl 16(%esp), %ebp + xorl %ebp, %edx + movl 36(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + orl %eax, %ebp + movl %edx, 48(%esp) + andl %ebx, %ebp + leal 2400959708(%edx,%ecx,1),%edx + movl %esi, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + andl %eax, %ecx + orl %ecx, %ebp + movl %edi, %ecx + roll $5, %ecx + addl %ecx, %ebp + movl 52(%esp), %ecx + addl %ebp, %edx + movl 60(%esp), %ebp + xorl %ebp, %ecx + movl 20(%esp), %ebp + xorl %ebp, %ecx + movl 40(%esp), %ebp +.byte 209 +.byte 206 /* rorl $1 %esi */ + xorl %ebp, %ecx +.byte 209 +.byte 193 /* roll $1 %ecx */ + movl %edi, %ebp + movl %ecx, 52(%esp) + orl %esi, %ebp + leal 2400959708(%ecx,%ebx,1),%ecx + movl %edi, %ebx + andl %eax, %ebp + andl %esi, %ebx + orl %ebx, %ebp + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ebp +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ecx + /* 40_59 45 */ + /* 40_59 46 */ + movl 56(%esp), %ebx + movl (%esp), %ebp + xorl %ebp, %ebx + movl 24(%esp), %ebp + xorl %ebp, %ebx + movl 44(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + orl %edi, %ebp + movl %ebx, 56(%esp) + andl %esi, %ebp + leal 2400959708(%ebx,%eax,1),%ebx + movl %edx, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + andl %edi, %eax + orl %eax, %ebp + movl %ecx, %eax + roll $5, %eax + addl %eax, %ebp + movl 60(%esp), %eax + addl %ebp, %ebx + movl 4(%esp), %ebp + xorl %ebp, %eax + movl 28(%esp), %ebp + xorl %ebp, %eax + movl 48(%esp), %ebp +.byte 209 +.byte 202 /* rorl $1 %edx */ + xorl %ebp, %eax +.byte 209 +.byte 192 /* roll $1 %eax */ + movl %ecx, %ebp + movl %eax, 60(%esp) + orl %edx, %ebp + leal 2400959708(%eax,%esi,1),%eax + movl %ecx, %esi + andl %edi, %ebp + andl %edx, %esi + orl %esi, %ebp + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %ebp +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %eax + /* 40_59 47 */ + /* 40_59 48 */ + movl (%esp), %esi + movl 8(%esp), %ebp + xorl %ebp, %esi + movl 32(%esp), %ebp + xorl %ebp, %esi + movl 52(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + orl %ecx, %ebp + movl %esi, (%esp) + andl %edx, %ebp + leal 2400959708(%esi,%edi,1),%esi + movl %ebx, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + andl %ecx, %edi + orl %edi, %ebp + movl %eax, %edi + roll $5, %edi + addl %edi, %ebp + movl 4(%esp), %edi + addl %ebp, %esi + movl 12(%esp), %ebp + xorl %ebp, %edi + movl 36(%esp), %ebp + xorl %ebp, %edi + movl 56(%esp), %ebp +.byte 209 +.byte 203 /* rorl $1 %ebx */ + xorl %ebp, %edi +.byte 209 +.byte 199 /* roll $1 %edi */ + movl %eax, %ebp + movl %edi, 4(%esp) + orl %ebx, %ebp + leal 2400959708(%edi,%edx,1),%edi + movl %eax, %edx + andl %ecx, %ebp + andl %ebx, %edx + orl %edx, %ebp + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %ebp +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edi + /* 40_59 49 */ + /* 40_59 50 */ + movl 8(%esp), %edx + movl 16(%esp), %ebp + xorl %ebp, %edx + movl 40(%esp), %ebp + xorl %ebp, %edx + movl 60(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + orl %eax, %ebp + movl %edx, 8(%esp) + andl %ebx, %ebp + leal 2400959708(%edx,%ecx,1),%edx + movl %esi, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + andl %eax, %ecx + orl %ecx, %ebp + movl %edi, %ecx + roll $5, %ecx + addl %ecx, %ebp + movl 12(%esp), %ecx + addl %ebp, %edx + movl 20(%esp), %ebp + xorl %ebp, %ecx + movl 44(%esp), %ebp + xorl %ebp, %ecx + movl (%esp), %ebp +.byte 209 +.byte 206 /* rorl $1 %esi */ + xorl %ebp, %ecx +.byte 209 +.byte 193 /* roll $1 %ecx */ + movl %edi, %ebp + movl %ecx, 12(%esp) + orl %esi, %ebp + leal 2400959708(%ecx,%ebx,1),%ecx + movl %edi, %ebx + andl %eax, %ebp + andl %esi, %ebx + orl %ebx, %ebp + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ebp +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ecx + /* 40_59 51 */ + /* 40_59 52 */ + movl 16(%esp), %ebx + movl 24(%esp), %ebp + xorl %ebp, %ebx + movl 48(%esp), %ebp + xorl %ebp, %ebx + movl 4(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + orl %edi, %ebp + movl %ebx, 16(%esp) + andl %esi, %ebp + leal 2400959708(%ebx,%eax,1),%ebx + movl %edx, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + andl %edi, %eax + orl %eax, %ebp + movl %ecx, %eax + roll $5, %eax + addl %eax, %ebp + movl 20(%esp), %eax + addl %ebp, %ebx + movl 28(%esp), %ebp + xorl %ebp, %eax + movl 52(%esp), %ebp + xorl %ebp, %eax + movl 8(%esp), %ebp +.byte 209 +.byte 202 /* rorl $1 %edx */ + xorl %ebp, %eax +.byte 209 +.byte 192 /* roll $1 %eax */ + movl %ecx, %ebp + movl %eax, 20(%esp) + orl %edx, %ebp + leal 2400959708(%eax,%esi,1),%eax + movl %ecx, %esi + andl %edi, %ebp + andl %edx, %esi + orl %esi, %ebp + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %ebp +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %eax + /* 40_59 53 */ + /* 40_59 54 */ + movl 24(%esp), %esi + movl 32(%esp), %ebp + xorl %ebp, %esi + movl 56(%esp), %ebp + xorl %ebp, %esi + movl 12(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + orl %ecx, %ebp + movl %esi, 24(%esp) + andl %edx, %ebp + leal 2400959708(%esi,%edi,1),%esi + movl %ebx, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + andl %ecx, %edi + orl %edi, %ebp + movl %eax, %edi + roll $5, %edi + addl %edi, %ebp + movl 28(%esp), %edi + addl %ebp, %esi + movl 36(%esp), %ebp + xorl %ebp, %edi + movl 60(%esp), %ebp + xorl %ebp, %edi + movl 16(%esp), %ebp +.byte 209 +.byte 203 /* rorl $1 %ebx */ + xorl %ebp, %edi +.byte 209 +.byte 199 /* roll $1 %edi */ + movl %eax, %ebp + movl %edi, 28(%esp) + orl %ebx, %ebp + leal 2400959708(%edi,%edx,1),%edi + movl %eax, %edx + andl %ecx, %ebp + andl %ebx, %edx + orl %edx, %ebp + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %ebp +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edi + /* 40_59 55 */ + /* 40_59 56 */ + movl 32(%esp), %edx + movl 40(%esp), %ebp + xorl %ebp, %edx + movl (%esp), %ebp + xorl %ebp, %edx + movl 20(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + orl %eax, %ebp + movl %edx, 32(%esp) + andl %ebx, %ebp + leal 2400959708(%edx,%ecx,1),%edx + movl %esi, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + andl %eax, %ecx + orl %ecx, %ebp + movl %edi, %ecx + roll $5, %ecx + addl %ecx, %ebp + movl 36(%esp), %ecx + addl %ebp, %edx + movl 44(%esp), %ebp + xorl %ebp, %ecx + movl 4(%esp), %ebp + xorl %ebp, %ecx + movl 24(%esp), %ebp +.byte 209 +.byte 206 /* rorl $1 %esi */ + xorl %ebp, %ecx +.byte 209 +.byte 193 /* roll $1 %ecx */ + movl %edi, %ebp + movl %ecx, 36(%esp) + orl %esi, %ebp + leal 2400959708(%ecx,%ebx,1),%ecx + movl %edi, %ebx + andl %eax, %ebp + andl %esi, %ebx + orl %ebx, %ebp + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ebp +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ecx + /* 40_59 57 */ + /* 40_59 58 */ + movl 40(%esp), %ebx + movl 48(%esp), %ebp + xorl %ebp, %ebx + movl 8(%esp), %ebp + xorl %ebp, %ebx + movl 28(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + orl %edi, %ebp + movl %ebx, 40(%esp) + andl %esi, %ebp + leal 2400959708(%ebx,%eax,1),%ebx + movl %edx, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + andl %edi, %eax + orl %eax, %ebp + movl %ecx, %eax + roll $5, %eax + addl %eax, %ebp + movl 44(%esp), %eax + addl %ebp, %ebx + movl 52(%esp), %ebp + xorl %ebp, %eax + movl 12(%esp), %ebp + xorl %ebp, %eax + movl 32(%esp), %ebp +.byte 209 +.byte 202 /* rorl $1 %edx */ + xorl %ebp, %eax +.byte 209 +.byte 192 /* roll $1 %eax */ + movl %ecx, %ebp + movl %eax, 44(%esp) + orl %edx, %ebp + leal 2400959708(%eax,%esi,1),%eax + movl %ecx, %esi + andl %edi, %ebp + andl %edx, %esi + orl %esi, %ebp + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %ebp +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %eax + /* 40_59 59 */ + /* 20_39 60 */ + movl 48(%esp), %esi + movl 56(%esp), %ebp + xorl %ebp, %esi + movl 16(%esp), %ebp + xorl %ebp, %esi + movl 36(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + xorl %ecx, %ebp + movl %esi, 48(%esp) + xorl %edx, %ebp + leal 3395469782(%esi,%edi,1),%esi + movl %eax, %edi + roll $5, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %ebp, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %edi, %esi + /* 20_39 61 */ + movl 52(%esp), %edi + movl 60(%esp), %ebp + xorl %ebp, %edi + movl 20(%esp), %ebp + xorl %ebp, %edi + movl 40(%esp), %ebp + xorl %ebp, %edi + movl %eax, %ebp +.byte 209 +.byte 199 /* roll $1 %edi */ + xorl %ebx, %ebp + movl %edi, 52(%esp) + xorl %ecx, %ebp + leal 3395469782(%edi,%edx,1),%edi + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %edi + /* 20_39 62 */ + movl 56(%esp), %edx + movl (%esp), %ebp + xorl %ebp, %edx + movl 24(%esp), %ebp + xorl %ebp, %edx + movl 44(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + xorl %eax, %ebp + movl %edx, 56(%esp) + xorl %ebx, %ebp + leal 3395469782(%edx,%ecx,1),%edx + movl %edi, %ecx + roll $5, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ebp, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ecx, %edx + /* 20_39 63 */ + movl 60(%esp), %ecx + movl 4(%esp), %ebp + xorl %ebp, %ecx + movl 28(%esp), %ebp + xorl %ebp, %ecx + movl 48(%esp), %ebp + xorl %ebp, %ecx + movl %edi, %ebp +.byte 209 +.byte 193 /* roll $1 %ecx */ + xorl %esi, %ebp + movl %ecx, 60(%esp) + xorl %eax, %ebp + leal 3395469782(%ecx,%ebx,1),%ecx + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ecx + /* 20_39 64 */ + movl (%esp), %ebx + movl 8(%esp), %ebp + xorl %ebp, %ebx + movl 32(%esp), %ebp + xorl %ebp, %ebx + movl 52(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + xorl %edi, %ebp + movl %ebx, (%esp) + xorl %esi, %ebp + leal 3395469782(%ebx,%eax,1),%ebx + movl %ecx, %eax + roll $5, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %ebp, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %eax, %ebx + /* 20_39 65 */ + movl 4(%esp), %eax + movl 12(%esp), %ebp + xorl %ebp, %eax + movl 36(%esp), %ebp + xorl %ebp, %eax + movl 56(%esp), %ebp + xorl %ebp, %eax + movl %ecx, %ebp +.byte 209 +.byte 192 /* roll $1 %eax */ + xorl %edx, %ebp + movl %eax, 4(%esp) + xorl %edi, %ebp + leal 3395469782(%eax,%esi,1),%eax + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %eax + /* 20_39 66 */ + movl 8(%esp), %esi + movl 16(%esp), %ebp + xorl %ebp, %esi + movl 40(%esp), %ebp + xorl %ebp, %esi + movl 60(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + xorl %ecx, %ebp + movl %esi, 8(%esp) + xorl %edx, %ebp + leal 3395469782(%esi,%edi,1),%esi + movl %eax, %edi + roll $5, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %ebp, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %edi, %esi + /* 20_39 67 */ + movl 12(%esp), %edi + movl 20(%esp), %ebp + xorl %ebp, %edi + movl 44(%esp), %ebp + xorl %ebp, %edi + movl (%esp), %ebp + xorl %ebp, %edi + movl %eax, %ebp +.byte 209 +.byte 199 /* roll $1 %edi */ + xorl %ebx, %ebp + movl %edi, 12(%esp) + xorl %ecx, %ebp + leal 3395469782(%edi,%edx,1),%edi + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %edi + /* 20_39 68 */ + movl 16(%esp), %edx + movl 24(%esp), %ebp + xorl %ebp, %edx + movl 48(%esp), %ebp + xorl %ebp, %edx + movl 4(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + xorl %eax, %ebp + movl %edx, 16(%esp) + xorl %ebx, %ebp + leal 3395469782(%edx,%ecx,1),%edx + movl %edi, %ecx + roll $5, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ebp, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ecx, %edx + /* 20_39 69 */ + movl 20(%esp), %ecx + movl 28(%esp), %ebp + xorl %ebp, %ecx + movl 52(%esp), %ebp + xorl %ebp, %ecx + movl 8(%esp), %ebp + xorl %ebp, %ecx + movl %edi, %ebp +.byte 209 +.byte 193 /* roll $1 %ecx */ + xorl %esi, %ebp + movl %ecx, 20(%esp) + xorl %eax, %ebp + leal 3395469782(%ecx,%ebx,1),%ecx + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ecx + /* 20_39 70 */ + movl 24(%esp), %ebx + movl 32(%esp), %ebp + xorl %ebp, %ebx + movl 56(%esp), %ebp + xorl %ebp, %ebx + movl 12(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + xorl %edi, %ebp + movl %ebx, 24(%esp) + xorl %esi, %ebp + leal 3395469782(%ebx,%eax,1),%ebx + movl %ecx, %eax + roll $5, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %ebp, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %eax, %ebx + /* 20_39 71 */ + movl 28(%esp), %eax + movl 36(%esp), %ebp + xorl %ebp, %eax + movl 60(%esp), %ebp + xorl %ebp, %eax + movl 16(%esp), %ebp + xorl %ebp, %eax + movl %ecx, %ebp +.byte 209 +.byte 192 /* roll $1 %eax */ + xorl %edx, %ebp + movl %eax, 28(%esp) + xorl %edi, %ebp + leal 3395469782(%eax,%esi,1),%eax + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %eax + /* 20_39 72 */ + movl 32(%esp), %esi + movl 40(%esp), %ebp + xorl %ebp, %esi + movl (%esp), %ebp + xorl %ebp, %esi + movl 20(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + xorl %ecx, %ebp + movl %esi, 32(%esp) + xorl %edx, %ebp + leal 3395469782(%esi,%edi,1),%esi + movl %eax, %edi + roll $5, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %ebp, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %edi, %esi + /* 20_39 73 */ + movl 36(%esp), %edi + movl 44(%esp), %ebp + xorl %ebp, %edi + movl 4(%esp), %ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + xorl %ebp, %edi + movl %eax, %ebp +.byte 209 +.byte 199 /* roll $1 %edi */ + xorl %ebx, %ebp + movl %edi, 36(%esp) + xorl %ecx, %ebp + leal 3395469782(%edi,%edx,1),%edi + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %edi + /* 20_39 74 */ + movl 40(%esp), %edx + movl 48(%esp), %ebp + xorl %ebp, %edx + movl 8(%esp), %ebp + xorl %ebp, %edx + movl 28(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + xorl %eax, %ebp + movl %edx, 40(%esp) + xorl %ebx, %ebp + leal 3395469782(%edx,%ecx,1),%edx + movl %edi, %ecx + roll $5, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ebp, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ecx, %edx + /* 20_39 75 */ + movl 44(%esp), %ecx + movl 52(%esp), %ebp + xorl %ebp, %ecx + movl 12(%esp), %ebp + xorl %ebp, %ecx + movl 32(%esp), %ebp + xorl %ebp, %ecx + movl %edi, %ebp +.byte 209 +.byte 193 /* roll $1 %ecx */ + xorl %esi, %ebp + movl %ecx, 44(%esp) + xorl %eax, %ebp + leal 3395469782(%ecx,%ebx,1),%ecx + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ecx + /* 20_39 76 */ + movl 48(%esp), %ebx + movl 56(%esp), %ebp + xorl %ebp, %ebx + movl 16(%esp), %ebp + xorl %ebp, %ebx + movl 36(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + xorl %edi, %ebp + movl %ebx, 48(%esp) + xorl %esi, %ebp + leal 3395469782(%ebx,%eax,1),%ebx + movl %ecx, %eax + roll $5, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %ebp, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %eax, %ebx + /* 20_39 77 */ + movl 52(%esp), %eax + movl 60(%esp), %ebp + xorl %ebp, %eax + movl 20(%esp), %ebp + xorl %ebp, %eax + movl 40(%esp), %ebp + xorl %ebp, %eax + movl %ecx, %ebp +.byte 209 +.byte 192 /* roll $1 %eax */ + xorl %edx, %ebp + movl %eax, 52(%esp) + xorl %edi, %ebp + leal 3395469782(%eax,%esi,1),%eax + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %eax + /* 20_39 78 */ + movl 56(%esp), %esi + movl (%esp), %ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + xorl %ebp, %esi + movl 44(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + xorl %ecx, %ebp + movl %esi, 56(%esp) + xorl %edx, %ebp + leal 3395469782(%esi,%edi,1),%esi + movl %eax, %edi + roll $5, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %ebp, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %edi, %esi + /* 20_39 79 */ + movl 60(%esp), %edi + movl 4(%esp), %ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + xorl %ebp, %edi + movl 48(%esp), %ebp + xorl %ebp, %edi + movl %eax, %ebp +.byte 209 +.byte 199 /* roll $1 %edi */ + xorl %ebx, %ebp + movl %edi, 60(%esp) + xorl %ecx, %ebp + leal 3395469782(%edi,%edx,1),%edi + movl %esi, %edx + roll $5, %edx + addl %ebp, %edx + movl 92(%esp), %ebp +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %edi +.byte 209 +.byte 200 /* rorl $1 %eax */ + /* End processing */ + + movl 12(%ebp), %edx + addl %ebx, %edx + movl 4(%ebp), %ebx + addl %esi, %ebx + movl %eax, %esi + movl (%ebp), %eax + movl %edx, 12(%ebp) + addl %edi, %eax + movl 16(%ebp), %edi + addl %ecx, %edi + movl 8(%ebp), %ecx + addl %esi, %ecx + movl %eax, (%ebp) + movl 64(%esp), %esi + movl %ecx, 8(%ebp) + addl $64, %esi + movl 68(%esp), %eax + movl %edi, 16(%ebp) + cmpl %esi, %eax + movl %ebx, 4(%ebp) + jl .L001end + movl (%esi), %eax + jmp .L000start +.L001end: + addl $72, %esp + popl %edi + popl %ebx + popl %ebp + popl %esi + ret +.sha1_block_x86_end: + SIZE(sha1_block_x86,.sha1_block_x86_end-sha1_block_x86) +.ident "desasm.pl" diff --git a/src/lib/libcrypto/sha/sha_sgst.c b/src/lib/libcrypto/sha/sha_sgst.c new file mode 100644 index 0000000000..8a16801328 --- /dev/null +++ b/src/lib/libcrypto/sha/sha_sgst.c @@ -0,0 +1,246 @@ +/* crypto/sha/sha_sgst.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdlib.h> +#include <string.h> + +#ifdef undef +/* one or the other needs to be defined */ +#ifndef SHA_1 /* FIPE 180-1 */ +#define SHA_0 /* FIPS 180 */ +#endif +#endif + +#define ULONG unsigned long +#define UCHAR unsigned char +#define UINT unsigned int + +#ifdef NOCONST +#define const +#endif + +#undef c2nl +#define c2nl(c,l) (l =(((unsigned long)(*((c)++)))<<24), \ + l|=(((unsigned long)(*((c)++)))<<16), \ + l|=(((unsigned long)(*((c)++)))<< 8), \ + l|=(((unsigned long)(*((c)++))) )) + +#undef p_c2nl +#define p_c2nl(c,l,n) { \ + switch (n) { \ + case 0: l =((unsigned long)(*((c)++)))<<24; \ + case 1: l|=((unsigned long)(*((c)++)))<<16; \ + case 2: l|=((unsigned long)(*((c)++)))<< 8; \ + case 3: l|=((unsigned long)(*((c)++))); \ + } \ + } + +#undef c2nl_p +/* NOTE the pointer is not incremented at the end of this */ +#define c2nl_p(c,l,n) { \ + l=0; \ + (c)+=n; \ + switch (n) { \ + case 3: l =((unsigned long)(*(--(c))))<< 8; \ + case 2: l|=((unsigned long)(*(--(c))))<<16; \ + case 1: l|=((unsigned long)(*(--(c))))<<24; \ + } \ + } + +#undef p_c2nl_p +#define p_c2nl_p(c,l,sc,len) { \ + switch (sc) \ + { \ + case 0: l =((unsigned long)(*((c)++)))<<24; \ + if (--len == 0) break; \ + case 1: l|=((unsigned long)(*((c)++)))<<16; \ + if (--len == 0) break; \ + case 2: l|=((unsigned long)(*((c)++)))<< 8; \ + } \ + } + +#undef nl2c +#define nl2c(l,c) (*((c)++)=(unsigned char)(((l)>>24)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16)&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ + *((c)++)=(unsigned char)(((l) )&0xff)) + +#undef c2l +#define c2l(c,l) (l =(((unsigned long)(*((c)++))) ), \ + l|=(((unsigned long)(*((c)++)))<< 8), \ + l|=(((unsigned long)(*((c)++)))<<16), \ + l|=(((unsigned long)(*((c)++)))<<24)) + +#undef p_c2l +#define p_c2l(c,l,n) { \ + switch (n) { \ + case 0: l =((unsigned long)(*((c)++))); \ + case 1: l|=((unsigned long)(*((c)++)))<< 8; \ + case 2: l|=((unsigned long)(*((c)++)))<<16; \ + case 3: l|=((unsigned long)(*((c)++)))<<24; \ + } \ + } + +#undef c2l_p +/* NOTE the pointer is not incremented at the end of this */ +#define c2l_p(c,l,n) { \ + l=0; \ + (c)+=n; \ + switch (n) { \ + case 3: l =((unsigned long)(*(--(c))))<<16; \ + case 2: l|=((unsigned long)(*(--(c))))<< 8; \ + case 1: l|=((unsigned long)(*(--(c)))); \ + } \ + } + +#undef p_c2l_p +#define p_c2l_p(c,l,sc,len) { \ + switch (sc) \ + { \ + case 0: l =((unsigned long)(*((c)++))); \ + if (--len == 0) break; \ + case 1: l|=((unsigned long)(*((c)++)))<< 8; \ + if (--len == 0) break; \ + case 2: l|=((unsigned long)(*((c)++)))<<16; \ + } \ + } + +#undef l2c +#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16)&0xff), \ + *((c)++)=(unsigned char)(((l)>>24)&0xff)) + +#undef ROTATE +#if defined(WIN32) +#define ROTATE(a,n) _lrotl(a,n) +#else +#define ROTATE(a,n) (((a)<<(n))|(((a)&0xffffffff)>>(32-(n)))) +#endif + +/* A nice byte order reversal from Wei Dai <weidai@eskimo.com> */ +#if defined(WIN32) +/* 5 instructions with rotate instruction, else 9 */ +#define Endian_Reverse32(a) \ + { \ + unsigned long l=(a); \ + (a)=((ROTATE(l,8)&0x00FF00FF)|(ROTATE(l,24)&0xFF00FF00)); \ + } +#else +/* 6 instructions with rotate instruction, else 8 */ +#define Endian_Reverse32(a) \ + { \ + unsigned long l=(a); \ + l=(((l&0xFF00FF00)>>8L)|((l&0x00FF00FF)<<8L)); \ + (a)=ROTATE(l,16L); \ + } +#endif + +/* As pointed out by Wei Dai <weidai@eskimo.com>, F() below can be + * simplified to the code in F_00_19. Wei attributes these optimisations + * to Peter Gutmann's SHS code, and he attributes it to Rich Schroeppel. + * #define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) + * I've just become aware of another tweak to be made, again from Wei Dai, + * in F_40_59, (x&a)|(y&a) -> (x|y)&a + */ +#define F_00_19(b,c,d) ((((c) ^ (d)) & (b)) ^ (d)) +#define F_20_39(b,c,d) ((b) ^ (c) ^ (d)) +#define F_40_59(b,c,d) (((b) & (c)) | (((b)|(c)) & (d))) +#define F_60_79(b,c,d) F_20_39(b,c,d) + +#ifdef SHA_0 +#undef Xupdate +#define Xupdate(a,i,ia,ib,ic,id) X[(i)&0x0f]=(a)=\ + (ia[(i)&0x0f]^ib[((i)+2)&0x0f]^ic[((i)+8)&0x0f]^id[((i)+13)&0x0f]); +#endif +#ifdef SHA_1 +#undef Xupdate +#define Xupdate(a,i,ia,ib,ic,id) (a)=\ + (ia[(i)&0x0f]^ib[((i)+2)&0x0f]^ic[((i)+8)&0x0f]^id[((i)+13)&0x0f]);\ + X[(i)&0x0f]=(a)=ROTATE((a),1); +#endif + +#define BODY_00_15(i,a,b,c,d,e,f,xa) \ + (f)=xa[i]+(e)+K_00_19+ROTATE((a),5)+F_00_19((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_16_19(i,a,b,c,d,e,f,xa,xb,xc,xd) \ + Xupdate(f,i,xa,xb,xc,xd); \ + (f)+=(e)+K_00_19+ROTATE((a),5)+F_00_19((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_20_31(i,a,b,c,d,e,f,xa,xb,xc,xd) \ + Xupdate(f,i,xa,xb,xc,xd); \ + (f)+=(e)+K_20_39+ROTATE((a),5)+F_20_39((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_32_39(i,a,b,c,d,e,f,xa) \ + Xupdate(f,i,xa,xa,xa,xa); \ + (f)+=(e)+K_20_39+ROTATE((a),5)+F_20_39((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_40_59(i,a,b,c,d,e,f,xa) \ + Xupdate(f,i,xa,xa,xa,xa); \ + (f)+=(e)+K_40_59+ROTATE((a),5)+F_40_59((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_60_79(i,a,b,c,d,e,f,xa) \ + Xupdate(f,i,xa,xa,xa,xa); \ + (f)=X[(i)&0x0f]+(e)+K_60_79+ROTATE((a),5)+F_60_79((b),(c),(d)); \ + (b)=ROTATE((b),30); + diff --git a/src/lib/libcrypto/util/mklink.sh b/src/lib/libcrypto/util/mklink.sh new file mode 100644 index 0000000000..1e052ed6ee --- /dev/null +++ b/src/lib/libcrypto/util/mklink.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# +# A bit of an ugly shell script used to actually 'link' files. +# Used by 'make links' +# + +PATH=$PATH:.:util:../util:../../util +export PATH + +from=$1 +shift + +here=`pwd` +tmp=`dirname $from` +while [ "$tmp"x != "x" -a "$tmp"x != ".x" ] +do + t=`basename $here` + here=`dirname $here` + to="/$t$to" + tmp=`dirname $tmp` +done +to=..$to + +#echo from=$from +#echo to =$to +#exit 1 + +if [ "$*"x != "x" ]; then + for i in $* + do + /bin/rm -f $from/$i + point.sh $to/$i $from/$i + done +fi +exit 0; diff --git a/src/lib/libcrypto/util/ranlib.sh b/src/lib/libcrypto/util/ranlib.sh new file mode 100644 index 0000000000..543f712c6b --- /dev/null +++ b/src/lib/libcrypto/util/ranlib.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +cwd=`pwd` +cd /tmp + +if [ -s /bin/ranlib ] ; then + RL=/bin/ranlib +else if [ -s /usr/bin/ranlib ] ; then + RL=/usr/bin/ranlib +fi +fi + +if [ "x$RL" != "x" ] +then + case "$1" in + /*) + $RL "$1" + ;; + *) + $RL "$cwd/$1" + ;; + esac +fi diff --git a/src/lib/libcrypto/util/sep_lib.sh b/src/lib/libcrypto/util/sep_lib.sh new file mode 100644 index 0000000000..2348db874e --- /dev/null +++ b/src/lib/libcrypto/util/sep_lib.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +cwd=`pwd` +/bin/rm -fr tmp/* + +cd crypto/des +make -f Makefile.uni tar +make -f Makefile.uni tar_lit +/bin/mv libdes.tgz $cwd/tmp +/bin/mv libdes-l.tgz $cwd/tmp +cd $cwd + +for name in md5 sha cast bf idea rc4 rc2 +do + echo doing $name + (cd crypto; tar cfh - $name)|(cd tmp; tar xf -) + cd tmp/$name + /bin/rm -f Makefile + /bin/rm -f Makefile.ssl + /bin/rm -f Makefile.ssl.orig + /bin/rm -f *.old + /bin/mv Makefile.uni Makefile + + cp $cwd/util/ranlib.sh . + chmod +x ranlib.sh + + if [ -d asm ]; then + mkdir asm/perlasm + cp $cwd/crypto/perlasm/*.pl asm/perlasm + fi + cd .. + tar cf - $name|gzip >$name.tgz +# /bin/rm -fr $name + cd $cwd +done + + diff --git a/src/lib/libcrypto/util/ssldir.pl b/src/lib/libcrypto/util/ssldir.pl new file mode 100644 index 0000000000..10584686da --- /dev/null +++ b/src/lib/libcrypto/util/ssldir.pl @@ -0,0 +1,52 @@ +#!/usr/bin/perl + +$#ARGV == 0 || die "usage: ssldir.pl /new/path\n"; +@files=('crypto/cryptlib.h', + 'Makefile.ssl', + 'tools/c_rehash', + 'util/mk1mf.pl', + ); + +%cryptlib=( + '\sX509_CERT_AREA\s',"#define X509_CERT_AREA\t\t".'"%s"', + '\sX509_CERT_DIR\s', "#define X509_CERT_DIR\t\t".'"%s/certs"', + '\sX509_CERT_FILE\s', "#define X509_CERT_FILE\t\t".'"%s/cert.pem"', + '\sX509_PRIVATE_DIR\s',"#define X509_PRIVATE_DIR\t".'"%s/private"', + ); + +%Makefile_ssl=( + '^INSTALLTOP=','INSTALLTOP=%s', + ); + +%c_rehash=( + '^DIR=', 'DIR=%s', + ); + +%mk1mf=( + '^$INSTALLTOP=','$INSTALLTOP="%s";', + ); + +&dofile("crypto/cryptlib.h",$ARGV[0],%cryptlib); +&dofile("Makefile.ssl",$ARGV[0],%Makefile_ssl); +&dofile("tools/c_rehash",$ARGV[0],%c_rehash); +&dofile("util/mk1mf.pl",$ARGV[0],%mk1mf); + +sub dofile + { + ($f,$p,%m)=@_; + + open(IN,"<$f") || die "unable to open $f:$!\n"; + @a=<IN>; + close(IN); + foreach $k (keys %m) + { + grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a); + } + ($ff=$f) =~ s/\..*$//; + open(OUT,">$ff.new") || die "unable to open $f:$!\n"; + print OUT @a; + close(OUT); + rename($f,"$ff.old") || die "unable to rename $f\n"; + rename("$ff.new",$f) || die "unable to rename $ff.new\n"; + } + diff --git a/src/lib/libcrypto/util/up_ver.pl b/src/lib/libcrypto/util/up_ver.pl new file mode 100644 index 0000000000..32c086b2aa --- /dev/null +++ b/src/lib/libcrypto/util/up_ver.pl @@ -0,0 +1,79 @@ +#!/usr/bin/perl +# +# Up the version numbers in the files. +# + +@files=( + "crypto/crypto.h", + "crypto/des/ecb_enc.c", + "crypto/idea/i_ecb.c", + "crypto/lhash/lhash.c", + "crypto/conf/conf.c", + "crypto/md2/md2_dgst.c", + "crypto/md5/md5_dgst.c", + "crypto/ripemd/rmd_dgst.c", + "crypto/pem/pem_lib.c", + "crypto/bn/bn_lib.c", + "crypto/dh/dh_lib.c", + "crypto/rc2/rc2_ecb.c", + "crypto/rc4/rc4_skey.c", + "crypto/rc5/rc5_ecb.c", + "crypto/bf/bf_ecb.c", + "crypto/cast/c_ecb.c", + "crypto/rsa/rsa_lib.c", + "crypto/dsa/dsa_lib.c", + "crypto/sha/sha1dgst.c", + "crypto/sha/sha_dgst.c", + "crypto/asn1/asn1_lib.c", + "crypto/x509/x509_vfy.c", + "crypto/evp/evp_enc.c", + "crypto/rand/md_rand.c", + "crypto/stack/stack.c", + "crypto/txt_db/txt_db.c", + "crypto/cversion.c", + "ssl/ssl_lib.c", + "ssl/s2_lib.c", + "ssl/s3_lib.c", + "ssl/t1_lib.c", + "README", + ); + +@month=('Jan','Feb','Mar','Apr','May','Jun', + 'Jul','Aug','Sep','Oct','Nov','Dec'); +@a=localtime(time()); +$time=sprintf("%02d-%s-%04d",$a[3],$month[$a[4]],$a[5]+1900); + +$ver=$ARGV[0]; +($ver ne "") || die "no version number specified\n"; +($a,$b,$c,$d)=unpack('axaxac',$ver); +$d=defined($d)?$d-96:0; +$xver=sprintf("%x%x%x%x",$a,$b,$c,$d); + +foreach $file (@files) + { + open(IN,"<$file") || die "unable to open $file:$!\n"; + open(OUT,">$file.new") || die "unable to open $file.new:$!\n"; + $found=0; + + print STDERR "$file:"; + + while (<IN>) + { + if ((s/SSLeay \d\.\d.\d[^"]*(\"|\s)/SSLeay $ver $time\1/) || + s/^(\#define\s+SSLEAY_VERSION_NUMBER\s+0x)[0-9a-zA-Z]+(.*)$/$1$xver$2/) + { + print STDERR " Done"; + $found++; + print OUT; + while (<IN>) { print OUT; } + last; + } + print OUT; + } + print STDERR "\n"; + close(IN); + close(OUT); + (!$found) && die "unable to update the version number in $file\n"; + rename($file,"$file.old") || die "unable to rename $file:$!\n"; + rename("$file.new",$file) || die "unable to rename $file.new:$!\n"; + } diff --git a/src/lib/libcrypto/x509/attrib b/src/lib/libcrypto/x509/attrib new file mode 100644 index 0000000000..37f6cd755f --- /dev/null +++ b/src/lib/libcrypto/x509/attrib @@ -0,0 +1,38 @@ + +PKCS7 + STACK of X509_ATTRIBUTES + ASN1_OBJECT + STACK of ASN1_TYPE + +So it is + +p7.xa[].obj +p7.xa[].data[] + +get_obj_by_nid(STACK , nid) +get_num_by_nid(STACK , nid) +get_data_by_nid(STACK , nid, index) + +X509_ATTRIBUTE *X509_ATTRIBUTE_new(void ); +void X509_ATTRIBUTE_free(X509_ATTRIBUTE *a); + +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **ex, + int nid, STACK *value); + +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **ex, + int nid, STACK *value); + +int X509_ATTRIBUTE_set_object(X509_ATTRIBUTE *ex,ASN1_OBJECT *obj); +int X509_ATTRIBUTE_add_data(X509_ATTRIBUTE *ex, int index, + ASN1_TYPE *value); + +ASN1_OBJECT * X509_ATTRIBUTE_get_object(X509_ATTRIBUTE *ex); +int X509_ATTRIBUTE_get_num(X509_ATTRIBUTE *ne); +ASN1_TYPE * X509_ATTRIBUTE_get_data(X509_ATTRIBUTE *ne,int index); + +ASN1_TYPE * X509_ATTRIBUTE_get_data_by_NID(X509_ATTRIBUTE *ne, + ASN1_OBJECT *obj); + +X509_ATTRUBUTE *PKCS7_get_s_att_by_NID(PKCS7 *p7,int nid); +X509_ATTRUBUTE *PKCS7_get_u_att_by_NID(PKCS7 *p7,int nid); + diff --git a/src/lib/libcrypto/x509/v3_net.c b/src/lib/libcrypto/x509/v3_net.c new file mode 100644 index 0000000000..0c2d276d13 --- /dev/null +++ b/src/lib/libcrypto/x509/v3_net.c @@ -0,0 +1,87 @@ +/* crypto/x509/v3_net.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "stack.h" +#include "cryptlib.h" +#include "asn1.h" +#include "objects.h" +#include "x509.h" + +#define NETSCAPE_X509_EXT_NUM 8 + +static X509_EXTENSION_METHOD netscape_x509_ext[NETSCAPE_X509_EXT_NUM]={ +{NID_netscape_ca_policy_url, V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, +{NID_netscape_ssl_server_name, V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, +{NID_netscape_revocation_url, V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, +{NID_netscape_base_url,V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, +{NID_netscape_cert_type,V_ASN1_BIT_STRING,X509_EXT_PACK_STRING}, +{NID_netscape_ca_revocation_url,V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, +{NID_netscape_renewal_url,V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, +{NID_netscape_comment,V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, + }; + +int X509v3_add_netscape_extensions() + { + int i; + + for (i=0; i<NETSCAPE_X509_EXT_NUM; i++) + if (!X509v3_add_extension(&(netscape_x509_ext[i]))) + return(0); + return(1); + } diff --git a/src/lib/libcrypto/x509/v3_x509.c b/src/lib/libcrypto/x509/v3_x509.c new file mode 100644 index 0000000000..f685aa4c71 --- /dev/null +++ b/src/lib/libcrypto/x509/v3_x509.c @@ -0,0 +1,253 @@ +/* crypto/x509/v3_x509.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include <ctype.h> +#include "stack.h" +#include "cryptlib.h" +#include "bio.h" +#include "asn1.h" +#include "objects.h" +#include "x509.h" + +#if 0 +static int i2a_key_usage(BIO *bp, X509 *x); +static int a2i_key_usage(X509 *x, char *str, int len); +#endif + +int X509v3_get_key_usage(X509 *x); +int X509v3_set_key_usage(X509 *x,unsigned int use); +int i2a_X509v3_key_usage(BIO *bp, unsigned int use); +unsigned int a2i_X509v3_key_usage(char *p); + +#define STD_X509_EXT_NUM 9 + +#if 0 +static X509_OBJECTS std_x509_ext[STD_X509_EXT_NUM]={ +{NID_subject_key_identifier, NULL,NULL}, +{NID_key_usage, a2i_key_usage,i2a_key_usage}, /**/ +{NID_private_key_usage_period, NULL,NULL}, +{NID_subject_alt_name, NULL,NULL}, +{NID_issuer_alt_name, NULL,NULL}, +{NID_basic_constraints, NULL,NULL}, +{NID_crl_number, NULL,NULL}, +{NID_certificate_policies, NULL,NULL}, +{NID_authority_key_identifier, NULL,NULL}, + }; +#endif + +int X509v3_add_standard_extensions() + { + +#if 0 + for (i=0; i<STD_X509_EXT_NUM; i++) + if (!X509v3_add_extension(&(std_x509_ext[i]))) + return(0); +#endif + return(1); + } + +int X509v3_get_key_usage(x) +X509 *x; + { + X509_EXTENSION *ext; + ASN1_STRING *st; + char *p; + int i; + + i=X509_get_ext_by_NID(x,NID_key_usage,-1); + if (i < 0) return(X509v3_KU_UNDEF); + ext=X509_get_ext(x,i); + st=X509v3_unpack_string(NULL,V_ASN1_BIT_STRING, + X509_EXTENSION_get_data(X509_get_ext(x,i))); + + p=(char *)ASN1_STRING_data(st); + if (ASN1_STRING_length(st) == 1) + i=p[0]; + else if (ASN1_STRING_length(st) == 2) + i=p[0]|(p[1]<<8); + else + i=0; + return(i); + } + +static struct + { + char *name; + unsigned int value; + } key_usage_data[] ={ + {"digitalSignature", X509v3_KU_DIGITAL_SIGNATURE}, + {"nonRepudiation", X509v3_KU_NON_REPUDIATION}, + {"keyEncipherment", X509v3_KU_KEY_ENCIPHERMENT}, + {"dataEncipherment", X509v3_KU_DATA_ENCIPHERMENT}, + {"keyAgreement", X509v3_KU_KEY_AGREEMENT}, + {"keyCertSign", X509v3_KU_KEY_CERT_SIGN}, + {"cRLSign", X509v3_KU_CRL_SIGN}, + {"encipherOnly", X509v3_KU_ENCIPHER_ONLY}, + {"decipherOnly", X509v3_KU_DECIPHER_ONLY}, + {NULL,0}, + }; + +#if 0 +static int a2i_key_usage(x,str,len) +X509 *x; +char *str; +int len; + { + return(X509v3_set_key_usage(x,a2i_X509v3_key_usage(str))); + } + +static int i2a_key_usage(bp,x) +BIO *bp; +X509 *x; + { + return(i2a_X509v3_key_usage(bp,X509v3_get_key_usage(x))); + } +#endif + +int i2a_X509v3_key_usage(bp,use) +BIO *bp; +unsigned int use; + { + int i=0,first=1; + + for (;;) + { + if (use | key_usage_data[i].value) + { + BIO_printf(bp,"%s%s",((first)?"":" "), + key_usage_data[i].name); + first=0; + } + } + return(1); + } + +unsigned int a2i_X509v3_key_usage(p) +char *p; + { + unsigned int ret=0; + char *q,*s; + int i,n; + + q=p; + for (;;) + { + while ((*q != '\0') && isalnum(*q)) + q++; + if (*q == '\0') break; + s=q++; + while (isalnum(*q)) + q++; + n=q-s; + i=0; + for (;;) + { + if (strncmp(key_usage_data[i].name,s,n) == 0) + { + ret|=key_usage_data[i].value; + break; + } + i++; + if (key_usage_data[i].name == NULL) + return(X509v3_KU_UNDEF); + } + } + return(ret); + } + +int X509v3_set_key_usage(x,use) +X509 *x; +unsigned int use; + { + ASN1_OCTET_STRING *os; + X509_EXTENSION *ext; + int i; + unsigned char data[4]; + + i=X509_get_ext_by_NID(x,NID_key_usage,-1); + if (i < 0) + { + i=X509_get_ext_count(x)+1; + if ((ext=X509_EXTENSION_new()) == NULL) return(0); + if (!X509_add_ext(x,ext,i)) + { + X509_EXTENSION_free(ext); + return(0); + } + } + else + ext=X509_get_ext(x,i); + + /* fill in 'ext' */ + os=X509_EXTENSION_get_data(ext); + + i=0; + if (use > 0) + { + i=1; + data[0]=use&0xff; + } + if (use > 0xff) + { + i=2; + data[1]=(use>>8)&0xff; + } + return((X509v3_pack_string(&os,V_ASN1_BIT_STRING,data,i) == NULL)?0:1); + } + diff --git a/src/lib/libcrypto/x509/x509.doc b/src/lib/libcrypto/x509/x509.doc new file mode 100644 index 0000000000..73cfc9f034 --- /dev/null +++ b/src/lib/libcrypto/x509/x509.doc @@ -0,0 +1,27 @@ +X509_verify() +X509_sign() + +X509_get_version() +X509_get_serialNumber() +X509_get_issuer() +X509_get_subject() +X509_get_notBefore() +X509_get_notAfter() +X509_get_pubkey() + +X509_set_version() +X509_set_serialNumber() +X509_set_issuer() +X509_set_subject() +X509_set_notBefore() +X509_set_notAfter() +X509_set_pubkey() + +X509_get_extensions() +X509_set_extensions() + +X509_EXTENSIONS_clear() +X509_EXTENSIONS_retrieve() +X509_EXTENSIONS_add() +X509_EXTENSIONS_delete() + diff --git a/src/lib/libcrypto/x509/x509.err b/src/lib/libcrypto/x509/x509.err new file mode 100644 index 0000000000..8d0862d7d1 --- /dev/null +++ b/src/lib/libcrypto/x509/x509.err @@ -0,0 +1,46 @@ +/* Error codes for the X509 functions. */ + +/* Function codes. */ +#define X509_F_ADD_CERT_DIR 100 +#define X509_F_BY_FILE_CTRL 101 +#define X509_F_DIR_CTRL 102 +#define X509_F_GET_CERT_BY_SUBJECT 103 +#define X509_F_X509V3_ADD_EXT 104 +#define X509_F_X509V3_ADD_EXTENSION 105 +#define X509_F_X509V3_PACK_STRING 106 +#define X509_F_X509V3_UNPACK_STRING 107 +#define X509_F_X509_EXTENSION_CREATE_BY_NID 108 +#define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 +#define X509_F_X509_GET_PUBKEY_PARAMETERS 110 +#define X509_F_X509_LOAD_CERT_FILE 111 +#define X509_F_X509_LOAD_CRL_FILE 112 +#define X509_F_X509_NAME_ADD_ENTRY 113 +#define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 +#define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 +#define X509_F_X509_NAME_ONELINE 116 +#define X509_F_X509_NAME_PRINT 117 +#define X509_F_X509_PRINT_FP 118 +#define X509_F_X509_PUBKEY_GET 119 +#define X509_F_X509_PUBKEY_SET 120 +#define X509_F_X509_REQ_PRINT 121 +#define X509_F_X509_REQ_PRINT_FP 122 +#define X509_F_X509_REQ_TO_X509 123 +#define X509_F_X509_STORE_ADD_CERT 124 +#define X509_F_X509_STORE_ADD_CRL 125 +#define X509_F_X509_TO_X509_REQ 126 +#define X509_F_X509_VERIFY_CERT 127 + +/* Reason codes. */ +#define X509_R_BAD_X509_FILETYPE 100 +#define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 +#define X509_R_ERR_ASN1_LIB 102 +#define X509_R_LOADING_CERT_DIR 103 +#define X509_R_LOADING_DEFAULTS 104 +#define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 +#define X509_R_SHOULD_RETRY 106 +#define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 +#define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 +#define X509_R_UNKNOWN_NID 109 +#define X509_R_UNKNOWN_STRING_TYPE 110 +#define X509_R_UNSUPPORTED_ALGORITHM 111 +#define X509_R_WRONG_LOOKUP_TYPE 112 diff --git a/src/lib/libcrypto/x509/x509pack.c b/src/lib/libcrypto/x509/x509pack.c new file mode 100644 index 0000000000..846f125859 --- /dev/null +++ b/src/lib/libcrypto/x509/x509pack.c @@ -0,0 +1,157 @@ +/* crypto/x509/x509pack.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "stack.h" +#include "cryptlib.h" +#include "asn1.h" +#include "objects.h" +#include "evp.h" +#include "x509.h" + +ASN1_OCTET_STRING *X509v3_pack_string(ex,type,bytes,len) +ASN1_OCTET_STRING **ex; +int type; +unsigned char *bytes; +int len; + { + ASN1_OCTET_STRING *os; + ASN1_STRING str; + unsigned char *p; + int i; + + if ((ex == NULL) || (*ex == NULL)) + os=ASN1_OCTET_STRING_new(); + else + os= *ex; + + if (len < 0) len=strlen((char *)bytes); + str.length=len; + str.type=type; + str.data=bytes; + + /* str now holds the data, we just have to copy it into ->value */ + + switch (type) + { + case V_ASN1_BIT_STRING: + i=i2d_ASN1_BIT_STRING((ASN1_BIT_STRING *)&str,NULL); + if (!ASN1_STRING_set((ASN1_STRING *)os,NULL,i)) + goto err; + p=(unsigned char *)os->data; + i2d_ASN1_BIT_STRING((ASN1_BIT_STRING *)&str,&p); + break; + case V_ASN1_OCTET_STRING: + i=i2d_ASN1_OCTET_STRING((ASN1_OCTET_STRING *)&str,NULL); + if (!ASN1_STRING_set((ASN1_STRING *)os,NULL,i)) + goto err; + p=(unsigned char *)os->data; + i2d_ASN1_OCTET_STRING((ASN1_OCTET_STRING *)&str,&p); + break; + case V_ASN1_IA5STRING: + case V_ASN1_PRINTABLESTRING: + case V_ASN1_T61STRING: + i=i2d_ASN1_bytes(&str,NULL,type,V_ASN1_UNIVERSAL); + if (!ASN1_STRING_set((ASN1_STRING *)os,NULL,i)) + goto err; + p=(unsigned char *)os->data; + i=i2d_ASN1_bytes(&str,&p,type,V_ASN1_UNIVERSAL); + break; + default: + X509err(X509_F_X509V3_PACK_STRING,X509_R_UNKNOWN_STRING_TYPE); + goto err; + } + os->length=i; + + if ((ex != NULL) && (os != *ex)) + *ex=os; + return(os); +err: + return(NULL); + } + +ASN1_STRING *X509v3_unpack_string(ex,type,os) +ASN1_STRING **ex; +int type; +ASN1_OCTET_STRING *os; + { + unsigned char *p; + ASN1_STRING *ret=NULL; + + p=os->data; + switch (type) + { + case V_ASN1_BIT_STRING: + ret=(ASN1_STRING *)d2i_ASN1_BIT_STRING( + (ASN1_BIT_STRING **)ex,&p,os->length); + break; + case V_ASN1_OCTET_STRING: + ret=(ASN1_STRING *)d2i_ASN1_OCTET_STRING( + (ASN1_BIT_STRING **)ex,&p,os->length); + break; + case V_ASN1_IA5STRING: + case V_ASN1_PRINTABLESTRING: + case V_ASN1_T61STRING: + ret=(ASN1_STRING *)d2i_ASN1_PRINTABLE(ex,&p,os->length); + break; + default: + X509err(X509_F_X509V3_UNPACK_STRING,X509_R_UNKNOWN_STRING_TYPE); + } + return(ret); + } + diff --git a/src/lib/libcrypto/x509/x509v3.doc b/src/lib/libcrypto/x509/x509v3.doc new file mode 100644 index 0000000000..1e760a9469 --- /dev/null +++ b/src/lib/libcrypto/x509/x509v3.doc @@ -0,0 +1,24 @@ +The 'new' system. + +The X509_EXTENSION_METHOD includes extensions and attributes and/or names. +Basically everthing that can be added to an X509 with an OID identifying it. + +It operates via 2 methods per object id. +int a2i_XXX(X509 *x,char *str,int len); +int i2a_XXX(BIO *bp,X509 *x); + +The a2i_XXX function will add the object with a value converted from the +string into the X509. Len can be -1 in which case the length is calculated +via strlen(str). Applications can always use direct knowledge to load and +unload the relevent objects themselves. + +i2a_XXX will print to the passed BIO, a text representation of the +relevet object. Use a memory BIO if you want it printed to a buffer :-). + +X509_add_by_NID(X509 *x,int nid,char *str,int len); +X509_add_by_OBJ(X509 *x,ASN1_OBJECT *obj,char *str,int len); + +X509_print_by_name(BIO *bp,X509 *x); +X509_print_by_NID(BIO *bp,X509 *x); +X509_print_by_OBJ(BIO *bp,X509 *x); + diff --git a/src/lib/libcrypto/x509v3/format b/src/lib/libcrypto/x509v3/format new file mode 100644 index 0000000000..3307978121 --- /dev/null +++ b/src/lib/libcrypto/x509v3/format @@ -0,0 +1,92 @@ +AuthorityKeyIdentifier + { + keyIdentifier [0] OCTET_STRING OPTIONAL + authorityCertIssuer [1] GeneralNames OPTIONAL + authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL + } + +SubjectKeyIdentifier OCTET_STRING + +KeyUsage + { + BIT_STRING + digitalSignature 0 + nonRepudiation 1 + keyEncipherment 2 + dataEncipherment 3 + keyAgreement 4 + keyCertSign 5 + cRLSign 6 + encipherOnly 7 + decipherOnly 8 + } + +extKeyUsage + { + SEQUENCE of OBJECT_IDENTIFIER + } + +privateKeyUsagePeriod + { + notBefore [0] GeneralizedTime OPTIONAL + notAfter [1] GeneralizedTime OPTIONAL + } + +certificatePoliciesSyntax + SEQUENCE of PoliciesInformation + +PoliciesInformation XXX +policyMappings XXX +supportedAlgorithms XXX + +subjectAltName + GeneralNames sequence of GeneralName + +GeneralName + { + otherName [0] INSTANCE OF OTHER-NAME + rfc882Name [1] IA5String + dNSName [2] IA5String + x400Address [3] ORAddress + directoryName [4] Name + ediPartyName [5] + { + nameAssigner [0] DirectoryString OPTIONAL + partyName [1] DirectoryString + } + uniformResourceIdentifier [6] IA5String + iPAddress [7] OCTET_STRING + registeredID [8] OBJECT_IDENTIFIER + } + +issuerAltName + GeneralNames sequence of GeneralName + +subjectDirectoryAttribute SEQUENCE of Attribute + +basicConstraints + { + cA BOOLEAN default FALSE + pathLenConstraint INTEGER OPTIONAL + } + +nameConstraints + { + permittedSubtrees [0] sequence of GeneralSubtree OPTIONAL + excludedSubtrees [1] sequence of GeneralSubtree OPTIONAL + } + +GeneralSubtree + { + base GeneralName + minimum [0] BaseDistance DEFAULT 0 + maximum [1] BaseDistance OPTIONAL + } + +PolicyConstraints + { + requiredExplicitPolicy [0] SkipCerts OPTIONAL + inhibitPolicyMapping [1] SkipCerts OPTIONAL + } +SkipCerts == INTEGER + diff --git a/src/lib/libcrypto/x509v3/header b/src/lib/libcrypto/x509v3/header new file mode 100644 index 0000000000..3d791ca3dd --- /dev/null +++ b/src/lib/libcrypto/x509v3/header @@ -0,0 +1,6 @@ +int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size) +int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a) +int i2d_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp) +ASN1_INTEGER * d2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp,long length) + + diff --git a/src/lib/libcrypto/x509v3/v3_ku.c b/src/lib/libcrypto/x509v3/v3_ku.c new file mode 100644 index 0000000000..87c7402f43 --- /dev/null +++ b/src/lib/libcrypto/x509v3/v3_ku.c @@ -0,0 +1,318 @@ +/* crypto/x509v3/v3_ku.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include <ctype.h> +#include "stack.h" +#include "cryptlib.h" +#include "bio.h" +#include "asn1.h" +#include "objects.h" +#include "x509.h" + +X509_EXTENSION_METHOD X509v3_key_usage_method= + { + NID_key_usage, + ku_clear, + ex_get_bool, + ex_set_bool, + NULL, + NULL, + NULL, + NULL, + ku_a2i, + ku_i2a, + }; + +static void ku_clear(a) +X509_EXTENSION *a; + { + } + +static int ku_expand(a) +X509_EXTENSION *a; + { + ASN1_BIT_STRING *bs; + + if (a->argp == NULL) + { + bs=X509v3_unpack_string(NULL,V_ASN1_BIT_STRING,value); + if (bs == NULL) return(0); + a->argp=(char *)bs; + a->ex_free=ASN1_STRING_free; + } + return(1); + } + +static int ku_get_bool(a,num) +X509_EXTENSION *a; +int num; + { + int ret; + ASN1_BIT_STRING *bs; + + if ((a->argp == NULL) && !ku_expand(a)) + return(-1); + bs=(ASN1_BIT_STRING *)a->argp; + ret=ASN1_BIT_STRING_get_bit(bs,num); + return(ret); + } + +static int ku_set_bool(a,num,value) +X509_EXTENSION *a; +int num; +int value; + { + ASN1_BIT_STRING *a; + + if ((a->argp == NULL) && !ku_expand(a)) + return(0); + bs=(ASN1_BIT_STRING *)a->argp; + ret=ASN1_BIT_STRING_set_bit(bs,num,value); + } + +static int ku_a2i(bio,a,buf,len) +BIO *bio; +X509_EXTENSION *a; +char *buf; +int len; + { + get token + } + +static char ku_names[X509v3_N_KU_NUM]={ + X509v3_S_KU_digitalSignature, + X509v3_S_KU_nonRepudiation, + X509v3_S_KU_keyEncipherment, + X509v3_S_KU_dataEncipherment, + X509v3_S_KU_keyAgreement, + X509v3_S_KU_keyCertSign, + X509v3_S_KU_cRLSign, + X509v3_S_KU_encipherOnly, + X509v3_S_KU_decipherOnly, + }; + +static int ku_i2a(bio,a); +BIO *bio; +X509_EXTENSION *a; + { + int i,first=1; + char *c; + + for (i=0; i<X509v3_N_KU_NUM; i++) + { + if (ku_get_bool(a,i) > 0) + { + BIO_printf(bio,"%s%s",((first)?"":" "),ku_names[i]); + first=0; + } + } + } + +/***********************/ + +int X509v3_get_key_usage(x,ret) +STACK *x; +unsigned long *ret; + { + X509_EXTENSION *ext; + ASN1_STRING *st; + char *p; + int i; + + i=X509_get_ext_by_NID(x,NID_key_usage,-1); + if (i < 0) return(X509v3_KU_UNDEF); + ext=X509_get_ext(x,i); + st=X509v3_unpack_string(NULL,V_ASN1_BIT_STRING, + X509_EXTENSION_get_data(X509_get_ext(x,i))); + + p=ASN1_STRING_data(st); + if (ASN1_STRING_length(st) == 1) + i=p[0]; + else if (ASN1_STRING_length(st) == 2) + i=p[0]|(p[1]<<8); + else + i=0; + return(i); + } + +static struct + { + char *name; + unsigned int value; + } key_usage_data[] ={ + {"digitalSignature", X509v3_KU_DIGITAL_SIGNATURE}, + {"nonRepudiation", X509v3_KU_NON_REPUDIATION}, + {"keyEncipherment", X509v3_KU_KEY_ENCIPHERMENT}, + {"dataEncipherment", X509v3_KU_DATA_ENCIPHERMENT}, + {"keyAgreement", X509v3_KU_KEY_AGREEMENT}, + {"keyCertSign", X509v3_KU_KEY_CERT_SIGN}, + {"cRLSign", X509v3_KU_CRL_SIGN}, + {"encipherOnly", X509v3_KU_ENCIPHER_ONLY}, + {"decipherOnly", X509v3_KU_DECIPHER_ONLY}, + {NULL,0}, + }; + +#if 0 +static int a2i_key_usage(x,str,len) +X509 *x; +char *str; +int len; + { + return(X509v3_set_key_usage(x,a2i_X509v3_key_usage(str))); + } + +static int i2a_key_usage(bp,x) +BIO *bp; +X509 *x; + { + return(i2a_X509v3_key_usage(bp,X509v3_get_key_usage(x))); + } +#endif + +int i2a_X509v3_key_usage(bp,use) +BIO *bp; +unsigned int use; + { + int i=0,first=1; + + for (;;) + { + if (use | key_usage_data[i].value) + { + BIO_printf(bp,"%s%s",((first)?"":" "), + key_usage_data[i].name); + first=0; + } + } + return(1); + } + +unsigned int a2i_X509v3_key_usage(p) +char *p; + { + unsigned int ret=0; + char *q,*s; + int i,n; + + q=p; + for (;;) + { + while ((*q != '\0') && isalnum(*q)) + q++; + if (*q == '\0') break; + s=q++; + while (isalnum(*q)) + q++; + n=q-s; + i=0; + for (;;) + { + if (strncmp(key_usage_data[i].name,s,n) == 0) + { + ret|=key_usage_data[i].value; + break; + } + i++; + if (key_usage_data[i].name == NULL) + return(X509v3_KU_UNDEF); + } + } + return(ret); + } + +int X509v3_set_key_usage(x,use) +X509 *x; +unsigned int use; + { + ASN1_OCTET_STRING *os; + X509_EXTENSION *ext; + int i; + unsigned char data[4]; + + i=X509_get_ext_by_NID(x,NID_key_usage,-1); + if (i < 0) + { + i=X509_get_ext_count(x)+1; + if ((ext=X509_EXTENSION_new()) == NULL) return(0); + if (!X509_add_ext(x,ext,i)) + { + X509_EXTENSION_free(ext); + return(0); + } + } + else + ext=X509_get_ext(x,i); + + /* fill in 'ext' */ + os=X509_EXTENSION_get_data(ext); + + i=0; + if (use > 0) + { + i=1; + data[0]=use&0xff; + } + if (use > 0xff) + { + i=2; + data[1]=(use>>8)&0xff; + } + return((X509v3_pack_string(&os,V_ASN1_BIT_STRING,data,i) == NULL)?0:1); + } + diff --git a/src/lib/libssl/Makefile b/src/lib/libssl/Makefile new file mode 100644 index 0000000000..d79795e0f3 --- /dev/null +++ b/src/lib/libssl/Makefile @@ -0,0 +1,12 @@ +.include <bsd.own.mk> + +ECHO= /bin/echo + +.if exists(${.OBJDIR}/src-patent) +SUBDIR= crypto-patent ssl-patent ssleay +.else +SUBDIR= crypto ssl ssleay +.endif + +.include <bsd.subdir.mk> + diff --git a/src/lib/libssl/Makefile.bsd-wrapper b/src/lib/libssl/Makefile.bsd-wrapper new file mode 100644 index 0000000000..20fc0cec1e --- /dev/null +++ b/src/lib/libssl/Makefile.bsd-wrapper @@ -0,0 +1,82 @@ +# Build wrapper for SSLeay. + +# Our lndir is hacked; specify a full path to avoid potential conflicts +# with the one installed with X11. +LNDIR= /usr/bin/lndir + + +# Figure out what flag we use to SSLeay's configure. This +# needs to be tested on all architectures. + +.if ${MACHINE_ARCH} == "i386" +SSLCONF= OpenBSD-x86 +.else +.if ${MACHINE_ARCH} == "alpha" +SSLCONF= OpenBSD-alpha +.else +.if ${MACHINE_ARCH} == "sparc" +SSLCONF= OpenBSD-bigendian +.else +##UNTESTED! +SSLCONF= OpenBSD-bigendian +.endif +.endif +.endif + + +.include <bsd.own.mk> + +#CLEANFILES = crypto/bf/bf_locl.h crypto/bn/bn.h crypto/des/des.h \ +# crypto/des/des_locl.h crypto/rc2/rc2.h crypto/md2/md2.h \ +# crypto/rc4/rc4.h crypto/rc4/rc4_locl.h crypto/idea/idea.h + +.if exists(src-patent) +SSL_SRC=src-patent +.else +SSL_SRC=src +.endif + +.BEGIN: + @if [ ${.CURDIR} != ${.OBJDIR} ]; then ${LNDIR} -s -e obj -e obj.${MACHINE_ARCH} -e Makefile.bsd-wrapper -e Makefile.ssl ${.CURDIR}; fi + +all: ${SSL_SRC}/crypto/md2/md2.h + (cd ${.OBJDIR}; ${MAKE}) + +includes: ${SSL_SRC}/crypto/md2/md2.h + (cd ${.OBJDIR}; ${MAKE} includes) + +install: + (cd ${.OBJDIR}; ${MAKE} install) + +${SSL_SRC}/crypto/md2/md2.h : ${SSL_SRC}/Makefile.ssl + (cd ${.OBJDIR}/${SSL_SRC}; /usr/bin/perl Configure ${SSLCONF}) + +${SSL_SRC}/Makefile.ssl: ${.CURDIR}/${SSL_SRC}/Makefile.ssl + (cp ${.CURDIR}/${SSL_SRC}/Makefile.ssl ${.OBJDIR}/${SSL_SRC}) + + +clean: + (cd ${.OBJDIR}; ${MAKE} clean) + +cleandir: + (cd ${.OBJDIR}; rm -f ${SSL_SRC}/crypto/md2/md2.h; ${MAKE} cleandir) + +test: + # Nothing here so far... + +depend: + # Nothing here so far... + +lint: + # Nothing here so far... + +tags: + # Nothing here so far... + +.include <bsd.obj.mk> +.include <bsd.subdir.mk> + + + + + diff --git a/src/lib/libssl/README.OPENBSD b/src/lib/libssl/README.OPENBSD new file mode 100644 index 0000000000..7cc3d0d424 --- /dev/null +++ b/src/lib/libssl/README.OPENBSD @@ -0,0 +1,66 @@ + + This is an SSLeay-0.9.0b (the b means the PKCS#1 bug is fixed) tree. + + It has the following modifcations made to it. + + 0) util/perlpath.pl has been run to change perlpath to /usr/bin + util/ssldir.pl has been run to change the ssl dir to /usr/ssl + Null check added to crypto/err/err.c (mailed to Eric Young) + to avoid problems in error handling. Includes install into + /usr/include/ssl, certs and configs are expected to be in + /etc/ssl. + + 1) Changes for openbsd compilation to have been made to + config and Configure (these have been sent to Eric Young) + +NOTES: + + Many tests will fail miserably, since most of them start + with SSL v2, which requires RSA, and of course, they barf. + idea tests will also fail. This is to be expected. Do + "make -k test" if you want to see the output and draw + your own conclusions. + + Many parts of the utility programs may not work, although things + like client and server will provided you start them in a mode + that does not require RSA to operate. + + Unlike an ssl library built to remove the offending routines + (which removes many of the things like SSL23init which many + packages like web servers use) this library does contain + stubs for everything. The patent bits will simply fail. The + idea is that this may be used as is for limited functionality, + or where possible replaced with a full function library. When + porting an app it is important to remember to try to use the + tls1 version of stuff first where possible. I.E. if you're + going to SSL-ize OpenBSD telnet, for example, call the tls1 init + functions *NOT* sslv2init or sslv23init, or you'll be dependent + on RSA and have a version that will only work with a full + function library. Use the tls versions and you'll work with + both - a good thing. + + "crypto" and "ssl" are OpenBSD style build dirs for the + libraries of the same name. "ssleay" is the build dir for the + "ssleay" executable, used to control everything vagely ssleay + like, from testing to generating certificates, to playing + simple client server games. libraries expect to install headers + in "/usr/include/ssl", libraries in /usr/lib, ssleay in /usr/sbin + +TODO: + SSLeay contains just no library docs, it's all use the + force, read the source. This should be fixed sometime. + + DSS certificate generation is a black art. This + needs to be properly documented and a comprehensive procedure + written up, at least for how to generate a cert for + a host to be used by multiple servers. beck@ has talked + to Mark Shuttleworth of Thawte, and he has agreed that + if we can get DSS hosts certs up and running Thawte will + consider providing the service (for the usual fee of course) + of for-real signing of OpenBSD host certs for those who + want a real CA for things like telnet and ftp and the like. + + Apps beyond ssleay need testing - apps that use exclusively old style + sslv2 or sslv2/3 need to be converted/modified where possible to + try the tls1 stuff, so that we can handle doing things without + RSA. diff --git a/src/lib/libssl/crypto-patent/Makefile b/src/lib/libssl/crypto-patent/Makefile new file mode 100644 index 0000000000..b08ad38763 --- /dev/null +++ b/src/lib/libssl/crypto-patent/Makefile @@ -0,0 +1,170 @@ + +LIB= crypto + +SSLEAYDIST= src-patent + +LCRYPTO_SRC= ${.CURDIR}/../${SSLEAYDIST}/crypto +SSLEAY_INC= ${.CURDIR}/../${SSLEAYDIST}/include + +.if ${MACHINE_ARCH} == "i386" +CFLAGS+= -DL_ENDIAN -DBN_ASM +.else +.if ${MACHINE_ARCH} == "alpha" +# no ENDIAN stuff defined for alpha +.else +CFLAGS+= -DB_ENDIAN +.endif +.endif + +CFLAGS+= -DNO_IDEA -DTERMIOS -DANSI_SOURCE +CFLAGS+= -I${SSLEAY_INC} +CFLAGS+= -I${LCRYPTO_SRC} +SRCS+= cryptlib.c mem.c cversion.c ex_data.c cpt_err.c +CFLAGS+= -I${LCRYPTO_SRC}/md2 +SRCS+= md2_dgst.c md2_one.c +CFLAGS+= -I${LCRYPTO_SRC}/md5 +SRCS+= md5_dgst.c md5_one.c +CFLAGS+= -I${LCRYPTO_SRC}/sha +SRCS+= sha_dgst.c sha1dgst.c sha_one.c sha1_one.c +CFLAGS+= -I${LCRYPTO_SRC}/mdc2 +SRCS+= mdc2dgst.c mdc2_one.c +CFLAGS+= -I${LCRYPTO_SRC}/hmac +SRCS+= hmac.c +CFLAGS+= -I${LCRYPTO_SRC}/ripemd +SRCS+= rmd_dgst.c rmd_one.c +CFLAGS+= -I${LCRYPTO_SRC}/des +SRCS+= cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \ + ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c \ + fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c \ + qud_cksm.c rand_key.c read_pwd.c rpc_enc.c set_key.c \ + des_enc.c fcrypt_b.c read2pwd.c \ + fcrypt.c xcbc_enc.c \ + str2key.c cfb64ede.c ofb64ede.c supp.c +CFLAGS+= -I${LCRYPTO_SRC}/rc2 +SRCS+= rc2_ecb.c rc2_skey.c rc2_cbc.c rc2cfb64.c +SRCS+= rc2ofb64.c +CFLAGS+= -I${LCRYPTO_SRC}/rc4 +SRCS+= rc4_skey.c rc4_enc.c +CFLAGS+= -I${LCRYPTO_SRC}/rc5 +SRCS+= rc5_skey.c rc5_ecb.c rc5cfb64.c rc5cfb64.c +SRCS+= rc5ofb64.c rc5_enc.c +CFLAGS+= -I${LCRYPTO_SRC}/idea +SRCS+= i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c +SRCS+= i_skey.c +CFLAGS+= -I${LCRYPTO_SRC}/bf +SRCS+= bf_skey.c bf_ecb.c bf_cfb64.c bf_ofb64.c bf_enc.c +CFLAGS+= -I${LCRYPTO_SRC}/cast +SRCS+= c_skey.c c_ecb.c c_cfb64.c c_ofb64.c c_enc.c +CFLAGS+= -I${LCRYPTO_SRC}/bn +SRCS+= bn_add.c bn_div.c bn_exp.c bn_lib.c bn_mod.c +SRCS+= bn_mul.c bn_print.c bn_rand.c bn_shift.c bn_sub.c +SRCS+= bn_word.c bn_blind.c bn_gcd.c bn_prime.c bn_err.c +SRCS+= bn_sqr.c bn_recp.c bn_mont.c bn_mpi.c +CFLAGS+= -I${LCRYPTO_SRC}/rsa +SRCS+= rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c +SRCS+= rsa_saos.c rsa_err.c rsa_pk1.c rsa_ssl.c +SRCS+= rsa_none.c +CFLAGS+= -I${LCRYPTO_SRC}/dsa +SRCS+= dsa_gen.c dsa_key.c dsa_lib.c dsa_vrf.c +SRCS+= dsa_sign.c dsa_err.c +CFLAGS+= -I${LCRYPTO_SRC}/dh +SRCS+= dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c +CFLAGS+= -I${LCRYPTO_SRC}/buffer +SRCS+= buffer.c buf_err.c +CFLAGS+= -I${LCRYPTO_SRC}/bio +SRCS+= bio_lib.c bio_cb.c bio_err.c bss_mem.c +SRCS+= bss_null.c bss_fd.c bss_file.c bss_sock.c +SRCS+= bss_conn.c bf_null.c bf_buff.c +SRCS+= b_print.c b_dump.c b_sock.c bss_acpt.c +SRCS+= bf_nbio.c +CFLAGS+= -I${LCRYPTO_SRC}/stack +SRCS+= stack.c +CFLAGS+= -I${LCRYPTO_SRC}/lhash +SRCS+= lhash.c lh_stats.c +CFLAGS+= -I${LCRYPTO_SRC}/rand +SRCS+= md_rand.c randfile.c +CFLAGS+= -I${LCRYPTO_SRC}/err +SRCS+= err.c err_all.c err_prn.c +CFLAGS+= -I${LCRYPTO_SRC}/objects +SRCS+= obj_dat.c obj_lib.c obj_err.c +CFLAGS+= -I${LCRYPTO_SRC}/evp +SRCS+= encode.c digest.c evp_enc.c evp_key.c +SRCS+= e_ecb_d.c e_cbc_d.c e_cfb_d.c e_ofb_d.c +SRCS+= e_ecb_i.c e_cbc_i.c e_cfb_i.c e_ofb_i.c +SRCS+= e_ecb_3d.c e_cbc_3d.c e_rc4.c names.c +SRCS+= e_cfb_3d.c e_ofb_3d.c e_xcbc_d.c e_ecb_r2.c +SRCS+= e_cbc_r2.c e_cfb_r2.c e_ofb_r2.c e_ecb_bf.c +SRCS+= e_cbc_bf.c e_cfb_bf.c e_ofb_bf.c e_ecb_c.c +SRCS+= e_cbc_c.c e_cfb_c.c e_ofb_c.c e_ecb_r5.c +SRCS+= e_cbc_r5.c e_cfb_r5.c e_ofb_r5.c m_null.c +SRCS+= m_md2.c m_md5.c m_sha.c m_sha1.c m_dss.c +SRCS+= m_dss1.c m_mdc2.c m_ripemd.c p_open.c +SRCS+= p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c +SRCS+= p_dec.c bio_md.c bio_b64.c bio_enc.c +SRCS+= evp_err.c e_null.c c_all.c evp_lib.c +CFLAGS+= -I${LCRYPTO_SRC}/pem +SRCS+= pem_sign.c pem_seal.c pem_info.c pem_lib.c +SRCS+= pem_all.c pem_err.c +CFLAGS+= -I${LCRYPTO_SRC}/asn1 +SRCS+= a_object.c a_bitstr.c a_utctm.c a_int.c +SRCS+= a_octet.c a_print.c a_type.c a_set.c +SRCS+= a_dup.c a_d2i_fp.c a_i2d_fp.c a_sign.c +SRCS+= a_digest.c a_verify.c x_algor.c x_val.c +SRCS+= x_pubkey.c x_sig.c x_req.c x_attrib.c +SRCS+= x_name.c x_cinf.c x_x509.c x_crl.c +SRCS+= x_info.c x_spki.c d2i_r_pr.c i2d_r_pr.c +SRCS+= d2i_r_pu.c i2d_r_pu.c d2i_s_pr.c i2d_s_pr.c +SRCS+= d2i_s_pu.c i2d_s_pu.c d2i_pu.c d2i_pr.c +SRCS+= i2d_pu.c i2d_pr.c t_req.c t_x509.c +SRCS+= t_pkey.c p7_i_s.c p7_signi.c p7_signd.c +SRCS+= p7_recip.c p7_enc_c.c p7_evp.c p7_dgst.c +SRCS+= p7_s_e.c p7_enc.c p7_lib.c f_int.c +SRCS+= f_string.c i2d_dhp.c i2d_dsap.c d2i_dhp.c +SRCS+= d2i_dsap.c n_pkey.c a_hdr.c x_pkey.c +SRCS+= a_bool.c x_exten.c asn1_par.c asn1_lib.c +SRCS+= asn1_err.c a_meth.c a_bytes.c evp_asn1.c +CFLAGS+= -I${LCRYPTO_SRC}/x509 +SRCS+= x509_def.c x509_d2.c x509_r2x.c x509_cmp.c +SRCS+= x509_obj.c x509_req.c x509_vfy.c x509_set.c +SRCS+= x509rset.c x509_err.c x509name.c x509_v3.c +SRCS+= x509_ext.c x509pack.c x509type.c x509_lu.c +SRCS+= x_all.c x509_txt.c by_file.c by_dir.c +SRCS+= v3_net.c v3_x509.c +CFLAGS+= -I${LCRYPTO_SRC}/conf +SRCS+= conf.c conf_err.c +CFLAGS+= -I${LCRYPTO_SRC}/txt_db +SRCS+= txt_db.c +CFLAGS+= -I${LCRYPTO_SRC}/pkcs7 +SRCS+= pk7_lib.c pkcs7err.c pk7_doit.c + +HDRS= asn1/asn1.h asn1/asn1_mac.h bf/blowfish.h bio/bio.h \ + bn/bn.h buffer/buffer.h cast/cast.h conf/conf.h des/des.h dh/dh.h \ + dsa/dsa.h err/err.h evp/evp.h hmac/hmac.h idea/idea.h lhash/lhash.h \ + md2/md2.h md5/md5.h mdc2/mdc2.h objects/objects.h pem/pem.h \ + pkcs7/pkcs7.h rand/rand.h rc2/rc2.h rc4/rc4.h rc5/rc5.h \ + ripemd/ripemd.h rsa/rsa.h sha/sha.h stack/stack.h txt_db/txt_db.h \ + x509/x509.h x509/x509_vfy.h crypto.h cryptall.h ../include/e_os.h + +.PATH: ${LCRYPTO_SRC}/md2 ${LCRYPTO_SRC}/md5 ${LCRYPTO_SRC}/sha ${LCRYPTO_SRC}/mdc2 \ + ${LCRYPTO_SRC}/hmac ${LCRYPTO_SRC}/ripemd ${LCRYPTO_SRC}/des ${LCRYPTO_SRC}/rc2 \ + ${LCRYPTO_SRC}/rc4 ${LCRYPTO_SRC}/rc5 ${LCRYPTO_SRC}/idea ${LCRYPTO_SRC}/bf \ + ${LCRYPTO_SRC}/cast ${LCRYPTO_SRC}/bn ${LCRYPTO_SRC}/rsa ${LCRYPTO_SRC}/dsa \ + ${LCRYPTO_SRC}/dh ${LCRYPTO_SRC}/buffer ${LCRYPTO_SRC}/bio ${LCRYPTO_SRC}/stack \ + ${LCRYPTO_SRC}/lhash ${LCRYPTO_SRC}/rand ${LCRYPTO_SRC}/err ${LCRYPTO_SRC}/objects \ + ${LCRYPTO_SRC}/evp ${LCRYPTO_SRC}/pem ${LCRYPTO_SRC}/asn1 ${LCRYPTO_SRC}/asn1 \ + ${LCRYPTO_SRC}/x509 ${LCRYPTO_SRC}/conf txt_db/txt_db.c ${LCRYPTO_SRC}/pkcs7 \ + ${LCRYPTO_SRC}/txt_db ${LCRYPTO_SRC} + +includes: + @cd ${LCRYPTO_SRC}; for i in $(HDRS); do \ + j="cmp -s ${LCRYPTO_SRC}/$$i \ + ${DESTDIR}/usr/include/ssl/`basename $$i` || \ + ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \ + ${LCRYPTO_SRC}/$$i ${DESTDIR}/usr/include/ssl"; \ + echo $$j; \ + eval "$$j"; \ + done + + +.include <bsd.lib.mk> + diff --git a/src/lib/libssl/crypto-patent/shlib_version b/src/lib/libssl/crypto-patent/shlib_version new file mode 100644 index 0000000000..893819d18f --- /dev/null +++ b/src/lib/libssl/crypto-patent/shlib_version @@ -0,0 +1,2 @@ +major=1 +minor=1 diff --git a/src/lib/libssl/crypto/Makefile b/src/lib/libssl/crypto/Makefile new file mode 100644 index 0000000000..ec9e75dd4d --- /dev/null +++ b/src/lib/libssl/crypto/Makefile @@ -0,0 +1,170 @@ + +LIB= crypto + +SSLEAYDIST= src + +LCRYPTO_SRC= ${.CURDIR}/../${SSLEAYDIST}/crypto +SSLEAY_INC= ${.CURDIR}/../${SSLEAYDIST}/include + +.if ${MACHINE_ARCH} == "i386" +CFLAGS+= -DL_ENDIAN -DBN_ASM +.else +.if ${MACHINE_ARCH} == "alpha" +# no ENDIAN stuff defined for alpha +.else +CFLAGS+= -DB_ENDIAN +.endif +.endif + +CFLAGS+= -DNO_IDEA -DTERMIOS -DANSI_SOURCE +CFLAGS+= -I${SSLEAY_INC} +CFLAGS+= -I${LCRYPTO_SRC} +SRCS+= cryptlib.c mem.c cversion.c ex_data.c cpt_err.c +CFLAGS+= -I${LCRYPTO_SRC}/md2 +SRCS+= md2_dgst.c md2_one.c +CFLAGS+= -I${LCRYPTO_SRC}/md5 +SRCS+= md5_dgst.c md5_one.c +CFLAGS+= -I${LCRYPTO_SRC}/sha +SRCS+= sha_dgst.c sha1dgst.c sha_one.c sha1_one.c +CFLAGS+= -I${LCRYPTO_SRC}/mdc2 +SRCS+= mdc2dgst.c mdc2_one.c +CFLAGS+= -I${LCRYPTO_SRC}/hmac +SRCS+= hmac.c +CFLAGS+= -I${LCRYPTO_SRC}/ripemd +SRCS+= rmd_dgst.c rmd_one.c +CFLAGS+= -I${LCRYPTO_SRC}/des +SRCS+= cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \ + ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c \ + fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c \ + qud_cksm.c rand_key.c read_pwd.c rpc_enc.c set_key.c \ + des_enc.c fcrypt_b.c read2pwd.c \ + fcrypt.c xcbc_enc.c \ + str2key.c cfb64ede.c ofb64ede.c supp.c +CFLAGS+= -I${LCRYPTO_SRC}/rc2 +SRCS+= rc2_ecb.c rc2_skey.c rc2_cbc.c rc2cfb64.c +SRCS+= rc2ofb64.c +CFLAGS+= -I${LCRYPTO_SRC}/rc4 +SRCS+= rc4_skey.c rc4_enc.c +CFLAGS+= -I${LCRYPTO_SRC}/rc5 +SRCS+= rc5_skey.c rc5_ecb.c rc5cfb64.c rc5cfb64.c +SRCS+= rc5ofb64.c rc5_enc.c +CFLAGS+= -I${LCRYPTO_SRC}/idea +SRCS+= i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c +SRCS+= i_skey.c +CFLAGS+= -I${LCRYPTO_SRC}/bf +SRCS+= bf_skey.c bf_ecb.c bf_cfb64.c bf_ofb64.c bf_enc.c +CFLAGS+= -I${LCRYPTO_SRC}/cast +SRCS+= c_skey.c c_ecb.c c_cfb64.c c_ofb64.c c_enc.c +CFLAGS+= -I${LCRYPTO_SRC}/bn +SRCS+= bn_add.c bn_div.c bn_exp.c bn_lib.c bn_mod.c +SRCS+= bn_mul.c bn_print.c bn_rand.c bn_shift.c bn_sub.c +SRCS+= bn_word.c bn_blind.c bn_gcd.c bn_prime.c bn_err.c +SRCS+= bn_sqr.c bn_recp.c bn_mont.c bn_mpi.c +CFLAGS+= -I${LCRYPTO_SRC}/rsa +SRCS+= rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c +SRCS+= rsa_saos.c rsa_err.c rsa_pk1.c rsa_ssl.c +SRCS+= rsa_none.c +CFLAGS+= -I${LCRYPTO_SRC}/dsa +SRCS+= dsa_gen.c dsa_key.c dsa_lib.c dsa_vrf.c +SRCS+= dsa_sign.c dsa_err.c +CFLAGS+= -I${LCRYPTO_SRC}/dh +SRCS+= dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c +CFLAGS+= -I${LCRYPTO_SRC}/buffer +SRCS+= buffer.c buf_err.c +CFLAGS+= -I${LCRYPTO_SRC}/bio +SRCS+= bio_lib.c bio_cb.c bio_err.c bss_mem.c +SRCS+= bss_null.c bss_fd.c bss_file.c bss_sock.c +SRCS+= bss_conn.c bf_null.c bf_buff.c +SRCS+= b_print.c b_dump.c b_sock.c bss_acpt.c +SRCS+= bf_nbio.c +CFLAGS+= -I${LCRYPTO_SRC}/stack +SRCS+= stack.c +CFLAGS+= -I${LCRYPTO_SRC}/lhash +SRCS+= lhash.c lh_stats.c +CFLAGS+= -I${LCRYPTO_SRC}/rand +SRCS+= md_rand.c randfile.c +CFLAGS+= -I${LCRYPTO_SRC}/err +SRCS+= err.c err_all.c err_prn.c +CFLAGS+= -I${LCRYPTO_SRC}/objects +SRCS+= obj_dat.c obj_lib.c obj_err.c +CFLAGS+= -I${LCRYPTO_SRC}/evp +SRCS+= encode.c digest.c evp_enc.c evp_key.c +SRCS+= e_ecb_d.c e_cbc_d.c e_cfb_d.c e_ofb_d.c +SRCS+= e_ecb_i.c e_cbc_i.c e_cfb_i.c e_ofb_i.c +SRCS+= e_ecb_3d.c e_cbc_3d.c e_rc4.c names.c +SRCS+= e_cfb_3d.c e_ofb_3d.c e_xcbc_d.c e_ecb_r2.c +SRCS+= e_cbc_r2.c e_cfb_r2.c e_ofb_r2.c e_ecb_bf.c +SRCS+= e_cbc_bf.c e_cfb_bf.c e_ofb_bf.c e_ecb_c.c +SRCS+= e_cbc_c.c e_cfb_c.c e_ofb_c.c e_ecb_r5.c +SRCS+= e_cbc_r5.c e_cfb_r5.c e_ofb_r5.c m_null.c +SRCS+= m_md2.c m_md5.c m_sha.c m_sha1.c m_dss.c +SRCS+= m_dss1.c m_mdc2.c m_ripemd.c p_open.c +SRCS+= p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c +SRCS+= p_dec.c bio_md.c bio_b64.c bio_enc.c +SRCS+= evp_err.c e_null.c c_all.c evp_lib.c +CFLAGS+= -I${LCRYPTO_SRC}/pem +SRCS+= pem_sign.c pem_seal.c pem_info.c pem_lib.c +SRCS+= pem_all.c pem_err.c +CFLAGS+= -I${LCRYPTO_SRC}/asn1 +SRCS+= a_object.c a_bitstr.c a_utctm.c a_int.c +SRCS+= a_octet.c a_print.c a_type.c a_set.c +SRCS+= a_dup.c a_d2i_fp.c a_i2d_fp.c a_sign.c +SRCS+= a_digest.c a_verify.c x_algor.c x_val.c +SRCS+= x_pubkey.c x_sig.c x_req.c x_attrib.c +SRCS+= x_name.c x_cinf.c x_x509.c x_crl.c +SRCS+= x_info.c x_spki.c d2i_r_pr.c i2d_r_pr.c +SRCS+= d2i_r_pu.c i2d_r_pu.c d2i_s_pr.c i2d_s_pr.c +SRCS+= d2i_s_pu.c i2d_s_pu.c d2i_pu.c d2i_pr.c +SRCS+= i2d_pu.c i2d_pr.c t_req.c t_x509.c +SRCS+= t_pkey.c p7_i_s.c p7_signi.c p7_signd.c +SRCS+= p7_recip.c p7_enc_c.c p7_evp.c p7_dgst.c +SRCS+= p7_s_e.c p7_enc.c p7_lib.c f_int.c +SRCS+= f_string.c i2d_dhp.c i2d_dsap.c d2i_dhp.c +SRCS+= d2i_dsap.c n_pkey.c a_hdr.c x_pkey.c +SRCS+= a_bool.c x_exten.c asn1_par.c asn1_lib.c +SRCS+= asn1_err.c a_meth.c a_bytes.c evp_asn1.c +CFLAGS+= -I${LCRYPTO_SRC}/x509 +SRCS+= x509_def.c x509_d2.c x509_r2x.c x509_cmp.c +SRCS+= x509_obj.c x509_req.c x509_vfy.c x509_set.c +SRCS+= x509rset.c x509_err.c x509name.c x509_v3.c +SRCS+= x509_ext.c x509pack.c x509type.c x509_lu.c +SRCS+= x_all.c x509_txt.c by_file.c by_dir.c +SRCS+= v3_net.c v3_x509.c +CFLAGS+= -I${LCRYPTO_SRC}/conf +SRCS+= conf.c conf_err.c +CFLAGS+= -I${LCRYPTO_SRC}/txt_db +SRCS+= txt_db.c +CFLAGS+= -I${LCRYPTO_SRC}/pkcs7 +SRCS+= pk7_lib.c pkcs7err.c pk7_doit.c + +HDRS= asn1/asn1.h asn1/asn1_mac.h bf/blowfish.h bio/bio.h \ + bn/bn.h buffer/buffer.h cast/cast.h conf/conf.h des/des.h dh/dh.h \ + dsa/dsa.h err/err.h evp/evp.h hmac/hmac.h idea/idea.h lhash/lhash.h \ + md2/md2.h md5/md5.h mdc2/mdc2.h objects/objects.h pem/pem.h \ + pkcs7/pkcs7.h rand/rand.h rc2/rc2.h rc4/rc4.h rc5/rc5.h \ + ripemd/ripemd.h rsa/rsa.h sha/sha.h stack/stack.h txt_db/txt_db.h \ + x509/x509.h x509/x509_vfy.h crypto.h cryptall.h ../include/e_os.h + +.PATH: ${LCRYPTO_SRC}/md2 ${LCRYPTO_SRC}/md5 ${LCRYPTO_SRC}/sha ${LCRYPTO_SRC}/mdc2 \ + ${LCRYPTO_SRC}/hmac ${LCRYPTO_SRC}/ripemd ${LCRYPTO_SRC}/des ${LCRYPTO_SRC}/rc2 \ + ${LCRYPTO_SRC}/rc4 ${LCRYPTO_SRC}/rc5 ${LCRYPTO_SRC}/idea ${LCRYPTO_SRC}/bf \ + ${LCRYPTO_SRC}/cast ${LCRYPTO_SRC}/bn ${LCRYPTO_SRC}/rsa ${LCRYPTO_SRC}/dsa \ + ${LCRYPTO_SRC}/dh ${LCRYPTO_SRC}/buffer ${LCRYPTO_SRC}/bio ${LCRYPTO_SRC}/stack \ + ${LCRYPTO_SRC}/lhash ${LCRYPTO_SRC}/rand ${LCRYPTO_SRC}/err ${LCRYPTO_SRC}/objects \ + ${LCRYPTO_SRC}/evp ${LCRYPTO_SRC}/pem ${LCRYPTO_SRC}/asn1 ${LCRYPTO_SRC}/asn1 \ + ${LCRYPTO_SRC}/x509 ${LCRYPTO_SRC}/conf txt_db/txt_db.c ${LCRYPTO_SRC}/pkcs7 \ + ${LCRYPTO_SRC}/txt_db ${LCRYPTO_SRC} + +includes: + @cd ${LCRYPTO_SRC}; for i in $(HDRS); do \ + j="cmp -s ${LCRYPTO_SRC}/$$i \ + ${DESTDIR}/usr/include/ssl/`basename $$i` || \ + ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \ + ${LCRYPTO_SRC}/$$i ${DESTDIR}/usr/include/ssl"; \ + echo $$j; \ + eval "$$j"; \ + done + + +.include <bsd.lib.mk> + diff --git a/src/lib/libssl/crypto/shlib_version b/src/lib/libssl/crypto/shlib_version new file mode 100644 index 0000000000..1edea46de9 --- /dev/null +++ b/src/lib/libssl/crypto/shlib_version @@ -0,0 +1,2 @@ +major=1 +minor=0 diff --git a/src/lib/libssl/src/COPYRIGHT b/src/lib/libssl/src/COPYRIGHT new file mode 100644 index 0000000000..4faa8c0a46 --- /dev/null +++ b/src/lib/libssl/src/COPYRIGHT @@ -0,0 +1,65 @@ +Copyright (C) 1997 Eric Young (eay@cryptsoft.com) +All rights reserved. + +This package is an SSL implementation written by Eric Young (eay@cryptsoft.com). +The implementation was written so as to conform with Netscapes SSL. + +This library is free for commercial and non-commercial use as long as +the following conditions are aheared to. The following conditions +apply to all code found in this distribution, be it the RC4, RSA, +lhash, DES, etc., code; not just the SSL code. The SSL documentation +included with this distribution is covered by the same copyright terms +except that the holder is Tim Hudson (tjh@cryptsoft.com). + +Please note that MD2, MD5 and IDEA are publically available standards +that contain sample implementations, I have re-coded them in my own +way but there is nothing special about those implementations. The DES +library is another mater :-). + +Copyright remains Eric Young's, and as such any Copyright notices in +the code are not to be removed. +If this package is used in a product, Eric Young should be given attribution +as the author of the parts of the library used. +This can be in the form of a textual message at program startup or +in documentation (online or textual) provided with the package. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + "This product includes cryptographic software written by + Eric Young (eay@cryptsoft.com)" + The word 'cryptographic' can be left out if the rouines from the library + being used are not cryptographic related :-). +4. If you include any Windows specific code (or a derivative thereof) from + the apps directory (application code) you must include an acknowledgement: + "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + +THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +The licence and distribution terms for any publically available version or +derivative of this code cannot be changed. i.e. this code cannot simply be +copied and put under another distribution licence +[including the GNU Public Licence.] + +The reason behind this being stated in this direct manner is past +experience in code simply being copied and the attribution removed +from it and then being distributed as part of other packages. This +implementation was a non-trivial and unpaid effort. + diff --git a/src/lib/libssl/src/HISTORY b/src/lib/libssl/src/HISTORY new file mode 100644 index 0000000000..7712100038 --- /dev/null +++ b/src/lib/libssl/src/HISTORY @@ -0,0 +1,316 @@ +16-Mar-98 + - Patch for Cray T90 from Wayne Schroeder <schroede@SDSC.EDU> + - Lots and lots of changes + +29-Jan-98 + - ASN1_BIT_STRING_set_bit()/ASN1_BIT_STRING_get_bit() from + Goetz Babin-Ebell <babinebell@trustcenter.de>. + - SSL_version() now returns SSL2_VERSION, SSL3_VERSION or + TLS1_VERSION. + +7-Jan-98 + - Finally reworked the cipher string to ciphers again, so it + works correctly + - All the app_data stuff is now ex_data with funcion calls to access. + The index is supplied by a function and 'methods' can be setup + for the types that are called on XXX_new/XXX_free. This lets + applications get notified on creation and destruction. Some of + the RSA methods could be implemented this way and I may do so. + - Oh yes, SSL under perl5 is working at the basic level. + +15-Dec-97 + - Warning - the gethostbyname cache is not fully thread safe, + but it should work well enough. + - Major internal reworking of the app_data stuff. More functions + but if you were accessing ->app_data directly, things will + stop working. + - The perlv5 stuff is working. Currently on message digests, + ciphers and the bignum library. + +9-Dec-97 + - Modified re-negotiation so that server initated re-neg + will cause a SSL_read() to return -1 should retry. + The danger otherwise was that the server and the + client could end up both trying to read when using non-blocking + sockets. + +4-Dec-97 + - Lots of small changes + - Fix for binaray mode in Windows for the FILE BIO, thanks to + Bob Denny <rdenny@dc3.com> + +17-Nov-97 + - Quite a few internal cleanups, (removal of errno, and using macros + defined in e_os.h). + - A bug in ca.c, pointed out by yasuyuki-ito@d-cruise.co.jp, where + the automactic naming out output files was being stuffed up. + +29-Oct-97 + - The Cast5 cipher has been added. MD5 and SHA-1 are now in assember + for x86. + +21-Oct-97 + - Fixed a bug in the BIO_gethostbyname() cache. + +15-Oct-97 + - cbc mode for blowfish/des/3des is now in assember. Blowfish asm + has also been improved. At this point in time, on the pentium, + md5 is %80 faster, the unoptimesed sha-1 is %79 faster, + des-cbc is %28 faster, des-ede3-cbc is %9 faster and blowfish-cbc + is %62 faster. + +12-Oct-97 + - MEM_BUF_grow() has been fixed so that it always sets the buf->length + to the value we are 'growing' to. Think of MEM_BUF_grow() as the + way to set the length value correctly. + +10-Oct-97 + - I now hash for certificate lookup on the raw DER encoded RDN (md5). + This breaks things again :-(. This is efficent since I cache + the DER encoding of the RDN. + - The text DN now puts in the numeric OID instead of UNKNOWN. + - req can now process arbitary OIDs in the config file. + - I've been implementing md5 in x86 asm, much faster :-). + - Started sha1 in x86 asm, needs more work. + - Quite a few speedups in the BN stuff. RSA public operation + has been made faster by caching the BN_MONT_CTX structure. + The calulating of the Ai where A*Ai === 1 mod m was rather + expensive. Basically a 40-50% speedup on public operations. + The RSA speedup is now 15% on pentiums and %20 on pentium + pro. + +30-Sep-97 + - After doing some profiling, I added x86 adm for bn_add_words(), + which just adds 2 arrays of longs together. A %10 speedup + for 512 and 1024 bit RSA on the pentium pro. + +29-Sep-97 + - Converted the x86 bignum assembler to us the perl scripts + for generation. + +23-Sep-97 + - If SSL_set_session() is passed a NULL session, it now clears the + current session-id. + +22-Sep-97 + - Added a '-ss_cert file' to apps/ca.c. This will sign selfsigned + certificates. + - Bug in crypto/evp/encode.c where by decoding of 65 base64 + encoded lines, one line at a time (via a memory BIO) would report + EOF after the first line was decoded. + - Fix in X509_find_by_issuer_and_serial() from + Dr Stephen Henson <shenson@bigfoot.com> + +19-Sep-97 + - NO_FP_API and NO_STDIO added. + - Put in sh config command. It auto runs Configure with the correct + parameters. + +18-Sep-97 + - Fix x509.c so if a DSA cert has different parameters to its parent, + they are left in place. Not tested yet. + +16-Sep-97 + - ssl_create_cipher_list() had some bugs, fixes from + Patrick Eisenacher <eisenach@stud.uni-frankfurt.de> + - Fixed a bug in the Base64 BIO, where it would return 1 instead + of -1 when end of input was encountered but should retry. + Basically a Base64/Memory BIO interaction problem. + - Added a HMAC set of functions in preporarion for TLS work. + +15-Sep-97 + - Top level makefile tweak - Cameron Simpson <cs@zip.com.au> + - Prime generation spead up %25 (512 bit prime, pentium pro linux) + by using montgomery multiplication in the prime number test. + +11-Sep-97 + - Ugly bug in ssl3_write_bytes(). Basically if application land + does a SSL_write(ssl,buf,len) where len > 16k, the SSLv3 write code + did not check the size and tried to copy the entire buffer. + This would tend to cause memory overwrites since SSLv3 has + a maximum packet size of 16k. If your program uses + buffers <= 16k, you would probably never see this problem. + - Fixed a new errors that were cause by malloc() not returning + 0 initialised memory.. + - SSL_OP_NETSCAPE_CA_DN_BUG was being switched on when using + SSL_CTX_set_options(ssl_ctx,SSL_OP_ALL); which was a bad thing + since this flags stops SSLeay being able to handle client + cert requests correctly. + +08-Sep-97 + - SSL_SESS_CACHE_NO_INTERNAL_LOOKUP option added. When switched + on, the SSL server routines will not use a SSL_SESSION that is + held in it's cache. This in intended to be used with the session-id + callbacks so that while the session-ids are still stored in the + cache, the decision to use them and how to look them up can be + done by the callbacks. The are the 'new', 'get' and 'remove' + callbacks. This can be used to determine the session-id + to use depending on information like which port/host the connection + is coming from. Since the are also SSL_SESSION_set_app_data() and + SSL_SESSION_get_app_data() functions, the application can hold + information against the session-id as well. + +03-Sep-97 + - Added lookup of CRLs to the by_dir method, + X509_load_crl_file() also added. Basically it means you can + lookup CRLs via the same system used to lookup certificates. + - Changed things so that the X509_NAME structure can contain + ASN.1 BIT_STRINGS which is required for the unique + identifier OID. + - Fixed some problems with the auto flushing of the session-id + cache. It was not occuring on the server side. + +02-Sep-97 + - Added SSL_CTX_sess_cache_size(SSL_CTX *ctx,unsigned long size) + which is the maximum number of entries allowed in the + session-id cache. This is enforced with a simple FIFO list. + The default size is 20*1024 entries which is rather large :-). + The Timeout code is still always operating. + +01-Sep-97 + - Added an argument to all the 'generate private key/prime` + callbacks. It is the last parameter so this should not + break existing code but it is needed for C++. + - Added the BIO_FLAGS_BASE64_NO_NL flag for the BIO_f_base64() + BIO. This lets the BIO read and write base64 encoded data + without inserting or looking for '\n' characters. The '-A' + flag turns this on when using apps/enc.c. + - RSA_NO_PADDING added to help BSAFE functionality. This is a + very dangerous thing to use, since RSA private key + operations without random padding bytes (as PKCS#1 adds) can + be attacked such that the private key can be revealed. + - ASN.1 bug and rc2-40-cbc and rc4-40 added by + Dr Stephen Henson <shenson@bigfoot.com> + +31-Aug-97 (stuff added while I was away) + - Linux pthreads by Tim Hudson (tjh@cryptsoft.com). + - RSA_flags() added allowing bypass of pub/priv match check + in ssl/ssl_rsa.c - Tim Hudson. + - A few minor bugs. + +SSLeay 0.8.1 released. + +19-Jul-97 + - Server side initated dynamic renegotiation is broken. I will fix + it when I get back from holidays. + +15-Jul-97 + - Quite a few small changes. + - INVALID_SOCKET usage cleanups from Alex Kiernan <alex@hisoft.co.uk> + +09-Jul-97 + - Added 2 new values to the SSL info callback. + SSL_CB_START which is passed when the SSL protocol is started + and SSL_CB_DONE when it has finished sucsessfully. + +08-Jul-97 + - Fixed a few bugs problems in apps/req.c and crypto/asn1/x_pkey.c + that related to DSA public/private keys. + - Added all the relevent PEM and normal IO functions to support + reading and writing RSAPublic keys. + - Changed makefiles to use ${AR} instead of 'ar r' + +07-Jul-97 + - Error in ERR_remove_state() that would leave a dangling reference + to a free()ed location - thanks to Alex Kiernan <alex@hisoft.co.uk> + - s_client now prints the X509_NAMEs passed from the server + when requesting a client cert. + - Added a ssl->type, which is one of SSL_ST_CONNECT or + SSL_ST_ACCEPT. I had to add it so I could tell if I was + a connect or an accept after the handshake had finished. + - SSL_get_client_CA_list(SSL *s) now returns the CA names + passed by the server if called by a client side SSL. + +05-Jul-97 + - Bug in X509_NAME_get_text_by_OBJ(), looking starting at index + 0, not -1 :-( Fix from Tim Hudson (tjh@cryptsoft.com). + +04-Jul-97 + - Fixed some things in X509_NAME_add_entry(), thanks to + Matthew Donald <matthew@world.net>. + - I had a look at the cipher section and though that it was a + bit confused, so I've changed it. + - I was not setting up the RC4-64-MD5 cipher correctly. It is + a MS special that appears in exported MS Money. + - Error in all my DH ciphers. Section 7.6.7.3 of the SSLv3 + spec. I was missing the two byte length header for the + ClientDiffieHellmanPublic value. This is a packet sent from + the client to the server. The SSL_OP_SSLEAY_080_CLIENT_DH_BUG + option will enable SSLeay server side SSLv3 accept either + the correct or my 080 packet format. + - Fixed a few typos in crypto/pem.org. + +02-Jul-97 + - Alias mapping for EVP_get_(digest|cipher)byname is now + performed before a lookup for actual cipher. This means + that an alias can be used to 're-direct' a cipher or a + digest. + - ASN1_read_bio() had a bug that only showed up when using a + memory BIO. When EOF is reached in the memory BIO, it is + reported as a -1 with BIO_should_retry() set to true. + +01-Jul-97 + - Fixed an error in X509_verify_cert() caused by my + miss-understanding how 'do { contine } while(0);' works. + Thanks to Emil Sit <sit@mit.edu> for educating me :-) + +30-Jun-97 + - Base64 decoding error. If the last data line did not end with + a '=', sometimes extra data would be returned. + - Another 'cut and paste' bug in x509.c related to setting up the + STDout BIO. + +27-Jun-97 + - apps/ciphers.c was not printing due to an editing error. + - Alex Kiernan <alex@hisoft.co.uk> send in a nice fix for + a library build error in util/mk1mf.pl + +26-Jun-97 + - Still did not have the auto 'experimental' code removal + script correct. + - A few header tweaks for Watcom 11.0 under Win32 from + Rolf Lindemann <Lindemann@maz-hh.de> + - 0 length OCTET_STRING bug in asn1_parse + - A minor fix with an non-existent function in the MS .def files. + - A few changes to the PKCS7 stuff. + +25-Jun-97 + SSLeay 0.8.0 finally it gets released. + +24-Jun-97 + Added a SSL_OP_EPHEMERAL_RSA option which causes all SSLv3 RSA keys to + use a temporary RSA key. This is experimental and needs some more work. + Fixed a few Win16 build problems. + +23-Jun-97 + SSLv3 bug. I was not doing the 'lookup' of the CERT structure + correctly. I was taking the SSL->ctx->default_cert when I should + have been using SSL->cert. The bug was in ssl/s3_srvr.c + +20-Jun-97 + X509_ATTRIBUTES were being encoded wrongly by apps/reg.c and the + rest of the library. Even though I had the code required to do + it correctly, apps/req.c was doing the wrong thing. I have fixed + and tested everything. + + Missing a few #ifdef FIONBIO sections in crypto/bio/bss_acpt.c. + +19-Jun-97 + Fixed a bug in the SSLv2 server side first packet handling. When + using the non-blocking test BIO, the ssl->s2->first_packet flag + was being reset when a would-block failure occurred when reading + the first 5 bytes of the first packet. This caused the checking + logic to run at the wrong time and cause an error. + + Fixed a problem with specifying cipher. If RC4-MD5 were used, + only the SSLv3 version would be picked up. Now this will pick + up both SSLv2 and SSLv3 versions. This required changing the + SSL_CIPHER->mask values so that they only mask the ciphers, + digests, authentication, export type and key-exchange algorithms. + + I found that when a SSLv23 session is established, a reused + session, of type SSLv3 was attempting to write the SSLv2 + ciphers, which were invalid. The SSL_METHOD->put_cipher_by_char + method has been modified so it will only write out cipher which + that method knows about. + diff --git a/src/lib/libssl/src/HISTORY.066 b/src/lib/libssl/src/HISTORY.066 new file mode 100644 index 0000000000..f85224977a --- /dev/null +++ b/src/lib/libssl/src/HISTORY.066 @@ -0,0 +1,443 @@ +SSLeay 0.6.5 + +After quite some time (3 months), the new release. I have been very busy +for the last few months and so this is mostly bug fixes and improvments. + +The main additions are + +- assember for x86 DES. For all those gcc based systems, this is a big + improvement. From 117,000 DES operation a second on a pentium 100, + I now get 191,000. I have also reworked the C version so it + now gives 148,000 DESs per second. +- As mentioned above, the inner DES macros now have some more variant that + sometimes help, sometimes hinder performance. There are now 3 options + DES_PTR (ptr vs array lookup), DES_UNROLL (full vs partial loop unrolling) + and DES_RISC (a more register intensive version of the inner macro). + The crypto/des/des_opts.c program, when compiled and run, will give + an indication of the correct options to use. +- The BIO stuff has been improved. Read doc/bio.doc. There are now + modules for encryption and base64 encoding and a BIO_printf() function. +- The CA program will accept simple one line X509v3 extensions in the + ssleay.cnf file. Have a look at the example. Currently this just + puts the text into the certificate as an OCTET_STRING so currently + the more advanced X509v3 data types are not handled but this is enough + for the netscape extensions. +- There is the start of a nicer higher level interface to the X509 + strucutre. +- Quite a lot of bug fixes. +- CRYPTO_malloc_init() (or CRYPTO_set_mem_functions()) can be used + to define the malloc(), free() and realloc() routines to use + (look in crypto/crypto.h). This is mostly needed for Windows NT/95 when + using DLLs and mixing CRT libraries. + +In general, read the 'VERSION' file for changes and be aware that some of +the new stuff may not have been tested quite enough yet, so don't just plonk +in SSLeay 0.6.5 when 0.6.4 used to work and expect nothing to break. + +SSLeay 0.6.4 30/08/96 eay + +I've just finished some test builds on Windows NT, Windows 3.1, Solaris 2.3, +Solaris 2.5, Linux, IRIX, HPUX 10 and everthing seems to work :-). + +The main changes in this release + +- Thread safe. have a read of doc/threads.doc and play in the mt directory. + For anyone using 0.6.3 with threads, I found 2 major errors so consider + moving to 0.6.4. I have a test program that builds under NT and + solaris. +- The get session-id callback has changed. Have a read of doc/callback.doc. +- The X509_cert_verify callback (the SSL_verify callback) now + has another argument. Have a read of doc/callback.doc +- 'ca -preserve', sign without re-ordering the DN. Not tested much. +- VMS support. +- Compile time memory leak detection can now be built into SSLeay. + Read doc/memory.doc +- CONF routines now understand '\', '\n', '\r' etc. What this means is that + the SPKAC object mentioned in doc/ns-ca.doc can be on multiple lines. +- 'ssleay ciphers' added, lists the default cipher list for SSLeay. +- RC2 key setup is now compatable with Netscape. +- Modifed server side of SSL implementation, big performance difference when + using session-id reuse. + +0.6.3 + +Bug fixes and the addition of some nice stuff to the 'ca' program. +Have a read of doc/ns-ca.doc for how hit has been modified so +it can be driven from a CGI script. The CGI script is not provided, +but that is just being left as an excersize for the reader :-). + +0.6.2 + +This is most bug fixes and functionality improvements. + +Additions are +- More thread debugging patches, the thread stuff is still being + tested, but for those keep to play with stuff, have a look in + crypto/cryptlib.c. The application needs to define 1 (or optionaly + a second) callback that is used to implement locking. Compiling + with LOCK_DEBUG spits out lots of locking crud :-). + This is what I'm currently working on. +- SSL_CTX_set_default_passwd_cb() can be used to define the callback + function used in the SSL*_file() functions used to load keys. I was + always of the opinion that people should call + PEM_read_RSAPrivateKey() and pass the callback they want to use, but + it appears they just want to use the SSL_*_file() function() :-(. +- 'enc' now has a -kfile so a key can be read from a file. This is + mostly used so that the passwd does not appear when using 'ps', + which appears imposible to stop under solaris. +- X509v3 certificates now work correctly. I even have more examples + in my tests :-). There is now a X509_EXTENSION type that is used in + X509v3 certificates and CRLv2. +- Fixed that signature type error :-( +- Fixed quite a few potential memory leaks and problems when reusing + X509, CRL and REQ structures. +- EVP_set_pw_prompt() now sets the library wide default password + prompt. +- The 'pkcs7' command will now, given the -print_certs flag, output in + pem format, all certificates and CRL contained within. This is more + of a pre-emtive thing for the new verisign distribution method. I + should also note, that this also gives and example in code, of how + to do this :-), or for that matter, what is involved in going the + other way (list of certs and crl -> pkcs7). +- Added RSA's DESX to the DES library. It is also available via the + EVP_desx_cbc() method and via 'enc desx'. + +SSLeay 0.6.1 + +The main functional changes since 0.6.0 are as follows +- Bad news, the Microsoft 060 DLL's are not compatable, but the good news is + that from now on, I'll keep the .def numbers the same so they will be. +- RSA private key operations are about 2 times faster that 0.6.0 +- The SSL_CTX now has more fields so default values can be put against + it. When an SSL structure is created, these default values are used + but can be overwritten. There are defaults for cipher, certificate, + private key, verify mode and callback. This means SSL session + creation can now be + ssl=SSL_new() + SSL_set_fd(ssl,sock); + SSL_accept(ssl) + .... + All the other uglyness with having to keep a global copy of the + private key and certificate/verify mode in the server is now gone. +- ssl/ssltest.c - one process talking SSL to its self for testing. +- Storage of Session-id's can be controled via a session_cache_mode + flag. There is also now an automatic default flushing of + old session-id's. +- The X509_cert_verify() function now has another parameter, this + should not effect most people but it now means that the reason for + the failure to verify is now available via SSL_get_verify_result(ssl). + You don't have to use a global variable. +- SSL_get_app_data() and SSL_set_app_data() can be used to keep some + application data against the SSL structure. It is upto the application + to free the data. I don't use it, but it is available. +- SSL_CTX_set_cert_verify_callback() can be used to specify a + verify callback function that completly replaces my certificate + verification code. Xcert should be able to use this :-). + The callback is of the form int app_verify_callback(arg,ssl,cert). + This needs to be documented more. +- I have started playing with shared library builds, have a look in + the shlib directory. It is very simple. If you need a numbered + list of functions, have a look at misc/crypto.num and misc/ssl.num. +- There is some stuff to do locking to make the library thread safe. + I have only started this stuff and have not finished. If anyone is + keen to do so, please send me the patches when finished. + +So I have finally made most of the additions to the SSL interface that +I thought were needed. + +There will probably be a pause before I make any non-bug/documentation +related changes to SSLeay since I'm feeling like a bit of a break. + +eric - 12 Jul 1996 +I saw recently a comment by some-one that we now seem to be entering +the age of perpetual Beta software. +Pioneered by packages like linux but refined to an art form by +netscape. + +I too wish to join this trend with the anouncement of SSLeay 0.6.0 :-). + +There are quite a large number of sections that are 'works in +progress' in this package. I will also list the major changes and +what files you should read. + +BIO - this is the new IO structure being used everywhere in SSLeay. I +started out developing this because of microsoft, I wanted a mechanism +to callback to the application for all IO, so Windows 3.1 DLL +perversion could be hidden from me and the 15 different ways to write +to a file under NT would also not be dictated by me at library build +time. What the 'package' is is an API for a data structure containing +functions. IO interfaces can be written to conform to the +specification. This in not intended to hide the underlying data type +from the application, but to hide it from SSLeay :-). +I have only really finished testing the FILE * and socket/fd modules. +There are also 'filter' BIO's. Currently I have only implemented +message digests, and it is in use in the dgst application. This +functionality will allow base64/encrypto/buffering modules to be +'push' into a BIO without it affecting the semantics. I'm also +working on an SSL BIO which will hide the SSL_accept()/SLL_connet() +from an event loop which uses the interface. +It is also possible to 'attach' callbacks to a BIO so they get called +before and after each operation, alowing extensive debug output +to be generated (try running dgst with -d). + +Unfortunaly in the conversion from 0.5.x to 0.6.0, quite a few +functions that used to take FILE *, now take BIO *. +The wrappers are easy to write + +function_fp(fp,x) +FILE *fp; + { + BIO *b; + int ret; + + if ((b=BIO_new(BIO_s_file())) == NULL) error..... + BIO_set_fp(b,fp,BIO_NOCLOSE); + ret=function_bio(b,x); + BIO_free(b); + return(ret); + } +Remember, there are no functions that take FILE * in SSLeay when +compiled for Windows 3.1 DLL's. + +-- +I have added a general EVP_PKEY type that can hold a public/private +key. This is now what is used by the EVP_ functions and is passed +around internally. I still have not done the PKCS#8 stuff, but +X509_PKEY is defined and waiting :-) + +-- +For a full function name listings, have a look at ms/crypt32.def and +ms/ssl32.def. These are auto-generated but are complete. +Things like ASN1_INTEGER_get() have been added and are in here if you +look. I have renamed a few things, again, have a look through the +function list and you will probably find what you are after. I intend +to at least put a one line descrition for each one..... + +-- +Microsoft - thats what this release is about, read the MICROSOFT file. + +-- +Multi-threading support. I have started hunting through the code and +flaging where things need to be done. In a state of work but high on +the list. + +-- +For random numbers, edit e_os.h and set DEVRANDOM (it's near the top) +be be you random data device, otherwise 'RFILE' in e_os.h +will be used, in your home directory. It will be updated +periodically. The environment variable RANDFILE will override this +choice and read/write to that file instead. DEVRANDOM is used in +conjunction to the RFILE/RANDFILE. If you wish to 'seed' the random +number generator, pick on one of these files. + +-- + +The list of things to read and do + +dgst -d +s_client -state (this uses a callback placed in the SSL state loop and + will be used else-where to help debug/monitor what + is happening.) + +doc/why.doc +doc/bio.doc <- hmmm, needs lots of work. +doc/bss_file.doc <- one that is working :-) +doc/session.doc <- it has changed +doc/speed.doc + also play with ssleay version -a. I have now added a SSLeay() + function that returns a version number, eg 0600 for this release + which is primarily to be used to check DLL version against the + application. +util/* Quite a few will not interest people, but some may, like + mk1mf.pl, mkdef.pl, +util/do_ms.sh + +try +cc -Iinclude -Icrypto -c crypto/crypto.c +cc -Iinclude -Issl -c ssl/ssl.c +You have just built the SSLeay libraries as 2 object files :-) + +Have a general rummage around in the bin stall directory and look at +what is in there, like CA.sh and c_rehash + +There are lots more things but it is 12:30am on a Friday night and I'm +heading home :-). + +eric 22-Jun-1996 +This version has quite a few major bug fixes and improvements. It DOES NOT +do SSLv3 yet. + +The main things changed +- A Few days ago I added the s_mult application to ssleay which is + a demo of an SSL server running in an event loop type thing. + It supports non-blocking IO, I have finally gotten it right, SSL_accept() + can operate in non-blocking IO mode, look at the code to see how :-). + Have a read of doc/s_mult as well. This program leaks memory and + file descriptors everywhere but I have not cleaned it up yet. + This is a demo of how to do non-blocking IO. +- The SSL session management has been 'worked over' and there is now + quite an expansive set of functions to manipulate them. Have a read of + doc/session.doc for some-things I quickly whipped up about how it now works. + This assume you know the SSLv2 protocol :-) +- I can now read/write the netscape certificate format, use the + -inform/-outform 'net' options to the x509 command. I have not put support + for this type in the other demo programs, but it would be easy to add. +- asn1parse and 'enc' have been modified so that when reading base64 + encoded files (pem format), they do not require '-----BEGIN' header lines. + The 'enc' program had a buffering bug fixed, it can be used as a general + base64 -> binary -> base64 filter by doing 'enc -a -e' and 'enc -a -d' + respecivly. Leaving out the '-a' flag in this case makes the 'enc' command + into a form of 'cat'. +- The 'x509' and 'req' programs have been fixed and modified a little so + that they generate self-signed certificates correctly. The test + script actually generates a 'CA' certificate and then 'signs' a + 'user' certificate. Have a look at this shell script (test/sstest) + to see how things work, it tests most possible combinations of what can + be done. +- The 'SSL_set_pref_cipher()' function has been 'fixed' and the prefered name + of SSL_set_cipher_list() is now the correct API (stops confusion :-). + If this function is used in the client, only the specified ciphers can + be used, with preference given to the order the ciphers were listed. + For the server, if this is used, only the specified ciphers will be used + to accept connections. If this 'option' is not used, a default set of + ciphers will be used. The SSL_CTX_set_cipher_list(SSL_CTX *ctx) sets this + list for all ciphers started against the SSL_CTX. So the order is + SSL cipher_list, if not present, SSL_CTX cipher list, if not + present, then the library default. + What this means is that normally ciphers like + NULL-MD5 will never be used. The only way this cipher can be used + for both ends to specify to use it. + To enable or disable ciphers in the library at build time, modify the + first field for the cipher in the ssl_ciphers array in ssl/ssl_lib.c. + This file also contains the 'pref_cipher' list which is the default + cipher preference order. +- I'm not currently sure if the 'rsa -inform net' and the 'rsa -outform net' + options work. They should, and they enable loading and writing the + netscape rsa private key format. I will be re-working this section of + SSLeay for the next version. What is currently in place is a quick and + dirty hack. +- I've re-written parts of the bignum library. This gives speedups + for all platforms. I now provide assembler for use under Windows NT. + I have not tested the Windows 3.1 assembler but it is quite simple code. + This gives RSAprivate_key operation encryption times of 0.047s (512bit key) + and 0.230s (1024bit key) on a pentium 100 which I consider reasonable. + Basically the times available under linux/solaris x86 can be achieve under + Windows NT. I still don't know how these times compare to RSA's BSAFE + library but I have been emailing with people and with their help, I should + be able to get my library's quite a bit faster still (more algorithm changes). + The object file crypto/bn/asm/x86-32.obj should be used when linking + under NT. +- 'make makefile.one' in the top directory will generate a single makefile + called 'makefile.one' This makefile contains no perl references and + will build the SSLeay library into the 'tmp' and 'out' directories. + util/mk1mf.pl >makefile.one is how this makefile is + generated. The mk1mf.pl command take several option to generate the + makefile for use with cc, gcc, Visual C++ and Borland C++. This is + still under development. I have only build .lib's for NT and MSDOS + I will be working on this more. I still need to play with the + correct compiler setups for these compilers and add some more stuff but + basically if you just want to compile the library + on a 'non-unix' platform, this is a very very good file to start with :-). + Have a look in the 'microsoft' directory for my current makefiles. + I have not yet modified things to link with sockets under Windows NT. + You guys should be able to do this since this is actually outside of the + SSLeay scope :-). I will be doing it for myself soon. + util/mk1mf.pl takes quite a few options including no-rc, rsaref and no-sock + to build without RC2/RC4, to require RSAref for linking, and to + build with no socket code. + +- Oh yes, the cipher that was reported to be compatible with RSA's RC2 cipher + that was posted to sci.crypt has been added to the library and SSL. + I take the view that if RC2 is going to be included in a standard, + I'll include the cipher to make my package complete. + There are NO_RC2, NO_RC4 and NO_IDEA macros to remove these ciphers + at compile time. I have not tested this recently but it should all work + and if you are in the USA and don't want RSA threatening to sue you, + you could probably remove the RC4/RC2 code inside these sections. + I may in the future include a perl script that does this code + removal automatically for those in the USA :-). +- I have removed all references to sed in the makefiles. So basically, + the development environment requires perl and sh. The build environment + does not (use the makefile.one makefile). + The Configure script still requires perl, this will probably stay that way + since I have perl for Windows NT :-). + +eric (03-May-1996) + +PS Have a look in the VERSION file for more details on the changes and + bug fixes. +I have fixed a few bugs, added alpha and x86 assembler and generally cleaned +things up. This version will be quite stable, mostly because I'm on +holidays until 10-March-1996. For any problems in the interum, send email +to Tim Hudson <tjh@mincom.oz.au>. + +SSLeay 0.5.0 + +12-12-95 +This is going out before it should really be released. + +I leave for 11 weeks holidays on the 22-12-95 and so I either sit on +this for 11 weeks or get things out. It is still going to change a +lot in the next week so if you do grab this version, please test and +give me feed back ASAP, inculuding questions on how to do things with +the library. This will prompt me to write documentation so I don't +have to answer the same question again :-). + +This 'pre' release version is for people who are interested in the +library. The applications will have to be changed to use +the new version of the SSL interface. I intend to finish more +documentation before I leave but until then, look at the programs in +the apps directory. As far as code goes, it is much much nicer than +the old version. + +The current library works, has no memory leaks (as far as I can tell) +and is far more bug free that 0.4.5d. There are no global variable of +consequence (I believe) and I will produce some documentation that +tell where to look for those people that do want to do multi-threaded +stuff. + +There should be more documentation. Have a look in the +doc directory. I'll be adding more before I leave, it is a start +by mostly documents the crypto library. Tim Hudson will update +the web page ASAP. The spelling and grammar are crap but +it is better than nothing :-) + +Reasons to start playing with version 0.5.0 +- All the programs in the apps directory build into one ssleay binary. +- There is a new version of the 'req' program that generates certificate + requests, there is even documentation for this one :-) +- There is a demo certification authorithy program. Currently it will + look at the simple database and update it. It will generate CRL from + the data base. You need to edit the database by hand to revoke a + certificate, it is my aim to use perl5/Tk but I don't have time to do + this right now. It will generate the certificates but the management + scripts still need to be written. This is not a hard task. +- Things have been cleaned up alot. +- Have a look at the enc and dgst programs in the apps directory. +- It supports v3 of x509 certiticates. + + +Major things missing. +- I have been working on (and thinging about) the distributed x509 + hierachy problem. I have not had time to put my solution in place. + It will have to wait until I come back. +- I have not put in CRL checking in the certificate verification but + it would not be hard to do. I was waiting until I could generate my + own CRL (which has only been in the last week) and I don't have time + to put it in correctly. +- Montgomery multiplication need to be implemented. I know the + algorithm, just ran out of time. +- PKCS#7. I can load and write the DER version. I need to re-work + things to support BER (if that means nothing, read the ASN1 spec :-). +- Testing of the higher level digital envelope routines. I have not + played with the *_seal() and *_open() type functions. They are + written but need testing. The *_sign() and *_verify() functions are + rock solid. +- PEM. Doing this and PKCS#7 have been dependant on the distributed + x509 heirachy problem. I started implementing my ideas, got + distracted writing a CA program and then ran out of time. I provide + the functionality of RSAref at least. +- Re work the asm. code for the x86. I've changed by low level bignum + interface again, so I really need to tweak the x86 stuff. gcc is + good enough for the other boxes. + diff --git a/src/lib/libssl/src/MICROSOFT b/src/lib/libssl/src/MICROSOFT new file mode 100644 index 0000000000..54176f0472 --- /dev/null +++ b/src/lib/libssl/src/MICROSOFT @@ -0,0 +1,146 @@ +The Microsoft World. + +The good news, to build SSLeay for the Microsft World + +Windows 3.1 DLL's +perl Configure VC-WIN16 +nmake -f ms\w31dll.mak + +Windows NT/95 DLL's +perl Configure VC-WIN32 +nmake -f ms\ntdll.mak + +Now the bad news +All builds were done using Microsofts Visual C++ 1.52c and [45].x. +If you are a borland person, you are probably going to have to help me +finish the stuff in util/pl/BC*pl + +All builds were made under Windows NT - this means long filenames, so +you may have problems under Windows 3.1 but probably not under 95. + +Because file pointers don't work in DLL's under Windows 3.1 (well at +least stdin/stdout don't and I don't like having to differentiate +between these and other file pointers), I now use the BIO file-pointer +module, which needs to be linked into your application. You can either +use the memory buffer BIO for IO, or compile bss_file.c into your +application, it is in the apps directory and is just a copy of +crypto/buffer/bss_file.c with #define APPS_WIN16 added. +I have not yet automated the makefile to automatically copy it into 'out' +for a win 3.1 build.... + +All callbacks passed into SSLeay for Windows 3.1 need to be of type +_far _loadds. + +I don't support building with the pascal calling convention. + +The DLL and static builds are large memory model. + +To build static libraries for NT/95 or win 3.1 + +perl util/mk1mf.pl VC-WIN32 > mf-stat.nt +perl util/mk1mf.pl VC-WIN16 > mf-stat.w31 +for DLL's +perl util/mk1mf.pl dll VC-WIN32 > mf-dll.nt +perl util/mk1mf.pl dll VC-WIN16 > mf-dll.w31 + +Again you will notice that if you dont have perl, you cannot do this. + +Now the next importaint issue. Running Configure! +I have small assember code files for critical big number library operation +in crypto/bn/asm. There is, asm code, object files and uuencode +object files. They are +x86nt32.asm - 32bit flat memory model assember - suitable Win32 +x86w16.asm - 16bit assember - used in the msdos build. +x86w32.asm - 32bit assember, win 3.1 segments, used for win16 build. + +If you feel compelled to build the 16bit maths routines in the windows 3.1 +build, +perl Configure VC-W31-16 +perl util/mk1mf.pl dll VC-W31-16 > mf-dll.w31 + +If you hate assember and don't want anything to do with it, +perl util/mk1mf.pl no-asm VC-WIN16 > mf-dll.w31 +will work for any of the makefile generations. + +There are more options to mk1mf.pl but these all leave the temporary +files in 'tmp' and the output files in 'out' by default. + +The NT build is done for console mode. + +The Windows 3.1 version of SSLeay uses quickwin, the interface is ugly +but it is better than nothing. If you want ugly, try doing anything +that involves getting a password. I decided to be ugly instead of +echoing characters. For Windows 3.1 I would just sugest using the +msdos version of the ssleay application for command line work. +The QuickWin build is primarily for testing. + +For both NT and Windows 3.1, I have not written the code so that +s_client, s_server can take input from the keyboard. You can happily +start applications up in separate windows, watch them handshake, and then sit +there for-ever. I have not had the time to get this working, and I've +been able to test things from a unix box to the NT box :-). +Try running ssleay s_server on the windows box +(with either -cert ../apps/server.pem -www) +and run ssleay s_time from another window. +This often stuffs up on Windows 3.1, but I'm not worried since this is +probably a problem with my demo applications, not the libraries. + +After a build of one of the version of microsoft SSLeay, +'cd ms' and then run 'test'. This should check everything out and +even does a trial run of generating certificates. +'test.bat' requires that perl be install, you be in the ms directory +(not the test directory, thats for unix so stay out :-) and that the +build output directory be ../out + +On a last note, you will probably get division by zero errors and +stuff after a build. This is due to your own inability to follow +instructions :-). + +The reasons for the problem is probably one of the following. + +1) You did not run Configure. This is critical for windows 3.1 when + using assember. The values in crypto/bn/bn.h must match the + ones requred for the assember code. (remember that if you + edit crypto/bn/bn.h by hand, it will be clobered the next time + you run Configure by the contents of crypto/bn/bn.org). + SSLeay version -o will list the compile options. + For VC-WIN32 you need bn(64,32) or bn(32,32) + For VC-W31-32/VC-WIN16 you need bn(32,32) + For VC-W31-16 you need bn(32,16) or bn(16,16) + For VC-MSDOS you need bn(32,16) or bn(16,16). + + The first number will be 2 times bigger than the second if + BN_LLONG is defined in bn.h and the size of the second number + depends on the 'bits' defined at the start of bn.h. Have a + look, it's all reasonably clear. + If you want to start messing with 8 bit builds and things like + that, build without the assember by re-generating a makefile + via 'perl util/mk1mf.pl no-asm'. +2) You tried to build under MS-DOS or Windows 3.1 using the /G3 + option. Don't. It is buggy (thats why you just got that + error) and unless you want to work out which optimising flag + to turn off, I'm not going to help you :-). I also noticed + that code often ran slower when compiled with /G3. +3) Under NT/95, malloc goes stupid. You are probably linking with + the wrong library, there are problems if you mix the threaded + and non-threaded libraries (due to the DLL being staticly + linked with one and the applicaion using another. + +Well hopefully thats most of the MS issues handled, see you in ssl-users :-). + +eric 30-Aug-1996 + +SSLeay 0.6.5 +For Windows 95/NT, add CRYPTO_malloc_init() to your program before any +calls to the SSLeay libraries. This function will insert callbacks so that +the SSLeay libraries will use the same malloc(), free() and realloc() as +your application so 'problem 3)' mentioned above will go away. + +There is now DES assember for Windows NT/95. The file is +crypto/des/asm/win32.asm and replaces crypto/des/des_enc.c in the build. + +There is also Blowfish assember for Windows NT/95. The file is +crypto/bf/asm/win32.asm and replaces crypto/bf/bf_enc.c in the build. + +eric 25-Jun-1997 + diff --git a/src/lib/libssl/src/MINFO b/src/lib/libssl/src/MINFO new file mode 100644 index 0000000000..0509f33648 --- /dev/null +++ b/src/lib/libssl/src/MINFO @@ -0,0 +1,968 @@ +RELATIVE_DIRECTORY=. +AR=ar r +BASENAME=SSLeay +BF_ENC=bf_enc.o +BN_MULW=bn_mulw.o +CAST_ENC=c_enc.o +CC=cc +CFLAG=-O -DNOPROTO +DES_ENC=des_enc.o fcrypt_b.o +DIRS=crypto ssl rsaref apps test tools +EDIRS=times doc bugs util include certs ms shlib mt demos perl dep +EXHEADER=e_os.h +EX_LIBS= +GENERAL=Makefile +HEADER=e_os.h +INSTALLTOP=/usr/local/ssl +LIBS=libcrypto.a libssl.a +MAKE=make -f Makefile.ssl +MAKEFILE=Makefile.ssl +MAN1=1 +MAN3=3 +MD5_ASM_OBJ= +MISC=COPYRIGHT Configure HISTORY.066 INSTALL Makefile.ssl Makefile README TODO HISTORY README.066 README.080 README.090 VERSION PROBLEMS MINFO makefile.one e_os.h MICROSOFT makevms.com config PATENTS +NAME=SSLeay-0.9.0 +ONEDIRS=out tmp +PEX_LIBS=-L. -L.. -L../.. -L../../.. +RC4_ENC=rc4_enc.o +RC5_ENC=rc5_enc.o +RMD160_ASM_OBJ= +SDIRS=md2 md5 sha mdc2 hmac ripemd des rc2 rc4 rc5 idea bf cast bn rsa dsa dh buffer bio stack lhash rand err objects evp pem asn1 x509 conf txt_db pkcs7 +SHA1_ASM_OBJ= +SHELL=/bin/sh +TARFILE=SSLeay-0.9.0.tar +TOP=. +VERSION=0.9.0 +WDIRS=windows +WTARFILE=SSLeay-0.9.0-win.tar +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto +ALL=Makefile README cryptlib.c mem.c cversion.c ex_data.c cpt_err.c cryptlib.h date.h crypto.h cryptall.h +AR=ar r +CC=cc +CFLAG=-g +CFLAGS=-I. -I../include -g -DCFLAGS=" \"cc -g\" " +DIR=crypto +ERR=crypto +ERRC=cpt_err +EXHEADER=crypto.h cryptall.h +EX_LIBS= +GENERAL=Makefile README +HEADER=cryptlib.h date.h crypto.h cryptall.h +INCLUDE=-I. -I../include +INCLUDES=-I.. -I../../include +INSTALLTOP=/usr/local/ssl +LIB=../libcrypto.a +LIBOBJ=cryptlib.o mem.o cversion.o ex_data.o cpt_err.o +LIBS= +LIBSRC=cryptlib.c mem.c cversion.c ex_data.c cpt_err.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +PEX_LIBS= +RM=/bin/rm -f +SDIRS=md2 md5 sha mdc2 hmac ripemd des rc2 rc4 rc5 idea bf cast bn rsa dsa dh buffer bio stack lhash rand err objects evp pem x509 asn1 conf txt_db pkcs7 +SRC=cryptlib.c mem.c cversion.c ex_data.c cpt_err.c +TOP=.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/md2 +ALL=Makefile md2_dgst.c md5_one.c md2.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS= -g +DIR=md +EXHEADER=md2.h +GENERAL=Makefile +HEADER=md2.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=md2_dgst.o md2_one.o +LIBSRC=md2_dgst.c md5_one.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=md2_dgst.c md5_one.c +TEST=md2test.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/md5 +ALL=Makefile md5_dgst.c md5_one.c md5_locl.h md5.h +APPS=md5.c +AR=ar r +CC=cc +CFLAG=-g +CFLAGS= -g +CPP=cc -E +DIR=md5 +EXHEADER=md5.h +GENERAL=Makefile +HEADER=md5_locl.h md5.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=md5_dgst.o md5_one.o +LIBSRC=md5_dgst.c md5_one.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +MD5_ASM_OBJ= +SRC=md5_dgst.c md5_one.c +TEST=md5test.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/sha +ALL=Makefile sha_dgst.c sha1dgst.c sha_one.c sha1_one.c sha_locl.h sha.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS= -g +DIR=sha +EXHEADER=sha.h +GENERAL=Makefile +HEADER=sha_locl.h sha.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=sha_dgst.o sha1dgst.o sha_one.o sha1_one.o +LIBSRC=sha_dgst.c sha1dgst.c sha_one.c sha1_one.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SHA1_ASM_OBJ= +SRC=sha_dgst.c sha1dgst.c sha_one.c sha1_one.c +TEST=shatest.c sha1test.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/mdc2 +ALL=Makefile mdc2dgst.c mdc2_one.c mdc2.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS= -g +DIR=mdc2 +EXHEADER=mdc2.h +GENERAL=Makefile +HEADER=mdc2.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=mdc2dgst.o mdc2_one.o +LIBSRC=mdc2dgst.c mdc2_one.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=mdc2dgst.c mdc2_one.c +TEST=mdc2test.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/hmac +ALL=Makefile hmac.c hmac.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS= -g +DIR=hmac +EXHEADER=hmac.h +GENERAL=Makefile +HEADER=hmac.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=hmac.o +LIBSRC=hmac.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=hmac.c +TEST=hmactest.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/ripemd +ALL=Makefile rmd_dgst.c rmd_one.c rmd_locl.h rmdconst.h ripemd.h +APPS=rmd160.c +AR=ar r +CC=cc +CFLAG=-g +CFLAGS= -g +CPP=cc -E +DIR=ripemd +EXHEADER=ripemd.h +GENERAL=Makefile +HEADER=rmd_locl.h rmdconst.h ripemd.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=rmd_dgst.o rmd_one.o +LIBSRC=rmd_dgst.c rmd_one.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +RIP_ASM_OBJ= +SRC=rmd_dgst.c rmd_one.c +TEST=rmdtest.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/des +ALL=Makefile des.org des_locl.org cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c qud_cksm.c rand_key.c read_pwd.c rpc_enc.c set_key.c des_enc.c fcrypt_b.c read2pwd.c fcrypt.c xcbc_enc.c str2key.c cfb64ede.c ofb64ede.c supp.c des_locl.h rpc_des.h podd.h sk.h spr.h des_ver.h des.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS= -g +CPP=cc -E +DES_ENC=des_enc.o fcrypt_b.o +DIR=des +EXHEADER=des.h +GENERAL=Makefile des.org des_locl.org +HEADER=des_locl.h rpc_des.h podd.h sk.h spr.h des_ver.h des.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=set_key.o ecb_enc.o cbc_enc.o ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o enc_read.o enc_writ.o ofb64enc.o ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o des_enc.o fcrypt_b.o read2pwd.o fcrypt.o xcbc_enc.o read_pwd.o rpc_enc.o cbc_cksm.o supp.o +LIBSRC=cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c qud_cksm.c rand_key.c read_pwd.c rpc_enc.c set_key.c des_enc.c fcrypt_b.c read2pwd.c fcrypt.c xcbc_enc.c str2key.c cfb64ede.c ofb64ede.c supp.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c qud_cksm.c rand_key.c read_pwd.c rpc_enc.c set_key.c des_enc.c fcrypt_b.c read2pwd.c fcrypt.c xcbc_enc.c str2key.c cfb64ede.c ofb64ede.c supp.c +TEST=destest.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/rc2 +ALL=Makefile rc2_ecb.c rc2_skey.c rc2_cbc.c rc2cfb64.c rc2ofb64.c rc2_locl.h rc2.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS= -g +DIR=rc2 +EXHEADER=rc2.h +GENERAL=Makefile +HEADER=rc2_locl.h rc2.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=rc2_ecb.o rc2_skey.o rc2_cbc.o rc2cfb64.o rc2ofb64.o +LIBSRC=rc2_ecb.c rc2_skey.c rc2_cbc.c rc2cfb64.c rc2ofb64.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=rc2_ecb.c rc2_skey.c rc2_cbc.c rc2cfb64.c rc2ofb64.c +TEST=rc2test.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/rc4 +ALL=Makefile rc4_skey.c rc4_enc.c rc4.h rc4_locl.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS= -g +DIR=rc4 +EXHEADER=rc4.h +GENERAL=Makefile +HEADER=rc4.h rc4_locl.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=rc4_skey.o rc4_enc.o +LIBSRC=rc4_skey.c rc4_enc.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +RC4_ENC=rc4_enc.o +SRC=rc4_skey.c rc4_enc.c +TEST=rc4test.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/rc5 +ALL=Makefile rc5_skey.c rc5_ecb.c rc5_enc.c rc5cfb64.c rc5ofb64.c rc5_locl.h rc5.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS= -g +CPP=cc -E +DIR=rc5 +EXHEADER=rc5.h +GENERAL=Makefile +HEADER=rc5_locl.h rc5.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=rc5_skey.o rc5_ecb.o rc5_enc.o rc5cfb64.o rc5ofb64.o +LIBSRC=rc5_skey.c rc5_ecb.c rc5_enc.c rc5cfb64.c rc5ofb64.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +RC5_ENC=rc5_enc.o +SRC=rc5_skey.c rc5_ecb.c rc5_enc.c rc5cfb64.c rc5ofb64.c +TEST=rc5test.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/idea +ALL=Makefile i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c i_skey.c idea_lcl.h idea.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS= -g +DIR=idea +EXHEADER=idea.h +GENERAL=Makefile +HEADER=idea_lcl.h idea.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=i_cbc.o i_cfb64.o i_ofb64.o i_ecb.o i_skey.o +LIBSRC=i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c i_skey.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c i_skey.c +TEST=ideatest.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/bf +ALL=Makefile bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c bf_pi.h bf_locl.h blowfish.h +APPS= +AR=ar r +BF_ENC=bf_enc.o +CC=cc +CFLAG=-g +CFLAGS= -g +CPP=cc -E +DIR=bf +EXHEADER=blowfish.h +GENERAL=Makefile +HEADER=bf_pi.h bf_locl.h blowfish.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=bf_skey.o bf_ecb.o bf_enc.o bf_cfb64.o bf_ofb64.o +LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c +TEST=bftest.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/cast +ALL=Makefile c_skey.c c_ecb.c c_enc.c c_cfb64.c c_ofb64.c cast_s.h cast_lcl.h cast.h +APPS= +AR=ar r +CAST_ENC=c_enc.o +CC=cc +CFLAG=-g +CFLAGS= -g +CPP=cc -E +DIR=cast +EXHEADER=cast.h +GENERAL=Makefile +HEADER=cast_s.h cast_lcl.h cast.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=c_skey.o c_ecb.o c_enc.o c_cfb64.o c_ofb64.o +LIBSRC=c_skey.c c_ecb.c c_enc.c c_cfb64.c c_ofb64.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=c_skey.c c_ecb.c c_enc.c c_cfb64.c c_ofb64.c +TEST=casttest.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/bn +ALL=Makefile bn_add.c bn_div.c bn_exp.c bn_lib.c bn_mod.c bn_mul.c bn_print.c bn_rand.c bn_shift.c bn_sub.c bn_word.c bn_blind.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_mulw.c bn_recp.c bn_mont.c bn_mpi.c bn_lcl.h bn_prime.h bn.h +APPS= +AR=ar r +BN_MULW=bn_mulw.o +CC=cc +CFLAG=-g +CFLAGS=-I.. -I../../include -g +DIR=bn +ERR=bn +ERRC=bn_err +EXHEADER=bn.h +GENERAL=Makefile +HEADER=bn_lcl.h bn_prime.h bn.h +INCLUDES=-I.. -I../../include +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=bn_add.o bn_div.o bn_exp.o bn_lib.o bn_mod.o bn_mul.o bn_print.o bn_rand.o bn_shift.o bn_sub.o bn_word.o bn_blind.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o bn_mulw.o bn_recp.o bn_mont.o bn_mpi.o +LIBSRC=bn_add.c bn_div.c bn_exp.c bn_lib.c bn_mod.c bn_mul.c bn_print.c bn_rand.c bn_shift.c bn_sub.c bn_word.c bn_blind.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_mulw.c bn_recp.c bn_mont.c bn_mpi.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=bn_add.c bn_div.c bn_exp.c bn_lib.c bn_mod.c bn_mul.c bn_print.c bn_rand.c bn_shift.c bn_sub.c bn_word.c bn_blind.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_mulw.c bn_recp.c bn_mont.c bn_mpi.c +TEST=bntest.c exptest.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/rsa +ALL=Makefile rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c rsa_err.c rsa_pk1.c rsa_ssl.c rsa_none.c rsa.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS=-I.. -I../../include -g +DIR=rsa +ERR=rsa +ERRC=rsa_err +EXHEADER=rsa.h +GENERAL=Makefile +HEADER=rsa.h +INCLUDES=-I.. -I../../include +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=rsa_eay.o rsa_gen.o rsa_lib.o rsa_sign.o rsa_saos.o rsa_err.o rsa_pk1.o rsa_ssl.o rsa_none.o +LIBSRC=rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c rsa_err.c rsa_pk1.c rsa_ssl.c rsa_none.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c rsa_err.c rsa_pk1.c rsa_ssl.c rsa_none.c +TEST= +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/dsa +ALL=Makefile dsa_gen.c dsa_key.c dsa_lib.c dsa_vrf.c dsa_sign.c dsa_err.c dsa.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS=-I.. -I../../include -g +DIR=dsa +ERR=dsa +ERRC=dsa_err +EXHEADER=dsa.h +GENERAL=Makefile +HEADER=dsa.h +INCLUDES=-I.. -I../../include +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=dsa_gen.o dsa_key.o dsa_lib.o dsa_vrf.o dsa_sign.o dsa_err.o +LIBSRC=dsa_gen.c dsa_key.c dsa_lib.c dsa_vrf.c dsa_sign.c dsa_err.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=dsa_gen.c dsa_key.c dsa_lib.c dsa_vrf.c dsa_sign.c dsa_err.c +TEST=dsatest.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/dh +ALL=Makefile dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c dh.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS=-I.. -I../../include -g +DIR=dh +ERR=dh +ERRC=dh_err +EXHEADER=dh.h +GENERAL=Makefile +HEADER=dh.h +INCLUDES=-I.. -I../../include +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o +LIBSRC=dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c +TEST=dhtest.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/buffer +ALL=Makefile buffer.c buf_err.c buffer.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS=-I.. -I../../include -g +DIR=buffer +ERR=buffer +ERRC=buf_err +EXHEADER=buffer.h +GENERAL=Makefile +HEADER=buffer.h +INCLUDES=-I.. -I../../include +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=buffer.o buf_err.o +LIBSRC=buffer.c buf_err.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=buffer.c buf_err.c +TEST= +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/bio +ALL=Makefile bio_lib.c bio_cb.c bio_err.c bss_mem.c bss_null.c bss_fd.c bss_file.c bss_sock.c bss_conn.c bf_null.c bf_buff.c b_print.c b_dump.c b_sock.c bss_acpt.c bf_nbio.c bio.h bss_file.c +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS=-I.. -I../../include -g +DIR=bio +ERR=bio +ERRC=bio_err +EXHEADER=bio.h bss_file.c +GENERAL=Makefile +HEADER=bio.h bss_file.c +INCLUDES=-I.. -I../../include +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=bio_lib.o bio_cb.o bio_err.o bss_mem.o bss_null.o bss_fd.o bss_file.o bss_sock.o bss_conn.o bf_null.o bf_buff.o b_print.o b_dump.o b_sock.o bss_acpt.o bf_nbio.o +LIBSRC=bio_lib.c bio_cb.c bio_err.c bss_mem.c bss_null.c bss_fd.c bss_file.c bss_sock.c bss_conn.c bf_null.c bf_buff.c b_print.c b_dump.c b_sock.c bss_acpt.c bf_nbio.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=bio_lib.c bio_cb.c bio_err.c bss_mem.c bss_null.c bss_fd.c bss_file.c bss_sock.c bss_conn.c bf_null.c bf_buff.c b_print.c b_dump.c b_sock.c bss_acpt.c bf_nbio.c +TEST= +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/stack +ALL=Makefile stack.c stack.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS= -g +DIR=stack +EXHEADER=stack.h +GENERAL=Makefile +HEADER=stack.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=stack.o +LIBSRC=stack.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=stack.c +TEST= +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/lhash +ALL=Makefile lhash.c lh_stats.c lhash.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS= -g +DIR=lhash +EXHEADER=lhash.h +GENERAL=Makefile +HEADER=lhash.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=lhash.o lh_stats.o +LIBSRC=lhash.c lh_stats.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=lhash.c lh_stats.c +TEST= +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/rand +ALL=Makefile md_rand.c randfile.c rand.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS= -g +DIR=rand +EXHEADER=rand.h +GENERAL=Makefile +HEADER=rand.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=md_rand.o randfile.o +LIBSRC=md_rand.c randfile.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=md_rand.c randfile.c +TEST=randtest.c +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/err +ALL=Makefile err.c err_all.c err_prn.c err.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS=-I.. -I../../include -g +DIR=err +EXHEADER=err.h +GENERAL=Makefile +HEADER=err.h +INCLUDES=-I.. -I../../include +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=err.o err_all.o err_prn.o +LIBSRC=err.c err_all.c err_prn.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=err.c err_all.c err_prn.c +TEST= +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/objects +ALL=Makefile README obj_dat.c obj_lib.c obj_err.c objects.h obj_dat.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS=-I.. -I../../include -g +DIR=objects +ERR=objects +ERRC=obj_err +EXHEADER=objects.h +GENERAL=Makefile README +HEADER=objects.h obj_dat.h +INCLUDES=-I.. -I../../include +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=obj_dat.o obj_lib.o obj_err.o +LIBSRC=obj_dat.c obj_lib.c obj_err.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=obj_dat.c obj_lib.c obj_err.c +TEST= +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/evp +ALL=Makefile encode.c digest.c evp_enc.c evp_key.c e_ecb_d.c e_cbc_d.c e_cfb_d.c e_ofb_d.c e_ecb_i.c e_cbc_i.c e_cfb_i.c e_ofb_i.c e_ecb_3d.c e_cbc_3d.c e_rc4.c names.c e_cfb_3d.c e_ofb_3d.c e_xcbc_d.c e_ecb_r2.c e_cbc_r2.c e_cfb_r2.c e_ofb_r2.c e_ecb_bf.c e_cbc_bf.c e_cfb_bf.c e_ofb_bf.c e_ecb_c.c e_cbc_c.c e_cfb_c.c e_ofb_c.c e_ecb_r5.c e_cbc_r5.c e_cfb_r5.c e_ofb_r5.c m_null.c m_md2.c m_md5.c m_sha.c m_sha1.c m_dss.c m_dss1.c m_mdc2.c m_ripemd.c p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c c_all.c evp_lib.c evp.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS=-I.. -I../../include -g +DIR=evp +ERR=evp +ERRC=evp_err +EXHEADER=evp.h +GENERAL=Makefile +HEADER=evp.h +INCLUDES=-I.. -I../../include +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=encode.o digest.o evp_enc.o evp_key.o e_ecb_d.o e_cbc_d.o e_cfb_d.o e_ofb_d.o e_ecb_i.o e_cbc_i.o e_cfb_i.o e_ofb_i.o e_ecb_3d.o e_cbc_3d.o e_rc4.o names.o e_cfb_3d.o e_ofb_3d.o e_xcbc_d.o e_ecb_r2.o e_cbc_r2.o e_cfb_r2.o e_ofb_r2.o e_ecb_bf.o e_cbc_bf.o e_cfb_bf.o e_ofb_bf.o e_ecb_c.o e_cbc_c.o e_cfb_c.o e_ofb_c.o e_ecb_r5.o e_cbc_r5.o e_cfb_r5.o e_ofb_r5.o m_null.o m_md2.o m_md5.o m_sha.o m_sha1.o m_dss.o m_dss1.o m_mdc2.o m_ripemd.o p_open.o p_seal.o p_sign.o p_verify.o p_lib.o p_enc.o p_dec.o bio_md.o bio_b64.o bio_enc.o evp_err.o e_null.o c_all.o evp_lib.o +LIBSRC=encode.c digest.c evp_enc.c evp_key.c e_ecb_d.c e_cbc_d.c e_cfb_d.c e_ofb_d.c e_ecb_i.c e_cbc_i.c e_cfb_i.c e_ofb_i.c e_ecb_3d.c e_cbc_3d.c e_rc4.c names.c e_cfb_3d.c e_ofb_3d.c e_xcbc_d.c e_ecb_r2.c e_cbc_r2.c e_cfb_r2.c e_ofb_r2.c e_ecb_bf.c e_cbc_bf.c e_cfb_bf.c e_ofb_bf.c e_ecb_c.c e_cbc_c.c e_cfb_c.c e_ofb_c.c e_ecb_r5.c e_cbc_r5.c e_cfb_r5.c e_ofb_r5.c m_null.c m_md2.c m_md5.c m_sha.c m_sha1.c m_dss.c m_dss1.c m_mdc2.c m_ripemd.c p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c c_all.c evp_lib.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=encode.c digest.c evp_enc.c evp_key.c e_ecb_d.c e_cbc_d.c e_cfb_d.c e_ofb_d.c e_ecb_i.c e_cbc_i.c e_cfb_i.c e_ofb_i.c e_ecb_3d.c e_cbc_3d.c e_rc4.c names.c e_cfb_3d.c e_ofb_3d.c e_xcbc_d.c e_ecb_r2.c e_cbc_r2.c e_cfb_r2.c e_ofb_r2.c e_ecb_bf.c e_cbc_bf.c e_cfb_bf.c e_ofb_bf.c e_ecb_c.c e_cbc_c.c e_cfb_c.c e_ofb_c.c e_ecb_r5.c e_cbc_r5.c e_cfb_r5.c e_ofb_r5.c m_null.c m_md2.c m_md5.c m_sha.c m_sha1.c m_dss.c m_dss1.c m_mdc2.c m_ripemd.c p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c c_all.c evp_lib.c +TEST= +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/pem +ALL=Makefile pem_sign.c pem_seal.c pem_info.c pem_lib.c pem_all.c pem_err.c pem.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS=-I.. -I../../include -g +CTX_SIZE=ctx_size +DIR=pem +ERR=pem +ERRC=pem_err +EXHEADER=pem.h +GENERAL=Makefile +HEADER=pem.h +INCLUDES=-I.. -I../../include +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=pem_sign.o pem_seal.o pem_info.o pem_lib.o pem_all.o pem_err.o +LIBSRC=pem_sign.c pem_seal.c pem_info.c pem_lib.c pem_all.c pem_err.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=pem_sign.c pem_seal.c pem_info.c pem_lib.c pem_all.c pem_err.c +TEST= +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/asn1 +ALL=Makefile README a_object.c a_bitstr.c a_utctm.c a_int.c a_octet.c a_print.c a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c a_sign.c a_digest.c a_verify.c x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c x_name.c x_cinf.c x_x509.c x_crl.c x_info.c x_spki.c d2i_r_pr.c i2d_r_pr.c d2i_r_pu.c i2d_r_pu.c d2i_s_pr.c i2d_s_pr.c d2i_s_pu.c i2d_s_pu.c d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c t_req.c t_x509.c t_pkey.c p7_i_s.c p7_signi.c p7_signd.c p7_recip.c p7_enc_c.c p7_evp.c p7_dgst.c p7_s_e.c p7_enc.c p7_lib.c f_int.c f_string.c i2d_dhp.c i2d_dsap.c d2i_dhp.c d2i_dsap.c n_pkey.c a_hdr.c x_pkey.c a_bool.c x_exten.c asn1_par.c asn1_lib.c asn1_err.c a_meth.c a_bytes.c evp_asn1.c asn1.h asn1_mac.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS=-I.. -I../../include -g +DIR=asn1 +ERR=asn1 +ERRC=asn1_err +EXHEADER=asn1.h asn1_mac.h +GENERAL=Makefile README +HEADER=asn1.h asn1_mac.h +INCLUDES=-I.. -I../../include +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=a_object.o a_bitstr.o a_utctm.o a_int.o a_octet.o a_print.o a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o a_sign.o a_digest.o a_verify.o x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o x_name.o x_cinf.o x_x509.o x_crl.o x_info.o x_spki.o d2i_r_pr.o i2d_r_pr.o d2i_r_pu.o i2d_r_pu.o d2i_s_pr.o i2d_s_pr.o d2i_s_pu.o i2d_s_pu.o d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o t_req.o t_x509.o t_pkey.o p7_i_s.o p7_signi.o p7_signd.o p7_recip.o p7_enc_c.o p7_evp.o p7_dgst.o p7_s_e.o p7_enc.o p7_lib.o f_int.o f_string.o i2d_dhp.o i2d_dsap.o d2i_dhp.o d2i_dsap.o n_pkey.o a_hdr.o x_pkey.o a_bool.o x_exten.o asn1_par.o asn1_lib.o asn1_err.o a_meth.o a_bytes.o evp_asn1.o +LIBSRC=a_object.c a_bitstr.c a_utctm.c a_int.c a_octet.c a_print.c a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c a_sign.c a_digest.c a_verify.c x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c x_name.c x_cinf.c x_x509.c x_crl.c x_info.c x_spki.c d2i_r_pr.c i2d_r_pr.c d2i_r_pu.c i2d_r_pu.c d2i_s_pr.c i2d_s_pr.c d2i_s_pu.c i2d_s_pu.c d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c t_req.c t_x509.c t_pkey.c p7_i_s.c p7_signi.c p7_signd.c p7_recip.c p7_enc_c.c p7_evp.c p7_dgst.c p7_s_e.c p7_enc.c p7_lib.c f_int.c f_string.c i2d_dhp.c i2d_dsap.c d2i_dhp.c d2i_dsap.c n_pkey.c a_hdr.c x_pkey.c a_bool.c x_exten.c asn1_par.c asn1_lib.c asn1_err.c a_meth.c a_bytes.c evp_asn1.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=a_object.c a_bitstr.c a_utctm.c a_int.c a_octet.c a_print.c a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c a_sign.c a_digest.c a_verify.c x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c x_name.c x_cinf.c x_x509.c x_crl.c x_info.c x_spki.c d2i_r_pr.c i2d_r_pr.c d2i_r_pu.c i2d_r_pu.c d2i_s_pr.c i2d_s_pr.c d2i_s_pu.c i2d_s_pu.c d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c t_req.c t_x509.c t_pkey.c p7_i_s.c p7_signi.c p7_signd.c p7_recip.c p7_enc_c.c p7_evp.c p7_dgst.c p7_s_e.c p7_enc.c p7_lib.c f_int.c f_string.c i2d_dhp.c i2d_dsap.c d2i_dhp.c d2i_dsap.c n_pkey.c a_hdr.c x_pkey.c a_bool.c x_exten.c asn1_par.c asn1_lib.c asn1_err.c a_meth.c a_bytes.c evp_asn1.c +TEST= +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/x509 +ALL=Makefile README x509_def.c x509_d2.c x509_r2x.c x509_cmp.c x509_obj.c x509_req.c x509_vfy.c x509_set.c x509rset.c x509_err.c x509name.c x509_v3.c x509_ext.c x509pack.c x509type.c x509_lu.c x_all.c x509_txt.c by_file.c by_dir.c v3_net.c v3_x509.c x509.h x509_vfy.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS=-I.. -I../../include -g +DIR=x509 +ERR=x509 +ERRC=x509_err +EXHEADER=x509.h x509_vfy.h +GENERAL=Makefile README +HEADER=x509.h x509_vfy.h +INCLUDES=-I.. -I../../include +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=x509_def.o x509_d2.o x509_r2x.o x509_cmp.o x509_obj.o x509_req.o x509_vfy.o x509_set.o x509rset.o x509_err.o x509name.o x509_v3.o x509_ext.o x509pack.o x509type.o x509_lu.o x_all.o x509_txt.o by_file.o by_dir.o v3_net.o v3_x509.o +LIBSRC=x509_def.c x509_d2.c x509_r2x.c x509_cmp.c x509_obj.c x509_req.c x509_vfy.c x509_set.c x509rset.c x509_err.c x509name.c x509_v3.c x509_ext.c x509pack.c x509type.c x509_lu.c x_all.c x509_txt.c by_file.c by_dir.c v3_net.c v3_x509.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=x509_def.c x509_d2.c x509_r2x.c x509_cmp.c x509_obj.c x509_req.c x509_vfy.c x509_set.c x509rset.c x509_err.c x509name.c x509_v3.c x509_ext.c x509pack.c x509type.c x509_lu.c x_all.c x509_txt.c by_file.c by_dir.c v3_net.c v3_x509.c +TEST= +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/conf +ALL=Makefile conf.c conf_err.c conf_lcl.h conf.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS=-I.. -I../../include -g +DIR=conf +ERR=conf +ERRC=conf_err +EXHEADER=conf.h +GENERAL=Makefile +HEADER=conf_lcl.h conf.h +INCLUDES=-I.. -I../../include +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=conf.o conf_err.o +LIBSRC=conf.c conf_err.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=conf.c conf_err.c +TEST= +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/txt_db +ALL=Makefile txt_db.c txt_db.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS= -g +DIR=txt_db +EXHEADER=txt_db.h +GENERAL=Makefile +HEADER=txt_db.h +INCLUDES= +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=txt_db.o +LIBSRC=txt_db.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=txt_db.c +TEST= +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=crypto/pkcs7 +ALL=Makefile README pk7_lib.c pkcs7err.c pk7_doit.c pkcs7.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS=-I.. -I../../include -g +DIR=pkcs7 +ERR=pkcs7 +ERRC=pkcs7err +EXHEADER=pkcs7.h +GENERAL=Makefile README +HEADER=pkcs7.h +INCLUDES=-I.. -I../../include +INSTALLTOP=/usr/local/ssl +LIB=../../libcrypto.a +LIBOBJ=pk7_lib.o pkcs7err.o pk7_doit.o +LIBSRC=pk7_lib.c pkcs7err.c pk7_doit.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=pk7_lib.c pkcs7err.c pk7_doit.c +TEST= +TOP=../.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=ssl +ALL=Makefile README s2_meth.c s2_srvr.c s2_clnt.c s2_lib.c s2_enc.c s2_pkt.c s3_meth.c s3_srvr.c s3_clnt.c s3_lib.c s3_enc.c s3_pkt.c s3_both.c s23_meth.c s23_srvr.c s23_clnt.c s23_lib.c s23_pkt.c t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c ssl_lib.c ssl_err2.c ssl_cert.c ssl_sess.c ssl_ciph.c ssl_stat.c ssl_rsa.c ssl_asn1.c ssl_txt.c ssl_algs.c bio_ssl.c ssl_err.c ssl.h ssl2.h ssl3.h ssl23.h tls1.h ssl_locl.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS=-I../crypto -I../include -g +DIR=ssl +ERR=ssl +ERRC=ssl_err +EXHEADER=ssl.h ssl2.h ssl3.h ssl23.h tls1.h +GENERAL=Makefile README +HEADER=ssl.h ssl2.h ssl3.h ssl23.h tls1.h ssl_locl.h +INCLUDES=-I../crypto -I../include +INSTALLTOP=/usr/local/ssl +LIB=../libssl.a +LIBOBJ=s2_meth.o s2_srvr.o s2_clnt.o s2_lib.o s2_enc.o s2_pkt.o s3_meth.o s3_srvr.o s3_clnt.o s3_lib.o s3_enc.o s3_pkt.o s3_both.o s23_meth.o s23_srvr.o s23_clnt.o s23_lib.o s23_pkt.o t1_meth.o t1_srvr.o t1_clnt.o t1_lib.o t1_enc.o ssl_lib.o ssl_err2.o ssl_cert.o ssl_sess.o ssl_ciph.o ssl_stat.o ssl_rsa.o ssl_asn1.o ssl_txt.o ssl_algs.o bio_ssl.o ssl_err.o +LIBSRC=s2_meth.c s2_srvr.c s2_clnt.c s2_lib.c s2_enc.c s2_pkt.c s3_meth.c s3_srvr.c s3_clnt.c s3_lib.c s3_enc.c s3_pkt.c s3_both.c s23_meth.c s23_srvr.c s23_clnt.c s23_lib.c s23_pkt.c t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c ssl_lib.c ssl_err2.c ssl_cert.c ssl_sess.c ssl_ciph.c ssl_stat.c ssl_rsa.c ssl_asn1.c ssl_txt.c ssl_algs.c bio_ssl.c ssl_err.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=s2_meth.c s2_srvr.c s2_clnt.c s2_lib.c s2_enc.c s2_pkt.c s3_meth.c s3_srvr.c s3_clnt.c s3_lib.c s3_enc.c s3_pkt.c s3_both.c s23_meth.c s23_srvr.c s23_clnt.c s23_lib.c s23_pkt.c t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c ssl_lib.c ssl_err2.c ssl_cert.c ssl_sess.c ssl_ciph.c ssl_stat.c ssl_rsa.c ssl_asn1.c ssl_txt.c ssl_algs.c bio_ssl.c ssl_err.c +TEST=ssltest.c +TOP=.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=rsaref +ALL=Makefile rsaref.c rsar_err.c rsaref.h +APPS= +AR=ar r +CC=cc +CFLAG=-g +CFLAGS=-I../crypto -I../include -g +DIR=rsaref +ERR=rsaref +ERRC=rsar_err +EXHEADER= +GENERAL=Makefile +HEADER= rsaref.h +INCLUDES=-I../crypto -I../include +INSTALLTOP=/usr/local/ssl +LIB=../libRSAglue.a +LIBOBJ=rsaref.o rsar_err.o +LIBSRC=rsaref.c rsar_err.c +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +SRC=rsaref.c rsar_err.c +TEST= +TOP=.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=apps +ALL=Makefile verify.c asn1pars.c req.c dgst.c dh.c enc.c gendh.c errstr.c ca.c pkcs7.c crl2p7.c crl.c rsa.c dsa.c dsaparam.c x509.c genrsa.c s_server.c s_client.c speed.c s_time.c apps.c s_cb.c s_socket.c version.c sess_id.c ciphers.c apps.h progs.h s_apps.h testdsa.h testrsa.h +A_OBJ=apps.o +A_SRC=apps.c +CC=cc +CFLAG=-g -static +CFLAGS=-DMONOLITH -I../include -g -static +DIR=apps +DLIBCRYPTO=../libcrypto.a +DLIBSSL=../libssl.a +EXE=ssleay +EXHEADER= +EX_LIBS= +E_EXE=verify asn1pars req dgst dh enc gendh errstr ca crl rsa dsa dsaparam x509 genrsa s_server s_client speed s_time version pkcs7 crl2pkcs7 sess_id ciphers +E_OBJ=verify.o asn1pars.o req.o dgst.o dh.o enc.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o dsa.o dsaparam.o x509.o genrsa.o s_server.o s_client.o speed.o s_time.o apps.o s_cb.o s_socket.o version.o sess_id.o ciphers.o +E_SRC=verify.c asn1pars.c req.c dgst.c dh.c enc.c gendh.c errstr.c ca.c pkcs7.c crl2p7.c crl.c rsa.c dsa.c dsaparam.c x509.c genrsa.c s_server.c s_client.c speed.c s_time.c apps.c s_cb.c s_socket.c version.c sess_id.c ciphers.c +GENERAL=Makefile +HEADER=apps.h progs.h s_apps.h testdsa.h testrsa.h +INCLUDES=-I../include +INSTALLTOP=/usr/local/ssl +LIBCRYPTO=-L.. -lcrypto +LIBSSL=-L.. -lssl +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +PEX_LIBS= +PROGS=ssleay.c +RM=/bin/rm -f +SCRIPTS=CA.sh der_chop +SRC=verify.c asn1pars.c req.c dgst.c dh.c enc.c gendh.c errstr.c ca.c pkcs7.c crl2p7.c crl.c rsa.c dsa.c dsaparam.c x509.c genrsa.c s_server.c s_client.c speed.c s_time.c apps.c s_cb.c s_socket.c version.c sess_id.c ciphers.c +SSLEAY=ssleay +S_OBJ=s_cb.o s_socket.o +S_SRC=s_cb.c s_socket.c +TOP=.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=test +ALL=Makefile.ssl bntest.c ideatest.c md2test.c md5test.c hmactest.c rc2test.c rc4test.c rc5test.c destest.c shatest.c sha1test.c mdc2test.c rmdtest.c randtest.c dhtest.c casttest.c bftest.c ssltest.c dsatest.c exptest.c +BFTEST=bftest +BNTEST=bntest +CASTTEST=casttest +CC=cc +CFLAG=-g +CFLAGS=-I../include -g +DESTEST=destest +DHTEST=dhtest +DIR=test +DLIBCRYPTO=../libcrypto.a +DLIBSSL=../libssl.a +DSATEST=dsatest +EXE=bntest ideatest md2test md5test hmactest rc2test rc4test rc5test destest shatest sha1test mdc2test rmdtest randtest dhtest bftest casttest ssltest exptest dsatest +EXHEADER= +EXPTEST=exptest +EX_LIBS= +GENERAL=Makefile.ssl +HEADER= +HMACTEST=hmactest +IDEATEST=ideatest +INCLUDES=-I../include +INSTALLTOP=/usr/local/ssl +LIBCRYPTO=-L.. -lcrypto +LIBSSL=-L.. -lssl +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -fMakefile.ssl +MAKEFILE=Makefile.ssl +MD2TEST=md2test +MD5TEST=md5test +MDC2TEST=mdc2test +METHTEST=methtest +OBJ=bntest.o ideatest.o md2test.o md5test.o hmactest.o rc2test.o rc4test.o rc5test.o destest.o shatest.o sha1test.o mdc2test.o rmdtest.o randtest.o dhtest.o casttest.o bftest.o ssltest.o dsatest.o exptest.o +PEX_LIBS= +RANDTEST=randtest +RC2TEST=rc2test +RC4TEST=rc4test +RC5TEST=rc5test +RMDTEST=rmdtest +SHA1TEST=sha1test +SHATEST=shatest +SRC=bntest.c ideatest.c md2test.c md5test.c hmactest.c rc2test.c rc4test.c rc5test.c destest.c shatest.c sha1test.c mdc2test.c rmdtest.c randtest.c dhtest.c casttest.c bftest.c ssltest.c dsatest.c exptest.c +SSLTEST=ssltest +TOP=.. +RELATIVE_DIRECTORY= +RELATIVE_DIRECTORY=tools +APPS=c_hash c_info c_issuer c_name c_rehash +CC=cc +CFLAG=-g +CFLAGS=-I.. -I../../include -g +DIR=tools +GENERAL=Makefile.ssl +INCLUDES=-I.. -I../../include +INSTALLTOP=/usr/local/ssl +MAKE=make -f Makefile.ssl +MAKEDEPEND=makedepend -f Makefile.ssl +MAKEFILE=Makefile.ssl +TEST= +TOP=.. +RELATIVE_DIRECTORY= diff --git a/src/lib/libssl/src/PATENTS b/src/lib/libssl/src/PATENTS new file mode 100644 index 0000000000..61423d03c8 --- /dev/null +++ b/src/lib/libssl/src/PATENTS @@ -0,0 +1,9 @@ +RSA Data Security holds software patents on the RSA and RC5 algorithms. +If there ciphers are used used inside the USA (and Japan?), you must contact +RSA Data Security for licencing conditions. + +The IDEA algorithm is patented by XXXX and they should be contacted if that +algorithm is to be used. + +RC4 is a trademark of RSA Data Security, so use of this label should perhaps +only me used with RSA Data Security's permission. diff --git a/src/lib/libssl/src/README.066 b/src/lib/libssl/src/README.066 new file mode 100644 index 0000000000..d8e086d0b4 --- /dev/null +++ b/src/lib/libssl/src/README.066 @@ -0,0 +1,27 @@ + +SSLeay 0.6.6 13-Jan-1997 + +The main additions are + +- assember for x86 DES improvments. + From 191,000 per second on a pentium 100, I now get 281,000. The inner + loop and the IP/FP modifications are from + Svend Olaf Mikkelsen <svolaf@inet.uni-c.dk>. Many thanks for his + contribution. +- The 'DES macros' introduced in 0.6.5 now have 3 types. + DES_PTR1, DES_PTR2 and 'normal'. As per before, des_opts reports which + is best and there is a summery of mine in crypto/des/options.txt +- A few bug fixes. +- Added blowfish. It is not used by SSL but all the other stuff that + deals with ciphers can use it in either ecb, cbc, cfb64 or ofb64 modes. + There are 3 options for optimising Blowfish. BF_PTR, BF_PTR2 and 'normal'. + BF_PTR2 is pentium/x86 specific. The correct option is setup in + the 'Configure' script. +- There is now a 'get client certificate' callback which can be + 'non-blocking'. If more details are required, let me know. It will + documented more in SSLv3 when I finish it. +- Bug fixes from 0.6.5 including the infamous 'ca' bug. The 'make test' + now tests the ca program. +- Lots of little things modified and tweaked. + +eric diff --git a/src/lib/libssl/src/README.080 b/src/lib/libssl/src/README.080 new file mode 100644 index 0000000000..155ce1c712 --- /dev/null +++ b/src/lib/libssl/src/README.080 @@ -0,0 +1,147 @@ +This version of SSLeay has quite a lot of things different from the +previous version. + +Basically check all callback parameters, I will be producing documentation +about how to use things in th future. Currently I'm just getting 080 out +the door. Please not that there are several ways to do everything, and +most of the applications in the apps directory are hybrids, some using old +methods and some using new methods. + +Have a look in demos/bio for some very simple programs and +apps/s_client.c and apps/s_server.c for some more advanced versions. +Notes are definitly needed but they are a week or so away. + +Anyway, some quick nots from Tim Hudson (tjh@cryptsoft.com) +--- +Quick porting notes for moving from SSLeay-0.6.x to SSLeay-0.8.x to +get those people that want to move to using the new code base off to +a quick start. + +Note that Eric has tidied up a lot of the areas of the API that were +less than desirable and renamed quite a few things (as he had to break +the API in lots of places anyrate). There are a whole pile of additional +functions for making dealing with (and creating) certificates a lot +cleaner. + +01-Jul-97 +Tim Hudson +tjh@cryptsoft.com + +---8<--- + +To maintain code that uses both SSLeay-0.6.x and SSLeay-0.8.x you could +use something like the following (assuming you #include "crypto.h" which +is something that you really should be doing). + +#if SSLEAY_VERSION_NUMBER >= 0x0800 +#define SSLEAY8 +#endif + +buffer.h -> splits into buffer.h and bio.h so you need to include bio.h + too if you are working with BIO internal stuff (as distinct + from simply using the interface in an opaque manner) + +#include "bio.h" - required along with "buffer.h" if you write + your own BIO routines as the buffer and bio + stuff that was intermixed has been separated + out + +envelope.h -> evp.h (which should have been done ages ago) + +Initialisation ... don't forget these or you end up with code that +is missing the bits required to do useful things (like ciphers): + +SSLeay_add_ssl_algorithms() +(probably also want SSL_load_error_strings() too but you should have + already had that call in place) + +SSL_CTX_new() - requires an extra method parameter + SSL_CTX_new(SSLv23_method()) + SSL_CTX_new(SSLv2_method()) + SSL_CTX_new(SSLv3_method()) + + OR to only have the server or the client code + SSL_CTX_new(SSLv23_server_method()) + SSL_CTX_new(SSLv2_server_method()) + SSL_CTX_new(SSLv3_server_method()) + or + SSL_CTX_new(SSLv23_client_method()) + SSL_CTX_new(SSLv2_client_method()) + SSL_CTX_new(SSLv3_client_method()) + +SSL_set_default_verify_paths() ... renamed to the more appropriate +SSL_CTX_set_default_verify_paths() + +If you want to use client certificates then you have to add in a bit +of extra stuff in that a SSLv3 server sends a list of those CAs that +it will accept certificates from ... so you have to provide a list to +SSLeay otherwise certain browsers will not send client certs. + +SSL_CTX_set_client_CA_list(ctx,SSL_load_client_CA_file(s_cert_file)); + + +X509_NAME_oneline(X) -> X509_NAME_oneline(X,NULL,0) + or provide a buffer and size to copy the + result into + +X509_add_cert -> X509_STORE_add_cert (and you might want to read the + notes on X509_NAME structure changes too) + + +VERIFICATION CODE +================= + +The codes have all be renamed from VERIFY_ERR_* to X509_V_ERR_* to +more accurately reflect things. + +The verification callback args are now packaged differently so that +extra fields for verification can be added easily in future without +having to break things by adding extra parameters each release :-) + +X509_cert_verify_error_string -> X509_verify_cert_error_string + + +BIO INTERNALS +============= + +Eric has fixed things so that extra flags can be introduced in +the BIO layer in future without having to play with all the BIO +modules by adding in some macros. + +The ugly stuff using + b->flags ~= (BIO_FLAGS_RW|BIO_FLAGS_SHOULD_RETRY) +becomes + BIO_clear_retry_flags(b) + + b->flags |= (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY) +becomes + BIO_set_retry_read(b) + +Also ... BIO_get_retry_flags(b), BIO_set_flags(b) + + + +OTHER THINGS +============ + +X509_NAME has been altered so that it isn't just a STACK ... the STACK +is now in the "entries" field ... and there are a pile of nice functions +for getting at the details in a much cleaner manner. + +SSL_CTX has been altered ... "cert" is no longer a direct member of this +structure ... things are now down under "cert_store" (see x509_vfy.h) and +things are no longer in a CERTIFICATE_CTX but instead in a X509_STORE. +If your code "knows" about this level of detail then it will need some +surgery. + +If you depending on the incorrect spelling of a number of the error codes +then you will have to change your code as these have been fixed. + +ENV_CIPHER "type" got renamed to "nid" and as that is what it actually +has been all along so this makes things clearer. +ify_cert_error_string(ctx->error)); + +SSL_R_NO_CIPHER_WE_TRUST -> SSL_R_NO_CIPHER_LIST + and SSL_R_REUSE_CIPHER_LIST_NOT_ZERO + + diff --git a/src/lib/libssl/src/README.090 b/src/lib/libssl/src/README.090 new file mode 100644 index 0000000000..634870d5f1 --- /dev/null +++ b/src/lib/libssl/src/README.090 @@ -0,0 +1,71 @@ +10-Apr-1998 +I said the next version would go out at easter, and so it shall. +I expect a 0.9.1 will follow with portability fixes in the next few weeks. + +This is a quick, meet the deadline. Look to ssl-users for comments on what +is new etc. + +The state of play +- TLSv1 - I need to do some explaining about how the methods interact. + The bad news is that SSLeay 0.8.x application will not roll back to + SSLv3, I suffed up. 0.8.x is rather pedantic about the '3.0' version + number. Look at the 'no-tls' options in applications in the apps directory. +- The perl5 stuff is very rough. The SSL part does not work due to + reference count hassles in the BIO stuff. I just have not had time to + look at it. The cipher, digest and bignum stuff works though. I just + need to clean up the API. +- Lots of x86 assember. I now have it for des, 3des, rc4, rc5, blowfish, + cast, md5, sha1 and ripemd160. It has been tested on win32, linux (elf) + and FreeBSD (a.out). +- As mentioned above, cast, rc5 and ripemd160 have been added. +- A simple HMAC set of functions. +- EX_DATA strucutre, which can be used by applications or other libraries + to tack arbitarty data against strucutures that include it. + You will probably have to see examples to see how to use it, and I will + elaberate on the ssl-users mailing list +- RSA blinding. If you fear timing attacks on RSA, you can turn on + blinding which defeats it. +- From Tim Hudson, try running 'sh config' instead of 'perl Configure'. + I makes an educated guess as to what you are and then runs 'perl Configure' +- The error stuff has been modified so arbitary strings can be taged + against an error message. It is used in a few places to elaberate on + parameters that caused the error. + +Areas of work +- The 16bit big-num assember needs a routine added. The WIN16 and + WIN32 stuff is ok, but MS-DOS or 286 builds need the update. +- Most of the bignum assember will not work. There will be a function + missing, bn_add_words(). I need people to send me the C compiler output + for platforms I don't already have. Currently, the assember is correct for + x86, win32, win16(386+), linux elf, FreeBSD a.out and sparc. +- PKCS7, I have delusions of s/MIME. I need to do a BIO interface. +- perl5, it needs finishing +- X509v3 extension. I have some ideas, I just need to + implement them :-) +- Public key methods. I need to clean up the library internally so + public key methods are loaded is a similar way to symetric ciphers + and digests. I also need to seperate out the digests from public + key methods. This stuff is needed to support sortware patents, smaller + code size and hardware tokens. + +Anyway, this release gets out the bug fixes and TLS, but be warned, until +all those old SSLeay 0.8.x based server get upgraded, you will need to +connect with SSLv3 if TLSv1 fails. + +eric (about to go bushwalking for the 4 day easter break :-) + +PS Common problems +- For Win32 build, use /MD to specify your libraries, or build SSLeay with + the same flags as your application. Visual C stuffs up the malloc routines + if memory allocated by one memory model is freed by another. FILE pointers + are a major cause of these problem. +- If you are trying to use non-blocking IO and it is not working, + try 'ssleay s_client -help' and see if the -nbio option is listed. + For unixware, it has the non-block IO define in 'differnt' header file + and SSLeay will silently build without non-blocking IO calls (but for + unixware, the special header has been included). +- -DL_ENDIAN. For the message digests, some code needs to be turned off + in the C code when assember is used. For x86, this means the L_ENDIAN + needs to defined when x86 -DSHA1_ASM is defined. The reasons this is + not automagically done is because non-x86 assember could be bigendian. + For pure C code builds, the B_ENDIAN/L_ENDIAN flags are optional. diff --git a/src/lib/libssl/src/TODO b/src/lib/libssl/src/TODO new file mode 100644 index 0000000000..1c3da41cdf --- /dev/null +++ b/src/lib/libssl/src/TODO @@ -0,0 +1,28 @@ +- The loading of the netscape RC4 encrypted key is a crock of pig pellets. + It will be reworked along with a nice general mechanism for encrypting + ASN.1 stuff. [ Jun 96 ] I've cleaned up private keys internally but + still have not done PKCS#8 support. + +- Winsock support in s_client/s_server for windows nt/3.1 is a crock. + I will probably not get this fixed for a while, it is just there so + I could test things. + +- Be able to generate DSS certificates. + +- Add CRL to the X509 verification stuff, this will probably be added with + SSLv3. + ++ X509 callback. I need to callback the application to retrieve certificates + and CRL. + +*<- designates the things I'm activly working on. ++<- designates that which I have next in the queue. + +==== + +X509v3 extensions +verify certificate chains +X509 cert lookup methods +RSA/DSA/DH methods mostly for smart cards +dsa cert generation + diff --git a/src/lib/libssl/src/VERSION b/src/lib/libssl/src/VERSION new file mode 100644 index 0000000000..5555e9a3af --- /dev/null +++ b/src/lib/libssl/src/VERSION @@ -0,0 +1,24 @@ +SSLeay 0.8.1 + - Mostly bug fixes. There is an Ephemeral DH cipher problem which + is fixed. + +SSLeay 0.8.0 + - New release, for those that are wondering what happend to + 0.7.x, call it our internal development version :-) + - There have been lots of changes, mostly the addition of SSLv3. + - There have been many additions from people and amongst + others, C2Net has assisted greatly. + +SSLeay 0.6.6 + SSLeay 0.8.0 is not upward compatable with SSLeay 0.6.6, so + if your application requires 0.6.6, use it. There have been + lots of bug fixes to 0.8.x that have not been applied to 0.6.6 + so use 0.8.0+ in preference. + +PORTING 0.6.6 to 0.8.0 + I'll be documenting this over the next few weeks but as + pressures have been increasing for making SSLv3 support + available I'm shipping it without this documentation as I + basically have not had time to write it (too busy earning a + living :-) + diff --git a/src/lib/libssl/src/apps/eay.c b/src/lib/libssl/src/apps/eay.c new file mode 100644 index 0000000000..37d5dcbd30 --- /dev/null +++ b/src/lib/libssl/src/apps/eay.c @@ -0,0 +1,130 @@ +/* apps/eay.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define MONOLITH +#define USE_SOCKETS +#include "../e_os.h" + +#include "bio.h" +#include "stack.h" +#include "lhash.h" + +#include "err.h" + +#include "bn.h" + +#include "evp.h" + +#include "rand.h" +#include "conf.h" +#include "txt_db.h" + +#include "err.h" + +#include "x509.h" +#include "pkcs7.h" +#include "pem.h" +#include "asn1.h" +#include "objects.h" + +#define MONOLITH + +#include "ssleay.c" +#include "apps.c" +#include "asn1pars.c" +#ifndef NO_RSA +#include "ca.c" +#include "genrsa.c" +#include "req.c" +#include "rsa.c" +#endif +#ifndef NO_DH +#include "gendh.c" +#include "dh.c" +#endif +#include "crl.c" +#include "crl2p7.c" +#include "dgst.c" +#include "enc.c" +#include "errstr.c" +#if !defined(NO_SSL2) || !defined(NO_SSL3) +#ifndef NO_SOCK +#include "s_cb.c" +#include "s_client.c" +#include "s_server.c" +#include "s_socket.c" +#include "s_time.c" +#endif +#endif +#include "speed.c" +#include "verify.c" +#include "version.c" +#include "x509.c" +#include "ciphers.c" +#include "sess_id.c" +#include "pkcs7.c" +#ifndef NO_DSA +#include "dsaparam.c" +#include "dsa.c" +#include "gendsa.c" +#endif + diff --git a/src/lib/libssl/src/apps/ext.v3 b/src/lib/libssl/src/apps/ext.v3 new file mode 100644 index 0000000000..87ee8e6173 --- /dev/null +++ b/src/lib/libssl/src/apps/ext.v3 @@ -0,0 +1,2 @@ +2.99999.3 SET.ex3 SET x509v3 extension 3 + diff --git a/src/lib/libssl/src/apps/g_ssleay.pl b/src/lib/libssl/src/apps/g_ssleay.pl new file mode 100644 index 0000000000..bd5621dcab --- /dev/null +++ b/src/lib/libssl/src/apps/g_ssleay.pl @@ -0,0 +1,114 @@ +#!/usr/bin/perl + +$mkprog='mklinks'; +$rmprog='rmlinks'; + +print "#ifndef NOPROTO\n"; + +grep(s/^asn1pars$/asn1parse/,@ARGV); + +foreach (@ARGV) + { printf "extern int %s_main(int argc,char *argv[]);\n",$_; } +print "#else\n"; +foreach (@ARGV) + { printf "extern int %s_main();\n",$_; } +print "#endif\n"; + + +print <<'EOF'; + +#ifdef SSLEAY_SRC + +#define FUNC_TYPE_GENERAL 1 +#define FUNC_TYPE_MD 2 +#define FUNC_TYPE_CIPHER 3 + +typedef struct { + int type; + char *name; + int (*func)(); + } FUNCTION; + +FUNCTION functions[] = { +EOF + +foreach (@ARGV) + { + push(@files,$_); + $str="\t{FUNC_TYPE_GENERAL,\"$_\",${_}_main},\n"; + if (($_ =~ /^s_/) || ($_ =~ /^ciphers$/)) + { print "#if !defined(NO_SOCK) && !(defined(NO_SSL2) && defined(O_SSL3))\n${str}#endif\n"; } + elsif ( ($_ =~ /^rsa$/) || ($_ =~ /^genrsa$/) || + ($_ =~ /^req$/) || ($_ =~ /^ca$/) || ($_ =~ /^x509$/)) + { print "#ifndef NO_RSA\n${str}#endif\n"; } + elsif ( ($_ =~ /^dsa$/) || ($_ =~ /^gendsa$/) || ($_ =~ /^dsaparam$/)) + { print "#ifndef NO_DSA\n${str}#endif\n"; } + elsif ( ($_ =~ /^dh$/) || ($_ =~ /^gendh$/)) + { print "#ifndef NO_DH\n${str}#endif\n"; } + else + { print $str; } + } + +foreach ("md2","md5","sha","sha1","mdc2") + { + push(@files,$_); + printf "\t{FUNC_TYPE_MD,\"%s\",dgst_main},\n",$_; + } + +foreach ( + "base64", + "des", "des3", "desx", "idea", "rc4", "rc2","bf","cast","rc5", + "des-ecb", "des-ede", "des-ede3", + "des-cbc", "des-ede-cbc","des-ede3-cbc", + "des-cfb", "des-ede-cfb","des-ede3-cfb", + "des-ofb", "des-ede-ofb","des-ede3-ofb", + "idea-cbc","idea-ecb", "idea-cfb", "idea-ofb", + "rc2-cbc", "rc2-ecb", "rc2-cfb", "rc2-ofb", + "bf-cbc", "bf-ecb", "bf-cfb", "bf-ofb", + "cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb", + "cast-cbc", "rc5-cbc", "rc5-ecb", "rc5-cfb", "rc5-ofb") + { + push(@files,$_); + + $t=sprintf("\t{FUNC_TYPE_CIPHER,\"%s\",enc_main},\n",$_); + if ($_ =~ /des/) { $t="#ifndef NO_DES\n${t}#endif\n"; } + elsif ($_ =~ /idea/) { $t="#ifndef NO_IDEA\n${t}#endif\n"; } + elsif ($_ =~ /rc4/) { $t="#ifndef NO_RC4\n${t}#endif\n"; } + elsif ($_ =~ /rc2/) { $t="#ifndef NO_RC2\n${t}#endif\n"; } + elsif ($_ =~ /bf/) { $t="#ifndef NO_BLOWFISH\n${t}#endif\n"; } + elsif ($_ =~ /cast/) { $t="#ifndef NO_CAST\n${t}#endif\n"; } + elsif ($_ =~ /rc5/) { $t="#ifndef NO_RC5\n${t}#endif\n"; } + print $t; + } + +print "\t{0,NULL,NULL}\n\t};\n"; +print "#endif\n\n"; + +open(OUT,">$mkprog") || die "unable to open '$prog':$!\n"; +print OUT "#!/bin/sh\nfor i in "; +foreach (@files) + { print OUT $_." "; } +print OUT <<'EOF'; + +do +echo making symlink for $i +/bin/rm -f $i +ln -s ssleay $i +done +EOF +close(OUT); +chmod(0755,$mkprog); + +open(OUT,">$rmprog") || die "unable to open '$prog':$!\n"; +print OUT "#!/bin/sh\nfor i in "; +foreach (@files) + { print OUT $_." "; } +print OUT <<'EOF'; + +do +echo removing $i +/bin/rm -f $i +done +EOF +close(OUT); +chmod(0755,$rmprog); diff --git a/src/lib/libssl/src/apps/mklinks b/src/lib/libssl/src/apps/mklinks new file mode 100644 index 0000000000..55a56b399e --- /dev/null +++ b/src/lib/libssl/src/apps/mklinks @@ -0,0 +1,7 @@ +#!/bin/sh +for i in verify asn1parse req dgst dh enc gendh errstr ca crl rsa dsa dsaparam x509 genrsa s_server s_client speed s_time version pkcs7 crl2pkcs7 sess_id ciphers md2 md5 sha sha1 mdc2 base64 des des3 desx idea rc4 rc2 bf cast rc5 des-ecb des-ede des-ede3 des-cbc des-ede-cbc des-ede3-cbc des-cfb des-ede-cfb des-ede3-cfb des-ofb des-ede-ofb des-ede3-ofb idea-cbc idea-ecb idea-cfb idea-ofb rc2-cbc rc2-ecb rc2-cfb rc2-ofb bf-cbc bf-ecb bf-cfb bf-ofb cast5-cbc cast5-ecb cast5-cfb cast5-ofb cast-cbc rc5-cbc rc5-ecb rc5-cfb rc5-ofb +do +echo making symlink for $i +/bin/rm -f $i +ln -s ssleay $i +done diff --git a/src/lib/libssl/src/apps/pem_mail.c b/src/lib/libssl/src/apps/pem_mail.c new file mode 100644 index 0000000000..64e04acb52 --- /dev/null +++ b/src/lib/libssl/src/apps/pem_mail.c @@ -0,0 +1,170 @@ +/* apps/pem_mail.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "rsa.h" +#include "evp.h" +#include "objects.h" +#include "x509.h" +#include "err.h" +#include "pem.h" +#include "apps.h" + +#undef PROG +#define PROG pem_mail_main + +static char *usage[]={ +"usage: pem_mail args\n", +"\n", +" -in arg - input file - default stdin\n", +" -out arg - output file - default stdout\n", +" -cert arg - the certificate to use\n", +" -key arg - the private key to use\n", +" -MIC - sign the message\n", +" -enc arg - encrypt with one of cbc-des\n", +NULL +}; + + +typedef struct lines_St + { + char *line; + struct lines_st *next; + } LINES; + +int main(argc, argv) +int argc; +char **argv; + { + FILE *in; + RSA *rsa=NULL; + EVP_MD_CTX ctx; + unsigned int mic=0,i,n; + unsigned char buf[1024*15]; + char *prog,*infile=NULL,*outfile=NULL,*key=NULL; + int badops=0; + + apps_startup(); + + prog=argv[0]; + argc--; + argv++; + while (argc >= 1) + { + if (strcmp(*argv,"-key") == 0) + { + if (--argc < 1) goto bad; + key= *(++argv); + } + else if (strcmp(*argv,"-in") == 0) + { + if (--argc < 1) goto bad; + infile= *(++argv); + } + else if (strcmp(*argv,"-out") == 0) + { + if (--argc < 1) goto bad; + outfile= *(++argv); + } + else if (strcmp(*argv,"-mic") == 0) + mic=1; + else + { + BIO_printf(bio_err,"unknown option %s\n",*argv); + badops=1; + break; + } + argc--; + argv++; + } + + if (badops) + { +bad: + BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog); + BIO_printf(bio_err,"where options are\n"); + EXIT(1); + } + + if (key == NULL) + { BIO_printf(bio_err,"you need to specify a key\n"); EXIT(1); } + in=fopen(key,"r"); + if (in == NULL) { perror(key); EXIT(1); } + rsa=PEM_read_RSAPrivateKey(in,NULL,NULL); + if (rsa == NULL) + { + BIO_printf(bio_err,"unable to load Private Key\n"); + ERR_print_errors(bio_err); + EXIT(1); + } + fclose(in); + + PEM_SignInit(&ctx,EVP_md5()); + for (;;) + { + i=fread(buf,1,1024*10,stdin); + if (i <= 0) break; + PEM_SignUpdate(&ctx,buf,i); + } + if (!PEM_SignFinal(&ctx,buf,&n,rsa)) goto err; + BIO_printf(bio_err,"%s\n",buf); + EXIT(0); +err: + ERR_print_errors(bio_err); + EXIT(1); + } diff --git a/src/lib/libssl/src/apps/rmlinks b/src/lib/libssl/src/apps/rmlinks new file mode 100644 index 0000000000..7c4f8983ba --- /dev/null +++ b/src/lib/libssl/src/apps/rmlinks @@ -0,0 +1,6 @@ +#!/bin/sh +for i in verify asn1parse req dgst dh enc gendh errstr ca crl rsa dsa dsaparam x509 genrsa s_server s_client speed s_time version pkcs7 crl2pkcs7 sess_id ciphers md2 md5 sha sha1 mdc2 base64 des des3 desx idea rc4 rc2 bf cast rc5 des-ecb des-ede des-ede3 des-cbc des-ede-cbc des-ede3-cbc des-cfb des-ede-cfb des-ede3-cfb des-ofb des-ede-ofb des-ede3-ofb idea-cbc idea-ecb idea-cfb idea-ofb rc2-cbc rc2-ecb rc2-cfb rc2-ofb bf-cbc bf-ecb bf-cfb bf-ofb cast5-cbc cast5-ecb cast5-cfb cast5-ofb cast-cbc rc5-cbc rc5-ecb rc5-cfb rc5-ofb +do +echo removing $i +/bin/rm -f $i +done diff --git a/src/lib/libssl/src/apps/ssleay.c b/src/lib/libssl/src/apps/ssleay.c new file mode 100644 index 0000000000..eac411b854 --- /dev/null +++ b/src/lib/libssl/src/apps/ssleay.c @@ -0,0 +1,342 @@ +/* apps/ssleay.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef DEBUG +#undef DEBUG +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include "bio.h" +#include "crypto.h" +#include "lhash.h" +#include "conf.h" +#include "x509.h" +#include "pem.h" +#include "ssl.h" +#define SSLEAY /* turn off a few special case MONOLITH macros */ +#define USE_SOCKETS /* needed for the _O_BINARY defs in the MS world */ +#define SSLEAY_SRC +#include "apps.h" +#include "s_apps.h" +#include "err.h" + +/* +#ifdef WINDOWS +#include "bss_file.c" +#endif +*/ + +#ifndef NOPROTO +static unsigned long MS_CALLBACK hash(FUNCTION *a); +static int MS_CALLBACK cmp(FUNCTION *a,FUNCTION *b); +static LHASH *prog_init(void ); +static int do_cmd(LHASH *prog,int argc,char *argv[]); +#else +static unsigned long MS_CALLBACK hash(); +static int MS_CALLBACK cmp(); +static LHASH *prog_init(); +static int do_cmd(); +#endif + +LHASH *config=NULL; +char *default_config_file=NULL; + +#ifdef DEBUG +static void sig_stop(i) +int i; + { + char *a=NULL; + + *a='\0'; + } +#endif + +/* Make sure there is only one when MONOLITH is defined */ +#ifdef MONOLITH +BIO *bio_err=NULL; +#endif + +int main(Argc,Argv) +int Argc; +char *Argv[]; + { + ARGS arg; +#define PROG_NAME_SIZE 16 + char pname[PROG_NAME_SIZE]; + FUNCTION f,*fp; + MS_STATIC char *prompt,buf[1024],config_name[256]; + int n,i,ret=0; + int argc; + char **argv,*p; + LHASH *prog=NULL; + long errline; + + arg.data=NULL; + arg.count=0; + + /* SSLeay_add_ssl_algorithms(); is called in apps_startup() */ + apps_startup(); + +#if defined(DEBUG) && !defined(WINDOWS) && !defined(MSDOS) +#ifdef SIGBUS + signal(SIGBUS,sig_stop); +#endif +#ifdef SIGSEGV + signal(SIGSEGV,sig_stop); +#endif +#endif + + if (bio_err == NULL) + if ((bio_err=BIO_new(BIO_s_file())) != NULL) + BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); + + CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); + + ERR_load_crypto_strings(); + + /* Lets load up our environment a little */ + p=getenv("SSLEAY_CONF"); + if (p == NULL) + { + strcpy(config_name,X509_get_default_cert_area()); + strcat(config_name,"/lib/"); + strcat(config_name,SSLEAY_CONF); + p=config_name; + } + + default_config_file=p; + + config=CONF_load(config,p,&errline); + if (config == NULL) ERR_clear_error(); + + prog=prog_init(); + + /* first check the program name */ + program_name(Argv[0],pname,PROG_NAME_SIZE); + + f.name=pname; + fp=(FUNCTION *)lh_retrieve(prog,(char *)&f); + if (fp != NULL) + { + Argv[0]=pname; + ret=fp->func(Argc,Argv); + goto end; + } + + /* ok, now check that there are not arguments, if there are, + * run with them, shifting the ssleay off the front */ + if (Argc != 1) + { + Argc--; + Argv++; + ret=do_cmd(prog,Argc,Argv); + if (ret < 0) ret=0; + goto end; + } + + /* ok, lets enter the old 'SSLeay>' mode */ + + for (;;) + { + ret=0; + p=buf; + n=1024; + i=0; + for (;;) + { + p[0]='\0'; + if (i++) + prompt=">"; + else prompt="SSLeay>"; + fputs(prompt,stdout); + fflush(stdout); + fgets(p,n,stdin); + if (p[0] == '\0') goto end; + i=strlen(p); + if (i <= 1) break; + if (p[i-2] != '\\') break; + i-=2; + p+=i; + n-=i; + } + if (!chopup_args(&arg,buf,&argc,&argv)) break; + + ret=do_cmd(prog,argc,argv); + if (ret < 0) + { + ret=0; + goto end; + } + if (ret != 0) + BIO_printf(bio_err,"error in %s\n",argv[0]); + BIO_flush(bio_err); + } + BIO_printf(bio_err,"bad exit\n"); + ret=1; +end: + if (config != NULL) + { + CONF_free(config); + config=NULL; + } + if (prog != NULL) lh_free(prog); + if (arg.data != NULL) Free(arg.data); + ERR_remove_state(0); + + EVP_cleanup(); + + CRYPTO_mem_leaks(bio_err); + if (bio_err != NULL) + { + BIO_free(bio_err); + bio_err=NULL; + } + EXIT(ret); + } + +static int do_cmd(prog,argc,argv) +LHASH *prog; +int argc; +char *argv[]; + { + FUNCTION f,*fp; + int i,ret=1,tp,nl; + + if ((argc <= 0) || (argv[0] == NULL)) + { ret=0; goto end; } + f.name=argv[0]; + fp=(FUNCTION *)lh_retrieve(prog,(char *)&f); + if (fp != NULL) + { + ret=fp->func(argc,argv); + } + else if ((strcmp(argv[0],"quit") == 0) || + (strcmp(argv[0],"q") == 0) || + (strcmp(argv[0],"exit") == 0) || + (strcmp(argv[0],"bye") == 0)) + { + ret= -1; + goto end; + } + else + { + BIO_printf(bio_err,"'%s' is a bad command, valid commands are", + argv[0]); + i=0; + fp=functions; + tp=0; + for (fp=functions; fp->name != NULL; fp++) + { + nl=0; + if (((i++) % 5) == 0) + { + BIO_printf(bio_err,"\n"); + nl=1; + } + if (fp->type != tp) + { + tp=fp->type; + if (!nl) BIO_printf(bio_err,"\n"); + if (tp == FUNC_TYPE_MD) + { + i=1; + BIO_printf(bio_err, + "Message Digest commands - see the dgst command for more details\n"); + } + else if (tp == FUNC_TYPE_CIPHER) + { + i=1; + BIO_printf(bio_err,"Cipher commands - see the enc command for more details\n"); + } + } + BIO_printf(bio_err,"%-15s",fp->name); + } + BIO_printf(bio_err,"\nquit\n"); + ret=0; + } +end: + return(ret); + } + +static LHASH *prog_init() + { + LHASH *ret; + FUNCTION *f; + + if ((ret=lh_new(hash,cmp)) == NULL) return(NULL); + + for (f=functions; f->name != NULL; f++) + lh_insert(ret,(char *)f); + return(ret); + } + +static int MS_CALLBACK cmp(a,b) +FUNCTION *a,*b; + { + return(strncmp(a->name,b->name,8)); + } + +static unsigned long MS_CALLBACK hash(a) +FUNCTION *a; + { + return(lh_strhash(a->name)); + } + +#undef SSLEAY diff --git a/src/lib/libssl/src/apps/ssleay.cnf b/src/lib/libssl/src/apps/ssleay.cnf new file mode 100644 index 0000000000..0b3bfa64f8 --- /dev/null +++ b/src/lib/libssl/src/apps/ssleay.cnf @@ -0,0 +1,116 @@ +# +# SSLeay example configuration file. +# This is mostly being used for generation of certificate requests. +# + +RANDFILE = $ENV::HOME/.rnd + +#################################################################### +[ ca ] +default_ca = CA_default # The default ca section + +#################################################################### +[ CA_default ] + +dir = ./demoCA # Where everything is kept +certs = $dir/certs # Where the issued certs are kept +crl_dir = $dir/crl # Where the issued crl are kept +database = $dir/index.txt # database index file. +new_certs_dir = $dir/newcerts # default place for new certs. + +certificate = $dir/cacert.pem # The CA certificate +serial = $dir/serial # The current serial number +crl = $dir/crl.pem # The current CRL +private_key = $dir/private/cakey.pem# The private key +RANDFILE = $dir/private/.rand # private random number file + +x509_extensions = x509v3_extensions # The extentions to add to the cert +default_days = 365 # how long to certify for +default_crl_days= 30 # how long before next CRL +default_md = md5 # which md to use. +preserve = no # keep passed DN ordering + +# A few difference way of specifying how similar the request should look +# For type CA, the listed attributes must be the same, and the optional +# and supplied fields are just that :-) +policy = policy_match + +# For the CA policy +[ policy_match ] +countryName = match +stateOrProvinceName = match +organizationName = match +organizationalUnitName = optional +commonName = supplied +emailAddress = optional + +# For the 'anything' policy +# At this point in time, you must list all acceptable 'object' +# types. +[ policy_anything ] +countryName = optional +stateOrProvinceName = optional +localityName = optional +organizationName = optional +organizationalUnitName = optional +commonName = supplied +emailAddress = optional + +#################################################################### +[ req ] +default_bits = 1024 +default_keyfile = privkey.pem +distinguished_name = req_distinguished_name +attributes = req_attributes + +[ req_distinguished_name ] +countryName = Country Name (2 letter code) +countryName_default = AU +countryName_min = 2 +countryName_max = 2 + +stateOrProvinceName = State or Province Name (full name) +stateOrProvinceName_default = Some-State + +localityName = Locality Name (eg, city) + +0.organizationName = Organization Name (eg, company) +0.organizationName_default = Internet Widgits Pty Ltd + +# we can do this but it is not needed normally :-) +#1.organizationName = Second Organization Name (eg, company) +#1.organizationName_default = CryptSoft Pty Ltd + +organizationalUnitName = Organizational Unit Name (eg, section) +#organizationalUnitName_default = + +commonName = Common Name (eg, YOUR name) +commonName_max = 64 + +emailAddress = Email Address +emailAddress_max = 40 + +[ req_attributes ] +challengePassword = A challenge password +challengePassword_min = 4 +challengePassword_max = 20 + +unstructuredName = An optional company name + +[ x509v3_extensions ] + +nsCaRevocationUrl = http://www.cryptsoft.com/ca-crl.pem +nsComment = "This is a comment" + +# under ASN.1, the 0 bit would be encoded as 80 +nsCertType = 0x40 + +#nsBaseUrl +#nsRevocationUrl +#nsRenewalUrl +#nsCaPolicyUrl +#nsSslServerName +#nsCertSequence +#nsCertExt +#nsDataType + diff --git a/src/lib/libssl/src/apps/tkca b/src/lib/libssl/src/apps/tkca new file mode 100644 index 0000000000..bdaf21606a --- /dev/null +++ b/src/lib/libssl/src/apps/tkca @@ -0,0 +1,66 @@ +#!/usr/local/bin/perl5 +# +# This is only something I'm playing with, it does not work :-) +# + +use Tk; + +my $main=MainWindow->new(); +my $f=$main->Frame(-relief => "ridge", -borderwidth => 2); +$f->pack(-fill => 'x'); + +my $ff=$f->Frame; +$ff->pack(-fill => 'x'); +my $l=$ff->Label(-text => "TkCA - SSLeay", + -relief => "ridge", -borderwidth => 2); +$l->pack(-fill => 'x', -ipady => 5); + +my $l=$ff->Button(-text => "Certify"); +$l->pack(-fill => 'x', -ipady => 5); + +my $l=$ff->Button(-text => "Review"); +$l->pack(-fill => 'x', -ipady => 5); + +my $l=$ff->Button(-text => "Revoke"); +$l->pack(-fill => 'x', -ipady => 5); + +my $l=$ff->Button(-text => "Generate CRL"); +$l->pack(-fill => 'x', -ipady => 5); + +my($db)=&load_db("demoCA/index.txt"); + +MainLoop; + +sub load_db + { + my(%ret); + my($file)=@_; + my(*IN); + my(%db_serial,%db_name,@f,@db_s); + + $ret{'serial'}=\%db_serial; + $ret{'name'}=\%db_name; + + open(IN,"<$file") || die "unable to open $file:$!\n"; + while (<IN>) + { + chop; + s/([^\\])\t/\1\t\t/g; + my(@f)=split(/\t\t/); + die "wrong number of fields in $file, line $.\n" + if ($#f != 5); + + my(%f); + $f{'type'}=$f[0]; + $f{'exp'}=$f[1]; + $f{'rev'}=$f[2]; + $f{'serial'}=$f[3]; + $f{'file'}=$f[4]; + $f{'name'}=$f[5]; + die "serial number $f{'serial'} appears twice (line $.)\n" + if (defined($db{$f{'serial'}})) + $db_serial{$f{'serial'}}=\%f; + $db_name{$f{'name'}}.=$f{'serial'}." "; + } + return \%ret; + } diff --git a/src/lib/libssl/src/certs/rsa-ssca.pem b/src/lib/libssl/src/certs/rsa-ssca.pem new file mode 100644 index 0000000000..c9403212d1 --- /dev/null +++ b/src/lib/libssl/src/certs/rsa-ssca.pem @@ -0,0 +1,19 @@ +subject=/C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority +issuer= /C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority +notBefore=941109235417Z +notAfter =991231235417Z +-----BEGIN X509 CERTIFICATE----- + +MIICKTCCAZYCBQJBAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMSAw +HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJl +IFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NDExMDkyMzU0MTda +Fw05OTEyMzEyMzU0MTdaMF8xCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0 +YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJlIFNlcnZlciBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eTCBmzANBgkqhkiG9w0BAQEFAAOBiQAwgYUCfgCSznrB +roM+WqqJg1esJQF2DK2ujiw3zus1eGRUA+WEQFHJv48I4oqCCNIWhjdV6bEhAq12 +aIGaBaJLyUslZiJWbIgHj/eBWW2EB2VwE3F2Ppt3TONQiVaYSLkdpykaEy5KEVmc +HhXVSVQsczppgrGXOZxtcGdI5d0t1sgeewIDAQABMA0GCSqGSIb3DQEBAgUAA34A +iNHReSHO4ovo+MF9NFM/YYPZtgs4F7boviGNjwC4i1N+RGceIr2XJ+CchcxK9oU7 +suK+ktPlDemvXA4MRpX/oRxePug2WHpzpgr4IhFrwwk4fia7c+8AvQKk8xQNMD9h +cHsg/jKjn7P0Z1LctO6EjJY2IN6BCINxIYoPnqk= +-----END X509 CERTIFICATE----- diff --git a/src/lib/libssl/src/certs/vsign4.pem b/src/lib/libssl/src/certs/vsign4.pem new file mode 100644 index 0000000000..b5bcef4d0d --- /dev/null +++ b/src/lib/libssl/src/certs/vsign4.pem @@ -0,0 +1,16 @@ + subject=/C=US/O=VeriSign, Inc./OU=Class 4 Public Primary Certification Authority + issuer= /C=US/O=VeriSign, Inc./OU=Class 4 Public Primary Certification Authority +-----BEGIN CERTIFICATE----- +MIICMTCCAZoCBQKmAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMRcw +FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgNCBQdWJsaWMg +UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NjAxMjkwMDAwMDBa +Fw05OTEyMzEyMzU5NTlaMF8xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2ln +biwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgNCBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0LJ1 +9njQrlpQ9OlQqZ+M1++RlHDo0iSQdomF1t+s5gEXMoDwnZNHvJplnR+Xrr/phnVj +IIm9gFidBAydqMEk6QvlMXi9/C0MN2qeeIDpRnX57aP7E3vIwUzSo+/1PLBij0pd +O92VZ48TucE81qcmm+zDO3rZTbxtm+gVAePwR6kCAwEAATANBgkqhkiG9w0BAQIF +AAOBgQBT3dPwnCR+QKri/AAa19oM/DJhuBUNlvP6Vxt/M3yv6ZiaYch6s7f/sdyZ +g9ysEvxwyR84Qu1E9oAuW2szaayc01znX1oYx7EteQSWQZGZQbE8DbqEOcY7l/Am +yY7uvcxClf8exwI/VAx49byqYHwCaejcrOICdmHEPgPq0ook0Q== +-----END CERTIFICATE----- diff --git a/src/lib/libssl/src/crypto/asn1/a_bmp.c b/src/lib/libssl/src/crypto/asn1/a_bmp.c new file mode 100644 index 0000000000..774502b1fc --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/a_bmp.c @@ -0,0 +1,90 @@ +/* crypto/asn1/a_bmp.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1.h" + +/* ASN1err(ASN1_F_D2I_ASN1_INTEGER,ASN1_R_EXPECTING_AN_INTEGER); + */ + +int i2d_ASN1_BMPSTRING(a, pp) +ASN1_BMPSTRING *a; +unsigned char **pp; + { + return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, + V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL)); + } + +ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(a, pp, length) +ASN1_BMPSTRING **a; +unsigned char **pp; +long length; + { + ASN1_BMPSTRING *ret=NULL; + + ret=(ASN1_BMPSTRING *)d2i_ASN1_bytes((ASN1_STRING **)a, + pp,length,V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL); + if (ret == NULL) + { + ASN1err(ASN1_F_D2I_ASN1_BMPSTRING,ASN1_R_ERROR_STACK); + return(NULL); + } + return(ret); + } + diff --git a/src/lib/libssl/src/crypto/asn1/asn1.err b/src/lib/libssl/src/crypto/asn1/asn1.err new file mode 100644 index 0000000000..c8b7011488 --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/asn1.err @@ -0,0 +1,182 @@ +/* Error codes for the ASN1 functions. */ + +/* Function codes. */ +#define ASN1_F_A2D_ASN1_OBJECT 100 +#define ASN1_F_A2I_ASN1_INTEGER 101 +#define ASN1_F_A2I_ASN1_STRING 102 +#define ASN1_F_ASN1_COLLATE_PRIMATIVE 103 +#define ASN1_F_ASN1_D2I_BIO 104 +#define ASN1_F_ASN1_D2I_FP 105 +#define ASN1_F_ASN1_DUP 106 +#define ASN1_F_ASN1_GET_OBJECT 107 +#define ASN1_F_ASN1_HEADER_NEW 108 +#define ASN1_F_ASN1_I2D_BIO 109 +#define ASN1_F_ASN1_I2D_FP 110 +#define ASN1_F_ASN1_INTEGER_SET 111 +#define ASN1_F_ASN1_INTEGER_TO_BN 112 +#define ASN1_F_ASN1_OBJECT_NEW 113 +#define ASN1_F_ASN1_SIGN 114 +#define ASN1_F_ASN1_STRING_NEW 115 +#define ASN1_F_ASN1_STRING_TYPE_NEW 116 +#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 117 +#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 118 +#define ASN1_F_ASN1_TYPE_NEW 119 +#define ASN1_F_ASN1_UTCTIME_NEW 120 +#define ASN1_F_ASN1_VERIFY 121 +#define ASN1_F_BN_TO_ASN1_INTEGER 122 +#define ASN1_F_D2I_ASN1_BIT_STRING 123 +#define ASN1_F_D2I_ASN1_BMPSTRING 124 +#define ASN1_F_D2I_ASN1_BOOLEAN 125 +#define ASN1_F_D2I_ASN1_BYTES 126 +#define ASN1_F_D2I_ASN1_HEADER 127 +#define ASN1_F_D2I_ASN1_INTEGER 128 +#define ASN1_F_D2I_ASN1_OBJECT 129 +#define ASN1_F_D2I_ASN1_OCTET_STRING 130 +#define ASN1_F_D2I_ASN1_PRINT_TYPE 131 +#define ASN1_F_D2I_ASN1_SET 132 +#define ASN1_F_D2I_ASN1_TYPE 133 +#define ASN1_F_D2I_ASN1_TYPE_BYTES 134 +#define ASN1_F_D2I_ASN1_UTCTIME 135 +#define ASN1_F_D2I_DHPARAMS 136 +#define ASN1_F_D2I_DSAPARAMS 137 +#define ASN1_F_D2I_DSAPRIVATEKEY 138 +#define ASN1_F_D2I_DSAPUBLICKEY 139 +#define ASN1_F_D2I_NETSCAPE_PKEY 140 +#define ASN1_F_D2I_NETSCAPE_RSA 141 +#define ASN1_F_D2I_NETSCAPE_RSA_2 142 +#define ASN1_F_D2I_NETSCAPE_SPKAC 143 +#define ASN1_F_D2I_NETSCAPE_SPKI 144 +#define ASN1_F_D2I_PKCS7 145 +#define ASN1_F_D2I_PKCS7_DIGEST 146 +#define ASN1_F_D2I_PKCS7_ENCRYPT 147 +#define ASN1_F_D2I_PKCS7_ENC_CONTENT 148 +#define ASN1_F_D2I_PKCS7_ENVELOPE 149 +#define ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL 150 +#define ASN1_F_D2I_PKCS7_RECIP_INFO 151 +#define ASN1_F_D2I_PKCS7_SIGNED 152 +#define ASN1_F_D2I_PKCS7_SIGNER_INFO 153 +#define ASN1_F_D2I_PKCS7_SIGN_ENVELOPE 154 +#define ASN1_F_D2I_PRIVATEKEY 155 +#define ASN1_F_D2I_PUBLICKEY 156 +#define ASN1_F_D2I_RSAPRIVATEKEY 157 +#define ASN1_F_D2I_RSAPUBLICKEY 158 +#define ASN1_F_D2I_X509 159 +#define ASN1_F_D2I_X509_ALGOR 160 +#define ASN1_F_D2I_X509_ATTRIBUTE 161 +#define ASN1_F_D2I_X509_CINF 162 +#define ASN1_F_D2I_X509_CRL 163 +#define ASN1_F_D2I_X509_CRL_INFO 164 +#define ASN1_F_D2I_X509_EXTENSION 165 +#define ASN1_F_D2I_X509_KEY 166 +#define ASN1_F_D2I_X509_NAME 167 +#define ASN1_F_D2I_X509_NAME_ENTRY 168 +#define ASN1_F_D2I_X509_PKEY 169 +#define ASN1_F_D2I_X509_PUBKEY 170 +#define ASN1_F_D2I_X509_REQ 171 +#define ASN1_F_D2I_X509_REQ_INFO 172 +#define ASN1_F_D2I_X509_REVOKED 173 +#define ASN1_F_D2I_X509_SIG 174 +#define ASN1_F_D2I_X509_VAL 175 +#define ASN1_F_I2D_ASN1_HEADER 176 +#define ASN1_F_I2D_DHPARAMS 177 +#define ASN1_F_I2D_DSAPARAMS 178 +#define ASN1_F_I2D_DSAPRIVATEKEY 179 +#define ASN1_F_I2D_DSAPUBLICKEY 180 +#define ASN1_F_I2D_NETSCAPE_RSA 181 +#define ASN1_F_I2D_PKCS7 182 +#define ASN1_F_I2D_PRIVATEKEY 183 +#define ASN1_F_I2D_PUBLICKEY 184 +#define ASN1_F_I2D_RSAPRIVATEKEY 185 +#define ASN1_F_I2D_RSAPUBLICKEY 186 +#define ASN1_F_I2D_X509_ATTRIBUTE 187 +#define ASN1_F_I2T_ASN1_OBJECT 188 +#define ASN1_F_NETSCAPE_PKEY_NEW 189 +#define ASN1_F_NETSCAPE_SPKAC_NEW 190 +#define ASN1_F_NETSCAPE_SPKI_NEW 191 +#define ASN1_F_PKCS7_DIGEST_NEW 192 +#define ASN1_F_PKCS7_ENCRYPT_NEW 193 +#define ASN1_F_PKCS7_ENC_CONTENT_NEW 194 +#define ASN1_F_PKCS7_ENVELOPE_NEW 195 +#define ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW 196 +#define ASN1_F_PKCS7_NEW 197 +#define ASN1_F_PKCS7_RECIP_INFO_NEW 198 +#define ASN1_F_PKCS7_SIGNED_NEW 199 +#define ASN1_F_PKCS7_SIGNER_INFO_NEW 200 +#define ASN1_F_PKCS7_SIGN_ENVELOPE_NEW 201 +#define ASN1_F_X509_ALGOR_NEW 202 +#define ASN1_F_X509_ATTRIBUTE_NEW 203 +#define ASN1_F_X509_CINF_NEW 204 +#define ASN1_F_X509_CRL_INFO_NEW 205 +#define ASN1_F_X509_CRL_NEW 206 +#define ASN1_F_X509_DHPARAMS_NEW 207 +#define ASN1_F_X509_EXTENSION_NEW 208 +#define ASN1_F_X509_INFO_NEW 209 +#define ASN1_F_X509_KEY_NEW 210 +#define ASN1_F_X509_NAME_ENTRY_NEW 211 +#define ASN1_F_X509_NAME_NEW 212 +#define ASN1_F_X509_NEW 213 +#define ASN1_F_X509_PKEY_NEW 214 +#define ASN1_F_X509_PUBKEY_NEW 215 +#define ASN1_F_X509_REQ_INFO_NEW 216 +#define ASN1_F_X509_REQ_NEW 217 +#define ASN1_F_X509_REVOKED_NEW 218 +#define ASN1_F_X509_SIG_NEW 219 +#define ASN1_F_X509_VAL_FREE 220 +#define ASN1_F_X509_VAL_NEW 221 + +/* Reason codes. */ +#define ASN1_R_BAD_CLASS 100 +#define ASN1_R_BAD_GET_OBJECT 101 +#define ASN1_R_BAD_OBJECT_HEADER 102 +#define ASN1_R_BAD_PASSWORD_READ 103 +#define ASN1_R_BAD_PKCS7_CONTENT 104 +#define ASN1_R_BAD_PKCS7_TYPE 105 +#define ASN1_R_BAD_TAG 106 +#define ASN1_R_BAD_TYPE 107 +#define ASN1_R_BN_LIB 108 +#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 109 +#define ASN1_R_BUFFER_TOO_SMALL 110 +#define ASN1_R_DATA_IS_WRONG 111 +#define ASN1_R_DECODING_ERROR 112 +#define ASN1_R_ERROR_STACK 113 +#define ASN1_R_EXPECTING_AN_INTEGER 114 +#define ASN1_R_EXPECTING_AN_OBJECT 115 +#define ASN1_R_EXPECTING_AN_OCTET_STRING 116 +#define ASN1_R_EXPECTING_A_BIT_STRING 117 +#define ASN1_R_EXPECTING_A_BOOLEAN 118 +#define ASN1_R_EXPECTING_A_SEQUENCE 119 +#define ASN1_R_EXPECTING_A_UTCTIME 120 +#define ASN1_R_FIRST_NUM_TOO_LARGE 121 +#define ASN1_R_HEADER_TOO_LONG 122 +#define ASN1_R_INVALID_DIGIT 123 +#define ASN1_R_INVALID_SEPARATOR 124 +#define ASN1_R_INVALID_TIME_FORMAT 125 +#define ASN1_R_IV_TOO_LARGE 126 +#define ASN1_R_LENGTH_ERROR 127 +#define ASN1_R_LENGTH_MISMATCH 128 +#define ASN1_R_MISSING_EOS 129 +#define ASN1_R_MISSING_SECOND_NUMBER 130 +#define ASN1_R_NON_HEX_CHARACTERS 131 +#define ASN1_R_NOT_ENOUGH_DATA 132 +#define ASN1_R_ODD_NUMBER_OF_CHARS 133 +#define ASN1_R_PARSING 134 +#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 135 +#define ASN1_R_SECOND_NUMBER_TOO_LARGE 136 +#define ASN1_R_SHORT_LINE 137 +#define ASN1_R_STRING_TOO_SHORT 138 +#define ASN1_R_TAG_VALUE_TOO_HIGH 139 +#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 140 +#define ASN1_R_TOO_LONG 141 +#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 142 +#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 143 +#define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 144 +#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 145 +#define ASN1_R_UNKNOWN_OBJECT_TYPE 146 +#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 147 +#define ASN1_R_UNSUPPORTED_CIPHER 148 +#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 149 +#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 150 +#define ASN1_R_UTCTIME_TOO_LONG 151 +#define ASN1_R_WRONG_PRINTABLE_TYPE 152 +#define ASN1_R_WRONG_TAG 153 +#define ASN1_R_WRONG_TYPE 154 diff --git a/src/lib/libssl/src/crypto/asn1/d2i_dhp.c b/src/lib/libssl/src/crypto/asn1/d2i_dhp.c new file mode 100644 index 0000000000..616a308100 --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/d2i_dhp.c @@ -0,0 +1,108 @@ +/* crypto/asn1/d2i_dhp.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "dh.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_D2I_DHPARAMS,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_I2D_DHPARAMS,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + */ + +DH *d2i_DHparams(a,pp,length) +DH **a; +unsigned char **pp; +long length; + { + int i=ASN1_R_ERROR_STACK; + ASN1_INTEGER *bs=NULL; + long v=0; + M_ASN1_D2I_vars(a,DH *,DH_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) goto err_bn; + + if (!M_ASN1_D2I_end_sequence()) + { + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + for (i=0; i<bs->length; i++) + v=(v<<8)|(bs->data[i]); + ret->length=(int)v; + } + + ASN1_BIT_STRING_free(bs); + + M_ASN1_D2I_Finish_2(a); + +err_bn: + i=ERR_R_BN_LIB; +err: + ASN1err(ASN1_F_D2I_DHPARAMS,i); + if ((ret != NULL) && ((a == NULL) || (*a != ret))) DH_free(ret); + if (bs != NULL) ASN1_BIT_STRING_free(bs); + return(NULL); + } + diff --git a/src/lib/libssl/src/crypto/asn1/d2i_dsap.c b/src/lib/libssl/src/crypto/asn1/d2i_dsap.c new file mode 100644 index 0000000000..2c8ac7bbcf --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/d2i_dsap.c @@ -0,0 +1,101 @@ +/* crypto/asn1/d2i_dsap.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "dsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_D2I_DSAPARAMS,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_I2D_DSAPARAMS,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + */ + +DSA *d2i_DSAparams(a,pp,length) +DSA **a; +unsigned char **pp; +long length; + { + int i=ASN1_R_ERROR_STACK; + ASN1_INTEGER *bs=NULL; + M_ASN1_D2I_vars(a,DSA *,DSA_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) goto err_bn; + + ASN1_BIT_STRING_free(bs); + + M_ASN1_D2I_Finish_2(a); + +err_bn: + i=ERR_R_BN_LIB; +err: + ASN1err(ASN1_F_D2I_DSAPARAMS,i); + if ((ret != NULL) && ((a == NULL) || (*a != ret))) DSA_free(ret); + if (bs != NULL) ASN1_BIT_STRING_free(bs); + return(NULL); + } + diff --git a/src/lib/libssl/src/crypto/asn1/d2i_r_pr.c b/src/lib/libssl/src/crypto/asn1/d2i_r_pr.c new file mode 100644 index 0000000000..0c53aa94bf --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/d2i_r_pr.c @@ -0,0 +1,129 @@ +/* crypto/asn1/d2i_r_pr.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "rsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_PARSING); + */ + +static ASN1_METHOD method={ + (int (*)()) i2d_RSAPrivateKey, + (char *(*)())d2i_RSAPrivateKey, + (char *(*)())RSA_new, + (void (*)()) RSA_free}; + +ASN1_METHOD *RSAPrivateKey_asn1_meth() + { + return(&method); + } + +RSA *d2i_RSAPrivateKey(a,pp,length) +RSA **a; +unsigned char **pp; +long length; + { + int i=ASN1_R_PARSING; + ASN1_INTEGER *bs=NULL; + M_ASN1_D2I_vars(a,RSA *,RSA_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if (bs->length == 0) + ret->version=0; + else ret->version=bs->data[0]; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->n=BN_bin2bn(bs->data,bs->length,ret->n)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->e=BN_bin2bn(bs->data,bs->length,ret->e)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->d=BN_bin2bn(bs->data,bs->length,ret->d)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->dmp1=BN_bin2bn(bs->data,bs->length,ret->dmp1)) == NULL) + goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->dmq1=BN_bin2bn(bs->data,bs->length,ret->dmq1)) == NULL) + goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->iqmp=BN_bin2bn(bs->data,bs->length,ret->iqmp)) == NULL) + goto err_bn; + + ASN1_INTEGER_free(bs); + + M_ASN1_D2I_Finish_2(a); +err_bn: + i=ERR_R_BN_LIB; +err: + ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,i); + if ((ret != NULL) && ((a == NULL) || (*a != ret))) RSA_free(ret); + if (bs != NULL) ASN1_INTEGER_free(bs); + return(NULL); + } + diff --git a/src/lib/libssl/src/crypto/asn1/d2i_r_pu.c b/src/lib/libssl/src/crypto/asn1/d2i_r_pu.c new file mode 100644 index 0000000000..778b792b1e --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/d2i_r_pu.c @@ -0,0 +1,100 @@ +/* crypto/asn1/d2i_r_pu.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "rsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_D2I_RSAPUBLICKEY,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_I2D_RSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + */ + +RSA *d2i_RSAPublicKey(a,pp,length) +RSA **a; +unsigned char **pp; +long length; + { + int i=ASN1_R_PARSING; + ASN1_INTEGER *bs=NULL; + M_ASN1_D2I_vars(a,RSA *,RSA_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->n=BN_bin2bn(bs->data,bs->length,ret->n)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->e=BN_bin2bn(bs->data,bs->length,ret->e)) == NULL) goto err_bn; + + ASN1_INTEGER_free(bs); + bs=NULL; + + M_ASN1_D2I_Finish_2(a); + +err_bn: + i=ERR_R_BN_LIB; +err: + ASN1err(ASN1_F_D2I_RSAPUBLICKEY,i); + if ((ret != NULL) && ((a == NULL) || (*a != ret))) RSA_free(ret); + if (bs != NULL) ASN1_INTEGER_free(bs); + return(NULL); + } + diff --git a/src/lib/libssl/src/crypto/asn1/d2i_s_pr.c b/src/lib/libssl/src/crypto/asn1/d2i_s_pr.c new file mode 100644 index 0000000000..32ff8ba4b3 --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/d2i_s_pr.c @@ -0,0 +1,113 @@ +/* crypto/asn1/d2i_s_pr.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* Origional version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "dsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_D2I_DSAPRIVATEKEY,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + * ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ASN1_R_PARSING); + */ + +DSA *d2i_DSAPrivateKey(a,pp,length) +DSA **a; +unsigned char **pp; +long length; + { + int i=ASN1_R_PARSING; + ASN1_INTEGER *bs=NULL; + M_ASN1_D2I_vars(a,DSA *,DSA_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if (bs->length == 0) + ret->version=0; + else ret->version=bs->data[0]; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->pub_key=BN_bin2bn(bs->data,bs->length,ret->pub_key)) + == NULL) goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->priv_key=BN_bin2bn(bs->data,bs->length,ret->priv_key)) + == NULL) goto err_bn; + + ASN1_INTEGER_free(bs); + + M_ASN1_D2I_Finish_2(a); +err_bn: + i=ERR_R_BN_LIB; +err: + ASN1err(ASN1_F_D2I_DSAPRIVATEKEY,i); + if ((ret != NULL) && ((a == NULL) || (*a != ret))) DSA_free(ret); + if (bs != NULL) ASN1_INTEGER_free(bs); + return(NULL); + } + diff --git a/src/lib/libssl/src/crypto/asn1/d2i_s_pu.c b/src/lib/libssl/src/crypto/asn1/d2i_s_pu.c new file mode 100644 index 0000000000..1002f41cd8 --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/d2i_s_pu.c @@ -0,0 +1,124 @@ +/* crypto/asn1/d2i_s_pu.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* Origional version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "dsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_D2I_DSAPUBLICKEY,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_I2D_DSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + */ + +DSA *d2i_DSAPublicKey(a,pp,length) +DSA **a; +unsigned char **pp; +long length; + { + int i=ASN1_R_PARSING; + ASN1_INTEGER *bs=NULL; + M_ASN1_D2I_vars(a,DSA *,DSA_new); + + M_ASN1_D2I_Init(); + if ((length != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) + == (V_ASN1_UNIVERSAL|(V_ASN1_INTEGER)))) + { + c.slen=length; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->pub_key=BN_bin2bn(bs->data,bs->length,ret->pub_key)) + == NULL) + goto err_bn; + ret->write_params=0; + } + else + { + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->pub_key=BN_bin2bn(bs->data,bs->length,ret->pub_key)) + == NULL) + goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) + goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) + goto err_bn; + M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); + if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) + goto err_bn; + + ret->write_params=1; + } + + ASN1_INTEGER_free(bs); + bs=NULL; + M_ASN1_D2I_Finish_2(a); +err_bn: + i=ERR_R_BN_LIB; +err: + ASN1err(ASN1_F_D2I_DSAPUBLICKEY,i); + if ((ret != NULL) && ((a == NULL) || (*a != ret))) DSA_free(ret); + if (bs != NULL) ASN1_INTEGER_free(bs); + return(NULL); + } + diff --git a/src/lib/libssl/src/crypto/asn1/i2d_dhp.c b/src/lib/libssl/src/crypto/asn1/i2d_dhp.c new file mode 100644 index 0000000000..a454025ce3 --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/i2d_dhp.c @@ -0,0 +1,128 @@ +/* crypto/asn1/i2d_dhp.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "asn1_mac.h" +#include "dh.h" + +/* + * ASN1err(ASN1_F_D2I_DHPARAMS,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_X509_DHPARAMS_NEW,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_DHparams(a,pp) +DH *a; +unsigned char **pp; + { + BIGNUM *num[3]; + ASN1_INTEGER bs; + unsigned int j,i,tot=0,len,max=0; + int t,ret= -1; + unsigned char *p; + + if (a == NULL) return(0); + num[0]=a->p; + num[1]=a->g; + if (a->length != 0) + { + if ((num[2]=BN_new()) == NULL) goto err; + if (!BN_set_word(num[2],a->length)) goto err; + } + else + num[2]=NULL; + + for (i=0; i<3; i++) + { + if (num[i] == NULL) continue; + j=BN_num_bits(num[i]); + len=((j == 0)?0:((j/8)+1)); + if (len > max) max=len; + len=ASN1_object_size(0,len, + (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); + tot+=len; + } + + t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); + if (pp == NULL) return(t); + + p= *pp; + ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + + bs.type=V_ASN1_INTEGER; + bs.data=(unsigned char *)Malloc(max+4); + if (bs.data == NULL) + { + ASN1err(ASN1_F_I2D_DHPARAMS,ERR_R_MALLOC_FAILURE); + goto err; + } + + for (i=0; i<3; i++) + { + if (num[i] == NULL) continue; + bs.length=BN_bn2bin(num[i],bs.data); + i2d_ASN1_INTEGER(&bs,&p); + } + Free((char *)bs.data); + ret=t; +err: + if (num[2] != NULL) BN_free(num[2]); + *pp=p; + return(ret); + } diff --git a/src/lib/libssl/src/crypto/asn1/i2d_dsap.c b/src/lib/libssl/src/crypto/asn1/i2d_dsap.c new file mode 100644 index 0000000000..94ecff1525 --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/i2d_dsap.c @@ -0,0 +1,121 @@ +/* crypto/asn1/i2d_dsap.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "asn1_mac.h" +#include "dsa.h" + +/* + * ASN1err(ASN1_F_D2I_DSAPARAMS,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_DSAparams(a,pp) +DSA *a; +unsigned char **pp; + { + BIGNUM *num[3]; + ASN1_INTEGER bs; + unsigned int j,i,tot=0,len,max=0; + int t,ret= -1; + unsigned char *p; + + if (a == NULL) return(0); + num[0]=a->p; + num[1]=a->q; + num[2]=a->g; + + for (i=0; i<3; i++) + { + if (num[i] == NULL) continue; + j=BN_num_bits(num[i]); + len=((j == 0)?0:((j/8)+1)); + if (len > max) max=len; + len=ASN1_object_size(0,len, + (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); + tot+=len; + } + + t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); + if (pp == NULL) return(t); + + p= *pp; + ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + + bs.type=V_ASN1_INTEGER; + bs.data=(unsigned char *)Malloc(max+4); + if (bs.data == NULL) + { + ASN1err(ASN1_F_I2D_DSAPARAMS,ERR_R_MALLOC_FAILURE); + goto err; + } + + for (i=0; i<3; i++) + { + if (num[i] == NULL) continue; + bs.length=BN_bn2bin(num[i],bs.data); + i2d_ASN1_INTEGER(&bs,&p); + } + Free((char *)bs.data); + ret=t; +err: + *pp=p; + return(ret); + } + diff --git a/src/lib/libssl/src/crypto/asn1/i2d_r_pr.c b/src/lib/libssl/src/crypto/asn1/i2d_r_pr.c new file mode 100644 index 0000000000..aadbb92d8e --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/i2d_r_pr.c @@ -0,0 +1,132 @@ +/* crypto/asn1/i2d_r_pr.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "rsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + */ + +int i2d_RSAPrivateKey(a,pp) +RSA *a; +unsigned char **pp; + { + BIGNUM *num[9]; + unsigned char data[1]; + ASN1_INTEGER bs; + unsigned int j,i,tot,t,len,max=0; + unsigned char *p; + + if (a == NULL) return(0); + + num[1]=a->n; + num[2]=a->e; + num[3]=a->d; + num[4]=a->p; + num[5]=a->q; + num[6]=a->dmp1; + num[7]=a->dmq1; + num[8]=a->iqmp; + + bs.length=1; + bs.data=data; + bs.type=V_ASN1_INTEGER; + data[0]=a->version&0x7f; + + tot=i2d_ASN1_INTEGER(&(bs),NULL); + for (i=1; i<9; i++) + { + j=BN_num_bits(num[i]); + len=((j == 0)?0:((j/8)+1)); + if (len > max) max=len; + len=ASN1_object_size(0,len, + (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); + tot+=len; + } + + t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); + if (pp == NULL) return(t); + + p= *pp; + ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + + i2d_ASN1_INTEGER(&bs,&p); + + bs.data=(unsigned char *)Malloc(max+4); + if (bs.data == NULL) + { + ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ERR_R_MALLOC_FAILURE); + return(-1); + } + + for (i=1; i<9; i++) + { + bs.length=BN_bn2bin(num[i],bs.data); + i2d_ASN1_INTEGER(&bs,&p); + } + Free((char *)bs.data); + *pp=p; + return(t); + } + diff --git a/src/lib/libssl/src/crypto/asn1/i2d_r_pu.c b/src/lib/libssl/src/crypto/asn1/i2d_r_pu.c new file mode 100644 index 0000000000..3c54f6709d --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/i2d_r_pu.c @@ -0,0 +1,118 @@ +/* crypto/asn1/i2d_r_pu.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "rsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_D2I_RSAPUBLICKEY,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_I2D_RSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + */ + +int i2d_RSAPublicKey(a,pp) +RSA *a; +unsigned char **pp; + { + BIGNUM *num[2]; + ASN1_INTEGER bs; + unsigned int j,i,tot=0,len,max=0,t; + unsigned char *p; + + if (a == NULL) return(0); + + num[0]=a->n; + num[1]=a->e; + + for (i=0; i<2; i++) + { + j=BN_num_bits(num[i]); + len=((j == 0)?0:((j/8)+1)); + if (len > max) max=len; + len=ASN1_object_size(0,len, + (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); + tot+=len; + } + + t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); + if (pp == NULL) return(t); + + p= *pp; + ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + + bs.type=V_ASN1_INTEGER; + bs.data=(unsigned char *)Malloc(max+4); + if (bs.data == NULL) + { + ASN1err(ASN1_F_I2D_RSAPUBLICKEY,ERR_R_MALLOC_FAILURE); + return(-1); + } + + for (i=0; i<2; i++) + { + bs.length=BN_bn2bin(num[i],bs.data); + i2d_ASN1_INTEGER(&bs,&p); + } + Free((char *)bs.data); + *pp=p; + return(t); + } + diff --git a/src/lib/libssl/src/crypto/asn1/i2d_s_pr.c b/src/lib/libssl/src/crypto/asn1/i2d_s_pr.c new file mode 100644 index 0000000000..6e95305548 --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/i2d_s_pr.c @@ -0,0 +1,128 @@ +/* crypto/asn1/i2d_s_pr.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "dsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + */ + +int i2d_DSAPrivateKey(a,pp) +DSA *a; +unsigned char **pp; + { + BIGNUM *num[6]; + unsigned char data[1]; + ASN1_INTEGER bs; + unsigned int j,i,tot,t,len,max=0; + unsigned char *p; + + if (a == NULL) return(0); + + num[1]=a->p; + num[2]=a->q; + num[3]=a->g; + num[4]=a->pub_key; + num[5]=a->priv_key; + + bs.length=1; + bs.data=data; + bs.type=V_ASN1_INTEGER; + data[0]=a->version&0x7f; + + tot=i2d_ASN1_INTEGER(&(bs),NULL); + for (i=1; i<6; i++) + { + j=BN_num_bits(num[i]); + len=((j == 0)?0:((j/8)+1)); + if (len > max) max=len; + len=ASN1_object_size(0,len, + (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); + tot+=len; + } + + t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); + if (pp == NULL) return(t); + + p= *pp; + ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + + i2d_ASN1_INTEGER(&bs,&p); + + bs.data=(unsigned char *)Malloc(max+4); + if (bs.data == NULL) + { + ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ERR_R_MALLOC_FAILURE); + return(-1); + } + + for (i=1; i<6; i++) + { + bs.length=BN_bn2bin(num[i],bs.data); + i2d_ASN1_INTEGER(&bs,&p); + } + Free((char *)bs.data); + *pp=p; + return(t); + } + diff --git a/src/lib/libssl/src/crypto/asn1/i2d_s_pu.c b/src/lib/libssl/src/crypto/asn1/i2d_s_pu.c new file mode 100644 index 0000000000..5cf2877069 --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/i2d_s_pu.c @@ -0,0 +1,133 @@ +/* crypto/asn1/i2d_s_pu.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn.h" +#include "dsa.h" +#include "objects.h" +#include "asn1_mac.h" + +/* + * ASN1err(ASN1_F_I2D_DSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); + */ + +int i2d_DSAPublicKey(a,pp) +DSA *a; +unsigned char **pp; + { + BIGNUM *num[4]; + ASN1_INTEGER bs; + unsigned int j,i,tot=0,len,max=0,t=0,all,n=1; + unsigned char *p; + + if (a == NULL) return(0); + + all=a->write_params; + + num[0]=a->pub_key; + if (all) + { + num[1]=a->p; + num[2]=a->q; + num[3]=a->g; + n=4; + } + + for (i=0; i<n; i++) + { + j=BN_num_bits(num[i]); + len=((j == 0)?0:((j/8)+1)); + if (len > max) max=len; + len=ASN1_object_size(0,len, + (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); + tot+=len; + } + + if (all) + { + t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); + if (pp == NULL) return(t); + } + else + { + if (pp == NULL) return(tot); + } + + p= *pp; + if (all) + ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + + bs.type=V_ASN1_INTEGER; + bs.data=(unsigned char *)Malloc(max+4); + if (bs.data == NULL) + { + ASN1err(ASN1_F_I2D_DSAPUBLICKEY,ERR_R_MALLOC_FAILURE); + return(-1); + } + + for (i=0; i<n; i++) + { + bs.length=BN_bn2bin(num[i],bs.data); + i2d_ASN1_INTEGER(&bs,&p); + } + Free((char *)bs.data); + *pp=p; + return(t); + } + diff --git a/src/lib/libssl/src/crypto/asn1/p7_dgst.c b/src/lib/libssl/src/crypto/asn1/p7_dgst.c new file mode 100644 index 0000000000..f71ed8eb1d --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/p7_dgst.c @@ -0,0 +1,130 @@ +/* crypto/asn1/p7_dgst.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_DIGEST_NEW,ASN1_R_MISSING_EOS); + * ASN1err(ASN1_F_D2I_PKCS7_DIGEST,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_DIGEST(a,pp) +PKCS7_DIGEST *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_len(a->md,i2d_X509_ALGOR); + M_ASN1_I2D_len(a->contents,i2d_PKCS7); + M_ASN1_I2D_len(a->digest,i2d_ASN1_OCTET_STRING); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_put(a->md,i2d_X509_ALGOR); + M_ASN1_I2D_put(a->contents,i2d_PKCS7); + M_ASN1_I2D_put(a->digest,i2d_ASN1_OCTET_STRING); + + M_ASN1_I2D_finish(); + } + +PKCS7_DIGEST *d2i_PKCS7_DIGEST(a,pp,length) +PKCS7_DIGEST **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_DIGEST *,PKCS7_DIGEST_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); + M_ASN1_D2I_get(ret->md,d2i_X509_ALGOR); + M_ASN1_D2I_get(ret->contents,d2i_PKCS7); + M_ASN1_D2I_get(ret->digest,d2i_ASN1_OCTET_STRING); + + M_ASN1_D2I_Finish(a,PKCS7_DIGEST_free,ASN1_F_D2I_PKCS7_DIGEST); + } + +PKCS7_DIGEST *PKCS7_DIGEST_new() + { + PKCS7_DIGEST *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_DIGEST); + M_ASN1_New(ret->version,ASN1_INTEGER_new); + M_ASN1_New(ret->md,X509_ALGOR_new); + M_ASN1_New(ret->contents,PKCS7_new); + M_ASN1_New(ret->digest,ASN1_OCTET_STRING_new); + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_DIGEST_NEW); + } + +void PKCS7_DIGEST_free(a) +PKCS7_DIGEST *a; + { + if (a == NULL) return; + ASN1_INTEGER_free(a->version); + X509_ALGOR_free(a->md); + PKCS7_free(a->contents); + ASN1_OCTET_STRING_free(a->digest); + Free((char *)a); + } + diff --git a/src/lib/libssl/src/crypto/asn1/p7_enc.c b/src/lib/libssl/src/crypto/asn1/p7_enc.c new file mode 100644 index 0000000000..874dd78389 --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/p7_enc.c @@ -0,0 +1,120 @@ +/* crypto/asn1/p7_enc.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_ENCRYPT_NEW,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_D2I_PKCS7_ENCRYPT,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_ENCRYPT(a,pp) +PKCS7_ENCRYPT *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); + + M_ASN1_I2D_finish(); + } + +PKCS7_ENCRYPT *d2i_PKCS7_ENCRYPT(a,pp,length) +PKCS7_ENCRYPT **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_ENCRYPT *,PKCS7_ENCRYPT_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); + M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); + + M_ASN1_D2I_Finish(a,PKCS7_ENCRYPT_free,ASN1_F_D2I_PKCS7_ENCRYPT); + } + +PKCS7_ENCRYPT *PKCS7_ENCRYPT_new() + { + PKCS7_ENCRYPT *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_ENCRYPT); + M_ASN1_New(ret->version,ASN1_INTEGER_new); + M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_ENCRYPT_NEW); + } + +void PKCS7_ENCRYPT_free(a) +PKCS7_ENCRYPT *a; + { + if (a == NULL) return; + ASN1_INTEGER_free(a->version); + PKCS7_ENC_CONTENT_free(a->enc_data); + Free((char *)a); + } + diff --git a/src/lib/libssl/src/crypto/asn1/p7_enc_c.c b/src/lib/libssl/src/crypto/asn1/p7_enc_c.c new file mode 100644 index 0000000000..2860d3e925 --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/p7_enc_c.c @@ -0,0 +1,127 @@ +/* crypto/asn1/p7_enc_c.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_ENC_CONTENT_NEW,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_D2I_PKCS7_ENC_CONTENT,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_ENC_CONTENT(a,pp) +PKCS7_ENC_CONTENT *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->content_type,i2d_ASN1_OBJECT); + M_ASN1_I2D_len(a->algorithm,i2d_X509_ALGOR); + M_ASN1_I2D_len_IMP_opt(a->enc_data,i2d_ASN1_OCTET_STRING); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->content_type,i2d_ASN1_OBJECT); + M_ASN1_I2D_put(a->algorithm,i2d_X509_ALGOR); + M_ASN1_I2D_put_IMP_opt(a->enc_data,i2d_ASN1_OCTET_STRING,0); + + M_ASN1_I2D_finish(); + } + +PKCS7_ENC_CONTENT *d2i_PKCS7_ENC_CONTENT(a,pp,length) +PKCS7_ENC_CONTENT **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_ENC_CONTENT *,PKCS7_ENC_CONTENT_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->content_type,d2i_ASN1_OBJECT); + M_ASN1_D2I_get(ret->algorithm,d2i_X509_ALGOR); + M_ASN1_D2I_get_IMP_opt(ret->enc_data,d2i_ASN1_OCTET_STRING,0, + V_ASN1_OCTET_STRING); + + M_ASN1_D2I_Finish(a,PKCS7_ENC_CONTENT_free, + ASN1_F_D2I_PKCS7_ENC_CONTENT); + } + +PKCS7_ENC_CONTENT *PKCS7_ENC_CONTENT_new() + { + PKCS7_ENC_CONTENT *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_ENC_CONTENT); + M_ASN1_New(ret->content_type,ASN1_OBJECT_new); + M_ASN1_New(ret->algorithm,X509_ALGOR_new); + ret->enc_data=NULL; + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_ENC_CONTENT_NEW); + } + +void PKCS7_ENC_CONTENT_free(a) +PKCS7_ENC_CONTENT *a; + { + if (a == NULL) return; + ASN1_OBJECT_free(a->content_type); + X509_ALGOR_free(a->algorithm); + ASN1_OCTET_STRING_free(a->enc_data); + Free((char *)a); + } + diff --git a/src/lib/libssl/src/crypto/asn1/p7_evp.c b/src/lib/libssl/src/crypto/asn1/p7_evp.c new file mode 100644 index 0000000000..4db0a7fe62 --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/p7_evp.c @@ -0,0 +1,125 @@ +/* crypto/asn1/p7_evp.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_ENVELOPE_NEW,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_D2I_PKCS7_ENVELOPE,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_ENVELOPE(a,pp) +PKCS7_ENVELOPE *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_len_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); + M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_put_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); + M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); + + M_ASN1_I2D_finish(); + } + +PKCS7_ENVELOPE *d2i_PKCS7_ENVELOPE(a,pp,length) +PKCS7_ENVELOPE **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_ENVELOPE *,PKCS7_ENVELOPE_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); + M_ASN1_D2I_get_set(ret->recipientinfo,d2i_PKCS7_RECIP_INFO); + M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); + + M_ASN1_D2I_Finish(a,PKCS7_ENVELOPE_free,ASN1_F_D2I_PKCS7_ENVELOPE); + } + +PKCS7_ENVELOPE *PKCS7_ENVELOPE_new() + { + PKCS7_ENVELOPE *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_ENVELOPE); + M_ASN1_New(ret->version,ASN1_INTEGER_new); + M_ASN1_New(ret->recipientinfo,sk_new_null); + M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_ENVELOPE_NEW); + } + +void PKCS7_ENVELOPE_free(a) +PKCS7_ENVELOPE *a; + { + if (a == NULL) return; + ASN1_INTEGER_free(a->version); + sk_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free); + PKCS7_ENC_CONTENT_free(a->enc_data); + Free((char *)a); + } + diff --git a/src/lib/libssl/src/crypto/asn1/p7_i_s.c b/src/lib/libssl/src/crypto/asn1/p7_i_s.c new file mode 100644 index 0000000000..9b00c556d9 --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/p7_i_s.c @@ -0,0 +1,120 @@ +/* crypto/asn1/p7_i_s.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_ISSUER_AND_SERIAL(a,pp) +PKCS7_ISSUER_AND_SERIAL *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->issuer,i2d_X509_NAME); + M_ASN1_I2D_len(a->serial,i2d_ASN1_INTEGER); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->issuer,i2d_X509_NAME); + M_ASN1_I2D_put(a->serial,i2d_ASN1_INTEGER); + + M_ASN1_I2D_finish(); + } + +PKCS7_ISSUER_AND_SERIAL *d2i_PKCS7_ISSUER_AND_SERIAL(a,pp,length) +PKCS7_ISSUER_AND_SERIAL **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_ISSUER_AND_SERIAL *,PKCS7_ISSUER_AND_SERIAL_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->issuer,d2i_X509_NAME); + M_ASN1_D2I_get(ret->serial,d2i_ASN1_INTEGER); + M_ASN1_D2I_Finish(a,PKCS7_ISSUER_AND_SERIAL_free, + ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL); + } + +PKCS7_ISSUER_AND_SERIAL *PKCS7_ISSUER_AND_SERIAL_new() + { + PKCS7_ISSUER_AND_SERIAL *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_ISSUER_AND_SERIAL); + M_ASN1_New(ret->issuer,X509_NAME_new); + M_ASN1_New(ret->serial,ASN1_INTEGER_new); + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW); + } + +void PKCS7_ISSUER_AND_SERIAL_free(a) +PKCS7_ISSUER_AND_SERIAL *a; + { + if (a == NULL) return; + X509_NAME_free(a->issuer); + ASN1_INTEGER_free(a->serial); + Free((char *)a); + } + diff --git a/src/lib/libssl/src/crypto/asn1/p7_lib.c b/src/lib/libssl/src/crypto/asn1/p7_lib.c new file mode 100644 index 0000000000..2134e0974a --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/p7_lib.c @@ -0,0 +1,299 @@ +/* crypto/asn1/p7_lib.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "objects.h" + +/* ASN1err(ASN1_F_D2I_PKCS7,ASN1_R_BAD_PKCS7_CONTENT); + * ASN1err(ASN1_F_I2D_PKCS7,ASN1_R_BAD_PKCS7_TYPE); + * ASN1err(ASN1_F_PKCS7_NEW,ASN1_R_BAD_PKCS7_TYPE); + */ + +int i2d_PKCS7(a,pp) +PKCS7 *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + if (a->asn1 != NULL) + { + if (pp == NULL) + return((int)a->length); + memcpy(*pp,a->asn1,(int)a->length); + *pp+=a->length; + return((int)a->length); + } + + ret+=4; /* sequence, BER header plus '0 0' end padding */ + M_ASN1_I2D_len(a->type,i2d_ASN1_OBJECT); + if (a->d.ptr != NULL) + { + ret+=4; /* explicit tag [ 0 ] BER plus '0 0' */ + switch (OBJ_obj2nid(a->type)) + { + case NID_pkcs7_data: + M_ASN1_I2D_len(a->d.data,i2d_ASN1_OCTET_STRING); + break; + case NID_pkcs7_signed: + M_ASN1_I2D_len(a->d.sign,i2d_PKCS7_SIGNED); + break; + case NID_pkcs7_enveloped: + M_ASN1_I2D_len(a->d.enveloped,i2d_PKCS7_ENVELOPE); + break; + case NID_pkcs7_signedAndEnveloped: + M_ASN1_I2D_len(a->d.signed_and_enveloped, + i2d_PKCS7_SIGN_ENVELOPE); + break; + case NID_pkcs7_digest: + M_ASN1_I2D_len(a->d.digest,i2d_PKCS7_DIGEST); + break; + case NID_pkcs7_encrypted: + M_ASN1_I2D_len(a->d.encrypted,i2d_PKCS7_ENCRYPT); + break; + default: + break; + } + } + r=ret; + if (pp == NULL) return(r); + p= *pp; + M_ASN1_I2D_INF_seq_start(V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + M_ASN1_I2D_put(a->type,i2d_ASN1_OBJECT); + + if (a->d.ptr != NULL) + { + M_ASN1_I2D_INF_seq_start(0,V_ASN1_CONTEXT_SPECIFIC); + switch (OBJ_obj2nid(a->type)) + { + case NID_pkcs7_data: + M_ASN1_I2D_put(a->d.data,i2d_ASN1_OCTET_STRING); + break; + case NID_pkcs7_signed: + M_ASN1_I2D_put(a->d.sign,i2d_PKCS7_SIGNED); + break; + case NID_pkcs7_enveloped: + M_ASN1_I2D_put(a->d.enveloped,i2d_PKCS7_ENVELOPE); + break; + case NID_pkcs7_signedAndEnveloped: + M_ASN1_I2D_put(a->d.signed_and_enveloped, + i2d_PKCS7_SIGN_ENVELOPE); + break; + case NID_pkcs7_digest: + M_ASN1_I2D_put(a->d.digest,i2d_PKCS7_DIGEST); + break; + case NID_pkcs7_encrypted: + M_ASN1_I2D_put(a->d.encrypted,i2d_PKCS7_ENCRYPT); + break; + default: + break; + } + M_ASN1_I2D_INF_seq_end(); + } + M_ASN1_I2D_INF_seq_end(); + M_ASN1_I2D_finish(); + } + +PKCS7 *d2i_PKCS7(a,pp,length) +PKCS7 **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7 *,PKCS7_new); + + if ((a != NULL) && ((*a) != NULL)) + { + if ((*a)->asn1 != NULL) + { + Free((char *)(*a)->asn1); + (*a)->asn1=NULL; + } + (*a)->length=0; + } + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->type,d2i_ASN1_OBJECT); + if (!M_ASN1_D2I_end_sequence()) + { + int Tinf,Ttag,Tclass; + long Tlen; + + if (M_ASN1_next != (V_ASN1_CONSTRUCTED| + V_ASN1_CONTEXT_SPECIFIC|0)) + { + c.error=ASN1_R_BAD_PKCS7_CONTENT; + goto err; + } + + ret->detached=0; + + c.q=c.p; + Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass, + (c.inf & 1)?(length+ *pp-c.q):c.slen); + if (Tinf & 0x80) goto err; + c.slen-=(c.p-c.q); + + switch (OBJ_obj2nid(ret->type)) + { + case NID_pkcs7_data: + M_ASN1_D2I_get(ret->d.data,d2i_ASN1_OCTET_STRING); + break; + case NID_pkcs7_signed: + M_ASN1_D2I_get(ret->d.sign,d2i_PKCS7_SIGNED); + if (ret->d.sign->contents->d.ptr == NULL) + ret->detached=1; + break; + case NID_pkcs7_enveloped: + M_ASN1_D2I_get(ret->d.enveloped,d2i_PKCS7_ENVELOPE); + break; + case NID_pkcs7_signedAndEnveloped: + M_ASN1_D2I_get(ret->d.signed_and_enveloped, + d2i_PKCS7_SIGN_ENVELOPE); + break; + case NID_pkcs7_digest: + M_ASN1_D2I_get(ret->d.digest,d2i_PKCS7_DIGEST); + break; + case NID_pkcs7_encrypted: + M_ASN1_D2I_get(ret->d.encrypted,d2i_PKCS7_ENCRYPT); + break; + default: + c.error=ASN1_R_BAD_PKCS7_TYPE; + goto err; + break; + } + if (Tinf == (1|V_ASN1_CONSTRUCTED)) + { + if (!ASN1_check_infinite_end(&c.p,c.slen)) + { + c.error=ASN1_R_MISSING_EOS; + goto err; + } + } + } + else + ret->detached=1; + + M_ASN1_D2I_Finish(a,PKCS7_free,ASN1_F_D2I_PKCS7); + } + +PKCS7 *PKCS7_new() + { + PKCS7 *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7); + ret->type=ASN1_OBJECT_new(); + ret->asn1=NULL; + ret->length=0; + ret->detached=0; + ret->d.ptr=NULL; + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_NEW); + } + +void PKCS7_free(a) +PKCS7 *a; + { + if (a == NULL) return; + + PKCS7_content_free(a); + if (a->type != NULL) + { + ASN1_OBJECT_free(a->type); + } + Free((char *)(char *)a); + } + +void PKCS7_content_free(a) +PKCS7 *a; + { + if (a->asn1 != NULL) Free((char *)a->asn1); + + if (a->d.ptr != NULL) + { + if (a->type == NULL) return; + + switch (OBJ_obj2nid(a->type)) + { + case NID_pkcs7_data: + ASN1_OCTET_STRING_free(a->d.data); + break; + case NID_pkcs7_signed: + PKCS7_SIGNED_free(a->d.sign); + break; + case NID_pkcs7_enveloped: + PKCS7_ENVELOPE_free(a->d.enveloped); + break; + case NID_pkcs7_signedAndEnveloped: + PKCS7_SIGN_ENVELOPE_free(a->d.signed_and_enveloped); + break; + case NID_pkcs7_digest: + PKCS7_DIGEST_free(a->d.digest); + break; + case NID_pkcs7_encrypted: + PKCS7_ENCRYPT_free(a->d.encrypted); + break; + default: + /* MEMORY LEAK */ + break; + } + } + a->d.ptr=NULL; + } + diff --git a/src/lib/libssl/src/crypto/asn1/p7_recip.c b/src/lib/libssl/src/crypto/asn1/p7_recip.c new file mode 100644 index 0000000000..f02233f5a8 --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/p7_recip.c @@ -0,0 +1,132 @@ +/* crypto/asn1/p7_recip.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_RECIP_INFO_NEW,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_D2I_PKCS7_RECIP_INFO,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_RECIP_INFO(a,pp) +PKCS7_RECIP_INFO *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_len(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); + M_ASN1_I2D_len(a->key_enc_algor,i2d_X509_ALGOR); + M_ASN1_I2D_len(a->enc_key,i2d_ASN1_OCTET_STRING); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_put(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); + M_ASN1_I2D_put(a->key_enc_algor,i2d_X509_ALGOR); + M_ASN1_I2D_put(a->enc_key,i2d_ASN1_OCTET_STRING); + + M_ASN1_I2D_finish(); + } + +PKCS7_RECIP_INFO *d2i_PKCS7_RECIP_INFO(a,pp,length) +PKCS7_RECIP_INFO **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_RECIP_INFO *,PKCS7_RECIP_INFO_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); + M_ASN1_D2I_get(ret->issuer_and_serial,d2i_PKCS7_ISSUER_AND_SERIAL); + M_ASN1_D2I_get(ret->key_enc_algor,d2i_X509_ALGOR); + M_ASN1_D2I_get(ret->enc_key,d2i_ASN1_OCTET_STRING); + + M_ASN1_D2I_Finish(a,PKCS7_RECIP_INFO_free,ASN1_F_D2I_PKCS7_RECIP_INFO); + } + +PKCS7_RECIP_INFO *PKCS7_RECIP_INFO_new() + { + PKCS7_RECIP_INFO *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_RECIP_INFO); + M_ASN1_New(ret->version,ASN1_INTEGER_new); + M_ASN1_New(ret->issuer_and_serial,PKCS7_ISSUER_AND_SERIAL_new); + M_ASN1_New(ret->key_enc_algor,X509_ALGOR_new); + M_ASN1_New(ret->enc_key,ASN1_OCTET_STRING_new); + ret->cert=NULL; + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_RECIP_INFO_NEW); + } + +void PKCS7_RECIP_INFO_free(a) +PKCS7_RECIP_INFO *a; + { + if (a == NULL) return; + ASN1_INTEGER_free(a->version); + PKCS7_ISSUER_AND_SERIAL_free(a->issuer_and_serial); + X509_ALGOR_free(a->key_enc_algor); + ASN1_OCTET_STRING_free(a->enc_key); + if (a->cert != NULL) X509_free(a->cert); + Free((char *)a); + } + diff --git a/src/lib/libssl/src/crypto/asn1/p7_s_e.c b/src/lib/libssl/src/crypto/asn1/p7_s_e.c new file mode 100644 index 0000000000..d344211456 --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/p7_s_e.c @@ -0,0 +1,146 @@ +/* crypto/asn1/p7_s_e.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_SIGN_ENVELOPE_NEW,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_D2I_PKCS7_SIGN_ENVELOPE,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_SIGN_ENVELOPE(a,pp) +PKCS7_SIGN_ENVELOPE *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_len_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); + M_ASN1_I2D_len_SET(a->md_algs,i2d_X509_ALGOR); + M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); + M_ASN1_I2D_len_IMP_set_opt(a->cert,i2d_X509,0); + M_ASN1_I2D_len_IMP_set_opt(a->crl,i2d_X509_CRL,1); + M_ASN1_I2D_len_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_put_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); + M_ASN1_I2D_put_SET(a->md_algs,i2d_X509_ALGOR); + M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); + M_ASN1_I2D_put_IMP_set_opt(a->cert,i2d_X509,0); + M_ASN1_I2D_put_IMP_set_opt(a->crl,i2d_X509_CRL,1); + M_ASN1_I2D_put_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); + + M_ASN1_I2D_finish(); + } + +PKCS7_SIGN_ENVELOPE *d2i_PKCS7_SIGN_ENVELOPE(a,pp,length) +PKCS7_SIGN_ENVELOPE **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_SIGN_ENVELOPE *,PKCS7_SIGN_ENVELOPE_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); + M_ASN1_D2I_get_set(ret->recipientinfo,d2i_PKCS7_RECIP_INFO); + M_ASN1_D2I_get_set(ret->md_algs,d2i_X509_ALGOR); + M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); + M_ASN1_D2I_get_IMP_set_opt(ret->cert,d2i_X509,0); + M_ASN1_D2I_get_IMP_set_opt(ret->crl,d2i_X509_CRL,1); + M_ASN1_D2I_get_set(ret->signer_info,d2i_PKCS7_SIGNER_INFO); + + M_ASN1_D2I_Finish(a,PKCS7_SIGN_ENVELOPE_free, + ASN1_F_D2I_PKCS7_SIGN_ENVELOPE); + } + +PKCS7_SIGN_ENVELOPE *PKCS7_SIGN_ENVELOPE_new() + { + PKCS7_SIGN_ENVELOPE *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_SIGN_ENVELOPE); + M_ASN1_New(ret->version,ASN1_INTEGER_new); + M_ASN1_New(ret->recipientinfo,sk_new_null); + M_ASN1_New(ret->md_algs,sk_new_null); + M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); + ret->cert=NULL; + ret->crl=NULL; + M_ASN1_New(ret->signer_info,sk_new_null); + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_SIGN_ENVELOPE_NEW); + } + +void PKCS7_SIGN_ENVELOPE_free(a) +PKCS7_SIGN_ENVELOPE *a; + { + if (a == NULL) return; + ASN1_INTEGER_free(a->version); + sk_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free); + sk_pop_free(a->md_algs,X509_ALGOR_free); + PKCS7_ENC_CONTENT_free(a->enc_data); + sk_pop_free(a->cert,X509_free); + sk_pop_free(a->crl,X509_CRL_free); + sk_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free); + Free((char *)a); + } + diff --git a/src/lib/libssl/src/crypto/asn1/p7_signd.c b/src/lib/libssl/src/crypto/asn1/p7_signd.c new file mode 100644 index 0000000000..40f9a44fa8 --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/p7_signd.c @@ -0,0 +1,140 @@ +/* crypto/asn1/p7_signd.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_SIGNED_NEW,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_D2I_PKCS7_SIGNED,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_SIGNED(a,pp) +PKCS7_SIGNED *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_len_SET(a->md_algs,i2d_X509_ALGOR); + M_ASN1_I2D_len(a->contents,i2d_PKCS7); + M_ASN1_I2D_len_IMP_set_opt(a->cert,i2d_X509,0); + M_ASN1_I2D_len_IMP_set_opt(a->crl,i2d_X509_CRL,1); + M_ASN1_I2D_len_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_put_SET(a->md_algs,i2d_X509_ALGOR); + M_ASN1_I2D_put(a->contents,i2d_PKCS7); + M_ASN1_I2D_put_IMP_set_opt(a->cert,i2d_X509,0); + M_ASN1_I2D_put_IMP_set_opt(a->crl,i2d_X509_CRL,1); + M_ASN1_I2D_put_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); + + M_ASN1_I2D_finish(); + } + +PKCS7_SIGNED *d2i_PKCS7_SIGNED(a,pp,length) +PKCS7_SIGNED **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_SIGNED *,PKCS7_SIGNED_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); + M_ASN1_D2I_get_set(ret->md_algs,d2i_X509_ALGOR); + M_ASN1_D2I_get(ret->contents,d2i_PKCS7); + M_ASN1_D2I_get_IMP_set_opt(ret->cert,d2i_X509,0); + M_ASN1_D2I_get_IMP_set_opt(ret->crl,d2i_X509_CRL,1); + M_ASN1_D2I_get_set(ret->signer_info,d2i_PKCS7_SIGNER_INFO); + + M_ASN1_D2I_Finish(a,PKCS7_SIGNED_free,ASN1_F_D2I_PKCS7_SIGNED); + } + +PKCS7_SIGNED *PKCS7_SIGNED_new() + { + PKCS7_SIGNED *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_SIGNED); + M_ASN1_New(ret->version,ASN1_INTEGER_new); + M_ASN1_New(ret->md_algs,sk_new_null); + M_ASN1_New(ret->contents,PKCS7_new); + ret->cert=NULL; + ret->crl=NULL; + M_ASN1_New(ret->signer_info,sk_new_null); + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_SIGNED_NEW); + } + +void PKCS7_SIGNED_free(a) +PKCS7_SIGNED *a; + { + if (a == NULL) return; + ASN1_INTEGER_free(a->version); + sk_pop_free(a->md_algs,X509_ALGOR_free); + PKCS7_free(a->contents); + sk_pop_free(a->cert,X509_free); + sk_pop_free(a->crl,X509_CRL_free); + sk_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free); + Free((char *)a); + } + diff --git a/src/lib/libssl/src/crypto/asn1/p7_signi.c b/src/lib/libssl/src/crypto/asn1/p7_signi.c new file mode 100644 index 0000000000..0da92169fc --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/p7_signi.c @@ -0,0 +1,149 @@ +/* crypto/asn1/p7_signi.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" + +/* + * ASN1err(ASN1_F_PKCS7_SIGNER_INFO_NEW,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_D2I_PKCS7_SIGNER_INFO,ASN1_R_LENGTH_MISMATCH); + */ + +int i2d_PKCS7_SIGNER_INFO(a,pp) +PKCS7_SIGNER_INFO *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_len(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); + M_ASN1_I2D_len(a->digest_alg,i2d_X509_ALGOR); + M_ASN1_I2D_len_IMP_set_opt(a->auth_attr,i2d_X509_ATTRIBUTE,0); + M_ASN1_I2D_len(a->digest_enc_alg,i2d_X509_ALGOR); + M_ASN1_I2D_len(a->enc_digest,i2d_ASN1_OCTET_STRING); + M_ASN1_I2D_len_IMP_set_opt(a->unauth_attr,i2d_X509_ATTRIBUTE,1); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); + M_ASN1_I2D_put(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); + M_ASN1_I2D_put(a->digest_alg,i2d_X509_ALGOR); + M_ASN1_I2D_put_IMP_set_opt(a->auth_attr,i2d_X509_ATTRIBUTE,0); + M_ASN1_I2D_put(a->digest_enc_alg,i2d_X509_ALGOR); + M_ASN1_I2D_put(a->enc_digest,i2d_ASN1_OCTET_STRING); + M_ASN1_I2D_put_IMP_set_opt(a->unauth_attr,i2d_X509_ATTRIBUTE,1); + + M_ASN1_I2D_finish(); + } + +PKCS7_SIGNER_INFO *d2i_PKCS7_SIGNER_INFO(a,pp,length) +PKCS7_SIGNER_INFO **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,PKCS7_SIGNER_INFO *,PKCS7_SIGNER_INFO_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); + M_ASN1_D2I_get(ret->issuer_and_serial,d2i_PKCS7_ISSUER_AND_SERIAL); + M_ASN1_D2I_get(ret->digest_alg,d2i_X509_ALGOR); + M_ASN1_D2I_get_IMP_set_opt(ret->auth_attr,d2i_X509_ATTRIBUTE,0); + M_ASN1_D2I_get(ret->digest_enc_alg,d2i_X509_ALGOR); + M_ASN1_D2I_get(ret->enc_digest,d2i_ASN1_OCTET_STRING); + M_ASN1_D2I_get_IMP_set_opt(ret->unauth_attr,d2i_X509_ATTRIBUTE,1); + + M_ASN1_D2I_Finish(a,PKCS7_SIGNER_INFO_free, + ASN1_F_D2I_PKCS7_SIGNER_INFO); + } + +PKCS7_SIGNER_INFO *PKCS7_SIGNER_INFO_new() + { + PKCS7_SIGNER_INFO *ret=NULL; + + M_ASN1_New_Malloc(ret,PKCS7_SIGNER_INFO); + M_ASN1_New(ret->version,ASN1_INTEGER_new); + M_ASN1_New(ret->issuer_and_serial,PKCS7_ISSUER_AND_SERIAL_new); + M_ASN1_New(ret->digest_alg,X509_ALGOR_new); + ret->auth_attr=NULL; + M_ASN1_New(ret->digest_enc_alg,X509_ALGOR_new); + M_ASN1_New(ret->enc_digest,ASN1_OCTET_STRING_new); + ret->unauth_attr=NULL; + ret->pkey=NULL; + return(ret); + M_ASN1_New_Error(ASN1_F_PKCS7_SIGNER_INFO_NEW); + } + +void PKCS7_SIGNER_INFO_free(a) +PKCS7_SIGNER_INFO *a; + { + if (a == NULL) return; + ASN1_INTEGER_free(a->version); + PKCS7_ISSUER_AND_SERIAL_free(a->issuer_and_serial); + X509_ALGOR_free(a->digest_alg); + sk_pop_free(a->auth_attr,X509_ATTRIBUTE_free); + X509_ALGOR_free(a->digest_enc_alg); + ASN1_OCTET_STRING_free(a->enc_digest); + sk_pop_free(a->unauth_attr,X509_ATTRIBUTE_free); + if (a->pkey != NULL) + EVP_PKEY_free(a->pkey); + Free((char *)a); + } + diff --git a/src/lib/libssl/src/crypto/asn1/pkcs8.c b/src/lib/libssl/src/crypto/asn1/pkcs8.c new file mode 100644 index 0000000000..03fdadd51a --- /dev/null +++ b/src/lib/libssl/src/crypto/asn1/pkcs8.c @@ -0,0 +1,142 @@ +/* crypto/asn1/pkcs8.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "asn1_mac.h" +#include "objects.h" + +/* + * ASN1err(ASN1_F_D2I_X509_KEY,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_X509_KEY_NEW,ASN1_R_BAD_GET_OBJECT); + */ + +int i2d_X509_KEY(a,pp) +X509 *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->cert_info, i2d_X509_CINF); + M_ASN1_I2D_len(a->sig_alg, i2d_X509_ALGOR); + M_ASN1_I2D_len(a->signature, i2d_ASN1_BIT_STRING); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->cert_info, i2d_X509_CINF); + M_ASN1_I2D_put(a->sig_alg, i2d_X509_ALGOR); + M_ASN1_I2D_put(a->signature, i2d_ASN1_BIT_STRING); + + M_ASN1_I2D_finish(); + } + +X509 *d2i_X509_KEY(a,pp,length) +X509 **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,X509 *,X509_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->cert_info,d2i_X509_CINF); + M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR); + M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING); + M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509); + } + +X509 *X509_KEY_new() + { + X509_KEY *ret=NULL; + + M_ASN1_New_Malloc(ret,X509_KEY); + ret->references=1; + ret->type=NID + M_ASN1_New(ret->cert_info,X509_CINF_new); + M_ASN1_New(ret->sig_alg,X509_ALGOR_new); + M_ASN1_New(ret->signature,ASN1_BIT_STRING_new); + return(ret); + M_ASN1_New_Error(ASN1_F_X509_NEW); + } + +void X509_KEY_free(a) +X509 *a; + { + int i; + + if (a == NULL) return; + + i=CRYPTO_add_lock(&a->references,-1,CRYPTO_LOCK_X509_KEY); +#ifdef REF_PRINT + REF_PRINT("X509_KEY",a); +#endif + if (i > 0) return; +#ifdef REF_CHECK + if (i < 0) + { + fprintf(stderr,"X509_KEY_free, bad reference count\n"); + abort(); + } +#endif + + X509_CINF_free(a->cert_info); + X509_ALGOR_free(a->sig_alg); + ASN1_BIT_STRING_free(a->signature); + Free((char *)a); + } + diff --git a/src/lib/libssl/src/crypto/bf/Makefile.uni b/src/lib/libssl/src/crypto/bf/Makefile.uni new file mode 100644 index 0000000000..9ba5b0c854 --- /dev/null +++ b/src/lib/libssl/src/crypto/bf/Makefile.uni @@ -0,0 +1,169 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +DIR= bf +TOP= . +# use BF_PTR2 for intel boxes, +# BF_PTR for sparc and MIPS/SGI +# use nothing for Alpha and HP. + +# There are 3 possible performance options, experiment :-) +#OPTS= -DBF_PTR # usr for sparc and MIPS/SGI +#OPTS= -DBF_PTR2 # use for pentium +OPTS= # use for pentium pro, Alpha and HP + +MAKE=make -f Makefile +#CC=cc +#CFLAG= -O + +CC=gcc +#CFLAG= -O4 -funroll-loops -fomit-frame-pointer +CFLAG= -O3 -fomit-frame-pointer + +CFLAGS=$(OPTS) $(CFLAG) +CPP=$(CC) -E +AS=as + +# Assember version of bf_encrypt(). +BF_ENC=bf_enc.o # normal C version +#BF_ENC=asm/bx86-elf.o # elf format x86 +#BF_ENC=asm/bx86-out.o # a.out format x86 +#BF_ENC=asm/bx86-sol.o # solaris format x86 +#BF_ENC=asm/bx86bsdi.o # bsdi format x86 + +LIBDIR=/usr/local/lib +BINDIR=/usr/local/bin +INCDIR=/usr/local/include +MANDIR=/usr/local/man +MAN1=1 +MAN3=3 +SHELL=/bin/sh +LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cfb64.o bf_ofb64.o +LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c + +GENERAL=Makefile Makefile.ssl Makefile.uni asm bf_locl.org README \ + COPYRIGHT blowfish.doc INSTALL + +TESTING= bftest bfspeed bf_opts +TESTING_SRC=bftest.c bfspeed.c bf_opts.c +HEADERS=bf_locl.h blowfish.h bf_pi.h + +ALL= $(GENERAL) $(TESTING_SRC) $(LIBSRC) $(HEADERS) + +BLIB= libblowfish.a + +all: $(BLIB) $(TESTING) + +cc: + $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all + +gcc: + $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all + +x86-elf: + $(MAKE) BF_ENC='asm/bx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all + +x86-out: + $(MAKE) BF_ENC='asm/bx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all + +x86-solaris: + $(MAKE) BF_ENC='asm/bx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all + +x86-bsdi: + $(MAKE) BF_ENC='asm/bx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all + +# elf +asm/bx86-elf.o: asm/bx86unix.cpp + $(CPP) -DELF asm/bx86unix.cpp | $(AS) -o asm/bx86-elf.o + +# solaris +asm/bx86-sol.o: asm/bx86unix.cpp + $(CC) -E -DSOL asm/bx86unix.cpp | sed 's/^#.*//' > asm/bx86-sol.s + as -o asm/bx86-sol.o asm/bx86-sol.s + rm -f asm/bx86-sol.s + +# a.out +asm/bx86-out.o: asm/bx86unix.cpp + $(CPP) -DOUT asm/bx86unix.cpp | $(AS) -o asm/bx86-out.o + +# bsdi +asm/bx86bsdi.o: asm/bx86unix.cpp + $(CPP) -DBSDI asm/bx86unix.cpp | $(AS) -o asm/bx86bsdi.o + +asm/bx86unix.cpp: + (cd asm; perl bf-586.pl cpp >bx86unix.cpp) + +test: all + ./bftest + +$(BLIB): $(LIBOBJ) + /bin/rm -f $(BLIB) + ar cr $(BLIB) $(LIBOBJ) + -if test -s /bin/ranlib; then /bin/ranlib $(BLIB); \ + else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(BLIB); \ + else exit 0; fi; fi + +bftest: bftest.o $(BLIB) + $(CC) $(CFLAGS) -o bftest bftest.o $(BLIB) + +bfspeed: bfspeed.o $(BLIB) + $(CC) $(CFLAGS) -o bfspeed bfspeed.o $(BLIB) + +bf_opts: bf_opts.o $(BLIB) + $(CC) $(CFLAGS) -o bf_opts bf_opts.o $(BLIB) + +tags: + ctags $(TESTING_SRC) $(LIBBF) + +tar: + tar chf libbf.tar $(ALL) + +shar: + shar $(ALL) >libbf.shar + +depend: + makedepend $(LIBBF) $(TESTING_SRC) + +clean: + /bin/rm -f *.o tags core $(TESTING) $(BLIB) .nfs* *.old *.bak asm/*.o + +dclean: + sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new + mv -f Makefile.new Makefile + +# Eric is probably going to choke when he next looks at this --tjh +install: $(BLIB) + if test $(INSTALLTOP); then \ + echo SSL style install; \ + cp $(BLIB) $(INSTALLTOP)/lib; \ + if test -s /bin/ranlib; then \ + /bin/ranlib $(INSTALLTOP)/lib/$(BLIB); \ + else \ + if test -s /usr/bin/ranlib; then \ + /usr/bin/ranlib $(INSTALLTOP)/lib/$(BLIB); \ + fi; fi; \ + chmod 644 $(INSTALLTOP)/lib/$(BLIB); \ + cp blowfish.h $(INSTALLTOP)/include; \ + chmod 644 $(INSTALLTOP)/include/blowfish.h; \ + else \ + echo Standalone install; \ + cp $(BLIB) $(LIBDIR)/$(BLIB); \ + if test -s /bin/ranlib; then \ + /bin/ranlib $(LIBDIR)/$(BLIB); \ + else \ + if test -s /usr/bin/ranlib; then \ + /usr/bin/ranlib $(LIBDIR)/$(BLIB); \ + fi; \ + fi; \ + chmod 644 $(LIBDIR)/$(BLIB); \ + cp blowfish.h $(INCDIR)/blowfish.h; \ + chmod 644 $(INCDIR)/blowfish.h; \ + fi + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libssl/src/crypto/bf/asm/b-win32.asm b/src/lib/libssl/src/crypto/bf/asm/b-win32.asm new file mode 100644 index 0000000000..138c99d0aa --- /dev/null +++ b/src/lib/libssl/src/crypto/bf/asm/b-win32.asm @@ -0,0 +1,906 @@ + ; Don't even think of reading this code + ; It was automatically generated by bf-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE bf-586.asm + .486 +.model FLAT +_TEXT SEGMENT +PUBLIC _BF_encrypt + +_BF_encrypt PROC NEAR + ; + push ebp + push ebx + mov ebx, DWORD PTR 12[esp] + mov ebp, DWORD PTR 16[esp] + push esi + push edi + ; Load the 2 words + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + xor eax, eax + mov ebx, DWORD PTR [ebp] + xor ecx, ecx + xor edi, ebx + ; + ; Round 0 + mov edx, DWORD PTR 4[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 1 + mov edx, DWORD PTR 8[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 2 + mov edx, DWORD PTR 12[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 3 + mov edx, DWORD PTR 16[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 4 + mov edx, DWORD PTR 20[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 5 + mov edx, DWORD PTR 24[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 6 + mov edx, DWORD PTR 28[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 7 + mov edx, DWORD PTR 32[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 8 + mov edx, DWORD PTR 36[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 9 + mov edx, DWORD PTR 40[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 10 + mov edx, DWORD PTR 44[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 11 + mov edx, DWORD PTR 48[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 12 + mov edx, DWORD PTR 52[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 13 + mov edx, DWORD PTR 56[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 14 + mov edx, DWORD PTR 60[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 15 + mov edx, DWORD PTR 64[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + ; Load parameter 0 (16) enc=1 + mov eax, DWORD PTR 20[esp] + xor edi, ebx + mov edx, DWORD PTR 68[ebp] + xor esi, edx + mov DWORD PTR 4[eax],edi + mov DWORD PTR [eax],esi + pop edi + pop esi + pop ebx + pop ebp + ret +_BF_encrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _BF_decrypt + +_BF_decrypt PROC NEAR + ; + push ebp + push ebx + mov ebx, DWORD PTR 12[esp] + mov ebp, DWORD PTR 16[esp] + push esi + push edi + ; Load the 2 words + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + xor eax, eax + mov ebx, DWORD PTR 68[ebp] + xor ecx, ecx + xor edi, ebx + ; + ; Round 16 + mov edx, DWORD PTR 64[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 15 + mov edx, DWORD PTR 60[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 14 + mov edx, DWORD PTR 56[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 13 + mov edx, DWORD PTR 52[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 12 + mov edx, DWORD PTR 48[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 11 + mov edx, DWORD PTR 44[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 10 + mov edx, DWORD PTR 40[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 9 + mov edx, DWORD PTR 36[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 8 + mov edx, DWORD PTR 32[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 7 + mov edx, DWORD PTR 28[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 6 + mov edx, DWORD PTR 24[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 5 + mov edx, DWORD PTR 20[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 4 + mov edx, DWORD PTR 16[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 3 + mov edx, DWORD PTR 12[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 2 + mov edx, DWORD PTR 8[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 1 + mov edx, DWORD PTR 4[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + ; Load parameter 0 (1) enc=0 + mov eax, DWORD PTR 20[esp] + xor edi, ebx + mov edx, DWORD PTR [ebp] + xor esi, edx + mov DWORD PTR 4[eax],edi + mov DWORD PTR [eax],esi + pop edi + pop esi + pop ebx + pop ebp + ret +_BF_decrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _BF_cbc_encrypt + +_BF_cbc_encrypt PROC NEAR + ; + push ebp + push ebx + push esi + push edi + mov ebp, DWORD PTR 28[esp] + ; getting iv ptr from parameter 4 + mov ebx, DWORD PTR 36[esp] + mov esi, DWORD PTR [ebx] + mov edi, DWORD PTR 4[ebx] + push edi + push esi + push edi + push esi + mov ebx, esp + mov esi, DWORD PTR 36[esp] + mov edi, DWORD PTR 40[esp] + ; getting encrypt flag from parameter 5 + mov ecx, DWORD PTR 56[esp] + ; get and push parameter 3 + mov eax, DWORD PTR 48[esp] + push eax + push ebx + cmp ecx, 0 + jz $L000decrypt + and ebp, 4294967288 + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + jz $L001encrypt_finish +L002encrypt_loop: + mov ecx, DWORD PTR [esi] + mov edx, DWORD PTR 4[esi] + xor eax, ecx + xor ebx, edx + bswap eax + bswap ebx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _BF_encrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + bswap eax + bswap ebx + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L002encrypt_loop +$L001encrypt_finish: + mov ebp, DWORD PTR 52[esp] + and ebp, 7 + jz $L003finish + xor ecx, ecx + xor edx, edx + mov ebp, DWORD PTR $L004cbc_enc_jmp_table[ebp*4] + jmp ebp +L005ej7: + mov dh, BYTE PTR 6[esi] + shl edx, 8 +L006ej6: + mov dh, BYTE PTR 5[esi] +L007ej5: + mov dl, BYTE PTR 4[esi] +L008ej4: + mov ecx, DWORD PTR [esi] + jmp $L009ejend +L010ej3: + mov ch, BYTE PTR 2[esi] + shl ecx, 8 +L011ej2: + mov ch, BYTE PTR 1[esi] +L012ej1: + mov cl, BYTE PTR [esi] +$L009ejend: + xor eax, ecx + xor ebx, edx + bswap eax + bswap ebx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _BF_encrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + bswap eax + bswap ebx + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + jmp $L003finish +$L000decrypt: + and ebp, 4294967288 + mov eax, DWORD PTR 16[esp] + mov ebx, DWORD PTR 20[esp] + jz $L013decrypt_finish +L014decrypt_loop: + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + bswap eax + bswap ebx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _BF_decrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + bswap eax + bswap ebx + mov ecx, DWORD PTR 16[esp] + mov edx, DWORD PTR 20[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR [edi],ecx + mov DWORD PTR 4[edi],edx + mov DWORD PTR 16[esp],eax + mov DWORD PTR 20[esp],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L014decrypt_loop +$L013decrypt_finish: + mov ebp, DWORD PTR 52[esp] + and ebp, 7 + jz $L003finish + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + bswap eax + bswap ebx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _BF_decrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + bswap eax + bswap ebx + mov ecx, DWORD PTR 16[esp] + mov edx, DWORD PTR 20[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] +L015dj7: + ror edx, 16 + mov BYTE PTR 6[edi],dl + shr edx, 16 +L016dj6: + mov BYTE PTR 5[edi],dh +L017dj5: + mov BYTE PTR 4[edi],dl +L018dj4: + mov DWORD PTR [edi],ecx + jmp $L019djend +L020dj3: + ror ecx, 16 + mov BYTE PTR 2[edi],cl + shl ecx, 16 +L021dj2: + mov BYTE PTR 1[esi],ch +L022dj1: + mov BYTE PTR [esi], cl +$L019djend: + jmp $L003finish +$L003finish: + mov ecx, DWORD PTR 60[esp] + add esp, 24 + mov DWORD PTR [ecx],eax + mov DWORD PTR 4[ecx],ebx + pop edi + pop esi + pop ebx + pop ebp + ret +$L004cbc_enc_jmp_table: + DD 0 + DD L012ej1 + DD L011ej2 + DD L010ej3 + DD L008ej4 + DD L007ej5 + DD L006ej6 + DD L005ej7 +L023cbc_dec_jmp_table: + DD 0 + DD L022dj1 + DD L021dj2 + DD L020dj3 + DD L018dj4 + DD L017dj5 + DD L016dj6 + DD L015dj7 +_BF_cbc_encrypt ENDP +_TEXT ENDS +END diff --git a/src/lib/libssl/src/crypto/bf/asm/bx86unix.cpp b/src/lib/libssl/src/crypto/bf/asm/bx86unix.cpp new file mode 100644 index 0000000000..cdaa269378 --- /dev/null +++ b/src/lib/libssl/src/crypto/bf/asm/bx86unix.cpp @@ -0,0 +1,976 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define BF_encrypt _BF_encrypt +#define BF_decrypt _BF_decrypt +#define BF_cbc_encrypt _BF_cbc_encrypt + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by bf-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "bf-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl BF_encrypt + TYPE(BF_encrypt,@function) +BF_encrypt: + + pushl %ebp + pushl %ebx + movl 12(%esp), %ebx + movl 16(%esp), %ebp + pushl %esi + pushl %edi + /* Load the 2 words */ + movl (%ebx), %edi + movl 4(%ebx), %esi + xorl %eax, %eax + movl (%ebp), %ebx + xorl %ecx, %ecx + xorl %ebx, %edi + + /* Round 0 */ + movl 4(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 1 */ + movl 8(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 2 */ + movl 12(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 3 */ + movl 16(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 4 */ + movl 20(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 5 */ + movl 24(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 6 */ + movl 28(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 7 */ + movl 32(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 8 */ + movl 36(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 9 */ + movl 40(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 10 */ + movl 44(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 11 */ + movl 48(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 12 */ + movl 52(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 13 */ + movl 56(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 14 */ + movl 60(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 15 */ + movl 64(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + /* Load parameter 0 (16) enc=1 */ + movl 20(%esp), %eax + xorl %ebx, %edi + movl 68(%ebp), %edx + xorl %edx, %esi + movl %edi, 4(%eax) + movl %esi, (%eax) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.BF_encrypt_end: + SIZE(BF_encrypt,.BF_encrypt_end-BF_encrypt) +.ident "BF_encrypt" +.text + .align ALIGN +.globl BF_decrypt + TYPE(BF_decrypt,@function) +BF_decrypt: + + pushl %ebp + pushl %ebx + movl 12(%esp), %ebx + movl 16(%esp), %ebp + pushl %esi + pushl %edi + /* Load the 2 words */ + movl (%ebx), %edi + movl 4(%ebx), %esi + xorl %eax, %eax + movl 68(%ebp), %ebx + xorl %ecx, %ecx + xorl %ebx, %edi + + /* Round 16 */ + movl 64(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 15 */ + movl 60(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 14 */ + movl 56(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 13 */ + movl 52(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 12 */ + movl 48(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 11 */ + movl 44(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 10 */ + movl 40(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 9 */ + movl 36(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 8 */ + movl 32(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 7 */ + movl 28(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 6 */ + movl 24(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 5 */ + movl 20(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 4 */ + movl 16(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 3 */ + movl 12(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %edi + + /* Round 2 */ + movl 8(%ebp), %edx + movl %edi, %ebx + xorl %edx, %esi + shrl $16, %ebx + movl %edi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + xorl %eax, %eax + xorl %ebx, %esi + + /* Round 1 */ + movl 4(%ebp), %edx + movl %esi, %ebx + xorl %edx, %edi + shrl $16, %ebx + movl %esi, %edx + movb %bh, %al + andl $255, %ebx + movb %dh, %cl + andl $255, %edx + movl 72(%ebp,%eax,4),%eax + movl 1096(%ebp,%ebx,4),%ebx + addl %eax, %ebx + movl 2120(%ebp,%ecx,4),%eax + xorl %eax, %ebx + movl 3144(%ebp,%edx,4),%edx + addl %edx, %ebx + /* Load parameter 0 (1) enc=0 */ + movl 20(%esp), %eax + xorl %ebx, %edi + movl (%ebp), %edx + xorl %edx, %esi + movl %edi, 4(%eax) + movl %esi, (%eax) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.BF_decrypt_end: + SIZE(BF_decrypt,.BF_decrypt_end-BF_decrypt) +.ident "BF_decrypt" +.text + .align ALIGN +.globl BF_cbc_encrypt + TYPE(BF_cbc_encrypt,@function) +BF_cbc_encrypt: + + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + movl 28(%esp), %ebp + /* getting iv ptr from parameter 4 */ + movl 36(%esp), %ebx + movl (%ebx), %esi + movl 4(%ebx), %edi + pushl %edi + pushl %esi + pushl %edi + pushl %esi + movl %esp, %ebx + movl 36(%esp), %esi + movl 40(%esp), %edi + /* getting encrypt flag from parameter 5 */ + movl 56(%esp), %ecx + /* get and push parameter 3 */ + movl 48(%esp), %eax + pushl %eax + pushl %ebx + cmpl $0, %ecx + jz .L000decrypt + andl $4294967288, %ebp + movl 8(%esp), %eax + movl 12(%esp), %ebx + jz .L001encrypt_finish +.L002encrypt_loop: + movl (%esi), %ecx + movl 4(%esi), %edx + xorl %ecx, %eax + xorl %edx, %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call BF_encrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, (%edi) + movl %ebx, 4(%edi) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L002encrypt_loop +.L001encrypt_finish: + movl 52(%esp), %ebp + andl $7, %ebp + jz .L003finish + xorl %ecx, %ecx + xorl %edx, %edx + movl .L004cbc_enc_jmp_table(,%ebp,4),%ebp + jmp *%ebp +.L005ej7: + movb 6(%esi), %dh + sall $8, %edx +.L006ej6: + movb 5(%esi), %dh +.L007ej5: + movb 4(%esi), %dl +.L008ej4: + movl (%esi), %ecx + jmp .L009ejend +.L010ej3: + movb 2(%esi), %ch + sall $8, %ecx +.L011ej2: + movb 1(%esi), %ch +.L012ej1: + movb (%esi), %cl +.L009ejend: + xorl %ecx, %eax + xorl %edx, %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call BF_encrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, (%edi) + movl %ebx, 4(%edi) + jmp .L003finish +.align ALIGN +.L000decrypt: + andl $4294967288, %ebp + movl 16(%esp), %eax + movl 20(%esp), %ebx + jz .L013decrypt_finish +.L014decrypt_loop: + movl (%esi), %eax + movl 4(%esi), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call BF_decrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl 16(%esp), %ecx + movl 20(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx + movl %ecx, (%edi) + movl %edx, 4(%edi) + movl %eax, 16(%esp) + movl %ebx, 20(%esp) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L014decrypt_loop +.L013decrypt_finish: + movl 52(%esp), %ebp + andl $7, %ebp + jz .L003finish + movl (%esi), %eax + movl 4(%esi), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call BF_decrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl 16(%esp), %ecx + movl 20(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx +.L015dj7: + rorl $16, %edx + movb %dl, 6(%edi) + shrl $16, %edx +.L016dj6: + movb %dh, 5(%edi) +.L017dj5: + movb %dl, 4(%edi) +.L018dj4: + movl %ecx, (%edi) + jmp .L019djend +.L020dj3: + rorl $16, %ecx + movb %cl, 2(%edi) + sall $16, %ecx +.L021dj2: + movb %ch, 1(%esi) +.L022dj1: + movb %cl, (%esi) +.L019djend: + jmp .L003finish +.align ALIGN +.L003finish: + movl 60(%esp), %ecx + addl $24, %esp + movl %eax, (%ecx) + movl %ebx, 4(%ecx) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.align ALIGN +.L004cbc_enc_jmp_table: + .long 0 + .long .L012ej1 + .long .L011ej2 + .long .L010ej3 + .long .L008ej4 + .long .L007ej5 + .long .L006ej6 + .long .L005ej7 +.align ALIGN +.L023cbc_dec_jmp_table: + .long 0 + .long .L022dj1 + .long .L021dj2 + .long .L020dj3 + .long .L018dj4 + .long .L017dj5 + .long .L016dj6 + .long .L015dj7 +.BF_cbc_encrypt_end: + SIZE(BF_cbc_encrypt,.BF_cbc_encrypt_end-BF_cbc_encrypt) +.ident "desasm.pl" diff --git a/src/lib/libssl/src/crypto/bf/bf_locl.org b/src/lib/libssl/src/crypto/bf/bf_locl.org new file mode 100644 index 0000000000..a5663de8ca --- /dev/null +++ b/src/lib/libssl/src/crypto/bf/bf_locl.org @@ -0,0 +1,242 @@ +/* crypto/bf/bf_locl.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify bf_locl.org since bf_locl.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined( sun ) /* Newer Sparc's */ +# define BF_PTR +#elif defined( __ultrix ) /* Older MIPS */ +# define BF_PTR +#elif defined( __osf1__ ) /* Alpha */ + /* None */ +#elif defined ( _AIX ) /* RS6000 */ + /* Unknown */ +#elif defined( __hpux ) /* HP-PA */ + /* None */ +#elif defined( __aux ) /* 68K */ + /* Unknown */ +#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ + /* Unknown */ +#elif defined( __sgi ) /* Newer MIPS */ +# define BF_PTR +#elif defined( i386 ) /* x86 boxes, should be gcc */ +#elif defined( _MSC_VER ) /* x86 boxes, Visual C */ +#endif /* Systems-specific speed defines */ + +#undef c2l +#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ + l|=((unsigned long)(*((c)++)))<< 8L, \ + l|=((unsigned long)(*((c)++)))<<16L, \ + l|=((unsigned long)(*((c)++)))<<24L) + +/* NOTE - c is not incremented as per c2l */ +#undef c2ln +#define c2ln(c,l1,l2,n) { \ + c+=n; \ + l1=l2=0; \ + switch (n) { \ + case 8: l2 =((unsigned long)(*(--(c))))<<24L; \ + case 7: l2|=((unsigned long)(*(--(c))))<<16L; \ + case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \ + case 5: l2|=((unsigned long)(*(--(c)))); \ + case 4: l1 =((unsigned long)(*(--(c))))<<24L; \ + case 3: l1|=((unsigned long)(*(--(c))))<<16L; \ + case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \ + case 1: l1|=((unsigned long)(*(--(c)))); \ + } \ + } + +#undef l2c +#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>24L)&0xff)) + +/* NOTE - c is not incremented as per l2c */ +#undef l2cn +#define l2cn(l1,l2,c,n) { \ + c+=n; \ + switch (n) { \ + case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ + case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ + case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ + case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ + case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ + case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ + case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ + case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ + } \ + } + +/* NOTE - c is not incremented as per n2l */ +#define n2ln(c,l1,l2,n) { \ + c+=n; \ + l1=l2=0; \ + switch (n) { \ + case 8: l2 =((unsigned long)(*(--(c)))) ; \ + case 7: l2|=((unsigned long)(*(--(c))))<< 8; \ + case 6: l2|=((unsigned long)(*(--(c))))<<16; \ + case 5: l2|=((unsigned long)(*(--(c))))<<24; \ + case 4: l1 =((unsigned long)(*(--(c)))) ; \ + case 3: l1|=((unsigned long)(*(--(c))))<< 8; \ + case 2: l1|=((unsigned long)(*(--(c))))<<16; \ + case 1: l1|=((unsigned long)(*(--(c))))<<24; \ + } \ + } + +/* NOTE - c is not incremented as per l2n */ +#define l2nn(l1,l2,c,n) { \ + c+=n; \ + switch (n) { \ + case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ + case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ + case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ + case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ + case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ + case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ + case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ + case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ + } \ + } + +#undef n2l +#define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \ + l|=((unsigned long)(*((c)++)))<<16L, \ + l|=((unsigned long)(*((c)++)))<< 8L, \ + l|=((unsigned long)(*((c)++)))) + +#undef l2n +#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ + *((c)++)=(unsigned char)(((l) )&0xff)) + +/* This is actually a big endian algorithm, the most significate byte + * is used to lookup array 0 */ + +/* use BF_PTR2 for intel boxes, + * BF_PTR for sparc and MIPS/SGI + * use nothing for Alpha and HP. + */ +#if !defined(BF_PTR) && !defined(BF_PTR2) +#undef BF_PTR +#endif + +#define BF_M 0x3fc +#define BF_0 22L +#define BF_1 14L +#define BF_2 6L +#define BF_3 2L /* left shift */ + +#if defined(BF_PTR2) + +/* This is basically a special pentium verson */ +#define BF_ENC(LL,R,S,P) \ + { \ + BF_LONG t,u,v; \ + u=R>>BF_0; \ + v=R>>BF_1; \ + u&=BF_M; \ + v&=BF_M; \ + t= *(BF_LONG *)((unsigned char *)&(S[ 0])+u); \ + u=R>>BF_2; \ + t+= *(BF_LONG *)((unsigned char *)&(S[256])+v); \ + v=R<<BF_3; \ + u&=BF_M; \ + v&=BF_M; \ + t^= *(BF_LONG *)((unsigned char *)&(S[512])+u); \ + LL^=P; \ + t+= *(BF_LONG *)((unsigned char *)&(S[768])+v); \ + LL^=t; \ + } + +#elif defined(BF_PTR) + +/* This is normally very good */ + +#define BF_ENC(LL,R,S,P) \ + LL^=P; \ + LL^= (((*(BF_LONG *)((unsigned char *)&(S[ 0])+((R>>BF_0)&BF_M))+ \ + *(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \ + *(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \ + *(BF_LONG *)((unsigned char *)&(S[768])+((R<<BF_3)&BF_M))); +#else + +/* This will always work, even on 64 bit machines and strangly enough, + * on the Alpha it is faster than the pointer versions (both 32 and 64 + * versions of BF_LONG) */ + +#define BF_ENC(LL,R,S,P) \ + LL^=P; \ + LL^=((( S[ (int)(R>>24L) ] + \ + S[0x0100+((int)(R>>16L)&0xff)])^ \ + S[0x0200+((int)(R>> 8L)&0xff)])+ \ + S[0x0300+((int)(R )&0xff)])&0xffffffffL; +#endif diff --git a/src/lib/libssl/src/crypto/bio/bio.err b/src/lib/libssl/src/crypto/bio/bio.err new file mode 100644 index 0000000000..6e2f2b63ca --- /dev/null +++ b/src/lib/libssl/src/crypto/bio/bio.err @@ -0,0 +1,46 @@ +/* Error codes for the BIO functions. */ + +/* Function codes. */ +#define BIO_F_ACPT_STATE 100 +#define BIO_F_BIO_ACCEPT 101 +#define BIO_F_BIO_CTRL 102 +#define BIO_F_BIO_GETS 103 +#define BIO_F_BIO_GET_ACCEPT_SOCKET 104 +#define BIO_F_BIO_GET_HOST_IP 105 +#define BIO_F_BIO_GET_PORT 106 +#define BIO_F_BIO_NEW 107 +#define BIO_F_BIO_NEW_FILE 108 +#define BIO_F_BIO_PUTS 109 +#define BIO_F_BIO_READ 110 +#define BIO_F_BIO_SOCK_INIT 111 +#define BIO_F_BIO_WRITE 112 +#define BIO_F_BUFFER_CTRL 113 +#define BIO_F_CONN_STATE 114 +#define BIO_F_FILE_CTRL 115 +#define BIO_F_MEM_WRITE 116 +#define BIO_F_SSL_NEW 117 +#define BIO_F_WSASTARTUP 118 + +/* Reason codes. */ +#define BIO_R_ACCEPT_ERROR 100 +#define BIO_R_BAD_FOPEN_MODE 101 +#define BIO_R_BAD_HOSTNAME_LOOKUP 102 +#define BIO_R_CONNECT_ERROR 103 +#define BIO_R_ERROR_SETTING_NBIO 104 +#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105 +#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106 +#define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 +#define BIO_R_INVALID_IP_ADDRESS 108 +#define BIO_R_KEEPALIVE 109 +#define BIO_R_NBIO_CONNECT_ERROR 110 +#define BIO_R_NO_ACCEPT_PORT_SPECIFIED 111 +#define BIO_R_NO_HOSTHNAME_SPECIFIED 112 +#define BIO_R_NO_PORT_DEFINED 113 +#define BIO_R_NO_PORT_SPECIFIED 114 +#define BIO_R_NULL_PARAMETER 115 +#define BIO_R_UNABLE_TO_BIND_SOCKET 116 +#define BIO_R_UNABLE_TO_CREATE_SOCKET 117 +#define BIO_R_UNABLE_TO_LISTEN_SOCKET 118 +#define BIO_R_UNINITALISED 119 +#define BIO_R_UNSUPPORTED_METHOD 120 +#define BIO_R_WSASTARTUP 121 diff --git a/src/lib/libssl/src/crypto/bn/asm/bn-win32.asm b/src/lib/libssl/src/crypto/bn/asm/bn-win32.asm new file mode 100644 index 0000000000..017ea462b0 --- /dev/null +++ b/src/lib/libssl/src/crypto/bn/asm/bn-win32.asm @@ -0,0 +1,689 @@ + ; Don't even think of reading this code + ; It was automatically generated by bn-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE bn-586.asm + .386 +.model FLAT +_TEXT SEGMENT +PUBLIC _bn_mul_add_words + +_bn_mul_add_words PROC NEAR + push ebp + push ebx + push esi + push edi + ; + xor esi, esi + mov edi, DWORD PTR 20[esp] + mov ecx, DWORD PTR 28[esp] + mov ebx, DWORD PTR 24[esp] + and ecx, 4294967288 + mov ebp, DWORD PTR 32[esp] + push ecx + jz $L000maw_finish +L001maw_loop: + mov DWORD PTR [esp],ecx + ; Round 0 + mov eax, DWORD PTR [ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR [edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR [edi],eax + mov esi, edx + ; Round 4 + mov eax, DWORD PTR 4[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 4[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR 4[edi],eax + mov esi, edx + ; Round 8 + mov eax, DWORD PTR 8[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 8[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR 8[edi],eax + mov esi, edx + ; Round 12 + mov eax, DWORD PTR 12[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 12[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR 12[edi],eax + mov esi, edx + ; Round 16 + mov eax, DWORD PTR 16[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 16[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR 16[edi],eax + mov esi, edx + ; Round 20 + mov eax, DWORD PTR 20[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 20[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR 20[edi],eax + mov esi, edx + ; Round 24 + mov eax, DWORD PTR 24[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 24[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR 24[edi],eax + mov esi, edx + ; Round 28 + mov eax, DWORD PTR 28[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 28[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR 28[edi],eax + mov esi, edx + ; + mov ecx, DWORD PTR [esp] + add ebx, 32 + add edi, 32 + sub ecx, 8 + jnz L001maw_loop +$L000maw_finish: + mov ecx, DWORD PTR 32[esp] + and ecx, 7 + jnz $L002maw_finish2 + jmp $L003maw_end +$L002maw_finish2: + ; Tail Round 0 + mov eax, DWORD PTR [ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR [edi] + adc edx, 0 + add eax, esi + adc edx, 0 + dec ecx + mov DWORD PTR [edi],eax + mov esi, edx + jz $L003maw_end + ; Tail Round 1 + mov eax, DWORD PTR 4[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 4[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + dec ecx + mov DWORD PTR 4[edi],eax + mov esi, edx + jz $L003maw_end + ; Tail Round 2 + mov eax, DWORD PTR 8[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 8[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + dec ecx + mov DWORD PTR 8[edi],eax + mov esi, edx + jz $L003maw_end + ; Tail Round 3 + mov eax, DWORD PTR 12[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 12[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + dec ecx + mov DWORD PTR 12[edi],eax + mov esi, edx + jz $L003maw_end + ; Tail Round 4 + mov eax, DWORD PTR 16[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 16[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + dec ecx + mov DWORD PTR 16[edi],eax + mov esi, edx + jz $L003maw_end + ; Tail Round 5 + mov eax, DWORD PTR 20[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 20[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + dec ecx + mov DWORD PTR 20[edi],eax + mov esi, edx + jz $L003maw_end + ; Tail Round 6 + mov eax, DWORD PTR 24[ebx] + mul ebp + add eax, esi + mov esi, DWORD PTR 24[edi] + adc edx, 0 + add eax, esi + adc edx, 0 + mov DWORD PTR 24[edi],eax + mov esi, edx +$L003maw_end: + mov eax, esi + pop ecx + pop edi + pop esi + pop ebx + pop ebp + ret +_bn_mul_add_words ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _bn_mul_words + +_bn_mul_words PROC NEAR + push ebp + push ebx + push esi + push edi + ; + xor esi, esi + mov edi, DWORD PTR 20[esp] + mov ebx, DWORD PTR 24[esp] + mov ebp, DWORD PTR 28[esp] + mov ecx, DWORD PTR 32[esp] + and ebp, 4294967288 + jz $L004mw_finish +L005mw_loop: + ; Round 0 + mov eax, DWORD PTR [ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR [edi],eax + mov esi, edx + ; Round 4 + mov eax, DWORD PTR 4[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 4[edi],eax + mov esi, edx + ; Round 8 + mov eax, DWORD PTR 8[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 8[edi],eax + mov esi, edx + ; Round 12 + mov eax, DWORD PTR 12[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 12[edi],eax + mov esi, edx + ; Round 16 + mov eax, DWORD PTR 16[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 16[edi],eax + mov esi, edx + ; Round 20 + mov eax, DWORD PTR 20[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 20[edi],eax + mov esi, edx + ; Round 24 + mov eax, DWORD PTR 24[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 24[edi],eax + mov esi, edx + ; Round 28 + mov eax, DWORD PTR 28[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 28[edi],eax + mov esi, edx + ; + add ebx, 32 + add edi, 32 + sub ebp, 8 + jz $L004mw_finish + jmp L005mw_loop +$L004mw_finish: + mov ebp, DWORD PTR 28[esp] + and ebp, 7 + jnz $L006mw_finish2 + jmp $L007mw_end +$L006mw_finish2: + ; Tail Round 0 + mov eax, DWORD PTR [ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR [edi],eax + mov esi, edx + dec ebp + jz $L007mw_end + ; Tail Round 1 + mov eax, DWORD PTR 4[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 4[edi],eax + mov esi, edx + dec ebp + jz $L007mw_end + ; Tail Round 2 + mov eax, DWORD PTR 8[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 8[edi],eax + mov esi, edx + dec ebp + jz $L007mw_end + ; Tail Round 3 + mov eax, DWORD PTR 12[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 12[edi],eax + mov esi, edx + dec ebp + jz $L007mw_end + ; Tail Round 4 + mov eax, DWORD PTR 16[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 16[edi],eax + mov esi, edx + dec ebp + jz $L007mw_end + ; Tail Round 5 + mov eax, DWORD PTR 20[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 20[edi],eax + mov esi, edx + dec ebp + jz $L007mw_end + ; Tail Round 6 + mov eax, DWORD PTR 24[ebx] + mul ecx + add eax, esi + adc edx, 0 + mov DWORD PTR 24[edi],eax + mov esi, edx +$L007mw_end: + mov eax, esi + pop edi + pop esi + pop ebx + pop ebp + ret +_bn_mul_words ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _bn_sqr_words + +_bn_sqr_words PROC NEAR + push ebp + push ebx + push esi + push edi + ; + mov esi, DWORD PTR 20[esp] + mov edi, DWORD PTR 24[esp] + mov ebx, DWORD PTR 28[esp] + and ebx, 4294967288 + jz $L008sw_finish +L009sw_loop: + ; Round 0 + mov eax, DWORD PTR [edi] + mul eax + mov DWORD PTR [esi],eax + mov DWORD PTR 4[esi],edx + ; Round 4 + mov eax, DWORD PTR 4[edi] + mul eax + mov DWORD PTR 8[esi],eax + mov DWORD PTR 12[esi],edx + ; Round 8 + mov eax, DWORD PTR 8[edi] + mul eax + mov DWORD PTR 16[esi],eax + mov DWORD PTR 20[esi],edx + ; Round 12 + mov eax, DWORD PTR 12[edi] + mul eax + mov DWORD PTR 24[esi],eax + mov DWORD PTR 28[esi],edx + ; Round 16 + mov eax, DWORD PTR 16[edi] + mul eax + mov DWORD PTR 32[esi],eax + mov DWORD PTR 36[esi],edx + ; Round 20 + mov eax, DWORD PTR 20[edi] + mul eax + mov DWORD PTR 40[esi],eax + mov DWORD PTR 44[esi],edx + ; Round 24 + mov eax, DWORD PTR 24[edi] + mul eax + mov DWORD PTR 48[esi],eax + mov DWORD PTR 52[esi],edx + ; Round 28 + mov eax, DWORD PTR 28[edi] + mul eax + mov DWORD PTR 56[esi],eax + mov DWORD PTR 60[esi],edx + ; + add edi, 32 + add esi, 64 + sub ebx, 8 + jnz L009sw_loop +$L008sw_finish: + mov ebx, DWORD PTR 28[esp] + and ebx, 7 + jz $L010sw_end + ; Tail Round 0 + mov eax, DWORD PTR [edi] + mul eax + mov DWORD PTR [esi],eax + dec ebx + mov DWORD PTR 4[esi],edx + jz $L010sw_end + ; Tail Round 1 + mov eax, DWORD PTR 4[edi] + mul eax + mov DWORD PTR 8[esi],eax + dec ebx + mov DWORD PTR 12[esi],edx + jz $L010sw_end + ; Tail Round 2 + mov eax, DWORD PTR 8[edi] + mul eax + mov DWORD PTR 16[esi],eax + dec ebx + mov DWORD PTR 20[esi],edx + jz $L010sw_end + ; Tail Round 3 + mov eax, DWORD PTR 12[edi] + mul eax + mov DWORD PTR 24[esi],eax + dec ebx + mov DWORD PTR 28[esi],edx + jz $L010sw_end + ; Tail Round 4 + mov eax, DWORD PTR 16[edi] + mul eax + mov DWORD PTR 32[esi],eax + dec ebx + mov DWORD PTR 36[esi],edx + jz $L010sw_end + ; Tail Round 5 + mov eax, DWORD PTR 20[edi] + mul eax + mov DWORD PTR 40[esi],eax + dec ebx + mov DWORD PTR 44[esi],edx + jz $L010sw_end + ; Tail Round 6 + mov eax, DWORD PTR 24[edi] + mul eax + mov DWORD PTR 48[esi],eax + mov DWORD PTR 52[esi],edx +$L010sw_end: + pop edi + pop esi + pop ebx + pop ebp + ret +_bn_sqr_words ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _bn_div64 + +_bn_div64 PROC NEAR + push ebp + push ebx + push esi + push edi + mov edx, DWORD PTR 20[esp] + mov eax, DWORD PTR 24[esp] + mov ebx, DWORD PTR 28[esp] + div ebx + pop edi + pop esi + pop ebx + pop ebp + ret +_bn_div64 ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _bn_add_words + +_bn_add_words PROC NEAR + push ebp + push ebx + push esi + push edi + ; + mov ebx, DWORD PTR 20[esp] + mov esi, DWORD PTR 24[esp] + mov edi, DWORD PTR 28[esp] + mov ebp, DWORD PTR 32[esp] + xor eax, eax + and ebp, 4294967288 + jz $L011aw_finish +L012aw_loop: + ; Round 0 + mov ecx, DWORD PTR [esi] + mov edx, DWORD PTR [edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR [ebx],ecx + ; Round 1 + mov ecx, DWORD PTR 4[esi] + mov edx, DWORD PTR 4[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR 4[ebx],ecx + ; Round 2 + mov ecx, DWORD PTR 8[esi] + mov edx, DWORD PTR 8[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR 8[ebx],ecx + ; Round 3 + mov ecx, DWORD PTR 12[esi] + mov edx, DWORD PTR 12[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR 12[ebx],ecx + ; Round 4 + mov ecx, DWORD PTR 16[esi] + mov edx, DWORD PTR 16[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR 16[ebx],ecx + ; Round 5 + mov ecx, DWORD PTR 20[esi] + mov edx, DWORD PTR 20[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR 20[ebx],ecx + ; Round 6 + mov ecx, DWORD PTR 24[esi] + mov edx, DWORD PTR 24[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR 24[ebx],ecx + ; Round 7 + mov ecx, DWORD PTR 28[esi] + mov edx, DWORD PTR 28[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR 28[ebx],ecx + ; + add esi, 32 + add edi, 32 + add ebx, 32 + sub ebp, 8 + jnz L012aw_loop +$L011aw_finish: + mov ebp, DWORD PTR 32[esp] + and ebp, 7 + jz $L013aw_end + ; Tail Round 0 + mov ecx, DWORD PTR [esi] + mov edx, DWORD PTR [edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + dec ebp + mov DWORD PTR [ebx],ecx + jz $L013aw_end + ; Tail Round 1 + mov ecx, DWORD PTR 4[esi] + mov edx, DWORD PTR 4[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + dec ebp + mov DWORD PTR 4[ebx],ecx + jz $L013aw_end + ; Tail Round 2 + mov ecx, DWORD PTR 8[esi] + mov edx, DWORD PTR 8[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + dec ebp + mov DWORD PTR 8[ebx],ecx + jz $L013aw_end + ; Tail Round 3 + mov ecx, DWORD PTR 12[esi] + mov edx, DWORD PTR 12[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + dec ebp + mov DWORD PTR 12[ebx],ecx + jz $L013aw_end + ; Tail Round 4 + mov ecx, DWORD PTR 16[esi] + mov edx, DWORD PTR 16[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + dec ebp + mov DWORD PTR 16[ebx],ecx + jz $L013aw_end + ; Tail Round 5 + mov ecx, DWORD PTR 20[esi] + mov edx, DWORD PTR 20[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + dec ebp + mov DWORD PTR 20[ebx],ecx + jz $L013aw_end + ; Tail Round 6 + mov ecx, DWORD PTR 24[esi] + mov edx, DWORD PTR 24[edi] + add ecx, eax + mov eax, 0 + adc eax, eax + add ecx, edx + adc eax, 0 + mov DWORD PTR 24[ebx],ecx +$L013aw_end: + mov eax, eax + pop edi + pop esi + pop ebx + pop ebp + ret +_bn_add_words ENDP +_TEXT ENDS +END diff --git a/src/lib/libssl/src/crypto/bn/asm/bn86unix.cpp b/src/lib/libssl/src/crypto/bn/asm/bn86unix.cpp new file mode 100644 index 0000000000..64702201ea --- /dev/null +++ b/src/lib/libssl/src/crypto/bn/asm/bn86unix.cpp @@ -0,0 +1,752 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define bn_mul_add_words _bn_mul_add_words +#define bn_mul_words _bn_mul_words +#define bn_sqr_words _bn_sqr_words +#define bn_div64 _bn_div64 +#define bn_add_words _bn_add_words + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by bn-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "bn-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl bn_mul_add_words + TYPE(bn_mul_add_words,@function) +bn_mul_add_words: + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + + + xorl %esi, %esi + movl 20(%esp), %edi + movl 28(%esp), %ecx + movl 24(%esp), %ebx + andl $4294967288, %ecx + movl 32(%esp), %ebp + pushl %ecx + jz .L000maw_finish +.L001maw_loop: + movl %ecx, (%esp) + /* Round 0 */ + movl (%ebx), %eax + mull %ebp + addl %esi, %eax + movl (%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, (%edi) + movl %edx, %esi + /* Round 4 */ + movl 4(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 4(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, 4(%edi) + movl %edx, %esi + /* Round 8 */ + movl 8(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 8(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, 8(%edi) + movl %edx, %esi + /* Round 12 */ + movl 12(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 12(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, 12(%edi) + movl %edx, %esi + /* Round 16 */ + movl 16(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 16(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, 16(%edi) + movl %edx, %esi + /* Round 20 */ + movl 20(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 20(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, 20(%edi) + movl %edx, %esi + /* Round 24 */ + movl 24(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 24(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, 24(%edi) + movl %edx, %esi + /* Round 28 */ + movl 28(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 28(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, 28(%edi) + movl %edx, %esi + + movl (%esp), %ecx + addl $32, %ebx + addl $32, %edi + subl $8, %ecx + jnz .L001maw_loop +.L000maw_finish: + movl 32(%esp), %ecx + andl $7, %ecx + jnz .L002maw_finish2 + jmp .L003maw_end +.align ALIGN +.L002maw_finish2: + /* Tail Round 0 */ + movl (%ebx), %eax + mull %ebp + addl %esi, %eax + movl (%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + decl %ecx + movl %eax, (%edi) + movl %edx, %esi + jz .L003maw_end + /* Tail Round 1 */ + movl 4(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 4(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + decl %ecx + movl %eax, 4(%edi) + movl %edx, %esi + jz .L003maw_end + /* Tail Round 2 */ + movl 8(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 8(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + decl %ecx + movl %eax, 8(%edi) + movl %edx, %esi + jz .L003maw_end + /* Tail Round 3 */ + movl 12(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 12(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + decl %ecx + movl %eax, 12(%edi) + movl %edx, %esi + jz .L003maw_end + /* Tail Round 4 */ + movl 16(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 16(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + decl %ecx + movl %eax, 16(%edi) + movl %edx, %esi + jz .L003maw_end + /* Tail Round 5 */ + movl 20(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 20(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + decl %ecx + movl %eax, 20(%edi) + movl %edx, %esi + jz .L003maw_end + /* Tail Round 6 */ + movl 24(%ebx), %eax + mull %ebp + addl %esi, %eax + movl 24(%edi), %esi + adcl $0, %edx + addl %esi, %eax + adcl $0, %edx + movl %eax, 24(%edi) + movl %edx, %esi +.L003maw_end: + movl %esi, %eax + popl %ecx + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.bn_mul_add_words_end: + SIZE(bn_mul_add_words,.bn_mul_add_words_end-bn_mul_add_words) +.ident "bn_mul_add_words" +.text + .align ALIGN +.globl bn_mul_words + TYPE(bn_mul_words,@function) +bn_mul_words: + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + + + xorl %esi, %esi + movl 20(%esp), %edi + movl 24(%esp), %ebx + movl 28(%esp), %ebp + movl 32(%esp), %ecx + andl $4294967288, %ebp + jz .L004mw_finish +.L005mw_loop: + /* Round 0 */ + movl (%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, (%edi) + movl %edx, %esi + /* Round 4 */ + movl 4(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 4(%edi) + movl %edx, %esi + /* Round 8 */ + movl 8(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 8(%edi) + movl %edx, %esi + /* Round 12 */ + movl 12(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 12(%edi) + movl %edx, %esi + /* Round 16 */ + movl 16(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 16(%edi) + movl %edx, %esi + /* Round 20 */ + movl 20(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 20(%edi) + movl %edx, %esi + /* Round 24 */ + movl 24(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 24(%edi) + movl %edx, %esi + /* Round 28 */ + movl 28(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 28(%edi) + movl %edx, %esi + + addl $32, %ebx + addl $32, %edi + subl $8, %ebp + jz .L004mw_finish + jmp .L005mw_loop +.L004mw_finish: + movl 28(%esp), %ebp + andl $7, %ebp + jnz .L006mw_finish2 + jmp .L007mw_end +.align ALIGN +.L006mw_finish2: + /* Tail Round 0 */ + movl (%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, (%edi) + movl %edx, %esi + decl %ebp + jz .L007mw_end + /* Tail Round 1 */ + movl 4(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 4(%edi) + movl %edx, %esi + decl %ebp + jz .L007mw_end + /* Tail Round 2 */ + movl 8(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 8(%edi) + movl %edx, %esi + decl %ebp + jz .L007mw_end + /* Tail Round 3 */ + movl 12(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 12(%edi) + movl %edx, %esi + decl %ebp + jz .L007mw_end + /* Tail Round 4 */ + movl 16(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 16(%edi) + movl %edx, %esi + decl %ebp + jz .L007mw_end + /* Tail Round 5 */ + movl 20(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 20(%edi) + movl %edx, %esi + decl %ebp + jz .L007mw_end + /* Tail Round 6 */ + movl 24(%ebx), %eax + mull %ecx + addl %esi, %eax + adcl $0, %edx + movl %eax, 24(%edi) + movl %edx, %esi +.L007mw_end: + movl %esi, %eax + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.bn_mul_words_end: + SIZE(bn_mul_words,.bn_mul_words_end-bn_mul_words) +.ident "bn_mul_words" +.text + .align ALIGN +.globl bn_sqr_words + TYPE(bn_sqr_words,@function) +bn_sqr_words: + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + + + movl 20(%esp), %esi + movl 24(%esp), %edi + movl 28(%esp), %ebx + andl $4294967288, %ebx + jz .L008sw_finish +.L009sw_loop: + /* Round 0 */ + movl (%edi), %eax + mull %eax + movl %eax, (%esi) + movl %edx, 4(%esi) + /* Round 4 */ + movl 4(%edi), %eax + mull %eax + movl %eax, 8(%esi) + movl %edx, 12(%esi) + /* Round 8 */ + movl 8(%edi), %eax + mull %eax + movl %eax, 16(%esi) + movl %edx, 20(%esi) + /* Round 12 */ + movl 12(%edi), %eax + mull %eax + movl %eax, 24(%esi) + movl %edx, 28(%esi) + /* Round 16 */ + movl 16(%edi), %eax + mull %eax + movl %eax, 32(%esi) + movl %edx, 36(%esi) + /* Round 20 */ + movl 20(%edi), %eax + mull %eax + movl %eax, 40(%esi) + movl %edx, 44(%esi) + /* Round 24 */ + movl 24(%edi), %eax + mull %eax + movl %eax, 48(%esi) + movl %edx, 52(%esi) + /* Round 28 */ + movl 28(%edi), %eax + mull %eax + movl %eax, 56(%esi) + movl %edx, 60(%esi) + + addl $32, %edi + addl $64, %esi + subl $8, %ebx + jnz .L009sw_loop +.L008sw_finish: + movl 28(%esp), %ebx + andl $7, %ebx + jz .L010sw_end + /* Tail Round 0 */ + movl (%edi), %eax + mull %eax + movl %eax, (%esi) + decl %ebx + movl %edx, 4(%esi) + jz .L010sw_end + /* Tail Round 1 */ + movl 4(%edi), %eax + mull %eax + movl %eax, 8(%esi) + decl %ebx + movl %edx, 12(%esi) + jz .L010sw_end + /* Tail Round 2 */ + movl 8(%edi), %eax + mull %eax + movl %eax, 16(%esi) + decl %ebx + movl %edx, 20(%esi) + jz .L010sw_end + /* Tail Round 3 */ + movl 12(%edi), %eax + mull %eax + movl %eax, 24(%esi) + decl %ebx + movl %edx, 28(%esi) + jz .L010sw_end + /* Tail Round 4 */ + movl 16(%edi), %eax + mull %eax + movl %eax, 32(%esi) + decl %ebx + movl %edx, 36(%esi) + jz .L010sw_end + /* Tail Round 5 */ + movl 20(%edi), %eax + mull %eax + movl %eax, 40(%esi) + decl %ebx + movl %edx, 44(%esi) + jz .L010sw_end + /* Tail Round 6 */ + movl 24(%edi), %eax + mull %eax + movl %eax, 48(%esi) + movl %edx, 52(%esi) +.L010sw_end: + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.bn_sqr_words_end: + SIZE(bn_sqr_words,.bn_sqr_words_end-bn_sqr_words) +.ident "bn_sqr_words" +.text + .align ALIGN +.globl bn_div64 + TYPE(bn_div64,@function) +bn_div64: + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + + movl 20(%esp), %edx + movl 24(%esp), %eax + movl 28(%esp), %ebx + divl %ebx + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.bn_div64_end: + SIZE(bn_div64,.bn_div64_end-bn_div64) +.ident "bn_div64" +.text + .align ALIGN +.globl bn_add_words + TYPE(bn_add_words,@function) +bn_add_words: + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + + + movl 20(%esp), %ebx + movl 24(%esp), %esi + movl 28(%esp), %edi + movl 32(%esp), %ebp + xorl %eax, %eax + andl $4294967288, %ebp + jz .L011aw_finish +.L012aw_loop: + /* Round 0 */ + movl (%esi), %ecx + movl (%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, (%ebx) + /* Round 1 */ + movl 4(%esi), %ecx + movl 4(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, 4(%ebx) + /* Round 2 */ + movl 8(%esi), %ecx + movl 8(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, 8(%ebx) + /* Round 3 */ + movl 12(%esi), %ecx + movl 12(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, 12(%ebx) + /* Round 4 */ + movl 16(%esi), %ecx + movl 16(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, 16(%ebx) + /* Round 5 */ + movl 20(%esi), %ecx + movl 20(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, 20(%ebx) + /* Round 6 */ + movl 24(%esi), %ecx + movl 24(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, 24(%ebx) + /* Round 7 */ + movl 28(%esi), %ecx + movl 28(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, 28(%ebx) + + addl $32, %esi + addl $32, %edi + addl $32, %ebx + subl $8, %ebp + jnz .L012aw_loop +.L011aw_finish: + movl 32(%esp), %ebp + andl $7, %ebp + jz .L013aw_end + /* Tail Round 0 */ + movl (%esi), %ecx + movl (%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + decl %ebp + movl %ecx, (%ebx) + jz .L013aw_end + /* Tail Round 1 */ + movl 4(%esi), %ecx + movl 4(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + decl %ebp + movl %ecx, 4(%ebx) + jz .L013aw_end + /* Tail Round 2 */ + movl 8(%esi), %ecx + movl 8(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + decl %ebp + movl %ecx, 8(%ebx) + jz .L013aw_end + /* Tail Round 3 */ + movl 12(%esi), %ecx + movl 12(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + decl %ebp + movl %ecx, 12(%ebx) + jz .L013aw_end + /* Tail Round 4 */ + movl 16(%esi), %ecx + movl 16(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + decl %ebp + movl %ecx, 16(%ebx) + jz .L013aw_end + /* Tail Round 5 */ + movl 20(%esi), %ecx + movl 20(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + decl %ebp + movl %ecx, 20(%ebx) + jz .L013aw_end + /* Tail Round 6 */ + movl 24(%esi), %ecx + movl 24(%edi), %edx + addl %eax, %ecx + movl $0, %eax + adcl %eax, %eax + addl %edx, %ecx + adcl $0, %eax + movl %ecx, 24(%ebx) +.L013aw_end: + movl %eax, %eax + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.bn_add_words_end: + SIZE(bn_add_words,.bn_add_words_end-bn_add_words) +.ident "bn_add_words" diff --git a/src/lib/libssl/src/crypto/bn/asm/sparc.s b/src/lib/libssl/src/crypto/bn/asm/sparc.s new file mode 100644 index 0000000000..f9e533caa8 --- /dev/null +++ b/src/lib/libssl/src/crypto/bn/asm/sparc.s @@ -0,0 +1,462 @@ + .file "bn_mulw.c" +gcc2_compiled.: +.section ".text" + .align 4 + .global bn_mul_add_words + .type bn_mul_add_words,#function + .proc 016 +bn_mul_add_words: + !#PROLOGUE# 0 + save %sp,-112,%sp + !#PROLOGUE# 1 + mov %i0,%o0 + mov %i1,%o2 + mov %i2,%g1 + mov %i3,%o1 + mov 0,%i4 + add %o0,12,%g4 + add %o2,12,%o7 +.LL2: + mov %i4,%i3 + mov 0,%i2 + ld [%o0],%g2 + mov %g2,%i1 + ld [%o2],%g2 + mov 0,%i0 + umul %o1,%g2,%g3 + rd %y,%g2 + addcc %g3,%i1,%g3 + addx %g2,%i0,%g2 + addcc %g3,%i3,%g3 + addx %g2,%i2,%g2 + st %g3,[%o0] + mov %g2,%i5 + mov 0,%i4 + addcc %g1,-1,%g1 + be .LL3 + mov %i5,%i4 + mov %i4,%i3 + mov 0,%i2 + ld [%g4-8],%g2 + mov %g2,%i1 + ld [%o7-8],%g2 + mov 0,%i0 + umul %o1,%g2,%g3 + rd %y,%g2 + addcc %g3,%i1,%g3 + addx %g2,%i0,%g2 + addcc %g3,%i3,%g3 + addx %g2,%i2,%g2 + st %g3,[%g4-8] + mov %g2,%i5 + mov 0,%i4 + addcc %g1,-1,%g1 + be .LL3 + mov %i5,%i4 + mov %i4,%i3 + mov 0,%i2 + ld [%g4-4],%g2 + mov %g2,%i1 + ld [%o7-4],%g2 + mov 0,%i0 + umul %o1,%g2,%g3 + rd %y,%g2 + addcc %g3,%i1,%g3 + addx %g2,%i0,%g2 + addcc %g3,%i3,%g3 + addx %g2,%i2,%g2 + st %g3,[%g4-4] + mov %g2,%i5 + mov 0,%i4 + addcc %g1,-1,%g1 + be .LL3 + mov %i5,%i4 + mov %i4,%i3 + mov 0,%i2 + ld [%g4],%g2 + mov %g2,%i1 + ld [%o7],%g2 + mov 0,%i0 + umul %o1,%g2,%g3 + rd %y,%g2 + addcc %g3,%i1,%g3 + addx %g2,%i0,%g2 + addcc %g3,%i3,%g3 + addx %g2,%i2,%g2 + st %g3,[%g4] + mov %g2,%i5 + mov 0,%i4 + addcc %g1,-1,%g1 + be .LL3 + mov %i5,%i4 + add %o7,16,%o7 + add %o2,16,%o2 + add %g4,16,%g4 + b .LL2 + add %o0,16,%o0 +.LL3: + ret + restore %g0,%i4,%o0 +.LLfe1: + .size bn_mul_add_words,.LLfe1-bn_mul_add_words + .align 4 + .global bn_mul_words + .type bn_mul_words,#function + .proc 016 +bn_mul_words: + !#PROLOGUE# 0 + save %sp,-112,%sp + !#PROLOGUE# 1 + mov %i0,%o7 + mov %i1,%o0 + mov %i2,%i4 + mov %i3,%g4 + mov 0,%i0 + add %o7,12,%g1 + add %o0,12,%i5 +.LL18: + mov %i0,%g3 + mov 0,%g2 + ld [%o0],%i2 + umul %g4,%i2,%i3 + rd %y,%i2 + addcc %i3,%g3,%i3 + addx %i2,%g2,%i2 + st %i3,[%o7] + mov %i2,%i1 + mov 0,%i0 + addcc %i4,-1,%i4 + be .LL19 + mov %i1,%i0 + mov %i0,%g3 + mov 0,%g2 + ld [%i5-8],%i2 + umul %g4,%i2,%i3 + rd %y,%i2 + addcc %i3,%g3,%i3 + addx %i2,%g2,%i2 + st %i3,[%g1-8] + mov %i2,%i1 + mov 0,%i0 + addcc %i4,-1,%i4 + be .LL19 + mov %i1,%i0 + mov %i0,%g3 + mov 0,%g2 + ld [%i5-4],%i2 + umul %g4,%i2,%i3 + rd %y,%i2 + addcc %i3,%g3,%i3 + addx %i2,%g2,%i2 + st %i3,[%g1-4] + mov %i2,%i1 + mov 0,%i0 + addcc %i4,-1,%i4 + be .LL19 + mov %i1,%i0 + mov %i0,%g3 + mov 0,%g2 + ld [%i5],%i2 + umul %g4,%i2,%i3 + rd %y,%i2 + addcc %i3,%g3,%i3 + addx %i2,%g2,%i2 + st %i3,[%g1] + mov %i2,%i1 + mov 0,%i0 + addcc %i4,-1,%i4 + be .LL19 + mov %i1,%i0 + add %i5,16,%i5 + add %o0,16,%o0 + add %g1,16,%g1 + b .LL18 + add %o7,16,%o7 +.LL19: + ret + restore +.LLfe2: + .size bn_mul_words,.LLfe2-bn_mul_words + .align 4 + .global bn_sqr_words + .type bn_sqr_words,#function + .proc 020 +bn_sqr_words: + !#PROLOGUE# 0 + !#PROLOGUE# 1 + mov %o0,%g4 + add %g4,28,%o3 + add %o1,12,%g1 +.LL34: + ld [%o1],%o0 + addcc %o2,-1,%o2 + umul %o0,%o0,%o5 + rd %y,%o4 + st %o5,[%g4] + mov %o4,%g3 + mov 0,%g2 + be .LL35 + st %g3,[%o3-24] + ld [%g1-8],%o0 + addcc %o2,-1,%o2 + umul %o0,%o0,%o5 + rd %y,%o4 + st %o5,[%o3-20] + mov %o4,%g3 + mov 0,%g2 + be .LL35 + st %g3,[%o3-16] + ld [%g1-4],%o0 + addcc %o2,-1,%o2 + umul %o0,%o0,%o5 + rd %y,%o4 + st %o5,[%o3-12] + mov %o4,%g3 + mov 0,%g2 + be .LL35 + st %g3,[%o3-8] + ld [%g1],%o0 + addcc %o2,-1,%o2 + umul %o0,%o0,%o5 + rd %y,%o4 + st %o5,[%o3-4] + mov %o4,%g3 + mov 0,%g2 + be .LL35 + st %g3,[%o3] + add %g1,16,%g1 + add %o1,16,%o1 + add %o3,32,%o3 + b .LL34 + add %g4,32,%g4 +.LL35: + retl + nop +.LLfe3: + .size bn_sqr_words,.LLfe3-bn_sqr_words + .align 4 + .global bn_add_words + .type bn_add_words,#function + .proc 016 +bn_add_words: + !#PROLOGUE# 0 + save %sp,-112,%sp + !#PROLOGUE# 1 + mov %i0,%o2 + mov %i1,%o3 + mov %i2,%o4 + mov %i3,%i5 + mov 0,%o0 + mov 0,%o1 + add %o2,12,%o7 + add %o4,12,%g4 + b .LL42 + add %o3,12,%g1 +.LL45: + add %i5,-1,%i5 + mov %i4,%g3 + ld [%g4-8],%i4 + mov 0,%g2 + mov %i4,%i1 + mov 0,%i0 + addcc %g3,%i1,%g3 + addx %g2,%i0,%g2 + addcc %o1,%g3,%o1 + addx %o0,%g2,%o0 + st %o1,[%o7-8] + mov %o0,%i3 + mov 0,%i2 + mov %i2,%o0 + mov %i3,%o1 + cmp %i5,0 + ble .LL43 + add %i5,-1,%i5 + ld [%g1-4],%i4 + mov %i4,%g3 + ld [%g4-4],%i4 + mov 0,%g2 + mov %i4,%i1 + mov 0,%i0 + addcc %g3,%i1,%g3 + addx %g2,%i0,%g2 + addcc %o1,%g3,%o1 + addx %o0,%g2,%o0 + st %o1,[%o7-4] + mov %o0,%i3 + mov 0,%i2 + mov %i2,%o0 + mov %i3,%o1 + cmp %i5,0 + ble .LL43 + add %i5,-1,%i5 + ld [%g1],%i4 + mov %i4,%g3 + ld [%g4],%i4 + mov 0,%g2 + mov %i4,%i1 + mov 0,%i0 + addcc %g3,%i1,%g3 + addx %g2,%i0,%g2 + addcc %o1,%g3,%o1 + addx %o0,%g2,%o0 + st %o1,[%o7] + mov %o0,%i3 + mov 0,%i2 + mov %i2,%o0 + mov %i3,%o1 + cmp %i5,0 + ble .LL43 + add %g1,16,%g1 + add %o3,16,%o3 + add %g4,16,%g4 + add %o4,16,%o4 + add %o7,16,%o7 + add %o2,16,%o2 +.LL42: + ld [%o3],%i4 + add %i5,-1,%i5 + mov %i4,%g3 + ld [%o4],%i4 + mov 0,%g2 + mov %i4,%i1 + mov 0,%i0 + addcc %g3,%i1,%g3 + addx %g2,%i0,%g2 + addcc %o1,%g3,%o1 + addx %o0,%g2,%o0 + st %o1,[%o2] + mov %o0,%i3 + mov 0,%i2 + mov %i2,%o0 + mov %i3,%o1 + cmp %i5,0 + bg,a .LL45 + ld [%g1-8],%i4 +.LL43: + ret + restore %g0,%o1,%o0 +.LLfe4: + .size bn_add_words,.LLfe4-bn_add_words +.section ".rodata" + .align 8 +.LLC0: + .asciz "Division would overflow (%d)\n" +.section ".text" + .align 4 + .global bn_div64 + .type bn_div64,#function + .proc 016 +bn_div64: + !#PROLOGUE# 0 + save %sp,-112,%sp + !#PROLOGUE# 1 + mov 0,%l1 + cmp %i2,0 + bne .LL51 + mov 2,%l0 + b .LL68 + mov -1,%i0 +.LL51: + call BN_num_bits_word,0 + mov %i2,%o0 + mov %o0,%o2 + cmp %o2,32 + be .LL52 + mov 1,%o0 + sll %o0,%o2,%o0 + cmp %i0,%o0 + bleu .LL69 + mov 32,%o0 + sethi %hi(__iob+32),%o0 + or %o0,%lo(__iob+32),%o0 + sethi %hi(.LLC0),%o1 + call fprintf,0 + or %o1,%lo(.LLC0),%o1 + call abort,0 + nop +.LL52: + mov 32,%o0 +.LL69: + cmp %i0,%i2 + blu .LL53 + sub %o0,%o2,%o2 + sub %i0,%i2,%i0 +.LL53: + cmp %o2,0 + be .LL54 + sll %i0,%o2,%o1 + sll %i2,%o2,%i2 + sub %o0,%o2,%o0 + srl %i1,%o0,%o0 + or %o1,%o0,%i0 + sll %i1,%o2,%i1 +.LL54: + srl %i2,16,%g2 + sethi %hi(65535),%o0 + or %o0,%lo(65535),%o1 + and %i2,%o1,%g3 + mov %o0,%g4 + sethi %hi(-65536),%o7 + mov %o1,%g1 +.LL55: + srl %i0,16,%o0 + cmp %o0,%g2 + be .LL59 + or %g4,%lo(65535),%o3 + wr %g0,%g0,%y + nop + nop + nop + udiv %i0,%g2,%o3 +.LL59: + and %i1,%o7,%o0 + srl %o0,16,%o5 + smul %o3,%g3,%o4 + smul %o3,%g2,%o2 +.LL60: + sub %i0,%o2,%o1 + andcc %o1,%o7,%g0 + bne .LL61 + sll %o1,16,%o0 + add %o0,%o5,%o0 + cmp %o4,%o0 + bleu .LL61 + sub %o4,%g3,%o4 + sub %o2,%g2,%o2 + b .LL60 + add %o3,-1,%o3 +.LL61: + smul %o3,%g2,%o2 + smul %o3,%g3,%o0 + srl %o0,16,%o1 + sll %o0,16,%o0 + and %o0,%o7,%o0 + cmp %i1,%o0 + bgeu .LL65 + add %o2,%o1,%o2 + add %o2,1,%o2 +.LL65: + cmp %i0,%o2 + bgeu .LL66 + sub %i1,%o0,%i1 + add %i0,%i2,%i0 + add %o3,-1,%o3 +.LL66: + addcc %l0,-1,%l0 + be .LL56 + sub %i0,%o2,%i0 + sll %o3,16,%l1 + sll %i0,16,%o0 + srl %i1,16,%o1 + or %o0,%o1,%i0 + and %i1,%g1,%o0 + b .LL55 + sll %o0,16,%i1 +.LL56: + or %l1,%o3,%i0 +.LL68: + ret + restore +.LLfe5: + .size bn_div64,.LLfe5-bn_div64 + .ident "GCC: (GNU) 2.7.2.3" diff --git a/src/lib/libssl/src/crypto/bn/asm/x86w16.asm b/src/lib/libssl/src/crypto/bn/asm/x86w16.asm new file mode 100644 index 0000000000..74a933a8cd --- /dev/null +++ b/src/lib/libssl/src/crypto/bn/asm/x86w16.asm @@ -0,0 +1,297 @@ +; Static Name Aliases +; + TITLE bn_mulw.c + .8087 +F_TEXT SEGMENT WORD PUBLIC 'CODE' +F_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS +DGROUP GROUP CONST, _BSS, _DATA + ASSUME DS: DGROUP, SS: DGROUP +F_TEXT SEGMENT + ASSUME CS: F_TEXT + PUBLIC _bn_mul_add_words +_bn_mul_add_words PROC FAR +; Line 58 + push bp + push bx + push si + push di + push ds + push es + mov bp,sp +; w = 26 +; num = 24 +; ap = 20 +; rp = 16 + xor si,si ;c=0; + mov di,WORD PTR [bp+16] ; load r + mov ds,WORD PTR [bp+18] ; load r + mov bx,WORD PTR [bp+20] ; load a + mov es,WORD PTR [bp+22] ; load a + mov cx,WORD PTR [bp+26] ; load w + mov bp,WORD PTR [bp+24] ; load num + + shr bp,1 ; div count by 4 and do groups of 4 + shr bp,1 + je $L555 + +$L546: + mov ax,cx + mul WORD PTR es:[bx] ; w* *a + add ax,WORD PTR ds:[di] ; + *r + adc dx,0 + adc ax,si + adc dx,0 + mov WORD PTR ds:[di],ax + mov si,dx + ; + mov ax,cx + mul WORD PTR es:[bx+2] ; w* *a + add ax,WORD PTR ds:[di+2] ; + *r + adc dx,0 + adc ax,si + adc dx,0 + mov WORD PTR ds:[di+2],ax + mov si,dx + ; + mov ax,cx + mul WORD PTR es:[bx+4] ; w* *a + add ax,WORD PTR ds:[di+4] ; + *r + adc dx,0 + adc ax,si + adc dx,0 + mov WORD PTR ds:[di+4],ax + mov si,dx + ; + mov ax,cx + mul WORD PTR es:[bx+6] ; w* *a + add ax,WORD PTR ds:[di+6] ; + *r + adc dx,0 + adc ax,si + adc dx,0 + mov WORD PTR ds:[di+6],ax + mov si,dx + ; + add bx,8 + add di,8 + ; + dec bp + je $L555 + jmp $L546 +; +; +$L555: + mov bp,sp + mov bp,WORD PTR [bp+24] ; load num + and bp,3 + dec bp + js $L547 + + mov ax,cx + mul WORD PTR es:[bx] ; w* *a + add ax,WORD PTR ds:[di] ; + *r + adc dx,0 + adc ax,si + adc dx,0 + mov WORD PTR ds:[di],ax + mov si,dx + dec bp + js $L547 ; Note that we are now testing for -1 + ; + mov ax,cx + mul WORD PTR es:[bx+2] ; w* *a + add ax,WORD PTR ds:[di+2] ; + *r + adc dx,0 + adc ax,si + adc dx,0 + mov WORD PTR ds:[di+2],ax + mov si,dx + dec bp + js $L547 + ; + mov ax,cx + mul WORD PTR es:[bx+4] ; w* *a + add ax,WORD PTR ds:[di+4] ; + *r + adc dx,0 + adc ax,si + adc dx,0 + mov WORD PTR ds:[di+4],ax + mov si,dx +$L547: + mov ax,si + pop es + pop ds + pop di + pop si + pop bx + pop bp + ret + nop + +_bn_mul_add_words ENDP + PUBLIC _bn_mul_words +_bn_mul_words PROC FAR +; Line 76 + push bp + push bx + push si + push di + push ds + push es + xor si,si + mov bp,sp + mov di,WORD PTR [bp+16] ; r + mov ds,WORD PTR [bp+18] + mov bx,WORD PTR [bp+20] ; a + mov es,WORD PTR [bp+22] + mov cx,WORD PTR [bp+26] ; w + mov bp,WORD PTR [bp+24] ; num +$FC743: + mov ax,cx + mul WORD PTR es:[bx] + add ax,si + adc dx,0 + mov WORD PTR ds:[di],ax + mov si,dx + dec bp + je $L764 + ; + mov ax,cx + mul WORD PTR es:[bx+2] + add ax,si + adc dx,0 + mov WORD PTR ds:[di+2],ax + mov si,dx + dec bp + je $L764 + ; + mov ax,cx + mul WORD PTR es:[bx+4] + add ax,si + adc dx,0 + mov WORD PTR ds:[di+4],ax + mov si,dx + dec bp + je $L764 + ; + mov ax,cx + mul WORD PTR es:[bx+6] + add ax,si + adc dx,0 + mov WORD PTR ds:[di+6],ax + mov si,dx + dec bp + je $L764 + ; + add bx,8 + add di,8 + jmp $FC743 + nop +$L764: + mov ax,si + pop es + pop ds + pop di + pop si + pop bx + pop bp + ret + nop +_bn_mul_words ENDP + PUBLIC _bn_sqr_words +_bn_sqr_words PROC FAR +; Line 92 + push bp + push bx + push si + push di + push ds + push es + mov bp,sp + mov si,WORD PTR [bp+16] + mov ds,WORD PTR [bp+18] + mov di,WORD PTR [bp+20] + mov es,WORD PTR [bp+22] + mov bx,WORD PTR [bp+24] + + mov bp,bx ; save a memory lookup later + shr bx,1 ; div count by 4 and do groups of 4 + shr bx,1 + je $L666 + +$L765: + mov ax,WORD PTR es:[di] + mul ax + mov WORD PTR ds:[si],ax + mov WORD PTR ds:[si+2],dx + ; + mov ax,WORD PTR es:[di+2] + mul ax + mov WORD PTR ds:[si+4],ax + mov WORD PTR ds:[si+6],dx + ; + mov ax,WORD PTR es:[di+4] + mul ax + mov WORD PTR ds:[si+8],ax + mov WORD PTR ds:[si+10],dx + ; + mov ax,WORD PTR es:[di+6] + mul ax + mov WORD PTR ds:[si+12],ax + mov WORD PTR ds:[si+14],dx + ; + add di,8 + add si,16 + dec bx + je $L666 + jmp $L765 +$L666: + and bp,3 + dec bp ; The copied value of bx (num) + js $L645 + ; + mov ax,WORD PTR es:[di] + mul ax + mov WORD PTR ds:[si],ax + mov WORD PTR ds:[si+2],dx + dec bp + js $L645 + ; + mov ax,WORD PTR es:[di+2] + mul ax + mov WORD PTR ds:[si+4],ax + mov WORD PTR ds:[si+6],dx + dec bp + js $L645 + ; + mov ax,WORD PTR es:[di+4] + mul ax + mov WORD PTR ds:[si+8],ax + mov WORD PTR ds:[si+10],dx +$L645: + pop es + pop ds + pop di + pop si + pop bx + pop bp + ret + +_bn_sqr_words ENDP + PUBLIC _bn_div64 +_bn_div64 PROC FAR + push bp + mov bp,sp + mov dx, WORD PTR [bp+6] + mov ax, WORD PTR [bp+8] + div WORD PTR [bp+10] + pop bp + ret +_bn_div64 ENDP +F_TEXT ENDS +END diff --git a/src/lib/libssl/src/crypto/bn/asm/x86w32.asm b/src/lib/libssl/src/crypto/bn/asm/x86w32.asm new file mode 100644 index 0000000000..fc6f917714 --- /dev/null +++ b/src/lib/libssl/src/crypto/bn/asm/x86w32.asm @@ -0,0 +1,362 @@ +; Static Name Aliases +; + TITLE bn_mulw.c + .386 +F_TEXT SEGMENT WORD USE16 PUBLIC 'CODE' +F_TEXT ENDS +_DATA SEGMENT WORD USE16 PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD USE16 PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD USE16 PUBLIC 'BSS' +_BSS ENDS +DGROUP GROUP CONST, _BSS, _DATA + ASSUME DS: DGROUP, SS: DGROUP +F_TEXT SEGMENT + ASSUME CS: F_TEXT + PUBLIC _bn_mul_add_words +_bn_mul_add_words PROC FAR +; Line 58 + push bp + push bx + push esi + push di + push ds + push es + mov bp,sp +; w = 28 +; num = 26 +; ap = 22 +; rp = 18 + xor esi,esi ;c=0; + mov di,WORD PTR [bp+18] ; load r + mov ds,WORD PTR [bp+20] ; load r + mov bx,WORD PTR [bp+22] ; load a + mov es,WORD PTR [bp+24] ; load a + mov ecx,DWORD PTR [bp+28] ; load w + mov bp,WORD PTR [bp+26] ; load num + shr bp,1 ; div count by 4 and do groups of 4 + shr bp,1 + je $L555 + +$L546: + mov eax,ecx + mul DWORD PTR es:[bx] ; w* *a + add eax,DWORD PTR ds:[di] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di],eax + mov esi,edx + ; + mov eax,ecx + mul DWORD PTR es:[bx+4] ; w* *a + add eax,DWORD PTR ds:[di+4] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di+4],eax + mov esi,edx + ; + mov eax,ecx + mul DWORD PTR es:[bx+8] ; w* *a + add eax,DWORD PTR ds:[di+8] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di+8],eax + mov esi,edx + ; + mov eax,ecx + mul DWORD PTR es:[bx+12] ; w* *a + add eax,DWORD PTR ds:[di+12] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di+12],eax + mov esi,edx + ; + add bx,16 + add di,16 + ; + dec bp + je $L555 + jmp $L546 +; +; +$L555: + mov bp,sp + mov bp,WORD PTR [bp+26] ; load num + and bp,3 + dec bp + js $L547 + + mov eax,ecx + mul DWORD PTR es:[bx] ; w* *a + add eax,DWORD PTR ds:[di] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di],eax + mov esi,edx + dec bp + js $L547 ; Note that we are now testing for -1 + ; + mov eax,ecx + mul DWORD PTR es:[bx+4] ; w* *a + add eax,DWORD PTR ds:[di+4] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di+4],eax + mov esi,edx + dec bp + js $L547 + ; + mov eax,ecx + mul DWORD PTR es:[bx+8] ; w* *a + add eax,DWORD PTR ds:[di+8] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di+8],eax + mov esi,edx +$L547: + mov eax,esi + mov edx,esi + shr edx,16 + pop es + pop ds + pop di + pop esi + pop bx + pop bp + ret + nop +_bn_mul_add_words ENDP + + PUBLIC _bn_mul_words +_bn_mul_words PROC FAR +; Line 76 + push bp + push bx + push esi + push di + push ds + push es + xor esi,esi + mov bp,sp + mov di,WORD PTR [bp+18] ; r + mov ds,WORD PTR [bp+20] + mov bx,WORD PTR [bp+22] ; a + mov es,WORD PTR [bp+24] + mov ecx,DWORD PTR [bp+28] ; w + mov bp,WORD PTR [bp+26] ; num + +$FC743: + mov eax,ecx + mul DWORD PTR es:[bx] + add eax,esi + adc edx,0 + mov DWORD PTR ds:[di],eax + mov esi,edx + dec bp + je $L764 + ; + mov eax,ecx + mul DWORD PTR es:[bx+4] + add eax,esi + adc edx,0 + mov DWORD PTR ds:[di+4],eax + mov esi,edx + dec bp + je $L764 + ; + mov eax,ecx + mul DWORD PTR es:[bx+8] + add eax,esi + adc edx,0 + mov DWORD PTR ds:[di+8],eax + mov esi,edx + dec bp + je $L764 + ; + mov eax,ecx + mul DWORD PTR es:[bx+12] + add eax,esi + adc edx,0 + mov DWORD PTR ds:[di+12],eax + mov esi,edx + dec bp + je $L764 + ; + add bx,16 + add di,16 + jmp $FC743 + nop +$L764: + mov eax,esi + mov edx,esi + shr edx,16 + pop es + pop ds + pop di + pop esi + pop bx + pop bp + ret + nop +_bn_mul_words ENDP + PUBLIC _bn_sqr_words +_bn_sqr_words PROC FAR +; Line 92 + push bp + push bx + push si + push di + push ds + push es + mov bp,sp + mov si,WORD PTR [bp+16] + mov ds,WORD PTR [bp+18] + mov di,WORD PTR [bp+20] + mov es,WORD PTR [bp+22] + mov bx,WORD PTR [bp+24] + + mov bp,bx ; save a memory lookup later + shr bx,1 ; div count by 4 and do groups of 4 + shr bx,1 + je $L666 + +$L765: + mov eax,DWORD PTR es:[di] + mul eax + mov DWORD PTR ds:[si],eax + mov DWORD PTR ds:[si+4],edx + ; + mov eax,DWORD PTR es:[di+4] + mul eax + mov DWORD PTR ds:[si+8],eax + mov DWORD PTR ds:[si+12],edx + ; + mov eax,DWORD PTR es:[di+8] + mul eax + mov DWORD PTR ds:[si+16],eax + mov DWORD PTR ds:[si+20],edx + ; + mov eax,DWORD PTR es:[di+12] + mul eax + mov DWORD PTR ds:[si+24],eax + mov DWORD PTR ds:[si+28],edx + ; + add di,16 + add si,32 + dec bx + je $L666 + jmp $L765 +$L666: + and bp,3 + dec bp ; The copied value of bx (num) + js $L645 + ; + mov eax,DWORD PTR es:[di] + mul eax + mov DWORD PTR ds:[si],eax + mov DWORD PTR ds:[si+4],edx + dec bp + js $L645 + ; + mov eax,DWORD PTR es:[di+4] + mul eax + mov DWORD PTR ds:[si+8],eax + mov DWORD PTR ds:[si+12],edx + dec bp + js $L645 + ; + mov eax,DWORD PTR es:[di+8] + mul eax + mov DWORD PTR ds:[si+16],eax + mov DWORD PTR ds:[si+20],edx +$L645: + pop es + pop ds + pop di + pop si + pop bx + pop bp + ret +_bn_sqr_words ENDP + + PUBLIC _bn_div64 +_bn_div64 PROC FAR + push bp + mov bp,sp + mov edx, DWORD PTR [bp+6] + mov eax, DWORD PTR [bp+10] + div DWORD PTR [bp+14] + mov edx,eax + shr edx,16 + pop bp + ret +_bn_div64 ENDP + + PUBLIC _bn_add_words +_bn_add_words PROC FAR +; Line 58 + push bp + push bx + push esi + push di + push ds + push es + mov bp,sp +; w = 28 +; num = 26 +; ap = 22 +; rp = 18 + xor esi,esi ;c=0; + mov si,WORD PTR [bp+22] ; load a + mov es,WORD PTR [bp+24] ; load a + mov di,WORD PTR [bp+26] ; load b + mov ds,WORD PTR [bp+28] ; load b + + mov dx,WORD PTR [bp+30] ; load num + dec dx + js $L547 + xor ecx,ecx + +$L5477: + xor ebx,ebx + mov eax,DWORD PTR es:[si] ; *a + add eax,ecx + adc ebx,0 + add si,4 ; a++ + add eax,DWORD PTR ds:[di] ; + *b + mov ecx,ebx + adc ecx,0 + add di,4 + mov bx,WORD PTR [bp+18] + mov ds,WORD PTR [bp+20] + mov DWORD PTR ds:[bx],eax + add bx,4 + mov ds,WORD PTR [bp+28] + mov WORD PTR [bp+18],bx + dec dx + js $L547 ; Note that we are now testing for -1 + jmp $L5477 + ; +$L547: + mov eax,ecx + mov edx,ecx + shr edx,16 + pop es + pop ds + pop di + pop esi + pop bx + pop bp + ret + nop +_bn_add_words ENDP +F_TEXT ENDS +END diff --git a/src/lib/libssl/src/crypto/bn/bn.err b/src/lib/libssl/src/crypto/bn/bn.err new file mode 100644 index 0000000000..7ccc247c41 --- /dev/null +++ b/src/lib/libssl/src/crypto/bn/bn.err @@ -0,0 +1,27 @@ +/* Error codes for the BN functions. */ + +/* Function codes. */ +#define BN_F_BN_BLINDING_CONVERT 100 +#define BN_F_BN_BLINDING_INVERT 101 +#define BN_F_BN_BLINDING_NEW 102 +#define BN_F_BN_BLINDING_UPDATE 103 +#define BN_F_BN_BN2DEC 104 +#define BN_F_BN_BN2HEX 105 +#define BN_F_BN_CTX_NEW 106 +#define BN_F_BN_DIV 107 +#define BN_F_BN_EXPAND2 108 +#define BN_F_BN_MOD_EXP_MONT 109 +#define BN_F_BN_MOD_INVERSE 110 +#define BN_F_BN_MOD_MUL_RECIPROCAL 111 +#define BN_F_BN_MPI2BN 112 +#define BN_F_BN_NEW 113 +#define BN_F_BN_RAND 114 + +/* Reason codes. */ +#define BN_R_BAD_RECIPROCAL 100 +#define BN_R_CALLED_WITH_EVEN_MODULUS 101 +#define BN_R_DIV_BY_ZERO 102 +#define BN_R_ENCODING_ERROR 103 +#define BN_R_INVALID_LENGTH 104 +#define BN_R_NOT_INITALISED 105 +#define BN_R_NO_INVERSE 106 diff --git a/src/lib/libssl/src/crypto/bn/bn.org b/src/lib/libssl/src/crypto/bn/bn.org new file mode 100644 index 0000000000..66dde285d6 --- /dev/null +++ b/src/lib/libssl/src/crypto/bn/bn.org @@ -0,0 +1,502 @@ +/* crypto/bn/bn.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify bn.org since bn.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +#ifndef HEADER_BN_H +#define HEADER_BN_H + +#ifdef __cplusplus +extern "C" { +#endif + +#undef BN_LLONG + +#ifdef WIN32 +#define BN_LLONG /* This comment stops Configure mutilating things */ +#endif + +#define RECP_MUL_MOD +#define MONT_MUL_MOD + +/* This next option uses the C libraries (2 word)/(1 word) function. + * If it is not defined, I use my C version (which is slower). + * The reason for this flag is that when the particular C compiler + * library routine is used, and the library is linked with a different + * compiler, the library is missing. This mostly happens when the + * library is built with gcc and then linked using nornal cc. This would + * be a common occurance because gcc normally produces code that is + * 2 times faster than system compilers for the big number stuff. + * For machines with only one compiler (or shared libraries), this should + * be on. Again this in only really a problem on machines + * using "long long's", are 32bit, and are not using my assember code. */ +#if defined(MSDOS) || defined(WINDOWS) || defined(linux) +#define BN_DIV2W +#endif + +/* Only one for the following should be defined */ +/* The prime number generation stuff may not work when + * EIGHT_BIT but I don't care since I've only used this mode + * for debuging the bignum libraries */ +#undef SIXTY_FOUR_BIT_LONG +#undef SIXTY_FOUR_BIT +#define THIRTY_TWO_BIT +#undef SIXTEEN_BIT +#undef EIGHT_BIT + +/* assuming long is 64bit - this is the DEC Alpha + * unsigned long long is only 64 bits :-(, don't define + * BN_LLONG for the DEC Alpha */ +#ifdef SIXTY_FOUR_BIT_LONG +#define BN_ULLONG unsigned long long +#define BN_ULONG unsigned long +#define BN_LONG long +#define BN_BITS 128 +#define BN_BYTES 8 +#define BN_BITS2 64 +#define BN_BITS4 32 +#define BN_MASK2 (0xffffffffffffffffL) +#define BN_MASK2l (0xffffffffL) +#define BN_MASK2h (0xffffffff00000000L) +#define BN_MASK2h1 (0xffffffff80000000L) +#define BN_TBIT (0x8000000000000000L) +#define BN_DEC_CONV (10000000000000000000L) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%019lu" +#define BN_DEC_NUM 19 +#endif + +#ifdef SIXTY_FOUR_BIT +#undef BN_LLONG +/* #define BN_ULLONG unsigned long long */ +#define BN_ULONG unsigned long long +#define BN_LONG long long +#define BN_BITS 128 +#define BN_BYTES 8 +#define BN_BITS2 64 +#define BN_BITS4 32 +#define BN_MASK2 (0xffffffffffffffffLL) +#define BN_MASK2l (0xffffffffL) +#define BN_MASK2h (0xffffffff00000000LL) +#define BN_MASK2h1 (0xffffffff80000000LL) +#define BN_TBIT (0x8000000000000000LL) +#define BN_DEC_CONV (10000000000000000000L) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%019lu" +#define BN_DEC_NUM 19 +#endif + +#ifdef THIRTY_TWO_BIT +#ifdef WIN32 +#define BN_ULLONG unsigned _int64 +#else +#define BN_ULLONG unsigned long long +#endif +#define BN_ULONG unsigned long +#define BN_LONG long +#define BN_BITS 64 +#define BN_BYTES 4 +#define BN_BITS2 32 +#define BN_BITS4 16 +#define BN_MASK2 (0xffffffffL) +#define BN_MASK2l (0xffff) +#define BN_MASK2h1 (0xffff8000L) +#define BN_MASK2h (0xffff0000L) +#define BN_TBIT (0x80000000L) +#define BN_DEC_CONV (1000000000L) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%09lu" +#define BN_DEC_NUM 9 +#endif + +#ifdef SIXTEEN_BIT +#ifndef BN_DIV2W +#define BN_DIV2W +#endif +#define BN_ULLONG unsigned long +#define BN_ULONG unsigned short +#define BN_LONG short +#define BN_BITS 32 +#define BN_BYTES 2 +#define BN_BITS2 16 +#define BN_BITS4 8 +#define BN_MASK2 (0xffff) +#define BN_MASK2l (0xff) +#define BN_MASK2h1 (0xff80) +#define BN_MASK2h (0xff00) +#define BN_TBIT (0x8000) +#define BN_DEC_CONV (100000) +#define BN_DEC_FMT1 "%u" +#define BN_DEC_FMT2 "%05u" +#define BN_DEC_NUM 5 +#endif + +#ifdef EIGHT_BIT +#ifndef BN_DIV2W +#define BN_DIV2W +#endif +#define BN_ULLONG unsigned short +#define BN_ULONG unsigned char +#define BN_LONG char +#define BN_BITS 16 +#define BN_BYTES 1 +#define BN_BITS2 8 +#define BN_BITS4 4 +#define BN_MASK2 (0xff) +#define BN_MASK2l (0xf) +#define BN_MASK2h1 (0xf8) +#define BN_MASK2h (0xf0) +#define BN_TBIT (0x80) +#define BN_DEC_CONV (100) +#define BN_DEC_FMT1 "%u" +#define BN_DEC_FMT2 "%02u" +#define BN_DEC_NUM 2 +#endif + +#define BN_DEFAULT_BITS 1280 + +#ifdef BIGNUM +#undef BIGNUM +#endif + +typedef struct bignum_st + { + BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ + int top; /* Index of last used d +1. */ + /* The next are internal book keeping for bn_expand. */ + int max; /* Size of the d array. */ + int neg; /* one if the number is negative */ + } BIGNUM; + +/* Used for temp variables */ +#define BN_CTX_NUM 12 +typedef struct bignum_ctx + { + int tos; + BIGNUM *bn[BN_CTX_NUM+1]; + } BN_CTX; + +typedef struct bn_blinding_st + { + int init; + BIGNUM *A; + BIGNUM *Ai; + BIGNUM *mod; /* just a reference */ + } BN_BLINDING; + +/* Used for montgomery multiplication */ +typedef struct bn_mont_ctx_st + { + int ri; /* number of bits in R */ + BIGNUM *RR; /* used to convert to montgomery form */ + BIGNUM *N; /* The modulus */ + BIGNUM *Ni; /* The inverse of N */ + BN_ULONG n0; /* word form of inverse, normally only one of + * Ni or n0 is defined */ + } BN_MONT_CTX; + +#define BN_to_montgomery(r,a,mont,ctx) BN_mod_mul_montgomery(\ + r,a,(mont)->RR,(mont),ctx) + +#define BN_prime_checks (5) + +#define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) +#define BN_is_word(a,w) (((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) +#define BN_is_zero(a) (((a)->top <= 1) && ((a)->d[0] == (BN_ULONG)0)) +#define BN_is_one(a) (BN_is_word((a),1)) +#define BN_is_odd(a) ((a)->d[0] & 1) +#define BN_one(a) (BN_set_word((a),1)) +#define BN_zero(a) (BN_set_word((a),0)) + +#define BN_ascii2bn(a) BN_hex2bn(a) +#define BN_bn2ascii(a) BN_bn2hex(a) + +#define bn_fix_top(a) \ + { \ + BN_ULONG *fix_top_l; \ + for (fix_top_l= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \ + if (*(fix_top_l--)) break; \ + } + +#define bn_expand(n,b) ((((b)/BN_BITS2) <= (n)->max)?\ + (n):bn_expand2((n),(b)/BN_BITS2)) +#define bn_wexpand(n,b) (((b) <= (n)->max)?(n):bn_expand2((n),(b))) + + +#ifndef NOPROTO +BIGNUM *BN_value_one(void); +char * BN_options(void); +BN_CTX *BN_CTX_new(void); +void BN_CTX_free(BN_CTX *c); +int BN_rand(BIGNUM *rnd, int bits, int top,int bottom); +int BN_num_bits(BIGNUM *a); +int BN_num_bits_word(BN_ULONG); +BIGNUM *BN_new(void); +void BN_clear_free(BIGNUM *a); +BIGNUM *BN_copy(BIGNUM *a, BIGNUM *b); +BIGNUM *BN_bin2bn(unsigned char *s,int len,BIGNUM *ret); +int BN_bn2bin(BIGNUM *a, unsigned char *to); +BIGNUM *BN_mpi2bn(unsigned char *s,int len,BIGNUM *ret); +int BN_bn2mpi(BIGNUM *a, unsigned char *to); +int BN_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b); +void bn_qsub(BIGNUM *r, BIGNUM *a, BIGNUM *b); +void bn_qadd(BIGNUM *r, BIGNUM *a, BIGNUM *b); +int BN_add(BIGNUM *r, BIGNUM *a, BIGNUM *b); +int BN_mod(BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx); +int BN_div(BIGNUM *dv, BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx); +int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b); +int BN_sqr(BIGNUM *r, BIGNUM *a,BN_CTX *ctx); +BN_ULONG BN_mod_word(BIGNUM *a, unsigned long w); +BN_ULONG BN_div_word(BIGNUM *a, unsigned long w); +int BN_mul_word(BIGNUM *a, unsigned long w); +int BN_add_word(BIGNUM *a, unsigned long w); +int BN_sub_word(BIGNUM *a, unsigned long w); +int BN_set_word(BIGNUM *a, unsigned long w); +unsigned long BN_get_word(BIGNUM *a); +int BN_cmp(BIGNUM *a, BIGNUM *b); +void BN_free(BIGNUM *a); +int BN_is_bit_set(BIGNUM *a, int n); +int BN_lshift(BIGNUM *r, BIGNUM *a, int n); +int BN_lshift1(BIGNUM *r, BIGNUM *a); +int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p,BN_CTX *ctx); +int BN_mod_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,BN_CTX *ctx); +int BN_mod_exp_mont(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,BN_CTX *ctx, + BN_MONT_CTX *m_ctx); +int BN_mod_exp_recp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,BN_CTX *ctx); +int BN_mod_exp_simple(BIGNUM *r, BIGNUM *a, BIGNUM *p, + BIGNUM *m,BN_CTX *ctx); +int BN_mask_bits(BIGNUM *a,int n); +int BN_mod_mul_reciprocal(BIGNUM *r, BIGNUM *x, BIGNUM *y, BIGNUM *m, + BIGNUM *i, int nb, BN_CTX *ctx); +int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, BIGNUM *m, + BN_CTX *ctx); +#ifndef WIN16 +int BN_print_fp(FILE *fp, BIGNUM *a); +#endif +#ifdef HEADER_BIO_H +int BN_print(BIO *fp, BIGNUM *a); +#else +int BN_print(char *fp, BIGNUM *a); +#endif +int BN_reciprocal(BIGNUM *r, BIGNUM *m, BN_CTX *ctx); +int BN_rshift(BIGNUM *r, BIGNUM *a, int n); +int BN_rshift1(BIGNUM *r, BIGNUM *a); +void BN_clear(BIGNUM *a); +BIGNUM *bn_expand2(BIGNUM *b, int bits); +BIGNUM *BN_dup(BIGNUM *a); +int BN_ucmp(BIGNUM *a, BIGNUM *b); +int BN_set_bit(BIGNUM *a, int n); +int BN_clear_bit(BIGNUM *a, int n); +char * BN_bn2hex(BIGNUM *a); +char * BN_bn2dec(BIGNUM *a); +int BN_hex2bn(BIGNUM **a,char *str); +int BN_dec2bn(BIGNUM **a,char *str); +int BN_gcd(BIGNUM *r,BIGNUM *in_a,BIGNUM *in_b,BN_CTX *ctx); +BIGNUM *BN_mod_inverse(BIGNUM *a, BIGNUM *n,BN_CTX *ctx); +BIGNUM *BN_generate_prime(int bits,int strong,BIGNUM *add, + BIGNUM *rem,void (*callback)(int,int,char *),char *cb_arg); +int BN_is_prime(BIGNUM *p,int nchecks,void (*callback)(int,int,char *), + BN_CTX *ctx,char *cb_arg); +void ERR_load_BN_strings(void ); + +BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w); +BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w); +void bn_sqr_words(BN_ULONG *rp, BN_ULONG *ap, int num); +BN_ULONG bn_div64(BN_ULONG h, BN_ULONG l, BN_ULONG d); +BN_ULONG bn_add_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int num); + +BN_MONT_CTX *BN_MONT_CTX_new(void ); +int BN_mod_mul_montgomery(BIGNUM *r,BIGNUM *a,BIGNUM *b,BN_MONT_CTX *mont, + BN_CTX *ctx); +int BN_from_montgomery(BIGNUM *r,BIGNUM *a,BN_MONT_CTX *mont,BN_CTX *ctx); +void BN_MONT_CTX_free(BN_MONT_CTX *mont); +int BN_MONT_CTX_set(BN_MONT_CTX *mont,BIGNUM *modulus,BN_CTX *ctx); + +BN_BLINDING *BN_BLINDING_new(BIGNUM *A,BIGNUM *Ai,BIGNUM *mod); +void BN_BLINDING_free(BN_BLINDING *b); +int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx); +int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *r, BN_CTX *ctx); +int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); + +#else + +BIGNUM *BN_value_one(); +char * BN_options(); +BN_CTX *BN_CTX_new(); +void BN_CTX_free(); +int BN_rand(); +int BN_num_bits(); +int BN_num_bits_word(); +BIGNUM *BN_new(); +void BN_clear_free(); +BIGNUM *BN_copy(); +BIGNUM *BN_bin2bn(); +int BN_bn2bin(); +BIGNUM *BN_mpi2bn(); +int BN_bn2mpi(); +int BN_sub(); +void bn_qsub(); +void bn_qadd(); +int BN_add(); +int BN_mod(); +int BN_div(); +int BN_mul(); +int BN_sqr(); +BN_ULONG BN_mod_word(); +BN_ULONG BN_div_word(); +int BN_add_word(); +int BN_sub_word(); +int BN_mul_word(); +int BN_set_word(); +unsigned long BN_get_word(); +int BN_cmp(); +void BN_free(); +int BN_is_bit_set(); +int BN_lshift(); +int BN_lshift1(); +int BN_exp(); +int BN_mod_exp(); +int BN_mod_exp_mont(); +int BN_mod_exp_recp(); +int BN_mod_exp_simple(); +int BN_mask_bits(); +int BN_mod_mul_reciprocal(); +int BN_mod_mul(); +#ifndef WIN16 +int BN_print_fp(); +#endif +int BN_print(); +int BN_reciprocal(); +int BN_rshift(); +int BN_rshift1(); +void BN_clear(); +BIGNUM *bn_expand2(); +BIGNUM *BN_dup(); +int BN_ucmp(); +int BN_set_bit(); +int BN_clear_bit(); +char * BN_bn2hex(); +char * BN_bn2dec(); +int BN_hex2bn(); +int BN_dec2bn(); +int BN_gcd(); +BIGNUM *BN_mod_inverse(); +BIGNUM *BN_generate_prime(); +int BN_is_prime(); +void ERR_load_BN_strings(); + +BN_ULONG bn_mul_add_words(); +BN_ULONG bn_mul_words(); +void bn_sqr_words(); +BN_ULONG bn_div64(); +BN_ULONG bn_add_words(); + +int BN_mod_mul_montgomery(); +int BN_from_montgomery(); +BN_MONT_CTX *BN_MONT_CTX_new(); +void BN_MONT_CTX_free(); +int BN_MONT_CTX_set(); + +BN_BLINDING *BN_BLINDING_new(); +void BN_BLINDING_free(); +int BN_BLINDING_update(); +int BN_BLINDING_convert(); +int BN_BLINDING_invert(); + +#endif + +/* BEGIN ERROR CODES */ +/* Error codes for the BN functions. */ + +/* Function codes. */ +#define BN_F_BN_BLINDING_CONVERT 100 +#define BN_F_BN_BLINDING_INVERT 101 +#define BN_F_BN_BLINDING_NEW 102 +#define BN_F_BN_BLINDING_UPDATE 103 +#define BN_F_BN_BN2DEC 104 +#define BN_F_BN_BN2HEX 105 +#define BN_F_BN_CTX_NEW 106 +#define BN_F_BN_DIV 107 +#define BN_F_BN_EXPAND2 108 +#define BN_F_BN_MOD_EXP_MONT 109 +#define BN_F_BN_MOD_INVERSE 110 +#define BN_F_BN_MOD_MUL_RECIPROCAL 111 +#define BN_F_BN_MPI2BN 112 +#define BN_F_BN_NEW 113 +#define BN_F_BN_RAND 114 + +/* Reason codes. */ +#define BN_R_BAD_RECIPROCAL 100 +#define BN_R_CALLED_WITH_EVEN_MODULUS 101 +#define BN_R_DIV_BY_ZERO 102 +#define BN_R_ENCODING_ERROR 103 +#define BN_R_INVALID_LENGTH 104 +#define BN_R_NOT_INITALISED 105 +#define BN_R_NO_INVERSE 106 + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/src/lib/libssl/src/crypto/bn/bn_m.c b/src/lib/libssl/src/crypto/bn/bn_m.c new file mode 100644 index 0000000000..5166daaeec --- /dev/null +++ b/src/lib/libssl/src/crypto/bn/bn_m.c @@ -0,0 +1,169 @@ +/* crypto/bn/bn_m.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn_lcl.h" +#include "stack.h" + +int limit=16; + +typedef struct bn_pool_st + { + int used; + int tos; + STACK *sk; + } BN_POOL; + +BIGNUM *BN_POOL_push(bp) +BN_POOL *bp; + { + BIGNUM *ret; + + if (bp->used >= bp->tos) + { + ret=BN_new(); + sk_push(bp->sk,(char *)ret); + bp->tos++; + bp->used++; + } + else + { + ret=(BIGNUM *)sk_value(bp->sk,bp->used); + bp->used++; + } + return(ret); + } + +void BN_POOL_pop(bp,num) +BN_POOL *bp; +int num; + { + bp->used-=num; + } + +int BN_m(r,a,b) +BIGNUM *r,*a,*b; + { + static BN_POOL bp; + static init=1; + + if (init) + { + bp.used=0; + bp.tos=0; + bp.sk=sk_new_null(); + init=0; + } + return(BN_mm(r,a,b,&bp)); + } + +/* r must be different to a and b */ +int BN_mm(m, A, B, bp) +BIGNUM *m,*A,*B; +BN_POOL *bp; + { + int i,num; + int an,bn; + BIGNUM *a,*b,*c,*d,*ac,*bd; + + an=A->top; + bn=B->top; + if ((an <= limit) || (bn <= limit)) + { + return(BN_mul(m,A,B)); + } + + a=BN_POOL_push(bp); + b=BN_POOL_push(bp); + c=BN_POOL_push(bp); + d=BN_POOL_push(bp); + ac=BN_POOL_push(bp); + bd=BN_POOL_push(bp); + + num=(an <= bn)?an:bn; + num=1<<(BN_num_bits_word(num-1)-1); + + /* Are going to now chop things into 'num' word chunks. */ + num*=BN_BITS2; + + BN_copy(a,A); + BN_mask_bits(a,num); + BN_rshift(b,A,num); + + BN_copy(c,B); + BN_mask_bits(c,num); + BN_rshift(d,B,num); + + BN_sub(ac ,b,a); + BN_sub(bd,c,d); + BN_mm(m,ac,bd,bp); + BN_mm(ac,a,c,bp); + BN_mm(bd,b,d,bp); + + BN_add(m,m,ac); + BN_add(m,m,bd); + BN_lshift(m,m,num); + BN_lshift(bd,bd,num*2); + + BN_add(m,m,ac); + BN_add(m,m,bd); + BN_POOL_pop(bp,6); + return(1); + } + diff --git a/src/lib/libssl/src/crypto/bn/bn_mulw.c b/src/lib/libssl/src/crypto/bn/bn_mulw.c new file mode 100644 index 0000000000..abfc7e4d6c --- /dev/null +++ b/src/lib/libssl/src/crypto/bn/bn_mulw.c @@ -0,0 +1,366 @@ +/* crypto/bn/bn_mulw.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn_lcl.h" + +#ifdef BN_LLONG + +BN_ULONG bn_mul_add_words(rp,ap,num,w) +BN_ULONG *rp,*ap; +int num; +BN_ULONG w; + { + BN_ULONG c1=0; + + for (;;) + { + mul_add(rp[0],ap[0],w,c1); + if (--num == 0) break; + mul_add(rp[1],ap[1],w,c1); + if (--num == 0) break; + mul_add(rp[2],ap[2],w,c1); + if (--num == 0) break; + mul_add(rp[3],ap[3],w,c1); + if (--num == 0) break; + ap+=4; + rp+=4; + } + + return(c1); + } + +BN_ULONG bn_mul_words(rp,ap,num,w) +BN_ULONG *rp,*ap; +int num; +BN_ULONG w; + { + BN_ULONG c1=0; + + for (;;) + { + mul(rp[0],ap[0],w,c1); + if (--num == 0) break; + mul(rp[1],ap[1],w,c1); + if (--num == 0) break; + mul(rp[2],ap[2],w,c1); + if (--num == 0) break; + mul(rp[3],ap[3],w,c1); + if (--num == 0) break; + ap+=4; + rp+=4; + } + return(c1); + } + +void bn_sqr_words(r,a,n) +BN_ULONG *r,*a; +int n; + { + for (;;) + { + BN_ULLONG t; + + t=(BN_ULLONG)(a[0])*(a[0]); + r[0]=Lw(t); r[1]=Hw(t); + if (--n == 0) break; + + t=(BN_ULLONG)(a[1])*(a[1]); + r[2]=Lw(t); r[3]=Hw(t); + if (--n == 0) break; + + t=(BN_ULLONG)(a[2])*(a[2]); + r[4]=Lw(t); r[5]=Hw(t); + if (--n == 0) break; + + t=(BN_ULLONG)(a[3])*(a[3]); + r[6]=Lw(t); r[7]=Hw(t); + if (--n == 0) break; + + a+=4; + r+=8; + } + } + +BN_ULONG bn_add_words(r,a,b,n) +BN_ULONG *r,*a,*b; +int n; + { + BN_ULLONG ll; + + ll=0; + for (;;) + { + ll+= (BN_ULLONG)a[0]+b[0]; + r[0]=(BN_ULONG)ll&BN_MASK2; + ll>>=BN_BITS2; + if (--n <= 0) break; + + ll+= (BN_ULLONG)a[1]+b[1]; + r[1]=(BN_ULONG)ll&BN_MASK2; + ll>>=BN_BITS2; + if (--n <= 0) break; + + ll+= (BN_ULLONG)a[2]+b[2]; + r[2]=(BN_ULONG)ll&BN_MASK2; + ll>>=BN_BITS2; + if (--n <= 0) break; + + ll+= (BN_ULLONG)a[3]+b[3]; + r[3]=(BN_ULONG)ll&BN_MASK2; + ll>>=BN_BITS2; + if (--n <= 0) break; + + a+=4; + b+=4; + r+=4; + } + return(ll&BN_MASK2); + } + +#else + +BN_ULONG bn_mul_add_words(rp,ap,num,w) +BN_ULONG *rp,*ap; +int num; +BN_ULONG w; + { + BN_ULONG c=0; + BN_ULONG bl,bh; + + bl=LBITS(w); + bh=HBITS(w); + + for (;;) + { + mul_add(rp[0],ap[0],bl,bh,c); + if (--num == 0) break; + mul_add(rp[1],ap[1],bl,bh,c); + if (--num == 0) break; + mul_add(rp[2],ap[2],bl,bh,c); + if (--num == 0) break; + mul_add(rp[3],ap[3],bl,bh,c); + if (--num == 0) break; + ap+=4; + rp+=4; + } + return(c); + } + +BN_ULONG bn_mul_words(rp,ap,num,w) +BN_ULONG *rp,*ap; +int num; +BN_ULONG w; + { + BN_ULONG carry=0; + BN_ULONG bl,bh; + + bl=LBITS(w); + bh=HBITS(w); + + for (;;) + { + mul(rp[0],ap[0],bl,bh,carry); + if (--num == 0) break; + mul(rp[1],ap[1],bl,bh,carry); + if (--num == 0) break; + mul(rp[2],ap[2],bl,bh,carry); + if (--num == 0) break; + mul(rp[3],ap[3],bl,bh,carry); + if (--num == 0) break; + ap+=4; + rp+=4; + } + return(carry); + } + +void bn_sqr_words(r,a,n) +BN_ULONG *r,*a; +int n; + { + for (;;) + { + sqr64(r[0],r[1],a[0]); + if (--n == 0) break; + + sqr64(r[2],r[3],a[1]); + if (--n == 0) break; + + sqr64(r[4],r[5],a[2]); + if (--n == 0) break; + + sqr64(r[6],r[7],a[3]); + if (--n == 0) break; + + a+=4; + r+=8; + } + } + +BN_ULONG bn_add_words(r,a,b,n) +BN_ULONG *r,*a,*b; +int n; + { + BN_ULONG t1,t2; + int carry,i; + + carry=0; + for (i=0; i<n; i++) + { + t1= *(a++); + t2= *(b++); + if (carry) + { + carry=(t2 >= ((~t1)&BN_MASK2)); + t2=(t1+t2+1)&BN_MASK2; + } + else + { + t2=(t1+t2)&BN_MASK2; + carry=(t2<t1); + } + *(r++)=t2; + } + return(carry); + } + +#endif + +#if defined(BN_LLONG) && defined(BN_DIV2W) + +BN_ULONG bn_div64(h,l,d) +BN_ULONG h,l,d; + { + return((BN_ULONG)(((((BN_ULLONG)h)<<BN_BITS2)|l)/(BN_ULLONG)d)); + } + +#else + +/* Divide h-l by d and return the result. */ +/* I need to test this some more :-( */ +BN_ULONG bn_div64(h,l,d) +BN_ULONG h,l,d; + { + BN_ULONG dh,dl,q,ret=0,th,tl,t; + int i,count=2; + + if (d == 0) return(BN_MASK2); + + i=BN_num_bits_word(d); + if ((i != BN_BITS2) && (h > (BN_ULONG)1<<i)) + { +#if !defined(NO_STDIO) && !defined(WIN16) + fprintf(stderr,"Division would overflow (%d)\n",i); +#endif + abort(); + } + i=BN_BITS2-i; + if (h >= d) h-=d; + + if (i) + { + d<<=i; + h=(h<<i)|(l>>(BN_BITS2-i)); + l<<=i; + } + dh=(d&BN_MASK2h)>>BN_BITS4; + dl=(d&BN_MASK2l); + for (;;) + { + if ((h>>BN_BITS4) == dh) + q=BN_MASK2l; + else + q=h/dh; + + for (;;) + { + t=(h-q*dh); + if ((t&BN_MASK2h) || + ((dl*q) <= ( + (t<<BN_BITS4)+ + ((l&BN_MASK2h)>>BN_BITS4)))) + break; + q--; + } + th=q*dh; + tl=q*dl; + t=(tl>>BN_BITS4); + tl=(tl<<BN_BITS4)&BN_MASK2h; + th+=t; + + if (l < tl) th++; + l-=tl; + if (h < th) + { + h+=d; + q--; + } + h-=th; + + if (--count == 0) break; + + ret=q<<BN_BITS4; + h=((h<<BN_BITS4)|(l>>BN_BITS4))&BN_MASK2; + l=(l&BN_MASK2l)<<BN_BITS4; + } + ret|=q; + return(ret); + } +#endif + diff --git a/src/lib/libssl/src/crypto/bn/bn_sub.c b/src/lib/libssl/src/crypto/bn/bn_sub.c new file mode 100644 index 0000000000..bba80f8afb --- /dev/null +++ b/src/lib/libssl/src/crypto/bn/bn_sub.c @@ -0,0 +1,180 @@ +/* crypto/bn/bn_sub.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "bn_lcl.h" + +/* unsigned subtraction of b from a, a must be larger than b. */ +void bn_qsub(r, a, b) +BIGNUM *r; +BIGNUM *a; +BIGNUM *b; + { + int max,min; + register BN_ULONG t1,t2,*ap,*bp,*rp; + int i,carry; +#if defined(IRIX_CC_BUG) && !defined(LINT) + int dummy; +#endif + + max=a->top; + min=b->top; + ap=a->d; + bp=b->d; + rp=r->d; + + carry=0; + for (i=0; i<min; i++) + { + t1= *(ap++); + t2= *(bp++); + if (carry) + { + carry=(t1 <= t2); + t1=(t1-t2-1)&BN_MASK2; + } + else + { + carry=(t1 < t2); + t1=(t1-t2)&BN_MASK2; + } +#if defined(IRIX_CC_BUG) && !defined(LINT) + dummy=t1; +#endif + *(rp++)=t1&BN_MASK2; + } + if (carry) /* subtracted */ + { + while (i < max) + { + i++; + t1= *(ap++); + t2=(t1-1)&BN_MASK2; + *(rp++)=t2; + if (t1 > t2) break; + } + } +#if 0 + memcpy(rp,ap,sizeof(*rp)*(max-i)); +#else + for (; i<max; i++) + *(rp++)= *(ap++); +#endif + + r->top=max; + bn_fix_top(r); + } + +int BN_sub(r, a, b) +BIGNUM *r; +BIGNUM *a; +BIGNUM *b; + { + int max,i; + int add=0,neg=0; + BIGNUM *tmp; + + /* a - b a-b + * a - -b a+b + * -a - b -(a+b) + * -a - -b b-a + */ + if (a->neg) + { + if (b->neg) + { tmp=a; a=b; b=tmp; } + else + { add=1; neg=1; } + } + else + { + if (b->neg) { add=1; neg=0; } + } + + if (add) + { + /* As a fast max size, do a a->top | b->top */ + i=(a->top | b->top)+1; + if (bn_wexpand(r,i) == NULL) + return(0); + if (i) + bn_qadd(r,a,b); + else + bn_qadd(r,b,a); + r->neg=neg; + return(1); + } + + /* We are actually doing a - b :-) */ + + max=(a->top > b->top)?a->top:b->top; + if (bn_wexpand(r,max) == NULL) return(0); + if (BN_ucmp(a,b) < 0) + { + bn_qsub(r,b,a); + r->neg=1; + } + else + { + bn_qsub(r,a,b); + r->neg=0; + } + return(1); + } + diff --git a/src/lib/libssl/src/crypto/buffer/buffer.err b/src/lib/libssl/src/crypto/buffer/buffer.err new file mode 100644 index 0000000000..62b775e637 --- /dev/null +++ b/src/lib/libssl/src/crypto/buffer/buffer.err @@ -0,0 +1,9 @@ +/* Error codes for the BUF functions. */ + +/* Function codes. */ +#define BUF_F_BUF_MEM_GROW 100 +#define BUF_F_BUF_MEM_NEW 101 +#define BUF_F_BUF_STRDUP 102 +#define BUF_F_PXYCLNT_READ 103 + +/* Reason codes. */ diff --git a/src/lib/libssl/src/crypto/cast/Makefile.uni b/src/lib/libssl/src/crypto/cast/Makefile.uni new file mode 100644 index 0000000000..780073e75b --- /dev/null +++ b/src/lib/libssl/src/crypto/cast/Makefile.uni @@ -0,0 +1,123 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +# There are 3 possible performance options, experiment :-) +#OPTS= -DBF_PTR +#OPTS= -DBF_PTR2 +OPTS= + +DIR= cast +TOP= . +CC= gcc +CFLAG= -O3 -fomit-frame-pointer + +CPP= $(CC) -E +INCLUDES= +INSTALLTOP=/usr/local/lib +MAKE= make +MAKEDEPEND= makedepend +MAKEFILE= Makefile.uni +AR= ar r + +CAST_ENC=c_enc.o +# or use +#CAST_ENC=asm/cx86-elf.o +#CAST_ENC=asm/cx86-out.o +#CAST_ENC=asm/cx86-sol.o +#CAST_ENC=asm/cx86bdsi.o + +CFLAGS= $(OPTS) $(INCLUDES) $(CFLAG) -DFULL_TEST + +GENERAL=Makefile +TEST=casttest +APP1=cast_spd +APP2=castopts +APPS=$(APP1) $(APP2) + +LIB=libcast.a +LIBSRC=c_skey.c c_ecb.c c_enc.c c_cfb64.c c_ofb64.c +LIBOBJ=c_skey.o c_ecb.o $(CAST_ENC) c_cfb64.o c_ofb64.o + +SRC= $(LIBSRC) + +EXHEADER= cast.h +HEADER= cast_lcl.h $(EXHEADER) + +ALL= $(GENERAL) $(SRC) $(HEADER) + +all: $(LIB) $(TEST) $(APPS) + +$(LIB): $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) + sh $(TOP)/ranlib.sh $(LIB) +# elf +asm/cx86-elf.o: asm/cx86unix.cpp + $(CPP) -DELF asm/cx86unix.cpp | as -o asm/cx86-elf.o + +# solaris +asm/cx86-sol.o: asm/cx86unix.cpp + $(CC) -E -DSOL asm/cx86unix.cpp | sed 's/^#.*//' > asm/cx86-sol.s + as -o asm/cx86-sol.o asm/cx86-sol.s + rm -f asm/cx86-sol.s + +# a.out +asm/cx86-out.o: asm/cx86unix.cpp + $(CPP) -DOUT asm/cx86unix.cpp | as -o asm/cx86-out.o + +# bsdi +asm/cx86bsdi.o: asm/cx86unix.cpp + $(CPP) -DBSDI asm/cx86unix.cpp | as -o asm/cx86bsdi.o + +asm/cx86unix.cpp: + (cd asm; perl cast-586.pl cpp >cx86unix.cpp) + +test: $(TEST) + ./$(TEST) + +$(TEST): $(TEST).c $(LIB) + $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) + +$(APP1): $(APP1).c $(LIB) + $(CC) -o $(APP1) $(CFLAGS) $(APP1).c $(LIB) + +$(APP2): $(APP2).c $(LIB) + $(CC) -o $(APP2) $(CFLAGS) $(APP2).c $(LIB) + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + +dclean: + perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff + +cc: + $(MAKE) CC="cc" CFLAG="-O" all + +gcc: + $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all + +x86-elf: + $(MAKE) CAST_ENC="asm/cx86-elf.o" CFLAG="-DELF $(CFLAGS)" all + +x86-out: + $(MAKE) CAST_ENC="asm/cx86-out.o" CFLAG="-DOUT $(CFLAGS)" all + +x86-solaris: + $(MAKE) CAST_ENC="asm/cx86-sol.o" CFLAG="-DSOL $(CFLAGS)" all + +x86-bdsi: + $(MAKE) CAST_ENC="asm/cx86-bdsi.o" CFLAG="-DBDSI $(CFLAGS)" all + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libssl/src/crypto/cast/asm/c-win32.asm b/src/lib/libssl/src/crypto/cast/asm/c-win32.asm new file mode 100644 index 0000000000..a1d8a2671a --- /dev/null +++ b/src/lib/libssl/src/crypto/cast/asm/c-win32.asm @@ -0,0 +1,940 @@ + ; Don't even think of reading this code + ; It was automatically generated by cast-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE cast-586.asm + .486 +.model FLAT +_TEXT SEGMENT +PUBLIC _CAST_encrypt +EXTERN _CAST_S_table0:DWORD +EXTERN _CAST_S_table1:DWORD +EXTERN _CAST_S_table2:DWORD +EXTERN _CAST_S_table3:DWORD + +_CAST_encrypt PROC NEAR + ; + push ebp + push ebx + mov ebx, DWORD PTR 12[esp] + mov ebp, DWORD PTR 16[esp] + push esi + push edi + ; Load the 2 words + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + xor eax, eax + ; round 0 + mov edx, DWORD PTR [ebp] + mov ecx, DWORD PTR 4[ebp] + add edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor edi, ecx + ; round 1 + mov edx, DWORD PTR 8[ebp] + mov ecx, DWORD PTR 12[ebp] + xor edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor esi, ecx + ; round 2 + mov edx, DWORD PTR 16[ebp] + mov ecx, DWORD PTR 20[ebp] + sub edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor edi, ecx + ; round 3 + mov edx, DWORD PTR 24[ebp] + mov ecx, DWORD PTR 28[ebp] + add edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor esi, ecx + ; round 4 + mov edx, DWORD PTR 32[ebp] + mov ecx, DWORD PTR 36[ebp] + xor edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor edi, ecx + ; round 5 + mov edx, DWORD PTR 40[ebp] + mov ecx, DWORD PTR 44[ebp] + sub edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor esi, ecx + ; round 6 + mov edx, DWORD PTR 48[ebp] + mov ecx, DWORD PTR 52[ebp] + add edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor edi, ecx + ; round 7 + mov edx, DWORD PTR 56[ebp] + mov ecx, DWORD PTR 60[ebp] + xor edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor esi, ecx + ; round 8 + mov edx, DWORD PTR 64[ebp] + mov ecx, DWORD PTR 68[ebp] + sub edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor edi, ecx + ; round 9 + mov edx, DWORD PTR 72[ebp] + mov ecx, DWORD PTR 76[ebp] + add edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor esi, ecx + ; round 10 + mov edx, DWORD PTR 80[ebp] + mov ecx, DWORD PTR 84[ebp] + xor edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor edi, ecx + ; round 11 + mov edx, DWORD PTR 88[ebp] + mov ecx, DWORD PTR 92[ebp] + sub edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor esi, ecx + ; round 12 + mov edx, DWORD PTR 96[ebp] + mov ecx, DWORD PTR 100[ebp] + add edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor edi, ecx + ; round 13 + mov edx, DWORD PTR 104[ebp] + mov ecx, DWORD PTR 108[ebp] + xor edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor esi, ecx + ; round 14 + mov edx, DWORD PTR 112[ebp] + mov ecx, DWORD PTR 116[ebp] + sub edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor edi, ecx + ; round 15 + mov edx, DWORD PTR 120[ebp] + mov ecx, DWORD PTR 124[ebp] + add edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + mov eax, DWORD PTR 20[esp] + xor esi, ecx + nop + mov DWORD PTR 4[eax],edi + mov DWORD PTR [eax],esi + pop edi + pop esi + pop ebx + pop ebp + ret +_CAST_encrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _CAST_decrypt +EXTERN _CAST_S_table0:DWORD +EXTERN _CAST_S_table1:DWORD +EXTERN _CAST_S_table2:DWORD +EXTERN _CAST_S_table3:DWORD + +_CAST_decrypt PROC NEAR + ; + push ebp + push ebx + mov ebx, DWORD PTR 12[esp] + mov ebp, DWORD PTR 16[esp] + push esi + push edi + ; Load the 2 words + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + xor eax, eax + ; round 15 + mov edx, DWORD PTR 120[ebp] + mov ecx, DWORD PTR 124[ebp] + add edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor edi, ecx + ; round 14 + mov edx, DWORD PTR 112[ebp] + mov ecx, DWORD PTR 116[ebp] + sub edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor esi, ecx + ; round 13 + mov edx, DWORD PTR 104[ebp] + mov ecx, DWORD PTR 108[ebp] + xor edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor edi, ecx + ; round 12 + mov edx, DWORD PTR 96[ebp] + mov ecx, DWORD PTR 100[ebp] + add edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor esi, ecx + ; round 11 + mov edx, DWORD PTR 88[ebp] + mov ecx, DWORD PTR 92[ebp] + sub edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor edi, ecx + ; round 10 + mov edx, DWORD PTR 80[ebp] + mov ecx, DWORD PTR 84[ebp] + xor edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor esi, ecx + ; round 9 + mov edx, DWORD PTR 72[ebp] + mov ecx, DWORD PTR 76[ebp] + add edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor edi, ecx + ; round 8 + mov edx, DWORD PTR 64[ebp] + mov ecx, DWORD PTR 68[ebp] + sub edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor esi, ecx + ; round 7 + mov edx, DWORD PTR 56[ebp] + mov ecx, DWORD PTR 60[ebp] + xor edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor edi, ecx + ; round 6 + mov edx, DWORD PTR 48[ebp] + mov ecx, DWORD PTR 52[ebp] + add edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor esi, ecx + ; round 5 + mov edx, DWORD PTR 40[ebp] + mov ecx, DWORD PTR 44[ebp] + sub edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor edi, ecx + ; round 4 + mov edx, DWORD PTR 32[ebp] + mov ecx, DWORD PTR 36[ebp] + xor edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor esi, ecx + ; round 3 + mov edx, DWORD PTR 24[ebp] + mov ecx, DWORD PTR 28[ebp] + add edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + xor edi, ecx + ; round 2 + mov edx, DWORD PTR 16[ebp] + mov ecx, DWORD PTR 20[ebp] + sub edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + sub ecx, ebx + xor esi, ecx + ; round 1 + mov edx, DWORD PTR 8[ebp] + mov ecx, DWORD PTR 12[ebp] + xor edx, esi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + add ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + xor ecx, ebx + xor edi, ecx + ; round 0 + mov edx, DWORD PTR [ebp] + mov ecx, DWORD PTR 4[ebp] + add edx, edi + rol edx, cl + mov ebx, edx + xor ecx, ecx + mov cl, dh + and ebx, 255 + shr edx, 16 + xor eax, eax + mov al, dh + and edx, 255 + mov ecx, DWORD PTR _CAST_S_table0[ecx*4] + mov ebx, DWORD PTR _CAST_S_table1[ebx*4] + xor ecx, ebx + mov ebx, DWORD PTR _CAST_S_table2[eax*4] + sub ecx, ebx + mov ebx, DWORD PTR _CAST_S_table3[edx*4] + add ecx, ebx + mov eax, DWORD PTR 20[esp] + xor esi, ecx + nop + mov DWORD PTR 4[eax],edi + mov DWORD PTR [eax],esi + pop edi + pop esi + pop ebx + pop ebp + ret +_CAST_decrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _CAST_cbc_encrypt + +_CAST_cbc_encrypt PROC NEAR + ; + push ebp + push ebx + push esi + push edi + mov ebp, DWORD PTR 28[esp] + ; getting iv ptr from parameter 4 + mov ebx, DWORD PTR 36[esp] + mov esi, DWORD PTR [ebx] + mov edi, DWORD PTR 4[ebx] + push edi + push esi + push edi + push esi + mov ebx, esp + mov esi, DWORD PTR 36[esp] + mov edi, DWORD PTR 40[esp] + ; getting encrypt flag from parameter 5 + mov ecx, DWORD PTR 56[esp] + ; get and push parameter 3 + mov eax, DWORD PTR 48[esp] + push eax + push ebx + cmp ecx, 0 + jz $L000decrypt + and ebp, 4294967288 + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + jz $L001encrypt_finish +L002encrypt_loop: + mov ecx, DWORD PTR [esi] + mov edx, DWORD PTR 4[esi] + xor eax, ecx + xor ebx, edx + bswap eax + bswap ebx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _CAST_encrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + bswap eax + bswap ebx + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L002encrypt_loop +$L001encrypt_finish: + mov ebp, DWORD PTR 52[esp] + and ebp, 7 + jz $L003finish + xor ecx, ecx + xor edx, edx + mov ebp, DWORD PTR $L004cbc_enc_jmp_table[ebp*4] + jmp ebp +L005ej7: + xor edx, edx + mov dh, BYTE PTR 6[esi] + shl edx, 8 +L006ej6: + mov dh, BYTE PTR 5[esi] +L007ej5: + mov dl, BYTE PTR 4[esi] +L008ej4: + mov ecx, DWORD PTR [esi] + jmp $L009ejend +L010ej3: + mov ch, BYTE PTR 2[esi] + xor ecx, ecx + shl ecx, 8 +L011ej2: + mov ch, BYTE PTR 1[esi] +L012ej1: + mov cl, BYTE PTR [esi] +$L009ejend: + xor eax, ecx + xor ebx, edx + bswap eax + bswap ebx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _CAST_encrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + bswap eax + bswap ebx + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + jmp $L003finish +$L000decrypt: + and ebp, 4294967288 + mov eax, DWORD PTR 16[esp] + mov ebx, DWORD PTR 20[esp] + jz $L013decrypt_finish +L014decrypt_loop: + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + bswap eax + bswap ebx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _CAST_decrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + bswap eax + bswap ebx + mov ecx, DWORD PTR 16[esp] + mov edx, DWORD PTR 20[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR [edi],ecx + mov DWORD PTR 4[edi],edx + mov DWORD PTR 16[esp],eax + mov DWORD PTR 20[esp],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L014decrypt_loop +$L013decrypt_finish: + mov ebp, DWORD PTR 52[esp] + and ebp, 7 + jz $L003finish + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + bswap eax + bswap ebx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _CAST_decrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + bswap eax + bswap ebx + mov ecx, DWORD PTR 16[esp] + mov edx, DWORD PTR 20[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] +L015dj7: + ror edx, 16 + mov BYTE PTR 6[edi],dl + shr edx, 16 +L016dj6: + mov BYTE PTR 5[edi],dh +L017dj5: + mov BYTE PTR 4[edi],dl +L018dj4: + mov DWORD PTR [edi],ecx + jmp $L019djend +L020dj3: + ror ecx, 16 + mov BYTE PTR 2[edi],cl + shl ecx, 16 +L021dj2: + mov BYTE PTR 1[esi],ch +L022dj1: + mov BYTE PTR [esi], cl +$L019djend: + jmp $L003finish +$L003finish: + mov ecx, DWORD PTR 60[esp] + add esp, 24 + mov DWORD PTR [ecx],eax + mov DWORD PTR 4[ecx],ebx + pop edi + pop esi + pop ebx + pop ebp + ret +$L004cbc_enc_jmp_table: + DD 0 + DD L012ej1 + DD L011ej2 + DD L010ej3 + DD L008ej4 + DD L007ej5 + DD L006ej6 + DD L005ej7 +L023cbc_dec_jmp_table: + DD 0 + DD L022dj1 + DD L021dj2 + DD L020dj3 + DD L018dj4 + DD L017dj5 + DD L016dj6 + DD L015dj7 +_CAST_cbc_encrypt ENDP +_TEXT ENDS +END diff --git a/src/lib/libssl/src/crypto/cast/asm/cx86unix.cpp b/src/lib/libssl/src/crypto/cast/asm/cx86unix.cpp new file mode 100644 index 0000000000..035692a5af --- /dev/null +++ b/src/lib/libssl/src/crypto/cast/asm/cx86unix.cpp @@ -0,0 +1,1010 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define CAST_S_table0 _CAST_S_table0 +#define CAST_S_table1 _CAST_S_table1 +#define CAST_S_table2 _CAST_S_table2 +#define CAST_S_table3 _CAST_S_table3 +#define CAST_encrypt _CAST_encrypt +#define CAST_S_table0 _CAST_S_table0 +#define CAST_S_table1 _CAST_S_table1 +#define CAST_S_table2 _CAST_S_table2 +#define CAST_S_table3 _CAST_S_table3 +#define CAST_decrypt _CAST_decrypt +#define CAST_cbc_encrypt _CAST_cbc_encrypt + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by cast-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "cast-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl CAST_encrypt + TYPE(CAST_encrypt,@function) +CAST_encrypt: + + pushl %ebp + pushl %ebx + movl 12(%esp), %ebx + movl 16(%esp), %ebp + pushl %esi + pushl %edi + /* Load the 2 words */ + movl (%ebx), %edi + movl 4(%ebx), %esi + xorl %eax, %eax + /* round 0 */ + movl (%ebp), %edx + movl 4(%ebp), %ecx + addl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %edi + /* round 1 */ + movl 8(%ebp), %edx + movl 12(%ebp), %ecx + xorl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %esi + /* round 2 */ + movl 16(%ebp), %edx + movl 20(%ebp), %ecx + subl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %edi + /* round 3 */ + movl 24(%ebp), %edx + movl 28(%ebp), %ecx + addl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %esi + /* round 4 */ + movl 32(%ebp), %edx + movl 36(%ebp), %ecx + xorl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %edi + /* round 5 */ + movl 40(%ebp), %edx + movl 44(%ebp), %ecx + subl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %esi + /* round 6 */ + movl 48(%ebp), %edx + movl 52(%ebp), %ecx + addl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %edi + /* round 7 */ + movl 56(%ebp), %edx + movl 60(%ebp), %ecx + xorl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %esi + /* round 8 */ + movl 64(%ebp), %edx + movl 68(%ebp), %ecx + subl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %edi + /* round 9 */ + movl 72(%ebp), %edx + movl 76(%ebp), %ecx + addl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %esi + /* round 10 */ + movl 80(%ebp), %edx + movl 84(%ebp), %ecx + xorl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %edi + /* round 11 */ + movl 88(%ebp), %edx + movl 92(%ebp), %ecx + subl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %esi + /* round 12 */ + movl 96(%ebp), %edx + movl 100(%ebp), %ecx + addl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %edi + /* round 13 */ + movl 104(%ebp), %edx + movl 108(%ebp), %ecx + xorl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %esi + /* round 14 */ + movl 112(%ebp), %edx + movl 116(%ebp), %ecx + subl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %edi + /* round 15 */ + movl 120(%ebp), %edx + movl 124(%ebp), %ecx + addl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + movl 20(%esp), %eax + xorl %ecx, %esi + nop + movl %edi, 4(%eax) + movl %esi, (%eax) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.CAST_encrypt_end: + SIZE(CAST_encrypt,.CAST_encrypt_end-CAST_encrypt) +.ident "CAST_encrypt" +.text + .align ALIGN +.globl CAST_decrypt + TYPE(CAST_decrypt,@function) +CAST_decrypt: + + pushl %ebp + pushl %ebx + movl 12(%esp), %ebx + movl 16(%esp), %ebp + pushl %esi + pushl %edi + /* Load the 2 words */ + movl (%ebx), %edi + movl 4(%ebx), %esi + xorl %eax, %eax + /* round 15 */ + movl 120(%ebp), %edx + movl 124(%ebp), %ecx + addl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %edi + /* round 14 */ + movl 112(%ebp), %edx + movl 116(%ebp), %ecx + subl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %esi + /* round 13 */ + movl 104(%ebp), %edx + movl 108(%ebp), %ecx + xorl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %edi + /* round 12 */ + movl 96(%ebp), %edx + movl 100(%ebp), %ecx + addl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %esi + /* round 11 */ + movl 88(%ebp), %edx + movl 92(%ebp), %ecx + subl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %edi + /* round 10 */ + movl 80(%ebp), %edx + movl 84(%ebp), %ecx + xorl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %esi + /* round 9 */ + movl 72(%ebp), %edx + movl 76(%ebp), %ecx + addl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %edi + /* round 8 */ + movl 64(%ebp), %edx + movl 68(%ebp), %ecx + subl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %esi + /* round 7 */ + movl 56(%ebp), %edx + movl 60(%ebp), %ecx + xorl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %edi + /* round 6 */ + movl 48(%ebp), %edx + movl 52(%ebp), %ecx + addl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %esi + /* round 5 */ + movl 40(%ebp), %edx + movl 44(%ebp), %ecx + subl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %edi + /* round 4 */ + movl 32(%ebp), %edx + movl 36(%ebp), %ecx + xorl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %esi + /* round 3 */ + movl 24(%ebp), %edx + movl 28(%ebp), %ecx + addl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + xorl %ecx, %edi + /* round 2 */ + movl 16(%ebp), %edx + movl 20(%ebp), %ecx + subl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + addl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + subl %ebx, %ecx + xorl %ecx, %esi + /* round 1 */ + movl 8(%ebp), %edx + movl 12(%ebp), %ecx + xorl %esi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + subl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + addl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + xorl %ebx, %ecx + xorl %ecx, %edi + /* round 0 */ + movl (%ebp), %edx + movl 4(%ebp), %ecx + addl %edi, %edx + roll %cl, %edx + movl %edx, %ebx + xorl %ecx, %ecx + movb %dh, %cl + andl $255, %ebx + shrl $16, %edx + xorl %eax, %eax + movb %dh, %al + andl $255, %edx + movl CAST_S_table0(,%ecx,4),%ecx + movl CAST_S_table1(,%ebx,4),%ebx + xorl %ebx, %ecx + movl CAST_S_table2(,%eax,4),%ebx + subl %ebx, %ecx + movl CAST_S_table3(,%edx,4),%ebx + addl %ebx, %ecx + movl 20(%esp), %eax + xorl %ecx, %esi + nop + movl %edi, 4(%eax) + movl %esi, (%eax) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.CAST_decrypt_end: + SIZE(CAST_decrypt,.CAST_decrypt_end-CAST_decrypt) +.ident "CAST_decrypt" +.text + .align ALIGN +.globl CAST_cbc_encrypt + TYPE(CAST_cbc_encrypt,@function) +CAST_cbc_encrypt: + + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + movl 28(%esp), %ebp + /* getting iv ptr from parameter 4 */ + movl 36(%esp), %ebx + movl (%ebx), %esi + movl 4(%ebx), %edi + pushl %edi + pushl %esi + pushl %edi + pushl %esi + movl %esp, %ebx + movl 36(%esp), %esi + movl 40(%esp), %edi + /* getting encrypt flag from parameter 5 */ + movl 56(%esp), %ecx + /* get and push parameter 3 */ + movl 48(%esp), %eax + pushl %eax + pushl %ebx + cmpl $0, %ecx + jz .L000decrypt + andl $4294967288, %ebp + movl 8(%esp), %eax + movl 12(%esp), %ebx + jz .L001encrypt_finish +.L002encrypt_loop: + movl (%esi), %ecx + movl 4(%esi), %edx + xorl %ecx, %eax + xorl %edx, %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call CAST_encrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, (%edi) + movl %ebx, 4(%edi) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L002encrypt_loop +.L001encrypt_finish: + movl 52(%esp), %ebp + andl $7, %ebp + jz .L003finish + xorl %ecx, %ecx + xorl %edx, %edx + movl .L004cbc_enc_jmp_table(,%ebp,4),%ebp + jmp *%ebp +.L005ej7: + xorl %edx, %edx + movb 6(%esi), %dh + sall $8, %edx +.L006ej6: + movb 5(%esi), %dh +.L007ej5: + movb 4(%esi), %dl +.L008ej4: + movl (%esi), %ecx + jmp .L009ejend +.L010ej3: + movb 2(%esi), %ch + xorl %ecx, %ecx + sall $8, %ecx +.L011ej2: + movb 1(%esi), %ch +.L012ej1: + movb (%esi), %cl +.L009ejend: + xorl %ecx, %eax + xorl %edx, %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call CAST_encrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, (%edi) + movl %ebx, 4(%edi) + jmp .L003finish +.align ALIGN +.L000decrypt: + andl $4294967288, %ebp + movl 16(%esp), %eax + movl 20(%esp), %ebx + jz .L013decrypt_finish +.L014decrypt_loop: + movl (%esi), %eax + movl 4(%esi), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call CAST_decrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl 16(%esp), %ecx + movl 20(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx + movl %ecx, (%edi) + movl %edx, 4(%edi) + movl %eax, 16(%esp) + movl %ebx, 20(%esp) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L014decrypt_loop +.L013decrypt_finish: + movl 52(%esp), %ebp + andl $7, %ebp + jz .L003finish + movl (%esi), %eax + movl 4(%esi), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call CAST_decrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx +.byte 15 +.byte 200 /* bswapl %eax */ +.byte 15 +.byte 203 /* bswapl %ebx */ + movl 16(%esp), %ecx + movl 20(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx +.L015dj7: + rorl $16, %edx + movb %dl, 6(%edi) + shrl $16, %edx +.L016dj6: + movb %dh, 5(%edi) +.L017dj5: + movb %dl, 4(%edi) +.L018dj4: + movl %ecx, (%edi) + jmp .L019djend +.L020dj3: + rorl $16, %ecx + movb %cl, 2(%edi) + sall $16, %ecx +.L021dj2: + movb %ch, 1(%esi) +.L022dj1: + movb %cl, (%esi) +.L019djend: + jmp .L003finish +.align ALIGN +.L003finish: + movl 60(%esp), %ecx + addl $24, %esp + movl %eax, (%ecx) + movl %ebx, 4(%ecx) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.align ALIGN +.L004cbc_enc_jmp_table: + .long 0 + .long .L012ej1 + .long .L011ej2 + .long .L010ej3 + .long .L008ej4 + .long .L007ej5 + .long .L006ej6 + .long .L005ej7 +.align ALIGN +.L023cbc_dec_jmp_table: + .long 0 + .long .L022dj1 + .long .L021dj2 + .long .L020dj3 + .long .L018dj4 + .long .L017dj5 + .long .L016dj6 + .long .L015dj7 +.CAST_cbc_encrypt_end: + SIZE(CAST_cbc_encrypt,.CAST_cbc_encrypt_end-CAST_cbc_encrypt) +.ident "desasm.pl" diff --git a/src/lib/libssl/src/crypto/conf/conf.c b/src/lib/libssl/src/crypto/conf/conf.c new file mode 100644 index 0000000000..9e84300c5e --- /dev/null +++ b/src/lib/libssl/src/crypto/conf/conf.c @@ -0,0 +1,727 @@ +/* crypto/conf/conf.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include <errno.h> +#include "cryptlib.h" +#include "stack.h" +#include "lhash.h" +#include "conf.h" +#include "buffer.h" +#include "err.h" + +#include "conf_lcl.h" + +#ifndef NOPROTO +static void value_free_hash(CONF_VALUE *a, LHASH *conf); +static void value_free_stack(CONF_VALUE *a,LHASH *conf); +static unsigned long hash(CONF_VALUE *v); +static int cmp(CONF_VALUE *a,CONF_VALUE *b); +static char *eat_ws(char *p); +static char *eat_alpha_numeric(char *p); +static void clear_comments(char *p); +static int str_copy(LHASH *conf,char *section,char **to, char *from); +static char *scan_quote(char *p); +static CONF_VALUE *new_section(LHASH *conf,char *section); +static CONF_VALUE *get_section(LHASH *conf,char *section); +#else +static void value_free_hash(); +static void value_free_stack(); +static unsigned long hash(); +static int cmp(); +static char *eat_ws(); +static char *eat_alpha_numeric(); +static void clear_comments(); +static int str_copy(); +static char *scan_quote(); +static CONF_VALUE *new_section(); +static CONF_VALUE *get_section(); +#endif + +#define scan_esc(p) ((*(++p) == '\0')?(p):(++p)) + +char *CONF_version="CONF part of SSLeay 0.9.0b 29-Jun-1998"; + +LHASH *CONF_load(h,file,line) +LHASH *h; +char *file; +long *line; + { + LHASH *ret=NULL; + FILE *in=NULL; +#define BUFSIZE 512 + int bufnum=0,i,ii; + BUF_MEM *buff=NULL; + char *s,*p,*end; + int again,n,eline=0; + CONF_VALUE *v=NULL,*vv,*tv; + CONF_VALUE *sv=NULL; + char *section=NULL,*buf; + STACK *section_sk=NULL,*ts; + char *start,*psection,*pname; + + if ((buff=BUF_MEM_new()) == NULL) + { + CONFerr(CONF_F_CONF_LOAD,ERR_R_BUF_LIB); + goto err; + } + + in=fopen(file,"rb"); + if (in == NULL) + { + SYSerr(SYS_F_FOPEN,get_last_sys_error()); + ERR_set_error_data(BUF_strdup(file), + ERR_TXT_MALLOCED|ERR_TXT_STRING); + CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB); + goto err; + } + + section=(char *)Malloc(10); + if (section == NULL) + { + CONFerr(CONF_F_CONF_LOAD,ERR_R_MALLOC_FAILURE); + goto err; + } + strcpy(section,"default"); + + if (h == NULL) + { + if ((ret=lh_new(hash,cmp)) == NULL) + { + CONFerr(CONF_F_CONF_LOAD,ERR_R_MALLOC_FAILURE); + goto err; + } + } + else + ret=h; + + sv=new_section(ret,section); + if (sv == NULL) + { + CONFerr(CONF_F_CONF_LOAD,CONF_R_UNABLE_TO_CREATE_NEW_SECTION); + goto err; + } + section_sk=(STACK *)sv->value; + + bufnum=0; + for (;;) + { + again=0; + if (!BUF_MEM_grow(buff,bufnum+BUFSIZE)) + { + CONFerr(CONF_F_CONF_LOAD,ERR_R_BUF_LIB); + goto err; + } + p= &(buff->data[bufnum]); + *p='\0'; + fgets(p,BUFSIZE-1,in); + p[BUFSIZE-1]='\0'; + ii=i=strlen(p); + if (i == 0) break; + while (i > 0) + { + if ((p[i-1] != '\r') && (p[i-1] != '\n')) + break; + else + i--; + } + /* we removed some trailing stuff so there is a new + * line on the end. */ + if (i == ii) + again=1; /* long line */ + else + { + p[i]='\0'; + eline++; /* another input line */ + } + + /* we now have a line with trailing \r\n removed */ + + /* i is the number of bytes */ + bufnum+=i; + + v=NULL; + /* check for line continuation */ + if (bufnum >= 1) + { + /* If we have bytes and the last char '\\' and + * second last char is not '\\' */ + p= &(buff->data[bufnum-1]); + if ( IS_ESC(p[0]) && + ((bufnum <= 1) || !IS_ESC(p[-1]))) + { + bufnum--; + again=1; + } + } + if (again) continue; + bufnum=0; + buf=buff->data; + + clear_comments(buf); + n=strlen(buf); + s=eat_ws(buf); + if (IS_EOF(*s)) continue; /* blank line */ + if (*s == '[') + { + s++; + start=eat_ws(s); + end=eat_alpha_numeric(start); + p=eat_ws(end); + if (*p != ']') + { + CONFerr(CONF_F_CONF_LOAD,CONF_R_MISSING_CLOSE_SQUARE_BRACKET); + goto err; + } + *end='\0'; + if (!str_copy(ret,NULL,§ion,start)) goto err; + if ((sv=get_section(ret,section)) == NULL) + sv=new_section(ret,section); + if (sv == NULL) + { + CONFerr(CONF_F_CONF_LOAD,CONF_R_UNABLE_TO_CREATE_NEW_SECTION); + goto err; + } + section_sk=(STACK *)sv->value; + continue; + } + else + { + pname=s; + psection=NULL; + end=eat_alpha_numeric(s); + if ((end[0] == ':') && (end[1] == ':')) + { + *end='\0'; + end+=2; + psection=pname; + pname=end; + end=eat_alpha_numeric(end); + } + p=eat_ws(end); + if (*p != '=') + { + CONFerr(CONF_F_CONF_LOAD,CONF_R_MISSING_EQUAL_SIGN); + goto err; + } + *end='\0'; + p++; + start=eat_ws(p); + while (!IS_EOF(*p)) + p++; + p--; + while ((p != start) && (IS_WS(*p))) + p--; + p++; + *p='\0'; + + if ((v=(CONF_VALUE *)Malloc(sizeof(CONF_VALUE))) == NULL) + { + CONFerr(CONF_F_CONF_LOAD,ERR_R_MALLOC_FAILURE); + goto err; + } + if (psection == NULL) psection=section; + v->name=(char *)Malloc(strlen(pname)+1); + v->value=NULL; + if (v->name == NULL) + { + CONFerr(CONF_F_CONF_LOAD,ERR_R_MALLOC_FAILURE); + goto err; + } + strcpy(v->name,pname); + if (!str_copy(ret,psection,&(v->value),start)) goto err; + + if (strcmp(psection,section) != 0) + { + if ((tv=get_section(ret,psection)) + == NULL) + tv=new_section(ret,psection); + if (tv == NULL) + { + CONFerr(CONF_F_CONF_LOAD,CONF_R_UNABLE_TO_CREATE_NEW_SECTION); + goto err; + } + ts=(STACK *)tv->value; + } + else + { + tv=sv; + ts=section_sk; + } + v->section=tv->section; + if (!sk_push(ts,(char *)v)) + { + CONFerr(CONF_F_CONF_LOAD,ERR_R_MALLOC_FAILURE); + goto err; + } + vv=(CONF_VALUE *)lh_insert(ret,(char *)v); + if (vv != NULL) + { + sk_delete_ptr(ts,(char *)vv); + Free(vv->name); + Free(vv->value); + Free(vv); + } + v=NULL; + } + } + if (buff != NULL) BUF_MEM_free(buff); + if (section != NULL) Free(section); + if (in != NULL) fclose(in); + return(ret); +err: + if (buff != NULL) BUF_MEM_free(buff); + if (section != NULL) Free(section); + if (line != NULL) *line=eline; + if (in != NULL) fclose(in); + if ((h != ret) && (ret != NULL)) CONF_free(ret); + if (v != NULL) + { + if (v->name != NULL) Free(v->name); + if (v->value != NULL) Free(v->value); + if (v != NULL) Free(v); + } + return(NULL); + } + +char *CONF_get_string(conf,section,name) +LHASH *conf; +char *section; +char *name; + { + CONF_VALUE *v,vv; + char *p; + + if (name == NULL) return(NULL); + if (conf != NULL) + { + if (section != NULL) + { + vv.name=name; + vv.section=section; + v=(CONF_VALUE *)lh_retrieve(conf,(char *)&vv); + if (v != NULL) return(v->value); + if (strcmp(section,"ENV") == 0) + { + p=Getenv(name); + if (p != NULL) return(p); + } + } + vv.section="default"; + vv.name=name; + v=(CONF_VALUE *)lh_retrieve(conf,(char *)&vv); + if (v != NULL) + return(v->value); + else + return(NULL); + } + else + return(Getenv(name)); + } + +static CONF_VALUE *get_section(conf,section) +LHASH *conf; +char *section; + { + CONF_VALUE *v,vv; + + if ((conf == NULL) || (section == NULL)) return(NULL); + vv.name=NULL; + vv.section=section; + v=(CONF_VALUE *)lh_retrieve(conf,(char *)&vv); + return(v); + } + +STACK *CONF_get_section(conf,section) +LHASH *conf; +char *section; + { + CONF_VALUE *v; + + v=get_section(conf,section); + if (v != NULL) + return((STACK *)v->value); + else + return(NULL); + } + +long CONF_get_number(conf,section,name) +LHASH *conf; +char *section; +char *name; + { + char *str; + long ret=0; + + str=CONF_get_string(conf,section,name); + if (str == NULL) return(0); + for (;;) + { + if (IS_NUMER(*str)) + ret=ret*10+(*str -'0'); + else + return(ret); + str++; + } + } + +void CONF_free(conf) +LHASH *conf; + { + if (conf == NULL) return; + + conf->down_load=0; /* evil thing to make sure the 'Free()' + * works as expected */ + lh_doall_arg(conf,(void (*)())value_free_hash,(char *)conf); + + /* We now have only 'section' entries in the hash table. + * Due to problems with */ + + lh_doall_arg(conf,(void (*)())value_free_stack,(char *)conf); + lh_free(conf); + } + +static void value_free_hash(a,conf) +CONF_VALUE *a; +LHASH *conf; + { + if (a->name != NULL) + { + a=(CONF_VALUE *)lh_delete(conf,(char *)a); + } + } + +static void value_free_stack(a,conf) +CONF_VALUE *a; +LHASH *conf; + { + CONF_VALUE *vv; + STACK *sk; + int i; + + if (a->name != NULL) return; + + sk=(STACK *)a->value; + for (i=sk_num(sk)-1; i>=0; i--) + { + vv=(CONF_VALUE *)sk_value(sk,i); + Free(vv->value); + Free(vv->name); + Free(vv); + } + if (sk != NULL) sk_free(sk); + Free(a->section); + Free(a); + } + +static void clear_comments(p) +char *p; + { + char *to; + + to=p; + for (;;) + { + if (IS_COMMENT(*p)) + { + *p='\0'; + return; + } + if (IS_QUOTE(*p)) + { + p=scan_quote(p); + continue; + } + if (IS_ESC(*p)) + { + p=scan_esc(p); + continue; + } + if (IS_EOF(*p)) + return; + else + p++; + } + } + +static int str_copy(conf,section,pto,from) +LHASH *conf; +char *section; +char **pto,*from; + { + int q,r,rr=0,to=0,len=0; + char *s,*e,*rp,*p,*rrp,*np,*cp,v; + BUF_MEM *buf; + + if ((buf=BUF_MEM_new()) == NULL) return(0); + + len=strlen(from)+1; + if (!BUF_MEM_grow(buf,len)) goto err; + + for (;;) + { + if (IS_QUOTE(*from)) + { + q= *from; + from++; + while ((*from != '\0') && (*from != q)) + { + if (*from == '\\') + { + from++; + if (*from == '\0') break; + } + buf->data[to++]= *(from++); + } + } + else if (*from == '\\') + { + from++; + v= *(from++); + if (v == '\0') break; + else if (v == 'r') v='\r'; + else if (v == 'n') v='\n'; + else if (v == 'b') v='\b'; + else if (v == 't') v='\t'; + buf->data[to++]= v; + } + else if (*from == '\0') + break; + else if (*from == '$') + { + /* try to expand it */ + rrp=NULL; + s= &(from[1]); + if (*s == '{') + q='}'; + else if (*s == '(') + q=')'; + else q=0; + + if (q) s++; + cp=section; + e=np=s; + while (IS_ALPHA_NUMERIC(*e)) + e++; + if ((e[0] == ':') && (e[1] == ':')) + { + cp=np; + rrp=e; + rr= *e; + *rrp='\0'; + e+=2; + np=e; + while (IS_ALPHA_NUMERIC(*e)) + e++; + } + r= *e; + *e='\0'; + rp=e; + if (q) + { + if (r != q) + { + CONFerr(CONF_F_STR_COPY,CONF_R_NO_CLOSE_BRACE); + goto err; + } + e++; + } + /* So at this point we have + * ns which is the start of the name string which is + * '\0' terminated. + * cs which is the start of the section string which is + * '\0' terminated. + * e is the 'next point after'. + * r and s are the chars replaced by the '\0' + * rp and sp is where 'r' and 's' came from. + */ + p=CONF_get_string(conf,cp,np); + if (rrp != NULL) *rrp=rr; + *rp=r; + if (p == NULL) + { + CONFerr(CONF_F_STR_COPY,CONF_R_VARIABLE_HAS_NO_VALUE); + goto err; + } + BUF_MEM_grow(buf,(strlen(p)+len-(e-from))); + while (*p) + buf->data[to++]= *(p++); + from=e; + } + else + buf->data[to++]= *(from++); + } + buf->data[to]='\0'; + if (*pto != NULL) Free(*pto); + *pto=buf->data; + Free(buf); + return(1); +err: + if (buf != NULL) BUF_MEM_free(buf); + return(0); + } + +static char *eat_ws(p) +char *p; + { + while (IS_WS(*p) && (!IS_EOF(*p))) + p++; + return(p); + } + +static char *eat_alpha_numeric(p) +char *p; + { + for (;;) + { + if (IS_ESC(*p)) + { + p=scan_esc(p); + continue; + } + if (!IS_ALPHA_NUMERIC_PUNCT(*p)) + return(p); + p++; + } + } + +static unsigned long hash(v) +CONF_VALUE *v; + { + return((lh_strhash(v->section)<<2)^lh_strhash(v->name)); + } + +static int cmp(a,b) +CONF_VALUE *a,*b; + { + int i; + + if (a->section != b->section) + { + i=strcmp(a->section,b->section); + if (i) return(i); + } + + if ((a->name != NULL) && (b->name != NULL)) + { + i=strcmp(a->name,b->name); + return(i); + } + else if (a->name == b->name) + return(0); + else + return((a->name == NULL)?-1:1); + } + +static char *scan_quote(p) +char *p; + { + int q= *p; + + p++; + while (!(IS_EOF(*p)) && (*p != q)) + { + if (IS_ESC(*p)) + { + p++; + if (IS_EOF(*p)) return(p); + } + p++; + } + if (*p == q) p++; + return(p); + } + +static CONF_VALUE *new_section(conf,section) +LHASH *conf; +char *section; + { + STACK *sk=NULL; + int ok=0,i; + CONF_VALUE *v=NULL,*vv; + + if ((sk=sk_new_null()) == NULL) + goto err; + if ((v=(CONF_VALUE *)Malloc(sizeof(CONF_VALUE))) == NULL) + goto err; + i=strlen(section)+1; + if ((v->section=(char *)Malloc(i)) == NULL) + goto err; + + memcpy(v->section,section,i); + v->name=NULL; + v->value=(char *)sk; + + vv=(CONF_VALUE *)lh_insert(conf,(char *)v); + if (vv != NULL) + { +#if !defined(NO_STDIO) && !defined(WIN16) + fprintf(stderr,"internal fault\n"); +#endif + abort(); + } + ok=1; +err: + if (!ok) + { + if (sk != NULL) sk_free(sk); + if (v != NULL) Free(v); + v=NULL; + } + return(v); + } diff --git a/src/lib/libssl/src/crypto/conf/conf.err b/src/lib/libssl/src/crypto/conf/conf.err new file mode 100644 index 0000000000..933d3d692a --- /dev/null +++ b/src/lib/libssl/src/crypto/conf/conf.err @@ -0,0 +1,12 @@ +/* Error codes for the CONF functions. */ + +/* Function codes. */ +#define CONF_F_CONF_LOAD 100 +#define CONF_F_STR_COPY 101 + +/* Reason codes. */ +#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 +#define CONF_R_MISSING_EQUAL_SIGN 101 +#define CONF_R_NO_CLOSE_BRACE 102 +#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 +#define CONF_R_VARIABLE_HAS_NO_VALUE 104 diff --git a/src/lib/libssl/src/crypto/conf/conf_lcl.h b/src/lib/libssl/src/crypto/conf/conf_lcl.h new file mode 100644 index 0000000000..4e5644ed79 --- /dev/null +++ b/src/lib/libssl/src/crypto/conf/conf_lcl.h @@ -0,0 +1,102 @@ +/* crypto/conf/conf_lcl.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#define CONF_NUMBER 1 +#define CONF_UPPER 2 +#define CONF_LOWER 4 +#define CONF_UNDER 256 +#define CONF_PUNCTUATION 512 +#define CONF_WS 16 +#define CONF_ESC 32 +#define CONF_QUOTE 64 +#define CONF_COMMENT 128 +#define CONF_EOF 8 +#define CONF_ALPHA (CONF_UPPER|CONF_LOWER) +#define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER) +#define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \ + CONF_PUNCTUATION) + +#define IS_COMMENT(a) (CONF_COMMENT&(CONF_type[(a)&0x7f])) +#define IS_EOF(a) ((a) == '\0') +#define IS_ESC(a) ((a) == '\\') +#define IS_NUMER(a) (CONF_type[(a)&0x7f]&CONF_NUMBER) +#define IS_WS(a) (CONF_type[(a)&0x7f]&CONF_WS) +#define IS_ALPHA_NUMERIC(a) (CONF_type[(a)&0x7f]&CONF_ALPHA_NUMERIC) +#define IS_ALPHA_NUMERIC_PUNCT(a) \ + (CONF_type[(a)&0x7f]&CONF_ALPHA_NUMERIC_PUNCT) +#define IS_QUOTE(a) (CONF_type[(a)&0x7f]&CONF_QUOTE) + +static unsigned short CONF_type[128]={ + 0x008,0x000,0x000,0x000,0x000,0x000,0x000,0x000, + 0x000,0x010,0x010,0x000,0x000,0x010,0x000,0x000, + 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000, + 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000, + 0x010,0x200,0x040,0x080,0x000,0x200,0x200,0x040, + 0x000,0x000,0x200,0x200,0x200,0x200,0x200,0x200, + 0x001,0x001,0x001,0x001,0x001,0x001,0x001,0x001, + 0x001,0x001,0x000,0x200,0x000,0x000,0x000,0x200, + 0x200,0x002,0x002,0x002,0x002,0x002,0x002,0x002, + 0x002,0x002,0x002,0x002,0x002,0x002,0x002,0x002, + 0x002,0x002,0x002,0x002,0x002,0x002,0x002,0x002, + 0x002,0x002,0x002,0x000,0x020,0x000,0x200,0x100, + 0x040,0x004,0x004,0x004,0x004,0x004,0x004,0x004, + 0x004,0x004,0x004,0x004,0x004,0x004,0x004,0x004, + 0x004,0x004,0x004,0x004,0x004,0x004,0x004,0x004, + 0x004,0x004,0x004,0x000,0x200,0x000,0x200,0x000, + }; + diff --git a/src/lib/libssl/src/crypto/cryptall.h b/src/lib/libssl/src/crypto/cryptall.h new file mode 100644 index 0000000000..65a46452a8 --- /dev/null +++ b/src/lib/libssl/src/crypto/cryptall.h @@ -0,0 +1,110 @@ +/* crypto/cryptall.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_CRYPTOALL_H +#define HEADER_CRYPTOALL_H + +#include "buffer.h" +#include "stack.h" +#include "lhash.h" + +#include "err.h" + +#ifdef NO_MD2 +#include <md2.h> +#else +#include "md2.h" +#endif +#ifdef NO_MD5 +#include <md5.h> +#else +#include "md5.h" +#endif +#include "sha.h" + +#ifdef NO_DES +#include <des.h> +#else +#include "des.h" +#endif +#include "rc2.h" +#include "rc4.h" +#include "idea.h" + +#include "bn.h" +#include "dh.h" +#include "rsa.h" +#include "dsa.h" + +#include "rand.h" +#include "conf.h" +#include "txt_db.h" + +#include "err.h" +#include "evp.h" + +#include "meth.h" +#include "x509.h" +#include "pkcs7.h" +#include "pem.h" +#include "asn1.h" +#include "objects.h" + +#include "crypto.h" + +#endif diff --git a/src/lib/libssl/src/crypto/crypto.c b/src/lib/libssl/src/crypto/crypto.c new file mode 100644 index 0000000000..366e25c939 --- /dev/null +++ b/src/lib/libssl/src/crypto/crypto.c @@ -0,0 +1,575 @@ +/* crypto/crypto.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* If you are happy to use the assmbler version of bn/bn_mulw.c, define + * BN_ASM */ +#ifndef BN_ASM +#undef BN_ASM +#define X86_ASM +#endif + +#ifndef DES_ASM +#undef DES_ASM +#endif + +#ifndef BF_ASM +#undef BF_ASM +#endif + +/* The following defines are only to break the compiles into chunks. + * If you wish to not compile some sections, use the 'NO_XXX' macros + */ +#ifndef CRYPTO_SUBSET +/* Define all subset symbols. */ +#define CRYPTO_LIB_SUBSET +#define CRYPTO_ASN1_SUBSET +#define CRYPTO_BN_SUBSET +#define CRYPTO_BUFFER_SUBSET +#define CRYPTO_BIO_SUBSET +#define CRYPTO_CONF_SUBSET +#define CRYPTO_DES_SUBSET +#define CRYPTO_DH_SUBSET +#define CRYPTO_DSA_SUBSET +#define CRYPTO_ERROR_SUBSET +#define CRYPTO_EVP_SUBSET +#define CRYPTO_IDEA_SUBSET +#define CRYPTO_LHASH_SUBSET +#define CRYPTO_MD_SUBSET +#define CRYPTO_MDC2_SUBSET +#define CRYPTO_METH_SUBSET +#define CRYPTO_OBJECTS_SUBSET +#define CRYPTO_PEM_SUBSET +#define CRYPTO_RAND_SUBSET +#define CRYPTO_RC_SUBSET +#define CRYPTO_BLOWFISH_SUBSET +#define CRYPTO_CAST_SUBSET +#define CRYPTO_RSA_SUBSET +#define CRYPTO_SHA_SUBSET +#define CRYPTO_HMAC_SUBSET +#define CRYPTO_SHA1_SUBSET +#define CRYPTO_STACK_SUBSET +#define CRYPTO_TXT_DB_SUBSET +#define CRYPTO_X509_SUBSET +#define CRYPTO_PKCS7_SUBSET +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define USE_SOCKETS +#include "../e_os.h" + +#include "buffer.h" +#include "bio.h" +#include "stack.h" +#include "lhash.h" + +#include "err.h" + +#include "bn.h" +#include "evp.h" + +#include "rand.h" +#include "conf.h" +#include "txt_db.h" + +#include "x509.h" +#include "pkcs7.h" +#include "pem.h" +#include "asn1.h" +#include "objects.h" + +#ifdef CRYPTO_LIB_SUBSET +#include "cryptlib.c" +#include "mem.c" +#include "cversion.c" +#endif + +#ifdef CRYPTO_ASN1_SUBSET +#include "asn1/a_meth.c" +#include "asn1/a_bitstr.c" +#include "asn1/a_d2i_fp.c" +#include "asn1/a_dup.c" +#include "asn1/a_hdr.c" +#include "asn1/a_i2d_fp.c" +#include "asn1/a_int.c" +#include "asn1/a_bool.c" +#include "asn1/a_bytes.c" +#include "asn1/a_object.c" +#include "asn1/a_octet.c" +#include "asn1/a_print.c" +#include "asn1/a_set.c" +#include "asn1/a_sign.c" +#include "asn1/a_type.c" +#include "asn1/a_utctm.c" +#include "asn1/a_verify.c" +#include "asn1/a_digest.c" +#include "asn1/asn1_err.c" +#include "asn1/asn1_lib.c" +#include "asn1/asn1_par.c" +#ifndef NO_DH +#include "asn1/d2i_dhp.c" +#include "asn1/i2d_dhp.c" +#endif +#ifndef NO_DSA +#include "asn1/d2i_dsap.c" +#include "asn1/i2d_dsap.c" +#include "asn1/d2i_s_pr.c" +#include "asn1/i2d_s_pr.c" +#include "asn1/d2i_s_pu.c" +#include "asn1/i2d_s_pu.c" +#endif +#ifndef NO_RSA +#include "asn1/d2i_r_pr.c" +#include "asn1/i2d_r_pr.c" +#include "asn1/d2i_r_pu.c" +#include "asn1/i2d_r_pu.c" +#include "asn1/n_pkey.c" +#endif +#include "asn1/d2i_pr.c" +#include "asn1/d2i_pu.c" +#include "asn1/i2d_pr.c" +#include "asn1/i2d_pu.c" +#include "asn1/f_int.c" +#include "asn1/f_string.c" +#include "asn1/p7_dgst.c" +#include "asn1/p7_enc.c" +#include "asn1/p7_enc_c.c" +#include "asn1/p7_evp.c" +#include "asn1/p7_i_s.c" +#include "asn1/p7_lib.c" +#include "asn1/p7_recip.c" +#include "asn1/p7_s_e.c" +#include "asn1/p7_signd.c" +#include "asn1/p7_signi.c" +#include "asn1/t_pkey.c" +#include "asn1/t_req.c" +#include "asn1/t_x509.c" +#include "asn1/x_algor.c" +#include "asn1/x_attrib.c" +#include "asn1/x_exten.c" +#include "asn1/x_cinf.c" +#include "asn1/x_crl.c" +#include "asn1/x_info.c" +#include "asn1/x_name.c" +#include "asn1/x_pkey.c" +#include "asn1/x_pubkey.c" +#include "asn1/x_req.c" +#include "asn1/x_sig.c" +#include "asn1/x_spki.c" +#include "asn1/x_val.c" +#include "asn1/x_x509.c" +#endif + +#ifdef CRYPTO_BN_SUBSET +#include "bn/bn_add.c" +#include "bn/bn_div.c" +#include "bn/bn_exp.c" +#include "bn/bn_mont.c" +#include "bn/bn_recp.c" +#include "bn/bn_gcd.c" +#include "bn/bn_lib.c" +#include "bn/bn_mod.c" +#include "bn/bn_mul.c" +#ifndef BN_ASM +#include "bn/bn_mulw.c" +#endif +#include "bn/bn_prime.c" +#include "bn/bn_rand.c" +#include "bn/bn_shift.c" +#include "bn/bn_sqr.c" +#include "bn/bn_sub.c" +#include "bn/bn_word.c" +#include "bn/bn_print.c" +#include "bn/bn_err.c" +#include "bn/bn_blind.c" +#endif + +#ifdef CRYPTO_BIO_SUBSET +#include "bio/bf_buff.c" +#include "bio/bf_null.c" +#include "bio/bf_nbio.c" +#include "bio/bio_cb.c" +#include "bio/bio_lib.c" +#include "bio/bss_fd.c" +#include "bio/bss_file.c" +#include "bio/bss_mem.c" +#include "bio/bss_null.c" +#ifdef VMS +#include "bio/bss_rtcp.c" +#endif +#include "bio/bss_sock.c" +#include "bio/bss_conn.c" +#include "bio/bss_acpt.c" +#include "bio/b_sock.c" +#include "bio/b_print.c" +#include "bio/b_dump.c" +#include "bio/bio_err.c" +#endif + +#ifdef CRYPTO_BUFFER_SUBSET +#include "buffer/buf_err.c" +#include "buffer/buffer.c" +#endif + +#ifdef CRYPTO_CONF_SUBSET +#include "conf/conf.c" +#include "conf/conf_err.c" +#endif + +#ifdef CRYPTO_DES_SUBSET +#include "des/read_pwd.c" +#ifndef NO_DES +#ifndef DES_ASM +#include "des/fcrypt_b.c" +#include "des/des_enc.c" +#endif +#include "des/cbc_cksm.c" +#include "des/xcbc_enc.c" +#include "des/cbc_enc.c" +#include "des/cfb64ede.c" +#include "des/cfb64enc.c" +#include "des/cfb_enc.c" +#include "des/ecb3_enc.c" +#include "des/ecb_enc.c" +#include "des/enc_read.c" +#include "des/enc_writ.c" +#include "des/fcrypt.c" +#include "des/ofb64ede.c" +#include "des/ofb64enc.c" +#include "des/ofb_enc.c" +#include "des/pcbc_enc.c" +#include "des/qud_cksm.c" +#include "des/rand_key.c" +#include "des/read2pwd.c" +#include "des/rpc_enc.c" +#include "des/set_key.c" +#include "des/str2key.c" +#include "des/supp.c" +#endif +#endif + +#ifdef CRYPTO_DH_SUBSET +#ifndef NO_DH +#include "dh/dh_check.c" +#include "dh/dh_err.c" +#include "dh/dh_gen.c" +#include "dh/dh_key.c" +#include "dh/dh_lib.c" +#endif +#endif + +#ifdef CRYPTO_DSA_SUBSET +#ifndef NO_DSA +#include "dsa/dsa_gen.c" +#include "dsa/dsa_key.c" +#include "dsa/dsa_lib.c" +#include "dsa/dsa_sign.c" +#include "dsa/dsa_vrf.c" +#include "dsa/dsa_err.c" +#endif +#endif + +#ifdef CRYPTO_ERROR_SUBSET +#include "err/err.c" +#include "err/err_all.c" +#include "err/err_prn.c" +#endif + +#ifdef CRYPTO_EVP_SUBSET +#include "evp/bio_md.c" +#include "evp/bio_b64.c" +#include "evp/bio_enc.c" +#include "evp/c_all.c" +#include "evp/digest.c" +#ifndef NO_DES +#include "evp/e_cbc_3d.c" +#include "evp/e_cfb_3d.c" +#include "evp/e_ecb_3d.c" +#include "evp/e_ofb_3d.c" +#include "evp/e_cbc_d.c" +#include "evp/e_cfb_d.c" +#include "evp/e_xcbc_d.c" +#include "evp/e_ecb_d.c" +#include "evp/e_ofb_d.c" +#endif +#ifndef NO_IDEA +#include "evp/e_cbc_i.c" +#include "evp/e_cfb_i.c" +#include "evp/e_ecb_i.c" +#include "evp/e_ofb_i.c" +#endif +#ifndef NO_RC2 +#include "evp/e_cbc_r2.c" +#include "evp/e_cfb_r2.c" +#include "evp/e_ecb_r2.c" +#include "evp/e_ofb_r2.c" +#endif +#ifndef NO_BLOWFISH +#include "evp/e_cbc_bf.c" +#include "evp/e_cfb_bf.c" +#include "evp/e_ecb_bf.c" +#include "evp/e_ofb_bf.c" +#endif +#ifndef NO_CAST +#include "evp/e_cbc_c.c" +#include "evp/e_cfb_c.c" +#include "evp/e_ecb_c.c" +#include "evp/e_ofb_c.c" +#endif +#ifndef NO_RC4 +#include "evp/e_rc4.c" +#endif +#include "rc5/rc5_enc.c" +#include "rc5/rc5cfb64.c" +#include "rc5/rc5_ecb.c" +#include "rc5/rc5_skey.c" +#include "rc5/rc5ofb64.c" +#include "ripemd/rmd160.c" +#include "ripemd/rmd_dgst.c" +#include "ripemd/rmd_one.c" +#include "evp/evp_lib.c" + +#include "evp/names.c" +#include "evp/e_null.c" +#include "evp/encode.c" +#include "evp/evp_enc.c" +#include "evp/evp_err.c" +#include "evp/evp_key.c" +#include "evp/m_null.c" +#include "evp/p_lib.c" +#ifndef NO_RSA +#include "evp/p_open.c" +#include "evp/p_seal.c" +#endif +#include "evp/p_sign.c" +#include "evp/p_verify.c" +#endif + +#ifdef CRYPTO_IDEA_SUBSET +#ifndef NO_IDEA +#include "idea/i_cbc.c" +#include "idea/i_cfb64.c" +#include "idea/i_ecb.c" +#include "idea/i_ofb64.c" +#include "idea/i_skey.c" +#endif +#endif + +#ifdef CRYPTO_BLOWFISH_SUBSET +#ifndef NO_BLOWFISH +#include "bf/bf_cfb64.c" +#include "bf/bf_ecb.c" +#ifndef BF_ASM +#include "bf/bf_enc.c" +#endif +#include "bf/bf_ofb64.c" +#include "bf/bf_skey.c" +#endif +#endif + +#ifdef CRYPTO_CAST_SUBSET +#ifndef NO_CAST +#include "cast/c_cfb64.c" +#include "cast/c_ecb.c" +#ifndef CAST_ASM +#include "cast/c_enc.c" +#endif +#include "cast/c_ofb64.c" +#include "cast/c_skey.c" +#endif +#endif + +#ifdef CRYPTO_LHASH_SUBSET +#include "lhash/lh_stats.c" +#include "lhash/lhash.c" +#endif + +#ifdef CRYPTO_MD_SUBSET +#ifndef NO_MD2 +#include "md2/md2_dgst.c" +#include "md2/md2_one.c" +#include "evp/m_md2.c" +#endif +#ifndef NO_MD5 +#include "md5/md5_dgst.c" +#include "md5/md5_one.c" +#include "evp/m_md5.c" +#endif +#endif + +#ifdef CRYPTO_MDC2_SUBSET +#ifndef NO_MDC2 +#include "mdc2/mdc2dgst.c" +#include "mdc2/mdc2_one.c" +#include "evp/m_mdc2.c" +#endif +#endif + +#ifdef CRYPTO_OBJECTS_SUBSET +#include "objects/obj_dat.c" +#include "objects/obj_err.c" +#include "objects/obj_lib.c" +#endif + +#ifdef CRYPTO_PEM_SUBSET +#include "pem/pem_err.c" +#include "pem/pem_info.c" +#include "pem/pem_lib.c" +#include "pem/pem_all.c" +#ifndef NO_RSA +#include "pem/pem_seal.c" +#include "pem/pem_sign.c" +#endif +#endif + +#ifdef CRYPTO_RAND_SUBSET +#include "rand/md_rand.c" +#include "rand/randfile.c" +#endif + +#ifdef CRYPTO_RC_SUBSET +#ifndef NO_RC2 +#include "rc2/rc2_cbc.c" +#include "rc2/rc2_ecb.c" +#include "rc2/rc2_skey.c" +#include "rc2/rc2cfb64.c" +#include "rc2/rc2ofb64.c" +#endif +#ifndef NO_RC4 +#include "rc4/rc4_skey.c" +#ifndef RC4_ASM +#include "rc4/rc4_enc.c" +#endif +#endif +#endif + +#ifdef CRYPTO_HMAC_SUBSET +#include "hmac/hmac.c" +#endif + +#ifdef CRYPTO_RSA_SUBSET +#ifndef NO_RSA +#include "rsa/rsa_eay.c" +#include "rsa/rsa_err.c" +#include "rsa/rsa_gen.c" +#include "rsa/rsa_lib.c" +#include "rsa/rsa_sign.c" +#include "rsa/rsa_saos.c" +#endif +#endif + +#ifdef CRYPTO_SHA1_SUBSET +#ifndef NO_SHA1 +#include "sha/sha1_one.c" +#include "sha/sha1dgst.c" +#include "evp/m_dss1.c" +#include "evp/m_sha1.c" +#endif +#endif + +#ifdef CRYPTO_SHA_SUBSET +#ifndef NO_SHA +#include "evp/m_dss.c" +#include "sha/sha_dgst.c" +#include "sha/sha_one.c" +#include "evp/m_sha.c" +#endif +#endif + +#ifdef CRYPTO_STACK_SUBSET +#include "stack/stack.c" +#endif + +#ifdef CRYPTO_TXT_DB_SUBSET +#include "txt_db/txt_db.c" +#endif + +#ifdef CRYPTO_X509_SUBSET +#include "x509/x509_cmp.c" +#include "x509/x509_d2.c" +#include "x509/x509_def.c" +#include "x509/x509_err.c" +#include "x509/x509_ext.c" +#include "x509/x509_lu.c" +#include "x509/x509_obj.c" +#include "x509/x509_r2x.c" +#include "x509/x509_req.c" +#include "x509/x509_set.c" +#include "x509/x509_v3.c" +#include "x509/x509_vfy.c" +#include "x509/x509name.c" +#include "x509/x509pack.c" +#include "x509/x509rset.c" +#include "x509/x509type.c" +#include "x509/x_all.c" +#include "x509/x509_txt.c" +#include "x509/by_dir.c" +#include "x509/by_file.c" +#include "x509/v3_net.c" +#include "x509/v3_x509.c" +#endif + + +#ifdef CRYPTO_PKCS7_SUBSET /* I have an explicit removal of 7 lines */ +#include "pkcs7/pk7_lib.c" +#include "pkcs7/pkcs7err.c" +#include "pkcs7/pk7_doit.c" +#endif /* CRYPTO_PKCS7_SUBSET */ + diff --git a/src/lib/libssl/src/crypto/crypto.err b/src/lib/libssl/src/crypto/crypto.err new file mode 100644 index 0000000000..4ea3385e73 --- /dev/null +++ b/src/lib/libssl/src/crypto/crypto.err @@ -0,0 +1,8 @@ +/* Error codes for the CRYPTO functions. */ + +/* Function codes. */ +#define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 +#define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101 +#define CRYPTO_F_CRYPTO_SET_EX_DATA 102 + +/* Reason codes. */ diff --git a/src/lib/libssl/src/crypto/date.h b/src/lib/libssl/src/crypto/date.h new file mode 100644 index 0000000000..dbb71bd1b7 --- /dev/null +++ b/src/lib/libssl/src/crypto/date.h @@ -0,0 +1 @@ +#define DATE "Sun Jul 12 21:04:32 MDT 1998" diff --git a/src/lib/libssl/src/crypto/des/DES.pod b/src/lib/libssl/src/crypto/des/DES.pod new file mode 100644 index 0000000000..8a739e7ca0 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/DES.pod @@ -0,0 +1,16 @@ +crypt <= crypt(buf,salt) +key <= set_odd_parity(key) +int <= is_weak_key(key) +keysched<= set_key(key) +key <= ecb_encrypt(string8,ks,enc) +key <= ecb3_encrypt(input,ks1,ks2,enc) +string <= cbc_encrypt(input,ks,ivec,enc) => ivec +string <= cbc3_encrypt(input,ks1,ks2,ivec1,ivec2,enc) => ivec1&ivec2 +ck1,ck2 <= cbc_cksum(input,ks,ivec) => ivec +string <= pcbc_encrypt(input,ks,ivec,enc) => ivec +string <= ofb_encrypt(input,numbits,ks,ivec) => ivec +string <= cfb_encrypt(input,numbits,ks,ivec,enc) => ivec +key <= random_key() +key <= string_to_key(string) +key1,key2<= string_to_2keys(string) + diff --git a/src/lib/libssl/src/crypto/des/MODES.DES b/src/lib/libssl/src/crypto/des/MODES.DES new file mode 100644 index 0000000000..0cbc44f51d --- /dev/null +++ b/src/lib/libssl/src/crypto/des/MODES.DES @@ -0,0 +1,84 @@ +Modes of DES +Quite a bit of the following information has been taken from + AS 2805.5.2 + Australian Standard + Electronic funds transfer - Requirements for interfaces, + Part 5.2: Modes of operation for an n-bit block cipher algorithm + Appendix A + +There are several different modes in which DES can be used, they are +as follows. + +Electronic Codebook Mode (ECB) (des_ecb_encrypt()) +- 64 bits are enciphered at a time. +- The order of the blocks can be rearranged without detection. +- The same plaintext block always produces the same ciphertext block + (for the same key) making it vulnerable to a 'dictionary attack'. +- An error will only affect one ciphertext block. + +Cipher Block Chaining Mode (CBC) (des_cbc_encrypt()) +- a multiple of 64 bits are enciphered at a time. +- The CBC mode produces the same ciphertext whenever the same + plaintext is encrypted using the same key and starting variable. +- The chaining operation makes the ciphertext blocks dependent on the + current and all preceding plaintext blocks and therefore blocks can not + be rearranged. +- The use of different starting variables prevents the same plaintext + enciphering to the same ciphertext. +- An error will affect the current and the following ciphertext blocks. + +Cipher Feedback Mode (CFB) (des_cfb_encrypt()) +- a number of bits (j) <= 64 are enciphered at a time. +- The CFB mode produces the same ciphertext whenever the same + plaintext is encrypted using the same key and starting variable. +- The chaining operation makes the ciphertext variables dependent on the + current and all preceding variables and therefore j-bit variables are + chained together and con not be rearranged. +- The use of different starting variables prevents the same plaintext + enciphering to the same ciphertext. +- The strength of the CFB mode depends on the size of k (maximal if + j == k). In my implementation this is always the case. +- Selection of a small value for j will require more cycles through + the encipherment algorithm per unit of plaintext and thus cause + greater processing overheads. +- Only multiples of j bits can be enciphered. +- An error will affect the current and the following ciphertext variables. + +Output Feedback Mode (OFB) (des_ofb_encrypt()) +- a number of bits (j) <= 64 are enciphered at a time. +- The OFB mode produces the same ciphertext whenever the same + plaintext enciphered using the same key and starting variable. More + over, in the OFB mode the same key stream is produced when the same + key and start variable are used. Consequently, for security reasons + a specific start variable should be used only once for a given key. +- The absence of chaining makes the OFB more vulnerable to specific attacks. +- The use of different start variables values prevents the same + plaintext enciphering to the same ciphertext, by producing different + key streams. +- Selection of a small value for j will require more cycles through + the encipherment algorithm per unit of plaintext and thus cause + greater processing overheads. +- Only multiples of j bits can be enciphered. +- OFB mode of operation does not extend ciphertext errors in the + resultant plaintext output. Every bit error in the ciphertext causes + only one bit to be in error in the deciphered plaintext. +- OFB mode is not self-synchronising. If the two operation of + encipherment and decipherment get out of synchronism, the system needs + to be re-initialised. +- Each re-initialisation should use a value of the start variable +different from the start variable values used before with the same +key. The reason for this is that an identical bit stream would be +produced each time from the same parameters. This would be +susceptible to a 'known plaintext' attack. + +Triple ECB Mode (des_ecb3_encrypt()) +- Encrypt with key1, decrypt with key2 and encrypt with key1 again. +- As for ECB encryption but increases the effective key length to 112 bits. +- If both keys are the same it is equivalent to encrypting once with + just one key. + +Triple CBC Mode (des_3cbc_encrypt()) +- Encrypt with key1, decrypt with key2 and encrypt with key1 again. +- As for CBC encryption but increases the effective key length to 112 bits. +- If both keys are the same it is equivalent to encrypting once with + just one key. diff --git a/src/lib/libssl/src/crypto/des/Makefile.PL b/src/lib/libssl/src/crypto/des/Makefile.PL new file mode 100644 index 0000000000..b54a24387c --- /dev/null +++ b/src/lib/libssl/src/crypto/des/Makefile.PL @@ -0,0 +1,14 @@ +use ExtUtils::MakeMaker; +# See lib/ExtUtils/MakeMaker.pm for details of how to influence +# the contents of the Makefile being created. +&writeMakefile( + 'potential_libs' => '', # e.g., '-lm' + 'INC' => '', # e.g., '-I/usr/include/other' + 'DISTNAME' => 'DES', + 'VERSION' => '0.1', + 'DEFINE' => '-DPERL5', + 'OBJECT' => 'DES.o cbc_cksm.o cbc_enc.o ecb_enc.o pcbc_enc.o \ + rand_key.o set_key.o str2key.o \ + enc_read.o enc_writ.o fcrypt.o cfb_enc.o \ + ecb3_enc.o ofb_enc.o cbc3_enc.o des_enc.o', + ); diff --git a/src/lib/libssl/src/crypto/des/Makefile.lit b/src/lib/libssl/src/crypto/des/Makefile.lit new file mode 100644 index 0000000000..c09f6969da --- /dev/null +++ b/src/lib/libssl/src/crypto/des/Makefile.lit @@ -0,0 +1,250 @@ +# You must select the correct terminal control system to be used to +# turn character echo off when reading passwords. There a 5 systems +# SGTTY - the old BSD system +# TERMIO - most system V boxes +# TERMIOS - SGI (ala IRIX). +# VMS - the DEC operating system +# MSDOS - we all know what it is :-) +# read_pwd.c makes a reasonable guess at what is correct. + +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +# If you are on a DEC Alpha, edit des.h and change the DES_LONG +# define to 'unsigned int'. I have seen this give a %20 speedup. + +OPTS0= -DLIBDES_LIT -DRAND -DTERMIO #-DNOCONST + +# Version 1.94 has changed the strings_to_key function so that it is +# now compatible with MITs when the string is longer than 8 characters. +# If you wish to keep the old version, uncomment the following line. +# This will affect the -E/-D options on des(1). +#OPTS1= -DOLD_STR_TO_KEY + +# There are 4 possible performance options +# -DDES_PTR +# -DDES_RISC1 +# -DDES_RISC2 (only one of DES_RISC1 and DES_RISC2) +# -DDES_UNROLL +# after the initial build, run 'des_opts' to see which options are best +# for your platform. There are some listed in options.txt +#OPTS2= -DDES_PTR +#OPTS3= -DDES_RISC1 # or DES_RISC2 +#OPTS4= -DDES_UNROLL + +OPTS= $(OPTS0) $(OPTS1) $(OPTS2) $(OPTS3) $(OPTS4) + +MAKE=make -f Makefile +#CC=cc +#CFLAG= -O + +CC=gcc +#CFLAG= -O4 -funroll-loops -fomit-frame-pointer +CFLAG= -O3 -fomit-frame-pointer + +CFLAGS=$(OPTS) $(CFLAG) +CPP=$(CC) -E +AS=as + +# Assember version of des_encrypt*(). +DES_ENC=des_enc.o fcrypt_b.o # normal C version +#DES_ENC=asm/dx86-elf.o asm/yx86-elf.o # elf format x86 +#DES_ENC=asm/dx86-out.o asm/yx86-out.o # a.out format x86 +#DES_ENC=asm/dx86-sol.o asm/yx86-sol.o # solaris format x86 +#DES_ENC=asm/dx86bsdi.o asm/yx86basi.o # bsdi format x86 + +LIBDIR=/usr/local/lib +BINDIR=/usr/local/bin +INCDIR=/usr/local/include +MANDIR=/usr/local/man +MAN1=1 +MAN3=3 +SHELL=/bin/sh +OBJ_LIT=cbc_enc.o ecb_enc.o $(DES_ENC) fcrypt.o set_key.o +OBJ_FULL=cbc_cksm.o $(OBJ_LIT) pcbc_enc.o \ + xcbc_enc.o qud_cksm.o \ + cfb64ede.o cfb64enc.o cfb_enc.o ecb3_enc.o \ + enc_read.o enc_writ.o ofb64ede.o ofb64enc.o ofb_enc.o \ + rand_key.o read_pwd.o read2pwd.o rpc_enc.o str2key.o supp.o + +GENERAL_LIT=COPYRIGHT INSTALL README VERSION Makefile des_crypt.man \ + des.doc options.txt asm +GENERAL_FULL=$(GENERAL_LIT) FILES Imakefile times vms.com KERBEROS MODES.DES \ + des.man DES.pm DES.pod DES.xs Makefile.PL dess.cpp des3s.cpp \ + Makefile.uni typemap t Makefile.ssl makefile.bc Makefile.lit \ + des.org des_locl.org +TESTING_LIT= destest speed des_opts +TESTING_FULL= rpw $(TESTING_LIT) +TESTING_SRC_LIT=destest.c speed.c des_opts.c +TESTING_SRC_FULL=rpw.c $(TESTING_SRC_LIT) +HEADERS_LIT=des_ver.h des.h des_locl.h podd.h sk.h spr.h +HEADERS_FULL= $(HEADERS_LIT) rpc_des.h +LIBDES_LIT=cbc_enc.c ecb_enc.c fcrypt.c set_key.c des_enc.c fcrypt_b.c +LIBDES_FULL= cbc_cksm.c pcbc_enc.c qud_cksm.c \ + cfb64ede.c cfb64enc.c cfb_enc.c ecb3_enc.c \ + enc_read.c enc_writ.c ofb64ede.c ofb64enc.c ofb_enc.c \ + rand_key.c rpc_enc.c str2key.c supp.c \ + xcbc_enc.c $(LIBDES_LIT) read_pwd.c read2pwd.c + +PERL= des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl + +OBJ= $(OBJ_LIT) +GENERAL=$(GENERAL_LIT) +TESTING=$(TESTING_LIT) +TESTING_SRC=$(TESTING_SRC_LIT) +HEADERS=$(HEADERS_LIT) +LIBDES= $(LIBDES_LIT) + +ALL= $(GENERAL) $(TESTING_SRC) $(LIBDES) $(PERL) $(HEADERS) + +DLIB= libdes.a + +all: $(DLIB) $(TESTING) + +cc: + $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all + +gcc: + $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all + +x86-elf: + $(MAKE) DES_ENC='asm/dx86-elf.o asm/yx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all + +x86-out: + $(MAKE) DES_ENC='asm/dx86-out.o asm/yx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all + +x86-solaris: + $(MAKE) DES_ENC='asm/dx86-sol.o asm/yx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all + +x86-bsdi: + $(MAKE) DES_ENC='asm/dx86bsdi.o asm/yx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all + +# elf +asm/dx86-elf.o: asm/dx86unix.cpp + $(CPP) -DELF asm/dx86unix.cpp | $(AS) -o asm/dx86-elf.o + +asm/yx86-elf.o: asm/yx86unix.cpp + $(CPP) -DELF asm/yx86unix.cpp | $(AS) -o asm/yx86-elf.o + +# solaris +asm/dx86-sol.o: asm/dx86unix.cpp + $(CC) -E -DSOL asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s + as -o asm/dx86-sol.o asm/dx86-sol.s + rm -f asm/dx86-sol.s + +asm/yx86-sol.o: asm/yx86unix.cpp + $(CC) -E -DSOL asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s + as -o asm/yx86-sol.o asm/yx86-sol.s + rm -f asm/yx86-sol.s + +# a.out +asm/dx86-out.o: asm/dx86unix.cpp + $(CPP) -DOUT asm/dx86unix.cpp | $(AS) -o asm/dx86-out.o + +asm/yx86-out.o: asm/yx86unix.cpp + $(CPP) -DOUT asm/yx86unix.cpp | $(AS) -o asm/yx86-out.o + +# bsdi +asm/dx86bsdi.o: asm/dx86unix.cpp + $(CPP) -DBSDI asm/dx86unix.cpp | $(AS) -o asm/dx86bsdi.o + +asm/yx86bsdi.o: asm/yx86unix.cpp + $(CPP) -DBSDI asm/yx86unix.cpp | $(AS) -o asm/yx86bsdi.o + +asm/dx86unix.cpp: + (cd asm; perl des-586.pl cpp >dx86unix.cpp) + +asm/yx86unix.cpp: + (cd asm; perl crypt586.pl cpp >yx86unix.cpp) + +test: all + ./destest + +$(DLIB): $(OBJ) + /bin/rm -f $(DLIB) + ar cr $(DLIB) $(OBJ) + -if test -s /bin/ranlib; then /bin/ranlib $(DLIB); \ + else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(DLIB); \ + else exit 0; fi; fi + +des_opts: des_opts.o $(DLIB) + $(CC) $(CFLAGS) -o des_opts des_opts.o $(DLIB) + +destest: destest.o $(DLIB) + $(CC) $(CFLAGS) -o destest destest.o $(DLIB) + +rpw: rpw.o $(DLIB) + $(CC) $(CFLAGS) -o rpw rpw.o $(DLIB) + +speed: speed.o $(DLIB) + $(CC) $(CFLAGS) -o speed speed.o $(DLIB) + +des: des.o $(DLIB) + $(CC) $(CFLAGS) -o des des.o $(DLIB) + +tags: + ctags $(TESTING_SRC) $(LIBDES) + +tar_lit: + /bin/mv Makefile Makefile.tmp + /bin/cp Makefile.lit Makefile + tar chf libdes-l.tar $(LIBDES_LIT) $(HEADERS_LIT) \ + $(GENERAL_LIT) $(TESTING_SRC_LIT) + /bin/rm -f Makefile + /bin/mv Makefile.tmp Makefile + +tar: + tar chf libdes.tar $(ALL) + +shar: + shar $(ALL) >libdes.shar + +depend: + makedepend $(LIBDES) $(TESTING_SRC) + +clean: + /bin/rm -f *.o tags core $(TESTING) $(DLIB) .nfs* *.old *.bak asm/*.o + +dclean: + sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new + mv -f Makefile.new Makefile + +# Eric is probably going to choke when he next looks at this --tjh +install: + if test $(INSTALLTOP); then \ + echo SSL style install; \ + cp $(DLIB) $(INSTALLTOP)/lib; \ + if test -s /bin/ranlib; then \ + /bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ + else \ + if test -s /usr/bin/ranlib; then \ + /usr/bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ + fi; fi; \ + chmod 644 $(INSTALLTOP)/lib/$(DLIB); \ + cp des.h $(INSTALLTOP)/include; \ + chmod 644 $(INSTALLTOP)/include/des.h; \ + else \ + echo Standalone install; \ + cp $(DLIB) $(LIBDIR)/$(DLIB); \ + if test -s /bin/ranlib; then \ + /bin/ranlib $(LIBDIR)/$(DLIB); \ + else \ + if test -s /usr/bin/ranlib; then \ + /usr/bin/ranlib $(LIBDIR)/$(DLIB); \ + fi; \ + fi; \ + chmod 644 $(LIBDIR)/$(DLIB); \ + cp des_crypt.man $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ + chmod 644 $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ + cp des.man $(MANDIR)/man$(MAN1)/des.$(MAN1); \ + chmod 644 $(MANDIR)/man$(MAN1)/des.$(MAN1); \ + cp des.h $(INCDIR)/des.h; \ + chmod 644 $(INCDIR)/des.h; \ + fi +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libssl/src/crypto/des/Makefile.uni b/src/lib/libssl/src/crypto/des/Makefile.uni new file mode 100644 index 0000000000..8f1759748a --- /dev/null +++ b/src/lib/libssl/src/crypto/des/Makefile.uni @@ -0,0 +1,263 @@ +# You must select the correct terminal control system to be used to +# turn character echo off when reading passwords. There a 5 systems +# SGTTY - the old BSD system +# TERMIO - most system V boxes +# TERMIOS - SGI (ala IRIX). +# VMS - the DEC operating system +# MSDOS - we all know what it is :-) +# read_pwd.c makes a reasonable guess at what is correct. + +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +# If you are on a DEC Alpha, edit des.h and change the DES_LONG +# define to 'unsigned int'. I have seen this give a %20 speedup. + +OPTS0= -DRAND -DTERMIO #-DNOCONST + +# Version 1.94 has changed the strings_to_key function so that it is +# now compatible with MITs when the string is longer than 8 characters. +# If you wish to keep the old version, uncomment the following line. +# This will affect the -E/-D options on des(1). +#OPTS1= -DOLD_STR_TO_KEY + +# There are 4 possible performance options +# -DDES_PTR +# -DDES_RISC1 +# -DDES_RISC2 (only one of DES_RISC1 and DES_RISC2) +# -DDES_UNROLL +# after the initial build, run 'des_opts' to see which options are best +# for your platform. There are some listed in options.txt +#OPTS2= -DDES_PTR +#OPTS3= -DDES_RISC1 # or DES_RISC2 +#OPTS4= -DDES_UNROLL + +OPTS= $(OPTS0) $(OPTS1) $(OPTS2) $(OPTS3) $(OPTS4) + +MAKE=make -f Makefile +#CC=cc +#CFLAG= -O + +CC=gcc +#CFLAG= -O4 -funroll-loops -fomit-frame-pointer +CFLAG= -O3 -fomit-frame-pointer + +CFLAGS=$(OPTS) $(CFLAG) +CPP=$(CC) -E +AS=as + +# Assember version of des_encrypt*(). +DES_ENC=des_enc.o fcrypt_b.o # normal C version +#DES_ENC=asm/dx86-elf.o asm/yx86-elf.o # elf format x86 +#DES_ENC=asm/dx86-out.o asm/yx86-out.o # a.out format x86 +#DES_ENC=asm/dx86-sol.o asm/yx86-sol.o # solaris format x86 +#DES_ENC=asm/dx86bsdi.o asm/yx86basi.o # bsdi format x86 + +LIBDIR=/usr/local/lib +BINDIR=/usr/local/bin +INCDIR=/usr/local/include +MANDIR=/usr/local/man +MAN1=1 +MAN3=3 +SHELL=/bin/sh +OBJ_LIT=cbc_enc.o ecb_enc.o $(DES_ENC) fcrypt.o set_key.o +OBJ_FULL=cbc_cksm.o $(OBJ_LIT) pcbc_enc.o \ + xcbc_enc.o qud_cksm.o cbc3_enc.o \ + cfb64ede.o cfb64enc.o cfb_enc.o ecb3_enc.o \ + enc_read.o enc_writ.o ofb64ede.o ofb64enc.o ofb_enc.o \ + rand_key.o read_pwd.o read2pwd.o rpc_enc.o str2key.o supp.o + +GENERAL_LIT=COPYRIGHT INSTALL README VERSION Makefile des_crypt.man \ + des.doc options.txt asm +GENERAL_FULL=$(GENERAL_LIT) FILES Imakefile times vms.com KERBEROS MODES.DES \ + des.man DES.pm DES.pod DES.xs Makefile.PL dess.cpp des3s.cpp \ + Makefile.uni typemap t Makefile.ssl makefile.bc Makefile.lit \ + des.org des_locl.org +TESTING_LIT= destest speed des_opts +TESTING_FULL= rpw des $(TESTING_LIT) +TESTING_SRC_LIT=destest.c speed.c des_opts.c +TESTING_SRC_FULL=rpw.c des.c $(TESTING_SRC_LIT) +HEADERS_LIT=des_ver.h des.h des_locl.h podd.h sk.h spr.h +HEADERS_FULL= $(HEADERS_LIT) rpc_des.h +LIBDES_LIT=cbc_enc.c ecb_enc.c fcrypt.c set_key.c des_enc.c fcrypt_b.c +LIBDES_FULL= cbc_cksm.c pcbc_enc.c qud_cksm.c cbc3_enc.c \ + cfb64ede.c cfb64enc.c cfb_enc.c ecb3_enc.c \ + enc_read.c enc_writ.c ofb64ede.c ofb64enc.c ofb_enc.c \ + rand_key.c rpc_enc.c str2key.c supp.c \ + xcbc_enc.c $(LIBDES_LIT) read_pwd.c read2pwd.c + +PERL= des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl + +OBJ= $(OBJ_FULL) +GENERAL=$(GENERAL_FULL) +TESTING=$(TESTING_FULL) +TESTING_SRC=$(TESTING_SRC_FULL) +HEADERS=$(HEADERS_FULL) +LIBDES= $(LIBDES_FULL) + +ALL= $(GENERAL) $(TESTING_SRC) $(LIBDES) $(PERL) $(HEADERS) + +DLIB= libdes.a + +all: $(DLIB) $(TESTING) + +cc: + $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all + +gcc: + $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all + +x86-elf: + $(MAKE) DES_ENC='asm/dx86-elf.o asm/yx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all + +x86-out: + $(MAKE) DES_ENC='asm/dx86-out.o asm/yx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all + +x86-solaris: + $(MAKE) DES_ENC='asm/dx86-sol.o asm/yx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all + +x86-bsdi: + $(MAKE) DES_ENC='asm/dx86bsdi.o asm/yx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all + +# elf +asm/dx86-elf.o: asm/dx86unix.cpp + $(CPP) -DELF asm/dx86unix.cpp | $(AS) -o asm/dx86-elf.o + +asm/yx86-elf.o: asm/yx86unix.cpp + $(CPP) -DELF asm/yx86unix.cpp | $(AS) -o asm/yx86-elf.o + +# solaris +asm/dx86-sol.o: asm/dx86unix.cpp + $(CC) -E -DSOL asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s + as -o asm/dx86-sol.o asm/dx86-sol.s + rm -f asm/dx86-sol.s + +asm/yx86-sol.o: asm/yx86unix.cpp + $(CC) -E -DSOL asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s + as -o asm/yx86-sol.o asm/yx86-sol.s + rm -f asm/yx86-sol.s + +# a.out +asm/dx86-out.o: asm/dx86unix.cpp + $(CPP) -DOUT asm/dx86unix.cpp | $(AS) -o asm/dx86-out.o + +asm/yx86-out.o: asm/yx86unix.cpp + $(CPP) -DOUT asm/yx86unix.cpp | $(AS) -o asm/yx86-out.o + +# bsdi +asm/dx86bsdi.o: asm/dx86unix.cpp + $(CPP) -DBSDI asm/dx86unix.cpp | $(AS) -o asm/dx86bsdi.o + +asm/yx86bsdi.o: asm/yx86unix.cpp + $(CPP) -DBSDI asm/yx86unix.cpp | $(AS) -o asm/yx86bsdi.o + +asm/dx86unix.cpp: + (cd asm; perl des-586.pl cpp >dx86unix.cpp) + +asm/yx86unix.cpp: + (cd asm; perl crypt586.pl cpp >yx86unix.cpp) + +test: all + ./destest + +$(DLIB): $(OBJ) + /bin/rm -f $(DLIB) + ar cr $(DLIB) $(OBJ) + -if test -s /bin/ranlib; then /bin/ranlib $(DLIB); \ + else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(DLIB); \ + else exit 0; fi; fi + +des_opts: des_opts.o $(DLIB) + $(CC) $(CFLAGS) -o des_opts des_opts.o $(DLIB) + +destest: destest.o $(DLIB) + $(CC) $(CFLAGS) -o destest destest.o $(DLIB) + +rpw: rpw.o $(DLIB) + $(CC) $(CFLAGS) -o rpw rpw.o $(DLIB) + +speed: speed.o $(DLIB) + $(CC) $(CFLAGS) -o speed speed.o $(DLIB) + +des: des.o $(DLIB) + $(CC) $(CFLAGS) -o des des.o $(DLIB) + +tags: + ctags $(TESTING_SRC) $(LIBDES) + +tar_lit: + /bin/mv Makefile Makefile.tmp + /bin/cp Makefile.lit Makefile + for i in $(HEADERS_LIT) $(LIBDES_LIT) $(GENERAL_LIT) $(TESTING_SRC_LIT) ;\ + do \ + n="$$n des/$$i"; \ + done; \ + ( cd .. ; tar chf - $$n )| gzip > libdes-l.tgz + /bin/rm -f Makefile + /bin/mv Makefile.tmp Makefile + +tar: + mv Makefile Makefile.tmp + /bin/cp Makefile.uni Makefile + for i in $(ALL) ;\ + do \ + n="$$n des/$$i"; \ + done; \ + ( cd .. ; tar chf - $$n )| gzip > libdes.tgz + /bin/rm -f Makefile + /bin/mv Makefile.tmp Makefile + +shar: + shar $(ALL) >libdes.shar + +depend: + makedepend $(LIBDES) $(TESTING_SRC) + +clean: + /bin/rm -f *.o tags core $(TESTING) $(DLIB) .nfs* *.old *.bak asm/*.o + +dclean: + sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new + mv -f Makefile.new Makefile + +# Eric is probably going to choke when he next looks at this --tjh +install: des + if test $(INSTALLTOP); then \ + echo SSL style install; \ + cp $(DLIB) $(INSTALLTOP)/lib; \ + if test -s /bin/ranlib; then \ + /bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ + else \ + if test -s /usr/bin/ranlib; then \ + /usr/bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ + fi; fi; \ + chmod 644 $(INSTALLTOP)/lib/$(DLIB); \ + cp des.h $(INSTALLTOP)/include; \ + chmod 644 $(INSTALLTOP)/include/des.h; \ + else \ + echo Standalone install; \ + cp $(DLIB) $(LIBDIR)/$(DLIB); \ + if test -s /bin/ranlib; then \ + /bin/ranlib $(LIBDIR)/$(DLIB); \ + else \ + if test -s /usr/bin/ranlib; then \ + /usr/bin/ranlib $(LIBDIR)/$(DLIB); \ + fi; \ + fi; \ + chmod 644 $(LIBDIR)/$(DLIB); \ + cp des $(BINDIR)/des; \ + chmod 711 $(BINDIR)/des; \ + cp des_crypt.man $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ + chmod 644 $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ + cp des.man $(MANDIR)/man$(MAN1)/des.$(MAN1); \ + chmod 644 $(MANDIR)/man$(MAN1)/des.$(MAN1); \ + cp des.h $(INCDIR)/des.h; \ + chmod 644 $(INCDIR)/des.h; \ + fi +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libssl/src/crypto/des/PC1 b/src/lib/libssl/src/crypto/des/PC1 new file mode 100644 index 0000000000..efb8348b72 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/PC1 @@ -0,0 +1,28 @@ +#!/usr/local/bin/perl + +@PC1=( 57,49,41,33,25,17, 9, + 1,58,50,42,34,26,18, + 10, 2,59,51,43,35,27, + 19,11, 3,60,52,44,36, + "-","-","-","-", + 63,55,47,39,31,23,15, + 7,62,54,46,38,30,22, + 14, 6,61,53,45,37,29, + 21,13, 5,28,20,12, 4, + "-","-","-","-", + ); + +foreach (@PC1) + { + if ($_ ne "-") + { + $_--; + $_=int($_/8)*8+7-($_%8); + printf "%2d ",$_; + } + else + { print "-- "; } + print "\n" if (((++$i) % 8) == 0); + print "\n" if ((($i) % 32) == 0); + } + diff --git a/src/lib/libssl/src/crypto/des/PC2 b/src/lib/libssl/src/crypto/des/PC2 new file mode 100644 index 0000000000..2d560270ec --- /dev/null +++ b/src/lib/libssl/src/crypto/des/PC2 @@ -0,0 +1,57 @@ +#!/usr/local/bin/perl + +@PC2_C=(14,17,11,24, 1, 5, + 3,28,15, 6,21,10, + 23,19,12, 4,26, 8, + 16, 7,27,20,13, 2, + ); + +@PC2_D=(41,52,31,37,47,55, + 30,40,51,45,33,48, + 44,49,39,56,34,53, + 46,42,50,36,29,32, + ); + +foreach (@PC2_C) { + if ($_ ne "-") + { + $_--; + printf "%2d ",$_; } + else { print "-- "; } + $C{$_}=1; + print "\n" if (((++$i) % 8) == 0); + } +$i=0; +print "\n"; +foreach (@PC2_D) { + if ($_ ne "-") + { + $_-=29; + printf "%2d ",$_; } + else { print "-- "; } + $D{$_}=1; + print "\n" if (((++$i) % 8) == 0); } + +print "\n"; +foreach $i (0 .. 27) + { + $_=$C{$i}; + if ($_ ne "-") {printf "%2d ",$_;} + else { print "-- "; } + print "\n" if (((++$i) % 8) == 0); + } +print "\n"; + +print "\n"; +foreach $i (0 .. 27) + { + $_=$D{$i}; + if ($_ ne "-") {printf "%2d ",$_;} + else { print "-- "; } + print "\n" if (((++$i) % 8) == 0); + } +print "\n"; +sub numsort + { + $a-$b; + } diff --git a/src/lib/libssl/src/crypto/des/asm/d-win32.asm b/src/lib/libssl/src/crypto/des/asm/d-win32.asm new file mode 100644 index 0000000000..9e3dc9cd87 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/asm/d-win32.asm @@ -0,0 +1,3132 @@ + ; Don't even think of reading this code + ; It was automatically generated by des-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE des-586.asm + .386 +.model FLAT +_TEXT SEGMENT +PUBLIC _des_encrypt +EXTRN _des_SPtrans:DWORD +_des_encrypt PROC NEAR + push esi + push edi + ; + ; Load the 2 words + mov esi, DWORD PTR 12[esp] + xor ecx, ecx + push ebx + push ebp + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 28[esp] + mov edi, DWORD PTR 4[esi] + ; + ; IP + rol eax, 4 + mov esi, eax + xor eax, edi + and eax, 0f0f0f0f0h + xor esi, eax + xor edi, eax + ; + rol edi, 20 + mov eax, edi + xor edi, esi + and edi, 0fff0000fh + xor eax, edi + xor esi, edi + ; + rol eax, 14 + mov edi, eax + xor eax, esi + and eax, 033333333h + xor edi, eax + xor esi, eax + ; + rol esi, 22 + mov eax, esi + xor esi, edi + and esi, 003fc03fch + xor eax, esi + xor edi, esi + ; + rol eax, 9 + mov esi, eax + xor eax, edi + and eax, 0aaaaaaaah + xor esi, eax + xor edi, eax + ; + rol edi, 1 + mov ebp, DWORD PTR 24[esp] + cmp ebx, 0 + je $L000start_decrypt + ; + ; Round 0 + mov eax, DWORD PTR [ebp] + xor ebx, ebx + mov edx, DWORD PTR 4[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 1 + mov eax, DWORD PTR 8[ebp] + xor ebx, ebx + mov edx, DWORD PTR 12[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 2 + mov eax, DWORD PTR 16[ebp] + xor ebx, ebx + mov edx, DWORD PTR 20[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 3 + mov eax, DWORD PTR 24[ebp] + xor ebx, ebx + mov edx, DWORD PTR 28[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 4 + mov eax, DWORD PTR 32[ebp] + xor ebx, ebx + mov edx, DWORD PTR 36[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 5 + mov eax, DWORD PTR 40[ebp] + xor ebx, ebx + mov edx, DWORD PTR 44[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 6 + mov eax, DWORD PTR 48[ebp] + xor ebx, ebx + mov edx, DWORD PTR 52[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 7 + mov eax, DWORD PTR 56[ebp] + xor ebx, ebx + mov edx, DWORD PTR 60[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 8 + mov eax, DWORD PTR 64[ebp] + xor ebx, ebx + mov edx, DWORD PTR 68[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 9 + mov eax, DWORD PTR 72[ebp] + xor ebx, ebx + mov edx, DWORD PTR 76[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 10 + mov eax, DWORD PTR 80[ebp] + xor ebx, ebx + mov edx, DWORD PTR 84[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 11 + mov eax, DWORD PTR 88[ebp] + xor ebx, ebx + mov edx, DWORD PTR 92[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 12 + mov eax, DWORD PTR 96[ebp] + xor ebx, ebx + mov edx, DWORD PTR 100[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 13 + mov eax, DWORD PTR 104[ebp] + xor ebx, ebx + mov edx, DWORD PTR 108[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 14 + mov eax, DWORD PTR 112[ebp] + xor ebx, ebx + mov edx, DWORD PTR 116[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 15 + mov eax, DWORD PTR 120[ebp] + xor ebx, ebx + mov edx, DWORD PTR 124[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + jmp $L001end +$L000start_decrypt: + ; + ; Round 15 + mov eax, DWORD PTR 120[ebp] + xor ebx, ebx + mov edx, DWORD PTR 124[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 14 + mov eax, DWORD PTR 112[ebp] + xor ebx, ebx + mov edx, DWORD PTR 116[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 13 + mov eax, DWORD PTR 104[ebp] + xor ebx, ebx + mov edx, DWORD PTR 108[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 12 + mov eax, DWORD PTR 96[ebp] + xor ebx, ebx + mov edx, DWORD PTR 100[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 11 + mov eax, DWORD PTR 88[ebp] + xor ebx, ebx + mov edx, DWORD PTR 92[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 10 + mov eax, DWORD PTR 80[ebp] + xor ebx, ebx + mov edx, DWORD PTR 84[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 9 + mov eax, DWORD PTR 72[ebp] + xor ebx, ebx + mov edx, DWORD PTR 76[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 8 + mov eax, DWORD PTR 64[ebp] + xor ebx, ebx + mov edx, DWORD PTR 68[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 7 + mov eax, DWORD PTR 56[ebp] + xor ebx, ebx + mov edx, DWORD PTR 60[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 6 + mov eax, DWORD PTR 48[ebp] + xor ebx, ebx + mov edx, DWORD PTR 52[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 5 + mov eax, DWORD PTR 40[ebp] + xor ebx, ebx + mov edx, DWORD PTR 44[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 4 + mov eax, DWORD PTR 32[ebp] + xor ebx, ebx + mov edx, DWORD PTR 36[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 3 + mov eax, DWORD PTR 24[ebp] + xor ebx, ebx + mov edx, DWORD PTR 28[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 2 + mov eax, DWORD PTR 16[ebp] + xor ebx, ebx + mov edx, DWORD PTR 20[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 1 + mov eax, DWORD PTR 8[ebp] + xor ebx, ebx + mov edx, DWORD PTR 12[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 0 + mov eax, DWORD PTR [ebp] + xor ebx, ebx + mov edx, DWORD PTR 4[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx +$L001end: + ; + ; FP + mov edx, DWORD PTR 20[esp] + ror esi, 1 + mov eax, edi + xor edi, esi + and edi, 0aaaaaaaah + xor eax, edi + xor esi, edi + ; + rol eax, 23 + mov edi, eax + xor eax, esi + and eax, 003fc03fch + xor edi, eax + xor esi, eax + ; + rol edi, 10 + mov eax, edi + xor edi, esi + and edi, 033333333h + xor eax, edi + xor esi, edi + ; + rol esi, 18 + mov edi, esi + xor esi, eax + and esi, 0fff0000fh + xor edi, esi + xor eax, esi + ; + rol edi, 12 + mov esi, edi + xor edi, eax + and edi, 0f0f0f0f0h + xor esi, edi + xor eax, edi + ; + ror eax, 4 + mov DWORD PTR [edx],eax + mov DWORD PTR 4[edx],esi + pop ebp + pop ebx + pop edi + pop esi + ret +_des_encrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _des_encrypt2 +EXTRN _des_SPtrans:DWORD +_des_encrypt2 PROC NEAR + push esi + push edi + ; + ; Load the 2 words + mov eax, DWORD PTR 12[esp] + xor ecx, ecx + push ebx + push ebp + mov esi, DWORD PTR [eax] + mov ebx, DWORD PTR 28[esp] + rol esi, 3 + mov edi, DWORD PTR 4[eax] + rol edi, 3 + mov ebp, DWORD PTR 24[esp] + cmp ebx, 0 + je $L002start_decrypt + ; + ; Round 0 + mov eax, DWORD PTR [ebp] + xor ebx, ebx + mov edx, DWORD PTR 4[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 1 + mov eax, DWORD PTR 8[ebp] + xor ebx, ebx + mov edx, DWORD PTR 12[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 2 + mov eax, DWORD PTR 16[ebp] + xor ebx, ebx + mov edx, DWORD PTR 20[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 3 + mov eax, DWORD PTR 24[ebp] + xor ebx, ebx + mov edx, DWORD PTR 28[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 4 + mov eax, DWORD PTR 32[ebp] + xor ebx, ebx + mov edx, DWORD PTR 36[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 5 + mov eax, DWORD PTR 40[ebp] + xor ebx, ebx + mov edx, DWORD PTR 44[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 6 + mov eax, DWORD PTR 48[ebp] + xor ebx, ebx + mov edx, DWORD PTR 52[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 7 + mov eax, DWORD PTR 56[ebp] + xor ebx, ebx + mov edx, DWORD PTR 60[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 8 + mov eax, DWORD PTR 64[ebp] + xor ebx, ebx + mov edx, DWORD PTR 68[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 9 + mov eax, DWORD PTR 72[ebp] + xor ebx, ebx + mov edx, DWORD PTR 76[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 10 + mov eax, DWORD PTR 80[ebp] + xor ebx, ebx + mov edx, DWORD PTR 84[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 11 + mov eax, DWORD PTR 88[ebp] + xor ebx, ebx + mov edx, DWORD PTR 92[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 12 + mov eax, DWORD PTR 96[ebp] + xor ebx, ebx + mov edx, DWORD PTR 100[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 13 + mov eax, DWORD PTR 104[ebp] + xor ebx, ebx + mov edx, DWORD PTR 108[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 14 + mov eax, DWORD PTR 112[ebp] + xor ebx, ebx + mov edx, DWORD PTR 116[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 15 + mov eax, DWORD PTR 120[ebp] + xor ebx, ebx + mov edx, DWORD PTR 124[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + jmp $L003end +$L002start_decrypt: + ; + ; Round 15 + mov eax, DWORD PTR 120[ebp] + xor ebx, ebx + mov edx, DWORD PTR 124[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 14 + mov eax, DWORD PTR 112[ebp] + xor ebx, ebx + mov edx, DWORD PTR 116[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 13 + mov eax, DWORD PTR 104[ebp] + xor ebx, ebx + mov edx, DWORD PTR 108[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 12 + mov eax, DWORD PTR 96[ebp] + xor ebx, ebx + mov edx, DWORD PTR 100[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 11 + mov eax, DWORD PTR 88[ebp] + xor ebx, ebx + mov edx, DWORD PTR 92[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 10 + mov eax, DWORD PTR 80[ebp] + xor ebx, ebx + mov edx, DWORD PTR 84[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 9 + mov eax, DWORD PTR 72[ebp] + xor ebx, ebx + mov edx, DWORD PTR 76[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 8 + mov eax, DWORD PTR 64[ebp] + xor ebx, ebx + mov edx, DWORD PTR 68[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 7 + mov eax, DWORD PTR 56[ebp] + xor ebx, ebx + mov edx, DWORD PTR 60[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 6 + mov eax, DWORD PTR 48[ebp] + xor ebx, ebx + mov edx, DWORD PTR 52[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 5 + mov eax, DWORD PTR 40[ebp] + xor ebx, ebx + mov edx, DWORD PTR 44[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 4 + mov eax, DWORD PTR 32[ebp] + xor ebx, ebx + mov edx, DWORD PTR 36[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 3 + mov eax, DWORD PTR 24[ebp] + xor ebx, ebx + mov edx, DWORD PTR 28[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 2 + mov eax, DWORD PTR 16[ebp] + xor ebx, ebx + mov edx, DWORD PTR 20[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 1 + mov eax, DWORD PTR 8[ebp] + xor ebx, ebx + mov edx, DWORD PTR 12[ebp] + xor eax, esi + xor edx, esi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 0 + mov eax, DWORD PTR [ebp] + xor ebx, ebx + mov edx, DWORD PTR 4[ebp] + xor eax, edi + xor edx, edi + and eax, 0fcfcfcfch + and edx, 0cfcfcfcfh + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx +$L003end: + ; + ; Fixup + ror edi, 3 + mov eax, DWORD PTR 20[esp] + ror esi, 3 + mov DWORD PTR [eax],edi + mov DWORD PTR 4[eax],esi + pop ebp + pop ebx + pop edi + pop esi + ret +_des_encrypt2 ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _des_encrypt3 + +_des_encrypt3 PROC NEAR + push ebx + mov ebx, DWORD PTR 8[esp] + push ebp + push esi + push edi + ; + ; Load the data words + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + sub esp, 12 + ; + ; IP + rol edi, 4 + mov edx, edi + xor edi, esi + and edi, 0f0f0f0f0h + xor edx, edi + xor esi, edi + ; + rol esi, 20 + mov edi, esi + xor esi, edx + and esi, 0fff0000fh + xor edi, esi + xor edx, esi + ; + rol edi, 14 + mov esi, edi + xor edi, edx + and edi, 033333333h + xor esi, edi + xor edx, edi + ; + rol edx, 22 + mov edi, edx + xor edx, esi + and edx, 003fc03fch + xor edi, edx + xor esi, edx + ; + rol edi, 9 + mov edx, edi + xor edi, esi + and edi, 0aaaaaaaah + xor edx, edi + xor esi, edi + ; + ror edx, 3 + ror esi, 2 + mov DWORD PTR 4[ebx],esi + mov eax, DWORD PTR 36[esp] + mov DWORD PTR [ebx],edx + mov edi, DWORD PTR 40[esp] + mov esi, DWORD PTR 44[esp] + mov DWORD PTR 8[esp],1 + mov DWORD PTR 4[esp],eax + mov DWORD PTR [esp],ebx + call _des_encrypt2 + mov DWORD PTR 8[esp],0 + mov DWORD PTR 4[esp],edi + mov DWORD PTR [esp],ebx + call _des_encrypt2 + mov DWORD PTR 8[esp],1 + mov DWORD PTR 4[esp],esi + mov DWORD PTR [esp],ebx + call _des_encrypt2 + add esp, 12 + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + ; + ; FP + rol esi, 2 + rol edi, 3 + mov eax, edi + xor edi, esi + and edi, 0aaaaaaaah + xor eax, edi + xor esi, edi + ; + rol eax, 23 + mov edi, eax + xor eax, esi + and eax, 003fc03fch + xor edi, eax + xor esi, eax + ; + rol edi, 10 + mov eax, edi + xor edi, esi + and edi, 033333333h + xor eax, edi + xor esi, edi + ; + rol esi, 18 + mov edi, esi + xor esi, eax + and esi, 0fff0000fh + xor edi, esi + xor eax, esi + ; + rol edi, 12 + mov esi, edi + xor edi, eax + and edi, 0f0f0f0f0h + xor esi, edi + xor eax, edi + ; + ror eax, 4 + mov DWORD PTR [ebx],eax + mov DWORD PTR 4[ebx],esi + pop edi + pop esi + pop ebp + pop ebx + ret +_des_encrypt3 ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _des_decrypt3 + +_des_decrypt3 PROC NEAR + push ebx + mov ebx, DWORD PTR 8[esp] + push ebp + push esi + push edi + ; + ; Load the data words + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + sub esp, 12 + ; + ; IP + rol edi, 4 + mov edx, edi + xor edi, esi + and edi, 0f0f0f0f0h + xor edx, edi + xor esi, edi + ; + rol esi, 20 + mov edi, esi + xor esi, edx + and esi, 0fff0000fh + xor edi, esi + xor edx, esi + ; + rol edi, 14 + mov esi, edi + xor edi, edx + and edi, 033333333h + xor esi, edi + xor edx, edi + ; + rol edx, 22 + mov edi, edx + xor edx, esi + and edx, 003fc03fch + xor edi, edx + xor esi, edx + ; + rol edi, 9 + mov edx, edi + xor edi, esi + and edi, 0aaaaaaaah + xor edx, edi + xor esi, edi + ; + ror edx, 3 + ror esi, 2 + mov DWORD PTR 4[ebx],esi + mov esi, DWORD PTR 36[esp] + mov DWORD PTR [ebx],edx + mov edi, DWORD PTR 40[esp] + mov eax, DWORD PTR 44[esp] + mov DWORD PTR 8[esp],0 + mov DWORD PTR 4[esp],eax + mov DWORD PTR [esp],ebx + call _des_encrypt2 + mov DWORD PTR 8[esp],1 + mov DWORD PTR 4[esp],edi + mov DWORD PTR [esp],ebx + call _des_encrypt2 + mov DWORD PTR 8[esp],0 + mov DWORD PTR 4[esp],esi + mov DWORD PTR [esp],ebx + call _des_encrypt2 + add esp, 12 + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + ; + ; FP + rol esi, 2 + rol edi, 3 + mov eax, edi + xor edi, esi + and edi, 0aaaaaaaah + xor eax, edi + xor esi, edi + ; + rol eax, 23 + mov edi, eax + xor eax, esi + and eax, 003fc03fch + xor edi, eax + xor esi, eax + ; + rol edi, 10 + mov eax, edi + xor edi, esi + and edi, 033333333h + xor eax, edi + xor esi, edi + ; + rol esi, 18 + mov edi, esi + xor esi, eax + and esi, 0fff0000fh + xor edi, esi + xor eax, esi + ; + rol edi, 12 + mov esi, edi + xor edi, eax + and edi, 0f0f0f0f0h + xor esi, edi + xor eax, edi + ; + ror eax, 4 + mov DWORD PTR [ebx],eax + mov DWORD PTR 4[ebx],esi + pop edi + pop esi + pop ebp + pop ebx + ret +_des_decrypt3 ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _des_ncbc_encrypt + +_des_ncbc_encrypt PROC NEAR + ; + push ebp + push ebx + push esi + push edi + mov ebp, DWORD PTR 28[esp] + ; getting iv ptr from parameter 4 + mov ebx, DWORD PTR 36[esp] + mov esi, DWORD PTR [ebx] + mov edi, DWORD PTR 4[ebx] + push edi + push esi + push edi + push esi + mov ebx, esp + mov esi, DWORD PTR 36[esp] + mov edi, DWORD PTR 40[esp] + ; getting encrypt flag from parameter 5 + mov ecx, DWORD PTR 56[esp] + ; get and push parameter 5 + push ecx + ; get and push parameter 3 + mov eax, DWORD PTR 52[esp] + push eax + push ebx + cmp ecx, 0 + jz $L004decrypt + and ebp, 4294967288 + mov eax, DWORD PTR 12[esp] + mov ebx, DWORD PTR 16[esp] + jz $L005encrypt_finish +L006encrypt_loop: + mov ecx, DWORD PTR [esi] + mov edx, DWORD PTR 4[esi] + xor eax, ecx + xor ebx, edx + mov DWORD PTR 12[esp],eax + mov DWORD PTR 16[esp],ebx + call _des_encrypt + mov eax, DWORD PTR 12[esp] + mov ebx, DWORD PTR 16[esp] + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L006encrypt_loop +$L005encrypt_finish: + mov ebp, DWORD PTR 56[esp] + and ebp, 7 + jz $L007finish + xor ecx, ecx + xor edx, edx + mov ebp, DWORD PTR $L008cbc_enc_jmp_table[ebp*4] + jmp ebp +L009ej7: + mov dh, BYTE PTR 6[esi] + shl edx, 8 +L010ej6: + mov dh, BYTE PTR 5[esi] +L011ej5: + mov dl, BYTE PTR 4[esi] +L012ej4: + mov ecx, DWORD PTR [esi] + jmp $L013ejend +L014ej3: + mov ch, BYTE PTR 2[esi] + shl ecx, 8 +L015ej2: + mov ch, BYTE PTR 1[esi] +L016ej1: + mov cl, BYTE PTR [esi] +$L013ejend: + xor eax, ecx + xor ebx, edx + mov DWORD PTR 12[esp],eax + mov DWORD PTR 16[esp],ebx + call _des_encrypt + mov eax, DWORD PTR 12[esp] + mov ebx, DWORD PTR 16[esp] + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + jmp $L007finish +$L004decrypt: + and ebp, 4294967288 + mov eax, DWORD PTR 20[esp] + mov ebx, DWORD PTR 24[esp] + jz $L017decrypt_finish +L018decrypt_loop: + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR 12[esp],eax + mov DWORD PTR 16[esp],ebx + call _des_encrypt + mov eax, DWORD PTR 12[esp] + mov ebx, DWORD PTR 16[esp] + mov ecx, DWORD PTR 20[esp] + mov edx, DWORD PTR 24[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR [edi],ecx + mov DWORD PTR 4[edi],edx + mov DWORD PTR 20[esp],eax + mov DWORD PTR 24[esp],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L018decrypt_loop +$L017decrypt_finish: + mov ebp, DWORD PTR 56[esp] + and ebp, 7 + jz $L007finish + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR 12[esp],eax + mov DWORD PTR 16[esp],ebx + call _des_encrypt + mov eax, DWORD PTR 12[esp] + mov ebx, DWORD PTR 16[esp] + mov ecx, DWORD PTR 20[esp] + mov edx, DWORD PTR 24[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] +L019dj7: + ror edx, 16 + mov BYTE PTR 6[edi],dl + shr edx, 16 +L020dj6: + mov BYTE PTR 5[edi],dh +L021dj5: + mov BYTE PTR 4[edi],dl +L022dj4: + mov DWORD PTR [edi],ecx + jmp $L023djend +L024dj3: + ror ecx, 16 + mov BYTE PTR 2[edi],cl + shl ecx, 16 +L025dj2: + mov BYTE PTR 1[esi],ch +L026dj1: + mov BYTE PTR [esi], cl +$L023djend: + jmp $L007finish +$L007finish: + mov ecx, DWORD PTR 64[esp] + add esp, 28 + mov DWORD PTR [ecx],eax + mov DWORD PTR 4[ecx],ebx + pop edi + pop esi + pop ebx + pop ebp + ret +$L008cbc_enc_jmp_table: + DD 0 + DD L016ej1 + DD L015ej2 + DD L014ej3 + DD L012ej4 + DD L011ej5 + DD L010ej6 + DD L009ej7 +L027cbc_dec_jmp_table: + DD 0 + DD L026dj1 + DD L025dj2 + DD L024dj3 + DD L022dj4 + DD L021dj5 + DD L020dj6 + DD L019dj7 +_des_ncbc_encrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _des_ede3_cbc_encrypt + +_des_ede3_cbc_encrypt PROC NEAR + ; + push ebp + push ebx + push esi + push edi + mov ebp, DWORD PTR 28[esp] + ; getting iv ptr from parameter 6 + mov ebx, DWORD PTR 44[esp] + mov esi, DWORD PTR [ebx] + mov edi, DWORD PTR 4[ebx] + push edi + push esi + push edi + push esi + mov ebx, esp + mov esi, DWORD PTR 36[esp] + mov edi, DWORD PTR 40[esp] + ; getting encrypt flag from parameter 7 + mov ecx, DWORD PTR 64[esp] + ; get and push parameter 5 + mov eax, DWORD PTR 56[esp] + push eax + ; get and push parameter 4 + mov eax, DWORD PTR 56[esp] + push eax + ; get and push parameter 3 + mov eax, DWORD PTR 56[esp] + push eax + push ebx + cmp ecx, 0 + jz $L028decrypt + and ebp, 4294967288 + mov eax, DWORD PTR 16[esp] + mov ebx, DWORD PTR 20[esp] + jz $L029encrypt_finish +L030encrypt_loop: + mov ecx, DWORD PTR [esi] + mov edx, DWORD PTR 4[esi] + xor eax, ecx + xor ebx, edx + mov DWORD PTR 16[esp],eax + mov DWORD PTR 20[esp],ebx + call _des_encrypt3 + mov eax, DWORD PTR 16[esp] + mov ebx, DWORD PTR 20[esp] + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L030encrypt_loop +$L029encrypt_finish: + mov ebp, DWORD PTR 60[esp] + and ebp, 7 + jz $L031finish + xor ecx, ecx + xor edx, edx + mov ebp, DWORD PTR $L032cbc_enc_jmp_table[ebp*4] + jmp ebp +L033ej7: + mov dh, BYTE PTR 6[esi] + shl edx, 8 +L034ej6: + mov dh, BYTE PTR 5[esi] +L035ej5: + mov dl, BYTE PTR 4[esi] +L036ej4: + mov ecx, DWORD PTR [esi] + jmp $L037ejend +L038ej3: + mov ch, BYTE PTR 2[esi] + shl ecx, 8 +L039ej2: + mov ch, BYTE PTR 1[esi] +L040ej1: + mov cl, BYTE PTR [esi] +$L037ejend: + xor eax, ecx + xor ebx, edx + mov DWORD PTR 16[esp],eax + mov DWORD PTR 20[esp],ebx + call _des_encrypt3 + mov eax, DWORD PTR 16[esp] + mov ebx, DWORD PTR 20[esp] + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + jmp $L031finish +$L028decrypt: + and ebp, 4294967288 + mov eax, DWORD PTR 24[esp] + mov ebx, DWORD PTR 28[esp] + jz $L041decrypt_finish +L042decrypt_loop: + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR 16[esp],eax + mov DWORD PTR 20[esp],ebx + call _des_decrypt3 + mov eax, DWORD PTR 16[esp] + mov ebx, DWORD PTR 20[esp] + mov ecx, DWORD PTR 24[esp] + mov edx, DWORD PTR 28[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR [edi],ecx + mov DWORD PTR 4[edi],edx + mov DWORD PTR 24[esp],eax + mov DWORD PTR 28[esp],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L042decrypt_loop +$L041decrypt_finish: + mov ebp, DWORD PTR 60[esp] + and ebp, 7 + jz $L031finish + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR 16[esp],eax + mov DWORD PTR 20[esp],ebx + call _des_decrypt3 + mov eax, DWORD PTR 16[esp] + mov ebx, DWORD PTR 20[esp] + mov ecx, DWORD PTR 24[esp] + mov edx, DWORD PTR 28[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] +L043dj7: + ror edx, 16 + mov BYTE PTR 6[edi],dl + shr edx, 16 +L044dj6: + mov BYTE PTR 5[edi],dh +L045dj5: + mov BYTE PTR 4[edi],dl +L046dj4: + mov DWORD PTR [edi],ecx + jmp $L047djend +L048dj3: + ror ecx, 16 + mov BYTE PTR 2[edi],cl + shl ecx, 16 +L049dj2: + mov BYTE PTR 1[esi],ch +L050dj1: + mov BYTE PTR [esi], cl +$L047djend: + jmp $L031finish +$L031finish: + mov ecx, DWORD PTR 76[esp] + add esp, 32 + mov DWORD PTR [ecx],eax + mov DWORD PTR 4[ecx],ebx + pop edi + pop esi + pop ebx + pop ebp + ret +$L032cbc_enc_jmp_table: + DD 0 + DD L040ej1 + DD L039ej2 + DD L038ej3 + DD L036ej4 + DD L035ej5 + DD L034ej6 + DD L033ej7 +L051cbc_dec_jmp_table: + DD 0 + DD L050dj1 + DD L049dj2 + DD L048dj3 + DD L046dj4 + DD L045dj5 + DD L044dj6 + DD L043dj7 +_des_ede3_cbc_encrypt ENDP +_TEXT ENDS +END diff --git a/src/lib/libssl/src/crypto/des/asm/dx86unix.cpp b/src/lib/libssl/src/crypto/des/asm/dx86unix.cpp new file mode 100644 index 0000000000..6fca9afa16 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/asm/dx86unix.cpp @@ -0,0 +1,3202 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define des_SPtrans _des_SPtrans +#define des_encrypt _des_encrypt +#define des_encrypt2 _des_encrypt2 +#define des_encrypt3 _des_encrypt3 +#define des_decrypt3 _des_decrypt3 +#define des_ncbc_encrypt _des_ncbc_encrypt +#define des_ede3_cbc_encrypt _des_ede3_cbc_encrypt + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by des-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "des-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl des_encrypt + TYPE(des_encrypt,@function) +des_encrypt: + pushl %esi + pushl %edi + + /* Load the 2 words */ + movl 12(%esp), %esi + xorl %ecx, %ecx + pushl %ebx + pushl %ebp + movl (%esi), %eax + movl 28(%esp), %ebx + movl 4(%esi), %edi + + /* IP */ + roll $4, %eax + movl %eax, %esi + xorl %edi, %eax + andl $0xf0f0f0f0, %eax + xorl %eax, %esi + xorl %eax, %edi + + roll $20, %edi + movl %edi, %eax + xorl %esi, %edi + andl $0xfff0000f, %edi + xorl %edi, %eax + xorl %edi, %esi + + roll $14, %eax + movl %eax, %edi + xorl %esi, %eax + andl $0x33333333, %eax + xorl %eax, %edi + xorl %eax, %esi + + roll $22, %esi + movl %esi, %eax + xorl %edi, %esi + andl $0x03fc03fc, %esi + xorl %esi, %eax + xorl %esi, %edi + + roll $9, %eax + movl %eax, %esi + xorl %edi, %eax + andl $0xaaaaaaaa, %eax + xorl %eax, %esi + xorl %eax, %edi + +.byte 209 +.byte 199 /* roll $1 %edi */ + movl 24(%esp), %ebp + cmpl $0, %ebx + je .L000start_decrypt + + /* Round 0 */ + movl (%ebp), %eax + xorl %ebx, %ebx + movl 4(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 1 */ + movl 8(%ebp), %eax + xorl %ebx, %ebx + movl 12(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 2 */ + movl 16(%ebp), %eax + xorl %ebx, %ebx + movl 20(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 3 */ + movl 24(%ebp), %eax + xorl %ebx, %ebx + movl 28(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 4 */ + movl 32(%ebp), %eax + xorl %ebx, %ebx + movl 36(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 5 */ + movl 40(%ebp), %eax + xorl %ebx, %ebx + movl 44(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 6 */ + movl 48(%ebp), %eax + xorl %ebx, %ebx + movl 52(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 7 */ + movl 56(%ebp), %eax + xorl %ebx, %ebx + movl 60(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 8 */ + movl 64(%ebp), %eax + xorl %ebx, %ebx + movl 68(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 9 */ + movl 72(%ebp), %eax + xorl %ebx, %ebx + movl 76(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 10 */ + movl 80(%ebp), %eax + xorl %ebx, %ebx + movl 84(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 11 */ + movl 88(%ebp), %eax + xorl %ebx, %ebx + movl 92(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 12 */ + movl 96(%ebp), %eax + xorl %ebx, %ebx + movl 100(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 13 */ + movl 104(%ebp), %eax + xorl %ebx, %ebx + movl 108(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 14 */ + movl 112(%ebp), %eax + xorl %ebx, %ebx + movl 116(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 15 */ + movl 120(%ebp), %eax + xorl %ebx, %ebx + movl 124(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + jmp .L001end +.L000start_decrypt: + + /* Round 15 */ + movl 120(%ebp), %eax + xorl %ebx, %ebx + movl 124(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 14 */ + movl 112(%ebp), %eax + xorl %ebx, %ebx + movl 116(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 13 */ + movl 104(%ebp), %eax + xorl %ebx, %ebx + movl 108(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 12 */ + movl 96(%ebp), %eax + xorl %ebx, %ebx + movl 100(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 11 */ + movl 88(%ebp), %eax + xorl %ebx, %ebx + movl 92(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 10 */ + movl 80(%ebp), %eax + xorl %ebx, %ebx + movl 84(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 9 */ + movl 72(%ebp), %eax + xorl %ebx, %ebx + movl 76(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 8 */ + movl 64(%ebp), %eax + xorl %ebx, %ebx + movl 68(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 7 */ + movl 56(%ebp), %eax + xorl %ebx, %ebx + movl 60(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 6 */ + movl 48(%ebp), %eax + xorl %ebx, %ebx + movl 52(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 5 */ + movl 40(%ebp), %eax + xorl %ebx, %ebx + movl 44(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 4 */ + movl 32(%ebp), %eax + xorl %ebx, %ebx + movl 36(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 3 */ + movl 24(%ebp), %eax + xorl %ebx, %ebx + movl 28(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 2 */ + movl 16(%ebp), %eax + xorl %ebx, %ebx + movl 20(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 1 */ + movl 8(%ebp), %eax + xorl %ebx, %ebx + movl 12(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 0 */ + movl (%ebp), %eax + xorl %ebx, %ebx + movl 4(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi +.L001end: + + /* FP */ + movl 20(%esp), %edx +.byte 209 +.byte 206 /* rorl $1 %esi */ + movl %edi, %eax + xorl %esi, %edi + andl $0xaaaaaaaa, %edi + xorl %edi, %eax + xorl %edi, %esi + + roll $23, %eax + movl %eax, %edi + xorl %esi, %eax + andl $0x03fc03fc, %eax + xorl %eax, %edi + xorl %eax, %esi + + roll $10, %edi + movl %edi, %eax + xorl %esi, %edi + andl $0x33333333, %edi + xorl %edi, %eax + xorl %edi, %esi + + roll $18, %esi + movl %esi, %edi + xorl %eax, %esi + andl $0xfff0000f, %esi + xorl %esi, %edi + xorl %esi, %eax + + roll $12, %edi + movl %edi, %esi + xorl %eax, %edi + andl $0xf0f0f0f0, %edi + xorl %edi, %esi + xorl %edi, %eax + + rorl $4, %eax + movl %eax, (%edx) + movl %esi, 4(%edx) + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +.des_encrypt_end: + SIZE(des_encrypt,.des_encrypt_end-des_encrypt) +.ident "desasm.pl" +.text + .align ALIGN +.globl des_encrypt2 + TYPE(des_encrypt2,@function) +des_encrypt2: + pushl %esi + pushl %edi + + /* Load the 2 words */ + movl 12(%esp), %eax + xorl %ecx, %ecx + pushl %ebx + pushl %ebp + movl (%eax), %esi + movl 28(%esp), %ebx + roll $3, %esi + movl 4(%eax), %edi + roll $3, %edi + movl 24(%esp), %ebp + cmpl $0, %ebx + je .L002start_decrypt + + /* Round 0 */ + movl (%ebp), %eax + xorl %ebx, %ebx + movl 4(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 1 */ + movl 8(%ebp), %eax + xorl %ebx, %ebx + movl 12(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 2 */ + movl 16(%ebp), %eax + xorl %ebx, %ebx + movl 20(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 3 */ + movl 24(%ebp), %eax + xorl %ebx, %ebx + movl 28(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 4 */ + movl 32(%ebp), %eax + xorl %ebx, %ebx + movl 36(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 5 */ + movl 40(%ebp), %eax + xorl %ebx, %ebx + movl 44(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 6 */ + movl 48(%ebp), %eax + xorl %ebx, %ebx + movl 52(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 7 */ + movl 56(%ebp), %eax + xorl %ebx, %ebx + movl 60(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 8 */ + movl 64(%ebp), %eax + xorl %ebx, %ebx + movl 68(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 9 */ + movl 72(%ebp), %eax + xorl %ebx, %ebx + movl 76(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 10 */ + movl 80(%ebp), %eax + xorl %ebx, %ebx + movl 84(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 11 */ + movl 88(%ebp), %eax + xorl %ebx, %ebx + movl 92(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 12 */ + movl 96(%ebp), %eax + xorl %ebx, %ebx + movl 100(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 13 */ + movl 104(%ebp), %eax + xorl %ebx, %ebx + movl 108(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 14 */ + movl 112(%ebp), %eax + xorl %ebx, %ebx + movl 116(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 15 */ + movl 120(%ebp), %eax + xorl %ebx, %ebx + movl 124(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + jmp .L003end +.L002start_decrypt: + + /* Round 15 */ + movl 120(%ebp), %eax + xorl %ebx, %ebx + movl 124(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 14 */ + movl 112(%ebp), %eax + xorl %ebx, %ebx + movl 116(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 13 */ + movl 104(%ebp), %eax + xorl %ebx, %ebx + movl 108(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 12 */ + movl 96(%ebp), %eax + xorl %ebx, %ebx + movl 100(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 11 */ + movl 88(%ebp), %eax + xorl %ebx, %ebx + movl 92(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 10 */ + movl 80(%ebp), %eax + xorl %ebx, %ebx + movl 84(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 9 */ + movl 72(%ebp), %eax + xorl %ebx, %ebx + movl 76(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 8 */ + movl 64(%ebp), %eax + xorl %ebx, %ebx + movl 68(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 7 */ + movl 56(%ebp), %eax + xorl %ebx, %ebx + movl 60(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 6 */ + movl 48(%ebp), %eax + xorl %ebx, %ebx + movl 52(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 5 */ + movl 40(%ebp), %eax + xorl %ebx, %ebx + movl 44(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 4 */ + movl 32(%ebp), %eax + xorl %ebx, %ebx + movl 36(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 3 */ + movl 24(%ebp), %eax + xorl %ebx, %ebx + movl 28(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 2 */ + movl 16(%ebp), %eax + xorl %ebx, %ebx + movl 20(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 1 */ + movl 8(%ebp), %eax + xorl %ebx, %ebx + movl 12(%ebp), %edx + xorl %esi, %eax + xorl %esi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 0 */ + movl (%ebp), %eax + xorl %ebx, %ebx + movl 4(%ebp), %edx + xorl %edi, %eax + xorl %edi, %edx + andl $0xfcfcfcfc, %eax + andl $0xcfcfcfcf, %edx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi +.L003end: + + /* Fixup */ + rorl $3, %edi + movl 20(%esp), %eax + rorl $3, %esi + movl %edi, (%eax) + movl %esi, 4(%eax) + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +.des_encrypt2_end: + SIZE(des_encrypt2,.des_encrypt2_end-des_encrypt2) +.ident "desasm.pl" +.text + .align ALIGN +.globl des_encrypt3 + TYPE(des_encrypt3,@function) +des_encrypt3: + pushl %ebx + movl 8(%esp), %ebx + pushl %ebp + pushl %esi + pushl %edi + + /* Load the data words */ + movl (%ebx), %edi + movl 4(%ebx), %esi + subl $12, %esp + + /* IP */ + roll $4, %edi + movl %edi, %edx + xorl %esi, %edi + andl $0xf0f0f0f0, %edi + xorl %edi, %edx + xorl %edi, %esi + + roll $20, %esi + movl %esi, %edi + xorl %edx, %esi + andl $0xfff0000f, %esi + xorl %esi, %edi + xorl %esi, %edx + + roll $14, %edi + movl %edi, %esi + xorl %edx, %edi + andl $0x33333333, %edi + xorl %edi, %esi + xorl %edi, %edx + + roll $22, %edx + movl %edx, %edi + xorl %esi, %edx + andl $0x03fc03fc, %edx + xorl %edx, %edi + xorl %edx, %esi + + roll $9, %edi + movl %edi, %edx + xorl %esi, %edi + andl $0xaaaaaaaa, %edi + xorl %edi, %edx + xorl %edi, %esi + + rorl $3, %edx + rorl $2, %esi + movl %esi, 4(%ebx) + movl 36(%esp), %eax + movl %edx, (%ebx) + movl 40(%esp), %edi + movl 44(%esp), %esi + movl $1, 8(%esp) + movl %eax, 4(%esp) + movl %ebx, (%esp) + call des_encrypt2 + movl $0, 8(%esp) + movl %edi, 4(%esp) + movl %ebx, (%esp) + call des_encrypt2 + movl $1, 8(%esp) + movl %esi, 4(%esp) + movl %ebx, (%esp) + call des_encrypt2 + addl $12, %esp + movl (%ebx), %edi + movl 4(%ebx), %esi + + /* FP */ + roll $2, %esi + roll $3, %edi + movl %edi, %eax + xorl %esi, %edi + andl $0xaaaaaaaa, %edi + xorl %edi, %eax + xorl %edi, %esi + + roll $23, %eax + movl %eax, %edi + xorl %esi, %eax + andl $0x03fc03fc, %eax + xorl %eax, %edi + xorl %eax, %esi + + roll $10, %edi + movl %edi, %eax + xorl %esi, %edi + andl $0x33333333, %edi + xorl %edi, %eax + xorl %edi, %esi + + roll $18, %esi + movl %esi, %edi + xorl %eax, %esi + andl $0xfff0000f, %esi + xorl %esi, %edi + xorl %esi, %eax + + roll $12, %edi + movl %edi, %esi + xorl %eax, %edi + andl $0xf0f0f0f0, %edi + xorl %edi, %esi + xorl %edi, %eax + + rorl $4, %eax + movl %eax, (%ebx) + movl %esi, 4(%ebx) + popl %edi + popl %esi + popl %ebp + popl %ebx + ret +.des_encrypt3_end: + SIZE(des_encrypt3,.des_encrypt3_end-des_encrypt3) +.ident "desasm.pl" +.text + .align ALIGN +.globl des_decrypt3 + TYPE(des_decrypt3,@function) +des_decrypt3: + pushl %ebx + movl 8(%esp), %ebx + pushl %ebp + pushl %esi + pushl %edi + + /* Load the data words */ + movl (%ebx), %edi + movl 4(%ebx), %esi + subl $12, %esp + + /* IP */ + roll $4, %edi + movl %edi, %edx + xorl %esi, %edi + andl $0xf0f0f0f0, %edi + xorl %edi, %edx + xorl %edi, %esi + + roll $20, %esi + movl %esi, %edi + xorl %edx, %esi + andl $0xfff0000f, %esi + xorl %esi, %edi + xorl %esi, %edx + + roll $14, %edi + movl %edi, %esi + xorl %edx, %edi + andl $0x33333333, %edi + xorl %edi, %esi + xorl %edi, %edx + + roll $22, %edx + movl %edx, %edi + xorl %esi, %edx + andl $0x03fc03fc, %edx + xorl %edx, %edi + xorl %edx, %esi + + roll $9, %edi + movl %edi, %edx + xorl %esi, %edi + andl $0xaaaaaaaa, %edi + xorl %edi, %edx + xorl %edi, %esi + + rorl $3, %edx + rorl $2, %esi + movl %esi, 4(%ebx) + movl 36(%esp), %esi + movl %edx, (%ebx) + movl 40(%esp), %edi + movl 44(%esp), %eax + movl $0, 8(%esp) + movl %eax, 4(%esp) + movl %ebx, (%esp) + call des_encrypt2 + movl $1, 8(%esp) + movl %edi, 4(%esp) + movl %ebx, (%esp) + call des_encrypt2 + movl $0, 8(%esp) + movl %esi, 4(%esp) + movl %ebx, (%esp) + call des_encrypt2 + addl $12, %esp + movl (%ebx), %edi + movl 4(%ebx), %esi + + /* FP */ + roll $2, %esi + roll $3, %edi + movl %edi, %eax + xorl %esi, %edi + andl $0xaaaaaaaa, %edi + xorl %edi, %eax + xorl %edi, %esi + + roll $23, %eax + movl %eax, %edi + xorl %esi, %eax + andl $0x03fc03fc, %eax + xorl %eax, %edi + xorl %eax, %esi + + roll $10, %edi + movl %edi, %eax + xorl %esi, %edi + andl $0x33333333, %edi + xorl %edi, %eax + xorl %edi, %esi + + roll $18, %esi + movl %esi, %edi + xorl %eax, %esi + andl $0xfff0000f, %esi + xorl %esi, %edi + xorl %esi, %eax + + roll $12, %edi + movl %edi, %esi + xorl %eax, %edi + andl $0xf0f0f0f0, %edi + xorl %edi, %esi + xorl %edi, %eax + + rorl $4, %eax + movl %eax, (%ebx) + movl %esi, 4(%ebx) + popl %edi + popl %esi + popl %ebp + popl %ebx + ret +.des_decrypt3_end: + SIZE(des_decrypt3,.des_decrypt3_end-des_decrypt3) +.ident "desasm.pl" +.text + .align ALIGN +.globl des_ncbc_encrypt + TYPE(des_ncbc_encrypt,@function) +des_ncbc_encrypt: + + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + movl 28(%esp), %ebp + /* getting iv ptr from parameter 4 */ + movl 36(%esp), %ebx + movl (%ebx), %esi + movl 4(%ebx), %edi + pushl %edi + pushl %esi + pushl %edi + pushl %esi + movl %esp, %ebx + movl 36(%esp), %esi + movl 40(%esp), %edi + /* getting encrypt flag from parameter 5 */ + movl 56(%esp), %ecx + /* get and push parameter 5 */ + pushl %ecx + /* get and push parameter 3 */ + movl 52(%esp), %eax + pushl %eax + pushl %ebx + cmpl $0, %ecx + jz .L004decrypt + andl $4294967288, %ebp + movl 12(%esp), %eax + movl 16(%esp), %ebx + jz .L005encrypt_finish +.L006encrypt_loop: + movl (%esi), %ecx + movl 4(%esi), %edx + xorl %ecx, %eax + xorl %edx, %ebx + movl %eax, 12(%esp) + movl %ebx, 16(%esp) + call des_encrypt + movl 12(%esp), %eax + movl 16(%esp), %ebx + movl %eax, (%edi) + movl %ebx, 4(%edi) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L006encrypt_loop +.L005encrypt_finish: + movl 56(%esp), %ebp + andl $7, %ebp + jz .L007finish + xorl %ecx, %ecx + xorl %edx, %edx + movl .L008cbc_enc_jmp_table(,%ebp,4),%ebp + jmp *%ebp +.L009ej7: + movb 6(%esi), %dh + sall $8, %edx +.L010ej6: + movb 5(%esi), %dh +.L011ej5: + movb 4(%esi), %dl +.L012ej4: + movl (%esi), %ecx + jmp .L013ejend +.L014ej3: + movb 2(%esi), %ch + sall $8, %ecx +.L015ej2: + movb 1(%esi), %ch +.L016ej1: + movb (%esi), %cl +.L013ejend: + xorl %ecx, %eax + xorl %edx, %ebx + movl %eax, 12(%esp) + movl %ebx, 16(%esp) + call des_encrypt + movl 12(%esp), %eax + movl 16(%esp), %ebx + movl %eax, (%edi) + movl %ebx, 4(%edi) + jmp .L007finish +.align ALIGN +.L004decrypt: + andl $4294967288, %ebp + movl 20(%esp), %eax + movl 24(%esp), %ebx + jz .L017decrypt_finish +.L018decrypt_loop: + movl (%esi), %eax + movl 4(%esi), %ebx + movl %eax, 12(%esp) + movl %ebx, 16(%esp) + call des_encrypt + movl 12(%esp), %eax + movl 16(%esp), %ebx + movl 20(%esp), %ecx + movl 24(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx + movl %ecx, (%edi) + movl %edx, 4(%edi) + movl %eax, 20(%esp) + movl %ebx, 24(%esp) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L018decrypt_loop +.L017decrypt_finish: + movl 56(%esp), %ebp + andl $7, %ebp + jz .L007finish + movl (%esi), %eax + movl 4(%esi), %ebx + movl %eax, 12(%esp) + movl %ebx, 16(%esp) + call des_encrypt + movl 12(%esp), %eax + movl 16(%esp), %ebx + movl 20(%esp), %ecx + movl 24(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx +.L019dj7: + rorl $16, %edx + movb %dl, 6(%edi) + shrl $16, %edx +.L020dj6: + movb %dh, 5(%edi) +.L021dj5: + movb %dl, 4(%edi) +.L022dj4: + movl %ecx, (%edi) + jmp .L023djend +.L024dj3: + rorl $16, %ecx + movb %cl, 2(%edi) + sall $16, %ecx +.L025dj2: + movb %ch, 1(%esi) +.L026dj1: + movb %cl, (%esi) +.L023djend: + jmp .L007finish +.align ALIGN +.L007finish: + movl 64(%esp), %ecx + addl $28, %esp + movl %eax, (%ecx) + movl %ebx, 4(%ecx) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.align ALIGN +.L008cbc_enc_jmp_table: + .long 0 + .long .L016ej1 + .long .L015ej2 + .long .L014ej3 + .long .L012ej4 + .long .L011ej5 + .long .L010ej6 + .long .L009ej7 +.align ALIGN +.L027cbc_dec_jmp_table: + .long 0 + .long .L026dj1 + .long .L025dj2 + .long .L024dj3 + .long .L022dj4 + .long .L021dj5 + .long .L020dj6 + .long .L019dj7 +.des_ncbc_encrypt_end: + SIZE(des_ncbc_encrypt,.des_ncbc_encrypt_end-des_ncbc_encrypt) +.ident "desasm.pl" +.text + .align ALIGN +.globl des_ede3_cbc_encrypt + TYPE(des_ede3_cbc_encrypt,@function) +des_ede3_cbc_encrypt: + + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + movl 28(%esp), %ebp + /* getting iv ptr from parameter 6 */ + movl 44(%esp), %ebx + movl (%ebx), %esi + movl 4(%ebx), %edi + pushl %edi + pushl %esi + pushl %edi + pushl %esi + movl %esp, %ebx + movl 36(%esp), %esi + movl 40(%esp), %edi + /* getting encrypt flag from parameter 7 */ + movl 64(%esp), %ecx + /* get and push parameter 5 */ + movl 56(%esp), %eax + pushl %eax + /* get and push parameter 4 */ + movl 56(%esp), %eax + pushl %eax + /* get and push parameter 3 */ + movl 56(%esp), %eax + pushl %eax + pushl %ebx + cmpl $0, %ecx + jz .L028decrypt + andl $4294967288, %ebp + movl 16(%esp), %eax + movl 20(%esp), %ebx + jz .L029encrypt_finish +.L030encrypt_loop: + movl (%esi), %ecx + movl 4(%esi), %edx + xorl %ecx, %eax + xorl %edx, %ebx + movl %eax, 16(%esp) + movl %ebx, 20(%esp) + call des_encrypt3 + movl 16(%esp), %eax + movl 20(%esp), %ebx + movl %eax, (%edi) + movl %ebx, 4(%edi) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L030encrypt_loop +.L029encrypt_finish: + movl 60(%esp), %ebp + andl $7, %ebp + jz .L031finish + xorl %ecx, %ecx + xorl %edx, %edx + movl .L032cbc_enc_jmp_table(,%ebp,4),%ebp + jmp *%ebp +.L033ej7: + movb 6(%esi), %dh + sall $8, %edx +.L034ej6: + movb 5(%esi), %dh +.L035ej5: + movb 4(%esi), %dl +.L036ej4: + movl (%esi), %ecx + jmp .L037ejend +.L038ej3: + movb 2(%esi), %ch + sall $8, %ecx +.L039ej2: + movb 1(%esi), %ch +.L040ej1: + movb (%esi), %cl +.L037ejend: + xorl %ecx, %eax + xorl %edx, %ebx + movl %eax, 16(%esp) + movl %ebx, 20(%esp) + call des_encrypt3 + movl 16(%esp), %eax + movl 20(%esp), %ebx + movl %eax, (%edi) + movl %ebx, 4(%edi) + jmp .L031finish +.align ALIGN +.L028decrypt: + andl $4294967288, %ebp + movl 24(%esp), %eax + movl 28(%esp), %ebx + jz .L041decrypt_finish +.L042decrypt_loop: + movl (%esi), %eax + movl 4(%esi), %ebx + movl %eax, 16(%esp) + movl %ebx, 20(%esp) + call des_decrypt3 + movl 16(%esp), %eax + movl 20(%esp), %ebx + movl 24(%esp), %ecx + movl 28(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx + movl %ecx, (%edi) + movl %edx, 4(%edi) + movl %eax, 24(%esp) + movl %ebx, 28(%esp) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L042decrypt_loop +.L041decrypt_finish: + movl 60(%esp), %ebp + andl $7, %ebp + jz .L031finish + movl (%esi), %eax + movl 4(%esi), %ebx + movl %eax, 16(%esp) + movl %ebx, 20(%esp) + call des_decrypt3 + movl 16(%esp), %eax + movl 20(%esp), %ebx + movl 24(%esp), %ecx + movl 28(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx +.L043dj7: + rorl $16, %edx + movb %dl, 6(%edi) + shrl $16, %edx +.L044dj6: + movb %dh, 5(%edi) +.L045dj5: + movb %dl, 4(%edi) +.L046dj4: + movl %ecx, (%edi) + jmp .L047djend +.L048dj3: + rorl $16, %ecx + movb %cl, 2(%edi) + sall $16, %ecx +.L049dj2: + movb %ch, 1(%esi) +.L050dj1: + movb %cl, (%esi) +.L047djend: + jmp .L031finish +.align ALIGN +.L031finish: + movl 76(%esp), %ecx + addl $32, %esp + movl %eax, (%ecx) + movl %ebx, 4(%ecx) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.align ALIGN +.L032cbc_enc_jmp_table: + .long 0 + .long .L040ej1 + .long .L039ej2 + .long .L038ej3 + .long .L036ej4 + .long .L035ej5 + .long .L034ej6 + .long .L033ej7 +.align ALIGN +.L051cbc_dec_jmp_table: + .long 0 + .long .L050dj1 + .long .L049dj2 + .long .L048dj3 + .long .L046dj4 + .long .L045dj5 + .long .L044dj6 + .long .L043dj7 +.des_ede3_cbc_encrypt_end: + SIZE(des_ede3_cbc_encrypt,.des_ede3_cbc_encrypt_end-des_ede3_cbc_encrypt) +.ident "desasm.pl" diff --git a/src/lib/libssl/src/crypto/des/asm/y-win32.asm b/src/lib/libssl/src/crypto/des/asm/y-win32.asm new file mode 100644 index 0000000000..af5c102422 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/asm/y-win32.asm @@ -0,0 +1,929 @@ + ; Don't even think of reading this code + ; It was automatically generated by crypt586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE crypt586.asm + .386 +.model FLAT +_TEXT SEGMENT +PUBLIC _fcrypt_body +EXTRN _des_SPtrans:DWORD +_fcrypt_body PROC NEAR + push ebp + push ebx + push esi + push edi + ; + ; Load the 2 words + xor edi, edi + xor esi, esi + mov ebp, DWORD PTR 24[esp] + push 25 +L000start: + ; + ; Round 0 + mov eax, DWORD PTR 32[esp] + mov edx, esi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, esi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR [ebp] + xor eax, ebx + mov ecx, DWORD PTR 4[ebp] + xor eax, esi + xor edx, esi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 1 + mov eax, DWORD PTR 32[esp] + mov edx, edi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, edi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 8[ebp] + xor eax, ebx + mov ecx, DWORD PTR 12[ebp] + xor eax, edi + xor edx, edi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 2 + mov eax, DWORD PTR 32[esp] + mov edx, esi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, esi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 16[ebp] + xor eax, ebx + mov ecx, DWORD PTR 20[ebp] + xor eax, esi + xor edx, esi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 3 + mov eax, DWORD PTR 32[esp] + mov edx, edi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, edi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 24[ebp] + xor eax, ebx + mov ecx, DWORD PTR 28[ebp] + xor eax, edi + xor edx, edi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 4 + mov eax, DWORD PTR 32[esp] + mov edx, esi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, esi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 32[ebp] + xor eax, ebx + mov ecx, DWORD PTR 36[ebp] + xor eax, esi + xor edx, esi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 5 + mov eax, DWORD PTR 32[esp] + mov edx, edi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, edi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 40[ebp] + xor eax, ebx + mov ecx, DWORD PTR 44[ebp] + xor eax, edi + xor edx, edi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 6 + mov eax, DWORD PTR 32[esp] + mov edx, esi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, esi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 48[ebp] + xor eax, ebx + mov ecx, DWORD PTR 52[ebp] + xor eax, esi + xor edx, esi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 7 + mov eax, DWORD PTR 32[esp] + mov edx, edi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, edi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 56[ebp] + xor eax, ebx + mov ecx, DWORD PTR 60[ebp] + xor eax, edi + xor edx, edi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 8 + mov eax, DWORD PTR 32[esp] + mov edx, esi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, esi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 64[ebp] + xor eax, ebx + mov ecx, DWORD PTR 68[ebp] + xor eax, esi + xor edx, esi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 9 + mov eax, DWORD PTR 32[esp] + mov edx, edi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, edi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 72[ebp] + xor eax, ebx + mov ecx, DWORD PTR 76[ebp] + xor eax, edi + xor edx, edi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 10 + mov eax, DWORD PTR 32[esp] + mov edx, esi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, esi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 80[ebp] + xor eax, ebx + mov ecx, DWORD PTR 84[ebp] + xor eax, esi + xor edx, esi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 11 + mov eax, DWORD PTR 32[esp] + mov edx, edi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, edi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 88[ebp] + xor eax, ebx + mov ecx, DWORD PTR 92[ebp] + xor eax, edi + xor edx, edi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 12 + mov eax, DWORD PTR 32[esp] + mov edx, esi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, esi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 96[ebp] + xor eax, ebx + mov ecx, DWORD PTR 100[ebp] + xor eax, esi + xor edx, esi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 13 + mov eax, DWORD PTR 32[esp] + mov edx, edi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, edi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 104[ebp] + xor eax, ebx + mov ecx, DWORD PTR 108[ebp] + xor eax, edi + xor edx, edi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + ; + ; Round 14 + mov eax, DWORD PTR 32[esp] + mov edx, esi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, esi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 112[ebp] + xor eax, ebx + mov ecx, DWORD PTR 116[ebp] + xor eax, esi + xor edx, esi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor edi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor edi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor edi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor edi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor edi, ebx + ; + ; Round 15 + mov eax, DWORD PTR 32[esp] + mov edx, edi + shr edx, 16 + mov ecx, DWORD PTR 36[esp] + xor edx, edi + and eax, edx + and edx, ecx + mov ebx, eax + shl ebx, 16 + mov ecx, edx + shl ecx, 16 + xor eax, ebx + xor edx, ecx + mov ebx, DWORD PTR 120[ebp] + xor eax, ebx + mov ecx, DWORD PTR 124[ebp] + xor eax, edi + xor edx, edi + xor edx, ecx + and eax, 0fcfcfcfch + xor ebx, ebx + and edx, 0cfcfcfcfh + xor ecx, ecx + mov bl, al + mov cl, ah + ror edx, 4 + mov ebp, DWORD PTR _des_SPtrans[ebx] + mov bl, dl + xor esi, ebp + mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] + xor esi, ebp + mov cl, dh + shr eax, 16 + mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] + xor esi, ebp + mov bl, ah + shr edx, 16 + mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + mov cl, dh + and eax, 0ffh + and edx, 0ffh + mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0400h+eax] + xor esi, ebx + mov ebx, DWORD PTR _des_SPtrans[0500h+edx] + xor esi, ebx + mov ebx, DWORD PTR [esp] + mov eax, edi + dec ebx + mov edi, esi + mov esi, eax + mov DWORD PTR [esp],ebx + jnz L000start + ; + ; FP + mov edx, DWORD PTR 24[esp] + ror edi, 1 + mov eax, esi + xor esi, edi + and esi, 0aaaaaaaah + xor eax, esi + xor edi, esi + ; + rol eax, 23 + mov esi, eax + xor eax, edi + and eax, 003fc03fch + xor esi, eax + xor edi, eax + ; + rol esi, 10 + mov eax, esi + xor esi, edi + and esi, 033333333h + xor eax, esi + xor edi, esi + ; + rol edi, 18 + mov esi, edi + xor edi, eax + and edi, 0fff0000fh + xor esi, edi + xor eax, edi + ; + rol esi, 12 + mov edi, esi + xor esi, eax + and esi, 0f0f0f0f0h + xor edi, esi + xor eax, esi + ; + ror eax, 4 + mov DWORD PTR [edx],eax + mov DWORD PTR 4[edx],edi + pop ecx + pop edi + pop esi + pop ebx + pop ebp + ret +_fcrypt_body ENDP +_TEXT ENDS +END diff --git a/src/lib/libssl/src/crypto/des/asm/yx86unix.cpp b/src/lib/libssl/src/crypto/des/asm/yx86unix.cpp new file mode 100644 index 0000000000..8719e38607 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/asm/yx86unix.cpp @@ -0,0 +1,976 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define des_SPtrans _des_SPtrans +#define fcrypt_body _fcrypt_body + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by crypt586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "crypt586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl fcrypt_body + TYPE(fcrypt_body,@function) +fcrypt_body: + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + + + /* Load the 2 words */ + xorl %edi, %edi + xorl %esi, %esi + movl 24(%esp), %ebp + pushl $25 +.L000start: + + /* Round 0 */ + movl 32(%esp), %eax + movl %esi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %esi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl (%ebp), %ebx + xorl %ebx, %eax + movl 4(%ebp), %ecx + xorl %esi, %eax + xorl %esi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 1 */ + movl 32(%esp), %eax + movl %edi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %edi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 8(%ebp), %ebx + xorl %ebx, %eax + movl 12(%ebp), %ecx + xorl %edi, %eax + xorl %edi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 2 */ + movl 32(%esp), %eax + movl %esi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %esi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 16(%ebp), %ebx + xorl %ebx, %eax + movl 20(%ebp), %ecx + xorl %esi, %eax + xorl %esi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 3 */ + movl 32(%esp), %eax + movl %edi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %edi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 24(%ebp), %ebx + xorl %ebx, %eax + movl 28(%ebp), %ecx + xorl %edi, %eax + xorl %edi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 4 */ + movl 32(%esp), %eax + movl %esi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %esi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 32(%ebp), %ebx + xorl %ebx, %eax + movl 36(%ebp), %ecx + xorl %esi, %eax + xorl %esi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 5 */ + movl 32(%esp), %eax + movl %edi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %edi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 40(%ebp), %ebx + xorl %ebx, %eax + movl 44(%ebp), %ecx + xorl %edi, %eax + xorl %edi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 6 */ + movl 32(%esp), %eax + movl %esi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %esi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 48(%ebp), %ebx + xorl %ebx, %eax + movl 52(%ebp), %ecx + xorl %esi, %eax + xorl %esi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 7 */ + movl 32(%esp), %eax + movl %edi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %edi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 56(%ebp), %ebx + xorl %ebx, %eax + movl 60(%ebp), %ecx + xorl %edi, %eax + xorl %edi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 8 */ + movl 32(%esp), %eax + movl %esi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %esi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 64(%ebp), %ebx + xorl %ebx, %eax + movl 68(%ebp), %ecx + xorl %esi, %eax + xorl %esi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 9 */ + movl 32(%esp), %eax + movl %edi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %edi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 72(%ebp), %ebx + xorl %ebx, %eax + movl 76(%ebp), %ecx + xorl %edi, %eax + xorl %edi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 10 */ + movl 32(%esp), %eax + movl %esi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %esi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 80(%ebp), %ebx + xorl %ebx, %eax + movl 84(%ebp), %ecx + xorl %esi, %eax + xorl %esi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 11 */ + movl 32(%esp), %eax + movl %edi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %edi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 88(%ebp), %ebx + xorl %ebx, %eax + movl 92(%ebp), %ecx + xorl %edi, %eax + xorl %edi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 12 */ + movl 32(%esp), %eax + movl %esi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %esi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 96(%ebp), %ebx + xorl %ebx, %eax + movl 100(%ebp), %ecx + xorl %esi, %eax + xorl %esi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 13 */ + movl 32(%esp), %eax + movl %edi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %edi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 104(%ebp), %ebx + xorl %ebx, %eax + movl 108(%ebp), %ecx + xorl %edi, %eax + xorl %edi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + + /* Round 14 */ + movl 32(%esp), %eax + movl %esi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %esi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 112(%ebp), %ebx + xorl %ebx, %eax + movl 116(%ebp), %ecx + xorl %esi, %eax + xorl %esi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %edi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %edi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %edi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %edi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %edi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %edi + + /* Round 15 */ + movl 32(%esp), %eax + movl %edi, %edx + shrl $16, %edx + movl 36(%esp), %ecx + xorl %edi, %edx + andl %edx, %eax + andl %ecx, %edx + movl %eax, %ebx + sall $16, %ebx + movl %edx, %ecx + sall $16, %ecx + xorl %ebx, %eax + xorl %ecx, %edx + movl 120(%ebp), %ebx + xorl %ebx, %eax + movl 124(%ebp), %ecx + xorl %edi, %eax + xorl %edi, %edx + xorl %ecx, %edx + andl $0xfcfcfcfc, %eax + xorl %ebx, %ebx + andl $0xcfcfcfcf, %edx + xorl %ecx, %ecx + movb %al, %bl + movb %ah, %cl + rorl $4, %edx + movl des_SPtrans(%ebx),%ebp + movb %dl, %bl + xorl %ebp, %esi + movl 0x200+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movb %dh, %cl + shrl $16, %eax + movl 0x100+des_SPtrans(%ebx),%ebp + xorl %ebp, %esi + movb %ah, %bl + shrl $16, %edx + movl 0x300+des_SPtrans(%ecx),%ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + movb %dh, %cl + andl $0xff, %eax + andl $0xff, %edx + movl 0x600+des_SPtrans(%ebx),%ebx + xorl %ebx, %esi + movl 0x700+des_SPtrans(%ecx),%ebx + xorl %ebx, %esi + movl 0x400+des_SPtrans(%eax),%ebx + xorl %ebx, %esi + movl 0x500+des_SPtrans(%edx),%ebx + xorl %ebx, %esi + movl (%esp), %ebx + movl %edi, %eax + decl %ebx + movl %esi, %edi + movl %eax, %esi + movl %ebx, (%esp) + jnz .L000start + + /* FP */ + movl 24(%esp), %edx +.byte 209 +.byte 207 /* rorl $1 %edi */ + movl %esi, %eax + xorl %edi, %esi + andl $0xaaaaaaaa, %esi + xorl %esi, %eax + xorl %esi, %edi + + roll $23, %eax + movl %eax, %esi + xorl %edi, %eax + andl $0x03fc03fc, %eax + xorl %eax, %esi + xorl %eax, %edi + + roll $10, %esi + movl %esi, %eax + xorl %edi, %esi + andl $0x33333333, %esi + xorl %esi, %eax + xorl %esi, %edi + + roll $18, %edi + movl %edi, %esi + xorl %eax, %edi + andl $0xfff0000f, %edi + xorl %edi, %esi + xorl %edi, %eax + + roll $12, %esi + movl %esi, %edi + xorl %eax, %esi + andl $0xf0f0f0f0, %esi + xorl %esi, %edi + xorl %esi, %eax + + rorl $4, %eax + movl %eax, (%edx) + movl %edi, 4(%edx) + popl %ecx + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.fcrypt_body_end: + SIZE(fcrypt_body,.fcrypt_body_end-fcrypt_body) +.ident "fcrypt_body" diff --git a/src/lib/libssl/src/crypto/des/des.man b/src/lib/libssl/src/crypto/des/des.man new file mode 100644 index 0000000000..7e06a1851a --- /dev/null +++ b/src/lib/libssl/src/crypto/des/des.man @@ -0,0 +1,186 @@ +.TH DES 1 +.SH NAME +des - encrypt or decrypt data using Data Encryption Standard +.SH SYNOPSIS +.B des +( +.B \-e +| +.B \-E +) | ( +.B \-d +| +.B \-D +) | ( +.B \-\fR[\fPcC\fR][\fPckname\fR]\fP +) | +[ +.B \-b3hfs +] [ +.B \-k +.I key +] +] [ +.B \-u\fR[\fIuuname\fR] +[ +.I input-file +[ +.I output-file +] ] +.SH DESCRIPTION +.B des +encrypts and decrypts data using the +Data Encryption Standard algorithm. +One of +.B \-e, \-E +(for encrypt) or +.B \-d, \-D +(for decrypt) must be specified. +It is also possible to use +.B \-c +or +.B \-C +in conjunction or instead of the a encrypt/decrypt option to generate +a 16 character hexadecimal checksum, generated via the +.I des_cbc_cksum. +.LP +Two standard encryption modes are supported by the +.B des +program, Cipher Block Chaining (the default) and Electronic Code Book +(specified with +.B \-b +). +.LP +The key used for the DES +algorithm is obtained by prompting the user unless the +.B `\-k +.I key' +option is given. +If the key is an argument to the +.B des +command, it is potentially visible to users executing +.BR ps (1) +or a derivative. To minimise this possibility, +.B des +takes care to destroy the key argument immediately upon entry. +If your shell keeps a history file be careful to make sure it is not +world readable. +.LP +Since this program attempts to maintain compatability with sunOS's +des(1) command, there are 2 different methods used to convert the user +supplied key to a des key. +Whenever and one or more of +.B \-E, \-D, \-C +or +.B \-3 +options are used, the key conversion procedure will not be compatible +with the sunOS des(1) version but will use all the user supplied +character to generate the des key. +.B des +command reads from standard input unless +.I input-file +is specified and writes to standard output unless +.I output-file +is given. +.SH OPTIONS +.TP +.B \-b +Select ECB +(eight bytes at a time) encryption mode. +.TP +.B \-3 +Encrypt using triple encryption. +By default triple cbc encryption is used but if the +.B \-b +option is used then triple ecb encryption is performed. +If the key is less than 8 characters long, the flag has no effect. +.TP +.B \-e +Encrypt data using an 8 byte key in a manner compatible with sunOS +des(1). +.TP +.B \-E +Encrypt data using a key of nearly unlimited length (1024 bytes). +This will product a more secure encryption. +.TP +.B \-d +Decrypt data that was encrypted with the \-e option. +.TP +.B \-D +Decrypt data that was encrypted with the \-E option. +.TP +.B \-c +Generate a 16 character hexadecimal cbc checksum and output this to +stderr. +If a filename was specified after the +.B \-c +option, the checksum is output to that file. +The checksum is generated using a key generated in a sunOS compatible +manner. +.TP +.B \-C +A cbc checksum is generated in the same manner as described for the +.B \-c +option but the DES key is generated in the same manner as used for the +.B \-E +and +.B \-D +options +.TP +.B \-f +Does nothing - allowed for compatibility with sunOS des(1) command. +.TP +.B \-s +Does nothing - allowed for compatibility with sunOS des(1) command. +.TP +.B "\-k \fIkey\fP" +Use the encryption +.I key +specified. +.TP +.B "\-h" +The +.I key +is assumed to be a 16 character hexadecimal number. +If the +.B "\-3" +option is used the key is assumed to be a 32 character hexadecimal +number. +.TP +.B \-u +This flag is used to read and write uuencoded files. If decrypting, +the input file is assumed to contain uuencoded, DES encrypted data. +If encrypting, the characters following the -u are used as the name of +the uuencoded file to embed in the begin line of the uuencoded +output. If there is no name specified after the -u, the name text.des +will be embedded in the header. +.SH SEE ALSO +.B ps (1) +.B des_crypt(3) +.SH BUGS +.LP +The problem with using the +.B -e +option is the short key length. +It would be better to use a real 56-bit key rather than an +ASCII-based 56-bit pattern. Knowing that the key was derived from ASCII +radically reduces the time necessary for a brute-force cryptographic attack. +My attempt to remove this problem is to add an alternative text-key to +DES-key function. This alternative function (accessed via +.B -E, -D, -S +and +.B -3 +) +uses DES to help generate the key. +.LP +Be carefully when using the -u option. Doing des -ud <filename> will +not decrypt filename (the -u option will gobble the d option). +.LP +The VMS operating system operates in a world where files are always a +multiple of 512 bytes. This causes problems when encrypted data is +send from unix to VMS since a 88 byte file will suddenly be padded +with 424 null bytes. To get around this problem, use the -u option +to uuencode the data before it is send to the VMS system. +.SH AUTHOR +.LP +Eric Young (eay@cryptsoft.com) diff --git a/src/lib/libssl/src/crypto/des/des.org b/src/lib/libssl/src/crypto/des/des.org new file mode 100644 index 0000000000..a4cf5c8770 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/des.org @@ -0,0 +1,301 @@ +/* crypto/des/des.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify des.org since des.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +#ifndef HEADER_DES_H +#define HEADER_DES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdio.h> + +/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a + * %20 speed up (longs are 8 bytes, int's are 4). */ +#ifndef DES_LONG +#define DES_LONG unsigned long +#endif + +typedef unsigned char des_cblock[8]; +typedef struct des_ks_struct + { + union { + des_cblock _; + /* make sure things are correct size on machines with + * 8 byte longs */ + DES_LONG pad[2]; + } ks; +#undef _ +#define _ ks._ + } des_key_schedule[16]; + +#define DES_KEY_SZ (sizeof(des_cblock)) +#define DES_SCHEDULE_SZ (sizeof(des_key_schedule)) + +#define DES_ENCRYPT 1 +#define DES_DECRYPT 0 + +#define DES_CBC_MODE 0 +#define DES_PCBC_MODE 1 + +#define des_ecb2_encrypt(i,o,k1,k2,e) \ + des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) + +#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ + des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) + +#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ + des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) + +#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ + des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) + +#define C_Block des_cblock +#define Key_schedule des_key_schedule +#ifdef KERBEROS +#define ENCRYPT DES_ENCRYPT +#define DECRYPT DES_DECRYPT +#endif +#define KEY_SZ DES_KEY_SZ +#define string_to_key des_string_to_key +#define read_pw_string des_read_pw_string +#define random_key des_random_key +#define pcbc_encrypt des_pcbc_encrypt +#define set_key des_set_key +#define key_sched des_key_sched +#define ecb_encrypt des_ecb_encrypt +#define cbc_encrypt des_cbc_encrypt +#define ncbc_encrypt des_ncbc_encrypt +#define xcbc_encrypt des_xcbc_encrypt +#define cbc_cksum des_cbc_cksum +#define quad_cksum des_quad_cksum + +/* For compatibility with the MIT lib - eay 20/05/92 */ +typedef des_key_schedule bit_64; +#define des_fixup_key_parity des_set_odd_parity +#define des_check_key_parity check_parity + +extern int des_check_key; /* defaults to false */ +extern int des_rw_mode; /* defaults to DES_PCBC_MODE */ + +/* The next line is used to disable full ANSI prototypes, if your + * compiler has problems with the prototypes, make sure this line always + * evaluates to true :-) */ +#if defined(MSDOS) || defined(__STDC__) +#undef NOPROTO +#endif +#ifndef NOPROTO +char *des_options(void); +void des_ecb3_encrypt(des_cblock *input,des_cblock *output, + des_key_schedule ks1,des_key_schedule ks2, + des_key_schedule ks3, int enc); +DES_LONG des_cbc_cksum(des_cblock *input,des_cblock *output, + long length,des_key_schedule schedule,des_cblock *ivec); +void des_cbc_encrypt(des_cblock *input,des_cblock *output,long length, + des_key_schedule schedule,des_cblock *ivec,int enc); +void des_ncbc_encrypt(des_cblock *input,des_cblock *output,long length, + des_key_schedule schedule,des_cblock *ivec,int enc); +void des_xcbc_encrypt(des_cblock *input,des_cblock *output,long length, + des_key_schedule schedule,des_cblock *ivec, + des_cblock *inw,des_cblock *outw,int enc); +void des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits, + long length,des_key_schedule schedule,des_cblock *ivec,int enc); +void des_ecb_encrypt(des_cblock *input,des_cblock *output, + des_key_schedule ks,int enc); +void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc); +void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc); +void des_encrypt3(DES_LONG *data, des_key_schedule ks1, + des_key_schedule ks2, des_key_schedule ks3); +void des_decrypt3(DES_LONG *data, des_key_schedule ks1, + des_key_schedule ks2, des_key_schedule ks3); +void des_ede3_cbc_encrypt(des_cblock *input, des_cblock *output, + long length, des_key_schedule ks1, des_key_schedule ks2, + des_key_schedule ks3, des_cblock *ivec, int enc); +void des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, + long length, des_key_schedule ks1, des_key_schedule ks2, + des_key_schedule ks3, des_cblock *ivec, int *num, int enc); +void des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, + long length, des_key_schedule ks1, des_key_schedule ks2, + des_key_schedule ks3, des_cblock *ivec, int *num); + +void des_xwhite_in2out(des_cblock (*des_key), des_cblock (*in_white), + des_cblock (*out_white)); + +int des_enc_read(int fd,char *buf,int len,des_key_schedule sched, + des_cblock *iv); +int des_enc_write(int fd,char *buf,int len,des_key_schedule sched, + des_cblock *iv); +char *des_fcrypt(const char *buf,const char *salt, char *ret); +#ifdef PERL5 +char *des_crypt(const char *buf,const char *salt); +#else +/* some stupid compilers complain because I have declared char instead + * of const char */ +#ifdef HEADER_DES_LOCL_H +char *crypt(const char *buf,const char *salt); +#else +char *crypt(); +#endif +#endif +void des_ofb_encrypt(unsigned char *in,unsigned char *out, + int numbits,long length,des_key_schedule schedule,des_cblock *ivec); +void des_pcbc_encrypt(des_cblock *input,des_cblock *output,long length, + des_key_schedule schedule,des_cblock *ivec,int enc); +DES_LONG des_quad_cksum(des_cblock *input,des_cblock *output, + long length,int out_count,des_cblock *seed); +void des_random_seed(des_cblock key); +void des_random_key(des_cblock ret); +int des_read_password(des_cblock *key,char *prompt,int verify); +int des_read_2passwords(des_cblock *key1,des_cblock *key2, + char *prompt,int verify); +int des_read_pw_string(char *buf,int length,char *prompt,int verify); +void des_set_odd_parity(des_cblock *key); +int des_is_weak_key(des_cblock *key); +int des_set_key(des_cblock *key,des_key_schedule schedule); +int des_key_sched(des_cblock *key,des_key_schedule schedule); +void des_string_to_key(char *str,des_cblock *key); +void des_string_to_2keys(char *str,des_cblock *key1,des_cblock *key2); +void des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, + des_key_schedule schedule, des_cblock *ivec, int *num, int enc); +void des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, + des_key_schedule schedule, des_cblock *ivec, int *num); +int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify); + +/* Extra functions from Mark Murray <mark@grondar.za> */ +void des_cblock_print_file(des_cblock *cb, FILE *fp); +/* The following functions are not in the normal unix build or the + * SSLeay build. When using the SSLeay build, use RAND_seed() + * and RAND_bytes() instead. */ +int des_new_random_key(des_cblock *key); +void des_init_random_number_generator(des_cblock *key); +void des_set_random_generator_seed(des_cblock *key); +void des_set_sequence_number(des_cblock new_sequence_number); +void des_generate_random_block(des_cblock *block); + +#else + +char *des_options(); +void des_ecb3_encrypt(); +DES_LONG des_cbc_cksum(); +void des_cbc_encrypt(); +void des_ncbc_encrypt(); +void des_xcbc_encrypt(); +void des_cfb_encrypt(); +void des_ede3_cfb64_encrypt(); +void des_ede3_ofb64_encrypt(); +void des_ecb_encrypt(); +void des_encrypt(); +void des_encrypt2(); +void des_encrypt3(); +void des_decrypt3(); +void des_ede3_cbc_encrypt(); +int des_enc_read(); +int des_enc_write(); +char *des_fcrypt(); +#ifdef PERL5 +char *des_crypt(); +#else +char *crypt(); +#endif +void des_ofb_encrypt(); +void des_pcbc_encrypt(); +DES_LONG des_quad_cksum(); +void des_random_seed(); +void des_random_key(); +int des_read_password(); +int des_read_2passwords(); +int des_read_pw_string(); +void des_set_odd_parity(); +int des_is_weak_key(); +int des_set_key(); +int des_key_sched(); +void des_string_to_key(); +void des_string_to_2keys(); +void des_cfb64_encrypt(); +void des_ofb64_encrypt(); +int des_read_pw(); +void des_xwhite_in2out(); + +/* Extra functions from Mark Murray <mark@grondar.za> */ +void des_cblock_print_file(); +/* The following functions are not in the normal unix build or the + * SSLeay build. When using the SSLeay build, use RAND_seed() + * and RAND_bytes() instead. */ +#ifdef FreeBSD +int des_new_random_key(); +void des_init_random_number_generator(); +void des_set_random_generator_seed(); +void des_set_sequence_number(); +void des_generate_random_block(); +#endif + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/lib/libssl/src/crypto/des/des.pl b/src/lib/libssl/src/crypto/des/des.pl new file mode 100644 index 0000000000..935eacb504 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/des.pl @@ -0,0 +1,552 @@ +#!/usr/bin/perl +# des.pl - eric young 22/11/1991 eay@cryptsoft.com +# +# Copyright (C) 1993 Eric Young +# +# 11 April 1996 - patched to circumvent Perl 5 (through 5.002) problem +# with sign-extension on right shift operations. +# Ed Kubaitis - ejk@uiuc.edu +# +# eay - 92/08/31 - I think I have fixed all problems for 64bit +# versions of perl but I could be wrong since I have not tested it yet :-). +# +# This is an implementation of DES in perl. +# The two routines (des_set_key and des_ecb_encrypt) +# take 8 byte objects as arguments. +# +# des_set_key takes an 8 byte string as a key and returns a key schedule +# for use in calls to des_ecb_encrypt. +# des_ecb_encrypt takes three arguments, the first is a key schedule +# (make sure to pass it by reference with the *), the second is 1 +# to encrypt, 0 to decrypt. The third argument is an 8 byte object +# to encrypt. The function returns an 8 byte object that has been +# DES encrypted. +# +# example: +# require 'des.pl' +# +# $key =pack("C8",0x12,0x23,0x45,0x67,0x89,0xab,0xcd,0xef); +# @ks= &des_set_key($key); +# +# $outbytes= &des_ecb_encrypt(*ks,1,$data); +# @enc =unpack("C8",$outbytes); +# + +package des; + +eval("use integer;") if (int($]) > 4); + +# The following 8 arrays are used in des_set_key +@skb0=( +# for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 +0x00000000,0x00000010,0x20000000,0x20000010, +0x00010000,0x00010010,0x20010000,0x20010010, +0x00000800,0x00000810,0x20000800,0x20000810, +0x00010800,0x00010810,0x20010800,0x20010810, +0x00000020,0x00000030,0x20000020,0x20000030, +0x00010020,0x00010030,0x20010020,0x20010030, +0x00000820,0x00000830,0x20000820,0x20000830, +0x00010820,0x00010830,0x20010820,0x20010830, +0x00080000,0x00080010,0x20080000,0x20080010, +0x00090000,0x00090010,0x20090000,0x20090010, +0x00080800,0x00080810,0x20080800,0x20080810, +0x00090800,0x00090810,0x20090800,0x20090810, +0x00080020,0x00080030,0x20080020,0x20080030, +0x00090020,0x00090030,0x20090020,0x20090030, +0x00080820,0x00080830,0x20080820,0x20080830, +0x00090820,0x00090830,0x20090820,0x20090830, +); +@skb1=( +# for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 +0x00000000,0x02000000,0x00002000,0x02002000, +0x00200000,0x02200000,0x00202000,0x02202000, +0x00000004,0x02000004,0x00002004,0x02002004, +0x00200004,0x02200004,0x00202004,0x02202004, +0x00000400,0x02000400,0x00002400,0x02002400, +0x00200400,0x02200400,0x00202400,0x02202400, +0x00000404,0x02000404,0x00002404,0x02002404, +0x00200404,0x02200404,0x00202404,0x02202404, +0x10000000,0x12000000,0x10002000,0x12002000, +0x10200000,0x12200000,0x10202000,0x12202000, +0x10000004,0x12000004,0x10002004,0x12002004, +0x10200004,0x12200004,0x10202004,0x12202004, +0x10000400,0x12000400,0x10002400,0x12002400, +0x10200400,0x12200400,0x10202400,0x12202400, +0x10000404,0x12000404,0x10002404,0x12002404, +0x10200404,0x12200404,0x10202404,0x12202404, +); +@skb2=( +# for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 +0x00000000,0x00000001,0x00040000,0x00040001, +0x01000000,0x01000001,0x01040000,0x01040001, +0x00000002,0x00000003,0x00040002,0x00040003, +0x01000002,0x01000003,0x01040002,0x01040003, +0x00000200,0x00000201,0x00040200,0x00040201, +0x01000200,0x01000201,0x01040200,0x01040201, +0x00000202,0x00000203,0x00040202,0x00040203, +0x01000202,0x01000203,0x01040202,0x01040203, +0x08000000,0x08000001,0x08040000,0x08040001, +0x09000000,0x09000001,0x09040000,0x09040001, +0x08000002,0x08000003,0x08040002,0x08040003, +0x09000002,0x09000003,0x09040002,0x09040003, +0x08000200,0x08000201,0x08040200,0x08040201, +0x09000200,0x09000201,0x09040200,0x09040201, +0x08000202,0x08000203,0x08040202,0x08040203, +0x09000202,0x09000203,0x09040202,0x09040203, +); +@skb3=( +# for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 +0x00000000,0x00100000,0x00000100,0x00100100, +0x00000008,0x00100008,0x00000108,0x00100108, +0x00001000,0x00101000,0x00001100,0x00101100, +0x00001008,0x00101008,0x00001108,0x00101108, +0x04000000,0x04100000,0x04000100,0x04100100, +0x04000008,0x04100008,0x04000108,0x04100108, +0x04001000,0x04101000,0x04001100,0x04101100, +0x04001008,0x04101008,0x04001108,0x04101108, +0x00020000,0x00120000,0x00020100,0x00120100, +0x00020008,0x00120008,0x00020108,0x00120108, +0x00021000,0x00121000,0x00021100,0x00121100, +0x00021008,0x00121008,0x00021108,0x00121108, +0x04020000,0x04120000,0x04020100,0x04120100, +0x04020008,0x04120008,0x04020108,0x04120108, +0x04021000,0x04121000,0x04021100,0x04121100, +0x04021008,0x04121008,0x04021108,0x04121108, +); +@skb4=( +# for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 +0x00000000,0x10000000,0x00010000,0x10010000, +0x00000004,0x10000004,0x00010004,0x10010004, +0x20000000,0x30000000,0x20010000,0x30010000, +0x20000004,0x30000004,0x20010004,0x30010004, +0x00100000,0x10100000,0x00110000,0x10110000, +0x00100004,0x10100004,0x00110004,0x10110004, +0x20100000,0x30100000,0x20110000,0x30110000, +0x20100004,0x30100004,0x20110004,0x30110004, +0x00001000,0x10001000,0x00011000,0x10011000, +0x00001004,0x10001004,0x00011004,0x10011004, +0x20001000,0x30001000,0x20011000,0x30011000, +0x20001004,0x30001004,0x20011004,0x30011004, +0x00101000,0x10101000,0x00111000,0x10111000, +0x00101004,0x10101004,0x00111004,0x10111004, +0x20101000,0x30101000,0x20111000,0x30111000, +0x20101004,0x30101004,0x20111004,0x30111004, +); +@skb5=( +# for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 +0x00000000,0x08000000,0x00000008,0x08000008, +0x00000400,0x08000400,0x00000408,0x08000408, +0x00020000,0x08020000,0x00020008,0x08020008, +0x00020400,0x08020400,0x00020408,0x08020408, +0x00000001,0x08000001,0x00000009,0x08000009, +0x00000401,0x08000401,0x00000409,0x08000409, +0x00020001,0x08020001,0x00020009,0x08020009, +0x00020401,0x08020401,0x00020409,0x08020409, +0x02000000,0x0A000000,0x02000008,0x0A000008, +0x02000400,0x0A000400,0x02000408,0x0A000408, +0x02020000,0x0A020000,0x02020008,0x0A020008, +0x02020400,0x0A020400,0x02020408,0x0A020408, +0x02000001,0x0A000001,0x02000009,0x0A000009, +0x02000401,0x0A000401,0x02000409,0x0A000409, +0x02020001,0x0A020001,0x02020009,0x0A020009, +0x02020401,0x0A020401,0x02020409,0x0A020409, +); +@skb6=( +# for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 +0x00000000,0x00000100,0x00080000,0x00080100, +0x01000000,0x01000100,0x01080000,0x01080100, +0x00000010,0x00000110,0x00080010,0x00080110, +0x01000010,0x01000110,0x01080010,0x01080110, +0x00200000,0x00200100,0x00280000,0x00280100, +0x01200000,0x01200100,0x01280000,0x01280100, +0x00200010,0x00200110,0x00280010,0x00280110, +0x01200010,0x01200110,0x01280010,0x01280110, +0x00000200,0x00000300,0x00080200,0x00080300, +0x01000200,0x01000300,0x01080200,0x01080300, +0x00000210,0x00000310,0x00080210,0x00080310, +0x01000210,0x01000310,0x01080210,0x01080310, +0x00200200,0x00200300,0x00280200,0x00280300, +0x01200200,0x01200300,0x01280200,0x01280300, +0x00200210,0x00200310,0x00280210,0x00280310, +0x01200210,0x01200310,0x01280210,0x01280310, +); +@skb7=( +# for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 +0x00000000,0x04000000,0x00040000,0x04040000, +0x00000002,0x04000002,0x00040002,0x04040002, +0x00002000,0x04002000,0x00042000,0x04042000, +0x00002002,0x04002002,0x00042002,0x04042002, +0x00000020,0x04000020,0x00040020,0x04040020, +0x00000022,0x04000022,0x00040022,0x04040022, +0x00002020,0x04002020,0x00042020,0x04042020, +0x00002022,0x04002022,0x00042022,0x04042022, +0x00000800,0x04000800,0x00040800,0x04040800, +0x00000802,0x04000802,0x00040802,0x04040802, +0x00002800,0x04002800,0x00042800,0x04042800, +0x00002802,0x04002802,0x00042802,0x04042802, +0x00000820,0x04000820,0x00040820,0x04040820, +0x00000822,0x04000822,0x00040822,0x04040822, +0x00002820,0x04002820,0x00042820,0x04042820, +0x00002822,0x04002822,0x00042822,0x04042822, +); + +@shifts2=(0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0); + +# used in ecb_encrypt +@SP0=( +0x00410100, 0x00010000, 0x40400000, 0x40410100, +0x00400000, 0x40010100, 0x40010000, 0x40400000, +0x40010100, 0x00410100, 0x00410000, 0x40000100, +0x40400100, 0x00400000, 0x00000000, 0x40010000, +0x00010000, 0x40000000, 0x00400100, 0x00010100, +0x40410100, 0x00410000, 0x40000100, 0x00400100, +0x40000000, 0x00000100, 0x00010100, 0x40410000, +0x00000100, 0x40400100, 0x40410000, 0x00000000, +0x00000000, 0x40410100, 0x00400100, 0x40010000, +0x00410100, 0x00010000, 0x40000100, 0x00400100, +0x40410000, 0x00000100, 0x00010100, 0x40400000, +0x40010100, 0x40000000, 0x40400000, 0x00410000, +0x40410100, 0x00010100, 0x00410000, 0x40400100, +0x00400000, 0x40000100, 0x40010000, 0x00000000, +0x00010000, 0x00400000, 0x40400100, 0x00410100, +0x40000000, 0x40410000, 0x00000100, 0x40010100, +); +@SP1=( +0x08021002, 0x00000000, 0x00021000, 0x08020000, +0x08000002, 0x00001002, 0x08001000, 0x00021000, +0x00001000, 0x08020002, 0x00000002, 0x08001000, +0x00020002, 0x08021000, 0x08020000, 0x00000002, +0x00020000, 0x08001002, 0x08020002, 0x00001000, +0x00021002, 0x08000000, 0x00000000, 0x00020002, +0x08001002, 0x00021002, 0x08021000, 0x08000002, +0x08000000, 0x00020000, 0x00001002, 0x08021002, +0x00020002, 0x08021000, 0x08001000, 0x00021002, +0x08021002, 0x00020002, 0x08000002, 0x00000000, +0x08000000, 0x00001002, 0x00020000, 0x08020002, +0x00001000, 0x08000000, 0x00021002, 0x08001002, +0x08021000, 0x00001000, 0x00000000, 0x08000002, +0x00000002, 0x08021002, 0x00021000, 0x08020000, +0x08020002, 0x00020000, 0x00001002, 0x08001000, +0x08001002, 0x00000002, 0x08020000, 0x00021000, +); +@SP2=( +0x20800000, 0x00808020, 0x00000020, 0x20800020, +0x20008000, 0x00800000, 0x20800020, 0x00008020, +0x00800020, 0x00008000, 0x00808000, 0x20000000, +0x20808020, 0x20000020, 0x20000000, 0x20808000, +0x00000000, 0x20008000, 0x00808020, 0x00000020, +0x20000020, 0x20808020, 0x00008000, 0x20800000, +0x20808000, 0x00800020, 0x20008020, 0x00808000, +0x00008020, 0x00000000, 0x00800000, 0x20008020, +0x00808020, 0x00000020, 0x20000000, 0x00008000, +0x20000020, 0x20008000, 0x00808000, 0x20800020, +0x00000000, 0x00808020, 0x00008020, 0x20808000, +0x20008000, 0x00800000, 0x20808020, 0x20000000, +0x20008020, 0x20800000, 0x00800000, 0x20808020, +0x00008000, 0x00800020, 0x20800020, 0x00008020, +0x00800020, 0x00000000, 0x20808000, 0x20000020, +0x20800000, 0x20008020, 0x00000020, 0x00808000, +); +@SP3=( +0x00080201, 0x02000200, 0x00000001, 0x02080201, +0x00000000, 0x02080000, 0x02000201, 0x00080001, +0x02080200, 0x02000001, 0x02000000, 0x00000201, +0x02000001, 0x00080201, 0x00080000, 0x02000000, +0x02080001, 0x00080200, 0x00000200, 0x00000001, +0x00080200, 0x02000201, 0x02080000, 0x00000200, +0x00000201, 0x00000000, 0x00080001, 0x02080200, +0x02000200, 0x02080001, 0x02080201, 0x00080000, +0x02080001, 0x00000201, 0x00080000, 0x02000001, +0x00080200, 0x02000200, 0x00000001, 0x02080000, +0x02000201, 0x00000000, 0x00000200, 0x00080001, +0x00000000, 0x02080001, 0x02080200, 0x00000200, +0x02000000, 0x02080201, 0x00080201, 0x00080000, +0x02080201, 0x00000001, 0x02000200, 0x00080201, +0x00080001, 0x00080200, 0x02080000, 0x02000201, +0x00000201, 0x02000000, 0x02000001, 0x02080200, +); +@SP4=( +0x01000000, 0x00002000, 0x00000080, 0x01002084, +0x01002004, 0x01000080, 0x00002084, 0x01002000, +0x00002000, 0x00000004, 0x01000004, 0x00002080, +0x01000084, 0x01002004, 0x01002080, 0x00000000, +0x00002080, 0x01000000, 0x00002004, 0x00000084, +0x01000080, 0x00002084, 0x00000000, 0x01000004, +0x00000004, 0x01000084, 0x01002084, 0x00002004, +0x01002000, 0x00000080, 0x00000084, 0x01002080, +0x01002080, 0x01000084, 0x00002004, 0x01002000, +0x00002000, 0x00000004, 0x01000004, 0x01000080, +0x01000000, 0x00002080, 0x01002084, 0x00000000, +0x00002084, 0x01000000, 0x00000080, 0x00002004, +0x01000084, 0x00000080, 0x00000000, 0x01002084, +0x01002004, 0x01002080, 0x00000084, 0x00002000, +0x00002080, 0x01002004, 0x01000080, 0x00000084, +0x00000004, 0x00002084, 0x01002000, 0x01000004, +); +@SP5=( +0x10000008, 0x00040008, 0x00000000, 0x10040400, +0x00040008, 0x00000400, 0x10000408, 0x00040000, +0x00000408, 0x10040408, 0x00040400, 0x10000000, +0x10000400, 0x10000008, 0x10040000, 0x00040408, +0x00040000, 0x10000408, 0x10040008, 0x00000000, +0x00000400, 0x00000008, 0x10040400, 0x10040008, +0x10040408, 0x10040000, 0x10000000, 0x00000408, +0x00000008, 0x00040400, 0x00040408, 0x10000400, +0x00000408, 0x10000000, 0x10000400, 0x00040408, +0x10040400, 0x00040008, 0x00000000, 0x10000400, +0x10000000, 0x00000400, 0x10040008, 0x00040000, +0x00040008, 0x10040408, 0x00040400, 0x00000008, +0x10040408, 0x00040400, 0x00040000, 0x10000408, +0x10000008, 0x10040000, 0x00040408, 0x00000000, +0x00000400, 0x10000008, 0x10000408, 0x10040400, +0x10040000, 0x00000408, 0x00000008, 0x10040008, +); +@SP6=( +0x00000800, 0x00000040, 0x00200040, 0x80200000, +0x80200840, 0x80000800, 0x00000840, 0x00000000, +0x00200000, 0x80200040, 0x80000040, 0x00200800, +0x80000000, 0x00200840, 0x00200800, 0x80000040, +0x80200040, 0x00000800, 0x80000800, 0x80200840, +0x00000000, 0x00200040, 0x80200000, 0x00000840, +0x80200800, 0x80000840, 0x00200840, 0x80000000, +0x80000840, 0x80200800, 0x00000040, 0x00200000, +0x80000840, 0x00200800, 0x80200800, 0x80000040, +0x00000800, 0x00000040, 0x00200000, 0x80200800, +0x80200040, 0x80000840, 0x00000840, 0x00000000, +0x00000040, 0x80200000, 0x80000000, 0x00200040, +0x00000000, 0x80200040, 0x00200040, 0x00000840, +0x80000040, 0x00000800, 0x80200840, 0x00200000, +0x00200840, 0x80000000, 0x80000800, 0x80200840, +0x80200000, 0x00200840, 0x00200800, 0x80000800, +); +@SP7=( +0x04100010, 0x04104000, 0x00004010, 0x00000000, +0x04004000, 0x00100010, 0x04100000, 0x04104010, +0x00000010, 0x04000000, 0x00104000, 0x00004010, +0x00104010, 0x04004010, 0x04000010, 0x04100000, +0x00004000, 0x00104010, 0x00100010, 0x04004000, +0x04104010, 0x04000010, 0x00000000, 0x00104000, +0x04000000, 0x00100000, 0x04004010, 0x04100010, +0x00100000, 0x00004000, 0x04104000, 0x00000010, +0x00100000, 0x00004000, 0x04000010, 0x04104010, +0x00004010, 0x04000000, 0x00000000, 0x00104000, +0x04100010, 0x04004010, 0x04004000, 0x00100010, +0x04104000, 0x00000010, 0x00100010, 0x04004000, +0x04104010, 0x00100000, 0x04100000, 0x04000010, +0x00104000, 0x00004010, 0x04004010, 0x04100000, +0x00000010, 0x04104000, 0x00104010, 0x00000000, +0x04000000, 0x04100010, 0x00004000, 0x00104010, +); + +sub main'des_set_key + { + local($param)=@_; + local(@key); + local($c,$d,$i,$s,$t); + local(@ks)=(); + + # Get the bytes in the order we want. + @key=unpack("C8",$param); + + $c= ($key[0] )| + ($key[1]<< 8)| + ($key[2]<<16)| + ($key[3]<<24); + $d= ($key[4] )| + ($key[5]<< 8)| + ($key[6]<<16)| + ($key[7]<<24); + + &doPC1(*c,*d); + + for $i (@shifts2) + { + if ($i) + { + $c=($c>>2)|($c<<26); + $d=($d>>2)|($d<<26); + } + else + { + $c=($c>>1)|($c<<27); + $d=($d>>1)|($d<<27); + } + $c&=0x0fffffff; + $d&=0x0fffffff; + $s= $skb0[ ($c )&0x3f ]| + $skb1[(($c>> 6)&0x03)|(($c>> 7)&0x3c)]| + $skb2[(($c>>13)&0x0f)|(($c>>14)&0x30)]| + $skb3[(($c>>20)&0x01)|(($c>>21)&0x06) | + (($c>>22)&0x38)]; + $t= $skb4[ ($d )&0x3f ]| + $skb5[(($d>> 7)&0x03)|(($d>> 8)&0x3c)]| + $skb6[ ($d>>15)&0x3f ]| + $skb7[(($d>>21)&0x0f)|(($d>>22)&0x30)]; + push(@ks,(($t<<16)|($s&0x0000ffff))&0xffffffff); + $s= (($s>>16)&0x0000ffff)|($t&0xffff0000) ; + push(@ks,(($s<<4)|(($s>>28)&0xf))&0xffffffff); + } + @ks; + } + +sub doPC1 + { + local(*a,*b)=@_; + local($t); + + $t=(($b>>4)^$a)&0x0f0f0f0f; + $b^=($t<<4); $a^=$t; + # do $a first + $t=(($a<<18)^$a)&0xcccc0000; + $a=$a^$t^(($t>>18)&0x00003fff); + $t=(($a<<17)^$a)&0xaaaa0000; + $a=$a^$t^(($t>>17)&0x00007fff); + $t=(($a<< 8)^$a)&0x00ff0000; + $a=$a^$t^(($t>> 8)&0x00ffffff); + $t=(($a<<17)^$a)&0xaaaa0000; + $a=$a^$t^(($t>>17)&0x00007fff); + + # now do $b + $t=(($b<<24)^$b)&0xff000000; + $b=$b^$t^(($t>>24)&0x000000ff); + $t=(($b<< 8)^$b)&0x00ff0000; + $b=$b^$t^(($t>> 8)&0x00ffffff); + $t=(($b<<14)^$b)&0x33330000; + $b=$b^$t^(($t>>14)&0x0003ffff); + $b=(($b&0x00aa00aa)<<7)|(($b&0x55005500)>>7)|($b&0xaa55aa55); + $b=(($b>>8)&0x00ffffff)|((($a&0xf0000000)>>4)&0x0fffffff); + $a&=0x0fffffff; + } + +sub doIP + { + local(*a,*b)=@_; + local($t); + + $t=(($b>> 4)^$a)&0x0f0f0f0f; + $b^=($t<< 4); $a^=$t; + $t=(($a>>16)^$b)&0x0000ffff; + $a^=($t<<16); $b^=$t; + $t=(($b>> 2)^$a)&0x33333333; + $b^=($t<< 2); $a^=$t; + $t=(($a>> 8)^$b)&0x00ff00ff; + $a^=($t<< 8); $b^=$t; + $t=(($b>> 1)^$a)&0x55555555; + $b^=($t<< 1); $a^=$t; + $t=$a; + $a=$b&0xffffffff; + $b=$t&0xffffffff; + } + +sub doFP + { + local(*a,*b)=@_; + local($t); + + $t=(($b>> 1)^$a)&0x55555555; + $b^=($t<< 1); $a^=$t; + $t=(($a>> 8)^$b)&0x00ff00ff; + $a^=($t<< 8); $b^=$t; + $t=(($b>> 2)^$a)&0x33333333; + $b^=($t<< 2); $a^=$t; + $t=(($a>>16)^$b)&0x0000ffff; + $a^=($t<<16); $b^=$t; + $t=(($b>> 4)^$a)&0x0f0f0f0f; + $b^=($t<< 4); $a^=$t; + $a&=0xffffffff; + $b&=0xffffffff; + } + +sub main'des_ecb_encrypt + { + local(*ks,$encrypt,$in)=@_; + local($l,$r,$i,$t,$u,@input); + + @input=unpack("C8",$in); + # Get the bytes in the order we want. + $l= ($input[0] )| + ($input[1]<< 8)| + ($input[2]<<16)| + ($input[3]<<24); + $r= ($input[4] )| + ($input[5]<< 8)| + ($input[6]<<16)| + ($input[7]<<24); + + $l&=0xffffffff; + $r&=0xffffffff; + &doIP(*l,*r); + if ($encrypt) + { + for ($i=0; $i<32; $i+=4) + { + $t=((($r&0x7fffffff)<<1)|(($r>>31)&0x00000001)); + $u=$t^$ks[$i ]; + $t=$t^$ks[$i+1]; + $t2=(($t&0x0000000f)<<28); + + $t=((($t>>4)&0x0fffffff)|(($t&0x0000000f)<<28)); + $l^= $SP1[ $t &0x3f]| + $SP3[($t>> 8)&0x3f]| + $SP5[($t>>16)&0x3f]| + $SP7[($t>>24)&0x3f]| + $SP0[ $u &0x3f]| + $SP2[($u>> 8)&0x3f]| + $SP4[($u>>16)&0x3f]| + $SP6[($u>>24)&0x3f]; + + $t=(($l<<1)|(($l>>31)&0x1))&0xffffffff; + $u=$t^$ks[$i+2]; + $t=$t^$ks[$i+3]; + $t=((($t>>4)&0x0fffffff)|($t<<28))&0xffffffff; + $r^= $SP1[ $t &0x3f]| + $SP3[($t>> 8)&0x3f]| + $SP5[($t>>16)&0x3f]| + $SP7[($t>>24)&0x3f]| + $SP0[ $u &0x3f]| + $SP2[($u>> 8)&0x3f]| + $SP4[($u>>16)&0x3f]| + $SP6[($u>>24)&0x3f]; + } + } + else + { + for ($i=30; $i>0; $i-=4) + { + $t=(($r<<1)|(($r>>31)&0x1))&0xffffffff; + $u=$t^$ks[$i ]; + $t=$t^$ks[$i+1]; + $t=((($t>>4)&0x0fffffff)|($t<<28))&0xffffffff; + $l^= $SP1[ $t &0x3f]| + $SP3[($t>> 8)&0x3f]| + $SP5[($t>>16)&0x3f]| + $SP7[($t>>24)&0x3f]| + $SP0[ $u &0x3f]| + $SP2[($u>> 8)&0x3f]| + $SP4[($u>>16)&0x3f]| + $SP6[($u>>24)&0x3f]; + + $t=(($l<<1)|(($l>>31)&0x1))&0xffffffff; + $u=$t^$ks[$i-2]; + $t=$t^$ks[$i-1]; + $t=((($t>>4)&0x0fffffff)|($t<<28))&0xffffffff; + $r^= $SP1[ $t &0x3f]| + $SP3[($t>> 8)&0x3f]| + $SP5[($t>>16)&0x3f]| + $SP7[($t>>24)&0x3f]| + $SP0[ $u &0x3f]| + $SP2[($u>> 8)&0x3f]| + $SP4[($u>>16)&0x3f]| + $SP6[($u>>24)&0x3f]; + } + } + &doFP(*l,*r); + pack("C8",$l&0xff, + ($l>> 8)&0x00ffffff, + ($l>>16)&0x0000ffff, + ($l>>24)&0x000000ff, + $r&0xff, + ($r>> 8)&0x00ffffff, + ($r>>16)&0x0000ffff, + ($r>>24)&0x000000ff); + } diff --git a/src/lib/libssl/src/crypto/des/des_crypt.man b/src/lib/libssl/src/crypto/des/des_crypt.man new file mode 100644 index 0000000000..0ecc416877 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/des_crypt.man @@ -0,0 +1,508 @@ +.TH DES_CRYPT 3 +.SH NAME +des_read_password, des_read_2password, +des_string_to_key, des_string_to_2key, des_read_pw_string, +des_random_key, des_set_key, +des_key_sched, des_ecb_encrypt, des_ecb3_encrypt, des_cbc_encrypt, +des_3cbc_encrypt, +des_pcbc_encrypt, des_cfb_encrypt, des_ofb_encrypt, +des_cbc_cksum, des_quad_cksum, +des_enc_read, des_enc_write, des_set_odd_parity, +des_is_weak_key, crypt \- (non USA) DES encryption +.SH SYNOPSIS +.nf +.nj +.ft B +#include <des.h> +.PP +.B int des_read_password(key,prompt,verify) +des_cblock *key; +char *prompt; +int verify; +.PP +.B int des_read_2password(key1,key2,prompt,verify) +des_cblock *key1,*key2; +char *prompt; +int verify; +.PP +.B int des_string_to_key(str,key) +char *str; +des_cblock *key; +.PP +.B int des_string_to_2keys(str,key1,key2) +char *str; +des_cblock *key1,*key2; +.PP +.B int des_read_pw_string(buf,length,prompt,verify) +char *buf; +int length; +char *prompt; +int verify; +.PP +.B int des_random_key(key) +des_cblock *key; +.PP +.B int des_set_key(key,schedule) +des_cblock *key; +des_key_schedule schedule; +.PP +.B int des_key_sched(key,schedule) +des_cblock *key; +des_key_schedule schedule; +.PP +.B int des_ecb_encrypt(input,output,schedule,encrypt) +des_cblock *input; +des_cblock *output; +des_key_schedule schedule; +int encrypt; +.PP +.B int des_ecb3_encrypt(input,output,ks1,ks2,encrypt) +des_cblock *input; +des_cblock *output; +des_key_schedule ks1,ks2; +int encrypt; +.PP +.B int des_cbc_encrypt(input,output,length,schedule,ivec,encrypt) +des_cblock *input; +des_cblock *output; +long length; +des_key_schedule schedule; +des_cblock *ivec; +int encrypt; +.PP +.B int des_3cbc_encrypt(input,output,length,sk1,sk2,ivec1,ivec2,encrypt) +des_cblock *input; +des_cblock *output; +long length; +des_key_schedule sk1; +des_key_schedule sk2; +des_cblock *ivec1; +des_cblock *ivec2; +int encrypt; +.PP +.B int des_pcbc_encrypt(input,output,length,schedule,ivec,encrypt) +des_cblock *input; +des_cblock *output; +long length; +des_key_schedule schedule; +des_cblock *ivec; +int encrypt; +.PP +.B int des_cfb_encrypt(input,output,numbits,length,schedule,ivec,encrypt) +unsigned char *input; +unsigned char *output; +int numbits; +long length; +des_key_schedule schedule; +des_cblock *ivec; +int encrypt; +.PP +.B int des_ofb_encrypt(input,output,numbits,length,schedule,ivec) +unsigned char *input,*output; +int numbits; +long length; +des_key_schedule schedule; +des_cblock *ivec; +.PP +.B unsigned long des_cbc_cksum(input,output,length,schedule,ivec) +des_cblock *input; +des_cblock *output; +long length; +des_key_schedule schedule; +des_cblock *ivec; +.PP +.B unsigned long des_quad_cksum(input,output,length,out_count,seed) +des_cblock *input; +des_cblock *output; +long length; +int out_count; +des_cblock *seed; +.PP +.B int des_check_key; +.PP +.B int des_enc_read(fd,buf,len,sched,iv) +int fd; +char *buf; +int len; +des_key_schedule sched; +des_cblock *iv; +.PP +.B int des_enc_write(fd,buf,len,sched,iv) +int fd; +char *buf; +int len; +des_key_schedule sched; +des_cblock *iv; +.PP +.B extern int des_rw_mode; +.PP +.B void des_set_odd_parity(key) +des_cblock *key; +.PP +.B int des_is_weak_key(key) +des_cblock *key; +.PP +.B char *crypt(passwd,salt) +char *passwd; +char *salt; +.PP +.fi +.SH DESCRIPTION +This library contains a fast implementation of the DES encryption +algorithm. +.PP +There are two phases to the use of DES encryption. +The first is the generation of a +.I des_key_schedule +from a key, +the second is the actual encryption. +A des key is of type +.I des_cblock. +This type is made from 8 characters with odd parity. +The least significant bit in the character is the parity bit. +The key schedule is an expanded form of the key; it is used to speed the +encryption process. +.PP +.I des_read_password +writes the string specified by prompt to the standard output, +turns off echo and reads an input string from standard input +until terminated with a newline. +If verify is non-zero, it prompts and reads the input again and verifies +that both entered passwords are the same. +The entered string is converted into a des key by using the +.I des_string_to_key +routine. +The new key is placed in the +.I des_cblock +that was passed (by reference) to the routine. +If there were no errors, +.I des_read_password +returns 0, +-1 is returned if there was a terminal error and 1 is returned for +any other error. +.PP +.I des_read_2password +operates in the same way as +.I des_read_password +except that it generates 2 keys by using the +.I des_string_to_2key +function. +.PP +.I des_read_pw_string +is called by +.I des_read_password +to read and verify a string from a terminal device. +The string is returned in +.I buf. +The size of +.I buf +is passed to the routine via the +.I length +parameter. +.PP +.I des_string_to_key +converts a string into a valid des key. +.PP +.I des_string_to_2key +converts a string into 2 valid des keys. +This routine is best suited for used to generate keys for use with +.I des_ecb3_encrypt. +.PP +.I des_random_key +returns a random key that is made of a combination of process id, +time and an increasing counter. +.PP +Before a des key can be used it is converted into a +.I des_key_schedule +via the +.I des_set_key +routine. +If the +.I des_check_key +flag is non-zero, +.I des_set_key +will check that the key passed is of odd parity and is not a week or +semi-weak key. +If the parity is wrong, +then -1 is returned. +If the key is a weak key, +then -2 is returned. +If an error is returned, +the key schedule is not generated. +.PP +.I des_key_sched +is another name for the +.I des_set_key +function. +.PP +The following routines mostly operate on an input and output stream of +.I des_cblock's. +.PP +.I des_ecb_encrypt +is the basic DES encryption routine that encrypts or decrypts a single 8-byte +.I des_cblock +in +.I electronic code book +mode. +It always transforms the input data, pointed to by +.I input, +into the output data, +pointed to by the +.I output +argument. +If the +.I encrypt +argument is non-zero (DES_ENCRYPT), +the +.I input +(cleartext) is encrypted in to the +.I output +(ciphertext) using the key_schedule specified by the +.I schedule +argument, +previously set via +.I des_set_key. +If +.I encrypt +is zero (DES_DECRYPT), +the +.I input +(now ciphertext) +is decrypted into the +.I output +(now cleartext). +Input and output may overlap. +No meaningful value is returned. +.PP +.I des_ecb3_encrypt +encrypts/decrypts the +.I input +block by using triple ecb DES encryption. +This involves encrypting the input with +.I ks1, +decryption with the key schedule +.I ks2, +and then encryption with the first again. +This routine greatly reduces the chances of brute force breaking of +DES and has the advantage of if +.I ks1 +and +.I ks2 +are the same, it is equivalent to just encryption using ecb mode and +.I ks1 +as the key. +.PP +.I des_cbc_encrypt +encrypts/decrypts using the +.I cipher-block-chaining +mode of DES. +If the +.I encrypt +argument is non-zero, +the routine cipher-block-chain encrypts the cleartext data pointed to by the +.I input +argument into the ciphertext pointed to by the +.I output +argument, +using the key schedule provided by the +.I schedule +argument, +and initialisation vector provided by the +.I ivec +argument. +If the +.I length +argument is not an integral multiple of eight bytes, +the last block is copied to a temporary area and zero filled. +The output is always +an integral multiple of eight bytes. +To make multiple cbc encrypt calls on a large amount of data appear to +be one +.I des_cbc_encrypt +call, the +.I ivec +of subsequent calls should be the last 8 bytes of the output. +.PP +.I des_3cbc_encrypt +encrypts/decrypts the +.I input +block by using triple cbc DES encryption. +This involves encrypting the input with key schedule +.I ks1, +decryption with the key schedule +.I ks2, +and then encryption with the first again. +2 initialisation vectors are required, +.I ivec1 +and +.I ivec2. +Unlike +.I des_cbc_encrypt, +these initialisation vectors are modified by the subroutine. +This routine greatly reduces the chances of brute force breaking of +DES and has the advantage of if +.I ks1 +and +.I ks2 +are the same, it is equivalent to just encryption using cbc mode and +.I ks1 +as the key. +.PP +.I des_pcbc_encrypt +encrypt/decrypts using a modified block chaining mode. +It provides better error propagation characteristics than cbc +encryption. +.PP +.I des_cfb_encrypt +encrypt/decrypts using cipher feedback mode. This method takes an +array of characters as input and outputs and array of characters. It +does not require any padding to 8 character groups. Note: the ivec +variable is changed and the new changed value needs to be passed to +the next call to this function. Since this function runs a complete +DES ecb encryption per numbits, this function is only suggested for +use when sending small numbers of characters. +.PP +.I des_ofb_encrypt +encrypt using output feedback mode. This method takes an +array of characters as input and outputs and array of characters. It +does not require any padding to 8 character groups. Note: the ivec +variable is changed and the new changed value needs to be passed to +the next call to this function. Since this function runs a complete +DES ecb encryption per numbits, this function is only suggested for +use when sending small numbers of characters. +.PP +.I des_cbc_cksum +produces an 8 byte checksum based on the input stream (via cbc encryption). +The last 4 bytes of the checksum is returned and the complete 8 bytes is +placed in +.I output. +.PP +.I des_quad_cksum +returns a 4 byte checksum from the input bytes. +The algorithm can be iterated over the input, +depending on +.I out_count, +1, 2, 3 or 4 times. +If +.I output +is non-NULL, +the 8 bytes generated by each pass are written into +.I output. +.PP +.I des_enc_write +is used to write +.I len +bytes +to file descriptor +.I fd +from buffer +.I buf. +The data is encrypted via +.I pcbc_encrypt +(default) using +.I sched +for the key and +.I iv +as a starting vector. +The actual data send down +.I fd +consists of 4 bytes (in network byte order) containing the length of the +following encrypted data. The encrypted data then follows, padded with random +data out to a multiple of 8 bytes. +.PP +.I des_enc_read +is used to read +.I len +bytes +from file descriptor +.I fd +into buffer +.I buf. +The data being read from +.I fd +is assumed to have come from +.I des_enc_write +and is decrypted using +.I sched +for the key schedule and +.I iv +for the initial vector. +The +.I des_enc_read/des_enc_write +pair can be used to read/write to files, pipes and sockets. +I have used them in implementing a version of rlogin in which all +data is encrypted. +.PP +.I des_rw_mode +is used to specify the encryption mode to use with +.I des_enc_read +and +.I des_end_write. +If set to +.I DES_PCBC_MODE +(the default), des_pcbc_encrypt is used. +If set to +.I DES_CBC_MODE +des_cbc_encrypt is used. +These two routines and the variable are not part of the normal MIT library. +.PP +.I des_set_odd_parity +sets the parity of the passed +.I key +to odd. This routine is not part of the standard MIT library. +.PP +.I des_is_weak_key +returns 1 is the passed key is a weak key (pick again :-), +0 if it is ok. +This routine is not part of the standard MIT library. +.PP +.I crypt +is a replacement for the normal system crypt. +It is much faster than the system crypt. +.PP +.SH FILES +/usr/include/des.h +.br +/usr/lib/libdes.a +.PP +The encryption routines have been tested on 16bit, 32bit and 64bit +machines of various endian and even works under VMS. +.PP +.SH BUGS +.PP +If you think this manual is sparse, +read the des_crypt(3) manual from the MIT kerberos (or bones outside +of the USA) distribution. +.PP +.I des_cfb_encrypt +and +.I des_ofb_encrypt +operates on input of 8 bits. What this means is that if you set +numbits to 12, and length to 2, the first 12 bits will come from the 1st +input byte and the low half of the second input byte. The second 12 +bits will have the low 8 bits taken from the 3rd input byte and the +top 4 bits taken from the 4th input byte. The same holds for output. +This function has been implemented this way because most people will +be using a multiple of 8 and because once you get into pulling bytes input +bytes apart things get ugly! +.PP +.I des_read_pw_string +is the most machine/OS dependent function and normally generates the +most problems when porting this code. +.PP +.I des_string_to_key +is probably different from the MIT version since there are lots +of fun ways to implement one-way encryption of a text string. +.PP +The routines are optimised for 32 bit machines and so are not efficient +on IBM PCs. +.PP +NOTE: extensive work has been done on this library since this document +was origionally written. Please try to read des.doc from the libdes +distribution since it is far more upto date and documents more of the +functions. Libdes is now also being shipped as part of SSLeay, a +general cryptographic library that amonst other things implements +netscapes SSL protocoll. The most recent version can be found in +SSLeay distributions. +.SH AUTHOR +Eric Young (eay@cryptsoft.com) diff --git a/src/lib/libssl/src/crypto/des/des_locl.org b/src/lib/libssl/src/crypto/des/des_locl.org new file mode 100644 index 0000000000..e2e503cbed --- /dev/null +++ b/src/lib/libssl/src/crypto/des/des_locl.org @@ -0,0 +1,516 @@ +/* crypto/des/des_locl.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify des_locl.org since des_locl.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +#ifndef HEADER_DES_LOCL_H +#define HEADER_DES_LOCL_H + +#if defined(WIN32) || defined(WIN16) +#ifndef MSDOS +#define MSDOS +#endif +#endif + +#include <stdio.h> +#include <stdlib.h> +#ifndef MSDOS +#include <unistd.h> +#endif +#include "des.h" + +#ifndef DES_DEFAULT_OPTIONS +/* the following is tweaked from a config script, that is why it is a + * protected undef/define */ +#ifndef DES_PTR +#undef DES_PTR +#endif + +/* This helps C compiler generate the correct code for multiple functional + * units. It reduces register dependancies at the expense of 2 more + * registers */ +#ifndef DES_RISC1 +#undef DES_RISC1 +#endif + +#ifndef DES_RISC2 +#undef DES_RISC2 +#endif + +#if defined(DES_RISC1) && defined(DES_RISC2) +YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! +#endif + +/* Unroll the inner loop, this sometimes helps, sometimes hinders. + * Very mucy CPU dependant */ +#ifndef DES_UNROLL +#undef DES_UNROLL +#endif + +/* These default values were supplied by + * Peter Gutman <pgut001@cs.auckland.ac.nz> + * They are only used if nothing else has been defined */ +#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined( sun ) /* Newer Sparc's */ + #define DES_PTR + #define DES_RISC1 + #define DES_UNROLL +#elif defined( __ultrix ) /* Older MIPS */ + #define DES_PTR + #define DES_RISC2 + #define DES_UNROLL +#elif defined( __osf1__ ) /* Alpha */ + #define DES_PTR + #define DES_RISC2 +#elif defined ( _AIX ) /* RS6000 */ + /* Unknown */ +#elif defined( __hpux ) /* HP-PA */ + /* Unknown */ +#elif defined( __aux ) /* 68K */ + /* Unknown */ +#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ + #define DES_UNROLL +#elif defined( __sgi ) /* Newer MIPS */ + #define DES_PTR + #define DES_RISC2 + #define DES_UNROLL +#elif defined( i386 ) /* x86 boxes, should be gcc */ + #define DES_PTR + #define DES_RISC1 + #define DES_UNROLL +#endif /* Systems-specific speed defines */ +#endif + +#endif /* DES_DEFAULT_OPTIONS */ + +#ifdef MSDOS /* Visual C++ 2.1 (Windows NT/95) */ +#include <stdlib.h> +#include <errno.h> +#include <time.h> +#include <io.h> +#ifndef RAND +#define RAND +#endif +#undef NOPROTO +#endif + +#if defined(__STDC__) || defined(VMS) || defined(M_XENIX) || defined(MSDOS) +#include <string.h> +#endif + +#ifndef RAND +#define RAND +#endif + +#ifdef linux +#undef RAND +#endif + +#ifdef MSDOS +#define getpid() 2 +#define RAND +#undef NOPROTO +#endif + +#if defined(NOCONST) +#define const +#endif + +#ifdef __STDC__ +#undef NOPROTO +#endif + +#ifdef RAND +#define srandom(s) srand(s) +#define random rand +#endif + +#define ITERATIONS 16 +#define HALF_ITERATIONS 8 + +/* used in des_read and des_write */ +#define MAXWRITE (1024*16) +#define BSIZE (MAXWRITE+4) + +#define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \ + l|=((DES_LONG)(*((c)++)))<< 8L, \ + l|=((DES_LONG)(*((c)++)))<<16L, \ + l|=((DES_LONG)(*((c)++)))<<24L) + +/* NOTE - c is not incremented as per c2l */ +#define c2ln(c,l1,l2,n) { \ + c+=n; \ + l1=l2=0; \ + switch (n) { \ + case 8: l2 =((DES_LONG)(*(--(c))))<<24L; \ + case 7: l2|=((DES_LONG)(*(--(c))))<<16L; \ + case 6: l2|=((DES_LONG)(*(--(c))))<< 8L; \ + case 5: l2|=((DES_LONG)(*(--(c)))); \ + case 4: l1 =((DES_LONG)(*(--(c))))<<24L; \ + case 3: l1|=((DES_LONG)(*(--(c))))<<16L; \ + case 2: l1|=((DES_LONG)(*(--(c))))<< 8L; \ + case 1: l1|=((DES_LONG)(*(--(c)))); \ + } \ + } + +#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>24L)&0xff)) + +/* replacements for htonl and ntohl since I have no idea what to do + * when faced with machines with 8 byte longs. */ +#define HDRSIZE 4 + +#define n2l(c,l) (l =((DES_LONG)(*((c)++)))<<24L, \ + l|=((DES_LONG)(*((c)++)))<<16L, \ + l|=((DES_LONG)(*((c)++)))<< 8L, \ + l|=((DES_LONG)(*((c)++)))) + +#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ + *((c)++)=(unsigned char)(((l) )&0xff)) + +/* NOTE - c is not incremented as per l2c */ +#define l2cn(l1,l2,c,n) { \ + c+=n; \ + switch (n) { \ + case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ + case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ + case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ + case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ + case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ + case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ + case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ + case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ + } \ + } + +#if defined(WIN32) +#define ROTATE(a,n) (_lrotr(a,n)) +#else +#define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) +#endif + +/* Don't worry about the LOAD_DATA() stuff, that is used by + * fcrypt() to add it's little bit to the front */ + +#ifdef DES_FCRYPT + +#define LOAD_DATA_tmp(R,S,u,t,E0,E1) \ + { DES_LONG tmp; LOAD_DATA(R,S,u,t,E0,E1,tmp); } + +#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ + t=R^(R>>16L); \ + u=t&E0; t&=E1; \ + tmp=(u<<16); u^=R^s[S ]; u^=tmp; \ + tmp=(t<<16); t^=R^s[S+1]; t^=tmp +#else +#define LOAD_DATA_tmp(a,b,c,d,e,f) LOAD_DATA(a,b,c,d,e,f,g) +#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ + u=R^s[S ]; \ + t=R^s[S+1] +#endif + +/* The changes to this macro may help or hinder, depending on the + * compiler and the achitecture. gcc2 always seems to do well :-). + * Inspired by Dana How <how@isl.stanford.edu> + * DO NOT use the alternative version on machines with 8 byte longs. + * It does not seem to work on the Alpha, even when DES_LONG is 4 + * bytes, probably an issue of accessing non-word aligned objects :-( */ +#ifdef DES_PTR + +/* It recently occured to me that 0^0^0^0^0^0^0 == 0, so there + * is no reason to not xor all the sub items together. This potentially + * saves a register since things can be xored directly into L */ + +#if defined(DES_RISC1) || defined(DES_RISC2) +#ifdef DES_RISC1 +#define D_ENCRYPT(LL,R,S) { \ + unsigned int u1,u2,u3; \ + LOAD_DATA(R,S,u,t,E0,E1,u1); \ + u2=(int)u>>8L; \ + u1=(int)u&0xfc; \ + u2&=0xfc; \ + t=ROTATE(t,4); \ + u>>=16L; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \ + u3=(int)(u>>8L); \ + u1=(int)u&0xfc; \ + u3&=0xfc; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+u3); \ + u2=(int)t>>8L; \ + u1=(int)t&0xfc; \ + u2&=0xfc; \ + t>>=16L; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \ + u3=(int)t>>8L; \ + u1=(int)t&0xfc; \ + u3&=0xfc; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+u3); } +#endif +#ifdef DES_RISC2 +#define D_ENCRYPT(LL,R,S) { \ + unsigned int u1,u2,s1,s2; \ + LOAD_DATA(R,S,u,t,E0,E1,u1); \ + u2=(int)u>>8L; \ + u1=(int)u&0xfc; \ + u2&=0xfc; \ + t=ROTATE(t,4); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \ + s1=(int)(u>>16L); \ + s2=(int)(u>>24L); \ + s1&=0xfc; \ + s2&=0xfc; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+s1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+s2); \ + u2=(int)t>>8L; \ + u1=(int)t&0xfc; \ + u2&=0xfc; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \ + s1=(int)(t>>16L); \ + s2=(int)(t>>24L); \ + s1&=0xfc; \ + s2&=0xfc; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+s1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+s2); } +#endif +#else +#define D_ENCRYPT(LL,R,S) { \ + LOAD_DATA_tmp(R,S,u,t,E0,E1); \ + t=ROTATE(t,4); \ + LL^= \ + *(DES_LONG *)((unsigned char *)des_SP +((u )&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x200+((u>> 8L)&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x400+((u>>16L)&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x600+((u>>24L)&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x100+((t )&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x300+((t>> 8L)&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x500+((t>>16L)&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x700+((t>>24L)&0xfc)); } +#endif + +#else /* original version */ + +#if defined(DES_RISC1) || defined(DES_RISC2) +#ifdef DES_RISC1 +#define D_ENCRYPT(LL,R,S) {\ + unsigned int u1,u2,u3; \ + LOAD_DATA(R,S,u,t,E0,E1,u1); \ + u>>=2L; \ + t=ROTATE(t,6); \ + u2=(int)u>>8L; \ + u1=(int)u&0x3f; \ + u2&=0x3f; \ + u>>=16L; \ + LL^=des_SPtrans[0][u1]; \ + LL^=des_SPtrans[2][u2]; \ + u3=(int)u>>8L; \ + u1=(int)u&0x3f; \ + u3&=0x3f; \ + LL^=des_SPtrans[4][u1]; \ + LL^=des_SPtrans[6][u3]; \ + u2=(int)t>>8L; \ + u1=(int)t&0x3f; \ + u2&=0x3f; \ + t>>=16L; \ + LL^=des_SPtrans[1][u1]; \ + LL^=des_SPtrans[3][u2]; \ + u3=(int)t>>8L; \ + u1=(int)t&0x3f; \ + u3&=0x3f; \ + LL^=des_SPtrans[5][u1]; \ + LL^=des_SPtrans[7][u3]; } +#endif +#ifdef DES_RISC2 +#define D_ENCRYPT(LL,R,S) {\ + unsigned int u1,u2,s1,s2; \ + LOAD_DATA(R,S,u,t,E0,E1,u1); \ + u>>=2L; \ + t=ROTATE(t,6); \ + u2=(int)u>>8L; \ + u1=(int)u&0x3f; \ + u2&=0x3f; \ + LL^=des_SPtrans[0][u1]; \ + LL^=des_SPtrans[2][u2]; \ + s1=(int)u>>16L; \ + s2=(int)u>>24L; \ + s1&=0x3f; \ + s2&=0x3f; \ + LL^=des_SPtrans[4][s1]; \ + LL^=des_SPtrans[6][s2]; \ + u2=(int)t>>8L; \ + u1=(int)t&0x3f; \ + u2&=0x3f; \ + LL^=des_SPtrans[1][u1]; \ + LL^=des_SPtrans[3][u2]; \ + s1=(int)t>>16; \ + s2=(int)t>>24L; \ + s1&=0x3f; \ + s2&=0x3f; \ + LL^=des_SPtrans[5][s1]; \ + LL^=des_SPtrans[7][s2]; } +#endif + +#else + +#define D_ENCRYPT(LL,R,S) {\ + LOAD_DATA_tmp(R,S,u,t,E0,E1); \ + t=ROTATE(t,4); \ + LL^=\ + des_SPtrans[0][(u>> 2L)&0x3f]^ \ + des_SPtrans[2][(u>>10L)&0x3f]^ \ + des_SPtrans[4][(u>>18L)&0x3f]^ \ + des_SPtrans[6][(u>>26L)&0x3f]^ \ + des_SPtrans[1][(t>> 2L)&0x3f]^ \ + des_SPtrans[3][(t>>10L)&0x3f]^ \ + des_SPtrans[5][(t>>18L)&0x3f]^ \ + des_SPtrans[7][(t>>26L)&0x3f]; } +#endif +#endif + + /* IP and FP + * The problem is more of a geometric problem that random bit fiddling. + 0 1 2 3 4 5 6 7 62 54 46 38 30 22 14 6 + 8 9 10 11 12 13 14 15 60 52 44 36 28 20 12 4 + 16 17 18 19 20 21 22 23 58 50 42 34 26 18 10 2 + 24 25 26 27 28 29 30 31 to 56 48 40 32 24 16 8 0 + + 32 33 34 35 36 37 38 39 63 55 47 39 31 23 15 7 + 40 41 42 43 44 45 46 47 61 53 45 37 29 21 13 5 + 48 49 50 51 52 53 54 55 59 51 43 35 27 19 11 3 + 56 57 58 59 60 61 62 63 57 49 41 33 25 17 9 1 + + The output has been subject to swaps of the form + 0 1 -> 3 1 but the odd and even bits have been put into + 2 3 2 0 + different words. The main trick is to remember that + t=((l>>size)^r)&(mask); + r^=t; + l^=(t<<size); + can be used to swap and move bits between words. + + So l = 0 1 2 3 r = 16 17 18 19 + 4 5 6 7 20 21 22 23 + 8 9 10 11 24 25 26 27 + 12 13 14 15 28 29 30 31 + becomes (for size == 2 and mask == 0x3333) + t = 2^16 3^17 -- -- l = 0 1 16 17 r = 2 3 18 19 + 6^20 7^21 -- -- 4 5 20 21 6 7 22 23 + 10^24 11^25 -- -- 8 9 24 25 10 11 24 25 + 14^28 15^29 -- -- 12 13 28 29 14 15 28 29 + + Thanks for hints from Richard Outerbridge - he told me IP&FP + could be done in 15 xor, 10 shifts and 5 ands. + When I finally started to think of the problem in 2D + I first got ~42 operations without xors. When I remembered + how to use xors :-) I got it to its final state. + */ +#define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\ + (b)^=(t),\ + (a)^=((t)<<(n))) + +#define IP(l,r) \ + { \ + register DES_LONG tt; \ + PERM_OP(r,l,tt, 4,0x0f0f0f0fL); \ + PERM_OP(l,r,tt,16,0x0000ffffL); \ + PERM_OP(r,l,tt, 2,0x33333333L); \ + PERM_OP(l,r,tt, 8,0x00ff00ffL); \ + PERM_OP(r,l,tt, 1,0x55555555L); \ + } + +#define FP(l,r) \ + { \ + register DES_LONG tt; \ + PERM_OP(l,r,tt, 1,0x55555555L); \ + PERM_OP(r,l,tt, 8,0x00ff00ffL); \ + PERM_OP(l,r,tt, 2,0x33333333L); \ + PERM_OP(r,l,tt,16,0x0000ffffL); \ + PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \ + } + +extern const DES_LONG des_SPtrans[8][64]; + +#ifndef NOPROTO +void fcrypt_body(DES_LONG *out,des_key_schedule ks, + DES_LONG Eswap0, DES_LONG Eswap1); +#else +void fcrypt_body(); +#endif + +#endif diff --git a/src/lib/libssl/src/crypto/des/doIP b/src/lib/libssl/src/crypto/des/doIP new file mode 100644 index 0000000000..18cf231303 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/doIP @@ -0,0 +1,46 @@ +#!/usr/local/bin/perl + +@l=( + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23, + 24,25,26,27,28,29,30,31 + ); +@r=( + 32,33,34,35,36,37,38,39, + 40,41,42,43,44,45,46,47, + 48,49,50,51,52,53,54,55, + 56,57,58,59,60,61,62,63 + ); + +require 'shifts.pl'; + +sub PERM_OP + { + local(*a,*b,*t,$n,$m)=@_; + + @z=&shift(*a,-$n); + @z=&xor(*b,*z); + @z=&and(*z,$m); + @b=&xor(*b,*z); + @z=&shift(*z,$n); + @a=&xor(*a,*z); + } + + +@L=@l; +@R=@r; +&PERM_OP(*R,*L,*T,4,0x0f0f0f0f); +&PERM_OP(*L,*R,*T,16,0x0000ffff); +&PERM_OP(*R,*L,*T,2,0x33333333); +&PERM_OP(*L,*R,*T,8,0x00ff00ff); +&PERM_OP(*R,*L,*T,1,0x55555555); + &printit(@L); + &printit(@R); +&PERM_OP(*R,*L,*T,1,0x55555555); +&PERM_OP(*L,*R,*T,8,0x00ff00ff); +&PERM_OP(*R,*L,*T,2,0x33333333); +&PERM_OP(*L,*R,*T,16,0x0000ffff); +&PERM_OP(*R,*L,*T,4,0x0f0f0f0f); + &printit(@L); + &printit(@R); diff --git a/src/lib/libssl/src/crypto/des/doPC1 b/src/lib/libssl/src/crypto/des/doPC1 new file mode 100644 index 0000000000..096afd8c46 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/doPC1 @@ -0,0 +1,110 @@ +#!/usr/local/bin/perl + +@l=( + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23, + 24,25,26,27,28,29,30,31 + ); +@r=( + 32,33,34,35,36,37,38,39, + 40,41,42,43,44,45,46,47, + 48,49,50,51,52,53,54,55, + 56,57,58,59,60,61,62,63 + ); + +require 'shifts.pl'; + +sub PERM_OP + { + local(*a,*b,*t,$n,$m)=@_; + + @z=&shift(*a,-$n); + @z=&xor(*b,*z); + @z=&and(*z,$m); + @b=&xor(*b,*z); + @z=&shift(*z,$n); + @a=&xor(*a,*z); + } + +sub HPERM_OP2 + { + local(*a,*t,$n,$m)=@_; + local(@x,@y,$i); + + @z=&shift(*a,16-$n); + @z=&xor(*a,*z); + @z=&and(*z,$m); + @a=&xor(*a,*z); + @z=&shift(*z,$n-16); + @a=&xor(*a,*z); + } + +sub HPERM_OP + { + local(*a,*t,$n,$m)=@_; + local(@x,@y,$i); + + for ($i=0; $i<16; $i++) + { + $x[$i]=$a[$i]; + $y[$i]=$a[16+$i]; + } + @z=&shift(*x,-$n); + @z=&xor(*y,*z); + @z=&and(*z,$m); + @y=&xor(*y,*z); + @z=&shift(*z,$n); + @x=&xor(*x,*z); + for ($i=0; $i<16; $i++) + { + $a[$i]=$x[$i]; + $a[16+$i]=$y[$i]; + } + } + +@L=@l; +@R=@r; + + print "---\n"; &printit(@R); +&PERM_OP(*R,*L,*T,4,0x0f0f0f0f); + print "---\n"; &printit(@R); +&HPERM_OP2(*L,*T,-2,0xcccc0000); +&HPERM_OP2(*R,*T,-2,0xcccc0000); + print "---\n"; &printit(@R); +&PERM_OP(*R,*L,*T,1,0x55555555); + print "---\n"; &printit(@R); +&PERM_OP(*L,*R,*T,8,0x00ff00ff); + print "---\n"; &printit(@R); +&PERM_OP(*R,*L,*T,1,0x55555555); + print "---\n"; &printit(@R); +# &printit(@L); + &printit(@R); +print <<"EOF"; +============================== +63 55 47 39 31 23 15 7 +62 54 46 38 30 22 14 6 +61 53 45 37 29 21 13 5 +60 52 44 36 -- -- -- -- + +57 49 41 33 25 17 9 1 +58 50 42 34 26 18 10 2 +59 51 43 35 27 19 11 3 +28 20 12 4 -- -- -- -- +EOF +exit(1); +@A=&and(*R,0x000000ff); +@A=&shift(*A,16); +@B=&and(*R,0x0000ff00); +@C=&and(*R,0x00ff0000); +@C=&shift(*C,-16); +@D=&and(*L,0xf0000000); +@D=&shift(*D,-4); +@A=&or(*A,*B); +@B=&or(*D,*C); +@R=&or(*A,*B); +@L=&and(*L,0x0fffffff); + + &printit(@L); + &printit(@R); + diff --git a/src/lib/libssl/src/crypto/des/doPC2 b/src/lib/libssl/src/crypto/des/doPC2 new file mode 100644 index 0000000000..fa5cf74cf7 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/doPC2 @@ -0,0 +1,94 @@ +#!/usr/local/bin/perl + +@PC2_C=(14,17,11,24, 1, 5, + 3,28,15, 6,21,10, + 23,19,12, 4,26, 8, + 16, 7,27,20,13, 2, + ); + +@PC2_D=(41,52,31,37,47,55, + 30,40,51,45,33,48, + 44,49,39,56,34,53, + 46,42,50,36,29,32, + ); + +$i=0; +foreach (@PC2_C) { + $_--; +# printf "%2d,",$_; + $C{$_}=$i; + ++$i; +# print "\n" if ((($i) % 8) == 0); + } +$i=0; +#print "\n"; +foreach (@PC2_D) { + $_-=28; + $_--; +# printf "%2d,",$_; + $D{$_}=$i; + $i++; +# print "\n" if ((($i) % 8) == 0); + } + +#print "\n"; +foreach $i (0 .. 27) + { + $_=$C{$i}; +# printf "%2d,",$_; + $i++; +# print "\n" if ((($i) % 8) == 0); + } +#print "\n"; + +#print "\n"; +foreach $i (0 .. 27) + { + $_=$D{$i}; +# printf "%2d,",$_; + $i++; +# print "\n" if ((($i) % 8) == 0); + } +#print "\n"; + +print "static ulong skb[8][64]={\n"; +&doit("C",*C, 0, 1, 2, 3, 4, 5); +&doit("C",*C, 6, 7, 9,10,11,12); +&doit("C",*C,13,14,15,16,18,19); +&doit("C",*C,20,22,23,25,26,27); + +&doit("D",*D, 0, 1, 2, 3, 4, 5); +&doit("D",*D, 7, 8,10,11,12,13); +&doit("D",*D,15,16,17,18,19,20); +&doit("D",*D,21,22,23,24,26,27); +print "};\n"; + +sub doit + { + local($l,*A,@b)=@_; + local(@out); + + printf("/* for $l bits (numbered as per FIPS 46) %d %d %d %d %d %d */\n", + $b[0]+1, $b[1]+1, $b[2]+1, $b[3]+1, $b[4]+1, $b[5]+1); + for ($i=0; $i<64; $i++) + { + $out[$i]=0; + $j=1; +#print "\n"; + for ($k=0; $k<6; $k++) + { + $l=$A{$b[$k]}; +#print"$l - "; + if ((1<<$k) & $i) + { + $ll=int($l/6)*8+($l%6); + $out[$i]|=1<<($ll); + } + } + $pp=$out[$i]; + $pp=($pp&0xff0000ff)| (($pp&0x00ff0000)>>8)| + (($pp&0x0000ff00)<<8); + printf("0x%08X,",$pp); + print "\n" if (($i+1) % 4 == 0); + } + } diff --git a/src/lib/libssl/src/crypto/des/ede_enc.c b/src/lib/libssl/src/crypto/des/ede_enc.c new file mode 100644 index 0000000000..9f75dd1037 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/ede_enc.c @@ -0,0 +1,190 @@ +/* crypto/des/ede_enc.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include "des_locl.h" + +void des_ede3_cbc_encrypt(input, output, length, ks1, ks2, ks3, ivec, enc) +des_cblock (*input); +des_cblock (*output); +long length; +des_key_schedule ks1; +des_key_schedule ks2; +des_key_schedule ks3; +des_cblock (*ivec); +int enc; + { + register DES_LONG tin0,tin1; + register DES_LONG tout0,tout1,xor0,xor1; + register unsigned char *in,*out; + register long l=length; + DES_LONG tin[2]; + unsigned char *iv; + + in=(unsigned char *)input; + out=(unsigned char *)output; + iv=(unsigned char *)ivec; + + if (enc) + { + c2l(iv,tout0); + c2l(iv,tout1); + for (l-=8; l>=0; l-=8) + { + c2l(in,tin0); + c2l(in,tin1); + tin0^=tout0; + tin1^=tout1; + + tin[0]=tin0; + tin[1]=tin1; + des_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); + tout0=tin[0]; + tout1=tin[1]; + + l2c(tout0,out); + l2c(tout1,out); + } + if (l != -8) + { + c2ln(in,tin0,tin1,l+8); + tin0^=tout0; + tin1^=tout1; + + tin[0]=tin0; + tin[1]=tin1; + des_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); + tout0=tin[0]; + tout1=tin[1]; + + l2c(tout0,out); + l2c(tout1,out); + } + iv=(unsigned char *)ivec; + l2c(tout0,iv); + l2c(tout1,iv); + } + else + { + register DES_LONG t0,t1; + + c2l(iv,xor0); + c2l(iv,xor1); + for (l-=8; l>=0; l-=8) + { + c2l(in,tin0); + c2l(in,tin1); + + t0=tin0; + t1=tin1; + + tin[0]=tin0; + tin[1]=tin1; + des_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); + tout0=tin[0]; + tout1=tin[1]; + + tout0^=xor0; + tout1^=xor1; + l2c(tout0,out); + l2c(tout1,out); + xor0=t0; + xor1=t1; + } + if (l != -8) + { + c2l(in,tin0); + c2l(in,tin1); + + t0=tin0; + t1=tin1; + + tin[0]=tin0; + tin[1]=tin1; + des_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); + tout0=tin[0]; + tout1=tin[1]; + + tout0^=xor0; + tout1^=xor1; + l2cn(tout0,tout1,out,l+8); + xor0=t0; + xor1=t1; + } + + iv=(unsigned char *)ivec; + l2c(xor0,iv); + l2c(xor1,iv); + } + tin0=tin1=tout0=tout1=xor0=xor1=0; + tin[0]=tin[1]=0; + } + +#ifdef undef /* MACRO */ +void des_ede2_cbc_encrypt(input, output, length, ks1, ks2, ivec, enc) +des_cblock (*input); +des_cblock (*output); +long length; +des_key_schedule ks1; +des_key_schedule ks2; +des_cblock (*ivec); +int enc; + { + des_ede3_cbc_encrypt(input,output,length,ks1,ks2,ks1,ivec,enc); + } +#endif + diff --git a/src/lib/libssl/src/crypto/des/podd.h b/src/lib/libssl/src/crypto/des/podd.h new file mode 100644 index 0000000000..1b2bfe0843 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/podd.h @@ -0,0 +1,75 @@ +/* crypto/des/podd.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +static const unsigned char odd_parity[256]={ + 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, + 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31, + 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47, + 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62, + 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79, + 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94, + 97, 97, 98, 98,100,100,103,103,104,104,107,107,109,109,110,110, +112,112,115,115,117,117,118,118,121,121,122,122,124,124,127,127, +128,128,131,131,133,133,134,134,137,137,138,138,140,140,143,143, +145,145,146,146,148,148,151,151,152,152,155,155,157,157,158,158, +161,161,162,162,164,164,167,167,168,168,171,171,173,173,174,174, +176,176,179,179,181,181,182,182,185,185,186,186,188,188,191,191, +193,193,194,194,196,196,199,199,200,200,203,203,205,205,206,206, +208,208,211,211,213,213,214,214,217,217,218,218,220,220,223,223, +224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239, +241,241,242,242,244,244,247,247,248,248,251,251,253,253,254,254}; diff --git a/src/lib/libssl/src/crypto/des/ranlib.sh b/src/lib/libssl/src/crypto/des/ranlib.sh new file mode 100644 index 0000000000..543f712c6b --- /dev/null +++ b/src/lib/libssl/src/crypto/des/ranlib.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +cwd=`pwd` +cd /tmp + +if [ -s /bin/ranlib ] ; then + RL=/bin/ranlib +else if [ -s /usr/bin/ranlib ] ; then + RL=/usr/bin/ranlib +fi +fi + +if [ "x$RL" != "x" ] +then + case "$1" in + /*) + $RL "$1" + ;; + *) + $RL "$cwd/$1" + ;; + esac +fi diff --git a/src/lib/libssl/src/crypto/des/shifts.pl b/src/lib/libssl/src/crypto/des/shifts.pl new file mode 100644 index 0000000000..d8a240c1ba --- /dev/null +++ b/src/lib/libssl/src/crypto/des/shifts.pl @@ -0,0 +1,198 @@ +#!/usr/bin/perl + +sub lab_shift + { + local(*a,$n)=@_; + local(@r,$i,$j,$k,$d,@z); + + @r=&shift(*a,$n); + foreach $i (0 .. 31) + { + @z=split(/\^/,$r[$i]); + for ($j=0; $j <= $#z; $j++) + { + ($d)=($z[$j] =~ /^(..)/); + ($k)=($z[$j] =~ /\[(.*)\]$/); + $k.=",$n" if ($k ne ""); + $k="$n" if ($k eq ""); + $d="$d[$k]"; + $z[$j]=$d; + } + $r[$i]=join('^',@z); + } + return(@r); + } + +sub shift + { + local(*a,$n)=@_; + local(@f); + + if ($n > 0) + { + @f=&shiftl(*a,$n); + } + else + { + @f=&shiftr(*a,-$n); + } + return(@f); + } + +sub rotate + { + local(*a,$n)=@_; + local(@f); + + if ($n > 0) + { @f=&rotatel(*a,$n); } + else + { @f=&rotater(*a,-$n); } + return(@f); + } + +sub rotater + { + local(*a,$n)=@_; + local(@f,@g); + + @f=&shiftr(*a,$n); + @g=&shiftl(*a,32-$n); + $#f=31; + $#g=31; + return(&or(*f,*g)); + } + +sub rotatel + { + local(*a,$n)=@_; + local(@f,@g); + + @f=&shiftl(*a,$n); + @g=&shiftr(*a,32-$n); + $#f=31; + $#g=31; + return(&or(*f,*g)); + } + +sub shiftr + { + local(*a,$n)=@_; + local(@r,$i); + + $#r=31; + foreach $i (0 .. 31) + { + if (($i+$n) > 31) + { + $r[$i]="--"; + } + else + { + $r[$i]=$a[$i+$n]; + } + } + return(@r); + } + +sub shiftl + { + local(*a,$n)=@_; + local(@r,$i); + + $#r=31; + foreach $i (0 .. 31) + { + if ($i < $n) + { + $r[$i]="--"; + } + else + { + $r[$i]=$a[$i-$n]; + } + } + return(@r); + } + +sub printit + { + local(@a)=@_; + local($i); + + foreach $i (0 .. 31) + { + printf "%2s ",$a[$i]; + print "\n" if (($i%8) == 7); + } + print "\n"; + } + +sub xor + { + local(*a,*b)=@_; + local(@r,$i); + + $#r=31; + foreach $i (0 .. 31) + { + $r[$i]=&compress($a[$i].'^'.$b[$i]); +# $r[$i]=$a[$i]."^".$b[$i]; + } + return(@r); + } + +sub and + { + local(*a,$m)=@_; + local(@r,$i); + + $#r=31; + foreach $i (0 .. 31) + { + $r[$i]=(($m & (1<<$i))?($a[$i]):('--')); + } + return(@r); + } + +sub or + { + local(*a,*b)=@_; + local(@r,$i); + + $#r=31; + foreach $i (0 .. 31) + { + $r[$i]='--' if (($a[$i] eq '--') && ($b[$i] eq '--')); + $r[$i]=$a[$i] if (($a[$i] ne '--') && ($b[$i] eq '--')); + $r[$i]=$b[$i] if (($a[$i] eq '--') && ($b[$i] ne '--')); + $r[$i]='++' if (($a[$i] ne '--') && ($b[$i] ne '--')); + } + return(@r); + } + +sub compress + { + local($s)=@_; + local($_,$i,@a,%a,$r); + + $s =~ s/\^\^/\^/g; + $s =~ s/^\^//; + $s =~ s/\^$//; + @a=split(/\^/,$s); + + while ($#a >= 0) + { + $_=shift(@a); + next unless /\d/; + $a{$_}++; + } + foreach $i (sort keys %a) + { + next if ($a{$i}%2 == 0); + $r.="$i^"; + } + chop($r); + return($r); + } +1; diff --git a/src/lib/libssl/src/crypto/des/sk.h b/src/lib/libssl/src/crypto/des/sk.h new file mode 100644 index 0000000000..f2ade88c7c --- /dev/null +++ b/src/lib/libssl/src/crypto/des/sk.h @@ -0,0 +1,204 @@ +/* crypto/des/sk.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +static const DES_LONG des_skb[8][64]={ +{ +/* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ +0x00000000L,0x00000010L,0x20000000L,0x20000010L, +0x00010000L,0x00010010L,0x20010000L,0x20010010L, +0x00000800L,0x00000810L,0x20000800L,0x20000810L, +0x00010800L,0x00010810L,0x20010800L,0x20010810L, +0x00000020L,0x00000030L,0x20000020L,0x20000030L, +0x00010020L,0x00010030L,0x20010020L,0x20010030L, +0x00000820L,0x00000830L,0x20000820L,0x20000830L, +0x00010820L,0x00010830L,0x20010820L,0x20010830L, +0x00080000L,0x00080010L,0x20080000L,0x20080010L, +0x00090000L,0x00090010L,0x20090000L,0x20090010L, +0x00080800L,0x00080810L,0x20080800L,0x20080810L, +0x00090800L,0x00090810L,0x20090800L,0x20090810L, +0x00080020L,0x00080030L,0x20080020L,0x20080030L, +0x00090020L,0x00090030L,0x20090020L,0x20090030L, +0x00080820L,0x00080830L,0x20080820L,0x20080830L, +0x00090820L,0x00090830L,0x20090820L,0x20090830L, +},{ +/* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ +0x00000000L,0x02000000L,0x00002000L,0x02002000L, +0x00200000L,0x02200000L,0x00202000L,0x02202000L, +0x00000004L,0x02000004L,0x00002004L,0x02002004L, +0x00200004L,0x02200004L,0x00202004L,0x02202004L, +0x00000400L,0x02000400L,0x00002400L,0x02002400L, +0x00200400L,0x02200400L,0x00202400L,0x02202400L, +0x00000404L,0x02000404L,0x00002404L,0x02002404L, +0x00200404L,0x02200404L,0x00202404L,0x02202404L, +0x10000000L,0x12000000L,0x10002000L,0x12002000L, +0x10200000L,0x12200000L,0x10202000L,0x12202000L, +0x10000004L,0x12000004L,0x10002004L,0x12002004L, +0x10200004L,0x12200004L,0x10202004L,0x12202004L, +0x10000400L,0x12000400L,0x10002400L,0x12002400L, +0x10200400L,0x12200400L,0x10202400L,0x12202400L, +0x10000404L,0x12000404L,0x10002404L,0x12002404L, +0x10200404L,0x12200404L,0x10202404L,0x12202404L, +},{ +/* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ +0x00000000L,0x00000001L,0x00040000L,0x00040001L, +0x01000000L,0x01000001L,0x01040000L,0x01040001L, +0x00000002L,0x00000003L,0x00040002L,0x00040003L, +0x01000002L,0x01000003L,0x01040002L,0x01040003L, +0x00000200L,0x00000201L,0x00040200L,0x00040201L, +0x01000200L,0x01000201L,0x01040200L,0x01040201L, +0x00000202L,0x00000203L,0x00040202L,0x00040203L, +0x01000202L,0x01000203L,0x01040202L,0x01040203L, +0x08000000L,0x08000001L,0x08040000L,0x08040001L, +0x09000000L,0x09000001L,0x09040000L,0x09040001L, +0x08000002L,0x08000003L,0x08040002L,0x08040003L, +0x09000002L,0x09000003L,0x09040002L,0x09040003L, +0x08000200L,0x08000201L,0x08040200L,0x08040201L, +0x09000200L,0x09000201L,0x09040200L,0x09040201L, +0x08000202L,0x08000203L,0x08040202L,0x08040203L, +0x09000202L,0x09000203L,0x09040202L,0x09040203L, +},{ +/* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ +0x00000000L,0x00100000L,0x00000100L,0x00100100L, +0x00000008L,0x00100008L,0x00000108L,0x00100108L, +0x00001000L,0x00101000L,0x00001100L,0x00101100L, +0x00001008L,0x00101008L,0x00001108L,0x00101108L, +0x04000000L,0x04100000L,0x04000100L,0x04100100L, +0x04000008L,0x04100008L,0x04000108L,0x04100108L, +0x04001000L,0x04101000L,0x04001100L,0x04101100L, +0x04001008L,0x04101008L,0x04001108L,0x04101108L, +0x00020000L,0x00120000L,0x00020100L,0x00120100L, +0x00020008L,0x00120008L,0x00020108L,0x00120108L, +0x00021000L,0x00121000L,0x00021100L,0x00121100L, +0x00021008L,0x00121008L,0x00021108L,0x00121108L, +0x04020000L,0x04120000L,0x04020100L,0x04120100L, +0x04020008L,0x04120008L,0x04020108L,0x04120108L, +0x04021000L,0x04121000L,0x04021100L,0x04121100L, +0x04021008L,0x04121008L,0x04021108L,0x04121108L, +},{ +/* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ +0x00000000L,0x10000000L,0x00010000L,0x10010000L, +0x00000004L,0x10000004L,0x00010004L,0x10010004L, +0x20000000L,0x30000000L,0x20010000L,0x30010000L, +0x20000004L,0x30000004L,0x20010004L,0x30010004L, +0x00100000L,0x10100000L,0x00110000L,0x10110000L, +0x00100004L,0x10100004L,0x00110004L,0x10110004L, +0x20100000L,0x30100000L,0x20110000L,0x30110000L, +0x20100004L,0x30100004L,0x20110004L,0x30110004L, +0x00001000L,0x10001000L,0x00011000L,0x10011000L, +0x00001004L,0x10001004L,0x00011004L,0x10011004L, +0x20001000L,0x30001000L,0x20011000L,0x30011000L, +0x20001004L,0x30001004L,0x20011004L,0x30011004L, +0x00101000L,0x10101000L,0x00111000L,0x10111000L, +0x00101004L,0x10101004L,0x00111004L,0x10111004L, +0x20101000L,0x30101000L,0x20111000L,0x30111000L, +0x20101004L,0x30101004L,0x20111004L,0x30111004L, +},{ +/* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ +0x00000000L,0x08000000L,0x00000008L,0x08000008L, +0x00000400L,0x08000400L,0x00000408L,0x08000408L, +0x00020000L,0x08020000L,0x00020008L,0x08020008L, +0x00020400L,0x08020400L,0x00020408L,0x08020408L, +0x00000001L,0x08000001L,0x00000009L,0x08000009L, +0x00000401L,0x08000401L,0x00000409L,0x08000409L, +0x00020001L,0x08020001L,0x00020009L,0x08020009L, +0x00020401L,0x08020401L,0x00020409L,0x08020409L, +0x02000000L,0x0A000000L,0x02000008L,0x0A000008L, +0x02000400L,0x0A000400L,0x02000408L,0x0A000408L, +0x02020000L,0x0A020000L,0x02020008L,0x0A020008L, +0x02020400L,0x0A020400L,0x02020408L,0x0A020408L, +0x02000001L,0x0A000001L,0x02000009L,0x0A000009L, +0x02000401L,0x0A000401L,0x02000409L,0x0A000409L, +0x02020001L,0x0A020001L,0x02020009L,0x0A020009L, +0x02020401L,0x0A020401L,0x02020409L,0x0A020409L, +},{ +/* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ +0x00000000L,0x00000100L,0x00080000L,0x00080100L, +0x01000000L,0x01000100L,0x01080000L,0x01080100L, +0x00000010L,0x00000110L,0x00080010L,0x00080110L, +0x01000010L,0x01000110L,0x01080010L,0x01080110L, +0x00200000L,0x00200100L,0x00280000L,0x00280100L, +0x01200000L,0x01200100L,0x01280000L,0x01280100L, +0x00200010L,0x00200110L,0x00280010L,0x00280110L, +0x01200010L,0x01200110L,0x01280010L,0x01280110L, +0x00000200L,0x00000300L,0x00080200L,0x00080300L, +0x01000200L,0x01000300L,0x01080200L,0x01080300L, +0x00000210L,0x00000310L,0x00080210L,0x00080310L, +0x01000210L,0x01000310L,0x01080210L,0x01080310L, +0x00200200L,0x00200300L,0x00280200L,0x00280300L, +0x01200200L,0x01200300L,0x01280200L,0x01280300L, +0x00200210L,0x00200310L,0x00280210L,0x00280310L, +0x01200210L,0x01200310L,0x01280210L,0x01280310L, +},{ +/* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ +0x00000000L,0x04000000L,0x00040000L,0x04040000L, +0x00000002L,0x04000002L,0x00040002L,0x04040002L, +0x00002000L,0x04002000L,0x00042000L,0x04042000L, +0x00002002L,0x04002002L,0x00042002L,0x04042002L, +0x00000020L,0x04000020L,0x00040020L,0x04040020L, +0x00000022L,0x04000022L,0x00040022L,0x04040022L, +0x00002020L,0x04002020L,0x00042020L,0x04042020L, +0x00002022L,0x04002022L,0x00042022L,0x04042022L, +0x00000800L,0x04000800L,0x00040800L,0x04040800L, +0x00000802L,0x04000802L,0x00040802L,0x04040802L, +0x00002800L,0x04002800L,0x00042800L,0x04042800L, +0x00002802L,0x04002802L,0x00042802L,0x04042802L, +0x00000820L,0x04000820L,0x00040820L,0x04040820L, +0x00000822L,0x04000822L,0x00040822L,0x04040822L, +0x00002820L,0x04002820L,0x00042820L,0x04042820L, +0x00002822L,0x04002822L,0x00042822L,0x04042822L, +}}; diff --git a/src/lib/libssl/src/crypto/des/supp.c b/src/lib/libssl/src/crypto/des/supp.c new file mode 100644 index 0000000000..f8e5833f69 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/supp.c @@ -0,0 +1,109 @@ +/* crypto/des/supp.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* + * Copyright (c) 1995 + * Mark Murray. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Mark Murray + * 4. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MARK MURRAY AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: supp.c,v 1.1.1.1 1998/10/05 20:12:45 ryker Exp $ + */ + +#include <stdio.h> +#include "des_locl.h" + +void des_cblock_print_file(cb, fp) + des_cblock *cb; + FILE *fp; +{ + int i; + unsigned int *p = (unsigned int *)cb; + + fprintf(fp, " 0x { "); + for (i = 0; i < 8; i++) { + fprintf(fp, "%x", p[i]); + if (i != 7) fprintf(fp, ", "); + } + fprintf(fp, " }"); +} diff --git a/src/lib/libssl/src/crypto/des/testdes.pl b/src/lib/libssl/src/crypto/des/testdes.pl new file mode 100644 index 0000000000..67fbd47f36 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/testdes.pl @@ -0,0 +1,167 @@ +#!/usr/bin/perl + +# des.pl tesing code + +require 'des.pl'; + +$num_tests=34; +@key_data=( + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10, + 0x7C,0xA1,0x10,0x45,0x4A,0x1A,0x6E,0x57, + 0x01,0x31,0xD9,0x61,0x9D,0xC1,0x37,0x6E, + 0x07,0xA1,0x13,0x3E,0x4A,0x0B,0x26,0x86, + 0x38,0x49,0x67,0x4C,0x26,0x02,0x31,0x9E, + 0x04,0xB9,0x15,0xBA,0x43,0xFE,0xB5,0xB6, + 0x01,0x13,0xB9,0x70,0xFD,0x34,0xF2,0xCE, + 0x01,0x70,0xF1,0x75,0x46,0x8F,0xB5,0xE6, + 0x43,0x29,0x7F,0xAD,0x38,0xE3,0x73,0xFE, + 0x07,0xA7,0x13,0x70,0x45,0xDA,0x2A,0x16, + 0x04,0x68,0x91,0x04,0xC2,0xFD,0x3B,0x2F, + 0x37,0xD0,0x6B,0xB5,0x16,0xCB,0x75,0x46, + 0x1F,0x08,0x26,0x0D,0x1A,0xC2,0x46,0x5E, + 0x58,0x40,0x23,0x64,0x1A,0xBA,0x61,0x76, + 0x02,0x58,0x16,0x16,0x46,0x29,0xB0,0x07, + 0x49,0x79,0x3E,0xBC,0x79,0xB3,0x25,0x8F, + 0x4F,0xB0,0x5E,0x15,0x15,0xAB,0x73,0xA7, + 0x49,0xE9,0x5D,0x6D,0x4C,0xA2,0x29,0xBF, + 0x01,0x83,0x10,0xDC,0x40,0x9B,0x26,0xD6, + 0x1C,0x58,0x7F,0x1C,0x13,0x92,0x4F,0xEF, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x1F,0x1F,0x1F,0x1F,0x0E,0x0E,0x0E,0x0E, + 0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10, + ); + +@plain_data=( + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x01,0xA1,0xD6,0xD0,0x39,0x77,0x67,0x42, + 0x5C,0xD5,0x4C,0xA8,0x3D,0xEF,0x57,0xDA, + 0x02,0x48,0xD4,0x38,0x06,0xF6,0x71,0x72, + 0x51,0x45,0x4B,0x58,0x2D,0xDF,0x44,0x0A, + 0x42,0xFD,0x44,0x30,0x59,0x57,0x7F,0xA2, + 0x05,0x9B,0x5E,0x08,0x51,0xCF,0x14,0x3A, + 0x07,0x56,0xD8,0xE0,0x77,0x47,0x61,0xD2, + 0x76,0x25,0x14,0xB8,0x29,0xBF,0x48,0x6A, + 0x3B,0xDD,0x11,0x90,0x49,0x37,0x28,0x02, + 0x26,0x95,0x5F,0x68,0x35,0xAF,0x60,0x9A, + 0x16,0x4D,0x5E,0x40,0x4F,0x27,0x52,0x32, + 0x6B,0x05,0x6E,0x18,0x75,0x9F,0x5C,0xCA, + 0x00,0x4B,0xD6,0xEF,0x09,0x17,0x60,0x62, + 0x48,0x0D,0x39,0x00,0x6E,0xE7,0x62,0xF2, + 0x43,0x75,0x40,0xC8,0x69,0x8F,0x3C,0xFA, + 0x07,0x2D,0x43,0xA0,0x77,0x07,0x52,0x92, + 0x02,0xFE,0x55,0x77,0x81,0x17,0xF1,0x2A, + 0x1D,0x9D,0x5C,0x50,0x18,0xF7,0x28,0xC2, + 0x30,0x55,0x32,0x28,0x6D,0x6F,0x29,0x5A, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF); + +@cipher_data=( + 0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7, + 0x73,0x59,0xB2,0x16,0x3E,0x4E,0xDC,0x58, + 0x95,0x8E,0x6E,0x62,0x7A,0x05,0x55,0x7B, + 0xF4,0x03,0x79,0xAB,0x9E,0x0E,0xC5,0x33, + 0x17,0x66,0x8D,0xFC,0x72,0x92,0x53,0x2D, + 0x8A,0x5A,0xE1,0xF8,0x1A,0xB8,0xF2,0xDD, + 0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7, + 0xED,0x39,0xD9,0x50,0xFA,0x74,0xBC,0xC4, + 0x69,0x0F,0x5B,0x0D,0x9A,0x26,0x93,0x9B, + 0x7A,0x38,0x9D,0x10,0x35,0x4B,0xD2,0x71, + 0x86,0x8E,0xBB,0x51,0xCA,0xB4,0x59,0x9A, + 0x71,0x78,0x87,0x6E,0x01,0xF1,0x9B,0x2A, + 0xAF,0x37,0xFB,0x42,0x1F,0x8C,0x40,0x95, + 0x86,0xA5,0x60,0xF1,0x0E,0xC6,0xD8,0x5B, + 0x0C,0xD3,0xDA,0x02,0x00,0x21,0xDC,0x09, + 0xEA,0x67,0x6B,0x2C,0xB7,0xDB,0x2B,0x7A, + 0xDF,0xD6,0x4A,0x81,0x5C,0xAF,0x1A,0x0F, + 0x5C,0x51,0x3C,0x9C,0x48,0x86,0xC0,0x88, + 0x0A,0x2A,0xEE,0xAE,0x3F,0xF4,0xAB,0x77, + 0xEF,0x1B,0xF0,0x3E,0x5D,0xFA,0x57,0x5A, + 0x88,0xBF,0x0D,0xB6,0xD7,0x0D,0xEE,0x56, + 0xA1,0xF9,0x91,0x55,0x41,0x02,0x0B,0x56, + 0x6F,0xBF,0x1C,0xAF,0xCF,0xFD,0x05,0x56, + 0x2F,0x22,0xE4,0x9B,0xAB,0x7C,0xA1,0xAC, + 0x5A,0x6B,0x61,0x2C,0xC2,0x6C,0xCE,0x4A, + 0x5F,0x4C,0x03,0x8E,0xD1,0x2B,0x2E,0x41, + 0x63,0xFA,0xC0,0xD0,0x34,0xD9,0xF7,0x93, + 0x61,0x7B,0x3A,0x0C,0xE8,0xF0,0x71,0x00, + 0xDB,0x95,0x86,0x05,0xF8,0xC8,0xC6,0x06, + 0xED,0xBF,0xD1,0xC6,0x6C,0x29,0xCC,0xC7, + 0x35,0x55,0x50,0xB2,0x15,0x0E,0x24,0x51, + 0xCA,0xAA,0xAF,0x4D,0xEA,0xF1,0xDB,0xAE, + 0xD5,0xD4,0x4F,0xF7,0x20,0x68,0x3D,0x0D, + 0x2A,0x2B,0xB0,0x08,0xDF,0x97,0xC2,0xF2); + +print "Doing ecb tests\n"; +for ($i=0; $i<$num_tests; $i++) + { + printf "Doing test $i\n"; + $key =pack("C8",splice(@key_data ,0,8)); + $data=pack("C8",splice(@plain_data ,0,8)); + $res =pack("C8",splice(@cipher_data,0,8)); + + @ks= &des_set_key($key); + $out1= &des_ecb_encrypt(*ks,1,$data); + $out2= &des_ecb_encrypt(*ks,0,$out1); + $out3= &des_ecb_encrypt(*ks,0,$res); + &eprint("encryption failure",$res,$out1) + if ($out1 ne $res); + &eprint("encryption/decryption failure",$data,$out2) + if ($out2 ne $data); + &eprint("decryption failure",$data,$out3) + if ($data ne $out3); + } +print "Done\n"; + +print "doing speed test over 30 seconds\n"; +$SIG{'ALRM'}='done'; +sub done {$done=1;} +$done=0; + +$count=0; +$d=pack("C8",0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef); +@ks= &des_set_key($d); +alarm(30); +$start=(times)[0]; +while (!$done) + { + $count++; + $d=&des_ecb_encrypt(*ks,1,$d); + } +$end=(times)[0]; +$t=$end-$start; +printf "$count DESs in %.2f seconds is %.2f DESs/sec or %.2f bytes/sec\n", + 1.0*$t,1.0*$count/$t,$count*8.0/$t; + +sub eprint + { + local($s,$c,$e)=@_; + local(@k); + + @k=unpack("C8",$c); + printf "%02x%02x%02x%02x %02x%02x%02x%02x - ",unpack("C8",$c); + printf "%02x%02x%02x%02x %02x%02x%02x%02x :",unpack("C8",$e); + print " $s\n"; + } diff --git a/src/lib/libssl/src/crypto/des/vms.com b/src/lib/libssl/src/crypto/des/vms.com new file mode 100644 index 0000000000..62ca1fbda4 --- /dev/null +++ b/src/lib/libssl/src/crypto/des/vms.com @@ -0,0 +1,90 @@ +$! --- VMS.com --- +$! +$ GoSub defines +$ GoSub linker_options +$ If (P1 .nes. "") +$ Then +$ GoSub 'P1' +$ Else +$ GoSub lib +$ GoSub destest +$ GoSub rpw +$ GoSub speed +$ GoSub des +$ EndIF +$! +$ Exit +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$DEFINES: +$ OPT_FILE := "VAX_LINKER_OPTIONS.OPT" +$! +$ CC_OPTS := "/NODebug/OPTimize/NOWarn" +$! +$ LINK_OPTS := "/NODebug/NOTraceback/Contiguous" +$! +$ OBJS = "cbc_cksm.obj,cbc_enc.obj,ecb_enc.obj,pcbc_enc.obj," + - + "qud_cksm.obj,rand_key.obj,read_pwd.obj,set_key.obj," + - + "str2key.obj,enc_read.obj,enc_writ.obj,fcrypt.obj," + - + "cfb_enc.obj,ecb3_enc.obj,ofb_enc.obj" + + +$! +$ LIBDES = "cbc_cksm.c,cbc_enc.c,ecb_enc.c,enc_read.c," + - + "enc_writ.c,pcbc_enc.c,qud_cksm.c,rand_key.c," + - + "read_pwd.c,set_key.c,str2key.c,fcrypt.c," + - + "cfb_enc.c,ecb3_enc.c,ofb_enc.c" +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$LINKER_OPTIONS: +$ If (f$search(OPT_FILE) .eqs. "") +$ Then +$ Create 'OPT_FILE' +$DECK +! Default system options file to link against the sharable C runtime library +! +Sys$Share:VAXcRTL.exe/Share +$EOD +$ EndIF +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$LIB: +$ CC 'CC_OPTS' 'LIBDES' +$ If (f$search("LIBDES.OLB") .nes. "") +$ Then Library /Object /Replace libdes 'OBJS' +$ Else Library /Create /Object libdes 'OBJS' +$ EndIF +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$DESTEST: +$ CC 'CC_OPTS' destest +$ Link 'link_opts' /Exec=destest destest.obj,libdes/LIBRARY,'opt_file'/Option +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$RPW: +$ CC 'CC_OPTS' rpw +$ Link 'link_opts' /Exec=rpw rpw.obj,libdes/LIBRARY,'opt_file'/Option +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$SPEED: +$ CC 'CC_OPTS' speed +$ Link 'link_opts' /Exec=speed speed.obj,libdes/LIBRARY,'opt_file'/Option +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$DES: +$ CC 'CC_OPTS' des +$ Link 'link_opts' /Exec=des des.obj,libdes/LIBRARY,'opt_file'/Option +$ Return diff --git a/src/lib/libssl/src/crypto/dh/dh.err b/src/lib/libssl/src/crypto/dh/dh.err new file mode 100644 index 0000000000..a4fe746985 --- /dev/null +++ b/src/lib/libssl/src/crypto/dh/dh.err @@ -0,0 +1,12 @@ +/* Error codes for the DH functions. */ + +/* Function codes. */ +#define DH_F_DHPARAMS_PRINT 100 +#define DH_F_DHPARAMS_PRINT_FP 101 +#define DH_F_DH_COMPUTE_KEY 102 +#define DH_F_DH_GENERATE_KEY 103 +#define DH_F_DH_GENERATE_PARAMETERS 104 +#define DH_F_DH_NEW 105 + +/* Reason codes. */ +#define DH_R_NO_PRIVATE_VALUE 100 diff --git a/src/lib/libssl/src/crypto/dsa/dsa.err b/src/lib/libssl/src/crypto/dsa/dsa.err new file mode 100644 index 0000000000..1131e9fa74 --- /dev/null +++ b/src/lib/libssl/src/crypto/dsa/dsa.err @@ -0,0 +1,15 @@ +/* Error codes for the DSA functions. */ + +/* Function codes. */ +#define DSA_F_DSAPARAMS_PRINT 100 +#define DSA_F_DSAPARAMS_PRINT_FP 101 +#define DSA_F_DSA_IS_PRIME 102 +#define DSA_F_DSA_NEW 103 +#define DSA_F_DSA_PRINT 104 +#define DSA_F_DSA_PRINT_FP 105 +#define DSA_F_DSA_SIGN 106 +#define DSA_F_DSA_SIGN_SETUP 107 +#define DSA_F_DSA_VERIFY 108 + +/* Reason codes. */ +#define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100 diff --git a/src/lib/libssl/src/crypto/err/err_code.pl b/src/lib/libssl/src/crypto/err/err_code.pl new file mode 100644 index 0000000000..ebc8eef913 --- /dev/null +++ b/src/lib/libssl/src/crypto/err/err_code.pl @@ -0,0 +1,105 @@ +#!/usr/bin/perl + +while (@ARGV) + { + $in=shift(@ARGV); + if ($in =~ /^-conf$/) + { + $in=shift(@ARGV); + open(IN,"<$in") || die "unable to open '$in'\n"; + while (<IN>) + { + s/#.*$//; + s/\s+$//; + next if (/^$/); + if (/^L\s+(\S+)\s+(\S+)$/) + { $errfile{$1}=$2; } + elsif (/^F\s+(\S+)$/) + { $function{$1}=1; } + elsif (/^R\s+(\S+)\s+(\S+)$/) + { $r_value{$1}=$2; } + else { die "bad input line: $in:$.\n"; } + } + close(IN); + next; + } + + open(IN,"<$in") || die "unable to open '$in'\n"; + $last=""; + while (<IN>) + { + if (/err\(([A-Z0-9]+_F_[0-9A-Z_]+)\s*,\s*([0-9A-Z]+_R_[0-9A-Z_]+)\s*\)/) + { + if ($1 != $last) + { + if ($function{$1} == 0) + { + printf STDERR "$. $1 is bad\n"; + } + } + $function{$1}++; + $last=$1; + $reason{$2}++; + } + } + close(IN); + } + +foreach (keys %function,keys %reason) + { + /^([A-Z0-9]+)_/; + $prefix{$1}++; + } + +@F=sort keys %function; +@R=sort keys %reason; +foreach $j (sort keys %prefix) + { + next if $errfile{$j} eq "NONE"; + printf STDERR "doing %-6s - ",$j; + if (defined($errfile{$j})) + { + open(OUT,">$errfile{$j}") || + die "unable to open '$errfile{$j}':$!\n"; + $close_file=1; + } + else + { + *OUT=*STDOUT; + $close=0; + } + @f=grep(/^${j}_/,@F); + @r=grep(/^${j}_/,@R); + $num=100; + print OUT "/* Error codes for the $j functions. */\n\n"; + print OUT "/* Function codes. */\n"; + $f_count=0; + foreach $i (@f) + { + $z=6-int(length($i)/8); + printf OUT "#define $i%s $num\n","\t" x $z; + $num++; + $f_count++; + } + $num=100; + print OUT "\n/* Reason codes. */\n"; + $r_count=0; + foreach $i (@r) + { + $z=6-int(length($i)/8); + if (defined($r_value{$i})) + { + printf OUT "#define $i%s $r_value{$i}\n","\t" x $z; + } + else + { + printf OUT "#define $i%s $num\n","\t" x $z; + $num++; + } + $r_count++; + } + close(OUT) if $close_file; + + printf STDERR "%3d functions, %3d reasons\n",$f_count,$r_count; + } + diff --git a/src/lib/libssl/src/crypto/err/err_genc.pl b/src/lib/libssl/src/crypto/err/err_genc.pl new file mode 100644 index 0000000000..a8e36c2f0c --- /dev/null +++ b/src/lib/libssl/src/crypto/err/err_genc.pl @@ -0,0 +1,198 @@ +#!/usr/bin/perl + +if ($ARGV[0] eq "-s") { $static=1; shift @ARGV; } + +($#ARGV == 1) || die "usage: $0 [-s] <header file> <output C file>\n"; +open(IN,"<$ARGV[0]") || die "unable to open $ARGV[0]:$!\n"; +open(STDOUT,">$ARGV[1]") || die "unable to open $ARGV[1]:$!\n"; + +$Func=0; +$Reas=0; +$fuction{'FOPEN'}='fopen'; +while (<IN>) + { + if (/(\S+)\s*\(\);/) + { + $t=$1; + $t =~ s/\*//; + ($upper=$t) =~ tr/a-z/A-Z/; + $fuction{$upper}=$t; + } + next unless (/^#define\s+(\S+)\s/); + + $o=$1; + if ($o =~ /^([^_]+)_F_(.*)/) + { + $type=$1; + $Func++; + $n=$2; + $n=$fuction{$n} if (defined($fuction{$n})); + $out{$1."_str_functs"}.= + sprintf("{ERR_PACK(0,%s,0),\t\"$n\"},\n",$o); + } + elsif ($o =~ /^([^_]+)_R_(.*)/) + { + $type=$1; + $Reas++; + $r=$2; + $r =~ tr/A-Z_/a-z /; + $pkg{$type."_str_reasons"}=$type; + $out{$type."_str_reasons"}.=sprintf("{%-40s,\"$r\"},\n",$o); + } + elsif ($ARGV[0] =~ /rsaref/ && $o =~ /^RE_(.*)/) + { + $type="RSAREF"; + $Reas++; + $r=$1; + $r =~ tr/A-Z_/a-z /; + $pkg{$type."_str_reasons"}=$type; + $out{$type."_str_reasons"}.=sprintf("{%-40s,\"$r\"},\n",$o); + } + } +close(IN); + +&header($type,$ARGV[0]); + +foreach (sort keys %out) + { + print "static ERR_STRING_DATA ${_}[]=\n\t{\n"; + print $out{$_}; + print "{0,NULL},\n"; + print "\t};\n\n"; + } +print "#endif\n"; + +if ($static) + { $lib="ERR_LIB_$type"; } +else + { $lib="${type}_lib_error_code"; } + +$str=""; +$str.="#ifndef NO_ERR\n"; +$str.="\t\tERR_load_strings($lib,${type}_str_functs);\n" if $Func; +$str.="\t\tERR_load_strings($lib,${type}_str_reasons);\n" if $Reas; +$str.="#endif\n"; + +if (!$static) + { +print <<"EOF"; + +static int ${type}_lib_error_code=0; + +void ERR_load_${type}_strings() + { + static int init=1; + + if (${type}_lib_error_code == 0) + ${type}_lib_error_code=ERR_get_next_error_library(); + + if (init); + {; + init=0; +$str + } + } + +void ERR_${type}_error(function,reason,file,line) +int function; +int reason; +char *file; +int line; + { + if (${type}_lib_error_code == 0) + ${type}_lib_error_code=ERR_get_next_error_library(); + ERR_PUT_error(${type}_lib_error_code,function,reason,file,line); + } +EOF + } +else # $static + { + print <<"EOF"; + +void ERR_load_${type}_strings() + { + static int init=1; + + if (init); + {; + init=0; +$str + } + } +EOF + } + +sub header + { + ($type,$header)=@_; + + ($lc=$type) =~ tr/A-Z/a-z/; + $header =~ s/^.*\///; + + print "/* lib/$lc/${lc}\_err.c */\n"; + print <<'EOF'; +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +EOF + + print "#include <stdio.h>\n"; + print "#include \"err.h\"\n"; + print "#include \"$header\"\n"; + print "\n/* BEGIN ERROR CODES */\n"; + print "#ifndef NO_ERR\n"; + } + diff --git a/src/lib/libssl/src/crypto/err/error.err b/src/lib/libssl/src/crypto/err/error.err new file mode 100644 index 0000000000..f09557d8d9 --- /dev/null +++ b/src/lib/libssl/src/crypto/err/error.err @@ -0,0 +1,13 @@ +/* Error codes for the ERR functions. */ + +/* Function codes. */ + +/* Reason codes. */ +#define ERR_R_BN_LIB 100 +#define ERR_R_DER_LIB 101 +#define ERR_R_MALLOC_FAILURE 102 +#define ERR_R_PEM_LIB 103 +#define ERR_R_RSA_LIB 104 +#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED 105 +#define ERR_R_SYS_LIB 106 +#define ERR_R_X509_LIB 107 diff --git a/src/lib/libssl/src/crypto/err/ssleay.ec b/src/lib/libssl/src/crypto/err/ssleay.ec new file mode 100644 index 0000000000..10b5dbb59d --- /dev/null +++ b/src/lib/libssl/src/crypto/err/ssleay.ec @@ -0,0 +1,57 @@ +L ERR NONE +L CRYPTO crypto.err +L BN bn/bn.err +L RSA rsa/rsa.err +L DSA dsa/dsa.err +L DH dh/dh.err +L EVP evp/evp.err +L BUF buffer/buffer.err +L BIO bio/bio.err +L OBJ objects/objects.err +L PEM pem/pem.err +L X509 x509/x509.err +L METH meth/meth.err +L ASN1 asn1/asn1.err +L CONF conf/conf.err +L PROXY proxy/proxy.err +L PKCS7 pkcs7/pkcs7.err +L RSAREF ../rsaref/rsaref.err +L SSL ../ssl/ssl.err +L SSL2 ../ssl/ssl2.err +L SSL3 ../ssl/ssl3.err +L SSL23 ../ssl/ssl23.err + +F RSAREF_F_RSA_BN2BIN +F RSAREF_F_RSA_PRIVATE_DECRYPT +F RSAREF_F_RSA_PRIVATE_ENCRYPT +F RSAREF_F_RSA_PUBLIC_DECRYPT +F RSAREF_F_RSA_PUBLIC_ENCRYPT +#F SSL_F_CLIENT_CERTIFICATE + +R SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 +R SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 +R SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 +R SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 +R SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 +R SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 +R SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 +R SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 +R SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 +R SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 +R SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 + +R RSAREF_R_CONTENT_ENCODING 0x0400 +R RSAREF_R_DATA 0x0401 +R RSAREF_R_DIGEST_ALGORITHM 0x0402 +R RSAREF_R_ENCODING 0x0403 +R RSAREF_R_KEY 0x0404 +R RSAREF_R_KEY_ENCODING 0x0405 +R RSAREF_R_LEN 0x0406 +R RSAREF_R_MODULUS_LEN 0x0407 +R RSAREF_R_NEED_RANDOM 0x0408 +R RSAREF_R_PRIVATE_KEY 0x0409 +R RSAREF_R_PUBLIC_KEY 0x040a +R RSAREF_R_SIGNATURE 0x040b +R RSAREF_R_SIGNATURE_ENCODING 0x040c +R RSAREF_R_ENCRYPTION_ALGORITHM 0x040d + diff --git a/src/lib/libssl/src/crypto/evp/e_cbc_3d.c b/src/lib/libssl/src/crypto/evp/e_cbc_3d.c new file mode 100644 index 0000000000..5761bf186a --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_cbc_3d.c @@ -0,0 +1,163 @@ +/* crypto/evp/e_cbc_3d.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void des_cbc_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_cbc_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_cbc_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void des_cbc_ede_init_key(); +static void des_cbc_ede3_init_key(); +static void des_cbc_ede_cipher(); +#endif + +static EVP_CIPHER d_cbc_ede_cipher2= + { + NID_des_ede_cbc, + 8,16,8, + des_cbc_ede_init_key, + des_cbc_ede_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), + EVP_CIPHER_get_asn1_iv, + EVP_CIPHER_set_asn1_iv, + }; + +static EVP_CIPHER d_cbc_ede_cipher3= + { + NID_des_ede3_cbc, + 8,24,8, + des_cbc_ede3_init_key, + des_cbc_ede_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_des_ede_cbc() + { + return(&d_cbc_ede_cipher2); + } + +EVP_CIPHER *EVP_des_ede3_cbc() + { + return(&d_cbc_ede_cipher3); + } + +static void des_cbc_ede_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + + if (key != NULL) + { + des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); + des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + memcpy( (char *)ctx->c.des_ede.ks3, + (char *)ctx->c.des_ede.ks1, + sizeof(ctx->c.des_ede.ks1)); + } + } + +static void des_cbc_ede3_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + + if (key != NULL) + { + des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); + des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); + } + } + +static void des_cbc_ede_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + des_ede3_cbc_encrypt( + (des_cblock *)in,(des_cblock *)out, + (long)inl, ctx->c.des_ede.ks1, + ctx->c.des_ede.ks2,ctx->c.des_ede.ks3, + (des_cblock *)&(ctx->iv[0]), + ctx->encrypt); + } diff --git a/src/lib/libssl/src/crypto/evp/e_cbc_bf.c b/src/lib/libssl/src/crypto/evp/e_cbc_bf.c new file mode 100644 index 0000000000..be605f4a13 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_cbc_bf.c @@ -0,0 +1,119 @@ +/* crypto/evp/e_cbc_bf.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_BLOWFISH + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void bf_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void bf_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void bf_cbc_init_key(); +static void bf_cbc_cipher(); +#endif + +static EVP_CIPHER bfish_cbc_cipher= + { + NID_bf_cbc, + 8,EVP_BLOWFISH_KEY_SIZE,8, + bf_cbc_init_key, + bf_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), + EVP_CIPHER_get_asn1_iv, + EVP_CIPHER_set_asn1_iv, + }; + +EVP_CIPHER *EVP_bf_cbc() + { + return(&bfish_cbc_cipher); + } + +static void bf_cbc_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + BF_set_key(&(ctx->c.bf_ks),EVP_BLOWFISH_KEY_SIZE,key); + } + +static void bf_cbc_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + BF_cbc_encrypt( + in,out,(long)inl, + &(ctx->c.bf_ks),&(ctx->iv[0]), + ctx->encrypt); + } + +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_cbc_c.c b/src/lib/libssl/src/crypto/evp/e_cbc_c.c new file mode 100644 index 0000000000..b50c7874b3 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_cbc_c.c @@ -0,0 +1,119 @@ +/* crypto/evp/e_cbc_c.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_CAST + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void cast_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void cast_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void cast_cbc_init_key(); +static void cast_cbc_cipher(); +#endif + +static EVP_CIPHER cast5_cbc_cipher= + { + NID_cast5_cbc, + 8,EVP_CAST5_KEY_SIZE,8, + cast_cbc_init_key, + cast_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), + EVP_CIPHER_get_asn1_iv, + EVP_CIPHER_set_asn1_iv, + }; + +EVP_CIPHER *EVP_cast5_cbc() + { + return(&cast5_cbc_cipher); + } + +static void cast_cbc_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + CAST_set_key(&(ctx->c.cast_ks),EVP_CAST5_KEY_SIZE,key); + } + +static void cast_cbc_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + CAST_cbc_encrypt( + in,out,(long)inl, + &(ctx->c.cast_ks),&(ctx->iv[0]), + ctx->encrypt); + } + +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_cbc_d.c b/src/lib/libssl/src/crypto/evp/e_cbc_d.c new file mode 100644 index 0000000000..c67706e3a0 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_cbc_d.c @@ -0,0 +1,116 @@ +/* crypto/evp/e_cbc_d.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void des_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void des_cbc_init_key(); +static void des_cbc_cipher(); +#endif + +static EVP_CIPHER d_cbc_cipher= + { + NID_des_cbc, + 8,8,8, + des_cbc_init_key, + des_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), + EVP_CIPHER_get_asn1_iv, + EVP_CIPHER_set_asn1_iv, + }; + +EVP_CIPHER *EVP_des_cbc() + { + return(&d_cbc_cipher); + } + +static void des_cbc_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + des_set_key((des_cblock *)key,ctx->c.des_ks); + } + +static void des_cbc_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + des_ncbc_encrypt( + (des_cblock *)in,(des_cblock *)out, + (long)inl, ctx->c.des_ks, + (des_cblock *)&(ctx->iv[0]), + ctx->encrypt); + } diff --git a/src/lib/libssl/src/crypto/evp/e_cbc_i.c b/src/lib/libssl/src/crypto/evp/e_cbc_i.c new file mode 100644 index 0000000000..312ffcb721 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_cbc_i.c @@ -0,0 +1,131 @@ +/* crypto/evp/e_cbc_i.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_IDEA + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void idea_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void idea_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void idea_cbc_init_key(); +static void idea_cbc_cipher(); +#endif + +static EVP_CIPHER i_cbc_cipher= + { + NID_idea_cbc, + 8,16,8, + idea_cbc_init_key, + idea_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), + EVP_CIPHER_get_asn1_iv, + EVP_CIPHER_set_asn1_iv, + }; + +EVP_CIPHER *EVP_idea_cbc() + { + return(&i_cbc_cipher); + } + +static void idea_cbc_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + { + if (enc) + idea_set_encrypt_key(key,&(ctx->c.idea_ks)); + else + { + IDEA_KEY_SCHEDULE tmp; + + idea_set_encrypt_key(key,&tmp); + idea_set_decrypt_key(&tmp,&(ctx->c.idea_ks)); + memset((unsigned char *)&tmp,0, + sizeof(IDEA_KEY_SCHEDULE)); + } + } + } + +static void idea_cbc_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + idea_cbc_encrypt( + in,out,(long)inl, + &(ctx->c.idea_ks),&(ctx->iv[0]), + ctx->encrypt); + } + +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_cbc_r2.c b/src/lib/libssl/src/crypto/evp/e_cbc_r2.c new file mode 100644 index 0000000000..4f8002f16d --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_cbc_r2.c @@ -0,0 +1,136 @@ +/* crypto/evp/e_cbc_r2.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC2 + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void rc2_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void rc2_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void rc2_cbc_init_key(); +static void rc2_cbc_cipher(); +#endif + +static EVP_CIPHER r2_cbc_cipher= + { + NID_rc2_cbc, + 8,EVP_RC2_KEY_SIZE,8, + rc2_cbc_init_key, + rc2_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), + EVP_CIPHER_get_asn1_iv, + EVP_CIPHER_set_asn1_iv, + }; + +static EVP_CIPHER r2_40_cbc_cipher= + { + NID_rc2_40_cbc, + 8,5 /* 40 bit */,8, + rc2_cbc_init_key, + rc2_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), + }; + +EVP_CIPHER *EVP_rc2_cbc() + { + return(&r2_cbc_cipher); + } + +EVP_CIPHER *EVP_rc2_40_cbc() + { + return(&r2_40_cbc_cipher); + } + +static void rc2_cbc_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + RC2_set_key(&(ctx->c.rc2_ks),EVP_CIPHER_CTX_key_length(ctx), + key,EVP_CIPHER_CTX_key_length(ctx)*8); + } + +static void rc2_cbc_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + RC2_cbc_encrypt( + in,out,(long)inl, + &(ctx->c.rc2_ks),&(ctx->iv[0]), + ctx->encrypt); + } + +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_cbc_r5.c b/src/lib/libssl/src/crypto/evp/e_cbc_r5.c new file mode 100644 index 0000000000..f7d46ca91f --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_cbc_r5.c @@ -0,0 +1,120 @@ +/* crypto/evp/e_cbc_r5.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC5 + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void r_32_12_16_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void r_32_12_16_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void r_32_12_16_cbc_init_key(); +static void r_32_12_16_cbc_cipher(); +#endif + +static EVP_CIPHER rc5_32_12_16_cbc_cipher= + { + NID_rc5_cbc, + 8,EVP_RC5_32_12_16_KEY_SIZE,8, + r_32_12_16_cbc_init_key, + r_32_12_16_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5_ks)), + NULL, + NULL, + }; + +EVP_CIPHER *EVP_rc5_32_12_16_cbc() + { + return(&rc5_32_12_16_cbc_cipher); + } + +static void r_32_12_16_cbc_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE, + key,RC5_12_ROUNDS); + } + +static void r_32_12_16_cbc_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + RC5_32_cbc_encrypt( + in,out,(long)inl, + &(ctx->c.rc5_ks),&(ctx->iv[0]), + ctx->encrypt); + } + +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_cfb_3d.c b/src/lib/libssl/src/crypto/evp/e_cfb_3d.c new file mode 100644 index 0000000000..e7e3419411 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_cfb_3d.c @@ -0,0 +1,166 @@ +/* crypto/evp/e_cfb_3d.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void des_ede_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_ede3_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void des_ede_cfb_init_key(); +static void des_ede3_cfb_init_key(); +static void des_ede_cfb_cipher(); +#endif + +static EVP_CIPHER d_ede_cfb_cipher2= + { + NID_des_ede_cfb64, + 1,16,8, + des_ede_cfb_init_key, + des_ede_cfb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +static EVP_CIPHER d_ede3_cfb_cipher3= + { + NID_des_ede3_cfb64, + 1,24,8, + des_ede3_cfb_init_key, + des_ede_cfb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_des_ede_cfb() + { + return(&d_ede_cfb_cipher2); + } + +EVP_CIPHER *EVP_des_ede3_cfb() + { + return(&d_ede3_cfb_cipher3); + } + +static void des_ede_cfb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + { + des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); + des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + memcpy( (char *)ctx->c.des_ede.ks3, + (char *)ctx->c.des_ede.ks1, + sizeof(ctx->c.des_ede.ks1)); + } + } + +static void des_ede3_cfb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + { + des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); + des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); + } + } + +static void des_ede_cfb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + des_ede3_cfb64_encrypt( + in,out,(long)inl, + ctx->c.des_ede.ks1, + ctx->c.des_ede.ks2, + ctx->c.des_ede.ks3, + (des_cblock *)&(ctx->iv[0]), + &ctx->num,ctx->encrypt); + } diff --git a/src/lib/libssl/src/crypto/evp/e_cfb_bf.c b/src/lib/libssl/src/crypto/evp/e_cfb_bf.c new file mode 100644 index 0000000000..8aba2564b8 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_cfb_bf.c @@ -0,0 +1,121 @@ +/* crypto/evp/e_cfb_bf.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_BLOWFISH + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void bf_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void bf_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void bf_cfb_init_key(); +static void bf_cfb_cipher(); +#endif + +static EVP_CIPHER bfish_cfb_cipher= + { + NID_bf_cfb64, + 1,EVP_BLOWFISH_KEY_SIZE,8, + bf_cfb_init_key, + bf_cfb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_bf_cfb() + { + return(&bfish_cfb_cipher); + } + +static void bf_cfb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + BF_set_key(&(ctx->c.bf_ks),EVP_BLOWFISH_KEY_SIZE,key); + } + +static void bf_cfb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + BF_cfb64_encrypt( + in,out, + (long)inl, &(ctx->c.bf_ks), + &(ctx->iv[0]), + &ctx->num,ctx->encrypt); + } +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_cfb_c.c b/src/lib/libssl/src/crypto/evp/e_cfb_c.c new file mode 100644 index 0000000000..936df55fd8 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_cfb_c.c @@ -0,0 +1,121 @@ +/* crypto/evp/e_cfb_c.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_CAST + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void cast_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void cast_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void cast_cfb_init_key(); +static void cast_cfb_cipher(); +#endif + +static EVP_CIPHER cast5_cfb_cipher= + { + NID_cast5_cfb64, + 1,EVP_CAST5_KEY_SIZE,8, + cast_cfb_init_key, + cast_cfb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_cast5_cfb() + { + return(&cast5_cfb_cipher); + } + +static void cast_cfb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + CAST_set_key(&(ctx->c.cast_ks),EVP_CAST5_KEY_SIZE,key); + } + +static void cast_cfb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + CAST_cfb64_encrypt( + in,out, + (long)inl, &(ctx->c.cast_ks), + &(ctx->iv[0]), + &ctx->num,ctx->encrypt); + } +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_cfb_d.c b/src/lib/libssl/src/crypto/evp/e_cfb_d.c new file mode 100644 index 0000000000..9ae4558f51 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_cfb_d.c @@ -0,0 +1,118 @@ +/* crypto/evp/e_cfb_d.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void des_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void des_cfb_init_key(); +static void des_cfb_cipher(); +#endif + +static EVP_CIPHER d_cfb_cipher= + { + NID_des_cfb64, + 1,8,8, + des_cfb_init_key, + des_cfb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_des_cfb() + { + return(&d_cfb_cipher); + } + +static void des_cfb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + des_set_key((des_cblock *)key,ctx->c.des_ks); + } + +static void des_cfb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + des_cfb64_encrypt( + in,out, + (long)inl, ctx->c.des_ks, + (des_cblock *)&(ctx->iv[0]), + &ctx->num,ctx->encrypt); + } diff --git a/src/lib/libssl/src/crypto/evp/e_cfb_i.c b/src/lib/libssl/src/crypto/evp/e_cfb_i.c new file mode 100644 index 0000000000..9225efaa86 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_cfb_i.c @@ -0,0 +1,121 @@ +/* crypto/evp/e_cfb_i.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_IDEA + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void idea_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void idea_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void idea_cfb_init_key(); +static void idea_cfb_cipher(); +#endif + +static EVP_CIPHER i_cfb_cipher= + { + NID_idea_cfb64, + 1,IDEA_KEY_LENGTH,IDEA_BLOCK, + idea_cfb_init_key, + idea_cfb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_idea_cfb() + { + return(&i_cfb_cipher); + } + +static void idea_cfb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + idea_set_encrypt_key(key,&(ctx->c.idea_ks)); + } + +static void idea_cfb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + idea_cfb64_encrypt( + in,out,(long)inl, + &(ctx->c.idea_ks),&(ctx->iv[0]), + &ctx->num,ctx->encrypt); + } + +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_cfb_r2.c b/src/lib/libssl/src/crypto/evp/e_cfb_r2.c new file mode 100644 index 0000000000..af5a39d1f4 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_cfb_r2.c @@ -0,0 +1,122 @@ +/* crypto/evp/e_cfb_r2.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC2 + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void rc2_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void rc2_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void rc2_cfb_init_key(); +static void rc2_cfb_cipher(); +#endif + +static EVP_CIPHER r2_cfb_cipher= + { + NID_rc2_cfb64, + 1,EVP_RC2_KEY_SIZE,8, + rc2_cfb_init_key, + rc2_cfb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_rc2_cfb() + { + return(&r2_cfb_cipher); + } + +static void rc2_cfb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + RC2_set_key(&(ctx->c.rc2_ks),EVP_RC2_KEY_SIZE,key, + EVP_RC2_KEY_SIZE*8); + } + +static void rc2_cfb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + RC2_cfb64_encrypt( + in,out, + (long)inl, &(ctx->c.rc2_ks), + &(ctx->iv[0]), + &ctx->num,ctx->encrypt); + } +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_cfb_r5.c b/src/lib/libssl/src/crypto/evp/e_cfb_r5.c new file mode 100644 index 0000000000..a2fddaedc0 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_cfb_r5.c @@ -0,0 +1,122 @@ +/* crypto/evp/e_cfb_r5.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC5 + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void rc5_32_12_16_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void rc5_32_12_16_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void rc5_32_12_16_cfb_init_key(); +static void rc5_32_12_16_cfb_cipher(); +#endif + +static EVP_CIPHER rc5_cfb_cipher= + { + NID_rc5_cfb64, + 1,EVP_RC5_32_12_16_KEY_SIZE,8, + rc5_32_12_16_cfb_init_key, + rc5_32_12_16_cfb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_rc5_32_12_16_cfb() + { + return(&rc5_cfb_cipher); + } + +static void rc5_32_12_16_cfb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE,key, + RC5_12_ROUNDS); + } + +static void rc5_32_12_16_cfb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + RC5_32_cfb64_encrypt( + in,out, + (long)inl, &(ctx->c.rc5_ks), + &(ctx->iv[0]), + &ctx->num,ctx->encrypt); + } +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_ecb_3d.c b/src/lib/libssl/src/crypto/evp/e_ecb_3d.c new file mode 100644 index 0000000000..908fc0760a --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_ecb_3d.c @@ -0,0 +1,161 @@ +/* crypto/evp/e_ecb_3d.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void des_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void des_ede_init_key(); +static void des_ede3_init_key(); +static void des_ede_cipher(); +#endif + +static EVP_CIPHER d_ede_cipher2= + { + NID_des_ede, + 8,16,0, + des_ede_init_key, + des_ede_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), + NULL, + NULL, + }; + +static EVP_CIPHER d_ede3_cipher3= + { + NID_des_ede3, + 8,24,0, + des_ede3_init_key, + des_ede_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), + NULL, + }; + +EVP_CIPHER *EVP_des_ede() + { + return(&d_ede_cipher2); + } + +EVP_CIPHER *EVP_des_ede3() + { + return(&d_ede3_cipher3); + } + +static void des_ede_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (key != NULL) + { + des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); + des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + memcpy( (char *)ctx->c.des_ede.ks3, + (char *)ctx->c.des_ede.ks1, + sizeof(ctx->c.des_ede.ks1)); + } + } + +static void des_ede3_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (key != NULL) + { + des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); + des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); + } + } + +static void des_ede_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + unsigned int i; + + if (inl < 8) return; + inl-=8; + for (i=0; i<=inl; i+=8) + { + des_ecb3_encrypt( + (des_cblock *)&(in[i]),(des_cblock *)&(out[i]), + ctx->c.des_ede.ks1, + ctx->c.des_ede.ks2, + ctx->c.des_ede.ks3, + ctx->encrypt); + } + } diff --git a/src/lib/libssl/src/crypto/evp/e_ecb_bf.c b/src/lib/libssl/src/crypto/evp/e_ecb_bf.c new file mode 100644 index 0000000000..142a9d3123 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_ecb_bf.c @@ -0,0 +1,122 @@ +/* crypto/evp/e_ecb_bf.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_BLOWFISH + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void bf_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void bf_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void bf_ecb_init_key(); +static void bf_ecb_cipher(); +#endif + +static EVP_CIPHER bfish_ecb_cipher= + { + NID_bf_ecb, + 8,EVP_BLOWFISH_KEY_SIZE,0, + bf_ecb_init_key, + bf_ecb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), + NULL, + NULL, + }; + +EVP_CIPHER *EVP_bf_ecb() + { + return(&bfish_ecb_cipher); + } + +static void bf_ecb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (key != NULL) + BF_set_key(&(ctx->c.bf_ks),EVP_BLOWFISH_KEY_SIZE,key); + } + +static void bf_ecb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + unsigned int i; + + if (inl < 8) return; + inl-=8; + for (i=0; i<=inl; i+=8) + { + BF_ecb_encrypt( + &(in[i]),&(out[i]), + &(ctx->c.bf_ks),ctx->encrypt); + } + } + +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_ecb_c.c b/src/lib/libssl/src/crypto/evp/e_ecb_c.c new file mode 100644 index 0000000000..34e0c18296 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_ecb_c.c @@ -0,0 +1,122 @@ +/* crypto/evp/e_ecb_c.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_CAST + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void cast_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void cast_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void cast_ecb_init_key(); +static void cast_ecb_cipher(); +#endif + +static EVP_CIPHER cast5_ecb_cipher= + { + NID_cast5_ecb, + 8,EVP_CAST5_KEY_SIZE,0, + cast_ecb_init_key, + cast_ecb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), + NULL, + NULL, + }; + +EVP_CIPHER *EVP_cast5_ecb() + { + return(&cast5_ecb_cipher); + } + +static void cast_ecb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (key != NULL) + CAST_set_key(&(ctx->c.cast_ks),EVP_CAST5_KEY_SIZE,key); + } + +static void cast_ecb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + unsigned int i; + + if (inl < 8) return; + inl-=8; + for (i=0; i<=inl; i+=8) + { + CAST_ecb_encrypt( + &(in[i]),&(out[i]), + &(ctx->c.cast_ks),ctx->encrypt); + } + } + +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_ecb_d.c b/src/lib/libssl/src/crypto/evp/e_ecb_d.c new file mode 100644 index 0000000000..7a409d6459 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_ecb_d.c @@ -0,0 +1,118 @@ +/* crypto/evp/e_ecb_d.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void des_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void des_ecb_init_key(); +static void des_ecb_cipher(); +#endif + +static EVP_CIPHER d_ecb_cipher= + { + NID_des_ecb, + 8,8,0, + des_ecb_init_key, + des_ecb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), + NULL, + NULL, + }; + +EVP_CIPHER *EVP_des_ecb() + { + return(&d_ecb_cipher); + } + +static void des_ecb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (key != NULL) + des_set_key((des_cblock *)key,ctx->c.des_ks); + } + +static void des_ecb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + unsigned int i; + + if (inl < 8) return; + inl-=8; + for (i=0; i<=inl; i+=8) + { + des_ecb_encrypt( + (des_cblock *)&(in[i]),(des_cblock *)&(out[i]), + ctx->c.des_ks,ctx->encrypt); + } + } diff --git a/src/lib/libssl/src/crypto/evp/e_ecb_i.c b/src/lib/libssl/src/crypto/evp/e_ecb_i.c new file mode 100644 index 0000000000..e24022a12c --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_ecb_i.c @@ -0,0 +1,133 @@ +/* crypto/evp/e_ecb_i.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_IDEA + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void idea_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void idea_ecb_init_key(); +static void idea_ecb_cipher(); +#endif + +static EVP_CIPHER i_ecb_cipher= + { + NID_idea_ecb, + 8,16,0, + idea_ecb_init_key, + idea_ecb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), + NULL, + NULL, + }; + +EVP_CIPHER *EVP_idea_ecb() + { + return(&i_ecb_cipher); + } + +static void idea_ecb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (key != NULL) + { + if (enc) + idea_set_encrypt_key(key,&(ctx->c.idea_ks)); + else + { + IDEA_KEY_SCHEDULE tmp; + + idea_set_encrypt_key(key,&tmp); + idea_set_decrypt_key(&tmp, &(ctx->c.idea_ks)); + memset((unsigned char *)&tmp,0, + sizeof(IDEA_KEY_SCHEDULE)); + } + } + } + +static void idea_ecb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + unsigned int i; + + if (inl < 8) return; + inl-=8; + for (i=0; i<=inl; i+=8) + { + idea_ecb_encrypt( + &(in[i]),&(out[i]),&(ctx->c.idea_ks)); + } + } + +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_ecb_r2.c b/src/lib/libssl/src/crypto/evp/e_ecb_r2.c new file mode 100644 index 0000000000..e35b06dc6d --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_ecb_r2.c @@ -0,0 +1,123 @@ +/* crypto/evp/e_ecb_r2.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC2 + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void rc2_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void rc2_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void rc2_ecb_init_key(); +static void rc2_ecb_cipher(); +#endif + +static EVP_CIPHER r2_ecb_cipher= + { + NID_rc2_ecb, + 8,EVP_RC2_KEY_SIZE,0, + rc2_ecb_init_key, + rc2_ecb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), + NULL, + NULL, + }; + +EVP_CIPHER *EVP_rc2_ecb() + { + return(&r2_ecb_cipher); + } + +static void rc2_ecb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (key != NULL) + RC2_set_key(&(ctx->c.rc2_ks),EVP_RC2_KEY_SIZE,key, + EVP_RC2_KEY_SIZE*8); + } + +static void rc2_ecb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + unsigned int i; + + if (inl < 8) return; + inl-=8; + for (i=0; i<=inl; i+=8) + { + RC2_ecb_encrypt( + &(in[i]),&(out[i]), + &(ctx->c.rc2_ks),ctx->encrypt); + } + } + +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_ecb_r5.c b/src/lib/libssl/src/crypto/evp/e_ecb_r5.c new file mode 100644 index 0000000000..08f4a82651 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_ecb_r5.c @@ -0,0 +1,123 @@ +/* crypto/evp/e_ecb_r5.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC5 + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void rc5_32_12_16_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void rc5_32_12_16_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void rc5_32_12_16_ecb_init_key(); +static void rc5_32_12_16_ecb_cipher(); +#endif + +static EVP_CIPHER rc5_ecb_cipher= + { + NID_rc5_ecb, + 8,EVP_RC5_32_12_16_KEY_SIZE,0, + rc5_32_12_16_ecb_init_key, + rc5_32_12_16_ecb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5_ks)), + NULL, + NULL, + }; + +EVP_CIPHER *EVP_rc5_32_12_16_ecb() + { + return(&rc5_ecb_cipher); + } + +static void rc5_32_12_16_ecb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + if (key != NULL) + RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE,key, + RC5_12_ROUNDS); + } + +static void rc5_32_12_16_ecb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + unsigned int i; + + if (inl < 8) return; + inl-=8; + for (i=0; i<=inl; i+=8) + { + RC5_32_ecb_encrypt( + &(in[i]),&(out[i]), + &(ctx->c.rc5_ks),ctx->encrypt); + } + } + +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_ofb_3d.c b/src/lib/libssl/src/crypto/evp/e_ofb_3d.c new file mode 100644 index 0000000000..c3add18e93 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_ofb_3d.c @@ -0,0 +1,165 @@ +/* crypto/evp/e_ofb_3d.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void des_ede_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_ede3_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void des_ede_ofb_init_key(); +static void des_ede3_ofb_init_key(); +static void des_ede_ofb_cipher(); +#endif + +static EVP_CIPHER d_ede_ofb_cipher2= + { + NID_des_ede_ofb64, + 1,16,8, + des_ede_ofb_init_key, + des_ede_ofb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +static EVP_CIPHER d_ede3_ofb_cipher3= + { + NID_des_ede3_ofb64, + 1,24,8, + des_ede3_ofb_init_key, + des_ede_ofb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_des_ede_ofb() + { + return(&d_ede_ofb_cipher2); + } + +EVP_CIPHER *EVP_des_ede3_ofb() + { + return(&d_ede3_ofb_cipher3); + } + +static void des_ede_ofb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + { + des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); + des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + memcpy( (char *)ctx->c.des_ede.ks3, + (char *)ctx->c.des_ede.ks1, + sizeof(ctx->c.des_ede.ks1)); + } + } + +static void des_ede3_ofb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + { + des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); + des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); + } + } + +static void des_ede_ofb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + des_ede3_ofb64_encrypt( + in,out, + (long)inl, + ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, + (des_cblock *)&(ctx->iv[0]), + &ctx->num); + } diff --git a/src/lib/libssl/src/crypto/evp/e_ofb_bf.c b/src/lib/libssl/src/crypto/evp/e_ofb_bf.c new file mode 100644 index 0000000000..492f9b9082 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_ofb_bf.c @@ -0,0 +1,122 @@ +/* crypto/evp/e_ofb_bf.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_BLOWFISH + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void bf_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void bf_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void bf_ofb_init_key(); +static void bf_ofb_cipher(); +#endif + +static EVP_CIPHER bfish_ofb_cipher= + { + NID_bf_ofb64, + 1,EVP_BLOWFISH_KEY_SIZE,8, + bf_ofb_init_key, + bf_ofb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_bf_ofb() + { + return(&bfish_ofb_cipher); + } + +static void bf_ofb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + BF_set_key(&(ctx->c.bf_ks),EVP_BLOWFISH_KEY_SIZE,key); + } + +static void bf_ofb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + BF_ofb64_encrypt( + in,out, + (long)inl, &(ctx->c.bf_ks), + &(ctx->iv[0]), + &ctx->num); + } + +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_ofb_c.c b/src/lib/libssl/src/crypto/evp/e_ofb_c.c new file mode 100644 index 0000000000..f1eef4469c --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_ofb_c.c @@ -0,0 +1,122 @@ +/* crypto/evp/e_ofb_c.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_CAST + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void cast_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void cast_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void cast_ofb_init_key(); +static void cast_ofb_cipher(); +#endif + +static EVP_CIPHER cast5_ofb_cipher= + { + NID_cast5_ofb64, + 1,EVP_CAST5_KEY_SIZE,8, + cast_ofb_init_key, + cast_ofb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_cast5_ofb() + { + return(&cast5_ofb_cipher); + } + +static void cast_ofb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + CAST_set_key(&(ctx->c.cast_ks),EVP_CAST5_KEY_SIZE,key); + } + +static void cast_ofb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + CAST_ofb64_encrypt( + in,out, + (long)inl, &(ctx->c.cast_ks), + &(ctx->iv[0]), + &ctx->num); + } + +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_ofb_d.c b/src/lib/libssl/src/crypto/evp/e_ofb_d.c new file mode 100644 index 0000000000..09d4b4139d --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_ofb_d.c @@ -0,0 +1,118 @@ +/* crypto/evp/e_ofb_d.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void des_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void des_ofb_init_key(); +static void des_ofb_cipher(); +#endif + +static EVP_CIPHER d_ofb_cipher= + { + NID_des_ofb64, + 1,8,8, + des_ofb_init_key, + des_ofb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_des_ofb() + { + return(&d_ofb_cipher); + } + +static void des_ofb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + des_set_key((des_cblock *)key,ctx->c.des_ks); + } + +static void des_ofb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + des_ofb64_encrypt( + in,out, + (long)inl, ctx->c.des_ks, + (des_cblock *)&(ctx->iv[0]), + &ctx->num); + } diff --git a/src/lib/libssl/src/crypto/evp/e_ofb_i.c b/src/lib/libssl/src/crypto/evp/e_ofb_i.c new file mode 100644 index 0000000000..96c8afd9c8 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_ofb_i.c @@ -0,0 +1,121 @@ +/* crypto/evp/e_ofb_i.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_IDEA + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void idea_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void idea_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void idea_ofb_init_key(); +static void idea_ofb_cipher(); +#endif + +static EVP_CIPHER i_ofb_cipher= + { + NID_idea_ofb64, + 1,IDEA_KEY_LENGTH,IDEA_BLOCK, + idea_ofb_init_key, + idea_ofb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_idea_ofb() + { + return(&i_ofb_cipher); + } + +static void idea_ofb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + idea_set_encrypt_key(key,&(ctx->c.idea_ks)); + } + +static void idea_ofb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + idea_ofb64_encrypt( + in,out,(long)inl, + &(ctx->c.idea_ks),&(ctx->iv[0]), + &ctx->num); + } + +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_ofb_r2.c b/src/lib/libssl/src/crypto/evp/e_ofb_r2.c new file mode 100644 index 0000000000..0f6d729988 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_ofb_r2.c @@ -0,0 +1,123 @@ +/* crypto/evp/e_ofb_r2.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC2 + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void rc2_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void rc2_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void rc2_ofb_init_key(); +static void rc2_ofb_cipher(); +#endif + +static EVP_CIPHER r2_ofb_cipher= + { + NID_rc2_ofb64, + 1,EVP_RC2_KEY_SIZE,8, + rc2_ofb_init_key, + rc2_ofb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_rc2_ofb() + { + return(&r2_ofb_cipher); + } + +static void rc2_ofb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + RC2_set_key(&(ctx->c.rc2_ks),EVP_RC2_KEY_SIZE,key, + EVP_RC2_KEY_SIZE*8); + } + +static void rc2_ofb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + RC2_ofb64_encrypt( + in,out, + (long)inl, &(ctx->c.rc2_ks), + &(ctx->iv[0]), + &ctx->num); + } + +#endif diff --git a/src/lib/libssl/src/crypto/evp/e_ofb_r5.c b/src/lib/libssl/src/crypto/evp/e_ofb_r5.c new file mode 100644 index 0000000000..db28d6c317 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_ofb_r5.c @@ -0,0 +1,123 @@ +/* crypto/evp/e_ofb_r5.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC5 + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +#ifndef NOPROTO +static void rc5_32_12_16_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static void rc5_32_12_16_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +#else +static void rc5_32_12_16_ofb_init_key(); +static void rc5_32_12_16_ofb_cipher(); +#endif + +static EVP_CIPHER rc5_ofb_cipher= + { + NID_rc5_ofb64, + 1,EVP_RC5_32_12_16_KEY_SIZE,8, + rc5_32_12_16_ofb_init_key, + rc5_32_12_16_ofb_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5_ks)), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + }; + +EVP_CIPHER *EVP_rc5_32_12_16_ofb() + { + return(&rc5_ofb_cipher); + } + +static void rc5_32_12_16_ofb_init_key(ctx,key,iv,enc) +EVP_CIPHER_CTX *ctx; +unsigned char *key; +unsigned char *iv; +int enc; + { + ctx->num=0; + + if (iv != NULL) + memcpy(&(ctx->oiv[0]),iv,8); + memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); + if (key != NULL) + RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE,key, + RC5_12_ROUNDS); + } + +static void rc5_32_12_16_ofb_cipher(ctx,out,in,inl) +EVP_CIPHER_CTX *ctx; +unsigned char *out; +unsigned char *in; +unsigned int inl; + { + RC5_32_ofb64_encrypt( + in,out, + (long)inl, &(ctx->c.rc5_ks), + &(ctx->iv[0]), + &ctx->num); + } + +#endif diff --git a/src/lib/libssl/src/crypto/evp/evp.err b/src/lib/libssl/src/crypto/evp/evp.err new file mode 100644 index 0000000000..cfc17437bc --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/evp.err @@ -0,0 +1,24 @@ +/* Error codes for the EVP functions. */ + +/* Function codes. */ +#define EVP_F_D2I_PKEY 100 +#define EVP_F_EVP_DECRYPTFINAL 101 +#define EVP_F_EVP_OPENINIT 102 +#define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 +#define EVP_F_EVP_PKEY_DECRYPT 104 +#define EVP_F_EVP_PKEY_ENCRYPT 105 +#define EVP_F_EVP_PKEY_NEW 106 +#define EVP_F_EVP_SIGNFINAL 107 +#define EVP_F_EVP_VERIFYFINAL 108 + +/* Reason codes. */ +#define EVP_R_BAD_DECRYPT 100 +#define EVP_R_DIFFERENT_KEY_TYPES 101 +#define EVP_R_IV_TOO_LARGE 102 +#define EVP_R_MISSING_PARMATERS 103 +#define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104 +#define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 +#define EVP_R_PUBLIC_KEY_NOT_RSA 106 +#define EVP_R_UNSUPPORTED_CIPHER 107 +#define EVP_R_WRONG_FINAL_BLOCK_LENGTH 108 +#define EVP_R_WRONG_PUBLIC_KEY_TYPE 109 diff --git a/src/lib/libssl/src/crypto/evp/pk_lib.c b/src/lib/libssl/src/crypto/evp/pk_lib.c new file mode 100644 index 0000000000..08f9fabbae --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/pk_lib.c @@ -0,0 +1,82 @@ +/* crypto/evp/pk_lib.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" +#include "objects.h" + +static LHASH *pk_md=NULL; + +static LHASH *pk_md=NULL; + +int EVP_add_pkey_md(oid,pkm,md) +int oid; +EVP_PKEY_METHOD *pkm; +EVP_MD *md; + { + } + +EVP_add_pkey(pkm) +EVP_PKEY_METHOD *pkm; + { + } + +EVP_PKEY_METHOD:q + + diff --git a/src/lib/libssl/src/crypto/libvms.com b/src/lib/libssl/src/crypto/libvms.com new file mode 100644 index 0000000000..44f90c65b0 --- /dev/null +++ b/src/lib/libssl/src/crypto/libvms.com @@ -0,0 +1,31 @@ +$! +$! Compile crypto.c as several subset modules and insert in crypto-xxx.olb. +$! If P1 is specifed, it specifies alternate list of subsets to compile. +$! +$ libname = "CRYPTO-AXP.OLB" +$ subset_list = "LIB,ASN1,BN,BUFFER,CONF,DES,DH,DSA,ERROR,EVP,IDEA,LHASH,MD," + - + "METH,OBJECTS,PEM,RAND,RC,RSA,SHA,STACK,TXT_DB,X509" +$ if p1 .nes. "" then subset_list = p1 +$! +$ if f$getsyi("CPU") .lt. 128 then libname = "CRYPTO-VAX.OLB" +$ if f$search(libname) .eqs. "" then library/create/object/log 'libname' +$! +$ cc = "cc/include=[-.include]/prefix=all" + P2 +$! +$ i = 0 +$ next_subset: +$ subset = f$element(i,",",subset_list) +$ if subset .eqs. "," then goto done +$ i = i + 1 +$ create crypto_'subset'.subset +#include "crypto.c" +$ ofile = "sys$disk:[]crypto_" + subset + ".obj" +$ on warning then goto next_subset +$ write sys$output "Compiling ", ofile +$ cc /object='ofile' crypto_'subset'.subset - + /define=(CRYPTO_SUBSET,CRYPTO_'subset'_SUBSET) +$ library/replace/log 'libname'/module=CRYPTO_'subset' 'ofile' +$ goto next_subset +$! +$ done: +$ exit diff --git a/src/lib/libssl/src/crypto/md2/md2.org b/src/lib/libssl/src/crypto/md2/md2.org new file mode 100644 index 0000000000..9f39933790 --- /dev/null +++ b/src/lib/libssl/src/crypto/md2/md2.org @@ -0,0 +1,106 @@ +/* crypto/md/md2.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify md2.org since md2.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + + +#ifndef HEADER_MD2_H +#define HEADER_MD2_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define MD2_DIGEST_LENGTH 16 +#define MD2_BLOCK 16 + +#define MD2_INT unsigned int + +typedef struct MD2state_st + { + int num; + unsigned char data[MD2_BLOCK]; + MD2_INT cksm[MD2_BLOCK]; + MD2_INT state[MD2_BLOCK]; + } MD2_CTX; + +#ifndef NOPROTO +char *MD2_options(void); +void MD2_Init(MD2_CTX *c); +void MD2_Update(MD2_CTX *c, register unsigned char *data, unsigned long len); +void MD2_Final(unsigned char *md, MD2_CTX *c); +unsigned char *MD2(unsigned char *d, unsigned long n,unsigned char *md); +#else +char *MD2_options(); +void MD2_Init(); +void MD2_Update(); +void MD2_Final(); +unsigned char *MD2(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/lib/libssl/src/crypto/md5/Makefile.uni b/src/lib/libssl/src/crypto/md5/Makefile.uni new file mode 100644 index 0000000000..54685712db --- /dev/null +++ b/src/lib/libssl/src/crypto/md5/Makefile.uni @@ -0,0 +1,109 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +DIR= md5 +TOP= . +CC= gcc +CFLAG= -O3 -fomit-frame-pointer + +CPP= $(CC) -E +INCLUDES= +INSTALLTOP=/usr/local/lib +MAKE= make +MAKEDEPEND= makedepend +MAKEFILE= Makefile.uni +AR= ar r + +MD5_ASM_OBJ= + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile +TEST=md5test +APPS=md5 + +LIB=libmd5.a +LIBSRC=md5_dgst.c md5_one.c +LIBOBJ=md5_dgst.o md5_one.o $(MD5_ASM_OBJ) + +SRC= $(LIBSRC) + +EXHEADER= md5.h +HEADER= md5_locl.h $(EXHEADER) + +ALL= $(GENERAL) $(SRC) $(HEADER) + +all: $(LIB) $(TEST) $(APPS) + +$(LIB): $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) + sh $(TOP)/ranlib.sh $(LIB) + +# elf +asm/mx86-elf.o: asm/mx86unix.cpp + $(CPP) -DELF asm/mx86unix.cpp | as -o asm/mx86-elf.o + +# solaris +asm/mx86-sol.o: asm/mx86unix.cpp + $(CC) -E -DSOL asm/mx86unix.cpp | sed 's/^#.*//' > asm/mx86-sol.s + as -o asm/mx86-sol.o asm/mx86-sol.s + rm -f asm/mx86-sol.s + +# a.out +asm/mx86-out.o: asm/mx86unix.cpp + $(CPP) -DOUT asm/mx86unix.cpp | as -o asm/mx86-out.o + +# bsdi +asm/mx86bsdi.o: asm/mx86unix.cpp + $(CPP) -DBSDI asm/mx86unix.cpp | as -o asm/mx86bsdi.o + +asm/mx86unix.cpp: + (cd asm; perl md5-586.pl cpp >mx86unix.cpp) + +test: $(TEST) + ./$(TEST) + +$(TEST): $(TEST).c $(LIB) + $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) + +$(APPS): $(APPS).c $(LIB) + $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + +dclean: + perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff + +cc: + $(MAKE) MD5_ASM_OBJ="" CC="cc" CFLAG="-O" all + +gcc: + $(MAKE) MD5_ASM_OBJ="" CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all + +x86-elf: + $(MAKE) MD5_ASM_OBJ="asm/mx86-elf.o" CFLAG="-DELF -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-out: + $(MAKE) MD5_ASM_OBJ="asm/mx86-out.o" CFLAG="-DOUT -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-solaris: + $(MAKE) MD5_ASM_OBJ="asm/mx86-sol.o" CFLAG="-DSOL -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-bdsi: + $(MAKE) MD5_ASM_OBJ="asm/mx86-bdsi.o" CFLAG="-DBDSI -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libssl/src/crypto/md5/asm/m5-win32.asm b/src/lib/libssl/src/crypto/md5/asm/m5-win32.asm new file mode 100644 index 0000000000..c2081da746 --- /dev/null +++ b/src/lib/libssl/src/crypto/md5/asm/m5-win32.asm @@ -0,0 +1,686 @@ + ; Don't even think of reading this code + ; It was automatically generated by md5-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE md5-586.asm + .386 +.model FLAT +_TEXT SEGMENT +PUBLIC _md5_block_x86 + +_md5_block_x86 PROC NEAR + push esi + push edi + mov edi, DWORD PTR 12[esp] + mov esi, DWORD PTR 16[esp] + mov ecx, DWORD PTR 20[esp] + push ebp + push ebx + add ecx, esi + sub ecx, 64 + mov eax, DWORD PTR [edi] + push ecx + mov ebx, DWORD PTR 4[edi] + mov ecx, DWORD PTR 8[edi] + mov edx, DWORD PTR 12[edi] +L000start: + ; + ; R0 section + mov edi, ecx + mov ebp, DWORD PTR [esi] + ; R0 0 + xor edi, edx + and edi, ebx + lea eax, DWORD PTR 3614090360[ebp*1+eax] + mov ebp, DWORD PTR 4[esi] + xor edi, edx + add eax, edi + mov edi, ebx + rol eax, 7 + add eax, ebx + ; R0 1 + xor edi, ecx + and edi, eax + lea edx, DWORD PTR 3905402710[ebp*1+edx] + mov ebp, DWORD PTR 8[esi] + xor edi, ecx + add edx, edi + mov edi, eax + rol edx, 12 + add edx, eax + ; R0 2 + xor edi, ebx + and edi, edx + lea ecx, DWORD PTR 606105819[ebp*1+ecx] + mov ebp, DWORD PTR 12[esi] + xor edi, ebx + add ecx, edi + mov edi, edx + rol ecx, 17 + add ecx, edx + ; R0 3 + xor edi, eax + and edi, ecx + lea ebx, DWORD PTR 3250441966[ebp*1+ebx] + mov ebp, DWORD PTR 16[esi] + xor edi, eax + add ebx, edi + mov edi, ecx + rol ebx, 22 + add ebx, ecx + ; R0 4 + xor edi, edx + and edi, ebx + lea eax, DWORD PTR 4118548399[ebp*1+eax] + mov ebp, DWORD PTR 20[esi] + xor edi, edx + add eax, edi + mov edi, ebx + rol eax, 7 + add eax, ebx + ; R0 5 + xor edi, ecx + and edi, eax + lea edx, DWORD PTR 1200080426[ebp*1+edx] + mov ebp, DWORD PTR 24[esi] + xor edi, ecx + add edx, edi + mov edi, eax + rol edx, 12 + add edx, eax + ; R0 6 + xor edi, ebx + and edi, edx + lea ecx, DWORD PTR 2821735955[ebp*1+ecx] + mov ebp, DWORD PTR 28[esi] + xor edi, ebx + add ecx, edi + mov edi, edx + rol ecx, 17 + add ecx, edx + ; R0 7 + xor edi, eax + and edi, ecx + lea ebx, DWORD PTR 4249261313[ebp*1+ebx] + mov ebp, DWORD PTR 32[esi] + xor edi, eax + add ebx, edi + mov edi, ecx + rol ebx, 22 + add ebx, ecx + ; R0 8 + xor edi, edx + and edi, ebx + lea eax, DWORD PTR 1770035416[ebp*1+eax] + mov ebp, DWORD PTR 36[esi] + xor edi, edx + add eax, edi + mov edi, ebx + rol eax, 7 + add eax, ebx + ; R0 9 + xor edi, ecx + and edi, eax + lea edx, DWORD PTR 2336552879[ebp*1+edx] + mov ebp, DWORD PTR 40[esi] + xor edi, ecx + add edx, edi + mov edi, eax + rol edx, 12 + add edx, eax + ; R0 10 + xor edi, ebx + and edi, edx + lea ecx, DWORD PTR 4294925233[ebp*1+ecx] + mov ebp, DWORD PTR 44[esi] + xor edi, ebx + add ecx, edi + mov edi, edx + rol ecx, 17 + add ecx, edx + ; R0 11 + xor edi, eax + and edi, ecx + lea ebx, DWORD PTR 2304563134[ebp*1+ebx] + mov ebp, DWORD PTR 48[esi] + xor edi, eax + add ebx, edi + mov edi, ecx + rol ebx, 22 + add ebx, ecx + ; R0 12 + xor edi, edx + and edi, ebx + lea eax, DWORD PTR 1804603682[ebp*1+eax] + mov ebp, DWORD PTR 52[esi] + xor edi, edx + add eax, edi + mov edi, ebx + rol eax, 7 + add eax, ebx + ; R0 13 + xor edi, ecx + and edi, eax + lea edx, DWORD PTR 4254626195[ebp*1+edx] + mov ebp, DWORD PTR 56[esi] + xor edi, ecx + add edx, edi + mov edi, eax + rol edx, 12 + add edx, eax + ; R0 14 + xor edi, ebx + and edi, edx + lea ecx, DWORD PTR 2792965006[ebp*1+ecx] + mov ebp, DWORD PTR 60[esi] + xor edi, ebx + add ecx, edi + mov edi, edx + rol ecx, 17 + add ecx, edx + ; R0 15 + xor edi, eax + and edi, ecx + lea ebx, DWORD PTR 1236535329[ebp*1+ebx] + mov ebp, DWORD PTR 4[esi] + xor edi, eax + add ebx, edi + mov edi, ecx + rol ebx, 22 + add ebx, ecx + ; + ; R1 section + ; R1 16 + lea eax, DWORD PTR 4129170786[ebp*1+eax] + xor edi, ebx + and edi, edx + mov ebp, DWORD PTR 24[esi] + xor edi, ecx + add eax, edi + mov edi, ebx + rol eax, 5 + add eax, ebx + ; R1 17 + lea edx, DWORD PTR 3225465664[ebp*1+edx] + xor edi, eax + and edi, ecx + mov ebp, DWORD PTR 44[esi] + xor edi, ebx + add edx, edi + mov edi, eax + rol edx, 9 + add edx, eax + ; R1 18 + lea ecx, DWORD PTR 643717713[ebp*1+ecx] + xor edi, edx + and edi, ebx + mov ebp, DWORD PTR [esi] + xor edi, eax + add ecx, edi + mov edi, edx + rol ecx, 14 + add ecx, edx + ; R1 19 + lea ebx, DWORD PTR 3921069994[ebp*1+ebx] + xor edi, ecx + and edi, eax + mov ebp, DWORD PTR 20[esi] + xor edi, edx + add ebx, edi + mov edi, ecx + rol ebx, 20 + add ebx, ecx + ; R1 20 + lea eax, DWORD PTR 3593408605[ebp*1+eax] + xor edi, ebx + and edi, edx + mov ebp, DWORD PTR 40[esi] + xor edi, ecx + add eax, edi + mov edi, ebx + rol eax, 5 + add eax, ebx + ; R1 21 + lea edx, DWORD PTR 38016083[ebp*1+edx] + xor edi, eax + and edi, ecx + mov ebp, DWORD PTR 60[esi] + xor edi, ebx + add edx, edi + mov edi, eax + rol edx, 9 + add edx, eax + ; R1 22 + lea ecx, DWORD PTR 3634488961[ebp*1+ecx] + xor edi, edx + and edi, ebx + mov ebp, DWORD PTR 16[esi] + xor edi, eax + add ecx, edi + mov edi, edx + rol ecx, 14 + add ecx, edx + ; R1 23 + lea ebx, DWORD PTR 3889429448[ebp*1+ebx] + xor edi, ecx + and edi, eax + mov ebp, DWORD PTR 36[esi] + xor edi, edx + add ebx, edi + mov edi, ecx + rol ebx, 20 + add ebx, ecx + ; R1 24 + lea eax, DWORD PTR 568446438[ebp*1+eax] + xor edi, ebx + and edi, edx + mov ebp, DWORD PTR 56[esi] + xor edi, ecx + add eax, edi + mov edi, ebx + rol eax, 5 + add eax, ebx + ; R1 25 + lea edx, DWORD PTR 3275163606[ebp*1+edx] + xor edi, eax + and edi, ecx + mov ebp, DWORD PTR 12[esi] + xor edi, ebx + add edx, edi + mov edi, eax + rol edx, 9 + add edx, eax + ; R1 26 + lea ecx, DWORD PTR 4107603335[ebp*1+ecx] + xor edi, edx + and edi, ebx + mov ebp, DWORD PTR 32[esi] + xor edi, eax + add ecx, edi + mov edi, edx + rol ecx, 14 + add ecx, edx + ; R1 27 + lea ebx, DWORD PTR 1163531501[ebp*1+ebx] + xor edi, ecx + and edi, eax + mov ebp, DWORD PTR 52[esi] + xor edi, edx + add ebx, edi + mov edi, ecx + rol ebx, 20 + add ebx, ecx + ; R1 28 + lea eax, DWORD PTR 2850285829[ebp*1+eax] + xor edi, ebx + and edi, edx + mov ebp, DWORD PTR 8[esi] + xor edi, ecx + add eax, edi + mov edi, ebx + rol eax, 5 + add eax, ebx + ; R1 29 + lea edx, DWORD PTR 4243563512[ebp*1+edx] + xor edi, eax + and edi, ecx + mov ebp, DWORD PTR 28[esi] + xor edi, ebx + add edx, edi + mov edi, eax + rol edx, 9 + add edx, eax + ; R1 30 + lea ecx, DWORD PTR 1735328473[ebp*1+ecx] + xor edi, edx + and edi, ebx + mov ebp, DWORD PTR 48[esi] + xor edi, eax + add ecx, edi + mov edi, edx + rol ecx, 14 + add ecx, edx + ; R1 31 + lea ebx, DWORD PTR 2368359562[ebp*1+ebx] + xor edi, ecx + and edi, eax + mov ebp, DWORD PTR 20[esi] + xor edi, edx + add ebx, edi + mov edi, ecx + rol ebx, 20 + add ebx, ecx + ; + ; R2 section + ; R2 32 + xor edi, edx + xor edi, ebx + lea eax, DWORD PTR 4294588738[ebp*1+eax] + add eax, edi + mov ebp, DWORD PTR 32[esi] + rol eax, 4 + mov edi, ebx + ; R2 33 + lea edx, DWORD PTR 2272392833[ebp*1+edx] + add eax, ebx + xor edi, ecx + xor edi, eax + mov ebp, DWORD PTR 44[esi] + add edx, edi + mov edi, eax + rol edx, 11 + add edx, eax + ; R2 34 + xor edi, ebx + xor edi, edx + lea ecx, DWORD PTR 1839030562[ebp*1+ecx] + add ecx, edi + mov ebp, DWORD PTR 56[esi] + rol ecx, 16 + mov edi, edx + ; R2 35 + lea ebx, DWORD PTR 4259657740[ebp*1+ebx] + add ecx, edx + xor edi, eax + xor edi, ecx + mov ebp, DWORD PTR 4[esi] + add ebx, edi + mov edi, ecx + rol ebx, 23 + add ebx, ecx + ; R2 36 + xor edi, edx + xor edi, ebx + lea eax, DWORD PTR 2763975236[ebp*1+eax] + add eax, edi + mov ebp, DWORD PTR 16[esi] + rol eax, 4 + mov edi, ebx + ; R2 37 + lea edx, DWORD PTR 1272893353[ebp*1+edx] + add eax, ebx + xor edi, ecx + xor edi, eax + mov ebp, DWORD PTR 28[esi] + add edx, edi + mov edi, eax + rol edx, 11 + add edx, eax + ; R2 38 + xor edi, ebx + xor edi, edx + lea ecx, DWORD PTR 4139469664[ebp*1+ecx] + add ecx, edi + mov ebp, DWORD PTR 40[esi] + rol ecx, 16 + mov edi, edx + ; R2 39 + lea ebx, DWORD PTR 3200236656[ebp*1+ebx] + add ecx, edx + xor edi, eax + xor edi, ecx + mov ebp, DWORD PTR 52[esi] + add ebx, edi + mov edi, ecx + rol ebx, 23 + add ebx, ecx + ; R2 40 + xor edi, edx + xor edi, ebx + lea eax, DWORD PTR 681279174[ebp*1+eax] + add eax, edi + mov ebp, DWORD PTR [esi] + rol eax, 4 + mov edi, ebx + ; R2 41 + lea edx, DWORD PTR 3936430074[ebp*1+edx] + add eax, ebx + xor edi, ecx + xor edi, eax + mov ebp, DWORD PTR 12[esi] + add edx, edi + mov edi, eax + rol edx, 11 + add edx, eax + ; R2 42 + xor edi, ebx + xor edi, edx + lea ecx, DWORD PTR 3572445317[ebp*1+ecx] + add ecx, edi + mov ebp, DWORD PTR 24[esi] + rol ecx, 16 + mov edi, edx + ; R2 43 + lea ebx, DWORD PTR 76029189[ebp*1+ebx] + add ecx, edx + xor edi, eax + xor edi, ecx + mov ebp, DWORD PTR 36[esi] + add ebx, edi + mov edi, ecx + rol ebx, 23 + add ebx, ecx + ; R2 44 + xor edi, edx + xor edi, ebx + lea eax, DWORD PTR 3654602809[ebp*1+eax] + add eax, edi + mov ebp, DWORD PTR 48[esi] + rol eax, 4 + mov edi, ebx + ; R2 45 + lea edx, DWORD PTR 3873151461[ebp*1+edx] + add eax, ebx + xor edi, ecx + xor edi, eax + mov ebp, DWORD PTR 60[esi] + add edx, edi + mov edi, eax + rol edx, 11 + add edx, eax + ; R2 46 + xor edi, ebx + xor edi, edx + lea ecx, DWORD PTR 530742520[ebp*1+ecx] + add ecx, edi + mov ebp, DWORD PTR 8[esi] + rol ecx, 16 + mov edi, edx + ; R2 47 + lea ebx, DWORD PTR 3299628645[ebp*1+ebx] + add ecx, edx + xor edi, eax + xor edi, ecx + mov ebp, DWORD PTR [esi] + add ebx, edi + mov edi, -1 + rol ebx, 23 + add ebx, ecx + ; + ; R3 section + ; R3 48 + xor edi, edx + or edi, ebx + lea eax, DWORD PTR 4096336452[ebp*1+eax] + xor edi, ecx + mov ebp, DWORD PTR 28[esi] + add eax, edi + mov edi, -1 + rol eax, 6 + xor edi, ecx + add eax, ebx + ; R3 49 + or edi, eax + lea edx, DWORD PTR 1126891415[ebp*1+edx] + xor edi, ebx + mov ebp, DWORD PTR 56[esi] + add edx, edi + mov edi, -1 + rol edx, 10 + xor edi, ebx + add edx, eax + ; R3 50 + or edi, edx + lea ecx, DWORD PTR 2878612391[ebp*1+ecx] + xor edi, eax + mov ebp, DWORD PTR 20[esi] + add ecx, edi + mov edi, -1 + rol ecx, 15 + xor edi, eax + add ecx, edx + ; R3 51 + or edi, ecx + lea ebx, DWORD PTR 4237533241[ebp*1+ebx] + xor edi, edx + mov ebp, DWORD PTR 48[esi] + add ebx, edi + mov edi, -1 + rol ebx, 21 + xor edi, edx + add ebx, ecx + ; R3 52 + or edi, ebx + lea eax, DWORD PTR 1700485571[ebp*1+eax] + xor edi, ecx + mov ebp, DWORD PTR 12[esi] + add eax, edi + mov edi, -1 + rol eax, 6 + xor edi, ecx + add eax, ebx + ; R3 53 + or edi, eax + lea edx, DWORD PTR 2399980690[ebp*1+edx] + xor edi, ebx + mov ebp, DWORD PTR 40[esi] + add edx, edi + mov edi, -1 + rol edx, 10 + xor edi, ebx + add edx, eax + ; R3 54 + or edi, edx + lea ecx, DWORD PTR 4293915773[ebp*1+ecx] + xor edi, eax + mov ebp, DWORD PTR 4[esi] + add ecx, edi + mov edi, -1 + rol ecx, 15 + xor edi, eax + add ecx, edx + ; R3 55 + or edi, ecx + lea ebx, DWORD PTR 2240044497[ebp*1+ebx] + xor edi, edx + mov ebp, DWORD PTR 32[esi] + add ebx, edi + mov edi, -1 + rol ebx, 21 + xor edi, edx + add ebx, ecx + ; R3 56 + or edi, ebx + lea eax, DWORD PTR 1873313359[ebp*1+eax] + xor edi, ecx + mov ebp, DWORD PTR 60[esi] + add eax, edi + mov edi, -1 + rol eax, 6 + xor edi, ecx + add eax, ebx + ; R3 57 + or edi, eax + lea edx, DWORD PTR 4264355552[ebp*1+edx] + xor edi, ebx + mov ebp, DWORD PTR 24[esi] + add edx, edi + mov edi, -1 + rol edx, 10 + xor edi, ebx + add edx, eax + ; R3 58 + or edi, edx + lea ecx, DWORD PTR 2734768916[ebp*1+ecx] + xor edi, eax + mov ebp, DWORD PTR 52[esi] + add ecx, edi + mov edi, -1 + rol ecx, 15 + xor edi, eax + add ecx, edx + ; R3 59 + or edi, ecx + lea ebx, DWORD PTR 1309151649[ebp*1+ebx] + xor edi, edx + mov ebp, DWORD PTR 16[esi] + add ebx, edi + mov edi, -1 + rol ebx, 21 + xor edi, edx + add ebx, ecx + ; R3 60 + or edi, ebx + lea eax, DWORD PTR 4149444226[ebp*1+eax] + xor edi, ecx + mov ebp, DWORD PTR 44[esi] + add eax, edi + mov edi, -1 + rol eax, 6 + xor edi, ecx + add eax, ebx + ; R3 61 + or edi, eax + lea edx, DWORD PTR 3174756917[ebp*1+edx] + xor edi, ebx + mov ebp, DWORD PTR 8[esi] + add edx, edi + mov edi, -1 + rol edx, 10 + xor edi, ebx + add edx, eax + ; R3 62 + or edi, edx + lea ecx, DWORD PTR 718787259[ebp*1+ecx] + xor edi, eax + mov ebp, DWORD PTR 36[esi] + add ecx, edi + mov edi, -1 + rol ecx, 15 + xor edi, eax + add ecx, edx + ; R3 63 + or edi, ecx + lea ebx, DWORD PTR 3951481745[ebp*1+ebx] + xor edi, edx + mov ebp, DWORD PTR 24[esp] + add ebx, edi + add esi, 64 + rol ebx, 21 + mov edi, DWORD PTR [ebp] + add ebx, ecx + add eax, edi + mov edi, DWORD PTR 4[ebp] + add ebx, edi + mov edi, DWORD PTR 8[ebp] + add ecx, edi + mov edi, DWORD PTR 12[ebp] + add edx, edi + mov DWORD PTR [ebp],eax + mov DWORD PTR 4[ebp],ebx + mov edi, DWORD PTR [esp] + mov DWORD PTR 8[ebp],ecx + mov DWORD PTR 12[ebp],edx + cmp edi, esi + jge L000start + pop eax + pop ebx + pop ebp + pop edi + pop esi + ret +_md5_block_x86 ENDP +_TEXT ENDS +END diff --git a/src/lib/libssl/src/crypto/md5/asm/mx86unix.cpp b/src/lib/libssl/src/crypto/md5/asm/mx86unix.cpp new file mode 100644 index 0000000000..5d399122b6 --- /dev/null +++ b/src/lib/libssl/src/crypto/md5/asm/mx86unix.cpp @@ -0,0 +1,730 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define md5_block_x86 _md5_block_x86 + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by md5-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "md5-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl md5_block_x86 + TYPE(md5_block_x86,@function) +md5_block_x86: + pushl %esi + pushl %edi + movl 12(%esp), %edi + movl 16(%esp), %esi + movl 20(%esp), %ecx + pushl %ebp + pushl %ebx + addl %esi, %ecx + subl $64, %ecx + movl (%edi), %eax + pushl %ecx + movl 4(%edi), %ebx + movl 8(%edi), %ecx + movl 12(%edi), %edx +.L000start: + + /* R0 section */ + movl %ecx, %edi + movl (%esi), %ebp + /* R0 0 */ + xorl %edx, %edi + andl %ebx, %edi + leal 3614090360(%eax,%ebp,1),%eax + movl 4(%esi), %ebp + xorl %edx, %edi + addl %edi, %eax + movl %ebx, %edi + roll $7, %eax + addl %ebx, %eax + /* R0 1 */ + xorl %ecx, %edi + andl %eax, %edi + leal 3905402710(%edx,%ebp,1),%edx + movl 8(%esi), %ebp + xorl %ecx, %edi + addl %edi, %edx + movl %eax, %edi + roll $12, %edx + addl %eax, %edx + /* R0 2 */ + xorl %ebx, %edi + andl %edx, %edi + leal 606105819(%ecx,%ebp,1),%ecx + movl 12(%esi), %ebp + xorl %ebx, %edi + addl %edi, %ecx + movl %edx, %edi + roll $17, %ecx + addl %edx, %ecx + /* R0 3 */ + xorl %eax, %edi + andl %ecx, %edi + leal 3250441966(%ebx,%ebp,1),%ebx + movl 16(%esi), %ebp + xorl %eax, %edi + addl %edi, %ebx + movl %ecx, %edi + roll $22, %ebx + addl %ecx, %ebx + /* R0 4 */ + xorl %edx, %edi + andl %ebx, %edi + leal 4118548399(%eax,%ebp,1),%eax + movl 20(%esi), %ebp + xorl %edx, %edi + addl %edi, %eax + movl %ebx, %edi + roll $7, %eax + addl %ebx, %eax + /* R0 5 */ + xorl %ecx, %edi + andl %eax, %edi + leal 1200080426(%edx,%ebp,1),%edx + movl 24(%esi), %ebp + xorl %ecx, %edi + addl %edi, %edx + movl %eax, %edi + roll $12, %edx + addl %eax, %edx + /* R0 6 */ + xorl %ebx, %edi + andl %edx, %edi + leal 2821735955(%ecx,%ebp,1),%ecx + movl 28(%esi), %ebp + xorl %ebx, %edi + addl %edi, %ecx + movl %edx, %edi + roll $17, %ecx + addl %edx, %ecx + /* R0 7 */ + xorl %eax, %edi + andl %ecx, %edi + leal 4249261313(%ebx,%ebp,1),%ebx + movl 32(%esi), %ebp + xorl %eax, %edi + addl %edi, %ebx + movl %ecx, %edi + roll $22, %ebx + addl %ecx, %ebx + /* R0 8 */ + xorl %edx, %edi + andl %ebx, %edi + leal 1770035416(%eax,%ebp,1),%eax + movl 36(%esi), %ebp + xorl %edx, %edi + addl %edi, %eax + movl %ebx, %edi + roll $7, %eax + addl %ebx, %eax + /* R0 9 */ + xorl %ecx, %edi + andl %eax, %edi + leal 2336552879(%edx,%ebp,1),%edx + movl 40(%esi), %ebp + xorl %ecx, %edi + addl %edi, %edx + movl %eax, %edi + roll $12, %edx + addl %eax, %edx + /* R0 10 */ + xorl %ebx, %edi + andl %edx, %edi + leal 4294925233(%ecx,%ebp,1),%ecx + movl 44(%esi), %ebp + xorl %ebx, %edi + addl %edi, %ecx + movl %edx, %edi + roll $17, %ecx + addl %edx, %ecx + /* R0 11 */ + xorl %eax, %edi + andl %ecx, %edi + leal 2304563134(%ebx,%ebp,1),%ebx + movl 48(%esi), %ebp + xorl %eax, %edi + addl %edi, %ebx + movl %ecx, %edi + roll $22, %ebx + addl %ecx, %ebx + /* R0 12 */ + xorl %edx, %edi + andl %ebx, %edi + leal 1804603682(%eax,%ebp,1),%eax + movl 52(%esi), %ebp + xorl %edx, %edi + addl %edi, %eax + movl %ebx, %edi + roll $7, %eax + addl %ebx, %eax + /* R0 13 */ + xorl %ecx, %edi + andl %eax, %edi + leal 4254626195(%edx,%ebp,1),%edx + movl 56(%esi), %ebp + xorl %ecx, %edi + addl %edi, %edx + movl %eax, %edi + roll $12, %edx + addl %eax, %edx + /* R0 14 */ + xorl %ebx, %edi + andl %edx, %edi + leal 2792965006(%ecx,%ebp,1),%ecx + movl 60(%esi), %ebp + xorl %ebx, %edi + addl %edi, %ecx + movl %edx, %edi + roll $17, %ecx + addl %edx, %ecx + /* R0 15 */ + xorl %eax, %edi + andl %ecx, %edi + leal 1236535329(%ebx,%ebp,1),%ebx + movl 4(%esi), %ebp + xorl %eax, %edi + addl %edi, %ebx + movl %ecx, %edi + roll $22, %ebx + addl %ecx, %ebx + + /* R1 section */ + /* R1 16 */ + leal 4129170786(%eax,%ebp,1),%eax + xorl %ebx, %edi + andl %edx, %edi + movl 24(%esi), %ebp + xorl %ecx, %edi + addl %edi, %eax + movl %ebx, %edi + roll $5, %eax + addl %ebx, %eax + /* R1 17 */ + leal 3225465664(%edx,%ebp,1),%edx + xorl %eax, %edi + andl %ecx, %edi + movl 44(%esi), %ebp + xorl %ebx, %edi + addl %edi, %edx + movl %eax, %edi + roll $9, %edx + addl %eax, %edx + /* R1 18 */ + leal 643717713(%ecx,%ebp,1),%ecx + xorl %edx, %edi + andl %ebx, %edi + movl (%esi), %ebp + xorl %eax, %edi + addl %edi, %ecx + movl %edx, %edi + roll $14, %ecx + addl %edx, %ecx + /* R1 19 */ + leal 3921069994(%ebx,%ebp,1),%ebx + xorl %ecx, %edi + andl %eax, %edi + movl 20(%esi), %ebp + xorl %edx, %edi + addl %edi, %ebx + movl %ecx, %edi + roll $20, %ebx + addl %ecx, %ebx + /* R1 20 */ + leal 3593408605(%eax,%ebp,1),%eax + xorl %ebx, %edi + andl %edx, %edi + movl 40(%esi), %ebp + xorl %ecx, %edi + addl %edi, %eax + movl %ebx, %edi + roll $5, %eax + addl %ebx, %eax + /* R1 21 */ + leal 38016083(%edx,%ebp,1),%edx + xorl %eax, %edi + andl %ecx, %edi + movl 60(%esi), %ebp + xorl %ebx, %edi + addl %edi, %edx + movl %eax, %edi + roll $9, %edx + addl %eax, %edx + /* R1 22 */ + leal 3634488961(%ecx,%ebp,1),%ecx + xorl %edx, %edi + andl %ebx, %edi + movl 16(%esi), %ebp + xorl %eax, %edi + addl %edi, %ecx + movl %edx, %edi + roll $14, %ecx + addl %edx, %ecx + /* R1 23 */ + leal 3889429448(%ebx,%ebp,1),%ebx + xorl %ecx, %edi + andl %eax, %edi + movl 36(%esi), %ebp + xorl %edx, %edi + addl %edi, %ebx + movl %ecx, %edi + roll $20, %ebx + addl %ecx, %ebx + /* R1 24 */ + leal 568446438(%eax,%ebp,1),%eax + xorl %ebx, %edi + andl %edx, %edi + movl 56(%esi), %ebp + xorl %ecx, %edi + addl %edi, %eax + movl %ebx, %edi + roll $5, %eax + addl %ebx, %eax + /* R1 25 */ + leal 3275163606(%edx,%ebp,1),%edx + xorl %eax, %edi + andl %ecx, %edi + movl 12(%esi), %ebp + xorl %ebx, %edi + addl %edi, %edx + movl %eax, %edi + roll $9, %edx + addl %eax, %edx + /* R1 26 */ + leal 4107603335(%ecx,%ebp,1),%ecx + xorl %edx, %edi + andl %ebx, %edi + movl 32(%esi), %ebp + xorl %eax, %edi + addl %edi, %ecx + movl %edx, %edi + roll $14, %ecx + addl %edx, %ecx + /* R1 27 */ + leal 1163531501(%ebx,%ebp,1),%ebx + xorl %ecx, %edi + andl %eax, %edi + movl 52(%esi), %ebp + xorl %edx, %edi + addl %edi, %ebx + movl %ecx, %edi + roll $20, %ebx + addl %ecx, %ebx + /* R1 28 */ + leal 2850285829(%eax,%ebp,1),%eax + xorl %ebx, %edi + andl %edx, %edi + movl 8(%esi), %ebp + xorl %ecx, %edi + addl %edi, %eax + movl %ebx, %edi + roll $5, %eax + addl %ebx, %eax + /* R1 29 */ + leal 4243563512(%edx,%ebp,1),%edx + xorl %eax, %edi + andl %ecx, %edi + movl 28(%esi), %ebp + xorl %ebx, %edi + addl %edi, %edx + movl %eax, %edi + roll $9, %edx + addl %eax, %edx + /* R1 30 */ + leal 1735328473(%ecx,%ebp,1),%ecx + xorl %edx, %edi + andl %ebx, %edi + movl 48(%esi), %ebp + xorl %eax, %edi + addl %edi, %ecx + movl %edx, %edi + roll $14, %ecx + addl %edx, %ecx + /* R1 31 */ + leal 2368359562(%ebx,%ebp,1),%ebx + xorl %ecx, %edi + andl %eax, %edi + movl 20(%esi), %ebp + xorl %edx, %edi + addl %edi, %ebx + movl %ecx, %edi + roll $20, %ebx + addl %ecx, %ebx + + /* R2 section */ + /* R2 32 */ + xorl %edx, %edi + xorl %ebx, %edi + leal 4294588738(%eax,%ebp,1),%eax + addl %edi, %eax + movl 32(%esi), %ebp + roll $4, %eax + movl %ebx, %edi + /* R2 33 */ + leal 2272392833(%edx,%ebp,1),%edx + addl %ebx, %eax + xorl %ecx, %edi + xorl %eax, %edi + movl 44(%esi), %ebp + addl %edi, %edx + movl %eax, %edi + roll $11, %edx + addl %eax, %edx + /* R2 34 */ + xorl %ebx, %edi + xorl %edx, %edi + leal 1839030562(%ecx,%ebp,1),%ecx + addl %edi, %ecx + movl 56(%esi), %ebp + roll $16, %ecx + movl %edx, %edi + /* R2 35 */ + leal 4259657740(%ebx,%ebp,1),%ebx + addl %edx, %ecx + xorl %eax, %edi + xorl %ecx, %edi + movl 4(%esi), %ebp + addl %edi, %ebx + movl %ecx, %edi + roll $23, %ebx + addl %ecx, %ebx + /* R2 36 */ + xorl %edx, %edi + xorl %ebx, %edi + leal 2763975236(%eax,%ebp,1),%eax + addl %edi, %eax + movl 16(%esi), %ebp + roll $4, %eax + movl %ebx, %edi + /* R2 37 */ + leal 1272893353(%edx,%ebp,1),%edx + addl %ebx, %eax + xorl %ecx, %edi + xorl %eax, %edi + movl 28(%esi), %ebp + addl %edi, %edx + movl %eax, %edi + roll $11, %edx + addl %eax, %edx + /* R2 38 */ + xorl %ebx, %edi + xorl %edx, %edi + leal 4139469664(%ecx,%ebp,1),%ecx + addl %edi, %ecx + movl 40(%esi), %ebp + roll $16, %ecx + movl %edx, %edi + /* R2 39 */ + leal 3200236656(%ebx,%ebp,1),%ebx + addl %edx, %ecx + xorl %eax, %edi + xorl %ecx, %edi + movl 52(%esi), %ebp + addl %edi, %ebx + movl %ecx, %edi + roll $23, %ebx + addl %ecx, %ebx + /* R2 40 */ + xorl %edx, %edi + xorl %ebx, %edi + leal 681279174(%eax,%ebp,1),%eax + addl %edi, %eax + movl (%esi), %ebp + roll $4, %eax + movl %ebx, %edi + /* R2 41 */ + leal 3936430074(%edx,%ebp,1),%edx + addl %ebx, %eax + xorl %ecx, %edi + xorl %eax, %edi + movl 12(%esi), %ebp + addl %edi, %edx + movl %eax, %edi + roll $11, %edx + addl %eax, %edx + /* R2 42 */ + xorl %ebx, %edi + xorl %edx, %edi + leal 3572445317(%ecx,%ebp,1),%ecx + addl %edi, %ecx + movl 24(%esi), %ebp + roll $16, %ecx + movl %edx, %edi + /* R2 43 */ + leal 76029189(%ebx,%ebp,1),%ebx + addl %edx, %ecx + xorl %eax, %edi + xorl %ecx, %edi + movl 36(%esi), %ebp + addl %edi, %ebx + movl %ecx, %edi + roll $23, %ebx + addl %ecx, %ebx + /* R2 44 */ + xorl %edx, %edi + xorl %ebx, %edi + leal 3654602809(%eax,%ebp,1),%eax + addl %edi, %eax + movl 48(%esi), %ebp + roll $4, %eax + movl %ebx, %edi + /* R2 45 */ + leal 3873151461(%edx,%ebp,1),%edx + addl %ebx, %eax + xorl %ecx, %edi + xorl %eax, %edi + movl 60(%esi), %ebp + addl %edi, %edx + movl %eax, %edi + roll $11, %edx + addl %eax, %edx + /* R2 46 */ + xorl %ebx, %edi + xorl %edx, %edi + leal 530742520(%ecx,%ebp,1),%ecx + addl %edi, %ecx + movl 8(%esi), %ebp + roll $16, %ecx + movl %edx, %edi + /* R2 47 */ + leal 3299628645(%ebx,%ebp,1),%ebx + addl %edx, %ecx + xorl %eax, %edi + xorl %ecx, %edi + movl (%esi), %ebp + addl %edi, %ebx + movl $-1, %edi + roll $23, %ebx + addl %ecx, %ebx + + /* R3 section */ + /* R3 48 */ + xorl %edx, %edi + orl %ebx, %edi + leal 4096336452(%eax,%ebp,1),%eax + xorl %ecx, %edi + movl 28(%esi), %ebp + addl %edi, %eax + movl $-1, %edi + roll $6, %eax + xorl %ecx, %edi + addl %ebx, %eax + /* R3 49 */ + orl %eax, %edi + leal 1126891415(%edx,%ebp,1),%edx + xorl %ebx, %edi + movl 56(%esi), %ebp + addl %edi, %edx + movl $-1, %edi + roll $10, %edx + xorl %ebx, %edi + addl %eax, %edx + /* R3 50 */ + orl %edx, %edi + leal 2878612391(%ecx,%ebp,1),%ecx + xorl %eax, %edi + movl 20(%esi), %ebp + addl %edi, %ecx + movl $-1, %edi + roll $15, %ecx + xorl %eax, %edi + addl %edx, %ecx + /* R3 51 */ + orl %ecx, %edi + leal 4237533241(%ebx,%ebp,1),%ebx + xorl %edx, %edi + movl 48(%esi), %ebp + addl %edi, %ebx + movl $-1, %edi + roll $21, %ebx + xorl %edx, %edi + addl %ecx, %ebx + /* R3 52 */ + orl %ebx, %edi + leal 1700485571(%eax,%ebp,1),%eax + xorl %ecx, %edi + movl 12(%esi), %ebp + addl %edi, %eax + movl $-1, %edi + roll $6, %eax + xorl %ecx, %edi + addl %ebx, %eax + /* R3 53 */ + orl %eax, %edi + leal 2399980690(%edx,%ebp,1),%edx + xorl %ebx, %edi + movl 40(%esi), %ebp + addl %edi, %edx + movl $-1, %edi + roll $10, %edx + xorl %ebx, %edi + addl %eax, %edx + /* R3 54 */ + orl %edx, %edi + leal 4293915773(%ecx,%ebp,1),%ecx + xorl %eax, %edi + movl 4(%esi), %ebp + addl %edi, %ecx + movl $-1, %edi + roll $15, %ecx + xorl %eax, %edi + addl %edx, %ecx + /* R3 55 */ + orl %ecx, %edi + leal 2240044497(%ebx,%ebp,1),%ebx + xorl %edx, %edi + movl 32(%esi), %ebp + addl %edi, %ebx + movl $-1, %edi + roll $21, %ebx + xorl %edx, %edi + addl %ecx, %ebx + /* R3 56 */ + orl %ebx, %edi + leal 1873313359(%eax,%ebp,1),%eax + xorl %ecx, %edi + movl 60(%esi), %ebp + addl %edi, %eax + movl $-1, %edi + roll $6, %eax + xorl %ecx, %edi + addl %ebx, %eax + /* R3 57 */ + orl %eax, %edi + leal 4264355552(%edx,%ebp,1),%edx + xorl %ebx, %edi + movl 24(%esi), %ebp + addl %edi, %edx + movl $-1, %edi + roll $10, %edx + xorl %ebx, %edi + addl %eax, %edx + /* R3 58 */ + orl %edx, %edi + leal 2734768916(%ecx,%ebp,1),%ecx + xorl %eax, %edi + movl 52(%esi), %ebp + addl %edi, %ecx + movl $-1, %edi + roll $15, %ecx + xorl %eax, %edi + addl %edx, %ecx + /* R3 59 */ + orl %ecx, %edi + leal 1309151649(%ebx,%ebp,1),%ebx + xorl %edx, %edi + movl 16(%esi), %ebp + addl %edi, %ebx + movl $-1, %edi + roll $21, %ebx + xorl %edx, %edi + addl %ecx, %ebx + /* R3 60 */ + orl %ebx, %edi + leal 4149444226(%eax,%ebp,1),%eax + xorl %ecx, %edi + movl 44(%esi), %ebp + addl %edi, %eax + movl $-1, %edi + roll $6, %eax + xorl %ecx, %edi + addl %ebx, %eax + /* R3 61 */ + orl %eax, %edi + leal 3174756917(%edx,%ebp,1),%edx + xorl %ebx, %edi + movl 8(%esi), %ebp + addl %edi, %edx + movl $-1, %edi + roll $10, %edx + xorl %ebx, %edi + addl %eax, %edx + /* R3 62 */ + orl %edx, %edi + leal 718787259(%ecx,%ebp,1),%ecx + xorl %eax, %edi + movl 36(%esi), %ebp + addl %edi, %ecx + movl $-1, %edi + roll $15, %ecx + xorl %eax, %edi + addl %edx, %ecx + /* R3 63 */ + orl %ecx, %edi + leal 3951481745(%ebx,%ebp,1),%ebx + xorl %edx, %edi + movl 24(%esp), %ebp + addl %edi, %ebx + addl $64, %esi + roll $21, %ebx + movl (%ebp), %edi + addl %ecx, %ebx + addl %edi, %eax + movl 4(%ebp), %edi + addl %edi, %ebx + movl 8(%ebp), %edi + addl %edi, %ecx + movl 12(%ebp), %edi + addl %edi, %edx + movl %eax, (%ebp) + movl %ebx, 4(%ebp) + movl (%esp), %edi + movl %ecx, 8(%ebp) + movl %edx, 12(%ebp) + cmpl %esi, %edi + jge .L000start + popl %eax + popl %ebx + popl %ebp + popl %edi + popl %esi + ret +.md5_block_x86_end: + SIZE(md5_block_x86,.md5_block_x86_end-md5_block_x86) +.ident "desasm.pl" diff --git a/src/lib/libssl/src/crypto/objects/objects.err b/src/lib/libssl/src/crypto/objects/objects.err new file mode 100644 index 0000000000..8bec3eaea2 --- /dev/null +++ b/src/lib/libssl/src/crypto/objects/objects.err @@ -0,0 +1,12 @@ +/* Error codes for the OBJ functions. */ + +/* Function codes. */ +#define OBJ_F_OBJ_CREATE 100 +#define OBJ_F_OBJ_DUP 101 +#define OBJ_F_OBJ_NID2LN 102 +#define OBJ_F_OBJ_NID2OBJ 103 +#define OBJ_F_OBJ_NID2SN 104 + +/* Reason codes. */ +#define OBJ_R_MALLOC_FAILURE 100 +#define OBJ_R_UNKNOWN_NID 101 diff --git a/src/lib/libssl/src/crypto/pem/ctx_size.c b/src/lib/libssl/src/crypto/pem/ctx_size.c new file mode 100644 index 0000000000..87469bc4af --- /dev/null +++ b/src/lib/libssl/src/crypto/pem/ctx_size.c @@ -0,0 +1,122 @@ +/* crypto/pem/ctx_size.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "cryptlib.h" +#include "evp.h" + +int main(argc,argv) +int argc; +char *argv[]; + { + int i,j; + char buf[256]; + + for (;;) + { + char *str; + buf[0]='\0'; + fgets(buf,256,stdin); + if (buf[0] == '\0') break; + + str="#define EVP_ENCODE_CTX_SIZE "; + if (strncmp(buf,str,strlen(str)) == 0) + { + printf("%s %d\n",str,(int)sizeof(EVP_ENCODE_CTX)); + continue; + } + str="#define EVP_MD_SIZE "; + if (strncmp(buf,str,strlen(str)) == 0) + { + printf("%s %d\n",str,(int)sizeof(EVP_MD)); + continue; + } + str="#define EVP_MD_CTX_SIZE "; + if (strncmp(buf,str,strlen(str)) == 0) + { + printf("%s %d\n",str,(int)sizeof(EVP_MD_CTX)); + continue; + } + str="#define EVP_CIPHER_SIZE "; + if (strncmp(buf,str,strlen(str)) == 0) + { + printf("%s %d\n",str,(int)sizeof(EVP_CIPHER)); + continue; + } + str="#define EVP_CIPHER_CTX_SIZE "; + if (strncmp(buf,str,strlen(str)) == 0) + { + printf("%s %d\n",str,(int)sizeof(EVP_CIPHER_CTX)); + continue; + } + + str="#define EVP_MAX_MD_SIZE "; + if (strncmp(buf,str,strlen(str)) == 0) + { + i=MD2_DIGEST_LENGTH; + j=MD5_DIGEST_LENGTH; + if (j > i) i=j; + j=SHA_DIGEST_LENGTH; + if (j > i) i=j; + printf("%s %d\n",str,i); + continue; + } + fputs(buf,stdout); + } + exit(0); + } diff --git a/src/lib/libssl/src/crypto/pem/pem.err b/src/lib/libssl/src/crypto/pem/pem.err new file mode 100644 index 0000000000..0e523abf82 --- /dev/null +++ b/src/lib/libssl/src/crypto/pem/pem.err @@ -0,0 +1,38 @@ +/* Error codes for the PEM functions. */ + +/* Function codes. */ +#define PEM_F_DEF_CALLBACK 100 +#define PEM_F_LOAD_IV 101 +#define PEM_F_PEM_ASN1_READ 102 +#define PEM_F_PEM_ASN1_READ_BIO 103 +#define PEM_F_PEM_ASN1_WRITE 104 +#define PEM_F_PEM_ASN1_WRITE_BIO 105 +#define PEM_F_PEM_DO_HEADER 106 +#define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 +#define PEM_F_PEM_READ 108 +#define PEM_F_PEM_READ_BIO 109 +#define PEM_F_PEM_SEALFINAL 110 +#define PEM_F_PEM_SEALINIT 111 +#define PEM_F_PEM_SIGNFINAL 112 +#define PEM_F_PEM_WRITE 113 +#define PEM_F_PEM_WRITE_BIO 114 +#define PEM_F_PEM_X509_INFO_READ 115 +#define PEM_F_PEM_X509_INFO_READ_BIO 116 +#define PEM_F_PEM_X509_INFO_WRITE_BIO 117 + +/* Reason codes. */ +#define PEM_R_BAD_BASE64_DECODE 100 +#define PEM_R_BAD_DECRYPT 101 +#define PEM_R_BAD_END_LINE 102 +#define PEM_R_BAD_IV_CHARS 103 +#define PEM_R_BAD_PASSWORD_READ 104 +#define PEM_R_NOT_DEK_INFO 105 +#define PEM_R_NOT_ENCRYPTED 106 +#define PEM_R_NOT_PROC_TYPE 107 +#define PEM_R_NO_START_LINE 108 +#define PEM_R_PROBLEMS_GETTING_PASSWORD 109 +#define PEM_R_PUBLIC_KEY_NO_RSA 110 +#define PEM_R_READ_KEY 111 +#define PEM_R_SHORT_HEADER 112 +#define PEM_R_UNSUPPORTED_CIPHER 113 +#define PEM_R_UNSUPPORTED_ENCRYPTION 114 diff --git a/src/lib/libssl/src/crypto/pem/pem.org b/src/lib/libssl/src/crypto/pem/pem.org new file mode 100644 index 0000000000..38952509dd --- /dev/null +++ b/src/lib/libssl/src/crypto/pem/pem.org @@ -0,0 +1,562 @@ +/* crypto/pem/pem.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify pem.org since pem.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +#ifndef HEADER_PEM_H +#define HEADER_PEM_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "evp.h" +#include "x509.h" + +#define PEM_OBJ_UNDEF 0 +#define PEM_OBJ_X509 1 +#define PEM_OBJ_X509_REQ 2 +#define PEM_OBJ_CRL 3 +#define PEM_OBJ_SSL_SESSION 4 +#define PEM_OBJ_PRIV_KEY 10 +#define PEM_OBJ_PRIV_RSA 11 +#define PEM_OBJ_PRIV_DSA 12 +#define PEM_OBJ_PRIV_DH 13 +#define PEM_OBJ_PUB_RSA 14 +#define PEM_OBJ_PUB_DSA 15 +#define PEM_OBJ_PUB_DH 16 +#define PEM_OBJ_DHPARAMS 17 +#define PEM_OBJ_DSAPARAMS 18 +#define PEM_OBJ_PRIV_RSA_PUBLIC 19 + +#define PEM_ERROR 30 +#define PEM_DEK_DES_CBC 40 +#define PEM_DEK_IDEA_CBC 45 +#define PEM_DEK_DES_EDE 50 +#define PEM_DEK_DES_ECB 60 +#define PEM_DEK_RSA 70 +#define PEM_DEK_RSA_MD2 80 +#define PEM_DEK_RSA_MD5 90 + +#define PEM_MD_MD2 NID_md2 +#define PEM_MD_MD5 NID_md5 +#define PEM_MD_SHA NID_sha +#define PEM_MD_MD2_RSA NID_md2WithRSAEncryption +#define PEM_MD_MD5_RSA NID_md5WithRSAEncryption +#define PEM_MD_SHA_RSA NID_sha1WithRSAEncryption + +#define PEM_STRING_X509_OLD "X509 CERTIFICATE" +#define PEM_STRING_X509 "CERTIFICATE" +#define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" +#define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" +#define PEM_STRING_X509_CRL "X509 CRL" +#define PEM_STRING_EVP_PKEY "PRIVATE KEY" +#define PEM_STRING_RSA "RSA PRIVATE KEY" +#define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" +#define PEM_STRING_DSA "DSA PRIVATE KEY" +#define PEM_STRING_PKCS7 "PKCS7" +#define PEM_STRING_DHPARAMS "DH PARAMETERS" +#define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" +#define PEM_STRING_DSAPARAMS "DSA PARAMETERS" + +#ifndef HEADER_ENVELOPE_H + +#define EVP_ENCODE_CTX_SIZE 92 +#define EVP_MD_SIZE 48 +#define EVP_MD_CTX_SIZE 152 +#define EVP_CIPHER_SIZE 28 +#define EVP_CIPHER_CTX_SIZE 4212 +#define EVP_MAX_MD_SIZE 20 + +typedef struct evp_encode_ctx_st + { + char data[EVP_ENCODE_CTX_SIZE]; + } EVP_ENCODE_CTX; + +typedef struct env_md_ctx_st + { + char data[EVP_MD_CTX_SIZE]; + } EVP_MD_CTX; + +typedef struct evp_cipher_st + { + char data[EVP_CIPHER_SIZE]; + } EVP_CIPHER; + +typedef struct evp_cipher_ctx_st + { + char data[EVP_CIPHER_CTX_SIZE]; + } EVP_CIPHER_CTX; +#endif + + +typedef struct PEM_Encode_Seal_st + { + EVP_ENCODE_CTX encode; + EVP_MD_CTX md; + EVP_CIPHER_CTX cipher; + } PEM_ENCODE_SEAL_CTX; + +/* enc_type is one off */ +#define PEM_TYPE_ENCRYPTED 10 +#define PEM_TYPE_MIC_ONLY 20 +#define PEM_TYPE_MIC_CLEAR 30 +#define PEM_TYPE_CLEAR 40 + +typedef struct pem_recip_st + { + char *name; + X509_NAME *dn; + + int cipher; + int key_enc; + char iv[8]; + } PEM_USER; + +typedef struct pem_ctx_st + { + int type; /* what type of object */ + + struct { + int version; + int mode; + } proc_type; + + char *domain; + + struct { + int cipher; + unsigned char iv[8]; + } DEK_info; + + PEM_USER *originator; + + int num_recipient; + PEM_USER **recipient; + +#ifdef HEADER_STACK_H + STACK *x509_chain; /* certificate chain */ +#else + char *x509_chain; /* certificate chain */ +#endif + EVP_MD *md; /* signature type */ + + int md_enc; /* is the md encrypted or not? */ + int md_len; /* length of md_data */ + char *md_data; /* message digest, could be pkey encrypted */ + + EVP_CIPHER *dec; /* date encryption cipher */ + int key_len; /* key length */ + unsigned char *key; /* key */ + unsigned char iv[8]; /* the iv */ + + + int data_enc; /* is the data encrypted */ + int data_len; + unsigned char *data; + } PEM_CTX; + +#ifdef SSLEAY_MACROS + +#define PEM_write_SSL_SESSION(fp,x) \ + PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \ + PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL) +#define PEM_write_X509(fp,x) \ + PEM_ASN1_write((int (*)())i2d_X509,PEM_STRING_X509,fp, \ + (char *)x, NULL,NULL,0,NULL) +#define PEM_write_X509_REQ(fp,x) PEM_ASN1_write( \ + (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,fp,(char *)x, \ + NULL,NULL,0,NULL) +#define PEM_write_X509_CRL(fp,x) \ + PEM_ASN1_write((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL, \ + fp,(char *)x, NULL,NULL,0,NULL) +#define PEM_write_RSAPrivateKey(fp,x,enc,kstr,klen,cb) \ + PEM_ASN1_write((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,fp,\ + (char *)x,enc,kstr,klen,cb) +#define PEM_write_RSAPublicKey(fp,x) \ + PEM_ASN1_write((int (*)())i2d_RSAPublicKey,\ + PEM_STRING_RSA_PUBLIC,fp,(char *)x,NULL,NULL,0,NULL) +#define PEM_write_DSAPrivateKey(fp,x,enc,kstr,klen,cb) \ + PEM_ASN1_write((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,fp,\ + (char *)x,enc,kstr,klen,cb) +#define PEM_write_PrivateKey(bp,x,enc,kstr,klen,cb) \ + PEM_ASN1_write((int (*)())i2d_PrivateKey,\ + (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\ + bp,(char *)x,enc,kstr,klen,cb) +#define PEM_write_PKCS7(fp,x) \ + PEM_ASN1_write((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,fp, \ + (char *)x, NULL,NULL,0,NULL) +#define PEM_write_DHparams(fp,x) \ + PEM_ASN1_write((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,fp,\ + (char *)x,NULL,NULL,0,NULL) + +#define PEM_read_SSL_SESSION(fp,x,cb) (SSL_SESSION *)PEM_ASN1_read( \ + (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb) +#define PEM_read_X509(fp,x,cb) (X509 *)PEM_ASN1_read( \ + (char *(*)())d2i_X509,PEM_STRING_X509,fp,(char **)x,cb) +#define PEM_read_X509_REQ(fp,x,cb) (X509_REQ *)PEM_ASN1_read( \ + (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,fp,(char **)x,cb) +#define PEM_read_X509_CRL(fp,x,cb) (X509_CRL *)PEM_ASN1_read( \ + (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,fp,(char **)x,cb) +#define PEM_read_RSAPrivateKey(fp,x,cb) (RSA *)PEM_ASN1_read( \ + (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,fp,(char **)x,cb) +#define PEM_read_RSAPublicKey(fp,x,cb) (RSA *)PEM_ASN1_read( \ + (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,fp,(char **)x,cb) +#define PEM_read_DSAPrivateKey(fp,x,cb) (DSA *)PEM_ASN1_read( \ + (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,fp,(char **)x,cb) +#define PEM_read_PrivateKey(fp,x,cb) (EVP_PKEY *)PEM_ASN1_read( \ + (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,fp,(char **)x,cb) +#define PEM_read_PKCS7(fp,x,cb) (PKCS7 *)PEM_ASN1_read( \ + (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,fp,(char **)x,cb) +#define PEM_read_DHparams(fp,x,cb) (DH *)PEM_ASN1_read( \ + (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,fp,(char **)x,cb) + +#define PEM_write_bio_SSL_SESSION(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_SSL_SESSION, \ + PEM_STRING_SSL_SESSION,bp, (char *)x, NULL,NULL,0,NULL) +#define PEM_write_bio_X509(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \ + (char *)x, NULL,NULL,0,NULL) +#define PEM_write_bio_X509_REQ(bp,x) PEM_ASN1_write_bio( \ + (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,bp,(char *)x, \ + NULL,NULL,0,NULL) +#define PEM_write_bio_X509_CRL(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL,\ + bp,(char *)x, NULL,NULL,0,NULL) +#define PEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb) \ + PEM_ASN1_write_bio((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,\ + bp,(char *)x,enc,kstr,klen,cb) +#define PEM_write_bio_RSAPublicKey(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_RSAPublicKey, \ + PEM_STRING_RSA_PUBLIC,\ + bp,(char *)x,NULL,NULL,0,NULL) +#define PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb) \ + PEM_ASN1_write_bio((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,\ + bp,(char *)x,enc,kstr,klen,cb) +#define PEM_write_bio_PrivateKey(bp,x,enc,kstr,klen,cb) \ + PEM_ASN1_write_bio((int (*)())i2d_PrivateKey,\ + (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\ + bp,(char *)x,enc,kstr,klen,cb) +#define PEM_write_bio_PKCS7(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,bp, \ + (char *)x, NULL,NULL,0,NULL) +#define PEM_write_bio_DHparams(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,\ + bp,(char *)x,NULL,NULL,0,NULL) +#define PEM_write_bio_DSAparams(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_DSAparams, \ + PEM_STRING_DSAPARAMS,bp,(char *)x,NULL,NULL,0,NULL) + +#define PEM_read_bio_SSL_SESSION(bp,x,cb) (SSL_SESSION *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,(char **)x,cb) +#define PEM_read_bio_X509(bp,x,cb) (X509 *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb) +#define PEM_read_bio_X509_REQ(bp,x,cb) (X509_REQ *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,bp,(char **)x,cb) +#define PEM_read_bio_X509_CRL(bp,x,cb) (X509_CRL *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,bp,(char **)x,cb) +#define PEM_read_bio_RSAPrivateKey(bp,x,cb) (RSA *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,bp,(char **)x,cb) +#define PEM_read_bio_RSAPublicKey(bp,x,cb) (RSA *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,bp,(char **)x,cb) +#define PEM_read_bio_DSAPrivateKey(bp,x,cb) (DSA *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,bp,(char **)x,cb) +#define PEM_read_bio_PrivateKey(bp,x,cb) (EVP_PKEY *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,bp,(char **)x,cb) + +#define PEM_read_bio_PKCS7(bp,x,cb) (PKCS7 *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,bp,(char **)x,cb) +#define PEM_read_bio_DHparams(bp,x,cb) (DH *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,bp,(char **)x,cb) +#define PEM_read_bio_DSAparams(bp,x,cb) (DSA *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_DSAparams,PEM_STRING_DSAPARAMS,bp,(char **)x,cb) + +#endif + +#ifndef NOPROTO +int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); +int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len, + int (*callback)()); + +#ifdef HEADER_BIO_H +int PEM_read_bio(BIO *bp, char **name, char **header, + unsigned char **data,long *len); +int PEM_write_bio(BIO *bp,char *name,char *hdr,unsigned char *data, + long len); +char * PEM_ASN1_read_bio(char *(*d2i)(),char *name,BIO *bp,char **x, + int (*cb)()); +int PEM_ASN1_write_bio(int (*i2d)(),char *name,BIO *bp,char *x, + EVP_CIPHER *enc,unsigned char *kstr,int klen,int (*callback)()); +STACK * PEM_X509_INFO_read_bio(BIO *bp, STACK *sk, int (*cb)()); +int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, + unsigned char *kstr, int klen, int (*cb)()); +#endif + +#ifndef WIN16 +int PEM_read(FILE *fp, char **name, char **header, + unsigned char **data,long *len); +int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len); +char * PEM_ASN1_read(char *(*d2i)(),char *name,FILE *fp,char **x, + int (*cb)()); +int PEM_ASN1_write(int (*i2d)(),char *name,FILE *fp,char *x, + EVP_CIPHER *enc,unsigned char *kstr,int klen,int (*callback)()); +STACK * PEM_X509_INFO_read(FILE *fp, STACK *sk, int (*cb)()); +#endif + +int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, + EVP_MD *md_type, unsigned char **ek, int *ekl, + unsigned char *iv, EVP_PKEY **pubk, int npubk); +void PEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl, + unsigned char *in, int inl); +int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig,int *sigl, + unsigned char *out, int *outl, EVP_PKEY *priv); + +void PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); +void PEM_SignUpdate(EVP_MD_CTX *ctx,unsigned char *d,unsigned int cnt); +int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, + unsigned int *siglen, EVP_PKEY *pkey); + +void ERR_load_PEM_strings(void); + +void PEM_proc_type(char *buf, int type); +void PEM_dek_info(char *buf, char *type, int len, char *str); + +#ifndef SSLEAY_MACROS + +#ifndef WIN16 +X509 *PEM_read_X509(FILE *fp,X509 **x,int (*cb)()); +X509_REQ *PEM_read_X509_REQ(FILE *fp,X509_REQ **x,int (*cb)()); +X509_CRL *PEM_read_X509_CRL(FILE *fp,X509_CRL **x,int (*cb)()); +RSA *PEM_read_RSAPrivateKey(FILE *fp,RSA **x,int (*cb)()); +RSA *PEM_read_RSAPublicKey(FILE *fp,RSA **x,int (*cb)()); +DSA *PEM_read_DSAPrivateKey(FILE *fp,DSA **x,int (*cb)()); +EVP_PKEY *PEM_read_PrivateKey(FILE *fp,EVP_PKEY **x,int (*cb)()); +PKCS7 *PEM_read_PKCS7(FILE *fp,PKCS7 **x,int (*cb)()); +DH *PEM_read_DHparams(FILE *fp,DH **x,int (*cb)()); +DSA *PEM_read_DSAparams(FILE *fp,DSA **x,int (*cb)()); +int PEM_write_X509(FILE *fp,X509 *x); +int PEM_write_X509_REQ(FILE *fp,X509_REQ *x); +int PEM_write_X509_CRL(FILE *fp,X509_CRL *x); +int PEM_write_RSAPrivateKey(FILE *fp,RSA *x,EVP_CIPHER *enc,unsigned char *kstr, + int klen,int (*cb)()); +int PEM_write_RSAPublicKey(FILE *fp,RSA *x); +int PEM_write_DSAPrivateKey(FILE *fp,DSA *x,EVP_CIPHER *enc,unsigned char *kstr, + int klen,int (*cb)()); +int PEM_write_PrivateKey(FILE *fp,EVP_PKEY *x,EVP_CIPHER *enc, + unsigned char *kstr,int klen,int (*cb)()); +int PEM_write_PKCS7(FILE *fp,PKCS7 *x); +int PEM_write_DHparams(FILE *fp,DH *x); +int PEM_write_DSAparams(FILE *fp,DSA *x); +#endif + +#ifdef HEADER_BIO_H +X509 *PEM_read_bio_X509(BIO *bp,X509 **x,int (*cb)()); +X509_REQ *PEM_read_bio_X509_REQ(BIO *bp,X509_REQ **x,int (*cb)()); +X509_CRL *PEM_read_bio_X509_CRL(BIO *bp,X509_CRL **x,int (*cb)()); +RSA *PEM_read_bio_RSAPrivateKey(BIO *bp,RSA **x,int (*cb)()); +RSA *PEM_read_bio_RSAPublicKey(BIO *bp,RSA **x,int (*cb)()); +DSA *PEM_read_bio_DSAPrivateKey(BIO *bp,DSA **x,int (*cb)()); +EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp,EVP_PKEY **x,int (*cb)()); +PKCS7 *PEM_read_bio_PKCS7(BIO *bp,PKCS7 **x,int (*cb)()); +DH *PEM_read_bio_DHparams(BIO *bp,DH **x,int (*cb)()); +DSA *PEM_read_bio_DSAparams(BIO *bp,DSA **x,int (*cb)()); +int PEM_write_bio_X509(BIO *bp,X509 *x); +int PEM_write_bio_X509_REQ(BIO *bp,X509_REQ *x); +int PEM_write_bio_X509_CRL(BIO *bp,X509_CRL *x); +int PEM_write_bio_RSAPrivateKey(BIO *fp,RSA *x,EVP_CIPHER *enc, + unsigned char *kstr,int klen,int (*cb)()); +int PEM_write_bio_RSAPublicKey(BIO *fp,RSA *x); +int PEM_write_bio_DSAPrivateKey(BIO *fp,DSA *x,EVP_CIPHER *enc, + unsigned char *kstr,int klen,int (*cb)()); +int PEM_write_bio_PrivateKey(BIO *fp,EVP_PKEY *x,EVP_CIPHER *enc, + unsigned char *kstr,int klen,int (*cb)()); +int PEM_write_bio_PKCS7(BIO *bp,PKCS7 *x); +int PEM_write_bio_DHparams(BIO *bp,DH *x); +int PEM_write_bio_DSAparams(BIO *bp,DSA *x); +#endif + +#endif /* SSLEAY_MACROS */ + + +#else + +int PEM_get_EVP_CIPHER_INFO(); +int PEM_do_header(); +int PEM_read_bio(); +int PEM_write_bio(); +#ifndef WIN16 +int PEM_read(); +int PEM_write(); +STACK * PEM_X509_INFO_read(); +char * PEM_ASN1_read(); +int PEM_ASN1_write(); +#endif +STACK * PEM_X509_INFO_read_bio(); +int PEM_X509_INFO_write_bio(); +char * PEM_ASN1_read_bio(); +int PEM_ASN1_write_bio(); +int PEM_SealInit(); +void PEM_SealUpdate(); +int PEM_SealFinal(); +int PEM_SignFinal(); + +void ERR_load_PEM_strings(); + +void PEM_proc_type(); +void PEM_dek_info(); + +#ifndef SSLEAY_MACROS +#ifndef WIN16 +X509 *PEM_read_X509(); +X509_REQ *PEM_read_X509_REQ(); +X509_CRL *PEM_read_X509_CRL(); +RSA *PEM_read_RSAPrivateKey(); +RSA *PEM_read_RSAPublicKey(); +DSA *PEM_read_DSAPrivateKey(); +EVP_PKEY *PEM_read_PrivateKey(); +PKCS7 *PEM_read_PKCS7(); +DH *PEM_read_DHparams(); +DSA *PEM_read_DSAparams(); +int PEM_write_X509(); +int PEM_write_X509_REQ(); +int PEM_write_X509_CRL(); +int PEM_write_RSAPrivateKey(); +int PEM_write_RSAPublicKey(); +int PEM_write_DSAPrivateKey(); +int PEM_write_PrivateKey(); +int PEM_write_PKCS7(); +int PEM_write_DHparams(); +int PEM_write_DSAparams(); +#endif + +X509 *PEM_read_bio_X509(); +X509_REQ *PEM_read_bio_X509_REQ(); +X509_CRL *PEM_read_bio_X509_CRL(); +RSA *PEM_read_bio_RSAPrivateKey(); +RSA *PEM_read_bio_RSAPublicKey(); +DSA *PEM_read_bio_DSAPrivateKey(); +EVP_PKEY *PEM_read_bio_PrivateKey(); +PKCS7 *PEM_read_bio_PKCS7(); +DH *PEM_read_bio_DHparams(); +DSA *PEM_read_bio_DSAparams(); +int PEM_write_bio_X509(); +int PEM_write_bio_X509_REQ(); +int PEM_write_bio_X509_CRL(); +int PEM_write_bio_RSAPrivateKey(); +int PEM_write_bio_RSAPublicKey(); +int PEM_write_bio_DSAPrivateKey(); +int PEM_write_bio_PrivateKey(); +int PEM_write_bio_PKCS7(); +int PEM_write_bio_DHparams(); +int PEM_write_bio_DSAparams(); + +#endif /* SSLEAY_MACROS */ + +#endif + +/* BEGIN ERROR CODES */ +/* Error codes for the PEM functions. */ + +/* Function codes. */ +#define PEM_F_DEF_CALLBACK 100 +#define PEM_F_LOAD_IV 101 +#define PEM_F_PEM_ASN1_READ 102 +#define PEM_F_PEM_ASN1_READ_BIO 103 +#define PEM_F_PEM_ASN1_WRITE 104 +#define PEM_F_PEM_ASN1_WRITE_BIO 105 +#define PEM_F_PEM_DO_HEADER 106 +#define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 +#define PEM_F_PEM_READ 108 +#define PEM_F_PEM_READ_BIO 109 +#define PEM_F_PEM_SEALFINAL 110 +#define PEM_F_PEM_SEALINIT 111 +#define PEM_F_PEM_SIGNFINAL 112 +#define PEM_F_PEM_WRITE 113 +#define PEM_F_PEM_WRITE_BIO 114 +#define PEM_F_PEM_X509_INFO_READ 115 +#define PEM_F_PEM_X509_INFO_READ_BIO 116 +#define PEM_F_PEM_X509_INFO_WRITE_BIO 117 + +/* Reason codes. */ +#define PEM_R_BAD_BASE64_DECODE 100 +#define PEM_R_BAD_DECRYPT 101 +#define PEM_R_BAD_END_LINE 102 +#define PEM_R_BAD_IV_CHARS 103 +#define PEM_R_BAD_PASSWORD_READ 104 +#define PEM_R_NOT_DEK_INFO 105 +#define PEM_R_NOT_ENCRYPTED 106 +#define PEM_R_NOT_PROC_TYPE 107 +#define PEM_R_NO_START_LINE 108 +#define PEM_R_PROBLEMS_GETTING_PASSWORD 109 +#define PEM_R_PUBLIC_KEY_NO_RSA 110 +#define PEM_R_READ_KEY 111 +#define PEM_R_SHORT_HEADER 112 +#define PEM_R_UNSUPPORTED_CIPHER 113 +#define PEM_R_UNSUPPORTED_ENCRYPTION 114 + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/src/lib/libssl/src/crypto/pkcs7/README b/src/lib/libssl/src/crypto/pkcs7/README new file mode 100644 index 0000000000..27001c6970 --- /dev/null +++ b/src/lib/libssl/src/crypto/pkcs7/README @@ -0,0 +1,5 @@ +WARNING + +Everything in this directory is experimental and is subject to change. + +Do not rely on the stuff in here not changing in the next release diff --git a/src/lib/libssl/src/crypto/pkcs7/mf.p7 b/src/lib/libssl/src/crypto/pkcs7/mf.p7 new file mode 100644 index 0000000000..524335b4b3 --- /dev/null +++ b/src/lib/libssl/src/crypto/pkcs7/mf.p7 @@ -0,0 +1,18 @@ +-----BEGIN PKCS7----- +MIAGCSqGSIb3DQEHAqCAMIIC2QIBATEMMAoGCCqGSIb3DQIFMIAGCSqGSIb3DQEH +AQAAoIIB7TCCAekwggFSAgEAMA0GCSqGSIb3DQEBBAUAMFsxCzAJBgNVBAYTAkFV +MRMwEQYDVQQIEwpRdWVlbnNsYW5kMRowGAYDVQQKExFDcnlwdFNvZnQgUHR5IEx0 +ZDEbMBkGA1UEAxMSVGVzdCBDQSAoMTAyNCBiaXQpMB4XDTk3MDYwOTEzNTc0NloX +DTk4MDYwOTEzNTc0NlowYzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xh +bmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMSMwIQYDVQQDExpTZXJ2ZXIg +dGVzdCBjZXJ0ICg1MTIgYml0KTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCfs8OE +J5X/EjFSDxXvRhHErYDmNlsP3YDXYY3g/HJFCTT+VWZFQ0xol2r+qKCl3194/+7X +ZLg/BMtv/yr+/rntAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAeEzEdgr2nChPcALL +vY8gl/GIlpoAjPmKD+pLeGZI9s+SEX5u1q8nCrJ6ZzkfrRnqgI5Anmev9+qPZfdU +bz5zdVSf4sUL9nX9ChXjK9NCJA3UzQHSFqhZErGUwGNkAHYHp2+zAdY6Ho6rmMzt +g0CDu/sKR4qzm6REsQGS8kgpjz4xgcUwgcICAQEwYDBbMQswCQYDVQQGEwJBVTET +MBEGA1UECBMKUXVlZW5zbGFuZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQx +GzAZBgNVBAMTElRlc3QgQ0EgKDEwMjQgYml0KQIBADAKBggqhkiG9w0CBTANBgkq +hkiG9w0BAQQFAARALnrxJiOX9XZf2D+3vL8SKMQmMq55LltomwOLGUru/q1uVXzi +ARg7FSCegOpA1nunsTURMUGgrPXKK4XmL4IseQAAAAA= +-----END PKCS7----- diff --git a/src/lib/libssl/src/crypto/pkcs7/p7.tst b/src/lib/libssl/src/crypto/pkcs7/p7.tst new file mode 100644 index 0000000000..6d14dce163 --- /dev/null +++ b/src/lib/libssl/src/crypto/pkcs7/p7.tst @@ -0,0 +1,33 @@ +-----BEGIN PKCS7----- +MIAGCSqGSIb3DQEHAqCAMIIFsQIBATELMAkGBSsOAwIaBQAwgAYJKoZIhvcNAQcB +AACgggQdMIICJTCCAc+gAwIBAgIBIjANBgkqhkiG9w0BAQQFADCBgjELMAkGA1UE +BhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5lMRow +GAYDVQQKExFDcnlwdFNvZnQgUHR5IEx0ZDEUMBIGA1UECxMLZGV2ZWxvcG1lbnQx +GTAXBgNVBAMTEENyeXB0U29mdCBEZXYgQ0EwHhcNOTcwNjEzMTgxMDE3WhcNOTgw +NjEzMTgxMDE3WjCBiDELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQx +ETAPBgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdFNvZnQgUHR5IEx0ZDEU +MBIGA1UECxMLSUlTIHRlc3RpbmcxDjAMBgNVBAMTBXRlc3QxMQ8wDQYJKoZIhvcN +AQkBFgAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAxtWiv59VH42+rotrmFAyDxTc +J2osFt5uy/zEllx3vvjtwewqQxGUOwf6cjqFOTrnpEdVvwywpEhIQ5364bJqIwID +AQABoygwJjAkBglghkgBhvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0G +CSqGSIb3DQEBBAUAA0EAMnYkNV2AdpeHPy/qlcdZx6MDGIJgrLhklhcn6Or6KiAP +t9+nv9XdOGHyMyQr9ufsweuQfAgJ9yjKPZR2/adTjTCCAfAwggGaAgEAMA0GCSqG +SIb3DQEBBAUAMIGCMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDER +MA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRQw +EgYDVQQLEwtkZXZlbG9wbWVudDEZMBcGA1UEAxMQQ3J5cHRTb2Z0IERldiBDQTAe +Fw05NzAzMjIxMzM0MDRaFw05ODAzMjIxMzM0MDRaMIGCMQswCQYDVQQGEwJBVTET +MBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoT +EUNyeXB0U29mdCBQdHkgTHRkMRQwEgYDVQQLEwtkZXZlbG9wbWVudDEZMBcGA1UE +AxMQQ3J5cHRTb2Z0IERldiBDQTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDgDgKq +IBuUMAJi4c8juAqEZ8f8FcuDWT+HcScvNztRJy9K8DnbGpiSrzzix4El6N4A7vbl +crwn/0CZmQJguZpfAgMBAAEwDQYJKoZIhvcNAQEEBQADQQA0UUvxlXXe6wKkVukn +ZoCyXbjlNsqt2rwbvfZEam6fQP3S7uq+o1Pnj+KDgE33WxWbQAA9h8fY1LWN7X3a +yTm/MYIBbTCCAWkCAQEwgYgwgYIxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVl +bnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0 +eSBMdGQxFDASBgNVBAsTC2RldmVsb3BtZW50MRkwFwYDVQQDExBDcnlwdFNvZnQg +RGV2IENBAgEiMAkGBSsOAwIaBQCgfTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcB +MCMGCSqGSIb3DQEJBDEWBBSUVhbGkNE+KGqpOK13+FkfOkaoizAcBgkqhkiG9w0B +CQUxDxcNOTcwNzAxMDE0MzM0WjAeBgkqhkiG9w0BCQ8xETAPMA0GCCqGSIb3DQMC +AgEoMA0GCSqGSIb3DQEBAQUABECa9Jpo4w/fZOc3Vy78wZFAVF8kvpn7il99Ldsr +AQ4JiBmcfiSwEBBY6WuKT+/SYtFwZl1oXkTwB5AVCFIC/IFNAAAAAA== +-----END PKCS7----- diff --git a/src/lib/libssl/src/crypto/pkcs7/pkcs7.err b/src/lib/libssl/src/crypto/pkcs7/pkcs7.err new file mode 100644 index 0000000000..91413aae43 --- /dev/null +++ b/src/lib/libssl/src/crypto/pkcs7/pkcs7.err @@ -0,0 +1,26 @@ +/* Error codes for the PKCS7 functions. */ + +/* Function codes. */ +#define PKCS7_F_PKCS7_ADD_CERTIFICATE 100 +#define PKCS7_F_PKCS7_ADD_CRL 101 +#define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102 +#define PKCS7_F_PKCS7_ADD_SIGNER 103 +#define PKCS7_F_PKCS7_CTRL 104 +#define PKCS7_F_PKCS7_DATAINIT 105 +#define PKCS7_F_PKCS7_DATASIGN 106 +#define PKCS7_F_PKCS7_DATAVERIFY 107 +#define PKCS7_F_PKCS7_SET_CIPHER 108 +#define PKCS7_F_PKCS7_SET_CONTENT 109 +#define PKCS7_F_PKCS7_SET_TYPE 110 + +/* Reason codes. */ +#define PKCS7_R_INTERNAL_ERROR 100 +#define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 101 +#define PKCS7_R_SIGNATURE_FAILURE 102 +#define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 103 +#define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 104 +#define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 105 +#define PKCS7_R_UNKNOWN_DIGEST_TYPE 106 +#define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 107 +#define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 108 +#define PKCS7_R_WRONG_CONTENT_TYPE 109 diff --git a/src/lib/libssl/src/crypto/ranlib.sh b/src/lib/libssl/src/crypto/ranlib.sh new file mode 100644 index 0000000000..543f712c6b --- /dev/null +++ b/src/lib/libssl/src/crypto/ranlib.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +cwd=`pwd` +cd /tmp + +if [ -s /bin/ranlib ] ; then + RL=/bin/ranlib +else if [ -s /usr/bin/ranlib ] ; then + RL=/usr/bin/ranlib +fi +fi + +if [ "x$RL" != "x" ] +then + case "$1" in + /*) + $RL "$1" + ;; + *) + $RL "$cwd/$1" + ;; + esac +fi diff --git a/src/lib/libssl/src/crypto/rc2/Makefile.uni b/src/lib/libssl/src/crypto/rc2/Makefile.uni new file mode 100644 index 0000000000..e50b3f2d19 --- /dev/null +++ b/src/lib/libssl/src/crypto/rc2/Makefile.uni @@ -0,0 +1,72 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options + +DIR= rc2 +TOP= . +CC= gcc +CFLAG= -O3 -fomit-frame-pointer + +CPP= $(CC) -E +INCLUDES= +INSTALLTOP=/usr/local/lib +MAKE= make +MAKEDEPEND= makedepend +MAKEFILE= Makefile.uni +AR= ar r + +IDEA_ENC=rc2_cbc.o + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile +TEST=rc2test +APPS=rc2speed + +LIB=librc2.a +LIBSRC=rc2_skey.c rc2_ecb.c rc2_cbc.c rc2cfb64.c rc2ofb64.c +LIBOBJ=rc2_skey.o rc2_ecb.o $(IDEA_ENC) rc2cfb64.o rc2ofb64.o + +SRC= $(LIBSRC) + +EXHEADER= rc2.h +HEADER= rc2_locl.h $(EXHEADER) + +ALL= $(GENERAL) $(SRC) $(HEADER) + +all: $(LIB) $(TEST) $(APPS) + +$(LIB): $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) + sh $(TOP)/ranlib.sh $(LIB) + +test: $(TEST) + ./$(TEST) + +$(TEST): $(TEST).c $(LIB) + $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) + +$(APPS): $(APPS).c $(LIB) + $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + +dclean: + perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff + +cc: + $(MAKE) CC="cc" CFLAG="-O" all + +gcc: + $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libssl/src/crypto/rc2/rc2.org b/src/lib/libssl/src/crypto/rc2/rc2.org new file mode 100644 index 0000000000..37354cfa62 --- /dev/null +++ b/src/lib/libssl/src/crypto/rc2/rc2.org @@ -0,0 +1,118 @@ +/* crypto/rc2/rc2.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify rc2.org since rc2.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +#ifndef HEADER_RC2_H +#define HEADER_RC2_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define RC2_ENCRYPT 1 +#define RC2_DECRYPT 0 + +/* I need to put in a mod for the alpha - eay */ +#define RC2_INT unsigned short + +#define RC2_BLOCK 8 +#define RC2_KEY_LENGTH 16 + +typedef struct rc2_key_st + { + RC2_INT data[64]; + } RC2_KEY; + +#ifndef NOPROTO + +void RC2_set_key(RC2_KEY *key, int len, unsigned char *data,int bits); +void RC2_ecb_encrypt(unsigned char *in,unsigned char *out,RC2_KEY *key, + int enc); +void RC2_encrypt(unsigned long *data,RC2_KEY *key); +void RC2_decrypt(unsigned long *data,RC2_KEY *key); +void RC2_cbc_encrypt(unsigned char *in, unsigned char *out, long length, + RC2_KEY *ks, unsigned char *iv, int enc); +void RC2_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, + RC2_KEY *schedule, unsigned char *ivec, int *num, int enc); +void RC2_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, + RC2_KEY *schedule, unsigned char *ivec, int *num); + +#else + +void RC2_set_key(); +void RC2_ecb_encrypt(); +void RC2_encrypt(); +void RC2_decrypt(); +void RC2_cbc_encrypt(); +void RC2_cfb64_encrypt(); +void RC2_ofb64_encrypt(); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/lib/libssl/src/crypto/rc4/Makefile.uni b/src/lib/libssl/src/crypto/rc4/Makefile.uni new file mode 100644 index 0000000000..79dc17b8d1 --- /dev/null +++ b/src/lib/libssl/src/crypto/rc4/Makefile.uni @@ -0,0 +1,102 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +DIR= rc4 +TOP= . +CC= gcc +CFLAG= -O3 -fomit-frame-pointer + +CPP= $(CC) -E +INCLUDES= +INSTALLTOP=/usr/local/lib +MAKE= make +MAKEDEPEND= makedepend +MAKEFILE= Makefile.uni +AR= ar r + +RC4_ENC=rc4_enc.o +# or use +#RC4_ENC=asm/rx86-elf.o +#RC4_ENC=asm/rx86-out.o +#RC4_ENC=asm/rx86-sol.o +#RC4_ENC=asm/rx86bdsi.o + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile +TEST=rc4test +APPS=rc4speed + +LIB=librc4.a +LIBSRC=rc4_skey.c rc4_enc.c +LIBOBJ=rc4_skey.o $(RC4_ENC) + +SRC= $(LIBSRC) + +EXHEADER= rc4.h +HEADER= $(EXHEADER) rc4_locl.h + +ALL= $(GENERAL) $(SRC) $(HEADER) + +all: $(LIB) $(TEST) $(APPS) + +$(LIB): $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) + sh $(TOP)/ranlib.sh $(LIB) + +# elf +asm/rx86-elf.o: asm/rx86unix.cpp + $(CPP) -DELF asm/rx86unix.cpp | as -o asm/rx86-elf.o + +# solaris +asm/rx86-sol.o: asm/rx86unix.cpp + $(CC) -E -DSOL asm/rx86unix.cpp | sed 's/^#.*//' > asm/rx86-sol.s + as -o asm/rx86-sol.o asm/rx86-sol.s + rm -f asm/rx86-sol.s + +# a.out +asm/rx86-out.o: asm/rx86unix.cpp + $(CPP) -DOUT asm/rx86unix.cpp | as -o asm/rx86-out.o + +# bsdi +asm/rx86bsdi.o: asm/rx86unix.cpp + $(CPP) -DBSDI asm/rx86unix.cpp | as -o asm/rx86bsdi.o + +asm/rx86unix.cpp: + (cd asm; perl rc4-586.pl cpp >rx86unix.cpp) + +test: $(TEST) + ./$(TEST) + +$(TEST): $(TEST).c $(LIB) + $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) + +$(APPS): $(APPS).c $(LIB) + $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + +dclean: + perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff + +cc: + $(MAKE) CC="cc" CFLAG="-O" all + +gcc: + $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libssl/src/crypto/rc4/asm/r4-win32.asm b/src/lib/libssl/src/crypto/rc4/asm/r4-win32.asm new file mode 100644 index 0000000000..70b0f7484c --- /dev/null +++ b/src/lib/libssl/src/crypto/rc4/asm/r4-win32.asm @@ -0,0 +1,314 @@ + ; Don't even think of reading this code + ; It was automatically generated by rc4-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE rc4-586.asm + .386 +.model FLAT +_TEXT SEGMENT +PUBLIC _RC4 + +_RC4 PROC NEAR + ; + push ebp + push ebx + mov ebp, DWORD PTR 12[esp] + mov ebx, DWORD PTR 16[esp] + push esi + push edi + mov ecx, DWORD PTR [ebp] + mov edx, DWORD PTR 4[ebp] + mov esi, DWORD PTR 28[esp] + inc ecx + sub esp, 12 + add ebp, 8 + and ecx, 255 + lea ebx, DWORD PTR [esi+ebx-8] + mov edi, DWORD PTR 44[esp] + mov DWORD PTR 8[esp],ebx + mov eax, DWORD PTR [ecx*4+ebp] + cmp ebx, esi + jl $L000end +L001start: + add esi, 8 + ; Round 0 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR [esp], bl + ; Round 1 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 1[esp],bl + ; Round 2 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 2[esp],bl + ; Round 3 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 3[esp],bl + ; Round 4 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 4[esp],bl + ; Round 5 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 5[esp],bl + ; Round 6 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 6[esp],bl + ; Round 7 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + add edi, 8 + mov BYTE PTR 7[esp],bl + ; apply the cipher text + mov eax, DWORD PTR [esp] + mov ebx, DWORD PTR [esi-8] + xor eax, ebx + mov ebx, DWORD PTR [esi-4] + mov DWORD PTR [edi-8],eax + mov eax, DWORD PTR 4[esp] + xor eax, ebx + mov ebx, DWORD PTR 8[esp] + mov DWORD PTR [edi-4],eax + mov eax, DWORD PTR [ecx*4+ebp] + cmp esi, ebx + jle L001start +$L000end: + ; Round 0 + add ebx, 8 + inc esi + cmp ebx, esi + jl $L002finished + mov DWORD PTR 8[esp],ebx + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR [edi], bl + ; Round 1 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 1[edi],bl + ; Round 2 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 2[edi],bl + ; Round 3 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 3[edi],bl + ; Round 4 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 4[edi],bl + ; Round 5 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 5[edi],bl + ; Round 6 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 6[edi],bl +$L002finished: + dec ecx + add esp, 12 + mov DWORD PTR [ebp-4],edx + mov BYTE PTR [ebp-8],cl + pop edi + pop esi + pop ebx + pop ebp + ret +_RC4 ENDP +_TEXT ENDS +END diff --git a/src/lib/libssl/src/crypto/rc4/asm/rx86unix.cpp b/src/lib/libssl/src/crypto/rc4/asm/rx86unix.cpp new file mode 100644 index 0000000000..ec1d72a110 --- /dev/null +++ b/src/lib/libssl/src/crypto/rc4/asm/rx86unix.cpp @@ -0,0 +1,358 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define RC4 _RC4 + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by rc4-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "rc4-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl RC4 + TYPE(RC4,@function) +RC4: + + pushl %ebp + pushl %ebx + movl 12(%esp), %ebp + movl 16(%esp), %ebx + pushl %esi + pushl %edi + movl (%ebp), %ecx + movl 4(%ebp), %edx + movl 28(%esp), %esi + incl %ecx + subl $12, %esp + addl $8, %ebp + andl $255, %ecx + leal -8(%ebx,%esi,), %ebx + movl 44(%esp), %edi + movl %ebx, 8(%esp) + movl (%ebp,%ecx,4), %eax + cmpl %esi, %ebx + jl .L000end +.L001start: + addl $8, %esi + /* Round 0 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, (%esp) + /* Round 1 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 1(%esp) + /* Round 2 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 2(%esp) + /* Round 3 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 3(%esp) + /* Round 4 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 4(%esp) + /* Round 5 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 5(%esp) + /* Round 6 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 6(%esp) + /* Round 7 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + addl $8, %edi + movb %bl, 7(%esp) + /* apply the cipher text */ + movl (%esp), %eax + movl -8(%esi), %ebx + xorl %ebx, %eax + movl -4(%esi), %ebx + movl %eax, -8(%edi) + movl 4(%esp), %eax + xorl %ebx, %eax + movl 8(%esp), %ebx + movl %eax, -4(%edi) + movl (%ebp,%ecx,4), %eax + cmpl %ebx, %esi + jle .L001start +.L000end: + /* Round 0 */ + addl $8, %ebx + incl %esi + cmpl %esi, %ebx + jl .L002finished + movl %ebx, 8(%esp) + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, (%edi) + /* Round 1 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 1(%edi) + /* Round 2 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 2(%edi) + /* Round 3 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 3(%edi) + /* Round 4 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 4(%edi) + /* Round 5 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 5(%edi) + /* Round 6 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 6(%edi) +.L002finished: + decl %ecx + addl $12, %esp + movl %edx, -4(%ebp) + movb %cl, -8(%ebp) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.RC4_end: + SIZE(RC4,.RC4_end-RC4) +.ident "RC4" diff --git a/src/lib/libssl/src/crypto/rc4/rc4.org b/src/lib/libssl/src/crypto/rc4/rc4.org new file mode 100644 index 0000000000..c558651af8 --- /dev/null +++ b/src/lib/libssl/src/crypto/rc4/rc4.org @@ -0,0 +1,103 @@ +/* crypto/rc4/rc4.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify rc4.org since rc4.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +#ifndef HEADER_RC4_H +#define HEADER_RC4_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* using int types make the structure larger but make the code faster + * on most boxes I have tested - up to %20 faster. */ +#define RC4_INT unsigned int + +typedef struct rc4_key_st + { + RC4_INT x,y; + RC4_INT data[256]; + } RC4_KEY; + +#ifndef NOPROTO + +char *RC4_options(void); +void RC4_set_key(RC4_KEY *key, int len, unsigned char *data); +void RC4(RC4_KEY *key, unsigned long len, unsigned char *indata, + unsigned char *outdata); + +#else + +char *RC4_options(); +void RC4_set_key(); +void RC4(); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/lib/libssl/src/crypto/rc4/rc4_locl.org b/src/lib/libssl/src/crypto/rc4/rc4_locl.org new file mode 100644 index 0000000000..1ef4455fb7 --- /dev/null +++ b/src/lib/libssl/src/crypto/rc4/rc4_locl.org @@ -0,0 +1,70 @@ +/* crypto/rc4/rc4_locl.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify bf_locl.org since bf_locl.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +/* if this is defined data[i] is used instead of *data, this is a %20 + * speedup on x86 */ +#undef RC4_INDEX + diff --git a/src/lib/libssl/src/crypto/rc5/Makefile.uni b/src/lib/libssl/src/crypto/rc5/Makefile.uni new file mode 100644 index 0000000000..e50b3f2d19 --- /dev/null +++ b/src/lib/libssl/src/crypto/rc5/Makefile.uni @@ -0,0 +1,72 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options + +DIR= rc2 +TOP= . +CC= gcc +CFLAG= -O3 -fomit-frame-pointer + +CPP= $(CC) -E +INCLUDES= +INSTALLTOP=/usr/local/lib +MAKE= make +MAKEDEPEND= makedepend +MAKEFILE= Makefile.uni +AR= ar r + +IDEA_ENC=rc2_cbc.o + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile +TEST=rc2test +APPS=rc2speed + +LIB=librc2.a +LIBSRC=rc2_skey.c rc2_ecb.c rc2_cbc.c rc2cfb64.c rc2ofb64.c +LIBOBJ=rc2_skey.o rc2_ecb.o $(IDEA_ENC) rc2cfb64.o rc2ofb64.o + +SRC= $(LIBSRC) + +EXHEADER= rc2.h +HEADER= rc2_locl.h $(EXHEADER) + +ALL= $(GENERAL) $(SRC) $(HEADER) + +all: $(LIB) $(TEST) $(APPS) + +$(LIB): $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) + sh $(TOP)/ranlib.sh $(LIB) + +test: $(TEST) + ./$(TEST) + +$(TEST): $(TEST).c $(LIB) + $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) + +$(APPS): $(APPS).c $(LIB) + $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + +dclean: + perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff + +cc: + $(MAKE) CC="cc" CFLAG="-O" all + +gcc: + $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libssl/src/crypto/rc5/asm/r5-win32.asm b/src/lib/libssl/src/crypto/rc5/asm/r5-win32.asm new file mode 100644 index 0000000000..f43d3711f0 --- /dev/null +++ b/src/lib/libssl/src/crypto/rc5/asm/r5-win32.asm @@ -0,0 +1,574 @@ + ; Don't even think of reading this code + ; It was automatically generated by rc5-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE rc5-586.asm + .386 +.model FLAT +_TEXT SEGMENT +PUBLIC _RC5_32_encrypt + +_RC5_32_encrypt PROC NEAR + ; + push ebp + push esi + push edi + mov edx, DWORD PTR 16[esp] + mov ebp, DWORD PTR 20[esp] + ; Load the 2 words + mov edi, DWORD PTR [edx] + mov esi, DWORD PTR 4[edx] + push ebx + mov ebx, DWORD PTR [ebp] + add edi, DWORD PTR 4[ebp] + add esi, DWORD PTR 8[ebp] + xor edi, esi + mov eax, DWORD PTR 12[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 16[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 20[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 24[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 28[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 32[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 36[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 40[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 44[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 48[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 52[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 56[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 60[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 64[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 68[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 72[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + cmp ebx, 8 + je $L000rc5_exit + xor edi, esi + mov eax, DWORD PTR 76[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 80[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 84[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 88[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 92[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 96[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 100[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 104[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + cmp ebx, 12 + je $L000rc5_exit + xor edi, esi + mov eax, DWORD PTR 108[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 112[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 116[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 120[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 124[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 128[ebp] + mov ecx, edi + rol esi, cl + add esi, eax + xor edi, esi + mov eax, DWORD PTR 132[ebp] + mov ecx, esi + rol edi, cl + add edi, eax + xor esi, edi + mov eax, DWORD PTR 136[ebp] + mov ecx, edi + rol esi, cl + add esi, eax +$L000rc5_exit: + mov DWORD PTR [edx],edi + mov DWORD PTR 4[edx],esi + pop ebx + pop edi + pop esi + pop ebp + ret +_RC5_32_encrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _RC5_32_decrypt + +_RC5_32_decrypt PROC NEAR + ; + push ebp + push esi + push edi + mov edx, DWORD PTR 16[esp] + mov ebp, DWORD PTR 20[esp] + ; Load the 2 words + mov edi, DWORD PTR [edx] + mov esi, DWORD PTR 4[edx] + push ebx + mov ebx, DWORD PTR [ebp] + cmp ebx, 12 + je $L001rc5_dec_12 + cmp ebx, 8 + je $L002rc5_dec_8 + mov eax, DWORD PTR 136[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 132[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 128[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 124[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 120[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 116[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 112[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 108[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi +$L001rc5_dec_12: + mov eax, DWORD PTR 104[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 100[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 96[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 92[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 88[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 84[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 80[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 76[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi +$L002rc5_dec_8: + mov eax, DWORD PTR 72[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 68[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 64[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 60[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 56[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 52[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 48[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 44[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 40[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 36[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 32[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 28[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 24[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 20[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + mov eax, DWORD PTR 16[ebp] + sub esi, eax + mov ecx, edi + ror esi, cl + xor esi, edi + mov eax, DWORD PTR 12[ebp] + sub edi, eax + mov ecx, esi + ror edi, cl + xor edi, esi + sub esi, DWORD PTR 8[ebp] + sub edi, DWORD PTR 4[ebp] +L003rc5_exit: + mov DWORD PTR [edx],edi + mov DWORD PTR 4[edx],esi + pop ebx + pop edi + pop esi + pop ebp + ret +_RC5_32_decrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _RC5_32_cbc_encrypt + +_RC5_32_cbc_encrypt PROC NEAR + ; + push ebp + push ebx + push esi + push edi + mov ebp, DWORD PTR 28[esp] + ; getting iv ptr from parameter 4 + mov ebx, DWORD PTR 36[esp] + mov esi, DWORD PTR [ebx] + mov edi, DWORD PTR 4[ebx] + push edi + push esi + push edi + push esi + mov ebx, esp + mov esi, DWORD PTR 36[esp] + mov edi, DWORD PTR 40[esp] + ; getting encrypt flag from parameter 5 + mov ecx, DWORD PTR 56[esp] + ; get and push parameter 3 + mov eax, DWORD PTR 48[esp] + push eax + push ebx + cmp ecx, 0 + jz $L004decrypt + and ebp, 4294967288 + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + jz $L005encrypt_finish +L006encrypt_loop: + mov ecx, DWORD PTR [esi] + mov edx, DWORD PTR 4[esi] + xor eax, ecx + xor ebx, edx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _RC5_32_encrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L006encrypt_loop +$L005encrypt_finish: + mov ebp, DWORD PTR 52[esp] + and ebp, 7 + jz $L007finish + xor ecx, ecx + xor edx, edx + mov ebp, DWORD PTR $L008cbc_enc_jmp_table[ebp*4] + jmp ebp +L009ej7: + mov dh, BYTE PTR 6[esi] + shl edx, 8 +L010ej6: + mov dh, BYTE PTR 5[esi] +L011ej5: + mov dl, BYTE PTR 4[esi] +L012ej4: + mov ecx, DWORD PTR [esi] + jmp $L013ejend +L014ej3: + mov ch, BYTE PTR 2[esi] + shl ecx, 8 +L015ej2: + mov ch, BYTE PTR 1[esi] +L016ej1: + mov cl, BYTE PTR [esi] +$L013ejend: + xor eax, ecx + xor ebx, edx + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _RC5_32_encrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + mov DWORD PTR [edi],eax + mov DWORD PTR 4[edi],ebx + jmp $L007finish +$L004decrypt: + and ebp, 4294967288 + mov eax, DWORD PTR 16[esp] + mov ebx, DWORD PTR 20[esp] + jz $L017decrypt_finish +L018decrypt_loop: + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _RC5_32_decrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + mov ecx, DWORD PTR 16[esp] + mov edx, DWORD PTR 20[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR [edi],ecx + mov DWORD PTR 4[edi],edx + mov DWORD PTR 16[esp],eax + mov DWORD PTR 20[esp],ebx + add esi, 8 + add edi, 8 + sub ebp, 8 + jnz L018decrypt_loop +$L017decrypt_finish: + mov ebp, DWORD PTR 52[esp] + and ebp, 7 + jz $L007finish + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR 8[esp],eax + mov DWORD PTR 12[esp],ebx + call _RC5_32_decrypt + mov eax, DWORD PTR 8[esp] + mov ebx, DWORD PTR 12[esp] + mov ecx, DWORD PTR 16[esp] + mov edx, DWORD PTR 20[esp] + xor ecx, eax + xor edx, ebx + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] +L019dj7: + ror edx, 16 + mov BYTE PTR 6[edi],dl + shr edx, 16 +L020dj6: + mov BYTE PTR 5[edi],dh +L021dj5: + mov BYTE PTR 4[edi],dl +L022dj4: + mov DWORD PTR [edi],ecx + jmp $L023djend +L024dj3: + ror ecx, 16 + mov BYTE PTR 2[edi],cl + shl ecx, 16 +L025dj2: + mov BYTE PTR 1[esi],ch +L026dj1: + mov BYTE PTR [esi], cl +$L023djend: + jmp $L007finish +$L007finish: + mov ecx, DWORD PTR 60[esp] + add esp, 24 + mov DWORD PTR [ecx],eax + mov DWORD PTR 4[ecx],ebx + pop edi + pop esi + pop ebx + pop ebp + ret +$L008cbc_enc_jmp_table: + DD 0 + DD L016ej1 + DD L015ej2 + DD L014ej3 + DD L012ej4 + DD L011ej5 + DD L010ej6 + DD L009ej7 +L027cbc_dec_jmp_table: + DD 0 + DD L026dj1 + DD L025dj2 + DD L024dj3 + DD L022dj4 + DD L021dj5 + DD L020dj6 + DD L019dj7 +_RC5_32_cbc_encrypt ENDP +_TEXT ENDS +END diff --git a/src/lib/libssl/src/crypto/rc5/asm/r586unix.cpp b/src/lib/libssl/src/crypto/rc5/asm/r586unix.cpp new file mode 100644 index 0000000000..a25dd5a9a4 --- /dev/null +++ b/src/lib/libssl/src/crypto/rc5/asm/r586unix.cpp @@ -0,0 +1,628 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define RC5_32_encrypt _RC5_32_encrypt +#define RC5_32_decrypt _RC5_32_decrypt +#define RC5_32_cbc_encrypt _RC5_32_cbc_encrypt + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by rc5-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "rc5-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl RC5_32_encrypt + TYPE(RC5_32_encrypt,@function) +RC5_32_encrypt: + + pushl %ebp + pushl %esi + pushl %edi + movl 16(%esp), %edx + movl 20(%esp), %ebp + /* Load the 2 words */ + movl (%edx), %edi + movl 4(%edx), %esi + pushl %ebx + movl (%ebp), %ebx + addl 4(%ebp), %edi + addl 8(%ebp), %esi + xorl %esi, %edi + movl 12(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 16(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 20(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 24(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 28(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 32(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 36(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 40(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 44(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 48(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 52(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 56(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 60(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 64(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 68(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 72(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + cmpl $8, %ebx + je .L000rc5_exit + xorl %esi, %edi + movl 76(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 80(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 84(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 88(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 92(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 96(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 100(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 104(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + cmpl $12, %ebx + je .L000rc5_exit + xorl %esi, %edi + movl 108(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 112(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 116(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 120(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 124(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 128(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi + xorl %esi, %edi + movl 132(%ebp), %eax + movl %esi, %ecx + roll %cl, %edi + addl %eax, %edi + xorl %edi, %esi + movl 136(%ebp), %eax + movl %edi, %ecx + roll %cl, %esi + addl %eax, %esi +.L000rc5_exit: + movl %edi, (%edx) + movl %esi, 4(%edx) + popl %ebx + popl %edi + popl %esi + popl %ebp + ret +.RC5_32_encrypt_end: + SIZE(RC5_32_encrypt,.RC5_32_encrypt_end-RC5_32_encrypt) +.ident "desasm.pl" +.text + .align ALIGN +.globl RC5_32_decrypt + TYPE(RC5_32_decrypt,@function) +RC5_32_decrypt: + + pushl %ebp + pushl %esi + pushl %edi + movl 16(%esp), %edx + movl 20(%esp), %ebp + /* Load the 2 words */ + movl (%edx), %edi + movl 4(%edx), %esi + pushl %ebx + movl (%ebp), %ebx + cmpl $12, %ebx + je .L001rc5_dec_12 + cmpl $8, %ebx + je .L002rc5_dec_8 + movl 136(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 132(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 128(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 124(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 120(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 116(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 112(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 108(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi +.L001rc5_dec_12: + movl 104(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 100(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 96(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 92(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 88(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 84(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 80(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 76(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi +.L002rc5_dec_8: + movl 72(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 68(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 64(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 60(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 56(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 52(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 48(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 44(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 40(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 36(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 32(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 28(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 24(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 20(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + movl 16(%ebp), %eax + subl %eax, %esi + movl %edi, %ecx + rorl %cl, %esi + xorl %edi, %esi + movl 12(%ebp), %eax + subl %eax, %edi + movl %esi, %ecx + rorl %cl, %edi + xorl %esi, %edi + subl 8(%ebp), %esi + subl 4(%ebp), %edi +.L003rc5_exit: + movl %edi, (%edx) + movl %esi, 4(%edx) + popl %ebx + popl %edi + popl %esi + popl %ebp + ret +.RC5_32_decrypt_end: + SIZE(RC5_32_decrypt,.RC5_32_decrypt_end-RC5_32_decrypt) +.ident "desasm.pl" +.text + .align ALIGN +.globl RC5_32_cbc_encrypt + TYPE(RC5_32_cbc_encrypt,@function) +RC5_32_cbc_encrypt: + + pushl %ebp + pushl %ebx + pushl %esi + pushl %edi + movl 28(%esp), %ebp + /* getting iv ptr from parameter 4 */ + movl 36(%esp), %ebx + movl (%ebx), %esi + movl 4(%ebx), %edi + pushl %edi + pushl %esi + pushl %edi + pushl %esi + movl %esp, %ebx + movl 36(%esp), %esi + movl 40(%esp), %edi + /* getting encrypt flag from parameter 5 */ + movl 56(%esp), %ecx + /* get and push parameter 3 */ + movl 48(%esp), %eax + pushl %eax + pushl %ebx + cmpl $0, %ecx + jz .L004decrypt + andl $4294967288, %ebp + movl 8(%esp), %eax + movl 12(%esp), %ebx + jz .L005encrypt_finish +.L006encrypt_loop: + movl (%esi), %ecx + movl 4(%esi), %edx + xorl %ecx, %eax + xorl %edx, %ebx + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call RC5_32_encrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx + movl %eax, (%edi) + movl %ebx, 4(%edi) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L006encrypt_loop +.L005encrypt_finish: + movl 52(%esp), %ebp + andl $7, %ebp + jz .L007finish + xorl %ecx, %ecx + xorl %edx, %edx + movl .L008cbc_enc_jmp_table(,%ebp,4),%ebp + jmp *%ebp +.L009ej7: + movb 6(%esi), %dh + sall $8, %edx +.L010ej6: + movb 5(%esi), %dh +.L011ej5: + movb 4(%esi), %dl +.L012ej4: + movl (%esi), %ecx + jmp .L013ejend +.L014ej3: + movb 2(%esi), %ch + sall $8, %ecx +.L015ej2: + movb 1(%esi), %ch +.L016ej1: + movb (%esi), %cl +.L013ejend: + xorl %ecx, %eax + xorl %edx, %ebx + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call RC5_32_encrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx + movl %eax, (%edi) + movl %ebx, 4(%edi) + jmp .L007finish +.align ALIGN +.L004decrypt: + andl $4294967288, %ebp + movl 16(%esp), %eax + movl 20(%esp), %ebx + jz .L017decrypt_finish +.L018decrypt_loop: + movl (%esi), %eax + movl 4(%esi), %ebx + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call RC5_32_decrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx + movl 16(%esp), %ecx + movl 20(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx + movl %ecx, (%edi) + movl %edx, 4(%edi) + movl %eax, 16(%esp) + movl %ebx, 20(%esp) + addl $8, %esi + addl $8, %edi + subl $8, %ebp + jnz .L018decrypt_loop +.L017decrypt_finish: + movl 52(%esp), %ebp + andl $7, %ebp + jz .L007finish + movl (%esi), %eax + movl 4(%esi), %ebx + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + call RC5_32_decrypt + movl 8(%esp), %eax + movl 12(%esp), %ebx + movl 16(%esp), %ecx + movl 20(%esp), %edx + xorl %eax, %ecx + xorl %ebx, %edx + movl (%esi), %eax + movl 4(%esi), %ebx +.L019dj7: + rorl $16, %edx + movb %dl, 6(%edi) + shrl $16, %edx +.L020dj6: + movb %dh, 5(%edi) +.L021dj5: + movb %dl, 4(%edi) +.L022dj4: + movl %ecx, (%edi) + jmp .L023djend +.L024dj3: + rorl $16, %ecx + movb %cl, 2(%edi) + sall $16, %ecx +.L025dj2: + movb %ch, 1(%esi) +.L026dj1: + movb %cl, (%esi) +.L023djend: + jmp .L007finish +.align ALIGN +.L007finish: + movl 60(%esp), %ecx + addl $24, %esp + movl %eax, (%ecx) + movl %ebx, 4(%ecx) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.align ALIGN +.L008cbc_enc_jmp_table: + .long 0 + .long .L016ej1 + .long .L015ej2 + .long .L014ej3 + .long .L012ej4 + .long .L011ej5 + .long .L010ej6 + .long .L009ej7 +.align ALIGN +.L027cbc_dec_jmp_table: + .long 0 + .long .L026dj1 + .long .L025dj2 + .long .L024dj3 + .long .L022dj4 + .long .L021dj5 + .long .L020dj6 + .long .L019dj7 +.RC5_32_cbc_encrypt_end: + SIZE(RC5_32_cbc_encrypt,.RC5_32_cbc_encrypt_end-RC5_32_cbc_encrypt) +.ident "desasm.pl" diff --git a/src/lib/libssl/src/crypto/ripemd/Makefile.uni b/src/lib/libssl/src/crypto/ripemd/Makefile.uni new file mode 100644 index 0000000000..54685712db --- /dev/null +++ b/src/lib/libssl/src/crypto/ripemd/Makefile.uni @@ -0,0 +1,109 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +DIR= md5 +TOP= . +CC= gcc +CFLAG= -O3 -fomit-frame-pointer + +CPP= $(CC) -E +INCLUDES= +INSTALLTOP=/usr/local/lib +MAKE= make +MAKEDEPEND= makedepend +MAKEFILE= Makefile.uni +AR= ar r + +MD5_ASM_OBJ= + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile +TEST=md5test +APPS=md5 + +LIB=libmd5.a +LIBSRC=md5_dgst.c md5_one.c +LIBOBJ=md5_dgst.o md5_one.o $(MD5_ASM_OBJ) + +SRC= $(LIBSRC) + +EXHEADER= md5.h +HEADER= md5_locl.h $(EXHEADER) + +ALL= $(GENERAL) $(SRC) $(HEADER) + +all: $(LIB) $(TEST) $(APPS) + +$(LIB): $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) + sh $(TOP)/ranlib.sh $(LIB) + +# elf +asm/mx86-elf.o: asm/mx86unix.cpp + $(CPP) -DELF asm/mx86unix.cpp | as -o asm/mx86-elf.o + +# solaris +asm/mx86-sol.o: asm/mx86unix.cpp + $(CC) -E -DSOL asm/mx86unix.cpp | sed 's/^#.*//' > asm/mx86-sol.s + as -o asm/mx86-sol.o asm/mx86-sol.s + rm -f asm/mx86-sol.s + +# a.out +asm/mx86-out.o: asm/mx86unix.cpp + $(CPP) -DOUT asm/mx86unix.cpp | as -o asm/mx86-out.o + +# bsdi +asm/mx86bsdi.o: asm/mx86unix.cpp + $(CPP) -DBSDI asm/mx86unix.cpp | as -o asm/mx86bsdi.o + +asm/mx86unix.cpp: + (cd asm; perl md5-586.pl cpp >mx86unix.cpp) + +test: $(TEST) + ./$(TEST) + +$(TEST): $(TEST).c $(LIB) + $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) + +$(APPS): $(APPS).c $(LIB) + $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + +dclean: + perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff + +cc: + $(MAKE) MD5_ASM_OBJ="" CC="cc" CFLAG="-O" all + +gcc: + $(MAKE) MD5_ASM_OBJ="" CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all + +x86-elf: + $(MAKE) MD5_ASM_OBJ="asm/mx86-elf.o" CFLAG="-DELF -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-out: + $(MAKE) MD5_ASM_OBJ="asm/mx86-out.o" CFLAG="-DOUT -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-solaris: + $(MAKE) MD5_ASM_OBJ="asm/mx86-sol.o" CFLAG="-DSOL -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-bdsi: + $(MAKE) MD5_ASM_OBJ="asm/mx86-bdsi.o" CFLAG="-DBDSI -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libssl/src/crypto/ripemd/asm/rm-win32.asm b/src/lib/libssl/src/crypto/ripemd/asm/rm-win32.asm new file mode 100644 index 0000000000..bd38791c13 --- /dev/null +++ b/src/lib/libssl/src/crypto/ripemd/asm/rm-win32.asm @@ -0,0 +1,1972 @@ + ; Don't even think of reading this code + ; It was automatically generated by rmd-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE rmd-586.asm + .386 +.model FLAT +_TEXT SEGMENT +PUBLIC _ripemd160_block_x86 + +_ripemd160_block_x86 PROC NEAR + push esi + mov ecx, DWORD PTR 16[esp] + push edi + mov esi, DWORD PTR 16[esp] + push ebp + add ecx, esi + push ebx + sub ecx, 64 + sub esp, 88 + mov DWORD PTR [esp],ecx + mov edi, DWORD PTR 108[esp] +L000start: + ; + mov eax, DWORD PTR [esi] + mov ebx, DWORD PTR 4[esi] + mov DWORD PTR 4[esp],eax + mov DWORD PTR 8[esp],ebx + mov eax, DWORD PTR 8[esi] + mov ebx, DWORD PTR 12[esi] + mov DWORD PTR 12[esp],eax + mov DWORD PTR 16[esp],ebx + mov eax, DWORD PTR 16[esi] + mov ebx, DWORD PTR 20[esi] + mov DWORD PTR 20[esp],eax + mov DWORD PTR 24[esp],ebx + mov eax, DWORD PTR 24[esi] + mov ebx, DWORD PTR 28[esi] + mov DWORD PTR 28[esp],eax + mov DWORD PTR 32[esp],ebx + mov eax, DWORD PTR 32[esi] + mov ebx, DWORD PTR 36[esi] + mov DWORD PTR 36[esp],eax + mov DWORD PTR 40[esp],ebx + mov eax, DWORD PTR 40[esi] + mov ebx, DWORD PTR 44[esi] + mov DWORD PTR 44[esp],eax + mov DWORD PTR 48[esp],ebx + mov eax, DWORD PTR 48[esi] + mov ebx, DWORD PTR 52[esi] + mov DWORD PTR 52[esp],eax + mov DWORD PTR 56[esp],ebx + mov eax, DWORD PTR 56[esi] + mov ebx, DWORD PTR 60[esi] + mov DWORD PTR 60[esp],eax + mov DWORD PTR 64[esp],ebx + add esi, 64 + mov eax, DWORD PTR [edi] + mov DWORD PTR 112[esp],esi + mov ebx, DWORD PTR 4[edi] + mov ecx, DWORD PTR 8[edi] + mov edx, DWORD PTR 12[edi] + mov ebp, DWORD PTR 16[edi] + ; 0 + mov esi, ecx + xor esi, edx + mov edi, DWORD PTR 4[esp] + xor esi, ebx + add eax, edi + rol ecx, 10 + add eax, esi + mov esi, ebx + rol eax, 11 + add eax, ebp + ; 1 + xor esi, ecx + mov edi, DWORD PTR 8[esp] + xor esi, eax + add ebp, esi + mov esi, eax + rol ebx, 10 + add ebp, edi + xor esi, ebx + rol ebp, 14 + add ebp, edx + ; 2 + mov edi, DWORD PTR 12[esp] + xor esi, ebp + add edx, edi + rol eax, 10 + add edx, esi + mov esi, ebp + rol edx, 15 + add edx, ecx + ; 3 + xor esi, eax + mov edi, DWORD PTR 16[esp] + xor esi, edx + add ecx, esi + mov esi, edx + rol ebp, 10 + add ecx, edi + xor esi, ebp + rol ecx, 12 + add ecx, ebx + ; 4 + mov edi, DWORD PTR 20[esp] + xor esi, ecx + add ebx, edi + rol edx, 10 + add ebx, esi + mov esi, ecx + rol ebx, 5 + add ebx, eax + ; 5 + xor esi, edx + mov edi, DWORD PTR 24[esp] + xor esi, ebx + add eax, esi + mov esi, ebx + rol ecx, 10 + add eax, edi + xor esi, ecx + rol eax, 8 + add eax, ebp + ; 6 + mov edi, DWORD PTR 28[esp] + xor esi, eax + add ebp, edi + rol ebx, 10 + add ebp, esi + mov esi, eax + rol ebp, 7 + add ebp, edx + ; 7 + xor esi, ebx + mov edi, DWORD PTR 32[esp] + xor esi, ebp + add edx, esi + mov esi, ebp + rol eax, 10 + add edx, edi + xor esi, eax + rol edx, 9 + add edx, ecx + ; 8 + mov edi, DWORD PTR 36[esp] + xor esi, edx + add ecx, edi + rol ebp, 10 + add ecx, esi + mov esi, edx + rol ecx, 11 + add ecx, ebx + ; 9 + xor esi, ebp + mov edi, DWORD PTR 40[esp] + xor esi, ecx + add ebx, esi + mov esi, ecx + rol edx, 10 + add ebx, edi + xor esi, edx + rol ebx, 13 + add ebx, eax + ; 10 + mov edi, DWORD PTR 44[esp] + xor esi, ebx + add eax, edi + rol ecx, 10 + add eax, esi + mov esi, ebx + rol eax, 14 + add eax, ebp + ; 11 + xor esi, ecx + mov edi, DWORD PTR 48[esp] + xor esi, eax + add ebp, esi + mov esi, eax + rol ebx, 10 + add ebp, edi + xor esi, ebx + rol ebp, 15 + add ebp, edx + ; 12 + mov edi, DWORD PTR 52[esp] + xor esi, ebp + add edx, edi + rol eax, 10 + add edx, esi + mov esi, ebp + rol edx, 6 + add edx, ecx + ; 13 + xor esi, eax + mov edi, DWORD PTR 56[esp] + xor esi, edx + add ecx, esi + mov esi, edx + rol ebp, 10 + add ecx, edi + xor esi, ebp + rol ecx, 7 + add ecx, ebx + ; 14 + mov edi, DWORD PTR 60[esp] + xor esi, ecx + add ebx, edi + rol edx, 10 + add ebx, esi + mov esi, ecx + rol ebx, 9 + add ebx, eax + ; 15 + xor esi, edx + mov edi, DWORD PTR 64[esp] + xor esi, ebx + add eax, esi + mov esi, -1 + rol ecx, 10 + add eax, edi + mov edi, DWORD PTR 32[esp] + rol eax, 8 + add eax, ebp + ; 16 + add ebp, edi + mov edi, ebx + sub esi, eax + and edi, eax + and esi, ecx + or edi, esi + mov esi, DWORD PTR 20[esp] + rol ebx, 10 + lea ebp, DWORD PTR 1518500249[edi*1+ebp] + mov edi, -1 + rol ebp, 7 + add ebp, edx + ; 17 + add edx, esi + mov esi, eax + sub edi, ebp + and esi, ebp + and edi, ebx + or esi, edi + mov edi, DWORD PTR 56[esp] + rol eax, 10 + lea edx, DWORD PTR 1518500249[esi*1+edx] + mov esi, -1 + rol edx, 6 + add edx, ecx + ; 18 + add ecx, edi + mov edi, ebp + sub esi, edx + and edi, edx + and esi, eax + or edi, esi + mov esi, DWORD PTR 8[esp] + rol ebp, 10 + lea ecx, DWORD PTR 1518500249[edi*1+ecx] + mov edi, -1 + rol ecx, 8 + add ecx, ebx + ; 19 + add ebx, esi + mov esi, edx + sub edi, ecx + and esi, ecx + and edi, ebp + or esi, edi + mov edi, DWORD PTR 44[esp] + rol edx, 10 + lea ebx, DWORD PTR 1518500249[esi*1+ebx] + mov esi, -1 + rol ebx, 13 + add ebx, eax + ; 20 + add eax, edi + mov edi, ecx + sub esi, ebx + and edi, ebx + and esi, edx + or edi, esi + mov esi, DWORD PTR 28[esp] + rol ecx, 10 + lea eax, DWORD PTR 1518500249[edi*1+eax] + mov edi, -1 + rol eax, 11 + add eax, ebp + ; 21 + add ebp, esi + mov esi, ebx + sub edi, eax + and esi, eax + and edi, ecx + or esi, edi + mov edi, DWORD PTR 64[esp] + rol ebx, 10 + lea ebp, DWORD PTR 1518500249[esi*1+ebp] + mov esi, -1 + rol ebp, 9 + add ebp, edx + ; 22 + add edx, edi + mov edi, eax + sub esi, ebp + and edi, ebp + and esi, ebx + or edi, esi + mov esi, DWORD PTR 16[esp] + rol eax, 10 + lea edx, DWORD PTR 1518500249[edi*1+edx] + mov edi, -1 + rol edx, 7 + add edx, ecx + ; 23 + add ecx, esi + mov esi, ebp + sub edi, edx + and esi, edx + and edi, eax + or esi, edi + mov edi, DWORD PTR 52[esp] + rol ebp, 10 + lea ecx, DWORD PTR 1518500249[esi*1+ecx] + mov esi, -1 + rol ecx, 15 + add ecx, ebx + ; 24 + add ebx, edi + mov edi, edx + sub esi, ecx + and edi, ecx + and esi, ebp + or edi, esi + mov esi, DWORD PTR 4[esp] + rol edx, 10 + lea ebx, DWORD PTR 1518500249[edi*1+ebx] + mov edi, -1 + rol ebx, 7 + add ebx, eax + ; 25 + add eax, esi + mov esi, ecx + sub edi, ebx + and esi, ebx + and edi, edx + or esi, edi + mov edi, DWORD PTR 40[esp] + rol ecx, 10 + lea eax, DWORD PTR 1518500249[esi*1+eax] + mov esi, -1 + rol eax, 12 + add eax, ebp + ; 26 + add ebp, edi + mov edi, ebx + sub esi, eax + and edi, eax + and esi, ecx + or edi, esi + mov esi, DWORD PTR 24[esp] + rol ebx, 10 + lea ebp, DWORD PTR 1518500249[edi*1+ebp] + mov edi, -1 + rol ebp, 15 + add ebp, edx + ; 27 + add edx, esi + mov esi, eax + sub edi, ebp + and esi, ebp + and edi, ebx + or esi, edi + mov edi, DWORD PTR 12[esp] + rol eax, 10 + lea edx, DWORD PTR 1518500249[esi*1+edx] + mov esi, -1 + rol edx, 9 + add edx, ecx + ; 28 + add ecx, edi + mov edi, ebp + sub esi, edx + and edi, edx + and esi, eax + or edi, esi + mov esi, DWORD PTR 60[esp] + rol ebp, 10 + lea ecx, DWORD PTR 1518500249[edi*1+ecx] + mov edi, -1 + rol ecx, 11 + add ecx, ebx + ; 29 + add ebx, esi + mov esi, edx + sub edi, ecx + and esi, ecx + and edi, ebp + or esi, edi + mov edi, DWORD PTR 48[esp] + rol edx, 10 + lea ebx, DWORD PTR 1518500249[esi*1+ebx] + mov esi, -1 + rol ebx, 7 + add ebx, eax + ; 30 + add eax, edi + mov edi, ecx + sub esi, ebx + and edi, ebx + and esi, edx + or edi, esi + mov esi, DWORD PTR 36[esp] + rol ecx, 10 + lea eax, DWORD PTR 1518500249[edi*1+eax] + mov edi, -1 + rol eax, 13 + add eax, ebp + ; 31 + add ebp, esi + mov esi, ebx + sub edi, eax + and esi, eax + and edi, ecx + or esi, edi + mov edi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1518500249[esi*1+ebp] + sub edi, eax + rol ebp, 12 + add ebp, edx + ; 32 + mov esi, DWORD PTR 16[esp] + or edi, ebp + add edx, esi + xor edi, ebx + mov esi, -1 + rol eax, 10 + lea edx, DWORD PTR 1859775393[edi*1+edx] + sub esi, ebp + rol edx, 11 + add edx, ecx + ; 33 + mov edi, DWORD PTR 44[esp] + or esi, edx + add ecx, edi + xor esi, eax + mov edi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1859775393[esi*1+ecx] + sub edi, edx + rol ecx, 13 + add ecx, ebx + ; 34 + mov esi, DWORD PTR 60[esp] + or edi, ecx + add ebx, esi + xor edi, ebp + mov esi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1859775393[edi*1+ebx] + sub esi, ecx + rol ebx, 6 + add ebx, eax + ; 35 + mov edi, DWORD PTR 20[esp] + or esi, ebx + add eax, edi + xor esi, edx + mov edi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1859775393[esi*1+eax] + sub edi, ebx + rol eax, 7 + add eax, ebp + ; 36 + mov esi, DWORD PTR 40[esp] + or edi, eax + add ebp, esi + xor edi, ecx + mov esi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1859775393[edi*1+ebp] + sub esi, eax + rol ebp, 14 + add ebp, edx + ; 37 + mov edi, DWORD PTR 64[esp] + or esi, ebp + add edx, edi + xor esi, ebx + mov edi, -1 + rol eax, 10 + lea edx, DWORD PTR 1859775393[esi*1+edx] + sub edi, ebp + rol edx, 9 + add edx, ecx + ; 38 + mov esi, DWORD PTR 36[esp] + or edi, edx + add ecx, esi + xor edi, eax + mov esi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1859775393[edi*1+ecx] + sub esi, edx + rol ecx, 13 + add ecx, ebx + ; 39 + mov edi, DWORD PTR 8[esp] + or esi, ecx + add ebx, edi + xor esi, ebp + mov edi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1859775393[esi*1+ebx] + sub edi, ecx + rol ebx, 15 + add ebx, eax + ; 40 + mov esi, DWORD PTR 12[esp] + or edi, ebx + add eax, esi + xor edi, edx + mov esi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1859775393[edi*1+eax] + sub esi, ebx + rol eax, 14 + add eax, ebp + ; 41 + mov edi, DWORD PTR 32[esp] + or esi, eax + add ebp, edi + xor esi, ecx + mov edi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1859775393[esi*1+ebp] + sub edi, eax + rol ebp, 8 + add ebp, edx + ; 42 + mov esi, DWORD PTR 4[esp] + or edi, ebp + add edx, esi + xor edi, ebx + mov esi, -1 + rol eax, 10 + lea edx, DWORD PTR 1859775393[edi*1+edx] + sub esi, ebp + rol edx, 13 + add edx, ecx + ; 43 + mov edi, DWORD PTR 28[esp] + or esi, edx + add ecx, edi + xor esi, eax + mov edi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1859775393[esi*1+ecx] + sub edi, edx + rol ecx, 6 + add ecx, ebx + ; 44 + mov esi, DWORD PTR 56[esp] + or edi, ecx + add ebx, esi + xor edi, ebp + mov esi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1859775393[edi*1+ebx] + sub esi, ecx + rol ebx, 5 + add ebx, eax + ; 45 + mov edi, DWORD PTR 48[esp] + or esi, ebx + add eax, edi + xor esi, edx + mov edi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1859775393[esi*1+eax] + sub edi, ebx + rol eax, 12 + add eax, ebp + ; 46 + mov esi, DWORD PTR 24[esp] + or edi, eax + add ebp, esi + xor edi, ecx + mov esi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1859775393[edi*1+ebp] + sub esi, eax + rol ebp, 7 + add ebp, edx + ; 47 + mov edi, DWORD PTR 52[esp] + or esi, ebp + add edx, edi + xor esi, ebx + mov edi, -1 + rol eax, 10 + lea edx, DWORD PTR 1859775393[esi*1+edx] + mov esi, eax + rol edx, 5 + add edx, ecx + ; 48 + sub edi, eax + and esi, edx + and edi, ebp + or edi, esi + mov esi, DWORD PTR 8[esp] + rol ebp, 10 + lea ecx, DWORD PTR 2400959708[edi+ecx] + mov edi, -1 + add ecx, esi + mov esi, ebp + rol ecx, 11 + add ecx, ebx + ; 49 + sub edi, ebp + and esi, ecx + and edi, edx + or edi, esi + mov esi, DWORD PTR 40[esp] + rol edx, 10 + lea ebx, DWORD PTR 2400959708[edi+ebx] + mov edi, -1 + add ebx, esi + mov esi, edx + rol ebx, 12 + add ebx, eax + ; 50 + sub edi, edx + and esi, ebx + and edi, ecx + or edi, esi + mov esi, DWORD PTR 48[esp] + rol ecx, 10 + lea eax, DWORD PTR 2400959708[edi+eax] + mov edi, -1 + add eax, esi + mov esi, ecx + rol eax, 14 + add eax, ebp + ; 51 + sub edi, ecx + and esi, eax + and edi, ebx + or edi, esi + mov esi, DWORD PTR 44[esp] + rol ebx, 10 + lea ebp, DWORD PTR 2400959708[edi+ebp] + mov edi, -1 + add ebp, esi + mov esi, ebx + rol ebp, 15 + add ebp, edx + ; 52 + sub edi, ebx + and esi, ebp + and edi, eax + or edi, esi + mov esi, DWORD PTR 4[esp] + rol eax, 10 + lea edx, DWORD PTR 2400959708[edi+edx] + mov edi, -1 + add edx, esi + mov esi, eax + rol edx, 14 + add edx, ecx + ; 53 + sub edi, eax + and esi, edx + and edi, ebp + or edi, esi + mov esi, DWORD PTR 36[esp] + rol ebp, 10 + lea ecx, DWORD PTR 2400959708[edi+ecx] + mov edi, -1 + add ecx, esi + mov esi, ebp + rol ecx, 15 + add ecx, ebx + ; 54 + sub edi, ebp + and esi, ecx + and edi, edx + or edi, esi + mov esi, DWORD PTR 52[esp] + rol edx, 10 + lea ebx, DWORD PTR 2400959708[edi+ebx] + mov edi, -1 + add ebx, esi + mov esi, edx + rol ebx, 9 + add ebx, eax + ; 55 + sub edi, edx + and esi, ebx + and edi, ecx + or edi, esi + mov esi, DWORD PTR 20[esp] + rol ecx, 10 + lea eax, DWORD PTR 2400959708[edi+eax] + mov edi, -1 + add eax, esi + mov esi, ecx + rol eax, 8 + add eax, ebp + ; 56 + sub edi, ecx + and esi, eax + and edi, ebx + or edi, esi + mov esi, DWORD PTR 56[esp] + rol ebx, 10 + lea ebp, DWORD PTR 2400959708[edi+ebp] + mov edi, -1 + add ebp, esi + mov esi, ebx + rol ebp, 9 + add ebp, edx + ; 57 + sub edi, ebx + and esi, ebp + and edi, eax + or edi, esi + mov esi, DWORD PTR 16[esp] + rol eax, 10 + lea edx, DWORD PTR 2400959708[edi+edx] + mov edi, -1 + add edx, esi + mov esi, eax + rol edx, 14 + add edx, ecx + ; 58 + sub edi, eax + and esi, edx + and edi, ebp + or edi, esi + mov esi, DWORD PTR 32[esp] + rol ebp, 10 + lea ecx, DWORD PTR 2400959708[edi+ecx] + mov edi, -1 + add ecx, esi + mov esi, ebp + rol ecx, 5 + add ecx, ebx + ; 59 + sub edi, ebp + and esi, ecx + and edi, edx + or edi, esi + mov esi, DWORD PTR 64[esp] + rol edx, 10 + lea ebx, DWORD PTR 2400959708[edi+ebx] + mov edi, -1 + add ebx, esi + mov esi, edx + rol ebx, 6 + add ebx, eax + ; 60 + sub edi, edx + and esi, ebx + and edi, ecx + or edi, esi + mov esi, DWORD PTR 60[esp] + rol ecx, 10 + lea eax, DWORD PTR 2400959708[edi+eax] + mov edi, -1 + add eax, esi + mov esi, ecx + rol eax, 8 + add eax, ebp + ; 61 + sub edi, ecx + and esi, eax + and edi, ebx + or edi, esi + mov esi, DWORD PTR 24[esp] + rol ebx, 10 + lea ebp, DWORD PTR 2400959708[edi+ebp] + mov edi, -1 + add ebp, esi + mov esi, ebx + rol ebp, 6 + add ebp, edx + ; 62 + sub edi, ebx + and esi, ebp + and edi, eax + or edi, esi + mov esi, DWORD PTR 28[esp] + rol eax, 10 + lea edx, DWORD PTR 2400959708[edi+edx] + mov edi, -1 + add edx, esi + mov esi, eax + rol edx, 5 + add edx, ecx + ; 63 + sub edi, eax + and esi, edx + and edi, ebp + or edi, esi + mov esi, DWORD PTR 12[esp] + rol ebp, 10 + lea ecx, DWORD PTR 2400959708[edi+ecx] + mov edi, -1 + add ecx, esi + sub edi, ebp + rol ecx, 12 + add ecx, ebx + ; 64 + mov esi, DWORD PTR 20[esp] + or edi, edx + add ebx, esi + xor edi, ecx + mov esi, -1 + rol edx, 10 + lea ebx, DWORD PTR 2840853838[edi*1+ebx] + sub esi, edx + rol ebx, 9 + add ebx, eax + ; 65 + mov edi, DWORD PTR 4[esp] + or esi, ecx + add eax, edi + xor esi, ebx + mov edi, -1 + rol ecx, 10 + lea eax, DWORD PTR 2840853838[esi*1+eax] + sub edi, ecx + rol eax, 15 + add eax, ebp + ; 66 + mov esi, DWORD PTR 24[esp] + or edi, ebx + add ebp, esi + xor edi, eax + mov esi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 2840853838[edi*1+ebp] + sub esi, ebx + rol ebp, 5 + add ebp, edx + ; 67 + mov edi, DWORD PTR 40[esp] + or esi, eax + add edx, edi + xor esi, ebp + mov edi, -1 + rol eax, 10 + lea edx, DWORD PTR 2840853838[esi*1+edx] + sub edi, eax + rol edx, 11 + add edx, ecx + ; 68 + mov esi, DWORD PTR 32[esp] + or edi, ebp + add ecx, esi + xor edi, edx + mov esi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 2840853838[edi*1+ecx] + sub esi, ebp + rol ecx, 6 + add ecx, ebx + ; 69 + mov edi, DWORD PTR 52[esp] + or esi, edx + add ebx, edi + xor esi, ecx + mov edi, -1 + rol edx, 10 + lea ebx, DWORD PTR 2840853838[esi*1+ebx] + sub edi, edx + rol ebx, 8 + add ebx, eax + ; 70 + mov esi, DWORD PTR 12[esp] + or edi, ecx + add eax, esi + xor edi, ebx + mov esi, -1 + rol ecx, 10 + lea eax, DWORD PTR 2840853838[edi*1+eax] + sub esi, ecx + rol eax, 13 + add eax, ebp + ; 71 + mov edi, DWORD PTR 44[esp] + or esi, ebx + add ebp, edi + xor esi, eax + mov edi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 2840853838[esi*1+ebp] + sub edi, ebx + rol ebp, 12 + add ebp, edx + ; 72 + mov esi, DWORD PTR 60[esp] + or edi, eax + add edx, esi + xor edi, ebp + mov esi, -1 + rol eax, 10 + lea edx, DWORD PTR 2840853838[edi*1+edx] + sub esi, eax + rol edx, 5 + add edx, ecx + ; 73 + mov edi, DWORD PTR 8[esp] + or esi, ebp + add ecx, edi + xor esi, edx + mov edi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 2840853838[esi*1+ecx] + sub edi, ebp + rol ecx, 12 + add ecx, ebx + ; 74 + mov esi, DWORD PTR 16[esp] + or edi, edx + add ebx, esi + xor edi, ecx + mov esi, -1 + rol edx, 10 + lea ebx, DWORD PTR 2840853838[edi*1+ebx] + sub esi, edx + rol ebx, 13 + add ebx, eax + ; 75 + mov edi, DWORD PTR 36[esp] + or esi, ecx + add eax, edi + xor esi, ebx + mov edi, -1 + rol ecx, 10 + lea eax, DWORD PTR 2840853838[esi*1+eax] + sub edi, ecx + rol eax, 14 + add eax, ebp + ; 76 + mov esi, DWORD PTR 48[esp] + or edi, ebx + add ebp, esi + xor edi, eax + mov esi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 2840853838[edi*1+ebp] + sub esi, ebx + rol ebp, 11 + add ebp, edx + ; 77 + mov edi, DWORD PTR 28[esp] + or esi, eax + add edx, edi + xor esi, ebp + mov edi, -1 + rol eax, 10 + lea edx, DWORD PTR 2840853838[esi*1+edx] + sub edi, eax + rol edx, 8 + add edx, ecx + ; 78 + mov esi, DWORD PTR 64[esp] + or edi, ebp + add ecx, esi + xor edi, edx + mov esi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 2840853838[edi*1+ecx] + sub esi, ebp + rol ecx, 5 + add ecx, ebx + ; 79 + mov edi, DWORD PTR 56[esp] + or esi, edx + add ebx, edi + xor esi, ecx + mov edi, DWORD PTR 108[esp] + rol edx, 10 + lea ebx, DWORD PTR 2840853838[esi*1+ebx] + mov DWORD PTR 68[esp],eax + rol ebx, 6 + add ebx, eax + mov eax, DWORD PTR [edi] + mov DWORD PTR 72[esp],ebx + mov DWORD PTR 76[esp],ecx + mov ebx, DWORD PTR 4[edi] + mov DWORD PTR 80[esp],edx + mov ecx, DWORD PTR 8[edi] + mov DWORD PTR 84[esp],ebp + mov edx, DWORD PTR 12[edi] + mov ebp, DWORD PTR 16[edi] + ; 80 + mov edi, -1 + sub edi, edx + mov esi, DWORD PTR 24[esp] + or edi, ecx + add eax, esi + xor edi, ebx + mov esi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1352829926[edi*1+eax] + sub esi, ecx + rol eax, 8 + add eax, ebp + ; 81 + mov edi, DWORD PTR 60[esp] + or esi, ebx + add ebp, edi + xor esi, eax + mov edi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1352829926[esi*1+ebp] + sub edi, ebx + rol ebp, 9 + add ebp, edx + ; 82 + mov esi, DWORD PTR 32[esp] + or edi, eax + add edx, esi + xor edi, ebp + mov esi, -1 + rol eax, 10 + lea edx, DWORD PTR 1352829926[edi*1+edx] + sub esi, eax + rol edx, 9 + add edx, ecx + ; 83 + mov edi, DWORD PTR 4[esp] + or esi, ebp + add ecx, edi + xor esi, edx + mov edi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1352829926[esi*1+ecx] + sub edi, ebp + rol ecx, 11 + add ecx, ebx + ; 84 + mov esi, DWORD PTR 40[esp] + or edi, edx + add ebx, esi + xor edi, ecx + mov esi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1352829926[edi*1+ebx] + sub esi, edx + rol ebx, 13 + add ebx, eax + ; 85 + mov edi, DWORD PTR 12[esp] + or esi, ecx + add eax, edi + xor esi, ebx + mov edi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1352829926[esi*1+eax] + sub edi, ecx + rol eax, 15 + add eax, ebp + ; 86 + mov esi, DWORD PTR 48[esp] + or edi, ebx + add ebp, esi + xor edi, eax + mov esi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1352829926[edi*1+ebp] + sub esi, ebx + rol ebp, 15 + add ebp, edx + ; 87 + mov edi, DWORD PTR 20[esp] + or esi, eax + add edx, edi + xor esi, ebp + mov edi, -1 + rol eax, 10 + lea edx, DWORD PTR 1352829926[esi*1+edx] + sub edi, eax + rol edx, 5 + add edx, ecx + ; 88 + mov esi, DWORD PTR 56[esp] + or edi, ebp + add ecx, esi + xor edi, edx + mov esi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1352829926[edi*1+ecx] + sub esi, ebp + rol ecx, 7 + add ecx, ebx + ; 89 + mov edi, DWORD PTR 28[esp] + or esi, edx + add ebx, edi + xor esi, ecx + mov edi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1352829926[esi*1+ebx] + sub edi, edx + rol ebx, 7 + add ebx, eax + ; 90 + mov esi, DWORD PTR 64[esp] + or edi, ecx + add eax, esi + xor edi, ebx + mov esi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1352829926[edi*1+eax] + sub esi, ecx + rol eax, 8 + add eax, ebp + ; 91 + mov edi, DWORD PTR 36[esp] + or esi, ebx + add ebp, edi + xor esi, eax + mov edi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1352829926[esi*1+ebp] + sub edi, ebx + rol ebp, 11 + add ebp, edx + ; 92 + mov esi, DWORD PTR 8[esp] + or edi, eax + add edx, esi + xor edi, ebp + mov esi, -1 + rol eax, 10 + lea edx, DWORD PTR 1352829926[edi*1+edx] + sub esi, eax + rol edx, 14 + add edx, ecx + ; 93 + mov edi, DWORD PTR 44[esp] + or esi, ebp + add ecx, edi + xor esi, edx + mov edi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1352829926[esi*1+ecx] + sub edi, ebp + rol ecx, 14 + add ecx, ebx + ; 94 + mov esi, DWORD PTR 16[esp] + or edi, edx + add ebx, esi + xor edi, ecx + mov esi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1352829926[edi*1+ebx] + sub esi, edx + rol ebx, 12 + add ebx, eax + ; 95 + mov edi, DWORD PTR 52[esp] + or esi, ecx + add eax, edi + xor esi, ebx + mov edi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1352829926[esi*1+eax] + mov esi, ecx + rol eax, 6 + add eax, ebp + ; 96 + sub edi, ecx + and esi, eax + and edi, ebx + or edi, esi + mov esi, DWORD PTR 28[esp] + rol ebx, 10 + lea ebp, DWORD PTR 1548603684[edi+ebp] + mov edi, -1 + add ebp, esi + mov esi, ebx + rol ebp, 9 + add ebp, edx + ; 97 + sub edi, ebx + and esi, ebp + and edi, eax + or edi, esi + mov esi, DWORD PTR 48[esp] + rol eax, 10 + lea edx, DWORD PTR 1548603684[edi+edx] + mov edi, -1 + add edx, esi + mov esi, eax + rol edx, 13 + add edx, ecx + ; 98 + sub edi, eax + and esi, edx + and edi, ebp + or edi, esi + mov esi, DWORD PTR 16[esp] + rol ebp, 10 + lea ecx, DWORD PTR 1548603684[edi+ecx] + mov edi, -1 + add ecx, esi + mov esi, ebp + rol ecx, 15 + add ecx, ebx + ; 99 + sub edi, ebp + and esi, ecx + and edi, edx + or edi, esi + mov esi, DWORD PTR 32[esp] + rol edx, 10 + lea ebx, DWORD PTR 1548603684[edi+ebx] + mov edi, -1 + add ebx, esi + mov esi, edx + rol ebx, 7 + add ebx, eax + ; 100 + sub edi, edx + and esi, ebx + and edi, ecx + or edi, esi + mov esi, DWORD PTR 4[esp] + rol ecx, 10 + lea eax, DWORD PTR 1548603684[edi+eax] + mov edi, -1 + add eax, esi + mov esi, ecx + rol eax, 12 + add eax, ebp + ; 101 + sub edi, ecx + and esi, eax + and edi, ebx + or edi, esi + mov esi, DWORD PTR 56[esp] + rol ebx, 10 + lea ebp, DWORD PTR 1548603684[edi+ebp] + mov edi, -1 + add ebp, esi + mov esi, ebx + rol ebp, 8 + add ebp, edx + ; 102 + sub edi, ebx + and esi, ebp + and edi, eax + or edi, esi + mov esi, DWORD PTR 24[esp] + rol eax, 10 + lea edx, DWORD PTR 1548603684[edi+edx] + mov edi, -1 + add edx, esi + mov esi, eax + rol edx, 9 + add edx, ecx + ; 103 + sub edi, eax + and esi, edx + and edi, ebp + or edi, esi + mov esi, DWORD PTR 44[esp] + rol ebp, 10 + lea ecx, DWORD PTR 1548603684[edi+ecx] + mov edi, -1 + add ecx, esi + mov esi, ebp + rol ecx, 11 + add ecx, ebx + ; 104 + sub edi, ebp + and esi, ecx + and edi, edx + or edi, esi + mov esi, DWORD PTR 60[esp] + rol edx, 10 + lea ebx, DWORD PTR 1548603684[edi+ebx] + mov edi, -1 + add ebx, esi + mov esi, edx + rol ebx, 7 + add ebx, eax + ; 105 + sub edi, edx + and esi, ebx + and edi, ecx + or edi, esi + mov esi, DWORD PTR 64[esp] + rol ecx, 10 + lea eax, DWORD PTR 1548603684[edi+eax] + mov edi, -1 + add eax, esi + mov esi, ecx + rol eax, 7 + add eax, ebp + ; 106 + sub edi, ecx + and esi, eax + and edi, ebx + or edi, esi + mov esi, DWORD PTR 36[esp] + rol ebx, 10 + lea ebp, DWORD PTR 1548603684[edi+ebp] + mov edi, -1 + add ebp, esi + mov esi, ebx + rol ebp, 12 + add ebp, edx + ; 107 + sub edi, ebx + and esi, ebp + and edi, eax + or edi, esi + mov esi, DWORD PTR 52[esp] + rol eax, 10 + lea edx, DWORD PTR 1548603684[edi+edx] + mov edi, -1 + add edx, esi + mov esi, eax + rol edx, 7 + add edx, ecx + ; 108 + sub edi, eax + and esi, edx + and edi, ebp + or edi, esi + mov esi, DWORD PTR 20[esp] + rol ebp, 10 + lea ecx, DWORD PTR 1548603684[edi+ecx] + mov edi, -1 + add ecx, esi + mov esi, ebp + rol ecx, 6 + add ecx, ebx + ; 109 + sub edi, ebp + and esi, ecx + and edi, edx + or edi, esi + mov esi, DWORD PTR 40[esp] + rol edx, 10 + lea ebx, DWORD PTR 1548603684[edi+ebx] + mov edi, -1 + add ebx, esi + mov esi, edx + rol ebx, 15 + add ebx, eax + ; 110 + sub edi, edx + and esi, ebx + and edi, ecx + or edi, esi + mov esi, DWORD PTR 8[esp] + rol ecx, 10 + lea eax, DWORD PTR 1548603684[edi+eax] + mov edi, -1 + add eax, esi + mov esi, ecx + rol eax, 13 + add eax, ebp + ; 111 + sub edi, ecx + and esi, eax + and edi, ebx + or edi, esi + mov esi, DWORD PTR 12[esp] + rol ebx, 10 + lea ebp, DWORD PTR 1548603684[edi+ebp] + mov edi, -1 + add ebp, esi + sub edi, eax + rol ebp, 11 + add ebp, edx + ; 112 + mov esi, DWORD PTR 64[esp] + or edi, ebp + add edx, esi + xor edi, ebx + mov esi, -1 + rol eax, 10 + lea edx, DWORD PTR 1836072691[edi*1+edx] + sub esi, ebp + rol edx, 9 + add edx, ecx + ; 113 + mov edi, DWORD PTR 24[esp] + or esi, edx + add ecx, edi + xor esi, eax + mov edi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1836072691[esi*1+ecx] + sub edi, edx + rol ecx, 7 + add ecx, ebx + ; 114 + mov esi, DWORD PTR 8[esp] + or edi, ecx + add ebx, esi + xor edi, ebp + mov esi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1836072691[edi*1+ebx] + sub esi, ecx + rol ebx, 15 + add ebx, eax + ; 115 + mov edi, DWORD PTR 16[esp] + or esi, ebx + add eax, edi + xor esi, edx + mov edi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1836072691[esi*1+eax] + sub edi, ebx + rol eax, 11 + add eax, ebp + ; 116 + mov esi, DWORD PTR 32[esp] + or edi, eax + add ebp, esi + xor edi, ecx + mov esi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1836072691[edi*1+ebp] + sub esi, eax + rol ebp, 8 + add ebp, edx + ; 117 + mov edi, DWORD PTR 60[esp] + or esi, ebp + add edx, edi + xor esi, ebx + mov edi, -1 + rol eax, 10 + lea edx, DWORD PTR 1836072691[esi*1+edx] + sub edi, ebp + rol edx, 6 + add edx, ecx + ; 118 + mov esi, DWORD PTR 28[esp] + or edi, edx + add ecx, esi + xor edi, eax + mov esi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1836072691[edi*1+ecx] + sub esi, edx + rol ecx, 6 + add ecx, ebx + ; 119 + mov edi, DWORD PTR 40[esp] + or esi, ecx + add ebx, edi + xor esi, ebp + mov edi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1836072691[esi*1+ebx] + sub edi, ecx + rol ebx, 14 + add ebx, eax + ; 120 + mov esi, DWORD PTR 48[esp] + or edi, ebx + add eax, esi + xor edi, edx + mov esi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1836072691[edi*1+eax] + sub esi, ebx + rol eax, 12 + add eax, ebp + ; 121 + mov edi, DWORD PTR 36[esp] + or esi, eax + add ebp, edi + xor esi, ecx + mov edi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1836072691[esi*1+ebp] + sub edi, eax + rol ebp, 13 + add ebp, edx + ; 122 + mov esi, DWORD PTR 52[esp] + or edi, ebp + add edx, esi + xor edi, ebx + mov esi, -1 + rol eax, 10 + lea edx, DWORD PTR 1836072691[edi*1+edx] + sub esi, ebp + rol edx, 5 + add edx, ecx + ; 123 + mov edi, DWORD PTR 12[esp] + or esi, edx + add ecx, edi + xor esi, eax + mov edi, -1 + rol ebp, 10 + lea ecx, DWORD PTR 1836072691[esi*1+ecx] + sub edi, edx + rol ecx, 14 + add ecx, ebx + ; 124 + mov esi, DWORD PTR 44[esp] + or edi, ecx + add ebx, esi + xor edi, ebp + mov esi, -1 + rol edx, 10 + lea ebx, DWORD PTR 1836072691[edi*1+ebx] + sub esi, ecx + rol ebx, 13 + add ebx, eax + ; 125 + mov edi, DWORD PTR 4[esp] + or esi, ebx + add eax, edi + xor esi, edx + mov edi, -1 + rol ecx, 10 + lea eax, DWORD PTR 1836072691[esi*1+eax] + sub edi, ebx + rol eax, 13 + add eax, ebp + ; 126 + mov esi, DWORD PTR 20[esp] + or edi, eax + add ebp, esi + xor edi, ecx + mov esi, -1 + rol ebx, 10 + lea ebp, DWORD PTR 1836072691[edi*1+ebp] + sub esi, eax + rol ebp, 7 + add ebp, edx + ; 127 + mov edi, DWORD PTR 56[esp] + or esi, ebp + add edx, edi + xor esi, ebx + mov edi, DWORD PTR 36[esp] + rol eax, 10 + lea edx, DWORD PTR 1836072691[esi*1+edx] + mov esi, -1 + rol edx, 5 + add edx, ecx + ; 128 + add ecx, edi + mov edi, ebp + sub esi, edx + and edi, edx + and esi, eax + or edi, esi + mov esi, DWORD PTR 28[esp] + rol ebp, 10 + lea ecx, DWORD PTR 2053994217[edi*1+ecx] + mov edi, -1 + rol ecx, 15 + add ecx, ebx + ; 129 + add ebx, esi + mov esi, edx + sub edi, ecx + and esi, ecx + and edi, ebp + or esi, edi + mov edi, DWORD PTR 20[esp] + rol edx, 10 + lea ebx, DWORD PTR 2053994217[esi*1+ebx] + mov esi, -1 + rol ebx, 5 + add ebx, eax + ; 130 + add eax, edi + mov edi, ecx + sub esi, ebx + and edi, ebx + and esi, edx + or edi, esi + mov esi, DWORD PTR 8[esp] + rol ecx, 10 + lea eax, DWORD PTR 2053994217[edi*1+eax] + mov edi, -1 + rol eax, 8 + add eax, ebp + ; 131 + add ebp, esi + mov esi, ebx + sub edi, eax + and esi, eax + and edi, ecx + or esi, edi + mov edi, DWORD PTR 16[esp] + rol ebx, 10 + lea ebp, DWORD PTR 2053994217[esi*1+ebp] + mov esi, -1 + rol ebp, 11 + add ebp, edx + ; 132 + add edx, edi + mov edi, eax + sub esi, ebp + and edi, ebp + and esi, ebx + or edi, esi + mov esi, DWORD PTR 48[esp] + rol eax, 10 + lea edx, DWORD PTR 2053994217[edi*1+edx] + mov edi, -1 + rol edx, 14 + add edx, ecx + ; 133 + add ecx, esi + mov esi, ebp + sub edi, edx + and esi, edx + and edi, eax + or esi, edi + mov edi, DWORD PTR 64[esp] + rol ebp, 10 + lea ecx, DWORD PTR 2053994217[esi*1+ecx] + mov esi, -1 + rol ecx, 14 + add ecx, ebx + ; 134 + add ebx, edi + mov edi, edx + sub esi, ecx + and edi, ecx + and esi, ebp + or edi, esi + mov esi, DWORD PTR 4[esp] + rol edx, 10 + lea ebx, DWORD PTR 2053994217[edi*1+ebx] + mov edi, -1 + rol ebx, 6 + add ebx, eax + ; 135 + add eax, esi + mov esi, ecx + sub edi, ebx + and esi, ebx + and edi, edx + or esi, edi + mov edi, DWORD PTR 24[esp] + rol ecx, 10 + lea eax, DWORD PTR 2053994217[esi*1+eax] + mov esi, -1 + rol eax, 14 + add eax, ebp + ; 136 + add ebp, edi + mov edi, ebx + sub esi, eax + and edi, eax + and esi, ecx + or edi, esi + mov esi, DWORD PTR 52[esp] + rol ebx, 10 + lea ebp, DWORD PTR 2053994217[edi*1+ebp] + mov edi, -1 + rol ebp, 6 + add ebp, edx + ; 137 + add edx, esi + mov esi, eax + sub edi, ebp + and esi, ebp + and edi, ebx + or esi, edi + mov edi, DWORD PTR 12[esp] + rol eax, 10 + lea edx, DWORD PTR 2053994217[esi*1+edx] + mov esi, -1 + rol edx, 9 + add edx, ecx + ; 138 + add ecx, edi + mov edi, ebp + sub esi, edx + and edi, edx + and esi, eax + or edi, esi + mov esi, DWORD PTR 56[esp] + rol ebp, 10 + lea ecx, DWORD PTR 2053994217[edi*1+ecx] + mov edi, -1 + rol ecx, 12 + add ecx, ebx + ; 139 + add ebx, esi + mov esi, edx + sub edi, ecx + and esi, ecx + and edi, ebp + or esi, edi + mov edi, DWORD PTR 40[esp] + rol edx, 10 + lea ebx, DWORD PTR 2053994217[esi*1+ebx] + mov esi, -1 + rol ebx, 9 + add ebx, eax + ; 140 + add eax, edi + mov edi, ecx + sub esi, ebx + and edi, ebx + and esi, edx + or edi, esi + mov esi, DWORD PTR 32[esp] + rol ecx, 10 + lea eax, DWORD PTR 2053994217[edi*1+eax] + mov edi, -1 + rol eax, 12 + add eax, ebp + ; 141 + add ebp, esi + mov esi, ebx + sub edi, eax + and esi, eax + and edi, ecx + or esi, edi + mov edi, DWORD PTR 44[esp] + rol ebx, 10 + lea ebp, DWORD PTR 2053994217[esi*1+ebp] + mov esi, -1 + rol ebp, 5 + add ebp, edx + ; 142 + add edx, edi + mov edi, eax + sub esi, ebp + and edi, ebp + and esi, ebx + or edi, esi + mov esi, DWORD PTR 60[esp] + rol eax, 10 + lea edx, DWORD PTR 2053994217[edi*1+edx] + mov edi, -1 + rol edx, 15 + add edx, ecx + ; 143 + add ecx, esi + mov esi, ebp + sub edi, edx + and esi, edx + and edi, eax + or edi, esi + mov esi, edx + rol ebp, 10 + lea ecx, DWORD PTR 2053994217[edi*1+ecx] + xor esi, ebp + rol ecx, 8 + add ecx, ebx + ; 144 + mov edi, DWORD PTR 52[esp] + xor esi, ecx + add ebx, edi + rol edx, 10 + add ebx, esi + mov esi, ecx + rol ebx, 8 + add ebx, eax + ; 145 + xor esi, edx + mov edi, DWORD PTR 64[esp] + xor esi, ebx + add eax, esi + mov esi, ebx + rol ecx, 10 + add eax, edi + xor esi, ecx + rol eax, 5 + add eax, ebp + ; 146 + mov edi, DWORD PTR 44[esp] + xor esi, eax + add ebp, edi + rol ebx, 10 + add ebp, esi + mov esi, eax + rol ebp, 12 + add ebp, edx + ; 147 + xor esi, ebx + mov edi, DWORD PTR 20[esp] + xor esi, ebp + add edx, esi + mov esi, ebp + rol eax, 10 + add edx, edi + xor esi, eax + rol edx, 9 + add edx, ecx + ; 148 + mov edi, DWORD PTR 8[esp] + xor esi, edx + add ecx, edi + rol ebp, 10 + add ecx, esi + mov esi, edx + rol ecx, 12 + add ecx, ebx + ; 149 + xor esi, ebp + mov edi, DWORD PTR 24[esp] + xor esi, ecx + add ebx, esi + mov esi, ecx + rol edx, 10 + add ebx, edi + xor esi, edx + rol ebx, 5 + add ebx, eax + ; 150 + mov edi, DWORD PTR 36[esp] + xor esi, ebx + add eax, edi + rol ecx, 10 + add eax, esi + mov esi, ebx + rol eax, 14 + add eax, ebp + ; 151 + xor esi, ecx + mov edi, DWORD PTR 32[esp] + xor esi, eax + add ebp, esi + mov esi, eax + rol ebx, 10 + add ebp, edi + xor esi, ebx + rol ebp, 6 + add ebp, edx + ; 152 + mov edi, DWORD PTR 28[esp] + xor esi, ebp + add edx, edi + rol eax, 10 + add edx, esi + mov esi, ebp + rol edx, 8 + add edx, ecx + ; 153 + xor esi, eax + mov edi, DWORD PTR 12[esp] + xor esi, edx + add ecx, esi + mov esi, edx + rol ebp, 10 + add ecx, edi + xor esi, ebp + rol ecx, 13 + add ecx, ebx + ; 154 + mov edi, DWORD PTR 56[esp] + xor esi, ecx + add ebx, edi + rol edx, 10 + add ebx, esi + mov esi, ecx + rol ebx, 6 + add ebx, eax + ; 155 + xor esi, edx + mov edi, DWORD PTR 60[esp] + xor esi, ebx + add eax, esi + mov esi, ebx + rol ecx, 10 + add eax, edi + xor esi, ecx + rol eax, 5 + add eax, ebp + ; 156 + mov edi, DWORD PTR 4[esp] + xor esi, eax + add ebp, edi + rol ebx, 10 + add ebp, esi + mov esi, eax + rol ebp, 15 + add ebp, edx + ; 157 + xor esi, ebx + mov edi, DWORD PTR 16[esp] + xor esi, ebp + add edx, esi + mov esi, ebp + rol eax, 10 + add edx, edi + xor esi, eax + rol edx, 13 + add edx, ecx + ; 158 + mov edi, DWORD PTR 40[esp] + xor esi, edx + add ecx, edi + rol ebp, 10 + add ecx, esi + mov esi, edx + rol ecx, 11 + add ecx, ebx + ; 159 + xor esi, ebp + mov edi, DWORD PTR 48[esp] + xor esi, ecx + add ebx, esi + rol edx, 10 + add ebx, edi + mov edi, DWORD PTR 108[esp] + rol ebx, 11 + add ebx, eax + mov esi, DWORD PTR 4[edi] + add edx, esi + mov esi, DWORD PTR 76[esp] + add edx, esi + mov esi, DWORD PTR 8[edi] + add ebp, esi + mov esi, DWORD PTR 80[esp] + add ebp, esi + mov esi, DWORD PTR 12[edi] + add eax, esi + mov esi, DWORD PTR 84[esp] + add eax, esi + mov esi, DWORD PTR 16[edi] + add ebx, esi + mov esi, DWORD PTR 68[esp] + add ebx, esi + mov esi, DWORD PTR [edi] + add ecx, esi + mov esi, DWORD PTR 72[esp] + add ecx, esi + mov DWORD PTR [edi],edx + mov DWORD PTR 4[edi],ebp + mov DWORD PTR 8[edi],eax + mov DWORD PTR 12[edi],ebx + mov DWORD PTR 16[edi],ecx + mov edi, DWORD PTR [esp] + mov esi, DWORD PTR 112[esp] + cmp edi, esi + mov edi, DWORD PTR 108[esp] + jge L000start + add esp, 88 + pop ebx + pop ebp + pop edi + pop esi + ret +_ripemd160_block_x86 ENDP +_TEXT ENDS +END diff --git a/src/lib/libssl/src/crypto/ripemd/asm/rm86unix.cpp b/src/lib/libssl/src/crypto/ripemd/asm/rm86unix.cpp new file mode 100644 index 0000000000..f90f6f2fd6 --- /dev/null +++ b/src/lib/libssl/src/crypto/ripemd/asm/rm86unix.cpp @@ -0,0 +1,2016 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define ripemd160_block_x86 _ripemd160_block_x86 + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by rmd-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "rmd-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl ripemd160_block_x86 + TYPE(ripemd160_block_x86,@function) +ripemd160_block_x86: + pushl %esi + movl 16(%esp), %ecx + pushl %edi + movl 16(%esp), %esi + pushl %ebp + addl %esi, %ecx + pushl %ebx + subl $64, %ecx + subl $88, %esp + movl %ecx, (%esp) + movl 108(%esp), %edi +.L000start: + + movl (%esi), %eax + movl 4(%esi), %ebx + movl %eax, 4(%esp) + movl %ebx, 8(%esp) + movl 8(%esi), %eax + movl 12(%esi), %ebx + movl %eax, 12(%esp) + movl %ebx, 16(%esp) + movl 16(%esi), %eax + movl 20(%esi), %ebx + movl %eax, 20(%esp) + movl %ebx, 24(%esp) + movl 24(%esi), %eax + movl 28(%esi), %ebx + movl %eax, 28(%esp) + movl %ebx, 32(%esp) + movl 32(%esi), %eax + movl 36(%esi), %ebx + movl %eax, 36(%esp) + movl %ebx, 40(%esp) + movl 40(%esi), %eax + movl 44(%esi), %ebx + movl %eax, 44(%esp) + movl %ebx, 48(%esp) + movl 48(%esi), %eax + movl 52(%esi), %ebx + movl %eax, 52(%esp) + movl %ebx, 56(%esp) + movl 56(%esi), %eax + movl 60(%esi), %ebx + movl %eax, 60(%esp) + movl %ebx, 64(%esp) + addl $64, %esi + movl (%edi), %eax + movl %esi, 112(%esp) + movl 4(%edi), %ebx + movl 8(%edi), %ecx + movl 12(%edi), %edx + movl 16(%edi), %ebp + /* 0 */ + movl %ecx, %esi + xorl %edx, %esi + movl 4(%esp), %edi + xorl %ebx, %esi + addl %edi, %eax + roll $10, %ecx + addl %esi, %eax + movl %ebx, %esi + roll $11, %eax + addl %ebp, %eax + /* 1 */ + xorl %ecx, %esi + movl 8(%esp), %edi + xorl %eax, %esi + addl %esi, %ebp + movl %eax, %esi + roll $10, %ebx + addl %edi, %ebp + xorl %ebx, %esi + roll $14, %ebp + addl %edx, %ebp + /* 2 */ + movl 12(%esp), %edi + xorl %ebp, %esi + addl %edi, %edx + roll $10, %eax + addl %esi, %edx + movl %ebp, %esi + roll $15, %edx + addl %ecx, %edx + /* 3 */ + xorl %eax, %esi + movl 16(%esp), %edi + xorl %edx, %esi + addl %esi, %ecx + movl %edx, %esi + roll $10, %ebp + addl %edi, %ecx + xorl %ebp, %esi + roll $12, %ecx + addl %ebx, %ecx + /* 4 */ + movl 20(%esp), %edi + xorl %ecx, %esi + addl %edi, %ebx + roll $10, %edx + addl %esi, %ebx + movl %ecx, %esi + roll $5, %ebx + addl %eax, %ebx + /* 5 */ + xorl %edx, %esi + movl 24(%esp), %edi + xorl %ebx, %esi + addl %esi, %eax + movl %ebx, %esi + roll $10, %ecx + addl %edi, %eax + xorl %ecx, %esi + roll $8, %eax + addl %ebp, %eax + /* 6 */ + movl 28(%esp), %edi + xorl %eax, %esi + addl %edi, %ebp + roll $10, %ebx + addl %esi, %ebp + movl %eax, %esi + roll $7, %ebp + addl %edx, %ebp + /* 7 */ + xorl %ebx, %esi + movl 32(%esp), %edi + xorl %ebp, %esi + addl %esi, %edx + movl %ebp, %esi + roll $10, %eax + addl %edi, %edx + xorl %eax, %esi + roll $9, %edx + addl %ecx, %edx + /* 8 */ + movl 36(%esp), %edi + xorl %edx, %esi + addl %edi, %ecx + roll $10, %ebp + addl %esi, %ecx + movl %edx, %esi + roll $11, %ecx + addl %ebx, %ecx + /* 9 */ + xorl %ebp, %esi + movl 40(%esp), %edi + xorl %ecx, %esi + addl %esi, %ebx + movl %ecx, %esi + roll $10, %edx + addl %edi, %ebx + xorl %edx, %esi + roll $13, %ebx + addl %eax, %ebx + /* 10 */ + movl 44(%esp), %edi + xorl %ebx, %esi + addl %edi, %eax + roll $10, %ecx + addl %esi, %eax + movl %ebx, %esi + roll $14, %eax + addl %ebp, %eax + /* 11 */ + xorl %ecx, %esi + movl 48(%esp), %edi + xorl %eax, %esi + addl %esi, %ebp + movl %eax, %esi + roll $10, %ebx + addl %edi, %ebp + xorl %ebx, %esi + roll $15, %ebp + addl %edx, %ebp + /* 12 */ + movl 52(%esp), %edi + xorl %ebp, %esi + addl %edi, %edx + roll $10, %eax + addl %esi, %edx + movl %ebp, %esi + roll $6, %edx + addl %ecx, %edx + /* 13 */ + xorl %eax, %esi + movl 56(%esp), %edi + xorl %edx, %esi + addl %esi, %ecx + movl %edx, %esi + roll $10, %ebp + addl %edi, %ecx + xorl %ebp, %esi + roll $7, %ecx + addl %ebx, %ecx + /* 14 */ + movl 60(%esp), %edi + xorl %ecx, %esi + addl %edi, %ebx + roll $10, %edx + addl %esi, %ebx + movl %ecx, %esi + roll $9, %ebx + addl %eax, %ebx + /* 15 */ + xorl %edx, %esi + movl 64(%esp), %edi + xorl %ebx, %esi + addl %esi, %eax + movl $-1, %esi + roll $10, %ecx + addl %edi, %eax + movl 32(%esp), %edi + roll $8, %eax + addl %ebp, %eax + /* 16 */ + addl %edi, %ebp + movl %ebx, %edi + subl %eax, %esi + andl %eax, %edi + andl %ecx, %esi + orl %esi, %edi + movl 20(%esp), %esi + roll $10, %ebx + leal 1518500249(%ebp,%edi,1),%ebp + movl $-1, %edi + roll $7, %ebp + addl %edx, %ebp + /* 17 */ + addl %esi, %edx + movl %eax, %esi + subl %ebp, %edi + andl %ebp, %esi + andl %ebx, %edi + orl %edi, %esi + movl 56(%esp), %edi + roll $10, %eax + leal 1518500249(%edx,%esi,1),%edx + movl $-1, %esi + roll $6, %edx + addl %ecx, %edx + /* 18 */ + addl %edi, %ecx + movl %ebp, %edi + subl %edx, %esi + andl %edx, %edi + andl %eax, %esi + orl %esi, %edi + movl 8(%esp), %esi + roll $10, %ebp + leal 1518500249(%ecx,%edi,1),%ecx + movl $-1, %edi + roll $8, %ecx + addl %ebx, %ecx + /* 19 */ + addl %esi, %ebx + movl %edx, %esi + subl %ecx, %edi + andl %ecx, %esi + andl %ebp, %edi + orl %edi, %esi + movl 44(%esp), %edi + roll $10, %edx + leal 1518500249(%ebx,%esi,1),%ebx + movl $-1, %esi + roll $13, %ebx + addl %eax, %ebx + /* 20 */ + addl %edi, %eax + movl %ecx, %edi + subl %ebx, %esi + andl %ebx, %edi + andl %edx, %esi + orl %esi, %edi + movl 28(%esp), %esi + roll $10, %ecx + leal 1518500249(%eax,%edi,1),%eax + movl $-1, %edi + roll $11, %eax + addl %ebp, %eax + /* 21 */ + addl %esi, %ebp + movl %ebx, %esi + subl %eax, %edi + andl %eax, %esi + andl %ecx, %edi + orl %edi, %esi + movl 64(%esp), %edi + roll $10, %ebx + leal 1518500249(%ebp,%esi,1),%ebp + movl $-1, %esi + roll $9, %ebp + addl %edx, %ebp + /* 22 */ + addl %edi, %edx + movl %eax, %edi + subl %ebp, %esi + andl %ebp, %edi + andl %ebx, %esi + orl %esi, %edi + movl 16(%esp), %esi + roll $10, %eax + leal 1518500249(%edx,%edi,1),%edx + movl $-1, %edi + roll $7, %edx + addl %ecx, %edx + /* 23 */ + addl %esi, %ecx + movl %ebp, %esi + subl %edx, %edi + andl %edx, %esi + andl %eax, %edi + orl %edi, %esi + movl 52(%esp), %edi + roll $10, %ebp + leal 1518500249(%ecx,%esi,1),%ecx + movl $-1, %esi + roll $15, %ecx + addl %ebx, %ecx + /* 24 */ + addl %edi, %ebx + movl %edx, %edi + subl %ecx, %esi + andl %ecx, %edi + andl %ebp, %esi + orl %esi, %edi + movl 4(%esp), %esi + roll $10, %edx + leal 1518500249(%ebx,%edi,1),%ebx + movl $-1, %edi + roll $7, %ebx + addl %eax, %ebx + /* 25 */ + addl %esi, %eax + movl %ecx, %esi + subl %ebx, %edi + andl %ebx, %esi + andl %edx, %edi + orl %edi, %esi + movl 40(%esp), %edi + roll $10, %ecx + leal 1518500249(%eax,%esi,1),%eax + movl $-1, %esi + roll $12, %eax + addl %ebp, %eax + /* 26 */ + addl %edi, %ebp + movl %ebx, %edi + subl %eax, %esi + andl %eax, %edi + andl %ecx, %esi + orl %esi, %edi + movl 24(%esp), %esi + roll $10, %ebx + leal 1518500249(%ebp,%edi,1),%ebp + movl $-1, %edi + roll $15, %ebp + addl %edx, %ebp + /* 27 */ + addl %esi, %edx + movl %eax, %esi + subl %ebp, %edi + andl %ebp, %esi + andl %ebx, %edi + orl %edi, %esi + movl 12(%esp), %edi + roll $10, %eax + leal 1518500249(%edx,%esi,1),%edx + movl $-1, %esi + roll $9, %edx + addl %ecx, %edx + /* 28 */ + addl %edi, %ecx + movl %ebp, %edi + subl %edx, %esi + andl %edx, %edi + andl %eax, %esi + orl %esi, %edi + movl 60(%esp), %esi + roll $10, %ebp + leal 1518500249(%ecx,%edi,1),%ecx + movl $-1, %edi + roll $11, %ecx + addl %ebx, %ecx + /* 29 */ + addl %esi, %ebx + movl %edx, %esi + subl %ecx, %edi + andl %ecx, %esi + andl %ebp, %edi + orl %edi, %esi + movl 48(%esp), %edi + roll $10, %edx + leal 1518500249(%ebx,%esi,1),%ebx + movl $-1, %esi + roll $7, %ebx + addl %eax, %ebx + /* 30 */ + addl %edi, %eax + movl %ecx, %edi + subl %ebx, %esi + andl %ebx, %edi + andl %edx, %esi + orl %esi, %edi + movl 36(%esp), %esi + roll $10, %ecx + leal 1518500249(%eax,%edi,1),%eax + movl $-1, %edi + roll $13, %eax + addl %ebp, %eax + /* 31 */ + addl %esi, %ebp + movl %ebx, %esi + subl %eax, %edi + andl %eax, %esi + andl %ecx, %edi + orl %edi, %esi + movl $-1, %edi + roll $10, %ebx + leal 1518500249(%ebp,%esi,1),%ebp + subl %eax, %edi + roll $12, %ebp + addl %edx, %ebp + /* 32 */ + movl 16(%esp), %esi + orl %ebp, %edi + addl %esi, %edx + xorl %ebx, %edi + movl $-1, %esi + roll $10, %eax + leal 1859775393(%edx,%edi,1),%edx + subl %ebp, %esi + roll $11, %edx + addl %ecx, %edx + /* 33 */ + movl 44(%esp), %edi + orl %edx, %esi + addl %edi, %ecx + xorl %eax, %esi + movl $-1, %edi + roll $10, %ebp + leal 1859775393(%ecx,%esi,1),%ecx + subl %edx, %edi + roll $13, %ecx + addl %ebx, %ecx + /* 34 */ + movl 60(%esp), %esi + orl %ecx, %edi + addl %esi, %ebx + xorl %ebp, %edi + movl $-1, %esi + roll $10, %edx + leal 1859775393(%ebx,%edi,1),%ebx + subl %ecx, %esi + roll $6, %ebx + addl %eax, %ebx + /* 35 */ + movl 20(%esp), %edi + orl %ebx, %esi + addl %edi, %eax + xorl %edx, %esi + movl $-1, %edi + roll $10, %ecx + leal 1859775393(%eax,%esi,1),%eax + subl %ebx, %edi + roll $7, %eax + addl %ebp, %eax + /* 36 */ + movl 40(%esp), %esi + orl %eax, %edi + addl %esi, %ebp + xorl %ecx, %edi + movl $-1, %esi + roll $10, %ebx + leal 1859775393(%ebp,%edi,1),%ebp + subl %eax, %esi + roll $14, %ebp + addl %edx, %ebp + /* 37 */ + movl 64(%esp), %edi + orl %ebp, %esi + addl %edi, %edx + xorl %ebx, %esi + movl $-1, %edi + roll $10, %eax + leal 1859775393(%edx,%esi,1),%edx + subl %ebp, %edi + roll $9, %edx + addl %ecx, %edx + /* 38 */ + movl 36(%esp), %esi + orl %edx, %edi + addl %esi, %ecx + xorl %eax, %edi + movl $-1, %esi + roll $10, %ebp + leal 1859775393(%ecx,%edi,1),%ecx + subl %edx, %esi + roll $13, %ecx + addl %ebx, %ecx + /* 39 */ + movl 8(%esp), %edi + orl %ecx, %esi + addl %edi, %ebx + xorl %ebp, %esi + movl $-1, %edi + roll $10, %edx + leal 1859775393(%ebx,%esi,1),%ebx + subl %ecx, %edi + roll $15, %ebx + addl %eax, %ebx + /* 40 */ + movl 12(%esp), %esi + orl %ebx, %edi + addl %esi, %eax + xorl %edx, %edi + movl $-1, %esi + roll $10, %ecx + leal 1859775393(%eax,%edi,1),%eax + subl %ebx, %esi + roll $14, %eax + addl %ebp, %eax + /* 41 */ + movl 32(%esp), %edi + orl %eax, %esi + addl %edi, %ebp + xorl %ecx, %esi + movl $-1, %edi + roll $10, %ebx + leal 1859775393(%ebp,%esi,1),%ebp + subl %eax, %edi + roll $8, %ebp + addl %edx, %ebp + /* 42 */ + movl 4(%esp), %esi + orl %ebp, %edi + addl %esi, %edx + xorl %ebx, %edi + movl $-1, %esi + roll $10, %eax + leal 1859775393(%edx,%edi,1),%edx + subl %ebp, %esi + roll $13, %edx + addl %ecx, %edx + /* 43 */ + movl 28(%esp), %edi + orl %edx, %esi + addl %edi, %ecx + xorl %eax, %esi + movl $-1, %edi + roll $10, %ebp + leal 1859775393(%ecx,%esi,1),%ecx + subl %edx, %edi + roll $6, %ecx + addl %ebx, %ecx + /* 44 */ + movl 56(%esp), %esi + orl %ecx, %edi + addl %esi, %ebx + xorl %ebp, %edi + movl $-1, %esi + roll $10, %edx + leal 1859775393(%ebx,%edi,1),%ebx + subl %ecx, %esi + roll $5, %ebx + addl %eax, %ebx + /* 45 */ + movl 48(%esp), %edi + orl %ebx, %esi + addl %edi, %eax + xorl %edx, %esi + movl $-1, %edi + roll $10, %ecx + leal 1859775393(%eax,%esi,1),%eax + subl %ebx, %edi + roll $12, %eax + addl %ebp, %eax + /* 46 */ + movl 24(%esp), %esi + orl %eax, %edi + addl %esi, %ebp + xorl %ecx, %edi + movl $-1, %esi + roll $10, %ebx + leal 1859775393(%ebp,%edi,1),%ebp + subl %eax, %esi + roll $7, %ebp + addl %edx, %ebp + /* 47 */ + movl 52(%esp), %edi + orl %ebp, %esi + addl %edi, %edx + xorl %ebx, %esi + movl $-1, %edi + roll $10, %eax + leal 1859775393(%edx,%esi,1),%edx + movl %eax, %esi + roll $5, %edx + addl %ecx, %edx + /* 48 */ + subl %eax, %edi + andl %edx, %esi + andl %ebp, %edi + orl %esi, %edi + movl 8(%esp), %esi + roll $10, %ebp + leal 2400959708(%ecx,%edi,),%ecx + movl $-1, %edi + addl %esi, %ecx + movl %ebp, %esi + roll $11, %ecx + addl %ebx, %ecx + /* 49 */ + subl %ebp, %edi + andl %ecx, %esi + andl %edx, %edi + orl %esi, %edi + movl 40(%esp), %esi + roll $10, %edx + leal 2400959708(%ebx,%edi,),%ebx + movl $-1, %edi + addl %esi, %ebx + movl %edx, %esi + roll $12, %ebx + addl %eax, %ebx + /* 50 */ + subl %edx, %edi + andl %ebx, %esi + andl %ecx, %edi + orl %esi, %edi + movl 48(%esp), %esi + roll $10, %ecx + leal 2400959708(%eax,%edi,),%eax + movl $-1, %edi + addl %esi, %eax + movl %ecx, %esi + roll $14, %eax + addl %ebp, %eax + /* 51 */ + subl %ecx, %edi + andl %eax, %esi + andl %ebx, %edi + orl %esi, %edi + movl 44(%esp), %esi + roll $10, %ebx + leal 2400959708(%ebp,%edi,),%ebp + movl $-1, %edi + addl %esi, %ebp + movl %ebx, %esi + roll $15, %ebp + addl %edx, %ebp + /* 52 */ + subl %ebx, %edi + andl %ebp, %esi + andl %eax, %edi + orl %esi, %edi + movl 4(%esp), %esi + roll $10, %eax + leal 2400959708(%edx,%edi,),%edx + movl $-1, %edi + addl %esi, %edx + movl %eax, %esi + roll $14, %edx + addl %ecx, %edx + /* 53 */ + subl %eax, %edi + andl %edx, %esi + andl %ebp, %edi + orl %esi, %edi + movl 36(%esp), %esi + roll $10, %ebp + leal 2400959708(%ecx,%edi,),%ecx + movl $-1, %edi + addl %esi, %ecx + movl %ebp, %esi + roll $15, %ecx + addl %ebx, %ecx + /* 54 */ + subl %ebp, %edi + andl %ecx, %esi + andl %edx, %edi + orl %esi, %edi + movl 52(%esp), %esi + roll $10, %edx + leal 2400959708(%ebx,%edi,),%ebx + movl $-1, %edi + addl %esi, %ebx + movl %edx, %esi + roll $9, %ebx + addl %eax, %ebx + /* 55 */ + subl %edx, %edi + andl %ebx, %esi + andl %ecx, %edi + orl %esi, %edi + movl 20(%esp), %esi + roll $10, %ecx + leal 2400959708(%eax,%edi,),%eax + movl $-1, %edi + addl %esi, %eax + movl %ecx, %esi + roll $8, %eax + addl %ebp, %eax + /* 56 */ + subl %ecx, %edi + andl %eax, %esi + andl %ebx, %edi + orl %esi, %edi + movl 56(%esp), %esi + roll $10, %ebx + leal 2400959708(%ebp,%edi,),%ebp + movl $-1, %edi + addl %esi, %ebp + movl %ebx, %esi + roll $9, %ebp + addl %edx, %ebp + /* 57 */ + subl %ebx, %edi + andl %ebp, %esi + andl %eax, %edi + orl %esi, %edi + movl 16(%esp), %esi + roll $10, %eax + leal 2400959708(%edx,%edi,),%edx + movl $-1, %edi + addl %esi, %edx + movl %eax, %esi + roll $14, %edx + addl %ecx, %edx + /* 58 */ + subl %eax, %edi + andl %edx, %esi + andl %ebp, %edi + orl %esi, %edi + movl 32(%esp), %esi + roll $10, %ebp + leal 2400959708(%ecx,%edi,),%ecx + movl $-1, %edi + addl %esi, %ecx + movl %ebp, %esi + roll $5, %ecx + addl %ebx, %ecx + /* 59 */ + subl %ebp, %edi + andl %ecx, %esi + andl %edx, %edi + orl %esi, %edi + movl 64(%esp), %esi + roll $10, %edx + leal 2400959708(%ebx,%edi,),%ebx + movl $-1, %edi + addl %esi, %ebx + movl %edx, %esi + roll $6, %ebx + addl %eax, %ebx + /* 60 */ + subl %edx, %edi + andl %ebx, %esi + andl %ecx, %edi + orl %esi, %edi + movl 60(%esp), %esi + roll $10, %ecx + leal 2400959708(%eax,%edi,),%eax + movl $-1, %edi + addl %esi, %eax + movl %ecx, %esi + roll $8, %eax + addl %ebp, %eax + /* 61 */ + subl %ecx, %edi + andl %eax, %esi + andl %ebx, %edi + orl %esi, %edi + movl 24(%esp), %esi + roll $10, %ebx + leal 2400959708(%ebp,%edi,),%ebp + movl $-1, %edi + addl %esi, %ebp + movl %ebx, %esi + roll $6, %ebp + addl %edx, %ebp + /* 62 */ + subl %ebx, %edi + andl %ebp, %esi + andl %eax, %edi + orl %esi, %edi + movl 28(%esp), %esi + roll $10, %eax + leal 2400959708(%edx,%edi,),%edx + movl $-1, %edi + addl %esi, %edx + movl %eax, %esi + roll $5, %edx + addl %ecx, %edx + /* 63 */ + subl %eax, %edi + andl %edx, %esi + andl %ebp, %edi + orl %esi, %edi + movl 12(%esp), %esi + roll $10, %ebp + leal 2400959708(%ecx,%edi,),%ecx + movl $-1, %edi + addl %esi, %ecx + subl %ebp, %edi + roll $12, %ecx + addl %ebx, %ecx + /* 64 */ + movl 20(%esp), %esi + orl %edx, %edi + addl %esi, %ebx + xorl %ecx, %edi + movl $-1, %esi + roll $10, %edx + leal 2840853838(%ebx,%edi,1),%ebx + subl %edx, %esi + roll $9, %ebx + addl %eax, %ebx + /* 65 */ + movl 4(%esp), %edi + orl %ecx, %esi + addl %edi, %eax + xorl %ebx, %esi + movl $-1, %edi + roll $10, %ecx + leal 2840853838(%eax,%esi,1),%eax + subl %ecx, %edi + roll $15, %eax + addl %ebp, %eax + /* 66 */ + movl 24(%esp), %esi + orl %ebx, %edi + addl %esi, %ebp + xorl %eax, %edi + movl $-1, %esi + roll $10, %ebx + leal 2840853838(%ebp,%edi,1),%ebp + subl %ebx, %esi + roll $5, %ebp + addl %edx, %ebp + /* 67 */ + movl 40(%esp), %edi + orl %eax, %esi + addl %edi, %edx + xorl %ebp, %esi + movl $-1, %edi + roll $10, %eax + leal 2840853838(%edx,%esi,1),%edx + subl %eax, %edi + roll $11, %edx + addl %ecx, %edx + /* 68 */ + movl 32(%esp), %esi + orl %ebp, %edi + addl %esi, %ecx + xorl %edx, %edi + movl $-1, %esi + roll $10, %ebp + leal 2840853838(%ecx,%edi,1),%ecx + subl %ebp, %esi + roll $6, %ecx + addl %ebx, %ecx + /* 69 */ + movl 52(%esp), %edi + orl %edx, %esi + addl %edi, %ebx + xorl %ecx, %esi + movl $-1, %edi + roll $10, %edx + leal 2840853838(%ebx,%esi,1),%ebx + subl %edx, %edi + roll $8, %ebx + addl %eax, %ebx + /* 70 */ + movl 12(%esp), %esi + orl %ecx, %edi + addl %esi, %eax + xorl %ebx, %edi + movl $-1, %esi + roll $10, %ecx + leal 2840853838(%eax,%edi,1),%eax + subl %ecx, %esi + roll $13, %eax + addl %ebp, %eax + /* 71 */ + movl 44(%esp), %edi + orl %ebx, %esi + addl %edi, %ebp + xorl %eax, %esi + movl $-1, %edi + roll $10, %ebx + leal 2840853838(%ebp,%esi,1),%ebp + subl %ebx, %edi + roll $12, %ebp + addl %edx, %ebp + /* 72 */ + movl 60(%esp), %esi + orl %eax, %edi + addl %esi, %edx + xorl %ebp, %edi + movl $-1, %esi + roll $10, %eax + leal 2840853838(%edx,%edi,1),%edx + subl %eax, %esi + roll $5, %edx + addl %ecx, %edx + /* 73 */ + movl 8(%esp), %edi + orl %ebp, %esi + addl %edi, %ecx + xorl %edx, %esi + movl $-1, %edi + roll $10, %ebp + leal 2840853838(%ecx,%esi,1),%ecx + subl %ebp, %edi + roll $12, %ecx + addl %ebx, %ecx + /* 74 */ + movl 16(%esp), %esi + orl %edx, %edi + addl %esi, %ebx + xorl %ecx, %edi + movl $-1, %esi + roll $10, %edx + leal 2840853838(%ebx,%edi,1),%ebx + subl %edx, %esi + roll $13, %ebx + addl %eax, %ebx + /* 75 */ + movl 36(%esp), %edi + orl %ecx, %esi + addl %edi, %eax + xorl %ebx, %esi + movl $-1, %edi + roll $10, %ecx + leal 2840853838(%eax,%esi,1),%eax + subl %ecx, %edi + roll $14, %eax + addl %ebp, %eax + /* 76 */ + movl 48(%esp), %esi + orl %ebx, %edi + addl %esi, %ebp + xorl %eax, %edi + movl $-1, %esi + roll $10, %ebx + leal 2840853838(%ebp,%edi,1),%ebp + subl %ebx, %esi + roll $11, %ebp + addl %edx, %ebp + /* 77 */ + movl 28(%esp), %edi + orl %eax, %esi + addl %edi, %edx + xorl %ebp, %esi + movl $-1, %edi + roll $10, %eax + leal 2840853838(%edx,%esi,1),%edx + subl %eax, %edi + roll $8, %edx + addl %ecx, %edx + /* 78 */ + movl 64(%esp), %esi + orl %ebp, %edi + addl %esi, %ecx + xorl %edx, %edi + movl $-1, %esi + roll $10, %ebp + leal 2840853838(%ecx,%edi,1),%ecx + subl %ebp, %esi + roll $5, %ecx + addl %ebx, %ecx + /* 79 */ + movl 56(%esp), %edi + orl %edx, %esi + addl %edi, %ebx + xorl %ecx, %esi + movl 108(%esp), %edi + roll $10, %edx + leal 2840853838(%ebx,%esi,1),%ebx + movl %eax, 68(%esp) + roll $6, %ebx + addl %eax, %ebx + movl (%edi), %eax + movl %ebx, 72(%esp) + movl %ecx, 76(%esp) + movl 4(%edi), %ebx + movl %edx, 80(%esp) + movl 8(%edi), %ecx + movl %ebp, 84(%esp) + movl 12(%edi), %edx + movl 16(%edi), %ebp + /* 80 */ + movl $-1, %edi + subl %edx, %edi + movl 24(%esp), %esi + orl %ecx, %edi + addl %esi, %eax + xorl %ebx, %edi + movl $-1, %esi + roll $10, %ecx + leal 1352829926(%eax,%edi,1),%eax + subl %ecx, %esi + roll $8, %eax + addl %ebp, %eax + /* 81 */ + movl 60(%esp), %edi + orl %ebx, %esi + addl %edi, %ebp + xorl %eax, %esi + movl $-1, %edi + roll $10, %ebx + leal 1352829926(%ebp,%esi,1),%ebp + subl %ebx, %edi + roll $9, %ebp + addl %edx, %ebp + /* 82 */ + movl 32(%esp), %esi + orl %eax, %edi + addl %esi, %edx + xorl %ebp, %edi + movl $-1, %esi + roll $10, %eax + leal 1352829926(%edx,%edi,1),%edx + subl %eax, %esi + roll $9, %edx + addl %ecx, %edx + /* 83 */ + movl 4(%esp), %edi + orl %ebp, %esi + addl %edi, %ecx + xorl %edx, %esi + movl $-1, %edi + roll $10, %ebp + leal 1352829926(%ecx,%esi,1),%ecx + subl %ebp, %edi + roll $11, %ecx + addl %ebx, %ecx + /* 84 */ + movl 40(%esp), %esi + orl %edx, %edi + addl %esi, %ebx + xorl %ecx, %edi + movl $-1, %esi + roll $10, %edx + leal 1352829926(%ebx,%edi,1),%ebx + subl %edx, %esi + roll $13, %ebx + addl %eax, %ebx + /* 85 */ + movl 12(%esp), %edi + orl %ecx, %esi + addl %edi, %eax + xorl %ebx, %esi + movl $-1, %edi + roll $10, %ecx + leal 1352829926(%eax,%esi,1),%eax + subl %ecx, %edi + roll $15, %eax + addl %ebp, %eax + /* 86 */ + movl 48(%esp), %esi + orl %ebx, %edi + addl %esi, %ebp + xorl %eax, %edi + movl $-1, %esi + roll $10, %ebx + leal 1352829926(%ebp,%edi,1),%ebp + subl %ebx, %esi + roll $15, %ebp + addl %edx, %ebp + /* 87 */ + movl 20(%esp), %edi + orl %eax, %esi + addl %edi, %edx + xorl %ebp, %esi + movl $-1, %edi + roll $10, %eax + leal 1352829926(%edx,%esi,1),%edx + subl %eax, %edi + roll $5, %edx + addl %ecx, %edx + /* 88 */ + movl 56(%esp), %esi + orl %ebp, %edi + addl %esi, %ecx + xorl %edx, %edi + movl $-1, %esi + roll $10, %ebp + leal 1352829926(%ecx,%edi,1),%ecx + subl %ebp, %esi + roll $7, %ecx + addl %ebx, %ecx + /* 89 */ + movl 28(%esp), %edi + orl %edx, %esi + addl %edi, %ebx + xorl %ecx, %esi + movl $-1, %edi + roll $10, %edx + leal 1352829926(%ebx,%esi,1),%ebx + subl %edx, %edi + roll $7, %ebx + addl %eax, %ebx + /* 90 */ + movl 64(%esp), %esi + orl %ecx, %edi + addl %esi, %eax + xorl %ebx, %edi + movl $-1, %esi + roll $10, %ecx + leal 1352829926(%eax,%edi,1),%eax + subl %ecx, %esi + roll $8, %eax + addl %ebp, %eax + /* 91 */ + movl 36(%esp), %edi + orl %ebx, %esi + addl %edi, %ebp + xorl %eax, %esi + movl $-1, %edi + roll $10, %ebx + leal 1352829926(%ebp,%esi,1),%ebp + subl %ebx, %edi + roll $11, %ebp + addl %edx, %ebp + /* 92 */ + movl 8(%esp), %esi + orl %eax, %edi + addl %esi, %edx + xorl %ebp, %edi + movl $-1, %esi + roll $10, %eax + leal 1352829926(%edx,%edi,1),%edx + subl %eax, %esi + roll $14, %edx + addl %ecx, %edx + /* 93 */ + movl 44(%esp), %edi + orl %ebp, %esi + addl %edi, %ecx + xorl %edx, %esi + movl $-1, %edi + roll $10, %ebp + leal 1352829926(%ecx,%esi,1),%ecx + subl %ebp, %edi + roll $14, %ecx + addl %ebx, %ecx + /* 94 */ + movl 16(%esp), %esi + orl %edx, %edi + addl %esi, %ebx + xorl %ecx, %edi + movl $-1, %esi + roll $10, %edx + leal 1352829926(%ebx,%edi,1),%ebx + subl %edx, %esi + roll $12, %ebx + addl %eax, %ebx + /* 95 */ + movl 52(%esp), %edi + orl %ecx, %esi + addl %edi, %eax + xorl %ebx, %esi + movl $-1, %edi + roll $10, %ecx + leal 1352829926(%eax,%esi,1),%eax + movl %ecx, %esi + roll $6, %eax + addl %ebp, %eax + /* 96 */ + subl %ecx, %edi + andl %eax, %esi + andl %ebx, %edi + orl %esi, %edi + movl 28(%esp), %esi + roll $10, %ebx + leal 1548603684(%ebp,%edi,),%ebp + movl $-1, %edi + addl %esi, %ebp + movl %ebx, %esi + roll $9, %ebp + addl %edx, %ebp + /* 97 */ + subl %ebx, %edi + andl %ebp, %esi + andl %eax, %edi + orl %esi, %edi + movl 48(%esp), %esi + roll $10, %eax + leal 1548603684(%edx,%edi,),%edx + movl $-1, %edi + addl %esi, %edx + movl %eax, %esi + roll $13, %edx + addl %ecx, %edx + /* 98 */ + subl %eax, %edi + andl %edx, %esi + andl %ebp, %edi + orl %esi, %edi + movl 16(%esp), %esi + roll $10, %ebp + leal 1548603684(%ecx,%edi,),%ecx + movl $-1, %edi + addl %esi, %ecx + movl %ebp, %esi + roll $15, %ecx + addl %ebx, %ecx + /* 99 */ + subl %ebp, %edi + andl %ecx, %esi + andl %edx, %edi + orl %esi, %edi + movl 32(%esp), %esi + roll $10, %edx + leal 1548603684(%ebx,%edi,),%ebx + movl $-1, %edi + addl %esi, %ebx + movl %edx, %esi + roll $7, %ebx + addl %eax, %ebx + /* 100 */ + subl %edx, %edi + andl %ebx, %esi + andl %ecx, %edi + orl %esi, %edi + movl 4(%esp), %esi + roll $10, %ecx + leal 1548603684(%eax,%edi,),%eax + movl $-1, %edi + addl %esi, %eax + movl %ecx, %esi + roll $12, %eax + addl %ebp, %eax + /* 101 */ + subl %ecx, %edi + andl %eax, %esi + andl %ebx, %edi + orl %esi, %edi + movl 56(%esp), %esi + roll $10, %ebx + leal 1548603684(%ebp,%edi,),%ebp + movl $-1, %edi + addl %esi, %ebp + movl %ebx, %esi + roll $8, %ebp + addl %edx, %ebp + /* 102 */ + subl %ebx, %edi + andl %ebp, %esi + andl %eax, %edi + orl %esi, %edi + movl 24(%esp), %esi + roll $10, %eax + leal 1548603684(%edx,%edi,),%edx + movl $-1, %edi + addl %esi, %edx + movl %eax, %esi + roll $9, %edx + addl %ecx, %edx + /* 103 */ + subl %eax, %edi + andl %edx, %esi + andl %ebp, %edi + orl %esi, %edi + movl 44(%esp), %esi + roll $10, %ebp + leal 1548603684(%ecx,%edi,),%ecx + movl $-1, %edi + addl %esi, %ecx + movl %ebp, %esi + roll $11, %ecx + addl %ebx, %ecx + /* 104 */ + subl %ebp, %edi + andl %ecx, %esi + andl %edx, %edi + orl %esi, %edi + movl 60(%esp), %esi + roll $10, %edx + leal 1548603684(%ebx,%edi,),%ebx + movl $-1, %edi + addl %esi, %ebx + movl %edx, %esi + roll $7, %ebx + addl %eax, %ebx + /* 105 */ + subl %edx, %edi + andl %ebx, %esi + andl %ecx, %edi + orl %esi, %edi + movl 64(%esp), %esi + roll $10, %ecx + leal 1548603684(%eax,%edi,),%eax + movl $-1, %edi + addl %esi, %eax + movl %ecx, %esi + roll $7, %eax + addl %ebp, %eax + /* 106 */ + subl %ecx, %edi + andl %eax, %esi + andl %ebx, %edi + orl %esi, %edi + movl 36(%esp), %esi + roll $10, %ebx + leal 1548603684(%ebp,%edi,),%ebp + movl $-1, %edi + addl %esi, %ebp + movl %ebx, %esi + roll $12, %ebp + addl %edx, %ebp + /* 107 */ + subl %ebx, %edi + andl %ebp, %esi + andl %eax, %edi + orl %esi, %edi + movl 52(%esp), %esi + roll $10, %eax + leal 1548603684(%edx,%edi,),%edx + movl $-1, %edi + addl %esi, %edx + movl %eax, %esi + roll $7, %edx + addl %ecx, %edx + /* 108 */ + subl %eax, %edi + andl %edx, %esi + andl %ebp, %edi + orl %esi, %edi + movl 20(%esp), %esi + roll $10, %ebp + leal 1548603684(%ecx,%edi,),%ecx + movl $-1, %edi + addl %esi, %ecx + movl %ebp, %esi + roll $6, %ecx + addl %ebx, %ecx + /* 109 */ + subl %ebp, %edi + andl %ecx, %esi + andl %edx, %edi + orl %esi, %edi + movl 40(%esp), %esi + roll $10, %edx + leal 1548603684(%ebx,%edi,),%ebx + movl $-1, %edi + addl %esi, %ebx + movl %edx, %esi + roll $15, %ebx + addl %eax, %ebx + /* 110 */ + subl %edx, %edi + andl %ebx, %esi + andl %ecx, %edi + orl %esi, %edi + movl 8(%esp), %esi + roll $10, %ecx + leal 1548603684(%eax,%edi,),%eax + movl $-1, %edi + addl %esi, %eax + movl %ecx, %esi + roll $13, %eax + addl %ebp, %eax + /* 111 */ + subl %ecx, %edi + andl %eax, %esi + andl %ebx, %edi + orl %esi, %edi + movl 12(%esp), %esi + roll $10, %ebx + leal 1548603684(%ebp,%edi,),%ebp + movl $-1, %edi + addl %esi, %ebp + subl %eax, %edi + roll $11, %ebp + addl %edx, %ebp + /* 112 */ + movl 64(%esp), %esi + orl %ebp, %edi + addl %esi, %edx + xorl %ebx, %edi + movl $-1, %esi + roll $10, %eax + leal 1836072691(%edx,%edi,1),%edx + subl %ebp, %esi + roll $9, %edx + addl %ecx, %edx + /* 113 */ + movl 24(%esp), %edi + orl %edx, %esi + addl %edi, %ecx + xorl %eax, %esi + movl $-1, %edi + roll $10, %ebp + leal 1836072691(%ecx,%esi,1),%ecx + subl %edx, %edi + roll $7, %ecx + addl %ebx, %ecx + /* 114 */ + movl 8(%esp), %esi + orl %ecx, %edi + addl %esi, %ebx + xorl %ebp, %edi + movl $-1, %esi + roll $10, %edx + leal 1836072691(%ebx,%edi,1),%ebx + subl %ecx, %esi + roll $15, %ebx + addl %eax, %ebx + /* 115 */ + movl 16(%esp), %edi + orl %ebx, %esi + addl %edi, %eax + xorl %edx, %esi + movl $-1, %edi + roll $10, %ecx + leal 1836072691(%eax,%esi,1),%eax + subl %ebx, %edi + roll $11, %eax + addl %ebp, %eax + /* 116 */ + movl 32(%esp), %esi + orl %eax, %edi + addl %esi, %ebp + xorl %ecx, %edi + movl $-1, %esi + roll $10, %ebx + leal 1836072691(%ebp,%edi,1),%ebp + subl %eax, %esi + roll $8, %ebp + addl %edx, %ebp + /* 117 */ + movl 60(%esp), %edi + orl %ebp, %esi + addl %edi, %edx + xorl %ebx, %esi + movl $-1, %edi + roll $10, %eax + leal 1836072691(%edx,%esi,1),%edx + subl %ebp, %edi + roll $6, %edx + addl %ecx, %edx + /* 118 */ + movl 28(%esp), %esi + orl %edx, %edi + addl %esi, %ecx + xorl %eax, %edi + movl $-1, %esi + roll $10, %ebp + leal 1836072691(%ecx,%edi,1),%ecx + subl %edx, %esi + roll $6, %ecx + addl %ebx, %ecx + /* 119 */ + movl 40(%esp), %edi + orl %ecx, %esi + addl %edi, %ebx + xorl %ebp, %esi + movl $-1, %edi + roll $10, %edx + leal 1836072691(%ebx,%esi,1),%ebx + subl %ecx, %edi + roll $14, %ebx + addl %eax, %ebx + /* 120 */ + movl 48(%esp), %esi + orl %ebx, %edi + addl %esi, %eax + xorl %edx, %edi + movl $-1, %esi + roll $10, %ecx + leal 1836072691(%eax,%edi,1),%eax + subl %ebx, %esi + roll $12, %eax + addl %ebp, %eax + /* 121 */ + movl 36(%esp), %edi + orl %eax, %esi + addl %edi, %ebp + xorl %ecx, %esi + movl $-1, %edi + roll $10, %ebx + leal 1836072691(%ebp,%esi,1),%ebp + subl %eax, %edi + roll $13, %ebp + addl %edx, %ebp + /* 122 */ + movl 52(%esp), %esi + orl %ebp, %edi + addl %esi, %edx + xorl %ebx, %edi + movl $-1, %esi + roll $10, %eax + leal 1836072691(%edx,%edi,1),%edx + subl %ebp, %esi + roll $5, %edx + addl %ecx, %edx + /* 123 */ + movl 12(%esp), %edi + orl %edx, %esi + addl %edi, %ecx + xorl %eax, %esi + movl $-1, %edi + roll $10, %ebp + leal 1836072691(%ecx,%esi,1),%ecx + subl %edx, %edi + roll $14, %ecx + addl %ebx, %ecx + /* 124 */ + movl 44(%esp), %esi + orl %ecx, %edi + addl %esi, %ebx + xorl %ebp, %edi + movl $-1, %esi + roll $10, %edx + leal 1836072691(%ebx,%edi,1),%ebx + subl %ecx, %esi + roll $13, %ebx + addl %eax, %ebx + /* 125 */ + movl 4(%esp), %edi + orl %ebx, %esi + addl %edi, %eax + xorl %edx, %esi + movl $-1, %edi + roll $10, %ecx + leal 1836072691(%eax,%esi,1),%eax + subl %ebx, %edi + roll $13, %eax + addl %ebp, %eax + /* 126 */ + movl 20(%esp), %esi + orl %eax, %edi + addl %esi, %ebp + xorl %ecx, %edi + movl $-1, %esi + roll $10, %ebx + leal 1836072691(%ebp,%edi,1),%ebp + subl %eax, %esi + roll $7, %ebp + addl %edx, %ebp + /* 127 */ + movl 56(%esp), %edi + orl %ebp, %esi + addl %edi, %edx + xorl %ebx, %esi + movl 36(%esp), %edi + roll $10, %eax + leal 1836072691(%edx,%esi,1),%edx + movl $-1, %esi + roll $5, %edx + addl %ecx, %edx + /* 128 */ + addl %edi, %ecx + movl %ebp, %edi + subl %edx, %esi + andl %edx, %edi + andl %eax, %esi + orl %esi, %edi + movl 28(%esp), %esi + roll $10, %ebp + leal 2053994217(%ecx,%edi,1),%ecx + movl $-1, %edi + roll $15, %ecx + addl %ebx, %ecx + /* 129 */ + addl %esi, %ebx + movl %edx, %esi + subl %ecx, %edi + andl %ecx, %esi + andl %ebp, %edi + orl %edi, %esi + movl 20(%esp), %edi + roll $10, %edx + leal 2053994217(%ebx,%esi,1),%ebx + movl $-1, %esi + roll $5, %ebx + addl %eax, %ebx + /* 130 */ + addl %edi, %eax + movl %ecx, %edi + subl %ebx, %esi + andl %ebx, %edi + andl %edx, %esi + orl %esi, %edi + movl 8(%esp), %esi + roll $10, %ecx + leal 2053994217(%eax,%edi,1),%eax + movl $-1, %edi + roll $8, %eax + addl %ebp, %eax + /* 131 */ + addl %esi, %ebp + movl %ebx, %esi + subl %eax, %edi + andl %eax, %esi + andl %ecx, %edi + orl %edi, %esi + movl 16(%esp), %edi + roll $10, %ebx + leal 2053994217(%ebp,%esi,1),%ebp + movl $-1, %esi + roll $11, %ebp + addl %edx, %ebp + /* 132 */ + addl %edi, %edx + movl %eax, %edi + subl %ebp, %esi + andl %ebp, %edi + andl %ebx, %esi + orl %esi, %edi + movl 48(%esp), %esi + roll $10, %eax + leal 2053994217(%edx,%edi,1),%edx + movl $-1, %edi + roll $14, %edx + addl %ecx, %edx + /* 133 */ + addl %esi, %ecx + movl %ebp, %esi + subl %edx, %edi + andl %edx, %esi + andl %eax, %edi + orl %edi, %esi + movl 64(%esp), %edi + roll $10, %ebp + leal 2053994217(%ecx,%esi,1),%ecx + movl $-1, %esi + roll $14, %ecx + addl %ebx, %ecx + /* 134 */ + addl %edi, %ebx + movl %edx, %edi + subl %ecx, %esi + andl %ecx, %edi + andl %ebp, %esi + orl %esi, %edi + movl 4(%esp), %esi + roll $10, %edx + leal 2053994217(%ebx,%edi,1),%ebx + movl $-1, %edi + roll $6, %ebx + addl %eax, %ebx + /* 135 */ + addl %esi, %eax + movl %ecx, %esi + subl %ebx, %edi + andl %ebx, %esi + andl %edx, %edi + orl %edi, %esi + movl 24(%esp), %edi + roll $10, %ecx + leal 2053994217(%eax,%esi,1),%eax + movl $-1, %esi + roll $14, %eax + addl %ebp, %eax + /* 136 */ + addl %edi, %ebp + movl %ebx, %edi + subl %eax, %esi + andl %eax, %edi + andl %ecx, %esi + orl %esi, %edi + movl 52(%esp), %esi + roll $10, %ebx + leal 2053994217(%ebp,%edi,1),%ebp + movl $-1, %edi + roll $6, %ebp + addl %edx, %ebp + /* 137 */ + addl %esi, %edx + movl %eax, %esi + subl %ebp, %edi + andl %ebp, %esi + andl %ebx, %edi + orl %edi, %esi + movl 12(%esp), %edi + roll $10, %eax + leal 2053994217(%edx,%esi,1),%edx + movl $-1, %esi + roll $9, %edx + addl %ecx, %edx + /* 138 */ + addl %edi, %ecx + movl %ebp, %edi + subl %edx, %esi + andl %edx, %edi + andl %eax, %esi + orl %esi, %edi + movl 56(%esp), %esi + roll $10, %ebp + leal 2053994217(%ecx,%edi,1),%ecx + movl $-1, %edi + roll $12, %ecx + addl %ebx, %ecx + /* 139 */ + addl %esi, %ebx + movl %edx, %esi + subl %ecx, %edi + andl %ecx, %esi + andl %ebp, %edi + orl %edi, %esi + movl 40(%esp), %edi + roll $10, %edx + leal 2053994217(%ebx,%esi,1),%ebx + movl $-1, %esi + roll $9, %ebx + addl %eax, %ebx + /* 140 */ + addl %edi, %eax + movl %ecx, %edi + subl %ebx, %esi + andl %ebx, %edi + andl %edx, %esi + orl %esi, %edi + movl 32(%esp), %esi + roll $10, %ecx + leal 2053994217(%eax,%edi,1),%eax + movl $-1, %edi + roll $12, %eax + addl %ebp, %eax + /* 141 */ + addl %esi, %ebp + movl %ebx, %esi + subl %eax, %edi + andl %eax, %esi + andl %ecx, %edi + orl %edi, %esi + movl 44(%esp), %edi + roll $10, %ebx + leal 2053994217(%ebp,%esi,1),%ebp + movl $-1, %esi + roll $5, %ebp + addl %edx, %ebp + /* 142 */ + addl %edi, %edx + movl %eax, %edi + subl %ebp, %esi + andl %ebp, %edi + andl %ebx, %esi + orl %esi, %edi + movl 60(%esp), %esi + roll $10, %eax + leal 2053994217(%edx,%edi,1),%edx + movl $-1, %edi + roll $15, %edx + addl %ecx, %edx + /* 143 */ + addl %esi, %ecx + movl %ebp, %esi + subl %edx, %edi + andl %edx, %esi + andl %eax, %edi + orl %esi, %edi + movl %edx, %esi + roll $10, %ebp + leal 2053994217(%ecx,%edi,1),%ecx + xorl %ebp, %esi + roll $8, %ecx + addl %ebx, %ecx + /* 144 */ + movl 52(%esp), %edi + xorl %ecx, %esi + addl %edi, %ebx + roll $10, %edx + addl %esi, %ebx + movl %ecx, %esi + roll $8, %ebx + addl %eax, %ebx + /* 145 */ + xorl %edx, %esi + movl 64(%esp), %edi + xorl %ebx, %esi + addl %esi, %eax + movl %ebx, %esi + roll $10, %ecx + addl %edi, %eax + xorl %ecx, %esi + roll $5, %eax + addl %ebp, %eax + /* 146 */ + movl 44(%esp), %edi + xorl %eax, %esi + addl %edi, %ebp + roll $10, %ebx + addl %esi, %ebp + movl %eax, %esi + roll $12, %ebp + addl %edx, %ebp + /* 147 */ + xorl %ebx, %esi + movl 20(%esp), %edi + xorl %ebp, %esi + addl %esi, %edx + movl %ebp, %esi + roll $10, %eax + addl %edi, %edx + xorl %eax, %esi + roll $9, %edx + addl %ecx, %edx + /* 148 */ + movl 8(%esp), %edi + xorl %edx, %esi + addl %edi, %ecx + roll $10, %ebp + addl %esi, %ecx + movl %edx, %esi + roll $12, %ecx + addl %ebx, %ecx + /* 149 */ + xorl %ebp, %esi + movl 24(%esp), %edi + xorl %ecx, %esi + addl %esi, %ebx + movl %ecx, %esi + roll $10, %edx + addl %edi, %ebx + xorl %edx, %esi + roll $5, %ebx + addl %eax, %ebx + /* 150 */ + movl 36(%esp), %edi + xorl %ebx, %esi + addl %edi, %eax + roll $10, %ecx + addl %esi, %eax + movl %ebx, %esi + roll $14, %eax + addl %ebp, %eax + /* 151 */ + xorl %ecx, %esi + movl 32(%esp), %edi + xorl %eax, %esi + addl %esi, %ebp + movl %eax, %esi + roll $10, %ebx + addl %edi, %ebp + xorl %ebx, %esi + roll $6, %ebp + addl %edx, %ebp + /* 152 */ + movl 28(%esp), %edi + xorl %ebp, %esi + addl %edi, %edx + roll $10, %eax + addl %esi, %edx + movl %ebp, %esi + roll $8, %edx + addl %ecx, %edx + /* 153 */ + xorl %eax, %esi + movl 12(%esp), %edi + xorl %edx, %esi + addl %esi, %ecx + movl %edx, %esi + roll $10, %ebp + addl %edi, %ecx + xorl %ebp, %esi + roll $13, %ecx + addl %ebx, %ecx + /* 154 */ + movl 56(%esp), %edi + xorl %ecx, %esi + addl %edi, %ebx + roll $10, %edx + addl %esi, %ebx + movl %ecx, %esi + roll $6, %ebx + addl %eax, %ebx + /* 155 */ + xorl %edx, %esi + movl 60(%esp), %edi + xorl %ebx, %esi + addl %esi, %eax + movl %ebx, %esi + roll $10, %ecx + addl %edi, %eax + xorl %ecx, %esi + roll $5, %eax + addl %ebp, %eax + /* 156 */ + movl 4(%esp), %edi + xorl %eax, %esi + addl %edi, %ebp + roll $10, %ebx + addl %esi, %ebp + movl %eax, %esi + roll $15, %ebp + addl %edx, %ebp + /* 157 */ + xorl %ebx, %esi + movl 16(%esp), %edi + xorl %ebp, %esi + addl %esi, %edx + movl %ebp, %esi + roll $10, %eax + addl %edi, %edx + xorl %eax, %esi + roll $13, %edx + addl %ecx, %edx + /* 158 */ + movl 40(%esp), %edi + xorl %edx, %esi + addl %edi, %ecx + roll $10, %ebp + addl %esi, %ecx + movl %edx, %esi + roll $11, %ecx + addl %ebx, %ecx + /* 159 */ + xorl %ebp, %esi + movl 48(%esp), %edi + xorl %ecx, %esi + addl %esi, %ebx + roll $10, %edx + addl %edi, %ebx + movl 108(%esp), %edi + roll $11, %ebx + addl %eax, %ebx + movl 4(%edi), %esi + addl %esi, %edx + movl 76(%esp), %esi + addl %esi, %edx + movl 8(%edi), %esi + addl %esi, %ebp + movl 80(%esp), %esi + addl %esi, %ebp + movl 12(%edi), %esi + addl %esi, %eax + movl 84(%esp), %esi + addl %esi, %eax + movl 16(%edi), %esi + addl %esi, %ebx + movl 68(%esp), %esi + addl %esi, %ebx + movl (%edi), %esi + addl %esi, %ecx + movl 72(%esp), %esi + addl %esi, %ecx + movl %edx, (%edi) + movl %ebp, 4(%edi) + movl %eax, 8(%edi) + movl %ebx, 12(%edi) + movl %ecx, 16(%edi) + movl (%esp), %edi + movl 112(%esp), %esi + cmpl %esi, %edi + movl 108(%esp), %edi + jge .L000start + addl $88, %esp + popl %ebx + popl %ebp + popl %edi + popl %esi + ret +.ripemd160_block_x86_end: + SIZE(ripemd160_block_x86,.ripemd160_block_x86_end-ripemd160_block_x86) +.ident "desasm.pl" diff --git a/src/lib/libssl/src/crypto/rsa/rsa.err b/src/lib/libssl/src/crypto/rsa/rsa.err new file mode 100644 index 0000000000..5ded1b5fa2 --- /dev/null +++ b/src/lib/libssl/src/crypto/rsa/rsa.err @@ -0,0 +1,45 @@ +/* Error codes for the RSA functions. */ + +/* Function codes. */ +#define RSA_F_RSA_EAY_PRIVATE_DECRYPT 100 +#define RSA_F_RSA_EAY_PRIVATE_ENCRYPT 101 +#define RSA_F_RSA_EAY_PUBLIC_DECRYPT 102 +#define RSA_F_RSA_EAY_PUBLIC_ENCRYPT 103 +#define RSA_F_RSA_GENERATE_KEY 104 +#define RSA_F_RSA_NEW_METHOD 105 +#define RSA_F_RSA_PADDING_ADD_NONE 106 +#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 107 +#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 108 +#define RSA_F_RSA_PADDING_ADD_SSLV23 109 +#define RSA_F_RSA_PADDING_CHECK_NONE 110 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 111 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 112 +#define RSA_F_RSA_PADDING_CHECK_SSLV23 113 +#define RSA_F_RSA_PRINT 114 +#define RSA_F_RSA_PRINT_FP 115 +#define RSA_F_RSA_SIGN 116 +#define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 117 +#define RSA_F_RSA_VERIFY 118 +#define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 119 + +/* Reason codes. */ +#define RSA_R_ALGORITHM_MISMATCH 100 +#define RSA_R_BAD_E_VALUE 101 +#define RSA_R_BAD_FIXED_HEADER_DECRYPT 102 +#define RSA_R_BAD_PAD_BYTE_COUNT 103 +#define RSA_R_BAD_SIGNATURE 104 +#define RSA_R_BAD_ZERO_BYTE 105 +#define RSA_R_BLOCK_TYPE_IS_NOT_01 106 +#define RSA_R_BLOCK_TYPE_IS_NOT_02 107 +#define RSA_R_DATA_GREATER_THAN_MOD_LEN 108 +#define RSA_R_DATA_TOO_LARGE 109 +#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110 +#define RSA_R_DATA_TOO_SMALL 111 +#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112 +#define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 +#define RSA_R_PADDING_CHECK_FAILED 114 +#define RSA_R_SSLV3_ROLLBACK_ATTACK 115 +#define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 +#define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 +#define RSA_R_UNKNOWN_PADDING_TYPE 118 +#define RSA_R_WRONG_SIGNATURE_LENGTH 119 diff --git a/src/lib/libssl/src/crypto/sha/Makefile.uni b/src/lib/libssl/src/crypto/sha/Makefile.uni new file mode 100644 index 0000000000..f3236755b2 --- /dev/null +++ b/src/lib/libssl/src/crypto/sha/Makefile.uni @@ -0,0 +1,122 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +DIR= sha +TOP= . +CC= gcc +CFLAG= -O3 -fomit-frame-pointer + +CPP= $(CC) -E +INCLUDES= +INSTALLTOP=/usr/local/lib +MAKE= make +MAKEDEPEND= makedepend +MAKEFILE= Makefile.uni +AR= ar r + +SHA_ASM_OBJ= + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile + +TEST1=shatest +TEST2=sha1test +APP1=sha +APP2=sha1 + +TEST=$(TEST1) $(TEST2) +APPS=$(APP1) $(APP2) + +LIB=libsha.a +LIBSRC=sha_dgst.c sha1dgst.c sha_one.c sha1_one.c +LIBOBJ=sha_dgst.o sha1dgst.o sha_one.o sha1_one.o $(SHA_ASM_OBJ) + +SRC= $(LIBSRC) + +EXHEADER= sha.h +HEADER= sha_locl.h $(EXHEADER) + +ALL= $(GENERAL) $(SRC) $(HEADER) + +all: $(LIB) $(TEST) $(APPS) + +$(LIB): $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) + sh $(TOP)/ranlib.sh $(LIB) + +# elf +asm/sx86-elf.o: asm/sx86unix.cpp + $(CPP) -DELF asm/sx86unix.cpp | as -o asm/sx86-elf.o + +# solaris +asm/sx86-sol.o: asm/sx86unix.cpp + $(CC) -E -DSOL asm/sx86unix.cpp | sed 's/^#.*//' > asm/sx86-sol.s + as -o asm/sx86-sol.o asm/sx86-sol.s + rm -f asm/sx86-sol.s + +# a.out +asm/sx86-out.o: asm/sx86unix.cpp + $(CPP) -DOUT asm/sx86unix.cpp | as -o asm/sx86-out.o + +# bsdi +asm/sx86bsdi.o: asm/sx86unix.cpp + $(CPP) -DBSDI asm/sx86unix.cpp | as -o asm/sx86bsdi.o + +asm/sx86unix.cpp: + (cd asm; perl sha1-586.pl cpp >sx86unix.cpp) + +test: $(TEST) + ./$(TEST1) + ./$(TEST2) + +$(TEST1): $(TEST1).c $(LIB) + $(CC) -o $(TEST1) $(CFLAGS) $(TEST1).c $(LIB) + +$(TEST2): $(TEST2).c $(LIB) + $(CC) -o $(TEST2) $(CFLAGS) $(TEST2).c $(LIB) + +$(APP1): $(APP1).c $(LIB) + $(CC) -o $(APP1) $(CFLAGS) $(APP1).c $(LIB) + +$(APP2): $(APP2).c $(LIB) + $(CC) -o $(APP2) $(CFLAGS) $(APP2).c $(LIB) + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + +dclean: + perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff + +cc: + $(MAKE) SHA_ASM_OBJ="" CC="cc" CFLAG="-O" all + +gcc: + $(MAKE) SHA_ASM_OBJ="" CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all + +x86-elf: + $(MAKE) SHA_ASM_OBJ="asm/sx86-elf.o" CFLAG="-DELF -DSHA1_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-out: + $(MAKE) SHA_ASM_OBJ="asm/sx86-out.o" CFLAG="-DOUT -DSHA1_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-solaris: + $(MAKE) SHA_ASM_OBJ="asm/sx86-sol.o" CFLAG="-DSOL -DSHA1_ASM -DL_ENDIAN $(CFLAGS)" all + +x86-bdsi: + $(MAKE) SHA_ASM_OBJ="asm/sx86-bdsi.o" CFLAG="-DBDSI -DSHA1_ASM -DL_ENDIAN $(CFLAGS)" all + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libssl/src/crypto/sha/asm/s1-win32.asm b/src/lib/libssl/src/crypto/sha/asm/s1-win32.asm new file mode 100644 index 0000000000..61335666b9 --- /dev/null +++ b/src/lib/libssl/src/crypto/sha/asm/s1-win32.asm @@ -0,0 +1,1664 @@ + ; Don't even think of reading this code + ; It was automatically generated by sha1-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE sha1-586.asm + .486 +.model FLAT +_TEXT SEGMENT +PUBLIC _sha1_block_x86 + +_sha1_block_x86 PROC NEAR + push esi + push ebp + mov eax, DWORD PTR 20[esp] + mov esi, DWORD PTR 16[esp] + add eax, esi + mov ebp, DWORD PTR 12[esp] + push ebx + sub eax, 64 + push edi + mov ebx, DWORD PTR 4[ebp] + sub esp, 72 + mov edx, DWORD PTR 12[ebp] + mov edi, DWORD PTR 16[ebp] + mov ecx, DWORD PTR 8[ebp] + mov DWORD PTR 68[esp],eax + ; First we need to setup the X array + mov eax, DWORD PTR [esi] +L000start: + ; First, load the words onto the stack in network byte order + bswap eax + mov DWORD PTR [esp],eax + mov eax, DWORD PTR 4[esi] + bswap eax + mov DWORD PTR 4[esp],eax + mov eax, DWORD PTR 8[esi] + bswap eax + mov DWORD PTR 8[esp],eax + mov eax, DWORD PTR 12[esi] + bswap eax + mov DWORD PTR 12[esp],eax + mov eax, DWORD PTR 16[esi] + bswap eax + mov DWORD PTR 16[esp],eax + mov eax, DWORD PTR 20[esi] + bswap eax + mov DWORD PTR 20[esp],eax + mov eax, DWORD PTR 24[esi] + bswap eax + mov DWORD PTR 24[esp],eax + mov eax, DWORD PTR 28[esi] + bswap eax + mov DWORD PTR 28[esp],eax + mov eax, DWORD PTR 32[esi] + bswap eax + mov DWORD PTR 32[esp],eax + mov eax, DWORD PTR 36[esi] + bswap eax + mov DWORD PTR 36[esp],eax + mov eax, DWORD PTR 40[esi] + bswap eax + mov DWORD PTR 40[esp],eax + mov eax, DWORD PTR 44[esi] + bswap eax + mov DWORD PTR 44[esp],eax + mov eax, DWORD PTR 48[esi] + bswap eax + mov DWORD PTR 48[esp],eax + mov eax, DWORD PTR 52[esi] + bswap eax + mov DWORD PTR 52[esp],eax + mov eax, DWORD PTR 56[esi] + bswap eax + mov DWORD PTR 56[esp],eax + mov eax, DWORD PTR 60[esi] + bswap eax + mov DWORD PTR 60[esp],eax + ; We now have the X array on the stack + ; starting at sp-4 + mov DWORD PTR 64[esp],esi + ; + ; Start processing + mov eax, DWORD PTR [ebp] + ; 00_15 0 + mov esi, ecx + mov ebp, eax + xor esi, edx + rol ebp, 5 + and esi, ebx + add ebp, edi + ror ebx, 1 + mov edi, DWORD PTR [esp] + ror ebx, 1 + xor esi, edx + lea ebp, DWORD PTR 1518500249[edi*1+ebp] + mov edi, ebx + add esi, ebp + xor edi, ecx + mov ebp, esi + and edi, eax + rol ebp, 5 + add ebp, edx + mov edx, DWORD PTR 4[esp] + ror eax, 1 + xor edi, ecx + ror eax, 1 + lea ebp, DWORD PTR 1518500249[edx*1+ebp] + add edi, ebp + ; 00_15 2 + mov edx, eax + mov ebp, edi + xor edx, ebx + rol ebp, 5 + and edx, esi + add ebp, ecx + ror esi, 1 + mov ecx, DWORD PTR 8[esp] + ror esi, 1 + xor edx, ebx + lea ebp, DWORD PTR 1518500249[ecx*1+ebp] + mov ecx, esi + add edx, ebp + xor ecx, eax + mov ebp, edx + and ecx, edi + rol ebp, 5 + add ebp, ebx + mov ebx, DWORD PTR 12[esp] + ror edi, 1 + xor ecx, eax + ror edi, 1 + lea ebp, DWORD PTR 1518500249[ebx*1+ebp] + add ecx, ebp + ; 00_15 4 + mov ebx, edi + mov ebp, ecx + xor ebx, esi + rol ebp, 5 + and ebx, edx + add ebp, eax + ror edx, 1 + mov eax, DWORD PTR 16[esp] + ror edx, 1 + xor ebx, esi + lea ebp, DWORD PTR 1518500249[eax*1+ebp] + mov eax, edx + add ebx, ebp + xor eax, edi + mov ebp, ebx + and eax, ecx + rol ebp, 5 + add ebp, esi + mov esi, DWORD PTR 20[esp] + ror ecx, 1 + xor eax, edi + ror ecx, 1 + lea ebp, DWORD PTR 1518500249[esi*1+ebp] + add eax, ebp + ; 00_15 6 + mov esi, ecx + mov ebp, eax + xor esi, edx + rol ebp, 5 + and esi, ebx + add ebp, edi + ror ebx, 1 + mov edi, DWORD PTR 24[esp] + ror ebx, 1 + xor esi, edx + lea ebp, DWORD PTR 1518500249[edi*1+ebp] + mov edi, ebx + add esi, ebp + xor edi, ecx + mov ebp, esi + and edi, eax + rol ebp, 5 + add ebp, edx + mov edx, DWORD PTR 28[esp] + ror eax, 1 + xor edi, ecx + ror eax, 1 + lea ebp, DWORD PTR 1518500249[edx*1+ebp] + add edi, ebp + ; 00_15 8 + mov edx, eax + mov ebp, edi + xor edx, ebx + rol ebp, 5 + and edx, esi + add ebp, ecx + ror esi, 1 + mov ecx, DWORD PTR 32[esp] + ror esi, 1 + xor edx, ebx + lea ebp, DWORD PTR 1518500249[ecx*1+ebp] + mov ecx, esi + add edx, ebp + xor ecx, eax + mov ebp, edx + and ecx, edi + rol ebp, 5 + add ebp, ebx + mov ebx, DWORD PTR 36[esp] + ror edi, 1 + xor ecx, eax + ror edi, 1 + lea ebp, DWORD PTR 1518500249[ebx*1+ebp] + add ecx, ebp + ; 00_15 10 + mov ebx, edi + mov ebp, ecx + xor ebx, esi + rol ebp, 5 + and ebx, edx + add ebp, eax + ror edx, 1 + mov eax, DWORD PTR 40[esp] + ror edx, 1 + xor ebx, esi + lea ebp, DWORD PTR 1518500249[eax*1+ebp] + mov eax, edx + add ebx, ebp + xor eax, edi + mov ebp, ebx + and eax, ecx + rol ebp, 5 + add ebp, esi + mov esi, DWORD PTR 44[esp] + ror ecx, 1 + xor eax, edi + ror ecx, 1 + lea ebp, DWORD PTR 1518500249[esi*1+ebp] + add eax, ebp + ; 00_15 12 + mov esi, ecx + mov ebp, eax + xor esi, edx + rol ebp, 5 + and esi, ebx + add ebp, edi + ror ebx, 1 + mov edi, DWORD PTR 48[esp] + ror ebx, 1 + xor esi, edx + lea ebp, DWORD PTR 1518500249[edi*1+ebp] + mov edi, ebx + add esi, ebp + xor edi, ecx + mov ebp, esi + and edi, eax + rol ebp, 5 + add ebp, edx + mov edx, DWORD PTR 52[esp] + ror eax, 1 + xor edi, ecx + ror eax, 1 + lea ebp, DWORD PTR 1518500249[edx*1+ebp] + add edi, ebp + ; 00_15 14 + mov edx, eax + mov ebp, edi + xor edx, ebx + rol ebp, 5 + and edx, esi + add ebp, ecx + ror esi, 1 + mov ecx, DWORD PTR 56[esp] + ror esi, 1 + xor edx, ebx + lea ebp, DWORD PTR 1518500249[ecx*1+ebp] + mov ecx, esi + add edx, ebp + xor ecx, eax + mov ebp, edx + and ecx, edi + rol ebp, 5 + add ebp, ebx + mov ebx, DWORD PTR 60[esp] + ror edi, 1 + xor ecx, eax + ror edi, 1 + lea ebp, DWORD PTR 1518500249[ebx*1+ebp] + add ecx, ebp + ; 16_19 16 + nop + mov ebp, DWORD PTR [esp] + mov ebx, DWORD PTR 8[esp] + xor ebx, ebp + mov ebp, DWORD PTR 32[esp] + xor ebx, ebp + mov ebp, DWORD PTR 52[esp] + xor ebx, ebp + mov ebp, edi + rol ebx, 1 + xor ebp, esi + mov DWORD PTR [esp],ebx + and ebp, edx + lea ebx, DWORD PTR 1518500249[eax*1+ebx] + xor ebp, esi + mov eax, ecx + add ebx, ebp + rol eax, 5 + ror edx, 1 + add ebx, eax + mov eax, DWORD PTR 4[esp] + mov ebp, DWORD PTR 12[esp] + xor eax, ebp + mov ebp, DWORD PTR 36[esp] + xor eax, ebp + mov ebp, DWORD PTR 56[esp] + ror edx, 1 + xor eax, ebp + rol eax, 1 + mov ebp, edx + xor ebp, edi + mov DWORD PTR 4[esp],eax + and ebp, ecx + lea eax, DWORD PTR 1518500249[esi*1+eax] + xor ebp, edi + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add eax, esi + ror ecx, 1 + add eax, ebp + ; 16_19 18 + mov ebp, DWORD PTR 8[esp] + mov esi, DWORD PTR 16[esp] + xor esi, ebp + mov ebp, DWORD PTR 40[esp] + xor esi, ebp + mov ebp, DWORD PTR 60[esp] + xor esi, ebp + mov ebp, ecx + rol esi, 1 + xor ebp, edx + mov DWORD PTR 8[esp],esi + and ebp, ebx + lea esi, DWORD PTR 1518500249[edi*1+esi] + xor ebp, edx + mov edi, eax + add esi, ebp + rol edi, 5 + ror ebx, 1 + add esi, edi + mov edi, DWORD PTR 12[esp] + mov ebp, DWORD PTR 20[esp] + xor edi, ebp + mov ebp, DWORD PTR 44[esp] + xor edi, ebp + mov ebp, DWORD PTR [esp] + ror ebx, 1 + xor edi, ebp + rol edi, 1 + mov ebp, ebx + xor ebp, ecx + mov DWORD PTR 12[esp],edi + and ebp, eax + lea edi, DWORD PTR 1518500249[edx*1+edi] + xor ebp, ecx + mov edx, esi + rol edx, 5 + ror eax, 1 + add edi, edx + ror eax, 1 + add edi, ebp + ; 20_39 20 + mov edx, DWORD PTR 16[esp] + mov ebp, DWORD PTR 24[esp] + xor edx, ebp + mov ebp, DWORD PTR 48[esp] + xor edx, ebp + mov ebp, DWORD PTR 4[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + xor ebp, eax + mov DWORD PTR 16[esp],edx + xor ebp, ebx + lea edx, DWORD PTR 1859775393[ecx*1+edx] + mov ecx, edi + rol ecx, 5 + ror esi, 1 + add ecx, ebp + ror esi, 1 + add edx, ecx + ; 20_39 21 + mov ecx, DWORD PTR 20[esp] + mov ebp, DWORD PTR 28[esp] + xor ecx, ebp + mov ebp, DWORD PTR 52[esp] + xor ecx, ebp + mov ebp, DWORD PTR 8[esp] + xor ecx, ebp + mov ebp, edi + rol ecx, 1 + xor ebp, esi + mov DWORD PTR 20[esp],ecx + xor ebp, eax + lea ecx, DWORD PTR 1859775393[ebx*1+ecx] + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebx, ebp + ror edi, 1 + add ecx, ebx + ; 20_39 22 + mov ebx, DWORD PTR 24[esp] + mov ebp, DWORD PTR 32[esp] + xor ebx, ebp + mov ebp, DWORD PTR 56[esp] + xor ebx, ebp + mov ebp, DWORD PTR 12[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + xor ebp, edi + mov DWORD PTR 24[esp],ebx + xor ebp, esi + lea ebx, DWORD PTR 1859775393[eax*1+ebx] + mov eax, ecx + rol eax, 5 + ror edx, 1 + add eax, ebp + ror edx, 1 + add ebx, eax + ; 20_39 23 + mov eax, DWORD PTR 28[esp] + mov ebp, DWORD PTR 36[esp] + xor eax, ebp + mov ebp, DWORD PTR 60[esp] + xor eax, ebp + mov ebp, DWORD PTR 16[esp] + xor eax, ebp + mov ebp, ecx + rol eax, 1 + xor ebp, edx + mov DWORD PTR 28[esp],eax + xor ebp, edi + lea eax, DWORD PTR 1859775393[esi*1+eax] + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add esi, ebp + ror ecx, 1 + add eax, esi + ; 20_39 24 + mov esi, DWORD PTR 32[esp] + mov ebp, DWORD PTR 40[esp] + xor esi, ebp + mov ebp, DWORD PTR [esp] + xor esi, ebp + mov ebp, DWORD PTR 20[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + xor ebp, ecx + mov DWORD PTR 32[esp],esi + xor ebp, edx + lea esi, DWORD PTR 1859775393[edi*1+esi] + mov edi, eax + rol edi, 5 + ror ebx, 1 + add edi, ebp + ror ebx, 1 + add esi, edi + ; 20_39 25 + mov edi, DWORD PTR 36[esp] + mov ebp, DWORD PTR 44[esp] + xor edi, ebp + mov ebp, DWORD PTR 4[esp] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + xor edi, ebp + mov ebp, eax + rol edi, 1 + xor ebp, ebx + mov DWORD PTR 36[esp],edi + xor ebp, ecx + lea edi, DWORD PTR 1859775393[edx*1+edi] + mov edx, esi + rol edx, 5 + ror eax, 1 + add edx, ebp + ror eax, 1 + add edi, edx + ; 20_39 26 + mov edx, DWORD PTR 40[esp] + mov ebp, DWORD PTR 48[esp] + xor edx, ebp + mov ebp, DWORD PTR 8[esp] + xor edx, ebp + mov ebp, DWORD PTR 28[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + xor ebp, eax + mov DWORD PTR 40[esp],edx + xor ebp, ebx + lea edx, DWORD PTR 1859775393[ecx*1+edx] + mov ecx, edi + rol ecx, 5 + ror esi, 1 + add ecx, ebp + ror esi, 1 + add edx, ecx + ; 20_39 27 + mov ecx, DWORD PTR 44[esp] + mov ebp, DWORD PTR 52[esp] + xor ecx, ebp + mov ebp, DWORD PTR 12[esp] + xor ecx, ebp + mov ebp, DWORD PTR 32[esp] + xor ecx, ebp + mov ebp, edi + rol ecx, 1 + xor ebp, esi + mov DWORD PTR 44[esp],ecx + xor ebp, eax + lea ecx, DWORD PTR 1859775393[ebx*1+ecx] + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebx, ebp + ror edi, 1 + add ecx, ebx + ; 20_39 28 + mov ebx, DWORD PTR 48[esp] + mov ebp, DWORD PTR 56[esp] + xor ebx, ebp + mov ebp, DWORD PTR 16[esp] + xor ebx, ebp + mov ebp, DWORD PTR 36[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + xor ebp, edi + mov DWORD PTR 48[esp],ebx + xor ebp, esi + lea ebx, DWORD PTR 1859775393[eax*1+ebx] + mov eax, ecx + rol eax, 5 + ror edx, 1 + add eax, ebp + ror edx, 1 + add ebx, eax + ; 20_39 29 + mov eax, DWORD PTR 52[esp] + mov ebp, DWORD PTR 60[esp] + xor eax, ebp + mov ebp, DWORD PTR 20[esp] + xor eax, ebp + mov ebp, DWORD PTR 40[esp] + xor eax, ebp + mov ebp, ecx + rol eax, 1 + xor ebp, edx + mov DWORD PTR 52[esp],eax + xor ebp, edi + lea eax, DWORD PTR 1859775393[esi*1+eax] + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add esi, ebp + ror ecx, 1 + add eax, esi + ; 20_39 30 + mov esi, DWORD PTR 56[esp] + mov ebp, DWORD PTR [esp] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + xor esi, ebp + mov ebp, DWORD PTR 44[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + xor ebp, ecx + mov DWORD PTR 56[esp],esi + xor ebp, edx + lea esi, DWORD PTR 1859775393[edi*1+esi] + mov edi, eax + rol edi, 5 + ror ebx, 1 + add edi, ebp + ror ebx, 1 + add esi, edi + ; 20_39 31 + mov edi, DWORD PTR 60[esp] + mov ebp, DWORD PTR 4[esp] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + xor edi, ebp + mov ebp, DWORD PTR 48[esp] + xor edi, ebp + mov ebp, eax + rol edi, 1 + xor ebp, ebx + mov DWORD PTR 60[esp],edi + xor ebp, ecx + lea edi, DWORD PTR 1859775393[edx*1+edi] + mov edx, esi + rol edx, 5 + ror eax, 1 + add edx, ebp + ror eax, 1 + add edi, edx + ; 20_39 32 + mov edx, DWORD PTR [esp] + mov ebp, DWORD PTR 8[esp] + xor edx, ebp + mov ebp, DWORD PTR 32[esp] + xor edx, ebp + mov ebp, DWORD PTR 52[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + xor ebp, eax + mov DWORD PTR [esp],edx + xor ebp, ebx + lea edx, DWORD PTR 1859775393[ecx*1+edx] + mov ecx, edi + rol ecx, 5 + ror esi, 1 + add ecx, ebp + ror esi, 1 + add edx, ecx + ; 20_39 33 + mov ecx, DWORD PTR 4[esp] + mov ebp, DWORD PTR 12[esp] + xor ecx, ebp + mov ebp, DWORD PTR 36[esp] + xor ecx, ebp + mov ebp, DWORD PTR 56[esp] + xor ecx, ebp + mov ebp, edi + rol ecx, 1 + xor ebp, esi + mov DWORD PTR 4[esp],ecx + xor ebp, eax + lea ecx, DWORD PTR 1859775393[ebx*1+ecx] + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebx, ebp + ror edi, 1 + add ecx, ebx + ; 20_39 34 + mov ebx, DWORD PTR 8[esp] + mov ebp, DWORD PTR 16[esp] + xor ebx, ebp + mov ebp, DWORD PTR 40[esp] + xor ebx, ebp + mov ebp, DWORD PTR 60[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + xor ebp, edi + mov DWORD PTR 8[esp],ebx + xor ebp, esi + lea ebx, DWORD PTR 1859775393[eax*1+ebx] + mov eax, ecx + rol eax, 5 + ror edx, 1 + add eax, ebp + ror edx, 1 + add ebx, eax + ; 20_39 35 + mov eax, DWORD PTR 12[esp] + mov ebp, DWORD PTR 20[esp] + xor eax, ebp + mov ebp, DWORD PTR 44[esp] + xor eax, ebp + mov ebp, DWORD PTR [esp] + xor eax, ebp + mov ebp, ecx + rol eax, 1 + xor ebp, edx + mov DWORD PTR 12[esp],eax + xor ebp, edi + lea eax, DWORD PTR 1859775393[esi*1+eax] + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add esi, ebp + ror ecx, 1 + add eax, esi + ; 20_39 36 + mov esi, DWORD PTR 16[esp] + mov ebp, DWORD PTR 24[esp] + xor esi, ebp + mov ebp, DWORD PTR 48[esp] + xor esi, ebp + mov ebp, DWORD PTR 4[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + xor ebp, ecx + mov DWORD PTR 16[esp],esi + xor ebp, edx + lea esi, DWORD PTR 1859775393[edi*1+esi] + mov edi, eax + rol edi, 5 + ror ebx, 1 + add edi, ebp + ror ebx, 1 + add esi, edi + ; 20_39 37 + mov edi, DWORD PTR 20[esp] + mov ebp, DWORD PTR 28[esp] + xor edi, ebp + mov ebp, DWORD PTR 52[esp] + xor edi, ebp + mov ebp, DWORD PTR 8[esp] + xor edi, ebp + mov ebp, eax + rol edi, 1 + xor ebp, ebx + mov DWORD PTR 20[esp],edi + xor ebp, ecx + lea edi, DWORD PTR 1859775393[edx*1+edi] + mov edx, esi + rol edx, 5 + ror eax, 1 + add edx, ebp + ror eax, 1 + add edi, edx + ; 20_39 38 + mov edx, DWORD PTR 24[esp] + mov ebp, DWORD PTR 32[esp] + xor edx, ebp + mov ebp, DWORD PTR 56[esp] + xor edx, ebp + mov ebp, DWORD PTR 12[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + xor ebp, eax + mov DWORD PTR 24[esp],edx + xor ebp, ebx + lea edx, DWORD PTR 1859775393[ecx*1+edx] + mov ecx, edi + rol ecx, 5 + ror esi, 1 + add ecx, ebp + ror esi, 1 + add edx, ecx + ; 20_39 39 + mov ecx, DWORD PTR 28[esp] + mov ebp, DWORD PTR 36[esp] + xor ecx, ebp + mov ebp, DWORD PTR 60[esp] + xor ecx, ebp + mov ebp, DWORD PTR 16[esp] + xor ecx, ebp + mov ebp, edi + rol ecx, 1 + xor ebp, esi + mov DWORD PTR 28[esp],ecx + xor ebp, eax + lea ecx, DWORD PTR 1859775393[ebx*1+ecx] + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebx, ebp + ror edi, 1 + add ecx, ebx + ; 40_59 40 + mov ebx, DWORD PTR 32[esp] + mov ebp, DWORD PTR 40[esp] + xor ebx, ebp + mov ebp, DWORD PTR [esp] + xor ebx, ebp + mov ebp, DWORD PTR 20[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + or ebp, edi + mov DWORD PTR 32[esp],ebx + and ebp, esi + lea ebx, DWORD PTR 2400959708[eax*1+ebx] + mov eax, edx + ror edx, 1 + and eax, edi + or ebp, eax + mov eax, ecx + rol eax, 5 + add ebp, eax + mov eax, DWORD PTR 36[esp] + add ebx, ebp + mov ebp, DWORD PTR 44[esp] + xor eax, ebp + mov ebp, DWORD PTR 4[esp] + xor eax, ebp + mov ebp, DWORD PTR 24[esp] + ror edx, 1 + xor eax, ebp + rol eax, 1 + mov ebp, ecx + mov DWORD PTR 36[esp],eax + or ebp, edx + lea eax, DWORD PTR 2400959708[esi*1+eax] + mov esi, ecx + and ebp, edi + and esi, edx + or ebp, esi + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add ebp, esi + ror ecx, 1 + add eax, ebp + ; 40_59 41 + ; 40_59 42 + mov esi, DWORD PTR 40[esp] + mov ebp, DWORD PTR 48[esp] + xor esi, ebp + mov ebp, DWORD PTR 8[esp] + xor esi, ebp + mov ebp, DWORD PTR 28[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + or ebp, ecx + mov DWORD PTR 40[esp],esi + and ebp, edx + lea esi, DWORD PTR 2400959708[edi*1+esi] + mov edi, ebx + ror ebx, 1 + and edi, ecx + or ebp, edi + mov edi, eax + rol edi, 5 + add ebp, edi + mov edi, DWORD PTR 44[esp] + add esi, ebp + mov ebp, DWORD PTR 52[esp] + xor edi, ebp + mov ebp, DWORD PTR 12[esp] + xor edi, ebp + mov ebp, DWORD PTR 32[esp] + ror ebx, 1 + xor edi, ebp + rol edi, 1 + mov ebp, eax + mov DWORD PTR 44[esp],edi + or ebp, ebx + lea edi, DWORD PTR 2400959708[edx*1+edi] + mov edx, eax + and ebp, ecx + and edx, ebx + or ebp, edx + mov edx, esi + rol edx, 5 + ror eax, 1 + add ebp, edx + ror eax, 1 + add edi, ebp + ; 40_59 43 + ; 40_59 44 + mov edx, DWORD PTR 48[esp] + mov ebp, DWORD PTR 56[esp] + xor edx, ebp + mov ebp, DWORD PTR 16[esp] + xor edx, ebp + mov ebp, DWORD PTR 36[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + or ebp, eax + mov DWORD PTR 48[esp],edx + and ebp, ebx + lea edx, DWORD PTR 2400959708[ecx*1+edx] + mov ecx, esi + ror esi, 1 + and ecx, eax + or ebp, ecx + mov ecx, edi + rol ecx, 5 + add ebp, ecx + mov ecx, DWORD PTR 52[esp] + add edx, ebp + mov ebp, DWORD PTR 60[esp] + xor ecx, ebp + mov ebp, DWORD PTR 20[esp] + xor ecx, ebp + mov ebp, DWORD PTR 40[esp] + ror esi, 1 + xor ecx, ebp + rol ecx, 1 + mov ebp, edi + mov DWORD PTR 52[esp],ecx + or ebp, esi + lea ecx, DWORD PTR 2400959708[ebx*1+ecx] + mov ebx, edi + and ebp, eax + and ebx, esi + or ebp, ebx + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebp, ebx + ror edi, 1 + add ecx, ebp + ; 40_59 45 + ; 40_59 46 + mov ebx, DWORD PTR 56[esp] + mov ebp, DWORD PTR [esp] + xor ebx, ebp + mov ebp, DWORD PTR 24[esp] + xor ebx, ebp + mov ebp, DWORD PTR 44[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + or ebp, edi + mov DWORD PTR 56[esp],ebx + and ebp, esi + lea ebx, DWORD PTR 2400959708[eax*1+ebx] + mov eax, edx + ror edx, 1 + and eax, edi + or ebp, eax + mov eax, ecx + rol eax, 5 + add ebp, eax + mov eax, DWORD PTR 60[esp] + add ebx, ebp + mov ebp, DWORD PTR 4[esp] + xor eax, ebp + mov ebp, DWORD PTR 28[esp] + xor eax, ebp + mov ebp, DWORD PTR 48[esp] + ror edx, 1 + xor eax, ebp + rol eax, 1 + mov ebp, ecx + mov DWORD PTR 60[esp],eax + or ebp, edx + lea eax, DWORD PTR 2400959708[esi*1+eax] + mov esi, ecx + and ebp, edi + and esi, edx + or ebp, esi + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add ebp, esi + ror ecx, 1 + add eax, ebp + ; 40_59 47 + ; 40_59 48 + mov esi, DWORD PTR [esp] + mov ebp, DWORD PTR 8[esp] + xor esi, ebp + mov ebp, DWORD PTR 32[esp] + xor esi, ebp + mov ebp, DWORD PTR 52[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + or ebp, ecx + mov DWORD PTR [esp],esi + and ebp, edx + lea esi, DWORD PTR 2400959708[edi*1+esi] + mov edi, ebx + ror ebx, 1 + and edi, ecx + or ebp, edi + mov edi, eax + rol edi, 5 + add ebp, edi + mov edi, DWORD PTR 4[esp] + add esi, ebp + mov ebp, DWORD PTR 12[esp] + xor edi, ebp + mov ebp, DWORD PTR 36[esp] + xor edi, ebp + mov ebp, DWORD PTR 56[esp] + ror ebx, 1 + xor edi, ebp + rol edi, 1 + mov ebp, eax + mov DWORD PTR 4[esp],edi + or ebp, ebx + lea edi, DWORD PTR 2400959708[edx*1+edi] + mov edx, eax + and ebp, ecx + and edx, ebx + or ebp, edx + mov edx, esi + rol edx, 5 + ror eax, 1 + add ebp, edx + ror eax, 1 + add edi, ebp + ; 40_59 49 + ; 40_59 50 + mov edx, DWORD PTR 8[esp] + mov ebp, DWORD PTR 16[esp] + xor edx, ebp + mov ebp, DWORD PTR 40[esp] + xor edx, ebp + mov ebp, DWORD PTR 60[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + or ebp, eax + mov DWORD PTR 8[esp],edx + and ebp, ebx + lea edx, DWORD PTR 2400959708[ecx*1+edx] + mov ecx, esi + ror esi, 1 + and ecx, eax + or ebp, ecx + mov ecx, edi + rol ecx, 5 + add ebp, ecx + mov ecx, DWORD PTR 12[esp] + add edx, ebp + mov ebp, DWORD PTR 20[esp] + xor ecx, ebp + mov ebp, DWORD PTR 44[esp] + xor ecx, ebp + mov ebp, DWORD PTR [esp] + ror esi, 1 + xor ecx, ebp + rol ecx, 1 + mov ebp, edi + mov DWORD PTR 12[esp],ecx + or ebp, esi + lea ecx, DWORD PTR 2400959708[ebx*1+ecx] + mov ebx, edi + and ebp, eax + and ebx, esi + or ebp, ebx + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebp, ebx + ror edi, 1 + add ecx, ebp + ; 40_59 51 + ; 40_59 52 + mov ebx, DWORD PTR 16[esp] + mov ebp, DWORD PTR 24[esp] + xor ebx, ebp + mov ebp, DWORD PTR 48[esp] + xor ebx, ebp + mov ebp, DWORD PTR 4[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + or ebp, edi + mov DWORD PTR 16[esp],ebx + and ebp, esi + lea ebx, DWORD PTR 2400959708[eax*1+ebx] + mov eax, edx + ror edx, 1 + and eax, edi + or ebp, eax + mov eax, ecx + rol eax, 5 + add ebp, eax + mov eax, DWORD PTR 20[esp] + add ebx, ebp + mov ebp, DWORD PTR 28[esp] + xor eax, ebp + mov ebp, DWORD PTR 52[esp] + xor eax, ebp + mov ebp, DWORD PTR 8[esp] + ror edx, 1 + xor eax, ebp + rol eax, 1 + mov ebp, ecx + mov DWORD PTR 20[esp],eax + or ebp, edx + lea eax, DWORD PTR 2400959708[esi*1+eax] + mov esi, ecx + and ebp, edi + and esi, edx + or ebp, esi + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add ebp, esi + ror ecx, 1 + add eax, ebp + ; 40_59 53 + ; 40_59 54 + mov esi, DWORD PTR 24[esp] + mov ebp, DWORD PTR 32[esp] + xor esi, ebp + mov ebp, DWORD PTR 56[esp] + xor esi, ebp + mov ebp, DWORD PTR 12[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + or ebp, ecx + mov DWORD PTR 24[esp],esi + and ebp, edx + lea esi, DWORD PTR 2400959708[edi*1+esi] + mov edi, ebx + ror ebx, 1 + and edi, ecx + or ebp, edi + mov edi, eax + rol edi, 5 + add ebp, edi + mov edi, DWORD PTR 28[esp] + add esi, ebp + mov ebp, DWORD PTR 36[esp] + xor edi, ebp + mov ebp, DWORD PTR 60[esp] + xor edi, ebp + mov ebp, DWORD PTR 16[esp] + ror ebx, 1 + xor edi, ebp + rol edi, 1 + mov ebp, eax + mov DWORD PTR 28[esp],edi + or ebp, ebx + lea edi, DWORD PTR 2400959708[edx*1+edi] + mov edx, eax + and ebp, ecx + and edx, ebx + or ebp, edx + mov edx, esi + rol edx, 5 + ror eax, 1 + add ebp, edx + ror eax, 1 + add edi, ebp + ; 40_59 55 + ; 40_59 56 + mov edx, DWORD PTR 32[esp] + mov ebp, DWORD PTR 40[esp] + xor edx, ebp + mov ebp, DWORD PTR [esp] + xor edx, ebp + mov ebp, DWORD PTR 20[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + or ebp, eax + mov DWORD PTR 32[esp],edx + and ebp, ebx + lea edx, DWORD PTR 2400959708[ecx*1+edx] + mov ecx, esi + ror esi, 1 + and ecx, eax + or ebp, ecx + mov ecx, edi + rol ecx, 5 + add ebp, ecx + mov ecx, DWORD PTR 36[esp] + add edx, ebp + mov ebp, DWORD PTR 44[esp] + xor ecx, ebp + mov ebp, DWORD PTR 4[esp] + xor ecx, ebp + mov ebp, DWORD PTR 24[esp] + ror esi, 1 + xor ecx, ebp + rol ecx, 1 + mov ebp, edi + mov DWORD PTR 36[esp],ecx + or ebp, esi + lea ecx, DWORD PTR 2400959708[ebx*1+ecx] + mov ebx, edi + and ebp, eax + and ebx, esi + or ebp, ebx + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebp, ebx + ror edi, 1 + add ecx, ebp + ; 40_59 57 + ; 40_59 58 + mov ebx, DWORD PTR 40[esp] + mov ebp, DWORD PTR 48[esp] + xor ebx, ebp + mov ebp, DWORD PTR 8[esp] + xor ebx, ebp + mov ebp, DWORD PTR 28[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + or ebp, edi + mov DWORD PTR 40[esp],ebx + and ebp, esi + lea ebx, DWORD PTR 2400959708[eax*1+ebx] + mov eax, edx + ror edx, 1 + and eax, edi + or ebp, eax + mov eax, ecx + rol eax, 5 + add ebp, eax + mov eax, DWORD PTR 44[esp] + add ebx, ebp + mov ebp, DWORD PTR 52[esp] + xor eax, ebp + mov ebp, DWORD PTR 12[esp] + xor eax, ebp + mov ebp, DWORD PTR 32[esp] + ror edx, 1 + xor eax, ebp + rol eax, 1 + mov ebp, ecx + mov DWORD PTR 44[esp],eax + or ebp, edx + lea eax, DWORD PTR 2400959708[esi*1+eax] + mov esi, ecx + and ebp, edi + and esi, edx + or ebp, esi + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add ebp, esi + ror ecx, 1 + add eax, ebp + ; 40_59 59 + ; 20_39 60 + mov esi, DWORD PTR 48[esp] + mov ebp, DWORD PTR 56[esp] + xor esi, ebp + mov ebp, DWORD PTR 16[esp] + xor esi, ebp + mov ebp, DWORD PTR 36[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + xor ebp, ecx + mov DWORD PTR 48[esp],esi + xor ebp, edx + lea esi, DWORD PTR 3395469782[edi*1+esi] + mov edi, eax + rol edi, 5 + ror ebx, 1 + add edi, ebp + ror ebx, 1 + add esi, edi + ; 20_39 61 + mov edi, DWORD PTR 52[esp] + mov ebp, DWORD PTR 60[esp] + xor edi, ebp + mov ebp, DWORD PTR 20[esp] + xor edi, ebp + mov ebp, DWORD PTR 40[esp] + xor edi, ebp + mov ebp, eax + rol edi, 1 + xor ebp, ebx + mov DWORD PTR 52[esp],edi + xor ebp, ecx + lea edi, DWORD PTR 3395469782[edx*1+edi] + mov edx, esi + rol edx, 5 + ror eax, 1 + add edx, ebp + ror eax, 1 + add edi, edx + ; 20_39 62 + mov edx, DWORD PTR 56[esp] + mov ebp, DWORD PTR [esp] + xor edx, ebp + mov ebp, DWORD PTR 24[esp] + xor edx, ebp + mov ebp, DWORD PTR 44[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + xor ebp, eax + mov DWORD PTR 56[esp],edx + xor ebp, ebx + lea edx, DWORD PTR 3395469782[ecx*1+edx] + mov ecx, edi + rol ecx, 5 + ror esi, 1 + add ecx, ebp + ror esi, 1 + add edx, ecx + ; 20_39 63 + mov ecx, DWORD PTR 60[esp] + mov ebp, DWORD PTR 4[esp] + xor ecx, ebp + mov ebp, DWORD PTR 28[esp] + xor ecx, ebp + mov ebp, DWORD PTR 48[esp] + xor ecx, ebp + mov ebp, edi + rol ecx, 1 + xor ebp, esi + mov DWORD PTR 60[esp],ecx + xor ebp, eax + lea ecx, DWORD PTR 3395469782[ebx*1+ecx] + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebx, ebp + ror edi, 1 + add ecx, ebx + ; 20_39 64 + mov ebx, DWORD PTR [esp] + mov ebp, DWORD PTR 8[esp] + xor ebx, ebp + mov ebp, DWORD PTR 32[esp] + xor ebx, ebp + mov ebp, DWORD PTR 52[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + xor ebp, edi + mov DWORD PTR [esp],ebx + xor ebp, esi + lea ebx, DWORD PTR 3395469782[eax*1+ebx] + mov eax, ecx + rol eax, 5 + ror edx, 1 + add eax, ebp + ror edx, 1 + add ebx, eax + ; 20_39 65 + mov eax, DWORD PTR 4[esp] + mov ebp, DWORD PTR 12[esp] + xor eax, ebp + mov ebp, DWORD PTR 36[esp] + xor eax, ebp + mov ebp, DWORD PTR 56[esp] + xor eax, ebp + mov ebp, ecx + rol eax, 1 + xor ebp, edx + mov DWORD PTR 4[esp],eax + xor ebp, edi + lea eax, DWORD PTR 3395469782[esi*1+eax] + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add esi, ebp + ror ecx, 1 + add eax, esi + ; 20_39 66 + mov esi, DWORD PTR 8[esp] + mov ebp, DWORD PTR 16[esp] + xor esi, ebp + mov ebp, DWORD PTR 40[esp] + xor esi, ebp + mov ebp, DWORD PTR 60[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + xor ebp, ecx + mov DWORD PTR 8[esp],esi + xor ebp, edx + lea esi, DWORD PTR 3395469782[edi*1+esi] + mov edi, eax + rol edi, 5 + ror ebx, 1 + add edi, ebp + ror ebx, 1 + add esi, edi + ; 20_39 67 + mov edi, DWORD PTR 12[esp] + mov ebp, DWORD PTR 20[esp] + xor edi, ebp + mov ebp, DWORD PTR 44[esp] + xor edi, ebp + mov ebp, DWORD PTR [esp] + xor edi, ebp + mov ebp, eax + rol edi, 1 + xor ebp, ebx + mov DWORD PTR 12[esp],edi + xor ebp, ecx + lea edi, DWORD PTR 3395469782[edx*1+edi] + mov edx, esi + rol edx, 5 + ror eax, 1 + add edx, ebp + ror eax, 1 + add edi, edx + ; 20_39 68 + mov edx, DWORD PTR 16[esp] + mov ebp, DWORD PTR 24[esp] + xor edx, ebp + mov ebp, DWORD PTR 48[esp] + xor edx, ebp + mov ebp, DWORD PTR 4[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + xor ebp, eax + mov DWORD PTR 16[esp],edx + xor ebp, ebx + lea edx, DWORD PTR 3395469782[ecx*1+edx] + mov ecx, edi + rol ecx, 5 + ror esi, 1 + add ecx, ebp + ror esi, 1 + add edx, ecx + ; 20_39 69 + mov ecx, DWORD PTR 20[esp] + mov ebp, DWORD PTR 28[esp] + xor ecx, ebp + mov ebp, DWORD PTR 52[esp] + xor ecx, ebp + mov ebp, DWORD PTR 8[esp] + xor ecx, ebp + mov ebp, edi + rol ecx, 1 + xor ebp, esi + mov DWORD PTR 20[esp],ecx + xor ebp, eax + lea ecx, DWORD PTR 3395469782[ebx*1+ecx] + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebx, ebp + ror edi, 1 + add ecx, ebx + ; 20_39 70 + mov ebx, DWORD PTR 24[esp] + mov ebp, DWORD PTR 32[esp] + xor ebx, ebp + mov ebp, DWORD PTR 56[esp] + xor ebx, ebp + mov ebp, DWORD PTR 12[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + xor ebp, edi + mov DWORD PTR 24[esp],ebx + xor ebp, esi + lea ebx, DWORD PTR 3395469782[eax*1+ebx] + mov eax, ecx + rol eax, 5 + ror edx, 1 + add eax, ebp + ror edx, 1 + add ebx, eax + ; 20_39 71 + mov eax, DWORD PTR 28[esp] + mov ebp, DWORD PTR 36[esp] + xor eax, ebp + mov ebp, DWORD PTR 60[esp] + xor eax, ebp + mov ebp, DWORD PTR 16[esp] + xor eax, ebp + mov ebp, ecx + rol eax, 1 + xor ebp, edx + mov DWORD PTR 28[esp],eax + xor ebp, edi + lea eax, DWORD PTR 3395469782[esi*1+eax] + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add esi, ebp + ror ecx, 1 + add eax, esi + ; 20_39 72 + mov esi, DWORD PTR 32[esp] + mov ebp, DWORD PTR 40[esp] + xor esi, ebp + mov ebp, DWORD PTR [esp] + xor esi, ebp + mov ebp, DWORD PTR 20[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + xor ebp, ecx + mov DWORD PTR 32[esp],esi + xor ebp, edx + lea esi, DWORD PTR 3395469782[edi*1+esi] + mov edi, eax + rol edi, 5 + ror ebx, 1 + add edi, ebp + ror ebx, 1 + add esi, edi + ; 20_39 73 + mov edi, DWORD PTR 36[esp] + mov ebp, DWORD PTR 44[esp] + xor edi, ebp + mov ebp, DWORD PTR 4[esp] + xor edi, ebp + mov ebp, DWORD PTR 24[esp] + xor edi, ebp + mov ebp, eax + rol edi, 1 + xor ebp, ebx + mov DWORD PTR 36[esp],edi + xor ebp, ecx + lea edi, DWORD PTR 3395469782[edx*1+edi] + mov edx, esi + rol edx, 5 + ror eax, 1 + add edx, ebp + ror eax, 1 + add edi, edx + ; 20_39 74 + mov edx, DWORD PTR 40[esp] + mov ebp, DWORD PTR 48[esp] + xor edx, ebp + mov ebp, DWORD PTR 8[esp] + xor edx, ebp + mov ebp, DWORD PTR 28[esp] + xor edx, ebp + mov ebp, esi + rol edx, 1 + xor ebp, eax + mov DWORD PTR 40[esp],edx + xor ebp, ebx + lea edx, DWORD PTR 3395469782[ecx*1+edx] + mov ecx, edi + rol ecx, 5 + ror esi, 1 + add ecx, ebp + ror esi, 1 + add edx, ecx + ; 20_39 75 + mov ecx, DWORD PTR 44[esp] + mov ebp, DWORD PTR 52[esp] + xor ecx, ebp + mov ebp, DWORD PTR 12[esp] + xor ecx, ebp + mov ebp, DWORD PTR 32[esp] + xor ecx, ebp + mov ebp, edi + rol ecx, 1 + xor ebp, esi + mov DWORD PTR 44[esp],ecx + xor ebp, eax + lea ecx, DWORD PTR 3395469782[ebx*1+ecx] + mov ebx, edx + rol ebx, 5 + ror edi, 1 + add ebx, ebp + ror edi, 1 + add ecx, ebx + ; 20_39 76 + mov ebx, DWORD PTR 48[esp] + mov ebp, DWORD PTR 56[esp] + xor ebx, ebp + mov ebp, DWORD PTR 16[esp] + xor ebx, ebp + mov ebp, DWORD PTR 36[esp] + xor ebx, ebp + mov ebp, edx + rol ebx, 1 + xor ebp, edi + mov DWORD PTR 48[esp],ebx + xor ebp, esi + lea ebx, DWORD PTR 3395469782[eax*1+ebx] + mov eax, ecx + rol eax, 5 + ror edx, 1 + add eax, ebp + ror edx, 1 + add ebx, eax + ; 20_39 77 + mov eax, DWORD PTR 52[esp] + mov ebp, DWORD PTR 60[esp] + xor eax, ebp + mov ebp, DWORD PTR 20[esp] + xor eax, ebp + mov ebp, DWORD PTR 40[esp] + xor eax, ebp + mov ebp, ecx + rol eax, 1 + xor ebp, edx + mov DWORD PTR 52[esp],eax + xor ebp, edi + lea eax, DWORD PTR 3395469782[esi*1+eax] + mov esi, ebx + rol esi, 5 + ror ecx, 1 + add esi, ebp + ror ecx, 1 + add eax, esi + ; 20_39 78 + mov esi, DWORD PTR 56[esp] + mov ebp, DWORD PTR [esp] + xor esi, ebp + mov ebp, DWORD PTR 24[esp] + xor esi, ebp + mov ebp, DWORD PTR 44[esp] + xor esi, ebp + mov ebp, ebx + rol esi, 1 + xor ebp, ecx + mov DWORD PTR 56[esp],esi + xor ebp, edx + lea esi, DWORD PTR 3395469782[edi*1+esi] + mov edi, eax + rol edi, 5 + ror ebx, 1 + add edi, ebp + ror ebx, 1 + add esi, edi + ; 20_39 79 + mov edi, DWORD PTR 60[esp] + mov ebp, DWORD PTR 4[esp] + xor edi, ebp + mov ebp, DWORD PTR 28[esp] + xor edi, ebp + mov ebp, DWORD PTR 48[esp] + xor edi, ebp + mov ebp, eax + rol edi, 1 + xor ebp, ebx + mov DWORD PTR 60[esp],edi + xor ebp, ecx + lea edi, DWORD PTR 3395469782[edx*1+edi] + mov edx, esi + rol edx, 5 + add edx, ebp + mov ebp, DWORD PTR 92[esp] + ror eax, 1 + add edi, edx + ror eax, 1 + ; End processing + ; + mov edx, DWORD PTR 12[ebp] + add edx, ebx + mov ebx, DWORD PTR 4[ebp] + add ebx, esi + mov esi, eax + mov eax, DWORD PTR [ebp] + mov DWORD PTR 12[ebp],edx + add eax, edi + mov edi, DWORD PTR 16[ebp] + add edi, ecx + mov ecx, DWORD PTR 8[ebp] + add ecx, esi + mov DWORD PTR [ebp],eax + mov esi, DWORD PTR 64[esp] + mov DWORD PTR 8[ebp],ecx + add esi, 64 + mov eax, DWORD PTR 68[esp] + mov DWORD PTR 16[ebp],edi + cmp eax, esi + mov DWORD PTR 4[ebp],ebx + jl $L001end + mov eax, DWORD PTR [esi] + jmp L000start +$L001end: + add esp, 72 + pop edi + pop ebx + pop ebp + pop esi + ret +_sha1_block_x86 ENDP +_TEXT ENDS +END diff --git a/src/lib/libssl/src/crypto/sha/asm/sx86unix.cpp b/src/lib/libssl/src/crypto/sha/asm/sx86unix.cpp new file mode 100644 index 0000000000..8366664a39 --- /dev/null +++ b/src/lib/libssl/src/crypto/sha/asm/sx86unix.cpp @@ -0,0 +1,1948 @@ +/* Run the C pre-processor over this file with one of the following defined + * ELF - elf object files, + * OUT - a.out object files, + * BSDI - BSDI style a.out object files + * SOL - Solaris style elf + */ + +#define TYPE(a,b) .type a,b +#define SIZE(a,b) .size a,b + +#if defined(OUT) || defined(BSDI) +#define sha1_block_x86 _sha1_block_x86 + +#endif + +#ifdef OUT +#define OK 1 +#define ALIGN 4 +#endif + +#ifdef BSDI +#define OK 1 +#define ALIGN 4 +#undef SIZE +#undef TYPE +#define SIZE(a,b) +#define TYPE(a,b) +#endif + +#if defined(ELF) || defined(SOL) +#define OK 1 +#define ALIGN 16 +#endif + +#ifndef OK +You need to define one of +ELF - elf systems - linux-elf, NetBSD and DG-UX +OUT - a.out systems - linux-a.out and FreeBSD +SOL - solaris systems, which are elf with strange comment lines +BSDI - a.out with a very primative version of as. +#endif + +/* Let the Assembler begin :-) */ + /* Don't even think of reading this code */ + /* It was automatically generated by sha1-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric <eay@cryptsoft.com> */ + + .file "sha1-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl sha1_block_x86 + TYPE(sha1_block_x86,@function) +sha1_block_x86: + pushl %esi + pushl %ebp + movl 20(%esp), %eax + movl 16(%esp), %esi + addl %esi, %eax + movl 12(%esp), %ebp + pushl %ebx + subl $64, %eax + pushl %edi + movl 4(%ebp), %ebx + subl $72, %esp + movl 12(%ebp), %edx + movl 16(%ebp), %edi + movl 8(%ebp), %ecx + movl %eax, 68(%esp) + /* First we need to setup the X array */ + movl (%esi), %eax +.L000start: + /* First, load the words onto the stack in network byte order */ +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, (%esp) + movl 4(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 4(%esp) + movl 8(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 8(%esp) + movl 12(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 12(%esp) + movl 16(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 16(%esp) + movl 20(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 20(%esp) + movl 24(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 24(%esp) + movl 28(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 28(%esp) + movl 32(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 32(%esp) + movl 36(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 36(%esp) + movl 40(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 40(%esp) + movl 44(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 44(%esp) + movl 48(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 48(%esp) + movl 52(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 52(%esp) + movl 56(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 56(%esp) + movl 60(%esi), %eax +.byte 15 +.byte 200 /* bswapl %eax */ + movl %eax, 60(%esp) + /* We now have the X array on the stack */ + /* starting at sp-4 */ + movl %esi, 64(%esp) + + /* Start processing */ + movl (%ebp), %eax + /* 00_15 0 */ + movl %ecx, %esi + movl %eax, %ebp + xorl %edx, %esi + roll $5, %ebp + andl %ebx, %esi + addl %edi, %ebp +.byte 209 +.byte 203 /* rorl $1 %ebx */ + movl (%esp), %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + xorl %edx, %esi + leal 1518500249(%ebp,%edi,1),%ebp + movl %ebx, %edi + addl %ebp, %esi + xorl %ecx, %edi + movl %esi, %ebp + andl %eax, %edi + roll $5, %ebp + addl %edx, %ebp + movl 4(%esp), %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + xorl %ecx, %edi +.byte 209 +.byte 200 /* rorl $1 %eax */ + leal 1518500249(%ebp,%edx,1),%ebp + addl %ebp, %edi + /* 00_15 2 */ + movl %eax, %edx + movl %edi, %ebp + xorl %ebx, %edx + roll $5, %ebp + andl %esi, %edx + addl %ecx, %ebp +.byte 209 +.byte 206 /* rorl $1 %esi */ + movl 8(%esp), %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + xorl %ebx, %edx + leal 1518500249(%ebp,%ecx,1),%ebp + movl %esi, %ecx + addl %ebp, %edx + xorl %eax, %ecx + movl %edx, %ebp + andl %edi, %ecx + roll $5, %ebp + addl %ebx, %ebp + movl 12(%esp), %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + xorl %eax, %ecx +.byte 209 +.byte 207 /* rorl $1 %edi */ + leal 1518500249(%ebp,%ebx,1),%ebp + addl %ebp, %ecx + /* 00_15 4 */ + movl %edi, %ebx + movl %ecx, %ebp + xorl %esi, %ebx + roll $5, %ebp + andl %edx, %ebx + addl %eax, %ebp +.byte 209 +.byte 202 /* rorl $1 %edx */ + movl 16(%esp), %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + xorl %esi, %ebx + leal 1518500249(%ebp,%eax,1),%ebp + movl %edx, %eax + addl %ebp, %ebx + xorl %edi, %eax + movl %ebx, %ebp + andl %ecx, %eax + roll $5, %ebp + addl %esi, %ebp + movl 20(%esp), %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + xorl %edi, %eax +.byte 209 +.byte 201 /* rorl $1 %ecx */ + leal 1518500249(%ebp,%esi,1),%ebp + addl %ebp, %eax + /* 00_15 6 */ + movl %ecx, %esi + movl %eax, %ebp + xorl %edx, %esi + roll $5, %ebp + andl %ebx, %esi + addl %edi, %ebp +.byte 209 +.byte 203 /* rorl $1 %ebx */ + movl 24(%esp), %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + xorl %edx, %esi + leal 1518500249(%ebp,%edi,1),%ebp + movl %ebx, %edi + addl %ebp, %esi + xorl %ecx, %edi + movl %esi, %ebp + andl %eax, %edi + roll $5, %ebp + addl %edx, %ebp + movl 28(%esp), %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + xorl %ecx, %edi +.byte 209 +.byte 200 /* rorl $1 %eax */ + leal 1518500249(%ebp,%edx,1),%ebp + addl %ebp, %edi + /* 00_15 8 */ + movl %eax, %edx + movl %edi, %ebp + xorl %ebx, %edx + roll $5, %ebp + andl %esi, %edx + addl %ecx, %ebp +.byte 209 +.byte 206 /* rorl $1 %esi */ + movl 32(%esp), %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + xorl %ebx, %edx + leal 1518500249(%ebp,%ecx,1),%ebp + movl %esi, %ecx + addl %ebp, %edx + xorl %eax, %ecx + movl %edx, %ebp + andl %edi, %ecx + roll $5, %ebp + addl %ebx, %ebp + movl 36(%esp), %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + xorl %eax, %ecx +.byte 209 +.byte 207 /* rorl $1 %edi */ + leal 1518500249(%ebp,%ebx,1),%ebp + addl %ebp, %ecx + /* 00_15 10 */ + movl %edi, %ebx + movl %ecx, %ebp + xorl %esi, %ebx + roll $5, %ebp + andl %edx, %ebx + addl %eax, %ebp +.byte 209 +.byte 202 /* rorl $1 %edx */ + movl 40(%esp), %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + xorl %esi, %ebx + leal 1518500249(%ebp,%eax,1),%ebp + movl %edx, %eax + addl %ebp, %ebx + xorl %edi, %eax + movl %ebx, %ebp + andl %ecx, %eax + roll $5, %ebp + addl %esi, %ebp + movl 44(%esp), %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + xorl %edi, %eax +.byte 209 +.byte 201 /* rorl $1 %ecx */ + leal 1518500249(%ebp,%esi,1),%ebp + addl %ebp, %eax + /* 00_15 12 */ + movl %ecx, %esi + movl %eax, %ebp + xorl %edx, %esi + roll $5, %ebp + andl %ebx, %esi + addl %edi, %ebp +.byte 209 +.byte 203 /* rorl $1 %ebx */ + movl 48(%esp), %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + xorl %edx, %esi + leal 1518500249(%ebp,%edi,1),%ebp + movl %ebx, %edi + addl %ebp, %esi + xorl %ecx, %edi + movl %esi, %ebp + andl %eax, %edi + roll $5, %ebp + addl %edx, %ebp + movl 52(%esp), %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + xorl %ecx, %edi +.byte 209 +.byte 200 /* rorl $1 %eax */ + leal 1518500249(%ebp,%edx,1),%ebp + addl %ebp, %edi + /* 00_15 14 */ + movl %eax, %edx + movl %edi, %ebp + xorl %ebx, %edx + roll $5, %ebp + andl %esi, %edx + addl %ecx, %ebp +.byte 209 +.byte 206 /* rorl $1 %esi */ + movl 56(%esp), %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + xorl %ebx, %edx + leal 1518500249(%ebp,%ecx,1),%ebp + movl %esi, %ecx + addl %ebp, %edx + xorl %eax, %ecx + movl %edx, %ebp + andl %edi, %ecx + roll $5, %ebp + addl %ebx, %ebp + movl 60(%esp), %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + xorl %eax, %ecx +.byte 209 +.byte 207 /* rorl $1 %edi */ + leal 1518500249(%ebp,%ebx,1),%ebp + addl %ebp, %ecx + /* 16_19 16 */ + nop + movl (%esp), %ebp + movl 8(%esp), %ebx + xorl %ebp, %ebx + movl 32(%esp), %ebp + xorl %ebp, %ebx + movl 52(%esp), %ebp + xorl %ebp, %ebx + movl %edi, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + xorl %esi, %ebp + movl %ebx, (%esp) + andl %edx, %ebp + leal 1518500249(%ebx,%eax,1),%ebx + xorl %esi, %ebp + movl %ecx, %eax + addl %ebp, %ebx + roll $5, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %eax, %ebx + movl 4(%esp), %eax + movl 12(%esp), %ebp + xorl %ebp, %eax + movl 36(%esp), %ebp + xorl %ebp, %eax + movl 56(%esp), %ebp +.byte 209 +.byte 202 /* rorl $1 %edx */ + xorl %ebp, %eax +.byte 209 +.byte 192 /* roll $1 %eax */ + movl %edx, %ebp + xorl %edi, %ebp + movl %eax, 4(%esp) + andl %ecx, %ebp + leal 1518500249(%eax,%esi,1),%eax + xorl %edi, %ebp + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %eax +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %eax + /* 16_19 18 */ + movl 8(%esp), %ebp + movl 16(%esp), %esi + xorl %ebp, %esi + movl 40(%esp), %ebp + xorl %ebp, %esi + movl 60(%esp), %ebp + xorl %ebp, %esi + movl %ecx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + xorl %edx, %ebp + movl %esi, 8(%esp) + andl %ebx, %ebp + leal 1518500249(%esi,%edi,1),%esi + xorl %edx, %ebp + movl %eax, %edi + addl %ebp, %esi + roll $5, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %edi, %esi + movl 12(%esp), %edi + movl 20(%esp), %ebp + xorl %ebp, %edi + movl 44(%esp), %ebp + xorl %ebp, %edi + movl (%esp), %ebp +.byte 209 +.byte 203 /* rorl $1 %ebx */ + xorl %ebp, %edi +.byte 209 +.byte 199 /* roll $1 %edi */ + movl %ebx, %ebp + xorl %ecx, %ebp + movl %edi, 12(%esp) + andl %eax, %ebp + leal 1518500249(%edi,%edx,1),%edi + xorl %ecx, %ebp + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %edi +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edi + /* 20_39 20 */ + movl 16(%esp), %edx + movl 24(%esp), %ebp + xorl %ebp, %edx + movl 48(%esp), %ebp + xorl %ebp, %edx + movl 4(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + xorl %eax, %ebp + movl %edx, 16(%esp) + xorl %ebx, %ebp + leal 1859775393(%edx,%ecx,1),%edx + movl %edi, %ecx + roll $5, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ebp, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ecx, %edx + /* 20_39 21 */ + movl 20(%esp), %ecx + movl 28(%esp), %ebp + xorl %ebp, %ecx + movl 52(%esp), %ebp + xorl %ebp, %ecx + movl 8(%esp), %ebp + xorl %ebp, %ecx + movl %edi, %ebp +.byte 209 +.byte 193 /* roll $1 %ecx */ + xorl %esi, %ebp + movl %ecx, 20(%esp) + xorl %eax, %ebp + leal 1859775393(%ecx,%ebx,1),%ecx + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ecx + /* 20_39 22 */ + movl 24(%esp), %ebx + movl 32(%esp), %ebp + xorl %ebp, %ebx + movl 56(%esp), %ebp + xorl %ebp, %ebx + movl 12(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + xorl %edi, %ebp + movl %ebx, 24(%esp) + xorl %esi, %ebp + leal 1859775393(%ebx,%eax,1),%ebx + movl %ecx, %eax + roll $5, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %ebp, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %eax, %ebx + /* 20_39 23 */ + movl 28(%esp), %eax + movl 36(%esp), %ebp + xorl %ebp, %eax + movl 60(%esp), %ebp + xorl %ebp, %eax + movl 16(%esp), %ebp + xorl %ebp, %eax + movl %ecx, %ebp +.byte 209 +.byte 192 /* roll $1 %eax */ + xorl %edx, %ebp + movl %eax, 28(%esp) + xorl %edi, %ebp + leal 1859775393(%eax,%esi,1),%eax + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %eax + /* 20_39 24 */ + movl 32(%esp), %esi + movl 40(%esp), %ebp + xorl %ebp, %esi + movl (%esp), %ebp + xorl %ebp, %esi + movl 20(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + xorl %ecx, %ebp + movl %esi, 32(%esp) + xorl %edx, %ebp + leal 1859775393(%esi,%edi,1),%esi + movl %eax, %edi + roll $5, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %ebp, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %edi, %esi + /* 20_39 25 */ + movl 36(%esp), %edi + movl 44(%esp), %ebp + xorl %ebp, %edi + movl 4(%esp), %ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + xorl %ebp, %edi + movl %eax, %ebp +.byte 209 +.byte 199 /* roll $1 %edi */ + xorl %ebx, %ebp + movl %edi, 36(%esp) + xorl %ecx, %ebp + leal 1859775393(%edi,%edx,1),%edi + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %edi + /* 20_39 26 */ + movl 40(%esp), %edx + movl 48(%esp), %ebp + xorl %ebp, %edx + movl 8(%esp), %ebp + xorl %ebp, %edx + movl 28(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + xorl %eax, %ebp + movl %edx, 40(%esp) + xorl %ebx, %ebp + leal 1859775393(%edx,%ecx,1),%edx + movl %edi, %ecx + roll $5, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ebp, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ecx, %edx + /* 20_39 27 */ + movl 44(%esp), %ecx + movl 52(%esp), %ebp + xorl %ebp, %ecx + movl 12(%esp), %ebp + xorl %ebp, %ecx + movl 32(%esp), %ebp + xorl %ebp, %ecx + movl %edi, %ebp +.byte 209 +.byte 193 /* roll $1 %ecx */ + xorl %esi, %ebp + movl %ecx, 44(%esp) + xorl %eax, %ebp + leal 1859775393(%ecx,%ebx,1),%ecx + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ecx + /* 20_39 28 */ + movl 48(%esp), %ebx + movl 56(%esp), %ebp + xorl %ebp, %ebx + movl 16(%esp), %ebp + xorl %ebp, %ebx + movl 36(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + xorl %edi, %ebp + movl %ebx, 48(%esp) + xorl %esi, %ebp + leal 1859775393(%ebx,%eax,1),%ebx + movl %ecx, %eax + roll $5, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %ebp, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %eax, %ebx + /* 20_39 29 */ + movl 52(%esp), %eax + movl 60(%esp), %ebp + xorl %ebp, %eax + movl 20(%esp), %ebp + xorl %ebp, %eax + movl 40(%esp), %ebp + xorl %ebp, %eax + movl %ecx, %ebp +.byte 209 +.byte 192 /* roll $1 %eax */ + xorl %edx, %ebp + movl %eax, 52(%esp) + xorl %edi, %ebp + leal 1859775393(%eax,%esi,1),%eax + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %eax + /* 20_39 30 */ + movl 56(%esp), %esi + movl (%esp), %ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + xorl %ebp, %esi + movl 44(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + xorl %ecx, %ebp + movl %esi, 56(%esp) + xorl %edx, %ebp + leal 1859775393(%esi,%edi,1),%esi + movl %eax, %edi + roll $5, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %ebp, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %edi, %esi + /* 20_39 31 */ + movl 60(%esp), %edi + movl 4(%esp), %ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + xorl %ebp, %edi + movl 48(%esp), %ebp + xorl %ebp, %edi + movl %eax, %ebp +.byte 209 +.byte 199 /* roll $1 %edi */ + xorl %ebx, %ebp + movl %edi, 60(%esp) + xorl %ecx, %ebp + leal 1859775393(%edi,%edx,1),%edi + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %edi + /* 20_39 32 */ + movl (%esp), %edx + movl 8(%esp), %ebp + xorl %ebp, %edx + movl 32(%esp), %ebp + xorl %ebp, %edx + movl 52(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + xorl %eax, %ebp + movl %edx, (%esp) + xorl %ebx, %ebp + leal 1859775393(%edx,%ecx,1),%edx + movl %edi, %ecx + roll $5, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ebp, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ecx, %edx + /* 20_39 33 */ + movl 4(%esp), %ecx + movl 12(%esp), %ebp + xorl %ebp, %ecx + movl 36(%esp), %ebp + xorl %ebp, %ecx + movl 56(%esp), %ebp + xorl %ebp, %ecx + movl %edi, %ebp +.byte 209 +.byte 193 /* roll $1 %ecx */ + xorl %esi, %ebp + movl %ecx, 4(%esp) + xorl %eax, %ebp + leal 1859775393(%ecx,%ebx,1),%ecx + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ecx + /* 20_39 34 */ + movl 8(%esp), %ebx + movl 16(%esp), %ebp + xorl %ebp, %ebx + movl 40(%esp), %ebp + xorl %ebp, %ebx + movl 60(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + xorl %edi, %ebp + movl %ebx, 8(%esp) + xorl %esi, %ebp + leal 1859775393(%ebx,%eax,1),%ebx + movl %ecx, %eax + roll $5, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %ebp, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %eax, %ebx + /* 20_39 35 */ + movl 12(%esp), %eax + movl 20(%esp), %ebp + xorl %ebp, %eax + movl 44(%esp), %ebp + xorl %ebp, %eax + movl (%esp), %ebp + xorl %ebp, %eax + movl %ecx, %ebp +.byte 209 +.byte 192 /* roll $1 %eax */ + xorl %edx, %ebp + movl %eax, 12(%esp) + xorl %edi, %ebp + leal 1859775393(%eax,%esi,1),%eax + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %eax + /* 20_39 36 */ + movl 16(%esp), %esi + movl 24(%esp), %ebp + xorl %ebp, %esi + movl 48(%esp), %ebp + xorl %ebp, %esi + movl 4(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + xorl %ecx, %ebp + movl %esi, 16(%esp) + xorl %edx, %ebp + leal 1859775393(%esi,%edi,1),%esi + movl %eax, %edi + roll $5, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %ebp, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %edi, %esi + /* 20_39 37 */ + movl 20(%esp), %edi + movl 28(%esp), %ebp + xorl %ebp, %edi + movl 52(%esp), %ebp + xorl %ebp, %edi + movl 8(%esp), %ebp + xorl %ebp, %edi + movl %eax, %ebp +.byte 209 +.byte 199 /* roll $1 %edi */ + xorl %ebx, %ebp + movl %edi, 20(%esp) + xorl %ecx, %ebp + leal 1859775393(%edi,%edx,1),%edi + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %edi + /* 20_39 38 */ + movl 24(%esp), %edx + movl 32(%esp), %ebp + xorl %ebp, %edx + movl 56(%esp), %ebp + xorl %ebp, %edx + movl 12(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + xorl %eax, %ebp + movl %edx, 24(%esp) + xorl %ebx, %ebp + leal 1859775393(%edx,%ecx,1),%edx + movl %edi, %ecx + roll $5, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ebp, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ecx, %edx + /* 20_39 39 */ + movl 28(%esp), %ecx + movl 36(%esp), %ebp + xorl %ebp, %ecx + movl 60(%esp), %ebp + xorl %ebp, %ecx + movl 16(%esp), %ebp + xorl %ebp, %ecx + movl %edi, %ebp +.byte 209 +.byte 193 /* roll $1 %ecx */ + xorl %esi, %ebp + movl %ecx, 28(%esp) + xorl %eax, %ebp + leal 1859775393(%ecx,%ebx,1),%ecx + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ecx + /* 40_59 40 */ + movl 32(%esp), %ebx + movl 40(%esp), %ebp + xorl %ebp, %ebx + movl (%esp), %ebp + xorl %ebp, %ebx + movl 20(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + orl %edi, %ebp + movl %ebx, 32(%esp) + andl %esi, %ebp + leal 2400959708(%ebx,%eax,1),%ebx + movl %edx, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + andl %edi, %eax + orl %eax, %ebp + movl %ecx, %eax + roll $5, %eax + addl %eax, %ebp + movl 36(%esp), %eax + addl %ebp, %ebx + movl 44(%esp), %ebp + xorl %ebp, %eax + movl 4(%esp), %ebp + xorl %ebp, %eax + movl 24(%esp), %ebp +.byte 209 +.byte 202 /* rorl $1 %edx */ + xorl %ebp, %eax +.byte 209 +.byte 192 /* roll $1 %eax */ + movl %ecx, %ebp + movl %eax, 36(%esp) + orl %edx, %ebp + leal 2400959708(%eax,%esi,1),%eax + movl %ecx, %esi + andl %edi, %ebp + andl %edx, %esi + orl %esi, %ebp + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %ebp +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %eax + /* 40_59 41 */ + /* 40_59 42 */ + movl 40(%esp), %esi + movl 48(%esp), %ebp + xorl %ebp, %esi + movl 8(%esp), %ebp + xorl %ebp, %esi + movl 28(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + orl %ecx, %ebp + movl %esi, 40(%esp) + andl %edx, %ebp + leal 2400959708(%esi,%edi,1),%esi + movl %ebx, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + andl %ecx, %edi + orl %edi, %ebp + movl %eax, %edi + roll $5, %edi + addl %edi, %ebp + movl 44(%esp), %edi + addl %ebp, %esi + movl 52(%esp), %ebp + xorl %ebp, %edi + movl 12(%esp), %ebp + xorl %ebp, %edi + movl 32(%esp), %ebp +.byte 209 +.byte 203 /* rorl $1 %ebx */ + xorl %ebp, %edi +.byte 209 +.byte 199 /* roll $1 %edi */ + movl %eax, %ebp + movl %edi, 44(%esp) + orl %ebx, %ebp + leal 2400959708(%edi,%edx,1),%edi + movl %eax, %edx + andl %ecx, %ebp + andl %ebx, %edx + orl %edx, %ebp + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %ebp +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edi + /* 40_59 43 */ + /* 40_59 44 */ + movl 48(%esp), %edx + movl 56(%esp), %ebp + xorl %ebp, %edx + movl 16(%esp), %ebp + xorl %ebp, %edx + movl 36(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + orl %eax, %ebp + movl %edx, 48(%esp) + andl %ebx, %ebp + leal 2400959708(%edx,%ecx,1),%edx + movl %esi, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + andl %eax, %ecx + orl %ecx, %ebp + movl %edi, %ecx + roll $5, %ecx + addl %ecx, %ebp + movl 52(%esp), %ecx + addl %ebp, %edx + movl 60(%esp), %ebp + xorl %ebp, %ecx + movl 20(%esp), %ebp + xorl %ebp, %ecx + movl 40(%esp), %ebp +.byte 209 +.byte 206 /* rorl $1 %esi */ + xorl %ebp, %ecx +.byte 209 +.byte 193 /* roll $1 %ecx */ + movl %edi, %ebp + movl %ecx, 52(%esp) + orl %esi, %ebp + leal 2400959708(%ecx,%ebx,1),%ecx + movl %edi, %ebx + andl %eax, %ebp + andl %esi, %ebx + orl %ebx, %ebp + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ebp +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ecx + /* 40_59 45 */ + /* 40_59 46 */ + movl 56(%esp), %ebx + movl (%esp), %ebp + xorl %ebp, %ebx + movl 24(%esp), %ebp + xorl %ebp, %ebx + movl 44(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + orl %edi, %ebp + movl %ebx, 56(%esp) + andl %esi, %ebp + leal 2400959708(%ebx,%eax,1),%ebx + movl %edx, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + andl %edi, %eax + orl %eax, %ebp + movl %ecx, %eax + roll $5, %eax + addl %eax, %ebp + movl 60(%esp), %eax + addl %ebp, %ebx + movl 4(%esp), %ebp + xorl %ebp, %eax + movl 28(%esp), %ebp + xorl %ebp, %eax + movl 48(%esp), %ebp +.byte 209 +.byte 202 /* rorl $1 %edx */ + xorl %ebp, %eax +.byte 209 +.byte 192 /* roll $1 %eax */ + movl %ecx, %ebp + movl %eax, 60(%esp) + orl %edx, %ebp + leal 2400959708(%eax,%esi,1),%eax + movl %ecx, %esi + andl %edi, %ebp + andl %edx, %esi + orl %esi, %ebp + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %ebp +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %eax + /* 40_59 47 */ + /* 40_59 48 */ + movl (%esp), %esi + movl 8(%esp), %ebp + xorl %ebp, %esi + movl 32(%esp), %ebp + xorl %ebp, %esi + movl 52(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + orl %ecx, %ebp + movl %esi, (%esp) + andl %edx, %ebp + leal 2400959708(%esi,%edi,1),%esi + movl %ebx, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + andl %ecx, %edi + orl %edi, %ebp + movl %eax, %edi + roll $5, %edi + addl %edi, %ebp + movl 4(%esp), %edi + addl %ebp, %esi + movl 12(%esp), %ebp + xorl %ebp, %edi + movl 36(%esp), %ebp + xorl %ebp, %edi + movl 56(%esp), %ebp +.byte 209 +.byte 203 /* rorl $1 %ebx */ + xorl %ebp, %edi +.byte 209 +.byte 199 /* roll $1 %edi */ + movl %eax, %ebp + movl %edi, 4(%esp) + orl %ebx, %ebp + leal 2400959708(%edi,%edx,1),%edi + movl %eax, %edx + andl %ecx, %ebp + andl %ebx, %edx + orl %edx, %ebp + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %ebp +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edi + /* 40_59 49 */ + /* 40_59 50 */ + movl 8(%esp), %edx + movl 16(%esp), %ebp + xorl %ebp, %edx + movl 40(%esp), %ebp + xorl %ebp, %edx + movl 60(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + orl %eax, %ebp + movl %edx, 8(%esp) + andl %ebx, %ebp + leal 2400959708(%edx,%ecx,1),%edx + movl %esi, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + andl %eax, %ecx + orl %ecx, %ebp + movl %edi, %ecx + roll $5, %ecx + addl %ecx, %ebp + movl 12(%esp), %ecx + addl %ebp, %edx + movl 20(%esp), %ebp + xorl %ebp, %ecx + movl 44(%esp), %ebp + xorl %ebp, %ecx + movl (%esp), %ebp +.byte 209 +.byte 206 /* rorl $1 %esi */ + xorl %ebp, %ecx +.byte 209 +.byte 193 /* roll $1 %ecx */ + movl %edi, %ebp + movl %ecx, 12(%esp) + orl %esi, %ebp + leal 2400959708(%ecx,%ebx,1),%ecx + movl %edi, %ebx + andl %eax, %ebp + andl %esi, %ebx + orl %ebx, %ebp + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ebp +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ecx + /* 40_59 51 */ + /* 40_59 52 */ + movl 16(%esp), %ebx + movl 24(%esp), %ebp + xorl %ebp, %ebx + movl 48(%esp), %ebp + xorl %ebp, %ebx + movl 4(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + orl %edi, %ebp + movl %ebx, 16(%esp) + andl %esi, %ebp + leal 2400959708(%ebx,%eax,1),%ebx + movl %edx, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + andl %edi, %eax + orl %eax, %ebp + movl %ecx, %eax + roll $5, %eax + addl %eax, %ebp + movl 20(%esp), %eax + addl %ebp, %ebx + movl 28(%esp), %ebp + xorl %ebp, %eax + movl 52(%esp), %ebp + xorl %ebp, %eax + movl 8(%esp), %ebp +.byte 209 +.byte 202 /* rorl $1 %edx */ + xorl %ebp, %eax +.byte 209 +.byte 192 /* roll $1 %eax */ + movl %ecx, %ebp + movl %eax, 20(%esp) + orl %edx, %ebp + leal 2400959708(%eax,%esi,1),%eax + movl %ecx, %esi + andl %edi, %ebp + andl %edx, %esi + orl %esi, %ebp + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %ebp +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %eax + /* 40_59 53 */ + /* 40_59 54 */ + movl 24(%esp), %esi + movl 32(%esp), %ebp + xorl %ebp, %esi + movl 56(%esp), %ebp + xorl %ebp, %esi + movl 12(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + orl %ecx, %ebp + movl %esi, 24(%esp) + andl %edx, %ebp + leal 2400959708(%esi,%edi,1),%esi + movl %ebx, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + andl %ecx, %edi + orl %edi, %ebp + movl %eax, %edi + roll $5, %edi + addl %edi, %ebp + movl 28(%esp), %edi + addl %ebp, %esi + movl 36(%esp), %ebp + xorl %ebp, %edi + movl 60(%esp), %ebp + xorl %ebp, %edi + movl 16(%esp), %ebp +.byte 209 +.byte 203 /* rorl $1 %ebx */ + xorl %ebp, %edi +.byte 209 +.byte 199 /* roll $1 %edi */ + movl %eax, %ebp + movl %edi, 28(%esp) + orl %ebx, %ebp + leal 2400959708(%edi,%edx,1),%edi + movl %eax, %edx + andl %ecx, %ebp + andl %ebx, %edx + orl %edx, %ebp + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %ebp +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edi + /* 40_59 55 */ + /* 40_59 56 */ + movl 32(%esp), %edx + movl 40(%esp), %ebp + xorl %ebp, %edx + movl (%esp), %ebp + xorl %ebp, %edx + movl 20(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + orl %eax, %ebp + movl %edx, 32(%esp) + andl %ebx, %ebp + leal 2400959708(%edx,%ecx,1),%edx + movl %esi, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + andl %eax, %ecx + orl %ecx, %ebp + movl %edi, %ecx + roll $5, %ecx + addl %ecx, %ebp + movl 36(%esp), %ecx + addl %ebp, %edx + movl 44(%esp), %ebp + xorl %ebp, %ecx + movl 4(%esp), %ebp + xorl %ebp, %ecx + movl 24(%esp), %ebp +.byte 209 +.byte 206 /* rorl $1 %esi */ + xorl %ebp, %ecx +.byte 209 +.byte 193 /* roll $1 %ecx */ + movl %edi, %ebp + movl %ecx, 36(%esp) + orl %esi, %ebp + leal 2400959708(%ecx,%ebx,1),%ecx + movl %edi, %ebx + andl %eax, %ebp + andl %esi, %ebx + orl %ebx, %ebp + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ebp +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ecx + /* 40_59 57 */ + /* 40_59 58 */ + movl 40(%esp), %ebx + movl 48(%esp), %ebp + xorl %ebp, %ebx + movl 8(%esp), %ebp + xorl %ebp, %ebx + movl 28(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + orl %edi, %ebp + movl %ebx, 40(%esp) + andl %esi, %ebp + leal 2400959708(%ebx,%eax,1),%ebx + movl %edx, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + andl %edi, %eax + orl %eax, %ebp + movl %ecx, %eax + roll $5, %eax + addl %eax, %ebp + movl 44(%esp), %eax + addl %ebp, %ebx + movl 52(%esp), %ebp + xorl %ebp, %eax + movl 12(%esp), %ebp + xorl %ebp, %eax + movl 32(%esp), %ebp +.byte 209 +.byte 202 /* rorl $1 %edx */ + xorl %ebp, %eax +.byte 209 +.byte 192 /* roll $1 %eax */ + movl %ecx, %ebp + movl %eax, 44(%esp) + orl %edx, %ebp + leal 2400959708(%eax,%esi,1),%eax + movl %ecx, %esi + andl %edi, %ebp + andl %edx, %esi + orl %esi, %ebp + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %ebp +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %eax + /* 40_59 59 */ + /* 20_39 60 */ + movl 48(%esp), %esi + movl 56(%esp), %ebp + xorl %ebp, %esi + movl 16(%esp), %ebp + xorl %ebp, %esi + movl 36(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + xorl %ecx, %ebp + movl %esi, 48(%esp) + xorl %edx, %ebp + leal 3395469782(%esi,%edi,1),%esi + movl %eax, %edi + roll $5, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %ebp, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %edi, %esi + /* 20_39 61 */ + movl 52(%esp), %edi + movl 60(%esp), %ebp + xorl %ebp, %edi + movl 20(%esp), %ebp + xorl %ebp, %edi + movl 40(%esp), %ebp + xorl %ebp, %edi + movl %eax, %ebp +.byte 209 +.byte 199 /* roll $1 %edi */ + xorl %ebx, %ebp + movl %edi, 52(%esp) + xorl %ecx, %ebp + leal 3395469782(%edi,%edx,1),%edi + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %edi + /* 20_39 62 */ + movl 56(%esp), %edx + movl (%esp), %ebp + xorl %ebp, %edx + movl 24(%esp), %ebp + xorl %ebp, %edx + movl 44(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + xorl %eax, %ebp + movl %edx, 56(%esp) + xorl %ebx, %ebp + leal 3395469782(%edx,%ecx,1),%edx + movl %edi, %ecx + roll $5, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ebp, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ecx, %edx + /* 20_39 63 */ + movl 60(%esp), %ecx + movl 4(%esp), %ebp + xorl %ebp, %ecx + movl 28(%esp), %ebp + xorl %ebp, %ecx + movl 48(%esp), %ebp + xorl %ebp, %ecx + movl %edi, %ebp +.byte 209 +.byte 193 /* roll $1 %ecx */ + xorl %esi, %ebp + movl %ecx, 60(%esp) + xorl %eax, %ebp + leal 3395469782(%ecx,%ebx,1),%ecx + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ecx + /* 20_39 64 */ + movl (%esp), %ebx + movl 8(%esp), %ebp + xorl %ebp, %ebx + movl 32(%esp), %ebp + xorl %ebp, %ebx + movl 52(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + xorl %edi, %ebp + movl %ebx, (%esp) + xorl %esi, %ebp + leal 3395469782(%ebx,%eax,1),%ebx + movl %ecx, %eax + roll $5, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %ebp, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %eax, %ebx + /* 20_39 65 */ + movl 4(%esp), %eax + movl 12(%esp), %ebp + xorl %ebp, %eax + movl 36(%esp), %ebp + xorl %ebp, %eax + movl 56(%esp), %ebp + xorl %ebp, %eax + movl %ecx, %ebp +.byte 209 +.byte 192 /* roll $1 %eax */ + xorl %edx, %ebp + movl %eax, 4(%esp) + xorl %edi, %ebp + leal 3395469782(%eax,%esi,1),%eax + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %eax + /* 20_39 66 */ + movl 8(%esp), %esi + movl 16(%esp), %ebp + xorl %ebp, %esi + movl 40(%esp), %ebp + xorl %ebp, %esi + movl 60(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + xorl %ecx, %ebp + movl %esi, 8(%esp) + xorl %edx, %ebp + leal 3395469782(%esi,%edi,1),%esi + movl %eax, %edi + roll $5, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %ebp, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %edi, %esi + /* 20_39 67 */ + movl 12(%esp), %edi + movl 20(%esp), %ebp + xorl %ebp, %edi + movl 44(%esp), %ebp + xorl %ebp, %edi + movl (%esp), %ebp + xorl %ebp, %edi + movl %eax, %ebp +.byte 209 +.byte 199 /* roll $1 %edi */ + xorl %ebx, %ebp + movl %edi, 12(%esp) + xorl %ecx, %ebp + leal 3395469782(%edi,%edx,1),%edi + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %edi + /* 20_39 68 */ + movl 16(%esp), %edx + movl 24(%esp), %ebp + xorl %ebp, %edx + movl 48(%esp), %ebp + xorl %ebp, %edx + movl 4(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + xorl %eax, %ebp + movl %edx, 16(%esp) + xorl %ebx, %ebp + leal 3395469782(%edx,%ecx,1),%edx + movl %edi, %ecx + roll $5, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ebp, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ecx, %edx + /* 20_39 69 */ + movl 20(%esp), %ecx + movl 28(%esp), %ebp + xorl %ebp, %ecx + movl 52(%esp), %ebp + xorl %ebp, %ecx + movl 8(%esp), %ebp + xorl %ebp, %ecx + movl %edi, %ebp +.byte 209 +.byte 193 /* roll $1 %ecx */ + xorl %esi, %ebp + movl %ecx, 20(%esp) + xorl %eax, %ebp + leal 3395469782(%ecx,%ebx,1),%ecx + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ecx + /* 20_39 70 */ + movl 24(%esp), %ebx + movl 32(%esp), %ebp + xorl %ebp, %ebx + movl 56(%esp), %ebp + xorl %ebp, %ebx + movl 12(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + xorl %edi, %ebp + movl %ebx, 24(%esp) + xorl %esi, %ebp + leal 3395469782(%ebx,%eax,1),%ebx + movl %ecx, %eax + roll $5, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %ebp, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %eax, %ebx + /* 20_39 71 */ + movl 28(%esp), %eax + movl 36(%esp), %ebp + xorl %ebp, %eax + movl 60(%esp), %ebp + xorl %ebp, %eax + movl 16(%esp), %ebp + xorl %ebp, %eax + movl %ecx, %ebp +.byte 209 +.byte 192 /* roll $1 %eax */ + xorl %edx, %ebp + movl %eax, 28(%esp) + xorl %edi, %ebp + leal 3395469782(%eax,%esi,1),%eax + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %eax + /* 20_39 72 */ + movl 32(%esp), %esi + movl 40(%esp), %ebp + xorl %ebp, %esi + movl (%esp), %ebp + xorl %ebp, %esi + movl 20(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + xorl %ecx, %ebp + movl %esi, 32(%esp) + xorl %edx, %ebp + leal 3395469782(%esi,%edi,1),%esi + movl %eax, %edi + roll $5, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %ebp, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %edi, %esi + /* 20_39 73 */ + movl 36(%esp), %edi + movl 44(%esp), %ebp + xorl %ebp, %edi + movl 4(%esp), %ebp + xorl %ebp, %edi + movl 24(%esp), %ebp + xorl %ebp, %edi + movl %eax, %ebp +.byte 209 +.byte 199 /* roll $1 %edi */ + xorl %ebx, %ebp + movl %edi, 36(%esp) + xorl %ecx, %ebp + leal 3395469782(%edi,%edx,1),%edi + movl %esi, %edx + roll $5, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %ebp, %edx +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %edi + /* 20_39 74 */ + movl 40(%esp), %edx + movl 48(%esp), %ebp + xorl %ebp, %edx + movl 8(%esp), %ebp + xorl %ebp, %edx + movl 28(%esp), %ebp + xorl %ebp, %edx + movl %esi, %ebp +.byte 209 +.byte 194 /* roll $1 %edx */ + xorl %eax, %ebp + movl %edx, 40(%esp) + xorl %ebx, %ebp + leal 3395469782(%edx,%ecx,1),%edx + movl %edi, %ecx + roll $5, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ebp, %ecx +.byte 209 +.byte 206 /* rorl $1 %esi */ + addl %ecx, %edx + /* 20_39 75 */ + movl 44(%esp), %ecx + movl 52(%esp), %ebp + xorl %ebp, %ecx + movl 12(%esp), %ebp + xorl %ebp, %ecx + movl 32(%esp), %ebp + xorl %ebp, %ecx + movl %edi, %ebp +.byte 209 +.byte 193 /* roll $1 %ecx */ + xorl %esi, %ebp + movl %ecx, 44(%esp) + xorl %eax, %ebp + leal 3395469782(%ecx,%ebx,1),%ecx + movl %edx, %ebx + roll $5, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebp, %ebx +.byte 209 +.byte 207 /* rorl $1 %edi */ + addl %ebx, %ecx + /* 20_39 76 */ + movl 48(%esp), %ebx + movl 56(%esp), %ebp + xorl %ebp, %ebx + movl 16(%esp), %ebp + xorl %ebp, %ebx + movl 36(%esp), %ebp + xorl %ebp, %ebx + movl %edx, %ebp +.byte 209 +.byte 195 /* roll $1 %ebx */ + xorl %edi, %ebp + movl %ebx, 48(%esp) + xorl %esi, %ebp + leal 3395469782(%ebx,%eax,1),%ebx + movl %ecx, %eax + roll $5, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %ebp, %eax +.byte 209 +.byte 202 /* rorl $1 %edx */ + addl %eax, %ebx + /* 20_39 77 */ + movl 52(%esp), %eax + movl 60(%esp), %ebp + xorl %ebp, %eax + movl 20(%esp), %ebp + xorl %ebp, %eax + movl 40(%esp), %ebp + xorl %ebp, %eax + movl %ecx, %ebp +.byte 209 +.byte 192 /* roll $1 %eax */ + xorl %edx, %ebp + movl %eax, 52(%esp) + xorl %edi, %ebp + leal 3395469782(%eax,%esi,1),%eax + movl %ebx, %esi + roll $5, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %ebp, %esi +.byte 209 +.byte 201 /* rorl $1 %ecx */ + addl %esi, %eax + /* 20_39 78 */ + movl 56(%esp), %esi + movl (%esp), %ebp + xorl %ebp, %esi + movl 24(%esp), %ebp + xorl %ebp, %esi + movl 44(%esp), %ebp + xorl %ebp, %esi + movl %ebx, %ebp +.byte 209 +.byte 198 /* roll $1 %esi */ + xorl %ecx, %ebp + movl %esi, 56(%esp) + xorl %edx, %ebp + leal 3395469782(%esi,%edi,1),%esi + movl %eax, %edi + roll $5, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %ebp, %edi +.byte 209 +.byte 203 /* rorl $1 %ebx */ + addl %edi, %esi + /* 20_39 79 */ + movl 60(%esp), %edi + movl 4(%esp), %ebp + xorl %ebp, %edi + movl 28(%esp), %ebp + xorl %ebp, %edi + movl 48(%esp), %ebp + xorl %ebp, %edi + movl %eax, %ebp +.byte 209 +.byte 199 /* roll $1 %edi */ + xorl %ebx, %ebp + movl %edi, 60(%esp) + xorl %ecx, %ebp + leal 3395469782(%edi,%edx,1),%edi + movl %esi, %edx + roll $5, %edx + addl %ebp, %edx + movl 92(%esp), %ebp +.byte 209 +.byte 200 /* rorl $1 %eax */ + addl %edx, %edi +.byte 209 +.byte 200 /* rorl $1 %eax */ + /* End processing */ + + movl 12(%ebp), %edx + addl %ebx, %edx + movl 4(%ebp), %ebx + addl %esi, %ebx + movl %eax, %esi + movl (%ebp), %eax + movl %edx, 12(%ebp) + addl %edi, %eax + movl 16(%ebp), %edi + addl %ecx, %edi + movl 8(%ebp), %ecx + addl %esi, %ecx + movl %eax, (%ebp) + movl 64(%esp), %esi + movl %ecx, 8(%ebp) + addl $64, %esi + movl 68(%esp), %eax + movl %edi, 16(%ebp) + cmpl %esi, %eax + movl %ebx, 4(%ebp) + jl .L001end + movl (%esi), %eax + jmp .L000start +.L001end: + addl $72, %esp + popl %edi + popl %ebx + popl %ebp + popl %esi + ret +.sha1_block_x86_end: + SIZE(sha1_block_x86,.sha1_block_x86_end-sha1_block_x86) +.ident "desasm.pl" diff --git a/src/lib/libssl/src/crypto/sha/sha_sgst.c b/src/lib/libssl/src/crypto/sha/sha_sgst.c new file mode 100644 index 0000000000..8a16801328 --- /dev/null +++ b/src/lib/libssl/src/crypto/sha/sha_sgst.c @@ -0,0 +1,246 @@ +/* crypto/sha/sha_sgst.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdlib.h> +#include <string.h> + +#ifdef undef +/* one or the other needs to be defined */ +#ifndef SHA_1 /* FIPE 180-1 */ +#define SHA_0 /* FIPS 180 */ +#endif +#endif + +#define ULONG unsigned long +#define UCHAR unsigned char +#define UINT unsigned int + +#ifdef NOCONST +#define const +#endif + +#undef c2nl +#define c2nl(c,l) (l =(((unsigned long)(*((c)++)))<<24), \ + l|=(((unsigned long)(*((c)++)))<<16), \ + l|=(((unsigned long)(*((c)++)))<< 8), \ + l|=(((unsigned long)(*((c)++))) )) + +#undef p_c2nl +#define p_c2nl(c,l,n) { \ + switch (n) { \ + case 0: l =((unsigned long)(*((c)++)))<<24; \ + case 1: l|=((unsigned long)(*((c)++)))<<16; \ + case 2: l|=((unsigned long)(*((c)++)))<< 8; \ + case 3: l|=((unsigned long)(*((c)++))); \ + } \ + } + +#undef c2nl_p +/* NOTE the pointer is not incremented at the end of this */ +#define c2nl_p(c,l,n) { \ + l=0; \ + (c)+=n; \ + switch (n) { \ + case 3: l =((unsigned long)(*(--(c))))<< 8; \ + case 2: l|=((unsigned long)(*(--(c))))<<16; \ + case 1: l|=((unsigned long)(*(--(c))))<<24; \ + } \ + } + +#undef p_c2nl_p +#define p_c2nl_p(c,l,sc,len) { \ + switch (sc) \ + { \ + case 0: l =((unsigned long)(*((c)++)))<<24; \ + if (--len == 0) break; \ + case 1: l|=((unsigned long)(*((c)++)))<<16; \ + if (--len == 0) break; \ + case 2: l|=((unsigned long)(*((c)++)))<< 8; \ + } \ + } + +#undef nl2c +#define nl2c(l,c) (*((c)++)=(unsigned char)(((l)>>24)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16)&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ + *((c)++)=(unsigned char)(((l) )&0xff)) + +#undef c2l +#define c2l(c,l) (l =(((unsigned long)(*((c)++))) ), \ + l|=(((unsigned long)(*((c)++)))<< 8), \ + l|=(((unsigned long)(*((c)++)))<<16), \ + l|=(((unsigned long)(*((c)++)))<<24)) + +#undef p_c2l +#define p_c2l(c,l,n) { \ + switch (n) { \ + case 0: l =((unsigned long)(*((c)++))); \ + case 1: l|=((unsigned long)(*((c)++)))<< 8; \ + case 2: l|=((unsigned long)(*((c)++)))<<16; \ + case 3: l|=((unsigned long)(*((c)++)))<<24; \ + } \ + } + +#undef c2l_p +/* NOTE the pointer is not incremented at the end of this */ +#define c2l_p(c,l,n) { \ + l=0; \ + (c)+=n; \ + switch (n) { \ + case 3: l =((unsigned long)(*(--(c))))<<16; \ + case 2: l|=((unsigned long)(*(--(c))))<< 8; \ + case 1: l|=((unsigned long)(*(--(c)))); \ + } \ + } + +#undef p_c2l_p +#define p_c2l_p(c,l,sc,len) { \ + switch (sc) \ + { \ + case 0: l =((unsigned long)(*((c)++))); \ + if (--len == 0) break; \ + case 1: l|=((unsigned long)(*((c)++)))<< 8; \ + if (--len == 0) break; \ + case 2: l|=((unsigned long)(*((c)++)))<<16; \ + } \ + } + +#undef l2c +#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16)&0xff), \ + *((c)++)=(unsigned char)(((l)>>24)&0xff)) + +#undef ROTATE +#if defined(WIN32) +#define ROTATE(a,n) _lrotl(a,n) +#else +#define ROTATE(a,n) (((a)<<(n))|(((a)&0xffffffff)>>(32-(n)))) +#endif + +/* A nice byte order reversal from Wei Dai <weidai@eskimo.com> */ +#if defined(WIN32) +/* 5 instructions with rotate instruction, else 9 */ +#define Endian_Reverse32(a) \ + { \ + unsigned long l=(a); \ + (a)=((ROTATE(l,8)&0x00FF00FF)|(ROTATE(l,24)&0xFF00FF00)); \ + } +#else +/* 6 instructions with rotate instruction, else 8 */ +#define Endian_Reverse32(a) \ + { \ + unsigned long l=(a); \ + l=(((l&0xFF00FF00)>>8L)|((l&0x00FF00FF)<<8L)); \ + (a)=ROTATE(l,16L); \ + } +#endif + +/* As pointed out by Wei Dai <weidai@eskimo.com>, F() below can be + * simplified to the code in F_00_19. Wei attributes these optimisations + * to Peter Gutmann's SHS code, and he attributes it to Rich Schroeppel. + * #define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) + * I've just become aware of another tweak to be made, again from Wei Dai, + * in F_40_59, (x&a)|(y&a) -> (x|y)&a + */ +#define F_00_19(b,c,d) ((((c) ^ (d)) & (b)) ^ (d)) +#define F_20_39(b,c,d) ((b) ^ (c) ^ (d)) +#define F_40_59(b,c,d) (((b) & (c)) | (((b)|(c)) & (d))) +#define F_60_79(b,c,d) F_20_39(b,c,d) + +#ifdef SHA_0 +#undef Xupdate +#define Xupdate(a,i,ia,ib,ic,id) X[(i)&0x0f]=(a)=\ + (ia[(i)&0x0f]^ib[((i)+2)&0x0f]^ic[((i)+8)&0x0f]^id[((i)+13)&0x0f]); +#endif +#ifdef SHA_1 +#undef Xupdate +#define Xupdate(a,i,ia,ib,ic,id) (a)=\ + (ia[(i)&0x0f]^ib[((i)+2)&0x0f]^ic[((i)+8)&0x0f]^id[((i)+13)&0x0f]);\ + X[(i)&0x0f]=(a)=ROTATE((a),1); +#endif + +#define BODY_00_15(i,a,b,c,d,e,f,xa) \ + (f)=xa[i]+(e)+K_00_19+ROTATE((a),5)+F_00_19((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_16_19(i,a,b,c,d,e,f,xa,xb,xc,xd) \ + Xupdate(f,i,xa,xb,xc,xd); \ + (f)+=(e)+K_00_19+ROTATE((a),5)+F_00_19((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_20_31(i,a,b,c,d,e,f,xa,xb,xc,xd) \ + Xupdate(f,i,xa,xb,xc,xd); \ + (f)+=(e)+K_20_39+ROTATE((a),5)+F_20_39((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_32_39(i,a,b,c,d,e,f,xa) \ + Xupdate(f,i,xa,xa,xa,xa); \ + (f)+=(e)+K_20_39+ROTATE((a),5)+F_20_39((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_40_59(i,a,b,c,d,e,f,xa) \ + Xupdate(f,i,xa,xa,xa,xa); \ + (f)+=(e)+K_40_59+ROTATE((a),5)+F_40_59((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_60_79(i,a,b,c,d,e,f,xa) \ + Xupdate(f,i,xa,xa,xa,xa); \ + (f)=X[(i)&0x0f]+(e)+K_60_79+ROTATE((a),5)+F_60_79((b),(c),(d)); \ + (b)=ROTATE((b),30); + diff --git a/src/lib/libssl/src/crypto/x509/attrib b/src/lib/libssl/src/crypto/x509/attrib new file mode 100644 index 0000000000..37f6cd755f --- /dev/null +++ b/src/lib/libssl/src/crypto/x509/attrib @@ -0,0 +1,38 @@ + +PKCS7 + STACK of X509_ATTRIBUTES + ASN1_OBJECT + STACK of ASN1_TYPE + +So it is + +p7.xa[].obj +p7.xa[].data[] + +get_obj_by_nid(STACK , nid) +get_num_by_nid(STACK , nid) +get_data_by_nid(STACK , nid, index) + +X509_ATTRIBUTE *X509_ATTRIBUTE_new(void ); +void X509_ATTRIBUTE_free(X509_ATTRIBUTE *a); + +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **ex, + int nid, STACK *value); + +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **ex, + int nid, STACK *value); + +int X509_ATTRIBUTE_set_object(X509_ATTRIBUTE *ex,ASN1_OBJECT *obj); +int X509_ATTRIBUTE_add_data(X509_ATTRIBUTE *ex, int index, + ASN1_TYPE *value); + +ASN1_OBJECT * X509_ATTRIBUTE_get_object(X509_ATTRIBUTE *ex); +int X509_ATTRIBUTE_get_num(X509_ATTRIBUTE *ne); +ASN1_TYPE * X509_ATTRIBUTE_get_data(X509_ATTRIBUTE *ne,int index); + +ASN1_TYPE * X509_ATTRIBUTE_get_data_by_NID(X509_ATTRIBUTE *ne, + ASN1_OBJECT *obj); + +X509_ATTRUBUTE *PKCS7_get_s_att_by_NID(PKCS7 *p7,int nid); +X509_ATTRUBUTE *PKCS7_get_u_att_by_NID(PKCS7 *p7,int nid); + diff --git a/src/lib/libssl/src/crypto/x509/v3_net.c b/src/lib/libssl/src/crypto/x509/v3_net.c new file mode 100644 index 0000000000..0c2d276d13 --- /dev/null +++ b/src/lib/libssl/src/crypto/x509/v3_net.c @@ -0,0 +1,87 @@ +/* crypto/x509/v3_net.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "stack.h" +#include "cryptlib.h" +#include "asn1.h" +#include "objects.h" +#include "x509.h" + +#define NETSCAPE_X509_EXT_NUM 8 + +static X509_EXTENSION_METHOD netscape_x509_ext[NETSCAPE_X509_EXT_NUM]={ +{NID_netscape_ca_policy_url, V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, +{NID_netscape_ssl_server_name, V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, +{NID_netscape_revocation_url, V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, +{NID_netscape_base_url,V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, +{NID_netscape_cert_type,V_ASN1_BIT_STRING,X509_EXT_PACK_STRING}, +{NID_netscape_ca_revocation_url,V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, +{NID_netscape_renewal_url,V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, +{NID_netscape_comment,V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, + }; + +int X509v3_add_netscape_extensions() + { + int i; + + for (i=0; i<NETSCAPE_X509_EXT_NUM; i++) + if (!X509v3_add_extension(&(netscape_x509_ext[i]))) + return(0); + return(1); + } diff --git a/src/lib/libssl/src/crypto/x509/v3_x509.c b/src/lib/libssl/src/crypto/x509/v3_x509.c new file mode 100644 index 0000000000..f685aa4c71 --- /dev/null +++ b/src/lib/libssl/src/crypto/x509/v3_x509.c @@ -0,0 +1,253 @@ +/* crypto/x509/v3_x509.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include <ctype.h> +#include "stack.h" +#include "cryptlib.h" +#include "bio.h" +#include "asn1.h" +#include "objects.h" +#include "x509.h" + +#if 0 +static int i2a_key_usage(BIO *bp, X509 *x); +static int a2i_key_usage(X509 *x, char *str, int len); +#endif + +int X509v3_get_key_usage(X509 *x); +int X509v3_set_key_usage(X509 *x,unsigned int use); +int i2a_X509v3_key_usage(BIO *bp, unsigned int use); +unsigned int a2i_X509v3_key_usage(char *p); + +#define STD_X509_EXT_NUM 9 + +#if 0 +static X509_OBJECTS std_x509_ext[STD_X509_EXT_NUM]={ +{NID_subject_key_identifier, NULL,NULL}, +{NID_key_usage, a2i_key_usage,i2a_key_usage}, /**/ +{NID_private_key_usage_period, NULL,NULL}, +{NID_subject_alt_name, NULL,NULL}, +{NID_issuer_alt_name, NULL,NULL}, +{NID_basic_constraints, NULL,NULL}, +{NID_crl_number, NULL,NULL}, +{NID_certificate_policies, NULL,NULL}, +{NID_authority_key_identifier, NULL,NULL}, + }; +#endif + +int X509v3_add_standard_extensions() + { + +#if 0 + for (i=0; i<STD_X509_EXT_NUM; i++) + if (!X509v3_add_extension(&(std_x509_ext[i]))) + return(0); +#endif + return(1); + } + +int X509v3_get_key_usage(x) +X509 *x; + { + X509_EXTENSION *ext; + ASN1_STRING *st; + char *p; + int i; + + i=X509_get_ext_by_NID(x,NID_key_usage,-1); + if (i < 0) return(X509v3_KU_UNDEF); + ext=X509_get_ext(x,i); + st=X509v3_unpack_string(NULL,V_ASN1_BIT_STRING, + X509_EXTENSION_get_data(X509_get_ext(x,i))); + + p=(char *)ASN1_STRING_data(st); + if (ASN1_STRING_length(st) == 1) + i=p[0]; + else if (ASN1_STRING_length(st) == 2) + i=p[0]|(p[1]<<8); + else + i=0; + return(i); + } + +static struct + { + char *name; + unsigned int value; + } key_usage_data[] ={ + {"digitalSignature", X509v3_KU_DIGITAL_SIGNATURE}, + {"nonRepudiation", X509v3_KU_NON_REPUDIATION}, + {"keyEncipherment", X509v3_KU_KEY_ENCIPHERMENT}, + {"dataEncipherment", X509v3_KU_DATA_ENCIPHERMENT}, + {"keyAgreement", X509v3_KU_KEY_AGREEMENT}, + {"keyCertSign", X509v3_KU_KEY_CERT_SIGN}, + {"cRLSign", X509v3_KU_CRL_SIGN}, + {"encipherOnly", X509v3_KU_ENCIPHER_ONLY}, + {"decipherOnly", X509v3_KU_DECIPHER_ONLY}, + {NULL,0}, + }; + +#if 0 +static int a2i_key_usage(x,str,len) +X509 *x; +char *str; +int len; + { + return(X509v3_set_key_usage(x,a2i_X509v3_key_usage(str))); + } + +static int i2a_key_usage(bp,x) +BIO *bp; +X509 *x; + { + return(i2a_X509v3_key_usage(bp,X509v3_get_key_usage(x))); + } +#endif + +int i2a_X509v3_key_usage(bp,use) +BIO *bp; +unsigned int use; + { + int i=0,first=1; + + for (;;) + { + if (use | key_usage_data[i].value) + { + BIO_printf(bp,"%s%s",((first)?"":" "), + key_usage_data[i].name); + first=0; + } + } + return(1); + } + +unsigned int a2i_X509v3_key_usage(p) +char *p; + { + unsigned int ret=0; + char *q,*s; + int i,n; + + q=p; + for (;;) + { + while ((*q != '\0') && isalnum(*q)) + q++; + if (*q == '\0') break; + s=q++; + while (isalnum(*q)) + q++; + n=q-s; + i=0; + for (;;) + { + if (strncmp(key_usage_data[i].name,s,n) == 0) + { + ret|=key_usage_data[i].value; + break; + } + i++; + if (key_usage_data[i].name == NULL) + return(X509v3_KU_UNDEF); + } + } + return(ret); + } + +int X509v3_set_key_usage(x,use) +X509 *x; +unsigned int use; + { + ASN1_OCTET_STRING *os; + X509_EXTENSION *ext; + int i; + unsigned char data[4]; + + i=X509_get_ext_by_NID(x,NID_key_usage,-1); + if (i < 0) + { + i=X509_get_ext_count(x)+1; + if ((ext=X509_EXTENSION_new()) == NULL) return(0); + if (!X509_add_ext(x,ext,i)) + { + X509_EXTENSION_free(ext); + return(0); + } + } + else + ext=X509_get_ext(x,i); + + /* fill in 'ext' */ + os=X509_EXTENSION_get_data(ext); + + i=0; + if (use > 0) + { + i=1; + data[0]=use&0xff; + } + if (use > 0xff) + { + i=2; + data[1]=(use>>8)&0xff; + } + return((X509v3_pack_string(&os,V_ASN1_BIT_STRING,data,i) == NULL)?0:1); + } + diff --git a/src/lib/libssl/src/crypto/x509/x509.doc b/src/lib/libssl/src/crypto/x509/x509.doc new file mode 100644 index 0000000000..73cfc9f034 --- /dev/null +++ b/src/lib/libssl/src/crypto/x509/x509.doc @@ -0,0 +1,27 @@ +X509_verify() +X509_sign() + +X509_get_version() +X509_get_serialNumber() +X509_get_issuer() +X509_get_subject() +X509_get_notBefore() +X509_get_notAfter() +X509_get_pubkey() + +X509_set_version() +X509_set_serialNumber() +X509_set_issuer() +X509_set_subject() +X509_set_notBefore() +X509_set_notAfter() +X509_set_pubkey() + +X509_get_extensions() +X509_set_extensions() + +X509_EXTENSIONS_clear() +X509_EXTENSIONS_retrieve() +X509_EXTENSIONS_add() +X509_EXTENSIONS_delete() + diff --git a/src/lib/libssl/src/crypto/x509/x509.err b/src/lib/libssl/src/crypto/x509/x509.err new file mode 100644 index 0000000000..8d0862d7d1 --- /dev/null +++ b/src/lib/libssl/src/crypto/x509/x509.err @@ -0,0 +1,46 @@ +/* Error codes for the X509 functions. */ + +/* Function codes. */ +#define X509_F_ADD_CERT_DIR 100 +#define X509_F_BY_FILE_CTRL 101 +#define X509_F_DIR_CTRL 102 +#define X509_F_GET_CERT_BY_SUBJECT 103 +#define X509_F_X509V3_ADD_EXT 104 +#define X509_F_X509V3_ADD_EXTENSION 105 +#define X509_F_X509V3_PACK_STRING 106 +#define X509_F_X509V3_UNPACK_STRING 107 +#define X509_F_X509_EXTENSION_CREATE_BY_NID 108 +#define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 +#define X509_F_X509_GET_PUBKEY_PARAMETERS 110 +#define X509_F_X509_LOAD_CERT_FILE 111 +#define X509_F_X509_LOAD_CRL_FILE 112 +#define X509_F_X509_NAME_ADD_ENTRY 113 +#define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 +#define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 +#define X509_F_X509_NAME_ONELINE 116 +#define X509_F_X509_NAME_PRINT 117 +#define X509_F_X509_PRINT_FP 118 +#define X509_F_X509_PUBKEY_GET 119 +#define X509_F_X509_PUBKEY_SET 120 +#define X509_F_X509_REQ_PRINT 121 +#define X509_F_X509_REQ_PRINT_FP 122 +#define X509_F_X509_REQ_TO_X509 123 +#define X509_F_X509_STORE_ADD_CERT 124 +#define X509_F_X509_STORE_ADD_CRL 125 +#define X509_F_X509_TO_X509_REQ 126 +#define X509_F_X509_VERIFY_CERT 127 + +/* Reason codes. */ +#define X509_R_BAD_X509_FILETYPE 100 +#define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 +#define X509_R_ERR_ASN1_LIB 102 +#define X509_R_LOADING_CERT_DIR 103 +#define X509_R_LOADING_DEFAULTS 104 +#define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 +#define X509_R_SHOULD_RETRY 106 +#define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 +#define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 +#define X509_R_UNKNOWN_NID 109 +#define X509_R_UNKNOWN_STRING_TYPE 110 +#define X509_R_UNSUPPORTED_ALGORITHM 111 +#define X509_R_WRONG_LOOKUP_TYPE 112 diff --git a/src/lib/libssl/src/crypto/x509/x509pack.c b/src/lib/libssl/src/crypto/x509/x509pack.c new file mode 100644 index 0000000000..846f125859 --- /dev/null +++ b/src/lib/libssl/src/crypto/x509/x509pack.c @@ -0,0 +1,157 @@ +/* crypto/x509/x509pack.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include "stack.h" +#include "cryptlib.h" +#include "asn1.h" +#include "objects.h" +#include "evp.h" +#include "x509.h" + +ASN1_OCTET_STRING *X509v3_pack_string(ex,type,bytes,len) +ASN1_OCTET_STRING **ex; +int type; +unsigned char *bytes; +int len; + { + ASN1_OCTET_STRING *os; + ASN1_STRING str; + unsigned char *p; + int i; + + if ((ex == NULL) || (*ex == NULL)) + os=ASN1_OCTET_STRING_new(); + else + os= *ex; + + if (len < 0) len=strlen((char *)bytes); + str.length=len; + str.type=type; + str.data=bytes; + + /* str now holds the data, we just have to copy it into ->value */ + + switch (type) + { + case V_ASN1_BIT_STRING: + i=i2d_ASN1_BIT_STRING((ASN1_BIT_STRING *)&str,NULL); + if (!ASN1_STRING_set((ASN1_STRING *)os,NULL,i)) + goto err; + p=(unsigned char *)os->data; + i2d_ASN1_BIT_STRING((ASN1_BIT_STRING *)&str,&p); + break; + case V_ASN1_OCTET_STRING: + i=i2d_ASN1_OCTET_STRING((ASN1_OCTET_STRING *)&str,NULL); + if (!ASN1_STRING_set((ASN1_STRING *)os,NULL,i)) + goto err; + p=(unsigned char *)os->data; + i2d_ASN1_OCTET_STRING((ASN1_OCTET_STRING *)&str,&p); + break; + case V_ASN1_IA5STRING: + case V_ASN1_PRINTABLESTRING: + case V_ASN1_T61STRING: + i=i2d_ASN1_bytes(&str,NULL,type,V_ASN1_UNIVERSAL); + if (!ASN1_STRING_set((ASN1_STRING *)os,NULL,i)) + goto err; + p=(unsigned char *)os->data; + i=i2d_ASN1_bytes(&str,&p,type,V_ASN1_UNIVERSAL); + break; + default: + X509err(X509_F_X509V3_PACK_STRING,X509_R_UNKNOWN_STRING_TYPE); + goto err; + } + os->length=i; + + if ((ex != NULL) && (os != *ex)) + *ex=os; + return(os); +err: + return(NULL); + } + +ASN1_STRING *X509v3_unpack_string(ex,type,os) +ASN1_STRING **ex; +int type; +ASN1_OCTET_STRING *os; + { + unsigned char *p; + ASN1_STRING *ret=NULL; + + p=os->data; + switch (type) + { + case V_ASN1_BIT_STRING: + ret=(ASN1_STRING *)d2i_ASN1_BIT_STRING( + (ASN1_BIT_STRING **)ex,&p,os->length); + break; + case V_ASN1_OCTET_STRING: + ret=(ASN1_STRING *)d2i_ASN1_OCTET_STRING( + (ASN1_BIT_STRING **)ex,&p,os->length); + break; + case V_ASN1_IA5STRING: + case V_ASN1_PRINTABLESTRING: + case V_ASN1_T61STRING: + ret=(ASN1_STRING *)d2i_ASN1_PRINTABLE(ex,&p,os->length); + break; + default: + X509err(X509_F_X509V3_UNPACK_STRING,X509_R_UNKNOWN_STRING_TYPE); + } + return(ret); + } + diff --git a/src/lib/libssl/src/crypto/x509/x509v3.doc b/src/lib/libssl/src/crypto/x509/x509v3.doc new file mode 100644 index 0000000000..1e760a9469 --- /dev/null +++ b/src/lib/libssl/src/crypto/x509/x509v3.doc @@ -0,0 +1,24 @@ +The 'new' system. + +The X509_EXTENSION_METHOD includes extensions and attributes and/or names. +Basically everthing that can be added to an X509 with an OID identifying it. + +It operates via 2 methods per object id. +int a2i_XXX(X509 *x,char *str,int len); +int i2a_XXX(BIO *bp,X509 *x); + +The a2i_XXX function will add the object with a value converted from the +string into the X509. Len can be -1 in which case the length is calculated +via strlen(str). Applications can always use direct knowledge to load and +unload the relevent objects themselves. + +i2a_XXX will print to the passed BIO, a text representation of the +relevet object. Use a memory BIO if you want it printed to a buffer :-). + +X509_add_by_NID(X509 *x,int nid,char *str,int len); +X509_add_by_OBJ(X509 *x,ASN1_OBJECT *obj,char *str,int len); + +X509_print_by_name(BIO *bp,X509 *x); +X509_print_by_NID(BIO *bp,X509 *x); +X509_print_by_OBJ(BIO *bp,X509 *x); + diff --git a/src/lib/libssl/src/crypto/x509v3/format b/src/lib/libssl/src/crypto/x509v3/format new file mode 100644 index 0000000000..3307978121 --- /dev/null +++ b/src/lib/libssl/src/crypto/x509v3/format @@ -0,0 +1,92 @@ +AuthorityKeyIdentifier + { + keyIdentifier [0] OCTET_STRING OPTIONAL + authorityCertIssuer [1] GeneralNames OPTIONAL + authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL + } + +SubjectKeyIdentifier OCTET_STRING + +KeyUsage + { + BIT_STRING + digitalSignature 0 + nonRepudiation 1 + keyEncipherment 2 + dataEncipherment 3 + keyAgreement 4 + keyCertSign 5 + cRLSign 6 + encipherOnly 7 + decipherOnly 8 + } + +extKeyUsage + { + SEQUENCE of OBJECT_IDENTIFIER + } + +privateKeyUsagePeriod + { + notBefore [0] GeneralizedTime OPTIONAL + notAfter [1] GeneralizedTime OPTIONAL + } + +certificatePoliciesSyntax + SEQUENCE of PoliciesInformation + +PoliciesInformation XXX +policyMappings XXX +supportedAlgorithms XXX + +subjectAltName + GeneralNames sequence of GeneralName + +GeneralName + { + otherName [0] INSTANCE OF OTHER-NAME + rfc882Name [1] IA5String + dNSName [2] IA5String + x400Address [3] ORAddress + directoryName [4] Name + ediPartyName [5] + { + nameAssigner [0] DirectoryString OPTIONAL + partyName [1] DirectoryString + } + uniformResourceIdentifier [6] IA5String + iPAddress [7] OCTET_STRING + registeredID [8] OBJECT_IDENTIFIER + } + +issuerAltName + GeneralNames sequence of GeneralName + +subjectDirectoryAttribute SEQUENCE of Attribute + +basicConstraints + { + cA BOOLEAN default FALSE + pathLenConstraint INTEGER OPTIONAL + } + +nameConstraints + { + permittedSubtrees [0] sequence of GeneralSubtree OPTIONAL + excludedSubtrees [1] sequence of GeneralSubtree OPTIONAL + } + +GeneralSubtree + { + base GeneralName + minimum [0] BaseDistance DEFAULT 0 + maximum [1] BaseDistance OPTIONAL + } + +PolicyConstraints + { + requiredExplicitPolicy [0] SkipCerts OPTIONAL + inhibitPolicyMapping [1] SkipCerts OPTIONAL + } +SkipCerts == INTEGER + diff --git a/src/lib/libssl/src/crypto/x509v3/header b/src/lib/libssl/src/crypto/x509v3/header new file mode 100644 index 0000000000..3d791ca3dd --- /dev/null +++ b/src/lib/libssl/src/crypto/x509v3/header @@ -0,0 +1,6 @@ +int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size) +int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a) +int i2d_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp) +ASN1_INTEGER * d2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp,long length) + + diff --git a/src/lib/libssl/src/crypto/x509v3/v3_ku.c b/src/lib/libssl/src/crypto/x509v3/v3_ku.c new file mode 100644 index 0000000000..87c7402f43 --- /dev/null +++ b/src/lib/libssl/src/crypto/x509v3/v3_ku.c @@ -0,0 +1,318 @@ +/* crypto/x509v3/v3_ku.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include <ctype.h> +#include "stack.h" +#include "cryptlib.h" +#include "bio.h" +#include "asn1.h" +#include "objects.h" +#include "x509.h" + +X509_EXTENSION_METHOD X509v3_key_usage_method= + { + NID_key_usage, + ku_clear, + ex_get_bool, + ex_set_bool, + NULL, + NULL, + NULL, + NULL, + ku_a2i, + ku_i2a, + }; + +static void ku_clear(a) +X509_EXTENSION *a; + { + } + +static int ku_expand(a) +X509_EXTENSION *a; + { + ASN1_BIT_STRING *bs; + + if (a->argp == NULL) + { + bs=X509v3_unpack_string(NULL,V_ASN1_BIT_STRING,value); + if (bs == NULL) return(0); + a->argp=(char *)bs; + a->ex_free=ASN1_STRING_free; + } + return(1); + } + +static int ku_get_bool(a,num) +X509_EXTENSION *a; +int num; + { + int ret; + ASN1_BIT_STRING *bs; + + if ((a->argp == NULL) && !ku_expand(a)) + return(-1); + bs=(ASN1_BIT_STRING *)a->argp; + ret=ASN1_BIT_STRING_get_bit(bs,num); + return(ret); + } + +static int ku_set_bool(a,num,value) +X509_EXTENSION *a; +int num; +int value; + { + ASN1_BIT_STRING *a; + + if ((a->argp == NULL) && !ku_expand(a)) + return(0); + bs=(ASN1_BIT_STRING *)a->argp; + ret=ASN1_BIT_STRING_set_bit(bs,num,value); + } + +static int ku_a2i(bio,a,buf,len) +BIO *bio; +X509_EXTENSION *a; +char *buf; +int len; + { + get token + } + +static char ku_names[X509v3_N_KU_NUM]={ + X509v3_S_KU_digitalSignature, + X509v3_S_KU_nonRepudiation, + X509v3_S_KU_keyEncipherment, + X509v3_S_KU_dataEncipherment, + X509v3_S_KU_keyAgreement, + X509v3_S_KU_keyCertSign, + X509v3_S_KU_cRLSign, + X509v3_S_KU_encipherOnly, + X509v3_S_KU_decipherOnly, + }; + +static int ku_i2a(bio,a); +BIO *bio; +X509_EXTENSION *a; + { + int i,first=1; + char *c; + + for (i=0; i<X509v3_N_KU_NUM; i++) + { + if (ku_get_bool(a,i) > 0) + { + BIO_printf(bio,"%s%s",((first)?"":" "),ku_names[i]); + first=0; + } + } + } + +/***********************/ + +int X509v3_get_key_usage(x,ret) +STACK *x; +unsigned long *ret; + { + X509_EXTENSION *ext; + ASN1_STRING *st; + char *p; + int i; + + i=X509_get_ext_by_NID(x,NID_key_usage,-1); + if (i < 0) return(X509v3_KU_UNDEF); + ext=X509_get_ext(x,i); + st=X509v3_unpack_string(NULL,V_ASN1_BIT_STRING, + X509_EXTENSION_get_data(X509_get_ext(x,i))); + + p=ASN1_STRING_data(st); + if (ASN1_STRING_length(st) == 1) + i=p[0]; + else if (ASN1_STRING_length(st) == 2) + i=p[0]|(p[1]<<8); + else + i=0; + return(i); + } + +static struct + { + char *name; + unsigned int value; + } key_usage_data[] ={ + {"digitalSignature", X509v3_KU_DIGITAL_SIGNATURE}, + {"nonRepudiation", X509v3_KU_NON_REPUDIATION}, + {"keyEncipherment", X509v3_KU_KEY_ENCIPHERMENT}, + {"dataEncipherment", X509v3_KU_DATA_ENCIPHERMENT}, + {"keyAgreement", X509v3_KU_KEY_AGREEMENT}, + {"keyCertSign", X509v3_KU_KEY_CERT_SIGN}, + {"cRLSign", X509v3_KU_CRL_SIGN}, + {"encipherOnly", X509v3_KU_ENCIPHER_ONLY}, + {"decipherOnly", X509v3_KU_DECIPHER_ONLY}, + {NULL,0}, + }; + +#if 0 +static int a2i_key_usage(x,str,len) +X509 *x; +char *str; +int len; + { + return(X509v3_set_key_usage(x,a2i_X509v3_key_usage(str))); + } + +static int i2a_key_usage(bp,x) +BIO *bp; +X509 *x; + { + return(i2a_X509v3_key_usage(bp,X509v3_get_key_usage(x))); + } +#endif + +int i2a_X509v3_key_usage(bp,use) +BIO *bp; +unsigned int use; + { + int i=0,first=1; + + for (;;) + { + if (use | key_usage_data[i].value) + { + BIO_printf(bp,"%s%s",((first)?"":" "), + key_usage_data[i].name); + first=0; + } + } + return(1); + } + +unsigned int a2i_X509v3_key_usage(p) +char *p; + { + unsigned int ret=0; + char *q,*s; + int i,n; + + q=p; + for (;;) + { + while ((*q != '\0') && isalnum(*q)) + q++; + if (*q == '\0') break; + s=q++; + while (isalnum(*q)) + q++; + n=q-s; + i=0; + for (;;) + { + if (strncmp(key_usage_data[i].name,s,n) == 0) + { + ret|=key_usage_data[i].value; + break; + } + i++; + if (key_usage_data[i].name == NULL) + return(X509v3_KU_UNDEF); + } + } + return(ret); + } + +int X509v3_set_key_usage(x,use) +X509 *x; +unsigned int use; + { + ASN1_OCTET_STRING *os; + X509_EXTENSION *ext; + int i; + unsigned char data[4]; + + i=X509_get_ext_by_NID(x,NID_key_usage,-1); + if (i < 0) + { + i=X509_get_ext_count(x)+1; + if ((ext=X509_EXTENSION_new()) == NULL) return(0); + if (!X509_add_ext(x,ext,i)) + { + X509_EXTENSION_free(ext); + return(0); + } + } + else + ext=X509_get_ext(x,i); + + /* fill in 'ext' */ + os=X509_EXTENSION_get_data(ext); + + i=0; + if (use > 0) + { + i=1; + data[0]=use&0xff; + } + if (use > 0xff) + { + i=2; + data[1]=(use>>8)&0xff; + } + return((X509v3_pack_string(&os,V_ASN1_BIT_STRING,data,i) == NULL)?0:1); + } + diff --git a/src/lib/libssl/src/dep/crypto.txt b/src/lib/libssl/src/dep/crypto.txt new file mode 100644 index 0000000000..9e5144fec6 --- /dev/null +++ b/src/lib/libssl/src/dep/crypto.txt @@ -0,0 +1,1043 @@ +ASN1_BIT_STRING_asn1_meth +ASN1_BIT_STRING_get_bit +ASN1_BIT_STRING_set_bit +ASN1_HEADER_free +ASN1_HEADER_new +ASN1_IA5STRING_asn1_meth +ASN1_INTEGER_get +ASN1_INTEGER_set +ASN1_INTEGER_to_BN +ASN1_OBJECT_create +ASN1_OBJECT_free +ASN1_OBJECT_new +ASN1_PRINTABLE_type +ASN1_STRING_cmp +ASN1_STRING_dup +ASN1_STRING_free +ASN1_STRING_new +ASN1_STRING_print +ASN1_STRING_set +ASN1_STRING_type_new +ASN1_TYPE_free +ASN1_TYPE_get +ASN1_TYPE_new +ASN1_TYPE_set +ASN1_UNIVERSALSTRING_to_string +ASN1_UTCTIME_check +ASN1_UTCTIME_print +ASN1_UTCTIME_set +ASN1_check_infinite_end +ASN1_d2i_bio +ASN1_d2i_fp +ASN1_digest +ASN1_dup +ASN1_get_object +ASN1_i2d_bio +ASN1_i2d_fp +ASN1_object_size +ASN1_parse +ASN1_put_object +ASN1_sign +ASN1_verify +BF_cbc_encrypt +BF_cfb64_encrypt +BF_decrypt +BF_ecb_encrypt +BF_encrypt +BF_ofb64_encrypt +BF_options +BF_set_key +BIO_ACCEPT_free +BIO_ACCEPT_new +BIO_CONNECT_free +BIO_CONNECT_new +BIO_accept +BIO_copy_next_retry +BIO_ctrl +BIO_ctrl_int +BIO_debug_callback +BIO_dump +BIO_dup_chain +BIO_f_base64 +BIO_f_buffer +BIO_f_cipher +BIO_f_md +BIO_f_nbio_test +BIO_f_null +BIO_f_proxy_server +BIO_fd_non_fatal_error +BIO_fd_should_retry +BIO_find_type +BIO_free +BIO_free_all +BIO_get_accept_socket +BIO_get_ex_data +BIO_get_ex_new_index +BIO_get_filter_bio +BIO_get_host_ip +BIO_get_port +BIO_get_retry_BIO +BIO_get_retry_reason +BIO_gethostbyname +BIO_gets +BIO_ghbn_ctrl +BIO_new +BIO_new_accept +BIO_new_connect +BIO_new_fd +BIO_new_file +BIO_new_fp +BIO_new_socket +BIO_pop +BIO_printf +BIO_ptr_ctrl +BIO_push +BIO_puts +BIO_read +BIO_s_accept +BIO_s_connect +BIO_s_fd +BIO_s_file +BIO_s_mem +BIO_s_null +BIO_s_proxy_client +BIO_s_socket +BIO_set +BIO_set_cipher +BIO_set_ex_data +BIO_set_tcp_ndelay +BIO_sock_cleanup +BIO_sock_error +BIO_sock_init +BIO_sock_non_fatal_error +BIO_sock_should_retry +BIO_socket_ioctl +BIO_write +BN_BLINDING_convert +BN_BLINDING_free +BN_BLINDING_invert +BN_BLINDING_new +BN_BLINDING_update +BN_CTX_free +BN_CTX_new +BN_MONT_CTX_free +BN_MONT_CTX_new +BN_MONT_CTX_set +BN_add +BN_add_word +BN_bin2bn +BN_bn2bin +BN_bn2dec +BN_bn2hex +BN_bn2mpi +BN_clear +BN_clear_bit +BN_clear_free +BN_cmp +BN_copy +BN_dec2bn +BN_div +BN_div_word +BN_dup +BN_exp +BN_free +BN_from_montgomery +BN_gcd +BN_generate_prime +BN_get_word +BN_hex2bn +BN_is_bit_set +BN_is_prime +BN_lshift +BN_lshift1 +BN_mask_bits +BN_mod +BN_mod_exp +BN_mod_exp_mont +BN_mod_exp_recp +BN_mod_exp_simple +BN_mod_inverse +BN_mod_mul +BN_mod_mul_montgomery +BN_mod_mul_reciprocal +BN_mod_word +BN_mpi2bn +BN_mul +BN_mul_word +BN_new +BN_num_bits +BN_num_bits_word +BN_options +BN_print +BN_print_fp +BN_rand +BN_reciprocal +BN_rshift +BN_rshift1 +BN_set_bit +BN_set_word +BN_sqr +BN_sub +BN_sub_word +BN_to_ASN1_INTEGER +BN_ucmp +BN_value_one +BUF_MEM_free +BUF_MEM_grow +BUF_MEM_new +BUF_strdup +CAST_cbc_encrypt +CAST_cfb64_encrypt +CAST_decrypt +CAST_ecb_encrypt +CAST_encrypt +CAST_ofb64_encrypt +CAST_set_key +CONF_free +CONF_get_number +CONF_get_section +CONF_get_string +CONF_load +CRYPTO_add_lock +CRYPTO_dbg_free +CRYPTO_dbg_malloc +CRYPTO_dbg_realloc +CRYPTO_dbg_remalloc +CRYPTO_dup_ex_data +CRYPTO_free +CRYPTO_free_ex_data +CRYPTO_get_add_lock_callback +CRYPTO_get_ex_data +CRYPTO_get_ex_new_index +CRYPTO_get_id_callback +CRYPTO_get_lock_name +CRYPTO_get_locking_callback +CRYPTO_get_mem_functions +CRYPTO_get_new_lockid +CRYPTO_lock +CRYPTO_malloc +CRYPTO_mem_ctrl +CRYPTO_mem_leaks +CRYPTO_mem_leaks_cb +CRYPTO_mem_leaks_fp +CRYPTO_new_ex_data +CRYPTO_realloc +CRYPTO_remalloc +CRYPTO_set_add_lock_callback +CRYPTO_set_ex_data +CRYPTO_set_id_callback +CRYPTO_set_locking_callback +CRYPTO_set_mem_functions +CRYPTO_thread_id +DH_check +DH_compute_key +DH_free +DH_generate_key +DH_generate_parameters +DH_new +DH_size +DHparams_print +DHparams_print_fp +DSA_free +DSA_generate_key +DSA_generate_parameters +DSA_is_prime +DSA_new +DSA_print +DSA_print_fp +DSA_sign +DSA_sign_setup +DSA_size +DSA_verify +DSAparams_print +DSAparams_print_fp +ERR_clear_error +ERR_error_string +ERR_free_strings +ERR_func_error_string +ERR_get_err_state_table +ERR_get_error +ERR_get_error_line +ERR_get_next_error_library +ERR_get_state +ERR_get_string_table +ERR_lib_error_string +ERR_load_ASN1_strings +ERR_load_BIO_strings +ERR_load_BN_strings +ERR_load_BUF_strings +ERR_load_CONF_strings +ERR_load_CRYPTO_strings +ERR_load_DH_strings +ERR_load_DSA_strings +ERR_load_ERR_strings +ERR_load_EVP_strings +ERR_load_OBJ_strings +ERR_load_PEM_strings +ERR_load_PKCS7_strings +ERR_load_PROXY_strings +ERR_load_RSA_strings +ERR_load_X509_strings +ERR_load_crypto_strings +ERR_load_strings +ERR_peek_error +ERR_peek_error_line +ERR_print_errors +ERR_print_errors_fp +ERR_put_error +ERR_reason_error_string +ERR_remove_state +EVP_BytesToKey +EVP_CIPHER_CTX_cleanup +EVP_CIPHER_CTX_init +EVP_CipherFinal +EVP_CipherInit +EVP_CipherUpdate +EVP_DecodeBlock +EVP_DecodeFinal +EVP_DecodeInit +EVP_DecodeUpdate +EVP_DecryptFinal +EVP_DecryptInit +EVP_DecryptUpdate +EVP_DigestFinal +EVP_DigestInit +EVP_DigestUpdate +EVP_EncodeBlock +EVP_EncodeFinal +EVP_EncodeInit +EVP_EncodeUpdate +EVP_EncryptFinal +EVP_EncryptInit +EVP_EncryptUpdate +EVP_OpenFinal +EVP_OpenInit +EVP_PKEY_assign +EVP_PKEY_bits +EVP_PKEY_cmp_parameters +EVP_PKEY_copy_parameters +EVP_PKEY_free +EVP_PKEY_missing_parameters +EVP_PKEY_new +EVP_PKEY_save_parameters +EVP_PKEY_size +EVP_PKEY_type +EVP_SealFinal +EVP_SealInit +EVP_SignFinal +EVP_VerifyFinal +EVP_add_alias +EVP_add_cipher +EVP_add_digest +EVP_bf_cbc +EVP_bf_cfb +EVP_bf_ecb +EVP_bf_ofb +EVP_cast5_cbc +EVP_cast5_cfb +EVP_cast5_ecb +EVP_cast5_ofb +EVP_cleanup +EVP_delete_alias +EVP_des_cbc +EVP_des_cfb +EVP_des_ecb +EVP_des_ede +EVP_des_ede3 +EVP_des_ede3_cbc +EVP_des_ede3_cfb +EVP_des_ede3_ofb +EVP_des_ede_cbc +EVP_des_ede_cfb +EVP_des_ede_ofb +EVP_des_ofb +EVP_desx_cbc +EVP_dss +EVP_dss1 +EVP_enc_null +EVP_get_cipherbyname +EVP_get_digestbyname +EVP_get_pw_prompt +EVP_idea_cbc +EVP_idea_cfb +EVP_idea_ecb +EVP_idea_ofb +EVP_md2 +EVP_md5 +EVP_md_null +EVP_mdc2 +EVP_rc2_40_cbc +EVP_rc2_cbc +EVP_rc2_cfb +EVP_rc2_ecb +EVP_rc2_ofb +EVP_rc4 +EVP_rc4_40 +EVP_read_pw_string +EVP_set_pw_prompt +EVP_sha +EVP_sha1 +HMAC +HMAC_Final +HMAC_Init +HMAC_Update +HMAC_cleanup +MD2 +MD2_Final +MD2_Init +MD2_Update +MD2_options +MD5 +MD5_Final +MD5_Init +MD5_Transform +MD5_Update +MDC2 +MDC2_Final +MDC2_Init +MDC2_Update +NETSCAPE_SPKAC_free +NETSCAPE_SPKAC_new +NETSCAPE_SPKI_free +NETSCAPE_SPKI_new +NETSCAPE_SPKI_sign +NETSCAPE_SPKI_verify +OBJ_add_object +OBJ_bsearch +OBJ_cleanup +OBJ_cmp +OBJ_create +OBJ_create_objects +OBJ_dup +OBJ_ln2nid +OBJ_new_nid +OBJ_nid2ln +OBJ_nid2obj +OBJ_nid2sn +OBJ_obj2nid +OBJ_sn2nid +OBJ_txt2nid +PEM_ASN1_read +PEM_ASN1_read_bio +PEM_ASN1_write +PEM_ASN1_write_bio +PEM_SealFinal +PEM_SealInit +PEM_SealUpdate +PEM_SignFinal +PEM_SignInit +PEM_SignUpdate +PEM_X509_INFO_read +PEM_X509_INFO_read_bio +PEM_X509_INFO_write_bio +PEM_dek_info +PEM_do_header +PEM_get_EVP_CIPHER_INFO +PEM_proc_type +PEM_read +PEM_read_DHparams +PEM_read_DSAPrivateKey +PEM_read_DSAparams +PEM_read_PKCS7 +PEM_read_PrivateKey +PEM_read_RSAPrivateKey +PEM_read_RSAPublicKey +PEM_read_X509 +PEM_read_X509_CRL +PEM_read_X509_REQ +PEM_read_bio +PEM_read_bio_DHparams +PEM_read_bio_DSAPrivateKey +PEM_read_bio_DSAparams +PEM_read_bio_PKCS7 +PEM_read_bio_PrivateKey +PEM_read_bio_RSAPrivateKey +PEM_read_bio_RSAPublicKey +PEM_read_bio_X509 +PEM_read_bio_X509_CRL +PEM_read_bio_X509_REQ +PEM_write +PEM_write_DHparams +PEM_write_DSAPrivateKey +PEM_write_DSAparams +PEM_write_PKCS7 +PEM_write_PrivateKey +PEM_write_RSAPrivateKey +PEM_write_RSAPublicKey +PEM_write_X509 +PEM_write_X509_CRL +PEM_write_X509_REQ +PEM_write_bio +PEM_write_bio_DHparams +PEM_write_bio_DSAPrivateKey +PEM_write_bio_DSAparams +PEM_write_bio_PKCS7 +PEM_write_bio_PrivateKey +PEM_write_bio_RSAPrivateKey +PEM_write_bio_RSAPublicKey +PEM_write_bio_X509 +PEM_write_bio_X509_CRL +PEM_write_bio_X509_REQ +PKCS7_DIGEST_free +PKCS7_DIGEST_new +PKCS7_ENCRYPT_free +PKCS7_ENCRYPT_new +PKCS7_ENC_CONTENT_free +PKCS7_ENC_CONTENT_new +PKCS7_ENVELOPE_free +PKCS7_ENVELOPE_new +PKCS7_ISSUER_AND_SERIAL_digest +PKCS7_ISSUER_AND_SERIAL_free +PKCS7_ISSUER_AND_SERIAL_new +PKCS7_RECIP_INFO_free +PKCS7_RECIP_INFO_new +PKCS7_SIGNED_free +PKCS7_SIGNED_new +PKCS7_SIGNER_INFO_free +PKCS7_SIGNER_INFO_new +PKCS7_SIGNER_INFO_set +PKCS7_SIGN_ENVELOPE_free +PKCS7_SIGN_ENVELOPE_new +PKCS7_add_certificate +PKCS7_add_crl +PKCS7_add_signature +PKCS7_add_signer +PKCS7_cert_from_signer_info +PKCS7_content_free +PKCS7_content_new +PKCS7_ctrl +PKCS7_dataInit +PKCS7_dataSign +PKCS7_dataVerify +PKCS7_dup +PKCS7_free +PKCS7_get_signer_info +PKCS7_new +PKCS7_set_content +PKCS7_set_type +PROXY_ENTRY_add_noproxy +PROXY_ENTRY_clear_noproxy +PROXY_ENTRY_free +PROXY_ENTRY_get_noproxy +PROXY_ENTRY_new +PROXY_ENTRY_set_server +PROXY_add_noproxy +PROXY_add_server +PROXY_check_by_host +PROXY_check_url +PROXY_clear_noproxy +PROXY_free +PROXY_get_noproxy +PROXY_get_proxies +PROXY_get_proxy_entry +PROXY_load_conf +PROXY_new +PROXY_print +RAND_bytes +RAND_cleanup +RAND_file_name +RAND_load_file +RAND_seed +RAND_write_file +RC2_cbc_encrypt +RC2_cfb64_encrypt +RC2_decrypt +RC2_ecb_encrypt +RC2_encrypt +RC2_ofb64_encrypt +RC2_set_key +RC4 +RC4_options +RC4_set_key +RC5_32_cbc_encrypt +RC5_32_cfb64_encrypt +RC5_32_decrypt +RC5_32_ecb_encrypt +RC5_32_encrypt +RC5_32_ofb64_encrypt +RC5_32_set_key +RIPEMD160 +RIPEMD160_Final +RIPEMD160_Init +RIPEMD160_Transform +RIPEMD160_Update +RSAPrivateKey_asn1_meth +RSAPrivateKey_dup +RSAPublicKey_dup +RSA_PKCS1_SSLeay +RSA_blinding_off +RSA_blinding_on +RSA_flags +RSA_free +RSA_generate_key +RSA_get_ex_data +RSA_get_ex_new_index +RSA_new +RSA_new_method +RSA_padding_add_PKCS1_type_1 +RSA_padding_add_PKCS1_type_2 +RSA_padding_add_SSLv23 +RSA_padding_add_none +RSA_padding_check_PKCS1_type_1 +RSA_padding_check_PKCS1_type_2 +RSA_padding_check_SSLv23 +RSA_padding_check_none +RSA_print +RSA_print_fp +RSA_private_decrypt +RSA_private_encrypt +RSA_public_decrypt +RSA_public_encrypt +RSA_set_default_method +RSA_set_ex_data +RSA_sign +RSA_sign_ASN1_OCTET_STRING +RSA_size +RSA_verify +RSA_verify_ASN1_OCTET_STRING +SHA +SHA1 +SHA1_Final +SHA1_Init +SHA1_Transform +SHA1_Update +SHA_Final +SHA_Init +SHA_Transform +SHA_Update +SSLeay +SSLeay_add_all_algorithms +SSLeay_add_all_ciphers +SSLeay_add_all_digests +SSLeay_version +TXT_DB_create_index +TXT_DB_free +TXT_DB_get_by_index +TXT_DB_insert +TXT_DB_read +TXT_DB_write +X509_ALGOR_free +X509_ALGOR_new +X509_ATTRIBUTE_free +X509_ATTRIBUTE_new +X509_CINF_free +X509_CINF_new +X509_CRL_INFO_free +X509_CRL_INFO_new +X509_CRL_add_ext +X509_CRL_cmp +X509_CRL_delete_ext +X509_CRL_dup +X509_CRL_free +X509_CRL_get_ext +X509_CRL_get_ext_by_NID +X509_CRL_get_ext_by_OBJ +X509_CRL_get_ext_by_critical +X509_CRL_get_ext_count +X509_CRL_new +X509_CRL_sign +X509_CRL_verify +X509_EXTENSION_create_by_NID +X509_EXTENSION_create_by_OBJ +X509_EXTENSION_dup +X509_EXTENSION_free +X509_EXTENSION_get_critical +X509_EXTENSION_get_data +X509_EXTENSION_get_object +X509_EXTENSION_new +X509_EXTENSION_set_critical +X509_EXTENSION_set_data +X509_EXTENSION_set_object +X509_INFO_free +X509_INFO_new +X509_LOOKUP_by_alias +X509_LOOKUP_by_fingerprint +X509_LOOKUP_by_issuer_serial +X509_LOOKUP_by_subject +X509_LOOKUP_ctrl +X509_LOOKUP_file +X509_LOOKUP_free +X509_LOOKUP_hash_dir +X509_LOOKUP_init +X509_LOOKUP_new +X509_LOOKUP_shutdown +X509_NAME_ENTRY_create_by_NID +X509_NAME_ENTRY_create_by_OBJ +X509_NAME_ENTRY_dup +X509_NAME_ENTRY_free +X509_NAME_ENTRY_get_data +X509_NAME_ENTRY_get_object +X509_NAME_ENTRY_new +X509_NAME_ENTRY_set_data +X509_NAME_ENTRY_set_object +X509_NAME_add_entry +X509_NAME_cmp +X509_NAME_delete_entry +X509_NAME_digest +X509_NAME_dup +X509_NAME_entry_count +X509_NAME_free +X509_NAME_get_entry +X509_NAME_get_index_by_NID +X509_NAME_get_index_by_OBJ +X509_NAME_get_text_by_NID +X509_NAME_get_text_by_OBJ +X509_NAME_hash +X509_NAME_new +X509_NAME_oneline +X509_NAME_print +X509_NAME_set +X509_OBJECT_free_contents +X509_OBJECT_retrive_by_subject +X509_OBJECT_up_ref_count +X509_PKEY_free +X509_PKEY_new +X509_PUBKEY_free +X509_PUBKEY_get +X509_PUBKEY_new +X509_PUBKEY_set +X509_REQ_INFO_free +X509_REQ_INFO_new +X509_REQ_dup +X509_REQ_free +X509_REQ_get_pubkey +X509_REQ_new +X509_REQ_print +X509_REQ_print_fp +X509_REQ_set_pubkey +X509_REQ_set_subject_name +X509_REQ_set_version +X509_REQ_sign +X509_REQ_to_X509 +X509_REQ_verify +X509_REVOKED_add_ext +X509_REVOKED_delete_ext +X509_REVOKED_free +X509_REVOKED_get_ext +X509_REVOKED_get_ext_by_NID +X509_REVOKED_get_ext_by_OBJ +X509_REVOKED_get_ext_by_critical +X509_REVOKED_get_ext_count +X509_REVOKED_new +X509_SIG_free +X509_SIG_new +X509_STORE_CTX_cleanup +X509_STORE_CTX_get_chain +X509_STORE_CTX_get_current_cert +X509_STORE_CTX_get_error +X509_STORE_CTX_get_error_depth +X509_STORE_CTX_get_ex_data +X509_STORE_CTX_get_ex_new_index +X509_STORE_CTX_init +X509_STORE_CTX_set_cert +X509_STORE_CTX_set_chain +X509_STORE_CTX_set_error +X509_STORE_CTX_set_ex_data +X509_STORE_add_cert +X509_STORE_add_crl +X509_STORE_add_lookup +X509_STORE_free +X509_STORE_get_by_subject +X509_STORE_load_locations +X509_STORE_new +X509_STORE_set_default_paths +X509_VAL_free +X509_VAL_new +X509_add_ext +X509_asn1_meth +X509_certificate_type +X509_check_private_key +X509_cmp_current_time +X509_delete_ext +X509_digest +X509_dup +X509_find_by_issuer_and_serial +X509_find_by_subject +X509_free +X509_get_default_cert_area +X509_get_default_cert_dir +X509_get_default_cert_dir_env +X509_get_default_cert_file +X509_get_default_cert_file_env +X509_get_default_private_dir +X509_get_ext +X509_get_ext_by_NID +X509_get_ext_by_OBJ +X509_get_ext_by_critical +X509_get_ext_count +X509_get_issuer_name +X509_get_pubkey +X509_get_pubkey_parameters +X509_get_serialNumber +X509_get_subject_name +X509_gmtime_adj +X509_issuer_and_serial_cmp +X509_issuer_and_serial_hash +X509_issuer_name_cmp +X509_issuer_name_hash +X509_load_cert_file +X509_load_crl_file +X509_new +X509_print +X509_print_fp +X509_set_issuer_name +X509_set_notAfter +X509_set_notBefore +X509_set_pubkey +X509_set_serialNumber +X509_set_subject_name +X509_set_version +X509_sign +X509_subject_name_cmp +X509_subject_name_hash +X509_to_X509_REQ +X509_verify +X509_verify_cert +X509_verify_cert_error_string +X509v3_add_ext +X509v3_add_extension +X509v3_add_netscape_extensions +X509v3_add_standard_extensions +X509v3_cleanup_extensions +X509v3_data_type_by_NID +X509v3_data_type_by_OBJ +X509v3_delete_ext +X509v3_get_ext +X509v3_get_ext_by_NID +X509v3_get_ext_by_OBJ +X509v3_get_ext_by_critical +X509v3_get_ext_count +X509v3_get_key_usage +X509v3_pack_string +X509v3_pack_type_by_NID +X509v3_pack_type_by_OBJ +X509v3_set_key_usage +X509v3_unpack_string +_des_crypt +a2d_ASN1_OBJECT +a2i_ASN1_INTEGER +a2i_ASN1_STRING +a2i_X509v3_key_usage +asn1_Finish +asn1_GetSequence +bn_add_words +bn_div64 +bn_expand2 +bn_mul_add_words +bn_mul_words +bn_qadd +bn_qsub +bn_sqr_words +crypt +d2i_ASN1_BIT_STRING +d2i_ASN1_BOOLEAN +d2i_ASN1_HEADER +d2i_ASN1_IA5STRING +d2i_ASN1_INTEGER +d2i_ASN1_OBJECT +d2i_ASN1_OCTET_STRING +d2i_ASN1_PRINTABLE +d2i_ASN1_PRINTABLESTRING +d2i_ASN1_SET +d2i_ASN1_T61STRING +d2i_ASN1_TYPE +d2i_ASN1_UTCTIME +d2i_ASN1_bytes +d2i_ASN1_type_bytes +d2i_DHparams +d2i_DSAPrivateKey +d2i_DSAPrivateKey_bio +d2i_DSAPrivateKey_fp +d2i_DSAPublicKey +d2i_DSAparams +d2i_NETSCAPE_SPKAC +d2i_NETSCAPE_SPKI +d2i_Netscape_RSA +d2i_Netscape_RSA_2 +d2i_PKCS7 +d2i_PKCS7_DIGEST +d2i_PKCS7_ENCRYPT +d2i_PKCS7_ENC_CONTENT +d2i_PKCS7_ENVELOPE +d2i_PKCS7_ISSUER_AND_SERIAL +d2i_PKCS7_RECIP_INFO +d2i_PKCS7_SIGNED +d2i_PKCS7_SIGNER_INFO +d2i_PKCS7_SIGN_ENVELOPE +d2i_PKCS7_bio +d2i_PKCS7_fp +d2i_PrivateKey +d2i_PublicKey +d2i_RSAPrivateKey +d2i_RSAPrivateKey_bio +d2i_RSAPrivateKey_fp +d2i_RSAPublicKey +d2i_RSAPublicKey_bio +d2i_RSAPublicKey_fp +d2i_X509 +d2i_X509_ALGOR +d2i_X509_ATTRIBUTE +d2i_X509_CINF +d2i_X509_CRL +d2i_X509_CRL_INFO +d2i_X509_CRL_bio +d2i_X509_CRL_fp +d2i_X509_EXTENSION +d2i_X509_NAME +d2i_X509_NAME_ENTRY +d2i_X509_PKEY +d2i_X509_PUBKEY +d2i_X509_REQ +d2i_X509_REQ_INFO +d2i_X509_REQ_bio +d2i_X509_REQ_fp +d2i_X509_REVOKED +d2i_X509_SIG +d2i_X509_VAL +d2i_X509_bio +d2i_X509_fp +des_cbc_cksum +des_cbc_encrypt +des_cblock_print_file +des_cfb64_encrypt +des_cfb_encrypt +des_decrypt3 +des_ecb3_encrypt +des_ecb_encrypt +des_ede3_cbc_encrypt +des_ede3_cfb64_encrypt +des_ede3_ofb64_encrypt +des_enc_read +des_enc_write +des_encrypt +des_encrypt2 +des_encrypt3 +des_fcrypt +des_is_weak_key +des_key_sched +des_ncbc_encrypt +des_ofb64_encrypt +des_ofb_encrypt +des_options +des_pcbc_encrypt +des_quad_cksum +des_random_key +des_random_seed +des_read_2passwords +des_read_password +des_read_pw +des_read_pw_string +des_set_key +des_set_odd_parity +des_string_to_2keys +des_string_to_key +des_xcbc_encrypt +des_xwhite_in2out +fcrypt_body +i2a_ASN1_INTEGER +i2a_ASN1_OBJECT +i2a_ASN1_STRING +i2a_X509v3_key_usage +i2d_ASN1_BIT_STRING +i2d_ASN1_BOOLEAN +i2d_ASN1_HEADER +i2d_ASN1_IA5STRING +i2d_ASN1_INTEGER +i2d_ASN1_OBJECT +i2d_ASN1_OCTET_STRING +i2d_ASN1_PRINTABLE +i2d_ASN1_SET +i2d_ASN1_TYPE +i2d_ASN1_UTCTIME +i2d_ASN1_bytes +i2d_DHparams +i2d_DSAPrivateKey +i2d_DSAPrivateKey_bio +i2d_DSAPrivateKey_fp +i2d_DSAPublicKey +i2d_DSAparams +i2d_NETSCAPE_SPKAC +i2d_NETSCAPE_SPKI +i2d_Netscape_RSA +i2d_PKCS7 +i2d_PKCS7_DIGEST +i2d_PKCS7_ENCRYPT +i2d_PKCS7_ENC_CONTENT +i2d_PKCS7_ENVELOPE +i2d_PKCS7_ISSUER_AND_SERIAL +i2d_PKCS7_RECIP_INFO +i2d_PKCS7_SIGNED +i2d_PKCS7_SIGNER_INFO +i2d_PKCS7_SIGN_ENVELOPE +i2d_PKCS7_bio +i2d_PKCS7_fp +i2d_PrivateKey +i2d_PublicKey +i2d_RSAPrivateKey +i2d_RSAPrivateKey_bio +i2d_RSAPrivateKey_fp +i2d_RSAPublicKey +i2d_RSAPublicKey_bio +i2d_RSAPublicKey_fp +i2d_X509 +i2d_X509_ALGOR +i2d_X509_ATTRIBUTE +i2d_X509_CINF +i2d_X509_CRL +i2d_X509_CRL_INFO +i2d_X509_CRL_bio +i2d_X509_CRL_fp +i2d_X509_EXTENSION +i2d_X509_NAME +i2d_X509_NAME_ENTRY +i2d_X509_PKEY +i2d_X509_PUBKEY +i2d_X509_REQ +i2d_X509_REQ_INFO +i2d_X509_REQ_bio +i2d_X509_REQ_fp +i2d_X509_REVOKED +i2d_X509_SIG +i2d_X509_VAL +i2d_X509_bio +i2d_X509_fp +i2t_ASN1_OBJECT +idea_cbc_encrypt +idea_cfb64_encrypt +idea_ecb_encrypt +idea_encrypt +idea_ofb64_encrypt +idea_options +idea_set_decrypt_key +idea_set_encrypt_key +lh_delete +lh_doall +lh_doall_arg +lh_free +lh_insert +lh_new +lh_node_stats +lh_node_stats_bio +lh_node_usage_stats +lh_node_usage_stats_bio +lh_retrieve +lh_stats +lh_stats_bio +lh_strhash +ripemd160_block +sha1_block +sha_block +sk_delete +sk_delete_ptr +sk_dup +sk_find +sk_free +sk_insert +sk_new +sk_pop +sk_pop_free +sk_push +sk_set_cmp_func +sk_shift +sk_unshift +sk_zero diff --git a/src/lib/libssl/src/dep/files b/src/lib/libssl/src/dep/files new file mode 100644 index 0000000000..8c5550c37c --- /dev/null +++ b/src/lib/libssl/src/dep/files @@ -0,0 +1,574 @@ +./e_os.h + +./crypto/cryptall.h CRYPTO +./crypto/cryptlib.h CRYPTO +./crypto/crypto.c CRYPTO +./crypto/cversion.c CRYPTO +./crypto/date.h CRYPTO +./crypto/mem.c CRYPTO +./crypto/cpt_err.c CRYPTO +./crypto/ex_data.c CRYPTO +./crypto/crypto.h CRYPTO +./crypto/cryptlib.c CRYPTO +./crypto/tmdiff.c CRYPTO + +./crypto/asn1/asn1.h ASN1 +./crypto/asn1/asn1_mac.h ASN1 +./crypto/asn1/asn1_err.c ASN1 +./crypto/asn1/asn1_lib.c ASN1 +./crypto/asn1/asn1_par.c ASN1 +./crypto/asn1/a_bitstr.c ASN1 +./crypto/asn1/a_bmp.c ASN1 +./crypto/asn1/a_bool.c ASN1 +./crypto/asn1/a_bytes.c ASN1 +./crypto/asn1/a_d2i_fp.c ASN1 +./crypto/asn1/a_digest.c ASN1 +./crypto/asn1/a_dup.c ASN1 +./crypto/asn1/a_hdr.c ASN1 +./crypto/asn1/a_i2d_fp.c ASN1 +./crypto/asn1/a_int.c ASN1 +./crypto/asn1/a_meth.c ASN1 +./crypto/asn1/a_object.c ASN1 +./crypto/asn1/a_octet.c ASN1 +./crypto/asn1/a_print.c ASN1 +./crypto/asn1/a_set.c ASN1 +./crypto/asn1/a_sign.c ASN1 +./crypto/asn1/a_type.c ASN1 +./crypto/asn1/a_utctm.c ASN1 +./crypto/asn1/a_verify.c ASN1 +./crypto/asn1/d2i_dhp.c ASN1 +./crypto/asn1/d2i_dsap.c ASN1 +./crypto/asn1/d2i_pr.c ASN1 +./crypto/asn1/d2i_pu.c ASN1 +./crypto/asn1/d2i_r_pr.c ASN1 +./crypto/asn1/d2i_r_pu.c ASN1 +./crypto/asn1/d2i_s_pr.c ASN1 +./crypto/asn1/d2i_s_pu.c ASN1 +./crypto/asn1/f_int.c ASN1 +./crypto/asn1/f_string.c ASN1 +./crypto/asn1/i2d_dhp.c ASN1 +./crypto/asn1/i2d_dsap.c ASN1 +./crypto/asn1/i2d_pr.c ASN1 +./crypto/asn1/i2d_pu.c ASN1 +./crypto/asn1/i2d_r_pr.c ASN1 +./crypto/asn1/i2d_r_pu.c ASN1 +./crypto/asn1/i2d_s_pr.c ASN1 +./crypto/asn1/i2d_s_pu.c ASN1 +./crypto/asn1/n_pkey.c ASN1 +./crypto/asn1/p7_dgst.c ASN1 +./crypto/asn1/p7_enc.c ASN1 +./crypto/asn1/p7_enc_c.c ASN1 +./crypto/asn1/p7_evp.c ASN1 +./crypto/asn1/p7_i_s.c ASN1 +./crypto/asn1/p7_lib.c ASN1 +./crypto/asn1/p7_recip.c ASN1 +./crypto/asn1/p7_signd.c ASN1 +./crypto/asn1/p7_signi.c ASN1 +./crypto/asn1/p7_s_e.c ASN1 +./crypto/asn1/pk.c ASN1 +./crypto/asn1/pkcs8.c ASN1 +./crypto/asn1/t_pkey.c ASN1 +./crypto/asn1/t_req.c ASN1 +./crypto/asn1/t_x509.c ASN1 +./crypto/asn1/x_algor.c ASN1 +./crypto/asn1/x_attrib.c ASN1 +./crypto/asn1/x_cinf.c ASN1 +./crypto/asn1/x_crl.c ASN1 +./crypto/asn1/x_exten.c ASN1 +./crypto/asn1/x_info.c ASN1 +./crypto/asn1/x_name.c ASN1 +./crypto/asn1/x_pkey.c ASN1 +./crypto/asn1/x_pubkey.c ASN1 +./crypto/asn1/x_req.c ASN1 +./crypto/asn1/x_sig.c ASN1 +./crypto/asn1/x_spki.c ASN1 +./crypto/asn1/x_val.c ASN1 +./crypto/asn1/x_x509.c ASN1 + +./crypto/bf/blowfish.h BF +./crypto/bf/bf_pi.h BF +./crypto/bf/bf_locl.h BF +./crypto/bf/bfspeed.c BF +./crypto/bf/bftest.c BF +./crypto/bf/bf_cbc.c BF +./crypto/bf/bf_cfb64.c BF +./crypto/bf/bf_ecb.c BF +./crypto/bf/bf_enc.c BF +./crypto/bf/bf_ofb64.c BF +./crypto/bf/bf_opts.c BF +./crypto/bf/bf_skey.c BF + +./crypto/bio/bio.h BIO +./crypto/bio/bf_buff.c BIO +./crypto/bio/bf_nbio.c BIO +./crypto/bio/bf_null.c BIO +./crypto/bio/bio_cb.c BIO +./crypto/bio/bio_err.c BIO +./crypto/bio/bio_lib.c BIO +./crypto/bio/bss_acpt.c BIO +./crypto/bio/bss_conn.c BIO +./crypto/bio/bss_fd.c BIO +./crypto/bio/bss_file.c BIO +./crypto/bio/bss_mem.c BIO +./crypto/bio/bss_null.c BIO +./crypto/bio/bss_rtcp.c BIO +./crypto/bio/bss_sock.c BIO +./crypto/bio/b_dump.c BIO +./crypto/bio/b_print.c BIO +./crypto/bio/b_sock.c BIO + +./crypto/bn/bn.h BN +./crypto/bn/bn_lcl.h BN +./crypto/bn/bn_prime.h BN +./crypto/bn/bnspeed.c BN +./crypto/bn/bntest.c BN +./crypto/bn/bn_add.c BN +./crypto/bn/bn_bld.c BN +./crypto/bn/bn_blind.c BN +./crypto/bn/bn_div.c BN +./crypto/bn/bn_err.c BN +./crypto/bn/bn_exp.c BN +./crypto/bn/bn_gcd.c BN +./crypto/bn/bn_lib.c BN +./crypto/bn/bn_mod.c BN +./crypto/bn/bn_mont.c BN +./crypto/bn/bn_mul.c BN +./crypto/bn/bn_mulw.c BN +./crypto/bn/bn_prime.c BN +./crypto/bn/bn_print.c BN +./crypto/bn/bn_rand.c BN +./crypto/bn/bn_recp.c BN +./crypto/bn/bn_shift.c BN +./crypto/bn/bn_sqr.c BN +./crypto/bn/bn_sub.c BN +./crypto/bn/bn_word.c BN +./crypto/bn/bn_m.c BN +./crypto/bn/m.c BN +./crypto/bn/expspeed.c BN +./crypto/bn/bn_mpi.c BN +./crypto/bn/exptest.c BN + +./crypto/buffer/buffer.c BUFF +./crypto/buffer/buffer.h BUFF +./crypto/buffer/buf_err.c BUFF + +./crypto/cast/cast.h CAST +./crypto/cast/castopts.c CAST +./crypto/cast/casttest.c CAST +./crypto/cast/cast_lcl.h CAST +./crypto/cast/cast_s.h CAST +./crypto/cast/cast_spd.c CAST +./crypto/cast/c_cfb64.c CAST +./crypto/cast/c_ecb.c CAST +./crypto/cast/c_enc.c CAST +./crypto/cast/c_ofb64.c CAST +./crypto/cast/c_skey.c CAST + +./crypto/conf/conf_lcl.h CONF +./crypto/conf/cnf_save.c CONF +./crypto/conf/conf.c CONF +./crypto/conf/conf.h CONF +./crypto/conf/conf_err.c CONF + +./crypto/des/des.h DES +./crypto/des/des_locl.h DES +./crypto/des/spr.h DES +./crypto/des/podd.h DES +./crypto/des/sk.h DES +./crypto/des/cbc3_enc.c DES +./crypto/des/cbc_cksm.c DES +./crypto/des/cbc_enc.c DES +./crypto/des/cfb64ede.c DES +./crypto/des/cfb64enc.c DES +./crypto/des/cfb_enc.c DES +./crypto/des/des.c DES +./crypto/des/destest.c DES +./crypto/des/des_enc.c DES +./crypto/des/des_opts.c DES +./crypto/des/des_ver.h DES +./crypto/des/ecb3_enc.c DES +./crypto/des/ecb_enc.c DES +./crypto/des/ede_enc.c DES +./crypto/des/enc_read.c DES +./crypto/des/enc_writ.c DES +./crypto/des/fcrypt.c DES +./crypto/des/fcrypt_b.c DES +./crypto/des/ncbc_enc.c DES +./crypto/des/ofb64ede.c DES +./crypto/des/ofb64enc.c DES +./crypto/des/ofb_enc.c DES +./crypto/des/pcbc_enc.c DES +./crypto/des/qud_cksm.c DES +./crypto/des/rand_key.c DES +./crypto/des/read2pwd.c DES +./crypto/des/read_pwd.c DES +./crypto/des/rpc_des.h DES +./crypto/des/rpc_enc.c DES +./crypto/des/rpw.c DES +./crypto/des/set_key.c DES +./crypto/des/str2key.c DES +./crypto/des/supp.c DES +./crypto/des/xcbc_enc.c DES + +./crypto/dh/dh.h DH +./crypto/dh/dh_check.c DH +./crypto/dh/dh_err.c DH +./crypto/dh/dh_gen.c DH +./crypto/dh/dh_key.c DH +./crypto/dh/dh_lib.c DH +./crypto/dh/p1024.c DH +./crypto/dh/p192.c DH +./crypto/dh/p512.c DH +./crypto/dh/dhtest.c DH + +./crypto/dsa/dsa.h DSA +./crypto/dsa/dsagen.c DSA +./crypto/dsa/dsa_err.c DSA +./crypto/dsa/dsa_gen.c DSA +./crypto/dsa/dsa_key.c DSA +./crypto/dsa/dsa_lib.c DSA +./crypto/dsa/dsa_sign.c DSA +./crypto/dsa/dsa_vrf.c DSA +./crypto/dsa/dsatest.c DSA + +./crypto/err/err.c ERR +./crypto/err/err.h ERR +./crypto/err/err_all.c ERR +./crypto/err/err_prn.c ERR + +./crypto/evp/evp.h EVP +./crypto/evp/bio_b64.c EVP +./crypto/evp/bio_enc.c EVP +./crypto/evp/bio_md.c EVP +./crypto/evp/c_all.c EVP +./crypto/evp/digest.c EVP +./crypto/evp/encode.c EVP +./crypto/evp/evp_enc.c EVP +./crypto/evp/evp_err.c EVP +./crypto/evp/evp_key.c EVP +./crypto/evp/e_cbc_3d.c EVP +./crypto/evp/e_cbc_bf.c EVP +./crypto/evp/e_cbc_c.c EVP +./crypto/evp/e_cbc_d.c EVP +./crypto/evp/e_cbc_i.c EVP +./crypto/evp/e_cbc_r2.c EVP +./crypto/evp/e_cfb_3d.c EVP +./crypto/evp/e_cfb_bf.c EVP +./crypto/evp/e_cfb_c.c EVP +./crypto/evp/e_cfb_d.c EVP +./crypto/evp/e_cfb_i.c EVP +./crypto/evp/e_cfb_r2.c EVP +./crypto/evp/e_dsa.c EVP +./crypto/evp/e_ecb_3d.c EVP +./crypto/evp/e_ecb_bf.c EVP +./crypto/evp/e_ecb_c.c EVP +./crypto/evp/e_ecb_d.c EVP +./crypto/evp/e_ecb_i.c EVP +./crypto/evp/e_ecb_r2.c EVP +./crypto/evp/e_null.c EVP +./crypto/evp/e_ofb_3d.c EVP +./crypto/evp/e_ofb_bf.c EVP +./crypto/evp/e_ofb_c.c EVP +./crypto/evp/e_ofb_d.c EVP +./crypto/evp/e_ofb_i.c EVP +./crypto/evp/e_ofb_r2.c EVP +./crypto/evp/e_rc4.c EVP +./crypto/evp/e_xcbc_d.c EVP +./crypto/evp/m_dss.c EVP +./crypto/evp/m_dss1.c EVP +./crypto/evp/m_md2.c EVP +./crypto/evp/m_md5.c EVP +./crypto/evp/m_mdc2.c EVP +./crypto/evp/m_null.c EVP +./crypto/evp/m_sha.c EVP +./crypto/evp/m_sha1.c EVP +./crypto/evp/names.c EVP +./crypto/evp/p_lib.c EVP +./crypto/evp/p_open.c EVP +./crypto/evp/p_seal.c EVP +./crypto/evp/p_sign.c EVP +./crypto/evp/p_verify.c EVP + +./crypto/hmac/hmac.c HMAC +./crypto/hmac/hmac.h HMAC +./crypto/hmac/hmactest.c HMAC + +./crypto/idea/ideatest.c IDEA +./crypto/idea/idea_lcl.h IDEA +./crypto/idea/idea_spd.c IDEA +./crypto/idea/i_cbc.c IDEA +./crypto/idea/i_cfb64.c IDEA +./crypto/idea/i_ecb.c IDEA +./crypto/idea/i_ofb64.c IDEA +./crypto/idea/i_skey.c IDEA +./crypto/idea/idea.h IDEA + +./crypto/lhash/lhash.c LHASH +./crypto/lhash/lhash.h LHASH +./crypto/lhash/lh_stats.c LHASH +./crypto/lhash/lh_test.c LHASH + +./crypto/md2/md2.c MD2 +./crypto/md2/md2test.c MD2 +./crypto/md2/md2_dgst.c MD2 +./crypto/md2/md2_one.c MD2 +./crypto/md2/md2.h MD2 + +./crypto/md5/md5.c MD5 +./crypto/md5/md5.h MD5 +./crypto/md5/md5test.c MD5 +./crypto/md5/md5_dgst.c MD5 +./crypto/md5/md5_locl.h MD5 +./crypto/md5/md5_one.c MD5 + +./crypto/mdc2/mdc2.h MDC2 +./crypto/mdc2/mdc2dgst.c MDC2 +./crypto/mdc2/mdc2test.c MDC2 +./crypto/mdc2/mdc2_one.c MDC2 + +./crypto/objects/objects.h OBJ +./crypto/objects/obj_dat.c OBJ +./crypto/objects/obj_dat.h OBJ +./crypto/objects/obj_err.c OBJ +./crypto/objects/obj_lib.c OBJ + +./crypto/pem/ctx_size.c PEM +./crypto/pem/pem.h PEM +./crypto/pem/pem_all.c PEM +./crypto/pem/pem_err.c PEM +./crypto/pem/pem_info.c PEM +./crypto/pem/pem_lib.c PEM +./crypto/pem/pem_seal.c PEM +./crypto/pem/pem_sign.c PEM + +./crypto/pkcs7/pk7_dgst.c PKCS7 +./crypto/pkcs7/pk7_doit.c PKCS7 +./crypto/pkcs7/pk7_enc.c PKCS7 +./crypto/pkcs7/pk7_lib.c PKCS7 +./crypto/pkcs7/pkcs7.h PKCS7 +./crypto/pkcs7/pkcs7err.c PKCS7 +./crypto/pkcs7/sign.c PKCS7 + +./crypto/proxy/bf_proxy.c PROXY +./crypto/proxy/p2test.c PROXY +./crypto/proxy/p3test.c PROXY +./crypto/proxy/paccept.c PROXY +./crypto/proxy/proxy.c PROXY +./crypto/proxy/proxy.h PROXY +./crypto/proxy/ptest.c PROXY +./crypto/proxy/pxy_conf.c PROXY +./crypto/proxy/pxy_err.c PROXY +./crypto/proxy/pxy_txt.c PROXY + +./crypto/rand/md_rand.c RAND +./crypto/rand/rand.h RAND +./crypto/rand/randfile.c RAND +./crypto/rand/randtest.c RAND + +./crypto/rc2/rc2cfb64.c RC2 +./crypto/rc2/rc2ofb64.c RC2 +./crypto/rc2/rc2speed.c RC2 +./crypto/rc2/rc2test.c RC2 +./crypto/rc2/rc2_cbc.c RC2 +./crypto/rc2/rc2_ecb.c RC2 +./crypto/rc2/rc2_locl.h RC2 +./crypto/rc2/rc2_skey.c RC2 +./crypto/rc2/rc2.h RC2 + +./crypto/rc4/rc4.c RC4 +./crypto/rc4/rc4speed.c RC4 +./crypto/rc4/rc4test.c RC4 +./crypto/rc4/rc4_enc.c RC4 +./crypto/rc4/rc4_skey.c RC4 +./crypto/rc4/rc4.h RC4 +./crypto/rc4/rc4_locl.h RC4 + +./crypto/rsa/rsa.h RSA +./crypto/rsa/rsa_eay.c RSA +./crypto/rsa/rsa_err.c RSA +./crypto/rsa/rsa_gen.c RSA +./crypto/rsa/rsa_lib.c RSA +./crypto/rsa/rsa_saos.c RSA +./crypto/rsa/rsa_sign.c RSA +./crypto/rsa/rsa_ssl.c RSA +./crypto/rsa/rsa_pk1.c RSA +./crypto/rsa/rsa_none.c RSA + +./crypto/sha/sha.h SHA +./crypto/sha/sha_locl.h SHA +./crypto/sha/sha.c SHA0 +./crypto/sha/sha_dgst.c SHA0 +./crypto/sha/sha_one.c SHA0 +./crypto/sha/sha_sgst.c SHA0 +./crypto/sha/shatest.c SHA0 +./crypto/sha/sha1.c SHA1 +./crypto/sha/sha1dgst.c SHA1 +./crypto/sha/sha1_one.c SHA1 +./crypto/sha/sha1test.c SHA1 + +./crypto/stack/stack.c STACK +./crypto/stack/stack.h STACK + +./crypto/txt_db/txt_db.c TXTDB +./crypto/txt_db/txt_db.h TXTDB + +./crypto/x509/by_dir.c X509 +./crypto/x509/by_file.c X509 +./crypto/x509/v3_net.c X509 +./crypto/x509/v3_x509.c X509 +./crypto/x509/x509.h X509 +./crypto/x509/x509name.c X509 +./crypto/x509/x509pack.c X509 +./crypto/x509/x509rset.c X509 +./crypto/x509/x509type.c X509 +./crypto/x509/x509_cmp.c X509 +./crypto/x509/x509_d2.c X509 +./crypto/x509/x509_def.c X509 +./crypto/x509/x509_err.c X509 +./crypto/x509/x509_ext.c X509 +./crypto/x509/x509_lu.c X509 +./crypto/x509/x509_obj.c X509 +./crypto/x509/x509_r2x.c X509 +./crypto/x509/x509_req.c X509 +./crypto/x509/x509_set.c X509 +./crypto/x509/x509_txt.c X509 +./crypto/x509/x509_v3.c X509 +./crypto/x509/x509_vfy.c X509 +./crypto/x509/x_all.c X509 +./crypto/x509/x509_vfy.h X509 +./crypto/x509v3/v3_ku.c X509 +./crypto/x509v3/x509v3.h X509 + +./crypto/threads/mttest.c THREADS +./crypto/threads/th-lock.c THREADS + +./crypto/ripemd/rmdtest.c RMD160 +./crypto/ripemd/ripemd.h RMD160 +./crypto/ripemd/rmdconst.h RMD160 +./crypto/ripemd/rmd_locl.h RMD160 +./crypto/ripemd/rmd_one.c RMD160 +./crypto/ripemd/rmd160.c RMD160 +./crypto/ripemd/rmd_dgst.c RMD160 + +./crypto/rc5/rc5_ecb.c RC5 +./crypto/rc5/rc5cfb64.c RC5 +./crypto/rc5/rc5ofb64.c RC5 +./crypto/rc5/rc5speed.c RC5 +./crypto/rc5/rc5test.c RC5 +./crypto/rc5/rc5_enc.c RC5 +./crypto/rc5/rc5.h RC5 +./crypto/rc5/rc5_locl.h RC5 +./crypto/rc5/rc5_skey.c RC5 + +./ssl/bio_ssl.c SSL +./ssl/pxy_ssl.c SSL +./ssl/s23_clnt.c SSL +./ssl/s23_lib.c SSL +./ssl/s23_meth.c SSL +./ssl/s23_pkt.c SSL +./ssl/s23_srvr.c SSL +./ssl/s2_clnt.c SSL +./ssl/s2_enc.c SSL +./ssl/s2_lib.c SSL +./ssl/s2_meth.c SSL +./ssl/s2_pkt.c SSL +./ssl/s2_srvr.c SSL +./ssl/s3_both.c SSL +./ssl/s3_clnt.c SSL +./ssl/s3_enc.c SSL +./ssl/s3_lib.c SSL +./ssl/s3_meth.c SSL +./ssl/s3_pkt.c SSL +./ssl/s3_srvr.c SSL +./ssl/ssl.c SSL +./ssl/ssl2.h SSL +./ssl/ssl23.h SSL +./ssl/ssl3.h SSL +./ssl/ssl_algs.c SSL +./ssl/ssl_asn1.c SSL +./ssl/ssl_cert.c SSL +./ssl/ssl_ciph.c SSL +./ssl/ssl_err.c SSL +./ssl/ssl_err2.c SSL +./ssl/ssl_lib.c SSL +./ssl/ssl_locl.h SSL +./ssl/ssl_rsa.c SSL +./ssl/ssl_sess.c SSL +./ssl/ssl_stat.c SSL +./ssl/ssl_task.c SSL +./ssl/ssl_txt.c SSL +./ssl/tls1.h SSL +./ssl/t1_lib.c SSL +./ssl/t1_enc.c SSL +./ssl/t1_meth.c SSL +./ssl/t1_srvr.c SSL +./ssl/t1_clnt.c SSL +./ssl/ssl.h SSL +./ssl/ssltest.c SSL + +./rsaref/rsaref.c RSAREF +./rsaref/rsaref.h RSAREF +./rsaref/rsar_err.c RSAREF + +./apps/apps.c APPS +./apps/apps.h APPS +./apps/asn1pars.c APPS +./apps/bf_perm.c APPS +./apps/bf_perm.h APPS +./apps/ca.c APPS +./apps/ciphers.c APPS +./apps/crl.c APPS +./apps/crl2p7.c APPS +./apps/dgst.c APPS +./apps/dh.c APPS +./apps/dsa.c APPS +./apps/dsaparam.c APPS +./apps/eay.c APPS +./apps/enc.c APPS +./apps/errstr.c APPS +./apps/speed.c APPS +./apps/gendh.c APPS +./apps/gendsa.c APPS +./apps/genrsa.c APPS +./apps/mybio_cb.c APPS +./apps/pem_mail.c APPS +./apps/pkcs7.c APPS +./apps/progs.h APPS +./apps/req.c APPS +./apps/rsa.c APPS +./apps/sess_id.c APPS +./apps/s_apps.h APPS +./apps/s_args.c APPS +./apps/s_cache.c APPS +./apps/s_cb.c APPS +./apps/s_client.c APPS +./apps/s_eio.c APPS +./apps/s_eio.h APPS +./apps/s_filter.c APPS +./apps/s_filter.h APPS +./apps/s_server.c APPS +./apps/s_socket.c APPS +./apps/s_state.c APPS +./apps/s_state.h APPS +./apps/s_time.c APPS +./apps/testdsa.h APPS +./apps/testrsa.h APPS +./apps/verify.c APPS +./apps/version.c APPS +./apps/x509.c APPS +./apps/ssleay.c APPS +./apps/sp.c APPS + +./demos/b64.c DEMO +./demos/bio/saccept.c DEMO +./demos/bio/sconnect.c DEMO +./demos/maurice/example1.c DEMO +./demos/maurice/example2.c DEMO +./demos/maurice/example3.c DEMO +./demos/maurice/example4.c DEMO +./demos/maurice/loadkeys.c DEMO +./demos/maurice/loadkeys.h DEMO +./demos/prime/prime.c DEMO +./demos/selfsign.c DEMO +./demos/spkigen.c DEMO + diff --git a/src/lib/libssl/src/dep/gen.pl b/src/lib/libssl/src/dep/gen.pl new file mode 100644 index 0000000000..35490f2794 --- /dev/null +++ b/src/lib/libssl/src/dep/gen.pl @@ -0,0 +1,113 @@ +#!/usr/bin/perl + +require 'getopts.pl'; + +$files="files"; +%have=(); +%missing=(); +%name=(); +%func=(); + +&Getopts('Ff:'); + +&load_file("files"); +foreach $file (@ARGV) + { &do_nm($file); } + +if (defined($opt_f)) + { + %a=(); + $r=&list_files($opt_f,"",*a); + if ($opt_F) + { + foreach (sort split(/\n/,$r)) + { print "$_\n"; } + } + else + { print $r; } + } +else + { + for (sort keys %have) + { + print "$_:$have{$_}\n"; + } + } + +sub list_files + { + local($f,$o,*done)=@_; + local($a,$_,$ff,$ret); + + return if $f =~ /^\s*$/; + + $done{$f}=1; + $ret.=$f."\n" if $opt_F; + foreach (split(/ /,$have{$f})) + { + $ret.="$o$f:$_\n" unless $opt_F; + } + + foreach (split(/ /,$missing{$f})) + { + $ff=$func{$_}; + next if defined($done{$ff}); + $ret.=&list_files($ff,$o." "); + } + $ret; + } + +sub do_nm + { + local($file)=@_; + local($fname)=""; + + open(IN,"nm $file|") || die "unable to run 'nm $file|':$!\n"; + while (<IN>) + { + chop; + next if /^\s*$/; + if (/^(.*)\.o:\s*$/) + { + $fname="$1.c"; + next; + } + ($type,$name)=/^.{8} (.) (.+)/; +# print "$fname $type $name\n"; + + if ($type eq "T") + { + $have{$fname}.="$name "; + $func{$name}=$fname; + } + elsif ($type eq "U") + { + $missing{$fname}.="$name "; + } + } + close(IN); + } + +sub load_file + { + local($file)=@_; + + open(IN,"<$files") || die "unable to open $files:$!\n"; + + while (<IN>) + { + chop; + next if /^\s*$/; + ($n)=/\/([^\/\s]+)\s+/; + ($fn)=/^(\S+)\s/; +# print "$n - $fn\n"; + if (defined($name{$n})) + { print "$n already exists\n"; } + else + { $name{$n}=$fn; } + } + close(IN); + @name=%name; + } + + diff --git a/src/lib/libssl/src/dep/ssl.txt b/src/lib/libssl/src/dep/ssl.txt new file mode 100644 index 0000000000..7cd125a0d1 --- /dev/null +++ b/src/lib/libssl/src/dep/ssl.txt @@ -0,0 +1,156 @@ +BIO_f_ssl +BIO_new_buffer_ssl_connect +BIO_new_ssl +BIO_new_ssl_connect +BIO_proxy_ssl_copy_session_id +BIO_ssl_copy_session_id +BIO_ssl_shutdown +ERR_load_SSL_strings +SSL_CIPHER_description +SSL_CIPHER_get_bits +SSL_CIPHER_get_name +SSL_CIPHER_get_version +SSL_CTX_add_client_CA +SSL_CTX_add_session +SSL_CTX_check_private_key +SSL_CTX_ctrl +SSL_CTX_flush_sessions +SSL_CTX_free +SSL_CTX_get_client_CA_list +SSL_CTX_get_ex_data +SSL_CTX_get_ex_new_index +SSL_CTX_get_quiet_shutdown +SSL_CTX_get_verify_callback +SSL_CTX_get_verify_mode +SSL_CTX_load_verify_locations +SSL_CTX_new +SSL_CTX_remove_session +SSL_CTX_set_cert_verify_cb +SSL_CTX_set_cipher_list +SSL_CTX_set_client_CA_list +SSL_CTX_set_default_passwd_cb +SSL_CTX_set_default_verify_paths +SSL_CTX_set_ex_data +SSL_CTX_set_quiet_shutdown +SSL_CTX_set_ssl_version +SSL_CTX_set_verify +SSL_CTX_use_PrivateKey +SSL_CTX_use_PrivateKey_ASN1 +SSL_CTX_use_PrivateKey_file +SSL_CTX_use_RSAPrivateKey +SSL_CTX_use_RSAPrivateKey_ASN1 +SSL_CTX_use_RSAPrivateKey_file +SSL_CTX_use_certificate +SSL_CTX_use_certificate_ASN1 +SSL_CTX_use_certificate_file +SSL_SESSION_cmp +SSL_SESSION_free +SSL_SESSION_get_ex_data +SSL_SESSION_get_ex_new_index +SSL_SESSION_get_time +SSL_SESSION_get_timeout +SSL_SESSION_hash +SSL_SESSION_new +SSL_SESSION_print +SSL_SESSION_print_fp +SSL_SESSION_set_ex_data +SSL_SESSION_set_time +SSL_SESSION_set_timeout +SSL_accept +SSL_add_client_CA +SSL_alert_desc_string +SSL_alert_desc_string_long +SSL_alert_type_string +SSL_alert_type_string_long +SSL_check_private_key +SSL_clear +SSL_connect +SSL_copy_session_id +SSL_ctrl +SSL_do_handshake +SSL_dup +SSL_dup_CA_list +SSL_free +SSL_get_SSL_CTX +SSL_get_certificate +SSL_get_cipher_list +SSL_get_ciphers +SSL_get_client_CA_list +SSL_get_current_cipher +SSL_get_default_timeout +SSL_get_error +SSL_get_ex_data +SSL_get_ex_new_index +SSL_get_fd +SSL_get_info_callback +SSL_get_peer_cert_chain +SSL_get_peer_certificate +SSL_get_privatekey +SSL_get_quiet_shutdown +SSL_get_rbio +SSL_get_read_ahead +SSL_get_session +SSL_get_shared_ciphers +SSL_get_shutdown +SSL_get_ssl_method +SSL_get_verify_callback +SSL_get_verify_mode +SSL_get_verify_result +SSL_get_version +SSL_get_wbio +SSL_load_client_CA_file +SSL_load_error_strings +SSL_new +SSL_peek +SSL_pending +SSL_read +SSL_renegotiate +SSL_rstate_string +SSL_rstate_string_long +SSL_set_accept_state +SSL_set_bio +SSL_set_cipher_list +SSL_set_client_CA_list +SSL_set_connect_state +SSL_set_ex_data +SSL_set_fd +SSL_set_info_callback +SSL_set_quiet_shutdown +SSL_set_read_ahead +SSL_set_rfd +SSL_set_session +SSL_set_shutdown +SSL_set_ssl_method +SSL_set_verify +SSL_set_verify_result +SSL_set_wfd +SSL_shutdown +SSL_state +SSL_state_string +SSL_state_string_long +SSL_use_PrivateKey +SSL_use_PrivateKey_ASN1 +SSL_use_PrivateKey_file +SSL_use_RSAPrivateKey +SSL_use_RSAPrivateKey_ASN1 +SSL_use_RSAPrivateKey_file +SSL_use_certificate +SSL_use_certificate_ASN1 +SSL_use_certificate_file +SSL_version +SSL_write +SSLeay_add_ssl_algorithms +SSLv23_client_method +SSLv23_method +SSLv23_server_method +SSLv2_client_method +SSLv2_method +SSLv2_server_method +SSLv3_client_method +SSLv3_method +SSLv3_server_method +TLSv1_client_method +TLSv1_method +TLSv1_server_method +d2i_SSL_SESSION +i2d_SSL_SESSION diff --git a/src/lib/libssl/src/doc/API.doc b/src/lib/libssl/src/doc/API.doc new file mode 100644 index 0000000000..fe2820259a --- /dev/null +++ b/src/lib/libssl/src/doc/API.doc @@ -0,0 +1,24 @@ +SSL - SSLv2/v3/v23 etc. + +BIO - methods and how they plug together + +MEM - memory allocation callback + +CRYPTO - locking for threads + +EVP - Ciphers/Digests/signatures + +RSA - methods + +X509 - certificate retrieval + +X509 - validation + +X509 - X509v3 extensions + +Objects - adding object identifiers + +ASN.1 - parsing + +PEM - parsing + diff --git a/src/lib/libssl/src/doc/a_verify.doc b/src/lib/libssl/src/doc/a_verify.doc new file mode 100644 index 0000000000..06eec17c2b --- /dev/null +++ b/src/lib/libssl/src/doc/a_verify.doc @@ -0,0 +1,85 @@ +From eay@mincom.com Fri Oct 4 18:29:06 1996 +Received: by orb.mincom.oz.au id AA29080 + (5.65c/IDA-1.4.4 for eay); Fri, 4 Oct 1996 08:29:07 +1000 +Date: Fri, 4 Oct 1996 08:29:06 +1000 (EST) +From: Eric Young <eay@mincom.oz.au> +X-Sender: eay@orb +To: wplatzer <wplatzer@iaik.tu-graz.ac.at> +Cc: Eric Young <eay@mincom.oz.au>, SSL Mailing List <ssl-users@mincom.com> +Subject: Re: Netscape's Public Key +In-Reply-To: <19961003134837.NTM0049@iaik.tu-graz.ac.at> +Message-Id: <Pine.SOL.3.91.961004081346.8018K-100000@orb> +Mime-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +Status: RO +X-Status: + +On Thu, 3 Oct 1996, wplatzer wrote: +> I get Public Key from Netscape (Gold 3.0b4), but cannot do anything +> with it... It looks like (asn1parse): +> +> 0:d=0 hl=3 l=180 cons: SEQUENCE +> 3:d=1 hl=2 l= 96 cons: SEQUENCE +> 5:d=2 hl=2 l= 92 cons: SEQUENCE +> 7:d=3 hl=2 l= 13 cons: SEQUENCE +> 9:d=4 hl=2 l= 9 prim: OBJECT :rsaEncryption +> 20:d=4 hl=2 l= 0 prim: NULL +> 22:d=3 hl=2 l= 75 prim: BIT STRING +> 99:d=2 hl=2 l= 0 prim: IA5STRING : +> 101:d=1 hl=2 l= 13 cons: SEQUENCE +> 103:d=2 hl=2 l= 9 prim: OBJECT :md5withRSAEncryption +> 114:d=2 hl=2 l= 0 prim: NULL +> 116:d=1 hl=2 l= 65 prim: BIT STRING +> +> The first BIT STRING is the public key and the second BIT STRING is +> the signature. +> But a public key consists of the public exponent and the modulus. Are +> both numbers in the first BIT STRING? +> Is there a document simply describing this coding stuff (checking +> signature, get the public key, etc.)? + +Minimal in SSLeay. If you want to see what the modulus and exponent are, +try asn1parse -offset 25 -length 75 <key.pem +asn1parse will currently stuff up on the 'length 75' part (fixed in next +release) but it will print the stuff. If you are after more +documentation on ASN.1, have a look at www.rsa.com and get their PKCS +documents, most of my initial work on SSLeay was done using them. + +As for SSLeay, +util/crypto.num and util/ssl.num are lists of all exported functions in +the library (but not macros :-(. + +The ones for extracting public keys from certificates and certificate +requests are EVP_PKEY * X509_REQ_extract_key(X509_REQ *req); +EVP_PKEY * X509_extract_key(X509 *x509); + +To verify a signature on a signed ASN.1 object +int X509_verify(X509 *a,EVP_PKEY *key); +int X509_REQ_verify(X509_REQ *a,EVP_PKEY *key); +int X509_CRL_verify(X509_CRL *a,EVP_PKEY *key); +int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a,EVP_PKEY *key); + +I should mention that EVP_PKEY can be used to hold a public or a private key, +since for things like RSA and DSS, a public key is just a subset of what +is stored for the private key. + +To sign any of the above structures + +int X509_sign(X509 *a,EVP_PKEY *key,EVP_MD *md); +int X509_REQ_sign(X509_REQ *a,EVP_PKEY *key,EVP_MD *md); +int X509_CRL_sign(X509_CRL *a,EVP_PKEY *key,EVP_MD *md); +int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *a,EVP_PKEY *key,EVP_MD *md); + +where md is the message digest to sign with. + +There are all defined in x509.h and all the _sign and _verify functions are +actually macros to the ASN1_sign() and ASN1_verify() functions. +These functions will put the correct algorithm identifiers in the correct +places in the structures. + +eric +-- +Eric Young | BOOL is tri-state according to Bill Gates. +AARNet: eay@mincom.oz.au | RTFM Win32 GetMessage(). + + diff --git a/src/lib/libssl/src/doc/apps.doc b/src/lib/libssl/src/doc/apps.doc new file mode 100644 index 0000000000..a2a4e0de72 --- /dev/null +++ b/src/lib/libssl/src/doc/apps.doc @@ -0,0 +1,53 @@ +The applications + +Ok, where to begin.... +In the begining, when SSLeay was small (April 1995), there +were but few applications, they did happily cohabit in +the one bin directory. Then over time, they did multiply and grow, +and they started to look like microsoft software; 500k to print 'hello world'. +A new approach was needed. They were coalessed into one 'Monolithic' +application, ssleay. This one program is composed of many programs that +can all be compiled independantly. + +ssleay has 3 modes of operation. +1) If the ssleay binaray has the name of one of its component programs, it +executes that program and then exits. This can be achieve by using hard or +symbolic links, or failing that, just renaming the binary. +2) If the first argument to ssleay is the name of one of the component +programs, that program runs that program and then exits. +3) If there are no arguments, ssleay enters a 'command' mode. Each line is +interpreted as a program name plus arguments. After each 'program' is run, +ssleay returns to the comand line. + +dgst - message digests +enc - encryption and base64 encoding + +ans1parse - 'pulls' appart ASN.1 encoded objects like certificates. + +dh - Diffle-Hellman parameter manipulation. +rsa - RSA manipulations. +crl - Certificate revokion list manipulations +x509 - X509 cert fiddles, including signing. +pkcs7 - pkcs7 manipulation, only DER versions right now. + +genrsa - generate an RSA private key. +gendh - Generate a set of Diffle-Hellman parameters. +req - Generate a PKCS#10 object, a certificate request. + +s_client - SSL client program +s_server - SSL server program +s_time - A SSL protocol timing program +s_mult - Another SSL server, but it multiplexes + connections. +s_filter - under development + +errstr - Convert SSLeay error numbers to strings. +ca - Sign certificate requests, and generate + certificate revokion lists +crl2pkcs7 - put a crl and certifcates into a pkcs7 object. +speed - Benchmark the ciphers. +verify - Check certificates +hashdir - under development + +[ there a now a few more options, play with the program to see what they + are ] diff --git a/src/lib/libssl/src/doc/asn1.doc b/src/lib/libssl/src/doc/asn1.doc new file mode 100644 index 0000000000..fdad17c05c --- /dev/null +++ b/src/lib/libssl/src/doc/asn1.doc @@ -0,0 +1,401 @@ +The ASN.1 Routines. + +ASN.1 is a specification for how to encode structured 'data' in binary form. +The approach I have take to the manipulation of structures and their encoding +into ASN.1 is as follows. + +For each distinct structure there are 4 function of the following form +TYPE *TYPE_new(void); +void TYPE_free(TYPE *); +TYPE *d2i_TYPE(TYPE **a,unsigned char **pp,long length); +long i2d_TYPE(TYPE *a,unsigned char **pp); /* CHECK RETURN VALUE */ + +where TYPE is the type of the 'object'. The TYPE that have these functions +can be in one of 2 forms, either the internal C malloc()ed data structure +or in the DER (a variant of ASN.1 encoding) binary encoding which is just +an array of unsigned bytes. The 'i2d' functions converts from the internal +form to the DER form and the 'd2i' functions convert from the DER form to +the internal form. + +The 'new' function returns a malloc()ed version of the structure with all +substructures either created or left as NULL pointers. For 'optional' +fields, they are normally left as NULL to indicate no value. For variable +size sub structures (often 'SET OF' or 'SEQUENCE OF' in ASN.1 syntax) the +STACK data type is used to hold the values. Have a read of stack.doc +and have a look at the relevant header files to see what I mean. If there +is an error while malloc()ing the structure, NULL is returned. + +The 'free' function will free() all the sub components of a particular +structure. If any of those sub components have been 'removed', replace +them with NULL pointers, the 'free' functions are tolerant of NULL fields. + +The 'd2i' function copies a binary representation into a C structure. It +operates as follows. 'a' is a pointer to a pointer to +the structure to populate, 'pp' is a pointer to a pointer to where the DER +byte string is located and 'length' is the length of the '*pp' data. +If there are no errors, a pointer to the populated structure is returned. +If there is an error, NULL is returned. Errors can occur because of +malloc() failures but normally they will be due to syntax errors in the DER +encoded data being parsed. It is also an error if there was an +attempt to read more that 'length' bytes from '*p'. If +everything works correctly, the value in '*p' is updated +to point at the location just beyond where the DER +structure was read from. In this way, chained calls to 'd2i' type +functions can be made, with the pointer into the 'data' array being +'walked' along the input byte array. +Depending on the value passed for 'a', different things will be done. If +'a' is NULL, a new structure will be malloc()ed and returned. If '*a' is +NULL, a new structure will be malloc()ed and put into '*a' and returned. +If '*a' is not NULL, the structure in '*a' will be populated, or in the +case of an error, free()ed and then returned. +Having these semantics means that a structure +can call a 'd2i' function to populate a field and if the field is currently +NULL, the structure will be created. + +The 'i2d' function type is used to copy a C structure to a byte array. +The parameter 'a' is the structure to convert and '*p' is where to put it. +As for the 'd2i' type structure, 'p' is updated to point after the last +byte written. If p is NULL, no data is written. The function also returns +the number of bytes written. Where this becomes useful is that if the +function is called with a NULL 'p' value, the length is returned. This can +then be used to malloc() an array of bytes and then the same function can +be recalled passing the malloced array to be written to. e.g. + +int len; +unsigned char *bytes,*p; +len=i2d_X509(x,NULL); /* get the size of the ASN1 encoding of 'x' */ +if ((bytes=(unsigned char *)malloc(len)) == NULL) + goto err; +p=bytes; +i2d_X509(x,&p); + +Please note that a new variable, 'p' was passed to i2d_X509. After the +call to i2d_X509 p has been incremented by len bytes. + +Now the reason for this functional organisation is that it allows nested +structures to be built up by calling these functions as required. There +are various macros used to help write the general 'i2d', 'd2i', 'new' and +'free' functions. They are discussed in another file and would only be +used by some-one wanting to add new structures to the library. As you +might be able to guess, the process of writing ASN.1 files can be a bit CPU +expensive for complex structures. I'm willing to live with this since the +simpler library code make my life easier and hopefully most programs using +these routines will have their execution profiles dominated by cipher or +message digest routines. +What follows is a list of 'TYPE' values and the corresponding ASN.1 +structure and where it is used. + +TYPE ASN.1 +ASN1_INTEGER INTEGER +ASN1_BIT_STRING BIT STRING +ASN1_OCTET_STRING OCTET STRING +ASN1_OBJECT OBJECT IDENTIFIER +ASN1_PRINTABLESTRING PrintableString +ASN1_T61STRING T61String +ASN1_IA5STRING IA5String +ASN1_UTCTIME UTCTime +ASN1_TYPE Any of the above mentioned types plus SEQUENCE and SET + +Most of the above mentioned types are actualled stored in the +ASN1_BIT_STRING type and macros are used to differentiate between them. +The 3 types used are + +typedef struct asn1_object_st + { + /* both null if a dynamic ASN1_OBJECT, one is + * defined if a 'static' ASN1_OBJECT */ + char *sn,*ln; + int nid; + int length; + unsigned char *data; + } ASN1_OBJECT; +This is used to store ASN1 OBJECTS. Read 'objects.doc' for details ono +routines to manipulate this structure. 'sn' and 'ln' are used to hold text +strings that represent the object (short name and long or lower case name). +These are used by the 'OBJ' library. 'nid' is a number used by the OBJ +library to uniquely identify objects. The ASN1 routines will populate the +'length' and 'data' fields which will contain the bit string representing +the object. + +typedef struct asn1_bit_string_st + { + int length; + int type; + unsigned char *data; + } ASN1_BIT_STRING; +This structure is used to hold all the other base ASN1 types except for +ASN1_UTCTIME (which is really just a 'char *'). Length is the number of +bytes held in data and type is the ASN1 type of the object (there is a list +in asn1.h). + +typedef struct asn1_type_st + { + int type; + union { + char *ptr; + ASN1_INTEGER * integer; + ASN1_BIT_STRING * bit_string; + ASN1_OCTET_STRING * octet_string; + ASN1_OBJECT * object; + ASN1_PRINTABLESTRING * printablestring; + ASN1_T61STRING * t61string; + ASN1_IA5STRING * ia5string; + ASN1_UTCTIME * utctime; + ASN1_BIT_STRING * set; + ASN1_BIT_STRING * sequence; + } value; + } ASN1_TYPE; +This structure is used in a few places when 'any' type of object can be +expected. + +X509 Certificate +X509_CINF CertificateInfo +X509_ALGOR AlgorithmIdentifier +X509_NAME Name +X509_NAME_ENTRY A single sub component of the name. +X509_VAL Validity +X509_PUBKEY SubjectPublicKeyInfo +The above mentioned types are declared in x509.h. They are all quite +straight forward except for the X509_NAME/X509_NAME_ENTRY pair. +A X509_NAME is a STACK (see stack.doc) of X509_NAME_ENTRY's. +typedef struct X509_name_entry_st + { + ASN1_OBJECT *object; + ASN1_BIT_STRING *value; + int set; + int size; /* temp variable */ + } X509_NAME_ENTRY; +The size is a temporary variable used by i2d_NAME and set is the set number +for the particular NAME_ENTRY. A X509_NAME is encoded as a sequence of +sequence of sets. Normally each set contains only a single item. +Sometimes it contains more. Normally throughout this library there will be +only one item per set. The set field contains the 'set' that this entry is +a member of. So if you have just created a X509_NAME structure and +populated it with X509_NAME_ENTRYs, you should then traverse the X509_NAME +(which is just a STACK) and set the 'set/' field to incrementing numbers. +For more details on why this is done, read the ASN.1 spec for Distinguished +Names. + +X509_REQ CertificateRequest +X509_REQ_INFO CertificateRequestInfo +These are used to hold certificate requests. + +X509_CRL CertificateRevocationList +These are used to hold a certificate revocation list + +RSAPrivateKey PrivateKeyInfo +RSAPublicKey PublicKeyInfo +Both these 'function groups' operate on 'RSA' structures (see rsa.doc). +The difference is that the RSAPublicKey operations only manipulate the m +and e fields in the RSA structure. + +DSAPrivateKey DSS private key +DSAPublicKey DSS public key +Both these 'function groups' operate on 'DSS' structures (see dsa.doc). +The difference is that the RSAPublicKey operations only manipulate the +XXX fields in the DSA structure. + +DHparams DHParameter +This is used to hold the p and g value for The Diffie-Hellman operation. +The function deal with the 'DH' strucure (see dh.doc). + +Now all of these function types can be used with several other functions to give +quite useful set of general manipulation routines. Normally one would +not uses these functions directly but use them via macros. + +char *ASN1_dup(int (*i2d)(),char *(*d2i)(),char *x); +'x' is the input structure case to a 'char *', 'i2d' is the 'i2d_TYPE' +function for the type that 'x' is and d2i is the 'd2i_TYPE' function for the +type that 'x' is. As is obvious from the parameters, this function +duplicates the strucutre by transforming it into the DER form and then +re-loading it into a new strucutre and returning the new strucutre. This +is obviously a bit cpu intensive but when faced with a complex dynamic +structure this is the simplest programming approach. There are macros for +duplicating the major data types but is simple to add extras. + +char *ASN1_d2i_fp(char *(*new)(),char *(*d2i)(),FILE *fp,unsigned char **x); +'x' is a pointer to a pointer of the 'desired type'. new and d2i are the +corresponding 'TYPE_new' and 'd2i_TYPE' functions for the type and 'fp' is +an open file pointer to read from. This function reads from 'fp' as much +data as it can and then uses 'd2i' to parse the bytes to load and return +the parsed strucutre in 'x' (if it was non-NULL) and to actually return the +strucutre. The behavior of 'x' is as per all the other d2i functions. + +char *ASN1_d2i_bio(char *(*new)(),char *(*d2i)(),BIO *fp,unsigned char **x); +The 'BIO' is the new IO type being used in SSLeay (see bio.doc). This +function is the same as ASN1_d2i_fp() except for the BIO argument. +ASN1_d2i_fp() actually calls this function. + +int ASN1_i2d_fp(int (*i2d)(),FILE *out,unsigned char *x); +'x' is converted to bytes by 'i2d' and then written to 'out'. ASN1_i2d_fp +and ASN1_d2i_fp are not really symetric since ASN1_i2d_fp will read all +available data from the file pointer before parsing a single item while +ASN1_i2d_fp can be used to write a sequence of data objects. To read a +series of objects from a file I would sugest loading the file into a buffer +and calling the relevent 'd2i' functions. + +char *ASN1_d2i_bio(char *(*new)(),char *(*d2i)(),BIO *fp,unsigned char **x); +This function is the same as ASN1_i2d_fp() except for the BIO argument. +ASN1_i2d_fp() actually calls this function. + +char * PEM_ASN1_read(char *(*d2i)(),char *name,FILE *fp,char **x,int (*cb)()); +This function will read the next PEM encoded (base64) object of the same +type as 'x' (loaded by the d2i function). 'name' is the name that is in +the '-----BEGIN name-----' that designates the start of that object type. +If the data is encrypted, 'cb' will be called to prompt for a password. If +it is NULL a default function will be used to prompt from the password. +'x' is delt with as per the standard 'd2i' function interface. This +function can be used to read a series of objects from a file. While any +data type can be encrypted (see PEM_ASN1_write) only RSA private keys tend +to be encrypted. + +char * PEM_ASN1_read_bio(char *(*d2i)(),char *name,BIO *fp, + char **x,int (*cb)()); +Same as PEM_ASN1_read() except using a BIO. This is called by +PEM_ASN1_read(). + +int PEM_ASN1_write(int (*i2d)(),char *name,FILE *fp,char *x,EVP_CIPHER *enc, + unsigned char *kstr,int klen,int (*callback)()); + +int PEM_ASN1_write_bio(int (*i2d)(),char *name,BIO *fp, + char *x,EVP_CIPHER *enc,unsigned char *kstr,int klen, + int (*callback)()); + +int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2, + ASN1_BIT_STRING *signature, char *data, RSA *rsa, EVP_MD *type); +int ASN1_verify(int (*i2d)(), X509_ALGOR *algor1, + ASN1_BIT_STRING *signature,char *data, RSA *rsa); + +int ASN1_BIT_STRING_cmp(ASN1_BIT_STRING *a, ASN1_BIT_STRING *b); +ASN1_BIT_STRING *ASN1_BIT_STRING_type_new(int type ); + +int ASN1_UTCTIME_check(ASN1_UTCTIME *a); +void ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a); +ASN1_UTCTIME *ASN1_UTCTIME_dup(ASN1_UTCTIME *a); + +ASN1_BIT_STRING *d2i_asn1_print_type(ASN1_BIT_STRING **a,unsigned char **pp, + long length,int type); + +int i2d_ASN1_SET(STACK *a, unsigned char **pp, + int (*func)(), int ex_tag, int ex_class); +STACK * d2i_ASN1_SET(STACK **a, unsigned char **pp, long length, + char *(*func)(), int ex_tag, int ex_class); + +int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *object); +int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); +int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size); + +int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); +long ASN1_INTEGER_get(ASN1_INTEGER *a); +ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai); +BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn); + +/* given a string, return the correct type. Max is the maximum number + * of bytes to parse. It stops parsing when 'max' bytes have been + * processed or a '\0' is hit */ +int ASN1_PRINTABLE_type(unsigned char *s,int max); + +void ASN1_parse(BIO *fp,unsigned char *pp,long len); + +int i2d_ASN1_bytes(ASN1_BIT_STRING *a, unsigned char **pp, int tag, int class); +ASN1_BIT_STRING *d2i_ASN1_bytes(ASN1_OCTET_STRING **a, unsigned char **pp, + long length, int Ptag, int Pclass); + +/* PARSING */ +int asn1_Finish(ASN1_CTX *c); + +/* SPECIALS */ +int ASN1_get_object(unsigned char **pp, long *plength, int *ptag, + int *pclass, long omax); +int ASN1_check_infinite_end(unsigned char **p,long len); +void ASN1_put_object(unsigned char **pp, int constructed, int length, + int tag, int class); +int ASN1_object_size(int constructed, int length, int tag); + +X509 * X509_get_cert(CERTIFICATE_CTX *ctx,X509_NAME * name,X509 *tmp_x509); +int X509_add_cert(CERTIFICATE_CTX *ctx,X509 *); + +char * X509_cert_verify_error_string(int n); +int X509_add_cert_file(CERTIFICATE_CTX *c,char *file, int type); +char * X509_gmtime (char *s, long adj); +int X509_add_cert_dir (CERTIFICATE_CTX *c,char *dir, int type); +int X509_load_verify_locations (CERTIFICATE_CTX *ctx, + char *file_env, char *dir_env); +int X509_set_default_verify_paths(CERTIFICATE_CTX *cts); +X509 * X509_new_D2i_X509(int len, unsigned char *p); +char * X509_get_default_cert_area(void ); +char * X509_get_default_cert_dir(void ); +char * X509_get_default_cert_file(void ); +char * X509_get_default_cert_dir_env(void ); +char * X509_get_default_cert_file_env(void ); +char * X509_get_default_private_dir(void ); +X509_REQ *X509_X509_TO_req(X509 *x, RSA *rsa); +int X509_cert_verify(CERTIFICATE_CTX *ctx,X509 *xs, int (*cb)()); + +CERTIFICATE_CTX *CERTIFICATE_CTX_new(); +void CERTIFICATE_CTX_free(CERTIFICATE_CTX *c); + +void X509_NAME_print(BIO *fp, X509_NAME *name, int obase); +int X509_print_fp(FILE *fp,X509 *x); +int X509_print(BIO *fp,X509 *x); + +X509_INFO * X509_INFO_new(void); +void X509_INFO_free(X509_INFO *a); + +char * X509_NAME_oneline(X509_NAME *a); + +#define X509_verify(x,rsa) +#define X509_REQ_verify(x,rsa) +#define X509_CRL_verify(x,rsa) + +#define X509_sign(x,rsa,md) +#define X509_REQ_sign(x,rsa,md) +#define X509_CRL_sign(x,rsa,md) + +#define X509_dup(x509) +#define d2i_X509_fp(fp,x509) +#define i2d_X509_fp(fp,x509) +#define d2i_X509_bio(bp,x509) +#define i2d_X509_bio(bp,x509) + +#define X509_CRL_dup(crl) +#define d2i_X509_CRL_fp(fp,crl) +#define i2d_X509_CRL_fp(fp,crl) +#define d2i_X509_CRL_bio(bp,crl) +#define i2d_X509_CRL_bio(bp,crl) + +#define X509_REQ_dup(req) +#define d2i_X509_REQ_fp(fp,req) +#define i2d_X509_REQ_fp(fp,req) +#define d2i_X509_REQ_bio(bp,req) +#define i2d_X509_REQ_bio(bp,req) + +#define RSAPrivateKey_dup(rsa) +#define d2i_RSAPrivateKey_fp(fp,rsa) +#define i2d_RSAPrivateKey_fp(fp,rsa) +#define d2i_RSAPrivateKey_bio(bp,rsa) +#define i2d_RSAPrivateKey_bio(bp,rsa) + +#define X509_NAME_dup(xn) +#define X509_NAME_ENTRY_dup(ne) + +void X509_REQ_print_fp(FILE *fp,X509_REQ *req); +void X509_REQ_print(BIO *fp,X509_REQ *req); + +RSA *X509_REQ_extract_key(X509_REQ *req); +RSA *X509_extract_key(X509 *x509); + +int X509_issuer_and_serial_cmp(X509 *a, X509 *b); +unsigned long X509_issuer_and_serial_hash(X509 *a); + +X509_NAME * X509_get_issuer_name(X509 *a); +int X509_issuer_name_cmp(X509 *a, X509 *b); +unsigned long X509_issuer_name_hash(X509 *a); + +X509_NAME * X509_get_subject_name(X509 *a); +int X509_subject_name_cmp(X509 *a,X509 *b); +unsigned long X509_subject_name_hash(X509 *x); + +int X509_NAME_cmp (X509_NAME *a, X509_NAME *b); +unsigned long X509_NAME_hash(X509_NAME *x); + diff --git a/src/lib/libssl/src/doc/bio.doc b/src/lib/libssl/src/doc/bio.doc new file mode 100644 index 0000000000..545a57cdff --- /dev/null +++ b/src/lib/libssl/src/doc/bio.doc @@ -0,0 +1,423 @@ +BIO Routines + +This documentation is rather sparse, you are probably best +off looking at the code for specific details. + +The BIO library is a IO abstraction that was originally +inspired by the need to have callbacks to perform IO to FILE +pointers when using Windows 3.1 DLLs. There are two types +of BIO; a source/sink type and a filter type. +The source/sink methods are as follows: +- BIO_s_mem() memory buffer - a read/write byte array that + grows until memory runs out :-). +- BIO_s_file() FILE pointer - A wrapper around the normal + 'FILE *' commands, good for use with stdin/stdout. +- BIO_s_fd() File descriptor - A wrapper around file + descriptors, often used with pipes. +- BIO_s_socket() Socket - Used around sockets. It is + mostly in the Microsoft world that sockets are different + from file descriptors and there are all those ugly winsock + commands. +- BIO_s_null() Null - read nothing and write nothing.; a + useful endpoint for filter type BIO's specifically things + like the message digest BIO. + +The filter types are +- BIO_f_buffer() IO buffering - does output buffering into + larger chunks and performs input buffering to allow gets() + type functions. +- BIO_f_md() Message digest - a transparent filter that can + be asked to return a message digest for the data that has + passed through it. +- BIO_f_cipher() Encrypt or decrypt all data passing + through the filter. +- BIO_f_base64() Base64 decode on read and encode on write. +- BIO_f_ssl() A filter that performs SSL encryption on the + data sent through it. + +Base BIO functions. +The BIO library has a set of base functions that are +implemented for each particular type. Filter BIOs will +normally call the equivalent function on the source/sink BIO +that they are layered on top of after they have performed +some modification to the data stream. Multiple filter BIOs +can be 'push' into a stack of modifers, so to read from a +file, unbase64 it, then decrypt it, a BIO_f_cipher, +BIO_f_base64 and a BIO_s_file would probably be used. If a +sha-1 and md5 message digest needed to be generated, a stack +two BIO_f_md() BIOs and a BIO_s_null() BIO could be used. +The base functions are +- BIO *BIO_new(BIO_METHOD *type); Create a new BIO of type 'type'. +- int BIO_free(BIO *a); Free a BIO structure. Depending on + the configuration, this will free the underlying data + object for a source/sink BIO. +- int BIO_read(BIO *b, char *data, int len); Read upto 'len' + bytes into 'data'. +- int BIO_gets(BIO *bp,char *buf, int size); Depending on + the BIO, this can either be a 'get special' or a get one + line of data, as per fgets(); +- int BIO_write(BIO *b, char *data, int len); Write 'len' + bytes from 'data' to the 'b' BIO. +- int BIO_puts(BIO *bp,char *buf); Either a 'put special' or + a write null terminated string as per fputs(). +- long BIO_ctrl(BIO *bp,int cmd,long larg,char *parg); A + control function which is used to manipulate the BIO + structure and modify it's state and or report on it. This + function is just about never used directly, rather it + should be used in conjunction with BIO_METHOD specific + macros. +- BIO *BIO_push(BIO *new_top, BIO *old); new_top is apped to the + top of the 'old' BIO list. new_top should be a filter BIO. + All writes will go through 'new_top' first and last on read. + 'old' is returned. +- BIO *BIO_pop(BIO *bio); the new topmost BIO is returned, NULL if + there are no more. + +If a particular low level BIO method is not supported +(normally BIO_gets()), -2 will be returned if that method is +called. Otherwise the IO methods (read, write, gets, puts) +will return the number of bytes read or written, and 0 or -1 +for error (or end of input). For the -1 case, +BIO_should_retry(bio) can be called to determine if it was a +genuine error or a temporary problem. -2 will also be +returned if the BIO has not been initalised yet, in all +cases, the correct error codes are set (accessible via the +ERR library). + + +The following functions are convenience functions: +- int BIO_printf(BIO *bio, char * format, ..); printf but + to a BIO handle. +- long BIO_ctrl_int(BIO *bp,int cmd,long larg,int iarg); a + convenience function to allow a different argument types + to be passed to BIO_ctrl(). +- int BIO_dump(BIO *b,char *bytes,int len); output 'len' + bytes from 'bytes' in a hex dump debug format. +- long BIO_debug_callback(BIO *bio, int cmd, char *argp, int + argi, long argl, long ret) - a default debug BIO callback, + this is mentioned below. To use this one normally has to + use the BIO_set_callback_arg() function to assign an + output BIO for the callback to use. +- BIO *BIO_find_type(BIO *bio,int type); when there is a 'stack' + of BIOs, this function scan the list and returns the first + that is of type 'type', as listed in buffer.h under BIO_TYPE_XXX. +- void BIO_free_all(BIO *bio); Free the bio and all other BIOs + in the list. It walks the bio->next_bio list. + + + +Extra commands are normally implemented as macros calling BIO_ctrl(). +- BIO_number_read(BIO *bio) - the number of bytes processed + by BIO_read(bio,.). +- BIO_number_written(BIO *bio) - the number of bytes written + by BIO_write(bio,.). +- BIO_reset(BIO *bio) - 'reset' the BIO. +- BIO_eof(BIO *bio) - non zero if we are at the current end + of input. +- BIO_set_close(BIO *bio, int close_flag) - set the close flag. +- BIO_get_close(BIO *bio) - return the close flag. + BIO_pending(BIO *bio) - return the number of bytes waiting + to be read (normally buffered internally). +- BIO_flush(BIO *bio) - output any data waiting to be output. +- BIO_should_retry(BIO *io) - after a BIO_read/BIO_write + operation returns 0 or -1, a call to this function will + return non zero if you should retry the call later (this + is for non-blocking IO). +- BIO_should_read(BIO *io) - we should retry when data can + be read. +- BIO_should_write(BIO *io) - we should retry when data can + be written. +- BIO_method_name(BIO *io) - return a string for the method name. +- BIO_method_type(BIO *io) - return the unique ID of the BIO method. +- BIO_set_callback(BIO *io, long (*callback)(BIO *io, int + cmd, char *argp, int argi, long argl, long ret); - sets + the debug callback. +- BIO_get_callback(BIO *io) - return the assigned function + as mentioned above. +- BIO_set_callback_arg(BIO *io, char *arg) - assign some + data against the BIO. This is normally used by the debug + callback but could in reality be used for anything. To + get an idea of how all this works, have a look at the code + in the default debug callback mentioned above. The + callback can modify the return values. + +Details of the BIO_METHOD structure. +typedef struct bio_method_st + { + int type; + char *name; + int (*bwrite)(); + int (*bread)(); + int (*bputs)(); + int (*bgets)(); + long (*ctrl)(); + int (*create)(); + int (*destroy)(); + } BIO_METHOD; + +The 'type' is the numeric type of the BIO, these are listed in buffer.h; +'Name' is a textual representation of the BIO 'type'. +The 7 function pointers point to the respective function +methods, some of which can be NULL if not implemented. +The BIO structure +typedef struct bio_st + { + BIO_METHOD *method; + long (*callback)(BIO * bio, int mode, char *argp, int + argi, long argl, long ret); + char *cb_arg; /* first argument for the callback */ + int init; + int shutdown; + int flags; /* extra storage */ + int num; + char *ptr; + struct bio_st *next_bio; /* used by filter BIOs */ + int references; + unsigned long num_read; + unsigned long num_write; + } BIO; + +- 'Method' is the BIO method. +- 'callback', when configured, is called before and after + each BIO method is called for that particular BIO. This + is intended primarily for debugging and of informational feedback. +- 'init' is 0 when the BIO can be used for operation. + Often, after a BIO is created, a number of operations may + need to be performed before it is available for use. An + example is for BIO_s_sock(). A socket needs to be + assigned to the BIO before it can be used. +- 'shutdown', this flag indicates if the underlying + comunication primative being used should be closed/freed + when the BIO is closed. +- 'flags' is used to hold extra state. It is primarily used + to hold information about why a non-blocking operation + failed and to record startup protocol information for the + SSL BIO. +- 'num' and 'ptr' are used to hold instance specific state + like file descriptors or local data structures. +- 'next_bio' is used by filter BIOs to hold the pointer of the + next BIO in the chain. written data is sent to this BIO and + data read is taken from it. +- 'references' is used to indicate the number of pointers to + this structure. This needs to be '1' before a call to + BIO_free() is made if the BIO_free() function is to + actually free() the structure, otherwise the reference + count is just decreased. The actual BIO subsystem does + not really use this functionality but it is useful when + used in more advanced applicaion. +- num_read and num_write are the total number of bytes + read/written via the 'read()' and 'write()' methods. + +BIO_ctrl operations. +The following is the list of standard commands passed as the +second parameter to BIO_ctrl() and should be supported by +all BIO as best as possible. Some are optional, some are +manditory, in any case, where is makes sense, a filter BIO +should pass such requests to underlying BIO's. +- BIO_CTRL_RESET - Reset the BIO back to an initial state. +- BIO_CTRL_EOF - return 0 if we are not at the end of input, + non 0 if we are. +- BIO_CTRL_INFO - BIO specific special command, normal + information return. +- BIO_CTRL_SET - set IO specific parameter. +- BIO_CTRL_GET - get IO specific parameter. +- BIO_CTRL_GET_CLOSE - Get the close on BIO_free() flag, one + of BIO_CLOSE or BIO_NOCLOSE. +- BIO_CTRL_SET_CLOSE - Set the close on BIO_free() flag. +- BIO_CTRL_PENDING - Return the number of bytes available + for instant reading +- BIO_CTRL_FLUSH - Output pending data, return number of bytes output. +- BIO_CTRL_SHOULD_RETRY - After an IO error (-1 returned) + should we 'retry' when IO is possible on the underlying IO object. +- BIO_CTRL_RETRY_TYPE - What kind of IO are we waiting on. + +The following command is a special BIO_s_file() specific option. +- BIO_CTRL_SET_FILENAME - specify a file to open for IO. + +The BIO_CTRL_RETRY_TYPE needs a little more explanation. +When performing non-blocking IO, or say reading on a memory +BIO, when no data is present (or cannot be written), +BIO_read() and/or BIO_write() will return -1. +BIO_should_retry(bio) will return true if this is due to an +IO condition rather than an actual error. In the case of +BIO_s_mem(), a read when there is no data will return -1 and +a should retry when there is more 'read' data. +The retry type is deduced from 2 macros +BIO_should_read(bio) and BIO_should_write(bio). +Now while it may appear obvious that a BIO_read() failure +should indicate that a retry should be performed when more +read data is available, this is often not true when using +things like an SSL BIO. During the SSL protocol startup +multiple reads and writes are performed, triggered by any +SSL_read or SSL_write. +So to write code that will transparently handle either a +socket or SSL BIO, + i=BIO_read(bio,..) + if (I == -1) + { + if (BIO_should_retry(bio)) + { + if (BIO_should_read(bio)) + { + /* call us again when BIO can be read */ + } + if (BIO_should_write(bio)) + { + /* call us again when BIO can be written */ + } + } + } + +At this point in time only read and write conditions can be +used but in the future I can see the situation for other +conditions, specifically with SSL there could be a condition +of a X509 certificate lookup taking place and so the non- +blocking BIO_read would require a retry when the certificate +lookup subsystem has finished it's lookup. This is all +makes more sense and is easy to use in a event loop type +setup. +When using the SSL BIO, either SSL_read() or SSL_write()s +can be called during the protocol startup and things will +still work correctly. +The nice aspect of the use of the BIO_should_retry() macro +is that all the errno codes that indicate a non-fatal error +are encapsulated in one place. The Windows specific error +codes and WSAGetLastError() calls are also hidden from the +application. + +Notes on each BIO method. +Normally buffer.h is just required but depending on the +BIO_METHOD, ssl.h or evp.h will also be required. + +BIO_METHOD *BIO_s_mem(void); +- BIO_set_mem_buf(BIO *bio, BUF_MEM *bm, int close_flag) - + set the underlying BUF_MEM structure for the BIO to use. +- BIO_get_mem_ptr(BIO *bio, char **pp) - if pp is not NULL, + set it to point to the memory array and return the number + of bytes available. +A read/write BIO. Any data written is appended to the +memory array and any read is read from the front. This BIO +can be used for read/write at the same time. BIO_gets() is +supported in the fgets() sense. +BIO_CTRL_INFO can be used to retrieve pointers to the memory +buffer and it's length. + +BIO_METHOD *BIO_s_file(void); +- BIO_set_fp(BIO *bio, FILE *fp, int close_flag) - set 'FILE *' to use. +- BIO_get_fp(BIO *bio, FILE **fp) - get the 'FILE *' in use. +- BIO_read_filename(BIO *bio, char *name) - read from file. +- BIO_write_filename(BIO *bio, char *name) - write to file. +- BIO_append_filename(BIO *bio, char *name) - append to file. +This BIO sits over the normal system fread()/fgets() type +functions. Gets() is supported. This BIO in theory could be +used for read and write but it is best to think of each BIO +of this type as either a read or a write BIO, not both. + +BIO_METHOD *BIO_s_socket(void); +BIO_METHOD *BIO_s_fd(void); +- BIO_sock_should_retry(int i) - the underlying function + used to determine if a call should be retried; the + argument is the '0' or '-1' returned by the previous BIO + operation. +- BIO_fd_should_retry(int i) - same as the +- BIO_sock_should_retry() except that it is different internally. +- BIO_set_fd(BIO *bio, int fd, int close_flag) - set the + file descriptor to use +- BIO_get_fd(BIO *bio, int *fd) - get the file descriptor. +These two methods are very similar. Gets() is not +supported, if you want this functionality, put a +BIO_f_buffer() onto it. This BIO is bi-directional if the +underlying file descriptor is. This is normally the case +for sockets but not the case for stdio descriptors. + +BIO_METHOD *BIO_s_null(void); +Read and write as much data as you like, it all disappears +into this BIO. + +BIO_METHOD *BIO_f_buffer(void); +- BIO_get_buffer_num_lines(BIO *bio) - return the number of + complete lines in the buffer. +- BIO_set_buffer_size(BIO *bio, long size) - set the size of + the buffers. +This type performs input and output buffering. It performs +both at the same time. The size of the buffer can be set +via the set buffer size option. Data buffered for output is +only written when the buffer fills. + +BIO_METHOD *BIO_f_ssl(void); +- BIO_set_ssl(BIO *bio, SSL *ssl, int close_flag) - the SSL + structure to use. +- BIO_get_ssl(BIO *bio, SSL **ssl) - get the SSL structure + in use. +The SSL bio is a little different from normal BIOs because +the underlying SSL structure is a little different. A SSL +structure performs IO via a read and write BIO. These can +be different and are normally set via the +SSL_set_rbio()/SSL_set_wbio() calls. The SSL_set_fd() calls +are just wrappers that create socket BIOs and then call +SSL_set_bio() where the read and write BIOs are the same. +The BIO_push() operation makes the SSLs IO BIOs the same, so +make sure the BIO pushed is capable of two directional +traffic. If it is not, you will have to install the BIOs +via the more conventional SSL_set_bio() call. BIO_pop() will retrieve +the 'SSL read' BIO. + +BIO_METHOD *BIO_f_md(void); +- BIO_set_md(BIO *bio, EVP_MD *md) - set the message digest + to use. +- BIO_get_md(BIO *bio, EVP_MD **mdp) - return the digest + method in use in mdp, return 0 if not set yet. +- BIO_reset() reinitializes the digest (EVP_DigestInit()) + and passes the reset to the underlying BIOs. +All data read or written via BIO_read() or BIO_write() to +this BIO will be added to the calculated digest. This +implies that this BIO is only one directional. If read and +write operations are performed, two separate BIO_f_md() BIOs +are reuqired to generate digests on both the input and the +output. BIO_gets(BIO *bio, char *md, int size) will place the +generated digest into 'md' and return the number of bytes. +The EVP_MAX_MD_SIZE should probably be used to size the 'md' +array. Reading the digest will also reset it. + +BIO_METHOD *BIO_f_cipher(void); +- BIO_reset() reinitializes the cipher. +- BIO_flush() should be called when the last bytes have been + output to flush the final block of block ciphers. +- BIO_get_cipher_status(BIO *b), when called after the last + read from a cipher BIO, returns non-zero if the data + decrypted correctly, otherwise, 0. +- BIO_set_cipher(BIO *b, EVP_CIPHER *c, unsigned char *key, + unsigned char *iv, int encrypt) This function is used to + setup a cipher BIO. The length of key and iv are + specified by the choice of EVP_CIPHER. Encrypt is 1 to + encrypt and 0 to decrypt. + +BIO_METHOD *BIO_f_base64(void); +- BIO_flush() should be called when the last bytes have been output. +This BIO base64 encodes when writing and base64 decodes when +reading. It will scan the input until a suitable begin line +is found. After reading data, BIO_reset() will reset the +BIO to start scanning again. Do not mix reading and writing +on the same base64 BIO. It is meant as a single stream BIO. + +Directions type +both BIO_s_mem() +one/both BIO_s_file() +both BIO_s_fd() +both BIO_s_socket() +both BIO_s_null() +both BIO_f_buffer() +one BIO_f_md() +one BIO_f_cipher() +one BIO_f_base64() +both BIO_f_ssl() + +It is easy to mix one and two directional BIOs, all one has +to do is to keep two separate BIO pointers for reading and +writing and be careful about usage of underlying BIOs. The +SSL bio by it's very nature has to be two directional but +the BIO_push() command will push the one BIO into the SSL +BIO for both reading and writing. + +The best example program to look at is apps/enc.c and/or perhaps apps/dgst.c. + diff --git a/src/lib/libssl/src/doc/blowfish.doc b/src/lib/libssl/src/doc/blowfish.doc new file mode 100644 index 0000000000..8a7f425b32 --- /dev/null +++ b/src/lib/libssl/src/doc/blowfish.doc @@ -0,0 +1,146 @@ +The Blowfish library. + +Blowfish is a block cipher that operates on 64bit (8 byte) quantities. It +uses variable size key, but 128bit (16 byte) key would normally be considered +good. It can be used in all the modes that DES can be used. This +library implements the ecb, cbc, cfb64, ofb64 modes. + +Blowfish is quite a bit faster that DES, and much faster than IDEA or +RC2. It is one of the faster block ciphers. + +For all calls that have an 'input' and 'output' variables, they can be the +same. + +This library requires the inclusion of 'blowfish.h'. + +All of the encryption functions take what is called an BF_KEY as an +argument. An BF_KEY is an expanded form of the Blowfish key. +For all modes of the Blowfish algorithm, the BF_KEY used for +decryption is the same one that was used for encryption. + +The define BF_ENCRYPT is passed to specify encryption for the functions +that require an encryption/decryption flag. BF_DECRYPT is passed to +specify decryption. + +Please note that any of the encryption modes specified in my DES library +could be used with Blowfish. I have only implemented ecb, cbc, cfb64 and +ofb64 for the following reasons. +- ecb is the basic Blowfish encryption. +- cbc is the normal 'chaining' form for block ciphers. +- cfb64 can be used to encrypt single characters, therefore input and output + do not need to be a multiple of 8. +- ofb64 is similar to cfb64 but is more like a stream cipher, not as + secure (not cipher feedback) but it does not have an encrypt/decrypt mode. +- If you want triple Blowfish, thats 384 bits of key and you must be totally + obsessed with security. Still, if you want it, it is simple enough to + copy the function from the DES library and change the des_encrypt to + BF_encrypt; an exercise left for the paranoid reader :-). + +The functions are as follows: + +void BF_set_key( +BF_KEY *ks; +int len; +unsigned char *key; + BF_set_key converts an 'len' byte key into a BF_KEY. + A 'ks' is an expanded form of the 'key' which is used to + perform actual encryption. It can be regenerated from the Blowfish key + so it only needs to be kept when encryption or decryption is about + to occur. Don't save or pass around BF_KEY's since they + are CPU architecture dependent, 'key's are not. Blowfish is an + interesting cipher in that it can be used with a variable length + key. 'len' is the length of 'key' to be used as the key. + A 'len' of 16 is recomended by me, but blowfish can use upto + 72 bytes. As a warning, blowfish has a very very slow set_key + function, it actually runs BF_encrypt 521 times. + +void BF_encrypt(unsigned long *data, BF_KEY *key); +void BF_decrypt(unsigned long *data, BF_KEY *key); + These are the Blowfish encryption function that gets called by just + about every other Blowfish routine in the library. You should not + use this function except to implement 'modes' of Blowfish. + I say this because the + functions that call this routine do the conversion from 'char *' to + long, and this needs to be done to make sure 'non-aligned' memory + access do not occur. + Data is a pointer to 2 unsigned long's and key is the + BF_KEY to use. + +void BF_ecb_encrypt( +unsigned char *in, +unsigned char *out, +BF_KEY *key, +int encrypt); + This is the basic Electronic Code Book form of Blowfish (in DES this + mode is called Electronic Code Book so I'm going to use the term + for blowfish as well. + Input is encrypted into output using the key represented by + key. Depending on the encrypt, encryption or + decryption occurs. Input is 8 bytes long and output is 8 bytes. + +void BF_cbc_encrypt( +unsigned char *in, +unsigned char *out, +long length, +BF_KEY *ks, +unsigned char *ivec, +int encrypt); + This routine implements Blowfish in Cipher Block Chaining mode. + Input, which should be a multiple of 8 bytes is encrypted + (or decrypted) to output which will also be a multiple of 8 bytes. + The number of bytes is in length (and from what I've said above, + should be a multiple of 8). If length is not a multiple of 8, bad + things will probably happen. ivec is the initialisation vector. + This function updates iv after each call so that it can be passed to + the next call to BF_cbc_encrypt(). + +void BF_cfb64_encrypt( +unsigned char *in, +unsigned char *out, +long length, +BF_KEY *schedule, +unsigned char *ivec, +int *num, +int encrypt); + This is one of the more useful functions in this Blowfish library, it + implements CFB mode of Blowfish with 64bit feedback. + This allows you to encrypt an arbitrary number of bytes, + you do not require 8 byte padding. Each call to this + routine will encrypt the input bytes to output and then update ivec + and num. Num contains 'how far' we are though ivec. + 'Encrypt' is used to indicate encryption or decryption. + CFB64 mode operates by using the cipher to generate a stream + of bytes which is used to encrypt the plain text. + The cipher text is then encrypted to generate the next 64 bits to + be xored (incrementally) with the next 64 bits of plain + text. As can be seen from this, to encrypt or decrypt, + the same 'cipher stream' needs to be generated but the way the next + block of data is gathered for encryption is different for + encryption and decryption. + +void BF_ofb64_encrypt( +unsigned char *in, +unsigned char *out, +long length, +BF_KEY *schedule, +unsigned char *ivec, +int *num); + This functions implements OFB mode of Blowfish with 64bit feedback. + This allows you to encrypt an arbitrary number of bytes, + you do not require 8 byte padding. Each call to this + routine will encrypt the input bytes to output and then update ivec + and num. Num contains 'how far' we are though ivec. + This is in effect a stream cipher, there is no encryption or + decryption mode. + +For reading passwords, I suggest using des_read_pw_string() from my DES library. +To generate a password from a text string, I suggest using MD5 (or MD2) to +produce a 16 byte message digest that can then be passed directly to +BF_set_key(). + +===== +For more information about the specific Blowfish modes in this library +(ecb, cbc, cfb and ofb), read the section entitled 'Modes of DES' from the +documentation on my DES library. What is said about DES is directly +applicable for Blowfish. + diff --git a/src/lib/libssl/src/doc/bn.doc b/src/lib/libssl/src/doc/bn.doc new file mode 100644 index 0000000000..47be23b6ea --- /dev/null +++ b/src/lib/libssl/src/doc/bn.doc @@ -0,0 +1,381 @@ +The Big Number library. + +#include "bn.h" when using this library. + +This big number library was written for use in implementing the RSA and DH +public key encryption algorithms. As such, features such as negative +numbers have not been extensively tested but they should work as expected. +This library uses dynamic memory allocation for storing its data structures +and so there are no limit on the size of the numbers manipulated by these +routines but there is always the requirement to check return codes from +functions just in case a memory allocation error has occurred. + +The basic object in this library is a BIGNUM. It is used to hold a single +large integer. This type should be considered opaque and fields should not +be modified or accessed directly. +typedef struct bignum_st + { + int top; /* Index of last used d. */ + BN_ULONG *d; /* Pointer to an array of 'BITS2' bit chunks. */ + int max; /* Size of the d array. */ + int neg; + } BIGNUM; +The big number is stored in a malloced array of BN_ULONG's. A BN_ULONG can +be either 16, 32 or 64 bits in size, depending on the 'number of bits' +specified in bn.h. +The 'd' field is this array. 'max' is the size of the 'd' array that has +been allocated. 'top' is the 'last' entry being used, so for a value of 4, +bn.d[0]=4 and bn.top=1. 'neg' is 1 if the number is negative. +When a BIGNUM is '0', the 'd' field can be NULL and top == 0. + +Various routines in this library require the use of 'temporary' BIGNUM +variables during their execution. Due to the use of dynamic memory +allocation to create BIGNUMs being rather expensive when used in +conjunction with repeated subroutine calls, the BN_CTX structure is +used. This structure contains BN_CTX BIGNUMs. BN_CTX +is the maximum number of temporary BIGNUMs any publicly exported +function will use. + +#define BN_CTX 12 +typedef struct bignum_ctx + { + int tos; /* top of stack */ + BIGNUM *bn[BN_CTX]; /* The variables */ + } BN_CTX; + +The functions that follow have been grouped according to function. Most +arithmetic functions return a result in the first argument, sometimes this +first argument can also be an input parameter, sometimes it cannot. These +restrictions are documented. + +extern BIGNUM *BN_value_one; +There is one variable defined by this library, a BIGNUM which contains the +number 1. This variable is useful for use in comparisons and assignment. + +Get Size functions. + +int BN_num_bits(BIGNUM *a); + This function returns the size of 'a' in bits. + +int BN_num_bytes(BIGNUM *a); + This function (macro) returns the size of 'a' in bytes. + For conversion of BIGNUMs to byte streams, this is the number of + bytes the output string will occupy. If the output byte + format specifies that the 'top' bit indicates if the number is + signed, so an extra '0' byte is required if the top bit on a + positive number is being written, it is upto the application to + make this adjustment. Like I said at the start, I don't + really support negative numbers :-). + +Creation/Destruction routines. + +BIGNUM *BN_new(); + Return a new BIGNUM object. The number initially has a value of 0. If + there is an error, NULL is returned. + +void BN_free(BIGNUM *a); + Free()s a BIGNUM. + +void BN_clear(BIGNUM *a); + Sets 'a' to a value of 0 and also zeros all unused allocated + memory. This function is used to clear a variable of 'sensitive' + data that was held in it. + +void BN_clear_free(BIGNUM *a); + This function zeros the memory used by 'a' and then free()'s it. + This function should be used to BN_free() BIGNUMS that have held + sensitive numeric values like RSA private key values. Both this + function and BN_clear tend to only be used by RSA and DH routines. + +BN_CTX *BN_CTX_new(void); + Returns a new BN_CTX. NULL on error. + +void BN_CTX_free(BN_CTX *c); + Free a BN_CTX structure. The BIGNUMs in 'c' are BN_clear_free()ed. + +BIGNUM *bn_expand(BIGNUM *b, int bits); + This is an internal function that should not normally be used. It + ensures that 'b' has enough room for a 'bits' bit number. It is + mostly used by the various BIGNUM routines. If there is an error, + NULL is returned. if not, 'b' is returned. + +BIGNUM *BN_copy(BIGNUM *to, BIGNUM *from); + The 'from' is copied into 'to'. NULL is returned if there is an + error, otherwise 'to' is returned. + +BIGNUM *BN_dup(BIGNUM *a); + A new BIGNUM is created and returned containing the value of 'a'. + NULL is returned on error. + +Comparison and Test Functions. + +int BN_is_zero(BIGNUM *a) + Return 1 if 'a' is zero, else 0. + +int BN_is_one(a) + Return 1 is 'a' is one, else 0. + +int BN_is_word(a,w) + Return 1 if 'a' == w, else 0. 'w' is a BN_ULONG. + +int BN_cmp(BIGNUM *a, BIGNUM *b); + Return -1 if 'a' is less than 'b', 0 if 'a' and 'b' are the same + and 1 is 'a' is greater than 'b'. This is a signed comparison. + +int BN_ucmp(BIGNUM *a, BIGNUM *b); + This function is the same as BN_cmp except that the comparison + ignores the sign of the numbers. + +Arithmetic Functions +For all of these functions, 0 is returned if there is an error and 1 is +returned for success. The return value should always be checked. eg. +if (!BN_add(r,a,b)) goto err; +Unless explicitly mentioned, the 'return' value can be one of the +'parameters' to the function. + +int BN_add(BIGNUM *r, BIGNUM *a, BIGNUM *b); + Add 'a' and 'b' and return the result in 'r'. This is r=a+b. + +int BN_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b); + Subtract 'a' from 'b' and put the result in 'r'. This is r=a-b. + +int BN_lshift(BIGNUM *r, BIGNUM *a, int n); + Shift 'a' left by 'n' bits. This is r=a*(2^n). + +int BN_lshift1(BIGNUM *r, BIGNUM *a); + Shift 'a' left by 1 bit. This form is more efficient than + BN_lshift(r,a,1). This is r=a*2. + +int BN_rshift(BIGNUM *r, BIGNUM *a, int n); + Shift 'a' right by 'n' bits. This is r=int(a/(2^n)). + +int BN_rshift1(BIGNUM *r, BIGNUM *a); + Shift 'a' right by 1 bit. This form is more efficient than + BN_rshift(r,a,1). This is r=int(a/2). + +int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b); + Multiply a by b and return the result in 'r'. 'r' must not be + either 'a' or 'b'. It has to be a different BIGNUM. + This is r=a*b. + +int BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx); + Multiply a by a and return the result in 'r'. 'r' must not be + 'a'. This function is alot faster than BN_mul(r,a,a). This is r=a*a. + +int BN_div(BIGNUM *dv, BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx); + Divide 'm' by 'd' and return the result in 'dv' and the remainder + in 'rem'. Either of 'dv' or 'rem' can be NULL in which case that + value is not returned. 'ctx' needs to be passed as a source of + temporary BIGNUM variables. + This is dv=int(m/d), rem=m%d. + +int BN_mod(BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx); + Find the remainder of 'm' divided by 'd' and return it in 'rem'. + 'ctx' holds the temporary BIGNUMs required by this function. + This function is more efficient than BN_div(NULL,rem,m,d,ctx); + This is rem=m%d. + +int BN_mod_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BIGNUM *m,BN_CTX *ctx); + Multiply 'a' by 'b' and return the remainder when divided by 'm'. + 'ctx' holds the temporary BIGNUMs required by this function. + This is r=(a*b)%m. + +int BN_mod_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,BN_CTX *ctx); + Raise 'a' to the 'p' power and return the remainder when divided by + 'm'. 'ctx' holds the temporary BIGNUMs required by this function. + This is r=(a^p)%m. + +int BN_reciprocal(BIGNUM *r, BIGNUM *m, BN_CTX *ctx); + Return the reciprocal of 'm'. 'ctx' holds the temporary variables + required. This function returns -1 on error, otherwise it returns + the number of bits 'r' is shifted left to make 'r' into an integer. + This number of bits shifted is required in BN_mod_mul_reciprocal(). + This is r=(1/m)<<(BN_num_bits(m)+1). + +int BN_mod_mul_reciprocal(BIGNUM *r, BIGNUM *x, BIGNUM *y, BIGNUM *m, + BIGNUM *i, int nb, BN_CTX *ctx); + This function is used to perform an efficient BN_mod_mul() + operation. If one is going to repeatedly perform BN_mod_mul() with + the same modulus is worth calculating the reciprocal of the modulus + and then using this function. This operation uses the fact that + a/b == a*r where r is the reciprocal of b. On modern computers + multiplication is very fast and big number division is very slow. + 'x' is multiplied by 'y' and then divided by 'm' and the remainder + is returned. 'i' is the reciprocal of 'm' and 'nb' is the number + of bits as returned from BN_reciprocal(). Normal usage is as follows. + bn=BN_reciprocal(i,m); + for (...) + { BN_mod_mul_reciprocal(r,x,y,m,i,bn,ctx); } + This is r=(x*y)%m. Internally it is approximately + r=(x*y)-m*(x*y/m) or r=(x*y)-m*((x*y*i) >> bn) + This function is used in BN_mod_exp() and BN_is_prime(). + +Assignment Operations + +int BN_one(BIGNUM *a) + Set 'a' to hold the value one. + This is a=1. + +int BN_zero(BIGNUM *a) + Set 'a' to hold the value zero. + This is a=0. + +int BN_set_word(BIGNUM *a, unsigned long w); + Set 'a' to hold the value of 'w'. 'w' is an unsigned long. + This is a=w. + +unsigned long BN_get_word(BIGNUM *a); + Returns 'a' in an unsigned long. Not remarkably, often 'a' will + be biger than a word, in which case 0xffffffffL is returned. + +Word Operations +These functions are much more efficient that the normal bignum arithmetic +operations. + +BN_ULONG BN_mod_word(BIGNUM *a, unsigned long w); + Return the remainder of 'a' divided by 'w'. + This is return(a%w). + +int BN_add_word(BIGNUM *a, unsigned long w); + Add 'w' to 'a'. This function does not take the sign of 'a' into + account. This is a+=w; + +Bit operations. + +int BN_is_bit_set(BIGNUM *a, int n); + This function return 1 if bit 'n' is set in 'a' else 0. + +int BN_set_bit(BIGNUM *a, int n); + This function sets bit 'n' to 1 in 'a'. + This is a&= ~(1<<n); + +int BN_clear_bit(BIGNUM *a, int n); + This function sets bit 'n' to zero in 'a'. Return 0 if less + than 'n' bits in 'a' else 1. This is a&= ~(1<<n); + +int BN_mask_bits(BIGNUM *a, int n); + Truncate 'a' to n bits long. This is a&= ~((~0)<<n) + +Format conversion routines. + +BIGNUM *BN_bin2bn(unsigned char *s, int len,BIGNUM *ret); + This function converts 'len' bytes in 's' into a BIGNUM which + is put in 'ret'. If ret is NULL, a new BIGNUM is created. + Either this new BIGNUM or ret is returned. The number is + assumed to be in bigendian form in 's'. By this I mean that + to 'ret' is created as follows for 'len' == 5. + ret = s[0]*2^32 + s[1]*2^24 + s[2]*2^16 + s[3]*2^8 + s[4]; + This function cannot be used to convert negative numbers. It + is always assumed the number is positive. The application + needs to diddle the 'neg' field of th BIGNUM its self. + The better solution would be to save the numbers in ASN.1 format + since this is a defined standard for storing big numbers. + Look at the functions + + ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai); + BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn); + int i2d_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp); + ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp, + long length; + +int BN_bn2bin(BIGNUM *a, unsigned char *to); + This function converts 'a' to a byte string which is put into + 'to'. The representation is big-endian in that the most + significant byte of 'a' is put into to[0]. This function + returns the number of bytes used to hold 'a'. BN_num_bytes(a) + would return the same value and can be used to determine how + large 'to' needs to be. If the number is negative, this + information is lost. Since this library was written to + manipulate large positive integers, the inability to save and + restore them is not considered to be a problem by me :-). + As for BN_bin2bn(), look at the ASN.1 integer encoding funtions + for SSLeay. They use BN_bin2bn() and BN_bn2bin() internally. + +char *BN_bn2ascii(BIGNUM *a); + This function returns a malloc()ed string that contains the + ascii hexadecimal encoding of 'a'. The number is in bigendian + format with a '-' in front if the number is negative. + +int BN_ascii2bn(BIGNUM **bn, char *a); + The inverse of BN_bn2ascii. The function returns the number of + characters from 'a' were processed in generating a the bignum. + error is inticated by 0 being returned. The number is a + hex digit string, optionally with a leading '-'. If *bn + is null, a BIGNUM is created and returned via that variable. + +int BN_print_fp(FILE *fp, BIGNUM *a); + 'a' is printed to file pointer 'fp'. It is in the same format + that is output from BN_bn2ascii(). 0 is returned on error, + 1 if things are ok. + +int BN_print(BIO *bp, BIGNUM *a); + Same as BN_print except that the output is done to the SSLeay libraries + BIO routines. BN_print_fp() actually calls this function. + +Miscellaneous Routines. + +int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); + This function returns in 'rnd' a random BIGNUM that is bits + long. If bottom is 1, the number returned is odd. If top is set, + the top 2 bits of the number are set. This is useful because if + this is set, 2 'n; bit numbers multiplied together will return a 2n + bit number. If top was not set, they could produce a 2n-1 bit + number. + +BIGNUM *BN_mod_inverse(BIGNUM *a, BIGNUM *n,BN_CTX *ctx); + This function create a new BIGNUM and returns it. This number + is the inverse mod 'n' of 'a'. By this it is meant that the + returned value 'r' satisfies (a*r)%n == 1. This function is + used in the generation of RSA keys. 'ctx', as per usual, + is used to hold temporary variables that are required by the + function. NULL is returned on error. + +int BN_gcd(BIGNUM *r,BIGNUM *a,BIGNUM *b,BN_CTX *ctx); + 'r' has the greatest common divisor of 'a' and 'b'. 'ctx' is + used for temporary variables and 0 is returned on error. + +int BN_is_prime(BIGNUM *p,int nchecks,void (*callback)(),BN_CTX *ctx, + char *cb_arg); + This function is used to check if a BIGNUM ('p') is prime. + It performs this test by using the Miller-Rabin randomised + primality test. This is a probalistic test that requires a + number of rounds to ensure the number is prime to a high + degree of probability. Since this can take quite some time, a + callback function can be passed and it will be called each + time 'p' passes a round of the prime testing. 'callback' will + be called as follows, callback(1,n,cb_arg) where n is the number of + the round, just passed. As per usual 'ctx' contains temporary + variables used. If ctx is NULL, it does not matter, a local version + will be malloced. This parameter is present to save some mallocing + inside the function but probably could be removed. + 0 is returned on error. + 'ncheck' is the number of Miller-Rabin tests to run. It is + suggested to use the value 'BN_prime_checks' by default. + +BIGNUM *BN_generate_prime( +int bits, +int strong, +BIGNUM *a, +BIGNUM *rems, +void (*callback)()); +char *cb_arg + This function is used to generate prime numbers. It returns a + new BIGNUM that has a high probability of being a prime. + 'bits' is the number of bits that + are to be in the prime. If 'strong' is true, the returned prime + will also be a strong prime ((p-1)/2 is also prime). + While searching for the prime ('p'), we + can add the requirement that the prime fill the following + condition p%a == rem. This can be used to help search for + primes with specific features, which is required when looking + for primes suitable for use with certain 'g' values in the + Diffie-Hellman key exchange algorithm. If 'a' is NULL, + this condition is not checked. If rem is NULL, rem is assumed + to be 1. Since this search for a prime + can take quite some time, if callback is not NULL, it is called + in the following situations. + We have a suspected prime (from a quick sieve), + callback(0,sus_prime++,cb_arg). Each item to be passed to BN_is_prime(). + callback(1,round++,cb_arg). Each successful 'round' in BN_is_prime(). + callback(2,round,cb_arg). For each successful BN_is_prime() test. + diff --git a/src/lib/libssl/src/doc/ca.1 b/src/lib/libssl/src/doc/ca.1 new file mode 100644 index 0000000000..5b0c5a198d --- /dev/null +++ b/src/lib/libssl/src/doc/ca.1 @@ -0,0 +1,121 @@ +From eay@orb.mincom.oz.au Thu Dec 28 23:56:45 1995 +Received: by orb.mincom.oz.au id AA07374 + (5.65c/IDA-1.4.4 for eay); Thu, 28 Dec 1995 13:56:45 +1000 +Date: Thu, 28 Dec 1995 13:56:45 +1000 (EST) +From: Eric Young <eay@mincom.oz.au> +X-Sender: eay@orb +To: sameer <sameer@c2.org> +Cc: ssleay@mincom.oz.au +Subject: Re: 'ca' +In-Reply-To: <199512230440.UAA23410@infinity.c2.org> +Message-Id: <Pine.SOL.3.91.951228133525.7269A-100000@orb> +Mime-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +Status: RO +X-Status: + +On Fri, 22 Dec 1995, sameer wrote: +> I could use documentation on 'ca'. Thanks. + +Very quickly. +The ca program uses the ssleay.conf file for most of its configuration + +./ca -help + + -verbose - Talk alot while doing things + -config file - A config file. If you don't want to use the + default config file + -name arg - The particular CA definition to use + In the config file, the section to use for parameters. This lets + multiple setups to be contained in the one file. By default, the + default_ca variable is looked up in the [ ca ] section. So in the + shipped ssleay.conf, the CA definition used is CA_default. It could be + any other name. + -gencrl days - Generate a new CRL, days is when the next CRL is due + This will generate a new certificate revocion list. + -days arg - number of days to certify the certificate for + When certifiying certificates, this is the number of days to use. + -md arg - md to use, one of md2, md5, sha or sha1 + -policy arg - The CA 'policy' to support + I'll describe this later, but there are 2 policies definied in the + shipped ssleay.conf + -keyfile arg - PEM RSA private key file + -key arg - key to decode the RSA private key if it is encrypted + since we need to keep the CA's RSA key encrypted + -cert - The CA certificate + -in file - The input PEM encoded certificate request(s) + -out file - Where to put the output file(s) + -outdir dir - Where to put output certificates + The -out options concatinates all the output certificied + certificates to one file, -outdir puts them in a directory, + named by serial number. + -infiles .... - The last argument, requests to process + The certificate requests to process, -in is the same. + +Just about all the above have default values defined in ssleay.conf. + +The key variables in ssleay.conf are (for the pariticular '-name' being +used, in the default, it is CA_default). + +dir is where all the CA database stuff is kept. +certs is where all the previously issued certificates are kept. +The database is a simple text database containing the following tab separated +fields. +status: a value of 'R' - revoked, 'E' -expired or 'V' valid. +issued date: When the certificate was certified. +revoked date: When it was revoked, blank if not revoked. +serial number: The certificate serial number. +certificate: Where the certificate is located. +CN: The name of the certificate. + +The demo file has quite a few made up values it it. The last 2 were +added by the ca program and are acurate. +The CA program does not update the 'certificate' file correctly right now. +The serial field should be unique as should the CN/status combination. +The ca program checks these at startup. What still needs to be +wrtten is a program to 'regenerate' the data base file from the issued +certificate list (and a CRL list). + +Back to the CA_default variables. + +Most of the variables are commented. + +policy is the default policy. + +Ok for policies, they define the order and which fields must be present +in the certificate request and what gets filled in. + +So a value of +countryName = match +means that the country name must match the CA certificate. +organizationalUnitName = optional +The org.Unit,Name does not have to be present and +commonName = supplied +commonName must be supplied in the certificate request. + +For the 'policy_match' polocy, the order of the attributes in the +generated certiticate would be +countryName +stateOrProvinceName +organizationName +organizationalUnitName +commonName +emailAddress + +Have a play, it sort of makes sense. If you think about how the persona +requests operate, it is similar to the 'policy_match' policy and the +'policy_anything' is similar to what versign is doing. + +I hope this helps a bit. Some backend scripts are definitly needed to +update the database and to make certificate revocion easy. All +certificates issued should also be kept forever (or until they expire?) + +hope this helps +eric (who has to run off an buy some cheap knee pads for the caving in 4 +days time :-) + +-- +Eric Young | Signature removed since it was generating +AARNet: eay@mincom.oz.au | more followups than the message contents :-) + + diff --git a/src/lib/libssl/src/doc/callback.doc b/src/lib/libssl/src/doc/callback.doc new file mode 100644 index 0000000000..7ad0f7f7d2 --- /dev/null +++ b/src/lib/libssl/src/doc/callback.doc @@ -0,0 +1,240 @@ +Callback functions used in SSLeay. + +-------------------------- +The BIO library. + +Each BIO structure can have a callback defined against it. This callback is +called 2 times for each BIO 'function'. It is passed 6 parameters. +BIO_debug_callback() is an example callback which is defined in +crypto/buffer/bio_cb.c and is used in apps/dgst.c This is intended mostly +for debuging or to notify the application of IO. + +long BIO_debug_callback(BIO *bio,int cmd,char *argp,int argi,long argl, + long ret); +bio is the BIO being called, cmd is the type of BIO function being called. +Look at the BIO_CB_* defines in buffer.h. Argp and argi are the arguments +passed to BIO_read(), BIO_write, BIO_gets(), BIO_puts(). In the case of +BIO_ctrl(), argl is also defined. The first time the callback is called, +before the underlying function has been executed, 0 is passed as 'ret', and +if the return code from the callback is not > 0, the call is aborted +and the returned <= 0 value is returned. +The second time the callback is called, the 'cmd' value also has +BIO_CB_RETURN logically 'or'ed with it. The 'ret' value is the value returned +from the actuall function call and whatever the callback returns is returned +from the BIO function. + +BIO_set_callback(b,cb) can be used to set the callback function +(b is a BIO), and BIO_set_callback_arg(b,arg) can be used to +set the cb_arg argument in the BIO strucutre. This field is only intended +to be used by application, primarily in the callback function since it is +accessable since the BIO is passed. + +-------------------------- +The PEM library. + +The pem library only really uses one type of callback, +static int def_callback(char *buf, int num, int verify); +which is used to return a password string if required. +'buf' is the buffer to put the string in. 'num' is the size of 'buf' +and 'verify' is used to indicate that the password should be checked. +This last flag is mostly used when reading a password for encryption. + +For all of these functions, a NULL callback will call the above mentioned +default callback. This default function does not work under Windows 3.1. +For other machines, it will use an application defined prompt string +(EVP_set_pw_prompt(), which defines a library wide prompt string) +if defined, otherwise it will use it's own PEM password prompt. +It will then call EVP_read_pw_string() to get a password from the console. +If your application wishes to use nice fancy windows to retrieve passwords, +replace this function. The callback should return the number of bytes read +into 'buf'. If the number of bytes <= 0, it is considered an error. + +Functions that take this callback are listed below. For the 'read' type +functions, the callback will only be required if the PEM data is encrypted. + +For the Write functions, normally a password can be passed in 'kstr', of +'klen' bytes which will be used if the 'enc' cipher is not NULL. If +'kstr' is NULL, the callback will be used to retrieve a password. + +int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len, + int (*callback)()); +char *PEM_ASN1_read_bio(char *(*d2i)(),char *name,BIO *bp,char **x,int (*cb)()); +char *PEM_ASN1_read(char *(*d2i)(),char *name,FILE *fp,char **x,int (*cb)()); +int PEM_ASN1_write_bio(int (*i2d)(),char *name,BIO *bp,char *x, + EVP_CIPHER *enc,unsigned char *kstr,int klen,int (*callback)()); +int PEM_ASN1_write(int (*i2d)(),char *name,FILE *fp,char *x, + EVP_CIPHER *enc,unsigned char *kstr,int klen,int (*callback)()); +STACK *PEM_X509_INFO_read(FILE *fp, STACK *sk, int (*cb)()); +STACK *PEM_X509_INFO_read_bio(BIO *fp, STACK *sk, int (*cb)()); + +#define PEM_write_RSAPrivateKey(fp,x,enc,kstr,klen,cb) +#define PEM_write_DSAPrivateKey(fp,x,enc,kstr,klen,cb) +#define PEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb) +#define PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb) +#define PEM_read_SSL_SESSION(fp,x,cb) +#define PEM_read_X509(fp,x,cb) +#define PEM_read_X509_REQ(fp,x,cb) +#define PEM_read_X509_CRL(fp,x,cb) +#define PEM_read_RSAPrivateKey(fp,x,cb) +#define PEM_read_DSAPrivateKey(fp,x,cb) +#define PEM_read_PrivateKey(fp,x,cb) +#define PEM_read_PKCS7(fp,x,cb) +#define PEM_read_DHparams(fp,x,cb) +#define PEM_read_bio_SSL_SESSION(bp,x,cb) +#define PEM_read_bio_X509(bp,x,cb) +#define PEM_read_bio_X509_REQ(bp,x,cb) +#define PEM_read_bio_X509_CRL(bp,x,cb) +#define PEM_read_bio_RSAPrivateKey(bp,x,cb) +#define PEM_read_bio_DSAPrivateKey(bp,x,cb) +#define PEM_read_bio_PrivateKey(bp,x,cb) +#define PEM_read_bio_PKCS7(bp,x,cb) +#define PEM_read_bio_DHparams(bp,x,cb) +int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)()); +RSA *d2i_Netscape_RSA(RSA **a, unsigned char **pp, long length, int (*cb)()); + +Now you will notice that macros like +#define PEM_write_X509(fp,x) \ + PEM_ASN1_write((int (*)())i2d_X509,PEM_STRING_X509,fp, \ + (char *)x, NULL,NULL,0,NULL) +Don't do encryption normally. If you want to PEM encrypt your X509 structure, +either just call PEM_ASN1_write directly or just define you own +macro variant. As you can see, this macro just sets all encryption related +parameters to NULL. + + +-------------------------- +The SSL library. + +#define SSL_set_info_callback(ssl,cb) +#define SSL_CTX_set_info_callback(ctx,cb) +void callback(SSL *ssl,int location,int ret) +This callback is called each time around the SSL_connect()/SSL_accept() +state machine. So it will be called each time the SSL protocol progresses. +It is mostly present for use when debugging. When SSL_connect() or +SSL_accept() return, the location flag is SSL_CB_ACCEPT_EXIT or +SSL_CB_CONNECT_EXIT and 'ret' is the value about to be returned. +Have a look at the SSL_CB_* defines in ssl.h. If an info callback is defined +against the SSL_CTX, it is called unless there is one set against the SSL. +Have a look at +void client_info_callback() in apps/s_client() for an example. + +Certificate verification. +void SSL_set_verify(SSL *s, int mode, int (*callback) ()); +void SSL_CTX_set_verify(SSL_CTX *ctx,int mode,int (*callback)()); +This callback is used to help verify client and server X509 certificates. +It is actually passed to X509_cert_verify(), along with the SSL structure +so you have to read about X509_cert_verify() :-). The SSL_CTX version is used +if the SSL version is not defined. X509_cert_verify() is the function used +by the SSL part of the library to verify certificates. This function is +nearly always defined by the application. + +void SSL_CTX_set_cert_verify_cb(SSL_CTX *ctx, int (*cb)(),char *arg); +int callback(char *arg,SSL *s,X509 *xs,STACK *cert_chain); +This call is used to replace the SSLeay certificate verification code. +The 'arg' is kept in the SSL_CTX and is passed to the callback. +If the callback returns 0, the certificate is rejected, otherwise it +is accepted. The callback is replacing the X509_cert_verify() call. +This feature is not often used, but if you wished to implement +some totally different certificate authentication system, this 'hook' is +vital. + +SSLeay keeps a cache of session-ids against each SSL_CTX. These callbacks can +be used to notify the application when a SSL_SESSION is added to the cache +or to retrieve a SSL_SESSION that is not in the cache from the application. +#define SSL_CTX_sess_set_get_cb(ctx,cb) +SSL_SESSION *callback(SSL *s,char *session_id,int session_id_len,int *copy); +If defined, this callback is called to return the SESSION_ID for the +session-id in 'session_id', of 'session_id_len' bytes. 'copy' is set to 1 +if the server is to 'take a copy' of the SSL_SESSION structure. It is 0 +if the SSL_SESSION is being 'passed in' so the SSLeay library is now +responsible for 'free()ing' the structure. Basically it is used to indicate +if the reference count on the SSL_SESSION structure needs to be incremented. + +#define SSL_CTX_sess_set_new_cb(ctx,cb) +int callback(SSL *s, SSL_SESSION *sess); +When a new connection is established, if the SSL_SESSION is going to be added +to the cache, this callback is called. Return 1 if a 'copy' is required, +otherwise, return 0. This return value just causes the reference count +to be incremented (on return of a 1), this means the application does +not need to worry about incrementing the refernece count (and the +locking that implies in a multi-threaded application). + +void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx,int (*cb)()); +This sets the SSL password reading function. +It is mostly used for windowing applications +and used by PEM_read_bio_X509() and PEM_read_bio_RSAPrivateKey() +calls inside the SSL library. The only reason this is present is because the +calls to PEM_* functions is hidden in the SSLeay library so you have to +pass in the callback some how. + +#define SSL_CTX_set_client_cert_cb(ctx,cb) +int callback(SSL *s,X509 **x509, EVP_PKEY **pkey); +Called when a client certificate is requested but there is not one set +against the SSL_CTX or the SSL. If the callback returns 1, x509 and +pkey need to point to valid data. The library will free these when +required so if the application wants to keep these around, increment +their reference counts. If 0 is returned, no client cert is +available. If -1 is returned, it is assumed that the callback needs +to be called again at a later point in time. SSL_connect will return +-1 and SSL_want_x509_lookup(ssl) returns true. Remember that +application data can be attached to an SSL structure via the +SSL_set_app_data(SSL *ssl,char *data) call. + +-------------------------- +The X509 library. + +int X509_cert_verify(CERTIFICATE_CTX *ctx,X509 *xs, int (*cb)(), + int *error,char *arg,STACK *cert_chain); +int verify_callback(int ok,X509 *xs,X509 *xi,int depth,int error,char *arg, + STACK *cert_chain); + +X509_cert_verify() is used to authenticate X509 certificates. The 'ctx' holds +the details of the various caches and files used to locate certificates. +'xs' is the certificate to verify and 'cb' is the application callback (more +detail later). 'error' will be set to the error code and 'arg' is passed +to the 'cb' callback. Look at the VERIFY_* defines in crypto/x509/x509.h + +When ever X509_cert_verify() makes a 'negative' decision about a +certitificate, the callback is called. If everything checks out, the +callback is called with 'VERIFY_OK' or 'VERIFY_ROOT_OK' (for a self +signed cert that is not the passed certificate). + +The callback is passed the X509_cert_verify opinion of the certificate +in 'ok', the certificate in 'xs', the issuer certificate in 'xi', +the 'depth' of the certificate in the verification 'chain', the +VERIFY_* code in 'error' and the argument passed to X509_cert_verify() +in 'arg'. cert_chain is a list of extra certs to use if they are not +in the cache. + +The callback can be used to look at the error reason, and then return 0 +for an 'error' or '1' for ok. This will override the X509_cert_verify() +opinion of the certificates validity. Processing will continue depending on +the return value. If one just wishes to use the callback for informational +reason, just return the 'ok' parameter. + +-------------------------- +The BN and DH library. + +BIGNUM *BN_generate_prime(int bits,int strong,BIGNUM *add, + BIGNUM *rem,void (*callback)(int,int)); +int BN_is_prime(BIGNUM *p,int nchecks,void (*callback)(int,int), + +Read doc/bn.doc for the description of these 2. + +DH *DH_generate_parameters(int prime_len,int generator, + void (*callback)(int,int)); +Read doc/bn.doc for the description of the callback, since it is just passed +to BN_generate_prime(), except that it is also called as +callback(3,0) by this function. + +-------------------------- +The CRYPTO library. + +void CRYPTO_set_locking_callback(void (*func)(int mode,int type,char *file, + int line)); +void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount, + int type,char *file, int line)); +void CRYPTO_set_id_callback(unsigned long (*func)(void)); + +Read threads.doc for info on these ones. + diff --git a/src/lib/libssl/src/doc/cipher.doc b/src/lib/libssl/src/doc/cipher.doc new file mode 100644 index 0000000000..d49ba78c5c --- /dev/null +++ b/src/lib/libssl/src/doc/cipher.doc @@ -0,0 +1,345 @@ +The Cipher subroutines. + +These routines require "evp.h" to be included. + +These functions are a higher level interface to the various cipher +routines found in this library. As such, they allow the same code to be +used to encrypt and decrypt via different ciphers with only a change +in an initial parameter. These routines also provide buffering for block +ciphers. + +These routines all take a pointer to the following structure to specify +which cipher to use. If you wish to use a new cipher with these routines, +you would probably be best off looking an how an existing cipher is +implemented and copying it. At this point in time, I'm not going to go +into many details. This structure should be considered opaque + +typedef struct pem_cipher_st + { + int type; + int block_size; + int key_len; + int iv_len; + void (*enc_init)(); /* init for encryption */ + void (*dec_init)(); /* init for decryption */ + void (*do_cipher)(); /* encrypt data */ + } EVP_CIPHER; + +The type field is the object NID of the cipher type +(read the section on Objects for an explanation of what a NID is). +The cipher block_size is how many bytes need to be passed +to the cipher at a time. Key_len is the +length of the key the cipher requires and iv_len is the length of the +initialisation vector required. enc_init is the function +called to initialise the ciphers context for encryption and dec_init is the +function to initialise for decryption (they need to be different, especially +for the IDEA cipher). + +One reason for specifying the Cipher via a pointer to a structure +is that if you only use des-cbc, only the des-cbc routines will +be included when you link the program. If you passed an integer +that specified which cipher to use, the routine that mapped that +integer to a set of cipher functions would cause all the ciphers +to be link into the code. This setup also allows new ciphers +to be added by the application (with some restrictions). + +The thirteen ciphers currently defined in this library are + +EVP_CIPHER *EVP_des_ecb(); /* DES in ecb mode, iv=0, block=8, key= 8 */ +EVP_CIPHER *EVP_des_ede(); /* DES in ecb ede mode, iv=0, block=8, key=16 */ +EVP_CIPHER *EVP_des_ede3(); /* DES in ecb ede mode, iv=0, block=8, key=24 */ +EVP_CIPHER *EVP_des_cfb(); /* DES in cfb mode, iv=8, block=1, key= 8 */ +EVP_CIPHER *EVP_des_ede_cfb(); /* DES in ede cfb mode, iv=8, block=1, key=16 */ +EVP_CIPHER *EVP_des_ede3_cfb();/* DES in ede cfb mode, iv=8, block=1, key=24 */ +EVP_CIPHER *EVP_des_ofb(); /* DES in ofb mode, iv=8, block=1, key= 8 */ +EVP_CIPHER *EVP_des_ede_ofb(); /* DES in ede ofb mode, iv=8, block=1, key=16 */ +EVP_CIPHER *EVP_des_ede3_ofb();/* DES in ede ofb mode, iv=8, block=1, key=24 */ +EVP_CIPHER *EVP_des_cbc(); /* DES in cbc mode, iv=8, block=8, key= 8 */ +EVP_CIPHER *EVP_des_ede_cbc(); /* DES in cbc ede mode, iv=8, block=8, key=16 */ +EVP_CIPHER *EVP_des_ede3_cbc();/* DES in cbc ede mode, iv=8, block=8, key=24 */ +EVP_CIPHER *EVP_desx_cbc(); /* DES in desx cbc mode,iv=8, block=8, key=24 */ +EVP_CIPHER *EVP_rc4(); /* RC4, iv=0, block=1, key=16 */ +EVP_CIPHER *EVP_idea_ecb(); /* IDEA in ecb mode, iv=0, block=8, key=16 */ +EVP_CIPHER *EVP_idea_cfb(); /* IDEA in cfb mode, iv=8, block=1, key=16 */ +EVP_CIPHER *EVP_idea_ofb(); /* IDEA in ofb mode, iv=8, block=1, key=16 */ +EVP_CIPHER *EVP_idea_cbc(); /* IDEA in cbc mode, iv=8, block=8, key=16 */ +EVP_CIPHER *EVP_rc2_ecb(); /* RC2 in ecb mode, iv=0, block=8, key=16 */ +EVP_CIPHER *EVP_rc2_cfb(); /* RC2 in cfb mode, iv=8, block=1, key=16 */ +EVP_CIPHER *EVP_rc2_ofb(); /* RC2 in ofb mode, iv=8, block=1, key=16 */ +EVP_CIPHER *EVP_rc2_cbc(); /* RC2 in cbc mode, iv=8, block=8, key=16 */ +EVP_CIPHER *EVP_bf_ecb(); /* Blowfish in ecb mode,iv=0, block=8, key=16 */ +EVP_CIPHER *EVP_bf_cfb(); /* Blowfish in cfb mode,iv=8, block=1, key=16 */ +EVP_CIPHER *EVP_bf_ofb(); /* Blowfish in ofb mode,iv=8, block=1, key=16 */ +EVP_CIPHER *EVP_bf_cbc(); /* Blowfish in cbc mode,iv=8, block=8, key=16 */ + +The meaning of the compound names is as follows. +des The base cipher is DES. +idea The base cipher is IDEA +rc4 The base cipher is RC4-128 +rc2 The base cipher is RC2-128 +ecb Electronic Code Book form of the cipher. +cbc Cipher Block Chaining form of the cipher. +cfb 64 bit Cipher Feedback form of the cipher. +ofb 64 bit Output Feedback form of the cipher. +ede The cipher is used in Encrypt, Decrypt, Encrypt mode. The first + and last keys are the same. +ede3 The cipher is used in Encrypt, Decrypt, Encrypt mode. + +All the Cipher routines take a EVP_CIPHER_CTX pointer as an argument. +The state of the cipher is kept in this structure. + +typedef struct EVP_CIPHER_Ctx_st + { + EVP_CIPHER *cipher; + int encrypt; /* encrypt or decrypt */ + int buf_len; /* number we have left */ + unsigned char buf[8]; + union { + .... /* cipher specific stuff */ + } c; + } EVP_CIPHER_CTX; + +Cipher is a pointer the the EVP_CIPHER for the current context. The encrypt +flag indicates encryption or decryption. buf_len is the number of bytes +currently being held in buf. +The 'c' union holds the cipher specify context. + +The following functions are to be used. + +int EVP_read_pw_string( +char *buf, +int len, +char *prompt, +int verify, + This function is the same as des_read_pw_string() (des.doc). + +void EVP_set_pw_prompt(char *prompt); + This function sets the 'default' prompt to use to use in + EVP_read_pw_string when the prompt parameter is NULL. If the + prompt parameter is NULL, this 'default prompt' feature is turned + off. Be warned, this is a global variable so weird things + will happen if it is used under Win16 and care must be taken + with a multi-threaded version of the library. + +char *EVP_get_pw_prompt(); + This returns a pointer to the default prompt string. NULL + if it is not set. + +int EVP_BytesToKey( +EVP_CIPHER *type, +EVP_MD *md, +unsigned char *salt, +unsigned char *data, +int datal, +int count, +unsigned char *key, +unsigned char *iv); + This function is used to generate a key and an initialisation vector + for a specified cipher from a key string and a salt. Type + specifies the cipher the 'key' is being generated for. Md is the + message digest algorithm to use to generate the key and iv. The salt + is an optional 8 byte object that is used to help seed the key + generator. + If the salt value is NULL, it is just not used. Datal is the + number of bytes to use from 'data' in the key generation. + This function returns the key size for the specified cipher, if + data is NULL, this value is returns and no other + computation is performed. Count is + the number of times to loop around the key generator. I would + suggest leaving it's value as 1. Key and iv are the structures to + place the returning iv and key in. If they are NULL, no value is + generated for that particular value. + The algorithm used is as follows + + /* M[] is an array of message digests + * MD() is the message digest function */ + M[0]=MD(data . salt); + for (i=1; i<count; i++) M[0]=MD(M[0]); + + i=1 + while (data still needed for key and iv) + { + M[i]=MD(M[i-1] . data . salt); + for (i=1; i<count; i++) M[i]=MD(M[i]); + i++; + } + + If the salt is NULL, it is not used. + The digests are concatenated together. + M = M[0] . M[1] . M[2] ....... + + For key= 8, iv=8 => key=M[0.. 8], iv=M[ 9 .. 16]. + For key=16, iv=0 => key=M[0..16]. + For key=16, iv=8 => key=M[0..16], iv=M[17 .. 24]. + For key=24, iv=8 => key=M[0..24], iv=M[25 .. 32]. + + This routine will produce DES-CBC keys and iv that are compatible + with the PKCS-5 standard when md2 or md5 are used. If md5 is + used, the salt is NULL and count is 1, this routine will produce + the password to key mapping normally used with RC4. + I have attempted to logically extend the PKCS-5 standard to + generate keys and iv for ciphers that require more than 16 bytes, + if anyone knows what the correct standard is, please inform me. + When using sha or sha1, things are a bit different under this scheme, + since sha produces a 20 byte digest. So for ciphers requiring + 24 bits of data, 20 will come from the first MD and 4 will + come from the second. + + I have considered having a separate function so this 'routine' + can be used without the requirement of passing a EVP_CIPHER *, + but I have decided to not bother. If you wish to use the + function without official EVP_CIPHER structures, just declare + a local one and set the key_len and iv_len fields to the + length you desire. + +The following routines perform encryption and decryption 'by parts'. By +this I mean that there are groups of 3 routines. An Init function that is +used to specify a cipher and initialise data structures. An Update routine +that does encryption/decryption, one 'chunk' at a time. And finally a +'Final' function that finishes the encryption/decryption process. +All these functions take a EVP_CIPHER pointer to specify which cipher to +encrypt/decrypt with. They also take a EVP_CIPHER_CTX object as an +argument. This structure is used to hold the state information associated +with the operation in progress. + +void EVP_EncryptInit( +EVP_CIPHER_CTX *ctx, +EVP_CIPHER *type, +unsigned char *key, +unsigned char *iv); + This function initialise a EVP_CIPHER_CTX for encryption using the + cipher passed in the 'type' field. The cipher is initialised to use + 'key' as the key and 'iv' for the initialisation vector (if one is + required). If the type, key or iv is NULL, the value currently in the + EVP_CIPHER_CTX is reused. So to perform several decrypt + using the same cipher, key and iv, initialise with the cipher, + key and iv the first time and then for subsequent calls, + reuse 'ctx' but pass NULL for type, key and iv. You must make sure + to pass a key that is large enough for a particular cipher. I + would suggest using the EVP_BytesToKey() function. + +void EVP_EncryptUpdate( +EVP_CIPHER_CTX *ctx, +unsigned char *out, +int *outl, +unsigned char *in, +int inl); + This function takes 'inl' bytes from 'in' and outputs bytes + encrypted by the cipher 'ctx' was initialised with into 'out'. The + number of bytes written to 'out' is put into outl. If a particular + cipher encrypts in blocks, less or more bytes than input may be + output. Currently the largest block size used by supported ciphers + is 8 bytes, so 'out' should have room for 'inl+7' bytes. Normally + EVP_EncryptInit() is called once, followed by lots and lots of + calls to EVP_EncryptUpdate, followed by a single EVP_EncryptFinal + call. + +void EVP_EncryptFinal( +EVP_CIPHER_CTX *ctx, +unsigned char *out, +int *outl); + Because quite a large number of ciphers are block ciphers, there is + often an incomplete block to write out at the end of the + encryption. EVP_EncryptFinal() performs processing on this last + block. The last block in encoded in such a way that it is possible + to determine how many bytes in the last block are valid. For 8 byte + block size ciphers, if only 5 bytes in the last block are valid, the + last three bytes will be filled with the value 3. If only 2 were + valid, the other 6 would be filled with sixes. If all 8 bytes are + valid, a extra 8 bytes are appended to the cipher stream containing + nothing but 8 eights. These last bytes are output into 'out' and + the number of bytes written is put into 'outl' These last bytes + are output into 'out' and the number of bytes written is put into + 'outl'. This form of block cipher finalisation is compatible with + PKCS-5. Please remember that even if you are using ciphers like + RC4 that has no blocking and so the function will not write + anything into 'out', it would still be a good idea to pass a + variable for 'out' that can hold 8 bytes just in case the cipher is + changed some time in the future. It should also be remembered + that the EVP_CIPHER_CTX contains the password and so when one has + finished encryption with a particular EVP_CIPHER_CTX, it is good + practice to zero the structure + (ie. memset(ctx,0,sizeof(EVP_CIPHER_CTX)). + +void EVP_DecryptInit( +EVP_CIPHER_CTX *ctx, +EVP_CIPHER *type, +unsigned char *key, +unsigned char *iv); + This function is basically the same as EVP_EncryptInit() accept that + is prepares the EVP_CIPHER_CTX for decryption. + +void EVP_DecryptUpdate( +EVP_CIPHER_CTX *ctx, +unsigned char *out, +int *outl, +unsigned char *in, +int inl); + This function is basically the same as EVP_EncryptUpdate() + except that it performs decryption. There is one + fundamental difference though. 'out' can not be the same as + 'in' for any ciphers with a block size greater than 1 if more + than one call to EVP_DecryptUpdate() will be made. This + is because this routine can hold a 'partial' block between + calls. When a partial block is decrypted (due to more bytes + being passed via this function, they will be written to 'out' + overwriting the input bytes in 'in' that have not been read + yet. From this it should also be noted that 'out' should + be at least one 'block size' larger than 'inl'. This problem + only occurs on the second and subsequent call to + EVP_DecryptUpdate() when using a block cipher. + +int EVP_DecryptFinal( +EVP_CIPHER_CTX *ctx, +unsigned char *out, +int *outl); + This function is different to EVP_EncryptFinal in that it 'removes' + any padding bytes appended when the data was encrypted. Due to the + way in which 1 to 8 bytes may have been appended when encryption + using a block cipher, 'out' can end up with 0 to 7 bytes being put + into it. When decoding the padding bytes, it is possible to detect + an incorrect decryption. If the decryption appears to be wrong, 0 + is returned. If everything seems ok, 1 is returned. For ciphers + with a block size of 1 (RC4), this function would normally not + return any bytes and would always return 1. Just because this + function returns 1 does not mean the decryption was correct. It + would normally be wrong due to either the wrong key/iv or + corruption of the cipher data fed to EVP_DecryptUpdate(). + As for EVP_EncryptFinal, it is a good idea to zero the + EVP_CIPHER_CTX after use since the structure contains the key used + to decrypt the data. + +The following Cipher routines are convenience routines that call either +EVP_EncryptXxx or EVP_DecryptXxx depending on weather the EVP_CIPHER_CTX +was setup to encrypt or decrypt. + +void EVP_CipherInit( +EVP_CIPHER_CTX *ctx, +EVP_CIPHER *type, +unsigned char *key, +unsigned char *iv, +int enc); + This function take arguments that are the same as EVP_EncryptInit() + and EVP_DecryptInit() except for the extra 'enc' flag. If 1, the + EVP_CIPHER_CTX is setup for encryption, if 0, decryption. + +void EVP_CipherUpdate( +EVP_CIPHER_CTX *ctx, +unsigned char *out, +int *outl, +unsigned char *in, +int inl); + Again this function calls either EVP_EncryptUpdate() or + EVP_DecryptUpdate() depending on state in the 'ctx' structure. + As noted for EVP_DecryptUpdate(), when this routine is used + for decryption with block ciphers, 'out' should not be the + same as 'in'. + +int EVP_CipherFinal( +EVP_CIPHER_CTX *ctx, +unsigned char *outm, +int *outl); + This routine call EVP_EncryptFinal() or EVP_DecryptFinal() + depending on the state information in 'ctx'. 1 is always returned + if the mode is encryption, otherwise the return value is the return + value of EVP_DecryptFinal(). diff --git a/src/lib/libssl/src/doc/cipher.m b/src/lib/libssl/src/doc/cipher.m new file mode 100644 index 0000000000..9f74917135 --- /dev/null +++ b/src/lib/libssl/src/doc/cipher.m @@ -0,0 +1,128 @@ +From ssl-lists-owner@mincom.com Tue Oct 15 18:16:14 1996 +Received: from cygnus.mincom.oz.au by orb.mincom.oz.au with SMTP id AA11550 + (5.65c/IDA-1.4.4 for eay); Tue, 15 Oct 1996 08:17:41 +1000 +Received: (from daemon@localhost) by cygnus.mincom.oz.au (8.7.5/8.7.3) id IAA12472 for ssl-users-outgoing; Tue, 15 Oct 1996 08:16:35 +1000 (EST) +Received: from orb.mincom.oz.au (eay@orb.mincom.oz.au [192.55.197.1]) by cygnus.mincom.oz.au (8.7.5/8.7.3) with SMTP id IAA12463 for <ssl-users@listserv.mincom.oz.au>; Tue, 15 Oct 1996 08:16:32 +1000 (EST) +Received: by orb.mincom.oz.au id AA11544 + (5.65c/IDA-1.4.4 for ssl-users@listserv.mincom.oz.au); Tue, 15 Oct 1996 08:16:15 +1000 +Date: Tue, 15 Oct 1996 08:16:14 +1000 (EST) +From: Eric Young <eay@mincom.com> +X-Sender: eay@orb +To: Roland Haring <rharing@tandem.cl> +Cc: ssl-users@mincom.com +Subject: Re: Symmetric encryption with ssleay +In-Reply-To: <m0vBpyq-00001aC@tandemnet.tandem.cl> +Message-Id: <Pine.SOL.3.91.961015075623.11394A-100000@orb> +Mime-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +Sender: ssl-lists-owner@mincom.com +Precedence: bulk +Status: RO +X-Status: + + +On Fri, 11 Oct 1996, Roland Haring wrote: +> THE_POINT: +> Would somebody be so kind to give me the minimum basic +> calls I need to do to libcrypto.a to get some text encrypted +> and decrypted again? ...hopefully with code included to do +> base64 encryption and decryption ... e.g. that sign-it.c code +> posted some while ago was a big help :-) (please, do not point +> me to apps/enc.c where I suspect my Heissenbug to be hidden :-) + +Ok, the base64 encoding stuff in 'enc.c' does the wrong thing sometimes +when the data is less than a line long (this is for decoding). I'll dig +up the exact fix today and post it. I am taking longer on 0.6.5 than I +intended so I'll just post this patch. + +The documentation to read is in +doc/cipher.doc, +doc/encode.doc (very sparse :-). +and perhaps +doc/digest.doc, + +The basic calls to encrypt with say triple DES are + +Given +char key[EVP_MAX_KEY_LENGTH]; +char iv[EVP_MAX_IV_LENGTH]; +EVP_CIPHER_CTX ctx; +unsigned char out[512+8]; +int outl; + +/* optional generation of key/iv data from text password using md5 + * via an upward compatable verson of PKCS#5. */ +EVP_BytesToKey(EVP_des_ede3_cbc,EVP_md5,NULL,passwd,strlen(passwd), + key,iv); + +/* Initalise the EVP_CIPHER_CTX */ +EVP_EncryptInit(ctx,EVP_des_ede3_cbc,key,iv); + +while (....) + { + /* This is processing 512 bytes at a time, the bytes are being + * copied into 'out', outl bytes are output. 'out' should not be the + * same as 'in' for reasons mentioned in the documentation. */ + EVP_EncryptUpdate(ctx,out,&outl,in,512); + } + +/* Output the last 'block'. If the cipher is a block cipher, the last + * block is encoded in such a way so that a wrong decryption will normally be + * detected - again, one of the PKCS standards. */ + +EVP_EncryptFinal(ctx,out,&outl); + +To decrypt, use the EVP_DecryptXXXXX functions except that EVP_DecryptFinal() +will return 0 if the decryption fails (only detectable on block ciphers). + +You can also use +EVP_CipherInit() +EVP_CipherUpdate() +EVP_CipherFinal() +which does either encryption or decryption depending on an extra +parameter to EVP_CipherInit(). + + +To do the base64 encoding, +EVP_EncodeInit() +EVP_EncodeUpdate() +EVP_EncodeFinal() + +EVP_DecodeInit() +EVP_DecodeUpdate() +EVP_DecodeFinal() + +where the encoding is quite simple, but the decoding can be a bit more +fun (due to dud input). + +EVP_DecodeUpdate() returns -1 for an error on an input line, 0 if the +'last line' was just processed, and 1 if more lines should be submitted. + +EVP_DecodeFinal() returns -1 for an error or 1 if things are ok. + +So the loop becomes +EVP_DecodeInit(....) +for (;;) + { + i=EVP_DecodeUpdate(....); + if (i < 0) goto err; + + /* process the data */ + + if (i == 0) break; + } +EVP_DecodeFinal(....); +/* process the data */ + +The problem in 'enc.c' is that I was stuff the processing up after the +EVP_DecodeFinal(...) when the for(..) loop was not being run (one line of +base64 data) and this was because 'enc.c' tries to scan over a file until +it hits the first valid base64 encoded line. + +hope this helps a bit. +eric +-- +Eric Young | BOOL is tri-state according to Bill Gates. +AARNet: eay@mincom.oz.au | RTFM Win32 GetMessage(). + + diff --git a/src/lib/libssl/src/doc/conf.doc b/src/lib/libssl/src/doc/conf.doc new file mode 100644 index 0000000000..f12fe884f5 --- /dev/null +++ b/src/lib/libssl/src/doc/conf.doc @@ -0,0 +1,89 @@ +The CONF library. + +The CONF library is a simple set of routines that can be used to configure +programs. It is a superset of the genenv() function with some extra +structure. + +The library consists of 5 functions. + +LHASH *CONF_load(LHASH *config,char *file); +This function is called to load in a configuration file. Multiple +configuration files can be loaded, with each subsequent 'load' overwriting +any already defined 'variables'. If there is an error, NULL is returned. +If config is NULL, a new LHASH structure is created and returned, otherwise +the new data in the 'file' is loaded into the 'config' structure. + +void CONF_free(LHASH *config); +This function free()s the data in config. + +char *CONF_get_string(LHASH *config,char *section,char *name); +This function returns the string found in 'config' that corresponds to the +'section' and 'name' specified. Classes and the naming system used will be +discussed later in this document. If the variable is not defined, an NULL +is returned. + +long CONF_get_long(LHASH *config,char *section, char *name); +This function is the same as CONF_get_string() except that it converts the +string to an long and returns it. If variable is not a number or the +variable does not exist, 0 is returned. This is a little problematic but I +don't know of a simple way around it. + +STACK *CONF_get_section(LHASH *config, char *section); +This function returns a 'stack' of CONF_VALUE items that are all the +items defined in a particular section. DO NOT free() any of the +variable returned. They will disappear when CONF_free() is called. + +The 'lookup' model. +The configuration file is divided into 'sections'. Each section is started by +a line of the form '[ section ]'. All subsequent variable definitions are +of this section. A variable definition is a simple alpha-numeric name +followed by an '=' and then the data. A section or variable name can be +described by a regular expression of the following form '[A-Za-z0-9_]+'. +The value of the variable is the text after the '=' until the end of the +line, stripped of leading and trailing white space. +At this point I should mention that a '#' is a comment character, \ is the +escape character, and all three types of quote can be used to stop any +special interpretation of the data. +Now when the data is being loaded, variable expansion can occur. This is +done by expanding any $NAME sequences into the value represented by the +variable NAME. If the variable is not in the current section, the different +section can be specified by using the $SECTION::NAME form. The ${NAME} form +also works and is very useful for expanding variables inside strings. + +When a variable is looked up, there are 2 special section. 'default', which +is the initial section, and 'ENV' which is the processes environment +variables (accessed via getenv()). When a variable is looked up, it is +first 'matched' with it's section (if one was specified), if this fails, the +'default' section is matched. +If the 'lhash' variable passed was NULL, the environment is searched. + +Now why do we bother with sections? So we can have multiple programs using +the same configuration file, or multiple instances of the same program +using different variables. It also provides a nice mechanism to override +the processes environment variables (eg ENV::HOME=/tmp). If there is a +program specific variable missing, we can have default values. +Multiple configuration files can be loaded, with each new value clearing +any predefined values. A system config file can provide 'default' values, +and application/usr specific files can provide overriding values. + +Examples + +# This is a simple example +SSLEAY_HOME = /usr/local/ssl +ENV::PATH = $SSLEAY_HOME/bin:$PATH # override my path + +[X509] +cert_dir = $SSLEAY_HOME/certs # /usr/local/ssl/certs + +[SSL] +CIPHER = DES-EDE-MD5:RC4-MD5 +USER_CERT = $HOME/${USER}di'r 5' # /home/eay/eaydir 5 +USER_CERT = $HOME/\${USER}di\'r # /home/eay/${USER}di'r +USER_CERT = "$HOME/${US"ER}di\'r # $HOME/${USER}di'r + +TEST = 1234\ +5678\ +9ab # TEST=123456789ab +TTT = 1234\n\n # TTT=1234<nl><nl> + + diff --git a/src/lib/libssl/src/doc/des.doc b/src/lib/libssl/src/doc/des.doc new file mode 100644 index 0000000000..5879d968f3 --- /dev/null +++ b/src/lib/libssl/src/doc/des.doc @@ -0,0 +1,505 @@ +The DES library. + +Please note that this library was originally written to operate with +eBones, a version of Kerberos that had had encryption removed when it left +the USA and then put back in. As such there are some routines that I will +advise not using but they are still in the library for historical reasons. +For all calls that have an 'input' and 'output' variables, they can be the +same. + +This library requires the inclusion of 'des.h'. + +All of the encryption functions take what is called a des_key_schedule as an +argument. A des_key_schedule is an expanded form of the des key. +A des_key is 8 bytes of odd parity, the type used to hold the key is a +des_cblock. A des_cblock is an array of 8 bytes, often in this library +description I will refer to input bytes when the function specifies +des_cblock's as input or output, this just means that the variable should +be a multiple of 8 bytes. + +The define DES_ENCRYPT is passed to specify encryption, DES_DECRYPT to +specify decryption. The functions and global variable are as follows: + +int des_check_key; + DES keys are supposed to be odd parity. If this variable is set to + a non-zero value, des_set_key() will check that the key has odd + parity and is not one of the known weak DES keys. By default this + variable is turned off; + +void des_set_odd_parity( +des_cblock *key ); + This function takes a DES key (8 bytes) and sets the parity to odd. + +int des_is_weak_key( +des_cblock *key ); + This function returns a non-zero value if the DES key passed is a + weak, DES key. If it is a weak key, don't use it, try a different + one. If you are using 'random' keys, the chances of hitting a weak + key are 1/2^52 so it is probably not worth checking for them. + +int des_set_key( +des_cblock *key, +des_key_schedule schedule); + Des_set_key converts an 8 byte DES key into a des_key_schedule. + A des_key_schedule is an expanded form of the key which is used to + perform actual encryption. It can be regenerated from the DES key + so it only needs to be kept when encryption or decryption is about + to occur. Don't save or pass around des_key_schedule's since they + are CPU architecture dependent, DES keys are not. If des_check_key + is non zero, zero is returned if the key has the wrong parity or + the key is a weak key, else 1 is returned. + +int des_key_sched( +des_cblock *key, +des_key_schedule schedule); + An alternative name for des_set_key(). + +int des_rw_mode; /* defaults to DES_PCBC_MODE */ + This flag holds either DES_CBC_MODE or DES_PCBC_MODE (default). + This specifies the function to use in the enc_read() and enc_write() + functions. + +void des_encrypt( +unsigned long *data, +des_key_schedule ks, +int enc); + This is the DES encryption function that gets called by just about + every other DES routine in the library. You should not use this + function except to implement 'modes' of DES. I say this because the + functions that call this routine do the conversion from 'char *' to + long, and this needs to be done to make sure 'non-aligned' memory + access do not occur. The characters are loaded 'little endian', + have a look at my source code for more details on how I use this + function. + Data is a pointer to 2 unsigned long's and ks is the + des_key_schedule to use. enc, is non zero specifies encryption, + zero if decryption. + +void des_encrypt2( +unsigned long *data, +des_key_schedule ks, +int enc); + This functions is the same as des_encrypt() except that the DES + initial permutation (IP) and final permutation (FP) have been left + out. As for des_encrypt(), you should not use this function. + It is used by the routines in my library that implement triple DES. + IP() des_encrypt2() des_encrypt2() des_encrypt2() FP() is the same + as des_encrypt() des_encrypt() des_encrypt() except faster :-). + +void des_ecb_encrypt( +des_cblock *input, +des_cblock *output, +des_key_schedule ks, +int enc); + This is the basic Electronic Code Book form of DES, the most basic + form. Input is encrypted into output using the key represented by + ks. If enc is non zero (DES_ENCRYPT), encryption occurs, otherwise + decryption occurs. Input is 8 bytes long and output is 8 bytes. + (the des_cblock structure is 8 chars). + +void des_ecb3_encrypt( +des_cblock *input, +des_cblock *output, +des_key_schedule ks1, +des_key_schedule ks2, +des_key_schedule ks3, +int enc); + This is the 3 key EDE mode of ECB DES. What this means is that + the 8 bytes of input is encrypted with ks1, decrypted with ks2 and + then encrypted again with ks3, before being put into output; + C=E(ks3,D(ks2,E(ks1,M))). There is a macro, des_ecb2_encrypt() + that only takes 2 des_key_schedules that implements, + C=E(ks1,D(ks2,E(ks1,M))) in that the final encrypt is done with ks1. + +void des_cbc_encrypt( +des_cblock *input, +des_cblock *output, +long length, +des_key_schedule ks, +des_cblock *ivec, +int enc); + This routine implements DES in Cipher Block Chaining mode. + Input, which should be a multiple of 8 bytes is encrypted + (or decrypted) to output which will also be a multiple of 8 bytes. + The number of bytes is in length (and from what I've said above, + should be a multiple of 8). If length is not a multiple of 8, I'm + not being held responsible :-). ivec is the initialisation vector. + This function does not modify this variable. To correctly implement + cbc mode, you need to do one of 2 things; copy the last 8 bytes of + cipher text for use as the next ivec in your application, + or use des_ncbc_encrypt(). + Only this routine has this problem with updating the ivec, all + other routines that are implementing cbc mode update ivec. + +void des_ncbc_encrypt( +des_cblock *input, +des_cblock *output, +long length, +des_key_schedule sk, +des_cblock *ivec, +int enc); + For historical reasons, des_cbc_encrypt() did not update the + ivec with the value requires so that subsequent calls to + des_cbc_encrypt() would 'chain'. This was needed so that the same + 'length' values would not need to be used when decrypting. + des_ncbc_encrypt() does the right thing. It is the same as + des_cbc_encrypt accept that ivec is updates with the correct value + to pass in subsequent calls to des_ncbc_encrypt(). I advise using + des_ncbc_encrypt() instead of des_cbc_encrypt(); + +void des_xcbc_encrypt( +des_cblock *input, +des_cblock *output, +long length, +des_key_schedule sk, +des_cblock *ivec, +des_cblock *inw, +des_cblock *outw, +int enc); + This is RSA's DESX mode of DES. It uses inw and outw to + 'whiten' the encryption. inw and outw are secret (unlike the iv) + and are as such, part of the key. So the key is sort of 24 bytes. + This is much better than cbc des. + +void des_3cbc_encrypt( +des_cblock *input, +des_cblock *output, +long length, +des_key_schedule sk1, +des_key_schedule sk2, +des_cblock *ivec1, +des_cblock *ivec2, +int enc); + This function is flawed, do not use it. I have left it in the + library because it is used in my des(1) program and will function + correctly when used by des(1). If I removed the function, people + could end up unable to decrypt files. + This routine implements outer triple cbc encryption using 2 ks and + 2 ivec's. Use des_ede2_cbc_encrypt() instead. + +void des_ede3_cbc_encrypt( +des_cblock *input, +des_cblock *output, +long length, +des_key_schedule ks1, +des_key_schedule ks2, +des_key_schedule ks3, +des_cblock *ivec, +int enc); + This function implements outer triple CBC DES encryption with 3 + keys. What this means is that each 'DES' operation + inside the cbc mode is really an C=E(ks3,D(ks2,E(ks1,M))). + Again, this is cbc mode so an ivec is requires. + This mode is used by SSL. + There is also a des_ede2_cbc_encrypt() that only uses 2 + des_key_schedule's, the first being reused for the final + encryption. C=E(ks1,D(ks2,E(ks1,M))). This form of triple DES + is used by the RSAref library. + +void des_pcbc_encrypt( +des_cblock *input, +des_cblock *output, +long length, +des_key_schedule ks, +des_cblock *ivec, +int enc); + This is Propagating Cipher Block Chaining mode of DES. It is used + by Kerberos v4. It's parameters are the same as des_ncbc_encrypt(). + +void des_cfb_encrypt( +unsigned char *in, +unsigned char *out, +int numbits, +long length, +des_key_schedule ks, +des_cblock *ivec, +int enc); + Cipher Feedback Back mode of DES. This implementation 'feeds back' + in numbit blocks. The input (and output) is in multiples of numbits + bits. numbits should to be a multiple of 8 bits. Length is the + number of bytes input. If numbits is not a multiple of 8 bits, + the extra bits in the bytes will be considered padding. So if + numbits is 12, for each 2 input bytes, the 4 high bits of the + second byte will be ignored. So to encode 72 bits when using + a numbits of 12 take 12 bytes. To encode 72 bits when using + numbits of 9 will take 16 bytes. To encode 80 bits when using + numbits of 16 will take 10 bytes. etc, etc. This padding will + apply to both input and output. + + +void des_cfb64_encrypt( +unsigned char *in, +unsigned char *out, +long length, +des_key_schedule ks, +des_cblock *ivec, +int *num, +int enc); + This is one of the more useful functions in this DES library, it + implements CFB mode of DES with 64bit feedback. Why is this + useful you ask? Because this routine will allow you to encrypt an + arbitrary number of bytes, no 8 byte padding. Each call to this + routine will encrypt the input bytes to output and then update ivec + and num. num contains 'how far' we are though ivec. If this does + not make much sense, read more about cfb mode of DES :-). + +void des_ede3_cfb64_encrypt( +unsigned char *in, +unsigned char *out, +long length, +des_key_schedule ks1, +des_key_schedule ks2, +des_key_schedule ks3, +des_cblock *ivec, +int *num, +int enc); + Same as des_cfb64_encrypt() accept that the DES operation is + triple DES. As usual, there is a macro for + des_ede2_cfb64_encrypt() which reuses ks1. + +void des_ofb_encrypt( +unsigned char *in, +unsigned char *out, +int numbits, +long length, +des_key_schedule ks, +des_cblock *ivec); + This is a implementation of Output Feed Back mode of DES. It is + the same as des_cfb_encrypt() in that numbits is the size of the + units dealt with during input and output (in bits). + +void des_ofb64_encrypt( +unsigned char *in, +unsigned char *out, +long length, +des_key_schedule ks, +des_cblock *ivec, +int *num); + The same as des_cfb64_encrypt() except that it is Output Feed Back + mode. + +void des_ede3_ofb64_encrypt( +unsigned char *in, +unsigned char *out, +long length, +des_key_schedule ks1, +des_key_schedule ks2, +des_key_schedule ks3, +des_cblock *ivec, +int *num); + Same as des_ofb64_encrypt() accept that the DES operation is + triple DES. As usual, there is a macro for + des_ede2_ofb64_encrypt() which reuses ks1. + +int des_read_pw_string( +char *buf, +int length, +char *prompt, +int verify); + This routine is used to get a password from the terminal with echo + turned off. Buf is where the string will end up and length is the + size of buf. Prompt is a string presented to the 'user' and if + verify is set, the key is asked for twice and unless the 2 copies + match, an error is returned. A return code of -1 indicates a + system error, 1 failure due to use interaction, and 0 is success. + +unsigned long des_cbc_cksum( +des_cblock *input, +des_cblock *output, +long length, +des_key_schedule ks, +des_cblock *ivec); + This function produces an 8 byte checksum from input that it puts in + output and returns the last 4 bytes as a long. The checksum is + generated via cbc mode of DES in which only the last 8 byes are + kept. I would recommend not using this function but instead using + the EVP_Digest routines, or at least using MD5 or SHA. This + function is used by Kerberos v4 so that is why it stays in the + library. + +char *des_fcrypt( +const char *buf, +const char *salt +char *ret); + This is my fast version of the unix crypt(3) function. This version + takes only a small amount of space relative to other fast + crypt() implementations. This is different to the normal crypt + in that the third parameter is the buffer that the return value + is written into. It needs to be at least 14 bytes long. This + function is thread safe, unlike the normal crypt. + +char *crypt( +const char *buf, +const char *salt); + This function calls des_fcrypt() with a static array passed as the + third parameter. This emulates the normal non-thread safe semantics + of crypt(3). + +void des_string_to_key( +char *str, +des_cblock *key); + This function takes str and converts it into a DES key. I would + recommend using MD5 instead and use the first 8 bytes of output. + When I wrote the first version of these routines back in 1990, MD5 + did not exist but I feel these routines are still sound. This + routines is compatible with the one in MIT's libdes. + +void des_string_to_2keys( +char *str, +des_cblock *key1, +des_cblock *key2); + This function takes str and converts it into 2 DES keys. + I would recommend using MD5 and using the 16 bytes as the 2 keys. + I have nothing against these 2 'string_to_key' routines, it's just + that if you say that your encryption key is generated by using the + 16 bytes of an MD5 hash, every-one knows how you generated your + keys. + +int des_read_password( +des_cblock *key, +char *prompt, +int verify); + This routine combines des_read_pw_string() with des_string_to_key(). + +int des_read_2passwords( +des_cblock *key1, +des_cblock *key2, +char *prompt, +int verify); + This routine combines des_read_pw_string() with des_string_to_2key(). + +void des_random_seed( +des_cblock key); + This routine sets a starting point for des_random_key(). + +void des_random_key( +des_cblock ret); + This function return a random key. Make sure to 'seed' the random + number generator (with des_random_seed()) before using this function. + I personally now use a MD5 based random number system. + +int des_enc_read( +int fd, +char *buf, +int len, +des_key_schedule ks, +des_cblock *iv); + This function will write to a file descriptor the encrypted data + from buf. This data will be preceded by a 4 byte 'byte count' and + will be padded out to 8 bytes. The encryption is either CBC of + PCBC depending on the value of des_rw_mode. If it is DES_PCBC_MODE, + pcbc is used, if DES_CBC_MODE, cbc is used. The default is to use + DES_PCBC_MODE. + +int des_enc_write( +int fd, +char *buf, +int len, +des_key_schedule ks, +des_cblock *iv); + This routines read stuff written by des_enc_read() and decrypts it. + I have used these routines quite a lot but I don't believe they are + suitable for non-blocking io. If you are after a full + authentication/encryption over networks, have a look at SSL instead. + +unsigned long des_quad_cksum( +des_cblock *input, +des_cblock *output, +long length, +int out_count, +des_cblock *seed); + This is a function from Kerberos v4 that is not anything to do with + DES but was needed. It is a cksum that is quicker to generate than + des_cbc_cksum(); I personally would use MD5 routines now. +===== +Modes of DES +Quite a bit of the following information has been taken from + AS 2805.5.2 + Australian Standard + Electronic funds transfer - Requirements for interfaces, + Part 5.2: Modes of operation for an n-bit block cipher algorithm + Appendix A + +There are several different modes in which DES can be used, they are +as follows. + +Electronic Codebook Mode (ECB) (des_ecb_encrypt()) +- 64 bits are enciphered at a time. +- The order of the blocks can be rearranged without detection. +- The same plaintext block always produces the same ciphertext block + (for the same key) making it vulnerable to a 'dictionary attack'. +- An error will only affect one ciphertext block. + +Cipher Block Chaining Mode (CBC) (des_cbc_encrypt()) +- a multiple of 64 bits are enciphered at a time. +- The CBC mode produces the same ciphertext whenever the same + plaintext is encrypted using the same key and starting variable. +- The chaining operation makes the ciphertext blocks dependent on the + current and all preceding plaintext blocks and therefore blocks can not + be rearranged. +- The use of different starting variables prevents the same plaintext + enciphering to the same ciphertext. +- An error will affect the current and the following ciphertext blocks. + +Cipher Feedback Mode (CFB) (des_cfb_encrypt()) +- a number of bits (j) <= 64 are enciphered at a time. +- The CFB mode produces the same ciphertext whenever the same + plaintext is encrypted using the same key and starting variable. +- The chaining operation makes the ciphertext variables dependent on the + current and all preceding variables and therefore j-bit variables are + chained together and can not be rearranged. +- The use of different starting variables prevents the same plaintext + enciphering to the same ciphertext. +- The strength of the CFB mode depends on the size of k (maximal if + j == k). In my implementation this is always the case. +- Selection of a small value for j will require more cycles through + the encipherment algorithm per unit of plaintext and thus cause + greater processing overheads. +- Only multiples of j bits can be enciphered. +- An error will affect the current and the following ciphertext variables. + +Output Feedback Mode (OFB) (des_ofb_encrypt()) +- a number of bits (j) <= 64 are enciphered at a time. +- The OFB mode produces the same ciphertext whenever the same + plaintext enciphered using the same key and starting variable. More + over, in the OFB mode the same key stream is produced when the same + key and start variable are used. Consequently, for security reasons + a specific start variable should be used only once for a given key. +- The absence of chaining makes the OFB more vulnerable to specific attacks. +- The use of different start variables values prevents the same + plaintext enciphering to the same ciphertext, by producing different + key streams. +- Selection of a small value for j will require more cycles through + the encipherment algorithm per unit of plaintext and thus cause + greater processing overheads. +- Only multiples of j bits can be enciphered. +- OFB mode of operation does not extend ciphertext errors in the + resultant plaintext output. Every bit error in the ciphertext causes + only one bit to be in error in the deciphered plaintext. +- OFB mode is not self-synchronising. If the two operation of + encipherment and decipherment get out of synchronism, the system needs + to be re-initialised. +- Each re-initialisation should use a value of the start variable + different from the start variable values used before with the same + key. The reason for this is that an identical bit stream would be + produced each time from the same parameters. This would be + susceptible to a ' known plaintext' attack. + +Triple ECB Mode (des_ecb3_encrypt()) +- Encrypt with key1, decrypt with key2 and encrypt with key3 again. +- As for ECB encryption but increases the key length to 168 bits. + There are theoretic attacks that can be used that make the effective + key length 112 bits, but this attack also requires 2^56 blocks of + memory, not very likely, even for the NSA. +- If both keys are the same it is equivalent to encrypting once with + just one key. +- If the first and last key are the same, the key length is 112 bits. + There are attacks that could reduce the key space to 55 bit's but it + requires 2^56 blocks of memory. +- If all 3 keys are the same, this is effectively the same as normal + ecb mode. + +Triple CBC Mode (des_ede3_cbc_encrypt()) +- Encrypt with key1, decrypt with key2 and then encrypt with key3. +- As for CBC encryption but increases the key length to 168 bits with + the same restrictions as for triple ecb mode. diff --git a/src/lib/libssl/src/doc/digest.doc b/src/lib/libssl/src/doc/digest.doc new file mode 100644 index 0000000000..d2fb987591 --- /dev/null +++ b/src/lib/libssl/src/doc/digest.doc @@ -0,0 +1,94 @@ + +The Message Digest subroutines. + +These routines require "evp.h" to be included. + +These functions are a higher level interface to the various message digest +routines found in this library. As such, they allow the same code to be +used to digest via different algorithms with only a change in an initial +parameter. They are basically just a front-end to the MD2, MD5, SHA +and SHA1 +routines. + +These routines all take a pointer to the following structure to specify +which message digest algorithm to use. +typedef struct evp_md_st + { + int type; + int pkey_type; + int md_size; + void (*init)(); + void (*update)(); + void (*final)(); + + int required_pkey_type; /*EVP_PKEY_xxx */ + int (*sign)(); + int (*verify)(); + } EVP_MD; + +If additional message digest algorithms are to be supported, a structure of +this type needs to be declared and populated and then the Digest routines +can be used with that algorithm. The type field is the object NID of the +digest type (read the section on Objects for an explanation). The pkey_type +is the Object type to use when the a message digest is generated by there +routines and then is to be signed with the pkey algorithm. Md_size is +the size of the message digest returned. Init, update +and final are the relevant functions to perform the message digest function +by parts. One reason for specifying the message digest to use via this +mechanism is that if you only use md5, only the md5 routines will +be included in you linked program. If you passed an integer +that specified which message digest to use, the routine that mapped that +integer to a set of message digest functions would cause all the message +digests functions to be link into the code. This setup also allows new +message digest functions to be added by the application. + +The six message digests defined in this library are + +EVP_MD *EVP_md2(void); /* RSA sign/verify */ +EVP_MD *EVP_md5(void); /* RSA sign/verify */ +EVP_MD *EVP_sha(void); /* RSA sign/verify */ +EVP_MD *EVP_sha1(void); /* RSA sign/verify */ +EVP_MD *EVP_dss(void); /* DSA sign/verify */ +EVP_MD *EVP_dss1(void); /* DSA sign/verify */ + +All the message digest routines take a EVP_MD_CTX pointer as an argument. +The state of the message digest is kept in this structure. + +typedef struct pem_md_ctx_st + { + EVP_MD *digest; + union { + unsigned char base[4]; /* this is used in my library as a + * 'pointer' to all union elements + * structures. */ + MD2_CTX md2; + MD5_CTX md5; + SHA_CTX sha; + } md; + } EVP_MD_CTX; + +The Digest functions are as follows. + +void EVP_DigestInit( +EVP_MD_CTX *ctx, +EVP_MD *type); + This function is used to initialise the EVP_MD_CTX. The message + digest that will associated with 'ctx' is specified by 'type'. + +void EVP_DigestUpdate( +EVP_MD_CTX *ctx, +unsigned char *data, +unsigned int cnt); + This function is used to pass more data to the message digest + function. 'cnt' bytes are digested from 'data'. + +void EVP_DigestFinal( +EVP_MD_CTX *ctx, +unsigned char *md, +unsigned int *len); + This function finishes the digestion and puts the message digest + into 'md'. The length of the message digest is put into len; + EVP_MAX_MD_SIZE is the size of the largest message digest that + can be returned from this function. Len can be NULL if the + size of the digest is not required. + diff --git a/src/lib/libssl/src/doc/encode.doc b/src/lib/libssl/src/doc/encode.doc new file mode 100644 index 0000000000..af17549289 --- /dev/null +++ b/src/lib/libssl/src/doc/encode.doc @@ -0,0 +1,15 @@ + +void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); +void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out, + int *outl,unsigned char *in,int inl); +void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl); +int EVP_EncodeBlock(unsigned char *t, unsigned char *f, int n); + +void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); +int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl, + unsigned char *in, int inl); +int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned + char *out, int *outl); +int EVP_DecodeBlock(unsigned char *t, unsigned + char *f, int n); + diff --git a/src/lib/libssl/src/doc/envelope.doc b/src/lib/libssl/src/doc/envelope.doc new file mode 100644 index 0000000000..483e4fca6b --- /dev/null +++ b/src/lib/libssl/src/doc/envelope.doc @@ -0,0 +1,67 @@ +The following routines are use to create 'digital' envelopes. +By this I mean that they perform various 'higher' level cryptographic +functions. Have a read of 'cipher.doc' and 'digest.doc' since those +routines are used by these functions. +cipher.doc contains documentation about the cipher part of the +envelope library and digest.doc contatins the description of the +message digests supported. + +To 'sign' a document involves generating a message digest and then encrypting +the digest with an private key. + +#define EVP_SignInit(a,b) EVP_DigestInit(a,b) +#define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) +Due to the fact this operation is basically just an extended message +digest, the first 2 functions are macro calls to Digest generating +functions. + +int EVP_SignFinal( +EVP_MD_CTX *ctx, +unsigned char *md, +unsigned int *s, +EVP_PKEY *pkey); + This finalisation function finishes the generation of the message +digest and then encrypts the digest (with the correct message digest +object identifier) with the EVP_PKEY private key. 'ctx' is the message digest +context. 'md' will end up containing the encrypted message digest. This +array needs to be EVP_PKEY_size(pkey) bytes long. 's' will actually +contain the exact length. 'pkey' of course is the private key. It is +one of EVP_PKEY_RSA or EVP_PKEY_DSA type. +If there is an error, 0 is returned, otherwise 1. + +Verify is used to check an signed message digest. + +#define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) +#define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) +Since the first step is to generate a message digest, the first 2 functions +are macros. + +int EVP_VerifyFinal( +EVP_MD_CTX *ctx, +unsigned char *md, +unsigned int s, +EVP_PKEY *pkey); + This function finishes the generation of the message digest and then +compares it with the supplied encrypted message digest. 'md' contains the +'s' bytes of encrypted message digest. 'pkey' is used to public key decrypt +the digest. It is then compared with the message digest just generated. +If they match, 1 is returned else 0. + +int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek, + int *ekl, unsigned char *iv, EVP_PKEY **pubk, int npubk); +Must have at least one public key, error is 0. I should also mention that +the buffers pointed to by 'ek' need to be EVP_PKEY_size(pubk[n]) is size. + +#define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) +void EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl); + + +int EVP_OpenInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type,unsigned char *ek, + int ekl,unsigned char *iv,EVP_PKEY *priv); +0 on failure + +#define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) + +int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); +Decrypt final return code + diff --git a/src/lib/libssl/src/doc/error.doc b/src/lib/libssl/src/doc/error.doc new file mode 100644 index 0000000000..a91654999a --- /dev/null +++ b/src/lib/libssl/src/doc/error.doc @@ -0,0 +1,115 @@ +The error routines. + +The 'error' system I've implemented is intended to server 2 purpose, to +record the reason why a command failed and to record where in the libraries +the failure occurred. It is more or less setup to record a 'trace' of which +library components were being traversed when the error occurred. + +When an error is recorded, it is done so a as single unsigned long which is +composed of three parts. The top byte is the 'library' number, the middle +12 bytes is the function code, and the bottom 12 bits is the 'reason' code. + +Each 'library', or should a say, 'section' of the SSLeay library has a +different unique 'library' error number. Each function in the library has +a number that is unique for that library. Each 'library' also has a number +for each 'error reason' that is only unique for that 'library'. + +Due to the way these error routines record a 'error trace', there is an +array per thread that is used to store the error codes. +The various functions in this library are used to access +and manipulate this array. + +void ERR_put_error(int lib, int func,int reason); + This routine records an error in library 'lib', function 'func' +and reason 'reason'. As errors get 'put' into the buffer, they wrap +around and overwrite old errors if too many are written. It is assumed +that the last errors are the most important. + +unsigned long ERR_get_error(void ); + This function returns the last error added to the error buffer. +In effect it is popping the value off the buffer so repeated calls will +continue to return values until there are no more errors to return in which +case 0 is returned. + +unsigned long ERR_peek_error(void ); + This function returns the value of the last error added to the +error buffer but does not 'pop' it from the buffer. + +void ERR_clear_error(void ); + This function clears the error buffer, discarding all unread +errors. + +While the above described error system obviously produces lots of different +error number, a method for 'reporting' these errors in a human readable +form is required. To achieve this, each library has the option of +'registering' error strings. + +typedef struct ERR_string_data_st + { + unsigned long error; + char *string; + } ERR_STRING_DATA; + +The 'ERR_STRING_DATA' contains an error code and the corresponding text +string. To add new function error strings for a library, the +ERR_STRING_DATA needs to be 'registered' with the library. + +void ERR_load_strings(unsigned long lib,ERR_STRING_DATA *err); + This function 'registers' the array of ERR_STRING_DATA pointed to by +'err' as error text strings for the error library 'lib'. + +void ERR_free_strings(void); + This function free()s all the loaded error strings. + +char *ERR_error_string(unsigned long error,char *buf); + This function returns a text string that is a human readable +version of the error represented by 'error'. Buff should be at least 120 +bytes long and if it is NULL, the return value is a pointer to a static +variable that will contain the error string, otherwise 'buf' is returned. +If there is not a text string registered for a particular error, a text +string containing the error number is returned instead. + +void ERR_print_errors(BIO *bp); +void ERR_print_errors_fp(FILE *fp); + This function is a convenience routine that prints the error string +for each error until all errors have been accounted for. + +char *ERR_lib_error_string(unsigned long e); +char *ERR_func_error_string(unsigned long e); +char *ERR_reason_error_string(unsigned long e); +The above three functions return the 3 different components strings for the +error 'e'. ERR_error_string() uses these functions. + +void ERR_load_ERR_strings(void ); + This function 'registers' the error strings for the 'ERR' module. + +void ERR_load_crypto_strings(void ); + This function 'register' the error strings for just about every +library in the SSLeay package except for the SSL routines. There is no +need to ever register any error text strings and you will probably save in +program size. If on the other hand you do 'register' all errors, it is +quite easy to determine why a particular routine failed. + +As a final footnote as to why the error system is designed as it is. +1) I did not want a single 'global' error code. +2) I wanted to know which subroutine a failure occurred in. +3) For Windows NT etc, it should be simple to replace the 'key' routines + with code to pass error codes back to the application. +4) I wanted the option of meaningful error text strings. + +Late breaking news - the changes to support threads. + +Each 'thread' has an 'ERR_STATE' state associated with it. +ERR_STATE *ERR_get_state(void ) will return the 'state' for the calling +thread/process. + +ERR_remove_state(unsigned long pid); will 'free()' this state. If pid == 0 +the current 'thread/process' will have it's error state removed. +If you do not remove the error state of a thread, this could be considered a +form of memory leak, so just after 'reaping' a thread that has died, +call ERR_remove_state(pid). + +Have a read of thread.doc for more details for what is required for +multi-threading support. All the other error routines will +work correctly when using threads. + diff --git a/src/lib/libssl/src/doc/legal.doc b/src/lib/libssl/src/doc/legal.doc new file mode 100644 index 0000000000..b55ed5ce6a --- /dev/null +++ b/src/lib/libssl/src/doc/legal.doc @@ -0,0 +1,117 @@ +From eay@mincom.com Thu Jun 27 00:25:45 1996 +Received: by orb.mincom.oz.au id AA15821 + (5.65c/IDA-1.4.4 for eay); Wed, 26 Jun 1996 14:25:45 +1000 +Date: Wed, 26 Jun 1996 14:25:45 +1000 (EST) +From: Eric Young <eay@mincom.oz.au> +X-Sender: eay@orb +To: Ken Toll <ktoll@ren.digitalage.com> +Cc: Eric Young <eay@mincom.oz.au>, ssl-talk@netscape.com +Subject: Re: Unidentified subject! +In-Reply-To: <9606261950.ZM28943@ren.digitalage.com> +Message-Id: <Pine.SOL.3.91.960626131156.28573K-100000@orb> +Mime-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +Status: O +X-Status: + + +This is a little off topic but since SSLeay is a free implementation of +the SSLv2 protocol, I feel it is worth responding on the topic of if it +is actually legal for Americans to use free cryptographic software. + +On Wed, 26 Jun 1996, Ken Toll wrote: +> Is the U.S the only country that SSLeay cannot be used commercially +> (because of RSAref) or is that going to be an issue with every country +> that a client/server application (non-web browser/server) is deployed +> and sold? + +>From what I understand, the software patents that apply to algorithms +like RSA and DH only apply in the USA. The IDEA algorithm I believe is +patened in europe (USA?), but considing how little it is used by other SSL +implementations, it quite easily be left out of the SSLeay build +(this can be done with a compile flag). + +Actually if the RSA patent did apply outside the USA, it could be rather +interesting since RSA is not alowed to let RSA toolkits outside of the USA +[1], and since these are the only forms that they will alow the algorithm +to be used in, it would mean that non-one outside of the USA could produce +public key software which would be a very strong statment for +international patent law to make :-). This logic is a little flawed but +it still points out some of the more interesting permutations of USA +patent law and ITAR restrictions. + +Inside the USA there is also the unresolved issue of RC4/RC2 which were +made public on sci.crypt in Sep 1994 (RC4) and Feb 1996 (RC2). I have +copies of the origional postings if people are interested. RSA I believe +claim that they were 'trade-secrets' and that some-one broke an NDA in +revealing them. Other claim they reverse engineered the algorithms from +compiled binaries. If the algorithms were reverse engineered, I belive +RSA had no legal leg to stand on. If an NDA was broken, I don't know. +Regardless, RSA, I belive, is willing to go to court over the issue so +licencing is probably the best idea, or at least talk to them. +If there are people who actually know more about this, pease let me know, I +don't want to vilify or spread miss-information if I can help it. + +If you are not producing a web browser, it is easy to build SSLeay with +RC2/RC4 removed. Since RC4 is the defacto standard cipher in +all web software (and it is damn fast) it is more or less required for +www use. For non www use of SSL, especially for an application where +interoperability with other vendors is not critical just leave it out. + +Removing IDEA, RC2 and RC4 would only leave DES and Triple DES but +they should be ok. Considing that Triple DES can encrypt at rates of +410k/sec on a pentium 100, and 940k/sec on a P6/200, this is quite +reasonable performance. Single DES clocks in at 1160k/s and 2467k/s +respectivly is actually quite fast for those not so paranoid (56 bit key).[1] + +> Is it possible to get a certificate for commercial use outside of the U.S.? +yes. + +Thawte Consulting issues certificates (they are the people who sell the + Sioux httpd server and are based in South Africa) +Verisign will issue certificates for Sioux (sold from South Africa), so this + proves that they will issue certificate for OS use if they are + happy with the quality of the software. + +(The above mentioned companies just the ones that I know for sure are issuing + certificates outside the USA). + +There is always the point that if you are using SSL for an intra net, +SSLeay provides programs that can be used so you can issue your own +certificates. They need polishing but at least it is a good starting point. + +I am not doing anything outside Australian law by implementing these +algorithms (to the best of my knowedge). It is another example of how +the world legal system does not cope with the internet very well. + +I may start making shared libraries available (I have now got DLL's for +Windows). This will mean that distributions into the usa could be +shipped with a version with a reduced cipher set and the versions outside +could use the DLL/shared library with all the ciphers (and without RSAref). + +This could be completly hidden from the application, so this would not +even require a re-linking. + +This is the reverse of what people were talking about doing to get around +USA export regulations :-) + +eric + +[1]: The RSAref2.0 tookit is available on at least 3 ftp sites in Europe + and one in South Africa. + +[2]: Since I always get questions when I post benchmark numbers :-), + DES performace figures are in 1000's of bytes per second in cbc + mode using an 8192 byte buffer. The pentium 100 was running Windows NT + 3.51 DLLs and the 686/200 was running NextStep. + I quote pentium 100 benchmarks because it is basically the + 'entry level' computer that most people buy for personal use. + Windows 95 is the OS shipping on those boxes, so I'll give + NT numbers (the same Win32 runtime environment). The 686 + numbers are present as an indication of where we will be in a + few years. +-- +Eric Young | BOOL is tri-state according to Bill Gates. +AARNet: eay@mincom.oz.au | RTFM Win32 GetMessage(). + + diff --git a/src/lib/libssl/src/doc/lhash.doc b/src/lib/libssl/src/doc/lhash.doc new file mode 100644 index 0000000000..5a2aeb4b38 --- /dev/null +++ b/src/lib/libssl/src/doc/lhash.doc @@ -0,0 +1,151 @@ +The LHASH library. + +I wrote this library in 1991 and have since forgotten why I called it lhash. +It implements a hash table from an article I read at the +time from 'Communications of the ACM'. What makes this hash +table different is that as the table fills, the hash table is +increased (or decreased) in size via realloc(). +When a 'resize' is done, instead of all hashes being redistributed over +twice as many 'buckets', one bucket is split. So when an 'expand' is done, +there is only a minimal cost to redistribute some values. Subsequent +inserts will cause more single 'bucket' redistributions but there will +never be a sudden large cost due to redistributing all the 'buckets'. + +The state for a particular hash table is kept in the LHASH structure. +The LHASH structure also records statistics about most aspects of accessing +the hash table. This is mostly a legacy of my writing this library for +the reasons of implementing what looked like a nice algorithm rather than +for a particular software product. + +Internal stuff you probably don't want to know about. +The decision to increase or decrease the hash table size is made depending +on the 'load' of the hash table. The load is the number of items in the +hash table divided by the size of the hash table. The default values are +as follows. If (hash->up_load < load) => expand. +if (hash->down_load > load) => contract. The 'up_load' has a default value of +1 and 'down_load' has a default value of 2. These numbers can be modified +by the application by just playing with the 'up_load' and 'down_load' +variables. The 'load' is kept in a form which is multiplied by 256. So +hash->up_load=8*256; will cause a load of 8 to be set. + +If you are interested in performance the field to watch is +num_comp_calls. The hash library keeps track of the 'hash' value for +each item so when a lookup is done, the 'hashes' are compared, if +there is a match, then a full compare is done, and +hash->num_comp_calls is incremented. If num_comp_calls is not equal +to num_delete plus num_retrieve it means that your hash function is +generating hashes that are the same for different values. It is +probably worth changing your hash function if this is the case because +even if your hash table has 10 items in a 'bucked', it can be searched +with 10 'unsigned long' compares and 10 linked list traverses. This +will be much less expensive that 10 calls to you compare function. + +LHASH *lh_new( +unsigned long (*hash)(), +int (*cmp)()); + This function is used to create a new LHASH structure. It is passed + function pointers that are used to store and retrieve values passed + into the hash table. The 'hash' + function is a hashing function that will return a hashed value of + it's passed structure. 'cmp' is passed 2 parameters, it returns 0 + is they are equal, otherwise, non zero. + If there are any problems (usually malloc failures), NULL is + returned, otherwise a new LHASH structure is returned. The + hash value is normally truncated to a power of 2, so make sure + that your hash function returns well mixed low order bits. + +void lh_free( +LHASH *lh); + This function free()s a LHASH structure. If there is malloced + data in the hash table, it will not be freed. Consider using the + lh_doall function to deallocate any remaining entries in the hash + table. + +char *lh_insert( +LHASH *lh, +char *data); + This function inserts the data pointed to by data into the lh hash + table. If there is already and entry in the hash table entry, the + value being replaced is returned. A NULL is returned if the new + entry does not clash with an entry already in the table (the normal + case) or on a malloc() failure (perhaps I should change this....). + The 'char *data' is exactly what is passed to the hash and + comparison functions specified in lh_new(). + +char *lh_delete( +LHASH *lh, +char *data); + This routine deletes an entry from the hash table. The value being + deleted is returned. NULL is returned if there is no such value in + the hash table. + +char *lh_retrieve( +LHASH *lh, +char *data); + If 'data' is in the hash table it is returned, else NULL is + returned. The way these routines would normally be uses is that a + dummy structure would have key fields populated and then + ret=lh_retrieve(hash,&dummy);. Ret would now be a pointer to a fully + populated structure. + +void lh_doall( +LHASH *lh, +void (*func)(char *a)); + This function will, for every entry in the hash table, call function + 'func' with the data item as parameters. + This function can be quite useful when used as follows. + void cleanup(STUFF *a) + { STUFF_free(a); } + lh_doall(hash,cleanup); + lh_free(hash); + This can be used to free all the entries, lh_free() then + cleans up the 'buckets' that point to nothing. Be careful + when doing this. If you delete entries from the hash table, + in the call back function, the table may decrease in size, + moving item that you are + currently on down lower in the hash table. This could cause + some entries to be skipped. The best solution to this problem + is to set lh->down_load=0 before you start. This will stop + the hash table ever being decreased in size. + +void lh_doall_arg( +LHASH *lh; +void(*func)(char *a,char *arg)); +char *arg; + This function is the same as lh_doall except that the function + called will be passed 'arg' as the second argument. + +unsigned long lh_strhash( +char *c); + This function is a demo string hashing function. Since the LHASH + routines would normally be passed structures, this routine would + not normally be passed to lh_new(), rather it would be used in the + function passed to lh_new(). + +The next three routines print out various statistics about the state of the +passed hash table. These numbers are all kept in the lhash structure. + +void lh_stats( +LHASH *lh, +FILE *out); + This function prints out statistics on the size of the hash table, + how many entries are in it, and the number and result of calls to + the routines in this library. + +void lh_node_stats( +LHASH *lh, +FILE *out); + For each 'bucket' in the hash table, the number of entries is + printed. + +void lh_node_usage_stats( +LHASH *lh, +FILE *out); + This function prints out a short summary of the state of the hash + table. It prints what I call the 'load' and the 'actual load'. + The load is the average number of data items per 'bucket' in the + hash table. The 'actual load' is the average number of items per + 'bucket', but only for buckets which contain entries. So the + 'actual load' is the average number of searches that will need to + find an item in the hash table, while the 'load' is the average number + that will be done to record a miss. diff --git a/src/lib/libssl/src/doc/md2.doc b/src/lib/libssl/src/doc/md2.doc new file mode 100644 index 0000000000..b106bc675d --- /dev/null +++ b/src/lib/libssl/src/doc/md2.doc @@ -0,0 +1,49 @@ +The MD2 library. +MD2 is a message digest algorithm that can be used to condense an arbitrary +length message down to a 16 byte hash. The functions all need to be passed +a MD2_CTX which is used to hold the MD2 context during multiple MD2_Update() +function calls. The normal method of use for this library is as follows + +MD2_Init(...); +MD2_Update(...); +... +MD2_Update(...); +MD2_Final(...); + +This library requires the inclusion of 'md2.h'. + +The main negative about MD2 is that it is slow, especially when compared +to MD5. + +The functions are as follows: + +void MD2_Init( +MD2_CTX *c); + This function needs to be called to initiate a MD2_CTX structure for + use. + +void MD2_Update( +MD2_CTX *c; +unsigned char *data; +unsigned long len); + This updates the message digest context being generated with 'len' + bytes from the 'data' pointer. The number of bytes can be any + length. + +void MD2_Final( +unsigned char *md; +MD2_CTX *c; + This function is called when a message digest of the data digested + with MD2_Update() is wanted. The message digest is put in the 'md' + array and is MD2_DIGEST_LENGTH (16) bytes long. + +unsigned char *MD2( +unsigned long n; +unsigned char *d; +unsigned char *md; + This function performs a MD2_Init(), followed by a MD2_Update() + followed by a MD2_Final() (using a local MD2_CTX). + The resulting digest is put into 'md' if it is not NULL. + Regardless of the value of 'md', the message + digest is returned from the function. If 'md' was NULL, the message + digest returned is being stored in a static structure. diff --git a/src/lib/libssl/src/doc/md5.doc b/src/lib/libssl/src/doc/md5.doc new file mode 100644 index 0000000000..519dbdc61a --- /dev/null +++ b/src/lib/libssl/src/doc/md5.doc @@ -0,0 +1,50 @@ +The MD5 library. +MD5 is a message digest algorithm that can be used to condense an arbitrary +length message down to a 16 byte hash. The functions all need to be passed +a MD5_CTX which is used to hold the MD5 context during multiple MD5_Update() +function calls. This library also contains random number routines that are +based on MD5 + +The normal method of use for this library is as follows + +MD5_Init(...); +MD5_Update(...); +... +MD5_Update(...); +MD5_Final(...); + +This library requires the inclusion of 'md5.h'. + +The functions are as follows: + +void MD5_Init( +MD5_CTX *c); + This function needs to be called to initiate a MD5_CTX structure for + use. + +void MD5_Update( +MD5_CTX *c; +unsigned char *data; +unsigned long len); + This updates the message digest context being generated with 'len' + bytes from the 'data' pointer. The number of bytes can be any + length. + +void MD5_Final( +unsigned char *md; +MD5_CTX *c; + This function is called when a message digest of the data digested + with MD5_Update() is wanted. The message digest is put in the 'md' + array and is MD5_DIGEST_LENGTH (16) bytes long. + +unsigned char *MD5( +unsigned char *d; +unsigned long n; +unsigned char *md; + This function performs a MD5_Init(), followed by a MD5_Update() + followed by a MD5_Final() (using a local MD5_CTX). + The resulting digest is put into 'md' if it is not NULL. + Regardless of the value of 'md', the message + digest is returned from the function. If 'md' was NULL, the message + digest returned is being stored in a static structure. + diff --git a/src/lib/libssl/src/doc/memory.doc b/src/lib/libssl/src/doc/memory.doc new file mode 100644 index 0000000000..b9aa33ace0 --- /dev/null +++ b/src/lib/libssl/src/doc/memory.doc @@ -0,0 +1,27 @@ +In the interests of debugging SSLeay, there is an option to compile +using some simple memory leak checking. + +All malloc(), free() and realloc() calls in SSLeay now go via +Malloc(), Free() and Realloc() (except those in crypto/lhash). + +If CRYPTO_MDEBUG is defined, these calls are #defined to +CRYPTO_malloc(), CRYPTO_free() and CRYPTO_realloc(). +If it is not defined, they are #defined to malloc(), free() and realloc(). + +the CRYPTO_malloc() routines by default just call the underlying library +functons. + +If CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON) is called, memory leak detection is +turned on. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF) turns it off. + +When turned on, each Malloc() or Realloc() call is recored along with the file +and line number from where the call was made. (This is done using the +lhash library which always uses normal system malloc(3) routines). + +void CRYPTO_mem_leaks(BIO *b); +void CRYPTO_mem_leaks_fp(FILE *fp); +These both print out the list of memory that has not been free()ed. +This will probably be rather hard to read, but if you look for the 'top level' +structure allocation, this will often give an idea as to what is not being +free()ed. I don't expect people to use this stuff normally. + diff --git a/src/lib/libssl/src/doc/ms3-ca.doc b/src/lib/libssl/src/doc/ms3-ca.doc new file mode 100644 index 0000000000..f8350aadc2 --- /dev/null +++ b/src/lib/libssl/src/doc/ms3-ca.doc @@ -0,0 +1,398 @@ +Date: Mon, 9 Jun 97 08:00:33 +0200 +From: Holger.Reif@PrakInf.TU-Ilmenau.DE (Holger Reif) +Subject: ms3-ca.doc +Organization: TU Ilmenau, Fak. IA, FG Telematik +Content-Length: 14575 +Status: RO +X-Status: + +Loading client certs into MSIE 3.01 +=================================== + +This document conatains all the information necessary to succesfully set up +some scripts to issue client certs to Microsoft Internet Explorer. It +includes the required knowledge about the model MSIE uses for client +certification and includes complete sample scripts ready to play with. The +scripts were tested against a modified ca program of SSLeay 0.6.6 and should +work with the regular ca program that comes with version 0.8.0. I haven't +tested against MSIE 4.0 + +You can use the information contained in this document in either way you +want. However if you feel it saved you a lot of time I ask you to be as fair +as to mention my name: Holger Reif <reif@prakinf.tu-ilmenau.de>. + +1.) The model used by MSIE +-------------------------- + +The Internet Explorer doesn't come with a embedded engine for installing +client certs like Netscape's Navigator. It rather uses the CryptoAPI (CAPI) +defined by Microsoft. CAPI comes with WindowsNT 4.0 or is installed together +with Internet Explorer since 3.01. The advantage of this approach is a higher +flexibility because the certificates in the (per user) system open +certificate store may be used by other applications as well. The drawback +however is that you need to do a bit more work to get a client cert issued. + +CAPI defines functions which will handle basic cryptographic work, eg. +generating keys, encrypting some data, signing text or building a certificate +request. The procedure is as follows: A CAPI function generates you a key +pair and saves it into the certificate store. After that one builds a +Distinguished Name. Together with that key pair another CAPI function forms a +PKCS#10 request which you somehow need to submit to a CA. Finally the issued +cert is given to a yet another CAPI function which saves it into the +certificate store. + +The certificate store with the user's keys and certs is in the registry. You +will find it under HKEY_CURRENT_USER/Software/Microsoft/Cryptography/ (I +leave it to you as a little exercise to figure out what all the entries mean +;-). Note that the keys are protected only with the user's usual Windows +login password. + +2.) The practical usage +----------------------- + +Unfortunatly since CAPI is a system API you can't access its functions from +HTML code directly. For this purpose Microsoft provides a wrapper called +certenr3.dll. This DLL accesses the CAPI functions and provides an interface +usable from Visual Basic Script. One needs to install that library on the +computer which wants to have client cert. The easiest way is to load it as an +ActiveX control (certenr3.dll is properly authenticode signed by MS ;-). If +you have ever enrolled e cert request at a CA you will have installed it. + +At time of writing certenr3.dll is contained in +http://www.microsoft.com/workshop/prog/security/csa/certenr3.exe. It comes +with an README file which explains the available functions. It is labeled +beta but every CA seems to use it anyway. The license.txt allows you the +usage for your own purposes (as far as I understood) and a somehow limited +distribution. + +The two functions of main interest are GenerateKeyPair and AcceptCredentials. +For complete explanation of all possible parameters see the README file. Here +are only minimal required parameters and their values. + +GenerateKeyPair(sessionID, FASLE, szName, 0, "ClientAuth", TRUE, FALSE, 1) +- sessionID is a (locally to that computer) unique string to correlate the +generated key pair with a cert installed later. +- szName is the DN of the form "C=DE; S=Thueringen; L=Ilmenau; CN=Holger +Reif; 1.2.840.113549.1.9.1=reif@prakinf.tu-ilmenau.de". Note that S is the +abreviation for StateOrProvince. The recognized abreviation include CN, O, C, +OU, G, I, L, S, T. If the abreviation is unknown (eg. for PKCS#9 email addr) +you need to use the full object identifier. The starting point for searching +them could be crypto/objects.h since all OIDs know to SSLeay are listed +there. +- note: the possible ninth parameter which should give a default name to the +certificate storage location doesn't seem to work. Changes to the constant +values in the call above doesn't seem to make sense. You can't generate +PKCS#10 extensions with that function. + +The result of GenerateKeyPair is the base64 encoded PKCS#10 request. However +it has a little strange format that SSLeay doesn't accept. (BTW I feel the +decision of rejecting that format as standard conforming.) It looks like +follows: + 1st line with 76 chars + 2nd line with 76 chars + ... + (n-2)th line with 76 chars + (n-1)th line contains a multiple of 4 chars less then 76 (possible +empty) + (n)th line has zero or 4 chars (then with 1 or 2 equal signs - the + original text's lenght wasn'T a multiple of 3) + The line separator has two chars: 0x0d 0x0a + +AcceptCredentials(sessionID, credentials, 0, FALSE) +- sessionID needs to be the same as while generating the key pair +- credentials is the base64 encoded PKCS#7 object containing the cert. + +CRL's and CA certs are not required simply just the client cert. (It seems to +me that both are not even checked somehow.) The only format of the base64 +encoded object I succesfully used was all characters in a very long string +without line feeds or carriage returns. (Hey, it doesn't matter, only a +computer reads it!) + +The result should be S_OK. For error handling see the example that comes with +certenr3.dll. + +A note about ASN.1 character encodings. certenr3.dll seems to know only about +2 of them: UniversalString and PrintableString. First it is definitely wrong +for an email address which is IA5STRING (checked by ssleay's ca). Second +unfortunately MSIE (at least until version 3.02) can't handle UniversalString +correctly - they just blow up you cert store! Therefore ssleay's ca (starting +from version 0.8.0) tries to convert the encodings automatically to IA5STRING +or TeletexString. The beef is it will work only for the latin-1 (western) +charset. Microsoft still has to do abit of homework... + +3.) An example +-------------- + +At least you need two steps: generating the key & request and then installing +the certificate. A real world CA would have some more steps involved, eg. +accepting some license. Note that both scripts shown below are just +experimental state without any warrenty! + +First how to generate a request. Note that we can't use a static page because +of the sessionID. I generate it from system time plus pid and hope it is +unique enough. Your are free to feed it through md5 to get more impressive +ID's ;-) Then the intended text is read in with sed which inserts the +sessionID. + +-----BEGIN ms-enroll.cgi----- +#!/bin/sh +SESSION_ID=`date '+%y%m%d%H%M%S'`$$ +echo Content-type: text/html +echo +sed s/template_for_sessId/$SESSION_ID/ <<EOF +<HTML><HEAD> +<TITLE>Certificate Enrollment Test Page</TITLE> +</HEAD><BODY> + +<OBJECT + classid="clsid:33BEC9E0-F78F-11cf-B782-00C04FD7BF43" + codebase=certenr3.dll + id=certHelper + > +</OBJECT> + +<CENTER> +<H2>enrollment for a personal cert</H2> +<BR><HR WIDTH=50%><BR><P> +<FORM NAME="MSIE_Enrollment" ACTION="ms-gencert.cgi" ENCTYPE=x-www-form- +encoded METHOD=POST> +<TABLE> + <TR><TD>Country</TD><TD><INPUT NAME="Country" VALUE=""></TD></TR> + <TR><TD>State</TD><TD><INPUT NAME="StateOrProvince" VALUE=""></TD></TR> + <TR><TD>Location</TD><TD><INPUT NAME="Location" VALUE=""></TD></TR> + <TR><TD>Organization</TD><TD><INPUT NAME="Organization" +VALUE=""></TD></TR> + <TR><TD>Organizational Unit</TD> + <TD><INPUT NAME="OrganizationalUnit" VALUE=""></TD></TR> + <TR><TD>Name</TD><TD><INPUT NAME="CommonName" VALUE=""></TD></TR> + <TR><TD>eMail Address</TD> + <TD><INPUT NAME="EmailAddress" VALUE=""></TD></TR> + <TR><TD></TD> + <TD><INPUT TYPE="BUTTON" NAME="submit" VALUE="Beantragen"></TD></TR> +</TABLE> + <INPUT TYPE="hidden" NAME="SessionId" VALUE="template_for_sessId"> + <INPUT TYPE="hidden" NAME="Request" VALUE=""> +</FORM> +<BR><HR WIDTH=50%><BR><P> +</CENTER> + +<SCRIPT LANGUAGE=VBS> + Dim DN + + Sub Submit_OnClick + Dim TheForm + Set TheForm = Document.MSIE_Enrollment + sessionId = TheForm.SessionId.value + reqHardware = FALSE + C = TheForm.Country.value + SP = TheForm.StateOrProvince.value + L = TheForm.Location.value + O = TheForm.Organization.value + OU = TheForm.OrganizationalUnit.value + CN = TheForm.CommonName.value + Email = TheForm.EmailAddress.value + szPurpose = "ClientAuth" + doAcceptanceUINow = FALSE + doOnline = TRUE + + DN = "" + + Call Add_RDN("C", C) + Call Add_RDN("S", SP) + Call Add_RDN("L", L) + Call Add_RDN("O", O) + Call Add_RDN("OU", OU) + Call Add_RDN("CN", CN) + Call Add_RDN("1.2.840.113549.1.9.1", Email) + ' rsadsi + ' pkcs + ' pkcs9 + ' eMailAddress + On Error Resume Next + sz10 = certHelper.GenerateKeyPair(sessionId, _ + FALSE, DN, 0, ClientAuth, FASLE, TRUE, 1)_ + theError = Err.Number + On Error Goto 0 + if (sz10 = Empty OR theError <> 0) Then + sz = "The error '" & Hex(theError) & "' occurred." & chr(13) & _ + chr(10) & "Your credentials could not be generated." + result = MsgBox(sz, 0, "Credentials Enrollment") + Exit Sub + else + TheForm.Request.value = sz10 + TheForm.Submit + end if + End Sub + + Sub Add_RDN(sn, value) + if (value <> "") then + if (DN <> "") then + DN = DN & "; " + end if + DN = DN & sn & "=" & value + end if + End Sub +</SCRIPT> +</BODY> +</HTML> +EOF +-----END ms-enroll.cgi----- + +Second, how to extract the request and feed the certificate back? We need to +"normalize" the base64 encoding of the PKCS#10 format which means +regenerating the lines and wrapping with BEGIN and END line. This is done by +gawk. The request is taken by ca the normal way. Then the cert needs to be +packed into a PKCS#7 structure (note: the use of a CRL is necessary for +crl2pkcs7 as of version 0.6.6. Starting with 0.8.0 it it might probably be +ommited). Finally we need to format the PKCS#7 object and generate the HTML +text. I use two templates to have a clearer script. + +1st note: postit2 is slightly modified from a program I found at ncsa's ftp +site. Grab it from http://www.easterngraphics.com/certs/IX9704/postit2.c. You +need utils.c from there too. + +2nd note: I'm note quite sure wether the gawk script really handles all +possible inputs for the request right! Today I don't use this construction +anymore myself. + +3d note: the cert must be of version 3! This could be done with the nsComment +line in ssleay.cnf... + +------BEGIN ms-gencert.cgi----- +#!/bin/sh +FILE="/tmp/"`date '+%y%m%d%H%M%S'-`$$ +rm -f "$FILE".* + +HOME=`pwd`; export HOME # as ssleay.cnf insists on having such an env var +cd /usr/local/ssl #where demoCA (as named in ssleay.conf) is located + +postit2 -s " " -i 0x0d > "$FILE".inp # process the FORM vars + +SESSION_ID=`gawk '$1 == "SessionId" { print $2; exit }' "$FILE".inp` + +gawk \ + 'BEGIN { \ + OFS = ""; \ + print "-----BEGIN CERTIFICATE REQUEST-----"; \ + req_seen=0 \ + } \ + $1 == "Request" { \ + req_seen=1; \ + if (length($2) == 72) print($2); \ + lastline=$2; \ + next; \ + } \ + { \ + if (req_seen == 1) { \ + if (length($1) >= 72) print($1); \ + else if (length(lastline) < 72) { \ + req_seen=0; \ + print (lastline,$1); \ + } \ + lastline=$1; \ + } \ + } \ + END { \ + print "-----END CERTIFICATE REQUEST-----"; \ + }' > "$FILE".pem < "$FILE".inp + +ssleay ca -batch -in "$FILE".pem -key passwd -out "$FILE".out +ssleay crl2pkcs7 -certfile "$FILE".out -out "$FILE".pkcs7 -in demoCA/crl.pem + +sed s/template_for_sessId/$SESSION_ID/ <ms-enroll2a.html >"$FILE".cert +/usr/local/bin/gawk \ + 'BEGIN { \ + OFS = ""; \ + dq = sprintf("%c",34); \ + } \ + $0 ~ "PKCS7" { next; } \ + { \ + print dq$0dq" & _"; \ + }' <"$FILE".pkcs7 >> "$FILE".cert +cat ms-enroll2b.html >>"$FILE".cert + +echo Content-type: text/html +echo Content-length: `wc -c "$FILE".cert` +echo +cat "$FILE".cert +rm -f "$FILE".* +-----END ms-gencert.cgi----- + +----BEGIN ms-enroll2a.html---- +<HTML><HEAD><TITLE>Certificate Acceptance Test Page</TITLE></HEAD><BODY> + +<OBJECT + classid="clsid:33BEC9E0-F78F-11cf-B782-00C04FD7BF43" + codebase=certenr3.dll + id=certHelper + > +</OBJECT> + +<CENTER> +<H2>Your personal certificate</H2> +<BR><HR WIDTH=50%><BR><P> +Press the button! +<P><INPUT TYPE=BUTTON VALUE="Nimm mich!" NAME="InstallCert"> +</CENTER> +<BR><HR WIDTH=50%><BR> + +<SCRIPT LANGUAGE=VBS> + Sub InstallCert_OnClick + + sessionId = "template_for_sessId" +credentials = "" & _ +----END ms-enroll2a.html---- + +----BEGIN ms-enroll2b.html---- +"" + On Error Resume Next + result = certHelper.AcceptCredentials(sessionId, credentials, 0, +FALSE) + if (IsEmpty(result)) Then + sz = "The error '" & Err.Number & "' occurred." & chr(13) & +chr(10) & "This Digital ID could not be registered." + msgOut = MsgBox(sz, 0, "Credentials Registration Error") + navigate "error.html" + else + sz = "Digital ID successfully registered." + msgOut = MsgBox(sz, 0, "Credentials Registration") + navigate "success.html" + end if + Exit Sub + End Sub +</SCRIPT> +</BODY> +</HTML> +----END ms-enroll2b.html---- + +4.) What do do with the cert? +----------------------------- + +The cert is visible (without restarting MSIE) under the following menu: +View->Options->Security->Personal certs. You can examine it's contents at +least partially. + +To use it for client authentication you need to use SSL3.0 (fortunately +SSLeay supports it with 0.8.0). Furthermore MSIE is told to only supports a +kind of automatic selection of certs (I personally wasn't able to test it +myself). But there is a requirement that the issuer of the server cert and +the issuer of the client cert needs to be the same (according to a developer +from MS). Which means: you need may more then one cert to talk to all +servers... + +I'm sure we will get a bit more experience after ApacheSSL is available for +SSLeay 0.8.8. + + +I hope you enjoyed reading and that in future questions on this topic will +rarely appear on ssl-users@moncom.com ;-) + +Ilmenau, 9th of June 1997 +Holger Reif <reif@prakinf.tu-ilmenau.de> +-- +read you later - Holger Reif +---------------------------------------- Signaturprojekt Deutsche Einheit +TU Ilmenau - Informatik - Telematik (Verdamp lang her) +Holger.Reif@PrakInf.TU-Ilmenau.DE Alt wie ein Baum werden, um ueber +http://Remus.PrakInf.TU-Ilmenau.DE/Reif/ alle 7 Bruecken gehen zu koennen + diff --git a/src/lib/libssl/src/doc/ns-ca.doc b/src/lib/libssl/src/doc/ns-ca.doc new file mode 100644 index 0000000000..836883e1a0 --- /dev/null +++ b/src/lib/libssl/src/doc/ns-ca.doc @@ -0,0 +1,154 @@ +The following documentation was supplied by Jeff Barber, who provided the +patch to the CA program to add this functionality. + +eric +-- +Jeff Barber Email: jeffb@issl.atl.hp.com + +Hewlett Packard Phone: (404) 648-9503 +Internet and System Security Lab Fax: (404) 648-9516 + + oo +---------------------cut /\ here for ns-ca.doc ------------------------------ + +This document briefly describes how to use SSLeay to implement a +certificate authority capable of dynamically serving up client +certificates for version 3.0 beta 5 (and presumably later) versions of +the Netscape Navigator. Before describing how this is done, it's +important to understand a little about how the browser implements its +client certificate support. This is documented in some detail in the +URLs based at <URL:http://home.netscape.com/eng/security/certs.html>. +Here's a brief overview: + +- The Navigator supports a new HTML tag "KEYGEN" which will cause + the browser to generate an RSA key pair when you submit a form + containing the tag. The public key, along with an optional + challenge (supposedly provided for use in certificate revocation + but I don't use it) is signed, DER-encoded, base-64 encoded + and sent to the web server as the value of the variable + whose NAME is provided in the KEYGEN tag. The private key is + stored by the browser in a local key database. + + This "Signed Public Key And Challenge" (SPKAC) arrives formatted + into 64 character lines (which are of course URL-encoded when + sent via HTTP -- i.e. spaces, newlines and most punctuatation are + encoded as "%HH" where HH is the hex equivalent of the ASCII code). + Note that the SPKAC does not contain the other usual attributes + of a certificate request, especially the subject name fields. + These must be otherwise encoded in the form for submission along + with the SPKAC. + +- Either immediately (in response to this form submission), or at + some later date (a real CA will probably verify your identity in + some way before issuing the certificate), a web server can send a + certificate based on the public key and other attributes back to + the browser by encoding it in DER (the binary form) and sending it + to the browser as MIME type: + "Content-type: application/x-x509-user-cert" + + The browser uses the public key encoded in the certificate to + associate the certificate with the appropriate private key in + its local key database. Now, the certificate is "installed". + +- When a server wants to require authentication based on client + certificates, it uses the right signals via the SSL protocol to + trigger the Navigator to ask you which certificate you want to + send. Whether the certificate is accepted is dependent on CA + certificates and so forth installed in the server and is beyond + the scope of this document. + + +Now, here's how the SSLeay package can be used to provide client +certficates: + +- You prepare a file for input to the SSLeay ca application. + The file contains a number of "name = value" pairs that identify + the subject. The names here are the same subject name component + identifiers used in the CA section of the lib/ssleay.conf file, + such as "emailAddress", "commonName" "organizationName" and so + forth. Both the long version and the short version (e.g. "Email", + "CN", "O") can be used. + + One more name is supported: this one is "SPKAC". Its value + is simply the value of the base-64 encoded SPKAC sent by the + browser (with all the newlines and other space charaters + removed -- and newline escapes are NOT supported). + + [ As of SSLeay 0.6.4, multiple lines are supported. + Put a \ at the end of each line and it will be joined with the + previous line with the '\n' removed - eay ] + + Here's a sample input file: + +C = US +SP = Georgia +O = Some Organization, Inc. +OU = Netscape Compatibility Group +CN = John X. Doe +Email = jxdoe@someorg.com +SPKAC = MIG0MGAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAwmk6FMJ4uAVIYbcvIOx5+bDGTfvL8X5gE+R67ccMk6rCSGbVQz2cetyQtnI+VIs0NwdD6wjuSuVtVFbLoHonowIDAQABFgAwDQYJKoZIhvcNAQEEBQADQQBFZDUWFl6BJdomtN1Bi53mwijy1rRgJ4YirF15yBEDM3DjAQkKXHYOIX+qpz4KXKnl6EYxTnGSFL5wWt8X2iyx + +- You execute the ca command (either from a CGI program run out of + the web server, or as a later manual task) giving it the above + file as input. For example, if the file were named /tmp/cert.req, + you'd run: + $SSLDIR/bin/ca -spkac /tmp/cert.req -out /tmp/cert + + The output is in DER format (binary) if a -out argument is + provided, as above; otherwise, it's in the PEM format (base-64 + encoded DER). Also, the "-batch" switch is implied by the + "-spkac" so you don't get asked whether to complete the signing + (probably it shouldn't work this way but I was only interested + in hacking together an online CA that could be used for issuing + test certificates). + + The "-spkac" capability doesn't support multiple files (I think). + + Any CHALLENGE provided in the SPKAC is simply ignored. + + The interactions between the identification fields you provide + and those identified in your lib/ssleay.conf are the same as if + you did an ordinary "ca -in infile -out outfile" -- that is, if + something is marked as required in the ssleay.conf file and it + isn't found in the -spkac file, the certificate won't be issued. + +- Now, you pick up the output from /tmp/cert and pass it back to + the Navigator prepending the Content-type string described earlier. + +- In order to run the ca command out of a CGI program, you must + provide a password to decrypt the CA's private key. You can + do this by using "echo MyKeyPassword | $SSLDIR/bin/ca ..." + I think there's a way to not encrypt the key file in the first + place, but I didn't see how to do that, so I made a small change + to the library that allows the password to be accepted from a pipe. + Either way is UTTERLY INSECURE and a real CA would never do that. + + [ You can use the 'ssleay rsa' command to remove the password + from the private key, or you can use the '-key' option to the + ca command to specify the decryption key on the command line + or use the -nodes option when generating the key. + ca will try to clear the command line version of the password + but for quite a few operating systems, this is not possible. + - eric ] + +So, what do you have to do to make use of this stuff to create an online +demo CA capability with SSLeay? + +1 Create an HTML form for your users. The form should contain + fields for all of the required or optional fields in ssleay.conf. + The form must contain a KEYGEN tag somewhere with at least a NAME + attribute. + +2 Create a CGI program to process the form input submitted by the + browser. The CGI program must URL-decode the variables and create + the file described above, containing subject identification info + as well as the SPKAC block. It should then run the the ca program + with the -spkac option. If it works (check the exit status), + return the new certificate with the appropriate MIME type. If not, + return the output of the ca command with MIME type "text/plain". + +3 Set up your web server to accept connections signed by your demo + CA. This probably involves obtaining the PEM-encoded CA certificate + (ordinarily in $SSLDIR/CA/cacert.pem) and installing it into a + server database. See your server manual for instructions. + diff --git a/src/lib/libssl/src/doc/obj.doc b/src/lib/libssl/src/doc/obj.doc new file mode 100644 index 0000000000..bad347c936 --- /dev/null +++ b/src/lib/libssl/src/doc/obj.doc @@ -0,0 +1,69 @@ +The Object library. + +As part of my Crypto library, I found I required a method of identifying various +objects. These objects normally had 3 different values associated with +them, a short text name, a long (or lower case) text name, and an +ASN.1 Object Identifier (which is a sequence of numbers). +This library contains a static list of objects and functions to lookup +according to one type and to return the other types. + +To use these routines, 'Object.h' needs to be included. + +For each supported object, #define entries are defined as follows +#define SN_Algorithm "Algorithm" +#define LN_algorithm "algorithm" +#define NID_algorithm 38 +#define OBJ_algorithm 1L,3L,14L,3L,2L + +SN_ stands for short name. +LN_ stands for either long name or lowercase name. +NID_ stands for Numeric ID. I each object has a unique NID and this + should be used internally to identify objects. +OBJ_ stands for ASN.1 Object Identifier or ASN1_OBJECT as defined in the + ASN1 routines. These values are used in ASN1 encoding. + +The following functions are to be used to return pointers into a static +definition of these types. What this means is "don't try to free() any +pointers returned from these functions. + +ASN1_OBJECT *OBJ_nid2obj( +int n); + Return the ASN1_OBJECT that corresponds to a NID of n. + +char *OBJ_nid2ln( +int n); + Return the long/lower case name of the object represented by the + NID of n. + +char *OBJ_nid2sn( +int n); + Return the short name for the object represented by the NID of n. + +ASN1_OBJECT *OBJ_dup( +ASN1_OBJECT *o); + Duplicate and return a new ASN1_OBJECT that is the same as the + passed parameter. + +int OBJ_obj2nid( +ASN1_OBJECT *o); + Given ASN1_OBJECT o, return the NID that corresponds. + +int OBJ_ln2nid( +char *s); + Given the long/lower case name 's', return the NID of the object. + +int OBJ_sn2nid( +char *s); + Given the short name 's', return the NID of the object. + +char *OBJ_bsearch( +char *key, +char *base, +int num, +int size, +int (*cmp)()); + Since I have come across a few platforms that do not have the + bsearch() function, OBJ_bsearch is my version of that function. + Feel free to use this function, but you may as well just use the + normal system bsearch(3) if it is present. This version also + has tolerance of being passed NULL pointers. diff --git a/src/lib/libssl/src/doc/rand.doc b/src/lib/libssl/src/doc/rand.doc new file mode 100644 index 0000000000..da02a07f64 --- /dev/null +++ b/src/lib/libssl/src/doc/rand.doc @@ -0,0 +1,141 @@ +My Random number library. + +These routines can be used to generate pseudo random numbers and can be +used to 'seed' the pseudo random number generator (RNG). The RNG make no +effort to reproduce the same random number stream with each execution. +Various other routines in the SSLeay library 'seed' the RNG when suitable +'random' input data is available. Read the section at the end for details +on the design of the RNG. + +void RAND_bytes( +unsigned char *buf, +int num); + This routine puts 'num' random bytes into 'buf'. One should make + sure RAND_seed() has been called before using this routine. + +void RAND_seed( +unsigned char *buf, +int num); + This routine adds more 'seed' data the RNG state. 'num' bytes + are added to the RNG state, they are taken from 'buf'. This + routine can be called with sensitive data such as user entered + passwords. This sensitive data is in no way recoverable from + the RAND library routines or state. Try to pass as much data + from 'random' sources as possible into the RNG via this function. + Also strongly consider using the RAND_load_file() and + RAND_write_file() routines. + +void RAND_cleanup(); + When a program has finished with the RAND library, if it so + desires, it can 'zero' all RNG state. + +The following 3 routines are convenience routines that can be used to +'save' and 'restore' data from/to the RNG and it's state. +Since the more 'random' data that is feed as seed data the better, why not +keep it around between executions of the program? Of course the +application should pass more 'random' data in via RAND_seed() and +make sure no-one can read the 'random' data file. + +char *RAND_file_name( +char *buf, +int size); + This routine returns a 'default' name for the location of a 'rand' + file. The 'rand' file should keep a sequence of random bytes used + to initialise the RNG. The filename is put in 'buf'. Buf is 'size' + bytes long. Buf is returned if things go well, if they do not, + NULL is returned. The 'rand' file name is generated in the + following way. First, if there is a 'RANDFILE' environment + variable, it is returned. Second, if there is a 'HOME' environment + variable, $HOME/.rand is returned. Third, NULL is returned. NULL + is also returned if a buf would overflow. + +int RAND_load_file( +char *file, +long number); + This function 'adds' the 'file' into the RNG state. It does this by + doing a RAND_seed() on the value returned from a stat() system call + on the file and if 'number' is non-zero, upto 'number' bytes read + from the file. The number of bytes passed to RAND_seed() is returned. + +int RAND_write_file( +char *file), + RAND_write_file() writes N random bytes to the file 'file', where + N is the size of the internal RND state (currently 1k). + This is a suitable method of saving RNG state for reloading via + RAND_load_file(). + +What follows is a description of this RNG and a description of the rational +behind it's design. + +It should be noted that this RNG is intended to be used to generate +'random' keys for various ciphers including generation of DH and RSA keys. + +It should also be noted that I have just created a system that I am happy with. +It may be overkill but that does not worry me. I have not spent that much +time on this algorithm so if there are glaring errors, please let me know. +Speed has not been a consideration in the design of these routines. + +First up I will state the things I believe I need for a good RNG. +1) A good hashing algorithm to mix things up and to convert the RNG 'state' + to random numbers. +2) An initial source of random 'state'. +3) The state should be very large. If the RNG is being used to generate + 4096 bit RSA keys, 2 2048 bit random strings are required (at a minimum). + If your RNG state only has 128 bits, you are obviously limiting the + search space to 128 bits, not 2048. I'm probably getting a little + carried away on this last point but it does indicate that it may not be + a bad idea to keep quite a lot of RNG state. It should be easier to + break a cipher than guess the RNG seed data. +4) Any RNG seed data should influence all subsequent random numbers + generated. This implies that any random seed data entered will have + an influence on all subsequent random numbers generated. +5) When using data to seed the RNG state, the data used should not be + extractable from the RNG state. I believe this should be a + requirement because one possible source of 'secret' semi random + data would be a private key or a password. This data must + not be disclosed by either subsequent random numbers or a + 'core' dump left by a program crash. +6) Given the same initial 'state', 2 systems should deviate in their RNG state + (and hence the random numbers generated) over time if at all possible. +7) Given the random number output stream, it should not be possible to determine + the RNG state or the next random number. + + +The algorithm is as follows. + +There is global state made up of a 1023 byte buffer (the 'state'), a +working message digest ('md') and a counter ('count'). + +Whenever seed data is added, it is inserted into the 'state' as +follows. + The input is chopped up into units of 16 bytes (or less for + the last block). Each of these blocks is run through the MD5 + message digest. The data passed to the MD5 digest is the + current 'md', the same number of bytes from the 'state' + (the location determined by in incremented looping index) as + the current 'block' and the new key data 'block'. The result + of this is kept in 'md' and also xored into the 'state' at the + same locations that were used as input into the MD5. + I believe this system addresses points 1 (MD5), 3 (the 'state'), + 4 (via the 'md'), 5 (by the use of MD5 and xor). + +When bytes are extracted from the RNG, the following process is used. +For each group of 8 bytes (or less), we do the following, + Input into MD5, the top 8 bytes from 'md', the byte that are + to be overwritten by the random bytes and bytes from the + 'state' (incrementing looping index). From this digest output + (which is kept in 'md'), the top (upto) 8 bytes are + returned to the caller and the bottom (upto) 8 bytes are xored + into the 'state'. + Finally, after we have finished 'generation' random bytes for the + called, 'count' (which is incremented) and 'md' are fed into MD5 and + the results are kept in 'md'. + I believe the above addressed points 1 (use of MD5), 6 (by + hashing into the 'state' the 'old' data from the caller that + is about to be overwritten) and 7 (by not using the 8 bytes + given to the caller to update the 'state', but they are used + to update 'md'). + +So of the points raised, only 2 is not addressed, but sources of +random data will always be a problem. + diff --git a/src/lib/libssl/src/doc/rc2.doc b/src/lib/libssl/src/doc/rc2.doc new file mode 100644 index 0000000000..efab015bd1 --- /dev/null +++ b/src/lib/libssl/src/doc/rc2.doc @@ -0,0 +1,165 @@ +The RC2 library. + +RC2 is a block cipher that operates on 64bit (8 byte) quantities. It +uses variable size key, but 128bit (16 byte) key would normally be considered +good. It can be used in all the modes that DES can be used. This +library implements the ecb, cbc, cfb64, ofb64 modes. + +I have implemented this library from an article posted to sci.crypt on +11-Feb-1996. I personally don't know how far to trust the RC2 cipher. +While it is capable of having a key of any size, not much reseach has +publically been done on it at this point in time (Apr-1996) +since the cipher has only been public for a few months :-) +It is of a similar speed to DES and IDEA, so unless it is required for +meeting some standard (SSLv2, perhaps S/MIME), it would probably be advisable +to stick to IDEA, or for the paranoid, Tripple DES. + +Mind you, having said all that, I should mention that I just read alot and +implement ciphers, I'm a 'babe in the woods' when it comes to evaluating +ciphers :-). + +For all calls that have an 'input' and 'output' variables, they can be the +same. + +This library requires the inclusion of 'rc2.h'. + +All of the encryption functions take what is called an RC2_KEY as an +argument. An RC2_KEY is an expanded form of the RC2 key. +For all modes of the RC2 algorithm, the RC2_KEY used for +decryption is the same one that was used for encryption. + +The define RC2_ENCRYPT is passed to specify encryption for the functions +that require an encryption/decryption flag. RC2_DECRYPT is passed to +specify decryption. + +Please note that any of the encryption modes specified in my DES library +could be used with RC2. I have only implemented ecb, cbc, cfb64 and +ofb64 for the following reasons. +- ecb is the basic RC2 encryption. +- cbc is the normal 'chaining' form for block ciphers. +- cfb64 can be used to encrypt single characters, therefore input and output + do not need to be a multiple of 8. +- ofb64 is similar to cfb64 but is more like a stream cipher, not as + secure (not cipher feedback) but it does not have an encrypt/decrypt mode. +- If you want triple RC2, thats 384 bits of key and you must be totally + obsessed with security. Still, if you want it, it is simple enough to + copy the function from the DES library and change the des_encrypt to + RC2_encrypt; an exercise left for the paranoid reader :-). + +The functions are as follows: + +void RC2_set_key( +RC2_KEY *ks; +int len; +unsigned char *key; +int bits; + RC2_set_key converts an 'len' byte key into a RC2_KEY. + A 'ks' is an expanded form of the 'key' which is used to + perform actual encryption. It can be regenerated from the RC2 key + so it only needs to be kept when encryption or decryption is about + to occur. Don't save or pass around RC2_KEY's since they + are CPU architecture dependent, 'key's are not. RC2 is an + interesting cipher in that it can be used with a variable length + key. 'len' is the length of 'key' to be used as the key. + A 'len' of 16 is recomended. The 'bits' argument is an + interesting addition which I only found out about in Aug 96. + BSAFE uses this parameter to 'limit' the number of bits used + for the key. To use the 'key' unmodified, set bits to 1024. + This is what old versions of my RC2 library did (SSLeay 0.6.3). + RSAs BSAFE library sets this parameter to be 128 if 128 bit + keys are being used. So to be compatable with BSAFE, set it + to 128, if you don't want to reduce RC2's key length, leave it + at 1024. + +void RC2_encrypt( +unsigned long *data, +RC2_KEY *key, +int encrypt); + This is the RC2 encryption function that gets called by just about + every other RC2 routine in the library. You should not use this + function except to implement 'modes' of RC2. I say this because the + functions that call this routine do the conversion from 'char *' to + long, and this needs to be done to make sure 'non-aligned' memory + access do not occur. + Data is a pointer to 2 unsigned long's and key is the + RC2_KEY to use. Encryption or decryption is indicated by 'encrypt'. + which can have the values RC2_ENCRYPT or RC2_DECRYPT. + +void RC2_ecb_encrypt( +unsigned char *in, +unsigned char *out, +RC2_KEY *key, +int encrypt); + This is the basic Electronic Code Book form of RC2 (in DES this + mode is called Electronic Code Book so I'm going to use the term + for rc2 as well. + Input is encrypted into output using the key represented by + key. Depending on the encrypt, encryption or + decryption occurs. Input is 8 bytes long and output is 8 bytes. + +void RC2_cbc_encrypt( +unsigned char *in, +unsigned char *out, +long length, +RC2_KEY *ks, +unsigned char *ivec, +int encrypt); + This routine implements RC2 in Cipher Block Chaining mode. + Input, which should be a multiple of 8 bytes is encrypted + (or decrypted) to output which will also be a multiple of 8 bytes. + The number of bytes is in length (and from what I've said above, + should be a multiple of 8). If length is not a multiple of 8, bad + things will probably happen. ivec is the initialisation vector. + This function updates iv after each call so that it can be passed to + the next call to RC2_cbc_encrypt(). + +void RC2_cfb64_encrypt( +unsigned char *in, +unsigned char *out, +long length, +RC2_KEY *schedule, +unsigned char *ivec, +int *num, +int encrypt); + This is one of the more useful functions in this RC2 library, it + implements CFB mode of RC2 with 64bit feedback. + This allows you to encrypt an arbitrary number of bytes, + you do not require 8 byte padding. Each call to this + routine will encrypt the input bytes to output and then update ivec + and num. Num contains 'how far' we are though ivec. + 'Encrypt' is used to indicate encryption or decryption. + CFB64 mode operates by using the cipher to generate a stream + of bytes which is used to encrypt the plain text. + The cipher text is then encrypted to generate the next 64 bits to + be xored (incrementally) with the next 64 bits of plain + text. As can be seen from this, to encrypt or decrypt, + the same 'cipher stream' needs to be generated but the way the next + block of data is gathered for encryption is different for + encryption and decryption. + +void RC2_ofb64_encrypt( +unsigned char *in, +unsigned char *out, +long length, +RC2_KEY *schedule, +unsigned char *ivec, +int *num); + This functions implements OFB mode of RC2 with 64bit feedback. + This allows you to encrypt an arbitrary number of bytes, + you do not require 8 byte padding. Each call to this + routine will encrypt the input bytes to output and then update ivec + and num. Num contains 'how far' we are though ivec. + This is in effect a stream cipher, there is no encryption or + decryption mode. + +For reading passwords, I suggest using des_read_pw_string() from my DES library. +To generate a password from a text string, I suggest using MD5 (or MD2) to +produce a 16 byte message digest that can then be passed directly to +RC2_set_key(). + +===== +For more information about the specific RC2 modes in this library +(ecb, cbc, cfb and ofb), read the section entitled 'Modes of DES' from the +documentation on my DES library. What is said about DES is directly +applicable for RC2. + diff --git a/src/lib/libssl/src/doc/rc4.doc b/src/lib/libssl/src/doc/rc4.doc new file mode 100644 index 0000000000..4b2897eb74 --- /dev/null +++ b/src/lib/libssl/src/doc/rc4.doc @@ -0,0 +1,44 @@ +The RC4 library. +RC4 is a stream cipher that operates on a byte stream. It can be used with +any length key but I would recommend normally using 16 bytes. + +This library requires the inclusion of 'rc4.h'. + +The RC4 encryption function takes what is called an RC4_KEY as an argument. +The RC4_KEY is generated by the RC4_set_key function from the key bytes. + +RC4, being a stream cipher, does not have an encryption or decryption mode. +It produces a stream of bytes that the input stream is xor'ed against and +so decryption is just a case of 'encrypting' again with the same key. + +I have only put in one 'mode' for RC4 which is the normal one. This means +there is no initialisation vector and there is no feedback of the cipher +text into the cipher. This implies that you should not ever use the +same key twice if you can help it. If you do, you leave yourself open to +known plain text attacks; if you know the plain text and +corresponding cipher text in one message, all messages that used the same +key can have the cipher text decoded for the corresponding positions in the +cipher stream. + +The main positive feature of RC4 is that it is a very fast cipher; about 4 +times faster that DES. This makes it ideally suited to protocols where the +key is randomly chosen, like SSL. + +The functions are as follows: + +void RC4_set_key( +RC4_KEY *key; +int len; +unsigned char *data); + This function initialises the RC4_KEY structure with the key passed + in 'data', which is 'len' bytes long. The key data can be any + length but 16 bytes seems to be a good number. + +void RC4( +RC4_KEY *key; +unsigned long len; +unsigned char *in; +unsigned char *out); + Do the actual RC4 encryption/decryption. Using the 'key', 'len' + bytes are transformed from 'in' to 'out'. As mentioned above, + decryption is the operation as encryption. diff --git a/src/lib/libssl/src/doc/readme b/src/lib/libssl/src/doc/readme new file mode 100644 index 0000000000..824d4fd0e2 --- /dev/null +++ b/src/lib/libssl/src/doc/readme @@ -0,0 +1,6 @@ +This is the old 0.6.6 docuementation. Most of the cipher stuff is still +relevent but I'm working (very slowly) on new docuemtation. +The current version can be found online at + +http://www.cryptsoft.com/ssleay/doc + diff --git a/src/lib/libssl/src/doc/ref.doc b/src/lib/libssl/src/doc/ref.doc new file mode 100644 index 0000000000..211559900d --- /dev/null +++ b/src/lib/libssl/src/doc/ref.doc @@ -0,0 +1,48 @@ +I have lots more references etc, and will update this list in the future, +30 Aug 1996 - eay + + +SSL The SSL Protocol - from Netscapes. + +RC4 Newsgroups: sci.crypt + From: sterndark@netcom.com (David Sterndark) + Subject: RC4 Algorithm revealed. + Message-ID: <sternCvKL4B.Hyy@netcom.com> + +RC2 Newsgroups: sci.crypt + From: pgut01@cs.auckland.ac.nz (Peter Gutmann) + Subject: Specification for Ron Rivests Cipher No.2 + Message-ID: <4fk39f$f70@net.auckland.ac.nz> + +MD2 RFC1319 The MD2 Message-Digest Algorithm +MD5 RFC1321 The MD5 Message-Digest Algorithm + +X509 Certificates + RFC1421 Privacy Enhancement for Internet Electronic Mail: Part I + RFC1422 Privacy Enhancement for Internet Electronic Mail: Part II + RFC1423 Privacy Enhancement for Internet Electronic Mail: Part III + RFC1424 Privacy Enhancement for Internet Electronic Mail: Part IV + +RSA and various standard encoding + PKCS#1 RSA Encryption Standard + PKCS#5 Password-Based Encryption Standard + PKCS#7 Cryptographic Message Syntax Standard + A Layman's Guide to a Subset of ASN.1, BER, and DER + An Overview of the PKCS Standards + Some Examples of the PKCS Standards + +IDEA Chapter 3 The Block Cipher IDEA + +RSA, prime number generation and bignum algorithms + Introduction To Algorithms, + Thomas Cormen, Charles Leiserson, Ronald Rivest, + Section 29 Arithmetic Circuits + Section 33 Number-Theoretic Algorithms + +Fast Private Key algorithm + Fast Decipherment Algorithm for RSA Public-Key Cryptosystem + J.-J. Quisquater and C. Couvreur, Electronics Letters, + 14th October 1982, Vol. 18 No. 21 + +Prime number generation and bignum algorithms. + PGP-2.3a diff --git a/src/lib/libssl/src/doc/req.1 b/src/lib/libssl/src/doc/req.1 new file mode 100644 index 0000000000..684fda580e --- /dev/null +++ b/src/lib/libssl/src/doc/req.1 @@ -0,0 +1,137 @@ +The 'req' command is used to manipulate and deal with pkcs#10 +certificate requests. + +It's default mode of operation is to load a certificate and then +write it out again. + +By default the 'req' is read from stdin in 'PEM' format. +The -inform option can be used to specify 'pem' format or 'der' +format. PEM format is the base64 encoding of the DER format. + +By default 'req' then writes the request back out. -outform can be used +to indicate the desired output format, be it 'pem' or 'der'. + +To specify an input file, use the '-in' option and the '-out' option +can be used to specify the output file. + +If you wish to perform a command and not output the certificate +request afterwards, use the '-noout' option. + +When a certificate is loaded, it can be printed in a human readable +ascii format via the '-text' option. + +To check that the signature on a certificate request is correct, use +the '-verify' option to make sure that the private key contained in the +certificate request corresponds to the signature. + +Besides the default mode, there is also the 'generate a certificate +request' mode. There are several flags that trigger this mode. + +-new will generate a new RSA key (if required) and then prompts +the user for details for the certificate request. +-newkey has an argument that is the number of bits to make the new +key. This function also triggers '-new'. + +The '-new' option can have a key to use specified instead of having to +load one, '-key' is used to specify the file containg the key. +-keyform can be used to specify the format of the key. Only +'pem' and 'der' formats are supported, later, 'netscape' format may be added. + +Finally there is the '-x509' options which makes req output a self +signed x509 certificate instead of a certificate request. + +Now as you may have noticed, there are lots of default options that +cannot be specified via the command line. They are held in a 'template' +or 'configuration file'. The -config option specifies which configuration +file to use. See conf.doc for details on the syntax of this file. + +The req command uses the 'req' section of the config file. + +--- +# The following variables are defined. For this example I will populate +# the various values +[ req ] +default_bits = 512 # default number of bits to use. +default_keyfile = testkey.pem # Where to write the generated keyfile + # if not specified. +distinguished_name= req_dn # The section that contains the + # information about which 'object' we + # want to put in the DN. +attributes = req_attr # The objects we want for the + # attributes field. +encrypt_rsa_key = no # Should we encrypt newly generated + # keys. I strongly recommend 'yes'. + +# The distinguished name section. For the following entries, the +# object names must exist in the SSLeay header file objects.h. If they +# do not, they will be silently ignored. The entries have the following +# format. +# <object_name> => string to prompt with +# <object_name>_default => default value for people +# <object_name>_value => Automatically use this value for this field. +# <object_name>_min => minimum number of characters for data (def. 0) +# <object_name>_max => maximum number of characters for data (def. inf.) +# All of these entries are optional except for the first one. +[ req_dn ] +countryName = Country Name (2 letter code) +countryName_default = AU + +stateOrProvinceName = State or Province Name (full name) +stateOrProvinceName_default = Queensland + +localityName = Locality Name (eg, city) + +organizationName = Organization Name (eg, company) +organizationName_default = Mincom Pty Ltd + +organizationalUnitName = Organizational Unit Name (eg, section) +organizationalUnitName_default = MTR + +commonName = Common Name (eg, YOUR name) +commonName_max = 64 + +emailAddress = Email Address +emailAddress_max = 40 + +# The next section is the attributes section. This is exactly the +# same as for the previous section except that the resulting objects are +# put in the attributes field. +[ req_attr ] +challengePassword = A challenge password +challengePassword_min = 4 +challengePassword_max = 20 + +unstructuredName = An optional company name + +---- +Also note that the order that attributes appear in this file is the +order they will be put into the distinguished name. + +Once this request has been generated, it can be sent to a CA for +certifying. + +---- +A few quick examples.... + +To generate a new request and a new key +req -new + +To generate a new request and a 1058 bit key +req -newkey 1058 + +To generate a new request using a pre-existing key +req -new -key key.pem + +To generate a self signed x509 certificate from a certificate +request using a supplied key, and we want to see the text form of the +output certificate (which we will put in the file selfSign.pem +req -x509 -in req.pem -key key.pem -text -out selfSign.pem + +Verify that the signature is correct on a certificate request. +req -verify -in req.pem + +Verify that the signature was made using a specified public key. +req -verify -in req.pem -key key.pem + +Print the contents of a certificate request +req -text -in req.pem diff --git a/src/lib/libssl/src/doc/rsa.doc b/src/lib/libssl/src/doc/rsa.doc new file mode 100644 index 0000000000..f260452bc6 --- /dev/null +++ b/src/lib/libssl/src/doc/rsa.doc @@ -0,0 +1,135 @@ +The RSA encryption and utility routines. + +The RSA routines are built on top of a big number library (the BN library). +There are support routines in the X509 library for loading and manipulating +the various objects in the RSA library. When errors are returned, read +about the ERR library for how to access the error codes. + +All RSA encryption is done according to the PKCS-1 standard which is +compatible with PEM and RSAref. This means that any values being encrypted +must be less than the size of the modulus in bytes, minus 10, bytes long. + +This library uses RAND_bytes()() for it's random data, make sure to feed +RAND_seed() with lots of interesting and varied data before using these +routines. + +The RSA library has one specific data type, the RSA structure. +It is composed of 8 BIGNUM variables (see the BN library for details) and +can hold either a private RSA key or a public RSA key. +Some RSA libraries have different structures for public and private keys, I +don't. For my libraries, a public key is determined by the fact that the +RSA->d value is NULL. These routines will operate on any size RSA keys. +While I'm sure 4096 bit keys are very very secure, they take a lot longer +to process that 1024 bit keys :-). + +The function in the RSA library are as follows. + +RSA *RSA_new(); + This function creates a new RSA object. The sub-fields of the RSA + type are also malloced so you should always use this routine to + create RSA variables. + +void RSA_free( +RSA *rsa); + This function 'frees' an RSA structure. This routine should always + be used to free the RSA structure since it will also 'free' any + sub-fields of the RSA type that need freeing. + +int RSA_size( +RSA *rsa); + This function returns the size of the RSA modulus in bytes. Why do + I need this you may ask, well the reason is that when you encrypt + with RSA, the output string will be the size of the RSA modulus. + So the output for the RSA_encrypt and the input for the RSA_decrypt + routines need to be RSA_size() bytes long, because this is how many + bytes are expected. + +For the following 4 RSA encryption routines, it should be noted that +RSA_private_decrypt() should be used on the output from +RSA_public_encrypt() and RSA_public_decrypt() should be used on +the output from RSA_private_encrypt(). + +int RSA_public_encrypt( +int from_len; +unsigned char *from +unsigned char *to +RSA *rsa); + This function implements RSA public encryption, the rsa variable + should be a public key (but can be a private key). 'from_len' + bytes taken from 'from' and encrypted and put into 'to'. 'to' needs + to be at least RSA_size(rsa) bytes long. The number of bytes + written into 'to' is returned. -1 is returned on an error. The + operation performed is + to = from^rsa->e mod rsa->n. + +int RSA_private_encrypt( +int from_len; +unsigned char *from +unsigned char *to +RSA *rsa); + This function implements RSA private encryption, the rsa variable + should be a private key. 'from_len' bytes taken from + 'from' and encrypted and put into 'to'. 'to' needs + to be at least RSA_size(rsa) bytes long. The number of bytes + written into 'to' is returned. -1 is returned on an error. The + operation performed is + to = from^rsa->d mod rsa->n. + +int RSA_public_decrypt( +int from_len; +unsigned char *from +unsigned char *to +RSA *rsa); + This function implements RSA public decryption, the rsa variable + should be a public key (but can be a private key). 'from_len' + bytes are taken from 'from' and decrypted. The decrypted data is + put into 'to'. The number of bytes encrypted is returned. -1 is + returned to indicate an error. The operation performed is + to = from^rsa->e mod rsa->n. + +int RSA_private_decrypt( +int from_len; +unsigned char *from +unsigned char *to +RSA *rsa); + This function implements RSA private decryption, the rsa variable + should be a private key. 'from_len' bytes are taken + from 'from' and decrypted. The decrypted data is + put into 'to'. The number of bytes encrypted is returned. -1 is + returned to indicate an error. The operation performed is + to = from^rsa->d mod rsa->n. + +int RSA_mod_exp( +BIGNUM *n; +BIGNUM *p; +RSA *rsa); + Normally you will never use this routine. + This is really an internal function which is called by + RSA_private_encrypt() and RSA_private_decrypt(). It performs + n=n^p mod rsa->n except that it uses the 5 extra variables in the + RSA structure to make this more efficient. + +RSA *RSA_generate_key( +int bits; +unsigned long e; +void (*callback)(); +char *cb_arg; + This routine is used to generate RSA private keys. It takes + quite a period of time to run and should only be used to + generate initial private keys that should then be stored + for later use. The passed callback function + will be called periodically so that feedback can be given + as to how this function is progressing. + 'bits' is the length desired for the modulus, so it would be 1024 + to generate a 1024 bit private key. + 'e' is the value to use for the public exponent 'e'. Traditionally + it is set to either 3 or 0x10001. + The callback function (if not NULL) is called in the following + situations. + when we have generated a suspected prime number to test, + callback(0,num1++,cb_arg). When it passes a prime number test, + callback(1,num2++,cb_arg). When it is rejected as one of + the 2 primes required due to gcd(prime,e value) != 0, + callback(2,num3++,cb_arg). When finally accepted as one + of the 2 primes, callback(3,num4++,cb_arg). + diff --git a/src/lib/libssl/src/doc/rsaref.doc b/src/lib/libssl/src/doc/rsaref.doc new file mode 100644 index 0000000000..0505b76f76 --- /dev/null +++ b/src/lib/libssl/src/doc/rsaref.doc @@ -0,0 +1,35 @@ +This package can be compiled to use the RSAref library. +This library is not allowed outside of the USA but inside the USA it is +claimed by RSA to be the only RSA public key library that can be used +besides BSAFE.. + +There are 2 files, rsaref/rsaref.c and rsaref/rsaref.h that contain the glue +code to use RSAref. These files were written by looking at the PGP +source code and seeing which routines it used to access RSAref. +I have also been sent by some-one a copy of the RSAref header file that +contains the library error codes. + +[ Jun 1996 update - I have recently gotten hold of RSAref 2.0 from + South Africa and have been doing some performace tests. ] + +They have now been tested against the recently announced RSAEURO +library. + +There are 2 ways to use SSLeay and RSAref. First, to build so that +the programs must be linked with RSAref, add '-DRSAref' to CFLAG in the top +level makefile and -lrsaref (or where ever you are keeping RSAref) to +EX_LIBS. + +To build a makefile via util/mk1mf.pl to do this, use the 'rsaref' option. + +The second method is to build as per normal and link applications with +the RSAglue library. The correct library order would be +cc -o cmd cmd.o -lssl -lRSAglue -lcrypto -lrsaref -ldes +The RSAglue library is built in the rsa directory and is NOT +automatically installed. + +Be warned that the RSAEURO library, that is claimed to be compatible +with RSAref contains a different value for the maximum number of bits +supported. This changes structure sizes and so if you are using +RSAEURO, change the value of RSAref_MAX_BITS in rsa/rsaref.h + diff --git a/src/lib/libssl/src/doc/s_mult.doc b/src/lib/libssl/src/doc/s_mult.doc new file mode 100644 index 0000000000..726085bc57 --- /dev/null +++ b/src/lib/libssl/src/doc/s_mult.doc @@ -0,0 +1,17 @@ +s_mult is a test program I hacked up on a Sunday for testing non-blocking +IO. It has a select loop at it's centre that handles multiple readers +and writers. + +Try the following command +ssleay s_mult -echo -nbio -ssl -v +echo - sends any sent text back to the sender +nbio - turns on non-blocking IO +ssl - accept SSL connections, default is normal text +v - print lots + type Q<cr> to quit + +In another window, run the following +ssleay s_client -pause </etc/termcap + +The pause option puts in a 1 second pause in each read(2)/write(2) call +so the other end will have read()s fail. diff --git a/src/lib/libssl/src/doc/session.doc b/src/lib/libssl/src/doc/session.doc new file mode 100644 index 0000000000..ffccb0306e --- /dev/null +++ b/src/lib/libssl/src/doc/session.doc @@ -0,0 +1,297 @@ +I have just checked over and re-worked the session stuff. +The following brief example will ignore all setup information to do with +authentication. + +Things operate as follows. + +The SSL environment has a 'context', a SSL_CTX structure. This holds the +cached SSL_SESSIONS (which can be reused) and the certificate lookup +information. Each SSL structure needs to be associated with a SSL_CTX. +Normally only one SSL_CTX structure is needed per program. + +SSL_CTX *SSL_CTX_new(void ); +void SSL_CTX_free(SSL_CTX *); +These 2 functions create and destroy SSL_CTX structures + +The SSL_CTX has a session_cache_mode which is by default, +in SSL_SESS_CACHE_SERVER mode. What this means is that the library +will automatically add new session-id's to the cache apon sucsessful +SSL_accept() calls. +If SSL_SESS_CACHE_CLIENT is set, then client certificates are also added +to the cache. +SSL_set_session_cache_mode(ctx,mode) will set the 'mode' and +SSL_get_session_cache_mode(ctx) will get the cache 'mode'. +The modes can be +SSL_SESS_CACHE_OFF - no caching +SSL_SESS_CACHE_CLIENT - only SSL_connect() +SSL_SESS_CACHE_SERVER - only SSL_accept() +SSL_SESS_NO_CACHE_BOTH - Either SSL_accept() or SSL_connect(). +If SSL_SESS_CACHE_NO_AUTO_CLEAR is set, old timed out sessions are +not automatically removed each 255, SSL_connect()s or SSL_accept()s. + +By default, apon every 255 successful SSL_connect() or SSL_accept()s, +the cache is flush. Please note that this could be expensive on +a heavily loaded SSL server, in which case, turn this off and +clear the cache of old entries 'manually' (with one of the functions +listed below) every few hours. Perhaps I should up this number, it is hard +to say. Remember, the '255' new calls is just a mechanims to get called +every now and then, in theory at most 255 new session-id's will have been +added but if 100 are added every minute, you would still have +500 in the cache before any would start being flushed (assuming a 3 minute +timeout).. + +int SSL_CTX_sess_hits(SSL_CTX *ctx); +int SSL_CTX_sess_misses(SSL_CTX *ctx); +int SSL_CTX_sess_timeouts(SSL_CTX *ctx); +These 3 functions return statistics about the SSL_CTX. These 3 are the +number of session id reuses. hits is the number of reuses, misses are the +number of lookups that failed, and timeouts is the number of cached +entries ignored because they had timeouted. + +ctx->new_session_cb is a function pointer to a function of type +int new_session_callback(SSL *ssl,SSL_SESSION *new); +This function, if set in the SSL_CTX structure is called whenever a new +SSL_SESSION is added to the cache. If the callback returns non-zero, it +means that the application will have to do a SSL_SESSION_free() +on the structure (this is +to do with the cache keeping the reference counts correct, without the +application needing to know about it. +The 'active' parameter is the current SSL session for which this connection +was created. + +void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx,int (*cb)()); +to set the callback, +int (*cb)() SSL_CTX_sess_get_new_cb(SSL_CTX *ctx) +to get the callback. + +If the 'get session' callback is set, when a session id is looked up and +it is not in the session-id cache, this callback is called. The callback is +of the form +SSL_SESSION *get_session_callback(unsigned char *sess_id,int sess_id_len, + int *copy); + +The get_session_callback is intended to return null if no session id is found. +The reference count on the SSL_SESSION in incremented by the SSL library, +if copy is 1. Otherwise, the reference count is not modified. + +void SSL_CTX_sess_set_get_cb(ctx,cb) sets the callback and +int (*cb)()SSL_CTX_sess_get_get_cb(ctx) returns the callback. + +These callbacks are basically indended to be used by processes to +send their session-id's to other processes. I currently have not implemented +non-blocking semantics for these callbacks, it is upto the appication +to make the callbacks effiecent if they require blocking (perhaps +by 'saving' them and then 'posting them' when control returns from +the SSL_accept(). + +LHASH *SSL_CTX_sessions(SSL_CTX *ctx) +This returns the session cache. The lhash strucutre can be accessed for +statistics about the cache. + +void lh_stats(LHASH *lh, FILE *out); +void lh_node_stats(LHASH *lh, FILE *out); +void lh_node_usage_stats(LHASH *lh, FILE *out); + +can be used to print details about it's activity and current state. +You can also delve directly into the lhash structure for 14 different +counters that are kept against the structure. When I wrote the lhash library, +I was interested in gathering statistics :-). +Have a read of doc/lhash.doc in the SSLeay distribution area for more details +on the lhash library. + +Now as mentioned ealier, when a SSL is created, it needs a SSL_CTX. +SSL * SSL_new(SSL_CTX *); + +This stores a session. A session is secret information shared between 2 +SSL contexts. It will only be created if both ends of the connection have +authenticated their peer to their satisfaction. It basically contains +the information required to use a particular secret key cipher. + +To retrieve the SSL_CTX being used by a SSL, +SSL_CTX *SSL_get_SSL_CTX(SSL *s); + +Now when a SSL session is established between to programs, the 'session' +information that is cached in the SSL_CTX can me manipulated by the +following functions. +int SSL_set_session(SSL *s, SSL_SESSION *session); +This will set the SSL_SESSION to use for the next SSL_connect(). If you use +this function on an already 'open' established SSL connection, 'bad things +will happen'. This function is meaning-less when used on a ssl strucutre +that is just about to be used in a SSL_accept() call since the +SSL_accept() will either create a new session or retrieve one from the +cache. + +SSL_SESSION *SSL_get_session(SSL *s); +This will return the SSL_SESSION for the current SSL, NULL if there is +no session associated with the SSL structure. + +The SSL sessions are kept in the SSL_CTX in a hash table, to remove a +session +void SSL_CTX_remove_session(SSL_CTX *,SSL_SESSION *c); +and to add one +int SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c); +SSL_CTX_add_session() returns 1 if the session was already in the cache (so it +was not added). +Whenever a new session is created via SSL_connect()/SSL_accept(), +they are automatically added to the cache, depending on the session_cache_mode +settings. SSL_set_session() +does not add it to the cache. Just call SSL_CTX_add_session() if you do want the +session added. For a 'client' this would not normally be the case. +SSL_CTX_add_session() is not normally ever used, except for doing 'evil' things +which the next 2 funtions help you do. + +int i2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp); +SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,unsigned char **pp,long length); +These 2 functions are in the standard ASN1 library form and can be used to +load and save to a byte format, the SSL_SESSION structure. +With these functions, you can save and read these structures to a files or +arbitary byte string. +The PEM_write_SSL_SESSION(fp,x) and PEM_read_SSL_SESSION(fp,x,cb) will +write to a file pointer in base64 encoding. + +What you can do with this, is pass session information between separate +processes. Please note, that you will probably also need to modify the +timeout information on the SSL_SESSIONs. + +long SSL_get_time(SSL_SESSION *s) +will return the 'time' that the session +was loaded. The timeout is relative to this time. This information is +saved when the SSL_SESSION is converted to binarary but it is stored +in as a unix long, which is rather OS dependant, but easy to convert back. + +long SSL_set_time(SSL_SESSION *s,long t) will set the above mentioned time. +The time value is just the value returned from time(3), and should really +be defined by be to be time_t. + +long SSL_get_timeout(SSL_SESSION *s); +long SSL_set_timeout(SSL_SESSION *s,long t); +These 2 retrieve and set the timeout which is just a number of secconds +from the 'SSL_get_time()' value. When this time period has elapesed, +the session will no longer be in the cache (well it will actually be removed +the next time it is attempted to be retrieved, so you could 'bump' +the timeout so it remains valid). +The 'time' and 'timeout' are set on a session when it is created, not reset +each time it is reused. If you did wish to 'bump it', just after establishing +a connection, do a +SSL_set_time(ssl,time(NULL)); + +You can also use +SSL_CTX_set_timeout(SSL_CTX *ctx,unsigned long t) and +SSL_CTX_get_timeout(SSL_CTX *ctx) to manipulate the default timeouts for +all SSL connections created against a SSL_CTX. If you set a timeout in +an SSL_CTX, all new SSL's created will inherit the timeout. It can be over +written by the SSL_set_timeout(SSL *s,unsigned long t) function call. +If you 'set' the timeout back to 0, the system default will be used. + +SSL_SESSION *SSL_SESSION_new(); +void SSL_SESSION_free(SSL_SESSION *ses); +These 2 functions are used to create and dispose of SSL_SESSION functions. +You should not ever normally need to use them unless you are using +i2d_SSL_SESSION() and/or d2i_SSL_SESSION(). If you 'load' a SSL_SESSION +via d2i_SSL_SESSION(), you will need to SSL_SESSION_free() it. +Both SSL_set_session() and SSL_CTX_add_session() will 'take copies' of the +structure (via reference counts) when it is passed to them. + +SSL_CTX_flush_sessions(ctx,time); +The first function will clear all sessions from the cache, which have expired +relative to 'time' (which could just be time(NULL)). + +SSL_CTX_flush_sessions(ctx,0); +This is a special case that clears everything. + +As a final comment, a 'session' is not enough to establish a new +connection. If a session has timed out, a certificate and private key +need to have been associated with the SSL structure. +SSL_copy_session_id(SSL *to,SSL *from); will copy not only the session +strucutre but also the private key and certificate associated with +'from'. + +EXAMPLES. + +So lets play at being a wierd SSL server. + +/* setup a context */ +ctx=SSL_CTX_new(); + +/* Lets load some session from binary into the cache, why one would do + * this is not toally clear, but passing between programs does make sense + * Perhaps you are using 4096 bit keys and are happy to keep them + * valid for a week, to avoid the RSA overhead of 15 seconds, I'm not toally + * sure, perhaps this is a process called from an SSL inetd and this is being + * passed to the application. */ +session=d2i_SSL_SESSION(....) +SSL_CTX_add_session(ctx,session); + +/* Lets even add a session from a file */ +session=PEM_read_SSL_SESSION(....) +SSL_CTX_add_session(ctx,session); + +/* create a new SSL structure */ +ssl=SSL_new(ctx); + +/* At this point we want to be able to 'create' new session if + * required, so we need a certificate and RSAkey. */ +SSL_use_RSAPrivateKey_file(ssl,...) +SSL_use_certificate_file(ssl,...) + +/* Now since we are a server, it make little sence to load a session against + * the ssl strucutre since a SSL_accept() will either create a new session or + * grab an existing one from the cache. */ + +/* grab a socket descriptor */ +fd=accept(...); + +/* associated it with the ssl strucutre */ +SSL_set_fd(ssl,fd); + +SSL_accept(ssl); /* 'do' SSL using out cert and RSA key */ + +/* Lets print out the session details or lets save it to a file, + * perhaps with a secret key cipher, so that we can pass it to the FBI + * when they want to decode the session :-). While we have RSA + * this does not matter much but when I do SSLv3, this will allow a mechanism + * for the server/client to record the information needed to decode + * the traffic that went over the wire, even when using Diffie-Hellman */ +PEM_write_SSL_SESSION(SSL_get_session(ssl),stdout,....) + +Lets 'connect' back to the caller using the same session id. + +ssl2=SSL_new(ctx); +fd2=connect(them); +SSL_set_fd(ssl2,fd2); +SSL_set_session(ssl2,SSL_get_session(ssl)); +SSL_connect(ssl2); + +/* what the hell, lets accept no more connections using this session */ +SSL_CTX_remove_session(SSL_get_SSL_CTX(ssl),SSL_get_session(ssl)); + +/* we could have just as easily used ssl2 since they both are using the + * same session. + * You will note that both ssl and ssl2 are still using the session, and + * the SSL_SESSION structure will be free()ed when both ssl and ssl2 + * finish using the session. Also note that you could continue to initiate + * connections using this session by doing SSL_get_session(ssl) to get the + * existing session, but SSL_accept() will not be able to find it to + * use for incoming connections. + * Of corse, the session will timeout at the far end and it will no + * longer be accepted after a while. The time and timeout are ignored except + * by SSL_accept(). */ + +/* Since we have had our server running for 10 weeks, and memory is getting + * short, perhaps we should clear the session cache to remove those + * 100000 session entries that have expired. Some may consider this + * a memory leak :-) */ + +SSL_CTX_flush_sessions(ctx,time(NULL)); + +/* Ok, after a bit more time we wish to flush all sessions from the cache + * so that all new connections will be authenticated and incure the + * public key operation overhead */ + +SSL_CTX_flush_sessions(ctx,0); + +/* As a final note, to copy everything to do with a SSL, use */ +SSL_copy_session_id(SSL *to,SSL *from); +/* as this also copies the certificate and RSA key so new session can + * be established using the same details */ + diff --git a/src/lib/libssl/src/doc/sha.doc b/src/lib/libssl/src/doc/sha.doc new file mode 100644 index 0000000000..895fa182ed --- /dev/null +++ b/src/lib/libssl/src/doc/sha.doc @@ -0,0 +1,52 @@ +The SHA (Secure Hash Algorithm) library. +SHA is a message digest algorithm that can be used to condense an arbitrary +length message down to a 20 byte hash. The functions all need to be passed +a SHA_CTX which is used to hold the SHA context during multiple SHA_Update() +function calls. The normal method of use for this library is as follows +This library contains both SHA and SHA-1 digest algorithms. SHA-1 is +an update to SHA (which should really be called SHA-0 now) which +tweaks the algorithm slightly. The SHA-1 algorithm is used by simply +using SHA1_Init(), SHA1_Update(), SHA1_Final() and SHA1() instead of the +SHA*() calls + +SHA_Init(...); +SHA_Update(...); +... +SHA_Update(...); +SHA_Final(...); + +This library requires the inclusion of 'sha.h'. + +The functions are as follows: + +void SHA_Init( +SHA_CTX *c); + This function needs to be called to initiate a SHA_CTX structure for + use. + +void SHA_Update( +SHA_CTX *c; +unsigned char *data; +unsigned long len); + This updates the message digest context being generated with 'len' + bytes from the 'data' pointer. The number of bytes can be any + length. + +void SHA_Final( +unsigned char *md; +SHA_CTX *c; + This function is called when a message digest of the data digested + with SHA_Update() is wanted. The message digest is put in the 'md' + array and is SHA_DIGEST_LENGTH (20) bytes long. + +unsigned char *SHA( +unsigned char *d; +unsigned long n; +unsigned char *md; + This function performs a SHA_Init(), followed by a SHA_Update() + followed by a SHA_Final() (using a local SHA_CTX). + The resulting digest is put into 'md' if it is not NULL. + Regardless of the value of 'md', the message + digest is returned from the function. If 'md' was NULL, the message + digest returned is being stored in a static structure. + diff --git a/src/lib/libssl/src/doc/speed.doc b/src/lib/libssl/src/doc/speed.doc new file mode 100644 index 0000000000..11dfa85f08 --- /dev/null +++ b/src/lib/libssl/src/doc/speed.doc @@ -0,0 +1,96 @@ +To get an idea of the performance of this library, use +ssleay speed + +perl util/sp-diff.pl file1 file2 + +will print out the relative differences between the 2 files which are +expected to be the output from the speed program. + +The performace of the library is very dependant on the Compiler +quality and various flags used to build. + +--- + +These are some numbers I did comparing RSAref and SSLeay on a Pentium 100. +[ These numbers are all out of date, as of SSL - 0.6.1 the RSA +operations are about 2 times faster, so check the version number ] + +RSA performance. + +SSLeay 0.6.0 +Pentium 100, 32meg, Windows NT Workstation 3.51 +linux - gcc v 2.7.0 -O3 -fomit-frame-pointer -m486 +and +Windows NT - Windows NT 3.51 - Visual C++ 4.1 - 586 code + 32bit assember +Windows 3.1 - Windows NT 3.51 - Visual C++ 1.52c - 286 code + 32bit assember +NT Dos Shell- Windows NT 3.51 - Visual C++ 1.52c - 286 code + 16bit assember + +Times are how long it takes to do an RSA private key operation. + + 512bits 1024bits +------------------------------- +SSLeay NT dll 0.042s 0.202s see above +SSLeay linux 0.046s 0.218s Assember inner loops (normal build) +SSLeay linux 0.067s 0.380s Pure C code with BN_LLONG defined +SSLeay W3.1 dll 0.108s 0.478s see above +SSLeay linux 0.109s 0.713s C without BN_LLONG. +RSAref2.0 linux 0.149s 0.936s +SSLeay MS-DOS 0.197s 1.049s see above + +486DX66, 32meg, Windows NT Server 3.51 + 512bits 1024bits +------------------------------- +SSLeay NT dll 0.084s 0.495s <- SSLeay 0.6.3 +SSLeay NT dll 0.154s 0.882s +SSLeay W3.1 dll 0.335s 1.538s +SSLeay MS-DOS 0.490s 2.790s + +What I find cute is that I'm still faster than RSAref when using standard C, +without using the 'long long' data type :-), %35 faster for 512bit and we +scale up to 3.2 times faster for the 'default linux' build. I should mention +that people should 'try' to use either x86-lnx.s (elf), x86-lnxa.s or +x86-sol.s for any x86 based unix they are building on. The only problems +with be with syntax but the performance gain is quite large, especially for +servers. The code is very simple, you just need to modify the 'header'. + +The message is, if you are stuck using RSAref, the RSA performance will be +bad. Considering the code was compiled for a pentium, the 486DX66 number +would indicate 'Use RSAref and turn you Pentium 100 into a 486DX66' :-). +[ As of verson 0.6.1, it would be correct to say 'turn you pentium 100 + into a 486DX33' :-) ] + +I won't tell people if the DLL's are using RSAref or my stuff if no-one +asks :-). + +eric + +PS while I know I could speed things up further, I will probably not do + so due to the effort involved. I did do some timings on the + SSLeay bignum format -> RSAref number format conversion that occurs + each time RSAref is used by SSLeay, and the numbers are trivial. + 0.00012s a call for 512bit vs 0.149s for the time spent in the function. + 0.00018s for 1024bit vs 0.938s. Insignificant. + So the 'way to go', to support faster RSA libraries, if people are keen, + is to write 'glue' code in a similar way that I do for RSAref and send it + to me :-). + My base library still has the advantage of being able to operate on + any size numbers, and is not that far from the performance from the + leaders in the field. (-%30?) + [ Well as of 0.6.1 I am now the leader in the filed on x86 (we at + least very close :-) ] + + I suppose I should also mention some other numbers RSAref numbers, again + on my Pentium. + DES CBC EDE-DES MD5 + RSAref linux 830k/s 302k/s 4390k/s + SSLeay linux 855k/s 319k/s 10025k/s + SSLeay NT 1158k/s 410k/s 10470k/s + SSLeay w31 378k/s 143k/s 2383k/s (fully 16bit) + + Got to admit that Visual C++ 4.[01] is a damn fine compiler :-) +-- +Eric Young | BOOL is tri-state according to Bill Gates. +AARNet: eay@cryptsoft.com | RTFM Win32 GetMessage(). + + + diff --git a/src/lib/libssl/src/doc/ssl-ciph.doc b/src/lib/libssl/src/doc/ssl-ciph.doc new file mode 100644 index 0000000000..33a7e41f0e --- /dev/null +++ b/src/lib/libssl/src/doc/ssl-ciph.doc @@ -0,0 +1,84 @@ +This is a quick high level summery of how things work now. + +Each SSLv2 and SSLv3 cipher is composed of 4 major attributes plus a few extra +minor ones. + +They are 'The key exchange algorithm', which is RSA for SSLv2 but can also +be Diffle-Hellman for SSLv3. + +An 'Authenticion algorithm', which can be RSA, Diffle-Helman, DSS or +none. + +The cipher + +The MAC digest. + +A cipher can also be an export cipher and is either an SSLv2 or a +SSLv3 ciphers. + +To specify which ciphers to use, one can either specify all the ciphers, +one at a time, or use 'aliases' to specify the preference and order for +the ciphers. + +There are a large number of aliases, but the most importaint are +kRSA, kDHr, kDHd and kEDH for key exchange types. + +aRSA, aDSS, aNULL and aDH for authentication +DES, 3DES, RC4, RC2, IDEA and eNULL for ciphers +MD5, SHA0 and SHA1 digests + +Now where this becomes interesting is that these can be put together to +specify the order and ciphers you wish to use. + +To speed this up there are also aliases for certian groups of ciphers. +The main ones are +SSLv2 - all SSLv2 ciphers +SSLv3 - all SSLv3 ciphers +EXP - all export ciphers +LOW - all low strngth ciphers (no export ciphers, normally single DES) +MEDIUM - 128 bit encryption +HIGH - Triple DES + +These aliases can be joined in a : separated list which specifies to +add ciphers, move them to the current location and delete them. + +A simpler way to look at all of this is to use the 'ssleay ciphers -v' command. +The default library cipher spec is +!ADH:RC4+RSA:HIGH:MEDIUM:LOW:EXP:+SSLv2:+EXP +which means, first, remove from consideration any ciphers that do not +authenticate. Next up, use ciphers using RC4 and RSA. Next include the HIGH, +MEDIUM and the LOW security ciphers. Finish up by adding all the export +ciphers on the end, then 'pull' all the SSLv2 and export ciphers to +the end of the list. + +The results are +$ ssleay ciphers -v '!ADH:RC4+RSA:HIGH:MEDIUM:LOW:EXP:+SSLv2:+EXP' + +RC4-SHA SSLv3 Kx=RSA Au=RSA Enc=RC4(128) Mac=SHA1 +RC4-MD5 SSLv3 Kx=RSA Au=RSA Enc=RC4(128) Mac=MD5 +EDH-RSA-DES-CBC3-SHA SSLv3 Kx=DH Au=RSA Enc=3DES(168) Mac=SHA1 +EDH-DSS-DES-CBC3-SHA SSLv3 Kx=DH Au=DSS Enc=3DES(168) Mac=SHA1 +DES-CBC3-SHA SSLv3 Kx=RSA Au=RSA Enc=3DES(168) Mac=SHA1 +IDEA-CBC-MD5 SSLv3 Kx=RSA Au=RSA Enc=IDEA(128) Mac=SHA1 +EDH-RSA-DES-CBC-SHA SSLv3 Kx=DH Au=RSA Enc=DES(56) Mac=SHA1 +EDH-DSS-DES-CBC-SHA SSLv3 Kx=DH Au=DSS Enc=DES(56) Mac=SHA1 +DES-CBC-SHA SSLv3 Kx=RSA Au=RSA Enc=DES(56) Mac=SHA1 +DES-CBC3-MD5 SSLv2 Kx=RSA Au=RSA Enc=3DES(168) Mac=MD5 +DES-CBC-MD5 SSLv2 Kx=RSA Au=RSA Enc=DES(56) Mac=MD5 +IDEA-CBC-MD5 SSLv2 Kx=RSA Au=RSA Enc=IDEA(128) Mac=MD5 +RC2-CBC-MD5 SSLv2 Kx=RSA Au=RSA Enc=RC2(128) Mac=MD5 +RC4-MD5 SSLv2 Kx=RSA Au=RSA Enc=RC4(128) Mac=MD5 +EXP-EDH-RSA-DES-CBC SSLv3 Kx=DH(512) Au=RSA Enc=DES(40) Mac=SHA1 export +EXP-EDH-DSS-DES-CBC-SHA SSLv3 Kx=DH(512) Au=DSS Enc=DES(40) Mac=SHA1 export +EXP-DES-CBC-SHA SSLv3 Kx=RSA(512) Au=RSA Enc=DES(40) Mac=SHA1 export +EXP-RC2-CBC-MD5 SSLv3 Kx=RSA(512) Au=RSA Enc=RC2(40) Mac=MD5 export +EXP-RC4-MD5 SSLv3 Kx=RSA(512) Au=RSA Enc=RC4(40) Mac=MD5 export +EXP-RC2-CBC-MD5 SSLv2 Kx=RSA(512) Au=RSA Enc=RC2(40) Mac=MD5 export +EXP-RC4-MD5 SSLv2 Kx=RSA(512) Au=RSA Enc=RC4(40) Mac=MD5 export + +I would recoment people use the 'ssleay ciphers -v "text"' +command to check what they are going to use. + +Anyway, I'm falling asleep here so I'll do some more tomorrow. + +eric diff --git a/src/lib/libssl/src/doc/ssl.doc b/src/lib/libssl/src/doc/ssl.doc new file mode 100644 index 0000000000..1f89cd5db2 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl.doc @@ -0,0 +1,172 @@ +SSL_CTX_sessions(SSL_CTX *ctx) - the session-id hash table. + +/* Session-id cache stats */ +SSL_CTX_sess_number +SSL_CTX_sess_connect +SSL_CTX_sess_connect_good +SSL_CTX_sess_accept +SSL_CTX_sess_accept_good +SSL_CTX_sess_hits +SSL_CTX_sess_cb_hits +SSL_CTX_sess_misses +SSL_CTX_sess_timeouts + +/* Session-id application notification callbacks */ +SSL_CTX_sess_set_new_cb +SSL_CTX_sess_get_new_cb +SSL_CTX_sess_set_get_cb +SSL_CTX_sess_get_get_cb + +/* Session-id cache operation mode */ +SSL_CTX_set_session_cache_mode +SSL_CTX_get_session_cache_mode + +/* Set default timeout values to use. */ +SSL_CTX_set_timeout +SSL_CTX_get_timeout + +/* Global SSL initalisation informational callback */ +SSL_CTX_set_info_callback +SSL_CTX_get_info_callback +SSL_set_info_callback +SSL_get_info_callback + +/* If the SSL_accept/SSL_connect returned with -1, these indicate when + * we should re-call *. +SSL_want +SSL_want_nothing +SSL_want_read +SSL_want_write +SSL_want_x509_lookup + +/* Where we are in SSL initalisation, used in non-blocking, perhaps + * have a look at ssl/bio_ssl.c */ +SSL_state +SSL_is_init_finished +SSL_in_init +SSL_in_connect_init +SSL_in_accept_init + +/* Used to set the 'inital' state so SSL_in_connect_init and SSL_in_accept_init + * can be used to work out which function to call. */ +SSL_set_connect_state +SSL_set_accept_state + +/* Where to look for certificates for authentication */ +SSL_set_default_verify_paths /* calles SSL_load_verify_locations */ +SSL_load_verify_locations + +/* get info from an established connection */ +SSL_get_session +SSL_get_certificate +SSL_get_SSL_CTX + +SSL_CTX_new +SSL_CTX_free +SSL_new +SSL_clear +SSL_free + +SSL_CTX_set_cipher_list +SSL_get_cipher +SSL_set_cipher_list +SSL_get_cipher_list +SSL_get_shared_ciphers + +SSL_accept +SSL_connect +SSL_read +SSL_write + +SSL_debug + +SSL_get_read_ahead +SSL_set_read_ahead +SSL_set_verify + +SSL_pending + +SSL_set_fd +SSL_set_rfd +SSL_set_wfd +SSL_set_bio +SSL_get_fd +SSL_get_rbio +SSL_get_wbio + +SSL_use_RSAPrivateKey +SSL_use_RSAPrivateKey_ASN1 +SSL_use_RSAPrivateKey_file +SSL_use_PrivateKey +SSL_use_PrivateKey_ASN1 +SSL_use_PrivateKey_file +SSL_use_certificate +SSL_use_certificate_ASN1 +SSL_use_certificate_file + +ERR_load_SSL_strings +SSL_load_error_strings + +/* human readable version of the 'state' of the SSL connection. */ +SSL_state_string +SSL_state_string_long +/* These 2 report what kind of IO operation the library was trying to + * perform last. Probably not very usefull. */ +SSL_rstate_string +SSL_rstate_string_long + +SSL_get_peer_certificate + +SSL_SESSION_new +SSL_SESSION_print_fp +SSL_SESSION_print +SSL_SESSION_free +i2d_SSL_SESSION +d2i_SSL_SESSION + +SSL_get_time +SSL_set_time +SSL_get_timeout +SSL_set_timeout +SSL_copy_session_id +SSL_set_session +SSL_CTX_add_session +SSL_CTX_remove_session +SSL_CTX_flush_sessions + +BIO_f_ssl + +/* used to hold information as to why a certificate verification failed */ +SSL_set_verify_result +SSL_get_verify_result + +/* can be used by the application to associate data with an SSL structure. + * It needs to be 'free()ed' by the application */ +SSL_set_app_data +SSL_get_app_data + +/* The following all set values that are kept in the SSL_CTX but + * are used as the default values when an SSL session is created. + * They are over writen by the relevent SSL_xxxx functions */ + +/* SSL_set_verify */ +void SSL_CTX_set_default_verify + +/* This callback, if set, totaly overrides the normal SSLeay verification + * functions and should return 1 on sucesss and 0 on failure */ +void SSL_CTX_set_cert_verify_callback + +/* The following are the same as the equivilent SSL_xxx functions. + * Only one copy of this information is kept and if a particular + * SSL structure has a local override, it is totally separate structure. + */ +int SSL_CTX_use_RSAPrivateKey +int SSL_CTX_use_RSAPrivateKey_ASN1 +int SSL_CTX_use_RSAPrivateKey_file +int SSL_CTX_use_PrivateKey +int SSL_CTX_use_PrivateKey_ASN1 +int SSL_CTX_use_PrivateKey_file +int SSL_CTX_use_certificate +int SSL_CTX_use_certificate_ASN1 +int SSL_CTX_use_certificate_file + diff --git a/src/lib/libssl/src/doc/ssl_ctx.doc b/src/lib/libssl/src/doc/ssl_ctx.doc new file mode 100644 index 0000000000..508394e75f --- /dev/null +++ b/src/lib/libssl/src/doc/ssl_ctx.doc @@ -0,0 +1,68 @@ +This is now a bit dated, quite a few of the SSL_ functions could be +SSL_CTX_ functions. I will update this in the future. 30 Aug 1996 + +From eay@orb.mincom.oz.au Mon Dec 11 21:37:08 1995 +Received: by orb.mincom.oz.au id AA00696 + (5.65c/IDA-1.4.4 for eay); Mon, 11 Dec 1995 11:37:08 +1000 +Date: Mon, 11 Dec 1995 11:37:08 +1000 (EST) +From: Eric Young <eay@mincom.oz.au> +X-Sender: eay@orb +To: sameer <sameer@c2.org> +Cc: Eric Young <eay@mincom.oz.au> +Subject: Re: PEM_readX509 oesn't seem to be working +In-Reply-To: <199512110102.RAA12521@infinity.c2.org> +Message-Id: <Pine.SOL.3.91.951211112115.28608D-100000@orb> +Mime-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +Status: RO +X-Status: + +On Sun, 10 Dec 1995, sameer wrote: +> OK, that's solved. I've found out that it is saying "no +> certificate set" in SSL_accept because s->conn == NULL +> so there is some place I need to initialize s->conn that I am +> not initializing it. + +The full order of things for a server should be. + +ctx=SSL_CTX_new(); + +/* The next line should not really be using ctx->cert but I'll leave it + * this way right now... I don't want a X509_ routine to know about an SSL + * structure, there should be an SSL_load_verify_locations... hmm, I may + * add it tonight. + */ +X509_load_verify_locations(ctx->cert,CAfile,CApath); + +/* Ok now for each new connection we do the following */ +con=SSL_new(ctx); +SSL_set_fd(con,s); +SSL_set_verify(con,verify,verify_callback); + +/* set the certificate and private key to use. */ +SSL_use_certificate_ASN1(con,X509_certificate); +SSL_use_RSAPrivateKey_ASN1(con,RSA_private_key); + +SSL_accept(con); + +SSL_read(con)/SSL_write(con); + +There is a bit more than that but that is basically the structure. + +Create a context and specify where to lookup certificates. + +foreach connection + { + create a SSL structure + set the certificate and private key + do a SSL_accept + + we should now be ok + } + +eric +-- +Eric Young | Signature removed since it was generating +AARNet: eay@mincom.oz.au | more followups than the message contents :-) + + diff --git a/src/lib/libssl/src/doc/ssleay.doc b/src/lib/libssl/src/doc/ssleay.doc new file mode 100644 index 0000000000..a0e86aef7c --- /dev/null +++ b/src/lib/libssl/src/doc/ssleay.doc @@ -0,0 +1,213 @@ +SSLeay: a cryptographic kitchen sink. + +1st December 1995 +Way back at the start of April 1995, I was looking for a mindless +programming project. A friend of mine (Tim Hudson) said "why don't you do SSL, +it has DES encryption in it and I would not mind using it in a SSL telnet". +While it was true I had written a DES library in previous years, litle +did I know what an expansive task SSL would turn into. + +First of all, the SSL protocol contains DES encryption. Well and good. My +DES library was fast and portable. It also contained the RSA's RC4 stream +cipher. Again, not a problem, some-one had just posted to sci.crypt +something that was claimed to be RC4. It also contained IDEA, I had the +specifications, not a problem to implement. MD5, an RFC, trivial, at most +I could spend a week or so trying to see if I could speed up the +implementation. All in all a nice set of ciphers. +Then the first 'expantion of the scope', RSA public key +encryption. Since I did not knowing a thing about public key encryption +or number theory, this appeared quite a daunting task. Just writing a +big number library would be problomatic in itself, let alone making it fast. +At this point the scope of 'implementing SSL' expands eponentialy. +First of all, the RSA private keys were being kept in ASN.1 format. +Thankfully the RSA PKCS series of documents explains this format. So I now +needed to be able to encode and decode arbitary ASN.1 objects. The Public +keys were embeded in X509 certificates. Hmm... these are not only +ASN.1 objects but they make up a heirachy of authentication. To +authenticate a X509 certificate one needs to retrieve it's issuers +certificate etc etc. Hmm..., so I also need to implement some kind +of certificate management software. I would also have to implement +software to authenticate certificates. At this point the support code made +the SSL part of my library look quite small. +Around this time, the first version of SSLeay was released. + +Ah, but here was the problem, I was not happy with the code so far. As may +have become obvious, I had been treating all of this as a learning +exersize, so I have completely written the library myself. As such, due +to the way it had grown like a fungus, much of the library was not +'elagent' or neat. There were global and static variables all over the +place, the SSL part did not even handle non-blocking IO. +The Great rewrite began. + +As of this point in time, the 'Great rewrite' has almost finished. So what +follows is an approximate list of what is actually SSLeay 0.5.0 + +/********* This needs to be updated for 0.6.0+ *************/ + +--- +The library contains the following routines. Please note that most of these +functions are not specfic for SSL or any other particular cipher +implementation. I have tried to make all the routines as general purpose +as possible. So you should not think of this library as an SSL +implemtation, but rather as a library of cryptographic functions +that also contains SSL. I refer to each of these function groupings as +libraries since they are often capable of functioning as independant +libraries + +First up, the general ciphers and message digests supported by the library. + +MD2 rfc???, a standard 'by parts' interface to this algorithm. +MD5 rfc???, the same type of interface as for the MD2 library except a + different algorithm. +SHA THe Secure Hash Algorithm. Again the same type of interface as + MD2/MD5 except the digest is 20 bytes. +SHA1 The 'revised' version of SHA. Just about identical to SHA except + for one tweak of an inner loop. +DES This is my libdes library that has been floating around for the last + few years. It has been enhanced for no other reason than completeness. + It now supports ecb, cbc, cfb, ofb, cfb64, ofb64 in normal mode and + triple DES modes of ecb, cbc, cfb64 and ofb64. cfb64 and ofb64 are + functional interfaces to the 64 bit modes of cfb and ofb used in + such a way thay they function as single character interfaces. +RC4 The RSA Inc. stream cipher. +RC2 The RSA Inc. block cipher. +IDEA An implmentation of the IDEA cipher, the library supports ecb, cbc, + cfb64 and ofb64 modes of operation. + +Now all the above mentioned ciphers and digests libraries support high +speed, minimal 'crap in the way' type interfaces. For fastest and +lowest level access, these routines should be used directly. + +Now there was also the matter of public key crypto systems. These are +based on large integer arithmatic. + +BN This is my large integer library. It supports all the normal + arithmentic operations. It uses malloc extensivly and as such has + no limits of the size of the numbers being manipulated. If you + wish to use 4000 bit RSA moduli, these routines will handle it. + This library also contains routines to 'generate' prime numbers and + to test for primality. The RSA and DH libraries sit on top of this + library. As of this point in time, I don't support SHA, but + when I do add it, it will just sit on top of the routines contained + in this library. +RSA This implements the RSA public key algorithm. It also contains + routines that will generate a new private/public key pair. + All the RSA functions conform to the PKCS#1 standard. +DH This is an implementation of the + Diffie-Hellman protocol. There are all the require routines for + the protocol, plus extra routines that can be used to generate a + strong prime for use with a specified generator. While this last + routine is not generally required by applications implementing DH, + It is present for completeness and because I thing it is much + better to be able to 'generate' your own 'magic' numbers as oposed + to using numbers suplied by others. I conform to the PKCS#3 + standard where required. + +You may have noticed the preceeding section mentions the 'generation' of +prime numbers. Now this requries the use of 'random numbers'. + +RAND This psuedo-random number library is based on MD5 at it's core + and a large internal state (2k bytes). Once you have entered enough + seed data into this random number algorithm I don't feel + you will ever need to worry about it generating predictable output. + Due to the way I am writing a portable library, I have left the + issue of how to get good initial random seed data upto the + application but I do have support routines for saving and loading a + persistant random number state for use between program runs. + +Now to make all these ciphers easier to use, a higher level +interface was required. In this form, the same function would be used to +encrypt 'by parts', via any one of the above mentioned ciphers. + +EVP The Digital EnVeloPe library is quite large. At it's core are + function to perform encryption and decryption by parts while using + an initial parameter to specify which of the 17 different ciphers + or 4 different message digests to use. On top of these are implmented + the digital signature functions, sign, verify, seal and open. + Base64 encoding of binary data is also done in this library. + +PEM rfc???? describe the format for Privacy Enhanced eMail. + As part of this standard, methods of encoding digital enveloped + data is an ascii format are defined. As such, I use a form of these + to encode enveloped data. While at this point in time full support + for PEM has not been built into the library, a minimal subset of + the secret key and Base64 encoding is present. These reoutines are + mostly used to Ascii encode binary data with a 'type' associated + with it and perhaps details of private key encryption used to + encrypt the data. + +PKCS7 This is another Digital Envelope encoding standard which uses ASN.1 + to encode the data. At this point in time, while there are some + routines to encode and decode this binary format, full support is + not present. + +As Mentioned, above, there are several different ways to encode +data structures. + +ASN1 This library is more a set of primatives used to encode the packing + and unpacking of data structures. It is used by the X509 + certificate standard and by the PKCS standards which are used by + this library. It also contains routines for duplicating and signing + the structures asocisated with X509. + +X509 The X509 library contains routines for packing and unpacking, + verifying and just about every thing else you would want to do with + X509 certificates. + +PKCS7 PKCS-7 is a standard for encoding digital envelope data + structures. At this point in time the routines will load and save + DER forms of these structees. They need to be re-worked to support + the BER form which is the normal way PKCS-7 is encoded. If the + previous 2 sentances don't make much sense, don't worry, this + library is not used by this version of SSLeay anyway. + +OBJ ASN.1 uses 'object identifiers' to identify objects. A set of + functions were requred to translate from ASN.1 to an intenger, to a + character string. This library provieds these translations + +Now I mentioned an X509 library. X509 specified a hieachy of certificates +which needs to be traversed to authenticate particular certificates. + +METH This library is used to push 'methods' of retrieving certificates + into the library. There are some supplied 'methods' with SSLeay + but applications can add new methods if they so desire. + This library has not been finished and is not being used in this + version. + +Now all the above are required for use in the initial point of this project. + +SSL The SSL protocol. This is a full implmentation of SSL v 2. It + support both server and client authentication. SSL v 3 support + will be added when the SSL v 3 specification is released in it's + final form. + +Now quite a few of the above mentioned libraries rely on a few 'complex' +data structures. For each of these I have a library. + +Lhash This is a hash table library which is used extensivly. + +STACK An implemetation of a Stack data structure. + +BUF A simple character array structure that also support a function to + check that the array is greater that a certain size, if it is not, + it is realloced so that is it. + +TXT_DB A simple memory based text file data base. The application can specify + unique indexes that will be enforced at update time. + +CONF Most of the programs written for this library require a configuration + file. Instead of letting programs constantly re-implment this + subsystem, the CONF library provides a consistant and flexable + interface to not only configuration files but also environment + variables. + +But what about when something goes wrong? +The one advantage (and perhaps disadvantage) of all of these +functions being in one library was the ability to implement a +single error reporting system. + +ERR This library is used to report errors. The error system records + library number, function number (in the library) and reason + number. Multiple errors can be reported so that an 'error' trace + is created. The errors can be printed in numeric or textual form. + diff --git a/src/lib/libssl/src/doc/ssluse.doc b/src/lib/libssl/src/doc/ssluse.doc new file mode 100644 index 0000000000..2e3a26cbf3 --- /dev/null +++ b/src/lib/libssl/src/doc/ssluse.doc @@ -0,0 +1,45 @@ +We have an SSL_CTX which contains global information for lots of +SSL connections. The session-id cache and the certificate verificate cache. +It also contains default values for use when certificates are used. + +SSL_CTX + default cipher list + session-id cache + certificate cache + default session-id timeout period + New session-id callback + Required session-id callback + session-id stats + Informational callback + Callback that is set, overrides the SSLeay X509 certificate + verification + The default Certificate/Private Key pair + Default read ahead mode. + Default verify mode and verify callback. These are not used + if the over ride callback mentioned above is used. + +Each SSL can have the following defined for it before a connection is made. + +Certificate +Private key +Ciphers to use +Certificate verify mode and callback +IO object to use in the comunication. +Some 'read-ahead' mode information. +A previous session-id to re-use. + +A connection is made by using SSL_connect or SSL_accept. +When non-blocking IO is being used, there are functions that can be used +to determin where and why the SSL_connect or SSL_accept did not complete. +This information can be used to recall the functions when the 'error' +condition has dissapeared. + +After the connection has been made, information can be retrived about the +SSL session and the session-id values that have been decided apon. +The 'peer' certificate can be retrieved. + +The session-id values include +'start time' +'timeout length' + + diff --git a/src/lib/libssl/src/doc/stack.doc b/src/lib/libssl/src/doc/stack.doc new file mode 100644 index 0000000000..7c20b1b664 --- /dev/null +++ b/src/lib/libssl/src/doc/stack.doc @@ -0,0 +1,96 @@ +The stack data structure is used to store an ordered list of objects. +It is basically misnamed to call it a stack but it can function that way +and that is what I originally used it for. Due to the way element +pointers are kept in a malloc()ed array, the most efficient way to use this +structure is to add and delete elements from the end via sk_pop() and +sk_push(). If you wish to do 'lookups' sk_find() is quite efficient since +it will sort the stack (if required) and then do a binary search to lookup +the requested item. This sorting occurs automatically so just sk_push() +elements on the stack and don't worry about the order. Do remember that if +you do a sk_find(), the order of the elements will change. + +You should never need to 'touch' this structure directly. +typedef struct stack_st + { + unsigned int num; + char **data; + int sorted; + + unsigned int num_alloc; + int (*comp)(); + } STACK; + +'num' holds the number of elements in the stack, 'data' is the array of +elements. 'sorted' is 1 is the list has been sorted, 0 if not. + +num_alloc is the number of 'nodes' allocated in 'data'. When num becomes +larger than num_alloc, data is realloced to a larger size. +If 'comp' is set, it is a function that is used to compare 2 of the items +in the stack. The function should return -1, 0 or 1, depending on the +ordering. + +#define sk_num(sk) ((sk)->num) +#define sk_value(sk,n) ((sk)->data[n]) + +These 2 macros should be used to access the number of elements in the +'stack' and to access a pointer to one of the values. + +STACK *sk_new(int (*c)()); + This creates a new stack. If 'c', the comparison function, is not +specified, the various functions that operate on a sorted 'stack' will not +work (sk_find()). NULL is returned on failure. + +void sk_free(STACK *); + This function free()'s a stack structure. The elements in the +stack will not be freed so one should 'pop' and free all elements from the +stack before calling this function or call sk_pop_free() instead. + +void sk_pop_free(STACK *st; void (*func)()); + This function calls 'func' for each element on the stack, passing +the element as the argument. sk_free() is then called to free the 'stack' +structure. + +int sk_insert(STACK *sk,char *data,int where); + This function inserts 'data' into stack 'sk' at location 'where'. +If 'where' is larger that the number of elements in the stack, the element +is put at the end. This function tends to be used by other 'stack' +functions. Returns 0 on failure, otherwise the number of elements in the +new stack. + +char *sk_delete(STACK *st,int loc); + Remove the item a location 'loc' from the stack and returns it. +Returns NULL if the 'loc' is out of range. + +char *sk_delete_ptr(STACK *st, char *p); + If the data item pointed to by 'p' is in the stack, it is deleted +from the stack and returned. NULL is returned if the element is not in the +stack. + +int sk_find(STACK *st,char *data); + Returns the location that contains a value that is equal to +the 'data' item. If the comparison function was not set, this function +does a linear search. This function actually qsort()s the stack if it is not +in order and then uses bsearch() to do the initial search. If the +search fails,, -1 is returned. For mutliple items with the same +value, the index of the first in the array is returned. + +int sk_push(STACK *st,char *data); + Append 'data' to the stack. 0 is returned if there is a failure +(due to a malloc failure), else 1. This is +sk_insert(st,data,sk_num(st)); + +int sk_unshift(STACK *st,char *data); + Prepend 'data' to the front (location 0) of the stack. This is +sk_insert(st,data,0); + +char *sk_shift(STACK *st); + Return and delete from the stack the first element in the stack. +This is sk_delete(st,0); + +char *sk_pop(STACK *st); + Return and delete the last element on the stack. This is +sk_delete(st,sk_num(sk)-1); + +void sk_zero(STACK *st); + Removes all items from the stack. It does not 'free' +pointers but is a quick way to clear a 'stack of references'. diff --git a/src/lib/libssl/src/doc/threads.doc b/src/lib/libssl/src/doc/threads.doc new file mode 100644 index 0000000000..251061e896 --- /dev/null +++ b/src/lib/libssl/src/doc/threads.doc @@ -0,0 +1,90 @@ +How to compile SSLeay for multi-threading. + +Well basically it is quite simple, set the compiler flags and build. +I have only really done much testing under Solaris and Windows NT. +If you library supports localtime_r() and gmtime_r() add, +-DTHREADS to the makefile parameters. You can probably survive with out +this define unless you are going to have multiple threads generating +certificates at once. It will not affect the SSL side of things. + +The approach I have taken to doing locking is to make the application provide +callbacks to perform locking and so that the SSLeay library can distinguish +between threads (for the error state). + +To have a look at an example program, 'cd mt; vi mttest.c'. +To build under solaris, sh solaris.sh, for Windows NT or Windows 95, +win32.bat + +This will build mttest which will fire up 10 threads that talk SSL +to each other 10 times. +To enable everything to work, the application needs to call + +CRYPTO_set_id_callback(id_function); +CRYPTO_set_locking_callback(locking_function); + +before any multithreading is started. +id_function does not need to be defined under Windows NT or 95, the +correct function will be called if it is not. Under unix, getpid() +is call if the id_callback is not defined, for solaris this is wrong +(since threads id's are not pid's) but under IRIX it is correct +(threads are just processes sharing the data segement). + +The locking_callback is used to perform locking by the SSLeay library. +eg. + +void solaris_locking_callback(mode,type,file,line) +int mode; +int type; +char *file; +int line; + { + if (mode & CRYPTO_LOCK) + mutex_lock(&(lock_cs[type])); + else + mutex_unlock(&(lock_cs[type])); + } + +Now in this case I have used mutexes instead of read/write locks, since they +are faster and there are not many read locks in SSLeay, you may as well +always use write locks. file and line are __FILE__ and __LINE__ from +the compile and can be usefull when debugging. + +Now as you can see, 'type' can be one of a range of values, these values are +defined in crypto/crypto.h +CRYPTO_get_lock_name(type) will return a text version of what the lock is. +There are CRYPTO_NUM_LOCKS locks required, so under solaris, the setup +for multi-threading can be + +static mutex_t lock_cs[CRYPTO_NUM_LOCKS]; + +void thread_setup() + { + int i; + + for (i=0; i<CRYPTO_NUM_LOCKS; i++) + mutex_init(&(lock_cs[i]),USYNC_THREAD,NULL); + CRYPTO_set_id_callback((unsigned long (*)())solaris_thread_id); + CRYPTO_set_locking_callback((void (*)())solaris_locking_callback); + } + +As a final note, under Windows NT or Windows 95, you have to be careful +not to mix the various threaded, unthreaded and debug libraries. +Normally if they are mixed incorrectly, mttest will crash just after printing +out some usage statistics at the end. This is because the +different system libraries use different malloc routines and if +data is malloc()ed inside crypt32.dll or ssl32.dll and then free()ed by a +different library malloc, things get very confused. + +The default SSLeay DLL builds use /MD, so if you use this on your +application, things will work as expected. If you use /MDd, +you will probably have to rebuild SSLeay using this flag. +I should modify util/mk1mf.pl so it does all this correctly, but +this has not been done yet. + +One last warning. Because locking overheads are actually quite large, the +statistics collected against the SSL_CTX for successfull connections etc +are not locked when updated. This does make it possible for these +values to be slightly lower than they should be, if you are +running multithreaded on a multi-processor box, but this does not really +matter much. + diff --git a/src/lib/libssl/src/doc/txt_db.doc b/src/lib/libssl/src/doc/txt_db.doc new file mode 100644 index 0000000000..3a5b0d50a1 --- /dev/null +++ b/src/lib/libssl/src/doc/txt_db.doc @@ -0,0 +1,4 @@ +TXT_DB, a simple text based in memory database. + +It holds rows of ascii data, for which the only special character is '\0'. +The rows can be of an unlimited length. diff --git a/src/lib/libssl/src/doc/verify b/src/lib/libssl/src/doc/verify new file mode 100644 index 0000000000..b78d96159d --- /dev/null +++ b/src/lib/libssl/src/doc/verify @@ -0,0 +1,22 @@ +X509_verify_cert_chain( + CERT_STORE *cert_store, + STACK /* X509 */ *certs, + int *verify_result, + int (*verify_error_callback)() + char *argument_to_callback, /* SSL */ + +app_verify_callback( + char *app_verify_arg, /* from SSL_CTX */ + STACK /* X509 */ *certs, + int *verify_result, + int (*verify_error_callback)() + SSL *s, + +int X509_verify_cert( + CERT_STORE *cert_store, + X509 *x509, + int *verify_result, + int (*verify_error_callback)(), + char *arg, + + diff --git a/src/lib/libssl/src/doc/why.doc b/src/lib/libssl/src/doc/why.doc new file mode 100644 index 0000000000..a1ac84bd27 --- /dev/null +++ b/src/lib/libssl/src/doc/why.doc @@ -0,0 +1,79 @@ +This file is more of a note for other people who wish to understand why +the build environment is the way it is :-). + +The include files 'depend' as follows. +Each of +crypto/*/*.c includes crypto/cryptlib.h +ssl/*.c include ssl/ssl_locl.h +apps/*.c include apps/apps.h +crypto/cryptlib.h, ssl/ssl_locl.h and apps/apps.h +all include e_os.h which contains OS/environment specific information. +If you need to add something todo with a particular environment, +add it to this file. It is worth remembering that quite a few libraries, +like lhash, des, md, sha etc etc do not include crypto/cryptlib.h. This +is because these libraries should be 'independantly compilable' and so I +try to keep them this way. +e_os.h is not so much a part of SSLeay, as the placing in one spot all the +evil OS dependant muck. + +I wanted to automate as many things as possible. This includes +error number generation. A +make errors +will scan the source files for error codes, append them to the correct +header files, and generate the functions to print the text version +of the error numbers. So don't even think about adding error numbers by +hand, put them in the form +XXXerr(XXXX_F_XXXX,YYYY_R_YYYY); +on line and it will be automatically picked up my a make errors. + +In a similar vein, programs to be added into ssleay in the apps directory +just need to have an entry added to E_EXE in makefile.ssl and +everthing will work as expected. Don't edit progs.h by hand. + +make links re-generates the symbolic links that are used. The reason why +I keep everything in its own directory, and don't put all the +test programs and header files in 'test' and 'include' is because I want +to keep the 'sub-libraries' independant. I still 'pull' out +indervidual libraries for use in specific projects where the code is +required. I have used the 'lhash' library in just about every software +project I have worked on :-). + +make depend generates dependancies and +make dclean removes them. + +You will notice that I use perl quite a bit when I could be using 'sed'. +The reason I decided to do this was to just stick to one 'extra' program. +For Windows NT, I have perl and no sed. + +The util/mk1mf.pl program can be used to generate a single makefile. +I use this because makefiles under Microsoft are horrific. +Each C compiler seems to have different linker formats, which have +to be used because the retarted C compilers explode when you do +cl -o file *.o. + +Now some would argue that I should just use the single makefile. I don't +like it during develoment for 2 reasons. First, the actuall make +command takes a long time. For my current setup, if I'm in +crypto/bn and I type make, only the crypto/bn directory gets rebuilt, +which is nice when you are modifying prototypes in bn.h which +half the SSLeay depends on. The second is that to add a new souce file +I just plonk it in at the required spot in the local makefile. This +then alows me to keep things local, I don't need to modify a 'global' +tables (the make for unix, the make for NT, the make for w31...). +When I am ripping apart a library structure, it is nice to only +have to worry about one directory :-). + +Having said all this, for the hell of it I put together 2 files that +#include all the souce code (generated by doing a ls */*.o after a build). +crypto.c takes only 30 seconds to build under NT and 2 minutes under linux +for my pentium100. Much faster that the normal build :-). +Again, the problem is that when using libraries, every program linked +to libcrypto.a would suddenly get 330k of library when it may only need +1k. This technique does look like a nice way to do shared libraries though. + +Oh yes, as a final note, to 'build' a distribution, I just type +make dist. +This cleans and packages everything. The directory needs to be called +SSLeay since the make does a 'cd ..' and renames and tars things up. + + diff --git a/src/lib/libssl/src/makefile.one b/src/lib/libssl/src/makefile.one new file mode 100644 index 0000000000..b0931e0d6f --- /dev/null +++ b/src/lib/libssl/src/makefile.one @@ -0,0 +1,1781 @@ +# This makefile has been automatically generated from the SSLeay distribution. +# This single makefile will build the complete SSLeay distribution and +# by default leave the 'intertesting' output files in ./out and the stuff +# that needs deleting in ./tmp. +# The file was generated by running 'make makefile.one', which +# does a 'make files', which writes all the environment variables from all +# the makefiles to the file call MINFO. This file is used by +# util/mk1mf.pl to generate makefile.one. +# The 'makefile per directory' system suites me when developing this +# library and also so I can 'distribute' indervidual library sections. +# The one monster makefile better suits building in non-unix +# environments. + +INSTALLTOP=/usr/local/ssl + +# Set your compiler options +CC=cc +CFLAG=-O -DTERMIO +APP_CFLAG= +LIB_CFLAG= +SHLIB_CFLAG= +APP_EX_OBJ= +SHLIB_EX_OBJ= +# add extra libraries to this define, for solaris -lsocket -lnsl would +# be added +EX_LIBS= + +# The SSLeay directory +SRC_D=. + +LINK=${CC} +LFLAGS=${CFLAGS} + +BN_MULW_OBJ= +BN_MULW_SRC= +DES_ENC_OBJ= +DES_ENC_SRC= +DES_CRYPT_OBJ= +DES_CRYPT_SRC= +BF_ENC_OBJ= +BF_ENC_SRC= +CAST_ENC_OBJ= +CAST_ENC_SRC= +RC4_ENC_OBJ= +RC4_ENC_SRC= +RC5_ENC_OBJ= +RC5_ENC_SRC= +MD5_ASM_OBJ= +MD5_ASM_SRC= +SHA1_ASM_OBJ= +SHA1_ASM_SRC= +RMD160_ASM_OBJ= +RMD160_ASM_SRC= + +# The output directory for everything intersting +OUT_D=out +# The output directory for all the temporary muck +TMP_D=tmp +# The output directory for the header files +INC_D=outinc + +CP=/bin/cp +RM=/bin/rm -f +RANLIB=$(SRC_D)/util/ranlib.sh +MKDIR=mkdir +MKLIB=ar r +MLFLAGS= +ASM=as + +###################################################### +# You should not need to touch anything below this point +###################################################### + +E_EXE=ssleay +SSL=ssl +CRYPTO=crypto +RSAGLUE=RSAglue + +# BIN_D - Binary output directory +# TEST_D - Binary test file output directory +# LIB_D - library output directory +BIN_D=$(OUT_D) +TEST_D=$(OUT_D) +LIB_D=$(OUT_D) + +# INCL_D - local library directory +# OBJ_D - temp object file directory +OBJ_D=$(TMP_D) +INCL_D=$(TMP_D) + +O_SSL= $(LIB_D)/lib$(SSL).a +O_CRYPTO= $(LIB_D)/lib$(CRYPTO).a +O_RSAGLUE= $(LIB_D)/lib$(RSAGLUE).a +SO_SSL= lib$(SSL) +SO_CRYPTO= lib$(CRYPTO) +L_SSL= $(LIB_D)/$(SSL).a +L_CRYPTO= $(LIB_D)/$(CRYPTO).a + +L_LIBS= $(L_SSL) $(L_CRYPTO) +#L_LIBS= $(O_SSL) $(O_RSAGLUE) -lrsaref $(O_CRYPTO) + +###################################################### +# Don't touch anything below this point +###################################################### + +INC=-I$(INC_D) -I$(INCL_D) +APP_CFLAGS=$(INC) $(CFLAG) $(APP_CFLAG) +LIB_CFLAGS=$(INC) $(CFLAG) $(LIB_CFLAG) +SHLIB_CFLAGS=$(INC) $(CFLAG) $(LIB_CFLAG) $(SHLIB_CFLAG) +LIBS_DEP=$(O_CRYPTO) $(O_RSAGLUE) $(O_SSL) + +############################################# +HEADER=$(INCL_D)/cryptlib.h \ + $(INCL_D)/date.h $(INCL_D)/md5_locl.h $(INCL_D)/sha_locl.h \ + $(INCL_D)/rmd_locl.h $(INCL_D)/rmdconst.h $(INCL_D)/des_locl.h \ + $(INCL_D)/rpc_des.h $(INCL_D)/podd.h $(INCL_D)/sk.h \ + $(INCL_D)/spr.h $(INCL_D)/des_ver.h $(INCL_D)/rc2_locl.h \ + $(INCL_D)/rc4_locl.h $(INCL_D)/rc5_locl.h $(INCL_D)/idea_lcl.h \ + $(INCL_D)/bf_pi.h $(INCL_D)/bf_locl.h $(INCL_D)/cast_s.h \ + $(INCL_D)/cast_lcl.h $(INCL_D)/bn_lcl.h $(INCL_D)/bn_prime.h \ + $(INCL_D)/obj_dat.h $(INCL_D)/conf_lcl.h $(INCL_D)/ssl_locl.h \ + $(INCL_D)/rsaref.h $(INCL_D)/apps.h $(INCL_D)/progs.h \ + $(INCL_D)/s_apps.h $(INCL_D)/testdsa.h $(INCL_D)/testrsa.h + +EXHEADER=$(INC_D)/e_os.h \ + $(INC_D)/crypto.h $(INC_D)/cryptall.h $(INC_D)/md2.h \ + $(INC_D)/md5.h $(INC_D)/sha.h $(INC_D)/mdc2.h \ + $(INC_D)/hmac.h $(INC_D)/ripemd.h $(INC_D)/des.h \ + $(INC_D)/rc2.h $(INC_D)/rc4.h $(INC_D)/rc5.h \ + $(INC_D)/idea.h $(INC_D)/blowfish.h $(INC_D)/cast.h \ + $(INC_D)/bn.h $(INC_D)/rsa.h $(INC_D)/dsa.h \ + $(INC_D)/dh.h $(INC_D)/buffer.h $(INC_D)/bio.h \ + $(INC_D)/bss_file.c $(INC_D)/stack.h $(INC_D)/lhash.h \ + $(INC_D)/rand.h $(INC_D)/err.h $(INC_D)/objects.h \ + $(INC_D)/evp.h $(INC_D)/pem.h $(INC_D)/asn1.h \ + $(INC_D)/asn1_mac.h $(INC_D)/x509.h $(INC_D)/x509_vfy.h \ + $(INC_D)/conf.h $(INC_D)/txt_db.h $(INC_D)/pkcs7.h \ + $(INC_D)/ssl.h $(INC_D)/ssl2.h $(INC_D)/ssl3.h \ + $(INC_D)/ssl23.h $(INC_D)/tls1.h + +T_OBJ=$(OBJ_D)/md2test.o \ + $(OBJ_D)/md5test.o $(OBJ_D)/shatest.o $(OBJ_D)/sha1test.o \ + $(OBJ_D)/mdc2test.o $(OBJ_D)/hmactest.o $(OBJ_D)/rmdtest.o \ + $(OBJ_D)/destest.o $(OBJ_D)/rc2test.o $(OBJ_D)/rc4test.o \ + $(OBJ_D)/rc5test.o $(OBJ_D)/ideatest.o $(OBJ_D)/bftest.o \ + $(OBJ_D)/casttest.o $(OBJ_D)/bntest.o $(OBJ_D)/exptest.o \ + $(OBJ_D)/dsatest.o $(OBJ_D)/dhtest.o $(OBJ_D)/randtest.o \ + $(OBJ_D)/ssltest.o + +E_OBJ=$(OBJ_D)/verify.o \ + $(OBJ_D)/asn1pars.o $(OBJ_D)/req.o $(OBJ_D)/dgst.o \ + $(OBJ_D)/dh.o $(OBJ_D)/enc.o $(OBJ_D)/gendh.o \ + $(OBJ_D)/errstr.o $(OBJ_D)/ca.o $(OBJ_D)/pkcs7.o \ + $(OBJ_D)/crl2p7.o $(OBJ_D)/crl.o $(OBJ_D)/rsa.o \ + $(OBJ_D)/dsa.o $(OBJ_D)/dsaparam.o $(OBJ_D)/x509.o \ + $(OBJ_D)/genrsa.o $(OBJ_D)/s_server.o $(OBJ_D)/s_client.o \ + $(OBJ_D)/speed.o $(OBJ_D)/s_time.o $(OBJ_D)/apps.o \ + $(OBJ_D)/s_cb.o $(OBJ_D)/s_socket.o $(OBJ_D)/version.o \ + $(OBJ_D)/sess_id.o $(OBJ_D)/ciphers.o $(OBJ_D)/ssleay.o + +CRYPTOOBJ=$(OBJ_D)/cryptlib.o \ + $(OBJ_D)/mem.o $(OBJ_D)/cversion.o $(OBJ_D)/ex_data.o \ + $(OBJ_D)/cpt_err.o $(OBJ_D)/md2_dgst.o $(OBJ_D)/md2_one.o \ + $(OBJ_D)/md5_dgst.o $(OBJ_D)/md5_one.o $(OBJ_D)/sha_dgst.o \ + $(OBJ_D)/sha1dgst.o $(OBJ_D)/sha_one.o $(OBJ_D)/sha1_one.o \ + $(OBJ_D)/mdc2dgst.o $(OBJ_D)/mdc2_one.o $(OBJ_D)/hmac.o \ + $(OBJ_D)/rmd_dgst.o $(OBJ_D)/rmd_one.o $(OBJ_D)/set_key.o \ + $(OBJ_D)/ecb_enc.o $(OBJ_D)/cbc_enc.o $(OBJ_D)/ecb3_enc.o \ + $(OBJ_D)/cfb64enc.o $(OBJ_D)/cfb64ede.o $(OBJ_D)/cfb_enc.o \ + $(OBJ_D)/ofb64ede.o $(OBJ_D)/enc_read.o $(OBJ_D)/enc_writ.o \ + $(OBJ_D)/ofb64enc.o $(OBJ_D)/ofb_enc.o $(OBJ_D)/str2key.o \ + $(OBJ_D)/pcbc_enc.o $(OBJ_D)/qud_cksm.o $(OBJ_D)/rand_key.o \ + $(OBJ_D)/des_enc.o $(OBJ_D)/fcrypt_b.o $(OBJ_D)/read2pwd.o \ + $(OBJ_D)/fcrypt.o $(OBJ_D)/xcbc_enc.o $(OBJ_D)/read_pwd.o \ + $(OBJ_D)/rpc_enc.o $(OBJ_D)/cbc_cksm.o $(OBJ_D)/supp.o \ + $(OBJ_D)/rc2_ecb.o $(OBJ_D)/rc2_skey.o $(OBJ_D)/rc2_cbc.o \ + $(OBJ_D)/rc2cfb64.o $(OBJ_D)/rc2ofb64.o $(OBJ_D)/rc4_skey.o \ + $(OBJ_D)/rc4_enc.o $(OBJ_D)/rc5_skey.o $(OBJ_D)/rc5_ecb.o \ + $(OBJ_D)/rc5_enc.o $(OBJ_D)/rc5cfb64.o $(OBJ_D)/rc5ofb64.o \ + $(OBJ_D)/i_cbc.o $(OBJ_D)/i_cfb64.o $(OBJ_D)/i_ofb64.o \ + $(OBJ_D)/i_ecb.o $(OBJ_D)/i_skey.o $(OBJ_D)/bf_skey.o \ + $(OBJ_D)/bf_ecb.o $(OBJ_D)/bf_enc.o $(OBJ_D)/bf_cfb64.o \ + $(OBJ_D)/bf_ofb64.o $(OBJ_D)/c_skey.o $(OBJ_D)/c_ecb.o \ + $(OBJ_D)/c_enc.o $(OBJ_D)/c_cfb64.o $(OBJ_D)/c_ofb64.o \ + $(OBJ_D)/bn_add.o $(OBJ_D)/bn_div.o $(OBJ_D)/bn_exp.o \ + $(OBJ_D)/bn_lib.o $(OBJ_D)/bn_mod.o $(OBJ_D)/bn_mul.o \ + $(OBJ_D)/bn_print.o $(OBJ_D)/bn_rand.o $(OBJ_D)/bn_shift.o \ + $(OBJ_D)/bn_sub.o $(OBJ_D)/bn_word.o $(OBJ_D)/bn_blind.o \ + $(OBJ_D)/bn_gcd.o $(OBJ_D)/bn_prime.o $(OBJ_D)/bn_err.o \ + $(OBJ_D)/bn_sqr.o $(OBJ_D)/bn_mulw.o $(OBJ_D)/bn_recp.o \ + $(OBJ_D)/bn_mont.o $(OBJ_D)/bn_mpi.o $(OBJ_D)/rsa_eay.o \ + $(OBJ_D)/rsa_gen.o $(OBJ_D)/rsa_lib.o $(OBJ_D)/rsa_sign.o \ + $(OBJ_D)/rsa_saos.o $(OBJ_D)/rsa_err.o $(OBJ_D)/rsa_pk1.o \ + $(OBJ_D)/rsa_ssl.o $(OBJ_D)/rsa_none.o $(OBJ_D)/dsa_gen.o \ + $(OBJ_D)/dsa_key.o $(OBJ_D)/dsa_lib.o $(OBJ_D)/dsa_vrf.o \ + $(OBJ_D)/dsa_sign.o $(OBJ_D)/dsa_err.o $(OBJ_D)/dh_gen.o \ + $(OBJ_D)/dh_key.o $(OBJ_D)/dh_lib.o $(OBJ_D)/dh_check.o \ + $(OBJ_D)/dh_err.o $(OBJ_D)/buffer.o $(OBJ_D)/buf_err.o \ + $(OBJ_D)/bio_lib.o $(OBJ_D)/bio_cb.o $(OBJ_D)/bio_err.o \ + $(OBJ_D)/bss_mem.o $(OBJ_D)/bss_null.o $(OBJ_D)/bss_fd.o \ + $(OBJ_D)/bss_file.o $(OBJ_D)/bss_sock.o $(OBJ_D)/bss_conn.o \ + $(OBJ_D)/bf_null.o $(OBJ_D)/bf_buff.o $(OBJ_D)/b_print.o \ + $(OBJ_D)/b_dump.o $(OBJ_D)/b_sock.o $(OBJ_D)/bss_acpt.o \ + $(OBJ_D)/bf_nbio.o $(OBJ_D)/stack.o $(OBJ_D)/lhash.o \ + $(OBJ_D)/lh_stats.o $(OBJ_D)/md_rand.o $(OBJ_D)/randfile.o \ + $(OBJ_D)/err.o $(OBJ_D)/err_all.o $(OBJ_D)/err_prn.o \ + $(OBJ_D)/obj_dat.o $(OBJ_D)/obj_lib.o $(OBJ_D)/obj_err.o \ + $(OBJ_D)/encode.o $(OBJ_D)/digest.o $(OBJ_D)/evp_enc.o \ + $(OBJ_D)/evp_key.o $(OBJ_D)/e_ecb_d.o $(OBJ_D)/e_cbc_d.o \ + $(OBJ_D)/e_cfb_d.o $(OBJ_D)/e_ofb_d.o $(OBJ_D)/e_ecb_i.o \ + $(OBJ_D)/e_cbc_i.o $(OBJ_D)/e_cfb_i.o $(OBJ_D)/e_ofb_i.o \ + $(OBJ_D)/e_ecb_3d.o $(OBJ_D)/e_cbc_3d.o $(OBJ_D)/e_rc4.o \ + $(OBJ_D)/names.o $(OBJ_D)/e_cfb_3d.o $(OBJ_D)/e_ofb_3d.o \ + $(OBJ_D)/e_xcbc_d.o $(OBJ_D)/e_ecb_r2.o $(OBJ_D)/e_cbc_r2.o \ + $(OBJ_D)/e_cfb_r2.o $(OBJ_D)/e_ofb_r2.o $(OBJ_D)/e_ecb_bf.o \ + $(OBJ_D)/e_cbc_bf.o $(OBJ_D)/e_cfb_bf.o $(OBJ_D)/e_ofb_bf.o \ + $(OBJ_D)/e_ecb_c.o $(OBJ_D)/e_cbc_c.o $(OBJ_D)/e_cfb_c.o \ + $(OBJ_D)/e_ofb_c.o $(OBJ_D)/e_ecb_r5.o $(OBJ_D)/e_cbc_r5.o \ + $(OBJ_D)/e_cfb_r5.o $(OBJ_D)/e_ofb_r5.o $(OBJ_D)/m_null.o \ + $(OBJ_D)/m_md2.o $(OBJ_D)/m_md5.o $(OBJ_D)/m_sha.o \ + $(OBJ_D)/m_sha1.o $(OBJ_D)/m_dss.o $(OBJ_D)/m_dss1.o \ + $(OBJ_D)/m_mdc2.o $(OBJ_D)/m_ripemd.o $(OBJ_D)/p_open.o \ + $(OBJ_D)/p_seal.o $(OBJ_D)/p_sign.o $(OBJ_D)/p_verify.o \ + $(OBJ_D)/p_lib.o $(OBJ_D)/p_enc.o $(OBJ_D)/p_dec.o \ + $(OBJ_D)/bio_md.o $(OBJ_D)/bio_b64.o $(OBJ_D)/bio_enc.o \ + $(OBJ_D)/evp_err.o $(OBJ_D)/e_null.o $(OBJ_D)/c_all.o \ + $(OBJ_D)/evp_lib.o $(OBJ_D)/pem_sign.o $(OBJ_D)/pem_seal.o \ + $(OBJ_D)/pem_info.o $(OBJ_D)/pem_lib.o $(OBJ_D)/pem_all.o \ + $(OBJ_D)/pem_err.o $(OBJ_D)/a_object.o $(OBJ_D)/a_bitstr.o \ + $(OBJ_D)/a_utctm.o $(OBJ_D)/a_int.o $(OBJ_D)/a_octet.o \ + $(OBJ_D)/a_print.o $(OBJ_D)/a_type.o $(OBJ_D)/a_set.o \ + $(OBJ_D)/a_dup.o $(OBJ_D)/a_d2i_fp.o $(OBJ_D)/a_i2d_fp.o \ + $(OBJ_D)/a_sign.o $(OBJ_D)/a_digest.o $(OBJ_D)/a_verify.o \ + $(OBJ_D)/x_algor.o $(OBJ_D)/x_val.o $(OBJ_D)/x_pubkey.o \ + $(OBJ_D)/x_sig.o $(OBJ_D)/x_req.o $(OBJ_D)/x_attrib.o \ + $(OBJ_D)/x_name.o $(OBJ_D)/x_cinf.o $(OBJ_D)/x_x509.o \ + $(OBJ_D)/x_crl.o $(OBJ_D)/x_info.o $(OBJ_D)/x_spki.o \ + $(OBJ_D)/d2i_r_pr.o $(OBJ_D)/i2d_r_pr.o $(OBJ_D)/d2i_r_pu.o \ + $(OBJ_D)/i2d_r_pu.o $(OBJ_D)/d2i_s_pr.o $(OBJ_D)/i2d_s_pr.o \ + $(OBJ_D)/d2i_s_pu.o $(OBJ_D)/i2d_s_pu.o $(OBJ_D)/d2i_pu.o \ + $(OBJ_D)/d2i_pr.o $(OBJ_D)/i2d_pu.o $(OBJ_D)/i2d_pr.o \ + $(OBJ_D)/t_req.o $(OBJ_D)/t_x509.o $(OBJ_D)/t_pkey.o \ + $(OBJ_D)/p7_i_s.o $(OBJ_D)/p7_signi.o $(OBJ_D)/p7_signd.o \ + $(OBJ_D)/p7_recip.o $(OBJ_D)/p7_enc_c.o $(OBJ_D)/p7_evp.o \ + $(OBJ_D)/p7_dgst.o $(OBJ_D)/p7_s_e.o $(OBJ_D)/p7_enc.o \ + $(OBJ_D)/p7_lib.o $(OBJ_D)/f_int.o $(OBJ_D)/f_string.o \ + $(OBJ_D)/i2d_dhp.o $(OBJ_D)/i2d_dsap.o $(OBJ_D)/d2i_dhp.o \ + $(OBJ_D)/d2i_dsap.o $(OBJ_D)/n_pkey.o $(OBJ_D)/a_hdr.o \ + $(OBJ_D)/x_pkey.o $(OBJ_D)/a_bool.o $(OBJ_D)/x_exten.o \ + $(OBJ_D)/asn1_par.o $(OBJ_D)/asn1_lib.o $(OBJ_D)/asn1_err.o \ + $(OBJ_D)/a_meth.o $(OBJ_D)/a_bytes.o $(OBJ_D)/evp_asn1.o \ + $(OBJ_D)/x509_def.o $(OBJ_D)/x509_d2.o $(OBJ_D)/x509_r2x.o \ + $(OBJ_D)/x509_cmp.o $(OBJ_D)/x509_obj.o $(OBJ_D)/x509_req.o \ + $(OBJ_D)/x509_vfy.o $(OBJ_D)/x509_set.o $(OBJ_D)/x509rset.o \ + $(OBJ_D)/x509_err.o $(OBJ_D)/x509name.o $(OBJ_D)/x509_v3.o \ + $(OBJ_D)/x509_ext.o $(OBJ_D)/x509pack.o $(OBJ_D)/x509type.o \ + $(OBJ_D)/x509_lu.o $(OBJ_D)/x_all.o $(OBJ_D)/x509_txt.o \ + $(OBJ_D)/by_file.o $(OBJ_D)/by_dir.o $(OBJ_D)/v3_net.o \ + $(OBJ_D)/v3_x509.o $(OBJ_D)/conf.o $(OBJ_D)/conf_err.o \ + $(OBJ_D)/txt_db.o $(OBJ_D)/pk7_lib.o $(OBJ_D)/pkcs7err.o \ + $(OBJ_D)/pk7_doit.o + +SSLOBJ=$(OBJ_D)/s2_meth.o \ + $(OBJ_D)/s2_srvr.o $(OBJ_D)/s2_clnt.o $(OBJ_D)/s2_lib.o \ + $(OBJ_D)/s2_enc.o $(OBJ_D)/s2_pkt.o $(OBJ_D)/s3_meth.o \ + $(OBJ_D)/s3_srvr.o $(OBJ_D)/s3_clnt.o $(OBJ_D)/s3_lib.o \ + $(OBJ_D)/s3_enc.o $(OBJ_D)/s3_pkt.o $(OBJ_D)/s3_both.o \ + $(OBJ_D)/s23_meth.o $(OBJ_D)/s23_srvr.o $(OBJ_D)/s23_clnt.o \ + $(OBJ_D)/s23_lib.o $(OBJ_D)/s23_pkt.o $(OBJ_D)/t1_meth.o \ + $(OBJ_D)/t1_srvr.o $(OBJ_D)/t1_clnt.o $(OBJ_D)/t1_lib.o \ + $(OBJ_D)/t1_enc.o $(OBJ_D)/ssl_lib.o $(OBJ_D)/ssl_err2.o \ + $(OBJ_D)/ssl_cert.o $(OBJ_D)/ssl_sess.o $(OBJ_D)/ssl_ciph.o \ + $(OBJ_D)/ssl_stat.o $(OBJ_D)/ssl_rsa.o $(OBJ_D)/ssl_asn1.o \ + $(OBJ_D)/ssl_txt.o $(OBJ_D)/ssl_algs.o $(OBJ_D)/bio_ssl.o \ + $(OBJ_D)/ssl_err.o + +RSAGLUEOBJ=$(OBJ_D)/rsaref.o \ + $(OBJ_D)/rsar_err.o + +T_EXE=$(TEST_D)/md2test \ + $(TEST_D)/md5test $(TEST_D)/shatest $(TEST_D)/sha1test \ + $(TEST_D)/mdc2test $(TEST_D)/hmactest $(TEST_D)/rmdtest \ + $(TEST_D)/destest $(TEST_D)/rc2test $(TEST_D)/rc4test \ + $(TEST_D)/rc5test $(TEST_D)/ideatest $(TEST_D)/bftest \ + $(TEST_D)/casttest $(TEST_D)/bntest $(TEST_D)/exptest \ + $(TEST_D)/dsatest $(TEST_D)/dhtest $(TEST_D)/randtest \ + $(TEST_D)/ssltest + +################################################################### +all: banner $(TMP_D) $(BIN_D) $(TEST_D) $(LIB_D) $(INC_D) headers lib exe + +banner: + + +$(TMP_D): + $(MKDIR) $(TMP_D) + +$(BIN_D): + $(MKDIR) $(BIN_D) + +$(TEST_D): + $(MKDIR) $(TEST_D) + +$(LIB_D): + $(MKDIR) $(LIB_D) + +$(INC_D): + $(MKDIR) $(INC_D) + +headers: $(HEADER) $(EXHEADER) + +lib: $(LIBS_DEP) + +exe: $(T_EXE) $(BIN_D)/$(E_EXE) + +install: + $(MKDIR) $(INSTALLTOP) + $(MKDIR) $(INSTALLTOP)/bin + $(MKDIR) $(INSTALLTOP)/include + $(MKDIR) $(INSTALLTOP)/lib + $(CP) $(INC_D)/*.[ch] $(INSTALLTOP)/include + $(CP) $(BIN_D)/$(E_EXE) $(INSTALLTOP)/bin + $(CP) $(O_SSL) $(INSTALLTOP)/lib + $(CP) $(O_CRYPTO) $(INSTALLTOP)/lib + +clean: + $(RM) $(TMP_D)/*.* + +vclean: + $(RM) $(TMP_D)/*.* + $(RM) $(OUT_D)/*.* + +$(INCL_D)/cryptlib.h: $(SRC_D)/crypto/cryptlib.h + $(CP) $(SRC_D)/crypto/cryptlib.h $(INCL_D)/cryptlib.h + +$(INCL_D)/date.h: $(SRC_D)/crypto/date.h + $(CP) $(SRC_D)/crypto/date.h $(INCL_D)/date.h + +$(INCL_D)/md5_locl.h: $(SRC_D)/crypto/md5/md5_locl.h + $(CP) $(SRC_D)/crypto/md5/md5_locl.h $(INCL_D)/md5_locl.h + +$(INCL_D)/sha_locl.h: $(SRC_D)/crypto/sha/sha_locl.h + $(CP) $(SRC_D)/crypto/sha/sha_locl.h $(INCL_D)/sha_locl.h + +$(INCL_D)/rmd_locl.h: $(SRC_D)/crypto/ripemd/rmd_locl.h + $(CP) $(SRC_D)/crypto/ripemd/rmd_locl.h $(INCL_D)/rmd_locl.h + +$(INCL_D)/rmdconst.h: $(SRC_D)/crypto/ripemd/rmdconst.h + $(CP) $(SRC_D)/crypto/ripemd/rmdconst.h $(INCL_D)/rmdconst.h + +$(INCL_D)/des_locl.h: $(SRC_D)/crypto/des/des_locl.h + $(CP) $(SRC_D)/crypto/des/des_locl.h $(INCL_D)/des_locl.h + +$(INCL_D)/rpc_des.h: $(SRC_D)/crypto/des/rpc_des.h + $(CP) $(SRC_D)/crypto/des/rpc_des.h $(INCL_D)/rpc_des.h + +$(INCL_D)/podd.h: $(SRC_D)/crypto/des/podd.h + $(CP) $(SRC_D)/crypto/des/podd.h $(INCL_D)/podd.h + +$(INCL_D)/sk.h: $(SRC_D)/crypto/des/sk.h + $(CP) $(SRC_D)/crypto/des/sk.h $(INCL_D)/sk.h + +$(INCL_D)/spr.h: $(SRC_D)/crypto/des/spr.h + $(CP) $(SRC_D)/crypto/des/spr.h $(INCL_D)/spr.h + +$(INCL_D)/des_ver.h: $(SRC_D)/crypto/des/des_ver.h + $(CP) $(SRC_D)/crypto/des/des_ver.h $(INCL_D)/des_ver.h + +$(INCL_D)/rc2_locl.h: $(SRC_D)/crypto/rc2/rc2_locl.h + $(CP) $(SRC_D)/crypto/rc2/rc2_locl.h $(INCL_D)/rc2_locl.h + +$(INCL_D)/rc4_locl.h: $(SRC_D)/crypto/rc4/rc4_locl.h + $(CP) $(SRC_D)/crypto/rc4/rc4_locl.h $(INCL_D)/rc4_locl.h + +$(INCL_D)/rc5_locl.h: $(SRC_D)/crypto/rc5/rc5_locl.h + $(CP) $(SRC_D)/crypto/rc5/rc5_locl.h $(INCL_D)/rc5_locl.h + +$(INCL_D)/idea_lcl.h: $(SRC_D)/crypto/idea/idea_lcl.h + $(CP) $(SRC_D)/crypto/idea/idea_lcl.h $(INCL_D)/idea_lcl.h + +$(INCL_D)/bf_pi.h: $(SRC_D)/crypto/bf/bf_pi.h + $(CP) $(SRC_D)/crypto/bf/bf_pi.h $(INCL_D)/bf_pi.h + +$(INCL_D)/bf_locl.h: $(SRC_D)/crypto/bf/bf_locl.h + $(CP) $(SRC_D)/crypto/bf/bf_locl.h $(INCL_D)/bf_locl.h + +$(INCL_D)/cast_s.h: $(SRC_D)/crypto/cast/cast_s.h + $(CP) $(SRC_D)/crypto/cast/cast_s.h $(INCL_D)/cast_s.h + +$(INCL_D)/cast_lcl.h: $(SRC_D)/crypto/cast/cast_lcl.h + $(CP) $(SRC_D)/crypto/cast/cast_lcl.h $(INCL_D)/cast_lcl.h + +$(INCL_D)/bn_lcl.h: $(SRC_D)/crypto/bn/bn_lcl.h + $(CP) $(SRC_D)/crypto/bn/bn_lcl.h $(INCL_D)/bn_lcl.h + +$(INCL_D)/bn_prime.h: $(SRC_D)/crypto/bn/bn_prime.h + $(CP) $(SRC_D)/crypto/bn/bn_prime.h $(INCL_D)/bn_prime.h + +$(INCL_D)/obj_dat.h: $(SRC_D)/crypto/objects/obj_dat.h + $(CP) $(SRC_D)/crypto/objects/obj_dat.h $(INCL_D)/obj_dat.h + +$(INCL_D)/conf_lcl.h: $(SRC_D)/crypto/conf/conf_lcl.h + $(CP) $(SRC_D)/crypto/conf/conf_lcl.h $(INCL_D)/conf_lcl.h + +$(INCL_D)/ssl_locl.h: $(SRC_D)/ssl/ssl_locl.h + $(CP) $(SRC_D)/ssl/ssl_locl.h $(INCL_D)/ssl_locl.h + +$(INCL_D)/rsaref.h: $(SRC_D)/rsaref/rsaref.h + $(CP) $(SRC_D)/rsaref/rsaref.h $(INCL_D)/rsaref.h + +$(INCL_D)/apps.h: $(SRC_D)/apps/apps.h + $(CP) $(SRC_D)/apps/apps.h $(INCL_D)/apps.h + +$(INCL_D)/progs.h: $(SRC_D)/apps/progs.h + $(CP) $(SRC_D)/apps/progs.h $(INCL_D)/progs.h + +$(INCL_D)/s_apps.h: $(SRC_D)/apps/s_apps.h + $(CP) $(SRC_D)/apps/s_apps.h $(INCL_D)/s_apps.h + +$(INCL_D)/testdsa.h: $(SRC_D)/apps/testdsa.h + $(CP) $(SRC_D)/apps/testdsa.h $(INCL_D)/testdsa.h + +$(INCL_D)/testrsa.h: $(SRC_D)/apps/testrsa.h + $(CP) $(SRC_D)/apps/testrsa.h $(INCL_D)/testrsa.h + +$(INC_D)/e_os.h: $(SRC_D)/./e_os.h + $(CP) $(SRC_D)/./e_os.h $(INC_D)/e_os.h + +$(INC_D)/crypto.h: $(SRC_D)/crypto/crypto.h + $(CP) $(SRC_D)/crypto/crypto.h $(INC_D)/crypto.h + +$(INC_D)/cryptall.h: $(SRC_D)/crypto/cryptall.h + $(CP) $(SRC_D)/crypto/cryptall.h $(INC_D)/cryptall.h + +$(INC_D)/md2.h: $(SRC_D)/crypto/md2/md2.h + $(CP) $(SRC_D)/crypto/md2/md2.h $(INC_D)/md2.h + +$(INC_D)/md5.h: $(SRC_D)/crypto/md5/md5.h + $(CP) $(SRC_D)/crypto/md5/md5.h $(INC_D)/md5.h + +$(INC_D)/sha.h: $(SRC_D)/crypto/sha/sha.h + $(CP) $(SRC_D)/crypto/sha/sha.h $(INC_D)/sha.h + +$(INC_D)/mdc2.h: $(SRC_D)/crypto/mdc2/mdc2.h + $(CP) $(SRC_D)/crypto/mdc2/mdc2.h $(INC_D)/mdc2.h + +$(INC_D)/hmac.h: $(SRC_D)/crypto/hmac/hmac.h + $(CP) $(SRC_D)/crypto/hmac/hmac.h $(INC_D)/hmac.h + +$(INC_D)/ripemd.h: $(SRC_D)/crypto/ripemd/ripemd.h + $(CP) $(SRC_D)/crypto/ripemd/ripemd.h $(INC_D)/ripemd.h + +$(INC_D)/des.h: $(SRC_D)/crypto/des/des.h + $(CP) $(SRC_D)/crypto/des/des.h $(INC_D)/des.h + +$(INC_D)/rc2.h: $(SRC_D)/crypto/rc2/rc2.h + $(CP) $(SRC_D)/crypto/rc2/rc2.h $(INC_D)/rc2.h + +$(INC_D)/rc4.h: $(SRC_D)/crypto/rc4/rc4.h + $(CP) $(SRC_D)/crypto/rc4/rc4.h $(INC_D)/rc4.h + +$(INC_D)/rc5.h: $(SRC_D)/crypto/rc5/rc5.h + $(CP) $(SRC_D)/crypto/rc5/rc5.h $(INC_D)/rc5.h + +$(INC_D)/idea.h: $(SRC_D)/crypto/idea/idea.h + $(CP) $(SRC_D)/crypto/idea/idea.h $(INC_D)/idea.h + +$(INC_D)/blowfish.h: $(SRC_D)/crypto/bf/blowfish.h + $(CP) $(SRC_D)/crypto/bf/blowfish.h $(INC_D)/blowfish.h + +$(INC_D)/cast.h: $(SRC_D)/crypto/cast/cast.h + $(CP) $(SRC_D)/crypto/cast/cast.h $(INC_D)/cast.h + +$(INC_D)/bn.h: $(SRC_D)/crypto/bn/bn.h + $(CP) $(SRC_D)/crypto/bn/bn.h $(INC_D)/bn.h + +$(INC_D)/rsa.h: $(SRC_D)/crypto/rsa/rsa.h + $(CP) $(SRC_D)/crypto/rsa/rsa.h $(INC_D)/rsa.h + +$(INC_D)/dsa.h: $(SRC_D)/crypto/dsa/dsa.h + $(CP) $(SRC_D)/crypto/dsa/dsa.h $(INC_D)/dsa.h + +$(INC_D)/dh.h: $(SRC_D)/crypto/dh/dh.h + $(CP) $(SRC_D)/crypto/dh/dh.h $(INC_D)/dh.h + +$(INC_D)/buffer.h: $(SRC_D)/crypto/buffer/buffer.h + $(CP) $(SRC_D)/crypto/buffer/buffer.h $(INC_D)/buffer.h + +$(INC_D)/bio.h: $(SRC_D)/crypto/bio/bio.h + $(CP) $(SRC_D)/crypto/bio/bio.h $(INC_D)/bio.h + +$(INC_D)/bss_file.c: $(SRC_D)/crypto/bio/bss_file.c + $(CP) $(SRC_D)/crypto/bio/bss_file.c $(INC_D)/bss_file.c + +$(INC_D)/stack.h: $(SRC_D)/crypto/stack/stack.h + $(CP) $(SRC_D)/crypto/stack/stack.h $(INC_D)/stack.h + +$(INC_D)/lhash.h: $(SRC_D)/crypto/lhash/lhash.h + $(CP) $(SRC_D)/crypto/lhash/lhash.h $(INC_D)/lhash.h + +$(INC_D)/rand.h: $(SRC_D)/crypto/rand/rand.h + $(CP) $(SRC_D)/crypto/rand/rand.h $(INC_D)/rand.h + +$(INC_D)/err.h: $(SRC_D)/crypto/err/err.h + $(CP) $(SRC_D)/crypto/err/err.h $(INC_D)/err.h + +$(INC_D)/objects.h: $(SRC_D)/crypto/objects/objects.h + $(CP) $(SRC_D)/crypto/objects/objects.h $(INC_D)/objects.h + +$(INC_D)/evp.h: $(SRC_D)/crypto/evp/evp.h + $(CP) $(SRC_D)/crypto/evp/evp.h $(INC_D)/evp.h + +$(INC_D)/pem.h: $(SRC_D)/crypto/pem/pem.h + $(CP) $(SRC_D)/crypto/pem/pem.h $(INC_D)/pem.h + +$(INC_D)/asn1.h: $(SRC_D)/crypto/asn1/asn1.h + $(CP) $(SRC_D)/crypto/asn1/asn1.h $(INC_D)/asn1.h + +$(INC_D)/asn1_mac.h: $(SRC_D)/crypto/asn1/asn1_mac.h + $(CP) $(SRC_D)/crypto/asn1/asn1_mac.h $(INC_D)/asn1_mac.h + +$(INC_D)/x509.h: $(SRC_D)/crypto/x509/x509.h + $(CP) $(SRC_D)/crypto/x509/x509.h $(INC_D)/x509.h + +$(INC_D)/x509_vfy.h: $(SRC_D)/crypto/x509/x509_vfy.h + $(CP) $(SRC_D)/crypto/x509/x509_vfy.h $(INC_D)/x509_vfy.h + +$(INC_D)/conf.h: $(SRC_D)/crypto/conf/conf.h + $(CP) $(SRC_D)/crypto/conf/conf.h $(INC_D)/conf.h + +$(INC_D)/txt_db.h: $(SRC_D)/crypto/txt_db/txt_db.h + $(CP) $(SRC_D)/crypto/txt_db/txt_db.h $(INC_D)/txt_db.h + +$(INC_D)/pkcs7.h: $(SRC_D)/crypto/pkcs7/pkcs7.h + $(CP) $(SRC_D)/crypto/pkcs7/pkcs7.h $(INC_D)/pkcs7.h + +$(INC_D)/ssl.h: $(SRC_D)/ssl/ssl.h + $(CP) $(SRC_D)/ssl/ssl.h $(INC_D)/ssl.h + +$(INC_D)/ssl2.h: $(SRC_D)/ssl/ssl2.h + $(CP) $(SRC_D)/ssl/ssl2.h $(INC_D)/ssl2.h + +$(INC_D)/ssl3.h: $(SRC_D)/ssl/ssl3.h + $(CP) $(SRC_D)/ssl/ssl3.h $(INC_D)/ssl3.h + +$(INC_D)/ssl23.h: $(SRC_D)/ssl/ssl23.h + $(CP) $(SRC_D)/ssl/ssl23.h $(INC_D)/ssl23.h + +$(INC_D)/tls1.h: $(SRC_D)/ssl/tls1.h + $(CP) $(SRC_D)/ssl/tls1.h $(INC_D)/tls1.h + +$(OBJ_D)/md2test.o: $(SRC_D)/crypto/md2/md2test.c + $(CC) -o $(OBJ_D)/md2test.o $(APP_CFLAGS) -c $(SRC_D)/crypto/md2/md2test.c + +$(OBJ_D)/md5test.o: $(SRC_D)/crypto/md5/md5test.c + $(CC) -o $(OBJ_D)/md5test.o $(APP_CFLAGS) -c $(SRC_D)/crypto/md5/md5test.c + +$(OBJ_D)/shatest.o: $(SRC_D)/crypto/sha/shatest.c + $(CC) -o $(OBJ_D)/shatest.o $(APP_CFLAGS) -c $(SRC_D)/crypto/sha/shatest.c + +$(OBJ_D)/sha1test.o: $(SRC_D)/crypto/sha/sha1test.c + $(CC) -o $(OBJ_D)/sha1test.o $(APP_CFLAGS) -c $(SRC_D)/crypto/sha/sha1test.c + +$(OBJ_D)/mdc2test.o: $(SRC_D)/crypto/mdc2/mdc2test.c + $(CC) -o $(OBJ_D)/mdc2test.o $(APP_CFLAGS) -c $(SRC_D)/crypto/mdc2/mdc2test.c + +$(OBJ_D)/hmactest.o: $(SRC_D)/crypto/hmac/hmactest.c + $(CC) -o $(OBJ_D)/hmactest.o $(APP_CFLAGS) -c $(SRC_D)/crypto/hmac/hmactest.c + +$(OBJ_D)/rmdtest.o: $(SRC_D)/crypto/ripemd/rmdtest.c + $(CC) -o $(OBJ_D)/rmdtest.o $(APP_CFLAGS) -c $(SRC_D)/crypto/ripemd/rmdtest.c + +$(OBJ_D)/destest.o: $(SRC_D)/crypto/des/destest.c + $(CC) -o $(OBJ_D)/destest.o $(APP_CFLAGS) -c $(SRC_D)/crypto/des/destest.c + +$(OBJ_D)/rc2test.o: $(SRC_D)/crypto/rc2/rc2test.c + $(CC) -o $(OBJ_D)/rc2test.o $(APP_CFLAGS) -c $(SRC_D)/crypto/rc2/rc2test.c + +$(OBJ_D)/rc4test.o: $(SRC_D)/crypto/rc4/rc4test.c + $(CC) -o $(OBJ_D)/rc4test.o $(APP_CFLAGS) -c $(SRC_D)/crypto/rc4/rc4test.c + +$(OBJ_D)/rc5test.o: $(SRC_D)/crypto/rc5/rc5test.c + $(CC) -o $(OBJ_D)/rc5test.o $(APP_CFLAGS) -c $(SRC_D)/crypto/rc5/rc5test.c + +$(OBJ_D)/ideatest.o: $(SRC_D)/crypto/idea/ideatest.c + $(CC) -o $(OBJ_D)/ideatest.o $(APP_CFLAGS) -c $(SRC_D)/crypto/idea/ideatest.c + +$(OBJ_D)/bftest.o: $(SRC_D)/crypto/bf/bftest.c + $(CC) -o $(OBJ_D)/bftest.o $(APP_CFLAGS) -c $(SRC_D)/crypto/bf/bftest.c + +$(OBJ_D)/casttest.o: $(SRC_D)/crypto/cast/casttest.c + $(CC) -o $(OBJ_D)/casttest.o $(APP_CFLAGS) -c $(SRC_D)/crypto/cast/casttest.c + +$(OBJ_D)/bntest.o: $(SRC_D)/crypto/bn/bntest.c + $(CC) -o $(OBJ_D)/bntest.o $(APP_CFLAGS) -c $(SRC_D)/crypto/bn/bntest.c + +$(OBJ_D)/exptest.o: $(SRC_D)/crypto/bn/exptest.c + $(CC) -o $(OBJ_D)/exptest.o $(APP_CFLAGS) -c $(SRC_D)/crypto/bn/exptest.c + +$(OBJ_D)/dsatest.o: $(SRC_D)/crypto/dsa/dsatest.c + $(CC) -o $(OBJ_D)/dsatest.o $(APP_CFLAGS) -c $(SRC_D)/crypto/dsa/dsatest.c + +$(OBJ_D)/dhtest.o: $(SRC_D)/crypto/dh/dhtest.c + $(CC) -o $(OBJ_D)/dhtest.o $(APP_CFLAGS) -c $(SRC_D)/crypto/dh/dhtest.c + +$(OBJ_D)/randtest.o: $(SRC_D)/crypto/rand/randtest.c + $(CC) -o $(OBJ_D)/randtest.o $(APP_CFLAGS) -c $(SRC_D)/crypto/rand/randtest.c + +$(OBJ_D)/ssltest.o: $(SRC_D)/ssl/ssltest.c + $(CC) -o $(OBJ_D)/ssltest.o $(APP_CFLAGS) -c $(SRC_D)/ssl/ssltest.c + +$(OBJ_D)/verify.o: $(SRC_D)/apps/verify.c + $(CC) -o $(OBJ_D)/verify.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/verify.c + +$(OBJ_D)/asn1pars.o: $(SRC_D)/apps/asn1pars.c + $(CC) -o $(OBJ_D)/asn1pars.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/asn1pars.c + +$(OBJ_D)/req.o: $(SRC_D)/apps/req.c + $(CC) -o $(OBJ_D)/req.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/req.c + +$(OBJ_D)/dgst.o: $(SRC_D)/apps/dgst.c + $(CC) -o $(OBJ_D)/dgst.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/dgst.c + +$(OBJ_D)/dh.o: $(SRC_D)/apps/dh.c + $(CC) -o $(OBJ_D)/dh.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/dh.c + +$(OBJ_D)/enc.o: $(SRC_D)/apps/enc.c + $(CC) -o $(OBJ_D)/enc.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/enc.c + +$(OBJ_D)/gendh.o: $(SRC_D)/apps/gendh.c + $(CC) -o $(OBJ_D)/gendh.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/gendh.c + +$(OBJ_D)/errstr.o: $(SRC_D)/apps/errstr.c + $(CC) -o $(OBJ_D)/errstr.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/errstr.c + +$(OBJ_D)/ca.o: $(SRC_D)/apps/ca.c + $(CC) -o $(OBJ_D)/ca.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/ca.c + +$(OBJ_D)/pkcs7.o: $(SRC_D)/apps/pkcs7.c + $(CC) -o $(OBJ_D)/pkcs7.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/pkcs7.c + +$(OBJ_D)/crl2p7.o: $(SRC_D)/apps/crl2p7.c + $(CC) -o $(OBJ_D)/crl2p7.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/crl2p7.c + +$(OBJ_D)/crl.o: $(SRC_D)/apps/crl.c + $(CC) -o $(OBJ_D)/crl.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/crl.c + +$(OBJ_D)/rsa.o: $(SRC_D)/apps/rsa.c + $(CC) -o $(OBJ_D)/rsa.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/rsa.c + +$(OBJ_D)/dsa.o: $(SRC_D)/apps/dsa.c + $(CC) -o $(OBJ_D)/dsa.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/dsa.c + +$(OBJ_D)/dsaparam.o: $(SRC_D)/apps/dsaparam.c + $(CC) -o $(OBJ_D)/dsaparam.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/dsaparam.c + +$(OBJ_D)/x509.o: $(SRC_D)/apps/x509.c + $(CC) -o $(OBJ_D)/x509.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/x509.c + +$(OBJ_D)/genrsa.o: $(SRC_D)/apps/genrsa.c + $(CC) -o $(OBJ_D)/genrsa.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/genrsa.c + +$(OBJ_D)/s_server.o: $(SRC_D)/apps/s_server.c + $(CC) -o $(OBJ_D)/s_server.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/s_server.c + +$(OBJ_D)/s_client.o: $(SRC_D)/apps/s_client.c + $(CC) -o $(OBJ_D)/s_client.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/s_client.c + +$(OBJ_D)/speed.o: $(SRC_D)/apps/speed.c + $(CC) -o $(OBJ_D)/speed.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/speed.c + +$(OBJ_D)/s_time.o: $(SRC_D)/apps/s_time.c + $(CC) -o $(OBJ_D)/s_time.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/s_time.c + +$(OBJ_D)/apps.o: $(SRC_D)/apps/apps.c + $(CC) -o $(OBJ_D)/apps.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/apps.c + +$(OBJ_D)/s_cb.o: $(SRC_D)/apps/s_cb.c + $(CC) -o $(OBJ_D)/s_cb.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/s_cb.c + +$(OBJ_D)/s_socket.o: $(SRC_D)/apps/s_socket.c + $(CC) -o $(OBJ_D)/s_socket.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/s_socket.c + +$(OBJ_D)/version.o: $(SRC_D)/apps/version.c + $(CC) -o $(OBJ_D)/version.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/version.c + +$(OBJ_D)/sess_id.o: $(SRC_D)/apps/sess_id.c + $(CC) -o $(OBJ_D)/sess_id.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/sess_id.c + +$(OBJ_D)/ciphers.o: $(SRC_D)/apps/ciphers.c + $(CC) -o $(OBJ_D)/ciphers.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/ciphers.c + +$(OBJ_D)/ssleay.o: $(SRC_D)/apps/ssleay.c + $(CC) -o $(OBJ_D)/ssleay.o -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)/apps/ssleay.c + +$(OBJ_D)/cryptlib.o: $(SRC_D)/crypto/cryptlib.c + $(CC) -o $(OBJ_D)/cryptlib.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/cryptlib.c + +$(OBJ_D)/mem.o: $(SRC_D)/crypto/mem.c + $(CC) -o $(OBJ_D)/mem.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/mem.c + +$(OBJ_D)/cversion.o: $(SRC_D)/crypto/cversion.c + $(CC) -o $(OBJ_D)/cversion.o $(LIB_CFLAGS) -DCFLAGS="\"$(CC) $(CFLAG)\"" -c $(SRC_D)/crypto/cversion.c + +$(OBJ_D)/ex_data.o: $(SRC_D)/crypto/ex_data.c + $(CC) -o $(OBJ_D)/ex_data.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/ex_data.c + +$(OBJ_D)/cpt_err.o: $(SRC_D)/crypto/cpt_err.c + $(CC) -o $(OBJ_D)/cpt_err.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/cpt_err.c + +$(OBJ_D)/md2_dgst.o: $(SRC_D)/crypto/md2/md2_dgst.c + $(CC) -o $(OBJ_D)/md2_dgst.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/md2/md2_dgst.c + +$(OBJ_D)/md2_one.o: $(SRC_D)/crypto/md2/md2_one.c + $(CC) -o $(OBJ_D)/md2_one.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/md2/md2_one.c + +$(OBJ_D)/md5_dgst.o: $(SRC_D)/crypto/md5/md5_dgst.c + $(CC) -o $(OBJ_D)/md5_dgst.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/md5/md5_dgst.c + +$(OBJ_D)/md5_one.o: $(SRC_D)/crypto/md5/md5_one.c + $(CC) -o $(OBJ_D)/md5_one.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/md5/md5_one.c + +$(OBJ_D)/sha_dgst.o: $(SRC_D)/crypto/sha/sha_dgst.c + $(CC) -o $(OBJ_D)/sha_dgst.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/sha/sha_dgst.c + +$(OBJ_D)/sha1dgst.o: $(SRC_D)/crypto/sha/sha1dgst.c + $(CC) -o $(OBJ_D)/sha1dgst.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/sha/sha1dgst.c + +$(OBJ_D)/sha_one.o: $(SRC_D)/crypto/sha/sha_one.c + $(CC) -o $(OBJ_D)/sha_one.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/sha/sha_one.c + +$(OBJ_D)/sha1_one.o: $(SRC_D)/crypto/sha/sha1_one.c + $(CC) -o $(OBJ_D)/sha1_one.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/sha/sha1_one.c + +$(OBJ_D)/mdc2dgst.o: $(SRC_D)/crypto/mdc2/mdc2dgst.c + $(CC) -o $(OBJ_D)/mdc2dgst.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/mdc2/mdc2dgst.c + +$(OBJ_D)/mdc2_one.o: $(SRC_D)/crypto/mdc2/mdc2_one.c + $(CC) -o $(OBJ_D)/mdc2_one.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/mdc2/mdc2_one.c + +$(OBJ_D)/hmac.o: $(SRC_D)/crypto/hmac/hmac.c + $(CC) -o $(OBJ_D)/hmac.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/hmac/hmac.c + +$(OBJ_D)/rmd_dgst.o: $(SRC_D)/crypto/ripemd/rmd_dgst.c + $(CC) -o $(OBJ_D)/rmd_dgst.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/ripemd/rmd_dgst.c + +$(OBJ_D)/rmd_one.o: $(SRC_D)/crypto/ripemd/rmd_one.c + $(CC) -o $(OBJ_D)/rmd_one.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/ripemd/rmd_one.c + +$(OBJ_D)/set_key.o: $(SRC_D)/crypto/des/set_key.c + $(CC) -o $(OBJ_D)/set_key.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/set_key.c + +$(OBJ_D)/ecb_enc.o: $(SRC_D)/crypto/des/ecb_enc.c + $(CC) -o $(OBJ_D)/ecb_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/ecb_enc.c + +$(OBJ_D)/cbc_enc.o: $(SRC_D)/crypto/des/cbc_enc.c + $(CC) -o $(OBJ_D)/cbc_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/cbc_enc.c + +$(OBJ_D)/ecb3_enc.o: $(SRC_D)/crypto/des/ecb3_enc.c + $(CC) -o $(OBJ_D)/ecb3_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/ecb3_enc.c + +$(OBJ_D)/cfb64enc.o: $(SRC_D)/crypto/des/cfb64enc.c + $(CC) -o $(OBJ_D)/cfb64enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/cfb64enc.c + +$(OBJ_D)/cfb64ede.o: $(SRC_D)/crypto/des/cfb64ede.c + $(CC) -o $(OBJ_D)/cfb64ede.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/cfb64ede.c + +$(OBJ_D)/cfb_enc.o: $(SRC_D)/crypto/des/cfb_enc.c + $(CC) -o $(OBJ_D)/cfb_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/cfb_enc.c + +$(OBJ_D)/ofb64ede.o: $(SRC_D)/crypto/des/ofb64ede.c + $(CC) -o $(OBJ_D)/ofb64ede.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/ofb64ede.c + +$(OBJ_D)/enc_read.o: $(SRC_D)/crypto/des/enc_read.c + $(CC) -o $(OBJ_D)/enc_read.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/enc_read.c + +$(OBJ_D)/enc_writ.o: $(SRC_D)/crypto/des/enc_writ.c + $(CC) -o $(OBJ_D)/enc_writ.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/enc_writ.c + +$(OBJ_D)/ofb64enc.o: $(SRC_D)/crypto/des/ofb64enc.c + $(CC) -o $(OBJ_D)/ofb64enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/ofb64enc.c + +$(OBJ_D)/ofb_enc.o: $(SRC_D)/crypto/des/ofb_enc.c + $(CC) -o $(OBJ_D)/ofb_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/ofb_enc.c + +$(OBJ_D)/str2key.o: $(SRC_D)/crypto/des/str2key.c + $(CC) -o $(OBJ_D)/str2key.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/str2key.c + +$(OBJ_D)/pcbc_enc.o: $(SRC_D)/crypto/des/pcbc_enc.c + $(CC) -o $(OBJ_D)/pcbc_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/pcbc_enc.c + +$(OBJ_D)/qud_cksm.o: $(SRC_D)/crypto/des/qud_cksm.c + $(CC) -o $(OBJ_D)/qud_cksm.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/qud_cksm.c + +$(OBJ_D)/rand_key.o: $(SRC_D)/crypto/des/rand_key.c + $(CC) -o $(OBJ_D)/rand_key.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/rand_key.c + +$(OBJ_D)/des_enc.o: $(SRC_D)/crypto/des/des_enc.c + $(CC) -o $(OBJ_D)/des_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/des_enc.c + +$(OBJ_D)/fcrypt_b.o: $(SRC_D)/crypto/des/fcrypt_b.c + $(CC) -o $(OBJ_D)/fcrypt_b.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/fcrypt_b.c + +$(OBJ_D)/read2pwd.o: $(SRC_D)/crypto/des/read2pwd.c + $(CC) -o $(OBJ_D)/read2pwd.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/read2pwd.c + +$(OBJ_D)/fcrypt.o: $(SRC_D)/crypto/des/fcrypt.c + $(CC) -o $(OBJ_D)/fcrypt.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/fcrypt.c + +$(OBJ_D)/xcbc_enc.o: $(SRC_D)/crypto/des/xcbc_enc.c + $(CC) -o $(OBJ_D)/xcbc_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/xcbc_enc.c + +$(OBJ_D)/read_pwd.o: $(SRC_D)/crypto/des/read_pwd.c + $(CC) -o $(OBJ_D)/read_pwd.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/read_pwd.c + +$(OBJ_D)/rpc_enc.o: $(SRC_D)/crypto/des/rpc_enc.c + $(CC) -o $(OBJ_D)/rpc_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/rpc_enc.c + +$(OBJ_D)/cbc_cksm.o: $(SRC_D)/crypto/des/cbc_cksm.c + $(CC) -o $(OBJ_D)/cbc_cksm.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/cbc_cksm.c + +$(OBJ_D)/supp.o: $(SRC_D)/crypto/des/supp.c + $(CC) -o $(OBJ_D)/supp.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/des/supp.c + +$(OBJ_D)/rc2_ecb.o: $(SRC_D)/crypto/rc2/rc2_ecb.c + $(CC) -o $(OBJ_D)/rc2_ecb.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rc2/rc2_ecb.c + +$(OBJ_D)/rc2_skey.o: $(SRC_D)/crypto/rc2/rc2_skey.c + $(CC) -o $(OBJ_D)/rc2_skey.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rc2/rc2_skey.c + +$(OBJ_D)/rc2_cbc.o: $(SRC_D)/crypto/rc2/rc2_cbc.c + $(CC) -o $(OBJ_D)/rc2_cbc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rc2/rc2_cbc.c + +$(OBJ_D)/rc2cfb64.o: $(SRC_D)/crypto/rc2/rc2cfb64.c + $(CC) -o $(OBJ_D)/rc2cfb64.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rc2/rc2cfb64.c + +$(OBJ_D)/rc2ofb64.o: $(SRC_D)/crypto/rc2/rc2ofb64.c + $(CC) -o $(OBJ_D)/rc2ofb64.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rc2/rc2ofb64.c + +$(OBJ_D)/rc4_skey.o: $(SRC_D)/crypto/rc4/rc4_skey.c + $(CC) -o $(OBJ_D)/rc4_skey.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rc4/rc4_skey.c + +$(OBJ_D)/rc4_enc.o: $(SRC_D)/crypto/rc4/rc4_enc.c + $(CC) -o $(OBJ_D)/rc4_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rc4/rc4_enc.c + +$(OBJ_D)/rc5_skey.o: $(SRC_D)/crypto/rc5/rc5_skey.c + $(CC) -o $(OBJ_D)/rc5_skey.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rc5/rc5_skey.c + +$(OBJ_D)/rc5_ecb.o: $(SRC_D)/crypto/rc5/rc5_ecb.c + $(CC) -o $(OBJ_D)/rc5_ecb.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rc5/rc5_ecb.c + +$(OBJ_D)/rc5_enc.o: $(SRC_D)/crypto/rc5/rc5_enc.c + $(CC) -o $(OBJ_D)/rc5_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rc5/rc5_enc.c + +$(OBJ_D)/rc5cfb64.o: $(SRC_D)/crypto/rc5/rc5cfb64.c + $(CC) -o $(OBJ_D)/rc5cfb64.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rc5/rc5cfb64.c + +$(OBJ_D)/rc5ofb64.o: $(SRC_D)/crypto/rc5/rc5ofb64.c + $(CC) -o $(OBJ_D)/rc5ofb64.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rc5/rc5ofb64.c + +$(OBJ_D)/i_cbc.o: $(SRC_D)/crypto/idea/i_cbc.c + $(CC) -o $(OBJ_D)/i_cbc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/idea/i_cbc.c + +$(OBJ_D)/i_cfb64.o: $(SRC_D)/crypto/idea/i_cfb64.c + $(CC) -o $(OBJ_D)/i_cfb64.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/idea/i_cfb64.c + +$(OBJ_D)/i_ofb64.o: $(SRC_D)/crypto/idea/i_ofb64.c + $(CC) -o $(OBJ_D)/i_ofb64.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/idea/i_ofb64.c + +$(OBJ_D)/i_ecb.o: $(SRC_D)/crypto/idea/i_ecb.c + $(CC) -o $(OBJ_D)/i_ecb.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/idea/i_ecb.c + +$(OBJ_D)/i_skey.o: $(SRC_D)/crypto/idea/i_skey.c + $(CC) -o $(OBJ_D)/i_skey.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/idea/i_skey.c + +$(OBJ_D)/bf_skey.o: $(SRC_D)/crypto/bf/bf_skey.c + $(CC) -o $(OBJ_D)/bf_skey.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bf/bf_skey.c + +$(OBJ_D)/bf_ecb.o: $(SRC_D)/crypto/bf/bf_ecb.c + $(CC) -o $(OBJ_D)/bf_ecb.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bf/bf_ecb.c + +$(OBJ_D)/bf_enc.o: $(SRC_D)/crypto/bf/bf_enc.c + $(CC) -o $(OBJ_D)/bf_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bf/bf_enc.c + +$(OBJ_D)/bf_cfb64.o: $(SRC_D)/crypto/bf/bf_cfb64.c + $(CC) -o $(OBJ_D)/bf_cfb64.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bf/bf_cfb64.c + +$(OBJ_D)/bf_ofb64.o: $(SRC_D)/crypto/bf/bf_ofb64.c + $(CC) -o $(OBJ_D)/bf_ofb64.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bf/bf_ofb64.c + +$(OBJ_D)/c_skey.o: $(SRC_D)/crypto/cast/c_skey.c + $(CC) -o $(OBJ_D)/c_skey.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/cast/c_skey.c + +$(OBJ_D)/c_ecb.o: $(SRC_D)/crypto/cast/c_ecb.c + $(CC) -o $(OBJ_D)/c_ecb.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/cast/c_ecb.c + +$(OBJ_D)/c_enc.o: $(SRC_D)/crypto/cast/c_enc.c + $(CC) -o $(OBJ_D)/c_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/cast/c_enc.c + +$(OBJ_D)/c_cfb64.o: $(SRC_D)/crypto/cast/c_cfb64.c + $(CC) -o $(OBJ_D)/c_cfb64.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/cast/c_cfb64.c + +$(OBJ_D)/c_ofb64.o: $(SRC_D)/crypto/cast/c_ofb64.c + $(CC) -o $(OBJ_D)/c_ofb64.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/cast/c_ofb64.c + +$(OBJ_D)/bn_add.o: $(SRC_D)/crypto/bn/bn_add.c + $(CC) -o $(OBJ_D)/bn_add.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_add.c + +$(OBJ_D)/bn_div.o: $(SRC_D)/crypto/bn/bn_div.c + $(CC) -o $(OBJ_D)/bn_div.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_div.c + +$(OBJ_D)/bn_exp.o: $(SRC_D)/crypto/bn/bn_exp.c + $(CC) -o $(OBJ_D)/bn_exp.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_exp.c + +$(OBJ_D)/bn_lib.o: $(SRC_D)/crypto/bn/bn_lib.c + $(CC) -o $(OBJ_D)/bn_lib.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_lib.c + +$(OBJ_D)/bn_mod.o: $(SRC_D)/crypto/bn/bn_mod.c + $(CC) -o $(OBJ_D)/bn_mod.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_mod.c + +$(OBJ_D)/bn_mul.o: $(SRC_D)/crypto/bn/bn_mul.c + $(CC) -o $(OBJ_D)/bn_mul.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_mul.c + +$(OBJ_D)/bn_print.o: $(SRC_D)/crypto/bn/bn_print.c + $(CC) -o $(OBJ_D)/bn_print.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_print.c + +$(OBJ_D)/bn_rand.o: $(SRC_D)/crypto/bn/bn_rand.c + $(CC) -o $(OBJ_D)/bn_rand.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_rand.c + +$(OBJ_D)/bn_shift.o: $(SRC_D)/crypto/bn/bn_shift.c + $(CC) -o $(OBJ_D)/bn_shift.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_shift.c + +$(OBJ_D)/bn_sub.o: $(SRC_D)/crypto/bn/bn_sub.c + $(CC) -o $(OBJ_D)/bn_sub.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_sub.c + +$(OBJ_D)/bn_word.o: $(SRC_D)/crypto/bn/bn_word.c + $(CC) -o $(OBJ_D)/bn_word.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_word.c + +$(OBJ_D)/bn_blind.o: $(SRC_D)/crypto/bn/bn_blind.c + $(CC) -o $(OBJ_D)/bn_blind.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_blind.c + +$(OBJ_D)/bn_gcd.o: $(SRC_D)/crypto/bn/bn_gcd.c + $(CC) -o $(OBJ_D)/bn_gcd.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_gcd.c + +$(OBJ_D)/bn_prime.o: $(SRC_D)/crypto/bn/bn_prime.c + $(CC) -o $(OBJ_D)/bn_prime.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_prime.c + +$(OBJ_D)/bn_err.o: $(SRC_D)/crypto/bn/bn_err.c + $(CC) -o $(OBJ_D)/bn_err.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_err.c + +$(OBJ_D)/bn_sqr.o: $(SRC_D)/crypto/bn/bn_sqr.c + $(CC) -o $(OBJ_D)/bn_sqr.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_sqr.c + +$(OBJ_D)/bn_mulw.o: $(SRC_D)/crypto/bn/bn_mulw.c + $(CC) -o $(OBJ_D)/bn_mulw.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_mulw.c + +$(OBJ_D)/bn_recp.o: $(SRC_D)/crypto/bn/bn_recp.c + $(CC) -o $(OBJ_D)/bn_recp.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_recp.c + +$(OBJ_D)/bn_mont.o: $(SRC_D)/crypto/bn/bn_mont.c + $(CC) -o $(OBJ_D)/bn_mont.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_mont.c + +$(OBJ_D)/bn_mpi.o: $(SRC_D)/crypto/bn/bn_mpi.c + $(CC) -o $(OBJ_D)/bn_mpi.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bn/bn_mpi.c + +$(OBJ_D)/rsa_eay.o: $(SRC_D)/crypto/rsa/rsa_eay.c + $(CC) -o $(OBJ_D)/rsa_eay.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rsa/rsa_eay.c + +$(OBJ_D)/rsa_gen.o: $(SRC_D)/crypto/rsa/rsa_gen.c + $(CC) -o $(OBJ_D)/rsa_gen.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rsa/rsa_gen.c + +$(OBJ_D)/rsa_lib.o: $(SRC_D)/crypto/rsa/rsa_lib.c + $(CC) -o $(OBJ_D)/rsa_lib.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rsa/rsa_lib.c + +$(OBJ_D)/rsa_sign.o: $(SRC_D)/crypto/rsa/rsa_sign.c + $(CC) -o $(OBJ_D)/rsa_sign.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rsa/rsa_sign.c + +$(OBJ_D)/rsa_saos.o: $(SRC_D)/crypto/rsa/rsa_saos.c + $(CC) -o $(OBJ_D)/rsa_saos.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rsa/rsa_saos.c + +$(OBJ_D)/rsa_err.o: $(SRC_D)/crypto/rsa/rsa_err.c + $(CC) -o $(OBJ_D)/rsa_err.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rsa/rsa_err.c + +$(OBJ_D)/rsa_pk1.o: $(SRC_D)/crypto/rsa/rsa_pk1.c + $(CC) -o $(OBJ_D)/rsa_pk1.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rsa/rsa_pk1.c + +$(OBJ_D)/rsa_ssl.o: $(SRC_D)/crypto/rsa/rsa_ssl.c + $(CC) -o $(OBJ_D)/rsa_ssl.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rsa/rsa_ssl.c + +$(OBJ_D)/rsa_none.o: $(SRC_D)/crypto/rsa/rsa_none.c + $(CC) -o $(OBJ_D)/rsa_none.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rsa/rsa_none.c + +$(OBJ_D)/dsa_gen.o: $(SRC_D)/crypto/dsa/dsa_gen.c + $(CC) -o $(OBJ_D)/dsa_gen.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/dsa/dsa_gen.c + +$(OBJ_D)/dsa_key.o: $(SRC_D)/crypto/dsa/dsa_key.c + $(CC) -o $(OBJ_D)/dsa_key.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/dsa/dsa_key.c + +$(OBJ_D)/dsa_lib.o: $(SRC_D)/crypto/dsa/dsa_lib.c + $(CC) -o $(OBJ_D)/dsa_lib.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/dsa/dsa_lib.c + +$(OBJ_D)/dsa_vrf.o: $(SRC_D)/crypto/dsa/dsa_vrf.c + $(CC) -o $(OBJ_D)/dsa_vrf.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/dsa/dsa_vrf.c + +$(OBJ_D)/dsa_sign.o: $(SRC_D)/crypto/dsa/dsa_sign.c + $(CC) -o $(OBJ_D)/dsa_sign.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/dsa/dsa_sign.c + +$(OBJ_D)/dsa_err.o: $(SRC_D)/crypto/dsa/dsa_err.c + $(CC) -o $(OBJ_D)/dsa_err.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/dsa/dsa_err.c + +$(OBJ_D)/dh_gen.o: $(SRC_D)/crypto/dh/dh_gen.c + $(CC) -o $(OBJ_D)/dh_gen.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/dh/dh_gen.c + +$(OBJ_D)/dh_key.o: $(SRC_D)/crypto/dh/dh_key.c + $(CC) -o $(OBJ_D)/dh_key.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/dh/dh_key.c + +$(OBJ_D)/dh_lib.o: $(SRC_D)/crypto/dh/dh_lib.c + $(CC) -o $(OBJ_D)/dh_lib.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/dh/dh_lib.c + +$(OBJ_D)/dh_check.o: $(SRC_D)/crypto/dh/dh_check.c + $(CC) -o $(OBJ_D)/dh_check.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/dh/dh_check.c + +$(OBJ_D)/dh_err.o: $(SRC_D)/crypto/dh/dh_err.c + $(CC) -o $(OBJ_D)/dh_err.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/dh/dh_err.c + +$(OBJ_D)/buffer.o: $(SRC_D)/crypto/buffer/buffer.c + $(CC) -o $(OBJ_D)/buffer.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/buffer/buffer.c + +$(OBJ_D)/buf_err.o: $(SRC_D)/crypto/buffer/buf_err.c + $(CC) -o $(OBJ_D)/buf_err.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/buffer/buf_err.c + +$(OBJ_D)/bio_lib.o: $(SRC_D)/crypto/bio/bio_lib.c + $(CC) -o $(OBJ_D)/bio_lib.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bio/bio_lib.c + +$(OBJ_D)/bio_cb.o: $(SRC_D)/crypto/bio/bio_cb.c + $(CC) -o $(OBJ_D)/bio_cb.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bio/bio_cb.c + +$(OBJ_D)/bio_err.o: $(SRC_D)/crypto/bio/bio_err.c + $(CC) -o $(OBJ_D)/bio_err.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bio/bio_err.c + +$(OBJ_D)/bss_mem.o: $(SRC_D)/crypto/bio/bss_mem.c + $(CC) -o $(OBJ_D)/bss_mem.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bio/bss_mem.c + +$(OBJ_D)/bss_null.o: $(SRC_D)/crypto/bio/bss_null.c + $(CC) -o $(OBJ_D)/bss_null.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bio/bss_null.c + +$(OBJ_D)/bss_fd.o: $(SRC_D)/crypto/bio/bss_fd.c + $(CC) -o $(OBJ_D)/bss_fd.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bio/bss_fd.c + +$(OBJ_D)/bss_file.o: $(SRC_D)/crypto/bio/bss_file.c + $(CC) -o $(OBJ_D)/bss_file.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bio/bss_file.c + +$(OBJ_D)/bss_sock.o: $(SRC_D)/crypto/bio/bss_sock.c + $(CC) -o $(OBJ_D)/bss_sock.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bio/bss_sock.c + +$(OBJ_D)/bss_conn.o: $(SRC_D)/crypto/bio/bss_conn.c + $(CC) -o $(OBJ_D)/bss_conn.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bio/bss_conn.c + +$(OBJ_D)/bf_null.o: $(SRC_D)/crypto/bio/bf_null.c + $(CC) -o $(OBJ_D)/bf_null.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bio/bf_null.c + +$(OBJ_D)/bf_buff.o: $(SRC_D)/crypto/bio/bf_buff.c + $(CC) -o $(OBJ_D)/bf_buff.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bio/bf_buff.c + +$(OBJ_D)/b_print.o: $(SRC_D)/crypto/bio/b_print.c + $(CC) -o $(OBJ_D)/b_print.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bio/b_print.c + +$(OBJ_D)/b_dump.o: $(SRC_D)/crypto/bio/b_dump.c + $(CC) -o $(OBJ_D)/b_dump.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bio/b_dump.c + +$(OBJ_D)/b_sock.o: $(SRC_D)/crypto/bio/b_sock.c + $(CC) -o $(OBJ_D)/b_sock.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bio/b_sock.c + +$(OBJ_D)/bss_acpt.o: $(SRC_D)/crypto/bio/bss_acpt.c + $(CC) -o $(OBJ_D)/bss_acpt.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bio/bss_acpt.c + +$(OBJ_D)/bf_nbio.o: $(SRC_D)/crypto/bio/bf_nbio.c + $(CC) -o $(OBJ_D)/bf_nbio.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/bio/bf_nbio.c + +$(OBJ_D)/stack.o: $(SRC_D)/crypto/stack/stack.c + $(CC) -o $(OBJ_D)/stack.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/stack/stack.c + +$(OBJ_D)/lhash.o: $(SRC_D)/crypto/lhash/lhash.c + $(CC) -o $(OBJ_D)/lhash.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/lhash/lhash.c + +$(OBJ_D)/lh_stats.o: $(SRC_D)/crypto/lhash/lh_stats.c + $(CC) -o $(OBJ_D)/lh_stats.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/lhash/lh_stats.c + +$(OBJ_D)/md_rand.o: $(SRC_D)/crypto/rand/md_rand.c + $(CC) -o $(OBJ_D)/md_rand.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rand/md_rand.c + +$(OBJ_D)/randfile.o: $(SRC_D)/crypto/rand/randfile.c + $(CC) -o $(OBJ_D)/randfile.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/rand/randfile.c + +$(OBJ_D)/err.o: $(SRC_D)/crypto/err/err.c + $(CC) -o $(OBJ_D)/err.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/err/err.c + +$(OBJ_D)/err_all.o: $(SRC_D)/crypto/err/err_all.c + $(CC) -o $(OBJ_D)/err_all.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/err/err_all.c + +$(OBJ_D)/err_prn.o: $(SRC_D)/crypto/err/err_prn.c + $(CC) -o $(OBJ_D)/err_prn.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/err/err_prn.c + +$(OBJ_D)/obj_dat.o: $(SRC_D)/crypto/objects/obj_dat.c + $(CC) -o $(OBJ_D)/obj_dat.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/objects/obj_dat.c + +$(OBJ_D)/obj_lib.o: $(SRC_D)/crypto/objects/obj_lib.c + $(CC) -o $(OBJ_D)/obj_lib.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/objects/obj_lib.c + +$(OBJ_D)/obj_err.o: $(SRC_D)/crypto/objects/obj_err.c + $(CC) -o $(OBJ_D)/obj_err.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/objects/obj_err.c + +$(OBJ_D)/encode.o: $(SRC_D)/crypto/evp/encode.c + $(CC) -o $(OBJ_D)/encode.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/encode.c + +$(OBJ_D)/digest.o: $(SRC_D)/crypto/evp/digest.c + $(CC) -o $(OBJ_D)/digest.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/digest.c + +$(OBJ_D)/evp_enc.o: $(SRC_D)/crypto/evp/evp_enc.c + $(CC) -o $(OBJ_D)/evp_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/evp_enc.c + +$(OBJ_D)/evp_key.o: $(SRC_D)/crypto/evp/evp_key.c + $(CC) -o $(OBJ_D)/evp_key.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/evp_key.c + +$(OBJ_D)/e_ecb_d.o: $(SRC_D)/crypto/evp/e_ecb_d.c + $(CC) -o $(OBJ_D)/e_ecb_d.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_ecb_d.c + +$(OBJ_D)/e_cbc_d.o: $(SRC_D)/crypto/evp/e_cbc_d.c + $(CC) -o $(OBJ_D)/e_cbc_d.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_cbc_d.c + +$(OBJ_D)/e_cfb_d.o: $(SRC_D)/crypto/evp/e_cfb_d.c + $(CC) -o $(OBJ_D)/e_cfb_d.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_cfb_d.c + +$(OBJ_D)/e_ofb_d.o: $(SRC_D)/crypto/evp/e_ofb_d.c + $(CC) -o $(OBJ_D)/e_ofb_d.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_ofb_d.c + +$(OBJ_D)/e_ecb_i.o: $(SRC_D)/crypto/evp/e_ecb_i.c + $(CC) -o $(OBJ_D)/e_ecb_i.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_ecb_i.c + +$(OBJ_D)/e_cbc_i.o: $(SRC_D)/crypto/evp/e_cbc_i.c + $(CC) -o $(OBJ_D)/e_cbc_i.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_cbc_i.c + +$(OBJ_D)/e_cfb_i.o: $(SRC_D)/crypto/evp/e_cfb_i.c + $(CC) -o $(OBJ_D)/e_cfb_i.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_cfb_i.c + +$(OBJ_D)/e_ofb_i.o: $(SRC_D)/crypto/evp/e_ofb_i.c + $(CC) -o $(OBJ_D)/e_ofb_i.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_ofb_i.c + +$(OBJ_D)/e_ecb_3d.o: $(SRC_D)/crypto/evp/e_ecb_3d.c + $(CC) -o $(OBJ_D)/e_ecb_3d.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_ecb_3d.c + +$(OBJ_D)/e_cbc_3d.o: $(SRC_D)/crypto/evp/e_cbc_3d.c + $(CC) -o $(OBJ_D)/e_cbc_3d.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_cbc_3d.c + +$(OBJ_D)/e_rc4.o: $(SRC_D)/crypto/evp/e_rc4.c + $(CC) -o $(OBJ_D)/e_rc4.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_rc4.c + +$(OBJ_D)/names.o: $(SRC_D)/crypto/evp/names.c + $(CC) -o $(OBJ_D)/names.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/names.c + +$(OBJ_D)/e_cfb_3d.o: $(SRC_D)/crypto/evp/e_cfb_3d.c + $(CC) -o $(OBJ_D)/e_cfb_3d.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_cfb_3d.c + +$(OBJ_D)/e_ofb_3d.o: $(SRC_D)/crypto/evp/e_ofb_3d.c + $(CC) -o $(OBJ_D)/e_ofb_3d.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_ofb_3d.c + +$(OBJ_D)/e_xcbc_d.o: $(SRC_D)/crypto/evp/e_xcbc_d.c + $(CC) -o $(OBJ_D)/e_xcbc_d.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_xcbc_d.c + +$(OBJ_D)/e_ecb_r2.o: $(SRC_D)/crypto/evp/e_ecb_r2.c + $(CC) -o $(OBJ_D)/e_ecb_r2.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_ecb_r2.c + +$(OBJ_D)/e_cbc_r2.o: $(SRC_D)/crypto/evp/e_cbc_r2.c + $(CC) -o $(OBJ_D)/e_cbc_r2.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_cbc_r2.c + +$(OBJ_D)/e_cfb_r2.o: $(SRC_D)/crypto/evp/e_cfb_r2.c + $(CC) -o $(OBJ_D)/e_cfb_r2.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_cfb_r2.c + +$(OBJ_D)/e_ofb_r2.o: $(SRC_D)/crypto/evp/e_ofb_r2.c + $(CC) -o $(OBJ_D)/e_ofb_r2.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_ofb_r2.c + +$(OBJ_D)/e_ecb_bf.o: $(SRC_D)/crypto/evp/e_ecb_bf.c + $(CC) -o $(OBJ_D)/e_ecb_bf.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_ecb_bf.c + +$(OBJ_D)/e_cbc_bf.o: $(SRC_D)/crypto/evp/e_cbc_bf.c + $(CC) -o $(OBJ_D)/e_cbc_bf.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_cbc_bf.c + +$(OBJ_D)/e_cfb_bf.o: $(SRC_D)/crypto/evp/e_cfb_bf.c + $(CC) -o $(OBJ_D)/e_cfb_bf.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_cfb_bf.c + +$(OBJ_D)/e_ofb_bf.o: $(SRC_D)/crypto/evp/e_ofb_bf.c + $(CC) -o $(OBJ_D)/e_ofb_bf.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_ofb_bf.c + +$(OBJ_D)/e_ecb_c.o: $(SRC_D)/crypto/evp/e_ecb_c.c + $(CC) -o $(OBJ_D)/e_ecb_c.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_ecb_c.c + +$(OBJ_D)/e_cbc_c.o: $(SRC_D)/crypto/evp/e_cbc_c.c + $(CC) -o $(OBJ_D)/e_cbc_c.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_cbc_c.c + +$(OBJ_D)/e_cfb_c.o: $(SRC_D)/crypto/evp/e_cfb_c.c + $(CC) -o $(OBJ_D)/e_cfb_c.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_cfb_c.c + +$(OBJ_D)/e_ofb_c.o: $(SRC_D)/crypto/evp/e_ofb_c.c + $(CC) -o $(OBJ_D)/e_ofb_c.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_ofb_c.c + +$(OBJ_D)/e_ecb_r5.o: $(SRC_D)/crypto/evp/e_ecb_r5.c + $(CC) -o $(OBJ_D)/e_ecb_r5.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_ecb_r5.c + +$(OBJ_D)/e_cbc_r5.o: $(SRC_D)/crypto/evp/e_cbc_r5.c + $(CC) -o $(OBJ_D)/e_cbc_r5.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_cbc_r5.c + +$(OBJ_D)/e_cfb_r5.o: $(SRC_D)/crypto/evp/e_cfb_r5.c + $(CC) -o $(OBJ_D)/e_cfb_r5.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_cfb_r5.c + +$(OBJ_D)/e_ofb_r5.o: $(SRC_D)/crypto/evp/e_ofb_r5.c + $(CC) -o $(OBJ_D)/e_ofb_r5.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_ofb_r5.c + +$(OBJ_D)/m_null.o: $(SRC_D)/crypto/evp/m_null.c + $(CC) -o $(OBJ_D)/m_null.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/m_null.c + +$(OBJ_D)/m_md2.o: $(SRC_D)/crypto/evp/m_md2.c + $(CC) -o $(OBJ_D)/m_md2.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/m_md2.c + +$(OBJ_D)/m_md5.o: $(SRC_D)/crypto/evp/m_md5.c + $(CC) -o $(OBJ_D)/m_md5.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/m_md5.c + +$(OBJ_D)/m_sha.o: $(SRC_D)/crypto/evp/m_sha.c + $(CC) -o $(OBJ_D)/m_sha.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/m_sha.c + +$(OBJ_D)/m_sha1.o: $(SRC_D)/crypto/evp/m_sha1.c + $(CC) -o $(OBJ_D)/m_sha1.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/m_sha1.c + +$(OBJ_D)/m_dss.o: $(SRC_D)/crypto/evp/m_dss.c + $(CC) -o $(OBJ_D)/m_dss.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/m_dss.c + +$(OBJ_D)/m_dss1.o: $(SRC_D)/crypto/evp/m_dss1.c + $(CC) -o $(OBJ_D)/m_dss1.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/m_dss1.c + +$(OBJ_D)/m_mdc2.o: $(SRC_D)/crypto/evp/m_mdc2.c + $(CC) -o $(OBJ_D)/m_mdc2.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/m_mdc2.c + +$(OBJ_D)/m_ripemd.o: $(SRC_D)/crypto/evp/m_ripemd.c + $(CC) -o $(OBJ_D)/m_ripemd.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/m_ripemd.c + +$(OBJ_D)/p_open.o: $(SRC_D)/crypto/evp/p_open.c + $(CC) -o $(OBJ_D)/p_open.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/p_open.c + +$(OBJ_D)/p_seal.o: $(SRC_D)/crypto/evp/p_seal.c + $(CC) -o $(OBJ_D)/p_seal.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/p_seal.c + +$(OBJ_D)/p_sign.o: $(SRC_D)/crypto/evp/p_sign.c + $(CC) -o $(OBJ_D)/p_sign.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/p_sign.c + +$(OBJ_D)/p_verify.o: $(SRC_D)/crypto/evp/p_verify.c + $(CC) -o $(OBJ_D)/p_verify.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/p_verify.c + +$(OBJ_D)/p_lib.o: $(SRC_D)/crypto/evp/p_lib.c + $(CC) -o $(OBJ_D)/p_lib.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/p_lib.c + +$(OBJ_D)/p_enc.o: $(SRC_D)/crypto/evp/p_enc.c + $(CC) -o $(OBJ_D)/p_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/p_enc.c + +$(OBJ_D)/p_dec.o: $(SRC_D)/crypto/evp/p_dec.c + $(CC) -o $(OBJ_D)/p_dec.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/p_dec.c + +$(OBJ_D)/bio_md.o: $(SRC_D)/crypto/evp/bio_md.c + $(CC) -o $(OBJ_D)/bio_md.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/bio_md.c + +$(OBJ_D)/bio_b64.o: $(SRC_D)/crypto/evp/bio_b64.c + $(CC) -o $(OBJ_D)/bio_b64.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/bio_b64.c + +$(OBJ_D)/bio_enc.o: $(SRC_D)/crypto/evp/bio_enc.c + $(CC) -o $(OBJ_D)/bio_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/bio_enc.c + +$(OBJ_D)/evp_err.o: $(SRC_D)/crypto/evp/evp_err.c + $(CC) -o $(OBJ_D)/evp_err.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/evp_err.c + +$(OBJ_D)/e_null.o: $(SRC_D)/crypto/evp/e_null.c + $(CC) -o $(OBJ_D)/e_null.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/e_null.c + +$(OBJ_D)/c_all.o: $(SRC_D)/crypto/evp/c_all.c + $(CC) -o $(OBJ_D)/c_all.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/c_all.c + +$(OBJ_D)/evp_lib.o: $(SRC_D)/crypto/evp/evp_lib.c + $(CC) -o $(OBJ_D)/evp_lib.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/evp/evp_lib.c + +$(OBJ_D)/pem_sign.o: $(SRC_D)/crypto/pem/pem_sign.c + $(CC) -o $(OBJ_D)/pem_sign.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/pem/pem_sign.c + +$(OBJ_D)/pem_seal.o: $(SRC_D)/crypto/pem/pem_seal.c + $(CC) -o $(OBJ_D)/pem_seal.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/pem/pem_seal.c + +$(OBJ_D)/pem_info.o: $(SRC_D)/crypto/pem/pem_info.c + $(CC) -o $(OBJ_D)/pem_info.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/pem/pem_info.c + +$(OBJ_D)/pem_lib.o: $(SRC_D)/crypto/pem/pem_lib.c + $(CC) -o $(OBJ_D)/pem_lib.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/pem/pem_lib.c + +$(OBJ_D)/pem_all.o: $(SRC_D)/crypto/pem/pem_all.c + $(CC) -o $(OBJ_D)/pem_all.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/pem/pem_all.c + +$(OBJ_D)/pem_err.o: $(SRC_D)/crypto/pem/pem_err.c + $(CC) -o $(OBJ_D)/pem_err.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/pem/pem_err.c + +$(OBJ_D)/a_object.o: $(SRC_D)/crypto/asn1/a_object.c + $(CC) -o $(OBJ_D)/a_object.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_object.c + +$(OBJ_D)/a_bitstr.o: $(SRC_D)/crypto/asn1/a_bitstr.c + $(CC) -o $(OBJ_D)/a_bitstr.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_bitstr.c + +$(OBJ_D)/a_utctm.o: $(SRC_D)/crypto/asn1/a_utctm.c + $(CC) -o $(OBJ_D)/a_utctm.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_utctm.c + +$(OBJ_D)/a_int.o: $(SRC_D)/crypto/asn1/a_int.c + $(CC) -o $(OBJ_D)/a_int.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_int.c + +$(OBJ_D)/a_octet.o: $(SRC_D)/crypto/asn1/a_octet.c + $(CC) -o $(OBJ_D)/a_octet.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_octet.c + +$(OBJ_D)/a_print.o: $(SRC_D)/crypto/asn1/a_print.c + $(CC) -o $(OBJ_D)/a_print.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_print.c + +$(OBJ_D)/a_type.o: $(SRC_D)/crypto/asn1/a_type.c + $(CC) -o $(OBJ_D)/a_type.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_type.c + +$(OBJ_D)/a_set.o: $(SRC_D)/crypto/asn1/a_set.c + $(CC) -o $(OBJ_D)/a_set.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_set.c + +$(OBJ_D)/a_dup.o: $(SRC_D)/crypto/asn1/a_dup.c + $(CC) -o $(OBJ_D)/a_dup.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_dup.c + +$(OBJ_D)/a_d2i_fp.o: $(SRC_D)/crypto/asn1/a_d2i_fp.c + $(CC) -o $(OBJ_D)/a_d2i_fp.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_d2i_fp.c + +$(OBJ_D)/a_i2d_fp.o: $(SRC_D)/crypto/asn1/a_i2d_fp.c + $(CC) -o $(OBJ_D)/a_i2d_fp.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_i2d_fp.c + +$(OBJ_D)/a_sign.o: $(SRC_D)/crypto/asn1/a_sign.c + $(CC) -o $(OBJ_D)/a_sign.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_sign.c + +$(OBJ_D)/a_digest.o: $(SRC_D)/crypto/asn1/a_digest.c + $(CC) -o $(OBJ_D)/a_digest.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_digest.c + +$(OBJ_D)/a_verify.o: $(SRC_D)/crypto/asn1/a_verify.c + $(CC) -o $(OBJ_D)/a_verify.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_verify.c + +$(OBJ_D)/x_algor.o: $(SRC_D)/crypto/asn1/x_algor.c + $(CC) -o $(OBJ_D)/x_algor.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/x_algor.c + +$(OBJ_D)/x_val.o: $(SRC_D)/crypto/asn1/x_val.c + $(CC) -o $(OBJ_D)/x_val.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/x_val.c + +$(OBJ_D)/x_pubkey.o: $(SRC_D)/crypto/asn1/x_pubkey.c + $(CC) -o $(OBJ_D)/x_pubkey.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/x_pubkey.c + +$(OBJ_D)/x_sig.o: $(SRC_D)/crypto/asn1/x_sig.c + $(CC) -o $(OBJ_D)/x_sig.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/x_sig.c + +$(OBJ_D)/x_req.o: $(SRC_D)/crypto/asn1/x_req.c + $(CC) -o $(OBJ_D)/x_req.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/x_req.c + +$(OBJ_D)/x_attrib.o: $(SRC_D)/crypto/asn1/x_attrib.c + $(CC) -o $(OBJ_D)/x_attrib.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/x_attrib.c + +$(OBJ_D)/x_name.o: $(SRC_D)/crypto/asn1/x_name.c + $(CC) -o $(OBJ_D)/x_name.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/x_name.c + +$(OBJ_D)/x_cinf.o: $(SRC_D)/crypto/asn1/x_cinf.c + $(CC) -o $(OBJ_D)/x_cinf.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/x_cinf.c + +$(OBJ_D)/x_x509.o: $(SRC_D)/crypto/asn1/x_x509.c + $(CC) -o $(OBJ_D)/x_x509.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/x_x509.c + +$(OBJ_D)/x_crl.o: $(SRC_D)/crypto/asn1/x_crl.c + $(CC) -o $(OBJ_D)/x_crl.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/x_crl.c + +$(OBJ_D)/x_info.o: $(SRC_D)/crypto/asn1/x_info.c + $(CC) -o $(OBJ_D)/x_info.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/x_info.c + +$(OBJ_D)/x_spki.o: $(SRC_D)/crypto/asn1/x_spki.c + $(CC) -o $(OBJ_D)/x_spki.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/x_spki.c + +$(OBJ_D)/d2i_r_pr.o: $(SRC_D)/crypto/asn1/d2i_r_pr.c + $(CC) -o $(OBJ_D)/d2i_r_pr.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/d2i_r_pr.c + +$(OBJ_D)/i2d_r_pr.o: $(SRC_D)/crypto/asn1/i2d_r_pr.c + $(CC) -o $(OBJ_D)/i2d_r_pr.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/i2d_r_pr.c + +$(OBJ_D)/d2i_r_pu.o: $(SRC_D)/crypto/asn1/d2i_r_pu.c + $(CC) -o $(OBJ_D)/d2i_r_pu.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/d2i_r_pu.c + +$(OBJ_D)/i2d_r_pu.o: $(SRC_D)/crypto/asn1/i2d_r_pu.c + $(CC) -o $(OBJ_D)/i2d_r_pu.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/i2d_r_pu.c + +$(OBJ_D)/d2i_s_pr.o: $(SRC_D)/crypto/asn1/d2i_s_pr.c + $(CC) -o $(OBJ_D)/d2i_s_pr.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/d2i_s_pr.c + +$(OBJ_D)/i2d_s_pr.o: $(SRC_D)/crypto/asn1/i2d_s_pr.c + $(CC) -o $(OBJ_D)/i2d_s_pr.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/i2d_s_pr.c + +$(OBJ_D)/d2i_s_pu.o: $(SRC_D)/crypto/asn1/d2i_s_pu.c + $(CC) -o $(OBJ_D)/d2i_s_pu.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/d2i_s_pu.c + +$(OBJ_D)/i2d_s_pu.o: $(SRC_D)/crypto/asn1/i2d_s_pu.c + $(CC) -o $(OBJ_D)/i2d_s_pu.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/i2d_s_pu.c + +$(OBJ_D)/d2i_pu.o: $(SRC_D)/crypto/asn1/d2i_pu.c + $(CC) -o $(OBJ_D)/d2i_pu.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/d2i_pu.c + +$(OBJ_D)/d2i_pr.o: $(SRC_D)/crypto/asn1/d2i_pr.c + $(CC) -o $(OBJ_D)/d2i_pr.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/d2i_pr.c + +$(OBJ_D)/i2d_pu.o: $(SRC_D)/crypto/asn1/i2d_pu.c + $(CC) -o $(OBJ_D)/i2d_pu.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/i2d_pu.c + +$(OBJ_D)/i2d_pr.o: $(SRC_D)/crypto/asn1/i2d_pr.c + $(CC) -o $(OBJ_D)/i2d_pr.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/i2d_pr.c + +$(OBJ_D)/t_req.o: $(SRC_D)/crypto/asn1/t_req.c + $(CC) -o $(OBJ_D)/t_req.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/t_req.c + +$(OBJ_D)/t_x509.o: $(SRC_D)/crypto/asn1/t_x509.c + $(CC) -o $(OBJ_D)/t_x509.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/t_x509.c + +$(OBJ_D)/t_pkey.o: $(SRC_D)/crypto/asn1/t_pkey.c + $(CC) -o $(OBJ_D)/t_pkey.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/t_pkey.c + +$(OBJ_D)/p7_i_s.o: $(SRC_D)/crypto/asn1/p7_i_s.c + $(CC) -o $(OBJ_D)/p7_i_s.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/p7_i_s.c + +$(OBJ_D)/p7_signi.o: $(SRC_D)/crypto/asn1/p7_signi.c + $(CC) -o $(OBJ_D)/p7_signi.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/p7_signi.c + +$(OBJ_D)/p7_signd.o: $(SRC_D)/crypto/asn1/p7_signd.c + $(CC) -o $(OBJ_D)/p7_signd.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/p7_signd.c + +$(OBJ_D)/p7_recip.o: $(SRC_D)/crypto/asn1/p7_recip.c + $(CC) -o $(OBJ_D)/p7_recip.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/p7_recip.c + +$(OBJ_D)/p7_enc_c.o: $(SRC_D)/crypto/asn1/p7_enc_c.c + $(CC) -o $(OBJ_D)/p7_enc_c.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/p7_enc_c.c + +$(OBJ_D)/p7_evp.o: $(SRC_D)/crypto/asn1/p7_evp.c + $(CC) -o $(OBJ_D)/p7_evp.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/p7_evp.c + +$(OBJ_D)/p7_dgst.o: $(SRC_D)/crypto/asn1/p7_dgst.c + $(CC) -o $(OBJ_D)/p7_dgst.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/p7_dgst.c + +$(OBJ_D)/p7_s_e.o: $(SRC_D)/crypto/asn1/p7_s_e.c + $(CC) -o $(OBJ_D)/p7_s_e.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/p7_s_e.c + +$(OBJ_D)/p7_enc.o: $(SRC_D)/crypto/asn1/p7_enc.c + $(CC) -o $(OBJ_D)/p7_enc.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/p7_enc.c + +$(OBJ_D)/p7_lib.o: $(SRC_D)/crypto/asn1/p7_lib.c + $(CC) -o $(OBJ_D)/p7_lib.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/p7_lib.c + +$(OBJ_D)/f_int.o: $(SRC_D)/crypto/asn1/f_int.c + $(CC) -o $(OBJ_D)/f_int.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/f_int.c + +$(OBJ_D)/f_string.o: $(SRC_D)/crypto/asn1/f_string.c + $(CC) -o $(OBJ_D)/f_string.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/f_string.c + +$(OBJ_D)/i2d_dhp.o: $(SRC_D)/crypto/asn1/i2d_dhp.c + $(CC) -o $(OBJ_D)/i2d_dhp.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/i2d_dhp.c + +$(OBJ_D)/i2d_dsap.o: $(SRC_D)/crypto/asn1/i2d_dsap.c + $(CC) -o $(OBJ_D)/i2d_dsap.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/i2d_dsap.c + +$(OBJ_D)/d2i_dhp.o: $(SRC_D)/crypto/asn1/d2i_dhp.c + $(CC) -o $(OBJ_D)/d2i_dhp.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/d2i_dhp.c + +$(OBJ_D)/d2i_dsap.o: $(SRC_D)/crypto/asn1/d2i_dsap.c + $(CC) -o $(OBJ_D)/d2i_dsap.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/d2i_dsap.c + +$(OBJ_D)/n_pkey.o: $(SRC_D)/crypto/asn1/n_pkey.c + $(CC) -o $(OBJ_D)/n_pkey.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/n_pkey.c + +$(OBJ_D)/a_hdr.o: $(SRC_D)/crypto/asn1/a_hdr.c + $(CC) -o $(OBJ_D)/a_hdr.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_hdr.c + +$(OBJ_D)/x_pkey.o: $(SRC_D)/crypto/asn1/x_pkey.c + $(CC) -o $(OBJ_D)/x_pkey.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/x_pkey.c + +$(OBJ_D)/a_bool.o: $(SRC_D)/crypto/asn1/a_bool.c + $(CC) -o $(OBJ_D)/a_bool.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_bool.c + +$(OBJ_D)/x_exten.o: $(SRC_D)/crypto/asn1/x_exten.c + $(CC) -o $(OBJ_D)/x_exten.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/x_exten.c + +$(OBJ_D)/asn1_par.o: $(SRC_D)/crypto/asn1/asn1_par.c + $(CC) -o $(OBJ_D)/asn1_par.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/asn1_par.c + +$(OBJ_D)/asn1_lib.o: $(SRC_D)/crypto/asn1/asn1_lib.c + $(CC) -o $(OBJ_D)/asn1_lib.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/asn1_lib.c + +$(OBJ_D)/asn1_err.o: $(SRC_D)/crypto/asn1/asn1_err.c + $(CC) -o $(OBJ_D)/asn1_err.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/asn1_err.c + +$(OBJ_D)/a_meth.o: $(SRC_D)/crypto/asn1/a_meth.c + $(CC) -o $(OBJ_D)/a_meth.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_meth.c + +$(OBJ_D)/a_bytes.o: $(SRC_D)/crypto/asn1/a_bytes.c + $(CC) -o $(OBJ_D)/a_bytes.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/a_bytes.c + +$(OBJ_D)/evp_asn1.o: $(SRC_D)/crypto/asn1/evp_asn1.c + $(CC) -o $(OBJ_D)/evp_asn1.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/asn1/evp_asn1.c + +$(OBJ_D)/x509_def.o: $(SRC_D)/crypto/x509/x509_def.c + $(CC) -o $(OBJ_D)/x509_def.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509_def.c + +$(OBJ_D)/x509_d2.o: $(SRC_D)/crypto/x509/x509_d2.c + $(CC) -o $(OBJ_D)/x509_d2.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509_d2.c + +$(OBJ_D)/x509_r2x.o: $(SRC_D)/crypto/x509/x509_r2x.c + $(CC) -o $(OBJ_D)/x509_r2x.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509_r2x.c + +$(OBJ_D)/x509_cmp.o: $(SRC_D)/crypto/x509/x509_cmp.c + $(CC) -o $(OBJ_D)/x509_cmp.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509_cmp.c + +$(OBJ_D)/x509_obj.o: $(SRC_D)/crypto/x509/x509_obj.c + $(CC) -o $(OBJ_D)/x509_obj.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509_obj.c + +$(OBJ_D)/x509_req.o: $(SRC_D)/crypto/x509/x509_req.c + $(CC) -o $(OBJ_D)/x509_req.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509_req.c + +$(OBJ_D)/x509_vfy.o: $(SRC_D)/crypto/x509/x509_vfy.c + $(CC) -o $(OBJ_D)/x509_vfy.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509_vfy.c + +$(OBJ_D)/x509_set.o: $(SRC_D)/crypto/x509/x509_set.c + $(CC) -o $(OBJ_D)/x509_set.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509_set.c + +$(OBJ_D)/x509rset.o: $(SRC_D)/crypto/x509/x509rset.c + $(CC) -o $(OBJ_D)/x509rset.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509rset.c + +$(OBJ_D)/x509_err.o: $(SRC_D)/crypto/x509/x509_err.c + $(CC) -o $(OBJ_D)/x509_err.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509_err.c + +$(OBJ_D)/x509name.o: $(SRC_D)/crypto/x509/x509name.c + $(CC) -o $(OBJ_D)/x509name.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509name.c + +$(OBJ_D)/x509_v3.o: $(SRC_D)/crypto/x509/x509_v3.c + $(CC) -o $(OBJ_D)/x509_v3.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509_v3.c + +$(OBJ_D)/x509_ext.o: $(SRC_D)/crypto/x509/x509_ext.c + $(CC) -o $(OBJ_D)/x509_ext.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509_ext.c + +$(OBJ_D)/x509pack.o: $(SRC_D)/crypto/x509/x509pack.c + $(CC) -o $(OBJ_D)/x509pack.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509pack.c + +$(OBJ_D)/x509type.o: $(SRC_D)/crypto/x509/x509type.c + $(CC) -o $(OBJ_D)/x509type.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509type.c + +$(OBJ_D)/x509_lu.o: $(SRC_D)/crypto/x509/x509_lu.c + $(CC) -o $(OBJ_D)/x509_lu.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509_lu.c + +$(OBJ_D)/x_all.o: $(SRC_D)/crypto/x509/x_all.c + $(CC) -o $(OBJ_D)/x_all.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x_all.c + +$(OBJ_D)/x509_txt.o: $(SRC_D)/crypto/x509/x509_txt.c + $(CC) -o $(OBJ_D)/x509_txt.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/x509_txt.c + +$(OBJ_D)/by_file.o: $(SRC_D)/crypto/x509/by_file.c + $(CC) -o $(OBJ_D)/by_file.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/by_file.c + +$(OBJ_D)/by_dir.o: $(SRC_D)/crypto/x509/by_dir.c + $(CC) -o $(OBJ_D)/by_dir.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/by_dir.c + +$(OBJ_D)/v3_net.o: $(SRC_D)/crypto/x509/v3_net.c + $(CC) -o $(OBJ_D)/v3_net.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/v3_net.c + +$(OBJ_D)/v3_x509.o: $(SRC_D)/crypto/x509/v3_x509.c + $(CC) -o $(OBJ_D)/v3_x509.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/x509/v3_x509.c + +$(OBJ_D)/conf.o: $(SRC_D)/crypto/conf/conf.c + $(CC) -o $(OBJ_D)/conf.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/conf/conf.c + +$(OBJ_D)/conf_err.o: $(SRC_D)/crypto/conf/conf_err.c + $(CC) -o $(OBJ_D)/conf_err.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/conf/conf_err.c + +$(OBJ_D)/txt_db.o: $(SRC_D)/crypto/txt_db/txt_db.c + $(CC) -o $(OBJ_D)/txt_db.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/txt_db/txt_db.c + +$(OBJ_D)/pk7_lib.o: $(SRC_D)/crypto/pkcs7/pk7_lib.c + $(CC) -o $(OBJ_D)/pk7_lib.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/pkcs7/pk7_lib.c + +$(OBJ_D)/pkcs7err.o: $(SRC_D)/crypto/pkcs7/pkcs7err.c + $(CC) -o $(OBJ_D)/pkcs7err.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/pkcs7/pkcs7err.c + +$(OBJ_D)/pk7_doit.o: $(SRC_D)/crypto/pkcs7/pk7_doit.c + $(CC) -o $(OBJ_D)/pk7_doit.o $(LIB_CFLAGS) -c $(SRC_D)/crypto/pkcs7/pk7_doit.c + +$(OBJ_D)/s2_meth.o: $(SRC_D)/ssl/s2_meth.c + $(CC) -o $(OBJ_D)/s2_meth.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s2_meth.c + +$(OBJ_D)/s2_srvr.o: $(SRC_D)/ssl/s2_srvr.c + $(CC) -o $(OBJ_D)/s2_srvr.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s2_srvr.c + +$(OBJ_D)/s2_clnt.o: $(SRC_D)/ssl/s2_clnt.c + $(CC) -o $(OBJ_D)/s2_clnt.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s2_clnt.c + +$(OBJ_D)/s2_lib.o: $(SRC_D)/ssl/s2_lib.c + $(CC) -o $(OBJ_D)/s2_lib.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s2_lib.c + +$(OBJ_D)/s2_enc.o: $(SRC_D)/ssl/s2_enc.c + $(CC) -o $(OBJ_D)/s2_enc.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s2_enc.c + +$(OBJ_D)/s2_pkt.o: $(SRC_D)/ssl/s2_pkt.c + $(CC) -o $(OBJ_D)/s2_pkt.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s2_pkt.c + +$(OBJ_D)/s3_meth.o: $(SRC_D)/ssl/s3_meth.c + $(CC) -o $(OBJ_D)/s3_meth.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s3_meth.c + +$(OBJ_D)/s3_srvr.o: $(SRC_D)/ssl/s3_srvr.c + $(CC) -o $(OBJ_D)/s3_srvr.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s3_srvr.c + +$(OBJ_D)/s3_clnt.o: $(SRC_D)/ssl/s3_clnt.c + $(CC) -o $(OBJ_D)/s3_clnt.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s3_clnt.c + +$(OBJ_D)/s3_lib.o: $(SRC_D)/ssl/s3_lib.c + $(CC) -o $(OBJ_D)/s3_lib.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s3_lib.c + +$(OBJ_D)/s3_enc.o: $(SRC_D)/ssl/s3_enc.c + $(CC) -o $(OBJ_D)/s3_enc.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s3_enc.c + +$(OBJ_D)/s3_pkt.o: $(SRC_D)/ssl/s3_pkt.c + $(CC) -o $(OBJ_D)/s3_pkt.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s3_pkt.c + +$(OBJ_D)/s3_both.o: $(SRC_D)/ssl/s3_both.c + $(CC) -o $(OBJ_D)/s3_both.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s3_both.c + +$(OBJ_D)/s23_meth.o: $(SRC_D)/ssl/s23_meth.c + $(CC) -o $(OBJ_D)/s23_meth.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s23_meth.c + +$(OBJ_D)/s23_srvr.o: $(SRC_D)/ssl/s23_srvr.c + $(CC) -o $(OBJ_D)/s23_srvr.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s23_srvr.c + +$(OBJ_D)/s23_clnt.o: $(SRC_D)/ssl/s23_clnt.c + $(CC) -o $(OBJ_D)/s23_clnt.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s23_clnt.c + +$(OBJ_D)/s23_lib.o: $(SRC_D)/ssl/s23_lib.c + $(CC) -o $(OBJ_D)/s23_lib.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s23_lib.c + +$(OBJ_D)/s23_pkt.o: $(SRC_D)/ssl/s23_pkt.c + $(CC) -o $(OBJ_D)/s23_pkt.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/s23_pkt.c + +$(OBJ_D)/t1_meth.o: $(SRC_D)/ssl/t1_meth.c + $(CC) -o $(OBJ_D)/t1_meth.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/t1_meth.c + +$(OBJ_D)/t1_srvr.o: $(SRC_D)/ssl/t1_srvr.c + $(CC) -o $(OBJ_D)/t1_srvr.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/t1_srvr.c + +$(OBJ_D)/t1_clnt.o: $(SRC_D)/ssl/t1_clnt.c + $(CC) -o $(OBJ_D)/t1_clnt.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/t1_clnt.c + +$(OBJ_D)/t1_lib.o: $(SRC_D)/ssl/t1_lib.c + $(CC) -o $(OBJ_D)/t1_lib.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/t1_lib.c + +$(OBJ_D)/t1_enc.o: $(SRC_D)/ssl/t1_enc.c + $(CC) -o $(OBJ_D)/t1_enc.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/t1_enc.c + +$(OBJ_D)/ssl_lib.o: $(SRC_D)/ssl/ssl_lib.c + $(CC) -o $(OBJ_D)/ssl_lib.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/ssl_lib.c + +$(OBJ_D)/ssl_err2.o: $(SRC_D)/ssl/ssl_err2.c + $(CC) -o $(OBJ_D)/ssl_err2.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/ssl_err2.c + +$(OBJ_D)/ssl_cert.o: $(SRC_D)/ssl/ssl_cert.c + $(CC) -o $(OBJ_D)/ssl_cert.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/ssl_cert.c + +$(OBJ_D)/ssl_sess.o: $(SRC_D)/ssl/ssl_sess.c + $(CC) -o $(OBJ_D)/ssl_sess.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/ssl_sess.c + +$(OBJ_D)/ssl_ciph.o: $(SRC_D)/ssl/ssl_ciph.c + $(CC) -o $(OBJ_D)/ssl_ciph.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/ssl_ciph.c + +$(OBJ_D)/ssl_stat.o: $(SRC_D)/ssl/ssl_stat.c + $(CC) -o $(OBJ_D)/ssl_stat.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/ssl_stat.c + +$(OBJ_D)/ssl_rsa.o: $(SRC_D)/ssl/ssl_rsa.c + $(CC) -o $(OBJ_D)/ssl_rsa.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/ssl_rsa.c + +$(OBJ_D)/ssl_asn1.o: $(SRC_D)/ssl/ssl_asn1.c + $(CC) -o $(OBJ_D)/ssl_asn1.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/ssl_asn1.c + +$(OBJ_D)/ssl_txt.o: $(SRC_D)/ssl/ssl_txt.c + $(CC) -o $(OBJ_D)/ssl_txt.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/ssl_txt.c + +$(OBJ_D)/ssl_algs.o: $(SRC_D)/ssl/ssl_algs.c + $(CC) -o $(OBJ_D)/ssl_algs.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/ssl_algs.c + +$(OBJ_D)/bio_ssl.o: $(SRC_D)/ssl/bio_ssl.c + $(CC) -o $(OBJ_D)/bio_ssl.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/bio_ssl.c + +$(OBJ_D)/ssl_err.o: $(SRC_D)/ssl/ssl_err.c + $(CC) -o $(OBJ_D)/ssl_err.o $(LIB_CFLAGS) -c $(SRC_D)/ssl/ssl_err.c + +$(OBJ_D)/rsaref.o: $(SRC_D)/rsaref/rsaref.c + $(CC) -o $(OBJ_D)/rsaref.o $(LIB_CFLAGS) -c $(SRC_D)/rsaref/rsaref.c + +$(OBJ_D)/rsar_err.o: $(SRC_D)/rsaref/rsar_err.c + $(CC) -o $(OBJ_D)/rsar_err.o $(LIB_CFLAGS) -c $(SRC_D)/rsaref/rsar_err.c + +$(TEST_D)/md2test: $(OBJ_D)/md2test.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/md2test $(LFLAGS) $(OBJ_D)/md2test.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/md5test: $(OBJ_D)/md5test.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/md5test $(LFLAGS) $(OBJ_D)/md5test.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/shatest: $(OBJ_D)/shatest.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/shatest $(LFLAGS) $(OBJ_D)/shatest.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/sha1test: $(OBJ_D)/sha1test.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/sha1test $(LFLAGS) $(OBJ_D)/sha1test.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/mdc2test: $(OBJ_D)/mdc2test.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/mdc2test $(LFLAGS) $(OBJ_D)/mdc2test.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/hmactest: $(OBJ_D)/hmactest.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/hmactest $(LFLAGS) $(OBJ_D)/hmactest.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/rmdtest: $(OBJ_D)/rmdtest.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/rmdtest $(LFLAGS) $(OBJ_D)/rmdtest.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/destest: $(OBJ_D)/destest.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/destest $(LFLAGS) $(OBJ_D)/destest.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/rc2test: $(OBJ_D)/rc2test.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/rc2test $(LFLAGS) $(OBJ_D)/rc2test.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/rc4test: $(OBJ_D)/rc4test.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/rc4test $(LFLAGS) $(OBJ_D)/rc4test.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/rc5test: $(OBJ_D)/rc5test.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/rc5test $(LFLAGS) $(OBJ_D)/rc5test.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/ideatest: $(OBJ_D)/ideatest.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/ideatest $(LFLAGS) $(OBJ_D)/ideatest.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/bftest: $(OBJ_D)/bftest.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/bftest $(LFLAGS) $(OBJ_D)/bftest.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/casttest: $(OBJ_D)/casttest.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/casttest $(LFLAGS) $(OBJ_D)/casttest.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/bntest: $(OBJ_D)/bntest.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/bntest $(LFLAGS) $(OBJ_D)/bntest.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/exptest: $(OBJ_D)/exptest.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/exptest $(LFLAGS) $(OBJ_D)/exptest.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/dsatest: $(OBJ_D)/dsatest.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/dsatest $(LFLAGS) $(OBJ_D)/dsatest.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/dhtest: $(OBJ_D)/dhtest.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/dhtest $(LFLAGS) $(OBJ_D)/dhtest.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/randtest: $(OBJ_D)/randtest.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/randtest $(LFLAGS) $(OBJ_D)/randtest.o $(L_LIBS) $(EX_LIBS) + +$(TEST_D)/ssltest: $(OBJ_D)/ssltest.o $(LIBS_DEP) + $(LINK) -o $(TEST_D)/ssltest $(LFLAGS) $(OBJ_D)/ssltest.o $(L_LIBS) $(EX_LIBS) + +$(LIB_D)/$(O_SSL): $(SSLOBJ) + $(RM) $(LIB_D)/$(O_SSL) + $(MKLIB) $(LIB_D)/$(O_SSL) $(SSLOBJ) + $(RANLIB) $(LIB_D)/$(O_SSL) + +$(LIB_D)/$(O_RSAGLUE): $(RSAGLUEOBJ) + $(RM) $(LIB_D)/$(O_RSAGLUE) + $(MKLIB) $(LIB_D)/$(O_RSAGLUE) $(RSAGLUEOBJ) + $(RANLIB) $(LIB_D)/$(O_RSAGLUE) + +$(LIB_D)/$(O_CRYPTO): $(CRYPTOOBJ) + $(RM) $(LIB_D)/$(O_CRYPTO) + $(MKLIB) $(LIB_D)/$(O_CRYPTO) $(CRYPTOOBJ) + $(RANLIB) $(LIB_D)/$(O_CRYPTO) + +$(BIN_D)/$(E_EXE): $(E_OBJ) $(LIBS_DEP) + $(LINK) -o $(BIN_D)/$(E_EXE) $(LFLAGS) $(E_OBJ) $(L_LIBS) $(EX_LIBS) + diff --git a/src/lib/libssl/src/ms/cipher.out b/src/lib/libssl/src/ms/cipher.out new file mode 100644 index 0000000000..2c73bb7d1c --- /dev/null +++ b/src/lib/libssl/src/ms/cipher.out @@ -0,0 +1,93 @@ +echo=off + +echo start testenc +path=..\ms;%path% +set ssleay=%1% +set input=..\ms\testenc.bat +set tmp1=..\ms\cipher.out +set out1=..\ms\clear.out +set cmp=perl ..\ms\cmp.pl + +call tenc.bat enc +if errorlevel 1 goto err + +call tenc.bat rc4 +if errorlevel 1 goto err + +call tenc.bat des-cfb +if errorlevel 1 goto err + +call tenc.bat des-ede-cfb +if errorlevel 1 goto err + +call tenc.bat des-ede3-cfb +if errorlevel 1 goto err + +call tenc.bat des-ofb +if errorlevel 1 goto err + +call tenc.bat des-ede-ofb +if errorlevel 1 goto err + +call tenc.bat des-ede3-ofb +if errorlevel 1 goto err + +call tenc.bat des-ecb +if errorlevel 1 goto err + +call tenc.bat des-ede +if errorlevel 1 goto err + +call tenc.bat des-ede3 +if errorlevel 1 goto err + +call tenc.bat des-cbc +if errorlevel 1 goto err + +call tenc.bat des-ede-cbc +if errorlevel 1 goto err + +call tenc.bat des-ede3-cbc +if errorlevel 1 goto err + +call tenc.bat idea-ecb +if errorlevel 1 goto err + +call tenc.bat idea-cfb +if errorlevel 1 goto err + +call tenc.bat idea-ofb +if errorlevel 1 goto err + +call tenc.bat idea-cbc +if errorlevel 1 goto err + +call tenc.bat rc2-ecb +if errorlevel 1 goto err + +call tenc.bat rc2-cfb +if errorlevel 1 goto err + +call tenc.bat rc2-ofb +if errorlevel 1 goto err + +call tenc.bat rc2-cbc +if errorlevel 1 goto err + +call tenc.bat bf-ecb +if errorlevel 1 goto err + +call tenc.bat bf-cfb +if errorlevel 1 goto err + +call tenc.bat bf-ofb +if errorlevel 1 goto err + +call tenc.bat bf-cbc +if errorlevel 1 goto err + +echo OK +del %out1% +del %tmp1% +:err + diff --git a/src/lib/libssl/src/ms/clear.out b/src/lib/libssl/src/ms/clear.out new file mode 100644 index 0000000000..2c73bb7d1c --- /dev/null +++ b/src/lib/libssl/src/ms/clear.out @@ -0,0 +1,93 @@ +echo=off + +echo start testenc +path=..\ms;%path% +set ssleay=%1% +set input=..\ms\testenc.bat +set tmp1=..\ms\cipher.out +set out1=..\ms\clear.out +set cmp=perl ..\ms\cmp.pl + +call tenc.bat enc +if errorlevel 1 goto err + +call tenc.bat rc4 +if errorlevel 1 goto err + +call tenc.bat des-cfb +if errorlevel 1 goto err + +call tenc.bat des-ede-cfb +if errorlevel 1 goto err + +call tenc.bat des-ede3-cfb +if errorlevel 1 goto err + +call tenc.bat des-ofb +if errorlevel 1 goto err + +call tenc.bat des-ede-ofb +if errorlevel 1 goto err + +call tenc.bat des-ede3-ofb +if errorlevel 1 goto err + +call tenc.bat des-ecb +if errorlevel 1 goto err + +call tenc.bat des-ede +if errorlevel 1 goto err + +call tenc.bat des-ede3 +if errorlevel 1 goto err + +call tenc.bat des-cbc +if errorlevel 1 goto err + +call tenc.bat des-ede-cbc +if errorlevel 1 goto err + +call tenc.bat des-ede3-cbc +if errorlevel 1 goto err + +call tenc.bat idea-ecb +if errorlevel 1 goto err + +call tenc.bat idea-cfb +if errorlevel 1 goto err + +call tenc.bat idea-ofb +if errorlevel 1 goto err + +call tenc.bat idea-cbc +if errorlevel 1 goto err + +call tenc.bat rc2-ecb +if errorlevel 1 goto err + +call tenc.bat rc2-cfb +if errorlevel 1 goto err + +call tenc.bat rc2-ofb +if errorlevel 1 goto err + +call tenc.bat rc2-cbc +if errorlevel 1 goto err + +call tenc.bat bf-ecb +if errorlevel 1 goto err + +call tenc.bat bf-cfb +if errorlevel 1 goto err + +call tenc.bat bf-ofb +if errorlevel 1 goto err + +call tenc.bat bf-cbc +if errorlevel 1 goto err + +echo OK +del %out1% +del %tmp1% +:err + diff --git a/src/lib/libssl/src/ms/libeay16.def b/src/lib/libssl/src/ms/libeay16.def new file mode 100644 index 0000000000..65bbad629e --- /dev/null +++ b/src/lib/libssl/src/ms/libeay16.def @@ -0,0 +1,987 @@ +; +; Definition file for the DDL version of the LIBEAY16 library from SSLeay +; + +LIBRARY LIBEAY16 + +DESCRIPTION 'SSLeay LIBEAY16 - eay@cryptsoft.com' + +CODE PRELOAD MOVEABLE +DATA PRELOAD MOVEABLE SINGLE + +EXETYPE WINDOWS + +HEAPSIZE 4096 +STACKSIZE 8192 + +EXPORTS + _SSLeay @1 + _SSLeay_add_all_algorithms @508 + _SSLeay_add_all_ciphers @509 + _SSLeay_add_all_digests @510 + _SSLeay_version @2 + _ASN1_BIT_STRING_asn1_meth @3 + _ASN1_BIT_STRING_get_bit @1060 + _ASN1_BIT_STRING_set_bit @1061 + _ASN1_HEADER_free @4 + _ASN1_HEADER_new @5 + _ASN1_IA5STRING_asn1_meth @6 + _ASN1_INTEGER_get @7 + _ASN1_INTEGER_set @8 + _ASN1_INTEGER_to_BN @9 + _ASN1_OBJECT_create @10 + _ASN1_OBJECT_free @11 + _ASN1_OBJECT_new @12 + _ASN1_PRINTABLE_type @13 + _ASN1_STRING_cmp @14 + _ASN1_STRING_dup @15 + _ASN1_STRING_free @16 + _ASN1_STRING_new @17 + _ASN1_STRING_print @18 + _ASN1_STRING_set @19 + _ASN1_STRING_type_new @20 + _ASN1_TYPE_free @21 + _ASN1_TYPE_get @916 + _ASN1_TYPE_get_int_octetstring @1076 + _ASN1_TYPE_get_octetstring @1077 + _ASN1_TYPE_new @22 + _ASN1_TYPE_set @917 + _ASN1_TYPE_set_int_octetstring @1078 + _ASN1_TYPE_set_octetstring @1079 + _ASN1_UNIVERSALSTRING_to_string @23 + _ASN1_UTCTIME_check @24 + _ASN1_UTCTIME_print @25 + _ASN1_UTCTIME_set @26 + _ASN1_UTCTIME_set_string @1080 + _ASN1_check_infinite_end @27 + _ASN1_d2i_bio @28 + _ASN1_digest @30 + _ASN1_dup @31 + _ASN1_get_object @32 + _ASN1_i2d_bio @33 + _ASN1_object_size @35 + _ASN1_parse @36 + _ASN1_put_object @37 + _ASN1_sign @38 + _ASN1_verify @39 + _BF_cbc_encrypt @40 + _BF_cfb64_encrypt @41 + _BF_decrypt @987 + _BF_ecb_encrypt @42 + _BF_encrypt @43 + _BF_ofb64_encrypt @44 + _BF_options @45 + _BF_set_key @46 + _BIO_accept @51 + _BIO_copy_next_retry @955 + _BIO_ctrl @52 + _BIO_debug_callback @54 + _BIO_dump @55 + _BIO_dup_chain @56 + _BIO_f_base64 @57 + _BIO_f_buffer @58 + _BIO_f_cipher @59 + _BIO_f_md @60 + _BIO_f_nbio_test @915 + _BIO_f_null @61 + _BIO_fd_non_fatal_error @63 + _BIO_fd_should_retry @64 + _BIO_find_type @65 + _BIO_free @66 + _BIO_free_all @67 + _BIO_get_accept_socket @69 + _BIO_get_host_ip @71 + _BIO_get_port @72 + _BIO_get_retry_BIO @73 + _BIO_get_retry_reason @74 + _BIO_gethostbyname @75 + _BIO_gets @76 + _BIO_ghbn_ctrl @1003 + _BIO_int_ctrl @53 + _BIO_new @78 + _BIO_new_accept @79 + _BIO_new_connect @80 + _BIO_new_fd @81 + _BIO_new_socket @84 + _BIO_pop @85 + _BIO_printf @86 + _BIO_ptr_ctrl @969 + _BIO_push @87 + _BIO_puts @88 + _BIO_read @89 + _BIO_s_accept @90 + _BIO_s_connect @91 + _BIO_s_fd @92 + _BIO_s_mem @95 + _BIO_s_null @96 + _BIO_s_socket @98 + _BIO_set @100 + _BIO_set_cipher @101 + _BIO_set_tcp_ndelay @102 + _BIO_sock_cleanup @103 + _BIO_sock_error @104 + _BIO_sock_init @105 + _BIO_sock_non_fatal_error @106 + _BIO_sock_should_retry @107 + _BIO_socket_ioctl @108 + _BIO_write @109 + _BN_BLINDING_convert @973 + _BN_BLINDING_free @981 + _BN_BLINDING_invert @974 + _BN_BLINDING_new @980 + _BN_BLINDING_update @975 + _BN_CTX_free @110 + _BN_CTX_new @111 + _BN_MONT_CTX_free @112 + _BN_MONT_CTX_new @113 + _BN_MONT_CTX_set @114 + _BN_add @115 + _BN_add_word @116 + _BN_bin2bn @118 + _BN_bn2bin @120 + _BN_bn2dec @1002 + _BN_bn2hex @119 + _BN_bn2mpi @1058 + _BN_clear @121 + _BN_clear_bit @122 + _BN_clear_free @123 + _BN_cmp @124 + _BN_copy @125 + _BN_dec2bn @1001 + _BN_div @126 + _BN_div_word @127 + _BN_dup @128 + _BN_exp @998 + _BN_free @129 + _BN_from_montgomery @130 + _BN_gcd @131 + _BN_generate_prime @132 + _BN_get_word @133 + _BN_hex2bn @117 + _BN_is_bit_set @134 + _BN_is_prime @135 + _BN_lshift @136 + _BN_lshift1 @137 + _BN_mask_bits @138 + _BN_mod @139 + _BN_mod_exp @140 + _BN_mod_exp_mont @141 + _BN_mod_exp_recp @142 + _BN_mod_exp_simple @143 + _BN_mod_inverse @144 + _BN_mod_mul @145 + _BN_mod_mul_montgomery @146 + _BN_mod_mul_reciprocal @147 + _BN_mod_word @148 + _BN_mpi2bn @1059 + _BN_mul @149 + _BN_mul_word @999 + _BN_new @150 + _BN_num_bits @151 + _BN_num_bits_word @152 + _BN_options @153 + _BN_print @154 + _BN_rand @156 + _BN_reciprocal @157 + _BN_rshift @158 + _BN_rshift1 @159 + _BN_set_bit @160 + _BN_set_word @161 + _BN_sqr @162 + _BN_sub @163 + _BN_sub_word @1000 + _BN_to_ASN1_INTEGER @164 + _BN_ucmp @165 + _BN_value_one @166 + _BUF_MEM_free @167 + _BUF_MEM_grow @168 + _BUF_MEM_new @169 + _BUF_strdup @170 + _CAST_cbc_encrypt @992 + _CAST_cfb64_encrypt @993 + _CAST_decrypt @990 + _CAST_ecb_encrypt @991 + _CAST_encrypt @989 + _CAST_ofb64_encrypt @994 + _CAST_set_key @988 + _CONF_free @171 + _CONF_get_number @172 + _CONF_get_section @173 + _CONF_get_string @174 + _CONF_load @175 + _CRYPTO_add_lock @176 + _CRYPTO_dbg_free @177 + _CRYPTO_dbg_malloc @178 + _CRYPTO_dbg_realloc @179 + _CRYPTO_dbg_remalloc @180 + _CRYPTO_dup_ex_data @1025 + _CRYPTO_free @181 + _CRYPTO_free_ex_data @1004 + _CRYPTO_get_add_lock_callback @182 + _CRYPTO_get_ex_data @1005 + _CRYPTO_get_ex_new_index @1041 + _CRYPTO_get_id_callback @183 + _CRYPTO_get_lock_name @184 + _CRYPTO_get_locking_callback @185 + _CRYPTO_get_mem_functions @186 + _CRYPTO_get_new_lockid @1026 + _CRYPTO_lock @187 + _CRYPTO_malloc @188 + _CRYPTO_mem_ctrl @189 + _CRYPTO_mem_leaks @190 + _CRYPTO_mem_leaks_cb @191 + _CRYPTO_new_ex_data @1027 + _CRYPTO_realloc @193 + _CRYPTO_remalloc @194 + _CRYPTO_set_add_lock_callback @195 + _CRYPTO_set_ex_data @1007 + _CRYPTO_set_id_callback @196 + _CRYPTO_set_locking_callback @197 + _CRYPTO_set_mem_functions @198 + _CRYPTO_thread_id @199 + _DH_check @200 + _DH_compute_key @201 + _DH_free @202 + _DH_generate_key @203 + _DH_generate_parameters @204 + _DH_new @205 + _DH_size @206 + _DHparams_print @207 + _DSA_free @209 + _DSA_generate_key @210 + _DSA_generate_parameters @211 + _DSA_is_prime @212 + _DSA_new @213 + _DSA_print @214 + _DSA_sign @216 + _DSA_sign_setup @217 + _DSA_size @218 + _DSA_verify @219 + _DSAparams_print @220 + _ERR_add_error_data @1081 + _ERR_clear_error @222 + _ERR_error_string @223 + _ERR_free_strings @224 + _ERR_func_error_string @225 + _ERR_get_err_state_table @226 + _ERR_get_error @227 + _ERR_get_error_line @228 + _ERR_get_next_error_library @966 + _ERR_get_state @229 + _ERR_get_string_table @230 + _ERR_lib_error_string @231 + _ERR_load_ASN1_strings @232 + _ERR_load_BIO_strings @233 + _ERR_load_BN_strings @234 + _ERR_load_BUF_strings @235 + _ERR_load_CONF_strings @236 + _ERR_load_CRYPTOlib_strings @1009 + _ERR_load_DH_strings @237 + _ERR_load_DSA_strings @238 + _ERR_load_ERR_strings @239 + _ERR_load_EVP_strings @240 + _ERR_load_OBJ_strings @241 + _ERR_load_PEM_strings @242 + _ERR_load_PKCS7_strings @919 + _ERR_load_RSA_strings @244 + _ERR_load_X509_strings @245 + _ERR_load_crypto_strings @246 + _ERR_load_strings @247 + _ERR_peek_error @248 + _ERR_peek_error_line @249 + _ERR_print_errors @250 + _ERR_put_error @252 + _ERR_reason_error_string @253 + _ERR_remove_state @254 + _ERR_set_error_data @1082 + _EVP_BytesToKey @255 + _EVP_CIPHER_CTX_cleanup @256 + _EVP_CIPHER_CTX_init @961 + _EVP_CIPHER_asn1_to_param @1083 + _EVP_CIPHER_get_asn1_iv @1085 + _EVP_CIPHER_param_to_asn1 @1084 + _EVP_CIPHER_set_asn1_iv @1086 + _EVP_CipherFinal @257 + _EVP_CipherInit @258 + _EVP_CipherUpdate @259 + _EVP_DecodeBlock @260 + _EVP_DecodeFinal @261 + _EVP_DecodeInit @262 + _EVP_DecodeUpdate @263 + _EVP_DecryptFinal @264 + _EVP_DecryptInit @265 + _EVP_DecryptUpdate @266 + _EVP_DigestFinal @267 + _EVP_DigestInit @268 + _EVP_DigestUpdate @269 + _EVP_EncodeBlock @270 + _EVP_EncodeFinal @271 + _EVP_EncodeInit @272 + _EVP_EncodeUpdate @273 + _EVP_EncryptFinal @274 + _EVP_EncryptInit @275 + _EVP_EncryptUpdate @276 + _EVP_OpenFinal @277 + _EVP_OpenInit @278 + _EVP_PKEY_assign @279 + _EVP_PKEY_bits @1010 + _EVP_PKEY_cmp_parameters @967 + _EVP_PKEY_copy_parameters @280 + _EVP_PKEY_decrypt @1070 + _EVP_PKEY_encrypt @1071 + _EVP_PKEY_free @281 + _EVP_PKEY_missing_parameters @282 + _EVP_PKEY_new @283 + _EVP_PKEY_save_parameters @284 + _EVP_PKEY_size @285 + _EVP_PKEY_type @286 + _EVP_SealFinal @287 + _EVP_SealInit @288 + _EVP_SignFinal @289 + _EVP_VerifyFinal @290 + _EVP_add_alias @291 + _EVP_add_cipher @292 + _EVP_add_digest @293 + _EVP_bf_cbc @294 + _EVP_bf_cfb @295 + _EVP_bf_ecb @296 + _EVP_bf_ofb @297 + _EVP_cast5_cbc @983 + _EVP_cast5_cfb @984 + _EVP_cast5_ecb @985 + _EVP_cast5_ofb @986 + _EVP_cleanup @298 + _EVP_delete_alias @941 + _EVP_des_cbc @299 + _EVP_des_cfb @300 + _EVP_des_ecb @301 + _EVP_des_ede @302 + _EVP_des_ede3 @303 + _EVP_des_ede3_cbc @304 + _EVP_des_ede3_cfb @305 + _EVP_des_ede3_ofb @306 + _EVP_des_ede_cbc @307 + _EVP_des_ede_cfb @308 + _EVP_des_ede_ofb @309 + _EVP_des_ofb @310 + _EVP_desx_cbc @311 + _EVP_dss @312 + _EVP_dss1 @313 + _EVP_enc_null @314 + _EVP_get_cipherbyname @315 + _EVP_get_digestbyname @316 + _EVP_get_pw_prompt @317 + _EVP_idea_cbc @318 + _EVP_idea_cfb @319 + _EVP_idea_ecb @320 + _EVP_idea_ofb @321 + _EVP_md2 @322 + _EVP_md5 @323 + _EVP_md_null @324 + _EVP_mdc2 @942 + _EVP_rc2_40_cbc @959 + _EVP_rc2_cbc @325 + _EVP_rc2_cfb @326 + _EVP_rc2_ecb @327 + _EVP_rc2_ofb @328 + _EVP_rc4 @329 + _EVP_rc4_40 @960 + _EVP_rc5_32_12_16_cbc @1087 + _EVP_rc5_32_12_16_cfb @1088 + _EVP_rc5_32_12_16_ecb @1089 + _EVP_rc5_32_12_16_ofb @1090 + _EVP_read_pw_string @330 + _EVP_set_pw_prompt @331 + _EVP_sha @332 + _EVP_sha1 @333 + _HMAC @962 + _HMAC_Final @965 + _HMAC_Init @963 + _HMAC_Update @964 + _HMAC_cleanup @968 + _MD2 @334 + _MD2_Final @335 + _MD2_Init @336 + _MD2_Update @337 + _MD2_options @338 + _MD5 @339 + _MD5_Final @340 + _MD5_Init @341 + _MD5_Transform @1011 + _MD5_Update @342 + _MDC2 @343 + _MDC2_Final @344 + _MDC2_Init @345 + _MDC2_Update @346 + _NETSCAPE_SPKAC_free @347 + _NETSCAPE_SPKAC_new @348 + _NETSCAPE_SPKI_free @349 + _NETSCAPE_SPKI_new @350 + _NETSCAPE_SPKI_sign @351 + _NETSCAPE_SPKI_verify @352 + _OBJ_add_object @353 + _OBJ_bsearch @354 + _OBJ_cleanup @355 + _OBJ_cmp @356 + _OBJ_create @357 + _OBJ_create_objects @997 + _OBJ_dup @358 + _OBJ_ln2nid @359 + _OBJ_new_nid @360 + _OBJ_nid2ln @361 + _OBJ_nid2obj @362 + _OBJ_nid2sn @363 + _OBJ_obj2nid @364 + _OBJ_sn2nid @365 + _OBJ_txt2nid @366 + _PEM_ASN1_read_bio @368 + _PEM_ASN1_write_bio @370 + _PEM_SealFinal @371 + _PEM_SealInit @372 + _PEM_SealUpdate @373 + _PEM_SignFinal @374 + _PEM_X509_INFO_read_bio @378 + _PEM_X509_INFO_write_bio @379 + _PEM_dek_info @380 + _PEM_do_header @381 + _PEM_get_EVP_CIPHER_INFO @382 + _PEM_proc_type @383 + _PEM_read_bio @394 + _PEM_read_bio_DHparams @395 + _PEM_read_bio_DSAPrivateKey @396 + _PEM_read_bio_DSAparams @397 + _PEM_read_bio_PKCS7 @398 + _PEM_read_bio_PrivateKey @399 + _PEM_read_bio_RSAPrivateKey @400 + _PEM_read_bio_RSAPublicKey @943 + _PEM_read_bio_X509 @401 + _PEM_read_bio_X509_CRL @402 + _PEM_read_bio_X509_REQ @403 + _PEM_write_bio @414 + _PEM_write_bio_DHparams @415 + _PEM_write_bio_DSAPrivateKey @416 + _PEM_write_bio_DSAparams @417 + _PEM_write_bio_PKCS7 @418 + _PEM_write_bio_PrivateKey @419 + _PEM_write_bio_RSAPrivateKey @420 + _PEM_write_bio_RSAPublicKey @944 + _PEM_write_bio_X509 @421 + _PEM_write_bio_X509_CRL @422 + _PEM_write_bio_X509_REQ @423 + _PKCS7_DIGEST_free @424 + _PKCS7_DIGEST_new @425 + _PKCS7_ENCRYPT_free @426 + _PKCS7_ENCRYPT_new @427 + _PKCS7_ENC_CONTENT_free @428 + _PKCS7_ENC_CONTENT_new @429 + _PKCS7_ENVELOPE_free @430 + _PKCS7_ENVELOPE_new @431 + _PKCS7_ISSUER_AND_SERIAL_digest @432 + _PKCS7_ISSUER_AND_SERIAL_free @433 + _PKCS7_ISSUER_AND_SERIAL_new @434 + _PKCS7_RECIP_INFO_free @435 + _PKCS7_RECIP_INFO_new @436 + _PKCS7_RECIP_INFO_set @1072 + _PKCS7_SIGNED_free @437 + _PKCS7_SIGNED_new @438 + _PKCS7_SIGNER_INFO_free @439 + _PKCS7_SIGNER_INFO_new @440 + _PKCS7_SIGNER_INFO_set @930 + _PKCS7_SIGN_ENVELOPE_free @441 + _PKCS7_SIGN_ENVELOPE_new @442 + _PKCS7_add_certificate @932 + _PKCS7_add_crl @933 + _PKCS7_add_recipient @1073 + _PKCS7_add_recipient_info @1074 + _PKCS7_add_signature @938 + _PKCS7_add_signer @931 + _PKCS7_cert_from_signer_info @939 + _PKCS7_content_free @918 + _PKCS7_content_new @934 + _PKCS7_ctrl @927 + _PKCS7_dataInit @937 + _PKCS7_dataSign @935 + _PKCS7_dataVerify @936 + _PKCS7_dup @443 + _PKCS7_free @444 + _PKCS7_get_signer_info @940 + _PKCS7_new @445 + _PKCS7_set_cipher @1075 + _PKCS7_set_content @929 + _PKCS7_set_type @928 + _RAND_bytes @464 + _RAND_cleanup @465 + _RAND_file_name @466 + _RAND_load_file @467 + _RAND_screen @468 + _RAND_seed @469 + _RAND_write_file @470 + _RC2_cbc_encrypt @471 + _RC2_cfb64_encrypt @472 + _RC2_decrypt @995 + _RC2_ecb_encrypt @473 + _RC2_encrypt @474 + _RC2_ofb64_encrypt @475 + _RC2_set_key @476 + _RC4 @477 + _RC4_options @478 + _RC4_set_key @479 + _RC5_32_cbc_encrypt @1051 + _RC5_32_cfb64_encrypt @1052 + _RC5_32_decrypt @1050 + _RC5_32_ecb_encrypt @1048 + _RC5_32_encrypt @1049 + _RC5_32_ofb64_encrypt @1053 + _RC5_32_set_key @1047 + _RIPEMD160 @1045 + _RIPEMD160_Final @1044 + _RIPEMD160_Init @1042 + _RIPEMD160_Transform @1046 + _RIPEMD160_Update @1043 + _RSAPrivateKey_asn1_meth @480 + _RSAPrivateKey_dup @481 + _RSAPublicKey_dup @482 + _RSA_PKCS1_SSLeay @483 + _RSA_blinding_off @978 + _RSA_blinding_on @977 + _RSA_flags @956 + _RSA_free @484 + _RSA_generate_key @485 + _RSA_get_ex_data @1029 + _RSA_get_ex_new_index @1030 + _RSA_new @486 + _RSA_new_method @487 + _RSA_padding_add_PKCS1_type_1 @1031 + _RSA_padding_add_PKCS1_type_2 @1032 + _RSA_padding_add_SSLv23 @1033 + _RSA_padding_add_none @1034 + _RSA_padding_check_PKCS1_type_1 @1035 + _RSA_padding_check_PKCS1_type_2 @1036 + _RSA_padding_check_SSLv23 @1037 + _RSA_padding_check_none @1038 + _RSA_print @488 + _RSA_private_decrypt @490 + _RSA_private_encrypt @491 + _RSA_public_decrypt @492 + _RSA_public_encrypt @493 + _RSA_set_default_method @494 + _RSA_set_ex_data @1028 + _RSA_sign @495 + _RSA_sign_ASN1_OCTET_STRING @496 + _RSA_size @497 + _RSA_verify @498 + _RSA_verify_ASN1_OCTET_STRING @499 + _SHA @500 + _SHA1 @501 + _SHA1_Final @502 + _SHA1_Init @503 + _SHA1_Transform @1012 + _SHA1_Update @504 + _SHA_Final @505 + _SHA_Init @506 + _SHA_Transform @1013 + _SHA_Update @507 + _TXT_DB_create_index @511 + _TXT_DB_free @512 + _TXT_DB_get_by_index @513 + _TXT_DB_insert @514 + _TXT_DB_read @515 + _TXT_DB_write @516 + _X509_ALGOR_free @517 + _X509_ALGOR_new @518 + _X509_ATTRIBUTE_free @519 + _X509_ATTRIBUTE_new @520 + _X509_CINF_free @521 + _X509_CINF_new @522 + _X509_CRL_INFO_free @523 + _X509_CRL_INFO_new @524 + _X509_CRL_add_ext @525 + _X509_CRL_cmp @526 + _X509_CRL_delete_ext @527 + _X509_CRL_dup @528 + _X509_CRL_free @529 + _X509_CRL_get_ext @530 + _X509_CRL_get_ext_by_NID @531 + _X509_CRL_get_ext_by_OBJ @532 + _X509_CRL_get_ext_by_critical @533 + _X509_CRL_get_ext_count @534 + _X509_CRL_new @535 + _X509_CRL_sign @536 + _X509_CRL_verify @537 + _X509_EXTENSION_create_by_NID @538 + _X509_EXTENSION_create_by_OBJ @539 + _X509_EXTENSION_dup @540 + _X509_EXTENSION_free @541 + _X509_EXTENSION_get_critical @542 + _X509_EXTENSION_get_data @543 + _X509_EXTENSION_get_object @544 + _X509_EXTENSION_new @545 + _X509_EXTENSION_set_critical @546 + _X509_EXTENSION_set_data @547 + _X509_EXTENSION_set_object @548 + _X509_INFO_free @549 + _X509_INFO_new @550 + _X509_LOOKUP_by_alias @551 + _X509_LOOKUP_by_fingerprint @552 + _X509_LOOKUP_by_issuer_serial @553 + _X509_LOOKUP_by_subject @554 + _X509_LOOKUP_ctrl @555 + _X509_LOOKUP_file @556 + _X509_LOOKUP_free @557 + _X509_LOOKUP_hash_dir @558 + _X509_LOOKUP_init @559 + _X509_LOOKUP_new @560 + _X509_LOOKUP_shutdown @561 + _X509_NAME_ENTRY_create_by_NID @562 + _X509_NAME_ENTRY_create_by_OBJ @563 + _X509_NAME_ENTRY_dup @564 + _X509_NAME_ENTRY_free @565 + _X509_NAME_ENTRY_get_data @566 + _X509_NAME_ENTRY_get_object @567 + _X509_NAME_ENTRY_new @568 + _X509_NAME_ENTRY_set_data @569 + _X509_NAME_ENTRY_set_object @570 + _X509_NAME_add_entry @571 + _X509_NAME_cmp @572 + _X509_NAME_delete_entry @573 + _X509_NAME_digest @574 + _X509_NAME_dup @575 + _X509_NAME_entry_count @576 + _X509_NAME_free @577 + _X509_NAME_get_entry @578 + _X509_NAME_get_index_by_NID @579 + _X509_NAME_get_index_by_OBJ @580 + _X509_NAME_get_text_by_NID @581 + _X509_NAME_get_text_by_OBJ @582 + _X509_NAME_hash @583 + _X509_NAME_new @584 + _X509_NAME_oneline @585 + _X509_NAME_print @586 + _X509_NAME_set @587 + _X509_OBJECT_free_contents @588 + _X509_OBJECT_retrive_by_subject @589 + _X509_OBJECT_up_ref_count @590 + _X509_PKEY_free @591 + _X509_PKEY_new @592 + _X509_PUBKEY_free @593 + _X509_PUBKEY_get @594 + _X509_PUBKEY_new @595 + _X509_PUBKEY_set @596 + _X509_REQ_INFO_free @597 + _X509_REQ_INFO_new @598 + _X509_REQ_dup @599 + _X509_REQ_free @600 + _X509_REQ_get_pubkey @601 + _X509_REQ_new @602 + _X509_REQ_print @603 + _X509_REQ_set_pubkey @605 + _X509_REQ_set_subject_name @606 + _X509_REQ_set_version @607 + _X509_REQ_sign @608 + _X509_REQ_to_X509 @609 + _X509_REQ_verify @610 + _X509_REVOKED_add_ext @611 + _X509_REVOKED_delete_ext @612 + _X509_REVOKED_free @613 + _X509_REVOKED_get_ext @614 + _X509_REVOKED_get_ext_by_NID @615 + _X509_REVOKED_get_ext_by_OBJ @616 + _X509_REVOKED_get_ext_by_critical @617 + _X509_REVOKED_get_ext_count @618 + _X509_REVOKED_new @619 + _X509_SIG_free @620 + _X509_SIG_new @621 + _X509_STORE_CTX_cleanup @622 + _X509_STORE_CTX_get_chain @1014 + _X509_STORE_CTX_get_current_cert @1015 + _X509_STORE_CTX_get_error @1016 + _X509_STORE_CTX_get_error_depth @1017 + _X509_STORE_CTX_get_ex_data @1018 + _X509_STORE_CTX_init @623 + _X509_STORE_CTX_set_cert @1020 + _X509_STORE_CTX_set_chain @1021 + _X509_STORE_CTX_set_error @1022 + _X509_STORE_CTX_set_ex_data @1023 + _X509_STORE_add_cert @624 + _X509_STORE_add_crl @957 + _X509_STORE_add_lookup @625 + _X509_STORE_free @626 + _X509_STORE_get_by_subject @627 + _X509_STORE_load_locations @628 + _X509_STORE_new @629 + _X509_STORE_set_default_paths @630 + _X509_VAL_free @631 + _X509_VAL_new @632 + _X509_add_ext @633 + _X509_asn1_meth @634 + _X509_certificate_type @635 + _X509_check_private_key @636 + _X509_cmp_current_time @637 + _X509_delete_ext @638 + _X509_digest @639 + _X509_dup @640 + _X509_find_by_issuer_and_serial @920 + _X509_find_by_subject @921 + _X509_free @641 + _X509_get_default_cert_area @642 + _X509_get_default_cert_dir @643 + _X509_get_default_cert_dir_env @644 + _X509_get_default_cert_file @645 + _X509_get_default_cert_file_env @646 + _X509_get_default_private_dir @647 + _X509_get_ext @648 + _X509_get_ext_by_NID @649 + _X509_get_ext_by_OBJ @650 + _X509_get_ext_by_critical @651 + _X509_get_ext_count @652 + _X509_get_issuer_name @653 + _X509_get_pubkey @654 + _X509_get_pubkey_parameters @655 + _X509_get_serialNumber @656 + _X509_get_subject_name @657 + _X509_gmtime_adj @658 + _X509_issuer_and_serial_cmp @659 + _X509_issuer_and_serial_hash @660 + _X509_issuer_name_cmp @661 + _X509_issuer_name_hash @662 + _X509_load_cert_file @663 + _X509_load_crl_file @958 + _X509_new @664 + _X509_print @665 + _X509_set_issuer_name @667 + _X509_set_notAfter @668 + _X509_set_notBefore @669 + _X509_set_pubkey @670 + _X509_set_serialNumber @671 + _X509_set_subject_name @672 + _X509_set_version @673 + _X509_sign @674 + _X509_subject_name_cmp @675 + _X509_subject_name_hash @676 + _X509_to_X509_REQ @677 + _X509_verify @678 + _X509_verify_cert @679 + _X509_verify_cert_error_string @680 + _X509v3_add_ext @681 + _X509v3_add_extension @682 + _X509v3_add_netscape_extensions @683 + _X509v3_add_standard_extensions @684 + _X509v3_cleanup_extensions @685 + _X509v3_data_type_by_NID @686 + _X509v3_data_type_by_OBJ @687 + _X509v3_delete_ext @688 + _X509v3_get_ext @689 + _X509v3_get_ext_by_NID @690 + _X509v3_get_ext_by_OBJ @691 + _X509v3_get_ext_by_critical @692 + _X509v3_get_ext_count @693 + _X509v3_pack_string @694 + _X509v3_pack_type_by_NID @695 + _X509v3_pack_type_by_OBJ @696 + _X509v3_unpack_string @697 + _a2d_ASN1_OBJECT @699 + _a2i_ASN1_INTEGER @700 + _a2i_ASN1_STRING @701 + _asn1_Finish @702 + _asn1_GetSequence @703 + _asn1_add_error @1091 + _bn_add_words @1039 + _bn_div64 @704 + _bn_expand2 @705 + _bn_mul_add_words @706 + _bn_mul_words @707 + _bn_qadd @708 + _bn_qsub @709 + _bn_sqr_words @710 + _crypt @711 + _d2i_ASN1_BIT_STRING @712 + _d2i_ASN1_BOOLEAN @713 + _d2i_ASN1_HEADER @714 + _d2i_ASN1_IA5STRING @715 + _d2i_ASN1_INTEGER @716 + _d2i_ASN1_OBJECT @717 + _d2i_ASN1_OCTET_STRING @718 + _d2i_ASN1_PRINTABLE @719 + _d2i_ASN1_PRINTABLESTRING @720 + _d2i_ASN1_SET @721 + _d2i_ASN1_T61STRING @722 + _d2i_ASN1_TYPE @723 + _d2i_ASN1_UTCTIME @724 + _d2i_ASN1_bytes @725 + _d2i_ASN1_type_bytes @726 + _d2i_DHparams @727 + _d2i_DSAPrivateKey @728 + _d2i_DSAPrivateKey_bio @729 + _d2i_DSAPublicKey @731 + _d2i_DSAparams @732 + _d2i_NETSCAPE_SPKAC @733 + _d2i_NETSCAPE_SPKI @734 + _d2i_Netscape_RSA @735 + _d2i_Netscape_RSA_2 @1040 + _d2i_PKCS7 @736 + _d2i_PKCS7_DIGEST @737 + _d2i_PKCS7_ENCRYPT @738 + _d2i_PKCS7_ENC_CONTENT @739 + _d2i_PKCS7_ENVELOPE @740 + _d2i_PKCS7_ISSUER_AND_SERIAL @741 + _d2i_PKCS7_RECIP_INFO @742 + _d2i_PKCS7_SIGNED @743 + _d2i_PKCS7_SIGNER_INFO @744 + _d2i_PKCS7_SIGN_ENVELOPE @745 + _d2i_PKCS7_bio @746 + _d2i_PrivateKey @748 + _d2i_PublicKey @749 + _d2i_RSAPrivateKey @750 + _d2i_RSAPrivateKey_bio @751 + _d2i_RSAPublicKey @753 + _d2i_RSAPublicKey_bio @945 + _d2i_X509 @754 + _d2i_X509_ALGOR @755 + _d2i_X509_ATTRIBUTE @756 + _d2i_X509_CINF @757 + _d2i_X509_CRL @758 + _d2i_X509_CRL_INFO @759 + _d2i_X509_CRL_bio @760 + _d2i_X509_EXTENSION @762 + _d2i_X509_NAME @763 + _d2i_X509_NAME_ENTRY @764 + _d2i_X509_PKEY @765 + _d2i_X509_PUBKEY @766 + _d2i_X509_REQ @767 + _d2i_X509_REQ_INFO @768 + _d2i_X509_REQ_bio @769 + _d2i_X509_REVOKED @771 + _d2i_X509_SIG @772 + _d2i_X509_VAL @773 + _d2i_X509_bio @774 + _des_cbc_cksum @777 + _des_cbc_encrypt @778 + _des_cblock_print_file @779 + _des_cfb64_encrypt @780 + _des_cfb_encrypt @781 + _des_decrypt3 @782 + _des_ecb3_encrypt @783 + _des_ecb_encrypt @784 + _des_ede3_cbc_encrypt @785 + _des_ede3_cfb64_encrypt @786 + _des_ede3_ofb64_encrypt @787 + _des_enc_read @788 + _des_enc_write @789 + _des_encrypt @790 + _des_encrypt2 @791 + _des_encrypt3 @792 + _des_fcrypt @793 + _des_is_weak_key @794 + _des_key_sched @795 + _des_ncbc_encrypt @796 + _des_ofb64_encrypt @797 + _des_ofb_encrypt @798 + _des_options @799 + _des_pcbc_encrypt @800 + _des_quad_cksum @801 + _des_random_key @802 + _des_random_seed @803 + _des_read_2passwords @804 + _des_read_password @805 + _des_read_pw @806 + _des_read_pw_string @807 + _des_set_key @808 + _des_set_odd_parity @809 + _des_string_to_2keys @810 + _des_string_to_key @811 + _des_xcbc_encrypt @812 + _des_xwhite_in2out @813 + _i2a_ASN1_INTEGER @815 + _i2a_ASN1_OBJECT @816 + _i2a_ASN1_STRING @817 + _i2d_ASN1_BIT_STRING @818 + _i2d_ASN1_BOOLEAN @819 + _i2d_ASN1_HEADER @820 + _i2d_ASN1_IA5STRING @821 + _i2d_ASN1_INTEGER @822 + _i2d_ASN1_OBJECT @823 + _i2d_ASN1_OCTET_STRING @824 + _i2d_ASN1_PRINTABLE @825 + _i2d_ASN1_SET @826 + _i2d_ASN1_TYPE @827 + _i2d_ASN1_UTCTIME @828 + _i2d_ASN1_bytes @829 + _i2d_DHparams @830 + _i2d_DSAPrivateKey @831 + _i2d_DSAPrivateKey_bio @832 + _i2d_DSAPublicKey @834 + _i2d_DSAparams @835 + _i2d_NETSCAPE_SPKAC @836 + _i2d_NETSCAPE_SPKI @837 + _i2d_Netscape_RSA @838 + _i2d_PKCS7 @839 + _i2d_PKCS7_DIGEST @840 + _i2d_PKCS7_ENCRYPT @841 + _i2d_PKCS7_ENC_CONTENT @842 + _i2d_PKCS7_ENVELOPE @843 + _i2d_PKCS7_ISSUER_AND_SERIAL @844 + _i2d_PKCS7_RECIP_INFO @845 + _i2d_PKCS7_SIGNED @846 + _i2d_PKCS7_SIGNER_INFO @847 + _i2d_PKCS7_SIGN_ENVELOPE @848 + _i2d_PKCS7_bio @849 + _i2d_PrivateKey @851 + _i2d_PublicKey @852 + _i2d_RSAPrivateKey @853 + _i2d_RSAPrivateKey_bio @854 + _i2d_RSAPublicKey @856 + _i2d_RSAPublicKey_bio @946 + _i2d_X509 @857 + _i2d_X509_ALGOR @858 + _i2d_X509_ATTRIBUTE @859 + _i2d_X509_CINF @860 + _i2d_X509_CRL @861 + _i2d_X509_CRL_INFO @862 + _i2d_X509_CRL_bio @863 + _i2d_X509_EXTENSION @865 + _i2d_X509_NAME @866 + _i2d_X509_NAME_ENTRY @867 + _i2d_X509_PKEY @868 + _i2d_X509_PUBKEY @869 + _i2d_X509_REQ @870 + _i2d_X509_REQ_INFO @871 + _i2d_X509_REQ_bio @872 + _i2d_X509_REVOKED @874 + _i2d_X509_SIG @875 + _i2d_X509_VAL @876 + _i2d_X509_bio @877 + _i2t_ASN1_OBJECT @979 + _idea_cbc_encrypt @879 + _idea_cfb64_encrypt @880 + _idea_ecb_encrypt @881 + _idea_encrypt @882 + _idea_ofb64_encrypt @883 + _idea_options @884 + _idea_set_decrypt_key @885 + _idea_set_encrypt_key @886 + _lh_delete @887 + _lh_doall @888 + _lh_doall_arg @889 + _lh_free @890 + _lh_insert @891 + _lh_new @892 + _lh_node_stats_bio @894 + _lh_node_usage_stats_bio @896 + _lh_retrieve @897 + _lh_stats_bio @899 + _lh_strhash @900 + _sk_delete @901 + _sk_delete_ptr @902 + _sk_dup @903 + _sk_find @904 + _sk_free @905 + _sk_insert @906 + _sk_new @907 + _sk_pop @908 + _sk_pop_free @909 + _sk_push @910 + _sk_set_cmp_func @911 + _sk_shift @912 + _sk_unshift @913 + _sk_zero @914 + diff --git a/src/lib/libssl/src/ms/libeay32.def b/src/lib/libssl/src/ms/libeay32.def new file mode 100644 index 0000000000..196c52216e --- /dev/null +++ b/src/lib/libssl/src/ms/libeay32.def @@ -0,0 +1,1035 @@ +; +; Definition file for the DDL version of the LIBEAY32 library from SSLeay +; + +LIBRARY LIBEAY32 + +DESCRIPTION 'SSLeay LIBEAY32 - eay@cryptsoft.com' + +EXPORTS + SSLeay @1 + SSLeay_add_all_algorithms @508 + SSLeay_add_all_ciphers @509 + SSLeay_add_all_digests @510 + SSLeay_version @2 + ASN1_BIT_STRING_asn1_meth @3 + ASN1_BIT_STRING_get_bit @1060 + ASN1_BIT_STRING_set_bit @1061 + ASN1_HEADER_free @4 + ASN1_HEADER_new @5 + ASN1_IA5STRING_asn1_meth @6 + ASN1_INTEGER_get @7 + ASN1_INTEGER_set @8 + ASN1_INTEGER_to_BN @9 + ASN1_OBJECT_create @10 + ASN1_OBJECT_free @11 + ASN1_OBJECT_new @12 + ASN1_PRINTABLE_type @13 + ASN1_STRING_cmp @14 + ASN1_STRING_dup @15 + ASN1_STRING_free @16 + ASN1_STRING_new @17 + ASN1_STRING_print @18 + ASN1_STRING_set @19 + ASN1_STRING_type_new @20 + ASN1_TYPE_free @21 + ASN1_TYPE_get @916 + ASN1_TYPE_get_int_octetstring @1076 + ASN1_TYPE_get_octetstring @1077 + ASN1_TYPE_new @22 + ASN1_TYPE_set @917 + ASN1_TYPE_set_int_octetstring @1078 + ASN1_TYPE_set_octetstring @1079 + ASN1_UNIVERSALSTRING_to_string @23 + ASN1_UTCTIME_check @24 + ASN1_UTCTIME_print @25 + ASN1_UTCTIME_set @26 + ASN1_UTCTIME_set_string @1080 + ASN1_check_infinite_end @27 + ASN1_d2i_bio @28 + ASN1_d2i_fp @29 + ASN1_digest @30 + ASN1_dup @31 + ASN1_get_object @32 + ASN1_i2d_bio @33 + ASN1_i2d_fp @34 + ASN1_object_size @35 + ASN1_parse @36 + ASN1_put_object @37 + ASN1_sign @38 + ASN1_verify @39 + BF_cbc_encrypt @40 + BF_cfb64_encrypt @41 + BF_decrypt @987 + BF_ecb_encrypt @42 + BF_encrypt @43 + BF_ofb64_encrypt @44 + BF_options @45 + BF_set_key @46 + BIO_accept @51 + BIO_copy_next_retry @955 + BIO_ctrl @52 + BIO_debug_callback @54 + BIO_dump @55 + BIO_dup_chain @56 + BIO_f_base64 @57 + BIO_f_buffer @58 + BIO_f_cipher @59 + BIO_f_md @60 + BIO_f_nbio_test @915 + BIO_f_null @61 + BIO_fd_non_fatal_error @63 + BIO_fd_should_retry @64 + BIO_find_type @65 + BIO_free @66 + BIO_free_all @67 + BIO_get_accept_socket @69 + BIO_get_host_ip @71 + BIO_get_port @72 + BIO_get_retry_BIO @73 + BIO_get_retry_reason @74 + BIO_gethostbyname @75 + BIO_gets @76 + BIO_ghbn_ctrl @1003 + BIO_int_ctrl @53 + BIO_new @78 + BIO_new_accept @79 + BIO_new_connect @80 + BIO_new_fd @81 + BIO_new_file @82 + BIO_new_fp @83 + BIO_new_socket @84 + BIO_pop @85 + BIO_printf @86 + BIO_ptr_ctrl @969 + BIO_push @87 + BIO_puts @88 + BIO_read @89 + BIO_s_accept @90 + BIO_s_connect @91 + BIO_s_fd @92 + BIO_s_file @93 + BIO_s_mem @95 + BIO_s_null @96 + BIO_s_socket @98 + BIO_set @100 + BIO_set_cipher @101 + BIO_set_tcp_ndelay @102 + BIO_sock_cleanup @103 + BIO_sock_error @104 + BIO_sock_init @105 + BIO_sock_non_fatal_error @106 + BIO_sock_should_retry @107 + BIO_socket_ioctl @108 + BIO_write @109 + BN_BLINDING_convert @973 + BN_BLINDING_free @981 + BN_BLINDING_invert @974 + BN_BLINDING_new @980 + BN_BLINDING_update @975 + BN_CTX_free @110 + BN_CTX_new @111 + BN_MONT_CTX_free @112 + BN_MONT_CTX_new @113 + BN_MONT_CTX_set @114 + BN_add @115 + BN_add_word @116 + BN_bin2bn @118 + BN_bn2bin @120 + BN_bn2dec @1002 + BN_bn2hex @119 + BN_bn2mpi @1058 + BN_clear @121 + BN_clear_bit @122 + BN_clear_free @123 + BN_cmp @124 + BN_copy @125 + BN_dec2bn @1001 + BN_div @126 + BN_div_word @127 + BN_dup @128 + BN_exp @998 + BN_free @129 + BN_from_montgomery @130 + BN_gcd @131 + BN_generate_prime @132 + BN_get_word @133 + BN_hex2bn @117 + BN_is_bit_set @134 + BN_is_prime @135 + BN_lshift @136 + BN_lshift1 @137 + BN_mask_bits @138 + BN_mod @139 + BN_mod_exp @140 + BN_mod_exp_mont @141 + BN_mod_exp_recp @142 + BN_mod_exp_simple @143 + BN_mod_inverse @144 + BN_mod_mul @145 + BN_mod_mul_montgomery @146 + BN_mod_mul_reciprocal @147 + BN_mod_word @148 + BN_mpi2bn @1059 + BN_mul @149 + BN_mul_word @999 + BN_new @150 + BN_num_bits @151 + BN_num_bits_word @152 + BN_options @153 + BN_print @154 + BN_print_fp @155 + BN_rand @156 + BN_reciprocal @157 + BN_rshift @158 + BN_rshift1 @159 + BN_set_bit @160 + BN_set_word @161 + BN_sqr @162 + BN_sub @163 + BN_sub_word @1000 + BN_to_ASN1_INTEGER @164 + BN_ucmp @165 + BN_value_one @166 + BUF_MEM_free @167 + BUF_MEM_grow @168 + BUF_MEM_new @169 + BUF_strdup @170 + CAST_cbc_encrypt @992 + CAST_cfb64_encrypt @993 + CAST_decrypt @990 + CAST_ecb_encrypt @991 + CAST_encrypt @989 + CAST_ofb64_encrypt @994 + CAST_set_key @988 + CONF_free @171 + CONF_get_number @172 + CONF_get_section @173 + CONF_get_string @174 + CONF_load @175 + CRYPTO_add_lock @176 + CRYPTO_dbg_free @177 + CRYPTO_dbg_malloc @178 + CRYPTO_dbg_realloc @179 + CRYPTO_dbg_remalloc @180 + CRYPTO_dup_ex_data @1025 + CRYPTO_free @181 + CRYPTO_free_ex_data @1004 + CRYPTO_get_add_lock_callback @182 + CRYPTO_get_ex_data @1005 + CRYPTO_get_ex_new_index @1041 + CRYPTO_get_id_callback @183 + CRYPTO_get_lock_name @184 + CRYPTO_get_locking_callback @185 + CRYPTO_get_mem_functions @186 + CRYPTO_get_new_lockid @1026 + CRYPTO_lock @187 + CRYPTO_malloc @188 + CRYPTO_mem_ctrl @189 + CRYPTO_mem_leaks @190 + CRYPTO_mem_leaks_cb @191 + CRYPTO_mem_leaks_fp @192 + CRYPTO_new_ex_data @1027 + CRYPTO_realloc @193 + CRYPTO_remalloc @194 + CRYPTO_set_add_lock_callback @195 + CRYPTO_set_ex_data @1007 + CRYPTO_set_id_callback @196 + CRYPTO_set_locking_callback @197 + CRYPTO_set_mem_functions @198 + CRYPTO_thread_id @199 + DH_check @200 + DH_compute_key @201 + DH_free @202 + DH_generate_key @203 + DH_generate_parameters @204 + DH_new @205 + DH_size @206 + DHparams_print @207 + DHparams_print_fp @208 + DSA_free @209 + DSA_generate_key @210 + DSA_generate_parameters @211 + DSA_is_prime @212 + DSA_new @213 + DSA_print @214 + DSA_print_fp @215 + DSA_sign @216 + DSA_sign_setup @217 + DSA_size @218 + DSA_verify @219 + DSAparams_print @220 + DSAparams_print_fp @221 + ERR_add_error_data @1081 + ERR_clear_error @222 + ERR_error_string @223 + ERR_free_strings @224 + ERR_func_error_string @225 + ERR_get_err_state_table @226 + ERR_get_error @227 + ERR_get_error_line @228 + ERR_get_next_error_library @966 + ERR_get_state @229 + ERR_get_string_table @230 + ERR_lib_error_string @231 + ERR_load_ASN1_strings @232 + ERR_load_BIO_strings @233 + ERR_load_BN_strings @234 + ERR_load_BUF_strings @235 + ERR_load_CONF_strings @236 + ERR_load_CRYPTO_strings @1009 + ERR_load_DH_strings @237 + ERR_load_DSA_strings @238 + ERR_load_ERR_strings @239 + ERR_load_EVP_strings @240 + ERR_load_OBJ_strings @241 + ERR_load_PEM_strings @242 + ERR_load_PKCS7_strings @919 + ERR_load_RSA_strings @244 + ERR_load_X509_strings @245 + ERR_load_crypto_strings @246 + ERR_load_strings @247 + ERR_peek_error @248 + ERR_peek_error_line @249 + ERR_print_errors @250 + ERR_print_errors_fp @251 + ERR_put_error @252 + ERR_reason_error_string @253 + ERR_remove_state @254 + ERR_set_error_data @1082 + EVP_BytesToKey @255 + EVP_CIPHER_CTX_cleanup @256 + EVP_CIPHER_CTX_init @961 + EVP_CIPHER_asn1_to_param @1083 + EVP_CIPHER_get_asn1_iv @1085 + EVP_CIPHER_param_to_asn1 @1084 + EVP_CIPHER_set_asn1_iv @1086 + EVP_CipherFinal @257 + EVP_CipherInit @258 + EVP_CipherUpdate @259 + EVP_DecodeBlock @260 + EVP_DecodeFinal @261 + EVP_DecodeInit @262 + EVP_DecodeUpdate @263 + EVP_DecryptFinal @264 + EVP_DecryptInit @265 + EVP_DecryptUpdate @266 + EVP_DigestFinal @267 + EVP_DigestInit @268 + EVP_DigestUpdate @269 + EVP_EncodeBlock @270 + EVP_EncodeFinal @271 + EVP_EncodeInit @272 + EVP_EncodeUpdate @273 + EVP_EncryptFinal @274 + EVP_EncryptInit @275 + EVP_EncryptUpdate @276 + EVP_OpenFinal @277 + EVP_OpenInit @278 + EVP_PKEY_assign @279 + EVP_PKEY_bits @1010 + EVP_PKEY_cmp_parameters @967 + EVP_PKEY_copy_parameters @280 + EVP_PKEY_decrypt @1070 + EVP_PKEY_encrypt @1071 + EVP_PKEY_free @281 + EVP_PKEY_missing_parameters @282 + EVP_PKEY_new @283 + EVP_PKEY_save_parameters @284 + EVP_PKEY_size @285 + EVP_PKEY_type @286 + EVP_SealFinal @287 + EVP_SealInit @288 + EVP_SignFinal @289 + EVP_VerifyFinal @290 + EVP_add_alias @291 + EVP_add_cipher @292 + EVP_add_digest @293 + EVP_bf_cbc @294 + EVP_bf_cfb @295 + EVP_bf_ecb @296 + EVP_bf_ofb @297 + EVP_cast5_cbc @983 + EVP_cast5_cfb @984 + EVP_cast5_ecb @985 + EVP_cast5_ofb @986 + EVP_cleanup @298 + EVP_delete_alias @941 + EVP_des_cbc @299 + EVP_des_cfb @300 + EVP_des_ecb @301 + EVP_des_ede @302 + EVP_des_ede3 @303 + EVP_des_ede3_cbc @304 + EVP_des_ede3_cfb @305 + EVP_des_ede3_ofb @306 + EVP_des_ede_cbc @307 + EVP_des_ede_cfb @308 + EVP_des_ede_ofb @309 + EVP_des_ofb @310 + EVP_desx_cbc @311 + EVP_dss @312 + EVP_dss1 @313 + EVP_enc_null @314 + EVP_get_cipherbyname @315 + EVP_get_digestbyname @316 + EVP_get_pw_prompt @317 + EVP_idea_cbc @318 + EVP_idea_cfb @319 + EVP_idea_ecb @320 + EVP_idea_ofb @321 + EVP_md2 @322 + EVP_md5 @323 + EVP_md_null @324 + EVP_mdc2 @942 + EVP_rc2_40_cbc @959 + EVP_rc2_cbc @325 + EVP_rc2_cfb @326 + EVP_rc2_ecb @327 + EVP_rc2_ofb @328 + EVP_rc4 @329 + EVP_rc4_40 @960 + EVP_rc5_32_12_16_cbc @1087 + EVP_rc5_32_12_16_cfb @1088 + EVP_rc5_32_12_16_ecb @1089 + EVP_rc5_32_12_16_ofb @1090 + EVP_read_pw_string @330 + EVP_set_pw_prompt @331 + EVP_sha @332 + EVP_sha1 @333 + HMAC @962 + HMAC_Final @965 + HMAC_Init @963 + HMAC_Update @964 + HMAC_cleanup @968 + MD2 @334 + MD2_Final @335 + MD2_Init @336 + MD2_Update @337 + MD2_options @338 + MD5 @339 + MD5_Final @340 + MD5_Init @341 + MD5_Transform @1011 + MD5_Update @342 + MDC2 @343 + MDC2_Final @344 + MDC2_Init @345 + MDC2_Update @346 + NETSCAPE_SPKAC_free @347 + NETSCAPE_SPKAC_new @348 + NETSCAPE_SPKI_free @349 + NETSCAPE_SPKI_new @350 + NETSCAPE_SPKI_sign @351 + NETSCAPE_SPKI_verify @352 + OBJ_add_object @353 + OBJ_bsearch @354 + OBJ_cleanup @355 + OBJ_cmp @356 + OBJ_create @357 + OBJ_create_objects @997 + OBJ_dup @358 + OBJ_ln2nid @359 + OBJ_new_nid @360 + OBJ_nid2ln @361 + OBJ_nid2obj @362 + OBJ_nid2sn @363 + OBJ_obj2nid @364 + OBJ_sn2nid @365 + OBJ_txt2nid @366 + PEM_ASN1_read @367 + PEM_ASN1_read_bio @368 + PEM_ASN1_write @369 + PEM_ASN1_write_bio @370 + PEM_SealFinal @371 + PEM_SealInit @372 + PEM_SealUpdate @373 + PEM_SignFinal @374 + PEM_X509_INFO_read @377 + PEM_X509_INFO_read_bio @378 + PEM_X509_INFO_write_bio @379 + PEM_dek_info @380 + PEM_do_header @381 + PEM_get_EVP_CIPHER_INFO @382 + PEM_proc_type @383 + PEM_read @384 + PEM_read_DHparams @385 + PEM_read_DSAPrivateKey @386 + PEM_read_DSAparams @387 + PEM_read_PKCS7 @388 + PEM_read_PrivateKey @389 + PEM_read_RSAPrivateKey @390 + PEM_read_RSAPublicKey @947 + PEM_read_X509 @391 + PEM_read_X509_CRL @392 + PEM_read_X509_REQ @393 + PEM_read_bio @394 + PEM_read_bio_DHparams @395 + PEM_read_bio_DSAPrivateKey @396 + PEM_read_bio_DSAparams @397 + PEM_read_bio_PKCS7 @398 + PEM_read_bio_PrivateKey @399 + PEM_read_bio_RSAPrivateKey @400 + PEM_read_bio_RSAPublicKey @943 + PEM_read_bio_X509 @401 + PEM_read_bio_X509_CRL @402 + PEM_read_bio_X509_REQ @403 + PEM_write @404 + PEM_write_DHparams @405 + PEM_write_DSAPrivateKey @406 + PEM_write_DSAparams @407 + PEM_write_PKCS7 @408 + PEM_write_PrivateKey @409 + PEM_write_RSAPrivateKey @410 + PEM_write_RSAPublicKey @949 + PEM_write_X509 @411 + PEM_write_X509_CRL @412 + PEM_write_X509_REQ @413 + PEM_write_bio @414 + PEM_write_bio_DHparams @415 + PEM_write_bio_DSAPrivateKey @416 + PEM_write_bio_DSAparams @417 + PEM_write_bio_PKCS7 @418 + PEM_write_bio_PrivateKey @419 + PEM_write_bio_RSAPrivateKey @420 + PEM_write_bio_RSAPublicKey @944 + PEM_write_bio_X509 @421 + PEM_write_bio_X509_CRL @422 + PEM_write_bio_X509_REQ @423 + PKCS7_DIGEST_free @424 + PKCS7_DIGEST_new @425 + PKCS7_ENCRYPT_free @426 + PKCS7_ENCRYPT_new @427 + PKCS7_ENC_CONTENT_free @428 + PKCS7_ENC_CONTENT_new @429 + PKCS7_ENVELOPE_free @430 + PKCS7_ENVELOPE_new @431 + PKCS7_ISSUER_AND_SERIAL_digest @432 + PKCS7_ISSUER_AND_SERIAL_free @433 + PKCS7_ISSUER_AND_SERIAL_new @434 + PKCS7_RECIP_INFO_free @435 + PKCS7_RECIP_INFO_new @436 + PKCS7_RECIP_INFO_set @1072 + PKCS7_SIGNED_free @437 + PKCS7_SIGNED_new @438 + PKCS7_SIGNER_INFO_free @439 + PKCS7_SIGNER_INFO_new @440 + PKCS7_SIGNER_INFO_set @930 + PKCS7_SIGN_ENVELOPE_free @441 + PKCS7_SIGN_ENVELOPE_new @442 + PKCS7_add_certificate @932 + PKCS7_add_crl @933 + PKCS7_add_recipient @1073 + PKCS7_add_recipient_info @1074 + PKCS7_add_signature @938 + PKCS7_add_signer @931 + PKCS7_cert_from_signer_info @939 + PKCS7_content_free @918 + PKCS7_content_new @934 + PKCS7_ctrl @927 + PKCS7_dataInit @937 + PKCS7_dataSign @935 + PKCS7_dataVerify @936 + PKCS7_dup @443 + PKCS7_free @444 + PKCS7_get_signer_info @940 + PKCS7_new @445 + PKCS7_set_cipher @1075 + PKCS7_set_content @929 + PKCS7_set_type @928 + RAND_bytes @464 + RAND_cleanup @465 + RAND_file_name @466 + RAND_load_file @467 + RAND_screen @468 + RAND_seed @469 + RAND_write_file @470 + RC2_cbc_encrypt @471 + RC2_cfb64_encrypt @472 + RC2_decrypt @995 + RC2_ecb_encrypt @473 + RC2_encrypt @474 + RC2_ofb64_encrypt @475 + RC2_set_key @476 + RC4 @477 + RC4_options @478 + RC4_set_key @479 + RC5_32_cbc_encrypt @1051 + RC5_32_cfb64_encrypt @1052 + RC5_32_decrypt @1050 + RC5_32_ecb_encrypt @1048 + RC5_32_encrypt @1049 + RC5_32_ofb64_encrypt @1053 + RC5_32_set_key @1047 + RIPEMD160 @1045 + RIPEMD160_Final @1044 + RIPEMD160_Init @1042 + RIPEMD160_Transform @1046 + RIPEMD160_Update @1043 + RSAPrivateKey_asn1_meth @480 + RSAPrivateKey_dup @481 + RSAPublicKey_dup @482 + RSA_PKCS1_SSLeay @483 + RSA_blinding_off @978 + RSA_blinding_on @977 + RSA_flags @956 + RSA_free @484 + RSA_generate_key @485 + RSA_get_ex_data @1029 + RSA_get_ex_new_index @1030 + RSA_new @486 + RSA_new_method @487 + RSA_padding_add_PKCS1_type_1 @1031 + RSA_padding_add_PKCS1_type_2 @1032 + RSA_padding_add_SSLv23 @1033 + RSA_padding_add_none @1034 + RSA_padding_check_PKCS1_type_1 @1035 + RSA_padding_check_PKCS1_type_2 @1036 + RSA_padding_check_SSLv23 @1037 + RSA_padding_check_none @1038 + RSA_print @488 + RSA_print_fp @489 + RSA_private_decrypt @490 + RSA_private_encrypt @491 + RSA_public_decrypt @492 + RSA_public_encrypt @493 + RSA_set_default_method @494 + RSA_set_ex_data @1028 + RSA_sign @495 + RSA_sign_ASN1_OCTET_STRING @496 + RSA_size @497 + RSA_verify @498 + RSA_verify_ASN1_OCTET_STRING @499 + SHA @500 + SHA1 @501 + SHA1_Final @502 + SHA1_Init @503 + SHA1_Transform @1012 + SHA1_Update @504 + SHA_Final @505 + SHA_Init @506 + SHA_Transform @1013 + SHA_Update @507 + TXT_DB_create_index @511 + TXT_DB_free @512 + TXT_DB_get_by_index @513 + TXT_DB_insert @514 + TXT_DB_read @515 + TXT_DB_write @516 + X509_ALGOR_free @517 + X509_ALGOR_new @518 + X509_ATTRIBUTE_free @519 + X509_ATTRIBUTE_new @520 + X509_CINF_free @521 + X509_CINF_new @522 + X509_CRL_INFO_free @523 + X509_CRL_INFO_new @524 + X509_CRL_add_ext @525 + X509_CRL_cmp @526 + X509_CRL_delete_ext @527 + X509_CRL_dup @528 + X509_CRL_free @529 + X509_CRL_get_ext @530 + X509_CRL_get_ext_by_NID @531 + X509_CRL_get_ext_by_OBJ @532 + X509_CRL_get_ext_by_critical @533 + X509_CRL_get_ext_count @534 + X509_CRL_new @535 + X509_CRL_sign @536 + X509_CRL_verify @537 + X509_EXTENSION_create_by_NID @538 + X509_EXTENSION_create_by_OBJ @539 + X509_EXTENSION_dup @540 + X509_EXTENSION_free @541 + X509_EXTENSION_get_critical @542 + X509_EXTENSION_get_data @543 + X509_EXTENSION_get_object @544 + X509_EXTENSION_new @545 + X509_EXTENSION_set_critical @546 + X509_EXTENSION_set_data @547 + X509_EXTENSION_set_object @548 + X509_INFO_free @549 + X509_INFO_new @550 + X509_LOOKUP_by_alias @551 + X509_LOOKUP_by_fingerprint @552 + X509_LOOKUP_by_issuer_serial @553 + X509_LOOKUP_by_subject @554 + X509_LOOKUP_ctrl @555 + X509_LOOKUP_file @556 + X509_LOOKUP_free @557 + X509_LOOKUP_hash_dir @558 + X509_LOOKUP_init @559 + X509_LOOKUP_new @560 + X509_LOOKUP_shutdown @561 + X509_NAME_ENTRY_create_by_NID @562 + X509_NAME_ENTRY_create_by_OBJ @563 + X509_NAME_ENTRY_dup @564 + X509_NAME_ENTRY_free @565 + X509_NAME_ENTRY_get_data @566 + X509_NAME_ENTRY_get_object @567 + X509_NAME_ENTRY_new @568 + X509_NAME_ENTRY_set_data @569 + X509_NAME_ENTRY_set_object @570 + X509_NAME_add_entry @571 + X509_NAME_cmp @572 + X509_NAME_delete_entry @573 + X509_NAME_digest @574 + X509_NAME_dup @575 + X509_NAME_entry_count @576 + X509_NAME_free @577 + X509_NAME_get_entry @578 + X509_NAME_get_index_by_NID @579 + X509_NAME_get_index_by_OBJ @580 + X509_NAME_get_text_by_NID @581 + X509_NAME_get_text_by_OBJ @582 + X509_NAME_hash @583 + X509_NAME_new @584 + X509_NAME_oneline @585 + X509_NAME_print @586 + X509_NAME_set @587 + X509_OBJECT_free_contents @588 + X509_OBJECT_retrive_by_subject @589 + X509_OBJECT_up_ref_count @590 + X509_PKEY_free @591 + X509_PKEY_new @592 + X509_PUBKEY_free @593 + X509_PUBKEY_get @594 + X509_PUBKEY_new @595 + X509_PUBKEY_set @596 + X509_REQ_INFO_free @597 + X509_REQ_INFO_new @598 + X509_REQ_dup @599 + X509_REQ_free @600 + X509_REQ_get_pubkey @601 + X509_REQ_new @602 + X509_REQ_print @603 + X509_REQ_print_fp @604 + X509_REQ_set_pubkey @605 + X509_REQ_set_subject_name @606 + X509_REQ_set_version @607 + X509_REQ_sign @608 + X509_REQ_to_X509 @609 + X509_REQ_verify @610 + X509_REVOKED_add_ext @611 + X509_REVOKED_delete_ext @612 + X509_REVOKED_free @613 + X509_REVOKED_get_ext @614 + X509_REVOKED_get_ext_by_NID @615 + X509_REVOKED_get_ext_by_OBJ @616 + X509_REVOKED_get_ext_by_critical @617 + X509_REVOKED_get_ext_count @618 + X509_REVOKED_new @619 + X509_SIG_free @620 + X509_SIG_new @621 + X509_STORE_CTX_cleanup @622 + X509_STORE_CTX_get_chain @1014 + X509_STORE_CTX_get_current_cert @1015 + X509_STORE_CTX_get_error @1016 + X509_STORE_CTX_get_error_depth @1017 + X509_STORE_CTX_get_ex_data @1018 + X509_STORE_CTX_init @623 + X509_STORE_CTX_set_cert @1020 + X509_STORE_CTX_set_chain @1021 + X509_STORE_CTX_set_error @1022 + X509_STORE_CTX_set_ex_data @1023 + X509_STORE_add_cert @624 + X509_STORE_add_crl @957 + X509_STORE_add_lookup @625 + X509_STORE_free @626 + X509_STORE_get_by_subject @627 + X509_STORE_load_locations @628 + X509_STORE_new @629 + X509_STORE_set_default_paths @630 + X509_VAL_free @631 + X509_VAL_new @632 + X509_add_ext @633 + X509_asn1_meth @634 + X509_certificate_type @635 + X509_check_private_key @636 + X509_cmp_current_time @637 + X509_delete_ext @638 + X509_digest @639 + X509_dup @640 + X509_find_by_issuer_and_serial @920 + X509_find_by_subject @921 + X509_free @641 + X509_get_default_cert_area @642 + X509_get_default_cert_dir @643 + X509_get_default_cert_dir_env @644 + X509_get_default_cert_file @645 + X509_get_default_cert_file_env @646 + X509_get_default_private_dir @647 + X509_get_ext @648 + X509_get_ext_by_NID @649 + X509_get_ext_by_OBJ @650 + X509_get_ext_by_critical @651 + X509_get_ext_count @652 + X509_get_issuer_name @653 + X509_get_pubkey @654 + X509_get_pubkey_parameters @655 + X509_get_serialNumber @656 + X509_get_subject_name @657 + X509_gmtime_adj @658 + X509_issuer_and_serial_cmp @659 + X509_issuer_and_serial_hash @660 + X509_issuer_name_cmp @661 + X509_issuer_name_hash @662 + X509_load_cert_file @663 + X509_load_crl_file @958 + X509_new @664 + X509_print @665 + X509_print_fp @666 + X509_set_issuer_name @667 + X509_set_notAfter @668 + X509_set_notBefore @669 + X509_set_pubkey @670 + X509_set_serialNumber @671 + X509_set_subject_name @672 + X509_set_version @673 + X509_sign @674 + X509_subject_name_cmp @675 + X509_subject_name_hash @676 + X509_to_X509_REQ @677 + X509_verify @678 + X509_verify_cert @679 + X509_verify_cert_error_string @680 + X509v3_add_ext @681 + X509v3_add_extension @682 + X509v3_add_netscape_extensions @683 + X509v3_add_standard_extensions @684 + X509v3_cleanup_extensions @685 + X509v3_data_type_by_NID @686 + X509v3_data_type_by_OBJ @687 + X509v3_delete_ext @688 + X509v3_get_ext @689 + X509v3_get_ext_by_NID @690 + X509v3_get_ext_by_OBJ @691 + X509v3_get_ext_by_critical @692 + X509v3_get_ext_count @693 + X509v3_pack_string @694 + X509v3_pack_type_by_NID @695 + X509v3_pack_type_by_OBJ @696 + X509v3_unpack_string @697 + a2d_ASN1_OBJECT @699 + a2i_ASN1_INTEGER @700 + a2i_ASN1_STRING @701 + asn1_Finish @702 + asn1_GetSequence @703 + asn1_add_error @1091 + bn_add_words @1039 + bn_div64 @704 + bn_expand2 @705 + bn_mul_add_words @706 + bn_mul_words @707 + bn_qadd @708 + bn_qsub @709 + bn_sqr_words @710 + crypt @711 + d2i_ASN1_BIT_STRING @712 + d2i_ASN1_BOOLEAN @713 + d2i_ASN1_HEADER @714 + d2i_ASN1_IA5STRING @715 + d2i_ASN1_INTEGER @716 + d2i_ASN1_OBJECT @717 + d2i_ASN1_OCTET_STRING @718 + d2i_ASN1_PRINTABLE @719 + d2i_ASN1_PRINTABLESTRING @720 + d2i_ASN1_SET @721 + d2i_ASN1_T61STRING @722 + d2i_ASN1_TYPE @723 + d2i_ASN1_UTCTIME @724 + d2i_ASN1_bytes @725 + d2i_ASN1_type_bytes @726 + d2i_DHparams @727 + d2i_DSAPrivateKey @728 + d2i_DSAPrivateKey_bio @729 + d2i_DSAPrivateKey_fp @730 + d2i_DSAPublicKey @731 + d2i_DSAparams @732 + d2i_NETSCAPE_SPKAC @733 + d2i_NETSCAPE_SPKI @734 + d2i_Netscape_RSA @735 + d2i_Netscape_RSA_2 @1040 + d2i_PKCS7 @736 + d2i_PKCS7_DIGEST @737 + d2i_PKCS7_ENCRYPT @738 + d2i_PKCS7_ENC_CONTENT @739 + d2i_PKCS7_ENVELOPE @740 + d2i_PKCS7_ISSUER_AND_SERIAL @741 + d2i_PKCS7_RECIP_INFO @742 + d2i_PKCS7_SIGNED @743 + d2i_PKCS7_SIGNER_INFO @744 + d2i_PKCS7_SIGN_ENVELOPE @745 + d2i_PKCS7_bio @746 + d2i_PKCS7_fp @747 + d2i_PrivateKey @748 + d2i_PublicKey @749 + d2i_RSAPrivateKey @750 + d2i_RSAPrivateKey_bio @751 + d2i_RSAPrivateKey_fp @752 + d2i_RSAPublicKey @753 + d2i_RSAPublicKey_bio @945 + d2i_RSAPublicKey_fp @952 + d2i_X509 @754 + d2i_X509_ALGOR @755 + d2i_X509_ATTRIBUTE @756 + d2i_X509_CINF @757 + d2i_X509_CRL @758 + d2i_X509_CRL_INFO @759 + d2i_X509_CRL_bio @760 + d2i_X509_CRL_fp @761 + d2i_X509_EXTENSION @762 + d2i_X509_NAME @763 + d2i_X509_NAME_ENTRY @764 + d2i_X509_PKEY @765 + d2i_X509_PUBKEY @766 + d2i_X509_REQ @767 + d2i_X509_REQ_INFO @768 + d2i_X509_REQ_bio @769 + d2i_X509_REQ_fp @770 + d2i_X509_REVOKED @771 + d2i_X509_SIG @772 + d2i_X509_VAL @773 + d2i_X509_bio @774 + d2i_X509_fp @775 + des_cbc_cksum @777 + des_cbc_encrypt @778 + des_cblock_print_file @779 + des_cfb64_encrypt @780 + des_cfb_encrypt @781 + des_decrypt3 @782 + des_ecb3_encrypt @783 + des_ecb_encrypt @784 + des_ede3_cbc_encrypt @785 + des_ede3_cfb64_encrypt @786 + des_ede3_ofb64_encrypt @787 + des_enc_read @788 + des_enc_write @789 + des_encrypt @790 + des_encrypt2 @791 + des_encrypt3 @792 + des_fcrypt @793 + des_is_weak_key @794 + des_key_sched @795 + des_ncbc_encrypt @796 + des_ofb64_encrypt @797 + des_ofb_encrypt @798 + des_options @799 + des_pcbc_encrypt @800 + des_quad_cksum @801 + des_random_key @802 + des_random_seed @803 + des_read_2passwords @804 + des_read_password @805 + des_read_pw @806 + des_read_pw_string @807 + des_set_key @808 + des_set_odd_parity @809 + des_string_to_2keys @810 + des_string_to_key @811 + des_xcbc_encrypt @812 + des_xwhite_in2out @813 + i2a_ASN1_INTEGER @815 + i2a_ASN1_OBJECT @816 + i2a_ASN1_STRING @817 + i2d_ASN1_BIT_STRING @818 + i2d_ASN1_BOOLEAN @819 + i2d_ASN1_HEADER @820 + i2d_ASN1_IA5STRING @821 + i2d_ASN1_INTEGER @822 + i2d_ASN1_OBJECT @823 + i2d_ASN1_OCTET_STRING @824 + i2d_ASN1_PRINTABLE @825 + i2d_ASN1_SET @826 + i2d_ASN1_TYPE @827 + i2d_ASN1_UTCTIME @828 + i2d_ASN1_bytes @829 + i2d_DHparams @830 + i2d_DSAPrivateKey @831 + i2d_DSAPrivateKey_bio @832 + i2d_DSAPrivateKey_fp @833 + i2d_DSAPublicKey @834 + i2d_DSAparams @835 + i2d_NETSCAPE_SPKAC @836 + i2d_NETSCAPE_SPKI @837 + i2d_Netscape_RSA @838 + i2d_PKCS7 @839 + i2d_PKCS7_DIGEST @840 + i2d_PKCS7_ENCRYPT @841 + i2d_PKCS7_ENC_CONTENT @842 + i2d_PKCS7_ENVELOPE @843 + i2d_PKCS7_ISSUER_AND_SERIAL @844 + i2d_PKCS7_RECIP_INFO @845 + i2d_PKCS7_SIGNED @846 + i2d_PKCS7_SIGNER_INFO @847 + i2d_PKCS7_SIGN_ENVELOPE @848 + i2d_PKCS7_bio @849 + i2d_PKCS7_fp @850 + i2d_PrivateKey @851 + i2d_PublicKey @852 + i2d_RSAPrivateKey @853 + i2d_RSAPrivateKey_bio @854 + i2d_RSAPrivateKey_fp @855 + i2d_RSAPublicKey @856 + i2d_RSAPublicKey_bio @946 + i2d_RSAPublicKey_fp @954 + i2d_X509 @857 + i2d_X509_ALGOR @858 + i2d_X509_ATTRIBUTE @859 + i2d_X509_CINF @860 + i2d_X509_CRL @861 + i2d_X509_CRL_INFO @862 + i2d_X509_CRL_bio @863 + i2d_X509_CRL_fp @864 + i2d_X509_EXTENSION @865 + i2d_X509_NAME @866 + i2d_X509_NAME_ENTRY @867 + i2d_X509_PKEY @868 + i2d_X509_PUBKEY @869 + i2d_X509_REQ @870 + i2d_X509_REQ_INFO @871 + i2d_X509_REQ_bio @872 + i2d_X509_REQ_fp @873 + i2d_X509_REVOKED @874 + i2d_X509_SIG @875 + i2d_X509_VAL @876 + i2d_X509_bio @877 + i2d_X509_fp @878 + i2t_ASN1_OBJECT @979 + idea_cbc_encrypt @879 + idea_cfb64_encrypt @880 + idea_ecb_encrypt @881 + idea_encrypt @882 + idea_ofb64_encrypt @883 + idea_options @884 + idea_set_decrypt_key @885 + idea_set_encrypt_key @886 + lh_delete @887 + lh_doall @888 + lh_doall_arg @889 + lh_free @890 + lh_insert @891 + lh_new @892 + lh_node_stats @893 + lh_node_stats_bio @894 + lh_node_usage_stats @895 + lh_node_usage_stats_bio @896 + lh_retrieve @897 + lh_stats @898 + lh_stats_bio @899 + lh_strhash @900 + sk_delete @901 + sk_delete_ptr @902 + sk_dup @903 + sk_find @904 + sk_free @905 + sk_insert @906 + sk_new @907 + sk_pop @908 + sk_pop_free @909 + sk_push @910 + sk_set_cmp_func @911 + sk_shift @912 + sk_unshift @913 + sk_zero @914 + diff --git a/src/lib/libssl/src/ms/ntdll.mak b/src/lib/libssl/src/ms/ntdll.mak new file mode 100644 index 0000000000..044cd909bc --- /dev/null +++ b/src/lib/libssl/src/ms/ntdll.mak @@ -0,0 +1,1853 @@ +# This makefile has been automatically generated from the SSLeay distribution. +# This single makefile will build the complete SSLeay distribution and +# by default leave the 'intertesting' output files in .\out and the stuff +# that needs deleting in .\tmp. +# The file was generated by running 'make makefile.one', which +# does a 'make files', which writes all the environment variables from all +# the makefiles to the file call MINFO. This file is used by +# util\mk1mf.pl to generate makefile.one. +# The 'makefile per directory' system suites me when developing this +# library and also so I can 'distribute' indervidual library sections. +# The one monster makefile better suits building in non-unix +# environments. + +INSTALLTOP=\usr\local\ssl + +# Set your compiler options +CC=cl +CFLAG= /MD /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DWIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM +APP_CFLAG= +LIB_CFLAG= /GD -D_WINDLL -D_DLL +SHLIB_CFLAG= +APP_EX_OBJ=setargv.obj +SHLIB_EX_OBJ= +# add extra libraries to this define, for solaris -lsocket -lnsl would +# be added +EX_LIBS=wsock32.lib user32.lib gdi32.lib + +# The SSLeay directory +SRC_D=. + +LINK=link +LFLAGS=/nologo /subsystem:console /machine:I386 /opt:ref + +BN_MULW_OBJ=crypto\bn\asm\bn-win32.obj +BN_MULW_SRC=crypto\bn\asm\bn-win32.asm +DES_ENC_OBJ=crypto\des\asm\d-win32.obj crypto\des\asm\y-win32.obj +DES_ENC_SRC=crypto\des\asm\d-win32.asm crypto\des\asm\y-win32.asm +DES_CRYPT_OBJ= +DES_CRYPT_SRC= +BF_ENC_OBJ=crypto\bf\asm\b-win32.obj +BF_ENC_SRC=crypto\bf\asm\b-win32.asm +CAST_ENC_OBJ=crypto\cast\asm\c-win32.obj +CAST_ENC_SRC=crypto\cast\asm\c-win32.asm +RC4_ENC_OBJ=crypto\rc4\asm\r4-win32.obj +RC4_ENC_SRC=crypto\rc4\asm\r4-win32.asm +RC5_ENC_OBJ=crypto\rc5\asm\r5-win32.obj +RC5_ENC_SRC=crypto\rc5\asm\r5-win32.asm +MD5_ASM_OBJ=crypto\md5\asm\m5-win32.obj +MD5_ASM_SRC=crypto\md5\asm\m5-win32.asm +SHA1_ASM_OBJ=crypto\sha\asm\s1-win32.obj +SHA1_ASM_SRC=crypto\sha\asm\s1-win32.asm +RMD160_ASM_OBJ=crypto\ripemd\asm\rm-win32.obj +RMD160_ASM_SRC=crypto\ripemd\asm\rm-win32.asm + +# The output directory for everything intersting +OUT_D=out32dll +# The output directory for all the temporary muck +TMP_D=tmp32dll +# The output directory for the header files +INC_D=inc32 + +CP=copy +RM=del +RANLIB= +MKDIR=mkdir +MKLIB=lib +MLFLAGS= /nologo /subsystem:console /machine:I386 /opt:ref /dll +ASM=ml /Cp /coff /c /Cx + +###################################################### +# You should not need to touch anything below this point +###################################################### + +E_EXE=ssleay +SSL=ssleay32 +CRYPTO=libeay32 +RSAGLUE=RSAglue + +# BIN_D - Binary output directory +# TEST_D - Binary test file output directory +# LIB_D - library output directory +BIN_D=$(OUT_D) +TEST_D=$(OUT_D) +LIB_D=$(OUT_D) + +# INCL_D - local library directory +# OBJ_D - temp object file directory +OBJ_D=$(TMP_D) +INCL_D=$(TMP_D) + +O_SSL= $(LIB_D)\$(SSL).dll +O_CRYPTO= $(LIB_D)\$(CRYPTO).dll +O_RSAGLUE= $(LIB_D)\$(RSAGLUE).lib +SO_SSL= $(SSL) +SO_CRYPTO= $(CRYPTO) +L_SSL= $(LIB_D)\$(SSL).lib +L_CRYPTO= $(LIB_D)\$(CRYPTO).lib + +L_LIBS= $(L_SSL) $(L_CRYPTO) +#L_LIBS= $(O_SSL) $(O_RSAGLUE) -lrsaref $(O_CRYPTO) + +###################################################### +# Don't touch anything below this point +###################################################### + +INC=-I$(INC_D) -I$(INCL_D) +APP_CFLAGS=$(INC) $(CFLAG) $(APP_CFLAG) +LIB_CFLAGS=$(INC) $(CFLAG) $(LIB_CFLAG) +SHLIB_CFLAGS=$(INC) $(CFLAG) $(LIB_CFLAG) $(SHLIB_CFLAG) +LIBS_DEP=$(O_CRYPTO) $(O_RSAGLUE) $(O_SSL) + +############################################# +HEADER=$(INCL_D)\cryptlib.h \ + $(INCL_D)\date.h $(INCL_D)\md5_locl.h $(INCL_D)\sha_locl.h \ + $(INCL_D)\rmd_locl.h $(INCL_D)\rmdconst.h $(INCL_D)\des_locl.h \ + $(INCL_D)\rpc_des.h $(INCL_D)\podd.h $(INCL_D)\sk.h \ + $(INCL_D)\spr.h $(INCL_D)\des_ver.h $(INCL_D)\rc2_locl.h \ + $(INCL_D)\rc4_locl.h $(INCL_D)\rc5_locl.h $(INCL_D)\idea_lcl.h \ + $(INCL_D)\bf_pi.h $(INCL_D)\bf_locl.h $(INCL_D)\cast_s.h \ + $(INCL_D)\cast_lcl.h $(INCL_D)\bn_lcl.h $(INCL_D)\bn_prime.h \ + $(INCL_D)\obj_dat.h $(INCL_D)\conf_lcl.h $(INCL_D)\ssl_locl.h \ + $(INCL_D)\rsaref.h $(INCL_D)\apps.h $(INCL_D)\progs.h \ + $(INCL_D)\s_apps.h $(INCL_D)\testdsa.h $(INCL_D)\testrsa.h + +EXHEADER=$(INC_D)\e_os.h \ + $(INC_D)\crypto.h $(INC_D)\cryptall.h $(INC_D)\md2.h \ + $(INC_D)\md5.h $(INC_D)\sha.h $(INC_D)\mdc2.h \ + $(INC_D)\hmac.h $(INC_D)\ripemd.h $(INC_D)\des.h \ + $(INC_D)\rc2.h $(INC_D)\rc4.h $(INC_D)\rc5.h \ + $(INC_D)\idea.h $(INC_D)\blowfish.h $(INC_D)\cast.h \ + $(INC_D)\bn.h $(INC_D)\rsa.h $(INC_D)\dsa.h \ + $(INC_D)\dh.h $(INC_D)\buffer.h $(INC_D)\bio.h \ + $(INC_D)\bss_file.c $(INC_D)\stack.h $(INC_D)\lhash.h \ + $(INC_D)\rand.h $(INC_D)\err.h $(INC_D)\objects.h \ + $(INC_D)\evp.h $(INC_D)\pem.h $(INC_D)\asn1.h \ + $(INC_D)\asn1_mac.h $(INC_D)\x509.h $(INC_D)\x509_vfy.h \ + $(INC_D)\conf.h $(INC_D)\txt_db.h $(INC_D)\pkcs7.h \ + $(INC_D)\ssl.h $(INC_D)\ssl2.h $(INC_D)\ssl3.h \ + $(INC_D)\ssl23.h $(INC_D)\tls1.h + +T_OBJ=$(OBJ_D)\md2test.obj \ + $(OBJ_D)\md5test.obj $(OBJ_D)\shatest.obj $(OBJ_D)\sha1test.obj \ + $(OBJ_D)\mdc2test.obj $(OBJ_D)\hmactest.obj $(OBJ_D)\rmdtest.obj \ + $(OBJ_D)\destest.obj $(OBJ_D)\rc2test.obj $(OBJ_D)\rc4test.obj \ + $(OBJ_D)\rc5test.obj $(OBJ_D)\ideatest.obj $(OBJ_D)\bftest.obj \ + $(OBJ_D)\casttest.obj $(OBJ_D)\bntest.obj $(OBJ_D)\exptest.obj \ + $(OBJ_D)\dsatest.obj $(OBJ_D)\dhtest.obj $(OBJ_D)\randtest.obj \ + $(OBJ_D)\ssltest.obj + +E_OBJ=$(OBJ_D)\verify.obj \ + $(OBJ_D)\asn1pars.obj $(OBJ_D)\req.obj $(OBJ_D)\dgst.obj \ + $(OBJ_D)\dh.obj $(OBJ_D)\enc.obj $(OBJ_D)\gendh.obj \ + $(OBJ_D)\errstr.obj $(OBJ_D)\ca.obj $(OBJ_D)\pkcs7.obj \ + $(OBJ_D)\crl2p7.obj $(OBJ_D)\crl.obj $(OBJ_D)\rsa.obj \ + $(OBJ_D)\dsa.obj $(OBJ_D)\dsaparam.obj $(OBJ_D)\x509.obj \ + $(OBJ_D)\genrsa.obj $(OBJ_D)\s_server.obj $(OBJ_D)\s_client.obj \ + $(OBJ_D)\speed.obj $(OBJ_D)\s_time.obj $(OBJ_D)\apps.obj \ + $(OBJ_D)\s_cb.obj $(OBJ_D)\s_socket.obj $(OBJ_D)\version.obj \ + $(OBJ_D)\sess_id.obj $(OBJ_D)\ciphers.obj $(OBJ_D)\ssleay.obj + +CRYPTOOBJ=$(OBJ_D)\cryptlib.obj \ + $(OBJ_D)\mem.obj $(OBJ_D)\cversion.obj $(OBJ_D)\ex_data.obj \ + $(OBJ_D)\cpt_err.obj $(OBJ_D)\md2_dgst.obj $(OBJ_D)\md2_one.obj \ + $(OBJ_D)\md5_dgst.obj $(MD5_ASM_OBJ) $(OBJ_D)\md5_one.obj \ + $(OBJ_D)\sha_dgst.obj $(OBJ_D)\sha1dgst.obj $(SHA1_ASM_OBJ) \ + $(OBJ_D)\sha_one.obj $(OBJ_D)\sha1_one.obj $(OBJ_D)\mdc2dgst.obj \ + $(OBJ_D)\mdc2_one.obj $(OBJ_D)\hmac.obj $(OBJ_D)\rmd_dgst.obj \ + $(RMD160_ASM_OBJ) $(OBJ_D)\rmd_one.obj $(OBJ_D)\set_key.obj \ + $(OBJ_D)\ecb_enc.obj $(OBJ_D)\cbc_enc.obj $(OBJ_D)\ecb3_enc.obj \ + $(OBJ_D)\cfb64enc.obj $(OBJ_D)\cfb64ede.obj $(OBJ_D)\cfb_enc.obj \ + $(OBJ_D)\ofb64ede.obj $(OBJ_D)\enc_read.obj $(OBJ_D)\enc_writ.obj \ + $(OBJ_D)\ofb64enc.obj $(OBJ_D)\ofb_enc.obj $(OBJ_D)\str2key.obj \ + $(OBJ_D)\pcbc_enc.obj $(OBJ_D)\qud_cksm.obj $(OBJ_D)\rand_key.obj \ + $(DES_ENC_OBJ) $(OBJ_D)\read2pwd.obj $(OBJ_D)\fcrypt.obj \ + $(OBJ_D)\xcbc_enc.obj $(OBJ_D)\read_pwd.obj $(OBJ_D)\rpc_enc.obj \ + $(OBJ_D)\cbc_cksm.obj $(OBJ_D)\supp.obj $(OBJ_D)\rc2_ecb.obj \ + $(OBJ_D)\rc2_skey.obj $(OBJ_D)\rc2_cbc.obj $(OBJ_D)\rc2cfb64.obj \ + $(OBJ_D)\rc2ofb64.obj $(OBJ_D)\rc4_skey.obj $(RC4_ENC_OBJ) \ + $(OBJ_D)\rc5_skey.obj $(OBJ_D)\rc5_ecb.obj $(RC5_ENC_OBJ) \ + $(OBJ_D)\rc5cfb64.obj $(OBJ_D)\rc5ofb64.obj $(OBJ_D)\i_cbc.obj \ + $(OBJ_D)\i_cfb64.obj $(OBJ_D)\i_ofb64.obj $(OBJ_D)\i_ecb.obj \ + $(OBJ_D)\i_skey.obj $(OBJ_D)\bf_skey.obj $(OBJ_D)\bf_ecb.obj \ + $(BF_ENC_OBJ) $(OBJ_D)\bf_cfb64.obj $(OBJ_D)\bf_ofb64.obj \ + $(OBJ_D)\c_skey.obj $(OBJ_D)\c_ecb.obj $(CAST_ENC_OBJ) \ + $(OBJ_D)\c_cfb64.obj $(OBJ_D)\c_ofb64.obj $(OBJ_D)\bn_add.obj \ + $(OBJ_D)\bn_div.obj $(OBJ_D)\bn_exp.obj $(OBJ_D)\bn_lib.obj \ + $(OBJ_D)\bn_mod.obj $(OBJ_D)\bn_mul.obj $(OBJ_D)\bn_print.obj \ + $(OBJ_D)\bn_rand.obj $(OBJ_D)\bn_shift.obj $(OBJ_D)\bn_sub.obj \ + $(OBJ_D)\bn_word.obj $(OBJ_D)\bn_blind.obj $(OBJ_D)\bn_gcd.obj \ + $(OBJ_D)\bn_prime.obj $(OBJ_D)\bn_err.obj $(OBJ_D)\bn_sqr.obj \ + $(BN_MULW_OBJ) $(OBJ_D)\bn_recp.obj $(OBJ_D)\bn_mont.obj \ + $(OBJ_D)\bn_mpi.obj $(OBJ_D)\rsa_eay.obj $(OBJ_D)\rsa_gen.obj \ + $(OBJ_D)\rsa_lib.obj $(OBJ_D)\rsa_sign.obj $(OBJ_D)\rsa_saos.obj \ + $(OBJ_D)\rsa_err.obj $(OBJ_D)\rsa_pk1.obj $(OBJ_D)\rsa_ssl.obj \ + $(OBJ_D)\rsa_none.obj $(OBJ_D)\dsa_gen.obj $(OBJ_D)\dsa_key.obj \ + $(OBJ_D)\dsa_lib.obj $(OBJ_D)\dsa_vrf.obj $(OBJ_D)\dsa_sign.obj \ + $(OBJ_D)\dsa_err.obj $(OBJ_D)\dh_gen.obj $(OBJ_D)\dh_key.obj \ + $(OBJ_D)\dh_lib.obj $(OBJ_D)\dh_check.obj $(OBJ_D)\dh_err.obj \ + $(OBJ_D)\buffer.obj $(OBJ_D)\buf_err.obj $(OBJ_D)\bio_lib.obj \ + $(OBJ_D)\bio_cb.obj $(OBJ_D)\bio_err.obj $(OBJ_D)\bss_mem.obj \ + $(OBJ_D)\bss_null.obj $(OBJ_D)\bss_fd.obj $(OBJ_D)\bss_file.obj \ + $(OBJ_D)\bss_sock.obj $(OBJ_D)\bss_conn.obj $(OBJ_D)\bf_null.obj \ + $(OBJ_D)\bf_buff.obj $(OBJ_D)\b_print.obj $(OBJ_D)\b_dump.obj \ + $(OBJ_D)\b_sock.obj $(OBJ_D)\bss_acpt.obj $(OBJ_D)\bf_nbio.obj \ + $(OBJ_D)\stack.obj $(OBJ_D)\lhash.obj $(OBJ_D)\lh_stats.obj \ + $(OBJ_D)\md_rand.obj $(OBJ_D)\randfile.obj $(OBJ_D)\err.obj \ + $(OBJ_D)\err_all.obj $(OBJ_D)\err_prn.obj $(OBJ_D)\obj_dat.obj \ + $(OBJ_D)\obj_lib.obj $(OBJ_D)\obj_err.obj $(OBJ_D)\encode.obj \ + $(OBJ_D)\digest.obj $(OBJ_D)\evp_enc.obj $(OBJ_D)\evp_key.obj \ + $(OBJ_D)\e_ecb_d.obj $(OBJ_D)\e_cbc_d.obj $(OBJ_D)\e_cfb_d.obj \ + $(OBJ_D)\e_ofb_d.obj $(OBJ_D)\e_ecb_i.obj $(OBJ_D)\e_cbc_i.obj \ + $(OBJ_D)\e_cfb_i.obj $(OBJ_D)\e_ofb_i.obj $(OBJ_D)\e_ecb_3d.obj \ + $(OBJ_D)\e_cbc_3d.obj $(OBJ_D)\e_rc4.obj $(OBJ_D)\names.obj \ + $(OBJ_D)\e_cfb_3d.obj $(OBJ_D)\e_ofb_3d.obj $(OBJ_D)\e_xcbc_d.obj \ + $(OBJ_D)\e_ecb_r2.obj $(OBJ_D)\e_cbc_r2.obj $(OBJ_D)\e_cfb_r2.obj \ + $(OBJ_D)\e_ofb_r2.obj $(OBJ_D)\e_ecb_bf.obj $(OBJ_D)\e_cbc_bf.obj \ + $(OBJ_D)\e_cfb_bf.obj $(OBJ_D)\e_ofb_bf.obj $(OBJ_D)\e_ecb_c.obj \ + $(OBJ_D)\e_cbc_c.obj $(OBJ_D)\e_cfb_c.obj $(OBJ_D)\e_ofb_c.obj \ + $(OBJ_D)\e_ecb_r5.obj $(OBJ_D)\e_cbc_r5.obj $(OBJ_D)\e_cfb_r5.obj \ + $(OBJ_D)\e_ofb_r5.obj $(OBJ_D)\m_null.obj $(OBJ_D)\m_md2.obj \ + $(OBJ_D)\m_md5.obj $(OBJ_D)\m_sha.obj $(OBJ_D)\m_sha1.obj \ + $(OBJ_D)\m_dss.obj $(OBJ_D)\m_dss1.obj $(OBJ_D)\m_mdc2.obj \ + $(OBJ_D)\m_ripemd.obj $(OBJ_D)\p_open.obj $(OBJ_D)\p_seal.obj \ + $(OBJ_D)\p_sign.obj $(OBJ_D)\p_verify.obj $(OBJ_D)\p_lib.obj \ + $(OBJ_D)\p_enc.obj $(OBJ_D)\p_dec.obj $(OBJ_D)\bio_md.obj \ + $(OBJ_D)\bio_b64.obj $(OBJ_D)\bio_enc.obj $(OBJ_D)\evp_err.obj \ + $(OBJ_D)\e_null.obj $(OBJ_D)\c_all.obj $(OBJ_D)\evp_lib.obj \ + $(OBJ_D)\pem_sign.obj $(OBJ_D)\pem_seal.obj $(OBJ_D)\pem_info.obj \ + $(OBJ_D)\pem_lib.obj $(OBJ_D)\pem_all.obj $(OBJ_D)\pem_err.obj \ + $(OBJ_D)\a_object.obj $(OBJ_D)\a_bitstr.obj $(OBJ_D)\a_utctm.obj \ + $(OBJ_D)\a_int.obj $(OBJ_D)\a_octet.obj $(OBJ_D)\a_print.obj \ + $(OBJ_D)\a_type.obj $(OBJ_D)\a_set.obj $(OBJ_D)\a_dup.obj \ + $(OBJ_D)\a_d2i_fp.obj $(OBJ_D)\a_i2d_fp.obj $(OBJ_D)\a_sign.obj \ + $(OBJ_D)\a_digest.obj $(OBJ_D)\a_verify.obj $(OBJ_D)\x_algor.obj \ + $(OBJ_D)\x_val.obj $(OBJ_D)\x_pubkey.obj $(OBJ_D)\x_sig.obj \ + $(OBJ_D)\x_req.obj $(OBJ_D)\x_attrib.obj $(OBJ_D)\x_name.obj \ + $(OBJ_D)\x_cinf.obj $(OBJ_D)\x_x509.obj $(OBJ_D)\x_crl.obj \ + $(OBJ_D)\x_info.obj $(OBJ_D)\x_spki.obj $(OBJ_D)\d2i_r_pr.obj \ + $(OBJ_D)\i2d_r_pr.obj $(OBJ_D)\d2i_r_pu.obj $(OBJ_D)\i2d_r_pu.obj \ + $(OBJ_D)\d2i_s_pr.obj $(OBJ_D)\i2d_s_pr.obj $(OBJ_D)\d2i_s_pu.obj \ + $(OBJ_D)\i2d_s_pu.obj $(OBJ_D)\d2i_pu.obj $(OBJ_D)\d2i_pr.obj \ + $(OBJ_D)\i2d_pu.obj $(OBJ_D)\i2d_pr.obj $(OBJ_D)\t_req.obj \ + $(OBJ_D)\t_x509.obj $(OBJ_D)\t_pkey.obj $(OBJ_D)\p7_i_s.obj \ + $(OBJ_D)\p7_signi.obj $(OBJ_D)\p7_signd.obj $(OBJ_D)\p7_recip.obj \ + $(OBJ_D)\p7_enc_c.obj $(OBJ_D)\p7_evp.obj $(OBJ_D)\p7_dgst.obj \ + $(OBJ_D)\p7_s_e.obj $(OBJ_D)\p7_enc.obj $(OBJ_D)\p7_lib.obj \ + $(OBJ_D)\f_int.obj $(OBJ_D)\f_string.obj $(OBJ_D)\i2d_dhp.obj \ + $(OBJ_D)\i2d_dsap.obj $(OBJ_D)\d2i_dhp.obj $(OBJ_D)\d2i_dsap.obj \ + $(OBJ_D)\n_pkey.obj $(OBJ_D)\a_hdr.obj $(OBJ_D)\x_pkey.obj \ + $(OBJ_D)\a_bool.obj $(OBJ_D)\x_exten.obj $(OBJ_D)\asn1_par.obj \ + $(OBJ_D)\asn1_lib.obj $(OBJ_D)\asn1_err.obj $(OBJ_D)\a_meth.obj \ + $(OBJ_D)\a_bytes.obj $(OBJ_D)\evp_asn1.obj $(OBJ_D)\x509_def.obj \ + $(OBJ_D)\x509_d2.obj $(OBJ_D)\x509_r2x.obj $(OBJ_D)\x509_cmp.obj \ + $(OBJ_D)\x509_obj.obj $(OBJ_D)\x509_req.obj $(OBJ_D)\x509_vfy.obj \ + $(OBJ_D)\x509_set.obj $(OBJ_D)\x509rset.obj $(OBJ_D)\x509_err.obj \ + $(OBJ_D)\x509name.obj $(OBJ_D)\x509_v3.obj $(OBJ_D)\x509_ext.obj \ + $(OBJ_D)\x509pack.obj $(OBJ_D)\x509type.obj $(OBJ_D)\x509_lu.obj \ + $(OBJ_D)\x_all.obj $(OBJ_D)\x509_txt.obj $(OBJ_D)\by_file.obj \ + $(OBJ_D)\by_dir.obj $(OBJ_D)\v3_net.obj $(OBJ_D)\v3_x509.obj \ + $(OBJ_D)\conf.obj $(OBJ_D)\conf_err.obj $(OBJ_D)\txt_db.obj \ + $(OBJ_D)\pk7_lib.obj $(OBJ_D)\pkcs7err.obj $(OBJ_D)\pk7_doit.obj + +SSLOBJ=$(OBJ_D)\s2_meth.obj \ + $(OBJ_D)\s2_srvr.obj $(OBJ_D)\s2_clnt.obj $(OBJ_D)\s2_lib.obj \ + $(OBJ_D)\s2_enc.obj $(OBJ_D)\s2_pkt.obj $(OBJ_D)\s3_meth.obj \ + $(OBJ_D)\s3_srvr.obj $(OBJ_D)\s3_clnt.obj $(OBJ_D)\s3_lib.obj \ + $(OBJ_D)\s3_enc.obj $(OBJ_D)\s3_pkt.obj $(OBJ_D)\s3_both.obj \ + $(OBJ_D)\s23_meth.obj $(OBJ_D)\s23_srvr.obj $(OBJ_D)\s23_clnt.obj \ + $(OBJ_D)\s23_lib.obj $(OBJ_D)\s23_pkt.obj $(OBJ_D)\t1_meth.obj \ + $(OBJ_D)\t1_srvr.obj $(OBJ_D)\t1_clnt.obj $(OBJ_D)\t1_lib.obj \ + $(OBJ_D)\t1_enc.obj $(OBJ_D)\ssl_lib.obj $(OBJ_D)\ssl_err2.obj \ + $(OBJ_D)\ssl_cert.obj $(OBJ_D)\ssl_sess.obj $(OBJ_D)\ssl_ciph.obj \ + $(OBJ_D)\ssl_stat.obj $(OBJ_D)\ssl_rsa.obj $(OBJ_D)\ssl_asn1.obj \ + $(OBJ_D)\ssl_txt.obj $(OBJ_D)\ssl_algs.obj $(OBJ_D)\bio_ssl.obj \ + $(OBJ_D)\ssl_err.obj + +RSAGLUEOBJ=$(OBJ_D)\rsaref.obj \ + $(OBJ_D)\rsar_err.obj + +T_EXE=$(TEST_D)\md2test.exe \ + $(TEST_D)\md5test.exe $(TEST_D)\shatest.exe $(TEST_D)\sha1test.exe \ + $(TEST_D)\mdc2test.exe $(TEST_D)\hmactest.exe $(TEST_D)\rmdtest.exe \ + $(TEST_D)\destest.exe $(TEST_D)\rc2test.exe $(TEST_D)\rc4test.exe \ + $(TEST_D)\rc5test.exe $(TEST_D)\ideatest.exe $(TEST_D)\bftest.exe \ + $(TEST_D)\casttest.exe $(TEST_D)\bntest.exe $(TEST_D)\exptest.exe \ + $(TEST_D)\dsatest.exe $(TEST_D)\dhtest.exe $(TEST_D)\randtest.exe \ + $(TEST_D)\ssltest.exe + +################################################################### +all: banner $(TMP_D) $(BIN_D) $(TEST_D) $(LIB_D) $(INC_D) headers lib exe + +banner: + + +$(TMP_D): + $(MKDIR) $(TMP_D) + +$(BIN_D): + $(MKDIR) $(BIN_D) + +$(TEST_D): + $(MKDIR) $(TEST_D) + +$(LIB_D): + $(MKDIR) $(LIB_D) + +$(INC_D): + $(MKDIR) $(INC_D) + +headers: $(HEADER) $(EXHEADER) + +lib: $(LIBS_DEP) + +exe: $(T_EXE) $(BIN_D)\$(E_EXE).exe + +install: + $(MKDIR) $(INSTALLTOP) + $(MKDIR) $(INSTALLTOP)\bin + $(MKDIR) $(INSTALLTOP)\include + $(MKDIR) $(INSTALLTOP)\lib + $(CP) $(INC_D)\*.[ch] $(INSTALLTOP)\include + $(CP) $(BIN_D)\$(E_EXE).exe $(INSTALLTOP)\bin + $(CP) $(O_SSL) $(INSTALLTOP)\lib + $(CP) $(O_CRYPTO) $(INSTALLTOP)\lib + +clean: + $(RM) $(TMP_D)\*.* + +vclean: + $(RM) $(TMP_D)\*.* + $(RM) $(OUT_D)\*.* + +$(INCL_D)\cryptlib.h: $(SRC_D)\crypto\cryptlib.h + $(CP) $(SRC_D)\crypto\cryptlib.h $(INCL_D)\cryptlib.h + +$(INCL_D)\date.h: $(SRC_D)\crypto\date.h + $(CP) $(SRC_D)\crypto\date.h $(INCL_D)\date.h + +$(INCL_D)\md5_locl.h: $(SRC_D)\crypto\md5\md5_locl.h + $(CP) $(SRC_D)\crypto\md5\md5_locl.h $(INCL_D)\md5_locl.h + +$(INCL_D)\sha_locl.h: $(SRC_D)\crypto\sha\sha_locl.h + $(CP) $(SRC_D)\crypto\sha\sha_locl.h $(INCL_D)\sha_locl.h + +$(INCL_D)\rmd_locl.h: $(SRC_D)\crypto\ripemd\rmd_locl.h + $(CP) $(SRC_D)\crypto\ripemd\rmd_locl.h $(INCL_D)\rmd_locl.h + +$(INCL_D)\rmdconst.h: $(SRC_D)\crypto\ripemd\rmdconst.h + $(CP) $(SRC_D)\crypto\ripemd\rmdconst.h $(INCL_D)\rmdconst.h + +$(INCL_D)\des_locl.h: $(SRC_D)\crypto\des\des_locl.h + $(CP) $(SRC_D)\crypto\des\des_locl.h $(INCL_D)\des_locl.h + +$(INCL_D)\rpc_des.h: $(SRC_D)\crypto\des\rpc_des.h + $(CP) $(SRC_D)\crypto\des\rpc_des.h $(INCL_D)\rpc_des.h + +$(INCL_D)\podd.h: $(SRC_D)\crypto\des\podd.h + $(CP) $(SRC_D)\crypto\des\podd.h $(INCL_D)\podd.h + +$(INCL_D)\sk.h: $(SRC_D)\crypto\des\sk.h + $(CP) $(SRC_D)\crypto\des\sk.h $(INCL_D)\sk.h + +$(INCL_D)\spr.h: $(SRC_D)\crypto\des\spr.h + $(CP) $(SRC_D)\crypto\des\spr.h $(INCL_D)\spr.h + +$(INCL_D)\des_ver.h: $(SRC_D)\crypto\des\des_ver.h + $(CP) $(SRC_D)\crypto\des\des_ver.h $(INCL_D)\des_ver.h + +$(INCL_D)\rc2_locl.h: $(SRC_D)\crypto\rc2\rc2_locl.h + $(CP) $(SRC_D)\crypto\rc2\rc2_locl.h $(INCL_D)\rc2_locl.h + +$(INCL_D)\rc4_locl.h: $(SRC_D)\crypto\rc4\rc4_locl.h + $(CP) $(SRC_D)\crypto\rc4\rc4_locl.h $(INCL_D)\rc4_locl.h + +$(INCL_D)\rc5_locl.h: $(SRC_D)\crypto\rc5\rc5_locl.h + $(CP) $(SRC_D)\crypto\rc5\rc5_locl.h $(INCL_D)\rc5_locl.h + +$(INCL_D)\idea_lcl.h: $(SRC_D)\crypto\idea\idea_lcl.h + $(CP) $(SRC_D)\crypto\idea\idea_lcl.h $(INCL_D)\idea_lcl.h + +$(INCL_D)\bf_pi.h: $(SRC_D)\crypto\bf\bf_pi.h + $(CP) $(SRC_D)\crypto\bf\bf_pi.h $(INCL_D)\bf_pi.h + +$(INCL_D)\bf_locl.h: $(SRC_D)\crypto\bf\bf_locl.h + $(CP) $(SRC_D)\crypto\bf\bf_locl.h $(INCL_D)\bf_locl.h + +$(INCL_D)\cast_s.h: $(SRC_D)\crypto\cast\cast_s.h + $(CP) $(SRC_D)\crypto\cast\cast_s.h $(INCL_D)\cast_s.h + +$(INCL_D)\cast_lcl.h: $(SRC_D)\crypto\cast\cast_lcl.h + $(CP) $(SRC_D)\crypto\cast\cast_lcl.h $(INCL_D)\cast_lcl.h + +$(INCL_D)\bn_lcl.h: $(SRC_D)\crypto\bn\bn_lcl.h + $(CP) $(SRC_D)\crypto\bn\bn_lcl.h $(INCL_D)\bn_lcl.h + +$(INCL_D)\bn_prime.h: $(SRC_D)\crypto\bn\bn_prime.h + $(CP) $(SRC_D)\crypto\bn\bn_prime.h $(INCL_D)\bn_prime.h + +$(INCL_D)\obj_dat.h: $(SRC_D)\crypto\objects\obj_dat.h + $(CP) $(SRC_D)\crypto\objects\obj_dat.h $(INCL_D)\obj_dat.h + +$(INCL_D)\conf_lcl.h: $(SRC_D)\crypto\conf\conf_lcl.h + $(CP) $(SRC_D)\crypto\conf\conf_lcl.h $(INCL_D)\conf_lcl.h + +$(INCL_D)\ssl_locl.h: $(SRC_D)\ssl\ssl_locl.h + $(CP) $(SRC_D)\ssl\ssl_locl.h $(INCL_D)\ssl_locl.h + +$(INCL_D)\rsaref.h: $(SRC_D)\rsaref\rsaref.h + $(CP) $(SRC_D)\rsaref\rsaref.h $(INCL_D)\rsaref.h + +$(INCL_D)\apps.h: $(SRC_D)\apps\apps.h + $(CP) $(SRC_D)\apps\apps.h $(INCL_D)\apps.h + +$(INCL_D)\progs.h: $(SRC_D)\apps\progs.h + $(CP) $(SRC_D)\apps\progs.h $(INCL_D)\progs.h + +$(INCL_D)\s_apps.h: $(SRC_D)\apps\s_apps.h + $(CP) $(SRC_D)\apps\s_apps.h $(INCL_D)\s_apps.h + +$(INCL_D)\testdsa.h: $(SRC_D)\apps\testdsa.h + $(CP) $(SRC_D)\apps\testdsa.h $(INCL_D)\testdsa.h + +$(INCL_D)\testrsa.h: $(SRC_D)\apps\testrsa.h + $(CP) $(SRC_D)\apps\testrsa.h $(INCL_D)\testrsa.h + +$(INC_D)\e_os.h: $(SRC_D)\.\e_os.h + $(CP) $(SRC_D)\.\e_os.h $(INC_D)\e_os.h + +$(INC_D)\crypto.h: $(SRC_D)\crypto\crypto.h + $(CP) $(SRC_D)\crypto\crypto.h $(INC_D)\crypto.h + +$(INC_D)\cryptall.h: $(SRC_D)\crypto\cryptall.h + $(CP) $(SRC_D)\crypto\cryptall.h $(INC_D)\cryptall.h + +$(INC_D)\md2.h: $(SRC_D)\crypto\md2\md2.h + $(CP) $(SRC_D)\crypto\md2\md2.h $(INC_D)\md2.h + +$(INC_D)\md5.h: $(SRC_D)\crypto\md5\md5.h + $(CP) $(SRC_D)\crypto\md5\md5.h $(INC_D)\md5.h + +$(INC_D)\sha.h: $(SRC_D)\crypto\sha\sha.h + $(CP) $(SRC_D)\crypto\sha\sha.h $(INC_D)\sha.h + +$(INC_D)\mdc2.h: $(SRC_D)\crypto\mdc2\mdc2.h + $(CP) $(SRC_D)\crypto\mdc2\mdc2.h $(INC_D)\mdc2.h + +$(INC_D)\hmac.h: $(SRC_D)\crypto\hmac\hmac.h + $(CP) $(SRC_D)\crypto\hmac\hmac.h $(INC_D)\hmac.h + +$(INC_D)\ripemd.h: $(SRC_D)\crypto\ripemd\ripemd.h + $(CP) $(SRC_D)\crypto\ripemd\ripemd.h $(INC_D)\ripemd.h + +$(INC_D)\des.h: $(SRC_D)\crypto\des\des.h + $(CP) $(SRC_D)\crypto\des\des.h $(INC_D)\des.h + +$(INC_D)\rc2.h: $(SRC_D)\crypto\rc2\rc2.h + $(CP) $(SRC_D)\crypto\rc2\rc2.h $(INC_D)\rc2.h + +$(INC_D)\rc4.h: $(SRC_D)\crypto\rc4\rc4.h + $(CP) $(SRC_D)\crypto\rc4\rc4.h $(INC_D)\rc4.h + +$(INC_D)\rc5.h: $(SRC_D)\crypto\rc5\rc5.h + $(CP) $(SRC_D)\crypto\rc5\rc5.h $(INC_D)\rc5.h + +$(INC_D)\idea.h: $(SRC_D)\crypto\idea\idea.h + $(CP) $(SRC_D)\crypto\idea\idea.h $(INC_D)\idea.h + +$(INC_D)\blowfish.h: $(SRC_D)\crypto\bf\blowfish.h + $(CP) $(SRC_D)\crypto\bf\blowfish.h $(INC_D)\blowfish.h + +$(INC_D)\cast.h: $(SRC_D)\crypto\cast\cast.h + $(CP) $(SRC_D)\crypto\cast\cast.h $(INC_D)\cast.h + +$(INC_D)\bn.h: $(SRC_D)\crypto\bn\bn.h + $(CP) $(SRC_D)\crypto\bn\bn.h $(INC_D)\bn.h + +$(INC_D)\rsa.h: $(SRC_D)\crypto\rsa\rsa.h + $(CP) $(SRC_D)\crypto\rsa\rsa.h $(INC_D)\rsa.h + +$(INC_D)\dsa.h: $(SRC_D)\crypto\dsa\dsa.h + $(CP) $(SRC_D)\crypto\dsa\dsa.h $(INC_D)\dsa.h + +$(INC_D)\dh.h: $(SRC_D)\crypto\dh\dh.h + $(CP) $(SRC_D)\crypto\dh\dh.h $(INC_D)\dh.h + +$(INC_D)\buffer.h: $(SRC_D)\crypto\buffer\buffer.h + $(CP) $(SRC_D)\crypto\buffer\buffer.h $(INC_D)\buffer.h + +$(INC_D)\bio.h: $(SRC_D)\crypto\bio\bio.h + $(CP) $(SRC_D)\crypto\bio\bio.h $(INC_D)\bio.h + +$(INC_D)\bss_file.c: $(SRC_D)\crypto\bio\bss_file.c + $(CP) $(SRC_D)\crypto\bio\bss_file.c $(INC_D)\bss_file.c + +$(INC_D)\stack.h: $(SRC_D)\crypto\stack\stack.h + $(CP) $(SRC_D)\crypto\stack\stack.h $(INC_D)\stack.h + +$(INC_D)\lhash.h: $(SRC_D)\crypto\lhash\lhash.h + $(CP) $(SRC_D)\crypto\lhash\lhash.h $(INC_D)\lhash.h + +$(INC_D)\rand.h: $(SRC_D)\crypto\rand\rand.h + $(CP) $(SRC_D)\crypto\rand\rand.h $(INC_D)\rand.h + +$(INC_D)\err.h: $(SRC_D)\crypto\err\err.h + $(CP) $(SRC_D)\crypto\err\err.h $(INC_D)\err.h + +$(INC_D)\objects.h: $(SRC_D)\crypto\objects\objects.h + $(CP) $(SRC_D)\crypto\objects\objects.h $(INC_D)\objects.h + +$(INC_D)\evp.h: $(SRC_D)\crypto\evp\evp.h + $(CP) $(SRC_D)\crypto\evp\evp.h $(INC_D)\evp.h + +$(INC_D)\pem.h: $(SRC_D)\crypto\pem\pem.h + $(CP) $(SRC_D)\crypto\pem\pem.h $(INC_D)\pem.h + +$(INC_D)\asn1.h: $(SRC_D)\crypto\asn1\asn1.h + $(CP) $(SRC_D)\crypto\asn1\asn1.h $(INC_D)\asn1.h + +$(INC_D)\asn1_mac.h: $(SRC_D)\crypto\asn1\asn1_mac.h + $(CP) $(SRC_D)\crypto\asn1\asn1_mac.h $(INC_D)\asn1_mac.h + +$(INC_D)\x509.h: $(SRC_D)\crypto\x509\x509.h + $(CP) $(SRC_D)\crypto\x509\x509.h $(INC_D)\x509.h + +$(INC_D)\x509_vfy.h: $(SRC_D)\crypto\x509\x509_vfy.h + $(CP) $(SRC_D)\crypto\x509\x509_vfy.h $(INC_D)\x509_vfy.h + +$(INC_D)\conf.h: $(SRC_D)\crypto\conf\conf.h + $(CP) $(SRC_D)\crypto\conf\conf.h $(INC_D)\conf.h + +$(INC_D)\txt_db.h: $(SRC_D)\crypto\txt_db\txt_db.h + $(CP) $(SRC_D)\crypto\txt_db\txt_db.h $(INC_D)\txt_db.h + +$(INC_D)\pkcs7.h: $(SRC_D)\crypto\pkcs7\pkcs7.h + $(CP) $(SRC_D)\crypto\pkcs7\pkcs7.h $(INC_D)\pkcs7.h + +$(INC_D)\ssl.h: $(SRC_D)\ssl\ssl.h + $(CP) $(SRC_D)\ssl\ssl.h $(INC_D)\ssl.h + +$(INC_D)\ssl2.h: $(SRC_D)\ssl\ssl2.h + $(CP) $(SRC_D)\ssl\ssl2.h $(INC_D)\ssl2.h + +$(INC_D)\ssl3.h: $(SRC_D)\ssl\ssl3.h + $(CP) $(SRC_D)\ssl\ssl3.h $(INC_D)\ssl3.h + +$(INC_D)\ssl23.h: $(SRC_D)\ssl\ssl23.h + $(CP) $(SRC_D)\ssl\ssl23.h $(INC_D)\ssl23.h + +$(INC_D)\tls1.h: $(SRC_D)\ssl\tls1.h + $(CP) $(SRC_D)\ssl\tls1.h $(INC_D)\tls1.h + +$(OBJ_D)\md2test.obj: $(SRC_D)\crypto\md2\md2test.c + $(CC) /Fo$(OBJ_D)\md2test.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\md2\md2test.c + +$(OBJ_D)\md5test.obj: $(SRC_D)\crypto\md5\md5test.c + $(CC) /Fo$(OBJ_D)\md5test.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\md5\md5test.c + +$(OBJ_D)\shatest.obj: $(SRC_D)\crypto\sha\shatest.c + $(CC) /Fo$(OBJ_D)\shatest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\sha\shatest.c + +$(OBJ_D)\sha1test.obj: $(SRC_D)\crypto\sha\sha1test.c + $(CC) /Fo$(OBJ_D)\sha1test.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\sha\sha1test.c + +$(OBJ_D)\mdc2test.obj: $(SRC_D)\crypto\mdc2\mdc2test.c + $(CC) /Fo$(OBJ_D)\mdc2test.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\mdc2\mdc2test.c + +$(OBJ_D)\hmactest.obj: $(SRC_D)\crypto\hmac\hmactest.c + $(CC) /Fo$(OBJ_D)\hmactest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\hmac\hmactest.c + +$(OBJ_D)\rmdtest.obj: $(SRC_D)\crypto\ripemd\rmdtest.c + $(CC) /Fo$(OBJ_D)\rmdtest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\ripemd\rmdtest.c + +$(OBJ_D)\destest.obj: $(SRC_D)\crypto\des\destest.c + $(CC) /Fo$(OBJ_D)\destest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\des\destest.c + +$(OBJ_D)\rc2test.obj: $(SRC_D)\crypto\rc2\rc2test.c + $(CC) /Fo$(OBJ_D)\rc2test.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\rc2\rc2test.c + +$(OBJ_D)\rc4test.obj: $(SRC_D)\crypto\rc4\rc4test.c + $(CC) /Fo$(OBJ_D)\rc4test.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\rc4\rc4test.c + +$(OBJ_D)\rc5test.obj: $(SRC_D)\crypto\rc5\rc5test.c + $(CC) /Fo$(OBJ_D)\rc5test.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\rc5\rc5test.c + +$(OBJ_D)\ideatest.obj: $(SRC_D)\crypto\idea\ideatest.c + $(CC) /Fo$(OBJ_D)\ideatest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\idea\ideatest.c + +$(OBJ_D)\bftest.obj: $(SRC_D)\crypto\bf\bftest.c + $(CC) /Fo$(OBJ_D)\bftest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\bf\bftest.c + +$(OBJ_D)\casttest.obj: $(SRC_D)\crypto\cast\casttest.c + $(CC) /Fo$(OBJ_D)\casttest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\cast\casttest.c + +$(OBJ_D)\bntest.obj: $(SRC_D)\crypto\bn\bntest.c + $(CC) /Fo$(OBJ_D)\bntest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\bn\bntest.c + +$(OBJ_D)\exptest.obj: $(SRC_D)\crypto\bn\exptest.c + $(CC) /Fo$(OBJ_D)\exptest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\bn\exptest.c + +$(OBJ_D)\dsatest.obj: $(SRC_D)\crypto\dsa\dsatest.c + $(CC) /Fo$(OBJ_D)\dsatest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\dsa\dsatest.c + +$(OBJ_D)\dhtest.obj: $(SRC_D)\crypto\dh\dhtest.c + $(CC) /Fo$(OBJ_D)\dhtest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\dh\dhtest.c + +$(OBJ_D)\randtest.obj: $(SRC_D)\crypto\rand\randtest.c + $(CC) /Fo$(OBJ_D)\randtest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\rand\randtest.c + +$(OBJ_D)\ssltest.obj: $(SRC_D)\ssl\ssltest.c + $(CC) /Fo$(OBJ_D)\ssltest.obj $(APP_CFLAGS) -c $(SRC_D)\ssl\ssltest.c + +$(OBJ_D)\verify.obj: $(SRC_D)\apps\verify.c + $(CC) /Fo$(OBJ_D)\verify.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\verify.c + +$(OBJ_D)\asn1pars.obj: $(SRC_D)\apps\asn1pars.c + $(CC) /Fo$(OBJ_D)\asn1pars.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\asn1pars.c + +$(OBJ_D)\req.obj: $(SRC_D)\apps\req.c + $(CC) /Fo$(OBJ_D)\req.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\req.c + +$(OBJ_D)\dgst.obj: $(SRC_D)\apps\dgst.c + $(CC) /Fo$(OBJ_D)\dgst.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\dgst.c + +$(OBJ_D)\dh.obj: $(SRC_D)\apps\dh.c + $(CC) /Fo$(OBJ_D)\dh.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\dh.c + +$(OBJ_D)\enc.obj: $(SRC_D)\apps\enc.c + $(CC) /Fo$(OBJ_D)\enc.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\enc.c + +$(OBJ_D)\gendh.obj: $(SRC_D)\apps\gendh.c + $(CC) /Fo$(OBJ_D)\gendh.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\gendh.c + +$(OBJ_D)\errstr.obj: $(SRC_D)\apps\errstr.c + $(CC) /Fo$(OBJ_D)\errstr.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\errstr.c + +$(OBJ_D)\ca.obj: $(SRC_D)\apps\ca.c + $(CC) /Fo$(OBJ_D)\ca.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\ca.c + +$(OBJ_D)\pkcs7.obj: $(SRC_D)\apps\pkcs7.c + $(CC) /Fo$(OBJ_D)\pkcs7.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\pkcs7.c + +$(OBJ_D)\crl2p7.obj: $(SRC_D)\apps\crl2p7.c + $(CC) /Fo$(OBJ_D)\crl2p7.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\crl2p7.c + +$(OBJ_D)\crl.obj: $(SRC_D)\apps\crl.c + $(CC) /Fo$(OBJ_D)\crl.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\crl.c + +$(OBJ_D)\rsa.obj: $(SRC_D)\apps\rsa.c + $(CC) /Fo$(OBJ_D)\rsa.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\rsa.c + +$(OBJ_D)\dsa.obj: $(SRC_D)\apps\dsa.c + $(CC) /Fo$(OBJ_D)\dsa.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\dsa.c + +$(OBJ_D)\dsaparam.obj: $(SRC_D)\apps\dsaparam.c + $(CC) /Fo$(OBJ_D)\dsaparam.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\dsaparam.c + +$(OBJ_D)\x509.obj: $(SRC_D)\apps\x509.c + $(CC) /Fo$(OBJ_D)\x509.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\x509.c + +$(OBJ_D)\genrsa.obj: $(SRC_D)\apps\genrsa.c + $(CC) /Fo$(OBJ_D)\genrsa.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\genrsa.c + +$(OBJ_D)\s_server.obj: $(SRC_D)\apps\s_server.c + $(CC) /Fo$(OBJ_D)\s_server.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\s_server.c + +$(OBJ_D)\s_client.obj: $(SRC_D)\apps\s_client.c + $(CC) /Fo$(OBJ_D)\s_client.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\s_client.c + +$(OBJ_D)\speed.obj: $(SRC_D)\apps\speed.c + $(CC) /Fo$(OBJ_D)\speed.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\speed.c + +$(OBJ_D)\s_time.obj: $(SRC_D)\apps\s_time.c + $(CC) /Fo$(OBJ_D)\s_time.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\s_time.c + +$(OBJ_D)\apps.obj: $(SRC_D)\apps\apps.c + $(CC) /Fo$(OBJ_D)\apps.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\apps.c + +$(OBJ_D)\s_cb.obj: $(SRC_D)\apps\s_cb.c + $(CC) /Fo$(OBJ_D)\s_cb.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\s_cb.c + +$(OBJ_D)\s_socket.obj: $(SRC_D)\apps\s_socket.c + $(CC) /Fo$(OBJ_D)\s_socket.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\s_socket.c + +$(OBJ_D)\version.obj: $(SRC_D)\apps\version.c + $(CC) /Fo$(OBJ_D)\version.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\version.c + +$(OBJ_D)\sess_id.obj: $(SRC_D)\apps\sess_id.c + $(CC) /Fo$(OBJ_D)\sess_id.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\sess_id.c + +$(OBJ_D)\ciphers.obj: $(SRC_D)\apps\ciphers.c + $(CC) /Fo$(OBJ_D)\ciphers.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\ciphers.c + +$(OBJ_D)\ssleay.obj: $(SRC_D)\apps\ssleay.c + $(CC) /Fo$(OBJ_D)\ssleay.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\ssleay.c + +crypto\bn\asm\bn-win32.obj: crypto\bn\asm\bn-win32.asm + $(ASM) /Focrypto\bn\asm\bn-win32.obj $(SRC_D)\crypto\bn\asm\bn-win32.asm + +crypto\des\asm\d-win32.obj: crypto\des\asm\d-win32.asm + $(ASM) /Focrypto\des\asm\d-win32.obj $(SRC_D)\crypto\des\asm\d-win32.asm + +crypto\des\asm\y-win32.obj: crypto\des\asm\y-win32.asm + $(ASM) /Focrypto\des\asm\y-win32.obj $(SRC_D)\crypto\des\asm\y-win32.asm + +crypto\bf\asm\b-win32.obj: crypto\bf\asm\b-win32.asm + $(ASM) /Focrypto\bf\asm\b-win32.obj $(SRC_D)\crypto\bf\asm\b-win32.asm + +crypto\cast\asm\c-win32.obj: crypto\cast\asm\c-win32.asm + $(ASM) /Focrypto\cast\asm\c-win32.obj $(SRC_D)\crypto\cast\asm\c-win32.asm + +crypto\rc4\asm\r4-win32.obj: crypto\rc4\asm\r4-win32.asm + $(ASM) /Focrypto\rc4\asm\r4-win32.obj $(SRC_D)\crypto\rc4\asm\r4-win32.asm + +crypto\rc5\asm\r5-win32.obj: crypto\rc5\asm\r5-win32.asm + $(ASM) /Focrypto\rc5\asm\r5-win32.obj $(SRC_D)\crypto\rc5\asm\r5-win32.asm + +crypto\md5\asm\m5-win32.obj: crypto\md5\asm\m5-win32.asm + $(ASM) /Focrypto\md5\asm\m5-win32.obj $(SRC_D)\crypto\md5\asm\m5-win32.asm + +crypto\sha\asm\s1-win32.obj: crypto\sha\asm\s1-win32.asm + $(ASM) /Focrypto\sha\asm\s1-win32.obj $(SRC_D)\crypto\sha\asm\s1-win32.asm + +crypto\ripemd\asm\rm-win32.obj: crypto\ripemd\asm\rm-win32.asm + $(ASM) /Focrypto\ripemd\asm\rm-win32.obj $(SRC_D)\crypto\ripemd\asm\rm-win32.asm + +$(OBJ_D)\cryptlib.obj: $(SRC_D)\crypto\cryptlib.c + $(CC) /Fo$(OBJ_D)\cryptlib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\cryptlib.c + +$(OBJ_D)\mem.obj: $(SRC_D)\crypto\mem.c + $(CC) /Fo$(OBJ_D)\mem.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\mem.c + +$(OBJ_D)\cversion.obj: $(SRC_D)\crypto\cversion.c + $(CC) /Fo$(OBJ_D)\cversion.obj $(SHLIB_CFLAGS) -DCFLAGS="\"$(CC) $(CFLAG)\"" -c $(SRC_D)\crypto\cversion.c + +$(OBJ_D)\ex_data.obj: $(SRC_D)\crypto\ex_data.c + $(CC) /Fo$(OBJ_D)\ex_data.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\ex_data.c + +$(OBJ_D)\cpt_err.obj: $(SRC_D)\crypto\cpt_err.c + $(CC) /Fo$(OBJ_D)\cpt_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\cpt_err.c + +$(OBJ_D)\md2_dgst.obj: $(SRC_D)\crypto\md2\md2_dgst.c + $(CC) /Fo$(OBJ_D)\md2_dgst.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\md2\md2_dgst.c + +$(OBJ_D)\md2_one.obj: $(SRC_D)\crypto\md2\md2_one.c + $(CC) /Fo$(OBJ_D)\md2_one.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\md2\md2_one.c + +$(OBJ_D)\md5_dgst.obj: $(SRC_D)\crypto\md5\md5_dgst.c + $(CC) /Fo$(OBJ_D)\md5_dgst.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\md5\md5_dgst.c + +$(OBJ_D)\md5_one.obj: $(SRC_D)\crypto\md5\md5_one.c + $(CC) /Fo$(OBJ_D)\md5_one.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\md5\md5_one.c + +$(OBJ_D)\sha_dgst.obj: $(SRC_D)\crypto\sha\sha_dgst.c + $(CC) /Fo$(OBJ_D)\sha_dgst.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\sha\sha_dgst.c + +$(OBJ_D)\sha1dgst.obj: $(SRC_D)\crypto\sha\sha1dgst.c + $(CC) /Fo$(OBJ_D)\sha1dgst.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\sha\sha1dgst.c + +$(OBJ_D)\sha_one.obj: $(SRC_D)\crypto\sha\sha_one.c + $(CC) /Fo$(OBJ_D)\sha_one.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\sha\sha_one.c + +$(OBJ_D)\sha1_one.obj: $(SRC_D)\crypto\sha\sha1_one.c + $(CC) /Fo$(OBJ_D)\sha1_one.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\sha\sha1_one.c + +$(OBJ_D)\mdc2dgst.obj: $(SRC_D)\crypto\mdc2\mdc2dgst.c + $(CC) /Fo$(OBJ_D)\mdc2dgst.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\mdc2\mdc2dgst.c + +$(OBJ_D)\mdc2_one.obj: $(SRC_D)\crypto\mdc2\mdc2_one.c + $(CC) /Fo$(OBJ_D)\mdc2_one.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\mdc2\mdc2_one.c + +$(OBJ_D)\hmac.obj: $(SRC_D)\crypto\hmac\hmac.c + $(CC) /Fo$(OBJ_D)\hmac.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\hmac\hmac.c + +$(OBJ_D)\rmd_dgst.obj: $(SRC_D)\crypto\ripemd\rmd_dgst.c + $(CC) /Fo$(OBJ_D)\rmd_dgst.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\ripemd\rmd_dgst.c + +$(OBJ_D)\rmd_one.obj: $(SRC_D)\crypto\ripemd\rmd_one.c + $(CC) /Fo$(OBJ_D)\rmd_one.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\ripemd\rmd_one.c + +$(OBJ_D)\set_key.obj: $(SRC_D)\crypto\des\set_key.c + $(CC) /Fo$(OBJ_D)\set_key.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\set_key.c + +$(OBJ_D)\ecb_enc.obj: $(SRC_D)\crypto\des\ecb_enc.c + $(CC) /Fo$(OBJ_D)\ecb_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\ecb_enc.c + +$(OBJ_D)\cbc_enc.obj: $(SRC_D)\crypto\des\cbc_enc.c + $(CC) /Fo$(OBJ_D)\cbc_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\cbc_enc.c + +$(OBJ_D)\ecb3_enc.obj: $(SRC_D)\crypto\des\ecb3_enc.c + $(CC) /Fo$(OBJ_D)\ecb3_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\ecb3_enc.c + +$(OBJ_D)\cfb64enc.obj: $(SRC_D)\crypto\des\cfb64enc.c + $(CC) /Fo$(OBJ_D)\cfb64enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\cfb64enc.c + +$(OBJ_D)\cfb64ede.obj: $(SRC_D)\crypto\des\cfb64ede.c + $(CC) /Fo$(OBJ_D)\cfb64ede.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\cfb64ede.c + +$(OBJ_D)\cfb_enc.obj: $(SRC_D)\crypto\des\cfb_enc.c + $(CC) /Fo$(OBJ_D)\cfb_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\cfb_enc.c + +$(OBJ_D)\ofb64ede.obj: $(SRC_D)\crypto\des\ofb64ede.c + $(CC) /Fo$(OBJ_D)\ofb64ede.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\ofb64ede.c + +$(OBJ_D)\enc_read.obj: $(SRC_D)\crypto\des\enc_read.c + $(CC) /Fo$(OBJ_D)\enc_read.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\enc_read.c + +$(OBJ_D)\enc_writ.obj: $(SRC_D)\crypto\des\enc_writ.c + $(CC) /Fo$(OBJ_D)\enc_writ.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\enc_writ.c + +$(OBJ_D)\ofb64enc.obj: $(SRC_D)\crypto\des\ofb64enc.c + $(CC) /Fo$(OBJ_D)\ofb64enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\ofb64enc.c + +$(OBJ_D)\ofb_enc.obj: $(SRC_D)\crypto\des\ofb_enc.c + $(CC) /Fo$(OBJ_D)\ofb_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\ofb_enc.c + +$(OBJ_D)\str2key.obj: $(SRC_D)\crypto\des\str2key.c + $(CC) /Fo$(OBJ_D)\str2key.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\str2key.c + +$(OBJ_D)\pcbc_enc.obj: $(SRC_D)\crypto\des\pcbc_enc.c + $(CC) /Fo$(OBJ_D)\pcbc_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\pcbc_enc.c + +$(OBJ_D)\qud_cksm.obj: $(SRC_D)\crypto\des\qud_cksm.c + $(CC) /Fo$(OBJ_D)\qud_cksm.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\qud_cksm.c + +$(OBJ_D)\rand_key.obj: $(SRC_D)\crypto\des\rand_key.c + $(CC) /Fo$(OBJ_D)\rand_key.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\rand_key.c + +$(OBJ_D)\des_enc.obj: $(SRC_D)\crypto\des\des_enc.c + $(CC) /Fo$(OBJ_D)\des_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\des_enc.c + +$(OBJ_D)\fcrypt_b.obj: $(SRC_D)\crypto\des\fcrypt_b.c + $(CC) /Fo$(OBJ_D)\fcrypt_b.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\fcrypt_b.c + +$(OBJ_D)\read2pwd.obj: $(SRC_D)\crypto\des\read2pwd.c + $(CC) /Fo$(OBJ_D)\read2pwd.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\read2pwd.c + +$(OBJ_D)\fcrypt.obj: $(SRC_D)\crypto\des\fcrypt.c + $(CC) /Fo$(OBJ_D)\fcrypt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\fcrypt.c + +$(OBJ_D)\xcbc_enc.obj: $(SRC_D)\crypto\des\xcbc_enc.c + $(CC) /Fo$(OBJ_D)\xcbc_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\xcbc_enc.c + +$(OBJ_D)\read_pwd.obj: $(SRC_D)\crypto\des\read_pwd.c + $(CC) /Fo$(OBJ_D)\read_pwd.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\read_pwd.c + +$(OBJ_D)\rpc_enc.obj: $(SRC_D)\crypto\des\rpc_enc.c + $(CC) /Fo$(OBJ_D)\rpc_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\rpc_enc.c + +$(OBJ_D)\cbc_cksm.obj: $(SRC_D)\crypto\des\cbc_cksm.c + $(CC) /Fo$(OBJ_D)\cbc_cksm.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\cbc_cksm.c + +$(OBJ_D)\supp.obj: $(SRC_D)\crypto\des\supp.c + $(CC) /Fo$(OBJ_D)\supp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\supp.c + +$(OBJ_D)\rc2_ecb.obj: $(SRC_D)\crypto\rc2\rc2_ecb.c + $(CC) /Fo$(OBJ_D)\rc2_ecb.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc2\rc2_ecb.c + +$(OBJ_D)\rc2_skey.obj: $(SRC_D)\crypto\rc2\rc2_skey.c + $(CC) /Fo$(OBJ_D)\rc2_skey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc2\rc2_skey.c + +$(OBJ_D)\rc2_cbc.obj: $(SRC_D)\crypto\rc2\rc2_cbc.c + $(CC) /Fo$(OBJ_D)\rc2_cbc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc2\rc2_cbc.c + +$(OBJ_D)\rc2cfb64.obj: $(SRC_D)\crypto\rc2\rc2cfb64.c + $(CC) /Fo$(OBJ_D)\rc2cfb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc2\rc2cfb64.c + +$(OBJ_D)\rc2ofb64.obj: $(SRC_D)\crypto\rc2\rc2ofb64.c + $(CC) /Fo$(OBJ_D)\rc2ofb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc2\rc2ofb64.c + +$(OBJ_D)\rc4_skey.obj: $(SRC_D)\crypto\rc4\rc4_skey.c + $(CC) /Fo$(OBJ_D)\rc4_skey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc4\rc4_skey.c + +$(OBJ_D)\rc4_enc.obj: $(SRC_D)\crypto\rc4\rc4_enc.c + $(CC) /Fo$(OBJ_D)\rc4_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc4\rc4_enc.c + +$(OBJ_D)\rc5_skey.obj: $(SRC_D)\crypto\rc5\rc5_skey.c + $(CC) /Fo$(OBJ_D)\rc5_skey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc5\rc5_skey.c + +$(OBJ_D)\rc5_ecb.obj: $(SRC_D)\crypto\rc5\rc5_ecb.c + $(CC) /Fo$(OBJ_D)\rc5_ecb.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc5\rc5_ecb.c + +$(OBJ_D)\rc5_enc.obj: $(SRC_D)\crypto\rc5\rc5_enc.c + $(CC) /Fo$(OBJ_D)\rc5_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc5\rc5_enc.c + +$(OBJ_D)\rc5cfb64.obj: $(SRC_D)\crypto\rc5\rc5cfb64.c + $(CC) /Fo$(OBJ_D)\rc5cfb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc5\rc5cfb64.c + +$(OBJ_D)\rc5ofb64.obj: $(SRC_D)\crypto\rc5\rc5ofb64.c + $(CC) /Fo$(OBJ_D)\rc5ofb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc5\rc5ofb64.c + +$(OBJ_D)\i_cbc.obj: $(SRC_D)\crypto\idea\i_cbc.c + $(CC) /Fo$(OBJ_D)\i_cbc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\idea\i_cbc.c + +$(OBJ_D)\i_cfb64.obj: $(SRC_D)\crypto\idea\i_cfb64.c + $(CC) /Fo$(OBJ_D)\i_cfb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\idea\i_cfb64.c + +$(OBJ_D)\i_ofb64.obj: $(SRC_D)\crypto\idea\i_ofb64.c + $(CC) /Fo$(OBJ_D)\i_ofb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\idea\i_ofb64.c + +$(OBJ_D)\i_ecb.obj: $(SRC_D)\crypto\idea\i_ecb.c + $(CC) /Fo$(OBJ_D)\i_ecb.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\idea\i_ecb.c + +$(OBJ_D)\i_skey.obj: $(SRC_D)\crypto\idea\i_skey.c + $(CC) /Fo$(OBJ_D)\i_skey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\idea\i_skey.c + +$(OBJ_D)\bf_skey.obj: $(SRC_D)\crypto\bf\bf_skey.c + $(CC) /Fo$(OBJ_D)\bf_skey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bf\bf_skey.c + +$(OBJ_D)\bf_ecb.obj: $(SRC_D)\crypto\bf\bf_ecb.c + $(CC) /Fo$(OBJ_D)\bf_ecb.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bf\bf_ecb.c + +$(OBJ_D)\bf_enc.obj: $(SRC_D)\crypto\bf\bf_enc.c + $(CC) /Fo$(OBJ_D)\bf_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bf\bf_enc.c + +$(OBJ_D)\bf_cfb64.obj: $(SRC_D)\crypto\bf\bf_cfb64.c + $(CC) /Fo$(OBJ_D)\bf_cfb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bf\bf_cfb64.c + +$(OBJ_D)\bf_ofb64.obj: $(SRC_D)\crypto\bf\bf_ofb64.c + $(CC) /Fo$(OBJ_D)\bf_ofb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bf\bf_ofb64.c + +$(OBJ_D)\c_skey.obj: $(SRC_D)\crypto\cast\c_skey.c + $(CC) /Fo$(OBJ_D)\c_skey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\cast\c_skey.c + +$(OBJ_D)\c_ecb.obj: $(SRC_D)\crypto\cast\c_ecb.c + $(CC) /Fo$(OBJ_D)\c_ecb.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\cast\c_ecb.c + +$(OBJ_D)\c_enc.obj: $(SRC_D)\crypto\cast\c_enc.c + $(CC) /Fo$(OBJ_D)\c_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\cast\c_enc.c + +$(OBJ_D)\c_cfb64.obj: $(SRC_D)\crypto\cast\c_cfb64.c + $(CC) /Fo$(OBJ_D)\c_cfb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\cast\c_cfb64.c + +$(OBJ_D)\c_ofb64.obj: $(SRC_D)\crypto\cast\c_ofb64.c + $(CC) /Fo$(OBJ_D)\c_ofb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\cast\c_ofb64.c + +$(OBJ_D)\bn_add.obj: $(SRC_D)\crypto\bn\bn_add.c + $(CC) /Fo$(OBJ_D)\bn_add.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_add.c + +$(OBJ_D)\bn_div.obj: $(SRC_D)\crypto\bn\bn_div.c + $(CC) /Fo$(OBJ_D)\bn_div.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_div.c + +$(OBJ_D)\bn_exp.obj: $(SRC_D)\crypto\bn\bn_exp.c + $(CC) /Fo$(OBJ_D)\bn_exp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_exp.c + +$(OBJ_D)\bn_lib.obj: $(SRC_D)\crypto\bn\bn_lib.c + $(CC) /Fo$(OBJ_D)\bn_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_lib.c + +$(OBJ_D)\bn_mod.obj: $(SRC_D)\crypto\bn\bn_mod.c + $(CC) /Fo$(OBJ_D)\bn_mod.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_mod.c + +$(OBJ_D)\bn_mul.obj: $(SRC_D)\crypto\bn\bn_mul.c + $(CC) /Fo$(OBJ_D)\bn_mul.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_mul.c + +$(OBJ_D)\bn_print.obj: $(SRC_D)\crypto\bn\bn_print.c + $(CC) /Fo$(OBJ_D)\bn_print.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_print.c + +$(OBJ_D)\bn_rand.obj: $(SRC_D)\crypto\bn\bn_rand.c + $(CC) /Fo$(OBJ_D)\bn_rand.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_rand.c + +$(OBJ_D)\bn_shift.obj: $(SRC_D)\crypto\bn\bn_shift.c + $(CC) /Fo$(OBJ_D)\bn_shift.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_shift.c + +$(OBJ_D)\bn_sub.obj: $(SRC_D)\crypto\bn\bn_sub.c + $(CC) /Fo$(OBJ_D)\bn_sub.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_sub.c + +$(OBJ_D)\bn_word.obj: $(SRC_D)\crypto\bn\bn_word.c + $(CC) /Fo$(OBJ_D)\bn_word.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_word.c + +$(OBJ_D)\bn_blind.obj: $(SRC_D)\crypto\bn\bn_blind.c + $(CC) /Fo$(OBJ_D)\bn_blind.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_blind.c + +$(OBJ_D)\bn_gcd.obj: $(SRC_D)\crypto\bn\bn_gcd.c + $(CC) /Fo$(OBJ_D)\bn_gcd.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_gcd.c + +$(OBJ_D)\bn_prime.obj: $(SRC_D)\crypto\bn\bn_prime.c + $(CC) /Fo$(OBJ_D)\bn_prime.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_prime.c + +$(OBJ_D)\bn_err.obj: $(SRC_D)\crypto\bn\bn_err.c + $(CC) /Fo$(OBJ_D)\bn_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_err.c + +$(OBJ_D)\bn_sqr.obj: $(SRC_D)\crypto\bn\bn_sqr.c + $(CC) /Fo$(OBJ_D)\bn_sqr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_sqr.c + +$(OBJ_D)\bn_mulw.obj: $(SRC_D)\crypto\bn\bn_mulw.c + $(CC) /Fo$(OBJ_D)\bn_mulw.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_mulw.c + +$(OBJ_D)\bn_recp.obj: $(SRC_D)\crypto\bn\bn_recp.c + $(CC) /Fo$(OBJ_D)\bn_recp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_recp.c + +$(OBJ_D)\bn_mont.obj: $(SRC_D)\crypto\bn\bn_mont.c + $(CC) /Fo$(OBJ_D)\bn_mont.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_mont.c + +$(OBJ_D)\bn_mpi.obj: $(SRC_D)\crypto\bn\bn_mpi.c + $(CC) /Fo$(OBJ_D)\bn_mpi.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_mpi.c + +$(OBJ_D)\rsa_eay.obj: $(SRC_D)\crypto\rsa\rsa_eay.c + $(CC) /Fo$(OBJ_D)\rsa_eay.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_eay.c + +$(OBJ_D)\rsa_gen.obj: $(SRC_D)\crypto\rsa\rsa_gen.c + $(CC) /Fo$(OBJ_D)\rsa_gen.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_gen.c + +$(OBJ_D)\rsa_lib.obj: $(SRC_D)\crypto\rsa\rsa_lib.c + $(CC) /Fo$(OBJ_D)\rsa_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_lib.c + +$(OBJ_D)\rsa_sign.obj: $(SRC_D)\crypto\rsa\rsa_sign.c + $(CC) /Fo$(OBJ_D)\rsa_sign.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_sign.c + +$(OBJ_D)\rsa_saos.obj: $(SRC_D)\crypto\rsa\rsa_saos.c + $(CC) /Fo$(OBJ_D)\rsa_saos.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_saos.c + +$(OBJ_D)\rsa_err.obj: $(SRC_D)\crypto\rsa\rsa_err.c + $(CC) /Fo$(OBJ_D)\rsa_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_err.c + +$(OBJ_D)\rsa_pk1.obj: $(SRC_D)\crypto\rsa\rsa_pk1.c + $(CC) /Fo$(OBJ_D)\rsa_pk1.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_pk1.c + +$(OBJ_D)\rsa_ssl.obj: $(SRC_D)\crypto\rsa\rsa_ssl.c + $(CC) /Fo$(OBJ_D)\rsa_ssl.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_ssl.c + +$(OBJ_D)\rsa_none.obj: $(SRC_D)\crypto\rsa\rsa_none.c + $(CC) /Fo$(OBJ_D)\rsa_none.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_none.c + +$(OBJ_D)\dsa_gen.obj: $(SRC_D)\crypto\dsa\dsa_gen.c + $(CC) /Fo$(OBJ_D)\dsa_gen.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dsa\dsa_gen.c + +$(OBJ_D)\dsa_key.obj: $(SRC_D)\crypto\dsa\dsa_key.c + $(CC) /Fo$(OBJ_D)\dsa_key.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dsa\dsa_key.c + +$(OBJ_D)\dsa_lib.obj: $(SRC_D)\crypto\dsa\dsa_lib.c + $(CC) /Fo$(OBJ_D)\dsa_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dsa\dsa_lib.c + +$(OBJ_D)\dsa_vrf.obj: $(SRC_D)\crypto\dsa\dsa_vrf.c + $(CC) /Fo$(OBJ_D)\dsa_vrf.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dsa\dsa_vrf.c + +$(OBJ_D)\dsa_sign.obj: $(SRC_D)\crypto\dsa\dsa_sign.c + $(CC) /Fo$(OBJ_D)\dsa_sign.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dsa\dsa_sign.c + +$(OBJ_D)\dsa_err.obj: $(SRC_D)\crypto\dsa\dsa_err.c + $(CC) /Fo$(OBJ_D)\dsa_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dsa\dsa_err.c + +$(OBJ_D)\dh_gen.obj: $(SRC_D)\crypto\dh\dh_gen.c + $(CC) /Fo$(OBJ_D)\dh_gen.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dh\dh_gen.c + +$(OBJ_D)\dh_key.obj: $(SRC_D)\crypto\dh\dh_key.c + $(CC) /Fo$(OBJ_D)\dh_key.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dh\dh_key.c + +$(OBJ_D)\dh_lib.obj: $(SRC_D)\crypto\dh\dh_lib.c + $(CC) /Fo$(OBJ_D)\dh_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dh\dh_lib.c + +$(OBJ_D)\dh_check.obj: $(SRC_D)\crypto\dh\dh_check.c + $(CC) /Fo$(OBJ_D)\dh_check.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dh\dh_check.c + +$(OBJ_D)\dh_err.obj: $(SRC_D)\crypto\dh\dh_err.c + $(CC) /Fo$(OBJ_D)\dh_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dh\dh_err.c + +$(OBJ_D)\buffer.obj: $(SRC_D)\crypto\buffer\buffer.c + $(CC) /Fo$(OBJ_D)\buffer.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\buffer\buffer.c + +$(OBJ_D)\buf_err.obj: $(SRC_D)\crypto\buffer\buf_err.c + $(CC) /Fo$(OBJ_D)\buf_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\buffer\buf_err.c + +$(OBJ_D)\bio_lib.obj: $(SRC_D)\crypto\bio\bio_lib.c + $(CC) /Fo$(OBJ_D)\bio_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bio_lib.c + +$(OBJ_D)\bio_cb.obj: $(SRC_D)\crypto\bio\bio_cb.c + $(CC) /Fo$(OBJ_D)\bio_cb.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bio_cb.c + +$(OBJ_D)\bio_err.obj: $(SRC_D)\crypto\bio\bio_err.c + $(CC) /Fo$(OBJ_D)\bio_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bio_err.c + +$(OBJ_D)\bss_mem.obj: $(SRC_D)\crypto\bio\bss_mem.c + $(CC) /Fo$(OBJ_D)\bss_mem.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bss_mem.c + +$(OBJ_D)\bss_null.obj: $(SRC_D)\crypto\bio\bss_null.c + $(CC) /Fo$(OBJ_D)\bss_null.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bss_null.c + +$(OBJ_D)\bss_fd.obj: $(SRC_D)\crypto\bio\bss_fd.c + $(CC) /Fo$(OBJ_D)\bss_fd.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bss_fd.c + +$(OBJ_D)\bss_file.obj: $(SRC_D)\crypto\bio\bss_file.c + $(CC) /Fo$(OBJ_D)\bss_file.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bss_file.c + +$(OBJ_D)\bss_sock.obj: $(SRC_D)\crypto\bio\bss_sock.c + $(CC) /Fo$(OBJ_D)\bss_sock.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bss_sock.c + +$(OBJ_D)\bss_conn.obj: $(SRC_D)\crypto\bio\bss_conn.c + $(CC) /Fo$(OBJ_D)\bss_conn.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bss_conn.c + +$(OBJ_D)\bf_null.obj: $(SRC_D)\crypto\bio\bf_null.c + $(CC) /Fo$(OBJ_D)\bf_null.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bf_null.c + +$(OBJ_D)\bf_buff.obj: $(SRC_D)\crypto\bio\bf_buff.c + $(CC) /Fo$(OBJ_D)\bf_buff.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bf_buff.c + +$(OBJ_D)\b_print.obj: $(SRC_D)\crypto\bio\b_print.c + $(CC) /Fo$(OBJ_D)\b_print.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\b_print.c + +$(OBJ_D)\b_dump.obj: $(SRC_D)\crypto\bio\b_dump.c + $(CC) /Fo$(OBJ_D)\b_dump.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\b_dump.c + +$(OBJ_D)\b_sock.obj: $(SRC_D)\crypto\bio\b_sock.c + $(CC) /Fo$(OBJ_D)\b_sock.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\b_sock.c + +$(OBJ_D)\bss_acpt.obj: $(SRC_D)\crypto\bio\bss_acpt.c + $(CC) /Fo$(OBJ_D)\bss_acpt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bss_acpt.c + +$(OBJ_D)\bf_nbio.obj: $(SRC_D)\crypto\bio\bf_nbio.c + $(CC) /Fo$(OBJ_D)\bf_nbio.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bf_nbio.c + +$(OBJ_D)\stack.obj: $(SRC_D)\crypto\stack\stack.c + $(CC) /Fo$(OBJ_D)\stack.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\stack\stack.c + +$(OBJ_D)\lhash.obj: $(SRC_D)\crypto\lhash\lhash.c + $(CC) /Fo$(OBJ_D)\lhash.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\lhash\lhash.c + +$(OBJ_D)\lh_stats.obj: $(SRC_D)\crypto\lhash\lh_stats.c + $(CC) /Fo$(OBJ_D)\lh_stats.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\lhash\lh_stats.c + +$(OBJ_D)\md_rand.obj: $(SRC_D)\crypto\rand\md_rand.c + $(CC) /Fo$(OBJ_D)\md_rand.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rand\md_rand.c + +$(OBJ_D)\randfile.obj: $(SRC_D)\crypto\rand\randfile.c + $(CC) /Fo$(OBJ_D)\randfile.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rand\randfile.c + +$(OBJ_D)\err.obj: $(SRC_D)\crypto\err\err.c + $(CC) /Fo$(OBJ_D)\err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\err\err.c + +$(OBJ_D)\err_all.obj: $(SRC_D)\crypto\err\err_all.c + $(CC) /Fo$(OBJ_D)\err_all.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\err\err_all.c + +$(OBJ_D)\err_prn.obj: $(SRC_D)\crypto\err\err_prn.c + $(CC) /Fo$(OBJ_D)\err_prn.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\err\err_prn.c + +$(OBJ_D)\obj_dat.obj: $(SRC_D)\crypto\objects\obj_dat.c + $(CC) /Fo$(OBJ_D)\obj_dat.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\objects\obj_dat.c + +$(OBJ_D)\obj_lib.obj: $(SRC_D)\crypto\objects\obj_lib.c + $(CC) /Fo$(OBJ_D)\obj_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\objects\obj_lib.c + +$(OBJ_D)\obj_err.obj: $(SRC_D)\crypto\objects\obj_err.c + $(CC) /Fo$(OBJ_D)\obj_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\objects\obj_err.c + +$(OBJ_D)\encode.obj: $(SRC_D)\crypto\evp\encode.c + $(CC) /Fo$(OBJ_D)\encode.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\encode.c + +$(OBJ_D)\digest.obj: $(SRC_D)\crypto\evp\digest.c + $(CC) /Fo$(OBJ_D)\digest.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\digest.c + +$(OBJ_D)\evp_enc.obj: $(SRC_D)\crypto\evp\evp_enc.c + $(CC) /Fo$(OBJ_D)\evp_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\evp_enc.c + +$(OBJ_D)\evp_key.obj: $(SRC_D)\crypto\evp\evp_key.c + $(CC) /Fo$(OBJ_D)\evp_key.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\evp_key.c + +$(OBJ_D)\e_ecb_d.obj: $(SRC_D)\crypto\evp\e_ecb_d.c + $(CC) /Fo$(OBJ_D)\e_ecb_d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ecb_d.c + +$(OBJ_D)\e_cbc_d.obj: $(SRC_D)\crypto\evp\e_cbc_d.c + $(CC) /Fo$(OBJ_D)\e_cbc_d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cbc_d.c + +$(OBJ_D)\e_cfb_d.obj: $(SRC_D)\crypto\evp\e_cfb_d.c + $(CC) /Fo$(OBJ_D)\e_cfb_d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cfb_d.c + +$(OBJ_D)\e_ofb_d.obj: $(SRC_D)\crypto\evp\e_ofb_d.c + $(CC) /Fo$(OBJ_D)\e_ofb_d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ofb_d.c + +$(OBJ_D)\e_ecb_i.obj: $(SRC_D)\crypto\evp\e_ecb_i.c + $(CC) /Fo$(OBJ_D)\e_ecb_i.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ecb_i.c + +$(OBJ_D)\e_cbc_i.obj: $(SRC_D)\crypto\evp\e_cbc_i.c + $(CC) /Fo$(OBJ_D)\e_cbc_i.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cbc_i.c + +$(OBJ_D)\e_cfb_i.obj: $(SRC_D)\crypto\evp\e_cfb_i.c + $(CC) /Fo$(OBJ_D)\e_cfb_i.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cfb_i.c + +$(OBJ_D)\e_ofb_i.obj: $(SRC_D)\crypto\evp\e_ofb_i.c + $(CC) /Fo$(OBJ_D)\e_ofb_i.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ofb_i.c + +$(OBJ_D)\e_ecb_3d.obj: $(SRC_D)\crypto\evp\e_ecb_3d.c + $(CC) /Fo$(OBJ_D)\e_ecb_3d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ecb_3d.c + +$(OBJ_D)\e_cbc_3d.obj: $(SRC_D)\crypto\evp\e_cbc_3d.c + $(CC) /Fo$(OBJ_D)\e_cbc_3d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cbc_3d.c + +$(OBJ_D)\e_rc4.obj: $(SRC_D)\crypto\evp\e_rc4.c + $(CC) /Fo$(OBJ_D)\e_rc4.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_rc4.c + +$(OBJ_D)\names.obj: $(SRC_D)\crypto\evp\names.c + $(CC) /Fo$(OBJ_D)\names.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\names.c + +$(OBJ_D)\e_cfb_3d.obj: $(SRC_D)\crypto\evp\e_cfb_3d.c + $(CC) /Fo$(OBJ_D)\e_cfb_3d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cfb_3d.c + +$(OBJ_D)\e_ofb_3d.obj: $(SRC_D)\crypto\evp\e_ofb_3d.c + $(CC) /Fo$(OBJ_D)\e_ofb_3d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ofb_3d.c + +$(OBJ_D)\e_xcbc_d.obj: $(SRC_D)\crypto\evp\e_xcbc_d.c + $(CC) /Fo$(OBJ_D)\e_xcbc_d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_xcbc_d.c + +$(OBJ_D)\e_ecb_r2.obj: $(SRC_D)\crypto\evp\e_ecb_r2.c + $(CC) /Fo$(OBJ_D)\e_ecb_r2.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ecb_r2.c + +$(OBJ_D)\e_cbc_r2.obj: $(SRC_D)\crypto\evp\e_cbc_r2.c + $(CC) /Fo$(OBJ_D)\e_cbc_r2.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cbc_r2.c + +$(OBJ_D)\e_cfb_r2.obj: $(SRC_D)\crypto\evp\e_cfb_r2.c + $(CC) /Fo$(OBJ_D)\e_cfb_r2.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cfb_r2.c + +$(OBJ_D)\e_ofb_r2.obj: $(SRC_D)\crypto\evp\e_ofb_r2.c + $(CC) /Fo$(OBJ_D)\e_ofb_r2.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ofb_r2.c + +$(OBJ_D)\e_ecb_bf.obj: $(SRC_D)\crypto\evp\e_ecb_bf.c + $(CC) /Fo$(OBJ_D)\e_ecb_bf.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ecb_bf.c + +$(OBJ_D)\e_cbc_bf.obj: $(SRC_D)\crypto\evp\e_cbc_bf.c + $(CC) /Fo$(OBJ_D)\e_cbc_bf.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cbc_bf.c + +$(OBJ_D)\e_cfb_bf.obj: $(SRC_D)\crypto\evp\e_cfb_bf.c + $(CC) /Fo$(OBJ_D)\e_cfb_bf.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cfb_bf.c + +$(OBJ_D)\e_ofb_bf.obj: $(SRC_D)\crypto\evp\e_ofb_bf.c + $(CC) /Fo$(OBJ_D)\e_ofb_bf.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ofb_bf.c + +$(OBJ_D)\e_ecb_c.obj: $(SRC_D)\crypto\evp\e_ecb_c.c + $(CC) /Fo$(OBJ_D)\e_ecb_c.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ecb_c.c + +$(OBJ_D)\e_cbc_c.obj: $(SRC_D)\crypto\evp\e_cbc_c.c + $(CC) /Fo$(OBJ_D)\e_cbc_c.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cbc_c.c + +$(OBJ_D)\e_cfb_c.obj: $(SRC_D)\crypto\evp\e_cfb_c.c + $(CC) /Fo$(OBJ_D)\e_cfb_c.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cfb_c.c + +$(OBJ_D)\e_ofb_c.obj: $(SRC_D)\crypto\evp\e_ofb_c.c + $(CC) /Fo$(OBJ_D)\e_ofb_c.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ofb_c.c + +$(OBJ_D)\e_ecb_r5.obj: $(SRC_D)\crypto\evp\e_ecb_r5.c + $(CC) /Fo$(OBJ_D)\e_ecb_r5.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ecb_r5.c + +$(OBJ_D)\e_cbc_r5.obj: $(SRC_D)\crypto\evp\e_cbc_r5.c + $(CC) /Fo$(OBJ_D)\e_cbc_r5.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cbc_r5.c + +$(OBJ_D)\e_cfb_r5.obj: $(SRC_D)\crypto\evp\e_cfb_r5.c + $(CC) /Fo$(OBJ_D)\e_cfb_r5.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cfb_r5.c + +$(OBJ_D)\e_ofb_r5.obj: $(SRC_D)\crypto\evp\e_ofb_r5.c + $(CC) /Fo$(OBJ_D)\e_ofb_r5.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ofb_r5.c + +$(OBJ_D)\m_null.obj: $(SRC_D)\crypto\evp\m_null.c + $(CC) /Fo$(OBJ_D)\m_null.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_null.c + +$(OBJ_D)\m_md2.obj: $(SRC_D)\crypto\evp\m_md2.c + $(CC) /Fo$(OBJ_D)\m_md2.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_md2.c + +$(OBJ_D)\m_md5.obj: $(SRC_D)\crypto\evp\m_md5.c + $(CC) /Fo$(OBJ_D)\m_md5.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_md5.c + +$(OBJ_D)\m_sha.obj: $(SRC_D)\crypto\evp\m_sha.c + $(CC) /Fo$(OBJ_D)\m_sha.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_sha.c + +$(OBJ_D)\m_sha1.obj: $(SRC_D)\crypto\evp\m_sha1.c + $(CC) /Fo$(OBJ_D)\m_sha1.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_sha1.c + +$(OBJ_D)\m_dss.obj: $(SRC_D)\crypto\evp\m_dss.c + $(CC) /Fo$(OBJ_D)\m_dss.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_dss.c + +$(OBJ_D)\m_dss1.obj: $(SRC_D)\crypto\evp\m_dss1.c + $(CC) /Fo$(OBJ_D)\m_dss1.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_dss1.c + +$(OBJ_D)\m_mdc2.obj: $(SRC_D)\crypto\evp\m_mdc2.c + $(CC) /Fo$(OBJ_D)\m_mdc2.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_mdc2.c + +$(OBJ_D)\m_ripemd.obj: $(SRC_D)\crypto\evp\m_ripemd.c + $(CC) /Fo$(OBJ_D)\m_ripemd.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_ripemd.c + +$(OBJ_D)\p_open.obj: $(SRC_D)\crypto\evp\p_open.c + $(CC) /Fo$(OBJ_D)\p_open.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\p_open.c + +$(OBJ_D)\p_seal.obj: $(SRC_D)\crypto\evp\p_seal.c + $(CC) /Fo$(OBJ_D)\p_seal.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\p_seal.c + +$(OBJ_D)\p_sign.obj: $(SRC_D)\crypto\evp\p_sign.c + $(CC) /Fo$(OBJ_D)\p_sign.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\p_sign.c + +$(OBJ_D)\p_verify.obj: $(SRC_D)\crypto\evp\p_verify.c + $(CC) /Fo$(OBJ_D)\p_verify.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\p_verify.c + +$(OBJ_D)\p_lib.obj: $(SRC_D)\crypto\evp\p_lib.c + $(CC) /Fo$(OBJ_D)\p_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\p_lib.c + +$(OBJ_D)\p_enc.obj: $(SRC_D)\crypto\evp\p_enc.c + $(CC) /Fo$(OBJ_D)\p_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\p_enc.c + +$(OBJ_D)\p_dec.obj: $(SRC_D)\crypto\evp\p_dec.c + $(CC) /Fo$(OBJ_D)\p_dec.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\p_dec.c + +$(OBJ_D)\bio_md.obj: $(SRC_D)\crypto\evp\bio_md.c + $(CC) /Fo$(OBJ_D)\bio_md.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\bio_md.c + +$(OBJ_D)\bio_b64.obj: $(SRC_D)\crypto\evp\bio_b64.c + $(CC) /Fo$(OBJ_D)\bio_b64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\bio_b64.c + +$(OBJ_D)\bio_enc.obj: $(SRC_D)\crypto\evp\bio_enc.c + $(CC) /Fo$(OBJ_D)\bio_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\bio_enc.c + +$(OBJ_D)\evp_err.obj: $(SRC_D)\crypto\evp\evp_err.c + $(CC) /Fo$(OBJ_D)\evp_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\evp_err.c + +$(OBJ_D)\e_null.obj: $(SRC_D)\crypto\evp\e_null.c + $(CC) /Fo$(OBJ_D)\e_null.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_null.c + +$(OBJ_D)\c_all.obj: $(SRC_D)\crypto\evp\c_all.c + $(CC) /Fo$(OBJ_D)\c_all.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\c_all.c + +$(OBJ_D)\evp_lib.obj: $(SRC_D)\crypto\evp\evp_lib.c + $(CC) /Fo$(OBJ_D)\evp_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\evp_lib.c + +$(OBJ_D)\pem_sign.obj: $(SRC_D)\crypto\pem\pem_sign.c + $(CC) /Fo$(OBJ_D)\pem_sign.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pem\pem_sign.c + +$(OBJ_D)\pem_seal.obj: $(SRC_D)\crypto\pem\pem_seal.c + $(CC) /Fo$(OBJ_D)\pem_seal.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pem\pem_seal.c + +$(OBJ_D)\pem_info.obj: $(SRC_D)\crypto\pem\pem_info.c + $(CC) /Fo$(OBJ_D)\pem_info.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pem\pem_info.c + +$(OBJ_D)\pem_lib.obj: $(SRC_D)\crypto\pem\pem_lib.c + $(CC) /Fo$(OBJ_D)\pem_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pem\pem_lib.c + +$(OBJ_D)\pem_all.obj: $(SRC_D)\crypto\pem\pem_all.c + $(CC) /Fo$(OBJ_D)\pem_all.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pem\pem_all.c + +$(OBJ_D)\pem_err.obj: $(SRC_D)\crypto\pem\pem_err.c + $(CC) /Fo$(OBJ_D)\pem_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pem\pem_err.c + +$(OBJ_D)\a_object.obj: $(SRC_D)\crypto\asn1\a_object.c + $(CC) /Fo$(OBJ_D)\a_object.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_object.c + +$(OBJ_D)\a_bitstr.obj: $(SRC_D)\crypto\asn1\a_bitstr.c + $(CC) /Fo$(OBJ_D)\a_bitstr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_bitstr.c + +$(OBJ_D)\a_utctm.obj: $(SRC_D)\crypto\asn1\a_utctm.c + $(CC) /Fo$(OBJ_D)\a_utctm.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_utctm.c + +$(OBJ_D)\a_int.obj: $(SRC_D)\crypto\asn1\a_int.c + $(CC) /Fo$(OBJ_D)\a_int.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_int.c + +$(OBJ_D)\a_octet.obj: $(SRC_D)\crypto\asn1\a_octet.c + $(CC) /Fo$(OBJ_D)\a_octet.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_octet.c + +$(OBJ_D)\a_print.obj: $(SRC_D)\crypto\asn1\a_print.c + $(CC) /Fo$(OBJ_D)\a_print.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_print.c + +$(OBJ_D)\a_type.obj: $(SRC_D)\crypto\asn1\a_type.c + $(CC) /Fo$(OBJ_D)\a_type.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_type.c + +$(OBJ_D)\a_set.obj: $(SRC_D)\crypto\asn1\a_set.c + $(CC) /Fo$(OBJ_D)\a_set.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_set.c + +$(OBJ_D)\a_dup.obj: $(SRC_D)\crypto\asn1\a_dup.c + $(CC) /Fo$(OBJ_D)\a_dup.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_dup.c + +$(OBJ_D)\a_d2i_fp.obj: $(SRC_D)\crypto\asn1\a_d2i_fp.c + $(CC) /Fo$(OBJ_D)\a_d2i_fp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_d2i_fp.c + +$(OBJ_D)\a_i2d_fp.obj: $(SRC_D)\crypto\asn1\a_i2d_fp.c + $(CC) /Fo$(OBJ_D)\a_i2d_fp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_i2d_fp.c + +$(OBJ_D)\a_sign.obj: $(SRC_D)\crypto\asn1\a_sign.c + $(CC) /Fo$(OBJ_D)\a_sign.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_sign.c + +$(OBJ_D)\a_digest.obj: $(SRC_D)\crypto\asn1\a_digest.c + $(CC) /Fo$(OBJ_D)\a_digest.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_digest.c + +$(OBJ_D)\a_verify.obj: $(SRC_D)\crypto\asn1\a_verify.c + $(CC) /Fo$(OBJ_D)\a_verify.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_verify.c + +$(OBJ_D)\x_algor.obj: $(SRC_D)\crypto\asn1\x_algor.c + $(CC) /Fo$(OBJ_D)\x_algor.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_algor.c + +$(OBJ_D)\x_val.obj: $(SRC_D)\crypto\asn1\x_val.c + $(CC) /Fo$(OBJ_D)\x_val.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_val.c + +$(OBJ_D)\x_pubkey.obj: $(SRC_D)\crypto\asn1\x_pubkey.c + $(CC) /Fo$(OBJ_D)\x_pubkey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_pubkey.c + +$(OBJ_D)\x_sig.obj: $(SRC_D)\crypto\asn1\x_sig.c + $(CC) /Fo$(OBJ_D)\x_sig.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_sig.c + +$(OBJ_D)\x_req.obj: $(SRC_D)\crypto\asn1\x_req.c + $(CC) /Fo$(OBJ_D)\x_req.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_req.c + +$(OBJ_D)\x_attrib.obj: $(SRC_D)\crypto\asn1\x_attrib.c + $(CC) /Fo$(OBJ_D)\x_attrib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_attrib.c + +$(OBJ_D)\x_name.obj: $(SRC_D)\crypto\asn1\x_name.c + $(CC) /Fo$(OBJ_D)\x_name.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_name.c + +$(OBJ_D)\x_cinf.obj: $(SRC_D)\crypto\asn1\x_cinf.c + $(CC) /Fo$(OBJ_D)\x_cinf.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_cinf.c + +$(OBJ_D)\x_x509.obj: $(SRC_D)\crypto\asn1\x_x509.c + $(CC) /Fo$(OBJ_D)\x_x509.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_x509.c + +$(OBJ_D)\x_crl.obj: $(SRC_D)\crypto\asn1\x_crl.c + $(CC) /Fo$(OBJ_D)\x_crl.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_crl.c + +$(OBJ_D)\x_info.obj: $(SRC_D)\crypto\asn1\x_info.c + $(CC) /Fo$(OBJ_D)\x_info.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_info.c + +$(OBJ_D)\x_spki.obj: $(SRC_D)\crypto\asn1\x_spki.c + $(CC) /Fo$(OBJ_D)\x_spki.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_spki.c + +$(OBJ_D)\d2i_r_pr.obj: $(SRC_D)\crypto\asn1\d2i_r_pr.c + $(CC) /Fo$(OBJ_D)\d2i_r_pr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\d2i_r_pr.c + +$(OBJ_D)\i2d_r_pr.obj: $(SRC_D)\crypto\asn1\i2d_r_pr.c + $(CC) /Fo$(OBJ_D)\i2d_r_pr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\i2d_r_pr.c + +$(OBJ_D)\d2i_r_pu.obj: $(SRC_D)\crypto\asn1\d2i_r_pu.c + $(CC) /Fo$(OBJ_D)\d2i_r_pu.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\d2i_r_pu.c + +$(OBJ_D)\i2d_r_pu.obj: $(SRC_D)\crypto\asn1\i2d_r_pu.c + $(CC) /Fo$(OBJ_D)\i2d_r_pu.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\i2d_r_pu.c + +$(OBJ_D)\d2i_s_pr.obj: $(SRC_D)\crypto\asn1\d2i_s_pr.c + $(CC) /Fo$(OBJ_D)\d2i_s_pr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\d2i_s_pr.c + +$(OBJ_D)\i2d_s_pr.obj: $(SRC_D)\crypto\asn1\i2d_s_pr.c + $(CC) /Fo$(OBJ_D)\i2d_s_pr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\i2d_s_pr.c + +$(OBJ_D)\d2i_s_pu.obj: $(SRC_D)\crypto\asn1\d2i_s_pu.c + $(CC) /Fo$(OBJ_D)\d2i_s_pu.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\d2i_s_pu.c + +$(OBJ_D)\i2d_s_pu.obj: $(SRC_D)\crypto\asn1\i2d_s_pu.c + $(CC) /Fo$(OBJ_D)\i2d_s_pu.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\i2d_s_pu.c + +$(OBJ_D)\d2i_pu.obj: $(SRC_D)\crypto\asn1\d2i_pu.c + $(CC) /Fo$(OBJ_D)\d2i_pu.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\d2i_pu.c + +$(OBJ_D)\d2i_pr.obj: $(SRC_D)\crypto\asn1\d2i_pr.c + $(CC) /Fo$(OBJ_D)\d2i_pr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\d2i_pr.c + +$(OBJ_D)\i2d_pu.obj: $(SRC_D)\crypto\asn1\i2d_pu.c + $(CC) /Fo$(OBJ_D)\i2d_pu.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\i2d_pu.c + +$(OBJ_D)\i2d_pr.obj: $(SRC_D)\crypto\asn1\i2d_pr.c + $(CC) /Fo$(OBJ_D)\i2d_pr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\i2d_pr.c + +$(OBJ_D)\t_req.obj: $(SRC_D)\crypto\asn1\t_req.c + $(CC) /Fo$(OBJ_D)\t_req.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\t_req.c + +$(OBJ_D)\t_x509.obj: $(SRC_D)\crypto\asn1\t_x509.c + $(CC) /Fo$(OBJ_D)\t_x509.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\t_x509.c + +$(OBJ_D)\t_pkey.obj: $(SRC_D)\crypto\asn1\t_pkey.c + $(CC) /Fo$(OBJ_D)\t_pkey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\t_pkey.c + +$(OBJ_D)\p7_i_s.obj: $(SRC_D)\crypto\asn1\p7_i_s.c + $(CC) /Fo$(OBJ_D)\p7_i_s.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_i_s.c + +$(OBJ_D)\p7_signi.obj: $(SRC_D)\crypto\asn1\p7_signi.c + $(CC) /Fo$(OBJ_D)\p7_signi.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_signi.c + +$(OBJ_D)\p7_signd.obj: $(SRC_D)\crypto\asn1\p7_signd.c + $(CC) /Fo$(OBJ_D)\p7_signd.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_signd.c + +$(OBJ_D)\p7_recip.obj: $(SRC_D)\crypto\asn1\p7_recip.c + $(CC) /Fo$(OBJ_D)\p7_recip.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_recip.c + +$(OBJ_D)\p7_enc_c.obj: $(SRC_D)\crypto\asn1\p7_enc_c.c + $(CC) /Fo$(OBJ_D)\p7_enc_c.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_enc_c.c + +$(OBJ_D)\p7_evp.obj: $(SRC_D)\crypto\asn1\p7_evp.c + $(CC) /Fo$(OBJ_D)\p7_evp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_evp.c + +$(OBJ_D)\p7_dgst.obj: $(SRC_D)\crypto\asn1\p7_dgst.c + $(CC) /Fo$(OBJ_D)\p7_dgst.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_dgst.c + +$(OBJ_D)\p7_s_e.obj: $(SRC_D)\crypto\asn1\p7_s_e.c + $(CC) /Fo$(OBJ_D)\p7_s_e.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_s_e.c + +$(OBJ_D)\p7_enc.obj: $(SRC_D)\crypto\asn1\p7_enc.c + $(CC) /Fo$(OBJ_D)\p7_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_enc.c + +$(OBJ_D)\p7_lib.obj: $(SRC_D)\crypto\asn1\p7_lib.c + $(CC) /Fo$(OBJ_D)\p7_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_lib.c + +$(OBJ_D)\f_int.obj: $(SRC_D)\crypto\asn1\f_int.c + $(CC) /Fo$(OBJ_D)\f_int.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\f_int.c + +$(OBJ_D)\f_string.obj: $(SRC_D)\crypto\asn1\f_string.c + $(CC) /Fo$(OBJ_D)\f_string.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\f_string.c + +$(OBJ_D)\i2d_dhp.obj: $(SRC_D)\crypto\asn1\i2d_dhp.c + $(CC) /Fo$(OBJ_D)\i2d_dhp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\i2d_dhp.c + +$(OBJ_D)\i2d_dsap.obj: $(SRC_D)\crypto\asn1\i2d_dsap.c + $(CC) /Fo$(OBJ_D)\i2d_dsap.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\i2d_dsap.c + +$(OBJ_D)\d2i_dhp.obj: $(SRC_D)\crypto\asn1\d2i_dhp.c + $(CC) /Fo$(OBJ_D)\d2i_dhp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\d2i_dhp.c + +$(OBJ_D)\d2i_dsap.obj: $(SRC_D)\crypto\asn1\d2i_dsap.c + $(CC) /Fo$(OBJ_D)\d2i_dsap.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\d2i_dsap.c + +$(OBJ_D)\n_pkey.obj: $(SRC_D)\crypto\asn1\n_pkey.c + $(CC) /Fo$(OBJ_D)\n_pkey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\n_pkey.c + +$(OBJ_D)\a_hdr.obj: $(SRC_D)\crypto\asn1\a_hdr.c + $(CC) /Fo$(OBJ_D)\a_hdr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_hdr.c + +$(OBJ_D)\x_pkey.obj: $(SRC_D)\crypto\asn1\x_pkey.c + $(CC) /Fo$(OBJ_D)\x_pkey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_pkey.c + +$(OBJ_D)\a_bool.obj: $(SRC_D)\crypto\asn1\a_bool.c + $(CC) /Fo$(OBJ_D)\a_bool.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_bool.c + +$(OBJ_D)\x_exten.obj: $(SRC_D)\crypto\asn1\x_exten.c + $(CC) /Fo$(OBJ_D)\x_exten.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_exten.c + +$(OBJ_D)\asn1_par.obj: $(SRC_D)\crypto\asn1\asn1_par.c + $(CC) /Fo$(OBJ_D)\asn1_par.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\asn1_par.c + +$(OBJ_D)\asn1_lib.obj: $(SRC_D)\crypto\asn1\asn1_lib.c + $(CC) /Fo$(OBJ_D)\asn1_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\asn1_lib.c + +$(OBJ_D)\asn1_err.obj: $(SRC_D)\crypto\asn1\asn1_err.c + $(CC) /Fo$(OBJ_D)\asn1_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\asn1_err.c + +$(OBJ_D)\a_meth.obj: $(SRC_D)\crypto\asn1\a_meth.c + $(CC) /Fo$(OBJ_D)\a_meth.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_meth.c + +$(OBJ_D)\a_bytes.obj: $(SRC_D)\crypto\asn1\a_bytes.c + $(CC) /Fo$(OBJ_D)\a_bytes.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_bytes.c + +$(OBJ_D)\evp_asn1.obj: $(SRC_D)\crypto\asn1\evp_asn1.c + $(CC) /Fo$(OBJ_D)\evp_asn1.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\evp_asn1.c + +$(OBJ_D)\x509_def.obj: $(SRC_D)\crypto\x509\x509_def.c + $(CC) /Fo$(OBJ_D)\x509_def.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_def.c + +$(OBJ_D)\x509_d2.obj: $(SRC_D)\crypto\x509\x509_d2.c + $(CC) /Fo$(OBJ_D)\x509_d2.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_d2.c + +$(OBJ_D)\x509_r2x.obj: $(SRC_D)\crypto\x509\x509_r2x.c + $(CC) /Fo$(OBJ_D)\x509_r2x.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_r2x.c + +$(OBJ_D)\x509_cmp.obj: $(SRC_D)\crypto\x509\x509_cmp.c + $(CC) /Fo$(OBJ_D)\x509_cmp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_cmp.c + +$(OBJ_D)\x509_obj.obj: $(SRC_D)\crypto\x509\x509_obj.c + $(CC) /Fo$(OBJ_D)\x509_obj.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_obj.c + +$(OBJ_D)\x509_req.obj: $(SRC_D)\crypto\x509\x509_req.c + $(CC) /Fo$(OBJ_D)\x509_req.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_req.c + +$(OBJ_D)\x509_vfy.obj: $(SRC_D)\crypto\x509\x509_vfy.c + $(CC) /Fo$(OBJ_D)\x509_vfy.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_vfy.c + +$(OBJ_D)\x509_set.obj: $(SRC_D)\crypto\x509\x509_set.c + $(CC) /Fo$(OBJ_D)\x509_set.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_set.c + +$(OBJ_D)\x509rset.obj: $(SRC_D)\crypto\x509\x509rset.c + $(CC) /Fo$(OBJ_D)\x509rset.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509rset.c + +$(OBJ_D)\x509_err.obj: $(SRC_D)\crypto\x509\x509_err.c + $(CC) /Fo$(OBJ_D)\x509_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_err.c + +$(OBJ_D)\x509name.obj: $(SRC_D)\crypto\x509\x509name.c + $(CC) /Fo$(OBJ_D)\x509name.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509name.c + +$(OBJ_D)\x509_v3.obj: $(SRC_D)\crypto\x509\x509_v3.c + $(CC) /Fo$(OBJ_D)\x509_v3.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_v3.c + +$(OBJ_D)\x509_ext.obj: $(SRC_D)\crypto\x509\x509_ext.c + $(CC) /Fo$(OBJ_D)\x509_ext.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_ext.c + +$(OBJ_D)\x509pack.obj: $(SRC_D)\crypto\x509\x509pack.c + $(CC) /Fo$(OBJ_D)\x509pack.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509pack.c + +$(OBJ_D)\x509type.obj: $(SRC_D)\crypto\x509\x509type.c + $(CC) /Fo$(OBJ_D)\x509type.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509type.c + +$(OBJ_D)\x509_lu.obj: $(SRC_D)\crypto\x509\x509_lu.c + $(CC) /Fo$(OBJ_D)\x509_lu.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_lu.c + +$(OBJ_D)\x_all.obj: $(SRC_D)\crypto\x509\x_all.c + $(CC) /Fo$(OBJ_D)\x_all.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x_all.c + +$(OBJ_D)\x509_txt.obj: $(SRC_D)\crypto\x509\x509_txt.c + $(CC) /Fo$(OBJ_D)\x509_txt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_txt.c + +$(OBJ_D)\by_file.obj: $(SRC_D)\crypto\x509\by_file.c + $(CC) /Fo$(OBJ_D)\by_file.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\by_file.c + +$(OBJ_D)\by_dir.obj: $(SRC_D)\crypto\x509\by_dir.c + $(CC) /Fo$(OBJ_D)\by_dir.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\by_dir.c + +$(OBJ_D)\v3_net.obj: $(SRC_D)\crypto\x509\v3_net.c + $(CC) /Fo$(OBJ_D)\v3_net.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\v3_net.c + +$(OBJ_D)\v3_x509.obj: $(SRC_D)\crypto\x509\v3_x509.c + $(CC) /Fo$(OBJ_D)\v3_x509.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\v3_x509.c + +$(OBJ_D)\conf.obj: $(SRC_D)\crypto\conf\conf.c + $(CC) /Fo$(OBJ_D)\conf.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\conf\conf.c + +$(OBJ_D)\conf_err.obj: $(SRC_D)\crypto\conf\conf_err.c + $(CC) /Fo$(OBJ_D)\conf_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\conf\conf_err.c + +$(OBJ_D)\txt_db.obj: $(SRC_D)\crypto\txt_db\txt_db.c + $(CC) /Fo$(OBJ_D)\txt_db.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\txt_db\txt_db.c + +$(OBJ_D)\pk7_lib.obj: $(SRC_D)\crypto\pkcs7\pk7_lib.c + $(CC) /Fo$(OBJ_D)\pk7_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pkcs7\pk7_lib.c + +$(OBJ_D)\pkcs7err.obj: $(SRC_D)\crypto\pkcs7\pkcs7err.c + $(CC) /Fo$(OBJ_D)\pkcs7err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pkcs7\pkcs7err.c + +$(OBJ_D)\pk7_doit.obj: $(SRC_D)\crypto\pkcs7\pk7_doit.c + $(CC) /Fo$(OBJ_D)\pk7_doit.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pkcs7\pk7_doit.c + +$(OBJ_D)\s2_meth.obj: $(SRC_D)\ssl\s2_meth.c + $(CC) /Fo$(OBJ_D)\s2_meth.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s2_meth.c + +$(OBJ_D)\s2_srvr.obj: $(SRC_D)\ssl\s2_srvr.c + $(CC) /Fo$(OBJ_D)\s2_srvr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s2_srvr.c + +$(OBJ_D)\s2_clnt.obj: $(SRC_D)\ssl\s2_clnt.c + $(CC) /Fo$(OBJ_D)\s2_clnt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s2_clnt.c + +$(OBJ_D)\s2_lib.obj: $(SRC_D)\ssl\s2_lib.c + $(CC) /Fo$(OBJ_D)\s2_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s2_lib.c + +$(OBJ_D)\s2_enc.obj: $(SRC_D)\ssl\s2_enc.c + $(CC) /Fo$(OBJ_D)\s2_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s2_enc.c + +$(OBJ_D)\s2_pkt.obj: $(SRC_D)\ssl\s2_pkt.c + $(CC) /Fo$(OBJ_D)\s2_pkt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s2_pkt.c + +$(OBJ_D)\s3_meth.obj: $(SRC_D)\ssl\s3_meth.c + $(CC) /Fo$(OBJ_D)\s3_meth.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s3_meth.c + +$(OBJ_D)\s3_srvr.obj: $(SRC_D)\ssl\s3_srvr.c + $(CC) /Fo$(OBJ_D)\s3_srvr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s3_srvr.c + +$(OBJ_D)\s3_clnt.obj: $(SRC_D)\ssl\s3_clnt.c + $(CC) /Fo$(OBJ_D)\s3_clnt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s3_clnt.c + +$(OBJ_D)\s3_lib.obj: $(SRC_D)\ssl\s3_lib.c + $(CC) /Fo$(OBJ_D)\s3_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s3_lib.c + +$(OBJ_D)\s3_enc.obj: $(SRC_D)\ssl\s3_enc.c + $(CC) /Fo$(OBJ_D)\s3_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s3_enc.c + +$(OBJ_D)\s3_pkt.obj: $(SRC_D)\ssl\s3_pkt.c + $(CC) /Fo$(OBJ_D)\s3_pkt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s3_pkt.c + +$(OBJ_D)\s3_both.obj: $(SRC_D)\ssl\s3_both.c + $(CC) /Fo$(OBJ_D)\s3_both.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s3_both.c + +$(OBJ_D)\s23_meth.obj: $(SRC_D)\ssl\s23_meth.c + $(CC) /Fo$(OBJ_D)\s23_meth.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s23_meth.c + +$(OBJ_D)\s23_srvr.obj: $(SRC_D)\ssl\s23_srvr.c + $(CC) /Fo$(OBJ_D)\s23_srvr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s23_srvr.c + +$(OBJ_D)\s23_clnt.obj: $(SRC_D)\ssl\s23_clnt.c + $(CC) /Fo$(OBJ_D)\s23_clnt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s23_clnt.c + +$(OBJ_D)\s23_lib.obj: $(SRC_D)\ssl\s23_lib.c + $(CC) /Fo$(OBJ_D)\s23_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s23_lib.c + +$(OBJ_D)\s23_pkt.obj: $(SRC_D)\ssl\s23_pkt.c + $(CC) /Fo$(OBJ_D)\s23_pkt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s23_pkt.c + +$(OBJ_D)\t1_meth.obj: $(SRC_D)\ssl\t1_meth.c + $(CC) /Fo$(OBJ_D)\t1_meth.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\t1_meth.c + +$(OBJ_D)\t1_srvr.obj: $(SRC_D)\ssl\t1_srvr.c + $(CC) /Fo$(OBJ_D)\t1_srvr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\t1_srvr.c + +$(OBJ_D)\t1_clnt.obj: $(SRC_D)\ssl\t1_clnt.c + $(CC) /Fo$(OBJ_D)\t1_clnt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\t1_clnt.c + +$(OBJ_D)\t1_lib.obj: $(SRC_D)\ssl\t1_lib.c + $(CC) /Fo$(OBJ_D)\t1_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\t1_lib.c + +$(OBJ_D)\t1_enc.obj: $(SRC_D)\ssl\t1_enc.c + $(CC) /Fo$(OBJ_D)\t1_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\t1_enc.c + +$(OBJ_D)\ssl_lib.obj: $(SRC_D)\ssl\ssl_lib.c + $(CC) /Fo$(OBJ_D)\ssl_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_lib.c + +$(OBJ_D)\ssl_err2.obj: $(SRC_D)\ssl\ssl_err2.c + $(CC) /Fo$(OBJ_D)\ssl_err2.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_err2.c + +$(OBJ_D)\ssl_cert.obj: $(SRC_D)\ssl\ssl_cert.c + $(CC) /Fo$(OBJ_D)\ssl_cert.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_cert.c + +$(OBJ_D)\ssl_sess.obj: $(SRC_D)\ssl\ssl_sess.c + $(CC) /Fo$(OBJ_D)\ssl_sess.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_sess.c + +$(OBJ_D)\ssl_ciph.obj: $(SRC_D)\ssl\ssl_ciph.c + $(CC) /Fo$(OBJ_D)\ssl_ciph.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_ciph.c + +$(OBJ_D)\ssl_stat.obj: $(SRC_D)\ssl\ssl_stat.c + $(CC) /Fo$(OBJ_D)\ssl_stat.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_stat.c + +$(OBJ_D)\ssl_rsa.obj: $(SRC_D)\ssl\ssl_rsa.c + $(CC) /Fo$(OBJ_D)\ssl_rsa.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_rsa.c + +$(OBJ_D)\ssl_asn1.obj: $(SRC_D)\ssl\ssl_asn1.c + $(CC) /Fo$(OBJ_D)\ssl_asn1.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_asn1.c + +$(OBJ_D)\ssl_txt.obj: $(SRC_D)\ssl\ssl_txt.c + $(CC) /Fo$(OBJ_D)\ssl_txt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_txt.c + +$(OBJ_D)\ssl_algs.obj: $(SRC_D)\ssl\ssl_algs.c + $(CC) /Fo$(OBJ_D)\ssl_algs.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_algs.c + +$(OBJ_D)\bio_ssl.obj: $(SRC_D)\ssl\bio_ssl.c + $(CC) /Fo$(OBJ_D)\bio_ssl.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\bio_ssl.c + +$(OBJ_D)\ssl_err.obj: $(SRC_D)\ssl\ssl_err.c + $(CC) /Fo$(OBJ_D)\ssl_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_err.c + +$(OBJ_D)\rsaref.obj: $(SRC_D)\rsaref\rsaref.c + $(CC) /Fo$(OBJ_D)\rsaref.obj $(LIB_CFLAGS) -c $(SRC_D)\rsaref\rsaref.c + +$(OBJ_D)\rsar_err.obj: $(SRC_D)\rsaref\rsar_err.c + $(CC) /Fo$(OBJ_D)\rsar_err.obj $(LIB_CFLAGS) -c $(SRC_D)\rsaref\rsar_err.c + +$(TEST_D)\md2test.exe: $(OBJ_D)\md2test.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\md2test.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\md2test.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\md5test.exe: $(OBJ_D)\md5test.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\md5test.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\md5test.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\shatest.exe: $(OBJ_D)\shatest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\shatest.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\shatest.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\sha1test.exe: $(OBJ_D)\sha1test.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\sha1test.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\sha1test.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\mdc2test.exe: $(OBJ_D)\mdc2test.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\mdc2test.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\mdc2test.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\hmactest.exe: $(OBJ_D)\hmactest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\hmactest.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\hmactest.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\rmdtest.exe: $(OBJ_D)\rmdtest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\rmdtest.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\rmdtest.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\destest.exe: $(OBJ_D)\destest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\destest.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\destest.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\rc2test.exe: $(OBJ_D)\rc2test.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\rc2test.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\rc2test.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\rc4test.exe: $(OBJ_D)\rc4test.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\rc4test.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\rc4test.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\rc5test.exe: $(OBJ_D)\rc5test.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\rc5test.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\rc5test.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\ideatest.exe: $(OBJ_D)\ideatest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\ideatest.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\ideatest.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\bftest.exe: $(OBJ_D)\bftest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\bftest.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\bftest.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\casttest.exe: $(OBJ_D)\casttest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\casttest.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\casttest.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\bntest.exe: $(OBJ_D)\bntest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\bntest.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\bntest.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\exptest.exe: $(OBJ_D)\exptest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\exptest.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\exptest.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\dsatest.exe: $(OBJ_D)\dsatest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\dsatest.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\dsatest.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\dhtest.exe: $(OBJ_D)\dhtest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\dhtest.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\dhtest.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\randtest.exe: $(OBJ_D)\randtest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\randtest.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\randtest.obj $(L_LIBS) $(EX_LIBS) +<< + +$(TEST_D)\ssltest.exe: $(OBJ_D)\ssltest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(TEST_D)\ssltest.exe @<< + $(APP_EX_OBJ) $(OBJ_D)\ssltest.obj $(L_LIBS) $(EX_LIBS) +<< + +$(O_SSL): $(SSLOBJ) + $(LINK) $(MLFLAGS) /out:$(O_SSL) /def:ms/SSLEAY32.def @<< + $(SHLIB_EX_OBJ) $(SSLOBJ) $(L_CRYPTO) wsock32.lib gdi32.lib +<< + +$(O_RSAGLUE): $(RSAGLUEOBJ) + $(MKLIB) /out:$(O_RSAGLUE) @<< + $(RSAGLUEOBJ) +<< + +$(O_CRYPTO): $(CRYPTOOBJ) + $(LINK) $(MLFLAGS) /out:$(O_CRYPTO) /def:ms/LIBEAY32.def @<< + $(SHLIB_EX_OBJ) $(CRYPTOOBJ) wsock32.lib gdi32.lib +<< + +$(BIN_D)\$(E_EXE).exe: $(E_OBJ) $(LIBS_DEP) + $(LINK) $(LFLAGS) /out:$(BIN_D)\$(E_EXE).exe @<< + $(APP_EX_OBJ) $(E_OBJ) $(L_LIBS) $(EX_LIBS) +<< + diff --git a/src/lib/libssl/src/ms/ssleay16.def b/src/lib/libssl/src/ms/ssleay16.def new file mode 100644 index 0000000000..2c61644308 --- /dev/null +++ b/src/lib/libssl/src/ms/ssleay16.def @@ -0,0 +1,171 @@ +; +; Definition file for the DDL version of the SSLEAY16 library from SSLeay +; + +LIBRARY SSLEAY16 + +DESCRIPTION 'SSLeay SSLEAY16 - eay@cryptsoft.com' + +CODE PRELOAD MOVEABLE +DATA PRELOAD MOVEABLE SINGLE + +EXETYPE WINDOWS + +HEAPSIZE 4096 +STACKSIZE 8192 + +EXPORTS + _SSLeay_add_ssl_algorithms @109 + _BIO_f_ssl @121 + _BIO_new_buffer_ssl_connect @173 + _BIO_new_ssl @122 + _BIO_new_ssl_connect @174 + _BIO_ssl_copy_session_id @124 + _BIO_ssl_shutdown @131 + _ERR_load_SSL_strings @1 + _SSL_CIPHER_description @2 + _SSL_CIPHER_get_bits @128 + _SSL_CIPHER_get_name @130 + _SSL_CIPHER_get_version @129 + _SSL_CTX_add_client_CA @3 + _SSL_CTX_add_session @4 + _SSL_CTX_check_private_key @5 + _SSL_CTX_ctrl @6 + _SSL_CTX_flush_sessions @7 + _SSL_CTX_free @8 + _SSL_CTX_get_client_CA_list @9 + _SSL_CTX_get_ex_data @138 + _SSL_CTX_get_ex_new_index @167 + _SSL_CTX_get_quiet_shutdown @140 + _SSL_CTX_get_verify_callback @10 + _SSL_CTX_get_verify_mode @11 + _SSL_CTX_load_verify_locations @141 + _SSL_CTX_new @12 + _SSL_CTX_remove_session @13 + _SSL_CTX_set_cert_verify_cb @14 + _SSL_CTX_set_cipher_list @15 + _SSL_CTX_set_client_CA_list @16 + _SSL_CTX_set_default_passwd_cb @17 + _SSL_CTX_set_default_verify_paths @142 + _SSL_CTX_set_ex_data @143 + _SSL_CTX_set_quiet_shutdown @145 + _SSL_CTX_set_ssl_version @19 + _SSL_CTX_set_verify @21 + _SSL_CTX_use_PrivateKey @22 + _SSL_CTX_use_PrivateKey_ASN1 @23 + _SSL_CTX_use_PrivateKey_file @24 + _SSL_CTX_use_RSAPrivateKey @25 + _SSL_CTX_use_RSAPrivateKey_ASN1 @26 + _SSL_CTX_use_RSAPrivateKey_file @27 + _SSL_CTX_use_certificate @28 + _SSL_CTX_use_certificate_ASN1 @29 + _SSL_CTX_use_certificate_file @30 + _SSL_SESSION_cmp @132 + _SSL_SESSION_free @31 + _SSL_SESSION_get_ex_data @146 + _SSL_SESSION_get_ex_new_index @168 + _SSL_SESSION_get_time @134 + _SSL_SESSION_get_timeout @136 + _SSL_SESSION_hash @133 + _SSL_SESSION_new @32 + _SSL_SESSION_print @33 + _SSL_SESSION_set_ex_data @148 + _SSL_SESSION_set_time @135 + _SSL_SESSION_set_timeout @137 + _SSL_accept @35 + _SSL_add_client_CA @36 + _SSL_alert_desc_string @37 + _SSL_alert_desc_string_long @38 + _SSL_alert_type_string @39 + _SSL_alert_type_string_long @40 + _SSL_check_private_key @41 + _SSL_clear @42 + _SSL_connect @43 + _SSL_copy_session_id @44 + _SSL_ctrl @45 + _SSL_do_handshake @125 + _SSL_dup @46 + _SSL_dup_CA_list @47 + _SSL_free @48 + _SSL_get_SSL_CTX @150 + _SSL_get_certificate @49 + _SSL_get_cipher_list @52 + _SSL_get_ciphers @55 + _SSL_get_client_CA_list @56 + _SSL_get_current_cipher @127 + _SSL_get_default_timeout @57 + _SSL_get_error @58 + _SSL_get_ex_data @151 + _SSL_get_ex_new_index @169 + _SSL_get_fd @59 + _SSL_get_info_callback @165 + _SSL_get_peer_cert_chain @60 + _SSL_get_peer_certificate @61 + _SSL_get_privatekey @126 + _SSL_get_quiet_shutdown @153 + _SSL_get_rbio @63 + _SSL_get_read_ahead @64 + _SSL_get_session @154 + _SSL_get_shared_ciphers @65 + _SSL_get_shutdown @155 + _SSL_get_ssl_method @66 + _SSL_get_verify_mode @70 + _SSL_get_verify_result @157 + _SSL_get_version @71 + _SSL_get_wbio @72 + _SSL_load_client_CA_file @73 + _SSL_load_error_strings @74 + _SSL_new @75 + _SSL_peek @76 + _SSL_pending @77 + _SSL_read @78 + _SSL_renegotiate @79 + _SSL_rstate_string @80 + _SSL_rstate_string_long @81 + _SSL_set_accept_state @82 + _SSL_set_bio @83 + _SSL_set_cipher_list @84 + _SSL_set_client_CA_list @85 + _SSL_set_connect_state @86 + _SSL_set_ex_data @158 + _SSL_set_fd @87 + _SSL_set_info_callback @160 + _SSL_set_quiet_shutdown @161 + _SSL_set_read_ahead @88 + _SSL_set_rfd @89 + _SSL_set_session @90 + _SSL_set_shutdown @162 + _SSL_set_ssl_method @91 + _SSL_set_verify @94 + _SSL_set_verify_result @163 + _SSL_set_wfd @95 + _SSL_shutdown @96 + _SSL_state @166 + _SSL_state_string @97 + _SSL_state_string_long @98 + _SSL_use_PrivateKey @99 + _SSL_use_PrivateKey_ASN1 @100 + _SSL_use_PrivateKey_file @101 + _SSL_use_RSAPrivateKey @102 + _SSL_use_RSAPrivateKey_ASN1 @103 + _SSL_use_RSAPrivateKey_file @104 + _SSL_use_certificate @105 + _SSL_use_certificate_ASN1 @106 + _SSL_use_certificate_file @107 + _SSL_version @164 + _SSL_write @108 + _SSLv23_client_method @110 + _SSLv23_method @111 + _SSLv23_server_method @112 + _SSLv2_client_method @113 + _SSLv2_method @114 + _SSLv2_server_method @115 + _SSLv3_client_method @116 + _SSLv3_method @117 + _SSLv3_server_method @118 + _TLSv1_client_method @172 + _TLSv1_method @170 + _TLSv1_server_method @171 + _d2i_SSL_SESSION @119 + _i2d_SSL_SESSION @120 + diff --git a/src/lib/libssl/src/ms/ssleay32.def b/src/lib/libssl/src/ms/ssleay32.def new file mode 100644 index 0000000000..aa823b8069 --- /dev/null +++ b/src/lib/libssl/src/ms/ssleay32.def @@ -0,0 +1,164 @@ +; +; Definition file for the DDL version of the SSLEAY32 library from SSLeay +; + +LIBRARY SSLEAY32 + +DESCRIPTION 'SSLeay SSLEAY32 - eay@cryptsoft.com' + +EXPORTS + SSLeay_add_ssl_algorithms @109 + BIO_f_ssl @121 + BIO_new_buffer_ssl_connect @173 + BIO_new_ssl @122 + BIO_new_ssl_connect @174 + BIO_ssl_copy_session_id @124 + BIO_ssl_shutdown @131 + ERR_load_SSL_strings @1 + SSL_CIPHER_description @2 + SSL_CIPHER_get_bits @128 + SSL_CIPHER_get_name @130 + SSL_CIPHER_get_version @129 + SSL_CTX_add_client_CA @3 + SSL_CTX_add_session @4 + SSL_CTX_check_private_key @5 + SSL_CTX_ctrl @6 + SSL_CTX_flush_sessions @7 + SSL_CTX_free @8 + SSL_CTX_get_client_CA_list @9 + SSL_CTX_get_ex_data @138 + SSL_CTX_get_ex_new_index @167 + SSL_CTX_get_quiet_shutdown @140 + SSL_CTX_get_verify_callback @10 + SSL_CTX_get_verify_mode @11 + SSL_CTX_load_verify_locations @141 + SSL_CTX_new @12 + SSL_CTX_remove_session @13 + SSL_CTX_set_cert_verify_cb @14 + SSL_CTX_set_cipher_list @15 + SSL_CTX_set_client_CA_list @16 + SSL_CTX_set_default_passwd_cb @17 + SSL_CTX_set_default_verify_paths @142 + SSL_CTX_set_ex_data @143 + SSL_CTX_set_quiet_shutdown @145 + SSL_CTX_set_ssl_version @19 + SSL_CTX_set_verify @21 + SSL_CTX_use_PrivateKey @22 + SSL_CTX_use_PrivateKey_ASN1 @23 + SSL_CTX_use_PrivateKey_file @24 + SSL_CTX_use_RSAPrivateKey @25 + SSL_CTX_use_RSAPrivateKey_ASN1 @26 + SSL_CTX_use_RSAPrivateKey_file @27 + SSL_CTX_use_certificate @28 + SSL_CTX_use_certificate_ASN1 @29 + SSL_CTX_use_certificate_file @30 + SSL_SESSION_cmp @132 + SSL_SESSION_free @31 + SSL_SESSION_get_ex_data @146 + SSL_SESSION_get_ex_new_index @168 + SSL_SESSION_get_time @134 + SSL_SESSION_get_timeout @136 + SSL_SESSION_hash @133 + SSL_SESSION_new @32 + SSL_SESSION_print @33 + SSL_SESSION_print_fp @34 + SSL_SESSION_set_ex_data @148 + SSL_SESSION_set_time @135 + SSL_SESSION_set_timeout @137 + SSL_accept @35 + SSL_add_client_CA @36 + SSL_alert_desc_string @37 + SSL_alert_desc_string_long @38 + SSL_alert_type_string @39 + SSL_alert_type_string_long @40 + SSL_check_private_key @41 + SSL_clear @42 + SSL_connect @43 + SSL_copy_session_id @44 + SSL_ctrl @45 + SSL_do_handshake @125 + SSL_dup @46 + SSL_dup_CA_list @47 + SSL_free @48 + SSL_get_SSL_CTX @150 + SSL_get_certificate @49 + SSL_get_cipher_list @52 + SSL_get_ciphers @55 + SSL_get_client_CA_list @56 + SSL_get_current_cipher @127 + SSL_get_default_timeout @57 + SSL_get_error @58 + SSL_get_ex_data @151 + SSL_get_ex_new_index @169 + SSL_get_fd @59 + SSL_get_info_callback @165 + SSL_get_peer_cert_chain @60 + SSL_get_peer_certificate @61 + SSL_get_privatekey @126 + SSL_get_quiet_shutdown @153 + SSL_get_rbio @63 + SSL_get_read_ahead @64 + SSL_get_session @154 + SSL_get_shared_ciphers @65 + SSL_get_shutdown @155 + SSL_get_ssl_method @66 + SSL_get_verify_mode @70 + SSL_get_verify_result @157 + SSL_get_version @71 + SSL_get_wbio @72 + SSL_load_client_CA_file @73 + SSL_load_error_strings @74 + SSL_new @75 + SSL_peek @76 + SSL_pending @77 + SSL_read @78 + SSL_renegotiate @79 + SSL_rstate_string @80 + SSL_rstate_string_long @81 + SSL_set_accept_state @82 + SSL_set_bio @83 + SSL_set_cipher_list @84 + SSL_set_client_CA_list @85 + SSL_set_connect_state @86 + SSL_set_ex_data @158 + SSL_set_fd @87 + SSL_set_info_callback @160 + SSL_set_quiet_shutdown @161 + SSL_set_read_ahead @88 + SSL_set_rfd @89 + SSL_set_session @90 + SSL_set_shutdown @162 + SSL_set_ssl_method @91 + SSL_set_verify @94 + SSL_set_verify_result @163 + SSL_set_wfd @95 + SSL_shutdown @96 + SSL_state @166 + SSL_state_string @97 + SSL_state_string_long @98 + SSL_use_PrivateKey @99 + SSL_use_PrivateKey_ASN1 @100 + SSL_use_PrivateKey_file @101 + SSL_use_RSAPrivateKey @102 + SSL_use_RSAPrivateKey_ASN1 @103 + SSL_use_RSAPrivateKey_file @104 + SSL_use_certificate @105 + SSL_use_certificate_ASN1 @106 + SSL_use_certificate_file @107 + SSL_version @164 + SSL_write @108 + SSLv23_client_method @110 + SSLv23_method @111 + SSLv23_server_method @112 + SSLv2_client_method @113 + SSLv2_method @114 + SSLv2_server_method @115 + SSLv3_client_method @116 + SSLv3_method @117 + SSLv3_server_method @118 + TLSv1_client_method @172 + TLSv1_method @170 + TLSv1_server_method @171 + d2i_SSL_SESSION @119 + i2d_SSL_SESSION @120 + diff --git a/src/lib/libssl/src/ms/w31dll.mak b/src/lib/libssl/src/ms/w31dll.mak new file mode 100644 index 0000000000..6821d82604 --- /dev/null +++ b/src/lib/libssl/src/ms/w31dll.mak @@ -0,0 +1,2295 @@ +# This makefile has been automatically generated from the SSLeay distribution. +# This single makefile will build the complete SSLeay distribution and +# by default leave the 'intertesting' output files in .\out and the stuff +# that needs deleting in .\tmp. +# The file was generated by running 'make makefile.one', which +# does a 'make files', which writes all the environment variables from all +# the makefiles to the file call MINFO. This file is used by +# util\mk1mf.pl to generate makefile.one. +# The 'makefile per directory' system suites me when developing this +# library and also so I can 'distribute' indervidual library sections. +# The one monster makefile better suits building in non-unix +# environments. + +INSTALLTOP=\usr\local\ssl + +# Set your compiler options +CC=cl +CFLAG=/ALw /Gx- /Gt256 /Gf /G2 /f- /Ocgnotb2 /W3 /WX -DL_ENDIAN /nologo -DWINDOWS -DWIN16 +APP_CFLAG=/Gw /FPi87 +LIB_CFLAG=/Gw -D_WINDLL -D_DLL +SHLIB_CFLAG= +APP_EX_OBJ=setargv.obj +SHLIB_EX_OBJ= +# add extra libraries to this define, for solaris -lsocket -lnsl would +# be added +EX_LIBS=oldnames llibcewq libw winsock + +# The SSLeay directory +SRC_D=. + +LINK=link +LFLAGS= /FARCALL /NOLOGO /NOD /SEG:1024 /ONERROR:NOEXE /NOE /PACKC:60000 /PACKD:60000 /STACK:20000 /ALIGN:256 + +BN_MULW_OBJ=crypto\bn\asm\x86w32.obj +BN_MULW_SRC=crypto\bn\asm\x86w32.asm +DES_ENC_OBJ= +DES_ENC_SRC= +DES_CRYPT_OBJ= +DES_CRYPT_SRC= +BF_ENC_OBJ= +BF_ENC_SRC= +CAST_ENC_OBJ= +CAST_ENC_SRC= +RC4_ENC_OBJ= +RC4_ENC_SRC= +RC5_ENC_OBJ= +RC5_ENC_SRC= +MD5_ASM_OBJ= +MD5_ASM_SRC= +SHA1_ASM_OBJ= +SHA1_ASM_SRC= +RMD160_ASM_OBJ= +RMD160_ASM_SRC= + +# The output directory for everything intersting +OUT_D=out16dll +# The output directory for all the temporary muck +TMP_D=tmp16dll +# The output directory for the header files +INC_D=inc16 + +CP=copy +RM=del +RANLIB= +MKDIR=mkdir +MKLIB=lib /PAGESIZE:1024 +MLFLAGS= /FARCALL /NOLOGO /NOD /SEG:1024 /ONERROR:NOEXE /NOE /PACKC:60000 /PACKD:60000 +ASM=ml /Cp /c /Cx + +###################################################### +# You should not need to touch anything below this point +###################################################### + +E_EXE=ssleay +SSL=ssleay16 +CRYPTO=libeay16 +RSAGLUE=RSAglue + +# BIN_D - Binary output directory +# TEST_D - Binary test file output directory +# LIB_D - library output directory +BIN_D=$(OUT_D) +TEST_D=$(OUT_D) +LIB_D=$(OUT_D) + +# INCL_D - local library directory +# OBJ_D - temp object file directory +OBJ_D=$(TMP_D) +INCL_D=$(TMP_D) + +O_SSL= $(LIB_D)\$(SSL).dll +O_CRYPTO= $(LIB_D)\$(CRYPTO).dll +O_RSAGLUE= $(LIB_D)\$(RSAGLUE).lib +SO_SSL= $(SSL) +SO_CRYPTO= $(CRYPTO) +L_SSL= $(LIB_D)\$(SSL).lib +L_CRYPTO= $(LIB_D)\$(CRYPTO).lib + +L_LIBS= $(L_SSL) $(L_CRYPTO) +#L_LIBS= $(O_SSL) $(O_RSAGLUE) -lrsaref $(O_CRYPTO) + +###################################################### +# Don't touch anything below this point +###################################################### + +INC=-I$(INC_D) -I$(INCL_D) +APP_CFLAGS=$(INC) $(CFLAG) $(APP_CFLAG) +LIB_CFLAGS=$(INC) $(CFLAG) $(LIB_CFLAG) +SHLIB_CFLAGS=$(INC) $(CFLAG) $(LIB_CFLAG) $(SHLIB_CFLAG) +LIBS_DEP=$(O_CRYPTO) $(O_RSAGLUE) $(O_SSL) + +############################################# +HEADER=$(INCL_D)\cryptlib.h \ + $(INCL_D)\date.h $(INCL_D)\md5_locl.h $(INCL_D)\sha_locl.h \ + $(INCL_D)\rmd_locl.h $(INCL_D)\rmdconst.h $(INCL_D)\des_locl.h \ + $(INCL_D)\rpc_des.h $(INCL_D)\podd.h $(INCL_D)\sk.h \ + $(INCL_D)\spr.h $(INCL_D)\des_ver.h $(INCL_D)\rc2_locl.h \ + $(INCL_D)\rc4_locl.h $(INCL_D)\rc5_locl.h $(INCL_D)\idea_lcl.h \ + $(INCL_D)\bf_pi.h $(INCL_D)\bf_locl.h $(INCL_D)\cast_s.h \ + $(INCL_D)\cast_lcl.h $(INCL_D)\bn_lcl.h $(INCL_D)\bn_prime.h \ + $(INCL_D)\obj_dat.h $(INCL_D)\conf_lcl.h $(INCL_D)\ssl_locl.h \ + $(INCL_D)\rsaref.h $(INCL_D)\apps.h $(INCL_D)\progs.h \ + $(INCL_D)\s_apps.h $(INCL_D)\testdsa.h $(INCL_D)\testrsa.h + +EXHEADER=$(INC_D)\e_os.h \ + $(INC_D)\crypto.h $(INC_D)\cryptall.h $(INC_D)\md2.h \ + $(INC_D)\md5.h $(INC_D)\sha.h $(INC_D)\mdc2.h \ + $(INC_D)\hmac.h $(INC_D)\ripemd.h $(INC_D)\des.h \ + $(INC_D)\rc2.h $(INC_D)\rc4.h $(INC_D)\rc5.h \ + $(INC_D)\idea.h $(INC_D)\blowfish.h $(INC_D)\cast.h \ + $(INC_D)\bn.h $(INC_D)\rsa.h $(INC_D)\dsa.h \ + $(INC_D)\dh.h $(INC_D)\buffer.h $(INC_D)\bio.h \ + $(INC_D)\bss_file.c $(INC_D)\stack.h $(INC_D)\lhash.h \ + $(INC_D)\rand.h $(INC_D)\err.h $(INC_D)\objects.h \ + $(INC_D)\evp.h $(INC_D)\pem.h $(INC_D)\asn1.h \ + $(INC_D)\asn1_mac.h $(INC_D)\x509.h $(INC_D)\x509_vfy.h \ + $(INC_D)\conf.h $(INC_D)\txt_db.h $(INC_D)\pkcs7.h \ + $(INC_D)\ssl.h $(INC_D)\ssl2.h $(INC_D)\ssl3.h \ + $(INC_D)\ssl23.h $(INC_D)\tls1.h + +T_OBJ=$(OBJ_D)\md2test.obj \ + $(OBJ_D)\md5test.obj $(OBJ_D)\shatest.obj $(OBJ_D)\sha1test.obj \ + $(OBJ_D)\mdc2test.obj $(OBJ_D)\hmactest.obj $(OBJ_D)\rmdtest.obj \ + $(OBJ_D)\destest.obj $(OBJ_D)\rc2test.obj $(OBJ_D)\rc4test.obj \ + $(OBJ_D)\rc5test.obj $(OBJ_D)\ideatest.obj $(OBJ_D)\bftest.obj \ + $(OBJ_D)\casttest.obj $(OBJ_D)\bntest.obj $(OBJ_D)\exptest.obj \ + $(OBJ_D)\dsatest.obj $(OBJ_D)\dhtest.obj $(OBJ_D)\randtest.obj \ + $(OBJ_D)\ssltest.obj + +E_OBJ=$(OBJ_D)\verify.obj \ + $(OBJ_D)\asn1pars.obj $(OBJ_D)\req.obj $(OBJ_D)\dgst.obj \ + $(OBJ_D)\dh.obj $(OBJ_D)\enc.obj $(OBJ_D)\gendh.obj \ + $(OBJ_D)\errstr.obj $(OBJ_D)\ca.obj $(OBJ_D)\pkcs7.obj \ + $(OBJ_D)\crl2p7.obj $(OBJ_D)\crl.obj $(OBJ_D)\rsa.obj \ + $(OBJ_D)\dsa.obj $(OBJ_D)\dsaparam.obj $(OBJ_D)\x509.obj \ + $(OBJ_D)\genrsa.obj $(OBJ_D)\s_server.obj $(OBJ_D)\s_client.obj \ + $(OBJ_D)\speed.obj $(OBJ_D)\s_time.obj $(OBJ_D)\apps.obj \ + $(OBJ_D)\s_cb.obj $(OBJ_D)\s_socket.obj $(OBJ_D)\version.obj \ + $(OBJ_D)\sess_id.obj $(OBJ_D)\ciphers.obj $(OBJ_D)\ssleay.obj + +CRYPTOOBJ=$(OBJ_D)\cryptlib.obj \ + $(OBJ_D)\mem.obj $(OBJ_D)\cversion.obj $(OBJ_D)\ex_data.obj \ + $(OBJ_D)\cpt_err.obj $(OBJ_D)\md2_dgst.obj $(OBJ_D)\md2_one.obj \ + $(OBJ_D)\md5_dgst.obj $(OBJ_D)\md5_one.obj $(OBJ_D)\sha_dgst.obj \ + $(OBJ_D)\sha1dgst.obj $(OBJ_D)\sha_one.obj $(OBJ_D)\sha1_one.obj \ + $(OBJ_D)\mdc2dgst.obj $(OBJ_D)\mdc2_one.obj $(OBJ_D)\hmac.obj \ + $(OBJ_D)\rmd_dgst.obj $(OBJ_D)\rmd_one.obj $(OBJ_D)\set_key.obj \ + $(OBJ_D)\ecb_enc.obj $(OBJ_D)\cbc_enc.obj $(OBJ_D)\ecb3_enc.obj \ + $(OBJ_D)\cfb64enc.obj $(OBJ_D)\cfb64ede.obj $(OBJ_D)\cfb_enc.obj \ + $(OBJ_D)\ofb64ede.obj $(OBJ_D)\enc_read.obj $(OBJ_D)\enc_writ.obj \ + $(OBJ_D)\ofb64enc.obj $(OBJ_D)\ofb_enc.obj $(OBJ_D)\str2key.obj \ + $(OBJ_D)\pcbc_enc.obj $(OBJ_D)\qud_cksm.obj $(OBJ_D)\rand_key.obj \ + $(OBJ_D)\des_enc.obj $(OBJ_D)\fcrypt_b.obj $(OBJ_D)\read2pwd.obj \ + $(OBJ_D)\fcrypt.obj $(OBJ_D)\xcbc_enc.obj $(OBJ_D)\read_pwd.obj \ + $(OBJ_D)\rpc_enc.obj $(OBJ_D)\cbc_cksm.obj $(OBJ_D)\supp.obj \ + $(OBJ_D)\rc2_ecb.obj $(OBJ_D)\rc2_skey.obj $(OBJ_D)\rc2_cbc.obj \ + $(OBJ_D)\rc2cfb64.obj $(OBJ_D)\rc2ofb64.obj $(OBJ_D)\rc4_skey.obj \ + $(OBJ_D)\rc4_enc.obj $(OBJ_D)\rc5_skey.obj $(OBJ_D)\rc5_ecb.obj \ + $(OBJ_D)\rc5_enc.obj $(OBJ_D)\rc5cfb64.obj $(OBJ_D)\rc5ofb64.obj \ + $(OBJ_D)\i_cbc.obj $(OBJ_D)\i_cfb64.obj $(OBJ_D)\i_ofb64.obj \ + $(OBJ_D)\i_ecb.obj $(OBJ_D)\i_skey.obj $(OBJ_D)\bf_skey.obj \ + $(OBJ_D)\bf_ecb.obj $(OBJ_D)\bf_enc.obj $(OBJ_D)\bf_cfb64.obj \ + $(OBJ_D)\bf_ofb64.obj $(OBJ_D)\c_skey.obj $(OBJ_D)\c_ecb.obj \ + $(OBJ_D)\c_enc.obj $(OBJ_D)\c_cfb64.obj $(OBJ_D)\c_ofb64.obj \ + $(OBJ_D)\bn_add.obj $(OBJ_D)\bn_div.obj $(OBJ_D)\bn_exp.obj \ + $(OBJ_D)\bn_lib.obj $(OBJ_D)\bn_mod.obj $(OBJ_D)\bn_mul.obj \ + $(OBJ_D)\bn_print.obj $(OBJ_D)\bn_rand.obj $(OBJ_D)\bn_shift.obj \ + $(OBJ_D)\bn_sub.obj $(OBJ_D)\bn_word.obj $(OBJ_D)\bn_blind.obj \ + $(OBJ_D)\bn_gcd.obj $(OBJ_D)\bn_prime.obj $(OBJ_D)\bn_err.obj \ + $(OBJ_D)\bn_sqr.obj $(BN_MULW_OBJ) $(OBJ_D)\bn_recp.obj \ + $(OBJ_D)\bn_mont.obj $(OBJ_D)\bn_mpi.obj $(OBJ_D)\rsa_eay.obj \ + $(OBJ_D)\rsa_gen.obj $(OBJ_D)\rsa_lib.obj $(OBJ_D)\rsa_sign.obj \ + $(OBJ_D)\rsa_saos.obj $(OBJ_D)\rsa_err.obj $(OBJ_D)\rsa_pk1.obj \ + $(OBJ_D)\rsa_ssl.obj $(OBJ_D)\rsa_none.obj $(OBJ_D)\dsa_gen.obj \ + $(OBJ_D)\dsa_key.obj $(OBJ_D)\dsa_lib.obj $(OBJ_D)\dsa_vrf.obj \ + $(OBJ_D)\dsa_sign.obj $(OBJ_D)\dsa_err.obj $(OBJ_D)\dh_gen.obj \ + $(OBJ_D)\dh_key.obj $(OBJ_D)\dh_lib.obj $(OBJ_D)\dh_check.obj \ + $(OBJ_D)\dh_err.obj $(OBJ_D)\buffer.obj $(OBJ_D)\buf_err.obj \ + $(OBJ_D)\bio_lib.obj $(OBJ_D)\bio_cb.obj $(OBJ_D)\bio_err.obj \ + $(OBJ_D)\bss_mem.obj $(OBJ_D)\bss_null.obj $(OBJ_D)\bss_fd.obj \ + $(OBJ_D)\bss_file.obj $(OBJ_D)\bss_sock.obj $(OBJ_D)\bss_conn.obj \ + $(OBJ_D)\bf_null.obj $(OBJ_D)\bf_buff.obj $(OBJ_D)\b_print.obj \ + $(OBJ_D)\b_dump.obj $(OBJ_D)\b_sock.obj $(OBJ_D)\bss_acpt.obj \ + $(OBJ_D)\bf_nbio.obj $(OBJ_D)\stack.obj $(OBJ_D)\lhash.obj \ + $(OBJ_D)\lh_stats.obj $(OBJ_D)\md_rand.obj $(OBJ_D)\randfile.obj \ + $(OBJ_D)\err.obj $(OBJ_D)\err_all.obj $(OBJ_D)\err_prn.obj \ + $(OBJ_D)\obj_dat.obj $(OBJ_D)\obj_lib.obj $(OBJ_D)\obj_err.obj \ + $(OBJ_D)\encode.obj $(OBJ_D)\digest.obj $(OBJ_D)\evp_enc.obj \ + $(OBJ_D)\evp_key.obj $(OBJ_D)\e_ecb_d.obj $(OBJ_D)\e_cbc_d.obj \ + $(OBJ_D)\e_cfb_d.obj $(OBJ_D)\e_ofb_d.obj $(OBJ_D)\e_ecb_i.obj \ + $(OBJ_D)\e_cbc_i.obj $(OBJ_D)\e_cfb_i.obj $(OBJ_D)\e_ofb_i.obj \ + $(OBJ_D)\e_ecb_3d.obj $(OBJ_D)\e_cbc_3d.obj $(OBJ_D)\e_rc4.obj \ + $(OBJ_D)\names.obj $(OBJ_D)\e_cfb_3d.obj $(OBJ_D)\e_ofb_3d.obj \ + $(OBJ_D)\e_xcbc_d.obj $(OBJ_D)\e_ecb_r2.obj $(OBJ_D)\e_cbc_r2.obj \ + $(OBJ_D)\e_cfb_r2.obj $(OBJ_D)\e_ofb_r2.obj $(OBJ_D)\e_ecb_bf.obj \ + $(OBJ_D)\e_cbc_bf.obj $(OBJ_D)\e_cfb_bf.obj $(OBJ_D)\e_ofb_bf.obj \ + $(OBJ_D)\e_ecb_c.obj $(OBJ_D)\e_cbc_c.obj $(OBJ_D)\e_cfb_c.obj \ + $(OBJ_D)\e_ofb_c.obj $(OBJ_D)\e_ecb_r5.obj $(OBJ_D)\e_cbc_r5.obj \ + $(OBJ_D)\e_cfb_r5.obj $(OBJ_D)\e_ofb_r5.obj $(OBJ_D)\m_null.obj \ + $(OBJ_D)\m_md2.obj $(OBJ_D)\m_md5.obj $(OBJ_D)\m_sha.obj \ + $(OBJ_D)\m_sha1.obj $(OBJ_D)\m_dss.obj $(OBJ_D)\m_dss1.obj \ + $(OBJ_D)\m_mdc2.obj $(OBJ_D)\m_ripemd.obj $(OBJ_D)\p_open.obj \ + $(OBJ_D)\p_seal.obj $(OBJ_D)\p_sign.obj $(OBJ_D)\p_verify.obj \ + $(OBJ_D)\p_lib.obj $(OBJ_D)\p_enc.obj $(OBJ_D)\p_dec.obj \ + $(OBJ_D)\bio_md.obj $(OBJ_D)\bio_b64.obj $(OBJ_D)\bio_enc.obj \ + $(OBJ_D)\evp_err.obj $(OBJ_D)\e_null.obj $(OBJ_D)\c_all.obj \ + $(OBJ_D)\evp_lib.obj $(OBJ_D)\pem_sign.obj $(OBJ_D)\pem_seal.obj \ + $(OBJ_D)\pem_info.obj $(OBJ_D)\pem_lib.obj $(OBJ_D)\pem_all.obj \ + $(OBJ_D)\pem_err.obj $(OBJ_D)\a_object.obj $(OBJ_D)\a_bitstr.obj \ + $(OBJ_D)\a_utctm.obj $(OBJ_D)\a_int.obj $(OBJ_D)\a_octet.obj \ + $(OBJ_D)\a_print.obj $(OBJ_D)\a_type.obj $(OBJ_D)\a_set.obj \ + $(OBJ_D)\a_dup.obj $(OBJ_D)\a_d2i_fp.obj $(OBJ_D)\a_i2d_fp.obj \ + $(OBJ_D)\a_sign.obj $(OBJ_D)\a_digest.obj $(OBJ_D)\a_verify.obj \ + $(OBJ_D)\x_algor.obj $(OBJ_D)\x_val.obj $(OBJ_D)\x_pubkey.obj \ + $(OBJ_D)\x_sig.obj $(OBJ_D)\x_req.obj $(OBJ_D)\x_attrib.obj \ + $(OBJ_D)\x_name.obj $(OBJ_D)\x_cinf.obj $(OBJ_D)\x_x509.obj \ + $(OBJ_D)\x_crl.obj $(OBJ_D)\x_info.obj $(OBJ_D)\x_spki.obj \ + $(OBJ_D)\d2i_r_pr.obj $(OBJ_D)\i2d_r_pr.obj $(OBJ_D)\d2i_r_pu.obj \ + $(OBJ_D)\i2d_r_pu.obj $(OBJ_D)\d2i_s_pr.obj $(OBJ_D)\i2d_s_pr.obj \ + $(OBJ_D)\d2i_s_pu.obj $(OBJ_D)\i2d_s_pu.obj $(OBJ_D)\d2i_pu.obj \ + $(OBJ_D)\d2i_pr.obj $(OBJ_D)\i2d_pu.obj $(OBJ_D)\i2d_pr.obj \ + $(OBJ_D)\t_req.obj $(OBJ_D)\t_x509.obj $(OBJ_D)\t_pkey.obj \ + $(OBJ_D)\p7_i_s.obj $(OBJ_D)\p7_signi.obj $(OBJ_D)\p7_signd.obj \ + $(OBJ_D)\p7_recip.obj $(OBJ_D)\p7_enc_c.obj $(OBJ_D)\p7_evp.obj \ + $(OBJ_D)\p7_dgst.obj $(OBJ_D)\p7_s_e.obj $(OBJ_D)\p7_enc.obj \ + $(OBJ_D)\p7_lib.obj $(OBJ_D)\f_int.obj $(OBJ_D)\f_string.obj \ + $(OBJ_D)\i2d_dhp.obj $(OBJ_D)\i2d_dsap.obj $(OBJ_D)\d2i_dhp.obj \ + $(OBJ_D)\d2i_dsap.obj $(OBJ_D)\n_pkey.obj $(OBJ_D)\a_hdr.obj \ + $(OBJ_D)\x_pkey.obj $(OBJ_D)\a_bool.obj $(OBJ_D)\x_exten.obj \ + $(OBJ_D)\asn1_par.obj $(OBJ_D)\asn1_lib.obj $(OBJ_D)\asn1_err.obj \ + $(OBJ_D)\a_meth.obj $(OBJ_D)\a_bytes.obj $(OBJ_D)\evp_asn1.obj \ + $(OBJ_D)\x509_def.obj $(OBJ_D)\x509_d2.obj $(OBJ_D)\x509_r2x.obj \ + $(OBJ_D)\x509_cmp.obj $(OBJ_D)\x509_obj.obj $(OBJ_D)\x509_req.obj \ + $(OBJ_D)\x509_vfy.obj $(OBJ_D)\x509_set.obj $(OBJ_D)\x509rset.obj \ + $(OBJ_D)\x509_err.obj $(OBJ_D)\x509name.obj $(OBJ_D)\x509_v3.obj \ + $(OBJ_D)\x509_ext.obj $(OBJ_D)\x509pack.obj $(OBJ_D)\x509type.obj \ + $(OBJ_D)\x509_lu.obj $(OBJ_D)\x_all.obj $(OBJ_D)\x509_txt.obj \ + $(OBJ_D)\by_file.obj $(OBJ_D)\by_dir.obj $(OBJ_D)\v3_net.obj \ + $(OBJ_D)\v3_x509.obj $(OBJ_D)\conf.obj $(OBJ_D)\conf_err.obj \ + $(OBJ_D)\txt_db.obj $(OBJ_D)\pk7_lib.obj $(OBJ_D)\pkcs7err.obj \ + $(OBJ_D)\pk7_doit.obj + +SSLOBJ=$(OBJ_D)\s2_meth.obj \ + $(OBJ_D)\s2_srvr.obj $(OBJ_D)\s2_clnt.obj $(OBJ_D)\s2_lib.obj \ + $(OBJ_D)\s2_enc.obj $(OBJ_D)\s2_pkt.obj $(OBJ_D)\s3_meth.obj \ + $(OBJ_D)\s3_srvr.obj $(OBJ_D)\s3_clnt.obj $(OBJ_D)\s3_lib.obj \ + $(OBJ_D)\s3_enc.obj $(OBJ_D)\s3_pkt.obj $(OBJ_D)\s3_both.obj \ + $(OBJ_D)\s23_meth.obj $(OBJ_D)\s23_srvr.obj $(OBJ_D)\s23_clnt.obj \ + $(OBJ_D)\s23_lib.obj $(OBJ_D)\s23_pkt.obj $(OBJ_D)\t1_meth.obj \ + $(OBJ_D)\t1_srvr.obj $(OBJ_D)\t1_clnt.obj $(OBJ_D)\t1_lib.obj \ + $(OBJ_D)\t1_enc.obj $(OBJ_D)\ssl_lib.obj $(OBJ_D)\ssl_err2.obj \ + $(OBJ_D)\ssl_cert.obj $(OBJ_D)\ssl_sess.obj $(OBJ_D)\ssl_ciph.obj \ + $(OBJ_D)\ssl_stat.obj $(OBJ_D)\ssl_rsa.obj $(OBJ_D)\ssl_asn1.obj \ + $(OBJ_D)\ssl_txt.obj $(OBJ_D)\ssl_algs.obj $(OBJ_D)\bio_ssl.obj \ + $(OBJ_D)\ssl_err.obj + +RSAGLUEOBJ=$(OBJ_D)\rsaref.obj \ + $(OBJ_D)\rsar_err.obj + +T_EXE=$(TEST_D)\md2test.exe \ + $(TEST_D)\md5test.exe $(TEST_D)\shatest.exe $(TEST_D)\sha1test.exe \ + $(TEST_D)\mdc2test.exe $(TEST_D)\hmactest.exe $(TEST_D)\rmdtest.exe \ + $(TEST_D)\destest.exe $(TEST_D)\rc2test.exe $(TEST_D)\rc4test.exe \ + $(TEST_D)\rc5test.exe $(TEST_D)\ideatest.exe $(TEST_D)\bftest.exe \ + $(TEST_D)\casttest.exe $(TEST_D)\bntest.exe $(TEST_D)\exptest.exe \ + $(TEST_D)\dsatest.exe $(TEST_D)\dhtest.exe $(TEST_D)\randtest.exe \ + $(TEST_D)\ssltest.exe + +################################################################### +all: banner $(TMP_D) $(BIN_D) $(TEST_D) $(LIB_D) $(INC_D) headers lib exe + +banner: + @echo Make sure you have run 'perl Configure VC-WIN16' in the + @echo top level directory, if you don't have perl, you will + @echo need to probably edit crypto/bn/bn.h, check the + @echo documentation for details. + + +$(TMP_D): + $(MKDIR) $(TMP_D) + +$(BIN_D): + $(MKDIR) $(BIN_D) + +$(TEST_D): + $(MKDIR) $(TEST_D) + +$(LIB_D): + $(MKDIR) $(LIB_D) + +$(INC_D): + $(MKDIR) $(INC_D) + +headers: $(HEADER) $(EXHEADER) + +lib: $(LIBS_DEP) + +exe: $(T_EXE) $(BIN_D)\$(E_EXE).exe + +install: + $(MKDIR) $(INSTALLTOP) + $(MKDIR) $(INSTALLTOP)\bin + $(MKDIR) $(INSTALLTOP)\include + $(MKDIR) $(INSTALLTOP)\lib + $(CP) $(INC_D)\*.[ch] $(INSTALLTOP)\include + $(CP) $(BIN_D)\$(E_EXE).exe $(INSTALLTOP)\bin + $(CP) $(O_SSL) $(INSTALLTOP)\lib + $(CP) $(O_CRYPTO) $(INSTALLTOP)\lib + +clean: + $(RM) $(TMP_D)\*.* + +vclean: + $(RM) $(TMP_D)\*.* + $(RM) $(OUT_D)\*.* + +$(INCL_D)\cryptlib.h: $(SRC_D)\crypto\cryptlib.h + $(CP) $(SRC_D)\crypto\cryptlib.h $(INCL_D)\cryptlib.h + +$(INCL_D)\date.h: $(SRC_D)\crypto\date.h + $(CP) $(SRC_D)\crypto\date.h $(INCL_D)\date.h + +$(INCL_D)\md5_locl.h: $(SRC_D)\crypto\md5\md5_locl.h + $(CP) $(SRC_D)\crypto\md5\md5_locl.h $(INCL_D)\md5_locl.h + +$(INCL_D)\sha_locl.h: $(SRC_D)\crypto\sha\sha_locl.h + $(CP) $(SRC_D)\crypto\sha\sha_locl.h $(INCL_D)\sha_locl.h + +$(INCL_D)\rmd_locl.h: $(SRC_D)\crypto\ripemd\rmd_locl.h + $(CP) $(SRC_D)\crypto\ripemd\rmd_locl.h $(INCL_D)\rmd_locl.h + +$(INCL_D)\rmdconst.h: $(SRC_D)\crypto\ripemd\rmdconst.h + $(CP) $(SRC_D)\crypto\ripemd\rmdconst.h $(INCL_D)\rmdconst.h + +$(INCL_D)\des_locl.h: $(SRC_D)\crypto\des\des_locl.h + $(CP) $(SRC_D)\crypto\des\des_locl.h $(INCL_D)\des_locl.h + +$(INCL_D)\rpc_des.h: $(SRC_D)\crypto\des\rpc_des.h + $(CP) $(SRC_D)\crypto\des\rpc_des.h $(INCL_D)\rpc_des.h + +$(INCL_D)\podd.h: $(SRC_D)\crypto\des\podd.h + $(CP) $(SRC_D)\crypto\des\podd.h $(INCL_D)\podd.h + +$(INCL_D)\sk.h: $(SRC_D)\crypto\des\sk.h + $(CP) $(SRC_D)\crypto\des\sk.h $(INCL_D)\sk.h + +$(INCL_D)\spr.h: $(SRC_D)\crypto\des\spr.h + $(CP) $(SRC_D)\crypto\des\spr.h $(INCL_D)\spr.h + +$(INCL_D)\des_ver.h: $(SRC_D)\crypto\des\des_ver.h + $(CP) $(SRC_D)\crypto\des\des_ver.h $(INCL_D)\des_ver.h + +$(INCL_D)\rc2_locl.h: $(SRC_D)\crypto\rc2\rc2_locl.h + $(CP) $(SRC_D)\crypto\rc2\rc2_locl.h $(INCL_D)\rc2_locl.h + +$(INCL_D)\rc4_locl.h: $(SRC_D)\crypto\rc4\rc4_locl.h + $(CP) $(SRC_D)\crypto\rc4\rc4_locl.h $(INCL_D)\rc4_locl.h + +$(INCL_D)\rc5_locl.h: $(SRC_D)\crypto\rc5\rc5_locl.h + $(CP) $(SRC_D)\crypto\rc5\rc5_locl.h $(INCL_D)\rc5_locl.h + +$(INCL_D)\idea_lcl.h: $(SRC_D)\crypto\idea\idea_lcl.h + $(CP) $(SRC_D)\crypto\idea\idea_lcl.h $(INCL_D)\idea_lcl.h + +$(INCL_D)\bf_pi.h: $(SRC_D)\crypto\bf\bf_pi.h + $(CP) $(SRC_D)\crypto\bf\bf_pi.h $(INCL_D)\bf_pi.h + +$(INCL_D)\bf_locl.h: $(SRC_D)\crypto\bf\bf_locl.h + $(CP) $(SRC_D)\crypto\bf\bf_locl.h $(INCL_D)\bf_locl.h + +$(INCL_D)\cast_s.h: $(SRC_D)\crypto\cast\cast_s.h + $(CP) $(SRC_D)\crypto\cast\cast_s.h $(INCL_D)\cast_s.h + +$(INCL_D)\cast_lcl.h: $(SRC_D)\crypto\cast\cast_lcl.h + $(CP) $(SRC_D)\crypto\cast\cast_lcl.h $(INCL_D)\cast_lcl.h + +$(INCL_D)\bn_lcl.h: $(SRC_D)\crypto\bn\bn_lcl.h + $(CP) $(SRC_D)\crypto\bn\bn_lcl.h $(INCL_D)\bn_lcl.h + +$(INCL_D)\bn_prime.h: $(SRC_D)\crypto\bn\bn_prime.h + $(CP) $(SRC_D)\crypto\bn\bn_prime.h $(INCL_D)\bn_prime.h + +$(INCL_D)\obj_dat.h: $(SRC_D)\crypto\objects\obj_dat.h + $(CP) $(SRC_D)\crypto\objects\obj_dat.h $(INCL_D)\obj_dat.h + +$(INCL_D)\conf_lcl.h: $(SRC_D)\crypto\conf\conf_lcl.h + $(CP) $(SRC_D)\crypto\conf\conf_lcl.h $(INCL_D)\conf_lcl.h + +$(INCL_D)\ssl_locl.h: $(SRC_D)\ssl\ssl_locl.h + $(CP) $(SRC_D)\ssl\ssl_locl.h $(INCL_D)\ssl_locl.h + +$(INCL_D)\rsaref.h: $(SRC_D)\rsaref\rsaref.h + $(CP) $(SRC_D)\rsaref\rsaref.h $(INCL_D)\rsaref.h + +$(INCL_D)\apps.h: $(SRC_D)\apps\apps.h + $(CP) $(SRC_D)\apps\apps.h $(INCL_D)\apps.h + +$(INCL_D)\progs.h: $(SRC_D)\apps\progs.h + $(CP) $(SRC_D)\apps\progs.h $(INCL_D)\progs.h + +$(INCL_D)\s_apps.h: $(SRC_D)\apps\s_apps.h + $(CP) $(SRC_D)\apps\s_apps.h $(INCL_D)\s_apps.h + +$(INCL_D)\testdsa.h: $(SRC_D)\apps\testdsa.h + $(CP) $(SRC_D)\apps\testdsa.h $(INCL_D)\testdsa.h + +$(INCL_D)\testrsa.h: $(SRC_D)\apps\testrsa.h + $(CP) $(SRC_D)\apps\testrsa.h $(INCL_D)\testrsa.h + +$(INC_D)\e_os.h: $(SRC_D)\.\e_os.h + $(CP) $(SRC_D)\.\e_os.h $(INC_D)\e_os.h + +$(INC_D)\crypto.h: $(SRC_D)\crypto\crypto.h + $(CP) $(SRC_D)\crypto\crypto.h $(INC_D)\crypto.h + +$(INC_D)\cryptall.h: $(SRC_D)\crypto\cryptall.h + $(CP) $(SRC_D)\crypto\cryptall.h $(INC_D)\cryptall.h + +$(INC_D)\md2.h: $(SRC_D)\crypto\md2\md2.h + $(CP) $(SRC_D)\crypto\md2\md2.h $(INC_D)\md2.h + +$(INC_D)\md5.h: $(SRC_D)\crypto\md5\md5.h + $(CP) $(SRC_D)\crypto\md5\md5.h $(INC_D)\md5.h + +$(INC_D)\sha.h: $(SRC_D)\crypto\sha\sha.h + $(CP) $(SRC_D)\crypto\sha\sha.h $(INC_D)\sha.h + +$(INC_D)\mdc2.h: $(SRC_D)\crypto\mdc2\mdc2.h + $(CP) $(SRC_D)\crypto\mdc2\mdc2.h $(INC_D)\mdc2.h + +$(INC_D)\hmac.h: $(SRC_D)\crypto\hmac\hmac.h + $(CP) $(SRC_D)\crypto\hmac\hmac.h $(INC_D)\hmac.h + +$(INC_D)\ripemd.h: $(SRC_D)\crypto\ripemd\ripemd.h + $(CP) $(SRC_D)\crypto\ripemd\ripemd.h $(INC_D)\ripemd.h + +$(INC_D)\des.h: $(SRC_D)\crypto\des\des.h + $(CP) $(SRC_D)\crypto\des\des.h $(INC_D)\des.h + +$(INC_D)\rc2.h: $(SRC_D)\crypto\rc2\rc2.h + $(CP) $(SRC_D)\crypto\rc2\rc2.h $(INC_D)\rc2.h + +$(INC_D)\rc4.h: $(SRC_D)\crypto\rc4\rc4.h + $(CP) $(SRC_D)\crypto\rc4\rc4.h $(INC_D)\rc4.h + +$(INC_D)\rc5.h: $(SRC_D)\crypto\rc5\rc5.h + $(CP) $(SRC_D)\crypto\rc5\rc5.h $(INC_D)\rc5.h + +$(INC_D)\idea.h: $(SRC_D)\crypto\idea\idea.h + $(CP) $(SRC_D)\crypto\idea\idea.h $(INC_D)\idea.h + +$(INC_D)\blowfish.h: $(SRC_D)\crypto\bf\blowfish.h + $(CP) $(SRC_D)\crypto\bf\blowfish.h $(INC_D)\blowfish.h + +$(INC_D)\cast.h: $(SRC_D)\crypto\cast\cast.h + $(CP) $(SRC_D)\crypto\cast\cast.h $(INC_D)\cast.h + +$(INC_D)\bn.h: $(SRC_D)\crypto\bn\bn.h + $(CP) $(SRC_D)\crypto\bn\bn.h $(INC_D)\bn.h + +$(INC_D)\rsa.h: $(SRC_D)\crypto\rsa\rsa.h + $(CP) $(SRC_D)\crypto\rsa\rsa.h $(INC_D)\rsa.h + +$(INC_D)\dsa.h: $(SRC_D)\crypto\dsa\dsa.h + $(CP) $(SRC_D)\crypto\dsa\dsa.h $(INC_D)\dsa.h + +$(INC_D)\dh.h: $(SRC_D)\crypto\dh\dh.h + $(CP) $(SRC_D)\crypto\dh\dh.h $(INC_D)\dh.h + +$(INC_D)\buffer.h: $(SRC_D)\crypto\buffer\buffer.h + $(CP) $(SRC_D)\crypto\buffer\buffer.h $(INC_D)\buffer.h + +$(INC_D)\bio.h: $(SRC_D)\crypto\bio\bio.h + $(CP) $(SRC_D)\crypto\bio\bio.h $(INC_D)\bio.h + +$(INC_D)\bss_file.c: $(SRC_D)\crypto\bio\bss_file.c + $(CP) $(SRC_D)\crypto\bio\bss_file.c $(INC_D)\bss_file.c + +$(INC_D)\stack.h: $(SRC_D)\crypto\stack\stack.h + $(CP) $(SRC_D)\crypto\stack\stack.h $(INC_D)\stack.h + +$(INC_D)\lhash.h: $(SRC_D)\crypto\lhash\lhash.h + $(CP) $(SRC_D)\crypto\lhash\lhash.h $(INC_D)\lhash.h + +$(INC_D)\rand.h: $(SRC_D)\crypto\rand\rand.h + $(CP) $(SRC_D)\crypto\rand\rand.h $(INC_D)\rand.h + +$(INC_D)\err.h: $(SRC_D)\crypto\err\err.h + $(CP) $(SRC_D)\crypto\err\err.h $(INC_D)\err.h + +$(INC_D)\objects.h: $(SRC_D)\crypto\objects\objects.h + $(CP) $(SRC_D)\crypto\objects\objects.h $(INC_D)\objects.h + +$(INC_D)\evp.h: $(SRC_D)\crypto\evp\evp.h + $(CP) $(SRC_D)\crypto\evp\evp.h $(INC_D)\evp.h + +$(INC_D)\pem.h: $(SRC_D)\crypto\pem\pem.h + $(CP) $(SRC_D)\crypto\pem\pem.h $(INC_D)\pem.h + +$(INC_D)\asn1.h: $(SRC_D)\crypto\asn1\asn1.h + $(CP) $(SRC_D)\crypto\asn1\asn1.h $(INC_D)\asn1.h + +$(INC_D)\asn1_mac.h: $(SRC_D)\crypto\asn1\asn1_mac.h + $(CP) $(SRC_D)\crypto\asn1\asn1_mac.h $(INC_D)\asn1_mac.h + +$(INC_D)\x509.h: $(SRC_D)\crypto\x509\x509.h + $(CP) $(SRC_D)\crypto\x509\x509.h $(INC_D)\x509.h + +$(INC_D)\x509_vfy.h: $(SRC_D)\crypto\x509\x509_vfy.h + $(CP) $(SRC_D)\crypto\x509\x509_vfy.h $(INC_D)\x509_vfy.h + +$(INC_D)\conf.h: $(SRC_D)\crypto\conf\conf.h + $(CP) $(SRC_D)\crypto\conf\conf.h $(INC_D)\conf.h + +$(INC_D)\txt_db.h: $(SRC_D)\crypto\txt_db\txt_db.h + $(CP) $(SRC_D)\crypto\txt_db\txt_db.h $(INC_D)\txt_db.h + +$(INC_D)\pkcs7.h: $(SRC_D)\crypto\pkcs7\pkcs7.h + $(CP) $(SRC_D)\crypto\pkcs7\pkcs7.h $(INC_D)\pkcs7.h + +$(INC_D)\ssl.h: $(SRC_D)\ssl\ssl.h + $(CP) $(SRC_D)\ssl\ssl.h $(INC_D)\ssl.h + +$(INC_D)\ssl2.h: $(SRC_D)\ssl\ssl2.h + $(CP) $(SRC_D)\ssl\ssl2.h $(INC_D)\ssl2.h + +$(INC_D)\ssl3.h: $(SRC_D)\ssl\ssl3.h + $(CP) $(SRC_D)\ssl\ssl3.h $(INC_D)\ssl3.h + +$(INC_D)\ssl23.h: $(SRC_D)\ssl\ssl23.h + $(CP) $(SRC_D)\ssl\ssl23.h $(INC_D)\ssl23.h + +$(INC_D)\tls1.h: $(SRC_D)\ssl\tls1.h + $(CP) $(SRC_D)\ssl\tls1.h $(INC_D)\tls1.h + +$(OBJ_D)\md2test.obj: $(SRC_D)\crypto\md2\md2test.c + $(CC) /Fo$(OBJ_D)\md2test.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\md2\md2test.c + +$(OBJ_D)\md5test.obj: $(SRC_D)\crypto\md5\md5test.c + $(CC) /Fo$(OBJ_D)\md5test.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\md5\md5test.c + +$(OBJ_D)\shatest.obj: $(SRC_D)\crypto\sha\shatest.c + $(CC) /Fo$(OBJ_D)\shatest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\sha\shatest.c + +$(OBJ_D)\sha1test.obj: $(SRC_D)\crypto\sha\sha1test.c + $(CC) /Fo$(OBJ_D)\sha1test.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\sha\sha1test.c + +$(OBJ_D)\mdc2test.obj: $(SRC_D)\crypto\mdc2\mdc2test.c + $(CC) /Fo$(OBJ_D)\mdc2test.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\mdc2\mdc2test.c + +$(OBJ_D)\hmactest.obj: $(SRC_D)\crypto\hmac\hmactest.c + $(CC) /Fo$(OBJ_D)\hmactest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\hmac\hmactest.c + +$(OBJ_D)\rmdtest.obj: $(SRC_D)\crypto\ripemd\rmdtest.c + $(CC) /Fo$(OBJ_D)\rmdtest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\ripemd\rmdtest.c + +$(OBJ_D)\destest.obj: $(SRC_D)\crypto\des\destest.c + $(CC) /Fo$(OBJ_D)\destest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\des\destest.c + +$(OBJ_D)\rc2test.obj: $(SRC_D)\crypto\rc2\rc2test.c + $(CC) /Fo$(OBJ_D)\rc2test.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\rc2\rc2test.c + +$(OBJ_D)\rc4test.obj: $(SRC_D)\crypto\rc4\rc4test.c + $(CC) /Fo$(OBJ_D)\rc4test.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\rc4\rc4test.c + +$(OBJ_D)\rc5test.obj: $(SRC_D)\crypto\rc5\rc5test.c + $(CC) /Fo$(OBJ_D)\rc5test.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\rc5\rc5test.c + +$(OBJ_D)\ideatest.obj: $(SRC_D)\crypto\idea\ideatest.c + $(CC) /Fo$(OBJ_D)\ideatest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\idea\ideatest.c + +$(OBJ_D)\bftest.obj: $(SRC_D)\crypto\bf\bftest.c + $(CC) /Fo$(OBJ_D)\bftest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\bf\bftest.c + +$(OBJ_D)\casttest.obj: $(SRC_D)\crypto\cast\casttest.c + $(CC) /Fo$(OBJ_D)\casttest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\cast\casttest.c + +$(OBJ_D)\bntest.obj: $(SRC_D)\crypto\bn\bntest.c + $(CC) /Fo$(OBJ_D)\bntest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\bn\bntest.c + +$(OBJ_D)\exptest.obj: $(SRC_D)\crypto\bn\exptest.c + $(CC) /Fo$(OBJ_D)\exptest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\bn\exptest.c + +$(OBJ_D)\dsatest.obj: $(SRC_D)\crypto\dsa\dsatest.c + $(CC) /Fo$(OBJ_D)\dsatest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\dsa\dsatest.c + +$(OBJ_D)\dhtest.obj: $(SRC_D)\crypto\dh\dhtest.c + $(CC) /Fo$(OBJ_D)\dhtest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\dh\dhtest.c + +$(OBJ_D)\randtest.obj: $(SRC_D)\crypto\rand\randtest.c + $(CC) /Fo$(OBJ_D)\randtest.obj $(APP_CFLAGS) -c $(SRC_D)\crypto\rand\randtest.c + +$(OBJ_D)\ssltest.obj: $(SRC_D)\ssl\ssltest.c + $(CC) /Fo$(OBJ_D)\ssltest.obj $(APP_CFLAGS) -c $(SRC_D)\ssl\ssltest.c + +$(OBJ_D)\verify.obj: $(SRC_D)\apps\verify.c + $(CC) /Fo$(OBJ_D)\verify.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\verify.c + +$(OBJ_D)\asn1pars.obj: $(SRC_D)\apps\asn1pars.c + $(CC) /Fo$(OBJ_D)\asn1pars.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\asn1pars.c + +$(OBJ_D)\req.obj: $(SRC_D)\apps\req.c + $(CC) /Fo$(OBJ_D)\req.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\req.c + +$(OBJ_D)\dgst.obj: $(SRC_D)\apps\dgst.c + $(CC) /Fo$(OBJ_D)\dgst.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\dgst.c + +$(OBJ_D)\dh.obj: $(SRC_D)\apps\dh.c + $(CC) /Fo$(OBJ_D)\dh.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\dh.c + +$(OBJ_D)\enc.obj: $(SRC_D)\apps\enc.c + $(CC) /Fo$(OBJ_D)\enc.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\enc.c + +$(OBJ_D)\gendh.obj: $(SRC_D)\apps\gendh.c + $(CC) /Fo$(OBJ_D)\gendh.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\gendh.c + +$(OBJ_D)\errstr.obj: $(SRC_D)\apps\errstr.c + $(CC) /Fo$(OBJ_D)\errstr.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\errstr.c + +$(OBJ_D)\ca.obj: $(SRC_D)\apps\ca.c + $(CC) /Fo$(OBJ_D)\ca.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\ca.c + +$(OBJ_D)\pkcs7.obj: $(SRC_D)\apps\pkcs7.c + $(CC) /Fo$(OBJ_D)\pkcs7.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\pkcs7.c + +$(OBJ_D)\crl2p7.obj: $(SRC_D)\apps\crl2p7.c + $(CC) /Fo$(OBJ_D)\crl2p7.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\crl2p7.c + +$(OBJ_D)\crl.obj: $(SRC_D)\apps\crl.c + $(CC) /Fo$(OBJ_D)\crl.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\crl.c + +$(OBJ_D)\rsa.obj: $(SRC_D)\apps\rsa.c + $(CC) /Fo$(OBJ_D)\rsa.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\rsa.c + +$(OBJ_D)\dsa.obj: $(SRC_D)\apps\dsa.c + $(CC) /Fo$(OBJ_D)\dsa.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\dsa.c + +$(OBJ_D)\dsaparam.obj: $(SRC_D)\apps\dsaparam.c + $(CC) /Fo$(OBJ_D)\dsaparam.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\dsaparam.c + +$(OBJ_D)\x509.obj: $(SRC_D)\apps\x509.c + $(CC) /Fo$(OBJ_D)\x509.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\x509.c + +$(OBJ_D)\genrsa.obj: $(SRC_D)\apps\genrsa.c + $(CC) /Fo$(OBJ_D)\genrsa.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\genrsa.c + +$(OBJ_D)\s_server.obj: $(SRC_D)\apps\s_server.c + $(CC) /Fo$(OBJ_D)\s_server.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\s_server.c + +$(OBJ_D)\s_client.obj: $(SRC_D)\apps\s_client.c + $(CC) /Fo$(OBJ_D)\s_client.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\s_client.c + +$(OBJ_D)\speed.obj: $(SRC_D)\apps\speed.c + $(CC) /Fo$(OBJ_D)\speed.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\speed.c + +$(OBJ_D)\s_time.obj: $(SRC_D)\apps\s_time.c + $(CC) /Fo$(OBJ_D)\s_time.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\s_time.c + +$(OBJ_D)\apps.obj: $(SRC_D)\apps\apps.c + $(CC) /Fo$(OBJ_D)\apps.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\apps.c + +$(OBJ_D)\s_cb.obj: $(SRC_D)\apps\s_cb.c + $(CC) /Fo$(OBJ_D)\s_cb.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\s_cb.c + +$(OBJ_D)\s_socket.obj: $(SRC_D)\apps\s_socket.c + $(CC) /Fo$(OBJ_D)\s_socket.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\s_socket.c + +$(OBJ_D)\version.obj: $(SRC_D)\apps\version.c + $(CC) /Fo$(OBJ_D)\version.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\version.c + +$(OBJ_D)\sess_id.obj: $(SRC_D)\apps\sess_id.c + $(CC) /Fo$(OBJ_D)\sess_id.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\sess_id.c + +$(OBJ_D)\ciphers.obj: $(SRC_D)\apps\ciphers.c + $(CC) /Fo$(OBJ_D)\ciphers.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\ciphers.c + +$(OBJ_D)\ssleay.obj: $(SRC_D)\apps\ssleay.c + $(CC) /Fo$(OBJ_D)\ssleay.obj -DMONOLITH $(APP_CFLAGS) -c $(SRC_D)\apps\ssleay.c + +crypto\bn\asm\x86w32.obj: crypto\bn\asm\x86w32.asm + $(ASM) /Focrypto\bn\asm\x86w32.obj $(SRC_D)\crypto\bn\asm\x86w32.asm + +$(OBJ_D)\cryptlib.obj: $(SRC_D)\crypto\cryptlib.c + $(CC) /Fo$(OBJ_D)\cryptlib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\cryptlib.c + +$(OBJ_D)\mem.obj: $(SRC_D)\crypto\mem.c + $(CC) /Fo$(OBJ_D)\mem.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\mem.c + +$(OBJ_D)\cversion.obj: $(SRC_D)\crypto\cversion.c + $(CC) /Fo$(OBJ_D)\cversion.obj $(SHLIB_CFLAGS) -DCFLAGS="\"$(CC) $(CFLAG)\"" -c $(SRC_D)\crypto\cversion.c + +$(OBJ_D)\ex_data.obj: $(SRC_D)\crypto\ex_data.c + $(CC) /Fo$(OBJ_D)\ex_data.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\ex_data.c + +$(OBJ_D)\cpt_err.obj: $(SRC_D)\crypto\cpt_err.c + $(CC) /Fo$(OBJ_D)\cpt_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\cpt_err.c + +$(OBJ_D)\md2_dgst.obj: $(SRC_D)\crypto\md2\md2_dgst.c + $(CC) /Fo$(OBJ_D)\md2_dgst.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\md2\md2_dgst.c + +$(OBJ_D)\md2_one.obj: $(SRC_D)\crypto\md2\md2_one.c + $(CC) /Fo$(OBJ_D)\md2_one.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\md2\md2_one.c + +$(OBJ_D)\md5_dgst.obj: $(SRC_D)\crypto\md5\md5_dgst.c + $(CC) /Fo$(OBJ_D)\md5_dgst.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\md5\md5_dgst.c + +$(OBJ_D)\md5_one.obj: $(SRC_D)\crypto\md5\md5_one.c + $(CC) /Fo$(OBJ_D)\md5_one.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\md5\md5_one.c + +$(OBJ_D)\sha_dgst.obj: $(SRC_D)\crypto\sha\sha_dgst.c + $(CC) /Fo$(OBJ_D)\sha_dgst.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\sha\sha_dgst.c + +$(OBJ_D)\sha1dgst.obj: $(SRC_D)\crypto\sha\sha1dgst.c + $(CC) /Fo$(OBJ_D)\sha1dgst.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\sha\sha1dgst.c + +$(OBJ_D)\sha_one.obj: $(SRC_D)\crypto\sha\sha_one.c + $(CC) /Fo$(OBJ_D)\sha_one.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\sha\sha_one.c + +$(OBJ_D)\sha1_one.obj: $(SRC_D)\crypto\sha\sha1_one.c + $(CC) /Fo$(OBJ_D)\sha1_one.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\sha\sha1_one.c + +$(OBJ_D)\mdc2dgst.obj: $(SRC_D)\crypto\mdc2\mdc2dgst.c + $(CC) /Fo$(OBJ_D)\mdc2dgst.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\mdc2\mdc2dgst.c + +$(OBJ_D)\mdc2_one.obj: $(SRC_D)\crypto\mdc2\mdc2_one.c + $(CC) /Fo$(OBJ_D)\mdc2_one.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\mdc2\mdc2_one.c + +$(OBJ_D)\hmac.obj: $(SRC_D)\crypto\hmac\hmac.c + $(CC) /Fo$(OBJ_D)\hmac.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\hmac\hmac.c + +$(OBJ_D)\rmd_dgst.obj: $(SRC_D)\crypto\ripemd\rmd_dgst.c + $(CC) /Fo$(OBJ_D)\rmd_dgst.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\ripemd\rmd_dgst.c + +$(OBJ_D)\rmd_one.obj: $(SRC_D)\crypto\ripemd\rmd_one.c + $(CC) /Fo$(OBJ_D)\rmd_one.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\ripemd\rmd_one.c + +$(OBJ_D)\set_key.obj: $(SRC_D)\crypto\des\set_key.c + $(CC) /Fo$(OBJ_D)\set_key.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\set_key.c + +$(OBJ_D)\ecb_enc.obj: $(SRC_D)\crypto\des\ecb_enc.c + $(CC) /Fo$(OBJ_D)\ecb_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\ecb_enc.c + +$(OBJ_D)\cbc_enc.obj: $(SRC_D)\crypto\des\cbc_enc.c + $(CC) /Fo$(OBJ_D)\cbc_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\cbc_enc.c + +$(OBJ_D)\ecb3_enc.obj: $(SRC_D)\crypto\des\ecb3_enc.c + $(CC) /Fo$(OBJ_D)\ecb3_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\ecb3_enc.c + +$(OBJ_D)\cfb64enc.obj: $(SRC_D)\crypto\des\cfb64enc.c + $(CC) /Fo$(OBJ_D)\cfb64enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\cfb64enc.c + +$(OBJ_D)\cfb64ede.obj: $(SRC_D)\crypto\des\cfb64ede.c + $(CC) /Fo$(OBJ_D)\cfb64ede.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\cfb64ede.c + +$(OBJ_D)\cfb_enc.obj: $(SRC_D)\crypto\des\cfb_enc.c + $(CC) /Fo$(OBJ_D)\cfb_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\cfb_enc.c + +$(OBJ_D)\ofb64ede.obj: $(SRC_D)\crypto\des\ofb64ede.c + $(CC) /Fo$(OBJ_D)\ofb64ede.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\ofb64ede.c + +$(OBJ_D)\enc_read.obj: $(SRC_D)\crypto\des\enc_read.c + $(CC) /Fo$(OBJ_D)\enc_read.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\enc_read.c + +$(OBJ_D)\enc_writ.obj: $(SRC_D)\crypto\des\enc_writ.c + $(CC) /Fo$(OBJ_D)\enc_writ.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\enc_writ.c + +$(OBJ_D)\ofb64enc.obj: $(SRC_D)\crypto\des\ofb64enc.c + $(CC) /Fo$(OBJ_D)\ofb64enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\ofb64enc.c + +$(OBJ_D)\ofb_enc.obj: $(SRC_D)\crypto\des\ofb_enc.c + $(CC) /Fo$(OBJ_D)\ofb_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\ofb_enc.c + +$(OBJ_D)\str2key.obj: $(SRC_D)\crypto\des\str2key.c + $(CC) /Fo$(OBJ_D)\str2key.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\str2key.c + +$(OBJ_D)\pcbc_enc.obj: $(SRC_D)\crypto\des\pcbc_enc.c + $(CC) /Fo$(OBJ_D)\pcbc_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\pcbc_enc.c + +$(OBJ_D)\qud_cksm.obj: $(SRC_D)\crypto\des\qud_cksm.c + $(CC) /Fo$(OBJ_D)\qud_cksm.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\qud_cksm.c + +$(OBJ_D)\rand_key.obj: $(SRC_D)\crypto\des\rand_key.c + $(CC) /Fo$(OBJ_D)\rand_key.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\rand_key.c + +$(OBJ_D)\des_enc.obj: $(SRC_D)\crypto\des\des_enc.c + $(CC) /Fo$(OBJ_D)\des_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\des_enc.c + +$(OBJ_D)\fcrypt_b.obj: $(SRC_D)\crypto\des\fcrypt_b.c + $(CC) /Fo$(OBJ_D)\fcrypt_b.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\fcrypt_b.c + +$(OBJ_D)\read2pwd.obj: $(SRC_D)\crypto\des\read2pwd.c + $(CC) /Fo$(OBJ_D)\read2pwd.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\read2pwd.c + +$(OBJ_D)\fcrypt.obj: $(SRC_D)\crypto\des\fcrypt.c + $(CC) /Fo$(OBJ_D)\fcrypt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\fcrypt.c + +$(OBJ_D)\xcbc_enc.obj: $(SRC_D)\crypto\des\xcbc_enc.c + $(CC) /Fo$(OBJ_D)\xcbc_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\xcbc_enc.c + +$(OBJ_D)\read_pwd.obj: $(SRC_D)\crypto\des\read_pwd.c + $(CC) /Fo$(OBJ_D)\read_pwd.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\read_pwd.c + +$(OBJ_D)\rpc_enc.obj: $(SRC_D)\crypto\des\rpc_enc.c + $(CC) /Fo$(OBJ_D)\rpc_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\rpc_enc.c + +$(OBJ_D)\cbc_cksm.obj: $(SRC_D)\crypto\des\cbc_cksm.c + $(CC) /Fo$(OBJ_D)\cbc_cksm.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\cbc_cksm.c + +$(OBJ_D)\supp.obj: $(SRC_D)\crypto\des\supp.c + $(CC) /Fo$(OBJ_D)\supp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\des\supp.c + +$(OBJ_D)\rc2_ecb.obj: $(SRC_D)\crypto\rc2\rc2_ecb.c + $(CC) /Fo$(OBJ_D)\rc2_ecb.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc2\rc2_ecb.c + +$(OBJ_D)\rc2_skey.obj: $(SRC_D)\crypto\rc2\rc2_skey.c + $(CC) /Fo$(OBJ_D)\rc2_skey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc2\rc2_skey.c + +$(OBJ_D)\rc2_cbc.obj: $(SRC_D)\crypto\rc2\rc2_cbc.c + $(CC) /Fo$(OBJ_D)\rc2_cbc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc2\rc2_cbc.c + +$(OBJ_D)\rc2cfb64.obj: $(SRC_D)\crypto\rc2\rc2cfb64.c + $(CC) /Fo$(OBJ_D)\rc2cfb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc2\rc2cfb64.c + +$(OBJ_D)\rc2ofb64.obj: $(SRC_D)\crypto\rc2\rc2ofb64.c + $(CC) /Fo$(OBJ_D)\rc2ofb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc2\rc2ofb64.c + +$(OBJ_D)\rc4_skey.obj: $(SRC_D)\crypto\rc4\rc4_skey.c + $(CC) /Fo$(OBJ_D)\rc4_skey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc4\rc4_skey.c + +$(OBJ_D)\rc4_enc.obj: $(SRC_D)\crypto\rc4\rc4_enc.c + $(CC) /Fo$(OBJ_D)\rc4_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc4\rc4_enc.c + +$(OBJ_D)\rc5_skey.obj: $(SRC_D)\crypto\rc5\rc5_skey.c + $(CC) /Fo$(OBJ_D)\rc5_skey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc5\rc5_skey.c + +$(OBJ_D)\rc5_ecb.obj: $(SRC_D)\crypto\rc5\rc5_ecb.c + $(CC) /Fo$(OBJ_D)\rc5_ecb.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc5\rc5_ecb.c + +$(OBJ_D)\rc5_enc.obj: $(SRC_D)\crypto\rc5\rc5_enc.c + $(CC) /Fo$(OBJ_D)\rc5_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc5\rc5_enc.c + +$(OBJ_D)\rc5cfb64.obj: $(SRC_D)\crypto\rc5\rc5cfb64.c + $(CC) /Fo$(OBJ_D)\rc5cfb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc5\rc5cfb64.c + +$(OBJ_D)\rc5ofb64.obj: $(SRC_D)\crypto\rc5\rc5ofb64.c + $(CC) /Fo$(OBJ_D)\rc5ofb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rc5\rc5ofb64.c + +$(OBJ_D)\i_cbc.obj: $(SRC_D)\crypto\idea\i_cbc.c + $(CC) /Fo$(OBJ_D)\i_cbc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\idea\i_cbc.c + +$(OBJ_D)\i_cfb64.obj: $(SRC_D)\crypto\idea\i_cfb64.c + $(CC) /Fo$(OBJ_D)\i_cfb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\idea\i_cfb64.c + +$(OBJ_D)\i_ofb64.obj: $(SRC_D)\crypto\idea\i_ofb64.c + $(CC) /Fo$(OBJ_D)\i_ofb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\idea\i_ofb64.c + +$(OBJ_D)\i_ecb.obj: $(SRC_D)\crypto\idea\i_ecb.c + $(CC) /Fo$(OBJ_D)\i_ecb.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\idea\i_ecb.c + +$(OBJ_D)\i_skey.obj: $(SRC_D)\crypto\idea\i_skey.c + $(CC) /Fo$(OBJ_D)\i_skey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\idea\i_skey.c + +$(OBJ_D)\bf_skey.obj: $(SRC_D)\crypto\bf\bf_skey.c + $(CC) /Fo$(OBJ_D)\bf_skey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bf\bf_skey.c + +$(OBJ_D)\bf_ecb.obj: $(SRC_D)\crypto\bf\bf_ecb.c + $(CC) /Fo$(OBJ_D)\bf_ecb.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bf\bf_ecb.c + +$(OBJ_D)\bf_enc.obj: $(SRC_D)\crypto\bf\bf_enc.c + $(CC) /Fo$(OBJ_D)\bf_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bf\bf_enc.c + +$(OBJ_D)\bf_cfb64.obj: $(SRC_D)\crypto\bf\bf_cfb64.c + $(CC) /Fo$(OBJ_D)\bf_cfb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bf\bf_cfb64.c + +$(OBJ_D)\bf_ofb64.obj: $(SRC_D)\crypto\bf\bf_ofb64.c + $(CC) /Fo$(OBJ_D)\bf_ofb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bf\bf_ofb64.c + +$(OBJ_D)\c_skey.obj: $(SRC_D)\crypto\cast\c_skey.c + $(CC) /Fo$(OBJ_D)\c_skey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\cast\c_skey.c + +$(OBJ_D)\c_ecb.obj: $(SRC_D)\crypto\cast\c_ecb.c + $(CC) /Fo$(OBJ_D)\c_ecb.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\cast\c_ecb.c + +$(OBJ_D)\c_enc.obj: $(SRC_D)\crypto\cast\c_enc.c + $(CC) /Fo$(OBJ_D)\c_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\cast\c_enc.c + +$(OBJ_D)\c_cfb64.obj: $(SRC_D)\crypto\cast\c_cfb64.c + $(CC) /Fo$(OBJ_D)\c_cfb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\cast\c_cfb64.c + +$(OBJ_D)\c_ofb64.obj: $(SRC_D)\crypto\cast\c_ofb64.c + $(CC) /Fo$(OBJ_D)\c_ofb64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\cast\c_ofb64.c + +$(OBJ_D)\bn_add.obj: $(SRC_D)\crypto\bn\bn_add.c + $(CC) /Fo$(OBJ_D)\bn_add.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_add.c + +$(OBJ_D)\bn_div.obj: $(SRC_D)\crypto\bn\bn_div.c + $(CC) /Fo$(OBJ_D)\bn_div.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_div.c + +$(OBJ_D)\bn_exp.obj: $(SRC_D)\crypto\bn\bn_exp.c + $(CC) /Fo$(OBJ_D)\bn_exp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_exp.c + +$(OBJ_D)\bn_lib.obj: $(SRC_D)\crypto\bn\bn_lib.c + $(CC) /Fo$(OBJ_D)\bn_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_lib.c + +$(OBJ_D)\bn_mod.obj: $(SRC_D)\crypto\bn\bn_mod.c + $(CC) /Fo$(OBJ_D)\bn_mod.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_mod.c + +$(OBJ_D)\bn_mul.obj: $(SRC_D)\crypto\bn\bn_mul.c + $(CC) /Fo$(OBJ_D)\bn_mul.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_mul.c + +$(OBJ_D)\bn_print.obj: $(SRC_D)\crypto\bn\bn_print.c + $(CC) /Fo$(OBJ_D)\bn_print.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_print.c + +$(OBJ_D)\bn_rand.obj: $(SRC_D)\crypto\bn\bn_rand.c + $(CC) /Fo$(OBJ_D)\bn_rand.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_rand.c + +$(OBJ_D)\bn_shift.obj: $(SRC_D)\crypto\bn\bn_shift.c + $(CC) /Fo$(OBJ_D)\bn_shift.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_shift.c + +$(OBJ_D)\bn_sub.obj: $(SRC_D)\crypto\bn\bn_sub.c + $(CC) /Fo$(OBJ_D)\bn_sub.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_sub.c + +$(OBJ_D)\bn_word.obj: $(SRC_D)\crypto\bn\bn_word.c + $(CC) /Fo$(OBJ_D)\bn_word.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_word.c + +$(OBJ_D)\bn_blind.obj: $(SRC_D)\crypto\bn\bn_blind.c + $(CC) /Fo$(OBJ_D)\bn_blind.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_blind.c + +$(OBJ_D)\bn_gcd.obj: $(SRC_D)\crypto\bn\bn_gcd.c + $(CC) /Fo$(OBJ_D)\bn_gcd.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_gcd.c + +$(OBJ_D)\bn_prime.obj: $(SRC_D)\crypto\bn\bn_prime.c + $(CC) /Fo$(OBJ_D)\bn_prime.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_prime.c + +$(OBJ_D)\bn_err.obj: $(SRC_D)\crypto\bn\bn_err.c + $(CC) /Fo$(OBJ_D)\bn_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_err.c + +$(OBJ_D)\bn_sqr.obj: $(SRC_D)\crypto\bn\bn_sqr.c + $(CC) /Fo$(OBJ_D)\bn_sqr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_sqr.c + +$(OBJ_D)\bn_mulw.obj: $(SRC_D)\crypto\bn\bn_mulw.c + $(CC) /Fo$(OBJ_D)\bn_mulw.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_mulw.c + +$(OBJ_D)\bn_recp.obj: $(SRC_D)\crypto\bn\bn_recp.c + $(CC) /Fo$(OBJ_D)\bn_recp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_recp.c + +$(OBJ_D)\bn_mont.obj: $(SRC_D)\crypto\bn\bn_mont.c + $(CC) /Fo$(OBJ_D)\bn_mont.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_mont.c + +$(OBJ_D)\bn_mpi.obj: $(SRC_D)\crypto\bn\bn_mpi.c + $(CC) /Fo$(OBJ_D)\bn_mpi.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bn\bn_mpi.c + +$(OBJ_D)\rsa_eay.obj: $(SRC_D)\crypto\rsa\rsa_eay.c + $(CC) /Fo$(OBJ_D)\rsa_eay.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_eay.c + +$(OBJ_D)\rsa_gen.obj: $(SRC_D)\crypto\rsa\rsa_gen.c + $(CC) /Fo$(OBJ_D)\rsa_gen.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_gen.c + +$(OBJ_D)\rsa_lib.obj: $(SRC_D)\crypto\rsa\rsa_lib.c + $(CC) /Fo$(OBJ_D)\rsa_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_lib.c + +$(OBJ_D)\rsa_sign.obj: $(SRC_D)\crypto\rsa\rsa_sign.c + $(CC) /Fo$(OBJ_D)\rsa_sign.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_sign.c + +$(OBJ_D)\rsa_saos.obj: $(SRC_D)\crypto\rsa\rsa_saos.c + $(CC) /Fo$(OBJ_D)\rsa_saos.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_saos.c + +$(OBJ_D)\rsa_err.obj: $(SRC_D)\crypto\rsa\rsa_err.c + $(CC) /Fo$(OBJ_D)\rsa_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_err.c + +$(OBJ_D)\rsa_pk1.obj: $(SRC_D)\crypto\rsa\rsa_pk1.c + $(CC) /Fo$(OBJ_D)\rsa_pk1.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_pk1.c + +$(OBJ_D)\rsa_ssl.obj: $(SRC_D)\crypto\rsa\rsa_ssl.c + $(CC) /Fo$(OBJ_D)\rsa_ssl.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_ssl.c + +$(OBJ_D)\rsa_none.obj: $(SRC_D)\crypto\rsa\rsa_none.c + $(CC) /Fo$(OBJ_D)\rsa_none.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rsa\rsa_none.c + +$(OBJ_D)\dsa_gen.obj: $(SRC_D)\crypto\dsa\dsa_gen.c + $(CC) /Fo$(OBJ_D)\dsa_gen.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dsa\dsa_gen.c + +$(OBJ_D)\dsa_key.obj: $(SRC_D)\crypto\dsa\dsa_key.c + $(CC) /Fo$(OBJ_D)\dsa_key.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dsa\dsa_key.c + +$(OBJ_D)\dsa_lib.obj: $(SRC_D)\crypto\dsa\dsa_lib.c + $(CC) /Fo$(OBJ_D)\dsa_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dsa\dsa_lib.c + +$(OBJ_D)\dsa_vrf.obj: $(SRC_D)\crypto\dsa\dsa_vrf.c + $(CC) /Fo$(OBJ_D)\dsa_vrf.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dsa\dsa_vrf.c + +$(OBJ_D)\dsa_sign.obj: $(SRC_D)\crypto\dsa\dsa_sign.c + $(CC) /Fo$(OBJ_D)\dsa_sign.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dsa\dsa_sign.c + +$(OBJ_D)\dsa_err.obj: $(SRC_D)\crypto\dsa\dsa_err.c + $(CC) /Fo$(OBJ_D)\dsa_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dsa\dsa_err.c + +$(OBJ_D)\dh_gen.obj: $(SRC_D)\crypto\dh\dh_gen.c + $(CC) /Fo$(OBJ_D)\dh_gen.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dh\dh_gen.c + +$(OBJ_D)\dh_key.obj: $(SRC_D)\crypto\dh\dh_key.c + $(CC) /Fo$(OBJ_D)\dh_key.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dh\dh_key.c + +$(OBJ_D)\dh_lib.obj: $(SRC_D)\crypto\dh\dh_lib.c + $(CC) /Fo$(OBJ_D)\dh_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dh\dh_lib.c + +$(OBJ_D)\dh_check.obj: $(SRC_D)\crypto\dh\dh_check.c + $(CC) /Fo$(OBJ_D)\dh_check.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dh\dh_check.c + +$(OBJ_D)\dh_err.obj: $(SRC_D)\crypto\dh\dh_err.c + $(CC) /Fo$(OBJ_D)\dh_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\dh\dh_err.c + +$(OBJ_D)\buffer.obj: $(SRC_D)\crypto\buffer\buffer.c + $(CC) /Fo$(OBJ_D)\buffer.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\buffer\buffer.c + +$(OBJ_D)\buf_err.obj: $(SRC_D)\crypto\buffer\buf_err.c + $(CC) /Fo$(OBJ_D)\buf_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\buffer\buf_err.c + +$(OBJ_D)\bio_lib.obj: $(SRC_D)\crypto\bio\bio_lib.c + $(CC) /Fo$(OBJ_D)\bio_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bio_lib.c + +$(OBJ_D)\bio_cb.obj: $(SRC_D)\crypto\bio\bio_cb.c + $(CC) /Fo$(OBJ_D)\bio_cb.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bio_cb.c + +$(OBJ_D)\bio_err.obj: $(SRC_D)\crypto\bio\bio_err.c + $(CC) /Fo$(OBJ_D)\bio_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bio_err.c + +$(OBJ_D)\bss_mem.obj: $(SRC_D)\crypto\bio\bss_mem.c + $(CC) /Fo$(OBJ_D)\bss_mem.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bss_mem.c + +$(OBJ_D)\bss_null.obj: $(SRC_D)\crypto\bio\bss_null.c + $(CC) /Fo$(OBJ_D)\bss_null.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bss_null.c + +$(OBJ_D)\bss_fd.obj: $(SRC_D)\crypto\bio\bss_fd.c + $(CC) /Fo$(OBJ_D)\bss_fd.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bss_fd.c + +$(OBJ_D)\bss_file.obj: $(SRC_D)\crypto\bio\bss_file.c + $(CC) /Fo$(OBJ_D)\bss_file.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bss_file.c + +$(OBJ_D)\bss_sock.obj: $(SRC_D)\crypto\bio\bss_sock.c + $(CC) /Fo$(OBJ_D)\bss_sock.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bss_sock.c + +$(OBJ_D)\bss_conn.obj: $(SRC_D)\crypto\bio\bss_conn.c + $(CC) /Fo$(OBJ_D)\bss_conn.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bss_conn.c + +$(OBJ_D)\bf_null.obj: $(SRC_D)\crypto\bio\bf_null.c + $(CC) /Fo$(OBJ_D)\bf_null.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bf_null.c + +$(OBJ_D)\bf_buff.obj: $(SRC_D)\crypto\bio\bf_buff.c + $(CC) /Fo$(OBJ_D)\bf_buff.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bf_buff.c + +$(OBJ_D)\b_print.obj: $(SRC_D)\crypto\bio\b_print.c + $(CC) /Fo$(OBJ_D)\b_print.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\b_print.c + +$(OBJ_D)\b_dump.obj: $(SRC_D)\crypto\bio\b_dump.c + $(CC) /Fo$(OBJ_D)\b_dump.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\b_dump.c + +$(OBJ_D)\b_sock.obj: $(SRC_D)\crypto\bio\b_sock.c + $(CC) /Fo$(OBJ_D)\b_sock.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\b_sock.c + +$(OBJ_D)\bss_acpt.obj: $(SRC_D)\crypto\bio\bss_acpt.c + $(CC) /Fo$(OBJ_D)\bss_acpt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bss_acpt.c + +$(OBJ_D)\bf_nbio.obj: $(SRC_D)\crypto\bio\bf_nbio.c + $(CC) /Fo$(OBJ_D)\bf_nbio.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\bio\bf_nbio.c + +$(OBJ_D)\stack.obj: $(SRC_D)\crypto\stack\stack.c + $(CC) /Fo$(OBJ_D)\stack.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\stack\stack.c + +$(OBJ_D)\lhash.obj: $(SRC_D)\crypto\lhash\lhash.c + $(CC) /Fo$(OBJ_D)\lhash.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\lhash\lhash.c + +$(OBJ_D)\lh_stats.obj: $(SRC_D)\crypto\lhash\lh_stats.c + $(CC) /Fo$(OBJ_D)\lh_stats.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\lhash\lh_stats.c + +$(OBJ_D)\md_rand.obj: $(SRC_D)\crypto\rand\md_rand.c + $(CC) /Fo$(OBJ_D)\md_rand.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rand\md_rand.c + +$(OBJ_D)\randfile.obj: $(SRC_D)\crypto\rand\randfile.c + $(CC) /Fo$(OBJ_D)\randfile.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\rand\randfile.c + +$(OBJ_D)\err.obj: $(SRC_D)\crypto\err\err.c + $(CC) /Fo$(OBJ_D)\err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\err\err.c + +$(OBJ_D)\err_all.obj: $(SRC_D)\crypto\err\err_all.c + $(CC) /Fo$(OBJ_D)\err_all.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\err\err_all.c + +$(OBJ_D)\err_prn.obj: $(SRC_D)\crypto\err\err_prn.c + $(CC) /Fo$(OBJ_D)\err_prn.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\err\err_prn.c + +$(OBJ_D)\obj_dat.obj: $(SRC_D)\crypto\objects\obj_dat.c + $(CC) /Fo$(OBJ_D)\obj_dat.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\objects\obj_dat.c + +$(OBJ_D)\obj_lib.obj: $(SRC_D)\crypto\objects\obj_lib.c + $(CC) /Fo$(OBJ_D)\obj_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\objects\obj_lib.c + +$(OBJ_D)\obj_err.obj: $(SRC_D)\crypto\objects\obj_err.c + $(CC) /Fo$(OBJ_D)\obj_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\objects\obj_err.c + +$(OBJ_D)\encode.obj: $(SRC_D)\crypto\evp\encode.c + $(CC) /Fo$(OBJ_D)\encode.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\encode.c + +$(OBJ_D)\digest.obj: $(SRC_D)\crypto\evp\digest.c + $(CC) /Fo$(OBJ_D)\digest.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\digest.c + +$(OBJ_D)\evp_enc.obj: $(SRC_D)\crypto\evp\evp_enc.c + $(CC) /Fo$(OBJ_D)\evp_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\evp_enc.c + +$(OBJ_D)\evp_key.obj: $(SRC_D)\crypto\evp\evp_key.c + $(CC) /Fo$(OBJ_D)\evp_key.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\evp_key.c + +$(OBJ_D)\e_ecb_d.obj: $(SRC_D)\crypto\evp\e_ecb_d.c + $(CC) /Fo$(OBJ_D)\e_ecb_d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ecb_d.c + +$(OBJ_D)\e_cbc_d.obj: $(SRC_D)\crypto\evp\e_cbc_d.c + $(CC) /Fo$(OBJ_D)\e_cbc_d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cbc_d.c + +$(OBJ_D)\e_cfb_d.obj: $(SRC_D)\crypto\evp\e_cfb_d.c + $(CC) /Fo$(OBJ_D)\e_cfb_d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cfb_d.c + +$(OBJ_D)\e_ofb_d.obj: $(SRC_D)\crypto\evp\e_ofb_d.c + $(CC) /Fo$(OBJ_D)\e_ofb_d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ofb_d.c + +$(OBJ_D)\e_ecb_i.obj: $(SRC_D)\crypto\evp\e_ecb_i.c + $(CC) /Fo$(OBJ_D)\e_ecb_i.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ecb_i.c + +$(OBJ_D)\e_cbc_i.obj: $(SRC_D)\crypto\evp\e_cbc_i.c + $(CC) /Fo$(OBJ_D)\e_cbc_i.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cbc_i.c + +$(OBJ_D)\e_cfb_i.obj: $(SRC_D)\crypto\evp\e_cfb_i.c + $(CC) /Fo$(OBJ_D)\e_cfb_i.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cfb_i.c + +$(OBJ_D)\e_ofb_i.obj: $(SRC_D)\crypto\evp\e_ofb_i.c + $(CC) /Fo$(OBJ_D)\e_ofb_i.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ofb_i.c + +$(OBJ_D)\e_ecb_3d.obj: $(SRC_D)\crypto\evp\e_ecb_3d.c + $(CC) /Fo$(OBJ_D)\e_ecb_3d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ecb_3d.c + +$(OBJ_D)\e_cbc_3d.obj: $(SRC_D)\crypto\evp\e_cbc_3d.c + $(CC) /Fo$(OBJ_D)\e_cbc_3d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cbc_3d.c + +$(OBJ_D)\e_rc4.obj: $(SRC_D)\crypto\evp\e_rc4.c + $(CC) /Fo$(OBJ_D)\e_rc4.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_rc4.c + +$(OBJ_D)\names.obj: $(SRC_D)\crypto\evp\names.c + $(CC) /Fo$(OBJ_D)\names.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\names.c + +$(OBJ_D)\e_cfb_3d.obj: $(SRC_D)\crypto\evp\e_cfb_3d.c + $(CC) /Fo$(OBJ_D)\e_cfb_3d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cfb_3d.c + +$(OBJ_D)\e_ofb_3d.obj: $(SRC_D)\crypto\evp\e_ofb_3d.c + $(CC) /Fo$(OBJ_D)\e_ofb_3d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ofb_3d.c + +$(OBJ_D)\e_xcbc_d.obj: $(SRC_D)\crypto\evp\e_xcbc_d.c + $(CC) /Fo$(OBJ_D)\e_xcbc_d.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_xcbc_d.c + +$(OBJ_D)\e_ecb_r2.obj: $(SRC_D)\crypto\evp\e_ecb_r2.c + $(CC) /Fo$(OBJ_D)\e_ecb_r2.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ecb_r2.c + +$(OBJ_D)\e_cbc_r2.obj: $(SRC_D)\crypto\evp\e_cbc_r2.c + $(CC) /Fo$(OBJ_D)\e_cbc_r2.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cbc_r2.c + +$(OBJ_D)\e_cfb_r2.obj: $(SRC_D)\crypto\evp\e_cfb_r2.c + $(CC) /Fo$(OBJ_D)\e_cfb_r2.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cfb_r2.c + +$(OBJ_D)\e_ofb_r2.obj: $(SRC_D)\crypto\evp\e_ofb_r2.c + $(CC) /Fo$(OBJ_D)\e_ofb_r2.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ofb_r2.c + +$(OBJ_D)\e_ecb_bf.obj: $(SRC_D)\crypto\evp\e_ecb_bf.c + $(CC) /Fo$(OBJ_D)\e_ecb_bf.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ecb_bf.c + +$(OBJ_D)\e_cbc_bf.obj: $(SRC_D)\crypto\evp\e_cbc_bf.c + $(CC) /Fo$(OBJ_D)\e_cbc_bf.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cbc_bf.c + +$(OBJ_D)\e_cfb_bf.obj: $(SRC_D)\crypto\evp\e_cfb_bf.c + $(CC) /Fo$(OBJ_D)\e_cfb_bf.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cfb_bf.c + +$(OBJ_D)\e_ofb_bf.obj: $(SRC_D)\crypto\evp\e_ofb_bf.c + $(CC) /Fo$(OBJ_D)\e_ofb_bf.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ofb_bf.c + +$(OBJ_D)\e_ecb_c.obj: $(SRC_D)\crypto\evp\e_ecb_c.c + $(CC) /Fo$(OBJ_D)\e_ecb_c.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ecb_c.c + +$(OBJ_D)\e_cbc_c.obj: $(SRC_D)\crypto\evp\e_cbc_c.c + $(CC) /Fo$(OBJ_D)\e_cbc_c.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cbc_c.c + +$(OBJ_D)\e_cfb_c.obj: $(SRC_D)\crypto\evp\e_cfb_c.c + $(CC) /Fo$(OBJ_D)\e_cfb_c.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cfb_c.c + +$(OBJ_D)\e_ofb_c.obj: $(SRC_D)\crypto\evp\e_ofb_c.c + $(CC) /Fo$(OBJ_D)\e_ofb_c.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ofb_c.c + +$(OBJ_D)\e_ecb_r5.obj: $(SRC_D)\crypto\evp\e_ecb_r5.c + $(CC) /Fo$(OBJ_D)\e_ecb_r5.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ecb_r5.c + +$(OBJ_D)\e_cbc_r5.obj: $(SRC_D)\crypto\evp\e_cbc_r5.c + $(CC) /Fo$(OBJ_D)\e_cbc_r5.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cbc_r5.c + +$(OBJ_D)\e_cfb_r5.obj: $(SRC_D)\crypto\evp\e_cfb_r5.c + $(CC) /Fo$(OBJ_D)\e_cfb_r5.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_cfb_r5.c + +$(OBJ_D)\e_ofb_r5.obj: $(SRC_D)\crypto\evp\e_ofb_r5.c + $(CC) /Fo$(OBJ_D)\e_ofb_r5.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_ofb_r5.c + +$(OBJ_D)\m_null.obj: $(SRC_D)\crypto\evp\m_null.c + $(CC) /Fo$(OBJ_D)\m_null.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_null.c + +$(OBJ_D)\m_md2.obj: $(SRC_D)\crypto\evp\m_md2.c + $(CC) /Fo$(OBJ_D)\m_md2.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_md2.c + +$(OBJ_D)\m_md5.obj: $(SRC_D)\crypto\evp\m_md5.c + $(CC) /Fo$(OBJ_D)\m_md5.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_md5.c + +$(OBJ_D)\m_sha.obj: $(SRC_D)\crypto\evp\m_sha.c + $(CC) /Fo$(OBJ_D)\m_sha.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_sha.c + +$(OBJ_D)\m_sha1.obj: $(SRC_D)\crypto\evp\m_sha1.c + $(CC) /Fo$(OBJ_D)\m_sha1.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_sha1.c + +$(OBJ_D)\m_dss.obj: $(SRC_D)\crypto\evp\m_dss.c + $(CC) /Fo$(OBJ_D)\m_dss.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_dss.c + +$(OBJ_D)\m_dss1.obj: $(SRC_D)\crypto\evp\m_dss1.c + $(CC) /Fo$(OBJ_D)\m_dss1.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_dss1.c + +$(OBJ_D)\m_mdc2.obj: $(SRC_D)\crypto\evp\m_mdc2.c + $(CC) /Fo$(OBJ_D)\m_mdc2.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_mdc2.c + +$(OBJ_D)\m_ripemd.obj: $(SRC_D)\crypto\evp\m_ripemd.c + $(CC) /Fo$(OBJ_D)\m_ripemd.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\m_ripemd.c + +$(OBJ_D)\p_open.obj: $(SRC_D)\crypto\evp\p_open.c + $(CC) /Fo$(OBJ_D)\p_open.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\p_open.c + +$(OBJ_D)\p_seal.obj: $(SRC_D)\crypto\evp\p_seal.c + $(CC) /Fo$(OBJ_D)\p_seal.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\p_seal.c + +$(OBJ_D)\p_sign.obj: $(SRC_D)\crypto\evp\p_sign.c + $(CC) /Fo$(OBJ_D)\p_sign.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\p_sign.c + +$(OBJ_D)\p_verify.obj: $(SRC_D)\crypto\evp\p_verify.c + $(CC) /Fo$(OBJ_D)\p_verify.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\p_verify.c + +$(OBJ_D)\p_lib.obj: $(SRC_D)\crypto\evp\p_lib.c + $(CC) /Fo$(OBJ_D)\p_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\p_lib.c + +$(OBJ_D)\p_enc.obj: $(SRC_D)\crypto\evp\p_enc.c + $(CC) /Fo$(OBJ_D)\p_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\p_enc.c + +$(OBJ_D)\p_dec.obj: $(SRC_D)\crypto\evp\p_dec.c + $(CC) /Fo$(OBJ_D)\p_dec.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\p_dec.c + +$(OBJ_D)\bio_md.obj: $(SRC_D)\crypto\evp\bio_md.c + $(CC) /Fo$(OBJ_D)\bio_md.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\bio_md.c + +$(OBJ_D)\bio_b64.obj: $(SRC_D)\crypto\evp\bio_b64.c + $(CC) /Fo$(OBJ_D)\bio_b64.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\bio_b64.c + +$(OBJ_D)\bio_enc.obj: $(SRC_D)\crypto\evp\bio_enc.c + $(CC) /Fo$(OBJ_D)\bio_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\bio_enc.c + +$(OBJ_D)\evp_err.obj: $(SRC_D)\crypto\evp\evp_err.c + $(CC) /Fo$(OBJ_D)\evp_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\evp_err.c + +$(OBJ_D)\e_null.obj: $(SRC_D)\crypto\evp\e_null.c + $(CC) /Fo$(OBJ_D)\e_null.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\e_null.c + +$(OBJ_D)\c_all.obj: $(SRC_D)\crypto\evp\c_all.c + $(CC) /Fo$(OBJ_D)\c_all.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\c_all.c + +$(OBJ_D)\evp_lib.obj: $(SRC_D)\crypto\evp\evp_lib.c + $(CC) /Fo$(OBJ_D)\evp_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\evp\evp_lib.c + +$(OBJ_D)\pem_sign.obj: $(SRC_D)\crypto\pem\pem_sign.c + $(CC) /Fo$(OBJ_D)\pem_sign.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pem\pem_sign.c + +$(OBJ_D)\pem_seal.obj: $(SRC_D)\crypto\pem\pem_seal.c + $(CC) /Fo$(OBJ_D)\pem_seal.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pem\pem_seal.c + +$(OBJ_D)\pem_info.obj: $(SRC_D)\crypto\pem\pem_info.c + $(CC) /Fo$(OBJ_D)\pem_info.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pem\pem_info.c + +$(OBJ_D)\pem_lib.obj: $(SRC_D)\crypto\pem\pem_lib.c + $(CC) /Fo$(OBJ_D)\pem_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pem\pem_lib.c + +$(OBJ_D)\pem_all.obj: $(SRC_D)\crypto\pem\pem_all.c + $(CC) /Fo$(OBJ_D)\pem_all.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pem\pem_all.c + +$(OBJ_D)\pem_err.obj: $(SRC_D)\crypto\pem\pem_err.c + $(CC) /Fo$(OBJ_D)\pem_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pem\pem_err.c + +$(OBJ_D)\a_object.obj: $(SRC_D)\crypto\asn1\a_object.c + $(CC) /Fo$(OBJ_D)\a_object.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_object.c + +$(OBJ_D)\a_bitstr.obj: $(SRC_D)\crypto\asn1\a_bitstr.c + $(CC) /Fo$(OBJ_D)\a_bitstr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_bitstr.c + +$(OBJ_D)\a_utctm.obj: $(SRC_D)\crypto\asn1\a_utctm.c + $(CC) /Fo$(OBJ_D)\a_utctm.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_utctm.c + +$(OBJ_D)\a_int.obj: $(SRC_D)\crypto\asn1\a_int.c + $(CC) /Fo$(OBJ_D)\a_int.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_int.c + +$(OBJ_D)\a_octet.obj: $(SRC_D)\crypto\asn1\a_octet.c + $(CC) /Fo$(OBJ_D)\a_octet.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_octet.c + +$(OBJ_D)\a_print.obj: $(SRC_D)\crypto\asn1\a_print.c + $(CC) /Fo$(OBJ_D)\a_print.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_print.c + +$(OBJ_D)\a_type.obj: $(SRC_D)\crypto\asn1\a_type.c + $(CC) /Fo$(OBJ_D)\a_type.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_type.c + +$(OBJ_D)\a_set.obj: $(SRC_D)\crypto\asn1\a_set.c + $(CC) /Fo$(OBJ_D)\a_set.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_set.c + +$(OBJ_D)\a_dup.obj: $(SRC_D)\crypto\asn1\a_dup.c + $(CC) /Fo$(OBJ_D)\a_dup.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_dup.c + +$(OBJ_D)\a_d2i_fp.obj: $(SRC_D)\crypto\asn1\a_d2i_fp.c + $(CC) /Fo$(OBJ_D)\a_d2i_fp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_d2i_fp.c + +$(OBJ_D)\a_i2d_fp.obj: $(SRC_D)\crypto\asn1\a_i2d_fp.c + $(CC) /Fo$(OBJ_D)\a_i2d_fp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_i2d_fp.c + +$(OBJ_D)\a_sign.obj: $(SRC_D)\crypto\asn1\a_sign.c + $(CC) /Fo$(OBJ_D)\a_sign.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_sign.c + +$(OBJ_D)\a_digest.obj: $(SRC_D)\crypto\asn1\a_digest.c + $(CC) /Fo$(OBJ_D)\a_digest.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_digest.c + +$(OBJ_D)\a_verify.obj: $(SRC_D)\crypto\asn1\a_verify.c + $(CC) /Fo$(OBJ_D)\a_verify.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_verify.c + +$(OBJ_D)\x_algor.obj: $(SRC_D)\crypto\asn1\x_algor.c + $(CC) /Fo$(OBJ_D)\x_algor.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_algor.c + +$(OBJ_D)\x_val.obj: $(SRC_D)\crypto\asn1\x_val.c + $(CC) /Fo$(OBJ_D)\x_val.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_val.c + +$(OBJ_D)\x_pubkey.obj: $(SRC_D)\crypto\asn1\x_pubkey.c + $(CC) /Fo$(OBJ_D)\x_pubkey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_pubkey.c + +$(OBJ_D)\x_sig.obj: $(SRC_D)\crypto\asn1\x_sig.c + $(CC) /Fo$(OBJ_D)\x_sig.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_sig.c + +$(OBJ_D)\x_req.obj: $(SRC_D)\crypto\asn1\x_req.c + $(CC) /Fo$(OBJ_D)\x_req.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_req.c + +$(OBJ_D)\x_attrib.obj: $(SRC_D)\crypto\asn1\x_attrib.c + $(CC) /Fo$(OBJ_D)\x_attrib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_attrib.c + +$(OBJ_D)\x_name.obj: $(SRC_D)\crypto\asn1\x_name.c + $(CC) /Fo$(OBJ_D)\x_name.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_name.c + +$(OBJ_D)\x_cinf.obj: $(SRC_D)\crypto\asn1\x_cinf.c + $(CC) /Fo$(OBJ_D)\x_cinf.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_cinf.c + +$(OBJ_D)\x_x509.obj: $(SRC_D)\crypto\asn1\x_x509.c + $(CC) /Fo$(OBJ_D)\x_x509.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_x509.c + +$(OBJ_D)\x_crl.obj: $(SRC_D)\crypto\asn1\x_crl.c + $(CC) /Fo$(OBJ_D)\x_crl.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_crl.c + +$(OBJ_D)\x_info.obj: $(SRC_D)\crypto\asn1\x_info.c + $(CC) /Fo$(OBJ_D)\x_info.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_info.c + +$(OBJ_D)\x_spki.obj: $(SRC_D)\crypto\asn1\x_spki.c + $(CC) /Fo$(OBJ_D)\x_spki.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_spki.c + +$(OBJ_D)\d2i_r_pr.obj: $(SRC_D)\crypto\asn1\d2i_r_pr.c + $(CC) /Fo$(OBJ_D)\d2i_r_pr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\d2i_r_pr.c + +$(OBJ_D)\i2d_r_pr.obj: $(SRC_D)\crypto\asn1\i2d_r_pr.c + $(CC) /Fo$(OBJ_D)\i2d_r_pr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\i2d_r_pr.c + +$(OBJ_D)\d2i_r_pu.obj: $(SRC_D)\crypto\asn1\d2i_r_pu.c + $(CC) /Fo$(OBJ_D)\d2i_r_pu.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\d2i_r_pu.c + +$(OBJ_D)\i2d_r_pu.obj: $(SRC_D)\crypto\asn1\i2d_r_pu.c + $(CC) /Fo$(OBJ_D)\i2d_r_pu.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\i2d_r_pu.c + +$(OBJ_D)\d2i_s_pr.obj: $(SRC_D)\crypto\asn1\d2i_s_pr.c + $(CC) /Fo$(OBJ_D)\d2i_s_pr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\d2i_s_pr.c + +$(OBJ_D)\i2d_s_pr.obj: $(SRC_D)\crypto\asn1\i2d_s_pr.c + $(CC) /Fo$(OBJ_D)\i2d_s_pr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\i2d_s_pr.c + +$(OBJ_D)\d2i_s_pu.obj: $(SRC_D)\crypto\asn1\d2i_s_pu.c + $(CC) /Fo$(OBJ_D)\d2i_s_pu.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\d2i_s_pu.c + +$(OBJ_D)\i2d_s_pu.obj: $(SRC_D)\crypto\asn1\i2d_s_pu.c + $(CC) /Fo$(OBJ_D)\i2d_s_pu.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\i2d_s_pu.c + +$(OBJ_D)\d2i_pu.obj: $(SRC_D)\crypto\asn1\d2i_pu.c + $(CC) /Fo$(OBJ_D)\d2i_pu.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\d2i_pu.c + +$(OBJ_D)\d2i_pr.obj: $(SRC_D)\crypto\asn1\d2i_pr.c + $(CC) /Fo$(OBJ_D)\d2i_pr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\d2i_pr.c + +$(OBJ_D)\i2d_pu.obj: $(SRC_D)\crypto\asn1\i2d_pu.c + $(CC) /Fo$(OBJ_D)\i2d_pu.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\i2d_pu.c + +$(OBJ_D)\i2d_pr.obj: $(SRC_D)\crypto\asn1\i2d_pr.c + $(CC) /Fo$(OBJ_D)\i2d_pr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\i2d_pr.c + +$(OBJ_D)\t_req.obj: $(SRC_D)\crypto\asn1\t_req.c + $(CC) /Fo$(OBJ_D)\t_req.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\t_req.c + +$(OBJ_D)\t_x509.obj: $(SRC_D)\crypto\asn1\t_x509.c + $(CC) /Fo$(OBJ_D)\t_x509.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\t_x509.c + +$(OBJ_D)\t_pkey.obj: $(SRC_D)\crypto\asn1\t_pkey.c + $(CC) /Fo$(OBJ_D)\t_pkey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\t_pkey.c + +$(OBJ_D)\p7_i_s.obj: $(SRC_D)\crypto\asn1\p7_i_s.c + $(CC) /Fo$(OBJ_D)\p7_i_s.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_i_s.c + +$(OBJ_D)\p7_signi.obj: $(SRC_D)\crypto\asn1\p7_signi.c + $(CC) /Fo$(OBJ_D)\p7_signi.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_signi.c + +$(OBJ_D)\p7_signd.obj: $(SRC_D)\crypto\asn1\p7_signd.c + $(CC) /Fo$(OBJ_D)\p7_signd.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_signd.c + +$(OBJ_D)\p7_recip.obj: $(SRC_D)\crypto\asn1\p7_recip.c + $(CC) /Fo$(OBJ_D)\p7_recip.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_recip.c + +$(OBJ_D)\p7_enc_c.obj: $(SRC_D)\crypto\asn1\p7_enc_c.c + $(CC) /Fo$(OBJ_D)\p7_enc_c.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_enc_c.c + +$(OBJ_D)\p7_evp.obj: $(SRC_D)\crypto\asn1\p7_evp.c + $(CC) /Fo$(OBJ_D)\p7_evp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_evp.c + +$(OBJ_D)\p7_dgst.obj: $(SRC_D)\crypto\asn1\p7_dgst.c + $(CC) /Fo$(OBJ_D)\p7_dgst.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_dgst.c + +$(OBJ_D)\p7_s_e.obj: $(SRC_D)\crypto\asn1\p7_s_e.c + $(CC) /Fo$(OBJ_D)\p7_s_e.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_s_e.c + +$(OBJ_D)\p7_enc.obj: $(SRC_D)\crypto\asn1\p7_enc.c + $(CC) /Fo$(OBJ_D)\p7_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_enc.c + +$(OBJ_D)\p7_lib.obj: $(SRC_D)\crypto\asn1\p7_lib.c + $(CC) /Fo$(OBJ_D)\p7_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\p7_lib.c + +$(OBJ_D)\f_int.obj: $(SRC_D)\crypto\asn1\f_int.c + $(CC) /Fo$(OBJ_D)\f_int.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\f_int.c + +$(OBJ_D)\f_string.obj: $(SRC_D)\crypto\asn1\f_string.c + $(CC) /Fo$(OBJ_D)\f_string.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\f_string.c + +$(OBJ_D)\i2d_dhp.obj: $(SRC_D)\crypto\asn1\i2d_dhp.c + $(CC) /Fo$(OBJ_D)\i2d_dhp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\i2d_dhp.c + +$(OBJ_D)\i2d_dsap.obj: $(SRC_D)\crypto\asn1\i2d_dsap.c + $(CC) /Fo$(OBJ_D)\i2d_dsap.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\i2d_dsap.c + +$(OBJ_D)\d2i_dhp.obj: $(SRC_D)\crypto\asn1\d2i_dhp.c + $(CC) /Fo$(OBJ_D)\d2i_dhp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\d2i_dhp.c + +$(OBJ_D)\d2i_dsap.obj: $(SRC_D)\crypto\asn1\d2i_dsap.c + $(CC) /Fo$(OBJ_D)\d2i_dsap.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\d2i_dsap.c + +$(OBJ_D)\n_pkey.obj: $(SRC_D)\crypto\asn1\n_pkey.c + $(CC) /Fo$(OBJ_D)\n_pkey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\n_pkey.c + +$(OBJ_D)\a_hdr.obj: $(SRC_D)\crypto\asn1\a_hdr.c + $(CC) /Fo$(OBJ_D)\a_hdr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_hdr.c + +$(OBJ_D)\x_pkey.obj: $(SRC_D)\crypto\asn1\x_pkey.c + $(CC) /Fo$(OBJ_D)\x_pkey.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_pkey.c + +$(OBJ_D)\a_bool.obj: $(SRC_D)\crypto\asn1\a_bool.c + $(CC) /Fo$(OBJ_D)\a_bool.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_bool.c + +$(OBJ_D)\x_exten.obj: $(SRC_D)\crypto\asn1\x_exten.c + $(CC) /Fo$(OBJ_D)\x_exten.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\x_exten.c + +$(OBJ_D)\asn1_par.obj: $(SRC_D)\crypto\asn1\asn1_par.c + $(CC) /Fo$(OBJ_D)\asn1_par.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\asn1_par.c + +$(OBJ_D)\asn1_lib.obj: $(SRC_D)\crypto\asn1\asn1_lib.c + $(CC) /Fo$(OBJ_D)\asn1_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\asn1_lib.c + +$(OBJ_D)\asn1_err.obj: $(SRC_D)\crypto\asn1\asn1_err.c + $(CC) /Fo$(OBJ_D)\asn1_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\asn1_err.c + +$(OBJ_D)\a_meth.obj: $(SRC_D)\crypto\asn1\a_meth.c + $(CC) /Fo$(OBJ_D)\a_meth.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_meth.c + +$(OBJ_D)\a_bytes.obj: $(SRC_D)\crypto\asn1\a_bytes.c + $(CC) /Fo$(OBJ_D)\a_bytes.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\a_bytes.c + +$(OBJ_D)\evp_asn1.obj: $(SRC_D)\crypto\asn1\evp_asn1.c + $(CC) /Fo$(OBJ_D)\evp_asn1.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\asn1\evp_asn1.c + +$(OBJ_D)\x509_def.obj: $(SRC_D)\crypto\x509\x509_def.c + $(CC) /Fo$(OBJ_D)\x509_def.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_def.c + +$(OBJ_D)\x509_d2.obj: $(SRC_D)\crypto\x509\x509_d2.c + $(CC) /Fo$(OBJ_D)\x509_d2.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_d2.c + +$(OBJ_D)\x509_r2x.obj: $(SRC_D)\crypto\x509\x509_r2x.c + $(CC) /Fo$(OBJ_D)\x509_r2x.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_r2x.c + +$(OBJ_D)\x509_cmp.obj: $(SRC_D)\crypto\x509\x509_cmp.c + $(CC) /Fo$(OBJ_D)\x509_cmp.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_cmp.c + +$(OBJ_D)\x509_obj.obj: $(SRC_D)\crypto\x509\x509_obj.c + $(CC) /Fo$(OBJ_D)\x509_obj.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_obj.c + +$(OBJ_D)\x509_req.obj: $(SRC_D)\crypto\x509\x509_req.c + $(CC) /Fo$(OBJ_D)\x509_req.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_req.c + +$(OBJ_D)\x509_vfy.obj: $(SRC_D)\crypto\x509\x509_vfy.c + $(CC) /Fo$(OBJ_D)\x509_vfy.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_vfy.c + +$(OBJ_D)\x509_set.obj: $(SRC_D)\crypto\x509\x509_set.c + $(CC) /Fo$(OBJ_D)\x509_set.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_set.c + +$(OBJ_D)\x509rset.obj: $(SRC_D)\crypto\x509\x509rset.c + $(CC) /Fo$(OBJ_D)\x509rset.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509rset.c + +$(OBJ_D)\x509_err.obj: $(SRC_D)\crypto\x509\x509_err.c + $(CC) /Fo$(OBJ_D)\x509_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_err.c + +$(OBJ_D)\x509name.obj: $(SRC_D)\crypto\x509\x509name.c + $(CC) /Fo$(OBJ_D)\x509name.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509name.c + +$(OBJ_D)\x509_v3.obj: $(SRC_D)\crypto\x509\x509_v3.c + $(CC) /Fo$(OBJ_D)\x509_v3.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_v3.c + +$(OBJ_D)\x509_ext.obj: $(SRC_D)\crypto\x509\x509_ext.c + $(CC) /Fo$(OBJ_D)\x509_ext.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_ext.c + +$(OBJ_D)\x509pack.obj: $(SRC_D)\crypto\x509\x509pack.c + $(CC) /Fo$(OBJ_D)\x509pack.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509pack.c + +$(OBJ_D)\x509type.obj: $(SRC_D)\crypto\x509\x509type.c + $(CC) /Fo$(OBJ_D)\x509type.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509type.c + +$(OBJ_D)\x509_lu.obj: $(SRC_D)\crypto\x509\x509_lu.c + $(CC) /Fo$(OBJ_D)\x509_lu.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_lu.c + +$(OBJ_D)\x_all.obj: $(SRC_D)\crypto\x509\x_all.c + $(CC) /Fo$(OBJ_D)\x_all.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x_all.c + +$(OBJ_D)\x509_txt.obj: $(SRC_D)\crypto\x509\x509_txt.c + $(CC) /Fo$(OBJ_D)\x509_txt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\x509_txt.c + +$(OBJ_D)\by_file.obj: $(SRC_D)\crypto\x509\by_file.c + $(CC) /Fo$(OBJ_D)\by_file.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\by_file.c + +$(OBJ_D)\by_dir.obj: $(SRC_D)\crypto\x509\by_dir.c + $(CC) /Fo$(OBJ_D)\by_dir.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\by_dir.c + +$(OBJ_D)\v3_net.obj: $(SRC_D)\crypto\x509\v3_net.c + $(CC) /Fo$(OBJ_D)\v3_net.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\v3_net.c + +$(OBJ_D)\v3_x509.obj: $(SRC_D)\crypto\x509\v3_x509.c + $(CC) /Fo$(OBJ_D)\v3_x509.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\x509\v3_x509.c + +$(OBJ_D)\conf.obj: $(SRC_D)\crypto\conf\conf.c + $(CC) /Fo$(OBJ_D)\conf.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\conf\conf.c + +$(OBJ_D)\conf_err.obj: $(SRC_D)\crypto\conf\conf_err.c + $(CC) /Fo$(OBJ_D)\conf_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\conf\conf_err.c + +$(OBJ_D)\txt_db.obj: $(SRC_D)\crypto\txt_db\txt_db.c + $(CC) /Fo$(OBJ_D)\txt_db.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\txt_db\txt_db.c + +$(OBJ_D)\pk7_lib.obj: $(SRC_D)\crypto\pkcs7\pk7_lib.c + $(CC) /Fo$(OBJ_D)\pk7_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pkcs7\pk7_lib.c + +$(OBJ_D)\pkcs7err.obj: $(SRC_D)\crypto\pkcs7\pkcs7err.c + $(CC) /Fo$(OBJ_D)\pkcs7err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pkcs7\pkcs7err.c + +$(OBJ_D)\pk7_doit.obj: $(SRC_D)\crypto\pkcs7\pk7_doit.c + $(CC) /Fo$(OBJ_D)\pk7_doit.obj $(SHLIB_CFLAGS) -c $(SRC_D)\crypto\pkcs7\pk7_doit.c + +$(OBJ_D)\s2_meth.obj: $(SRC_D)\ssl\s2_meth.c + $(CC) /Fo$(OBJ_D)\s2_meth.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s2_meth.c + +$(OBJ_D)\s2_srvr.obj: $(SRC_D)\ssl\s2_srvr.c + $(CC) /Fo$(OBJ_D)\s2_srvr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s2_srvr.c + +$(OBJ_D)\s2_clnt.obj: $(SRC_D)\ssl\s2_clnt.c + $(CC) /Fo$(OBJ_D)\s2_clnt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s2_clnt.c + +$(OBJ_D)\s2_lib.obj: $(SRC_D)\ssl\s2_lib.c + $(CC) /Fo$(OBJ_D)\s2_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s2_lib.c + +$(OBJ_D)\s2_enc.obj: $(SRC_D)\ssl\s2_enc.c + $(CC) /Fo$(OBJ_D)\s2_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s2_enc.c + +$(OBJ_D)\s2_pkt.obj: $(SRC_D)\ssl\s2_pkt.c + $(CC) /Fo$(OBJ_D)\s2_pkt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s2_pkt.c + +$(OBJ_D)\s3_meth.obj: $(SRC_D)\ssl\s3_meth.c + $(CC) /Fo$(OBJ_D)\s3_meth.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s3_meth.c + +$(OBJ_D)\s3_srvr.obj: $(SRC_D)\ssl\s3_srvr.c + $(CC) /Fo$(OBJ_D)\s3_srvr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s3_srvr.c + +$(OBJ_D)\s3_clnt.obj: $(SRC_D)\ssl\s3_clnt.c + $(CC) /Fo$(OBJ_D)\s3_clnt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s3_clnt.c + +$(OBJ_D)\s3_lib.obj: $(SRC_D)\ssl\s3_lib.c + $(CC) /Fo$(OBJ_D)\s3_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s3_lib.c + +$(OBJ_D)\s3_enc.obj: $(SRC_D)\ssl\s3_enc.c + $(CC) /Fo$(OBJ_D)\s3_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s3_enc.c + +$(OBJ_D)\s3_pkt.obj: $(SRC_D)\ssl\s3_pkt.c + $(CC) /Fo$(OBJ_D)\s3_pkt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s3_pkt.c + +$(OBJ_D)\s3_both.obj: $(SRC_D)\ssl\s3_both.c + $(CC) /Fo$(OBJ_D)\s3_both.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s3_both.c + +$(OBJ_D)\s23_meth.obj: $(SRC_D)\ssl\s23_meth.c + $(CC) /Fo$(OBJ_D)\s23_meth.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s23_meth.c + +$(OBJ_D)\s23_srvr.obj: $(SRC_D)\ssl\s23_srvr.c + $(CC) /Fo$(OBJ_D)\s23_srvr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s23_srvr.c + +$(OBJ_D)\s23_clnt.obj: $(SRC_D)\ssl\s23_clnt.c + $(CC) /Fo$(OBJ_D)\s23_clnt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s23_clnt.c + +$(OBJ_D)\s23_lib.obj: $(SRC_D)\ssl\s23_lib.c + $(CC) /Fo$(OBJ_D)\s23_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s23_lib.c + +$(OBJ_D)\s23_pkt.obj: $(SRC_D)\ssl\s23_pkt.c + $(CC) /Fo$(OBJ_D)\s23_pkt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\s23_pkt.c + +$(OBJ_D)\t1_meth.obj: $(SRC_D)\ssl\t1_meth.c + $(CC) /Fo$(OBJ_D)\t1_meth.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\t1_meth.c + +$(OBJ_D)\t1_srvr.obj: $(SRC_D)\ssl\t1_srvr.c + $(CC) /Fo$(OBJ_D)\t1_srvr.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\t1_srvr.c + +$(OBJ_D)\t1_clnt.obj: $(SRC_D)\ssl\t1_clnt.c + $(CC) /Fo$(OBJ_D)\t1_clnt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\t1_clnt.c + +$(OBJ_D)\t1_lib.obj: $(SRC_D)\ssl\t1_lib.c + $(CC) /Fo$(OBJ_D)\t1_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\t1_lib.c + +$(OBJ_D)\t1_enc.obj: $(SRC_D)\ssl\t1_enc.c + $(CC) /Fo$(OBJ_D)\t1_enc.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\t1_enc.c + +$(OBJ_D)\ssl_lib.obj: $(SRC_D)\ssl\ssl_lib.c + $(CC) /Fo$(OBJ_D)\ssl_lib.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_lib.c + +$(OBJ_D)\ssl_err2.obj: $(SRC_D)\ssl\ssl_err2.c + $(CC) /Fo$(OBJ_D)\ssl_err2.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_err2.c + +$(OBJ_D)\ssl_cert.obj: $(SRC_D)\ssl\ssl_cert.c + $(CC) /Fo$(OBJ_D)\ssl_cert.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_cert.c + +$(OBJ_D)\ssl_sess.obj: $(SRC_D)\ssl\ssl_sess.c + $(CC) /Fo$(OBJ_D)\ssl_sess.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_sess.c + +$(OBJ_D)\ssl_ciph.obj: $(SRC_D)\ssl\ssl_ciph.c + $(CC) /Fo$(OBJ_D)\ssl_ciph.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_ciph.c + +$(OBJ_D)\ssl_stat.obj: $(SRC_D)\ssl\ssl_stat.c + $(CC) /Fo$(OBJ_D)\ssl_stat.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_stat.c + +$(OBJ_D)\ssl_rsa.obj: $(SRC_D)\ssl\ssl_rsa.c + $(CC) /Fo$(OBJ_D)\ssl_rsa.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_rsa.c + +$(OBJ_D)\ssl_asn1.obj: $(SRC_D)\ssl\ssl_asn1.c + $(CC) /Fo$(OBJ_D)\ssl_asn1.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_asn1.c + +$(OBJ_D)\ssl_txt.obj: $(SRC_D)\ssl\ssl_txt.c + $(CC) /Fo$(OBJ_D)\ssl_txt.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_txt.c + +$(OBJ_D)\ssl_algs.obj: $(SRC_D)\ssl\ssl_algs.c + $(CC) /Fo$(OBJ_D)\ssl_algs.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_algs.c + +$(OBJ_D)\bio_ssl.obj: $(SRC_D)\ssl\bio_ssl.c + $(CC) /Fo$(OBJ_D)\bio_ssl.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\bio_ssl.c + +$(OBJ_D)\ssl_err.obj: $(SRC_D)\ssl\ssl_err.c + $(CC) /Fo$(OBJ_D)\ssl_err.obj $(SHLIB_CFLAGS) -c $(SRC_D)\ssl\ssl_err.c + +$(OBJ_D)\rsaref.obj: $(SRC_D)\rsaref\rsaref.c + $(CC) /Fo$(OBJ_D)\rsaref.obj $(LIB_CFLAGS) -c $(SRC_D)\rsaref\rsaref.c + +$(OBJ_D)\rsar_err.obj: $(SRC_D)\rsaref\rsar_err.c + $(CC) /Fo$(OBJ_D)\rsar_err.obj $(LIB_CFLAGS) -c $(SRC_D)\rsaref\rsar_err.c + +$(TEST_D)\md2test.exe: $(OBJ_D)\md2test.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\md2test.obj + $(TEST_D)\md2test.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\md5test.exe: $(OBJ_D)\md5test.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\md5test.obj + $(TEST_D)\md5test.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\shatest.exe: $(OBJ_D)\shatest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\shatest.obj + $(TEST_D)\shatest.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\sha1test.exe: $(OBJ_D)\sha1test.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\sha1test.obj + $(TEST_D)\sha1test.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\mdc2test.exe: $(OBJ_D)\mdc2test.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\mdc2test.obj + $(TEST_D)\mdc2test.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\hmactest.exe: $(OBJ_D)\hmactest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\hmactest.obj + $(TEST_D)\hmactest.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\rmdtest.exe: $(OBJ_D)\rmdtest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\rmdtest.obj + $(TEST_D)\rmdtest.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\destest.exe: $(OBJ_D)\destest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\destest.obj + $(TEST_D)\destest.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\rc2test.exe: $(OBJ_D)\rc2test.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\rc2test.obj + $(TEST_D)\rc2test.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\rc4test.exe: $(OBJ_D)\rc4test.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\rc4test.obj + $(TEST_D)\rc4test.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\rc5test.exe: $(OBJ_D)\rc5test.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\rc5test.obj + $(TEST_D)\rc5test.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\ideatest.exe: $(OBJ_D)\ideatest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\ideatest.obj + $(TEST_D)\ideatest.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\bftest.exe: $(OBJ_D)\bftest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\bftest.obj + $(TEST_D)\bftest.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\casttest.exe: $(OBJ_D)\casttest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\casttest.obj + $(TEST_D)\casttest.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\bntest.exe: $(OBJ_D)\bntest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\bntest.obj + $(TEST_D)\bntest.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\exptest.exe: $(OBJ_D)\exptest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\exptest.obj + $(TEST_D)\exptest.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\dsatest.exe: $(OBJ_D)\dsatest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\dsatest.obj + $(TEST_D)\dsatest.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\dhtest.exe: $(OBJ_D)\dhtest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\dhtest.obj + $(TEST_D)\dhtest.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\randtest.exe: $(OBJ_D)\randtest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\randtest.obj + $(TEST_D)\randtest.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(TEST_D)\ssltest.exe: $(OBJ_D)\ssltest.obj $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) $(OBJ_D)\ssltest.obj + $(TEST_D)\ssltest.exe + + $(L_LIBS) $(EX_LIBS) + +<< + +$(O_SSL): $(SSLOBJ) + $(LINK) $(MLFLAGS) @<< + $(SHLIB_EX_OBJ) + + $(OBJ_D)\bio_ssl.obj + + $(OBJ_D)\s23_clnt.obj + + $(OBJ_D)\s23_lib.obj + + $(OBJ_D)\s23_meth.obj + + $(OBJ_D)\s23_pkt.obj + + $(OBJ_D)\s23_srvr.obj + + $(OBJ_D)\s2_clnt.obj + + $(OBJ_D)\s2_enc.obj + + $(OBJ_D)\s2_lib.obj + + $(OBJ_D)\s2_meth.obj + + $(OBJ_D)\s2_pkt.obj + + $(OBJ_D)\s2_srvr.obj + + $(OBJ_D)\s3_both.obj + + $(OBJ_D)\s3_clnt.obj + + $(OBJ_D)\s3_enc.obj + + $(OBJ_D)\s3_lib.obj + + $(OBJ_D)\s3_meth.obj + + $(OBJ_D)\s3_pkt.obj + + $(OBJ_D)\s3_srvr.obj + + $(OBJ_D)\ssl_algs.obj + + $(OBJ_D)\ssl_asn1.obj + + $(OBJ_D)\ssl_cert.obj + + $(OBJ_D)\ssl_ciph.obj + + $(OBJ_D)\ssl_err.obj + + $(OBJ_D)\ssl_err2.obj + + $(OBJ_D)\ssl_lib.obj + + $(OBJ_D)\ssl_rsa.obj + + $(OBJ_D)\ssl_sess.obj + + $(OBJ_D)\ssl_stat.obj + + $(OBJ_D)\ssl_txt.obj + + $(OBJ_D)\t1_clnt.obj + + $(OBJ_D)\t1_enc.obj + + $(OBJ_D)\t1_lib.obj + + $(OBJ_D)\t1_meth.obj + + $(OBJ_D)\t1_srvr.obj + + + $(O_SSL) + + $(L_CRYPTO) winsock oldnames ldllcew libw +ms\ssleay16.def; +<< + implib /noignorecase /nowep $(L_SSL) $(O_SSL) + +$(O_RSAGLUE): $(RSAGLUEOBJ) + del $(O_RSAGLUE) + $(MKLIB) @<< +$(O_RSAGLUE) +y ++$(OBJ_D)\rsar_err.obj & ++$(OBJ_D)\rsaref.obj & + + +<< + +$(O_CRYPTO): $(CRYPTOOBJ) + $(LINK) $(MLFLAGS) @<< + $(SHLIB_EX_OBJ) + + $(BN_MULW_OBJ) + + $(OBJ_D)\a_bitstr.obj + + $(OBJ_D)\a_bool.obj + + $(OBJ_D)\a_bytes.obj + + $(OBJ_D)\a_d2i_fp.obj + + $(OBJ_D)\a_digest.obj + + $(OBJ_D)\a_dup.obj + + $(OBJ_D)\a_hdr.obj + + $(OBJ_D)\a_i2d_fp.obj + + $(OBJ_D)\a_int.obj + + $(OBJ_D)\a_meth.obj + + $(OBJ_D)\a_object.obj + + $(OBJ_D)\a_octet.obj + + $(OBJ_D)\a_print.obj + + $(OBJ_D)\a_set.obj + + $(OBJ_D)\a_sign.obj + + $(OBJ_D)\a_type.obj + + $(OBJ_D)\a_utctm.obj + + $(OBJ_D)\a_verify.obj + + $(OBJ_D)\asn1_err.obj + + $(OBJ_D)\asn1_lib.obj + + $(OBJ_D)\asn1_par.obj + + $(OBJ_D)\b_dump.obj + + $(OBJ_D)\b_print.obj + + $(OBJ_D)\b_sock.obj + + $(OBJ_D)\bf_buff.obj + + $(OBJ_D)\bf_cfb64.obj + + $(OBJ_D)\bf_ecb.obj + + $(OBJ_D)\bf_enc.obj + + $(OBJ_D)\bf_nbio.obj + + $(OBJ_D)\bf_null.obj + + $(OBJ_D)\bf_ofb64.obj + + $(OBJ_D)\bf_skey.obj + + $(OBJ_D)\bio_b64.obj + + $(OBJ_D)\bio_cb.obj + + $(OBJ_D)\bio_enc.obj + + $(OBJ_D)\bio_err.obj + + $(OBJ_D)\bio_lib.obj + + $(OBJ_D)\bio_md.obj + + $(OBJ_D)\bn_add.obj + + $(OBJ_D)\bn_blind.obj + + $(OBJ_D)\bn_div.obj + + $(OBJ_D)\bn_err.obj + + $(OBJ_D)\bn_exp.obj + + $(OBJ_D)\bn_gcd.obj + + $(OBJ_D)\bn_lib.obj + + $(OBJ_D)\bn_mod.obj + + $(OBJ_D)\bn_mont.obj + + $(OBJ_D)\bn_mpi.obj + + $(OBJ_D)\bn_mul.obj + + $(OBJ_D)\bn_prime.obj + + $(OBJ_D)\bn_print.obj + + $(OBJ_D)\bn_rand.obj + + $(OBJ_D)\bn_recp.obj + + $(OBJ_D)\bn_shift.obj + + $(OBJ_D)\bn_sqr.obj + + $(OBJ_D)\bn_sub.obj + + $(OBJ_D)\bn_word.obj + + $(OBJ_D)\bss_acpt.obj + + $(OBJ_D)\bss_conn.obj + + $(OBJ_D)\bss_fd.obj + + $(OBJ_D)\bss_file.obj + + $(OBJ_D)\bss_mem.obj + + $(OBJ_D)\bss_null.obj + + $(OBJ_D)\bss_sock.obj + + $(OBJ_D)\buf_err.obj + + $(OBJ_D)\buffer.obj + + $(OBJ_D)\by_dir.obj + + $(OBJ_D)\by_file.obj + + $(OBJ_D)\c_all.obj + + $(OBJ_D)\c_cfb64.obj + + $(OBJ_D)\c_ecb.obj + + $(OBJ_D)\c_enc.obj + + $(OBJ_D)\c_ofb64.obj + + $(OBJ_D)\c_skey.obj + + $(OBJ_D)\cbc_cksm.obj + + $(OBJ_D)\cbc_enc.obj + + $(OBJ_D)\cfb64ede.obj + + $(OBJ_D)\cfb64enc.obj + + $(OBJ_D)\cfb_enc.obj + + $(OBJ_D)\conf.obj + + $(OBJ_D)\conf_err.obj + + $(OBJ_D)\cpt_err.obj + + $(OBJ_D)\cryptlib.obj + + $(OBJ_D)\cversion.obj + + $(OBJ_D)\d2i_dhp.obj + + $(OBJ_D)\d2i_dsap.obj + + $(OBJ_D)\d2i_pr.obj + + $(OBJ_D)\d2i_pu.obj + + $(OBJ_D)\d2i_r_pr.obj + + $(OBJ_D)\d2i_r_pu.obj + + $(OBJ_D)\d2i_s_pr.obj + + $(OBJ_D)\d2i_s_pu.obj + + $(OBJ_D)\des_enc.obj + + $(OBJ_D)\dh_check.obj + + $(OBJ_D)\dh_err.obj + + $(OBJ_D)\dh_gen.obj + + $(OBJ_D)\dh_key.obj + + $(OBJ_D)\dh_lib.obj + + $(OBJ_D)\digest.obj + + $(OBJ_D)\dsa_err.obj + + $(OBJ_D)\dsa_gen.obj + + $(OBJ_D)\dsa_key.obj + + $(OBJ_D)\dsa_lib.obj + + $(OBJ_D)\dsa_sign.obj + + $(OBJ_D)\dsa_vrf.obj + + $(OBJ_D)\e_cbc_3d.obj + + $(OBJ_D)\e_cbc_bf.obj + + $(OBJ_D)\e_cbc_c.obj + + $(OBJ_D)\e_cbc_d.obj + + $(OBJ_D)\e_cbc_i.obj + + $(OBJ_D)\e_cbc_r2.obj + + $(OBJ_D)\e_cbc_r5.obj + + $(OBJ_D)\e_cfb_3d.obj + + $(OBJ_D)\e_cfb_bf.obj + + $(OBJ_D)\e_cfb_c.obj + + $(OBJ_D)\e_cfb_d.obj + + $(OBJ_D)\e_cfb_i.obj + + $(OBJ_D)\e_cfb_r2.obj + + $(OBJ_D)\e_cfb_r5.obj + + $(OBJ_D)\e_ecb_3d.obj + + $(OBJ_D)\e_ecb_bf.obj + + $(OBJ_D)\e_ecb_c.obj + + $(OBJ_D)\e_ecb_d.obj + + $(OBJ_D)\e_ecb_i.obj + + $(OBJ_D)\e_ecb_r2.obj + + $(OBJ_D)\e_ecb_r5.obj + + $(OBJ_D)\e_null.obj + + $(OBJ_D)\e_ofb_3d.obj + + $(OBJ_D)\e_ofb_bf.obj + + $(OBJ_D)\e_ofb_c.obj + + $(OBJ_D)\e_ofb_d.obj + + $(OBJ_D)\e_ofb_i.obj + + $(OBJ_D)\e_ofb_r2.obj + + $(OBJ_D)\e_ofb_r5.obj + + $(OBJ_D)\e_rc4.obj + + $(OBJ_D)\e_xcbc_d.obj + + $(OBJ_D)\ecb3_enc.obj + + $(OBJ_D)\ecb_enc.obj + + $(OBJ_D)\enc_read.obj + + $(OBJ_D)\enc_writ.obj + + $(OBJ_D)\encode.obj + + $(OBJ_D)\err.obj + + $(OBJ_D)\err_all.obj + + $(OBJ_D)\err_prn.obj + + $(OBJ_D)\evp_asn1.obj + + $(OBJ_D)\evp_enc.obj + + $(OBJ_D)\evp_err.obj + + $(OBJ_D)\evp_key.obj + + $(OBJ_D)\evp_lib.obj + + $(OBJ_D)\ex_data.obj + + $(OBJ_D)\f_int.obj + + $(OBJ_D)\f_string.obj + + $(OBJ_D)\fcrypt.obj + + $(OBJ_D)\fcrypt_b.obj + + $(OBJ_D)\hmac.obj + + $(OBJ_D)\i2d_dhp.obj + + $(OBJ_D)\i2d_dsap.obj + + $(OBJ_D)\i2d_pr.obj + + $(OBJ_D)\i2d_pu.obj + + $(OBJ_D)\i2d_r_pr.obj + + $(OBJ_D)\i2d_r_pu.obj + + $(OBJ_D)\i2d_s_pr.obj + + $(OBJ_D)\i2d_s_pu.obj + + $(OBJ_D)\i_cbc.obj + + $(OBJ_D)\i_cfb64.obj + + $(OBJ_D)\i_ecb.obj + + $(OBJ_D)\i_ofb64.obj + + $(OBJ_D)\i_skey.obj + + $(OBJ_D)\lh_stats.obj + + $(OBJ_D)\lhash.obj + + $(OBJ_D)\m_dss.obj + + $(OBJ_D)\m_dss1.obj + + $(OBJ_D)\m_md2.obj + + $(OBJ_D)\m_md5.obj + + $(OBJ_D)\m_mdc2.obj + + $(OBJ_D)\m_null.obj + + $(OBJ_D)\m_ripemd.obj + + $(OBJ_D)\m_sha.obj + + $(OBJ_D)\m_sha1.obj + + $(OBJ_D)\md2_dgst.obj + + $(OBJ_D)\md2_one.obj + + $(OBJ_D)\md5_dgst.obj + + $(OBJ_D)\md5_one.obj + + $(OBJ_D)\md_rand.obj + + $(OBJ_D)\mdc2_one.obj + + $(OBJ_D)\mdc2dgst.obj + + $(OBJ_D)\mem.obj + + $(OBJ_D)\n_pkey.obj + + $(OBJ_D)\names.obj + + $(OBJ_D)\obj_dat.obj + + $(OBJ_D)\obj_err.obj + + $(OBJ_D)\obj_lib.obj + + $(OBJ_D)\ofb64ede.obj + + $(OBJ_D)\ofb64enc.obj + + $(OBJ_D)\ofb_enc.obj + + $(OBJ_D)\p7_dgst.obj + + $(OBJ_D)\p7_enc.obj + + $(OBJ_D)\p7_enc_c.obj + + $(OBJ_D)\p7_evp.obj + + $(OBJ_D)\p7_i_s.obj + + $(OBJ_D)\p7_lib.obj + + $(OBJ_D)\p7_recip.obj + + $(OBJ_D)\p7_s_e.obj + + $(OBJ_D)\p7_signd.obj + + $(OBJ_D)\p7_signi.obj + + $(OBJ_D)\p_dec.obj + + $(OBJ_D)\p_enc.obj + + $(OBJ_D)\p_lib.obj + + $(OBJ_D)\p_open.obj + + $(OBJ_D)\p_seal.obj + + $(OBJ_D)\p_sign.obj + + $(OBJ_D)\p_verify.obj + + $(OBJ_D)\pcbc_enc.obj + + $(OBJ_D)\pem_all.obj + + $(OBJ_D)\pem_err.obj + + $(OBJ_D)\pem_info.obj + + $(OBJ_D)\pem_lib.obj + + $(OBJ_D)\pem_seal.obj + + $(OBJ_D)\pem_sign.obj + + $(OBJ_D)\pk7_doit.obj + + $(OBJ_D)\pk7_lib.obj + + $(OBJ_D)\pkcs7err.obj + + $(OBJ_D)\qud_cksm.obj + + $(OBJ_D)\rand_key.obj + + $(OBJ_D)\randfile.obj + + $(OBJ_D)\rc2_cbc.obj + + $(OBJ_D)\rc2_ecb.obj + + $(OBJ_D)\rc2_skey.obj + + $(OBJ_D)\rc2cfb64.obj + + $(OBJ_D)\rc2ofb64.obj + + $(OBJ_D)\rc4_enc.obj + + $(OBJ_D)\rc4_skey.obj + + $(OBJ_D)\rc5_ecb.obj + + $(OBJ_D)\rc5_enc.obj + + $(OBJ_D)\rc5_skey.obj + + $(OBJ_D)\rc5cfb64.obj + + $(OBJ_D)\rc5ofb64.obj + + $(OBJ_D)\read2pwd.obj + + $(OBJ_D)\read_pwd.obj + + $(OBJ_D)\rmd_dgst.obj + + $(OBJ_D)\rmd_one.obj + + $(OBJ_D)\rpc_enc.obj + + $(OBJ_D)\rsa_eay.obj + + $(OBJ_D)\rsa_err.obj + + $(OBJ_D)\rsa_gen.obj + + $(OBJ_D)\rsa_lib.obj + + $(OBJ_D)\rsa_none.obj + + $(OBJ_D)\rsa_pk1.obj + + $(OBJ_D)\rsa_saos.obj + + $(OBJ_D)\rsa_sign.obj + + $(OBJ_D)\rsa_ssl.obj + + $(OBJ_D)\set_key.obj + + $(OBJ_D)\sha1_one.obj + + $(OBJ_D)\sha1dgst.obj + + $(OBJ_D)\sha_dgst.obj + + $(OBJ_D)\sha_one.obj + + $(OBJ_D)\stack.obj + + $(OBJ_D)\str2key.obj + + $(OBJ_D)\supp.obj + + $(OBJ_D)\t_pkey.obj + + $(OBJ_D)\t_req.obj + + $(OBJ_D)\t_x509.obj + + $(OBJ_D)\txt_db.obj + + $(OBJ_D)\v3_net.obj + + $(OBJ_D)\v3_x509.obj + + $(OBJ_D)\x509_cmp.obj + + $(OBJ_D)\x509_d2.obj + + $(OBJ_D)\x509_def.obj + + $(OBJ_D)\x509_err.obj + + $(OBJ_D)\x509_ext.obj + + $(OBJ_D)\x509_lu.obj + + $(OBJ_D)\x509_obj.obj + + $(OBJ_D)\x509_r2x.obj + + $(OBJ_D)\x509_req.obj + + $(OBJ_D)\x509_set.obj + + $(OBJ_D)\x509_txt.obj + + $(OBJ_D)\x509_v3.obj + + $(OBJ_D)\x509_vfy.obj + + $(OBJ_D)\x509name.obj + + $(OBJ_D)\x509pack.obj + + $(OBJ_D)\x509rset.obj + + $(OBJ_D)\x509type.obj + + $(OBJ_D)\x_algor.obj + + $(OBJ_D)\x_all.obj + + $(OBJ_D)\x_attrib.obj + + $(OBJ_D)\x_cinf.obj + + $(OBJ_D)\x_crl.obj + + $(OBJ_D)\x_exten.obj + + $(OBJ_D)\x_info.obj + + $(OBJ_D)\x_name.obj + + $(OBJ_D)\x_pkey.obj + + $(OBJ_D)\x_pubkey.obj + + $(OBJ_D)\x_req.obj + + $(OBJ_D)\x_sig.obj + + $(OBJ_D)\x_spki.obj + + $(OBJ_D)\x_val.obj + + $(OBJ_D)\x_x509.obj + + $(OBJ_D)\xcbc_enc.obj + + + $(O_CRYPTO) + + winsock oldnames ldllcew libw +ms\libeay16.def; +<< + implib /noignorecase /nowep $(L_CRYPTO) $(O_CRYPTO) + +$(BIN_D)\$(E_EXE).exe: $(E_OBJ) $(LIBS_DEP) + $(LINK) $(LFLAGS) @<< + $(APP_EX_OBJ) + + $(OBJ_D)\apps.obj + + $(OBJ_D)\asn1pars.obj + + $(OBJ_D)\ca.obj + + $(OBJ_D)\ciphers.obj + + $(OBJ_D)\crl.obj + + $(OBJ_D)\crl2p7.obj + + $(OBJ_D)\dgst.obj + + $(OBJ_D)\dh.obj + + $(OBJ_D)\dsa.obj + + $(OBJ_D)\dsaparam.obj + + $(OBJ_D)\enc.obj + + $(OBJ_D)\errstr.obj + + $(OBJ_D)\gendh.obj + + $(OBJ_D)\genrsa.obj + + $(OBJ_D)\pkcs7.obj + + $(OBJ_D)\req.obj + + $(OBJ_D)\rsa.obj + + $(OBJ_D)\s_cb.obj + + $(OBJ_D)\s_client.obj + + $(OBJ_D)\s_server.obj + + $(OBJ_D)\s_socket.obj + + $(OBJ_D)\s_time.obj + + $(OBJ_D)\sess_id.obj + + $(OBJ_D)\speed.obj + + $(OBJ_D)\ssleay.obj + + $(OBJ_D)\verify.obj + + $(OBJ_D)\version.obj + + $(OBJ_D)\x509.obj + + + $(BIN_D)\$(E_EXE).exe + + $(L_LIBS) $(EX_LIBS) + +<< + diff --git a/src/lib/libssl/src/mt/README b/src/lib/libssl/src/mt/README new file mode 100644 index 0000000000..df6b26e146 --- /dev/null +++ b/src/lib/libssl/src/mt/README @@ -0,0 +1,14 @@ +Mutithreading testing area. + +Since this stuff is very very platorm specific, this is not part of the +normal build. Have a read of doc/threads.doc. + +mttest will do some testing and will currently build under Windows NT/95, +Solaris and Linux. The IRIX stuff is not finished. + +I have tested this program on a 12 CPU ultra sparc box (solaris 2.5.1) +and things seem to work ok. + +The Linux pthreads package can be retrieved from +http://www.mit.edu:8001/people/proven/pthreads.html + diff --git a/src/lib/libssl/src/mt/mttest.c b/src/lib/libssl/src/mt/mttest.c new file mode 100644 index 0000000000..8651a1131a --- /dev/null +++ b/src/lib/libssl/src/mt/mttest.c @@ -0,0 +1,1115 @@ +/* mt/mttest.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#ifdef LINUX +#include <typedefs.h> +#endif +#ifdef WIN32 +#include <windows.h> +#endif +#ifdef SOLARIS +#include <synch.h> +#include <thread.h> +#endif +#ifdef IRIX +#include <ulocks.h> +#include <sys/prctl.h> +#endif +#include "lhash.h" +#include "crypto.h" +#include "buffer.h" +#include "../e_os.h" +#include "x509.h" +#include "ssl.h" +#include "err.h" + +#ifdef NO_FP_API +#define APPS_WIN16 +#include "../crypto/buffer/bss_file.c" +#endif + +#define TEST_SERVER_CERT "../apps/server.pem" +#define TEST_CLIENT_CERT "../apps/client.pem" + +#define MAX_THREAD_NUMBER 100 + +#ifndef NOPROTO +int MS_CALLBACK verify_callback(int ok, X509 *xs, X509 *xi, int depth, + int error,char *arg); +void thread_setup(void); +void thread_cleanup(void); +void do_threads(SSL_CTX *s_ctx,SSL_CTX *c_ctx); + +void irix_locking_callback(int mode,int type,char *file,int line); +void solaris_locking_callback(int mode,int type,char *file,int line); +void win32_locking_callback(int mode,int type,char *file,int line); +void pthreads_locking_callback(int mode,int type,char *file,int line); + +unsigned long irix_thread_id(void ); +unsigned long solaris_thread_id(void ); +unsigned long pthreads_thread_id(void ); + +#else +int MS_CALLBACK verify_callback(); +void thread_setup(); +void thread_cleanup(); +void do_threads(); + +void irix_locking_callback(); +void solaris_locking_callback(); +void win32_locking_callback(); +void pthreads_locking_callback(); + +unsigned long irix_thread_id(); +unsigned long solaris_thread_id(); +unsigned long pthreads_thread_id(); + +#endif + +BIO *bio_err=NULL; +BIO *bio_stdout=NULL; + +static char *cipher=NULL; +int verbose=0; +#ifdef FIONBIO +static int s_nbio=0; +#endif + +int thread_number=10; +int number_of_loops=10; +int reconnect=0; +int cache_stats=0; + +#ifndef NOPROTO +int doit(char *ctx[4]); +#else +int doit(); +#endif + +static void print_stats(fp,ctx) +FILE *fp; +SSL_CTX *ctx; +{ + fprintf(fp,"%4ld items in the session cache\n", + SSL_CTX_sess_number(ctx)); + fprintf(fp,"%4d client connects (SSL_connect())\n", + SSL_CTX_sess_connect(ctx)); + fprintf(fp,"%4d client connects that finished\n", + SSL_CTX_sess_connect_good(ctx)); + fprintf(fp,"%4d server connects (SSL_accept())\n", + SSL_CTX_sess_accept(ctx)); + fprintf(fp,"%4d server connects that finished\n", + SSL_CTX_sess_accept_good(ctx)); + fprintf(fp,"%4d session cache hits\n",SSL_CTX_sess_hits(ctx)); + fprintf(fp,"%4d session cache misses\n",SSL_CTX_sess_misses(ctx)); + fprintf(fp,"%4d session cache timeouts\n",SSL_CTX_sess_timeouts(ctx)); + } + +static void sv_usage() + { + fprintf(stderr,"usage: ssltest [args ...]\n"); + fprintf(stderr,"\n"); + fprintf(stderr," -server_auth - check server certificate\n"); + fprintf(stderr," -client_auth - do client authentication\n"); + fprintf(stderr," -v - more output\n"); + fprintf(stderr," -CApath arg - PEM format directory of CA's\n"); + fprintf(stderr," -CAfile arg - PEM format file of CA's\n"); + fprintf(stderr," -threads arg - number of threads\n"); + fprintf(stderr," -loops arg - number of 'connections', per thread\n"); + fprintf(stderr," -reconnect - reuse session-id's\n"); + fprintf(stderr," -stats - server session-id cache stats\n"); + fprintf(stderr," -cert arg - server certificate/key\n"); + fprintf(stderr," -ccert arg - client certificate/key\n"); + fprintf(stderr," -ssl3 - just SSLv3n\n"); + } + +int main(argc, argv) +int argc; +char *argv[]; + { + char *CApath=NULL,*CAfile=NULL; + int badop=0; + int ret=1; + int client_auth=0; + int server_auth=0; + SSL_CTX *s_ctx=NULL; + SSL_CTX *c_ctx=NULL; + char *scert=TEST_SERVER_CERT; + char *ccert=TEST_CLIENT_CERT; + SSL_METHOD *ssl_method=SSLv23_method(); + + if (bio_err == NULL) + bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); + if (bio_stdout == NULL) + bio_stdout=BIO_new_fp(stdout,BIO_NOCLOSE); + argc--; + argv++; + + while (argc >= 1) + { + if (strcmp(*argv,"-server_auth") == 0) + server_auth=1; + else if (strcmp(*argv,"-client_auth") == 0) + client_auth=1; + else if (strcmp(*argv,"-reconnect") == 0) + reconnect=1; + else if (strcmp(*argv,"-stats") == 0) + cache_stats=1; + else if (strcmp(*argv,"-ssl3") == 0) + ssl_method=SSLv3_method(); + else if (strcmp(*argv,"-ssl2") == 0) + ssl_method=SSLv2_method(); + else if (strcmp(*argv,"-CApath") == 0) + { + if (--argc < 1) goto bad; + CApath= *(++argv); + } + else if (strcmp(*argv,"-CAfile") == 0) + { + if (--argc < 1) goto bad; + CAfile= *(++argv); + } + else if (strcmp(*argv,"-cert") == 0) + { + if (--argc < 1) goto bad; + scert= *(++argv); + } + else if (strcmp(*argv,"-ccert") == 0) + { + if (--argc < 1) goto bad; + ccert= *(++argv); + } + else if (strcmp(*argv,"-threads") == 0) + { + if (--argc < 1) goto bad; + thread_number= atoi(*(++argv)); + if (thread_number == 0) thread_number=1; + if (thread_number > MAX_THREAD_NUMBER) + thread_number=MAX_THREAD_NUMBER; + } + else if (strcmp(*argv,"-loops") == 0) + { + if (--argc < 1) goto bad; + number_of_loops= atoi(*(++argv)); + if (number_of_loops == 0) number_of_loops=1; + } + else + { + fprintf(stderr,"unknown option %s\n",*argv); + badop=1; + break; + } + argc--; + argv++; + } + if (badop) + { +bad: + sv_usage(); + goto end; + } + + if (cipher == NULL) cipher=getenv("SSL_CIPHER"); + + SSL_load_error_strings(); + SSLeay_add_ssl_algorithms(); + + c_ctx=SSL_CTX_new(ssl_method); + s_ctx=SSL_CTX_new(ssl_method); + if ((c_ctx == NULL) || (s_ctx == NULL)) + { + ERR_print_errors(bio_err); + goto end; + } + + SSL_CTX_set_session_cache_mode(s_ctx, + SSL_SESS_CACHE_NO_AUTO_CLEAR|SSL_SESS_CACHE_SERVER); + SSL_CTX_set_session_cache_mode(c_ctx, + SSL_SESS_CACHE_NO_AUTO_CLEAR|SSL_SESS_CACHE_SERVER); + + SSL_CTX_use_certificate_file(s_ctx,scert,SSL_FILETYPE_PEM); + SSL_CTX_use_RSAPrivateKey_file(s_ctx,scert,SSL_FILETYPE_PEM); + + if (client_auth) + { + SSL_CTX_use_certificate_file(c_ctx,ccert, + SSL_FILETYPE_PEM); + SSL_CTX_use_RSAPrivateKey_file(c_ctx,ccert, + SSL_FILETYPE_PEM); + } + + if ( (!SSL_CTX_load_verify_locations(s_ctx,CAfile,CApath)) || + (!SSL_CTX_set_default_verify_paths(s_ctx)) || + (!SSL_CTX_load_verify_locations(c_ctx,CAfile,CApath)) || + (!SSL_CTX_set_default_verify_paths(c_ctx))) + { + fprintf(stderr,"SSL_load_verify_locations\n"); + ERR_print_errors(bio_err); + goto end; + } + + if (client_auth) + { + fprintf(stderr,"client authentication\n"); + SSL_CTX_set_verify(s_ctx, + SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT, + verify_callback); + } + if (server_auth) + { + fprintf(stderr,"server authentication\n"); + SSL_CTX_set_verify(c_ctx,SSL_VERIFY_PEER, + verify_callback); + } + + thread_setup(); + do_threads(s_ctx,c_ctx); + thread_cleanup(); +end: + + if (c_ctx != NULL) + { + fprintf(stderr,"Client SSL_CTX stats then free it\n"); + print_stats(stderr,c_ctx); + SSL_CTX_free(c_ctx); + } + if (s_ctx != NULL) + { + fprintf(stderr,"Server SSL_CTX stats then free it\n"); + print_stats(stderr,s_ctx); + if (cache_stats) + { + fprintf(stderr,"-----\n"); + lh_stats(SSL_CTX_sessions(s_ctx),stderr); + fprintf(stderr,"-----\n"); + /* lh_node_stats(SSL_CTX_sessions(s_ctx),stderr); + fprintf(stderr,"-----\n"); */ + lh_node_usage_stats(SSL_CTX_sessions(s_ctx),stderr); + fprintf(stderr,"-----\n"); + } + SSL_CTX_free(s_ctx); + fprintf(stderr,"done free\n"); + } + exit(ret); + return(0); + } + +#define W_READ 1 +#define W_WRITE 2 +#define C_DONE 1 +#define S_DONE 2 + +int ndoit(ssl_ctx) +SSL_CTX *ssl_ctx[2]; + { + int i; + int ret; + char *ctx[4]; + + ctx[0]=(char *)ssl_ctx[0]; + ctx[1]=(char *)ssl_ctx[1]; + + if (reconnect) + { + ctx[2]=(char *)SSL_new(ssl_ctx[0]); + ctx[3]=(char *)SSL_new(ssl_ctx[1]); + } + else + { + ctx[2]=NULL; + ctx[3]=NULL; + } + + fprintf(stdout,"started thread %lu\n",CRYPTO_thread_id()); + for (i=0; i<number_of_loops; i++) + { +/* fprintf(stderr,"%4d %2d ctx->ref (%3d,%3d)\n", + CRYPTO_thread_id(),i, + ssl_ctx[0]->references, + ssl_ctx[1]->references); */ + /* pthread_delay_np(&tm);*/ + + ret=doit(ctx); + if (ret != 0) + { + fprintf(stdout,"error[%d] %lu - %d\n", + i,CRYPTO_thread_id(),ret); + return(ret); + } + } + fprintf(stdout,"DONE %lu\n",CRYPTO_thread_id()); + if (reconnect) + { + SSL_free((SSL *)ctx[2]); + SSL_free((SSL *)ctx[3]); + } + return(0); + } + +int doit(ctx) +char *ctx[4]; + { + SSL_CTX *s_ctx,*c_ctx; + static char cbuf[200],sbuf[200]; + SSL *c_ssl=NULL; + SSL *s_ssl=NULL; + BIO *c_to_s=NULL; + BIO *s_to_c=NULL; + BIO *c_bio=NULL; + BIO *s_bio=NULL; + int c_r,c_w,s_r,s_w; + int c_want,s_want; + int i; + int done=0; + int c_write,s_write; + int do_server=0,do_client=0; + + s_ctx=(SSL_CTX *)ctx[0]; + c_ctx=(SSL_CTX *)ctx[1]; + + if (ctx[2] != NULL) + s_ssl=(SSL *)ctx[2]; + else + s_ssl=SSL_new(s_ctx); + + if (ctx[3] != NULL) + c_ssl=(SSL *)ctx[3]; + else + c_ssl=SSL_new(c_ctx); + + if ((s_ssl == NULL) || (c_ssl == NULL)) goto err; + + c_to_s=BIO_new(BIO_s_mem()); + s_to_c=BIO_new(BIO_s_mem()); + if ((s_to_c == NULL) || (c_to_s == NULL)) goto err; + + c_bio=BIO_new(BIO_f_ssl()); + s_bio=BIO_new(BIO_f_ssl()); + if ((c_bio == NULL) || (s_bio == NULL)) goto err; + + SSL_set_connect_state(c_ssl); + SSL_set_bio(c_ssl,s_to_c,c_to_s); + BIO_set_ssl(c_bio,c_ssl,(ctx[2] == NULL)?BIO_CLOSE:BIO_NOCLOSE); + + SSL_set_accept_state(s_ssl); + SSL_set_bio(s_ssl,c_to_s,s_to_c); + BIO_set_ssl(s_bio,s_ssl,(ctx[3] == NULL)?BIO_CLOSE:BIO_NOCLOSE); + + c_r=0; s_r=1; + c_w=1; s_w=0; + c_want=W_WRITE; + s_want=0; + c_write=1,s_write=0; + + /* We can always do writes */ + for (;;) + { + do_server=0; + do_client=0; + + i=(int)BIO_pending(s_bio); + if ((i && s_r) || s_w) do_server=1; + + i=(int)BIO_pending(c_bio); + if ((i && c_r) || c_w) do_client=1; + + if (do_server && verbose) + { + if (SSL_in_init(s_ssl)) + printf("server waiting in SSL_accept - %s\n", + SSL_state_string_long(s_ssl)); + else if (s_write) + printf("server:SSL_write()\n"); + else + printf("server:SSL_read()\n"); + } + + if (do_client && verbose) + { + if (SSL_in_init(c_ssl)) + printf("client waiting in SSL_connect - %s\n", + SSL_state_string_long(c_ssl)); + else if (c_write) + printf("client:SSL_write()\n"); + else + printf("client:SSL_read()\n"); + } + + if (!do_client && !do_server) + { + fprintf(stdout,"ERROR IN STARTUP\n"); + break; + } + if (do_client && !(done & C_DONE)) + { + if (c_write) + { + i=BIO_write(c_bio,"hello from client\n",18); + if (i < 0) + { + c_r=0; + c_w=0; + if (BIO_should_retry(c_bio)) + { + if (BIO_should_read(c_bio)) + c_r=1; + if (BIO_should_write(c_bio)) + c_w=1; + } + else + { + fprintf(stderr,"ERROR in CLIENT\n"); + return(1); + } + } + else if (i == 0) + { + fprintf(stderr,"SSL CLIENT STARTUP FAILED\n"); + return(1); + } + else + { + /* ok */ + c_write=0; + } + } + else + { + i=BIO_read(c_bio,cbuf,100); + if (i < 0) + { + c_r=0; + c_w=0; + if (BIO_should_retry(c_bio)) + { + if (BIO_should_read(c_bio)) + c_r=1; + if (BIO_should_write(c_bio)) + c_w=1; + } + else + { + fprintf(stderr,"ERROR in CLIENT\n"); + return(1); + } + } + else if (i == 0) + { + fprintf(stderr,"SSL CLIENT STARTUP FAILED\n"); + return(1); + } + else + { + done|=C_DONE; +#ifdef undef + fprintf(stdout,"CLIENT:from server:"); + fwrite(cbuf,1,i,stdout); + fflush(stdout); +#endif + } + } + } + + if (do_server && !(done & S_DONE)) + { + if (!s_write) + { + i=BIO_read(s_bio,sbuf,100); + if (i < 0) + { + s_r=0; + s_w=0; + if (BIO_should_retry(s_bio)) + { + if (BIO_should_read(s_bio)) + s_r=1; + if (BIO_should_write(s_bio)) + s_w=1; + } + else + { + fprintf(stderr,"ERROR in SERVER\n"); + ERR_print_errors_fp(stderr); + return(1); + } + } + else if (i == 0) + { + fprintf(stderr,"SSL SERVER STARTUP FAILED\n"); + return(1); + } + else + { + s_write=1; + s_w=1; +#ifdef undef + fprintf(stdout,"SERVER:from client:"); + fwrite(sbuf,1,i,stdout); + fflush(stdout); +#endif + } + } + else + { + i=BIO_write(s_bio,"hello from server\n",18); + if (i < 0) + { + s_r=0; + s_w=0; + if (BIO_should_retry(s_bio)) + { + if (BIO_should_read(s_bio)) + s_r=1; + if (BIO_should_write(s_bio)) + s_w=1; + } + else + { + fprintf(stderr,"ERROR in SERVER\n"); + ERR_print_errors_fp(stderr); + return(1); + } + } + else if (i == 0) + { + fprintf(stderr,"SSL SERVER STARTUP FAILED\n"); + return(1); + } + else + { + s_write=0; + s_r=1; + done|=S_DONE; + } + } + } + + if ((done & S_DONE) && (done & C_DONE)) break; + } + + SSL_set_shutdown(c_ssl,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN); + SSL_set_shutdown(s_ssl,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN); + +#ifdef undef + fprintf(stdout,"DONE\n"); +#endif +err: + /* We have to set the BIO's to NULL otherwise they will be + * free()ed twice. Once when th s_ssl is SSL_free()ed and + * again when c_ssl is SSL_free()ed. + * This is a hack required because s_ssl and c_ssl are sharing the same + * BIO structure and SSL_set_bio() and SSL_free() automatically + * BIO_free non NULL entries. + * You should not normally do this or be required to do this */ + + if (s_ssl != NULL) + { + s_ssl->rbio=NULL; + s_ssl->wbio=NULL; + } + if (c_ssl != NULL) + { + c_ssl->rbio=NULL; + c_ssl->wbio=NULL; + } + + /* The SSL's are optionally freed in the following calls */ + if (c_to_s != NULL) BIO_free(c_to_s); + if (s_to_c != NULL) BIO_free(s_to_c); + + if (c_bio != NULL) BIO_free(c_bio); + if (s_bio != NULL) BIO_free(s_bio); + return(0); + } + +int MS_CALLBACK verify_callback(ok, xs, xi, depth, error, arg) +int ok; +X509 *xs; +X509 *xi; +int depth; +int error; +char *arg; + { + char buf[256]; + + if (verbose) + { + X509_NAME_oneline(X509_get_subject_name(xs),buf,256); + if (ok) + fprintf(stderr,"depth=%d %s\n",depth,buf); + else + fprintf(stderr,"depth=%d error=%d %s\n",depth,error,buf); + } + return(ok); + } + +#define THREAD_STACK_SIZE (16*1024) + +#ifdef WIN32 + +static PRLOCK lock_cs[CRYPTO_NUM_LOCKS]; + +void thread_setup() + { + int i; + + for (i=0; i<CRYPTO_NUM_LOCKS; i++) + { + lock_cs[i]=CreateMutex(NULL,FALSE,NULL); + } + + CRYPTO_set_locking_callback((void (*)(int,int,char *,int))win32_locking_callback); + /* id callback defined */ + } + +void thread_cleanup() + { + int i; + + CRYPTO_set_locking_callback(NULL); + for (i=0; i<CRYPTO_NUM_LOCKS; i++) + CloseHandle(lock_cs[i]); + } + +void win32_locking_callback(mode,type,file,line) +int mode; +int type; +char *file; +int line; + { + if (mode & CRYPTO_LOCK) + { + WaitForSingleObject(lock_cs[type],INFINITE); + } + else + { + ReleaseMutex(lock_cs[type]); + } + } + +void do_threads(s_ctx,c_ctx) +SSL_CTX *s_ctx,*c_ctx; + { + double ret; + SSL_CTX *ssl_ctx[2]; + DWORD thread_id[MAX_THREAD_NUMBER]; + HANDLE thread_handle[MAX_THREAD_NUMBER]; + int i; + SYSTEMTIME start,end; + + ssl_ctx[0]=s_ctx; + ssl_ctx[1]=c_ctx; + + GetSystemTime(&start); + for (i=0; i<thread_number; i++) + { + thread_handle[i]=CreateThread(NULL, + THREAD_STACK_SIZE, + (LPTHREAD_START_ROUTINE)ndoit, + (void *)ssl_ctx, + 0L, + &(thread_id[i])); + } + + printf("reaping\n"); + for (i=0; i<thread_number; i+=50) + { + int j; + + j=(thread_number < (i+50))?(thread_number-i):50; + + if (WaitForMultipleObjects(j, + (CONST HANDLE *)&(thread_handle[i]),TRUE,INFINITE) + == WAIT_FAILED) + { + fprintf(stderr,"WaitForMultipleObjects failed:%d\n",GetLastError()); + exit(1); + } + } + GetSystemTime(&end); + + if (start.wDayOfWeek > end.wDayOfWeek) end.wDayOfWeek+=7; + ret=(end.wDayOfWeek-start.wDayOfWeek)*24; + + ret=(ret+end.wHour-start.wHour)*60; + ret=(ret+end.wMinute-start.wMinute)*60; + ret=(ret+end.wSecond-start.wSecond); + ret+=(end.wMilliseconds-start.wMilliseconds)/1000.0; + + printf("win32 threads done - %.3f seconds\n",ret); + } + +#endif /* WIN32 */ + +#ifdef SOLARIS + +static mutex_t lock_cs[CRYPTO_NUM_LOCKS]; +/*static rwlock_t lock_cs[CRYPTO_NUM_LOCKS]; */ +static long lock_count[CRYPTO_NUM_LOCKS]; + +void thread_setup() + { + int i; + + for (i=0; i<CRYPTO_NUM_LOCKS; i++) + { + lock_count[i]=0; + /* rwlock_init(&(lock_cs[i]),USYNC_THREAD,NULL); */ + mutex_init(&(lock_cs[i]),USYNC_THREAD,NULL); + } + + CRYPTO_set_id_callback((unsigned long (*)())solaris_thread_id); + CRYPTO_set_locking_callback((void (*)())solaris_locking_callback); + } + +void thread_cleanup() + { + int i; + + CRYPTO_set_locking_callback(NULL); +fprintf(stderr,"cleanup\n"); + for (i=0; i<CRYPTO_NUM_LOCKS; i++) + { + /* rwlock_destroy(&(lock_cs[i])); */ + mutex_destroy(&(lock_cs[i])); + fprintf(stderr,"%8ld:%s\n",lock_count[i],CRYPTO_get_lock_name(i)); + } +fprintf(stderr,"done cleanup\n"); + } + +void solaris_locking_callback(mode,type,file,line) +int mode; +int type; +char *file; +int line; + { +#ifdef undef +fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", + CRYPTO_thread_id(), + (mode&CRYPTO_LOCK)?"l":"u", + (type&CRYPTO_READ)?"r":"w",file,line); +#endif + +/* +if (CRYPTO_LOCK_SSL_CERT == type) + fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n", + CRYPTO_thread_id(), + mode,file,line); +*/ + if (mode & CRYPTO_LOCK) + { + /* if (mode & CRYPTO_READ) + rw_rdlock(&(lock_cs[type])); + else + rw_wrlock(&(lock_cs[type])); */ + + mutex_lock(&(lock_cs[type])); + lock_count[type]++; + } + else + { +/* rw_unlock(&(lock_cs[type])); */ + mutex_unlock(&(lock_cs[type])); + } + } + +void do_threads(s_ctx,c_ctx) +SSL_CTX *s_ctx,*c_ctx; + { + SSL_CTX *ssl_ctx[2]; + thread_t thread_ctx[MAX_THREAD_NUMBER]; + int i; + + ssl_ctx[0]=s_ctx; + ssl_ctx[1]=c_ctx; + + thr_setconcurrency(thread_number); + for (i=0; i<thread_number; i++) + { + thr_create(NULL, THREAD_STACK_SIZE, + (void *(*)())ndoit, + (void *)ssl_ctx, + 0L, + &(thread_ctx[i])); + } + + printf("reaping\n"); + for (i=0; i<thread_number; i++) + { + thr_join(thread_ctx[i],NULL,NULL); + } + + printf("solaris threads done (%d,%d)\n", + s_ctx->references,c_ctx->references); + } + +unsigned long solaris_thread_id() + { + unsigned long ret; + + ret=(unsigned long)thr_self(); + return(ret); + } +#endif /* SOLARIS */ + +#ifdef IRIX + + +static usptr_t *arena; +static usema_t *lock_cs[CRYPTO_NUM_LOCKS]; + +void thread_setup() + { + int i; + char filename[20]; + + strcpy(filename,"/tmp/mttest.XXXXXX"); + mktemp(filename); + + usconfig(CONF_STHREADIOOFF); + usconfig(CONF_STHREADMALLOCOFF); + usconfig(CONF_INITUSERS,100); + usconfig(CONF_LOCKTYPE,US_DEBUGPLUS); + arena=usinit(filename); + unlink(filename); + + for (i=0; i<CRYPTO_NUM_LOCKS; i++) + { + lock_cs[i]=usnewsema(arena,1); + } + + CRYPTO_set_id_callback((unsigned long (*)())irix_thread_id); + CRYPTO_set_locking_callback((void (*)())irix_locking_callback); + } + +void thread_cleanup() + { + int i; + + CRYPTO_set_locking_callback(NULL); + for (i=0; i<CRYPTO_NUM_LOCKS; i++) + { + char buf[10]; + + sprintf(buf,"%2d:",i); + usdumpsema(lock_cs[i],stdout,buf); + usfreesema(lock_cs[i],arena); + } + } + +void irix_locking_callback(mode,type,file,line) +int mode; +int type; +char *file; +int line; + { + if (mode & CRYPTO_LOCK) + { + printf("lock %d\n",type); + uspsema(lock_cs[type]); + } + else + { + printf("unlock %d\n",type); + usvsema(lock_cs[type]); + } + } + +void do_threads(s_ctx,c_ctx) +SSL_CTX *s_ctx,*c_ctx; + { + SSL_CTX *ssl_ctx[2]; + int thread_ctx[MAX_THREAD_NUMBER]; + int i; + + ssl_ctx[0]=s_ctx; + ssl_ctx[1]=c_ctx; + + for (i=0; i<thread_number; i++) + { + thread_ctx[i]=sproc((void (*)())ndoit, + PR_SADDR|PR_SFDS,(void *)ssl_ctx); + } + + printf("reaping\n"); + for (i=0; i<thread_number; i++) + { + wait(NULL); + } + + printf("irix threads done (%d,%d)\n", + s_ctx->references,c_ctx->references); + } + +unsigned long irix_thread_id() + { + unsigned long ret; + + ret=(unsigned long)getpid(); + return(ret); + } +#endif /* IRIX */ + +#ifdef PTHREADS + +static pthread_mutex_t lock_cs[CRYPTO_NUM_LOCKS]; +static long lock_count[CRYPTO_NUM_LOCKS]; + +void thread_setup() + { + int i; + + for (i=0; i<CRYPTO_NUM_LOCKS; i++) + { + lock_count[i]=0; + pthread_mutex_init(&(lock_cs[i]),NULL); + } + + CRYPTO_set_id_callback((unsigned long (*)())pthreads_thread_id); + CRYPTO_set_locking_callback((void (*)())pthreads_locking_callback); + } + +void thread_cleanup() + { + int i; + + CRYPTO_set_locking_callback(NULL); + fprintf(stderr,"cleanup\n"); + for (i=0; i<CRYPTO_NUM_LOCKS; i++) + { + pthread_mutex_destroy(&(lock_cs[i])); + fprintf(stderr,"%8ld:%s\n",lock_count[i], + CRYPTO_get_lock_name(i)); + } + fprintf(stderr,"done cleanup\n"); + } + +void pthreads_locking_callback(mode,type,file,line) +int mode; +int type; +char *file; +int line; + { +#ifdef undef + fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", + CRYPTO_thread_id(), + (mode&CRYPTO_LOCK)?"l":"u", + (type&CRYPTO_READ)?"r":"w",file,line); +#endif +/* + if (CRYPTO_LOCK_SSL_CERT == type) + fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n", + CRYPTO_thread_id(), + mode,file,line); +*/ + if (mode & CRYPTO_LOCK) + { + pthread_mutex_lock(&(lock_cs[type])); + lock_count[type]++; + } + else + { + pthread_mutex_unlock(&(lock_cs[type])); + } + } + +void do_threads(s_ctx,c_ctx) +SSL_CTX *s_ctx,*c_ctx; + { + SSL_CTX *ssl_ctx[2]; + pthread_t thread_ctx[MAX_THREAD_NUMBER]; + int i; + + ssl_ctx[0]=s_ctx; + ssl_ctx[1]=c_ctx; + + /* + thr_setconcurrency(thread_number); + */ + for (i=0; i<thread_number; i++) + { + pthread_create(&(thread_ctx[i]), NULL, + (void *(*)())ndoit, (void *)ssl_ctx); + } + + printf("reaping\n"); + for (i=0; i<thread_number; i++) + { + pthread_join(thread_ctx[i],NULL); + } + + printf("pthreads threads done (%d,%d)\n", + s_ctx->references,c_ctx->references); + } + +unsigned long pthreads_thread_id() + { + unsigned long ret; + + ret=(unsigned long)pthread_self(); + return(ret); + } + +#endif /* PTHREADS */ + + + diff --git a/src/lib/libssl/src/mt/profile.sh b/src/lib/libssl/src/mt/profile.sh new file mode 100644 index 0000000000..de5eb06708 --- /dev/null +++ b/src/lib/libssl/src/mt/profile.sh @@ -0,0 +1,4 @@ +#!/bin/sh +/bin/rm -f mttest +cc -p -DSOLARIS -I../include -g mttest.c -o mttest -L/usr/lib/libc -ldl -L.. -lthread -lssl -lcrypto -lnsl -lsocket + diff --git a/src/lib/libssl/src/mt/ptest.bat b/src/lib/libssl/src/mt/ptest.bat new file mode 100644 index 0000000000..ccaccae09d --- /dev/null +++ b/src/lib/libssl/src/mt/ptest.bat @@ -0,0 +1,4 @@ +del mttest.exe + +purify cl /O2 -DWIN32 /MD -I..\out mttest.c /Femttest ..\out\ssl32.lib ..\out\crypt32.lib + diff --git a/src/lib/libssl/src/mt/pthread.sh b/src/lib/libssl/src/mt/pthread.sh new file mode 100644 index 0000000000..7d0b6e55f5 --- /dev/null +++ b/src/lib/libssl/src/mt/pthread.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# +# build using pthreads +# +# http://www.mit.edu:8001/people/proven/pthreads.html +# +/bin/rm -f mttest +pgcc -DPTHREADS -I../include -g mttest.c -o mttest -L.. -lssl -lcrypto + diff --git a/src/lib/libssl/src/mt/purify.sh b/src/lib/libssl/src/mt/purify.sh new file mode 100644 index 0000000000..57c4017073 --- /dev/null +++ b/src/lib/libssl/src/mt/purify.sh @@ -0,0 +1,4 @@ +#!/bin/sh +/bin/rm -f mttest +purify cc -DSOLARIS -I../include -g mttest.c -o mttest -L.. -lthread -lssl -lcrypto -lnsl -lsocket + diff --git a/src/lib/libssl/src/mt/solaris.sh b/src/lib/libssl/src/mt/solaris.sh new file mode 100644 index 0000000000..f6a90b17ee --- /dev/null +++ b/src/lib/libssl/src/mt/solaris.sh @@ -0,0 +1,4 @@ +#!/bin/sh +/bin/rm -f mttest +cc -DSOLARIS -I../include -g mttest.c -o mttest -L.. -lthread -lssl -lcrypto -lnsl -lsocket + diff --git a/src/lib/libssl/src/mt/win32.bat b/src/lib/libssl/src/mt/win32.bat new file mode 100644 index 0000000000..56089f69be --- /dev/null +++ b/src/lib/libssl/src/mt/win32.bat @@ -0,0 +1,4 @@ +del mttest.exe + +cl /O2 -DWIN32 /MD -I..\out mttest.c /Femttest ..\out\ssleay32.lib ..\out\libeay32.lib + diff --git a/src/lib/libssl/src/perl/MANIFEST b/src/lib/libssl/src/perl/MANIFEST new file mode 100644 index 0000000000..992db5ed4c --- /dev/null +++ b/src/lib/libssl/src/perl/MANIFEST @@ -0,0 +1,17 @@ +MANIFEST +Makefile.PL +SSLeay.pm +bio.xs +bn.xs +cipher.xs +digest.xs +err.xs +ssl.xs +x509.xs +test.pl +test2.pl +test3.pl +test9.pl +testbn.pl +testmd.pl +typemap diff --git a/src/lib/libssl/src/perl/Makefile.PL b/src/lib/libssl/src/perl/Makefile.PL new file mode 100644 index 0000000000..f9998e0a61 --- /dev/null +++ b/src/lib/libssl/src/perl/Makefile.PL @@ -0,0 +1,25 @@ +use ExtUtils::MakeMaker; +# See lib/ExtUtils/MakeMaker.pm for details of how to influence +# the contents of the Makefile that is written. +WriteMakefile( + 'OPTIMIZE' => '-g', + 'DISTNAME' => 'SSLeay-perl5-0.8.5', + 'NAME' => 'SSLeay', + 'VERSION_FROM' => 'SSLeay.pm', + 'LIBS' => ['-L.. -lssl -lcrypto'], + 'DEFINE' => '', + 'INC' => '-I../include', + 'C' => ['callback.c'], + 'H' => ['p5SSLeay.h'], + 'OBJECT' => " SSLeay.o bio.o bn.o cipher.o digest.o err.o + ssl.o x509.o", + 'XS' => { 'SSLeay.xs' => 'SSLeay.c', + 'bio.xs' => 'bio.c', + 'bn.xs' => 'bn.c', + 'cipher.xs' => 'cipher.c', + 'digest.xs' => 'digest.c', + 'err.xs' => 'err.c', + 'ssl.xs' => 'ssl.c', + 'x509.xs' => 'x509.c', + } + ); diff --git a/src/lib/libssl/src/perl/SSLeay.pm b/src/lib/libssl/src/perl/SSLeay.pm new file mode 100644 index 0000000000..f7710039d2 --- /dev/null +++ b/src/lib/libssl/src/perl/SSLeay.pm @@ -0,0 +1,78 @@ +package SSLeay; + +use Exporter; +use DynaLoader; + +@ISA = qw(Exporter DynaLoader); +@EXPORT = qw(); + +$VERSION='0.82'; +$VERSION='0.82'; +bootstrap SSLeay; + +@SSLeay::BN::ISA= qw(SSLeay::ERR); +@SSLeay::MD::ISA= qw(SSLeay::ERR); +@SSLeay::Cipher::ISA= qw(SSLeay::ERR); +@SSLeay::SSL::CTX::ISA= qw(SSLeay::ERR); +@SSLeay::BIO::ISA= qw(SSLeay::ERR); +@SSLeay::SSL::ISA= qw(SSLeay::ERR); + +@BN::ISA= qw(SSLeay::BN); +@MD::ISA= qw(SSLeay::MD); +@Cipher::ISA= qw(SSLeay::Cipher); +@SSL::ISA= qw(SSLeay::SSL); +@SSL::CTX::ISA= qw(SSLeay::SSL::CTX); +@BIO::ISA= qw(SSLeay::BIO); + + +@SSLeay::MD::names=qw(md2 md5 sha sha1 ripemd160 mdc2); + +@SSLeay::Cipher::names=qw( + des-ecb des-cfb des-ofb des-cbc + des-ede des-ede-cfb des-ede-ofb des-ede-cbc + des-ede3 des-ede3-cfb des-ede3-ofb des-ede3-cbc + desx-cbc rc4 rc4-40 + idea-ecb idea-cfb idea-ofb idea-cbc + rc2-ecb rc2-cbc rc2-40-cbc rc2-cfb rc2-ofb + bf-ecb bf-cfb bf-ofb bf-cbc + cast5-ecb cast5-cfb cast5-ofb cast5-cbc + rc5-ecb rc5-cfb rc5-ofb rc5-cbc + ); + +sub SSLeay::SSL::CTX::new_ssl { SSLeay::SSL::new($_[0]); } + +sub SSLeay::ERR::error + { + my($o)=@_; + my($s,$ret); + + while (($s=$o->get_error()) != 0) + { + $ret.=$s."\n"; + } + return($ret); + } + +@SSLeay::Cipher::aliases=qw(des desx des3 idea rc2 bf cast); + +package SSLeay::BN; + +sub bnfix { (ref($_[0]) ne "SSLeay::BN")?SSLeay::BN::dec2bn($_[0]):$_[0]; } +use overload +"=" => sub { dup($_[0]); }, +"+" => sub { add($_[0],$_[1]); }, +"-" => sub { ($_[1],$_[0])=($_[0],$_[1]) if $_[2]; + SSLeay::BN::sub($_[0],$_[1]); }, +"*" => sub { mul($_[0],$_[1]); }, +"/" => sub { ($_[1],$_[0])=($_[0],$_[1]) if $_[2]; (div($_[0],$_[1]))[0]; }, +"%" => sub { ($_[1],$_[0])=($_[0],$_[1]) if $_[2]; mod($_[0],$_[1]); }, +"**" => sub { ($_[1],$_[0])=($_[0],$_[1]) if $_[2]; exp($_[0],$_[1]); }, +"<<" => sub { lshift($_[0],$_[1]); }, +">>" => sub { rshift($_[0],$_[1]); }, +"<=>" => sub { SSLeay::BN::cmp($_[0],$_[1]); }, +'""' => sub { bn2dec($_[0]); }, +'0+' => sub { dec2bn($_[0]); }, +"bool" => sub { ref($_[0]) eq "SSLeay::BN"; }; + +sub SSLeay::BIO::do_accept { SSLeay::BIO::do_handshake(@_); } +1; diff --git a/src/lib/libssl/src/perl/SSLeay.xs b/src/lib/libssl/src/perl/SSLeay.xs new file mode 100644 index 0000000000..582b5705aa --- /dev/null +++ b/src/lib/libssl/src/perl/SSLeay.xs @@ -0,0 +1,63 @@ +#include "p5SSLeay.h" + +SV *new_ref(type,obj,mort) +char *type; +char *obj; + { + SV *ret; + + if (mort) + ret=sv_newmortal(); + else + ret=newSViv(0); + sv_setref_pv(ret,type,(void *)obj); + return(ret); + } + +int ex_new(obj,data,ad,idx,argl,argp) +char *obj; +SV *data; +CRYPTO_EX_DATA *ad; +int idx; +long argl; +char *argp; + { + SV *sv; + +fprintf(stderr,"ex_new %08X %s\n",obj,argp); + sv=sv_newmortal(); + sv_setref_pv(sv,argp,(void *)obj); + CRYPTO_set_ex_data(ad,idx,(char *)sv); + return(1); + } + +void ex_cleanup(obj,data,ad,idx,argl,argp) +char *obj; +SV *data; +CRYPTO_EX_DATA *ad; +int idx; +long argl; +char *argp; + { + pr_name("ex_cleanup"); +fprintf(stderr,"ex_cleanup %08X %s\n",obj,argp); + if (data != NULL) + SvREFCNT_dec((SV *)data); + } + +MODULE = SSLeay PACKAGE = SSLeay + +BOOT: + boot_bio(); + boot_cipher(); + boot_digest(); + boot_err(); + boot_ssl(); + boot_SSLeay__BN(); + boot_SSLeay__BIO(); + boot_SSLeay__Cipher(); + boot_SSLeay__MD(); + boot_SSLeay__ERR(); + boot_SSLeay__SSL(); + boot_SSLeay__X509(); + diff --git a/src/lib/libssl/src/perl/b.pl b/src/lib/libssl/src/perl/b.pl new file mode 100644 index 0000000000..e8b3fd0dd9 --- /dev/null +++ b/src/lib/libssl/src/perl/b.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$cmd=<<"EOF"; + +EOF + +$conn="localhost:4433"; +$conn=$ARGV[0] if $#ARGV >= 0; +print "X\n"; +$bio=BIO->new("connect"); +print "XX\n"; +$bio->set_callback(sub {print STDERR $_[0]->number_read."\n"; $_[$#_] }); +print "XXX\n"; +$bio->hostname($conn) || die $ssl->error(); +print "XXXX\n"; + +#$ssl=BIO->new("ssl"); diff --git a/src/lib/libssl/src/perl/bio.pl b/src/lib/libssl/src/perl/bio.pl new file mode 100644 index 0000000000..653322c2cc --- /dev/null +++ b/src/lib/libssl/src/perl/bio.pl @@ -0,0 +1,28 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$cmd=<<"EOF"; + +EOF + +$conn="localhost:4433"; +$conn=$ARGV[0] if $#ARGV >= 0; +$bio=SSLeay::BIO::new("connect"); +$bio->set_callback(sub {print STDERR $_[0]->number_read."\n"; $_[$#_] }); +$bio->hostname($conn) || die $ssl->error(); + + +(($ret=$bio->do_handshake()) > 0) || die $bio->error(); + +(($ret=$bio->syswrite($cmd)) > 0) || die $bio->error(); + +while (1) + { + $ret=$bio->sysread($buf,10240); + last if ($ret <= 0); + print $buf; + } + diff --git a/src/lib/libssl/src/perl/bio.txt b/src/lib/libssl/src/perl/bio.txt new file mode 100644 index 0000000000..5b46c9f5ee --- /dev/null +++ b/src/lib/libssl/src/perl/bio.txt @@ -0,0 +1,36 @@ +BIO::new(type) + "connect" + "accept" + "ssl" + "buffer" + +"connect" + BIO::hostname(name) host:port to connect to + +"accept" + BIO::set_accept_port(port) port to connect too. + +"connect", "accept", "ssl" + BIO::do_andshake do protocol + +"ssl" + BIO::set_ssl(ssl) + BIO::get_ssl() + +BIO::push(bio) +BIO::pop; return BIO +BIO::number_read() +BIO::number_written() +BIO::references() + +BIO::sysread(buf,len[,offset]) +BIO::syswrite(in[,len][,offset]) +BIO::getline() +BIO::puts(in) +BIO::flush() +BIO::type() +BIO::next_bio(); +BIO::set_callback(callback[, args]) + +BIO::new_buffer_ssl_connect(SSL_CTX) +BIO::new_ssl_connect(SSL_CTX) diff --git a/src/lib/libssl/src/perl/bio.xs b/src/lib/libssl/src/perl/bio.xs new file mode 100644 index 0000000000..3782d42062 --- /dev/null +++ b/src/lib/libssl/src/perl/bio.xs @@ -0,0 +1,448 @@ +#include "p5SSLeay.h" + +static int p5_bio_ex_bio_ptr=0; +static int p5_bio_ex_bio_callback=0; +static int p5_bio_ex_bio_callback_data=0; + +static long p5_bio_callback(bio,state,parg,cmd,larg,ret) +BIO *bio; +int state; +char *parg; +int cmd; +long larg; +int ret; + { + int i; + SV *me,*cb; + + me=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr); + cb=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_callback); + if (cb != NULL) + { + dSP; + + ENTER ; + SAVETMPS; + + PUSHMARK(sp); + XPUSHs(me); + XPUSHs(sv_2mortal(newSViv(state))); + XPUSHs(sv_2mortal(newSViv(cmd))); + if ((state == BIO_CB_READ) || (state == BIO_CB_WRITE)) + { + XPUSHs(sv_2mortal(newSVpv(parg,larg))); + } + else + XPUSHs(&sv_undef); + /* ptr one */ + XPUSHs(sv_2mortal(newSViv(larg))); + XPUSHs(sv_2mortal(newSViv(ret))); + PUTBACK; + + i=perl_call_sv(cb,G_SCALAR); + + SPAGAIN; + if (i == 1) + ret=POPi; + else + ret=1; + PUTBACK; + FREETMPS; + LEAVE; + } + else + { + croak("Internal error in SSL p5_ssl_info_callback"); + } + return(ret); + } + +int boot_bio() + { + p5_bio_ex_bio_ptr= + BIO_get_ex_new_index(0,"SSLeay::BIO",ex_new,NULL,ex_cleanup); + p5_bio_ex_bio_callback= + BIO_get_ex_new_index(0,"bio_callback",NULL,NULL, + ex_cleanup); + p5_bio_ex_bio_callback_data= + BIO_get_ex_new_index(0,"bio_callback_data",NULL,NULL, + ex_cleanup); + return(1); + } + +MODULE = SSLeay::BIO PACKAGE = SSLeay::BIO PREFIX = p5_BIO_ + +VERSIONCHECK: DISABLE + +void +p5_BIO_new_buffer_ssl_connect(...) + PREINIT: + SSL_CTX *ctx; + BIO *bio; + SV *arg; + PPCODE: + if (items == 1) + arg=ST(0); + else if (items == 2) + arg=ST(1); + else + arg=NULL; + + if ((arg == NULL) || !(sv_derived_from(arg,"SSLeay::SSL::CTX"))) + croak("Usage: SSLeay::BIO::new_buffer_ssl_connect(SSL_CTX)"); + else + { + IV tmp=SvIV((SV *)SvRV(arg)); + ctx=(SSL_CTX *)tmp; + } + EXTEND(sp,1); + bio=BIO_new_buffer_ssl_connect(ctx); + arg=new_ref("SSLeay::BIO",(char *)bio,0); + PUSHs(arg); + BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,(char *)arg); + +void +p5_BIO_new_ssl_connect(...) + PREINIT: + SSL_CTX *ctx; + BIO *bio; + SV *arg; + PPCODE: + if (items == 1) + arg=ST(0); + else if (items == 2) + arg=ST(1); + else + arg=NULL; + + if ((arg == NULL) || !(sv_derived_from(arg,"SSLeay::SSL::CTX"))) + croak("Usage: SSLeay::BIO::new_ssl_connect(SSL_CTX)"); + else + { + IV tmp=SvIV((SV *)SvRV(arg)); + ctx=(SSL_CTX *)tmp; + } + EXTEND(sp,1); + bio=BIO_new_ssl_connect(ctx); + arg=new_ref("SSLeay::BIO",(char *)bio,0); + PUSHs(arg); + BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,(char *)arg); + +void +p5_BIO_new(...) + PREINIT: + BIO *bio; + char *type; + SV *arg; + PPCODE: + pr_name("p5_BIO_new"); + if ((items == 1) && SvPOK(ST(0))) + type=SvPV(ST(0),na); + else if ((items == 2) && SvPOK(ST(1))) + type=SvPV(ST(1),na); + else + croak("Usage: SSLeay::BIO::new(type)"); + + EXTEND(sp,1); + if (strcmp(type,"connect") == 0) + bio=BIO_new(BIO_s_connect()); + else if (strcmp(type,"accept") == 0) + bio=BIO_new(BIO_s_accept()); + else if (strcmp(type,"ssl") == 0) + bio=BIO_new(BIO_f_ssl()); + else if (strcmp(type,"buffer") == 0) + bio=BIO_new(BIO_f_buffer()); + else + croak("unknown BIO type"); + arg=new_ref("SSLeay::BIO",(char *)bio,0); + PUSHs(arg); + BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,(char *)arg); + +int +p5_BIO_hostname(bio,name) + BIO *bio; + char *name; + CODE: + RETVAL=BIO_set_hostname(bio,name); + OUTPUT: + RETVAL + +int +p5_BIO_set_accept_port(bio,str) + BIO *bio; + char *str; + CODE: + RETVAL=BIO_set_accept_port(bio,str); + OUTPUT: + RETVAL + +int +p5_BIO_do_handshake(bio) + BIO *bio; + CODE: + RETVAL=BIO_do_handshake(bio); + OUTPUT: + RETVAL + +BIO * +p5_BIO_push(b,bio) + BIO *b; + BIO *bio; + CODE: + /* This reference will be reduced when the reference is + * let go, and then when the BIO_free_all() is called + * inside the SSLeay library by the BIO with this + * pushed into */ + bio->references++; + RETVAL=BIO_push(b,bio); + OUTPUT: + RETVAL + +void +p5_BIO_pop(b) + BIO *b + PREINIT: + BIO *bio; + char *type; + SV *arg; + PPCODE: + bio=BIO_pop(b); + if (bio != NULL) + { + /* This BIO will either be one created in the + * perl library, in which case it will have a perl + * SV, otherwise it will have been created internally, + * inside SSLeay. For the 'pushed in', it needs + * the reference count decememted. */ + arg=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr); + if (arg == NULL) + { + arg=new_ref("SSLeay::BIO",(char *)bio,0); + PUSHs(arg); + BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,(char *)arg); + } + else + { + /* it was pushed in */ + SvREFCNT_inc(arg); + PUSHs(arg); + if (bio->references < 1) + abort(); + /* decrement the reference count */ + BIO_free(bio); + } + } + +int +p5_BIO_sysread(bio,in,num, ...) + BIO *bio; + SV *in; + int num; + PREINIT: + int i,n,olen; + int offset; + char *p; + CODE: + offset=0; + if (!SvPOK(in)) + sv_setpvn(in,"",0); + SvPV(in,olen); + if (items > 3) + { + offset=SvIV(ST(3)); + if (offset < 0) + { + if (-offset > olen) + croad("Offset outside string"); + offset+=olen; + } + } + if ((num+offset) > olen) + { + SvGROW(in,num+offset+1); + p=SvPV(in,i); + memset(&(p[olen]),0,(num+offset)-olen+1); + } + p=SvPV(in,n); + + i=BIO_read(bio,p+offset,num); + RETVAL=i; + if (i <= 0) i=0; + SvCUR_set(in,offset+i); + OUTPUT: + RETVAL + +int +p5_BIO_syswrite(bio,in, ...) + BIO *bio; + SV *in; + PREINIT: + char *ptr; + int len,in_len; + int offset=0; + int n; + CODE: + ptr=SvPV(in,in_len); + if (items > 2) + { + len=SvOK(ST(2))?SvIV(ST(2)):in_len; + if (items > 3) + { + offset=SvIV(ST(3)); + if (offset < 0) + { + if (-offset > in_len) + croak("Offset outside string"); + offset+=in_len; + } + else if ((offset >= in_len) && (in_len > 0)) + croak("Offset outside string"); + } + if (len >= (in_len-offset)) + len=in_len-offset; + } + else + len=in_len; + + RETVAL=BIO_write(bio,ptr+offset,len); + OUTPUT: + RETVAL + +void +p5_BIO_getline(bio) + BIO *bio; + PREINIT: + int i; + char *p; + PPCODE: + pr_name("p5_BIO_gets"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + sv_setpvn(ST(0),"",0); + SvGROW(ST(0),1024); + p=SvPV(ST(0),na); + i=BIO_gets(bio,p,1024); + if (i < 0) i=0; + SvCUR_set(ST(0),i); + +int +p5_BIO_flush(bio) + BIO *bio; + CODE: + RETVAL=BIO_flush(bio); + OUTPUT: + RETVAL + +char * +p5_BIO_type(bio) + BIO *bio; + CODE: + RETVAL=bio->method->name; + OUTPUT: + RETVAL + +void +p5_BIO_next_bio(b) + BIO *b + PREINIT: + BIO *bio; + char *type; + SV *arg; + PPCODE: + bio=b->next_bio; + if (bio != NULL) + { + arg=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr); + if (arg == NULL) + { + arg=new_ref("SSLeay::BIO",(char *)bio,0); + PUSHs(arg); + BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,(char *)arg); + } + else + { + SvREFCNT_inc(arg); + PUSHs(arg); + } + } + +int +p5_BIO_puts(bio,in) + BIO *bio; + SV *in; + PREINIT: + char *ptr; + CODE: + ptr=SvPV(in,na); + RETVAL=BIO_puts(bio,ptr); + OUTPUT: + RETVAL + +void +p5_BIO_set_callback(bio,cb,...) + BIO *bio; + SV *cb; + PREINIT: + SV *arg=NULL; + SV *arg2=NULL; + CODE: + if (items > 3) + croak("Usage: SSLeay::BIO::set_callback(bio,callback[,arg]"); + if (items == 3) + { + arg2=sv_mortalcopy(ST(2)); + SvREFCNT_inc(arg2); + BIO_set_ex_data(bio,p5_bio_ex_bio_callback_data, + (char *)arg2); + } + arg=sv_mortalcopy(ST(1)); + SvREFCNT_inc(arg); + BIO_set_ex_data(bio,p5_bio_ex_bio_callback,(char *)arg); + BIO_set_callback(bio,p5_bio_callback); + +void +p5_BIO_DESTROY(bio) + BIO *bio + PREINIT: + SV *sv; + PPCODE: + pr_name_d("p5_BIO_DESTROY",bio->references); + printf("p5_BIO_DESTROY <%s> %d\n",bio->method->name,bio->references); + BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,NULL); + BIO_free_all(bio); + +int +p5_BIO_set_ssl(bio,ssl) + BIO *bio; + SSL *ssl; + CODE: + pr_name("p5_BIO_set_ssl"); + ssl->references++; + RETVAL=BIO_set_ssl(bio,ssl,BIO_CLOSE); + OUTPUT: + RETVAL + +int +p5_BIO_number_read(bio) + BIO *bio; + CODE: + RETVAL=BIO_number_read(bio); + OUTPUT: + RETVAL + +int +p5_BIO_number_written(bio) + BIO *bio; + CODE: + RETVAL=BIO_number_written(bio); + OUTPUT: + RETVAL + +int +p5_BIO_references(bio) + BIO *bio; + CODE: + RETVAL=bio->references; + OUTPUT: + RETVAL + diff --git a/src/lib/libssl/src/perl/bn.pl b/src/lib/libssl/src/perl/bn.pl new file mode 100644 index 0000000000..5314ca46e1 --- /dev/null +++ b/src/lib/libssl/src/perl/bn.pl @@ -0,0 +1,23 @@ +#!/usr/bin/perl +use ExtUtils::testlib; +use SSLeay; + +$message=SSLeay::BN::new(); +$e=SSLeay::BN::new(); +$mod=SSLeay::BN::new(); + +$mod=SSLeay::BN::dec2bn("114381625757888867669235779976146612010218296721242362562561842935706935245733897830597123563958705058989075147599290026879543541"); +$e=5; +$d=SSLeay::BN::dec2bn("45752650303155547067694311990458644804087318688496945025024737159778909096647814932594914301288138204957467016445183857236173773"); + +$message=SSLeay::BN::bin2bn("The magic words are squeamish ossifrage"); + + + $cipher_text= $message->mod_exp($e,$mod); +print $mod."\n"; +print $mod->num_bits()."\n"; +for (1 .. 1000) + { + $clear= $cipher_text->mod_exp($d,$mod); + } +print $clear->bn2bin()."\n"; diff --git a/src/lib/libssl/src/perl/bn.txt b/src/lib/libssl/src/perl/bn.txt new file mode 100644 index 0000000000..784e761558 --- /dev/null +++ b/src/lib/libssl/src/perl/bn.txt @@ -0,0 +1,38 @@ +BN->new() +BN->dup(a) +BN->rand(bits[,top][,bottom]) + +BN->hex2bn(a) +BN->bn2hex(a) +BN->dec2bn(a) +BN->bn2dec(a) +BN->bin2bn(a) +BN->bn2bin(a) +BN->mpi2bn(a) +BN->bn2mpi(a) + +BN->add(a,b) +BN->sub(a,b) +BN->mul(a,b) +(div,mod)=BN->div(a,b) +BN->mod(a,b) +BN->exp(a,p) +BN->mod_mul(a,b,c) +BN->mod_exp(a,b,c) + +BN->is_prime(p,num) +BN->generate_prime(bits,strong,callback) + +BN->num_bits(a) +BN->cmp(a,b) +BN->ucmp(a,b) +BN->is_bit_set(a,pos) +BN->set_bit(a,pos) +BN->clear_bit(a,pos) +BN->lshift(a,num) +BN->rshift(a,num) +BN->mask_bits(a,pos) +BN->clear(a) +BN->gcd(a,b) +BN->mod_inverse(a,mod) + diff --git a/src/lib/libssl/src/perl/bn.xs b/src/lib/libssl/src/perl/bn.xs new file mode 100644 index 0000000000..c15be3729a --- /dev/null +++ b/src/lib/libssl/src/perl/bn.xs @@ -0,0 +1,589 @@ +#include "p5SSLeay.h" + +int sv_to_BIGNUM(var,arg,name) +BIGNUM **var; +SV *arg; +char *name; + { + int ret=1; + + if (sv_derived_from(arg,"SSLeay::BN")) + { + IV tmp = SvIV((SV*)SvRV(arg)); + *var = (BIGNUM *) tmp; + } + else if (SvIOK(arg)) { + SV *tmp=sv_newmortal(); + *var=BN_new(); + BN_set_word(*var,SvIV(arg)); + sv_setref_pv(tmp,"SSLeay::BN",(void*)*var); + } + else if (SvPOK(arg)) { + char *ptr; + STRLEN len; + SV *tmp=sv_newmortal(); + *var=BN_new(); + sv_setref_pv(tmp,"SSLeay::BN", (void*)*var); + ptr=SvPV(arg,len); + SvGROW(arg,len+1); + ptr[len]='\0'; + BN_dec2bn(var,ptr); + } + else + { + croak(name); + ret=0; + } + return(ret); + } + +typedef struct gpc_args_st { + SV *cb; + SV *arg; + } GPC_ARGS; + +static void generate_prime_callback(pos,num,arg) +int pos; +int num; +char *arg; + { + dSP ; + int i; + GPC_ARGS *a=(GPC_ARGS *)arg; + + ENTER ; + SAVETMPS ; + + PUSHMARK(sp); + XPUSHs(sv_2mortal(newSViv(pos))); + XPUSHs(sv_2mortal(newSViv(num))); + XPUSHs(sv_2mortal(newSVsv(a->arg))); + PUTBACK; + + i=perl_call_sv(a->cb,G_DISCARD); + + SPAGAIN; + + PUTBACK; + FREETMPS; + LEAVE; + } + +MODULE = SSLeay::BN PACKAGE = SSLeay::BN PREFIX = p5_BN_ + +VERSIONCHECK: DISABLE + +void +p5_BN_new(...) + PREINIT: + BIGNUM *bn; + SV *arg; + PPCODE: + pr_name("p5_BN_new"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + bn=BN_new(); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)bn); + +void +p5_BN_dup(a) + BIGNUM *a; + PREINIT: + BIGNUM *bn; + PPCODE: + pr_name("p5_BN_dup"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + bn=BN_dup(a); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)bn); + +void +p5_BN_rand(bits,...) + int bits; + PREINIT: + int top=1; + int bottom=0; + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_rand"); + if ((items < 1) || (items > 3)) + croak("Usage: SSLeay::BN::rand(bits[,top_bit][,bottombit]"); + if (items >= 2) top=(int)SvIV(ST(0)); + if (items >= 3) bottom=(int)SvIV(ST(1)); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_new(); + BN_rand(ret,bits,top,bottom); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + +void +p5_BN_bin2bn(a) + datum a; + PREINIT: + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_bin2bn"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_bin2bn(a.dptr,a.dsize,NULL); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + +void +p5_BN_bn2bin(a) + BIGNUM *a; + PREINIT: + int i; + PPCODE: + pr_name("p5_BN_bn2bin"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + i=BN_num_bytes(a)+2; + sv_setpvn(ST(0),"",1); + SvGROW(ST(0),i+1); + SvCUR_set(ST(0),BN_bn2bin(a,SvPV(ST(0),na))); + +void +p5_BN_mpi2bn(a) + datum a; + PREINIT: + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_mpi2bn"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_mpi2bn(a.dptr,a.dsize,NULL); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + +void +p5_BN_bn2mpi(a) + BIGNUM *a; + PREINIT: + int i; + PPCODE: + pr_name("p5_BN_bn2mpi"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + i=BN_bn2mpi(a,NULL); + sv_setpvn(ST(0),"",1); + SvGROW(ST(0),i+1); + SvCUR_set(ST(0),BN_bn2mpi(a,SvPV(ST(0),na))); + +void +p5_BN_hex2bn(a) + datum a; + PREINIT: + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_hex2bn"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_new(); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + BN_hex2bn(&ret,a.dptr); + +void +p5_BN_dec2bn(a) + datum a; + PREINIT: + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_dec2bn"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_new(); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + BN_dec2bn(&ret,a.dptr); + +SV * +p5_BN_bn2hex(a) + BIGNUM *a; + PREINIT: + char *ptr; + int i; + CODE: + pr_name("p5_BN_bn2hex"); + ptr=BN_bn2hex(a); + RETVAL=newSVpv("",0); + i=strlen(ptr); + SvGROW(RETVAL,i+1); + memcpy(SvPV(RETVAL,na),ptr,i+1); + SvCUR_set(RETVAL,i); + Free(ptr); + OUTPUT: + RETVAL + +SV * +p5_BN_bn2dec(a) + BIGNUM *a; + PREINIT: + char *ptr; + int i; + CODE: + pr_name("p5_BN_bn2dec"); + ptr=BN_bn2dec(a); + RETVAL=newSVpv("",0); + i=strlen(ptr); + SvGROW(RETVAL,i+1); + memcpy(SvPV(RETVAL,na),ptr,i+1); + SvCUR_set(RETVAL,i); + Free(ptr); + OUTPUT: + RETVAL + +void +p5_BN_add(a,b) + BIGNUM *a; + BIGNUM *b; + PREINIT: + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_add"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_new(); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + BN_add(ret,a,b); + +void +p5_BN_sub(a,b) + BIGNUM *a; + BIGNUM *b; + PREINIT: + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_sub"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_new(); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + BN_sub(ret,a,b); + +void +p5_BN_mul(a,b) + BIGNUM *a; + BIGNUM *b; + PREINIT: + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_mul"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_new(); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + BN_mul(ret,a,b); + +void +p5_BN_div(a,b) + BIGNUM *a; + BIGNUM *b; + PREINIT: + static BN_CTX *ctx=NULL; + BIGNUM *div,*mod; + PPCODE: + pr_name("p5_BN_div"); + if (ctx == NULL) ctx=BN_CTX_new(); + EXTEND(sp,2); + PUSHs(sv_newmortal()); + PUSHs(sv_newmortal()); + div=BN_new(); + mod=BN_new(); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)div); + sv_setref_pv(ST(1), "SSLeay::BN", (void*)mod); + BN_div(div,mod,a,b,ctx); + +void +p5_BN_mod(a,b) + BIGNUM *a; + BIGNUM *b; + PREINIT: + static BN_CTX *ctx=NULL; + BIGNUM *rem; + PPCODE: + pr_name("p5_BN_mod"); + if (ctx == NULL) ctx=BN_CTX_new(); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + rem=BN_new(); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)rem); + BN_mod(rem,a,b,ctx); + +void +p5_BN_exp(a,p) + BIGNUM *a; + BIGNUM *p; + PREINIT: + BIGNUM *ret; + static BN_CTX *ctx=NULL; + PPCODE: + pr_name("p5_BN_exp"); + if (ctx == NULL) ctx=BN_CTX_new(); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_new(); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + BN_exp(ret,a,p,ctx); + +void +p5_BN_mod_mul(a,b,c) + BIGNUM *a; + BIGNUM *b; + BIGNUM *c; + PREINIT: + static BN_CTX *ctx=NULL; + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_mod_mul"); + if (ctx == NULL) ctx=BN_CTX_new(); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_new(); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + BN_mod_mul(ret,a,b,c,ctx); + +void +p5_BN_mod_exp(a,b,c) + BIGNUM *a; + BIGNUM *b; + BIGNUM *c; + PREINIT: + static BN_CTX *ctx=NULL; + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_mod_exp"); + if (ctx == NULL) ctx=BN_CTX_new(); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_new(); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + BN_mod_exp(ret,a,b,c,ctx); + +void +p5_BN_generate_prime(...) + PREINIT: + int bits=512; + int strong=0; + BIGNUM *ret=NULL; + SV *callback=NULL; + SV *cb_arg=NULL; + GPC_ARGS arg; + dSP; + + PPCODE: + pr_name("p5_BN_generate_prime"); + if ((items < 0) || (items > 4)) + croak("Usage: SSLeay::BN::generate_prime(a[,strong][,callback][,cb_arg]"); + if (items >= 1) bits=(int)SvIV(ST(0)); + if (items >= 2) strong=(int)SvIV(ST(1)); + if (items >= 3) callback=ST(2); + if (items == 4) cb_arg=ST(3); + + if (callback == NULL) + ret=BN_generate_prime(bits,strong,NULL,NULL,NULL,NULL); + else + { + arg.cb=callback; + arg.arg=cb_arg; + + ret=BN_generate_prime(bits,strong,NULL,NULL, + generate_prime_callback,(char *)&arg); + } + + SPAGAIN; + sp-=items; /* a bit evil that I do this */ + + EXTEND(sp,1); + PUSHs(sv_newmortal()); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + +void +p5_BN_is_prime(p,...) + BIGNUM *p; + PREINIT: + int nchecks=5,ret; + SV *callback=NULL; + SV *cb_arg=NULL; + GPC_ARGS arg; + dSP; + static BN_CTX *ctx=NULL; + PPCODE: + pr_name("p5_BN_is_prime"); + if ((items < 1) || (items > 4)) + croak("Usage: SSLeay::BN::is_prime(a[,ncheck][,callback][,callback_arg]"); + if (ctx == NULL) ctx=BN_CTX_new(); + if (items >= 2) nchecks=(int)SvIV(ST(1)); + if (items >= 3) callback=ST(2); + if (items >= 4) cb_arg=ST(3); + arg.arg=cb_arg; + if (callback == NULL) + ret=BN_is_prime(p,nchecks,NULL,ctx,NULL); + else + { + arg.cb=callback; + arg.arg=cb_arg; + ret=BN_is_prime(p,nchecks,generate_prime_callback, + ctx,(char *)&arg); + } + SPAGAIN; + sp-=items; /* a bit evil */ + PUSHs(sv_2mortal(newSViv(ret))); + +int +p5_BN_num_bits(a) + BIGNUM *a; + CODE: + pr_name("p5_BN_num_bits"); + RETVAL=BN_num_bits(a); + OUTPUT: + RETVAL + +int +p5_BN_cmp(a,b) + BIGNUM *a; + BIGNUM *b; + CODE: + pr_name("p5_BN_cmp"); + RETVAL=BN_cmp(a,b); + OUTPUT: + RETVAL + +int +p5_BN_ucmp(a,b) + BIGNUM *a; + BIGNUM *b; + CODE: + pr_name("p5_BN_ucmp"); + RETVAL=BN_ucmp(a,b); + OUTPUT: + RETVAL + +int +p5_BN_is_bit_set(a,b) + BIGNUM *a; + int b; + CODE: + pr_name("p5_BN_is_bit_set"); + RETVAL=BN_is_bit_set(a,b); + OUTPUT: + RETVAL + +void +p5_BN_set_bit(a,b) + BIGNUM *a; + int b; + PREINIT: + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_set_bit"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_dup(a); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + BN_set_bit(ret,b); + +void +p5_BN_clear_bit(a,b) + BIGNUM *a; + int b; + PREINIT: + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_clear_bit"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_dup(a); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + BN_clear_bit(ret,b); + +void +p5_BN_lshift(a,b) + BIGNUM *a; + int b; + PREINIT: + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_lshift"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_new(); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + if (b == 1) + BN_lshift1(ret,a); + else + BN_lshift(ret,a,b); + +void +p5_BN_rshift(a,b) + BIGNUM *a; + int b; + PREINIT: + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_rshift"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_new(); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + if (b == 1) + BN_rshift1(ret,a); + else + BN_rshift(ret,a,b); + +void +p5_BN_mask_bits(a,b) + BIGNUM *a; + int b; + PREINIT: + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_mask_bits"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_dup(a); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + BN_mask_bits(ret,b); + +void +p5_BN_clear(a) + BIGNUM *a; + PPCODE: + pr_name("p5_BN_clear"); + BN_clear(a); + +void +p5_BN_gcd(a,b) + BIGNUM *a; + BIGNUM *b; + PREINIT: + static BN_CTX *ctx=NULL; + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_gcd"); + if (ctx == NULL) ctx=BN_CTX_new(); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ret=BN_new(); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + BN_gcd(ret,a,b,ctx); + +void +p5_BN_mod_inverse(a,mod) + BIGNUM *a; + BIGNUM *mod; + PREINIT: + static BN_CTX *ctx=NULL; + BIGNUM *ret; + PPCODE: + pr_name("p5_BN_mod_inverse"); + if (ctx == NULL) ctx=BN_CTX_new(); + ret=BN_mod_inverse(a,mod,ctx); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + sv_setref_pv(ST(0), "SSLeay::BN", (void*)ret); + +void +p5_BN_DESTROY(bn) + BIGNUM *bn + CODE: + pr_name("p5_BN_DESTROY"); + BN_free(bn); + diff --git a/src/lib/libssl/src/perl/callback.c b/src/lib/libssl/src/perl/callback.c new file mode 100644 index 0000000000..01840abc85 --- /dev/null +++ b/src/lib/libssl/src/perl/callback.c @@ -0,0 +1,103 @@ +/* perl/callback.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +SV *new_ref(type,obj,mort) +char *type; +char *obj; + { + SV *ret; + + if (mort) + ret=sv_newmortal(); + else + ret=newSViv(0); + sv_setref_pv(ret,type,(void *)obj); + return(ret); + } + +int ex_new(obj,data,ad,idx,argl,argp) +char *obj; +SV *data; +CRYPTO_EX_DATA *ad; +int idx; +long argl; +char *argp; + { + SV *sv; + +fprintf(stderr,"ex_new %08X %s\n",obj,argp); + sv=sv_newmortal(); + sv_setref_pv(sv,argp,(void *)obj); + CRYPTO_set_ex_data(ad,idx,(char *)sv); + return(1); + } + +void ex_cleanup(obj,data,ad,idx,argl,argp) +char *obj; +SV *data; +CRYPTO_EX_DATA *ad; +int idx; +long argl; +char *argp; + { + pr_name("ex_cleanup"); +fprintf(stderr,"ex_cleanup %08X %s\n",obj,argp); + if (data != NULL) + SvREFCNT_dec((SV *)data); + } + diff --git a/src/lib/libssl/src/perl/cipher.pl b/src/lib/libssl/src/perl/cipher.pl new file mode 100644 index 0000000000..e774bceed2 --- /dev/null +++ b/src/lib/libssl/src/perl/cipher.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$md=SSLeay::MD::new("md5"); + +foreach (@SSLeay::Cipher::names) + { + ($c=SSLeay::Cipher::new($_)) || + die "'$_' is an unknown cipher algorithm\n"; + + + $data="012345678abcdefghijklmnopqrstuvwxyz"; + $c->init("01234567abcdefghABCDEFGH","zyxwvut",1); + + $in =$c->update(substr($data, 0, 5)); + $in.=$c->update(substr($data, 5,10)); + $in.=$c->update(substr($data,15,1)); + $in.=$c->update(substr($data,16)); + + $in.=$c->final(); + + $c->init("01234567abcdefghABCDEFGH","zyxwvut",0); + $out=$c->update($in); + $out.=$c->final(); + + ($out eq $data) || die "decrypt for $_ failed:$!\n"; + + $md->init(); + $md->update($in); + $digest=$md->final(); + + print unpack("H*",$digest); + printf " %2d %2d %2d %s\n", $c->key_length(), $c->iv_length(), + $c->block_size(), $c->name(); + } + diff --git a/src/lib/libssl/src/perl/cipher.txt b/src/lib/libssl/src/perl/cipher.txt new file mode 100644 index 0000000000..c47952b5c9 --- /dev/null +++ b/src/lib/libssl/src/perl/cipher.txt @@ -0,0 +1,10 @@ +Cipher::new(name) "des-cbc" etc +Cipher::name() +Cipher::key_length() +Cipher::iv_length() +Cipher::block_size() + +Cipher::init(key,iv,enc) +Cipher::update(in) +Cipher::final() +Cipher::cipher(in) diff --git a/src/lib/libssl/src/perl/cipher.xs b/src/lib/libssl/src/perl/cipher.xs new file mode 100644 index 0000000000..1044d7a4ef --- /dev/null +++ b/src/lib/libssl/src/perl/cipher.xs @@ -0,0 +1,152 @@ +#include "p5SSLeay.h" + +int boot_cipher() + { + SSLeay_add_all_ciphers(); + return(1); + } + +MODULE = SSLeay::Cipher PACKAGE = SSLeay::Cipher PREFIX = p5_EVP_C_ + +VERSIONCHECK: DISABLE + +void +p5_EVP_C_new(...) + PREINIT: + EVP_CIPHER_CTX *ctx; + EVP_CIPHER *c; + char *name; + PPCODE: + if ((items == 1) && SvPOK(ST(0))) + name=SvPV(ST(0),na); + else if ((items == 2) && SvPOK(ST(1))) + name=SvPV(ST(1),na); + else + croak("Usage: SSLeay::Cipher::new(type)"); + PUSHs(sv_newmortal()); + c=EVP_get_cipherbyname(name); + if (c != NULL) + { + ctx=malloc(sizeof(EVP_CIPHER_CTX)); + EVP_EncryptInit(ctx,c,NULL,NULL); + sv_setref_pv(ST(0), "SSLeay::Cipher", (void*)ctx); + } + +datum +p5_EVP_C_name(ctx) + EVP_CIPHER_CTX *ctx + CODE: + RETVAL.dptr=OBJ_nid2ln(EVP_CIPHER_CTX_nid(ctx)); + RETVAL.dsize=strlen(RETVAL.dptr); + OUTPUT: + RETVAL + +int +p5_EVP_C_key_length(ctx) + EVP_CIPHER_CTX *ctx + CODE: + RETVAL=EVP_CIPHER_CTX_key_length(ctx); + OUTPUT: + RETVAL + +int +p5_EVP_C_iv_length(ctx) + EVP_CIPHER_CTX *ctx + CODE: + RETVAL=EVP_CIPHER_CTX_iv_length(ctx); + OUTPUT: + RETVAL + +int +p5_EVP_C_block_size(ctx) + EVP_CIPHER_CTX *ctx + CODE: + RETVAL=EVP_CIPHER_CTX_block_size(ctx); + OUTPUT: + RETVAL + +void +p5_EVP_C_init(ctx,key,iv,enc) + EVP_CIPHER_CTX *ctx + datum key + datum iv + int enc + PREINIT: + char loc_iv[EVP_MAX_IV_LENGTH]; + char loc_key[EVP_MAX_KEY_LENGTH]; + char *ip=loc_iv,*kp=loc_key; + int i; + memset(loc_iv,0,EVP_MAX_IV_LENGTH); + memset(loc_key,0,EVP_MAX_KEY_LENGTH); + CODE: + i=key.dsize; + if (key.dsize > EVP_CIPHER_CTX_key_length(ctx)) + i=EVP_CIPHER_CTX_key_length(ctx); + if (i > 0) + { + memset(kp,0,EVP_MAX_KEY_LENGTH); + memcpy(kp,key.dptr,i); + } + else + kp=NULL; + i=iv.dsize; + if (iv.dsize > EVP_CIPHER_CTX_iv_length(ctx)) + i=EVP_CIPHER_CTX_iv_length(ctx); + if (i > 0) + { + memcpy(ip,iv.dptr,i); + memset(ip,0,EVP_MAX_IV_LENGTH); + } + else + ip=NULL; + EVP_CipherInit(ctx,EVP_CIPHER_CTX_cipher(ctx),kp,ip,enc); + memset(loc_key,0,sizeof(loc_key)); + memset(loc_iv,0,sizeof(loc_iv)); + +SV * +p5_EVP_C_cipher(ctx,in) + EVP_CIPHER_CTX *ctx; + datum in; + CODE: + RETVAL=newSVpv("",0); + SvGROW(RETVAL,in.dsize+EVP_CIPHER_CTX_block_size(ctx)+1); + EVP_Cipher(ctx,SvPV(RETVAL,na),in.dptr,in.dsize); + SvCUR_set(RETVAL,in.dsize); + OUTPUT: + RETVAL + +SV * +p5_EVP_C_update(ctx, in) + EVP_CIPHER_CTX *ctx + datum in + PREINIT: + int i; + CODE: + RETVAL=newSVpv("",0); + SvGROW(RETVAL,in.dsize+EVP_CIPHER_CTX_block_size(ctx)+1); + EVP_CipherUpdate(ctx,SvPV(RETVAL,na),&i,in.dptr,in.dsize); + SvCUR_set(RETVAL,i); + OUTPUT: + RETVAL + +SV * +p5_EVP_C_final(ctx) + EVP_CIPHER_CTX *ctx + PREINIT: + int i; + CODE: + RETVAL=newSVpv("",0); + SvGROW(RETVAL,EVP_CIPHER_CTX_block_size(ctx)+1); + if (!EVP_CipherFinal(ctx,SvPV(RETVAL,na),&i)) + sv_setpv(RETVAL,"BAD DECODE"); + else + SvCUR_set(RETVAL,i); + OUTPUT: + RETVAL + +void +p5_EVP_C_DESTROY(ctx) + EVP_CIPHER_CTX *ctx + CODE: + free((char *)ctx); + diff --git a/src/lib/libssl/src/perl/dh.pl b/src/lib/libssl/src/perl/dh.pl new file mode 100644 index 0000000000..73decc241a --- /dev/null +++ b/src/lib/libssl/src/perl/dh.pl @@ -0,0 +1,40 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$g=SSLeay::BN::hex2bn("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002"); +$p=SSLeay::BN::hex2bn("ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"); +$pub=SSLeay::BN::hex2bn("521b5b72d0a23f5f908eff62741b9c43ac65c47ad264a4f8d62d73dfab4938a6e019f81c28d64efd9b47c1b8188566c6184b6064cc42fac2778bd732678148c6cc7601bfe0ed18da76dd7bb976cd2ff0afc7b20f3f81171e2ea6534de061f929"); +$priv=SSLeay::BN::hex2bn("6e15c752af3f4cf6d7425164c451eeba760ec0651d12dc3b0ee5002a95af6191268ca47c0fbb3d836136eee795ae4af3a1adad5e04d0dbb04378cae0406ece23ca3b86839c0fd60064c1019c7d18be4dc0ec4be6c1e9ff6b0f5bd76373585503"); +$his=SSLeay::BN::hex2bn("d0fb51cd44a8578f55eb0822ede90f07504f4720d7367ff4bf76c27fedbce79d9204421ff7e86bd1dd02031bce4ceccd1d3e7c62679b6eb5fda8238fd4fe07bff573d552795f0d46f25753c688300fb9ed396792b59a49fdf89c8429124b668e"); +$sh=SSLeay::BN::hex2bn("66ec34b09bddf86147f6c6efd5ee4e6691e690eb0e90aceda16a742cad0abe531cb61d057aff362001ca19013215140ca2a1dd8966c78105bacbf2161f9cfbd58d351ff87923de77f9c56851037223d48272565416ee769e65a621cefb90b403"); + +$g2=SSLeay::BN::hex2bn("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002"); +$p2=SSLeay::BN::hex2bn("ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"); +$pub2=SSLeay::BN::hex2bn("d0fb51cd44a8578f55eb0822ede90f07504f4720d7367ff4bf76c27fedbce79d9204421ff7e86bd1dd02031bce4ceccd1d3e7c62679b6eb5fda8238fd4fe07bff573d552795f0d46f25753c688300fb9ed396792b59a49fdf89c8429124b668e"); +$priv2=SSLeay::BN::hex2bn("b81d54f52b687669fc8bd8087ac319accc2f94a2feafe09779f4a81e8e01f77290f5bbe84a08003afc4448145be427fad0b9d047889cf361c9dd378b15c1ebd5bda33e051fbd9eba8bf063e2bd836467cddb61f1db5c4b06bea5c9a77fb87b24"); +$his2=SSLeay::BN::hex2bn("521b5b72d0a23f5f908eff62741b9c43ac65c47ad264a4f8d62d73dfab4938a6e019f81c28d64efd9b47c1b8188566c6184b6064cc42fac2778bd732678148c6cc7601bfe0ed18da76dd7bb976cd2ff0afc7b20f3f81171e2ea6534de061f929"); +$sh2=SSLeay::BN::hex2bn("791faba7a6b592cb68a963945229483dc30f80f5cb295b2b5a59ef618a262d22de0845948a34db83d8bde260b940967ff85593a609e53ee6510aea09b776b4704d5e916917f384458d4790b6e0befcb1cb2f112b850e9ed410a091db80e1db2e"); + +print "g=".$g->bn2hex."\n"; +print "p=".$p->bn2hex."\n"; +print "pub=".$pub->bn2hex."\n"; +print "priv=".$priv->bn2hex."\n"; +print "sh=".$sh->bn2hex."\n"; + +print "new p - p2 = ".($p-$p2)."\n"; + +$tmp=$g->mod_exp($priv,$p); +print "XXXXXXXXXXXXXXXX\n"; +print "new pub - pub = ".($tmp-$pub)."\n"; +$tmp2=$g2->mod_exp($priv2,$p2); +print "XXXXXXXXXXXXXXXX\n"; + +print $p." pub\n"; +print $tmp2." calc pub\n"; +print $pub2." txt pub\n"; + + + diff --git a/src/lib/libssl/src/perl/digest.txt b/src/lib/libssl/src/perl/digest.txt new file mode 100644 index 0000000000..6cb3ffedb0 --- /dev/null +++ b/src/lib/libssl/src/perl/digest.txt @@ -0,0 +1,7 @@ +MD::new(name) "md2", "md5" etc +MD::name() +MD::init() +MD::update(in) +MD::final() + + diff --git a/src/lib/libssl/src/perl/digest.xs b/src/lib/libssl/src/perl/digest.xs new file mode 100644 index 0000000000..5738b09e48 --- /dev/null +++ b/src/lib/libssl/src/perl/digest.xs @@ -0,0 +1,83 @@ +#include "p5SSLeay.h" + +int boot_digest() + { + SSLeay_add_all_digests(); + return(1); + } + +MODULE = SSLeay::MD PACKAGE = SSLeay::MD PREFIX = p5_EVP_MD_ + +PROTOTYPES: ENABLE +VERSIONCHECK: DISABLE + +# SSLeay::MD::new(name) name= md2, md5, sha, sha1, or mdc2 +# md->name() - returns the name +# md->init() - reinitalises the digest +# md->update(data) - adds more data to digest +# digest=md->final() - returns digest +# + +void +p5_EVP_MD_new(...) + PREINIT: + EVP_MD_CTX *ctx; + EVP_MD *md; + char *name; + PPCODE: + if ((items == 1) && SvPOK(ST(0))) + name=SvPV(ST(0),na); + else if ((items == 2) && SvPOK(ST(1))) + name=SvPV(ST(1),na); + else + croak("Usage: SSLeay::MD::new(type)"); + PUSHs(sv_newmortal()); + md=EVP_get_digestbyname(name); + if (md != NULL) + { + ctx=malloc(sizeof(EVP_MD_CTX)); + EVP_DigestInit(ctx,md); + sv_setref_pv(ST(0), "SSLeay::MD", (void*)ctx); + } + +datum +p5_EVP_MD_name(ctx) + EVP_MD_CTX *ctx + CODE: + RETVAL.dptr=OBJ_nid2ln(EVP_MD_type(EVP_MD_CTX_type(ctx))); + RETVAL.dsize=strlen(RETVAL.dptr); + OUTPUT: + RETVAL + +void +p5_EVP_MD_init(ctx) + EVP_MD_CTX *ctx + CODE: + EVP_DigestInit(ctx,EVP_MD_CTX_type(ctx)); + +void +p5_EVP_MD_update(ctx, in) + EVP_MD_CTX *ctx + datum in + CODE: + EVP_DigestUpdate(ctx,in.dptr,in.dsize); + +datum +p5_EVP_MD_final(ctx) + EVP_MD_CTX *ctx + PREINIT: + char md[EVP_MAX_MD_SIZE]; + int len; + CODE: + EVP_DigestFinal(ctx,md,&len); + RETVAL.dptr=md; + RETVAL.dsize=len; + OUTPUT: + RETVAL + +void +p5_EVP_MD_DESTROY(ctx) + EVP_MD_CTX *ctx + CODE: + free((char *)ctx); + diff --git a/src/lib/libssl/src/perl/err.txt b/src/lib/libssl/src/perl/err.txt new file mode 100644 index 0000000000..5e6cdaecdc --- /dev/null +++ b/src/lib/libssl/src/perl/err.txt @@ -0,0 +1,2 @@ +ERR::get_error() +ERR::peek_error() diff --git a/src/lib/libssl/src/perl/err.xs b/src/lib/libssl/src/perl/err.xs new file mode 100644 index 0000000000..6d1aec3ea1 --- /dev/null +++ b/src/lib/libssl/src/perl/err.xs @@ -0,0 +1,46 @@ +#include "p5SSLeay.h" + +int boot_err() + { + SSL_load_error_strings(); + return(1); + } + +MODULE = SSLeay::ERR PACKAGE = SSLeay::ERR PREFIX = p5_ERR_ + +PROTOTYPES: ENABLE +VERSIONCHECK: DISABLE + +# md->error() - returns the last error in text or numeric context + +void +p5_ERR_get_error(...) + PPCODE: + char buf[512]; + unsigned long l; + + pr_name("p5_ERR_get_code"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + l=ERR_get_error(); + ERR_error_string(l,buf); + sv_setiv(ST(0),l); + sv_setpv(ST(0),buf); + SvIOK_on(ST(0)); + +void +p5_ERR_peek_error(...) + PPCODE: + char buf[512]; + unsigned long l; + + pr_name("p5_ERR_get_code"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + l=ERR_peek_error(); + ERR_error_string(l,buf); + sv_setiv(ST(0),l); + sv_setpv(ST(0),buf); + SvIOK_on(ST(0)); + + diff --git a/src/lib/libssl/src/perl/f.pl b/src/lib/libssl/src/perl/f.pl new file mode 100644 index 0000000000..a255931864 --- /dev/null +++ b/src/lib/libssl/src/perl/f.pl @@ -0,0 +1,25 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$data=<>; + +#$b=SSLeay::BN::hex2bn($a); +#$data=$b->bn2bin; + +#substr($data,0,8)=""; +#print $data; + +$md=SSLeay::MD::new("md5"); +$md->init(); +$md->update("test"); +$key=$md->final(); + +$rc4=SSLeay::Cipher::new("rc4"); +$rc4->init($key,"",1); +$out=$rc4->cipher($data); + +print $out; + diff --git a/src/lib/libssl/src/perl/g.pl b/src/lib/libssl/src/perl/g.pl new file mode 100644 index 0000000000..ffbe694b05 --- /dev/null +++ b/src/lib/libssl/src/perl/g.pl @@ -0,0 +1,18 @@ +#!/usr/bin/perl +use ExtUtils::testlib; +use SSLeay; + +$num=SSLeay::BN::new(); +$shift=SSLeay::BN::new(); + +print "0\n"; +$num=SSLeay::BN::hex2bn("1234329378209857309429670349760347603497603496398"); +print "1\n"; +$s=SSLeay::BN::hex2bn("59"); +print "a\n"; +$r=$num->lshift(59); +print "b"; + +print $num->bn2hex."\n"; +print $s->bn2hex."\n"; +print $r->bn2hex."\n"; diff --git a/src/lib/libssl/src/perl/gen_rsa.pl b/src/lib/libssl/src/perl/gen_rsa.pl new file mode 100644 index 0000000000..ed8c71aa9e --- /dev/null +++ b/src/lib/libssl/src/perl/gen_rsa.pl @@ -0,0 +1,49 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$bits=512; +$bits=$ARGV[0] if $#ARGV >= 0; + +$p=SSLeay::BN::generate_prime($bits/2,0,sub {print STDERR $_[0]?"+":"."}); +print "\n"; +$q=SSLeay::BN::generate_prime($bits/2,0,sub {print STDERR $_[0]?"+":"."}); +print "\n"; + +$e=SSLeay::BN::hex2bn("10001"); + +$t1=$p-1; +$t2=$q-1; + +($t1->gcd($e) == 1) || die "p failed the gcd test\n"; +($t2->gcd($e) == 1) || die "q failed the gcd test\n"; + +($q,$p)=($p,$q) if ($p < $q); +$n=$p*$q; +$t=($p-1)*($q-1); +($t->gcd($e) == 1) || die "t failed the gcd test\n"; + +$d=$e->mod_inverse($t); + +$dmp1=$d%($p-1); +$dmq1=$d%($q-1); +$iqmp=$q->mod_inverse($p); + +print "n =$n\n"; +print "e =$e\n"; +print "d =$d\n"; +print "dmp1=$dmp1\n"; +print "dmq1=$dmq1\n"; +print "iqmp=$iqmp\n"; + +$a=SSLeay::BN::bin2bn("This is an RSA test"); +print "Test with\n'".$a->bn2bin."' or\n$a\n"; + +$t1=$a->mod_exp($e,$n); +print "$t1\n"; +$t2=$t1->mod_exp($d,$n); +print "'".$t2->bn2bin."'\n"; + + diff --git a/src/lib/libssl/src/perl/mul.pl b/src/lib/libssl/src/perl/mul.pl new file mode 100644 index 0000000000..611a760625 --- /dev/null +++ b/src/lib/libssl/src/perl/mul.pl @@ -0,0 +1,56 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + + +sub mul + { + my($ab,$cd,$num)=@_; + + if ($num <= 4096) + { + return($ab*$cd); + } + else + { + my($a,$b,$c,$d,$n,$ac,$bd,$m,$t1,$t2); + + $n=$num/2; + + $a=$ab->mask_bits($n); + $b=$ab->rshift($n); + $c=$cd->mask_bits($n); + $d=$cd->rshift($n); + + $t1=($b-$a); + $t2=($c-$d); + $m= &mul($t1,$t2,$n); + $ac=&mul($a,$c,$n); + $bd=&mul($b,$d,$n); + $m=$m+$ac+$bd; + $m=$m->lshift($n); + $bd=$bd->lshift($num); + + $r=$ac+$m+$bd; + return($r); + } + } + +$num=4096*32; +$a=SSLeay::BN::rand($num); +$b=SSLeay::BN::rand($num); + +#for (1 .. 10) + { + $r=&mul($a,$b,$num); + } + +#for (1 .. 10) + { + $rr=$a*$b; + } + +$res=$rr-$r; +print $res->bn2hex()."\n"; diff --git a/src/lib/libssl/src/perl/p5SSLeay.h b/src/lib/libssl/src/perl/p5SSLeay.h new file mode 100644 index 0000000000..bcccda7d5f --- /dev/null +++ b/src/lib/libssl/src/perl/p5SSLeay.h @@ -0,0 +1,96 @@ +/* perl/p5SSLeay.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +#ifdef __cplusplus +extern "C" { +#endif +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" +#ifdef __cplusplus +} +#endif + +typedef struct datum_st + { + char *dptr; + int dsize; + } datum; + +#include "crypto.h" +#include "buffer.h" +#include "bio.h" +#include "evp.h" +#include "err.h" +#include "x509.h" +#include "ssl.h" + +#if 0 +#define pr_name(name) printf("%s\n",name) +#define pr_name_d(name,p2) printf("%s %d\n",name,p2) +#define pr_name_dd(name,p2,p3) printf("%s %d %d\n",name,p2,p3) +#else +#define pr_name(name) +#define pr_name_d(name,p2) +#define pr_name_dd(name,p2,p3) +#endif + +SV *new_ref(char *type, char *obj, int mort); +int ex_new(char *obj,SV *data,CRYPTO_EX_DATA *ad,int idx,long argl,char *argp); +void ex_cleanup(char *obj,SV *data,CRYPTO_EX_DATA *ad,int idx, + long argl,char *argp); + diff --git a/src/lib/libssl/src/perl/r.pl b/src/lib/libssl/src/perl/r.pl new file mode 100644 index 0000000000..abcc331c78 --- /dev/null +++ b/src/lib/libssl/src/perl/r.pl @@ -0,0 +1,56 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$bits=512; +$bits=$ARGV[0] if $#ARGV >= 0; + +$q=SSLeay::BN::dec2bn("334533373942443239443435463034324139443635374634423531423146313742443038394230324138363038393539303745363034393946353346323345374537463935433635374238353245344341444241344138413244373443323338334431414134363244443532423243423133433537"); + +$p=SSLeay::BN::dec2bn("3338413942343132463534373734353742343636444439363131313131353843334536434330363934313646414132453044434138413630434631334134443046313735313632344131433437443642434436423642453234383046393732383538444139393131314339303743393939363744443235443332393332394543384630304634323646333735"); +$pp=SSLeay::BN::generate_prime($bits/2,0,sub {print STDERR $_[0]?"+":"."}); + +printf $pp->is_prime."\n"; +printf $p->is_prime."\n"; +printf $q->is_prime."\n"; +printf "p->length=%d\n",$p->num_bits; +printf "q->length=%d\n",$q->num_bits; +$bits=$p->num_bits+$q->num_bits; +$e=SSLeay::BN::hex2bn("10001"); + +$t1=$p-1; +$t2=$q-1; + +($t1->gcd($e) == 1) || die "p failed the gcd test\n"; +($t2->gcd($e) == 1) || die "q failed the gcd test\n"; + +($q,$p)=($p,$q) if ($p < $q); +$n=$p*$q; +$t=($p-1)*($q-1); +($t->gcd($e) == 1) || die "t failed the gcd test\n"; + +$d=$e->mod_inverse($t); + +$dmp1=$d%($p-1); +$dmq1=$d%($q-1); +$iqmp=$q->mod_inverse($p); + +print "n =$n\n"; +print "e =$e\n"; +print "d =$d\n"; +print "dmp1=$dmp1\n"; +print "dmq1=$dmq1\n"; +print "iqmp=$iqmp\n"; + +$a=SSLeay::BN::bin2bn("This is an RSA test"); +print "Test with\n'".$a->bn2bin."' or\n$a\n"; + +print "<$a>\n"; +$t1=$a->mod_exp($e,$n); +print ">$t1>\n"; +$t2=$t1->mod_exp($d,$n); +print "<$t2>\n"; + + diff --git a/src/lib/libssl/src/perl/s.pl b/src/lib/libssl/src/perl/s.pl new file mode 100644 index 0000000000..1d438a6765 --- /dev/null +++ b/src/lib/libssl/src/perl/s.pl @@ -0,0 +1,72 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$ssl_ctx=SSL::CTX->new("SSLv3_client"); + +$ssl_ctx->set_options("-info_callback" => + sub { + print STDERR $_[0]->state()."\n"; + } + ); + +$conn="localhost:4433"; +$conn=$ARGV[0] if $#ARGV >= 0; +$cbio=BIO->new("connect"); +$cbio->hostname($conn) || die $ssl->error(); + +$bbio=BIO->new("buffer"); + +$sbio=BIO->new("ssl"); +$ssl=$ssl_ctx->new_ssl; +$ssl->set_options(-connect_state); +$sbio->set_ssl($ssl); + +$sbio->push($cbio); +$bbio->push($sbio); +$bio=$bbio; + +#$bio->set_callback( +# sub { +# my($bio,$state,$cmd,$buf,$lart,$ret)=@_; +# print STDERR "$state:$cmd\n"; +# return($ret); +# } +# ); + +$b=$bio; +do { + print STDERR $b->type."\n"; + } while ($b=$b->next_bio); + +(($ret=$bio->syswrite("GET / HTTP/1.0\r\n\r\n")) > 0) || die $bio->error(); +$bio->flush; + +$data=""; +while (1) + { + $ret=$bio->getline; + $ret =~ s/[\r\n]//g; + print STDERR "$ret\n"; + last if $ret eq ""; + $server=$1 if $ret=~ /^Server: (.*)/; + } + + +print "server is $server\n"; +$x509=$ssl->get_peer_certificate(); +print "version :".$x509->get_version()."\n"; +print "serialNumber:".$x509->get_serialNumber()->bn2hex."\n"; +print "subject :".$x509->get_subject_name()."\n"; +print "issuer :". $x509->get_issuer_name()."\n"; + +$c=$ssl->get_current_cipher; +($i,$a)=$c->get_bits; +$v=$c->get_version; +$n=$c->get_name; + +print "protocol=".$ssl->get_version."\n"; +print "bits=$i($a) cipher type=$v cipher=$n\n"; + diff --git a/src/lib/libssl/src/perl/s2.pl b/src/lib/libssl/src/perl/s2.pl new file mode 100644 index 0000000000..d39b4b8e25 --- /dev/null +++ b/src/lib/libssl/src/perl/s2.pl @@ -0,0 +1,49 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$ssl_ctx=SSL::CTX->new("SSLv3"); + +$ssl_ctx->set_options("-info_callback" => + sub { + print STDERR $_[0]->state()."\n"; + } + ); + +$conn="localhost:4433"; +$conn=$ARGV[0] if $#ARGV >= 0; +$cbio=BIO->new("connect"); +$cbio->hostname($conn) || die $ssl->error(); + +$ssl=$ssl_ctx->new_ssl; +$sbio=BIO->new("ssl"); +$sbio->set_ssl($ssl); +$ssl->set_options("-connect_state"); + +$bio=BIO->new("buffer"); + +$sbio->push($cbio); +$bio->push($sbio); + +($bio->do_handshake() > 0) || die $bio->error(); + +(($ret=$bio->syswrite("GET / HTTP/1.0\r\n\r\n")) > 0) || die $ssl->error(); +$bio->flush() || die $bio->error(); + +$data=""; +while ($_=$bio->getline()) + { + if (/^Server:/) + { + print; + last; + } + } + +if ($bio->peek_error()) + { + print "There was an error:".$ssl->error(); + } +print "exit\n"; diff --git a/src/lib/libssl/src/perl/server.pem b/src/lib/libssl/src/perl/server.pem new file mode 100644 index 0000000000..eabb927036 --- /dev/null +++ b/src/lib/libssl/src/perl/server.pem @@ -0,0 +1,369 @@ +issuer= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit) +subject=/C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Server test cert (512 bit) +-----BEGIN CERTIFICATE----- +MIIB6TCCAVICAQAwDQYJKoZIhvcNAQEEBQAwWzELMAkGA1UEBhMCQVUxEzARBgNV +BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYD +VQQDExJUZXN0IENBICgxMDI0IGJpdCkwHhcNOTcwNjA5MTM1NzQ2WhcNOTgwNjA5 +MTM1NzQ2WjBjMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDEaMBgG +A1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxIzAhBgNVBAMTGlNlcnZlciB0ZXN0IGNl +cnQgKDUxMiBiaXQpMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJ+zw4Qnlf8SMVIP +Fe9GEcStgOY2Ww/dgNdhjeD8ckUJNP5VZkVDTGiXav6ooKXfX3j/7tdkuD8Ey2// +Kv7+ue0CAwEAATANBgkqhkiG9w0BAQQFAAOBgQB4TMR2CvacKE9wAsu9jyCX8YiW +mgCM+YoP6kt4Zkj2z5IRfm7WrycKsnpnOR+tGeqAjkCeZ6/36o9l91RvPnN1VJ/i +xQv2df0KFeMr00IkDdTNAdIWqFkSsZTAY2QAdgenb7MB1joejquYzO2DQIO7+wpH +irObpESxAZLySCmPPg== +-----END CERTIFICATE----- +-----BEGIN RSA PRIVATE KEY----- +MIIBPAIBAAJBAJ+zw4Qnlf8SMVIPFe9GEcStgOY2Ww/dgNdhjeD8ckUJNP5VZkVD +TGiXav6ooKXfX3j/7tdkuD8Ey2//Kv7+ue0CAwEAAQJAN6W31vDEP2DjdqhzCDDu +OA4NACqoiFqyblo7yc2tM4h4xMbC3Yx5UKMN9ZkCtX0gzrz6DyF47bdKcWBzNWCj +gQIhANEoojVt7hq+SQ6MCN6FTAysGgQf56Q3TYoJMoWvdiXVAiEAw3e3rc+VJpOz +rHuDo6bgpjUAAXM+v3fcpsfZSNO6V7kCIQCtbVjanpUwvZkMI9by02oUk9taki3b +PzPfAfNPYAbCJQIhAJXNQDWyqwn/lGmR11cqY2y9nZ1+5w3yHGatLrcDnQHxAiEA +vnlEGo8K85u+KwIOimM48ZG8oTk7iFdkqLJR1utT3aU= +-----END RSA PRIVATE KEY----- +subject=/C=US/O=AT&T Bell Laboratories/OU=Prototype Research CA +issuer= /C=US/O=AT&T Bell Laboratories/OU=Prototype Research CA +notBefore=950413210656Z +notAfter =970412210656Z +-----BEGIN X509 CERTIFICATE----- + +MIICCDCCAXECAQAwDQYJKoZIhvcNAQEEBQAwTjELMAkGA1UEBhMCVVMxHzAdBgNV +BAoUFkFUJlQgQmVsbCBMYWJvcmF0b3JpZXMxHjAcBgNVBAsUFVByb3RvdHlwZSBS +ZXNlYXJjaCBDQTAeFw05NTA0MTMyMTA2NTZaFw05NzA0MTIyMTA2NTZaME4xCzAJ +BgNVBAYTAlVTMR8wHQYDVQQKFBZBVCZUIEJlbGwgTGFib3JhdG9yaWVzMR4wHAYD +VQQLFBVQcm90b3R5cGUgUmVzZWFyY2ggQ0EwgZwwDQYJKoZIhvcNAQEBBQADgYoA +MIGGAoGAebOmgtSCl+wCYZc86UGYeTLY8cjmW2P0FN8ToT/u2pECCoFdrlycX0OR +3wt0ZhpFXLVNeDnHwEE9veNUih7pCL2ZBFqoIoQkB1lZmXRiVtjGonz8BLm/qrFM +YHb0lme/Ol+s118mwKVxnn6bSAeI/OXKhLaVdYZWk+aEaxEDkVkCAQ8wDQYJKoZI +hvcNAQEEBQADgYEAAZMG14lZmZ8bahkaHaTV9dQf4p2FZiQTFwHP9ZyGsXPC+LT5 +dG5iTaRmyjNIJdPWohZDl97kAci79aBndvuEvRKOjLHs3WRGBIwERnAcnY9Mz8u/ +zIHK23PjYVxGGaZd669OJwD0CYyqH22HH9nFUGaoJdsv39ChW0NRdLE9+y8= +-----END X509 CERTIFICATE----- +issuer= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test PCA (1024 bit) +subject=/C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit) +-----BEGIN CERTIFICATE----- +MIICJjCCAY8CAQAwDQYJKoZIhvcNAQEEBQAwXDELMAkGA1UEBhMCQVUxEzARBgNV +BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYD +VQQDExNUZXN0IFBDQSAoMTAyNCBiaXQpMB4XDTk3MDYwOTEzNTc0M1oXDTAxMDYw +OTEzNTc0M1owWzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY +BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYDVQQDExJUZXN0IENBICgxMDI0 +IGJpdCkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKO7o8t116VP6cgybTsZ +DCZhr95nYlZuya3aCi1IKoztqwWnjbmDFIriOqGFPrZQ+moMETC9D59iRW/dFXSv +1F65ka/XY2hLh9exCCo7XuUcDs53Qp3bI3AmMqHjgzE8oO3ajyJAzJkTTOUecQU2 +mw/gI4tMM0LqWMQS7luTy4+xAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAM7achv3v +hLQJcv/65eGEpBXM40ZDVoFQFFJWaY5p883HTqLB1x4FdzsXHH0QKBTcKpWwqyu4 +YDm3fb8oDugw72bCzfyZK/zVZPR/hVlqI/fvU109Qoc+7oPvIXWky71HfcK6ZBCA +q30KIqGM/uoM60INq97qjDmCJapagcNBGQs= +-----END CERTIFICATE----- +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQCju6PLddelT+nIMm07GQwmYa/eZ2JWbsmt2gotSCqM7asFp425 +gxSK4jqhhT62UPpqDBEwvQ+fYkVv3RV0r9ReuZGv12NoS4fXsQgqO17lHA7Od0Kd +2yNwJjKh44MxPKDt2o8iQMyZE0zlHnEFNpsP4COLTDNC6ljEEu5bk8uPsQIDAQAB +AoGAVZmpFZsDZfr0l2S9tLLwpjRWNOlKATQkno6q2WesT0eGLQufTciY+c8ypfU6 +hyio8r5iUl/VhhdjhAtKx1mRpiotftHo/eYf8rtsrnprOnWG0bWjLjtIoMbcxGn2 +J3bN6LJmbJMjDs0eJ3KnTu646F3nDUw2oGAwmpzKXA1KAP0CQQDRvQhxk2D3Pehs +HvG665u2pB5ipYQngEFlZO7RHJZzJOZEWSLuuMqaF/7pTfA5jiBvWqCgJeCRRInL +21ru4dlPAkEAx9jj7BgKn5TYnMoBSSe0afjsV9oApVpN1Nacb1YDtCwy+scp3++s +nFxlv98wxIlSdpwMUn+AUWfjiWR7Tu/G/wJBAJ/KjwZIrFVxewP0x2ILYsTRYLzz +MS4PDsO7FB+I0i7DbBOifXS2oNSpd3I0CNMwrxFnUHzynpbOStVfN3ZL5w0CQQCa +pwFahxBRhkJKsxhjoFJBX9yl75JoY4Wvm5Tbo9ih6UJaRx3kqfkN14L2BKYcsZgb +KY9vmDOYy6iNfjDeWTfJAkBkfPUb8oTJ/nSP5zN6sqGxSY4krc4xLxpRmxoJ8HL2 +XfhqXkTzbU13RX9JJ/NZ8vQN9Vm2NhxRGJocQkmcdVtJ +-----END RSA PRIVATE KEY----- +-----BEGIN X509 CERTIFICATE----- +MIICYDCCAiACAgEoMAkGBSsOAwINBQAwfDELMAkGA1UEBhMCVVMxNjA0BgNVBAoT +LU5hdGlvbmFsIEFlcm9uYXV0aWNzIGFuZCBTcGFjZSBBZG1pbmlzdHJhdGlvbjEZ +MBcGA1UECxMQVGVzdCBFbnZpcm9ubWVudDEaMBgGA1UECxMRRFNTLU5BU0EtUGls +b3QtQ0EwHhcNOTYwMjI2MTYzMjQ1WhcNOTcwMjI1MTYzMjQ1WjB8MQswCQYDVQQG +EwJVUzE2MDQGA1UEChMtTmF0aW9uYWwgQWVyb25hdXRpY3MgYW5kIFNwYWNlIEFk +bWluaXN0cmF0aW9uMRkwFwYDVQQLExBUZXN0IEVudmlyb25tZW50MRowGAYDVQQL +ExFEU1MtTkFTQS1QaWxvdC1DQTCB8jAJBgUrDgMCDAUAA4HkADCB4AJBAMA/ssKb +hPNUG7ZlASfVwEJU21O5OyF/iyBzgHI1O8eOhJGUYO8cc8wDMjR508Mr9cp6Uhl/ +ZB7FV5GkLNEnRHYCQQDUEaSg45P2qrDwixTRhFhmWz5Nvc4lRFQ/42XPcchiJBLb +bn3QK74T2IxY1yY+kCNq8XrIqf5fJJzIH0J/xUP3AhUAsg2wsQHfDGYk/BOSulX3 +fVd0geUCQQCzCFUQAh+ZkEmp5804cs6ZWBhrUAfnra8lJItYo9xPcXgdIfLfibcX +R71UsyO77MRD7B0+Ag2tq794IleCVcEEMAkGBSsOAwINBQADLwAwLAIUUayDfreR +Yh2WeU86/pHNdkUC1IgCFEfxe1f0oMpxJyrJ5XIxTi7vGdoK +-----END X509 CERTIFICATE----- +-----BEGIN X509 CERTIFICATE----- + +MIICGTCCAdgCAwCqTDAJBgUrDgMCDQUAMHwxCzAJBgNVBAYTAlVTMTYwNAYDVQQK +Ey1OYXRpb25hbCBBZXJvbmF1dGljcyBhbmQgU3BhY2UgQWRtaW5pc3RyYXRpb24x +GTAXBgNVBAsTEFRlc3QgRW52aXJvbm1lbnQxGjAYBgNVBAsTEURTUy1OQVNBLVBp +bG90LUNBMB4XDTk2MDUxNDE3MDE0MVoXDTk3MDUxNDE3MDE0MVowMzELMAkGA1UE +BhMCQVUxDzANBgNVBAoTBk1pbmNvbTETMBEGA1UEAxMKRXJpYyBZb3VuZzCB8jAJ +BgUrDgMCDAUAA4HkADCB4AJBAKbfHz6vE6pXXMTpswtGUec2tvnfLJUsoxE9qs4+ +ObZX7LmLvragNPUeiTJx7UOWZ5DfBj6bXLc8eYne0lP1g3ACQQDUEaSg45P2qrDw +ixTRhFhmWz5Nvc4lRFQ/42XPcchiJBLbbn3QK74T2IxY1yY+kCNq8XrIqf5fJJzI +H0J/xUP3AhUAsg2wsQHfDGYk/BOSulX3fVd0geUCQQCzCFUQAh+ZkEmp5804cs6Z +WBhrUAfnra8lJItYo9xPcXgdIfLfibcXR71UsyO77MRD7B0+Ag2tq794IleCVcEE +MAkGBSsOAwINBQADMAAwLQIUWsuuJRE3VT4ueWkWMAJMJaZjj1ECFQCYY0zX4bzM +LC7obsrHD8XAHG+ZRG== +-----END X509 CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICTTCCAbagAwIBAgIBADANBgkqhkiG9w0BAQQFADBMMQswCQYDVQQGEwJHQjEM +MAoGA1UEChMDVUNMMRgwFgYDVQQLEw9JQ0UtVEVMIFByb2plY3QxFTATBgNVBAMT +DFRydXN0RmFjdG9yeTAeFw05NzA0MjIxNDM5MTRaFw05ODA0MjIxNDM5MTRaMEwx +CzAJBgNVBAYTAkdCMQwwCgYDVQQKEwNVQ0wxGDAWBgNVBAsTD0lDRS1URUwgUHJv +amVjdDEVMBMGA1UEAxMMVHJ1c3RGYWN0b3J5MIGcMAoGBFUIAQECAgQAA4GNADCB +iQKBgQCEieR8NcXkUW1f0G6aC6u0i8q/98JqS6RxK5YmHIGKCkuTWAUjzLfUa4dt +U9igGCjTuxaDqlzEim+t/02pmiBZT9HaX++35MjQPUWmsChcYU5WyzGErXi+rQaw +zlwS73zM8qiPj/97lXYycWhgL0VaiDSPxRXEUdWoaGruom4mNQIDAQABo0IwQDAd +BgNVHQ4EFgQUHal1LZr7oVg5z6lYzrhTgZRCmcUwDgYDVR0PAQH/BAQDAgH2MA8G +A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAfaggfl6FZoioecjv0dq8 +/DXo/u11iMZvXn08gjX/zl2b4wtPbShOSY5FhkSm8GeySasz+/Nwb/uzfnIhokWi +lfPZHtlCWtXbIy/TN51eJyq04ceDCQDWvLC2enVg9KB+GJ34b5c5VaPRzq8MBxsA +S7ELuYGtmYgYm9NZOIr7yU0= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIB6jCCAZQCAgEtMA0GCSqGSIb3DQEBBAUAMIGAMQswCQYDVQQGEwJVUzE2MDQG +A1UEChMtTmF0aW9uYWwgQWVyb25hdXRpY3MgYW5kIFNwYWNlIEFkbWluaXN0cmF0 +aW9uMRkwFwYDVQQLExBUZXN0IEVudmlyb25tZW50MR4wHAYDVQQLExVNRDUtUlNB +LU5BU0EtUGlsb3QtQ0EwHhcNOTYwNDMwMjIwNTAwWhcNOTcwNDMwMjIwNTAwWjCB +gDELMAkGA1UEBhMCVVMxNjA0BgNVBAoTLU5hdGlvbmFsIEFlcm9uYXV0aWNzIGFu +ZCBTcGFjZSBBZG1pbmlzdHJhdGlvbjEZMBcGA1UECxMQVGVzdCBFbnZpcm9ubWVu +dDEeMBwGA1UECxMVTUQ1LVJTQS1OQVNBLVBpbG90LUNBMFkwCgYEVQgBAQICAgAD +SwAwSAJBALmmX5+GqAvcrWK13rfDrNX9UfeA7f+ijyBgeFQjYUoDpFqapw4nzQBL +bAXug8pKkRwa2Zh8YODhXsRWu2F/UckCAwEAATANBgkqhkiG9w0BAQQFAANBAH9a +OBA+QCsjxXgnSqHx04gcU8S49DVUb1f2XVoLnHlIb8RnX0k5O6mpHT5eti9bLkiW +GJNMJ4L0AJ/ac+SmHZc= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICajCCAdMCBDGA0QUwDQYJKoZIhvcNAQEEBQAwfTELMAkGA1UEBhMCQ2ExDzAN +BgNVBAcTBk5lcGVhbjEeMBwGA1UECxMVTm8gTGlhYmlsaXR5IEFjY2VwdGVkMR8w +HQYDVQQKExZGb3IgRGVtbyBQdXJwb3NlcyBPbmx5MRwwGgYDVQQDExNFbnRydXN0 +IERlbW8gV2ViIENBMB4XDTk2MDQyNjEzMzUwMVoXDTA2MDQyNjEzMzUwMVowfTEL +MAkGA1UEBhMCQ2ExDzANBgNVBAcTBk5lcGVhbjEeMBwGA1UECxMVTm8gTGlhYmls +aXR5IEFjY2VwdGVkMR8wHQYDVQQKExZGb3IgRGVtbyBQdXJwb3NlcyBPbmx5MRww +GgYDVQQDExNFbnRydXN0IERlbW8gV2ViIENBMIGdMA0GCSqGSIb3DQEBAQUAA4GL +ADCBhwKBgQCaroS7O1DA0hm4IefNYU1cx/nqOmzEnk291d1XqznDeF4wEgakbkCc +zTKxK791yNpXG5RmngqH7cygDRTHZJ6mfCRn0wGC+AI00F2vYTGqPGRQL1N3lZT0 +YDKFC0SQeMMjFIZ1aeQigroFQnHo0VB3zWIMpNkka8PY9lxHZAmWwQIBAzANBgkq +hkiG9w0BAQQFAAOBgQBAx0UMVA1s54lMQyXjMX5kj99FJN5itb8bK1Rk+cegPQPF +cWO9SEWyEjjBjIkjjzAwBkaEszFsNGxemxtXvwjIm1xEUMTVlPEWTs2qnDvAUA9W +YqhWbhH0toGT36236QAsqCZ76rbTRVSSX2BHyJwJMG2tCRv7kRJ//NIgxj3H4w== +-----END CERTIFICATE----- + +issuer= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test PCA (1024 bit) +subject=/C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test PCA (1024 bit) +-----BEGIN CERTIFICATE----- +MIICJzCCAZACAQAwDQYJKoZIhvcNAQEEBQAwXDELMAkGA1UEBhMCQVUxEzARBgNV +BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYD +VQQDExNUZXN0IFBDQSAoMTAyNCBiaXQpMB4XDTk3MDYwOTEzNTczN1oXDTAxMDYw +OTEzNTczN1owXDELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY +BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYDVQQDExNUZXN0IFBDQSAoMTAy +NCBiaXQpMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCdoWk/3+WcMlfjIrkg +40ketmnQaEogQe1LLcuOJV6rKfUSAsPgwgsabJ/wn8TxA1yy3eKJbFl3OiUXMRsp +22Jp85PmemiDzyUIStwk72qhp1imbANZvlmlCFKiQrjUyuDfu4TABmn+kkt3vR1Y +BEOGt+IFye1UBVSATVdRJ2UVhwIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABNA1u/S +Cg/LJZWb7GliiKJsvuhxlE4E5JxQF2zMub/CSNbF97//tYSyj96sxeFQxZXbcjm9 +xt6mr/xNLA4szNQMJ4P+L7b5e/jC5DSqlwS+CUYJgaFs/SP+qJoCSu1bR3IM9XWO +cRBpDmcBbYLkSyB92WURvsZ1LtjEcn+cdQVI +-----END CERTIFICATE----- +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQCdoWk/3+WcMlfjIrkg40ketmnQaEogQe1LLcuOJV6rKfUSAsPg +wgsabJ/wn8TxA1yy3eKJbFl3OiUXMRsp22Jp85PmemiDzyUIStwk72qhp1imbANZ +vlmlCFKiQrjUyuDfu4TABmn+kkt3vR1YBEOGt+IFye1UBVSATVdRJ2UVhwIDAQAB +AoGAba4fTtuap5l7/8ZsbE7Z1O32KJY4ZcOZukLOLUUhXxXduT+FTgGWujc0/rgc +z9qYCLlNZHOouMYTgtSfYvuMuLZ11VIt0GYH+nRioLShE59Yy+zCRyC+gPigS1kz +xvo14AsOIPYV14Tk/SsHyq6E0eTk7VzaIE197giiINUERPECQQDSKmtPTh/lRKw7 +HSZSM0I1mFWn/1zqrAbontRQY5w98QWIOe5qmzYyFbPXYT3d9BzlsMyhgiRNoBbD +yvohSHXJAkEAwAHx6ezAZeWWzD5yXD36nyjpkVCw7Tk7TSmOceLJMWt1QcrCfqlS +xA5jjpQ6Z8suU5DdtWAryM2sAir1WisYzwJAd6Zcx56jvAQ3xcPXsE6scBTVFzrj +7FqZ6E+cclPzfLQ+QQsyOBE7bpI6e/FJppY26XGZXo3YGzV8IGXrt40oOQJALETG +h86EFXo3qGOFbmsDy4pdP5nBERCu8X1xUCSfintiD4c2DInxgS5oGclnJeMcjTvL +QjQoJCX3UJCi/OUO1QJBAKgcDHWjMvt+l1pjJBsSEZ0HX9AAIIVx0RQmbFGS+F2Q +hhu5l77WnnZOQ9vvhV5u7NPCUF9nhU3jh60qWWO8mkc= +-----END RSA PRIVATE KEY----- +subject=/C=US/O=RSA Data Security, Inc./OU=Commercial Certification Authority +issuer= /C=US/O=RSA Data Security, Inc./OU=Commercial Certification Authority +notBefore=941104185834Z +notAfter =991103185834Z +-----BEGIN X509 CERTIFICATE----- + +MIICIzCCAZACBQJBAAAWMA0GCSqGSIb3DQEBAgUAMFwxCzAJBgNVBAYTAlVTMSAw +HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjErMCkGA1UECxMiQ29tbWVy +Y2lhbCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NDExMDQxODU4MzRaFw05 +OTExMDMxODU4MzRaMFwxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0YSBT +ZWN1cml0eSwgSW5jLjErMCkGA1UECxMiQ29tbWVyY2lhbCBDZXJ0aWZpY2F0aW9u +IEF1dGhvcml0eTCBmzANBgkqhkiG9w0BAQEFAAOBiQAwgYUCfgCk+4Fie84QJ93o +975sbsZwmdu41QUDaSiCnHJ/lj+O7Kwpkj+KFPhCdr69XQO5kNTQvAayUTNfxMK/ +touPmbZiImDd298ggrTKoi8tUO2UMt7gVY3UaOLgTNLNBRYulWZcYVI4HlGogqHE +7yXpCuaLK44xZtn42f29O2nZ6wIDAQABMA0GCSqGSIb3DQEBAgUAA34AdrW2EP4j +9/dZYkuwX5zBaLxJu7NJbyFHXSudVMQAKD+YufKKg5tgf+tQx6sFEC097TgCwaVI +0v5loMC86qYjFmZsGySp8+x5NRhPJsjjr1BKx6cxa9B8GJ1Qv6km+iYrRpwUqbtb +MJhCKLVLU7tDCZJAuqiqWqTGtotXTcU= +-----END X509 CERTIFICATE----- +subject=/C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority +issuer= /C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority +notBefore=941109235417Z +notAfter =991231235417Z +-----BEGIN X509 CERTIFICATE----- + +MIICKTCCAZYCBQJBAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMSAw +HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJl +IFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NDExMDkyMzU0MTda +Fw05OTEyMzEyMzU0MTdaMF8xCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0 +YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJlIFNlcnZlciBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eTCBmzANBgkqhkiG9w0BAQEFAAOBiQAwgYUCfgCSznrB +roM+WqqJg1esJQF2DK2ujiw3zus1eGRUA+WEQFHJv48I4oqCCNIWhjdV6bEhAq12 +aIGaBaJLyUslZiJWbIgHj/eBWW2EB2VwE3F2Ppt3TONQiVaYSLkdpykaEy5KEVmc +HhXVSVQsczppgrGXOZxtcGdI5d0t1sgeewIDAQABMA0GCSqGSIb3DQEBAgUAA34A +iNHReSHO4ovo+MF9NFM/YYPZtgs4F7boviGNjwC4i1N+RGceIr2XJ+CchcxK9oU7 +suK+ktPlDemvXA4MRpX/oRxePug2WHpzpgr4IhFrwwk4fia7c+8AvQKk8xQNMD9h +cHsg/jKjn7P0Z1LctO6EjJY2IN6BCINxIYoPnqk= +-----END X509 CERTIFICATE----- +subject=/C=ZA/SP=Western Cape/L=Cape Town/O=Thawte Consulting cc + /OU=Certification Services Division/CN=Thawte Server CA + /Email=server-certs@thawte.com +issuer= /C=ZA/SP=Western Cape/L=Cape Town/O=Thawte Consulting cc + /OU=Certification Services Division/CN=Thawte Server CA + /Email=server-certs@thawte.com +-----BEGIN CERTIFICATE----- +MIIC+TCCAmICAQAwDQYJKoZIhvcNAQEEBQAwgcQxCzAJBgNVBAYTAlpBMRUwEwYD +VQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU +VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2Vy +dmljZXMgRGl2aXNpb24xGTAXBgNVBAMTEFRoYXd0ZSBTZXJ2ZXIgQ0ExJjAkBgkq +hkiG9w0BCQEWF3NlcnZlci1jZXJ0c0B0aGF3dGUuY29tMB4XDTk2MDcyNzE4MDc1 +N1oXDTk4MDcyNzE4MDc1N1owgcQxCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0 +ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMUVGhhd3RlIENv +bnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2 +aXNpb24xGTAXBgNVBAMTEFRoYXd0ZSBTZXJ2ZXIgQ0ExJjAkBgkqhkiG9w0BCQEW +F3NlcnZlci1jZXJ0c0B0aGF3dGUuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB +iQKBgQDTpFBuyP9Wa+bPXbbqDGh1R6KqwtqEJfyo9EdR2oW1IHSUhh4PdcnpCGH1 +Bm0wbhUZAulSwGLbTZme4moMRDjN/r7jZAlwxf6xaym2L0nIO9QnBCUQly/nkG3A +KEKZ10xD3sP1IW1Un13DWOHA5NlbsLjctHvfNjrCtWYiEtaHDQIDAQABMA0GCSqG +SIb3DQEBBAUAA4GBAIsvn7ifX3RUIrvYXtpI4DOfARkTogwm6o7OwVdl93yFhDcX +7h5t0XZ11MUAMziKdde3rmTvzUYIUCYoY5b032IwGMTvdiclK+STN6NP2m5nvFAM +qJT5gC5O+j/jBuZRQ4i0AMYQr5F4lT8oBJnhgafw6PL8aDY2vMHGSPl9+7uf +-----END CERTIFICATE----- + +-----BEGIN CERTIFICATE----- +MIIDDTCCAnYCAQAwDQYJKoZIhvcNAQEEBQAwgc4xCzAJBgNVBAYTAlpBMRUwEwYD +VQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU +VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2Vy +dmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNlcnZlciBD +QTEoMCYGCSqGSIb3DQEJARYZcHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNvbTAeFw05 +NjA3MjcxODA3MTRaFw05ODA3MjcxODA3MTRaMIHOMQswCQYDVQQGEwJaQTEVMBMG +A1UECBMMV2VzdGVybiBDYXBlMRIwEAYDVQQHEwlDYXBlIFRvd24xHTAbBgNVBAoT +FFRoYXd0ZSBDb25zdWx0aW5nIGNjMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNl +cnZpY2VzIERpdmlzaW9uMSEwHwYDVQQDExhUaGF3dGUgUHJlbWl1bSBTZXJ2ZXIg +Q0ExKDAmBgkqhkiG9w0BCQEWGXByZW1pdW0tc2VydmVyQHRoYXd0ZS5jb20wgZ8w +DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANI2NmqL18JbntqBQWKPOO5JBFXW0O8c +G5UWR+8YSDU6UvQragaPOy/qVuOvho2eF/eetGV1Ak3vywmiIVHYm9Bn0LoNkgYU +c9STy5cqAJxcTgy8+hVS/PJEbtoRSm4Iny8t4/mqOoZztkZTWMiJBb2DEbhzP6oH +jfRCTedAnRw3AgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAutFIgTRZVYerIZfL9lvR +w9Eifvvo5KTZ3h+Bj+VzNnyw4Qc/IyXkPOu6SIiH9LQ3sCmWBdxpe+qr4l77rLj2 +GYuMtESFfn1XVALzkYgC7JcPuTOjMfIiMByt+uFf8AV8x0IW/Qkuv+hEQcyM9vxK +3VZdLbCVIhNoEsysrxCpxcI= +-----END CERTIFICATE----- +Tims test GCI CA + +-----BEGIN CERTIFICATE----- +MIIB8DCCAZoCAQAwDQYJKoZIhvcNAQEEBQAwgYIxCzAJBgNVBAYTAkFVMRMwEQYD +VQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5 +cHRTb2Z0IFB0eSBMdGQxFDASBgNVBAsTC2RldmVsb3BtZW50MRkwFwYDVQQDExBD +cnlwdFNvZnQgRGV2IENBMB4XDTk3MDMyMjEzMzQwNFoXDTk4MDMyMjEzMzQwNFow +gYIxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhC +cmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxFDASBgNVBAsTC2Rl +dmVsb3BtZW50MRkwFwYDVQQDExBDcnlwdFNvZnQgRGV2IENBMFwwDQYJKoZIhvcN +AQEBBQADSwAwSAJBAOAOAqogG5QwAmLhzyO4CoRnx/wVy4NZP4dxJy83O1EnL0rw +OdsamJKvPOLHgSXo3gDu9uVyvCf/QJmZAmC5ml8CAwEAATANBgkqhkiG9w0BAQQF +AANBADRRS/GVdd7rAqRW6SdmgLJduOU2yq3avBu99kRqbp9A/dLu6r6jU+eP4oOA +TfdbFZtAAD2Hx9jUtY3tfdrJOb8= +-----END CERTIFICATE----- + +-----BEGIN CERTIFICATE----- +MIICVjCCAgACAQAwDQYJKoZIhvcNAQEEBQAwgbUxCzAJBgNVBAYTAkFVMRMwEQYD +VQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5 +cHRTb2Z0IFB0eSBMdGQxLDAqBgNVBAsTI1dPUlRITEVTUyBDRVJUSUZJQ0FUSU9O +IEFVVEhPUklUSUVTMTQwMgYDVQQDEytaRVJPIFZBTFVFIENBIC0gREVNT05TVFJB +VElPTiBQVVJQT1NFUyBPTkxZMB4XDTk3MDQwMzEzMjI1NFoXDTk4MDQwMzEzMjI1 +NFowgbUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQH +EwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxLDAqBgNVBAsT +I1dPUlRITEVTUyBDRVJUSUZJQ0FUSU9OIEFVVEhPUklUSUVTMTQwMgYDVQQDEyta +RVJPIFZBTFVFIENBIC0gREVNT05TVFJBVElPTiBQVVJQT1NFUyBPTkxZMFwwDQYJ +KoZIhvcNAQEBBQADSwAwSAJBAOZ7T7yqP/tyspcko3yPY1y0Cm2EmwNvzW4QgVXR +Fjs3HmJ4xtSpXdo6mwcGezL3Abt/aQXaxv9PU8xt+Jr0OFUCAwEAATANBgkqhkiG +9w0BAQQFAANBAOQpYmGgyCqCy1OljgJhCqQOu627oVlHzK1L+t9vBaMfn40AVUR4 +WzQVWO31KTgi5vTK1U+3h46fgUWqQ0h+6rU= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIAwgKADAgECAgEAMA0GCSqGSIb3DQEBBAUAMGIxETAPBgNVBAcTCEludGVybmV0 +MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE0MDIGA1UECxMrVmVyaVNpZ24gQ2xh +c3MgMSBDQSAtIEluZGl2aWR1YWwgU3Vic2NyaWJlcjAeFw05NjA0MDgxMDIwMjda +Fw05NzA0MDgxMDIwMjdaMGIxETAPBgNVBAcTCEludGVybmV0MRcwFQYDVQQKEw5W +ZXJpU2lnbiwgSW5jLjE0MDIGA1UECxMrVmVyaVNpZ24gQ2xhc3MgMSBDQSAtIElu +ZGl2aWR1YWwgU3Vic2NyaWJlcjCAMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2 +FKbPTdAFDdjKI9BvqrQpkmOOLPhvltcunXZLEbE2jVfJw/0cxrr+Hgi6M8qV6r7j +W80GqLd5HUQq7XPysVKDaBBwZJHXPmv5912dFEObbpdFmIFH0S3L3bty10w/cari +QPJUObwW7s987LrbP2wqsxaxhhKdrpM01bjV0Pc+qQIDAQABAAAAADANBgkqhkiG +9w0BAQQFAAOBgQA+1nJryNt8VBRjRr07ArDAV/3jAH7GjDc9jsrxZS68ost9v06C +TvTNKGL+LISNmFLXl+JXhgGB0JZ9fvyYzNgHQ46HBUng1H6voalfJgS2KdEo50wW +8EFZYMDkT1k4uynwJqkVN2QJK/2q4/A/VCov5h6SlM8Affg2W+1TLqvqkwAA +-----END CERTIFICATE----- + + subject=/L=Internet/O=VeriSign, Inc./OU=VeriSign Class 2 CA - Individual Subscriber + issuer= /L=Internet/O=VeriSign, Inc./OU=VeriSign Class 2 CA - Individual Subscriber + +-----BEGIN CERTIFICATE----- +MIIEkzCCA/ygAwIBAgIRANDTUpSRL3nTFeMrMayFSPAwDQYJKoZIhvcNAQECBQAw +YjERMA8GA1UEBxMISW50ZXJuZXQxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTQw +MgYDVQQLEytWZXJpU2lnbiBDbGFzcyAyIENBIC0gSW5kaXZpZHVhbCBTdWJzY3Jp +YmVyMB4XDTk2MDYwNDAwMDAwMFoXDTk4MDYwNDIzNTk1OVowYjERMA8GA1UEBxMI +SW50ZXJuZXQxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTQwMgYDVQQLEytWZXJp +U2lnbiBDbGFzcyAyIENBIC0gSW5kaXZpZHVhbCBTdWJzY3JpYmVyMIGfMA0GCSqG +SIb3DQEBAQUAA4GNADCBiQKBgQC6A+2czKGRcYMfm8gdnk+0de99TDDzsqo0v5nb +RsbUmMcdRQ7nsMbRWe0SAb/9QoLTZ/cJ0iOBqdrkz7UpqqKarVoTSdlSMVM92tWp +3bJncZHQD1t4xd6lQVdI1/T6R+5J0T1ukOdsI9Jmf+F28S6g3R3L1SFwiHKeZKZv +z+793wIDAQABo4ICRzCCAkMwggIpBgNVHQMBAf8EggIdMIICGTCCAhUwggIRBgtg +hkgBhvhFAQcBATCCAgAWggGrVGhpcyBjZXJ0aWZpY2F0ZSBpbmNvcnBvcmF0ZXMg +YnkgcmVmZXJlbmNlLCBhbmQgaXRzIHVzZSBpcyBzdHJpY3RseSBzdWJqZWN0IHRv +LCB0aGUgVmVyaVNpZ24gQ2VydGlmaWNhdGlvbiBQcmFjdGljZSBTdGF0ZW1lbnQg +KENQUyksIGF2YWlsYWJsZSBhdDogaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL0NQ +Uy0xLjA7IGJ5IEUtbWFpbCBhdCBDUFMtcmVxdWVzdHNAdmVyaXNpZ24uY29tOyBv +ciBieSBtYWlsIGF0IFZlcmlTaWduLCBJbmMuLCAyNTkzIENvYXN0IEF2ZS4sIE1v +dW50YWluIFZpZXcsIENBIDk0MDQzIFVTQSBUZWwuICsxICg0MTUpIDk2MS04ODMw +IENvcHlyaWdodCAoYykgMTk5NiBWZXJpU2lnbiwgSW5jLiAgQWxsIFJpZ2h0cyBS +ZXNlcnZlZC4gQ0VSVEFJTiBXQVJSQU5USUVTIERJU0NMQUlNRUQgYW5kIExJQUJJ +TElUWSBMSU1JVEVELqAOBgxghkgBhvhFAQcBAQGhDgYMYIZIAYb4RQEHAQECMC8w +LRYraHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JlcG9zaXRvcnkvQ1BTLTEuMDAU +BglghkgBhvhCAQEBAf8EBAMCAgQwDQYJKoZIhvcNAQECBQADgYEApRJRkNBqLLgs +53IR/d18ODdLOWMTZ+QOOxBrq460iBEdUwgF8vmPRX1ku7UiDeNzaLlurE6eFqHq +2zPyK5j60zfTLVJMWKcQWwTJLjHtXrW8pxhNtFc6Fdvy5ZkHnC/9NIl7/t4U6WqB +p4y+p7SdMIkEwIZfds0VbnQyX5MRUJY= +-----END CERTIFICATE----- + + subject=/C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority + issuer= /C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority +-----BEGIN CERTIFICATE----- +MIICMTCCAZoCBQKhAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMRcw +FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMyBQdWJsaWMg +UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NjAxMjkwMDAwMDBa +Fw05OTEyMzEyMzU5NTlaMF8xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2ln +biwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMyBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAyVxZ +nvIbigEUtBDfBEDb41evakVAj4QMC9Ez2dkRz+4CWB8l9yqoRAWq7AMfeH+ek7ma +AKojfdashaJjRcdyJ8z0TMZ1cdI5709C8HXfCpDGjiBvmA/4rCNfcCk2pMmG57Ga +IMtTpYXnPb59mv4kRTPcdhXtD6JxZExlLoFoRacCAwEAATANBgkqhkiG9w0BAQIF +AAOBgQB1Zmw+0c2B27X4LzZRtvdCvM1Cr9wO+hVs+GeTVzrrtpLotgHKjLeOQ7RJ +Zfk+7r11Ri7J/CVdqMcvi5uPaM+0nJcYwE3vH9mvgrPmZLiEXIqaB1JDYft0nls6 +NvxMsvwaPxUupVs8G5DsiCnkWRb5zget7Ond2tIxik/W2O8XjQ== +-----END CERTIFICATE----- + subject=/C=US/O=VeriSign, Inc./OU=Class 4 Public Primary Certification Authority + issuer= /C=US/O=VeriSign, Inc./OU=Class 4 Public Primary Certification Authority +-----BEGIN CERTIFICATE----- +MIICMTCCAZoCBQKmAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMRcw +FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgNCBQdWJsaWMg +UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NjAxMjkwMDAwMDBa +Fw05OTEyMzEyMzU5NTlaMF8xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2ln +biwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgNCBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0LJ1 +9njQrlpQ9OlQqZ+M1++RlHDo0iSQdomF1t+s5gEXMoDwnZNHvJplnR+Xrr/phnVj +IIm9gFidBAydqMEk6QvlMXi9/C0MN2qeeIDpRnX57aP7E3vIwUzSo+/1PLBij0pd +O92VZ48TucE81qcmm+zDO3rZTbxtm+gVAePwR6kCAwEAATANBgkqhkiG9w0BAQIF +AAOBgQBT3dPwnCR+QKri/AAa19oM/DJhuBUNlvP6Vxt/M3yv6ZiaYch6s7f/sdyZ +g9ysEvxwyR84Qu1E9oAuW2szaayc01znX1oYx7EteQSWQZGZQbE8DbqEOcY7l/Am +yY7uvcxClf8exwI/VAx49byqYHwCaejcrOICdmHEPgPq0ook0Q== +-----END CERTIFICATE----- diff --git a/src/lib/libssl/src/perl/ss.pl b/src/lib/libssl/src/perl/ss.pl new file mode 100644 index 0000000000..f243a3af50 --- /dev/null +++ b/src/lib/libssl/src/perl/ss.pl @@ -0,0 +1,64 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$ssl_ctx=SSL::CTX->new("SSLv3_client"); + +#$ssl_ctx->set_options("-info_callback" => +# sub { +# print STDERR $_[0]->state()."\n"; +# } +# ); + +$conn="localhost:4433"; +$conn=$ARGV[0] if $#ARGV >= 0; + +print $ssl_ctx."\n"; +$bio=BIO->new_buffer_ssl_connect($ssl_ctx); +$bio->hostname($conn) || die $bio->error(); + +#$bio->set_callback( +# sub { +# my($bio,$state,$cmd,$buf,$lart,$ret)=@_; +# print STDERR "$state:$cmd\n"; +# return($ret); +# } +# ); + +#$b=$bio; +#do { +# print STDERR $b->type."\n"; +# } while ($b=$b->next_bio); + +(($ret=$bio->syswrite("GET / HTTP/1.0\r\n\r\n")) > 0) || die $bio->error(); +$bio->flush; + +$data=""; +while (1) + { + $ret=$bio->getline; + $ret =~ s/[\r\n]//g; + print STDERR "$ret\n"; + last if $ret eq ""; + $server=$1 if $ret=~ /^Server: (.*)/; + } + + +print "server is $server\n"; +$x509=$ssl->get_peer_certificate(); +print "version :".$x509->get_version()."\n"; +print "serialNumber:".$x509->get_serialNumber()->bn2hex."\n"; +print "subject :".$x509->get_subject_name()."\n"; +print "issuer :". $x509->get_issuer_name()."\n"; + +$c=$ssl->get_current_cipher; +($i,$a)=$c->get_bits; +$v=$c->get_version; +$n=$c->get_name; + +$ssl=$bio->get_ssl(); +print "protocol=".$ssl->get_version."\n"; +print "bits=$i($a) cipher type=$v cipher=$n\n"; + diff --git a/src/lib/libssl/src/perl/ssl.pl b/src/lib/libssl/src/perl/ssl.pl new file mode 100644 index 0000000000..f9e983ed87 --- /dev/null +++ b/src/lib/libssl/src/perl/ssl.pl @@ -0,0 +1,71 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$ssl_ctx=SSL::CTX->new("SSLv3"); + +$ssl_ctx->set_options("-info_callback" => + sub { + print STDERR $_[0]->state()."\n"; + } + ); + +$conn="localhost:4433"; +$conn=$ARGV[0] if $#ARGV >= 0; +$bio=BIO->new("connect"); +$bio->hostname($conn) || die $ssl->error(); + +#$bbio=BIO->new("buffer"); +#$bbio->push($cbio); +#$bio=$bbio; + +#$bio->set_callback( +# sub { +# my($bio,$state,$cmd,$buf,$lart,$ret)=@_; +# print STDERR "$state:$cmd\n"; +# return($ret); +# } +# ); + +print STDERR "-1 ABCD\n"; +$ssl=$ssl_ctx->new_ssl; +print STDERR "000 ABCD\n"; +$ssl->set_bio($bio); + +print STDERR "00 ABCD\n"; +(($ret=$ssl->connect()) > 0) || die $ssl->error(); + +print STDERR "0 ABCD\n"; + +(($ret=$ssl->syswrite("GET / HTTP/1.0\r\n\r\n")) > 0) || die $ssl->error(); + +print STDERR "1 ABCD\n"; +$data=""; +while (1) + { +print STDERR "2 ABCD\n"; + $ret=$ssl->sysread($buf,1024); +print STDERR "3 ABCD\n"; + last if $ret <= 0; + $data.=$buf; + } + +print STDERR "4 ABCD\n"; +@a=split(/[\r]\n/,$data); +($server)=grep(/^Server:/,@a); + +print "$server\n"; +$x509=$ssl->get_peer_certificate(); +print "subject:".$x509->get_subject_name()."\n"; +print "issuer:". $x509->get_issuer_name()."\n"; + +$c=$ssl->get_current_cipher; +($i,$a)=$c->get_bits; +$v=$c->get_version; +$n=$c->get_name; + +print "protocol=".$ssl->get_version."\n"; +print "bits=$i($a) cipher type=$v cipher=$n\n"; + diff --git a/src/lib/libssl/src/perl/ssl.txt b/src/lib/libssl/src/perl/ssl.txt new file mode 100644 index 0000000000..63c52a0e1d --- /dev/null +++ b/src/lib/libssl/src/perl/ssl.txt @@ -0,0 +1,43 @@ +SSL_CTX::new(method) + SSLv3 + SSLv3_client + SSLv3_server + SSLv23 + SSLv23_client + SSLv23_server + SSLv2 + SSLv2_client + SSLv2_server + +SSL_CTX::use_PrivateKey_file(file[,type]) + type eq "der" or "pem". Default == 'pem'. + +SSL_CTX::set_options(...) + -info_callback function + +SSL::new(SSL_CTX) + +SSL::connect(); returns 0, -1 or 1 +SSL::accept(); return 0, -1 or 1 +SSL::sysread(); as per sysread +SSL::syswrite(); as per syswrite +SSL::set_bio(bio); + +SSL::set_options(...) + -info_callback function + -connect_state + -accept_state + +SSL::state(); the state in numeric and text form. +SSL::references(); debug stuff +SSL::get_peer_certificate() +SSL::do_handshake() +SSL::renegotiate() +SSL::shutdown() +SSL::get_version() + +SSL::get_current_cipher(); + +(key,alg)=SSL_CIPHER::get_bits(); +SSL_CIPHER::get_version(); +SSL_CIPHER::get_name(); diff --git a/src/lib/libssl/src/perl/ssl.xs b/src/lib/libssl/src/perl/ssl.xs new file mode 100644 index 0000000000..6777cf7ada --- /dev/null +++ b/src/lib/libssl/src/perl/ssl.xs @@ -0,0 +1,474 @@ +#include "p5SSLeay.h" + +static int p5_ssl_ex_ssl_ptr=0; +static int p5_ssl_ex_ssl_info_callback=0; +static int p5_ssl_ex_ssl_ctx_ptr=0; +static int p5_ssl_ctx_ex_ssl_info_callback=0; + +typedef struct ssl_ic_args_st { + SV *cb; + SV *arg; + } SSL_IC_ARGS; + +static void p5_ssl_info_callback(ssl,mode,ret) +SSL *ssl; +int mode; +int ret; + { + int i; + SV *me,*cb; + + me=(SV *)SSL_get_ex_data(ssl,p5_ssl_ex_ssl_ptr); + cb=(SV *)SSL_get_ex_data(ssl,p5_ssl_ex_ssl_info_callback); + if (cb == NULL) + cb=(SV *)SSL_CTX_get_ex_data( + SSL_get_SSL_CTX(ssl),p5_ssl_ctx_ex_ssl_info_callback); + if (cb != NULL) + { + dSP; + + PUSHMARK(sp); + XPUSHs(me); + XPUSHs(sv_2mortal(newSViv(mode))); + XPUSHs(sv_2mortal(newSViv(ret))); + PUTBACK; + + i=perl_call_sv(cb,G_DISCARD); + } + else + { + croak("Internal error in SSL p5_ssl_info_callback"); + } + } + +int boot_ssl() + { + p5_ssl_ex_ssl_ptr= + SSL_get_ex_new_index(0,"SSLeay::SSL",ex_new,NULL,ex_cleanup); + p5_ssl_ex_ssl_info_callback= + SSL_get_ex_new_index(0,"ssl_info_callback",NULL,NULL, + ex_cleanup); + p5_ssl_ex_ssl_ctx_ptr= + SSL_get_ex_new_index(0,"ssl_ctx_ptr",NULL,NULL, + ex_cleanup); + p5_ssl_ctx_ex_ssl_info_callback= + SSL_CTX_get_ex_new_index(0,"ssl_ctx_info_callback",NULL,NULL, + ex_cleanup); + return(1); + } + +MODULE = SSLeay::SSL PACKAGE = SSLeay::SSL::CTX PREFIX = p5_SSL_CTX_ + +VERSIONCHECK: DISABLE + +void +p5_SSL_CTX_new(...) + PREINIT: + SSL_METHOD *meth; + SSL_CTX *ctx; + char *method; + PPCODE: + pr_name("p5_SSL_CTX_new"); + if ((items == 1) && SvPOK(ST(0))) + method=SvPV(ST(0),na); + else if ((items == 2) && SvPOK(ST(1))) + method=SvPV(ST(1),na); + else + croak("Usage: SSLeay::SSL_CTX::new(type)"); + + if (strcmp(method,"SSLv3") == 0) + meth=SSLv3_method(); + else if (strcmp(method,"SSLv3_client") == 0) + meth=SSLv3_client_method(); + else if (strcmp(method,"SSLv3_server") == 0) + meth=SSLv3_server_method(); + else if (strcmp(method,"SSLv23") == 0) + meth=SSLv23_method(); + else if (strcmp(method,"SSLv23_client") == 0) + meth=SSLv23_client_method(); + else if (strcmp(method,"SSLv23_server") == 0) + meth=SSLv23_server_method(); + else if (strcmp(method,"SSLv2") == 0) + meth=SSLv2_method(); + else if (strcmp(method,"SSLv2_client") == 0) + meth=SSLv2_client_method(); + else if (strcmp(method,"SSLv2_server") == 0) + meth=SSLv2_server_method(); + else + { + croak("Not passed a valid SSL method name, should be 'SSLv[23] [client|server]'"); + } + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ctx=SSL_CTX_new(meth); + sv_setref_pv(ST(0), "SSLeay::SSL::CTX", (void*)ctx); + +int +p5_SSL_CTX_use_PrivateKey_file(ctx,file,...) + SSL_CTX *ctx; + char *file; + PREINIT: + int i=SSL_FILETYPE_PEM; + char *ptr; + CODE: + pr_name("p5_SSL_CTX_use_PrivateKey_file"); + if (items > 3) + croak("SSLeay::SSL::CTX::use_PrivateKey_file(ssl_ctx,file[,type])"); + if (items == 3) + { + ptr=SvPV(ST(2),na); + if (strcmp(ptr,"der") == 0) + i=SSL_FILETYPE_ASN1; + else + i=SSL_FILETYPE_PEM; + } + RETVAL=SSL_CTX_use_RSAPrivateKey_file(ctx,file,i); + OUTPUT: + RETVAL + +int +p5_SSL_CTX_set_options(ctx,...) + SSL_CTX *ctx; + PREINIT: + int i; + char *ptr; + SV *sv; + CODE: + pr_name("p5_SSL_CTX_set_options"); + + for (i=1; i<items; i++) + { + if (!SvPOK(ST(i))) + croak("Usage: SSLeay::SSL_CTX::set_options(ssl_ctx[,option,value]+)"); + ptr=SvPV(ST(i),na); + if (strcmp(ptr,"-info_callback") == 0) + { + SSL_CTX_set_info_callback(ctx, + p5_ssl_info_callback); + sv=sv_mortalcopy(ST(i+1)); + SvREFCNT_inc(sv); + SSL_CTX_set_ex_data(ctx, + p5_ssl_ctx_ex_ssl_info_callback, + (char *)sv); + i++; + } + else + { + croak("SSLeay::SSL_CTX::set_options(): unknown option"); + } + } + +void +p5_SSL_CTX_DESTROY(ctx) + SSL_CTX *ctx + PREINIT: + SV *sv; + PPCODE: + pr_name_d("p5_SSL_CTX_DESTROY",ctx->references); + SSL_CTX_free(ctx); + +MODULE = SSLeay::SSL PACKAGE = SSLeay::SSL PREFIX = p5_SSL_ + +void +p5_SSL_new(...) + PREINIT: + SV *sv_ctx; + SSL_CTX *ctx; + SSL *ssl; + int i; + SV *arg; + PPCODE: + pr_name("p5_SSL_new"); + if ((items != 1) && (items != 2)) + croak("Usage: SSLeay::SSL::new(ssl_ctx)"); + if (sv_derived_from(ST(items-1),"SSLeay::SSL::CTX")) + { + IV tmp = SvIV((SV*)SvRV(ST(items-1))); + ctx=(SSL_CTX *)tmp; + sv_ctx=ST(items-1); + } + else + croak("ssl_ctx is not of type SSLeay::SSL::CTX"); + + EXTEND(sp,1); + PUSHs(sv_newmortal()); + ssl=SSL_new(ctx); + sv_setref_pv(ST(0), "SSLeay::SSL", (void*)ssl); + + /* Now this is being a little hairy, we keep a pointer to + * our perl reference. We need to do a different one + * to the one we return because it will have it's reference + * count droped to 0 apon return and if we up its reference + * count, it will never be DESTROYED */ + arg=newSVsv(ST(0)); + SSL_set_ex_data(ssl,p5_ssl_ex_ssl_ptr,(char *)arg); + SvREFCNT_inc(sv_ctx); + SSL_set_ex_data(ssl,p5_ssl_ex_ssl_ctx_ptr,(char *)sv_ctx); + +int +p5_SSL_connect(ssl) + SSL *ssl; + CODE: + RETVAL=SSL_connect(ssl); + OUTPUT: + RETVAL + +int +p5_SSL_accept(ssl) + SSL *ssl; + CODE: + RETVAL=SSL_connect(ssl); + OUTPUT: + RETVAL + +int +p5_SSL_sysread(ssl,in,num, ...) + SSL *ssl; + SV *in; + int num; + PREINIT: + int i,n,olen; + int offset; + char *p; + CODE: + offset=0; + if (!SvPOK(in)) + sv_setpvn(in,"",0); + SvPV(in,olen); + if (items > 3) + { + offset=SvIV(ST(3)); + if (offset < 0) + { + if (-offset > olen) + croad("Offset outside string"); + offset+=olen; + } + } + if ((num+offset) > olen) + { + SvGROW(in,num+offset+1); + p=SvPV(in,i); + memset(&(p[olen]),0,(num+offset)-olen+1); + } + p=SvPV(in,n); + + i=SSL_read(ssl,p+offset,num); + RETVAL=i; + if (i <= 0) i=0; + SvCUR_set(in,offset+i); + OUTPUT: + RETVAL + +int +p5_SSL_syswrite(ssl,in, ...) + SSL *ssl; + SV *in; + PREINIT: + char *ptr; + int len,in_len; + int offset=0; + int n; + CODE: + ptr=SvPV(in,in_len); + if (items > 2) + { + len=SvOK(ST(2))?SvIV(ST(2)):in_len; + if (items > 3) + { + offset=SvIV(ST(3)); + if (offset < 0) + { + if (-offset > in_len) + croak("Offset outside string"); + offset+=in_len; + } + else if ((offset >= in_len) && (in_len > 0)) + croak("Offset outside string"); + } + if (len >= (in_len-offset)) + len=in_len-offset; + } + else + len=in_len; + + RETVAL=SSL_write(ssl,ptr+offset,len); + OUTPUT: + RETVAL + +void +p5_SSL_set_bio(ssl,bio) + SSL *ssl; + BIO *bio; + CODE: + bio->references++; + SSL_set_bio(ssl,bio,bio); + +int +p5_SSL_set_options(ssl,...) + SSL *ssl; + PREINIT: + int i; + char *ptr; + SV *sv; + CODE: + pr_name("p5_SSL_set_options"); + + for (i=1; i<items; i++) + { + if (!SvPOK(ST(i))) + croak("Usage: SSLeay::SSL::set_options(ssl[,option,value]+)"); + ptr=SvPV(ST(i),na); + if (strcmp(ptr,"-info_callback") == 0) + { + SSL_set_info_callback(ssl, + p5_ssl_info_callback); + sv=sv_mortalcopy(ST(i+1)); + SvREFCNT_inc(sv); + SSL_set_ex_data(ssl, + p5_ssl_ex_ssl_info_callback,(char *)sv); + i++; + } + else if (strcmp(ptr,"-connect_state") == 0) + { + SSL_set_connect_state(ssl); + } + else if (strcmp(ptr,"-accept_state") == 0) + { + SSL_set_accept_state(ssl); + } + else + { + croak("SSLeay::SSL::set_options(): unknown option"); + } + } + +void +p5_SSL_state(ssl) + SSL *ssl; + PREINIT: + int state; + PPCODE: + pr_name("p5_SSL_state"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + state=SSL_state(ssl); + sv_setpv(ST(0),SSL_state_string_long(ssl)); + sv_setiv(ST(0),state); + SvPOK_on(ST(0)); + +void +p5_SSL_DESTROY(ssl) + SSL *ssl; + CODE: + pr_name_dd("p5_SSL_DESTROY",ssl->references,ssl->ctx->references); + fprintf(stderr,"SSL_DESTROY %d\n",ssl->references); + SSL_free(ssl); + +int +p5_SSL_references(ssl) + SSL *ssl; + CODE: + RETVAL=ssl->references; + OUTPUT: + RETVAL + +int +p5_SSL_do_handshake(ssl) + SSL *ssl; + CODE: + RETVAL=SSL_do_handshake(ssl); + OUTPUT: + RETVAL + +int +p5_SSL_renegotiate(ssl) + SSL *ssl; + CODE: + RETVAL=SSL_renegotiate(ssl); + OUTPUT: + RETVAL + +int +p5_SSL_shutdown(ssl) + SSL *ssl; + CODE: + RETVAL=SSL_shutdown(ssl); + OUTPUT: + RETVAL + +char * +p5_SSL_get_version(ssl) + SSL *ssl; + CODE: + RETVAL=SSL_get_version(ssl); + OUTPUT: + RETVAL + +SSL_CIPHER * +p5_SSL_get_current_cipher(ssl) + SSL *ssl; + CODE: + RETVAL=SSL_get_current_cipher(ssl); + OUTPUT: + RETVAL + +X509 * +p5_SSL_get_peer_certificate(ssl) + SSL *ssl + CODE: + RETVAL=SSL_get_peer_certificate(ssl); + OUTPUT: + RETVAL + +MODULE = SSLeay::SSL PACKAGE = SSLeay::SSL::CIPHER PREFIX = p5_SSL_CIPHER_ + +int +p5_SSL_CIPHER_get_bits(sc) + SSL_CIPHER *sc + PREINIT: + int i,ret; + PPCODE: + EXTEND(sp,2); + PUSHs(sv_newmortal()); + PUSHs(sv_newmortal()); + ret=SSL_CIPHER_get_bits(sc,&i); + sv_setiv(ST(0),(IV)ret); + sv_setiv(ST(1),(IV)i); + +char * +p5_SSL_CIPHER_get_version(sc) + SSL_CIPHER *sc + CODE: + RETVAL=SSL_CIPHER_get_version(sc); + OUTPUT: + RETVAL + +char * +p5_SSL_CIPHER_get_name(sc) + SSL_CIPHER *sc + CODE: + RETVAL=SSL_CIPHER_get_name(sc); + OUTPUT: + RETVAL + +MODULE = SSLeay::SSL PACKAGE = SSLeay::BIO PREFIX = p5_BIO_ + +void +p5_BIO_get_ssl(bio) + BIO *bio; + PREINIT: + SSL *ssl; + SV *ret; + int i; + PPCODE: + if ((i=BIO_get_ssl(bio,&ssl)) > 0) + { + ret=(SV *)SSL_get_ex_data(ssl,p5_ssl_ex_ssl_ptr); + ret=sv_mortalcopy(ret); + } + else + ret= &sv_undef; + EXTEND(sp,1); + PUSHs(ret); + diff --git a/src/lib/libssl/src/perl/ssl_srvr.pl b/src/lib/libssl/src/perl/ssl_srvr.pl new file mode 100644 index 0000000000..653a2e7f03 --- /dev/null +++ b/src/lib/libssl/src/perl/ssl_srvr.pl @@ -0,0 +1,35 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$ssl_ctx=SSL::CTX->new("SSLv3"); + +$ssl_ctx->set_options("-info_callback" => + sub { + print STDERR $_[0]->state()."\n"; + } + ); + +$ssl_ctx->use_PrivateKey_file("server.pem"); + +$conn="localhost:4433"; +$conn=$ARGV[0] if $#ARGV >= 0; +$bio=BIO->new("connect"); +$bio->hostname($conn) || die $ssl->error(); + +$ssl=$ssl_ctx->new_ssl; +$ssl->set_bio($bio); + +(($ret=$ssl->connect()) > 0) || die $ssl->error(); + +(($ret=$ssl->write("GET / HTTP/1.0\r\n\r\n")) > 0) || die $ssl->error(); + +while (1) + { + $ret=$ssl->read($buf,10240); + last if ($ret <= 0); + print $buf; + } + diff --git a/src/lib/libssl/src/perl/sslbio.pl b/src/lib/libssl/src/perl/sslbio.pl new file mode 100644 index 0000000000..ca9daa36a1 --- /dev/null +++ b/src/lib/libssl/src/perl/sslbio.pl @@ -0,0 +1,40 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$ssl_ctx=SSL::CTX->new("SSLv3"); + +#$ssl_ctx->set_options("-info_callback" => +# sub { +# print STDOUT $_[0]->state()."\n"; +# } +# ); + +# create a ssl bio +$bssl=BIO->new("ssl"); +$bssl->set_ssl($ssl_ctx->new_ssl()) || die $bssl->error(); +$bssl->get_ssl->set_options("-connect_state") || die $ssl->error(); + +$bssl->set_callback(sub { printf "XXXXXXXXXXXXXXXXXXXXXX %d %s\n",$_[1],$_[0]->type; }); + +# create connect bio +$host="localhost:4433"; +$host=$ARGV[0] if $#ARGV >= 0; +$bio=BIO->new("connect"); +$bio->hostname($host) || die $bio->error(); + +# push it in +$bssl->push($bio); + +(($ret=$bssl->write("GET / HTTP/1.0\r\n\r\n")) > 0) || die $bssl->error(); + +while (1) + { + $ret=$bssl->read($buf,10240); + last if ($ret <= 0); + print $buf; + } + + diff --git a/src/lib/libssl/src/perl/t.pl b/src/lib/libssl/src/perl/t.pl new file mode 100644 index 0000000000..fbd9fb8490 --- /dev/null +++ b/src/lib/libssl/src/perl/t.pl @@ -0,0 +1,12 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$a=SSLeay::BN::dec2bn("1231353465324563455"); +print "a=$a\n".$a->bn2dec."\n"; +$b=SSLeay::BN::dec2bn("98790816238765235"); +print "a=$a\nb=$b\n"; +print $a->gcd($b)."\n"; + diff --git a/src/lib/libssl/src/perl/test b/src/lib/libssl/src/perl/test new file mode 100644 index 0000000000..3977c48865 --- /dev/null +++ b/src/lib/libssl/src/perl/test @@ -0,0 +1,32 @@ +30373b8dbfc38d360bda81fad2fb462e 8 0 8 des-ecb +a5f61a73a0894979d46c2481e9f27151 8 8 1 des-cfb +a64a08dc69e79becccde95bed6239fca 8 8 1 des-ofb +553d168193e54100524541f2c473b705 8 8 8 des-cbc +bb75383e4aad6d83418dde16c6cea6f5 16 0 8 des-ede +3ea71cd9a2e50d82d66b433e9471eeb2 16 8 1 des-ede-cfb +3d56b76d43dc8d51647773bc9719a355 16 8 1 des-ede-ofb +eafa89aae63167b9798639c0e31223b4 16 8 8 des-ede-cbc +a952f8c409fb0df75a7df1aa54ba30b8 24 0 8 des-ede3 +0badccc43a14d8503d33f32a2345bbd2 24 8 1 des-ede3-cfb +bae638c0e33850d02c792ed0e3d6b600 24 8 1 des-ede3-ofb +ec4522bbefabf0198126683e661325e2 24 8 8 des-ede3-cbc +4431f05d198d8afc003aeec85bea01b9 24 8 8 desx-cbc +606af8d6f30c1fd9c647df5eb716ae0f 16 0 1 rc4 +4aaaf7e4bc3fd2caa6318a4852f636f4 5 0 1 rc4-40 +77e0851e8c96c4a1e26140d1ec822036 16 0 8 idea-ecb +a28e51e283519fde0e128bcb697bc23e 16 8 1 idea-cfb +17d0e70f07de6c08e9673d52987599ab 16 8 1 idea-ofb +0687cf6ca11ee45f8bf9c29525405a4d 16 8 8 idea-cbc +e2268681a63198fe38282b0a1bb6ed36 16 0 8 rc2-ecb +f48748e6386790e639bbee4fccaa5067 16 8 8 rc2-cbc +f250cfe829ef797d6866e32526ec4fe4 5 8 8 rc2-40-cbc +a372f970b6c346341a2899bb872a7349 16 8 1 rc2-cfb +d2da66102dea6b833f0fbf71e2cb4988 16 8 1 rc2-ofb +237b0ef0e4f7fb28a5708d59773caecf 16 0 8 bf-ecb +c58cf5da90472caf0f0b7fafb0590977 16 8 1 bf-cfb +1f3e49e2e27f9ad177a6a64b09d361ed 16 8 1 bf-ofb +66acaf2cb5f301580c59fa17d005b716 16 8 8 bf-cbc +3548c9fe9fcd13f647ae177a15915af9 16 0 8 cast5-ecb +e8d074ad8cc0d3d828da80ab18452f91 16 8 1 cast5-cfb +5331eb4351c2048c27c8a8901fd29e20 16 8 1 cast5-ofb +8033607fdb68598cc62c379af218eeeb 16 8 8 cast5-cbc diff --git a/src/lib/libssl/src/perl/test.pl b/src/lib/libssl/src/perl/test.pl new file mode 100644 index 0000000000..52423ef620 --- /dev/null +++ b/src/lib/libssl/src/perl/test.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +($a=SSLeay::BN::new()) || die "unable to make bignum\n"; +($b=SSLeay::BN::new()) || die "unable to make bignum\n"; + +$a=SSLeay::BN::hex2bn("123456789ABCDEF"); +$b=SSLeay::BN::hex2bn("123456789ABCDEF"); +$mod=SSLeay::BN::hex2bn("fedcba9876543201"); +$c=SSLeay::BN::hex2bn("1234"); + +print "a=".$a->bn2hex()."\n"; +print "b=".$b->bn2hex()."\n"; +print "c=".$c->bn2hex()."\n"; + +print $a->mul($b)->bn2hex."\n"; +($d,$r)=$b->div($c); +print "($d)($r)\n"; +printf "%s x %s + %s\n",$c->bn2hex,$d->bn2hex,$r->bn2hex; + +$g=$d; + +for (;;) + { + $a=$a->mod_mul($a,$mod); + print $a->bn2hex."\n"; + } diff --git a/src/lib/libssl/src/perl/test.txt b/src/lib/libssl/src/perl/test.txt new file mode 100644 index 0000000000..ff37ffd09b --- /dev/null +++ b/src/lib/libssl/src/perl/test.txt @@ -0,0 +1,36 @@ +30373b8dbfc38d360bda81fad2fb462e 8 0 8 des-ecb +a5f61a73a0894979d46c2481e9f27151 8 8 1 des-cfb +a64a08dc69e79becccde95bed6239fca 8 8 1 des-ofb +553d168193e54100524541f2c473b705 8 8 8 des-cbc +bb75383e4aad6d83418dde16c6cea6f5 16 0 8 des-ede +3ea71cd9a2e50d82d66b433e9471eeb2 16 8 1 des-ede-cfb +3d56b76d43dc8d51647773bc9719a355 16 8 1 des-ede-ofb +eafa89aae63167b9798639c0e31223b4 16 8 8 des-ede-cbc +a952f8c409fb0df75a7df1aa54ba30b8 24 0 8 des-ede3 +0badccc43a14d8503d33f32a2345bbd2 24 8 1 des-ede3-cfb +bae638c0e33850d02c792ed0e3d6b600 24 8 1 des-ede3-ofb +ec4522bbefabf0198126683e661325e2 24 8 8 des-ede3-cbc +4431f05d198d8afc003aeec85bea01b9 24 8 8 desx-cbc +606af8d6f30c1fd9c647df5eb716ae0f 16 0 1 rc4 +4aaaf7e4bc3fd2caa6318a4852f636f4 5 0 1 rc4-40 +77e0851e8c96c4a1e26140d1ec822036 16 0 8 idea-ecb +a28e51e283519fde0e128bcb697bc23e 16 8 1 idea-cfb +17d0e70f07de6c08e9673d52987599ab 16 8 1 idea-ofb +0687cf6ca11ee45f8bf9c29525405a4d 16 8 8 idea-cbc +e2268681a63198fe38282b0a1bb6ed36 16 0 8 rc2-ecb +f48748e6386790e639bbee4fccaa5067 16 8 8 rc2-cbc +f250cfe829ef797d6866e32526ec4fe4 5 8 8 rc2-40-cbc +a372f970b6c346341a2899bb872a7349 16 8 1 rc2-cfb +d2da66102dea6b833f0fbf71e2cb4988 16 8 1 rc2-ofb +237b0ef0e4f7fb28a5708d59773caecf 16 0 8 bf-ecb +c58cf5da90472caf0f0b7fafb0590977 16 8 1 bf-cfb +1f3e49e2e27f9ad177a6a64b09d361ed 16 8 1 bf-ofb +66acaf2cb5f301580c59fa17d005b716 16 8 8 bf-cbc +3548c9fe9fcd13f647ae177a15915af9 16 0 8 cast5-ecb +e8d074ad8cc0d3d828da80ab18452f91 16 8 1 cast5-cfb +5331eb4351c2048c27c8a8901fd29e20 16 8 1 cast5-ofb +8033607fdb68598cc62c379af218eeeb 16 8 8 cast5-cbc +e3a6760eb5e79bf4063cf0791e99842d 16 0 8 rc5-ecb +2f5eab0d0992dcce8615a5a60966391a 16 8 1 rc5-cfb +c5893e49e73342db2957b83b70f23e27 16 8 1 rc5-ofb +683ce60c8b7bf028ec0d3dc0f018a1a4 16 8 8 rc5-cbc diff --git a/src/lib/libssl/src/perl/test2.pl b/src/lib/libssl/src/perl/test2.pl new file mode 100644 index 0000000000..2e1196c072 --- /dev/null +++ b/src/lib/libssl/src/perl/test2.pl @@ -0,0 +1,28 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +@md=(); +($c=SSLeay::Cipher::new("idea")) || + die "'des' is an unknown cipher algorithm\n"; + +printf "name =%s\n" ,$c->name(); +printf "key length=%2d\n",$c->key_length(); +printf "iv length =%2d\n",$c->iv_length(); +printf "block size=%2d\n",$c->block_size(); + +$data="1234"; +$c->init("01234567","abcdefgh",1); +$in=$c->update($data); +$in.=$c->final(); + +$c->init("01234567","abcdefgh",0); +$out=$c->update($in); +$out.=$c->final(); +print $data; +print " -> "; +print $out; +print "\n"; + diff --git a/src/lib/libssl/src/perl/test3.pl b/src/lib/libssl/src/perl/test3.pl new file mode 100644 index 0000000000..4102ab9297 --- /dev/null +++ b/src/lib/libssl/src/perl/test3.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +@md=(); +($c=SSLeay::Cipher::new("idea")) || + die "'des' is an unknown cipher algorithm\n"; + +$key=" "; +$iv=" "; +$c->init($key,$iv,0); +while (<>) + { + print $c->update($_); + } +print $c->final(); + diff --git a/src/lib/libssl/src/perl/test8.pl b/src/lib/libssl/src/perl/test8.pl new file mode 100644 index 0000000000..c144f7f136 --- /dev/null +++ b/src/lib/libssl/src/perl/test8.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +# 2687145 * 3003 * 10^5072 - 1. + +$a=SSLeay::BN::set_word(99); +$b=SSLeay::BN::set_word(100); + +$aa=$a->dup; +$bb=$b->dup; + +$c=$a*$b; +$bb+=$a; + +print "$a*$b=$c\n"; +print "$bb\n"; diff --git a/src/lib/libssl/src/perl/test9.pl b/src/lib/libssl/src/perl/test9.pl new file mode 100644 index 0000000000..cc710c310e --- /dev/null +++ b/src/lib/libssl/src/perl/test9.pl @@ -0,0 +1,38 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +# 2687145 * 3003 * 10^5072 - 1. + +$a=SSLeay::BN::set_word(2687145); +$b=SSLeay::BN::set_word(3003); +$c=SSLeay::BN::set_word(10); +$d=SSLeay::BN::set_word(5072); +$e=SSLeay::BN::set_word(1); + +print $a->bn2hex()."\n"; +print $b->bn2hex()."\n"; +print $c->bn2hex()."\n"; +print $d->bn2hex()."\n"; +print $e->bn2hex()."\n"; + +$f=(($a->mul($b)->mul($c->exp($d)))->sub($e)); +#print "$a $b\n"; + +$c=$a->mul($b); +print "1->".$c->bn2hex()." \n"; + +$c=$a*$b; +print "2->".$c->bn2hex()." \n"; +$a*=$b; +print "3->$a\n"; + +print $f->bn2hex()." $a\n"; +print $a."\n"; + +print "$a=(($b*$c)/$d);\n"; +$a=(($b*$c)/$d); +print "$a\n"; + diff --git a/src/lib/libssl/src/perl/testbn.pl b/src/lib/libssl/src/perl/testbn.pl new file mode 100644 index 0000000000..3062439563 --- /dev/null +++ b/src/lib/libssl/src/perl/testbn.pl @@ -0,0 +1,23 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$num ="a43f6a8885a308d313198a2e03707344a4093822"; +$num.="299f31d0082efa98ec4e6c89452821e638d01377"; +$num.="be5466cf34e90c6cc0ac29b7c97c50dd3f84d5b5"; +$num.="b54709179216d5d98979fb1bd1310ba698dfb5ac"; +$num.="2ffd72dbd01adfb7b8e1afed6a267e96ba7c9045"; +$num.="f12c7f9924a19947b3916cf70801f2e2858efc16"; +$num.="636920d871574e69a458fea3f4933d7e0d95748f"; +$num.="728eb658718bcd5882154aee7b54a41dc25a59b5"; +$num.="9c30d5392af26013c5d1b023286085f0ca417918"; +$num.="b8db38ef8e79dcb0603a180e6c9e0e8bb01e8a3e"; +$num.="d71577c1bd314b2778af2fda55605c60e65525f3"; +$num.="aa55ab945748986263e8144055ca396a2aab10b6"; +$num.="b4cc5c341141e8cea15486af7c8f14a7"; + +$a=SSLeay::BN::hex2bn($num); +print "num bits =".$a->num_bits."\n"; +print $a->is_prime(50,sub {print STDERR $_[0]?"+":"."})."\n"; diff --git a/src/lib/libssl/src/perl/testdec.pl b/src/lib/libssl/src/perl/testdec.pl new file mode 100644 index 0000000000..0dce3f8e79 --- /dev/null +++ b/src/lib/libssl/src/perl/testdec.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$a=SSLeay::BN::dec2bn("1234"); + +foreach (1..4) + { + $a*=$a; + print $a."\n",$a->bn2dec()."\n"; + } + diff --git a/src/lib/libssl/src/perl/testmd.pl b/src/lib/libssl/src/perl/testmd.pl new file mode 100644 index 0000000000..6549166c8a --- /dev/null +++ b/src/lib/libssl/src/perl/testmd.pl @@ -0,0 +1,26 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +@md=(); +foreach ("md2", "md5", "sha", "sha1", "mdc2", "ripemd160") + { + ($f=MD->new($_)) || + die "$_ is an unknown message digest algorithm\n"; + push(@md,$f); + } + +while (<>) + { + foreach $md (@md) + { $md->update($_); } + } + +foreach (@md) + { + $digest=$_->final(); + printf "%-4s=%s\n",$_->name(),unpack("H*",$digest); + } + diff --git a/src/lib/libssl/src/perl/tt.pl b/src/lib/libssl/src/perl/tt.pl new file mode 100644 index 0000000000..80ec88b2a8 --- /dev/null +++ b/src/lib/libssl/src/perl/tt.pl @@ -0,0 +1,15 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +for ($i=1; $i<1000; $i++) + { + $a.=$i%10; + $y=SSLeay::BN::dec2bn($a); + $z=SSLeay::BN::bn2dec($y); + + print "$a\n$y\n$z\n"; + } + diff --git a/src/lib/libssl/src/perl/typemap b/src/lib/libssl/src/perl/typemap new file mode 100644 index 0000000000..5226fbc369 --- /dev/null +++ b/src/lib/libssl/src/perl/typemap @@ -0,0 +1,96 @@ + +datum T_DATUM +EVP_MD_CTX * T_MD_CTX +EVP_CIPHER_CTX * T_CIPHER_CTX +BIGNUM * T_BIGNUM +SSL_METHOD * T_SSL_METHOD +SSL_CTX * T_SSL_CTX +SSL_CIPHER * T_SSL_CIPHER +SSL * T_SSL +BIO * T_BIO +X509 * T_X509 + +INPUT +T_DATUM + $var.dptr=SvPV($arg,$var.dsize); +T_MD_CTX + if (sv_derived_from($arg, \"SSLeay::MD\")) { + IV tmp = SvIV((SV*)SvRV($arg)); + $var = (EVP_MD_CTX *) tmp; + } + else + croak(\"$var is not of type SSLeay::MD\") +T_CIPHER_CTX + if (sv_derived_from($arg, \"SSLeay::Cipher\")) { + IV tmp = SvIV((SV*)SvRV($arg)); + $var = (EVP_CIPHER_CTX *) tmp; + } + else + croak(\"$var is not of type SSLeay::Cipher\") +T_BIGNUM + sv_to_BIGNUM(&($var),$arg,\"$var is not of type SSLeay::MD, int or string\") +T_SSL_METHOD + if (sv_derived_from($arg, \"SSLeay::SSL::METHOD\")) { + IV tmp = SvIV((SV*)SvRV($arg)); + $var = (SSL_METHOD *) tmp; + } + else + croak(\"$var is not of type SSLeay::SSL::METHOD\") +T_SSL_CTX + if (sv_derived_from($arg, \"SSLeay::SSL::CTX\")) { + IV tmp = SvIV((SV*)SvRV($arg)); + $var = (SSL_CTX *) tmp; + } + else + croak(\"$var is not of type SSLeay::SSL::CTX\") +T_SSL_CIPHER + if (sv_derived_from($arg, \"SSLeay::SSL::CIPHER\")) { + IV tmp = SvIV((SV*)SvRV($arg)); + $var = (SSL_CIPHER *) tmp; + } + else + croak(\"$var is not of type SSLeay::SSL::CIPHER\") +T_SSL + if (sv_derived_from($arg, \"SSLeay::SSL\")) { + IV tmp = SvIV((SV*)SvRV($arg)); + $var = (SSL *) tmp; + } + else + croak(\"$var is not of type SSLeay::SSL\") +T_BIO + if (sv_derived_from($arg, \"SSLeay::BIO\")) { + IV tmp = SvIV((SV*)SvRV($arg)); + $var = (BIO *) tmp; + } + else + croak(\"$var is not of type SSLeay::BIO\") +T_X509 + if (sv_derived_from($arg, \"SSLeay::X509\")) { + IV tmp = SvIV((SV*)SvRV($arg)); + $var = (X509 *) tmp; + } + else + croak(\"$var is not of type SSLeay::X509\") +OUTPUT +T_DATUM + sv_setpvn($arg,$var.dptr,$var.dsize); +T_MD_CTX + sv_setref_pv($arg, \"SSLeay::MD\", (void*)$var); +T_CIPHER_CTX + sv_setref_pv($arg, \"SSLeay::Cipher\", (void*)$var); +T_BIGNUM + sv_setref_pv($arg, \"SSLeay::BN\", (void*)$var); +T_SSL_METHOD + sv_setref_pv($arg, \"SSLeay::SSL::METHOD\", (void*)$var); +T_SSL_CTX + sv_setref_pv($arg, \"SSLeay::SSL::CTX\", (void*)$var); +T_SSL_CIPHER + sv_setref_pv($arg, \"SSLeay::SSL::CIPHER\", (void*)$var); +T_SSL + sv_setref_pv($arg, \"SSLeay::SSL\", (void*)$var); +T_BIO + sv_setref_pv($arg, \"SSLeay::BIO\", (void*)$var); +T_X509 + sv_setref_pv($arg, \"SSLeay::X509\", (void*)$var); + + diff --git a/src/lib/libssl/src/perl/x509.txt b/src/lib/libssl/src/perl/x509.txt new file mode 100644 index 0000000000..8468eff512 --- /dev/null +++ b/src/lib/libssl/src/perl/x509.txt @@ -0,0 +1,6 @@ +X509::new() + +X509::get_verson() +X509::get_serial_number() +X509::get_subject_name() +X509::get_issuer_name() diff --git a/src/lib/libssl/src/perl/x509.xs b/src/lib/libssl/src/perl/x509.xs new file mode 100644 index 0000000000..67633ad225 --- /dev/null +++ b/src/lib/libssl/src/perl/x509.xs @@ -0,0 +1,74 @@ +#include "p5SSLeay.h" + +MODULE = SSLeay::X509 PACKAGE = SSLeay::X509 PREFIX = p5_X509_ + +PROTOTYPES: ENABLE +VERSIONCHECK: DISABLE + +void +p5_X509_new(void ) + PREINIT: + X509 *x509; + SV *arg; + PPCODE: + pr_name("p5_X509_new"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + x509=X509_new(); + sv_setref_pv(ST(0),"SSLeay::X509",(void *)x509); + +char * +p5_X509_get_subject_name(x509) + X509 *x509; + PREINIT: + char *p; + X509_NAME *name; + char buf[1024]; + int i; + CODE: + name=X509_get_subject_name(x509); + X509_NAME_oneline(name,buf,sizeof(buf)); + p= &(buf[0]); + RETVAL=p; + OUTPUT: + RETVAL + +char * +p5_X509_get_issuer_name(x509) + X509 *x509; + PREINIT: + char *p; + X509_NAME *name; + char buf[1024]; + int i; + CODE: + name=X509_get_issuer_name(x509); + X509_NAME_oneline(name,buf,sizeof(buf)); + p= &(buf[0]); + RETVAL=p; + OUTPUT: + RETVAL + +int +p5_X509_get_version(x509) + X509 *x509; + CODE: + RETVAL=X509_get_version(x509); + OUTPUT: + RETVAL + +BIGNUM * +p5_X509_get_serialNumber(x509) + X509 *x509; + CODE: + RETVAL=ASN1_INTEGER_to_BN(X509_get_serialNumber(x509),NULL); + OUTPUT: + RETVAL + +void +p5_X509_DESTROY(x509) + X509 *x509; + CODE: + pr_name("p5_X509_DESTROY"); + X509_free(x509); + diff --git a/src/lib/libssl/src/perl/xstmp.c b/src/lib/libssl/src/perl/xstmp.c new file mode 100644 index 0000000000..aa18959017 --- /dev/null +++ b/src/lib/libssl/src/perl/xstmp.c @@ -0,0 +1,102 @@ +/* perl/xstmp.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* + * This file was generated automatically by xsubpp version 1.9402 from the + * contents of SSLeay.xs. Do not edit this file, edit SSLeay.xs instead. + * + * ANY CHANGES MADE HERE WILL BE LOST! + * + */ + +#line 1 "SSLeay.xs" +#ifdef __cplusplus +extern "C" { +#endif +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" +#ifdef __cplusplus +} +#endif + +typedef struct datum_st + { + char *dptr; + int dsize; + } datum; + +#include "crypto.h" +#include "buffer.h" +#include "bio.h" +#include "evp.h" +#include "err.h" +#include "x509.h" +#include "ssl.h" + +#if 0 +#define pr_name(name) printf("%s\n",name) +#define pr_name_d(name,p2) printf("%s %d\n",name,p2) +#define pr_name_dd(name,p2,p3) printf("%s %d %d\n",name,p2,p3) +#else +#define pr_name(name) +#define pr_name_d(name,p2) +#define pr_name_dd(name,p2,p3) +#endif + +#include "callback.c" + diff --git a/src/lib/libssl/src/perl/y.pl b/src/lib/libssl/src/perl/y.pl new file mode 100644 index 0000000000..fe608a6724 --- /dev/null +++ b/src/lib/libssl/src/perl/y.pl @@ -0,0 +1,7 @@ +#!/usr/bin/perl +use ExtUtils::testlib; +use SSLeay; + +$message=SSLeay::BN::dec2bn("936345681743241125150760694794510965960940252288797108931456691368672287489405603308617928680920874760917824938589009714909675985261365549781893129784821682998948722"); + +print $message->bn2hex."\n"; diff --git a/src/lib/libssl/src/perl/yy.pl b/src/lib/libssl/src/perl/yy.pl new file mode 100644 index 0000000000..2e00edb3e9 --- /dev/null +++ b/src/lib/libssl/src/perl/yy.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$a=SSLeay::BN::new(); + +$a+="1234567"; + +print $a->bn2hex()."\n"; + + +for (1 .. 20) + { + $a*=$a; + $b=$a->bn2hex(); + print " ".$b."\n".length($b)."\n"; + } diff --git a/src/lib/libssl/src/perl/z.pl b/src/lib/libssl/src/perl/z.pl new file mode 100644 index 0000000000..7e2d5285cc --- /dev/null +++ b/src/lib/libssl/src/perl/z.pl @@ -0,0 +1,32 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; +use Benchmark; + +$buf=('x' x (1024*1024)); +$buf=('x' x (1024*1024)); + +@md=(); +foreach $name ("md2", "mdc2", "sha", "ripemd160", "sha1", "md5") + { + if (($name eq "md2") || ($name eq "mdc2")) + { $num=5; } + else { $num=100; } + + $t=timeit($num,'&hash($name)'); + printf "%6d000 bytes/sec:$name\n",int(($num*1024*1024)/$t->[1]/1000); + } + +sub hash + { + my($name)=@_; + my($f,$digest); + + ($f=MD->new($name)) || + die "$_ is an unknown message digest algorithm\n"; + $f->update($buf); + $digest=$f->final(); + } + diff --git a/src/lib/libssl/src/perl/zz.pl b/src/lib/libssl/src/perl/zz.pl new file mode 100644 index 0000000000..38866c9227 --- /dev/null +++ b/src/lib/libssl/src/perl/zz.pl @@ -0,0 +1,22 @@ +#!/usr/bin/perl +use ExtUtils::testlib; +use SSLeay; + +$a=SSLeay::BN::dec2bn("12345678901234567890"); +$b=SSLeay::BN::dec2bn("98765432109876543210"); +print "a=$a\n"; +print "b=$b\n"; + +$n=$a*$b; +$m=$n+"1223123235345634764534567889"; +$l=$m*88888888; + +$r=$l/$b; + +print "a=$a\n"; +print "b=$b\n"; +print "n=$n\n"; +print "m=$m\n"; +print "l=$l\n"; +print "r=$r\n"; + diff --git a/src/lib/libssl/src/shlib/linux.sh b/src/lib/libssl/src/shlib/linux.sh new file mode 100644 index 0000000000..f80292d90c --- /dev/null +++ b/src/lib/libssl/src/shlib/linux.sh @@ -0,0 +1,76 @@ +#!/bin/sh + +echo "#define DATE \"`date`\"" >crypto/date.h + +major="0" +minor="8.2" +slib=libssl +clib=libcrypto +CC=gcc +CPP='gcc -E' +AS=as +FLAGS='-DX86_ASM -DTERMIO -O3 -DL_ENDIAN -fomit-frame-pointer -m486 -Wall' +#FLAGS='-DTERMIO -g2 -ggdb -DL_ENDIAN -m486 -Wall -DREF_CHECK -DCRYPTO_MDEBUG' +INCLUDE='-Iinclude -Icrypto -Issl' +SHFLAGS='-DPIC -fpic' + +CFLAGS="$FLAGS $INCLUDE $SHFLAGS" +ASM_OBJ=""; + +echo compiling bignum assember +$CPP -DELF crypto/bn/asm/bn86unix.cpp | $AS -o bn_asm.o +CFLAGS="$CFLAGS -DBN_ASM -DX86_ASM" +ASM_OBJ="$ASM_OBJ bn_asm.o" + +echo compiling des assember +$CPP -DELF crypto/des/asm/dx86unix.cpp | $AS -o des_enc.o +$CPP -DELF crypto/des/asm/yx86unix.cpp | $AS -o fcrypt-b.o +CFLAGS="$CFLAGS -DDES_ASM" +ASM_OBJ="$ASM_OBJ des_enc.o fcrypt-b.o" + +echo compiling blowfish assember +$CPP -DELF crypto/bf/asm/bx86unix.cpp | $AS -o bf_enc.o +CFLAGS="$CFLAGS -DBF_ASM" +ASM_OBJ="$ASM_OBJ bf_enc.o" + +echo compiling cast assember +$CPP -DELF crypto/cast/asm/cx86unix.cpp | $AS -o cast_enc.o +CFLAGS="$CFLAGS -DCAST_ASM" +ASM_OBJ="$ASM_OBJ cast_enc.o" + +echo compiling rc4 assember +$CPP -DELF crypto/rc4/asm/rx86unix.cpp | $AS -o rc4_enc.o +CFLAGS="$CFLAGS -DRC4_ASM" +ASM_OBJ="$ASM_OBJ rc4_enc.o" + +echo compiling md5 assember +$CPP -DELF crypto/md5/asm/mx86unix.cpp | $AS -o md5_enc.o +CFLAGS="$CFLAGS -DMD5_ASM" +ASM_OBJ="$ASM_OBJ md5_enc.o" + +echo compiling sha1 assember +$CPP -DELF crypto/sha/asm/sx86unix.cpp | $AS -o sha1_enc.o +CFLAGS="$CFLAGS -DSHA1_ASM" +ASM_OBJ="$ASM_OBJ sha1_enc.o" + +echo compiling $clib +$CC -c $CFLAGS -DCFLAGS="\"$FLAGS\"" -o crypto.o crypto/crypto.c + +echo linking $clib.so +gcc $CFLAGS -shared -Wl,-soname,$clib.so.$major -o $clib.so.$major.$minor crypto.o $ASM_OBJ +/bin/rm -f $clib.so $clib.so.$major +ln -s $clib.so.$major.$minor $clib.so +ln -s $clib.so.$major.$minor $clib.so.$major + +echo compiling $slib.so +$CC -c $CFLAGS -o ssl.o ssl/ssl.c + +echo building $slib.so +gcc $CFLAGS -shared -Wl,-soname,$slib.so.$major -o $slib.so.$major.$minor ssl.o +/bin/rm -f $slib.so $slib.so.$major +ln -s $slib.so.$major.$minor $slib.so +ln -s $slib.so.$major.$minor $slib.so.$major + +echo building ssleay executable +gcc $CFLAGS -o ssleay apps/eay.c -L. -lssl -lcrypto + diff --git a/src/lib/libssl/src/ssl/readme b/src/lib/libssl/src/ssl/readme new file mode 100644 index 0000000000..ca174848a1 --- /dev/null +++ b/src/lib/libssl/src/ssl/readme @@ -0,0 +1,277 @@ +22 Jun 1996 +This file belongs in ../apps, but I'll leave it here because it deals +with SSL :-) It is rather dated but it gives you an idea of how +things work. +=== + +17 Jul 1995 +I have been changing things quite a bit and have not fully updated +this file, so take what you read with a grain of salt +eric +=== +The s_client and s_server programs can be used to test SSL capable +IP/port addresses and the verification of the X509 certificates in use +by these services. I strongly advise having a look at the code to get +an idea of how to use the authentication under SSLeay. Any feedback +on changes and improvements would be greatly accepted. + +This file will probably be gibberish unless you have read +rfc1421, rfc1422, rfc1423 and rfc1424 which describe PEM +authentication. + +A Brief outline (and examples) how to use them to do so. + +NOTE: +The environment variable SSL_CIPER is used to specify the prefered +cipher to use, play around with setting it's value to combinations of +RC4-MD5, EXP-RC4-MD5, CBC-DES-MD5, CBC3-DES-MD5, CFB-DES-NULL +in a : separated list. + +This directory contains 3 X509 certificates which can be used by these programs. +client.pem: a file containing a certificate and private key to be used + by s_client. +server.pem :a file containing a certificate and private key to be used + by s_server. +eay1024.pem:the certificate used to sign client.pem and server.pem. + This would be your CA's certificate. There is also a link + from the file a8556381.0 to eay1024.PEM. The value a8556381 + is returned by 'x509 -hash -noout <eay1024.pem' and is the + value used by X509 verification routines to 'find' this + certificte when search a directory for it. + [the above is not true any more, the CA cert is + ../certs/testca.pem which is signed by ../certs/mincomca.pem] + +When testing the s_server, you may get +bind: Address already in use +errors. These indicate the port is still being held by the unix +kernel and you are going to have to wait for it to let go of it. If +this is the case, remember to use the port commands on the s_server and +s_client to talk on an alternative port. + +===== +s_client. +This program can be used to connect to any IP/hostname:port that is +talking SSL. Once connected, it will attempt to authenticate the +certificate it was passed and if everything works as expected, a 2 +directional channel will be open. Any text typed will be sent to the +other end. type Q<cr> to exit. Flags are as follows. +-host arg : Arg is the host or IP address to connect to. +-port arg : Arg is the port to connect to (https is 443). +-verify arg : Turn on authentication of the server certificate. + : Arg specifies the 'depth', this will covered below. +-cert arg : The optional certificate to use. This certificate + : will be returned to the server if the server + : requests it for client authentication. +-key arg : The private key that matches the certificate + : specified by the -cert option. If this is not + : specified (but -cert is), the -cert file will be + : searched for the Private key. Both files are + : assumed to be in PEM format. +-CApath arg : When to look for certificates when 'verifying' the + : certificate from the server. +-CAfile arg : A file containing certificates to be used for + : 'verifying' the server certificate. +-reconnect : Once a connection has been made, drop it and + : reconnect with same session-id. This is for testing :-). + +The '-verify n' parameter specifies not only to verify the servers +certificate but to also only take notice of 'n' levels. The best way +to explain is to show via examples. +Given +s_server -cert server.PEM is running. + +s_client + CONNECTED + depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server + issuer= /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA + verify error:num=1:unable to get issuer certificate + verify return:1 + CIPHER is CBC-DES-MD5 +What has happened is that the 'SSLeay demo server' certificate's +issuer ('CA') could not be found but because verify is not on, we +don't care and the connection has been made anyway. It is now 'up' +using CBC-DES-MD5 mode. This is an unauthenticate secure channel. +You may not be talking to the right person but the data going to them +is encrypted. + +s_client -verify 0 + CONNECTED + depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server + issuer= /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA + verify error:num=1:unable to get issuer certificate + verify return:1 + CIPHER is CBC-DES-MD5 +We are 'verifying' but only to depth 0, so since the 'SSLeay demo server' +certificate passed the date and checksum, we are happy to proceed. + +s_client -verify 1 + CONNECTED + depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server + issuer= /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA + verify error:num=1:unable to get issuer certificate + verify return:0 + ERROR + verify error:unable to get issuer certificate +In this case we failed to make the connection because we could not +authenticate the certificate because we could not find the +'CA' certificate. + +s_client -verify 1 -CAfile eay1024.PEM + CONNECTED + depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server + verify return:1 + depth=1 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA + verify return:1 + CIPHER is CBC-DES-MD5 +We loaded the certificates from the file eay1024.PEM. Everything +checked out and so we made the connection. + +s_client -verify 1 -CApath . + CONNECTED + depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server + verify return:1 + depth=1 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA + verify return:1 + CIPHER is CBC-DES-MD5 +We looked in out local directory for issuer certificates and 'found' +a8556381.0 and so everything is ok. + +It is worth noting that 'CA' is a self certified certificate. If you +are passed one of these, it will fail to 'verify' at depth 0 because +we need to lookup the certifier of a certificate from some information +that we trust and keep locally. + +SSL_CIPHER=CBC3-DES-MD5:RC4-MD5 +export SSL_CIPHER +s_client -verify 10 -CApath . -reconnect + CONNECTED + depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server + verify return:1 + depth=1 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA + verify return:1 + drop the connection and reconnect with the same session id + CIPHER is CBC3-DES-MD5 +This has done a full connection and then re-estabished it with the +same session id but a new socket. No RSA stuff occures on the second +connection. Note that we said we would prefer to use CBC3-DES-MD5 +encryption and so, since the server supports it, we are. + +===== +s_server +This program accepts SSL connections on a specified port +Once connected, it will estabish an SSL connection and optionaly +attempt to authenticate the client. A 2 directional channel will be +open. Any text typed will be sent to the other end. Type Q<cr> to exit. +Flags are as follows. +-port arg : Arg is the port to listen on. +-verify arg : Turn on authentication of the client if they have a + : certificate. Arg specifies the 'depth'. +-Verify arg : Turn on authentication of the client. If they don't + : have a valid certificate, drop the connection. +-cert arg : The certificate to use. This certificate + : will be passed to the client. If it is not + : specified, it will default to server.PEM +-key arg : The private key that matches the certificate + : specified by the -cert option. If this is not + : specified (but -cert is), the -cert file will be + : searched for the Private key. Both files are + : assumed to be in PEM format. Default is server.PEM +-CApath arg : When to look for certificates when 'verifying' the + : certificate from the client. +-CAfile arg : A file containing certificates to be used for + : 'verifying' the client certificate. + +For the following 'demo' I will specify the s_server command and +the s_client command and then list the output from the s_server. +s_server +s_client + CONNECTED + CIPHER is CBC-DES-MD5 +Everything up and running + +s_server -verify 0 +s_client + CONNECTED + CIPHER is CBC-DES-MD5 +Ok since no certificate was returned and we don't care. + +s_server -verify 0 +./s_client -cert client.PEM + CONNECTED + depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo client + issuer= /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA + verify error:num=1:unable to get issuer certificate + verify return:1 + CIPHER is CBC-DES-MD5 +Ok since we were only verifying to level 0 + +s_server -verify 4 +s_client -cert client.PEM + CONNECTED + depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo client + issuer= /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA + verify error:num=1:unable to get issuer certificate + verify return:0 + ERROR + verify error:unable to get issuer certificate +Bad because we could not authenticate the returned certificate. + +s_server -verify 4 -CApath . +s_client -cert client.PEM + CONNECTED + depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo client + verify return:1 + depth=1 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA + verify return:1 + CIPHER is CBC-DES-MD5 +Ok because we could authenticate the returned certificate :-). + +s_server -Verify 0 -CApath . +s_client + CONNECTED + ERROR + SSL error:function is:REQUEST_CERTIFICATE + :error is :client end did not return a certificate +Error because no certificate returned. + +s_server -Verify 4 -CApath . +s_client -cert client.PEM + CONNECTED + depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo client + verify return:1 + depth=1 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA + verify return:1 + CIPHER is CBC-DES-MD5 +Full authentication of the client. + +So in summary to do full authentication of both ends +s_server -Verify 9 -CApath . +s_client -cert client.PEM -CApath . -verify 9 +From the server side + CONNECTED + depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo client + verify return:1 + depth=1 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA + verify return:1 + CIPHER is CBC-DES-MD5 +From the client side + CONNECTED + depth=0 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server + verify return:1 + depth=1 /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA + verify return:1 + CIPHER is CBC-DES-MD5 + +For general probing of the 'internet https' servers for the +distribution area, run +s_client -host www.netscape.com -port 443 -verify 4 -CApath ../rsa/hash +Then enter +GET / +and you should be talking to the https server on that host. + +www.rsa.com was refusing to respond to connections on 443 when I was +testing. + +have fun :-). + +eric diff --git a/src/lib/libssl/src/ssl/ssl.c b/src/lib/libssl/src/ssl/ssl.c new file mode 100644 index 0000000000..7f506ce48f --- /dev/null +++ b/src/lib/libssl/src/ssl/ssl.c @@ -0,0 +1,172 @@ +/* ssl/ssl.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define USE_SOCKETS +#include "../e_os.h" + +#include "buffer.h" +#include "stack.h" +#include "lhash.h" + +#include "bio.h" +#include "err.h" + +#include "bn.h" + +#include "rand.h" +#include "conf.h" +#include "txt_db.h" + +#include "err.h" +#include "evp.h" + +#include "x509.h" +#include "pkcs7.h" +#include "pem.h" +#include "asn1.h" +#include "objects.h" + +#include "ssl_locl.h" + +#if !(BUILD_SSLV23) && !defined(BUILD_SSLV2) && !defined(BUILD_SSLV3) && !defined(BUILD_SSL_COMMON) && !defined(BUILD_SSL_BIO) && !defined(BUILD_SSL_OPTIONAL) +#define BUILD_SSLV23 +#define BUILD_SSLV2 +#define BUILD_SSLV3 +#define BUILD_TLS1 +#define BUILD_SSL_COMMON +#define BUILD_SSL_BIO +#define BUILD_SSL_OPTIONAL +#endif + +#ifdef NO_RSA +#undef BUILD_SSLV2 +#undef BUILD_SSLV23 +#endif + +#ifdef NO_SSL2 +#undef BUILD_SSLV2 +#undef BUILD_SSLV23 +#endif + +#ifdef NO_SSL3 +#undef BUILD_SSL3 +#undef BUILD_SSLV23 +#endif + +#ifdef BUILD_SSLV23 +#include "s23_clnt.c" +#include "s23_srvr.c" +#include "s23_pkt.c" +#include "s23_lib.c" +#include "s23_meth.c" +#endif + +#ifdef BUILD_SSLV2 +#include "s2_clnt.c" +#include "s2_srvr.c" +#include "s2_pkt.c" +#include "s2_enc.c" +#include "s2_lib.c" +#include "s2_meth.c" +#endif + +#ifdef BUILD_SSLV3 +#include "s3_clnt.c" +#include "s3_both.c" +#include "s3_srvr.c" +#include "s3_pkt.c" +#include "s3_enc.c" +#include "s3_lib.c" +#include "s3_meth.c" +#endif + +#ifdef BUILD_TLS1 +#include "t1_clnt.c" +#include "t1_enc.c" +#include "t1_lib.c" +#include "t1_meth.c" +#include "t1_srvr.c" +#endif + + +#ifdef BUILD_SSL_COMMON +#include "ssl_lib.c" +#include "ssl_algs.c" +#include "ssl_cert.c" +#include "ssl_ciph.c" +#include "ssl_sess.c" +#include "ssl_rsa.c" +#endif + +/* Extra things */ +#ifdef BUILD_SSL_BIO +#include "bio_ssl.c" +#endif + +#ifdef BUILD_SSL_OPTIONAL +#include "ssl_asn1.c" +#include "ssl_txt.c" +#include "ssl_stat.c" +#include "ssl_err.c" +#include "ssl_err2.c" +#endif + diff --git a/src/lib/libssl/src/ssl/ssl.err b/src/lib/libssl/src/ssl/ssl.err new file mode 100644 index 0000000000..c54326c624 --- /dev/null +++ b/src/lib/libssl/src/ssl/ssl.err @@ -0,0 +1,290 @@ +/* Error codes for the SSL functions. */ + +/* Function codes. */ +#define SSL_F_CLIENT_CERTIFICATE 100 +#define SSL_F_CLIENT_HELLO 101 +#define SSL_F_CLIENT_MASTER_KEY 102 +#define SSL_F_D2I_SSL_SESSION 103 +#define SSL_F_DO_SSL3_WRITE 104 +#define SSL_F_GET_CLIENT_FINISHED 105 +#define SSL_F_GET_CLIENT_HELLO 106 +#define SSL_F_GET_CLIENT_MASTER_KEY 107 +#define SSL_F_GET_SERVER_FINISHED 108 +#define SSL_F_GET_SERVER_HELLO 109 +#define SSL_F_GET_SERVER_VERIFY 110 +#define SSL_F_I2D_SSL_SESSION 111 +#define SSL_F_READ_N 112 +#define SSL_F_REQUEST_CERTIFICATE 113 +#define SSL_F_SERVER_HELLO 114 +#define SSL_F_SSL23_ACCEPT 115 +#define SSL_F_SSL23_CLIENT_HELLO 116 +#define SSL_F_SSL23_CONNECT 117 +#define SSL_F_SSL23_GET_CLIENT_HELLO 118 +#define SSL_F_SSL23_GET_SERVER_HELLO 119 +#define SSL_F_SSL23_READ 120 +#define SSL_F_SSL23_WRITE 121 +#define SSL_F_SSL2_ACCEPT 122 +#define SSL_F_SSL2_CONNECT 123 +#define SSL_F_SSL2_ENC_INIT 124 +#define SSL_F_SSL2_READ 125 +#define SSL_F_SSL2_SET_CERTIFICATE 126 +#define SSL_F_SSL2_WRITE 127 +#define SSL_F_SSL3_ACCEPT 128 +#define SSL_F_SSL3_CHANGE_CIPHER_STATE 129 +#define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 130 +#define SSL_F_SSL3_CLIENT_HELLO 131 +#define SSL_F_SSL3_CONNECT 132 +#define SSL_F_SSL3_CTX_CTRL 133 +#define SSL_F_SSL3_ENC 134 +#define SSL_F_SSL3_GET_CERTIFICATE_REQUEST 135 +#define SSL_F_SSL3_GET_CERT_VERIFY 136 +#define SSL_F_SSL3_GET_CLIENT_CERTIFICATE 137 +#define SSL_F_SSL3_GET_CLIENT_HELLO 138 +#define SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE 139 +#define SSL_F_SSL3_GET_FINISHED 140 +#define SSL_F_SSL3_GET_KEY_EXCHANGE 141 +#define SSL_F_SSL3_GET_MESSAGE 142 +#define SSL_F_SSL3_GET_RECORD 143 +#define SSL_F_SSL3_GET_SERVER_CERTIFICATE 144 +#define SSL_F_SSL3_GET_SERVER_DONE 145 +#define SSL_F_SSL3_GET_SERVER_HELLO 146 +#define SSL_F_SSL3_OUTPUT_CERT_CHAIN 147 +#define SSL_F_SSL3_READ_BYTES 148 +#define SSL_F_SSL3_READ_N 149 +#define SSL_F_SSL3_SEND_CERTIFICATE_REQUEST 150 +#define SSL_F_SSL3_SEND_CLIENT_CERTIFICATE 151 +#define SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE 152 +#define SSL_F_SSL3_SEND_CLIENT_VERIFY 153 +#define SSL_F_SSL3_SEND_SERVER_CERTIFICATE 154 +#define SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE 155 +#define SSL_F_SSL3_SETUP_BUFFERS 156 +#define SSL_F_SSL3_SETUP_KEY_BLOCK 157 +#define SSL_F_SSL3_WRITE_BYTES 158 +#define SSL_F_SSL3_WRITE_PENDING 159 +#define SSL_F_SSL_BAD_METHOD 160 +#define SSL_F_SSL_BYTES_TO_CIPHER_LIST 161 +#define SSL_F_SSL_CERT_NEW 162 +#define SSL_F_SSL_CHECK_PRIVATE_KEY 163 +#define SSL_F_SSL_CREATE_CIPHER_LIST 164 +#define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 165 +#define SSL_F_SSL_CTX_NEW 166 +#define SSL_F_SSL_CTX_SET_SSL_VERSION 167 +#define SSL_F_SSL_CTX_USE_CERTIFICATE 168 +#define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1 169 +#define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE 170 +#define SSL_F_SSL_CTX_USE_PRIVATEKEY 171 +#define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 172 +#define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE 173 +#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY 174 +#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1 175 +#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE 176 +#define SSL_F_SSL_DO_HANDSHAKE 177 +#define SSL_F_SSL_GET_NEW_SESSION 178 +#define SSL_F_SSL_GET_SERVER_SEND_CERT 179 +#define SSL_F_SSL_GET_SIGN_PKEY 180 +#define SSL_F_SSL_INIT_WBIO_BUFFER 181 +#define SSL_F_SSL_LOAD_CLIENT_CA_FILE 182 +#define SSL_F_SSL_NEW 183 +#define SSL_F_SSL_RSA_PRIVATE_DECRYPT 184 +#define SSL_F_SSL_RSA_PUBLIC_ENCRYPT 185 +#define SSL_F_SSL_SESSION_NEW 186 +#define SSL_F_SSL_SESSION_PRINT_FP 187 +#define SSL_F_SSL_SET_CERT 188 +#define SSL_F_SSL_SET_FD 189 +#define SSL_F_SSL_SET_PKEY 190 +#define SSL_F_SSL_SET_RFD 191 +#define SSL_F_SSL_SET_SESSION 192 +#define SSL_F_SSL_SET_WFD 193 +#define SSL_F_SSL_UNDEFINED_FUNCTION 194 +#define SSL_F_SSL_USE_CERTIFICATE 195 +#define SSL_F_SSL_USE_CERTIFICATE_ASN1 196 +#define SSL_F_SSL_USE_CERTIFICATE_FILE 197 +#define SSL_F_SSL_USE_PRIVATEKEY 198 +#define SSL_F_SSL_USE_PRIVATEKEY_ASN1 199 +#define SSL_F_SSL_USE_PRIVATEKEY_FILE 200 +#define SSL_F_SSL_USE_RSAPRIVATEKEY 201 +#define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 202 +#define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE 203 +#define SSL_F_SSL_WRITE 204 +#define SSL_F_TLS1_CHANGE_CIPHER_STATE 205 +#define SSL_F_TLS1_ENC 206 +#define SSL_F_TLS1_SETUP_KEY_BLOCK 207 +#define SSL_F_WRITE_PENDING 208 + +/* Reason codes. */ +#define SSL_R_APP_DATA_IN_HANDSHAKE 100 +#define SSL_R_BAD_ALERT_RECORD 101 +#define SSL_R_BAD_AUTHENTICATION_TYPE 102 +#define SSL_R_BAD_CHANGE_CIPHER_SPEC 103 +#define SSL_R_BAD_CHECKSUM 104 +#define SSL_R_BAD_CLIENT_REQUEST 105 +#define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK 106 +#define SSL_R_BAD_DECOMPRESSION 107 +#define SSL_R_BAD_DH_G_LENGTH 108 +#define SSL_R_BAD_DH_PUB_KEY_LENGTH 109 +#define SSL_R_BAD_DH_P_LENGTH 110 +#define SSL_R_BAD_DIGEST_LENGTH 111 +#define SSL_R_BAD_DSA_SIGNATURE 112 +#define SSL_R_BAD_MAC_DECODE 113 +#define SSL_R_BAD_MESSAGE_TYPE 114 +#define SSL_R_BAD_PACKET_LENGTH 115 +#define SSL_R_BAD_PROTOCOL_VERSION_NUMBER 116 +#define SSL_R_BAD_RESPONSE_ARGUMENT 117 +#define SSL_R_BAD_RSA_DECRYPT 118 +#define SSL_R_BAD_RSA_ENCRYPT 119 +#define SSL_R_BAD_RSA_E_LENGTH 120 +#define SSL_R_BAD_RSA_MODULUS_LENGTH 121 +#define SSL_R_BAD_RSA_SIGNATURE 122 +#define SSL_R_BAD_SIGNATURE 123 +#define SSL_R_BAD_SSL_FILETYPE 124 +#define SSL_R_BAD_SSL_SESSION_ID_LENGTH 125 +#define SSL_R_BAD_STATE 126 +#define SSL_R_BAD_WRITE_RETRY 127 +#define SSL_R_BIO_NOT_SET 128 +#define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG 129 +#define SSL_R_BN_LIB 130 +#define SSL_R_CA_DN_LENGTH_MISMATCH 131 +#define SSL_R_CA_DN_TOO_LONG 132 +#define SSL_R_CCS_RECEIVED_EARLY 133 +#define SSL_R_CERTIFICATE_VERIFY_FAILED 134 +#define SSL_R_CERT_LENGTH_MISMATCH 135 +#define SSL_R_CHALLENGE_IS_DIFFERENT 136 +#define SSL_R_CIPHER_CODE_WRONG_LENGTH 137 +#define SSL_R_CIPHER_OR_HASH_UNAVAILABLE 138 +#define SSL_R_CIPHER_TABLE_SRC_ERROR 139 +#define SSL_R_COMPRESSED_LENGTH_TOO_LONG 140 +#define SSL_R_COMPRESSION_FAILURE 141 +#define SSL_R_CONNECTION_ID_IS_DIFFERENT 142 +#define SSL_R_CONNECTION_TYPE_NOT_SET 143 +#define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 144 +#define SSL_R_DATA_LENGTH_TOO_LONG 145 +#define SSL_R_DECRYPTION_FAILED 146 +#define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 147 +#define SSL_R_DIGEST_CHECK_FAILED 148 +#define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 149 +#define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 150 +#define SSL_R_EXCESSIVE_MESSAGE_SIZE 151 +#define SSL_R_EXTRA_DATA_IN_MESSAGE 152 +#define SSL_R_GOT_A_FIN_BEFORE_A_CCS 153 +#define SSL_R_HTTPS_PROXY_REQUEST 154 +#define SSL_R_HTTP_REQUEST 155 +#define SSL_R_INTERNAL_ERROR 156 +#define SSL_R_INVALID_CHALLENGE_LENGTH 157 +#define SSL_R_LENGTH_MISMATCH 158 +#define SSL_R_LENGTH_TOO_SHORT 159 +#define SSL_R_LIBRARY_HAS_NO_CIPHERS 160 +#define SSL_R_MISSING_DH_DSA_CERT 161 +#define SSL_R_MISSING_DH_KEY 162 +#define SSL_R_MISSING_DH_RSA_CERT 163 +#define SSL_R_MISSING_DSA_SIGNING_CERT 164 +#define SSL_R_MISSING_EXPORT_TMP_DH_KEY 165 +#define SSL_R_MISSING_EXPORT_TMP_RSA_KEY 166 +#define SSL_R_MISSING_RSA_CERTIFICATE 167 +#define SSL_R_MISSING_RSA_ENCRYPTING_CERT 168 +#define SSL_R_MISSING_RSA_SIGNING_CERT 169 +#define SSL_R_MISSING_TMP_DH_KEY 170 +#define SSL_R_MISSING_TMP_RSA_KEY 171 +#define SSL_R_MISSING_TMP_RSA_PKEY 172 +#define SSL_R_MISSING_VERIFY_MESSAGE 173 +#define SSL_R_NON_SSLV2_INITIAL_PACKET 174 +#define SSL_R_NO_CERTIFICATES_RETURNED 175 +#define SSL_R_NO_CERTIFICATE_ASSIGNED 176 +#define SSL_R_NO_CERTIFICATE_RETURNED 177 +#define SSL_R_NO_CERTIFICATE_SET 178 +#define SSL_R_NO_CERTIFICATE_SPECIFIED 179 +#define SSL_R_NO_CIPHERS_AVAILABLE 180 +#define SSL_R_NO_CIPHERS_PASSED 181 +#define SSL_R_NO_CIPHERS_SPECIFIED 182 +#define SSL_R_NO_CIPHER_LIST 183 +#define SSL_R_NO_CIPHER_MATCH 184 +#define SSL_R_NO_CLIENT_CERT_RECEIVED 185 +#define SSL_R_NO_COMPRESSION_SPECIFIED 186 +#define SSL_R_NO_PRIVATEKEY 187 +#define SSL_R_NO_PRIVATE_KEY_ASSIGNED 188 +#define SSL_R_NO_PROTOCOLS_AVAILABLE 189 +#define SSL_R_NO_PUBLICKEY 190 +#define SSL_R_NO_SHARED_CIPHER 191 +#define SSL_R_NULL_SSL_CTX 192 +#define SSL_R_NULL_SSL_METHOD_PASSED 193 +#define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 194 +#define SSL_R_PACKET_LENGTH_TOO_LONG 195 +#define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 196 +#define SSL_R_PEER_ERROR 197 +#define SSL_R_PEER_ERROR_CERTIFICATE 198 +#define SSL_R_PEER_ERROR_NO_CERTIFICATE 199 +#define SSL_R_PEER_ERROR_NO_CIPHER 200 +#define SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE 201 +#define SSL_R_PRE_MAC_LENGTH_TOO_LONG 202 +#define SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS 203 +#define SSL_R_PROTOCOL_IS_SHUTDOWN 204 +#define SSL_R_PUBLIC_KEY_ENCRYPT_ERROR 205 +#define SSL_R_PUBLIC_KEY_IS_NOT_RSA 206 +#define SSL_R_PUBLIC_KEY_NOT_RSA 207 +#define SSL_R_READ_BIO_NOT_SET 208 +#define SSL_R_READ_WRONG_PACKET_TYPE 209 +#define SSL_R_RECORD_LENGTH_MISMATCH 210 +#define SSL_R_RECORD_TOO_LARGE 211 +#define SSL_R_REQUIRED_CIPHER_MISSING 212 +#define SSL_R_REUSE_CERT_LENGTH_NOT_ZERO 213 +#define SSL_R_REUSE_CERT_TYPE_NOT_ZERO 214 +#define SSL_R_REUSE_CIPHER_LIST_NOT_ZERO 215 +#define SSL_R_SHORT_READ 216 +#define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 217 +#define SSL_R_SSL3_SESSION_ID_TOO_SHORT 218 +#define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 +#define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 +#define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 +#define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 +#define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 +#define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 +#define SSL_R_SSLV3_ALERT_PEER_ERROR_CERTIFICATE 219 +#define SSL_R_SSLV3_ALERT_PEER_ERROR_NO_CERTIFICATE 220 +#define SSL_R_SSLV3_ALERT_PEER_ERROR_NO_CIPHER 221 +#define SSL_R_SSLV3_ALERT_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE 222 +#define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 +#define SSL_R_SSLV3_ALERT_UNKNOWN_REMOTE_ERROR_TYPE 223 +#define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 +#define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 224 +#define SSL_R_SSL_HANDSHAKE_FAILURE 225 +#define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 226 +#define SSL_R_SSL_SESSION_ID_IS_DIFFERENT 227 +#define SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER 228 +#define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 229 +#define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG 230 +#define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER 231 +#define SSL_R_UNABLE_TO_DECODE_DH_CERTS 232 +#define SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY 233 +#define SSL_R_UNABLE_TO_FIND_DH_PARAMETERS 234 +#define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 235 +#define SSL_R_UNABLE_TO_FIND_SSL_METHOD 236 +#define SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES 237 +#define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES 238 +#define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 239 +#define SSL_R_UNEXPECTED_MESSAGE 240 +#define SSL_R_UNEXPECTED_RECORD 241 +#define SSL_R_UNKNOWN_ALERT_TYPE 242 +#define SSL_R_UNKNOWN_CERTIFICATE_TYPE 243 +#define SSL_R_UNKNOWN_CIPHER_RETURNED 244 +#define SSL_R_UNKNOWN_CIPHER_TYPE 245 +#define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 246 +#define SSL_R_UNKNOWN_PKEY_TYPE 247 +#define SSL_R_UNKNOWN_PROTOCOL 248 +#define SSL_R_UNKNOWN_REMOTE_ERROR_TYPE 249 +#define SSL_R_UNKNOWN_SSL_VERSION 250 +#define SSL_R_UNKNOWN_STATE 251 +#define SSL_R_UNSUPPORTED_CIPHER 252 +#define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 253 +#define SSL_R_UNSUPPORTED_PROTOCOL 254 +#define SSL_R_UNSUPPORTED_SSL_VERSION 255 +#define SSL_R_WRITE_BIO_NOT_SET 256 +#define SSL_R_WRONG_CIPHER_RETURNED 257 +#define SSL_R_WRONG_MESSAGE_TYPE 258 +#define SSL_R_WRONG_NUMBER_OF_KEY_BITS 259 +#define SSL_R_WRONG_SIGNATURE_LENGTH 260 +#define SSL_R_WRONG_SIGNATURE_SIZE 261 +#define SSL_R_WRONG_SSL_VERSION 262 +#define SSL_R_WRONG_VERSION_NUMBER 263 +#define SSL_R_X509_LIB 264 diff --git a/src/lib/libssl/src/test/.rnd b/src/lib/libssl/src/test/.rnd new file mode 100644 index 0000000000..234970e241 Binary files /dev/null and b/src/lib/libssl/src/test/.rnd differ diff --git a/src/lib/libssl/src/test/certCA.srl b/src/lib/libssl/src/test/certCA.srl new file mode 100644 index 0000000000..39f5b69311 --- /dev/null +++ b/src/lib/libssl/src/test/certCA.srl @@ -0,0 +1 @@ +71 diff --git a/src/lib/libssl/src/test/demoCA/index.txt b/src/lib/libssl/src/test/demoCA/index.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/lib/libssl/src/test/demoCA/private/cakey.pem b/src/lib/libssl/src/test/demoCA/private/cakey.pem new file mode 100644 index 0000000000..edd5a5773f --- /dev/null +++ b/src/lib/libssl/src/test/demoCA/private/cakey.pem @@ -0,0 +1,2 @@ +-----BEGIN RSA PRIVATE KEY----- +-----END RSA PRIVATE KEY----- diff --git a/src/lib/libssl/src/test/demoCA/serial b/src/lib/libssl/src/test/demoCA/serial new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/src/lib/libssl/src/test/demoCA/serial @@ -0,0 +1 @@ +01 diff --git a/src/lib/libssl/src/test/dsa-ca.pem b/src/lib/libssl/src/test/dsa-ca.pem new file mode 100644 index 0000000000..9eb08f3ddd --- /dev/null +++ b/src/lib/libssl/src/test/dsa-ca.pem @@ -0,0 +1,43 @@ +-----BEGIN DSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CBC,C5B6C7CC9E1FE2C0 + +svCXBcBRhMuU22UXOfiKZA+thmz6KYXpt1Yg5Rd+TYQcQ1MdvNy0B0tkP1SxzDq0 +Xh1eMeTML9/9/0rKakgNXXXbpi5RB8t6BmwRSyej89F7nn1mtR3qzoyPRpp15SDl +Tn67C+2v+HDF3MFk88hiNCYkNbcmi7TWvChsl8N1r7wdZwtIox56yXdgxw6ZIpa/ +par0oUCzN7fiavPgCWz1kfPNSaBQSdxwH7TZi5tMHAr0J3C7a7QRnZfE09R59Uqr +zslrq+ndIw1BZAxoY0SlBu+iFOVaBVlwToC4AsHkv7j7l8ITtr7f42YbBa44D9TO +uOhONmkk/v3Fso4RaOEzdKZC+hnmmzvHs6TiTWm6yzJgSFwyOUK0eGmKEeVxpcH5 +rUOlHOwzen+FFtocZDZAfdFnb7QY7L/boQvyA5A+ZbRG4DUpmBQeQsSaICHM5Rxx +1QaLF413VNPXTLPbW0ilSc2H8x2iZTIVKfd33oSO6NhXPtSYQgfecEF4BvNHY5c4 +HovjT4mckbK95bcBzoCHu43vuSQkmZzdYo/ydSZt6zoPavbBLueTpgSbdXiDi827 +MVqOsYxGCb+kez0FoDSTgw== +-----END DSA PRIVATE KEY----- +-----BEGIN CERTIFICATE REQUEST----- +MIICUjCCAhECAQAwUjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUx +ITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDELMAkGA1UEAxMCQ0Ew +ggG0MIIBKQYFKw4DAgwwggEeAoGBAKc/boW/QWopffCfRxkwkJoJHdpqMx7FPYaW +sxXgUy6P4FmCc5A+dTGZR3pS+4Xk2aZ7OJtoioSbh8YetX6GS1NbWc9xZRmIbs5m +rmuINvvsKNzC16W75Sw5JkvamnAYlTeVEFYj9hXtugRe3jlP/bdDH7WkZW/NgBHk +cJVbUM1JAhUA9wcx7fpsBgPVhYocrJxl51BmZW8CgYBN30wDppGK9RlvUEYlmeVo +bzDjaeHls12YuyiGSPzemQQ/X4gMnHMkDSBduSqaPxiWJ+Rih8F7dGJT/GEnqHqR +CZ228U2cVA9YBu5JdAfOVX4jzhb2ytxaYQF+yXG1TfbcNCmHaPZeIJOz2/XkCWxB +F5WS6wG1c6Vqftgy7Q4CuAOBhAACgYAapll6iqz9XrZFlk2GCVcB+KihxWnH7IuH +vSLw9YUrJahcBHmbpvt494lF4gC5w3WPM+vXJofbusk4GoQEEsQNMDaah4m49uUq +AylOVFJJJXuirVJ+o+0TtOFDITEAl+YZZariXOD7tdOSOl9RLMPC6+daHKS9e68u +3enxhqnDGaAAMAkGBSsOAwIbBQADMAAwLQIVAJGVuFsG/0DBuSZ0jF7ypdU0/G0v +AhQfeF5BoMMDbX/kidUVpQ6gadPlZA== +-----END CERTIFICATE REQUEST----- +-----BEGIN CERTIFICATE----- +MIIBrjCCAWwCAQswCQYFKw4DAhsFADBTMQswCQYDVQQGEwJBVTETMBEGA1UECBMK +U29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMQww +CgYDVQQDEwNQQ0EwHhcNOTcwNjE1MDIxNDI5WhcNOTcwNzE1MDIxNDI5WjBSMQsw +CQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJu +ZXQgV2lkZ2l0cyBQdHkgTHRkMQswCQYDVQQDEwJDQTCBkjAJBgUrDgMCDAUAA4GE +AAKBgBqmWXqKrP1etkWWTYYJVwH4qKHFacfsi4e9IvD1hSslqFwEeZum+3j3iUXi +ALnDdY8z69cmh9u6yTgahAQSxA0wNpqHibj25SoDKU5UUkkle6KtUn6j7RO04UMh +MQCX5hllquJc4Pu105I6X1Esw8Lr51ocpL17ry7d6fGGqcMZMAkGBSsOAwIbBQAD +MQAwLgIVAJ4wtQsANPxHo7Q4IQZYsL12SKdbAhUAjJ9n38zxT+iai2164xS+LIfa +C1Q= +-----END CERTIFICATE----- + diff --git a/src/lib/libssl/src/test/dsa-pca.pem b/src/lib/libssl/src/test/dsa-pca.pem new file mode 100644 index 0000000000..e3641ad47e --- /dev/null +++ b/src/lib/libssl/src/test/dsa-pca.pem @@ -0,0 +1,49 @@ +-----BEGIN DSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CBC,F80EEEBEEA7386C4 + +GZ9zgFcHOlnhPoiSbVi/yXc9mGoj44A6IveD4UlpSEUt6Xbse3Fr0KHIUyQ3oGnS +mClKoAp/eOTb5Frhto85SzdsxYtac+X1v5XwdzAMy2KowHVk1N8A5jmE2OlkNPNt +of132MNlo2cyIRYaa35PPYBGNCmUm7YcYS8O90YtkrQZZTf4+2C4kllhMcdkQwkr +FWSWC8YOQ7w0LHb4cX1FejHHom9Nd/0PN3vn3UyySvfOqoR7nbXkrpHXmPIr0hxX +RcF0aXcV/CzZ1/nfXWQf4o3+oD0T22SDoVcZY60IzI0oIc3pNCbDV3uKNmgekrFd +qOUJ+QW8oWp7oefRx62iBfIeC8DZunohMXaWAQCU0sLQOR4yEdeUCnzCSywe0bG1 +diD0KYaEe+Yub1BQH4aLsBgDjardgpJRTQLq0DUvw0/QGO1irKTJzegEDNVBKrVn +V4AHOKT1CUKqvGNRP1UnccUDTF6miOAtaj/qpzra7sSk7dkGBvIEeFoAg84kfh9h +hVvF1YyzC9bwZepruoqoUwke/WdNIR5ymOVZ/4Liw0JdIOcq+atbdRX08niqIRkf +dsZrUj4leo3zdefYUQ7w4N2Ns37yDFq7 +-----END DSA PRIVATE KEY----- +-----BEGIN CERTIFICATE REQUEST----- +MIICVTCCAhMCAQAwUzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUx +ITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEMMAoGA1UEAxMDUENB +MIIBtTCCASkGBSsOAwIMMIIBHgKBgQCnP26Fv0FqKX3wn0cZMJCaCR3aajMexT2G +lrMV4FMuj+BZgnOQPnUxmUd6UvuF5NmmezibaIqEm4fGHrV+hktTW1nPcWUZiG7O +Zq5riDb77Cjcwtelu+UsOSZL2ppwGJU3lRBWI/YV7boEXt45T/23Qx+1pGVvzYAR +5HCVW1DNSQIVAPcHMe36bAYD1YWKHKycZedQZmVvAoGATd9MA6aRivUZb1BGJZnl +aG8w42nh5bNdmLsohkj83pkEP1+IDJxzJA0gXbkqmj8YlifkYofBe3RiU/xhJ6h6 +kQmdtvFNnFQPWAbuSXQHzlV+I84W9srcWmEBfslxtU323DQph2j2XiCTs9v15Als +QReVkusBtXOlan7YMu0OArgDgYUAAoGBAKbtuR5AdW+ICjCFe2ixjUiJJzM2IKwe +6NZEMXg39+HQ1UTPTmfLZLps+rZfolHDXuRKMXbGFdSF0nXYzotPCzi7GauwEJTZ +yr27ZZjA1C6apGSQ9GzuwNvZ4rCXystVEagAS8OQ4H3D4dWS17Zg31ICb5o4E5r0 +z09o/Uz46u0VoAAwCQYFKw4DAhsFAAMxADAuAhUArRubTxsbIXy3AhtjQ943AbNB +nSICFQCu+g1iW3jwF+gOcbroD4S/ZcvB3w== +-----END CERTIFICATE REQUEST----- +-----BEGIN CERTIFICATE----- +MIIC0zCCApECAQAwCQYFKw4DAhsFADBTMQswCQYDVQQGEwJBVTETMBEGA1UECBMK +U29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMQww +CgYDVQQDEwNQQ0EwHhcNOTcwNjE0MjI1NDQ1WhcNOTcwNzE0MjI1NDQ1WjBTMQsw +CQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJu +ZXQgV2lkZ2l0cyBQdHkgTHRkMQwwCgYDVQQDEwNQQ0EwggG1MIIBKQYFKw4DAgww +ggEeAoGBAKc/boW/QWopffCfRxkwkJoJHdpqMx7FPYaWsxXgUy6P4FmCc5A+dTGZ +R3pS+4Xk2aZ7OJtoioSbh8YetX6GS1NbWc9xZRmIbs5mrmuINvvsKNzC16W75Sw5 +JkvamnAYlTeVEFYj9hXtugRe3jlP/bdDH7WkZW/NgBHkcJVbUM1JAhUA9wcx7fps +BgPVhYocrJxl51BmZW8CgYBN30wDppGK9RlvUEYlmeVobzDjaeHls12YuyiGSPze +mQQ/X4gMnHMkDSBduSqaPxiWJ+Rih8F7dGJT/GEnqHqRCZ228U2cVA9YBu5JdAfO +VX4jzhb2ytxaYQF+yXG1TfbcNCmHaPZeIJOz2/XkCWxBF5WS6wG1c6Vqftgy7Q4C +uAOBhQACgYEApu25HkB1b4gKMIV7aLGNSIknMzYgrB7o1kQxeDf34dDVRM9OZ8tk +umz6tl+iUcNe5EoxdsYV1IXSddjOi08LOLsZq7AQlNnKvbtlmMDULpqkZJD0bO7A +29nisJfKy1URqABLw5DgfcPh1ZLXtmDfUgJvmjgTmvTPT2j9TPjq7RUwCQYFKw4D +AhsFAAMxADAuAhUAvtv6AkMolix1Jvy3UnVEIUqdCUICFQC+jq8P49mwrY9oJ24n +5rKUjNBhSg== +-----END CERTIFICATE----- + diff --git a/src/lib/libssl/src/test/p b/src/lib/libssl/src/test/p new file mode 100644 index 0000000000..b3de76751e --- /dev/null +++ b/src/lib/libssl/src/test/p @@ -0,0 +1,294 @@ +# +# test/Makefile.ssl +# + +DIR= test +TOP= .. +CC= cc +INCLUDES= -I../include +CFLAG= -g +INSTALLTOP= /usr/local/ssl +MAKEFILE= Makefile.ssl +MAKE= make -f $(MAKEFILE) +MAKEDEPEND= makedepend -f$(MAKEFILE) + +PEX_LIBS= +EX_LIBS= #-lnsl -lsocket + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile.ssl + +DLIBCRYPTO= ../libcrypto.a +DLIBSSL= ../libssl.a +LIBCRYPTO= -L.. -lcrypto +LIBSSL= -L.. -lssl + +BNTEST= bntest +EXPTEST= exptest +IDEATEST= ideatest +SHATEST= shatest +SHA1TEST= sha1test +MDC2TEST= mdc2test +RMDTEST= rmdtest +MD2TEST= md2test +MD5TEST= md5test +HMACTEST= hmactest +RC2TEST= rc2test +RC4TEST= rc4test +RC5TEST= rc5test +BFTEST= bftest +CASTTEST= casttest +DESTEST= destest +RANDTEST= randtest +DHTEST= dhtest +DSATEST= dsatest +METHTEST= methtest +SSLTEST= ssltest + +EXE= $(BNTEST) $(IDEATEST) $(MD2TEST) $(MD5TEST) $(HMACTEST) \ + $(RC2TEST) $(RC4TEST) $(RC5TEST) \ + $(DESTEST) $(SHATEST) $(SHA1TEST) $(MDC2TEST) $(RMDTEST) \ + $(RANDTEST) $(DHTEST) \ + $(BFTEST) $(CASTTEST) $(SSLTEST) $(EXPTEST) $(DSATEST) + +# $(METHTEST) + +OBJ= $(BNTEST).o $(IDEATEST).o $(MD2TEST).o $(MD5TEST).o $(HMACTEST).o \ + $(RC2TEST).o $(RC4TEST).o $(RC5TEST).o \ + $(DESTEST).o $(SHATEST).o $(SHA1TEST).o $(MDC2TEST).o $(RMDTEST).o \ + $(RANDTEST).o $(DHTEST).o $(CASTTEST).o \ + $(BFTEST).o $(SSLTEST).o $(DSATEST).o $(EXPTEST).o +SRC= $(BNTEST).c $(IDEATEST).c $(MD2TEST).c $(MD5TEST).c $(HMACTEST).c \ + $(RC2TEST).c $(RC4TEST).c $(RC5TEST).c \ + $(DESTEST).c $(SHATEST).c $(SHA1TEST).c $(MDC2TEST).c $(RMDTEST).c \ + $(RANDTEST).c $(DHTEST).c $(CASTTEST).c \ + $(BFTEST).c $(SSLTEST).c $(DSATEST).c $(EXPTEST).c + +EXHEADER= +HEADER= $(EXHEADER) + +ALL= $(GENERAL) $(SRC) $(HEADER) + +top: + (cd ..; $(MAKE) DIRS=$(DIR) all) + +all: exe + +exe: $(EXE) + +files: + perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO + +links: + /bin/rm -f Makefile + $(TOP)/util/point.sh Makefile.ssl Makefile ; + +errors: + +install: + +tags: + ctags $(SRC) + +tests: exe apps \ + test_des test_idea test_sha test_md5 test_hmac test_md2 test_mdc2 \ + test_rc2 test_rc4 test_rc5 test_bf test_cast \ + test_rand test_enc test_x509 test_rsa test_crl test_sid test_req \ + test_pkcs7 test_bn test_verify test_dh test_dsa test_reqgen \ + test_ss test_ssl test_ca + +apps: + @(cd ../apps; $(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' all) + +test_des: + #./$(DESTEST) + +test_idea: + ./$(IDEATEST) + +test_sha: + ./$(SHATEST) + ./$(SHA1TEST) + +test_mdc2: + ./$(MDC2TEST) + +test_md5: + ./$(MD5TEST) + +test_hmac: + ./$(HMACTEST) + +test_md2: + ./$(MD2TEST) + +test_rmd: + ./$(RMDTEST) + +test_bf: + ./$(BFTEST) + +test_cast: + ./$(CASTTEST) + +test_rc2: + ./$(RC2TEST) + +test_rc4: + ./$(RC4TEST) + +test_rc5: + ./$(RC5TEST) + +test_rand: + ./$(RANDTEST) + +test_enc: + @sh ./testenc + +test_x509: + echo test normal x509v1 certificate + sh ./tx509 2>/dev/null + echo test first x509v3 certificate + sh ./tx509 v3-cert1.pem 2>/dev/null + echo test second x509v3 certificate + sh ./tx509 v3-cert2.pem 2>/dev/null + +test_rsa: + @sh ./trsa 2>/dev/null + +test_crl: + @sh ./tcrl 2>/dev/null + +test_sid: + @sh ./tsid 2>/dev/null + +test_req: + @sh ./treq 2>/dev/null + @sh ./treq testreq2.pem 2>/dev/null + +test_pkcs7: + @sh ./tpkcs7 2>/dev/null + @sh ./tpkcs7d 2>/dev/null + +test_bn: + @echo 'test a^b%c implementations' + ./$(EXPTEST) + @echo starting big number library test, could take a while... + @(./$(BNTEST)|bc) | awk '{ \ +if ($$0 != "0") {print "error"; exit(1); } \ +if (((NR+1)%64) == 0) print NR+1," tests done"; }' + +test_verify: + @echo "The following command should have some OK's and some failures" + @echo "There are definitly a few expired certificates" + ../apps/ssleay verify -CApath ../certs ../certs/*.pem + +test_dh: + @echo "Generate as set of DH parameters" + ./$(DHTEST) + +test_dsa: + @echo "Generate as set of DSA parameters" + ./$(DSATEST) + +test_reqgen: + @echo "Generate and verify a certificate request" + @sh ./testgen + +test_ss: + @echo "Generate and certify a test certificate" + @sh ./testss + +test_ssl: + @echo "test SSL protocol" + @sh ./testssl + +test_ca: + @echo "Generate and certify a test certificate via the 'ca' program" + @sh ./testca + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(SRC) + +dclean: + perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff $(EXE) *.ss log + +$(DLIBSSL): + (cd ../ssl; $(MAKE)) + +$(DLIBCRYPTO): + (cd ../crypto; $(MAKE)) + +$(BNTEST): $(BNTEST).o $(DLIBCRYPTO) + $(CC) -o $(BNTEST) $(CFLAGS) $(BNTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(EXPTEST): $(EXPTEST).o $(DLIBCRYPTO) + $(CC) -o $(EXPTEST) $(CFLAGS) $(EXPTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(IDEATEST): $(IDEATEST).o $(DLIBCRYPTO) + $(CC) -o $(IDEATEST) $(CFLAGS) $(IDEATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(MD2TEST): $(MD2TEST).o $(DLIBCRYPTO) + $(CC) -o $(MD2TEST) $(CFLAGS) $(MD2TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(SHATEST): $(SHATEST).o $(DLIBCRYPTO) + $(CC) -o $(SHATEST) $(CFLAGS) $(SHATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(SHA1TEST): $(SHA1TEST).o $(DLIBCRYPTO) + $(CC) -o $(SHA1TEST) $(CFLAGS) $(SHA1TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(RMDTEST): $(RMDTEST).o $(DLIBCRYPTO) + $(CC) -o $(RMDTEST) $(CFLAGS) $(RMDTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(MDC2TEST): $(MDC2TEST).o $(DLIBCRYPTO) + $(CC) -o $(MDC2TEST) $(CFLAGS) $(MDC2TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(MD5TEST): $(MD5TEST).o $(DLIBCRYPTO) + $(CC) -o $(MD5TEST) $(CFLAGS) $(MD5TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(HMACTEST): $(HMACTEST).o $(DLIBCRYPTO) + $(CC) -o $(HMACTEST) $(CFLAGS) $(HMACTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(RC2TEST): $(RC2TEST).o $(DLIBCRYPTO) + $(CC) -o $(RC2TEST) $(CFLAGS) $(RC2TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(BFTEST): $(BFTEST).o $(DLIBCRYPTO) + $(CC) -o $(BFTEST) $(CFLAGS) $(BFTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(CASTTEST): $(CASTTEST).o $(DLIBCRYPTO) + $(CC) -o $(CASTTEST) $(CFLAGS) $(CASTTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(RC4TEST): $(RC4TEST).o $(DLIBCRYPTO) + $(CC) -o $(RC4TEST) $(CFLAGS) $(RC4TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(RC5TEST): $(RC5TEST).o $(DLIBCRYPTO) + $(CC) -o $(RC5TEST) $(CFLAGS) $(RC5TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(DESTEST): $(DESTEST).o $(DLIBCRYPTO) + $(CC) -o $(DESTEST) $(CFLAGS) $(DESTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(RANDTEST): $(RANDTEST).o $(DLIBCRYPTO) + $(CC) -o $(RANDTEST) $(CFLAGS) $(RANDTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(DHTEST): $(DHTEST).o $(DLIBCRYPTO) + $(CC) -o $(DHTEST) $(CFLAGS) $(DHTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(DSATEST): $(DSATEST).o $(DLIBCRYPTO) + $(CC) -o $(DSATEST) $(CFLAGS) $(DSATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(METHTEST): $(METHTEST).o $(DLIBCRYPTO) + $(CC) -o $(METHTEST) $(CFLAGS) $(METHTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(SSLTEST): $(SSLTEST).o $(DLIBSSL) $(DLIBCRYPTO) + $(CC) -o $(SSLTEST) $(CFLAGS) $(SSLTEST).o $(PEX_LIBS) $(LIBSSL) $(LIBCRYPTO) $(EX_LIBS) + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libssl/src/test/riptest b/src/lib/libssl/src/test/riptest new file mode 100644 index 0000000000..8685d0ce53 Binary files /dev/null and b/src/lib/libssl/src/test/riptest differ diff --git a/src/lib/libssl/src/test/test.txt b/src/lib/libssl/src/test/test.txt new file mode 100644 index 0000000000..c6d8d50ba9 --- /dev/null +++ b/src/lib/libssl/src/test/test.txt @@ -0,0 +1,31 @@ +#!/bin/sh + +test=./test.txt + +cat $0 >$test; + +for i in rc4 des-cfb des-ofb des-ecb des-cbc des-ede des-ede3 \ + des-cbc-ede des-cbc-ede3 idea-ecb idea-cfb idea-ofb idea-cbc +do + echo $i + ../apps/ssleay $i -e -k test < $test > $test.$i.cipher + ../apps/ssleay $i -d -k test < $test.$i.cipher >$test.$i.clear + cmp $test $test.$i.clear + if [ $? != 0 ] + then + exit 1 + else + /bin/rm $test.$i.cipher $test.$i.clear + fi + + echo $i base64 + ../apps/ssleay $i -a -e -k test < $test > $test.$i.cipher + ../apps/ssleay $i -a -d -k test < $test.$i.cipher >$test.$i.clear + cmp $test $test.$i.clear + if [ $? != 0 ] + then + exit 1 + else + /bin/rm $test.$i.cipher $test.$i.clear + fi +done diff --git a/src/lib/libssl/src/test/testkey.pem b/src/lib/libssl/src/test/testkey.pem new file mode 100644 index 0000000000..edd5a5773f --- /dev/null +++ b/src/lib/libssl/src/test/testkey.pem @@ -0,0 +1,2 @@ +-----BEGIN RSA PRIVATE KEY----- +-----END RSA PRIVATE KEY----- diff --git a/src/lib/libssl/src/test/testreq.pem b/src/lib/libssl/src/test/testreq.pem new file mode 100644 index 0000000000..1311fa7785 --- /dev/null +++ b/src/lib/libssl/src/test/testreq.pem @@ -0,0 +1,9 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIBQjCB7QIBADCBhzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQx +ETAPBgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdFNvZnQgUHR5IEx0ZDET +MBEGA1UEAxMKRXJpYyBZb3VuZzEfMB0GCSqGSIb3DQEJARYQZWF5QG1pbmNvbS5v +ei5hdTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDVKdT5QB2ZojtNQGjA/9J7s2o4 +RNkuSq8l377uWLAyMljtdkcoRsvUy5lZ997UDHFTbVFA038ZBrmw7l5EyHeXAgMB +AAGgADANBgkqhkiG9w0BAQQFAANBAKnaFr4u7PTdfmpjiX/H8Ho4UWGVRWUlvD2R +/D9yoTj7TN3uODx2BD0drErVBe/Zjv81vhH6Yo3cJO/hRS3A7jw= +-----END CERTIFICATE REQUEST----- diff --git a/src/lib/libssl/src/util/mklink.sh b/src/lib/libssl/src/util/mklink.sh new file mode 100644 index 0000000000..1e052ed6ee --- /dev/null +++ b/src/lib/libssl/src/util/mklink.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# +# A bit of an ugly shell script used to actually 'link' files. +# Used by 'make links' +# + +PATH=$PATH:.:util:../util:../../util +export PATH + +from=$1 +shift + +here=`pwd` +tmp=`dirname $from` +while [ "$tmp"x != "x" -a "$tmp"x != ".x" ] +do + t=`basename $here` + here=`dirname $here` + to="/$t$to" + tmp=`dirname $tmp` +done +to=..$to + +#echo from=$from +#echo to =$to +#exit 1 + +if [ "$*"x != "x" ]; then + for i in $* + do + /bin/rm -f $from/$i + point.sh $to/$i $from/$i + done +fi +exit 0; diff --git a/src/lib/libssl/src/util/ranlib.sh b/src/lib/libssl/src/util/ranlib.sh new file mode 100644 index 0000000000..543f712c6b --- /dev/null +++ b/src/lib/libssl/src/util/ranlib.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +cwd=`pwd` +cd /tmp + +if [ -s /bin/ranlib ] ; then + RL=/bin/ranlib +else if [ -s /usr/bin/ranlib ] ; then + RL=/usr/bin/ranlib +fi +fi + +if [ "x$RL" != "x" ] +then + case "$1" in + /*) + $RL "$1" + ;; + *) + $RL "$cwd/$1" + ;; + esac +fi diff --git a/src/lib/libssl/src/util/sep_lib.sh b/src/lib/libssl/src/util/sep_lib.sh new file mode 100644 index 0000000000..2348db874e --- /dev/null +++ b/src/lib/libssl/src/util/sep_lib.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +cwd=`pwd` +/bin/rm -fr tmp/* + +cd crypto/des +make -f Makefile.uni tar +make -f Makefile.uni tar_lit +/bin/mv libdes.tgz $cwd/tmp +/bin/mv libdes-l.tgz $cwd/tmp +cd $cwd + +for name in md5 sha cast bf idea rc4 rc2 +do + echo doing $name + (cd crypto; tar cfh - $name)|(cd tmp; tar xf -) + cd tmp/$name + /bin/rm -f Makefile + /bin/rm -f Makefile.ssl + /bin/rm -f Makefile.ssl.orig + /bin/rm -f *.old + /bin/mv Makefile.uni Makefile + + cp $cwd/util/ranlib.sh . + chmod +x ranlib.sh + + if [ -d asm ]; then + mkdir asm/perlasm + cp $cwd/crypto/perlasm/*.pl asm/perlasm + fi + cd .. + tar cf - $name|gzip >$name.tgz +# /bin/rm -fr $name + cd $cwd +done + + diff --git a/src/lib/libssl/src/util/ssldir.pl b/src/lib/libssl/src/util/ssldir.pl new file mode 100644 index 0000000000..10584686da --- /dev/null +++ b/src/lib/libssl/src/util/ssldir.pl @@ -0,0 +1,52 @@ +#!/usr/bin/perl + +$#ARGV == 0 || die "usage: ssldir.pl /new/path\n"; +@files=('crypto/cryptlib.h', + 'Makefile.ssl', + 'tools/c_rehash', + 'util/mk1mf.pl', + ); + +%cryptlib=( + '\sX509_CERT_AREA\s',"#define X509_CERT_AREA\t\t".'"%s"', + '\sX509_CERT_DIR\s', "#define X509_CERT_DIR\t\t".'"%s/certs"', + '\sX509_CERT_FILE\s', "#define X509_CERT_FILE\t\t".'"%s/cert.pem"', + '\sX509_PRIVATE_DIR\s',"#define X509_PRIVATE_DIR\t".'"%s/private"', + ); + +%Makefile_ssl=( + '^INSTALLTOP=','INSTALLTOP=%s', + ); + +%c_rehash=( + '^DIR=', 'DIR=%s', + ); + +%mk1mf=( + '^$INSTALLTOP=','$INSTALLTOP="%s";', + ); + +&dofile("crypto/cryptlib.h",$ARGV[0],%cryptlib); +&dofile("Makefile.ssl",$ARGV[0],%Makefile_ssl); +&dofile("tools/c_rehash",$ARGV[0],%c_rehash); +&dofile("util/mk1mf.pl",$ARGV[0],%mk1mf); + +sub dofile + { + ($f,$p,%m)=@_; + + open(IN,"<$f") || die "unable to open $f:$!\n"; + @a=<IN>; + close(IN); + foreach $k (keys %m) + { + grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a); + } + ($ff=$f) =~ s/\..*$//; + open(OUT,">$ff.new") || die "unable to open $f:$!\n"; + print OUT @a; + close(OUT); + rename($f,"$ff.old") || die "unable to rename $f\n"; + rename("$ff.new",$f) || die "unable to rename $ff.new\n"; + } + diff --git a/src/lib/libssl/src/util/up_ver.pl b/src/lib/libssl/src/util/up_ver.pl new file mode 100644 index 0000000000..32c086b2aa --- /dev/null +++ b/src/lib/libssl/src/util/up_ver.pl @@ -0,0 +1,79 @@ +#!/usr/bin/perl +# +# Up the version numbers in the files. +# + +@files=( + "crypto/crypto.h", + "crypto/des/ecb_enc.c", + "crypto/idea/i_ecb.c", + "crypto/lhash/lhash.c", + "crypto/conf/conf.c", + "crypto/md2/md2_dgst.c", + "crypto/md5/md5_dgst.c", + "crypto/ripemd/rmd_dgst.c", + "crypto/pem/pem_lib.c", + "crypto/bn/bn_lib.c", + "crypto/dh/dh_lib.c", + "crypto/rc2/rc2_ecb.c", + "crypto/rc4/rc4_skey.c", + "crypto/rc5/rc5_ecb.c", + "crypto/bf/bf_ecb.c", + "crypto/cast/c_ecb.c", + "crypto/rsa/rsa_lib.c", + "crypto/dsa/dsa_lib.c", + "crypto/sha/sha1dgst.c", + "crypto/sha/sha_dgst.c", + "crypto/asn1/asn1_lib.c", + "crypto/x509/x509_vfy.c", + "crypto/evp/evp_enc.c", + "crypto/rand/md_rand.c", + "crypto/stack/stack.c", + "crypto/txt_db/txt_db.c", + "crypto/cversion.c", + "ssl/ssl_lib.c", + "ssl/s2_lib.c", + "ssl/s3_lib.c", + "ssl/t1_lib.c", + "README", + ); + +@month=('Jan','Feb','Mar','Apr','May','Jun', + 'Jul','Aug','Sep','Oct','Nov','Dec'); +@a=localtime(time()); +$time=sprintf("%02d-%s-%04d",$a[3],$month[$a[4]],$a[5]+1900); + +$ver=$ARGV[0]; +($ver ne "") || die "no version number specified\n"; +($a,$b,$c,$d)=unpack('axaxac',$ver); +$d=defined($d)?$d-96:0; +$xver=sprintf("%x%x%x%x",$a,$b,$c,$d); + +foreach $file (@files) + { + open(IN,"<$file") || die "unable to open $file:$!\n"; + open(OUT,">$file.new") || die "unable to open $file.new:$!\n"; + $found=0; + + print STDERR "$file:"; + + while (<IN>) + { + if ((s/SSLeay \d\.\d.\d[^"]*(\"|\s)/SSLeay $ver $time\1/) || + s/^(\#define\s+SSLEAY_VERSION_NUMBER\s+0x)[0-9a-zA-Z]+(.*)$/$1$xver$2/) + { + print STDERR " Done"; + $found++; + print OUT; + while (<IN>) { print OUT; } + last; + } + print OUT; + } + print STDERR "\n"; + close(IN); + close(OUT); + (!$found) && die "unable to update the version number in $file\n"; + rename($file,"$file.old") || die "unable to rename $file:$!\n"; + rename("$file.new",$file) || die "unable to rename $file.new:$!\n"; + } diff --git a/src/lib/libssl/ssl-patent/Makefile b/src/lib/libssl/ssl-patent/Makefile new file mode 100644 index 0000000000..4831fcfe42 --- /dev/null +++ b/src/lib/libssl/ssl-patent/Makefile @@ -0,0 +1,45 @@ + +LIB= ssl + +SSLEAYDIST= src-patent + +LSSL_SRC= ${.CURDIR}/../${SSLEAYDIST}/ssl +SSLEAY_INC= ${.CURDIR}/../${SSLEAYDIST}/include +LCRYPTO_INC= ${.CURDIR}/../${SSLEAYDIST}/crypto + +.if ${MACHINE_ARCH} == "i386" +CFLAGS+= -DL_ENDIAN -DBN_ASM +.else +.if ${MACHINE_ARCH} == "alpha" +# no ENDIAN stuff defined for alpha +.else +CFLAGS+= -DB_ENDIAN +.endif +.endif +CFLAGS+= -DNO_IDEA -DTERMIOS -DANSI_SOURCE +CFLAGS+= -I${LSSL_SRC} -I${SSLEAY_INC} -I${LCRYPTO_INC} + +SRCS= s2_meth.c s2_srvr.c s2_clnt.c s2_lib.c s2_enc.c s2_pkt.c \ + s3_meth.c s3_srvr.c s3_clnt.c s3_lib.c s3_enc.c s3_pkt.c s3_both.c \ + s23_meth.c s23_srvr.c s23_clnt.c s23_lib.c s23_pkt.c \ + t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c \ + ssl_lib.c ssl_err2.c ssl_cert.c ssl_sess.c \ + ssl_ciph.c ssl_stat.c ssl_rsa.c \ + ssl_asn1.c ssl_txt.c ssl_algs.c \ + bio_ssl.c ssl_err.c + +HDRS= ssl.h ssl2.h ssl3.h ssl23.h tls1.h + +.PATH: ${LSSL_SRC} + +includes: + @cd ${LSSL_SRC}; for i in $(HDRS); do \ + j="cmp -s $$i ${DESTDIR}/usr/include/ssl/`basename $$i` || \ + ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \ + $$i ${DESTDIR}/usr/include/ssl"; \ + echo $$j; \ + eval "$$j"; \ + done + + +.include <bsd.lib.mk> diff --git a/src/lib/libssl/ssl-patent/shlib_version b/src/lib/libssl/ssl-patent/shlib_version new file mode 100644 index 0000000000..893819d18f --- /dev/null +++ b/src/lib/libssl/ssl-patent/shlib_version @@ -0,0 +1,2 @@ +major=1 +minor=1 diff --git a/src/lib/libssl/ssl/Makefile b/src/lib/libssl/ssl/Makefile new file mode 100644 index 0000000000..a2fce87b5c --- /dev/null +++ b/src/lib/libssl/ssl/Makefile @@ -0,0 +1,45 @@ + +LIB= ssl + +SSLEAYDIST= src + +LSSL_SRC= ${.CURDIR}/../${SSLEAYDIST}/ssl +SSLEAY_INC= ${.CURDIR}/../${SSLEAYDIST}/include +LCRYPTO_INC= ${.CURDIR}/../${SSLEAYDIST}/crypto + +.if ${MACHINE_ARCH} == "i386" +CFLAGS+= -DL_ENDIAN -DBN_ASM +.else +.if ${MACHINE_ARCH} == "alpha" +# no ENDIAN stuff defined for alpha +.else +CFLAGS+= -DB_ENDIAN +.endif +.endif +CFLAGS+= -DNO_IDEA -DTERMIOS -DANSI_SOURCE +CFLAGS+= -I${LSSL_SRC} -I${SSLEAY_INC} -I${LCRYPTO_INC} + +SRCS= s2_meth.c s2_srvr.c s2_clnt.c s2_lib.c s2_enc.c s2_pkt.c \ + s3_meth.c s3_srvr.c s3_clnt.c s3_lib.c s3_enc.c s3_pkt.c s3_both.c \ + s23_meth.c s23_srvr.c s23_clnt.c s23_lib.c s23_pkt.c \ + t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c \ + ssl_lib.c ssl_err2.c ssl_cert.c ssl_sess.c \ + ssl_ciph.c ssl_stat.c ssl_rsa.c \ + ssl_asn1.c ssl_txt.c ssl_algs.c \ + bio_ssl.c ssl_err.c + +HDRS= ssl.h ssl2.h ssl3.h ssl23.h tls1.h + +.PATH: ${LSSL_SRC} + +includes: + @cd ${LSSL_SRC}; for i in $(HDRS); do \ + j="cmp -s $$i ${DESTDIR}/usr/include/ssl/`basename $$i` || \ + ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \ + $$i ${DESTDIR}/usr/include/ssl"; \ + echo $$j; \ + eval "$$j"; \ + done + + +.include <bsd.lib.mk> diff --git a/src/lib/libssl/ssl/shlib_version b/src/lib/libssl/ssl/shlib_version new file mode 100644 index 0000000000..1edea46de9 --- /dev/null +++ b/src/lib/libssl/ssl/shlib_version @@ -0,0 +1,2 @@ +major=1 +minor=0 diff --git a/src/lib/libssl/ssleay/Makefile b/src/lib/libssl/ssleay/Makefile new file mode 100644 index 0000000000..5eea72267b --- /dev/null +++ b/src/lib/libssl/ssleay/Makefile @@ -0,0 +1,38 @@ + +PROG= ssleay + +BINOWN= root +BINGRP= bin +BINMODE= 555 +BINDIR= /usr/sbin +LDADD= -lssl -lcrypto +NOMAN= not yet kiddies + +SSLEAYDIST= src + +SSLEAY_SRC= ${.CURDIR}/../${SSLEAYDIST}/apps + +.if ${MACHINE_ARCH} == "i386" +CFLAGS+= -DL_ENDIAN -DBN_ASM +.else +.if ${MACHINE_ARCH} == "alpha" +# no ENDIAN stuff defined for alpha +.else +CFLAGS+= -DB_ENDIAN +.endif +.endif + +CFLAGS+= -DMONOLITH -DNO_IDEA -DTERMIOS -DANSI_SOURCE +CFLAGS+= -I/usr/include/ssl + +SRCS= verify.c asn1pars.c req.c dgst.c dh.c enc.c gendh.c errstr.c ca.c \ + pkcs7.c crl2p7.c crl.c \ + rsa.c dsa.c dsaparam.c \ + x509.c genrsa.c s_server.c s_client.c speed.c \ + s_time.c apps.c s_cb.c s_socket.c version.c sess_id.c \ + ciphers.c ssleay.c + +.PATH: ${SSLEAY_SRC} + +.include<bsd.prog.mk> + diff --git a/src/lib/libssl/test/.rnd b/src/lib/libssl/test/.rnd new file mode 100644 index 0000000000..234970e241 Binary files /dev/null and b/src/lib/libssl/test/.rnd differ diff --git a/src/lib/libssl/test/certCA.srl b/src/lib/libssl/test/certCA.srl new file mode 100644 index 0000000000..39f5b69311 --- /dev/null +++ b/src/lib/libssl/test/certCA.srl @@ -0,0 +1 @@ +71 diff --git a/src/lib/libssl/test/demoCA/index.txt b/src/lib/libssl/test/demoCA/index.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/lib/libssl/test/demoCA/private/cakey.pem b/src/lib/libssl/test/demoCA/private/cakey.pem new file mode 100644 index 0000000000..edd5a5773f --- /dev/null +++ b/src/lib/libssl/test/demoCA/private/cakey.pem @@ -0,0 +1,2 @@ +-----BEGIN RSA PRIVATE KEY----- +-----END RSA PRIVATE KEY----- diff --git a/src/lib/libssl/test/demoCA/serial b/src/lib/libssl/test/demoCA/serial new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/src/lib/libssl/test/demoCA/serial @@ -0,0 +1 @@ +01 diff --git a/src/lib/libssl/test/dsa-ca.pem b/src/lib/libssl/test/dsa-ca.pem new file mode 100644 index 0000000000..9eb08f3ddd --- /dev/null +++ b/src/lib/libssl/test/dsa-ca.pem @@ -0,0 +1,43 @@ +-----BEGIN DSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CBC,C5B6C7CC9E1FE2C0 + +svCXBcBRhMuU22UXOfiKZA+thmz6KYXpt1Yg5Rd+TYQcQ1MdvNy0B0tkP1SxzDq0 +Xh1eMeTML9/9/0rKakgNXXXbpi5RB8t6BmwRSyej89F7nn1mtR3qzoyPRpp15SDl +Tn67C+2v+HDF3MFk88hiNCYkNbcmi7TWvChsl8N1r7wdZwtIox56yXdgxw6ZIpa/ +par0oUCzN7fiavPgCWz1kfPNSaBQSdxwH7TZi5tMHAr0J3C7a7QRnZfE09R59Uqr +zslrq+ndIw1BZAxoY0SlBu+iFOVaBVlwToC4AsHkv7j7l8ITtr7f42YbBa44D9TO +uOhONmkk/v3Fso4RaOEzdKZC+hnmmzvHs6TiTWm6yzJgSFwyOUK0eGmKEeVxpcH5 +rUOlHOwzen+FFtocZDZAfdFnb7QY7L/boQvyA5A+ZbRG4DUpmBQeQsSaICHM5Rxx +1QaLF413VNPXTLPbW0ilSc2H8x2iZTIVKfd33oSO6NhXPtSYQgfecEF4BvNHY5c4 +HovjT4mckbK95bcBzoCHu43vuSQkmZzdYo/ydSZt6zoPavbBLueTpgSbdXiDi827 +MVqOsYxGCb+kez0FoDSTgw== +-----END DSA PRIVATE KEY----- +-----BEGIN CERTIFICATE REQUEST----- +MIICUjCCAhECAQAwUjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUx +ITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDELMAkGA1UEAxMCQ0Ew +ggG0MIIBKQYFKw4DAgwwggEeAoGBAKc/boW/QWopffCfRxkwkJoJHdpqMx7FPYaW +sxXgUy6P4FmCc5A+dTGZR3pS+4Xk2aZ7OJtoioSbh8YetX6GS1NbWc9xZRmIbs5m +rmuINvvsKNzC16W75Sw5JkvamnAYlTeVEFYj9hXtugRe3jlP/bdDH7WkZW/NgBHk +cJVbUM1JAhUA9wcx7fpsBgPVhYocrJxl51BmZW8CgYBN30wDppGK9RlvUEYlmeVo +bzDjaeHls12YuyiGSPzemQQ/X4gMnHMkDSBduSqaPxiWJ+Rih8F7dGJT/GEnqHqR +CZ228U2cVA9YBu5JdAfOVX4jzhb2ytxaYQF+yXG1TfbcNCmHaPZeIJOz2/XkCWxB +F5WS6wG1c6Vqftgy7Q4CuAOBhAACgYAapll6iqz9XrZFlk2GCVcB+KihxWnH7IuH +vSLw9YUrJahcBHmbpvt494lF4gC5w3WPM+vXJofbusk4GoQEEsQNMDaah4m49uUq +AylOVFJJJXuirVJ+o+0TtOFDITEAl+YZZariXOD7tdOSOl9RLMPC6+daHKS9e68u +3enxhqnDGaAAMAkGBSsOAwIbBQADMAAwLQIVAJGVuFsG/0DBuSZ0jF7ypdU0/G0v +AhQfeF5BoMMDbX/kidUVpQ6gadPlZA== +-----END CERTIFICATE REQUEST----- +-----BEGIN CERTIFICATE----- +MIIBrjCCAWwCAQswCQYFKw4DAhsFADBTMQswCQYDVQQGEwJBVTETMBEGA1UECBMK +U29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMQww +CgYDVQQDEwNQQ0EwHhcNOTcwNjE1MDIxNDI5WhcNOTcwNzE1MDIxNDI5WjBSMQsw +CQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJu +ZXQgV2lkZ2l0cyBQdHkgTHRkMQswCQYDVQQDEwJDQTCBkjAJBgUrDgMCDAUAA4GE +AAKBgBqmWXqKrP1etkWWTYYJVwH4qKHFacfsi4e9IvD1hSslqFwEeZum+3j3iUXi +ALnDdY8z69cmh9u6yTgahAQSxA0wNpqHibj25SoDKU5UUkkle6KtUn6j7RO04UMh +MQCX5hllquJc4Pu105I6X1Esw8Lr51ocpL17ry7d6fGGqcMZMAkGBSsOAwIbBQAD +MQAwLgIVAJ4wtQsANPxHo7Q4IQZYsL12SKdbAhUAjJ9n38zxT+iai2164xS+LIfa +C1Q= +-----END CERTIFICATE----- + diff --git a/src/lib/libssl/test/dsa-pca.pem b/src/lib/libssl/test/dsa-pca.pem new file mode 100644 index 0000000000..e3641ad47e --- /dev/null +++ b/src/lib/libssl/test/dsa-pca.pem @@ -0,0 +1,49 @@ +-----BEGIN DSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CBC,F80EEEBEEA7386C4 + +GZ9zgFcHOlnhPoiSbVi/yXc9mGoj44A6IveD4UlpSEUt6Xbse3Fr0KHIUyQ3oGnS +mClKoAp/eOTb5Frhto85SzdsxYtac+X1v5XwdzAMy2KowHVk1N8A5jmE2OlkNPNt +of132MNlo2cyIRYaa35PPYBGNCmUm7YcYS8O90YtkrQZZTf4+2C4kllhMcdkQwkr +FWSWC8YOQ7w0LHb4cX1FejHHom9Nd/0PN3vn3UyySvfOqoR7nbXkrpHXmPIr0hxX +RcF0aXcV/CzZ1/nfXWQf4o3+oD0T22SDoVcZY60IzI0oIc3pNCbDV3uKNmgekrFd +qOUJ+QW8oWp7oefRx62iBfIeC8DZunohMXaWAQCU0sLQOR4yEdeUCnzCSywe0bG1 +diD0KYaEe+Yub1BQH4aLsBgDjardgpJRTQLq0DUvw0/QGO1irKTJzegEDNVBKrVn +V4AHOKT1CUKqvGNRP1UnccUDTF6miOAtaj/qpzra7sSk7dkGBvIEeFoAg84kfh9h +hVvF1YyzC9bwZepruoqoUwke/WdNIR5ymOVZ/4Liw0JdIOcq+atbdRX08niqIRkf +dsZrUj4leo3zdefYUQ7w4N2Ns37yDFq7 +-----END DSA PRIVATE KEY----- +-----BEGIN CERTIFICATE REQUEST----- +MIICVTCCAhMCAQAwUzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUx +ITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEMMAoGA1UEAxMDUENB +MIIBtTCCASkGBSsOAwIMMIIBHgKBgQCnP26Fv0FqKX3wn0cZMJCaCR3aajMexT2G +lrMV4FMuj+BZgnOQPnUxmUd6UvuF5NmmezibaIqEm4fGHrV+hktTW1nPcWUZiG7O +Zq5riDb77Cjcwtelu+UsOSZL2ppwGJU3lRBWI/YV7boEXt45T/23Qx+1pGVvzYAR +5HCVW1DNSQIVAPcHMe36bAYD1YWKHKycZedQZmVvAoGATd9MA6aRivUZb1BGJZnl +aG8w42nh5bNdmLsohkj83pkEP1+IDJxzJA0gXbkqmj8YlifkYofBe3RiU/xhJ6h6 +kQmdtvFNnFQPWAbuSXQHzlV+I84W9srcWmEBfslxtU323DQph2j2XiCTs9v15Als +QReVkusBtXOlan7YMu0OArgDgYUAAoGBAKbtuR5AdW+ICjCFe2ixjUiJJzM2IKwe +6NZEMXg39+HQ1UTPTmfLZLps+rZfolHDXuRKMXbGFdSF0nXYzotPCzi7GauwEJTZ +yr27ZZjA1C6apGSQ9GzuwNvZ4rCXystVEagAS8OQ4H3D4dWS17Zg31ICb5o4E5r0 +z09o/Uz46u0VoAAwCQYFKw4DAhsFAAMxADAuAhUArRubTxsbIXy3AhtjQ943AbNB +nSICFQCu+g1iW3jwF+gOcbroD4S/ZcvB3w== +-----END CERTIFICATE REQUEST----- +-----BEGIN CERTIFICATE----- +MIIC0zCCApECAQAwCQYFKw4DAhsFADBTMQswCQYDVQQGEwJBVTETMBEGA1UECBMK +U29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMQww +CgYDVQQDEwNQQ0EwHhcNOTcwNjE0MjI1NDQ1WhcNOTcwNzE0MjI1NDQ1WjBTMQsw +CQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJu +ZXQgV2lkZ2l0cyBQdHkgTHRkMQwwCgYDVQQDEwNQQ0EwggG1MIIBKQYFKw4DAgww +ggEeAoGBAKc/boW/QWopffCfRxkwkJoJHdpqMx7FPYaWsxXgUy6P4FmCc5A+dTGZ +R3pS+4Xk2aZ7OJtoioSbh8YetX6GS1NbWc9xZRmIbs5mrmuINvvsKNzC16W75Sw5 +JkvamnAYlTeVEFYj9hXtugRe3jlP/bdDH7WkZW/NgBHkcJVbUM1JAhUA9wcx7fps +BgPVhYocrJxl51BmZW8CgYBN30wDppGK9RlvUEYlmeVobzDjaeHls12YuyiGSPze +mQQ/X4gMnHMkDSBduSqaPxiWJ+Rih8F7dGJT/GEnqHqRCZ228U2cVA9YBu5JdAfO +VX4jzhb2ytxaYQF+yXG1TfbcNCmHaPZeIJOz2/XkCWxBF5WS6wG1c6Vqftgy7Q4C +uAOBhQACgYEApu25HkB1b4gKMIV7aLGNSIknMzYgrB7o1kQxeDf34dDVRM9OZ8tk +umz6tl+iUcNe5EoxdsYV1IXSddjOi08LOLsZq7AQlNnKvbtlmMDULpqkZJD0bO7A +29nisJfKy1URqABLw5DgfcPh1ZLXtmDfUgJvmjgTmvTPT2j9TPjq7RUwCQYFKw4D +AhsFAAMxADAuAhUAvtv6AkMolix1Jvy3UnVEIUqdCUICFQC+jq8P49mwrY9oJ24n +5rKUjNBhSg== +-----END CERTIFICATE----- + diff --git a/src/lib/libssl/test/p b/src/lib/libssl/test/p new file mode 100644 index 0000000000..b3de76751e --- /dev/null +++ b/src/lib/libssl/test/p @@ -0,0 +1,294 @@ +# +# test/Makefile.ssl +# + +DIR= test +TOP= .. +CC= cc +INCLUDES= -I../include +CFLAG= -g +INSTALLTOP= /usr/local/ssl +MAKEFILE= Makefile.ssl +MAKE= make -f $(MAKEFILE) +MAKEDEPEND= makedepend -f$(MAKEFILE) + +PEX_LIBS= +EX_LIBS= #-lnsl -lsocket + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile.ssl + +DLIBCRYPTO= ../libcrypto.a +DLIBSSL= ../libssl.a +LIBCRYPTO= -L.. -lcrypto +LIBSSL= -L.. -lssl + +BNTEST= bntest +EXPTEST= exptest +IDEATEST= ideatest +SHATEST= shatest +SHA1TEST= sha1test +MDC2TEST= mdc2test +RMDTEST= rmdtest +MD2TEST= md2test +MD5TEST= md5test +HMACTEST= hmactest +RC2TEST= rc2test +RC4TEST= rc4test +RC5TEST= rc5test +BFTEST= bftest +CASTTEST= casttest +DESTEST= destest +RANDTEST= randtest +DHTEST= dhtest +DSATEST= dsatest +METHTEST= methtest +SSLTEST= ssltest + +EXE= $(BNTEST) $(IDEATEST) $(MD2TEST) $(MD5TEST) $(HMACTEST) \ + $(RC2TEST) $(RC4TEST) $(RC5TEST) \ + $(DESTEST) $(SHATEST) $(SHA1TEST) $(MDC2TEST) $(RMDTEST) \ + $(RANDTEST) $(DHTEST) \ + $(BFTEST) $(CASTTEST) $(SSLTEST) $(EXPTEST) $(DSATEST) + +# $(METHTEST) + +OBJ= $(BNTEST).o $(IDEATEST).o $(MD2TEST).o $(MD5TEST).o $(HMACTEST).o \ + $(RC2TEST).o $(RC4TEST).o $(RC5TEST).o \ + $(DESTEST).o $(SHATEST).o $(SHA1TEST).o $(MDC2TEST).o $(RMDTEST).o \ + $(RANDTEST).o $(DHTEST).o $(CASTTEST).o \ + $(BFTEST).o $(SSLTEST).o $(DSATEST).o $(EXPTEST).o +SRC= $(BNTEST).c $(IDEATEST).c $(MD2TEST).c $(MD5TEST).c $(HMACTEST).c \ + $(RC2TEST).c $(RC4TEST).c $(RC5TEST).c \ + $(DESTEST).c $(SHATEST).c $(SHA1TEST).c $(MDC2TEST).c $(RMDTEST).c \ + $(RANDTEST).c $(DHTEST).c $(CASTTEST).c \ + $(BFTEST).c $(SSLTEST).c $(DSATEST).c $(EXPTEST).c + +EXHEADER= +HEADER= $(EXHEADER) + +ALL= $(GENERAL) $(SRC) $(HEADER) + +top: + (cd ..; $(MAKE) DIRS=$(DIR) all) + +all: exe + +exe: $(EXE) + +files: + perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO + +links: + /bin/rm -f Makefile + $(TOP)/util/point.sh Makefile.ssl Makefile ; + +errors: + +install: + +tags: + ctags $(SRC) + +tests: exe apps \ + test_des test_idea test_sha test_md5 test_hmac test_md2 test_mdc2 \ + test_rc2 test_rc4 test_rc5 test_bf test_cast \ + test_rand test_enc test_x509 test_rsa test_crl test_sid test_req \ + test_pkcs7 test_bn test_verify test_dh test_dsa test_reqgen \ + test_ss test_ssl test_ca + +apps: + @(cd ../apps; $(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' all) + +test_des: + #./$(DESTEST) + +test_idea: + ./$(IDEATEST) + +test_sha: + ./$(SHATEST) + ./$(SHA1TEST) + +test_mdc2: + ./$(MDC2TEST) + +test_md5: + ./$(MD5TEST) + +test_hmac: + ./$(HMACTEST) + +test_md2: + ./$(MD2TEST) + +test_rmd: + ./$(RMDTEST) + +test_bf: + ./$(BFTEST) + +test_cast: + ./$(CASTTEST) + +test_rc2: + ./$(RC2TEST) + +test_rc4: + ./$(RC4TEST) + +test_rc5: + ./$(RC5TEST) + +test_rand: + ./$(RANDTEST) + +test_enc: + @sh ./testenc + +test_x509: + echo test normal x509v1 certificate + sh ./tx509 2>/dev/null + echo test first x509v3 certificate + sh ./tx509 v3-cert1.pem 2>/dev/null + echo test second x509v3 certificate + sh ./tx509 v3-cert2.pem 2>/dev/null + +test_rsa: + @sh ./trsa 2>/dev/null + +test_crl: + @sh ./tcrl 2>/dev/null + +test_sid: + @sh ./tsid 2>/dev/null + +test_req: + @sh ./treq 2>/dev/null + @sh ./treq testreq2.pem 2>/dev/null + +test_pkcs7: + @sh ./tpkcs7 2>/dev/null + @sh ./tpkcs7d 2>/dev/null + +test_bn: + @echo 'test a^b%c implementations' + ./$(EXPTEST) + @echo starting big number library test, could take a while... + @(./$(BNTEST)|bc) | awk '{ \ +if ($$0 != "0") {print "error"; exit(1); } \ +if (((NR+1)%64) == 0) print NR+1," tests done"; }' + +test_verify: + @echo "The following command should have some OK's and some failures" + @echo "There are definitly a few expired certificates" + ../apps/ssleay verify -CApath ../certs ../certs/*.pem + +test_dh: + @echo "Generate as set of DH parameters" + ./$(DHTEST) + +test_dsa: + @echo "Generate as set of DSA parameters" + ./$(DSATEST) + +test_reqgen: + @echo "Generate and verify a certificate request" + @sh ./testgen + +test_ss: + @echo "Generate and certify a test certificate" + @sh ./testss + +test_ssl: + @echo "test SSL protocol" + @sh ./testssl + +test_ca: + @echo "Generate and certify a test certificate via the 'ca' program" + @sh ./testca + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(SRC) + +dclean: + perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff $(EXE) *.ss log + +$(DLIBSSL): + (cd ../ssl; $(MAKE)) + +$(DLIBCRYPTO): + (cd ../crypto; $(MAKE)) + +$(BNTEST): $(BNTEST).o $(DLIBCRYPTO) + $(CC) -o $(BNTEST) $(CFLAGS) $(BNTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(EXPTEST): $(EXPTEST).o $(DLIBCRYPTO) + $(CC) -o $(EXPTEST) $(CFLAGS) $(EXPTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(IDEATEST): $(IDEATEST).o $(DLIBCRYPTO) + $(CC) -o $(IDEATEST) $(CFLAGS) $(IDEATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(MD2TEST): $(MD2TEST).o $(DLIBCRYPTO) + $(CC) -o $(MD2TEST) $(CFLAGS) $(MD2TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(SHATEST): $(SHATEST).o $(DLIBCRYPTO) + $(CC) -o $(SHATEST) $(CFLAGS) $(SHATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(SHA1TEST): $(SHA1TEST).o $(DLIBCRYPTO) + $(CC) -o $(SHA1TEST) $(CFLAGS) $(SHA1TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(RMDTEST): $(RMDTEST).o $(DLIBCRYPTO) + $(CC) -o $(RMDTEST) $(CFLAGS) $(RMDTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(MDC2TEST): $(MDC2TEST).o $(DLIBCRYPTO) + $(CC) -o $(MDC2TEST) $(CFLAGS) $(MDC2TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(MD5TEST): $(MD5TEST).o $(DLIBCRYPTO) + $(CC) -o $(MD5TEST) $(CFLAGS) $(MD5TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(HMACTEST): $(HMACTEST).o $(DLIBCRYPTO) + $(CC) -o $(HMACTEST) $(CFLAGS) $(HMACTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(RC2TEST): $(RC2TEST).o $(DLIBCRYPTO) + $(CC) -o $(RC2TEST) $(CFLAGS) $(RC2TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(BFTEST): $(BFTEST).o $(DLIBCRYPTO) + $(CC) -o $(BFTEST) $(CFLAGS) $(BFTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(CASTTEST): $(CASTTEST).o $(DLIBCRYPTO) + $(CC) -o $(CASTTEST) $(CFLAGS) $(CASTTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(RC4TEST): $(RC4TEST).o $(DLIBCRYPTO) + $(CC) -o $(RC4TEST) $(CFLAGS) $(RC4TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(RC5TEST): $(RC5TEST).o $(DLIBCRYPTO) + $(CC) -o $(RC5TEST) $(CFLAGS) $(RC5TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(DESTEST): $(DESTEST).o $(DLIBCRYPTO) + $(CC) -o $(DESTEST) $(CFLAGS) $(DESTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(RANDTEST): $(RANDTEST).o $(DLIBCRYPTO) + $(CC) -o $(RANDTEST) $(CFLAGS) $(RANDTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(DHTEST): $(DHTEST).o $(DLIBCRYPTO) + $(CC) -o $(DHTEST) $(CFLAGS) $(DHTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(DSATEST): $(DSATEST).o $(DLIBCRYPTO) + $(CC) -o $(DSATEST) $(CFLAGS) $(DSATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(METHTEST): $(METHTEST).o $(DLIBCRYPTO) + $(CC) -o $(METHTEST) $(CFLAGS) $(METHTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) + +$(SSLTEST): $(SSLTEST).o $(DLIBSSL) $(DLIBCRYPTO) + $(CC) -o $(SSLTEST) $(CFLAGS) $(SSLTEST).o $(PEX_LIBS) $(LIBSSL) $(LIBCRYPTO) $(EX_LIBS) + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libssl/test/riptest b/src/lib/libssl/test/riptest new file mode 100644 index 0000000000..8685d0ce53 Binary files /dev/null and b/src/lib/libssl/test/riptest differ diff --git a/src/lib/libssl/test/test.txt b/src/lib/libssl/test/test.txt new file mode 100644 index 0000000000..c6d8d50ba9 --- /dev/null +++ b/src/lib/libssl/test/test.txt @@ -0,0 +1,31 @@ +#!/bin/sh + +test=./test.txt + +cat $0 >$test; + +for i in rc4 des-cfb des-ofb des-ecb des-cbc des-ede des-ede3 \ + des-cbc-ede des-cbc-ede3 idea-ecb idea-cfb idea-ofb idea-cbc +do + echo $i + ../apps/ssleay $i -e -k test < $test > $test.$i.cipher + ../apps/ssleay $i -d -k test < $test.$i.cipher >$test.$i.clear + cmp $test $test.$i.clear + if [ $? != 0 ] + then + exit 1 + else + /bin/rm $test.$i.cipher $test.$i.clear + fi + + echo $i base64 + ../apps/ssleay $i -a -e -k test < $test > $test.$i.cipher + ../apps/ssleay $i -a -d -k test < $test.$i.cipher >$test.$i.clear + cmp $test $test.$i.clear + if [ $? != 0 ] + then + exit 1 + else + /bin/rm $test.$i.cipher $test.$i.clear + fi +done diff --git a/src/lib/libssl/test/testkey.pem b/src/lib/libssl/test/testkey.pem new file mode 100644 index 0000000000..edd5a5773f --- /dev/null +++ b/src/lib/libssl/test/testkey.pem @@ -0,0 +1,2 @@ +-----BEGIN RSA PRIVATE KEY----- +-----END RSA PRIVATE KEY----- diff --git a/src/lib/libssl/test/testreq.pem b/src/lib/libssl/test/testreq.pem new file mode 100644 index 0000000000..1311fa7785 --- /dev/null +++ b/src/lib/libssl/test/testreq.pem @@ -0,0 +1,9 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIBQjCB7QIBADCBhzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQx +ETAPBgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdFNvZnQgUHR5IEx0ZDET +MBEGA1UEAxMKRXJpYyBZb3VuZzEfMB0GCSqGSIb3DQEJARYQZWF5QG1pbmNvbS5v +ei5hdTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDVKdT5QB2ZojtNQGjA/9J7s2o4 +RNkuSq8l377uWLAyMljtdkcoRsvUy5lZ997UDHFTbVFA038ZBrmw7l5EyHeXAgMB +AAGgADANBgkqhkiG9w0BAQQFAANBAKnaFr4u7PTdfmpjiX/H8Ho4UWGVRWUlvD2R +/D9yoTj7TN3uODx2BD0drErVBe/Zjv81vhH6Yo3cJO/hRS3A7jw= +-----END CERTIFICATE REQUEST----- -- cgit v1.2.3-55-g6feb