diff options
Diffstat (limited to 'src/lib/libcrypto')
197 files changed, 47393 insertions, 0 deletions
diff --git a/src/lib/libcrypto/Makefile.ssl b/src/lib/libcrypto/Makefile.ssl new file mode 100644 index 0000000000..efdbba38ac --- /dev/null +++ b/src/lib/libcrypto/Makefile.ssl | |||
@@ -0,0 +1,161 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= crypto | ||
6 | TOP= .. | ||
7 | CC= cc | ||
8 | INCLUDE= -I. -I../include | ||
9 | INCLUDES= -I.. -I../../include | ||
10 | CFLAG= -g | ||
11 | INSTALLTOP= /usr/local/ssl | ||
12 | MAKE= make -f Makefile.ssl | ||
13 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
14 | MAKEFILE= Makefile.ssl | ||
15 | RM= /bin/rm -f | ||
16 | AR= ar r | ||
17 | |||
18 | MAKE= make -f Makefile.ssl | ||
19 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
20 | MAKEFILE= Makefile.ssl | ||
21 | |||
22 | PEX_LIBS= | ||
23 | EX_LIBS= | ||
24 | |||
25 | CFLAGS= $(INCLUDE) $(CFLAG) -DCFLAGS=" \"$(CC) $(CFLAG)\" " | ||
26 | |||
27 | ERR=crypto | ||
28 | ERRC=cpt_err | ||
29 | |||
30 | LIBS= | ||
31 | |||
32 | SDIRS= md2 md5 sha mdc2 hmac ripemd \ | ||
33 | des rc2 rc4 rc5 idea bf cast \ | ||
34 | bn rsa dsa dh \ | ||
35 | buffer bio stack lhash rand err objects \ | ||
36 | evp pem x509 \ | ||
37 | asn1 conf txt_db pkcs7 | ||
38 | |||
39 | GENERAL=Makefile README | ||
40 | |||
41 | LIB= $(TOP)/libcrypto.a | ||
42 | LIBSRC= cryptlib.c mem.c cversion.c ex_data.c $(ERRC).c | ||
43 | LIBOBJ= cryptlib.o mem.o cversion.o ex_data.o $(ERRC).o | ||
44 | |||
45 | SRC= $(LIBSRC) | ||
46 | |||
47 | EXHEADER= crypto.h cryptall.h | ||
48 | HEADER= cryptlib.h date.h $(EXHEADER) | ||
49 | |||
50 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
51 | |||
52 | top: | ||
53 | @(cd ..; $(MAKE) DIRS=$(DIR) all) | ||
54 | |||
55 | all: date.h lib subdirs | ||
56 | |||
57 | date.h: ../Makefile.ssl ../VERSION | ||
58 | echo "#define DATE \"`date`\"" >date.h | ||
59 | |||
60 | subdirs: | ||
61 | @for i in $(SDIRS) ;\ | ||
62 | do \ | ||
63 | (cd $$i; echo "making all in $$i..."; \ | ||
64 | $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_MULW='${BN_MULW}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' all ); \ | ||
65 | done; | ||
66 | |||
67 | files: | ||
68 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
69 | @for i in $(SDIRS) ;\ | ||
70 | do \ | ||
71 | (cd $$i; echo "making 'files' in $$i..."; \ | ||
72 | $(MAKE) files ); \ | ||
73 | done; | ||
74 | |||
75 | links: | ||
76 | /bin/rm -f Makefile | ||
77 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
78 | $(TOP)/util/mklink.sh ../include $(HEADER) ; | ||
79 | $(TOP)/util/mklink.sh ../test $(TEST) ; | ||
80 | $(TOP)/util/mklink.sh ../apps $(APPS) ; | ||
81 | $(TOP)/util/point.sh Makefile.ssl Makefile; | ||
82 | @for i in $(SDIRS) ;\ | ||
83 | do \ | ||
84 | (cd $$i; echo "making links in $$i..."; \ | ||
85 | $(MAKE) links ); \ | ||
86 | done; | ||
87 | |||
88 | lib: $(LIBOBJ) | ||
89 | $(AR) $(LIB) $(LIBOBJ) | ||
90 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
91 | @touch lib | ||
92 | |||
93 | libs: | ||
94 | @for i in $(SDIRS) ;\ | ||
95 | do \ | ||
96 | (cd $$i; echo "making libs in $$i..."; \ | ||
97 | $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' AR='${AR}' lib ); \ | ||
98 | done; | ||
99 | |||
100 | tests: | ||
101 | @for i in $(SDIRS) ;\ | ||
102 | do \ | ||
103 | (cd $$i; echo "making tests in $$i..."; \ | ||
104 | $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' AR='${AR}' tests ); \ | ||
105 | done; | ||
106 | |||
107 | install: | ||
108 | @for i in $(EXHEADER) ;\ | ||
109 | do \ | ||
110 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
111 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
112 | done; | ||
113 | @for i in $(SDIRS) ;\ | ||
114 | do \ | ||
115 | (cd $$i; echo "making install in $$i..."; \ | ||
116 | $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' install ); \ | ||
117 | done; | ||
118 | |||
119 | lint: | ||
120 | @for i in $(SDIRS) ;\ | ||
121 | do \ | ||
122 | (cd $$i; echo "making lint in $$i..."; \ | ||
123 | $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' lint ); \ | ||
124 | done; | ||
125 | |||
126 | depend: | ||
127 | $(MAKEDEPEND) $(INCLUDE) $(PROGS) $(LIBSRC) | ||
128 | @for i in $(SDIRS) ;\ | ||
129 | do \ | ||
130 | (cd $$i; echo "making depend in $$i..."; \ | ||
131 | $(MAKE) MAKEFILE='${MAKEFILE}' INCLUDES='${INCLUDES}' MAKEDEPEND='${MAKEDEPEND}' depend ); \ | ||
132 | done; | ||
133 | |||
134 | clean: | ||
135 | /bin/rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
136 | @for i in $(SDIRS) ;\ | ||
137 | do \ | ||
138 | (cd $$i; echo "making clean in $$i..."; \ | ||
139 | $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' clean ); \ | ||
140 | done; | ||
141 | |||
142 | dclean: | ||
143 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
144 | mv -f Makefile.new $(MAKEFILE) | ||
145 | @for i in $(SDIRS) ;\ | ||
146 | do \ | ||
147 | (cd $$i; echo "making dclean in $$i..."; \ | ||
148 | $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' dclean ); \ | ||
149 | done; | ||
150 | |||
151 | errors: | ||
152 | perl ./err/err_code.pl -conf err/ssleay.ec *.c */*.c ../ssl/*.c ../rsaref/*.c | ||
153 | perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h | ||
154 | perl err/err_genc.pl -s $(ERR).h $(ERRC).c | ||
155 | @for i in $(SDIRS) ;\ | ||
156 | do \ | ||
157 | (cd $$i; echo "making errors in $$i..."; \ | ||
158 | $(MAKE) errors ); \ | ||
159 | done; | ||
160 | |||
161 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
diff --git a/src/lib/libcrypto/asn1/Makefile.ssl b/src/lib/libcrypto/asn1/Makefile.ssl new file mode 100644 index 0000000000..30751bd156 --- /dev/null +++ b/src/lib/libcrypto/asn1/Makefile.ssl | |||
@@ -0,0 +1,120 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/asn1/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= asn1 | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | ERR=asn1 | ||
19 | ERRC=asn1_err | ||
20 | GENERAL=Makefile README | ||
21 | TEST= | ||
22 | APPS= | ||
23 | |||
24 | LIB=$(TOP)/libcrypto.a | ||
25 | LIBSRC= a_object.c a_bitstr.c a_utctm.c a_int.c a_octet.c a_print.c \ | ||
26 | a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c \ | ||
27 | a_sign.c a_digest.c a_verify.c \ | ||
28 | x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c \ | ||
29 | x_name.c x_cinf.c x_x509.c x_crl.c x_info.c x_spki.c \ | ||
30 | d2i_r_pr.c i2d_r_pr.c d2i_r_pu.c i2d_r_pu.c \ | ||
31 | d2i_s_pr.c i2d_s_pr.c d2i_s_pu.c i2d_s_pu.c \ | ||
32 | d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\ | ||
33 | t_req.c t_x509.c t_pkey.c \ | ||
34 | p7_i_s.c p7_signi.c p7_signd.c p7_recip.c p7_enc_c.c p7_evp.c \ | ||
35 | p7_dgst.c p7_s_e.c p7_enc.c p7_lib.c \ | ||
36 | f_int.c f_string.c i2d_dhp.c i2d_dsap.c d2i_dhp.c d2i_dsap.c n_pkey.c \ | ||
37 | a_hdr.c x_pkey.c a_bool.c x_exten.c \ | ||
38 | asn1_par.c asn1_lib.c $(ERRC).c a_meth.c a_bytes.c \ | ||
39 | evp_asn1.c | ||
40 | LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_int.o a_octet.o a_print.o \ | ||
41 | a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o \ | ||
42 | a_sign.o a_digest.o a_verify.o \ | ||
43 | x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o \ | ||
44 | x_name.o x_cinf.o x_x509.o x_crl.o x_info.o x_spki.o \ | ||
45 | d2i_r_pr.o i2d_r_pr.o d2i_r_pu.o i2d_r_pu.o \ | ||
46 | d2i_s_pr.o i2d_s_pr.o d2i_s_pu.o i2d_s_pu.o \ | ||
47 | d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \ | ||
48 | t_req.o t_x509.o t_pkey.o \ | ||
49 | p7_i_s.o p7_signi.o p7_signd.o p7_recip.o p7_enc_c.o p7_evp.o \ | ||
50 | p7_dgst.o p7_s_e.o p7_enc.o p7_lib.o \ | ||
51 | f_int.o f_string.o i2d_dhp.o i2d_dsap.o d2i_dhp.o d2i_dsap.o n_pkey.o \ | ||
52 | a_hdr.o x_pkey.o a_bool.o x_exten.o \ | ||
53 | asn1_par.o asn1_lib.o $(ERRC).o a_meth.o a_bytes.o \ | ||
54 | evp_asn1.o | ||
55 | |||
56 | SRC= $(LIBSRC) | ||
57 | |||
58 | EXHEADER= asn1.h asn1_mac.h | ||
59 | HEADER= $(EXHEADER) | ||
60 | |||
61 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
62 | |||
63 | top: | ||
64 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
65 | |||
66 | test: test.c | ||
67 | cc -g -I../../include -c test.c | ||
68 | cc -g -I../../include -o test test.o -L../.. -lcrypto | ||
69 | |||
70 | pk: pk.c | ||
71 | cc -g -I../../include -c pk.c | ||
72 | cc -g -I../../include -o pk pk.o -L../.. -lcrypto | ||
73 | |||
74 | all: lib | ||
75 | |||
76 | lib: $(LIBOBJ) | ||
77 | $(AR) $(LIB) $(LIBOBJ) | ||
78 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
79 | @touch lib | ||
80 | |||
81 | files: | ||
82 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
83 | |||
84 | links: | ||
85 | /bin/rm -f Makefile | ||
86 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
87 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
88 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
89 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
90 | |||
91 | install: | ||
92 | @for i in $(EXHEADER) ; \ | ||
93 | do \ | ||
94 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
95 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
96 | done; | ||
97 | |||
98 | tags: | ||
99 | ctags $(SRC) | ||
100 | |||
101 | tests: | ||
102 | |||
103 | lint: | ||
104 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
105 | |||
106 | depend: | ||
107 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
108 | |||
109 | dclean: | ||
110 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
111 | mv -f Makefile.new $(MAKEFILE) | ||
112 | |||
113 | clean: | ||
114 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
115 | |||
116 | errors: | ||
117 | perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h | ||
118 | perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c | ||
119 | |||
120 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | /* crypto/asn1/a_bmp.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "asn1.h" | ||
62 | |||
63 | /* ASN1err(ASN1_F_D2I_ASN1_INTEGER,ASN1_R_EXPECTING_AN_INTEGER); | ||
64 | */ | ||
65 | |||
66 | int i2d_ASN1_BMPSTRING(a, pp) | ||
67 | ASN1_BMPSTRING *a; | ||
68 | unsigned char **pp; | ||
69 | { | ||
70 | return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, | ||
71 | V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL)); | ||
72 | } | ||
73 | |||
74 | ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(a, pp, length) | ||
75 | ASN1_BMPSTRING **a; | ||
76 | unsigned char **pp; | ||
77 | long length; | ||
78 | { | ||
79 | ASN1_BMPSTRING *ret=NULL; | ||
80 | |||
81 | ret=(ASN1_BMPSTRING *)d2i_ASN1_bytes((ASN1_STRING **)a, | ||
82 | pp,length,V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL); | ||
83 | if (ret == NULL) | ||
84 | { | ||
85 | ASN1err(ASN1_F_D2I_ASN1_BMPSTRING,ASN1_R_ERROR_STACK); | ||
86 | return(NULL); | ||
87 | } | ||
88 | return(ret); | ||
89 | } | ||
90 | |||
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 @@ | |||
1 | /* Error codes for the ASN1 functions. */ | ||
2 | |||
3 | /* Function codes. */ | ||
4 | #define ASN1_F_A2D_ASN1_OBJECT 100 | ||
5 | #define ASN1_F_A2I_ASN1_INTEGER 101 | ||
6 | #define ASN1_F_A2I_ASN1_STRING 102 | ||
7 | #define ASN1_F_ASN1_COLLATE_PRIMATIVE 103 | ||
8 | #define ASN1_F_ASN1_D2I_BIO 104 | ||
9 | #define ASN1_F_ASN1_D2I_FP 105 | ||
10 | #define ASN1_F_ASN1_DUP 106 | ||
11 | #define ASN1_F_ASN1_GET_OBJECT 107 | ||
12 | #define ASN1_F_ASN1_HEADER_NEW 108 | ||
13 | #define ASN1_F_ASN1_I2D_BIO 109 | ||
14 | #define ASN1_F_ASN1_I2D_FP 110 | ||
15 | #define ASN1_F_ASN1_INTEGER_SET 111 | ||
16 | #define ASN1_F_ASN1_INTEGER_TO_BN 112 | ||
17 | #define ASN1_F_ASN1_OBJECT_NEW 113 | ||
18 | #define ASN1_F_ASN1_SIGN 114 | ||
19 | #define ASN1_F_ASN1_STRING_NEW 115 | ||
20 | #define ASN1_F_ASN1_STRING_TYPE_NEW 116 | ||
21 | #define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 117 | ||
22 | #define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 118 | ||
23 | #define ASN1_F_ASN1_TYPE_NEW 119 | ||
24 | #define ASN1_F_ASN1_UTCTIME_NEW 120 | ||
25 | #define ASN1_F_ASN1_VERIFY 121 | ||
26 | #define ASN1_F_BN_TO_ASN1_INTEGER 122 | ||
27 | #define ASN1_F_D2I_ASN1_BIT_STRING 123 | ||
28 | #define ASN1_F_D2I_ASN1_BMPSTRING 124 | ||
29 | #define ASN1_F_D2I_ASN1_BOOLEAN 125 | ||
30 | #define ASN1_F_D2I_ASN1_BYTES 126 | ||
31 | #define ASN1_F_D2I_ASN1_HEADER 127 | ||
32 | #define ASN1_F_D2I_ASN1_INTEGER 128 | ||
33 | #define ASN1_F_D2I_ASN1_OBJECT 129 | ||
34 | #define ASN1_F_D2I_ASN1_OCTET_STRING 130 | ||
35 | #define ASN1_F_D2I_ASN1_PRINT_TYPE 131 | ||
36 | #define ASN1_F_D2I_ASN1_SET 132 | ||
37 | #define ASN1_F_D2I_ASN1_TYPE 133 | ||
38 | #define ASN1_F_D2I_ASN1_TYPE_BYTES 134 | ||
39 | #define ASN1_F_D2I_ASN1_UTCTIME 135 | ||
40 | #define ASN1_F_D2I_DHPARAMS 136 | ||
41 | #define ASN1_F_D2I_DSAPARAMS 137 | ||
42 | #define ASN1_F_D2I_DSAPRIVATEKEY 138 | ||
43 | #define ASN1_F_D2I_DSAPUBLICKEY 139 | ||
44 | #define ASN1_F_D2I_NETSCAPE_PKEY 140 | ||
45 | #define ASN1_F_D2I_NETSCAPE_RSA 141 | ||
46 | #define ASN1_F_D2I_NETSCAPE_RSA_2 142 | ||
47 | #define ASN1_F_D2I_NETSCAPE_SPKAC 143 | ||
48 | #define ASN1_F_D2I_NETSCAPE_SPKI 144 | ||
49 | #define ASN1_F_D2I_PKCS7 145 | ||
50 | #define ASN1_F_D2I_PKCS7_DIGEST 146 | ||
51 | #define ASN1_F_D2I_PKCS7_ENCRYPT 147 | ||
52 | #define ASN1_F_D2I_PKCS7_ENC_CONTENT 148 | ||
53 | #define ASN1_F_D2I_PKCS7_ENVELOPE 149 | ||
54 | #define ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL 150 | ||
55 | #define ASN1_F_D2I_PKCS7_RECIP_INFO 151 | ||
56 | #define ASN1_F_D2I_PKCS7_SIGNED 152 | ||
57 | #define ASN1_F_D2I_PKCS7_SIGNER_INFO 153 | ||
58 | #define ASN1_F_D2I_PKCS7_SIGN_ENVELOPE 154 | ||
59 | #define ASN1_F_D2I_PRIVATEKEY 155 | ||
60 | #define ASN1_F_D2I_PUBLICKEY 156 | ||
61 | #define ASN1_F_D2I_RSAPRIVATEKEY 157 | ||
62 | #define ASN1_F_D2I_RSAPUBLICKEY 158 | ||
63 | #define ASN1_F_D2I_X509 159 | ||
64 | #define ASN1_F_D2I_X509_ALGOR 160 | ||
65 | #define ASN1_F_D2I_X509_ATTRIBUTE 161 | ||
66 | #define ASN1_F_D2I_X509_CINF 162 | ||
67 | #define ASN1_F_D2I_X509_CRL 163 | ||
68 | #define ASN1_F_D2I_X509_CRL_INFO 164 | ||
69 | #define ASN1_F_D2I_X509_EXTENSION 165 | ||
70 | #define ASN1_F_D2I_X509_KEY 166 | ||
71 | #define ASN1_F_D2I_X509_NAME 167 | ||
72 | #define ASN1_F_D2I_X509_NAME_ENTRY 168 | ||
73 | #define ASN1_F_D2I_X509_PKEY 169 | ||
74 | #define ASN1_F_D2I_X509_PUBKEY 170 | ||
75 | #define ASN1_F_D2I_X509_REQ 171 | ||
76 | #define ASN1_F_D2I_X509_REQ_INFO 172 | ||
77 | #define ASN1_F_D2I_X509_REVOKED 173 | ||
78 | #define ASN1_F_D2I_X509_SIG 174 | ||
79 | #define ASN1_F_D2I_X509_VAL 175 | ||
80 | #define ASN1_F_I2D_ASN1_HEADER 176 | ||
81 | #define ASN1_F_I2D_DHPARAMS 177 | ||
82 | #define ASN1_F_I2D_DSAPARAMS 178 | ||
83 | #define ASN1_F_I2D_DSAPRIVATEKEY 179 | ||
84 | #define ASN1_F_I2D_DSAPUBLICKEY 180 | ||
85 | #define ASN1_F_I2D_NETSCAPE_RSA 181 | ||
86 | #define ASN1_F_I2D_PKCS7 182 | ||
87 | #define ASN1_F_I2D_PRIVATEKEY 183 | ||
88 | #define ASN1_F_I2D_PUBLICKEY 184 | ||
89 | #define ASN1_F_I2D_RSAPRIVATEKEY 185 | ||
90 | #define ASN1_F_I2D_RSAPUBLICKEY 186 | ||
91 | #define ASN1_F_I2D_X509_ATTRIBUTE 187 | ||
92 | #define ASN1_F_I2T_ASN1_OBJECT 188 | ||
93 | #define ASN1_F_NETSCAPE_PKEY_NEW 189 | ||
94 | #define ASN1_F_NETSCAPE_SPKAC_NEW 190 | ||
95 | #define ASN1_F_NETSCAPE_SPKI_NEW 191 | ||
96 | #define ASN1_F_PKCS7_DIGEST_NEW 192 | ||
97 | #define ASN1_F_PKCS7_ENCRYPT_NEW 193 | ||
98 | #define ASN1_F_PKCS7_ENC_CONTENT_NEW 194 | ||
99 | #define ASN1_F_PKCS7_ENVELOPE_NEW 195 | ||
100 | #define ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW 196 | ||
101 | #define ASN1_F_PKCS7_NEW 197 | ||
102 | #define ASN1_F_PKCS7_RECIP_INFO_NEW 198 | ||
103 | #define ASN1_F_PKCS7_SIGNED_NEW 199 | ||
104 | #define ASN1_F_PKCS7_SIGNER_INFO_NEW 200 | ||
105 | #define ASN1_F_PKCS7_SIGN_ENVELOPE_NEW 201 | ||
106 | #define ASN1_F_X509_ALGOR_NEW 202 | ||
107 | #define ASN1_F_X509_ATTRIBUTE_NEW 203 | ||
108 | #define ASN1_F_X509_CINF_NEW 204 | ||
109 | #define ASN1_F_X509_CRL_INFO_NEW 205 | ||
110 | #define ASN1_F_X509_CRL_NEW 206 | ||
111 | #define ASN1_F_X509_DHPARAMS_NEW 207 | ||
112 | #define ASN1_F_X509_EXTENSION_NEW 208 | ||
113 | #define ASN1_F_X509_INFO_NEW 209 | ||
114 | #define ASN1_F_X509_KEY_NEW 210 | ||
115 | #define ASN1_F_X509_NAME_ENTRY_NEW 211 | ||
116 | #define ASN1_F_X509_NAME_NEW 212 | ||
117 | #define ASN1_F_X509_NEW 213 | ||
118 | #define ASN1_F_X509_PKEY_NEW 214 | ||
119 | #define ASN1_F_X509_PUBKEY_NEW 215 | ||
120 | #define ASN1_F_X509_REQ_INFO_NEW 216 | ||
121 | #define ASN1_F_X509_REQ_NEW 217 | ||
122 | #define ASN1_F_X509_REVOKED_NEW 218 | ||
123 | #define ASN1_F_X509_SIG_NEW 219 | ||
124 | #define ASN1_F_X509_VAL_FREE 220 | ||
125 | #define ASN1_F_X509_VAL_NEW 221 | ||
126 | |||
127 | /* Reason codes. */ | ||
128 | #define ASN1_R_BAD_CLASS 100 | ||
129 | #define ASN1_R_BAD_GET_OBJECT 101 | ||
130 | #define ASN1_R_BAD_OBJECT_HEADER 102 | ||
131 | #define ASN1_R_BAD_PASSWORD_READ 103 | ||
132 | #define ASN1_R_BAD_PKCS7_CONTENT 104 | ||
133 | #define ASN1_R_BAD_PKCS7_TYPE 105 | ||
134 | #define ASN1_R_BAD_TAG 106 | ||
135 | #define ASN1_R_BAD_TYPE 107 | ||
136 | #define ASN1_R_BN_LIB 108 | ||
137 | #define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 109 | ||
138 | #define ASN1_R_BUFFER_TOO_SMALL 110 | ||
139 | #define ASN1_R_DATA_IS_WRONG 111 | ||
140 | #define ASN1_R_DECODING_ERROR 112 | ||
141 | #define ASN1_R_ERROR_STACK 113 | ||
142 | #define ASN1_R_EXPECTING_AN_INTEGER 114 | ||
143 | #define ASN1_R_EXPECTING_AN_OBJECT 115 | ||
144 | #define ASN1_R_EXPECTING_AN_OCTET_STRING 116 | ||
145 | #define ASN1_R_EXPECTING_A_BIT_STRING 117 | ||
146 | #define ASN1_R_EXPECTING_A_BOOLEAN 118 | ||
147 | #define ASN1_R_EXPECTING_A_SEQUENCE 119 | ||
148 | #define ASN1_R_EXPECTING_A_UTCTIME 120 | ||
149 | #define ASN1_R_FIRST_NUM_TOO_LARGE 121 | ||
150 | #define ASN1_R_HEADER_TOO_LONG 122 | ||
151 | #define ASN1_R_INVALID_DIGIT 123 | ||
152 | #define ASN1_R_INVALID_SEPARATOR 124 | ||
153 | #define ASN1_R_INVALID_TIME_FORMAT 125 | ||
154 | #define ASN1_R_IV_TOO_LARGE 126 | ||
155 | #define ASN1_R_LENGTH_ERROR 127 | ||
156 | #define ASN1_R_LENGTH_MISMATCH 128 | ||
157 | #define ASN1_R_MISSING_EOS 129 | ||
158 | #define ASN1_R_MISSING_SECOND_NUMBER 130 | ||
159 | #define ASN1_R_NON_HEX_CHARACTERS 131 | ||
160 | #define ASN1_R_NOT_ENOUGH_DATA 132 | ||
161 | #define ASN1_R_ODD_NUMBER_OF_CHARS 133 | ||
162 | #define ASN1_R_PARSING 134 | ||
163 | #define ASN1_R_PRIVATE_KEY_HEADER_MISSING 135 | ||
164 | #define ASN1_R_SECOND_NUMBER_TOO_LARGE 136 | ||
165 | #define ASN1_R_SHORT_LINE 137 | ||
166 | #define ASN1_R_STRING_TOO_SHORT 138 | ||
167 | #define ASN1_R_TAG_VALUE_TOO_HIGH 139 | ||
168 | #define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 140 | ||
169 | #define ASN1_R_TOO_LONG 141 | ||
170 | #define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 142 | ||
171 | #define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 143 | ||
172 | #define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 144 | ||
173 | #define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 145 | ||
174 | #define ASN1_R_UNKNOWN_OBJECT_TYPE 146 | ||
175 | #define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 147 | ||
176 | #define ASN1_R_UNSUPPORTED_CIPHER 148 | ||
177 | #define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 149 | ||
178 | #define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 150 | ||
179 | #define ASN1_R_UTCTIME_TOO_LONG 151 | ||
180 | #define ASN1_R_WRONG_PRINTABLE_TYPE 152 | ||
181 | #define ASN1_R_WRONG_TAG 153 | ||
182 | #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 @@ | |||
1 | /* crypto/asn1/d2i_dhp.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "bn.h" | ||
62 | #include "dh.h" | ||
63 | #include "objects.h" | ||
64 | #include "asn1_mac.h" | ||
65 | |||
66 | /* | ||
67 | * ASN1err(ASN1_F_D2I_DHPARAMS,ASN1_R_LENGTH_MISMATCH); | ||
68 | * ASN1err(ASN1_F_I2D_DHPARAMS,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); | ||
69 | */ | ||
70 | |||
71 | DH *d2i_DHparams(a,pp,length) | ||
72 | DH **a; | ||
73 | unsigned char **pp; | ||
74 | long length; | ||
75 | { | ||
76 | int i=ASN1_R_ERROR_STACK; | ||
77 | ASN1_INTEGER *bs=NULL; | ||
78 | long v=0; | ||
79 | M_ASN1_D2I_vars(a,DH *,DH_new); | ||
80 | |||
81 | M_ASN1_D2I_Init(); | ||
82 | M_ASN1_D2I_start_sequence(); | ||
83 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
84 | if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn; | ||
85 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
86 | if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) goto err_bn; | ||
87 | |||
88 | if (!M_ASN1_D2I_end_sequence()) | ||
89 | { | ||
90 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
91 | for (i=0; i<bs->length; i++) | ||
92 | v=(v<<8)|(bs->data[i]); | ||
93 | ret->length=(int)v; | ||
94 | } | ||
95 | |||
96 | ASN1_BIT_STRING_free(bs); | ||
97 | |||
98 | M_ASN1_D2I_Finish_2(a); | ||
99 | |||
100 | err_bn: | ||
101 | i=ERR_R_BN_LIB; | ||
102 | err: | ||
103 | ASN1err(ASN1_F_D2I_DHPARAMS,i); | ||
104 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) DH_free(ret); | ||
105 | if (bs != NULL) ASN1_BIT_STRING_free(bs); | ||
106 | return(NULL); | ||
107 | } | ||
108 | |||
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 @@ | |||
1 | /* crypto/asn1/d2i_dsap.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "bn.h" | ||
62 | #include "dsa.h" | ||
63 | #include "objects.h" | ||
64 | #include "asn1_mac.h" | ||
65 | |||
66 | /* | ||
67 | * ASN1err(ASN1_F_D2I_DSAPARAMS,ASN1_R_LENGTH_MISMATCH); | ||
68 | * ASN1err(ASN1_F_I2D_DSAPARAMS,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); | ||
69 | */ | ||
70 | |||
71 | DSA *d2i_DSAparams(a,pp,length) | ||
72 | DSA **a; | ||
73 | unsigned char **pp; | ||
74 | long length; | ||
75 | { | ||
76 | int i=ASN1_R_ERROR_STACK; | ||
77 | ASN1_INTEGER *bs=NULL; | ||
78 | M_ASN1_D2I_vars(a,DSA *,DSA_new); | ||
79 | |||
80 | M_ASN1_D2I_Init(); | ||
81 | M_ASN1_D2I_start_sequence(); | ||
82 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
83 | if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn; | ||
84 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
85 | if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) goto err_bn; | ||
86 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
87 | if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) goto err_bn; | ||
88 | |||
89 | ASN1_BIT_STRING_free(bs); | ||
90 | |||
91 | M_ASN1_D2I_Finish_2(a); | ||
92 | |||
93 | err_bn: | ||
94 | i=ERR_R_BN_LIB; | ||
95 | err: | ||
96 | ASN1err(ASN1_F_D2I_DSAPARAMS,i); | ||
97 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) DSA_free(ret); | ||
98 | if (bs != NULL) ASN1_BIT_STRING_free(bs); | ||
99 | return(NULL); | ||
100 | } | ||
101 | |||
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 @@ | |||
1 | /* crypto/asn1/d2i_r_pr.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "bn.h" | ||
62 | #include "rsa.h" | ||
63 | #include "objects.h" | ||
64 | #include "asn1_mac.h" | ||
65 | |||
66 | /* | ||
67 | * ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,ASN1_R_LENGTH_MISMATCH); | ||
68 | * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); | ||
69 | * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_PARSING); | ||
70 | */ | ||
71 | |||
72 | static ASN1_METHOD method={ | ||
73 | (int (*)()) i2d_RSAPrivateKey, | ||
74 | (char *(*)())d2i_RSAPrivateKey, | ||
75 | (char *(*)())RSA_new, | ||
76 | (void (*)()) RSA_free}; | ||
77 | |||
78 | ASN1_METHOD *RSAPrivateKey_asn1_meth() | ||
79 | { | ||
80 | return(&method); | ||
81 | } | ||
82 | |||
83 | RSA *d2i_RSAPrivateKey(a,pp,length) | ||
84 | RSA **a; | ||
85 | unsigned char **pp; | ||
86 | long length; | ||
87 | { | ||
88 | int i=ASN1_R_PARSING; | ||
89 | ASN1_INTEGER *bs=NULL; | ||
90 | M_ASN1_D2I_vars(a,RSA *,RSA_new); | ||
91 | |||
92 | M_ASN1_D2I_Init(); | ||
93 | M_ASN1_D2I_start_sequence(); | ||
94 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
95 | if (bs->length == 0) | ||
96 | ret->version=0; | ||
97 | else ret->version=bs->data[0]; | ||
98 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
99 | if ((ret->n=BN_bin2bn(bs->data,bs->length,ret->n)) == NULL) goto err_bn; | ||
100 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
101 | if ((ret->e=BN_bin2bn(bs->data,bs->length,ret->e)) == NULL) goto err_bn; | ||
102 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
103 | if ((ret->d=BN_bin2bn(bs->data,bs->length,ret->d)) == NULL) goto err_bn; | ||
104 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
105 | if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn; | ||
106 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
107 | if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) goto err_bn; | ||
108 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
109 | if ((ret->dmp1=BN_bin2bn(bs->data,bs->length,ret->dmp1)) == NULL) | ||
110 | goto err_bn; | ||
111 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
112 | if ((ret->dmq1=BN_bin2bn(bs->data,bs->length,ret->dmq1)) == NULL) | ||
113 | goto err_bn; | ||
114 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
115 | if ((ret->iqmp=BN_bin2bn(bs->data,bs->length,ret->iqmp)) == NULL) | ||
116 | goto err_bn; | ||
117 | |||
118 | ASN1_INTEGER_free(bs); | ||
119 | |||
120 | M_ASN1_D2I_Finish_2(a); | ||
121 | err_bn: | ||
122 | i=ERR_R_BN_LIB; | ||
123 | err: | ||
124 | ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,i); | ||
125 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) RSA_free(ret); | ||
126 | if (bs != NULL) ASN1_INTEGER_free(bs); | ||
127 | return(NULL); | ||
128 | } | ||
129 | |||
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 @@ | |||
1 | /* crypto/asn1/d2i_r_pu.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "bn.h" | ||
62 | #include "rsa.h" | ||
63 | #include "objects.h" | ||
64 | #include "asn1_mac.h" | ||
65 | |||
66 | /* | ||
67 | * ASN1err(ASN1_F_D2I_RSAPUBLICKEY,ASN1_R_LENGTH_MISMATCH); | ||
68 | * ASN1err(ASN1_F_I2D_RSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); | ||
69 | */ | ||
70 | |||
71 | RSA *d2i_RSAPublicKey(a,pp,length) | ||
72 | RSA **a; | ||
73 | unsigned char **pp; | ||
74 | long length; | ||
75 | { | ||
76 | int i=ASN1_R_PARSING; | ||
77 | ASN1_INTEGER *bs=NULL; | ||
78 | M_ASN1_D2I_vars(a,RSA *,RSA_new); | ||
79 | |||
80 | M_ASN1_D2I_Init(); | ||
81 | M_ASN1_D2I_start_sequence(); | ||
82 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
83 | if ((ret->n=BN_bin2bn(bs->data,bs->length,ret->n)) == NULL) goto err_bn; | ||
84 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
85 | if ((ret->e=BN_bin2bn(bs->data,bs->length,ret->e)) == NULL) goto err_bn; | ||
86 | |||
87 | ASN1_INTEGER_free(bs); | ||
88 | bs=NULL; | ||
89 | |||
90 | M_ASN1_D2I_Finish_2(a); | ||
91 | |||
92 | err_bn: | ||
93 | i=ERR_R_BN_LIB; | ||
94 | err: | ||
95 | ASN1err(ASN1_F_D2I_RSAPUBLICKEY,i); | ||
96 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) RSA_free(ret); | ||
97 | if (bs != NULL) ASN1_INTEGER_free(bs); | ||
98 | return(NULL); | ||
99 | } | ||
100 | |||
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 @@ | |||
1 | /* crypto/asn1/d2i_s_pr.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* Origional version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "bn.h" | ||
64 | #include "dsa.h" | ||
65 | #include "objects.h" | ||
66 | #include "asn1_mac.h" | ||
67 | |||
68 | /* | ||
69 | * ASN1err(ASN1_F_D2I_DSAPRIVATEKEY,ASN1_R_LENGTH_MISMATCH); | ||
70 | * ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); | ||
71 | * ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ASN1_R_PARSING); | ||
72 | */ | ||
73 | |||
74 | DSA *d2i_DSAPrivateKey(a,pp,length) | ||
75 | DSA **a; | ||
76 | unsigned char **pp; | ||
77 | long length; | ||
78 | { | ||
79 | int i=ASN1_R_PARSING; | ||
80 | ASN1_INTEGER *bs=NULL; | ||
81 | M_ASN1_D2I_vars(a,DSA *,DSA_new); | ||
82 | |||
83 | M_ASN1_D2I_Init(); | ||
84 | M_ASN1_D2I_start_sequence(); | ||
85 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
86 | if (bs->length == 0) | ||
87 | ret->version=0; | ||
88 | else ret->version=bs->data[0]; | ||
89 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
90 | if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn; | ||
91 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
92 | if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) goto err_bn; | ||
93 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
94 | if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) goto err_bn; | ||
95 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
96 | if ((ret->pub_key=BN_bin2bn(bs->data,bs->length,ret->pub_key)) | ||
97 | == NULL) goto err_bn; | ||
98 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
99 | if ((ret->priv_key=BN_bin2bn(bs->data,bs->length,ret->priv_key)) | ||
100 | == NULL) goto err_bn; | ||
101 | |||
102 | ASN1_INTEGER_free(bs); | ||
103 | |||
104 | M_ASN1_D2I_Finish_2(a); | ||
105 | err_bn: | ||
106 | i=ERR_R_BN_LIB; | ||
107 | err: | ||
108 | ASN1err(ASN1_F_D2I_DSAPRIVATEKEY,i); | ||
109 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) DSA_free(ret); | ||
110 | if (bs != NULL) ASN1_INTEGER_free(bs); | ||
111 | return(NULL); | ||
112 | } | ||
113 | |||
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 @@ | |||
1 | /* crypto/asn1/d2i_s_pu.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* Origional version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "bn.h" | ||
64 | #include "dsa.h" | ||
65 | #include "objects.h" | ||
66 | #include "asn1_mac.h" | ||
67 | |||
68 | /* | ||
69 | * ASN1err(ASN1_F_D2I_DSAPUBLICKEY,ASN1_R_LENGTH_MISMATCH); | ||
70 | * ASN1err(ASN1_F_I2D_DSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); | ||
71 | */ | ||
72 | |||
73 | DSA *d2i_DSAPublicKey(a,pp,length) | ||
74 | DSA **a; | ||
75 | unsigned char **pp; | ||
76 | long length; | ||
77 | { | ||
78 | int i=ASN1_R_PARSING; | ||
79 | ASN1_INTEGER *bs=NULL; | ||
80 | M_ASN1_D2I_vars(a,DSA *,DSA_new); | ||
81 | |||
82 | M_ASN1_D2I_Init(); | ||
83 | if ((length != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) | ||
84 | == (V_ASN1_UNIVERSAL|(V_ASN1_INTEGER)))) | ||
85 | { | ||
86 | c.slen=length; | ||
87 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
88 | if ((ret->pub_key=BN_bin2bn(bs->data,bs->length,ret->pub_key)) | ||
89 | == NULL) | ||
90 | goto err_bn; | ||
91 | ret->write_params=0; | ||
92 | } | ||
93 | else | ||
94 | { | ||
95 | M_ASN1_D2I_start_sequence(); | ||
96 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
97 | if ((ret->pub_key=BN_bin2bn(bs->data,bs->length,ret->pub_key)) | ||
98 | == NULL) | ||
99 | goto err_bn; | ||
100 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
101 | if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) | ||
102 | goto err_bn; | ||
103 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
104 | if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) | ||
105 | goto err_bn; | ||
106 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
107 | if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) | ||
108 | goto err_bn; | ||
109 | |||
110 | ret->write_params=1; | ||
111 | } | ||
112 | |||
113 | ASN1_INTEGER_free(bs); | ||
114 | bs=NULL; | ||
115 | M_ASN1_D2I_Finish_2(a); | ||
116 | err_bn: | ||
117 | i=ERR_R_BN_LIB; | ||
118 | err: | ||
119 | ASN1err(ASN1_F_D2I_DSAPUBLICKEY,i); | ||
120 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) DSA_free(ret); | ||
121 | if (bs != NULL) ASN1_INTEGER_free(bs); | ||
122 | return(NULL); | ||
123 | } | ||
124 | |||
diff --git a/src/lib/libcrypto/asn1/f.c b/src/lib/libcrypto/asn1/f.c new file mode 100644 index 0000000000..2ab3a262ac --- /dev/null +++ b/src/lib/libcrypto/asn1/f.c | |||
@@ -0,0 +1,80 @@ | |||
1 | /* crypto/asn1/f.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | #include <stdio.h> | ||
59 | #include "asn1.h" | ||
60 | #include "err.h" | ||
61 | |||
62 | main() | ||
63 | { | ||
64 | ASN1_TYPE *at; | ||
65 | char buf[512]; | ||
66 | int n; | ||
67 | long l; | ||
68 | |||
69 | at=ASN1_TYPE_new(); | ||
70 | |||
71 | n=ASN1_TYPE_set_int_octetstring(at,98736,"01234567",8); | ||
72 | printf("%d\n",n); | ||
73 | n=ASN1_TYPE_get_int_octetstring(at,&l,buf,8); | ||
74 | buf[8]='\0'; | ||
75 | printf("%ld %d %d\n",l,n,buf[8]); | ||
76 | buf[8]='\0'; | ||
77 | printf("%s\n",buf); | ||
78 | ERR_load_crypto_strings(); | ||
79 | ERR_print_errors_fp(stderr); | ||
80 | } | ||
diff --git a/src/lib/libcrypto/asn1/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 @@ | |||
1 | /* crypto/asn1/i2d_dhp.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "bn.h" | ||
62 | #include "asn1_mac.h" | ||
63 | #include "dh.h" | ||
64 | |||
65 | /* | ||
66 | * ASN1err(ASN1_F_D2I_DHPARAMS,ASN1_R_LENGTH_MISMATCH); | ||
67 | * ASN1err(ASN1_F_X509_DHPARAMS_NEW,ASN1_R_LENGTH_MISMATCH); | ||
68 | */ | ||
69 | |||
70 | int i2d_DHparams(a,pp) | ||
71 | DH *a; | ||
72 | unsigned char **pp; | ||
73 | { | ||
74 | BIGNUM *num[3]; | ||
75 | ASN1_INTEGER bs; | ||
76 | unsigned int j,i,tot=0,len,max=0; | ||
77 | int t,ret= -1; | ||
78 | unsigned char *p; | ||
79 | |||
80 | if (a == NULL) return(0); | ||
81 | num[0]=a->p; | ||
82 | num[1]=a->g; | ||
83 | if (a->length != 0) | ||
84 | { | ||
85 | if ((num[2]=BN_new()) == NULL) goto err; | ||
86 | if (!BN_set_word(num[2],a->length)) goto err; | ||
87 | } | ||
88 | else | ||
89 | num[2]=NULL; | ||
90 | |||
91 | for (i=0; i<3; i++) | ||
92 | { | ||
93 | if (num[i] == NULL) continue; | ||
94 | j=BN_num_bits(num[i]); | ||
95 | len=((j == 0)?0:((j/8)+1)); | ||
96 | if (len > max) max=len; | ||
97 | len=ASN1_object_size(0,len, | ||
98 | (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); | ||
99 | tot+=len; | ||
100 | } | ||
101 | |||
102 | t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); | ||
103 | if (pp == NULL) return(t); | ||
104 | |||
105 | p= *pp; | ||
106 | ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); | ||
107 | |||
108 | bs.type=V_ASN1_INTEGER; | ||
109 | bs.data=(unsigned char *)Malloc(max+4); | ||
110 | if (bs.data == NULL) | ||
111 | { | ||
112 | ASN1err(ASN1_F_I2D_DHPARAMS,ERR_R_MALLOC_FAILURE); | ||
113 | goto err; | ||
114 | } | ||
115 | |||
116 | for (i=0; i<3; i++) | ||
117 | { | ||
118 | if (num[i] == NULL) continue; | ||
119 | bs.length=BN_bn2bin(num[i],bs.data); | ||
120 | i2d_ASN1_INTEGER(&bs,&p); | ||
121 | } | ||
122 | Free((char *)bs.data); | ||
123 | ret=t; | ||
124 | err: | ||
125 | if (num[2] != NULL) BN_free(num[2]); | ||
126 | *pp=p; | ||
127 | return(ret); | ||
128 | } | ||
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 @@ | |||
1 | /* crypto/asn1/i2d_dsap.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "bn.h" | ||
62 | #include "asn1_mac.h" | ||
63 | #include "dsa.h" | ||
64 | |||
65 | /* | ||
66 | * ASN1err(ASN1_F_D2I_DSAPARAMS,ASN1_R_LENGTH_MISMATCH); | ||
67 | */ | ||
68 | |||
69 | int i2d_DSAparams(a,pp) | ||
70 | DSA *a; | ||
71 | unsigned char **pp; | ||
72 | { | ||
73 | BIGNUM *num[3]; | ||
74 | ASN1_INTEGER bs; | ||
75 | unsigned int j,i,tot=0,len,max=0; | ||
76 | int t,ret= -1; | ||
77 | unsigned char *p; | ||
78 | |||
79 | if (a == NULL) return(0); | ||
80 | num[0]=a->p; | ||
81 | num[1]=a->q; | ||
82 | num[2]=a->g; | ||
83 | |||
84 | for (i=0; i<3; i++) | ||
85 | { | ||
86 | if (num[i] == NULL) continue; | ||
87 | j=BN_num_bits(num[i]); | ||
88 | len=((j == 0)?0:((j/8)+1)); | ||
89 | if (len > max) max=len; | ||
90 | len=ASN1_object_size(0,len, | ||
91 | (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); | ||
92 | tot+=len; | ||
93 | } | ||
94 | |||
95 | t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); | ||
96 | if (pp == NULL) return(t); | ||
97 | |||
98 | p= *pp; | ||
99 | ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); | ||
100 | |||
101 | bs.type=V_ASN1_INTEGER; | ||
102 | bs.data=(unsigned char *)Malloc(max+4); | ||
103 | if (bs.data == NULL) | ||
104 | { | ||
105 | ASN1err(ASN1_F_I2D_DSAPARAMS,ERR_R_MALLOC_FAILURE); | ||
106 | goto err; | ||
107 | } | ||
108 | |||
109 | for (i=0; i<3; i++) | ||
110 | { | ||
111 | if (num[i] == NULL) continue; | ||
112 | bs.length=BN_bn2bin(num[i],bs.data); | ||
113 | i2d_ASN1_INTEGER(&bs,&p); | ||
114 | } | ||
115 | Free((char *)bs.data); | ||
116 | ret=t; | ||
117 | err: | ||
118 | *pp=p; | ||
119 | return(ret); | ||
120 | } | ||
121 | |||
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 @@ | |||
1 | /* crypto/asn1/i2d_r_pr.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "bn.h" | ||
62 | #include "rsa.h" | ||
63 | #include "objects.h" | ||
64 | #include "asn1_mac.h" | ||
65 | |||
66 | /* | ||
67 | * ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,ASN1_R_LENGTH_MISMATCH); | ||
68 | * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); | ||
69 | */ | ||
70 | |||
71 | int i2d_RSAPrivateKey(a,pp) | ||
72 | RSA *a; | ||
73 | unsigned char **pp; | ||
74 | { | ||
75 | BIGNUM *num[9]; | ||
76 | unsigned char data[1]; | ||
77 | ASN1_INTEGER bs; | ||
78 | unsigned int j,i,tot,t,len,max=0; | ||
79 | unsigned char *p; | ||
80 | |||
81 | if (a == NULL) return(0); | ||
82 | |||
83 | num[1]=a->n; | ||
84 | num[2]=a->e; | ||
85 | num[3]=a->d; | ||
86 | num[4]=a->p; | ||
87 | num[5]=a->q; | ||
88 | num[6]=a->dmp1; | ||
89 | num[7]=a->dmq1; | ||
90 | num[8]=a->iqmp; | ||
91 | |||
92 | bs.length=1; | ||
93 | bs.data=data; | ||
94 | bs.type=V_ASN1_INTEGER; | ||
95 | data[0]=a->version&0x7f; | ||
96 | |||
97 | tot=i2d_ASN1_INTEGER(&(bs),NULL); | ||
98 | for (i=1; i<9; i++) | ||
99 | { | ||
100 | j=BN_num_bits(num[i]); | ||
101 | len=((j == 0)?0:((j/8)+1)); | ||
102 | if (len > max) max=len; | ||
103 | len=ASN1_object_size(0,len, | ||
104 | (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); | ||
105 | tot+=len; | ||
106 | } | ||
107 | |||
108 | t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); | ||
109 | if (pp == NULL) return(t); | ||
110 | |||
111 | p= *pp; | ||
112 | ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); | ||
113 | |||
114 | i2d_ASN1_INTEGER(&bs,&p); | ||
115 | |||
116 | bs.data=(unsigned char *)Malloc(max+4); | ||
117 | if (bs.data == NULL) | ||
118 | { | ||
119 | ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ERR_R_MALLOC_FAILURE); | ||
120 | return(-1); | ||
121 | } | ||
122 | |||
123 | for (i=1; i<9; i++) | ||
124 | { | ||
125 | bs.length=BN_bn2bin(num[i],bs.data); | ||
126 | i2d_ASN1_INTEGER(&bs,&p); | ||
127 | } | ||
128 | Free((char *)bs.data); | ||
129 | *pp=p; | ||
130 | return(t); | ||
131 | } | ||
132 | |||
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 @@ | |||
1 | /* crypto/asn1/i2d_r_pu.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "bn.h" | ||
62 | #include "rsa.h" | ||
63 | #include "objects.h" | ||
64 | #include "asn1_mac.h" | ||
65 | |||
66 | /* | ||
67 | * ASN1err(ASN1_F_D2I_RSAPUBLICKEY,ASN1_R_LENGTH_MISMATCH); | ||
68 | * ASN1err(ASN1_F_I2D_RSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); | ||
69 | */ | ||
70 | |||
71 | int i2d_RSAPublicKey(a,pp) | ||
72 | RSA *a; | ||
73 | unsigned char **pp; | ||
74 | { | ||
75 | BIGNUM *num[2]; | ||
76 | ASN1_INTEGER bs; | ||
77 | unsigned int j,i,tot=0,len,max=0,t; | ||
78 | unsigned char *p; | ||
79 | |||
80 | if (a == NULL) return(0); | ||
81 | |||
82 | num[0]=a->n; | ||
83 | num[1]=a->e; | ||
84 | |||
85 | for (i=0; i<2; i++) | ||
86 | { | ||
87 | j=BN_num_bits(num[i]); | ||
88 | len=((j == 0)?0:((j/8)+1)); | ||
89 | if (len > max) max=len; | ||
90 | len=ASN1_object_size(0,len, | ||
91 | (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); | ||
92 | tot+=len; | ||
93 | } | ||
94 | |||
95 | t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); | ||
96 | if (pp == NULL) return(t); | ||
97 | |||
98 | p= *pp; | ||
99 | ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); | ||
100 | |||
101 | bs.type=V_ASN1_INTEGER; | ||
102 | bs.data=(unsigned char *)Malloc(max+4); | ||
103 | if (bs.data == NULL) | ||
104 | { | ||
105 | ASN1err(ASN1_F_I2D_RSAPUBLICKEY,ERR_R_MALLOC_FAILURE); | ||
106 | return(-1); | ||
107 | } | ||
108 | |||
109 | for (i=0; i<2; i++) | ||
110 | { | ||
111 | bs.length=BN_bn2bin(num[i],bs.data); | ||
112 | i2d_ASN1_INTEGER(&bs,&p); | ||
113 | } | ||
114 | Free((char *)bs.data); | ||
115 | *pp=p; | ||
116 | return(t); | ||
117 | } | ||
118 | |||
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 @@ | |||
1 | /* crypto/asn1/i2d_s_pr.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "bn.h" | ||
62 | #include "dsa.h" | ||
63 | #include "objects.h" | ||
64 | #include "asn1_mac.h" | ||
65 | |||
66 | /* | ||
67 | * ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); | ||
68 | */ | ||
69 | |||
70 | int i2d_DSAPrivateKey(a,pp) | ||
71 | DSA *a; | ||
72 | unsigned char **pp; | ||
73 | { | ||
74 | BIGNUM *num[6]; | ||
75 | unsigned char data[1]; | ||
76 | ASN1_INTEGER bs; | ||
77 | unsigned int j,i,tot,t,len,max=0; | ||
78 | unsigned char *p; | ||
79 | |||
80 | if (a == NULL) return(0); | ||
81 | |||
82 | num[1]=a->p; | ||
83 | num[2]=a->q; | ||
84 | num[3]=a->g; | ||
85 | num[4]=a->pub_key; | ||
86 | num[5]=a->priv_key; | ||
87 | |||
88 | bs.length=1; | ||
89 | bs.data=data; | ||
90 | bs.type=V_ASN1_INTEGER; | ||
91 | data[0]=a->version&0x7f; | ||
92 | |||
93 | tot=i2d_ASN1_INTEGER(&(bs),NULL); | ||
94 | for (i=1; i<6; i++) | ||
95 | { | ||
96 | j=BN_num_bits(num[i]); | ||
97 | len=((j == 0)?0:((j/8)+1)); | ||
98 | if (len > max) max=len; | ||
99 | len=ASN1_object_size(0,len, | ||
100 | (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); | ||
101 | tot+=len; | ||
102 | } | ||
103 | |||
104 | t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); | ||
105 | if (pp == NULL) return(t); | ||
106 | |||
107 | p= *pp; | ||
108 | ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); | ||
109 | |||
110 | i2d_ASN1_INTEGER(&bs,&p); | ||
111 | |||
112 | bs.data=(unsigned char *)Malloc(max+4); | ||
113 | if (bs.data == NULL) | ||
114 | { | ||
115 | ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ERR_R_MALLOC_FAILURE); | ||
116 | return(-1); | ||
117 | } | ||
118 | |||
119 | for (i=1; i<6; i++) | ||
120 | { | ||
121 | bs.length=BN_bn2bin(num[i],bs.data); | ||
122 | i2d_ASN1_INTEGER(&bs,&p); | ||
123 | } | ||
124 | Free((char *)bs.data); | ||
125 | *pp=p; | ||
126 | return(t); | ||
127 | } | ||
128 | |||
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 @@ | |||
1 | /* crypto/asn1/i2d_s_pu.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "bn.h" | ||
62 | #include "dsa.h" | ||
63 | #include "objects.h" | ||
64 | #include "asn1_mac.h" | ||
65 | |||
66 | /* | ||
67 | * ASN1err(ASN1_F_I2D_DSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); | ||
68 | */ | ||
69 | |||
70 | int i2d_DSAPublicKey(a,pp) | ||
71 | DSA *a; | ||
72 | unsigned char **pp; | ||
73 | { | ||
74 | BIGNUM *num[4]; | ||
75 | ASN1_INTEGER bs; | ||
76 | unsigned int j,i,tot=0,len,max=0,t=0,all,n=1; | ||
77 | unsigned char *p; | ||
78 | |||
79 | if (a == NULL) return(0); | ||
80 | |||
81 | all=a->write_params; | ||
82 | |||
83 | num[0]=a->pub_key; | ||
84 | if (all) | ||
85 | { | ||
86 | num[1]=a->p; | ||
87 | num[2]=a->q; | ||
88 | num[3]=a->g; | ||
89 | n=4; | ||
90 | } | ||
91 | |||
92 | for (i=0; i<n; i++) | ||
93 | { | ||
94 | j=BN_num_bits(num[i]); | ||
95 | len=((j == 0)?0:((j/8)+1)); | ||
96 | if (len > max) max=len; | ||
97 | len=ASN1_object_size(0,len, | ||
98 | (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); | ||
99 | tot+=len; | ||
100 | } | ||
101 | |||
102 | if (all) | ||
103 | { | ||
104 | t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); | ||
105 | if (pp == NULL) return(t); | ||
106 | } | ||
107 | else | ||
108 | { | ||
109 | if (pp == NULL) return(tot); | ||
110 | } | ||
111 | |||
112 | p= *pp; | ||
113 | if (all) | ||
114 | ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); | ||
115 | |||
116 | bs.type=V_ASN1_INTEGER; | ||
117 | bs.data=(unsigned char *)Malloc(max+4); | ||
118 | if (bs.data == NULL) | ||
119 | { | ||
120 | ASN1err(ASN1_F_I2D_DSAPUBLICKEY,ERR_R_MALLOC_FAILURE); | ||
121 | return(-1); | ||
122 | } | ||
123 | |||
124 | for (i=0; i<n; i++) | ||
125 | { | ||
126 | bs.length=BN_bn2bin(num[i],bs.data); | ||
127 | i2d_ASN1_INTEGER(&bs,&p); | ||
128 | } | ||
129 | Free((char *)bs.data); | ||
130 | *pp=p; | ||
131 | return(t); | ||
132 | } | ||
133 | |||
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 @@ | |||
1 | /* crypto/asn1/p7_dgst.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "asn1_mac.h" | ||
62 | #include "x509.h" | ||
63 | |||
64 | /* | ||
65 | * ASN1err(ASN1_F_PKCS7_DIGEST_NEW,ASN1_R_MISSING_EOS); | ||
66 | * ASN1err(ASN1_F_D2I_PKCS7_DIGEST,ASN1_R_LENGTH_MISMATCH); | ||
67 | */ | ||
68 | |||
69 | int i2d_PKCS7_DIGEST(a,pp) | ||
70 | PKCS7_DIGEST *a; | ||
71 | unsigned char **pp; | ||
72 | { | ||
73 | M_ASN1_I2D_vars(a); | ||
74 | |||
75 | M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); | ||
76 | M_ASN1_I2D_len(a->md,i2d_X509_ALGOR); | ||
77 | M_ASN1_I2D_len(a->contents,i2d_PKCS7); | ||
78 | M_ASN1_I2D_len(a->digest,i2d_ASN1_OCTET_STRING); | ||
79 | |||
80 | M_ASN1_I2D_seq_total(); | ||
81 | |||
82 | M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); | ||
83 | M_ASN1_I2D_put(a->md,i2d_X509_ALGOR); | ||
84 | M_ASN1_I2D_put(a->contents,i2d_PKCS7); | ||
85 | M_ASN1_I2D_put(a->digest,i2d_ASN1_OCTET_STRING); | ||
86 | |||
87 | M_ASN1_I2D_finish(); | ||
88 | } | ||
89 | |||
90 | PKCS7_DIGEST *d2i_PKCS7_DIGEST(a,pp,length) | ||
91 | PKCS7_DIGEST **a; | ||
92 | unsigned char **pp; | ||
93 | long length; | ||
94 | { | ||
95 | M_ASN1_D2I_vars(a,PKCS7_DIGEST *,PKCS7_DIGEST_new); | ||
96 | |||
97 | M_ASN1_D2I_Init(); | ||
98 | M_ASN1_D2I_start_sequence(); | ||
99 | M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); | ||
100 | M_ASN1_D2I_get(ret->md,d2i_X509_ALGOR); | ||
101 | M_ASN1_D2I_get(ret->contents,d2i_PKCS7); | ||
102 | M_ASN1_D2I_get(ret->digest,d2i_ASN1_OCTET_STRING); | ||
103 | |||
104 | M_ASN1_D2I_Finish(a,PKCS7_DIGEST_free,ASN1_F_D2I_PKCS7_DIGEST); | ||
105 | } | ||
106 | |||
107 | PKCS7_DIGEST *PKCS7_DIGEST_new() | ||
108 | { | ||
109 | PKCS7_DIGEST *ret=NULL; | ||
110 | |||
111 | M_ASN1_New_Malloc(ret,PKCS7_DIGEST); | ||
112 | M_ASN1_New(ret->version,ASN1_INTEGER_new); | ||
113 | M_ASN1_New(ret->md,X509_ALGOR_new); | ||
114 | M_ASN1_New(ret->contents,PKCS7_new); | ||
115 | M_ASN1_New(ret->digest,ASN1_OCTET_STRING_new); | ||
116 | return(ret); | ||
117 | M_ASN1_New_Error(ASN1_F_PKCS7_DIGEST_NEW); | ||
118 | } | ||
119 | |||
120 | void PKCS7_DIGEST_free(a) | ||
121 | PKCS7_DIGEST *a; | ||
122 | { | ||
123 | if (a == NULL) return; | ||
124 | ASN1_INTEGER_free(a->version); | ||
125 | X509_ALGOR_free(a->md); | ||
126 | PKCS7_free(a->contents); | ||
127 | ASN1_OCTET_STRING_free(a->digest); | ||
128 | Free((char *)a); | ||
129 | } | ||
130 | |||
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 @@ | |||
1 | /* crypto/asn1/p7_enc.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "asn1_mac.h" | ||
62 | #include "x509.h" | ||
63 | |||
64 | /* | ||
65 | * ASN1err(ASN1_F_PKCS7_ENCRYPT_NEW,ASN1_R_LENGTH_MISMATCH); | ||
66 | * ASN1err(ASN1_F_D2I_PKCS7_ENCRYPT,ASN1_R_LENGTH_MISMATCH); | ||
67 | */ | ||
68 | |||
69 | int i2d_PKCS7_ENCRYPT(a,pp) | ||
70 | PKCS7_ENCRYPT *a; | ||
71 | unsigned char **pp; | ||
72 | { | ||
73 | M_ASN1_I2D_vars(a); | ||
74 | |||
75 | M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); | ||
76 | M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); | ||
77 | |||
78 | M_ASN1_I2D_seq_total(); | ||
79 | |||
80 | M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); | ||
81 | M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); | ||
82 | |||
83 | M_ASN1_I2D_finish(); | ||
84 | } | ||
85 | |||
86 | PKCS7_ENCRYPT *d2i_PKCS7_ENCRYPT(a,pp,length) | ||
87 | PKCS7_ENCRYPT **a; | ||
88 | unsigned char **pp; | ||
89 | long length; | ||
90 | { | ||
91 | M_ASN1_D2I_vars(a,PKCS7_ENCRYPT *,PKCS7_ENCRYPT_new); | ||
92 | |||
93 | M_ASN1_D2I_Init(); | ||
94 | M_ASN1_D2I_start_sequence(); | ||
95 | M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); | ||
96 | M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); | ||
97 | |||
98 | M_ASN1_D2I_Finish(a,PKCS7_ENCRYPT_free,ASN1_F_D2I_PKCS7_ENCRYPT); | ||
99 | } | ||
100 | |||
101 | PKCS7_ENCRYPT *PKCS7_ENCRYPT_new() | ||
102 | { | ||
103 | PKCS7_ENCRYPT *ret=NULL; | ||
104 | |||
105 | M_ASN1_New_Malloc(ret,PKCS7_ENCRYPT); | ||
106 | M_ASN1_New(ret->version,ASN1_INTEGER_new); | ||
107 | M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); | ||
108 | return(ret); | ||
109 | M_ASN1_New_Error(ASN1_F_PKCS7_ENCRYPT_NEW); | ||
110 | } | ||
111 | |||
112 | void PKCS7_ENCRYPT_free(a) | ||
113 | PKCS7_ENCRYPT *a; | ||
114 | { | ||
115 | if (a == NULL) return; | ||
116 | ASN1_INTEGER_free(a->version); | ||
117 | PKCS7_ENC_CONTENT_free(a->enc_data); | ||
118 | Free((char *)a); | ||
119 | } | ||
120 | |||
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 @@ | |||
1 | /* crypto/asn1/p7_enc_c.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "asn1_mac.h" | ||
62 | #include "x509.h" | ||
63 | |||
64 | /* | ||
65 | * ASN1err(ASN1_F_PKCS7_ENC_CONTENT_NEW,ASN1_R_LENGTH_MISMATCH); | ||
66 | * ASN1err(ASN1_F_D2I_PKCS7_ENC_CONTENT,ASN1_R_LENGTH_MISMATCH); | ||
67 | */ | ||
68 | |||
69 | int i2d_PKCS7_ENC_CONTENT(a,pp) | ||
70 | PKCS7_ENC_CONTENT *a; | ||
71 | unsigned char **pp; | ||
72 | { | ||
73 | M_ASN1_I2D_vars(a); | ||
74 | |||
75 | M_ASN1_I2D_len(a->content_type,i2d_ASN1_OBJECT); | ||
76 | M_ASN1_I2D_len(a->algorithm,i2d_X509_ALGOR); | ||
77 | M_ASN1_I2D_len_IMP_opt(a->enc_data,i2d_ASN1_OCTET_STRING); | ||
78 | |||
79 | M_ASN1_I2D_seq_total(); | ||
80 | |||
81 | M_ASN1_I2D_put(a->content_type,i2d_ASN1_OBJECT); | ||
82 | M_ASN1_I2D_put(a->algorithm,i2d_X509_ALGOR); | ||
83 | M_ASN1_I2D_put_IMP_opt(a->enc_data,i2d_ASN1_OCTET_STRING,0); | ||
84 | |||
85 | M_ASN1_I2D_finish(); | ||
86 | } | ||
87 | |||
88 | PKCS7_ENC_CONTENT *d2i_PKCS7_ENC_CONTENT(a,pp,length) | ||
89 | PKCS7_ENC_CONTENT **a; | ||
90 | unsigned char **pp; | ||
91 | long length; | ||
92 | { | ||
93 | M_ASN1_D2I_vars(a,PKCS7_ENC_CONTENT *,PKCS7_ENC_CONTENT_new); | ||
94 | |||
95 | M_ASN1_D2I_Init(); | ||
96 | M_ASN1_D2I_start_sequence(); | ||
97 | M_ASN1_D2I_get(ret->content_type,d2i_ASN1_OBJECT); | ||
98 | M_ASN1_D2I_get(ret->algorithm,d2i_X509_ALGOR); | ||
99 | M_ASN1_D2I_get_IMP_opt(ret->enc_data,d2i_ASN1_OCTET_STRING,0, | ||
100 | V_ASN1_OCTET_STRING); | ||
101 | |||
102 | M_ASN1_D2I_Finish(a,PKCS7_ENC_CONTENT_free, | ||
103 | ASN1_F_D2I_PKCS7_ENC_CONTENT); | ||
104 | } | ||
105 | |||
106 | PKCS7_ENC_CONTENT *PKCS7_ENC_CONTENT_new() | ||
107 | { | ||
108 | PKCS7_ENC_CONTENT *ret=NULL; | ||
109 | |||
110 | M_ASN1_New_Malloc(ret,PKCS7_ENC_CONTENT); | ||
111 | M_ASN1_New(ret->content_type,ASN1_OBJECT_new); | ||
112 | M_ASN1_New(ret->algorithm,X509_ALGOR_new); | ||
113 | ret->enc_data=NULL; | ||
114 | return(ret); | ||
115 | M_ASN1_New_Error(ASN1_F_PKCS7_ENC_CONTENT_NEW); | ||
116 | } | ||
117 | |||
118 | void PKCS7_ENC_CONTENT_free(a) | ||
119 | PKCS7_ENC_CONTENT *a; | ||
120 | { | ||
121 | if (a == NULL) return; | ||
122 | ASN1_OBJECT_free(a->content_type); | ||
123 | X509_ALGOR_free(a->algorithm); | ||
124 | ASN1_OCTET_STRING_free(a->enc_data); | ||
125 | Free((char *)a); | ||
126 | } | ||
127 | |||
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 @@ | |||
1 | /* crypto/asn1/p7_evp.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "asn1_mac.h" | ||
62 | #include "x509.h" | ||
63 | |||
64 | /* | ||
65 | * ASN1err(ASN1_F_PKCS7_ENVELOPE_NEW,ASN1_R_LENGTH_MISMATCH); | ||
66 | * ASN1err(ASN1_F_D2I_PKCS7_ENVELOPE,ASN1_R_LENGTH_MISMATCH); | ||
67 | */ | ||
68 | |||
69 | int i2d_PKCS7_ENVELOPE(a,pp) | ||
70 | PKCS7_ENVELOPE *a; | ||
71 | unsigned char **pp; | ||
72 | { | ||
73 | M_ASN1_I2D_vars(a); | ||
74 | |||
75 | M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); | ||
76 | M_ASN1_I2D_len_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); | ||
77 | M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); | ||
78 | |||
79 | M_ASN1_I2D_seq_total(); | ||
80 | |||
81 | M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); | ||
82 | M_ASN1_I2D_put_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); | ||
83 | M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); | ||
84 | |||
85 | M_ASN1_I2D_finish(); | ||
86 | } | ||
87 | |||
88 | PKCS7_ENVELOPE *d2i_PKCS7_ENVELOPE(a,pp,length) | ||
89 | PKCS7_ENVELOPE **a; | ||
90 | unsigned char **pp; | ||
91 | long length; | ||
92 | { | ||
93 | M_ASN1_D2I_vars(a,PKCS7_ENVELOPE *,PKCS7_ENVELOPE_new); | ||
94 | |||
95 | M_ASN1_D2I_Init(); | ||
96 | M_ASN1_D2I_start_sequence(); | ||
97 | M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); | ||
98 | M_ASN1_D2I_get_set(ret->recipientinfo,d2i_PKCS7_RECIP_INFO); | ||
99 | M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); | ||
100 | |||
101 | M_ASN1_D2I_Finish(a,PKCS7_ENVELOPE_free,ASN1_F_D2I_PKCS7_ENVELOPE); | ||
102 | } | ||
103 | |||
104 | PKCS7_ENVELOPE *PKCS7_ENVELOPE_new() | ||
105 | { | ||
106 | PKCS7_ENVELOPE *ret=NULL; | ||
107 | |||
108 | M_ASN1_New_Malloc(ret,PKCS7_ENVELOPE); | ||
109 | M_ASN1_New(ret->version,ASN1_INTEGER_new); | ||
110 | M_ASN1_New(ret->recipientinfo,sk_new_null); | ||
111 | M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); | ||
112 | return(ret); | ||
113 | M_ASN1_New_Error(ASN1_F_PKCS7_ENVELOPE_NEW); | ||
114 | } | ||
115 | |||
116 | void PKCS7_ENVELOPE_free(a) | ||
117 | PKCS7_ENVELOPE *a; | ||
118 | { | ||
119 | if (a == NULL) return; | ||
120 | ASN1_INTEGER_free(a->version); | ||
121 | sk_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free); | ||
122 | PKCS7_ENC_CONTENT_free(a->enc_data); | ||
123 | Free((char *)a); | ||
124 | } | ||
125 | |||
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 @@ | |||
1 | /* crypto/asn1/p7_i_s.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "asn1_mac.h" | ||
62 | #include "x509.h" | ||
63 | |||
64 | /* | ||
65 | * ASN1err(ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW,ASN1_R_LENGTH_MISMATCH); | ||
66 | * ASN1err(ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL,ASN1_R_LENGTH_MISMATCH); | ||
67 | */ | ||
68 | |||
69 | int i2d_PKCS7_ISSUER_AND_SERIAL(a,pp) | ||
70 | PKCS7_ISSUER_AND_SERIAL *a; | ||
71 | unsigned char **pp; | ||
72 | { | ||
73 | M_ASN1_I2D_vars(a); | ||
74 | |||
75 | M_ASN1_I2D_len(a->issuer,i2d_X509_NAME); | ||
76 | M_ASN1_I2D_len(a->serial,i2d_ASN1_INTEGER); | ||
77 | |||
78 | M_ASN1_I2D_seq_total(); | ||
79 | |||
80 | M_ASN1_I2D_put(a->issuer,i2d_X509_NAME); | ||
81 | M_ASN1_I2D_put(a->serial,i2d_ASN1_INTEGER); | ||
82 | |||
83 | M_ASN1_I2D_finish(); | ||
84 | } | ||
85 | |||
86 | PKCS7_ISSUER_AND_SERIAL *d2i_PKCS7_ISSUER_AND_SERIAL(a,pp,length) | ||
87 | PKCS7_ISSUER_AND_SERIAL **a; | ||
88 | unsigned char **pp; | ||
89 | long length; | ||
90 | { | ||
91 | M_ASN1_D2I_vars(a,PKCS7_ISSUER_AND_SERIAL *,PKCS7_ISSUER_AND_SERIAL_new); | ||
92 | |||
93 | M_ASN1_D2I_Init(); | ||
94 | M_ASN1_D2I_start_sequence(); | ||
95 | M_ASN1_D2I_get(ret->issuer,d2i_X509_NAME); | ||
96 | M_ASN1_D2I_get(ret->serial,d2i_ASN1_INTEGER); | ||
97 | M_ASN1_D2I_Finish(a,PKCS7_ISSUER_AND_SERIAL_free, | ||
98 | ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL); | ||
99 | } | ||
100 | |||
101 | PKCS7_ISSUER_AND_SERIAL *PKCS7_ISSUER_AND_SERIAL_new() | ||
102 | { | ||
103 | PKCS7_ISSUER_AND_SERIAL *ret=NULL; | ||
104 | |||
105 | M_ASN1_New_Malloc(ret,PKCS7_ISSUER_AND_SERIAL); | ||
106 | M_ASN1_New(ret->issuer,X509_NAME_new); | ||
107 | M_ASN1_New(ret->serial,ASN1_INTEGER_new); | ||
108 | return(ret); | ||
109 | M_ASN1_New_Error(ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW); | ||
110 | } | ||
111 | |||
112 | void PKCS7_ISSUER_AND_SERIAL_free(a) | ||
113 | PKCS7_ISSUER_AND_SERIAL *a; | ||
114 | { | ||
115 | if (a == NULL) return; | ||
116 | X509_NAME_free(a->issuer); | ||
117 | ASN1_INTEGER_free(a->serial); | ||
118 | Free((char *)a); | ||
119 | } | ||
120 | |||
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 @@ | |||
1 | /* crypto/asn1/p7_lib.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "asn1_mac.h" | ||
62 | #include "objects.h" | ||
63 | |||
64 | /* ASN1err(ASN1_F_D2I_PKCS7,ASN1_R_BAD_PKCS7_CONTENT); | ||
65 | * ASN1err(ASN1_F_I2D_PKCS7,ASN1_R_BAD_PKCS7_TYPE); | ||
66 | * ASN1err(ASN1_F_PKCS7_NEW,ASN1_R_BAD_PKCS7_TYPE); | ||
67 | */ | ||
68 | |||
69 | int i2d_PKCS7(a,pp) | ||
70 | PKCS7 *a; | ||
71 | unsigned char **pp; | ||
72 | { | ||
73 | M_ASN1_I2D_vars(a); | ||
74 | |||
75 | if (a->asn1 != NULL) | ||
76 | { | ||
77 | if (pp == NULL) | ||
78 | return((int)a->length); | ||
79 | memcpy(*pp,a->asn1,(int)a->length); | ||
80 | *pp+=a->length; | ||
81 | return((int)a->length); | ||
82 | } | ||
83 | |||
84 | ret+=4; /* sequence, BER header plus '0 0' end padding */ | ||
85 | M_ASN1_I2D_len(a->type,i2d_ASN1_OBJECT); | ||
86 | if (a->d.ptr != NULL) | ||
87 | { | ||
88 | ret+=4; /* explicit tag [ 0 ] BER plus '0 0' */ | ||
89 | switch (OBJ_obj2nid(a->type)) | ||
90 | { | ||
91 | case NID_pkcs7_data: | ||
92 | M_ASN1_I2D_len(a->d.data,i2d_ASN1_OCTET_STRING); | ||
93 | break; | ||
94 | case NID_pkcs7_signed: | ||
95 | M_ASN1_I2D_len(a->d.sign,i2d_PKCS7_SIGNED); | ||
96 | break; | ||
97 | case NID_pkcs7_enveloped: | ||
98 | M_ASN1_I2D_len(a->d.enveloped,i2d_PKCS7_ENVELOPE); | ||
99 | break; | ||
100 | case NID_pkcs7_signedAndEnveloped: | ||
101 | M_ASN1_I2D_len(a->d.signed_and_enveloped, | ||
102 | i2d_PKCS7_SIGN_ENVELOPE); | ||
103 | break; | ||
104 | case NID_pkcs7_digest: | ||
105 | M_ASN1_I2D_len(a->d.digest,i2d_PKCS7_DIGEST); | ||
106 | break; | ||
107 | case NID_pkcs7_encrypted: | ||
108 | M_ASN1_I2D_len(a->d.encrypted,i2d_PKCS7_ENCRYPT); | ||
109 | break; | ||
110 | default: | ||
111 | break; | ||
112 | } | ||
113 | } | ||
114 | r=ret; | ||
115 | if (pp == NULL) return(r); | ||
116 | p= *pp; | ||
117 | M_ASN1_I2D_INF_seq_start(V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); | ||
118 | M_ASN1_I2D_put(a->type,i2d_ASN1_OBJECT); | ||
119 | |||
120 | if (a->d.ptr != NULL) | ||
121 | { | ||
122 | M_ASN1_I2D_INF_seq_start(0,V_ASN1_CONTEXT_SPECIFIC); | ||
123 | switch (OBJ_obj2nid(a->type)) | ||
124 | { | ||
125 | case NID_pkcs7_data: | ||
126 | M_ASN1_I2D_put(a->d.data,i2d_ASN1_OCTET_STRING); | ||
127 | break; | ||
128 | case NID_pkcs7_signed: | ||
129 | M_ASN1_I2D_put(a->d.sign,i2d_PKCS7_SIGNED); | ||
130 | break; | ||
131 | case NID_pkcs7_enveloped: | ||
132 | M_ASN1_I2D_put(a->d.enveloped,i2d_PKCS7_ENVELOPE); | ||
133 | break; | ||
134 | case NID_pkcs7_signedAndEnveloped: | ||
135 | M_ASN1_I2D_put(a->d.signed_and_enveloped, | ||
136 | i2d_PKCS7_SIGN_ENVELOPE); | ||
137 | break; | ||
138 | case NID_pkcs7_digest: | ||
139 | M_ASN1_I2D_put(a->d.digest,i2d_PKCS7_DIGEST); | ||
140 | break; | ||
141 | case NID_pkcs7_encrypted: | ||
142 | M_ASN1_I2D_put(a->d.encrypted,i2d_PKCS7_ENCRYPT); | ||
143 | break; | ||
144 | default: | ||
145 | break; | ||
146 | } | ||
147 | M_ASN1_I2D_INF_seq_end(); | ||
148 | } | ||
149 | M_ASN1_I2D_INF_seq_end(); | ||
150 | M_ASN1_I2D_finish(); | ||
151 | } | ||
152 | |||
153 | PKCS7 *d2i_PKCS7(a,pp,length) | ||
154 | PKCS7 **a; | ||
155 | unsigned char **pp; | ||
156 | long length; | ||
157 | { | ||
158 | M_ASN1_D2I_vars(a,PKCS7 *,PKCS7_new); | ||
159 | |||
160 | if ((a != NULL) && ((*a) != NULL)) | ||
161 | { | ||
162 | if ((*a)->asn1 != NULL) | ||
163 | { | ||
164 | Free((char *)(*a)->asn1); | ||
165 | (*a)->asn1=NULL; | ||
166 | } | ||
167 | (*a)->length=0; | ||
168 | } | ||
169 | |||
170 | M_ASN1_D2I_Init(); | ||
171 | M_ASN1_D2I_start_sequence(); | ||
172 | M_ASN1_D2I_get(ret->type,d2i_ASN1_OBJECT); | ||
173 | if (!M_ASN1_D2I_end_sequence()) | ||
174 | { | ||
175 | int Tinf,Ttag,Tclass; | ||
176 | long Tlen; | ||
177 | |||
178 | if (M_ASN1_next != (V_ASN1_CONSTRUCTED| | ||
179 | V_ASN1_CONTEXT_SPECIFIC|0)) | ||
180 | { | ||
181 | c.error=ASN1_R_BAD_PKCS7_CONTENT; | ||
182 | goto err; | ||
183 | } | ||
184 | |||
185 | ret->detached=0; | ||
186 | |||
187 | c.q=c.p; | ||
188 | Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass, | ||
189 | (c.inf & 1)?(length+ *pp-c.q):c.slen); | ||
190 | if (Tinf & 0x80) goto err; | ||
191 | c.slen-=(c.p-c.q); | ||
192 | |||
193 | switch (OBJ_obj2nid(ret->type)) | ||
194 | { | ||
195 | case NID_pkcs7_data: | ||
196 | M_ASN1_D2I_get(ret->d.data,d2i_ASN1_OCTET_STRING); | ||
197 | break; | ||
198 | case NID_pkcs7_signed: | ||
199 | M_ASN1_D2I_get(ret->d.sign,d2i_PKCS7_SIGNED); | ||
200 | if (ret->d.sign->contents->d.ptr == NULL) | ||
201 | ret->detached=1; | ||
202 | break; | ||
203 | case NID_pkcs7_enveloped: | ||
204 | M_ASN1_D2I_get(ret->d.enveloped,d2i_PKCS7_ENVELOPE); | ||
205 | break; | ||
206 | case NID_pkcs7_signedAndEnveloped: | ||
207 | M_ASN1_D2I_get(ret->d.signed_and_enveloped, | ||
208 | d2i_PKCS7_SIGN_ENVELOPE); | ||
209 | break; | ||
210 | case NID_pkcs7_digest: | ||
211 | M_ASN1_D2I_get(ret->d.digest,d2i_PKCS7_DIGEST); | ||
212 | break; | ||
213 | case NID_pkcs7_encrypted: | ||
214 | M_ASN1_D2I_get(ret->d.encrypted,d2i_PKCS7_ENCRYPT); | ||
215 | break; | ||
216 | default: | ||
217 | c.error=ASN1_R_BAD_PKCS7_TYPE; | ||
218 | goto err; | ||
219 | break; | ||
220 | } | ||
221 | if (Tinf == (1|V_ASN1_CONSTRUCTED)) | ||
222 | { | ||
223 | if (!ASN1_check_infinite_end(&c.p,c.slen)) | ||
224 | { | ||
225 | c.error=ASN1_R_MISSING_EOS; | ||
226 | goto err; | ||
227 | } | ||
228 | } | ||
229 | } | ||
230 | else | ||
231 | ret->detached=1; | ||
232 | |||
233 | M_ASN1_D2I_Finish(a,PKCS7_free,ASN1_F_D2I_PKCS7); | ||
234 | } | ||
235 | |||
236 | PKCS7 *PKCS7_new() | ||
237 | { | ||
238 | PKCS7 *ret=NULL; | ||
239 | |||
240 | M_ASN1_New_Malloc(ret,PKCS7); | ||
241 | ret->type=ASN1_OBJECT_new(); | ||
242 | ret->asn1=NULL; | ||
243 | ret->length=0; | ||
244 | ret->detached=0; | ||
245 | ret->d.ptr=NULL; | ||
246 | return(ret); | ||
247 | M_ASN1_New_Error(ASN1_F_PKCS7_NEW); | ||
248 | } | ||
249 | |||
250 | void PKCS7_free(a) | ||
251 | PKCS7 *a; | ||
252 | { | ||
253 | if (a == NULL) return; | ||
254 | |||
255 | PKCS7_content_free(a); | ||
256 | if (a->type != NULL) | ||
257 | { | ||
258 | ASN1_OBJECT_free(a->type); | ||
259 | } | ||
260 | Free((char *)(char *)a); | ||
261 | } | ||
262 | |||
263 | void PKCS7_content_free(a) | ||
264 | PKCS7 *a; | ||
265 | { | ||
266 | if (a->asn1 != NULL) Free((char *)a->asn1); | ||
267 | |||
268 | if (a->d.ptr != NULL) | ||
269 | { | ||
270 | if (a->type == NULL) return; | ||
271 | |||
272 | switch (OBJ_obj2nid(a->type)) | ||
273 | { | ||
274 | case NID_pkcs7_data: | ||
275 | ASN1_OCTET_STRING_free(a->d.data); | ||
276 | break; | ||
277 | case NID_pkcs7_signed: | ||
278 | PKCS7_SIGNED_free(a->d.sign); | ||
279 | break; | ||
280 | case NID_pkcs7_enveloped: | ||
281 | PKCS7_ENVELOPE_free(a->d.enveloped); | ||
282 | break; | ||
283 | case NID_pkcs7_signedAndEnveloped: | ||
284 | PKCS7_SIGN_ENVELOPE_free(a->d.signed_and_enveloped); | ||
285 | break; | ||
286 | case NID_pkcs7_digest: | ||
287 | PKCS7_DIGEST_free(a->d.digest); | ||
288 | break; | ||
289 | case NID_pkcs7_encrypted: | ||
290 | PKCS7_ENCRYPT_free(a->d.encrypted); | ||
291 | break; | ||
292 | default: | ||
293 | /* MEMORY LEAK */ | ||
294 | break; | ||
295 | } | ||
296 | } | ||
297 | a->d.ptr=NULL; | ||
298 | } | ||
299 | |||
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 @@ | |||
1 | /* crypto/asn1/p7_recip.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "asn1_mac.h" | ||
62 | #include "x509.h" | ||
63 | |||
64 | /* | ||
65 | * ASN1err(ASN1_F_PKCS7_RECIP_INFO_NEW,ASN1_R_LENGTH_MISMATCH); | ||
66 | * ASN1err(ASN1_F_D2I_PKCS7_RECIP_INFO,ASN1_R_LENGTH_MISMATCH); | ||
67 | */ | ||
68 | |||
69 | int i2d_PKCS7_RECIP_INFO(a,pp) | ||
70 | PKCS7_RECIP_INFO *a; | ||
71 | unsigned char **pp; | ||
72 | { | ||
73 | M_ASN1_I2D_vars(a); | ||
74 | |||
75 | M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); | ||
76 | M_ASN1_I2D_len(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); | ||
77 | M_ASN1_I2D_len(a->key_enc_algor,i2d_X509_ALGOR); | ||
78 | M_ASN1_I2D_len(a->enc_key,i2d_ASN1_OCTET_STRING); | ||
79 | |||
80 | M_ASN1_I2D_seq_total(); | ||
81 | |||
82 | M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); | ||
83 | M_ASN1_I2D_put(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); | ||
84 | M_ASN1_I2D_put(a->key_enc_algor,i2d_X509_ALGOR); | ||
85 | M_ASN1_I2D_put(a->enc_key,i2d_ASN1_OCTET_STRING); | ||
86 | |||
87 | M_ASN1_I2D_finish(); | ||
88 | } | ||
89 | |||
90 | PKCS7_RECIP_INFO *d2i_PKCS7_RECIP_INFO(a,pp,length) | ||
91 | PKCS7_RECIP_INFO **a; | ||
92 | unsigned char **pp; | ||
93 | long length; | ||
94 | { | ||
95 | M_ASN1_D2I_vars(a,PKCS7_RECIP_INFO *,PKCS7_RECIP_INFO_new); | ||
96 | |||
97 | M_ASN1_D2I_Init(); | ||
98 | M_ASN1_D2I_start_sequence(); | ||
99 | M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); | ||
100 | M_ASN1_D2I_get(ret->issuer_and_serial,d2i_PKCS7_ISSUER_AND_SERIAL); | ||
101 | M_ASN1_D2I_get(ret->key_enc_algor,d2i_X509_ALGOR); | ||
102 | M_ASN1_D2I_get(ret->enc_key,d2i_ASN1_OCTET_STRING); | ||
103 | |||
104 | M_ASN1_D2I_Finish(a,PKCS7_RECIP_INFO_free,ASN1_F_D2I_PKCS7_RECIP_INFO); | ||
105 | } | ||
106 | |||
107 | PKCS7_RECIP_INFO *PKCS7_RECIP_INFO_new() | ||
108 | { | ||
109 | PKCS7_RECIP_INFO *ret=NULL; | ||
110 | |||
111 | M_ASN1_New_Malloc(ret,PKCS7_RECIP_INFO); | ||
112 | M_ASN1_New(ret->version,ASN1_INTEGER_new); | ||
113 | M_ASN1_New(ret->issuer_and_serial,PKCS7_ISSUER_AND_SERIAL_new); | ||
114 | M_ASN1_New(ret->key_enc_algor,X509_ALGOR_new); | ||
115 | M_ASN1_New(ret->enc_key,ASN1_OCTET_STRING_new); | ||
116 | ret->cert=NULL; | ||
117 | return(ret); | ||
118 | M_ASN1_New_Error(ASN1_F_PKCS7_RECIP_INFO_NEW); | ||
119 | } | ||
120 | |||
121 | void PKCS7_RECIP_INFO_free(a) | ||
122 | PKCS7_RECIP_INFO *a; | ||
123 | { | ||
124 | if (a == NULL) return; | ||
125 | ASN1_INTEGER_free(a->version); | ||
126 | PKCS7_ISSUER_AND_SERIAL_free(a->issuer_and_serial); | ||
127 | X509_ALGOR_free(a->key_enc_algor); | ||
128 | ASN1_OCTET_STRING_free(a->enc_key); | ||
129 | if (a->cert != NULL) X509_free(a->cert); | ||
130 | Free((char *)a); | ||
131 | } | ||
132 | |||
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 @@ | |||
1 | /* crypto/asn1/p7_s_e.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "asn1_mac.h" | ||
62 | #include "x509.h" | ||
63 | |||
64 | /* | ||
65 | * ASN1err(ASN1_F_PKCS7_SIGN_ENVELOPE_NEW,ASN1_R_LENGTH_MISMATCH); | ||
66 | * ASN1err(ASN1_F_D2I_PKCS7_SIGN_ENVELOPE,ASN1_R_LENGTH_MISMATCH); | ||
67 | */ | ||
68 | |||
69 | int i2d_PKCS7_SIGN_ENVELOPE(a,pp) | ||
70 | PKCS7_SIGN_ENVELOPE *a; | ||
71 | unsigned char **pp; | ||
72 | { | ||
73 | M_ASN1_I2D_vars(a); | ||
74 | |||
75 | M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); | ||
76 | M_ASN1_I2D_len_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); | ||
77 | M_ASN1_I2D_len_SET(a->md_algs,i2d_X509_ALGOR); | ||
78 | M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); | ||
79 | M_ASN1_I2D_len_IMP_set_opt(a->cert,i2d_X509,0); | ||
80 | M_ASN1_I2D_len_IMP_set_opt(a->crl,i2d_X509_CRL,1); | ||
81 | M_ASN1_I2D_len_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); | ||
82 | |||
83 | M_ASN1_I2D_seq_total(); | ||
84 | |||
85 | M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); | ||
86 | M_ASN1_I2D_put_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); | ||
87 | M_ASN1_I2D_put_SET(a->md_algs,i2d_X509_ALGOR); | ||
88 | M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); | ||
89 | M_ASN1_I2D_put_IMP_set_opt(a->cert,i2d_X509,0); | ||
90 | M_ASN1_I2D_put_IMP_set_opt(a->crl,i2d_X509_CRL,1); | ||
91 | M_ASN1_I2D_put_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); | ||
92 | |||
93 | M_ASN1_I2D_finish(); | ||
94 | } | ||
95 | |||
96 | PKCS7_SIGN_ENVELOPE *d2i_PKCS7_SIGN_ENVELOPE(a,pp,length) | ||
97 | PKCS7_SIGN_ENVELOPE **a; | ||
98 | unsigned char **pp; | ||
99 | long length; | ||
100 | { | ||
101 | M_ASN1_D2I_vars(a,PKCS7_SIGN_ENVELOPE *,PKCS7_SIGN_ENVELOPE_new); | ||
102 | |||
103 | M_ASN1_D2I_Init(); | ||
104 | M_ASN1_D2I_start_sequence(); | ||
105 | M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); | ||
106 | M_ASN1_D2I_get_set(ret->recipientinfo,d2i_PKCS7_RECIP_INFO); | ||
107 | M_ASN1_D2I_get_set(ret->md_algs,d2i_X509_ALGOR); | ||
108 | M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); | ||
109 | M_ASN1_D2I_get_IMP_set_opt(ret->cert,d2i_X509,0); | ||
110 | M_ASN1_D2I_get_IMP_set_opt(ret->crl,d2i_X509_CRL,1); | ||
111 | M_ASN1_D2I_get_set(ret->signer_info,d2i_PKCS7_SIGNER_INFO); | ||
112 | |||
113 | M_ASN1_D2I_Finish(a,PKCS7_SIGN_ENVELOPE_free, | ||
114 | ASN1_F_D2I_PKCS7_SIGN_ENVELOPE); | ||
115 | } | ||
116 | |||
117 | PKCS7_SIGN_ENVELOPE *PKCS7_SIGN_ENVELOPE_new() | ||
118 | { | ||
119 | PKCS7_SIGN_ENVELOPE *ret=NULL; | ||
120 | |||
121 | M_ASN1_New_Malloc(ret,PKCS7_SIGN_ENVELOPE); | ||
122 | M_ASN1_New(ret->version,ASN1_INTEGER_new); | ||
123 | M_ASN1_New(ret->recipientinfo,sk_new_null); | ||
124 | M_ASN1_New(ret->md_algs,sk_new_null); | ||
125 | M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); | ||
126 | ret->cert=NULL; | ||
127 | ret->crl=NULL; | ||
128 | M_ASN1_New(ret->signer_info,sk_new_null); | ||
129 | return(ret); | ||
130 | M_ASN1_New_Error(ASN1_F_PKCS7_SIGN_ENVELOPE_NEW); | ||
131 | } | ||
132 | |||
133 | void PKCS7_SIGN_ENVELOPE_free(a) | ||
134 | PKCS7_SIGN_ENVELOPE *a; | ||
135 | { | ||
136 | if (a == NULL) return; | ||
137 | ASN1_INTEGER_free(a->version); | ||
138 | sk_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free); | ||
139 | sk_pop_free(a->md_algs,X509_ALGOR_free); | ||
140 | PKCS7_ENC_CONTENT_free(a->enc_data); | ||
141 | sk_pop_free(a->cert,X509_free); | ||
142 | sk_pop_free(a->crl,X509_CRL_free); | ||
143 | sk_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free); | ||
144 | Free((char *)a); | ||
145 | } | ||
146 | |||
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 @@ | |||
1 | /* crypto/asn1/p7_signd.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "asn1_mac.h" | ||
62 | #include "x509.h" | ||
63 | |||
64 | /* | ||
65 | * ASN1err(ASN1_F_PKCS7_SIGNED_NEW,ASN1_R_LENGTH_MISMATCH); | ||
66 | * ASN1err(ASN1_F_D2I_PKCS7_SIGNED,ASN1_R_LENGTH_MISMATCH); | ||
67 | */ | ||
68 | |||
69 | int i2d_PKCS7_SIGNED(a,pp) | ||
70 | PKCS7_SIGNED *a; | ||
71 | unsigned char **pp; | ||
72 | { | ||
73 | M_ASN1_I2D_vars(a); | ||
74 | |||
75 | M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); | ||
76 | M_ASN1_I2D_len_SET(a->md_algs,i2d_X509_ALGOR); | ||
77 | M_ASN1_I2D_len(a->contents,i2d_PKCS7); | ||
78 | M_ASN1_I2D_len_IMP_set_opt(a->cert,i2d_X509,0); | ||
79 | M_ASN1_I2D_len_IMP_set_opt(a->crl,i2d_X509_CRL,1); | ||
80 | M_ASN1_I2D_len_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); | ||
81 | |||
82 | M_ASN1_I2D_seq_total(); | ||
83 | |||
84 | M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); | ||
85 | M_ASN1_I2D_put_SET(a->md_algs,i2d_X509_ALGOR); | ||
86 | M_ASN1_I2D_put(a->contents,i2d_PKCS7); | ||
87 | M_ASN1_I2D_put_IMP_set_opt(a->cert,i2d_X509,0); | ||
88 | M_ASN1_I2D_put_IMP_set_opt(a->crl,i2d_X509_CRL,1); | ||
89 | M_ASN1_I2D_put_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); | ||
90 | |||
91 | M_ASN1_I2D_finish(); | ||
92 | } | ||
93 | |||
94 | PKCS7_SIGNED *d2i_PKCS7_SIGNED(a,pp,length) | ||
95 | PKCS7_SIGNED **a; | ||
96 | unsigned char **pp; | ||
97 | long length; | ||
98 | { | ||
99 | M_ASN1_D2I_vars(a,PKCS7_SIGNED *,PKCS7_SIGNED_new); | ||
100 | |||
101 | M_ASN1_D2I_Init(); | ||
102 | M_ASN1_D2I_start_sequence(); | ||
103 | M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); | ||
104 | M_ASN1_D2I_get_set(ret->md_algs,d2i_X509_ALGOR); | ||
105 | M_ASN1_D2I_get(ret->contents,d2i_PKCS7); | ||
106 | M_ASN1_D2I_get_IMP_set_opt(ret->cert,d2i_X509,0); | ||
107 | M_ASN1_D2I_get_IMP_set_opt(ret->crl,d2i_X509_CRL,1); | ||
108 | M_ASN1_D2I_get_set(ret->signer_info,d2i_PKCS7_SIGNER_INFO); | ||
109 | |||
110 | M_ASN1_D2I_Finish(a,PKCS7_SIGNED_free,ASN1_F_D2I_PKCS7_SIGNED); | ||
111 | } | ||
112 | |||
113 | PKCS7_SIGNED *PKCS7_SIGNED_new() | ||
114 | { | ||
115 | PKCS7_SIGNED *ret=NULL; | ||
116 | |||
117 | M_ASN1_New_Malloc(ret,PKCS7_SIGNED); | ||
118 | M_ASN1_New(ret->version,ASN1_INTEGER_new); | ||
119 | M_ASN1_New(ret->md_algs,sk_new_null); | ||
120 | M_ASN1_New(ret->contents,PKCS7_new); | ||
121 | ret->cert=NULL; | ||
122 | ret->crl=NULL; | ||
123 | M_ASN1_New(ret->signer_info,sk_new_null); | ||
124 | return(ret); | ||
125 | M_ASN1_New_Error(ASN1_F_PKCS7_SIGNED_NEW); | ||
126 | } | ||
127 | |||
128 | void PKCS7_SIGNED_free(a) | ||
129 | PKCS7_SIGNED *a; | ||
130 | { | ||
131 | if (a == NULL) return; | ||
132 | ASN1_INTEGER_free(a->version); | ||
133 | sk_pop_free(a->md_algs,X509_ALGOR_free); | ||
134 | PKCS7_free(a->contents); | ||
135 | sk_pop_free(a->cert,X509_free); | ||
136 | sk_pop_free(a->crl,X509_CRL_free); | ||
137 | sk_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free); | ||
138 | Free((char *)a); | ||
139 | } | ||
140 | |||
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 @@ | |||
1 | /* crypto/asn1/p7_signi.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "asn1_mac.h" | ||
62 | #include "x509.h" | ||
63 | |||
64 | /* | ||
65 | * ASN1err(ASN1_F_PKCS7_SIGNER_INFO_NEW,ASN1_R_LENGTH_MISMATCH); | ||
66 | * ASN1err(ASN1_F_D2I_PKCS7_SIGNER_INFO,ASN1_R_LENGTH_MISMATCH); | ||
67 | */ | ||
68 | |||
69 | int i2d_PKCS7_SIGNER_INFO(a,pp) | ||
70 | PKCS7_SIGNER_INFO *a; | ||
71 | unsigned char **pp; | ||
72 | { | ||
73 | M_ASN1_I2D_vars(a); | ||
74 | |||
75 | M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); | ||
76 | M_ASN1_I2D_len(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); | ||
77 | M_ASN1_I2D_len(a->digest_alg,i2d_X509_ALGOR); | ||
78 | M_ASN1_I2D_len_IMP_set_opt(a->auth_attr,i2d_X509_ATTRIBUTE,0); | ||
79 | M_ASN1_I2D_len(a->digest_enc_alg,i2d_X509_ALGOR); | ||
80 | M_ASN1_I2D_len(a->enc_digest,i2d_ASN1_OCTET_STRING); | ||
81 | M_ASN1_I2D_len_IMP_set_opt(a->unauth_attr,i2d_X509_ATTRIBUTE,1); | ||
82 | |||
83 | M_ASN1_I2D_seq_total(); | ||
84 | |||
85 | M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); | ||
86 | M_ASN1_I2D_put(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); | ||
87 | M_ASN1_I2D_put(a->digest_alg,i2d_X509_ALGOR); | ||
88 | M_ASN1_I2D_put_IMP_set_opt(a->auth_attr,i2d_X509_ATTRIBUTE,0); | ||
89 | M_ASN1_I2D_put(a->digest_enc_alg,i2d_X509_ALGOR); | ||
90 | M_ASN1_I2D_put(a->enc_digest,i2d_ASN1_OCTET_STRING); | ||
91 | M_ASN1_I2D_put_IMP_set_opt(a->unauth_attr,i2d_X509_ATTRIBUTE,1); | ||
92 | |||
93 | M_ASN1_I2D_finish(); | ||
94 | } | ||
95 | |||
96 | PKCS7_SIGNER_INFO *d2i_PKCS7_SIGNER_INFO(a,pp,length) | ||
97 | PKCS7_SIGNER_INFO **a; | ||
98 | unsigned char **pp; | ||
99 | long length; | ||
100 | { | ||
101 | M_ASN1_D2I_vars(a,PKCS7_SIGNER_INFO *,PKCS7_SIGNER_INFO_new); | ||
102 | |||
103 | M_ASN1_D2I_Init(); | ||
104 | M_ASN1_D2I_start_sequence(); | ||
105 | M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); | ||
106 | M_ASN1_D2I_get(ret->issuer_and_serial,d2i_PKCS7_ISSUER_AND_SERIAL); | ||
107 | M_ASN1_D2I_get(ret->digest_alg,d2i_X509_ALGOR); | ||
108 | M_ASN1_D2I_get_IMP_set_opt(ret->auth_attr,d2i_X509_ATTRIBUTE,0); | ||
109 | M_ASN1_D2I_get(ret->digest_enc_alg,d2i_X509_ALGOR); | ||
110 | M_ASN1_D2I_get(ret->enc_digest,d2i_ASN1_OCTET_STRING); | ||
111 | M_ASN1_D2I_get_IMP_set_opt(ret->unauth_attr,d2i_X509_ATTRIBUTE,1); | ||
112 | |||
113 | M_ASN1_D2I_Finish(a,PKCS7_SIGNER_INFO_free, | ||
114 | ASN1_F_D2I_PKCS7_SIGNER_INFO); | ||
115 | } | ||
116 | |||
117 | PKCS7_SIGNER_INFO *PKCS7_SIGNER_INFO_new() | ||
118 | { | ||
119 | PKCS7_SIGNER_INFO *ret=NULL; | ||
120 | |||
121 | M_ASN1_New_Malloc(ret,PKCS7_SIGNER_INFO); | ||
122 | M_ASN1_New(ret->version,ASN1_INTEGER_new); | ||
123 | M_ASN1_New(ret->issuer_and_serial,PKCS7_ISSUER_AND_SERIAL_new); | ||
124 | M_ASN1_New(ret->digest_alg,X509_ALGOR_new); | ||
125 | ret->auth_attr=NULL; | ||
126 | M_ASN1_New(ret->digest_enc_alg,X509_ALGOR_new); | ||
127 | M_ASN1_New(ret->enc_digest,ASN1_OCTET_STRING_new); | ||
128 | ret->unauth_attr=NULL; | ||
129 | ret->pkey=NULL; | ||
130 | return(ret); | ||
131 | M_ASN1_New_Error(ASN1_F_PKCS7_SIGNER_INFO_NEW); | ||
132 | } | ||
133 | |||
134 | void PKCS7_SIGNER_INFO_free(a) | ||
135 | PKCS7_SIGNER_INFO *a; | ||
136 | { | ||
137 | if (a == NULL) return; | ||
138 | ASN1_INTEGER_free(a->version); | ||
139 | PKCS7_ISSUER_AND_SERIAL_free(a->issuer_and_serial); | ||
140 | X509_ALGOR_free(a->digest_alg); | ||
141 | sk_pop_free(a->auth_attr,X509_ATTRIBUTE_free); | ||
142 | X509_ALGOR_free(a->digest_enc_alg); | ||
143 | ASN1_OCTET_STRING_free(a->enc_digest); | ||
144 | sk_pop_free(a->unauth_attr,X509_ATTRIBUTE_free); | ||
145 | if (a->pkey != NULL) | ||
146 | EVP_PKEY_free(a->pkey); | ||
147 | Free((char *)a); | ||
148 | } | ||
149 | |||
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 @@ | |||
1 | /* crypto/asn1/pkcs8.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "asn1_mac.h" | ||
62 | #include "objects.h" | ||
63 | |||
64 | /* | ||
65 | * ASN1err(ASN1_F_D2I_X509_KEY,ASN1_R_LENGTH_MISMATCH); | ||
66 | * ASN1err(ASN1_F_X509_KEY_NEW,ASN1_R_BAD_GET_OBJECT); | ||
67 | */ | ||
68 | |||
69 | int i2d_X509_KEY(a,pp) | ||
70 | X509 *a; | ||
71 | unsigned char **pp; | ||
72 | { | ||
73 | M_ASN1_I2D_vars(a); | ||
74 | |||
75 | M_ASN1_I2D_len(a->cert_info, i2d_X509_CINF); | ||
76 | M_ASN1_I2D_len(a->sig_alg, i2d_X509_ALGOR); | ||
77 | M_ASN1_I2D_len(a->signature, i2d_ASN1_BIT_STRING); | ||
78 | |||
79 | M_ASN1_I2D_seq_total(); | ||
80 | |||
81 | M_ASN1_I2D_put(a->cert_info, i2d_X509_CINF); | ||
82 | M_ASN1_I2D_put(a->sig_alg, i2d_X509_ALGOR); | ||
83 | M_ASN1_I2D_put(a->signature, i2d_ASN1_BIT_STRING); | ||
84 | |||
85 | M_ASN1_I2D_finish(); | ||
86 | } | ||
87 | |||
88 | X509 *d2i_X509_KEY(a,pp,length) | ||
89 | X509 **a; | ||
90 | unsigned char **pp; | ||
91 | long length; | ||
92 | { | ||
93 | M_ASN1_D2I_vars(a,X509 *,X509_new); | ||
94 | |||
95 | M_ASN1_D2I_Init(); | ||
96 | M_ASN1_D2I_start_sequence(); | ||
97 | M_ASN1_D2I_get(ret->cert_info,d2i_X509_CINF); | ||
98 | M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR); | ||
99 | M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING); | ||
100 | M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509); | ||
101 | } | ||
102 | |||
103 | X509 *X509_KEY_new() | ||
104 | { | ||
105 | X509_KEY *ret=NULL; | ||
106 | |||
107 | M_ASN1_New_Malloc(ret,X509_KEY); | ||
108 | ret->references=1; | ||
109 | ret->type=NID | ||
110 | M_ASN1_New(ret->cert_info,X509_CINF_new); | ||
111 | M_ASN1_New(ret->sig_alg,X509_ALGOR_new); | ||
112 | M_ASN1_New(ret->signature,ASN1_BIT_STRING_new); | ||
113 | return(ret); | ||
114 | M_ASN1_New_Error(ASN1_F_X509_NEW); | ||
115 | } | ||
116 | |||
117 | void X509_KEY_free(a) | ||
118 | X509 *a; | ||
119 | { | ||
120 | int i; | ||
121 | |||
122 | if (a == NULL) return; | ||
123 | |||
124 | i=CRYPTO_add_lock(&a->references,-1,CRYPTO_LOCK_X509_KEY); | ||
125 | #ifdef REF_PRINT | ||
126 | REF_PRINT("X509_KEY",a); | ||
127 | #endif | ||
128 | if (i > 0) return; | ||
129 | #ifdef REF_CHECK | ||
130 | if (i < 0) | ||
131 | { | ||
132 | fprintf(stderr,"X509_KEY_free, bad reference count\n"); | ||
133 | abort(); | ||
134 | } | ||
135 | #endif | ||
136 | |||
137 | X509_CINF_free(a->cert_info); | ||
138 | X509_ALGOR_free(a->sig_alg); | ||
139 | ASN1_BIT_STRING_free(a->signature); | ||
140 | Free((char *)a); | ||
141 | } | ||
142 | |||
diff --git a/src/lib/libcrypto/asn1/x_cinf.c b/src/lib/libcrypto/asn1/x_cinf.c new file mode 100644 index 0000000000..4fc2cc9f6e --- /dev/null +++ b/src/lib/libcrypto/asn1/x_cinf.c | |||
@@ -0,0 +1,197 @@ | |||
1 | /* crypto/asn1/x_cinf.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "asn1_mac.h" | ||
62 | |||
63 | /* | ||
64 | * ASN1err(ASN1_F_D2I_X509_CINF,ASN1_R_LENGTH_MISMATCH); | ||
65 | * ASN1err(ASN1_F_X509_CINF_NEW,ASN1_R_LENGTH_MISMATCH); | ||
66 | */ | ||
67 | |||
68 | int i2d_X509_CINF(a,pp) | ||
69 | X509_CINF *a; | ||
70 | unsigned char **pp; | ||
71 | { | ||
72 | int v1=0,v2=0; | ||
73 | M_ASN1_I2D_vars(a); | ||
74 | |||
75 | M_ASN1_I2D_len_EXP_opt(a->version,i2d_ASN1_INTEGER,0,v1); | ||
76 | M_ASN1_I2D_len(a->serialNumber, i2d_ASN1_INTEGER); | ||
77 | M_ASN1_I2D_len(a->signature, i2d_X509_ALGOR); | ||
78 | M_ASN1_I2D_len(a->issuer, i2d_X509_NAME); | ||
79 | M_ASN1_I2D_len(a->validity, i2d_X509_VAL); | ||
80 | M_ASN1_I2D_len(a->subject, i2d_X509_NAME); | ||
81 | M_ASN1_I2D_len(a->key, i2d_X509_PUBKEY); | ||
82 | M_ASN1_I2D_len_IMP_opt(a->issuerUID, i2d_ASN1_BIT_STRING); | ||
83 | M_ASN1_I2D_len_IMP_opt(a->subjectUID, i2d_ASN1_BIT_STRING); | ||
84 | M_ASN1_I2D_len_EXP_set_opt(a->extensions,i2d_X509_EXTENSION,3,V_ASN1_SEQUENCE,v2); | ||
85 | |||
86 | M_ASN1_I2D_seq_total(); | ||
87 | |||
88 | M_ASN1_I2D_put_EXP_opt(a->version,i2d_ASN1_INTEGER,0,v1); | ||
89 | M_ASN1_I2D_put(a->serialNumber, i2d_ASN1_INTEGER); | ||
90 | M_ASN1_I2D_put(a->signature, i2d_X509_ALGOR); | ||
91 | M_ASN1_I2D_put(a->issuer, i2d_X509_NAME); | ||
92 | M_ASN1_I2D_put(a->validity, i2d_X509_VAL); | ||
93 | M_ASN1_I2D_put(a->subject, i2d_X509_NAME); | ||
94 | M_ASN1_I2D_put(a->key, i2d_X509_PUBKEY); | ||
95 | M_ASN1_I2D_put_IMP_opt(a->issuerUID, i2d_ASN1_BIT_STRING,1); | ||
96 | M_ASN1_I2D_put_IMP_opt(a->subjectUID, i2d_ASN1_BIT_STRING,2); | ||
97 | M_ASN1_I2D_put_EXP_set_opt(a->extensions,i2d_X509_EXTENSION,3,V_ASN1_SEQUENCE,v2); | ||
98 | |||
99 | M_ASN1_I2D_finish(); | ||
100 | } | ||
101 | |||
102 | X509_CINF *d2i_X509_CINF(a,pp,length) | ||
103 | X509_CINF **a; | ||
104 | unsigned char **pp; | ||
105 | long length; | ||
106 | { | ||
107 | int ver=0; | ||
108 | M_ASN1_D2I_vars(a,X509_CINF *,X509_CINF_new); | ||
109 | |||
110 | M_ASN1_D2I_Init(); | ||
111 | M_ASN1_D2I_start_sequence(); | ||
112 | /* we have the optional version field */ | ||
113 | if (M_ASN1_next == (V_ASN1_CONTEXT_SPECIFIC | V_ASN1_CONSTRUCTED | 0)) | ||
114 | { | ||
115 | M_ASN1_D2I_get_EXP_opt(ret->version,d2i_ASN1_INTEGER,0); | ||
116 | if (ret->version->data != NULL) | ||
117 | ver=ret->version->data[0]; | ||
118 | } | ||
119 | else | ||
120 | { | ||
121 | if (ret->version != NULL) | ||
122 | { | ||
123 | ASN1_INTEGER_free(ret->version); | ||
124 | ret->version=NULL; | ||
125 | } | ||
126 | } | ||
127 | M_ASN1_D2I_get(ret->serialNumber,d2i_ASN1_INTEGER); | ||
128 | M_ASN1_D2I_get(ret->signature,d2i_X509_ALGOR); | ||
129 | M_ASN1_D2I_get(ret->issuer,d2i_X509_NAME); | ||
130 | M_ASN1_D2I_get(ret->validity,d2i_X509_VAL); | ||
131 | M_ASN1_D2I_get(ret->subject,d2i_X509_NAME); | ||
132 | M_ASN1_D2I_get(ret->key,d2i_X509_PUBKEY); | ||
133 | if (ver >= 1) /* version 2 extensions */ | ||
134 | { | ||
135 | if (ret->issuerUID != NULL) | ||
136 | { | ||
137 | ASN1_BIT_STRING_free(ret->issuerUID); | ||
138 | ret->issuerUID=NULL; | ||
139 | } | ||
140 | if (ret->subjectUID != NULL) | ||
141 | { | ||
142 | ASN1_BIT_STRING_free(ret->subjectUID); | ||
143 | ret->issuerUID=NULL; | ||
144 | } | ||
145 | M_ASN1_D2I_get_IMP_opt(ret->issuerUID,d2i_ASN1_BIT_STRING, 1, | ||
146 | V_ASN1_BIT_STRING); | ||
147 | M_ASN1_D2I_get_IMP_opt(ret->subjectUID,d2i_ASN1_BIT_STRING, 2, | ||
148 | V_ASN1_BIT_STRING); | ||
149 | } | ||
150 | if (ver >= 2) /* version 3 extensions */ | ||
151 | { | ||
152 | if (ret->extensions != NULL) | ||
153 | while (sk_num(ret->extensions)) | ||
154 | X509_EXTENSION_free((X509_EXTENSION *) | ||
155 | sk_pop(ret->extensions)); | ||
156 | M_ASN1_D2I_get_EXP_set_opt(ret->extensions,d2i_X509_EXTENSION,3, | ||
157 | V_ASN1_SEQUENCE); | ||
158 | } | ||
159 | M_ASN1_D2I_Finish(a,X509_CINF_free,ASN1_F_D2I_X509_CINF); | ||
160 | } | ||
161 | |||
162 | X509_CINF *X509_CINF_new() | ||
163 | { | ||
164 | X509_CINF *ret=NULL; | ||
165 | |||
166 | M_ASN1_New_Malloc(ret,X509_CINF); | ||
167 | ret->version=NULL; | ||
168 | M_ASN1_New(ret->serialNumber,ASN1_INTEGER_new); | ||
169 | M_ASN1_New(ret->signature,X509_ALGOR_new); | ||
170 | M_ASN1_New(ret->issuer,X509_NAME_new); | ||
171 | M_ASN1_New(ret->validity,X509_VAL_new); | ||
172 | M_ASN1_New(ret->subject,X509_NAME_new); | ||
173 | M_ASN1_New(ret->key,X509_PUBKEY_new); | ||
174 | ret->issuerUID=NULL; | ||
175 | ret->subjectUID=NULL; | ||
176 | ret->extensions=NULL; | ||
177 | return(ret); | ||
178 | M_ASN1_New_Error(ASN1_F_X509_CINF_NEW); | ||
179 | } | ||
180 | |||
181 | void X509_CINF_free(a) | ||
182 | X509_CINF *a; | ||
183 | { | ||
184 | if (a == NULL) return; | ||
185 | ASN1_INTEGER_free(a->version); | ||
186 | ASN1_INTEGER_free(a->serialNumber); | ||
187 | X509_ALGOR_free(a->signature); | ||
188 | X509_NAME_free(a->issuer); | ||
189 | X509_VAL_free(a->validity); | ||
190 | X509_NAME_free(a->subject); | ||
191 | X509_PUBKEY_free(a->key); | ||
192 | ASN1_BIT_STRING_free(a->issuerUID); | ||
193 | ASN1_BIT_STRING_free(a->subjectUID); | ||
194 | sk_pop_free(a->extensions,X509_EXTENSION_free); | ||
195 | Free((char *)a); | ||
196 | } | ||
197 | |||
diff --git a/src/lib/libcrypto/bf/Makefile.ssl b/src/lib/libcrypto/bf/Makefile.ssl new file mode 100644 index 0000000000..236671f238 --- /dev/null +++ b/src/lib/libcrypto/bf/Makefile.ssl | |||
@@ -0,0 +1,107 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/blowfish/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= bf | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | CPP= $(CC) -E | ||
9 | INCLUDES= | ||
10 | CFLAG=-g | ||
11 | INSTALLTOP=/usr/local/ssl | ||
12 | MAKE= make -f Makefile.ssl | ||
13 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
14 | MAKEFILE= Makefile.ssl | ||
15 | AR= ar r | ||
16 | |||
17 | BF_ENC= bf_enc.o | ||
18 | # or use | ||
19 | #DES_ENC= bx86-elf.o | ||
20 | |||
21 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
22 | |||
23 | GENERAL=Makefile | ||
24 | TEST=bftest.c | ||
25 | APPS= | ||
26 | |||
27 | LIB=$(TOP)/libcrypto.a | ||
28 | LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c | ||
29 | LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cfb64.o bf_ofb64.o | ||
30 | |||
31 | SRC= $(LIBSRC) | ||
32 | |||
33 | EXHEADER= blowfish.h | ||
34 | HEADER= bf_pi.h bf_locl.h $(EXHEADER) | ||
35 | |||
36 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
37 | |||
38 | top: | ||
39 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
40 | |||
41 | all: lib | ||
42 | |||
43 | lib: $(LIBOBJ) | ||
44 | $(AR) $(LIB) $(LIBOBJ) | ||
45 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
46 | @touch lib | ||
47 | |||
48 | # elf | ||
49 | asm/bx86-elf.o: asm/bx86unix.cpp | ||
50 | $(CPP) -DELF asm/bx86unix.cpp | as -o asm/bx86-elf.o | ||
51 | |||
52 | # solaris | ||
53 | asm/bx86-sol.o: asm/bx86unix.cpp | ||
54 | $(CC) -E -DSOL asm/bx86unix.cpp | sed 's/^#.*//' > asm/bx86-sol.s | ||
55 | as -o asm/bx86-sol.o asm/bx86-sol.s | ||
56 | rm -f asm/bx86-sol.s | ||
57 | |||
58 | # a.out | ||
59 | asm/bx86-out.o: asm/bx86unix.cpp | ||
60 | $(CPP) -DOUT asm/bx86unix.cpp | as -o asm/bx86-out.o | ||
61 | |||
62 | # bsdi | ||
63 | asm/bx86bsdi.o: asm/bx86unix.cpp | ||
64 | $(CPP) -DBSDI asm/bx86unix.cpp | as -o asm/bx86bsdi.o | ||
65 | |||
66 | asm/bx86unix.cpp: | ||
67 | (cd asm; perl bf-586.pl cpp >bx86unix.cpp) | ||
68 | |||
69 | files: | ||
70 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
71 | |||
72 | links: | ||
73 | /bin/rm -f Makefile | ||
74 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
75 | $(TOP)/util/point.sh ../../doc/blowfish.doc blowfish.doc ; | ||
76 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
77 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
78 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
79 | |||
80 | install: | ||
81 | @for i in $(EXHEADER) ; \ | ||
82 | do \ | ||
83 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
84 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
85 | done; | ||
86 | |||
87 | tags: | ||
88 | ctags $(SRC) | ||
89 | |||
90 | tests: | ||
91 | |||
92 | lint: | ||
93 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
94 | |||
95 | depend: | ||
96 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
97 | |||
98 | dclean: | ||
99 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
100 | mv -f Makefile.new $(MAKEFILE) | ||
101 | |||
102 | clean: | ||
103 | /bin/rm -f *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
104 | |||
105 | errors: | ||
106 | |||
107 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | # Targets | ||
2 | # make - twidle the options yourself :-) | ||
3 | # make cc - standard cc options | ||
4 | # make gcc - standard gcc options | ||
5 | # make x86-elf - linux-elf etc | ||
6 | # make x86-out - linux-a.out, FreeBSD etc | ||
7 | # make x86-solaris | ||
8 | # make x86-bdsi | ||
9 | |||
10 | DIR= bf | ||
11 | TOP= . | ||
12 | # use BF_PTR2 for intel boxes, | ||
13 | # BF_PTR for sparc and MIPS/SGI | ||
14 | # use nothing for Alpha and HP. | ||
15 | |||
16 | # There are 3 possible performance options, experiment :-) | ||
17 | #OPTS= -DBF_PTR # usr for sparc and MIPS/SGI | ||
18 | #OPTS= -DBF_PTR2 # use for pentium | ||
19 | OPTS= # use for pentium pro, Alpha and HP | ||
20 | |||
21 | MAKE=make -f Makefile | ||
22 | #CC=cc | ||
23 | #CFLAG= -O | ||
24 | |||
25 | CC=gcc | ||
26 | #CFLAG= -O4 -funroll-loops -fomit-frame-pointer | ||
27 | CFLAG= -O3 -fomit-frame-pointer | ||
28 | |||
29 | CFLAGS=$(OPTS) $(CFLAG) | ||
30 | CPP=$(CC) -E | ||
31 | AS=as | ||
32 | |||
33 | # Assember version of bf_encrypt(). | ||
34 | BF_ENC=bf_enc.o # normal C version | ||
35 | #BF_ENC=asm/bx86-elf.o # elf format x86 | ||
36 | #BF_ENC=asm/bx86-out.o # a.out format x86 | ||
37 | #BF_ENC=asm/bx86-sol.o # solaris format x86 | ||
38 | #BF_ENC=asm/bx86bsdi.o # bsdi format x86 | ||
39 | |||
40 | LIBDIR=/usr/local/lib | ||
41 | BINDIR=/usr/local/bin | ||
42 | INCDIR=/usr/local/include | ||
43 | MANDIR=/usr/local/man | ||
44 | MAN1=1 | ||
45 | MAN3=3 | ||
46 | SHELL=/bin/sh | ||
47 | LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cfb64.o bf_ofb64.o | ||
48 | LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c | ||
49 | |||
50 | GENERAL=Makefile Makefile.ssl Makefile.uni asm bf_locl.org README \ | ||
51 | COPYRIGHT blowfish.doc INSTALL | ||
52 | |||
53 | TESTING= bftest bfspeed bf_opts | ||
54 | TESTING_SRC=bftest.c bfspeed.c bf_opts.c | ||
55 | HEADERS=bf_locl.h blowfish.h bf_pi.h | ||
56 | |||
57 | ALL= $(GENERAL) $(TESTING_SRC) $(LIBSRC) $(HEADERS) | ||
58 | |||
59 | BLIB= libblowfish.a | ||
60 | |||
61 | all: $(BLIB) $(TESTING) | ||
62 | |||
63 | cc: | ||
64 | $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all | ||
65 | |||
66 | gcc: | ||
67 | $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all | ||
68 | |||
69 | x86-elf: | ||
70 | $(MAKE) BF_ENC='asm/bx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all | ||
71 | |||
72 | x86-out: | ||
73 | $(MAKE) BF_ENC='asm/bx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all | ||
74 | |||
75 | x86-solaris: | ||
76 | $(MAKE) BF_ENC='asm/bx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all | ||
77 | |||
78 | x86-bsdi: | ||
79 | $(MAKE) BF_ENC='asm/bx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all | ||
80 | |||
81 | # elf | ||
82 | asm/bx86-elf.o: asm/bx86unix.cpp | ||
83 | $(CPP) -DELF asm/bx86unix.cpp | $(AS) -o asm/bx86-elf.o | ||
84 | |||
85 | # solaris | ||
86 | asm/bx86-sol.o: asm/bx86unix.cpp | ||
87 | $(CC) -E -DSOL asm/bx86unix.cpp | sed 's/^#.*//' > asm/bx86-sol.s | ||
88 | as -o asm/bx86-sol.o asm/bx86-sol.s | ||
89 | rm -f asm/bx86-sol.s | ||
90 | |||
91 | # a.out | ||
92 | asm/bx86-out.o: asm/bx86unix.cpp | ||
93 | $(CPP) -DOUT asm/bx86unix.cpp | $(AS) -o asm/bx86-out.o | ||
94 | |||
95 | # bsdi | ||
96 | asm/bx86bsdi.o: asm/bx86unix.cpp | ||
97 | $(CPP) -DBSDI asm/bx86unix.cpp | $(AS) -o asm/bx86bsdi.o | ||
98 | |||
99 | asm/bx86unix.cpp: | ||
100 | (cd asm; perl bf-586.pl cpp >bx86unix.cpp) | ||
101 | |||
102 | test: all | ||
103 | ./bftest | ||
104 | |||
105 | $(BLIB): $(LIBOBJ) | ||
106 | /bin/rm -f $(BLIB) | ||
107 | ar cr $(BLIB) $(LIBOBJ) | ||
108 | -if test -s /bin/ranlib; then /bin/ranlib $(BLIB); \ | ||
109 | else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(BLIB); \ | ||
110 | else exit 0; fi; fi | ||
111 | |||
112 | bftest: bftest.o $(BLIB) | ||
113 | $(CC) $(CFLAGS) -o bftest bftest.o $(BLIB) | ||
114 | |||
115 | bfspeed: bfspeed.o $(BLIB) | ||
116 | $(CC) $(CFLAGS) -o bfspeed bfspeed.o $(BLIB) | ||
117 | |||
118 | bf_opts: bf_opts.o $(BLIB) | ||
119 | $(CC) $(CFLAGS) -o bf_opts bf_opts.o $(BLIB) | ||
120 | |||
121 | tags: | ||
122 | ctags $(TESTING_SRC) $(LIBBF) | ||
123 | |||
124 | tar: | ||
125 | tar chf libbf.tar $(ALL) | ||
126 | |||
127 | shar: | ||
128 | shar $(ALL) >libbf.shar | ||
129 | |||
130 | depend: | ||
131 | makedepend $(LIBBF) $(TESTING_SRC) | ||
132 | |||
133 | clean: | ||
134 | /bin/rm -f *.o tags core $(TESTING) $(BLIB) .nfs* *.old *.bak asm/*.o | ||
135 | |||
136 | dclean: | ||
137 | sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new | ||
138 | mv -f Makefile.new Makefile | ||
139 | |||
140 | # Eric is probably going to choke when he next looks at this --tjh | ||
141 | install: $(BLIB) | ||
142 | if test $(INSTALLTOP); then \ | ||
143 | echo SSL style install; \ | ||
144 | cp $(BLIB) $(INSTALLTOP)/lib; \ | ||
145 | if test -s /bin/ranlib; then \ | ||
146 | /bin/ranlib $(INSTALLTOP)/lib/$(BLIB); \ | ||
147 | else \ | ||
148 | if test -s /usr/bin/ranlib; then \ | ||
149 | /usr/bin/ranlib $(INSTALLTOP)/lib/$(BLIB); \ | ||
150 | fi; fi; \ | ||
151 | chmod 644 $(INSTALLTOP)/lib/$(BLIB); \ | ||
152 | cp blowfish.h $(INSTALLTOP)/include; \ | ||
153 | chmod 644 $(INSTALLTOP)/include/blowfish.h; \ | ||
154 | else \ | ||
155 | echo Standalone install; \ | ||
156 | cp $(BLIB) $(LIBDIR)/$(BLIB); \ | ||
157 | if test -s /bin/ranlib; then \ | ||
158 | /bin/ranlib $(LIBDIR)/$(BLIB); \ | ||
159 | else \ | ||
160 | if test -s /usr/bin/ranlib; then \ | ||
161 | /usr/bin/ranlib $(LIBDIR)/$(BLIB); \ | ||
162 | fi; \ | ||
163 | fi; \ | ||
164 | chmod 644 $(LIBDIR)/$(BLIB); \ | ||
165 | cp blowfish.h $(INCDIR)/blowfish.h; \ | ||
166 | chmod 644 $(INCDIR)/blowfish.h; \ | ||
167 | fi | ||
168 | |||
169 | # 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 @@ | |||
1 | ; Don't even think of reading this code | ||
2 | ; It was automatically generated by bf-586.pl | ||
3 | ; Which is a perl program used to generate the x86 assember for | ||
4 | ; any of elf, a.out, BSDI,Win32, or Solaris | ||
5 | ; eric <eay@cryptsoft.com> | ||
6 | ; | ||
7 | TITLE bf-586.asm | ||
8 | .486 | ||
9 | .model FLAT | ||
10 | _TEXT SEGMENT | ||
11 | PUBLIC _BF_encrypt | ||
12 | |||
13 | _BF_encrypt PROC NEAR | ||
14 | ; | ||
15 | push ebp | ||
16 | push ebx | ||
17 | mov ebx, DWORD PTR 12[esp] | ||
18 | mov ebp, DWORD PTR 16[esp] | ||
19 | push esi | ||
20 | push edi | ||
21 | ; Load the 2 words | ||
22 | mov edi, DWORD PTR [ebx] | ||
23 | mov esi, DWORD PTR 4[ebx] | ||
24 | xor eax, eax | ||
25 | mov ebx, DWORD PTR [ebp] | ||
26 | xor ecx, ecx | ||
27 | xor edi, ebx | ||
28 | ; | ||
29 | ; Round 0 | ||
30 | mov edx, DWORD PTR 4[ebp] | ||
31 | mov ebx, edi | ||
32 | xor esi, edx | ||
33 | shr ebx, 16 | ||
34 | mov edx, edi | ||
35 | mov al, bh | ||
36 | and ebx, 255 | ||
37 | mov cl, dh | ||
38 | and edx, 255 | ||
39 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
40 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
41 | add ebx, eax | ||
42 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
43 | xor ebx, eax | ||
44 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
45 | add ebx, edx | ||
46 | xor eax, eax | ||
47 | xor esi, ebx | ||
48 | ; | ||
49 | ; Round 1 | ||
50 | mov edx, DWORD PTR 8[ebp] | ||
51 | mov ebx, esi | ||
52 | xor edi, edx | ||
53 | shr ebx, 16 | ||
54 | mov edx, esi | ||
55 | mov al, bh | ||
56 | and ebx, 255 | ||
57 | mov cl, dh | ||
58 | and edx, 255 | ||
59 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
60 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
61 | add ebx, eax | ||
62 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
63 | xor ebx, eax | ||
64 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
65 | add ebx, edx | ||
66 | xor eax, eax | ||
67 | xor edi, ebx | ||
68 | ; | ||
69 | ; Round 2 | ||
70 | mov edx, DWORD PTR 12[ebp] | ||
71 | mov ebx, edi | ||
72 | xor esi, edx | ||
73 | shr ebx, 16 | ||
74 | mov edx, edi | ||
75 | mov al, bh | ||
76 | and ebx, 255 | ||
77 | mov cl, dh | ||
78 | and edx, 255 | ||
79 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
80 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
81 | add ebx, eax | ||
82 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
83 | xor ebx, eax | ||
84 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
85 | add ebx, edx | ||
86 | xor eax, eax | ||
87 | xor esi, ebx | ||
88 | ; | ||
89 | ; Round 3 | ||
90 | mov edx, DWORD PTR 16[ebp] | ||
91 | mov ebx, esi | ||
92 | xor edi, edx | ||
93 | shr ebx, 16 | ||
94 | mov edx, esi | ||
95 | mov al, bh | ||
96 | and ebx, 255 | ||
97 | mov cl, dh | ||
98 | and edx, 255 | ||
99 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
100 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
101 | add ebx, eax | ||
102 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
103 | xor ebx, eax | ||
104 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
105 | add ebx, edx | ||
106 | xor eax, eax | ||
107 | xor edi, ebx | ||
108 | ; | ||
109 | ; Round 4 | ||
110 | mov edx, DWORD PTR 20[ebp] | ||
111 | mov ebx, edi | ||
112 | xor esi, edx | ||
113 | shr ebx, 16 | ||
114 | mov edx, edi | ||
115 | mov al, bh | ||
116 | and ebx, 255 | ||
117 | mov cl, dh | ||
118 | and edx, 255 | ||
119 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
120 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
121 | add ebx, eax | ||
122 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
123 | xor ebx, eax | ||
124 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
125 | add ebx, edx | ||
126 | xor eax, eax | ||
127 | xor esi, ebx | ||
128 | ; | ||
129 | ; Round 5 | ||
130 | mov edx, DWORD PTR 24[ebp] | ||
131 | mov ebx, esi | ||
132 | xor edi, edx | ||
133 | shr ebx, 16 | ||
134 | mov edx, esi | ||
135 | mov al, bh | ||
136 | and ebx, 255 | ||
137 | mov cl, dh | ||
138 | and edx, 255 | ||
139 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
140 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
141 | add ebx, eax | ||
142 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
143 | xor ebx, eax | ||
144 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
145 | add ebx, edx | ||
146 | xor eax, eax | ||
147 | xor edi, ebx | ||
148 | ; | ||
149 | ; Round 6 | ||
150 | mov edx, DWORD PTR 28[ebp] | ||
151 | mov ebx, edi | ||
152 | xor esi, edx | ||
153 | shr ebx, 16 | ||
154 | mov edx, edi | ||
155 | mov al, bh | ||
156 | and ebx, 255 | ||
157 | mov cl, dh | ||
158 | and edx, 255 | ||
159 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
160 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
161 | add ebx, eax | ||
162 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
163 | xor ebx, eax | ||
164 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
165 | add ebx, edx | ||
166 | xor eax, eax | ||
167 | xor esi, ebx | ||
168 | ; | ||
169 | ; Round 7 | ||
170 | mov edx, DWORD PTR 32[ebp] | ||
171 | mov ebx, esi | ||
172 | xor edi, edx | ||
173 | shr ebx, 16 | ||
174 | mov edx, esi | ||
175 | mov al, bh | ||
176 | and ebx, 255 | ||
177 | mov cl, dh | ||
178 | and edx, 255 | ||
179 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
180 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
181 | add ebx, eax | ||
182 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
183 | xor ebx, eax | ||
184 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
185 | add ebx, edx | ||
186 | xor eax, eax | ||
187 | xor edi, ebx | ||
188 | ; | ||
189 | ; Round 8 | ||
190 | mov edx, DWORD PTR 36[ebp] | ||
191 | mov ebx, edi | ||
192 | xor esi, edx | ||
193 | shr ebx, 16 | ||
194 | mov edx, edi | ||
195 | mov al, bh | ||
196 | and ebx, 255 | ||
197 | mov cl, dh | ||
198 | and edx, 255 | ||
199 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
200 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
201 | add ebx, eax | ||
202 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
203 | xor ebx, eax | ||
204 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
205 | add ebx, edx | ||
206 | xor eax, eax | ||
207 | xor esi, ebx | ||
208 | ; | ||
209 | ; Round 9 | ||
210 | mov edx, DWORD PTR 40[ebp] | ||
211 | mov ebx, esi | ||
212 | xor edi, edx | ||
213 | shr ebx, 16 | ||
214 | mov edx, esi | ||
215 | mov al, bh | ||
216 | and ebx, 255 | ||
217 | mov cl, dh | ||
218 | and edx, 255 | ||
219 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
220 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
221 | add ebx, eax | ||
222 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
223 | xor ebx, eax | ||
224 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
225 | add ebx, edx | ||
226 | xor eax, eax | ||
227 | xor edi, ebx | ||
228 | ; | ||
229 | ; Round 10 | ||
230 | mov edx, DWORD PTR 44[ebp] | ||
231 | mov ebx, edi | ||
232 | xor esi, edx | ||
233 | shr ebx, 16 | ||
234 | mov edx, edi | ||
235 | mov al, bh | ||
236 | and ebx, 255 | ||
237 | mov cl, dh | ||
238 | and edx, 255 | ||
239 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
240 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
241 | add ebx, eax | ||
242 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
243 | xor ebx, eax | ||
244 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
245 | add ebx, edx | ||
246 | xor eax, eax | ||
247 | xor esi, ebx | ||
248 | ; | ||
249 | ; Round 11 | ||
250 | mov edx, DWORD PTR 48[ebp] | ||
251 | mov ebx, esi | ||
252 | xor edi, edx | ||
253 | shr ebx, 16 | ||
254 | mov edx, esi | ||
255 | mov al, bh | ||
256 | and ebx, 255 | ||
257 | mov cl, dh | ||
258 | and edx, 255 | ||
259 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
260 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
261 | add ebx, eax | ||
262 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
263 | xor ebx, eax | ||
264 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
265 | add ebx, edx | ||
266 | xor eax, eax | ||
267 | xor edi, ebx | ||
268 | ; | ||
269 | ; Round 12 | ||
270 | mov edx, DWORD PTR 52[ebp] | ||
271 | mov ebx, edi | ||
272 | xor esi, edx | ||
273 | shr ebx, 16 | ||
274 | mov edx, edi | ||
275 | mov al, bh | ||
276 | and ebx, 255 | ||
277 | mov cl, dh | ||
278 | and edx, 255 | ||
279 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
280 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
281 | add ebx, eax | ||
282 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
283 | xor ebx, eax | ||
284 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
285 | add ebx, edx | ||
286 | xor eax, eax | ||
287 | xor esi, ebx | ||
288 | ; | ||
289 | ; Round 13 | ||
290 | mov edx, DWORD PTR 56[ebp] | ||
291 | mov ebx, esi | ||
292 | xor edi, edx | ||
293 | shr ebx, 16 | ||
294 | mov edx, esi | ||
295 | mov al, bh | ||
296 | and ebx, 255 | ||
297 | mov cl, dh | ||
298 | and edx, 255 | ||
299 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
300 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
301 | add ebx, eax | ||
302 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
303 | xor ebx, eax | ||
304 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
305 | add ebx, edx | ||
306 | xor eax, eax | ||
307 | xor edi, ebx | ||
308 | ; | ||
309 | ; Round 14 | ||
310 | mov edx, DWORD PTR 60[ebp] | ||
311 | mov ebx, edi | ||
312 | xor esi, edx | ||
313 | shr ebx, 16 | ||
314 | mov edx, edi | ||
315 | mov al, bh | ||
316 | and ebx, 255 | ||
317 | mov cl, dh | ||
318 | and edx, 255 | ||
319 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
320 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
321 | add ebx, eax | ||
322 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
323 | xor ebx, eax | ||
324 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
325 | add ebx, edx | ||
326 | xor eax, eax | ||
327 | xor esi, ebx | ||
328 | ; | ||
329 | ; Round 15 | ||
330 | mov edx, DWORD PTR 64[ebp] | ||
331 | mov ebx, esi | ||
332 | xor edi, edx | ||
333 | shr ebx, 16 | ||
334 | mov edx, esi | ||
335 | mov al, bh | ||
336 | and ebx, 255 | ||
337 | mov cl, dh | ||
338 | and edx, 255 | ||
339 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
340 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
341 | add ebx, eax | ||
342 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
343 | xor ebx, eax | ||
344 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
345 | add ebx, edx | ||
346 | ; Load parameter 0 (16) enc=1 | ||
347 | mov eax, DWORD PTR 20[esp] | ||
348 | xor edi, ebx | ||
349 | mov edx, DWORD PTR 68[ebp] | ||
350 | xor esi, edx | ||
351 | mov DWORD PTR 4[eax],edi | ||
352 | mov DWORD PTR [eax],esi | ||
353 | pop edi | ||
354 | pop esi | ||
355 | pop ebx | ||
356 | pop ebp | ||
357 | ret | ||
358 | _BF_encrypt ENDP | ||
359 | _TEXT ENDS | ||
360 | _TEXT SEGMENT | ||
361 | PUBLIC _BF_decrypt | ||
362 | |||
363 | _BF_decrypt PROC NEAR | ||
364 | ; | ||
365 | push ebp | ||
366 | push ebx | ||
367 | mov ebx, DWORD PTR 12[esp] | ||
368 | mov ebp, DWORD PTR 16[esp] | ||
369 | push esi | ||
370 | push edi | ||
371 | ; Load the 2 words | ||
372 | mov edi, DWORD PTR [ebx] | ||
373 | mov esi, DWORD PTR 4[ebx] | ||
374 | xor eax, eax | ||
375 | mov ebx, DWORD PTR 68[ebp] | ||
376 | xor ecx, ecx | ||
377 | xor edi, ebx | ||
378 | ; | ||
379 | ; Round 16 | ||
380 | mov edx, DWORD PTR 64[ebp] | ||
381 | mov ebx, edi | ||
382 | xor esi, edx | ||
383 | shr ebx, 16 | ||
384 | mov edx, edi | ||
385 | mov al, bh | ||
386 | and ebx, 255 | ||
387 | mov cl, dh | ||
388 | and edx, 255 | ||
389 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
390 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
391 | add ebx, eax | ||
392 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
393 | xor ebx, eax | ||
394 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
395 | add ebx, edx | ||
396 | xor eax, eax | ||
397 | xor esi, ebx | ||
398 | ; | ||
399 | ; Round 15 | ||
400 | mov edx, DWORD PTR 60[ebp] | ||
401 | mov ebx, esi | ||
402 | xor edi, edx | ||
403 | shr ebx, 16 | ||
404 | mov edx, esi | ||
405 | mov al, bh | ||
406 | and ebx, 255 | ||
407 | mov cl, dh | ||
408 | and edx, 255 | ||
409 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
410 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
411 | add ebx, eax | ||
412 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
413 | xor ebx, eax | ||
414 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
415 | add ebx, edx | ||
416 | xor eax, eax | ||
417 | xor edi, ebx | ||
418 | ; | ||
419 | ; Round 14 | ||
420 | mov edx, DWORD PTR 56[ebp] | ||
421 | mov ebx, edi | ||
422 | xor esi, edx | ||
423 | shr ebx, 16 | ||
424 | mov edx, edi | ||
425 | mov al, bh | ||
426 | and ebx, 255 | ||
427 | mov cl, dh | ||
428 | and edx, 255 | ||
429 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
430 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
431 | add ebx, eax | ||
432 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
433 | xor ebx, eax | ||
434 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
435 | add ebx, edx | ||
436 | xor eax, eax | ||
437 | xor esi, ebx | ||
438 | ; | ||
439 | ; Round 13 | ||
440 | mov edx, DWORD PTR 52[ebp] | ||
441 | mov ebx, esi | ||
442 | xor edi, edx | ||
443 | shr ebx, 16 | ||
444 | mov edx, esi | ||
445 | mov al, bh | ||
446 | and ebx, 255 | ||
447 | mov cl, dh | ||
448 | and edx, 255 | ||
449 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
450 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
451 | add ebx, eax | ||
452 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
453 | xor ebx, eax | ||
454 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
455 | add ebx, edx | ||
456 | xor eax, eax | ||
457 | xor edi, ebx | ||
458 | ; | ||
459 | ; Round 12 | ||
460 | mov edx, DWORD PTR 48[ebp] | ||
461 | mov ebx, edi | ||
462 | xor esi, edx | ||
463 | shr ebx, 16 | ||
464 | mov edx, edi | ||
465 | mov al, bh | ||
466 | and ebx, 255 | ||
467 | mov cl, dh | ||
468 | and edx, 255 | ||
469 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
470 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
471 | add ebx, eax | ||
472 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
473 | xor ebx, eax | ||
474 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
475 | add ebx, edx | ||
476 | xor eax, eax | ||
477 | xor esi, ebx | ||
478 | ; | ||
479 | ; Round 11 | ||
480 | mov edx, DWORD PTR 44[ebp] | ||
481 | mov ebx, esi | ||
482 | xor edi, edx | ||
483 | shr ebx, 16 | ||
484 | mov edx, esi | ||
485 | mov al, bh | ||
486 | and ebx, 255 | ||
487 | mov cl, dh | ||
488 | and edx, 255 | ||
489 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
490 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
491 | add ebx, eax | ||
492 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
493 | xor ebx, eax | ||
494 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
495 | add ebx, edx | ||
496 | xor eax, eax | ||
497 | xor edi, ebx | ||
498 | ; | ||
499 | ; Round 10 | ||
500 | mov edx, DWORD PTR 40[ebp] | ||
501 | mov ebx, edi | ||
502 | xor esi, edx | ||
503 | shr ebx, 16 | ||
504 | mov edx, edi | ||
505 | mov al, bh | ||
506 | and ebx, 255 | ||
507 | mov cl, dh | ||
508 | and edx, 255 | ||
509 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
510 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
511 | add ebx, eax | ||
512 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
513 | xor ebx, eax | ||
514 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
515 | add ebx, edx | ||
516 | xor eax, eax | ||
517 | xor esi, ebx | ||
518 | ; | ||
519 | ; Round 9 | ||
520 | mov edx, DWORD PTR 36[ebp] | ||
521 | mov ebx, esi | ||
522 | xor edi, edx | ||
523 | shr ebx, 16 | ||
524 | mov edx, esi | ||
525 | mov al, bh | ||
526 | and ebx, 255 | ||
527 | mov cl, dh | ||
528 | and edx, 255 | ||
529 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
530 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
531 | add ebx, eax | ||
532 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
533 | xor ebx, eax | ||
534 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
535 | add ebx, edx | ||
536 | xor eax, eax | ||
537 | xor edi, ebx | ||
538 | ; | ||
539 | ; Round 8 | ||
540 | mov edx, DWORD PTR 32[ebp] | ||
541 | mov ebx, edi | ||
542 | xor esi, edx | ||
543 | shr ebx, 16 | ||
544 | mov edx, edi | ||
545 | mov al, bh | ||
546 | and ebx, 255 | ||
547 | mov cl, dh | ||
548 | and edx, 255 | ||
549 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
550 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
551 | add ebx, eax | ||
552 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
553 | xor ebx, eax | ||
554 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
555 | add ebx, edx | ||
556 | xor eax, eax | ||
557 | xor esi, ebx | ||
558 | ; | ||
559 | ; Round 7 | ||
560 | mov edx, DWORD PTR 28[ebp] | ||
561 | mov ebx, esi | ||
562 | xor edi, edx | ||
563 | shr ebx, 16 | ||
564 | mov edx, esi | ||
565 | mov al, bh | ||
566 | and ebx, 255 | ||
567 | mov cl, dh | ||
568 | and edx, 255 | ||
569 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
570 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
571 | add ebx, eax | ||
572 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
573 | xor ebx, eax | ||
574 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
575 | add ebx, edx | ||
576 | xor eax, eax | ||
577 | xor edi, ebx | ||
578 | ; | ||
579 | ; Round 6 | ||
580 | mov edx, DWORD PTR 24[ebp] | ||
581 | mov ebx, edi | ||
582 | xor esi, edx | ||
583 | shr ebx, 16 | ||
584 | mov edx, edi | ||
585 | mov al, bh | ||
586 | and ebx, 255 | ||
587 | mov cl, dh | ||
588 | and edx, 255 | ||
589 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
590 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
591 | add ebx, eax | ||
592 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
593 | xor ebx, eax | ||
594 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
595 | add ebx, edx | ||
596 | xor eax, eax | ||
597 | xor esi, ebx | ||
598 | ; | ||
599 | ; Round 5 | ||
600 | mov edx, DWORD PTR 20[ebp] | ||
601 | mov ebx, esi | ||
602 | xor edi, edx | ||
603 | shr ebx, 16 | ||
604 | mov edx, esi | ||
605 | mov al, bh | ||
606 | and ebx, 255 | ||
607 | mov cl, dh | ||
608 | and edx, 255 | ||
609 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
610 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
611 | add ebx, eax | ||
612 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
613 | xor ebx, eax | ||
614 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
615 | add ebx, edx | ||
616 | xor eax, eax | ||
617 | xor edi, ebx | ||
618 | ; | ||
619 | ; Round 4 | ||
620 | mov edx, DWORD PTR 16[ebp] | ||
621 | mov ebx, edi | ||
622 | xor esi, edx | ||
623 | shr ebx, 16 | ||
624 | mov edx, edi | ||
625 | mov al, bh | ||
626 | and ebx, 255 | ||
627 | mov cl, dh | ||
628 | and edx, 255 | ||
629 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
630 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
631 | add ebx, eax | ||
632 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
633 | xor ebx, eax | ||
634 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
635 | add ebx, edx | ||
636 | xor eax, eax | ||
637 | xor esi, ebx | ||
638 | ; | ||
639 | ; Round 3 | ||
640 | mov edx, DWORD PTR 12[ebp] | ||
641 | mov ebx, esi | ||
642 | xor edi, edx | ||
643 | shr ebx, 16 | ||
644 | mov edx, esi | ||
645 | mov al, bh | ||
646 | and ebx, 255 | ||
647 | mov cl, dh | ||
648 | and edx, 255 | ||
649 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
650 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
651 | add ebx, eax | ||
652 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
653 | xor ebx, eax | ||
654 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
655 | add ebx, edx | ||
656 | xor eax, eax | ||
657 | xor edi, ebx | ||
658 | ; | ||
659 | ; Round 2 | ||
660 | mov edx, DWORD PTR 8[ebp] | ||
661 | mov ebx, edi | ||
662 | xor esi, edx | ||
663 | shr ebx, 16 | ||
664 | mov edx, edi | ||
665 | mov al, bh | ||
666 | and ebx, 255 | ||
667 | mov cl, dh | ||
668 | and edx, 255 | ||
669 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
670 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
671 | add ebx, eax | ||
672 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
673 | xor ebx, eax | ||
674 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
675 | add ebx, edx | ||
676 | xor eax, eax | ||
677 | xor esi, ebx | ||
678 | ; | ||
679 | ; Round 1 | ||
680 | mov edx, DWORD PTR 4[ebp] | ||
681 | mov ebx, esi | ||
682 | xor edi, edx | ||
683 | shr ebx, 16 | ||
684 | mov edx, esi | ||
685 | mov al, bh | ||
686 | and ebx, 255 | ||
687 | mov cl, dh | ||
688 | and edx, 255 | ||
689 | mov eax, DWORD PTR 72[eax*4+ebp] | ||
690 | mov ebx, DWORD PTR 1096[ebx*4+ebp] | ||
691 | add ebx, eax | ||
692 | mov eax, DWORD PTR 2120[ecx*4+ebp] | ||
693 | xor ebx, eax | ||
694 | mov edx, DWORD PTR 3144[edx*4+ebp] | ||
695 | add ebx, edx | ||
696 | ; Load parameter 0 (1) enc=0 | ||
697 | mov eax, DWORD PTR 20[esp] | ||
698 | xor edi, ebx | ||
699 | mov edx, DWORD PTR [ebp] | ||
700 | xor esi, edx | ||
701 | mov DWORD PTR 4[eax],edi | ||
702 | mov DWORD PTR [eax],esi | ||
703 | pop edi | ||
704 | pop esi | ||
705 | pop ebx | ||
706 | pop ebp | ||
707 | ret | ||
708 | _BF_decrypt ENDP | ||
709 | _TEXT ENDS | ||
710 | _TEXT SEGMENT | ||
711 | PUBLIC _BF_cbc_encrypt | ||
712 | |||
713 | _BF_cbc_encrypt PROC NEAR | ||
714 | ; | ||
715 | push ebp | ||
716 | push ebx | ||
717 | push esi | ||
718 | push edi | ||
719 | mov ebp, DWORD PTR 28[esp] | ||
720 | ; getting iv ptr from parameter 4 | ||
721 | mov ebx, DWORD PTR 36[esp] | ||
722 | mov esi, DWORD PTR [ebx] | ||
723 | mov edi, DWORD PTR 4[ebx] | ||
724 | push edi | ||
725 | push esi | ||
726 | push edi | ||
727 | push esi | ||
728 | mov ebx, esp | ||
729 | mov esi, DWORD PTR 36[esp] | ||
730 | mov edi, DWORD PTR 40[esp] | ||
731 | ; getting encrypt flag from parameter 5 | ||
732 | mov ecx, DWORD PTR 56[esp] | ||
733 | ; get and push parameter 3 | ||
734 | mov eax, DWORD PTR 48[esp] | ||
735 | push eax | ||
736 | push ebx | ||
737 | cmp ecx, 0 | ||
738 | jz $L000decrypt | ||
739 | and ebp, 4294967288 | ||
740 | mov eax, DWORD PTR 8[esp] | ||
741 | mov ebx, DWORD PTR 12[esp] | ||
742 | jz $L001encrypt_finish | ||
743 | L002encrypt_loop: | ||
744 | mov ecx, DWORD PTR [esi] | ||
745 | mov edx, DWORD PTR 4[esi] | ||
746 | xor eax, ecx | ||
747 | xor ebx, edx | ||
748 | bswap eax | ||
749 | bswap ebx | ||
750 | mov DWORD PTR 8[esp],eax | ||
751 | mov DWORD PTR 12[esp],ebx | ||
752 | call _BF_encrypt | ||
753 | mov eax, DWORD PTR 8[esp] | ||
754 | mov ebx, DWORD PTR 12[esp] | ||
755 | bswap eax | ||
756 | bswap ebx | ||
757 | mov DWORD PTR [edi],eax | ||
758 | mov DWORD PTR 4[edi],ebx | ||
759 | add esi, 8 | ||
760 | add edi, 8 | ||
761 | sub ebp, 8 | ||
762 | jnz L002encrypt_loop | ||
763 | $L001encrypt_finish: | ||
764 | mov ebp, DWORD PTR 52[esp] | ||
765 | and ebp, 7 | ||
766 | jz $L003finish | ||
767 | xor ecx, ecx | ||
768 | xor edx, edx | ||
769 | mov ebp, DWORD PTR $L004cbc_enc_jmp_table[ebp*4] | ||
770 | jmp ebp | ||
771 | L005ej7: | ||
772 | mov dh, BYTE PTR 6[esi] | ||
773 | shl edx, 8 | ||
774 | L006ej6: | ||
775 | mov dh, BYTE PTR 5[esi] | ||
776 | L007ej5: | ||
777 | mov dl, BYTE PTR 4[esi] | ||
778 | L008ej4: | ||
779 | mov ecx, DWORD PTR [esi] | ||
780 | jmp $L009ejend | ||
781 | L010ej3: | ||
782 | mov ch, BYTE PTR 2[esi] | ||
783 | shl ecx, 8 | ||
784 | L011ej2: | ||
785 | mov ch, BYTE PTR 1[esi] | ||
786 | L012ej1: | ||
787 | mov cl, BYTE PTR [esi] | ||
788 | $L009ejend: | ||
789 | xor eax, ecx | ||
790 | xor ebx, edx | ||
791 | bswap eax | ||
792 | bswap ebx | ||
793 | mov DWORD PTR 8[esp],eax | ||
794 | mov DWORD PTR 12[esp],ebx | ||
795 | call _BF_encrypt | ||
796 | mov eax, DWORD PTR 8[esp] | ||
797 | mov ebx, DWORD PTR 12[esp] | ||
798 | bswap eax | ||
799 | bswap ebx | ||
800 | mov DWORD PTR [edi],eax | ||
801 | mov DWORD PTR 4[edi],ebx | ||
802 | jmp $L003finish | ||
803 | $L000decrypt: | ||
804 | and ebp, 4294967288 | ||
805 | mov eax, DWORD PTR 16[esp] | ||
806 | mov ebx, DWORD PTR 20[esp] | ||
807 | jz $L013decrypt_finish | ||
808 | L014decrypt_loop: | ||
809 | mov eax, DWORD PTR [esi] | ||
810 | mov ebx, DWORD PTR 4[esi] | ||
811 | bswap eax | ||
812 | bswap ebx | ||
813 | mov DWORD PTR 8[esp],eax | ||
814 | mov DWORD PTR 12[esp],ebx | ||
815 | call _BF_decrypt | ||
816 | mov eax, DWORD PTR 8[esp] | ||
817 | mov ebx, DWORD PTR 12[esp] | ||
818 | bswap eax | ||
819 | bswap ebx | ||
820 | mov ecx, DWORD PTR 16[esp] | ||
821 | mov edx, DWORD PTR 20[esp] | ||
822 | xor ecx, eax | ||
823 | xor edx, ebx | ||
824 | mov eax, DWORD PTR [esi] | ||
825 | mov ebx, DWORD PTR 4[esi] | ||
826 | mov DWORD PTR [edi],ecx | ||
827 | mov DWORD PTR 4[edi],edx | ||
828 | mov DWORD PTR 16[esp],eax | ||
829 | mov DWORD PTR 20[esp],ebx | ||
830 | add esi, 8 | ||
831 | add edi, 8 | ||
832 | sub ebp, 8 | ||
833 | jnz L014decrypt_loop | ||
834 | $L013decrypt_finish: | ||
835 | mov ebp, DWORD PTR 52[esp] | ||
836 | and ebp, 7 | ||
837 | jz $L003finish | ||
838 | mov eax, DWORD PTR [esi] | ||
839 | mov ebx, DWORD PTR 4[esi] | ||
840 | bswap eax | ||
841 | bswap ebx | ||
842 | mov DWORD PTR 8[esp],eax | ||
843 | mov DWORD PTR 12[esp],ebx | ||
844 | call _BF_decrypt | ||
845 | mov eax, DWORD PTR 8[esp] | ||
846 | mov ebx, DWORD PTR 12[esp] | ||
847 | bswap eax | ||
848 | bswap ebx | ||
849 | mov ecx, DWORD PTR 16[esp] | ||
850 | mov edx, DWORD PTR 20[esp] | ||
851 | xor ecx, eax | ||
852 | xor edx, ebx | ||
853 | mov eax, DWORD PTR [esi] | ||
854 | mov ebx, DWORD PTR 4[esi] | ||
855 | L015dj7: | ||
856 | ror edx, 16 | ||
857 | mov BYTE PTR 6[edi],dl | ||
858 | shr edx, 16 | ||
859 | L016dj6: | ||
860 | mov BYTE PTR 5[edi],dh | ||
861 | L017dj5: | ||
862 | mov BYTE PTR 4[edi],dl | ||
863 | L018dj4: | ||
864 | mov DWORD PTR [edi],ecx | ||
865 | jmp $L019djend | ||
866 | L020dj3: | ||
867 | ror ecx, 16 | ||
868 | mov BYTE PTR 2[edi],cl | ||
869 | shl ecx, 16 | ||
870 | L021dj2: | ||
871 | mov BYTE PTR 1[esi],ch | ||
872 | L022dj1: | ||
873 | mov BYTE PTR [esi], cl | ||
874 | $L019djend: | ||
875 | jmp $L003finish | ||
876 | $L003finish: | ||
877 | mov ecx, DWORD PTR 60[esp] | ||
878 | add esp, 24 | ||
879 | mov DWORD PTR [ecx],eax | ||
880 | mov DWORD PTR 4[ecx],ebx | ||
881 | pop edi | ||
882 | pop esi | ||
883 | pop ebx | ||
884 | pop ebp | ||
885 | ret | ||
886 | $L004cbc_enc_jmp_table: | ||
887 | DD 0 | ||
888 | DD L012ej1 | ||
889 | DD L011ej2 | ||
890 | DD L010ej3 | ||
891 | DD L008ej4 | ||
892 | DD L007ej5 | ||
893 | DD L006ej6 | ||
894 | DD L005ej7 | ||
895 | L023cbc_dec_jmp_table: | ||
896 | DD 0 | ||
897 | DD L022dj1 | ||
898 | DD L021dj2 | ||
899 | DD L020dj3 | ||
900 | DD L018dj4 | ||
901 | DD L017dj5 | ||
902 | DD L016dj6 | ||
903 | DD L015dj7 | ||
904 | _BF_cbc_encrypt ENDP | ||
905 | _TEXT ENDS | ||
906 | 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 @@ | |||
1 | /* Run the C pre-processor over this file with one of the following defined | ||
2 | * ELF - elf object files, | ||
3 | * OUT - a.out object files, | ||
4 | * BSDI - BSDI style a.out object files | ||
5 | * SOL - Solaris style elf | ||
6 | */ | ||
7 | |||
8 | #define TYPE(a,b) .type a,b | ||
9 | #define SIZE(a,b) .size a,b | ||
10 | |||
11 | #if defined(OUT) || defined(BSDI) | ||
12 | #define BF_encrypt _BF_encrypt | ||
13 | #define BF_decrypt _BF_decrypt | ||
14 | #define BF_cbc_encrypt _BF_cbc_encrypt | ||
15 | |||
16 | #endif | ||
17 | |||
18 | #ifdef OUT | ||
19 | #define OK 1 | ||
20 | #define ALIGN 4 | ||
21 | #endif | ||
22 | |||
23 | #ifdef BSDI | ||
24 | #define OK 1 | ||
25 | #define ALIGN 4 | ||
26 | #undef SIZE | ||
27 | #undef TYPE | ||
28 | #define SIZE(a,b) | ||
29 | #define TYPE(a,b) | ||
30 | #endif | ||
31 | |||
32 | #if defined(ELF) || defined(SOL) | ||
33 | #define OK 1 | ||
34 | #define ALIGN 16 | ||
35 | #endif | ||
36 | |||
37 | #ifndef OK | ||
38 | You need to define one of | ||
39 | ELF - elf systems - linux-elf, NetBSD and DG-UX | ||
40 | OUT - a.out systems - linux-a.out and FreeBSD | ||
41 | SOL - solaris systems, which are elf with strange comment lines | ||
42 | BSDI - a.out with a very primative version of as. | ||
43 | #endif | ||
44 | |||
45 | /* Let the Assembler begin :-) */ | ||
46 | /* Don't even think of reading this code */ | ||
47 | /* It was automatically generated by bf-586.pl */ | ||
48 | /* Which is a perl program used to generate the x86 assember for */ | ||
49 | /* any of elf, a.out, BSDI,Win32, or Solaris */ | ||
50 | /* eric <eay@cryptsoft.com> */ | ||
51 | |||
52 | .file "bf-586.s" | ||
53 | .version "01.01" | ||
54 | gcc2_compiled.: | ||
55 | .text | ||
56 | .align ALIGN | ||
57 | .globl BF_encrypt | ||
58 | TYPE(BF_encrypt,@function) | ||
59 | BF_encrypt: | ||
60 | |||
61 | pushl %ebp | ||
62 | pushl %ebx | ||
63 | movl 12(%esp), %ebx | ||
64 | movl 16(%esp), %ebp | ||
65 | pushl %esi | ||
66 | pushl %edi | ||
67 | /* Load the 2 words */ | ||
68 | movl (%ebx), %edi | ||
69 | movl 4(%ebx), %esi | ||
70 | xorl %eax, %eax | ||
71 | movl (%ebp), %ebx | ||
72 | xorl %ecx, %ecx | ||
73 | xorl %ebx, %edi | ||
74 | |||
75 | /* Round 0 */ | ||
76 | movl 4(%ebp), %edx | ||
77 | movl %edi, %ebx | ||
78 | xorl %edx, %esi | ||
79 | shrl $16, %ebx | ||
80 | movl %edi, %edx | ||
81 | movb %bh, %al | ||
82 | andl $255, %ebx | ||
83 | movb %dh, %cl | ||
84 | andl $255, %edx | ||
85 | movl 72(%ebp,%eax,4),%eax | ||
86 | movl 1096(%ebp,%ebx,4),%ebx | ||
87 | addl %eax, %ebx | ||
88 | movl 2120(%ebp,%ecx,4),%eax | ||
89 | xorl %eax, %ebx | ||
90 | movl 3144(%ebp,%edx,4),%edx | ||
91 | addl %edx, %ebx | ||
92 | xorl %eax, %eax | ||
93 | xorl %ebx, %esi | ||
94 | |||
95 | /* Round 1 */ | ||
96 | movl 8(%ebp), %edx | ||
97 | movl %esi, %ebx | ||
98 | xorl %edx, %edi | ||
99 | shrl $16, %ebx | ||
100 | movl %esi, %edx | ||
101 | movb %bh, %al | ||
102 | andl $255, %ebx | ||
103 | movb %dh, %cl | ||
104 | andl $255, %edx | ||
105 | movl 72(%ebp,%eax,4),%eax | ||
106 | movl 1096(%ebp,%ebx,4),%ebx | ||
107 | addl %eax, %ebx | ||
108 | movl 2120(%ebp,%ecx,4),%eax | ||
109 | xorl %eax, %ebx | ||
110 | movl 3144(%ebp,%edx,4),%edx | ||
111 | addl %edx, %ebx | ||
112 | xorl %eax, %eax | ||
113 | xorl %ebx, %edi | ||
114 | |||
115 | /* Round 2 */ | ||
116 | movl 12(%ebp), %edx | ||
117 | movl %edi, %ebx | ||
118 | xorl %edx, %esi | ||
119 | shrl $16, %ebx | ||
120 | movl %edi, %edx | ||
121 | movb %bh, %al | ||
122 | andl $255, %ebx | ||
123 | movb %dh, %cl | ||
124 | andl $255, %edx | ||
125 | movl 72(%ebp,%eax,4),%eax | ||
126 | movl 1096(%ebp,%ebx,4),%ebx | ||
127 | addl %eax, %ebx | ||
128 | movl 2120(%ebp,%ecx,4),%eax | ||
129 | xorl %eax, %ebx | ||
130 | movl 3144(%ebp,%edx,4),%edx | ||
131 | addl %edx, %ebx | ||
132 | xorl %eax, %eax | ||
133 | xorl %ebx, %esi | ||
134 | |||
135 | /* Round 3 */ | ||
136 | movl 16(%ebp), %edx | ||
137 | movl %esi, %ebx | ||
138 | xorl %edx, %edi | ||
139 | shrl $16, %ebx | ||
140 | movl %esi, %edx | ||
141 | movb %bh, %al | ||
142 | andl $255, %ebx | ||
143 | movb %dh, %cl | ||
144 | andl $255, %edx | ||
145 | movl 72(%ebp,%eax,4),%eax | ||
146 | movl 1096(%ebp,%ebx,4),%ebx | ||
147 | addl %eax, %ebx | ||
148 | movl 2120(%ebp,%ecx,4),%eax | ||
149 | xorl %eax, %ebx | ||
150 | movl 3144(%ebp,%edx,4),%edx | ||
151 | addl %edx, %ebx | ||
152 | xorl %eax, %eax | ||
153 | xorl %ebx, %edi | ||
154 | |||
155 | /* Round 4 */ | ||
156 | movl 20(%ebp), %edx | ||
157 | movl %edi, %ebx | ||
158 | xorl %edx, %esi | ||
159 | shrl $16, %ebx | ||
160 | movl %edi, %edx | ||
161 | movb %bh, %al | ||
162 | andl $255, %ebx | ||
163 | movb %dh, %cl | ||
164 | andl $255, %edx | ||
165 | movl 72(%ebp,%eax,4),%eax | ||
166 | movl 1096(%ebp,%ebx,4),%ebx | ||
167 | addl %eax, %ebx | ||
168 | movl 2120(%ebp,%ecx,4),%eax | ||
169 | xorl %eax, %ebx | ||
170 | movl 3144(%ebp,%edx,4),%edx | ||
171 | addl %edx, %ebx | ||
172 | xorl %eax, %eax | ||
173 | xorl %ebx, %esi | ||
174 | |||
175 | /* Round 5 */ | ||
176 | movl 24(%ebp), %edx | ||
177 | movl %esi, %ebx | ||
178 | xorl %edx, %edi | ||
179 | shrl $16, %ebx | ||
180 | movl %esi, %edx | ||
181 | movb %bh, %al | ||
182 | andl $255, %ebx | ||
183 | movb %dh, %cl | ||
184 | andl $255, %edx | ||
185 | movl 72(%ebp,%eax,4),%eax | ||
186 | movl 1096(%ebp,%ebx,4),%ebx | ||
187 | addl %eax, %ebx | ||
188 | movl 2120(%ebp,%ecx,4),%eax | ||
189 | xorl %eax, %ebx | ||
190 | movl 3144(%ebp,%edx,4),%edx | ||
191 | addl %edx, %ebx | ||
192 | xorl %eax, %eax | ||
193 | xorl %ebx, %edi | ||
194 | |||
195 | /* Round 6 */ | ||
196 | movl 28(%ebp), %edx | ||
197 | movl %edi, %ebx | ||
198 | xorl %edx, %esi | ||
199 | shrl $16, %ebx | ||
200 | movl %edi, %edx | ||
201 | movb %bh, %al | ||
202 | andl $255, %ebx | ||
203 | movb %dh, %cl | ||
204 | andl $255, %edx | ||
205 | movl 72(%ebp,%eax,4),%eax | ||
206 | movl 1096(%ebp,%ebx,4),%ebx | ||
207 | addl %eax, %ebx | ||
208 | movl 2120(%ebp,%ecx,4),%eax | ||
209 | xorl %eax, %ebx | ||
210 | movl 3144(%ebp,%edx,4),%edx | ||
211 | addl %edx, %ebx | ||
212 | xorl %eax, %eax | ||
213 | xorl %ebx, %esi | ||
214 | |||
215 | /* Round 7 */ | ||
216 | movl 32(%ebp), %edx | ||
217 | movl %esi, %ebx | ||
218 | xorl %edx, %edi | ||
219 | shrl $16, %ebx | ||
220 | movl %esi, %edx | ||
221 | movb %bh, %al | ||
222 | andl $255, %ebx | ||
223 | movb %dh, %cl | ||
224 | andl $255, %edx | ||
225 | movl 72(%ebp,%eax,4),%eax | ||
226 | movl 1096(%ebp,%ebx,4),%ebx | ||
227 | addl %eax, %ebx | ||
228 | movl 2120(%ebp,%ecx,4),%eax | ||
229 | xorl %eax, %ebx | ||
230 | movl 3144(%ebp,%edx,4),%edx | ||
231 | addl %edx, %ebx | ||
232 | xorl %eax, %eax | ||
233 | xorl %ebx, %edi | ||
234 | |||
235 | /* Round 8 */ | ||
236 | movl 36(%ebp), %edx | ||
237 | movl %edi, %ebx | ||
238 | xorl %edx, %esi | ||
239 | shrl $16, %ebx | ||
240 | movl %edi, %edx | ||
241 | movb %bh, %al | ||
242 | andl $255, %ebx | ||
243 | movb %dh, %cl | ||
244 | andl $255, %edx | ||
245 | movl 72(%ebp,%eax,4),%eax | ||
246 | movl 1096(%ebp,%ebx,4),%ebx | ||
247 | addl %eax, %ebx | ||
248 | movl 2120(%ebp,%ecx,4),%eax | ||
249 | xorl %eax, %ebx | ||
250 | movl 3144(%ebp,%edx,4),%edx | ||
251 | addl %edx, %ebx | ||
252 | xorl %eax, %eax | ||
253 | xorl %ebx, %esi | ||
254 | |||
255 | /* Round 9 */ | ||
256 | movl 40(%ebp), %edx | ||
257 | movl %esi, %ebx | ||
258 | xorl %edx, %edi | ||
259 | shrl $16, %ebx | ||
260 | movl %esi, %edx | ||
261 | movb %bh, %al | ||
262 | andl $255, %ebx | ||
263 | movb %dh, %cl | ||
264 | andl $255, %edx | ||
265 | movl 72(%ebp,%eax,4),%eax | ||
266 | movl 1096(%ebp,%ebx,4),%ebx | ||
267 | addl %eax, %ebx | ||
268 | movl 2120(%ebp,%ecx,4),%eax | ||
269 | xorl %eax, %ebx | ||
270 | movl 3144(%ebp,%edx,4),%edx | ||
271 | addl %edx, %ebx | ||
272 | xorl %eax, %eax | ||
273 | xorl %ebx, %edi | ||
274 | |||
275 | /* Round 10 */ | ||
276 | movl 44(%ebp), %edx | ||
277 | movl %edi, %ebx | ||
278 | xorl %edx, %esi | ||
279 | shrl $16, %ebx | ||
280 | movl %edi, %edx | ||
281 | movb %bh, %al | ||
282 | andl $255, %ebx | ||
283 | movb %dh, %cl | ||
284 | andl $255, %edx | ||
285 | movl 72(%ebp,%eax,4),%eax | ||
286 | movl 1096(%ebp,%ebx,4),%ebx | ||
287 | addl %eax, %ebx | ||
288 | movl 2120(%ebp,%ecx,4),%eax | ||
289 | xorl %eax, %ebx | ||
290 | movl 3144(%ebp,%edx,4),%edx | ||
291 | addl %edx, %ebx | ||
292 | xorl %eax, %eax | ||
293 | xorl %ebx, %esi | ||
294 | |||
295 | /* Round 11 */ | ||
296 | movl 48(%ebp), %edx | ||
297 | movl %esi, %ebx | ||
298 | xorl %edx, %edi | ||
299 | shrl $16, %ebx | ||
300 | movl %esi, %edx | ||
301 | movb %bh, %al | ||
302 | andl $255, %ebx | ||
303 | movb %dh, %cl | ||
304 | andl $255, %edx | ||
305 | movl 72(%ebp,%eax,4),%eax | ||
306 | movl 1096(%ebp,%ebx,4),%ebx | ||
307 | addl %eax, %ebx | ||
308 | movl 2120(%ebp,%ecx,4),%eax | ||
309 | xorl %eax, %ebx | ||
310 | movl 3144(%ebp,%edx,4),%edx | ||
311 | addl %edx, %ebx | ||
312 | xorl %eax, %eax | ||
313 | xorl %ebx, %edi | ||
314 | |||
315 | /* Round 12 */ | ||
316 | movl 52(%ebp), %edx | ||
317 | movl %edi, %ebx | ||
318 | xorl %edx, %esi | ||
319 | shrl $16, %ebx | ||
320 | movl %edi, %edx | ||
321 | movb %bh, %al | ||
322 | andl $255, %ebx | ||
323 | movb %dh, %cl | ||
324 | andl $255, %edx | ||
325 | movl 72(%ebp,%eax,4),%eax | ||
326 | movl 1096(%ebp,%ebx,4),%ebx | ||
327 | addl %eax, %ebx | ||
328 | movl 2120(%ebp,%ecx,4),%eax | ||
329 | xorl %eax, %ebx | ||
330 | movl 3144(%ebp,%edx,4),%edx | ||
331 | addl %edx, %ebx | ||
332 | xorl %eax, %eax | ||
333 | xorl %ebx, %esi | ||
334 | |||
335 | /* Round 13 */ | ||
336 | movl 56(%ebp), %edx | ||
337 | movl %esi, %ebx | ||
338 | xorl %edx, %edi | ||
339 | shrl $16, %ebx | ||
340 | movl %esi, %edx | ||
341 | movb %bh, %al | ||
342 | andl $255, %ebx | ||
343 | movb %dh, %cl | ||
344 | andl $255, %edx | ||
345 | movl 72(%ebp,%eax,4),%eax | ||
346 | movl 1096(%ebp,%ebx,4),%ebx | ||
347 | addl %eax, %ebx | ||
348 | movl 2120(%ebp,%ecx,4),%eax | ||
349 | xorl %eax, %ebx | ||
350 | movl 3144(%ebp,%edx,4),%edx | ||
351 | addl %edx, %ebx | ||
352 | xorl %eax, %eax | ||
353 | xorl %ebx, %edi | ||
354 | |||
355 | /* Round 14 */ | ||
356 | movl 60(%ebp), %edx | ||
357 | movl %edi, %ebx | ||
358 | xorl %edx, %esi | ||
359 | shrl $16, %ebx | ||
360 | movl %edi, %edx | ||
361 | movb %bh, %al | ||
362 | andl $255, %ebx | ||
363 | movb %dh, %cl | ||
364 | andl $255, %edx | ||
365 | movl 72(%ebp,%eax,4),%eax | ||
366 | movl 1096(%ebp,%ebx,4),%ebx | ||
367 | addl %eax, %ebx | ||
368 | movl 2120(%ebp,%ecx,4),%eax | ||
369 | xorl %eax, %ebx | ||
370 | movl 3144(%ebp,%edx,4),%edx | ||
371 | addl %edx, %ebx | ||
372 | xorl %eax, %eax | ||
373 | xorl %ebx, %esi | ||
374 | |||
375 | /* Round 15 */ | ||
376 | movl 64(%ebp), %edx | ||
377 | movl %esi, %ebx | ||
378 | xorl %edx, %edi | ||
379 | shrl $16, %ebx | ||
380 | movl %esi, %edx | ||
381 | movb %bh, %al | ||
382 | andl $255, %ebx | ||
383 | movb %dh, %cl | ||
384 | andl $255, %edx | ||
385 | movl 72(%ebp,%eax,4),%eax | ||
386 | movl 1096(%ebp,%ebx,4),%ebx | ||
387 | addl %eax, %ebx | ||
388 | movl 2120(%ebp,%ecx,4),%eax | ||
389 | xorl %eax, %ebx | ||
390 | movl 3144(%ebp,%edx,4),%edx | ||
391 | addl %edx, %ebx | ||
392 | /* Load parameter 0 (16) enc=1 */ | ||
393 | movl 20(%esp), %eax | ||
394 | xorl %ebx, %edi | ||
395 | movl 68(%ebp), %edx | ||
396 | xorl %edx, %esi | ||
397 | movl %edi, 4(%eax) | ||
398 | movl %esi, (%eax) | ||
399 | popl %edi | ||
400 | popl %esi | ||
401 | popl %ebx | ||
402 | popl %ebp | ||
403 | ret | ||
404 | .BF_encrypt_end: | ||
405 | SIZE(BF_encrypt,.BF_encrypt_end-BF_encrypt) | ||
406 | .ident "BF_encrypt" | ||
407 | .text | ||
408 | .align ALIGN | ||
409 | .globl BF_decrypt | ||
410 | TYPE(BF_decrypt,@function) | ||
411 | BF_decrypt: | ||
412 | |||
413 | pushl %ebp | ||
414 | pushl %ebx | ||
415 | movl 12(%esp), %ebx | ||
416 | movl 16(%esp), %ebp | ||
417 | pushl %esi | ||
418 | pushl %edi | ||
419 | /* Load the 2 words */ | ||
420 | movl (%ebx), %edi | ||
421 | movl 4(%ebx), %esi | ||
422 | xorl %eax, %eax | ||
423 | movl 68(%ebp), %ebx | ||
424 | xorl %ecx, %ecx | ||
425 | xorl %ebx, %edi | ||
426 | |||
427 | /* Round 16 */ | ||
428 | movl 64(%ebp), %edx | ||
429 | movl %edi, %ebx | ||
430 | xorl %edx, %esi | ||
431 | shrl $16, %ebx | ||
432 | movl %edi, %edx | ||
433 | movb %bh, %al | ||
434 | andl $255, %ebx | ||
435 | movb %dh, %cl | ||
436 | andl $255, %edx | ||
437 | movl 72(%ebp,%eax,4),%eax | ||
438 | movl 1096(%ebp,%ebx,4),%ebx | ||
439 | addl %eax, %ebx | ||
440 | movl 2120(%ebp,%ecx,4),%eax | ||
441 | xorl %eax, %ebx | ||
442 | movl 3144(%ebp,%edx,4),%edx | ||
443 | addl %edx, %ebx | ||
444 | xorl %eax, %eax | ||
445 | xorl %ebx, %esi | ||
446 | |||
447 | /* Round 15 */ | ||
448 | movl 60(%ebp), %edx | ||
449 | movl %esi, %ebx | ||
450 | xorl %edx, %edi | ||
451 | shrl $16, %ebx | ||
452 | movl %esi, %edx | ||
453 | movb %bh, %al | ||
454 | andl $255, %ebx | ||
455 | movb %dh, %cl | ||
456 | andl $255, %edx | ||
457 | movl 72(%ebp,%eax,4),%eax | ||
458 | movl 1096(%ebp,%ebx,4),%ebx | ||
459 | addl %eax, %ebx | ||
460 | movl 2120(%ebp,%ecx,4),%eax | ||
461 | xorl %eax, %ebx | ||
462 | movl 3144(%ebp,%edx,4),%edx | ||
463 | addl %edx, %ebx | ||
464 | xorl %eax, %eax | ||
465 | xorl %ebx, %edi | ||
466 | |||
467 | /* Round 14 */ | ||
468 | movl 56(%ebp), %edx | ||
469 | movl %edi, %ebx | ||
470 | xorl %edx, %esi | ||
471 | shrl $16, %ebx | ||
472 | movl %edi, %edx | ||
473 | movb %bh, %al | ||
474 | andl $255, %ebx | ||
475 | movb %dh, %cl | ||
476 | andl $255, %edx | ||
477 | movl 72(%ebp,%eax,4),%eax | ||
478 | movl 1096(%ebp,%ebx,4),%ebx | ||
479 | addl %eax, %ebx | ||
480 | movl 2120(%ebp,%ecx,4),%eax | ||
481 | xorl %eax, %ebx | ||
482 | movl 3144(%ebp,%edx,4),%edx | ||
483 | addl %edx, %ebx | ||
484 | xorl %eax, %eax | ||
485 | xorl %ebx, %esi | ||
486 | |||
487 | /* Round 13 */ | ||
488 | movl 52(%ebp), %edx | ||
489 | movl %esi, %ebx | ||
490 | xorl %edx, %edi | ||
491 | shrl $16, %ebx | ||
492 | movl %esi, %edx | ||
493 | movb %bh, %al | ||
494 | andl $255, %ebx | ||
495 | movb %dh, %cl | ||
496 | andl $255, %edx | ||
497 | movl 72(%ebp,%eax,4),%eax | ||
498 | movl 1096(%ebp,%ebx,4),%ebx | ||
499 | addl %eax, %ebx | ||
500 | movl 2120(%ebp,%ecx,4),%eax | ||
501 | xorl %eax, %ebx | ||
502 | movl 3144(%ebp,%edx,4),%edx | ||
503 | addl %edx, %ebx | ||
504 | xorl %eax, %eax | ||
505 | xorl %ebx, %edi | ||
506 | |||
507 | /* Round 12 */ | ||
508 | movl 48(%ebp), %edx | ||
509 | movl %edi, %ebx | ||
510 | xorl %edx, %esi | ||
511 | shrl $16, %ebx | ||
512 | movl %edi, %edx | ||
513 | movb %bh, %al | ||
514 | andl $255, %ebx | ||
515 | movb %dh, %cl | ||
516 | andl $255, %edx | ||
517 | movl 72(%ebp,%eax,4),%eax | ||
518 | movl 1096(%ebp,%ebx,4),%ebx | ||
519 | addl %eax, %ebx | ||
520 | movl 2120(%ebp,%ecx,4),%eax | ||
521 | xorl %eax, %ebx | ||
522 | movl 3144(%ebp,%edx,4),%edx | ||
523 | addl %edx, %ebx | ||
524 | xorl %eax, %eax | ||
525 | xorl %ebx, %esi | ||
526 | |||
527 | /* Round 11 */ | ||
528 | movl 44(%ebp), %edx | ||
529 | movl %esi, %ebx | ||
530 | xorl %edx, %edi | ||
531 | shrl $16, %ebx | ||
532 | movl %esi, %edx | ||
533 | movb %bh, %al | ||
534 | andl $255, %ebx | ||
535 | movb %dh, %cl | ||
536 | andl $255, %edx | ||
537 | movl 72(%ebp,%eax,4),%eax | ||
538 | movl 1096(%ebp,%ebx,4),%ebx | ||
539 | addl %eax, %ebx | ||
540 | movl 2120(%ebp,%ecx,4),%eax | ||
541 | xorl %eax, %ebx | ||
542 | movl 3144(%ebp,%edx,4),%edx | ||
543 | addl %edx, %ebx | ||
544 | xorl %eax, %eax | ||
545 | xorl %ebx, %edi | ||
546 | |||
547 | /* Round 10 */ | ||
548 | movl 40(%ebp), %edx | ||
549 | movl %edi, %ebx | ||
550 | xorl %edx, %esi | ||
551 | shrl $16, %ebx | ||
552 | movl %edi, %edx | ||
553 | movb %bh, %al | ||
554 | andl $255, %ebx | ||
555 | movb %dh, %cl | ||
556 | andl $255, %edx | ||
557 | movl 72(%ebp,%eax,4),%eax | ||
558 | movl 1096(%ebp,%ebx,4),%ebx | ||
559 | addl %eax, %ebx | ||
560 | movl 2120(%ebp,%ecx,4),%eax | ||
561 | xorl %eax, %ebx | ||
562 | movl 3144(%ebp,%edx,4),%edx | ||
563 | addl %edx, %ebx | ||
564 | xorl %eax, %eax | ||
565 | xorl %ebx, %esi | ||
566 | |||
567 | /* Round 9 */ | ||
568 | movl 36(%ebp), %edx | ||
569 | movl %esi, %ebx | ||
570 | xorl %edx, %edi | ||
571 | shrl $16, %ebx | ||
572 | movl %esi, %edx | ||
573 | movb %bh, %al | ||
574 | andl $255, %ebx | ||
575 | movb %dh, %cl | ||
576 | andl $255, %edx | ||
577 | movl 72(%ebp,%eax,4),%eax | ||
578 | movl 1096(%ebp,%ebx,4),%ebx | ||
579 | addl %eax, %ebx | ||
580 | movl 2120(%ebp,%ecx,4),%eax | ||
581 | xorl %eax, %ebx | ||
582 | movl 3144(%ebp,%edx,4),%edx | ||
583 | addl %edx, %ebx | ||
584 | xorl %eax, %eax | ||
585 | xorl %ebx, %edi | ||
586 | |||
587 | /* Round 8 */ | ||
588 | movl 32(%ebp), %edx | ||
589 | movl %edi, %ebx | ||
590 | xorl %edx, %esi | ||
591 | shrl $16, %ebx | ||
592 | movl %edi, %edx | ||
593 | movb %bh, %al | ||
594 | andl $255, %ebx | ||
595 | movb %dh, %cl | ||
596 | andl $255, %edx | ||
597 | movl 72(%ebp,%eax,4),%eax | ||
598 | movl 1096(%ebp,%ebx,4),%ebx | ||
599 | addl %eax, %ebx | ||
600 | movl 2120(%ebp,%ecx,4),%eax | ||
601 | xorl %eax, %ebx | ||
602 | movl 3144(%ebp,%edx,4),%edx | ||
603 | addl %edx, %ebx | ||
604 | xorl %eax, %eax | ||
605 | xorl %ebx, %esi | ||
606 | |||
607 | /* Round 7 */ | ||
608 | movl 28(%ebp), %edx | ||
609 | movl %esi, %ebx | ||
610 | xorl %edx, %edi | ||
611 | shrl $16, %ebx | ||
612 | movl %esi, %edx | ||
613 | movb %bh, %al | ||
614 | andl $255, %ebx | ||
615 | movb %dh, %cl | ||
616 | andl $255, %edx | ||
617 | movl 72(%ebp,%eax,4),%eax | ||
618 | movl 1096(%ebp,%ebx,4),%ebx | ||
619 | addl %eax, %ebx | ||
620 | movl 2120(%ebp,%ecx,4),%eax | ||
621 | xorl %eax, %ebx | ||
622 | movl 3144(%ebp,%edx,4),%edx | ||
623 | addl %edx, %ebx | ||
624 | xorl %eax, %eax | ||
625 | xorl %ebx, %edi | ||
626 | |||
627 | /* Round 6 */ | ||
628 | movl 24(%ebp), %edx | ||
629 | movl %edi, %ebx | ||
630 | xorl %edx, %esi | ||
631 | shrl $16, %ebx | ||
632 | movl %edi, %edx | ||
633 | movb %bh, %al | ||
634 | andl $255, %ebx | ||
635 | movb %dh, %cl | ||
636 | andl $255, %edx | ||
637 | movl 72(%ebp,%eax,4),%eax | ||
638 | movl 1096(%ebp,%ebx,4),%ebx | ||
639 | addl %eax, %ebx | ||
640 | movl 2120(%ebp,%ecx,4),%eax | ||
641 | xorl %eax, %ebx | ||
642 | movl 3144(%ebp,%edx,4),%edx | ||
643 | addl %edx, %ebx | ||
644 | xorl %eax, %eax | ||
645 | xorl %ebx, %esi | ||
646 | |||
647 | /* Round 5 */ | ||
648 | movl 20(%ebp), %edx | ||
649 | movl %esi, %ebx | ||
650 | xorl %edx, %edi | ||
651 | shrl $16, %ebx | ||
652 | movl %esi, %edx | ||
653 | movb %bh, %al | ||
654 | andl $255, %ebx | ||
655 | movb %dh, %cl | ||
656 | andl $255, %edx | ||
657 | movl 72(%ebp,%eax,4),%eax | ||
658 | movl 1096(%ebp,%ebx,4),%ebx | ||
659 | addl %eax, %ebx | ||
660 | movl 2120(%ebp,%ecx,4),%eax | ||
661 | xorl %eax, %ebx | ||
662 | movl 3144(%ebp,%edx,4),%edx | ||
663 | addl %edx, %ebx | ||
664 | xorl %eax, %eax | ||
665 | xorl %ebx, %edi | ||
666 | |||
667 | /* Round 4 */ | ||
668 | movl 16(%ebp), %edx | ||
669 | movl %edi, %ebx | ||
670 | xorl %edx, %esi | ||
671 | shrl $16, %ebx | ||
672 | movl %edi, %edx | ||
673 | movb %bh, %al | ||
674 | andl $255, %ebx | ||
675 | movb %dh, %cl | ||
676 | andl $255, %edx | ||
677 | movl 72(%ebp,%eax,4),%eax | ||
678 | movl 1096(%ebp,%ebx,4),%ebx | ||
679 | addl %eax, %ebx | ||
680 | movl 2120(%ebp,%ecx,4),%eax | ||
681 | xorl %eax, %ebx | ||
682 | movl 3144(%ebp,%edx,4),%edx | ||
683 | addl %edx, %ebx | ||
684 | xorl %eax, %eax | ||
685 | xorl %ebx, %esi | ||
686 | |||
687 | /* Round 3 */ | ||
688 | movl 12(%ebp), %edx | ||
689 | movl %esi, %ebx | ||
690 | xorl %edx, %edi | ||
691 | shrl $16, %ebx | ||
692 | movl %esi, %edx | ||
693 | movb %bh, %al | ||
694 | andl $255, %ebx | ||
695 | movb %dh, %cl | ||
696 | andl $255, %edx | ||
697 | movl 72(%ebp,%eax,4),%eax | ||
698 | movl 1096(%ebp,%ebx,4),%ebx | ||
699 | addl %eax, %ebx | ||
700 | movl 2120(%ebp,%ecx,4),%eax | ||
701 | xorl %eax, %ebx | ||
702 | movl 3144(%ebp,%edx,4),%edx | ||
703 | addl %edx, %ebx | ||
704 | xorl %eax, %eax | ||
705 | xorl %ebx, %edi | ||
706 | |||
707 | /* Round 2 */ | ||
708 | movl 8(%ebp), %edx | ||
709 | movl %edi, %ebx | ||
710 | xorl %edx, %esi | ||
711 | shrl $16, %ebx | ||
712 | movl %edi, %edx | ||
713 | movb %bh, %al | ||
714 | andl $255, %ebx | ||
715 | movb %dh, %cl | ||
716 | andl $255, %edx | ||
717 | movl 72(%ebp,%eax,4),%eax | ||
718 | movl 1096(%ebp,%ebx,4),%ebx | ||
719 | addl %eax, %ebx | ||
720 | movl 2120(%ebp,%ecx,4),%eax | ||
721 | xorl %eax, %ebx | ||
722 | movl 3144(%ebp,%edx,4),%edx | ||
723 | addl %edx, %ebx | ||
724 | xorl %eax, %eax | ||
725 | xorl %ebx, %esi | ||
726 | |||
727 | /* Round 1 */ | ||
728 | movl 4(%ebp), %edx | ||
729 | movl %esi, %ebx | ||
730 | xorl %edx, %edi | ||
731 | shrl $16, %ebx | ||
732 | movl %esi, %edx | ||
733 | movb %bh, %al | ||
734 | andl $255, %ebx | ||
735 | movb %dh, %cl | ||
736 | andl $255, %edx | ||
737 | movl 72(%ebp,%eax,4),%eax | ||
738 | movl 1096(%ebp,%ebx,4),%ebx | ||
739 | addl %eax, %ebx | ||
740 | movl 2120(%ebp,%ecx,4),%eax | ||
741 | xorl %eax, %ebx | ||
742 | movl 3144(%ebp,%edx,4),%edx | ||
743 | addl %edx, %ebx | ||
744 | /* Load parameter 0 (1) enc=0 */ | ||
745 | movl 20(%esp), %eax | ||
746 | xorl %ebx, %edi | ||
747 | movl (%ebp), %edx | ||
748 | xorl %edx, %esi | ||
749 | movl %edi, 4(%eax) | ||
750 | movl %esi, (%eax) | ||
751 | popl %edi | ||
752 | popl %esi | ||
753 | popl %ebx | ||
754 | popl %ebp | ||
755 | ret | ||
756 | .BF_decrypt_end: | ||
757 | SIZE(BF_decrypt,.BF_decrypt_end-BF_decrypt) | ||
758 | .ident "BF_decrypt" | ||
759 | .text | ||
760 | .align ALIGN | ||
761 | .globl BF_cbc_encrypt | ||
762 | TYPE(BF_cbc_encrypt,@function) | ||
763 | BF_cbc_encrypt: | ||
764 | |||
765 | pushl %ebp | ||
766 | pushl %ebx | ||
767 | pushl %esi | ||
768 | pushl %edi | ||
769 | movl 28(%esp), %ebp | ||
770 | /* getting iv ptr from parameter 4 */ | ||
771 | movl 36(%esp), %ebx | ||
772 | movl (%ebx), %esi | ||
773 | movl 4(%ebx), %edi | ||
774 | pushl %edi | ||
775 | pushl %esi | ||
776 | pushl %edi | ||
777 | pushl %esi | ||
778 | movl %esp, %ebx | ||
779 | movl 36(%esp), %esi | ||
780 | movl 40(%esp), %edi | ||
781 | /* getting encrypt flag from parameter 5 */ | ||
782 | movl 56(%esp), %ecx | ||
783 | /* get and push parameter 3 */ | ||
784 | movl 48(%esp), %eax | ||
785 | pushl %eax | ||
786 | pushl %ebx | ||
787 | cmpl $0, %ecx | ||
788 | jz .L000decrypt | ||
789 | andl $4294967288, %ebp | ||
790 | movl 8(%esp), %eax | ||
791 | movl 12(%esp), %ebx | ||
792 | jz .L001encrypt_finish | ||
793 | .L002encrypt_loop: | ||
794 | movl (%esi), %ecx | ||
795 | movl 4(%esi), %edx | ||
796 | xorl %ecx, %eax | ||
797 | xorl %edx, %ebx | ||
798 | .byte 15 | ||
799 | .byte 200 /* bswapl %eax */ | ||
800 | .byte 15 | ||
801 | .byte 203 /* bswapl %ebx */ | ||
802 | movl %eax, 8(%esp) | ||
803 | movl %ebx, 12(%esp) | ||
804 | call BF_encrypt | ||
805 | movl 8(%esp), %eax | ||
806 | movl 12(%esp), %ebx | ||
807 | .byte 15 | ||
808 | .byte 200 /* bswapl %eax */ | ||
809 | .byte 15 | ||
810 | .byte 203 /* bswapl %ebx */ | ||
811 | movl %eax, (%edi) | ||
812 | movl %ebx, 4(%edi) | ||
813 | addl $8, %esi | ||
814 | addl $8, %edi | ||
815 | subl $8, %ebp | ||
816 | jnz .L002encrypt_loop | ||
817 | .L001encrypt_finish: | ||
818 | movl 52(%esp), %ebp | ||
819 | andl $7, %ebp | ||
820 | jz .L003finish | ||
821 | xorl %ecx, %ecx | ||
822 | xorl %edx, %edx | ||
823 | movl .L004cbc_enc_jmp_table(,%ebp,4),%ebp | ||
824 | jmp *%ebp | ||
825 | .L005ej7: | ||
826 | movb 6(%esi), %dh | ||
827 | sall $8, %edx | ||
828 | .L006ej6: | ||
829 | movb 5(%esi), %dh | ||
830 | .L007ej5: | ||
831 | movb 4(%esi), %dl | ||
832 | .L008ej4: | ||
833 | movl (%esi), %ecx | ||
834 | jmp .L009ejend | ||
835 | .L010ej3: | ||
836 | movb 2(%esi), %ch | ||
837 | sall $8, %ecx | ||
838 | .L011ej2: | ||
839 | movb 1(%esi), %ch | ||
840 | .L012ej1: | ||
841 | movb (%esi), %cl | ||
842 | .L009ejend: | ||
843 | xorl %ecx, %eax | ||
844 | xorl %edx, %ebx | ||
845 | .byte 15 | ||
846 | .byte 200 /* bswapl %eax */ | ||
847 | .byte 15 | ||
848 | .byte 203 /* bswapl %ebx */ | ||
849 | movl %eax, 8(%esp) | ||
850 | movl %ebx, 12(%esp) | ||
851 | call BF_encrypt | ||
852 | movl 8(%esp), %eax | ||
853 | movl 12(%esp), %ebx | ||
854 | .byte 15 | ||
855 | .byte 200 /* bswapl %eax */ | ||
856 | .byte 15 | ||
857 | .byte 203 /* bswapl %ebx */ | ||
858 | movl %eax, (%edi) | ||
859 | movl %ebx, 4(%edi) | ||
860 | jmp .L003finish | ||
861 | .align ALIGN | ||
862 | .L000decrypt: | ||
863 | andl $4294967288, %ebp | ||
864 | movl 16(%esp), %eax | ||
865 | movl 20(%esp), %ebx | ||
866 | jz .L013decrypt_finish | ||
867 | .L014decrypt_loop: | ||
868 | movl (%esi), %eax | ||
869 | movl 4(%esi), %ebx | ||
870 | .byte 15 | ||
871 | .byte 200 /* bswapl %eax */ | ||
872 | .byte 15 | ||
873 | .byte 203 /* bswapl %ebx */ | ||
874 | movl %eax, 8(%esp) | ||
875 | movl %ebx, 12(%esp) | ||
876 | call BF_decrypt | ||
877 | movl 8(%esp), %eax | ||
878 | movl 12(%esp), %ebx | ||
879 | .byte 15 | ||
880 | .byte 200 /* bswapl %eax */ | ||
881 | .byte 15 | ||
882 | .byte 203 /* bswapl %ebx */ | ||
883 | movl 16(%esp), %ecx | ||
884 | movl 20(%esp), %edx | ||
885 | xorl %eax, %ecx | ||
886 | xorl %ebx, %edx | ||
887 | movl (%esi), %eax | ||
888 | movl 4(%esi), %ebx | ||
889 | movl %ecx, (%edi) | ||
890 | movl %edx, 4(%edi) | ||
891 | movl %eax, 16(%esp) | ||
892 | movl %ebx, 20(%esp) | ||
893 | addl $8, %esi | ||
894 | addl $8, %edi | ||
895 | subl $8, %ebp | ||
896 | jnz .L014decrypt_loop | ||
897 | .L013decrypt_finish: | ||
898 | movl 52(%esp), %ebp | ||
899 | andl $7, %ebp | ||
900 | jz .L003finish | ||
901 | movl (%esi), %eax | ||
902 | movl 4(%esi), %ebx | ||
903 | .byte 15 | ||
904 | .byte 200 /* bswapl %eax */ | ||
905 | .byte 15 | ||
906 | .byte 203 /* bswapl %ebx */ | ||
907 | movl %eax, 8(%esp) | ||
908 | movl %ebx, 12(%esp) | ||
909 | call BF_decrypt | ||
910 | movl 8(%esp), %eax | ||
911 | movl 12(%esp), %ebx | ||
912 | .byte 15 | ||
913 | .byte 200 /* bswapl %eax */ | ||
914 | .byte 15 | ||
915 | .byte 203 /* bswapl %ebx */ | ||
916 | movl 16(%esp), %ecx | ||
917 | movl 20(%esp), %edx | ||
918 | xorl %eax, %ecx | ||
919 | xorl %ebx, %edx | ||
920 | movl (%esi), %eax | ||
921 | movl 4(%esi), %ebx | ||
922 | .L015dj7: | ||
923 | rorl $16, %edx | ||
924 | movb %dl, 6(%edi) | ||
925 | shrl $16, %edx | ||
926 | .L016dj6: | ||
927 | movb %dh, 5(%edi) | ||
928 | .L017dj5: | ||
929 | movb %dl, 4(%edi) | ||
930 | .L018dj4: | ||
931 | movl %ecx, (%edi) | ||
932 | jmp .L019djend | ||
933 | .L020dj3: | ||
934 | rorl $16, %ecx | ||
935 | movb %cl, 2(%edi) | ||
936 | sall $16, %ecx | ||
937 | .L021dj2: | ||
938 | movb %ch, 1(%esi) | ||
939 | .L022dj1: | ||
940 | movb %cl, (%esi) | ||
941 | .L019djend: | ||
942 | jmp .L003finish | ||
943 | .align ALIGN | ||
944 | .L003finish: | ||
945 | movl 60(%esp), %ecx | ||
946 | addl $24, %esp | ||
947 | movl %eax, (%ecx) | ||
948 | movl %ebx, 4(%ecx) | ||
949 | popl %edi | ||
950 | popl %esi | ||
951 | popl %ebx | ||
952 | popl %ebp | ||
953 | ret | ||
954 | .align ALIGN | ||
955 | .L004cbc_enc_jmp_table: | ||
956 | .long 0 | ||
957 | .long .L012ej1 | ||
958 | .long .L011ej2 | ||
959 | .long .L010ej3 | ||
960 | .long .L008ej4 | ||
961 | .long .L007ej5 | ||
962 | .long .L006ej6 | ||
963 | .long .L005ej7 | ||
964 | .align ALIGN | ||
965 | .L023cbc_dec_jmp_table: | ||
966 | .long 0 | ||
967 | .long .L022dj1 | ||
968 | .long .L021dj2 | ||
969 | .long .L020dj3 | ||
970 | .long .L018dj4 | ||
971 | .long .L017dj5 | ||
972 | .long .L016dj6 | ||
973 | .long .L015dj7 | ||
974 | .BF_cbc_encrypt_end: | ||
975 | SIZE(BF_cbc_encrypt,.BF_cbc_encrypt_end-BF_cbc_encrypt) | ||
976 | .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 @@ | |||
1 | /* crypto/bf/bf_locl.org */ | ||
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
60 | * | ||
61 | * Always modify bf_locl.org since bf_locl.h is automatically generated from | ||
62 | * it during SSLeay configuration. | ||
63 | * | ||
64 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
65 | */ | ||
66 | |||
67 | /* Special defines which change the way the code is built depending on the | ||
68 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
69 | even newer MIPS CPU's, but at the moment one size fits all for | ||
70 | optimization options. Older Sparc's work better with only UNROLL, but | ||
71 | there's no way to tell at compile time what it is you're running on */ | ||
72 | |||
73 | #if defined( sun ) /* Newer Sparc's */ | ||
74 | # define BF_PTR | ||
75 | #elif defined( __ultrix ) /* Older MIPS */ | ||
76 | # define BF_PTR | ||
77 | #elif defined( __osf1__ ) /* Alpha */ | ||
78 | /* None */ | ||
79 | #elif defined ( _AIX ) /* RS6000 */ | ||
80 | /* Unknown */ | ||
81 | #elif defined( __hpux ) /* HP-PA */ | ||
82 | /* None */ | ||
83 | #elif defined( __aux ) /* 68K */ | ||
84 | /* Unknown */ | ||
85 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
86 | /* Unknown */ | ||
87 | #elif defined( __sgi ) /* Newer MIPS */ | ||
88 | # define BF_PTR | ||
89 | #elif defined( i386 ) /* x86 boxes, should be gcc */ | ||
90 | #elif defined( _MSC_VER ) /* x86 boxes, Visual C */ | ||
91 | #endif /* Systems-specific speed defines */ | ||
92 | |||
93 | #undef c2l | ||
94 | #define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ | ||
95 | l|=((unsigned long)(*((c)++)))<< 8L, \ | ||
96 | l|=((unsigned long)(*((c)++)))<<16L, \ | ||
97 | l|=((unsigned long)(*((c)++)))<<24L) | ||
98 | |||
99 | /* NOTE - c is not incremented as per c2l */ | ||
100 | #undef c2ln | ||
101 | #define c2ln(c,l1,l2,n) { \ | ||
102 | c+=n; \ | ||
103 | l1=l2=0; \ | ||
104 | switch (n) { \ | ||
105 | case 8: l2 =((unsigned long)(*(--(c))))<<24L; \ | ||
106 | case 7: l2|=((unsigned long)(*(--(c))))<<16L; \ | ||
107 | case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \ | ||
108 | case 5: l2|=((unsigned long)(*(--(c)))); \ | ||
109 | case 4: l1 =((unsigned long)(*(--(c))))<<24L; \ | ||
110 | case 3: l1|=((unsigned long)(*(--(c))))<<16L; \ | ||
111 | case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \ | ||
112 | case 1: l1|=((unsigned long)(*(--(c)))); \ | ||
113 | } \ | ||
114 | } | ||
115 | |||
116 | #undef l2c | ||
117 | #define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ | ||
118 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ | ||
119 | *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ | ||
120 | *((c)++)=(unsigned char)(((l)>>24L)&0xff)) | ||
121 | |||
122 | /* NOTE - c is not incremented as per l2c */ | ||
123 | #undef l2cn | ||
124 | #define l2cn(l1,l2,c,n) { \ | ||
125 | c+=n; \ | ||
126 | switch (n) { \ | ||
127 | case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ | ||
128 | case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ | ||
129 | case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ | ||
130 | case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ | ||
131 | case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ | ||
132 | case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ | ||
133 | case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ | ||
134 | case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ | ||
135 | } \ | ||
136 | } | ||
137 | |||
138 | /* NOTE - c is not incremented as per n2l */ | ||
139 | #define n2ln(c,l1,l2,n) { \ | ||
140 | c+=n; \ | ||
141 | l1=l2=0; \ | ||
142 | switch (n) { \ | ||
143 | case 8: l2 =((unsigned long)(*(--(c)))) ; \ | ||
144 | case 7: l2|=((unsigned long)(*(--(c))))<< 8; \ | ||
145 | case 6: l2|=((unsigned long)(*(--(c))))<<16; \ | ||
146 | case 5: l2|=((unsigned long)(*(--(c))))<<24; \ | ||
147 | case 4: l1 =((unsigned long)(*(--(c)))) ; \ | ||
148 | case 3: l1|=((unsigned long)(*(--(c))))<< 8; \ | ||
149 | case 2: l1|=((unsigned long)(*(--(c))))<<16; \ | ||
150 | case 1: l1|=((unsigned long)(*(--(c))))<<24; \ | ||
151 | } \ | ||
152 | } | ||
153 | |||
154 | /* NOTE - c is not incremented as per l2n */ | ||
155 | #define l2nn(l1,l2,c,n) { \ | ||
156 | c+=n; \ | ||
157 | switch (n) { \ | ||
158 | case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ | ||
159 | case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ | ||
160 | case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ | ||
161 | case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ | ||
162 | case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ | ||
163 | case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ | ||
164 | case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ | ||
165 | case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ | ||
166 | } \ | ||
167 | } | ||
168 | |||
169 | #undef n2l | ||
170 | #define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \ | ||
171 | l|=((unsigned long)(*((c)++)))<<16L, \ | ||
172 | l|=((unsigned long)(*((c)++)))<< 8L, \ | ||
173 | l|=((unsigned long)(*((c)++)))) | ||
174 | |||
175 | #undef l2n | ||
176 | #define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ | ||
177 | *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ | ||
178 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ | ||
179 | *((c)++)=(unsigned char)(((l) )&0xff)) | ||
180 | |||
181 | /* This is actually a big endian algorithm, the most significate byte | ||
182 | * is used to lookup array 0 */ | ||
183 | |||
184 | /* use BF_PTR2 for intel boxes, | ||
185 | * BF_PTR for sparc and MIPS/SGI | ||
186 | * use nothing for Alpha and HP. | ||
187 | */ | ||
188 | #if !defined(BF_PTR) && !defined(BF_PTR2) | ||
189 | #undef BF_PTR | ||
190 | #endif | ||
191 | |||
192 | #define BF_M 0x3fc | ||
193 | #define BF_0 22L | ||
194 | #define BF_1 14L | ||
195 | #define BF_2 6L | ||
196 | #define BF_3 2L /* left shift */ | ||
197 | |||
198 | #if defined(BF_PTR2) | ||
199 | |||
200 | /* This is basically a special pentium verson */ | ||
201 | #define BF_ENC(LL,R,S,P) \ | ||
202 | { \ | ||
203 | BF_LONG t,u,v; \ | ||
204 | u=R>>BF_0; \ | ||
205 | v=R>>BF_1; \ | ||
206 | u&=BF_M; \ | ||
207 | v&=BF_M; \ | ||
208 | t= *(BF_LONG *)((unsigned char *)&(S[ 0])+u); \ | ||
209 | u=R>>BF_2; \ | ||
210 | t+= *(BF_LONG *)((unsigned char *)&(S[256])+v); \ | ||
211 | v=R<<BF_3; \ | ||
212 | u&=BF_M; \ | ||
213 | v&=BF_M; \ | ||
214 | t^= *(BF_LONG *)((unsigned char *)&(S[512])+u); \ | ||
215 | LL^=P; \ | ||
216 | t+= *(BF_LONG *)((unsigned char *)&(S[768])+v); \ | ||
217 | LL^=t; \ | ||
218 | } | ||
219 | |||
220 | #elif defined(BF_PTR) | ||
221 | |||
222 | /* This is normally very good */ | ||
223 | |||
224 | #define BF_ENC(LL,R,S,P) \ | ||
225 | LL^=P; \ | ||
226 | LL^= (((*(BF_LONG *)((unsigned char *)&(S[ 0])+((R>>BF_0)&BF_M))+ \ | ||
227 | *(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \ | ||
228 | *(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \ | ||
229 | *(BF_LONG *)((unsigned char *)&(S[768])+((R<<BF_3)&BF_M))); | ||
230 | #else | ||
231 | |||
232 | /* This will always work, even on 64 bit machines and strangly enough, | ||
233 | * on the Alpha it is faster than the pointer versions (both 32 and 64 | ||
234 | * versions of BF_LONG) */ | ||
235 | |||
236 | #define BF_ENC(LL,R,S,P) \ | ||
237 | LL^=P; \ | ||
238 | LL^=((( S[ (int)(R>>24L) ] + \ | ||
239 | S[0x0100+((int)(R>>16L)&0xff)])^ \ | ||
240 | S[0x0200+((int)(R>> 8L)&0xff)])+ \ | ||
241 | S[0x0300+((int)(R )&0xff)])&0xffffffffL; | ||
242 | #endif | ||
diff --git a/src/lib/libcrypto/bio/Makefile.ssl b/src/lib/libcrypto/bio/Makefile.ssl new file mode 100644 index 0000000000..42e11e1c94 --- /dev/null +++ b/src/lib/libcrypto/bio/Makefile.ssl | |||
@@ -0,0 +1,92 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/bio/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= bio | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | ERR=bio | ||
19 | ERRC=bio_err | ||
20 | GENERAL=Makefile | ||
21 | TEST= | ||
22 | APPS= | ||
23 | |||
24 | LIB=$(TOP)/libcrypto.a | ||
25 | LIBSRC= bio_lib.c bio_cb.c $(ERRC).c \ | ||
26 | bss_mem.c bss_null.c bss_fd.c \ | ||
27 | bss_file.c bss_sock.c bss_conn.c \ | ||
28 | bf_null.c bf_buff.c b_print.c b_dump.c \ | ||
29 | b_sock.c bss_acpt.c bf_nbio.c | ||
30 | LIBOBJ= bio_lib.o bio_cb.o $(ERRC).o \ | ||
31 | bss_mem.o bss_null.o bss_fd.o \ | ||
32 | bss_file.o bss_sock.o bss_conn.o \ | ||
33 | bf_null.o bf_buff.o b_print.o b_dump.o \ | ||
34 | b_sock.o bss_acpt.o bf_nbio.o | ||
35 | |||
36 | SRC= $(LIBSRC) | ||
37 | |||
38 | EXHEADER= bio.h bss_file.c | ||
39 | HEADER= $(EXHEADER) | ||
40 | |||
41 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
42 | |||
43 | top: | ||
44 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
45 | |||
46 | all: lib | ||
47 | |||
48 | lib: $(LIBOBJ) | ||
49 | $(AR) $(LIB) $(LIBOBJ) | ||
50 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
51 | @touch lib | ||
52 | |||
53 | files: | ||
54 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
55 | |||
56 | links: | ||
57 | /bin/rm -f Makefile | ||
58 | $(TOP)/util/point.sh Makefile.ssl Makefile; | ||
59 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
60 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
61 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
62 | |||
63 | install: | ||
64 | @for i in $(EXHEADER) bss_file.c ; \ | ||
65 | do \ | ||
66 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
67 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
68 | done; | ||
69 | |||
70 | tags: | ||
71 | ctags $(SRC) | ||
72 | |||
73 | tests: | ||
74 | |||
75 | lint: | ||
76 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
77 | |||
78 | depend: | ||
79 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
80 | |||
81 | dclean: | ||
82 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
83 | mv -f Makefile.new $(MAKEFILE) | ||
84 | |||
85 | clean: | ||
86 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
87 | |||
88 | errors: | ||
89 | perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h | ||
90 | perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c | ||
91 | |||
92 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | /* Error codes for the BIO functions. */ | ||
2 | |||
3 | /* Function codes. */ | ||
4 | #define BIO_F_ACPT_STATE 100 | ||
5 | #define BIO_F_BIO_ACCEPT 101 | ||
6 | #define BIO_F_BIO_CTRL 102 | ||
7 | #define BIO_F_BIO_GETS 103 | ||
8 | #define BIO_F_BIO_GET_ACCEPT_SOCKET 104 | ||
9 | #define BIO_F_BIO_GET_HOST_IP 105 | ||
10 | #define BIO_F_BIO_GET_PORT 106 | ||
11 | #define BIO_F_BIO_NEW 107 | ||
12 | #define BIO_F_BIO_NEW_FILE 108 | ||
13 | #define BIO_F_BIO_PUTS 109 | ||
14 | #define BIO_F_BIO_READ 110 | ||
15 | #define BIO_F_BIO_SOCK_INIT 111 | ||
16 | #define BIO_F_BIO_WRITE 112 | ||
17 | #define BIO_F_BUFFER_CTRL 113 | ||
18 | #define BIO_F_CONN_STATE 114 | ||
19 | #define BIO_F_FILE_CTRL 115 | ||
20 | #define BIO_F_MEM_WRITE 116 | ||
21 | #define BIO_F_SSL_NEW 117 | ||
22 | #define BIO_F_WSASTARTUP 118 | ||
23 | |||
24 | /* Reason codes. */ | ||
25 | #define BIO_R_ACCEPT_ERROR 100 | ||
26 | #define BIO_R_BAD_FOPEN_MODE 101 | ||
27 | #define BIO_R_BAD_HOSTNAME_LOOKUP 102 | ||
28 | #define BIO_R_CONNECT_ERROR 103 | ||
29 | #define BIO_R_ERROR_SETTING_NBIO 104 | ||
30 | #define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105 | ||
31 | #define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106 | ||
32 | #define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 | ||
33 | #define BIO_R_INVALID_IP_ADDRESS 108 | ||
34 | #define BIO_R_KEEPALIVE 109 | ||
35 | #define BIO_R_NBIO_CONNECT_ERROR 110 | ||
36 | #define BIO_R_NO_ACCEPT_PORT_SPECIFIED 111 | ||
37 | #define BIO_R_NO_HOSTHNAME_SPECIFIED 112 | ||
38 | #define BIO_R_NO_PORT_DEFINED 113 | ||
39 | #define BIO_R_NO_PORT_SPECIFIED 114 | ||
40 | #define BIO_R_NULL_PARAMETER 115 | ||
41 | #define BIO_R_UNABLE_TO_BIND_SOCKET 116 | ||
42 | #define BIO_R_UNABLE_TO_CREATE_SOCKET 117 | ||
43 | #define BIO_R_UNABLE_TO_LISTEN_SOCKET 118 | ||
44 | #define BIO_R_UNINITALISED 119 | ||
45 | #define BIO_R_UNSUPPORTED_METHOD 120 | ||
46 | #define BIO_R_WSASTARTUP 121 | ||
diff --git a/src/lib/libcrypto/bn/Makefile.ssl b/src/lib/libcrypto/bn/Makefile.ssl new file mode 100644 index 0000000000..9809d26cbc --- /dev/null +++ b/src/lib/libcrypto/bn/Makefile.ssl | |||
@@ -0,0 +1,133 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/bn/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= bn | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | BN_MULW= bn_mulw.o | ||
17 | # or use | ||
18 | #BN_MULW= bn86-elf.o | ||
19 | |||
20 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
21 | |||
22 | ERR=bn | ||
23 | ERRC=bn_err | ||
24 | GENERAL=Makefile | ||
25 | TEST=bntest.c exptest.c | ||
26 | APPS= | ||
27 | |||
28 | LIB=$(TOP)/libcrypto.a | ||
29 | LIBSRC= bn_add.c bn_div.c bn_exp.c bn_lib.c bn_mod.c bn_mul.c \ | ||
30 | bn_print.c bn_rand.c bn_shift.c bn_sub.c bn_word.c bn_blind.c \ | ||
31 | bn_gcd.c bn_prime.c $(ERRC).c bn_sqr.c bn_mulw.c bn_recp.c bn_mont.c \ | ||
32 | bn_mpi.c | ||
33 | |||
34 | LIBOBJ= bn_add.o bn_div.o bn_exp.o bn_lib.o bn_mod.o bn_mul.o \ | ||
35 | bn_print.o bn_rand.o bn_shift.o bn_sub.o bn_word.o bn_blind.o \ | ||
36 | bn_gcd.o bn_prime.o $(ERRC).o bn_sqr.o $(BN_MULW) bn_recp.o bn_mont.o \ | ||
37 | bn_mpi.o | ||
38 | |||
39 | |||
40 | SRC= $(LIBSRC) | ||
41 | |||
42 | EXHEADER= bn.h | ||
43 | HEADER= bn_lcl.h bn_prime.h $(EXHEADER) | ||
44 | |||
45 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
46 | |||
47 | top: | ||
48 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
49 | |||
50 | all: lib | ||
51 | |||
52 | knuth: bn_knuth.c | ||
53 | cc -pg -I.. -I../../include bn_knuth.c -o knuth $(LIB) #../../../libefence.a | ||
54 | |||
55 | knuth.fast: bn_knuth.c | ||
56 | cc -pg -fast -I.. -I../../include bn_knuth.c -o knuth $(LIB) #../../../libefence.a | ||
57 | |||
58 | |||
59 | lib: $(LIBOBJ) | ||
60 | $(AR) $(LIB) $(LIBOBJ) | ||
61 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
62 | @touch lib | ||
63 | |||
64 | # elf | ||
65 | asm/bn86-elf.o: asm/bn86unix.cpp | ||
66 | $(CPP) -DELF asm/bn86unix.cpp | as -o asm/bn86-elf.o | ||
67 | |||
68 | # solaris | ||
69 | asm/bn86-sol.o: asm/bn86unix.cpp | ||
70 | $(CC) -E -DSOL asm/bn86unix.cpp | sed 's/^#.*//' > asm/bn86-sol.s | ||
71 | as -o asm/bn86-sol.o asm/bn86-sol.s | ||
72 | rm -f asm/bn86-sol.s | ||
73 | |||
74 | # a.out | ||
75 | asm/bn86-out.o: asm/bn86unix.cpp | ||
76 | $(CPP) -DOUT asm/bn86unix.cpp | as -o asm/bn86-out.o | ||
77 | |||
78 | # bsdi | ||
79 | asm/bn86bsdi.o: asm/bn86unix.cpp | ||
80 | $(CPP) -DBSDI asm/bn86unix.cpp | as -o asm/bn86bsdi.o | ||
81 | |||
82 | asm/bn86unix.cpp: | ||
83 | (cd asm; perl bn-586.pl cpp >bn86unix.cpp ) | ||
84 | |||
85 | files: | ||
86 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
87 | |||
88 | links: | ||
89 | /bin/rm -f Makefile | ||
90 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
91 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
92 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
93 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
94 | |||
95 | install: | ||
96 | @for i in $(EXHEADER) ; \ | ||
97 | do \ | ||
98 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
99 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
100 | done; | ||
101 | |||
102 | exptest: | ||
103 | /bin/rm -f exptest | ||
104 | gcc -I../../include -g2 -ggdb -o exptest exptest.c ../../libcrypto.a | ||
105 | |||
106 | div: | ||
107 | /bin/rm -f a.out | ||
108 | gcc -I.. -g div.c ../../libcrypto.a | ||
109 | |||
110 | tags: | ||
111 | ctags $(SRC) | ||
112 | |||
113 | tests: | ||
114 | |||
115 | lint: | ||
116 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
117 | |||
118 | depend: | ||
119 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
120 | |||
121 | dclean: | ||
122 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
123 | mv -f Makefile.new $(MAKEFILE) | ||
124 | |||
125 | clean: | ||
126 | /bin/rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff bn_mulw.s | ||
127 | |||
128 | errors: | ||
129 | perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).org # special case .org | ||
130 | perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h | ||
131 | perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c | ||
132 | |||
133 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | ; Don't even think of reading this code | ||
2 | ; It was automatically generated by bn-586.pl | ||
3 | ; Which is a perl program used to generate the x86 assember for | ||
4 | ; any of elf, a.out, BSDI,Win32, or Solaris | ||
5 | ; eric <eay@cryptsoft.com> | ||
6 | ; | ||
7 | TITLE bn-586.asm | ||
8 | .386 | ||
9 | .model FLAT | ||
10 | _TEXT SEGMENT | ||
11 | PUBLIC _bn_mul_add_words | ||
12 | |||
13 | _bn_mul_add_words PROC NEAR | ||
14 | push ebp | ||
15 | push ebx | ||
16 | push esi | ||
17 | push edi | ||
18 | ; | ||
19 | xor esi, esi | ||
20 | mov edi, DWORD PTR 20[esp] | ||
21 | mov ecx, DWORD PTR 28[esp] | ||
22 | mov ebx, DWORD PTR 24[esp] | ||
23 | and ecx, 4294967288 | ||
24 | mov ebp, DWORD PTR 32[esp] | ||
25 | push ecx | ||
26 | jz $L000maw_finish | ||
27 | L001maw_loop: | ||
28 | mov DWORD PTR [esp],ecx | ||
29 | ; Round 0 | ||
30 | mov eax, DWORD PTR [ebx] | ||
31 | mul ebp | ||
32 | add eax, esi | ||
33 | mov esi, DWORD PTR [edi] | ||
34 | adc edx, 0 | ||
35 | add eax, esi | ||
36 | adc edx, 0 | ||
37 | mov DWORD PTR [edi],eax | ||
38 | mov esi, edx | ||
39 | ; Round 4 | ||
40 | mov eax, DWORD PTR 4[ebx] | ||
41 | mul ebp | ||
42 | add eax, esi | ||
43 | mov esi, DWORD PTR 4[edi] | ||
44 | adc edx, 0 | ||
45 | add eax, esi | ||
46 | adc edx, 0 | ||
47 | mov DWORD PTR 4[edi],eax | ||
48 | mov esi, edx | ||
49 | ; Round 8 | ||
50 | mov eax, DWORD PTR 8[ebx] | ||
51 | mul ebp | ||
52 | add eax, esi | ||
53 | mov esi, DWORD PTR 8[edi] | ||
54 | adc edx, 0 | ||
55 | add eax, esi | ||
56 | adc edx, 0 | ||
57 | mov DWORD PTR 8[edi],eax | ||
58 | mov esi, edx | ||
59 | ; Round 12 | ||
60 | mov eax, DWORD PTR 12[ebx] | ||
61 | mul ebp | ||
62 | add eax, esi | ||
63 | mov esi, DWORD PTR 12[edi] | ||
64 | adc edx, 0 | ||
65 | add eax, esi | ||
66 | adc edx, 0 | ||
67 | mov DWORD PTR 12[edi],eax | ||
68 | mov esi, edx | ||
69 | ; Round 16 | ||
70 | mov eax, DWORD PTR 16[ebx] | ||
71 | mul ebp | ||
72 | add eax, esi | ||
73 | mov esi, DWORD PTR 16[edi] | ||
74 | adc edx, 0 | ||
75 | add eax, esi | ||
76 | adc edx, 0 | ||
77 | mov DWORD PTR 16[edi],eax | ||
78 | mov esi, edx | ||
79 | ; Round 20 | ||
80 | mov eax, DWORD PTR 20[ebx] | ||
81 | mul ebp | ||
82 | add eax, esi | ||
83 | mov esi, DWORD PTR 20[edi] | ||
84 | adc edx, 0 | ||
85 | add eax, esi | ||
86 | adc edx, 0 | ||
87 | mov DWORD PTR 20[edi],eax | ||
88 | mov esi, edx | ||
89 | ; Round 24 | ||
90 | mov eax, DWORD PTR 24[ebx] | ||
91 | mul ebp | ||
92 | add eax, esi | ||
93 | mov esi, DWORD PTR 24[edi] | ||
94 | adc edx, 0 | ||
95 | add eax, esi | ||
96 | adc edx, 0 | ||
97 | mov DWORD PTR 24[edi],eax | ||
98 | mov esi, edx | ||
99 | ; Round 28 | ||
100 | mov eax, DWORD PTR 28[ebx] | ||
101 | mul ebp | ||
102 | add eax, esi | ||
103 | mov esi, DWORD PTR 28[edi] | ||
104 | adc edx, 0 | ||
105 | add eax, esi | ||
106 | adc edx, 0 | ||
107 | mov DWORD PTR 28[edi],eax | ||
108 | mov esi, edx | ||
109 | ; | ||
110 | mov ecx, DWORD PTR [esp] | ||
111 | add ebx, 32 | ||
112 | add edi, 32 | ||
113 | sub ecx, 8 | ||
114 | jnz L001maw_loop | ||
115 | $L000maw_finish: | ||
116 | mov ecx, DWORD PTR 32[esp] | ||
117 | and ecx, 7 | ||
118 | jnz $L002maw_finish2 | ||
119 | jmp $L003maw_end | ||
120 | $L002maw_finish2: | ||
121 | ; Tail Round 0 | ||
122 | mov eax, DWORD PTR [ebx] | ||
123 | mul ebp | ||
124 | add eax, esi | ||
125 | mov esi, DWORD PTR [edi] | ||
126 | adc edx, 0 | ||
127 | add eax, esi | ||
128 | adc edx, 0 | ||
129 | dec ecx | ||
130 | mov DWORD PTR [edi],eax | ||
131 | mov esi, edx | ||
132 | jz $L003maw_end | ||
133 | ; Tail Round 1 | ||
134 | mov eax, DWORD PTR 4[ebx] | ||
135 | mul ebp | ||
136 | add eax, esi | ||
137 | mov esi, DWORD PTR 4[edi] | ||
138 | adc edx, 0 | ||
139 | add eax, esi | ||
140 | adc edx, 0 | ||
141 | dec ecx | ||
142 | mov DWORD PTR 4[edi],eax | ||
143 | mov esi, edx | ||
144 | jz $L003maw_end | ||
145 | ; Tail Round 2 | ||
146 | mov eax, DWORD PTR 8[ebx] | ||
147 | mul ebp | ||
148 | add eax, esi | ||
149 | mov esi, DWORD PTR 8[edi] | ||
150 | adc edx, 0 | ||
151 | add eax, esi | ||
152 | adc edx, 0 | ||
153 | dec ecx | ||
154 | mov DWORD PTR 8[edi],eax | ||
155 | mov esi, edx | ||
156 | jz $L003maw_end | ||
157 | ; Tail Round 3 | ||
158 | mov eax, DWORD PTR 12[ebx] | ||
159 | mul ebp | ||
160 | add eax, esi | ||
161 | mov esi, DWORD PTR 12[edi] | ||
162 | adc edx, 0 | ||
163 | add eax, esi | ||
164 | adc edx, 0 | ||
165 | dec ecx | ||
166 | mov DWORD PTR 12[edi],eax | ||
167 | mov esi, edx | ||
168 | jz $L003maw_end | ||
169 | ; Tail Round 4 | ||
170 | mov eax, DWORD PTR 16[ebx] | ||
171 | mul ebp | ||
172 | add eax, esi | ||
173 | mov esi, DWORD PTR 16[edi] | ||
174 | adc edx, 0 | ||
175 | add eax, esi | ||
176 | adc edx, 0 | ||
177 | dec ecx | ||
178 | mov DWORD PTR 16[edi],eax | ||
179 | mov esi, edx | ||
180 | jz $L003maw_end | ||
181 | ; Tail Round 5 | ||
182 | mov eax, DWORD PTR 20[ebx] | ||
183 | mul ebp | ||
184 | add eax, esi | ||
185 | mov esi, DWORD PTR 20[edi] | ||
186 | adc edx, 0 | ||
187 | add eax, esi | ||
188 | adc edx, 0 | ||
189 | dec ecx | ||
190 | mov DWORD PTR 20[edi],eax | ||
191 | mov esi, edx | ||
192 | jz $L003maw_end | ||
193 | ; Tail Round 6 | ||
194 | mov eax, DWORD PTR 24[ebx] | ||
195 | mul ebp | ||
196 | add eax, esi | ||
197 | mov esi, DWORD PTR 24[edi] | ||
198 | adc edx, 0 | ||
199 | add eax, esi | ||
200 | adc edx, 0 | ||
201 | mov DWORD PTR 24[edi],eax | ||
202 | mov esi, edx | ||
203 | $L003maw_end: | ||
204 | mov eax, esi | ||
205 | pop ecx | ||
206 | pop edi | ||
207 | pop esi | ||
208 | pop ebx | ||
209 | pop ebp | ||
210 | ret | ||
211 | _bn_mul_add_words ENDP | ||
212 | _TEXT ENDS | ||
213 | _TEXT SEGMENT | ||
214 | PUBLIC _bn_mul_words | ||
215 | |||
216 | _bn_mul_words PROC NEAR | ||
217 | push ebp | ||
218 | push ebx | ||
219 | push esi | ||
220 | push edi | ||
221 | ; | ||
222 | xor esi, esi | ||
223 | mov edi, DWORD PTR 20[esp] | ||
224 | mov ebx, DWORD PTR 24[esp] | ||
225 | mov ebp, DWORD PTR 28[esp] | ||
226 | mov ecx, DWORD PTR 32[esp] | ||
227 | and ebp, 4294967288 | ||
228 | jz $L004mw_finish | ||
229 | L005mw_loop: | ||
230 | ; Round 0 | ||
231 | mov eax, DWORD PTR [ebx] | ||
232 | mul ecx | ||
233 | add eax, esi | ||
234 | adc edx, 0 | ||
235 | mov DWORD PTR [edi],eax | ||
236 | mov esi, edx | ||
237 | ; Round 4 | ||
238 | mov eax, DWORD PTR 4[ebx] | ||
239 | mul ecx | ||
240 | add eax, esi | ||
241 | adc edx, 0 | ||
242 | mov DWORD PTR 4[edi],eax | ||
243 | mov esi, edx | ||
244 | ; Round 8 | ||
245 | mov eax, DWORD PTR 8[ebx] | ||
246 | mul ecx | ||
247 | add eax, esi | ||
248 | adc edx, 0 | ||
249 | mov DWORD PTR 8[edi],eax | ||
250 | mov esi, edx | ||
251 | ; Round 12 | ||
252 | mov eax, DWORD PTR 12[ebx] | ||
253 | mul ecx | ||
254 | add eax, esi | ||
255 | adc edx, 0 | ||
256 | mov DWORD PTR 12[edi],eax | ||
257 | mov esi, edx | ||
258 | ; Round 16 | ||
259 | mov eax, DWORD PTR 16[ebx] | ||
260 | mul ecx | ||
261 | add eax, esi | ||
262 | adc edx, 0 | ||
263 | mov DWORD PTR 16[edi],eax | ||
264 | mov esi, edx | ||
265 | ; Round 20 | ||
266 | mov eax, DWORD PTR 20[ebx] | ||
267 | mul ecx | ||
268 | add eax, esi | ||
269 | adc edx, 0 | ||
270 | mov DWORD PTR 20[edi],eax | ||
271 | mov esi, edx | ||
272 | ; Round 24 | ||
273 | mov eax, DWORD PTR 24[ebx] | ||
274 | mul ecx | ||
275 | add eax, esi | ||
276 | adc edx, 0 | ||
277 | mov DWORD PTR 24[edi],eax | ||
278 | mov esi, edx | ||
279 | ; Round 28 | ||
280 | mov eax, DWORD PTR 28[ebx] | ||
281 | mul ecx | ||
282 | add eax, esi | ||
283 | adc edx, 0 | ||
284 | mov DWORD PTR 28[edi],eax | ||
285 | mov esi, edx | ||
286 | ; | ||
287 | add ebx, 32 | ||
288 | add edi, 32 | ||
289 | sub ebp, 8 | ||
290 | jz $L004mw_finish | ||
291 | jmp L005mw_loop | ||
292 | $L004mw_finish: | ||
293 | mov ebp, DWORD PTR 28[esp] | ||
294 | and ebp, 7 | ||
295 | jnz $L006mw_finish2 | ||
296 | jmp $L007mw_end | ||
297 | $L006mw_finish2: | ||
298 | ; Tail Round 0 | ||
299 | mov eax, DWORD PTR [ebx] | ||
300 | mul ecx | ||
301 | add eax, esi | ||
302 | adc edx, 0 | ||
303 | mov DWORD PTR [edi],eax | ||
304 | mov esi, edx | ||
305 | dec ebp | ||
306 | jz $L007mw_end | ||
307 | ; Tail Round 1 | ||
308 | mov eax, DWORD PTR 4[ebx] | ||
309 | mul ecx | ||
310 | add eax, esi | ||
311 | adc edx, 0 | ||
312 | mov DWORD PTR 4[edi],eax | ||
313 | mov esi, edx | ||
314 | dec ebp | ||
315 | jz $L007mw_end | ||
316 | ; Tail Round 2 | ||
317 | mov eax, DWORD PTR 8[ebx] | ||
318 | mul ecx | ||
319 | add eax, esi | ||
320 | adc edx, 0 | ||
321 | mov DWORD PTR 8[edi],eax | ||
322 | mov esi, edx | ||
323 | dec ebp | ||
324 | jz $L007mw_end | ||
325 | ; Tail Round 3 | ||
326 | mov eax, DWORD PTR 12[ebx] | ||
327 | mul ecx | ||
328 | add eax, esi | ||
329 | adc edx, 0 | ||
330 | mov DWORD PTR 12[edi],eax | ||
331 | mov esi, edx | ||
332 | dec ebp | ||
333 | jz $L007mw_end | ||
334 | ; Tail Round 4 | ||
335 | mov eax, DWORD PTR 16[ebx] | ||
336 | mul ecx | ||
337 | add eax, esi | ||
338 | adc edx, 0 | ||
339 | mov DWORD PTR 16[edi],eax | ||
340 | mov esi, edx | ||
341 | dec ebp | ||
342 | jz $L007mw_end | ||
343 | ; Tail Round 5 | ||
344 | mov eax, DWORD PTR 20[ebx] | ||
345 | mul ecx | ||
346 | add eax, esi | ||
347 | adc edx, 0 | ||
348 | mov DWORD PTR 20[edi],eax | ||
349 | mov esi, edx | ||
350 | dec ebp | ||
351 | jz $L007mw_end | ||
352 | ; Tail Round 6 | ||
353 | mov eax, DWORD PTR 24[ebx] | ||
354 | mul ecx | ||
355 | add eax, esi | ||
356 | adc edx, 0 | ||
357 | mov DWORD PTR 24[edi],eax | ||
358 | mov esi, edx | ||
359 | $L007mw_end: | ||
360 | mov eax, esi | ||
361 | pop edi | ||
362 | pop esi | ||
363 | pop ebx | ||
364 | pop ebp | ||
365 | ret | ||
366 | _bn_mul_words ENDP | ||
367 | _TEXT ENDS | ||
368 | _TEXT SEGMENT | ||
369 | PUBLIC _bn_sqr_words | ||
370 | |||
371 | _bn_sqr_words PROC NEAR | ||
372 | push ebp | ||
373 | push ebx | ||
374 | push esi | ||
375 | push edi | ||
376 | ; | ||
377 | mov esi, DWORD PTR 20[esp] | ||
378 | mov edi, DWORD PTR 24[esp] | ||
379 | mov ebx, DWORD PTR 28[esp] | ||
380 | and ebx, 4294967288 | ||
381 | jz $L008sw_finish | ||
382 | L009sw_loop: | ||
383 | ; Round 0 | ||
384 | mov eax, DWORD PTR [edi] | ||
385 | mul eax | ||
386 | mov DWORD PTR [esi],eax | ||
387 | mov DWORD PTR 4[esi],edx | ||
388 | ; Round 4 | ||
389 | mov eax, DWORD PTR 4[edi] | ||
390 | mul eax | ||
391 | mov DWORD PTR 8[esi],eax | ||
392 | mov DWORD PTR 12[esi],edx | ||
393 | ; Round 8 | ||
394 | mov eax, DWORD PTR 8[edi] | ||
395 | mul eax | ||
396 | mov DWORD PTR 16[esi],eax | ||
397 | mov DWORD PTR 20[esi],edx | ||
398 | ; Round 12 | ||
399 | mov eax, DWORD PTR 12[edi] | ||
400 | mul eax | ||
401 | mov DWORD PTR 24[esi],eax | ||
402 | mov DWORD PTR 28[esi],edx | ||
403 | ; Round 16 | ||
404 | mov eax, DWORD PTR 16[edi] | ||
405 | mul eax | ||
406 | mov DWORD PTR 32[esi],eax | ||
407 | mov DWORD PTR 36[esi],edx | ||
408 | ; Round 20 | ||
409 | mov eax, DWORD PTR 20[edi] | ||
410 | mul eax | ||
411 | mov DWORD PTR 40[esi],eax | ||
412 | mov DWORD PTR 44[esi],edx | ||
413 | ; Round 24 | ||
414 | mov eax, DWORD PTR 24[edi] | ||
415 | mul eax | ||
416 | mov DWORD PTR 48[esi],eax | ||
417 | mov DWORD PTR 52[esi],edx | ||
418 | ; Round 28 | ||
419 | mov eax, DWORD PTR 28[edi] | ||
420 | mul eax | ||
421 | mov DWORD PTR 56[esi],eax | ||
422 | mov DWORD PTR 60[esi],edx | ||
423 | ; | ||
424 | add edi, 32 | ||
425 | add esi, 64 | ||
426 | sub ebx, 8 | ||
427 | jnz L009sw_loop | ||
428 | $L008sw_finish: | ||
429 | mov ebx, DWORD PTR 28[esp] | ||
430 | and ebx, 7 | ||
431 | jz $L010sw_end | ||
432 | ; Tail Round 0 | ||
433 | mov eax, DWORD PTR [edi] | ||
434 | mul eax | ||
435 | mov DWORD PTR [esi],eax | ||
436 | dec ebx | ||
437 | mov DWORD PTR 4[esi],edx | ||
438 | jz $L010sw_end | ||
439 | ; Tail Round 1 | ||
440 | mov eax, DWORD PTR 4[edi] | ||
441 | mul eax | ||
442 | mov DWORD PTR 8[esi],eax | ||
443 | dec ebx | ||
444 | mov DWORD PTR 12[esi],edx | ||
445 | jz $L010sw_end | ||
446 | ; Tail Round 2 | ||
447 | mov eax, DWORD PTR 8[edi] | ||
448 | mul eax | ||
449 | mov DWORD PTR 16[esi],eax | ||
450 | dec ebx | ||
451 | mov DWORD PTR 20[esi],edx | ||
452 | jz $L010sw_end | ||
453 | ; Tail Round 3 | ||
454 | mov eax, DWORD PTR 12[edi] | ||
455 | mul eax | ||
456 | mov DWORD PTR 24[esi],eax | ||
457 | dec ebx | ||
458 | mov DWORD PTR 28[esi],edx | ||
459 | jz $L010sw_end | ||
460 | ; Tail Round 4 | ||
461 | mov eax, DWORD PTR 16[edi] | ||
462 | mul eax | ||
463 | mov DWORD PTR 32[esi],eax | ||
464 | dec ebx | ||
465 | mov DWORD PTR 36[esi],edx | ||
466 | jz $L010sw_end | ||
467 | ; Tail Round 5 | ||
468 | mov eax, DWORD PTR 20[edi] | ||
469 | mul eax | ||
470 | mov DWORD PTR 40[esi],eax | ||
471 | dec ebx | ||
472 | mov DWORD PTR 44[esi],edx | ||
473 | jz $L010sw_end | ||
474 | ; Tail Round 6 | ||
475 | mov eax, DWORD PTR 24[edi] | ||
476 | mul eax | ||
477 | mov DWORD PTR 48[esi],eax | ||
478 | mov DWORD PTR 52[esi],edx | ||
479 | $L010sw_end: | ||
480 | pop edi | ||
481 | pop esi | ||
482 | pop ebx | ||
483 | pop ebp | ||
484 | ret | ||
485 | _bn_sqr_words ENDP | ||
486 | _TEXT ENDS | ||
487 | _TEXT SEGMENT | ||
488 | PUBLIC _bn_div64 | ||
489 | |||
490 | _bn_div64 PROC NEAR | ||
491 | push ebp | ||
492 | push ebx | ||
493 | push esi | ||
494 | push edi | ||
495 | mov edx, DWORD PTR 20[esp] | ||
496 | mov eax, DWORD PTR 24[esp] | ||
497 | mov ebx, DWORD PTR 28[esp] | ||
498 | div ebx | ||
499 | pop edi | ||
500 | pop esi | ||
501 | pop ebx | ||
502 | pop ebp | ||
503 | ret | ||
504 | _bn_div64 ENDP | ||
505 | _TEXT ENDS | ||
506 | _TEXT SEGMENT | ||
507 | PUBLIC _bn_add_words | ||
508 | |||
509 | _bn_add_words PROC NEAR | ||
510 | push ebp | ||
511 | push ebx | ||
512 | push esi | ||
513 | push edi | ||
514 | ; | ||
515 | mov ebx, DWORD PTR 20[esp] | ||
516 | mov esi, DWORD PTR 24[esp] | ||
517 | mov edi, DWORD PTR 28[esp] | ||
518 | mov ebp, DWORD PTR 32[esp] | ||
519 | xor eax, eax | ||
520 | and ebp, 4294967288 | ||
521 | jz $L011aw_finish | ||
522 | L012aw_loop: | ||
523 | ; Round 0 | ||
524 | mov ecx, DWORD PTR [esi] | ||
525 | mov edx, DWORD PTR [edi] | ||
526 | add ecx, eax | ||
527 | mov eax, 0 | ||
528 | adc eax, eax | ||
529 | add ecx, edx | ||
530 | adc eax, 0 | ||
531 | mov DWORD PTR [ebx],ecx | ||
532 | ; Round 1 | ||
533 | mov ecx, DWORD PTR 4[esi] | ||
534 | mov edx, DWORD PTR 4[edi] | ||
535 | add ecx, eax | ||
536 | mov eax, 0 | ||
537 | adc eax, eax | ||
538 | add ecx, edx | ||
539 | adc eax, 0 | ||
540 | mov DWORD PTR 4[ebx],ecx | ||
541 | ; Round 2 | ||
542 | mov ecx, DWORD PTR 8[esi] | ||
543 | mov edx, DWORD PTR 8[edi] | ||
544 | add ecx, eax | ||
545 | mov eax, 0 | ||
546 | adc eax, eax | ||
547 | add ecx, edx | ||
548 | adc eax, 0 | ||
549 | mov DWORD PTR 8[ebx],ecx | ||
550 | ; Round 3 | ||
551 | mov ecx, DWORD PTR 12[esi] | ||
552 | mov edx, DWORD PTR 12[edi] | ||
553 | add ecx, eax | ||
554 | mov eax, 0 | ||
555 | adc eax, eax | ||
556 | add ecx, edx | ||
557 | adc eax, 0 | ||
558 | mov DWORD PTR 12[ebx],ecx | ||
559 | ; Round 4 | ||
560 | mov ecx, DWORD PTR 16[esi] | ||
561 | mov edx, DWORD PTR 16[edi] | ||
562 | add ecx, eax | ||
563 | mov eax, 0 | ||
564 | adc eax, eax | ||
565 | add ecx, edx | ||
566 | adc eax, 0 | ||
567 | mov DWORD PTR 16[ebx],ecx | ||
568 | ; Round 5 | ||
569 | mov ecx, DWORD PTR 20[esi] | ||
570 | mov edx, DWORD PTR 20[edi] | ||
571 | add ecx, eax | ||
572 | mov eax, 0 | ||
573 | adc eax, eax | ||
574 | add ecx, edx | ||
575 | adc eax, 0 | ||
576 | mov DWORD PTR 20[ebx],ecx | ||
577 | ; Round 6 | ||
578 | mov ecx, DWORD PTR 24[esi] | ||
579 | mov edx, DWORD PTR 24[edi] | ||
580 | add ecx, eax | ||
581 | mov eax, 0 | ||
582 | adc eax, eax | ||
583 | add ecx, edx | ||
584 | adc eax, 0 | ||
585 | mov DWORD PTR 24[ebx],ecx | ||
586 | ; Round 7 | ||
587 | mov ecx, DWORD PTR 28[esi] | ||
588 | mov edx, DWORD PTR 28[edi] | ||
589 | add ecx, eax | ||
590 | mov eax, 0 | ||
591 | adc eax, eax | ||
592 | add ecx, edx | ||
593 | adc eax, 0 | ||
594 | mov DWORD PTR 28[ebx],ecx | ||
595 | ; | ||
596 | add esi, 32 | ||
597 | add edi, 32 | ||
598 | add ebx, 32 | ||
599 | sub ebp, 8 | ||
600 | jnz L012aw_loop | ||
601 | $L011aw_finish: | ||
602 | mov ebp, DWORD PTR 32[esp] | ||
603 | and ebp, 7 | ||
604 | jz $L013aw_end | ||
605 | ; Tail Round 0 | ||
606 | mov ecx, DWORD PTR [esi] | ||
607 | mov edx, DWORD PTR [edi] | ||
608 | add ecx, eax | ||
609 | mov eax, 0 | ||
610 | adc eax, eax | ||
611 | add ecx, edx | ||
612 | adc eax, 0 | ||
613 | dec ebp | ||
614 | mov DWORD PTR [ebx],ecx | ||
615 | jz $L013aw_end | ||
616 | ; Tail Round 1 | ||
617 | mov ecx, DWORD PTR 4[esi] | ||
618 | mov edx, DWORD PTR 4[edi] | ||
619 | add ecx, eax | ||
620 | mov eax, 0 | ||
621 | adc eax, eax | ||
622 | add ecx, edx | ||
623 | adc eax, 0 | ||
624 | dec ebp | ||
625 | mov DWORD PTR 4[ebx],ecx | ||
626 | jz $L013aw_end | ||
627 | ; Tail Round 2 | ||
628 | mov ecx, DWORD PTR 8[esi] | ||
629 | mov edx, DWORD PTR 8[edi] | ||
630 | add ecx, eax | ||
631 | mov eax, 0 | ||
632 | adc eax, eax | ||
633 | add ecx, edx | ||
634 | adc eax, 0 | ||
635 | dec ebp | ||
636 | mov DWORD PTR 8[ebx],ecx | ||
637 | jz $L013aw_end | ||
638 | ; Tail Round 3 | ||
639 | mov ecx, DWORD PTR 12[esi] | ||
640 | mov edx, DWORD PTR 12[edi] | ||
641 | add ecx, eax | ||
642 | mov eax, 0 | ||
643 | adc eax, eax | ||
644 | add ecx, edx | ||
645 | adc eax, 0 | ||
646 | dec ebp | ||
647 | mov DWORD PTR 12[ebx],ecx | ||
648 | jz $L013aw_end | ||
649 | ; Tail Round 4 | ||
650 | mov ecx, DWORD PTR 16[esi] | ||
651 | mov edx, DWORD PTR 16[edi] | ||
652 | add ecx, eax | ||
653 | mov eax, 0 | ||
654 | adc eax, eax | ||
655 | add ecx, edx | ||
656 | adc eax, 0 | ||
657 | dec ebp | ||
658 | mov DWORD PTR 16[ebx],ecx | ||
659 | jz $L013aw_end | ||
660 | ; Tail Round 5 | ||
661 | mov ecx, DWORD PTR 20[esi] | ||
662 | mov edx, DWORD PTR 20[edi] | ||
663 | add ecx, eax | ||
664 | mov eax, 0 | ||
665 | adc eax, eax | ||
666 | add ecx, edx | ||
667 | adc eax, 0 | ||
668 | dec ebp | ||
669 | mov DWORD PTR 20[ebx],ecx | ||
670 | jz $L013aw_end | ||
671 | ; Tail Round 6 | ||
672 | mov ecx, DWORD PTR 24[esi] | ||
673 | mov edx, DWORD PTR 24[edi] | ||
674 | add ecx, eax | ||
675 | mov eax, 0 | ||
676 | adc eax, eax | ||
677 | add ecx, edx | ||
678 | adc eax, 0 | ||
679 | mov DWORD PTR 24[ebx],ecx | ||
680 | $L013aw_end: | ||
681 | mov eax, eax | ||
682 | pop edi | ||
683 | pop esi | ||
684 | pop ebx | ||
685 | pop ebp | ||
686 | ret | ||
687 | _bn_add_words ENDP | ||
688 | _TEXT ENDS | ||
689 | 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 @@ | |||
1 | /* Run the C pre-processor over this file with one of the following defined | ||
2 | * ELF - elf object files, | ||
3 | * OUT - a.out object files, | ||
4 | * BSDI - BSDI style a.out object files | ||
5 | * SOL - Solaris style elf | ||
6 | */ | ||
7 | |||
8 | #define TYPE(a,b) .type a,b | ||
9 | #define SIZE(a,b) .size a,b | ||
10 | |||
11 | #if defined(OUT) || defined(BSDI) | ||
12 | #define bn_mul_add_words _bn_mul_add_words | ||
13 | #define bn_mul_words _bn_mul_words | ||
14 | #define bn_sqr_words _bn_sqr_words | ||
15 | #define bn_div64 _bn_div64 | ||
16 | #define bn_add_words _bn_add_words | ||
17 | |||
18 | #endif | ||
19 | |||
20 | #ifdef OUT | ||
21 | #define OK 1 | ||
22 | #define ALIGN 4 | ||
23 | #endif | ||
24 | |||
25 | #ifdef BSDI | ||
26 | #define OK 1 | ||
27 | #define ALIGN 4 | ||
28 | #undef SIZE | ||
29 | #undef TYPE | ||
30 | #define SIZE(a,b) | ||
31 | #define TYPE(a,b) | ||
32 | #endif | ||
33 | |||
34 | #if defined(ELF) || defined(SOL) | ||
35 | #define OK 1 | ||
36 | #define ALIGN 16 | ||
37 | #endif | ||
38 | |||
39 | #ifndef OK | ||
40 | You need to define one of | ||
41 | ELF - elf systems - linux-elf, NetBSD and DG-UX | ||
42 | OUT - a.out systems - linux-a.out and FreeBSD | ||
43 | SOL - solaris systems, which are elf with strange comment lines | ||
44 | BSDI - a.out with a very primative version of as. | ||
45 | #endif | ||
46 | |||
47 | /* Let the Assembler begin :-) */ | ||
48 | /* Don't even think of reading this code */ | ||
49 | /* It was automatically generated by bn-586.pl */ | ||
50 | /* Which is a perl program used to generate the x86 assember for */ | ||
51 | /* any of elf, a.out, BSDI,Win32, or Solaris */ | ||
52 | /* eric <eay@cryptsoft.com> */ | ||
53 | |||
54 | .file "bn-586.s" | ||
55 | .version "01.01" | ||
56 | gcc2_compiled.: | ||
57 | .text | ||
58 | .align ALIGN | ||
59 | .globl bn_mul_add_words | ||
60 | TYPE(bn_mul_add_words,@function) | ||
61 | bn_mul_add_words: | ||
62 | pushl %ebp | ||
63 | pushl %ebx | ||
64 | pushl %esi | ||
65 | pushl %edi | ||
66 | |||
67 | |||
68 | xorl %esi, %esi | ||
69 | movl 20(%esp), %edi | ||
70 | movl 28(%esp), %ecx | ||
71 | movl 24(%esp), %ebx | ||
72 | andl $4294967288, %ecx | ||
73 | movl 32(%esp), %ebp | ||
74 | pushl %ecx | ||
75 | jz .L000maw_finish | ||
76 | .L001maw_loop: | ||
77 | movl %ecx, (%esp) | ||
78 | /* Round 0 */ | ||
79 | movl (%ebx), %eax | ||
80 | mull %ebp | ||
81 | addl %esi, %eax | ||
82 | movl (%edi), %esi | ||
83 | adcl $0, %edx | ||
84 | addl %esi, %eax | ||
85 | adcl $0, %edx | ||
86 | movl %eax, (%edi) | ||
87 | movl %edx, %esi | ||
88 | /* Round 4 */ | ||
89 | movl 4(%ebx), %eax | ||
90 | mull %ebp | ||
91 | addl %esi, %eax | ||
92 | movl 4(%edi), %esi | ||
93 | adcl $0, %edx | ||
94 | addl %esi, %eax | ||
95 | adcl $0, %edx | ||
96 | movl %eax, 4(%edi) | ||
97 | movl %edx, %esi | ||
98 | /* Round 8 */ | ||
99 | movl 8(%ebx), %eax | ||
100 | mull %ebp | ||
101 | addl %esi, %eax | ||
102 | movl 8(%edi), %esi | ||
103 | adcl $0, %edx | ||
104 | addl %esi, %eax | ||
105 | adcl $0, %edx | ||
106 | movl %eax, 8(%edi) | ||
107 | movl %edx, %esi | ||
108 | /* Round 12 */ | ||
109 | movl 12(%ebx), %eax | ||
110 | mull %ebp | ||
111 | addl %esi, %eax | ||
112 | movl 12(%edi), %esi | ||
113 | adcl $0, %edx | ||
114 | addl %esi, %eax | ||
115 | adcl $0, %edx | ||
116 | movl %eax, 12(%edi) | ||
117 | movl %edx, %esi | ||
118 | /* Round 16 */ | ||
119 | movl 16(%ebx), %eax | ||
120 | mull %ebp | ||
121 | addl %esi, %eax | ||
122 | movl 16(%edi), %esi | ||
123 | adcl $0, %edx | ||
124 | addl %esi, %eax | ||
125 | adcl $0, %edx | ||
126 | movl %eax, 16(%edi) | ||
127 | movl %edx, %esi | ||
128 | /* Round 20 */ | ||
129 | movl 20(%ebx), %eax | ||
130 | mull %ebp | ||
131 | addl %esi, %eax | ||
132 | movl 20(%edi), %esi | ||
133 | adcl $0, %edx | ||
134 | addl %esi, %eax | ||
135 | adcl $0, %edx | ||
136 | movl %eax, 20(%edi) | ||
137 | movl %edx, %esi | ||
138 | /* Round 24 */ | ||
139 | movl 24(%ebx), %eax | ||
140 | mull %ebp | ||
141 | addl %esi, %eax | ||
142 | movl 24(%edi), %esi | ||
143 | adcl $0, %edx | ||
144 | addl %esi, %eax | ||
145 | adcl $0, %edx | ||
146 | movl %eax, 24(%edi) | ||
147 | movl %edx, %esi | ||
148 | /* Round 28 */ | ||
149 | movl 28(%ebx), %eax | ||
150 | mull %ebp | ||
151 | addl %esi, %eax | ||
152 | movl 28(%edi), %esi | ||
153 | adcl $0, %edx | ||
154 | addl %esi, %eax | ||
155 | adcl $0, %edx | ||
156 | movl %eax, 28(%edi) | ||
157 | movl %edx, %esi | ||
158 | |||
159 | movl (%esp), %ecx | ||
160 | addl $32, %ebx | ||
161 | addl $32, %edi | ||
162 | subl $8, %ecx | ||
163 | jnz .L001maw_loop | ||
164 | .L000maw_finish: | ||
165 | movl 32(%esp), %ecx | ||
166 | andl $7, %ecx | ||
167 | jnz .L002maw_finish2 | ||
168 | jmp .L003maw_end | ||
169 | .align ALIGN | ||
170 | .L002maw_finish2: | ||
171 | /* Tail Round 0 */ | ||
172 | movl (%ebx), %eax | ||
173 | mull %ebp | ||
174 | addl %esi, %eax | ||
175 | movl (%edi), %esi | ||
176 | adcl $0, %edx | ||
177 | addl %esi, %eax | ||
178 | adcl $0, %edx | ||
179 | decl %ecx | ||
180 | movl %eax, (%edi) | ||
181 | movl %edx, %esi | ||
182 | jz .L003maw_end | ||
183 | /* Tail Round 1 */ | ||
184 | movl 4(%ebx), %eax | ||
185 | mull %ebp | ||
186 | addl %esi, %eax | ||
187 | movl 4(%edi), %esi | ||
188 | adcl $0, %edx | ||
189 | addl %esi, %eax | ||
190 | adcl $0, %edx | ||
191 | decl %ecx | ||
192 | movl %eax, 4(%edi) | ||
193 | movl %edx, %esi | ||
194 | jz .L003maw_end | ||
195 | /* Tail Round 2 */ | ||
196 | movl 8(%ebx), %eax | ||
197 | mull %ebp | ||
198 | addl %esi, %eax | ||
199 | movl 8(%edi), %esi | ||
200 | adcl $0, %edx | ||
201 | addl %esi, %eax | ||
202 | adcl $0, %edx | ||
203 | decl %ecx | ||
204 | movl %eax, 8(%edi) | ||
205 | movl %edx, %esi | ||
206 | jz .L003maw_end | ||
207 | /* Tail Round 3 */ | ||
208 | movl 12(%ebx), %eax | ||
209 | mull %ebp | ||
210 | addl %esi, %eax | ||
211 | movl 12(%edi), %esi | ||
212 | adcl $0, %edx | ||
213 | addl %esi, %eax | ||
214 | adcl $0, %edx | ||
215 | decl %ecx | ||
216 | movl %eax, 12(%edi) | ||
217 | movl %edx, %esi | ||
218 | jz .L003maw_end | ||
219 | /* Tail Round 4 */ | ||
220 | movl 16(%ebx), %eax | ||
221 | mull %ebp | ||
222 | addl %esi, %eax | ||
223 | movl 16(%edi), %esi | ||
224 | adcl $0, %edx | ||
225 | addl %esi, %eax | ||
226 | adcl $0, %edx | ||
227 | decl %ecx | ||
228 | movl %eax, 16(%edi) | ||
229 | movl %edx, %esi | ||
230 | jz .L003maw_end | ||
231 | /* Tail Round 5 */ | ||
232 | movl 20(%ebx), %eax | ||
233 | mull %ebp | ||
234 | addl %esi, %eax | ||
235 | movl 20(%edi), %esi | ||
236 | adcl $0, %edx | ||
237 | addl %esi, %eax | ||
238 | adcl $0, %edx | ||
239 | decl %ecx | ||
240 | movl %eax, 20(%edi) | ||
241 | movl %edx, %esi | ||
242 | jz .L003maw_end | ||
243 | /* Tail Round 6 */ | ||
244 | movl 24(%ebx), %eax | ||
245 | mull %ebp | ||
246 | addl %esi, %eax | ||
247 | movl 24(%edi), %esi | ||
248 | adcl $0, %edx | ||
249 | addl %esi, %eax | ||
250 | adcl $0, %edx | ||
251 | movl %eax, 24(%edi) | ||
252 | movl %edx, %esi | ||
253 | .L003maw_end: | ||
254 | movl %esi, %eax | ||
255 | popl %ecx | ||
256 | popl %edi | ||
257 | popl %esi | ||
258 | popl %ebx | ||
259 | popl %ebp | ||
260 | ret | ||
261 | .bn_mul_add_words_end: | ||
262 | SIZE(bn_mul_add_words,.bn_mul_add_words_end-bn_mul_add_words) | ||
263 | .ident "bn_mul_add_words" | ||
264 | .text | ||
265 | .align ALIGN | ||
266 | .globl bn_mul_words | ||
267 | TYPE(bn_mul_words,@function) | ||
268 | bn_mul_words: | ||
269 | pushl %ebp | ||
270 | pushl %ebx | ||
271 | pushl %esi | ||
272 | pushl %edi | ||
273 | |||
274 | |||
275 | xorl %esi, %esi | ||
276 | movl 20(%esp), %edi | ||
277 | movl 24(%esp), %ebx | ||
278 | movl 28(%esp), %ebp | ||
279 | movl 32(%esp), %ecx | ||
280 | andl $4294967288, %ebp | ||
281 | jz .L004mw_finish | ||
282 | .L005mw_loop: | ||
283 | /* Round 0 */ | ||
284 | movl (%ebx), %eax | ||
285 | mull %ecx | ||
286 | addl %esi, %eax | ||
287 | adcl $0, %edx | ||
288 | movl %eax, (%edi) | ||
289 | movl %edx, %esi | ||
290 | /* Round 4 */ | ||
291 | movl 4(%ebx), %eax | ||
292 | mull %ecx | ||
293 | addl %esi, %eax | ||
294 | adcl $0, %edx | ||
295 | movl %eax, 4(%edi) | ||
296 | movl %edx, %esi | ||
297 | /* Round 8 */ | ||
298 | movl 8(%ebx), %eax | ||
299 | mull %ecx | ||
300 | addl %esi, %eax | ||
301 | adcl $0, %edx | ||
302 | movl %eax, 8(%edi) | ||
303 | movl %edx, %esi | ||
304 | /* Round 12 */ | ||
305 | movl 12(%ebx), %eax | ||
306 | mull %ecx | ||
307 | addl %esi, %eax | ||
308 | adcl $0, %edx | ||
309 | movl %eax, 12(%edi) | ||
310 | movl %edx, %esi | ||
311 | /* Round 16 */ | ||
312 | movl 16(%ebx), %eax | ||
313 | mull %ecx | ||
314 | addl %esi, %eax | ||
315 | adcl $0, %edx | ||
316 | movl %eax, 16(%edi) | ||
317 | movl %edx, %esi | ||
318 | /* Round 20 */ | ||
319 | movl 20(%ebx), %eax | ||
320 | mull %ecx | ||
321 | addl %esi, %eax | ||
322 | adcl $0, %edx | ||
323 | movl %eax, 20(%edi) | ||
324 | movl %edx, %esi | ||
325 | /* Round 24 */ | ||
326 | movl 24(%ebx), %eax | ||
327 | mull %ecx | ||
328 | addl %esi, %eax | ||
329 | adcl $0, %edx | ||
330 | movl %eax, 24(%edi) | ||
331 | movl %edx, %esi | ||
332 | /* Round 28 */ | ||
333 | movl 28(%ebx), %eax | ||
334 | mull %ecx | ||
335 | addl %esi, %eax | ||
336 | adcl $0, %edx | ||
337 | movl %eax, 28(%edi) | ||
338 | movl %edx, %esi | ||
339 | |||
340 | addl $32, %ebx | ||
341 | addl $32, %edi | ||
342 | subl $8, %ebp | ||
343 | jz .L004mw_finish | ||
344 | jmp .L005mw_loop | ||
345 | .L004mw_finish: | ||
346 | movl 28(%esp), %ebp | ||
347 | andl $7, %ebp | ||
348 | jnz .L006mw_finish2 | ||
349 | jmp .L007mw_end | ||
350 | .align ALIGN | ||
351 | .L006mw_finish2: | ||
352 | /* Tail Round 0 */ | ||
353 | movl (%ebx), %eax | ||
354 | mull %ecx | ||
355 | addl %esi, %eax | ||
356 | adcl $0, %edx | ||
357 | movl %eax, (%edi) | ||
358 | movl %edx, %esi | ||
359 | decl %ebp | ||
360 | jz .L007mw_end | ||
361 | /* Tail Round 1 */ | ||
362 | movl 4(%ebx), %eax | ||
363 | mull %ecx | ||
364 | addl %esi, %eax | ||
365 | adcl $0, %edx | ||
366 | movl %eax, 4(%edi) | ||
367 | movl %edx, %esi | ||
368 | decl %ebp | ||
369 | jz .L007mw_end | ||
370 | /* Tail Round 2 */ | ||
371 | movl 8(%ebx), %eax | ||
372 | mull %ecx | ||
373 | addl %esi, %eax | ||
374 | adcl $0, %edx | ||
375 | movl %eax, 8(%edi) | ||
376 | movl %edx, %esi | ||
377 | decl %ebp | ||
378 | jz .L007mw_end | ||
379 | /* Tail Round 3 */ | ||
380 | movl 12(%ebx), %eax | ||
381 | mull %ecx | ||
382 | addl %esi, %eax | ||
383 | adcl $0, %edx | ||
384 | movl %eax, 12(%edi) | ||
385 | movl %edx, %esi | ||
386 | decl %ebp | ||
387 | jz .L007mw_end | ||
388 | /* Tail Round 4 */ | ||
389 | movl 16(%ebx), %eax | ||
390 | mull %ecx | ||
391 | addl %esi, %eax | ||
392 | adcl $0, %edx | ||
393 | movl %eax, 16(%edi) | ||
394 | movl %edx, %esi | ||
395 | decl %ebp | ||
396 | jz .L007mw_end | ||
397 | /* Tail Round 5 */ | ||
398 | movl 20(%ebx), %eax | ||
399 | mull %ecx | ||
400 | addl %esi, %eax | ||
401 | adcl $0, %edx | ||
402 | movl %eax, 20(%edi) | ||
403 | movl %edx, %esi | ||
404 | decl %ebp | ||
405 | jz .L007mw_end | ||
406 | /* Tail Round 6 */ | ||
407 | movl 24(%ebx), %eax | ||
408 | mull %ecx | ||
409 | addl %esi, %eax | ||
410 | adcl $0, %edx | ||
411 | movl %eax, 24(%edi) | ||
412 | movl %edx, %esi | ||
413 | .L007mw_end: | ||
414 | movl %esi, %eax | ||
415 | popl %edi | ||
416 | popl %esi | ||
417 | popl %ebx | ||
418 | popl %ebp | ||
419 | ret | ||
420 | .bn_mul_words_end: | ||
421 | SIZE(bn_mul_words,.bn_mul_words_end-bn_mul_words) | ||
422 | .ident "bn_mul_words" | ||
423 | .text | ||
424 | .align ALIGN | ||
425 | .globl bn_sqr_words | ||
426 | TYPE(bn_sqr_words,@function) | ||
427 | bn_sqr_words: | ||
428 | pushl %ebp | ||
429 | pushl %ebx | ||
430 | pushl %esi | ||
431 | pushl %edi | ||
432 | |||
433 | |||
434 | movl 20(%esp), %esi | ||
435 | movl 24(%esp), %edi | ||
436 | movl 28(%esp), %ebx | ||
437 | andl $4294967288, %ebx | ||
438 | jz .L008sw_finish | ||
439 | .L009sw_loop: | ||
440 | /* Round 0 */ | ||
441 | movl (%edi), %eax | ||
442 | mull %eax | ||
443 | movl %eax, (%esi) | ||
444 | movl %edx, 4(%esi) | ||
445 | /* Round 4 */ | ||
446 | movl 4(%edi), %eax | ||
447 | mull %eax | ||
448 | movl %eax, 8(%esi) | ||
449 | movl %edx, 12(%esi) | ||
450 | /* Round 8 */ | ||
451 | movl 8(%edi), %eax | ||
452 | mull %eax | ||
453 | movl %eax, 16(%esi) | ||
454 | movl %edx, 20(%esi) | ||
455 | /* Round 12 */ | ||
456 | movl 12(%edi), %eax | ||
457 | mull %eax | ||
458 | movl %eax, 24(%esi) | ||
459 | movl %edx, 28(%esi) | ||
460 | /* Round 16 */ | ||
461 | movl 16(%edi), %eax | ||
462 | mull %eax | ||
463 | movl %eax, 32(%esi) | ||
464 | movl %edx, 36(%esi) | ||
465 | /* Round 20 */ | ||
466 | movl 20(%edi), %eax | ||
467 | mull %eax | ||
468 | movl %eax, 40(%esi) | ||
469 | movl %edx, 44(%esi) | ||
470 | /* Round 24 */ | ||
471 | movl 24(%edi), %eax | ||
472 | mull %eax | ||
473 | movl %eax, 48(%esi) | ||
474 | movl %edx, 52(%esi) | ||
475 | /* Round 28 */ | ||
476 | movl 28(%edi), %eax | ||
477 | mull %eax | ||
478 | movl %eax, 56(%esi) | ||
479 | movl %edx, 60(%esi) | ||
480 | |||
481 | addl $32, %edi | ||
482 | addl $64, %esi | ||
483 | subl $8, %ebx | ||
484 | jnz .L009sw_loop | ||
485 | .L008sw_finish: | ||
486 | movl 28(%esp), %ebx | ||
487 | andl $7, %ebx | ||
488 | jz .L010sw_end | ||
489 | /* Tail Round 0 */ | ||
490 | movl (%edi), %eax | ||
491 | mull %eax | ||
492 | movl %eax, (%esi) | ||
493 | decl %ebx | ||
494 | movl %edx, 4(%esi) | ||
495 | jz .L010sw_end | ||
496 | /* Tail Round 1 */ | ||
497 | movl 4(%edi), %eax | ||
498 | mull %eax | ||
499 | movl %eax, 8(%esi) | ||
500 | decl %ebx | ||
501 | movl %edx, 12(%esi) | ||
502 | jz .L010sw_end | ||
503 | /* Tail Round 2 */ | ||
504 | movl 8(%edi), %eax | ||
505 | mull %eax | ||
506 | movl %eax, 16(%esi) | ||
507 | decl %ebx | ||
508 | movl %edx, 20(%esi) | ||
509 | jz .L010sw_end | ||
510 | /* Tail Round 3 */ | ||
511 | movl 12(%edi), %eax | ||
512 | mull %eax | ||
513 | movl %eax, 24(%esi) | ||
514 | decl %ebx | ||
515 | movl %edx, 28(%esi) | ||
516 | jz .L010sw_end | ||
517 | /* Tail Round 4 */ | ||
518 | movl 16(%edi), %eax | ||
519 | mull %eax | ||
520 | movl %eax, 32(%esi) | ||
521 | decl %ebx | ||
522 | movl %edx, 36(%esi) | ||
523 | jz .L010sw_end | ||
524 | /* Tail Round 5 */ | ||
525 | movl 20(%edi), %eax | ||
526 | mull %eax | ||
527 | movl %eax, 40(%esi) | ||
528 | decl %ebx | ||
529 | movl %edx, 44(%esi) | ||
530 | jz .L010sw_end | ||
531 | /* Tail Round 6 */ | ||
532 | movl 24(%edi), %eax | ||
533 | mull %eax | ||
534 | movl %eax, 48(%esi) | ||
535 | movl %edx, 52(%esi) | ||
536 | .L010sw_end: | ||
537 | popl %edi | ||
538 | popl %esi | ||
539 | popl %ebx | ||
540 | popl %ebp | ||
541 | ret | ||
542 | .bn_sqr_words_end: | ||
543 | SIZE(bn_sqr_words,.bn_sqr_words_end-bn_sqr_words) | ||
544 | .ident "bn_sqr_words" | ||
545 | .text | ||
546 | .align ALIGN | ||
547 | .globl bn_div64 | ||
548 | TYPE(bn_div64,@function) | ||
549 | bn_div64: | ||
550 | pushl %ebp | ||
551 | pushl %ebx | ||
552 | pushl %esi | ||
553 | pushl %edi | ||
554 | |||
555 | movl 20(%esp), %edx | ||
556 | movl 24(%esp), %eax | ||
557 | movl 28(%esp), %ebx | ||
558 | divl %ebx | ||
559 | popl %edi | ||
560 | popl %esi | ||
561 | popl %ebx | ||
562 | popl %ebp | ||
563 | ret | ||
564 | .bn_div64_end: | ||
565 | SIZE(bn_div64,.bn_div64_end-bn_div64) | ||
566 | .ident "bn_div64" | ||
567 | .text | ||
568 | .align ALIGN | ||
569 | .globl bn_add_words | ||
570 | TYPE(bn_add_words,@function) | ||
571 | bn_add_words: | ||
572 | pushl %ebp | ||
573 | pushl %ebx | ||
574 | pushl %esi | ||
575 | pushl %edi | ||
576 | |||
577 | |||
578 | movl 20(%esp), %ebx | ||
579 | movl 24(%esp), %esi | ||
580 | movl 28(%esp), %edi | ||
581 | movl 32(%esp), %ebp | ||
582 | xorl %eax, %eax | ||
583 | andl $4294967288, %ebp | ||
584 | jz .L011aw_finish | ||
585 | .L012aw_loop: | ||
586 | /* Round 0 */ | ||
587 | movl (%esi), %ecx | ||
588 | movl (%edi), %edx | ||
589 | addl %eax, %ecx | ||
590 | movl $0, %eax | ||
591 | adcl %eax, %eax | ||
592 | addl %edx, %ecx | ||
593 | adcl $0, %eax | ||
594 | movl %ecx, (%ebx) | ||
595 | /* Round 1 */ | ||
596 | movl 4(%esi), %ecx | ||
597 | movl 4(%edi), %edx | ||
598 | addl %eax, %ecx | ||
599 | movl $0, %eax | ||
600 | adcl %eax, %eax | ||
601 | addl %edx, %ecx | ||
602 | adcl $0, %eax | ||
603 | movl %ecx, 4(%ebx) | ||
604 | /* Round 2 */ | ||
605 | movl 8(%esi), %ecx | ||
606 | movl 8(%edi), %edx | ||
607 | addl %eax, %ecx | ||
608 | movl $0, %eax | ||
609 | adcl %eax, %eax | ||
610 | addl %edx, %ecx | ||
611 | adcl $0, %eax | ||
612 | movl %ecx, 8(%ebx) | ||
613 | /* Round 3 */ | ||
614 | movl 12(%esi), %ecx | ||
615 | movl 12(%edi), %edx | ||
616 | addl %eax, %ecx | ||
617 | movl $0, %eax | ||
618 | adcl %eax, %eax | ||
619 | addl %edx, %ecx | ||
620 | adcl $0, %eax | ||
621 | movl %ecx, 12(%ebx) | ||
622 | /* Round 4 */ | ||
623 | movl 16(%esi), %ecx | ||
624 | movl 16(%edi), %edx | ||
625 | addl %eax, %ecx | ||
626 | movl $0, %eax | ||
627 | adcl %eax, %eax | ||
628 | addl %edx, %ecx | ||
629 | adcl $0, %eax | ||
630 | movl %ecx, 16(%ebx) | ||
631 | /* Round 5 */ | ||
632 | movl 20(%esi), %ecx | ||
633 | movl 20(%edi), %edx | ||
634 | addl %eax, %ecx | ||
635 | movl $0, %eax | ||
636 | adcl %eax, %eax | ||
637 | addl %edx, %ecx | ||
638 | adcl $0, %eax | ||
639 | movl %ecx, 20(%ebx) | ||
640 | /* Round 6 */ | ||
641 | movl 24(%esi), %ecx | ||
642 | movl 24(%edi), %edx | ||
643 | addl %eax, %ecx | ||
644 | movl $0, %eax | ||
645 | adcl %eax, %eax | ||
646 | addl %edx, %ecx | ||
647 | adcl $0, %eax | ||
648 | movl %ecx, 24(%ebx) | ||
649 | /* Round 7 */ | ||
650 | movl 28(%esi), %ecx | ||
651 | movl 28(%edi), %edx | ||
652 | addl %eax, %ecx | ||
653 | movl $0, %eax | ||
654 | adcl %eax, %eax | ||
655 | addl %edx, %ecx | ||
656 | adcl $0, %eax | ||
657 | movl %ecx, 28(%ebx) | ||
658 | |||
659 | addl $32, %esi | ||
660 | addl $32, %edi | ||
661 | addl $32, %ebx | ||
662 | subl $8, %ebp | ||
663 | jnz .L012aw_loop | ||
664 | .L011aw_finish: | ||
665 | movl 32(%esp), %ebp | ||
666 | andl $7, %ebp | ||
667 | jz .L013aw_end | ||
668 | /* Tail Round 0 */ | ||
669 | movl (%esi), %ecx | ||
670 | movl (%edi), %edx | ||
671 | addl %eax, %ecx | ||
672 | movl $0, %eax | ||
673 | adcl %eax, %eax | ||
674 | addl %edx, %ecx | ||
675 | adcl $0, %eax | ||
676 | decl %ebp | ||
677 | movl %ecx, (%ebx) | ||
678 | jz .L013aw_end | ||
679 | /* Tail Round 1 */ | ||
680 | movl 4(%esi), %ecx | ||
681 | movl 4(%edi), %edx | ||
682 | addl %eax, %ecx | ||
683 | movl $0, %eax | ||
684 | adcl %eax, %eax | ||
685 | addl %edx, %ecx | ||
686 | adcl $0, %eax | ||
687 | decl %ebp | ||
688 | movl %ecx, 4(%ebx) | ||
689 | jz .L013aw_end | ||
690 | /* Tail Round 2 */ | ||
691 | movl 8(%esi), %ecx | ||
692 | movl 8(%edi), %edx | ||
693 | addl %eax, %ecx | ||
694 | movl $0, %eax | ||
695 | adcl %eax, %eax | ||
696 | addl %edx, %ecx | ||
697 | adcl $0, %eax | ||
698 | decl %ebp | ||
699 | movl %ecx, 8(%ebx) | ||
700 | jz .L013aw_end | ||
701 | /* Tail Round 3 */ | ||
702 | movl 12(%esi), %ecx | ||
703 | movl 12(%edi), %edx | ||
704 | addl %eax, %ecx | ||
705 | movl $0, %eax | ||
706 | adcl %eax, %eax | ||
707 | addl %edx, %ecx | ||
708 | adcl $0, %eax | ||
709 | decl %ebp | ||
710 | movl %ecx, 12(%ebx) | ||
711 | jz .L013aw_end | ||
712 | /* Tail Round 4 */ | ||
713 | movl 16(%esi), %ecx | ||
714 | movl 16(%edi), %edx | ||
715 | addl %eax, %ecx | ||
716 | movl $0, %eax | ||
717 | adcl %eax, %eax | ||
718 | addl %edx, %ecx | ||
719 | adcl $0, %eax | ||
720 | decl %ebp | ||
721 | movl %ecx, 16(%ebx) | ||
722 | jz .L013aw_end | ||
723 | /* Tail Round 5 */ | ||
724 | movl 20(%esi), %ecx | ||
725 | movl 20(%edi), %edx | ||
726 | addl %eax, %ecx | ||
727 | movl $0, %eax | ||
728 | adcl %eax, %eax | ||
729 | addl %edx, %ecx | ||
730 | adcl $0, %eax | ||
731 | decl %ebp | ||
732 | movl %ecx, 20(%ebx) | ||
733 | jz .L013aw_end | ||
734 | /* Tail Round 6 */ | ||
735 | movl 24(%esi), %ecx | ||
736 | movl 24(%edi), %edx | ||
737 | addl %eax, %ecx | ||
738 | movl $0, %eax | ||
739 | adcl %eax, %eax | ||
740 | addl %edx, %ecx | ||
741 | adcl $0, %eax | ||
742 | movl %ecx, 24(%ebx) | ||
743 | .L013aw_end: | ||
744 | movl %eax, %eax | ||
745 | popl %edi | ||
746 | popl %esi | ||
747 | popl %ebx | ||
748 | popl %ebp | ||
749 | ret | ||
750 | .bn_add_words_end: | ||
751 | SIZE(bn_add_words,.bn_add_words_end-bn_add_words) | ||
752 | .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 @@ | |||
1 | .file "bn_mulw.c" | ||
2 | gcc2_compiled.: | ||
3 | .section ".text" | ||
4 | .align 4 | ||
5 | .global bn_mul_add_words | ||
6 | .type bn_mul_add_words,#function | ||
7 | .proc 016 | ||
8 | bn_mul_add_words: | ||
9 | !#PROLOGUE# 0 | ||
10 | save %sp,-112,%sp | ||
11 | !#PROLOGUE# 1 | ||
12 | mov %i0,%o0 | ||
13 | mov %i1,%o2 | ||
14 | mov %i2,%g1 | ||
15 | mov %i3,%o1 | ||
16 | mov 0,%i4 | ||
17 | add %o0,12,%g4 | ||
18 | add %o2,12,%o7 | ||
19 | .LL2: | ||
20 | mov %i4,%i3 | ||
21 | mov 0,%i2 | ||
22 | ld [%o0],%g2 | ||
23 | mov %g2,%i1 | ||
24 | ld [%o2],%g2 | ||
25 | mov 0,%i0 | ||
26 | umul %o1,%g2,%g3 | ||
27 | rd %y,%g2 | ||
28 | addcc %g3,%i1,%g3 | ||
29 | addx %g2,%i0,%g2 | ||
30 | addcc %g3,%i3,%g3 | ||
31 | addx %g2,%i2,%g2 | ||
32 | st %g3,[%o0] | ||
33 | mov %g2,%i5 | ||
34 | mov 0,%i4 | ||
35 | addcc %g1,-1,%g1 | ||
36 | be .LL3 | ||
37 | mov %i5,%i4 | ||
38 | mov %i4,%i3 | ||
39 | mov 0,%i2 | ||
40 | ld [%g4-8],%g2 | ||
41 | mov %g2,%i1 | ||
42 | ld [%o7-8],%g2 | ||
43 | mov 0,%i0 | ||
44 | umul %o1,%g2,%g3 | ||
45 | rd %y,%g2 | ||
46 | addcc %g3,%i1,%g3 | ||
47 | addx %g2,%i0,%g2 | ||
48 | addcc %g3,%i3,%g3 | ||
49 | addx %g2,%i2,%g2 | ||
50 | st %g3,[%g4-8] | ||
51 | mov %g2,%i5 | ||
52 | mov 0,%i4 | ||
53 | addcc %g1,-1,%g1 | ||
54 | be .LL3 | ||
55 | mov %i5,%i4 | ||
56 | mov %i4,%i3 | ||
57 | mov 0,%i2 | ||
58 | ld [%g4-4],%g2 | ||
59 | mov %g2,%i1 | ||
60 | ld [%o7-4],%g2 | ||
61 | mov 0,%i0 | ||
62 | umul %o1,%g2,%g3 | ||
63 | rd %y,%g2 | ||
64 | addcc %g3,%i1,%g3 | ||
65 | addx %g2,%i0,%g2 | ||
66 | addcc %g3,%i3,%g3 | ||
67 | addx %g2,%i2,%g2 | ||
68 | st %g3,[%g4-4] | ||
69 | mov %g2,%i5 | ||
70 | mov 0,%i4 | ||
71 | addcc %g1,-1,%g1 | ||
72 | be .LL3 | ||
73 | mov %i5,%i4 | ||
74 | mov %i4,%i3 | ||
75 | mov 0,%i2 | ||
76 | ld [%g4],%g2 | ||
77 | mov %g2,%i1 | ||
78 | ld [%o7],%g2 | ||
79 | mov 0,%i0 | ||
80 | umul %o1,%g2,%g3 | ||
81 | rd %y,%g2 | ||
82 | addcc %g3,%i1,%g3 | ||
83 | addx %g2,%i0,%g2 | ||
84 | addcc %g3,%i3,%g3 | ||
85 | addx %g2,%i2,%g2 | ||
86 | st %g3,[%g4] | ||
87 | mov %g2,%i5 | ||
88 | mov 0,%i4 | ||
89 | addcc %g1,-1,%g1 | ||
90 | be .LL3 | ||
91 | mov %i5,%i4 | ||
92 | add %o7,16,%o7 | ||
93 | add %o2,16,%o2 | ||
94 | add %g4,16,%g4 | ||
95 | b .LL2 | ||
96 | add %o0,16,%o0 | ||
97 | .LL3: | ||
98 | ret | ||
99 | restore %g0,%i4,%o0 | ||
100 | .LLfe1: | ||
101 | .size bn_mul_add_words,.LLfe1-bn_mul_add_words | ||
102 | .align 4 | ||
103 | .global bn_mul_words | ||
104 | .type bn_mul_words,#function | ||
105 | .proc 016 | ||
106 | bn_mul_words: | ||
107 | !#PROLOGUE# 0 | ||
108 | save %sp,-112,%sp | ||
109 | !#PROLOGUE# 1 | ||
110 | mov %i0,%o7 | ||
111 | mov %i1,%o0 | ||
112 | mov %i2,%i4 | ||
113 | mov %i3,%g4 | ||
114 | mov 0,%i0 | ||
115 | add %o7,12,%g1 | ||
116 | add %o0,12,%i5 | ||
117 | .LL18: | ||
118 | mov %i0,%g3 | ||
119 | mov 0,%g2 | ||
120 | ld [%o0],%i2 | ||
121 | umul %g4,%i2,%i3 | ||
122 | rd %y,%i2 | ||
123 | addcc %i3,%g3,%i3 | ||
124 | addx %i2,%g2,%i2 | ||
125 | st %i3,[%o7] | ||
126 | mov %i2,%i1 | ||
127 | mov 0,%i0 | ||
128 | addcc %i4,-1,%i4 | ||
129 | be .LL19 | ||
130 | mov %i1,%i0 | ||
131 | mov %i0,%g3 | ||
132 | mov 0,%g2 | ||
133 | ld [%i5-8],%i2 | ||
134 | umul %g4,%i2,%i3 | ||
135 | rd %y,%i2 | ||
136 | addcc %i3,%g3,%i3 | ||
137 | addx %i2,%g2,%i2 | ||
138 | st %i3,[%g1-8] | ||
139 | mov %i2,%i1 | ||
140 | mov 0,%i0 | ||
141 | addcc %i4,-1,%i4 | ||
142 | be .LL19 | ||
143 | mov %i1,%i0 | ||
144 | mov %i0,%g3 | ||
145 | mov 0,%g2 | ||
146 | ld [%i5-4],%i2 | ||
147 | umul %g4,%i2,%i3 | ||
148 | rd %y,%i2 | ||
149 | addcc %i3,%g3,%i3 | ||
150 | addx %i2,%g2,%i2 | ||
151 | st %i3,[%g1-4] | ||
152 | mov %i2,%i1 | ||
153 | mov 0,%i0 | ||
154 | addcc %i4,-1,%i4 | ||
155 | be .LL19 | ||
156 | mov %i1,%i0 | ||
157 | mov %i0,%g3 | ||
158 | mov 0,%g2 | ||
159 | ld [%i5],%i2 | ||
160 | umul %g4,%i2,%i3 | ||
161 | rd %y,%i2 | ||
162 | addcc %i3,%g3,%i3 | ||
163 | addx %i2,%g2,%i2 | ||
164 | st %i3,[%g1] | ||
165 | mov %i2,%i1 | ||
166 | mov 0,%i0 | ||
167 | addcc %i4,-1,%i4 | ||
168 | be .LL19 | ||
169 | mov %i1,%i0 | ||
170 | add %i5,16,%i5 | ||
171 | add %o0,16,%o0 | ||
172 | add %g1,16,%g1 | ||
173 | b .LL18 | ||
174 | add %o7,16,%o7 | ||
175 | .LL19: | ||
176 | ret | ||
177 | restore | ||
178 | .LLfe2: | ||
179 | .size bn_mul_words,.LLfe2-bn_mul_words | ||
180 | .align 4 | ||
181 | .global bn_sqr_words | ||
182 | .type bn_sqr_words,#function | ||
183 | .proc 020 | ||
184 | bn_sqr_words: | ||
185 | !#PROLOGUE# 0 | ||
186 | !#PROLOGUE# 1 | ||
187 | mov %o0,%g4 | ||
188 | add %g4,28,%o3 | ||
189 | add %o1,12,%g1 | ||
190 | .LL34: | ||
191 | ld [%o1],%o0 | ||
192 | addcc %o2,-1,%o2 | ||
193 | umul %o0,%o0,%o5 | ||
194 | rd %y,%o4 | ||
195 | st %o5,[%g4] | ||
196 | mov %o4,%g3 | ||
197 | mov 0,%g2 | ||
198 | be .LL35 | ||
199 | st %g3,[%o3-24] | ||
200 | ld [%g1-8],%o0 | ||
201 | addcc %o2,-1,%o2 | ||
202 | umul %o0,%o0,%o5 | ||
203 | rd %y,%o4 | ||
204 | st %o5,[%o3-20] | ||
205 | mov %o4,%g3 | ||
206 | mov 0,%g2 | ||
207 | be .LL35 | ||
208 | st %g3,[%o3-16] | ||
209 | ld [%g1-4],%o0 | ||
210 | addcc %o2,-1,%o2 | ||
211 | umul %o0,%o0,%o5 | ||
212 | rd %y,%o4 | ||
213 | st %o5,[%o3-12] | ||
214 | mov %o4,%g3 | ||
215 | mov 0,%g2 | ||
216 | be .LL35 | ||
217 | st %g3,[%o3-8] | ||
218 | ld [%g1],%o0 | ||
219 | addcc %o2,-1,%o2 | ||
220 | umul %o0,%o0,%o5 | ||
221 | rd %y,%o4 | ||
222 | st %o5,[%o3-4] | ||
223 | mov %o4,%g3 | ||
224 | mov 0,%g2 | ||
225 | be .LL35 | ||
226 | st %g3,[%o3] | ||
227 | add %g1,16,%g1 | ||
228 | add %o1,16,%o1 | ||
229 | add %o3,32,%o3 | ||
230 | b .LL34 | ||
231 | add %g4,32,%g4 | ||
232 | .LL35: | ||
233 | retl | ||
234 | nop | ||
235 | .LLfe3: | ||
236 | .size bn_sqr_words,.LLfe3-bn_sqr_words | ||
237 | .align 4 | ||
238 | .global bn_add_words | ||
239 | .type bn_add_words,#function | ||
240 | .proc 016 | ||
241 | bn_add_words: | ||
242 | !#PROLOGUE# 0 | ||
243 | save %sp,-112,%sp | ||
244 | !#PROLOGUE# 1 | ||
245 | mov %i0,%o2 | ||
246 | mov %i1,%o3 | ||
247 | mov %i2,%o4 | ||
248 | mov %i3,%i5 | ||
249 | mov 0,%o0 | ||
250 | mov 0,%o1 | ||
251 | add %o2,12,%o7 | ||
252 | add %o4,12,%g4 | ||
253 | b .LL42 | ||
254 | add %o3,12,%g1 | ||
255 | .LL45: | ||
256 | add %i5,-1,%i5 | ||
257 | mov %i4,%g3 | ||
258 | ld [%g4-8],%i4 | ||
259 | mov 0,%g2 | ||
260 | mov %i4,%i1 | ||
261 | mov 0,%i0 | ||
262 | addcc %g3,%i1,%g3 | ||
263 | addx %g2,%i0,%g2 | ||
264 | addcc %o1,%g3,%o1 | ||
265 | addx %o0,%g2,%o0 | ||
266 | st %o1,[%o7-8] | ||
267 | mov %o0,%i3 | ||
268 | mov 0,%i2 | ||
269 | mov %i2,%o0 | ||
270 | mov %i3,%o1 | ||
271 | cmp %i5,0 | ||
272 | ble .LL43 | ||
273 | add %i5,-1,%i5 | ||
274 | ld [%g1-4],%i4 | ||
275 | mov %i4,%g3 | ||
276 | ld [%g4-4],%i4 | ||
277 | mov 0,%g2 | ||
278 | mov %i4,%i1 | ||
279 | mov 0,%i0 | ||
280 | addcc %g3,%i1,%g3 | ||
281 | addx %g2,%i0,%g2 | ||
282 | addcc %o1,%g3,%o1 | ||
283 | addx %o0,%g2,%o0 | ||
284 | st %o1,[%o7-4] | ||
285 | mov %o0,%i3 | ||
286 | mov 0,%i2 | ||
287 | mov %i2,%o0 | ||
288 | mov %i3,%o1 | ||
289 | cmp %i5,0 | ||
290 | ble .LL43 | ||
291 | add %i5,-1,%i5 | ||
292 | ld [%g1],%i4 | ||
293 | mov %i4,%g3 | ||
294 | ld [%g4],%i4 | ||
295 | mov 0,%g2 | ||
296 | mov %i4,%i1 | ||
297 | mov 0,%i0 | ||
298 | addcc %g3,%i1,%g3 | ||
299 | addx %g2,%i0,%g2 | ||
300 | addcc %o1,%g3,%o1 | ||
301 | addx %o0,%g2,%o0 | ||
302 | st %o1,[%o7] | ||
303 | mov %o0,%i3 | ||
304 | mov 0,%i2 | ||
305 | mov %i2,%o0 | ||
306 | mov %i3,%o1 | ||
307 | cmp %i5,0 | ||
308 | ble .LL43 | ||
309 | add %g1,16,%g1 | ||
310 | add %o3,16,%o3 | ||
311 | add %g4,16,%g4 | ||
312 | add %o4,16,%o4 | ||
313 | add %o7,16,%o7 | ||
314 | add %o2,16,%o2 | ||
315 | .LL42: | ||
316 | ld [%o3],%i4 | ||
317 | add %i5,-1,%i5 | ||
318 | mov %i4,%g3 | ||
319 | ld [%o4],%i4 | ||
320 | mov 0,%g2 | ||
321 | mov %i4,%i1 | ||
322 | mov 0,%i0 | ||
323 | addcc %g3,%i1,%g3 | ||
324 | addx %g2,%i0,%g2 | ||
325 | addcc %o1,%g3,%o1 | ||
326 | addx %o0,%g2,%o0 | ||
327 | st %o1,[%o2] | ||
328 | mov %o0,%i3 | ||
329 | mov 0,%i2 | ||
330 | mov %i2,%o0 | ||
331 | mov %i3,%o1 | ||
332 | cmp %i5,0 | ||
333 | bg,a .LL45 | ||
334 | ld [%g1-8],%i4 | ||
335 | .LL43: | ||
336 | ret | ||
337 | restore %g0,%o1,%o0 | ||
338 | .LLfe4: | ||
339 | .size bn_add_words,.LLfe4-bn_add_words | ||
340 | .section ".rodata" | ||
341 | .align 8 | ||
342 | .LLC0: | ||
343 | .asciz "Division would overflow (%d)\n" | ||
344 | .section ".text" | ||
345 | .align 4 | ||
346 | .global bn_div64 | ||
347 | .type bn_div64,#function | ||
348 | .proc 016 | ||
349 | bn_div64: | ||
350 | !#PROLOGUE# 0 | ||
351 | save %sp,-112,%sp | ||
352 | !#PROLOGUE# 1 | ||
353 | mov 0,%l1 | ||
354 | cmp %i2,0 | ||
355 | bne .LL51 | ||
356 | mov 2,%l0 | ||
357 | b .LL68 | ||
358 | mov -1,%i0 | ||
359 | .LL51: | ||
360 | call BN_num_bits_word,0 | ||
361 | mov %i2,%o0 | ||
362 | mov %o0,%o2 | ||
363 | cmp %o2,32 | ||
364 | be .LL52 | ||
365 | mov 1,%o0 | ||
366 | sll %o0,%o2,%o0 | ||
367 | cmp %i0,%o0 | ||
368 | bleu .LL69 | ||
369 | mov 32,%o0 | ||
370 | sethi %hi(__iob+32),%o0 | ||
371 | or %o0,%lo(__iob+32),%o0 | ||
372 | sethi %hi(.LLC0),%o1 | ||
373 | call fprintf,0 | ||
374 | or %o1,%lo(.LLC0),%o1 | ||
375 | call abort,0 | ||
376 | nop | ||
377 | .LL52: | ||
378 | mov 32,%o0 | ||
379 | .LL69: | ||
380 | cmp %i0,%i2 | ||
381 | blu .LL53 | ||
382 | sub %o0,%o2,%o2 | ||
383 | sub %i0,%i2,%i0 | ||
384 | .LL53: | ||
385 | cmp %o2,0 | ||
386 | be .LL54 | ||
387 | sll %i0,%o2,%o1 | ||
388 | sll %i2,%o2,%i2 | ||
389 | sub %o0,%o2,%o0 | ||
390 | srl %i1,%o0,%o0 | ||
391 | or %o1,%o0,%i0 | ||
392 | sll %i1,%o2,%i1 | ||
393 | .LL54: | ||
394 | srl %i2,16,%g2 | ||
395 | sethi %hi(65535),%o0 | ||
396 | or %o0,%lo(65535),%o1 | ||
397 | and %i2,%o1,%g3 | ||
398 | mov %o0,%g4 | ||
399 | sethi %hi(-65536),%o7 | ||
400 | mov %o1,%g1 | ||
401 | .LL55: | ||
402 | srl %i0,16,%o0 | ||
403 | cmp %o0,%g2 | ||
404 | be .LL59 | ||
405 | or %g4,%lo(65535),%o3 | ||
406 | wr %g0,%g0,%y | ||
407 | nop | ||
408 | nop | ||
409 | nop | ||
410 | udiv %i0,%g2,%o3 | ||
411 | .LL59: | ||
412 | and %i1,%o7,%o0 | ||
413 | srl %o0,16,%o5 | ||
414 | smul %o3,%g3,%o4 | ||
415 | smul %o3,%g2,%o2 | ||
416 | .LL60: | ||
417 | sub %i0,%o2,%o1 | ||
418 | andcc %o1,%o7,%g0 | ||
419 | bne .LL61 | ||
420 | sll %o1,16,%o0 | ||
421 | add %o0,%o5,%o0 | ||
422 | cmp %o4,%o0 | ||
423 | bleu .LL61 | ||
424 | sub %o4,%g3,%o4 | ||
425 | sub %o2,%g2,%o2 | ||
426 | b .LL60 | ||
427 | add %o3,-1,%o3 | ||
428 | .LL61: | ||
429 | smul %o3,%g2,%o2 | ||
430 | smul %o3,%g3,%o0 | ||
431 | srl %o0,16,%o1 | ||
432 | sll %o0,16,%o0 | ||
433 | and %o0,%o7,%o0 | ||
434 | cmp %i1,%o0 | ||
435 | bgeu .LL65 | ||
436 | add %o2,%o1,%o2 | ||
437 | add %o2,1,%o2 | ||
438 | .LL65: | ||
439 | cmp %i0,%o2 | ||
440 | bgeu .LL66 | ||
441 | sub %i1,%o0,%i1 | ||
442 | add %i0,%i2,%i0 | ||
443 | add %o3,-1,%o3 | ||
444 | .LL66: | ||
445 | addcc %l0,-1,%l0 | ||
446 | be .LL56 | ||
447 | sub %i0,%o2,%i0 | ||
448 | sll %o3,16,%l1 | ||
449 | sll %i0,16,%o0 | ||
450 | srl %i1,16,%o1 | ||
451 | or %o0,%o1,%i0 | ||
452 | and %i1,%g1,%o0 | ||
453 | b .LL55 | ||
454 | sll %o0,16,%i1 | ||
455 | .LL56: | ||
456 | or %l1,%o3,%i0 | ||
457 | .LL68: | ||
458 | ret | ||
459 | restore | ||
460 | .LLfe5: | ||
461 | .size bn_div64,.LLfe5-bn_div64 | ||
462 | .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 @@ | |||
1 | ; Static Name Aliases | ||
2 | ; | ||
3 | TITLE bn_mulw.c | ||
4 | .8087 | ||
5 | F_TEXT SEGMENT WORD PUBLIC 'CODE' | ||
6 | F_TEXT ENDS | ||
7 | _DATA SEGMENT WORD PUBLIC 'DATA' | ||
8 | _DATA ENDS | ||
9 | CONST SEGMENT WORD PUBLIC 'CONST' | ||
10 | CONST ENDS | ||
11 | _BSS SEGMENT WORD PUBLIC 'BSS' | ||
12 | _BSS ENDS | ||
13 | DGROUP GROUP CONST, _BSS, _DATA | ||
14 | ASSUME DS: DGROUP, SS: DGROUP | ||
15 | F_TEXT SEGMENT | ||
16 | ASSUME CS: F_TEXT | ||
17 | PUBLIC _bn_mul_add_words | ||
18 | _bn_mul_add_words PROC FAR | ||
19 | ; Line 58 | ||
20 | push bp | ||
21 | push bx | ||
22 | push si | ||
23 | push di | ||
24 | push ds | ||
25 | push es | ||
26 | mov bp,sp | ||
27 | ; w = 26 | ||
28 | ; num = 24 | ||
29 | ; ap = 20 | ||
30 | ; rp = 16 | ||
31 | xor si,si ;c=0; | ||
32 | mov di,WORD PTR [bp+16] ; load r | ||
33 | mov ds,WORD PTR [bp+18] ; load r | ||
34 | mov bx,WORD PTR [bp+20] ; load a | ||
35 | mov es,WORD PTR [bp+22] ; load a | ||
36 | mov cx,WORD PTR [bp+26] ; load w | ||
37 | mov bp,WORD PTR [bp+24] ; load num | ||
38 | |||
39 | shr bp,1 ; div count by 4 and do groups of 4 | ||
40 | shr bp,1 | ||
41 | je $L555 | ||
42 | |||
43 | $L546: | ||
44 | mov ax,cx | ||
45 | mul WORD PTR es:[bx] ; w* *a | ||
46 | add ax,WORD PTR ds:[di] ; + *r | ||
47 | adc dx,0 | ||
48 | adc ax,si | ||
49 | adc dx,0 | ||
50 | mov WORD PTR ds:[di],ax | ||
51 | mov si,dx | ||
52 | ; | ||
53 | mov ax,cx | ||
54 | mul WORD PTR es:[bx+2] ; w* *a | ||
55 | add ax,WORD PTR ds:[di+2] ; + *r | ||
56 | adc dx,0 | ||
57 | adc ax,si | ||
58 | adc dx,0 | ||
59 | mov WORD PTR ds:[di+2],ax | ||
60 | mov si,dx | ||
61 | ; | ||
62 | mov ax,cx | ||
63 | mul WORD PTR es:[bx+4] ; w* *a | ||
64 | add ax,WORD PTR ds:[di+4] ; + *r | ||
65 | adc dx,0 | ||
66 | adc ax,si | ||
67 | adc dx,0 | ||
68 | mov WORD PTR ds:[di+4],ax | ||
69 | mov si,dx | ||
70 | ; | ||
71 | mov ax,cx | ||
72 | mul WORD PTR es:[bx+6] ; w* *a | ||
73 | add ax,WORD PTR ds:[di+6] ; + *r | ||
74 | adc dx,0 | ||
75 | adc ax,si | ||
76 | adc dx,0 | ||
77 | mov WORD PTR ds:[di+6],ax | ||
78 | mov si,dx | ||
79 | ; | ||
80 | add bx,8 | ||
81 | add di,8 | ||
82 | ; | ||
83 | dec bp | ||
84 | je $L555 | ||
85 | jmp $L546 | ||
86 | ; | ||
87 | ; | ||
88 | $L555: | ||
89 | mov bp,sp | ||
90 | mov bp,WORD PTR [bp+24] ; load num | ||
91 | and bp,3 | ||
92 | dec bp | ||
93 | js $L547 | ||
94 | |||
95 | mov ax,cx | ||
96 | mul WORD PTR es:[bx] ; w* *a | ||
97 | add ax,WORD PTR ds:[di] ; + *r | ||
98 | adc dx,0 | ||
99 | adc ax,si | ||
100 | adc dx,0 | ||
101 | mov WORD PTR ds:[di],ax | ||
102 | mov si,dx | ||
103 | dec bp | ||
104 | js $L547 ; Note that we are now testing for -1 | ||
105 | ; | ||
106 | mov ax,cx | ||
107 | mul WORD PTR es:[bx+2] ; w* *a | ||
108 | add ax,WORD PTR ds:[di+2] ; + *r | ||
109 | adc dx,0 | ||
110 | adc ax,si | ||
111 | adc dx,0 | ||
112 | mov WORD PTR ds:[di+2],ax | ||
113 | mov si,dx | ||
114 | dec bp | ||
115 | js $L547 | ||
116 | ; | ||
117 | mov ax,cx | ||
118 | mul WORD PTR es:[bx+4] ; w* *a | ||
119 | add ax,WORD PTR ds:[di+4] ; + *r | ||
120 | adc dx,0 | ||
121 | adc ax,si | ||
122 | adc dx,0 | ||
123 | mov WORD PTR ds:[di+4],ax | ||
124 | mov si,dx | ||
125 | $L547: | ||
126 | mov ax,si | ||
127 | pop es | ||
128 | pop ds | ||
129 | pop di | ||
130 | pop si | ||
131 | pop bx | ||
132 | pop bp | ||
133 | ret | ||
134 | nop | ||
135 | |||
136 | _bn_mul_add_words ENDP | ||
137 | PUBLIC _bn_mul_words | ||
138 | _bn_mul_words PROC FAR | ||
139 | ; Line 76 | ||
140 | push bp | ||
141 | push bx | ||
142 | push si | ||
143 | push di | ||
144 | push ds | ||
145 | push es | ||
146 | xor si,si | ||
147 | mov bp,sp | ||
148 | mov di,WORD PTR [bp+16] ; r | ||
149 | mov ds,WORD PTR [bp+18] | ||
150 | mov bx,WORD PTR [bp+20] ; a | ||
151 | mov es,WORD PTR [bp+22] | ||
152 | mov cx,WORD PTR [bp+26] ; w | ||
153 | mov bp,WORD PTR [bp+24] ; num | ||
154 | $FC743: | ||
155 | mov ax,cx | ||
156 | mul WORD PTR es:[bx] | ||
157 | add ax,si | ||
158 | adc dx,0 | ||
159 | mov WORD PTR ds:[di],ax | ||
160 | mov si,dx | ||
161 | dec bp | ||
162 | je $L764 | ||
163 | ; | ||
164 | mov ax,cx | ||
165 | mul WORD PTR es:[bx+2] | ||
166 | add ax,si | ||
167 | adc dx,0 | ||
168 | mov WORD PTR ds:[di+2],ax | ||
169 | mov si,dx | ||
170 | dec bp | ||
171 | je $L764 | ||
172 | ; | ||
173 | mov ax,cx | ||
174 | mul WORD PTR es:[bx+4] | ||
175 | add ax,si | ||
176 | adc dx,0 | ||
177 | mov WORD PTR ds:[di+4],ax | ||
178 | mov si,dx | ||
179 | dec bp | ||
180 | je $L764 | ||
181 | ; | ||
182 | mov ax,cx | ||
183 | mul WORD PTR es:[bx+6] | ||
184 | add ax,si | ||
185 | adc dx,0 | ||
186 | mov WORD PTR ds:[di+6],ax | ||
187 | mov si,dx | ||
188 | dec bp | ||
189 | je $L764 | ||
190 | ; | ||
191 | add bx,8 | ||
192 | add di,8 | ||
193 | jmp $FC743 | ||
194 | nop | ||
195 | $L764: | ||
196 | mov ax,si | ||
197 | pop es | ||
198 | pop ds | ||
199 | pop di | ||
200 | pop si | ||
201 | pop bx | ||
202 | pop bp | ||
203 | ret | ||
204 | nop | ||
205 | _bn_mul_words ENDP | ||
206 | PUBLIC _bn_sqr_words | ||
207 | _bn_sqr_words PROC FAR | ||
208 | ; Line 92 | ||
209 | push bp | ||
210 | push bx | ||
211 | push si | ||
212 | push di | ||
213 | push ds | ||
214 | push es | ||
215 | mov bp,sp | ||
216 | mov si,WORD PTR [bp+16] | ||
217 | mov ds,WORD PTR [bp+18] | ||
218 | mov di,WORD PTR [bp+20] | ||
219 | mov es,WORD PTR [bp+22] | ||
220 | mov bx,WORD PTR [bp+24] | ||
221 | |||
222 | mov bp,bx ; save a memory lookup later | ||
223 | shr bx,1 ; div count by 4 and do groups of 4 | ||
224 | shr bx,1 | ||
225 | je $L666 | ||
226 | |||
227 | $L765: | ||
228 | mov ax,WORD PTR es:[di] | ||
229 | mul ax | ||
230 | mov WORD PTR ds:[si],ax | ||
231 | mov WORD PTR ds:[si+2],dx | ||
232 | ; | ||
233 | mov ax,WORD PTR es:[di+2] | ||
234 | mul ax | ||
235 | mov WORD PTR ds:[si+4],ax | ||
236 | mov WORD PTR ds:[si+6],dx | ||
237 | ; | ||
238 | mov ax,WORD PTR es:[di+4] | ||
239 | mul ax | ||
240 | mov WORD PTR ds:[si+8],ax | ||
241 | mov WORD PTR ds:[si+10],dx | ||
242 | ; | ||
243 | mov ax,WORD PTR es:[di+6] | ||
244 | mul ax | ||
245 | mov WORD PTR ds:[si+12],ax | ||
246 | mov WORD PTR ds:[si+14],dx | ||
247 | ; | ||
248 | add di,8 | ||
249 | add si,16 | ||
250 | dec bx | ||
251 | je $L666 | ||
252 | jmp $L765 | ||
253 | $L666: | ||
254 | and bp,3 | ||
255 | dec bp ; The copied value of bx (num) | ||
256 | js $L645 | ||
257 | ; | ||
258 | mov ax,WORD PTR es:[di] | ||
259 | mul ax | ||
260 | mov WORD PTR ds:[si],ax | ||
261 | mov WORD PTR ds:[si+2],dx | ||
262 | dec bp | ||
263 | js $L645 | ||
264 | ; | ||
265 | mov ax,WORD PTR es:[di+2] | ||
266 | mul ax | ||
267 | mov WORD PTR ds:[si+4],ax | ||
268 | mov WORD PTR ds:[si+6],dx | ||
269 | dec bp | ||
270 | js $L645 | ||
271 | ; | ||
272 | mov ax,WORD PTR es:[di+4] | ||
273 | mul ax | ||
274 | mov WORD PTR ds:[si+8],ax | ||
275 | mov WORD PTR ds:[si+10],dx | ||
276 | $L645: | ||
277 | pop es | ||
278 | pop ds | ||
279 | pop di | ||
280 | pop si | ||
281 | pop bx | ||
282 | pop bp | ||
283 | ret | ||
284 | |||
285 | _bn_sqr_words ENDP | ||
286 | PUBLIC _bn_div64 | ||
287 | _bn_div64 PROC FAR | ||
288 | push bp | ||
289 | mov bp,sp | ||
290 | mov dx, WORD PTR [bp+6] | ||
291 | mov ax, WORD PTR [bp+8] | ||
292 | div WORD PTR [bp+10] | ||
293 | pop bp | ||
294 | ret | ||
295 | _bn_div64 ENDP | ||
296 | F_TEXT ENDS | ||
297 | 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 @@ | |||
1 | ; Static Name Aliases | ||
2 | ; | ||
3 | TITLE bn_mulw.c | ||
4 | .386 | ||
5 | F_TEXT SEGMENT WORD USE16 PUBLIC 'CODE' | ||
6 | F_TEXT ENDS | ||
7 | _DATA SEGMENT WORD USE16 PUBLIC 'DATA' | ||
8 | _DATA ENDS | ||
9 | CONST SEGMENT WORD USE16 PUBLIC 'CONST' | ||
10 | CONST ENDS | ||
11 | _BSS SEGMENT WORD USE16 PUBLIC 'BSS' | ||
12 | _BSS ENDS | ||
13 | DGROUP GROUP CONST, _BSS, _DATA | ||
14 | ASSUME DS: DGROUP, SS: DGROUP | ||
15 | F_TEXT SEGMENT | ||
16 | ASSUME CS: F_TEXT | ||
17 | PUBLIC _bn_mul_add_words | ||
18 | _bn_mul_add_words PROC FAR | ||
19 | ; Line 58 | ||
20 | push bp | ||
21 | push bx | ||
22 | push esi | ||
23 | push di | ||
24 | push ds | ||
25 | push es | ||
26 | mov bp,sp | ||
27 | ; w = 28 | ||
28 | ; num = 26 | ||
29 | ; ap = 22 | ||
30 | ; rp = 18 | ||
31 | xor esi,esi ;c=0; | ||
32 | mov di,WORD PTR [bp+18] ; load r | ||
33 | mov ds,WORD PTR [bp+20] ; load r | ||
34 | mov bx,WORD PTR [bp+22] ; load a | ||
35 | mov es,WORD PTR [bp+24] ; load a | ||
36 | mov ecx,DWORD PTR [bp+28] ; load w | ||
37 | mov bp,WORD PTR [bp+26] ; load num | ||
38 | shr bp,1 ; div count by 4 and do groups of 4 | ||
39 | shr bp,1 | ||
40 | je $L555 | ||
41 | |||
42 | $L546: | ||
43 | mov eax,ecx | ||
44 | mul DWORD PTR es:[bx] ; w* *a | ||
45 | add eax,DWORD PTR ds:[di] ; + *r | ||
46 | adc edx,0 | ||
47 | adc eax,esi | ||
48 | adc edx,0 | ||
49 | mov DWORD PTR ds:[di],eax | ||
50 | mov esi,edx | ||
51 | ; | ||
52 | mov eax,ecx | ||
53 | mul DWORD PTR es:[bx+4] ; w* *a | ||
54 | add eax,DWORD PTR ds:[di+4] ; + *r | ||
55 | adc edx,0 | ||
56 | adc eax,esi | ||
57 | adc edx,0 | ||
58 | mov DWORD PTR ds:[di+4],eax | ||
59 | mov esi,edx | ||
60 | ; | ||
61 | mov eax,ecx | ||
62 | mul DWORD PTR es:[bx+8] ; w* *a | ||
63 | add eax,DWORD PTR ds:[di+8] ; + *r | ||
64 | adc edx,0 | ||
65 | adc eax,esi | ||
66 | adc edx,0 | ||
67 | mov DWORD PTR ds:[di+8],eax | ||
68 | mov esi,edx | ||
69 | ; | ||
70 | mov eax,ecx | ||
71 | mul DWORD PTR es:[bx+12] ; w* *a | ||
72 | add eax,DWORD PTR ds:[di+12] ; + *r | ||
73 | adc edx,0 | ||
74 | adc eax,esi | ||
75 | adc edx,0 | ||
76 | mov DWORD PTR ds:[di+12],eax | ||
77 | mov esi,edx | ||
78 | ; | ||
79 | add bx,16 | ||
80 | add di,16 | ||
81 | ; | ||
82 | dec bp | ||
83 | je $L555 | ||
84 | jmp $L546 | ||
85 | ; | ||
86 | ; | ||
87 | $L555: | ||
88 | mov bp,sp | ||
89 | mov bp,WORD PTR [bp+26] ; load num | ||
90 | and bp,3 | ||
91 | dec bp | ||
92 | js $L547 | ||
93 | |||
94 | mov eax,ecx | ||
95 | mul DWORD PTR es:[bx] ; w* *a | ||
96 | add eax,DWORD PTR ds:[di] ; + *r | ||
97 | adc edx,0 | ||
98 | adc eax,esi | ||
99 | adc edx,0 | ||
100 | mov DWORD PTR ds:[di],eax | ||
101 | mov esi,edx | ||
102 | dec bp | ||
103 | js $L547 ; Note that we are now testing for -1 | ||
104 | ; | ||
105 | mov eax,ecx | ||
106 | mul DWORD PTR es:[bx+4] ; w* *a | ||
107 | add eax,DWORD PTR ds:[di+4] ; + *r | ||
108 | adc edx,0 | ||
109 | adc eax,esi | ||
110 | adc edx,0 | ||
111 | mov DWORD PTR ds:[di+4],eax | ||
112 | mov esi,edx | ||
113 | dec bp | ||
114 | js $L547 | ||
115 | ; | ||
116 | mov eax,ecx | ||
117 | mul DWORD PTR es:[bx+8] ; w* *a | ||
118 | add eax,DWORD PTR ds:[di+8] ; + *r | ||
119 | adc edx,0 | ||
120 | adc eax,esi | ||
121 | adc edx,0 | ||
122 | mov DWORD PTR ds:[di+8],eax | ||
123 | mov esi,edx | ||
124 | $L547: | ||
125 | mov eax,esi | ||
126 | mov edx,esi | ||
127 | shr edx,16 | ||
128 | pop es | ||
129 | pop ds | ||
130 | pop di | ||
131 | pop esi | ||
132 | pop bx | ||
133 | pop bp | ||
134 | ret | ||
135 | nop | ||
136 | _bn_mul_add_words ENDP | ||
137 | |||
138 | PUBLIC _bn_mul_words | ||
139 | _bn_mul_words PROC FAR | ||
140 | ; Line 76 | ||
141 | push bp | ||
142 | push bx | ||
143 | push esi | ||
144 | push di | ||
145 | push ds | ||
146 | push es | ||
147 | xor esi,esi | ||
148 | mov bp,sp | ||
149 | mov di,WORD PTR [bp+18] ; r | ||
150 | mov ds,WORD PTR [bp+20] | ||
151 | mov bx,WORD PTR [bp+22] ; a | ||
152 | mov es,WORD PTR [bp+24] | ||
153 | mov ecx,DWORD PTR [bp+28] ; w | ||
154 | mov bp,WORD PTR [bp+26] ; num | ||
155 | |||
156 | $FC743: | ||
157 | mov eax,ecx | ||
158 | mul DWORD PTR es:[bx] | ||
159 | add eax,esi | ||
160 | adc edx,0 | ||
161 | mov DWORD PTR ds:[di],eax | ||
162 | mov esi,edx | ||
163 | dec bp | ||
164 | je $L764 | ||
165 | ; | ||
166 | mov eax,ecx | ||
167 | mul DWORD PTR es:[bx+4] | ||
168 | add eax,esi | ||
169 | adc edx,0 | ||
170 | mov DWORD PTR ds:[di+4],eax | ||
171 | mov esi,edx | ||
172 | dec bp | ||
173 | je $L764 | ||
174 | ; | ||
175 | mov eax,ecx | ||
176 | mul DWORD PTR es:[bx+8] | ||
177 | add eax,esi | ||
178 | adc edx,0 | ||
179 | mov DWORD PTR ds:[di+8],eax | ||
180 | mov esi,edx | ||
181 | dec bp | ||
182 | je $L764 | ||
183 | ; | ||
184 | mov eax,ecx | ||
185 | mul DWORD PTR es:[bx+12] | ||
186 | add eax,esi | ||
187 | adc edx,0 | ||
188 | mov DWORD PTR ds:[di+12],eax | ||
189 | mov esi,edx | ||
190 | dec bp | ||
191 | je $L764 | ||
192 | ; | ||
193 | add bx,16 | ||
194 | add di,16 | ||
195 | jmp $FC743 | ||
196 | nop | ||
197 | $L764: | ||
198 | mov eax,esi | ||
199 | mov edx,esi | ||
200 | shr edx,16 | ||
201 | pop es | ||
202 | pop ds | ||
203 | pop di | ||
204 | pop esi | ||
205 | pop bx | ||
206 | pop bp | ||
207 | ret | ||
208 | nop | ||
209 | _bn_mul_words ENDP | ||
210 | PUBLIC _bn_sqr_words | ||
211 | _bn_sqr_words PROC FAR | ||
212 | ; Line 92 | ||
213 | push bp | ||
214 | push bx | ||
215 | push si | ||
216 | push di | ||
217 | push ds | ||
218 | push es | ||
219 | mov bp,sp | ||
220 | mov si,WORD PTR [bp+16] | ||
221 | mov ds,WORD PTR [bp+18] | ||
222 | mov di,WORD PTR [bp+20] | ||
223 | mov es,WORD PTR [bp+22] | ||
224 | mov bx,WORD PTR [bp+24] | ||
225 | |||
226 | mov bp,bx ; save a memory lookup later | ||
227 | shr bx,1 ; div count by 4 and do groups of 4 | ||
228 | shr bx,1 | ||
229 | je $L666 | ||
230 | |||
231 | $L765: | ||
232 | mov eax,DWORD PTR es:[di] | ||
233 | mul eax | ||
234 | mov DWORD PTR ds:[si],eax | ||
235 | mov DWORD PTR ds:[si+4],edx | ||
236 | ; | ||
237 | mov eax,DWORD PTR es:[di+4] | ||
238 | mul eax | ||
239 | mov DWORD PTR ds:[si+8],eax | ||
240 | mov DWORD PTR ds:[si+12],edx | ||
241 | ; | ||
242 | mov eax,DWORD PTR es:[di+8] | ||
243 | mul eax | ||
244 | mov DWORD PTR ds:[si+16],eax | ||
245 | mov DWORD PTR ds:[si+20],edx | ||
246 | ; | ||
247 | mov eax,DWORD PTR es:[di+12] | ||
248 | mul eax | ||
249 | mov DWORD PTR ds:[si+24],eax | ||
250 | mov DWORD PTR ds:[si+28],edx | ||
251 | ; | ||
252 | add di,16 | ||
253 | add si,32 | ||
254 | dec bx | ||
255 | je $L666 | ||
256 | jmp $L765 | ||
257 | $L666: | ||
258 | and bp,3 | ||
259 | dec bp ; The copied value of bx (num) | ||
260 | js $L645 | ||
261 | ; | ||
262 | mov eax,DWORD PTR es:[di] | ||
263 | mul eax | ||
264 | mov DWORD PTR ds:[si],eax | ||
265 | mov DWORD PTR ds:[si+4],edx | ||
266 | dec bp | ||
267 | js $L645 | ||
268 | ; | ||
269 | mov eax,DWORD PTR es:[di+4] | ||
270 | mul eax | ||
271 | mov DWORD PTR ds:[si+8],eax | ||
272 | mov DWORD PTR ds:[si+12],edx | ||
273 | dec bp | ||
274 | js $L645 | ||
275 | ; | ||
276 | mov eax,DWORD PTR es:[di+8] | ||
277 | mul eax | ||
278 | mov DWORD PTR ds:[si+16],eax | ||
279 | mov DWORD PTR ds:[si+20],edx | ||
280 | $L645: | ||
281 | pop es | ||
282 | pop ds | ||
283 | pop di | ||
284 | pop si | ||
285 | pop bx | ||
286 | pop bp | ||
287 | ret | ||
288 | _bn_sqr_words ENDP | ||
289 | |||
290 | PUBLIC _bn_div64 | ||
291 | _bn_div64 PROC FAR | ||
292 | push bp | ||
293 | mov bp,sp | ||
294 | mov edx, DWORD PTR [bp+6] | ||
295 | mov eax, DWORD PTR [bp+10] | ||
296 | div DWORD PTR [bp+14] | ||
297 | mov edx,eax | ||
298 | shr edx,16 | ||
299 | pop bp | ||
300 | ret | ||
301 | _bn_div64 ENDP | ||
302 | |||
303 | PUBLIC _bn_add_words | ||
304 | _bn_add_words PROC FAR | ||
305 | ; Line 58 | ||
306 | push bp | ||
307 | push bx | ||
308 | push esi | ||
309 | push di | ||
310 | push ds | ||
311 | push es | ||
312 | mov bp,sp | ||
313 | ; w = 28 | ||
314 | ; num = 26 | ||
315 | ; ap = 22 | ||
316 | ; rp = 18 | ||
317 | xor esi,esi ;c=0; | ||
318 | mov si,WORD PTR [bp+22] ; load a | ||
319 | mov es,WORD PTR [bp+24] ; load a | ||
320 | mov di,WORD PTR [bp+26] ; load b | ||
321 | mov ds,WORD PTR [bp+28] ; load b | ||
322 | |||
323 | mov dx,WORD PTR [bp+30] ; load num | ||
324 | dec dx | ||
325 | js $L547 | ||
326 | xor ecx,ecx | ||
327 | |||
328 | $L5477: | ||
329 | xor ebx,ebx | ||
330 | mov eax,DWORD PTR es:[si] ; *a | ||
331 | add eax,ecx | ||
332 | adc ebx,0 | ||
333 | add si,4 ; a++ | ||
334 | add eax,DWORD PTR ds:[di] ; + *b | ||
335 | mov ecx,ebx | ||
336 | adc ecx,0 | ||
337 | add di,4 | ||
338 | mov bx,WORD PTR [bp+18] | ||
339 | mov ds,WORD PTR [bp+20] | ||
340 | mov DWORD PTR ds:[bx],eax | ||
341 | add bx,4 | ||
342 | mov ds,WORD PTR [bp+28] | ||
343 | mov WORD PTR [bp+18],bx | ||
344 | dec dx | ||
345 | js $L547 ; Note that we are now testing for -1 | ||
346 | jmp $L5477 | ||
347 | ; | ||
348 | $L547: | ||
349 | mov eax,ecx | ||
350 | mov edx,ecx | ||
351 | shr edx,16 | ||
352 | pop es | ||
353 | pop ds | ||
354 | pop di | ||
355 | pop esi | ||
356 | pop bx | ||
357 | pop bp | ||
358 | ret | ||
359 | nop | ||
360 | _bn_add_words ENDP | ||
361 | F_TEXT ENDS | ||
362 | 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 @@ | |||
1 | /* Error codes for the BN functions. */ | ||
2 | |||
3 | /* Function codes. */ | ||
4 | #define BN_F_BN_BLINDING_CONVERT 100 | ||
5 | #define BN_F_BN_BLINDING_INVERT 101 | ||
6 | #define BN_F_BN_BLINDING_NEW 102 | ||
7 | #define BN_F_BN_BLINDING_UPDATE 103 | ||
8 | #define BN_F_BN_BN2DEC 104 | ||
9 | #define BN_F_BN_BN2HEX 105 | ||
10 | #define BN_F_BN_CTX_NEW 106 | ||
11 | #define BN_F_BN_DIV 107 | ||
12 | #define BN_F_BN_EXPAND2 108 | ||
13 | #define BN_F_BN_MOD_EXP_MONT 109 | ||
14 | #define BN_F_BN_MOD_INVERSE 110 | ||
15 | #define BN_F_BN_MOD_MUL_RECIPROCAL 111 | ||
16 | #define BN_F_BN_MPI2BN 112 | ||
17 | #define BN_F_BN_NEW 113 | ||
18 | #define BN_F_BN_RAND 114 | ||
19 | |||
20 | /* Reason codes. */ | ||
21 | #define BN_R_BAD_RECIPROCAL 100 | ||
22 | #define BN_R_CALLED_WITH_EVEN_MODULUS 101 | ||
23 | #define BN_R_DIV_BY_ZERO 102 | ||
24 | #define BN_R_ENCODING_ERROR 103 | ||
25 | #define BN_R_INVALID_LENGTH 104 | ||
26 | #define BN_R_NOT_INITALISED 105 | ||
27 | #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 @@ | |||
1 | /* crypto/bn/bn.org */ | ||
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
60 | * | ||
61 | * Always modify bn.org since bn.h is automatically generated from | ||
62 | * it during SSLeay configuration. | ||
63 | * | ||
64 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
65 | */ | ||
66 | |||
67 | #ifndef HEADER_BN_H | ||
68 | #define HEADER_BN_H | ||
69 | |||
70 | #ifdef __cplusplus | ||
71 | extern "C" { | ||
72 | #endif | ||
73 | |||
74 | #undef BN_LLONG | ||
75 | |||
76 | #ifdef WIN32 | ||
77 | #define BN_LLONG /* This comment stops Configure mutilating things */ | ||
78 | #endif | ||
79 | |||
80 | #define RECP_MUL_MOD | ||
81 | #define MONT_MUL_MOD | ||
82 | |||
83 | /* This next option uses the C libraries (2 word)/(1 word) function. | ||
84 | * If it is not defined, I use my C version (which is slower). | ||
85 | * The reason for this flag is that when the particular C compiler | ||
86 | * library routine is used, and the library is linked with a different | ||
87 | * compiler, the library is missing. This mostly happens when the | ||
88 | * library is built with gcc and then linked using nornal cc. This would | ||
89 | * be a common occurance because gcc normally produces code that is | ||
90 | * 2 times faster than system compilers for the big number stuff. | ||
91 | * For machines with only one compiler (or shared libraries), this should | ||
92 | * be on. Again this in only really a problem on machines | ||
93 | * using "long long's", are 32bit, and are not using my assember code. */ | ||
94 | #if defined(MSDOS) || defined(WINDOWS) || defined(linux) | ||
95 | #define BN_DIV2W | ||
96 | #endif | ||
97 | |||
98 | /* Only one for the following should be defined */ | ||
99 | /* The prime number generation stuff may not work when | ||
100 | * EIGHT_BIT but I don't care since I've only used this mode | ||
101 | * for debuging the bignum libraries */ | ||
102 | #undef SIXTY_FOUR_BIT_LONG | ||
103 | #undef SIXTY_FOUR_BIT | ||
104 | #define THIRTY_TWO_BIT | ||
105 | #undef SIXTEEN_BIT | ||
106 | #undef EIGHT_BIT | ||
107 | |||
108 | /* assuming long is 64bit - this is the DEC Alpha | ||
109 | * unsigned long long is only 64 bits :-(, don't define | ||
110 | * BN_LLONG for the DEC Alpha */ | ||
111 | #ifdef SIXTY_FOUR_BIT_LONG | ||
112 | #define BN_ULLONG unsigned long long | ||
113 | #define BN_ULONG unsigned long | ||
114 | #define BN_LONG long | ||
115 | #define BN_BITS 128 | ||
116 | #define BN_BYTES 8 | ||
117 | #define BN_BITS2 64 | ||
118 | #define BN_BITS4 32 | ||
119 | #define BN_MASK2 (0xffffffffffffffffL) | ||
120 | #define BN_MASK2l (0xffffffffL) | ||
121 | #define BN_MASK2h (0xffffffff00000000L) | ||
122 | #define BN_MASK2h1 (0xffffffff80000000L) | ||
123 | #define BN_TBIT (0x8000000000000000L) | ||
124 | #define BN_DEC_CONV (10000000000000000000L) | ||
125 | #define BN_DEC_FMT1 "%lu" | ||
126 | #define BN_DEC_FMT2 "%019lu" | ||
127 | #define BN_DEC_NUM 19 | ||
128 | #endif | ||
129 | |||
130 | #ifdef SIXTY_FOUR_BIT | ||
131 | #undef BN_LLONG | ||
132 | /* #define BN_ULLONG unsigned long long */ | ||
133 | #define BN_ULONG unsigned long long | ||
134 | #define BN_LONG long long | ||
135 | #define BN_BITS 128 | ||
136 | #define BN_BYTES 8 | ||
137 | #define BN_BITS2 64 | ||
138 | #define BN_BITS4 32 | ||
139 | #define BN_MASK2 (0xffffffffffffffffLL) | ||
140 | #define BN_MASK2l (0xffffffffL) | ||
141 | #define BN_MASK2h (0xffffffff00000000LL) | ||
142 | #define BN_MASK2h1 (0xffffffff80000000LL) | ||
143 | #define BN_TBIT (0x8000000000000000LL) | ||
144 | #define BN_DEC_CONV (10000000000000000000L) | ||
145 | #define BN_DEC_FMT1 "%lu" | ||
146 | #define BN_DEC_FMT2 "%019lu" | ||
147 | #define BN_DEC_NUM 19 | ||
148 | #endif | ||
149 | |||
150 | #ifdef THIRTY_TWO_BIT | ||
151 | #ifdef WIN32 | ||
152 | #define BN_ULLONG unsigned _int64 | ||
153 | #else | ||
154 | #define BN_ULLONG unsigned long long | ||
155 | #endif | ||
156 | #define BN_ULONG unsigned long | ||
157 | #define BN_LONG long | ||
158 | #define BN_BITS 64 | ||
159 | #define BN_BYTES 4 | ||
160 | #define BN_BITS2 32 | ||
161 | #define BN_BITS4 16 | ||
162 | #define BN_MASK2 (0xffffffffL) | ||
163 | #define BN_MASK2l (0xffff) | ||
164 | #define BN_MASK2h1 (0xffff8000L) | ||
165 | #define BN_MASK2h (0xffff0000L) | ||
166 | #define BN_TBIT (0x80000000L) | ||
167 | #define BN_DEC_CONV (1000000000L) | ||
168 | #define BN_DEC_FMT1 "%lu" | ||
169 | #define BN_DEC_FMT2 "%09lu" | ||
170 | #define BN_DEC_NUM 9 | ||
171 | #endif | ||
172 | |||
173 | #ifdef SIXTEEN_BIT | ||
174 | #ifndef BN_DIV2W | ||
175 | #define BN_DIV2W | ||
176 | #endif | ||
177 | #define BN_ULLONG unsigned long | ||
178 | #define BN_ULONG unsigned short | ||
179 | #define BN_LONG short | ||
180 | #define BN_BITS 32 | ||
181 | #define BN_BYTES 2 | ||
182 | #define BN_BITS2 16 | ||
183 | #define BN_BITS4 8 | ||
184 | #define BN_MASK2 (0xffff) | ||
185 | #define BN_MASK2l (0xff) | ||
186 | #define BN_MASK2h1 (0xff80) | ||
187 | #define BN_MASK2h (0xff00) | ||
188 | #define BN_TBIT (0x8000) | ||
189 | #define BN_DEC_CONV (100000) | ||
190 | #define BN_DEC_FMT1 "%u" | ||
191 | #define BN_DEC_FMT2 "%05u" | ||
192 | #define BN_DEC_NUM 5 | ||
193 | #endif | ||
194 | |||
195 | #ifdef EIGHT_BIT | ||
196 | #ifndef BN_DIV2W | ||
197 | #define BN_DIV2W | ||
198 | #endif | ||
199 | #define BN_ULLONG unsigned short | ||
200 | #define BN_ULONG unsigned char | ||
201 | #define BN_LONG char | ||
202 | #define BN_BITS 16 | ||
203 | #define BN_BYTES 1 | ||
204 | #define BN_BITS2 8 | ||
205 | #define BN_BITS4 4 | ||
206 | #define BN_MASK2 (0xff) | ||
207 | #define BN_MASK2l (0xf) | ||
208 | #define BN_MASK2h1 (0xf8) | ||
209 | #define BN_MASK2h (0xf0) | ||
210 | #define BN_TBIT (0x80) | ||
211 | #define BN_DEC_CONV (100) | ||
212 | #define BN_DEC_FMT1 "%u" | ||
213 | #define BN_DEC_FMT2 "%02u" | ||
214 | #define BN_DEC_NUM 2 | ||
215 | #endif | ||
216 | |||
217 | #define BN_DEFAULT_BITS 1280 | ||
218 | |||
219 | #ifdef BIGNUM | ||
220 | #undef BIGNUM | ||
221 | #endif | ||
222 | |||
223 | typedef struct bignum_st | ||
224 | { | ||
225 | BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ | ||
226 | int top; /* Index of last used d +1. */ | ||
227 | /* The next are internal book keeping for bn_expand. */ | ||
228 | int max; /* Size of the d array. */ | ||
229 | int neg; /* one if the number is negative */ | ||
230 | } BIGNUM; | ||
231 | |||
232 | /* Used for temp variables */ | ||
233 | #define BN_CTX_NUM 12 | ||
234 | typedef struct bignum_ctx | ||
235 | { | ||
236 | int tos; | ||
237 | BIGNUM *bn[BN_CTX_NUM+1]; | ||
238 | } BN_CTX; | ||
239 | |||
240 | typedef struct bn_blinding_st | ||
241 | { | ||
242 | int init; | ||
243 | BIGNUM *A; | ||
244 | BIGNUM *Ai; | ||
245 | BIGNUM *mod; /* just a reference */ | ||
246 | } BN_BLINDING; | ||
247 | |||
248 | /* Used for montgomery multiplication */ | ||
249 | typedef struct bn_mont_ctx_st | ||
250 | { | ||
251 | int ri; /* number of bits in R */ | ||
252 | BIGNUM *RR; /* used to convert to montgomery form */ | ||
253 | BIGNUM *N; /* The modulus */ | ||
254 | BIGNUM *Ni; /* The inverse of N */ | ||
255 | BN_ULONG n0; /* word form of inverse, normally only one of | ||
256 | * Ni or n0 is defined */ | ||
257 | } BN_MONT_CTX; | ||
258 | |||
259 | #define BN_to_montgomery(r,a,mont,ctx) BN_mod_mul_montgomery(\ | ||
260 | r,a,(mont)->RR,(mont),ctx) | ||
261 | |||
262 | #define BN_prime_checks (5) | ||
263 | |||
264 | #define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) | ||
265 | #define BN_is_word(a,w) (((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) | ||
266 | #define BN_is_zero(a) (((a)->top <= 1) && ((a)->d[0] == (BN_ULONG)0)) | ||
267 | #define BN_is_one(a) (BN_is_word((a),1)) | ||
268 | #define BN_is_odd(a) ((a)->d[0] & 1) | ||
269 | #define BN_one(a) (BN_set_word((a),1)) | ||
270 | #define BN_zero(a) (BN_set_word((a),0)) | ||
271 | |||
272 | #define BN_ascii2bn(a) BN_hex2bn(a) | ||
273 | #define BN_bn2ascii(a) BN_bn2hex(a) | ||
274 | |||
275 | #define bn_fix_top(a) \ | ||
276 | { \ | ||
277 | BN_ULONG *fix_top_l; \ | ||
278 | for (fix_top_l= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \ | ||
279 | if (*(fix_top_l--)) break; \ | ||
280 | } | ||
281 | |||
282 | #define bn_expand(n,b) ((((b)/BN_BITS2) <= (n)->max)?\ | ||
283 | (n):bn_expand2((n),(b)/BN_BITS2)) | ||
284 | #define bn_wexpand(n,b) (((b) <= (n)->max)?(n):bn_expand2((n),(b))) | ||
285 | |||
286 | |||
287 | #ifndef NOPROTO | ||
288 | BIGNUM *BN_value_one(void); | ||
289 | char * BN_options(void); | ||
290 | BN_CTX *BN_CTX_new(void); | ||
291 | void BN_CTX_free(BN_CTX *c); | ||
292 | int BN_rand(BIGNUM *rnd, int bits, int top,int bottom); | ||
293 | int BN_num_bits(BIGNUM *a); | ||
294 | int BN_num_bits_word(BN_ULONG); | ||
295 | BIGNUM *BN_new(void); | ||
296 | void BN_clear_free(BIGNUM *a); | ||
297 | BIGNUM *BN_copy(BIGNUM *a, BIGNUM *b); | ||
298 | BIGNUM *BN_bin2bn(unsigned char *s,int len,BIGNUM *ret); | ||
299 | int BN_bn2bin(BIGNUM *a, unsigned char *to); | ||
300 | BIGNUM *BN_mpi2bn(unsigned char *s,int len,BIGNUM *ret); | ||
301 | int BN_bn2mpi(BIGNUM *a, unsigned char *to); | ||
302 | int BN_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b); | ||
303 | void bn_qsub(BIGNUM *r, BIGNUM *a, BIGNUM *b); | ||
304 | void bn_qadd(BIGNUM *r, BIGNUM *a, BIGNUM *b); | ||
305 | int BN_add(BIGNUM *r, BIGNUM *a, BIGNUM *b); | ||
306 | int BN_mod(BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx); | ||
307 | int BN_div(BIGNUM *dv, BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx); | ||
308 | int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b); | ||
309 | int BN_sqr(BIGNUM *r, BIGNUM *a,BN_CTX *ctx); | ||
310 | BN_ULONG BN_mod_word(BIGNUM *a, unsigned long w); | ||
311 | BN_ULONG BN_div_word(BIGNUM *a, unsigned long w); | ||
312 | int BN_mul_word(BIGNUM *a, unsigned long w); | ||
313 | int BN_add_word(BIGNUM *a, unsigned long w); | ||
314 | int BN_sub_word(BIGNUM *a, unsigned long w); | ||
315 | int BN_set_word(BIGNUM *a, unsigned long w); | ||
316 | unsigned long BN_get_word(BIGNUM *a); | ||
317 | int BN_cmp(BIGNUM *a, BIGNUM *b); | ||
318 | void BN_free(BIGNUM *a); | ||
319 | int BN_is_bit_set(BIGNUM *a, int n); | ||
320 | int BN_lshift(BIGNUM *r, BIGNUM *a, int n); | ||
321 | int BN_lshift1(BIGNUM *r, BIGNUM *a); | ||
322 | int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p,BN_CTX *ctx); | ||
323 | int BN_mod_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,BN_CTX *ctx); | ||
324 | int BN_mod_exp_mont(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,BN_CTX *ctx, | ||
325 | BN_MONT_CTX *m_ctx); | ||
326 | int BN_mod_exp_recp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,BN_CTX *ctx); | ||
327 | int BN_mod_exp_simple(BIGNUM *r, BIGNUM *a, BIGNUM *p, | ||
328 | BIGNUM *m,BN_CTX *ctx); | ||
329 | int BN_mask_bits(BIGNUM *a,int n); | ||
330 | int BN_mod_mul_reciprocal(BIGNUM *r, BIGNUM *x, BIGNUM *y, BIGNUM *m, | ||
331 | BIGNUM *i, int nb, BN_CTX *ctx); | ||
332 | int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, BIGNUM *m, | ||
333 | BN_CTX *ctx); | ||
334 | #ifndef WIN16 | ||
335 | int BN_print_fp(FILE *fp, BIGNUM *a); | ||
336 | #endif | ||
337 | #ifdef HEADER_BIO_H | ||
338 | int BN_print(BIO *fp, BIGNUM *a); | ||
339 | #else | ||
340 | int BN_print(char *fp, BIGNUM *a); | ||
341 | #endif | ||
342 | int BN_reciprocal(BIGNUM *r, BIGNUM *m, BN_CTX *ctx); | ||
343 | int BN_rshift(BIGNUM *r, BIGNUM *a, int n); | ||
344 | int BN_rshift1(BIGNUM *r, BIGNUM *a); | ||
345 | void BN_clear(BIGNUM *a); | ||
346 | BIGNUM *bn_expand2(BIGNUM *b, int bits); | ||
347 | BIGNUM *BN_dup(BIGNUM *a); | ||
348 | int BN_ucmp(BIGNUM *a, BIGNUM *b); | ||
349 | int BN_set_bit(BIGNUM *a, int n); | ||
350 | int BN_clear_bit(BIGNUM *a, int n); | ||
351 | char * BN_bn2hex(BIGNUM *a); | ||
352 | char * BN_bn2dec(BIGNUM *a); | ||
353 | int BN_hex2bn(BIGNUM **a,char *str); | ||
354 | int BN_dec2bn(BIGNUM **a,char *str); | ||
355 | int BN_gcd(BIGNUM *r,BIGNUM *in_a,BIGNUM *in_b,BN_CTX *ctx); | ||
356 | BIGNUM *BN_mod_inverse(BIGNUM *a, BIGNUM *n,BN_CTX *ctx); | ||
357 | BIGNUM *BN_generate_prime(int bits,int strong,BIGNUM *add, | ||
358 | BIGNUM *rem,void (*callback)(int,int,char *),char *cb_arg); | ||
359 | int BN_is_prime(BIGNUM *p,int nchecks,void (*callback)(int,int,char *), | ||
360 | BN_CTX *ctx,char *cb_arg); | ||
361 | void ERR_load_BN_strings(void ); | ||
362 | |||
363 | BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w); | ||
364 | BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w); | ||
365 | void bn_sqr_words(BN_ULONG *rp, BN_ULONG *ap, int num); | ||
366 | BN_ULONG bn_div64(BN_ULONG h, BN_ULONG l, BN_ULONG d); | ||
367 | BN_ULONG bn_add_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int num); | ||
368 | |||
369 | BN_MONT_CTX *BN_MONT_CTX_new(void ); | ||
370 | int BN_mod_mul_montgomery(BIGNUM *r,BIGNUM *a,BIGNUM *b,BN_MONT_CTX *mont, | ||
371 | BN_CTX *ctx); | ||
372 | int BN_from_montgomery(BIGNUM *r,BIGNUM *a,BN_MONT_CTX *mont,BN_CTX *ctx); | ||
373 | void BN_MONT_CTX_free(BN_MONT_CTX *mont); | ||
374 | int BN_MONT_CTX_set(BN_MONT_CTX *mont,BIGNUM *modulus,BN_CTX *ctx); | ||
375 | |||
376 | BN_BLINDING *BN_BLINDING_new(BIGNUM *A,BIGNUM *Ai,BIGNUM *mod); | ||
377 | void BN_BLINDING_free(BN_BLINDING *b); | ||
378 | int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx); | ||
379 | int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *r, BN_CTX *ctx); | ||
380 | int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); | ||
381 | |||
382 | #else | ||
383 | |||
384 | BIGNUM *BN_value_one(); | ||
385 | char * BN_options(); | ||
386 | BN_CTX *BN_CTX_new(); | ||
387 | void BN_CTX_free(); | ||
388 | int BN_rand(); | ||
389 | int BN_num_bits(); | ||
390 | int BN_num_bits_word(); | ||
391 | BIGNUM *BN_new(); | ||
392 | void BN_clear_free(); | ||
393 | BIGNUM *BN_copy(); | ||
394 | BIGNUM *BN_bin2bn(); | ||
395 | int BN_bn2bin(); | ||
396 | BIGNUM *BN_mpi2bn(); | ||
397 | int BN_bn2mpi(); | ||
398 | int BN_sub(); | ||
399 | void bn_qsub(); | ||
400 | void bn_qadd(); | ||
401 | int BN_add(); | ||
402 | int BN_mod(); | ||
403 | int BN_div(); | ||
404 | int BN_mul(); | ||
405 | int BN_sqr(); | ||
406 | BN_ULONG BN_mod_word(); | ||
407 | BN_ULONG BN_div_word(); | ||
408 | int BN_add_word(); | ||
409 | int BN_sub_word(); | ||
410 | int BN_mul_word(); | ||
411 | int BN_set_word(); | ||
412 | unsigned long BN_get_word(); | ||
413 | int BN_cmp(); | ||
414 | void BN_free(); | ||
415 | int BN_is_bit_set(); | ||
416 | int BN_lshift(); | ||
417 | int BN_lshift1(); | ||
418 | int BN_exp(); | ||
419 | int BN_mod_exp(); | ||
420 | int BN_mod_exp_mont(); | ||
421 | int BN_mod_exp_recp(); | ||
422 | int BN_mod_exp_simple(); | ||
423 | int BN_mask_bits(); | ||
424 | int BN_mod_mul_reciprocal(); | ||
425 | int BN_mod_mul(); | ||
426 | #ifndef WIN16 | ||
427 | int BN_print_fp(); | ||
428 | #endif | ||
429 | int BN_print(); | ||
430 | int BN_reciprocal(); | ||
431 | int BN_rshift(); | ||
432 | int BN_rshift1(); | ||
433 | void BN_clear(); | ||
434 | BIGNUM *bn_expand2(); | ||
435 | BIGNUM *BN_dup(); | ||
436 | int BN_ucmp(); | ||
437 | int BN_set_bit(); | ||
438 | int BN_clear_bit(); | ||
439 | char * BN_bn2hex(); | ||
440 | char * BN_bn2dec(); | ||
441 | int BN_hex2bn(); | ||
442 | int BN_dec2bn(); | ||
443 | int BN_gcd(); | ||
444 | BIGNUM *BN_mod_inverse(); | ||
445 | BIGNUM *BN_generate_prime(); | ||
446 | int BN_is_prime(); | ||
447 | void ERR_load_BN_strings(); | ||
448 | |||
449 | BN_ULONG bn_mul_add_words(); | ||
450 | BN_ULONG bn_mul_words(); | ||
451 | void bn_sqr_words(); | ||
452 | BN_ULONG bn_div64(); | ||
453 | BN_ULONG bn_add_words(); | ||
454 | |||
455 | int BN_mod_mul_montgomery(); | ||
456 | int BN_from_montgomery(); | ||
457 | BN_MONT_CTX *BN_MONT_CTX_new(); | ||
458 | void BN_MONT_CTX_free(); | ||
459 | int BN_MONT_CTX_set(); | ||
460 | |||
461 | BN_BLINDING *BN_BLINDING_new(); | ||
462 | void BN_BLINDING_free(); | ||
463 | int BN_BLINDING_update(); | ||
464 | int BN_BLINDING_convert(); | ||
465 | int BN_BLINDING_invert(); | ||
466 | |||
467 | #endif | ||
468 | |||
469 | /* BEGIN ERROR CODES */ | ||
470 | /* Error codes for the BN functions. */ | ||
471 | |||
472 | /* Function codes. */ | ||
473 | #define BN_F_BN_BLINDING_CONVERT 100 | ||
474 | #define BN_F_BN_BLINDING_INVERT 101 | ||
475 | #define BN_F_BN_BLINDING_NEW 102 | ||
476 | #define BN_F_BN_BLINDING_UPDATE 103 | ||
477 | #define BN_F_BN_BN2DEC 104 | ||
478 | #define BN_F_BN_BN2HEX 105 | ||
479 | #define BN_F_BN_CTX_NEW 106 | ||
480 | #define BN_F_BN_DIV 107 | ||
481 | #define BN_F_BN_EXPAND2 108 | ||
482 | #define BN_F_BN_MOD_EXP_MONT 109 | ||
483 | #define BN_F_BN_MOD_INVERSE 110 | ||
484 | #define BN_F_BN_MOD_MUL_RECIPROCAL 111 | ||
485 | #define BN_F_BN_MPI2BN 112 | ||
486 | #define BN_F_BN_NEW 113 | ||
487 | #define BN_F_BN_RAND 114 | ||
488 | |||
489 | /* Reason codes. */ | ||
490 | #define BN_R_BAD_RECIPROCAL 100 | ||
491 | #define BN_R_CALLED_WITH_EVEN_MODULUS 101 | ||
492 | #define BN_R_DIV_BY_ZERO 102 | ||
493 | #define BN_R_ENCODING_ERROR 103 | ||
494 | #define BN_R_INVALID_LENGTH 104 | ||
495 | #define BN_R_NOT_INITALISED 105 | ||
496 | #define BN_R_NO_INVERSE 106 | ||
497 | |||
498 | #ifdef __cplusplus | ||
499 | } | ||
500 | #endif | ||
501 | #endif | ||
502 | |||
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 @@ | |||
1 | /* crypto/bn/bn_m.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "bn_lcl.h" | ||
62 | #include "stack.h" | ||
63 | |||
64 | int limit=16; | ||
65 | |||
66 | typedef struct bn_pool_st | ||
67 | { | ||
68 | int used; | ||
69 | int tos; | ||
70 | STACK *sk; | ||
71 | } BN_POOL; | ||
72 | |||
73 | BIGNUM *BN_POOL_push(bp) | ||
74 | BN_POOL *bp; | ||
75 | { | ||
76 | BIGNUM *ret; | ||
77 | |||
78 | if (bp->used >= bp->tos) | ||
79 | { | ||
80 | ret=BN_new(); | ||
81 | sk_push(bp->sk,(char *)ret); | ||
82 | bp->tos++; | ||
83 | bp->used++; | ||
84 | } | ||
85 | else | ||
86 | { | ||
87 | ret=(BIGNUM *)sk_value(bp->sk,bp->used); | ||
88 | bp->used++; | ||
89 | } | ||
90 | return(ret); | ||
91 | } | ||
92 | |||
93 | void BN_POOL_pop(bp,num) | ||
94 | BN_POOL *bp; | ||
95 | int num; | ||
96 | { | ||
97 | bp->used-=num; | ||
98 | } | ||
99 | |||
100 | int BN_m(r,a,b) | ||
101 | BIGNUM *r,*a,*b; | ||
102 | { | ||
103 | static BN_POOL bp; | ||
104 | static init=1; | ||
105 | |||
106 | if (init) | ||
107 | { | ||
108 | bp.used=0; | ||
109 | bp.tos=0; | ||
110 | bp.sk=sk_new_null(); | ||
111 | init=0; | ||
112 | } | ||
113 | return(BN_mm(r,a,b,&bp)); | ||
114 | } | ||
115 | |||
116 | /* r must be different to a and b */ | ||
117 | int BN_mm(m, A, B, bp) | ||
118 | BIGNUM *m,*A,*B; | ||
119 | BN_POOL *bp; | ||
120 | { | ||
121 | int i,num; | ||
122 | int an,bn; | ||
123 | BIGNUM *a,*b,*c,*d,*ac,*bd; | ||
124 | |||
125 | an=A->top; | ||
126 | bn=B->top; | ||
127 | if ((an <= limit) || (bn <= limit)) | ||
128 | { | ||
129 | return(BN_mul(m,A,B)); | ||
130 | } | ||
131 | |||
132 | a=BN_POOL_push(bp); | ||
133 | b=BN_POOL_push(bp); | ||
134 | c=BN_POOL_push(bp); | ||
135 | d=BN_POOL_push(bp); | ||
136 | ac=BN_POOL_push(bp); | ||
137 | bd=BN_POOL_push(bp); | ||
138 | |||
139 | num=(an <= bn)?an:bn; | ||
140 | num=1<<(BN_num_bits_word(num-1)-1); | ||
141 | |||
142 | /* Are going to now chop things into 'num' word chunks. */ | ||
143 | num*=BN_BITS2; | ||
144 | |||
145 | BN_copy(a,A); | ||
146 | BN_mask_bits(a,num); | ||
147 | BN_rshift(b,A,num); | ||
148 | |||
149 | BN_copy(c,B); | ||
150 | BN_mask_bits(c,num); | ||
151 | BN_rshift(d,B,num); | ||
152 | |||
153 | BN_sub(ac ,b,a); | ||
154 | BN_sub(bd,c,d); | ||
155 | BN_mm(m,ac,bd,bp); | ||
156 | BN_mm(ac,a,c,bp); | ||
157 | BN_mm(bd,b,d,bp); | ||
158 | |||
159 | BN_add(m,m,ac); | ||
160 | BN_add(m,m,bd); | ||
161 | BN_lshift(m,m,num); | ||
162 | BN_lshift(bd,bd,num*2); | ||
163 | |||
164 | BN_add(m,m,ac); | ||
165 | BN_add(m,m,bd); | ||
166 | BN_POOL_pop(bp,6); | ||
167 | return(1); | ||
168 | } | ||
169 | |||
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 @@ | |||
1 | /* crypto/bn/bn_mulw.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "bn_lcl.h" | ||
62 | |||
63 | #ifdef BN_LLONG | ||
64 | |||
65 | BN_ULONG bn_mul_add_words(rp,ap,num,w) | ||
66 | BN_ULONG *rp,*ap; | ||
67 | int num; | ||
68 | BN_ULONG w; | ||
69 | { | ||
70 | BN_ULONG c1=0; | ||
71 | |||
72 | for (;;) | ||
73 | { | ||
74 | mul_add(rp[0],ap[0],w,c1); | ||
75 | if (--num == 0) break; | ||
76 | mul_add(rp[1],ap[1],w,c1); | ||
77 | if (--num == 0) break; | ||
78 | mul_add(rp[2],ap[2],w,c1); | ||
79 | if (--num == 0) break; | ||
80 | mul_add(rp[3],ap[3],w,c1); | ||
81 | if (--num == 0) break; | ||
82 | ap+=4; | ||
83 | rp+=4; | ||
84 | } | ||
85 | |||
86 | return(c1); | ||
87 | } | ||
88 | |||
89 | BN_ULONG bn_mul_words(rp,ap,num,w) | ||
90 | BN_ULONG *rp,*ap; | ||
91 | int num; | ||
92 | BN_ULONG w; | ||
93 | { | ||
94 | BN_ULONG c1=0; | ||
95 | |||
96 | for (;;) | ||
97 | { | ||
98 | mul(rp[0],ap[0],w,c1); | ||
99 | if (--num == 0) break; | ||
100 | mul(rp[1],ap[1],w,c1); | ||
101 | if (--num == 0) break; | ||
102 | mul(rp[2],ap[2],w,c1); | ||
103 | if (--num == 0) break; | ||
104 | mul(rp[3],ap[3],w,c1); | ||
105 | if (--num == 0) break; | ||
106 | ap+=4; | ||
107 | rp+=4; | ||
108 | } | ||
109 | return(c1); | ||
110 | } | ||
111 | |||
112 | void bn_sqr_words(r,a,n) | ||
113 | BN_ULONG *r,*a; | ||
114 | int n; | ||
115 | { | ||
116 | for (;;) | ||
117 | { | ||
118 | BN_ULLONG t; | ||
119 | |||
120 | t=(BN_ULLONG)(a[0])*(a[0]); | ||
121 | r[0]=Lw(t); r[1]=Hw(t); | ||
122 | if (--n == 0) break; | ||
123 | |||
124 | t=(BN_ULLONG)(a[1])*(a[1]); | ||
125 | r[2]=Lw(t); r[3]=Hw(t); | ||
126 | if (--n == 0) break; | ||
127 | |||
128 | t=(BN_ULLONG)(a[2])*(a[2]); | ||
129 | r[4]=Lw(t); r[5]=Hw(t); | ||
130 | if (--n == 0) break; | ||
131 | |||
132 | t=(BN_ULLONG)(a[3])*(a[3]); | ||
133 | r[6]=Lw(t); r[7]=Hw(t); | ||
134 | if (--n == 0) break; | ||
135 | |||
136 | a+=4; | ||
137 | r+=8; | ||
138 | } | ||
139 | } | ||
140 | |||
141 | BN_ULONG bn_add_words(r,a,b,n) | ||
142 | BN_ULONG *r,*a,*b; | ||
143 | int n; | ||
144 | { | ||
145 | BN_ULLONG ll; | ||
146 | |||
147 | ll=0; | ||
148 | for (;;) | ||
149 | { | ||
150 | ll+= (BN_ULLONG)a[0]+b[0]; | ||
151 | r[0]=(BN_ULONG)ll&BN_MASK2; | ||
152 | ll>>=BN_BITS2; | ||
153 | if (--n <= 0) break; | ||
154 | |||
155 | ll+= (BN_ULLONG)a[1]+b[1]; | ||
156 | r[1]=(BN_ULONG)ll&BN_MASK2; | ||
157 | ll>>=BN_BITS2; | ||
158 | if (--n <= 0) break; | ||
159 | |||
160 | ll+= (BN_ULLONG)a[2]+b[2]; | ||
161 | r[2]=(BN_ULONG)ll&BN_MASK2; | ||
162 | ll>>=BN_BITS2; | ||
163 | if (--n <= 0) break; | ||
164 | |||
165 | ll+= (BN_ULLONG)a[3]+b[3]; | ||
166 | r[3]=(BN_ULONG)ll&BN_MASK2; | ||
167 | ll>>=BN_BITS2; | ||
168 | if (--n <= 0) break; | ||
169 | |||
170 | a+=4; | ||
171 | b+=4; | ||
172 | r+=4; | ||
173 | } | ||
174 | return(ll&BN_MASK2); | ||
175 | } | ||
176 | |||
177 | #else | ||
178 | |||
179 | BN_ULONG bn_mul_add_words(rp,ap,num,w) | ||
180 | BN_ULONG *rp,*ap; | ||
181 | int num; | ||
182 | BN_ULONG w; | ||
183 | { | ||
184 | BN_ULONG c=0; | ||
185 | BN_ULONG bl,bh; | ||
186 | |||
187 | bl=LBITS(w); | ||
188 | bh=HBITS(w); | ||
189 | |||
190 | for (;;) | ||
191 | { | ||
192 | mul_add(rp[0],ap[0],bl,bh,c); | ||
193 | if (--num == 0) break; | ||
194 | mul_add(rp[1],ap[1],bl,bh,c); | ||
195 | if (--num == 0) break; | ||
196 | mul_add(rp[2],ap[2],bl,bh,c); | ||
197 | if (--num == 0) break; | ||
198 | mul_add(rp[3],ap[3],bl,bh,c); | ||
199 | if (--num == 0) break; | ||
200 | ap+=4; | ||
201 | rp+=4; | ||
202 | } | ||
203 | return(c); | ||
204 | } | ||
205 | |||
206 | BN_ULONG bn_mul_words(rp,ap,num,w) | ||
207 | BN_ULONG *rp,*ap; | ||
208 | int num; | ||
209 | BN_ULONG w; | ||
210 | { | ||
211 | BN_ULONG carry=0; | ||
212 | BN_ULONG bl,bh; | ||
213 | |||
214 | bl=LBITS(w); | ||
215 | bh=HBITS(w); | ||
216 | |||
217 | for (;;) | ||
218 | { | ||
219 | mul(rp[0],ap[0],bl,bh,carry); | ||
220 | if (--num == 0) break; | ||
221 | mul(rp[1],ap[1],bl,bh,carry); | ||
222 | if (--num == 0) break; | ||
223 | mul(rp[2],ap[2],bl,bh,carry); | ||
224 | if (--num == 0) break; | ||
225 | mul(rp[3],ap[3],bl,bh,carry); | ||
226 | if (--num == 0) break; | ||
227 | ap+=4; | ||
228 | rp+=4; | ||
229 | } | ||
230 | return(carry); | ||
231 | } | ||
232 | |||
233 | void bn_sqr_words(r,a,n) | ||
234 | BN_ULONG *r,*a; | ||
235 | int n; | ||
236 | { | ||
237 | for (;;) | ||
238 | { | ||
239 | sqr64(r[0],r[1],a[0]); | ||
240 | if (--n == 0) break; | ||
241 | |||
242 | sqr64(r[2],r[3],a[1]); | ||
243 | if (--n == 0) break; | ||
244 | |||
245 | sqr64(r[4],r[5],a[2]); | ||
246 | if (--n == 0) break; | ||
247 | |||
248 | sqr64(r[6],r[7],a[3]); | ||
249 | if (--n == 0) break; | ||
250 | |||
251 | a+=4; | ||
252 | r+=8; | ||
253 | } | ||
254 | } | ||
255 | |||
256 | BN_ULONG bn_add_words(r,a,b,n) | ||
257 | BN_ULONG *r,*a,*b; | ||
258 | int n; | ||
259 | { | ||
260 | BN_ULONG t1,t2; | ||
261 | int carry,i; | ||
262 | |||
263 | carry=0; | ||
264 | for (i=0; i<n; i++) | ||
265 | { | ||
266 | t1= *(a++); | ||
267 | t2= *(b++); | ||
268 | if (carry) | ||
269 | { | ||
270 | carry=(t2 >= ((~t1)&BN_MASK2)); | ||
271 | t2=(t1+t2+1)&BN_MASK2; | ||
272 | } | ||
273 | else | ||
274 | { | ||
275 | t2=(t1+t2)&BN_MASK2; | ||
276 | carry=(t2<t1); | ||
277 | } | ||
278 | *(r++)=t2; | ||
279 | } | ||
280 | return(carry); | ||
281 | } | ||
282 | |||
283 | #endif | ||
284 | |||
285 | #if defined(BN_LLONG) && defined(BN_DIV2W) | ||
286 | |||
287 | BN_ULONG bn_div64(h,l,d) | ||
288 | BN_ULONG h,l,d; | ||
289 | { | ||
290 | return((BN_ULONG)(((((BN_ULLONG)h)<<BN_BITS2)|l)/(BN_ULLONG)d)); | ||
291 | } | ||
292 | |||
293 | #else | ||
294 | |||
295 | /* Divide h-l by d and return the result. */ | ||
296 | /* I need to test this some more :-( */ | ||
297 | BN_ULONG bn_div64(h,l,d) | ||
298 | BN_ULONG h,l,d; | ||
299 | { | ||
300 | BN_ULONG dh,dl,q,ret=0,th,tl,t; | ||
301 | int i,count=2; | ||
302 | |||
303 | if (d == 0) return(BN_MASK2); | ||
304 | |||
305 | i=BN_num_bits_word(d); | ||
306 | if ((i != BN_BITS2) && (h > (BN_ULONG)1<<i)) | ||
307 | { | ||
308 | #if !defined(NO_STDIO) && !defined(WIN16) | ||
309 | fprintf(stderr,"Division would overflow (%d)\n",i); | ||
310 | #endif | ||
311 | abort(); | ||
312 | } | ||
313 | i=BN_BITS2-i; | ||
314 | if (h >= d) h-=d; | ||
315 | |||
316 | if (i) | ||
317 | { | ||
318 | d<<=i; | ||
319 | h=(h<<i)|(l>>(BN_BITS2-i)); | ||
320 | l<<=i; | ||
321 | } | ||
322 | dh=(d&BN_MASK2h)>>BN_BITS4; | ||
323 | dl=(d&BN_MASK2l); | ||
324 | for (;;) | ||
325 | { | ||
326 | if ((h>>BN_BITS4) == dh) | ||
327 | q=BN_MASK2l; | ||
328 | else | ||
329 | q=h/dh; | ||
330 | |||
331 | for (;;) | ||
332 | { | ||
333 | t=(h-q*dh); | ||
334 | if ((t&BN_MASK2h) || | ||
335 | ((dl*q) <= ( | ||
336 | (t<<BN_BITS4)+ | ||
337 | ((l&BN_MASK2h)>>BN_BITS4)))) | ||
338 | break; | ||
339 | q--; | ||
340 | } | ||
341 | th=q*dh; | ||
342 | tl=q*dl; | ||
343 | t=(tl>>BN_BITS4); | ||
344 | tl=(tl<<BN_BITS4)&BN_MASK2h; | ||
345 | th+=t; | ||
346 | |||
347 | if (l < tl) th++; | ||
348 | l-=tl; | ||
349 | if (h < th) | ||
350 | { | ||
351 | h+=d; | ||
352 | q--; | ||
353 | } | ||
354 | h-=th; | ||
355 | |||
356 | if (--count == 0) break; | ||
357 | |||
358 | ret=q<<BN_BITS4; | ||
359 | h=((h<<BN_BITS4)|(l>>BN_BITS4))&BN_MASK2; | ||
360 | l=(l&BN_MASK2l)<<BN_BITS4; | ||
361 | } | ||
362 | ret|=q; | ||
363 | return(ret); | ||
364 | } | ||
365 | #endif | ||
366 | |||
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 @@ | |||
1 | /* crypto/bn/bn_sub.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "bn_lcl.h" | ||
62 | |||
63 | /* unsigned subtraction of b from a, a must be larger than b. */ | ||
64 | void bn_qsub(r, a, b) | ||
65 | BIGNUM *r; | ||
66 | BIGNUM *a; | ||
67 | BIGNUM *b; | ||
68 | { | ||
69 | int max,min; | ||
70 | register BN_ULONG t1,t2,*ap,*bp,*rp; | ||
71 | int i,carry; | ||
72 | #if defined(IRIX_CC_BUG) && !defined(LINT) | ||
73 | int dummy; | ||
74 | #endif | ||
75 | |||
76 | max=a->top; | ||
77 | min=b->top; | ||
78 | ap=a->d; | ||
79 | bp=b->d; | ||
80 | rp=r->d; | ||
81 | |||
82 | carry=0; | ||
83 | for (i=0; i<min; i++) | ||
84 | { | ||
85 | t1= *(ap++); | ||
86 | t2= *(bp++); | ||
87 | if (carry) | ||
88 | { | ||
89 | carry=(t1 <= t2); | ||
90 | t1=(t1-t2-1)&BN_MASK2; | ||
91 | } | ||
92 | else | ||
93 | { | ||
94 | carry=(t1 < t2); | ||
95 | t1=(t1-t2)&BN_MASK2; | ||
96 | } | ||
97 | #if defined(IRIX_CC_BUG) && !defined(LINT) | ||
98 | dummy=t1; | ||
99 | #endif | ||
100 | *(rp++)=t1&BN_MASK2; | ||
101 | } | ||
102 | if (carry) /* subtracted */ | ||
103 | { | ||
104 | while (i < max) | ||
105 | { | ||
106 | i++; | ||
107 | t1= *(ap++); | ||
108 | t2=(t1-1)&BN_MASK2; | ||
109 | *(rp++)=t2; | ||
110 | if (t1 > t2) break; | ||
111 | } | ||
112 | } | ||
113 | #if 0 | ||
114 | memcpy(rp,ap,sizeof(*rp)*(max-i)); | ||
115 | #else | ||
116 | for (; i<max; i++) | ||
117 | *(rp++)= *(ap++); | ||
118 | #endif | ||
119 | |||
120 | r->top=max; | ||
121 | bn_fix_top(r); | ||
122 | } | ||
123 | |||
124 | int BN_sub(r, a, b) | ||
125 | BIGNUM *r; | ||
126 | BIGNUM *a; | ||
127 | BIGNUM *b; | ||
128 | { | ||
129 | int max,i; | ||
130 | int add=0,neg=0; | ||
131 | BIGNUM *tmp; | ||
132 | |||
133 | /* a - b a-b | ||
134 | * a - -b a+b | ||
135 | * -a - b -(a+b) | ||
136 | * -a - -b b-a | ||
137 | */ | ||
138 | if (a->neg) | ||
139 | { | ||
140 | if (b->neg) | ||
141 | { tmp=a; a=b; b=tmp; } | ||
142 | else | ||
143 | { add=1; neg=1; } | ||
144 | } | ||
145 | else | ||
146 | { | ||
147 | if (b->neg) { add=1; neg=0; } | ||
148 | } | ||
149 | |||
150 | if (add) | ||
151 | { | ||
152 | /* As a fast max size, do a a->top | b->top */ | ||
153 | i=(a->top | b->top)+1; | ||
154 | if (bn_wexpand(r,i) == NULL) | ||
155 | return(0); | ||
156 | if (i) | ||
157 | bn_qadd(r,a,b); | ||
158 | else | ||
159 | bn_qadd(r,b,a); | ||
160 | r->neg=neg; | ||
161 | return(1); | ||
162 | } | ||
163 | |||
164 | /* We are actually doing a - b :-) */ | ||
165 | |||
166 | max=(a->top > b->top)?a->top:b->top; | ||
167 | if (bn_wexpand(r,max) == NULL) return(0); | ||
168 | if (BN_ucmp(a,b) < 0) | ||
169 | { | ||
170 | bn_qsub(r,b,a); | ||
171 | r->neg=1; | ||
172 | } | ||
173 | else | ||
174 | { | ||
175 | bn_qsub(r,a,b); | ||
176 | r->neg=0; | ||
177 | } | ||
178 | return(1); | ||
179 | } | ||
180 | |||
diff --git a/src/lib/libcrypto/buffer/Makefile.ssl b/src/lib/libcrypto/buffer/Makefile.ssl new file mode 100644 index 0000000000..a5f150e523 --- /dev/null +++ b/src/lib/libcrypto/buffer/Makefile.ssl | |||
@@ -0,0 +1,84 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/buffer/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= buffer | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | ERR=buffer | ||
19 | ERRC=buf_err | ||
20 | GENERAL=Makefile | ||
21 | TEST= | ||
22 | APPS= | ||
23 | |||
24 | LIB=$(TOP)/libcrypto.a | ||
25 | LIBSRC= buffer.c $(ERRC).c | ||
26 | LIBOBJ= buffer.o $(ERRC).o | ||
27 | |||
28 | SRC= $(LIBSRC) | ||
29 | |||
30 | EXHEADER= buffer.h | ||
31 | HEADER= $(EXHEADER) | ||
32 | |||
33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
34 | |||
35 | top: | ||
36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
37 | |||
38 | all: lib | ||
39 | |||
40 | lib: $(LIBOBJ) | ||
41 | $(AR) $(LIB) $(LIBOBJ) | ||
42 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
43 | @touch lib | ||
44 | |||
45 | files: | ||
46 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
47 | |||
48 | links: | ||
49 | /bin/rm -f Makefile | ||
50 | $(TOP)/util/point.sh Makefile.ssl Makefile; | ||
51 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
52 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
53 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
54 | |||
55 | install: | ||
56 | @for i in $(EXHEADER) ; \ | ||
57 | do \ | ||
58 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
59 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
60 | done; | ||
61 | |||
62 | tags: | ||
63 | ctags $(SRC) | ||
64 | |||
65 | tests: | ||
66 | |||
67 | lint: | ||
68 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
69 | |||
70 | depend: | ||
71 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
72 | |||
73 | dclean: | ||
74 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
75 | mv -f Makefile.new $(MAKEFILE) | ||
76 | |||
77 | clean: | ||
78 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
79 | |||
80 | errors: | ||
81 | perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h | ||
82 | perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c | ||
83 | |||
84 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | /* Error codes for the BUF functions. */ | ||
2 | |||
3 | /* Function codes. */ | ||
4 | #define BUF_F_BUF_MEM_GROW 100 | ||
5 | #define BUF_F_BUF_MEM_NEW 101 | ||
6 | #define BUF_F_BUF_STRDUP 102 | ||
7 | #define BUF_F_PXYCLNT_READ 103 | ||
8 | |||
9 | /* Reason codes. */ | ||
diff --git a/src/lib/libcrypto/cast/Makefile.ssl b/src/lib/libcrypto/cast/Makefile.ssl new file mode 100644 index 0000000000..0143827ae5 --- /dev/null +++ b/src/lib/libcrypto/cast/Makefile.ssl | |||
@@ -0,0 +1,109 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/cast/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= cast | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | CPP= $(CC) -E | ||
9 | INCLUDES= | ||
10 | CFLAG=-g | ||
11 | INSTALLTOP=/usr/local/ssl | ||
12 | MAKE= make -f Makefile.ssl | ||
13 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
14 | MAKEFILE= Makefile.ssl | ||
15 | AR= ar r | ||
16 | |||
17 | CAST_ENC=c_enc.o | ||
18 | # or use | ||
19 | #CAST_ENC=asm/cx86-elf.o | ||
20 | #CAST_ENC=asm/cx86-out.o | ||
21 | #CAST_ENC=asm/cx86-sol.o | ||
22 | #CAST_ENC=asm/cx86bdsi.o | ||
23 | |||
24 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
25 | |||
26 | GENERAL=Makefile | ||
27 | TEST=casttest.c | ||
28 | APPS= | ||
29 | |||
30 | LIB=$(TOP)/libcrypto.a | ||
31 | LIBSRC=c_skey.c c_ecb.c c_enc.c c_cfb64.c c_ofb64.c | ||
32 | LIBOBJ=c_skey.o c_ecb.o $(CAST_ENC) c_cfb64.o c_ofb64.o | ||
33 | |||
34 | SRC= $(LIBSRC) | ||
35 | |||
36 | EXHEADER= cast.h | ||
37 | HEADER= cast_s.h cast_lcl.h $(EXHEADER) | ||
38 | |||
39 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
40 | |||
41 | top: | ||
42 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
43 | |||
44 | all: lib | ||
45 | |||
46 | lib: $(LIBOBJ) | ||
47 | $(AR) $(LIB) $(LIBOBJ) | ||
48 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
49 | @touch lib | ||
50 | |||
51 | # elf | ||
52 | asm/cx86-elf.o: asm/cx86unix.cpp | ||
53 | $(CPP) -DELF asm/cx86unix.cpp | as -o asm/cx86-elf.o | ||
54 | |||
55 | # solaris | ||
56 | asm/cx86-sol.o: asm/cx86unix.cpp | ||
57 | $(CC) -E -DSOL asm/cx86unix.cpp | sed 's/^#.*//' > asm/cx86-sol.s | ||
58 | as -o asm/cx86-sol.o asm/cx86-sol.s | ||
59 | rm -f asm/cx86-sol.s | ||
60 | |||
61 | # a.out | ||
62 | asm/cx86-out.o: asm/cx86unix.cpp | ||
63 | $(CPP) -DOUT asm/cx86unix.cpp | as -o asm/cx86-out.o | ||
64 | |||
65 | # bsdi | ||
66 | asm/cx86bsdi.o: asm/cx86unix.cpp | ||
67 | $(CPP) -DBSDI asm/cx86unix.cpp | as -o asm/cx86bsdi.o | ||
68 | |||
69 | asm/cx86unix.cpp: | ||
70 | (cd asm; perl cast-586.pl cpp >cx86unix.cpp) | ||
71 | |||
72 | files: | ||
73 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
74 | |||
75 | links: | ||
76 | /bin/rm -f Makefile | ||
77 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
78 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
79 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
80 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
81 | |||
82 | install: | ||
83 | @for i in $(EXHEADER) ; \ | ||
84 | do \ | ||
85 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
86 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
87 | done; | ||
88 | |||
89 | tags: | ||
90 | ctags $(SRC) | ||
91 | |||
92 | tests: | ||
93 | |||
94 | lint: | ||
95 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
96 | |||
97 | depend: | ||
98 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
99 | |||
100 | dclean: | ||
101 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
102 | mv -f Makefile.new $(MAKEFILE) | ||
103 | |||
104 | clean: | ||
105 | /bin/rm -f *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
106 | |||
107 | errors: | ||
108 | |||
109 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | # Targets | ||
2 | # make - twidle the options yourself :-) | ||
3 | # make cc - standard cc options | ||
4 | # make gcc - standard gcc options | ||
5 | # make x86-elf - linux-elf etc | ||
6 | # make x86-out - linux-a.out, FreeBSD etc | ||
7 | # make x86-solaris | ||
8 | # make x86-bdsi | ||
9 | |||
10 | # There are 3 possible performance options, experiment :-) | ||
11 | #OPTS= -DBF_PTR | ||
12 | #OPTS= -DBF_PTR2 | ||
13 | OPTS= | ||
14 | |||
15 | DIR= cast | ||
16 | TOP= . | ||
17 | CC= gcc | ||
18 | CFLAG= -O3 -fomit-frame-pointer | ||
19 | |||
20 | CPP= $(CC) -E | ||
21 | INCLUDES= | ||
22 | INSTALLTOP=/usr/local/lib | ||
23 | MAKE= make | ||
24 | MAKEDEPEND= makedepend | ||
25 | MAKEFILE= Makefile.uni | ||
26 | AR= ar r | ||
27 | |||
28 | CAST_ENC=c_enc.o | ||
29 | # or use | ||
30 | #CAST_ENC=asm/cx86-elf.o | ||
31 | #CAST_ENC=asm/cx86-out.o | ||
32 | #CAST_ENC=asm/cx86-sol.o | ||
33 | #CAST_ENC=asm/cx86bdsi.o | ||
34 | |||
35 | CFLAGS= $(OPTS) $(INCLUDES) $(CFLAG) -DFULL_TEST | ||
36 | |||
37 | GENERAL=Makefile | ||
38 | TEST=casttest | ||
39 | APP1=cast_spd | ||
40 | APP2=castopts | ||
41 | APPS=$(APP1) $(APP2) | ||
42 | |||
43 | LIB=libcast.a | ||
44 | LIBSRC=c_skey.c c_ecb.c c_enc.c c_cfb64.c c_ofb64.c | ||
45 | LIBOBJ=c_skey.o c_ecb.o $(CAST_ENC) c_cfb64.o c_ofb64.o | ||
46 | |||
47 | SRC= $(LIBSRC) | ||
48 | |||
49 | EXHEADER= cast.h | ||
50 | HEADER= cast_lcl.h $(EXHEADER) | ||
51 | |||
52 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
53 | |||
54 | all: $(LIB) $(TEST) $(APPS) | ||
55 | |||
56 | $(LIB): $(LIBOBJ) | ||
57 | $(AR) $(LIB) $(LIBOBJ) | ||
58 | sh $(TOP)/ranlib.sh $(LIB) | ||
59 | # elf | ||
60 | asm/cx86-elf.o: asm/cx86unix.cpp | ||
61 | $(CPP) -DELF asm/cx86unix.cpp | as -o asm/cx86-elf.o | ||
62 | |||
63 | # solaris | ||
64 | asm/cx86-sol.o: asm/cx86unix.cpp | ||
65 | $(CC) -E -DSOL asm/cx86unix.cpp | sed 's/^#.*//' > asm/cx86-sol.s | ||
66 | as -o asm/cx86-sol.o asm/cx86-sol.s | ||
67 | rm -f asm/cx86-sol.s | ||
68 | |||
69 | # a.out | ||
70 | asm/cx86-out.o: asm/cx86unix.cpp | ||
71 | $(CPP) -DOUT asm/cx86unix.cpp | as -o asm/cx86-out.o | ||
72 | |||
73 | # bsdi | ||
74 | asm/cx86bsdi.o: asm/cx86unix.cpp | ||
75 | $(CPP) -DBSDI asm/cx86unix.cpp | as -o asm/cx86bsdi.o | ||
76 | |||
77 | asm/cx86unix.cpp: | ||
78 | (cd asm; perl cast-586.pl cpp >cx86unix.cpp) | ||
79 | |||
80 | test: $(TEST) | ||
81 | ./$(TEST) | ||
82 | |||
83 | $(TEST): $(TEST).c $(LIB) | ||
84 | $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) | ||
85 | |||
86 | $(APP1): $(APP1).c $(LIB) | ||
87 | $(CC) -o $(APP1) $(CFLAGS) $(APP1).c $(LIB) | ||
88 | |||
89 | $(APP2): $(APP2).c $(LIB) | ||
90 | $(CC) -o $(APP2) $(CFLAGS) $(APP2).c $(LIB) | ||
91 | |||
92 | lint: | ||
93 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
94 | |||
95 | depend: | ||
96 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
97 | |||
98 | dclean: | ||
99 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
100 | mv -f Makefile.new $(MAKEFILE) | ||
101 | |||
102 | clean: | ||
103 | /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
104 | |||
105 | cc: | ||
106 | $(MAKE) CC="cc" CFLAG="-O" all | ||
107 | |||
108 | gcc: | ||
109 | $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all | ||
110 | |||
111 | x86-elf: | ||
112 | $(MAKE) CAST_ENC="asm/cx86-elf.o" CFLAG="-DELF $(CFLAGS)" all | ||
113 | |||
114 | x86-out: | ||
115 | $(MAKE) CAST_ENC="asm/cx86-out.o" CFLAG="-DOUT $(CFLAGS)" all | ||
116 | |||
117 | x86-solaris: | ||
118 | $(MAKE) CAST_ENC="asm/cx86-sol.o" CFLAG="-DSOL $(CFLAGS)" all | ||
119 | |||
120 | x86-bdsi: | ||
121 | $(MAKE) CAST_ENC="asm/cx86-bdsi.o" CFLAG="-DBDSI $(CFLAGS)" all | ||
122 | |||
123 | # 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 @@ | |||
1 | ; Don't even think of reading this code | ||
2 | ; It was automatically generated by cast-586.pl | ||
3 | ; Which is a perl program used to generate the x86 assember for | ||
4 | ; any of elf, a.out, BSDI,Win32, or Solaris | ||
5 | ; eric <eay@cryptsoft.com> | ||
6 | ; | ||
7 | TITLE cast-586.asm | ||
8 | .486 | ||
9 | .model FLAT | ||
10 | _TEXT SEGMENT | ||
11 | PUBLIC _CAST_encrypt | ||
12 | EXTERN _CAST_S_table0:DWORD | ||
13 | EXTERN _CAST_S_table1:DWORD | ||
14 | EXTERN _CAST_S_table2:DWORD | ||
15 | EXTERN _CAST_S_table3:DWORD | ||
16 | |||
17 | _CAST_encrypt PROC NEAR | ||
18 | ; | ||
19 | push ebp | ||
20 | push ebx | ||
21 | mov ebx, DWORD PTR 12[esp] | ||
22 | mov ebp, DWORD PTR 16[esp] | ||
23 | push esi | ||
24 | push edi | ||
25 | ; Load the 2 words | ||
26 | mov edi, DWORD PTR [ebx] | ||
27 | mov esi, DWORD PTR 4[ebx] | ||
28 | xor eax, eax | ||
29 | ; round 0 | ||
30 | mov edx, DWORD PTR [ebp] | ||
31 | mov ecx, DWORD PTR 4[ebp] | ||
32 | add edx, esi | ||
33 | rol edx, cl | ||
34 | mov ebx, edx | ||
35 | xor ecx, ecx | ||
36 | mov cl, dh | ||
37 | and ebx, 255 | ||
38 | shr edx, 16 | ||
39 | xor eax, eax | ||
40 | mov al, dh | ||
41 | and edx, 255 | ||
42 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
43 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
44 | xor ecx, ebx | ||
45 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
46 | sub ecx, ebx | ||
47 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
48 | add ecx, ebx | ||
49 | xor edi, ecx | ||
50 | ; round 1 | ||
51 | mov edx, DWORD PTR 8[ebp] | ||
52 | mov ecx, DWORD PTR 12[ebp] | ||
53 | xor edx, edi | ||
54 | rol edx, cl | ||
55 | mov ebx, edx | ||
56 | xor ecx, ecx | ||
57 | mov cl, dh | ||
58 | and ebx, 255 | ||
59 | shr edx, 16 | ||
60 | xor eax, eax | ||
61 | mov al, dh | ||
62 | and edx, 255 | ||
63 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
64 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
65 | sub ecx, ebx | ||
66 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
67 | add ecx, ebx | ||
68 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
69 | xor ecx, ebx | ||
70 | xor esi, ecx | ||
71 | ; round 2 | ||
72 | mov edx, DWORD PTR 16[ebp] | ||
73 | mov ecx, DWORD PTR 20[ebp] | ||
74 | sub edx, esi | ||
75 | rol edx, cl | ||
76 | mov ebx, edx | ||
77 | xor ecx, ecx | ||
78 | mov cl, dh | ||
79 | and ebx, 255 | ||
80 | shr edx, 16 | ||
81 | xor eax, eax | ||
82 | mov al, dh | ||
83 | and edx, 255 | ||
84 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
85 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
86 | add ecx, ebx | ||
87 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
88 | xor ecx, ebx | ||
89 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
90 | sub ecx, ebx | ||
91 | xor edi, ecx | ||
92 | ; round 3 | ||
93 | mov edx, DWORD PTR 24[ebp] | ||
94 | mov ecx, DWORD PTR 28[ebp] | ||
95 | add edx, edi | ||
96 | rol edx, cl | ||
97 | mov ebx, edx | ||
98 | xor ecx, ecx | ||
99 | mov cl, dh | ||
100 | and ebx, 255 | ||
101 | shr edx, 16 | ||
102 | xor eax, eax | ||
103 | mov al, dh | ||
104 | and edx, 255 | ||
105 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
106 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
107 | xor ecx, ebx | ||
108 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
109 | sub ecx, ebx | ||
110 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
111 | add ecx, ebx | ||
112 | xor esi, ecx | ||
113 | ; round 4 | ||
114 | mov edx, DWORD PTR 32[ebp] | ||
115 | mov ecx, DWORD PTR 36[ebp] | ||
116 | xor edx, esi | ||
117 | rol edx, cl | ||
118 | mov ebx, edx | ||
119 | xor ecx, ecx | ||
120 | mov cl, dh | ||
121 | and ebx, 255 | ||
122 | shr edx, 16 | ||
123 | xor eax, eax | ||
124 | mov al, dh | ||
125 | and edx, 255 | ||
126 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
127 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
128 | sub ecx, ebx | ||
129 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
130 | add ecx, ebx | ||
131 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
132 | xor ecx, ebx | ||
133 | xor edi, ecx | ||
134 | ; round 5 | ||
135 | mov edx, DWORD PTR 40[ebp] | ||
136 | mov ecx, DWORD PTR 44[ebp] | ||
137 | sub edx, edi | ||
138 | rol edx, cl | ||
139 | mov ebx, edx | ||
140 | xor ecx, ecx | ||
141 | mov cl, dh | ||
142 | and ebx, 255 | ||
143 | shr edx, 16 | ||
144 | xor eax, eax | ||
145 | mov al, dh | ||
146 | and edx, 255 | ||
147 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
148 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
149 | add ecx, ebx | ||
150 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
151 | xor ecx, ebx | ||
152 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
153 | sub ecx, ebx | ||
154 | xor esi, ecx | ||
155 | ; round 6 | ||
156 | mov edx, DWORD PTR 48[ebp] | ||
157 | mov ecx, DWORD PTR 52[ebp] | ||
158 | add edx, esi | ||
159 | rol edx, cl | ||
160 | mov ebx, edx | ||
161 | xor ecx, ecx | ||
162 | mov cl, dh | ||
163 | and ebx, 255 | ||
164 | shr edx, 16 | ||
165 | xor eax, eax | ||
166 | mov al, dh | ||
167 | and edx, 255 | ||
168 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
169 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
170 | xor ecx, ebx | ||
171 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
172 | sub ecx, ebx | ||
173 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
174 | add ecx, ebx | ||
175 | xor edi, ecx | ||
176 | ; round 7 | ||
177 | mov edx, DWORD PTR 56[ebp] | ||
178 | mov ecx, DWORD PTR 60[ebp] | ||
179 | xor edx, edi | ||
180 | rol edx, cl | ||
181 | mov ebx, edx | ||
182 | xor ecx, ecx | ||
183 | mov cl, dh | ||
184 | and ebx, 255 | ||
185 | shr edx, 16 | ||
186 | xor eax, eax | ||
187 | mov al, dh | ||
188 | and edx, 255 | ||
189 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
190 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
191 | sub ecx, ebx | ||
192 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
193 | add ecx, ebx | ||
194 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
195 | xor ecx, ebx | ||
196 | xor esi, ecx | ||
197 | ; round 8 | ||
198 | mov edx, DWORD PTR 64[ebp] | ||
199 | mov ecx, DWORD PTR 68[ebp] | ||
200 | sub edx, esi | ||
201 | rol edx, cl | ||
202 | mov ebx, edx | ||
203 | xor ecx, ecx | ||
204 | mov cl, dh | ||
205 | and ebx, 255 | ||
206 | shr edx, 16 | ||
207 | xor eax, eax | ||
208 | mov al, dh | ||
209 | and edx, 255 | ||
210 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
211 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
212 | add ecx, ebx | ||
213 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
214 | xor ecx, ebx | ||
215 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
216 | sub ecx, ebx | ||
217 | xor edi, ecx | ||
218 | ; round 9 | ||
219 | mov edx, DWORD PTR 72[ebp] | ||
220 | mov ecx, DWORD PTR 76[ebp] | ||
221 | add edx, edi | ||
222 | rol edx, cl | ||
223 | mov ebx, edx | ||
224 | xor ecx, ecx | ||
225 | mov cl, dh | ||
226 | and ebx, 255 | ||
227 | shr edx, 16 | ||
228 | xor eax, eax | ||
229 | mov al, dh | ||
230 | and edx, 255 | ||
231 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
232 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
233 | xor ecx, ebx | ||
234 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
235 | sub ecx, ebx | ||
236 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
237 | add ecx, ebx | ||
238 | xor esi, ecx | ||
239 | ; round 10 | ||
240 | mov edx, DWORD PTR 80[ebp] | ||
241 | mov ecx, DWORD PTR 84[ebp] | ||
242 | xor edx, esi | ||
243 | rol edx, cl | ||
244 | mov ebx, edx | ||
245 | xor ecx, ecx | ||
246 | mov cl, dh | ||
247 | and ebx, 255 | ||
248 | shr edx, 16 | ||
249 | xor eax, eax | ||
250 | mov al, dh | ||
251 | and edx, 255 | ||
252 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
253 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
254 | sub ecx, ebx | ||
255 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
256 | add ecx, ebx | ||
257 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
258 | xor ecx, ebx | ||
259 | xor edi, ecx | ||
260 | ; round 11 | ||
261 | mov edx, DWORD PTR 88[ebp] | ||
262 | mov ecx, DWORD PTR 92[ebp] | ||
263 | sub edx, edi | ||
264 | rol edx, cl | ||
265 | mov ebx, edx | ||
266 | xor ecx, ecx | ||
267 | mov cl, dh | ||
268 | and ebx, 255 | ||
269 | shr edx, 16 | ||
270 | xor eax, eax | ||
271 | mov al, dh | ||
272 | and edx, 255 | ||
273 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
274 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
275 | add ecx, ebx | ||
276 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
277 | xor ecx, ebx | ||
278 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
279 | sub ecx, ebx | ||
280 | xor esi, ecx | ||
281 | ; round 12 | ||
282 | mov edx, DWORD PTR 96[ebp] | ||
283 | mov ecx, DWORD PTR 100[ebp] | ||
284 | add edx, esi | ||
285 | rol edx, cl | ||
286 | mov ebx, edx | ||
287 | xor ecx, ecx | ||
288 | mov cl, dh | ||
289 | and ebx, 255 | ||
290 | shr edx, 16 | ||
291 | xor eax, eax | ||
292 | mov al, dh | ||
293 | and edx, 255 | ||
294 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
295 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
296 | xor ecx, ebx | ||
297 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
298 | sub ecx, ebx | ||
299 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
300 | add ecx, ebx | ||
301 | xor edi, ecx | ||
302 | ; round 13 | ||
303 | mov edx, DWORD PTR 104[ebp] | ||
304 | mov ecx, DWORD PTR 108[ebp] | ||
305 | xor edx, edi | ||
306 | rol edx, cl | ||
307 | mov ebx, edx | ||
308 | xor ecx, ecx | ||
309 | mov cl, dh | ||
310 | and ebx, 255 | ||
311 | shr edx, 16 | ||
312 | xor eax, eax | ||
313 | mov al, dh | ||
314 | and edx, 255 | ||
315 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
316 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
317 | sub ecx, ebx | ||
318 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
319 | add ecx, ebx | ||
320 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
321 | xor ecx, ebx | ||
322 | xor esi, ecx | ||
323 | ; round 14 | ||
324 | mov edx, DWORD PTR 112[ebp] | ||
325 | mov ecx, DWORD PTR 116[ebp] | ||
326 | sub edx, esi | ||
327 | rol edx, cl | ||
328 | mov ebx, edx | ||
329 | xor ecx, ecx | ||
330 | mov cl, dh | ||
331 | and ebx, 255 | ||
332 | shr edx, 16 | ||
333 | xor eax, eax | ||
334 | mov al, dh | ||
335 | and edx, 255 | ||
336 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
337 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
338 | add ecx, ebx | ||
339 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
340 | xor ecx, ebx | ||
341 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
342 | sub ecx, ebx | ||
343 | xor edi, ecx | ||
344 | ; round 15 | ||
345 | mov edx, DWORD PTR 120[ebp] | ||
346 | mov ecx, DWORD PTR 124[ebp] | ||
347 | add edx, edi | ||
348 | rol edx, cl | ||
349 | mov ebx, edx | ||
350 | xor ecx, ecx | ||
351 | mov cl, dh | ||
352 | and ebx, 255 | ||
353 | shr edx, 16 | ||
354 | xor eax, eax | ||
355 | mov al, dh | ||
356 | and edx, 255 | ||
357 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
358 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
359 | xor ecx, ebx | ||
360 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
361 | sub ecx, ebx | ||
362 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
363 | add ecx, ebx | ||
364 | mov eax, DWORD PTR 20[esp] | ||
365 | xor esi, ecx | ||
366 | nop | ||
367 | mov DWORD PTR 4[eax],edi | ||
368 | mov DWORD PTR [eax],esi | ||
369 | pop edi | ||
370 | pop esi | ||
371 | pop ebx | ||
372 | pop ebp | ||
373 | ret | ||
374 | _CAST_encrypt ENDP | ||
375 | _TEXT ENDS | ||
376 | _TEXT SEGMENT | ||
377 | PUBLIC _CAST_decrypt | ||
378 | EXTERN _CAST_S_table0:DWORD | ||
379 | EXTERN _CAST_S_table1:DWORD | ||
380 | EXTERN _CAST_S_table2:DWORD | ||
381 | EXTERN _CAST_S_table3:DWORD | ||
382 | |||
383 | _CAST_decrypt PROC NEAR | ||
384 | ; | ||
385 | push ebp | ||
386 | push ebx | ||
387 | mov ebx, DWORD PTR 12[esp] | ||
388 | mov ebp, DWORD PTR 16[esp] | ||
389 | push esi | ||
390 | push edi | ||
391 | ; Load the 2 words | ||
392 | mov edi, DWORD PTR [ebx] | ||
393 | mov esi, DWORD PTR 4[ebx] | ||
394 | xor eax, eax | ||
395 | ; round 15 | ||
396 | mov edx, DWORD PTR 120[ebp] | ||
397 | mov ecx, DWORD PTR 124[ebp] | ||
398 | add edx, esi | ||
399 | rol edx, cl | ||
400 | mov ebx, edx | ||
401 | xor ecx, ecx | ||
402 | mov cl, dh | ||
403 | and ebx, 255 | ||
404 | shr edx, 16 | ||
405 | xor eax, eax | ||
406 | mov al, dh | ||
407 | and edx, 255 | ||
408 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
409 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
410 | xor ecx, ebx | ||
411 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
412 | sub ecx, ebx | ||
413 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
414 | add ecx, ebx | ||
415 | xor edi, ecx | ||
416 | ; round 14 | ||
417 | mov edx, DWORD PTR 112[ebp] | ||
418 | mov ecx, DWORD PTR 116[ebp] | ||
419 | sub edx, edi | ||
420 | rol edx, cl | ||
421 | mov ebx, edx | ||
422 | xor ecx, ecx | ||
423 | mov cl, dh | ||
424 | and ebx, 255 | ||
425 | shr edx, 16 | ||
426 | xor eax, eax | ||
427 | mov al, dh | ||
428 | and edx, 255 | ||
429 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
430 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
431 | add ecx, ebx | ||
432 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
433 | xor ecx, ebx | ||
434 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
435 | sub ecx, ebx | ||
436 | xor esi, ecx | ||
437 | ; round 13 | ||
438 | mov edx, DWORD PTR 104[ebp] | ||
439 | mov ecx, DWORD PTR 108[ebp] | ||
440 | xor edx, esi | ||
441 | rol edx, cl | ||
442 | mov ebx, edx | ||
443 | xor ecx, ecx | ||
444 | mov cl, dh | ||
445 | and ebx, 255 | ||
446 | shr edx, 16 | ||
447 | xor eax, eax | ||
448 | mov al, dh | ||
449 | and edx, 255 | ||
450 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
451 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
452 | sub ecx, ebx | ||
453 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
454 | add ecx, ebx | ||
455 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
456 | xor ecx, ebx | ||
457 | xor edi, ecx | ||
458 | ; round 12 | ||
459 | mov edx, DWORD PTR 96[ebp] | ||
460 | mov ecx, DWORD PTR 100[ebp] | ||
461 | add edx, edi | ||
462 | rol edx, cl | ||
463 | mov ebx, edx | ||
464 | xor ecx, ecx | ||
465 | mov cl, dh | ||
466 | and ebx, 255 | ||
467 | shr edx, 16 | ||
468 | xor eax, eax | ||
469 | mov al, dh | ||
470 | and edx, 255 | ||
471 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
472 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
473 | xor ecx, ebx | ||
474 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
475 | sub ecx, ebx | ||
476 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
477 | add ecx, ebx | ||
478 | xor esi, ecx | ||
479 | ; round 11 | ||
480 | mov edx, DWORD PTR 88[ebp] | ||
481 | mov ecx, DWORD PTR 92[ebp] | ||
482 | sub edx, esi | ||
483 | rol edx, cl | ||
484 | mov ebx, edx | ||
485 | xor ecx, ecx | ||
486 | mov cl, dh | ||
487 | and ebx, 255 | ||
488 | shr edx, 16 | ||
489 | xor eax, eax | ||
490 | mov al, dh | ||
491 | and edx, 255 | ||
492 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
493 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
494 | add ecx, ebx | ||
495 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
496 | xor ecx, ebx | ||
497 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
498 | sub ecx, ebx | ||
499 | xor edi, ecx | ||
500 | ; round 10 | ||
501 | mov edx, DWORD PTR 80[ebp] | ||
502 | mov ecx, DWORD PTR 84[ebp] | ||
503 | xor edx, edi | ||
504 | rol edx, cl | ||
505 | mov ebx, edx | ||
506 | xor ecx, ecx | ||
507 | mov cl, dh | ||
508 | and ebx, 255 | ||
509 | shr edx, 16 | ||
510 | xor eax, eax | ||
511 | mov al, dh | ||
512 | and edx, 255 | ||
513 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
514 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
515 | sub ecx, ebx | ||
516 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
517 | add ecx, ebx | ||
518 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
519 | xor ecx, ebx | ||
520 | xor esi, ecx | ||
521 | ; round 9 | ||
522 | mov edx, DWORD PTR 72[ebp] | ||
523 | mov ecx, DWORD PTR 76[ebp] | ||
524 | add edx, esi | ||
525 | rol edx, cl | ||
526 | mov ebx, edx | ||
527 | xor ecx, ecx | ||
528 | mov cl, dh | ||
529 | and ebx, 255 | ||
530 | shr edx, 16 | ||
531 | xor eax, eax | ||
532 | mov al, dh | ||
533 | and edx, 255 | ||
534 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
535 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
536 | xor ecx, ebx | ||
537 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
538 | sub ecx, ebx | ||
539 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
540 | add ecx, ebx | ||
541 | xor edi, ecx | ||
542 | ; round 8 | ||
543 | mov edx, DWORD PTR 64[ebp] | ||
544 | mov ecx, DWORD PTR 68[ebp] | ||
545 | sub edx, edi | ||
546 | rol edx, cl | ||
547 | mov ebx, edx | ||
548 | xor ecx, ecx | ||
549 | mov cl, dh | ||
550 | and ebx, 255 | ||
551 | shr edx, 16 | ||
552 | xor eax, eax | ||
553 | mov al, dh | ||
554 | and edx, 255 | ||
555 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
556 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
557 | add ecx, ebx | ||
558 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
559 | xor ecx, ebx | ||
560 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
561 | sub ecx, ebx | ||
562 | xor esi, ecx | ||
563 | ; round 7 | ||
564 | mov edx, DWORD PTR 56[ebp] | ||
565 | mov ecx, DWORD PTR 60[ebp] | ||
566 | xor edx, esi | ||
567 | rol edx, cl | ||
568 | mov ebx, edx | ||
569 | xor ecx, ecx | ||
570 | mov cl, dh | ||
571 | and ebx, 255 | ||
572 | shr edx, 16 | ||
573 | xor eax, eax | ||
574 | mov al, dh | ||
575 | and edx, 255 | ||
576 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
577 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
578 | sub ecx, ebx | ||
579 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
580 | add ecx, ebx | ||
581 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
582 | xor ecx, ebx | ||
583 | xor edi, ecx | ||
584 | ; round 6 | ||
585 | mov edx, DWORD PTR 48[ebp] | ||
586 | mov ecx, DWORD PTR 52[ebp] | ||
587 | add edx, edi | ||
588 | rol edx, cl | ||
589 | mov ebx, edx | ||
590 | xor ecx, ecx | ||
591 | mov cl, dh | ||
592 | and ebx, 255 | ||
593 | shr edx, 16 | ||
594 | xor eax, eax | ||
595 | mov al, dh | ||
596 | and edx, 255 | ||
597 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
598 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
599 | xor ecx, ebx | ||
600 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
601 | sub ecx, ebx | ||
602 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
603 | add ecx, ebx | ||
604 | xor esi, ecx | ||
605 | ; round 5 | ||
606 | mov edx, DWORD PTR 40[ebp] | ||
607 | mov ecx, DWORD PTR 44[ebp] | ||
608 | sub edx, esi | ||
609 | rol edx, cl | ||
610 | mov ebx, edx | ||
611 | xor ecx, ecx | ||
612 | mov cl, dh | ||
613 | and ebx, 255 | ||
614 | shr edx, 16 | ||
615 | xor eax, eax | ||
616 | mov al, dh | ||
617 | and edx, 255 | ||
618 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
619 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
620 | add ecx, ebx | ||
621 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
622 | xor ecx, ebx | ||
623 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
624 | sub ecx, ebx | ||
625 | xor edi, ecx | ||
626 | ; round 4 | ||
627 | mov edx, DWORD PTR 32[ebp] | ||
628 | mov ecx, DWORD PTR 36[ebp] | ||
629 | xor edx, edi | ||
630 | rol edx, cl | ||
631 | mov ebx, edx | ||
632 | xor ecx, ecx | ||
633 | mov cl, dh | ||
634 | and ebx, 255 | ||
635 | shr edx, 16 | ||
636 | xor eax, eax | ||
637 | mov al, dh | ||
638 | and edx, 255 | ||
639 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
640 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
641 | sub ecx, ebx | ||
642 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
643 | add ecx, ebx | ||
644 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
645 | xor ecx, ebx | ||
646 | xor esi, ecx | ||
647 | ; round 3 | ||
648 | mov edx, DWORD PTR 24[ebp] | ||
649 | mov ecx, DWORD PTR 28[ebp] | ||
650 | add edx, esi | ||
651 | rol edx, cl | ||
652 | mov ebx, edx | ||
653 | xor ecx, ecx | ||
654 | mov cl, dh | ||
655 | and ebx, 255 | ||
656 | shr edx, 16 | ||
657 | xor eax, eax | ||
658 | mov al, dh | ||
659 | and edx, 255 | ||
660 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
661 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
662 | xor ecx, ebx | ||
663 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
664 | sub ecx, ebx | ||
665 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
666 | add ecx, ebx | ||
667 | xor edi, ecx | ||
668 | ; round 2 | ||
669 | mov edx, DWORD PTR 16[ebp] | ||
670 | mov ecx, DWORD PTR 20[ebp] | ||
671 | sub edx, edi | ||
672 | rol edx, cl | ||
673 | mov ebx, edx | ||
674 | xor ecx, ecx | ||
675 | mov cl, dh | ||
676 | and ebx, 255 | ||
677 | shr edx, 16 | ||
678 | xor eax, eax | ||
679 | mov al, dh | ||
680 | and edx, 255 | ||
681 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
682 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
683 | add ecx, ebx | ||
684 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
685 | xor ecx, ebx | ||
686 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
687 | sub ecx, ebx | ||
688 | xor esi, ecx | ||
689 | ; round 1 | ||
690 | mov edx, DWORD PTR 8[ebp] | ||
691 | mov ecx, DWORD PTR 12[ebp] | ||
692 | xor edx, esi | ||
693 | rol edx, cl | ||
694 | mov ebx, edx | ||
695 | xor ecx, ecx | ||
696 | mov cl, dh | ||
697 | and ebx, 255 | ||
698 | shr edx, 16 | ||
699 | xor eax, eax | ||
700 | mov al, dh | ||
701 | and edx, 255 | ||
702 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
703 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
704 | sub ecx, ebx | ||
705 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
706 | add ecx, ebx | ||
707 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
708 | xor ecx, ebx | ||
709 | xor edi, ecx | ||
710 | ; round 0 | ||
711 | mov edx, DWORD PTR [ebp] | ||
712 | mov ecx, DWORD PTR 4[ebp] | ||
713 | add edx, edi | ||
714 | rol edx, cl | ||
715 | mov ebx, edx | ||
716 | xor ecx, ecx | ||
717 | mov cl, dh | ||
718 | and ebx, 255 | ||
719 | shr edx, 16 | ||
720 | xor eax, eax | ||
721 | mov al, dh | ||
722 | and edx, 255 | ||
723 | mov ecx, DWORD PTR _CAST_S_table0[ecx*4] | ||
724 | mov ebx, DWORD PTR _CAST_S_table1[ebx*4] | ||
725 | xor ecx, ebx | ||
726 | mov ebx, DWORD PTR _CAST_S_table2[eax*4] | ||
727 | sub ecx, ebx | ||
728 | mov ebx, DWORD PTR _CAST_S_table3[edx*4] | ||
729 | add ecx, ebx | ||
730 | mov eax, DWORD PTR 20[esp] | ||
731 | xor esi, ecx | ||
732 | nop | ||
733 | mov DWORD PTR 4[eax],edi | ||
734 | mov DWORD PTR [eax],esi | ||
735 | pop edi | ||
736 | pop esi | ||
737 | pop ebx | ||
738 | pop ebp | ||
739 | ret | ||
740 | _CAST_decrypt ENDP | ||
741 | _TEXT ENDS | ||
742 | _TEXT SEGMENT | ||
743 | PUBLIC _CAST_cbc_encrypt | ||
744 | |||
745 | _CAST_cbc_encrypt PROC NEAR | ||
746 | ; | ||
747 | push ebp | ||
748 | push ebx | ||
749 | push esi | ||
750 | push edi | ||
751 | mov ebp, DWORD PTR 28[esp] | ||
752 | ; getting iv ptr from parameter 4 | ||
753 | mov ebx, DWORD PTR 36[esp] | ||
754 | mov esi, DWORD PTR [ebx] | ||
755 | mov edi, DWORD PTR 4[ebx] | ||
756 | push edi | ||
757 | push esi | ||
758 | push edi | ||
759 | push esi | ||
760 | mov ebx, esp | ||
761 | mov esi, DWORD PTR 36[esp] | ||
762 | mov edi, DWORD PTR 40[esp] | ||
763 | ; getting encrypt flag from parameter 5 | ||
764 | mov ecx, DWORD PTR 56[esp] | ||
765 | ; get and push parameter 3 | ||
766 | mov eax, DWORD PTR 48[esp] | ||
767 | push eax | ||
768 | push ebx | ||
769 | cmp ecx, 0 | ||
770 | jz $L000decrypt | ||
771 | and ebp, 4294967288 | ||
772 | mov eax, DWORD PTR 8[esp] | ||
773 | mov ebx, DWORD PTR 12[esp] | ||
774 | jz $L001encrypt_finish | ||
775 | L002encrypt_loop: | ||
776 | mov ecx, DWORD PTR [esi] | ||
777 | mov edx, DWORD PTR 4[esi] | ||
778 | xor eax, ecx | ||
779 | xor ebx, edx | ||
780 | bswap eax | ||
781 | bswap ebx | ||
782 | mov DWORD PTR 8[esp],eax | ||
783 | mov DWORD PTR 12[esp],ebx | ||
784 | call _CAST_encrypt | ||
785 | mov eax, DWORD PTR 8[esp] | ||
786 | mov ebx, DWORD PTR 12[esp] | ||
787 | bswap eax | ||
788 | bswap ebx | ||
789 | mov DWORD PTR [edi],eax | ||
790 | mov DWORD PTR 4[edi],ebx | ||
791 | add esi, 8 | ||
792 | add edi, 8 | ||
793 | sub ebp, 8 | ||
794 | jnz L002encrypt_loop | ||
795 | $L001encrypt_finish: | ||
796 | mov ebp, DWORD PTR 52[esp] | ||
797 | and ebp, 7 | ||
798 | jz $L003finish | ||
799 | xor ecx, ecx | ||
800 | xor edx, edx | ||
801 | mov ebp, DWORD PTR $L004cbc_enc_jmp_table[ebp*4] | ||
802 | jmp ebp | ||
803 | L005ej7: | ||
804 | xor edx, edx | ||
805 | mov dh, BYTE PTR 6[esi] | ||
806 | shl edx, 8 | ||
807 | L006ej6: | ||
808 | mov dh, BYTE PTR 5[esi] | ||
809 | L007ej5: | ||
810 | mov dl, BYTE PTR 4[esi] | ||
811 | L008ej4: | ||
812 | mov ecx, DWORD PTR [esi] | ||
813 | jmp $L009ejend | ||
814 | L010ej3: | ||
815 | mov ch, BYTE PTR 2[esi] | ||
816 | xor ecx, ecx | ||
817 | shl ecx, 8 | ||
818 | L011ej2: | ||
819 | mov ch, BYTE PTR 1[esi] | ||
820 | L012ej1: | ||
821 | mov cl, BYTE PTR [esi] | ||
822 | $L009ejend: | ||
823 | xor eax, ecx | ||
824 | xor ebx, edx | ||
825 | bswap eax | ||
826 | bswap ebx | ||
827 | mov DWORD PTR 8[esp],eax | ||
828 | mov DWORD PTR 12[esp],ebx | ||
829 | call _CAST_encrypt | ||
830 | mov eax, DWORD PTR 8[esp] | ||
831 | mov ebx, DWORD PTR 12[esp] | ||
832 | bswap eax | ||
833 | bswap ebx | ||
834 | mov DWORD PTR [edi],eax | ||
835 | mov DWORD PTR 4[edi],ebx | ||
836 | jmp $L003finish | ||
837 | $L000decrypt: | ||
838 | and ebp, 4294967288 | ||
839 | mov eax, DWORD PTR 16[esp] | ||
840 | mov ebx, DWORD PTR 20[esp] | ||
841 | jz $L013decrypt_finish | ||
842 | L014decrypt_loop: | ||
843 | mov eax, DWORD PTR [esi] | ||
844 | mov ebx, DWORD PTR 4[esi] | ||
845 | bswap eax | ||
846 | bswap ebx | ||
847 | mov DWORD PTR 8[esp],eax | ||
848 | mov DWORD PTR 12[esp],ebx | ||
849 | call _CAST_decrypt | ||
850 | mov eax, DWORD PTR 8[esp] | ||
851 | mov ebx, DWORD PTR 12[esp] | ||
852 | bswap eax | ||
853 | bswap ebx | ||
854 | mov ecx, DWORD PTR 16[esp] | ||
855 | mov edx, DWORD PTR 20[esp] | ||
856 | xor ecx, eax | ||
857 | xor edx, ebx | ||
858 | mov eax, DWORD PTR [esi] | ||
859 | mov ebx, DWORD PTR 4[esi] | ||
860 | mov DWORD PTR [edi],ecx | ||
861 | mov DWORD PTR 4[edi],edx | ||
862 | mov DWORD PTR 16[esp],eax | ||
863 | mov DWORD PTR 20[esp],ebx | ||
864 | add esi, 8 | ||
865 | add edi, 8 | ||
866 | sub ebp, 8 | ||
867 | jnz L014decrypt_loop | ||
868 | $L013decrypt_finish: | ||
869 | mov ebp, DWORD PTR 52[esp] | ||
870 | and ebp, 7 | ||
871 | jz $L003finish | ||
872 | mov eax, DWORD PTR [esi] | ||
873 | mov ebx, DWORD PTR 4[esi] | ||
874 | bswap eax | ||
875 | bswap ebx | ||
876 | mov DWORD PTR 8[esp],eax | ||
877 | mov DWORD PTR 12[esp],ebx | ||
878 | call _CAST_decrypt | ||
879 | mov eax, DWORD PTR 8[esp] | ||
880 | mov ebx, DWORD PTR 12[esp] | ||
881 | bswap eax | ||
882 | bswap ebx | ||
883 | mov ecx, DWORD PTR 16[esp] | ||
884 | mov edx, DWORD PTR 20[esp] | ||
885 | xor ecx, eax | ||
886 | xor edx, ebx | ||
887 | mov eax, DWORD PTR [esi] | ||
888 | mov ebx, DWORD PTR 4[esi] | ||
889 | L015dj7: | ||
890 | ror edx, 16 | ||
891 | mov BYTE PTR 6[edi],dl | ||
892 | shr edx, 16 | ||
893 | L016dj6: | ||
894 | mov BYTE PTR 5[edi],dh | ||
895 | L017dj5: | ||
896 | mov BYTE PTR 4[edi],dl | ||
897 | L018dj4: | ||
898 | mov DWORD PTR [edi],ecx | ||
899 | jmp $L019djend | ||
900 | L020dj3: | ||
901 | ror ecx, 16 | ||
902 | mov BYTE PTR 2[edi],cl | ||
903 | shl ecx, 16 | ||
904 | L021dj2: | ||
905 | mov BYTE PTR 1[esi],ch | ||
906 | L022dj1: | ||
907 | mov BYTE PTR [esi], cl | ||
908 | $L019djend: | ||
909 | jmp $L003finish | ||
910 | $L003finish: | ||
911 | mov ecx, DWORD PTR 60[esp] | ||
912 | add esp, 24 | ||
913 | mov DWORD PTR [ecx],eax | ||
914 | mov DWORD PTR 4[ecx],ebx | ||
915 | pop edi | ||
916 | pop esi | ||
917 | pop ebx | ||
918 | pop ebp | ||
919 | ret | ||
920 | $L004cbc_enc_jmp_table: | ||
921 | DD 0 | ||
922 | DD L012ej1 | ||
923 | DD L011ej2 | ||
924 | DD L010ej3 | ||
925 | DD L008ej4 | ||
926 | DD L007ej5 | ||
927 | DD L006ej6 | ||
928 | DD L005ej7 | ||
929 | L023cbc_dec_jmp_table: | ||
930 | DD 0 | ||
931 | DD L022dj1 | ||
932 | DD L021dj2 | ||
933 | DD L020dj3 | ||
934 | DD L018dj4 | ||
935 | DD L017dj5 | ||
936 | DD L016dj6 | ||
937 | DD L015dj7 | ||
938 | _CAST_cbc_encrypt ENDP | ||
939 | _TEXT ENDS | ||
940 | 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 @@ | |||
1 | /* Run the C pre-processor over this file with one of the following defined | ||
2 | * ELF - elf object files, | ||
3 | * OUT - a.out object files, | ||
4 | * BSDI - BSDI style a.out object files | ||
5 | * SOL - Solaris style elf | ||
6 | */ | ||
7 | |||
8 | #define TYPE(a,b) .type a,b | ||
9 | #define SIZE(a,b) .size a,b | ||
10 | |||
11 | #if defined(OUT) || defined(BSDI) | ||
12 | #define CAST_S_table0 _CAST_S_table0 | ||
13 | #define CAST_S_table1 _CAST_S_table1 | ||
14 | #define CAST_S_table2 _CAST_S_table2 | ||
15 | #define CAST_S_table3 _CAST_S_table3 | ||
16 | #define CAST_encrypt _CAST_encrypt | ||
17 | #define CAST_S_table0 _CAST_S_table0 | ||
18 | #define CAST_S_table1 _CAST_S_table1 | ||
19 | #define CAST_S_table2 _CAST_S_table2 | ||
20 | #define CAST_S_table3 _CAST_S_table3 | ||
21 | #define CAST_decrypt _CAST_decrypt | ||
22 | #define CAST_cbc_encrypt _CAST_cbc_encrypt | ||
23 | |||
24 | #endif | ||
25 | |||
26 | #ifdef OUT | ||
27 | #define OK 1 | ||
28 | #define ALIGN 4 | ||
29 | #endif | ||
30 | |||
31 | #ifdef BSDI | ||
32 | #define OK 1 | ||
33 | #define ALIGN 4 | ||
34 | #undef SIZE | ||
35 | #undef TYPE | ||
36 | #define SIZE(a,b) | ||
37 | #define TYPE(a,b) | ||
38 | #endif | ||
39 | |||
40 | #if defined(ELF) || defined(SOL) | ||
41 | #define OK 1 | ||
42 | #define ALIGN 16 | ||
43 | #endif | ||
44 | |||
45 | #ifndef OK | ||
46 | You need to define one of | ||
47 | ELF - elf systems - linux-elf, NetBSD and DG-UX | ||
48 | OUT - a.out systems - linux-a.out and FreeBSD | ||
49 | SOL - solaris systems, which are elf with strange comment lines | ||
50 | BSDI - a.out with a very primative version of as. | ||
51 | #endif | ||
52 | |||
53 | /* Let the Assembler begin :-) */ | ||
54 | /* Don't even think of reading this code */ | ||
55 | /* It was automatically generated by cast-586.pl */ | ||
56 | /* Which is a perl program used to generate the x86 assember for */ | ||
57 | /* any of elf, a.out, BSDI,Win32, or Solaris */ | ||
58 | /* eric <eay@cryptsoft.com> */ | ||
59 | |||
60 | .file "cast-586.s" | ||
61 | .version "01.01" | ||
62 | gcc2_compiled.: | ||
63 | .text | ||
64 | .align ALIGN | ||
65 | .globl CAST_encrypt | ||
66 | TYPE(CAST_encrypt,@function) | ||
67 | CAST_encrypt: | ||
68 | |||
69 | pushl %ebp | ||
70 | pushl %ebx | ||
71 | movl 12(%esp), %ebx | ||
72 | movl 16(%esp), %ebp | ||
73 | pushl %esi | ||
74 | pushl %edi | ||
75 | /* Load the 2 words */ | ||
76 | movl (%ebx), %edi | ||
77 | movl 4(%ebx), %esi | ||
78 | xorl %eax, %eax | ||
79 | /* round 0 */ | ||
80 | movl (%ebp), %edx | ||
81 | movl 4(%ebp), %ecx | ||
82 | addl %esi, %edx | ||
83 | roll %cl, %edx | ||
84 | movl %edx, %ebx | ||
85 | xorl %ecx, %ecx | ||
86 | movb %dh, %cl | ||
87 | andl $255, %ebx | ||
88 | shrl $16, %edx | ||
89 | xorl %eax, %eax | ||
90 | movb %dh, %al | ||
91 | andl $255, %edx | ||
92 | movl CAST_S_table0(,%ecx,4),%ecx | ||
93 | movl CAST_S_table1(,%ebx,4),%ebx | ||
94 | xorl %ebx, %ecx | ||
95 | movl CAST_S_table2(,%eax,4),%ebx | ||
96 | subl %ebx, %ecx | ||
97 | movl CAST_S_table3(,%edx,4),%ebx | ||
98 | addl %ebx, %ecx | ||
99 | xorl %ecx, %edi | ||
100 | /* round 1 */ | ||
101 | movl 8(%ebp), %edx | ||
102 | movl 12(%ebp), %ecx | ||
103 | xorl %edi, %edx | ||
104 | roll %cl, %edx | ||
105 | movl %edx, %ebx | ||
106 | xorl %ecx, %ecx | ||
107 | movb %dh, %cl | ||
108 | andl $255, %ebx | ||
109 | shrl $16, %edx | ||
110 | xorl %eax, %eax | ||
111 | movb %dh, %al | ||
112 | andl $255, %edx | ||
113 | movl CAST_S_table0(,%ecx,4),%ecx | ||
114 | movl CAST_S_table1(,%ebx,4),%ebx | ||
115 | subl %ebx, %ecx | ||
116 | movl CAST_S_table2(,%eax,4),%ebx | ||
117 | addl %ebx, %ecx | ||
118 | movl CAST_S_table3(,%edx,4),%ebx | ||
119 | xorl %ebx, %ecx | ||
120 | xorl %ecx, %esi | ||
121 | /* round 2 */ | ||
122 | movl 16(%ebp), %edx | ||
123 | movl 20(%ebp), %ecx | ||
124 | subl %esi, %edx | ||
125 | roll %cl, %edx | ||
126 | movl %edx, %ebx | ||
127 | xorl %ecx, %ecx | ||
128 | movb %dh, %cl | ||
129 | andl $255, %ebx | ||
130 | shrl $16, %edx | ||
131 | xorl %eax, %eax | ||
132 | movb %dh, %al | ||
133 | andl $255, %edx | ||
134 | movl CAST_S_table0(,%ecx,4),%ecx | ||
135 | movl CAST_S_table1(,%ebx,4),%ebx | ||
136 | addl %ebx, %ecx | ||
137 | movl CAST_S_table2(,%eax,4),%ebx | ||
138 | xorl %ebx, %ecx | ||
139 | movl CAST_S_table3(,%edx,4),%ebx | ||
140 | subl %ebx, %ecx | ||
141 | xorl %ecx, %edi | ||
142 | /* round 3 */ | ||
143 | movl 24(%ebp), %edx | ||
144 | movl 28(%ebp), %ecx | ||
145 | addl %edi, %edx | ||
146 | roll %cl, %edx | ||
147 | movl %edx, %ebx | ||
148 | xorl %ecx, %ecx | ||
149 | movb %dh, %cl | ||
150 | andl $255, %ebx | ||
151 | shrl $16, %edx | ||
152 | xorl %eax, %eax | ||
153 | movb %dh, %al | ||
154 | andl $255, %edx | ||
155 | movl CAST_S_table0(,%ecx,4),%ecx | ||
156 | movl CAST_S_table1(,%ebx,4),%ebx | ||
157 | xorl %ebx, %ecx | ||
158 | movl CAST_S_table2(,%eax,4),%ebx | ||
159 | subl %ebx, %ecx | ||
160 | movl CAST_S_table3(,%edx,4),%ebx | ||
161 | addl %ebx, %ecx | ||
162 | xorl %ecx, %esi | ||
163 | /* round 4 */ | ||
164 | movl 32(%ebp), %edx | ||
165 | movl 36(%ebp), %ecx | ||
166 | xorl %esi, %edx | ||
167 | roll %cl, %edx | ||
168 | movl %edx, %ebx | ||
169 | xorl %ecx, %ecx | ||
170 | movb %dh, %cl | ||
171 | andl $255, %ebx | ||
172 | shrl $16, %edx | ||
173 | xorl %eax, %eax | ||
174 | movb %dh, %al | ||
175 | andl $255, %edx | ||
176 | movl CAST_S_table0(,%ecx,4),%ecx | ||
177 | movl CAST_S_table1(,%ebx,4),%ebx | ||
178 | subl %ebx, %ecx | ||
179 | movl CAST_S_table2(,%eax,4),%ebx | ||
180 | addl %ebx, %ecx | ||
181 | movl CAST_S_table3(,%edx,4),%ebx | ||
182 | xorl %ebx, %ecx | ||
183 | xorl %ecx, %edi | ||
184 | /* round 5 */ | ||
185 | movl 40(%ebp), %edx | ||
186 | movl 44(%ebp), %ecx | ||
187 | subl %edi, %edx | ||
188 | roll %cl, %edx | ||
189 | movl %edx, %ebx | ||
190 | xorl %ecx, %ecx | ||
191 | movb %dh, %cl | ||
192 | andl $255, %ebx | ||
193 | shrl $16, %edx | ||
194 | xorl %eax, %eax | ||
195 | movb %dh, %al | ||
196 | andl $255, %edx | ||
197 | movl CAST_S_table0(,%ecx,4),%ecx | ||
198 | movl CAST_S_table1(,%ebx,4),%ebx | ||
199 | addl %ebx, %ecx | ||
200 | movl CAST_S_table2(,%eax,4),%ebx | ||
201 | xorl %ebx, %ecx | ||
202 | movl CAST_S_table3(,%edx,4),%ebx | ||
203 | subl %ebx, %ecx | ||
204 | xorl %ecx, %esi | ||
205 | /* round 6 */ | ||
206 | movl 48(%ebp), %edx | ||
207 | movl 52(%ebp), %ecx | ||
208 | addl %esi, %edx | ||
209 | roll %cl, %edx | ||
210 | movl %edx, %ebx | ||
211 | xorl %ecx, %ecx | ||
212 | movb %dh, %cl | ||
213 | andl $255, %ebx | ||
214 | shrl $16, %edx | ||
215 | xorl %eax, %eax | ||
216 | movb %dh, %al | ||
217 | andl $255, %edx | ||
218 | movl CAST_S_table0(,%ecx,4),%ecx | ||
219 | movl CAST_S_table1(,%ebx,4),%ebx | ||
220 | xorl %ebx, %ecx | ||
221 | movl CAST_S_table2(,%eax,4),%ebx | ||
222 | subl %ebx, %ecx | ||
223 | movl CAST_S_table3(,%edx,4),%ebx | ||
224 | addl %ebx, %ecx | ||
225 | xorl %ecx, %edi | ||
226 | /* round 7 */ | ||
227 | movl 56(%ebp), %edx | ||
228 | movl 60(%ebp), %ecx | ||
229 | xorl %edi, %edx | ||
230 | roll %cl, %edx | ||
231 | movl %edx, %ebx | ||
232 | xorl %ecx, %ecx | ||
233 | movb %dh, %cl | ||
234 | andl $255, %ebx | ||
235 | shrl $16, %edx | ||
236 | xorl %eax, %eax | ||
237 | movb %dh, %al | ||
238 | andl $255, %edx | ||
239 | movl CAST_S_table0(,%ecx,4),%ecx | ||
240 | movl CAST_S_table1(,%ebx,4),%ebx | ||
241 | subl %ebx, %ecx | ||
242 | movl CAST_S_table2(,%eax,4),%ebx | ||
243 | addl %ebx, %ecx | ||
244 | movl CAST_S_table3(,%edx,4),%ebx | ||
245 | xorl %ebx, %ecx | ||
246 | xorl %ecx, %esi | ||
247 | /* round 8 */ | ||
248 | movl 64(%ebp), %edx | ||
249 | movl 68(%ebp), %ecx | ||
250 | subl %esi, %edx | ||
251 | roll %cl, %edx | ||
252 | movl %edx, %ebx | ||
253 | xorl %ecx, %ecx | ||
254 | movb %dh, %cl | ||
255 | andl $255, %ebx | ||
256 | shrl $16, %edx | ||
257 | xorl %eax, %eax | ||
258 | movb %dh, %al | ||
259 | andl $255, %edx | ||
260 | movl CAST_S_table0(,%ecx,4),%ecx | ||
261 | movl CAST_S_table1(,%ebx,4),%ebx | ||
262 | addl %ebx, %ecx | ||
263 | movl CAST_S_table2(,%eax,4),%ebx | ||
264 | xorl %ebx, %ecx | ||
265 | movl CAST_S_table3(,%edx,4),%ebx | ||
266 | subl %ebx, %ecx | ||
267 | xorl %ecx, %edi | ||
268 | /* round 9 */ | ||
269 | movl 72(%ebp), %edx | ||
270 | movl 76(%ebp), %ecx | ||
271 | addl %edi, %edx | ||
272 | roll %cl, %edx | ||
273 | movl %edx, %ebx | ||
274 | xorl %ecx, %ecx | ||
275 | movb %dh, %cl | ||
276 | andl $255, %ebx | ||
277 | shrl $16, %edx | ||
278 | xorl %eax, %eax | ||
279 | movb %dh, %al | ||
280 | andl $255, %edx | ||
281 | movl CAST_S_table0(,%ecx,4),%ecx | ||
282 | movl CAST_S_table1(,%ebx,4),%ebx | ||
283 | xorl %ebx, %ecx | ||
284 | movl CAST_S_table2(,%eax,4),%ebx | ||
285 | subl %ebx, %ecx | ||
286 | movl CAST_S_table3(,%edx,4),%ebx | ||
287 | addl %ebx, %ecx | ||
288 | xorl %ecx, %esi | ||
289 | /* round 10 */ | ||
290 | movl 80(%ebp), %edx | ||
291 | movl 84(%ebp), %ecx | ||
292 | xorl %esi, %edx | ||
293 | roll %cl, %edx | ||
294 | movl %edx, %ebx | ||
295 | xorl %ecx, %ecx | ||
296 | movb %dh, %cl | ||
297 | andl $255, %ebx | ||
298 | shrl $16, %edx | ||
299 | xorl %eax, %eax | ||
300 | movb %dh, %al | ||
301 | andl $255, %edx | ||
302 | movl CAST_S_table0(,%ecx,4),%ecx | ||
303 | movl CAST_S_table1(,%ebx,4),%ebx | ||
304 | subl %ebx, %ecx | ||
305 | movl CAST_S_table2(,%eax,4),%ebx | ||
306 | addl %ebx, %ecx | ||
307 | movl CAST_S_table3(,%edx,4),%ebx | ||
308 | xorl %ebx, %ecx | ||
309 | xorl %ecx, %edi | ||
310 | /* round 11 */ | ||
311 | movl 88(%ebp), %edx | ||
312 | movl 92(%ebp), %ecx | ||
313 | subl %edi, %edx | ||
314 | roll %cl, %edx | ||
315 | movl %edx, %ebx | ||
316 | xorl %ecx, %ecx | ||
317 | movb %dh, %cl | ||
318 | andl $255, %ebx | ||
319 | shrl $16, %edx | ||
320 | xorl %eax, %eax | ||
321 | movb %dh, %al | ||
322 | andl $255, %edx | ||
323 | movl CAST_S_table0(,%ecx,4),%ecx | ||
324 | movl CAST_S_table1(,%ebx,4),%ebx | ||
325 | addl %ebx, %ecx | ||
326 | movl CAST_S_table2(,%eax,4),%ebx | ||
327 | xorl %ebx, %ecx | ||
328 | movl CAST_S_table3(,%edx,4),%ebx | ||
329 | subl %ebx, %ecx | ||
330 | xorl %ecx, %esi | ||
331 | /* round 12 */ | ||
332 | movl 96(%ebp), %edx | ||
333 | movl 100(%ebp), %ecx | ||
334 | addl %esi, %edx | ||
335 | roll %cl, %edx | ||
336 | movl %edx, %ebx | ||
337 | xorl %ecx, %ecx | ||
338 | movb %dh, %cl | ||
339 | andl $255, %ebx | ||
340 | shrl $16, %edx | ||
341 | xorl %eax, %eax | ||
342 | movb %dh, %al | ||
343 | andl $255, %edx | ||
344 | movl CAST_S_table0(,%ecx,4),%ecx | ||
345 | movl CAST_S_table1(,%ebx,4),%ebx | ||
346 | xorl %ebx, %ecx | ||
347 | movl CAST_S_table2(,%eax,4),%ebx | ||
348 | subl %ebx, %ecx | ||
349 | movl CAST_S_table3(,%edx,4),%ebx | ||
350 | addl %ebx, %ecx | ||
351 | xorl %ecx, %edi | ||
352 | /* round 13 */ | ||
353 | movl 104(%ebp), %edx | ||
354 | movl 108(%ebp), %ecx | ||
355 | xorl %edi, %edx | ||
356 | roll %cl, %edx | ||
357 | movl %edx, %ebx | ||
358 | xorl %ecx, %ecx | ||
359 | movb %dh, %cl | ||
360 | andl $255, %ebx | ||
361 | shrl $16, %edx | ||
362 | xorl %eax, %eax | ||
363 | movb %dh, %al | ||
364 | andl $255, %edx | ||
365 | movl CAST_S_table0(,%ecx,4),%ecx | ||
366 | movl CAST_S_table1(,%ebx,4),%ebx | ||
367 | subl %ebx, %ecx | ||
368 | movl CAST_S_table2(,%eax,4),%ebx | ||
369 | addl %ebx, %ecx | ||
370 | movl CAST_S_table3(,%edx,4),%ebx | ||
371 | xorl %ebx, %ecx | ||
372 | xorl %ecx, %esi | ||
373 | /* round 14 */ | ||
374 | movl 112(%ebp), %edx | ||
375 | movl 116(%ebp), %ecx | ||
376 | subl %esi, %edx | ||
377 | roll %cl, %edx | ||
378 | movl %edx, %ebx | ||
379 | xorl %ecx, %ecx | ||
380 | movb %dh, %cl | ||
381 | andl $255, %ebx | ||
382 | shrl $16, %edx | ||
383 | xorl %eax, %eax | ||
384 | movb %dh, %al | ||
385 | andl $255, %edx | ||
386 | movl CAST_S_table0(,%ecx,4),%ecx | ||
387 | movl CAST_S_table1(,%ebx,4),%ebx | ||
388 | addl %ebx, %ecx | ||
389 | movl CAST_S_table2(,%eax,4),%ebx | ||
390 | xorl %ebx, %ecx | ||
391 | movl CAST_S_table3(,%edx,4),%ebx | ||
392 | subl %ebx, %ecx | ||
393 | xorl %ecx, %edi | ||
394 | /* round 15 */ | ||
395 | movl 120(%ebp), %edx | ||
396 | movl 124(%ebp), %ecx | ||
397 | addl %edi, %edx | ||
398 | roll %cl, %edx | ||
399 | movl %edx, %ebx | ||
400 | xorl %ecx, %ecx | ||
401 | movb %dh, %cl | ||
402 | andl $255, %ebx | ||
403 | shrl $16, %edx | ||
404 | xorl %eax, %eax | ||
405 | movb %dh, %al | ||
406 | andl $255, %edx | ||
407 | movl CAST_S_table0(,%ecx,4),%ecx | ||
408 | movl CAST_S_table1(,%ebx,4),%ebx | ||
409 | xorl %ebx, %ecx | ||
410 | movl CAST_S_table2(,%eax,4),%ebx | ||
411 | subl %ebx, %ecx | ||
412 | movl CAST_S_table3(,%edx,4),%ebx | ||
413 | addl %ebx, %ecx | ||
414 | movl 20(%esp), %eax | ||
415 | xorl %ecx, %esi | ||
416 | nop | ||
417 | movl %edi, 4(%eax) | ||
418 | movl %esi, (%eax) | ||
419 | popl %edi | ||
420 | popl %esi | ||
421 | popl %ebx | ||
422 | popl %ebp | ||
423 | ret | ||
424 | .CAST_encrypt_end: | ||
425 | SIZE(CAST_encrypt,.CAST_encrypt_end-CAST_encrypt) | ||
426 | .ident "CAST_encrypt" | ||
427 | .text | ||
428 | .align ALIGN | ||
429 | .globl CAST_decrypt | ||
430 | TYPE(CAST_decrypt,@function) | ||
431 | CAST_decrypt: | ||
432 | |||
433 | pushl %ebp | ||
434 | pushl %ebx | ||
435 | movl 12(%esp), %ebx | ||
436 | movl 16(%esp), %ebp | ||
437 | pushl %esi | ||
438 | pushl %edi | ||
439 | /* Load the 2 words */ | ||
440 | movl (%ebx), %edi | ||
441 | movl 4(%ebx), %esi | ||
442 | xorl %eax, %eax | ||
443 | /* round 15 */ | ||
444 | movl 120(%ebp), %edx | ||
445 | movl 124(%ebp), %ecx | ||
446 | addl %esi, %edx | ||
447 | roll %cl, %edx | ||
448 | movl %edx, %ebx | ||
449 | xorl %ecx, %ecx | ||
450 | movb %dh, %cl | ||
451 | andl $255, %ebx | ||
452 | shrl $16, %edx | ||
453 | xorl %eax, %eax | ||
454 | movb %dh, %al | ||
455 | andl $255, %edx | ||
456 | movl CAST_S_table0(,%ecx,4),%ecx | ||
457 | movl CAST_S_table1(,%ebx,4),%ebx | ||
458 | xorl %ebx, %ecx | ||
459 | movl CAST_S_table2(,%eax,4),%ebx | ||
460 | subl %ebx, %ecx | ||
461 | movl CAST_S_table3(,%edx,4),%ebx | ||
462 | addl %ebx, %ecx | ||
463 | xorl %ecx, %edi | ||
464 | /* round 14 */ | ||
465 | movl 112(%ebp), %edx | ||
466 | movl 116(%ebp), %ecx | ||
467 | subl %edi, %edx | ||
468 | roll %cl, %edx | ||
469 | movl %edx, %ebx | ||
470 | xorl %ecx, %ecx | ||
471 | movb %dh, %cl | ||
472 | andl $255, %ebx | ||
473 | shrl $16, %edx | ||
474 | xorl %eax, %eax | ||
475 | movb %dh, %al | ||
476 | andl $255, %edx | ||
477 | movl CAST_S_table0(,%ecx,4),%ecx | ||
478 | movl CAST_S_table1(,%ebx,4),%ebx | ||
479 | addl %ebx, %ecx | ||
480 | movl CAST_S_table2(,%eax,4),%ebx | ||
481 | xorl %ebx, %ecx | ||
482 | movl CAST_S_table3(,%edx,4),%ebx | ||
483 | subl %ebx, %ecx | ||
484 | xorl %ecx, %esi | ||
485 | /* round 13 */ | ||
486 | movl 104(%ebp), %edx | ||
487 | movl 108(%ebp), %ecx | ||
488 | xorl %esi, %edx | ||
489 | roll %cl, %edx | ||
490 | movl %edx, %ebx | ||
491 | xorl %ecx, %ecx | ||
492 | movb %dh, %cl | ||
493 | andl $255, %ebx | ||
494 | shrl $16, %edx | ||
495 | xorl %eax, %eax | ||
496 | movb %dh, %al | ||
497 | andl $255, %edx | ||
498 | movl CAST_S_table0(,%ecx,4),%ecx | ||
499 | movl CAST_S_table1(,%ebx,4),%ebx | ||
500 | subl %ebx, %ecx | ||
501 | movl CAST_S_table2(,%eax,4),%ebx | ||
502 | addl %ebx, %ecx | ||
503 | movl CAST_S_table3(,%edx,4),%ebx | ||
504 | xorl %ebx, %ecx | ||
505 | xorl %ecx, %edi | ||
506 | /* round 12 */ | ||
507 | movl 96(%ebp), %edx | ||
508 | movl 100(%ebp), %ecx | ||
509 | addl %edi, %edx | ||
510 | roll %cl, %edx | ||
511 | movl %edx, %ebx | ||
512 | xorl %ecx, %ecx | ||
513 | movb %dh, %cl | ||
514 | andl $255, %ebx | ||
515 | shrl $16, %edx | ||
516 | xorl %eax, %eax | ||
517 | movb %dh, %al | ||
518 | andl $255, %edx | ||
519 | movl CAST_S_table0(,%ecx,4),%ecx | ||
520 | movl CAST_S_table1(,%ebx,4),%ebx | ||
521 | xorl %ebx, %ecx | ||
522 | movl CAST_S_table2(,%eax,4),%ebx | ||
523 | subl %ebx, %ecx | ||
524 | movl CAST_S_table3(,%edx,4),%ebx | ||
525 | addl %ebx, %ecx | ||
526 | xorl %ecx, %esi | ||
527 | /* round 11 */ | ||
528 | movl 88(%ebp), %edx | ||
529 | movl 92(%ebp), %ecx | ||
530 | subl %esi, %edx | ||
531 | roll %cl, %edx | ||
532 | movl %edx, %ebx | ||
533 | xorl %ecx, %ecx | ||
534 | movb %dh, %cl | ||
535 | andl $255, %ebx | ||
536 | shrl $16, %edx | ||
537 | xorl %eax, %eax | ||
538 | movb %dh, %al | ||
539 | andl $255, %edx | ||
540 | movl CAST_S_table0(,%ecx,4),%ecx | ||
541 | movl CAST_S_table1(,%ebx,4),%ebx | ||
542 | addl %ebx, %ecx | ||
543 | movl CAST_S_table2(,%eax,4),%ebx | ||
544 | xorl %ebx, %ecx | ||
545 | movl CAST_S_table3(,%edx,4),%ebx | ||
546 | subl %ebx, %ecx | ||
547 | xorl %ecx, %edi | ||
548 | /* round 10 */ | ||
549 | movl 80(%ebp), %edx | ||
550 | movl 84(%ebp), %ecx | ||
551 | xorl %edi, %edx | ||
552 | roll %cl, %edx | ||
553 | movl %edx, %ebx | ||
554 | xorl %ecx, %ecx | ||
555 | movb %dh, %cl | ||
556 | andl $255, %ebx | ||
557 | shrl $16, %edx | ||
558 | xorl %eax, %eax | ||
559 | movb %dh, %al | ||
560 | andl $255, %edx | ||
561 | movl CAST_S_table0(,%ecx,4),%ecx | ||
562 | movl CAST_S_table1(,%ebx,4),%ebx | ||
563 | subl %ebx, %ecx | ||
564 | movl CAST_S_table2(,%eax,4),%ebx | ||
565 | addl %ebx, %ecx | ||
566 | movl CAST_S_table3(,%edx,4),%ebx | ||
567 | xorl %ebx, %ecx | ||
568 | xorl %ecx, %esi | ||
569 | /* round 9 */ | ||
570 | movl 72(%ebp), %edx | ||
571 | movl 76(%ebp), %ecx | ||
572 | addl %esi, %edx | ||
573 | roll %cl, %edx | ||
574 | movl %edx, %ebx | ||
575 | xorl %ecx, %ecx | ||
576 | movb %dh, %cl | ||
577 | andl $255, %ebx | ||
578 | shrl $16, %edx | ||
579 | xorl %eax, %eax | ||
580 | movb %dh, %al | ||
581 | andl $255, %edx | ||
582 | movl CAST_S_table0(,%ecx,4),%ecx | ||
583 | movl CAST_S_table1(,%ebx,4),%ebx | ||
584 | xorl %ebx, %ecx | ||
585 | movl CAST_S_table2(,%eax,4),%ebx | ||
586 | subl %ebx, %ecx | ||
587 | movl CAST_S_table3(,%edx,4),%ebx | ||
588 | addl %ebx, %ecx | ||
589 | xorl %ecx, %edi | ||
590 | /* round 8 */ | ||
591 | movl 64(%ebp), %edx | ||
592 | movl 68(%ebp), %ecx | ||
593 | subl %edi, %edx | ||
594 | roll %cl, %edx | ||
595 | movl %edx, %ebx | ||
596 | xorl %ecx, %ecx | ||
597 | movb %dh, %cl | ||
598 | andl $255, %ebx | ||
599 | shrl $16, %edx | ||
600 | xorl %eax, %eax | ||
601 | movb %dh, %al | ||
602 | andl $255, %edx | ||
603 | movl CAST_S_table0(,%ecx,4),%ecx | ||
604 | movl CAST_S_table1(,%ebx,4),%ebx | ||
605 | addl %ebx, %ecx | ||
606 | movl CAST_S_table2(,%eax,4),%ebx | ||
607 | xorl %ebx, %ecx | ||
608 | movl CAST_S_table3(,%edx,4),%ebx | ||
609 | subl %ebx, %ecx | ||
610 | xorl %ecx, %esi | ||
611 | /* round 7 */ | ||
612 | movl 56(%ebp), %edx | ||
613 | movl 60(%ebp), %ecx | ||
614 | xorl %esi, %edx | ||
615 | roll %cl, %edx | ||
616 | movl %edx, %ebx | ||
617 | xorl %ecx, %ecx | ||
618 | movb %dh, %cl | ||
619 | andl $255, %ebx | ||
620 | shrl $16, %edx | ||
621 | xorl %eax, %eax | ||
622 | movb %dh, %al | ||
623 | andl $255, %edx | ||
624 | movl CAST_S_table0(,%ecx,4),%ecx | ||
625 | movl CAST_S_table1(,%ebx,4),%ebx | ||
626 | subl %ebx, %ecx | ||
627 | movl CAST_S_table2(,%eax,4),%ebx | ||
628 | addl %ebx, %ecx | ||
629 | movl CAST_S_table3(,%edx,4),%ebx | ||
630 | xorl %ebx, %ecx | ||
631 | xorl %ecx, %edi | ||
632 | /* round 6 */ | ||
633 | movl 48(%ebp), %edx | ||
634 | movl 52(%ebp), %ecx | ||
635 | addl %edi, %edx | ||
636 | roll %cl, %edx | ||
637 | movl %edx, %ebx | ||
638 | xorl %ecx, %ecx | ||
639 | movb %dh, %cl | ||
640 | andl $255, %ebx | ||
641 | shrl $16, %edx | ||
642 | xorl %eax, %eax | ||
643 | movb %dh, %al | ||
644 | andl $255, %edx | ||
645 | movl CAST_S_table0(,%ecx,4),%ecx | ||
646 | movl CAST_S_table1(,%ebx,4),%ebx | ||
647 | xorl %ebx, %ecx | ||
648 | movl CAST_S_table2(,%eax,4),%ebx | ||
649 | subl %ebx, %ecx | ||
650 | movl CAST_S_table3(,%edx,4),%ebx | ||
651 | addl %ebx, %ecx | ||
652 | xorl %ecx, %esi | ||
653 | /* round 5 */ | ||
654 | movl 40(%ebp), %edx | ||
655 | movl 44(%ebp), %ecx | ||
656 | subl %esi, %edx | ||
657 | roll %cl, %edx | ||
658 | movl %edx, %ebx | ||
659 | xorl %ecx, %ecx | ||
660 | movb %dh, %cl | ||
661 | andl $255, %ebx | ||
662 | shrl $16, %edx | ||
663 | xorl %eax, %eax | ||
664 | movb %dh, %al | ||
665 | andl $255, %edx | ||
666 | movl CAST_S_table0(,%ecx,4),%ecx | ||
667 | movl CAST_S_table1(,%ebx,4),%ebx | ||
668 | addl %ebx, %ecx | ||
669 | movl CAST_S_table2(,%eax,4),%ebx | ||
670 | xorl %ebx, %ecx | ||
671 | movl CAST_S_table3(,%edx,4),%ebx | ||
672 | subl %ebx, %ecx | ||
673 | xorl %ecx, %edi | ||
674 | /* round 4 */ | ||
675 | movl 32(%ebp), %edx | ||
676 | movl 36(%ebp), %ecx | ||
677 | xorl %edi, %edx | ||
678 | roll %cl, %edx | ||
679 | movl %edx, %ebx | ||
680 | xorl %ecx, %ecx | ||
681 | movb %dh, %cl | ||
682 | andl $255, %ebx | ||
683 | shrl $16, %edx | ||
684 | xorl %eax, %eax | ||
685 | movb %dh, %al | ||
686 | andl $255, %edx | ||
687 | movl CAST_S_table0(,%ecx,4),%ecx | ||
688 | movl CAST_S_table1(,%ebx,4),%ebx | ||
689 | subl %ebx, %ecx | ||
690 | movl CAST_S_table2(,%eax,4),%ebx | ||
691 | addl %ebx, %ecx | ||
692 | movl CAST_S_table3(,%edx,4),%ebx | ||
693 | xorl %ebx, %ecx | ||
694 | xorl %ecx, %esi | ||
695 | /* round 3 */ | ||
696 | movl 24(%ebp), %edx | ||
697 | movl 28(%ebp), %ecx | ||
698 | addl %esi, %edx | ||
699 | roll %cl, %edx | ||
700 | movl %edx, %ebx | ||
701 | xorl %ecx, %ecx | ||
702 | movb %dh, %cl | ||
703 | andl $255, %ebx | ||
704 | shrl $16, %edx | ||
705 | xorl %eax, %eax | ||
706 | movb %dh, %al | ||
707 | andl $255, %edx | ||
708 | movl CAST_S_table0(,%ecx,4),%ecx | ||
709 | movl CAST_S_table1(,%ebx,4),%ebx | ||
710 | xorl %ebx, %ecx | ||
711 | movl CAST_S_table2(,%eax,4),%ebx | ||
712 | subl %ebx, %ecx | ||
713 | movl CAST_S_table3(,%edx,4),%ebx | ||
714 | addl %ebx, %ecx | ||
715 | xorl %ecx, %edi | ||
716 | /* round 2 */ | ||
717 | movl 16(%ebp), %edx | ||
718 | movl 20(%ebp), %ecx | ||
719 | subl %edi, %edx | ||
720 | roll %cl, %edx | ||
721 | movl %edx, %ebx | ||
722 | xorl %ecx, %ecx | ||
723 | movb %dh, %cl | ||
724 | andl $255, %ebx | ||
725 | shrl $16, %edx | ||
726 | xorl %eax, %eax | ||
727 | movb %dh, %al | ||
728 | andl $255, %edx | ||
729 | movl CAST_S_table0(,%ecx,4),%ecx | ||
730 | movl CAST_S_table1(,%ebx,4),%ebx | ||
731 | addl %ebx, %ecx | ||
732 | movl CAST_S_table2(,%eax,4),%ebx | ||
733 | xorl %ebx, %ecx | ||
734 | movl CAST_S_table3(,%edx,4),%ebx | ||
735 | subl %ebx, %ecx | ||
736 | xorl %ecx, %esi | ||
737 | /* round 1 */ | ||
738 | movl 8(%ebp), %edx | ||
739 | movl 12(%ebp), %ecx | ||
740 | xorl %esi, %edx | ||
741 | roll %cl, %edx | ||
742 | movl %edx, %ebx | ||
743 | xorl %ecx, %ecx | ||
744 | movb %dh, %cl | ||
745 | andl $255, %ebx | ||
746 | shrl $16, %edx | ||
747 | xorl %eax, %eax | ||
748 | movb %dh, %al | ||
749 | andl $255, %edx | ||
750 | movl CAST_S_table0(,%ecx,4),%ecx | ||
751 | movl CAST_S_table1(,%ebx,4),%ebx | ||
752 | subl %ebx, %ecx | ||
753 | movl CAST_S_table2(,%eax,4),%ebx | ||
754 | addl %ebx, %ecx | ||
755 | movl CAST_S_table3(,%edx,4),%ebx | ||
756 | xorl %ebx, %ecx | ||
757 | xorl %ecx, %edi | ||
758 | /* round 0 */ | ||
759 | movl (%ebp), %edx | ||
760 | movl 4(%ebp), %ecx | ||
761 | addl %edi, %edx | ||
762 | roll %cl, %edx | ||
763 | movl %edx, %ebx | ||
764 | xorl %ecx, %ecx | ||
765 | movb %dh, %cl | ||
766 | andl $255, %ebx | ||
767 | shrl $16, %edx | ||
768 | xorl %eax, %eax | ||
769 | movb %dh, %al | ||
770 | andl $255, %edx | ||
771 | movl CAST_S_table0(,%ecx,4),%ecx | ||
772 | movl CAST_S_table1(,%ebx,4),%ebx | ||
773 | xorl %ebx, %ecx | ||
774 | movl CAST_S_table2(,%eax,4),%ebx | ||
775 | subl %ebx, %ecx | ||
776 | movl CAST_S_table3(,%edx,4),%ebx | ||
777 | addl %ebx, %ecx | ||
778 | movl 20(%esp), %eax | ||
779 | xorl %ecx, %esi | ||
780 | nop | ||
781 | movl %edi, 4(%eax) | ||
782 | movl %esi, (%eax) | ||
783 | popl %edi | ||
784 | popl %esi | ||
785 | popl %ebx | ||
786 | popl %ebp | ||
787 | ret | ||
788 | .CAST_decrypt_end: | ||
789 | SIZE(CAST_decrypt,.CAST_decrypt_end-CAST_decrypt) | ||
790 | .ident "CAST_decrypt" | ||
791 | .text | ||
792 | .align ALIGN | ||
793 | .globl CAST_cbc_encrypt | ||
794 | TYPE(CAST_cbc_encrypt,@function) | ||
795 | CAST_cbc_encrypt: | ||
796 | |||
797 | pushl %ebp | ||
798 | pushl %ebx | ||
799 | pushl %esi | ||
800 | pushl %edi | ||
801 | movl 28(%esp), %ebp | ||
802 | /* getting iv ptr from parameter 4 */ | ||
803 | movl 36(%esp), %ebx | ||
804 | movl (%ebx), %esi | ||
805 | movl 4(%ebx), %edi | ||
806 | pushl %edi | ||
807 | pushl %esi | ||
808 | pushl %edi | ||
809 | pushl %esi | ||
810 | movl %esp, %ebx | ||
811 | movl 36(%esp), %esi | ||
812 | movl 40(%esp), %edi | ||
813 | /* getting encrypt flag from parameter 5 */ | ||
814 | movl 56(%esp), %ecx | ||
815 | /* get and push parameter 3 */ | ||
816 | movl 48(%esp), %eax | ||
817 | pushl %eax | ||
818 | pushl %ebx | ||
819 | cmpl $0, %ecx | ||
820 | jz .L000decrypt | ||
821 | andl $4294967288, %ebp | ||
822 | movl 8(%esp), %eax | ||
823 | movl 12(%esp), %ebx | ||
824 | jz .L001encrypt_finish | ||
825 | .L002encrypt_loop: | ||
826 | movl (%esi), %ecx | ||
827 | movl 4(%esi), %edx | ||
828 | xorl %ecx, %eax | ||
829 | xorl %edx, %ebx | ||
830 | .byte 15 | ||
831 | .byte 200 /* bswapl %eax */ | ||
832 | .byte 15 | ||
833 | .byte 203 /* bswapl %ebx */ | ||
834 | movl %eax, 8(%esp) | ||
835 | movl %ebx, 12(%esp) | ||
836 | call CAST_encrypt | ||
837 | movl 8(%esp), %eax | ||
838 | movl 12(%esp), %ebx | ||
839 | .byte 15 | ||
840 | .byte 200 /* bswapl %eax */ | ||
841 | .byte 15 | ||
842 | .byte 203 /* bswapl %ebx */ | ||
843 | movl %eax, (%edi) | ||
844 | movl %ebx, 4(%edi) | ||
845 | addl $8, %esi | ||
846 | addl $8, %edi | ||
847 | subl $8, %ebp | ||
848 | jnz .L002encrypt_loop | ||
849 | .L001encrypt_finish: | ||
850 | movl 52(%esp), %ebp | ||
851 | andl $7, %ebp | ||
852 | jz .L003finish | ||
853 | xorl %ecx, %ecx | ||
854 | xorl %edx, %edx | ||
855 | movl .L004cbc_enc_jmp_table(,%ebp,4),%ebp | ||
856 | jmp *%ebp | ||
857 | .L005ej7: | ||
858 | xorl %edx, %edx | ||
859 | movb 6(%esi), %dh | ||
860 | sall $8, %edx | ||
861 | .L006ej6: | ||
862 | movb 5(%esi), %dh | ||
863 | .L007ej5: | ||
864 | movb 4(%esi), %dl | ||
865 | .L008ej4: | ||
866 | movl (%esi), %ecx | ||
867 | jmp .L009ejend | ||
868 | .L010ej3: | ||
869 | movb 2(%esi), %ch | ||
870 | xorl %ecx, %ecx | ||
871 | sall $8, %ecx | ||
872 | .L011ej2: | ||
873 | movb 1(%esi), %ch | ||
874 | .L012ej1: | ||
875 | movb (%esi), %cl | ||
876 | .L009ejend: | ||
877 | xorl %ecx, %eax | ||
878 | xorl %edx, %ebx | ||
879 | .byte 15 | ||
880 | .byte 200 /* bswapl %eax */ | ||
881 | .byte 15 | ||
882 | .byte 203 /* bswapl %ebx */ | ||
883 | movl %eax, 8(%esp) | ||
884 | movl %ebx, 12(%esp) | ||
885 | call CAST_encrypt | ||
886 | movl 8(%esp), %eax | ||
887 | movl 12(%esp), %ebx | ||
888 | .byte 15 | ||
889 | .byte 200 /* bswapl %eax */ | ||
890 | .byte 15 | ||
891 | .byte 203 /* bswapl %ebx */ | ||
892 | movl %eax, (%edi) | ||
893 | movl %ebx, 4(%edi) | ||
894 | jmp .L003finish | ||
895 | .align ALIGN | ||
896 | .L000decrypt: | ||
897 | andl $4294967288, %ebp | ||
898 | movl 16(%esp), %eax | ||
899 | movl 20(%esp), %ebx | ||
900 | jz .L013decrypt_finish | ||
901 | .L014decrypt_loop: | ||
902 | movl (%esi), %eax | ||
903 | movl 4(%esi), %ebx | ||
904 | .byte 15 | ||
905 | .byte 200 /* bswapl %eax */ | ||
906 | .byte 15 | ||
907 | .byte 203 /* bswapl %ebx */ | ||
908 | movl %eax, 8(%esp) | ||
909 | movl %ebx, 12(%esp) | ||
910 | call CAST_decrypt | ||
911 | movl 8(%esp), %eax | ||
912 | movl 12(%esp), %ebx | ||
913 | .byte 15 | ||
914 | .byte 200 /* bswapl %eax */ | ||
915 | .byte 15 | ||
916 | .byte 203 /* bswapl %ebx */ | ||
917 | movl 16(%esp), %ecx | ||
918 | movl 20(%esp), %edx | ||
919 | xorl %eax, %ecx | ||
920 | xorl %ebx, %edx | ||
921 | movl (%esi), %eax | ||
922 | movl 4(%esi), %ebx | ||
923 | movl %ecx, (%edi) | ||
924 | movl %edx, 4(%edi) | ||
925 | movl %eax, 16(%esp) | ||
926 | movl %ebx, 20(%esp) | ||
927 | addl $8, %esi | ||
928 | addl $8, %edi | ||
929 | subl $8, %ebp | ||
930 | jnz .L014decrypt_loop | ||
931 | .L013decrypt_finish: | ||
932 | movl 52(%esp), %ebp | ||
933 | andl $7, %ebp | ||
934 | jz .L003finish | ||
935 | movl (%esi), %eax | ||
936 | movl 4(%esi), %ebx | ||
937 | .byte 15 | ||
938 | .byte 200 /* bswapl %eax */ | ||
939 | .byte 15 | ||
940 | .byte 203 /* bswapl %ebx */ | ||
941 | movl %eax, 8(%esp) | ||
942 | movl %ebx, 12(%esp) | ||
943 | call CAST_decrypt | ||
944 | movl 8(%esp), %eax | ||
945 | movl 12(%esp), %ebx | ||
946 | .byte 15 | ||
947 | .byte 200 /* bswapl %eax */ | ||
948 | .byte 15 | ||
949 | .byte 203 /* bswapl %ebx */ | ||
950 | movl 16(%esp), %ecx | ||
951 | movl 20(%esp), %edx | ||
952 | xorl %eax, %ecx | ||
953 | xorl %ebx, %edx | ||
954 | movl (%esi), %eax | ||
955 | movl 4(%esi), %ebx | ||
956 | .L015dj7: | ||
957 | rorl $16, %edx | ||
958 | movb %dl, 6(%edi) | ||
959 | shrl $16, %edx | ||
960 | .L016dj6: | ||
961 | movb %dh, 5(%edi) | ||
962 | .L017dj5: | ||
963 | movb %dl, 4(%edi) | ||
964 | .L018dj4: | ||
965 | movl %ecx, (%edi) | ||
966 | jmp .L019djend | ||
967 | .L020dj3: | ||
968 | rorl $16, %ecx | ||
969 | movb %cl, 2(%edi) | ||
970 | sall $16, %ecx | ||
971 | .L021dj2: | ||
972 | movb %ch, 1(%esi) | ||
973 | .L022dj1: | ||
974 | movb %cl, (%esi) | ||
975 | .L019djend: | ||
976 | jmp .L003finish | ||
977 | .align ALIGN | ||
978 | .L003finish: | ||
979 | movl 60(%esp), %ecx | ||
980 | addl $24, %esp | ||
981 | movl %eax, (%ecx) | ||
982 | movl %ebx, 4(%ecx) | ||
983 | popl %edi | ||
984 | popl %esi | ||
985 | popl %ebx | ||
986 | popl %ebp | ||
987 | ret | ||
988 | .align ALIGN | ||
989 | .L004cbc_enc_jmp_table: | ||
990 | .long 0 | ||
991 | .long .L012ej1 | ||
992 | .long .L011ej2 | ||
993 | .long .L010ej3 | ||
994 | .long .L008ej4 | ||
995 | .long .L007ej5 | ||
996 | .long .L006ej6 | ||
997 | .long .L005ej7 | ||
998 | .align ALIGN | ||
999 | .L023cbc_dec_jmp_table: | ||
1000 | .long 0 | ||
1001 | .long .L022dj1 | ||
1002 | .long .L021dj2 | ||
1003 | .long .L020dj3 | ||
1004 | .long .L018dj4 | ||
1005 | .long .L017dj5 | ||
1006 | .long .L016dj6 | ||
1007 | .long .L015dj7 | ||
1008 | .CAST_cbc_encrypt_end: | ||
1009 | SIZE(CAST_cbc_encrypt,.CAST_cbc_encrypt_end-CAST_cbc_encrypt) | ||
1010 | .ident "desasm.pl" | ||
diff --git a/src/lib/libcrypto/conf/Makefile.ssl b/src/lib/libcrypto/conf/Makefile.ssl new file mode 100644 index 0000000000..00e917aa44 --- /dev/null +++ b/src/lib/libcrypto/conf/Makefile.ssl | |||
@@ -0,0 +1,85 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/conf/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= conf | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | ERR=conf | ||
19 | ERRC=conf_err | ||
20 | GENERAL=Makefile | ||
21 | TEST= | ||
22 | APPS= | ||
23 | |||
24 | LIB=$(TOP)/libcrypto.a | ||
25 | LIBSRC= conf.c $(ERRC).c | ||
26 | |||
27 | LIBOBJ= conf.o $(ERRC).o | ||
28 | |||
29 | SRC= $(LIBSRC) | ||
30 | |||
31 | EXHEADER= conf.h | ||
32 | HEADER= conf_lcl.h $(EXHEADER) | ||
33 | |||
34 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
35 | |||
36 | top: | ||
37 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
38 | |||
39 | all: lib | ||
40 | |||
41 | lib: $(LIBOBJ) | ||
42 | $(AR) $(LIB) $(LIBOBJ) | ||
43 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
44 | @touch lib | ||
45 | |||
46 | files: | ||
47 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
48 | |||
49 | links: | ||
50 | /bin/rm -f Makefile | ||
51 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
52 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
53 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
54 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
55 | |||
56 | install: | ||
57 | @for i in $(EXHEADER) ; \ | ||
58 | do \ | ||
59 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
60 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
61 | done; | ||
62 | |||
63 | tags: | ||
64 | ctags $(SRC) | ||
65 | |||
66 | tests: | ||
67 | |||
68 | lint: | ||
69 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
70 | |||
71 | depend: | ||
72 | $(MAKEDEPEND) $(INCLUDES) $(LIBSRC) | ||
73 | |||
74 | dclean: | ||
75 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
76 | mv -f Makefile.new $(MAKEFILE) | ||
77 | |||
78 | clean: | ||
79 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
80 | |||
81 | errors: | ||
82 | perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h | ||
83 | perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c | ||
84 | |||
85 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | /* crypto/conf/conf.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include <errno.h> | ||
61 | #include "cryptlib.h" | ||
62 | #include "stack.h" | ||
63 | #include "lhash.h" | ||
64 | #include "conf.h" | ||
65 | #include "buffer.h" | ||
66 | #include "err.h" | ||
67 | |||
68 | #include "conf_lcl.h" | ||
69 | |||
70 | #ifndef NOPROTO | ||
71 | static void value_free_hash(CONF_VALUE *a, LHASH *conf); | ||
72 | static void value_free_stack(CONF_VALUE *a,LHASH *conf); | ||
73 | static unsigned long hash(CONF_VALUE *v); | ||
74 | static int cmp(CONF_VALUE *a,CONF_VALUE *b); | ||
75 | static char *eat_ws(char *p); | ||
76 | static char *eat_alpha_numeric(char *p); | ||
77 | static void clear_comments(char *p); | ||
78 | static int str_copy(LHASH *conf,char *section,char **to, char *from); | ||
79 | static char *scan_quote(char *p); | ||
80 | static CONF_VALUE *new_section(LHASH *conf,char *section); | ||
81 | static CONF_VALUE *get_section(LHASH *conf,char *section); | ||
82 | #else | ||
83 | static void value_free_hash(); | ||
84 | static void value_free_stack(); | ||
85 | static unsigned long hash(); | ||
86 | static int cmp(); | ||
87 | static char *eat_ws(); | ||
88 | static char *eat_alpha_numeric(); | ||
89 | static void clear_comments(); | ||
90 | static int str_copy(); | ||
91 | static char *scan_quote(); | ||
92 | static CONF_VALUE *new_section(); | ||
93 | static CONF_VALUE *get_section(); | ||
94 | #endif | ||
95 | |||
96 | #define scan_esc(p) ((*(++p) == '\0')?(p):(++p)) | ||
97 | |||
98 | char *CONF_version="CONF part of SSLeay 0.9.0b 29-Jun-1998"; | ||
99 | |||
100 | LHASH *CONF_load(h,file,line) | ||
101 | LHASH *h; | ||
102 | char *file; | ||
103 | long *line; | ||
104 | { | ||
105 | LHASH *ret=NULL; | ||
106 | FILE *in=NULL; | ||
107 | #define BUFSIZE 512 | ||
108 | int bufnum=0,i,ii; | ||
109 | BUF_MEM *buff=NULL; | ||
110 | char *s,*p,*end; | ||
111 | int again,n,eline=0; | ||
112 | CONF_VALUE *v=NULL,*vv,*tv; | ||
113 | CONF_VALUE *sv=NULL; | ||
114 | char *section=NULL,*buf; | ||
115 | STACK *section_sk=NULL,*ts; | ||
116 | char *start,*psection,*pname; | ||
117 | |||
118 | if ((buff=BUF_MEM_new()) == NULL) | ||
119 | { | ||
120 | CONFerr(CONF_F_CONF_LOAD,ERR_R_BUF_LIB); | ||
121 | goto err; | ||
122 | } | ||
123 | |||
124 | in=fopen(file,"rb"); | ||
125 | if (in == NULL) | ||
126 | { | ||
127 | SYSerr(SYS_F_FOPEN,get_last_sys_error()); | ||
128 | ERR_set_error_data(BUF_strdup(file), | ||
129 | ERR_TXT_MALLOCED|ERR_TXT_STRING); | ||
130 | CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB); | ||
131 | goto err; | ||
132 | } | ||
133 | |||
134 | section=(char *)Malloc(10); | ||
135 | if (section == NULL) | ||
136 | { | ||
137 | CONFerr(CONF_F_CONF_LOAD,ERR_R_MALLOC_FAILURE); | ||
138 | goto err; | ||
139 | } | ||
140 | strcpy(section,"default"); | ||
141 | |||
142 | if (h == NULL) | ||
143 | { | ||
144 | if ((ret=lh_new(hash,cmp)) == NULL) | ||
145 | { | ||
146 | CONFerr(CONF_F_CONF_LOAD,ERR_R_MALLOC_FAILURE); | ||
147 | goto err; | ||
148 | } | ||
149 | } | ||
150 | else | ||
151 | ret=h; | ||
152 | |||
153 | sv=new_section(ret,section); | ||
154 | if (sv == NULL) | ||
155 | { | ||
156 | CONFerr(CONF_F_CONF_LOAD,CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | ||
157 | goto err; | ||
158 | } | ||
159 | section_sk=(STACK *)sv->value; | ||
160 | |||
161 | bufnum=0; | ||
162 | for (;;) | ||
163 | { | ||
164 | again=0; | ||
165 | if (!BUF_MEM_grow(buff,bufnum+BUFSIZE)) | ||
166 | { | ||
167 | CONFerr(CONF_F_CONF_LOAD,ERR_R_BUF_LIB); | ||
168 | goto err; | ||
169 | } | ||
170 | p= &(buff->data[bufnum]); | ||
171 | *p='\0'; | ||
172 | fgets(p,BUFSIZE-1,in); | ||
173 | p[BUFSIZE-1]='\0'; | ||
174 | ii=i=strlen(p); | ||
175 | if (i == 0) break; | ||
176 | while (i > 0) | ||
177 | { | ||
178 | if ((p[i-1] != '\r') && (p[i-1] != '\n')) | ||
179 | break; | ||
180 | else | ||
181 | i--; | ||
182 | } | ||
183 | /* we removed some trailing stuff so there is a new | ||
184 | * line on the end. */ | ||
185 | if (i == ii) | ||
186 | again=1; /* long line */ | ||
187 | else | ||
188 | { | ||
189 | p[i]='\0'; | ||
190 | eline++; /* another input line */ | ||
191 | } | ||
192 | |||
193 | /* we now have a line with trailing \r\n removed */ | ||
194 | |||
195 | /* i is the number of bytes */ | ||
196 | bufnum+=i; | ||
197 | |||
198 | v=NULL; | ||
199 | /* check for line continuation */ | ||
200 | if (bufnum >= 1) | ||
201 | { | ||
202 | /* If we have bytes and the last char '\\' and | ||
203 | * second last char is not '\\' */ | ||
204 | p= &(buff->data[bufnum-1]); | ||
205 | if ( IS_ESC(p[0]) && | ||
206 | ((bufnum <= 1) || !IS_ESC(p[-1]))) | ||
207 | { | ||
208 | bufnum--; | ||
209 | again=1; | ||
210 | } | ||
211 | } | ||
212 | if (again) continue; | ||
213 | bufnum=0; | ||
214 | buf=buff->data; | ||
215 | |||
216 | clear_comments(buf); | ||
217 | n=strlen(buf); | ||
218 | s=eat_ws(buf); | ||
219 | if (IS_EOF(*s)) continue; /* blank line */ | ||
220 | if (*s == '[') | ||
221 | { | ||
222 | s++; | ||
223 | start=eat_ws(s); | ||
224 | end=eat_alpha_numeric(start); | ||
225 | p=eat_ws(end); | ||
226 | if (*p != ']') | ||
227 | { | ||
228 | CONFerr(CONF_F_CONF_LOAD,CONF_R_MISSING_CLOSE_SQUARE_BRACKET); | ||
229 | goto err; | ||
230 | } | ||
231 | *end='\0'; | ||
232 | if (!str_copy(ret,NULL,§ion,start)) goto err; | ||
233 | if ((sv=get_section(ret,section)) == NULL) | ||
234 | sv=new_section(ret,section); | ||
235 | if (sv == NULL) | ||
236 | { | ||
237 | CONFerr(CONF_F_CONF_LOAD,CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | ||
238 | goto err; | ||
239 | } | ||
240 | section_sk=(STACK *)sv->value; | ||
241 | continue; | ||
242 | } | ||
243 | else | ||
244 | { | ||
245 | pname=s; | ||
246 | psection=NULL; | ||
247 | end=eat_alpha_numeric(s); | ||
248 | if ((end[0] == ':') && (end[1] == ':')) | ||
249 | { | ||
250 | *end='\0'; | ||
251 | end+=2; | ||
252 | psection=pname; | ||
253 | pname=end; | ||
254 | end=eat_alpha_numeric(end); | ||
255 | } | ||
256 | p=eat_ws(end); | ||
257 | if (*p != '=') | ||
258 | { | ||
259 | CONFerr(CONF_F_CONF_LOAD,CONF_R_MISSING_EQUAL_SIGN); | ||
260 | goto err; | ||
261 | } | ||
262 | *end='\0'; | ||
263 | p++; | ||
264 | start=eat_ws(p); | ||
265 | while (!IS_EOF(*p)) | ||
266 | p++; | ||
267 | p--; | ||
268 | while ((p != start) && (IS_WS(*p))) | ||
269 | p--; | ||
270 | p++; | ||
271 | *p='\0'; | ||
272 | |||
273 | if ((v=(CONF_VALUE *)Malloc(sizeof(CONF_VALUE))) == NULL) | ||
274 | { | ||
275 | CONFerr(CONF_F_CONF_LOAD,ERR_R_MALLOC_FAILURE); | ||
276 | goto err; | ||
277 | } | ||
278 | if (psection == NULL) psection=section; | ||
279 | v->name=(char *)Malloc(strlen(pname)+1); | ||
280 | v->value=NULL; | ||
281 | if (v->name == NULL) | ||
282 | { | ||
283 | CONFerr(CONF_F_CONF_LOAD,ERR_R_MALLOC_FAILURE); | ||
284 | goto err; | ||
285 | } | ||
286 | strcpy(v->name,pname); | ||
287 | if (!str_copy(ret,psection,&(v->value),start)) goto err; | ||
288 | |||
289 | if (strcmp(psection,section) != 0) | ||
290 | { | ||
291 | if ((tv=get_section(ret,psection)) | ||
292 | == NULL) | ||
293 | tv=new_section(ret,psection); | ||
294 | if (tv == NULL) | ||
295 | { | ||
296 | CONFerr(CONF_F_CONF_LOAD,CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | ||
297 | goto err; | ||
298 | } | ||
299 | ts=(STACK *)tv->value; | ||
300 | } | ||
301 | else | ||
302 | { | ||
303 | tv=sv; | ||
304 | ts=section_sk; | ||
305 | } | ||
306 | v->section=tv->section; | ||
307 | if (!sk_push(ts,(char *)v)) | ||
308 | { | ||
309 | CONFerr(CONF_F_CONF_LOAD,ERR_R_MALLOC_FAILURE); | ||
310 | goto err; | ||
311 | } | ||
312 | vv=(CONF_VALUE *)lh_insert(ret,(char *)v); | ||
313 | if (vv != NULL) | ||
314 | { | ||
315 | sk_delete_ptr(ts,(char *)vv); | ||
316 | Free(vv->name); | ||
317 | Free(vv->value); | ||
318 | Free(vv); | ||
319 | } | ||
320 | v=NULL; | ||
321 | } | ||
322 | } | ||
323 | if (buff != NULL) BUF_MEM_free(buff); | ||
324 | if (section != NULL) Free(section); | ||
325 | if (in != NULL) fclose(in); | ||
326 | return(ret); | ||
327 | err: | ||
328 | if (buff != NULL) BUF_MEM_free(buff); | ||
329 | if (section != NULL) Free(section); | ||
330 | if (line != NULL) *line=eline; | ||
331 | if (in != NULL) fclose(in); | ||
332 | if ((h != ret) && (ret != NULL)) CONF_free(ret); | ||
333 | if (v != NULL) | ||
334 | { | ||
335 | if (v->name != NULL) Free(v->name); | ||
336 | if (v->value != NULL) Free(v->value); | ||
337 | if (v != NULL) Free(v); | ||
338 | } | ||
339 | return(NULL); | ||
340 | } | ||
341 | |||
342 | char *CONF_get_string(conf,section,name) | ||
343 | LHASH *conf; | ||
344 | char *section; | ||
345 | char *name; | ||
346 | { | ||
347 | CONF_VALUE *v,vv; | ||
348 | char *p; | ||
349 | |||
350 | if (name == NULL) return(NULL); | ||
351 | if (conf != NULL) | ||
352 | { | ||
353 | if (section != NULL) | ||
354 | { | ||
355 | vv.name=name; | ||
356 | vv.section=section; | ||
357 | v=(CONF_VALUE *)lh_retrieve(conf,(char *)&vv); | ||
358 | if (v != NULL) return(v->value); | ||
359 | if (strcmp(section,"ENV") == 0) | ||
360 | { | ||
361 | p=Getenv(name); | ||
362 | if (p != NULL) return(p); | ||
363 | } | ||
364 | } | ||
365 | vv.section="default"; | ||
366 | vv.name=name; | ||
367 | v=(CONF_VALUE *)lh_retrieve(conf,(char *)&vv); | ||
368 | if (v != NULL) | ||
369 | return(v->value); | ||
370 | else | ||
371 | return(NULL); | ||
372 | } | ||
373 | else | ||
374 | return(Getenv(name)); | ||
375 | } | ||
376 | |||
377 | static CONF_VALUE *get_section(conf,section) | ||
378 | LHASH *conf; | ||
379 | char *section; | ||
380 | { | ||
381 | CONF_VALUE *v,vv; | ||
382 | |||
383 | if ((conf == NULL) || (section == NULL)) return(NULL); | ||
384 | vv.name=NULL; | ||
385 | vv.section=section; | ||
386 | v=(CONF_VALUE *)lh_retrieve(conf,(char *)&vv); | ||
387 | return(v); | ||
388 | } | ||
389 | |||
390 | STACK *CONF_get_section(conf,section) | ||
391 | LHASH *conf; | ||
392 | char *section; | ||
393 | { | ||
394 | CONF_VALUE *v; | ||
395 | |||
396 | v=get_section(conf,section); | ||
397 | if (v != NULL) | ||
398 | return((STACK *)v->value); | ||
399 | else | ||
400 | return(NULL); | ||
401 | } | ||
402 | |||
403 | long CONF_get_number(conf,section,name) | ||
404 | LHASH *conf; | ||
405 | char *section; | ||
406 | char *name; | ||
407 | { | ||
408 | char *str; | ||
409 | long ret=0; | ||
410 | |||
411 | str=CONF_get_string(conf,section,name); | ||
412 | if (str == NULL) return(0); | ||
413 | for (;;) | ||
414 | { | ||
415 | if (IS_NUMER(*str)) | ||
416 | ret=ret*10+(*str -'0'); | ||
417 | else | ||
418 | return(ret); | ||
419 | str++; | ||
420 | } | ||
421 | } | ||
422 | |||
423 | void CONF_free(conf) | ||
424 | LHASH *conf; | ||
425 | { | ||
426 | if (conf == NULL) return; | ||
427 | |||
428 | conf->down_load=0; /* evil thing to make sure the 'Free()' | ||
429 | * works as expected */ | ||
430 | lh_doall_arg(conf,(void (*)())value_free_hash,(char *)conf); | ||
431 | |||
432 | /* We now have only 'section' entries in the hash table. | ||
433 | * Due to problems with */ | ||
434 | |||
435 | lh_doall_arg(conf,(void (*)())value_free_stack,(char *)conf); | ||
436 | lh_free(conf); | ||
437 | } | ||
438 | |||
439 | static void value_free_hash(a,conf) | ||
440 | CONF_VALUE *a; | ||
441 | LHASH *conf; | ||
442 | { | ||
443 | if (a->name != NULL) | ||
444 | { | ||
445 | a=(CONF_VALUE *)lh_delete(conf,(char *)a); | ||
446 | } | ||
447 | } | ||
448 | |||
449 | static void value_free_stack(a,conf) | ||
450 | CONF_VALUE *a; | ||
451 | LHASH *conf; | ||
452 | { | ||
453 | CONF_VALUE *vv; | ||
454 | STACK *sk; | ||
455 | int i; | ||
456 | |||
457 | if (a->name != NULL) return; | ||
458 | |||
459 | sk=(STACK *)a->value; | ||
460 | for (i=sk_num(sk)-1; i>=0; i--) | ||
461 | { | ||
462 | vv=(CONF_VALUE *)sk_value(sk,i); | ||
463 | Free(vv->value); | ||
464 | Free(vv->name); | ||
465 | Free(vv); | ||
466 | } | ||
467 | if (sk != NULL) sk_free(sk); | ||
468 | Free(a->section); | ||
469 | Free(a); | ||
470 | } | ||
471 | |||
472 | static void clear_comments(p) | ||
473 | char *p; | ||
474 | { | ||
475 | char *to; | ||
476 | |||
477 | to=p; | ||
478 | for (;;) | ||
479 | { | ||
480 | if (IS_COMMENT(*p)) | ||
481 | { | ||
482 | *p='\0'; | ||
483 | return; | ||
484 | } | ||
485 | if (IS_QUOTE(*p)) | ||
486 | { | ||
487 | p=scan_quote(p); | ||
488 | continue; | ||
489 | } | ||
490 | if (IS_ESC(*p)) | ||
491 | { | ||
492 | p=scan_esc(p); | ||
493 | continue; | ||
494 | } | ||
495 | if (IS_EOF(*p)) | ||
496 | return; | ||
497 | else | ||
498 | p++; | ||
499 | } | ||
500 | } | ||
501 | |||
502 | static int str_copy(conf,section,pto,from) | ||
503 | LHASH *conf; | ||
504 | char *section; | ||
505 | char **pto,*from; | ||
506 | { | ||
507 | int q,r,rr=0,to=0,len=0; | ||
508 | char *s,*e,*rp,*p,*rrp,*np,*cp,v; | ||
509 | BUF_MEM *buf; | ||
510 | |||
511 | if ((buf=BUF_MEM_new()) == NULL) return(0); | ||
512 | |||
513 | len=strlen(from)+1; | ||
514 | if (!BUF_MEM_grow(buf,len)) goto err; | ||
515 | |||
516 | for (;;) | ||
517 | { | ||
518 | if (IS_QUOTE(*from)) | ||
519 | { | ||
520 | q= *from; | ||
521 | from++; | ||
522 | while ((*from != '\0') && (*from != q)) | ||
523 | { | ||
524 | if (*from == '\\') | ||
525 | { | ||
526 | from++; | ||
527 | if (*from == '\0') break; | ||
528 | } | ||
529 | buf->data[to++]= *(from++); | ||
530 | } | ||
531 | } | ||
532 | else if (*from == '\\') | ||
533 | { | ||
534 | from++; | ||
535 | v= *(from++); | ||
536 | if (v == '\0') break; | ||
537 | else if (v == 'r') v='\r'; | ||
538 | else if (v == 'n') v='\n'; | ||
539 | else if (v == 'b') v='\b'; | ||
540 | else if (v == 't') v='\t'; | ||
541 | buf->data[to++]= v; | ||
542 | } | ||
543 | else if (*from == '\0') | ||
544 | break; | ||
545 | else if (*from == '$') | ||
546 | { | ||
547 | /* try to expand it */ | ||
548 | rrp=NULL; | ||
549 | s= &(from[1]); | ||
550 | if (*s == '{') | ||
551 | q='}'; | ||
552 | else if (*s == '(') | ||
553 | q=')'; | ||
554 | else q=0; | ||
555 | |||
556 | if (q) s++; | ||
557 | cp=section; | ||
558 | e=np=s; | ||
559 | while (IS_ALPHA_NUMERIC(*e)) | ||
560 | e++; | ||
561 | if ((e[0] == ':') && (e[1] == ':')) | ||
562 | { | ||
563 | cp=np; | ||
564 | rrp=e; | ||
565 | rr= *e; | ||
566 | *rrp='\0'; | ||
567 | e+=2; | ||
568 | np=e; | ||
569 | while (IS_ALPHA_NUMERIC(*e)) | ||
570 | e++; | ||
571 | } | ||
572 | r= *e; | ||
573 | *e='\0'; | ||
574 | rp=e; | ||
575 | if (q) | ||
576 | { | ||
577 | if (r != q) | ||
578 | { | ||
579 | CONFerr(CONF_F_STR_COPY,CONF_R_NO_CLOSE_BRACE); | ||
580 | goto err; | ||
581 | } | ||
582 | e++; | ||
583 | } | ||
584 | /* So at this point we have | ||
585 | * ns which is the start of the name string which is | ||
586 | * '\0' terminated. | ||
587 | * cs which is the start of the section string which is | ||
588 | * '\0' terminated. | ||
589 | * e is the 'next point after'. | ||
590 | * r and s are the chars replaced by the '\0' | ||
591 | * rp and sp is where 'r' and 's' came from. | ||
592 | */ | ||
593 | p=CONF_get_string(conf,cp,np); | ||
594 | if (rrp != NULL) *rrp=rr; | ||
595 | *rp=r; | ||
596 | if (p == NULL) | ||
597 | { | ||
598 | CONFerr(CONF_F_STR_COPY,CONF_R_VARIABLE_HAS_NO_VALUE); | ||
599 | goto err; | ||
600 | } | ||
601 | BUF_MEM_grow(buf,(strlen(p)+len-(e-from))); | ||
602 | while (*p) | ||
603 | buf->data[to++]= *(p++); | ||
604 | from=e; | ||
605 | } | ||
606 | else | ||
607 | buf->data[to++]= *(from++); | ||
608 | } | ||
609 | buf->data[to]='\0'; | ||
610 | if (*pto != NULL) Free(*pto); | ||
611 | *pto=buf->data; | ||
612 | Free(buf); | ||
613 | return(1); | ||
614 | err: | ||
615 | if (buf != NULL) BUF_MEM_free(buf); | ||
616 | return(0); | ||
617 | } | ||
618 | |||
619 | static char *eat_ws(p) | ||
620 | char *p; | ||
621 | { | ||
622 | while (IS_WS(*p) && (!IS_EOF(*p))) | ||
623 | p++; | ||
624 | return(p); | ||
625 | } | ||
626 | |||
627 | static char *eat_alpha_numeric(p) | ||
628 | char *p; | ||
629 | { | ||
630 | for (;;) | ||
631 | { | ||
632 | if (IS_ESC(*p)) | ||
633 | { | ||
634 | p=scan_esc(p); | ||
635 | continue; | ||
636 | } | ||
637 | if (!IS_ALPHA_NUMERIC_PUNCT(*p)) | ||
638 | return(p); | ||
639 | p++; | ||
640 | } | ||
641 | } | ||
642 | |||
643 | static unsigned long hash(v) | ||
644 | CONF_VALUE *v; | ||
645 | { | ||
646 | return((lh_strhash(v->section)<<2)^lh_strhash(v->name)); | ||
647 | } | ||
648 | |||
649 | static int cmp(a,b) | ||
650 | CONF_VALUE *a,*b; | ||
651 | { | ||
652 | int i; | ||
653 | |||
654 | if (a->section != b->section) | ||
655 | { | ||
656 | i=strcmp(a->section,b->section); | ||
657 | if (i) return(i); | ||
658 | } | ||
659 | |||
660 | if ((a->name != NULL) && (b->name != NULL)) | ||
661 | { | ||
662 | i=strcmp(a->name,b->name); | ||
663 | return(i); | ||
664 | } | ||
665 | else if (a->name == b->name) | ||
666 | return(0); | ||
667 | else | ||
668 | return((a->name == NULL)?-1:1); | ||
669 | } | ||
670 | |||
671 | static char *scan_quote(p) | ||
672 | char *p; | ||
673 | { | ||
674 | int q= *p; | ||
675 | |||
676 | p++; | ||
677 | while (!(IS_EOF(*p)) && (*p != q)) | ||
678 | { | ||
679 | if (IS_ESC(*p)) | ||
680 | { | ||
681 | p++; | ||
682 | if (IS_EOF(*p)) return(p); | ||
683 | } | ||
684 | p++; | ||
685 | } | ||
686 | if (*p == q) p++; | ||
687 | return(p); | ||
688 | } | ||
689 | |||
690 | static CONF_VALUE *new_section(conf,section) | ||
691 | LHASH *conf; | ||
692 | char *section; | ||
693 | { | ||
694 | STACK *sk=NULL; | ||
695 | int ok=0,i; | ||
696 | CONF_VALUE *v=NULL,*vv; | ||
697 | |||
698 | if ((sk=sk_new_null()) == NULL) | ||
699 | goto err; | ||
700 | if ((v=(CONF_VALUE *)Malloc(sizeof(CONF_VALUE))) == NULL) | ||
701 | goto err; | ||
702 | i=strlen(section)+1; | ||
703 | if ((v->section=(char *)Malloc(i)) == NULL) | ||
704 | goto err; | ||
705 | |||
706 | memcpy(v->section,section,i); | ||
707 | v->name=NULL; | ||
708 | v->value=(char *)sk; | ||
709 | |||
710 | vv=(CONF_VALUE *)lh_insert(conf,(char *)v); | ||
711 | if (vv != NULL) | ||
712 | { | ||
713 | #if !defined(NO_STDIO) && !defined(WIN16) | ||
714 | fprintf(stderr,"internal fault\n"); | ||
715 | #endif | ||
716 | abort(); | ||
717 | } | ||
718 | ok=1; | ||
719 | err: | ||
720 | if (!ok) | ||
721 | { | ||
722 | if (sk != NULL) sk_free(sk); | ||
723 | if (v != NULL) Free(v); | ||
724 | v=NULL; | ||
725 | } | ||
726 | return(v); | ||
727 | } | ||
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 @@ | |||
1 | /* Error codes for the CONF functions. */ | ||
2 | |||
3 | /* Function codes. */ | ||
4 | #define CONF_F_CONF_LOAD 100 | ||
5 | #define CONF_F_STR_COPY 101 | ||
6 | |||
7 | /* Reason codes. */ | ||
8 | #define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 | ||
9 | #define CONF_R_MISSING_EQUAL_SIGN 101 | ||
10 | #define CONF_R_NO_CLOSE_BRACE 102 | ||
11 | #define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 | ||
12 | #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 @@ | |||
1 | /* crypto/conf/conf_lcl.h */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #define CONF_NUMBER 1 | ||
60 | #define CONF_UPPER 2 | ||
61 | #define CONF_LOWER 4 | ||
62 | #define CONF_UNDER 256 | ||
63 | #define CONF_PUNCTUATION 512 | ||
64 | #define CONF_WS 16 | ||
65 | #define CONF_ESC 32 | ||
66 | #define CONF_QUOTE 64 | ||
67 | #define CONF_COMMENT 128 | ||
68 | #define CONF_EOF 8 | ||
69 | #define CONF_ALPHA (CONF_UPPER|CONF_LOWER) | ||
70 | #define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER) | ||
71 | #define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \ | ||
72 | CONF_PUNCTUATION) | ||
73 | |||
74 | #define IS_COMMENT(a) (CONF_COMMENT&(CONF_type[(a)&0x7f])) | ||
75 | #define IS_EOF(a) ((a) == '\0') | ||
76 | #define IS_ESC(a) ((a) == '\\') | ||
77 | #define IS_NUMER(a) (CONF_type[(a)&0x7f]&CONF_NUMBER) | ||
78 | #define IS_WS(a) (CONF_type[(a)&0x7f]&CONF_WS) | ||
79 | #define IS_ALPHA_NUMERIC(a) (CONF_type[(a)&0x7f]&CONF_ALPHA_NUMERIC) | ||
80 | #define IS_ALPHA_NUMERIC_PUNCT(a) \ | ||
81 | (CONF_type[(a)&0x7f]&CONF_ALPHA_NUMERIC_PUNCT) | ||
82 | #define IS_QUOTE(a) (CONF_type[(a)&0x7f]&CONF_QUOTE) | ||
83 | |||
84 | static unsigned short CONF_type[128]={ | ||
85 | 0x008,0x000,0x000,0x000,0x000,0x000,0x000,0x000, | ||
86 | 0x000,0x010,0x010,0x000,0x000,0x010,0x000,0x000, | ||
87 | 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000, | ||
88 | 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000, | ||
89 | 0x010,0x200,0x040,0x080,0x000,0x200,0x200,0x040, | ||
90 | 0x000,0x000,0x200,0x200,0x200,0x200,0x200,0x200, | ||
91 | 0x001,0x001,0x001,0x001,0x001,0x001,0x001,0x001, | ||
92 | 0x001,0x001,0x000,0x200,0x000,0x000,0x000,0x200, | ||
93 | 0x200,0x002,0x002,0x002,0x002,0x002,0x002,0x002, | ||
94 | 0x002,0x002,0x002,0x002,0x002,0x002,0x002,0x002, | ||
95 | 0x002,0x002,0x002,0x002,0x002,0x002,0x002,0x002, | ||
96 | 0x002,0x002,0x002,0x000,0x020,0x000,0x200,0x100, | ||
97 | 0x040,0x004,0x004,0x004,0x004,0x004,0x004,0x004, | ||
98 | 0x004,0x004,0x004,0x004,0x004,0x004,0x004,0x004, | ||
99 | 0x004,0x004,0x004,0x004,0x004,0x004,0x004,0x004, | ||
100 | 0x004,0x004,0x004,0x000,0x200,0x000,0x200,0x000, | ||
101 | }; | ||
102 | |||
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 @@ | |||
1 | /* crypto/cryptall.h */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef HEADER_CRYPTOALL_H | ||
60 | #define HEADER_CRYPTOALL_H | ||
61 | |||
62 | #include "buffer.h" | ||
63 | #include "stack.h" | ||
64 | #include "lhash.h" | ||
65 | |||
66 | #include "err.h" | ||
67 | |||
68 | #ifdef NO_MD2 | ||
69 | #include <md2.h> | ||
70 | #else | ||
71 | #include "md2.h" | ||
72 | #endif | ||
73 | #ifdef NO_MD5 | ||
74 | #include <md5.h> | ||
75 | #else | ||
76 | #include "md5.h" | ||
77 | #endif | ||
78 | #include "sha.h" | ||
79 | |||
80 | #ifdef NO_DES | ||
81 | #include <des.h> | ||
82 | #else | ||
83 | #include "des.h" | ||
84 | #endif | ||
85 | #include "rc2.h" | ||
86 | #include "rc4.h" | ||
87 | #include "idea.h" | ||
88 | |||
89 | #include "bn.h" | ||
90 | #include "dh.h" | ||
91 | #include "rsa.h" | ||
92 | #include "dsa.h" | ||
93 | |||
94 | #include "rand.h" | ||
95 | #include "conf.h" | ||
96 | #include "txt_db.h" | ||
97 | |||
98 | #include "err.h" | ||
99 | #include "evp.h" | ||
100 | |||
101 | #include "meth.h" | ||
102 | #include "x509.h" | ||
103 | #include "pkcs7.h" | ||
104 | #include "pem.h" | ||
105 | #include "asn1.h" | ||
106 | #include "objects.h" | ||
107 | |||
108 | #include "crypto.h" | ||
109 | |||
110 | #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 @@ | |||
1 | /* crypto/crypto.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* If you are happy to use the assmbler version of bn/bn_mulw.c, define | ||
60 | * BN_ASM */ | ||
61 | #ifndef BN_ASM | ||
62 | #undef BN_ASM | ||
63 | #define X86_ASM | ||
64 | #endif | ||
65 | |||
66 | #ifndef DES_ASM | ||
67 | #undef DES_ASM | ||
68 | #endif | ||
69 | |||
70 | #ifndef BF_ASM | ||
71 | #undef BF_ASM | ||
72 | #endif | ||
73 | |||
74 | /* The following defines are only to break the compiles into chunks. | ||
75 | * If you wish to not compile some sections, use the 'NO_XXX' macros | ||
76 | */ | ||
77 | #ifndef CRYPTO_SUBSET | ||
78 | /* Define all subset symbols. */ | ||
79 | #define CRYPTO_LIB_SUBSET | ||
80 | #define CRYPTO_ASN1_SUBSET | ||
81 | #define CRYPTO_BN_SUBSET | ||
82 | #define CRYPTO_BUFFER_SUBSET | ||
83 | #define CRYPTO_BIO_SUBSET | ||
84 | #define CRYPTO_CONF_SUBSET | ||
85 | #define CRYPTO_DES_SUBSET | ||
86 | #define CRYPTO_DH_SUBSET | ||
87 | #define CRYPTO_DSA_SUBSET | ||
88 | #define CRYPTO_ERROR_SUBSET | ||
89 | #define CRYPTO_EVP_SUBSET | ||
90 | #define CRYPTO_IDEA_SUBSET | ||
91 | #define CRYPTO_LHASH_SUBSET | ||
92 | #define CRYPTO_MD_SUBSET | ||
93 | #define CRYPTO_MDC2_SUBSET | ||
94 | #define CRYPTO_METH_SUBSET | ||
95 | #define CRYPTO_OBJECTS_SUBSET | ||
96 | #define CRYPTO_PEM_SUBSET | ||
97 | #define CRYPTO_RAND_SUBSET | ||
98 | #define CRYPTO_RC_SUBSET | ||
99 | #define CRYPTO_BLOWFISH_SUBSET | ||
100 | #define CRYPTO_CAST_SUBSET | ||
101 | #define CRYPTO_RSA_SUBSET | ||
102 | #define CRYPTO_SHA_SUBSET | ||
103 | #define CRYPTO_HMAC_SUBSET | ||
104 | #define CRYPTO_SHA1_SUBSET | ||
105 | #define CRYPTO_STACK_SUBSET | ||
106 | #define CRYPTO_TXT_DB_SUBSET | ||
107 | #define CRYPTO_X509_SUBSET | ||
108 | #define CRYPTO_PKCS7_SUBSET | ||
109 | #endif | ||
110 | |||
111 | #include <stdio.h> | ||
112 | #include <stdlib.h> | ||
113 | #include <string.h> | ||
114 | |||
115 | #define USE_SOCKETS | ||
116 | #include "../e_os.h" | ||
117 | |||
118 | #include "buffer.h" | ||
119 | #include "bio.h" | ||
120 | #include "stack.h" | ||
121 | #include "lhash.h" | ||
122 | |||
123 | #include "err.h" | ||
124 | |||
125 | #include "bn.h" | ||
126 | #include "evp.h" | ||
127 | |||
128 | #include "rand.h" | ||
129 | #include "conf.h" | ||
130 | #include "txt_db.h" | ||
131 | |||
132 | #include "x509.h" | ||
133 | #include "pkcs7.h" | ||
134 | #include "pem.h" | ||
135 | #include "asn1.h" | ||
136 | #include "objects.h" | ||
137 | |||
138 | #ifdef CRYPTO_LIB_SUBSET | ||
139 | #include "cryptlib.c" | ||
140 | #include "mem.c" | ||
141 | #include "cversion.c" | ||
142 | #endif | ||
143 | |||
144 | #ifdef CRYPTO_ASN1_SUBSET | ||
145 | #include "asn1/a_meth.c" | ||
146 | #include "asn1/a_bitstr.c" | ||
147 | #include "asn1/a_d2i_fp.c" | ||
148 | #include "asn1/a_dup.c" | ||
149 | #include "asn1/a_hdr.c" | ||
150 | #include "asn1/a_i2d_fp.c" | ||
151 | #include "asn1/a_int.c" | ||
152 | #include "asn1/a_bool.c" | ||
153 | #include "asn1/a_bytes.c" | ||
154 | #include "asn1/a_object.c" | ||
155 | #include "asn1/a_octet.c" | ||
156 | #include "asn1/a_print.c" | ||
157 | #include "asn1/a_set.c" | ||
158 | #include "asn1/a_sign.c" | ||
159 | #include "asn1/a_type.c" | ||
160 | #include "asn1/a_utctm.c" | ||
161 | #include "asn1/a_verify.c" | ||
162 | #include "asn1/a_digest.c" | ||
163 | #include "asn1/asn1_err.c" | ||
164 | #include "asn1/asn1_lib.c" | ||
165 | #include "asn1/asn1_par.c" | ||
166 | #ifndef NO_DH | ||
167 | #include "asn1/d2i_dhp.c" | ||
168 | #include "asn1/i2d_dhp.c" | ||
169 | #endif | ||
170 | #ifndef NO_DSA | ||
171 | #include "asn1/d2i_dsap.c" | ||
172 | #include "asn1/i2d_dsap.c" | ||
173 | #include "asn1/d2i_s_pr.c" | ||
174 | #include "asn1/i2d_s_pr.c" | ||
175 | #include "asn1/d2i_s_pu.c" | ||
176 | #include "asn1/i2d_s_pu.c" | ||
177 | #endif | ||
178 | #ifndef NO_RSA | ||
179 | #include "asn1/d2i_r_pr.c" | ||
180 | #include "asn1/i2d_r_pr.c" | ||
181 | #include "asn1/d2i_r_pu.c" | ||
182 | #include "asn1/i2d_r_pu.c" | ||
183 | #include "asn1/n_pkey.c" | ||
184 | #endif | ||
185 | #include "asn1/d2i_pr.c" | ||
186 | #include "asn1/d2i_pu.c" | ||
187 | #include "asn1/i2d_pr.c" | ||
188 | #include "asn1/i2d_pu.c" | ||
189 | #include "asn1/f_int.c" | ||
190 | #include "asn1/f_string.c" | ||
191 | #include "asn1/p7_dgst.c" | ||
192 | #include "asn1/p7_enc.c" | ||
193 | #include "asn1/p7_enc_c.c" | ||
194 | #include "asn1/p7_evp.c" | ||
195 | #include "asn1/p7_i_s.c" | ||
196 | #include "asn1/p7_lib.c" | ||
197 | #include "asn1/p7_recip.c" | ||
198 | #include "asn1/p7_s_e.c" | ||
199 | #include "asn1/p7_signd.c" | ||
200 | #include "asn1/p7_signi.c" | ||
201 | #include "asn1/t_pkey.c" | ||
202 | #include "asn1/t_req.c" | ||
203 | #include "asn1/t_x509.c" | ||
204 | #include "asn1/x_algor.c" | ||
205 | #include "asn1/x_attrib.c" | ||
206 | #include "asn1/x_exten.c" | ||
207 | #include "asn1/x_cinf.c" | ||
208 | #include "asn1/x_crl.c" | ||
209 | #include "asn1/x_info.c" | ||
210 | #include "asn1/x_name.c" | ||
211 | #include "asn1/x_pkey.c" | ||
212 | #include "asn1/x_pubkey.c" | ||
213 | #include "asn1/x_req.c" | ||
214 | #include "asn1/x_sig.c" | ||
215 | #include "asn1/x_spki.c" | ||
216 | #include "asn1/x_val.c" | ||
217 | #include "asn1/x_x509.c" | ||
218 | #endif | ||
219 | |||
220 | #ifdef CRYPTO_BN_SUBSET | ||
221 | #include "bn/bn_add.c" | ||
222 | #include "bn/bn_div.c" | ||
223 | #include "bn/bn_exp.c" | ||
224 | #include "bn/bn_mont.c" | ||
225 | #include "bn/bn_recp.c" | ||
226 | #include "bn/bn_gcd.c" | ||
227 | #include "bn/bn_lib.c" | ||
228 | #include "bn/bn_mod.c" | ||
229 | #include "bn/bn_mul.c" | ||
230 | #ifndef BN_ASM | ||
231 | #include "bn/bn_mulw.c" | ||
232 | #endif | ||
233 | #include "bn/bn_prime.c" | ||
234 | #include "bn/bn_rand.c" | ||
235 | #include "bn/bn_shift.c" | ||
236 | #include "bn/bn_sqr.c" | ||
237 | #include "bn/bn_sub.c" | ||
238 | #include "bn/bn_word.c" | ||
239 | #include "bn/bn_print.c" | ||
240 | #include "bn/bn_err.c" | ||
241 | #include "bn/bn_blind.c" | ||
242 | #endif | ||
243 | |||
244 | #ifdef CRYPTO_BIO_SUBSET | ||
245 | #include "bio/bf_buff.c" | ||
246 | #include "bio/bf_null.c" | ||
247 | #include "bio/bf_nbio.c" | ||
248 | #include "bio/bio_cb.c" | ||
249 | #include "bio/bio_lib.c" | ||
250 | #include "bio/bss_fd.c" | ||
251 | #include "bio/bss_file.c" | ||
252 | #include "bio/bss_mem.c" | ||
253 | #include "bio/bss_null.c" | ||
254 | #ifdef VMS | ||
255 | #include "bio/bss_rtcp.c" | ||
256 | #endif | ||
257 | #include "bio/bss_sock.c" | ||
258 | #include "bio/bss_conn.c" | ||
259 | #include "bio/bss_acpt.c" | ||
260 | #include "bio/b_sock.c" | ||
261 | #include "bio/b_print.c" | ||
262 | #include "bio/b_dump.c" | ||
263 | #include "bio/bio_err.c" | ||
264 | #endif | ||
265 | |||
266 | #ifdef CRYPTO_BUFFER_SUBSET | ||
267 | #include "buffer/buf_err.c" | ||
268 | #include "buffer/buffer.c" | ||
269 | #endif | ||
270 | |||
271 | #ifdef CRYPTO_CONF_SUBSET | ||
272 | #include "conf/conf.c" | ||
273 | #include "conf/conf_err.c" | ||
274 | #endif | ||
275 | |||
276 | #ifdef CRYPTO_DES_SUBSET | ||
277 | #include "des/read_pwd.c" | ||
278 | #ifndef NO_DES | ||
279 | #ifndef DES_ASM | ||
280 | #include "des/fcrypt_b.c" | ||
281 | #include "des/des_enc.c" | ||
282 | #endif | ||
283 | #include "des/cbc_cksm.c" | ||
284 | #include "des/xcbc_enc.c" | ||
285 | #include "des/cbc_enc.c" | ||
286 | #include "des/cfb64ede.c" | ||
287 | #include "des/cfb64enc.c" | ||
288 | #include "des/cfb_enc.c" | ||
289 | #include "des/ecb3_enc.c" | ||
290 | #include "des/ecb_enc.c" | ||
291 | #include "des/enc_read.c" | ||
292 | #include "des/enc_writ.c" | ||
293 | #include "des/fcrypt.c" | ||
294 | #include "des/ofb64ede.c" | ||
295 | #include "des/ofb64enc.c" | ||
296 | #include "des/ofb_enc.c" | ||
297 | #include "des/pcbc_enc.c" | ||
298 | #include "des/qud_cksm.c" | ||
299 | #include "des/rand_key.c" | ||
300 | #include "des/read2pwd.c" | ||
301 | #include "des/rpc_enc.c" | ||
302 | #include "des/set_key.c" | ||
303 | #include "des/str2key.c" | ||
304 | #include "des/supp.c" | ||
305 | #endif | ||
306 | #endif | ||
307 | |||
308 | #ifdef CRYPTO_DH_SUBSET | ||
309 | #ifndef NO_DH | ||
310 | #include "dh/dh_check.c" | ||
311 | #include "dh/dh_err.c" | ||
312 | #include "dh/dh_gen.c" | ||
313 | #include "dh/dh_key.c" | ||
314 | #include "dh/dh_lib.c" | ||
315 | #endif | ||
316 | #endif | ||
317 | |||
318 | #ifdef CRYPTO_DSA_SUBSET | ||
319 | #ifndef NO_DSA | ||
320 | #include "dsa/dsa_gen.c" | ||
321 | #include "dsa/dsa_key.c" | ||
322 | #include "dsa/dsa_lib.c" | ||
323 | #include "dsa/dsa_sign.c" | ||
324 | #include "dsa/dsa_vrf.c" | ||
325 | #include "dsa/dsa_err.c" | ||
326 | #endif | ||
327 | #endif | ||
328 | |||
329 | #ifdef CRYPTO_ERROR_SUBSET | ||
330 | #include "err/err.c" | ||
331 | #include "err/err_all.c" | ||
332 | #include "err/err_prn.c" | ||
333 | #endif | ||
334 | |||
335 | #ifdef CRYPTO_EVP_SUBSET | ||
336 | #include "evp/bio_md.c" | ||
337 | #include "evp/bio_b64.c" | ||
338 | #include "evp/bio_enc.c" | ||
339 | #include "evp/c_all.c" | ||
340 | #include "evp/digest.c" | ||
341 | #ifndef NO_DES | ||
342 | #include "evp/e_cbc_3d.c" | ||
343 | #include "evp/e_cfb_3d.c" | ||
344 | #include "evp/e_ecb_3d.c" | ||
345 | #include "evp/e_ofb_3d.c" | ||
346 | #include "evp/e_cbc_d.c" | ||
347 | #include "evp/e_cfb_d.c" | ||
348 | #include "evp/e_xcbc_d.c" | ||
349 | #include "evp/e_ecb_d.c" | ||
350 | #include "evp/e_ofb_d.c" | ||
351 | #endif | ||
352 | #ifndef NO_IDEA | ||
353 | #include "evp/e_cbc_i.c" | ||
354 | #include "evp/e_cfb_i.c" | ||
355 | #include "evp/e_ecb_i.c" | ||
356 | #include "evp/e_ofb_i.c" | ||
357 | #endif | ||
358 | #ifndef NO_RC2 | ||
359 | #include "evp/e_cbc_r2.c" | ||
360 | #include "evp/e_cfb_r2.c" | ||
361 | #include "evp/e_ecb_r2.c" | ||
362 | #include "evp/e_ofb_r2.c" | ||
363 | #endif | ||
364 | #ifndef NO_BLOWFISH | ||
365 | #include "evp/e_cbc_bf.c" | ||
366 | #include "evp/e_cfb_bf.c" | ||
367 | #include "evp/e_ecb_bf.c" | ||
368 | #include "evp/e_ofb_bf.c" | ||
369 | #endif | ||
370 | #ifndef NO_CAST | ||
371 | #include "evp/e_cbc_c.c" | ||
372 | #include "evp/e_cfb_c.c" | ||
373 | #include "evp/e_ecb_c.c" | ||
374 | #include "evp/e_ofb_c.c" | ||
375 | #endif | ||
376 | #ifndef NO_RC4 | ||
377 | #include "evp/e_rc4.c" | ||
378 | #endif | ||
379 | #include "rc5/rc5_enc.c" | ||
380 | #include "rc5/rc5cfb64.c" | ||
381 | #include "rc5/rc5_ecb.c" | ||
382 | #include "rc5/rc5_skey.c" | ||
383 | #include "rc5/rc5ofb64.c" | ||
384 | #include "ripemd/rmd160.c" | ||
385 | #include "ripemd/rmd_dgst.c" | ||
386 | #include "ripemd/rmd_one.c" | ||
387 | #include "evp/evp_lib.c" | ||
388 | |||
389 | #include "evp/names.c" | ||
390 | #include "evp/e_null.c" | ||
391 | #include "evp/encode.c" | ||
392 | #include "evp/evp_enc.c" | ||
393 | #include "evp/evp_err.c" | ||
394 | #include "evp/evp_key.c" | ||
395 | #include "evp/m_null.c" | ||
396 | #include "evp/p_lib.c" | ||
397 | #ifndef NO_RSA | ||
398 | #include "evp/p_open.c" | ||
399 | #include "evp/p_seal.c" | ||
400 | #endif | ||
401 | #include "evp/p_sign.c" | ||
402 | #include "evp/p_verify.c" | ||
403 | #endif | ||
404 | |||
405 | #ifdef CRYPTO_IDEA_SUBSET | ||
406 | #ifndef NO_IDEA | ||
407 | #include "idea/i_cbc.c" | ||
408 | #include "idea/i_cfb64.c" | ||
409 | #include "idea/i_ecb.c" | ||
410 | #include "idea/i_ofb64.c" | ||
411 | #include "idea/i_skey.c" | ||
412 | #endif | ||
413 | #endif | ||
414 | |||
415 | #ifdef CRYPTO_BLOWFISH_SUBSET | ||
416 | #ifndef NO_BLOWFISH | ||
417 | #include "bf/bf_cfb64.c" | ||
418 | #include "bf/bf_ecb.c" | ||
419 | #ifndef BF_ASM | ||
420 | #include "bf/bf_enc.c" | ||
421 | #endif | ||
422 | #include "bf/bf_ofb64.c" | ||
423 | #include "bf/bf_skey.c" | ||
424 | #endif | ||
425 | #endif | ||
426 | |||
427 | #ifdef CRYPTO_CAST_SUBSET | ||
428 | #ifndef NO_CAST | ||
429 | #include "cast/c_cfb64.c" | ||
430 | #include "cast/c_ecb.c" | ||
431 | #ifndef CAST_ASM | ||
432 | #include "cast/c_enc.c" | ||
433 | #endif | ||
434 | #include "cast/c_ofb64.c" | ||
435 | #include "cast/c_skey.c" | ||
436 | #endif | ||
437 | #endif | ||
438 | |||
439 | #ifdef CRYPTO_LHASH_SUBSET | ||
440 | #include "lhash/lh_stats.c" | ||
441 | #include "lhash/lhash.c" | ||
442 | #endif | ||
443 | |||
444 | #ifdef CRYPTO_MD_SUBSET | ||
445 | #ifndef NO_MD2 | ||
446 | #include "md2/md2_dgst.c" | ||
447 | #include "md2/md2_one.c" | ||
448 | #include "evp/m_md2.c" | ||
449 | #endif | ||
450 | #ifndef NO_MD5 | ||
451 | #include "md5/md5_dgst.c" | ||
452 | #include "md5/md5_one.c" | ||
453 | #include "evp/m_md5.c" | ||
454 | #endif | ||
455 | #endif | ||
456 | |||
457 | #ifdef CRYPTO_MDC2_SUBSET | ||
458 | #ifndef NO_MDC2 | ||
459 | #include "mdc2/mdc2dgst.c" | ||
460 | #include "mdc2/mdc2_one.c" | ||
461 | #include "evp/m_mdc2.c" | ||
462 | #endif | ||
463 | #endif | ||
464 | |||
465 | #ifdef CRYPTO_OBJECTS_SUBSET | ||
466 | #include "objects/obj_dat.c" | ||
467 | #include "objects/obj_err.c" | ||
468 | #include "objects/obj_lib.c" | ||
469 | #endif | ||
470 | |||
471 | #ifdef CRYPTO_PEM_SUBSET | ||
472 | #include "pem/pem_err.c" | ||
473 | #include "pem/pem_info.c" | ||
474 | #include "pem/pem_lib.c" | ||
475 | #include "pem/pem_all.c" | ||
476 | #ifndef NO_RSA | ||
477 | #include "pem/pem_seal.c" | ||
478 | #include "pem/pem_sign.c" | ||
479 | #endif | ||
480 | #endif | ||
481 | |||
482 | #ifdef CRYPTO_RAND_SUBSET | ||
483 | #include "rand/md_rand.c" | ||
484 | #include "rand/randfile.c" | ||
485 | #endif | ||
486 | |||
487 | #ifdef CRYPTO_RC_SUBSET | ||
488 | #ifndef NO_RC2 | ||
489 | #include "rc2/rc2_cbc.c" | ||
490 | #include "rc2/rc2_ecb.c" | ||
491 | #include "rc2/rc2_skey.c" | ||
492 | #include "rc2/rc2cfb64.c" | ||
493 | #include "rc2/rc2ofb64.c" | ||
494 | #endif | ||
495 | #ifndef NO_RC4 | ||
496 | #include "rc4/rc4_skey.c" | ||
497 | #ifndef RC4_ASM | ||
498 | #include "rc4/rc4_enc.c" | ||
499 | #endif | ||
500 | #endif | ||
501 | #endif | ||
502 | |||
503 | #ifdef CRYPTO_HMAC_SUBSET | ||
504 | #include "hmac/hmac.c" | ||
505 | #endif | ||
506 | |||
507 | #ifdef CRYPTO_RSA_SUBSET | ||
508 | #ifndef NO_RSA | ||
509 | #include "rsa/rsa_eay.c" | ||
510 | #include "rsa/rsa_err.c" | ||
511 | #include "rsa/rsa_gen.c" | ||
512 | #include "rsa/rsa_lib.c" | ||
513 | #include "rsa/rsa_sign.c" | ||
514 | #include "rsa/rsa_saos.c" | ||
515 | #endif | ||
516 | #endif | ||
517 | |||
518 | #ifdef CRYPTO_SHA1_SUBSET | ||
519 | #ifndef NO_SHA1 | ||
520 | #include "sha/sha1_one.c" | ||
521 | #include "sha/sha1dgst.c" | ||
522 | #include "evp/m_dss1.c" | ||
523 | #include "evp/m_sha1.c" | ||
524 | #endif | ||
525 | #endif | ||
526 | |||
527 | #ifdef CRYPTO_SHA_SUBSET | ||
528 | #ifndef NO_SHA | ||
529 | #include "evp/m_dss.c" | ||
530 | #include "sha/sha_dgst.c" | ||
531 | #include "sha/sha_one.c" | ||
532 | #include "evp/m_sha.c" | ||
533 | #endif | ||
534 | #endif | ||
535 | |||
536 | #ifdef CRYPTO_STACK_SUBSET | ||
537 | #include "stack/stack.c" | ||
538 | #endif | ||
539 | |||
540 | #ifdef CRYPTO_TXT_DB_SUBSET | ||
541 | #include "txt_db/txt_db.c" | ||
542 | #endif | ||
543 | |||
544 | #ifdef CRYPTO_X509_SUBSET | ||
545 | #include "x509/x509_cmp.c" | ||
546 | #include "x509/x509_d2.c" | ||
547 | #include "x509/x509_def.c" | ||
548 | #include "x509/x509_err.c" | ||
549 | #include "x509/x509_ext.c" | ||
550 | #include "x509/x509_lu.c" | ||
551 | #include "x509/x509_obj.c" | ||
552 | #include "x509/x509_r2x.c" | ||
553 | #include "x509/x509_req.c" | ||
554 | #include "x509/x509_set.c" | ||
555 | #include "x509/x509_v3.c" | ||
556 | #include "x509/x509_vfy.c" | ||
557 | #include "x509/x509name.c" | ||
558 | #include "x509/x509pack.c" | ||
559 | #include "x509/x509rset.c" | ||
560 | #include "x509/x509type.c" | ||
561 | #include "x509/x_all.c" | ||
562 | #include "x509/x509_txt.c" | ||
563 | #include "x509/by_dir.c" | ||
564 | #include "x509/by_file.c" | ||
565 | #include "x509/v3_net.c" | ||
566 | #include "x509/v3_x509.c" | ||
567 | #endif | ||
568 | |||
569 | |||
570 | #ifdef CRYPTO_PKCS7_SUBSET /* I have an explicit removal of 7 lines */ | ||
571 | #include "pkcs7/pk7_lib.c" | ||
572 | #include "pkcs7/pkcs7err.c" | ||
573 | #include "pkcs7/pk7_doit.c" | ||
574 | #endif /* CRYPTO_PKCS7_SUBSET */ | ||
575 | |||
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 @@ | |||
1 | /* Error codes for the CRYPTO functions. */ | ||
2 | |||
3 | /* Function codes. */ | ||
4 | #define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 | ||
5 | #define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101 | ||
6 | #define CRYPTO_F_CRYPTO_SET_EX_DATA 102 | ||
7 | |||
8 | /* 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 @@ | |||
1 | crypt <= crypt(buf,salt) | ||
2 | key <= set_odd_parity(key) | ||
3 | int <= is_weak_key(key) | ||
4 | keysched<= set_key(key) | ||
5 | key <= ecb_encrypt(string8,ks,enc) | ||
6 | key <= ecb3_encrypt(input,ks1,ks2,enc) | ||
7 | string <= cbc_encrypt(input,ks,ivec,enc) => ivec | ||
8 | string <= cbc3_encrypt(input,ks1,ks2,ivec1,ivec2,enc) => ivec1&ivec2 | ||
9 | ck1,ck2 <= cbc_cksum(input,ks,ivec) => ivec | ||
10 | string <= pcbc_encrypt(input,ks,ivec,enc) => ivec | ||
11 | string <= ofb_encrypt(input,numbits,ks,ivec) => ivec | ||
12 | string <= cfb_encrypt(input,numbits,ks,ivec,enc) => ivec | ||
13 | key <= random_key() | ||
14 | key <= string_to_key(string) | ||
15 | key1,key2<= string_to_2keys(string) | ||
16 | |||
diff --git a/src/lib/libcrypto/des/FILES b/src/lib/libcrypto/des/FILES new file mode 100644 index 0000000000..4c7ea2de7a --- /dev/null +++ b/src/lib/libcrypto/des/FILES | |||
@@ -0,0 +1,96 @@ | |||
1 | /* General stuff */ | ||
2 | COPYRIGHT - Copyright info. | ||
3 | MODES.DES - A description of the features of the different modes of DES. | ||
4 | FILES - This file. | ||
5 | INSTALL - How to make things compile. | ||
6 | Imakefile - For use with kerberos. | ||
7 | README - What this package is. | ||
8 | VERSION - Which version this is and what was changed. | ||
9 | KERBEROS - Kerberos version 4 notes. | ||
10 | Makefile.PL - An old makefile to build with perl5, not current. | ||
11 | Makefile.ssl - The SSLeay makefile | ||
12 | Makefile.uni - The normal unix makefile. | ||
13 | GNUmakefile - The makefile for use with glibc. | ||
14 | makefile.bc - A Borland C makefile | ||
15 | times - Some outputs from 'speed' on some machines. | ||
16 | vms.com - For use when compiling under VMS | ||
17 | |||
18 | /* My SunOS des(1) replacement */ | ||
19 | des.c - des(1) source code. | ||
20 | des.man - des(1) manual. | ||
21 | |||
22 | /* Testing and timing programs. */ | ||
23 | destest.c - Source for libdes.a test program. | ||
24 | speed.c - Source for libdes.a timing program. | ||
25 | rpw.c - Source for libdes.a testing password reading routines. | ||
26 | |||
27 | /* libdes.a source code */ | ||
28 | des_crypt.man - libdes.a manual page. | ||
29 | des.h - Public libdes.a header file. | ||
30 | ecb_enc.c - des_ecb_encrypt() source, this contains the basic DES code. | ||
31 | ecb3_enc.c - des_ecb3_encrypt() source. | ||
32 | cbc_ckm.c - des_cbc_cksum() source. | ||
33 | cbc_enc.c - des_cbc_encrypt() source. | ||
34 | ncbc_enc.c - des_cbc_encrypt() that is 'normal' in that it copies | ||
35 | the new iv values back in the passed iv vector. | ||
36 | ede_enc.c - des_ede3_cbc_encrypt() cbc mode des using triple DES. | ||
37 | cbc3_enc.c - des_3cbc_encrypt() source, don't use this function. | ||
38 | cfb_enc.c - des_cfb_encrypt() source. | ||
39 | cfb64enc.c - des_cfb64_encrypt() cfb in 64 bit mode but setup to be | ||
40 | used as a stream cipher. | ||
41 | cfb64ede.c - des_ede3_cfb64_encrypt() cfb in 64 bit mode but setup to be | ||
42 | used as a stream cipher and using triple DES. | ||
43 | ofb_enc.c - des_cfb_encrypt() source. | ||
44 | ofb64_enc.c - des_ofb_encrypt() ofb in 64 bit mode but setup to be | ||
45 | used as a stream cipher. | ||
46 | ofb64ede.c - des_ede3_ofb64_encrypt() ofb in 64 bit mode but setup to be | ||
47 | used as a stream cipher and using triple DES. | ||
48 | enc_read.c - des_enc_read() source. | ||
49 | enc_writ.c - des_enc_write() source. | ||
50 | pcbc_enc.c - des_pcbc_encrypt() source. | ||
51 | qud_cksm.c - quad_cksum() source. | ||
52 | rand_key.c - des_random_key() source. | ||
53 | read_pwd.c - Source for des_read_password() plus related functions. | ||
54 | set_key.c - Source for des_set_key(). | ||
55 | str2key.c - Covert a string of any length into a key. | ||
56 | fcrypt.c - A small, fast version of crypt(3). | ||
57 | des_locl.h - Internal libdes.a header file. | ||
58 | podd.h - Odd parity tables - used in des_set_key(). | ||
59 | sk.h - Lookup tables used in des_set_key(). | ||
60 | spr.h - What is left of the S tables - used in ecb_encrypt(). | ||
61 | des_ver.h - header file for the external definition of the | ||
62 | version string. | ||
63 | des.doc - SSLeay documentation for the library. | ||
64 | |||
65 | /* The perl scripts - you can ignore these files they are only | ||
66 | * included for the curious */ | ||
67 | des.pl - des in perl anyone? des_set_key and des_ecb_encrypt | ||
68 | both done in a perl library. | ||
69 | testdes.pl - Testing program for des.pl | ||
70 | doIP - Perl script used to develop IP xor/shift code. | ||
71 | doPC1 - Perl script used to develop PC1 xor/shift code. | ||
72 | doPC2 - Generates sk.h. | ||
73 | PC1 - Output of doPC1 should be the same as output from PC1. | ||
74 | PC2 - used in development of doPC2. | ||
75 | shifts.pl - Perl library used by my perl scripts. | ||
76 | |||
77 | /* I started making a perl5 dynamic library for libdes | ||
78 | * but did not fully finish, these files are part of that effort. */ | ||
79 | DES.pm | ||
80 | DES.pod | ||
81 | DES.xs | ||
82 | t | ||
83 | typemap | ||
84 | |||
85 | /* The following are for use with sun RPC implementaions. */ | ||
86 | rpc_des.h | ||
87 | rpc_enc.c | ||
88 | |||
89 | /* The following are contibuted by Mark Murray <mark@grondar.za>. They | ||
90 | * are not normally built into libdes due to machine specific routines | ||
91 | * contained in them. They are for use in the most recent incarnation of | ||
92 | * export kerberos v 4 (eBones). */ | ||
93 | supp.c | ||
94 | new_rkey.c | ||
95 | |||
96 | |||
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 @@ | |||
1 | Modes of DES | ||
2 | Quite a bit of the following information has been taken from | ||
3 | AS 2805.5.2 | ||
4 | Australian Standard | ||
5 | Electronic funds transfer - Requirements for interfaces, | ||
6 | Part 5.2: Modes of operation for an n-bit block cipher algorithm | ||
7 | Appendix A | ||
8 | |||
9 | There are several different modes in which DES can be used, they are | ||
10 | as follows. | ||
11 | |||
12 | Electronic Codebook Mode (ECB) (des_ecb_encrypt()) | ||
13 | - 64 bits are enciphered at a time. | ||
14 | - The order of the blocks can be rearranged without detection. | ||
15 | - The same plaintext block always produces the same ciphertext block | ||
16 | (for the same key) making it vulnerable to a 'dictionary attack'. | ||
17 | - An error will only affect one ciphertext block. | ||
18 | |||
19 | Cipher Block Chaining Mode (CBC) (des_cbc_encrypt()) | ||
20 | - a multiple of 64 bits are enciphered at a time. | ||
21 | - The CBC mode produces the same ciphertext whenever the same | ||
22 | plaintext is encrypted using the same key and starting variable. | ||
23 | - The chaining operation makes the ciphertext blocks dependent on the | ||
24 | current and all preceding plaintext blocks and therefore blocks can not | ||
25 | be rearranged. | ||
26 | - The use of different starting variables prevents the same plaintext | ||
27 | enciphering to the same ciphertext. | ||
28 | - An error will affect the current and the following ciphertext blocks. | ||
29 | |||
30 | Cipher Feedback Mode (CFB) (des_cfb_encrypt()) | ||
31 | - a number of bits (j) <= 64 are enciphered at a time. | ||
32 | - The CFB mode produces the same ciphertext whenever the same | ||
33 | plaintext is encrypted using the same key and starting variable. | ||
34 | - The chaining operation makes the ciphertext variables dependent on the | ||
35 | current and all preceding variables and therefore j-bit variables are | ||
36 | chained together and con not be rearranged. | ||
37 | - The use of different starting variables prevents the same plaintext | ||
38 | enciphering to the same ciphertext. | ||
39 | - The strength of the CFB mode depends on the size of k (maximal if | ||
40 | j == k). In my implementation this is always the case. | ||
41 | - Selection of a small value for j will require more cycles through | ||
42 | the encipherment algorithm per unit of plaintext and thus cause | ||
43 | greater processing overheads. | ||
44 | - Only multiples of j bits can be enciphered. | ||
45 | - An error will affect the current and the following ciphertext variables. | ||
46 | |||
47 | Output Feedback Mode (OFB) (des_ofb_encrypt()) | ||
48 | - a number of bits (j) <= 64 are enciphered at a time. | ||
49 | - The OFB mode produces the same ciphertext whenever the same | ||
50 | plaintext enciphered using the same key and starting variable. More | ||
51 | over, in the OFB mode the same key stream is produced when the same | ||
52 | key and start variable are used. Consequently, for security reasons | ||
53 | a specific start variable should be used only once for a given key. | ||
54 | - The absence of chaining makes the OFB more vulnerable to specific attacks. | ||
55 | - The use of different start variables values prevents the same | ||
56 | plaintext enciphering to the same ciphertext, by producing different | ||
57 | key streams. | ||
58 | - Selection of a small value for j will require more cycles through | ||
59 | the encipherment algorithm per unit of plaintext and thus cause | ||
60 | greater processing overheads. | ||
61 | - Only multiples of j bits can be enciphered. | ||
62 | - OFB mode of operation does not extend ciphertext errors in the | ||
63 | resultant plaintext output. Every bit error in the ciphertext causes | ||
64 | only one bit to be in error in the deciphered plaintext. | ||
65 | - OFB mode is not self-synchronising. If the two operation of | ||
66 | encipherment and decipherment get out of synchronism, the system needs | ||
67 | to be re-initialised. | ||
68 | - Each re-initialisation should use a value of the start variable | ||
69 | different from the start variable values used before with the same | ||
70 | key. The reason for this is that an identical bit stream would be | ||
71 | produced each time from the same parameters. This would be | ||
72 | susceptible to a 'known plaintext' attack. | ||
73 | |||
74 | Triple ECB Mode (des_ecb3_encrypt()) | ||
75 | - Encrypt with key1, decrypt with key2 and encrypt with key1 again. | ||
76 | - As for ECB encryption but increases the effective key length to 112 bits. | ||
77 | - If both keys are the same it is equivalent to encrypting once with | ||
78 | just one key. | ||
79 | |||
80 | Triple CBC Mode (des_3cbc_encrypt()) | ||
81 | - Encrypt with key1, decrypt with key2 and encrypt with key1 again. | ||
82 | - As for CBC encryption but increases the effective key length to 112 bits. | ||
83 | - If both keys are the same it is equivalent to encrypting once with | ||
84 | 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 @@ | |||
1 | use ExtUtils::MakeMaker; | ||
2 | # See lib/ExtUtils/MakeMaker.pm for details of how to influence | ||
3 | # the contents of the Makefile being created. | ||
4 | &writeMakefile( | ||
5 | 'potential_libs' => '', # e.g., '-lm' | ||
6 | 'INC' => '', # e.g., '-I/usr/include/other' | ||
7 | 'DISTNAME' => 'DES', | ||
8 | 'VERSION' => '0.1', | ||
9 | 'DEFINE' => '-DPERL5', | ||
10 | 'OBJECT' => 'DES.o cbc_cksm.o cbc_enc.o ecb_enc.o pcbc_enc.o \ | ||
11 | rand_key.o set_key.o str2key.o \ | ||
12 | enc_read.o enc_writ.o fcrypt.o cfb_enc.o \ | ||
13 | ecb3_enc.o ofb_enc.o cbc3_enc.o des_enc.o', | ||
14 | ); | ||
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 @@ | |||
1 | # You must select the correct terminal control system to be used to | ||
2 | # turn character echo off when reading passwords. There a 5 systems | ||
3 | # SGTTY - the old BSD system | ||
4 | # TERMIO - most system V boxes | ||
5 | # TERMIOS - SGI (ala IRIX). | ||
6 | # VMS - the DEC operating system | ||
7 | # MSDOS - we all know what it is :-) | ||
8 | # read_pwd.c makes a reasonable guess at what is correct. | ||
9 | |||
10 | # Targets | ||
11 | # make - twidle the options yourself :-) | ||
12 | # make cc - standard cc options | ||
13 | # make gcc - standard gcc options | ||
14 | # make x86-elf - linux-elf etc | ||
15 | # make x86-out - linux-a.out, FreeBSD etc | ||
16 | # make x86-solaris | ||
17 | # make x86-bdsi | ||
18 | |||
19 | # If you are on a DEC Alpha, edit des.h and change the DES_LONG | ||
20 | # define to 'unsigned int'. I have seen this give a %20 speedup. | ||
21 | |||
22 | OPTS0= -DLIBDES_LIT -DRAND -DTERMIO #-DNOCONST | ||
23 | |||
24 | # Version 1.94 has changed the strings_to_key function so that it is | ||
25 | # now compatible with MITs when the string is longer than 8 characters. | ||
26 | # If you wish to keep the old version, uncomment the following line. | ||
27 | # This will affect the -E/-D options on des(1). | ||
28 | #OPTS1= -DOLD_STR_TO_KEY | ||
29 | |||
30 | # There are 4 possible performance options | ||
31 | # -DDES_PTR | ||
32 | # -DDES_RISC1 | ||
33 | # -DDES_RISC2 (only one of DES_RISC1 and DES_RISC2) | ||
34 | # -DDES_UNROLL | ||
35 | # after the initial build, run 'des_opts' to see which options are best | ||
36 | # for your platform. There are some listed in options.txt | ||
37 | #OPTS2= -DDES_PTR | ||
38 | #OPTS3= -DDES_RISC1 # or DES_RISC2 | ||
39 | #OPTS4= -DDES_UNROLL | ||
40 | |||
41 | OPTS= $(OPTS0) $(OPTS1) $(OPTS2) $(OPTS3) $(OPTS4) | ||
42 | |||
43 | MAKE=make -f Makefile | ||
44 | #CC=cc | ||
45 | #CFLAG= -O | ||
46 | |||
47 | CC=gcc | ||
48 | #CFLAG= -O4 -funroll-loops -fomit-frame-pointer | ||
49 | CFLAG= -O3 -fomit-frame-pointer | ||
50 | |||
51 | CFLAGS=$(OPTS) $(CFLAG) | ||
52 | CPP=$(CC) -E | ||
53 | AS=as | ||
54 | |||
55 | # Assember version of des_encrypt*(). | ||
56 | DES_ENC=des_enc.o fcrypt_b.o # normal C version | ||
57 | #DES_ENC=asm/dx86-elf.o asm/yx86-elf.o # elf format x86 | ||
58 | #DES_ENC=asm/dx86-out.o asm/yx86-out.o # a.out format x86 | ||
59 | #DES_ENC=asm/dx86-sol.o asm/yx86-sol.o # solaris format x86 | ||
60 | #DES_ENC=asm/dx86bsdi.o asm/yx86basi.o # bsdi format x86 | ||
61 | |||
62 | LIBDIR=/usr/local/lib | ||
63 | BINDIR=/usr/local/bin | ||
64 | INCDIR=/usr/local/include | ||
65 | MANDIR=/usr/local/man | ||
66 | MAN1=1 | ||
67 | MAN3=3 | ||
68 | SHELL=/bin/sh | ||
69 | OBJ_LIT=cbc_enc.o ecb_enc.o $(DES_ENC) fcrypt.o set_key.o | ||
70 | OBJ_FULL=cbc_cksm.o $(OBJ_LIT) pcbc_enc.o \ | ||
71 | xcbc_enc.o qud_cksm.o \ | ||
72 | cfb64ede.o cfb64enc.o cfb_enc.o ecb3_enc.o \ | ||
73 | enc_read.o enc_writ.o ofb64ede.o ofb64enc.o ofb_enc.o \ | ||
74 | rand_key.o read_pwd.o read2pwd.o rpc_enc.o str2key.o supp.o | ||
75 | |||
76 | GENERAL_LIT=COPYRIGHT INSTALL README VERSION Makefile des_crypt.man \ | ||
77 | des.doc options.txt asm | ||
78 | GENERAL_FULL=$(GENERAL_LIT) FILES Imakefile times vms.com KERBEROS MODES.DES \ | ||
79 | des.man DES.pm DES.pod DES.xs Makefile.PL dess.cpp des3s.cpp \ | ||
80 | Makefile.uni typemap t Makefile.ssl makefile.bc Makefile.lit \ | ||
81 | des.org des_locl.org | ||
82 | TESTING_LIT= destest speed des_opts | ||
83 | TESTING_FULL= rpw $(TESTING_LIT) | ||
84 | TESTING_SRC_LIT=destest.c speed.c des_opts.c | ||
85 | TESTING_SRC_FULL=rpw.c $(TESTING_SRC_LIT) | ||
86 | HEADERS_LIT=des_ver.h des.h des_locl.h podd.h sk.h spr.h | ||
87 | HEADERS_FULL= $(HEADERS_LIT) rpc_des.h | ||
88 | LIBDES_LIT=cbc_enc.c ecb_enc.c fcrypt.c set_key.c des_enc.c fcrypt_b.c | ||
89 | LIBDES_FULL= cbc_cksm.c pcbc_enc.c qud_cksm.c \ | ||
90 | cfb64ede.c cfb64enc.c cfb_enc.c ecb3_enc.c \ | ||
91 | enc_read.c enc_writ.c ofb64ede.c ofb64enc.c ofb_enc.c \ | ||
92 | rand_key.c rpc_enc.c str2key.c supp.c \ | ||
93 | xcbc_enc.c $(LIBDES_LIT) read_pwd.c read2pwd.c | ||
94 | |||
95 | PERL= des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl | ||
96 | |||
97 | OBJ= $(OBJ_LIT) | ||
98 | GENERAL=$(GENERAL_LIT) | ||
99 | TESTING=$(TESTING_LIT) | ||
100 | TESTING_SRC=$(TESTING_SRC_LIT) | ||
101 | HEADERS=$(HEADERS_LIT) | ||
102 | LIBDES= $(LIBDES_LIT) | ||
103 | |||
104 | ALL= $(GENERAL) $(TESTING_SRC) $(LIBDES) $(PERL) $(HEADERS) | ||
105 | |||
106 | DLIB= libdes.a | ||
107 | |||
108 | all: $(DLIB) $(TESTING) | ||
109 | |||
110 | cc: | ||
111 | $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all | ||
112 | |||
113 | gcc: | ||
114 | $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all | ||
115 | |||
116 | x86-elf: | ||
117 | $(MAKE) DES_ENC='asm/dx86-elf.o asm/yx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all | ||
118 | |||
119 | x86-out: | ||
120 | $(MAKE) DES_ENC='asm/dx86-out.o asm/yx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all | ||
121 | |||
122 | x86-solaris: | ||
123 | $(MAKE) DES_ENC='asm/dx86-sol.o asm/yx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all | ||
124 | |||
125 | x86-bsdi: | ||
126 | $(MAKE) DES_ENC='asm/dx86bsdi.o asm/yx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all | ||
127 | |||
128 | # elf | ||
129 | asm/dx86-elf.o: asm/dx86unix.cpp | ||
130 | $(CPP) -DELF asm/dx86unix.cpp | $(AS) -o asm/dx86-elf.o | ||
131 | |||
132 | asm/yx86-elf.o: asm/yx86unix.cpp | ||
133 | $(CPP) -DELF asm/yx86unix.cpp | $(AS) -o asm/yx86-elf.o | ||
134 | |||
135 | # solaris | ||
136 | asm/dx86-sol.o: asm/dx86unix.cpp | ||
137 | $(CC) -E -DSOL asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s | ||
138 | as -o asm/dx86-sol.o asm/dx86-sol.s | ||
139 | rm -f asm/dx86-sol.s | ||
140 | |||
141 | asm/yx86-sol.o: asm/yx86unix.cpp | ||
142 | $(CC) -E -DSOL asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s | ||
143 | as -o asm/yx86-sol.o asm/yx86-sol.s | ||
144 | rm -f asm/yx86-sol.s | ||
145 | |||
146 | # a.out | ||
147 | asm/dx86-out.o: asm/dx86unix.cpp | ||
148 | $(CPP) -DOUT asm/dx86unix.cpp | $(AS) -o asm/dx86-out.o | ||
149 | |||
150 | asm/yx86-out.o: asm/yx86unix.cpp | ||
151 | $(CPP) -DOUT asm/yx86unix.cpp | $(AS) -o asm/yx86-out.o | ||
152 | |||
153 | # bsdi | ||
154 | asm/dx86bsdi.o: asm/dx86unix.cpp | ||
155 | $(CPP) -DBSDI asm/dx86unix.cpp | $(AS) -o asm/dx86bsdi.o | ||
156 | |||
157 | asm/yx86bsdi.o: asm/yx86unix.cpp | ||
158 | $(CPP) -DBSDI asm/yx86unix.cpp | $(AS) -o asm/yx86bsdi.o | ||
159 | |||
160 | asm/dx86unix.cpp: | ||
161 | (cd asm; perl des-586.pl cpp >dx86unix.cpp) | ||
162 | |||
163 | asm/yx86unix.cpp: | ||
164 | (cd asm; perl crypt586.pl cpp >yx86unix.cpp) | ||
165 | |||
166 | test: all | ||
167 | ./destest | ||
168 | |||
169 | $(DLIB): $(OBJ) | ||
170 | /bin/rm -f $(DLIB) | ||
171 | ar cr $(DLIB) $(OBJ) | ||
172 | -if test -s /bin/ranlib; then /bin/ranlib $(DLIB); \ | ||
173 | else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(DLIB); \ | ||
174 | else exit 0; fi; fi | ||
175 | |||
176 | des_opts: des_opts.o $(DLIB) | ||
177 | $(CC) $(CFLAGS) -o des_opts des_opts.o $(DLIB) | ||
178 | |||
179 | destest: destest.o $(DLIB) | ||
180 | $(CC) $(CFLAGS) -o destest destest.o $(DLIB) | ||
181 | |||
182 | rpw: rpw.o $(DLIB) | ||
183 | $(CC) $(CFLAGS) -o rpw rpw.o $(DLIB) | ||
184 | |||
185 | speed: speed.o $(DLIB) | ||
186 | $(CC) $(CFLAGS) -o speed speed.o $(DLIB) | ||
187 | |||
188 | des: des.o $(DLIB) | ||
189 | $(CC) $(CFLAGS) -o des des.o $(DLIB) | ||
190 | |||
191 | tags: | ||
192 | ctags $(TESTING_SRC) $(LIBDES) | ||
193 | |||
194 | tar_lit: | ||
195 | /bin/mv Makefile Makefile.tmp | ||
196 | /bin/cp Makefile.lit Makefile | ||
197 | tar chf libdes-l.tar $(LIBDES_LIT) $(HEADERS_LIT) \ | ||
198 | $(GENERAL_LIT) $(TESTING_SRC_LIT) | ||
199 | /bin/rm -f Makefile | ||
200 | /bin/mv Makefile.tmp Makefile | ||
201 | |||
202 | tar: | ||
203 | tar chf libdes.tar $(ALL) | ||
204 | |||
205 | shar: | ||
206 | shar $(ALL) >libdes.shar | ||
207 | |||
208 | depend: | ||
209 | makedepend $(LIBDES) $(TESTING_SRC) | ||
210 | |||
211 | clean: | ||
212 | /bin/rm -f *.o tags core $(TESTING) $(DLIB) .nfs* *.old *.bak asm/*.o | ||
213 | |||
214 | dclean: | ||
215 | sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new | ||
216 | mv -f Makefile.new Makefile | ||
217 | |||
218 | # Eric is probably going to choke when he next looks at this --tjh | ||
219 | install: | ||
220 | if test $(INSTALLTOP); then \ | ||
221 | echo SSL style install; \ | ||
222 | cp $(DLIB) $(INSTALLTOP)/lib; \ | ||
223 | if test -s /bin/ranlib; then \ | ||
224 | /bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ | ||
225 | else \ | ||
226 | if test -s /usr/bin/ranlib; then \ | ||
227 | /usr/bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ | ||
228 | fi; fi; \ | ||
229 | chmod 644 $(INSTALLTOP)/lib/$(DLIB); \ | ||
230 | cp des.h $(INSTALLTOP)/include; \ | ||
231 | chmod 644 $(INSTALLTOP)/include/des.h; \ | ||
232 | else \ | ||
233 | echo Standalone install; \ | ||
234 | cp $(DLIB) $(LIBDIR)/$(DLIB); \ | ||
235 | if test -s /bin/ranlib; then \ | ||
236 | /bin/ranlib $(LIBDIR)/$(DLIB); \ | ||
237 | else \ | ||
238 | if test -s /usr/bin/ranlib; then \ | ||
239 | /usr/bin/ranlib $(LIBDIR)/$(DLIB); \ | ||
240 | fi; \ | ||
241 | fi; \ | ||
242 | chmod 644 $(LIBDIR)/$(DLIB); \ | ||
243 | cp des_crypt.man $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ | ||
244 | chmod 644 $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ | ||
245 | cp des.man $(MANDIR)/man$(MAN1)/des.$(MAN1); \ | ||
246 | chmod 644 $(MANDIR)/man$(MAN1)/des.$(MAN1); \ | ||
247 | cp des.h $(INCDIR)/des.h; \ | ||
248 | chmod 644 $(INCDIR)/des.h; \ | ||
249 | fi | ||
250 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
diff --git a/src/lib/libcrypto/des/Makefile.ssl b/src/lib/libcrypto/des/Makefile.ssl new file mode 100644 index 0000000000..78b5189ee3 --- /dev/null +++ b/src/lib/libcrypto/des/Makefile.ssl | |||
@@ -0,0 +1,140 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/des/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= des | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | CPP= $(CC) -E | ||
9 | INCLUDES= | ||
10 | CFLAG=-g | ||
11 | INSTALLTOP=/usr/local/ssl | ||
12 | MAKE= make -f Makefile.ssl | ||
13 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
14 | MAKEFILE= Makefile.ssl | ||
15 | AR= ar r | ||
16 | DES_ENC= des_enc.o fcrypt_b.o | ||
17 | # or use | ||
18 | #DES_ENC= dx86-elf.o yx86-elf.o | ||
19 | |||
20 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
21 | |||
22 | GENERAL=Makefile des.org des_locl.org | ||
23 | TEST=destest.c | ||
24 | APPS= | ||
25 | |||
26 | LIB=$(TOP)/libcrypto.a | ||
27 | LIBSRC= cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \ | ||
28 | ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c \ | ||
29 | fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c \ | ||
30 | qud_cksm.c rand_key.c read_pwd.c rpc_enc.c set_key.c \ | ||
31 | des_enc.c fcrypt_b.c read2pwd.c \ | ||
32 | fcrypt.c xcbc_enc.c \ | ||
33 | str2key.c cfb64ede.c ofb64ede.c supp.c | ||
34 | |||
35 | LIBOBJ= set_key.o ecb_enc.o cbc_enc.o \ | ||
36 | ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o \ | ||
37 | enc_read.o enc_writ.o ofb64enc.o \ | ||
38 | ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o \ | ||
39 | ${DES_ENC} read2pwd.o \ | ||
40 | fcrypt.o xcbc_enc.o read_pwd.o rpc_enc.o cbc_cksm.o supp.o | ||
41 | |||
42 | SRC= $(LIBSRC) | ||
43 | |||
44 | EXHEADER= des.h | ||
45 | HEADER= des_locl.h rpc_des.h podd.h sk.h spr.h des_ver.h $(EXHEADER) | ||
46 | |||
47 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
48 | |||
49 | top: | ||
50 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
51 | |||
52 | all: lib | ||
53 | |||
54 | lib: $(LIBOBJ) | ||
55 | $(AR) $(LIB) $(LIBOBJ) | ||
56 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
57 | @touch lib | ||
58 | |||
59 | # elf | ||
60 | asm/dx86-elf.o: asm/dx86unix.cpp | ||
61 | $(CPP) -DELF asm/dx86unix.cpp | as -o asm/dx86-elf.o | ||
62 | |||
63 | asm/yx86-elf.o: asm/yx86unix.cpp | ||
64 | $(CPP) -DELF asm/yx86unix.cpp | as -o asm/yx86-elf.o | ||
65 | |||
66 | # solaris | ||
67 | asm/dx86-sol.o: asm/dx86unix.cpp | ||
68 | $(CC) -E -DSOL asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s | ||
69 | as -o asm/dx86-sol.o asm/dx86-sol.s | ||
70 | rm -f asm/dx86-sol.s | ||
71 | |||
72 | asm/yx86-sol.o: asm/yx86unix.cpp | ||
73 | $(CC) -E -DSOL asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s | ||
74 | as -o asm/yx86-sol.o asm/yx86-sol.s | ||
75 | rm -f asm/yx86-sol.s | ||
76 | |||
77 | # a.out | ||
78 | asm/dx86-out.o: asm/dx86unix.cpp | ||
79 | $(CPP) -DOUT asm/dx86unix.cpp | as -o asm/dx86-out.o | ||
80 | |||
81 | asm/yx86-out.o: asm/yx86unix.cpp | ||
82 | $(CPP) -DOUT asm/yx86unix.cpp | as -o asm/yx86-out.o | ||
83 | |||
84 | # bsdi | ||
85 | asm/dx86bsdi.o: asm/dx86unix.cpp | ||
86 | $(CPP) -DBSDI asm/dx86unix.cpp | as -o asm/dx86bsdi.o | ||
87 | |||
88 | asm/yx86bsdi.o: asm/yx86unix.cpp | ||
89 | $(CPP) -DBSDI asm/yx86unix.cpp | as -o asm/yx86bsdi.o | ||
90 | |||
91 | asm/dx86unix.cpp: | ||
92 | (cd asm; perl des-586.pl cpp >dx86unix.cpp) | ||
93 | |||
94 | asm/yx86unix.cpp: | ||
95 | (cd asm; perl crypt586.pl cpp >yx86unix.cpp) | ||
96 | |||
97 | files: | ||
98 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
99 | |||
100 | links: | ||
101 | /bin/rm -f Makefile | ||
102 | $(TOP)/util/point.sh Makefile.ssl Makefile | ||
103 | /bin/rm -f des.doc | ||
104 | /bin/rm -fr asm/perlasm | ||
105 | $(TOP)/util/point.sh ../../perlasm asm/perlasm | ||
106 | $(TOP)/util/point.sh ../../doc/des.doc des.doc | ||
107 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
108 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
109 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
110 | |||
111 | install: installs | ||
112 | |||
113 | installs: | ||
114 | @for i in $(EXHEADER) ; \ | ||
115 | do \ | ||
116 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
117 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
118 | done; | ||
119 | |||
120 | tags: | ||
121 | ctags $(SRC) | ||
122 | |||
123 | tests: | ||
124 | |||
125 | lint: | ||
126 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
127 | |||
128 | depend: | ||
129 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
130 | |||
131 | dclean: | ||
132 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
133 | mv -f Makefile.new $(MAKEFILE) | ||
134 | |||
135 | clean: | ||
136 | /bin/rm -f *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
137 | |||
138 | errors: | ||
139 | |||
140 | # 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 @@ | |||
1 | # You must select the correct terminal control system to be used to | ||
2 | # turn character echo off when reading passwords. There a 5 systems | ||
3 | # SGTTY - the old BSD system | ||
4 | # TERMIO - most system V boxes | ||
5 | # TERMIOS - SGI (ala IRIX). | ||
6 | # VMS - the DEC operating system | ||
7 | # MSDOS - we all know what it is :-) | ||
8 | # read_pwd.c makes a reasonable guess at what is correct. | ||
9 | |||
10 | # Targets | ||
11 | # make - twidle the options yourself :-) | ||
12 | # make cc - standard cc options | ||
13 | # make gcc - standard gcc options | ||
14 | # make x86-elf - linux-elf etc | ||
15 | # make x86-out - linux-a.out, FreeBSD etc | ||
16 | # make x86-solaris | ||
17 | # make x86-bdsi | ||
18 | |||
19 | # If you are on a DEC Alpha, edit des.h and change the DES_LONG | ||
20 | # define to 'unsigned int'. I have seen this give a %20 speedup. | ||
21 | |||
22 | OPTS0= -DRAND -DTERMIO #-DNOCONST | ||
23 | |||
24 | # Version 1.94 has changed the strings_to_key function so that it is | ||
25 | # now compatible with MITs when the string is longer than 8 characters. | ||
26 | # If you wish to keep the old version, uncomment the following line. | ||
27 | # This will affect the -E/-D options on des(1). | ||
28 | #OPTS1= -DOLD_STR_TO_KEY | ||
29 | |||
30 | # There are 4 possible performance options | ||
31 | # -DDES_PTR | ||
32 | # -DDES_RISC1 | ||
33 | # -DDES_RISC2 (only one of DES_RISC1 and DES_RISC2) | ||
34 | # -DDES_UNROLL | ||
35 | # after the initial build, run 'des_opts' to see which options are best | ||
36 | # for your platform. There are some listed in options.txt | ||
37 | #OPTS2= -DDES_PTR | ||
38 | #OPTS3= -DDES_RISC1 # or DES_RISC2 | ||
39 | #OPTS4= -DDES_UNROLL | ||
40 | |||
41 | OPTS= $(OPTS0) $(OPTS1) $(OPTS2) $(OPTS3) $(OPTS4) | ||
42 | |||
43 | MAKE=make -f Makefile | ||
44 | #CC=cc | ||
45 | #CFLAG= -O | ||
46 | |||
47 | CC=gcc | ||
48 | #CFLAG= -O4 -funroll-loops -fomit-frame-pointer | ||
49 | CFLAG= -O3 -fomit-frame-pointer | ||
50 | |||
51 | CFLAGS=$(OPTS) $(CFLAG) | ||
52 | CPP=$(CC) -E | ||
53 | AS=as | ||
54 | |||
55 | # Assember version of des_encrypt*(). | ||
56 | DES_ENC=des_enc.o fcrypt_b.o # normal C version | ||
57 | #DES_ENC=asm/dx86-elf.o asm/yx86-elf.o # elf format x86 | ||
58 | #DES_ENC=asm/dx86-out.o asm/yx86-out.o # a.out format x86 | ||
59 | #DES_ENC=asm/dx86-sol.o asm/yx86-sol.o # solaris format x86 | ||
60 | #DES_ENC=asm/dx86bsdi.o asm/yx86basi.o # bsdi format x86 | ||
61 | |||
62 | LIBDIR=/usr/local/lib | ||
63 | BINDIR=/usr/local/bin | ||
64 | INCDIR=/usr/local/include | ||
65 | MANDIR=/usr/local/man | ||
66 | MAN1=1 | ||
67 | MAN3=3 | ||
68 | SHELL=/bin/sh | ||
69 | OBJ_LIT=cbc_enc.o ecb_enc.o $(DES_ENC) fcrypt.o set_key.o | ||
70 | OBJ_FULL=cbc_cksm.o $(OBJ_LIT) pcbc_enc.o \ | ||
71 | xcbc_enc.o qud_cksm.o cbc3_enc.o \ | ||
72 | cfb64ede.o cfb64enc.o cfb_enc.o ecb3_enc.o \ | ||
73 | enc_read.o enc_writ.o ofb64ede.o ofb64enc.o ofb_enc.o \ | ||
74 | rand_key.o read_pwd.o read2pwd.o rpc_enc.o str2key.o supp.o | ||
75 | |||
76 | GENERAL_LIT=COPYRIGHT INSTALL README VERSION Makefile des_crypt.man \ | ||
77 | des.doc options.txt asm | ||
78 | GENERAL_FULL=$(GENERAL_LIT) FILES Imakefile times vms.com KERBEROS MODES.DES \ | ||
79 | des.man DES.pm DES.pod DES.xs Makefile.PL dess.cpp des3s.cpp \ | ||
80 | Makefile.uni typemap t Makefile.ssl makefile.bc Makefile.lit \ | ||
81 | des.org des_locl.org | ||
82 | TESTING_LIT= destest speed des_opts | ||
83 | TESTING_FULL= rpw des $(TESTING_LIT) | ||
84 | TESTING_SRC_LIT=destest.c speed.c des_opts.c | ||
85 | TESTING_SRC_FULL=rpw.c des.c $(TESTING_SRC_LIT) | ||
86 | HEADERS_LIT=des_ver.h des.h des_locl.h podd.h sk.h spr.h | ||
87 | HEADERS_FULL= $(HEADERS_LIT) rpc_des.h | ||
88 | LIBDES_LIT=cbc_enc.c ecb_enc.c fcrypt.c set_key.c des_enc.c fcrypt_b.c | ||
89 | LIBDES_FULL= cbc_cksm.c pcbc_enc.c qud_cksm.c cbc3_enc.c \ | ||
90 | cfb64ede.c cfb64enc.c cfb_enc.c ecb3_enc.c \ | ||
91 | enc_read.c enc_writ.c ofb64ede.c ofb64enc.c ofb_enc.c \ | ||
92 | rand_key.c rpc_enc.c str2key.c supp.c \ | ||
93 | xcbc_enc.c $(LIBDES_LIT) read_pwd.c read2pwd.c | ||
94 | |||
95 | PERL= des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl | ||
96 | |||
97 | OBJ= $(OBJ_FULL) | ||
98 | GENERAL=$(GENERAL_FULL) | ||
99 | TESTING=$(TESTING_FULL) | ||
100 | TESTING_SRC=$(TESTING_SRC_FULL) | ||
101 | HEADERS=$(HEADERS_FULL) | ||
102 | LIBDES= $(LIBDES_FULL) | ||
103 | |||
104 | ALL= $(GENERAL) $(TESTING_SRC) $(LIBDES) $(PERL) $(HEADERS) | ||
105 | |||
106 | DLIB= libdes.a | ||
107 | |||
108 | all: $(DLIB) $(TESTING) | ||
109 | |||
110 | cc: | ||
111 | $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all | ||
112 | |||
113 | gcc: | ||
114 | $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all | ||
115 | |||
116 | x86-elf: | ||
117 | $(MAKE) DES_ENC='asm/dx86-elf.o asm/yx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all | ||
118 | |||
119 | x86-out: | ||
120 | $(MAKE) DES_ENC='asm/dx86-out.o asm/yx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all | ||
121 | |||
122 | x86-solaris: | ||
123 | $(MAKE) DES_ENC='asm/dx86-sol.o asm/yx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all | ||
124 | |||
125 | x86-bsdi: | ||
126 | $(MAKE) DES_ENC='asm/dx86bsdi.o asm/yx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all | ||
127 | |||
128 | # elf | ||
129 | asm/dx86-elf.o: asm/dx86unix.cpp | ||
130 | $(CPP) -DELF asm/dx86unix.cpp | $(AS) -o asm/dx86-elf.o | ||
131 | |||
132 | asm/yx86-elf.o: asm/yx86unix.cpp | ||
133 | $(CPP) -DELF asm/yx86unix.cpp | $(AS) -o asm/yx86-elf.o | ||
134 | |||
135 | # solaris | ||
136 | asm/dx86-sol.o: asm/dx86unix.cpp | ||
137 | $(CC) -E -DSOL asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s | ||
138 | as -o asm/dx86-sol.o asm/dx86-sol.s | ||
139 | rm -f asm/dx86-sol.s | ||
140 | |||
141 | asm/yx86-sol.o: asm/yx86unix.cpp | ||
142 | $(CC) -E -DSOL asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s | ||
143 | as -o asm/yx86-sol.o asm/yx86-sol.s | ||
144 | rm -f asm/yx86-sol.s | ||
145 | |||
146 | # a.out | ||
147 | asm/dx86-out.o: asm/dx86unix.cpp | ||
148 | $(CPP) -DOUT asm/dx86unix.cpp | $(AS) -o asm/dx86-out.o | ||
149 | |||
150 | asm/yx86-out.o: asm/yx86unix.cpp | ||
151 | $(CPP) -DOUT asm/yx86unix.cpp | $(AS) -o asm/yx86-out.o | ||
152 | |||
153 | # bsdi | ||
154 | asm/dx86bsdi.o: asm/dx86unix.cpp | ||
155 | $(CPP) -DBSDI asm/dx86unix.cpp | $(AS) -o asm/dx86bsdi.o | ||
156 | |||
157 | asm/yx86bsdi.o: asm/yx86unix.cpp | ||
158 | $(CPP) -DBSDI asm/yx86unix.cpp | $(AS) -o asm/yx86bsdi.o | ||
159 | |||
160 | asm/dx86unix.cpp: | ||
161 | (cd asm; perl des-586.pl cpp >dx86unix.cpp) | ||
162 | |||
163 | asm/yx86unix.cpp: | ||
164 | (cd asm; perl crypt586.pl cpp >yx86unix.cpp) | ||
165 | |||
166 | test: all | ||
167 | ./destest | ||
168 | |||
169 | $(DLIB): $(OBJ) | ||
170 | /bin/rm -f $(DLIB) | ||
171 | ar cr $(DLIB) $(OBJ) | ||
172 | -if test -s /bin/ranlib; then /bin/ranlib $(DLIB); \ | ||
173 | else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(DLIB); \ | ||
174 | else exit 0; fi; fi | ||
175 | |||
176 | des_opts: des_opts.o $(DLIB) | ||
177 | $(CC) $(CFLAGS) -o des_opts des_opts.o $(DLIB) | ||
178 | |||
179 | destest: destest.o $(DLIB) | ||
180 | $(CC) $(CFLAGS) -o destest destest.o $(DLIB) | ||
181 | |||
182 | rpw: rpw.o $(DLIB) | ||
183 | $(CC) $(CFLAGS) -o rpw rpw.o $(DLIB) | ||
184 | |||
185 | speed: speed.o $(DLIB) | ||
186 | $(CC) $(CFLAGS) -o speed speed.o $(DLIB) | ||
187 | |||
188 | des: des.o $(DLIB) | ||
189 | $(CC) $(CFLAGS) -o des des.o $(DLIB) | ||
190 | |||
191 | tags: | ||
192 | ctags $(TESTING_SRC) $(LIBDES) | ||
193 | |||
194 | tar_lit: | ||
195 | /bin/mv Makefile Makefile.tmp | ||
196 | /bin/cp Makefile.lit Makefile | ||
197 | for i in $(HEADERS_LIT) $(LIBDES_LIT) $(GENERAL_LIT) $(TESTING_SRC_LIT) ;\ | ||
198 | do \ | ||
199 | n="$$n des/$$i"; \ | ||
200 | done; \ | ||
201 | ( cd .. ; tar chf - $$n )| gzip > libdes-l.tgz | ||
202 | /bin/rm -f Makefile | ||
203 | /bin/mv Makefile.tmp Makefile | ||
204 | |||
205 | tar: | ||
206 | mv Makefile Makefile.tmp | ||
207 | /bin/cp Makefile.uni Makefile | ||
208 | for i in $(ALL) ;\ | ||
209 | do \ | ||
210 | n="$$n des/$$i"; \ | ||
211 | done; \ | ||
212 | ( cd .. ; tar chf - $$n )| gzip > libdes.tgz | ||
213 | /bin/rm -f Makefile | ||
214 | /bin/mv Makefile.tmp Makefile | ||
215 | |||
216 | shar: | ||
217 | shar $(ALL) >libdes.shar | ||
218 | |||
219 | depend: | ||
220 | makedepend $(LIBDES) $(TESTING_SRC) | ||
221 | |||
222 | clean: | ||
223 | /bin/rm -f *.o tags core $(TESTING) $(DLIB) .nfs* *.old *.bak asm/*.o | ||
224 | |||
225 | dclean: | ||
226 | sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new | ||
227 | mv -f Makefile.new Makefile | ||
228 | |||
229 | # Eric is probably going to choke when he next looks at this --tjh | ||
230 | install: des | ||
231 | if test $(INSTALLTOP); then \ | ||
232 | echo SSL style install; \ | ||
233 | cp $(DLIB) $(INSTALLTOP)/lib; \ | ||
234 | if test -s /bin/ranlib; then \ | ||
235 | /bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ | ||
236 | else \ | ||
237 | if test -s /usr/bin/ranlib; then \ | ||
238 | /usr/bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ | ||
239 | fi; fi; \ | ||
240 | chmod 644 $(INSTALLTOP)/lib/$(DLIB); \ | ||
241 | cp des.h $(INSTALLTOP)/include; \ | ||
242 | chmod 644 $(INSTALLTOP)/include/des.h; \ | ||
243 | else \ | ||
244 | echo Standalone install; \ | ||
245 | cp $(DLIB) $(LIBDIR)/$(DLIB); \ | ||
246 | if test -s /bin/ranlib; then \ | ||
247 | /bin/ranlib $(LIBDIR)/$(DLIB); \ | ||
248 | else \ | ||
249 | if test -s /usr/bin/ranlib; then \ | ||
250 | /usr/bin/ranlib $(LIBDIR)/$(DLIB); \ | ||
251 | fi; \ | ||
252 | fi; \ | ||
253 | chmod 644 $(LIBDIR)/$(DLIB); \ | ||
254 | cp des $(BINDIR)/des; \ | ||
255 | chmod 711 $(BINDIR)/des; \ | ||
256 | cp des_crypt.man $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ | ||
257 | chmod 644 $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ | ||
258 | cp des.man $(MANDIR)/man$(MAN1)/des.$(MAN1); \ | ||
259 | chmod 644 $(MANDIR)/man$(MAN1)/des.$(MAN1); \ | ||
260 | cp des.h $(INCDIR)/des.h; \ | ||
261 | chmod 644 $(INCDIR)/des.h; \ | ||
262 | fi | ||
263 | # 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 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | @PC1=( 57,49,41,33,25,17, 9, | ||
4 | 1,58,50,42,34,26,18, | ||
5 | 10, 2,59,51,43,35,27, | ||
6 | 19,11, 3,60,52,44,36, | ||
7 | "-","-","-","-", | ||
8 | 63,55,47,39,31,23,15, | ||
9 | 7,62,54,46,38,30,22, | ||
10 | 14, 6,61,53,45,37,29, | ||
11 | 21,13, 5,28,20,12, 4, | ||
12 | "-","-","-","-", | ||
13 | ); | ||
14 | |||
15 | foreach (@PC1) | ||
16 | { | ||
17 | if ($_ ne "-") | ||
18 | { | ||
19 | $_--; | ||
20 | $_=int($_/8)*8+7-($_%8); | ||
21 | printf "%2d ",$_; | ||
22 | } | ||
23 | else | ||
24 | { print "-- "; } | ||
25 | print "\n" if (((++$i) % 8) == 0); | ||
26 | print "\n" if ((($i) % 32) == 0); | ||
27 | } | ||
28 | |||
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 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | @PC2_C=(14,17,11,24, 1, 5, | ||
4 | 3,28,15, 6,21,10, | ||
5 | 23,19,12, 4,26, 8, | ||
6 | 16, 7,27,20,13, 2, | ||
7 | ); | ||
8 | |||
9 | @PC2_D=(41,52,31,37,47,55, | ||
10 | 30,40,51,45,33,48, | ||
11 | 44,49,39,56,34,53, | ||
12 | 46,42,50,36,29,32, | ||
13 | ); | ||
14 | |||
15 | foreach (@PC2_C) { | ||
16 | if ($_ ne "-") | ||
17 | { | ||
18 | $_--; | ||
19 | printf "%2d ",$_; } | ||
20 | else { print "-- "; } | ||
21 | $C{$_}=1; | ||
22 | print "\n" if (((++$i) % 8) == 0); | ||
23 | } | ||
24 | $i=0; | ||
25 | print "\n"; | ||
26 | foreach (@PC2_D) { | ||
27 | if ($_ ne "-") | ||
28 | { | ||
29 | $_-=29; | ||
30 | printf "%2d ",$_; } | ||
31 | else { print "-- "; } | ||
32 | $D{$_}=1; | ||
33 | print "\n" if (((++$i) % 8) == 0); } | ||
34 | |||
35 | print "\n"; | ||
36 | foreach $i (0 .. 27) | ||
37 | { | ||
38 | $_=$C{$i}; | ||
39 | if ($_ ne "-") {printf "%2d ",$_;} | ||
40 | else { print "-- "; } | ||
41 | print "\n" if (((++$i) % 8) == 0); | ||
42 | } | ||
43 | print "\n"; | ||
44 | |||
45 | print "\n"; | ||
46 | foreach $i (0 .. 27) | ||
47 | { | ||
48 | $_=$D{$i}; | ||
49 | if ($_ ne "-") {printf "%2d ",$_;} | ||
50 | else { print "-- "; } | ||
51 | print "\n" if (((++$i) % 8) == 0); | ||
52 | } | ||
53 | print "\n"; | ||
54 | sub numsort | ||
55 | { | ||
56 | $a-$b; | ||
57 | } | ||
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 @@ | |||
1 | ; Don't even think of reading this code | ||
2 | ; It was automatically generated by des-586.pl | ||
3 | ; Which is a perl program used to generate the x86 assember for | ||
4 | ; any of elf, a.out, BSDI,Win32, or Solaris | ||
5 | ; eric <eay@cryptsoft.com> | ||
6 | ; | ||
7 | TITLE des-586.asm | ||
8 | .386 | ||
9 | .model FLAT | ||
10 | _TEXT SEGMENT | ||
11 | PUBLIC _des_encrypt | ||
12 | EXTRN _des_SPtrans:DWORD | ||
13 | _des_encrypt PROC NEAR | ||
14 | push esi | ||
15 | push edi | ||
16 | ; | ||
17 | ; Load the 2 words | ||
18 | mov esi, DWORD PTR 12[esp] | ||
19 | xor ecx, ecx | ||
20 | push ebx | ||
21 | push ebp | ||
22 | mov eax, DWORD PTR [esi] | ||
23 | mov ebx, DWORD PTR 28[esp] | ||
24 | mov edi, DWORD PTR 4[esi] | ||
25 | ; | ||
26 | ; IP | ||
27 | rol eax, 4 | ||
28 | mov esi, eax | ||
29 | xor eax, edi | ||
30 | and eax, 0f0f0f0f0h | ||
31 | xor esi, eax | ||
32 | xor edi, eax | ||
33 | ; | ||
34 | rol edi, 20 | ||
35 | mov eax, edi | ||
36 | xor edi, esi | ||
37 | and edi, 0fff0000fh | ||
38 | xor eax, edi | ||
39 | xor esi, edi | ||
40 | ; | ||
41 | rol eax, 14 | ||
42 | mov edi, eax | ||
43 | xor eax, esi | ||
44 | and eax, 033333333h | ||
45 | xor edi, eax | ||
46 | xor esi, eax | ||
47 | ; | ||
48 | rol esi, 22 | ||
49 | mov eax, esi | ||
50 | xor esi, edi | ||
51 | and esi, 003fc03fch | ||
52 | xor eax, esi | ||
53 | xor edi, esi | ||
54 | ; | ||
55 | rol eax, 9 | ||
56 | mov esi, eax | ||
57 | xor eax, edi | ||
58 | and eax, 0aaaaaaaah | ||
59 | xor esi, eax | ||
60 | xor edi, eax | ||
61 | ; | ||
62 | rol edi, 1 | ||
63 | mov ebp, DWORD PTR 24[esp] | ||
64 | cmp ebx, 0 | ||
65 | je $L000start_decrypt | ||
66 | ; | ||
67 | ; Round 0 | ||
68 | mov eax, DWORD PTR [ebp] | ||
69 | xor ebx, ebx | ||
70 | mov edx, DWORD PTR 4[ebp] | ||
71 | xor eax, esi | ||
72 | xor edx, esi | ||
73 | and eax, 0fcfcfcfch | ||
74 | and edx, 0cfcfcfcfh | ||
75 | mov bl, al | ||
76 | mov cl, ah | ||
77 | ror edx, 4 | ||
78 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
79 | mov bl, dl | ||
80 | xor edi, ebp | ||
81 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
82 | xor edi, ebp | ||
83 | mov cl, dh | ||
84 | shr eax, 16 | ||
85 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
86 | xor edi, ebp | ||
87 | mov bl, ah | ||
88 | shr edx, 16 | ||
89 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
90 | xor edi, ebp | ||
91 | mov ebp, DWORD PTR 24[esp] | ||
92 | mov cl, dh | ||
93 | and eax, 0ffh | ||
94 | and edx, 0ffh | ||
95 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
96 | xor edi, ebx | ||
97 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
98 | xor edi, ebx | ||
99 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
100 | xor edi, ebx | ||
101 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
102 | xor edi, ebx | ||
103 | ; | ||
104 | ; Round 1 | ||
105 | mov eax, DWORD PTR 8[ebp] | ||
106 | xor ebx, ebx | ||
107 | mov edx, DWORD PTR 12[ebp] | ||
108 | xor eax, edi | ||
109 | xor edx, edi | ||
110 | and eax, 0fcfcfcfch | ||
111 | and edx, 0cfcfcfcfh | ||
112 | mov bl, al | ||
113 | mov cl, ah | ||
114 | ror edx, 4 | ||
115 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
116 | mov bl, dl | ||
117 | xor esi, ebp | ||
118 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
119 | xor esi, ebp | ||
120 | mov cl, dh | ||
121 | shr eax, 16 | ||
122 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
123 | xor esi, ebp | ||
124 | mov bl, ah | ||
125 | shr edx, 16 | ||
126 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
127 | xor esi, ebp | ||
128 | mov ebp, DWORD PTR 24[esp] | ||
129 | mov cl, dh | ||
130 | and eax, 0ffh | ||
131 | and edx, 0ffh | ||
132 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
133 | xor esi, ebx | ||
134 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
135 | xor esi, ebx | ||
136 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
137 | xor esi, ebx | ||
138 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
139 | xor esi, ebx | ||
140 | ; | ||
141 | ; Round 2 | ||
142 | mov eax, DWORD PTR 16[ebp] | ||
143 | xor ebx, ebx | ||
144 | mov edx, DWORD PTR 20[ebp] | ||
145 | xor eax, esi | ||
146 | xor edx, esi | ||
147 | and eax, 0fcfcfcfch | ||
148 | and edx, 0cfcfcfcfh | ||
149 | mov bl, al | ||
150 | mov cl, ah | ||
151 | ror edx, 4 | ||
152 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
153 | mov bl, dl | ||
154 | xor edi, ebp | ||
155 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
156 | xor edi, ebp | ||
157 | mov cl, dh | ||
158 | shr eax, 16 | ||
159 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
160 | xor edi, ebp | ||
161 | mov bl, ah | ||
162 | shr edx, 16 | ||
163 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
164 | xor edi, ebp | ||
165 | mov ebp, DWORD PTR 24[esp] | ||
166 | mov cl, dh | ||
167 | and eax, 0ffh | ||
168 | and edx, 0ffh | ||
169 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
170 | xor edi, ebx | ||
171 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
172 | xor edi, ebx | ||
173 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
174 | xor edi, ebx | ||
175 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
176 | xor edi, ebx | ||
177 | ; | ||
178 | ; Round 3 | ||
179 | mov eax, DWORD PTR 24[ebp] | ||
180 | xor ebx, ebx | ||
181 | mov edx, DWORD PTR 28[ebp] | ||
182 | xor eax, edi | ||
183 | xor edx, edi | ||
184 | and eax, 0fcfcfcfch | ||
185 | and edx, 0cfcfcfcfh | ||
186 | mov bl, al | ||
187 | mov cl, ah | ||
188 | ror edx, 4 | ||
189 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
190 | mov bl, dl | ||
191 | xor esi, ebp | ||
192 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
193 | xor esi, ebp | ||
194 | mov cl, dh | ||
195 | shr eax, 16 | ||
196 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
197 | xor esi, ebp | ||
198 | mov bl, ah | ||
199 | shr edx, 16 | ||
200 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
201 | xor esi, ebp | ||
202 | mov ebp, DWORD PTR 24[esp] | ||
203 | mov cl, dh | ||
204 | and eax, 0ffh | ||
205 | and edx, 0ffh | ||
206 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
207 | xor esi, ebx | ||
208 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
209 | xor esi, ebx | ||
210 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
211 | xor esi, ebx | ||
212 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
213 | xor esi, ebx | ||
214 | ; | ||
215 | ; Round 4 | ||
216 | mov eax, DWORD PTR 32[ebp] | ||
217 | xor ebx, ebx | ||
218 | mov edx, DWORD PTR 36[ebp] | ||
219 | xor eax, esi | ||
220 | xor edx, esi | ||
221 | and eax, 0fcfcfcfch | ||
222 | and edx, 0cfcfcfcfh | ||
223 | mov bl, al | ||
224 | mov cl, ah | ||
225 | ror edx, 4 | ||
226 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
227 | mov bl, dl | ||
228 | xor edi, ebp | ||
229 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
230 | xor edi, ebp | ||
231 | mov cl, dh | ||
232 | shr eax, 16 | ||
233 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
234 | xor edi, ebp | ||
235 | mov bl, ah | ||
236 | shr edx, 16 | ||
237 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
238 | xor edi, ebp | ||
239 | mov ebp, DWORD PTR 24[esp] | ||
240 | mov cl, dh | ||
241 | and eax, 0ffh | ||
242 | and edx, 0ffh | ||
243 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
244 | xor edi, ebx | ||
245 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
246 | xor edi, ebx | ||
247 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
248 | xor edi, ebx | ||
249 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
250 | xor edi, ebx | ||
251 | ; | ||
252 | ; Round 5 | ||
253 | mov eax, DWORD PTR 40[ebp] | ||
254 | xor ebx, ebx | ||
255 | mov edx, DWORD PTR 44[ebp] | ||
256 | xor eax, edi | ||
257 | xor edx, edi | ||
258 | and eax, 0fcfcfcfch | ||
259 | and edx, 0cfcfcfcfh | ||
260 | mov bl, al | ||
261 | mov cl, ah | ||
262 | ror edx, 4 | ||
263 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
264 | mov bl, dl | ||
265 | xor esi, ebp | ||
266 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
267 | xor esi, ebp | ||
268 | mov cl, dh | ||
269 | shr eax, 16 | ||
270 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
271 | xor esi, ebp | ||
272 | mov bl, ah | ||
273 | shr edx, 16 | ||
274 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
275 | xor esi, ebp | ||
276 | mov ebp, DWORD PTR 24[esp] | ||
277 | mov cl, dh | ||
278 | and eax, 0ffh | ||
279 | and edx, 0ffh | ||
280 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
281 | xor esi, ebx | ||
282 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
283 | xor esi, ebx | ||
284 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
285 | xor esi, ebx | ||
286 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
287 | xor esi, ebx | ||
288 | ; | ||
289 | ; Round 6 | ||
290 | mov eax, DWORD PTR 48[ebp] | ||
291 | xor ebx, ebx | ||
292 | mov edx, DWORD PTR 52[ebp] | ||
293 | xor eax, esi | ||
294 | xor edx, esi | ||
295 | and eax, 0fcfcfcfch | ||
296 | and edx, 0cfcfcfcfh | ||
297 | mov bl, al | ||
298 | mov cl, ah | ||
299 | ror edx, 4 | ||
300 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
301 | mov bl, dl | ||
302 | xor edi, ebp | ||
303 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
304 | xor edi, ebp | ||
305 | mov cl, dh | ||
306 | shr eax, 16 | ||
307 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
308 | xor edi, ebp | ||
309 | mov bl, ah | ||
310 | shr edx, 16 | ||
311 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
312 | xor edi, ebp | ||
313 | mov ebp, DWORD PTR 24[esp] | ||
314 | mov cl, dh | ||
315 | and eax, 0ffh | ||
316 | and edx, 0ffh | ||
317 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
318 | xor edi, ebx | ||
319 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
320 | xor edi, ebx | ||
321 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
322 | xor edi, ebx | ||
323 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
324 | xor edi, ebx | ||
325 | ; | ||
326 | ; Round 7 | ||
327 | mov eax, DWORD PTR 56[ebp] | ||
328 | xor ebx, ebx | ||
329 | mov edx, DWORD PTR 60[ebp] | ||
330 | xor eax, edi | ||
331 | xor edx, edi | ||
332 | and eax, 0fcfcfcfch | ||
333 | and edx, 0cfcfcfcfh | ||
334 | mov bl, al | ||
335 | mov cl, ah | ||
336 | ror edx, 4 | ||
337 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
338 | mov bl, dl | ||
339 | xor esi, ebp | ||
340 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
341 | xor esi, ebp | ||
342 | mov cl, dh | ||
343 | shr eax, 16 | ||
344 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
345 | xor esi, ebp | ||
346 | mov bl, ah | ||
347 | shr edx, 16 | ||
348 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
349 | xor esi, ebp | ||
350 | mov ebp, DWORD PTR 24[esp] | ||
351 | mov cl, dh | ||
352 | and eax, 0ffh | ||
353 | and edx, 0ffh | ||
354 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
355 | xor esi, ebx | ||
356 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
357 | xor esi, ebx | ||
358 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
359 | xor esi, ebx | ||
360 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
361 | xor esi, ebx | ||
362 | ; | ||
363 | ; Round 8 | ||
364 | mov eax, DWORD PTR 64[ebp] | ||
365 | xor ebx, ebx | ||
366 | mov edx, DWORD PTR 68[ebp] | ||
367 | xor eax, esi | ||
368 | xor edx, esi | ||
369 | and eax, 0fcfcfcfch | ||
370 | and edx, 0cfcfcfcfh | ||
371 | mov bl, al | ||
372 | mov cl, ah | ||
373 | ror edx, 4 | ||
374 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
375 | mov bl, dl | ||
376 | xor edi, ebp | ||
377 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
378 | xor edi, ebp | ||
379 | mov cl, dh | ||
380 | shr eax, 16 | ||
381 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
382 | xor edi, ebp | ||
383 | mov bl, ah | ||
384 | shr edx, 16 | ||
385 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
386 | xor edi, ebp | ||
387 | mov ebp, DWORD PTR 24[esp] | ||
388 | mov cl, dh | ||
389 | and eax, 0ffh | ||
390 | and edx, 0ffh | ||
391 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
392 | xor edi, ebx | ||
393 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
394 | xor edi, ebx | ||
395 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
396 | xor edi, ebx | ||
397 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
398 | xor edi, ebx | ||
399 | ; | ||
400 | ; Round 9 | ||
401 | mov eax, DWORD PTR 72[ebp] | ||
402 | xor ebx, ebx | ||
403 | mov edx, DWORD PTR 76[ebp] | ||
404 | xor eax, edi | ||
405 | xor edx, edi | ||
406 | and eax, 0fcfcfcfch | ||
407 | and edx, 0cfcfcfcfh | ||
408 | mov bl, al | ||
409 | mov cl, ah | ||
410 | ror edx, 4 | ||
411 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
412 | mov bl, dl | ||
413 | xor esi, ebp | ||
414 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
415 | xor esi, ebp | ||
416 | mov cl, dh | ||
417 | shr eax, 16 | ||
418 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
419 | xor esi, ebp | ||
420 | mov bl, ah | ||
421 | shr edx, 16 | ||
422 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
423 | xor esi, ebp | ||
424 | mov ebp, DWORD PTR 24[esp] | ||
425 | mov cl, dh | ||
426 | and eax, 0ffh | ||
427 | and edx, 0ffh | ||
428 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
429 | xor esi, ebx | ||
430 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
431 | xor esi, ebx | ||
432 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
433 | xor esi, ebx | ||
434 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
435 | xor esi, ebx | ||
436 | ; | ||
437 | ; Round 10 | ||
438 | mov eax, DWORD PTR 80[ebp] | ||
439 | xor ebx, ebx | ||
440 | mov edx, DWORD PTR 84[ebp] | ||
441 | xor eax, esi | ||
442 | xor edx, esi | ||
443 | and eax, 0fcfcfcfch | ||
444 | and edx, 0cfcfcfcfh | ||
445 | mov bl, al | ||
446 | mov cl, ah | ||
447 | ror edx, 4 | ||
448 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
449 | mov bl, dl | ||
450 | xor edi, ebp | ||
451 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
452 | xor edi, ebp | ||
453 | mov cl, dh | ||
454 | shr eax, 16 | ||
455 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
456 | xor edi, ebp | ||
457 | mov bl, ah | ||
458 | shr edx, 16 | ||
459 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
460 | xor edi, ebp | ||
461 | mov ebp, DWORD PTR 24[esp] | ||
462 | mov cl, dh | ||
463 | and eax, 0ffh | ||
464 | and edx, 0ffh | ||
465 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
466 | xor edi, ebx | ||
467 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
468 | xor edi, ebx | ||
469 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
470 | xor edi, ebx | ||
471 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
472 | xor edi, ebx | ||
473 | ; | ||
474 | ; Round 11 | ||
475 | mov eax, DWORD PTR 88[ebp] | ||
476 | xor ebx, ebx | ||
477 | mov edx, DWORD PTR 92[ebp] | ||
478 | xor eax, edi | ||
479 | xor edx, edi | ||
480 | and eax, 0fcfcfcfch | ||
481 | and edx, 0cfcfcfcfh | ||
482 | mov bl, al | ||
483 | mov cl, ah | ||
484 | ror edx, 4 | ||
485 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
486 | mov bl, dl | ||
487 | xor esi, ebp | ||
488 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
489 | xor esi, ebp | ||
490 | mov cl, dh | ||
491 | shr eax, 16 | ||
492 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
493 | xor esi, ebp | ||
494 | mov bl, ah | ||
495 | shr edx, 16 | ||
496 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
497 | xor esi, ebp | ||
498 | mov ebp, DWORD PTR 24[esp] | ||
499 | mov cl, dh | ||
500 | and eax, 0ffh | ||
501 | and edx, 0ffh | ||
502 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
503 | xor esi, ebx | ||
504 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
505 | xor esi, ebx | ||
506 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
507 | xor esi, ebx | ||
508 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
509 | xor esi, ebx | ||
510 | ; | ||
511 | ; Round 12 | ||
512 | mov eax, DWORD PTR 96[ebp] | ||
513 | xor ebx, ebx | ||
514 | mov edx, DWORD PTR 100[ebp] | ||
515 | xor eax, esi | ||
516 | xor edx, esi | ||
517 | and eax, 0fcfcfcfch | ||
518 | and edx, 0cfcfcfcfh | ||
519 | mov bl, al | ||
520 | mov cl, ah | ||
521 | ror edx, 4 | ||
522 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
523 | mov bl, dl | ||
524 | xor edi, ebp | ||
525 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
526 | xor edi, ebp | ||
527 | mov cl, dh | ||
528 | shr eax, 16 | ||
529 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
530 | xor edi, ebp | ||
531 | mov bl, ah | ||
532 | shr edx, 16 | ||
533 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
534 | xor edi, ebp | ||
535 | mov ebp, DWORD PTR 24[esp] | ||
536 | mov cl, dh | ||
537 | and eax, 0ffh | ||
538 | and edx, 0ffh | ||
539 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
540 | xor edi, ebx | ||
541 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
542 | xor edi, ebx | ||
543 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
544 | xor edi, ebx | ||
545 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
546 | xor edi, ebx | ||
547 | ; | ||
548 | ; Round 13 | ||
549 | mov eax, DWORD PTR 104[ebp] | ||
550 | xor ebx, ebx | ||
551 | mov edx, DWORD PTR 108[ebp] | ||
552 | xor eax, edi | ||
553 | xor edx, edi | ||
554 | and eax, 0fcfcfcfch | ||
555 | and edx, 0cfcfcfcfh | ||
556 | mov bl, al | ||
557 | mov cl, ah | ||
558 | ror edx, 4 | ||
559 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
560 | mov bl, dl | ||
561 | xor esi, ebp | ||
562 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
563 | xor esi, ebp | ||
564 | mov cl, dh | ||
565 | shr eax, 16 | ||
566 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
567 | xor esi, ebp | ||
568 | mov bl, ah | ||
569 | shr edx, 16 | ||
570 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
571 | xor esi, ebp | ||
572 | mov ebp, DWORD PTR 24[esp] | ||
573 | mov cl, dh | ||
574 | and eax, 0ffh | ||
575 | and edx, 0ffh | ||
576 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
577 | xor esi, ebx | ||
578 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
579 | xor esi, ebx | ||
580 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
581 | xor esi, ebx | ||
582 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
583 | xor esi, ebx | ||
584 | ; | ||
585 | ; Round 14 | ||
586 | mov eax, DWORD PTR 112[ebp] | ||
587 | xor ebx, ebx | ||
588 | mov edx, DWORD PTR 116[ebp] | ||
589 | xor eax, esi | ||
590 | xor edx, esi | ||
591 | and eax, 0fcfcfcfch | ||
592 | and edx, 0cfcfcfcfh | ||
593 | mov bl, al | ||
594 | mov cl, ah | ||
595 | ror edx, 4 | ||
596 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
597 | mov bl, dl | ||
598 | xor edi, ebp | ||
599 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
600 | xor edi, ebp | ||
601 | mov cl, dh | ||
602 | shr eax, 16 | ||
603 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
604 | xor edi, ebp | ||
605 | mov bl, ah | ||
606 | shr edx, 16 | ||
607 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
608 | xor edi, ebp | ||
609 | mov ebp, DWORD PTR 24[esp] | ||
610 | mov cl, dh | ||
611 | and eax, 0ffh | ||
612 | and edx, 0ffh | ||
613 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
614 | xor edi, ebx | ||
615 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
616 | xor edi, ebx | ||
617 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
618 | xor edi, ebx | ||
619 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
620 | xor edi, ebx | ||
621 | ; | ||
622 | ; Round 15 | ||
623 | mov eax, DWORD PTR 120[ebp] | ||
624 | xor ebx, ebx | ||
625 | mov edx, DWORD PTR 124[ebp] | ||
626 | xor eax, edi | ||
627 | xor edx, edi | ||
628 | and eax, 0fcfcfcfch | ||
629 | and edx, 0cfcfcfcfh | ||
630 | mov bl, al | ||
631 | mov cl, ah | ||
632 | ror edx, 4 | ||
633 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
634 | mov bl, dl | ||
635 | xor esi, ebp | ||
636 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
637 | xor esi, ebp | ||
638 | mov cl, dh | ||
639 | shr eax, 16 | ||
640 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
641 | xor esi, ebp | ||
642 | mov bl, ah | ||
643 | shr edx, 16 | ||
644 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
645 | xor esi, ebp | ||
646 | mov ebp, DWORD PTR 24[esp] | ||
647 | mov cl, dh | ||
648 | and eax, 0ffh | ||
649 | and edx, 0ffh | ||
650 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
651 | xor esi, ebx | ||
652 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
653 | xor esi, ebx | ||
654 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
655 | xor esi, ebx | ||
656 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
657 | xor esi, ebx | ||
658 | jmp $L001end | ||
659 | $L000start_decrypt: | ||
660 | ; | ||
661 | ; Round 15 | ||
662 | mov eax, DWORD PTR 120[ebp] | ||
663 | xor ebx, ebx | ||
664 | mov edx, DWORD PTR 124[ebp] | ||
665 | xor eax, esi | ||
666 | xor edx, esi | ||
667 | and eax, 0fcfcfcfch | ||
668 | and edx, 0cfcfcfcfh | ||
669 | mov bl, al | ||
670 | mov cl, ah | ||
671 | ror edx, 4 | ||
672 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
673 | mov bl, dl | ||
674 | xor edi, ebp | ||
675 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
676 | xor edi, ebp | ||
677 | mov cl, dh | ||
678 | shr eax, 16 | ||
679 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
680 | xor edi, ebp | ||
681 | mov bl, ah | ||
682 | shr edx, 16 | ||
683 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
684 | xor edi, ebp | ||
685 | mov ebp, DWORD PTR 24[esp] | ||
686 | mov cl, dh | ||
687 | and eax, 0ffh | ||
688 | and edx, 0ffh | ||
689 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
690 | xor edi, ebx | ||
691 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
692 | xor edi, ebx | ||
693 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
694 | xor edi, ebx | ||
695 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
696 | xor edi, ebx | ||
697 | ; | ||
698 | ; Round 14 | ||
699 | mov eax, DWORD PTR 112[ebp] | ||
700 | xor ebx, ebx | ||
701 | mov edx, DWORD PTR 116[ebp] | ||
702 | xor eax, edi | ||
703 | xor edx, edi | ||
704 | and eax, 0fcfcfcfch | ||
705 | and edx, 0cfcfcfcfh | ||
706 | mov bl, al | ||
707 | mov cl, ah | ||
708 | ror edx, 4 | ||
709 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
710 | mov bl, dl | ||
711 | xor esi, ebp | ||
712 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
713 | xor esi, ebp | ||
714 | mov cl, dh | ||
715 | shr eax, 16 | ||
716 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
717 | xor esi, ebp | ||
718 | mov bl, ah | ||
719 | shr edx, 16 | ||
720 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
721 | xor esi, ebp | ||
722 | mov ebp, DWORD PTR 24[esp] | ||
723 | mov cl, dh | ||
724 | and eax, 0ffh | ||
725 | and edx, 0ffh | ||
726 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
727 | xor esi, ebx | ||
728 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
729 | xor esi, ebx | ||
730 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
731 | xor esi, ebx | ||
732 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
733 | xor esi, ebx | ||
734 | ; | ||
735 | ; Round 13 | ||
736 | mov eax, DWORD PTR 104[ebp] | ||
737 | xor ebx, ebx | ||
738 | mov edx, DWORD PTR 108[ebp] | ||
739 | xor eax, esi | ||
740 | xor edx, esi | ||
741 | and eax, 0fcfcfcfch | ||
742 | and edx, 0cfcfcfcfh | ||
743 | mov bl, al | ||
744 | mov cl, ah | ||
745 | ror edx, 4 | ||
746 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
747 | mov bl, dl | ||
748 | xor edi, ebp | ||
749 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
750 | xor edi, ebp | ||
751 | mov cl, dh | ||
752 | shr eax, 16 | ||
753 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
754 | xor edi, ebp | ||
755 | mov bl, ah | ||
756 | shr edx, 16 | ||
757 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
758 | xor edi, ebp | ||
759 | mov ebp, DWORD PTR 24[esp] | ||
760 | mov cl, dh | ||
761 | and eax, 0ffh | ||
762 | and edx, 0ffh | ||
763 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
764 | xor edi, ebx | ||
765 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
766 | xor edi, ebx | ||
767 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
768 | xor edi, ebx | ||
769 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
770 | xor edi, ebx | ||
771 | ; | ||
772 | ; Round 12 | ||
773 | mov eax, DWORD PTR 96[ebp] | ||
774 | xor ebx, ebx | ||
775 | mov edx, DWORD PTR 100[ebp] | ||
776 | xor eax, edi | ||
777 | xor edx, edi | ||
778 | and eax, 0fcfcfcfch | ||
779 | and edx, 0cfcfcfcfh | ||
780 | mov bl, al | ||
781 | mov cl, ah | ||
782 | ror edx, 4 | ||
783 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
784 | mov bl, dl | ||
785 | xor esi, ebp | ||
786 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
787 | xor esi, ebp | ||
788 | mov cl, dh | ||
789 | shr eax, 16 | ||
790 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
791 | xor esi, ebp | ||
792 | mov bl, ah | ||
793 | shr edx, 16 | ||
794 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
795 | xor esi, ebp | ||
796 | mov ebp, DWORD PTR 24[esp] | ||
797 | mov cl, dh | ||
798 | and eax, 0ffh | ||
799 | and edx, 0ffh | ||
800 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
801 | xor esi, ebx | ||
802 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
803 | xor esi, ebx | ||
804 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
805 | xor esi, ebx | ||
806 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
807 | xor esi, ebx | ||
808 | ; | ||
809 | ; Round 11 | ||
810 | mov eax, DWORD PTR 88[ebp] | ||
811 | xor ebx, ebx | ||
812 | mov edx, DWORD PTR 92[ebp] | ||
813 | xor eax, esi | ||
814 | xor edx, esi | ||
815 | and eax, 0fcfcfcfch | ||
816 | and edx, 0cfcfcfcfh | ||
817 | mov bl, al | ||
818 | mov cl, ah | ||
819 | ror edx, 4 | ||
820 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
821 | mov bl, dl | ||
822 | xor edi, ebp | ||
823 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
824 | xor edi, ebp | ||
825 | mov cl, dh | ||
826 | shr eax, 16 | ||
827 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
828 | xor edi, ebp | ||
829 | mov bl, ah | ||
830 | shr edx, 16 | ||
831 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
832 | xor edi, ebp | ||
833 | mov ebp, DWORD PTR 24[esp] | ||
834 | mov cl, dh | ||
835 | and eax, 0ffh | ||
836 | and edx, 0ffh | ||
837 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
838 | xor edi, ebx | ||
839 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
840 | xor edi, ebx | ||
841 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
842 | xor edi, ebx | ||
843 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
844 | xor edi, ebx | ||
845 | ; | ||
846 | ; Round 10 | ||
847 | mov eax, DWORD PTR 80[ebp] | ||
848 | xor ebx, ebx | ||
849 | mov edx, DWORD PTR 84[ebp] | ||
850 | xor eax, edi | ||
851 | xor edx, edi | ||
852 | and eax, 0fcfcfcfch | ||
853 | and edx, 0cfcfcfcfh | ||
854 | mov bl, al | ||
855 | mov cl, ah | ||
856 | ror edx, 4 | ||
857 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
858 | mov bl, dl | ||
859 | xor esi, ebp | ||
860 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
861 | xor esi, ebp | ||
862 | mov cl, dh | ||
863 | shr eax, 16 | ||
864 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
865 | xor esi, ebp | ||
866 | mov bl, ah | ||
867 | shr edx, 16 | ||
868 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
869 | xor esi, ebp | ||
870 | mov ebp, DWORD PTR 24[esp] | ||
871 | mov cl, dh | ||
872 | and eax, 0ffh | ||
873 | and edx, 0ffh | ||
874 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
875 | xor esi, ebx | ||
876 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
877 | xor esi, ebx | ||
878 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
879 | xor esi, ebx | ||
880 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
881 | xor esi, ebx | ||
882 | ; | ||
883 | ; Round 9 | ||
884 | mov eax, DWORD PTR 72[ebp] | ||
885 | xor ebx, ebx | ||
886 | mov edx, DWORD PTR 76[ebp] | ||
887 | xor eax, esi | ||
888 | xor edx, esi | ||
889 | and eax, 0fcfcfcfch | ||
890 | and edx, 0cfcfcfcfh | ||
891 | mov bl, al | ||
892 | mov cl, ah | ||
893 | ror edx, 4 | ||
894 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
895 | mov bl, dl | ||
896 | xor edi, ebp | ||
897 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
898 | xor edi, ebp | ||
899 | mov cl, dh | ||
900 | shr eax, 16 | ||
901 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
902 | xor edi, ebp | ||
903 | mov bl, ah | ||
904 | shr edx, 16 | ||
905 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
906 | xor edi, ebp | ||
907 | mov ebp, DWORD PTR 24[esp] | ||
908 | mov cl, dh | ||
909 | and eax, 0ffh | ||
910 | and edx, 0ffh | ||
911 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
912 | xor edi, ebx | ||
913 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
914 | xor edi, ebx | ||
915 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
916 | xor edi, ebx | ||
917 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
918 | xor edi, ebx | ||
919 | ; | ||
920 | ; Round 8 | ||
921 | mov eax, DWORD PTR 64[ebp] | ||
922 | xor ebx, ebx | ||
923 | mov edx, DWORD PTR 68[ebp] | ||
924 | xor eax, edi | ||
925 | xor edx, edi | ||
926 | and eax, 0fcfcfcfch | ||
927 | and edx, 0cfcfcfcfh | ||
928 | mov bl, al | ||
929 | mov cl, ah | ||
930 | ror edx, 4 | ||
931 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
932 | mov bl, dl | ||
933 | xor esi, ebp | ||
934 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
935 | xor esi, ebp | ||
936 | mov cl, dh | ||
937 | shr eax, 16 | ||
938 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
939 | xor esi, ebp | ||
940 | mov bl, ah | ||
941 | shr edx, 16 | ||
942 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
943 | xor esi, ebp | ||
944 | mov ebp, DWORD PTR 24[esp] | ||
945 | mov cl, dh | ||
946 | and eax, 0ffh | ||
947 | and edx, 0ffh | ||
948 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
949 | xor esi, ebx | ||
950 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
951 | xor esi, ebx | ||
952 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
953 | xor esi, ebx | ||
954 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
955 | xor esi, ebx | ||
956 | ; | ||
957 | ; Round 7 | ||
958 | mov eax, DWORD PTR 56[ebp] | ||
959 | xor ebx, ebx | ||
960 | mov edx, DWORD PTR 60[ebp] | ||
961 | xor eax, esi | ||
962 | xor edx, esi | ||
963 | and eax, 0fcfcfcfch | ||
964 | and edx, 0cfcfcfcfh | ||
965 | mov bl, al | ||
966 | mov cl, ah | ||
967 | ror edx, 4 | ||
968 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
969 | mov bl, dl | ||
970 | xor edi, ebp | ||
971 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
972 | xor edi, ebp | ||
973 | mov cl, dh | ||
974 | shr eax, 16 | ||
975 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
976 | xor edi, ebp | ||
977 | mov bl, ah | ||
978 | shr edx, 16 | ||
979 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
980 | xor edi, ebp | ||
981 | mov ebp, DWORD PTR 24[esp] | ||
982 | mov cl, dh | ||
983 | and eax, 0ffh | ||
984 | and edx, 0ffh | ||
985 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
986 | xor edi, ebx | ||
987 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
988 | xor edi, ebx | ||
989 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
990 | xor edi, ebx | ||
991 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
992 | xor edi, ebx | ||
993 | ; | ||
994 | ; Round 6 | ||
995 | mov eax, DWORD PTR 48[ebp] | ||
996 | xor ebx, ebx | ||
997 | mov edx, DWORD PTR 52[ebp] | ||
998 | xor eax, edi | ||
999 | xor edx, edi | ||
1000 | and eax, 0fcfcfcfch | ||
1001 | and edx, 0cfcfcfcfh | ||
1002 | mov bl, al | ||
1003 | mov cl, ah | ||
1004 | ror edx, 4 | ||
1005 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1006 | mov bl, dl | ||
1007 | xor esi, ebp | ||
1008 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1009 | xor esi, ebp | ||
1010 | mov cl, dh | ||
1011 | shr eax, 16 | ||
1012 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1013 | xor esi, ebp | ||
1014 | mov bl, ah | ||
1015 | shr edx, 16 | ||
1016 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1017 | xor esi, ebp | ||
1018 | mov ebp, DWORD PTR 24[esp] | ||
1019 | mov cl, dh | ||
1020 | and eax, 0ffh | ||
1021 | and edx, 0ffh | ||
1022 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1023 | xor esi, ebx | ||
1024 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1025 | xor esi, ebx | ||
1026 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1027 | xor esi, ebx | ||
1028 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1029 | xor esi, ebx | ||
1030 | ; | ||
1031 | ; Round 5 | ||
1032 | mov eax, DWORD PTR 40[ebp] | ||
1033 | xor ebx, ebx | ||
1034 | mov edx, DWORD PTR 44[ebp] | ||
1035 | xor eax, esi | ||
1036 | xor edx, esi | ||
1037 | and eax, 0fcfcfcfch | ||
1038 | and edx, 0cfcfcfcfh | ||
1039 | mov bl, al | ||
1040 | mov cl, ah | ||
1041 | ror edx, 4 | ||
1042 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1043 | mov bl, dl | ||
1044 | xor edi, ebp | ||
1045 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1046 | xor edi, ebp | ||
1047 | mov cl, dh | ||
1048 | shr eax, 16 | ||
1049 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1050 | xor edi, ebp | ||
1051 | mov bl, ah | ||
1052 | shr edx, 16 | ||
1053 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1054 | xor edi, ebp | ||
1055 | mov ebp, DWORD PTR 24[esp] | ||
1056 | mov cl, dh | ||
1057 | and eax, 0ffh | ||
1058 | and edx, 0ffh | ||
1059 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1060 | xor edi, ebx | ||
1061 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1062 | xor edi, ebx | ||
1063 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1064 | xor edi, ebx | ||
1065 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1066 | xor edi, ebx | ||
1067 | ; | ||
1068 | ; Round 4 | ||
1069 | mov eax, DWORD PTR 32[ebp] | ||
1070 | xor ebx, ebx | ||
1071 | mov edx, DWORD PTR 36[ebp] | ||
1072 | xor eax, edi | ||
1073 | xor edx, edi | ||
1074 | and eax, 0fcfcfcfch | ||
1075 | and edx, 0cfcfcfcfh | ||
1076 | mov bl, al | ||
1077 | mov cl, ah | ||
1078 | ror edx, 4 | ||
1079 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1080 | mov bl, dl | ||
1081 | xor esi, ebp | ||
1082 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1083 | xor esi, ebp | ||
1084 | mov cl, dh | ||
1085 | shr eax, 16 | ||
1086 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1087 | xor esi, ebp | ||
1088 | mov bl, ah | ||
1089 | shr edx, 16 | ||
1090 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1091 | xor esi, ebp | ||
1092 | mov ebp, DWORD PTR 24[esp] | ||
1093 | mov cl, dh | ||
1094 | and eax, 0ffh | ||
1095 | and edx, 0ffh | ||
1096 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1097 | xor esi, ebx | ||
1098 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1099 | xor esi, ebx | ||
1100 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1101 | xor esi, ebx | ||
1102 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1103 | xor esi, ebx | ||
1104 | ; | ||
1105 | ; Round 3 | ||
1106 | mov eax, DWORD PTR 24[ebp] | ||
1107 | xor ebx, ebx | ||
1108 | mov edx, DWORD PTR 28[ebp] | ||
1109 | xor eax, esi | ||
1110 | xor edx, esi | ||
1111 | and eax, 0fcfcfcfch | ||
1112 | and edx, 0cfcfcfcfh | ||
1113 | mov bl, al | ||
1114 | mov cl, ah | ||
1115 | ror edx, 4 | ||
1116 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1117 | mov bl, dl | ||
1118 | xor edi, ebp | ||
1119 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1120 | xor edi, ebp | ||
1121 | mov cl, dh | ||
1122 | shr eax, 16 | ||
1123 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1124 | xor edi, ebp | ||
1125 | mov bl, ah | ||
1126 | shr edx, 16 | ||
1127 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1128 | xor edi, ebp | ||
1129 | mov ebp, DWORD PTR 24[esp] | ||
1130 | mov cl, dh | ||
1131 | and eax, 0ffh | ||
1132 | and edx, 0ffh | ||
1133 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1134 | xor edi, ebx | ||
1135 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1136 | xor edi, ebx | ||
1137 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1138 | xor edi, ebx | ||
1139 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1140 | xor edi, ebx | ||
1141 | ; | ||
1142 | ; Round 2 | ||
1143 | mov eax, DWORD PTR 16[ebp] | ||
1144 | xor ebx, ebx | ||
1145 | mov edx, DWORD PTR 20[ebp] | ||
1146 | xor eax, edi | ||
1147 | xor edx, edi | ||
1148 | and eax, 0fcfcfcfch | ||
1149 | and edx, 0cfcfcfcfh | ||
1150 | mov bl, al | ||
1151 | mov cl, ah | ||
1152 | ror edx, 4 | ||
1153 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1154 | mov bl, dl | ||
1155 | xor esi, ebp | ||
1156 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1157 | xor esi, ebp | ||
1158 | mov cl, dh | ||
1159 | shr eax, 16 | ||
1160 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1161 | xor esi, ebp | ||
1162 | mov bl, ah | ||
1163 | shr edx, 16 | ||
1164 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1165 | xor esi, ebp | ||
1166 | mov ebp, DWORD PTR 24[esp] | ||
1167 | mov cl, dh | ||
1168 | and eax, 0ffh | ||
1169 | and edx, 0ffh | ||
1170 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1171 | xor esi, ebx | ||
1172 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1173 | xor esi, ebx | ||
1174 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1175 | xor esi, ebx | ||
1176 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1177 | xor esi, ebx | ||
1178 | ; | ||
1179 | ; Round 1 | ||
1180 | mov eax, DWORD PTR 8[ebp] | ||
1181 | xor ebx, ebx | ||
1182 | mov edx, DWORD PTR 12[ebp] | ||
1183 | xor eax, esi | ||
1184 | xor edx, esi | ||
1185 | and eax, 0fcfcfcfch | ||
1186 | and edx, 0cfcfcfcfh | ||
1187 | mov bl, al | ||
1188 | mov cl, ah | ||
1189 | ror edx, 4 | ||
1190 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1191 | mov bl, dl | ||
1192 | xor edi, ebp | ||
1193 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1194 | xor edi, ebp | ||
1195 | mov cl, dh | ||
1196 | shr eax, 16 | ||
1197 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1198 | xor edi, ebp | ||
1199 | mov bl, ah | ||
1200 | shr edx, 16 | ||
1201 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1202 | xor edi, ebp | ||
1203 | mov ebp, DWORD PTR 24[esp] | ||
1204 | mov cl, dh | ||
1205 | and eax, 0ffh | ||
1206 | and edx, 0ffh | ||
1207 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1208 | xor edi, ebx | ||
1209 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1210 | xor edi, ebx | ||
1211 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1212 | xor edi, ebx | ||
1213 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1214 | xor edi, ebx | ||
1215 | ; | ||
1216 | ; Round 0 | ||
1217 | mov eax, DWORD PTR [ebp] | ||
1218 | xor ebx, ebx | ||
1219 | mov edx, DWORD PTR 4[ebp] | ||
1220 | xor eax, edi | ||
1221 | xor edx, edi | ||
1222 | and eax, 0fcfcfcfch | ||
1223 | and edx, 0cfcfcfcfh | ||
1224 | mov bl, al | ||
1225 | mov cl, ah | ||
1226 | ror edx, 4 | ||
1227 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1228 | mov bl, dl | ||
1229 | xor esi, ebp | ||
1230 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1231 | xor esi, ebp | ||
1232 | mov cl, dh | ||
1233 | shr eax, 16 | ||
1234 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1235 | xor esi, ebp | ||
1236 | mov bl, ah | ||
1237 | shr edx, 16 | ||
1238 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1239 | xor esi, ebp | ||
1240 | mov ebp, DWORD PTR 24[esp] | ||
1241 | mov cl, dh | ||
1242 | and eax, 0ffh | ||
1243 | and edx, 0ffh | ||
1244 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1245 | xor esi, ebx | ||
1246 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1247 | xor esi, ebx | ||
1248 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1249 | xor esi, ebx | ||
1250 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1251 | xor esi, ebx | ||
1252 | $L001end: | ||
1253 | ; | ||
1254 | ; FP | ||
1255 | mov edx, DWORD PTR 20[esp] | ||
1256 | ror esi, 1 | ||
1257 | mov eax, edi | ||
1258 | xor edi, esi | ||
1259 | and edi, 0aaaaaaaah | ||
1260 | xor eax, edi | ||
1261 | xor esi, edi | ||
1262 | ; | ||
1263 | rol eax, 23 | ||
1264 | mov edi, eax | ||
1265 | xor eax, esi | ||
1266 | and eax, 003fc03fch | ||
1267 | xor edi, eax | ||
1268 | xor esi, eax | ||
1269 | ; | ||
1270 | rol edi, 10 | ||
1271 | mov eax, edi | ||
1272 | xor edi, esi | ||
1273 | and edi, 033333333h | ||
1274 | xor eax, edi | ||
1275 | xor esi, edi | ||
1276 | ; | ||
1277 | rol esi, 18 | ||
1278 | mov edi, esi | ||
1279 | xor esi, eax | ||
1280 | and esi, 0fff0000fh | ||
1281 | xor edi, esi | ||
1282 | xor eax, esi | ||
1283 | ; | ||
1284 | rol edi, 12 | ||
1285 | mov esi, edi | ||
1286 | xor edi, eax | ||
1287 | and edi, 0f0f0f0f0h | ||
1288 | xor esi, edi | ||
1289 | xor eax, edi | ||
1290 | ; | ||
1291 | ror eax, 4 | ||
1292 | mov DWORD PTR [edx],eax | ||
1293 | mov DWORD PTR 4[edx],esi | ||
1294 | pop ebp | ||
1295 | pop ebx | ||
1296 | pop edi | ||
1297 | pop esi | ||
1298 | ret | ||
1299 | _des_encrypt ENDP | ||
1300 | _TEXT ENDS | ||
1301 | _TEXT SEGMENT | ||
1302 | PUBLIC _des_encrypt2 | ||
1303 | EXTRN _des_SPtrans:DWORD | ||
1304 | _des_encrypt2 PROC NEAR | ||
1305 | push esi | ||
1306 | push edi | ||
1307 | ; | ||
1308 | ; Load the 2 words | ||
1309 | mov eax, DWORD PTR 12[esp] | ||
1310 | xor ecx, ecx | ||
1311 | push ebx | ||
1312 | push ebp | ||
1313 | mov esi, DWORD PTR [eax] | ||
1314 | mov ebx, DWORD PTR 28[esp] | ||
1315 | rol esi, 3 | ||
1316 | mov edi, DWORD PTR 4[eax] | ||
1317 | rol edi, 3 | ||
1318 | mov ebp, DWORD PTR 24[esp] | ||
1319 | cmp ebx, 0 | ||
1320 | je $L002start_decrypt | ||
1321 | ; | ||
1322 | ; Round 0 | ||
1323 | mov eax, DWORD PTR [ebp] | ||
1324 | xor ebx, ebx | ||
1325 | mov edx, DWORD PTR 4[ebp] | ||
1326 | xor eax, esi | ||
1327 | xor edx, esi | ||
1328 | and eax, 0fcfcfcfch | ||
1329 | and edx, 0cfcfcfcfh | ||
1330 | mov bl, al | ||
1331 | mov cl, ah | ||
1332 | ror edx, 4 | ||
1333 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1334 | mov bl, dl | ||
1335 | xor edi, ebp | ||
1336 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1337 | xor edi, ebp | ||
1338 | mov cl, dh | ||
1339 | shr eax, 16 | ||
1340 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1341 | xor edi, ebp | ||
1342 | mov bl, ah | ||
1343 | shr edx, 16 | ||
1344 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1345 | xor edi, ebp | ||
1346 | mov ebp, DWORD PTR 24[esp] | ||
1347 | mov cl, dh | ||
1348 | and eax, 0ffh | ||
1349 | and edx, 0ffh | ||
1350 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1351 | xor edi, ebx | ||
1352 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1353 | xor edi, ebx | ||
1354 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1355 | xor edi, ebx | ||
1356 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1357 | xor edi, ebx | ||
1358 | ; | ||
1359 | ; Round 1 | ||
1360 | mov eax, DWORD PTR 8[ebp] | ||
1361 | xor ebx, ebx | ||
1362 | mov edx, DWORD PTR 12[ebp] | ||
1363 | xor eax, edi | ||
1364 | xor edx, edi | ||
1365 | and eax, 0fcfcfcfch | ||
1366 | and edx, 0cfcfcfcfh | ||
1367 | mov bl, al | ||
1368 | mov cl, ah | ||
1369 | ror edx, 4 | ||
1370 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1371 | mov bl, dl | ||
1372 | xor esi, ebp | ||
1373 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1374 | xor esi, ebp | ||
1375 | mov cl, dh | ||
1376 | shr eax, 16 | ||
1377 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1378 | xor esi, ebp | ||
1379 | mov bl, ah | ||
1380 | shr edx, 16 | ||
1381 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1382 | xor esi, ebp | ||
1383 | mov ebp, DWORD PTR 24[esp] | ||
1384 | mov cl, dh | ||
1385 | and eax, 0ffh | ||
1386 | and edx, 0ffh | ||
1387 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1388 | xor esi, ebx | ||
1389 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1390 | xor esi, ebx | ||
1391 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1392 | xor esi, ebx | ||
1393 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1394 | xor esi, ebx | ||
1395 | ; | ||
1396 | ; Round 2 | ||
1397 | mov eax, DWORD PTR 16[ebp] | ||
1398 | xor ebx, ebx | ||
1399 | mov edx, DWORD PTR 20[ebp] | ||
1400 | xor eax, esi | ||
1401 | xor edx, esi | ||
1402 | and eax, 0fcfcfcfch | ||
1403 | and edx, 0cfcfcfcfh | ||
1404 | mov bl, al | ||
1405 | mov cl, ah | ||
1406 | ror edx, 4 | ||
1407 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1408 | mov bl, dl | ||
1409 | xor edi, ebp | ||
1410 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1411 | xor edi, ebp | ||
1412 | mov cl, dh | ||
1413 | shr eax, 16 | ||
1414 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1415 | xor edi, ebp | ||
1416 | mov bl, ah | ||
1417 | shr edx, 16 | ||
1418 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1419 | xor edi, ebp | ||
1420 | mov ebp, DWORD PTR 24[esp] | ||
1421 | mov cl, dh | ||
1422 | and eax, 0ffh | ||
1423 | and edx, 0ffh | ||
1424 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1425 | xor edi, ebx | ||
1426 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1427 | xor edi, ebx | ||
1428 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1429 | xor edi, ebx | ||
1430 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1431 | xor edi, ebx | ||
1432 | ; | ||
1433 | ; Round 3 | ||
1434 | mov eax, DWORD PTR 24[ebp] | ||
1435 | xor ebx, ebx | ||
1436 | mov edx, DWORD PTR 28[ebp] | ||
1437 | xor eax, edi | ||
1438 | xor edx, edi | ||
1439 | and eax, 0fcfcfcfch | ||
1440 | and edx, 0cfcfcfcfh | ||
1441 | mov bl, al | ||
1442 | mov cl, ah | ||
1443 | ror edx, 4 | ||
1444 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1445 | mov bl, dl | ||
1446 | xor esi, ebp | ||
1447 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1448 | xor esi, ebp | ||
1449 | mov cl, dh | ||
1450 | shr eax, 16 | ||
1451 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1452 | xor esi, ebp | ||
1453 | mov bl, ah | ||
1454 | shr edx, 16 | ||
1455 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1456 | xor esi, ebp | ||
1457 | mov ebp, DWORD PTR 24[esp] | ||
1458 | mov cl, dh | ||
1459 | and eax, 0ffh | ||
1460 | and edx, 0ffh | ||
1461 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1462 | xor esi, ebx | ||
1463 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1464 | xor esi, ebx | ||
1465 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1466 | xor esi, ebx | ||
1467 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1468 | xor esi, ebx | ||
1469 | ; | ||
1470 | ; Round 4 | ||
1471 | mov eax, DWORD PTR 32[ebp] | ||
1472 | xor ebx, ebx | ||
1473 | mov edx, DWORD PTR 36[ebp] | ||
1474 | xor eax, esi | ||
1475 | xor edx, esi | ||
1476 | and eax, 0fcfcfcfch | ||
1477 | and edx, 0cfcfcfcfh | ||
1478 | mov bl, al | ||
1479 | mov cl, ah | ||
1480 | ror edx, 4 | ||
1481 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1482 | mov bl, dl | ||
1483 | xor edi, ebp | ||
1484 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1485 | xor edi, ebp | ||
1486 | mov cl, dh | ||
1487 | shr eax, 16 | ||
1488 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1489 | xor edi, ebp | ||
1490 | mov bl, ah | ||
1491 | shr edx, 16 | ||
1492 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1493 | xor edi, ebp | ||
1494 | mov ebp, DWORD PTR 24[esp] | ||
1495 | mov cl, dh | ||
1496 | and eax, 0ffh | ||
1497 | and edx, 0ffh | ||
1498 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1499 | xor edi, ebx | ||
1500 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1501 | xor edi, ebx | ||
1502 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1503 | xor edi, ebx | ||
1504 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1505 | xor edi, ebx | ||
1506 | ; | ||
1507 | ; Round 5 | ||
1508 | mov eax, DWORD PTR 40[ebp] | ||
1509 | xor ebx, ebx | ||
1510 | mov edx, DWORD PTR 44[ebp] | ||
1511 | xor eax, edi | ||
1512 | xor edx, edi | ||
1513 | and eax, 0fcfcfcfch | ||
1514 | and edx, 0cfcfcfcfh | ||
1515 | mov bl, al | ||
1516 | mov cl, ah | ||
1517 | ror edx, 4 | ||
1518 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1519 | mov bl, dl | ||
1520 | xor esi, ebp | ||
1521 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1522 | xor esi, ebp | ||
1523 | mov cl, dh | ||
1524 | shr eax, 16 | ||
1525 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1526 | xor esi, ebp | ||
1527 | mov bl, ah | ||
1528 | shr edx, 16 | ||
1529 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1530 | xor esi, ebp | ||
1531 | mov ebp, DWORD PTR 24[esp] | ||
1532 | mov cl, dh | ||
1533 | and eax, 0ffh | ||
1534 | and edx, 0ffh | ||
1535 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1536 | xor esi, ebx | ||
1537 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1538 | xor esi, ebx | ||
1539 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1540 | xor esi, ebx | ||
1541 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1542 | xor esi, ebx | ||
1543 | ; | ||
1544 | ; Round 6 | ||
1545 | mov eax, DWORD PTR 48[ebp] | ||
1546 | xor ebx, ebx | ||
1547 | mov edx, DWORD PTR 52[ebp] | ||
1548 | xor eax, esi | ||
1549 | xor edx, esi | ||
1550 | and eax, 0fcfcfcfch | ||
1551 | and edx, 0cfcfcfcfh | ||
1552 | mov bl, al | ||
1553 | mov cl, ah | ||
1554 | ror edx, 4 | ||
1555 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1556 | mov bl, dl | ||
1557 | xor edi, ebp | ||
1558 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1559 | xor edi, ebp | ||
1560 | mov cl, dh | ||
1561 | shr eax, 16 | ||
1562 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1563 | xor edi, ebp | ||
1564 | mov bl, ah | ||
1565 | shr edx, 16 | ||
1566 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1567 | xor edi, ebp | ||
1568 | mov ebp, DWORD PTR 24[esp] | ||
1569 | mov cl, dh | ||
1570 | and eax, 0ffh | ||
1571 | and edx, 0ffh | ||
1572 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1573 | xor edi, ebx | ||
1574 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1575 | xor edi, ebx | ||
1576 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1577 | xor edi, ebx | ||
1578 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1579 | xor edi, ebx | ||
1580 | ; | ||
1581 | ; Round 7 | ||
1582 | mov eax, DWORD PTR 56[ebp] | ||
1583 | xor ebx, ebx | ||
1584 | mov edx, DWORD PTR 60[ebp] | ||
1585 | xor eax, edi | ||
1586 | xor edx, edi | ||
1587 | and eax, 0fcfcfcfch | ||
1588 | and edx, 0cfcfcfcfh | ||
1589 | mov bl, al | ||
1590 | mov cl, ah | ||
1591 | ror edx, 4 | ||
1592 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1593 | mov bl, dl | ||
1594 | xor esi, ebp | ||
1595 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1596 | xor esi, ebp | ||
1597 | mov cl, dh | ||
1598 | shr eax, 16 | ||
1599 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1600 | xor esi, ebp | ||
1601 | mov bl, ah | ||
1602 | shr edx, 16 | ||
1603 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1604 | xor esi, ebp | ||
1605 | mov ebp, DWORD PTR 24[esp] | ||
1606 | mov cl, dh | ||
1607 | and eax, 0ffh | ||
1608 | and edx, 0ffh | ||
1609 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1610 | xor esi, ebx | ||
1611 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1612 | xor esi, ebx | ||
1613 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1614 | xor esi, ebx | ||
1615 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1616 | xor esi, ebx | ||
1617 | ; | ||
1618 | ; Round 8 | ||
1619 | mov eax, DWORD PTR 64[ebp] | ||
1620 | xor ebx, ebx | ||
1621 | mov edx, DWORD PTR 68[ebp] | ||
1622 | xor eax, esi | ||
1623 | xor edx, esi | ||
1624 | and eax, 0fcfcfcfch | ||
1625 | and edx, 0cfcfcfcfh | ||
1626 | mov bl, al | ||
1627 | mov cl, ah | ||
1628 | ror edx, 4 | ||
1629 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1630 | mov bl, dl | ||
1631 | xor edi, ebp | ||
1632 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1633 | xor edi, ebp | ||
1634 | mov cl, dh | ||
1635 | shr eax, 16 | ||
1636 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1637 | xor edi, ebp | ||
1638 | mov bl, ah | ||
1639 | shr edx, 16 | ||
1640 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1641 | xor edi, ebp | ||
1642 | mov ebp, DWORD PTR 24[esp] | ||
1643 | mov cl, dh | ||
1644 | and eax, 0ffh | ||
1645 | and edx, 0ffh | ||
1646 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1647 | xor edi, ebx | ||
1648 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1649 | xor edi, ebx | ||
1650 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1651 | xor edi, ebx | ||
1652 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1653 | xor edi, ebx | ||
1654 | ; | ||
1655 | ; Round 9 | ||
1656 | mov eax, DWORD PTR 72[ebp] | ||
1657 | xor ebx, ebx | ||
1658 | mov edx, DWORD PTR 76[ebp] | ||
1659 | xor eax, edi | ||
1660 | xor edx, edi | ||
1661 | and eax, 0fcfcfcfch | ||
1662 | and edx, 0cfcfcfcfh | ||
1663 | mov bl, al | ||
1664 | mov cl, ah | ||
1665 | ror edx, 4 | ||
1666 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1667 | mov bl, dl | ||
1668 | xor esi, ebp | ||
1669 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1670 | xor esi, ebp | ||
1671 | mov cl, dh | ||
1672 | shr eax, 16 | ||
1673 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1674 | xor esi, ebp | ||
1675 | mov bl, ah | ||
1676 | shr edx, 16 | ||
1677 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1678 | xor esi, ebp | ||
1679 | mov ebp, DWORD PTR 24[esp] | ||
1680 | mov cl, dh | ||
1681 | and eax, 0ffh | ||
1682 | and edx, 0ffh | ||
1683 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1684 | xor esi, ebx | ||
1685 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1686 | xor esi, ebx | ||
1687 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1688 | xor esi, ebx | ||
1689 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1690 | xor esi, ebx | ||
1691 | ; | ||
1692 | ; Round 10 | ||
1693 | mov eax, DWORD PTR 80[ebp] | ||
1694 | xor ebx, ebx | ||
1695 | mov edx, DWORD PTR 84[ebp] | ||
1696 | xor eax, esi | ||
1697 | xor edx, esi | ||
1698 | and eax, 0fcfcfcfch | ||
1699 | and edx, 0cfcfcfcfh | ||
1700 | mov bl, al | ||
1701 | mov cl, ah | ||
1702 | ror edx, 4 | ||
1703 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1704 | mov bl, dl | ||
1705 | xor edi, ebp | ||
1706 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1707 | xor edi, ebp | ||
1708 | mov cl, dh | ||
1709 | shr eax, 16 | ||
1710 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1711 | xor edi, ebp | ||
1712 | mov bl, ah | ||
1713 | shr edx, 16 | ||
1714 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1715 | xor edi, ebp | ||
1716 | mov ebp, DWORD PTR 24[esp] | ||
1717 | mov cl, dh | ||
1718 | and eax, 0ffh | ||
1719 | and edx, 0ffh | ||
1720 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1721 | xor edi, ebx | ||
1722 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1723 | xor edi, ebx | ||
1724 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1725 | xor edi, ebx | ||
1726 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1727 | xor edi, ebx | ||
1728 | ; | ||
1729 | ; Round 11 | ||
1730 | mov eax, DWORD PTR 88[ebp] | ||
1731 | xor ebx, ebx | ||
1732 | mov edx, DWORD PTR 92[ebp] | ||
1733 | xor eax, edi | ||
1734 | xor edx, edi | ||
1735 | and eax, 0fcfcfcfch | ||
1736 | and edx, 0cfcfcfcfh | ||
1737 | mov bl, al | ||
1738 | mov cl, ah | ||
1739 | ror edx, 4 | ||
1740 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1741 | mov bl, dl | ||
1742 | xor esi, ebp | ||
1743 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1744 | xor esi, ebp | ||
1745 | mov cl, dh | ||
1746 | shr eax, 16 | ||
1747 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1748 | xor esi, ebp | ||
1749 | mov bl, ah | ||
1750 | shr edx, 16 | ||
1751 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1752 | xor esi, ebp | ||
1753 | mov ebp, DWORD PTR 24[esp] | ||
1754 | mov cl, dh | ||
1755 | and eax, 0ffh | ||
1756 | and edx, 0ffh | ||
1757 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1758 | xor esi, ebx | ||
1759 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1760 | xor esi, ebx | ||
1761 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1762 | xor esi, ebx | ||
1763 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1764 | xor esi, ebx | ||
1765 | ; | ||
1766 | ; Round 12 | ||
1767 | mov eax, DWORD PTR 96[ebp] | ||
1768 | xor ebx, ebx | ||
1769 | mov edx, DWORD PTR 100[ebp] | ||
1770 | xor eax, esi | ||
1771 | xor edx, esi | ||
1772 | and eax, 0fcfcfcfch | ||
1773 | and edx, 0cfcfcfcfh | ||
1774 | mov bl, al | ||
1775 | mov cl, ah | ||
1776 | ror edx, 4 | ||
1777 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1778 | mov bl, dl | ||
1779 | xor edi, ebp | ||
1780 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1781 | xor edi, ebp | ||
1782 | mov cl, dh | ||
1783 | shr eax, 16 | ||
1784 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1785 | xor edi, ebp | ||
1786 | mov bl, ah | ||
1787 | shr edx, 16 | ||
1788 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1789 | xor edi, ebp | ||
1790 | mov ebp, DWORD PTR 24[esp] | ||
1791 | mov cl, dh | ||
1792 | and eax, 0ffh | ||
1793 | and edx, 0ffh | ||
1794 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1795 | xor edi, ebx | ||
1796 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1797 | xor edi, ebx | ||
1798 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1799 | xor edi, ebx | ||
1800 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1801 | xor edi, ebx | ||
1802 | ; | ||
1803 | ; Round 13 | ||
1804 | mov eax, DWORD PTR 104[ebp] | ||
1805 | xor ebx, ebx | ||
1806 | mov edx, DWORD PTR 108[ebp] | ||
1807 | xor eax, edi | ||
1808 | xor edx, edi | ||
1809 | and eax, 0fcfcfcfch | ||
1810 | and edx, 0cfcfcfcfh | ||
1811 | mov bl, al | ||
1812 | mov cl, ah | ||
1813 | ror edx, 4 | ||
1814 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1815 | mov bl, dl | ||
1816 | xor esi, ebp | ||
1817 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1818 | xor esi, ebp | ||
1819 | mov cl, dh | ||
1820 | shr eax, 16 | ||
1821 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1822 | xor esi, ebp | ||
1823 | mov bl, ah | ||
1824 | shr edx, 16 | ||
1825 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1826 | xor esi, ebp | ||
1827 | mov ebp, DWORD PTR 24[esp] | ||
1828 | mov cl, dh | ||
1829 | and eax, 0ffh | ||
1830 | and edx, 0ffh | ||
1831 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1832 | xor esi, ebx | ||
1833 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1834 | xor esi, ebx | ||
1835 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1836 | xor esi, ebx | ||
1837 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1838 | xor esi, ebx | ||
1839 | ; | ||
1840 | ; Round 14 | ||
1841 | mov eax, DWORD PTR 112[ebp] | ||
1842 | xor ebx, ebx | ||
1843 | mov edx, DWORD PTR 116[ebp] | ||
1844 | xor eax, esi | ||
1845 | xor edx, esi | ||
1846 | and eax, 0fcfcfcfch | ||
1847 | and edx, 0cfcfcfcfh | ||
1848 | mov bl, al | ||
1849 | mov cl, ah | ||
1850 | ror edx, 4 | ||
1851 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1852 | mov bl, dl | ||
1853 | xor edi, ebp | ||
1854 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1855 | xor edi, ebp | ||
1856 | mov cl, dh | ||
1857 | shr eax, 16 | ||
1858 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1859 | xor edi, ebp | ||
1860 | mov bl, ah | ||
1861 | shr edx, 16 | ||
1862 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1863 | xor edi, ebp | ||
1864 | mov ebp, DWORD PTR 24[esp] | ||
1865 | mov cl, dh | ||
1866 | and eax, 0ffh | ||
1867 | and edx, 0ffh | ||
1868 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1869 | xor edi, ebx | ||
1870 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1871 | xor edi, ebx | ||
1872 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1873 | xor edi, ebx | ||
1874 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1875 | xor edi, ebx | ||
1876 | ; | ||
1877 | ; Round 15 | ||
1878 | mov eax, DWORD PTR 120[ebp] | ||
1879 | xor ebx, ebx | ||
1880 | mov edx, DWORD PTR 124[ebp] | ||
1881 | xor eax, edi | ||
1882 | xor edx, edi | ||
1883 | and eax, 0fcfcfcfch | ||
1884 | and edx, 0cfcfcfcfh | ||
1885 | mov bl, al | ||
1886 | mov cl, ah | ||
1887 | ror edx, 4 | ||
1888 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1889 | mov bl, dl | ||
1890 | xor esi, ebp | ||
1891 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1892 | xor esi, ebp | ||
1893 | mov cl, dh | ||
1894 | shr eax, 16 | ||
1895 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1896 | xor esi, ebp | ||
1897 | mov bl, ah | ||
1898 | shr edx, 16 | ||
1899 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1900 | xor esi, ebp | ||
1901 | mov ebp, DWORD PTR 24[esp] | ||
1902 | mov cl, dh | ||
1903 | and eax, 0ffh | ||
1904 | and edx, 0ffh | ||
1905 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1906 | xor esi, ebx | ||
1907 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1908 | xor esi, ebx | ||
1909 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1910 | xor esi, ebx | ||
1911 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1912 | xor esi, ebx | ||
1913 | jmp $L003end | ||
1914 | $L002start_decrypt: | ||
1915 | ; | ||
1916 | ; Round 15 | ||
1917 | mov eax, DWORD PTR 120[ebp] | ||
1918 | xor ebx, ebx | ||
1919 | mov edx, DWORD PTR 124[ebp] | ||
1920 | xor eax, esi | ||
1921 | xor edx, esi | ||
1922 | and eax, 0fcfcfcfch | ||
1923 | and edx, 0cfcfcfcfh | ||
1924 | mov bl, al | ||
1925 | mov cl, ah | ||
1926 | ror edx, 4 | ||
1927 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1928 | mov bl, dl | ||
1929 | xor edi, ebp | ||
1930 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1931 | xor edi, ebp | ||
1932 | mov cl, dh | ||
1933 | shr eax, 16 | ||
1934 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1935 | xor edi, ebp | ||
1936 | mov bl, ah | ||
1937 | shr edx, 16 | ||
1938 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1939 | xor edi, ebp | ||
1940 | mov ebp, DWORD PTR 24[esp] | ||
1941 | mov cl, dh | ||
1942 | and eax, 0ffh | ||
1943 | and edx, 0ffh | ||
1944 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1945 | xor edi, ebx | ||
1946 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1947 | xor edi, ebx | ||
1948 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1949 | xor edi, ebx | ||
1950 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1951 | xor edi, ebx | ||
1952 | ; | ||
1953 | ; Round 14 | ||
1954 | mov eax, DWORD PTR 112[ebp] | ||
1955 | xor ebx, ebx | ||
1956 | mov edx, DWORD PTR 116[ebp] | ||
1957 | xor eax, edi | ||
1958 | xor edx, edi | ||
1959 | and eax, 0fcfcfcfch | ||
1960 | and edx, 0cfcfcfcfh | ||
1961 | mov bl, al | ||
1962 | mov cl, ah | ||
1963 | ror edx, 4 | ||
1964 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1965 | mov bl, dl | ||
1966 | xor esi, ebp | ||
1967 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1968 | xor esi, ebp | ||
1969 | mov cl, dh | ||
1970 | shr eax, 16 | ||
1971 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1972 | xor esi, ebp | ||
1973 | mov bl, ah | ||
1974 | shr edx, 16 | ||
1975 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1976 | xor esi, ebp | ||
1977 | mov ebp, DWORD PTR 24[esp] | ||
1978 | mov cl, dh | ||
1979 | and eax, 0ffh | ||
1980 | and edx, 0ffh | ||
1981 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1982 | xor esi, ebx | ||
1983 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1984 | xor esi, ebx | ||
1985 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1986 | xor esi, ebx | ||
1987 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1988 | xor esi, ebx | ||
1989 | ; | ||
1990 | ; Round 13 | ||
1991 | mov eax, DWORD PTR 104[ebp] | ||
1992 | xor ebx, ebx | ||
1993 | mov edx, DWORD PTR 108[ebp] | ||
1994 | xor eax, esi | ||
1995 | xor edx, esi | ||
1996 | and eax, 0fcfcfcfch | ||
1997 | and edx, 0cfcfcfcfh | ||
1998 | mov bl, al | ||
1999 | mov cl, ah | ||
2000 | ror edx, 4 | ||
2001 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2002 | mov bl, dl | ||
2003 | xor edi, ebp | ||
2004 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2005 | xor edi, ebp | ||
2006 | mov cl, dh | ||
2007 | shr eax, 16 | ||
2008 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2009 | xor edi, ebp | ||
2010 | mov bl, ah | ||
2011 | shr edx, 16 | ||
2012 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2013 | xor edi, ebp | ||
2014 | mov ebp, DWORD PTR 24[esp] | ||
2015 | mov cl, dh | ||
2016 | and eax, 0ffh | ||
2017 | and edx, 0ffh | ||
2018 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2019 | xor edi, ebx | ||
2020 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2021 | xor edi, ebx | ||
2022 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2023 | xor edi, ebx | ||
2024 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2025 | xor edi, ebx | ||
2026 | ; | ||
2027 | ; Round 12 | ||
2028 | mov eax, DWORD PTR 96[ebp] | ||
2029 | xor ebx, ebx | ||
2030 | mov edx, DWORD PTR 100[ebp] | ||
2031 | xor eax, edi | ||
2032 | xor edx, edi | ||
2033 | and eax, 0fcfcfcfch | ||
2034 | and edx, 0cfcfcfcfh | ||
2035 | mov bl, al | ||
2036 | mov cl, ah | ||
2037 | ror edx, 4 | ||
2038 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2039 | mov bl, dl | ||
2040 | xor esi, ebp | ||
2041 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2042 | xor esi, ebp | ||
2043 | mov cl, dh | ||
2044 | shr eax, 16 | ||
2045 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2046 | xor esi, ebp | ||
2047 | mov bl, ah | ||
2048 | shr edx, 16 | ||
2049 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2050 | xor esi, ebp | ||
2051 | mov ebp, DWORD PTR 24[esp] | ||
2052 | mov cl, dh | ||
2053 | and eax, 0ffh | ||
2054 | and edx, 0ffh | ||
2055 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2056 | xor esi, ebx | ||
2057 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2058 | xor esi, ebx | ||
2059 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2060 | xor esi, ebx | ||
2061 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2062 | xor esi, ebx | ||
2063 | ; | ||
2064 | ; Round 11 | ||
2065 | mov eax, DWORD PTR 88[ebp] | ||
2066 | xor ebx, ebx | ||
2067 | mov edx, DWORD PTR 92[ebp] | ||
2068 | xor eax, esi | ||
2069 | xor edx, esi | ||
2070 | and eax, 0fcfcfcfch | ||
2071 | and edx, 0cfcfcfcfh | ||
2072 | mov bl, al | ||
2073 | mov cl, ah | ||
2074 | ror edx, 4 | ||
2075 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2076 | mov bl, dl | ||
2077 | xor edi, ebp | ||
2078 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2079 | xor edi, ebp | ||
2080 | mov cl, dh | ||
2081 | shr eax, 16 | ||
2082 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2083 | xor edi, ebp | ||
2084 | mov bl, ah | ||
2085 | shr edx, 16 | ||
2086 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2087 | xor edi, ebp | ||
2088 | mov ebp, DWORD PTR 24[esp] | ||
2089 | mov cl, dh | ||
2090 | and eax, 0ffh | ||
2091 | and edx, 0ffh | ||
2092 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2093 | xor edi, ebx | ||
2094 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2095 | xor edi, ebx | ||
2096 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2097 | xor edi, ebx | ||
2098 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2099 | xor edi, ebx | ||
2100 | ; | ||
2101 | ; Round 10 | ||
2102 | mov eax, DWORD PTR 80[ebp] | ||
2103 | xor ebx, ebx | ||
2104 | mov edx, DWORD PTR 84[ebp] | ||
2105 | xor eax, edi | ||
2106 | xor edx, edi | ||
2107 | and eax, 0fcfcfcfch | ||
2108 | and edx, 0cfcfcfcfh | ||
2109 | mov bl, al | ||
2110 | mov cl, ah | ||
2111 | ror edx, 4 | ||
2112 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2113 | mov bl, dl | ||
2114 | xor esi, ebp | ||
2115 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2116 | xor esi, ebp | ||
2117 | mov cl, dh | ||
2118 | shr eax, 16 | ||
2119 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2120 | xor esi, ebp | ||
2121 | mov bl, ah | ||
2122 | shr edx, 16 | ||
2123 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2124 | xor esi, ebp | ||
2125 | mov ebp, DWORD PTR 24[esp] | ||
2126 | mov cl, dh | ||
2127 | and eax, 0ffh | ||
2128 | and edx, 0ffh | ||
2129 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2130 | xor esi, ebx | ||
2131 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2132 | xor esi, ebx | ||
2133 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2134 | xor esi, ebx | ||
2135 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2136 | xor esi, ebx | ||
2137 | ; | ||
2138 | ; Round 9 | ||
2139 | mov eax, DWORD PTR 72[ebp] | ||
2140 | xor ebx, ebx | ||
2141 | mov edx, DWORD PTR 76[ebp] | ||
2142 | xor eax, esi | ||
2143 | xor edx, esi | ||
2144 | and eax, 0fcfcfcfch | ||
2145 | and edx, 0cfcfcfcfh | ||
2146 | mov bl, al | ||
2147 | mov cl, ah | ||
2148 | ror edx, 4 | ||
2149 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2150 | mov bl, dl | ||
2151 | xor edi, ebp | ||
2152 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2153 | xor edi, ebp | ||
2154 | mov cl, dh | ||
2155 | shr eax, 16 | ||
2156 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2157 | xor edi, ebp | ||
2158 | mov bl, ah | ||
2159 | shr edx, 16 | ||
2160 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2161 | xor edi, ebp | ||
2162 | mov ebp, DWORD PTR 24[esp] | ||
2163 | mov cl, dh | ||
2164 | and eax, 0ffh | ||
2165 | and edx, 0ffh | ||
2166 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2167 | xor edi, ebx | ||
2168 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2169 | xor edi, ebx | ||
2170 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2171 | xor edi, ebx | ||
2172 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2173 | xor edi, ebx | ||
2174 | ; | ||
2175 | ; Round 8 | ||
2176 | mov eax, DWORD PTR 64[ebp] | ||
2177 | xor ebx, ebx | ||
2178 | mov edx, DWORD PTR 68[ebp] | ||
2179 | xor eax, edi | ||
2180 | xor edx, edi | ||
2181 | and eax, 0fcfcfcfch | ||
2182 | and edx, 0cfcfcfcfh | ||
2183 | mov bl, al | ||
2184 | mov cl, ah | ||
2185 | ror edx, 4 | ||
2186 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2187 | mov bl, dl | ||
2188 | xor esi, ebp | ||
2189 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2190 | xor esi, ebp | ||
2191 | mov cl, dh | ||
2192 | shr eax, 16 | ||
2193 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2194 | xor esi, ebp | ||
2195 | mov bl, ah | ||
2196 | shr edx, 16 | ||
2197 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2198 | xor esi, ebp | ||
2199 | mov ebp, DWORD PTR 24[esp] | ||
2200 | mov cl, dh | ||
2201 | and eax, 0ffh | ||
2202 | and edx, 0ffh | ||
2203 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2204 | xor esi, ebx | ||
2205 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2206 | xor esi, ebx | ||
2207 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2208 | xor esi, ebx | ||
2209 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2210 | xor esi, ebx | ||
2211 | ; | ||
2212 | ; Round 7 | ||
2213 | mov eax, DWORD PTR 56[ebp] | ||
2214 | xor ebx, ebx | ||
2215 | mov edx, DWORD PTR 60[ebp] | ||
2216 | xor eax, esi | ||
2217 | xor edx, esi | ||
2218 | and eax, 0fcfcfcfch | ||
2219 | and edx, 0cfcfcfcfh | ||
2220 | mov bl, al | ||
2221 | mov cl, ah | ||
2222 | ror edx, 4 | ||
2223 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2224 | mov bl, dl | ||
2225 | xor edi, ebp | ||
2226 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2227 | xor edi, ebp | ||
2228 | mov cl, dh | ||
2229 | shr eax, 16 | ||
2230 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2231 | xor edi, ebp | ||
2232 | mov bl, ah | ||
2233 | shr edx, 16 | ||
2234 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2235 | xor edi, ebp | ||
2236 | mov ebp, DWORD PTR 24[esp] | ||
2237 | mov cl, dh | ||
2238 | and eax, 0ffh | ||
2239 | and edx, 0ffh | ||
2240 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2241 | xor edi, ebx | ||
2242 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2243 | xor edi, ebx | ||
2244 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2245 | xor edi, ebx | ||
2246 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2247 | xor edi, ebx | ||
2248 | ; | ||
2249 | ; Round 6 | ||
2250 | mov eax, DWORD PTR 48[ebp] | ||
2251 | xor ebx, ebx | ||
2252 | mov edx, DWORD PTR 52[ebp] | ||
2253 | xor eax, edi | ||
2254 | xor edx, edi | ||
2255 | and eax, 0fcfcfcfch | ||
2256 | and edx, 0cfcfcfcfh | ||
2257 | mov bl, al | ||
2258 | mov cl, ah | ||
2259 | ror edx, 4 | ||
2260 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2261 | mov bl, dl | ||
2262 | xor esi, ebp | ||
2263 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2264 | xor esi, ebp | ||
2265 | mov cl, dh | ||
2266 | shr eax, 16 | ||
2267 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2268 | xor esi, ebp | ||
2269 | mov bl, ah | ||
2270 | shr edx, 16 | ||
2271 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2272 | xor esi, ebp | ||
2273 | mov ebp, DWORD PTR 24[esp] | ||
2274 | mov cl, dh | ||
2275 | and eax, 0ffh | ||
2276 | and edx, 0ffh | ||
2277 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2278 | xor esi, ebx | ||
2279 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2280 | xor esi, ebx | ||
2281 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2282 | xor esi, ebx | ||
2283 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2284 | xor esi, ebx | ||
2285 | ; | ||
2286 | ; Round 5 | ||
2287 | mov eax, DWORD PTR 40[ebp] | ||
2288 | xor ebx, ebx | ||
2289 | mov edx, DWORD PTR 44[ebp] | ||
2290 | xor eax, esi | ||
2291 | xor edx, esi | ||
2292 | and eax, 0fcfcfcfch | ||
2293 | and edx, 0cfcfcfcfh | ||
2294 | mov bl, al | ||
2295 | mov cl, ah | ||
2296 | ror edx, 4 | ||
2297 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2298 | mov bl, dl | ||
2299 | xor edi, ebp | ||
2300 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2301 | xor edi, ebp | ||
2302 | mov cl, dh | ||
2303 | shr eax, 16 | ||
2304 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2305 | xor edi, ebp | ||
2306 | mov bl, ah | ||
2307 | shr edx, 16 | ||
2308 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2309 | xor edi, ebp | ||
2310 | mov ebp, DWORD PTR 24[esp] | ||
2311 | mov cl, dh | ||
2312 | and eax, 0ffh | ||
2313 | and edx, 0ffh | ||
2314 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2315 | xor edi, ebx | ||
2316 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2317 | xor edi, ebx | ||
2318 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2319 | xor edi, ebx | ||
2320 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2321 | xor edi, ebx | ||
2322 | ; | ||
2323 | ; Round 4 | ||
2324 | mov eax, DWORD PTR 32[ebp] | ||
2325 | xor ebx, ebx | ||
2326 | mov edx, DWORD PTR 36[ebp] | ||
2327 | xor eax, edi | ||
2328 | xor edx, edi | ||
2329 | and eax, 0fcfcfcfch | ||
2330 | and edx, 0cfcfcfcfh | ||
2331 | mov bl, al | ||
2332 | mov cl, ah | ||
2333 | ror edx, 4 | ||
2334 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2335 | mov bl, dl | ||
2336 | xor esi, ebp | ||
2337 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2338 | xor esi, ebp | ||
2339 | mov cl, dh | ||
2340 | shr eax, 16 | ||
2341 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2342 | xor esi, ebp | ||
2343 | mov bl, ah | ||
2344 | shr edx, 16 | ||
2345 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2346 | xor esi, ebp | ||
2347 | mov ebp, DWORD PTR 24[esp] | ||
2348 | mov cl, dh | ||
2349 | and eax, 0ffh | ||
2350 | and edx, 0ffh | ||
2351 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2352 | xor esi, ebx | ||
2353 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2354 | xor esi, ebx | ||
2355 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2356 | xor esi, ebx | ||
2357 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2358 | xor esi, ebx | ||
2359 | ; | ||
2360 | ; Round 3 | ||
2361 | mov eax, DWORD PTR 24[ebp] | ||
2362 | xor ebx, ebx | ||
2363 | mov edx, DWORD PTR 28[ebp] | ||
2364 | xor eax, esi | ||
2365 | xor edx, esi | ||
2366 | and eax, 0fcfcfcfch | ||
2367 | and edx, 0cfcfcfcfh | ||
2368 | mov bl, al | ||
2369 | mov cl, ah | ||
2370 | ror edx, 4 | ||
2371 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2372 | mov bl, dl | ||
2373 | xor edi, ebp | ||
2374 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2375 | xor edi, ebp | ||
2376 | mov cl, dh | ||
2377 | shr eax, 16 | ||
2378 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2379 | xor edi, ebp | ||
2380 | mov bl, ah | ||
2381 | shr edx, 16 | ||
2382 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2383 | xor edi, ebp | ||
2384 | mov ebp, DWORD PTR 24[esp] | ||
2385 | mov cl, dh | ||
2386 | and eax, 0ffh | ||
2387 | and edx, 0ffh | ||
2388 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2389 | xor edi, ebx | ||
2390 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2391 | xor edi, ebx | ||
2392 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2393 | xor edi, ebx | ||
2394 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2395 | xor edi, ebx | ||
2396 | ; | ||
2397 | ; Round 2 | ||
2398 | mov eax, DWORD PTR 16[ebp] | ||
2399 | xor ebx, ebx | ||
2400 | mov edx, DWORD PTR 20[ebp] | ||
2401 | xor eax, edi | ||
2402 | xor edx, edi | ||
2403 | and eax, 0fcfcfcfch | ||
2404 | and edx, 0cfcfcfcfh | ||
2405 | mov bl, al | ||
2406 | mov cl, ah | ||
2407 | ror edx, 4 | ||
2408 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2409 | mov bl, dl | ||
2410 | xor esi, ebp | ||
2411 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2412 | xor esi, ebp | ||
2413 | mov cl, dh | ||
2414 | shr eax, 16 | ||
2415 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2416 | xor esi, ebp | ||
2417 | mov bl, ah | ||
2418 | shr edx, 16 | ||
2419 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2420 | xor esi, ebp | ||
2421 | mov ebp, DWORD PTR 24[esp] | ||
2422 | mov cl, dh | ||
2423 | and eax, 0ffh | ||
2424 | and edx, 0ffh | ||
2425 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2426 | xor esi, ebx | ||
2427 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2428 | xor esi, ebx | ||
2429 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2430 | xor esi, ebx | ||
2431 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2432 | xor esi, ebx | ||
2433 | ; | ||
2434 | ; Round 1 | ||
2435 | mov eax, DWORD PTR 8[ebp] | ||
2436 | xor ebx, ebx | ||
2437 | mov edx, DWORD PTR 12[ebp] | ||
2438 | xor eax, esi | ||
2439 | xor edx, esi | ||
2440 | and eax, 0fcfcfcfch | ||
2441 | and edx, 0cfcfcfcfh | ||
2442 | mov bl, al | ||
2443 | mov cl, ah | ||
2444 | ror edx, 4 | ||
2445 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2446 | mov bl, dl | ||
2447 | xor edi, ebp | ||
2448 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2449 | xor edi, ebp | ||
2450 | mov cl, dh | ||
2451 | shr eax, 16 | ||
2452 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2453 | xor edi, ebp | ||
2454 | mov bl, ah | ||
2455 | shr edx, 16 | ||
2456 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2457 | xor edi, ebp | ||
2458 | mov ebp, DWORD PTR 24[esp] | ||
2459 | mov cl, dh | ||
2460 | and eax, 0ffh | ||
2461 | and edx, 0ffh | ||
2462 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2463 | xor edi, ebx | ||
2464 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2465 | xor edi, ebx | ||
2466 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2467 | xor edi, ebx | ||
2468 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2469 | xor edi, ebx | ||
2470 | ; | ||
2471 | ; Round 0 | ||
2472 | mov eax, DWORD PTR [ebp] | ||
2473 | xor ebx, ebx | ||
2474 | mov edx, DWORD PTR 4[ebp] | ||
2475 | xor eax, edi | ||
2476 | xor edx, edi | ||
2477 | and eax, 0fcfcfcfch | ||
2478 | and edx, 0cfcfcfcfh | ||
2479 | mov bl, al | ||
2480 | mov cl, ah | ||
2481 | ror edx, 4 | ||
2482 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2483 | mov bl, dl | ||
2484 | xor esi, ebp | ||
2485 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2486 | xor esi, ebp | ||
2487 | mov cl, dh | ||
2488 | shr eax, 16 | ||
2489 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2490 | xor esi, ebp | ||
2491 | mov bl, ah | ||
2492 | shr edx, 16 | ||
2493 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2494 | xor esi, ebp | ||
2495 | mov ebp, DWORD PTR 24[esp] | ||
2496 | mov cl, dh | ||
2497 | and eax, 0ffh | ||
2498 | and edx, 0ffh | ||
2499 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2500 | xor esi, ebx | ||
2501 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2502 | xor esi, ebx | ||
2503 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2504 | xor esi, ebx | ||
2505 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2506 | xor esi, ebx | ||
2507 | $L003end: | ||
2508 | ; | ||
2509 | ; Fixup | ||
2510 | ror edi, 3 | ||
2511 | mov eax, DWORD PTR 20[esp] | ||
2512 | ror esi, 3 | ||
2513 | mov DWORD PTR [eax],edi | ||
2514 | mov DWORD PTR 4[eax],esi | ||
2515 | pop ebp | ||
2516 | pop ebx | ||
2517 | pop edi | ||
2518 | pop esi | ||
2519 | ret | ||
2520 | _des_encrypt2 ENDP | ||
2521 | _TEXT ENDS | ||
2522 | _TEXT SEGMENT | ||
2523 | PUBLIC _des_encrypt3 | ||
2524 | |||
2525 | _des_encrypt3 PROC NEAR | ||
2526 | push ebx | ||
2527 | mov ebx, DWORD PTR 8[esp] | ||
2528 | push ebp | ||
2529 | push esi | ||
2530 | push edi | ||
2531 | ; | ||
2532 | ; Load the data words | ||
2533 | mov edi, DWORD PTR [ebx] | ||
2534 | mov esi, DWORD PTR 4[ebx] | ||
2535 | sub esp, 12 | ||
2536 | ; | ||
2537 | ; IP | ||
2538 | rol edi, 4 | ||
2539 | mov edx, edi | ||
2540 | xor edi, esi | ||
2541 | and edi, 0f0f0f0f0h | ||
2542 | xor edx, edi | ||
2543 | xor esi, edi | ||
2544 | ; | ||
2545 | rol esi, 20 | ||
2546 | mov edi, esi | ||
2547 | xor esi, edx | ||
2548 | and esi, 0fff0000fh | ||
2549 | xor edi, esi | ||
2550 | xor edx, esi | ||
2551 | ; | ||
2552 | rol edi, 14 | ||
2553 | mov esi, edi | ||
2554 | xor edi, edx | ||
2555 | and edi, 033333333h | ||
2556 | xor esi, edi | ||
2557 | xor edx, edi | ||
2558 | ; | ||
2559 | rol edx, 22 | ||
2560 | mov edi, edx | ||
2561 | xor edx, esi | ||
2562 | and edx, 003fc03fch | ||
2563 | xor edi, edx | ||
2564 | xor esi, edx | ||
2565 | ; | ||
2566 | rol edi, 9 | ||
2567 | mov edx, edi | ||
2568 | xor edi, esi | ||
2569 | and edi, 0aaaaaaaah | ||
2570 | xor edx, edi | ||
2571 | xor esi, edi | ||
2572 | ; | ||
2573 | ror edx, 3 | ||
2574 | ror esi, 2 | ||
2575 | mov DWORD PTR 4[ebx],esi | ||
2576 | mov eax, DWORD PTR 36[esp] | ||
2577 | mov DWORD PTR [ebx],edx | ||
2578 | mov edi, DWORD PTR 40[esp] | ||
2579 | mov esi, DWORD PTR 44[esp] | ||
2580 | mov DWORD PTR 8[esp],1 | ||
2581 | mov DWORD PTR 4[esp],eax | ||
2582 | mov DWORD PTR [esp],ebx | ||
2583 | call _des_encrypt2 | ||
2584 | mov DWORD PTR 8[esp],0 | ||
2585 | mov DWORD PTR 4[esp],edi | ||
2586 | mov DWORD PTR [esp],ebx | ||
2587 | call _des_encrypt2 | ||
2588 | mov DWORD PTR 8[esp],1 | ||
2589 | mov DWORD PTR 4[esp],esi | ||
2590 | mov DWORD PTR [esp],ebx | ||
2591 | call _des_encrypt2 | ||
2592 | add esp, 12 | ||
2593 | mov edi, DWORD PTR [ebx] | ||
2594 | mov esi, DWORD PTR 4[ebx] | ||
2595 | ; | ||
2596 | ; FP | ||
2597 | rol esi, 2 | ||
2598 | rol edi, 3 | ||
2599 | mov eax, edi | ||
2600 | xor edi, esi | ||
2601 | and edi, 0aaaaaaaah | ||
2602 | xor eax, edi | ||
2603 | xor esi, edi | ||
2604 | ; | ||
2605 | rol eax, 23 | ||
2606 | mov edi, eax | ||
2607 | xor eax, esi | ||
2608 | and eax, 003fc03fch | ||
2609 | xor edi, eax | ||
2610 | xor esi, eax | ||
2611 | ; | ||
2612 | rol edi, 10 | ||
2613 | mov eax, edi | ||
2614 | xor edi, esi | ||
2615 | and edi, 033333333h | ||
2616 | xor eax, edi | ||
2617 | xor esi, edi | ||
2618 | ; | ||
2619 | rol esi, 18 | ||
2620 | mov edi, esi | ||
2621 | xor esi, eax | ||
2622 | and esi, 0fff0000fh | ||
2623 | xor edi, esi | ||
2624 | xor eax, esi | ||
2625 | ; | ||
2626 | rol edi, 12 | ||
2627 | mov esi, edi | ||
2628 | xor edi, eax | ||
2629 | and edi, 0f0f0f0f0h | ||
2630 | xor esi, edi | ||
2631 | xor eax, edi | ||
2632 | ; | ||
2633 | ror eax, 4 | ||
2634 | mov DWORD PTR [ebx],eax | ||
2635 | mov DWORD PTR 4[ebx],esi | ||
2636 | pop edi | ||
2637 | pop esi | ||
2638 | pop ebp | ||
2639 | pop ebx | ||
2640 | ret | ||
2641 | _des_encrypt3 ENDP | ||
2642 | _TEXT ENDS | ||
2643 | _TEXT SEGMENT | ||
2644 | PUBLIC _des_decrypt3 | ||
2645 | |||
2646 | _des_decrypt3 PROC NEAR | ||
2647 | push ebx | ||
2648 | mov ebx, DWORD PTR 8[esp] | ||
2649 | push ebp | ||
2650 | push esi | ||
2651 | push edi | ||
2652 | ; | ||
2653 | ; Load the data words | ||
2654 | mov edi, DWORD PTR [ebx] | ||
2655 | mov esi, DWORD PTR 4[ebx] | ||
2656 | sub esp, 12 | ||
2657 | ; | ||
2658 | ; IP | ||
2659 | rol edi, 4 | ||
2660 | mov edx, edi | ||
2661 | xor edi, esi | ||
2662 | and edi, 0f0f0f0f0h | ||
2663 | xor edx, edi | ||
2664 | xor esi, edi | ||
2665 | ; | ||
2666 | rol esi, 20 | ||
2667 | mov edi, esi | ||
2668 | xor esi, edx | ||
2669 | and esi, 0fff0000fh | ||
2670 | xor edi, esi | ||
2671 | xor edx, esi | ||
2672 | ; | ||
2673 | rol edi, 14 | ||
2674 | mov esi, edi | ||
2675 | xor edi, edx | ||
2676 | and edi, 033333333h | ||
2677 | xor esi, edi | ||
2678 | xor edx, edi | ||
2679 | ; | ||
2680 | rol edx, 22 | ||
2681 | mov edi, edx | ||
2682 | xor edx, esi | ||
2683 | and edx, 003fc03fch | ||
2684 | xor edi, edx | ||
2685 | xor esi, edx | ||
2686 | ; | ||
2687 | rol edi, 9 | ||
2688 | mov edx, edi | ||
2689 | xor edi, esi | ||
2690 | and edi, 0aaaaaaaah | ||
2691 | xor edx, edi | ||
2692 | xor esi, edi | ||
2693 | ; | ||
2694 | ror edx, 3 | ||
2695 | ror esi, 2 | ||
2696 | mov DWORD PTR 4[ebx],esi | ||
2697 | mov esi, DWORD PTR 36[esp] | ||
2698 | mov DWORD PTR [ebx],edx | ||
2699 | mov edi, DWORD PTR 40[esp] | ||
2700 | mov eax, DWORD PTR 44[esp] | ||
2701 | mov DWORD PTR 8[esp],0 | ||
2702 | mov DWORD PTR 4[esp],eax | ||
2703 | mov DWORD PTR [esp],ebx | ||
2704 | call _des_encrypt2 | ||
2705 | mov DWORD PTR 8[esp],1 | ||
2706 | mov DWORD PTR 4[esp],edi | ||
2707 | mov DWORD PTR [esp],ebx | ||
2708 | call _des_encrypt2 | ||
2709 | mov DWORD PTR 8[esp],0 | ||
2710 | mov DWORD PTR 4[esp],esi | ||
2711 | mov DWORD PTR [esp],ebx | ||
2712 | call _des_encrypt2 | ||
2713 | add esp, 12 | ||
2714 | mov edi, DWORD PTR [ebx] | ||
2715 | mov esi, DWORD PTR 4[ebx] | ||
2716 | ; | ||
2717 | ; FP | ||
2718 | rol esi, 2 | ||
2719 | rol edi, 3 | ||
2720 | mov eax, edi | ||
2721 | xor edi, esi | ||
2722 | and edi, 0aaaaaaaah | ||
2723 | xor eax, edi | ||
2724 | xor esi, edi | ||
2725 | ; | ||
2726 | rol eax, 23 | ||
2727 | mov edi, eax | ||
2728 | xor eax, esi | ||
2729 | and eax, 003fc03fch | ||
2730 | xor edi, eax | ||
2731 | xor esi, eax | ||
2732 | ; | ||
2733 | rol edi, 10 | ||
2734 | mov eax, edi | ||
2735 | xor edi, esi | ||
2736 | and edi, 033333333h | ||
2737 | xor eax, edi | ||
2738 | xor esi, edi | ||
2739 | ; | ||
2740 | rol esi, 18 | ||
2741 | mov edi, esi | ||
2742 | xor esi, eax | ||
2743 | and esi, 0fff0000fh | ||
2744 | xor edi, esi | ||
2745 | xor eax, esi | ||
2746 | ; | ||
2747 | rol edi, 12 | ||
2748 | mov esi, edi | ||
2749 | xor edi, eax | ||
2750 | and edi, 0f0f0f0f0h | ||
2751 | xor esi, edi | ||
2752 | xor eax, edi | ||
2753 | ; | ||
2754 | ror eax, 4 | ||
2755 | mov DWORD PTR [ebx],eax | ||
2756 | mov DWORD PTR 4[ebx],esi | ||
2757 | pop edi | ||
2758 | pop esi | ||
2759 | pop ebp | ||
2760 | pop ebx | ||
2761 | ret | ||
2762 | _des_decrypt3 ENDP | ||
2763 | _TEXT ENDS | ||
2764 | _TEXT SEGMENT | ||
2765 | PUBLIC _des_ncbc_encrypt | ||
2766 | |||
2767 | _des_ncbc_encrypt PROC NEAR | ||
2768 | ; | ||
2769 | push ebp | ||
2770 | push ebx | ||
2771 | push esi | ||
2772 | push edi | ||
2773 | mov ebp, DWORD PTR 28[esp] | ||
2774 | ; getting iv ptr from parameter 4 | ||
2775 | mov ebx, DWORD PTR 36[esp] | ||
2776 | mov esi, DWORD PTR [ebx] | ||
2777 | mov edi, DWORD PTR 4[ebx] | ||
2778 | push edi | ||
2779 | push esi | ||
2780 | push edi | ||
2781 | push esi | ||
2782 | mov ebx, esp | ||
2783 | mov esi, DWORD PTR 36[esp] | ||
2784 | mov edi, DWORD PTR 40[esp] | ||
2785 | ; getting encrypt flag from parameter 5 | ||
2786 | mov ecx, DWORD PTR 56[esp] | ||
2787 | ; get and push parameter 5 | ||
2788 | push ecx | ||
2789 | ; get and push parameter 3 | ||
2790 | mov eax, DWORD PTR 52[esp] | ||
2791 | push eax | ||
2792 | push ebx | ||
2793 | cmp ecx, 0 | ||
2794 | jz $L004decrypt | ||
2795 | and ebp, 4294967288 | ||
2796 | mov eax, DWORD PTR 12[esp] | ||
2797 | mov ebx, DWORD PTR 16[esp] | ||
2798 | jz $L005encrypt_finish | ||
2799 | L006encrypt_loop: | ||
2800 | mov ecx, DWORD PTR [esi] | ||
2801 | mov edx, DWORD PTR 4[esi] | ||
2802 | xor eax, ecx | ||
2803 | xor ebx, edx | ||
2804 | mov DWORD PTR 12[esp],eax | ||
2805 | mov DWORD PTR 16[esp],ebx | ||
2806 | call _des_encrypt | ||
2807 | mov eax, DWORD PTR 12[esp] | ||
2808 | mov ebx, DWORD PTR 16[esp] | ||
2809 | mov DWORD PTR [edi],eax | ||
2810 | mov DWORD PTR 4[edi],ebx | ||
2811 | add esi, 8 | ||
2812 | add edi, 8 | ||
2813 | sub ebp, 8 | ||
2814 | jnz L006encrypt_loop | ||
2815 | $L005encrypt_finish: | ||
2816 | mov ebp, DWORD PTR 56[esp] | ||
2817 | and ebp, 7 | ||
2818 | jz $L007finish | ||
2819 | xor ecx, ecx | ||
2820 | xor edx, edx | ||
2821 | mov ebp, DWORD PTR $L008cbc_enc_jmp_table[ebp*4] | ||
2822 | jmp ebp | ||
2823 | L009ej7: | ||
2824 | mov dh, BYTE PTR 6[esi] | ||
2825 | shl edx, 8 | ||
2826 | L010ej6: | ||
2827 | mov dh, BYTE PTR 5[esi] | ||
2828 | L011ej5: | ||
2829 | mov dl, BYTE PTR 4[esi] | ||
2830 | L012ej4: | ||
2831 | mov ecx, DWORD PTR [esi] | ||
2832 | jmp $L013ejend | ||
2833 | L014ej3: | ||
2834 | mov ch, BYTE PTR 2[esi] | ||
2835 | shl ecx, 8 | ||
2836 | L015ej2: | ||
2837 | mov ch, BYTE PTR 1[esi] | ||
2838 | L016ej1: | ||
2839 | mov cl, BYTE PTR [esi] | ||
2840 | $L013ejend: | ||
2841 | xor eax, ecx | ||
2842 | xor ebx, edx | ||
2843 | mov DWORD PTR 12[esp],eax | ||
2844 | mov DWORD PTR 16[esp],ebx | ||
2845 | call _des_encrypt | ||
2846 | mov eax, DWORD PTR 12[esp] | ||
2847 | mov ebx, DWORD PTR 16[esp] | ||
2848 | mov DWORD PTR [edi],eax | ||
2849 | mov DWORD PTR 4[edi],ebx | ||
2850 | jmp $L007finish | ||
2851 | $L004decrypt: | ||
2852 | and ebp, 4294967288 | ||
2853 | mov eax, DWORD PTR 20[esp] | ||
2854 | mov ebx, DWORD PTR 24[esp] | ||
2855 | jz $L017decrypt_finish | ||
2856 | L018decrypt_loop: | ||
2857 | mov eax, DWORD PTR [esi] | ||
2858 | mov ebx, DWORD PTR 4[esi] | ||
2859 | mov DWORD PTR 12[esp],eax | ||
2860 | mov DWORD PTR 16[esp],ebx | ||
2861 | call _des_encrypt | ||
2862 | mov eax, DWORD PTR 12[esp] | ||
2863 | mov ebx, DWORD PTR 16[esp] | ||
2864 | mov ecx, DWORD PTR 20[esp] | ||
2865 | mov edx, DWORD PTR 24[esp] | ||
2866 | xor ecx, eax | ||
2867 | xor edx, ebx | ||
2868 | mov eax, DWORD PTR [esi] | ||
2869 | mov ebx, DWORD PTR 4[esi] | ||
2870 | mov DWORD PTR [edi],ecx | ||
2871 | mov DWORD PTR 4[edi],edx | ||
2872 | mov DWORD PTR 20[esp],eax | ||
2873 | mov DWORD PTR 24[esp],ebx | ||
2874 | add esi, 8 | ||
2875 | add edi, 8 | ||
2876 | sub ebp, 8 | ||
2877 | jnz L018decrypt_loop | ||
2878 | $L017decrypt_finish: | ||
2879 | mov ebp, DWORD PTR 56[esp] | ||
2880 | and ebp, 7 | ||
2881 | jz $L007finish | ||
2882 | mov eax, DWORD PTR [esi] | ||
2883 | mov ebx, DWORD PTR 4[esi] | ||
2884 | mov DWORD PTR 12[esp],eax | ||
2885 | mov DWORD PTR 16[esp],ebx | ||
2886 | call _des_encrypt | ||
2887 | mov eax, DWORD PTR 12[esp] | ||
2888 | mov ebx, DWORD PTR 16[esp] | ||
2889 | mov ecx, DWORD PTR 20[esp] | ||
2890 | mov edx, DWORD PTR 24[esp] | ||
2891 | xor ecx, eax | ||
2892 | xor edx, ebx | ||
2893 | mov eax, DWORD PTR [esi] | ||
2894 | mov ebx, DWORD PTR 4[esi] | ||
2895 | L019dj7: | ||
2896 | ror edx, 16 | ||
2897 | mov BYTE PTR 6[edi],dl | ||
2898 | shr edx, 16 | ||
2899 | L020dj6: | ||
2900 | mov BYTE PTR 5[edi],dh | ||
2901 | L021dj5: | ||
2902 | mov BYTE PTR 4[edi],dl | ||
2903 | L022dj4: | ||
2904 | mov DWORD PTR [edi],ecx | ||
2905 | jmp $L023djend | ||
2906 | L024dj3: | ||
2907 | ror ecx, 16 | ||
2908 | mov BYTE PTR 2[edi],cl | ||
2909 | shl ecx, 16 | ||
2910 | L025dj2: | ||
2911 | mov BYTE PTR 1[esi],ch | ||
2912 | L026dj1: | ||
2913 | mov BYTE PTR [esi], cl | ||
2914 | $L023djend: | ||
2915 | jmp $L007finish | ||
2916 | $L007finish: | ||
2917 | mov ecx, DWORD PTR 64[esp] | ||
2918 | add esp, 28 | ||
2919 | mov DWORD PTR [ecx],eax | ||
2920 | mov DWORD PTR 4[ecx],ebx | ||
2921 | pop edi | ||
2922 | pop esi | ||
2923 | pop ebx | ||
2924 | pop ebp | ||
2925 | ret | ||
2926 | $L008cbc_enc_jmp_table: | ||
2927 | DD 0 | ||
2928 | DD L016ej1 | ||
2929 | DD L015ej2 | ||
2930 | DD L014ej3 | ||
2931 | DD L012ej4 | ||
2932 | DD L011ej5 | ||
2933 | DD L010ej6 | ||
2934 | DD L009ej7 | ||
2935 | L027cbc_dec_jmp_table: | ||
2936 | DD 0 | ||
2937 | DD L026dj1 | ||
2938 | DD L025dj2 | ||
2939 | DD L024dj3 | ||
2940 | DD L022dj4 | ||
2941 | DD L021dj5 | ||
2942 | DD L020dj6 | ||
2943 | DD L019dj7 | ||
2944 | _des_ncbc_encrypt ENDP | ||
2945 | _TEXT ENDS | ||
2946 | _TEXT SEGMENT | ||
2947 | PUBLIC _des_ede3_cbc_encrypt | ||
2948 | |||
2949 | _des_ede3_cbc_encrypt PROC NEAR | ||
2950 | ; | ||
2951 | push ebp | ||
2952 | push ebx | ||
2953 | push esi | ||
2954 | push edi | ||
2955 | mov ebp, DWORD PTR 28[esp] | ||
2956 | ; getting iv ptr from parameter 6 | ||
2957 | mov ebx, DWORD PTR 44[esp] | ||
2958 | mov esi, DWORD PTR [ebx] | ||
2959 | mov edi, DWORD PTR 4[ebx] | ||
2960 | push edi | ||
2961 | push esi | ||
2962 | push edi | ||
2963 | push esi | ||
2964 | mov ebx, esp | ||
2965 | mov esi, DWORD PTR 36[esp] | ||
2966 | mov edi, DWORD PTR 40[esp] | ||
2967 | ; getting encrypt flag from parameter 7 | ||
2968 | mov ecx, DWORD PTR 64[esp] | ||
2969 | ; get and push parameter 5 | ||
2970 | mov eax, DWORD PTR 56[esp] | ||
2971 | push eax | ||
2972 | ; get and push parameter 4 | ||
2973 | mov eax, DWORD PTR 56[esp] | ||
2974 | push eax | ||
2975 | ; get and push parameter 3 | ||
2976 | mov eax, DWORD PTR 56[esp] | ||
2977 | push eax | ||
2978 | push ebx | ||
2979 | cmp ecx, 0 | ||
2980 | jz $L028decrypt | ||
2981 | and ebp, 4294967288 | ||
2982 | mov eax, DWORD PTR 16[esp] | ||
2983 | mov ebx, DWORD PTR 20[esp] | ||
2984 | jz $L029encrypt_finish | ||
2985 | L030encrypt_loop: | ||
2986 | mov ecx, DWORD PTR [esi] | ||
2987 | mov edx, DWORD PTR 4[esi] | ||
2988 | xor eax, ecx | ||
2989 | xor ebx, edx | ||
2990 | mov DWORD PTR 16[esp],eax | ||
2991 | mov DWORD PTR 20[esp],ebx | ||
2992 | call _des_encrypt3 | ||
2993 | mov eax, DWORD PTR 16[esp] | ||
2994 | mov ebx, DWORD PTR 20[esp] | ||
2995 | mov DWORD PTR [edi],eax | ||
2996 | mov DWORD PTR 4[edi],ebx | ||
2997 | add esi, 8 | ||
2998 | add edi, 8 | ||
2999 | sub ebp, 8 | ||
3000 | jnz L030encrypt_loop | ||
3001 | $L029encrypt_finish: | ||
3002 | mov ebp, DWORD PTR 60[esp] | ||
3003 | and ebp, 7 | ||
3004 | jz $L031finish | ||
3005 | xor ecx, ecx | ||
3006 | xor edx, edx | ||
3007 | mov ebp, DWORD PTR $L032cbc_enc_jmp_table[ebp*4] | ||
3008 | jmp ebp | ||
3009 | L033ej7: | ||
3010 | mov dh, BYTE PTR 6[esi] | ||
3011 | shl edx, 8 | ||
3012 | L034ej6: | ||
3013 | mov dh, BYTE PTR 5[esi] | ||
3014 | L035ej5: | ||
3015 | mov dl, BYTE PTR 4[esi] | ||
3016 | L036ej4: | ||
3017 | mov ecx, DWORD PTR [esi] | ||
3018 | jmp $L037ejend | ||
3019 | L038ej3: | ||
3020 | mov ch, BYTE PTR 2[esi] | ||
3021 | shl ecx, 8 | ||
3022 | L039ej2: | ||
3023 | mov ch, BYTE PTR 1[esi] | ||
3024 | L040ej1: | ||
3025 | mov cl, BYTE PTR [esi] | ||
3026 | $L037ejend: | ||
3027 | xor eax, ecx | ||
3028 | xor ebx, edx | ||
3029 | mov DWORD PTR 16[esp],eax | ||
3030 | mov DWORD PTR 20[esp],ebx | ||
3031 | call _des_encrypt3 | ||
3032 | mov eax, DWORD PTR 16[esp] | ||
3033 | mov ebx, DWORD PTR 20[esp] | ||
3034 | mov DWORD PTR [edi],eax | ||
3035 | mov DWORD PTR 4[edi],ebx | ||
3036 | jmp $L031finish | ||
3037 | $L028decrypt: | ||
3038 | and ebp, 4294967288 | ||
3039 | mov eax, DWORD PTR 24[esp] | ||
3040 | mov ebx, DWORD PTR 28[esp] | ||
3041 | jz $L041decrypt_finish | ||
3042 | L042decrypt_loop: | ||
3043 | mov eax, DWORD PTR [esi] | ||
3044 | mov ebx, DWORD PTR 4[esi] | ||
3045 | mov DWORD PTR 16[esp],eax | ||
3046 | mov DWORD PTR 20[esp],ebx | ||
3047 | call _des_decrypt3 | ||
3048 | mov eax, DWORD PTR 16[esp] | ||
3049 | mov ebx, DWORD PTR 20[esp] | ||
3050 | mov ecx, DWORD PTR 24[esp] | ||
3051 | mov edx, DWORD PTR 28[esp] | ||
3052 | xor ecx, eax | ||
3053 | xor edx, ebx | ||
3054 | mov eax, DWORD PTR [esi] | ||
3055 | mov ebx, DWORD PTR 4[esi] | ||
3056 | mov DWORD PTR [edi],ecx | ||
3057 | mov DWORD PTR 4[edi],edx | ||
3058 | mov DWORD PTR 24[esp],eax | ||
3059 | mov DWORD PTR 28[esp],ebx | ||
3060 | add esi, 8 | ||
3061 | add edi, 8 | ||
3062 | sub ebp, 8 | ||
3063 | jnz L042decrypt_loop | ||
3064 | $L041decrypt_finish: | ||
3065 | mov ebp, DWORD PTR 60[esp] | ||
3066 | and ebp, 7 | ||
3067 | jz $L031finish | ||
3068 | mov eax, DWORD PTR [esi] | ||
3069 | mov ebx, DWORD PTR 4[esi] | ||
3070 | mov DWORD PTR 16[esp],eax | ||
3071 | mov DWORD PTR 20[esp],ebx | ||
3072 | call _des_decrypt3 | ||
3073 | mov eax, DWORD PTR 16[esp] | ||
3074 | mov ebx, DWORD PTR 20[esp] | ||
3075 | mov ecx, DWORD PTR 24[esp] | ||
3076 | mov edx, DWORD PTR 28[esp] | ||
3077 | xor ecx, eax | ||
3078 | xor edx, ebx | ||
3079 | mov eax, DWORD PTR [esi] | ||
3080 | mov ebx, DWORD PTR 4[esi] | ||
3081 | L043dj7: | ||
3082 | ror edx, 16 | ||
3083 | mov BYTE PTR 6[edi],dl | ||
3084 | shr edx, 16 | ||
3085 | L044dj6: | ||
3086 | mov BYTE PTR 5[edi],dh | ||
3087 | L045dj5: | ||
3088 | mov BYTE PTR 4[edi],dl | ||
3089 | L046dj4: | ||
3090 | mov DWORD PTR [edi],ecx | ||
3091 | jmp $L047djend | ||
3092 | L048dj3: | ||
3093 | ror ecx, 16 | ||
3094 | mov BYTE PTR 2[edi],cl | ||
3095 | shl ecx, 16 | ||
3096 | L049dj2: | ||
3097 | mov BYTE PTR 1[esi],ch | ||
3098 | L050dj1: | ||
3099 | mov BYTE PTR [esi], cl | ||
3100 | $L047djend: | ||
3101 | jmp $L031finish | ||
3102 | $L031finish: | ||
3103 | mov ecx, DWORD PTR 76[esp] | ||
3104 | add esp, 32 | ||
3105 | mov DWORD PTR [ecx],eax | ||
3106 | mov DWORD PTR 4[ecx],ebx | ||
3107 | pop edi | ||
3108 | pop esi | ||
3109 | pop ebx | ||
3110 | pop ebp | ||
3111 | ret | ||
3112 | $L032cbc_enc_jmp_table: | ||
3113 | DD 0 | ||
3114 | DD L040ej1 | ||
3115 | DD L039ej2 | ||
3116 | DD L038ej3 | ||
3117 | DD L036ej4 | ||
3118 | DD L035ej5 | ||
3119 | DD L034ej6 | ||
3120 | DD L033ej7 | ||
3121 | L051cbc_dec_jmp_table: | ||
3122 | DD 0 | ||
3123 | DD L050dj1 | ||
3124 | DD L049dj2 | ||
3125 | DD L048dj3 | ||
3126 | DD L046dj4 | ||
3127 | DD L045dj5 | ||
3128 | DD L044dj6 | ||
3129 | DD L043dj7 | ||
3130 | _des_ede3_cbc_encrypt ENDP | ||
3131 | _TEXT ENDS | ||
3132 | 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 @@ | |||
1 | /* Run the C pre-processor over this file with one of the following defined | ||
2 | * ELF - elf object files, | ||
3 | * OUT - a.out object files, | ||
4 | * BSDI - BSDI style a.out object files | ||
5 | * SOL - Solaris style elf | ||
6 | */ | ||
7 | |||
8 | #define TYPE(a,b) .type a,b | ||
9 | #define SIZE(a,b) .size a,b | ||
10 | |||
11 | #if defined(OUT) || defined(BSDI) | ||
12 | #define des_SPtrans _des_SPtrans | ||
13 | #define des_encrypt _des_encrypt | ||
14 | #define des_encrypt2 _des_encrypt2 | ||
15 | #define des_encrypt3 _des_encrypt3 | ||
16 | #define des_decrypt3 _des_decrypt3 | ||
17 | #define des_ncbc_encrypt _des_ncbc_encrypt | ||
18 | #define des_ede3_cbc_encrypt _des_ede3_cbc_encrypt | ||
19 | |||
20 | #endif | ||
21 | |||
22 | #ifdef OUT | ||
23 | #define OK 1 | ||
24 | #define ALIGN 4 | ||
25 | #endif | ||
26 | |||
27 | #ifdef BSDI | ||
28 | #define OK 1 | ||
29 | #define ALIGN 4 | ||
30 | #undef SIZE | ||
31 | #undef TYPE | ||
32 | #define SIZE(a,b) | ||
33 | #define TYPE(a,b) | ||
34 | #endif | ||
35 | |||
36 | #if defined(ELF) || defined(SOL) | ||
37 | #define OK 1 | ||
38 | #define ALIGN 16 | ||
39 | #endif | ||
40 | |||
41 | #ifndef OK | ||
42 | You need to define one of | ||
43 | ELF - elf systems - linux-elf, NetBSD and DG-UX | ||
44 | OUT - a.out systems - linux-a.out and FreeBSD | ||
45 | SOL - solaris systems, which are elf with strange comment lines | ||
46 | BSDI - a.out with a very primative version of as. | ||
47 | #endif | ||
48 | |||
49 | /* Let the Assembler begin :-) */ | ||
50 | /* Don't even think of reading this code */ | ||
51 | /* It was automatically generated by des-586.pl */ | ||
52 | /* Which is a perl program used to generate the x86 assember for */ | ||
53 | /* any of elf, a.out, BSDI,Win32, or Solaris */ | ||
54 | /* eric <eay@cryptsoft.com> */ | ||
55 | |||
56 | .file "des-586.s" | ||
57 | .version "01.01" | ||
58 | gcc2_compiled.: | ||
59 | .text | ||
60 | .align ALIGN | ||
61 | .globl des_encrypt | ||
62 | TYPE(des_encrypt,@function) | ||
63 | des_encrypt: | ||
64 | pushl %esi | ||
65 | pushl %edi | ||
66 | |||
67 | /* Load the 2 words */ | ||
68 | movl 12(%esp), %esi | ||
69 | xorl %ecx, %ecx | ||
70 | pushl %ebx | ||
71 | pushl %ebp | ||
72 | movl (%esi), %eax | ||
73 | movl 28(%esp), %ebx | ||
74 | movl 4(%esi), %edi | ||
75 | |||
76 | /* IP */ | ||
77 | roll $4, %eax | ||
78 | movl %eax, %esi | ||
79 | xorl %edi, %eax | ||
80 | andl $0xf0f0f0f0, %eax | ||
81 | xorl %eax, %esi | ||
82 | xorl %eax, %edi | ||
83 | |||
84 | roll $20, %edi | ||
85 | movl %edi, %eax | ||
86 | xorl %esi, %edi | ||
87 | andl $0xfff0000f, %edi | ||
88 | xorl %edi, %eax | ||
89 | xorl %edi, %esi | ||
90 | |||
91 | roll $14, %eax | ||
92 | movl %eax, %edi | ||
93 | xorl %esi, %eax | ||
94 | andl $0x33333333, %eax | ||
95 | xorl %eax, %edi | ||
96 | xorl %eax, %esi | ||
97 | |||
98 | roll $22, %esi | ||
99 | movl %esi, %eax | ||
100 | xorl %edi, %esi | ||
101 | andl $0x03fc03fc, %esi | ||
102 | xorl %esi, %eax | ||
103 | xorl %esi, %edi | ||
104 | |||
105 | roll $9, %eax | ||
106 | movl %eax, %esi | ||
107 | xorl %edi, %eax | ||
108 | andl $0xaaaaaaaa, %eax | ||
109 | xorl %eax, %esi | ||
110 | xorl %eax, %edi | ||
111 | |||
112 | .byte 209 | ||
113 | .byte 199 /* roll $1 %edi */ | ||
114 | movl 24(%esp), %ebp | ||
115 | cmpl $0, %ebx | ||
116 | je .L000start_decrypt | ||
117 | |||
118 | /* Round 0 */ | ||
119 | movl (%ebp), %eax | ||
120 | xorl %ebx, %ebx | ||
121 | movl 4(%ebp), %edx | ||
122 | xorl %esi, %eax | ||
123 | xorl %esi, %edx | ||
124 | andl $0xfcfcfcfc, %eax | ||
125 | andl $0xcfcfcfcf, %edx | ||
126 | movb %al, %bl | ||
127 | movb %ah, %cl | ||
128 | rorl $4, %edx | ||
129 | movl des_SPtrans(%ebx),%ebp | ||
130 | movb %dl, %bl | ||
131 | xorl %ebp, %edi | ||
132 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
133 | xorl %ebp, %edi | ||
134 | movb %dh, %cl | ||
135 | shrl $16, %eax | ||
136 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
137 | xorl %ebp, %edi | ||
138 | movb %ah, %bl | ||
139 | shrl $16, %edx | ||
140 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
141 | xorl %ebp, %edi | ||
142 | movl 24(%esp), %ebp | ||
143 | movb %dh, %cl | ||
144 | andl $0xff, %eax | ||
145 | andl $0xff, %edx | ||
146 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
147 | xorl %ebx, %edi | ||
148 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
149 | xorl %ebx, %edi | ||
150 | movl 0x400+des_SPtrans(%eax),%ebx | ||
151 | xorl %ebx, %edi | ||
152 | movl 0x500+des_SPtrans(%edx),%ebx | ||
153 | xorl %ebx, %edi | ||
154 | |||
155 | /* Round 1 */ | ||
156 | movl 8(%ebp), %eax | ||
157 | xorl %ebx, %ebx | ||
158 | movl 12(%ebp), %edx | ||
159 | xorl %edi, %eax | ||
160 | xorl %edi, %edx | ||
161 | andl $0xfcfcfcfc, %eax | ||
162 | andl $0xcfcfcfcf, %edx | ||
163 | movb %al, %bl | ||
164 | movb %ah, %cl | ||
165 | rorl $4, %edx | ||
166 | movl des_SPtrans(%ebx),%ebp | ||
167 | movb %dl, %bl | ||
168 | xorl %ebp, %esi | ||
169 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
170 | xorl %ebp, %esi | ||
171 | movb %dh, %cl | ||
172 | shrl $16, %eax | ||
173 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
174 | xorl %ebp, %esi | ||
175 | movb %ah, %bl | ||
176 | shrl $16, %edx | ||
177 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
178 | xorl %ebp, %esi | ||
179 | movl 24(%esp), %ebp | ||
180 | movb %dh, %cl | ||
181 | andl $0xff, %eax | ||
182 | andl $0xff, %edx | ||
183 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
184 | xorl %ebx, %esi | ||
185 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
186 | xorl %ebx, %esi | ||
187 | movl 0x400+des_SPtrans(%eax),%ebx | ||
188 | xorl %ebx, %esi | ||
189 | movl 0x500+des_SPtrans(%edx),%ebx | ||
190 | xorl %ebx, %esi | ||
191 | |||
192 | /* Round 2 */ | ||
193 | movl 16(%ebp), %eax | ||
194 | xorl %ebx, %ebx | ||
195 | movl 20(%ebp), %edx | ||
196 | xorl %esi, %eax | ||
197 | xorl %esi, %edx | ||
198 | andl $0xfcfcfcfc, %eax | ||
199 | andl $0xcfcfcfcf, %edx | ||
200 | movb %al, %bl | ||
201 | movb %ah, %cl | ||
202 | rorl $4, %edx | ||
203 | movl des_SPtrans(%ebx),%ebp | ||
204 | movb %dl, %bl | ||
205 | xorl %ebp, %edi | ||
206 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
207 | xorl %ebp, %edi | ||
208 | movb %dh, %cl | ||
209 | shrl $16, %eax | ||
210 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
211 | xorl %ebp, %edi | ||
212 | movb %ah, %bl | ||
213 | shrl $16, %edx | ||
214 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
215 | xorl %ebp, %edi | ||
216 | movl 24(%esp), %ebp | ||
217 | movb %dh, %cl | ||
218 | andl $0xff, %eax | ||
219 | andl $0xff, %edx | ||
220 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
221 | xorl %ebx, %edi | ||
222 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
223 | xorl %ebx, %edi | ||
224 | movl 0x400+des_SPtrans(%eax),%ebx | ||
225 | xorl %ebx, %edi | ||
226 | movl 0x500+des_SPtrans(%edx),%ebx | ||
227 | xorl %ebx, %edi | ||
228 | |||
229 | /* Round 3 */ | ||
230 | movl 24(%ebp), %eax | ||
231 | xorl %ebx, %ebx | ||
232 | movl 28(%ebp), %edx | ||
233 | xorl %edi, %eax | ||
234 | xorl %edi, %edx | ||
235 | andl $0xfcfcfcfc, %eax | ||
236 | andl $0xcfcfcfcf, %edx | ||
237 | movb %al, %bl | ||
238 | movb %ah, %cl | ||
239 | rorl $4, %edx | ||
240 | movl des_SPtrans(%ebx),%ebp | ||
241 | movb %dl, %bl | ||
242 | xorl %ebp, %esi | ||
243 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
244 | xorl %ebp, %esi | ||
245 | movb %dh, %cl | ||
246 | shrl $16, %eax | ||
247 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
248 | xorl %ebp, %esi | ||
249 | movb %ah, %bl | ||
250 | shrl $16, %edx | ||
251 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
252 | xorl %ebp, %esi | ||
253 | movl 24(%esp), %ebp | ||
254 | movb %dh, %cl | ||
255 | andl $0xff, %eax | ||
256 | andl $0xff, %edx | ||
257 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
258 | xorl %ebx, %esi | ||
259 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
260 | xorl %ebx, %esi | ||
261 | movl 0x400+des_SPtrans(%eax),%ebx | ||
262 | xorl %ebx, %esi | ||
263 | movl 0x500+des_SPtrans(%edx),%ebx | ||
264 | xorl %ebx, %esi | ||
265 | |||
266 | /* Round 4 */ | ||
267 | movl 32(%ebp), %eax | ||
268 | xorl %ebx, %ebx | ||
269 | movl 36(%ebp), %edx | ||
270 | xorl %esi, %eax | ||
271 | xorl %esi, %edx | ||
272 | andl $0xfcfcfcfc, %eax | ||
273 | andl $0xcfcfcfcf, %edx | ||
274 | movb %al, %bl | ||
275 | movb %ah, %cl | ||
276 | rorl $4, %edx | ||
277 | movl des_SPtrans(%ebx),%ebp | ||
278 | movb %dl, %bl | ||
279 | xorl %ebp, %edi | ||
280 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
281 | xorl %ebp, %edi | ||
282 | movb %dh, %cl | ||
283 | shrl $16, %eax | ||
284 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
285 | xorl %ebp, %edi | ||
286 | movb %ah, %bl | ||
287 | shrl $16, %edx | ||
288 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
289 | xorl %ebp, %edi | ||
290 | movl 24(%esp), %ebp | ||
291 | movb %dh, %cl | ||
292 | andl $0xff, %eax | ||
293 | andl $0xff, %edx | ||
294 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
295 | xorl %ebx, %edi | ||
296 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
297 | xorl %ebx, %edi | ||
298 | movl 0x400+des_SPtrans(%eax),%ebx | ||
299 | xorl %ebx, %edi | ||
300 | movl 0x500+des_SPtrans(%edx),%ebx | ||
301 | xorl %ebx, %edi | ||
302 | |||
303 | /* Round 5 */ | ||
304 | movl 40(%ebp), %eax | ||
305 | xorl %ebx, %ebx | ||
306 | movl 44(%ebp), %edx | ||
307 | xorl %edi, %eax | ||
308 | xorl %edi, %edx | ||
309 | andl $0xfcfcfcfc, %eax | ||
310 | andl $0xcfcfcfcf, %edx | ||
311 | movb %al, %bl | ||
312 | movb %ah, %cl | ||
313 | rorl $4, %edx | ||
314 | movl des_SPtrans(%ebx),%ebp | ||
315 | movb %dl, %bl | ||
316 | xorl %ebp, %esi | ||
317 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
318 | xorl %ebp, %esi | ||
319 | movb %dh, %cl | ||
320 | shrl $16, %eax | ||
321 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
322 | xorl %ebp, %esi | ||
323 | movb %ah, %bl | ||
324 | shrl $16, %edx | ||
325 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
326 | xorl %ebp, %esi | ||
327 | movl 24(%esp), %ebp | ||
328 | movb %dh, %cl | ||
329 | andl $0xff, %eax | ||
330 | andl $0xff, %edx | ||
331 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
332 | xorl %ebx, %esi | ||
333 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
334 | xorl %ebx, %esi | ||
335 | movl 0x400+des_SPtrans(%eax),%ebx | ||
336 | xorl %ebx, %esi | ||
337 | movl 0x500+des_SPtrans(%edx),%ebx | ||
338 | xorl %ebx, %esi | ||
339 | |||
340 | /* Round 6 */ | ||
341 | movl 48(%ebp), %eax | ||
342 | xorl %ebx, %ebx | ||
343 | movl 52(%ebp), %edx | ||
344 | xorl %esi, %eax | ||
345 | xorl %esi, %edx | ||
346 | andl $0xfcfcfcfc, %eax | ||
347 | andl $0xcfcfcfcf, %edx | ||
348 | movb %al, %bl | ||
349 | movb %ah, %cl | ||
350 | rorl $4, %edx | ||
351 | movl des_SPtrans(%ebx),%ebp | ||
352 | movb %dl, %bl | ||
353 | xorl %ebp, %edi | ||
354 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
355 | xorl %ebp, %edi | ||
356 | movb %dh, %cl | ||
357 | shrl $16, %eax | ||
358 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
359 | xorl %ebp, %edi | ||
360 | movb %ah, %bl | ||
361 | shrl $16, %edx | ||
362 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
363 | xorl %ebp, %edi | ||
364 | movl 24(%esp), %ebp | ||
365 | movb %dh, %cl | ||
366 | andl $0xff, %eax | ||
367 | andl $0xff, %edx | ||
368 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
369 | xorl %ebx, %edi | ||
370 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
371 | xorl %ebx, %edi | ||
372 | movl 0x400+des_SPtrans(%eax),%ebx | ||
373 | xorl %ebx, %edi | ||
374 | movl 0x500+des_SPtrans(%edx),%ebx | ||
375 | xorl %ebx, %edi | ||
376 | |||
377 | /* Round 7 */ | ||
378 | movl 56(%ebp), %eax | ||
379 | xorl %ebx, %ebx | ||
380 | movl 60(%ebp), %edx | ||
381 | xorl %edi, %eax | ||
382 | xorl %edi, %edx | ||
383 | andl $0xfcfcfcfc, %eax | ||
384 | andl $0xcfcfcfcf, %edx | ||
385 | movb %al, %bl | ||
386 | movb %ah, %cl | ||
387 | rorl $4, %edx | ||
388 | movl des_SPtrans(%ebx),%ebp | ||
389 | movb %dl, %bl | ||
390 | xorl %ebp, %esi | ||
391 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
392 | xorl %ebp, %esi | ||
393 | movb %dh, %cl | ||
394 | shrl $16, %eax | ||
395 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
396 | xorl %ebp, %esi | ||
397 | movb %ah, %bl | ||
398 | shrl $16, %edx | ||
399 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
400 | xorl %ebp, %esi | ||
401 | movl 24(%esp), %ebp | ||
402 | movb %dh, %cl | ||
403 | andl $0xff, %eax | ||
404 | andl $0xff, %edx | ||
405 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
406 | xorl %ebx, %esi | ||
407 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
408 | xorl %ebx, %esi | ||
409 | movl 0x400+des_SPtrans(%eax),%ebx | ||
410 | xorl %ebx, %esi | ||
411 | movl 0x500+des_SPtrans(%edx),%ebx | ||
412 | xorl %ebx, %esi | ||
413 | |||
414 | /* Round 8 */ | ||
415 | movl 64(%ebp), %eax | ||
416 | xorl %ebx, %ebx | ||
417 | movl 68(%ebp), %edx | ||
418 | xorl %esi, %eax | ||
419 | xorl %esi, %edx | ||
420 | andl $0xfcfcfcfc, %eax | ||
421 | andl $0xcfcfcfcf, %edx | ||
422 | movb %al, %bl | ||
423 | movb %ah, %cl | ||
424 | rorl $4, %edx | ||
425 | movl des_SPtrans(%ebx),%ebp | ||
426 | movb %dl, %bl | ||
427 | xorl %ebp, %edi | ||
428 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
429 | xorl %ebp, %edi | ||
430 | movb %dh, %cl | ||
431 | shrl $16, %eax | ||
432 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
433 | xorl %ebp, %edi | ||
434 | movb %ah, %bl | ||
435 | shrl $16, %edx | ||
436 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
437 | xorl %ebp, %edi | ||
438 | movl 24(%esp), %ebp | ||
439 | movb %dh, %cl | ||
440 | andl $0xff, %eax | ||
441 | andl $0xff, %edx | ||
442 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
443 | xorl %ebx, %edi | ||
444 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
445 | xorl %ebx, %edi | ||
446 | movl 0x400+des_SPtrans(%eax),%ebx | ||
447 | xorl %ebx, %edi | ||
448 | movl 0x500+des_SPtrans(%edx),%ebx | ||
449 | xorl %ebx, %edi | ||
450 | |||
451 | /* Round 9 */ | ||
452 | movl 72(%ebp), %eax | ||
453 | xorl %ebx, %ebx | ||
454 | movl 76(%ebp), %edx | ||
455 | xorl %edi, %eax | ||
456 | xorl %edi, %edx | ||
457 | andl $0xfcfcfcfc, %eax | ||
458 | andl $0xcfcfcfcf, %edx | ||
459 | movb %al, %bl | ||
460 | movb %ah, %cl | ||
461 | rorl $4, %edx | ||
462 | movl des_SPtrans(%ebx),%ebp | ||
463 | movb %dl, %bl | ||
464 | xorl %ebp, %esi | ||
465 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
466 | xorl %ebp, %esi | ||
467 | movb %dh, %cl | ||
468 | shrl $16, %eax | ||
469 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
470 | xorl %ebp, %esi | ||
471 | movb %ah, %bl | ||
472 | shrl $16, %edx | ||
473 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
474 | xorl %ebp, %esi | ||
475 | movl 24(%esp), %ebp | ||
476 | movb %dh, %cl | ||
477 | andl $0xff, %eax | ||
478 | andl $0xff, %edx | ||
479 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
480 | xorl %ebx, %esi | ||
481 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
482 | xorl %ebx, %esi | ||
483 | movl 0x400+des_SPtrans(%eax),%ebx | ||
484 | xorl %ebx, %esi | ||
485 | movl 0x500+des_SPtrans(%edx),%ebx | ||
486 | xorl %ebx, %esi | ||
487 | |||
488 | /* Round 10 */ | ||
489 | movl 80(%ebp), %eax | ||
490 | xorl %ebx, %ebx | ||
491 | movl 84(%ebp), %edx | ||
492 | xorl %esi, %eax | ||
493 | xorl %esi, %edx | ||
494 | andl $0xfcfcfcfc, %eax | ||
495 | andl $0xcfcfcfcf, %edx | ||
496 | movb %al, %bl | ||
497 | movb %ah, %cl | ||
498 | rorl $4, %edx | ||
499 | movl des_SPtrans(%ebx),%ebp | ||
500 | movb %dl, %bl | ||
501 | xorl %ebp, %edi | ||
502 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
503 | xorl %ebp, %edi | ||
504 | movb %dh, %cl | ||
505 | shrl $16, %eax | ||
506 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
507 | xorl %ebp, %edi | ||
508 | movb %ah, %bl | ||
509 | shrl $16, %edx | ||
510 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
511 | xorl %ebp, %edi | ||
512 | movl 24(%esp), %ebp | ||
513 | movb %dh, %cl | ||
514 | andl $0xff, %eax | ||
515 | andl $0xff, %edx | ||
516 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
517 | xorl %ebx, %edi | ||
518 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
519 | xorl %ebx, %edi | ||
520 | movl 0x400+des_SPtrans(%eax),%ebx | ||
521 | xorl %ebx, %edi | ||
522 | movl 0x500+des_SPtrans(%edx),%ebx | ||
523 | xorl %ebx, %edi | ||
524 | |||
525 | /* Round 11 */ | ||
526 | movl 88(%ebp), %eax | ||
527 | xorl %ebx, %ebx | ||
528 | movl 92(%ebp), %edx | ||
529 | xorl %edi, %eax | ||
530 | xorl %edi, %edx | ||
531 | andl $0xfcfcfcfc, %eax | ||
532 | andl $0xcfcfcfcf, %edx | ||
533 | movb %al, %bl | ||
534 | movb %ah, %cl | ||
535 | rorl $4, %edx | ||
536 | movl des_SPtrans(%ebx),%ebp | ||
537 | movb %dl, %bl | ||
538 | xorl %ebp, %esi | ||
539 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
540 | xorl %ebp, %esi | ||
541 | movb %dh, %cl | ||
542 | shrl $16, %eax | ||
543 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
544 | xorl %ebp, %esi | ||
545 | movb %ah, %bl | ||
546 | shrl $16, %edx | ||
547 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
548 | xorl %ebp, %esi | ||
549 | movl 24(%esp), %ebp | ||
550 | movb %dh, %cl | ||
551 | andl $0xff, %eax | ||
552 | andl $0xff, %edx | ||
553 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
554 | xorl %ebx, %esi | ||
555 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
556 | xorl %ebx, %esi | ||
557 | movl 0x400+des_SPtrans(%eax),%ebx | ||
558 | xorl %ebx, %esi | ||
559 | movl 0x500+des_SPtrans(%edx),%ebx | ||
560 | xorl %ebx, %esi | ||
561 | |||
562 | /* Round 12 */ | ||
563 | movl 96(%ebp), %eax | ||
564 | xorl %ebx, %ebx | ||
565 | movl 100(%ebp), %edx | ||
566 | xorl %esi, %eax | ||
567 | xorl %esi, %edx | ||
568 | andl $0xfcfcfcfc, %eax | ||
569 | andl $0xcfcfcfcf, %edx | ||
570 | movb %al, %bl | ||
571 | movb %ah, %cl | ||
572 | rorl $4, %edx | ||
573 | movl des_SPtrans(%ebx),%ebp | ||
574 | movb %dl, %bl | ||
575 | xorl %ebp, %edi | ||
576 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
577 | xorl %ebp, %edi | ||
578 | movb %dh, %cl | ||
579 | shrl $16, %eax | ||
580 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
581 | xorl %ebp, %edi | ||
582 | movb %ah, %bl | ||
583 | shrl $16, %edx | ||
584 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
585 | xorl %ebp, %edi | ||
586 | movl 24(%esp), %ebp | ||
587 | movb %dh, %cl | ||
588 | andl $0xff, %eax | ||
589 | andl $0xff, %edx | ||
590 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
591 | xorl %ebx, %edi | ||
592 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
593 | xorl %ebx, %edi | ||
594 | movl 0x400+des_SPtrans(%eax),%ebx | ||
595 | xorl %ebx, %edi | ||
596 | movl 0x500+des_SPtrans(%edx),%ebx | ||
597 | xorl %ebx, %edi | ||
598 | |||
599 | /* Round 13 */ | ||
600 | movl 104(%ebp), %eax | ||
601 | xorl %ebx, %ebx | ||
602 | movl 108(%ebp), %edx | ||
603 | xorl %edi, %eax | ||
604 | xorl %edi, %edx | ||
605 | andl $0xfcfcfcfc, %eax | ||
606 | andl $0xcfcfcfcf, %edx | ||
607 | movb %al, %bl | ||
608 | movb %ah, %cl | ||
609 | rorl $4, %edx | ||
610 | movl des_SPtrans(%ebx),%ebp | ||
611 | movb %dl, %bl | ||
612 | xorl %ebp, %esi | ||
613 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
614 | xorl %ebp, %esi | ||
615 | movb %dh, %cl | ||
616 | shrl $16, %eax | ||
617 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
618 | xorl %ebp, %esi | ||
619 | movb %ah, %bl | ||
620 | shrl $16, %edx | ||
621 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
622 | xorl %ebp, %esi | ||
623 | movl 24(%esp), %ebp | ||
624 | movb %dh, %cl | ||
625 | andl $0xff, %eax | ||
626 | andl $0xff, %edx | ||
627 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
628 | xorl %ebx, %esi | ||
629 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
630 | xorl %ebx, %esi | ||
631 | movl 0x400+des_SPtrans(%eax),%ebx | ||
632 | xorl %ebx, %esi | ||
633 | movl 0x500+des_SPtrans(%edx),%ebx | ||
634 | xorl %ebx, %esi | ||
635 | |||
636 | /* Round 14 */ | ||
637 | movl 112(%ebp), %eax | ||
638 | xorl %ebx, %ebx | ||
639 | movl 116(%ebp), %edx | ||
640 | xorl %esi, %eax | ||
641 | xorl %esi, %edx | ||
642 | andl $0xfcfcfcfc, %eax | ||
643 | andl $0xcfcfcfcf, %edx | ||
644 | movb %al, %bl | ||
645 | movb %ah, %cl | ||
646 | rorl $4, %edx | ||
647 | movl des_SPtrans(%ebx),%ebp | ||
648 | movb %dl, %bl | ||
649 | xorl %ebp, %edi | ||
650 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
651 | xorl %ebp, %edi | ||
652 | movb %dh, %cl | ||
653 | shrl $16, %eax | ||
654 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
655 | xorl %ebp, %edi | ||
656 | movb %ah, %bl | ||
657 | shrl $16, %edx | ||
658 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
659 | xorl %ebp, %edi | ||
660 | movl 24(%esp), %ebp | ||
661 | movb %dh, %cl | ||
662 | andl $0xff, %eax | ||
663 | andl $0xff, %edx | ||
664 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
665 | xorl %ebx, %edi | ||
666 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
667 | xorl %ebx, %edi | ||
668 | movl 0x400+des_SPtrans(%eax),%ebx | ||
669 | xorl %ebx, %edi | ||
670 | movl 0x500+des_SPtrans(%edx),%ebx | ||
671 | xorl %ebx, %edi | ||
672 | |||
673 | /* Round 15 */ | ||
674 | movl 120(%ebp), %eax | ||
675 | xorl %ebx, %ebx | ||
676 | movl 124(%ebp), %edx | ||
677 | xorl %edi, %eax | ||
678 | xorl %edi, %edx | ||
679 | andl $0xfcfcfcfc, %eax | ||
680 | andl $0xcfcfcfcf, %edx | ||
681 | movb %al, %bl | ||
682 | movb %ah, %cl | ||
683 | rorl $4, %edx | ||
684 | movl des_SPtrans(%ebx),%ebp | ||
685 | movb %dl, %bl | ||
686 | xorl %ebp, %esi | ||
687 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
688 | xorl %ebp, %esi | ||
689 | movb %dh, %cl | ||
690 | shrl $16, %eax | ||
691 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
692 | xorl %ebp, %esi | ||
693 | movb %ah, %bl | ||
694 | shrl $16, %edx | ||
695 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
696 | xorl %ebp, %esi | ||
697 | movl 24(%esp), %ebp | ||
698 | movb %dh, %cl | ||
699 | andl $0xff, %eax | ||
700 | andl $0xff, %edx | ||
701 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
702 | xorl %ebx, %esi | ||
703 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
704 | xorl %ebx, %esi | ||
705 | movl 0x400+des_SPtrans(%eax),%ebx | ||
706 | xorl %ebx, %esi | ||
707 | movl 0x500+des_SPtrans(%edx),%ebx | ||
708 | xorl %ebx, %esi | ||
709 | jmp .L001end | ||
710 | .L000start_decrypt: | ||
711 | |||
712 | /* Round 15 */ | ||
713 | movl 120(%ebp), %eax | ||
714 | xorl %ebx, %ebx | ||
715 | movl 124(%ebp), %edx | ||
716 | xorl %esi, %eax | ||
717 | xorl %esi, %edx | ||
718 | andl $0xfcfcfcfc, %eax | ||
719 | andl $0xcfcfcfcf, %edx | ||
720 | movb %al, %bl | ||
721 | movb %ah, %cl | ||
722 | rorl $4, %edx | ||
723 | movl des_SPtrans(%ebx),%ebp | ||
724 | movb %dl, %bl | ||
725 | xorl %ebp, %edi | ||
726 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
727 | xorl %ebp, %edi | ||
728 | movb %dh, %cl | ||
729 | shrl $16, %eax | ||
730 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
731 | xorl %ebp, %edi | ||
732 | movb %ah, %bl | ||
733 | shrl $16, %edx | ||
734 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
735 | xorl %ebp, %edi | ||
736 | movl 24(%esp), %ebp | ||
737 | movb %dh, %cl | ||
738 | andl $0xff, %eax | ||
739 | andl $0xff, %edx | ||
740 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
741 | xorl %ebx, %edi | ||
742 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
743 | xorl %ebx, %edi | ||
744 | movl 0x400+des_SPtrans(%eax),%ebx | ||
745 | xorl %ebx, %edi | ||
746 | movl 0x500+des_SPtrans(%edx),%ebx | ||
747 | xorl %ebx, %edi | ||
748 | |||
749 | /* Round 14 */ | ||
750 | movl 112(%ebp), %eax | ||
751 | xorl %ebx, %ebx | ||
752 | movl 116(%ebp), %edx | ||
753 | xorl %edi, %eax | ||
754 | xorl %edi, %edx | ||
755 | andl $0xfcfcfcfc, %eax | ||
756 | andl $0xcfcfcfcf, %edx | ||
757 | movb %al, %bl | ||
758 | movb %ah, %cl | ||
759 | rorl $4, %edx | ||
760 | movl des_SPtrans(%ebx),%ebp | ||
761 | movb %dl, %bl | ||
762 | xorl %ebp, %esi | ||
763 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
764 | xorl %ebp, %esi | ||
765 | movb %dh, %cl | ||
766 | shrl $16, %eax | ||
767 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
768 | xorl %ebp, %esi | ||
769 | movb %ah, %bl | ||
770 | shrl $16, %edx | ||
771 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
772 | xorl %ebp, %esi | ||
773 | movl 24(%esp), %ebp | ||
774 | movb %dh, %cl | ||
775 | andl $0xff, %eax | ||
776 | andl $0xff, %edx | ||
777 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
778 | xorl %ebx, %esi | ||
779 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
780 | xorl %ebx, %esi | ||
781 | movl 0x400+des_SPtrans(%eax),%ebx | ||
782 | xorl %ebx, %esi | ||
783 | movl 0x500+des_SPtrans(%edx),%ebx | ||
784 | xorl %ebx, %esi | ||
785 | |||
786 | /* Round 13 */ | ||
787 | movl 104(%ebp), %eax | ||
788 | xorl %ebx, %ebx | ||
789 | movl 108(%ebp), %edx | ||
790 | xorl %esi, %eax | ||
791 | xorl %esi, %edx | ||
792 | andl $0xfcfcfcfc, %eax | ||
793 | andl $0xcfcfcfcf, %edx | ||
794 | movb %al, %bl | ||
795 | movb %ah, %cl | ||
796 | rorl $4, %edx | ||
797 | movl des_SPtrans(%ebx),%ebp | ||
798 | movb %dl, %bl | ||
799 | xorl %ebp, %edi | ||
800 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
801 | xorl %ebp, %edi | ||
802 | movb %dh, %cl | ||
803 | shrl $16, %eax | ||
804 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
805 | xorl %ebp, %edi | ||
806 | movb %ah, %bl | ||
807 | shrl $16, %edx | ||
808 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
809 | xorl %ebp, %edi | ||
810 | movl 24(%esp), %ebp | ||
811 | movb %dh, %cl | ||
812 | andl $0xff, %eax | ||
813 | andl $0xff, %edx | ||
814 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
815 | xorl %ebx, %edi | ||
816 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
817 | xorl %ebx, %edi | ||
818 | movl 0x400+des_SPtrans(%eax),%ebx | ||
819 | xorl %ebx, %edi | ||
820 | movl 0x500+des_SPtrans(%edx),%ebx | ||
821 | xorl %ebx, %edi | ||
822 | |||
823 | /* Round 12 */ | ||
824 | movl 96(%ebp), %eax | ||
825 | xorl %ebx, %ebx | ||
826 | movl 100(%ebp), %edx | ||
827 | xorl %edi, %eax | ||
828 | xorl %edi, %edx | ||
829 | andl $0xfcfcfcfc, %eax | ||
830 | andl $0xcfcfcfcf, %edx | ||
831 | movb %al, %bl | ||
832 | movb %ah, %cl | ||
833 | rorl $4, %edx | ||
834 | movl des_SPtrans(%ebx),%ebp | ||
835 | movb %dl, %bl | ||
836 | xorl %ebp, %esi | ||
837 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
838 | xorl %ebp, %esi | ||
839 | movb %dh, %cl | ||
840 | shrl $16, %eax | ||
841 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
842 | xorl %ebp, %esi | ||
843 | movb %ah, %bl | ||
844 | shrl $16, %edx | ||
845 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
846 | xorl %ebp, %esi | ||
847 | movl 24(%esp), %ebp | ||
848 | movb %dh, %cl | ||
849 | andl $0xff, %eax | ||
850 | andl $0xff, %edx | ||
851 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
852 | xorl %ebx, %esi | ||
853 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
854 | xorl %ebx, %esi | ||
855 | movl 0x400+des_SPtrans(%eax),%ebx | ||
856 | xorl %ebx, %esi | ||
857 | movl 0x500+des_SPtrans(%edx),%ebx | ||
858 | xorl %ebx, %esi | ||
859 | |||
860 | /* Round 11 */ | ||
861 | movl 88(%ebp), %eax | ||
862 | xorl %ebx, %ebx | ||
863 | movl 92(%ebp), %edx | ||
864 | xorl %esi, %eax | ||
865 | xorl %esi, %edx | ||
866 | andl $0xfcfcfcfc, %eax | ||
867 | andl $0xcfcfcfcf, %edx | ||
868 | movb %al, %bl | ||
869 | movb %ah, %cl | ||
870 | rorl $4, %edx | ||
871 | movl des_SPtrans(%ebx),%ebp | ||
872 | movb %dl, %bl | ||
873 | xorl %ebp, %edi | ||
874 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
875 | xorl %ebp, %edi | ||
876 | movb %dh, %cl | ||
877 | shrl $16, %eax | ||
878 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
879 | xorl %ebp, %edi | ||
880 | movb %ah, %bl | ||
881 | shrl $16, %edx | ||
882 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
883 | xorl %ebp, %edi | ||
884 | movl 24(%esp), %ebp | ||
885 | movb %dh, %cl | ||
886 | andl $0xff, %eax | ||
887 | andl $0xff, %edx | ||
888 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
889 | xorl %ebx, %edi | ||
890 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
891 | xorl %ebx, %edi | ||
892 | movl 0x400+des_SPtrans(%eax),%ebx | ||
893 | xorl %ebx, %edi | ||
894 | movl 0x500+des_SPtrans(%edx),%ebx | ||
895 | xorl %ebx, %edi | ||
896 | |||
897 | /* Round 10 */ | ||
898 | movl 80(%ebp), %eax | ||
899 | xorl %ebx, %ebx | ||
900 | movl 84(%ebp), %edx | ||
901 | xorl %edi, %eax | ||
902 | xorl %edi, %edx | ||
903 | andl $0xfcfcfcfc, %eax | ||
904 | andl $0xcfcfcfcf, %edx | ||
905 | movb %al, %bl | ||
906 | movb %ah, %cl | ||
907 | rorl $4, %edx | ||
908 | movl des_SPtrans(%ebx),%ebp | ||
909 | movb %dl, %bl | ||
910 | xorl %ebp, %esi | ||
911 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
912 | xorl %ebp, %esi | ||
913 | movb %dh, %cl | ||
914 | shrl $16, %eax | ||
915 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
916 | xorl %ebp, %esi | ||
917 | movb %ah, %bl | ||
918 | shrl $16, %edx | ||
919 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
920 | xorl %ebp, %esi | ||
921 | movl 24(%esp), %ebp | ||
922 | movb %dh, %cl | ||
923 | andl $0xff, %eax | ||
924 | andl $0xff, %edx | ||
925 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
926 | xorl %ebx, %esi | ||
927 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
928 | xorl %ebx, %esi | ||
929 | movl 0x400+des_SPtrans(%eax),%ebx | ||
930 | xorl %ebx, %esi | ||
931 | movl 0x500+des_SPtrans(%edx),%ebx | ||
932 | xorl %ebx, %esi | ||
933 | |||
934 | /* Round 9 */ | ||
935 | movl 72(%ebp), %eax | ||
936 | xorl %ebx, %ebx | ||
937 | movl 76(%ebp), %edx | ||
938 | xorl %esi, %eax | ||
939 | xorl %esi, %edx | ||
940 | andl $0xfcfcfcfc, %eax | ||
941 | andl $0xcfcfcfcf, %edx | ||
942 | movb %al, %bl | ||
943 | movb %ah, %cl | ||
944 | rorl $4, %edx | ||
945 | movl des_SPtrans(%ebx),%ebp | ||
946 | movb %dl, %bl | ||
947 | xorl %ebp, %edi | ||
948 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
949 | xorl %ebp, %edi | ||
950 | movb %dh, %cl | ||
951 | shrl $16, %eax | ||
952 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
953 | xorl %ebp, %edi | ||
954 | movb %ah, %bl | ||
955 | shrl $16, %edx | ||
956 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
957 | xorl %ebp, %edi | ||
958 | movl 24(%esp), %ebp | ||
959 | movb %dh, %cl | ||
960 | andl $0xff, %eax | ||
961 | andl $0xff, %edx | ||
962 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
963 | xorl %ebx, %edi | ||
964 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
965 | xorl %ebx, %edi | ||
966 | movl 0x400+des_SPtrans(%eax),%ebx | ||
967 | xorl %ebx, %edi | ||
968 | movl 0x500+des_SPtrans(%edx),%ebx | ||
969 | xorl %ebx, %edi | ||
970 | |||
971 | /* Round 8 */ | ||
972 | movl 64(%ebp), %eax | ||
973 | xorl %ebx, %ebx | ||
974 | movl 68(%ebp), %edx | ||
975 | xorl %edi, %eax | ||
976 | xorl %edi, %edx | ||
977 | andl $0xfcfcfcfc, %eax | ||
978 | andl $0xcfcfcfcf, %edx | ||
979 | movb %al, %bl | ||
980 | movb %ah, %cl | ||
981 | rorl $4, %edx | ||
982 | movl des_SPtrans(%ebx),%ebp | ||
983 | movb %dl, %bl | ||
984 | xorl %ebp, %esi | ||
985 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
986 | xorl %ebp, %esi | ||
987 | movb %dh, %cl | ||
988 | shrl $16, %eax | ||
989 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
990 | xorl %ebp, %esi | ||
991 | movb %ah, %bl | ||
992 | shrl $16, %edx | ||
993 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
994 | xorl %ebp, %esi | ||
995 | movl 24(%esp), %ebp | ||
996 | movb %dh, %cl | ||
997 | andl $0xff, %eax | ||
998 | andl $0xff, %edx | ||
999 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1000 | xorl %ebx, %esi | ||
1001 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1002 | xorl %ebx, %esi | ||
1003 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1004 | xorl %ebx, %esi | ||
1005 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1006 | xorl %ebx, %esi | ||
1007 | |||
1008 | /* Round 7 */ | ||
1009 | movl 56(%ebp), %eax | ||
1010 | xorl %ebx, %ebx | ||
1011 | movl 60(%ebp), %edx | ||
1012 | xorl %esi, %eax | ||
1013 | xorl %esi, %edx | ||
1014 | andl $0xfcfcfcfc, %eax | ||
1015 | andl $0xcfcfcfcf, %edx | ||
1016 | movb %al, %bl | ||
1017 | movb %ah, %cl | ||
1018 | rorl $4, %edx | ||
1019 | movl des_SPtrans(%ebx),%ebp | ||
1020 | movb %dl, %bl | ||
1021 | xorl %ebp, %edi | ||
1022 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1023 | xorl %ebp, %edi | ||
1024 | movb %dh, %cl | ||
1025 | shrl $16, %eax | ||
1026 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1027 | xorl %ebp, %edi | ||
1028 | movb %ah, %bl | ||
1029 | shrl $16, %edx | ||
1030 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1031 | xorl %ebp, %edi | ||
1032 | movl 24(%esp), %ebp | ||
1033 | movb %dh, %cl | ||
1034 | andl $0xff, %eax | ||
1035 | andl $0xff, %edx | ||
1036 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1037 | xorl %ebx, %edi | ||
1038 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1039 | xorl %ebx, %edi | ||
1040 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1041 | xorl %ebx, %edi | ||
1042 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1043 | xorl %ebx, %edi | ||
1044 | |||
1045 | /* Round 6 */ | ||
1046 | movl 48(%ebp), %eax | ||
1047 | xorl %ebx, %ebx | ||
1048 | movl 52(%ebp), %edx | ||
1049 | xorl %edi, %eax | ||
1050 | xorl %edi, %edx | ||
1051 | andl $0xfcfcfcfc, %eax | ||
1052 | andl $0xcfcfcfcf, %edx | ||
1053 | movb %al, %bl | ||
1054 | movb %ah, %cl | ||
1055 | rorl $4, %edx | ||
1056 | movl des_SPtrans(%ebx),%ebp | ||
1057 | movb %dl, %bl | ||
1058 | xorl %ebp, %esi | ||
1059 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1060 | xorl %ebp, %esi | ||
1061 | movb %dh, %cl | ||
1062 | shrl $16, %eax | ||
1063 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1064 | xorl %ebp, %esi | ||
1065 | movb %ah, %bl | ||
1066 | shrl $16, %edx | ||
1067 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1068 | xorl %ebp, %esi | ||
1069 | movl 24(%esp), %ebp | ||
1070 | movb %dh, %cl | ||
1071 | andl $0xff, %eax | ||
1072 | andl $0xff, %edx | ||
1073 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1074 | xorl %ebx, %esi | ||
1075 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1076 | xorl %ebx, %esi | ||
1077 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1078 | xorl %ebx, %esi | ||
1079 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1080 | xorl %ebx, %esi | ||
1081 | |||
1082 | /* Round 5 */ | ||
1083 | movl 40(%ebp), %eax | ||
1084 | xorl %ebx, %ebx | ||
1085 | movl 44(%ebp), %edx | ||
1086 | xorl %esi, %eax | ||
1087 | xorl %esi, %edx | ||
1088 | andl $0xfcfcfcfc, %eax | ||
1089 | andl $0xcfcfcfcf, %edx | ||
1090 | movb %al, %bl | ||
1091 | movb %ah, %cl | ||
1092 | rorl $4, %edx | ||
1093 | movl des_SPtrans(%ebx),%ebp | ||
1094 | movb %dl, %bl | ||
1095 | xorl %ebp, %edi | ||
1096 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1097 | xorl %ebp, %edi | ||
1098 | movb %dh, %cl | ||
1099 | shrl $16, %eax | ||
1100 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1101 | xorl %ebp, %edi | ||
1102 | movb %ah, %bl | ||
1103 | shrl $16, %edx | ||
1104 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1105 | xorl %ebp, %edi | ||
1106 | movl 24(%esp), %ebp | ||
1107 | movb %dh, %cl | ||
1108 | andl $0xff, %eax | ||
1109 | andl $0xff, %edx | ||
1110 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1111 | xorl %ebx, %edi | ||
1112 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1113 | xorl %ebx, %edi | ||
1114 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1115 | xorl %ebx, %edi | ||
1116 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1117 | xorl %ebx, %edi | ||
1118 | |||
1119 | /* Round 4 */ | ||
1120 | movl 32(%ebp), %eax | ||
1121 | xorl %ebx, %ebx | ||
1122 | movl 36(%ebp), %edx | ||
1123 | xorl %edi, %eax | ||
1124 | xorl %edi, %edx | ||
1125 | andl $0xfcfcfcfc, %eax | ||
1126 | andl $0xcfcfcfcf, %edx | ||
1127 | movb %al, %bl | ||
1128 | movb %ah, %cl | ||
1129 | rorl $4, %edx | ||
1130 | movl des_SPtrans(%ebx),%ebp | ||
1131 | movb %dl, %bl | ||
1132 | xorl %ebp, %esi | ||
1133 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1134 | xorl %ebp, %esi | ||
1135 | movb %dh, %cl | ||
1136 | shrl $16, %eax | ||
1137 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1138 | xorl %ebp, %esi | ||
1139 | movb %ah, %bl | ||
1140 | shrl $16, %edx | ||
1141 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1142 | xorl %ebp, %esi | ||
1143 | movl 24(%esp), %ebp | ||
1144 | movb %dh, %cl | ||
1145 | andl $0xff, %eax | ||
1146 | andl $0xff, %edx | ||
1147 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1148 | xorl %ebx, %esi | ||
1149 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1150 | xorl %ebx, %esi | ||
1151 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1152 | xorl %ebx, %esi | ||
1153 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1154 | xorl %ebx, %esi | ||
1155 | |||
1156 | /* Round 3 */ | ||
1157 | movl 24(%ebp), %eax | ||
1158 | xorl %ebx, %ebx | ||
1159 | movl 28(%ebp), %edx | ||
1160 | xorl %esi, %eax | ||
1161 | xorl %esi, %edx | ||
1162 | andl $0xfcfcfcfc, %eax | ||
1163 | andl $0xcfcfcfcf, %edx | ||
1164 | movb %al, %bl | ||
1165 | movb %ah, %cl | ||
1166 | rorl $4, %edx | ||
1167 | movl des_SPtrans(%ebx),%ebp | ||
1168 | movb %dl, %bl | ||
1169 | xorl %ebp, %edi | ||
1170 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1171 | xorl %ebp, %edi | ||
1172 | movb %dh, %cl | ||
1173 | shrl $16, %eax | ||
1174 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1175 | xorl %ebp, %edi | ||
1176 | movb %ah, %bl | ||
1177 | shrl $16, %edx | ||
1178 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1179 | xorl %ebp, %edi | ||
1180 | movl 24(%esp), %ebp | ||
1181 | movb %dh, %cl | ||
1182 | andl $0xff, %eax | ||
1183 | andl $0xff, %edx | ||
1184 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1185 | xorl %ebx, %edi | ||
1186 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1187 | xorl %ebx, %edi | ||
1188 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1189 | xorl %ebx, %edi | ||
1190 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1191 | xorl %ebx, %edi | ||
1192 | |||
1193 | /* Round 2 */ | ||
1194 | movl 16(%ebp), %eax | ||
1195 | xorl %ebx, %ebx | ||
1196 | movl 20(%ebp), %edx | ||
1197 | xorl %edi, %eax | ||
1198 | xorl %edi, %edx | ||
1199 | andl $0xfcfcfcfc, %eax | ||
1200 | andl $0xcfcfcfcf, %edx | ||
1201 | movb %al, %bl | ||
1202 | movb %ah, %cl | ||
1203 | rorl $4, %edx | ||
1204 | movl des_SPtrans(%ebx),%ebp | ||
1205 | movb %dl, %bl | ||
1206 | xorl %ebp, %esi | ||
1207 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1208 | xorl %ebp, %esi | ||
1209 | movb %dh, %cl | ||
1210 | shrl $16, %eax | ||
1211 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1212 | xorl %ebp, %esi | ||
1213 | movb %ah, %bl | ||
1214 | shrl $16, %edx | ||
1215 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1216 | xorl %ebp, %esi | ||
1217 | movl 24(%esp), %ebp | ||
1218 | movb %dh, %cl | ||
1219 | andl $0xff, %eax | ||
1220 | andl $0xff, %edx | ||
1221 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1222 | xorl %ebx, %esi | ||
1223 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1224 | xorl %ebx, %esi | ||
1225 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1226 | xorl %ebx, %esi | ||
1227 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1228 | xorl %ebx, %esi | ||
1229 | |||
1230 | /* Round 1 */ | ||
1231 | movl 8(%ebp), %eax | ||
1232 | xorl %ebx, %ebx | ||
1233 | movl 12(%ebp), %edx | ||
1234 | xorl %esi, %eax | ||
1235 | xorl %esi, %edx | ||
1236 | andl $0xfcfcfcfc, %eax | ||
1237 | andl $0xcfcfcfcf, %edx | ||
1238 | movb %al, %bl | ||
1239 | movb %ah, %cl | ||
1240 | rorl $4, %edx | ||
1241 | movl des_SPtrans(%ebx),%ebp | ||
1242 | movb %dl, %bl | ||
1243 | xorl %ebp, %edi | ||
1244 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1245 | xorl %ebp, %edi | ||
1246 | movb %dh, %cl | ||
1247 | shrl $16, %eax | ||
1248 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1249 | xorl %ebp, %edi | ||
1250 | movb %ah, %bl | ||
1251 | shrl $16, %edx | ||
1252 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1253 | xorl %ebp, %edi | ||
1254 | movl 24(%esp), %ebp | ||
1255 | movb %dh, %cl | ||
1256 | andl $0xff, %eax | ||
1257 | andl $0xff, %edx | ||
1258 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1259 | xorl %ebx, %edi | ||
1260 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1261 | xorl %ebx, %edi | ||
1262 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1263 | xorl %ebx, %edi | ||
1264 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1265 | xorl %ebx, %edi | ||
1266 | |||
1267 | /* Round 0 */ | ||
1268 | movl (%ebp), %eax | ||
1269 | xorl %ebx, %ebx | ||
1270 | movl 4(%ebp), %edx | ||
1271 | xorl %edi, %eax | ||
1272 | xorl %edi, %edx | ||
1273 | andl $0xfcfcfcfc, %eax | ||
1274 | andl $0xcfcfcfcf, %edx | ||
1275 | movb %al, %bl | ||
1276 | movb %ah, %cl | ||
1277 | rorl $4, %edx | ||
1278 | movl des_SPtrans(%ebx),%ebp | ||
1279 | movb %dl, %bl | ||
1280 | xorl %ebp, %esi | ||
1281 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1282 | xorl %ebp, %esi | ||
1283 | movb %dh, %cl | ||
1284 | shrl $16, %eax | ||
1285 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1286 | xorl %ebp, %esi | ||
1287 | movb %ah, %bl | ||
1288 | shrl $16, %edx | ||
1289 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1290 | xorl %ebp, %esi | ||
1291 | movl 24(%esp), %ebp | ||
1292 | movb %dh, %cl | ||
1293 | andl $0xff, %eax | ||
1294 | andl $0xff, %edx | ||
1295 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1296 | xorl %ebx, %esi | ||
1297 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1298 | xorl %ebx, %esi | ||
1299 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1300 | xorl %ebx, %esi | ||
1301 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1302 | xorl %ebx, %esi | ||
1303 | .L001end: | ||
1304 | |||
1305 | /* FP */ | ||
1306 | movl 20(%esp), %edx | ||
1307 | .byte 209 | ||
1308 | .byte 206 /* rorl $1 %esi */ | ||
1309 | movl %edi, %eax | ||
1310 | xorl %esi, %edi | ||
1311 | andl $0xaaaaaaaa, %edi | ||
1312 | xorl %edi, %eax | ||
1313 | xorl %edi, %esi | ||
1314 | |||
1315 | roll $23, %eax | ||
1316 | movl %eax, %edi | ||
1317 | xorl %esi, %eax | ||
1318 | andl $0x03fc03fc, %eax | ||
1319 | xorl %eax, %edi | ||
1320 | xorl %eax, %esi | ||
1321 | |||
1322 | roll $10, %edi | ||
1323 | movl %edi, %eax | ||
1324 | xorl %esi, %edi | ||
1325 | andl $0x33333333, %edi | ||
1326 | xorl %edi, %eax | ||
1327 | xorl %edi, %esi | ||
1328 | |||
1329 | roll $18, %esi | ||
1330 | movl %esi, %edi | ||
1331 | xorl %eax, %esi | ||
1332 | andl $0xfff0000f, %esi | ||
1333 | xorl %esi, %edi | ||
1334 | xorl %esi, %eax | ||
1335 | |||
1336 | roll $12, %edi | ||
1337 | movl %edi, %esi | ||
1338 | xorl %eax, %edi | ||
1339 | andl $0xf0f0f0f0, %edi | ||
1340 | xorl %edi, %esi | ||
1341 | xorl %edi, %eax | ||
1342 | |||
1343 | rorl $4, %eax | ||
1344 | movl %eax, (%edx) | ||
1345 | movl %esi, 4(%edx) | ||
1346 | popl %ebp | ||
1347 | popl %ebx | ||
1348 | popl %edi | ||
1349 | popl %esi | ||
1350 | ret | ||
1351 | .des_encrypt_end: | ||
1352 | SIZE(des_encrypt,.des_encrypt_end-des_encrypt) | ||
1353 | .ident "desasm.pl" | ||
1354 | .text | ||
1355 | .align ALIGN | ||
1356 | .globl des_encrypt2 | ||
1357 | TYPE(des_encrypt2,@function) | ||
1358 | des_encrypt2: | ||
1359 | pushl %esi | ||
1360 | pushl %edi | ||
1361 | |||
1362 | /* Load the 2 words */ | ||
1363 | movl 12(%esp), %eax | ||
1364 | xorl %ecx, %ecx | ||
1365 | pushl %ebx | ||
1366 | pushl %ebp | ||
1367 | movl (%eax), %esi | ||
1368 | movl 28(%esp), %ebx | ||
1369 | roll $3, %esi | ||
1370 | movl 4(%eax), %edi | ||
1371 | roll $3, %edi | ||
1372 | movl 24(%esp), %ebp | ||
1373 | cmpl $0, %ebx | ||
1374 | je .L002start_decrypt | ||
1375 | |||
1376 | /* Round 0 */ | ||
1377 | movl (%ebp), %eax | ||
1378 | xorl %ebx, %ebx | ||
1379 | movl 4(%ebp), %edx | ||
1380 | xorl %esi, %eax | ||
1381 | xorl %esi, %edx | ||
1382 | andl $0xfcfcfcfc, %eax | ||
1383 | andl $0xcfcfcfcf, %edx | ||
1384 | movb %al, %bl | ||
1385 | movb %ah, %cl | ||
1386 | rorl $4, %edx | ||
1387 | movl des_SPtrans(%ebx),%ebp | ||
1388 | movb %dl, %bl | ||
1389 | xorl %ebp, %edi | ||
1390 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1391 | xorl %ebp, %edi | ||
1392 | movb %dh, %cl | ||
1393 | shrl $16, %eax | ||
1394 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1395 | xorl %ebp, %edi | ||
1396 | movb %ah, %bl | ||
1397 | shrl $16, %edx | ||
1398 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1399 | xorl %ebp, %edi | ||
1400 | movl 24(%esp), %ebp | ||
1401 | movb %dh, %cl | ||
1402 | andl $0xff, %eax | ||
1403 | andl $0xff, %edx | ||
1404 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1405 | xorl %ebx, %edi | ||
1406 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1407 | xorl %ebx, %edi | ||
1408 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1409 | xorl %ebx, %edi | ||
1410 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1411 | xorl %ebx, %edi | ||
1412 | |||
1413 | /* Round 1 */ | ||
1414 | movl 8(%ebp), %eax | ||
1415 | xorl %ebx, %ebx | ||
1416 | movl 12(%ebp), %edx | ||
1417 | xorl %edi, %eax | ||
1418 | xorl %edi, %edx | ||
1419 | andl $0xfcfcfcfc, %eax | ||
1420 | andl $0xcfcfcfcf, %edx | ||
1421 | movb %al, %bl | ||
1422 | movb %ah, %cl | ||
1423 | rorl $4, %edx | ||
1424 | movl des_SPtrans(%ebx),%ebp | ||
1425 | movb %dl, %bl | ||
1426 | xorl %ebp, %esi | ||
1427 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1428 | xorl %ebp, %esi | ||
1429 | movb %dh, %cl | ||
1430 | shrl $16, %eax | ||
1431 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1432 | xorl %ebp, %esi | ||
1433 | movb %ah, %bl | ||
1434 | shrl $16, %edx | ||
1435 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1436 | xorl %ebp, %esi | ||
1437 | movl 24(%esp), %ebp | ||
1438 | movb %dh, %cl | ||
1439 | andl $0xff, %eax | ||
1440 | andl $0xff, %edx | ||
1441 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1442 | xorl %ebx, %esi | ||
1443 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1444 | xorl %ebx, %esi | ||
1445 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1446 | xorl %ebx, %esi | ||
1447 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1448 | xorl %ebx, %esi | ||
1449 | |||
1450 | /* Round 2 */ | ||
1451 | movl 16(%ebp), %eax | ||
1452 | xorl %ebx, %ebx | ||
1453 | movl 20(%ebp), %edx | ||
1454 | xorl %esi, %eax | ||
1455 | xorl %esi, %edx | ||
1456 | andl $0xfcfcfcfc, %eax | ||
1457 | andl $0xcfcfcfcf, %edx | ||
1458 | movb %al, %bl | ||
1459 | movb %ah, %cl | ||
1460 | rorl $4, %edx | ||
1461 | movl des_SPtrans(%ebx),%ebp | ||
1462 | movb %dl, %bl | ||
1463 | xorl %ebp, %edi | ||
1464 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1465 | xorl %ebp, %edi | ||
1466 | movb %dh, %cl | ||
1467 | shrl $16, %eax | ||
1468 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1469 | xorl %ebp, %edi | ||
1470 | movb %ah, %bl | ||
1471 | shrl $16, %edx | ||
1472 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1473 | xorl %ebp, %edi | ||
1474 | movl 24(%esp), %ebp | ||
1475 | movb %dh, %cl | ||
1476 | andl $0xff, %eax | ||
1477 | andl $0xff, %edx | ||
1478 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1479 | xorl %ebx, %edi | ||
1480 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1481 | xorl %ebx, %edi | ||
1482 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1483 | xorl %ebx, %edi | ||
1484 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1485 | xorl %ebx, %edi | ||
1486 | |||
1487 | /* Round 3 */ | ||
1488 | movl 24(%ebp), %eax | ||
1489 | xorl %ebx, %ebx | ||
1490 | movl 28(%ebp), %edx | ||
1491 | xorl %edi, %eax | ||
1492 | xorl %edi, %edx | ||
1493 | andl $0xfcfcfcfc, %eax | ||
1494 | andl $0xcfcfcfcf, %edx | ||
1495 | movb %al, %bl | ||
1496 | movb %ah, %cl | ||
1497 | rorl $4, %edx | ||
1498 | movl des_SPtrans(%ebx),%ebp | ||
1499 | movb %dl, %bl | ||
1500 | xorl %ebp, %esi | ||
1501 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1502 | xorl %ebp, %esi | ||
1503 | movb %dh, %cl | ||
1504 | shrl $16, %eax | ||
1505 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1506 | xorl %ebp, %esi | ||
1507 | movb %ah, %bl | ||
1508 | shrl $16, %edx | ||
1509 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1510 | xorl %ebp, %esi | ||
1511 | movl 24(%esp), %ebp | ||
1512 | movb %dh, %cl | ||
1513 | andl $0xff, %eax | ||
1514 | andl $0xff, %edx | ||
1515 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1516 | xorl %ebx, %esi | ||
1517 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1518 | xorl %ebx, %esi | ||
1519 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1520 | xorl %ebx, %esi | ||
1521 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1522 | xorl %ebx, %esi | ||
1523 | |||
1524 | /* Round 4 */ | ||
1525 | movl 32(%ebp), %eax | ||
1526 | xorl %ebx, %ebx | ||
1527 | movl 36(%ebp), %edx | ||
1528 | xorl %esi, %eax | ||
1529 | xorl %esi, %edx | ||
1530 | andl $0xfcfcfcfc, %eax | ||
1531 | andl $0xcfcfcfcf, %edx | ||
1532 | movb %al, %bl | ||
1533 | movb %ah, %cl | ||
1534 | rorl $4, %edx | ||
1535 | movl des_SPtrans(%ebx),%ebp | ||
1536 | movb %dl, %bl | ||
1537 | xorl %ebp, %edi | ||
1538 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1539 | xorl %ebp, %edi | ||
1540 | movb %dh, %cl | ||
1541 | shrl $16, %eax | ||
1542 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1543 | xorl %ebp, %edi | ||
1544 | movb %ah, %bl | ||
1545 | shrl $16, %edx | ||
1546 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1547 | xorl %ebp, %edi | ||
1548 | movl 24(%esp), %ebp | ||
1549 | movb %dh, %cl | ||
1550 | andl $0xff, %eax | ||
1551 | andl $0xff, %edx | ||
1552 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1553 | xorl %ebx, %edi | ||
1554 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1555 | xorl %ebx, %edi | ||
1556 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1557 | xorl %ebx, %edi | ||
1558 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1559 | xorl %ebx, %edi | ||
1560 | |||
1561 | /* Round 5 */ | ||
1562 | movl 40(%ebp), %eax | ||
1563 | xorl %ebx, %ebx | ||
1564 | movl 44(%ebp), %edx | ||
1565 | xorl %edi, %eax | ||
1566 | xorl %edi, %edx | ||
1567 | andl $0xfcfcfcfc, %eax | ||
1568 | andl $0xcfcfcfcf, %edx | ||
1569 | movb %al, %bl | ||
1570 | movb %ah, %cl | ||
1571 | rorl $4, %edx | ||
1572 | movl des_SPtrans(%ebx),%ebp | ||
1573 | movb %dl, %bl | ||
1574 | xorl %ebp, %esi | ||
1575 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1576 | xorl %ebp, %esi | ||
1577 | movb %dh, %cl | ||
1578 | shrl $16, %eax | ||
1579 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1580 | xorl %ebp, %esi | ||
1581 | movb %ah, %bl | ||
1582 | shrl $16, %edx | ||
1583 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1584 | xorl %ebp, %esi | ||
1585 | movl 24(%esp), %ebp | ||
1586 | movb %dh, %cl | ||
1587 | andl $0xff, %eax | ||
1588 | andl $0xff, %edx | ||
1589 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1590 | xorl %ebx, %esi | ||
1591 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1592 | xorl %ebx, %esi | ||
1593 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1594 | xorl %ebx, %esi | ||
1595 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1596 | xorl %ebx, %esi | ||
1597 | |||
1598 | /* Round 6 */ | ||
1599 | movl 48(%ebp), %eax | ||
1600 | xorl %ebx, %ebx | ||
1601 | movl 52(%ebp), %edx | ||
1602 | xorl %esi, %eax | ||
1603 | xorl %esi, %edx | ||
1604 | andl $0xfcfcfcfc, %eax | ||
1605 | andl $0xcfcfcfcf, %edx | ||
1606 | movb %al, %bl | ||
1607 | movb %ah, %cl | ||
1608 | rorl $4, %edx | ||
1609 | movl des_SPtrans(%ebx),%ebp | ||
1610 | movb %dl, %bl | ||
1611 | xorl %ebp, %edi | ||
1612 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1613 | xorl %ebp, %edi | ||
1614 | movb %dh, %cl | ||
1615 | shrl $16, %eax | ||
1616 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1617 | xorl %ebp, %edi | ||
1618 | movb %ah, %bl | ||
1619 | shrl $16, %edx | ||
1620 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1621 | xorl %ebp, %edi | ||
1622 | movl 24(%esp), %ebp | ||
1623 | movb %dh, %cl | ||
1624 | andl $0xff, %eax | ||
1625 | andl $0xff, %edx | ||
1626 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1627 | xorl %ebx, %edi | ||
1628 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1629 | xorl %ebx, %edi | ||
1630 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1631 | xorl %ebx, %edi | ||
1632 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1633 | xorl %ebx, %edi | ||
1634 | |||
1635 | /* Round 7 */ | ||
1636 | movl 56(%ebp), %eax | ||
1637 | xorl %ebx, %ebx | ||
1638 | movl 60(%ebp), %edx | ||
1639 | xorl %edi, %eax | ||
1640 | xorl %edi, %edx | ||
1641 | andl $0xfcfcfcfc, %eax | ||
1642 | andl $0xcfcfcfcf, %edx | ||
1643 | movb %al, %bl | ||
1644 | movb %ah, %cl | ||
1645 | rorl $4, %edx | ||
1646 | movl des_SPtrans(%ebx),%ebp | ||
1647 | movb %dl, %bl | ||
1648 | xorl %ebp, %esi | ||
1649 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1650 | xorl %ebp, %esi | ||
1651 | movb %dh, %cl | ||
1652 | shrl $16, %eax | ||
1653 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1654 | xorl %ebp, %esi | ||
1655 | movb %ah, %bl | ||
1656 | shrl $16, %edx | ||
1657 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1658 | xorl %ebp, %esi | ||
1659 | movl 24(%esp), %ebp | ||
1660 | movb %dh, %cl | ||
1661 | andl $0xff, %eax | ||
1662 | andl $0xff, %edx | ||
1663 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1664 | xorl %ebx, %esi | ||
1665 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1666 | xorl %ebx, %esi | ||
1667 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1668 | xorl %ebx, %esi | ||
1669 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1670 | xorl %ebx, %esi | ||
1671 | |||
1672 | /* Round 8 */ | ||
1673 | movl 64(%ebp), %eax | ||
1674 | xorl %ebx, %ebx | ||
1675 | movl 68(%ebp), %edx | ||
1676 | xorl %esi, %eax | ||
1677 | xorl %esi, %edx | ||
1678 | andl $0xfcfcfcfc, %eax | ||
1679 | andl $0xcfcfcfcf, %edx | ||
1680 | movb %al, %bl | ||
1681 | movb %ah, %cl | ||
1682 | rorl $4, %edx | ||
1683 | movl des_SPtrans(%ebx),%ebp | ||
1684 | movb %dl, %bl | ||
1685 | xorl %ebp, %edi | ||
1686 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1687 | xorl %ebp, %edi | ||
1688 | movb %dh, %cl | ||
1689 | shrl $16, %eax | ||
1690 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1691 | xorl %ebp, %edi | ||
1692 | movb %ah, %bl | ||
1693 | shrl $16, %edx | ||
1694 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1695 | xorl %ebp, %edi | ||
1696 | movl 24(%esp), %ebp | ||
1697 | movb %dh, %cl | ||
1698 | andl $0xff, %eax | ||
1699 | andl $0xff, %edx | ||
1700 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1701 | xorl %ebx, %edi | ||
1702 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1703 | xorl %ebx, %edi | ||
1704 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1705 | xorl %ebx, %edi | ||
1706 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1707 | xorl %ebx, %edi | ||
1708 | |||
1709 | /* Round 9 */ | ||
1710 | movl 72(%ebp), %eax | ||
1711 | xorl %ebx, %ebx | ||
1712 | movl 76(%ebp), %edx | ||
1713 | xorl %edi, %eax | ||
1714 | xorl %edi, %edx | ||
1715 | andl $0xfcfcfcfc, %eax | ||
1716 | andl $0xcfcfcfcf, %edx | ||
1717 | movb %al, %bl | ||
1718 | movb %ah, %cl | ||
1719 | rorl $4, %edx | ||
1720 | movl des_SPtrans(%ebx),%ebp | ||
1721 | movb %dl, %bl | ||
1722 | xorl %ebp, %esi | ||
1723 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1724 | xorl %ebp, %esi | ||
1725 | movb %dh, %cl | ||
1726 | shrl $16, %eax | ||
1727 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1728 | xorl %ebp, %esi | ||
1729 | movb %ah, %bl | ||
1730 | shrl $16, %edx | ||
1731 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1732 | xorl %ebp, %esi | ||
1733 | movl 24(%esp), %ebp | ||
1734 | movb %dh, %cl | ||
1735 | andl $0xff, %eax | ||
1736 | andl $0xff, %edx | ||
1737 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1738 | xorl %ebx, %esi | ||
1739 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1740 | xorl %ebx, %esi | ||
1741 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1742 | xorl %ebx, %esi | ||
1743 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1744 | xorl %ebx, %esi | ||
1745 | |||
1746 | /* Round 10 */ | ||
1747 | movl 80(%ebp), %eax | ||
1748 | xorl %ebx, %ebx | ||
1749 | movl 84(%ebp), %edx | ||
1750 | xorl %esi, %eax | ||
1751 | xorl %esi, %edx | ||
1752 | andl $0xfcfcfcfc, %eax | ||
1753 | andl $0xcfcfcfcf, %edx | ||
1754 | movb %al, %bl | ||
1755 | movb %ah, %cl | ||
1756 | rorl $4, %edx | ||
1757 | movl des_SPtrans(%ebx),%ebp | ||
1758 | movb %dl, %bl | ||
1759 | xorl %ebp, %edi | ||
1760 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1761 | xorl %ebp, %edi | ||
1762 | movb %dh, %cl | ||
1763 | shrl $16, %eax | ||
1764 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1765 | xorl %ebp, %edi | ||
1766 | movb %ah, %bl | ||
1767 | shrl $16, %edx | ||
1768 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1769 | xorl %ebp, %edi | ||
1770 | movl 24(%esp), %ebp | ||
1771 | movb %dh, %cl | ||
1772 | andl $0xff, %eax | ||
1773 | andl $0xff, %edx | ||
1774 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1775 | xorl %ebx, %edi | ||
1776 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1777 | xorl %ebx, %edi | ||
1778 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1779 | xorl %ebx, %edi | ||
1780 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1781 | xorl %ebx, %edi | ||
1782 | |||
1783 | /* Round 11 */ | ||
1784 | movl 88(%ebp), %eax | ||
1785 | xorl %ebx, %ebx | ||
1786 | movl 92(%ebp), %edx | ||
1787 | xorl %edi, %eax | ||
1788 | xorl %edi, %edx | ||
1789 | andl $0xfcfcfcfc, %eax | ||
1790 | andl $0xcfcfcfcf, %edx | ||
1791 | movb %al, %bl | ||
1792 | movb %ah, %cl | ||
1793 | rorl $4, %edx | ||
1794 | movl des_SPtrans(%ebx),%ebp | ||
1795 | movb %dl, %bl | ||
1796 | xorl %ebp, %esi | ||
1797 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1798 | xorl %ebp, %esi | ||
1799 | movb %dh, %cl | ||
1800 | shrl $16, %eax | ||
1801 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1802 | xorl %ebp, %esi | ||
1803 | movb %ah, %bl | ||
1804 | shrl $16, %edx | ||
1805 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1806 | xorl %ebp, %esi | ||
1807 | movl 24(%esp), %ebp | ||
1808 | movb %dh, %cl | ||
1809 | andl $0xff, %eax | ||
1810 | andl $0xff, %edx | ||
1811 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1812 | xorl %ebx, %esi | ||
1813 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1814 | xorl %ebx, %esi | ||
1815 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1816 | xorl %ebx, %esi | ||
1817 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1818 | xorl %ebx, %esi | ||
1819 | |||
1820 | /* Round 12 */ | ||
1821 | movl 96(%ebp), %eax | ||
1822 | xorl %ebx, %ebx | ||
1823 | movl 100(%ebp), %edx | ||
1824 | xorl %esi, %eax | ||
1825 | xorl %esi, %edx | ||
1826 | andl $0xfcfcfcfc, %eax | ||
1827 | andl $0xcfcfcfcf, %edx | ||
1828 | movb %al, %bl | ||
1829 | movb %ah, %cl | ||
1830 | rorl $4, %edx | ||
1831 | movl des_SPtrans(%ebx),%ebp | ||
1832 | movb %dl, %bl | ||
1833 | xorl %ebp, %edi | ||
1834 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1835 | xorl %ebp, %edi | ||
1836 | movb %dh, %cl | ||
1837 | shrl $16, %eax | ||
1838 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1839 | xorl %ebp, %edi | ||
1840 | movb %ah, %bl | ||
1841 | shrl $16, %edx | ||
1842 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1843 | xorl %ebp, %edi | ||
1844 | movl 24(%esp), %ebp | ||
1845 | movb %dh, %cl | ||
1846 | andl $0xff, %eax | ||
1847 | andl $0xff, %edx | ||
1848 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1849 | xorl %ebx, %edi | ||
1850 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1851 | xorl %ebx, %edi | ||
1852 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1853 | xorl %ebx, %edi | ||
1854 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1855 | xorl %ebx, %edi | ||
1856 | |||
1857 | /* Round 13 */ | ||
1858 | movl 104(%ebp), %eax | ||
1859 | xorl %ebx, %ebx | ||
1860 | movl 108(%ebp), %edx | ||
1861 | xorl %edi, %eax | ||
1862 | xorl %edi, %edx | ||
1863 | andl $0xfcfcfcfc, %eax | ||
1864 | andl $0xcfcfcfcf, %edx | ||
1865 | movb %al, %bl | ||
1866 | movb %ah, %cl | ||
1867 | rorl $4, %edx | ||
1868 | movl des_SPtrans(%ebx),%ebp | ||
1869 | movb %dl, %bl | ||
1870 | xorl %ebp, %esi | ||
1871 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1872 | xorl %ebp, %esi | ||
1873 | movb %dh, %cl | ||
1874 | shrl $16, %eax | ||
1875 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1876 | xorl %ebp, %esi | ||
1877 | movb %ah, %bl | ||
1878 | shrl $16, %edx | ||
1879 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1880 | xorl %ebp, %esi | ||
1881 | movl 24(%esp), %ebp | ||
1882 | movb %dh, %cl | ||
1883 | andl $0xff, %eax | ||
1884 | andl $0xff, %edx | ||
1885 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1886 | xorl %ebx, %esi | ||
1887 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1888 | xorl %ebx, %esi | ||
1889 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1890 | xorl %ebx, %esi | ||
1891 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1892 | xorl %ebx, %esi | ||
1893 | |||
1894 | /* Round 14 */ | ||
1895 | movl 112(%ebp), %eax | ||
1896 | xorl %ebx, %ebx | ||
1897 | movl 116(%ebp), %edx | ||
1898 | xorl %esi, %eax | ||
1899 | xorl %esi, %edx | ||
1900 | andl $0xfcfcfcfc, %eax | ||
1901 | andl $0xcfcfcfcf, %edx | ||
1902 | movb %al, %bl | ||
1903 | movb %ah, %cl | ||
1904 | rorl $4, %edx | ||
1905 | movl des_SPtrans(%ebx),%ebp | ||
1906 | movb %dl, %bl | ||
1907 | xorl %ebp, %edi | ||
1908 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1909 | xorl %ebp, %edi | ||
1910 | movb %dh, %cl | ||
1911 | shrl $16, %eax | ||
1912 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1913 | xorl %ebp, %edi | ||
1914 | movb %ah, %bl | ||
1915 | shrl $16, %edx | ||
1916 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1917 | xorl %ebp, %edi | ||
1918 | movl 24(%esp), %ebp | ||
1919 | movb %dh, %cl | ||
1920 | andl $0xff, %eax | ||
1921 | andl $0xff, %edx | ||
1922 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1923 | xorl %ebx, %edi | ||
1924 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1925 | xorl %ebx, %edi | ||
1926 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1927 | xorl %ebx, %edi | ||
1928 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1929 | xorl %ebx, %edi | ||
1930 | |||
1931 | /* Round 15 */ | ||
1932 | movl 120(%ebp), %eax | ||
1933 | xorl %ebx, %ebx | ||
1934 | movl 124(%ebp), %edx | ||
1935 | xorl %edi, %eax | ||
1936 | xorl %edi, %edx | ||
1937 | andl $0xfcfcfcfc, %eax | ||
1938 | andl $0xcfcfcfcf, %edx | ||
1939 | movb %al, %bl | ||
1940 | movb %ah, %cl | ||
1941 | rorl $4, %edx | ||
1942 | movl des_SPtrans(%ebx),%ebp | ||
1943 | movb %dl, %bl | ||
1944 | xorl %ebp, %esi | ||
1945 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1946 | xorl %ebp, %esi | ||
1947 | movb %dh, %cl | ||
1948 | shrl $16, %eax | ||
1949 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1950 | xorl %ebp, %esi | ||
1951 | movb %ah, %bl | ||
1952 | shrl $16, %edx | ||
1953 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1954 | xorl %ebp, %esi | ||
1955 | movl 24(%esp), %ebp | ||
1956 | movb %dh, %cl | ||
1957 | andl $0xff, %eax | ||
1958 | andl $0xff, %edx | ||
1959 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1960 | xorl %ebx, %esi | ||
1961 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1962 | xorl %ebx, %esi | ||
1963 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1964 | xorl %ebx, %esi | ||
1965 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1966 | xorl %ebx, %esi | ||
1967 | jmp .L003end | ||
1968 | .L002start_decrypt: | ||
1969 | |||
1970 | /* Round 15 */ | ||
1971 | movl 120(%ebp), %eax | ||
1972 | xorl %ebx, %ebx | ||
1973 | movl 124(%ebp), %edx | ||
1974 | xorl %esi, %eax | ||
1975 | xorl %esi, %edx | ||
1976 | andl $0xfcfcfcfc, %eax | ||
1977 | andl $0xcfcfcfcf, %edx | ||
1978 | movb %al, %bl | ||
1979 | movb %ah, %cl | ||
1980 | rorl $4, %edx | ||
1981 | movl des_SPtrans(%ebx),%ebp | ||
1982 | movb %dl, %bl | ||
1983 | xorl %ebp, %edi | ||
1984 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1985 | xorl %ebp, %edi | ||
1986 | movb %dh, %cl | ||
1987 | shrl $16, %eax | ||
1988 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1989 | xorl %ebp, %edi | ||
1990 | movb %ah, %bl | ||
1991 | shrl $16, %edx | ||
1992 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1993 | xorl %ebp, %edi | ||
1994 | movl 24(%esp), %ebp | ||
1995 | movb %dh, %cl | ||
1996 | andl $0xff, %eax | ||
1997 | andl $0xff, %edx | ||
1998 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1999 | xorl %ebx, %edi | ||
2000 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2001 | xorl %ebx, %edi | ||
2002 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2003 | xorl %ebx, %edi | ||
2004 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2005 | xorl %ebx, %edi | ||
2006 | |||
2007 | /* Round 14 */ | ||
2008 | movl 112(%ebp), %eax | ||
2009 | xorl %ebx, %ebx | ||
2010 | movl 116(%ebp), %edx | ||
2011 | xorl %edi, %eax | ||
2012 | xorl %edi, %edx | ||
2013 | andl $0xfcfcfcfc, %eax | ||
2014 | andl $0xcfcfcfcf, %edx | ||
2015 | movb %al, %bl | ||
2016 | movb %ah, %cl | ||
2017 | rorl $4, %edx | ||
2018 | movl des_SPtrans(%ebx),%ebp | ||
2019 | movb %dl, %bl | ||
2020 | xorl %ebp, %esi | ||
2021 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2022 | xorl %ebp, %esi | ||
2023 | movb %dh, %cl | ||
2024 | shrl $16, %eax | ||
2025 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2026 | xorl %ebp, %esi | ||
2027 | movb %ah, %bl | ||
2028 | shrl $16, %edx | ||
2029 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2030 | xorl %ebp, %esi | ||
2031 | movl 24(%esp), %ebp | ||
2032 | movb %dh, %cl | ||
2033 | andl $0xff, %eax | ||
2034 | andl $0xff, %edx | ||
2035 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2036 | xorl %ebx, %esi | ||
2037 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2038 | xorl %ebx, %esi | ||
2039 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2040 | xorl %ebx, %esi | ||
2041 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2042 | xorl %ebx, %esi | ||
2043 | |||
2044 | /* Round 13 */ | ||
2045 | movl 104(%ebp), %eax | ||
2046 | xorl %ebx, %ebx | ||
2047 | movl 108(%ebp), %edx | ||
2048 | xorl %esi, %eax | ||
2049 | xorl %esi, %edx | ||
2050 | andl $0xfcfcfcfc, %eax | ||
2051 | andl $0xcfcfcfcf, %edx | ||
2052 | movb %al, %bl | ||
2053 | movb %ah, %cl | ||
2054 | rorl $4, %edx | ||
2055 | movl des_SPtrans(%ebx),%ebp | ||
2056 | movb %dl, %bl | ||
2057 | xorl %ebp, %edi | ||
2058 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2059 | xorl %ebp, %edi | ||
2060 | movb %dh, %cl | ||
2061 | shrl $16, %eax | ||
2062 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2063 | xorl %ebp, %edi | ||
2064 | movb %ah, %bl | ||
2065 | shrl $16, %edx | ||
2066 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2067 | xorl %ebp, %edi | ||
2068 | movl 24(%esp), %ebp | ||
2069 | movb %dh, %cl | ||
2070 | andl $0xff, %eax | ||
2071 | andl $0xff, %edx | ||
2072 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2073 | xorl %ebx, %edi | ||
2074 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2075 | xorl %ebx, %edi | ||
2076 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2077 | xorl %ebx, %edi | ||
2078 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2079 | xorl %ebx, %edi | ||
2080 | |||
2081 | /* Round 12 */ | ||
2082 | movl 96(%ebp), %eax | ||
2083 | xorl %ebx, %ebx | ||
2084 | movl 100(%ebp), %edx | ||
2085 | xorl %edi, %eax | ||
2086 | xorl %edi, %edx | ||
2087 | andl $0xfcfcfcfc, %eax | ||
2088 | andl $0xcfcfcfcf, %edx | ||
2089 | movb %al, %bl | ||
2090 | movb %ah, %cl | ||
2091 | rorl $4, %edx | ||
2092 | movl des_SPtrans(%ebx),%ebp | ||
2093 | movb %dl, %bl | ||
2094 | xorl %ebp, %esi | ||
2095 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2096 | xorl %ebp, %esi | ||
2097 | movb %dh, %cl | ||
2098 | shrl $16, %eax | ||
2099 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2100 | xorl %ebp, %esi | ||
2101 | movb %ah, %bl | ||
2102 | shrl $16, %edx | ||
2103 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2104 | xorl %ebp, %esi | ||
2105 | movl 24(%esp), %ebp | ||
2106 | movb %dh, %cl | ||
2107 | andl $0xff, %eax | ||
2108 | andl $0xff, %edx | ||
2109 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2110 | xorl %ebx, %esi | ||
2111 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2112 | xorl %ebx, %esi | ||
2113 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2114 | xorl %ebx, %esi | ||
2115 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2116 | xorl %ebx, %esi | ||
2117 | |||
2118 | /* Round 11 */ | ||
2119 | movl 88(%ebp), %eax | ||
2120 | xorl %ebx, %ebx | ||
2121 | movl 92(%ebp), %edx | ||
2122 | xorl %esi, %eax | ||
2123 | xorl %esi, %edx | ||
2124 | andl $0xfcfcfcfc, %eax | ||
2125 | andl $0xcfcfcfcf, %edx | ||
2126 | movb %al, %bl | ||
2127 | movb %ah, %cl | ||
2128 | rorl $4, %edx | ||
2129 | movl des_SPtrans(%ebx),%ebp | ||
2130 | movb %dl, %bl | ||
2131 | xorl %ebp, %edi | ||
2132 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2133 | xorl %ebp, %edi | ||
2134 | movb %dh, %cl | ||
2135 | shrl $16, %eax | ||
2136 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2137 | xorl %ebp, %edi | ||
2138 | movb %ah, %bl | ||
2139 | shrl $16, %edx | ||
2140 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2141 | xorl %ebp, %edi | ||
2142 | movl 24(%esp), %ebp | ||
2143 | movb %dh, %cl | ||
2144 | andl $0xff, %eax | ||
2145 | andl $0xff, %edx | ||
2146 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2147 | xorl %ebx, %edi | ||
2148 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2149 | xorl %ebx, %edi | ||
2150 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2151 | xorl %ebx, %edi | ||
2152 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2153 | xorl %ebx, %edi | ||
2154 | |||
2155 | /* Round 10 */ | ||
2156 | movl 80(%ebp), %eax | ||
2157 | xorl %ebx, %ebx | ||
2158 | movl 84(%ebp), %edx | ||
2159 | xorl %edi, %eax | ||
2160 | xorl %edi, %edx | ||
2161 | andl $0xfcfcfcfc, %eax | ||
2162 | andl $0xcfcfcfcf, %edx | ||
2163 | movb %al, %bl | ||
2164 | movb %ah, %cl | ||
2165 | rorl $4, %edx | ||
2166 | movl des_SPtrans(%ebx),%ebp | ||
2167 | movb %dl, %bl | ||
2168 | xorl %ebp, %esi | ||
2169 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2170 | xorl %ebp, %esi | ||
2171 | movb %dh, %cl | ||
2172 | shrl $16, %eax | ||
2173 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2174 | xorl %ebp, %esi | ||
2175 | movb %ah, %bl | ||
2176 | shrl $16, %edx | ||
2177 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2178 | xorl %ebp, %esi | ||
2179 | movl 24(%esp), %ebp | ||
2180 | movb %dh, %cl | ||
2181 | andl $0xff, %eax | ||
2182 | andl $0xff, %edx | ||
2183 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2184 | xorl %ebx, %esi | ||
2185 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2186 | xorl %ebx, %esi | ||
2187 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2188 | xorl %ebx, %esi | ||
2189 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2190 | xorl %ebx, %esi | ||
2191 | |||
2192 | /* Round 9 */ | ||
2193 | movl 72(%ebp), %eax | ||
2194 | xorl %ebx, %ebx | ||
2195 | movl 76(%ebp), %edx | ||
2196 | xorl %esi, %eax | ||
2197 | xorl %esi, %edx | ||
2198 | andl $0xfcfcfcfc, %eax | ||
2199 | andl $0xcfcfcfcf, %edx | ||
2200 | movb %al, %bl | ||
2201 | movb %ah, %cl | ||
2202 | rorl $4, %edx | ||
2203 | movl des_SPtrans(%ebx),%ebp | ||
2204 | movb %dl, %bl | ||
2205 | xorl %ebp, %edi | ||
2206 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2207 | xorl %ebp, %edi | ||
2208 | movb %dh, %cl | ||
2209 | shrl $16, %eax | ||
2210 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2211 | xorl %ebp, %edi | ||
2212 | movb %ah, %bl | ||
2213 | shrl $16, %edx | ||
2214 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2215 | xorl %ebp, %edi | ||
2216 | movl 24(%esp), %ebp | ||
2217 | movb %dh, %cl | ||
2218 | andl $0xff, %eax | ||
2219 | andl $0xff, %edx | ||
2220 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2221 | xorl %ebx, %edi | ||
2222 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2223 | xorl %ebx, %edi | ||
2224 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2225 | xorl %ebx, %edi | ||
2226 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2227 | xorl %ebx, %edi | ||
2228 | |||
2229 | /* Round 8 */ | ||
2230 | movl 64(%ebp), %eax | ||
2231 | xorl %ebx, %ebx | ||
2232 | movl 68(%ebp), %edx | ||
2233 | xorl %edi, %eax | ||
2234 | xorl %edi, %edx | ||
2235 | andl $0xfcfcfcfc, %eax | ||
2236 | andl $0xcfcfcfcf, %edx | ||
2237 | movb %al, %bl | ||
2238 | movb %ah, %cl | ||
2239 | rorl $4, %edx | ||
2240 | movl des_SPtrans(%ebx),%ebp | ||
2241 | movb %dl, %bl | ||
2242 | xorl %ebp, %esi | ||
2243 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2244 | xorl %ebp, %esi | ||
2245 | movb %dh, %cl | ||
2246 | shrl $16, %eax | ||
2247 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2248 | xorl %ebp, %esi | ||
2249 | movb %ah, %bl | ||
2250 | shrl $16, %edx | ||
2251 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2252 | xorl %ebp, %esi | ||
2253 | movl 24(%esp), %ebp | ||
2254 | movb %dh, %cl | ||
2255 | andl $0xff, %eax | ||
2256 | andl $0xff, %edx | ||
2257 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2258 | xorl %ebx, %esi | ||
2259 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2260 | xorl %ebx, %esi | ||
2261 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2262 | xorl %ebx, %esi | ||
2263 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2264 | xorl %ebx, %esi | ||
2265 | |||
2266 | /* Round 7 */ | ||
2267 | movl 56(%ebp), %eax | ||
2268 | xorl %ebx, %ebx | ||
2269 | movl 60(%ebp), %edx | ||
2270 | xorl %esi, %eax | ||
2271 | xorl %esi, %edx | ||
2272 | andl $0xfcfcfcfc, %eax | ||
2273 | andl $0xcfcfcfcf, %edx | ||
2274 | movb %al, %bl | ||
2275 | movb %ah, %cl | ||
2276 | rorl $4, %edx | ||
2277 | movl des_SPtrans(%ebx),%ebp | ||
2278 | movb %dl, %bl | ||
2279 | xorl %ebp, %edi | ||
2280 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2281 | xorl %ebp, %edi | ||
2282 | movb %dh, %cl | ||
2283 | shrl $16, %eax | ||
2284 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2285 | xorl %ebp, %edi | ||
2286 | movb %ah, %bl | ||
2287 | shrl $16, %edx | ||
2288 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2289 | xorl %ebp, %edi | ||
2290 | movl 24(%esp), %ebp | ||
2291 | movb %dh, %cl | ||
2292 | andl $0xff, %eax | ||
2293 | andl $0xff, %edx | ||
2294 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2295 | xorl %ebx, %edi | ||
2296 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2297 | xorl %ebx, %edi | ||
2298 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2299 | xorl %ebx, %edi | ||
2300 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2301 | xorl %ebx, %edi | ||
2302 | |||
2303 | /* Round 6 */ | ||
2304 | movl 48(%ebp), %eax | ||
2305 | xorl %ebx, %ebx | ||
2306 | movl 52(%ebp), %edx | ||
2307 | xorl %edi, %eax | ||
2308 | xorl %edi, %edx | ||
2309 | andl $0xfcfcfcfc, %eax | ||
2310 | andl $0xcfcfcfcf, %edx | ||
2311 | movb %al, %bl | ||
2312 | movb %ah, %cl | ||
2313 | rorl $4, %edx | ||
2314 | movl des_SPtrans(%ebx),%ebp | ||
2315 | movb %dl, %bl | ||
2316 | xorl %ebp, %esi | ||
2317 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2318 | xorl %ebp, %esi | ||
2319 | movb %dh, %cl | ||
2320 | shrl $16, %eax | ||
2321 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2322 | xorl %ebp, %esi | ||
2323 | movb %ah, %bl | ||
2324 | shrl $16, %edx | ||
2325 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2326 | xorl %ebp, %esi | ||
2327 | movl 24(%esp), %ebp | ||
2328 | movb %dh, %cl | ||
2329 | andl $0xff, %eax | ||
2330 | andl $0xff, %edx | ||
2331 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2332 | xorl %ebx, %esi | ||
2333 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2334 | xorl %ebx, %esi | ||
2335 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2336 | xorl %ebx, %esi | ||
2337 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2338 | xorl %ebx, %esi | ||
2339 | |||
2340 | /* Round 5 */ | ||
2341 | movl 40(%ebp), %eax | ||
2342 | xorl %ebx, %ebx | ||
2343 | movl 44(%ebp), %edx | ||
2344 | xorl %esi, %eax | ||
2345 | xorl %esi, %edx | ||
2346 | andl $0xfcfcfcfc, %eax | ||
2347 | andl $0xcfcfcfcf, %edx | ||
2348 | movb %al, %bl | ||
2349 | movb %ah, %cl | ||
2350 | rorl $4, %edx | ||
2351 | movl des_SPtrans(%ebx),%ebp | ||
2352 | movb %dl, %bl | ||
2353 | xorl %ebp, %edi | ||
2354 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2355 | xorl %ebp, %edi | ||
2356 | movb %dh, %cl | ||
2357 | shrl $16, %eax | ||
2358 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2359 | xorl %ebp, %edi | ||
2360 | movb %ah, %bl | ||
2361 | shrl $16, %edx | ||
2362 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2363 | xorl %ebp, %edi | ||
2364 | movl 24(%esp), %ebp | ||
2365 | movb %dh, %cl | ||
2366 | andl $0xff, %eax | ||
2367 | andl $0xff, %edx | ||
2368 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2369 | xorl %ebx, %edi | ||
2370 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2371 | xorl %ebx, %edi | ||
2372 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2373 | xorl %ebx, %edi | ||
2374 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2375 | xorl %ebx, %edi | ||
2376 | |||
2377 | /* Round 4 */ | ||
2378 | movl 32(%ebp), %eax | ||
2379 | xorl %ebx, %ebx | ||
2380 | movl 36(%ebp), %edx | ||
2381 | xorl %edi, %eax | ||
2382 | xorl %edi, %edx | ||
2383 | andl $0xfcfcfcfc, %eax | ||
2384 | andl $0xcfcfcfcf, %edx | ||
2385 | movb %al, %bl | ||
2386 | movb %ah, %cl | ||
2387 | rorl $4, %edx | ||
2388 | movl des_SPtrans(%ebx),%ebp | ||
2389 | movb %dl, %bl | ||
2390 | xorl %ebp, %esi | ||
2391 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2392 | xorl %ebp, %esi | ||
2393 | movb %dh, %cl | ||
2394 | shrl $16, %eax | ||
2395 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2396 | xorl %ebp, %esi | ||
2397 | movb %ah, %bl | ||
2398 | shrl $16, %edx | ||
2399 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2400 | xorl %ebp, %esi | ||
2401 | movl 24(%esp), %ebp | ||
2402 | movb %dh, %cl | ||
2403 | andl $0xff, %eax | ||
2404 | andl $0xff, %edx | ||
2405 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2406 | xorl %ebx, %esi | ||
2407 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2408 | xorl %ebx, %esi | ||
2409 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2410 | xorl %ebx, %esi | ||
2411 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2412 | xorl %ebx, %esi | ||
2413 | |||
2414 | /* Round 3 */ | ||
2415 | movl 24(%ebp), %eax | ||
2416 | xorl %ebx, %ebx | ||
2417 | movl 28(%ebp), %edx | ||
2418 | xorl %esi, %eax | ||
2419 | xorl %esi, %edx | ||
2420 | andl $0xfcfcfcfc, %eax | ||
2421 | andl $0xcfcfcfcf, %edx | ||
2422 | movb %al, %bl | ||
2423 | movb %ah, %cl | ||
2424 | rorl $4, %edx | ||
2425 | movl des_SPtrans(%ebx),%ebp | ||
2426 | movb %dl, %bl | ||
2427 | xorl %ebp, %edi | ||
2428 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2429 | xorl %ebp, %edi | ||
2430 | movb %dh, %cl | ||
2431 | shrl $16, %eax | ||
2432 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2433 | xorl %ebp, %edi | ||
2434 | movb %ah, %bl | ||
2435 | shrl $16, %edx | ||
2436 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2437 | xorl %ebp, %edi | ||
2438 | movl 24(%esp), %ebp | ||
2439 | movb %dh, %cl | ||
2440 | andl $0xff, %eax | ||
2441 | andl $0xff, %edx | ||
2442 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2443 | xorl %ebx, %edi | ||
2444 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2445 | xorl %ebx, %edi | ||
2446 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2447 | xorl %ebx, %edi | ||
2448 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2449 | xorl %ebx, %edi | ||
2450 | |||
2451 | /* Round 2 */ | ||
2452 | movl 16(%ebp), %eax | ||
2453 | xorl %ebx, %ebx | ||
2454 | movl 20(%ebp), %edx | ||
2455 | xorl %edi, %eax | ||
2456 | xorl %edi, %edx | ||
2457 | andl $0xfcfcfcfc, %eax | ||
2458 | andl $0xcfcfcfcf, %edx | ||
2459 | movb %al, %bl | ||
2460 | movb %ah, %cl | ||
2461 | rorl $4, %edx | ||
2462 | movl des_SPtrans(%ebx),%ebp | ||
2463 | movb %dl, %bl | ||
2464 | xorl %ebp, %esi | ||
2465 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2466 | xorl %ebp, %esi | ||
2467 | movb %dh, %cl | ||
2468 | shrl $16, %eax | ||
2469 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2470 | xorl %ebp, %esi | ||
2471 | movb %ah, %bl | ||
2472 | shrl $16, %edx | ||
2473 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2474 | xorl %ebp, %esi | ||
2475 | movl 24(%esp), %ebp | ||
2476 | movb %dh, %cl | ||
2477 | andl $0xff, %eax | ||
2478 | andl $0xff, %edx | ||
2479 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2480 | xorl %ebx, %esi | ||
2481 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2482 | xorl %ebx, %esi | ||
2483 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2484 | xorl %ebx, %esi | ||
2485 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2486 | xorl %ebx, %esi | ||
2487 | |||
2488 | /* Round 1 */ | ||
2489 | movl 8(%ebp), %eax | ||
2490 | xorl %ebx, %ebx | ||
2491 | movl 12(%ebp), %edx | ||
2492 | xorl %esi, %eax | ||
2493 | xorl %esi, %edx | ||
2494 | andl $0xfcfcfcfc, %eax | ||
2495 | andl $0xcfcfcfcf, %edx | ||
2496 | movb %al, %bl | ||
2497 | movb %ah, %cl | ||
2498 | rorl $4, %edx | ||
2499 | movl des_SPtrans(%ebx),%ebp | ||
2500 | movb %dl, %bl | ||
2501 | xorl %ebp, %edi | ||
2502 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2503 | xorl %ebp, %edi | ||
2504 | movb %dh, %cl | ||
2505 | shrl $16, %eax | ||
2506 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2507 | xorl %ebp, %edi | ||
2508 | movb %ah, %bl | ||
2509 | shrl $16, %edx | ||
2510 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2511 | xorl %ebp, %edi | ||
2512 | movl 24(%esp), %ebp | ||
2513 | movb %dh, %cl | ||
2514 | andl $0xff, %eax | ||
2515 | andl $0xff, %edx | ||
2516 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2517 | xorl %ebx, %edi | ||
2518 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2519 | xorl %ebx, %edi | ||
2520 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2521 | xorl %ebx, %edi | ||
2522 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2523 | xorl %ebx, %edi | ||
2524 | |||
2525 | /* Round 0 */ | ||
2526 | movl (%ebp), %eax | ||
2527 | xorl %ebx, %ebx | ||
2528 | movl 4(%ebp), %edx | ||
2529 | xorl %edi, %eax | ||
2530 | xorl %edi, %edx | ||
2531 | andl $0xfcfcfcfc, %eax | ||
2532 | andl $0xcfcfcfcf, %edx | ||
2533 | movb %al, %bl | ||
2534 | movb %ah, %cl | ||
2535 | rorl $4, %edx | ||
2536 | movl des_SPtrans(%ebx),%ebp | ||
2537 | movb %dl, %bl | ||
2538 | xorl %ebp, %esi | ||
2539 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2540 | xorl %ebp, %esi | ||
2541 | movb %dh, %cl | ||
2542 | shrl $16, %eax | ||
2543 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2544 | xorl %ebp, %esi | ||
2545 | movb %ah, %bl | ||
2546 | shrl $16, %edx | ||
2547 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2548 | xorl %ebp, %esi | ||
2549 | movl 24(%esp), %ebp | ||
2550 | movb %dh, %cl | ||
2551 | andl $0xff, %eax | ||
2552 | andl $0xff, %edx | ||
2553 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2554 | xorl %ebx, %esi | ||
2555 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2556 | xorl %ebx, %esi | ||
2557 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2558 | xorl %ebx, %esi | ||
2559 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2560 | xorl %ebx, %esi | ||
2561 | .L003end: | ||
2562 | |||
2563 | /* Fixup */ | ||
2564 | rorl $3, %edi | ||
2565 | movl 20(%esp), %eax | ||
2566 | rorl $3, %esi | ||
2567 | movl %edi, (%eax) | ||
2568 | movl %esi, 4(%eax) | ||
2569 | popl %ebp | ||
2570 | popl %ebx | ||
2571 | popl %edi | ||
2572 | popl %esi | ||
2573 | ret | ||
2574 | .des_encrypt2_end: | ||
2575 | SIZE(des_encrypt2,.des_encrypt2_end-des_encrypt2) | ||
2576 | .ident "desasm.pl" | ||
2577 | .text | ||
2578 | .align ALIGN | ||
2579 | .globl des_encrypt3 | ||
2580 | TYPE(des_encrypt3,@function) | ||
2581 | des_encrypt3: | ||
2582 | pushl %ebx | ||
2583 | movl 8(%esp), %ebx | ||
2584 | pushl %ebp | ||
2585 | pushl %esi | ||
2586 | pushl %edi | ||
2587 | |||
2588 | /* Load the data words */ | ||
2589 | movl (%ebx), %edi | ||
2590 | movl 4(%ebx), %esi | ||
2591 | subl $12, %esp | ||
2592 | |||
2593 | /* IP */ | ||
2594 | roll $4, %edi | ||
2595 | movl %edi, %edx | ||
2596 | xorl %esi, %edi | ||
2597 | andl $0xf0f0f0f0, %edi | ||
2598 | xorl %edi, %edx | ||
2599 | xorl %edi, %esi | ||
2600 | |||
2601 | roll $20, %esi | ||
2602 | movl %esi, %edi | ||
2603 | xorl %edx, %esi | ||
2604 | andl $0xfff0000f, %esi | ||
2605 | xorl %esi, %edi | ||
2606 | xorl %esi, %edx | ||
2607 | |||
2608 | roll $14, %edi | ||
2609 | movl %edi, %esi | ||
2610 | xorl %edx, %edi | ||
2611 | andl $0x33333333, %edi | ||
2612 | xorl %edi, %esi | ||
2613 | xorl %edi, %edx | ||
2614 | |||
2615 | roll $22, %edx | ||
2616 | movl %edx, %edi | ||
2617 | xorl %esi, %edx | ||
2618 | andl $0x03fc03fc, %edx | ||
2619 | xorl %edx, %edi | ||
2620 | xorl %edx, %esi | ||
2621 | |||
2622 | roll $9, %edi | ||
2623 | movl %edi, %edx | ||
2624 | xorl %esi, %edi | ||
2625 | andl $0xaaaaaaaa, %edi | ||
2626 | xorl %edi, %edx | ||
2627 | xorl %edi, %esi | ||
2628 | |||
2629 | rorl $3, %edx | ||
2630 | rorl $2, %esi | ||
2631 | movl %esi, 4(%ebx) | ||
2632 | movl 36(%esp), %eax | ||
2633 | movl %edx, (%ebx) | ||
2634 | movl 40(%esp), %edi | ||
2635 | movl 44(%esp), %esi | ||
2636 | movl $1, 8(%esp) | ||
2637 | movl %eax, 4(%esp) | ||
2638 | movl %ebx, (%esp) | ||
2639 | call des_encrypt2 | ||
2640 | movl $0, 8(%esp) | ||
2641 | movl %edi, 4(%esp) | ||
2642 | movl %ebx, (%esp) | ||
2643 | call des_encrypt2 | ||
2644 | movl $1, 8(%esp) | ||
2645 | movl %esi, 4(%esp) | ||
2646 | movl %ebx, (%esp) | ||
2647 | call des_encrypt2 | ||
2648 | addl $12, %esp | ||
2649 | movl (%ebx), %edi | ||
2650 | movl 4(%ebx), %esi | ||
2651 | |||
2652 | /* FP */ | ||
2653 | roll $2, %esi | ||
2654 | roll $3, %edi | ||
2655 | movl %edi, %eax | ||
2656 | xorl %esi, %edi | ||
2657 | andl $0xaaaaaaaa, %edi | ||
2658 | xorl %edi, %eax | ||
2659 | xorl %edi, %esi | ||
2660 | |||
2661 | roll $23, %eax | ||
2662 | movl %eax, %edi | ||
2663 | xorl %esi, %eax | ||
2664 | andl $0x03fc03fc, %eax | ||
2665 | xorl %eax, %edi | ||
2666 | xorl %eax, %esi | ||
2667 | |||
2668 | roll $10, %edi | ||
2669 | movl %edi, %eax | ||
2670 | xorl %esi, %edi | ||
2671 | andl $0x33333333, %edi | ||
2672 | xorl %edi, %eax | ||
2673 | xorl %edi, %esi | ||
2674 | |||
2675 | roll $18, %esi | ||
2676 | movl %esi, %edi | ||
2677 | xorl %eax, %esi | ||
2678 | andl $0xfff0000f, %esi | ||
2679 | xorl %esi, %edi | ||
2680 | xorl %esi, %eax | ||
2681 | |||
2682 | roll $12, %edi | ||
2683 | movl %edi, %esi | ||
2684 | xorl %eax, %edi | ||
2685 | andl $0xf0f0f0f0, %edi | ||
2686 | xorl %edi, %esi | ||
2687 | xorl %edi, %eax | ||
2688 | |||
2689 | rorl $4, %eax | ||
2690 | movl %eax, (%ebx) | ||
2691 | movl %esi, 4(%ebx) | ||
2692 | popl %edi | ||
2693 | popl %esi | ||
2694 | popl %ebp | ||
2695 | popl %ebx | ||
2696 | ret | ||
2697 | .des_encrypt3_end: | ||
2698 | SIZE(des_encrypt3,.des_encrypt3_end-des_encrypt3) | ||
2699 | .ident "desasm.pl" | ||
2700 | .text | ||
2701 | .align ALIGN | ||
2702 | .globl des_decrypt3 | ||
2703 | TYPE(des_decrypt3,@function) | ||
2704 | des_decrypt3: | ||
2705 | pushl %ebx | ||
2706 | movl 8(%esp), %ebx | ||
2707 | pushl %ebp | ||
2708 | pushl %esi | ||
2709 | pushl %edi | ||
2710 | |||
2711 | /* Load the data words */ | ||
2712 | movl (%ebx), %edi | ||
2713 | movl 4(%ebx), %esi | ||
2714 | subl $12, %esp | ||
2715 | |||
2716 | /* IP */ | ||
2717 | roll $4, %edi | ||
2718 | movl %edi, %edx | ||
2719 | xorl %esi, %edi | ||
2720 | andl $0xf0f0f0f0, %edi | ||
2721 | xorl %edi, %edx | ||
2722 | xorl %edi, %esi | ||
2723 | |||
2724 | roll $20, %esi | ||
2725 | movl %esi, %edi | ||
2726 | xorl %edx, %esi | ||
2727 | andl $0xfff0000f, %esi | ||
2728 | xorl %esi, %edi | ||
2729 | xorl %esi, %edx | ||
2730 | |||
2731 | roll $14, %edi | ||
2732 | movl %edi, %esi | ||
2733 | xorl %edx, %edi | ||
2734 | andl $0x33333333, %edi | ||
2735 | xorl %edi, %esi | ||
2736 | xorl %edi, %edx | ||
2737 | |||
2738 | roll $22, %edx | ||
2739 | movl %edx, %edi | ||
2740 | xorl %esi, %edx | ||
2741 | andl $0x03fc03fc, %edx | ||
2742 | xorl %edx, %edi | ||
2743 | xorl %edx, %esi | ||
2744 | |||
2745 | roll $9, %edi | ||
2746 | movl %edi, %edx | ||
2747 | xorl %esi, %edi | ||
2748 | andl $0xaaaaaaaa, %edi | ||
2749 | xorl %edi, %edx | ||
2750 | xorl %edi, %esi | ||
2751 | |||
2752 | rorl $3, %edx | ||
2753 | rorl $2, %esi | ||
2754 | movl %esi, 4(%ebx) | ||
2755 | movl 36(%esp), %esi | ||
2756 | movl %edx, (%ebx) | ||
2757 | movl 40(%esp), %edi | ||
2758 | movl 44(%esp), %eax | ||
2759 | movl $0, 8(%esp) | ||
2760 | movl %eax, 4(%esp) | ||
2761 | movl %ebx, (%esp) | ||
2762 | call des_encrypt2 | ||
2763 | movl $1, 8(%esp) | ||
2764 | movl %edi, 4(%esp) | ||
2765 | movl %ebx, (%esp) | ||
2766 | call des_encrypt2 | ||
2767 | movl $0, 8(%esp) | ||
2768 | movl %esi, 4(%esp) | ||
2769 | movl %ebx, (%esp) | ||
2770 | call des_encrypt2 | ||
2771 | addl $12, %esp | ||
2772 | movl (%ebx), %edi | ||
2773 | movl 4(%ebx), %esi | ||
2774 | |||
2775 | /* FP */ | ||
2776 | roll $2, %esi | ||
2777 | roll $3, %edi | ||
2778 | movl %edi, %eax | ||
2779 | xorl %esi, %edi | ||
2780 | andl $0xaaaaaaaa, %edi | ||
2781 | xorl %edi, %eax | ||
2782 | xorl %edi, %esi | ||
2783 | |||
2784 | roll $23, %eax | ||
2785 | movl %eax, %edi | ||
2786 | xorl %esi, %eax | ||
2787 | andl $0x03fc03fc, %eax | ||
2788 | xorl %eax, %edi | ||
2789 | xorl %eax, %esi | ||
2790 | |||
2791 | roll $10, %edi | ||
2792 | movl %edi, %eax | ||
2793 | xorl %esi, %edi | ||
2794 | andl $0x33333333, %edi | ||
2795 | xorl %edi, %eax | ||
2796 | xorl %edi, %esi | ||
2797 | |||
2798 | roll $18, %esi | ||
2799 | movl %esi, %edi | ||
2800 | xorl %eax, %esi | ||
2801 | andl $0xfff0000f, %esi | ||
2802 | xorl %esi, %edi | ||
2803 | xorl %esi, %eax | ||
2804 | |||
2805 | roll $12, %edi | ||
2806 | movl %edi, %esi | ||
2807 | xorl %eax, %edi | ||
2808 | andl $0xf0f0f0f0, %edi | ||
2809 | xorl %edi, %esi | ||
2810 | xorl %edi, %eax | ||
2811 | |||
2812 | rorl $4, %eax | ||
2813 | movl %eax, (%ebx) | ||
2814 | movl %esi, 4(%ebx) | ||
2815 | popl %edi | ||
2816 | popl %esi | ||
2817 | popl %ebp | ||
2818 | popl %ebx | ||
2819 | ret | ||
2820 | .des_decrypt3_end: | ||
2821 | SIZE(des_decrypt3,.des_decrypt3_end-des_decrypt3) | ||
2822 | .ident "desasm.pl" | ||
2823 | .text | ||
2824 | .align ALIGN | ||
2825 | .globl des_ncbc_encrypt | ||
2826 | TYPE(des_ncbc_encrypt,@function) | ||
2827 | des_ncbc_encrypt: | ||
2828 | |||
2829 | pushl %ebp | ||
2830 | pushl %ebx | ||
2831 | pushl %esi | ||
2832 | pushl %edi | ||
2833 | movl 28(%esp), %ebp | ||
2834 | /* getting iv ptr from parameter 4 */ | ||
2835 | movl 36(%esp), %ebx | ||
2836 | movl (%ebx), %esi | ||
2837 | movl 4(%ebx), %edi | ||
2838 | pushl %edi | ||
2839 | pushl %esi | ||
2840 | pushl %edi | ||
2841 | pushl %esi | ||
2842 | movl %esp, %ebx | ||
2843 | movl 36(%esp), %esi | ||
2844 | movl 40(%esp), %edi | ||
2845 | /* getting encrypt flag from parameter 5 */ | ||
2846 | movl 56(%esp), %ecx | ||
2847 | /* get and push parameter 5 */ | ||
2848 | pushl %ecx | ||
2849 | /* get and push parameter 3 */ | ||
2850 | movl 52(%esp), %eax | ||
2851 | pushl %eax | ||
2852 | pushl %ebx | ||
2853 | cmpl $0, %ecx | ||
2854 | jz .L004decrypt | ||
2855 | andl $4294967288, %ebp | ||
2856 | movl 12(%esp), %eax | ||
2857 | movl 16(%esp), %ebx | ||
2858 | jz .L005encrypt_finish | ||
2859 | .L006encrypt_loop: | ||
2860 | movl (%esi), %ecx | ||
2861 | movl 4(%esi), %edx | ||
2862 | xorl %ecx, %eax | ||
2863 | xorl %edx, %ebx | ||
2864 | movl %eax, 12(%esp) | ||
2865 | movl %ebx, 16(%esp) | ||
2866 | call des_encrypt | ||
2867 | movl 12(%esp), %eax | ||
2868 | movl 16(%esp), %ebx | ||
2869 | movl %eax, (%edi) | ||
2870 | movl %ebx, 4(%edi) | ||
2871 | addl $8, %esi | ||
2872 | addl $8, %edi | ||
2873 | subl $8, %ebp | ||
2874 | jnz .L006encrypt_loop | ||
2875 | .L005encrypt_finish: | ||
2876 | movl 56(%esp), %ebp | ||
2877 | andl $7, %ebp | ||
2878 | jz .L007finish | ||
2879 | xorl %ecx, %ecx | ||
2880 | xorl %edx, %edx | ||
2881 | movl .L008cbc_enc_jmp_table(,%ebp,4),%ebp | ||
2882 | jmp *%ebp | ||
2883 | .L009ej7: | ||
2884 | movb 6(%esi), %dh | ||
2885 | sall $8, %edx | ||
2886 | .L010ej6: | ||
2887 | movb 5(%esi), %dh | ||
2888 | .L011ej5: | ||
2889 | movb 4(%esi), %dl | ||
2890 | .L012ej4: | ||
2891 | movl (%esi), %ecx | ||
2892 | jmp .L013ejend | ||
2893 | .L014ej3: | ||
2894 | movb 2(%esi), %ch | ||
2895 | sall $8, %ecx | ||
2896 | .L015ej2: | ||
2897 | movb 1(%esi), %ch | ||
2898 | .L016ej1: | ||
2899 | movb (%esi), %cl | ||
2900 | .L013ejend: | ||
2901 | xorl %ecx, %eax | ||
2902 | xorl %edx, %ebx | ||
2903 | movl %eax, 12(%esp) | ||
2904 | movl %ebx, 16(%esp) | ||
2905 | call des_encrypt | ||
2906 | movl 12(%esp), %eax | ||
2907 | movl 16(%esp), %ebx | ||
2908 | movl %eax, (%edi) | ||
2909 | movl %ebx, 4(%edi) | ||
2910 | jmp .L007finish | ||
2911 | .align ALIGN | ||
2912 | .L004decrypt: | ||
2913 | andl $4294967288, %ebp | ||
2914 | movl 20(%esp), %eax | ||
2915 | movl 24(%esp), %ebx | ||
2916 | jz .L017decrypt_finish | ||
2917 | .L018decrypt_loop: | ||
2918 | movl (%esi), %eax | ||
2919 | movl 4(%esi), %ebx | ||
2920 | movl %eax, 12(%esp) | ||
2921 | movl %ebx, 16(%esp) | ||
2922 | call des_encrypt | ||
2923 | movl 12(%esp), %eax | ||
2924 | movl 16(%esp), %ebx | ||
2925 | movl 20(%esp), %ecx | ||
2926 | movl 24(%esp), %edx | ||
2927 | xorl %eax, %ecx | ||
2928 | xorl %ebx, %edx | ||
2929 | movl (%esi), %eax | ||
2930 | movl 4(%esi), %ebx | ||
2931 | movl %ecx, (%edi) | ||
2932 | movl %edx, 4(%edi) | ||
2933 | movl %eax, 20(%esp) | ||
2934 | movl %ebx, 24(%esp) | ||
2935 | addl $8, %esi | ||
2936 | addl $8, %edi | ||
2937 | subl $8, %ebp | ||
2938 | jnz .L018decrypt_loop | ||
2939 | .L017decrypt_finish: | ||
2940 | movl 56(%esp), %ebp | ||
2941 | andl $7, %ebp | ||
2942 | jz .L007finish | ||
2943 | movl (%esi), %eax | ||
2944 | movl 4(%esi), %ebx | ||
2945 | movl %eax, 12(%esp) | ||
2946 | movl %ebx, 16(%esp) | ||
2947 | call des_encrypt | ||
2948 | movl 12(%esp), %eax | ||
2949 | movl 16(%esp), %ebx | ||
2950 | movl 20(%esp), %ecx | ||
2951 | movl 24(%esp), %edx | ||
2952 | xorl %eax, %ecx | ||
2953 | xorl %ebx, %edx | ||
2954 | movl (%esi), %eax | ||
2955 | movl 4(%esi), %ebx | ||
2956 | .L019dj7: | ||
2957 | rorl $16, %edx | ||
2958 | movb %dl, 6(%edi) | ||
2959 | shrl $16, %edx | ||
2960 | .L020dj6: | ||
2961 | movb %dh, 5(%edi) | ||
2962 | .L021dj5: | ||
2963 | movb %dl, 4(%edi) | ||
2964 | .L022dj4: | ||
2965 | movl %ecx, (%edi) | ||
2966 | jmp .L023djend | ||
2967 | .L024dj3: | ||
2968 | rorl $16, %ecx | ||
2969 | movb %cl, 2(%edi) | ||
2970 | sall $16, %ecx | ||
2971 | .L025dj2: | ||
2972 | movb %ch, 1(%esi) | ||
2973 | .L026dj1: | ||
2974 | movb %cl, (%esi) | ||
2975 | .L023djend: | ||
2976 | jmp .L007finish | ||
2977 | .align ALIGN | ||
2978 | .L007finish: | ||
2979 | movl 64(%esp), %ecx | ||
2980 | addl $28, %esp | ||
2981 | movl %eax, (%ecx) | ||
2982 | movl %ebx, 4(%ecx) | ||
2983 | popl %edi | ||
2984 | popl %esi | ||
2985 | popl %ebx | ||
2986 | popl %ebp | ||
2987 | ret | ||
2988 | .align ALIGN | ||
2989 | .L008cbc_enc_jmp_table: | ||
2990 | .long 0 | ||
2991 | .long .L016ej1 | ||
2992 | .long .L015ej2 | ||
2993 | .long .L014ej3 | ||
2994 | .long .L012ej4 | ||
2995 | .long .L011ej5 | ||
2996 | .long .L010ej6 | ||
2997 | .long .L009ej7 | ||
2998 | .align ALIGN | ||
2999 | .L027cbc_dec_jmp_table: | ||
3000 | .long 0 | ||
3001 | .long .L026dj1 | ||
3002 | .long .L025dj2 | ||
3003 | .long .L024dj3 | ||
3004 | .long .L022dj4 | ||
3005 | .long .L021dj5 | ||
3006 | .long .L020dj6 | ||
3007 | .long .L019dj7 | ||
3008 | .des_ncbc_encrypt_end: | ||
3009 | SIZE(des_ncbc_encrypt,.des_ncbc_encrypt_end-des_ncbc_encrypt) | ||
3010 | .ident "desasm.pl" | ||
3011 | .text | ||
3012 | .align ALIGN | ||
3013 | .globl des_ede3_cbc_encrypt | ||
3014 | TYPE(des_ede3_cbc_encrypt,@function) | ||
3015 | des_ede3_cbc_encrypt: | ||
3016 | |||
3017 | pushl %ebp | ||
3018 | pushl %ebx | ||
3019 | pushl %esi | ||
3020 | pushl %edi | ||
3021 | movl 28(%esp), %ebp | ||
3022 | /* getting iv ptr from parameter 6 */ | ||
3023 | movl 44(%esp), %ebx | ||
3024 | movl (%ebx), %esi | ||
3025 | movl 4(%ebx), %edi | ||
3026 | pushl %edi | ||
3027 | pushl %esi | ||
3028 | pushl %edi | ||
3029 | pushl %esi | ||
3030 | movl %esp, %ebx | ||
3031 | movl 36(%esp), %esi | ||
3032 | movl 40(%esp), %edi | ||
3033 | /* getting encrypt flag from parameter 7 */ | ||
3034 | movl 64(%esp), %ecx | ||
3035 | /* get and push parameter 5 */ | ||
3036 | movl 56(%esp), %eax | ||
3037 | pushl %eax | ||
3038 | /* get and push parameter 4 */ | ||
3039 | movl 56(%esp), %eax | ||
3040 | pushl %eax | ||
3041 | /* get and push parameter 3 */ | ||
3042 | movl 56(%esp), %eax | ||
3043 | pushl %eax | ||
3044 | pushl %ebx | ||
3045 | cmpl $0, %ecx | ||
3046 | jz .L028decrypt | ||
3047 | andl $4294967288, %ebp | ||
3048 | movl 16(%esp), %eax | ||
3049 | movl 20(%esp), %ebx | ||
3050 | jz .L029encrypt_finish | ||
3051 | .L030encrypt_loop: | ||
3052 | movl (%esi), %ecx | ||
3053 | movl 4(%esi), %edx | ||
3054 | xorl %ecx, %eax | ||
3055 | xorl %edx, %ebx | ||
3056 | movl %eax, 16(%esp) | ||
3057 | movl %ebx, 20(%esp) | ||
3058 | call des_encrypt3 | ||
3059 | movl 16(%esp), %eax | ||
3060 | movl 20(%esp), %ebx | ||
3061 | movl %eax, (%edi) | ||
3062 | movl %ebx, 4(%edi) | ||
3063 | addl $8, %esi | ||
3064 | addl $8, %edi | ||
3065 | subl $8, %ebp | ||
3066 | jnz .L030encrypt_loop | ||
3067 | .L029encrypt_finish: | ||
3068 | movl 60(%esp), %ebp | ||
3069 | andl $7, %ebp | ||
3070 | jz .L031finish | ||
3071 | xorl %ecx, %ecx | ||
3072 | xorl %edx, %edx | ||
3073 | movl .L032cbc_enc_jmp_table(,%ebp,4),%ebp | ||
3074 | jmp *%ebp | ||
3075 | .L033ej7: | ||
3076 | movb 6(%esi), %dh | ||
3077 | sall $8, %edx | ||
3078 | .L034ej6: | ||
3079 | movb 5(%esi), %dh | ||
3080 | .L035ej5: | ||
3081 | movb 4(%esi), %dl | ||
3082 | .L036ej4: | ||
3083 | movl (%esi), %ecx | ||
3084 | jmp .L037ejend | ||
3085 | .L038ej3: | ||
3086 | movb 2(%esi), %ch | ||
3087 | sall $8, %ecx | ||
3088 | .L039ej2: | ||
3089 | movb 1(%esi), %ch | ||
3090 | .L040ej1: | ||
3091 | movb (%esi), %cl | ||
3092 | .L037ejend: | ||
3093 | xorl %ecx, %eax | ||
3094 | xorl %edx, %ebx | ||
3095 | movl %eax, 16(%esp) | ||
3096 | movl %ebx, 20(%esp) | ||
3097 | call des_encrypt3 | ||
3098 | movl 16(%esp), %eax | ||
3099 | movl 20(%esp), %ebx | ||
3100 | movl %eax, (%edi) | ||
3101 | movl %ebx, 4(%edi) | ||
3102 | jmp .L031finish | ||
3103 | .align ALIGN | ||
3104 | .L028decrypt: | ||
3105 | andl $4294967288, %ebp | ||
3106 | movl 24(%esp), %eax | ||
3107 | movl 28(%esp), %ebx | ||
3108 | jz .L041decrypt_finish | ||
3109 | .L042decrypt_loop: | ||
3110 | movl (%esi), %eax | ||
3111 | movl 4(%esi), %ebx | ||
3112 | movl %eax, 16(%esp) | ||
3113 | movl %ebx, 20(%esp) | ||
3114 | call des_decrypt3 | ||
3115 | movl 16(%esp), %eax | ||
3116 | movl 20(%esp), %ebx | ||
3117 | movl 24(%esp), %ecx | ||
3118 | movl 28(%esp), %edx | ||
3119 | xorl %eax, %ecx | ||
3120 | xorl %ebx, %edx | ||
3121 | movl (%esi), %eax | ||
3122 | movl 4(%esi), %ebx | ||
3123 | movl %ecx, (%edi) | ||
3124 | movl %edx, 4(%edi) | ||
3125 | movl %eax, 24(%esp) | ||
3126 | movl %ebx, 28(%esp) | ||
3127 | addl $8, %esi | ||
3128 | addl $8, %edi | ||
3129 | subl $8, %ebp | ||
3130 | jnz .L042decrypt_loop | ||
3131 | .L041decrypt_finish: | ||
3132 | movl 60(%esp), %ebp | ||
3133 | andl $7, %ebp | ||
3134 | jz .L031finish | ||
3135 | movl (%esi), %eax | ||
3136 | movl 4(%esi), %ebx | ||
3137 | movl %eax, 16(%esp) | ||
3138 | movl %ebx, 20(%esp) | ||
3139 | call des_decrypt3 | ||
3140 | movl 16(%esp), %eax | ||
3141 | movl 20(%esp), %ebx | ||
3142 | movl 24(%esp), %ecx | ||
3143 | movl 28(%esp), %edx | ||
3144 | xorl %eax, %ecx | ||
3145 | xorl %ebx, %edx | ||
3146 | movl (%esi), %eax | ||
3147 | movl 4(%esi), %ebx | ||
3148 | .L043dj7: | ||
3149 | rorl $16, %edx | ||
3150 | movb %dl, 6(%edi) | ||
3151 | shrl $16, %edx | ||
3152 | .L044dj6: | ||
3153 | movb %dh, 5(%edi) | ||
3154 | .L045dj5: | ||
3155 | movb %dl, 4(%edi) | ||
3156 | .L046dj4: | ||
3157 | movl %ecx, (%edi) | ||
3158 | jmp .L047djend | ||
3159 | .L048dj3: | ||
3160 | rorl $16, %ecx | ||
3161 | movb %cl, 2(%edi) | ||
3162 | sall $16, %ecx | ||
3163 | .L049dj2: | ||
3164 | movb %ch, 1(%esi) | ||
3165 | .L050dj1: | ||
3166 | movb %cl, (%esi) | ||
3167 | .L047djend: | ||
3168 | jmp .L031finish | ||
3169 | .align ALIGN | ||
3170 | .L031finish: | ||
3171 | movl 76(%esp), %ecx | ||
3172 | addl $32, %esp | ||
3173 | movl %eax, (%ecx) | ||
3174 | movl %ebx, 4(%ecx) | ||
3175 | popl %edi | ||
3176 | popl %esi | ||
3177 | popl %ebx | ||
3178 | popl %ebp | ||
3179 | ret | ||
3180 | .align ALIGN | ||
3181 | .L032cbc_enc_jmp_table: | ||
3182 | .long 0 | ||
3183 | .long .L040ej1 | ||
3184 | .long .L039ej2 | ||
3185 | .long .L038ej3 | ||
3186 | .long .L036ej4 | ||
3187 | .long .L035ej5 | ||
3188 | .long .L034ej6 | ||
3189 | .long .L033ej7 | ||
3190 | .align ALIGN | ||
3191 | .L051cbc_dec_jmp_table: | ||
3192 | .long 0 | ||
3193 | .long .L050dj1 | ||
3194 | .long .L049dj2 | ||
3195 | .long .L048dj3 | ||
3196 | .long .L046dj4 | ||
3197 | .long .L045dj5 | ||
3198 | .long .L044dj6 | ||
3199 | .long .L043dj7 | ||
3200 | .des_ede3_cbc_encrypt_end: | ||
3201 | SIZE(des_ede3_cbc_encrypt,.des_ede3_cbc_encrypt_end-des_ede3_cbc_encrypt) | ||
3202 | .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 @@ | |||
1 | ; Don't even think of reading this code | ||
2 | ; It was automatically generated by crypt586.pl | ||
3 | ; Which is a perl program used to generate the x86 assember for | ||
4 | ; any of elf, a.out, BSDI,Win32, or Solaris | ||
5 | ; eric <eay@cryptsoft.com> | ||
6 | ; | ||
7 | TITLE crypt586.asm | ||
8 | .386 | ||
9 | .model FLAT | ||
10 | _TEXT SEGMENT | ||
11 | PUBLIC _fcrypt_body | ||
12 | EXTRN _des_SPtrans:DWORD | ||
13 | _fcrypt_body PROC NEAR | ||
14 | push ebp | ||
15 | push ebx | ||
16 | push esi | ||
17 | push edi | ||
18 | ; | ||
19 | ; Load the 2 words | ||
20 | xor edi, edi | ||
21 | xor esi, esi | ||
22 | mov ebp, DWORD PTR 24[esp] | ||
23 | push 25 | ||
24 | L000start: | ||
25 | ; | ||
26 | ; Round 0 | ||
27 | mov eax, DWORD PTR 32[esp] | ||
28 | mov edx, esi | ||
29 | shr edx, 16 | ||
30 | mov ecx, DWORD PTR 36[esp] | ||
31 | xor edx, esi | ||
32 | and eax, edx | ||
33 | and edx, ecx | ||
34 | mov ebx, eax | ||
35 | shl ebx, 16 | ||
36 | mov ecx, edx | ||
37 | shl ecx, 16 | ||
38 | xor eax, ebx | ||
39 | xor edx, ecx | ||
40 | mov ebx, DWORD PTR [ebp] | ||
41 | xor eax, ebx | ||
42 | mov ecx, DWORD PTR 4[ebp] | ||
43 | xor eax, esi | ||
44 | xor edx, esi | ||
45 | xor edx, ecx | ||
46 | and eax, 0fcfcfcfch | ||
47 | xor ebx, ebx | ||
48 | and edx, 0cfcfcfcfh | ||
49 | xor ecx, ecx | ||
50 | mov bl, al | ||
51 | mov cl, ah | ||
52 | ror edx, 4 | ||
53 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
54 | mov bl, dl | ||
55 | xor edi, ebp | ||
56 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
57 | xor edi, ebp | ||
58 | mov cl, dh | ||
59 | shr eax, 16 | ||
60 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
61 | xor edi, ebp | ||
62 | mov bl, ah | ||
63 | shr edx, 16 | ||
64 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
65 | xor edi, ebp | ||
66 | mov ebp, DWORD PTR 28[esp] | ||
67 | mov cl, dh | ||
68 | and eax, 0ffh | ||
69 | and edx, 0ffh | ||
70 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
71 | xor edi, ebx | ||
72 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
73 | xor edi, ebx | ||
74 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
75 | xor edi, ebx | ||
76 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
77 | xor edi, ebx | ||
78 | ; | ||
79 | ; Round 1 | ||
80 | mov eax, DWORD PTR 32[esp] | ||
81 | mov edx, edi | ||
82 | shr edx, 16 | ||
83 | mov ecx, DWORD PTR 36[esp] | ||
84 | xor edx, edi | ||
85 | and eax, edx | ||
86 | and edx, ecx | ||
87 | mov ebx, eax | ||
88 | shl ebx, 16 | ||
89 | mov ecx, edx | ||
90 | shl ecx, 16 | ||
91 | xor eax, ebx | ||
92 | xor edx, ecx | ||
93 | mov ebx, DWORD PTR 8[ebp] | ||
94 | xor eax, ebx | ||
95 | mov ecx, DWORD PTR 12[ebp] | ||
96 | xor eax, edi | ||
97 | xor edx, edi | ||
98 | xor edx, ecx | ||
99 | and eax, 0fcfcfcfch | ||
100 | xor ebx, ebx | ||
101 | and edx, 0cfcfcfcfh | ||
102 | xor ecx, ecx | ||
103 | mov bl, al | ||
104 | mov cl, ah | ||
105 | ror edx, 4 | ||
106 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
107 | mov bl, dl | ||
108 | xor esi, ebp | ||
109 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
110 | xor esi, ebp | ||
111 | mov cl, dh | ||
112 | shr eax, 16 | ||
113 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
114 | xor esi, ebp | ||
115 | mov bl, ah | ||
116 | shr edx, 16 | ||
117 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
118 | xor esi, ebp | ||
119 | mov ebp, DWORD PTR 28[esp] | ||
120 | mov cl, dh | ||
121 | and eax, 0ffh | ||
122 | and edx, 0ffh | ||
123 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
124 | xor esi, ebx | ||
125 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
126 | xor esi, ebx | ||
127 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
128 | xor esi, ebx | ||
129 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
130 | xor esi, ebx | ||
131 | ; | ||
132 | ; Round 2 | ||
133 | mov eax, DWORD PTR 32[esp] | ||
134 | mov edx, esi | ||
135 | shr edx, 16 | ||
136 | mov ecx, DWORD PTR 36[esp] | ||
137 | xor edx, esi | ||
138 | and eax, edx | ||
139 | and edx, ecx | ||
140 | mov ebx, eax | ||
141 | shl ebx, 16 | ||
142 | mov ecx, edx | ||
143 | shl ecx, 16 | ||
144 | xor eax, ebx | ||
145 | xor edx, ecx | ||
146 | mov ebx, DWORD PTR 16[ebp] | ||
147 | xor eax, ebx | ||
148 | mov ecx, DWORD PTR 20[ebp] | ||
149 | xor eax, esi | ||
150 | xor edx, esi | ||
151 | xor edx, ecx | ||
152 | and eax, 0fcfcfcfch | ||
153 | xor ebx, ebx | ||
154 | and edx, 0cfcfcfcfh | ||
155 | xor ecx, ecx | ||
156 | mov bl, al | ||
157 | mov cl, ah | ||
158 | ror edx, 4 | ||
159 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
160 | mov bl, dl | ||
161 | xor edi, ebp | ||
162 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
163 | xor edi, ebp | ||
164 | mov cl, dh | ||
165 | shr eax, 16 | ||
166 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
167 | xor edi, ebp | ||
168 | mov bl, ah | ||
169 | shr edx, 16 | ||
170 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
171 | xor edi, ebp | ||
172 | mov ebp, DWORD PTR 28[esp] | ||
173 | mov cl, dh | ||
174 | and eax, 0ffh | ||
175 | and edx, 0ffh | ||
176 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
177 | xor edi, ebx | ||
178 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
179 | xor edi, ebx | ||
180 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
181 | xor edi, ebx | ||
182 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
183 | xor edi, ebx | ||
184 | ; | ||
185 | ; Round 3 | ||
186 | mov eax, DWORD PTR 32[esp] | ||
187 | mov edx, edi | ||
188 | shr edx, 16 | ||
189 | mov ecx, DWORD PTR 36[esp] | ||
190 | xor edx, edi | ||
191 | and eax, edx | ||
192 | and edx, ecx | ||
193 | mov ebx, eax | ||
194 | shl ebx, 16 | ||
195 | mov ecx, edx | ||
196 | shl ecx, 16 | ||
197 | xor eax, ebx | ||
198 | xor edx, ecx | ||
199 | mov ebx, DWORD PTR 24[ebp] | ||
200 | xor eax, ebx | ||
201 | mov ecx, DWORD PTR 28[ebp] | ||
202 | xor eax, edi | ||
203 | xor edx, edi | ||
204 | xor edx, ecx | ||
205 | and eax, 0fcfcfcfch | ||
206 | xor ebx, ebx | ||
207 | and edx, 0cfcfcfcfh | ||
208 | xor ecx, ecx | ||
209 | mov bl, al | ||
210 | mov cl, ah | ||
211 | ror edx, 4 | ||
212 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
213 | mov bl, dl | ||
214 | xor esi, ebp | ||
215 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
216 | xor esi, ebp | ||
217 | mov cl, dh | ||
218 | shr eax, 16 | ||
219 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
220 | xor esi, ebp | ||
221 | mov bl, ah | ||
222 | shr edx, 16 | ||
223 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
224 | xor esi, ebp | ||
225 | mov ebp, DWORD PTR 28[esp] | ||
226 | mov cl, dh | ||
227 | and eax, 0ffh | ||
228 | and edx, 0ffh | ||
229 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
230 | xor esi, ebx | ||
231 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
232 | xor esi, ebx | ||
233 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
234 | xor esi, ebx | ||
235 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
236 | xor esi, ebx | ||
237 | ; | ||
238 | ; Round 4 | ||
239 | mov eax, DWORD PTR 32[esp] | ||
240 | mov edx, esi | ||
241 | shr edx, 16 | ||
242 | mov ecx, DWORD PTR 36[esp] | ||
243 | xor edx, esi | ||
244 | and eax, edx | ||
245 | and edx, ecx | ||
246 | mov ebx, eax | ||
247 | shl ebx, 16 | ||
248 | mov ecx, edx | ||
249 | shl ecx, 16 | ||
250 | xor eax, ebx | ||
251 | xor edx, ecx | ||
252 | mov ebx, DWORD PTR 32[ebp] | ||
253 | xor eax, ebx | ||
254 | mov ecx, DWORD PTR 36[ebp] | ||
255 | xor eax, esi | ||
256 | xor edx, esi | ||
257 | xor edx, ecx | ||
258 | and eax, 0fcfcfcfch | ||
259 | xor ebx, ebx | ||
260 | and edx, 0cfcfcfcfh | ||
261 | xor ecx, ecx | ||
262 | mov bl, al | ||
263 | mov cl, ah | ||
264 | ror edx, 4 | ||
265 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
266 | mov bl, dl | ||
267 | xor edi, ebp | ||
268 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
269 | xor edi, ebp | ||
270 | mov cl, dh | ||
271 | shr eax, 16 | ||
272 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
273 | xor edi, ebp | ||
274 | mov bl, ah | ||
275 | shr edx, 16 | ||
276 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
277 | xor edi, ebp | ||
278 | mov ebp, DWORD PTR 28[esp] | ||
279 | mov cl, dh | ||
280 | and eax, 0ffh | ||
281 | and edx, 0ffh | ||
282 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
283 | xor edi, ebx | ||
284 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
285 | xor edi, ebx | ||
286 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
287 | xor edi, ebx | ||
288 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
289 | xor edi, ebx | ||
290 | ; | ||
291 | ; Round 5 | ||
292 | mov eax, DWORD PTR 32[esp] | ||
293 | mov edx, edi | ||
294 | shr edx, 16 | ||
295 | mov ecx, DWORD PTR 36[esp] | ||
296 | xor edx, edi | ||
297 | and eax, edx | ||
298 | and edx, ecx | ||
299 | mov ebx, eax | ||
300 | shl ebx, 16 | ||
301 | mov ecx, edx | ||
302 | shl ecx, 16 | ||
303 | xor eax, ebx | ||
304 | xor edx, ecx | ||
305 | mov ebx, DWORD PTR 40[ebp] | ||
306 | xor eax, ebx | ||
307 | mov ecx, DWORD PTR 44[ebp] | ||
308 | xor eax, edi | ||
309 | xor edx, edi | ||
310 | xor edx, ecx | ||
311 | and eax, 0fcfcfcfch | ||
312 | xor ebx, ebx | ||
313 | and edx, 0cfcfcfcfh | ||
314 | xor ecx, ecx | ||
315 | mov bl, al | ||
316 | mov cl, ah | ||
317 | ror edx, 4 | ||
318 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
319 | mov bl, dl | ||
320 | xor esi, ebp | ||
321 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
322 | xor esi, ebp | ||
323 | mov cl, dh | ||
324 | shr eax, 16 | ||
325 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
326 | xor esi, ebp | ||
327 | mov bl, ah | ||
328 | shr edx, 16 | ||
329 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
330 | xor esi, ebp | ||
331 | mov ebp, DWORD PTR 28[esp] | ||
332 | mov cl, dh | ||
333 | and eax, 0ffh | ||
334 | and edx, 0ffh | ||
335 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
336 | xor esi, ebx | ||
337 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
338 | xor esi, ebx | ||
339 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
340 | xor esi, ebx | ||
341 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
342 | xor esi, ebx | ||
343 | ; | ||
344 | ; Round 6 | ||
345 | mov eax, DWORD PTR 32[esp] | ||
346 | mov edx, esi | ||
347 | shr edx, 16 | ||
348 | mov ecx, DWORD PTR 36[esp] | ||
349 | xor edx, esi | ||
350 | and eax, edx | ||
351 | and edx, ecx | ||
352 | mov ebx, eax | ||
353 | shl ebx, 16 | ||
354 | mov ecx, edx | ||
355 | shl ecx, 16 | ||
356 | xor eax, ebx | ||
357 | xor edx, ecx | ||
358 | mov ebx, DWORD PTR 48[ebp] | ||
359 | xor eax, ebx | ||
360 | mov ecx, DWORD PTR 52[ebp] | ||
361 | xor eax, esi | ||
362 | xor edx, esi | ||
363 | xor edx, ecx | ||
364 | and eax, 0fcfcfcfch | ||
365 | xor ebx, ebx | ||
366 | and edx, 0cfcfcfcfh | ||
367 | xor ecx, ecx | ||
368 | mov bl, al | ||
369 | mov cl, ah | ||
370 | ror edx, 4 | ||
371 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
372 | mov bl, dl | ||
373 | xor edi, ebp | ||
374 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
375 | xor edi, ebp | ||
376 | mov cl, dh | ||
377 | shr eax, 16 | ||
378 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
379 | xor edi, ebp | ||
380 | mov bl, ah | ||
381 | shr edx, 16 | ||
382 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
383 | xor edi, ebp | ||
384 | mov ebp, DWORD PTR 28[esp] | ||
385 | mov cl, dh | ||
386 | and eax, 0ffh | ||
387 | and edx, 0ffh | ||
388 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
389 | xor edi, ebx | ||
390 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
391 | xor edi, ebx | ||
392 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
393 | xor edi, ebx | ||
394 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
395 | xor edi, ebx | ||
396 | ; | ||
397 | ; Round 7 | ||
398 | mov eax, DWORD PTR 32[esp] | ||
399 | mov edx, edi | ||
400 | shr edx, 16 | ||
401 | mov ecx, DWORD PTR 36[esp] | ||
402 | xor edx, edi | ||
403 | and eax, edx | ||
404 | and edx, ecx | ||
405 | mov ebx, eax | ||
406 | shl ebx, 16 | ||
407 | mov ecx, edx | ||
408 | shl ecx, 16 | ||
409 | xor eax, ebx | ||
410 | xor edx, ecx | ||
411 | mov ebx, DWORD PTR 56[ebp] | ||
412 | xor eax, ebx | ||
413 | mov ecx, DWORD PTR 60[ebp] | ||
414 | xor eax, edi | ||
415 | xor edx, edi | ||
416 | xor edx, ecx | ||
417 | and eax, 0fcfcfcfch | ||
418 | xor ebx, ebx | ||
419 | and edx, 0cfcfcfcfh | ||
420 | xor ecx, ecx | ||
421 | mov bl, al | ||
422 | mov cl, ah | ||
423 | ror edx, 4 | ||
424 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
425 | mov bl, dl | ||
426 | xor esi, ebp | ||
427 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
428 | xor esi, ebp | ||
429 | mov cl, dh | ||
430 | shr eax, 16 | ||
431 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
432 | xor esi, ebp | ||
433 | mov bl, ah | ||
434 | shr edx, 16 | ||
435 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
436 | xor esi, ebp | ||
437 | mov ebp, DWORD PTR 28[esp] | ||
438 | mov cl, dh | ||
439 | and eax, 0ffh | ||
440 | and edx, 0ffh | ||
441 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
442 | xor esi, ebx | ||
443 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
444 | xor esi, ebx | ||
445 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
446 | xor esi, ebx | ||
447 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
448 | xor esi, ebx | ||
449 | ; | ||
450 | ; Round 8 | ||
451 | mov eax, DWORD PTR 32[esp] | ||
452 | mov edx, esi | ||
453 | shr edx, 16 | ||
454 | mov ecx, DWORD PTR 36[esp] | ||
455 | xor edx, esi | ||
456 | and eax, edx | ||
457 | and edx, ecx | ||
458 | mov ebx, eax | ||
459 | shl ebx, 16 | ||
460 | mov ecx, edx | ||
461 | shl ecx, 16 | ||
462 | xor eax, ebx | ||
463 | xor edx, ecx | ||
464 | mov ebx, DWORD PTR 64[ebp] | ||
465 | xor eax, ebx | ||
466 | mov ecx, DWORD PTR 68[ebp] | ||
467 | xor eax, esi | ||
468 | xor edx, esi | ||
469 | xor edx, ecx | ||
470 | and eax, 0fcfcfcfch | ||
471 | xor ebx, ebx | ||
472 | and edx, 0cfcfcfcfh | ||
473 | xor ecx, ecx | ||
474 | mov bl, al | ||
475 | mov cl, ah | ||
476 | ror edx, 4 | ||
477 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
478 | mov bl, dl | ||
479 | xor edi, ebp | ||
480 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
481 | xor edi, ebp | ||
482 | mov cl, dh | ||
483 | shr eax, 16 | ||
484 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
485 | xor edi, ebp | ||
486 | mov bl, ah | ||
487 | shr edx, 16 | ||
488 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
489 | xor edi, ebp | ||
490 | mov ebp, DWORD PTR 28[esp] | ||
491 | mov cl, dh | ||
492 | and eax, 0ffh | ||
493 | and edx, 0ffh | ||
494 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
495 | xor edi, ebx | ||
496 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
497 | xor edi, ebx | ||
498 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
499 | xor edi, ebx | ||
500 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
501 | xor edi, ebx | ||
502 | ; | ||
503 | ; Round 9 | ||
504 | mov eax, DWORD PTR 32[esp] | ||
505 | mov edx, edi | ||
506 | shr edx, 16 | ||
507 | mov ecx, DWORD PTR 36[esp] | ||
508 | xor edx, edi | ||
509 | and eax, edx | ||
510 | and edx, ecx | ||
511 | mov ebx, eax | ||
512 | shl ebx, 16 | ||
513 | mov ecx, edx | ||
514 | shl ecx, 16 | ||
515 | xor eax, ebx | ||
516 | xor edx, ecx | ||
517 | mov ebx, DWORD PTR 72[ebp] | ||
518 | xor eax, ebx | ||
519 | mov ecx, DWORD PTR 76[ebp] | ||
520 | xor eax, edi | ||
521 | xor edx, edi | ||
522 | xor edx, ecx | ||
523 | and eax, 0fcfcfcfch | ||
524 | xor ebx, ebx | ||
525 | and edx, 0cfcfcfcfh | ||
526 | xor ecx, ecx | ||
527 | mov bl, al | ||
528 | mov cl, ah | ||
529 | ror edx, 4 | ||
530 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
531 | mov bl, dl | ||
532 | xor esi, ebp | ||
533 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
534 | xor esi, ebp | ||
535 | mov cl, dh | ||
536 | shr eax, 16 | ||
537 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
538 | xor esi, ebp | ||
539 | mov bl, ah | ||
540 | shr edx, 16 | ||
541 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
542 | xor esi, ebp | ||
543 | mov ebp, DWORD PTR 28[esp] | ||
544 | mov cl, dh | ||
545 | and eax, 0ffh | ||
546 | and edx, 0ffh | ||
547 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
548 | xor esi, ebx | ||
549 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
550 | xor esi, ebx | ||
551 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
552 | xor esi, ebx | ||
553 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
554 | xor esi, ebx | ||
555 | ; | ||
556 | ; Round 10 | ||
557 | mov eax, DWORD PTR 32[esp] | ||
558 | mov edx, esi | ||
559 | shr edx, 16 | ||
560 | mov ecx, DWORD PTR 36[esp] | ||
561 | xor edx, esi | ||
562 | and eax, edx | ||
563 | and edx, ecx | ||
564 | mov ebx, eax | ||
565 | shl ebx, 16 | ||
566 | mov ecx, edx | ||
567 | shl ecx, 16 | ||
568 | xor eax, ebx | ||
569 | xor edx, ecx | ||
570 | mov ebx, DWORD PTR 80[ebp] | ||
571 | xor eax, ebx | ||
572 | mov ecx, DWORD PTR 84[ebp] | ||
573 | xor eax, esi | ||
574 | xor edx, esi | ||
575 | xor edx, ecx | ||
576 | and eax, 0fcfcfcfch | ||
577 | xor ebx, ebx | ||
578 | and edx, 0cfcfcfcfh | ||
579 | xor ecx, ecx | ||
580 | mov bl, al | ||
581 | mov cl, ah | ||
582 | ror edx, 4 | ||
583 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
584 | mov bl, dl | ||
585 | xor edi, ebp | ||
586 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
587 | xor edi, ebp | ||
588 | mov cl, dh | ||
589 | shr eax, 16 | ||
590 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
591 | xor edi, ebp | ||
592 | mov bl, ah | ||
593 | shr edx, 16 | ||
594 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
595 | xor edi, ebp | ||
596 | mov ebp, DWORD PTR 28[esp] | ||
597 | mov cl, dh | ||
598 | and eax, 0ffh | ||
599 | and edx, 0ffh | ||
600 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
601 | xor edi, ebx | ||
602 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
603 | xor edi, ebx | ||
604 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
605 | xor edi, ebx | ||
606 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
607 | xor edi, ebx | ||
608 | ; | ||
609 | ; Round 11 | ||
610 | mov eax, DWORD PTR 32[esp] | ||
611 | mov edx, edi | ||
612 | shr edx, 16 | ||
613 | mov ecx, DWORD PTR 36[esp] | ||
614 | xor edx, edi | ||
615 | and eax, edx | ||
616 | and edx, ecx | ||
617 | mov ebx, eax | ||
618 | shl ebx, 16 | ||
619 | mov ecx, edx | ||
620 | shl ecx, 16 | ||
621 | xor eax, ebx | ||
622 | xor edx, ecx | ||
623 | mov ebx, DWORD PTR 88[ebp] | ||
624 | xor eax, ebx | ||
625 | mov ecx, DWORD PTR 92[ebp] | ||
626 | xor eax, edi | ||
627 | xor edx, edi | ||
628 | xor edx, ecx | ||
629 | and eax, 0fcfcfcfch | ||
630 | xor ebx, ebx | ||
631 | and edx, 0cfcfcfcfh | ||
632 | xor ecx, ecx | ||
633 | mov bl, al | ||
634 | mov cl, ah | ||
635 | ror edx, 4 | ||
636 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
637 | mov bl, dl | ||
638 | xor esi, ebp | ||
639 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
640 | xor esi, ebp | ||
641 | mov cl, dh | ||
642 | shr eax, 16 | ||
643 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
644 | xor esi, ebp | ||
645 | mov bl, ah | ||
646 | shr edx, 16 | ||
647 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
648 | xor esi, ebp | ||
649 | mov ebp, DWORD PTR 28[esp] | ||
650 | mov cl, dh | ||
651 | and eax, 0ffh | ||
652 | and edx, 0ffh | ||
653 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
654 | xor esi, ebx | ||
655 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
656 | xor esi, ebx | ||
657 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
658 | xor esi, ebx | ||
659 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
660 | xor esi, ebx | ||
661 | ; | ||
662 | ; Round 12 | ||
663 | mov eax, DWORD PTR 32[esp] | ||
664 | mov edx, esi | ||
665 | shr edx, 16 | ||
666 | mov ecx, DWORD PTR 36[esp] | ||
667 | xor edx, esi | ||
668 | and eax, edx | ||
669 | and edx, ecx | ||
670 | mov ebx, eax | ||
671 | shl ebx, 16 | ||
672 | mov ecx, edx | ||
673 | shl ecx, 16 | ||
674 | xor eax, ebx | ||
675 | xor edx, ecx | ||
676 | mov ebx, DWORD PTR 96[ebp] | ||
677 | xor eax, ebx | ||
678 | mov ecx, DWORD PTR 100[ebp] | ||
679 | xor eax, esi | ||
680 | xor edx, esi | ||
681 | xor edx, ecx | ||
682 | and eax, 0fcfcfcfch | ||
683 | xor ebx, ebx | ||
684 | and edx, 0cfcfcfcfh | ||
685 | xor ecx, ecx | ||
686 | mov bl, al | ||
687 | mov cl, ah | ||
688 | ror edx, 4 | ||
689 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
690 | mov bl, dl | ||
691 | xor edi, ebp | ||
692 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
693 | xor edi, ebp | ||
694 | mov cl, dh | ||
695 | shr eax, 16 | ||
696 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
697 | xor edi, ebp | ||
698 | mov bl, ah | ||
699 | shr edx, 16 | ||
700 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
701 | xor edi, ebp | ||
702 | mov ebp, DWORD PTR 28[esp] | ||
703 | mov cl, dh | ||
704 | and eax, 0ffh | ||
705 | and edx, 0ffh | ||
706 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
707 | xor edi, ebx | ||
708 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
709 | xor edi, ebx | ||
710 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
711 | xor edi, ebx | ||
712 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
713 | xor edi, ebx | ||
714 | ; | ||
715 | ; Round 13 | ||
716 | mov eax, DWORD PTR 32[esp] | ||
717 | mov edx, edi | ||
718 | shr edx, 16 | ||
719 | mov ecx, DWORD PTR 36[esp] | ||
720 | xor edx, edi | ||
721 | and eax, edx | ||
722 | and edx, ecx | ||
723 | mov ebx, eax | ||
724 | shl ebx, 16 | ||
725 | mov ecx, edx | ||
726 | shl ecx, 16 | ||
727 | xor eax, ebx | ||
728 | xor edx, ecx | ||
729 | mov ebx, DWORD PTR 104[ebp] | ||
730 | xor eax, ebx | ||
731 | mov ecx, DWORD PTR 108[ebp] | ||
732 | xor eax, edi | ||
733 | xor edx, edi | ||
734 | xor edx, ecx | ||
735 | and eax, 0fcfcfcfch | ||
736 | xor ebx, ebx | ||
737 | and edx, 0cfcfcfcfh | ||
738 | xor ecx, ecx | ||
739 | mov bl, al | ||
740 | mov cl, ah | ||
741 | ror edx, 4 | ||
742 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
743 | mov bl, dl | ||
744 | xor esi, ebp | ||
745 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
746 | xor esi, ebp | ||
747 | mov cl, dh | ||
748 | shr eax, 16 | ||
749 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
750 | xor esi, ebp | ||
751 | mov bl, ah | ||
752 | shr edx, 16 | ||
753 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
754 | xor esi, ebp | ||
755 | mov ebp, DWORD PTR 28[esp] | ||
756 | mov cl, dh | ||
757 | and eax, 0ffh | ||
758 | and edx, 0ffh | ||
759 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
760 | xor esi, ebx | ||
761 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
762 | xor esi, ebx | ||
763 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
764 | xor esi, ebx | ||
765 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
766 | xor esi, ebx | ||
767 | ; | ||
768 | ; Round 14 | ||
769 | mov eax, DWORD PTR 32[esp] | ||
770 | mov edx, esi | ||
771 | shr edx, 16 | ||
772 | mov ecx, DWORD PTR 36[esp] | ||
773 | xor edx, esi | ||
774 | and eax, edx | ||
775 | and edx, ecx | ||
776 | mov ebx, eax | ||
777 | shl ebx, 16 | ||
778 | mov ecx, edx | ||
779 | shl ecx, 16 | ||
780 | xor eax, ebx | ||
781 | xor edx, ecx | ||
782 | mov ebx, DWORD PTR 112[ebp] | ||
783 | xor eax, ebx | ||
784 | mov ecx, DWORD PTR 116[ebp] | ||
785 | xor eax, esi | ||
786 | xor edx, esi | ||
787 | xor edx, ecx | ||
788 | and eax, 0fcfcfcfch | ||
789 | xor ebx, ebx | ||
790 | and edx, 0cfcfcfcfh | ||
791 | xor ecx, ecx | ||
792 | mov bl, al | ||
793 | mov cl, ah | ||
794 | ror edx, 4 | ||
795 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
796 | mov bl, dl | ||
797 | xor edi, ebp | ||
798 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
799 | xor edi, ebp | ||
800 | mov cl, dh | ||
801 | shr eax, 16 | ||
802 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
803 | xor edi, ebp | ||
804 | mov bl, ah | ||
805 | shr edx, 16 | ||
806 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
807 | xor edi, ebp | ||
808 | mov ebp, DWORD PTR 28[esp] | ||
809 | mov cl, dh | ||
810 | and eax, 0ffh | ||
811 | and edx, 0ffh | ||
812 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
813 | xor edi, ebx | ||
814 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
815 | xor edi, ebx | ||
816 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
817 | xor edi, ebx | ||
818 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
819 | xor edi, ebx | ||
820 | ; | ||
821 | ; Round 15 | ||
822 | mov eax, DWORD PTR 32[esp] | ||
823 | mov edx, edi | ||
824 | shr edx, 16 | ||
825 | mov ecx, DWORD PTR 36[esp] | ||
826 | xor edx, edi | ||
827 | and eax, edx | ||
828 | and edx, ecx | ||
829 | mov ebx, eax | ||
830 | shl ebx, 16 | ||
831 | mov ecx, edx | ||
832 | shl ecx, 16 | ||
833 | xor eax, ebx | ||
834 | xor edx, ecx | ||
835 | mov ebx, DWORD PTR 120[ebp] | ||
836 | xor eax, ebx | ||
837 | mov ecx, DWORD PTR 124[ebp] | ||
838 | xor eax, edi | ||
839 | xor edx, edi | ||
840 | xor edx, ecx | ||
841 | and eax, 0fcfcfcfch | ||
842 | xor ebx, ebx | ||
843 | and edx, 0cfcfcfcfh | ||
844 | xor ecx, ecx | ||
845 | mov bl, al | ||
846 | mov cl, ah | ||
847 | ror edx, 4 | ||
848 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
849 | mov bl, dl | ||
850 | xor esi, ebp | ||
851 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
852 | xor esi, ebp | ||
853 | mov cl, dh | ||
854 | shr eax, 16 | ||
855 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
856 | xor esi, ebp | ||
857 | mov bl, ah | ||
858 | shr edx, 16 | ||
859 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
860 | xor esi, ebp | ||
861 | mov ebp, DWORD PTR 28[esp] | ||
862 | mov cl, dh | ||
863 | and eax, 0ffh | ||
864 | and edx, 0ffh | ||
865 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
866 | xor esi, ebx | ||
867 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
868 | xor esi, ebx | ||
869 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
870 | xor esi, ebx | ||
871 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
872 | xor esi, ebx | ||
873 | mov ebx, DWORD PTR [esp] | ||
874 | mov eax, edi | ||
875 | dec ebx | ||
876 | mov edi, esi | ||
877 | mov esi, eax | ||
878 | mov DWORD PTR [esp],ebx | ||
879 | jnz L000start | ||
880 | ; | ||
881 | ; FP | ||
882 | mov edx, DWORD PTR 24[esp] | ||
883 | ror edi, 1 | ||
884 | mov eax, esi | ||
885 | xor esi, edi | ||
886 | and esi, 0aaaaaaaah | ||
887 | xor eax, esi | ||
888 | xor edi, esi | ||
889 | ; | ||
890 | rol eax, 23 | ||
891 | mov esi, eax | ||
892 | xor eax, edi | ||
893 | and eax, 003fc03fch | ||
894 | xor esi, eax | ||
895 | xor edi, eax | ||
896 | ; | ||
897 | rol esi, 10 | ||
898 | mov eax, esi | ||
899 | xor esi, edi | ||
900 | and esi, 033333333h | ||
901 | xor eax, esi | ||
902 | xor edi, esi | ||
903 | ; | ||
904 | rol edi, 18 | ||
905 | mov esi, edi | ||
906 | xor edi, eax | ||
907 | and edi, 0fff0000fh | ||
908 | xor esi, edi | ||
909 | xor eax, edi | ||
910 | ; | ||
911 | rol esi, 12 | ||
912 | mov edi, esi | ||
913 | xor esi, eax | ||
914 | and esi, 0f0f0f0f0h | ||
915 | xor edi, esi | ||
916 | xor eax, esi | ||
917 | ; | ||
918 | ror eax, 4 | ||
919 | mov DWORD PTR [edx],eax | ||
920 | mov DWORD PTR 4[edx],edi | ||
921 | pop ecx | ||
922 | pop edi | ||
923 | pop esi | ||
924 | pop ebx | ||
925 | pop ebp | ||
926 | ret | ||
927 | _fcrypt_body ENDP | ||
928 | _TEXT ENDS | ||
929 | 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 @@ | |||
1 | /* Run the C pre-processor over this file with one of the following defined | ||
2 | * ELF - elf object files, | ||
3 | * OUT - a.out object files, | ||
4 | * BSDI - BSDI style a.out object files | ||
5 | * SOL - Solaris style elf | ||
6 | */ | ||
7 | |||
8 | #define TYPE(a,b) .type a,b | ||
9 | #define SIZE(a,b) .size a,b | ||
10 | |||
11 | #if defined(OUT) || defined(BSDI) | ||
12 | #define des_SPtrans _des_SPtrans | ||
13 | #define fcrypt_body _fcrypt_body | ||
14 | |||
15 | #endif | ||
16 | |||
17 | #ifdef OUT | ||
18 | #define OK 1 | ||
19 | #define ALIGN 4 | ||
20 | #endif | ||
21 | |||
22 | #ifdef BSDI | ||
23 | #define OK 1 | ||
24 | #define ALIGN 4 | ||
25 | #undef SIZE | ||
26 | #undef TYPE | ||
27 | #define SIZE(a,b) | ||
28 | #define TYPE(a,b) | ||
29 | #endif | ||
30 | |||
31 | #if defined(ELF) || defined(SOL) | ||
32 | #define OK 1 | ||
33 | #define ALIGN 16 | ||
34 | #endif | ||
35 | |||
36 | #ifndef OK | ||
37 | You need to define one of | ||
38 | ELF - elf systems - linux-elf, NetBSD and DG-UX | ||
39 | OUT - a.out systems - linux-a.out and FreeBSD | ||
40 | SOL - solaris systems, which are elf with strange comment lines | ||
41 | BSDI - a.out with a very primative version of as. | ||
42 | #endif | ||
43 | |||
44 | /* Let the Assembler begin :-) */ | ||
45 | /* Don't even think of reading this code */ | ||
46 | /* It was automatically generated by crypt586.pl */ | ||
47 | /* Which is a perl program used to generate the x86 assember for */ | ||
48 | /* any of elf, a.out, BSDI,Win32, or Solaris */ | ||
49 | /* eric <eay@cryptsoft.com> */ | ||
50 | |||
51 | .file "crypt586.s" | ||
52 | .version "01.01" | ||
53 | gcc2_compiled.: | ||
54 | .text | ||
55 | .align ALIGN | ||
56 | .globl fcrypt_body | ||
57 | TYPE(fcrypt_body,@function) | ||
58 | fcrypt_body: | ||
59 | pushl %ebp | ||
60 | pushl %ebx | ||
61 | pushl %esi | ||
62 | pushl %edi | ||
63 | |||
64 | |||
65 | /* Load the 2 words */ | ||
66 | xorl %edi, %edi | ||
67 | xorl %esi, %esi | ||
68 | movl 24(%esp), %ebp | ||
69 | pushl $25 | ||
70 | .L000start: | ||
71 | |||
72 | /* Round 0 */ | ||
73 | movl 32(%esp), %eax | ||
74 | movl %esi, %edx | ||
75 | shrl $16, %edx | ||
76 | movl 36(%esp), %ecx | ||
77 | xorl %esi, %edx | ||
78 | andl %edx, %eax | ||
79 | andl %ecx, %edx | ||
80 | movl %eax, %ebx | ||
81 | sall $16, %ebx | ||
82 | movl %edx, %ecx | ||
83 | sall $16, %ecx | ||
84 | xorl %ebx, %eax | ||
85 | xorl %ecx, %edx | ||
86 | movl (%ebp), %ebx | ||
87 | xorl %ebx, %eax | ||
88 | movl 4(%ebp), %ecx | ||
89 | xorl %esi, %eax | ||
90 | xorl %esi, %edx | ||
91 | xorl %ecx, %edx | ||
92 | andl $0xfcfcfcfc, %eax | ||
93 | xorl %ebx, %ebx | ||
94 | andl $0xcfcfcfcf, %edx | ||
95 | xorl %ecx, %ecx | ||
96 | movb %al, %bl | ||
97 | movb %ah, %cl | ||
98 | rorl $4, %edx | ||
99 | movl des_SPtrans(%ebx),%ebp | ||
100 | movb %dl, %bl | ||
101 | xorl %ebp, %edi | ||
102 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
103 | xorl %ebp, %edi | ||
104 | movb %dh, %cl | ||
105 | shrl $16, %eax | ||
106 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
107 | xorl %ebp, %edi | ||
108 | movb %ah, %bl | ||
109 | shrl $16, %edx | ||
110 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
111 | xorl %ebp, %edi | ||
112 | movl 28(%esp), %ebp | ||
113 | movb %dh, %cl | ||
114 | andl $0xff, %eax | ||
115 | andl $0xff, %edx | ||
116 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
117 | xorl %ebx, %edi | ||
118 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
119 | xorl %ebx, %edi | ||
120 | movl 0x400+des_SPtrans(%eax),%ebx | ||
121 | xorl %ebx, %edi | ||
122 | movl 0x500+des_SPtrans(%edx),%ebx | ||
123 | xorl %ebx, %edi | ||
124 | |||
125 | /* Round 1 */ | ||
126 | movl 32(%esp), %eax | ||
127 | movl %edi, %edx | ||
128 | shrl $16, %edx | ||
129 | movl 36(%esp), %ecx | ||
130 | xorl %edi, %edx | ||
131 | andl %edx, %eax | ||
132 | andl %ecx, %edx | ||
133 | movl %eax, %ebx | ||
134 | sall $16, %ebx | ||
135 | movl %edx, %ecx | ||
136 | sall $16, %ecx | ||
137 | xorl %ebx, %eax | ||
138 | xorl %ecx, %edx | ||
139 | movl 8(%ebp), %ebx | ||
140 | xorl %ebx, %eax | ||
141 | movl 12(%ebp), %ecx | ||
142 | xorl %edi, %eax | ||
143 | xorl %edi, %edx | ||
144 | xorl %ecx, %edx | ||
145 | andl $0xfcfcfcfc, %eax | ||
146 | xorl %ebx, %ebx | ||
147 | andl $0xcfcfcfcf, %edx | ||
148 | xorl %ecx, %ecx | ||
149 | movb %al, %bl | ||
150 | movb %ah, %cl | ||
151 | rorl $4, %edx | ||
152 | movl des_SPtrans(%ebx),%ebp | ||
153 | movb %dl, %bl | ||
154 | xorl %ebp, %esi | ||
155 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
156 | xorl %ebp, %esi | ||
157 | movb %dh, %cl | ||
158 | shrl $16, %eax | ||
159 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
160 | xorl %ebp, %esi | ||
161 | movb %ah, %bl | ||
162 | shrl $16, %edx | ||
163 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
164 | xorl %ebp, %esi | ||
165 | movl 28(%esp), %ebp | ||
166 | movb %dh, %cl | ||
167 | andl $0xff, %eax | ||
168 | andl $0xff, %edx | ||
169 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
170 | xorl %ebx, %esi | ||
171 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
172 | xorl %ebx, %esi | ||
173 | movl 0x400+des_SPtrans(%eax),%ebx | ||
174 | xorl %ebx, %esi | ||
175 | movl 0x500+des_SPtrans(%edx),%ebx | ||
176 | xorl %ebx, %esi | ||
177 | |||
178 | /* Round 2 */ | ||
179 | movl 32(%esp), %eax | ||
180 | movl %esi, %edx | ||
181 | shrl $16, %edx | ||
182 | movl 36(%esp), %ecx | ||
183 | xorl %esi, %edx | ||
184 | andl %edx, %eax | ||
185 | andl %ecx, %edx | ||
186 | movl %eax, %ebx | ||
187 | sall $16, %ebx | ||
188 | movl %edx, %ecx | ||
189 | sall $16, %ecx | ||
190 | xorl %ebx, %eax | ||
191 | xorl %ecx, %edx | ||
192 | movl 16(%ebp), %ebx | ||
193 | xorl %ebx, %eax | ||
194 | movl 20(%ebp), %ecx | ||
195 | xorl %esi, %eax | ||
196 | xorl %esi, %edx | ||
197 | xorl %ecx, %edx | ||
198 | andl $0xfcfcfcfc, %eax | ||
199 | xorl %ebx, %ebx | ||
200 | andl $0xcfcfcfcf, %edx | ||
201 | xorl %ecx, %ecx | ||
202 | movb %al, %bl | ||
203 | movb %ah, %cl | ||
204 | rorl $4, %edx | ||
205 | movl des_SPtrans(%ebx),%ebp | ||
206 | movb %dl, %bl | ||
207 | xorl %ebp, %edi | ||
208 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
209 | xorl %ebp, %edi | ||
210 | movb %dh, %cl | ||
211 | shrl $16, %eax | ||
212 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
213 | xorl %ebp, %edi | ||
214 | movb %ah, %bl | ||
215 | shrl $16, %edx | ||
216 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
217 | xorl %ebp, %edi | ||
218 | movl 28(%esp), %ebp | ||
219 | movb %dh, %cl | ||
220 | andl $0xff, %eax | ||
221 | andl $0xff, %edx | ||
222 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
223 | xorl %ebx, %edi | ||
224 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
225 | xorl %ebx, %edi | ||
226 | movl 0x400+des_SPtrans(%eax),%ebx | ||
227 | xorl %ebx, %edi | ||
228 | movl 0x500+des_SPtrans(%edx),%ebx | ||
229 | xorl %ebx, %edi | ||
230 | |||
231 | /* Round 3 */ | ||
232 | movl 32(%esp), %eax | ||
233 | movl %edi, %edx | ||
234 | shrl $16, %edx | ||
235 | movl 36(%esp), %ecx | ||
236 | xorl %edi, %edx | ||
237 | andl %edx, %eax | ||
238 | andl %ecx, %edx | ||
239 | movl %eax, %ebx | ||
240 | sall $16, %ebx | ||
241 | movl %edx, %ecx | ||
242 | sall $16, %ecx | ||
243 | xorl %ebx, %eax | ||
244 | xorl %ecx, %edx | ||
245 | movl 24(%ebp), %ebx | ||
246 | xorl %ebx, %eax | ||
247 | movl 28(%ebp), %ecx | ||
248 | xorl %edi, %eax | ||
249 | xorl %edi, %edx | ||
250 | xorl %ecx, %edx | ||
251 | andl $0xfcfcfcfc, %eax | ||
252 | xorl %ebx, %ebx | ||
253 | andl $0xcfcfcfcf, %edx | ||
254 | xorl %ecx, %ecx | ||
255 | movb %al, %bl | ||
256 | movb %ah, %cl | ||
257 | rorl $4, %edx | ||
258 | movl des_SPtrans(%ebx),%ebp | ||
259 | movb %dl, %bl | ||
260 | xorl %ebp, %esi | ||
261 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
262 | xorl %ebp, %esi | ||
263 | movb %dh, %cl | ||
264 | shrl $16, %eax | ||
265 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
266 | xorl %ebp, %esi | ||
267 | movb %ah, %bl | ||
268 | shrl $16, %edx | ||
269 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
270 | xorl %ebp, %esi | ||
271 | movl 28(%esp), %ebp | ||
272 | movb %dh, %cl | ||
273 | andl $0xff, %eax | ||
274 | andl $0xff, %edx | ||
275 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
276 | xorl %ebx, %esi | ||
277 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
278 | xorl %ebx, %esi | ||
279 | movl 0x400+des_SPtrans(%eax),%ebx | ||
280 | xorl %ebx, %esi | ||
281 | movl 0x500+des_SPtrans(%edx),%ebx | ||
282 | xorl %ebx, %esi | ||
283 | |||
284 | /* Round 4 */ | ||
285 | movl 32(%esp), %eax | ||
286 | movl %esi, %edx | ||
287 | shrl $16, %edx | ||
288 | movl 36(%esp), %ecx | ||
289 | xorl %esi, %edx | ||
290 | andl %edx, %eax | ||
291 | andl %ecx, %edx | ||
292 | movl %eax, %ebx | ||
293 | sall $16, %ebx | ||
294 | movl %edx, %ecx | ||
295 | sall $16, %ecx | ||
296 | xorl %ebx, %eax | ||
297 | xorl %ecx, %edx | ||
298 | movl 32(%ebp), %ebx | ||
299 | xorl %ebx, %eax | ||
300 | movl 36(%ebp), %ecx | ||
301 | xorl %esi, %eax | ||
302 | xorl %esi, %edx | ||
303 | xorl %ecx, %edx | ||
304 | andl $0xfcfcfcfc, %eax | ||
305 | xorl %ebx, %ebx | ||
306 | andl $0xcfcfcfcf, %edx | ||
307 | xorl %ecx, %ecx | ||
308 | movb %al, %bl | ||
309 | movb %ah, %cl | ||
310 | rorl $4, %edx | ||
311 | movl des_SPtrans(%ebx),%ebp | ||
312 | movb %dl, %bl | ||
313 | xorl %ebp, %edi | ||
314 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
315 | xorl %ebp, %edi | ||
316 | movb %dh, %cl | ||
317 | shrl $16, %eax | ||
318 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
319 | xorl %ebp, %edi | ||
320 | movb %ah, %bl | ||
321 | shrl $16, %edx | ||
322 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
323 | xorl %ebp, %edi | ||
324 | movl 28(%esp), %ebp | ||
325 | movb %dh, %cl | ||
326 | andl $0xff, %eax | ||
327 | andl $0xff, %edx | ||
328 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
329 | xorl %ebx, %edi | ||
330 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
331 | xorl %ebx, %edi | ||
332 | movl 0x400+des_SPtrans(%eax),%ebx | ||
333 | xorl %ebx, %edi | ||
334 | movl 0x500+des_SPtrans(%edx),%ebx | ||
335 | xorl %ebx, %edi | ||
336 | |||
337 | /* Round 5 */ | ||
338 | movl 32(%esp), %eax | ||
339 | movl %edi, %edx | ||
340 | shrl $16, %edx | ||
341 | movl 36(%esp), %ecx | ||
342 | xorl %edi, %edx | ||
343 | andl %edx, %eax | ||
344 | andl %ecx, %edx | ||
345 | movl %eax, %ebx | ||
346 | sall $16, %ebx | ||
347 | movl %edx, %ecx | ||
348 | sall $16, %ecx | ||
349 | xorl %ebx, %eax | ||
350 | xorl %ecx, %edx | ||
351 | movl 40(%ebp), %ebx | ||
352 | xorl %ebx, %eax | ||
353 | movl 44(%ebp), %ecx | ||
354 | xorl %edi, %eax | ||
355 | xorl %edi, %edx | ||
356 | xorl %ecx, %edx | ||
357 | andl $0xfcfcfcfc, %eax | ||
358 | xorl %ebx, %ebx | ||
359 | andl $0xcfcfcfcf, %edx | ||
360 | xorl %ecx, %ecx | ||
361 | movb %al, %bl | ||
362 | movb %ah, %cl | ||
363 | rorl $4, %edx | ||
364 | movl des_SPtrans(%ebx),%ebp | ||
365 | movb %dl, %bl | ||
366 | xorl %ebp, %esi | ||
367 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
368 | xorl %ebp, %esi | ||
369 | movb %dh, %cl | ||
370 | shrl $16, %eax | ||
371 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
372 | xorl %ebp, %esi | ||
373 | movb %ah, %bl | ||
374 | shrl $16, %edx | ||
375 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
376 | xorl %ebp, %esi | ||
377 | movl 28(%esp), %ebp | ||
378 | movb %dh, %cl | ||
379 | andl $0xff, %eax | ||
380 | andl $0xff, %edx | ||
381 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
382 | xorl %ebx, %esi | ||
383 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
384 | xorl %ebx, %esi | ||
385 | movl 0x400+des_SPtrans(%eax),%ebx | ||
386 | xorl %ebx, %esi | ||
387 | movl 0x500+des_SPtrans(%edx),%ebx | ||
388 | xorl %ebx, %esi | ||
389 | |||
390 | /* Round 6 */ | ||
391 | movl 32(%esp), %eax | ||
392 | movl %esi, %edx | ||
393 | shrl $16, %edx | ||
394 | movl 36(%esp), %ecx | ||
395 | xorl %esi, %edx | ||
396 | andl %edx, %eax | ||
397 | andl %ecx, %edx | ||
398 | movl %eax, %ebx | ||
399 | sall $16, %ebx | ||
400 | movl %edx, %ecx | ||
401 | sall $16, %ecx | ||
402 | xorl %ebx, %eax | ||
403 | xorl %ecx, %edx | ||
404 | movl 48(%ebp), %ebx | ||
405 | xorl %ebx, %eax | ||
406 | movl 52(%ebp), %ecx | ||
407 | xorl %esi, %eax | ||
408 | xorl %esi, %edx | ||
409 | xorl %ecx, %edx | ||
410 | andl $0xfcfcfcfc, %eax | ||
411 | xorl %ebx, %ebx | ||
412 | andl $0xcfcfcfcf, %edx | ||
413 | xorl %ecx, %ecx | ||
414 | movb %al, %bl | ||
415 | movb %ah, %cl | ||
416 | rorl $4, %edx | ||
417 | movl des_SPtrans(%ebx),%ebp | ||
418 | movb %dl, %bl | ||
419 | xorl %ebp, %edi | ||
420 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
421 | xorl %ebp, %edi | ||
422 | movb %dh, %cl | ||
423 | shrl $16, %eax | ||
424 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
425 | xorl %ebp, %edi | ||
426 | movb %ah, %bl | ||
427 | shrl $16, %edx | ||
428 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
429 | xorl %ebp, %edi | ||
430 | movl 28(%esp), %ebp | ||
431 | movb %dh, %cl | ||
432 | andl $0xff, %eax | ||
433 | andl $0xff, %edx | ||
434 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
435 | xorl %ebx, %edi | ||
436 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
437 | xorl %ebx, %edi | ||
438 | movl 0x400+des_SPtrans(%eax),%ebx | ||
439 | xorl %ebx, %edi | ||
440 | movl 0x500+des_SPtrans(%edx),%ebx | ||
441 | xorl %ebx, %edi | ||
442 | |||
443 | /* Round 7 */ | ||
444 | movl 32(%esp), %eax | ||
445 | movl %edi, %edx | ||
446 | shrl $16, %edx | ||
447 | movl 36(%esp), %ecx | ||
448 | xorl %edi, %edx | ||
449 | andl %edx, %eax | ||
450 | andl %ecx, %edx | ||
451 | movl %eax, %ebx | ||
452 | sall $16, %ebx | ||
453 | movl %edx, %ecx | ||
454 | sall $16, %ecx | ||
455 | xorl %ebx, %eax | ||
456 | xorl %ecx, %edx | ||
457 | movl 56(%ebp), %ebx | ||
458 | xorl %ebx, %eax | ||
459 | movl 60(%ebp), %ecx | ||
460 | xorl %edi, %eax | ||
461 | xorl %edi, %edx | ||
462 | xorl %ecx, %edx | ||
463 | andl $0xfcfcfcfc, %eax | ||
464 | xorl %ebx, %ebx | ||
465 | andl $0xcfcfcfcf, %edx | ||
466 | xorl %ecx, %ecx | ||
467 | movb %al, %bl | ||
468 | movb %ah, %cl | ||
469 | rorl $4, %edx | ||
470 | movl des_SPtrans(%ebx),%ebp | ||
471 | movb %dl, %bl | ||
472 | xorl %ebp, %esi | ||
473 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
474 | xorl %ebp, %esi | ||
475 | movb %dh, %cl | ||
476 | shrl $16, %eax | ||
477 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
478 | xorl %ebp, %esi | ||
479 | movb %ah, %bl | ||
480 | shrl $16, %edx | ||
481 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
482 | xorl %ebp, %esi | ||
483 | movl 28(%esp), %ebp | ||
484 | movb %dh, %cl | ||
485 | andl $0xff, %eax | ||
486 | andl $0xff, %edx | ||
487 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
488 | xorl %ebx, %esi | ||
489 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
490 | xorl %ebx, %esi | ||
491 | movl 0x400+des_SPtrans(%eax),%ebx | ||
492 | xorl %ebx, %esi | ||
493 | movl 0x500+des_SPtrans(%edx),%ebx | ||
494 | xorl %ebx, %esi | ||
495 | |||
496 | /* Round 8 */ | ||
497 | movl 32(%esp), %eax | ||
498 | movl %esi, %edx | ||
499 | shrl $16, %edx | ||
500 | movl 36(%esp), %ecx | ||
501 | xorl %esi, %edx | ||
502 | andl %edx, %eax | ||
503 | andl %ecx, %edx | ||
504 | movl %eax, %ebx | ||
505 | sall $16, %ebx | ||
506 | movl %edx, %ecx | ||
507 | sall $16, %ecx | ||
508 | xorl %ebx, %eax | ||
509 | xorl %ecx, %edx | ||
510 | movl 64(%ebp), %ebx | ||
511 | xorl %ebx, %eax | ||
512 | movl 68(%ebp), %ecx | ||
513 | xorl %esi, %eax | ||
514 | xorl %esi, %edx | ||
515 | xorl %ecx, %edx | ||
516 | andl $0xfcfcfcfc, %eax | ||
517 | xorl %ebx, %ebx | ||
518 | andl $0xcfcfcfcf, %edx | ||
519 | xorl %ecx, %ecx | ||
520 | movb %al, %bl | ||
521 | movb %ah, %cl | ||
522 | rorl $4, %edx | ||
523 | movl des_SPtrans(%ebx),%ebp | ||
524 | movb %dl, %bl | ||
525 | xorl %ebp, %edi | ||
526 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
527 | xorl %ebp, %edi | ||
528 | movb %dh, %cl | ||
529 | shrl $16, %eax | ||
530 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
531 | xorl %ebp, %edi | ||
532 | movb %ah, %bl | ||
533 | shrl $16, %edx | ||
534 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
535 | xorl %ebp, %edi | ||
536 | movl 28(%esp), %ebp | ||
537 | movb %dh, %cl | ||
538 | andl $0xff, %eax | ||
539 | andl $0xff, %edx | ||
540 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
541 | xorl %ebx, %edi | ||
542 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
543 | xorl %ebx, %edi | ||
544 | movl 0x400+des_SPtrans(%eax),%ebx | ||
545 | xorl %ebx, %edi | ||
546 | movl 0x500+des_SPtrans(%edx),%ebx | ||
547 | xorl %ebx, %edi | ||
548 | |||
549 | /* Round 9 */ | ||
550 | movl 32(%esp), %eax | ||
551 | movl %edi, %edx | ||
552 | shrl $16, %edx | ||
553 | movl 36(%esp), %ecx | ||
554 | xorl %edi, %edx | ||
555 | andl %edx, %eax | ||
556 | andl %ecx, %edx | ||
557 | movl %eax, %ebx | ||
558 | sall $16, %ebx | ||
559 | movl %edx, %ecx | ||
560 | sall $16, %ecx | ||
561 | xorl %ebx, %eax | ||
562 | xorl %ecx, %edx | ||
563 | movl 72(%ebp), %ebx | ||
564 | xorl %ebx, %eax | ||
565 | movl 76(%ebp), %ecx | ||
566 | xorl %edi, %eax | ||
567 | xorl %edi, %edx | ||
568 | xorl %ecx, %edx | ||
569 | andl $0xfcfcfcfc, %eax | ||
570 | xorl %ebx, %ebx | ||
571 | andl $0xcfcfcfcf, %edx | ||
572 | xorl %ecx, %ecx | ||
573 | movb %al, %bl | ||
574 | movb %ah, %cl | ||
575 | rorl $4, %edx | ||
576 | movl des_SPtrans(%ebx),%ebp | ||
577 | movb %dl, %bl | ||
578 | xorl %ebp, %esi | ||
579 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
580 | xorl %ebp, %esi | ||
581 | movb %dh, %cl | ||
582 | shrl $16, %eax | ||
583 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
584 | xorl %ebp, %esi | ||
585 | movb %ah, %bl | ||
586 | shrl $16, %edx | ||
587 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
588 | xorl %ebp, %esi | ||
589 | movl 28(%esp), %ebp | ||
590 | movb %dh, %cl | ||
591 | andl $0xff, %eax | ||
592 | andl $0xff, %edx | ||
593 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
594 | xorl %ebx, %esi | ||
595 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
596 | xorl %ebx, %esi | ||
597 | movl 0x400+des_SPtrans(%eax),%ebx | ||
598 | xorl %ebx, %esi | ||
599 | movl 0x500+des_SPtrans(%edx),%ebx | ||
600 | xorl %ebx, %esi | ||
601 | |||
602 | /* Round 10 */ | ||
603 | movl 32(%esp), %eax | ||
604 | movl %esi, %edx | ||
605 | shrl $16, %edx | ||
606 | movl 36(%esp), %ecx | ||
607 | xorl %esi, %edx | ||
608 | andl %edx, %eax | ||
609 | andl %ecx, %edx | ||
610 | movl %eax, %ebx | ||
611 | sall $16, %ebx | ||
612 | movl %edx, %ecx | ||
613 | sall $16, %ecx | ||
614 | xorl %ebx, %eax | ||
615 | xorl %ecx, %edx | ||
616 | movl 80(%ebp), %ebx | ||
617 | xorl %ebx, %eax | ||
618 | movl 84(%ebp), %ecx | ||
619 | xorl %esi, %eax | ||
620 | xorl %esi, %edx | ||
621 | xorl %ecx, %edx | ||
622 | andl $0xfcfcfcfc, %eax | ||
623 | xorl %ebx, %ebx | ||
624 | andl $0xcfcfcfcf, %edx | ||
625 | xorl %ecx, %ecx | ||
626 | movb %al, %bl | ||
627 | movb %ah, %cl | ||
628 | rorl $4, %edx | ||
629 | movl des_SPtrans(%ebx),%ebp | ||
630 | movb %dl, %bl | ||
631 | xorl %ebp, %edi | ||
632 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
633 | xorl %ebp, %edi | ||
634 | movb %dh, %cl | ||
635 | shrl $16, %eax | ||
636 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
637 | xorl %ebp, %edi | ||
638 | movb %ah, %bl | ||
639 | shrl $16, %edx | ||
640 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
641 | xorl %ebp, %edi | ||
642 | movl 28(%esp), %ebp | ||
643 | movb %dh, %cl | ||
644 | andl $0xff, %eax | ||
645 | andl $0xff, %edx | ||
646 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
647 | xorl %ebx, %edi | ||
648 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
649 | xorl %ebx, %edi | ||
650 | movl 0x400+des_SPtrans(%eax),%ebx | ||
651 | xorl %ebx, %edi | ||
652 | movl 0x500+des_SPtrans(%edx),%ebx | ||
653 | xorl %ebx, %edi | ||
654 | |||
655 | /* Round 11 */ | ||
656 | movl 32(%esp), %eax | ||
657 | movl %edi, %edx | ||
658 | shrl $16, %edx | ||
659 | movl 36(%esp), %ecx | ||
660 | xorl %edi, %edx | ||
661 | andl %edx, %eax | ||
662 | andl %ecx, %edx | ||
663 | movl %eax, %ebx | ||
664 | sall $16, %ebx | ||
665 | movl %edx, %ecx | ||
666 | sall $16, %ecx | ||
667 | xorl %ebx, %eax | ||
668 | xorl %ecx, %edx | ||
669 | movl 88(%ebp), %ebx | ||
670 | xorl %ebx, %eax | ||
671 | movl 92(%ebp), %ecx | ||
672 | xorl %edi, %eax | ||
673 | xorl %edi, %edx | ||
674 | xorl %ecx, %edx | ||
675 | andl $0xfcfcfcfc, %eax | ||
676 | xorl %ebx, %ebx | ||
677 | andl $0xcfcfcfcf, %edx | ||
678 | xorl %ecx, %ecx | ||
679 | movb %al, %bl | ||
680 | movb %ah, %cl | ||
681 | rorl $4, %edx | ||
682 | movl des_SPtrans(%ebx),%ebp | ||
683 | movb %dl, %bl | ||
684 | xorl %ebp, %esi | ||
685 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
686 | xorl %ebp, %esi | ||
687 | movb %dh, %cl | ||
688 | shrl $16, %eax | ||
689 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
690 | xorl %ebp, %esi | ||
691 | movb %ah, %bl | ||
692 | shrl $16, %edx | ||
693 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
694 | xorl %ebp, %esi | ||
695 | movl 28(%esp), %ebp | ||
696 | movb %dh, %cl | ||
697 | andl $0xff, %eax | ||
698 | andl $0xff, %edx | ||
699 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
700 | xorl %ebx, %esi | ||
701 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
702 | xorl %ebx, %esi | ||
703 | movl 0x400+des_SPtrans(%eax),%ebx | ||
704 | xorl %ebx, %esi | ||
705 | movl 0x500+des_SPtrans(%edx),%ebx | ||
706 | xorl %ebx, %esi | ||
707 | |||
708 | /* Round 12 */ | ||
709 | movl 32(%esp), %eax | ||
710 | movl %esi, %edx | ||
711 | shrl $16, %edx | ||
712 | movl 36(%esp), %ecx | ||
713 | xorl %esi, %edx | ||
714 | andl %edx, %eax | ||
715 | andl %ecx, %edx | ||
716 | movl %eax, %ebx | ||
717 | sall $16, %ebx | ||
718 | movl %edx, %ecx | ||
719 | sall $16, %ecx | ||
720 | xorl %ebx, %eax | ||
721 | xorl %ecx, %edx | ||
722 | movl 96(%ebp), %ebx | ||
723 | xorl %ebx, %eax | ||
724 | movl 100(%ebp), %ecx | ||
725 | xorl %esi, %eax | ||
726 | xorl %esi, %edx | ||
727 | xorl %ecx, %edx | ||
728 | andl $0xfcfcfcfc, %eax | ||
729 | xorl %ebx, %ebx | ||
730 | andl $0xcfcfcfcf, %edx | ||
731 | xorl %ecx, %ecx | ||
732 | movb %al, %bl | ||
733 | movb %ah, %cl | ||
734 | rorl $4, %edx | ||
735 | movl des_SPtrans(%ebx),%ebp | ||
736 | movb %dl, %bl | ||
737 | xorl %ebp, %edi | ||
738 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
739 | xorl %ebp, %edi | ||
740 | movb %dh, %cl | ||
741 | shrl $16, %eax | ||
742 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
743 | xorl %ebp, %edi | ||
744 | movb %ah, %bl | ||
745 | shrl $16, %edx | ||
746 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
747 | xorl %ebp, %edi | ||
748 | movl 28(%esp), %ebp | ||
749 | movb %dh, %cl | ||
750 | andl $0xff, %eax | ||
751 | andl $0xff, %edx | ||
752 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
753 | xorl %ebx, %edi | ||
754 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
755 | xorl %ebx, %edi | ||
756 | movl 0x400+des_SPtrans(%eax),%ebx | ||
757 | xorl %ebx, %edi | ||
758 | movl 0x500+des_SPtrans(%edx),%ebx | ||
759 | xorl %ebx, %edi | ||
760 | |||
761 | /* Round 13 */ | ||
762 | movl 32(%esp), %eax | ||
763 | movl %edi, %edx | ||
764 | shrl $16, %edx | ||
765 | movl 36(%esp), %ecx | ||
766 | xorl %edi, %edx | ||
767 | andl %edx, %eax | ||
768 | andl %ecx, %edx | ||
769 | movl %eax, %ebx | ||
770 | sall $16, %ebx | ||
771 | movl %edx, %ecx | ||
772 | sall $16, %ecx | ||
773 | xorl %ebx, %eax | ||
774 | xorl %ecx, %edx | ||
775 | movl 104(%ebp), %ebx | ||
776 | xorl %ebx, %eax | ||
777 | movl 108(%ebp), %ecx | ||
778 | xorl %edi, %eax | ||
779 | xorl %edi, %edx | ||
780 | xorl %ecx, %edx | ||
781 | andl $0xfcfcfcfc, %eax | ||
782 | xorl %ebx, %ebx | ||
783 | andl $0xcfcfcfcf, %edx | ||
784 | xorl %ecx, %ecx | ||
785 | movb %al, %bl | ||
786 | movb %ah, %cl | ||
787 | rorl $4, %edx | ||
788 | movl des_SPtrans(%ebx),%ebp | ||
789 | movb %dl, %bl | ||
790 | xorl %ebp, %esi | ||
791 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
792 | xorl %ebp, %esi | ||
793 | movb %dh, %cl | ||
794 | shrl $16, %eax | ||
795 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
796 | xorl %ebp, %esi | ||
797 | movb %ah, %bl | ||
798 | shrl $16, %edx | ||
799 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
800 | xorl %ebp, %esi | ||
801 | movl 28(%esp), %ebp | ||
802 | movb %dh, %cl | ||
803 | andl $0xff, %eax | ||
804 | andl $0xff, %edx | ||
805 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
806 | xorl %ebx, %esi | ||
807 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
808 | xorl %ebx, %esi | ||
809 | movl 0x400+des_SPtrans(%eax),%ebx | ||
810 | xorl %ebx, %esi | ||
811 | movl 0x500+des_SPtrans(%edx),%ebx | ||
812 | xorl %ebx, %esi | ||
813 | |||
814 | /* Round 14 */ | ||
815 | movl 32(%esp), %eax | ||
816 | movl %esi, %edx | ||
817 | shrl $16, %edx | ||
818 | movl 36(%esp), %ecx | ||
819 | xorl %esi, %edx | ||
820 | andl %edx, %eax | ||
821 | andl %ecx, %edx | ||
822 | movl %eax, %ebx | ||
823 | sall $16, %ebx | ||
824 | movl %edx, %ecx | ||
825 | sall $16, %ecx | ||
826 | xorl %ebx, %eax | ||
827 | xorl %ecx, %edx | ||
828 | movl 112(%ebp), %ebx | ||
829 | xorl %ebx, %eax | ||
830 | movl 116(%ebp), %ecx | ||
831 | xorl %esi, %eax | ||
832 | xorl %esi, %edx | ||
833 | xorl %ecx, %edx | ||
834 | andl $0xfcfcfcfc, %eax | ||
835 | xorl %ebx, %ebx | ||
836 | andl $0xcfcfcfcf, %edx | ||
837 | xorl %ecx, %ecx | ||
838 | movb %al, %bl | ||
839 | movb %ah, %cl | ||
840 | rorl $4, %edx | ||
841 | movl des_SPtrans(%ebx),%ebp | ||
842 | movb %dl, %bl | ||
843 | xorl %ebp, %edi | ||
844 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
845 | xorl %ebp, %edi | ||
846 | movb %dh, %cl | ||
847 | shrl $16, %eax | ||
848 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
849 | xorl %ebp, %edi | ||
850 | movb %ah, %bl | ||
851 | shrl $16, %edx | ||
852 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
853 | xorl %ebp, %edi | ||
854 | movl 28(%esp), %ebp | ||
855 | movb %dh, %cl | ||
856 | andl $0xff, %eax | ||
857 | andl $0xff, %edx | ||
858 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
859 | xorl %ebx, %edi | ||
860 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
861 | xorl %ebx, %edi | ||
862 | movl 0x400+des_SPtrans(%eax),%ebx | ||
863 | xorl %ebx, %edi | ||
864 | movl 0x500+des_SPtrans(%edx),%ebx | ||
865 | xorl %ebx, %edi | ||
866 | |||
867 | /* Round 15 */ | ||
868 | movl 32(%esp), %eax | ||
869 | movl %edi, %edx | ||
870 | shrl $16, %edx | ||
871 | movl 36(%esp), %ecx | ||
872 | xorl %edi, %edx | ||
873 | andl %edx, %eax | ||
874 | andl %ecx, %edx | ||
875 | movl %eax, %ebx | ||
876 | sall $16, %ebx | ||
877 | movl %edx, %ecx | ||
878 | sall $16, %ecx | ||
879 | xorl %ebx, %eax | ||
880 | xorl %ecx, %edx | ||
881 | movl 120(%ebp), %ebx | ||
882 | xorl %ebx, %eax | ||
883 | movl 124(%ebp), %ecx | ||
884 | xorl %edi, %eax | ||
885 | xorl %edi, %edx | ||
886 | xorl %ecx, %edx | ||
887 | andl $0xfcfcfcfc, %eax | ||
888 | xorl %ebx, %ebx | ||
889 | andl $0xcfcfcfcf, %edx | ||
890 | xorl %ecx, %ecx | ||
891 | movb %al, %bl | ||
892 | movb %ah, %cl | ||
893 | rorl $4, %edx | ||
894 | movl des_SPtrans(%ebx),%ebp | ||
895 | movb %dl, %bl | ||
896 | xorl %ebp, %esi | ||
897 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
898 | xorl %ebp, %esi | ||
899 | movb %dh, %cl | ||
900 | shrl $16, %eax | ||
901 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
902 | xorl %ebp, %esi | ||
903 | movb %ah, %bl | ||
904 | shrl $16, %edx | ||
905 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
906 | xorl %ebp, %esi | ||
907 | movl 28(%esp), %ebp | ||
908 | movb %dh, %cl | ||
909 | andl $0xff, %eax | ||
910 | andl $0xff, %edx | ||
911 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
912 | xorl %ebx, %esi | ||
913 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
914 | xorl %ebx, %esi | ||
915 | movl 0x400+des_SPtrans(%eax),%ebx | ||
916 | xorl %ebx, %esi | ||
917 | movl 0x500+des_SPtrans(%edx),%ebx | ||
918 | xorl %ebx, %esi | ||
919 | movl (%esp), %ebx | ||
920 | movl %edi, %eax | ||
921 | decl %ebx | ||
922 | movl %esi, %edi | ||
923 | movl %eax, %esi | ||
924 | movl %ebx, (%esp) | ||
925 | jnz .L000start | ||
926 | |||
927 | /* FP */ | ||
928 | movl 24(%esp), %edx | ||
929 | .byte 209 | ||
930 | .byte 207 /* rorl $1 %edi */ | ||
931 | movl %esi, %eax | ||
932 | xorl %edi, %esi | ||
933 | andl $0xaaaaaaaa, %esi | ||
934 | xorl %esi, %eax | ||
935 | xorl %esi, %edi | ||
936 | |||
937 | roll $23, %eax | ||
938 | movl %eax, %esi | ||
939 | xorl %edi, %eax | ||
940 | andl $0x03fc03fc, %eax | ||
941 | xorl %eax, %esi | ||
942 | xorl %eax, %edi | ||
943 | |||
944 | roll $10, %esi | ||
945 | movl %esi, %eax | ||
946 | xorl %edi, %esi | ||
947 | andl $0x33333333, %esi | ||
948 | xorl %esi, %eax | ||
949 | xorl %esi, %edi | ||
950 | |||
951 | roll $18, %edi | ||
952 | movl %edi, %esi | ||
953 | xorl %eax, %edi | ||
954 | andl $0xfff0000f, %edi | ||
955 | xorl %edi, %esi | ||
956 | xorl %edi, %eax | ||
957 | |||
958 | roll $12, %esi | ||
959 | movl %esi, %edi | ||
960 | xorl %eax, %esi | ||
961 | andl $0xf0f0f0f0, %esi | ||
962 | xorl %esi, %edi | ||
963 | xorl %esi, %eax | ||
964 | |||
965 | rorl $4, %eax | ||
966 | movl %eax, (%edx) | ||
967 | movl %edi, 4(%edx) | ||
968 | popl %ecx | ||
969 | popl %edi | ||
970 | popl %esi | ||
971 | popl %ebx | ||
972 | popl %ebp | ||
973 | ret | ||
974 | .fcrypt_body_end: | ||
975 | SIZE(fcrypt_body,.fcrypt_body_end-fcrypt_body) | ||
976 | .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 @@ | |||
1 | .TH DES 1 | ||
2 | .SH NAME | ||
3 | des - encrypt or decrypt data using Data Encryption Standard | ||
4 | .SH SYNOPSIS | ||
5 | .B des | ||
6 | ( | ||
7 | .B \-e | ||
8 | | | ||
9 | .B \-E | ||
10 | ) | ( | ||
11 | .B \-d | ||
12 | | | ||
13 | .B \-D | ||
14 | ) | ( | ||
15 | .B \-\fR[\fPcC\fR][\fPckname\fR]\fP | ||
16 | ) | | ||
17 | [ | ||
18 | .B \-b3hfs | ||
19 | ] [ | ||
20 | .B \-k | ||
21 | .I key | ||
22 | ] | ||
23 | ] [ | ||
24 | .B \-u\fR[\fIuuname\fR] | ||
25 | [ | ||
26 | .I input-file | ||
27 | [ | ||
28 | .I output-file | ||
29 | ] ] | ||
30 | .SH DESCRIPTION | ||
31 | .B des | ||
32 | encrypts and decrypts data using the | ||
33 | Data Encryption Standard algorithm. | ||
34 | One of | ||
35 | .B \-e, \-E | ||
36 | (for encrypt) or | ||
37 | .B \-d, \-D | ||
38 | (for decrypt) must be specified. | ||
39 | It is also possible to use | ||
40 | .B \-c | ||
41 | or | ||
42 | .B \-C | ||
43 | in conjunction or instead of the a encrypt/decrypt option to generate | ||
44 | a 16 character hexadecimal checksum, generated via the | ||
45 | .I des_cbc_cksum. | ||
46 | .LP | ||
47 | Two standard encryption modes are supported by the | ||
48 | .B des | ||
49 | program, Cipher Block Chaining (the default) and Electronic Code Book | ||
50 | (specified with | ||
51 | .B \-b | ||
52 | ). | ||
53 | .LP | ||
54 | The key used for the DES | ||
55 | algorithm is obtained by prompting the user unless the | ||
56 | .B `\-k | ||
57 | .I key' | ||
58 | option is given. | ||
59 | If the key is an argument to the | ||
60 | .B des | ||
61 | command, it is potentially visible to users executing | ||
62 | .BR ps (1) | ||
63 | or a derivative. To minimise this possibility, | ||
64 | .B des | ||
65 | takes care to destroy the key argument immediately upon entry. | ||
66 | If your shell keeps a history file be careful to make sure it is not | ||
67 | world readable. | ||
68 | .LP | ||
69 | Since this program attempts to maintain compatability with sunOS's | ||
70 | des(1) command, there are 2 different methods used to convert the user | ||
71 | supplied key to a des key. | ||
72 | Whenever and one or more of | ||
73 | .B \-E, \-D, \-C | ||
74 | or | ||
75 | .B \-3 | ||
76 | options are used, the key conversion procedure will not be compatible | ||
77 | with the sunOS des(1) version but will use all the user supplied | ||
78 | character to generate the des key. | ||
79 | .B des | ||
80 | command reads from standard input unless | ||
81 | .I input-file | ||
82 | is specified and writes to standard output unless | ||
83 | .I output-file | ||
84 | is given. | ||
85 | .SH OPTIONS | ||
86 | .TP | ||
87 | .B \-b | ||
88 | Select ECB | ||
89 | (eight bytes at a time) encryption mode. | ||
90 | .TP | ||
91 | .B \-3 | ||
92 | Encrypt using triple encryption. | ||
93 | By default triple cbc encryption is used but if the | ||
94 | .B \-b | ||
95 | option is used then triple ecb encryption is performed. | ||
96 | If the key is less than 8 characters long, the flag has no effect. | ||
97 | .TP | ||
98 | .B \-e | ||
99 | Encrypt data using an 8 byte key in a manner compatible with sunOS | ||
100 | des(1). | ||
101 | .TP | ||
102 | .B \-E | ||
103 | Encrypt data using a key of nearly unlimited length (1024 bytes). | ||
104 | This will product a more secure encryption. | ||
105 | .TP | ||
106 | .B \-d | ||
107 | Decrypt data that was encrypted with the \-e option. | ||
108 | .TP | ||
109 | .B \-D | ||
110 | Decrypt data that was encrypted with the \-E option. | ||
111 | .TP | ||
112 | .B \-c | ||
113 | Generate a 16 character hexadecimal cbc checksum and output this to | ||
114 | stderr. | ||
115 | If a filename was specified after the | ||
116 | .B \-c | ||
117 | option, the checksum is output to that file. | ||
118 | The checksum is generated using a key generated in a sunOS compatible | ||
119 | manner. | ||
120 | .TP | ||
121 | .B \-C | ||
122 | A cbc checksum is generated in the same manner as described for the | ||
123 | .B \-c | ||
124 | option but the DES key is generated in the same manner as used for the | ||
125 | .B \-E | ||
126 | and | ||
127 | .B \-D | ||
128 | options | ||
129 | .TP | ||
130 | .B \-f | ||
131 | Does nothing - allowed for compatibility with sunOS des(1) command. | ||
132 | .TP | ||
133 | .B \-s | ||
134 | Does nothing - allowed for compatibility with sunOS des(1) command. | ||
135 | .TP | ||
136 | .B "\-k \fIkey\fP" | ||
137 | Use the encryption | ||
138 | .I key | ||
139 | specified. | ||
140 | .TP | ||
141 | .B "\-h" | ||
142 | The | ||
143 | .I key | ||
144 | is assumed to be a 16 character hexadecimal number. | ||
145 | If the | ||
146 | .B "\-3" | ||
147 | option is used the key is assumed to be a 32 character hexadecimal | ||
148 | number. | ||
149 | .TP | ||
150 | .B \-u | ||
151 | This flag is used to read and write uuencoded files. If decrypting, | ||
152 | the input file is assumed to contain uuencoded, DES encrypted data. | ||
153 | If encrypting, the characters following the -u are used as the name of | ||
154 | the uuencoded file to embed in the begin line of the uuencoded | ||
155 | output. If there is no name specified after the -u, the name text.des | ||
156 | will be embedded in the header. | ||
157 | .SH SEE ALSO | ||
158 | .B ps (1) | ||
159 | .B des_crypt(3) | ||
160 | .SH BUGS | ||
161 | .LP | ||
162 | The problem with using the | ||
163 | .B -e | ||
164 | option is the short key length. | ||
165 | It would be better to use a real 56-bit key rather than an | ||
166 | ASCII-based 56-bit pattern. Knowing that the key was derived from ASCII | ||
167 | radically reduces the time necessary for a brute-force cryptographic attack. | ||
168 | My attempt to remove this problem is to add an alternative text-key to | ||
169 | DES-key function. This alternative function (accessed via | ||
170 | .B -E, -D, -S | ||
171 | and | ||
172 | .B -3 | ||
173 | ) | ||
174 | uses DES to help generate the key. | ||
175 | .LP | ||
176 | Be carefully when using the -u option. Doing des -ud <filename> will | ||
177 | not decrypt filename (the -u option will gobble the d option). | ||
178 | .LP | ||
179 | The VMS operating system operates in a world where files are always a | ||
180 | multiple of 512 bytes. This causes problems when encrypted data is | ||
181 | send from unix to VMS since a 88 byte file will suddenly be padded | ||
182 | with 424 null bytes. To get around this problem, use the -u option | ||
183 | to uuencode the data before it is send to the VMS system. | ||
184 | .SH AUTHOR | ||
185 | .LP | ||
186 | 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 @@ | |||
1 | /* crypto/des/des.org */ | ||
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
60 | * | ||
61 | * Always modify des.org since des.h is automatically generated from | ||
62 | * it during SSLeay configuration. | ||
63 | * | ||
64 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
65 | */ | ||
66 | |||
67 | #ifndef HEADER_DES_H | ||
68 | #define HEADER_DES_H | ||
69 | |||
70 | #ifdef __cplusplus | ||
71 | extern "C" { | ||
72 | #endif | ||
73 | |||
74 | #include <stdio.h> | ||
75 | |||
76 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
77 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
78 | #ifndef DES_LONG | ||
79 | #define DES_LONG unsigned long | ||
80 | #endif | ||
81 | |||
82 | typedef unsigned char des_cblock[8]; | ||
83 | typedef struct des_ks_struct | ||
84 | { | ||
85 | union { | ||
86 | des_cblock _; | ||
87 | /* make sure things are correct size on machines with | ||
88 | * 8 byte longs */ | ||
89 | DES_LONG pad[2]; | ||
90 | } ks; | ||
91 | #undef _ | ||
92 | #define _ ks._ | ||
93 | } des_key_schedule[16]; | ||
94 | |||
95 | #define DES_KEY_SZ (sizeof(des_cblock)) | ||
96 | #define DES_SCHEDULE_SZ (sizeof(des_key_schedule)) | ||
97 | |||
98 | #define DES_ENCRYPT 1 | ||
99 | #define DES_DECRYPT 0 | ||
100 | |||
101 | #define DES_CBC_MODE 0 | ||
102 | #define DES_PCBC_MODE 1 | ||
103 | |||
104 | #define des_ecb2_encrypt(i,o,k1,k2,e) \ | ||
105 | des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) | ||
106 | |||
107 | #define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ | ||
108 | des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) | ||
109 | |||
110 | #define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ | ||
111 | des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) | ||
112 | |||
113 | #define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ | ||
114 | des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) | ||
115 | |||
116 | #define C_Block des_cblock | ||
117 | #define Key_schedule des_key_schedule | ||
118 | #ifdef KERBEROS | ||
119 | #define ENCRYPT DES_ENCRYPT | ||
120 | #define DECRYPT DES_DECRYPT | ||
121 | #endif | ||
122 | #define KEY_SZ DES_KEY_SZ | ||
123 | #define string_to_key des_string_to_key | ||
124 | #define read_pw_string des_read_pw_string | ||
125 | #define random_key des_random_key | ||
126 | #define pcbc_encrypt des_pcbc_encrypt | ||
127 | #define set_key des_set_key | ||
128 | #define key_sched des_key_sched | ||
129 | #define ecb_encrypt des_ecb_encrypt | ||
130 | #define cbc_encrypt des_cbc_encrypt | ||
131 | #define ncbc_encrypt des_ncbc_encrypt | ||
132 | #define xcbc_encrypt des_xcbc_encrypt | ||
133 | #define cbc_cksum des_cbc_cksum | ||
134 | #define quad_cksum des_quad_cksum | ||
135 | |||
136 | /* For compatibility with the MIT lib - eay 20/05/92 */ | ||
137 | typedef des_key_schedule bit_64; | ||
138 | #define des_fixup_key_parity des_set_odd_parity | ||
139 | #define des_check_key_parity check_parity | ||
140 | |||
141 | extern int des_check_key; /* defaults to false */ | ||
142 | extern int des_rw_mode; /* defaults to DES_PCBC_MODE */ | ||
143 | |||
144 | /* The next line is used to disable full ANSI prototypes, if your | ||
145 | * compiler has problems with the prototypes, make sure this line always | ||
146 | * evaluates to true :-) */ | ||
147 | #if defined(MSDOS) || defined(__STDC__) | ||
148 | #undef NOPROTO | ||
149 | #endif | ||
150 | #ifndef NOPROTO | ||
151 | char *des_options(void); | ||
152 | void des_ecb3_encrypt(des_cblock *input,des_cblock *output, | ||
153 | des_key_schedule ks1,des_key_schedule ks2, | ||
154 | des_key_schedule ks3, int enc); | ||
155 | DES_LONG des_cbc_cksum(des_cblock *input,des_cblock *output, | ||
156 | long length,des_key_schedule schedule,des_cblock *ivec); | ||
157 | void des_cbc_encrypt(des_cblock *input,des_cblock *output,long length, | ||
158 | des_key_schedule schedule,des_cblock *ivec,int enc); | ||
159 | void des_ncbc_encrypt(des_cblock *input,des_cblock *output,long length, | ||
160 | des_key_schedule schedule,des_cblock *ivec,int enc); | ||
161 | void des_xcbc_encrypt(des_cblock *input,des_cblock *output,long length, | ||
162 | des_key_schedule schedule,des_cblock *ivec, | ||
163 | des_cblock *inw,des_cblock *outw,int enc); | ||
164 | void des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits, | ||
165 | long length,des_key_schedule schedule,des_cblock *ivec,int enc); | ||
166 | void des_ecb_encrypt(des_cblock *input,des_cblock *output, | ||
167 | des_key_schedule ks,int enc); | ||
168 | void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc); | ||
169 | void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc); | ||
170 | void des_encrypt3(DES_LONG *data, des_key_schedule ks1, | ||
171 | des_key_schedule ks2, des_key_schedule ks3); | ||
172 | void des_decrypt3(DES_LONG *data, des_key_schedule ks1, | ||
173 | des_key_schedule ks2, des_key_schedule ks3); | ||
174 | void des_ede3_cbc_encrypt(des_cblock *input, des_cblock *output, | ||
175 | long length, des_key_schedule ks1, des_key_schedule ks2, | ||
176 | des_key_schedule ks3, des_cblock *ivec, int enc); | ||
177 | void des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, | ||
178 | long length, des_key_schedule ks1, des_key_schedule ks2, | ||
179 | des_key_schedule ks3, des_cblock *ivec, int *num, int enc); | ||
180 | void des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, | ||
181 | long length, des_key_schedule ks1, des_key_schedule ks2, | ||
182 | des_key_schedule ks3, des_cblock *ivec, int *num); | ||
183 | |||
184 | void des_xwhite_in2out(des_cblock (*des_key), des_cblock (*in_white), | ||
185 | des_cblock (*out_white)); | ||
186 | |||
187 | int des_enc_read(int fd,char *buf,int len,des_key_schedule sched, | ||
188 | des_cblock *iv); | ||
189 | int des_enc_write(int fd,char *buf,int len,des_key_schedule sched, | ||
190 | des_cblock *iv); | ||
191 | char *des_fcrypt(const char *buf,const char *salt, char *ret); | ||
192 | #ifdef PERL5 | ||
193 | char *des_crypt(const char *buf,const char *salt); | ||
194 | #else | ||
195 | /* some stupid compilers complain because I have declared char instead | ||
196 | * of const char */ | ||
197 | #ifdef HEADER_DES_LOCL_H | ||
198 | char *crypt(const char *buf,const char *salt); | ||
199 | #else | ||
200 | char *crypt(); | ||
201 | #endif | ||
202 | #endif | ||
203 | void des_ofb_encrypt(unsigned char *in,unsigned char *out, | ||
204 | int numbits,long length,des_key_schedule schedule,des_cblock *ivec); | ||
205 | void des_pcbc_encrypt(des_cblock *input,des_cblock *output,long length, | ||
206 | des_key_schedule schedule,des_cblock *ivec,int enc); | ||
207 | DES_LONG des_quad_cksum(des_cblock *input,des_cblock *output, | ||
208 | long length,int out_count,des_cblock *seed); | ||
209 | void des_random_seed(des_cblock key); | ||
210 | void des_random_key(des_cblock ret); | ||
211 | int des_read_password(des_cblock *key,char *prompt,int verify); | ||
212 | int des_read_2passwords(des_cblock *key1,des_cblock *key2, | ||
213 | char *prompt,int verify); | ||
214 | int des_read_pw_string(char *buf,int length,char *prompt,int verify); | ||
215 | void des_set_odd_parity(des_cblock *key); | ||
216 | int des_is_weak_key(des_cblock *key); | ||
217 | int des_set_key(des_cblock *key,des_key_schedule schedule); | ||
218 | int des_key_sched(des_cblock *key,des_key_schedule schedule); | ||
219 | void des_string_to_key(char *str,des_cblock *key); | ||
220 | void des_string_to_2keys(char *str,des_cblock *key1,des_cblock *key2); | ||
221 | void des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
222 | des_key_schedule schedule, des_cblock *ivec, int *num, int enc); | ||
223 | void des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
224 | des_key_schedule schedule, des_cblock *ivec, int *num); | ||
225 | int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify); | ||
226 | |||
227 | /* Extra functions from Mark Murray <mark@grondar.za> */ | ||
228 | void des_cblock_print_file(des_cblock *cb, FILE *fp); | ||
229 | /* The following functions are not in the normal unix build or the | ||
230 | * SSLeay build. When using the SSLeay build, use RAND_seed() | ||
231 | * and RAND_bytes() instead. */ | ||
232 | int des_new_random_key(des_cblock *key); | ||
233 | void des_init_random_number_generator(des_cblock *key); | ||
234 | void des_set_random_generator_seed(des_cblock *key); | ||
235 | void des_set_sequence_number(des_cblock new_sequence_number); | ||
236 | void des_generate_random_block(des_cblock *block); | ||
237 | |||
238 | #else | ||
239 | |||
240 | char *des_options(); | ||
241 | void des_ecb3_encrypt(); | ||
242 | DES_LONG des_cbc_cksum(); | ||
243 | void des_cbc_encrypt(); | ||
244 | void des_ncbc_encrypt(); | ||
245 | void des_xcbc_encrypt(); | ||
246 | void des_cfb_encrypt(); | ||
247 | void des_ede3_cfb64_encrypt(); | ||
248 | void des_ede3_ofb64_encrypt(); | ||
249 | void des_ecb_encrypt(); | ||
250 | void des_encrypt(); | ||
251 | void des_encrypt2(); | ||
252 | void des_encrypt3(); | ||
253 | void des_decrypt3(); | ||
254 | void des_ede3_cbc_encrypt(); | ||
255 | int des_enc_read(); | ||
256 | int des_enc_write(); | ||
257 | char *des_fcrypt(); | ||
258 | #ifdef PERL5 | ||
259 | char *des_crypt(); | ||
260 | #else | ||
261 | char *crypt(); | ||
262 | #endif | ||
263 | void des_ofb_encrypt(); | ||
264 | void des_pcbc_encrypt(); | ||
265 | DES_LONG des_quad_cksum(); | ||
266 | void des_random_seed(); | ||
267 | void des_random_key(); | ||
268 | int des_read_password(); | ||
269 | int des_read_2passwords(); | ||
270 | int des_read_pw_string(); | ||
271 | void des_set_odd_parity(); | ||
272 | int des_is_weak_key(); | ||
273 | int des_set_key(); | ||
274 | int des_key_sched(); | ||
275 | void des_string_to_key(); | ||
276 | void des_string_to_2keys(); | ||
277 | void des_cfb64_encrypt(); | ||
278 | void des_ofb64_encrypt(); | ||
279 | int des_read_pw(); | ||
280 | void des_xwhite_in2out(); | ||
281 | |||
282 | /* Extra functions from Mark Murray <mark@grondar.za> */ | ||
283 | void des_cblock_print_file(); | ||
284 | /* The following functions are not in the normal unix build or the | ||
285 | * SSLeay build. When using the SSLeay build, use RAND_seed() | ||
286 | * and RAND_bytes() instead. */ | ||
287 | #ifdef FreeBSD | ||
288 | int des_new_random_key(); | ||
289 | void des_init_random_number_generator(); | ||
290 | void des_set_random_generator_seed(); | ||
291 | void des_set_sequence_number(); | ||
292 | void des_generate_random_block(); | ||
293 | #endif | ||
294 | |||
295 | #endif | ||
296 | |||
297 | #ifdef __cplusplus | ||
298 | } | ||
299 | #endif | ||
300 | |||
301 | #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 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # des.pl - eric young 22/11/1991 eay@cryptsoft.com | ||
3 | # | ||
4 | # Copyright (C) 1993 Eric Young | ||
5 | # | ||
6 | # 11 April 1996 - patched to circumvent Perl 5 (through 5.002) problem | ||
7 | # with sign-extension on right shift operations. | ||
8 | # Ed Kubaitis - ejk@uiuc.edu | ||
9 | # | ||
10 | # eay - 92/08/31 - I think I have fixed all problems for 64bit | ||
11 | # versions of perl but I could be wrong since I have not tested it yet :-). | ||
12 | # | ||
13 | # This is an implementation of DES in perl. | ||
14 | # The two routines (des_set_key and des_ecb_encrypt) | ||
15 | # take 8 byte objects as arguments. | ||
16 | # | ||
17 | # des_set_key takes an 8 byte string as a key and returns a key schedule | ||
18 | # for use in calls to des_ecb_encrypt. | ||
19 | # des_ecb_encrypt takes three arguments, the first is a key schedule | ||
20 | # (make sure to pass it by reference with the *), the second is 1 | ||
21 | # to encrypt, 0 to decrypt. The third argument is an 8 byte object | ||
22 | # to encrypt. The function returns an 8 byte object that has been | ||
23 | # DES encrypted. | ||
24 | # | ||
25 | # example: | ||
26 | # require 'des.pl' | ||
27 | # | ||
28 | # $key =pack("C8",0x12,0x23,0x45,0x67,0x89,0xab,0xcd,0xef); | ||
29 | # @ks= &des_set_key($key); | ||
30 | # | ||
31 | # $outbytes= &des_ecb_encrypt(*ks,1,$data); | ||
32 | # @enc =unpack("C8",$outbytes); | ||
33 | # | ||
34 | |||
35 | package des; | ||
36 | |||
37 | eval("use integer;") if (int($]) > 4); | ||
38 | |||
39 | # The following 8 arrays are used in des_set_key | ||
40 | @skb0=( | ||
41 | # for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 | ||
42 | 0x00000000,0x00000010,0x20000000,0x20000010, | ||
43 | 0x00010000,0x00010010,0x20010000,0x20010010, | ||
44 | 0x00000800,0x00000810,0x20000800,0x20000810, | ||
45 | 0x00010800,0x00010810,0x20010800,0x20010810, | ||
46 | 0x00000020,0x00000030,0x20000020,0x20000030, | ||
47 | 0x00010020,0x00010030,0x20010020,0x20010030, | ||
48 | 0x00000820,0x00000830,0x20000820,0x20000830, | ||
49 | 0x00010820,0x00010830,0x20010820,0x20010830, | ||
50 | 0x00080000,0x00080010,0x20080000,0x20080010, | ||
51 | 0x00090000,0x00090010,0x20090000,0x20090010, | ||
52 | 0x00080800,0x00080810,0x20080800,0x20080810, | ||
53 | 0x00090800,0x00090810,0x20090800,0x20090810, | ||
54 | 0x00080020,0x00080030,0x20080020,0x20080030, | ||
55 | 0x00090020,0x00090030,0x20090020,0x20090030, | ||
56 | 0x00080820,0x00080830,0x20080820,0x20080830, | ||
57 | 0x00090820,0x00090830,0x20090820,0x20090830, | ||
58 | ); | ||
59 | @skb1=( | ||
60 | # for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 | ||
61 | 0x00000000,0x02000000,0x00002000,0x02002000, | ||
62 | 0x00200000,0x02200000,0x00202000,0x02202000, | ||
63 | 0x00000004,0x02000004,0x00002004,0x02002004, | ||
64 | 0x00200004,0x02200004,0x00202004,0x02202004, | ||
65 | 0x00000400,0x02000400,0x00002400,0x02002400, | ||
66 | 0x00200400,0x02200400,0x00202400,0x02202400, | ||
67 | 0x00000404,0x02000404,0x00002404,0x02002404, | ||
68 | 0x00200404,0x02200404,0x00202404,0x02202404, | ||
69 | 0x10000000,0x12000000,0x10002000,0x12002000, | ||
70 | 0x10200000,0x12200000,0x10202000,0x12202000, | ||
71 | 0x10000004,0x12000004,0x10002004,0x12002004, | ||
72 | 0x10200004,0x12200004,0x10202004,0x12202004, | ||
73 | 0x10000400,0x12000400,0x10002400,0x12002400, | ||
74 | 0x10200400,0x12200400,0x10202400,0x12202400, | ||
75 | 0x10000404,0x12000404,0x10002404,0x12002404, | ||
76 | 0x10200404,0x12200404,0x10202404,0x12202404, | ||
77 | ); | ||
78 | @skb2=( | ||
79 | # for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 | ||
80 | 0x00000000,0x00000001,0x00040000,0x00040001, | ||
81 | 0x01000000,0x01000001,0x01040000,0x01040001, | ||
82 | 0x00000002,0x00000003,0x00040002,0x00040003, | ||
83 | 0x01000002,0x01000003,0x01040002,0x01040003, | ||
84 | 0x00000200,0x00000201,0x00040200,0x00040201, | ||
85 | 0x01000200,0x01000201,0x01040200,0x01040201, | ||
86 | 0x00000202,0x00000203,0x00040202,0x00040203, | ||
87 | 0x01000202,0x01000203,0x01040202,0x01040203, | ||
88 | 0x08000000,0x08000001,0x08040000,0x08040001, | ||
89 | 0x09000000,0x09000001,0x09040000,0x09040001, | ||
90 | 0x08000002,0x08000003,0x08040002,0x08040003, | ||
91 | 0x09000002,0x09000003,0x09040002,0x09040003, | ||
92 | 0x08000200,0x08000201,0x08040200,0x08040201, | ||
93 | 0x09000200,0x09000201,0x09040200,0x09040201, | ||
94 | 0x08000202,0x08000203,0x08040202,0x08040203, | ||
95 | 0x09000202,0x09000203,0x09040202,0x09040203, | ||
96 | ); | ||
97 | @skb3=( | ||
98 | # for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 | ||
99 | 0x00000000,0x00100000,0x00000100,0x00100100, | ||
100 | 0x00000008,0x00100008,0x00000108,0x00100108, | ||
101 | 0x00001000,0x00101000,0x00001100,0x00101100, | ||
102 | 0x00001008,0x00101008,0x00001108,0x00101108, | ||
103 | 0x04000000,0x04100000,0x04000100,0x04100100, | ||
104 | 0x04000008,0x04100008,0x04000108,0x04100108, | ||
105 | 0x04001000,0x04101000,0x04001100,0x04101100, | ||
106 | 0x04001008,0x04101008,0x04001108,0x04101108, | ||
107 | 0x00020000,0x00120000,0x00020100,0x00120100, | ||
108 | 0x00020008,0x00120008,0x00020108,0x00120108, | ||
109 | 0x00021000,0x00121000,0x00021100,0x00121100, | ||
110 | 0x00021008,0x00121008,0x00021108,0x00121108, | ||
111 | 0x04020000,0x04120000,0x04020100,0x04120100, | ||
112 | 0x04020008,0x04120008,0x04020108,0x04120108, | ||
113 | 0x04021000,0x04121000,0x04021100,0x04121100, | ||
114 | 0x04021008,0x04121008,0x04021108,0x04121108, | ||
115 | ); | ||
116 | @skb4=( | ||
117 | # for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 | ||
118 | 0x00000000,0x10000000,0x00010000,0x10010000, | ||
119 | 0x00000004,0x10000004,0x00010004,0x10010004, | ||
120 | 0x20000000,0x30000000,0x20010000,0x30010000, | ||
121 | 0x20000004,0x30000004,0x20010004,0x30010004, | ||
122 | 0x00100000,0x10100000,0x00110000,0x10110000, | ||
123 | 0x00100004,0x10100004,0x00110004,0x10110004, | ||
124 | 0x20100000,0x30100000,0x20110000,0x30110000, | ||
125 | 0x20100004,0x30100004,0x20110004,0x30110004, | ||
126 | 0x00001000,0x10001000,0x00011000,0x10011000, | ||
127 | 0x00001004,0x10001004,0x00011004,0x10011004, | ||
128 | 0x20001000,0x30001000,0x20011000,0x30011000, | ||
129 | 0x20001004,0x30001004,0x20011004,0x30011004, | ||
130 | 0x00101000,0x10101000,0x00111000,0x10111000, | ||
131 | 0x00101004,0x10101004,0x00111004,0x10111004, | ||
132 | 0x20101000,0x30101000,0x20111000,0x30111000, | ||
133 | 0x20101004,0x30101004,0x20111004,0x30111004, | ||
134 | ); | ||
135 | @skb5=( | ||
136 | # for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 | ||
137 | 0x00000000,0x08000000,0x00000008,0x08000008, | ||
138 | 0x00000400,0x08000400,0x00000408,0x08000408, | ||
139 | 0x00020000,0x08020000,0x00020008,0x08020008, | ||
140 | 0x00020400,0x08020400,0x00020408,0x08020408, | ||
141 | 0x00000001,0x08000001,0x00000009,0x08000009, | ||
142 | 0x00000401,0x08000401,0x00000409,0x08000409, | ||
143 | 0x00020001,0x08020001,0x00020009,0x08020009, | ||
144 | 0x00020401,0x08020401,0x00020409,0x08020409, | ||
145 | 0x02000000,0x0A000000,0x02000008,0x0A000008, | ||
146 | 0x02000400,0x0A000400,0x02000408,0x0A000408, | ||
147 | 0x02020000,0x0A020000,0x02020008,0x0A020008, | ||
148 | 0x02020400,0x0A020400,0x02020408,0x0A020408, | ||
149 | 0x02000001,0x0A000001,0x02000009,0x0A000009, | ||
150 | 0x02000401,0x0A000401,0x02000409,0x0A000409, | ||
151 | 0x02020001,0x0A020001,0x02020009,0x0A020009, | ||
152 | 0x02020401,0x0A020401,0x02020409,0x0A020409, | ||
153 | ); | ||
154 | @skb6=( | ||
155 | # for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 | ||
156 | 0x00000000,0x00000100,0x00080000,0x00080100, | ||
157 | 0x01000000,0x01000100,0x01080000,0x01080100, | ||
158 | 0x00000010,0x00000110,0x00080010,0x00080110, | ||
159 | 0x01000010,0x01000110,0x01080010,0x01080110, | ||
160 | 0x00200000,0x00200100,0x00280000,0x00280100, | ||
161 | 0x01200000,0x01200100,0x01280000,0x01280100, | ||
162 | 0x00200010,0x00200110,0x00280010,0x00280110, | ||
163 | 0x01200010,0x01200110,0x01280010,0x01280110, | ||
164 | 0x00000200,0x00000300,0x00080200,0x00080300, | ||
165 | 0x01000200,0x01000300,0x01080200,0x01080300, | ||
166 | 0x00000210,0x00000310,0x00080210,0x00080310, | ||
167 | 0x01000210,0x01000310,0x01080210,0x01080310, | ||
168 | 0x00200200,0x00200300,0x00280200,0x00280300, | ||
169 | 0x01200200,0x01200300,0x01280200,0x01280300, | ||
170 | 0x00200210,0x00200310,0x00280210,0x00280310, | ||
171 | 0x01200210,0x01200310,0x01280210,0x01280310, | ||
172 | ); | ||
173 | @skb7=( | ||
174 | # for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 | ||
175 | 0x00000000,0x04000000,0x00040000,0x04040000, | ||
176 | 0x00000002,0x04000002,0x00040002,0x04040002, | ||
177 | 0x00002000,0x04002000,0x00042000,0x04042000, | ||
178 | 0x00002002,0x04002002,0x00042002,0x04042002, | ||
179 | 0x00000020,0x04000020,0x00040020,0x04040020, | ||
180 | 0x00000022,0x04000022,0x00040022,0x04040022, | ||
181 | 0x00002020,0x04002020,0x00042020,0x04042020, | ||
182 | 0x00002022,0x04002022,0x00042022,0x04042022, | ||
183 | 0x00000800,0x04000800,0x00040800,0x04040800, | ||
184 | 0x00000802,0x04000802,0x00040802,0x04040802, | ||
185 | 0x00002800,0x04002800,0x00042800,0x04042800, | ||
186 | 0x00002802,0x04002802,0x00042802,0x04042802, | ||
187 | 0x00000820,0x04000820,0x00040820,0x04040820, | ||
188 | 0x00000822,0x04000822,0x00040822,0x04040822, | ||
189 | 0x00002820,0x04002820,0x00042820,0x04042820, | ||
190 | 0x00002822,0x04002822,0x00042822,0x04042822, | ||
191 | ); | ||
192 | |||
193 | @shifts2=(0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0); | ||
194 | |||
195 | # used in ecb_encrypt | ||
196 | @SP0=( | ||
197 | 0x00410100, 0x00010000, 0x40400000, 0x40410100, | ||
198 | 0x00400000, 0x40010100, 0x40010000, 0x40400000, | ||
199 | 0x40010100, 0x00410100, 0x00410000, 0x40000100, | ||
200 | 0x40400100, 0x00400000, 0x00000000, 0x40010000, | ||
201 | 0x00010000, 0x40000000, 0x00400100, 0x00010100, | ||
202 | 0x40410100, 0x00410000, 0x40000100, 0x00400100, | ||
203 | 0x40000000, 0x00000100, 0x00010100, 0x40410000, | ||
204 | 0x00000100, 0x40400100, 0x40410000, 0x00000000, | ||
205 | 0x00000000, 0x40410100, 0x00400100, 0x40010000, | ||
206 | 0x00410100, 0x00010000, 0x40000100, 0x00400100, | ||
207 | 0x40410000, 0x00000100, 0x00010100, 0x40400000, | ||
208 | 0x40010100, 0x40000000, 0x40400000, 0x00410000, | ||
209 | 0x40410100, 0x00010100, 0x00410000, 0x40400100, | ||
210 | 0x00400000, 0x40000100, 0x40010000, 0x00000000, | ||
211 | 0x00010000, 0x00400000, 0x40400100, 0x00410100, | ||
212 | 0x40000000, 0x40410000, 0x00000100, 0x40010100, | ||
213 | ); | ||
214 | @SP1=( | ||
215 | 0x08021002, 0x00000000, 0x00021000, 0x08020000, | ||
216 | 0x08000002, 0x00001002, 0x08001000, 0x00021000, | ||
217 | 0x00001000, 0x08020002, 0x00000002, 0x08001000, | ||
218 | 0x00020002, 0x08021000, 0x08020000, 0x00000002, | ||
219 | 0x00020000, 0x08001002, 0x08020002, 0x00001000, | ||
220 | 0x00021002, 0x08000000, 0x00000000, 0x00020002, | ||
221 | 0x08001002, 0x00021002, 0x08021000, 0x08000002, | ||
222 | 0x08000000, 0x00020000, 0x00001002, 0x08021002, | ||
223 | 0x00020002, 0x08021000, 0x08001000, 0x00021002, | ||
224 | 0x08021002, 0x00020002, 0x08000002, 0x00000000, | ||
225 | 0x08000000, 0x00001002, 0x00020000, 0x08020002, | ||
226 | 0x00001000, 0x08000000, 0x00021002, 0x08001002, | ||
227 | 0x08021000, 0x00001000, 0x00000000, 0x08000002, | ||
228 | 0x00000002, 0x08021002, 0x00021000, 0x08020000, | ||
229 | 0x08020002, 0x00020000, 0x00001002, 0x08001000, | ||
230 | 0x08001002, 0x00000002, 0x08020000, 0x00021000, | ||
231 | ); | ||
232 | @SP2=( | ||
233 | 0x20800000, 0x00808020, 0x00000020, 0x20800020, | ||
234 | 0x20008000, 0x00800000, 0x20800020, 0x00008020, | ||
235 | 0x00800020, 0x00008000, 0x00808000, 0x20000000, | ||
236 | 0x20808020, 0x20000020, 0x20000000, 0x20808000, | ||
237 | 0x00000000, 0x20008000, 0x00808020, 0x00000020, | ||
238 | 0x20000020, 0x20808020, 0x00008000, 0x20800000, | ||
239 | 0x20808000, 0x00800020, 0x20008020, 0x00808000, | ||
240 | 0x00008020, 0x00000000, 0x00800000, 0x20008020, | ||
241 | 0x00808020, 0x00000020, 0x20000000, 0x00008000, | ||
242 | 0x20000020, 0x20008000, 0x00808000, 0x20800020, | ||
243 | 0x00000000, 0x00808020, 0x00008020, 0x20808000, | ||
244 | 0x20008000, 0x00800000, 0x20808020, 0x20000000, | ||
245 | 0x20008020, 0x20800000, 0x00800000, 0x20808020, | ||
246 | 0x00008000, 0x00800020, 0x20800020, 0x00008020, | ||
247 | 0x00800020, 0x00000000, 0x20808000, 0x20000020, | ||
248 | 0x20800000, 0x20008020, 0x00000020, 0x00808000, | ||
249 | ); | ||
250 | @SP3=( | ||
251 | 0x00080201, 0x02000200, 0x00000001, 0x02080201, | ||
252 | 0x00000000, 0x02080000, 0x02000201, 0x00080001, | ||
253 | 0x02080200, 0x02000001, 0x02000000, 0x00000201, | ||
254 | 0x02000001, 0x00080201, 0x00080000, 0x02000000, | ||
255 | 0x02080001, 0x00080200, 0x00000200, 0x00000001, | ||
256 | 0x00080200, 0x02000201, 0x02080000, 0x00000200, | ||
257 | 0x00000201, 0x00000000, 0x00080001, 0x02080200, | ||
258 | 0x02000200, 0x02080001, 0x02080201, 0x00080000, | ||
259 | 0x02080001, 0x00000201, 0x00080000, 0x02000001, | ||
260 | 0x00080200, 0x02000200, 0x00000001, 0x02080000, | ||
261 | 0x02000201, 0x00000000, 0x00000200, 0x00080001, | ||
262 | 0x00000000, 0x02080001, 0x02080200, 0x00000200, | ||
263 | 0x02000000, 0x02080201, 0x00080201, 0x00080000, | ||
264 | 0x02080201, 0x00000001, 0x02000200, 0x00080201, | ||
265 | 0x00080001, 0x00080200, 0x02080000, 0x02000201, | ||
266 | 0x00000201, 0x02000000, 0x02000001, 0x02080200, | ||
267 | ); | ||
268 | @SP4=( | ||
269 | 0x01000000, 0x00002000, 0x00000080, 0x01002084, | ||
270 | 0x01002004, 0x01000080, 0x00002084, 0x01002000, | ||
271 | 0x00002000, 0x00000004, 0x01000004, 0x00002080, | ||
272 | 0x01000084, 0x01002004, 0x01002080, 0x00000000, | ||
273 | 0x00002080, 0x01000000, 0x00002004, 0x00000084, | ||
274 | 0x01000080, 0x00002084, 0x00000000, 0x01000004, | ||
275 | 0x00000004, 0x01000084, 0x01002084, 0x00002004, | ||
276 | 0x01002000, 0x00000080, 0x00000084, 0x01002080, | ||
277 | 0x01002080, 0x01000084, 0x00002004, 0x01002000, | ||
278 | 0x00002000, 0x00000004, 0x01000004, 0x01000080, | ||
279 | 0x01000000, 0x00002080, 0x01002084, 0x00000000, | ||
280 | 0x00002084, 0x01000000, 0x00000080, 0x00002004, | ||
281 | 0x01000084, 0x00000080, 0x00000000, 0x01002084, | ||
282 | 0x01002004, 0x01002080, 0x00000084, 0x00002000, | ||
283 | 0x00002080, 0x01002004, 0x01000080, 0x00000084, | ||
284 | 0x00000004, 0x00002084, 0x01002000, 0x01000004, | ||
285 | ); | ||
286 | @SP5=( | ||
287 | 0x10000008, 0x00040008, 0x00000000, 0x10040400, | ||
288 | 0x00040008, 0x00000400, 0x10000408, 0x00040000, | ||
289 | 0x00000408, 0x10040408, 0x00040400, 0x10000000, | ||
290 | 0x10000400, 0x10000008, 0x10040000, 0x00040408, | ||
291 | 0x00040000, 0x10000408, 0x10040008, 0x00000000, | ||
292 | 0x00000400, 0x00000008, 0x10040400, 0x10040008, | ||
293 | 0x10040408, 0x10040000, 0x10000000, 0x00000408, | ||
294 | 0x00000008, 0x00040400, 0x00040408, 0x10000400, | ||
295 | 0x00000408, 0x10000000, 0x10000400, 0x00040408, | ||
296 | 0x10040400, 0x00040008, 0x00000000, 0x10000400, | ||
297 | 0x10000000, 0x00000400, 0x10040008, 0x00040000, | ||
298 | 0x00040008, 0x10040408, 0x00040400, 0x00000008, | ||
299 | 0x10040408, 0x00040400, 0x00040000, 0x10000408, | ||
300 | 0x10000008, 0x10040000, 0x00040408, 0x00000000, | ||
301 | 0x00000400, 0x10000008, 0x10000408, 0x10040400, | ||
302 | 0x10040000, 0x00000408, 0x00000008, 0x10040008, | ||
303 | ); | ||
304 | @SP6=( | ||
305 | 0x00000800, 0x00000040, 0x00200040, 0x80200000, | ||
306 | 0x80200840, 0x80000800, 0x00000840, 0x00000000, | ||
307 | 0x00200000, 0x80200040, 0x80000040, 0x00200800, | ||
308 | 0x80000000, 0x00200840, 0x00200800, 0x80000040, | ||
309 | 0x80200040, 0x00000800, 0x80000800, 0x80200840, | ||
310 | 0x00000000, 0x00200040, 0x80200000, 0x00000840, | ||
311 | 0x80200800, 0x80000840, 0x00200840, 0x80000000, | ||
312 | 0x80000840, 0x80200800, 0x00000040, 0x00200000, | ||
313 | 0x80000840, 0x00200800, 0x80200800, 0x80000040, | ||
314 | 0x00000800, 0x00000040, 0x00200000, 0x80200800, | ||
315 | 0x80200040, 0x80000840, 0x00000840, 0x00000000, | ||
316 | 0x00000040, 0x80200000, 0x80000000, 0x00200040, | ||
317 | 0x00000000, 0x80200040, 0x00200040, 0x00000840, | ||
318 | 0x80000040, 0x00000800, 0x80200840, 0x00200000, | ||
319 | 0x00200840, 0x80000000, 0x80000800, 0x80200840, | ||
320 | 0x80200000, 0x00200840, 0x00200800, 0x80000800, | ||
321 | ); | ||
322 | @SP7=( | ||
323 | 0x04100010, 0x04104000, 0x00004010, 0x00000000, | ||
324 | 0x04004000, 0x00100010, 0x04100000, 0x04104010, | ||
325 | 0x00000010, 0x04000000, 0x00104000, 0x00004010, | ||
326 | 0x00104010, 0x04004010, 0x04000010, 0x04100000, | ||
327 | 0x00004000, 0x00104010, 0x00100010, 0x04004000, | ||
328 | 0x04104010, 0x04000010, 0x00000000, 0x00104000, | ||
329 | 0x04000000, 0x00100000, 0x04004010, 0x04100010, | ||
330 | 0x00100000, 0x00004000, 0x04104000, 0x00000010, | ||
331 | 0x00100000, 0x00004000, 0x04000010, 0x04104010, | ||
332 | 0x00004010, 0x04000000, 0x00000000, 0x00104000, | ||
333 | 0x04100010, 0x04004010, 0x04004000, 0x00100010, | ||
334 | 0x04104000, 0x00000010, 0x00100010, 0x04004000, | ||
335 | 0x04104010, 0x00100000, 0x04100000, 0x04000010, | ||
336 | 0x00104000, 0x00004010, 0x04004010, 0x04100000, | ||
337 | 0x00000010, 0x04104000, 0x00104010, 0x00000000, | ||
338 | 0x04000000, 0x04100010, 0x00004000, 0x00104010, | ||
339 | ); | ||
340 | |||
341 | sub main'des_set_key | ||
342 | { | ||
343 | local($param)=@_; | ||
344 | local(@key); | ||
345 | local($c,$d,$i,$s,$t); | ||
346 | local(@ks)=(); | ||
347 | |||
348 | # Get the bytes in the order we want. | ||
349 | @key=unpack("C8",$param); | ||
350 | |||
351 | $c= ($key[0] )| | ||
352 | ($key[1]<< 8)| | ||
353 | ($key[2]<<16)| | ||
354 | ($key[3]<<24); | ||
355 | $d= ($key[4] )| | ||
356 | ($key[5]<< 8)| | ||
357 | ($key[6]<<16)| | ||
358 | ($key[7]<<24); | ||
359 | |||
360 | &doPC1(*c,*d); | ||
361 | |||
362 | for $i (@shifts2) | ||
363 | { | ||
364 | if ($i) | ||
365 | { | ||
366 | $c=($c>>2)|($c<<26); | ||
367 | $d=($d>>2)|($d<<26); | ||
368 | } | ||
369 | else | ||
370 | { | ||
371 | $c=($c>>1)|($c<<27); | ||
372 | $d=($d>>1)|($d<<27); | ||
373 | } | ||
374 | $c&=0x0fffffff; | ||
375 | $d&=0x0fffffff; | ||
376 | $s= $skb0[ ($c )&0x3f ]| | ||
377 | $skb1[(($c>> 6)&0x03)|(($c>> 7)&0x3c)]| | ||
378 | $skb2[(($c>>13)&0x0f)|(($c>>14)&0x30)]| | ||
379 | $skb3[(($c>>20)&0x01)|(($c>>21)&0x06) | | ||
380 | (($c>>22)&0x38)]; | ||
381 | $t= $skb4[ ($d )&0x3f ]| | ||
382 | $skb5[(($d>> 7)&0x03)|(($d>> 8)&0x3c)]| | ||
383 | $skb6[ ($d>>15)&0x3f ]| | ||
384 | $skb7[(($d>>21)&0x0f)|(($d>>22)&0x30)]; | ||
385 | push(@ks,(($t<<16)|($s&0x0000ffff))&0xffffffff); | ||
386 | $s= (($s>>16)&0x0000ffff)|($t&0xffff0000) ; | ||
387 | push(@ks,(($s<<4)|(($s>>28)&0xf))&0xffffffff); | ||
388 | } | ||
389 | @ks; | ||
390 | } | ||
391 | |||
392 | sub doPC1 | ||
393 | { | ||
394 | local(*a,*b)=@_; | ||
395 | local($t); | ||
396 | |||
397 | $t=(($b>>4)^$a)&0x0f0f0f0f; | ||
398 | $b^=($t<<4); $a^=$t; | ||
399 | # do $a first | ||
400 | $t=(($a<<18)^$a)&0xcccc0000; | ||
401 | $a=$a^$t^(($t>>18)&0x00003fff); | ||
402 | $t=(($a<<17)^$a)&0xaaaa0000; | ||
403 | $a=$a^$t^(($t>>17)&0x00007fff); | ||
404 | $t=(($a<< 8)^$a)&0x00ff0000; | ||
405 | $a=$a^$t^(($t>> 8)&0x00ffffff); | ||
406 | $t=(($a<<17)^$a)&0xaaaa0000; | ||
407 | $a=$a^$t^(($t>>17)&0x00007fff); | ||
408 | |||
409 | # now do $b | ||
410 | $t=(($b<<24)^$b)&0xff000000; | ||
411 | $b=$b^$t^(($t>>24)&0x000000ff); | ||
412 | $t=(($b<< 8)^$b)&0x00ff0000; | ||
413 | $b=$b^$t^(($t>> 8)&0x00ffffff); | ||
414 | $t=(($b<<14)^$b)&0x33330000; | ||
415 | $b=$b^$t^(($t>>14)&0x0003ffff); | ||
416 | $b=(($b&0x00aa00aa)<<7)|(($b&0x55005500)>>7)|($b&0xaa55aa55); | ||
417 | $b=(($b>>8)&0x00ffffff)|((($a&0xf0000000)>>4)&0x0fffffff); | ||
418 | $a&=0x0fffffff; | ||
419 | } | ||
420 | |||
421 | sub doIP | ||
422 | { | ||
423 | local(*a,*b)=@_; | ||
424 | local($t); | ||
425 | |||
426 | $t=(($b>> 4)^$a)&0x0f0f0f0f; | ||
427 | $b^=($t<< 4); $a^=$t; | ||
428 | $t=(($a>>16)^$b)&0x0000ffff; | ||
429 | $a^=($t<<16); $b^=$t; | ||
430 | $t=(($b>> 2)^$a)&0x33333333; | ||
431 | $b^=($t<< 2); $a^=$t; | ||
432 | $t=(($a>> 8)^$b)&0x00ff00ff; | ||
433 | $a^=($t<< 8); $b^=$t; | ||
434 | $t=(($b>> 1)^$a)&0x55555555; | ||
435 | $b^=($t<< 1); $a^=$t; | ||
436 | $t=$a; | ||
437 | $a=$b&0xffffffff; | ||
438 | $b=$t&0xffffffff; | ||
439 | } | ||
440 | |||
441 | sub doFP | ||
442 | { | ||
443 | local(*a,*b)=@_; | ||
444 | local($t); | ||
445 | |||
446 | $t=(($b>> 1)^$a)&0x55555555; | ||
447 | $b^=($t<< 1); $a^=$t; | ||
448 | $t=(($a>> 8)^$b)&0x00ff00ff; | ||
449 | $a^=($t<< 8); $b^=$t; | ||
450 | $t=(($b>> 2)^$a)&0x33333333; | ||
451 | $b^=($t<< 2); $a^=$t; | ||
452 | $t=(($a>>16)^$b)&0x0000ffff; | ||
453 | $a^=($t<<16); $b^=$t; | ||
454 | $t=(($b>> 4)^$a)&0x0f0f0f0f; | ||
455 | $b^=($t<< 4); $a^=$t; | ||
456 | $a&=0xffffffff; | ||
457 | $b&=0xffffffff; | ||
458 | } | ||
459 | |||
460 | sub main'des_ecb_encrypt | ||
461 | { | ||
462 | local(*ks,$encrypt,$in)=@_; | ||
463 | local($l,$r,$i,$t,$u,@input); | ||
464 | |||
465 | @input=unpack("C8",$in); | ||
466 | # Get the bytes in the order we want. | ||
467 | $l= ($input[0] )| | ||
468 | ($input[1]<< 8)| | ||
469 | ($input[2]<<16)| | ||
470 | ($input[3]<<24); | ||
471 | $r= ($input[4] )| | ||
472 | ($input[5]<< 8)| | ||
473 | ($input[6]<<16)| | ||
474 | ($input[7]<<24); | ||
475 | |||
476 | $l&=0xffffffff; | ||
477 | $r&=0xffffffff; | ||
478 | &doIP(*l,*r); | ||
479 | if ($encrypt) | ||
480 | { | ||
481 | for ($i=0; $i<32; $i+=4) | ||
482 | { | ||
483 | $t=((($r&0x7fffffff)<<1)|(($r>>31)&0x00000001)); | ||
484 | $u=$t^$ks[$i ]; | ||
485 | $t=$t^$ks[$i+1]; | ||
486 | $t2=(($t&0x0000000f)<<28); | ||
487 | |||
488 | $t=((($t>>4)&0x0fffffff)|(($t&0x0000000f)<<28)); | ||
489 | $l^= $SP1[ $t &0x3f]| | ||
490 | $SP3[($t>> 8)&0x3f]| | ||
491 | $SP5[($t>>16)&0x3f]| | ||
492 | $SP7[($t>>24)&0x3f]| | ||
493 | $SP0[ $u &0x3f]| | ||
494 | $SP2[($u>> 8)&0x3f]| | ||
495 | $SP4[($u>>16)&0x3f]| | ||
496 | $SP6[($u>>24)&0x3f]; | ||
497 | |||
498 | $t=(($l<<1)|(($l>>31)&0x1))&0xffffffff; | ||
499 | $u=$t^$ks[$i+2]; | ||
500 | $t=$t^$ks[$i+3]; | ||
501 | $t=((($t>>4)&0x0fffffff)|($t<<28))&0xffffffff; | ||
502 | $r^= $SP1[ $t &0x3f]| | ||
503 | $SP3[($t>> 8)&0x3f]| | ||
504 | $SP5[($t>>16)&0x3f]| | ||
505 | $SP7[($t>>24)&0x3f]| | ||
506 | $SP0[ $u &0x3f]| | ||
507 | $SP2[($u>> 8)&0x3f]| | ||
508 | $SP4[($u>>16)&0x3f]| | ||
509 | $SP6[($u>>24)&0x3f]; | ||
510 | } | ||
511 | } | ||
512 | else | ||
513 | { | ||
514 | for ($i=30; $i>0; $i-=4) | ||
515 | { | ||
516 | $t=(($r<<1)|(($r>>31)&0x1))&0xffffffff; | ||
517 | $u=$t^$ks[$i ]; | ||
518 | $t=$t^$ks[$i+1]; | ||
519 | $t=((($t>>4)&0x0fffffff)|($t<<28))&0xffffffff; | ||
520 | $l^= $SP1[ $t &0x3f]| | ||
521 | $SP3[($t>> 8)&0x3f]| | ||
522 | $SP5[($t>>16)&0x3f]| | ||
523 | $SP7[($t>>24)&0x3f]| | ||
524 | $SP0[ $u &0x3f]| | ||
525 | $SP2[($u>> 8)&0x3f]| | ||
526 | $SP4[($u>>16)&0x3f]| | ||
527 | $SP6[($u>>24)&0x3f]; | ||
528 | |||
529 | $t=(($l<<1)|(($l>>31)&0x1))&0xffffffff; | ||
530 | $u=$t^$ks[$i-2]; | ||
531 | $t=$t^$ks[$i-1]; | ||
532 | $t=((($t>>4)&0x0fffffff)|($t<<28))&0xffffffff; | ||
533 | $r^= $SP1[ $t &0x3f]| | ||
534 | $SP3[($t>> 8)&0x3f]| | ||
535 | $SP5[($t>>16)&0x3f]| | ||
536 | $SP7[($t>>24)&0x3f]| | ||
537 | $SP0[ $u &0x3f]| | ||
538 | $SP2[($u>> 8)&0x3f]| | ||
539 | $SP4[($u>>16)&0x3f]| | ||
540 | $SP6[($u>>24)&0x3f]; | ||
541 | } | ||
542 | } | ||
543 | &doFP(*l,*r); | ||
544 | pack("C8",$l&0xff, | ||
545 | ($l>> 8)&0x00ffffff, | ||
546 | ($l>>16)&0x0000ffff, | ||
547 | ($l>>24)&0x000000ff, | ||
548 | $r&0xff, | ||
549 | ($r>> 8)&0x00ffffff, | ||
550 | ($r>>16)&0x0000ffff, | ||
551 | ($r>>24)&0x000000ff); | ||
552 | } | ||
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 @@ | |||
1 | .TH DES_CRYPT 3 | ||
2 | .SH NAME | ||
3 | des_read_password, des_read_2password, | ||
4 | des_string_to_key, des_string_to_2key, des_read_pw_string, | ||
5 | des_random_key, des_set_key, | ||
6 | des_key_sched, des_ecb_encrypt, des_ecb3_encrypt, des_cbc_encrypt, | ||
7 | des_3cbc_encrypt, | ||
8 | des_pcbc_encrypt, des_cfb_encrypt, des_ofb_encrypt, | ||
9 | des_cbc_cksum, des_quad_cksum, | ||
10 | des_enc_read, des_enc_write, des_set_odd_parity, | ||
11 | des_is_weak_key, crypt \- (non USA) DES encryption | ||
12 | .SH SYNOPSIS | ||
13 | .nf | ||
14 | .nj | ||
15 | .ft B | ||
16 | #include <des.h> | ||
17 | .PP | ||
18 | .B int des_read_password(key,prompt,verify) | ||
19 | des_cblock *key; | ||
20 | char *prompt; | ||
21 | int verify; | ||
22 | .PP | ||
23 | .B int des_read_2password(key1,key2,prompt,verify) | ||
24 | des_cblock *key1,*key2; | ||
25 | char *prompt; | ||
26 | int verify; | ||
27 | .PP | ||
28 | .B int des_string_to_key(str,key) | ||
29 | char *str; | ||
30 | des_cblock *key; | ||
31 | .PP | ||
32 | .B int des_string_to_2keys(str,key1,key2) | ||
33 | char *str; | ||
34 | des_cblock *key1,*key2; | ||
35 | .PP | ||
36 | .B int des_read_pw_string(buf,length,prompt,verify) | ||
37 | char *buf; | ||
38 | int length; | ||
39 | char *prompt; | ||
40 | int verify; | ||
41 | .PP | ||
42 | .B int des_random_key(key) | ||
43 | des_cblock *key; | ||
44 | .PP | ||
45 | .B int des_set_key(key,schedule) | ||
46 | des_cblock *key; | ||
47 | des_key_schedule schedule; | ||
48 | .PP | ||
49 | .B int des_key_sched(key,schedule) | ||
50 | des_cblock *key; | ||
51 | des_key_schedule schedule; | ||
52 | .PP | ||
53 | .B int des_ecb_encrypt(input,output,schedule,encrypt) | ||
54 | des_cblock *input; | ||
55 | des_cblock *output; | ||
56 | des_key_schedule schedule; | ||
57 | int encrypt; | ||
58 | .PP | ||
59 | .B int des_ecb3_encrypt(input,output,ks1,ks2,encrypt) | ||
60 | des_cblock *input; | ||
61 | des_cblock *output; | ||
62 | des_key_schedule ks1,ks2; | ||
63 | int encrypt; | ||
64 | .PP | ||
65 | .B int des_cbc_encrypt(input,output,length,schedule,ivec,encrypt) | ||
66 | des_cblock *input; | ||
67 | des_cblock *output; | ||
68 | long length; | ||
69 | des_key_schedule schedule; | ||
70 | des_cblock *ivec; | ||
71 | int encrypt; | ||
72 | .PP | ||
73 | .B int des_3cbc_encrypt(input,output,length,sk1,sk2,ivec1,ivec2,encrypt) | ||
74 | des_cblock *input; | ||
75 | des_cblock *output; | ||
76 | long length; | ||
77 | des_key_schedule sk1; | ||
78 | des_key_schedule sk2; | ||
79 | des_cblock *ivec1; | ||
80 | des_cblock *ivec2; | ||
81 | int encrypt; | ||
82 | .PP | ||
83 | .B int des_pcbc_encrypt(input,output,length,schedule,ivec,encrypt) | ||
84 | des_cblock *input; | ||
85 | des_cblock *output; | ||
86 | long length; | ||
87 | des_key_schedule schedule; | ||
88 | des_cblock *ivec; | ||
89 | int encrypt; | ||
90 | .PP | ||
91 | .B int des_cfb_encrypt(input,output,numbits,length,schedule,ivec,encrypt) | ||
92 | unsigned char *input; | ||
93 | unsigned char *output; | ||
94 | int numbits; | ||
95 | long length; | ||
96 | des_key_schedule schedule; | ||
97 | des_cblock *ivec; | ||
98 | int encrypt; | ||
99 | .PP | ||
100 | .B int des_ofb_encrypt(input,output,numbits,length,schedule,ivec) | ||
101 | unsigned char *input,*output; | ||
102 | int numbits; | ||
103 | long length; | ||
104 | des_key_schedule schedule; | ||
105 | des_cblock *ivec; | ||
106 | .PP | ||
107 | .B unsigned long des_cbc_cksum(input,output,length,schedule,ivec) | ||
108 | des_cblock *input; | ||
109 | des_cblock *output; | ||
110 | long length; | ||
111 | des_key_schedule schedule; | ||
112 | des_cblock *ivec; | ||
113 | .PP | ||
114 | .B unsigned long des_quad_cksum(input,output,length,out_count,seed) | ||
115 | des_cblock *input; | ||
116 | des_cblock *output; | ||
117 | long length; | ||
118 | int out_count; | ||
119 | des_cblock *seed; | ||
120 | .PP | ||
121 | .B int des_check_key; | ||
122 | .PP | ||
123 | .B int des_enc_read(fd,buf,len,sched,iv) | ||
124 | int fd; | ||
125 | char *buf; | ||
126 | int len; | ||
127 | des_key_schedule sched; | ||
128 | des_cblock *iv; | ||
129 | .PP | ||
130 | .B int des_enc_write(fd,buf,len,sched,iv) | ||
131 | int fd; | ||
132 | char *buf; | ||
133 | int len; | ||
134 | des_key_schedule sched; | ||
135 | des_cblock *iv; | ||
136 | .PP | ||
137 | .B extern int des_rw_mode; | ||
138 | .PP | ||
139 | .B void des_set_odd_parity(key) | ||
140 | des_cblock *key; | ||
141 | .PP | ||
142 | .B int des_is_weak_key(key) | ||
143 | des_cblock *key; | ||
144 | .PP | ||
145 | .B char *crypt(passwd,salt) | ||
146 | char *passwd; | ||
147 | char *salt; | ||
148 | .PP | ||
149 | .fi | ||
150 | .SH DESCRIPTION | ||
151 | This library contains a fast implementation of the DES encryption | ||
152 | algorithm. | ||
153 | .PP | ||
154 | There are two phases to the use of DES encryption. | ||
155 | The first is the generation of a | ||
156 | .I des_key_schedule | ||
157 | from a key, | ||
158 | the second is the actual encryption. | ||
159 | A des key is of type | ||
160 | .I des_cblock. | ||
161 | This type is made from 8 characters with odd parity. | ||
162 | The least significant bit in the character is the parity bit. | ||
163 | The key schedule is an expanded form of the key; it is used to speed the | ||
164 | encryption process. | ||
165 | .PP | ||
166 | .I des_read_password | ||
167 | writes the string specified by prompt to the standard output, | ||
168 | turns off echo and reads an input string from standard input | ||
169 | until terminated with a newline. | ||
170 | If verify is non-zero, it prompts and reads the input again and verifies | ||
171 | that both entered passwords are the same. | ||
172 | The entered string is converted into a des key by using the | ||
173 | .I des_string_to_key | ||
174 | routine. | ||
175 | The new key is placed in the | ||
176 | .I des_cblock | ||
177 | that was passed (by reference) to the routine. | ||
178 | If there were no errors, | ||
179 | .I des_read_password | ||
180 | returns 0, | ||
181 | -1 is returned if there was a terminal error and 1 is returned for | ||
182 | any other error. | ||
183 | .PP | ||
184 | .I des_read_2password | ||
185 | operates in the same way as | ||
186 | .I des_read_password | ||
187 | except that it generates 2 keys by using the | ||
188 | .I des_string_to_2key | ||
189 | function. | ||
190 | .PP | ||
191 | .I des_read_pw_string | ||
192 | is called by | ||
193 | .I des_read_password | ||
194 | to read and verify a string from a terminal device. | ||
195 | The string is returned in | ||
196 | .I buf. | ||
197 | The size of | ||
198 | .I buf | ||
199 | is passed to the routine via the | ||
200 | .I length | ||
201 | parameter. | ||
202 | .PP | ||
203 | .I des_string_to_key | ||
204 | converts a string into a valid des key. | ||
205 | .PP | ||
206 | .I des_string_to_2key | ||
207 | converts a string into 2 valid des keys. | ||
208 | This routine is best suited for used to generate keys for use with | ||
209 | .I des_ecb3_encrypt. | ||
210 | .PP | ||
211 | .I des_random_key | ||
212 | returns a random key that is made of a combination of process id, | ||
213 | time and an increasing counter. | ||
214 | .PP | ||
215 | Before a des key can be used it is converted into a | ||
216 | .I des_key_schedule | ||
217 | via the | ||
218 | .I des_set_key | ||
219 | routine. | ||
220 | If the | ||
221 | .I des_check_key | ||
222 | flag is non-zero, | ||
223 | .I des_set_key | ||
224 | will check that the key passed is of odd parity and is not a week or | ||
225 | semi-weak key. | ||
226 | If the parity is wrong, | ||
227 | then -1 is returned. | ||
228 | If the key is a weak key, | ||
229 | then -2 is returned. | ||
230 | If an error is returned, | ||
231 | the key schedule is not generated. | ||
232 | .PP | ||
233 | .I des_key_sched | ||
234 | is another name for the | ||
235 | .I des_set_key | ||
236 | function. | ||
237 | .PP | ||
238 | The following routines mostly operate on an input and output stream of | ||
239 | .I des_cblock's. | ||
240 | .PP | ||
241 | .I des_ecb_encrypt | ||
242 | is the basic DES encryption routine that encrypts or decrypts a single 8-byte | ||
243 | .I des_cblock | ||
244 | in | ||
245 | .I electronic code book | ||
246 | mode. | ||
247 | It always transforms the input data, pointed to by | ||
248 | .I input, | ||
249 | into the output data, | ||
250 | pointed to by the | ||
251 | .I output | ||
252 | argument. | ||
253 | If the | ||
254 | .I encrypt | ||
255 | argument is non-zero (DES_ENCRYPT), | ||
256 | the | ||
257 | .I input | ||
258 | (cleartext) is encrypted in to the | ||
259 | .I output | ||
260 | (ciphertext) using the key_schedule specified by the | ||
261 | .I schedule | ||
262 | argument, | ||
263 | previously set via | ||
264 | .I des_set_key. | ||
265 | If | ||
266 | .I encrypt | ||
267 | is zero (DES_DECRYPT), | ||
268 | the | ||
269 | .I input | ||
270 | (now ciphertext) | ||
271 | is decrypted into the | ||
272 | .I output | ||
273 | (now cleartext). | ||
274 | Input and output may overlap. | ||
275 | No meaningful value is returned. | ||
276 | .PP | ||
277 | .I des_ecb3_encrypt | ||
278 | encrypts/decrypts the | ||
279 | .I input | ||
280 | block by using triple ecb DES encryption. | ||
281 | This involves encrypting the input with | ||
282 | .I ks1, | ||
283 | decryption with the key schedule | ||
284 | .I ks2, | ||
285 | and then encryption with the first again. | ||
286 | This routine greatly reduces the chances of brute force breaking of | ||
287 | DES and has the advantage of if | ||
288 | .I ks1 | ||
289 | and | ||
290 | .I ks2 | ||
291 | are the same, it is equivalent to just encryption using ecb mode and | ||
292 | .I ks1 | ||
293 | as the key. | ||
294 | .PP | ||
295 | .I des_cbc_encrypt | ||
296 | encrypts/decrypts using the | ||
297 | .I cipher-block-chaining | ||
298 | mode of DES. | ||
299 | If the | ||
300 | .I encrypt | ||
301 | argument is non-zero, | ||
302 | the routine cipher-block-chain encrypts the cleartext data pointed to by the | ||
303 | .I input | ||
304 | argument into the ciphertext pointed to by the | ||
305 | .I output | ||
306 | argument, | ||
307 | using the key schedule provided by the | ||
308 | .I schedule | ||
309 | argument, | ||
310 | and initialisation vector provided by the | ||
311 | .I ivec | ||
312 | argument. | ||
313 | If the | ||
314 | .I length | ||
315 | argument is not an integral multiple of eight bytes, | ||
316 | the last block is copied to a temporary area and zero filled. | ||
317 | The output is always | ||
318 | an integral multiple of eight bytes. | ||
319 | To make multiple cbc encrypt calls on a large amount of data appear to | ||
320 | be one | ||
321 | .I des_cbc_encrypt | ||
322 | call, the | ||
323 | .I ivec | ||
324 | of subsequent calls should be the last 8 bytes of the output. | ||
325 | .PP | ||
326 | .I des_3cbc_encrypt | ||
327 | encrypts/decrypts the | ||
328 | .I input | ||
329 | block by using triple cbc DES encryption. | ||
330 | This involves encrypting the input with key schedule | ||
331 | .I ks1, | ||
332 | decryption with the key schedule | ||
333 | .I ks2, | ||
334 | and then encryption with the first again. | ||
335 | 2 initialisation vectors are required, | ||
336 | .I ivec1 | ||
337 | and | ||
338 | .I ivec2. | ||
339 | Unlike | ||
340 | .I des_cbc_encrypt, | ||
341 | these initialisation vectors are modified by the subroutine. | ||
342 | This routine greatly reduces the chances of brute force breaking of | ||
343 | DES and has the advantage of if | ||
344 | .I ks1 | ||
345 | and | ||
346 | .I ks2 | ||
347 | are the same, it is equivalent to just encryption using cbc mode and | ||
348 | .I ks1 | ||
349 | as the key. | ||
350 | .PP | ||
351 | .I des_pcbc_encrypt | ||
352 | encrypt/decrypts using a modified block chaining mode. | ||
353 | It provides better error propagation characteristics than cbc | ||
354 | encryption. | ||
355 | .PP | ||
356 | .I des_cfb_encrypt | ||
357 | encrypt/decrypts using cipher feedback mode. This method takes an | ||
358 | array of characters as input and outputs and array of characters. It | ||
359 | does not require any padding to 8 character groups. Note: the ivec | ||
360 | variable is changed and the new changed value needs to be passed to | ||
361 | the next call to this function. Since this function runs a complete | ||
362 | DES ecb encryption per numbits, this function is only suggested for | ||
363 | use when sending small numbers of characters. | ||
364 | .PP | ||
365 | .I des_ofb_encrypt | ||
366 | encrypt using output feedback mode. This method takes an | ||
367 | array of characters as input and outputs and array of characters. It | ||
368 | does not require any padding to 8 character groups. Note: the ivec | ||
369 | variable is changed and the new changed value needs to be passed to | ||
370 | the next call to this function. Since this function runs a complete | ||
371 | DES ecb encryption per numbits, this function is only suggested for | ||
372 | use when sending small numbers of characters. | ||
373 | .PP | ||
374 | .I des_cbc_cksum | ||
375 | produces an 8 byte checksum based on the input stream (via cbc encryption). | ||
376 | The last 4 bytes of the checksum is returned and the complete 8 bytes is | ||
377 | placed in | ||
378 | .I output. | ||
379 | .PP | ||
380 | .I des_quad_cksum | ||
381 | returns a 4 byte checksum from the input bytes. | ||
382 | The algorithm can be iterated over the input, | ||
383 | depending on | ||
384 | .I out_count, | ||
385 | 1, 2, 3 or 4 times. | ||
386 | If | ||
387 | .I output | ||
388 | is non-NULL, | ||
389 | the 8 bytes generated by each pass are written into | ||
390 | .I output. | ||
391 | .PP | ||
392 | .I des_enc_write | ||
393 | is used to write | ||
394 | .I len | ||
395 | bytes | ||
396 | to file descriptor | ||
397 | .I fd | ||
398 | from buffer | ||
399 | .I buf. | ||
400 | The data is encrypted via | ||
401 | .I pcbc_encrypt | ||
402 | (default) using | ||
403 | .I sched | ||
404 | for the key and | ||
405 | .I iv | ||
406 | as a starting vector. | ||
407 | The actual data send down | ||
408 | .I fd | ||
409 | consists of 4 bytes (in network byte order) containing the length of the | ||
410 | following encrypted data. The encrypted data then follows, padded with random | ||
411 | data out to a multiple of 8 bytes. | ||
412 | .PP | ||
413 | .I des_enc_read | ||
414 | is used to read | ||
415 | .I len | ||
416 | bytes | ||
417 | from file descriptor | ||
418 | .I fd | ||
419 | into buffer | ||
420 | .I buf. | ||
421 | The data being read from | ||
422 | .I fd | ||
423 | is assumed to have come from | ||
424 | .I des_enc_write | ||
425 | and is decrypted using | ||
426 | .I sched | ||
427 | for the key schedule and | ||
428 | .I iv | ||
429 | for the initial vector. | ||
430 | The | ||
431 | .I des_enc_read/des_enc_write | ||
432 | pair can be used to read/write to files, pipes and sockets. | ||
433 | I have used them in implementing a version of rlogin in which all | ||
434 | data is encrypted. | ||
435 | .PP | ||
436 | .I des_rw_mode | ||
437 | is used to specify the encryption mode to use with | ||
438 | .I des_enc_read | ||
439 | and | ||
440 | .I des_end_write. | ||
441 | If set to | ||
442 | .I DES_PCBC_MODE | ||
443 | (the default), des_pcbc_encrypt is used. | ||
444 | If set to | ||
445 | .I DES_CBC_MODE | ||
446 | des_cbc_encrypt is used. | ||
447 | These two routines and the variable are not part of the normal MIT library. | ||
448 | .PP | ||
449 | .I des_set_odd_parity | ||
450 | sets the parity of the passed | ||
451 | .I key | ||
452 | to odd. This routine is not part of the standard MIT library. | ||
453 | .PP | ||
454 | .I des_is_weak_key | ||
455 | returns 1 is the passed key is a weak key (pick again :-), | ||
456 | 0 if it is ok. | ||
457 | This routine is not part of the standard MIT library. | ||
458 | .PP | ||
459 | .I crypt | ||
460 | is a replacement for the normal system crypt. | ||
461 | It is much faster than the system crypt. | ||
462 | .PP | ||
463 | .SH FILES | ||
464 | /usr/include/des.h | ||
465 | .br | ||
466 | /usr/lib/libdes.a | ||
467 | .PP | ||
468 | The encryption routines have been tested on 16bit, 32bit and 64bit | ||
469 | machines of various endian and even works under VMS. | ||
470 | .PP | ||
471 | .SH BUGS | ||
472 | .PP | ||
473 | If you think this manual is sparse, | ||
474 | read the des_crypt(3) manual from the MIT kerberos (or bones outside | ||
475 | of the USA) distribution. | ||
476 | .PP | ||
477 | .I des_cfb_encrypt | ||
478 | and | ||
479 | .I des_ofb_encrypt | ||
480 | operates on input of 8 bits. What this means is that if you set | ||
481 | numbits to 12, and length to 2, the first 12 bits will come from the 1st | ||
482 | input byte and the low half of the second input byte. The second 12 | ||
483 | bits will have the low 8 bits taken from the 3rd input byte and the | ||
484 | top 4 bits taken from the 4th input byte. The same holds for output. | ||
485 | This function has been implemented this way because most people will | ||
486 | be using a multiple of 8 and because once you get into pulling bytes input | ||
487 | bytes apart things get ugly! | ||
488 | .PP | ||
489 | .I des_read_pw_string | ||
490 | is the most machine/OS dependent function and normally generates the | ||
491 | most problems when porting this code. | ||
492 | .PP | ||
493 | .I des_string_to_key | ||
494 | is probably different from the MIT version since there are lots | ||
495 | of fun ways to implement one-way encryption of a text string. | ||
496 | .PP | ||
497 | The routines are optimised for 32 bit machines and so are not efficient | ||
498 | on IBM PCs. | ||
499 | .PP | ||
500 | NOTE: extensive work has been done on this library since this document | ||
501 | was origionally written. Please try to read des.doc from the libdes | ||
502 | distribution since it is far more upto date and documents more of the | ||
503 | functions. Libdes is now also being shipped as part of SSLeay, a | ||
504 | general cryptographic library that amonst other things implements | ||
505 | netscapes SSL protocoll. The most recent version can be found in | ||
506 | SSLeay distributions. | ||
507 | .SH AUTHOR | ||
508 | 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 @@ | |||
1 | /* crypto/des/des_locl.org */ | ||
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
60 | * | ||
61 | * Always modify des_locl.org since des_locl.h is automatically generated from | ||
62 | * it during SSLeay configuration. | ||
63 | * | ||
64 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
65 | */ | ||
66 | |||
67 | #ifndef HEADER_DES_LOCL_H | ||
68 | #define HEADER_DES_LOCL_H | ||
69 | |||
70 | #if defined(WIN32) || defined(WIN16) | ||
71 | #ifndef MSDOS | ||
72 | #define MSDOS | ||
73 | #endif | ||
74 | #endif | ||
75 | |||
76 | #include <stdio.h> | ||
77 | #include <stdlib.h> | ||
78 | #ifndef MSDOS | ||
79 | #include <unistd.h> | ||
80 | #endif | ||
81 | #include "des.h" | ||
82 | |||
83 | #ifndef DES_DEFAULT_OPTIONS | ||
84 | /* the following is tweaked from a config script, that is why it is a | ||
85 | * protected undef/define */ | ||
86 | #ifndef DES_PTR | ||
87 | #undef DES_PTR | ||
88 | #endif | ||
89 | |||
90 | /* This helps C compiler generate the correct code for multiple functional | ||
91 | * units. It reduces register dependancies at the expense of 2 more | ||
92 | * registers */ | ||
93 | #ifndef DES_RISC1 | ||
94 | #undef DES_RISC1 | ||
95 | #endif | ||
96 | |||
97 | #ifndef DES_RISC2 | ||
98 | #undef DES_RISC2 | ||
99 | #endif | ||
100 | |||
101 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
102 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
103 | #endif | ||
104 | |||
105 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
106 | * Very mucy CPU dependant */ | ||
107 | #ifndef DES_UNROLL | ||
108 | #undef DES_UNROLL | ||
109 | #endif | ||
110 | |||
111 | /* These default values were supplied by | ||
112 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
113 | * They are only used if nothing else has been defined */ | ||
114 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
115 | /* Special defines which change the way the code is built depending on the | ||
116 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
117 | even newer MIPS CPU's, but at the moment one size fits all for | ||
118 | optimization options. Older Sparc's work better with only UNROLL, but | ||
119 | there's no way to tell at compile time what it is you're running on */ | ||
120 | |||
121 | #if defined( sun ) /* Newer Sparc's */ | ||
122 | #define DES_PTR | ||
123 | #define DES_RISC1 | ||
124 | #define DES_UNROLL | ||
125 | #elif defined( __ultrix ) /* Older MIPS */ | ||
126 | #define DES_PTR | ||
127 | #define DES_RISC2 | ||
128 | #define DES_UNROLL | ||
129 | #elif defined( __osf1__ ) /* Alpha */ | ||
130 | #define DES_PTR | ||
131 | #define DES_RISC2 | ||
132 | #elif defined ( _AIX ) /* RS6000 */ | ||
133 | /* Unknown */ | ||
134 | #elif defined( __hpux ) /* HP-PA */ | ||
135 | /* Unknown */ | ||
136 | #elif defined( __aux ) /* 68K */ | ||
137 | /* Unknown */ | ||
138 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
139 | #define DES_UNROLL | ||
140 | #elif defined( __sgi ) /* Newer MIPS */ | ||
141 | #define DES_PTR | ||
142 | #define DES_RISC2 | ||
143 | #define DES_UNROLL | ||
144 | #elif defined( i386 ) /* x86 boxes, should be gcc */ | ||
145 | #define DES_PTR | ||
146 | #define DES_RISC1 | ||
147 | #define DES_UNROLL | ||
148 | #endif /* Systems-specific speed defines */ | ||
149 | #endif | ||
150 | |||
151 | #endif /* DES_DEFAULT_OPTIONS */ | ||
152 | |||
153 | #ifdef MSDOS /* Visual C++ 2.1 (Windows NT/95) */ | ||
154 | #include <stdlib.h> | ||
155 | #include <errno.h> | ||
156 | #include <time.h> | ||
157 | #include <io.h> | ||
158 | #ifndef RAND | ||
159 | #define RAND | ||
160 | #endif | ||
161 | #undef NOPROTO | ||
162 | #endif | ||
163 | |||
164 | #if defined(__STDC__) || defined(VMS) || defined(M_XENIX) || defined(MSDOS) | ||
165 | #include <string.h> | ||
166 | #endif | ||
167 | |||
168 | #ifndef RAND | ||
169 | #define RAND | ||
170 | #endif | ||
171 | |||
172 | #ifdef linux | ||
173 | #undef RAND | ||
174 | #endif | ||
175 | |||
176 | #ifdef MSDOS | ||
177 | #define getpid() 2 | ||
178 | #define RAND | ||
179 | #undef NOPROTO | ||
180 | #endif | ||
181 | |||
182 | #if defined(NOCONST) | ||
183 | #define const | ||
184 | #endif | ||
185 | |||
186 | #ifdef __STDC__ | ||
187 | #undef NOPROTO | ||
188 | #endif | ||
189 | |||
190 | #ifdef RAND | ||
191 | #define srandom(s) srand(s) | ||
192 | #define random rand | ||
193 | #endif | ||
194 | |||
195 | #define ITERATIONS 16 | ||
196 | #define HALF_ITERATIONS 8 | ||
197 | |||
198 | /* used in des_read and des_write */ | ||
199 | #define MAXWRITE (1024*16) | ||
200 | #define BSIZE (MAXWRITE+4) | ||
201 | |||
202 | #define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \ | ||
203 | l|=((DES_LONG)(*((c)++)))<< 8L, \ | ||
204 | l|=((DES_LONG)(*((c)++)))<<16L, \ | ||
205 | l|=((DES_LONG)(*((c)++)))<<24L) | ||
206 | |||
207 | /* NOTE - c is not incremented as per c2l */ | ||
208 | #define c2ln(c,l1,l2,n) { \ | ||
209 | c+=n; \ | ||
210 | l1=l2=0; \ | ||
211 | switch (n) { \ | ||
212 | case 8: l2 =((DES_LONG)(*(--(c))))<<24L; \ | ||
213 | case 7: l2|=((DES_LONG)(*(--(c))))<<16L; \ | ||
214 | case 6: l2|=((DES_LONG)(*(--(c))))<< 8L; \ | ||
215 | case 5: l2|=((DES_LONG)(*(--(c)))); \ | ||
216 | case 4: l1 =((DES_LONG)(*(--(c))))<<24L; \ | ||
217 | case 3: l1|=((DES_LONG)(*(--(c))))<<16L; \ | ||
218 | case 2: l1|=((DES_LONG)(*(--(c))))<< 8L; \ | ||
219 | case 1: l1|=((DES_LONG)(*(--(c)))); \ | ||
220 | } \ | ||
221 | } | ||
222 | |||
223 | #define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ | ||
224 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ | ||
225 | *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ | ||
226 | *((c)++)=(unsigned char)(((l)>>24L)&0xff)) | ||
227 | |||
228 | /* replacements for htonl and ntohl since I have no idea what to do | ||
229 | * when faced with machines with 8 byte longs. */ | ||
230 | #define HDRSIZE 4 | ||
231 | |||
232 | #define n2l(c,l) (l =((DES_LONG)(*((c)++)))<<24L, \ | ||
233 | l|=((DES_LONG)(*((c)++)))<<16L, \ | ||
234 | l|=((DES_LONG)(*((c)++)))<< 8L, \ | ||
235 | l|=((DES_LONG)(*((c)++)))) | ||
236 | |||
237 | #define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ | ||
238 | *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ | ||
239 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ | ||
240 | *((c)++)=(unsigned char)(((l) )&0xff)) | ||
241 | |||
242 | /* NOTE - c is not incremented as per l2c */ | ||
243 | #define l2cn(l1,l2,c,n) { \ | ||
244 | c+=n; \ | ||
245 | switch (n) { \ | ||
246 | case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ | ||
247 | case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ | ||
248 | case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ | ||
249 | case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ | ||
250 | case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ | ||
251 | case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ | ||
252 | case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ | ||
253 | case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ | ||
254 | } \ | ||
255 | } | ||
256 | |||
257 | #if defined(WIN32) | ||
258 | #define ROTATE(a,n) (_lrotr(a,n)) | ||
259 | #else | ||
260 | #define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) | ||
261 | #endif | ||
262 | |||
263 | /* Don't worry about the LOAD_DATA() stuff, that is used by | ||
264 | * fcrypt() to add it's little bit to the front */ | ||
265 | |||
266 | #ifdef DES_FCRYPT | ||
267 | |||
268 | #define LOAD_DATA_tmp(R,S,u,t,E0,E1) \ | ||
269 | { DES_LONG tmp; LOAD_DATA(R,S,u,t,E0,E1,tmp); } | ||
270 | |||
271 | #define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ | ||
272 | t=R^(R>>16L); \ | ||
273 | u=t&E0; t&=E1; \ | ||
274 | tmp=(u<<16); u^=R^s[S ]; u^=tmp; \ | ||
275 | tmp=(t<<16); t^=R^s[S+1]; t^=tmp | ||
276 | #else | ||
277 | #define LOAD_DATA_tmp(a,b,c,d,e,f) LOAD_DATA(a,b,c,d,e,f,g) | ||
278 | #define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ | ||
279 | u=R^s[S ]; \ | ||
280 | t=R^s[S+1] | ||
281 | #endif | ||
282 | |||
283 | /* The changes to this macro may help or hinder, depending on the | ||
284 | * compiler and the achitecture. gcc2 always seems to do well :-). | ||
285 | * Inspired by Dana How <how@isl.stanford.edu> | ||
286 | * DO NOT use the alternative version on machines with 8 byte longs. | ||
287 | * It does not seem to work on the Alpha, even when DES_LONG is 4 | ||
288 | * bytes, probably an issue of accessing non-word aligned objects :-( */ | ||
289 | #ifdef DES_PTR | ||
290 | |||
291 | /* It recently occured to me that 0^0^0^0^0^0^0 == 0, so there | ||
292 | * is no reason to not xor all the sub items together. This potentially | ||
293 | * saves a register since things can be xored directly into L */ | ||
294 | |||
295 | #if defined(DES_RISC1) || defined(DES_RISC2) | ||
296 | #ifdef DES_RISC1 | ||
297 | #define D_ENCRYPT(LL,R,S) { \ | ||
298 | unsigned int u1,u2,u3; \ | ||
299 | LOAD_DATA(R,S,u,t,E0,E1,u1); \ | ||
300 | u2=(int)u>>8L; \ | ||
301 | u1=(int)u&0xfc; \ | ||
302 | u2&=0xfc; \ | ||
303 | t=ROTATE(t,4); \ | ||
304 | u>>=16L; \ | ||
305 | LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \ | ||
306 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \ | ||
307 | u3=(int)(u>>8L); \ | ||
308 | u1=(int)u&0xfc; \ | ||
309 | u3&=0xfc; \ | ||
310 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+u1); \ | ||
311 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+u3); \ | ||
312 | u2=(int)t>>8L; \ | ||
313 | u1=(int)t&0xfc; \ | ||
314 | u2&=0xfc; \ | ||
315 | t>>=16L; \ | ||
316 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \ | ||
317 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \ | ||
318 | u3=(int)t>>8L; \ | ||
319 | u1=(int)t&0xfc; \ | ||
320 | u3&=0xfc; \ | ||
321 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+u1); \ | ||
322 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+u3); } | ||
323 | #endif | ||
324 | #ifdef DES_RISC2 | ||
325 | #define D_ENCRYPT(LL,R,S) { \ | ||
326 | unsigned int u1,u2,s1,s2; \ | ||
327 | LOAD_DATA(R,S,u,t,E0,E1,u1); \ | ||
328 | u2=(int)u>>8L; \ | ||
329 | u1=(int)u&0xfc; \ | ||
330 | u2&=0xfc; \ | ||
331 | t=ROTATE(t,4); \ | ||
332 | LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \ | ||
333 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \ | ||
334 | s1=(int)(u>>16L); \ | ||
335 | s2=(int)(u>>24L); \ | ||
336 | s1&=0xfc; \ | ||
337 | s2&=0xfc; \ | ||
338 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+s1); \ | ||
339 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+s2); \ | ||
340 | u2=(int)t>>8L; \ | ||
341 | u1=(int)t&0xfc; \ | ||
342 | u2&=0xfc; \ | ||
343 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \ | ||
344 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \ | ||
345 | s1=(int)(t>>16L); \ | ||
346 | s2=(int)(t>>24L); \ | ||
347 | s1&=0xfc; \ | ||
348 | s2&=0xfc; \ | ||
349 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+s1); \ | ||
350 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+s2); } | ||
351 | #endif | ||
352 | #else | ||
353 | #define D_ENCRYPT(LL,R,S) { \ | ||
354 | LOAD_DATA_tmp(R,S,u,t,E0,E1); \ | ||
355 | t=ROTATE(t,4); \ | ||
356 | LL^= \ | ||
357 | *(DES_LONG *)((unsigned char *)des_SP +((u )&0xfc))^ \ | ||
358 | *(DES_LONG *)((unsigned char *)des_SP+0x200+((u>> 8L)&0xfc))^ \ | ||
359 | *(DES_LONG *)((unsigned char *)des_SP+0x400+((u>>16L)&0xfc))^ \ | ||
360 | *(DES_LONG *)((unsigned char *)des_SP+0x600+((u>>24L)&0xfc))^ \ | ||
361 | *(DES_LONG *)((unsigned char *)des_SP+0x100+((t )&0xfc))^ \ | ||
362 | *(DES_LONG *)((unsigned char *)des_SP+0x300+((t>> 8L)&0xfc))^ \ | ||
363 | *(DES_LONG *)((unsigned char *)des_SP+0x500+((t>>16L)&0xfc))^ \ | ||
364 | *(DES_LONG *)((unsigned char *)des_SP+0x700+((t>>24L)&0xfc)); } | ||
365 | #endif | ||
366 | |||
367 | #else /* original version */ | ||
368 | |||
369 | #if defined(DES_RISC1) || defined(DES_RISC2) | ||
370 | #ifdef DES_RISC1 | ||
371 | #define D_ENCRYPT(LL,R,S) {\ | ||
372 | unsigned int u1,u2,u3; \ | ||
373 | LOAD_DATA(R,S,u,t,E0,E1,u1); \ | ||
374 | u>>=2L; \ | ||
375 | t=ROTATE(t,6); \ | ||
376 | u2=(int)u>>8L; \ | ||
377 | u1=(int)u&0x3f; \ | ||
378 | u2&=0x3f; \ | ||
379 | u>>=16L; \ | ||
380 | LL^=des_SPtrans[0][u1]; \ | ||
381 | LL^=des_SPtrans[2][u2]; \ | ||
382 | u3=(int)u>>8L; \ | ||
383 | u1=(int)u&0x3f; \ | ||
384 | u3&=0x3f; \ | ||
385 | LL^=des_SPtrans[4][u1]; \ | ||
386 | LL^=des_SPtrans[6][u3]; \ | ||
387 | u2=(int)t>>8L; \ | ||
388 | u1=(int)t&0x3f; \ | ||
389 | u2&=0x3f; \ | ||
390 | t>>=16L; \ | ||
391 | LL^=des_SPtrans[1][u1]; \ | ||
392 | LL^=des_SPtrans[3][u2]; \ | ||
393 | u3=(int)t>>8L; \ | ||
394 | u1=(int)t&0x3f; \ | ||
395 | u3&=0x3f; \ | ||
396 | LL^=des_SPtrans[5][u1]; \ | ||
397 | LL^=des_SPtrans[7][u3]; } | ||
398 | #endif | ||
399 | #ifdef DES_RISC2 | ||
400 | #define D_ENCRYPT(LL,R,S) {\ | ||
401 | unsigned int u1,u2,s1,s2; \ | ||
402 | LOAD_DATA(R,S,u,t,E0,E1,u1); \ | ||
403 | u>>=2L; \ | ||
404 | t=ROTATE(t,6); \ | ||
405 | u2=(int)u>>8L; \ | ||
406 | u1=(int)u&0x3f; \ | ||
407 | u2&=0x3f; \ | ||
408 | LL^=des_SPtrans[0][u1]; \ | ||
409 | LL^=des_SPtrans[2][u2]; \ | ||
410 | s1=(int)u>>16L; \ | ||
411 | s2=(int)u>>24L; \ | ||
412 | s1&=0x3f; \ | ||
413 | s2&=0x3f; \ | ||
414 | LL^=des_SPtrans[4][s1]; \ | ||
415 | LL^=des_SPtrans[6][s2]; \ | ||
416 | u2=(int)t>>8L; \ | ||
417 | u1=(int)t&0x3f; \ | ||
418 | u2&=0x3f; \ | ||
419 | LL^=des_SPtrans[1][u1]; \ | ||
420 | LL^=des_SPtrans[3][u2]; \ | ||
421 | s1=(int)t>>16; \ | ||
422 | s2=(int)t>>24L; \ | ||
423 | s1&=0x3f; \ | ||
424 | s2&=0x3f; \ | ||
425 | LL^=des_SPtrans[5][s1]; \ | ||
426 | LL^=des_SPtrans[7][s2]; } | ||
427 | #endif | ||
428 | |||
429 | #else | ||
430 | |||
431 | #define D_ENCRYPT(LL,R,S) {\ | ||
432 | LOAD_DATA_tmp(R,S,u,t,E0,E1); \ | ||
433 | t=ROTATE(t,4); \ | ||
434 | LL^=\ | ||
435 | des_SPtrans[0][(u>> 2L)&0x3f]^ \ | ||
436 | des_SPtrans[2][(u>>10L)&0x3f]^ \ | ||
437 | des_SPtrans[4][(u>>18L)&0x3f]^ \ | ||
438 | des_SPtrans[6][(u>>26L)&0x3f]^ \ | ||
439 | des_SPtrans[1][(t>> 2L)&0x3f]^ \ | ||
440 | des_SPtrans[3][(t>>10L)&0x3f]^ \ | ||
441 | des_SPtrans[5][(t>>18L)&0x3f]^ \ | ||
442 | des_SPtrans[7][(t>>26L)&0x3f]; } | ||
443 | #endif | ||
444 | #endif | ||
445 | |||
446 | /* IP and FP | ||
447 | * The problem is more of a geometric problem that random bit fiddling. | ||
448 | 0 1 2 3 4 5 6 7 62 54 46 38 30 22 14 6 | ||
449 | 8 9 10 11 12 13 14 15 60 52 44 36 28 20 12 4 | ||
450 | 16 17 18 19 20 21 22 23 58 50 42 34 26 18 10 2 | ||
451 | 24 25 26 27 28 29 30 31 to 56 48 40 32 24 16 8 0 | ||
452 | |||
453 | 32 33 34 35 36 37 38 39 63 55 47 39 31 23 15 7 | ||
454 | 40 41 42 43 44 45 46 47 61 53 45 37 29 21 13 5 | ||
455 | 48 49 50 51 52 53 54 55 59 51 43 35 27 19 11 3 | ||
456 | 56 57 58 59 60 61 62 63 57 49 41 33 25 17 9 1 | ||
457 | |||
458 | The output has been subject to swaps of the form | ||
459 | 0 1 -> 3 1 but the odd and even bits have been put into | ||
460 | 2 3 2 0 | ||
461 | different words. The main trick is to remember that | ||
462 | t=((l>>size)^r)&(mask); | ||
463 | r^=t; | ||
464 | l^=(t<<size); | ||
465 | can be used to swap and move bits between words. | ||
466 | |||
467 | So l = 0 1 2 3 r = 16 17 18 19 | ||
468 | 4 5 6 7 20 21 22 23 | ||
469 | 8 9 10 11 24 25 26 27 | ||
470 | 12 13 14 15 28 29 30 31 | ||
471 | becomes (for size == 2 and mask == 0x3333) | ||
472 | t = 2^16 3^17 -- -- l = 0 1 16 17 r = 2 3 18 19 | ||
473 | 6^20 7^21 -- -- 4 5 20 21 6 7 22 23 | ||
474 | 10^24 11^25 -- -- 8 9 24 25 10 11 24 25 | ||
475 | 14^28 15^29 -- -- 12 13 28 29 14 15 28 29 | ||
476 | |||
477 | Thanks for hints from Richard Outerbridge - he told me IP&FP | ||
478 | could be done in 15 xor, 10 shifts and 5 ands. | ||
479 | When I finally started to think of the problem in 2D | ||
480 | I first got ~42 operations without xors. When I remembered | ||
481 | how to use xors :-) I got it to its final state. | ||
482 | */ | ||
483 | #define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\ | ||
484 | (b)^=(t),\ | ||
485 | (a)^=((t)<<(n))) | ||
486 | |||
487 | #define IP(l,r) \ | ||
488 | { \ | ||
489 | register DES_LONG tt; \ | ||
490 | PERM_OP(r,l,tt, 4,0x0f0f0f0fL); \ | ||
491 | PERM_OP(l,r,tt,16,0x0000ffffL); \ | ||
492 | PERM_OP(r,l,tt, 2,0x33333333L); \ | ||
493 | PERM_OP(l,r,tt, 8,0x00ff00ffL); \ | ||
494 | PERM_OP(r,l,tt, 1,0x55555555L); \ | ||
495 | } | ||
496 | |||
497 | #define FP(l,r) \ | ||
498 | { \ | ||
499 | register DES_LONG tt; \ | ||
500 | PERM_OP(l,r,tt, 1,0x55555555L); \ | ||
501 | PERM_OP(r,l,tt, 8,0x00ff00ffL); \ | ||
502 | PERM_OP(l,r,tt, 2,0x33333333L); \ | ||
503 | PERM_OP(r,l,tt,16,0x0000ffffL); \ | ||
504 | PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \ | ||
505 | } | ||
506 | |||
507 | extern const DES_LONG des_SPtrans[8][64]; | ||
508 | |||
509 | #ifndef NOPROTO | ||
510 | void fcrypt_body(DES_LONG *out,des_key_schedule ks, | ||
511 | DES_LONG Eswap0, DES_LONG Eswap1); | ||
512 | #else | ||
513 | void fcrypt_body(); | ||
514 | #endif | ||
515 | |||
516 | #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 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | @l=( | ||
4 | 0, 1, 2, 3, 4, 5, 6, 7, | ||
5 | 8, 9,10,11,12,13,14,15, | ||
6 | 16,17,18,19,20,21,22,23, | ||
7 | 24,25,26,27,28,29,30,31 | ||
8 | ); | ||
9 | @r=( | ||
10 | 32,33,34,35,36,37,38,39, | ||
11 | 40,41,42,43,44,45,46,47, | ||
12 | 48,49,50,51,52,53,54,55, | ||
13 | 56,57,58,59,60,61,62,63 | ||
14 | ); | ||
15 | |||
16 | require 'shifts.pl'; | ||
17 | |||
18 | sub PERM_OP | ||
19 | { | ||
20 | local(*a,*b,*t,$n,$m)=@_; | ||
21 | |||
22 | @z=&shift(*a,-$n); | ||
23 | @z=&xor(*b,*z); | ||
24 | @z=&and(*z,$m); | ||
25 | @b=&xor(*b,*z); | ||
26 | @z=&shift(*z,$n); | ||
27 | @a=&xor(*a,*z); | ||
28 | } | ||
29 | |||
30 | |||
31 | @L=@l; | ||
32 | @R=@r; | ||
33 | &PERM_OP(*R,*L,*T,4,0x0f0f0f0f); | ||
34 | &PERM_OP(*L,*R,*T,16,0x0000ffff); | ||
35 | &PERM_OP(*R,*L,*T,2,0x33333333); | ||
36 | &PERM_OP(*L,*R,*T,8,0x00ff00ff); | ||
37 | &PERM_OP(*R,*L,*T,1,0x55555555); | ||
38 | &printit(@L); | ||
39 | &printit(@R); | ||
40 | &PERM_OP(*R,*L,*T,1,0x55555555); | ||
41 | &PERM_OP(*L,*R,*T,8,0x00ff00ff); | ||
42 | &PERM_OP(*R,*L,*T,2,0x33333333); | ||
43 | &PERM_OP(*L,*R,*T,16,0x0000ffff); | ||
44 | &PERM_OP(*R,*L,*T,4,0x0f0f0f0f); | ||
45 | &printit(@L); | ||
46 | &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 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | @l=( | ||
4 | 0, 1, 2, 3, 4, 5, 6, 7, | ||
5 | 8, 9,10,11,12,13,14,15, | ||
6 | 16,17,18,19,20,21,22,23, | ||
7 | 24,25,26,27,28,29,30,31 | ||
8 | ); | ||
9 | @r=( | ||
10 | 32,33,34,35,36,37,38,39, | ||
11 | 40,41,42,43,44,45,46,47, | ||
12 | 48,49,50,51,52,53,54,55, | ||
13 | 56,57,58,59,60,61,62,63 | ||
14 | ); | ||
15 | |||
16 | require 'shifts.pl'; | ||
17 | |||
18 | sub PERM_OP | ||
19 | { | ||
20 | local(*a,*b,*t,$n,$m)=@_; | ||
21 | |||
22 | @z=&shift(*a,-$n); | ||
23 | @z=&xor(*b,*z); | ||
24 | @z=&and(*z,$m); | ||
25 | @b=&xor(*b,*z); | ||
26 | @z=&shift(*z,$n); | ||
27 | @a=&xor(*a,*z); | ||
28 | } | ||
29 | |||
30 | sub HPERM_OP2 | ||
31 | { | ||
32 | local(*a,*t,$n,$m)=@_; | ||
33 | local(@x,@y,$i); | ||
34 | |||
35 | @z=&shift(*a,16-$n); | ||
36 | @z=&xor(*a,*z); | ||
37 | @z=&and(*z,$m); | ||
38 | @a=&xor(*a,*z); | ||
39 | @z=&shift(*z,$n-16); | ||
40 | @a=&xor(*a,*z); | ||
41 | } | ||
42 | |||
43 | sub HPERM_OP | ||
44 | { | ||
45 | local(*a,*t,$n,$m)=@_; | ||
46 | local(@x,@y,$i); | ||
47 | |||
48 | for ($i=0; $i<16; $i++) | ||
49 | { | ||
50 | $x[$i]=$a[$i]; | ||
51 | $y[$i]=$a[16+$i]; | ||
52 | } | ||
53 | @z=&shift(*x,-$n); | ||
54 | @z=&xor(*y,*z); | ||
55 | @z=&and(*z,$m); | ||
56 | @y=&xor(*y,*z); | ||
57 | @z=&shift(*z,$n); | ||
58 | @x=&xor(*x,*z); | ||
59 | for ($i=0; $i<16; $i++) | ||
60 | { | ||
61 | $a[$i]=$x[$i]; | ||
62 | $a[16+$i]=$y[$i]; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | @L=@l; | ||
67 | @R=@r; | ||
68 | |||
69 | print "---\n"; &printit(@R); | ||
70 | &PERM_OP(*R,*L,*T,4,0x0f0f0f0f); | ||
71 | print "---\n"; &printit(@R); | ||
72 | &HPERM_OP2(*L,*T,-2,0xcccc0000); | ||
73 | &HPERM_OP2(*R,*T,-2,0xcccc0000); | ||
74 | print "---\n"; &printit(@R); | ||
75 | &PERM_OP(*R,*L,*T,1,0x55555555); | ||
76 | print "---\n"; &printit(@R); | ||
77 | &PERM_OP(*L,*R,*T,8,0x00ff00ff); | ||
78 | print "---\n"; &printit(@R); | ||
79 | &PERM_OP(*R,*L,*T,1,0x55555555); | ||
80 | print "---\n"; &printit(@R); | ||
81 | # &printit(@L); | ||
82 | &printit(@R); | ||
83 | print <<"EOF"; | ||
84 | ============================== | ||
85 | 63 55 47 39 31 23 15 7 | ||
86 | 62 54 46 38 30 22 14 6 | ||
87 | 61 53 45 37 29 21 13 5 | ||
88 | 60 52 44 36 -- -- -- -- | ||
89 | |||
90 | 57 49 41 33 25 17 9 1 | ||
91 | 58 50 42 34 26 18 10 2 | ||
92 | 59 51 43 35 27 19 11 3 | ||
93 | 28 20 12 4 -- -- -- -- | ||
94 | EOF | ||
95 | exit(1); | ||
96 | @A=&and(*R,0x000000ff); | ||
97 | @A=&shift(*A,16); | ||
98 | @B=&and(*R,0x0000ff00); | ||
99 | @C=&and(*R,0x00ff0000); | ||
100 | @C=&shift(*C,-16); | ||
101 | @D=&and(*L,0xf0000000); | ||
102 | @D=&shift(*D,-4); | ||
103 | @A=&or(*A,*B); | ||
104 | @B=&or(*D,*C); | ||
105 | @R=&or(*A,*B); | ||
106 | @L=&and(*L,0x0fffffff); | ||
107 | |||
108 | &printit(@L); | ||
109 | &printit(@R); | ||
110 | |||
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 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | @PC2_C=(14,17,11,24, 1, 5, | ||
4 | 3,28,15, 6,21,10, | ||
5 | 23,19,12, 4,26, 8, | ||
6 | 16, 7,27,20,13, 2, | ||
7 | ); | ||
8 | |||
9 | @PC2_D=(41,52,31,37,47,55, | ||
10 | 30,40,51,45,33,48, | ||
11 | 44,49,39,56,34,53, | ||
12 | 46,42,50,36,29,32, | ||
13 | ); | ||
14 | |||
15 | $i=0; | ||
16 | foreach (@PC2_C) { | ||
17 | $_--; | ||
18 | # printf "%2d,",$_; | ||
19 | $C{$_}=$i; | ||
20 | ++$i; | ||
21 | # print "\n" if ((($i) % 8) == 0); | ||
22 | } | ||
23 | $i=0; | ||
24 | #print "\n"; | ||
25 | foreach (@PC2_D) { | ||
26 | $_-=28; | ||
27 | $_--; | ||
28 | # printf "%2d,",$_; | ||
29 | $D{$_}=$i; | ||
30 | $i++; | ||
31 | # print "\n" if ((($i) % 8) == 0); | ||
32 | } | ||
33 | |||
34 | #print "\n"; | ||
35 | foreach $i (0 .. 27) | ||
36 | { | ||
37 | $_=$C{$i}; | ||
38 | # printf "%2d,",$_; | ||
39 | $i++; | ||
40 | # print "\n" if ((($i) % 8) == 0); | ||
41 | } | ||
42 | #print "\n"; | ||
43 | |||
44 | #print "\n"; | ||
45 | foreach $i (0 .. 27) | ||
46 | { | ||
47 | $_=$D{$i}; | ||
48 | # printf "%2d,",$_; | ||
49 | $i++; | ||
50 | # print "\n" if ((($i) % 8) == 0); | ||
51 | } | ||
52 | #print "\n"; | ||
53 | |||
54 | print "static ulong skb[8][64]={\n"; | ||
55 | &doit("C",*C, 0, 1, 2, 3, 4, 5); | ||
56 | &doit("C",*C, 6, 7, 9,10,11,12); | ||
57 | &doit("C",*C,13,14,15,16,18,19); | ||
58 | &doit("C",*C,20,22,23,25,26,27); | ||
59 | |||
60 | &doit("D",*D, 0, 1, 2, 3, 4, 5); | ||
61 | &doit("D",*D, 7, 8,10,11,12,13); | ||
62 | &doit("D",*D,15,16,17,18,19,20); | ||
63 | &doit("D",*D,21,22,23,24,26,27); | ||
64 | print "};\n"; | ||
65 | |||
66 | sub doit | ||
67 | { | ||
68 | local($l,*A,@b)=@_; | ||
69 | local(@out); | ||
70 | |||
71 | printf("/* for $l bits (numbered as per FIPS 46) %d %d %d %d %d %d */\n", | ||
72 | $b[0]+1, $b[1]+1, $b[2]+1, $b[3]+1, $b[4]+1, $b[5]+1); | ||
73 | for ($i=0; $i<64; $i++) | ||
74 | { | ||
75 | $out[$i]=0; | ||
76 | $j=1; | ||
77 | #print "\n"; | ||
78 | for ($k=0; $k<6; $k++) | ||
79 | { | ||
80 | $l=$A{$b[$k]}; | ||
81 | #print"$l - "; | ||
82 | if ((1<<$k) & $i) | ||
83 | { | ||
84 | $ll=int($l/6)*8+($l%6); | ||
85 | $out[$i]|=1<<($ll); | ||
86 | } | ||
87 | } | ||
88 | $pp=$out[$i]; | ||
89 | $pp=($pp&0xff0000ff)| (($pp&0x00ff0000)>>8)| | ||
90 | (($pp&0x0000ff00)<<8); | ||
91 | printf("0x%08X,",$pp); | ||
92 | print "\n" if (($i+1) % 4 == 0); | ||
93 | } | ||
94 | } | ||
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 @@ | |||
1 | /* crypto/des/ede_enc.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include "des_locl.h" | ||
60 | |||
61 | void des_ede3_cbc_encrypt(input, output, length, ks1, ks2, ks3, ivec, enc) | ||
62 | des_cblock (*input); | ||
63 | des_cblock (*output); | ||
64 | long length; | ||
65 | des_key_schedule ks1; | ||
66 | des_key_schedule ks2; | ||
67 | des_key_schedule ks3; | ||
68 | des_cblock (*ivec); | ||
69 | int enc; | ||
70 | { | ||
71 | register DES_LONG tin0,tin1; | ||
72 | register DES_LONG tout0,tout1,xor0,xor1; | ||
73 | register unsigned char *in,*out; | ||
74 | register long l=length; | ||
75 | DES_LONG tin[2]; | ||
76 | unsigned char *iv; | ||
77 | |||
78 | in=(unsigned char *)input; | ||
79 | out=(unsigned char *)output; | ||
80 | iv=(unsigned char *)ivec; | ||
81 | |||
82 | if (enc) | ||
83 | { | ||
84 | c2l(iv,tout0); | ||
85 | c2l(iv,tout1); | ||
86 | for (l-=8; l>=0; l-=8) | ||
87 | { | ||
88 | c2l(in,tin0); | ||
89 | c2l(in,tin1); | ||
90 | tin0^=tout0; | ||
91 | tin1^=tout1; | ||
92 | |||
93 | tin[0]=tin0; | ||
94 | tin[1]=tin1; | ||
95 | des_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); | ||
96 | tout0=tin[0]; | ||
97 | tout1=tin[1]; | ||
98 | |||
99 | l2c(tout0,out); | ||
100 | l2c(tout1,out); | ||
101 | } | ||
102 | if (l != -8) | ||
103 | { | ||
104 | c2ln(in,tin0,tin1,l+8); | ||
105 | tin0^=tout0; | ||
106 | tin1^=tout1; | ||
107 | |||
108 | tin[0]=tin0; | ||
109 | tin[1]=tin1; | ||
110 | des_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); | ||
111 | tout0=tin[0]; | ||
112 | tout1=tin[1]; | ||
113 | |||
114 | l2c(tout0,out); | ||
115 | l2c(tout1,out); | ||
116 | } | ||
117 | iv=(unsigned char *)ivec; | ||
118 | l2c(tout0,iv); | ||
119 | l2c(tout1,iv); | ||
120 | } | ||
121 | else | ||
122 | { | ||
123 | register DES_LONG t0,t1; | ||
124 | |||
125 | c2l(iv,xor0); | ||
126 | c2l(iv,xor1); | ||
127 | for (l-=8; l>=0; l-=8) | ||
128 | { | ||
129 | c2l(in,tin0); | ||
130 | c2l(in,tin1); | ||
131 | |||
132 | t0=tin0; | ||
133 | t1=tin1; | ||
134 | |||
135 | tin[0]=tin0; | ||
136 | tin[1]=tin1; | ||
137 | des_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); | ||
138 | tout0=tin[0]; | ||
139 | tout1=tin[1]; | ||
140 | |||
141 | tout0^=xor0; | ||
142 | tout1^=xor1; | ||
143 | l2c(tout0,out); | ||
144 | l2c(tout1,out); | ||
145 | xor0=t0; | ||
146 | xor1=t1; | ||
147 | } | ||
148 | if (l != -8) | ||
149 | { | ||
150 | c2l(in,tin0); | ||
151 | c2l(in,tin1); | ||
152 | |||
153 | t0=tin0; | ||
154 | t1=tin1; | ||
155 | |||
156 | tin[0]=tin0; | ||
157 | tin[1]=tin1; | ||
158 | des_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); | ||
159 | tout0=tin[0]; | ||
160 | tout1=tin[1]; | ||
161 | |||
162 | tout0^=xor0; | ||
163 | tout1^=xor1; | ||
164 | l2cn(tout0,tout1,out,l+8); | ||
165 | xor0=t0; | ||
166 | xor1=t1; | ||
167 | } | ||
168 | |||
169 | iv=(unsigned char *)ivec; | ||
170 | l2c(xor0,iv); | ||
171 | l2c(xor1,iv); | ||
172 | } | ||
173 | tin0=tin1=tout0=tout1=xor0=xor1=0; | ||
174 | tin[0]=tin[1]=0; | ||
175 | } | ||
176 | |||
177 | #ifdef undef /* MACRO */ | ||
178 | void des_ede2_cbc_encrypt(input, output, length, ks1, ks2, ivec, enc) | ||
179 | des_cblock (*input); | ||
180 | des_cblock (*output); | ||
181 | long length; | ||
182 | des_key_schedule ks1; | ||
183 | des_key_schedule ks2; | ||
184 | des_cblock (*ivec); | ||
185 | int enc; | ||
186 | { | ||
187 | des_ede3_cbc_encrypt(input,output,length,ks1,ks2,ks1,ivec,enc); | ||
188 | } | ||
189 | #endif | ||
190 | |||
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 @@ | |||
1 | /* crypto/des/podd.h */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | static const unsigned char odd_parity[256]={ | ||
60 | 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, | ||
61 | 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31, | ||
62 | 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47, | ||
63 | 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62, | ||
64 | 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79, | ||
65 | 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94, | ||
66 | 97, 97, 98, 98,100,100,103,103,104,104,107,107,109,109,110,110, | ||
67 | 112,112,115,115,117,117,118,118,121,121,122,122,124,124,127,127, | ||
68 | 128,128,131,131,133,133,134,134,137,137,138,138,140,140,143,143, | ||
69 | 145,145,146,146,148,148,151,151,152,152,155,155,157,157,158,158, | ||
70 | 161,161,162,162,164,164,167,167,168,168,171,171,173,173,174,174, | ||
71 | 176,176,179,179,181,181,182,182,185,185,186,186,188,188,191,191, | ||
72 | 193,193,194,194,196,196,199,199,200,200,203,203,205,205,206,206, | ||
73 | 208,208,211,211,213,213,214,214,217,217,218,218,220,220,223,223, | ||
74 | 224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239, | ||
75 | 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 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cwd=`pwd` | ||
4 | cd /tmp | ||
5 | |||
6 | if [ -s /bin/ranlib ] ; then | ||
7 | RL=/bin/ranlib | ||
8 | else if [ -s /usr/bin/ranlib ] ; then | ||
9 | RL=/usr/bin/ranlib | ||
10 | fi | ||
11 | fi | ||
12 | |||
13 | if [ "x$RL" != "x" ] | ||
14 | then | ||
15 | case "$1" in | ||
16 | /*) | ||
17 | $RL "$1" | ||
18 | ;; | ||
19 | *) | ||
20 | $RL "$cwd/$1" | ||
21 | ;; | ||
22 | esac | ||
23 | 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 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | sub lab_shift | ||
4 | { | ||
5 | local(*a,$n)=@_; | ||
6 | local(@r,$i,$j,$k,$d,@z); | ||
7 | |||
8 | @r=&shift(*a,$n); | ||
9 | foreach $i (0 .. 31) | ||
10 | { | ||
11 | @z=split(/\^/,$r[$i]); | ||
12 | for ($j=0; $j <= $#z; $j++) | ||
13 | { | ||
14 | ($d)=($z[$j] =~ /^(..)/); | ||
15 | ($k)=($z[$j] =~ /\[(.*)\]$/); | ||
16 | $k.=",$n" if ($k ne ""); | ||
17 | $k="$n" if ($k eq ""); | ||
18 | $d="$d[$k]"; | ||
19 | $z[$j]=$d; | ||
20 | } | ||
21 | $r[$i]=join('^',@z); | ||
22 | } | ||
23 | return(@r); | ||
24 | } | ||
25 | |||
26 | sub shift | ||
27 | { | ||
28 | local(*a,$n)=@_; | ||
29 | local(@f); | ||
30 | |||
31 | if ($n > 0) | ||
32 | { | ||
33 | @f=&shiftl(*a,$n); | ||
34 | } | ||
35 | else | ||
36 | { | ||
37 | @f=&shiftr(*a,-$n); | ||
38 | } | ||
39 | return(@f); | ||
40 | } | ||
41 | |||
42 | sub rotate | ||
43 | { | ||
44 | local(*a,$n)=@_; | ||
45 | local(@f); | ||
46 | |||
47 | if ($n > 0) | ||
48 | { @f=&rotatel(*a,$n); } | ||
49 | else | ||
50 | { @f=&rotater(*a,-$n); } | ||
51 | return(@f); | ||
52 | } | ||
53 | |||
54 | sub rotater | ||
55 | { | ||
56 | local(*a,$n)=@_; | ||
57 | local(@f,@g); | ||
58 | |||
59 | @f=&shiftr(*a,$n); | ||
60 | @g=&shiftl(*a,32-$n); | ||
61 | $#f=31; | ||
62 | $#g=31; | ||
63 | return(&or(*f,*g)); | ||
64 | } | ||
65 | |||
66 | sub rotatel | ||
67 | { | ||
68 | local(*a,$n)=@_; | ||
69 | local(@f,@g); | ||
70 | |||
71 | @f=&shiftl(*a,$n); | ||
72 | @g=&shiftr(*a,32-$n); | ||
73 | $#f=31; | ||
74 | $#g=31; | ||
75 | return(&or(*f,*g)); | ||
76 | } | ||
77 | |||
78 | sub shiftr | ||
79 | { | ||
80 | local(*a,$n)=@_; | ||
81 | local(@r,$i); | ||
82 | |||
83 | $#r=31; | ||
84 | foreach $i (0 .. 31) | ||
85 | { | ||
86 | if (($i+$n) > 31) | ||
87 | { | ||
88 | $r[$i]="--"; | ||
89 | } | ||
90 | else | ||
91 | { | ||
92 | $r[$i]=$a[$i+$n]; | ||
93 | } | ||
94 | } | ||
95 | return(@r); | ||
96 | } | ||
97 | |||
98 | sub shiftl | ||
99 | { | ||
100 | local(*a,$n)=@_; | ||
101 | local(@r,$i); | ||
102 | |||
103 | $#r=31; | ||
104 | foreach $i (0 .. 31) | ||
105 | { | ||
106 | if ($i < $n) | ||
107 | { | ||
108 | $r[$i]="--"; | ||
109 | } | ||
110 | else | ||
111 | { | ||
112 | $r[$i]=$a[$i-$n]; | ||
113 | } | ||
114 | } | ||
115 | return(@r); | ||
116 | } | ||
117 | |||
118 | sub printit | ||
119 | { | ||
120 | local(@a)=@_; | ||
121 | local($i); | ||
122 | |||
123 | foreach $i (0 .. 31) | ||
124 | { | ||
125 | printf "%2s ",$a[$i]; | ||
126 | print "\n" if (($i%8) == 7); | ||
127 | } | ||
128 | print "\n"; | ||
129 | } | ||
130 | |||
131 | sub xor | ||
132 | { | ||
133 | local(*a,*b)=@_; | ||
134 | local(@r,$i); | ||
135 | |||
136 | $#r=31; | ||
137 | foreach $i (0 .. 31) | ||
138 | { | ||
139 | $r[$i]=&compress($a[$i].'^'.$b[$i]); | ||
140 | # $r[$i]=$a[$i]."^".$b[$i]; | ||
141 | } | ||
142 | return(@r); | ||
143 | } | ||
144 | |||
145 | sub and | ||
146 | { | ||
147 | local(*a,$m)=@_; | ||
148 | local(@r,$i); | ||
149 | |||
150 | $#r=31; | ||
151 | foreach $i (0 .. 31) | ||
152 | { | ||
153 | $r[$i]=(($m & (1<<$i))?($a[$i]):('--')); | ||
154 | } | ||
155 | return(@r); | ||
156 | } | ||
157 | |||
158 | sub or | ||
159 | { | ||
160 | local(*a,*b)=@_; | ||
161 | local(@r,$i); | ||
162 | |||
163 | $#r=31; | ||
164 | foreach $i (0 .. 31) | ||
165 | { | ||
166 | $r[$i]='--' if (($a[$i] eq '--') && ($b[$i] eq '--')); | ||
167 | $r[$i]=$a[$i] if (($a[$i] ne '--') && ($b[$i] eq '--')); | ||
168 | $r[$i]=$b[$i] if (($a[$i] eq '--') && ($b[$i] ne '--')); | ||
169 | $r[$i]='++' if (($a[$i] ne '--') && ($b[$i] ne '--')); | ||
170 | } | ||
171 | return(@r); | ||
172 | } | ||
173 | |||
174 | sub compress | ||
175 | { | ||
176 | local($s)=@_; | ||
177 | local($_,$i,@a,%a,$r); | ||
178 | |||
179 | $s =~ s/\^\^/\^/g; | ||
180 | $s =~ s/^\^//; | ||
181 | $s =~ s/\^$//; | ||
182 | @a=split(/\^/,$s); | ||
183 | |||
184 | while ($#a >= 0) | ||
185 | { | ||
186 | $_=shift(@a); | ||
187 | next unless /\d/; | ||
188 | $a{$_}++; | ||
189 | } | ||
190 | foreach $i (sort keys %a) | ||
191 | { | ||
192 | next if ($a{$i}%2 == 0); | ||
193 | $r.="$i^"; | ||
194 | } | ||
195 | chop($r); | ||
196 | return($r); | ||
197 | } | ||
198 | 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 @@ | |||
1 | /* crypto/des/sk.h */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | static const DES_LONG des_skb[8][64]={ | ||
60 | { | ||
61 | /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ | ||
62 | 0x00000000L,0x00000010L,0x20000000L,0x20000010L, | ||
63 | 0x00010000L,0x00010010L,0x20010000L,0x20010010L, | ||
64 | 0x00000800L,0x00000810L,0x20000800L,0x20000810L, | ||
65 | 0x00010800L,0x00010810L,0x20010800L,0x20010810L, | ||
66 | 0x00000020L,0x00000030L,0x20000020L,0x20000030L, | ||
67 | 0x00010020L,0x00010030L,0x20010020L,0x20010030L, | ||
68 | 0x00000820L,0x00000830L,0x20000820L,0x20000830L, | ||
69 | 0x00010820L,0x00010830L,0x20010820L,0x20010830L, | ||
70 | 0x00080000L,0x00080010L,0x20080000L,0x20080010L, | ||
71 | 0x00090000L,0x00090010L,0x20090000L,0x20090010L, | ||
72 | 0x00080800L,0x00080810L,0x20080800L,0x20080810L, | ||
73 | 0x00090800L,0x00090810L,0x20090800L,0x20090810L, | ||
74 | 0x00080020L,0x00080030L,0x20080020L,0x20080030L, | ||
75 | 0x00090020L,0x00090030L,0x20090020L,0x20090030L, | ||
76 | 0x00080820L,0x00080830L,0x20080820L,0x20080830L, | ||
77 | 0x00090820L,0x00090830L,0x20090820L,0x20090830L, | ||
78 | },{ | ||
79 | /* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ | ||
80 | 0x00000000L,0x02000000L,0x00002000L,0x02002000L, | ||
81 | 0x00200000L,0x02200000L,0x00202000L,0x02202000L, | ||
82 | 0x00000004L,0x02000004L,0x00002004L,0x02002004L, | ||
83 | 0x00200004L,0x02200004L,0x00202004L,0x02202004L, | ||
84 | 0x00000400L,0x02000400L,0x00002400L,0x02002400L, | ||
85 | 0x00200400L,0x02200400L,0x00202400L,0x02202400L, | ||
86 | 0x00000404L,0x02000404L,0x00002404L,0x02002404L, | ||
87 | 0x00200404L,0x02200404L,0x00202404L,0x02202404L, | ||
88 | 0x10000000L,0x12000000L,0x10002000L,0x12002000L, | ||
89 | 0x10200000L,0x12200000L,0x10202000L,0x12202000L, | ||
90 | 0x10000004L,0x12000004L,0x10002004L,0x12002004L, | ||
91 | 0x10200004L,0x12200004L,0x10202004L,0x12202004L, | ||
92 | 0x10000400L,0x12000400L,0x10002400L,0x12002400L, | ||
93 | 0x10200400L,0x12200400L,0x10202400L,0x12202400L, | ||
94 | 0x10000404L,0x12000404L,0x10002404L,0x12002404L, | ||
95 | 0x10200404L,0x12200404L,0x10202404L,0x12202404L, | ||
96 | },{ | ||
97 | /* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ | ||
98 | 0x00000000L,0x00000001L,0x00040000L,0x00040001L, | ||
99 | 0x01000000L,0x01000001L,0x01040000L,0x01040001L, | ||
100 | 0x00000002L,0x00000003L,0x00040002L,0x00040003L, | ||
101 | 0x01000002L,0x01000003L,0x01040002L,0x01040003L, | ||
102 | 0x00000200L,0x00000201L,0x00040200L,0x00040201L, | ||
103 | 0x01000200L,0x01000201L,0x01040200L,0x01040201L, | ||
104 | 0x00000202L,0x00000203L,0x00040202L,0x00040203L, | ||
105 | 0x01000202L,0x01000203L,0x01040202L,0x01040203L, | ||
106 | 0x08000000L,0x08000001L,0x08040000L,0x08040001L, | ||
107 | 0x09000000L,0x09000001L,0x09040000L,0x09040001L, | ||
108 | 0x08000002L,0x08000003L,0x08040002L,0x08040003L, | ||
109 | 0x09000002L,0x09000003L,0x09040002L,0x09040003L, | ||
110 | 0x08000200L,0x08000201L,0x08040200L,0x08040201L, | ||
111 | 0x09000200L,0x09000201L,0x09040200L,0x09040201L, | ||
112 | 0x08000202L,0x08000203L,0x08040202L,0x08040203L, | ||
113 | 0x09000202L,0x09000203L,0x09040202L,0x09040203L, | ||
114 | },{ | ||
115 | /* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ | ||
116 | 0x00000000L,0x00100000L,0x00000100L,0x00100100L, | ||
117 | 0x00000008L,0x00100008L,0x00000108L,0x00100108L, | ||
118 | 0x00001000L,0x00101000L,0x00001100L,0x00101100L, | ||
119 | 0x00001008L,0x00101008L,0x00001108L,0x00101108L, | ||
120 | 0x04000000L,0x04100000L,0x04000100L,0x04100100L, | ||
121 | 0x04000008L,0x04100008L,0x04000108L,0x04100108L, | ||
122 | 0x04001000L,0x04101000L,0x04001100L,0x04101100L, | ||
123 | 0x04001008L,0x04101008L,0x04001108L,0x04101108L, | ||
124 | 0x00020000L,0x00120000L,0x00020100L,0x00120100L, | ||
125 | 0x00020008L,0x00120008L,0x00020108L,0x00120108L, | ||
126 | 0x00021000L,0x00121000L,0x00021100L,0x00121100L, | ||
127 | 0x00021008L,0x00121008L,0x00021108L,0x00121108L, | ||
128 | 0x04020000L,0x04120000L,0x04020100L,0x04120100L, | ||
129 | 0x04020008L,0x04120008L,0x04020108L,0x04120108L, | ||
130 | 0x04021000L,0x04121000L,0x04021100L,0x04121100L, | ||
131 | 0x04021008L,0x04121008L,0x04021108L,0x04121108L, | ||
132 | },{ | ||
133 | /* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ | ||
134 | 0x00000000L,0x10000000L,0x00010000L,0x10010000L, | ||
135 | 0x00000004L,0x10000004L,0x00010004L,0x10010004L, | ||
136 | 0x20000000L,0x30000000L,0x20010000L,0x30010000L, | ||
137 | 0x20000004L,0x30000004L,0x20010004L,0x30010004L, | ||
138 | 0x00100000L,0x10100000L,0x00110000L,0x10110000L, | ||
139 | 0x00100004L,0x10100004L,0x00110004L,0x10110004L, | ||
140 | 0x20100000L,0x30100000L,0x20110000L,0x30110000L, | ||
141 | 0x20100004L,0x30100004L,0x20110004L,0x30110004L, | ||
142 | 0x00001000L,0x10001000L,0x00011000L,0x10011000L, | ||
143 | 0x00001004L,0x10001004L,0x00011004L,0x10011004L, | ||
144 | 0x20001000L,0x30001000L,0x20011000L,0x30011000L, | ||
145 | 0x20001004L,0x30001004L,0x20011004L,0x30011004L, | ||
146 | 0x00101000L,0x10101000L,0x00111000L,0x10111000L, | ||
147 | 0x00101004L,0x10101004L,0x00111004L,0x10111004L, | ||
148 | 0x20101000L,0x30101000L,0x20111000L,0x30111000L, | ||
149 | 0x20101004L,0x30101004L,0x20111004L,0x30111004L, | ||
150 | },{ | ||
151 | /* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ | ||
152 | 0x00000000L,0x08000000L,0x00000008L,0x08000008L, | ||
153 | 0x00000400L,0x08000400L,0x00000408L,0x08000408L, | ||
154 | 0x00020000L,0x08020000L,0x00020008L,0x08020008L, | ||
155 | 0x00020400L,0x08020400L,0x00020408L,0x08020408L, | ||
156 | 0x00000001L,0x08000001L,0x00000009L,0x08000009L, | ||
157 | 0x00000401L,0x08000401L,0x00000409L,0x08000409L, | ||
158 | 0x00020001L,0x08020001L,0x00020009L,0x08020009L, | ||
159 | 0x00020401L,0x08020401L,0x00020409L,0x08020409L, | ||
160 | 0x02000000L,0x0A000000L,0x02000008L,0x0A000008L, | ||
161 | 0x02000400L,0x0A000400L,0x02000408L,0x0A000408L, | ||
162 | 0x02020000L,0x0A020000L,0x02020008L,0x0A020008L, | ||
163 | 0x02020400L,0x0A020400L,0x02020408L,0x0A020408L, | ||
164 | 0x02000001L,0x0A000001L,0x02000009L,0x0A000009L, | ||
165 | 0x02000401L,0x0A000401L,0x02000409L,0x0A000409L, | ||
166 | 0x02020001L,0x0A020001L,0x02020009L,0x0A020009L, | ||
167 | 0x02020401L,0x0A020401L,0x02020409L,0x0A020409L, | ||
168 | },{ | ||
169 | /* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ | ||
170 | 0x00000000L,0x00000100L,0x00080000L,0x00080100L, | ||
171 | 0x01000000L,0x01000100L,0x01080000L,0x01080100L, | ||
172 | 0x00000010L,0x00000110L,0x00080010L,0x00080110L, | ||
173 | 0x01000010L,0x01000110L,0x01080010L,0x01080110L, | ||
174 | 0x00200000L,0x00200100L,0x00280000L,0x00280100L, | ||
175 | 0x01200000L,0x01200100L,0x01280000L,0x01280100L, | ||
176 | 0x00200010L,0x00200110L,0x00280010L,0x00280110L, | ||
177 | 0x01200010L,0x01200110L,0x01280010L,0x01280110L, | ||
178 | 0x00000200L,0x00000300L,0x00080200L,0x00080300L, | ||
179 | 0x01000200L,0x01000300L,0x01080200L,0x01080300L, | ||
180 | 0x00000210L,0x00000310L,0x00080210L,0x00080310L, | ||
181 | 0x01000210L,0x01000310L,0x01080210L,0x01080310L, | ||
182 | 0x00200200L,0x00200300L,0x00280200L,0x00280300L, | ||
183 | 0x01200200L,0x01200300L,0x01280200L,0x01280300L, | ||
184 | 0x00200210L,0x00200310L,0x00280210L,0x00280310L, | ||
185 | 0x01200210L,0x01200310L,0x01280210L,0x01280310L, | ||
186 | },{ | ||
187 | /* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ | ||
188 | 0x00000000L,0x04000000L,0x00040000L,0x04040000L, | ||
189 | 0x00000002L,0x04000002L,0x00040002L,0x04040002L, | ||
190 | 0x00002000L,0x04002000L,0x00042000L,0x04042000L, | ||
191 | 0x00002002L,0x04002002L,0x00042002L,0x04042002L, | ||
192 | 0x00000020L,0x04000020L,0x00040020L,0x04040020L, | ||
193 | 0x00000022L,0x04000022L,0x00040022L,0x04040022L, | ||
194 | 0x00002020L,0x04002020L,0x00042020L,0x04042020L, | ||
195 | 0x00002022L,0x04002022L,0x00042022L,0x04042022L, | ||
196 | 0x00000800L,0x04000800L,0x00040800L,0x04040800L, | ||
197 | 0x00000802L,0x04000802L,0x00040802L,0x04040802L, | ||
198 | 0x00002800L,0x04002800L,0x00042800L,0x04042800L, | ||
199 | 0x00002802L,0x04002802L,0x00042802L,0x04042802L, | ||
200 | 0x00000820L,0x04000820L,0x00040820L,0x04040820L, | ||
201 | 0x00000822L,0x04000822L,0x00040822L,0x04040822L, | ||
202 | 0x00002820L,0x04002820L,0x00042820L,0x04042820L, | ||
203 | 0x00002822L,0x04002822L,0x00042822L,0x04042822L, | ||
204 | }}; | ||
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 @@ | |||
1 | /* crypto/des/supp.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* | ||
60 | * Copyright (c) 1995 | ||
61 | * Mark Murray. All rights reserved. | ||
62 | * | ||
63 | * Redistribution and use in source and binary forms, with or without | ||
64 | * modification, are permitted provided that the following conditions | ||
65 | * are met: | ||
66 | * 1. Redistributions of source code must retain the above copyright | ||
67 | * notice, this list of conditions and the following disclaimer. | ||
68 | * 2. Redistributions in binary form must reproduce the above copyright | ||
69 | * notice, this list of conditions and the following disclaimer in the | ||
70 | * documentation and/or other materials provided with the distribution. | ||
71 | * 3. All advertising materials mentioning features or use of this software | ||
72 | * must display the following acknowledgement: | ||
73 | * This product includes software developed by Mark Murray | ||
74 | * 4. Neither the name of the author nor the names of any co-contributors | ||
75 | * may be used to endorse or promote products derived from this software | ||
76 | * without specific prior written permission. | ||
77 | * | ||
78 | * THIS SOFTWARE IS PROVIDED BY MARK MURRAY AND CONTRIBUTORS ``AS IS'' AND | ||
79 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
80 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
81 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
82 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
83 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
84 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
85 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
86 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
87 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
88 | * SUCH DAMAGE. | ||
89 | * | ||
90 | * $Id: supp.c,v 1.1.1.1 1998/10/05 20:12:45 ryker Exp $ | ||
91 | */ | ||
92 | |||
93 | #include <stdio.h> | ||
94 | #include "des_locl.h" | ||
95 | |||
96 | void des_cblock_print_file(cb, fp) | ||
97 | des_cblock *cb; | ||
98 | FILE *fp; | ||
99 | { | ||
100 | int i; | ||
101 | unsigned int *p = (unsigned int *)cb; | ||
102 | |||
103 | fprintf(fp, " 0x { "); | ||
104 | for (i = 0; i < 8; i++) { | ||
105 | fprintf(fp, "%x", p[i]); | ||
106 | if (i != 7) fprintf(fp, ", "); | ||
107 | } | ||
108 | fprintf(fp, " }"); | ||
109 | } | ||
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 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | # des.pl tesing code | ||
4 | |||
5 | require 'des.pl'; | ||
6 | |||
7 | $num_tests=34; | ||
8 | @key_data=( | ||
9 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
10 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, | ||
11 | 0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
12 | 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, | ||
13 | 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, | ||
14 | 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, | ||
15 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
16 | 0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10, | ||
17 | 0x7C,0xA1,0x10,0x45,0x4A,0x1A,0x6E,0x57, | ||
18 | 0x01,0x31,0xD9,0x61,0x9D,0xC1,0x37,0x6E, | ||
19 | 0x07,0xA1,0x13,0x3E,0x4A,0x0B,0x26,0x86, | ||
20 | 0x38,0x49,0x67,0x4C,0x26,0x02,0x31,0x9E, | ||
21 | 0x04,0xB9,0x15,0xBA,0x43,0xFE,0xB5,0xB6, | ||
22 | 0x01,0x13,0xB9,0x70,0xFD,0x34,0xF2,0xCE, | ||
23 | 0x01,0x70,0xF1,0x75,0x46,0x8F,0xB5,0xE6, | ||
24 | 0x43,0x29,0x7F,0xAD,0x38,0xE3,0x73,0xFE, | ||
25 | 0x07,0xA7,0x13,0x70,0x45,0xDA,0x2A,0x16, | ||
26 | 0x04,0x68,0x91,0x04,0xC2,0xFD,0x3B,0x2F, | ||
27 | 0x37,0xD0,0x6B,0xB5,0x16,0xCB,0x75,0x46, | ||
28 | 0x1F,0x08,0x26,0x0D,0x1A,0xC2,0x46,0x5E, | ||
29 | 0x58,0x40,0x23,0x64,0x1A,0xBA,0x61,0x76, | ||
30 | 0x02,0x58,0x16,0x16,0x46,0x29,0xB0,0x07, | ||
31 | 0x49,0x79,0x3E,0xBC,0x79,0xB3,0x25,0x8F, | ||
32 | 0x4F,0xB0,0x5E,0x15,0x15,0xAB,0x73,0xA7, | ||
33 | 0x49,0xE9,0x5D,0x6D,0x4C,0xA2,0x29,0xBF, | ||
34 | 0x01,0x83,0x10,0xDC,0x40,0x9B,0x26,0xD6, | ||
35 | 0x1C,0x58,0x7F,0x1C,0x13,0x92,0x4F,0xEF, | ||
36 | 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, | ||
37 | 0x1F,0x1F,0x1F,0x1F,0x0E,0x0E,0x0E,0x0E, | ||
38 | 0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE, | ||
39 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
40 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, | ||
41 | 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, | ||
42 | 0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10, | ||
43 | ); | ||
44 | |||
45 | @plain_data=( | ||
46 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
47 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, | ||
48 | 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x01, | ||
49 | 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, | ||
50 | 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, | ||
51 | 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, | ||
52 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
53 | 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, | ||
54 | 0x01,0xA1,0xD6,0xD0,0x39,0x77,0x67,0x42, | ||
55 | 0x5C,0xD5,0x4C,0xA8,0x3D,0xEF,0x57,0xDA, | ||
56 | 0x02,0x48,0xD4,0x38,0x06,0xF6,0x71,0x72, | ||
57 | 0x51,0x45,0x4B,0x58,0x2D,0xDF,0x44,0x0A, | ||
58 | 0x42,0xFD,0x44,0x30,0x59,0x57,0x7F,0xA2, | ||
59 | 0x05,0x9B,0x5E,0x08,0x51,0xCF,0x14,0x3A, | ||
60 | 0x07,0x56,0xD8,0xE0,0x77,0x47,0x61,0xD2, | ||
61 | 0x76,0x25,0x14,0xB8,0x29,0xBF,0x48,0x6A, | ||
62 | 0x3B,0xDD,0x11,0x90,0x49,0x37,0x28,0x02, | ||
63 | 0x26,0x95,0x5F,0x68,0x35,0xAF,0x60,0x9A, | ||
64 | 0x16,0x4D,0x5E,0x40,0x4F,0x27,0x52,0x32, | ||
65 | 0x6B,0x05,0x6E,0x18,0x75,0x9F,0x5C,0xCA, | ||
66 | 0x00,0x4B,0xD6,0xEF,0x09,0x17,0x60,0x62, | ||
67 | 0x48,0x0D,0x39,0x00,0x6E,0xE7,0x62,0xF2, | ||
68 | 0x43,0x75,0x40,0xC8,0x69,0x8F,0x3C,0xFA, | ||
69 | 0x07,0x2D,0x43,0xA0,0x77,0x07,0x52,0x92, | ||
70 | 0x02,0xFE,0x55,0x77,0x81,0x17,0xF1,0x2A, | ||
71 | 0x1D,0x9D,0x5C,0x50,0x18,0xF7,0x28,0xC2, | ||
72 | 0x30,0x55,0x32,0x28,0x6D,0x6F,0x29,0x5A, | ||
73 | 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, | ||
74 | 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, | ||
75 | 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, | ||
76 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, | ||
77 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
78 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
79 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF); | ||
80 | |||
81 | @cipher_data=( | ||
82 | 0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7, | ||
83 | 0x73,0x59,0xB2,0x16,0x3E,0x4E,0xDC,0x58, | ||
84 | 0x95,0x8E,0x6E,0x62,0x7A,0x05,0x55,0x7B, | ||
85 | 0xF4,0x03,0x79,0xAB,0x9E,0x0E,0xC5,0x33, | ||
86 | 0x17,0x66,0x8D,0xFC,0x72,0x92,0x53,0x2D, | ||
87 | 0x8A,0x5A,0xE1,0xF8,0x1A,0xB8,0xF2,0xDD, | ||
88 | 0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7, | ||
89 | 0xED,0x39,0xD9,0x50,0xFA,0x74,0xBC,0xC4, | ||
90 | 0x69,0x0F,0x5B,0x0D,0x9A,0x26,0x93,0x9B, | ||
91 | 0x7A,0x38,0x9D,0x10,0x35,0x4B,0xD2,0x71, | ||
92 | 0x86,0x8E,0xBB,0x51,0xCA,0xB4,0x59,0x9A, | ||
93 | 0x71,0x78,0x87,0x6E,0x01,0xF1,0x9B,0x2A, | ||
94 | 0xAF,0x37,0xFB,0x42,0x1F,0x8C,0x40,0x95, | ||
95 | 0x86,0xA5,0x60,0xF1,0x0E,0xC6,0xD8,0x5B, | ||
96 | 0x0C,0xD3,0xDA,0x02,0x00,0x21,0xDC,0x09, | ||
97 | 0xEA,0x67,0x6B,0x2C,0xB7,0xDB,0x2B,0x7A, | ||
98 | 0xDF,0xD6,0x4A,0x81,0x5C,0xAF,0x1A,0x0F, | ||
99 | 0x5C,0x51,0x3C,0x9C,0x48,0x86,0xC0,0x88, | ||
100 | 0x0A,0x2A,0xEE,0xAE,0x3F,0xF4,0xAB,0x77, | ||
101 | 0xEF,0x1B,0xF0,0x3E,0x5D,0xFA,0x57,0x5A, | ||
102 | 0x88,0xBF,0x0D,0xB6,0xD7,0x0D,0xEE,0x56, | ||
103 | 0xA1,0xF9,0x91,0x55,0x41,0x02,0x0B,0x56, | ||
104 | 0x6F,0xBF,0x1C,0xAF,0xCF,0xFD,0x05,0x56, | ||
105 | 0x2F,0x22,0xE4,0x9B,0xAB,0x7C,0xA1,0xAC, | ||
106 | 0x5A,0x6B,0x61,0x2C,0xC2,0x6C,0xCE,0x4A, | ||
107 | 0x5F,0x4C,0x03,0x8E,0xD1,0x2B,0x2E,0x41, | ||
108 | 0x63,0xFA,0xC0,0xD0,0x34,0xD9,0xF7,0x93, | ||
109 | 0x61,0x7B,0x3A,0x0C,0xE8,0xF0,0x71,0x00, | ||
110 | 0xDB,0x95,0x86,0x05,0xF8,0xC8,0xC6,0x06, | ||
111 | 0xED,0xBF,0xD1,0xC6,0x6C,0x29,0xCC,0xC7, | ||
112 | 0x35,0x55,0x50,0xB2,0x15,0x0E,0x24,0x51, | ||
113 | 0xCA,0xAA,0xAF,0x4D,0xEA,0xF1,0xDB,0xAE, | ||
114 | 0xD5,0xD4,0x4F,0xF7,0x20,0x68,0x3D,0x0D, | ||
115 | 0x2A,0x2B,0xB0,0x08,0xDF,0x97,0xC2,0xF2); | ||
116 | |||
117 | print "Doing ecb tests\n"; | ||
118 | for ($i=0; $i<$num_tests; $i++) | ||
119 | { | ||
120 | printf "Doing test $i\n"; | ||
121 | $key =pack("C8",splice(@key_data ,0,8)); | ||
122 | $data=pack("C8",splice(@plain_data ,0,8)); | ||
123 | $res =pack("C8",splice(@cipher_data,0,8)); | ||
124 | |||
125 | @ks= &des_set_key($key); | ||
126 | $out1= &des_ecb_encrypt(*ks,1,$data); | ||
127 | $out2= &des_ecb_encrypt(*ks,0,$out1); | ||
128 | $out3= &des_ecb_encrypt(*ks,0,$res); | ||
129 | &eprint("encryption failure",$res,$out1) | ||
130 | if ($out1 ne $res); | ||
131 | &eprint("encryption/decryption failure",$data,$out2) | ||
132 | if ($out2 ne $data); | ||
133 | &eprint("decryption failure",$data,$out3) | ||
134 | if ($data ne $out3); | ||
135 | } | ||
136 | print "Done\n"; | ||
137 | |||
138 | print "doing speed test over 30 seconds\n"; | ||
139 | $SIG{'ALRM'}='done'; | ||
140 | sub done {$done=1;} | ||
141 | $done=0; | ||
142 | |||
143 | $count=0; | ||
144 | $d=pack("C8",0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef); | ||
145 | @ks= &des_set_key($d); | ||
146 | alarm(30); | ||
147 | $start=(times)[0]; | ||
148 | while (!$done) | ||
149 | { | ||
150 | $count++; | ||
151 | $d=&des_ecb_encrypt(*ks,1,$d); | ||
152 | } | ||
153 | $end=(times)[0]; | ||
154 | $t=$end-$start; | ||
155 | printf "$count DESs in %.2f seconds is %.2f DESs/sec or %.2f bytes/sec\n", | ||
156 | 1.0*$t,1.0*$count/$t,$count*8.0/$t; | ||
157 | |||
158 | sub eprint | ||
159 | { | ||
160 | local($s,$c,$e)=@_; | ||
161 | local(@k); | ||
162 | |||
163 | @k=unpack("C8",$c); | ||
164 | printf "%02x%02x%02x%02x %02x%02x%02x%02x - ",unpack("C8",$c); | ||
165 | printf "%02x%02x%02x%02x %02x%02x%02x%02x :",unpack("C8",$e); | ||
166 | print " $s\n"; | ||
167 | } | ||
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 @@ | |||
1 | $! --- VMS.com --- | ||
2 | $! | ||
3 | $ GoSub defines | ||
4 | $ GoSub linker_options | ||
5 | $ If (P1 .nes. "") | ||
6 | $ Then | ||
7 | $ GoSub 'P1' | ||
8 | $ Else | ||
9 | $ GoSub lib | ||
10 | $ GoSub destest | ||
11 | $ GoSub rpw | ||
12 | $ GoSub speed | ||
13 | $ GoSub des | ||
14 | $ EndIF | ||
15 | $! | ||
16 | $ Exit | ||
17 | $! | ||
18 | $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
19 | $! | ||
20 | $DEFINES: | ||
21 | $ OPT_FILE := "VAX_LINKER_OPTIONS.OPT" | ||
22 | $! | ||
23 | $ CC_OPTS := "/NODebug/OPTimize/NOWarn" | ||
24 | $! | ||
25 | $ LINK_OPTS := "/NODebug/NOTraceback/Contiguous" | ||
26 | $! | ||
27 | $ OBJS = "cbc_cksm.obj,cbc_enc.obj,ecb_enc.obj,pcbc_enc.obj," + - | ||
28 | "qud_cksm.obj,rand_key.obj,read_pwd.obj,set_key.obj," + - | ||
29 | "str2key.obj,enc_read.obj,enc_writ.obj,fcrypt.obj," + - | ||
30 | "cfb_enc.obj,ecb3_enc.obj,ofb_enc.obj" | ||
31 | |||
32 | |||
33 | $! | ||
34 | $ LIBDES = "cbc_cksm.c,cbc_enc.c,ecb_enc.c,enc_read.c," + - | ||
35 | "enc_writ.c,pcbc_enc.c,qud_cksm.c,rand_key.c," + - | ||
36 | "read_pwd.c,set_key.c,str2key.c,fcrypt.c," + - | ||
37 | "cfb_enc.c,ecb3_enc.c,ofb_enc.c" | ||
38 | $ Return | ||
39 | $! | ||
40 | $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
41 | $! | ||
42 | $LINKER_OPTIONS: | ||
43 | $ If (f$search(OPT_FILE) .eqs. "") | ||
44 | $ Then | ||
45 | $ Create 'OPT_FILE' | ||
46 | $DECK | ||
47 | ! Default system options file to link against the sharable C runtime library | ||
48 | ! | ||
49 | Sys$Share:VAXcRTL.exe/Share | ||
50 | $EOD | ||
51 | $ EndIF | ||
52 | $ Return | ||
53 | $! | ||
54 | $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
55 | $! | ||
56 | $LIB: | ||
57 | $ CC 'CC_OPTS' 'LIBDES' | ||
58 | $ If (f$search("LIBDES.OLB") .nes. "") | ||
59 | $ Then Library /Object /Replace libdes 'OBJS' | ||
60 | $ Else Library /Create /Object libdes 'OBJS' | ||
61 | $ EndIF | ||
62 | $ Return | ||
63 | $! | ||
64 | $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
65 | $! | ||
66 | $DESTEST: | ||
67 | $ CC 'CC_OPTS' destest | ||
68 | $ Link 'link_opts' /Exec=destest destest.obj,libdes/LIBRARY,'opt_file'/Option | ||
69 | $ Return | ||
70 | $! | ||
71 | $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
72 | $! | ||
73 | $RPW: | ||
74 | $ CC 'CC_OPTS' rpw | ||
75 | $ Link 'link_opts' /Exec=rpw rpw.obj,libdes/LIBRARY,'opt_file'/Option | ||
76 | $ Return | ||
77 | $! | ||
78 | $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
79 | $! | ||
80 | $SPEED: | ||
81 | $ CC 'CC_OPTS' speed | ||
82 | $ Link 'link_opts' /Exec=speed speed.obj,libdes/LIBRARY,'opt_file'/Option | ||
83 | $ Return | ||
84 | $! | ||
85 | $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
86 | $! | ||
87 | $DES: | ||
88 | $ CC 'CC_OPTS' des | ||
89 | $ Link 'link_opts' /Exec=des des.obj,libdes/LIBRARY,'opt_file'/Option | ||
90 | $ Return | ||
diff --git a/src/lib/libcrypto/dh/Makefile.ssl b/src/lib/libcrypto/dh/Makefile.ssl new file mode 100644 index 0000000000..dfa7e4525d --- /dev/null +++ b/src/lib/libcrypto/dh/Makefile.ssl | |||
@@ -0,0 +1,84 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/dh/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= dh | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | ERR=dh | ||
19 | ERRC=dh_err | ||
20 | GENERAL=Makefile | ||
21 | TEST= dhtest.c | ||
22 | APPS= | ||
23 | |||
24 | LIB=$(TOP)/libcrypto.a | ||
25 | LIBSRC= dh_gen.c dh_key.c dh_lib.c dh_check.c $(ERRC).c | ||
26 | LIBOBJ= dh_gen.o dh_key.o dh_lib.o dh_check.o $(ERRC).o | ||
27 | |||
28 | SRC= $(LIBSRC) | ||
29 | |||
30 | EXHEADER= dh.h | ||
31 | HEADER= $(EXHEADER) | ||
32 | |||
33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
34 | |||
35 | top: | ||
36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
37 | |||
38 | all: lib | ||
39 | |||
40 | lib: $(LIBOBJ) | ||
41 | $(AR) $(LIB) $(LIBOBJ) | ||
42 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
43 | @touch lib | ||
44 | |||
45 | files: | ||
46 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
47 | |||
48 | links: | ||
49 | /bin/rm -f Makefile | ||
50 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
51 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
52 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
53 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
54 | |||
55 | install: | ||
56 | @for i in $(EXHEADER) ; \ | ||
57 | do \ | ||
58 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
59 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
60 | done; | ||
61 | |||
62 | tags: | ||
63 | ctags $(SRC) | ||
64 | |||
65 | tests: | ||
66 | |||
67 | lint: | ||
68 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
69 | |||
70 | depend: | ||
71 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
72 | |||
73 | dclean: | ||
74 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
75 | mv -f Makefile.new $(MAKEFILE) | ||
76 | |||
77 | clean: | ||
78 | /bin/rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
79 | |||
80 | errors: | ||
81 | perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h | ||
82 | perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c | ||
83 | |||
84 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | /* Error codes for the DH functions. */ | ||
2 | |||
3 | /* Function codes. */ | ||
4 | #define DH_F_DHPARAMS_PRINT 100 | ||
5 | #define DH_F_DHPARAMS_PRINT_FP 101 | ||
6 | #define DH_F_DH_COMPUTE_KEY 102 | ||
7 | #define DH_F_DH_GENERATE_KEY 103 | ||
8 | #define DH_F_DH_GENERATE_PARAMETERS 104 | ||
9 | #define DH_F_DH_NEW 105 | ||
10 | |||
11 | /* Reason codes. */ | ||
12 | #define DH_R_NO_PRIVATE_VALUE 100 | ||
diff --git a/src/lib/libcrypto/dsa/Makefile.ssl b/src/lib/libcrypto/dsa/Makefile.ssl new file mode 100644 index 0000000000..2cc4ddb39e --- /dev/null +++ b/src/lib/libcrypto/dsa/Makefile.ssl | |||
@@ -0,0 +1,84 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/dsa/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= dsa | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | ERR=dsa | ||
19 | ERRC=dsa_err | ||
20 | GENERAL=Makefile | ||
21 | TEST=dsatest.c | ||
22 | APPS= | ||
23 | |||
24 | LIB=$(TOP)/libcrypto.a | ||
25 | LIBSRC= dsa_gen.c dsa_key.c dsa_lib.c dsa_vrf.c dsa_sign.c $(ERRC).c | ||
26 | LIBOBJ= dsa_gen.o dsa_key.o dsa_lib.o dsa_vrf.o dsa_sign.o $(ERRC).o | ||
27 | |||
28 | SRC= $(LIBSRC) | ||
29 | |||
30 | EXHEADER= dsa.h | ||
31 | HEADER= $(EXHEADER) | ||
32 | |||
33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
34 | |||
35 | top: | ||
36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
37 | |||
38 | all: lib | ||
39 | |||
40 | lib: $(LIBOBJ) | ||
41 | $(AR) $(LIB) $(LIBOBJ) | ||
42 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
43 | @touch lib | ||
44 | |||
45 | files: | ||
46 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
47 | |||
48 | links: | ||
49 | /bin/rm -f Makefile | ||
50 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
51 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
52 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
53 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
54 | |||
55 | install: | ||
56 | @for i in $(EXHEADER) ; \ | ||
57 | do \ | ||
58 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
59 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
60 | done; | ||
61 | |||
62 | tags: | ||
63 | ctags $(SRC) | ||
64 | |||
65 | tests: | ||
66 | |||
67 | lint: | ||
68 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
69 | |||
70 | depend: | ||
71 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
72 | |||
73 | dclean: | ||
74 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
75 | mv -f Makefile.new $(MAKEFILE) | ||
76 | |||
77 | clean: | ||
78 | /bin/rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
79 | |||
80 | errors: | ||
81 | perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h | ||
82 | perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c | ||
83 | |||
84 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | /* Error codes for the DSA functions. */ | ||
2 | |||
3 | /* Function codes. */ | ||
4 | #define DSA_F_DSAPARAMS_PRINT 100 | ||
5 | #define DSA_F_DSAPARAMS_PRINT_FP 101 | ||
6 | #define DSA_F_DSA_IS_PRIME 102 | ||
7 | #define DSA_F_DSA_NEW 103 | ||
8 | #define DSA_F_DSA_PRINT 104 | ||
9 | #define DSA_F_DSA_PRINT_FP 105 | ||
10 | #define DSA_F_DSA_SIGN 106 | ||
11 | #define DSA_F_DSA_SIGN_SETUP 107 | ||
12 | #define DSA_F_DSA_VERIFY 108 | ||
13 | |||
14 | /* Reason codes. */ | ||
15 | #define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100 | ||
diff --git a/src/lib/libcrypto/err/Makefile.ssl b/src/lib/libcrypto/err/Makefile.ssl new file mode 100644 index 0000000000..57c87eb041 --- /dev/null +++ b/src/lib/libcrypto/err/Makefile.ssl | |||
@@ -0,0 +1,80 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/err/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= err | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | GENERAL=Makefile | ||
19 | TEST= | ||
20 | APPS= | ||
21 | |||
22 | LIB=$(TOP)/libcrypto.a | ||
23 | LIBSRC=err.c err_all.c err_prn.c | ||
24 | LIBOBJ=err.o err_all.o err_prn.o | ||
25 | |||
26 | SRC= $(LIBSRC) | ||
27 | |||
28 | EXHEADER= err.h | ||
29 | HEADER= $(EXHEADER) | ||
30 | |||
31 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
32 | |||
33 | top: | ||
34 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
35 | |||
36 | all: lib | ||
37 | |||
38 | lib: $(LIBOBJ) | ||
39 | $(AR) $(LIB) $(LIBOBJ) | ||
40 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
41 | @touch lib | ||
42 | |||
43 | files: | ||
44 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
45 | |||
46 | links: | ||
47 | /bin/rm -f Makefile | ||
48 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
49 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
50 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
51 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
52 | |||
53 | install: | ||
54 | @for i in $(EXHEADER) ; \ | ||
55 | do \ | ||
56 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
57 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
58 | done; | ||
59 | |||
60 | tags: | ||
61 | ctags $(SRC) | ||
62 | |||
63 | tests: | ||
64 | |||
65 | lint: | ||
66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
67 | |||
68 | depend: | ||
69 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
70 | |||
71 | dclean: | ||
72 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
73 | mv -f Makefile.new $(MAKEFILE) | ||
74 | |||
75 | clean: | ||
76 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
77 | |||
78 | errors: | ||
79 | |||
80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | while (@ARGV) | ||
4 | { | ||
5 | $in=shift(@ARGV); | ||
6 | if ($in =~ /^-conf$/) | ||
7 | { | ||
8 | $in=shift(@ARGV); | ||
9 | open(IN,"<$in") || die "unable to open '$in'\n"; | ||
10 | while (<IN>) | ||
11 | { | ||
12 | s/#.*$//; | ||
13 | s/\s+$//; | ||
14 | next if (/^$/); | ||
15 | if (/^L\s+(\S+)\s+(\S+)$/) | ||
16 | { $errfile{$1}=$2; } | ||
17 | elsif (/^F\s+(\S+)$/) | ||
18 | { $function{$1}=1; } | ||
19 | elsif (/^R\s+(\S+)\s+(\S+)$/) | ||
20 | { $r_value{$1}=$2; } | ||
21 | else { die "bad input line: $in:$.\n"; } | ||
22 | } | ||
23 | close(IN); | ||
24 | next; | ||
25 | } | ||
26 | |||
27 | open(IN,"<$in") || die "unable to open '$in'\n"; | ||
28 | $last=""; | ||
29 | while (<IN>) | ||
30 | { | ||
31 | if (/err\(([A-Z0-9]+_F_[0-9A-Z_]+)\s*,\s*([0-9A-Z]+_R_[0-9A-Z_]+)\s*\)/) | ||
32 | { | ||
33 | if ($1 != $last) | ||
34 | { | ||
35 | if ($function{$1} == 0) | ||
36 | { | ||
37 | printf STDERR "$. $1 is bad\n"; | ||
38 | } | ||
39 | } | ||
40 | $function{$1}++; | ||
41 | $last=$1; | ||
42 | $reason{$2}++; | ||
43 | } | ||
44 | } | ||
45 | close(IN); | ||
46 | } | ||
47 | |||
48 | foreach (keys %function,keys %reason) | ||
49 | { | ||
50 | /^([A-Z0-9]+)_/; | ||
51 | $prefix{$1}++; | ||
52 | } | ||
53 | |||
54 | @F=sort keys %function; | ||
55 | @R=sort keys %reason; | ||
56 | foreach $j (sort keys %prefix) | ||
57 | { | ||
58 | next if $errfile{$j} eq "NONE"; | ||
59 | printf STDERR "doing %-6s - ",$j; | ||
60 | if (defined($errfile{$j})) | ||
61 | { | ||
62 | open(OUT,">$errfile{$j}") || | ||
63 | die "unable to open '$errfile{$j}':$!\n"; | ||
64 | $close_file=1; | ||
65 | } | ||
66 | else | ||
67 | { | ||
68 | *OUT=*STDOUT; | ||
69 | $close=0; | ||
70 | } | ||
71 | @f=grep(/^${j}_/,@F); | ||
72 | @r=grep(/^${j}_/,@R); | ||
73 | $num=100; | ||
74 | print OUT "/* Error codes for the $j functions. */\n\n"; | ||
75 | print OUT "/* Function codes. */\n"; | ||
76 | $f_count=0; | ||
77 | foreach $i (@f) | ||
78 | { | ||
79 | $z=6-int(length($i)/8); | ||
80 | printf OUT "#define $i%s $num\n","\t" x $z; | ||
81 | $num++; | ||
82 | $f_count++; | ||
83 | } | ||
84 | $num=100; | ||
85 | print OUT "\n/* Reason codes. */\n"; | ||
86 | $r_count=0; | ||
87 | foreach $i (@r) | ||
88 | { | ||
89 | $z=6-int(length($i)/8); | ||
90 | if (defined($r_value{$i})) | ||
91 | { | ||
92 | printf OUT "#define $i%s $r_value{$i}\n","\t" x $z; | ||
93 | } | ||
94 | else | ||
95 | { | ||
96 | printf OUT "#define $i%s $num\n","\t" x $z; | ||
97 | $num++; | ||
98 | } | ||
99 | $r_count++; | ||
100 | } | ||
101 | close(OUT) if $close_file; | ||
102 | |||
103 | printf STDERR "%3d functions, %3d reasons\n",$f_count,$r_count; | ||
104 | } | ||
105 | |||
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 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | if ($ARGV[0] eq "-s") { $static=1; shift @ARGV; } | ||
4 | |||
5 | ($#ARGV == 1) || die "usage: $0 [-s] <header file> <output C file>\n"; | ||
6 | open(IN,"<$ARGV[0]") || die "unable to open $ARGV[0]:$!\n"; | ||
7 | open(STDOUT,">$ARGV[1]") || die "unable to open $ARGV[1]:$!\n"; | ||
8 | |||
9 | $Func=0; | ||
10 | $Reas=0; | ||
11 | $fuction{'FOPEN'}='fopen'; | ||
12 | while (<IN>) | ||
13 | { | ||
14 | if (/(\S+)\s*\(\);/) | ||
15 | { | ||
16 | $t=$1; | ||
17 | $t =~ s/\*//; | ||
18 | ($upper=$t) =~ tr/a-z/A-Z/; | ||
19 | $fuction{$upper}=$t; | ||
20 | } | ||
21 | next unless (/^#define\s+(\S+)\s/); | ||
22 | |||
23 | $o=$1; | ||
24 | if ($o =~ /^([^_]+)_F_(.*)/) | ||
25 | { | ||
26 | $type=$1; | ||
27 | $Func++; | ||
28 | $n=$2; | ||
29 | $n=$fuction{$n} if (defined($fuction{$n})); | ||
30 | $out{$1."_str_functs"}.= | ||
31 | sprintf("{ERR_PACK(0,%s,0),\t\"$n\"},\n",$o); | ||
32 | } | ||
33 | elsif ($o =~ /^([^_]+)_R_(.*)/) | ||
34 | { | ||
35 | $type=$1; | ||
36 | $Reas++; | ||
37 | $r=$2; | ||
38 | $r =~ tr/A-Z_/a-z /; | ||
39 | $pkg{$type."_str_reasons"}=$type; | ||
40 | $out{$type."_str_reasons"}.=sprintf("{%-40s,\"$r\"},\n",$o); | ||
41 | } | ||
42 | elsif ($ARGV[0] =~ /rsaref/ && $o =~ /^RE_(.*)/) | ||
43 | { | ||
44 | $type="RSAREF"; | ||
45 | $Reas++; | ||
46 | $r=$1; | ||
47 | $r =~ tr/A-Z_/a-z /; | ||
48 | $pkg{$type."_str_reasons"}=$type; | ||
49 | $out{$type."_str_reasons"}.=sprintf("{%-40s,\"$r\"},\n",$o); | ||
50 | } | ||
51 | } | ||
52 | close(IN); | ||
53 | |||
54 | &header($type,$ARGV[0]); | ||
55 | |||
56 | foreach (sort keys %out) | ||
57 | { | ||
58 | print "static ERR_STRING_DATA ${_}[]=\n\t{\n"; | ||
59 | print $out{$_}; | ||
60 | print "{0,NULL},\n"; | ||
61 | print "\t};\n\n"; | ||
62 | } | ||
63 | print "#endif\n"; | ||
64 | |||
65 | if ($static) | ||
66 | { $lib="ERR_LIB_$type"; } | ||
67 | else | ||
68 | { $lib="${type}_lib_error_code"; } | ||
69 | |||
70 | $str=""; | ||
71 | $str.="#ifndef NO_ERR\n"; | ||
72 | $str.="\t\tERR_load_strings($lib,${type}_str_functs);\n" if $Func; | ||
73 | $str.="\t\tERR_load_strings($lib,${type}_str_reasons);\n" if $Reas; | ||
74 | $str.="#endif\n"; | ||
75 | |||
76 | if (!$static) | ||
77 | { | ||
78 | print <<"EOF"; | ||
79 | |||
80 | static int ${type}_lib_error_code=0; | ||
81 | |||
82 | void ERR_load_${type}_strings() | ||
83 | { | ||
84 | static int init=1; | ||
85 | |||
86 | if (${type}_lib_error_code == 0) | ||
87 | ${type}_lib_error_code=ERR_get_next_error_library(); | ||
88 | |||
89 | if (init); | ||
90 | {; | ||
91 | init=0; | ||
92 | $str | ||
93 | } | ||
94 | } | ||
95 | |||
96 | void ERR_${type}_error(function,reason,file,line) | ||
97 | int function; | ||
98 | int reason; | ||
99 | char *file; | ||
100 | int line; | ||
101 | { | ||
102 | if (${type}_lib_error_code == 0) | ||
103 | ${type}_lib_error_code=ERR_get_next_error_library(); | ||
104 | ERR_PUT_error(${type}_lib_error_code,function,reason,file,line); | ||
105 | } | ||
106 | EOF | ||
107 | } | ||
108 | else # $static | ||
109 | { | ||
110 | print <<"EOF"; | ||
111 | |||
112 | void ERR_load_${type}_strings() | ||
113 | { | ||
114 | static int init=1; | ||
115 | |||
116 | if (init); | ||
117 | {; | ||
118 | init=0; | ||
119 | $str | ||
120 | } | ||
121 | } | ||
122 | EOF | ||
123 | } | ||
124 | |||
125 | sub header | ||
126 | { | ||
127 | ($type,$header)=@_; | ||
128 | |||
129 | ($lc=$type) =~ tr/A-Z/a-z/; | ||
130 | $header =~ s/^.*\///; | ||
131 | |||
132 | print "/* lib/$lc/${lc}\_err.c */\n"; | ||
133 | print <<'EOF'; | ||
134 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | ||
135 | * All rights reserved. | ||
136 | * | ||
137 | * This package is an SSL implementation written | ||
138 | * by Eric Young (eay@cryptsoft.com). | ||
139 | * The implementation was written so as to conform with Netscapes SSL. | ||
140 | * | ||
141 | * This library is free for commercial and non-commercial use as long as | ||
142 | * the following conditions are aheared to. The following conditions | ||
143 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
144 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
145 | * included with this distribution is covered by the same copyright terms | ||
146 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
147 | * | ||
148 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
149 | * the code are not to be removed. | ||
150 | * If this package is used in a product, Eric Young should be given attribution | ||
151 | * as the author of the parts of the library used. | ||
152 | * This can be in the form of a textual message at program startup or | ||
153 | * in documentation (online or textual) provided with the package. | ||
154 | * | ||
155 | * Redistribution and use in source and binary forms, with or without | ||
156 | * modification, are permitted provided that the following conditions | ||
157 | * are met: | ||
158 | * 1. Redistributions of source code must retain the copyright | ||
159 | * notice, this list of conditions and the following disclaimer. | ||
160 | * 2. Redistributions in binary form must reproduce the above copyright | ||
161 | * notice, this list of conditions and the following disclaimer in the | ||
162 | * documentation and/or other materials provided with the distribution. | ||
163 | * 3. All advertising materials mentioning features or use of this software | ||
164 | * must display the following acknowledgement: | ||
165 | * "This product includes cryptographic software written by | ||
166 | * Eric Young (eay@cryptsoft.com)" | ||
167 | * The word 'cryptographic' can be left out if the rouines from the library | ||
168 | * being used are not cryptographic related :-). | ||
169 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
170 | * the apps directory (application code) you must include an acknowledgement: | ||
171 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
172 | * | ||
173 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
174 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
175 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
176 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
177 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
178 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
179 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
180 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
181 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
182 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
183 | * SUCH DAMAGE. | ||
184 | * | ||
185 | * The licence and distribution terms for any publically available version or | ||
186 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
187 | * copied and put under another distribution licence | ||
188 | * [including the GNU Public Licence.] | ||
189 | */ | ||
190 | EOF | ||
191 | |||
192 | print "#include <stdio.h>\n"; | ||
193 | print "#include \"err.h\"\n"; | ||
194 | print "#include \"$header\"\n"; | ||
195 | print "\n/* BEGIN ERROR CODES */\n"; | ||
196 | print "#ifndef NO_ERR\n"; | ||
197 | } | ||
198 | |||
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 @@ | |||
1 | /* Error codes for the ERR functions. */ | ||
2 | |||
3 | /* Function codes. */ | ||
4 | |||
5 | /* Reason codes. */ | ||
6 | #define ERR_R_BN_LIB 100 | ||
7 | #define ERR_R_DER_LIB 101 | ||
8 | #define ERR_R_MALLOC_FAILURE 102 | ||
9 | #define ERR_R_PEM_LIB 103 | ||
10 | #define ERR_R_RSA_LIB 104 | ||
11 | #define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED 105 | ||
12 | #define ERR_R_SYS_LIB 106 | ||
13 | #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 @@ | |||
1 | L ERR NONE | ||
2 | L CRYPTO crypto.err | ||
3 | L BN bn/bn.err | ||
4 | L RSA rsa/rsa.err | ||
5 | L DSA dsa/dsa.err | ||
6 | L DH dh/dh.err | ||
7 | L EVP evp/evp.err | ||
8 | L BUF buffer/buffer.err | ||
9 | L BIO bio/bio.err | ||
10 | L OBJ objects/objects.err | ||
11 | L PEM pem/pem.err | ||
12 | L X509 x509/x509.err | ||
13 | L METH meth/meth.err | ||
14 | L ASN1 asn1/asn1.err | ||
15 | L CONF conf/conf.err | ||
16 | L PROXY proxy/proxy.err | ||
17 | L PKCS7 pkcs7/pkcs7.err | ||
18 | L RSAREF ../rsaref/rsaref.err | ||
19 | L SSL ../ssl/ssl.err | ||
20 | L SSL2 ../ssl/ssl2.err | ||
21 | L SSL3 ../ssl/ssl3.err | ||
22 | L SSL23 ../ssl/ssl23.err | ||
23 | |||
24 | F RSAREF_F_RSA_BN2BIN | ||
25 | F RSAREF_F_RSA_PRIVATE_DECRYPT | ||
26 | F RSAREF_F_RSA_PRIVATE_ENCRYPT | ||
27 | F RSAREF_F_RSA_PUBLIC_DECRYPT | ||
28 | F RSAREF_F_RSA_PUBLIC_ENCRYPT | ||
29 | #F SSL_F_CLIENT_CERTIFICATE | ||
30 | |||
31 | R SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 | ||
32 | R SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 | ||
33 | R SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 | ||
34 | R SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 | ||
35 | R SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 | ||
36 | R SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 | ||
37 | R SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 | ||
38 | R SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 | ||
39 | R SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 | ||
40 | R SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 | ||
41 | R SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 | ||
42 | |||
43 | R RSAREF_R_CONTENT_ENCODING 0x0400 | ||
44 | R RSAREF_R_DATA 0x0401 | ||
45 | R RSAREF_R_DIGEST_ALGORITHM 0x0402 | ||
46 | R RSAREF_R_ENCODING 0x0403 | ||
47 | R RSAREF_R_KEY 0x0404 | ||
48 | R RSAREF_R_KEY_ENCODING 0x0405 | ||
49 | R RSAREF_R_LEN 0x0406 | ||
50 | R RSAREF_R_MODULUS_LEN 0x0407 | ||
51 | R RSAREF_R_NEED_RANDOM 0x0408 | ||
52 | R RSAREF_R_PRIVATE_KEY 0x0409 | ||
53 | R RSAREF_R_PUBLIC_KEY 0x040a | ||
54 | R RSAREF_R_SIGNATURE 0x040b | ||
55 | R RSAREF_R_SIGNATURE_ENCODING 0x040c | ||
56 | R RSAREF_R_ENCRYPTION_ALGORITHM 0x040d | ||
57 | |||
diff --git a/src/lib/libcrypto/evp/Makefile.ssl b/src/lib/libcrypto/evp/Makefile.ssl new file mode 100644 index 0000000000..8bf2516458 --- /dev/null +++ b/src/lib/libcrypto/evp/Makefile.ssl | |||
@@ -0,0 +1,111 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/evp/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= evp | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | ERR=evp | ||
19 | ERRC=evp_err | ||
20 | GENERAL=Makefile | ||
21 | TEST= | ||
22 | APPS= | ||
23 | |||
24 | LIB=$(TOP)/libcrypto.a | ||
25 | LIBSRC= encode.c digest.c evp_enc.c evp_key.c \ | ||
26 | e_ecb_d.c e_cbc_d.c e_cfb_d.c e_ofb_d.c \ | ||
27 | e_ecb_i.c e_cbc_i.c e_cfb_i.c e_ofb_i.c \ | ||
28 | e_ecb_3d.c e_cbc_3d.c e_rc4.c names.c \ | ||
29 | e_cfb_3d.c e_ofb_3d.c e_xcbc_d.c \ | ||
30 | e_ecb_r2.c e_cbc_r2.c e_cfb_r2.c e_ofb_r2.c \ | ||
31 | e_ecb_bf.c e_cbc_bf.c e_cfb_bf.c e_ofb_bf.c \ | ||
32 | e_ecb_c.c e_cbc_c.c e_cfb_c.c e_ofb_c.c \ | ||
33 | e_ecb_r5.c e_cbc_r5.c e_cfb_r5.c e_ofb_r5.c \ | ||
34 | m_null.c m_md2.c m_md5.c m_sha.c m_sha1.c m_dss.c m_dss1.c m_mdc2.c \ | ||
35 | m_ripemd.c \ | ||
36 | p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \ | ||
37 | bio_md.c bio_b64.c bio_enc.c $(ERRC).c e_null.c \ | ||
38 | c_all.c evp_lib.c | ||
39 | |||
40 | LIBOBJ= encode.o digest.o evp_enc.o evp_key.o \ | ||
41 | e_ecb_d.o e_cbc_d.o e_cfb_d.o e_ofb_d.o \ | ||
42 | e_ecb_i.o e_cbc_i.o e_cfb_i.o e_ofb_i.o \ | ||
43 | e_ecb_3d.o e_cbc_3d.o e_rc4.o names.o \ | ||
44 | e_cfb_3d.o e_ofb_3d.o e_xcbc_d.o \ | ||
45 | e_ecb_r2.o e_cbc_r2.o e_cfb_r2.o e_ofb_r2.o \ | ||
46 | e_ecb_bf.o e_cbc_bf.o e_cfb_bf.o e_ofb_bf.o \ | ||
47 | e_ecb_c.o e_cbc_c.o e_cfb_c.o e_ofb_c.o \ | ||
48 | e_ecb_r5.o e_cbc_r5.o e_cfb_r5.o e_ofb_r5.o \ | ||
49 | m_null.o m_md2.o m_md5.o m_sha.o m_sha1.o m_dss.o m_dss1.o m_mdc2.o \ | ||
50 | m_ripemd.o \ | ||
51 | p_open.o p_seal.o p_sign.o p_verify.o p_lib.o p_enc.o p_dec.o \ | ||
52 | bio_md.o bio_b64.o bio_enc.o $(ERRC).o e_null.o \ | ||
53 | c_all.o evp_lib.o | ||
54 | |||
55 | SRC= $(LIBSRC) | ||
56 | |||
57 | EXHEADER= evp.h | ||
58 | HEADER= $(EXHEADER) | ||
59 | |||
60 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
61 | |||
62 | top: | ||
63 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
64 | |||
65 | all: lib | ||
66 | |||
67 | lib: $(LIBOBJ) | ||
68 | $(AR) $(LIB) $(LIBOBJ) | ||
69 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
70 | @touch lib | ||
71 | |||
72 | files: | ||
73 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
74 | |||
75 | links: | ||
76 | /bin/rm -f Makefile | ||
77 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
78 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
79 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
80 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
81 | |||
82 | install: | ||
83 | @for i in $(EXHEADER) ; \ | ||
84 | do \ | ||
85 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
86 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
87 | done; | ||
88 | |||
89 | tags: | ||
90 | ctags $(SRC) | ||
91 | |||
92 | tests: | ||
93 | |||
94 | lint: | ||
95 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
96 | |||
97 | depend: | ||
98 | $(MAKEDEPEND) $(INCLUDES) $(LIBSRC) | ||
99 | |||
100 | dclean: | ||
101 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
102 | mv -f Makefile.new $(MAKEFILE) | ||
103 | |||
104 | clean: | ||
105 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
106 | |||
107 | errors: | ||
108 | perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h | ||
109 | perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c | ||
110 | |||
111 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | /* crypto/evp/e_cbc_3d.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "evp.h" | ||
62 | #include "objects.h" | ||
63 | |||
64 | #ifndef NOPROTO | ||
65 | static void des_cbc_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
66 | unsigned char *iv,int enc); | ||
67 | static void des_cbc_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void des_cbc_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void des_cbc_ede_init_key(); | ||
73 | static void des_cbc_ede3_init_key(); | ||
74 | static void des_cbc_ede_cipher(); | ||
75 | #endif | ||
76 | |||
77 | static EVP_CIPHER d_cbc_ede_cipher2= | ||
78 | { | ||
79 | NID_des_ede_cbc, | ||
80 | 8,16,8, | ||
81 | des_cbc_ede_init_key, | ||
82 | des_cbc_ede_cipher, | ||
83 | NULL, | ||
84 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
85 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), | ||
86 | EVP_CIPHER_get_asn1_iv, | ||
87 | EVP_CIPHER_set_asn1_iv, | ||
88 | }; | ||
89 | |||
90 | static EVP_CIPHER d_cbc_ede_cipher3= | ||
91 | { | ||
92 | NID_des_ede3_cbc, | ||
93 | 8,24,8, | ||
94 | des_cbc_ede3_init_key, | ||
95 | des_cbc_ede_cipher, | ||
96 | NULL, | ||
97 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
98 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), | ||
99 | EVP_CIPHER_set_asn1_iv, | ||
100 | EVP_CIPHER_get_asn1_iv, | ||
101 | }; | ||
102 | |||
103 | EVP_CIPHER *EVP_des_ede_cbc() | ||
104 | { | ||
105 | return(&d_cbc_ede_cipher2); | ||
106 | } | ||
107 | |||
108 | EVP_CIPHER *EVP_des_ede3_cbc() | ||
109 | { | ||
110 | return(&d_cbc_ede_cipher3); | ||
111 | } | ||
112 | |||
113 | static void des_cbc_ede_init_key(ctx,key,iv,enc) | ||
114 | EVP_CIPHER_CTX *ctx; | ||
115 | unsigned char *key; | ||
116 | unsigned char *iv; | ||
117 | int enc; | ||
118 | { | ||
119 | if (iv != NULL) | ||
120 | memcpy(&(ctx->oiv[0]),iv,8); | ||
121 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
122 | |||
123 | if (key != NULL) | ||
124 | { | ||
125 | des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); | ||
126 | des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); | ||
127 | memcpy( (char *)ctx->c.des_ede.ks3, | ||
128 | (char *)ctx->c.des_ede.ks1, | ||
129 | sizeof(ctx->c.des_ede.ks1)); | ||
130 | } | ||
131 | } | ||
132 | |||
133 | static void des_cbc_ede3_init_key(ctx,key,iv,enc) | ||
134 | EVP_CIPHER_CTX *ctx; | ||
135 | unsigned char *key; | ||
136 | unsigned char *iv; | ||
137 | int enc; | ||
138 | { | ||
139 | if (iv != NULL) | ||
140 | memcpy(&(ctx->oiv[0]),iv,8); | ||
141 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
142 | |||
143 | if (key != NULL) | ||
144 | { | ||
145 | des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); | ||
146 | des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); | ||
147 | des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); | ||
148 | } | ||
149 | } | ||
150 | |||
151 | static void des_cbc_ede_cipher(ctx,out,in,inl) | ||
152 | EVP_CIPHER_CTX *ctx; | ||
153 | unsigned char *out; | ||
154 | unsigned char *in; | ||
155 | unsigned int inl; | ||
156 | { | ||
157 | des_ede3_cbc_encrypt( | ||
158 | (des_cblock *)in,(des_cblock *)out, | ||
159 | (long)inl, ctx->c.des_ede.ks1, | ||
160 | ctx->c.des_ede.ks2,ctx->c.des_ede.ks3, | ||
161 | (des_cblock *)&(ctx->iv[0]), | ||
162 | ctx->encrypt); | ||
163 | } | ||
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 @@ | |||
1 | /* crypto/evp/e_cbc_bf.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_BLOWFISH | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void bf_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void bf_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void bf_cbc_init_key(); | ||
73 | static void bf_cbc_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER bfish_cbc_cipher= | ||
77 | { | ||
78 | NID_bf_cbc, | ||
79 | 8,EVP_BLOWFISH_KEY_SIZE,8, | ||
80 | bf_cbc_init_key, | ||
81 | bf_cbc_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), | ||
85 | EVP_CIPHER_get_asn1_iv, | ||
86 | EVP_CIPHER_set_asn1_iv, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_bf_cbc() | ||
90 | { | ||
91 | return(&bfish_cbc_cipher); | ||
92 | } | ||
93 | |||
94 | static void bf_cbc_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | if (iv != NULL) | ||
101 | memcpy(&(ctx->oiv[0]),iv,8); | ||
102 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
103 | if (key != NULL) | ||
104 | BF_set_key(&(ctx->c.bf_ks),EVP_BLOWFISH_KEY_SIZE,key); | ||
105 | } | ||
106 | |||
107 | static void bf_cbc_cipher(ctx,out,in,inl) | ||
108 | EVP_CIPHER_CTX *ctx; | ||
109 | unsigned char *out; | ||
110 | unsigned char *in; | ||
111 | unsigned int inl; | ||
112 | { | ||
113 | BF_cbc_encrypt( | ||
114 | in,out,(long)inl, | ||
115 | &(ctx->c.bf_ks),&(ctx->iv[0]), | ||
116 | ctx->encrypt); | ||
117 | } | ||
118 | |||
119 | #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 @@ | |||
1 | /* crypto/evp/e_cbc_c.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_CAST | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void cast_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void cast_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void cast_cbc_init_key(); | ||
73 | static void cast_cbc_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER cast5_cbc_cipher= | ||
77 | { | ||
78 | NID_cast5_cbc, | ||
79 | 8,EVP_CAST5_KEY_SIZE,8, | ||
80 | cast_cbc_init_key, | ||
81 | cast_cbc_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), | ||
85 | EVP_CIPHER_get_asn1_iv, | ||
86 | EVP_CIPHER_set_asn1_iv, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_cast5_cbc() | ||
90 | { | ||
91 | return(&cast5_cbc_cipher); | ||
92 | } | ||
93 | |||
94 | static void cast_cbc_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | if (iv != NULL) | ||
101 | memcpy(&(ctx->oiv[0]),iv,8); | ||
102 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
103 | if (key != NULL) | ||
104 | CAST_set_key(&(ctx->c.cast_ks),EVP_CAST5_KEY_SIZE,key); | ||
105 | } | ||
106 | |||
107 | static void cast_cbc_cipher(ctx,out,in,inl) | ||
108 | EVP_CIPHER_CTX *ctx; | ||
109 | unsigned char *out; | ||
110 | unsigned char *in; | ||
111 | unsigned int inl; | ||
112 | { | ||
113 | CAST_cbc_encrypt( | ||
114 | in,out,(long)inl, | ||
115 | &(ctx->c.cast_ks),&(ctx->iv[0]), | ||
116 | ctx->encrypt); | ||
117 | } | ||
118 | |||
119 | #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 @@ | |||
1 | /* crypto/evp/e_cbc_d.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "evp.h" | ||
62 | #include "objects.h" | ||
63 | |||
64 | #ifndef NOPROTO | ||
65 | static void des_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
66 | unsigned char *iv,int enc); | ||
67 | static void des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
68 | unsigned char *in, unsigned int inl); | ||
69 | #else | ||
70 | static void des_cbc_init_key(); | ||
71 | static void des_cbc_cipher(); | ||
72 | #endif | ||
73 | |||
74 | static EVP_CIPHER d_cbc_cipher= | ||
75 | { | ||
76 | NID_des_cbc, | ||
77 | 8,8,8, | ||
78 | des_cbc_init_key, | ||
79 | des_cbc_cipher, | ||
80 | NULL, | ||
81 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
82 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), | ||
83 | EVP_CIPHER_get_asn1_iv, | ||
84 | EVP_CIPHER_set_asn1_iv, | ||
85 | }; | ||
86 | |||
87 | EVP_CIPHER *EVP_des_cbc() | ||
88 | { | ||
89 | return(&d_cbc_cipher); | ||
90 | } | ||
91 | |||
92 | static void des_cbc_init_key(ctx,key,iv,enc) | ||
93 | EVP_CIPHER_CTX *ctx; | ||
94 | unsigned char *key; | ||
95 | unsigned char *iv; | ||
96 | int enc; | ||
97 | { | ||
98 | if (iv != NULL) | ||
99 | memcpy(&(ctx->oiv[0]),iv,8); | ||
100 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
101 | if (key != NULL) | ||
102 | des_set_key((des_cblock *)key,ctx->c.des_ks); | ||
103 | } | ||
104 | |||
105 | static void des_cbc_cipher(ctx,out,in,inl) | ||
106 | EVP_CIPHER_CTX *ctx; | ||
107 | unsigned char *out; | ||
108 | unsigned char *in; | ||
109 | unsigned int inl; | ||
110 | { | ||
111 | des_ncbc_encrypt( | ||
112 | (des_cblock *)in,(des_cblock *)out, | ||
113 | (long)inl, ctx->c.des_ks, | ||
114 | (des_cblock *)&(ctx->iv[0]), | ||
115 | ctx->encrypt); | ||
116 | } | ||
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 @@ | |||
1 | /* crypto/evp/e_cbc_i.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_IDEA | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void idea_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void idea_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void idea_cbc_init_key(); | ||
73 | static void idea_cbc_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER i_cbc_cipher= | ||
77 | { | ||
78 | NID_idea_cbc, | ||
79 | 8,16,8, | ||
80 | idea_cbc_init_key, | ||
81 | idea_cbc_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), | ||
85 | EVP_CIPHER_get_asn1_iv, | ||
86 | EVP_CIPHER_set_asn1_iv, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_idea_cbc() | ||
90 | { | ||
91 | return(&i_cbc_cipher); | ||
92 | } | ||
93 | |||
94 | static void idea_cbc_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | if (iv != NULL) | ||
101 | memcpy(&(ctx->oiv[0]),iv,8); | ||
102 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
103 | if (key != NULL) | ||
104 | { | ||
105 | if (enc) | ||
106 | idea_set_encrypt_key(key,&(ctx->c.idea_ks)); | ||
107 | else | ||
108 | { | ||
109 | IDEA_KEY_SCHEDULE tmp; | ||
110 | |||
111 | idea_set_encrypt_key(key,&tmp); | ||
112 | idea_set_decrypt_key(&tmp,&(ctx->c.idea_ks)); | ||
113 | memset((unsigned char *)&tmp,0, | ||
114 | sizeof(IDEA_KEY_SCHEDULE)); | ||
115 | } | ||
116 | } | ||
117 | } | ||
118 | |||
119 | static void idea_cbc_cipher(ctx,out,in,inl) | ||
120 | EVP_CIPHER_CTX *ctx; | ||
121 | unsigned char *out; | ||
122 | unsigned char *in; | ||
123 | unsigned int inl; | ||
124 | { | ||
125 | idea_cbc_encrypt( | ||
126 | in,out,(long)inl, | ||
127 | &(ctx->c.idea_ks),&(ctx->iv[0]), | ||
128 | ctx->encrypt); | ||
129 | } | ||
130 | |||
131 | #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 @@ | |||
1 | /* crypto/evp/e_cbc_r2.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_RC2 | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void rc2_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void rc2_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void rc2_cbc_init_key(); | ||
73 | static void rc2_cbc_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER r2_cbc_cipher= | ||
77 | { | ||
78 | NID_rc2_cbc, | ||
79 | 8,EVP_RC2_KEY_SIZE,8, | ||
80 | rc2_cbc_init_key, | ||
81 | rc2_cbc_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), | ||
85 | EVP_CIPHER_get_asn1_iv, | ||
86 | EVP_CIPHER_set_asn1_iv, | ||
87 | }; | ||
88 | |||
89 | static EVP_CIPHER r2_40_cbc_cipher= | ||
90 | { | ||
91 | NID_rc2_40_cbc, | ||
92 | 8,5 /* 40 bit */,8, | ||
93 | rc2_cbc_init_key, | ||
94 | rc2_cbc_cipher, | ||
95 | NULL, | ||
96 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
97 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), | ||
98 | }; | ||
99 | |||
100 | EVP_CIPHER *EVP_rc2_cbc() | ||
101 | { | ||
102 | return(&r2_cbc_cipher); | ||
103 | } | ||
104 | |||
105 | EVP_CIPHER *EVP_rc2_40_cbc() | ||
106 | { | ||
107 | return(&r2_40_cbc_cipher); | ||
108 | } | ||
109 | |||
110 | static void rc2_cbc_init_key(ctx,key,iv,enc) | ||
111 | EVP_CIPHER_CTX *ctx; | ||
112 | unsigned char *key; | ||
113 | unsigned char *iv; | ||
114 | int enc; | ||
115 | { | ||
116 | if (iv != NULL) | ||
117 | memcpy(&(ctx->oiv[0]),iv,8); | ||
118 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
119 | if (key != NULL) | ||
120 | RC2_set_key(&(ctx->c.rc2_ks),EVP_CIPHER_CTX_key_length(ctx), | ||
121 | key,EVP_CIPHER_CTX_key_length(ctx)*8); | ||
122 | } | ||
123 | |||
124 | static void rc2_cbc_cipher(ctx,out,in,inl) | ||
125 | EVP_CIPHER_CTX *ctx; | ||
126 | unsigned char *out; | ||
127 | unsigned char *in; | ||
128 | unsigned int inl; | ||
129 | { | ||
130 | RC2_cbc_encrypt( | ||
131 | in,out,(long)inl, | ||
132 | &(ctx->c.rc2_ks),&(ctx->iv[0]), | ||
133 | ctx->encrypt); | ||
134 | } | ||
135 | |||
136 | #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 @@ | |||
1 | /* crypto/evp/e_cbc_r5.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_RC5 | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void r_32_12_16_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void r_32_12_16_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void r_32_12_16_cbc_init_key(); | ||
73 | static void r_32_12_16_cbc_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER rc5_32_12_16_cbc_cipher= | ||
77 | { | ||
78 | NID_rc5_cbc, | ||
79 | 8,EVP_RC5_32_12_16_KEY_SIZE,8, | ||
80 | r_32_12_16_cbc_init_key, | ||
81 | r_32_12_16_cbc_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5_ks)), | ||
85 | NULL, | ||
86 | NULL, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_rc5_32_12_16_cbc() | ||
90 | { | ||
91 | return(&rc5_32_12_16_cbc_cipher); | ||
92 | } | ||
93 | |||
94 | static void r_32_12_16_cbc_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | if (iv != NULL) | ||
101 | memcpy(&(ctx->oiv[0]),iv,8); | ||
102 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
103 | if (key != NULL) | ||
104 | RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE, | ||
105 | key,RC5_12_ROUNDS); | ||
106 | } | ||
107 | |||
108 | static void r_32_12_16_cbc_cipher(ctx,out,in,inl) | ||
109 | EVP_CIPHER_CTX *ctx; | ||
110 | unsigned char *out; | ||
111 | unsigned char *in; | ||
112 | unsigned int inl; | ||
113 | { | ||
114 | RC5_32_cbc_encrypt( | ||
115 | in,out,(long)inl, | ||
116 | &(ctx->c.rc5_ks),&(ctx->iv[0]), | ||
117 | ctx->encrypt); | ||
118 | } | ||
119 | |||
120 | #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 @@ | |||
1 | /* crypto/evp/e_cfb_3d.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "evp.h" | ||
62 | #include "objects.h" | ||
63 | |||
64 | #ifndef NOPROTO | ||
65 | static void des_ede_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
66 | unsigned char *iv,int enc); | ||
67 | static void des_ede3_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void des_ede_cfb_init_key(); | ||
73 | static void des_ede3_cfb_init_key(); | ||
74 | static void des_ede_cfb_cipher(); | ||
75 | #endif | ||
76 | |||
77 | static EVP_CIPHER d_ede_cfb_cipher2= | ||
78 | { | ||
79 | NID_des_ede_cfb64, | ||
80 | 1,16,8, | ||
81 | des_ede_cfb_init_key, | ||
82 | des_ede_cfb_cipher, | ||
83 | NULL, | ||
84 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
85 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), | ||
86 | EVP_CIPHER_set_asn1_iv, | ||
87 | EVP_CIPHER_get_asn1_iv, | ||
88 | }; | ||
89 | |||
90 | static EVP_CIPHER d_ede3_cfb_cipher3= | ||
91 | { | ||
92 | NID_des_ede3_cfb64, | ||
93 | 1,24,8, | ||
94 | des_ede3_cfb_init_key, | ||
95 | des_ede_cfb_cipher, | ||
96 | NULL, | ||
97 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
98 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), | ||
99 | EVP_CIPHER_set_asn1_iv, | ||
100 | EVP_CIPHER_get_asn1_iv, | ||
101 | }; | ||
102 | |||
103 | EVP_CIPHER *EVP_des_ede_cfb() | ||
104 | { | ||
105 | return(&d_ede_cfb_cipher2); | ||
106 | } | ||
107 | |||
108 | EVP_CIPHER *EVP_des_ede3_cfb() | ||
109 | { | ||
110 | return(&d_ede3_cfb_cipher3); | ||
111 | } | ||
112 | |||
113 | static void des_ede_cfb_init_key(ctx,key,iv,enc) | ||
114 | EVP_CIPHER_CTX *ctx; | ||
115 | unsigned char *key; | ||
116 | unsigned char *iv; | ||
117 | int enc; | ||
118 | { | ||
119 | ctx->num=0; | ||
120 | |||
121 | if (iv != NULL) | ||
122 | memcpy(&(ctx->oiv[0]),iv,8); | ||
123 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
124 | if (key != NULL) | ||
125 | { | ||
126 | des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); | ||
127 | des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); | ||
128 | memcpy( (char *)ctx->c.des_ede.ks3, | ||
129 | (char *)ctx->c.des_ede.ks1, | ||
130 | sizeof(ctx->c.des_ede.ks1)); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | static void des_ede3_cfb_init_key(ctx,key,iv,enc) | ||
135 | EVP_CIPHER_CTX *ctx; | ||
136 | unsigned char *key; | ||
137 | unsigned char *iv; | ||
138 | int enc; | ||
139 | { | ||
140 | ctx->num=0; | ||
141 | |||
142 | if (iv != NULL) | ||
143 | memcpy(&(ctx->oiv[0]),iv,8); | ||
144 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
145 | if (key != NULL) | ||
146 | { | ||
147 | des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); | ||
148 | des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); | ||
149 | des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | static void des_ede_cfb_cipher(ctx,out,in,inl) | ||
154 | EVP_CIPHER_CTX *ctx; | ||
155 | unsigned char *out; | ||
156 | unsigned char *in; | ||
157 | unsigned int inl; | ||
158 | { | ||
159 | des_ede3_cfb64_encrypt( | ||
160 | in,out,(long)inl, | ||
161 | ctx->c.des_ede.ks1, | ||
162 | ctx->c.des_ede.ks2, | ||
163 | ctx->c.des_ede.ks3, | ||
164 | (des_cblock *)&(ctx->iv[0]), | ||
165 | &ctx->num,ctx->encrypt); | ||
166 | } | ||
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 @@ | |||
1 | /* crypto/evp/e_cfb_bf.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_BLOWFISH | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void bf_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void bf_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void bf_cfb_init_key(); | ||
73 | static void bf_cfb_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER bfish_cfb_cipher= | ||
77 | { | ||
78 | NID_bf_cfb64, | ||
79 | 1,EVP_BLOWFISH_KEY_SIZE,8, | ||
80 | bf_cfb_init_key, | ||
81 | bf_cfb_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), | ||
85 | EVP_CIPHER_set_asn1_iv, | ||
86 | EVP_CIPHER_get_asn1_iv, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_bf_cfb() | ||
90 | { | ||
91 | return(&bfish_cfb_cipher); | ||
92 | } | ||
93 | |||
94 | static void bf_cfb_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | ctx->num=0; | ||
101 | |||
102 | if (iv != NULL) | ||
103 | memcpy(&(ctx->oiv[0]),iv,8); | ||
104 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
105 | if (key != NULL) | ||
106 | BF_set_key(&(ctx->c.bf_ks),EVP_BLOWFISH_KEY_SIZE,key); | ||
107 | } | ||
108 | |||
109 | static void bf_cfb_cipher(ctx,out,in,inl) | ||
110 | EVP_CIPHER_CTX *ctx; | ||
111 | unsigned char *out; | ||
112 | unsigned char *in; | ||
113 | unsigned int inl; | ||
114 | { | ||
115 | BF_cfb64_encrypt( | ||
116 | in,out, | ||
117 | (long)inl, &(ctx->c.bf_ks), | ||
118 | &(ctx->iv[0]), | ||
119 | &ctx->num,ctx->encrypt); | ||
120 | } | ||
121 | #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 @@ | |||
1 | /* crypto/evp/e_cfb_c.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_CAST | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void cast_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void cast_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void cast_cfb_init_key(); | ||
73 | static void cast_cfb_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER cast5_cfb_cipher= | ||
77 | { | ||
78 | NID_cast5_cfb64, | ||
79 | 1,EVP_CAST5_KEY_SIZE,8, | ||
80 | cast_cfb_init_key, | ||
81 | cast_cfb_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), | ||
85 | EVP_CIPHER_set_asn1_iv, | ||
86 | EVP_CIPHER_get_asn1_iv, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_cast5_cfb() | ||
90 | { | ||
91 | return(&cast5_cfb_cipher); | ||
92 | } | ||
93 | |||
94 | static void cast_cfb_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | ctx->num=0; | ||
101 | |||
102 | if (iv != NULL) | ||
103 | memcpy(&(ctx->oiv[0]),iv,8); | ||
104 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
105 | if (key != NULL) | ||
106 | CAST_set_key(&(ctx->c.cast_ks),EVP_CAST5_KEY_SIZE,key); | ||
107 | } | ||
108 | |||
109 | static void cast_cfb_cipher(ctx,out,in,inl) | ||
110 | EVP_CIPHER_CTX *ctx; | ||
111 | unsigned char *out; | ||
112 | unsigned char *in; | ||
113 | unsigned int inl; | ||
114 | { | ||
115 | CAST_cfb64_encrypt( | ||
116 | in,out, | ||
117 | (long)inl, &(ctx->c.cast_ks), | ||
118 | &(ctx->iv[0]), | ||
119 | &ctx->num,ctx->encrypt); | ||
120 | } | ||
121 | #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 @@ | |||
1 | /* crypto/evp/e_cfb_d.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "evp.h" | ||
62 | #include "objects.h" | ||
63 | |||
64 | #ifndef NOPROTO | ||
65 | static void des_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
66 | unsigned char *iv,int enc); | ||
67 | static void des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
68 | unsigned char *in, unsigned int inl); | ||
69 | #else | ||
70 | static void des_cfb_init_key(); | ||
71 | static void des_cfb_cipher(); | ||
72 | #endif | ||
73 | |||
74 | static EVP_CIPHER d_cfb_cipher= | ||
75 | { | ||
76 | NID_des_cfb64, | ||
77 | 1,8,8, | ||
78 | des_cfb_init_key, | ||
79 | des_cfb_cipher, | ||
80 | NULL, | ||
81 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
82 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), | ||
83 | EVP_CIPHER_set_asn1_iv, | ||
84 | EVP_CIPHER_get_asn1_iv, | ||
85 | }; | ||
86 | |||
87 | EVP_CIPHER *EVP_des_cfb() | ||
88 | { | ||
89 | return(&d_cfb_cipher); | ||
90 | } | ||
91 | |||
92 | static void des_cfb_init_key(ctx,key,iv,enc) | ||
93 | EVP_CIPHER_CTX *ctx; | ||
94 | unsigned char *key; | ||
95 | unsigned char *iv; | ||
96 | int enc; | ||
97 | { | ||
98 | ctx->num=0; | ||
99 | |||
100 | if (iv != NULL) | ||
101 | memcpy(&(ctx->oiv[0]),iv,8); | ||
102 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
103 | if (key != NULL) | ||
104 | des_set_key((des_cblock *)key,ctx->c.des_ks); | ||
105 | } | ||
106 | |||
107 | static void des_cfb_cipher(ctx,out,in,inl) | ||
108 | EVP_CIPHER_CTX *ctx; | ||
109 | unsigned char *out; | ||
110 | unsigned char *in; | ||
111 | unsigned int inl; | ||
112 | { | ||
113 | des_cfb64_encrypt( | ||
114 | in,out, | ||
115 | (long)inl, ctx->c.des_ks, | ||
116 | (des_cblock *)&(ctx->iv[0]), | ||
117 | &ctx->num,ctx->encrypt); | ||
118 | } | ||
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 @@ | |||
1 | /* crypto/evp/e_cfb_i.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_IDEA | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void idea_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void idea_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void idea_cfb_init_key(); | ||
73 | static void idea_cfb_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER i_cfb_cipher= | ||
77 | { | ||
78 | NID_idea_cfb64, | ||
79 | 1,IDEA_KEY_LENGTH,IDEA_BLOCK, | ||
80 | idea_cfb_init_key, | ||
81 | idea_cfb_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), | ||
85 | EVP_CIPHER_set_asn1_iv, | ||
86 | EVP_CIPHER_get_asn1_iv, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_idea_cfb() | ||
90 | { | ||
91 | return(&i_cfb_cipher); | ||
92 | } | ||
93 | |||
94 | static void idea_cfb_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | ctx->num=0; | ||
101 | |||
102 | if (iv != NULL) | ||
103 | memcpy(&(ctx->oiv[0]),iv,8); | ||
104 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
105 | if (key != NULL) | ||
106 | idea_set_encrypt_key(key,&(ctx->c.idea_ks)); | ||
107 | } | ||
108 | |||
109 | static void idea_cfb_cipher(ctx,out,in,inl) | ||
110 | EVP_CIPHER_CTX *ctx; | ||
111 | unsigned char *out; | ||
112 | unsigned char *in; | ||
113 | unsigned int inl; | ||
114 | { | ||
115 | idea_cfb64_encrypt( | ||
116 | in,out,(long)inl, | ||
117 | &(ctx->c.idea_ks),&(ctx->iv[0]), | ||
118 | &ctx->num,ctx->encrypt); | ||
119 | } | ||
120 | |||
121 | #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 @@ | |||
1 | /* crypto/evp/e_cfb_r2.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_RC2 | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void rc2_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void rc2_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void rc2_cfb_init_key(); | ||
73 | static void rc2_cfb_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER r2_cfb_cipher= | ||
77 | { | ||
78 | NID_rc2_cfb64, | ||
79 | 1,EVP_RC2_KEY_SIZE,8, | ||
80 | rc2_cfb_init_key, | ||
81 | rc2_cfb_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), | ||
85 | EVP_CIPHER_set_asn1_iv, | ||
86 | EVP_CIPHER_get_asn1_iv, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_rc2_cfb() | ||
90 | { | ||
91 | return(&r2_cfb_cipher); | ||
92 | } | ||
93 | |||
94 | static void rc2_cfb_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | ctx->num=0; | ||
101 | |||
102 | if (iv != NULL) | ||
103 | memcpy(&(ctx->oiv[0]),iv,8); | ||
104 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
105 | if (key != NULL) | ||
106 | RC2_set_key(&(ctx->c.rc2_ks),EVP_RC2_KEY_SIZE,key, | ||
107 | EVP_RC2_KEY_SIZE*8); | ||
108 | } | ||
109 | |||
110 | static void rc2_cfb_cipher(ctx,out,in,inl) | ||
111 | EVP_CIPHER_CTX *ctx; | ||
112 | unsigned char *out; | ||
113 | unsigned char *in; | ||
114 | unsigned int inl; | ||
115 | { | ||
116 | RC2_cfb64_encrypt( | ||
117 | in,out, | ||
118 | (long)inl, &(ctx->c.rc2_ks), | ||
119 | &(ctx->iv[0]), | ||
120 | &ctx->num,ctx->encrypt); | ||
121 | } | ||
122 | #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 @@ | |||
1 | /* crypto/evp/e_cfb_r5.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_RC5 | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void rc5_32_12_16_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void rc5_32_12_16_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void rc5_32_12_16_cfb_init_key(); | ||
73 | static void rc5_32_12_16_cfb_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER rc5_cfb_cipher= | ||
77 | { | ||
78 | NID_rc5_cfb64, | ||
79 | 1,EVP_RC5_32_12_16_KEY_SIZE,8, | ||
80 | rc5_32_12_16_cfb_init_key, | ||
81 | rc5_32_12_16_cfb_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5_ks)), | ||
85 | EVP_CIPHER_set_asn1_iv, | ||
86 | EVP_CIPHER_get_asn1_iv, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_rc5_32_12_16_cfb() | ||
90 | { | ||
91 | return(&rc5_cfb_cipher); | ||
92 | } | ||
93 | |||
94 | static void rc5_32_12_16_cfb_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | ctx->num=0; | ||
101 | |||
102 | if (iv != NULL) | ||
103 | memcpy(&(ctx->oiv[0]),iv,8); | ||
104 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
105 | if (key != NULL) | ||
106 | RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE,key, | ||
107 | RC5_12_ROUNDS); | ||
108 | } | ||
109 | |||
110 | static void rc5_32_12_16_cfb_cipher(ctx,out,in,inl) | ||
111 | EVP_CIPHER_CTX *ctx; | ||
112 | unsigned char *out; | ||
113 | unsigned char *in; | ||
114 | unsigned int inl; | ||
115 | { | ||
116 | RC5_32_cfb64_encrypt( | ||
117 | in,out, | ||
118 | (long)inl, &(ctx->c.rc5_ks), | ||
119 | &(ctx->iv[0]), | ||
120 | &ctx->num,ctx->encrypt); | ||
121 | } | ||
122 | #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 @@ | |||
1 | /* crypto/evp/e_ecb_3d.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "evp.h" | ||
62 | #include "objects.h" | ||
63 | |||
64 | #ifndef NOPROTO | ||
65 | static void des_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
66 | unsigned char *iv,int enc); | ||
67 | static void des_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void des_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void des_ede_init_key(); | ||
73 | static void des_ede3_init_key(); | ||
74 | static void des_ede_cipher(); | ||
75 | #endif | ||
76 | |||
77 | static EVP_CIPHER d_ede_cipher2= | ||
78 | { | ||
79 | NID_des_ede, | ||
80 | 8,16,0, | ||
81 | des_ede_init_key, | ||
82 | des_ede_cipher, | ||
83 | NULL, | ||
84 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
85 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), | ||
86 | NULL, | ||
87 | NULL, | ||
88 | }; | ||
89 | |||
90 | static EVP_CIPHER d_ede3_cipher3= | ||
91 | { | ||
92 | NID_des_ede3, | ||
93 | 8,24,0, | ||
94 | des_ede3_init_key, | ||
95 | des_ede_cipher, | ||
96 | NULL, | ||
97 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
98 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), | ||
99 | NULL, | ||
100 | }; | ||
101 | |||
102 | EVP_CIPHER *EVP_des_ede() | ||
103 | { | ||
104 | return(&d_ede_cipher2); | ||
105 | } | ||
106 | |||
107 | EVP_CIPHER *EVP_des_ede3() | ||
108 | { | ||
109 | return(&d_ede3_cipher3); | ||
110 | } | ||
111 | |||
112 | static void des_ede_init_key(ctx,key,iv,enc) | ||
113 | EVP_CIPHER_CTX *ctx; | ||
114 | unsigned char *key; | ||
115 | unsigned char *iv; | ||
116 | int enc; | ||
117 | { | ||
118 | if (key != NULL) | ||
119 | { | ||
120 | des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); | ||
121 | des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); | ||
122 | memcpy( (char *)ctx->c.des_ede.ks3, | ||
123 | (char *)ctx->c.des_ede.ks1, | ||
124 | sizeof(ctx->c.des_ede.ks1)); | ||
125 | } | ||
126 | } | ||
127 | |||
128 | static void des_ede3_init_key(ctx,key,iv,enc) | ||
129 | EVP_CIPHER_CTX *ctx; | ||
130 | unsigned char *key; | ||
131 | unsigned char *iv; | ||
132 | int enc; | ||
133 | { | ||
134 | if (key != NULL) | ||
135 | { | ||
136 | des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); | ||
137 | des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); | ||
138 | des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); | ||
139 | } | ||
140 | } | ||
141 | |||
142 | static void des_ede_cipher(ctx,out,in,inl) | ||
143 | EVP_CIPHER_CTX *ctx; | ||
144 | unsigned char *out; | ||
145 | unsigned char *in; | ||
146 | unsigned int inl; | ||
147 | { | ||
148 | unsigned int i; | ||
149 | |||
150 | if (inl < 8) return; | ||
151 | inl-=8; | ||
152 | for (i=0; i<=inl; i+=8) | ||
153 | { | ||
154 | des_ecb3_encrypt( | ||
155 | (des_cblock *)&(in[i]),(des_cblock *)&(out[i]), | ||
156 | ctx->c.des_ede.ks1, | ||
157 | ctx->c.des_ede.ks2, | ||
158 | ctx->c.des_ede.ks3, | ||
159 | ctx->encrypt); | ||
160 | } | ||
161 | } | ||
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 @@ | |||
1 | /* crypto/evp/e_ecb_bf.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_BLOWFISH | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void bf_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void bf_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void bf_ecb_init_key(); | ||
73 | static void bf_ecb_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER bfish_ecb_cipher= | ||
77 | { | ||
78 | NID_bf_ecb, | ||
79 | 8,EVP_BLOWFISH_KEY_SIZE,0, | ||
80 | bf_ecb_init_key, | ||
81 | bf_ecb_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), | ||
85 | NULL, | ||
86 | NULL, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_bf_ecb() | ||
90 | { | ||
91 | return(&bfish_ecb_cipher); | ||
92 | } | ||
93 | |||
94 | static void bf_ecb_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | if (key != NULL) | ||
101 | BF_set_key(&(ctx->c.bf_ks),EVP_BLOWFISH_KEY_SIZE,key); | ||
102 | } | ||
103 | |||
104 | static void bf_ecb_cipher(ctx,out,in,inl) | ||
105 | EVP_CIPHER_CTX *ctx; | ||
106 | unsigned char *out; | ||
107 | unsigned char *in; | ||
108 | unsigned int inl; | ||
109 | { | ||
110 | unsigned int i; | ||
111 | |||
112 | if (inl < 8) return; | ||
113 | inl-=8; | ||
114 | for (i=0; i<=inl; i+=8) | ||
115 | { | ||
116 | BF_ecb_encrypt( | ||
117 | &(in[i]),&(out[i]), | ||
118 | &(ctx->c.bf_ks),ctx->encrypt); | ||
119 | } | ||
120 | } | ||
121 | |||
122 | #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 @@ | |||
1 | /* crypto/evp/e_ecb_c.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_CAST | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void cast_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void cast_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void cast_ecb_init_key(); | ||
73 | static void cast_ecb_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER cast5_ecb_cipher= | ||
77 | { | ||
78 | NID_cast5_ecb, | ||
79 | 8,EVP_CAST5_KEY_SIZE,0, | ||
80 | cast_ecb_init_key, | ||
81 | cast_ecb_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), | ||
85 | NULL, | ||
86 | NULL, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_cast5_ecb() | ||
90 | { | ||
91 | return(&cast5_ecb_cipher); | ||
92 | } | ||
93 | |||
94 | static void cast_ecb_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | if (key != NULL) | ||
101 | CAST_set_key(&(ctx->c.cast_ks),EVP_CAST5_KEY_SIZE,key); | ||
102 | } | ||
103 | |||
104 | static void cast_ecb_cipher(ctx,out,in,inl) | ||
105 | EVP_CIPHER_CTX *ctx; | ||
106 | unsigned char *out; | ||
107 | unsigned char *in; | ||
108 | unsigned int inl; | ||
109 | { | ||
110 | unsigned int i; | ||
111 | |||
112 | if (inl < 8) return; | ||
113 | inl-=8; | ||
114 | for (i=0; i<=inl; i+=8) | ||
115 | { | ||
116 | CAST_ecb_encrypt( | ||
117 | &(in[i]),&(out[i]), | ||
118 | &(ctx->c.cast_ks),ctx->encrypt); | ||
119 | } | ||
120 | } | ||
121 | |||
122 | #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 @@ | |||
1 | /* crypto/evp/e_ecb_d.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "evp.h" | ||
62 | #include "objects.h" | ||
63 | |||
64 | #ifndef NOPROTO | ||
65 | static void des_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
66 | unsigned char *iv,int enc); | ||
67 | static void des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
68 | unsigned char *in, unsigned int inl); | ||
69 | #else | ||
70 | static void des_ecb_init_key(); | ||
71 | static void des_ecb_cipher(); | ||
72 | #endif | ||
73 | |||
74 | static EVP_CIPHER d_ecb_cipher= | ||
75 | { | ||
76 | NID_des_ecb, | ||
77 | 8,8,0, | ||
78 | des_ecb_init_key, | ||
79 | des_ecb_cipher, | ||
80 | NULL, | ||
81 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
82 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), | ||
83 | NULL, | ||
84 | NULL, | ||
85 | }; | ||
86 | |||
87 | EVP_CIPHER *EVP_des_ecb() | ||
88 | { | ||
89 | return(&d_ecb_cipher); | ||
90 | } | ||
91 | |||
92 | static void des_ecb_init_key(ctx,key,iv,enc) | ||
93 | EVP_CIPHER_CTX *ctx; | ||
94 | unsigned char *key; | ||
95 | unsigned char *iv; | ||
96 | int enc; | ||
97 | { | ||
98 | if (key != NULL) | ||
99 | des_set_key((des_cblock *)key,ctx->c.des_ks); | ||
100 | } | ||
101 | |||
102 | static void des_ecb_cipher(ctx,out,in,inl) | ||
103 | EVP_CIPHER_CTX *ctx; | ||
104 | unsigned char *out; | ||
105 | unsigned char *in; | ||
106 | unsigned int inl; | ||
107 | { | ||
108 | unsigned int i; | ||
109 | |||
110 | if (inl < 8) return; | ||
111 | inl-=8; | ||
112 | for (i=0; i<=inl; i+=8) | ||
113 | { | ||
114 | des_ecb_encrypt( | ||
115 | (des_cblock *)&(in[i]),(des_cblock *)&(out[i]), | ||
116 | ctx->c.des_ks,ctx->encrypt); | ||
117 | } | ||
118 | } | ||
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 @@ | |||
1 | /* crypto/evp/e_ecb_i.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_IDEA | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void idea_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void idea_ecb_init_key(); | ||
73 | static void idea_ecb_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER i_ecb_cipher= | ||
77 | { | ||
78 | NID_idea_ecb, | ||
79 | 8,16,0, | ||
80 | idea_ecb_init_key, | ||
81 | idea_ecb_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), | ||
85 | NULL, | ||
86 | NULL, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_idea_ecb() | ||
90 | { | ||
91 | return(&i_ecb_cipher); | ||
92 | } | ||
93 | |||
94 | static void idea_ecb_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | if (key != NULL) | ||
101 | { | ||
102 | if (enc) | ||
103 | idea_set_encrypt_key(key,&(ctx->c.idea_ks)); | ||
104 | else | ||
105 | { | ||
106 | IDEA_KEY_SCHEDULE tmp; | ||
107 | |||
108 | idea_set_encrypt_key(key,&tmp); | ||
109 | idea_set_decrypt_key(&tmp, &(ctx->c.idea_ks)); | ||
110 | memset((unsigned char *)&tmp,0, | ||
111 | sizeof(IDEA_KEY_SCHEDULE)); | ||
112 | } | ||
113 | } | ||
114 | } | ||
115 | |||
116 | static void idea_ecb_cipher(ctx,out,in,inl) | ||
117 | EVP_CIPHER_CTX *ctx; | ||
118 | unsigned char *out; | ||
119 | unsigned char *in; | ||
120 | unsigned int inl; | ||
121 | { | ||
122 | unsigned int i; | ||
123 | |||
124 | if (inl < 8) return; | ||
125 | inl-=8; | ||
126 | for (i=0; i<=inl; i+=8) | ||
127 | { | ||
128 | idea_ecb_encrypt( | ||
129 | &(in[i]),&(out[i]),&(ctx->c.idea_ks)); | ||
130 | } | ||
131 | } | ||
132 | |||
133 | #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 @@ | |||
1 | /* crypto/evp/e_ecb_r2.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_RC2 | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void rc2_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void rc2_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void rc2_ecb_init_key(); | ||
73 | static void rc2_ecb_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER r2_ecb_cipher= | ||
77 | { | ||
78 | NID_rc2_ecb, | ||
79 | 8,EVP_RC2_KEY_SIZE,0, | ||
80 | rc2_ecb_init_key, | ||
81 | rc2_ecb_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), | ||
85 | NULL, | ||
86 | NULL, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_rc2_ecb() | ||
90 | { | ||
91 | return(&r2_ecb_cipher); | ||
92 | } | ||
93 | |||
94 | static void rc2_ecb_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | if (key != NULL) | ||
101 | RC2_set_key(&(ctx->c.rc2_ks),EVP_RC2_KEY_SIZE,key, | ||
102 | EVP_RC2_KEY_SIZE*8); | ||
103 | } | ||
104 | |||
105 | static void rc2_ecb_cipher(ctx,out,in,inl) | ||
106 | EVP_CIPHER_CTX *ctx; | ||
107 | unsigned char *out; | ||
108 | unsigned char *in; | ||
109 | unsigned int inl; | ||
110 | { | ||
111 | unsigned int i; | ||
112 | |||
113 | if (inl < 8) return; | ||
114 | inl-=8; | ||
115 | for (i=0; i<=inl; i+=8) | ||
116 | { | ||
117 | RC2_ecb_encrypt( | ||
118 | &(in[i]),&(out[i]), | ||
119 | &(ctx->c.rc2_ks),ctx->encrypt); | ||
120 | } | ||
121 | } | ||
122 | |||
123 | #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 @@ | |||
1 | /* crypto/evp/e_ecb_r5.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_RC5 | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void rc5_32_12_16_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void rc5_32_12_16_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void rc5_32_12_16_ecb_init_key(); | ||
73 | static void rc5_32_12_16_ecb_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER rc5_ecb_cipher= | ||
77 | { | ||
78 | NID_rc5_ecb, | ||
79 | 8,EVP_RC5_32_12_16_KEY_SIZE,0, | ||
80 | rc5_32_12_16_ecb_init_key, | ||
81 | rc5_32_12_16_ecb_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5_ks)), | ||
85 | NULL, | ||
86 | NULL, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_rc5_32_12_16_ecb() | ||
90 | { | ||
91 | return(&rc5_ecb_cipher); | ||
92 | } | ||
93 | |||
94 | static void rc5_32_12_16_ecb_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | if (key != NULL) | ||
101 | RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE,key, | ||
102 | RC5_12_ROUNDS); | ||
103 | } | ||
104 | |||
105 | static void rc5_32_12_16_ecb_cipher(ctx,out,in,inl) | ||
106 | EVP_CIPHER_CTX *ctx; | ||
107 | unsigned char *out; | ||
108 | unsigned char *in; | ||
109 | unsigned int inl; | ||
110 | { | ||
111 | unsigned int i; | ||
112 | |||
113 | if (inl < 8) return; | ||
114 | inl-=8; | ||
115 | for (i=0; i<=inl; i+=8) | ||
116 | { | ||
117 | RC5_32_ecb_encrypt( | ||
118 | &(in[i]),&(out[i]), | ||
119 | &(ctx->c.rc5_ks),ctx->encrypt); | ||
120 | } | ||
121 | } | ||
122 | |||
123 | #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 @@ | |||
1 | /* crypto/evp/e_ofb_3d.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "evp.h" | ||
62 | #include "objects.h" | ||
63 | |||
64 | #ifndef NOPROTO | ||
65 | static void des_ede_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
66 | unsigned char *iv,int enc); | ||
67 | static void des_ede3_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void des_ede_ofb_init_key(); | ||
73 | static void des_ede3_ofb_init_key(); | ||
74 | static void des_ede_ofb_cipher(); | ||
75 | #endif | ||
76 | |||
77 | static EVP_CIPHER d_ede_ofb_cipher2= | ||
78 | { | ||
79 | NID_des_ede_ofb64, | ||
80 | 1,16,8, | ||
81 | des_ede_ofb_init_key, | ||
82 | des_ede_ofb_cipher, | ||
83 | NULL, | ||
84 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
85 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), | ||
86 | EVP_CIPHER_set_asn1_iv, | ||
87 | EVP_CIPHER_get_asn1_iv, | ||
88 | }; | ||
89 | |||
90 | static EVP_CIPHER d_ede3_ofb_cipher3= | ||
91 | { | ||
92 | NID_des_ede3_ofb64, | ||
93 | 1,24,8, | ||
94 | des_ede3_ofb_init_key, | ||
95 | des_ede_ofb_cipher, | ||
96 | NULL, | ||
97 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
98 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), | ||
99 | EVP_CIPHER_set_asn1_iv, | ||
100 | EVP_CIPHER_get_asn1_iv, | ||
101 | }; | ||
102 | |||
103 | EVP_CIPHER *EVP_des_ede_ofb() | ||
104 | { | ||
105 | return(&d_ede_ofb_cipher2); | ||
106 | } | ||
107 | |||
108 | EVP_CIPHER *EVP_des_ede3_ofb() | ||
109 | { | ||
110 | return(&d_ede3_ofb_cipher3); | ||
111 | } | ||
112 | |||
113 | static void des_ede_ofb_init_key(ctx,key,iv,enc) | ||
114 | EVP_CIPHER_CTX *ctx; | ||
115 | unsigned char *key; | ||
116 | unsigned char *iv; | ||
117 | int enc; | ||
118 | { | ||
119 | ctx->num=0; | ||
120 | |||
121 | if (iv != NULL) | ||
122 | memcpy(&(ctx->oiv[0]),iv,8); | ||
123 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
124 | if (key != NULL) | ||
125 | { | ||
126 | des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); | ||
127 | des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); | ||
128 | memcpy( (char *)ctx->c.des_ede.ks3, | ||
129 | (char *)ctx->c.des_ede.ks1, | ||
130 | sizeof(ctx->c.des_ede.ks1)); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | static void des_ede3_ofb_init_key(ctx,key,iv,enc) | ||
135 | EVP_CIPHER_CTX *ctx; | ||
136 | unsigned char *key; | ||
137 | unsigned char *iv; | ||
138 | int enc; | ||
139 | { | ||
140 | ctx->num=0; | ||
141 | |||
142 | if (iv != NULL) | ||
143 | memcpy(&(ctx->oiv[0]),iv,8); | ||
144 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
145 | if (key != NULL) | ||
146 | { | ||
147 | des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); | ||
148 | des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); | ||
149 | des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | static void des_ede_ofb_cipher(ctx,out,in,inl) | ||
154 | EVP_CIPHER_CTX *ctx; | ||
155 | unsigned char *out; | ||
156 | unsigned char *in; | ||
157 | unsigned int inl; | ||
158 | { | ||
159 | des_ede3_ofb64_encrypt( | ||
160 | in,out, | ||
161 | (long)inl, | ||
162 | ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, | ||
163 | (des_cblock *)&(ctx->iv[0]), | ||
164 | &ctx->num); | ||
165 | } | ||
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 @@ | |||
1 | /* crypto/evp/e_ofb_bf.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_BLOWFISH | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void bf_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void bf_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void bf_ofb_init_key(); | ||
73 | static void bf_ofb_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER bfish_ofb_cipher= | ||
77 | { | ||
78 | NID_bf_ofb64, | ||
79 | 1,EVP_BLOWFISH_KEY_SIZE,8, | ||
80 | bf_ofb_init_key, | ||
81 | bf_ofb_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), | ||
85 | EVP_CIPHER_set_asn1_iv, | ||
86 | EVP_CIPHER_get_asn1_iv, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_bf_ofb() | ||
90 | { | ||
91 | return(&bfish_ofb_cipher); | ||
92 | } | ||
93 | |||
94 | static void bf_ofb_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | ctx->num=0; | ||
101 | |||
102 | if (iv != NULL) | ||
103 | memcpy(&(ctx->oiv[0]),iv,8); | ||
104 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
105 | if (key != NULL) | ||
106 | BF_set_key(&(ctx->c.bf_ks),EVP_BLOWFISH_KEY_SIZE,key); | ||
107 | } | ||
108 | |||
109 | static void bf_ofb_cipher(ctx,out,in,inl) | ||
110 | EVP_CIPHER_CTX *ctx; | ||
111 | unsigned char *out; | ||
112 | unsigned char *in; | ||
113 | unsigned int inl; | ||
114 | { | ||
115 | BF_ofb64_encrypt( | ||
116 | in,out, | ||
117 | (long)inl, &(ctx->c.bf_ks), | ||
118 | &(ctx->iv[0]), | ||
119 | &ctx->num); | ||
120 | } | ||
121 | |||
122 | #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 @@ | |||
1 | /* crypto/evp/e_ofb_c.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_CAST | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void cast_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void cast_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void cast_ofb_init_key(); | ||
73 | static void cast_ofb_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER cast5_ofb_cipher= | ||
77 | { | ||
78 | NID_cast5_ofb64, | ||
79 | 1,EVP_CAST5_KEY_SIZE,8, | ||
80 | cast_ofb_init_key, | ||
81 | cast_ofb_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), | ||
85 | EVP_CIPHER_set_asn1_iv, | ||
86 | EVP_CIPHER_get_asn1_iv, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_cast5_ofb() | ||
90 | { | ||
91 | return(&cast5_ofb_cipher); | ||
92 | } | ||
93 | |||
94 | static void cast_ofb_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | ctx->num=0; | ||
101 | |||
102 | if (iv != NULL) | ||
103 | memcpy(&(ctx->oiv[0]),iv,8); | ||
104 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
105 | if (key != NULL) | ||
106 | CAST_set_key(&(ctx->c.cast_ks),EVP_CAST5_KEY_SIZE,key); | ||
107 | } | ||
108 | |||
109 | static void cast_ofb_cipher(ctx,out,in,inl) | ||
110 | EVP_CIPHER_CTX *ctx; | ||
111 | unsigned char *out; | ||
112 | unsigned char *in; | ||
113 | unsigned int inl; | ||
114 | { | ||
115 | CAST_ofb64_encrypt( | ||
116 | in,out, | ||
117 | (long)inl, &(ctx->c.cast_ks), | ||
118 | &(ctx->iv[0]), | ||
119 | &ctx->num); | ||
120 | } | ||
121 | |||
122 | #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 @@ | |||
1 | /* crypto/evp/e_ofb_d.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "evp.h" | ||
62 | #include "objects.h" | ||
63 | |||
64 | #ifndef NOPROTO | ||
65 | static void des_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
66 | unsigned char *iv,int enc); | ||
67 | static void des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
68 | unsigned char *in, unsigned int inl); | ||
69 | #else | ||
70 | static void des_ofb_init_key(); | ||
71 | static void des_ofb_cipher(); | ||
72 | #endif | ||
73 | |||
74 | static EVP_CIPHER d_ofb_cipher= | ||
75 | { | ||
76 | NID_des_ofb64, | ||
77 | 1,8,8, | ||
78 | des_ofb_init_key, | ||
79 | des_ofb_cipher, | ||
80 | NULL, | ||
81 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
82 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), | ||
83 | EVP_CIPHER_set_asn1_iv, | ||
84 | EVP_CIPHER_get_asn1_iv, | ||
85 | }; | ||
86 | |||
87 | EVP_CIPHER *EVP_des_ofb() | ||
88 | { | ||
89 | return(&d_ofb_cipher); | ||
90 | } | ||
91 | |||
92 | static void des_ofb_init_key(ctx,key,iv,enc) | ||
93 | EVP_CIPHER_CTX *ctx; | ||
94 | unsigned char *key; | ||
95 | unsigned char *iv; | ||
96 | int enc; | ||
97 | { | ||
98 | ctx->num=0; | ||
99 | |||
100 | if (iv != NULL) | ||
101 | memcpy(&(ctx->oiv[0]),iv,8); | ||
102 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
103 | if (key != NULL) | ||
104 | des_set_key((des_cblock *)key,ctx->c.des_ks); | ||
105 | } | ||
106 | |||
107 | static void des_ofb_cipher(ctx,out,in,inl) | ||
108 | EVP_CIPHER_CTX *ctx; | ||
109 | unsigned char *out; | ||
110 | unsigned char *in; | ||
111 | unsigned int inl; | ||
112 | { | ||
113 | des_ofb64_encrypt( | ||
114 | in,out, | ||
115 | (long)inl, ctx->c.des_ks, | ||
116 | (des_cblock *)&(ctx->iv[0]), | ||
117 | &ctx->num); | ||
118 | } | ||
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 @@ | |||
1 | /* crypto/evp/e_ofb_i.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_IDEA | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void idea_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void idea_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void idea_ofb_init_key(); | ||
73 | static void idea_ofb_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER i_ofb_cipher= | ||
77 | { | ||
78 | NID_idea_ofb64, | ||
79 | 1,IDEA_KEY_LENGTH,IDEA_BLOCK, | ||
80 | idea_ofb_init_key, | ||
81 | idea_ofb_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), | ||
85 | EVP_CIPHER_set_asn1_iv, | ||
86 | EVP_CIPHER_get_asn1_iv, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_idea_ofb() | ||
90 | { | ||
91 | return(&i_ofb_cipher); | ||
92 | } | ||
93 | |||
94 | static void idea_ofb_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | ctx->num=0; | ||
101 | |||
102 | if (iv != NULL) | ||
103 | memcpy(&(ctx->oiv[0]),iv,8); | ||
104 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
105 | if (key != NULL) | ||
106 | idea_set_encrypt_key(key,&(ctx->c.idea_ks)); | ||
107 | } | ||
108 | |||
109 | static void idea_ofb_cipher(ctx,out,in,inl) | ||
110 | EVP_CIPHER_CTX *ctx; | ||
111 | unsigned char *out; | ||
112 | unsigned char *in; | ||
113 | unsigned int inl; | ||
114 | { | ||
115 | idea_ofb64_encrypt( | ||
116 | in,out,(long)inl, | ||
117 | &(ctx->c.idea_ks),&(ctx->iv[0]), | ||
118 | &ctx->num); | ||
119 | } | ||
120 | |||
121 | #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 @@ | |||
1 | /* crypto/evp/e_ofb_r2.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_RC2 | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void rc2_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void rc2_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void rc2_ofb_init_key(); | ||
73 | static void rc2_ofb_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER r2_ofb_cipher= | ||
77 | { | ||
78 | NID_rc2_ofb64, | ||
79 | 1,EVP_RC2_KEY_SIZE,8, | ||
80 | rc2_ofb_init_key, | ||
81 | rc2_ofb_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), | ||
85 | EVP_CIPHER_set_asn1_iv, | ||
86 | EVP_CIPHER_get_asn1_iv, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_rc2_ofb() | ||
90 | { | ||
91 | return(&r2_ofb_cipher); | ||
92 | } | ||
93 | |||
94 | static void rc2_ofb_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | ctx->num=0; | ||
101 | |||
102 | if (iv != NULL) | ||
103 | memcpy(&(ctx->oiv[0]),iv,8); | ||
104 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
105 | if (key != NULL) | ||
106 | RC2_set_key(&(ctx->c.rc2_ks),EVP_RC2_KEY_SIZE,key, | ||
107 | EVP_RC2_KEY_SIZE*8); | ||
108 | } | ||
109 | |||
110 | static void rc2_ofb_cipher(ctx,out,in,inl) | ||
111 | EVP_CIPHER_CTX *ctx; | ||
112 | unsigned char *out; | ||
113 | unsigned char *in; | ||
114 | unsigned int inl; | ||
115 | { | ||
116 | RC2_ofb64_encrypt( | ||
117 | in,out, | ||
118 | (long)inl, &(ctx->c.rc2_ks), | ||
119 | &(ctx->iv[0]), | ||
120 | &ctx->num); | ||
121 | } | ||
122 | |||
123 | #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 @@ | |||
1 | /* crypto/evp/e_ofb_r5.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef NO_RC5 | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include "evp.h" | ||
64 | #include "objects.h" | ||
65 | |||
66 | #ifndef NOPROTO | ||
67 | static void rc5_32_12_16_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | ||
68 | unsigned char *iv,int enc); | ||
69 | static void rc5_32_12_16_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
70 | unsigned char *in, unsigned int inl); | ||
71 | #else | ||
72 | static void rc5_32_12_16_ofb_init_key(); | ||
73 | static void rc5_32_12_16_ofb_cipher(); | ||
74 | #endif | ||
75 | |||
76 | static EVP_CIPHER rc5_ofb_cipher= | ||
77 | { | ||
78 | NID_rc5_ofb64, | ||
79 | 1,EVP_RC5_32_12_16_KEY_SIZE,8, | ||
80 | rc5_32_12_16_ofb_init_key, | ||
81 | rc5_32_12_16_ofb_cipher, | ||
82 | NULL, | ||
83 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ | ||
84 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5_ks)), | ||
85 | EVP_CIPHER_set_asn1_iv, | ||
86 | EVP_CIPHER_get_asn1_iv, | ||
87 | }; | ||
88 | |||
89 | EVP_CIPHER *EVP_rc5_32_12_16_ofb() | ||
90 | { | ||
91 | return(&rc5_ofb_cipher); | ||
92 | } | ||
93 | |||
94 | static void rc5_32_12_16_ofb_init_key(ctx,key,iv,enc) | ||
95 | EVP_CIPHER_CTX *ctx; | ||
96 | unsigned char *key; | ||
97 | unsigned char *iv; | ||
98 | int enc; | ||
99 | { | ||
100 | ctx->num=0; | ||
101 | |||
102 | if (iv != NULL) | ||
103 | memcpy(&(ctx->oiv[0]),iv,8); | ||
104 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | ||
105 | if (key != NULL) | ||
106 | RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE,key, | ||
107 | RC5_12_ROUNDS); | ||
108 | } | ||
109 | |||
110 | static void rc5_32_12_16_ofb_cipher(ctx,out,in,inl) | ||
111 | EVP_CIPHER_CTX *ctx; | ||
112 | unsigned char *out; | ||
113 | unsigned char *in; | ||
114 | unsigned int inl; | ||
115 | { | ||
116 | RC5_32_ofb64_encrypt( | ||
117 | in,out, | ||
118 | (long)inl, &(ctx->c.rc5_ks), | ||
119 | &(ctx->iv[0]), | ||
120 | &ctx->num); | ||
121 | } | ||
122 | |||
123 | #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 @@ | |||
1 | /* Error codes for the EVP functions. */ | ||
2 | |||
3 | /* Function codes. */ | ||
4 | #define EVP_F_D2I_PKEY 100 | ||
5 | #define EVP_F_EVP_DECRYPTFINAL 101 | ||
6 | #define EVP_F_EVP_OPENINIT 102 | ||
7 | #define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 | ||
8 | #define EVP_F_EVP_PKEY_DECRYPT 104 | ||
9 | #define EVP_F_EVP_PKEY_ENCRYPT 105 | ||
10 | #define EVP_F_EVP_PKEY_NEW 106 | ||
11 | #define EVP_F_EVP_SIGNFINAL 107 | ||
12 | #define EVP_F_EVP_VERIFYFINAL 108 | ||
13 | |||
14 | /* Reason codes. */ | ||
15 | #define EVP_R_BAD_DECRYPT 100 | ||
16 | #define EVP_R_DIFFERENT_KEY_TYPES 101 | ||
17 | #define EVP_R_IV_TOO_LARGE 102 | ||
18 | #define EVP_R_MISSING_PARMATERS 103 | ||
19 | #define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104 | ||
20 | #define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 | ||
21 | #define EVP_R_PUBLIC_KEY_NOT_RSA 106 | ||
22 | #define EVP_R_UNSUPPORTED_CIPHER 107 | ||
23 | #define EVP_R_WRONG_FINAL_BLOCK_LENGTH 108 | ||
24 | #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 @@ | |||
1 | /* crypto/evp/pk_lib.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "evp.h" | ||
62 | #include "objects.h" | ||
63 | |||
64 | static LHASH *pk_md=NULL; | ||
65 | |||
66 | static LHASH *pk_md=NULL; | ||
67 | |||
68 | int EVP_add_pkey_md(oid,pkm,md) | ||
69 | int oid; | ||
70 | EVP_PKEY_METHOD *pkm; | ||
71 | EVP_MD *md; | ||
72 | { | ||
73 | } | ||
74 | |||
75 | EVP_add_pkey(pkm) | ||
76 | EVP_PKEY_METHOD *pkm; | ||
77 | { | ||
78 | } | ||
79 | |||
80 | EVP_PKEY_METHOD:q | ||
81 | |||
82 | |||
diff --git a/src/lib/libcrypto/hmac/Makefile.ssl b/src/lib/libcrypto/hmac/Makefile.ssl new file mode 100644 index 0000000000..7a042b7261 --- /dev/null +++ b/src/lib/libcrypto/hmac/Makefile.ssl | |||
@@ -0,0 +1,80 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/md/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= hmac | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | GENERAL=Makefile | ||
19 | TEST=hmactest.c | ||
20 | APPS= | ||
21 | |||
22 | LIB=$(TOP)/libcrypto.a | ||
23 | LIBSRC=hmac.c | ||
24 | LIBOBJ=hmac.o | ||
25 | |||
26 | SRC= $(LIBSRC) | ||
27 | |||
28 | EXHEADER= hmac.h | ||
29 | HEADER= $(EXHEADER) | ||
30 | |||
31 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
32 | |||
33 | top: | ||
34 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
35 | |||
36 | all: lib | ||
37 | |||
38 | lib: $(LIBOBJ) | ||
39 | $(AR) $(LIB) $(LIBOBJ) | ||
40 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
41 | @touch lib | ||
42 | |||
43 | files: | ||
44 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
45 | |||
46 | links: | ||
47 | /bin/rm -f Makefile | ||
48 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
49 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
50 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
51 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
52 | |||
53 | install: | ||
54 | @for i in $(EXHEADER) ; \ | ||
55 | do \ | ||
56 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
57 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
58 | done; | ||
59 | |||
60 | tags: | ||
61 | ctags $(SRC) | ||
62 | |||
63 | tests: | ||
64 | |||
65 | lint: | ||
66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
67 | |||
68 | depend: | ||
69 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
70 | |||
71 | dclean: | ||
72 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
73 | mv -f Makefile.new $(MAKEFILE) | ||
74 | |||
75 | clean: | ||
76 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
77 | |||
78 | errors: | ||
79 | |||
80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
diff --git a/src/lib/libcrypto/idea/Makefile.ssl b/src/lib/libcrypto/idea/Makefile.ssl new file mode 100644 index 0000000000..41b42ce03b --- /dev/null +++ b/src/lib/libcrypto/idea/Makefile.ssl | |||
@@ -0,0 +1,80 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/idea/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= idea | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | GENERAL=Makefile | ||
19 | TEST=ideatest.c | ||
20 | APPS= | ||
21 | |||
22 | LIB=$(TOP)/libcrypto.a | ||
23 | LIBSRC=i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c i_skey.c | ||
24 | LIBOBJ=i_cbc.o i_cfb64.o i_ofb64.o i_ecb.o i_skey.o | ||
25 | |||
26 | SRC= $(LIBSRC) | ||
27 | |||
28 | EXHEADER= idea.h | ||
29 | HEADER= idea_lcl.h $(EXHEADER) | ||
30 | |||
31 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
32 | |||
33 | top: | ||
34 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
35 | |||
36 | all: lib | ||
37 | |||
38 | lib: $(LIBOBJ) | ||
39 | $(AR) $(LIB) $(LIBOBJ) | ||
40 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
41 | @touch lib | ||
42 | |||
43 | files: | ||
44 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
45 | |||
46 | links: | ||
47 | /bin/rm -f Makefile | ||
48 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
49 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
50 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
51 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
52 | |||
53 | install: | ||
54 | @for i in $(EXHEADER) ; \ | ||
55 | do \ | ||
56 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
57 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
58 | done; | ||
59 | |||
60 | tags: | ||
61 | ctags $(SRC) | ||
62 | |||
63 | tests: | ||
64 | |||
65 | lint: | ||
66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
67 | |||
68 | depend: | ||
69 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
70 | |||
71 | dclean: | ||
72 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
73 | mv -f Makefile.new $(MAKEFILE) | ||
74 | |||
75 | clean: | ||
76 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
77 | |||
78 | errors: | ||
79 | |||
80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
diff --git a/src/lib/libcrypto/lhash/Makefile.ssl b/src/lib/libcrypto/lhash/Makefile.ssl new file mode 100644 index 0000000000..cb08547b4f --- /dev/null +++ b/src/lib/libcrypto/lhash/Makefile.ssl | |||
@@ -0,0 +1,80 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/lhash/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= lhash | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | GENERAL=Makefile | ||
19 | TEST= | ||
20 | APPS= | ||
21 | |||
22 | LIB=$(TOP)/libcrypto.a | ||
23 | LIBSRC=lhash.c lh_stats.c | ||
24 | LIBOBJ=lhash.o lh_stats.o | ||
25 | |||
26 | SRC= $(LIBSRC) | ||
27 | |||
28 | EXHEADER= lhash.h | ||
29 | HEADER= $(EXHEADER) | ||
30 | |||
31 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
32 | |||
33 | top: | ||
34 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
35 | |||
36 | all: lib | ||
37 | |||
38 | lib: $(LIBOBJ) | ||
39 | $(AR) $(LIB) $(LIBOBJ) | ||
40 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
41 | @touch lib | ||
42 | |||
43 | files: | ||
44 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
45 | |||
46 | links: | ||
47 | /bin/rm -f Makefile | ||
48 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
49 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
50 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
51 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
52 | |||
53 | install: | ||
54 | @for i in $(EXHEADER) ; \ | ||
55 | do \ | ||
56 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
57 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
58 | done; | ||
59 | |||
60 | tags: | ||
61 | ctags $(SRC) | ||
62 | |||
63 | tests: | ||
64 | |||
65 | lint: | ||
66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
67 | |||
68 | depend: | ||
69 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
70 | |||
71 | dclean: | ||
72 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
73 | mv -f Makefile.new $(MAKEFILE) | ||
74 | |||
75 | clean: | ||
76 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
77 | |||
78 | errors: | ||
79 | |||
80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | $! | ||
2 | $! Compile crypto.c as several subset modules and insert in crypto-xxx.olb. | ||
3 | $! If P1 is specifed, it specifies alternate list of subsets to compile. | ||
4 | $! | ||
5 | $ libname = "CRYPTO-AXP.OLB" | ||
6 | $ subset_list = "LIB,ASN1,BN,BUFFER,CONF,DES,DH,DSA,ERROR,EVP,IDEA,LHASH,MD," + - | ||
7 | "METH,OBJECTS,PEM,RAND,RC,RSA,SHA,STACK,TXT_DB,X509" | ||
8 | $ if p1 .nes. "" then subset_list = p1 | ||
9 | $! | ||
10 | $ if f$getsyi("CPU") .lt. 128 then libname = "CRYPTO-VAX.OLB" | ||
11 | $ if f$search(libname) .eqs. "" then library/create/object/log 'libname' | ||
12 | $! | ||
13 | $ cc = "cc/include=[-.include]/prefix=all" + P2 | ||
14 | $! | ||
15 | $ i = 0 | ||
16 | $ next_subset: | ||
17 | $ subset = f$element(i,",",subset_list) | ||
18 | $ if subset .eqs. "," then goto done | ||
19 | $ i = i + 1 | ||
20 | $ create crypto_'subset'.subset | ||
21 | #include "crypto.c" | ||
22 | $ ofile = "sys$disk:[]crypto_" + subset + ".obj" | ||
23 | $ on warning then goto next_subset | ||
24 | $ write sys$output "Compiling ", ofile | ||
25 | $ cc /object='ofile' crypto_'subset'.subset - | ||
26 | /define=(CRYPTO_SUBSET,CRYPTO_'subset'_SUBSET) | ||
27 | $ library/replace/log 'libname'/module=CRYPTO_'subset' 'ofile' | ||
28 | $ goto next_subset | ||
29 | $! | ||
30 | $ done: | ||
31 | $ exit | ||
diff --git a/src/lib/libcrypto/md2/Makefile.ssl b/src/lib/libcrypto/md2/Makefile.ssl new file mode 100644 index 0000000000..d8e7200c83 --- /dev/null +++ b/src/lib/libcrypto/md2/Makefile.ssl | |||
@@ -0,0 +1,80 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/md/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= md | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | GENERAL=Makefile | ||
19 | TEST=md2test.c | ||
20 | APPS= | ||
21 | |||
22 | LIB=$(TOP)/libcrypto.a | ||
23 | LIBSRC=md2_dgst.c md5_one.c | ||
24 | LIBOBJ=md2_dgst.o md2_one.o | ||
25 | |||
26 | SRC= $(LIBSRC) | ||
27 | |||
28 | EXHEADER= md2.h | ||
29 | HEADER= $(EXHEADER) | ||
30 | |||
31 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
32 | |||
33 | top: | ||
34 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
35 | |||
36 | all: lib | ||
37 | |||
38 | lib: $(LIBOBJ) | ||
39 | $(AR) $(LIB) $(LIBOBJ) | ||
40 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
41 | @touch lib | ||
42 | |||
43 | files: | ||
44 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
45 | |||
46 | links: | ||
47 | /bin/rm -f Makefile | ||
48 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
49 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
50 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
51 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
52 | |||
53 | install: | ||
54 | @for i in $(EXHEADER) ; \ | ||
55 | do \ | ||
56 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
57 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
58 | done; | ||
59 | |||
60 | tags: | ||
61 | ctags $(SRC) | ||
62 | |||
63 | tests: | ||
64 | |||
65 | lint: | ||
66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
67 | |||
68 | depend: | ||
69 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
70 | |||
71 | dclean: | ||
72 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
73 | mv -f Makefile.new $(MAKEFILE) | ||
74 | |||
75 | clean: | ||
76 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
77 | |||
78 | errors: | ||
79 | |||
80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | /* crypto/md/md2.org */ | ||
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
60 | * | ||
61 | * Always modify md2.org since md2.h is automatically generated from | ||
62 | * it during SSLeay configuration. | ||
63 | * | ||
64 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
65 | */ | ||
66 | |||
67 | |||
68 | #ifndef HEADER_MD2_H | ||
69 | #define HEADER_MD2_H | ||
70 | |||
71 | #ifdef __cplusplus | ||
72 | extern "C" { | ||
73 | #endif | ||
74 | |||
75 | #define MD2_DIGEST_LENGTH 16 | ||
76 | #define MD2_BLOCK 16 | ||
77 | |||
78 | #define MD2_INT unsigned int | ||
79 | |||
80 | typedef struct MD2state_st | ||
81 | { | ||
82 | int num; | ||
83 | unsigned char data[MD2_BLOCK]; | ||
84 | MD2_INT cksm[MD2_BLOCK]; | ||
85 | MD2_INT state[MD2_BLOCK]; | ||
86 | } MD2_CTX; | ||
87 | |||
88 | #ifndef NOPROTO | ||
89 | char *MD2_options(void); | ||
90 | void MD2_Init(MD2_CTX *c); | ||
91 | void MD2_Update(MD2_CTX *c, register unsigned char *data, unsigned long len); | ||
92 | void MD2_Final(unsigned char *md, MD2_CTX *c); | ||
93 | unsigned char *MD2(unsigned char *d, unsigned long n,unsigned char *md); | ||
94 | #else | ||
95 | char *MD2_options(); | ||
96 | void MD2_Init(); | ||
97 | void MD2_Update(); | ||
98 | void MD2_Final(); | ||
99 | unsigned char *MD2(); | ||
100 | #endif | ||
101 | |||
102 | #ifdef __cplusplus | ||
103 | } | ||
104 | #endif | ||
105 | |||
106 | #endif | ||
diff --git a/src/lib/libcrypto/md5/Makefile.ssl b/src/lib/libcrypto/md5/Makefile.ssl new file mode 100644 index 0000000000..47e1ce05ca --- /dev/null +++ b/src/lib/libcrypto/md5/Makefile.ssl | |||
@@ -0,0 +1,104 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/md5/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= md5 | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | CPP= $(CC) -E | ||
9 | INCLUDES= | ||
10 | CFLAG=-g | ||
11 | INSTALLTOP=/usr/local/ssl | ||
12 | MAKE= make -f Makefile.ssl | ||
13 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
14 | MAKEFILE= Makefile.ssl | ||
15 | AR= ar r | ||
16 | |||
17 | MD5_ASM_OBJ= | ||
18 | |||
19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
20 | |||
21 | GENERAL=Makefile | ||
22 | TEST=md5test.c | ||
23 | APPS=md5.c | ||
24 | |||
25 | LIB=$(TOP)/libcrypto.a | ||
26 | LIBSRC=md5_dgst.c md5_one.c | ||
27 | LIBOBJ=md5_dgst.o md5_one.o $(MD5_ASM_OBJ) | ||
28 | |||
29 | SRC= $(LIBSRC) | ||
30 | |||
31 | EXHEADER= md5.h | ||
32 | HEADER= md5_locl.h $(EXHEADER) | ||
33 | |||
34 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
35 | |||
36 | top: | ||
37 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
38 | |||
39 | all: lib | ||
40 | |||
41 | lib: $(LIBOBJ) | ||
42 | $(AR) $(LIB) $(LIBOBJ) | ||
43 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
44 | @touch lib | ||
45 | |||
46 | # elf | ||
47 | asm/mx86-elf.o: asm/mx86unix.cpp | ||
48 | $(CPP) -DELF asm/mx86unix.cpp | as -o asm/mx86-elf.o | ||
49 | |||
50 | # solaris | ||
51 | asm/mx86-sol.o: asm/mx86unix.cpp | ||
52 | $(CC) -E -DSOL asm/mx86unix.cpp | sed 's/^#.*//' > asm/mx86-sol.s | ||
53 | as -o asm/mx86-sol.o asm/mx86-sol.s | ||
54 | rm -f asm/mx86-sol.s | ||
55 | |||
56 | # a.out | ||
57 | asm/mx86-out.o: asm/mx86unix.cpp | ||
58 | $(CPP) -DOUT asm/mx86unix.cpp | as -o asm/mx86-out.o | ||
59 | |||
60 | # bsdi | ||
61 | asm/mx86bsdi.o: asm/mx86unix.cpp | ||
62 | $(CPP) -DBSDI asm/mx86unix.cpp | as -o asm/mx86bsdi.o | ||
63 | |||
64 | asm/mx86unix.cpp: | ||
65 | (cd asm; perl md5-586.pl cpp >mx86unix.cpp) | ||
66 | |||
67 | files: | ||
68 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
69 | |||
70 | links: | ||
71 | /bin/rm -f Makefile | ||
72 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
73 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
74 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
75 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
76 | |||
77 | install: | ||
78 | @for i in $(EXHEADER) ; \ | ||
79 | do \ | ||
80 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
81 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
82 | done; | ||
83 | |||
84 | tags: | ||
85 | ctags $(SRC) | ||
86 | |||
87 | tests: | ||
88 | |||
89 | lint: | ||
90 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
91 | |||
92 | depend: | ||
93 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
94 | |||
95 | dclean: | ||
96 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
97 | mv -f Makefile.new $(MAKEFILE) | ||
98 | |||
99 | clean: | ||
100 | /bin/rm -f *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
101 | |||
102 | errors: | ||
103 | |||
104 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | # Targets | ||
2 | # make - twidle the options yourself :-) | ||
3 | # make cc - standard cc options | ||
4 | # make gcc - standard gcc options | ||
5 | # make x86-elf - linux-elf etc | ||
6 | # make x86-out - linux-a.out, FreeBSD etc | ||
7 | # make x86-solaris | ||
8 | # make x86-bdsi | ||
9 | |||
10 | DIR= md5 | ||
11 | TOP= . | ||
12 | CC= gcc | ||
13 | CFLAG= -O3 -fomit-frame-pointer | ||
14 | |||
15 | CPP= $(CC) -E | ||
16 | INCLUDES= | ||
17 | INSTALLTOP=/usr/local/lib | ||
18 | MAKE= make | ||
19 | MAKEDEPEND= makedepend | ||
20 | MAKEFILE= Makefile.uni | ||
21 | AR= ar r | ||
22 | |||
23 | MD5_ASM_OBJ= | ||
24 | |||
25 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
26 | |||
27 | GENERAL=Makefile | ||
28 | TEST=md5test | ||
29 | APPS=md5 | ||
30 | |||
31 | LIB=libmd5.a | ||
32 | LIBSRC=md5_dgst.c md5_one.c | ||
33 | LIBOBJ=md5_dgst.o md5_one.o $(MD5_ASM_OBJ) | ||
34 | |||
35 | SRC= $(LIBSRC) | ||
36 | |||
37 | EXHEADER= md5.h | ||
38 | HEADER= md5_locl.h $(EXHEADER) | ||
39 | |||
40 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
41 | |||
42 | all: $(LIB) $(TEST) $(APPS) | ||
43 | |||
44 | $(LIB): $(LIBOBJ) | ||
45 | $(AR) $(LIB) $(LIBOBJ) | ||
46 | sh $(TOP)/ranlib.sh $(LIB) | ||
47 | |||
48 | # elf | ||
49 | asm/mx86-elf.o: asm/mx86unix.cpp | ||
50 | $(CPP) -DELF asm/mx86unix.cpp | as -o asm/mx86-elf.o | ||
51 | |||
52 | # solaris | ||
53 | asm/mx86-sol.o: asm/mx86unix.cpp | ||
54 | $(CC) -E -DSOL asm/mx86unix.cpp | sed 's/^#.*//' > asm/mx86-sol.s | ||
55 | as -o asm/mx86-sol.o asm/mx86-sol.s | ||
56 | rm -f asm/mx86-sol.s | ||
57 | |||
58 | # a.out | ||
59 | asm/mx86-out.o: asm/mx86unix.cpp | ||
60 | $(CPP) -DOUT asm/mx86unix.cpp | as -o asm/mx86-out.o | ||
61 | |||
62 | # bsdi | ||
63 | asm/mx86bsdi.o: asm/mx86unix.cpp | ||
64 | $(CPP) -DBSDI asm/mx86unix.cpp | as -o asm/mx86bsdi.o | ||
65 | |||
66 | asm/mx86unix.cpp: | ||
67 | (cd asm; perl md5-586.pl cpp >mx86unix.cpp) | ||
68 | |||
69 | test: $(TEST) | ||
70 | ./$(TEST) | ||
71 | |||
72 | $(TEST): $(TEST).c $(LIB) | ||
73 | $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) | ||
74 | |||
75 | $(APPS): $(APPS).c $(LIB) | ||
76 | $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) | ||
77 | |||
78 | lint: | ||
79 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
80 | |||
81 | depend: | ||
82 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
83 | |||
84 | dclean: | ||
85 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
86 | mv -f Makefile.new $(MAKEFILE) | ||
87 | |||
88 | clean: | ||
89 | /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
90 | |||
91 | cc: | ||
92 | $(MAKE) MD5_ASM_OBJ="" CC="cc" CFLAG="-O" all | ||
93 | |||
94 | gcc: | ||
95 | $(MAKE) MD5_ASM_OBJ="" CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all | ||
96 | |||
97 | x86-elf: | ||
98 | $(MAKE) MD5_ASM_OBJ="asm/mx86-elf.o" CFLAG="-DELF -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all | ||
99 | |||
100 | x86-out: | ||
101 | $(MAKE) MD5_ASM_OBJ="asm/mx86-out.o" CFLAG="-DOUT -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all | ||
102 | |||
103 | x86-solaris: | ||
104 | $(MAKE) MD5_ASM_OBJ="asm/mx86-sol.o" CFLAG="-DSOL -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all | ||
105 | |||
106 | x86-bdsi: | ||
107 | $(MAKE) MD5_ASM_OBJ="asm/mx86-bdsi.o" CFLAG="-DBDSI -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all | ||
108 | |||
109 | # 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 @@ | |||
1 | ; Don't even think of reading this code | ||
2 | ; It was automatically generated by md5-586.pl | ||
3 | ; Which is a perl program used to generate the x86 assember for | ||
4 | ; any of elf, a.out, BSDI,Win32, or Solaris | ||
5 | ; eric <eay@cryptsoft.com> | ||
6 | ; | ||
7 | TITLE md5-586.asm | ||
8 | .386 | ||
9 | .model FLAT | ||
10 | _TEXT SEGMENT | ||
11 | PUBLIC _md5_block_x86 | ||
12 | |||
13 | _md5_block_x86 PROC NEAR | ||
14 | push esi | ||
15 | push edi | ||
16 | mov edi, DWORD PTR 12[esp] | ||
17 | mov esi, DWORD PTR 16[esp] | ||
18 | mov ecx, DWORD PTR 20[esp] | ||
19 | push ebp | ||
20 | push ebx | ||
21 | add ecx, esi | ||
22 | sub ecx, 64 | ||
23 | mov eax, DWORD PTR [edi] | ||
24 | push ecx | ||
25 | mov ebx, DWORD PTR 4[edi] | ||
26 | mov ecx, DWORD PTR 8[edi] | ||
27 | mov edx, DWORD PTR 12[edi] | ||
28 | L000start: | ||
29 | ; | ||
30 | ; R0 section | ||
31 | mov edi, ecx | ||
32 | mov ebp, DWORD PTR [esi] | ||
33 | ; R0 0 | ||
34 | xor edi, edx | ||
35 | and edi, ebx | ||
36 | lea eax, DWORD PTR 3614090360[ebp*1+eax] | ||
37 | mov ebp, DWORD PTR 4[esi] | ||
38 | xor edi, edx | ||
39 | add eax, edi | ||
40 | mov edi, ebx | ||
41 | rol eax, 7 | ||
42 | add eax, ebx | ||
43 | ; R0 1 | ||
44 | xor edi, ecx | ||
45 | and edi, eax | ||
46 | lea edx, DWORD PTR 3905402710[ebp*1+edx] | ||
47 | mov ebp, DWORD PTR 8[esi] | ||
48 | xor edi, ecx | ||
49 | add edx, edi | ||
50 | mov edi, eax | ||
51 | rol edx, 12 | ||
52 | add edx, eax | ||
53 | ; R0 2 | ||
54 | xor edi, ebx | ||
55 | and edi, edx | ||
56 | lea ecx, DWORD PTR 606105819[ebp*1+ecx] | ||
57 | mov ebp, DWORD PTR 12[esi] | ||
58 | xor edi, ebx | ||
59 | add ecx, edi | ||
60 | mov edi, edx | ||
61 | rol ecx, 17 | ||
62 | add ecx, edx | ||
63 | ; R0 3 | ||
64 | xor edi, eax | ||
65 | and edi, ecx | ||
66 | lea ebx, DWORD PTR 3250441966[ebp*1+ebx] | ||
67 | mov ebp, DWORD PTR 16[esi] | ||
68 | xor edi, eax | ||
69 | add ebx, edi | ||
70 | mov edi, ecx | ||
71 | rol ebx, 22 | ||
72 | add ebx, ecx | ||
73 | ; R0 4 | ||
74 | xor edi, edx | ||
75 | and edi, ebx | ||
76 | lea eax, DWORD PTR 4118548399[ebp*1+eax] | ||
77 | mov ebp, DWORD PTR 20[esi] | ||
78 | xor edi, edx | ||
79 | add eax, edi | ||
80 | mov edi, ebx | ||
81 | rol eax, 7 | ||
82 | add eax, ebx | ||
83 | ; R0 5 | ||
84 | xor edi, ecx | ||
85 | and edi, eax | ||
86 | lea edx, DWORD PTR 1200080426[ebp*1+edx] | ||
87 | mov ebp, DWORD PTR 24[esi] | ||
88 | xor edi, ecx | ||
89 | add edx, edi | ||
90 | mov edi, eax | ||
91 | rol edx, 12 | ||
92 | add edx, eax | ||
93 | ; R0 6 | ||
94 | xor edi, ebx | ||
95 | and edi, edx | ||
96 | lea ecx, DWORD PTR 2821735955[ebp*1+ecx] | ||
97 | mov ebp, DWORD PTR 28[esi] | ||
98 | xor edi, ebx | ||
99 | add ecx, edi | ||
100 | mov edi, edx | ||
101 | rol ecx, 17 | ||
102 | add ecx, edx | ||
103 | ; R0 7 | ||
104 | xor edi, eax | ||
105 | and edi, ecx | ||
106 | lea ebx, DWORD PTR 4249261313[ebp*1+ebx] | ||
107 | mov ebp, DWORD PTR 32[esi] | ||
108 | xor edi, eax | ||
109 | add ebx, edi | ||
110 | mov edi, ecx | ||
111 | rol ebx, 22 | ||
112 | add ebx, ecx | ||
113 | ; R0 8 | ||
114 | xor edi, edx | ||
115 | and edi, ebx | ||
116 | lea eax, DWORD PTR 1770035416[ebp*1+eax] | ||
117 | mov ebp, DWORD PTR 36[esi] | ||
118 | xor edi, edx | ||
119 | add eax, edi | ||
120 | mov edi, ebx | ||
121 | rol eax, 7 | ||
122 | add eax, ebx | ||
123 | ; R0 9 | ||
124 | xor edi, ecx | ||
125 | and edi, eax | ||
126 | lea edx, DWORD PTR 2336552879[ebp*1+edx] | ||
127 | mov ebp, DWORD PTR 40[esi] | ||
128 | xor edi, ecx | ||
129 | add edx, edi | ||
130 | mov edi, eax | ||
131 | rol edx, 12 | ||
132 | add edx, eax | ||
133 | ; R0 10 | ||
134 | xor edi, ebx | ||
135 | and edi, edx | ||
136 | lea ecx, DWORD PTR 4294925233[ebp*1+ecx] | ||
137 | mov ebp, DWORD PTR 44[esi] | ||
138 | xor edi, ebx | ||
139 | add ecx, edi | ||
140 | mov edi, edx | ||
141 | rol ecx, 17 | ||
142 | add ecx, edx | ||
143 | ; R0 11 | ||
144 | xor edi, eax | ||
145 | and edi, ecx | ||
146 | lea ebx, DWORD PTR 2304563134[ebp*1+ebx] | ||
147 | mov ebp, DWORD PTR 48[esi] | ||
148 | xor edi, eax | ||
149 | add ebx, edi | ||
150 | mov edi, ecx | ||
151 | rol ebx, 22 | ||
152 | add ebx, ecx | ||
153 | ; R0 12 | ||
154 | xor edi, edx | ||
155 | and edi, ebx | ||
156 | lea eax, DWORD PTR 1804603682[ebp*1+eax] | ||
157 | mov ebp, DWORD PTR 52[esi] | ||
158 | xor edi, edx | ||
159 | add eax, edi | ||
160 | mov edi, ebx | ||
161 | rol eax, 7 | ||
162 | add eax, ebx | ||
163 | ; R0 13 | ||
164 | xor edi, ecx | ||
165 | and edi, eax | ||
166 | lea edx, DWORD PTR 4254626195[ebp*1+edx] | ||
167 | mov ebp, DWORD PTR 56[esi] | ||
168 | xor edi, ecx | ||
169 | add edx, edi | ||
170 | mov edi, eax | ||
171 | rol edx, 12 | ||
172 | add edx, eax | ||
173 | ; R0 14 | ||
174 | xor edi, ebx | ||
175 | and edi, edx | ||
176 | lea ecx, DWORD PTR 2792965006[ebp*1+ecx] | ||
177 | mov ebp, DWORD PTR 60[esi] | ||
178 | xor edi, ebx | ||
179 | add ecx, edi | ||
180 | mov edi, edx | ||
181 | rol ecx, 17 | ||
182 | add ecx, edx | ||
183 | ; R0 15 | ||
184 | xor edi, eax | ||
185 | and edi, ecx | ||
186 | lea ebx, DWORD PTR 1236535329[ebp*1+ebx] | ||
187 | mov ebp, DWORD PTR 4[esi] | ||
188 | xor edi, eax | ||
189 | add ebx, edi | ||
190 | mov edi, ecx | ||
191 | rol ebx, 22 | ||
192 | add ebx, ecx | ||
193 | ; | ||
194 | ; R1 section | ||
195 | ; R1 16 | ||
196 | lea eax, DWORD PTR 4129170786[ebp*1+eax] | ||
197 | xor edi, ebx | ||
198 | and edi, edx | ||
199 | mov ebp, DWORD PTR 24[esi] | ||
200 | xor edi, ecx | ||
201 | add eax, edi | ||
202 | mov edi, ebx | ||
203 | rol eax, 5 | ||
204 | add eax, ebx | ||
205 | ; R1 17 | ||
206 | lea edx, DWORD PTR 3225465664[ebp*1+edx] | ||
207 | xor edi, eax | ||
208 | and edi, ecx | ||
209 | mov ebp, DWORD PTR 44[esi] | ||
210 | xor edi, ebx | ||
211 | add edx, edi | ||
212 | mov edi, eax | ||
213 | rol edx, 9 | ||
214 | add edx, eax | ||
215 | ; R1 18 | ||
216 | lea ecx, DWORD PTR 643717713[ebp*1+ecx] | ||
217 | xor edi, edx | ||
218 | and edi, ebx | ||
219 | mov ebp, DWORD PTR [esi] | ||
220 | xor edi, eax | ||
221 | add ecx, edi | ||
222 | mov edi, edx | ||
223 | rol ecx, 14 | ||
224 | add ecx, edx | ||
225 | ; R1 19 | ||
226 | lea ebx, DWORD PTR 3921069994[ebp*1+ebx] | ||
227 | xor edi, ecx | ||
228 | and edi, eax | ||
229 | mov ebp, DWORD PTR 20[esi] | ||
230 | xor edi, edx | ||
231 | add ebx, edi | ||
232 | mov edi, ecx | ||
233 | rol ebx, 20 | ||
234 | add ebx, ecx | ||
235 | ; R1 20 | ||
236 | lea eax, DWORD PTR 3593408605[ebp*1+eax] | ||
237 | xor edi, ebx | ||
238 | and edi, edx | ||
239 | mov ebp, DWORD PTR 40[esi] | ||
240 | xor edi, ecx | ||
241 | add eax, edi | ||
242 | mov edi, ebx | ||
243 | rol eax, 5 | ||
244 | add eax, ebx | ||
245 | ; R1 21 | ||
246 | lea edx, DWORD PTR 38016083[ebp*1+edx] | ||
247 | xor edi, eax | ||
248 | and edi, ecx | ||
249 | mov ebp, DWORD PTR 60[esi] | ||
250 | xor edi, ebx | ||
251 | add edx, edi | ||
252 | mov edi, eax | ||
253 | rol edx, 9 | ||
254 | add edx, eax | ||
255 | ; R1 22 | ||
256 | lea ecx, DWORD PTR 3634488961[ebp*1+ecx] | ||
257 | xor edi, edx | ||
258 | and edi, ebx | ||
259 | mov ebp, DWORD PTR 16[esi] | ||
260 | xor edi, eax | ||
261 | add ecx, edi | ||
262 | mov edi, edx | ||
263 | rol ecx, 14 | ||
264 | add ecx, edx | ||
265 | ; R1 23 | ||
266 | lea ebx, DWORD PTR 3889429448[ebp*1+ebx] | ||
267 | xor edi, ecx | ||
268 | and edi, eax | ||
269 | mov ebp, DWORD PTR 36[esi] | ||
270 | xor edi, edx | ||
271 | add ebx, edi | ||
272 | mov edi, ecx | ||
273 | rol ebx, 20 | ||
274 | add ebx, ecx | ||
275 | ; R1 24 | ||
276 | lea eax, DWORD PTR 568446438[ebp*1+eax] | ||
277 | xor edi, ebx | ||
278 | and edi, edx | ||
279 | mov ebp, DWORD PTR 56[esi] | ||
280 | xor edi, ecx | ||
281 | add eax, edi | ||
282 | mov edi, ebx | ||
283 | rol eax, 5 | ||
284 | add eax, ebx | ||
285 | ; R1 25 | ||
286 | lea edx, DWORD PTR 3275163606[ebp*1+edx] | ||
287 | xor edi, eax | ||
288 | and edi, ecx | ||
289 | mov ebp, DWORD PTR 12[esi] | ||
290 | xor edi, ebx | ||
291 | add edx, edi | ||
292 | mov edi, eax | ||
293 | rol edx, 9 | ||
294 | add edx, eax | ||
295 | ; R1 26 | ||
296 | lea ecx, DWORD PTR 4107603335[ebp*1+ecx] | ||
297 | xor edi, edx | ||
298 | and edi, ebx | ||
299 | mov ebp, DWORD PTR 32[esi] | ||
300 | xor edi, eax | ||
301 | add ecx, edi | ||
302 | mov edi, edx | ||
303 | rol ecx, 14 | ||
304 | add ecx, edx | ||
305 | ; R1 27 | ||
306 | lea ebx, DWORD PTR 1163531501[ebp*1+ebx] | ||
307 | xor edi, ecx | ||
308 | and edi, eax | ||
309 | mov ebp, DWORD PTR 52[esi] | ||
310 | xor edi, edx | ||
311 | add ebx, edi | ||
312 | mov edi, ecx | ||
313 | rol ebx, 20 | ||
314 | add ebx, ecx | ||
315 | ; R1 28 | ||
316 | lea eax, DWORD PTR 2850285829[ebp*1+eax] | ||
317 | xor edi, ebx | ||
318 | and edi, edx | ||
319 | mov ebp, DWORD PTR 8[esi] | ||
320 | xor edi, ecx | ||
321 | add eax, edi | ||
322 | mov edi, ebx | ||
323 | rol eax, 5 | ||
324 | add eax, ebx | ||
325 | ; R1 29 | ||
326 | lea edx, DWORD PTR 4243563512[ebp*1+edx] | ||
327 | xor edi, eax | ||
328 | and edi, ecx | ||
329 | mov ebp, DWORD PTR 28[esi] | ||
330 | xor edi, ebx | ||
331 | add edx, edi | ||
332 | mov edi, eax | ||
333 | rol edx, 9 | ||
334 | add edx, eax | ||
335 | ; R1 30 | ||
336 | lea ecx, DWORD PTR 1735328473[ebp*1+ecx] | ||
337 | xor edi, edx | ||
338 | and edi, ebx | ||
339 | mov ebp, DWORD PTR 48[esi] | ||
340 | xor edi, eax | ||
341 | add ecx, edi | ||
342 | mov edi, edx | ||
343 | rol ecx, 14 | ||
344 | add ecx, edx | ||
345 | ; R1 31 | ||
346 | lea ebx, DWORD PTR 2368359562[ebp*1+ebx] | ||
347 | xor edi, ecx | ||
348 | and edi, eax | ||
349 | mov ebp, DWORD PTR 20[esi] | ||
350 | xor edi, edx | ||
351 | add ebx, edi | ||
352 | mov edi, ecx | ||
353 | rol ebx, 20 | ||
354 | add ebx, ecx | ||
355 | ; | ||
356 | ; R2 section | ||
357 | ; R2 32 | ||
358 | xor edi, edx | ||
359 | xor edi, ebx | ||
360 | lea eax, DWORD PTR 4294588738[ebp*1+eax] | ||
361 | add eax, edi | ||
362 | mov ebp, DWORD PTR 32[esi] | ||
363 | rol eax, 4 | ||
364 | mov edi, ebx | ||
365 | ; R2 33 | ||
366 | lea edx, DWORD PTR 2272392833[ebp*1+edx] | ||
367 | add eax, ebx | ||
368 | xor edi, ecx | ||
369 | xor edi, eax | ||
370 | mov ebp, DWORD PTR 44[esi] | ||
371 | add edx, edi | ||
372 | mov edi, eax | ||
373 | rol edx, 11 | ||
374 | add edx, eax | ||
375 | ; R2 34 | ||
376 | xor edi, ebx | ||
377 | xor edi, edx | ||
378 | lea ecx, DWORD PTR 1839030562[ebp*1+ecx] | ||
379 | add ecx, edi | ||
380 | mov ebp, DWORD PTR 56[esi] | ||
381 | rol ecx, 16 | ||
382 | mov edi, edx | ||
383 | ; R2 35 | ||
384 | lea ebx, DWORD PTR 4259657740[ebp*1+ebx] | ||
385 | add ecx, edx | ||
386 | xor edi, eax | ||
387 | xor edi, ecx | ||
388 | mov ebp, DWORD PTR 4[esi] | ||
389 | add ebx, edi | ||
390 | mov edi, ecx | ||
391 | rol ebx, 23 | ||
392 | add ebx, ecx | ||
393 | ; R2 36 | ||
394 | xor edi, edx | ||
395 | xor edi, ebx | ||
396 | lea eax, DWORD PTR 2763975236[ebp*1+eax] | ||
397 | add eax, edi | ||
398 | mov ebp, DWORD PTR 16[esi] | ||
399 | rol eax, 4 | ||
400 | mov edi, ebx | ||
401 | ; R2 37 | ||
402 | lea edx, DWORD PTR 1272893353[ebp*1+edx] | ||
403 | add eax, ebx | ||
404 | xor edi, ecx | ||
405 | xor edi, eax | ||
406 | mov ebp, DWORD PTR 28[esi] | ||
407 | add edx, edi | ||
408 | mov edi, eax | ||
409 | rol edx, 11 | ||
410 | add edx, eax | ||
411 | ; R2 38 | ||
412 | xor edi, ebx | ||
413 | xor edi, edx | ||
414 | lea ecx, DWORD PTR 4139469664[ebp*1+ecx] | ||
415 | add ecx, edi | ||
416 | mov ebp, DWORD PTR 40[esi] | ||
417 | rol ecx, 16 | ||
418 | mov edi, edx | ||
419 | ; R2 39 | ||
420 | lea ebx, DWORD PTR 3200236656[ebp*1+ebx] | ||
421 | add ecx, edx | ||
422 | xor edi, eax | ||
423 | xor edi, ecx | ||
424 | mov ebp, DWORD PTR 52[esi] | ||
425 | add ebx, edi | ||
426 | mov edi, ecx | ||
427 | rol ebx, 23 | ||
428 | add ebx, ecx | ||
429 | ; R2 40 | ||
430 | xor edi, edx | ||
431 | xor edi, ebx | ||
432 | lea eax, DWORD PTR 681279174[ebp*1+eax] | ||
433 | add eax, edi | ||
434 | mov ebp, DWORD PTR [esi] | ||
435 | rol eax, 4 | ||
436 | mov edi, ebx | ||
437 | ; R2 41 | ||
438 | lea edx, DWORD PTR 3936430074[ebp*1+edx] | ||
439 | add eax, ebx | ||
440 | xor edi, ecx | ||
441 | xor edi, eax | ||
442 | mov ebp, DWORD PTR 12[esi] | ||
443 | add edx, edi | ||
444 | mov edi, eax | ||
445 | rol edx, 11 | ||
446 | add edx, eax | ||
447 | ; R2 42 | ||
448 | xor edi, ebx | ||
449 | xor edi, edx | ||
450 | lea ecx, DWORD PTR 3572445317[ebp*1+ecx] | ||
451 | add ecx, edi | ||
452 | mov ebp, DWORD PTR 24[esi] | ||
453 | rol ecx, 16 | ||
454 | mov edi, edx | ||
455 | ; R2 43 | ||
456 | lea ebx, DWORD PTR 76029189[ebp*1+ebx] | ||
457 | add ecx, edx | ||
458 | xor edi, eax | ||
459 | xor edi, ecx | ||
460 | mov ebp, DWORD PTR 36[esi] | ||
461 | add ebx, edi | ||
462 | mov edi, ecx | ||
463 | rol ebx, 23 | ||
464 | add ebx, ecx | ||
465 | ; R2 44 | ||
466 | xor edi, edx | ||
467 | xor edi, ebx | ||
468 | lea eax, DWORD PTR 3654602809[ebp*1+eax] | ||
469 | add eax, edi | ||
470 | mov ebp, DWORD PTR 48[esi] | ||
471 | rol eax, 4 | ||
472 | mov edi, ebx | ||
473 | ; R2 45 | ||
474 | lea edx, DWORD PTR 3873151461[ebp*1+edx] | ||
475 | add eax, ebx | ||
476 | xor edi, ecx | ||
477 | xor edi, eax | ||
478 | mov ebp, DWORD PTR 60[esi] | ||
479 | add edx, edi | ||
480 | mov edi, eax | ||
481 | rol edx, 11 | ||
482 | add edx, eax | ||
483 | ; R2 46 | ||
484 | xor edi, ebx | ||
485 | xor edi, edx | ||
486 | lea ecx, DWORD PTR 530742520[ebp*1+ecx] | ||
487 | add ecx, edi | ||
488 | mov ebp, DWORD PTR 8[esi] | ||
489 | rol ecx, 16 | ||
490 | mov edi, edx | ||
491 | ; R2 47 | ||
492 | lea ebx, DWORD PTR 3299628645[ebp*1+ebx] | ||
493 | add ecx, edx | ||
494 | xor edi, eax | ||
495 | xor edi, ecx | ||
496 | mov ebp, DWORD PTR [esi] | ||
497 | add ebx, edi | ||
498 | mov edi, -1 | ||
499 | rol ebx, 23 | ||
500 | add ebx, ecx | ||
501 | ; | ||
502 | ; R3 section | ||
503 | ; R3 48 | ||
504 | xor edi, edx | ||
505 | or edi, ebx | ||
506 | lea eax, DWORD PTR 4096336452[ebp*1+eax] | ||
507 | xor edi, ecx | ||
508 | mov ebp, DWORD PTR 28[esi] | ||
509 | add eax, edi | ||
510 | mov edi, -1 | ||
511 | rol eax, 6 | ||
512 | xor edi, ecx | ||
513 | add eax, ebx | ||
514 | ; R3 49 | ||
515 | or edi, eax | ||
516 | lea edx, DWORD PTR 1126891415[ebp*1+edx] | ||
517 | xor edi, ebx | ||
518 | mov ebp, DWORD PTR 56[esi] | ||
519 | add edx, edi | ||
520 | mov edi, -1 | ||
521 | rol edx, 10 | ||
522 | xor edi, ebx | ||
523 | add edx, eax | ||
524 | ; R3 50 | ||
525 | or edi, edx | ||
526 | lea ecx, DWORD PTR 2878612391[ebp*1+ecx] | ||
527 | xor edi, eax | ||
528 | mov ebp, DWORD PTR 20[esi] | ||
529 | add ecx, edi | ||
530 | mov edi, -1 | ||
531 | rol ecx, 15 | ||
532 | xor edi, eax | ||
533 | add ecx, edx | ||
534 | ; R3 51 | ||
535 | or edi, ecx | ||
536 | lea ebx, DWORD PTR 4237533241[ebp*1+ebx] | ||
537 | xor edi, edx | ||
538 | mov ebp, DWORD PTR 48[esi] | ||
539 | add ebx, edi | ||
540 | mov edi, -1 | ||
541 | rol ebx, 21 | ||
542 | xor edi, edx | ||
543 | add ebx, ecx | ||
544 | ; R3 52 | ||
545 | or edi, ebx | ||
546 | lea eax, DWORD PTR 1700485571[ebp*1+eax] | ||
547 | xor edi, ecx | ||
548 | mov ebp, DWORD PTR 12[esi] | ||
549 | add eax, edi | ||
550 | mov edi, -1 | ||
551 | rol eax, 6 | ||
552 | xor edi, ecx | ||
553 | add eax, ebx | ||
554 | ; R3 53 | ||
555 | or edi, eax | ||
556 | lea edx, DWORD PTR 2399980690[ebp*1+edx] | ||
557 | xor edi, ebx | ||
558 | mov ebp, DWORD PTR 40[esi] | ||
559 | add edx, edi | ||
560 | mov edi, -1 | ||
561 | rol edx, 10 | ||
562 | xor edi, ebx | ||
563 | add edx, eax | ||
564 | ; R3 54 | ||
565 | or edi, edx | ||
566 | lea ecx, DWORD PTR 4293915773[ebp*1+ecx] | ||
567 | xor edi, eax | ||
568 | mov ebp, DWORD PTR 4[esi] | ||
569 | add ecx, edi | ||
570 | mov edi, -1 | ||
571 | rol ecx, 15 | ||
572 | xor edi, eax | ||
573 | add ecx, edx | ||
574 | ; R3 55 | ||
575 | or edi, ecx | ||
576 | lea ebx, DWORD PTR 2240044497[ebp*1+ebx] | ||
577 | xor edi, edx | ||
578 | mov ebp, DWORD PTR 32[esi] | ||
579 | add ebx, edi | ||
580 | mov edi, -1 | ||
581 | rol ebx, 21 | ||
582 | xor edi, edx | ||
583 | add ebx, ecx | ||
584 | ; R3 56 | ||
585 | or edi, ebx | ||
586 | lea eax, DWORD PTR 1873313359[ebp*1+eax] | ||
587 | xor edi, ecx | ||
588 | mov ebp, DWORD PTR 60[esi] | ||
589 | add eax, edi | ||
590 | mov edi, -1 | ||
591 | rol eax, 6 | ||
592 | xor edi, ecx | ||
593 | add eax, ebx | ||
594 | ; R3 57 | ||
595 | or edi, eax | ||
596 | lea edx, DWORD PTR 4264355552[ebp*1+edx] | ||
597 | xor edi, ebx | ||
598 | mov ebp, DWORD PTR 24[esi] | ||
599 | add edx, edi | ||
600 | mov edi, -1 | ||
601 | rol edx, 10 | ||
602 | xor edi, ebx | ||
603 | add edx, eax | ||
604 | ; R3 58 | ||
605 | or edi, edx | ||
606 | lea ecx, DWORD PTR 2734768916[ebp*1+ecx] | ||
607 | xor edi, eax | ||
608 | mov ebp, DWORD PTR 52[esi] | ||
609 | add ecx, edi | ||
610 | mov edi, -1 | ||
611 | rol ecx, 15 | ||
612 | xor edi, eax | ||
613 | add ecx, edx | ||
614 | ; R3 59 | ||
615 | or edi, ecx | ||
616 | lea ebx, DWORD PTR 1309151649[ebp*1+ebx] | ||
617 | xor edi, edx | ||
618 | mov ebp, DWORD PTR 16[esi] | ||
619 | add ebx, edi | ||
620 | mov edi, -1 | ||
621 | rol ebx, 21 | ||
622 | xor edi, edx | ||
623 | add ebx, ecx | ||
624 | ; R3 60 | ||
625 | or edi, ebx | ||
626 | lea eax, DWORD PTR 4149444226[ebp*1+eax] | ||
627 | xor edi, ecx | ||
628 | mov ebp, DWORD PTR 44[esi] | ||
629 | add eax, edi | ||
630 | mov edi, -1 | ||
631 | rol eax, 6 | ||
632 | xor edi, ecx | ||
633 | add eax, ebx | ||
634 | ; R3 61 | ||
635 | or edi, eax | ||
636 | lea edx, DWORD PTR 3174756917[ebp*1+edx] | ||
637 | xor edi, ebx | ||
638 | mov ebp, DWORD PTR 8[esi] | ||
639 | add edx, edi | ||
640 | mov edi, -1 | ||
641 | rol edx, 10 | ||
642 | xor edi, ebx | ||
643 | add edx, eax | ||
644 | ; R3 62 | ||
645 | or edi, edx | ||
646 | lea ecx, DWORD PTR 718787259[ebp*1+ecx] | ||
647 | xor edi, eax | ||
648 | mov ebp, DWORD PTR 36[esi] | ||
649 | add ecx, edi | ||
650 | mov edi, -1 | ||
651 | rol ecx, 15 | ||
652 | xor edi, eax | ||
653 | add ecx, edx | ||
654 | ; R3 63 | ||
655 | or edi, ecx | ||
656 | lea ebx, DWORD PTR 3951481745[ebp*1+ebx] | ||
657 | xor edi, edx | ||
658 | mov ebp, DWORD PTR 24[esp] | ||
659 | add ebx, edi | ||
660 | add esi, 64 | ||
661 | rol ebx, 21 | ||
662 | mov edi, DWORD PTR [ebp] | ||
663 | add ebx, ecx | ||
664 | add eax, edi | ||
665 | mov edi, DWORD PTR 4[ebp] | ||
666 | add ebx, edi | ||
667 | mov edi, DWORD PTR 8[ebp] | ||
668 | add ecx, edi | ||
669 | mov edi, DWORD PTR 12[ebp] | ||
670 | add edx, edi | ||
671 | mov DWORD PTR [ebp],eax | ||
672 | mov DWORD PTR 4[ebp],ebx | ||
673 | mov edi, DWORD PTR [esp] | ||
674 | mov DWORD PTR 8[ebp],ecx | ||
675 | mov DWORD PTR 12[ebp],edx | ||
676 | cmp edi, esi | ||
677 | jge L000start | ||
678 | pop eax | ||
679 | pop ebx | ||
680 | pop ebp | ||
681 | pop edi | ||
682 | pop esi | ||
683 | ret | ||
684 | _md5_block_x86 ENDP | ||
685 | _TEXT ENDS | ||
686 | 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 @@ | |||
1 | /* Run the C pre-processor over this file with one of the following defined | ||
2 | * ELF - elf object files, | ||
3 | * OUT - a.out object files, | ||
4 | * BSDI - BSDI style a.out object files | ||
5 | * SOL - Solaris style elf | ||
6 | */ | ||
7 | |||
8 | #define TYPE(a,b) .type a,b | ||
9 | #define SIZE(a,b) .size a,b | ||
10 | |||
11 | #if defined(OUT) || defined(BSDI) | ||
12 | #define md5_block_x86 _md5_block_x86 | ||
13 | |||
14 | #endif | ||
15 | |||
16 | #ifdef OUT | ||
17 | #define OK 1 | ||
18 | #define ALIGN 4 | ||
19 | #endif | ||
20 | |||
21 | #ifdef BSDI | ||
22 | #define OK 1 | ||
23 | #define ALIGN 4 | ||
24 | #undef SIZE | ||
25 | #undef TYPE | ||
26 | #define SIZE(a,b) | ||
27 | #define TYPE(a,b) | ||
28 | #endif | ||
29 | |||
30 | #if defined(ELF) || defined(SOL) | ||
31 | #define OK 1 | ||
32 | #define ALIGN 16 | ||
33 | #endif | ||
34 | |||
35 | #ifndef OK | ||
36 | You need to define one of | ||
37 | ELF - elf systems - linux-elf, NetBSD and DG-UX | ||
38 | OUT - a.out systems - linux-a.out and FreeBSD | ||
39 | SOL - solaris systems, which are elf with strange comment lines | ||
40 | BSDI - a.out with a very primative version of as. | ||
41 | #endif | ||
42 | |||
43 | /* Let the Assembler begin :-) */ | ||
44 | /* Don't even think of reading this code */ | ||
45 | /* It was automatically generated by md5-586.pl */ | ||
46 | /* Which is a perl program used to generate the x86 assember for */ | ||
47 | /* any of elf, a.out, BSDI,Win32, or Solaris */ | ||
48 | /* eric <eay@cryptsoft.com> */ | ||
49 | |||
50 | .file "md5-586.s" | ||
51 | .version "01.01" | ||
52 | gcc2_compiled.: | ||
53 | .text | ||
54 | .align ALIGN | ||
55 | .globl md5_block_x86 | ||
56 | TYPE(md5_block_x86,@function) | ||
57 | md5_block_x86: | ||
58 | pushl %esi | ||
59 | pushl %edi | ||
60 | movl 12(%esp), %edi | ||
61 | movl 16(%esp), %esi | ||
62 | movl 20(%esp), %ecx | ||
63 | pushl %ebp | ||
64 | pushl %ebx | ||
65 | addl %esi, %ecx | ||
66 | subl $64, %ecx | ||
67 | movl (%edi), %eax | ||
68 | pushl %ecx | ||
69 | movl 4(%edi), %ebx | ||
70 | movl 8(%edi), %ecx | ||
71 | movl 12(%edi), %edx | ||
72 | .L000start: | ||
73 | |||
74 | /* R0 section */ | ||
75 | movl %ecx, %edi | ||
76 | movl (%esi), %ebp | ||
77 | /* R0 0 */ | ||
78 | xorl %edx, %edi | ||
79 | andl %ebx, %edi | ||
80 | leal 3614090360(%eax,%ebp,1),%eax | ||
81 | movl 4(%esi), %ebp | ||
82 | xorl %edx, %edi | ||
83 | addl %edi, %eax | ||
84 | movl %ebx, %edi | ||
85 | roll $7, %eax | ||
86 | addl %ebx, %eax | ||
87 | /* R0 1 */ | ||
88 | xorl %ecx, %edi | ||
89 | andl %eax, %edi | ||
90 | leal 3905402710(%edx,%ebp,1),%edx | ||
91 | movl 8(%esi), %ebp | ||
92 | xorl %ecx, %edi | ||
93 | addl %edi, %edx | ||
94 | movl %eax, %edi | ||
95 | roll $12, %edx | ||
96 | addl %eax, %edx | ||
97 | /* R0 2 */ | ||
98 | xorl %ebx, %edi | ||
99 | andl %edx, %edi | ||
100 | leal 606105819(%ecx,%ebp,1),%ecx | ||
101 | movl 12(%esi), %ebp | ||
102 | xorl %ebx, %edi | ||
103 | addl %edi, %ecx | ||
104 | movl %edx, %edi | ||
105 | roll $17, %ecx | ||
106 | addl %edx, %ecx | ||
107 | /* R0 3 */ | ||
108 | xorl %eax, %edi | ||
109 | andl %ecx, %edi | ||
110 | leal 3250441966(%ebx,%ebp,1),%ebx | ||
111 | movl 16(%esi), %ebp | ||
112 | xorl %eax, %edi | ||
113 | addl %edi, %ebx | ||
114 | movl %ecx, %edi | ||
115 | roll $22, %ebx | ||
116 | addl %ecx, %ebx | ||
117 | /* R0 4 */ | ||
118 | xorl %edx, %edi | ||
119 | andl %ebx, %edi | ||
120 | leal 4118548399(%eax,%ebp,1),%eax | ||
121 | movl 20(%esi), %ebp | ||
122 | xorl %edx, %edi | ||
123 | addl %edi, %eax | ||
124 | movl %ebx, %edi | ||
125 | roll $7, %eax | ||
126 | addl %ebx, %eax | ||
127 | /* R0 5 */ | ||
128 | xorl %ecx, %edi | ||
129 | andl %eax, %edi | ||
130 | leal 1200080426(%edx,%ebp,1),%edx | ||
131 | movl 24(%esi), %ebp | ||
132 | xorl %ecx, %edi | ||
133 | addl %edi, %edx | ||
134 | movl %eax, %edi | ||
135 | roll $12, %edx | ||
136 | addl %eax, %edx | ||
137 | /* R0 6 */ | ||
138 | xorl %ebx, %edi | ||
139 | andl %edx, %edi | ||
140 | leal 2821735955(%ecx,%ebp,1),%ecx | ||
141 | movl 28(%esi), %ebp | ||
142 | xorl %ebx, %edi | ||
143 | addl %edi, %ecx | ||
144 | movl %edx, %edi | ||
145 | roll $17, %ecx | ||
146 | addl %edx, %ecx | ||
147 | /* R0 7 */ | ||
148 | xorl %eax, %edi | ||
149 | andl %ecx, %edi | ||
150 | leal 4249261313(%ebx,%ebp,1),%ebx | ||
151 | movl 32(%esi), %ebp | ||
152 | xorl %eax, %edi | ||
153 | addl %edi, %ebx | ||
154 | movl %ecx, %edi | ||
155 | roll $22, %ebx | ||
156 | addl %ecx, %ebx | ||
157 | /* R0 8 */ | ||
158 | xorl %edx, %edi | ||
159 | andl %ebx, %edi | ||
160 | leal 1770035416(%eax,%ebp,1),%eax | ||
161 | movl 36(%esi), %ebp | ||
162 | xorl %edx, %edi | ||
163 | addl %edi, %eax | ||
164 | movl %ebx, %edi | ||
165 | roll $7, %eax | ||
166 | addl %ebx, %eax | ||
167 | /* R0 9 */ | ||
168 | xorl %ecx, %edi | ||
169 | andl %eax, %edi | ||
170 | leal 2336552879(%edx,%ebp,1),%edx | ||
171 | movl 40(%esi), %ebp | ||
172 | xorl %ecx, %edi | ||
173 | addl %edi, %edx | ||
174 | movl %eax, %edi | ||
175 | roll $12, %edx | ||
176 | addl %eax, %edx | ||
177 | /* R0 10 */ | ||
178 | xorl %ebx, %edi | ||
179 | andl %edx, %edi | ||
180 | leal 4294925233(%ecx,%ebp,1),%ecx | ||
181 | movl 44(%esi), %ebp | ||
182 | xorl %ebx, %edi | ||
183 | addl %edi, %ecx | ||
184 | movl %edx, %edi | ||
185 | roll $17, %ecx | ||
186 | addl %edx, %ecx | ||
187 | /* R0 11 */ | ||
188 | xorl %eax, %edi | ||
189 | andl %ecx, %edi | ||
190 | leal 2304563134(%ebx,%ebp,1),%ebx | ||
191 | movl 48(%esi), %ebp | ||
192 | xorl %eax, %edi | ||
193 | addl %edi, %ebx | ||
194 | movl %ecx, %edi | ||
195 | roll $22, %ebx | ||
196 | addl %ecx, %ebx | ||
197 | /* R0 12 */ | ||
198 | xorl %edx, %edi | ||
199 | andl %ebx, %edi | ||
200 | leal 1804603682(%eax,%ebp,1),%eax | ||
201 | movl 52(%esi), %ebp | ||
202 | xorl %edx, %edi | ||
203 | addl %edi, %eax | ||
204 | movl %ebx, %edi | ||
205 | roll $7, %eax | ||
206 | addl %ebx, %eax | ||
207 | /* R0 13 */ | ||
208 | xorl %ecx, %edi | ||
209 | andl %eax, %edi | ||
210 | leal 4254626195(%edx,%ebp,1),%edx | ||
211 | movl 56(%esi), %ebp | ||
212 | xorl %ecx, %edi | ||
213 | addl %edi, %edx | ||
214 | movl %eax, %edi | ||
215 | roll $12, %edx | ||
216 | addl %eax, %edx | ||
217 | /* R0 14 */ | ||
218 | xorl %ebx, %edi | ||
219 | andl %edx, %edi | ||
220 | leal 2792965006(%ecx,%ebp,1),%ecx | ||
221 | movl 60(%esi), %ebp | ||
222 | xorl %ebx, %edi | ||
223 | addl %edi, %ecx | ||
224 | movl %edx, %edi | ||
225 | roll $17, %ecx | ||
226 | addl %edx, %ecx | ||
227 | /* R0 15 */ | ||
228 | xorl %eax, %edi | ||
229 | andl %ecx, %edi | ||
230 | leal 1236535329(%ebx,%ebp,1),%ebx | ||
231 | movl 4(%esi), %ebp | ||
232 | xorl %eax, %edi | ||
233 | addl %edi, %ebx | ||
234 | movl %ecx, %edi | ||
235 | roll $22, %ebx | ||
236 | addl %ecx, %ebx | ||
237 | |||
238 | /* R1 section */ | ||
239 | /* R1 16 */ | ||
240 | leal 4129170786(%eax,%ebp,1),%eax | ||
241 | xorl %ebx, %edi | ||
242 | andl %edx, %edi | ||
243 | movl 24(%esi), %ebp | ||
244 | xorl %ecx, %edi | ||
245 | addl %edi, %eax | ||
246 | movl %ebx, %edi | ||
247 | roll $5, %eax | ||
248 | addl %ebx, %eax | ||
249 | /* R1 17 */ | ||
250 | leal 3225465664(%edx,%ebp,1),%edx | ||
251 | xorl %eax, %edi | ||
252 | andl %ecx, %edi | ||
253 | movl 44(%esi), %ebp | ||
254 | xorl %ebx, %edi | ||
255 | addl %edi, %edx | ||
256 | movl %eax, %edi | ||
257 | roll $9, %edx | ||
258 | addl %eax, %edx | ||
259 | /* R1 18 */ | ||
260 | leal 643717713(%ecx,%ebp,1),%ecx | ||
261 | xorl %edx, %edi | ||
262 | andl %ebx, %edi | ||
263 | movl (%esi), %ebp | ||
264 | xorl %eax, %edi | ||
265 | addl %edi, %ecx | ||
266 | movl %edx, %edi | ||
267 | roll $14, %ecx | ||
268 | addl %edx, %ecx | ||
269 | /* R1 19 */ | ||
270 | leal 3921069994(%ebx,%ebp,1),%ebx | ||
271 | xorl %ecx, %edi | ||
272 | andl %eax, %edi | ||
273 | movl 20(%esi), %ebp | ||
274 | xorl %edx, %edi | ||
275 | addl %edi, %ebx | ||
276 | movl %ecx, %edi | ||
277 | roll $20, %ebx | ||
278 | addl %ecx, %ebx | ||
279 | /* R1 20 */ | ||
280 | leal 3593408605(%eax,%ebp,1),%eax | ||
281 | xorl %ebx, %edi | ||
282 | andl %edx, %edi | ||
283 | movl 40(%esi), %ebp | ||
284 | xorl %ecx, %edi | ||
285 | addl %edi, %eax | ||
286 | movl %ebx, %edi | ||
287 | roll $5, %eax | ||
288 | addl %ebx, %eax | ||
289 | /* R1 21 */ | ||
290 | leal 38016083(%edx,%ebp,1),%edx | ||
291 | xorl %eax, %edi | ||
292 | andl %ecx, %edi | ||
293 | movl 60(%esi), %ebp | ||
294 | xorl %ebx, %edi | ||
295 | addl %edi, %edx | ||
296 | movl %eax, %edi | ||
297 | roll $9, %edx | ||
298 | addl %eax, %edx | ||
299 | /* R1 22 */ | ||
300 | leal 3634488961(%ecx,%ebp,1),%ecx | ||
301 | xorl %edx, %edi | ||
302 | andl %ebx, %edi | ||
303 | movl 16(%esi), %ebp | ||
304 | xorl %eax, %edi | ||
305 | addl %edi, %ecx | ||
306 | movl %edx, %edi | ||
307 | roll $14, %ecx | ||
308 | addl %edx, %ecx | ||
309 | /* R1 23 */ | ||
310 | leal 3889429448(%ebx,%ebp,1),%ebx | ||
311 | xorl %ecx, %edi | ||
312 | andl %eax, %edi | ||
313 | movl 36(%esi), %ebp | ||
314 | xorl %edx, %edi | ||
315 | addl %edi, %ebx | ||
316 | movl %ecx, %edi | ||
317 | roll $20, %ebx | ||
318 | addl %ecx, %ebx | ||
319 | /* R1 24 */ | ||
320 | leal 568446438(%eax,%ebp,1),%eax | ||
321 | xorl %ebx, %edi | ||
322 | andl %edx, %edi | ||
323 | movl 56(%esi), %ebp | ||
324 | xorl %ecx, %edi | ||
325 | addl %edi, %eax | ||
326 | movl %ebx, %edi | ||
327 | roll $5, %eax | ||
328 | addl %ebx, %eax | ||
329 | /* R1 25 */ | ||
330 | leal 3275163606(%edx,%ebp,1),%edx | ||
331 | xorl %eax, %edi | ||
332 | andl %ecx, %edi | ||
333 | movl 12(%esi), %ebp | ||
334 | xorl %ebx, %edi | ||
335 | addl %edi, %edx | ||
336 | movl %eax, %edi | ||
337 | roll $9, %edx | ||
338 | addl %eax, %edx | ||
339 | /* R1 26 */ | ||
340 | leal 4107603335(%ecx,%ebp,1),%ecx | ||
341 | xorl %edx, %edi | ||
342 | andl %ebx, %edi | ||
343 | movl 32(%esi), %ebp | ||
344 | xorl %eax, %edi | ||
345 | addl %edi, %ecx | ||
346 | movl %edx, %edi | ||
347 | roll $14, %ecx | ||
348 | addl %edx, %ecx | ||
349 | /* R1 27 */ | ||
350 | leal 1163531501(%ebx,%ebp,1),%ebx | ||
351 | xorl %ecx, %edi | ||
352 | andl %eax, %edi | ||
353 | movl 52(%esi), %ebp | ||
354 | xorl %edx, %edi | ||
355 | addl %edi, %ebx | ||
356 | movl %ecx, %edi | ||
357 | roll $20, %ebx | ||
358 | addl %ecx, %ebx | ||
359 | /* R1 28 */ | ||
360 | leal 2850285829(%eax,%ebp,1),%eax | ||
361 | xorl %ebx, %edi | ||
362 | andl %edx, %edi | ||
363 | movl 8(%esi), %ebp | ||
364 | xorl %ecx, %edi | ||
365 | addl %edi, %eax | ||
366 | movl %ebx, %edi | ||
367 | roll $5, %eax | ||
368 | addl %ebx, %eax | ||
369 | /* R1 29 */ | ||
370 | leal 4243563512(%edx,%ebp,1),%edx | ||
371 | xorl %eax, %edi | ||
372 | andl %ecx, %edi | ||
373 | movl 28(%esi), %ebp | ||
374 | xorl %ebx, %edi | ||
375 | addl %edi, %edx | ||
376 | movl %eax, %edi | ||
377 | roll $9, %edx | ||
378 | addl %eax, %edx | ||
379 | /* R1 30 */ | ||
380 | leal 1735328473(%ecx,%ebp,1),%ecx | ||
381 | xorl %edx, %edi | ||
382 | andl %ebx, %edi | ||
383 | movl 48(%esi), %ebp | ||
384 | xorl %eax, %edi | ||
385 | addl %edi, %ecx | ||
386 | movl %edx, %edi | ||
387 | roll $14, %ecx | ||
388 | addl %edx, %ecx | ||
389 | /* R1 31 */ | ||
390 | leal 2368359562(%ebx,%ebp,1),%ebx | ||
391 | xorl %ecx, %edi | ||
392 | andl %eax, %edi | ||
393 | movl 20(%esi), %ebp | ||
394 | xorl %edx, %edi | ||
395 | addl %edi, %ebx | ||
396 | movl %ecx, %edi | ||
397 | roll $20, %ebx | ||
398 | addl %ecx, %ebx | ||
399 | |||
400 | /* R2 section */ | ||
401 | /* R2 32 */ | ||
402 | xorl %edx, %edi | ||
403 | xorl %ebx, %edi | ||
404 | leal 4294588738(%eax,%ebp,1),%eax | ||
405 | addl %edi, %eax | ||
406 | movl 32(%esi), %ebp | ||
407 | roll $4, %eax | ||
408 | movl %ebx, %edi | ||
409 | /* R2 33 */ | ||
410 | leal 2272392833(%edx,%ebp,1),%edx | ||
411 | addl %ebx, %eax | ||
412 | xorl %ecx, %edi | ||
413 | xorl %eax, %edi | ||
414 | movl 44(%esi), %ebp | ||
415 | addl %edi, %edx | ||
416 | movl %eax, %edi | ||
417 | roll $11, %edx | ||
418 | addl %eax, %edx | ||
419 | /* R2 34 */ | ||
420 | xorl %ebx, %edi | ||
421 | xorl %edx, %edi | ||
422 | leal 1839030562(%ecx,%ebp,1),%ecx | ||
423 | addl %edi, %ecx | ||
424 | movl 56(%esi), %ebp | ||
425 | roll $16, %ecx | ||
426 | movl %edx, %edi | ||
427 | /* R2 35 */ | ||
428 | leal 4259657740(%ebx,%ebp,1),%ebx | ||
429 | addl %edx, %ecx | ||
430 | xorl %eax, %edi | ||
431 | xorl %ecx, %edi | ||
432 | movl 4(%esi), %ebp | ||
433 | addl %edi, %ebx | ||
434 | movl %ecx, %edi | ||
435 | roll $23, %ebx | ||
436 | addl %ecx, %ebx | ||
437 | /* R2 36 */ | ||
438 | xorl %edx, %edi | ||
439 | xorl %ebx, %edi | ||
440 | leal 2763975236(%eax,%ebp,1),%eax | ||
441 | addl %edi, %eax | ||
442 | movl 16(%esi), %ebp | ||
443 | roll $4, %eax | ||
444 | movl %ebx, %edi | ||
445 | /* R2 37 */ | ||
446 | leal 1272893353(%edx,%ebp,1),%edx | ||
447 | addl %ebx, %eax | ||
448 | xorl %ecx, %edi | ||
449 | xorl %eax, %edi | ||
450 | movl 28(%esi), %ebp | ||
451 | addl %edi, %edx | ||
452 | movl %eax, %edi | ||
453 | roll $11, %edx | ||
454 | addl %eax, %edx | ||
455 | /* R2 38 */ | ||
456 | xorl %ebx, %edi | ||
457 | xorl %edx, %edi | ||
458 | leal 4139469664(%ecx,%ebp,1),%ecx | ||
459 | addl %edi, %ecx | ||
460 | movl 40(%esi), %ebp | ||
461 | roll $16, %ecx | ||
462 | movl %edx, %edi | ||
463 | /* R2 39 */ | ||
464 | leal 3200236656(%ebx,%ebp,1),%ebx | ||
465 | addl %edx, %ecx | ||
466 | xorl %eax, %edi | ||
467 | xorl %ecx, %edi | ||
468 | movl 52(%esi), %ebp | ||
469 | addl %edi, %ebx | ||
470 | movl %ecx, %edi | ||
471 | roll $23, %ebx | ||
472 | addl %ecx, %ebx | ||
473 | /* R2 40 */ | ||
474 | xorl %edx, %edi | ||
475 | xorl %ebx, %edi | ||
476 | leal 681279174(%eax,%ebp,1),%eax | ||
477 | addl %edi, %eax | ||
478 | movl (%esi), %ebp | ||
479 | roll $4, %eax | ||
480 | movl %ebx, %edi | ||
481 | /* R2 41 */ | ||
482 | leal 3936430074(%edx,%ebp,1),%edx | ||
483 | addl %ebx, %eax | ||
484 | xorl %ecx, %edi | ||
485 | xorl %eax, %edi | ||
486 | movl 12(%esi), %ebp | ||
487 | addl %edi, %edx | ||
488 | movl %eax, %edi | ||
489 | roll $11, %edx | ||
490 | addl %eax, %edx | ||
491 | /* R2 42 */ | ||
492 | xorl %ebx, %edi | ||
493 | xorl %edx, %edi | ||
494 | leal 3572445317(%ecx,%ebp,1),%ecx | ||
495 | addl %edi, %ecx | ||
496 | movl 24(%esi), %ebp | ||
497 | roll $16, %ecx | ||
498 | movl %edx, %edi | ||
499 | /* R2 43 */ | ||
500 | leal 76029189(%ebx,%ebp,1),%ebx | ||
501 | addl %edx, %ecx | ||
502 | xorl %eax, %edi | ||
503 | xorl %ecx, %edi | ||
504 | movl 36(%esi), %ebp | ||
505 | addl %edi, %ebx | ||
506 | movl %ecx, %edi | ||
507 | roll $23, %ebx | ||
508 | addl %ecx, %ebx | ||
509 | /* R2 44 */ | ||
510 | xorl %edx, %edi | ||
511 | xorl %ebx, %edi | ||
512 | leal 3654602809(%eax,%ebp,1),%eax | ||
513 | addl %edi, %eax | ||
514 | movl 48(%esi), %ebp | ||
515 | roll $4, %eax | ||
516 | movl %ebx, %edi | ||
517 | /* R2 45 */ | ||
518 | leal 3873151461(%edx,%ebp,1),%edx | ||
519 | addl %ebx, %eax | ||
520 | xorl %ecx, %edi | ||
521 | xorl %eax, %edi | ||
522 | movl 60(%esi), %ebp | ||
523 | addl %edi, %edx | ||
524 | movl %eax, %edi | ||
525 | roll $11, %edx | ||
526 | addl %eax, %edx | ||
527 | /* R2 46 */ | ||
528 | xorl %ebx, %edi | ||
529 | xorl %edx, %edi | ||
530 | leal 530742520(%ecx,%ebp,1),%ecx | ||
531 | addl %edi, %ecx | ||
532 | movl 8(%esi), %ebp | ||
533 | roll $16, %ecx | ||
534 | movl %edx, %edi | ||
535 | /* R2 47 */ | ||
536 | leal 3299628645(%ebx,%ebp,1),%ebx | ||
537 | addl %edx, %ecx | ||
538 | xorl %eax, %edi | ||
539 | xorl %ecx, %edi | ||
540 | movl (%esi), %ebp | ||
541 | addl %edi, %ebx | ||
542 | movl $-1, %edi | ||
543 | roll $23, %ebx | ||
544 | addl %ecx, %ebx | ||
545 | |||
546 | /* R3 section */ | ||
547 | /* R3 48 */ | ||
548 | xorl %edx, %edi | ||
549 | orl %ebx, %edi | ||
550 | leal 4096336452(%eax,%ebp,1),%eax | ||
551 | xorl %ecx, %edi | ||
552 | movl 28(%esi), %ebp | ||
553 | addl %edi, %eax | ||
554 | movl $-1, %edi | ||
555 | roll $6, %eax | ||
556 | xorl %ecx, %edi | ||
557 | addl %ebx, %eax | ||
558 | /* R3 49 */ | ||
559 | orl %eax, %edi | ||
560 | leal 1126891415(%edx,%ebp,1),%edx | ||
561 | xorl %ebx, %edi | ||
562 | movl 56(%esi), %ebp | ||
563 | addl %edi, %edx | ||
564 | movl $-1, %edi | ||
565 | roll $10, %edx | ||
566 | xorl %ebx, %edi | ||
567 | addl %eax, %edx | ||
568 | /* R3 50 */ | ||
569 | orl %edx, %edi | ||
570 | leal 2878612391(%ecx,%ebp,1),%ecx | ||
571 | xorl %eax, %edi | ||
572 | movl 20(%esi), %ebp | ||
573 | addl %edi, %ecx | ||
574 | movl $-1, %edi | ||
575 | roll $15, %ecx | ||
576 | xorl %eax, %edi | ||
577 | addl %edx, %ecx | ||
578 | /* R3 51 */ | ||
579 | orl %ecx, %edi | ||
580 | leal 4237533241(%ebx,%ebp,1),%ebx | ||
581 | xorl %edx, %edi | ||
582 | movl 48(%esi), %ebp | ||
583 | addl %edi, %ebx | ||
584 | movl $-1, %edi | ||
585 | roll $21, %ebx | ||
586 | xorl %edx, %edi | ||
587 | addl %ecx, %ebx | ||
588 | /* R3 52 */ | ||
589 | orl %ebx, %edi | ||
590 | leal 1700485571(%eax,%ebp,1),%eax | ||
591 | xorl %ecx, %edi | ||
592 | movl 12(%esi), %ebp | ||
593 | addl %edi, %eax | ||
594 | movl $-1, %edi | ||
595 | roll $6, %eax | ||
596 | xorl %ecx, %edi | ||
597 | addl %ebx, %eax | ||
598 | /* R3 53 */ | ||
599 | orl %eax, %edi | ||
600 | leal 2399980690(%edx,%ebp,1),%edx | ||
601 | xorl %ebx, %edi | ||
602 | movl 40(%esi), %ebp | ||
603 | addl %edi, %edx | ||
604 | movl $-1, %edi | ||
605 | roll $10, %edx | ||
606 | xorl %ebx, %edi | ||
607 | addl %eax, %edx | ||
608 | /* R3 54 */ | ||
609 | orl %edx, %edi | ||
610 | leal 4293915773(%ecx,%ebp,1),%ecx | ||
611 | xorl %eax, %edi | ||
612 | movl 4(%esi), %ebp | ||
613 | addl %edi, %ecx | ||
614 | movl $-1, %edi | ||
615 | roll $15, %ecx | ||
616 | xorl %eax, %edi | ||
617 | addl %edx, %ecx | ||
618 | /* R3 55 */ | ||
619 | orl %ecx, %edi | ||
620 | leal 2240044497(%ebx,%ebp,1),%ebx | ||
621 | xorl %edx, %edi | ||
622 | movl 32(%esi), %ebp | ||
623 | addl %edi, %ebx | ||
624 | movl $-1, %edi | ||
625 | roll $21, %ebx | ||
626 | xorl %edx, %edi | ||
627 | addl %ecx, %ebx | ||
628 | /* R3 56 */ | ||
629 | orl %ebx, %edi | ||
630 | leal 1873313359(%eax,%ebp,1),%eax | ||
631 | xorl %ecx, %edi | ||
632 | movl 60(%esi), %ebp | ||
633 | addl %edi, %eax | ||
634 | movl $-1, %edi | ||
635 | roll $6, %eax | ||
636 | xorl %ecx, %edi | ||
637 | addl %ebx, %eax | ||
638 | /* R3 57 */ | ||
639 | orl %eax, %edi | ||
640 | leal 4264355552(%edx,%ebp,1),%edx | ||
641 | xorl %ebx, %edi | ||
642 | movl 24(%esi), %ebp | ||
643 | addl %edi, %edx | ||
644 | movl $-1, %edi | ||
645 | roll $10, %edx | ||
646 | xorl %ebx, %edi | ||
647 | addl %eax, %edx | ||
648 | /* R3 58 */ | ||
649 | orl %edx, %edi | ||
650 | leal 2734768916(%ecx,%ebp,1),%ecx | ||
651 | xorl %eax, %edi | ||
652 | movl 52(%esi), %ebp | ||
653 | addl %edi, %ecx | ||
654 | movl $-1, %edi | ||
655 | roll $15, %ecx | ||
656 | xorl %eax, %edi | ||
657 | addl %edx, %ecx | ||
658 | /* R3 59 */ | ||
659 | orl %ecx, %edi | ||
660 | leal 1309151649(%ebx,%ebp,1),%ebx | ||
661 | xorl %edx, %edi | ||
662 | movl 16(%esi), %ebp | ||
663 | addl %edi, %ebx | ||
664 | movl $-1, %edi | ||
665 | roll $21, %ebx | ||
666 | xorl %edx, %edi | ||
667 | addl %ecx, %ebx | ||
668 | /* R3 60 */ | ||
669 | orl %ebx, %edi | ||
670 | leal 4149444226(%eax,%ebp,1),%eax | ||
671 | xorl %ecx, %edi | ||
672 | movl 44(%esi), %ebp | ||
673 | addl %edi, %eax | ||
674 | movl $-1, %edi | ||
675 | roll $6, %eax | ||
676 | xorl %ecx, %edi | ||
677 | addl %ebx, %eax | ||
678 | /* R3 61 */ | ||
679 | orl %eax, %edi | ||
680 | leal 3174756917(%edx,%ebp,1),%edx | ||
681 | xorl %ebx, %edi | ||
682 | movl 8(%esi), %ebp | ||
683 | addl %edi, %edx | ||
684 | movl $-1, %edi | ||
685 | roll $10, %edx | ||
686 | xorl %ebx, %edi | ||
687 | addl %eax, %edx | ||
688 | /* R3 62 */ | ||
689 | orl %edx, %edi | ||
690 | leal 718787259(%ecx,%ebp,1),%ecx | ||
691 | xorl %eax, %edi | ||
692 | movl 36(%esi), %ebp | ||
693 | addl %edi, %ecx | ||
694 | movl $-1, %edi | ||
695 | roll $15, %ecx | ||
696 | xorl %eax, %edi | ||
697 | addl %edx, %ecx | ||
698 | /* R3 63 */ | ||
699 | orl %ecx, %edi | ||
700 | leal 3951481745(%ebx,%ebp,1),%ebx | ||
701 | xorl %edx, %edi | ||
702 | movl 24(%esp), %ebp | ||
703 | addl %edi, %ebx | ||
704 | addl $64, %esi | ||
705 | roll $21, %ebx | ||
706 | movl (%ebp), %edi | ||
707 | addl %ecx, %ebx | ||
708 | addl %edi, %eax | ||
709 | movl 4(%ebp), %edi | ||
710 | addl %edi, %ebx | ||
711 | movl 8(%ebp), %edi | ||
712 | addl %edi, %ecx | ||
713 | movl 12(%ebp), %edi | ||
714 | addl %edi, %edx | ||
715 | movl %eax, (%ebp) | ||
716 | movl %ebx, 4(%ebp) | ||
717 | movl (%esp), %edi | ||
718 | movl %ecx, 8(%ebp) | ||
719 | movl %edx, 12(%ebp) | ||
720 | cmpl %esi, %edi | ||
721 | jge .L000start | ||
722 | popl %eax | ||
723 | popl %ebx | ||
724 | popl %ebp | ||
725 | popl %edi | ||
726 | popl %esi | ||
727 | ret | ||
728 | .md5_block_x86_end: | ||
729 | SIZE(md5_block_x86,.md5_block_x86_end-md5_block_x86) | ||
730 | .ident "desasm.pl" | ||
diff --git a/src/lib/libcrypto/mdc2/Makefile.ssl b/src/lib/libcrypto/mdc2/Makefile.ssl new file mode 100644 index 0000000000..495a2789a0 --- /dev/null +++ b/src/lib/libcrypto/mdc2/Makefile.ssl | |||
@@ -0,0 +1,80 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/mdc2/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= mdc2 | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | GENERAL=Makefile | ||
19 | TEST= mdc2test.c | ||
20 | APPS= | ||
21 | |||
22 | LIB=$(TOP)/libcrypto.a | ||
23 | LIBSRC=mdc2dgst.c mdc2_one.c | ||
24 | LIBOBJ=mdc2dgst.o mdc2_one.o | ||
25 | |||
26 | SRC= $(LIBSRC) | ||
27 | |||
28 | EXHEADER= mdc2.h | ||
29 | HEADER= $(EXHEADER) | ||
30 | |||
31 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
32 | |||
33 | top: | ||
34 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
35 | |||
36 | all: lib | ||
37 | |||
38 | lib: $(LIBOBJ) | ||
39 | $(AR) $(LIB) $(LIBOBJ) | ||
40 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
41 | @touch lib | ||
42 | |||
43 | files: | ||
44 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
45 | |||
46 | links: | ||
47 | /bin/rm -f Makefile | ||
48 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
49 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
50 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
51 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
52 | |||
53 | install: | ||
54 | @for i in $(EXHEADER) ; \ | ||
55 | do \ | ||
56 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
57 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
58 | done; | ||
59 | |||
60 | tags: | ||
61 | ctags $(SRC) | ||
62 | |||
63 | tests: | ||
64 | |||
65 | lint: | ||
66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
67 | |||
68 | depend: | ||
69 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
70 | |||
71 | dclean: | ||
72 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
73 | mv -f Makefile.new $(MAKEFILE) | ||
74 | |||
75 | clean: | ||
76 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
77 | |||
78 | errors: | ||
79 | |||
80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
diff --git a/src/lib/libcrypto/objects/Makefile.ssl b/src/lib/libcrypto/objects/Makefile.ssl new file mode 100644 index 0000000000..320523cea1 --- /dev/null +++ b/src/lib/libcrypto/objects/Makefile.ssl | |||
@@ -0,0 +1,87 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/objects/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= objects | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | ERR=objects | ||
19 | ERRC=obj_err | ||
20 | GENERAL=Makefile README | ||
21 | TEST= | ||
22 | APPS= | ||
23 | |||
24 | LIB=$(TOP)/libcrypto.a | ||
25 | LIBSRC= obj_dat.c obj_lib.c $(ERRC).c | ||
26 | LIBOBJ= obj_dat.o obj_lib.o $(ERRC).o | ||
27 | |||
28 | SRC= $(LIBSRC) | ||
29 | |||
30 | EXHEADER= objects.h | ||
31 | HEADER= $(EXHEADER) obj_dat.h | ||
32 | |||
33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
34 | |||
35 | top: | ||
36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
37 | |||
38 | all: obj_dat.h lib | ||
39 | |||
40 | obj_dat.h: objects.h obj_dat.pl | ||
41 | perl ./obj_dat.pl < objects.h > obj_dat.h | ||
42 | |||
43 | lib: $(LIBOBJ) | ||
44 | $(AR) $(LIB) $(LIBOBJ) | ||
45 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
46 | @touch lib | ||
47 | |||
48 | files: | ||
49 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
50 | |||
51 | links: | ||
52 | /bin/rm -f Makefile | ||
53 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
54 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
55 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
56 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
57 | |||
58 | install: | ||
59 | @for i in $(EXHEADER) ; \ | ||
60 | do \ | ||
61 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
62 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
63 | done; | ||
64 | |||
65 | tags: | ||
66 | ctags $(SRC) | ||
67 | |||
68 | tests: | ||
69 | |||
70 | lint: | ||
71 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
72 | |||
73 | depend: | ||
74 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
75 | |||
76 | dclean: | ||
77 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
78 | mv -f Makefile.new $(MAKEFILE) | ||
79 | |||
80 | clean: | ||
81 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
82 | |||
83 | errors: | ||
84 | perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h | ||
85 | perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c | ||
86 | |||
87 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | /* Error codes for the OBJ functions. */ | ||
2 | |||
3 | /* Function codes. */ | ||
4 | #define OBJ_F_OBJ_CREATE 100 | ||
5 | #define OBJ_F_OBJ_DUP 101 | ||
6 | #define OBJ_F_OBJ_NID2LN 102 | ||
7 | #define OBJ_F_OBJ_NID2OBJ 103 | ||
8 | #define OBJ_F_OBJ_NID2SN 104 | ||
9 | |||
10 | /* Reason codes. */ | ||
11 | #define OBJ_R_MALLOC_FAILURE 100 | ||
12 | #define OBJ_R_UNKNOWN_NID 101 | ||
diff --git a/src/lib/libcrypto/pem/Makefile.ssl b/src/lib/libcrypto/pem/Makefile.ssl new file mode 100644 index 0000000000..fc04a88fd9 --- /dev/null +++ b/src/lib/libcrypto/pem/Makefile.ssl | |||
@@ -0,0 +1,96 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/pem/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= pem | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | ERR=pem | ||
19 | ERRC=pem_err | ||
20 | GENERAL=Makefile | ||
21 | TEST= | ||
22 | APPS= | ||
23 | |||
24 | CTX_SIZE= ctx_size | ||
25 | |||
26 | LIB=$(TOP)/libcrypto.a | ||
27 | LIBSRC= pem_sign.c pem_seal.c pem_info.c pem_lib.c pem_all.c $(ERRC).c | ||
28 | |||
29 | LIBOBJ= pem_sign.o pem_seal.o pem_info.o pem_lib.o pem_all.o $(ERRC).o | ||
30 | |||
31 | SRC= $(LIBSRC) | ||
32 | |||
33 | EXHEADER= pem.h | ||
34 | HEADER= $(EXHEADER) | ||
35 | |||
36 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
37 | |||
38 | top: | ||
39 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
40 | |||
41 | all: pem.h lib | ||
42 | |||
43 | pem.h: $(CTX_SIZE) | ||
44 | ./$(CTX_SIZE) <pem.org >pem.new | ||
45 | if [ -f pem.h ]; then mv -f pem.h pem.old; fi | ||
46 | mv -f pem.new pem.h | ||
47 | |||
48 | $(CTX_SIZE): $(CTX_SIZE).o | ||
49 | $(CC) $(CFLAGS) -o $(CTX_SIZE) $(CTX_SIZE).o | ||
50 | |||
51 | lib: $(LIBOBJ) | ||
52 | $(AR) $(LIB) $(LIBOBJ) | ||
53 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
54 | @touch lib | ||
55 | |||
56 | files: | ||
57 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
58 | |||
59 | links: | ||
60 | /bin/rm -f Makefile | ||
61 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
62 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
63 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
64 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
65 | |||
66 | install: | ||
67 | @for i in $(EXHEADER) ; \ | ||
68 | do \ | ||
69 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
70 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
71 | done; | ||
72 | |||
73 | tags: | ||
74 | ctags $(SRC) | ||
75 | |||
76 | tests: | ||
77 | |||
78 | lint: | ||
79 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
80 | |||
81 | depend: | ||
82 | $(MAKEDEPEND) $(INCLUDES) $(CTX_SIZE).c $(LIBSRC) | ||
83 | |||
84 | dclean: | ||
85 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
86 | mv -f Makefile.new $(MAKEFILE) | ||
87 | |||
88 | clean: | ||
89 | /bin/rm -f $(CTX_SIZE) *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
90 | |||
91 | errors: | ||
92 | perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).org # SPECIAL CASE .org | ||
93 | perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h | ||
94 | perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c | ||
95 | |||
96 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | /* crypto/pem/ctx_size.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "evp.h" | ||
62 | |||
63 | int main(argc,argv) | ||
64 | int argc; | ||
65 | char *argv[]; | ||
66 | { | ||
67 | int i,j; | ||
68 | char buf[256]; | ||
69 | |||
70 | for (;;) | ||
71 | { | ||
72 | char *str; | ||
73 | buf[0]='\0'; | ||
74 | fgets(buf,256,stdin); | ||
75 | if (buf[0] == '\0') break; | ||
76 | |||
77 | str="#define EVP_ENCODE_CTX_SIZE "; | ||
78 | if (strncmp(buf,str,strlen(str)) == 0) | ||
79 | { | ||
80 | printf("%s %d\n",str,(int)sizeof(EVP_ENCODE_CTX)); | ||
81 | continue; | ||
82 | } | ||
83 | str="#define EVP_MD_SIZE "; | ||
84 | if (strncmp(buf,str,strlen(str)) == 0) | ||
85 | { | ||
86 | printf("%s %d\n",str,(int)sizeof(EVP_MD)); | ||
87 | continue; | ||
88 | } | ||
89 | str="#define EVP_MD_CTX_SIZE "; | ||
90 | if (strncmp(buf,str,strlen(str)) == 0) | ||
91 | { | ||
92 | printf("%s %d\n",str,(int)sizeof(EVP_MD_CTX)); | ||
93 | continue; | ||
94 | } | ||
95 | str="#define EVP_CIPHER_SIZE "; | ||
96 | if (strncmp(buf,str,strlen(str)) == 0) | ||
97 | { | ||
98 | printf("%s %d\n",str,(int)sizeof(EVP_CIPHER)); | ||
99 | continue; | ||
100 | } | ||
101 | str="#define EVP_CIPHER_CTX_SIZE "; | ||
102 | if (strncmp(buf,str,strlen(str)) == 0) | ||
103 | { | ||
104 | printf("%s %d\n",str,(int)sizeof(EVP_CIPHER_CTX)); | ||
105 | continue; | ||
106 | } | ||
107 | |||
108 | str="#define EVP_MAX_MD_SIZE "; | ||
109 | if (strncmp(buf,str,strlen(str)) == 0) | ||
110 | { | ||
111 | i=MD2_DIGEST_LENGTH; | ||
112 | j=MD5_DIGEST_LENGTH; | ||
113 | if (j > i) i=j; | ||
114 | j=SHA_DIGEST_LENGTH; | ||
115 | if (j > i) i=j; | ||
116 | printf("%s %d\n",str,i); | ||
117 | continue; | ||
118 | } | ||
119 | fputs(buf,stdout); | ||
120 | } | ||
121 | exit(0); | ||
122 | } | ||
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 @@ | |||
1 | /* Error codes for the PEM functions. */ | ||
2 | |||
3 | /* Function codes. */ | ||
4 | #define PEM_F_DEF_CALLBACK 100 | ||
5 | #define PEM_F_LOAD_IV 101 | ||
6 | #define PEM_F_PEM_ASN1_READ 102 | ||
7 | #define PEM_F_PEM_ASN1_READ_BIO 103 | ||
8 | #define PEM_F_PEM_ASN1_WRITE 104 | ||
9 | #define PEM_F_PEM_ASN1_WRITE_BIO 105 | ||
10 | #define PEM_F_PEM_DO_HEADER 106 | ||
11 | #define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 | ||
12 | #define PEM_F_PEM_READ 108 | ||
13 | #define PEM_F_PEM_READ_BIO 109 | ||
14 | #define PEM_F_PEM_SEALFINAL 110 | ||
15 | #define PEM_F_PEM_SEALINIT 111 | ||
16 | #define PEM_F_PEM_SIGNFINAL 112 | ||
17 | #define PEM_F_PEM_WRITE 113 | ||
18 | #define PEM_F_PEM_WRITE_BIO 114 | ||
19 | #define PEM_F_PEM_X509_INFO_READ 115 | ||
20 | #define PEM_F_PEM_X509_INFO_READ_BIO 116 | ||
21 | #define PEM_F_PEM_X509_INFO_WRITE_BIO 117 | ||
22 | |||
23 | /* Reason codes. */ | ||
24 | #define PEM_R_BAD_BASE64_DECODE 100 | ||
25 | #define PEM_R_BAD_DECRYPT 101 | ||
26 | #define PEM_R_BAD_END_LINE 102 | ||
27 | #define PEM_R_BAD_IV_CHARS 103 | ||
28 | #define PEM_R_BAD_PASSWORD_READ 104 | ||
29 | #define PEM_R_NOT_DEK_INFO 105 | ||
30 | #define PEM_R_NOT_ENCRYPTED 106 | ||
31 | #define PEM_R_NOT_PROC_TYPE 107 | ||
32 | #define PEM_R_NO_START_LINE 108 | ||
33 | #define PEM_R_PROBLEMS_GETTING_PASSWORD 109 | ||
34 | #define PEM_R_PUBLIC_KEY_NO_RSA 110 | ||
35 | #define PEM_R_READ_KEY 111 | ||
36 | #define PEM_R_SHORT_HEADER 112 | ||
37 | #define PEM_R_UNSUPPORTED_CIPHER 113 | ||
38 | #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 @@ | |||
1 | /* crypto/pem/pem.org */ | ||
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
60 | * | ||
61 | * Always modify pem.org since pem.h is automatically generated from | ||
62 | * it during SSLeay configuration. | ||
63 | * | ||
64 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
65 | */ | ||
66 | |||
67 | #ifndef HEADER_PEM_H | ||
68 | #define HEADER_PEM_H | ||
69 | |||
70 | #ifdef __cplusplus | ||
71 | extern "C" { | ||
72 | #endif | ||
73 | |||
74 | #include "evp.h" | ||
75 | #include "x509.h" | ||
76 | |||
77 | #define PEM_OBJ_UNDEF 0 | ||
78 | #define PEM_OBJ_X509 1 | ||
79 | #define PEM_OBJ_X509_REQ 2 | ||
80 | #define PEM_OBJ_CRL 3 | ||
81 | #define PEM_OBJ_SSL_SESSION 4 | ||
82 | #define PEM_OBJ_PRIV_KEY 10 | ||
83 | #define PEM_OBJ_PRIV_RSA 11 | ||
84 | #define PEM_OBJ_PRIV_DSA 12 | ||
85 | #define PEM_OBJ_PRIV_DH 13 | ||
86 | #define PEM_OBJ_PUB_RSA 14 | ||
87 | #define PEM_OBJ_PUB_DSA 15 | ||
88 | #define PEM_OBJ_PUB_DH 16 | ||
89 | #define PEM_OBJ_DHPARAMS 17 | ||
90 | #define PEM_OBJ_DSAPARAMS 18 | ||
91 | #define PEM_OBJ_PRIV_RSA_PUBLIC 19 | ||
92 | |||
93 | #define PEM_ERROR 30 | ||
94 | #define PEM_DEK_DES_CBC 40 | ||
95 | #define PEM_DEK_IDEA_CBC 45 | ||
96 | #define PEM_DEK_DES_EDE 50 | ||
97 | #define PEM_DEK_DES_ECB 60 | ||
98 | #define PEM_DEK_RSA 70 | ||
99 | #define PEM_DEK_RSA_MD2 80 | ||
100 | #define PEM_DEK_RSA_MD5 90 | ||
101 | |||
102 | #define PEM_MD_MD2 NID_md2 | ||
103 | #define PEM_MD_MD5 NID_md5 | ||
104 | #define PEM_MD_SHA NID_sha | ||
105 | #define PEM_MD_MD2_RSA NID_md2WithRSAEncryption | ||
106 | #define PEM_MD_MD5_RSA NID_md5WithRSAEncryption | ||
107 | #define PEM_MD_SHA_RSA NID_sha1WithRSAEncryption | ||
108 | |||
109 | #define PEM_STRING_X509_OLD "X509 CERTIFICATE" | ||
110 | #define PEM_STRING_X509 "CERTIFICATE" | ||
111 | #define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" | ||
112 | #define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" | ||
113 | #define PEM_STRING_X509_CRL "X509 CRL" | ||
114 | #define PEM_STRING_EVP_PKEY "PRIVATE KEY" | ||
115 | #define PEM_STRING_RSA "RSA PRIVATE KEY" | ||
116 | #define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" | ||
117 | #define PEM_STRING_DSA "DSA PRIVATE KEY" | ||
118 | #define PEM_STRING_PKCS7 "PKCS7" | ||
119 | #define PEM_STRING_DHPARAMS "DH PARAMETERS" | ||
120 | #define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" | ||
121 | #define PEM_STRING_DSAPARAMS "DSA PARAMETERS" | ||
122 | |||
123 | #ifndef HEADER_ENVELOPE_H | ||
124 | |||
125 | #define EVP_ENCODE_CTX_SIZE 92 | ||
126 | #define EVP_MD_SIZE 48 | ||
127 | #define EVP_MD_CTX_SIZE 152 | ||
128 | #define EVP_CIPHER_SIZE 28 | ||
129 | #define EVP_CIPHER_CTX_SIZE 4212 | ||
130 | #define EVP_MAX_MD_SIZE 20 | ||
131 | |||
132 | typedef struct evp_encode_ctx_st | ||
133 | { | ||
134 | char data[EVP_ENCODE_CTX_SIZE]; | ||
135 | } EVP_ENCODE_CTX; | ||
136 | |||
137 | typedef struct env_md_ctx_st | ||
138 | { | ||
139 | char data[EVP_MD_CTX_SIZE]; | ||
140 | } EVP_MD_CTX; | ||
141 | |||
142 | typedef struct evp_cipher_st | ||
143 | { | ||
144 | char data[EVP_CIPHER_SIZE]; | ||
145 | } EVP_CIPHER; | ||
146 | |||
147 | typedef struct evp_cipher_ctx_st | ||
148 | { | ||
149 | char data[EVP_CIPHER_CTX_SIZE]; | ||
150 | } EVP_CIPHER_CTX; | ||
151 | #endif | ||
152 | |||
153 | |||
154 | typedef struct PEM_Encode_Seal_st | ||
155 | { | ||
156 | EVP_ENCODE_CTX encode; | ||
157 | EVP_MD_CTX md; | ||
158 | EVP_CIPHER_CTX cipher; | ||
159 | } PEM_ENCODE_SEAL_CTX; | ||
160 | |||
161 | /* enc_type is one off */ | ||
162 | #define PEM_TYPE_ENCRYPTED 10 | ||
163 | #define PEM_TYPE_MIC_ONLY 20 | ||
164 | #define PEM_TYPE_MIC_CLEAR 30 | ||
165 | #define PEM_TYPE_CLEAR 40 | ||
166 | |||
167 | typedef struct pem_recip_st | ||
168 | { | ||
169 | char *name; | ||
170 | X509_NAME *dn; | ||
171 | |||
172 | int cipher; | ||
173 | int key_enc; | ||
174 | char iv[8]; | ||
175 | } PEM_USER; | ||
176 | |||
177 | typedef struct pem_ctx_st | ||
178 | { | ||
179 | int type; /* what type of object */ | ||
180 | |||
181 | struct { | ||
182 | int version; | ||
183 | int mode; | ||
184 | } proc_type; | ||
185 | |||
186 | char *domain; | ||
187 | |||
188 | struct { | ||
189 | int cipher; | ||
190 | unsigned char iv[8]; | ||
191 | } DEK_info; | ||
192 | |||
193 | PEM_USER *originator; | ||
194 | |||
195 | int num_recipient; | ||
196 | PEM_USER **recipient; | ||
197 | |||
198 | #ifdef HEADER_STACK_H | ||
199 | STACK *x509_chain; /* certificate chain */ | ||
200 | #else | ||
201 | char *x509_chain; /* certificate chain */ | ||
202 | #endif | ||
203 | EVP_MD *md; /* signature type */ | ||
204 | |||
205 | int md_enc; /* is the md encrypted or not? */ | ||
206 | int md_len; /* length of md_data */ | ||
207 | char *md_data; /* message digest, could be pkey encrypted */ | ||
208 | |||
209 | EVP_CIPHER *dec; /* date encryption cipher */ | ||
210 | int key_len; /* key length */ | ||
211 | unsigned char *key; /* key */ | ||
212 | unsigned char iv[8]; /* the iv */ | ||
213 | |||
214 | |||
215 | int data_enc; /* is the data encrypted */ | ||
216 | int data_len; | ||
217 | unsigned char *data; | ||
218 | } PEM_CTX; | ||
219 | |||
220 | #ifdef SSLEAY_MACROS | ||
221 | |||
222 | #define PEM_write_SSL_SESSION(fp,x) \ | ||
223 | PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \ | ||
224 | PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL) | ||
225 | #define PEM_write_X509(fp,x) \ | ||
226 | PEM_ASN1_write((int (*)())i2d_X509,PEM_STRING_X509,fp, \ | ||
227 | (char *)x, NULL,NULL,0,NULL) | ||
228 | #define PEM_write_X509_REQ(fp,x) PEM_ASN1_write( \ | ||
229 | (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,fp,(char *)x, \ | ||
230 | NULL,NULL,0,NULL) | ||
231 | #define PEM_write_X509_CRL(fp,x) \ | ||
232 | PEM_ASN1_write((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL, \ | ||
233 | fp,(char *)x, NULL,NULL,0,NULL) | ||
234 | #define PEM_write_RSAPrivateKey(fp,x,enc,kstr,klen,cb) \ | ||
235 | PEM_ASN1_write((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,fp,\ | ||
236 | (char *)x,enc,kstr,klen,cb) | ||
237 | #define PEM_write_RSAPublicKey(fp,x) \ | ||
238 | PEM_ASN1_write((int (*)())i2d_RSAPublicKey,\ | ||
239 | PEM_STRING_RSA_PUBLIC,fp,(char *)x,NULL,NULL,0,NULL) | ||
240 | #define PEM_write_DSAPrivateKey(fp,x,enc,kstr,klen,cb) \ | ||
241 | PEM_ASN1_write((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,fp,\ | ||
242 | (char *)x,enc,kstr,klen,cb) | ||
243 | #define PEM_write_PrivateKey(bp,x,enc,kstr,klen,cb) \ | ||
244 | PEM_ASN1_write((int (*)())i2d_PrivateKey,\ | ||
245 | (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\ | ||
246 | bp,(char *)x,enc,kstr,klen,cb) | ||
247 | #define PEM_write_PKCS7(fp,x) \ | ||
248 | PEM_ASN1_write((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,fp, \ | ||
249 | (char *)x, NULL,NULL,0,NULL) | ||
250 | #define PEM_write_DHparams(fp,x) \ | ||
251 | PEM_ASN1_write((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,fp,\ | ||
252 | (char *)x,NULL,NULL,0,NULL) | ||
253 | |||
254 | #define PEM_read_SSL_SESSION(fp,x,cb) (SSL_SESSION *)PEM_ASN1_read( \ | ||
255 | (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb) | ||
256 | #define PEM_read_X509(fp,x,cb) (X509 *)PEM_ASN1_read( \ | ||
257 | (char *(*)())d2i_X509,PEM_STRING_X509,fp,(char **)x,cb) | ||
258 | #define PEM_read_X509_REQ(fp,x,cb) (X509_REQ *)PEM_ASN1_read( \ | ||
259 | (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,fp,(char **)x,cb) | ||
260 | #define PEM_read_X509_CRL(fp,x,cb) (X509_CRL *)PEM_ASN1_read( \ | ||
261 | (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,fp,(char **)x,cb) | ||
262 | #define PEM_read_RSAPrivateKey(fp,x,cb) (RSA *)PEM_ASN1_read( \ | ||
263 | (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,fp,(char **)x,cb) | ||
264 | #define PEM_read_RSAPublicKey(fp,x,cb) (RSA *)PEM_ASN1_read( \ | ||
265 | (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,fp,(char **)x,cb) | ||
266 | #define PEM_read_DSAPrivateKey(fp,x,cb) (DSA *)PEM_ASN1_read( \ | ||
267 | (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,fp,(char **)x,cb) | ||
268 | #define PEM_read_PrivateKey(fp,x,cb) (EVP_PKEY *)PEM_ASN1_read( \ | ||
269 | (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,fp,(char **)x,cb) | ||
270 | #define PEM_read_PKCS7(fp,x,cb) (PKCS7 *)PEM_ASN1_read( \ | ||
271 | (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,fp,(char **)x,cb) | ||
272 | #define PEM_read_DHparams(fp,x,cb) (DH *)PEM_ASN1_read( \ | ||
273 | (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,fp,(char **)x,cb) | ||
274 | |||
275 | #define PEM_write_bio_SSL_SESSION(bp,x) \ | ||
276 | PEM_ASN1_write_bio((int (*)())i2d_SSL_SESSION, \ | ||
277 | PEM_STRING_SSL_SESSION,bp, (char *)x, NULL,NULL,0,NULL) | ||
278 | #define PEM_write_bio_X509(bp,x) \ | ||
279 | PEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \ | ||
280 | (char *)x, NULL,NULL,0,NULL) | ||
281 | #define PEM_write_bio_X509_REQ(bp,x) PEM_ASN1_write_bio( \ | ||
282 | (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,bp,(char *)x, \ | ||
283 | NULL,NULL,0,NULL) | ||
284 | #define PEM_write_bio_X509_CRL(bp,x) \ | ||
285 | PEM_ASN1_write_bio((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL,\ | ||
286 | bp,(char *)x, NULL,NULL,0,NULL) | ||
287 | #define PEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb) \ | ||
288 | PEM_ASN1_write_bio((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,\ | ||
289 | bp,(char *)x,enc,kstr,klen,cb) | ||
290 | #define PEM_write_bio_RSAPublicKey(bp,x) \ | ||
291 | PEM_ASN1_write_bio((int (*)())i2d_RSAPublicKey, \ | ||
292 | PEM_STRING_RSA_PUBLIC,\ | ||
293 | bp,(char *)x,NULL,NULL,0,NULL) | ||
294 | #define PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb) \ | ||
295 | PEM_ASN1_write_bio((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,\ | ||
296 | bp,(char *)x,enc,kstr,klen,cb) | ||
297 | #define PEM_write_bio_PrivateKey(bp,x,enc,kstr,klen,cb) \ | ||
298 | PEM_ASN1_write_bio((int (*)())i2d_PrivateKey,\ | ||
299 | (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\ | ||
300 | bp,(char *)x,enc,kstr,klen,cb) | ||
301 | #define PEM_write_bio_PKCS7(bp,x) \ | ||
302 | PEM_ASN1_write_bio((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,bp, \ | ||
303 | (char *)x, NULL,NULL,0,NULL) | ||
304 | #define PEM_write_bio_DHparams(bp,x) \ | ||
305 | PEM_ASN1_write_bio((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,\ | ||
306 | bp,(char *)x,NULL,NULL,0,NULL) | ||
307 | #define PEM_write_bio_DSAparams(bp,x) \ | ||
308 | PEM_ASN1_write_bio((int (*)())i2d_DSAparams, \ | ||
309 | PEM_STRING_DSAPARAMS,bp,(char *)x,NULL,NULL,0,NULL) | ||
310 | |||
311 | #define PEM_read_bio_SSL_SESSION(bp,x,cb) (SSL_SESSION *)PEM_ASN1_read_bio( \ | ||
312 | (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,(char **)x,cb) | ||
313 | #define PEM_read_bio_X509(bp,x,cb) (X509 *)PEM_ASN1_read_bio( \ | ||
314 | (char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb) | ||
315 | #define PEM_read_bio_X509_REQ(bp,x,cb) (X509_REQ *)PEM_ASN1_read_bio( \ | ||
316 | (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,bp,(char **)x,cb) | ||
317 | #define PEM_read_bio_X509_CRL(bp,x,cb) (X509_CRL *)PEM_ASN1_read_bio( \ | ||
318 | (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,bp,(char **)x,cb) | ||
319 | #define PEM_read_bio_RSAPrivateKey(bp,x,cb) (RSA *)PEM_ASN1_read_bio( \ | ||
320 | (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,bp,(char **)x,cb) | ||
321 | #define PEM_read_bio_RSAPublicKey(bp,x,cb) (RSA *)PEM_ASN1_read_bio( \ | ||
322 | (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,bp,(char **)x,cb) | ||
323 | #define PEM_read_bio_DSAPrivateKey(bp,x,cb) (DSA *)PEM_ASN1_read_bio( \ | ||
324 | (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,bp,(char **)x,cb) | ||
325 | #define PEM_read_bio_PrivateKey(bp,x,cb) (EVP_PKEY *)PEM_ASN1_read_bio( \ | ||
326 | (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,bp,(char **)x,cb) | ||
327 | |||
328 | #define PEM_read_bio_PKCS7(bp,x,cb) (PKCS7 *)PEM_ASN1_read_bio( \ | ||
329 | (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,bp,(char **)x,cb) | ||
330 | #define PEM_read_bio_DHparams(bp,x,cb) (DH *)PEM_ASN1_read_bio( \ | ||
331 | (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,bp,(char **)x,cb) | ||
332 | #define PEM_read_bio_DSAparams(bp,x,cb) (DSA *)PEM_ASN1_read_bio( \ | ||
333 | (char *(*)())d2i_DSAparams,PEM_STRING_DSAPARAMS,bp,(char **)x,cb) | ||
334 | |||
335 | #endif | ||
336 | |||
337 | #ifndef NOPROTO | ||
338 | int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); | ||
339 | int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len, | ||
340 | int (*callback)()); | ||
341 | |||
342 | #ifdef HEADER_BIO_H | ||
343 | int PEM_read_bio(BIO *bp, char **name, char **header, | ||
344 | unsigned char **data,long *len); | ||
345 | int PEM_write_bio(BIO *bp,char *name,char *hdr,unsigned char *data, | ||
346 | long len); | ||
347 | char * PEM_ASN1_read_bio(char *(*d2i)(),char *name,BIO *bp,char **x, | ||
348 | int (*cb)()); | ||
349 | int PEM_ASN1_write_bio(int (*i2d)(),char *name,BIO *bp,char *x, | ||
350 | EVP_CIPHER *enc,unsigned char *kstr,int klen,int (*callback)()); | ||
351 | STACK * PEM_X509_INFO_read_bio(BIO *bp, STACK *sk, int (*cb)()); | ||
352 | int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, | ||
353 | unsigned char *kstr, int klen, int (*cb)()); | ||
354 | #endif | ||
355 | |||
356 | #ifndef WIN16 | ||
357 | int PEM_read(FILE *fp, char **name, char **header, | ||
358 | unsigned char **data,long *len); | ||
359 | int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len); | ||
360 | char * PEM_ASN1_read(char *(*d2i)(),char *name,FILE *fp,char **x, | ||
361 | int (*cb)()); | ||
362 | int PEM_ASN1_write(int (*i2d)(),char *name,FILE *fp,char *x, | ||
363 | EVP_CIPHER *enc,unsigned char *kstr,int klen,int (*callback)()); | ||
364 | STACK * PEM_X509_INFO_read(FILE *fp, STACK *sk, int (*cb)()); | ||
365 | #endif | ||
366 | |||
367 | int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, | ||
368 | EVP_MD *md_type, unsigned char **ek, int *ekl, | ||
369 | unsigned char *iv, EVP_PKEY **pubk, int npubk); | ||
370 | void PEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl, | ||
371 | unsigned char *in, int inl); | ||
372 | int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig,int *sigl, | ||
373 | unsigned char *out, int *outl, EVP_PKEY *priv); | ||
374 | |||
375 | void PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); | ||
376 | void PEM_SignUpdate(EVP_MD_CTX *ctx,unsigned char *d,unsigned int cnt); | ||
377 | int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, | ||
378 | unsigned int *siglen, EVP_PKEY *pkey); | ||
379 | |||
380 | void ERR_load_PEM_strings(void); | ||
381 | |||
382 | void PEM_proc_type(char *buf, int type); | ||
383 | void PEM_dek_info(char *buf, char *type, int len, char *str); | ||
384 | |||
385 | #ifndef SSLEAY_MACROS | ||
386 | |||
387 | #ifndef WIN16 | ||
388 | X509 *PEM_read_X509(FILE *fp,X509 **x,int (*cb)()); | ||
389 | X509_REQ *PEM_read_X509_REQ(FILE *fp,X509_REQ **x,int (*cb)()); | ||
390 | X509_CRL *PEM_read_X509_CRL(FILE *fp,X509_CRL **x,int (*cb)()); | ||
391 | RSA *PEM_read_RSAPrivateKey(FILE *fp,RSA **x,int (*cb)()); | ||
392 | RSA *PEM_read_RSAPublicKey(FILE *fp,RSA **x,int (*cb)()); | ||
393 | DSA *PEM_read_DSAPrivateKey(FILE *fp,DSA **x,int (*cb)()); | ||
394 | EVP_PKEY *PEM_read_PrivateKey(FILE *fp,EVP_PKEY **x,int (*cb)()); | ||
395 | PKCS7 *PEM_read_PKCS7(FILE *fp,PKCS7 **x,int (*cb)()); | ||
396 | DH *PEM_read_DHparams(FILE *fp,DH **x,int (*cb)()); | ||
397 | DSA *PEM_read_DSAparams(FILE *fp,DSA **x,int (*cb)()); | ||
398 | int PEM_write_X509(FILE *fp,X509 *x); | ||
399 | int PEM_write_X509_REQ(FILE *fp,X509_REQ *x); | ||
400 | int PEM_write_X509_CRL(FILE *fp,X509_CRL *x); | ||
401 | int PEM_write_RSAPrivateKey(FILE *fp,RSA *x,EVP_CIPHER *enc,unsigned char *kstr, | ||
402 | int klen,int (*cb)()); | ||
403 | int PEM_write_RSAPublicKey(FILE *fp,RSA *x); | ||
404 | int PEM_write_DSAPrivateKey(FILE *fp,DSA *x,EVP_CIPHER *enc,unsigned char *kstr, | ||
405 | int klen,int (*cb)()); | ||
406 | int PEM_write_PrivateKey(FILE *fp,EVP_PKEY *x,EVP_CIPHER *enc, | ||
407 | unsigned char *kstr,int klen,int (*cb)()); | ||
408 | int PEM_write_PKCS7(FILE *fp,PKCS7 *x); | ||
409 | int PEM_write_DHparams(FILE *fp,DH *x); | ||
410 | int PEM_write_DSAparams(FILE *fp,DSA *x); | ||
411 | #endif | ||
412 | |||
413 | #ifdef HEADER_BIO_H | ||
414 | X509 *PEM_read_bio_X509(BIO *bp,X509 **x,int (*cb)()); | ||
415 | X509_REQ *PEM_read_bio_X509_REQ(BIO *bp,X509_REQ **x,int (*cb)()); | ||
416 | X509_CRL *PEM_read_bio_X509_CRL(BIO *bp,X509_CRL **x,int (*cb)()); | ||
417 | RSA *PEM_read_bio_RSAPrivateKey(BIO *bp,RSA **x,int (*cb)()); | ||
418 | RSA *PEM_read_bio_RSAPublicKey(BIO *bp,RSA **x,int (*cb)()); | ||
419 | DSA *PEM_read_bio_DSAPrivateKey(BIO *bp,DSA **x,int (*cb)()); | ||
420 | EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp,EVP_PKEY **x,int (*cb)()); | ||
421 | PKCS7 *PEM_read_bio_PKCS7(BIO *bp,PKCS7 **x,int (*cb)()); | ||
422 | DH *PEM_read_bio_DHparams(BIO *bp,DH **x,int (*cb)()); | ||
423 | DSA *PEM_read_bio_DSAparams(BIO *bp,DSA **x,int (*cb)()); | ||
424 | int PEM_write_bio_X509(BIO *bp,X509 *x); | ||
425 | int PEM_write_bio_X509_REQ(BIO *bp,X509_REQ *x); | ||
426 | int PEM_write_bio_X509_CRL(BIO *bp,X509_CRL *x); | ||
427 | int PEM_write_bio_RSAPrivateKey(BIO *fp,RSA *x,EVP_CIPHER *enc, | ||
428 | unsigned char *kstr,int klen,int (*cb)()); | ||
429 | int PEM_write_bio_RSAPublicKey(BIO *fp,RSA *x); | ||
430 | int PEM_write_bio_DSAPrivateKey(BIO *fp,DSA *x,EVP_CIPHER *enc, | ||
431 | unsigned char *kstr,int klen,int (*cb)()); | ||
432 | int PEM_write_bio_PrivateKey(BIO *fp,EVP_PKEY *x,EVP_CIPHER *enc, | ||
433 | unsigned char *kstr,int klen,int (*cb)()); | ||
434 | int PEM_write_bio_PKCS7(BIO *bp,PKCS7 *x); | ||
435 | int PEM_write_bio_DHparams(BIO *bp,DH *x); | ||
436 | int PEM_write_bio_DSAparams(BIO *bp,DSA *x); | ||
437 | #endif | ||
438 | |||
439 | #endif /* SSLEAY_MACROS */ | ||
440 | |||
441 | |||
442 | #else | ||
443 | |||
444 | int PEM_get_EVP_CIPHER_INFO(); | ||
445 | int PEM_do_header(); | ||
446 | int PEM_read_bio(); | ||
447 | int PEM_write_bio(); | ||
448 | #ifndef WIN16 | ||
449 | int PEM_read(); | ||
450 | int PEM_write(); | ||
451 | STACK * PEM_X509_INFO_read(); | ||
452 | char * PEM_ASN1_read(); | ||
453 | int PEM_ASN1_write(); | ||
454 | #endif | ||
455 | STACK * PEM_X509_INFO_read_bio(); | ||
456 | int PEM_X509_INFO_write_bio(); | ||
457 | char * PEM_ASN1_read_bio(); | ||
458 | int PEM_ASN1_write_bio(); | ||
459 | int PEM_SealInit(); | ||
460 | void PEM_SealUpdate(); | ||
461 | int PEM_SealFinal(); | ||
462 | int PEM_SignFinal(); | ||
463 | |||
464 | void ERR_load_PEM_strings(); | ||
465 | |||
466 | void PEM_proc_type(); | ||
467 | void PEM_dek_info(); | ||
468 | |||
469 | #ifndef SSLEAY_MACROS | ||
470 | #ifndef WIN16 | ||
471 | X509 *PEM_read_X509(); | ||
472 | X509_REQ *PEM_read_X509_REQ(); | ||
473 | X509_CRL *PEM_read_X509_CRL(); | ||
474 | RSA *PEM_read_RSAPrivateKey(); | ||
475 | RSA *PEM_read_RSAPublicKey(); | ||
476 | DSA *PEM_read_DSAPrivateKey(); | ||
477 | EVP_PKEY *PEM_read_PrivateKey(); | ||
478 | PKCS7 *PEM_read_PKCS7(); | ||
479 | DH *PEM_read_DHparams(); | ||
480 | DSA *PEM_read_DSAparams(); | ||
481 | int PEM_write_X509(); | ||
482 | int PEM_write_X509_REQ(); | ||
483 | int PEM_write_X509_CRL(); | ||
484 | int PEM_write_RSAPrivateKey(); | ||
485 | int PEM_write_RSAPublicKey(); | ||
486 | int PEM_write_DSAPrivateKey(); | ||
487 | int PEM_write_PrivateKey(); | ||
488 | int PEM_write_PKCS7(); | ||
489 | int PEM_write_DHparams(); | ||
490 | int PEM_write_DSAparams(); | ||
491 | #endif | ||
492 | |||
493 | X509 *PEM_read_bio_X509(); | ||
494 | X509_REQ *PEM_read_bio_X509_REQ(); | ||
495 | X509_CRL *PEM_read_bio_X509_CRL(); | ||
496 | RSA *PEM_read_bio_RSAPrivateKey(); | ||
497 | RSA *PEM_read_bio_RSAPublicKey(); | ||
498 | DSA *PEM_read_bio_DSAPrivateKey(); | ||
499 | EVP_PKEY *PEM_read_bio_PrivateKey(); | ||
500 | PKCS7 *PEM_read_bio_PKCS7(); | ||
501 | DH *PEM_read_bio_DHparams(); | ||
502 | DSA *PEM_read_bio_DSAparams(); | ||
503 | int PEM_write_bio_X509(); | ||
504 | int PEM_write_bio_X509_REQ(); | ||
505 | int PEM_write_bio_X509_CRL(); | ||
506 | int PEM_write_bio_RSAPrivateKey(); | ||
507 | int PEM_write_bio_RSAPublicKey(); | ||
508 | int PEM_write_bio_DSAPrivateKey(); | ||
509 | int PEM_write_bio_PrivateKey(); | ||
510 | int PEM_write_bio_PKCS7(); | ||
511 | int PEM_write_bio_DHparams(); | ||
512 | int PEM_write_bio_DSAparams(); | ||
513 | |||
514 | #endif /* SSLEAY_MACROS */ | ||
515 | |||
516 | #endif | ||
517 | |||
518 | /* BEGIN ERROR CODES */ | ||
519 | /* Error codes for the PEM functions. */ | ||
520 | |||
521 | /* Function codes. */ | ||
522 | #define PEM_F_DEF_CALLBACK 100 | ||
523 | #define PEM_F_LOAD_IV 101 | ||
524 | #define PEM_F_PEM_ASN1_READ 102 | ||
525 | #define PEM_F_PEM_ASN1_READ_BIO 103 | ||
526 | #define PEM_F_PEM_ASN1_WRITE 104 | ||
527 | #define PEM_F_PEM_ASN1_WRITE_BIO 105 | ||
528 | #define PEM_F_PEM_DO_HEADER 106 | ||
529 | #define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 | ||
530 | #define PEM_F_PEM_READ 108 | ||
531 | #define PEM_F_PEM_READ_BIO 109 | ||
532 | #define PEM_F_PEM_SEALFINAL 110 | ||
533 | #define PEM_F_PEM_SEALINIT 111 | ||
534 | #define PEM_F_PEM_SIGNFINAL 112 | ||
535 | #define PEM_F_PEM_WRITE 113 | ||
536 | #define PEM_F_PEM_WRITE_BIO 114 | ||
537 | #define PEM_F_PEM_X509_INFO_READ 115 | ||
538 | #define PEM_F_PEM_X509_INFO_READ_BIO 116 | ||
539 | #define PEM_F_PEM_X509_INFO_WRITE_BIO 117 | ||
540 | |||
541 | /* Reason codes. */ | ||
542 | #define PEM_R_BAD_BASE64_DECODE 100 | ||
543 | #define PEM_R_BAD_DECRYPT 101 | ||
544 | #define PEM_R_BAD_END_LINE 102 | ||
545 | #define PEM_R_BAD_IV_CHARS 103 | ||
546 | #define PEM_R_BAD_PASSWORD_READ 104 | ||
547 | #define PEM_R_NOT_DEK_INFO 105 | ||
548 | #define PEM_R_NOT_ENCRYPTED 106 | ||
549 | #define PEM_R_NOT_PROC_TYPE 107 | ||
550 | #define PEM_R_NO_START_LINE 108 | ||
551 | #define PEM_R_PROBLEMS_GETTING_PASSWORD 109 | ||
552 | #define PEM_R_PUBLIC_KEY_NO_RSA 110 | ||
553 | #define PEM_R_READ_KEY 111 | ||
554 | #define PEM_R_SHORT_HEADER 112 | ||
555 | #define PEM_R_UNSUPPORTED_CIPHER 113 | ||
556 | #define PEM_R_UNSUPPORTED_ENCRYPTION 114 | ||
557 | |||
558 | #ifdef __cplusplus | ||
559 | } | ||
560 | #endif | ||
561 | #endif | ||
562 | |||
diff --git a/src/lib/libcrypto/pkcs7/Makefile.ssl b/src/lib/libcrypto/pkcs7/Makefile.ssl new file mode 100644 index 0000000000..a88359b320 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/Makefile.ssl | |||
@@ -0,0 +1,86 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/asn1/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= pkcs7 | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | ERR=pkcs7 | ||
19 | ERRC=pkcs7err | ||
20 | GENERAL=Makefile README | ||
21 | TEST= | ||
22 | APPS= | ||
23 | |||
24 | LIB=$(TOP)/libcrypto.a | ||
25 | LIBSRC= pk7_lib.c pkcs7err.c pk7_doit.c | ||
26 | LIBOBJ= pk7_lib.o pkcs7err.o pk7_doit.o | ||
27 | |||
28 | SRC= $(LIBSRC) | ||
29 | |||
30 | EXHEADER= pkcs7.h | ||
31 | HEADER= $(EXHEADER) | ||
32 | |||
33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
34 | |||
35 | top: | ||
36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
37 | |||
38 | test: | ||
39 | |||
40 | all: lib | ||
41 | |||
42 | lib: $(LIBOBJ) | ||
43 | $(AR) $(LIB) $(LIBOBJ) | ||
44 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
45 | @touch lib | ||
46 | |||
47 | files: | ||
48 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
49 | |||
50 | links: | ||
51 | /bin/rm -f Makefile | ||
52 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
53 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
54 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
55 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
56 | |||
57 | install: | ||
58 | @for i in $(EXHEADER) ; \ | ||
59 | do \ | ||
60 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
61 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
62 | done; | ||
63 | |||
64 | tags: | ||
65 | ctags $(SRC) | ||
66 | |||
67 | tests: | ||
68 | |||
69 | lint: | ||
70 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
71 | |||
72 | depend: | ||
73 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
74 | |||
75 | dclean: | ||
76 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
77 | mv -f Makefile.new $(MAKEFILE) | ||
78 | |||
79 | clean: | ||
80 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
81 | |||
82 | errors: | ||
83 | perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h | ||
84 | perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c | ||
85 | |||
86 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | WARNING | ||
2 | |||
3 | Everything in this directory is experimental and is subject to change. | ||
4 | |||
5 | 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 @@ | |||
1 | -----BEGIN PKCS7----- | ||
2 | MIAGCSqGSIb3DQEHAqCAMIIC2QIBATEMMAoGCCqGSIb3DQIFMIAGCSqGSIb3DQEH | ||
3 | AQAAoIIB7TCCAekwggFSAgEAMA0GCSqGSIb3DQEBBAUAMFsxCzAJBgNVBAYTAkFV | ||
4 | MRMwEQYDVQQIEwpRdWVlbnNsYW5kMRowGAYDVQQKExFDcnlwdFNvZnQgUHR5IEx0 | ||
5 | ZDEbMBkGA1UEAxMSVGVzdCBDQSAoMTAyNCBiaXQpMB4XDTk3MDYwOTEzNTc0NloX | ||
6 | DTk4MDYwOTEzNTc0NlowYzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xh | ||
7 | bmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMSMwIQYDVQQDExpTZXJ2ZXIg | ||
8 | dGVzdCBjZXJ0ICg1MTIgYml0KTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCfs8OE | ||
9 | J5X/EjFSDxXvRhHErYDmNlsP3YDXYY3g/HJFCTT+VWZFQ0xol2r+qKCl3194/+7X | ||
10 | ZLg/BMtv/yr+/rntAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAeEzEdgr2nChPcALL | ||
11 | vY8gl/GIlpoAjPmKD+pLeGZI9s+SEX5u1q8nCrJ6ZzkfrRnqgI5Anmev9+qPZfdU | ||
12 | bz5zdVSf4sUL9nX9ChXjK9NCJA3UzQHSFqhZErGUwGNkAHYHp2+zAdY6Ho6rmMzt | ||
13 | g0CDu/sKR4qzm6REsQGS8kgpjz4xgcUwgcICAQEwYDBbMQswCQYDVQQGEwJBVTET | ||
14 | MBEGA1UECBMKUXVlZW5zbGFuZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQx | ||
15 | GzAZBgNVBAMTElRlc3QgQ0EgKDEwMjQgYml0KQIBADAKBggqhkiG9w0CBTANBgkq | ||
16 | hkiG9w0BAQQFAARALnrxJiOX9XZf2D+3vL8SKMQmMq55LltomwOLGUru/q1uVXzi | ||
17 | ARg7FSCegOpA1nunsTURMUGgrPXKK4XmL4IseQAAAAA= | ||
18 | -----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 @@ | |||
1 | -----BEGIN PKCS7----- | ||
2 | MIAGCSqGSIb3DQEHAqCAMIIFsQIBATELMAkGBSsOAwIaBQAwgAYJKoZIhvcNAQcB | ||
3 | AACgggQdMIICJTCCAc+gAwIBAgIBIjANBgkqhkiG9w0BAQQFADCBgjELMAkGA1UE | ||
4 | BhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5lMRow | ||
5 | GAYDVQQKExFDcnlwdFNvZnQgUHR5IEx0ZDEUMBIGA1UECxMLZGV2ZWxvcG1lbnQx | ||
6 | GTAXBgNVBAMTEENyeXB0U29mdCBEZXYgQ0EwHhcNOTcwNjEzMTgxMDE3WhcNOTgw | ||
7 | NjEzMTgxMDE3WjCBiDELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQx | ||
8 | ETAPBgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdFNvZnQgUHR5IEx0ZDEU | ||
9 | MBIGA1UECxMLSUlTIHRlc3RpbmcxDjAMBgNVBAMTBXRlc3QxMQ8wDQYJKoZIhvcN | ||
10 | AQkBFgAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAxtWiv59VH42+rotrmFAyDxTc | ||
11 | J2osFt5uy/zEllx3vvjtwewqQxGUOwf6cjqFOTrnpEdVvwywpEhIQ5364bJqIwID | ||
12 | AQABoygwJjAkBglghkgBhvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0G | ||
13 | CSqGSIb3DQEBBAUAA0EAMnYkNV2AdpeHPy/qlcdZx6MDGIJgrLhklhcn6Or6KiAP | ||
14 | t9+nv9XdOGHyMyQr9ufsweuQfAgJ9yjKPZR2/adTjTCCAfAwggGaAgEAMA0GCSqG | ||
15 | SIb3DQEBBAUAMIGCMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDER | ||
16 | MA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRQw | ||
17 | EgYDVQQLEwtkZXZlbG9wbWVudDEZMBcGA1UEAxMQQ3J5cHRTb2Z0IERldiBDQTAe | ||
18 | Fw05NzAzMjIxMzM0MDRaFw05ODAzMjIxMzM0MDRaMIGCMQswCQYDVQQGEwJBVTET | ||
19 | MBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoT | ||
20 | EUNyeXB0U29mdCBQdHkgTHRkMRQwEgYDVQQLEwtkZXZlbG9wbWVudDEZMBcGA1UE | ||
21 | AxMQQ3J5cHRTb2Z0IERldiBDQTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDgDgKq | ||
22 | IBuUMAJi4c8juAqEZ8f8FcuDWT+HcScvNztRJy9K8DnbGpiSrzzix4El6N4A7vbl | ||
23 | crwn/0CZmQJguZpfAgMBAAEwDQYJKoZIhvcNAQEEBQADQQA0UUvxlXXe6wKkVukn | ||
24 | ZoCyXbjlNsqt2rwbvfZEam6fQP3S7uq+o1Pnj+KDgE33WxWbQAA9h8fY1LWN7X3a | ||
25 | yTm/MYIBbTCCAWkCAQEwgYgwgYIxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVl | ||
26 | bnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0 | ||
27 | eSBMdGQxFDASBgNVBAsTC2RldmVsb3BtZW50MRkwFwYDVQQDExBDcnlwdFNvZnQg | ||
28 | RGV2IENBAgEiMAkGBSsOAwIaBQCgfTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcB | ||
29 | MCMGCSqGSIb3DQEJBDEWBBSUVhbGkNE+KGqpOK13+FkfOkaoizAcBgkqhkiG9w0B | ||
30 | CQUxDxcNOTcwNzAxMDE0MzM0WjAeBgkqhkiG9w0BCQ8xETAPMA0GCCqGSIb3DQMC | ||
31 | AgEoMA0GCSqGSIb3DQEBAQUABECa9Jpo4w/fZOc3Vy78wZFAVF8kvpn7il99Ldsr | ||
32 | AQ4JiBmcfiSwEBBY6WuKT+/SYtFwZl1oXkTwB5AVCFIC/IFNAAAAAA== | ||
33 | -----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 @@ | |||
1 | /* Error codes for the PKCS7 functions. */ | ||
2 | |||
3 | /* Function codes. */ | ||
4 | #define PKCS7_F_PKCS7_ADD_CERTIFICATE 100 | ||
5 | #define PKCS7_F_PKCS7_ADD_CRL 101 | ||
6 | #define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102 | ||
7 | #define PKCS7_F_PKCS7_ADD_SIGNER 103 | ||
8 | #define PKCS7_F_PKCS7_CTRL 104 | ||
9 | #define PKCS7_F_PKCS7_DATAINIT 105 | ||
10 | #define PKCS7_F_PKCS7_DATASIGN 106 | ||
11 | #define PKCS7_F_PKCS7_DATAVERIFY 107 | ||
12 | #define PKCS7_F_PKCS7_SET_CIPHER 108 | ||
13 | #define PKCS7_F_PKCS7_SET_CONTENT 109 | ||
14 | #define PKCS7_F_PKCS7_SET_TYPE 110 | ||
15 | |||
16 | /* Reason codes. */ | ||
17 | #define PKCS7_R_INTERNAL_ERROR 100 | ||
18 | #define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 101 | ||
19 | #define PKCS7_R_SIGNATURE_FAILURE 102 | ||
20 | #define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 103 | ||
21 | #define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 104 | ||
22 | #define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 105 | ||
23 | #define PKCS7_R_UNKNOWN_DIGEST_TYPE 106 | ||
24 | #define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 107 | ||
25 | #define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 108 | ||
26 | #define PKCS7_R_WRONG_CONTENT_TYPE 109 | ||
diff --git a/src/lib/libcrypto/rand/Makefile.ssl b/src/lib/libcrypto/rand/Makefile.ssl new file mode 100644 index 0000000000..d04f0a9b43 --- /dev/null +++ b/src/lib/libcrypto/rand/Makefile.ssl | |||
@@ -0,0 +1,80 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/rand/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= rand | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | GENERAL=Makefile | ||
19 | TEST= randtest.c | ||
20 | APPS= | ||
21 | |||
22 | LIB=$(TOP)/libcrypto.a | ||
23 | LIBSRC=md_rand.c randfile.c | ||
24 | LIBOBJ=md_rand.o randfile.o | ||
25 | |||
26 | SRC= $(LIBSRC) | ||
27 | |||
28 | EXHEADER= rand.h | ||
29 | HEADER= $(EXHEADER) | ||
30 | |||
31 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
32 | |||
33 | top: | ||
34 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
35 | |||
36 | all: lib | ||
37 | |||
38 | lib: $(LIBOBJ) | ||
39 | $(AR) $(LIB) $(LIBOBJ) | ||
40 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
41 | @touch lib | ||
42 | |||
43 | files: | ||
44 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
45 | |||
46 | links: | ||
47 | /bin/rm -f Makefile | ||
48 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
49 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
50 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
51 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
52 | |||
53 | install: | ||
54 | @for i in $(EXHEADER) ; \ | ||
55 | do \ | ||
56 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
57 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
58 | done; | ||
59 | |||
60 | tags: | ||
61 | ctags $(SRC) | ||
62 | |||
63 | tests: | ||
64 | |||
65 | lint: | ||
66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
67 | |||
68 | depend: | ||
69 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
70 | |||
71 | dclean: | ||
72 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
73 | mv -f Makefile.new $(MAKEFILE) | ||
74 | |||
75 | clean: | ||
76 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
77 | |||
78 | errors: | ||
79 | |||
80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cwd=`pwd` | ||
4 | cd /tmp | ||
5 | |||
6 | if [ -s /bin/ranlib ] ; then | ||
7 | RL=/bin/ranlib | ||
8 | else if [ -s /usr/bin/ranlib ] ; then | ||
9 | RL=/usr/bin/ranlib | ||
10 | fi | ||
11 | fi | ||
12 | |||
13 | if [ "x$RL" != "x" ] | ||
14 | then | ||
15 | case "$1" in | ||
16 | /*) | ||
17 | $RL "$1" | ||
18 | ;; | ||
19 | *) | ||
20 | $RL "$cwd/$1" | ||
21 | ;; | ||
22 | esac | ||
23 | fi | ||
diff --git a/src/lib/libcrypto/rc2/Makefile.ssl b/src/lib/libcrypto/rc2/Makefile.ssl new file mode 100644 index 0000000000..c5138f13e2 --- /dev/null +++ b/src/lib/libcrypto/rc2/Makefile.ssl | |||
@@ -0,0 +1,80 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/rc2/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= rc2 | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | GENERAL=Makefile | ||
19 | TEST=rc2test.c | ||
20 | APPS= | ||
21 | |||
22 | LIB=$(TOP)/libcrypto.a | ||
23 | LIBSRC=rc2_ecb.c rc2_skey.c rc2_cbc.c rc2cfb64.c rc2ofb64.c | ||
24 | LIBOBJ=rc2_ecb.o rc2_skey.o rc2_cbc.o rc2cfb64.o rc2ofb64.o | ||
25 | |||
26 | SRC= $(LIBSRC) | ||
27 | |||
28 | EXHEADER= rc2.h | ||
29 | HEADER= rc2_locl.h $(EXHEADER) | ||
30 | |||
31 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
32 | |||
33 | top: | ||
34 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
35 | |||
36 | all: lib | ||
37 | |||
38 | lib: $(LIBOBJ) | ||
39 | $(AR) $(LIB) $(LIBOBJ) | ||
40 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
41 | @touch lib | ||
42 | |||
43 | files: | ||
44 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
45 | |||
46 | links: | ||
47 | /bin/rm -f Makefile | ||
48 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
49 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
50 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
51 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
52 | |||
53 | install: | ||
54 | @for i in $(EXHEADER) ; \ | ||
55 | do \ | ||
56 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
57 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
58 | done; | ||
59 | |||
60 | tags: | ||
61 | ctags $(SRC) | ||
62 | |||
63 | tests: | ||
64 | |||
65 | lint: | ||
66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
67 | |||
68 | depend: | ||
69 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
70 | |||
71 | dclean: | ||
72 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
73 | mv -f Makefile.new $(MAKEFILE) | ||
74 | |||
75 | clean: | ||
76 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
77 | |||
78 | errors: | ||
79 | |||
80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | # Targets | ||
2 | # make - twidle the options yourself :-) | ||
3 | # make cc - standard cc options | ||
4 | # make gcc - standard gcc options | ||
5 | |||
6 | DIR= rc2 | ||
7 | TOP= . | ||
8 | CC= gcc | ||
9 | CFLAG= -O3 -fomit-frame-pointer | ||
10 | |||
11 | CPP= $(CC) -E | ||
12 | INCLUDES= | ||
13 | INSTALLTOP=/usr/local/lib | ||
14 | MAKE= make | ||
15 | MAKEDEPEND= makedepend | ||
16 | MAKEFILE= Makefile.uni | ||
17 | AR= ar r | ||
18 | |||
19 | IDEA_ENC=rc2_cbc.o | ||
20 | |||
21 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
22 | |||
23 | GENERAL=Makefile | ||
24 | TEST=rc2test | ||
25 | APPS=rc2speed | ||
26 | |||
27 | LIB=librc2.a | ||
28 | LIBSRC=rc2_skey.c rc2_ecb.c rc2_cbc.c rc2cfb64.c rc2ofb64.c | ||
29 | LIBOBJ=rc2_skey.o rc2_ecb.o $(IDEA_ENC) rc2cfb64.o rc2ofb64.o | ||
30 | |||
31 | SRC= $(LIBSRC) | ||
32 | |||
33 | EXHEADER= rc2.h | ||
34 | HEADER= rc2_locl.h $(EXHEADER) | ||
35 | |||
36 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
37 | |||
38 | all: $(LIB) $(TEST) $(APPS) | ||
39 | |||
40 | $(LIB): $(LIBOBJ) | ||
41 | $(AR) $(LIB) $(LIBOBJ) | ||
42 | sh $(TOP)/ranlib.sh $(LIB) | ||
43 | |||
44 | test: $(TEST) | ||
45 | ./$(TEST) | ||
46 | |||
47 | $(TEST): $(TEST).c $(LIB) | ||
48 | $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) | ||
49 | |||
50 | $(APPS): $(APPS).c $(LIB) | ||
51 | $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) | ||
52 | |||
53 | lint: | ||
54 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
55 | |||
56 | depend: | ||
57 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
58 | |||
59 | dclean: | ||
60 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
61 | mv -f Makefile.new $(MAKEFILE) | ||
62 | |||
63 | clean: | ||
64 | /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
65 | |||
66 | cc: | ||
67 | $(MAKE) CC="cc" CFLAG="-O" all | ||
68 | |||
69 | gcc: | ||
70 | $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all | ||
71 | |||
72 | # 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 @@ | |||
1 | /* crypto/rc2/rc2.org */ | ||
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
60 | * | ||
61 | * Always modify rc2.org since rc2.h is automatically generated from | ||
62 | * it during SSLeay configuration. | ||
63 | * | ||
64 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
65 | */ | ||
66 | |||
67 | #ifndef HEADER_RC2_H | ||
68 | #define HEADER_RC2_H | ||
69 | |||
70 | #ifdef __cplusplus | ||
71 | extern "C" { | ||
72 | #endif | ||
73 | |||
74 | #define RC2_ENCRYPT 1 | ||
75 | #define RC2_DECRYPT 0 | ||
76 | |||
77 | /* I need to put in a mod for the alpha - eay */ | ||
78 | #define RC2_INT unsigned short | ||
79 | |||
80 | #define RC2_BLOCK 8 | ||
81 | #define RC2_KEY_LENGTH 16 | ||
82 | |||
83 | typedef struct rc2_key_st | ||
84 | { | ||
85 | RC2_INT data[64]; | ||
86 | } RC2_KEY; | ||
87 | |||
88 | #ifndef NOPROTO | ||
89 | |||
90 | void RC2_set_key(RC2_KEY *key, int len, unsigned char *data,int bits); | ||
91 | void RC2_ecb_encrypt(unsigned char *in,unsigned char *out,RC2_KEY *key, | ||
92 | int enc); | ||
93 | void RC2_encrypt(unsigned long *data,RC2_KEY *key); | ||
94 | void RC2_decrypt(unsigned long *data,RC2_KEY *key); | ||
95 | void RC2_cbc_encrypt(unsigned char *in, unsigned char *out, long length, | ||
96 | RC2_KEY *ks, unsigned char *iv, int enc); | ||
97 | void RC2_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
98 | RC2_KEY *schedule, unsigned char *ivec, int *num, int enc); | ||
99 | void RC2_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
100 | RC2_KEY *schedule, unsigned char *ivec, int *num); | ||
101 | |||
102 | #else | ||
103 | |||
104 | void RC2_set_key(); | ||
105 | void RC2_ecb_encrypt(); | ||
106 | void RC2_encrypt(); | ||
107 | void RC2_decrypt(); | ||
108 | void RC2_cbc_encrypt(); | ||
109 | void RC2_cfb64_encrypt(); | ||
110 | void RC2_ofb64_encrypt(); | ||
111 | |||
112 | #endif | ||
113 | |||
114 | #ifdef __cplusplus | ||
115 | } | ||
116 | #endif | ||
117 | |||
118 | #endif | ||
diff --git a/src/lib/libcrypto/rc4/Makefile.ssl b/src/lib/libcrypto/rc4/Makefile.ssl new file mode 100644 index 0000000000..19c1e980f3 --- /dev/null +++ b/src/lib/libcrypto/rc4/Makefile.ssl | |||
@@ -0,0 +1,108 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/rc4/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= rc4 | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | RC4_ENC=rc4_enc.o | ||
17 | # or use | ||
18 | #RC4_ENC=asm/rx86-elf.o | ||
19 | #RC4_ENC=asm/rx86-out.o | ||
20 | #RC4_ENC=asm/rx86-sol.o | ||
21 | #RC4_ENC=asm/rx86bdsi.o | ||
22 | |||
23 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
24 | |||
25 | GENERAL=Makefile | ||
26 | TEST=rc4test.c | ||
27 | APPS= | ||
28 | |||
29 | LIB=$(TOP)/libcrypto.a | ||
30 | LIBSRC=rc4_skey.c rc4_enc.c | ||
31 | LIBOBJ=rc4_skey.o $(RC4_ENC) | ||
32 | |||
33 | SRC= $(LIBSRC) | ||
34 | |||
35 | EXHEADER= rc4.h | ||
36 | HEADER= $(EXHEADER) rc4_locl.h | ||
37 | |||
38 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
39 | |||
40 | top: | ||
41 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
42 | |||
43 | all: lib | ||
44 | |||
45 | lib: $(LIBOBJ) | ||
46 | $(AR) $(LIB) $(LIBOBJ) | ||
47 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
48 | @touch lib | ||
49 | |||
50 | # elf | ||
51 | asm/rx86-elf.o: asm/rx86unix.cpp | ||
52 | $(CPP) -DELF asm/rx86unix.cpp | as -o asm/rx86-elf.o | ||
53 | |||
54 | # solaris | ||
55 | asm/rx86-sol.o: asm/rx86unix.cpp | ||
56 | $(CC) -E -DSOL asm/rx86unix.cpp | sed 's/^#.*//' > asm/rx86-sol.s | ||
57 | as -o asm/rx86-sol.o asm/rx86-sol.s | ||
58 | rm -f asm/rx86-sol.s | ||
59 | |||
60 | # a.out | ||
61 | asm/rx86-out.o: asm/rx86unix.cpp | ||
62 | $(CPP) -DOUT asm/rx86unix.cpp | as -o asm/rx86-out.o | ||
63 | |||
64 | # bsdi | ||
65 | asm/rx86bsdi.o: asm/rx86unix.cpp | ||
66 | $(CPP) -DBSDI asm/rx86unix.cpp | as -o asm/rx86bsdi.o | ||
67 | |||
68 | asm/rx86unix.cpp: | ||
69 | (cd asm; perl rc4-586.pl cpp >rx86unix.cpp) | ||
70 | |||
71 | files: | ||
72 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
73 | |||
74 | links: | ||
75 | /bin/rm -f Makefile | ||
76 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
77 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
78 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
79 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
80 | |||
81 | install: | ||
82 | @for i in $(EXHEADER) ; \ | ||
83 | do \ | ||
84 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
85 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
86 | done; | ||
87 | |||
88 | tags: | ||
89 | ctags $(SRC) | ||
90 | |||
91 | tests: | ||
92 | |||
93 | lint: | ||
94 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
95 | |||
96 | depend: | ||
97 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
98 | |||
99 | dclean: | ||
100 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
101 | mv -f Makefile.new $(MAKEFILE) | ||
102 | |||
103 | clean: | ||
104 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff asm/*.o | ||
105 | |||
106 | errors: | ||
107 | |||
108 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | # Targets | ||
2 | # make - twidle the options yourself :-) | ||
3 | # make cc - standard cc options | ||
4 | # make gcc - standard gcc options | ||
5 | # make x86-elf - linux-elf etc | ||
6 | # make x86-out - linux-a.out, FreeBSD etc | ||
7 | # make x86-solaris | ||
8 | # make x86-bdsi | ||
9 | |||
10 | DIR= rc4 | ||
11 | TOP= . | ||
12 | CC= gcc | ||
13 | CFLAG= -O3 -fomit-frame-pointer | ||
14 | |||
15 | CPP= $(CC) -E | ||
16 | INCLUDES= | ||
17 | INSTALLTOP=/usr/local/lib | ||
18 | MAKE= make | ||
19 | MAKEDEPEND= makedepend | ||
20 | MAKEFILE= Makefile.uni | ||
21 | AR= ar r | ||
22 | |||
23 | RC4_ENC=rc4_enc.o | ||
24 | # or use | ||
25 | #RC4_ENC=asm/rx86-elf.o | ||
26 | #RC4_ENC=asm/rx86-out.o | ||
27 | #RC4_ENC=asm/rx86-sol.o | ||
28 | #RC4_ENC=asm/rx86bdsi.o | ||
29 | |||
30 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
31 | |||
32 | GENERAL=Makefile | ||
33 | TEST=rc4test | ||
34 | APPS=rc4speed | ||
35 | |||
36 | LIB=librc4.a | ||
37 | LIBSRC=rc4_skey.c rc4_enc.c | ||
38 | LIBOBJ=rc4_skey.o $(RC4_ENC) | ||
39 | |||
40 | SRC= $(LIBSRC) | ||
41 | |||
42 | EXHEADER= rc4.h | ||
43 | HEADER= $(EXHEADER) rc4_locl.h | ||
44 | |||
45 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
46 | |||
47 | all: $(LIB) $(TEST) $(APPS) | ||
48 | |||
49 | $(LIB): $(LIBOBJ) | ||
50 | $(AR) $(LIB) $(LIBOBJ) | ||
51 | sh $(TOP)/ranlib.sh $(LIB) | ||
52 | |||
53 | # elf | ||
54 | asm/rx86-elf.o: asm/rx86unix.cpp | ||
55 | $(CPP) -DELF asm/rx86unix.cpp | as -o asm/rx86-elf.o | ||
56 | |||
57 | # solaris | ||
58 | asm/rx86-sol.o: asm/rx86unix.cpp | ||
59 | $(CC) -E -DSOL asm/rx86unix.cpp | sed 's/^#.*//' > asm/rx86-sol.s | ||
60 | as -o asm/rx86-sol.o asm/rx86-sol.s | ||
61 | rm -f asm/rx86-sol.s | ||
62 | |||
63 | # a.out | ||
64 | asm/rx86-out.o: asm/rx86unix.cpp | ||
65 | $(CPP) -DOUT asm/rx86unix.cpp | as -o asm/rx86-out.o | ||
66 | |||
67 | # bsdi | ||
68 | asm/rx86bsdi.o: asm/rx86unix.cpp | ||
69 | $(CPP) -DBSDI asm/rx86unix.cpp | as -o asm/rx86bsdi.o | ||
70 | |||
71 | asm/rx86unix.cpp: | ||
72 | (cd asm; perl rc4-586.pl cpp >rx86unix.cpp) | ||
73 | |||
74 | test: $(TEST) | ||
75 | ./$(TEST) | ||
76 | |||
77 | $(TEST): $(TEST).c $(LIB) | ||
78 | $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) | ||
79 | |||
80 | $(APPS): $(APPS).c $(LIB) | ||
81 | $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) | ||
82 | |||
83 | lint: | ||
84 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
85 | |||
86 | depend: | ||
87 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
88 | |||
89 | dclean: | ||
90 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
91 | mv -f Makefile.new $(MAKEFILE) | ||
92 | |||
93 | clean: | ||
94 | /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
95 | |||
96 | cc: | ||
97 | $(MAKE) CC="cc" CFLAG="-O" all | ||
98 | |||
99 | gcc: | ||
100 | $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all | ||
101 | |||
102 | # 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 @@ | |||
1 | ; Don't even think of reading this code | ||
2 | ; It was automatically generated by rc4-586.pl | ||
3 | ; Which is a perl program used to generate the x86 assember for | ||
4 | ; any of elf, a.out, BSDI,Win32, or Solaris | ||
5 | ; eric <eay@cryptsoft.com> | ||
6 | ; | ||
7 | TITLE rc4-586.asm | ||
8 | .386 | ||
9 | .model FLAT | ||
10 | _TEXT SEGMENT | ||
11 | PUBLIC _RC4 | ||
12 | |||
13 | _RC4 PROC NEAR | ||
14 | ; | ||
15 | push ebp | ||
16 | push ebx | ||
17 | mov ebp, DWORD PTR 12[esp] | ||
18 | mov ebx, DWORD PTR 16[esp] | ||
19 | push esi | ||
20 | push edi | ||
21 | mov ecx, DWORD PTR [ebp] | ||
22 | mov edx, DWORD PTR 4[ebp] | ||
23 | mov esi, DWORD PTR 28[esp] | ||
24 | inc ecx | ||
25 | sub esp, 12 | ||
26 | add ebp, 8 | ||
27 | and ecx, 255 | ||
28 | lea ebx, DWORD PTR [esi+ebx-8] | ||
29 | mov edi, DWORD PTR 44[esp] | ||
30 | mov DWORD PTR 8[esp],ebx | ||
31 | mov eax, DWORD PTR [ecx*4+ebp] | ||
32 | cmp ebx, esi | ||
33 | jl $L000end | ||
34 | L001start: | ||
35 | add esi, 8 | ||
36 | ; Round 0 | ||
37 | add edx, eax | ||
38 | and edx, 255 | ||
39 | inc ecx | ||
40 | mov ebx, DWORD PTR [edx*4+ebp] | ||
41 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
42 | add ebx, eax | ||
43 | and ecx, 255 | ||
44 | and ebx, 255 | ||
45 | mov DWORD PTR [edx*4+ebp],eax | ||
46 | nop | ||
47 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
48 | mov eax, DWORD PTR [ecx*4+ebp] | ||
49 | mov BYTE PTR [esp], bl | ||
50 | ; Round 1 | ||
51 | add edx, eax | ||
52 | and edx, 255 | ||
53 | inc ecx | ||
54 | mov ebx, DWORD PTR [edx*4+ebp] | ||
55 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
56 | add ebx, eax | ||
57 | and ecx, 255 | ||
58 | and ebx, 255 | ||
59 | mov DWORD PTR [edx*4+ebp],eax | ||
60 | nop | ||
61 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
62 | mov eax, DWORD PTR [ecx*4+ebp] | ||
63 | mov BYTE PTR 1[esp],bl | ||
64 | ; Round 2 | ||
65 | add edx, eax | ||
66 | and edx, 255 | ||
67 | inc ecx | ||
68 | mov ebx, DWORD PTR [edx*4+ebp] | ||
69 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
70 | add ebx, eax | ||
71 | and ecx, 255 | ||
72 | and ebx, 255 | ||
73 | mov DWORD PTR [edx*4+ebp],eax | ||
74 | nop | ||
75 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
76 | mov eax, DWORD PTR [ecx*4+ebp] | ||
77 | mov BYTE PTR 2[esp],bl | ||
78 | ; Round 3 | ||
79 | add edx, eax | ||
80 | and edx, 255 | ||
81 | inc ecx | ||
82 | mov ebx, DWORD PTR [edx*4+ebp] | ||
83 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
84 | add ebx, eax | ||
85 | and ecx, 255 | ||
86 | and ebx, 255 | ||
87 | mov DWORD PTR [edx*4+ebp],eax | ||
88 | nop | ||
89 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
90 | mov eax, DWORD PTR [ecx*4+ebp] | ||
91 | mov BYTE PTR 3[esp],bl | ||
92 | ; Round 4 | ||
93 | add edx, eax | ||
94 | and edx, 255 | ||
95 | inc ecx | ||
96 | mov ebx, DWORD PTR [edx*4+ebp] | ||
97 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
98 | add ebx, eax | ||
99 | and ecx, 255 | ||
100 | and ebx, 255 | ||
101 | mov DWORD PTR [edx*4+ebp],eax | ||
102 | nop | ||
103 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
104 | mov eax, DWORD PTR [ecx*4+ebp] | ||
105 | mov BYTE PTR 4[esp],bl | ||
106 | ; Round 5 | ||
107 | add edx, eax | ||
108 | and edx, 255 | ||
109 | inc ecx | ||
110 | mov ebx, DWORD PTR [edx*4+ebp] | ||
111 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
112 | add ebx, eax | ||
113 | and ecx, 255 | ||
114 | and ebx, 255 | ||
115 | mov DWORD PTR [edx*4+ebp],eax | ||
116 | nop | ||
117 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
118 | mov eax, DWORD PTR [ecx*4+ebp] | ||
119 | mov BYTE PTR 5[esp],bl | ||
120 | ; Round 6 | ||
121 | add edx, eax | ||
122 | and edx, 255 | ||
123 | inc ecx | ||
124 | mov ebx, DWORD PTR [edx*4+ebp] | ||
125 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
126 | add ebx, eax | ||
127 | and ecx, 255 | ||
128 | and ebx, 255 | ||
129 | mov DWORD PTR [edx*4+ebp],eax | ||
130 | nop | ||
131 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
132 | mov eax, DWORD PTR [ecx*4+ebp] | ||
133 | mov BYTE PTR 6[esp],bl | ||
134 | ; Round 7 | ||
135 | add edx, eax | ||
136 | and edx, 255 | ||
137 | inc ecx | ||
138 | mov ebx, DWORD PTR [edx*4+ebp] | ||
139 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
140 | add ebx, eax | ||
141 | and ecx, 255 | ||
142 | and ebx, 255 | ||
143 | mov DWORD PTR [edx*4+ebp],eax | ||
144 | nop | ||
145 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
146 | add edi, 8 | ||
147 | mov BYTE PTR 7[esp],bl | ||
148 | ; apply the cipher text | ||
149 | mov eax, DWORD PTR [esp] | ||
150 | mov ebx, DWORD PTR [esi-8] | ||
151 | xor eax, ebx | ||
152 | mov ebx, DWORD PTR [esi-4] | ||
153 | mov DWORD PTR [edi-8],eax | ||
154 | mov eax, DWORD PTR 4[esp] | ||
155 | xor eax, ebx | ||
156 | mov ebx, DWORD PTR 8[esp] | ||
157 | mov DWORD PTR [edi-4],eax | ||
158 | mov eax, DWORD PTR [ecx*4+ebp] | ||
159 | cmp esi, ebx | ||
160 | jle L001start | ||
161 | $L000end: | ||
162 | ; Round 0 | ||
163 | add ebx, 8 | ||
164 | inc esi | ||
165 | cmp ebx, esi | ||
166 | jl $L002finished | ||
167 | mov DWORD PTR 8[esp],ebx | ||
168 | add edx, eax | ||
169 | and edx, 255 | ||
170 | inc ecx | ||
171 | mov ebx, DWORD PTR [edx*4+ebp] | ||
172 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
173 | add ebx, eax | ||
174 | and ecx, 255 | ||
175 | and ebx, 255 | ||
176 | mov DWORD PTR [edx*4+ebp],eax | ||
177 | nop | ||
178 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
179 | mov eax, DWORD PTR [ecx*4+ebp] | ||
180 | mov bh, BYTE PTR [esi-1] | ||
181 | xor bl, bh | ||
182 | mov BYTE PTR [edi], bl | ||
183 | ; Round 1 | ||
184 | mov ebx, DWORD PTR 8[esp] | ||
185 | cmp ebx, esi | ||
186 | jle $L002finished | ||
187 | inc esi | ||
188 | add edx, eax | ||
189 | and edx, 255 | ||
190 | inc ecx | ||
191 | mov ebx, DWORD PTR [edx*4+ebp] | ||
192 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
193 | add ebx, eax | ||
194 | and ecx, 255 | ||
195 | and ebx, 255 | ||
196 | mov DWORD PTR [edx*4+ebp],eax | ||
197 | nop | ||
198 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
199 | mov eax, DWORD PTR [ecx*4+ebp] | ||
200 | mov bh, BYTE PTR [esi-1] | ||
201 | xor bl, bh | ||
202 | mov BYTE PTR 1[edi],bl | ||
203 | ; Round 2 | ||
204 | mov ebx, DWORD PTR 8[esp] | ||
205 | cmp ebx, esi | ||
206 | jle $L002finished | ||
207 | inc esi | ||
208 | add edx, eax | ||
209 | and edx, 255 | ||
210 | inc ecx | ||
211 | mov ebx, DWORD PTR [edx*4+ebp] | ||
212 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
213 | add ebx, eax | ||
214 | and ecx, 255 | ||
215 | and ebx, 255 | ||
216 | mov DWORD PTR [edx*4+ebp],eax | ||
217 | nop | ||
218 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
219 | mov eax, DWORD PTR [ecx*4+ebp] | ||
220 | mov bh, BYTE PTR [esi-1] | ||
221 | xor bl, bh | ||
222 | mov BYTE PTR 2[edi],bl | ||
223 | ; Round 3 | ||
224 | mov ebx, DWORD PTR 8[esp] | ||
225 | cmp ebx, esi | ||
226 | jle $L002finished | ||
227 | inc esi | ||
228 | add edx, eax | ||
229 | and edx, 255 | ||
230 | inc ecx | ||
231 | mov ebx, DWORD PTR [edx*4+ebp] | ||
232 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
233 | add ebx, eax | ||
234 | and ecx, 255 | ||
235 | and ebx, 255 | ||
236 | mov DWORD PTR [edx*4+ebp],eax | ||
237 | nop | ||
238 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
239 | mov eax, DWORD PTR [ecx*4+ebp] | ||
240 | mov bh, BYTE PTR [esi-1] | ||
241 | xor bl, bh | ||
242 | mov BYTE PTR 3[edi],bl | ||
243 | ; Round 4 | ||
244 | mov ebx, DWORD PTR 8[esp] | ||
245 | cmp ebx, esi | ||
246 | jle $L002finished | ||
247 | inc esi | ||
248 | add edx, eax | ||
249 | and edx, 255 | ||
250 | inc ecx | ||
251 | mov ebx, DWORD PTR [edx*4+ebp] | ||
252 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
253 | add ebx, eax | ||
254 | and ecx, 255 | ||
255 | and ebx, 255 | ||
256 | mov DWORD PTR [edx*4+ebp],eax | ||
257 | nop | ||
258 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
259 | mov eax, DWORD PTR [ecx*4+ebp] | ||
260 | mov bh, BYTE PTR [esi-1] | ||
261 | xor bl, bh | ||
262 | mov BYTE PTR 4[edi],bl | ||
263 | ; Round 5 | ||
264 | mov ebx, DWORD PTR 8[esp] | ||
265 | cmp ebx, esi | ||
266 | jle $L002finished | ||
267 | inc esi | ||
268 | add edx, eax | ||
269 | and edx, 255 | ||
270 | inc ecx | ||
271 | mov ebx, DWORD PTR [edx*4+ebp] | ||
272 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
273 | add ebx, eax | ||
274 | and ecx, 255 | ||
275 | and ebx, 255 | ||
276 | mov DWORD PTR [edx*4+ebp],eax | ||
277 | nop | ||
278 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
279 | mov eax, DWORD PTR [ecx*4+ebp] | ||
280 | mov bh, BYTE PTR [esi-1] | ||
281 | xor bl, bh | ||
282 | mov BYTE PTR 5[edi],bl | ||
283 | ; Round 6 | ||
284 | mov ebx, DWORD PTR 8[esp] | ||
285 | cmp ebx, esi | ||
286 | jle $L002finished | ||
287 | inc esi | ||
288 | add edx, eax | ||
289 | and edx, 255 | ||
290 | inc ecx | ||
291 | mov ebx, DWORD PTR [edx*4+ebp] | ||
292 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
293 | add ebx, eax | ||
294 | and ecx, 255 | ||
295 | and ebx, 255 | ||
296 | mov DWORD PTR [edx*4+ebp],eax | ||
297 | nop | ||
298 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
299 | mov bh, BYTE PTR [esi-1] | ||
300 | xor bl, bh | ||
301 | mov BYTE PTR 6[edi],bl | ||
302 | $L002finished: | ||
303 | dec ecx | ||
304 | add esp, 12 | ||
305 | mov DWORD PTR [ebp-4],edx | ||
306 | mov BYTE PTR [ebp-8],cl | ||
307 | pop edi | ||
308 | pop esi | ||
309 | pop ebx | ||
310 | pop ebp | ||
311 | ret | ||
312 | _RC4 ENDP | ||
313 | _TEXT ENDS | ||
314 | 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 @@ | |||
1 | /* Run the C pre-processor over this file with one of the following defined | ||
2 | * ELF - elf object files, | ||
3 | * OUT - a.out object files, | ||
4 | * BSDI - BSDI style a.out object files | ||
5 | * SOL - Solaris style elf | ||
6 | */ | ||
7 | |||
8 | #define TYPE(a,b) .type a,b | ||
9 | #define SIZE(a,b) .size a,b | ||
10 | |||
11 | #if defined(OUT) || defined(BSDI) | ||
12 | #define RC4 _RC4 | ||
13 | |||
14 | #endif | ||
15 | |||
16 | #ifdef OUT | ||
17 | #define OK 1 | ||
18 | #define ALIGN 4 | ||
19 | #endif | ||
20 | |||
21 | #ifdef BSDI | ||
22 | #define OK 1 | ||
23 | #define ALIGN 4 | ||
24 | #undef SIZE | ||
25 | #undef TYPE | ||
26 | #define SIZE(a,b) | ||
27 | #define TYPE(a,b) | ||
28 | #endif | ||
29 | |||
30 | #if defined(ELF) || defined(SOL) | ||
31 | #define OK 1 | ||
32 | #define ALIGN 16 | ||
33 | #endif | ||
34 | |||
35 | #ifndef OK | ||
36 | You need to define one of | ||
37 | ELF - elf systems - linux-elf, NetBSD and DG-UX | ||
38 | OUT - a.out systems - linux-a.out and FreeBSD | ||
39 | SOL - solaris systems, which are elf with strange comment lines | ||
40 | BSDI - a.out with a very primative version of as. | ||
41 | #endif | ||
42 | |||
43 | /* Let the Assembler begin :-) */ | ||
44 | /* Don't even think of reading this code */ | ||
45 | /* It was automatically generated by rc4-586.pl */ | ||
46 | /* Which is a perl program used to generate the x86 assember for */ | ||
47 | /* any of elf, a.out, BSDI,Win32, or Solaris */ | ||
48 | /* eric <eay@cryptsoft.com> */ | ||
49 | |||
50 | .file "rc4-586.s" | ||
51 | .version "01.01" | ||
52 | gcc2_compiled.: | ||
53 | .text | ||
54 | .align ALIGN | ||
55 | .globl RC4 | ||
56 | TYPE(RC4,@function) | ||
57 | RC4: | ||
58 | |||
59 | pushl %ebp | ||
60 | pushl %ebx | ||
61 | movl 12(%esp), %ebp | ||
62 | movl 16(%esp), %ebx | ||
63 | pushl %esi | ||
64 | pushl %edi | ||
65 | movl (%ebp), %ecx | ||
66 | movl 4(%ebp), %edx | ||
67 | movl 28(%esp), %esi | ||
68 | incl %ecx | ||
69 | subl $12, %esp | ||
70 | addl $8, %ebp | ||
71 | andl $255, %ecx | ||
72 | leal -8(%ebx,%esi,), %ebx | ||
73 | movl 44(%esp), %edi | ||
74 | movl %ebx, 8(%esp) | ||
75 | movl (%ebp,%ecx,4), %eax | ||
76 | cmpl %esi, %ebx | ||
77 | jl .L000end | ||
78 | .L001start: | ||
79 | addl $8, %esi | ||
80 | /* Round 0 */ | ||
81 | addl %eax, %edx | ||
82 | andl $255, %edx | ||
83 | incl %ecx | ||
84 | movl (%ebp,%edx,4), %ebx | ||
85 | movl %ebx, -4(%ebp,%ecx,4) | ||
86 | addl %eax, %ebx | ||
87 | andl $255, %ecx | ||
88 | andl $255, %ebx | ||
89 | movl %eax, (%ebp,%edx,4) | ||
90 | nop | ||
91 | movl (%ebp,%ebx,4), %ebx | ||
92 | movl (%ebp,%ecx,4), %eax | ||
93 | movb %bl, (%esp) | ||
94 | /* Round 1 */ | ||
95 | addl %eax, %edx | ||
96 | andl $255, %edx | ||
97 | incl %ecx | ||
98 | movl (%ebp,%edx,4), %ebx | ||
99 | movl %ebx, -4(%ebp,%ecx,4) | ||
100 | addl %eax, %ebx | ||
101 | andl $255, %ecx | ||
102 | andl $255, %ebx | ||
103 | movl %eax, (%ebp,%edx,4) | ||
104 | nop | ||
105 | movl (%ebp,%ebx,4), %ebx | ||
106 | movl (%ebp,%ecx,4), %eax | ||
107 | movb %bl, 1(%esp) | ||
108 | /* Round 2 */ | ||
109 | addl %eax, %edx | ||
110 | andl $255, %edx | ||
111 | incl %ecx | ||
112 | movl (%ebp,%edx,4), %ebx | ||
113 | movl %ebx, -4(%ebp,%ecx,4) | ||
114 | addl %eax, %ebx | ||
115 | andl $255, %ecx | ||
116 | andl $255, %ebx | ||
117 | movl %eax, (%ebp,%edx,4) | ||
118 | nop | ||
119 | movl (%ebp,%ebx,4), %ebx | ||
120 | movl (%ebp,%ecx,4), %eax | ||
121 | movb %bl, 2(%esp) | ||
122 | /* Round 3 */ | ||
123 | addl %eax, %edx | ||
124 | andl $255, %edx | ||
125 | incl %ecx | ||
126 | movl (%ebp,%edx,4), %ebx | ||
127 | movl %ebx, -4(%ebp,%ecx,4) | ||
128 | addl %eax, %ebx | ||
129 | andl $255, %ecx | ||
130 | andl $255, %ebx | ||
131 | movl %eax, (%ebp,%edx,4) | ||
132 | nop | ||
133 | movl (%ebp,%ebx,4), %ebx | ||
134 | movl (%ebp,%ecx,4), %eax | ||
135 | movb %bl, 3(%esp) | ||
136 | /* Round 4 */ | ||
137 | addl %eax, %edx | ||
138 | andl $255, %edx | ||
139 | incl %ecx | ||
140 | movl (%ebp,%edx,4), %ebx | ||
141 | movl %ebx, -4(%ebp,%ecx,4) | ||
142 | addl %eax, %ebx | ||
143 | andl $255, %ecx | ||
144 | andl $255, %ebx | ||
145 | movl %eax, (%ebp,%edx,4) | ||
146 | nop | ||
147 | movl (%ebp,%ebx,4), %ebx | ||
148 | movl (%ebp,%ecx,4), %eax | ||
149 | movb %bl, 4(%esp) | ||
150 | /* Round 5 */ | ||
151 | addl %eax, %edx | ||
152 | andl $255, %edx | ||
153 | incl %ecx | ||
154 | movl (%ebp,%edx,4), %ebx | ||
155 | movl %ebx, -4(%ebp,%ecx,4) | ||
156 | addl %eax, %ebx | ||
157 | andl $255, %ecx | ||
158 | andl $255, %ebx | ||
159 | movl %eax, (%ebp,%edx,4) | ||
160 | nop | ||
161 | movl (%ebp,%ebx,4), %ebx | ||
162 | movl (%ebp,%ecx,4), %eax | ||
163 | movb %bl, 5(%esp) | ||
164 | /* Round 6 */ | ||
165 | addl %eax, %edx | ||
166 | andl $255, %edx | ||
167 | incl %ecx | ||
168 | movl (%ebp,%edx,4), %ebx | ||
169 | movl %ebx, -4(%ebp,%ecx,4) | ||
170 | addl %eax, %ebx | ||
171 | andl $255, %ecx | ||
172 | andl $255, %ebx | ||
173 | movl %eax, (%ebp,%edx,4) | ||
174 | nop | ||
175 | movl (%ebp,%ebx,4), %ebx | ||
176 | movl (%ebp,%ecx,4), %eax | ||
177 | movb %bl, 6(%esp) | ||
178 | /* Round 7 */ | ||
179 | addl %eax, %edx | ||
180 | andl $255, %edx | ||
181 | incl %ecx | ||
182 | movl (%ebp,%edx,4), %ebx | ||
183 | movl %ebx, -4(%ebp,%ecx,4) | ||
184 | addl %eax, %ebx | ||
185 | andl $255, %ecx | ||
186 | andl $255, %ebx | ||
187 | movl %eax, (%ebp,%edx,4) | ||
188 | nop | ||
189 | movl (%ebp,%ebx,4), %ebx | ||
190 | addl $8, %edi | ||
191 | movb %bl, 7(%esp) | ||
192 | /* apply the cipher text */ | ||
193 | movl (%esp), %eax | ||
194 | movl -8(%esi), %ebx | ||
195 | xorl %ebx, %eax | ||
196 | movl -4(%esi), %ebx | ||
197 | movl %eax, -8(%edi) | ||
198 | movl 4(%esp), %eax | ||
199 | xorl %ebx, %eax | ||
200 | movl 8(%esp), %ebx | ||
201 | movl %eax, -4(%edi) | ||
202 | movl (%ebp,%ecx,4), %eax | ||
203 | cmpl %ebx, %esi | ||
204 | jle .L001start | ||
205 | .L000end: | ||
206 | /* Round 0 */ | ||
207 | addl $8, %ebx | ||
208 | incl %esi | ||
209 | cmpl %esi, %ebx | ||
210 | jl .L002finished | ||
211 | movl %ebx, 8(%esp) | ||
212 | addl %eax, %edx | ||
213 | andl $255, %edx | ||
214 | incl %ecx | ||
215 | movl (%ebp,%edx,4), %ebx | ||
216 | movl %ebx, -4(%ebp,%ecx,4) | ||
217 | addl %eax, %ebx | ||
218 | andl $255, %ecx | ||
219 | andl $255, %ebx | ||
220 | movl %eax, (%ebp,%edx,4) | ||
221 | nop | ||
222 | movl (%ebp,%ebx,4), %ebx | ||
223 | movl (%ebp,%ecx,4), %eax | ||
224 | movb -1(%esi), %bh | ||
225 | xorb %bh, %bl | ||
226 | movb %bl, (%edi) | ||
227 | /* Round 1 */ | ||
228 | movl 8(%esp), %ebx | ||
229 | cmpl %esi, %ebx | ||
230 | jle .L002finished | ||
231 | incl %esi | ||
232 | addl %eax, %edx | ||
233 | andl $255, %edx | ||
234 | incl %ecx | ||
235 | movl (%ebp,%edx,4), %ebx | ||
236 | movl %ebx, -4(%ebp,%ecx,4) | ||
237 | addl %eax, %ebx | ||
238 | andl $255, %ecx | ||
239 | andl $255, %ebx | ||
240 | movl %eax, (%ebp,%edx,4) | ||
241 | nop | ||
242 | movl (%ebp,%ebx,4), %ebx | ||
243 | movl (%ebp,%ecx,4), %eax | ||
244 | movb -1(%esi), %bh | ||
245 | xorb %bh, %bl | ||
246 | movb %bl, 1(%edi) | ||
247 | /* Round 2 */ | ||
248 | movl 8(%esp), %ebx | ||
249 | cmpl %esi, %ebx | ||
250 | jle .L002finished | ||
251 | incl %esi | ||
252 | addl %eax, %edx | ||
253 | andl $255, %edx | ||
254 | incl %ecx | ||
255 | movl (%ebp,%edx,4), %ebx | ||
256 | movl %ebx, -4(%ebp,%ecx,4) | ||
257 | addl %eax, %ebx | ||
258 | andl $255, %ecx | ||
259 | andl $255, %ebx | ||
260 | movl %eax, (%ebp,%edx,4) | ||
261 | nop | ||
262 | movl (%ebp,%ebx,4), %ebx | ||
263 | movl (%ebp,%ecx,4), %eax | ||
264 | movb -1(%esi), %bh | ||
265 | xorb %bh, %bl | ||
266 | movb %bl, 2(%edi) | ||
267 | /* Round 3 */ | ||
268 | movl 8(%esp), %ebx | ||
269 | cmpl %esi, %ebx | ||
270 | jle .L002finished | ||
271 | incl %esi | ||
272 | addl %eax, %edx | ||
273 | andl $255, %edx | ||
274 | incl %ecx | ||
275 | movl (%ebp,%edx,4), %ebx | ||
276 | movl %ebx, -4(%ebp,%ecx,4) | ||
277 | addl %eax, %ebx | ||
278 | andl $255, %ecx | ||
279 | andl $255, %ebx | ||
280 | movl %eax, (%ebp,%edx,4) | ||
281 | nop | ||
282 | movl (%ebp,%ebx,4), %ebx | ||
283 | movl (%ebp,%ecx,4), %eax | ||
284 | movb -1(%esi), %bh | ||
285 | xorb %bh, %bl | ||
286 | movb %bl, 3(%edi) | ||
287 | /* Round 4 */ | ||
288 | movl 8(%esp), %ebx | ||
289 | cmpl %esi, %ebx | ||
290 | jle .L002finished | ||
291 | incl %esi | ||
292 | addl %eax, %edx | ||
293 | andl $255, %edx | ||
294 | incl %ecx | ||
295 | movl (%ebp,%edx,4), %ebx | ||
296 | movl %ebx, -4(%ebp,%ecx,4) | ||
297 | addl %eax, %ebx | ||
298 | andl $255, %ecx | ||
299 | andl $255, %ebx | ||
300 | movl %eax, (%ebp,%edx,4) | ||
301 | nop | ||
302 | movl (%ebp,%ebx,4), %ebx | ||
303 | movl (%ebp,%ecx,4), %eax | ||
304 | movb -1(%esi), %bh | ||
305 | xorb %bh, %bl | ||
306 | movb %bl, 4(%edi) | ||
307 | /* Round 5 */ | ||
308 | movl 8(%esp), %ebx | ||
309 | cmpl %esi, %ebx | ||
310 | jle .L002finished | ||
311 | incl %esi | ||
312 | addl %eax, %edx | ||
313 | andl $255, %edx | ||
314 | incl %ecx | ||
315 | movl (%ebp,%edx,4), %ebx | ||
316 | movl %ebx, -4(%ebp,%ecx,4) | ||
317 | addl %eax, %ebx | ||
318 | andl $255, %ecx | ||
319 | andl $255, %ebx | ||
320 | movl %eax, (%ebp,%edx,4) | ||
321 | nop | ||
322 | movl (%ebp,%ebx,4), %ebx | ||
323 | movl (%ebp,%ecx,4), %eax | ||
324 | movb -1(%esi), %bh | ||
325 | xorb %bh, %bl | ||
326 | movb %bl, 5(%edi) | ||
327 | /* Round 6 */ | ||
328 | movl 8(%esp), %ebx | ||
329 | cmpl %esi, %ebx | ||
330 | jle .L002finished | ||
331 | incl %esi | ||
332 | addl %eax, %edx | ||
333 | andl $255, %edx | ||
334 | incl %ecx | ||
335 | movl (%ebp,%edx,4), %ebx | ||
336 | movl %ebx, -4(%ebp,%ecx,4) | ||
337 | addl %eax, %ebx | ||
338 | andl $255, %ecx | ||
339 | andl $255, %ebx | ||
340 | movl %eax, (%ebp,%edx,4) | ||
341 | nop | ||
342 | movl (%ebp,%ebx,4), %ebx | ||
343 | movb -1(%esi), %bh | ||
344 | xorb %bh, %bl | ||
345 | movb %bl, 6(%edi) | ||
346 | .L002finished: | ||
347 | decl %ecx | ||
348 | addl $12, %esp | ||
349 | movl %edx, -4(%ebp) | ||
350 | movb %cl, -8(%ebp) | ||
351 | popl %edi | ||
352 | popl %esi | ||
353 | popl %ebx | ||
354 | popl %ebp | ||
355 | ret | ||
356 | .RC4_end: | ||
357 | SIZE(RC4,.RC4_end-RC4) | ||
358 | .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 @@ | |||
1 | /* crypto/rc4/rc4.org */ | ||
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
60 | * | ||
61 | * Always modify rc4.org since rc4.h is automatically generated from | ||
62 | * it during SSLeay configuration. | ||
63 | * | ||
64 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
65 | */ | ||
66 | |||
67 | #ifndef HEADER_RC4_H | ||
68 | #define HEADER_RC4_H | ||
69 | |||
70 | #ifdef __cplusplus | ||
71 | extern "C" { | ||
72 | #endif | ||
73 | |||
74 | /* using int types make the structure larger but make the code faster | ||
75 | * on most boxes I have tested - up to %20 faster. */ | ||
76 | #define RC4_INT unsigned int | ||
77 | |||
78 | typedef struct rc4_key_st | ||
79 | { | ||
80 | RC4_INT x,y; | ||
81 | RC4_INT data[256]; | ||
82 | } RC4_KEY; | ||
83 | |||
84 | #ifndef NOPROTO | ||
85 | |||
86 | char *RC4_options(void); | ||
87 | void RC4_set_key(RC4_KEY *key, int len, unsigned char *data); | ||
88 | void RC4(RC4_KEY *key, unsigned long len, unsigned char *indata, | ||
89 | unsigned char *outdata); | ||
90 | |||
91 | #else | ||
92 | |||
93 | char *RC4_options(); | ||
94 | void RC4_set_key(); | ||
95 | void RC4(); | ||
96 | |||
97 | #endif | ||
98 | |||
99 | #ifdef __cplusplus | ||
100 | } | ||
101 | #endif | ||
102 | |||
103 | #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 @@ | |||
1 | /* crypto/rc4/rc4_locl.org */ | ||
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
60 | * | ||
61 | * Always modify bf_locl.org since bf_locl.h is automatically generated from | ||
62 | * it during SSLeay configuration. | ||
63 | * | ||
64 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
65 | */ | ||
66 | |||
67 | /* if this is defined data[i] is used instead of *data, this is a %20 | ||
68 | * speedup on x86 */ | ||
69 | #undef RC4_INDEX | ||
70 | |||
diff --git a/src/lib/libcrypto/rc5/Makefile.ssl b/src/lib/libcrypto/rc5/Makefile.ssl new file mode 100644 index 0000000000..5e98ee2348 --- /dev/null +++ b/src/lib/libcrypto/rc5/Makefile.ssl | |||
@@ -0,0 +1,107 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/rc5/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= rc5 | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | CPP= $(CC) -E | ||
9 | INCLUDES= | ||
10 | CFLAG=-g | ||
11 | INSTALLTOP=/usr/local/ssl | ||
12 | MAKE= make -f Makefile.ssl | ||
13 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
14 | MAKEFILE= Makefile.ssl | ||
15 | AR= ar r | ||
16 | |||
17 | RC5_ENC= rc5_enc.o | ||
18 | # or use | ||
19 | #DES_ENC= r586-elf.o | ||
20 | |||
21 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
22 | |||
23 | GENERAL=Makefile | ||
24 | TEST=rc5test.c | ||
25 | APPS= | ||
26 | |||
27 | LIB=$(TOP)/libcrypto.a | ||
28 | LIBSRC=rc5_skey.c rc5_ecb.c rc5_enc.c rc5cfb64.c rc5ofb64.c | ||
29 | LIBOBJ=rc5_skey.o rc5_ecb.o $(RC5_ENC) rc5cfb64.o rc5ofb64.o | ||
30 | |||
31 | SRC= $(LIBSRC) | ||
32 | |||
33 | EXHEADER= rc5.h | ||
34 | HEADER= rc5_locl.h $(EXHEADER) | ||
35 | |||
36 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
37 | |||
38 | top: | ||
39 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
40 | |||
41 | all: lib | ||
42 | |||
43 | lib: $(LIBOBJ) | ||
44 | $(AR) $(LIB) $(LIBOBJ) | ||
45 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
46 | @touch lib | ||
47 | |||
48 | # elf | ||
49 | asm/r586-elf.o: asm/r586unix.cpp | ||
50 | $(CPP) -DELF asm/r586unix.cpp | as -o asm/r586-elf.o | ||
51 | |||
52 | # solaris | ||
53 | asm/r586-sol.o: asm/r586unix.cpp | ||
54 | $(CC) -E -DSOL asm/r586unix.cpp | sed 's/^#.*//' > asm/r586-sol.s | ||
55 | as -o asm/r586-sol.o asm/r586-sol.s | ||
56 | rm -f asm/r586-sol.s | ||
57 | |||
58 | # a.out | ||
59 | asm/r586-out.o: asm/r586unix.cpp | ||
60 | $(CPP) -DOUT asm/r586unix.cpp | as -o asm/r586-out.o | ||
61 | |||
62 | # bsdi | ||
63 | asm/r586bsdi.o: asm/r586unix.cpp | ||
64 | $(CPP) -DBSDI asm/r586unix.cpp | as -o asm/r586bsdi.o | ||
65 | |||
66 | asm/r586unix.cpp: | ||
67 | (cd asm; perl rc5-586.pl cpp >r586unix.cpp) | ||
68 | |||
69 | files: | ||
70 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
71 | |||
72 | links: | ||
73 | /bin/rm -f Makefile | ||
74 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
75 | $(TOP)/util/point.sh ../../doc/rc5.doc rc5.doc ; | ||
76 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
77 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
78 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
79 | |||
80 | install: | ||
81 | @for i in $(EXHEADER) ; \ | ||
82 | do \ | ||
83 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
84 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
85 | done; | ||
86 | |||
87 | tags: | ||
88 | ctags $(SRC) | ||
89 | |||
90 | tests: | ||
91 | |||
92 | lint: | ||
93 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
94 | |||
95 | depend: | ||
96 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
97 | |||
98 | dclean: | ||
99 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
100 | mv -f Makefile.new $(MAKEFILE) | ||
101 | |||
102 | clean: | ||
103 | /bin/rm -f *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
104 | |||
105 | errors: | ||
106 | |||
107 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | # Targets | ||
2 | # make - twidle the options yourself :-) | ||
3 | # make cc - standard cc options | ||
4 | # make gcc - standard gcc options | ||
5 | |||
6 | DIR= rc2 | ||
7 | TOP= . | ||
8 | CC= gcc | ||
9 | CFLAG= -O3 -fomit-frame-pointer | ||
10 | |||
11 | CPP= $(CC) -E | ||
12 | INCLUDES= | ||
13 | INSTALLTOP=/usr/local/lib | ||
14 | MAKE= make | ||
15 | MAKEDEPEND= makedepend | ||
16 | MAKEFILE= Makefile.uni | ||
17 | AR= ar r | ||
18 | |||
19 | IDEA_ENC=rc2_cbc.o | ||
20 | |||
21 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
22 | |||
23 | GENERAL=Makefile | ||
24 | TEST=rc2test | ||
25 | APPS=rc2speed | ||
26 | |||
27 | LIB=librc2.a | ||
28 | LIBSRC=rc2_skey.c rc2_ecb.c rc2_cbc.c rc2cfb64.c rc2ofb64.c | ||
29 | LIBOBJ=rc2_skey.o rc2_ecb.o $(IDEA_ENC) rc2cfb64.o rc2ofb64.o | ||
30 | |||
31 | SRC= $(LIBSRC) | ||
32 | |||
33 | EXHEADER= rc2.h | ||
34 | HEADER= rc2_locl.h $(EXHEADER) | ||
35 | |||
36 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
37 | |||
38 | all: $(LIB) $(TEST) $(APPS) | ||
39 | |||
40 | $(LIB): $(LIBOBJ) | ||
41 | $(AR) $(LIB) $(LIBOBJ) | ||
42 | sh $(TOP)/ranlib.sh $(LIB) | ||
43 | |||
44 | test: $(TEST) | ||
45 | ./$(TEST) | ||
46 | |||
47 | $(TEST): $(TEST).c $(LIB) | ||
48 | $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) | ||
49 | |||
50 | $(APPS): $(APPS).c $(LIB) | ||
51 | $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) | ||
52 | |||
53 | lint: | ||
54 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
55 | |||
56 | depend: | ||
57 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
58 | |||
59 | dclean: | ||
60 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
61 | mv -f Makefile.new $(MAKEFILE) | ||
62 | |||
63 | clean: | ||
64 | /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
65 | |||
66 | cc: | ||
67 | $(MAKE) CC="cc" CFLAG="-O" all | ||
68 | |||
69 | gcc: | ||
70 | $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all | ||
71 | |||
72 | # 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 @@ | |||
1 | ; Don't even think of reading this code | ||
2 | ; It was automatically generated by rc5-586.pl | ||
3 | ; Which is a perl program used to generate the x86 assember for | ||
4 | ; any of elf, a.out, BSDI,Win32, or Solaris | ||
5 | ; eric <eay@cryptsoft.com> | ||
6 | ; | ||
7 | TITLE rc5-586.asm | ||
8 | .386 | ||
9 | .model FLAT | ||
10 | _TEXT SEGMENT | ||
11 | PUBLIC _RC5_32_encrypt | ||
12 | |||
13 | _RC5_32_encrypt PROC NEAR | ||
14 | ; | ||
15 | push ebp | ||
16 | push esi | ||
17 | push edi | ||
18 | mov edx, DWORD PTR 16[esp] | ||
19 | mov ebp, DWORD PTR 20[esp] | ||
20 | ; Load the 2 words | ||
21 | mov edi, DWORD PTR [edx] | ||
22 | mov esi, DWORD PTR 4[edx] | ||
23 | push ebx | ||
24 | mov ebx, DWORD PTR [ebp] | ||
25 | add edi, DWORD PTR 4[ebp] | ||
26 | add esi, DWORD PTR 8[ebp] | ||
27 | xor edi, esi | ||
28 | mov eax, DWORD PTR 12[ebp] | ||
29 | mov ecx, esi | ||
30 | rol edi, cl | ||
31 | add edi, eax | ||
32 | xor esi, edi | ||
33 | mov eax, DWORD PTR 16[ebp] | ||
34 | mov ecx, edi | ||
35 | rol esi, cl | ||
36 | add esi, eax | ||
37 | xor edi, esi | ||
38 | mov eax, DWORD PTR 20[ebp] | ||
39 | mov ecx, esi | ||
40 | rol edi, cl | ||
41 | add edi, eax | ||
42 | xor esi, edi | ||
43 | mov eax, DWORD PTR 24[ebp] | ||
44 | mov ecx, edi | ||
45 | rol esi, cl | ||
46 | add esi, eax | ||
47 | xor edi, esi | ||
48 | mov eax, DWORD PTR 28[ebp] | ||
49 | mov ecx, esi | ||
50 | rol edi, cl | ||
51 | add edi, eax | ||
52 | xor esi, edi | ||
53 | mov eax, DWORD PTR 32[ebp] | ||
54 | mov ecx, edi | ||
55 | rol esi, cl | ||
56 | add esi, eax | ||
57 | xor edi, esi | ||
58 | mov eax, DWORD PTR 36[ebp] | ||
59 | mov ecx, esi | ||
60 | rol edi, cl | ||
61 | add edi, eax | ||
62 | xor esi, edi | ||
63 | mov eax, DWORD PTR 40[ebp] | ||
64 | mov ecx, edi | ||
65 | rol esi, cl | ||
66 | add esi, eax | ||
67 | xor edi, esi | ||
68 | mov eax, DWORD PTR 44[ebp] | ||
69 | mov ecx, esi | ||
70 | rol edi, cl | ||
71 | add edi, eax | ||
72 | xor esi, edi | ||
73 | mov eax, DWORD PTR 48[ebp] | ||
74 | mov ecx, edi | ||
75 | rol esi, cl | ||
76 | add esi, eax | ||
77 | xor edi, esi | ||
78 | mov eax, DWORD PTR 52[ebp] | ||
79 | mov ecx, esi | ||
80 | rol edi, cl | ||
81 | add edi, eax | ||
82 | xor esi, edi | ||
83 | mov eax, DWORD PTR 56[ebp] | ||
84 | mov ecx, edi | ||
85 | rol esi, cl | ||
86 | add esi, eax | ||
87 | xor edi, esi | ||
88 | mov eax, DWORD PTR 60[ebp] | ||
89 | mov ecx, esi | ||
90 | rol edi, cl | ||
91 | add edi, eax | ||
92 | xor esi, edi | ||
93 | mov eax, DWORD PTR 64[ebp] | ||
94 | mov ecx, edi | ||
95 | rol esi, cl | ||
96 | add esi, eax | ||
97 | xor edi, esi | ||
98 | mov eax, DWORD PTR 68[ebp] | ||
99 | mov ecx, esi | ||
100 | rol edi, cl | ||
101 | add edi, eax | ||
102 | xor esi, edi | ||
103 | mov eax, DWORD PTR 72[ebp] | ||
104 | mov ecx, edi | ||
105 | rol esi, cl | ||
106 | add esi, eax | ||
107 | cmp ebx, 8 | ||
108 | je $L000rc5_exit | ||
109 | xor edi, esi | ||
110 | mov eax, DWORD PTR 76[ebp] | ||
111 | mov ecx, esi | ||
112 | rol edi, cl | ||
113 | add edi, eax | ||
114 | xor esi, edi | ||
115 | mov eax, DWORD PTR 80[ebp] | ||
116 | mov ecx, edi | ||
117 | rol esi, cl | ||
118 | add esi, eax | ||
119 | xor edi, esi | ||
120 | mov eax, DWORD PTR 84[ebp] | ||
121 | mov ecx, esi | ||
122 | rol edi, cl | ||
123 | add edi, eax | ||
124 | xor esi, edi | ||
125 | mov eax, DWORD PTR 88[ebp] | ||
126 | mov ecx, edi | ||
127 | rol esi, cl | ||
128 | add esi, eax | ||
129 | xor edi, esi | ||
130 | mov eax, DWORD PTR 92[ebp] | ||
131 | mov ecx, esi | ||
132 | rol edi, cl | ||
133 | add edi, eax | ||
134 | xor esi, edi | ||
135 | mov eax, DWORD PTR 96[ebp] | ||
136 | mov ecx, edi | ||
137 | rol esi, cl | ||
138 | add esi, eax | ||
139 | xor edi, esi | ||
140 | mov eax, DWORD PTR 100[ebp] | ||
141 | mov ecx, esi | ||
142 | rol edi, cl | ||
143 | add edi, eax | ||
144 | xor esi, edi | ||
145 | mov eax, DWORD PTR 104[ebp] | ||
146 | mov ecx, edi | ||
147 | rol esi, cl | ||
148 | add esi, eax | ||
149 | cmp ebx, 12 | ||
150 | je $L000rc5_exit | ||
151 | xor edi, esi | ||
152 | mov eax, DWORD PTR 108[ebp] | ||
153 | mov ecx, esi | ||
154 | rol edi, cl | ||
155 | add edi, eax | ||
156 | xor esi, edi | ||
157 | mov eax, DWORD PTR 112[ebp] | ||
158 | mov ecx, edi | ||
159 | rol esi, cl | ||
160 | add esi, eax | ||
161 | xor edi, esi | ||
162 | mov eax, DWORD PTR 116[ebp] | ||
163 | mov ecx, esi | ||
164 | rol edi, cl | ||
165 | add edi, eax | ||
166 | xor esi, edi | ||
167 | mov eax, DWORD PTR 120[ebp] | ||
168 | mov ecx, edi | ||
169 | rol esi, cl | ||
170 | add esi, eax | ||
171 | xor edi, esi | ||
172 | mov eax, DWORD PTR 124[ebp] | ||
173 | mov ecx, esi | ||
174 | rol edi, cl | ||
175 | add edi, eax | ||
176 | xor esi, edi | ||
177 | mov eax, DWORD PTR 128[ebp] | ||
178 | mov ecx, edi | ||
179 | rol esi, cl | ||
180 | add esi, eax | ||
181 | xor edi, esi | ||
182 | mov eax, DWORD PTR 132[ebp] | ||
183 | mov ecx, esi | ||
184 | rol edi, cl | ||
185 | add edi, eax | ||
186 | xor esi, edi | ||
187 | mov eax, DWORD PTR 136[ebp] | ||
188 | mov ecx, edi | ||
189 | rol esi, cl | ||
190 | add esi, eax | ||
191 | $L000rc5_exit: | ||
192 | mov DWORD PTR [edx],edi | ||
193 | mov DWORD PTR 4[edx],esi | ||
194 | pop ebx | ||
195 | pop edi | ||
196 | pop esi | ||
197 | pop ebp | ||
198 | ret | ||
199 | _RC5_32_encrypt ENDP | ||
200 | _TEXT ENDS | ||
201 | _TEXT SEGMENT | ||
202 | PUBLIC _RC5_32_decrypt | ||
203 | |||
204 | _RC5_32_decrypt PROC NEAR | ||
205 | ; | ||
206 | push ebp | ||
207 | push esi | ||
208 | push edi | ||
209 | mov edx, DWORD PTR 16[esp] | ||
210 | mov ebp, DWORD PTR 20[esp] | ||
211 | ; Load the 2 words | ||
212 | mov edi, DWORD PTR [edx] | ||
213 | mov esi, DWORD PTR 4[edx] | ||
214 | push ebx | ||
215 | mov ebx, DWORD PTR [ebp] | ||
216 | cmp ebx, 12 | ||
217 | je $L001rc5_dec_12 | ||
218 | cmp ebx, 8 | ||
219 | je $L002rc5_dec_8 | ||
220 | mov eax, DWORD PTR 136[ebp] | ||
221 | sub esi, eax | ||
222 | mov ecx, edi | ||
223 | ror esi, cl | ||
224 | xor esi, edi | ||
225 | mov eax, DWORD PTR 132[ebp] | ||
226 | sub edi, eax | ||
227 | mov ecx, esi | ||
228 | ror edi, cl | ||
229 | xor edi, esi | ||
230 | mov eax, DWORD PTR 128[ebp] | ||
231 | sub esi, eax | ||
232 | mov ecx, edi | ||
233 | ror esi, cl | ||
234 | xor esi, edi | ||
235 | mov eax, DWORD PTR 124[ebp] | ||
236 | sub edi, eax | ||
237 | mov ecx, esi | ||
238 | ror edi, cl | ||
239 | xor edi, esi | ||
240 | mov eax, DWORD PTR 120[ebp] | ||
241 | sub esi, eax | ||
242 | mov ecx, edi | ||
243 | ror esi, cl | ||
244 | xor esi, edi | ||
245 | mov eax, DWORD PTR 116[ebp] | ||
246 | sub edi, eax | ||
247 | mov ecx, esi | ||
248 | ror edi, cl | ||
249 | xor edi, esi | ||
250 | mov eax, DWORD PTR 112[ebp] | ||
251 | sub esi, eax | ||
252 | mov ecx, edi | ||
253 | ror esi, cl | ||
254 | xor esi, edi | ||
255 | mov eax, DWORD PTR 108[ebp] | ||
256 | sub edi, eax | ||
257 | mov ecx, esi | ||
258 | ror edi, cl | ||
259 | xor edi, esi | ||
260 | $L001rc5_dec_12: | ||
261 | mov eax, DWORD PTR 104[ebp] | ||
262 | sub esi, eax | ||
263 | mov ecx, edi | ||
264 | ror esi, cl | ||
265 | xor esi, edi | ||
266 | mov eax, DWORD PTR 100[ebp] | ||
267 | sub edi, eax | ||
268 | mov ecx, esi | ||
269 | ror edi, cl | ||
270 | xor edi, esi | ||
271 | mov eax, DWORD PTR 96[ebp] | ||
272 | sub esi, eax | ||
273 | mov ecx, edi | ||
274 | ror esi, cl | ||
275 | xor esi, edi | ||
276 | mov eax, DWORD PTR 92[ebp] | ||
277 | sub edi, eax | ||
278 | mov ecx, esi | ||
279 | ror edi, cl | ||
280 | xor edi, esi | ||
281 | mov eax, DWORD PTR 88[ebp] | ||
282 | sub esi, eax | ||
283 | mov ecx, edi | ||
284 | ror esi, cl | ||
285 | xor esi, edi | ||
286 | mov eax, DWORD PTR 84[ebp] | ||
287 | sub edi, eax | ||
288 | mov ecx, esi | ||
289 | ror edi, cl | ||
290 | xor edi, esi | ||
291 | mov eax, DWORD PTR 80[ebp] | ||
292 | sub esi, eax | ||
293 | mov ecx, edi | ||
294 | ror esi, cl | ||
295 | xor esi, edi | ||
296 | mov eax, DWORD PTR 76[ebp] | ||
297 | sub edi, eax | ||
298 | mov ecx, esi | ||
299 | ror edi, cl | ||
300 | xor edi, esi | ||
301 | $L002rc5_dec_8: | ||
302 | mov eax, DWORD PTR 72[ebp] | ||
303 | sub esi, eax | ||
304 | mov ecx, edi | ||
305 | ror esi, cl | ||
306 | xor esi, edi | ||
307 | mov eax, DWORD PTR 68[ebp] | ||
308 | sub edi, eax | ||
309 | mov ecx, esi | ||
310 | ror edi, cl | ||
311 | xor edi, esi | ||
312 | mov eax, DWORD PTR 64[ebp] | ||
313 | sub esi, eax | ||
314 | mov ecx, edi | ||
315 | ror esi, cl | ||
316 | xor esi, edi | ||
317 | mov eax, DWORD PTR 60[ebp] | ||
318 | sub edi, eax | ||
319 | mov ecx, esi | ||
320 | ror edi, cl | ||
321 | xor edi, esi | ||
322 | mov eax, DWORD PTR 56[ebp] | ||
323 | sub esi, eax | ||
324 | mov ecx, edi | ||
325 | ror esi, cl | ||
326 | xor esi, edi | ||
327 | mov eax, DWORD PTR 52[ebp] | ||
328 | sub edi, eax | ||
329 | mov ecx, esi | ||
330 | ror edi, cl | ||
331 | xor edi, esi | ||
332 | mov eax, DWORD PTR 48[ebp] | ||
333 | sub esi, eax | ||
334 | mov ecx, edi | ||
335 | ror esi, cl | ||
336 | xor esi, edi | ||
337 | mov eax, DWORD PTR 44[ebp] | ||
338 | sub edi, eax | ||
339 | mov ecx, esi | ||
340 | ror edi, cl | ||
341 | xor edi, esi | ||
342 | mov eax, DWORD PTR 40[ebp] | ||
343 | sub esi, eax | ||
344 | mov ecx, edi | ||
345 | ror esi, cl | ||
346 | xor esi, edi | ||
347 | mov eax, DWORD PTR 36[ebp] | ||
348 | sub edi, eax | ||
349 | mov ecx, esi | ||
350 | ror edi, cl | ||
351 | xor edi, esi | ||
352 | mov eax, DWORD PTR 32[ebp] | ||
353 | sub esi, eax | ||
354 | mov ecx, edi | ||
355 | ror esi, cl | ||
356 | xor esi, edi | ||
357 | mov eax, DWORD PTR 28[ebp] | ||
358 | sub edi, eax | ||
359 | mov ecx, esi | ||
360 | ror edi, cl | ||
361 | xor edi, esi | ||
362 | mov eax, DWORD PTR 24[ebp] | ||
363 | sub esi, eax | ||
364 | mov ecx, edi | ||
365 | ror esi, cl | ||
366 | xor esi, edi | ||
367 | mov eax, DWORD PTR 20[ebp] | ||
368 | sub edi, eax | ||
369 | mov ecx, esi | ||
370 | ror edi, cl | ||
371 | xor edi, esi | ||
372 | mov eax, DWORD PTR 16[ebp] | ||
373 | sub esi, eax | ||
374 | mov ecx, edi | ||
375 | ror esi, cl | ||
376 | xor esi, edi | ||
377 | mov eax, DWORD PTR 12[ebp] | ||
378 | sub edi, eax | ||
379 | mov ecx, esi | ||
380 | ror edi, cl | ||
381 | xor edi, esi | ||
382 | sub esi, DWORD PTR 8[ebp] | ||
383 | sub edi, DWORD PTR 4[ebp] | ||
384 | L003rc5_exit: | ||
385 | mov DWORD PTR [edx],edi | ||
386 | mov DWORD PTR 4[edx],esi | ||
387 | pop ebx | ||
388 | pop edi | ||
389 | pop esi | ||
390 | pop ebp | ||
391 | ret | ||
392 | _RC5_32_decrypt ENDP | ||
393 | _TEXT ENDS | ||
394 | _TEXT SEGMENT | ||
395 | PUBLIC _RC5_32_cbc_encrypt | ||
396 | |||
397 | _RC5_32_cbc_encrypt PROC NEAR | ||
398 | ; | ||
399 | push ebp | ||
400 | push ebx | ||
401 | push esi | ||
402 | push edi | ||
403 | mov ebp, DWORD PTR 28[esp] | ||
404 | ; getting iv ptr from parameter 4 | ||
405 | mov ebx, DWORD PTR 36[esp] | ||
406 | mov esi, DWORD PTR [ebx] | ||
407 | mov edi, DWORD PTR 4[ebx] | ||
408 | push edi | ||
409 | push esi | ||
410 | push edi | ||
411 | push esi | ||
412 | mov ebx, esp | ||
413 | mov esi, DWORD PTR 36[esp] | ||
414 | mov edi, DWORD PTR 40[esp] | ||
415 | ; getting encrypt flag from parameter 5 | ||
416 | mov ecx, DWORD PTR 56[esp] | ||
417 | ; get and push parameter 3 | ||
418 | mov eax, DWORD PTR 48[esp] | ||
419 | push eax | ||
420 | push ebx | ||
421 | cmp ecx, 0 | ||
422 | jz $L004decrypt | ||
423 | and ebp, 4294967288 | ||
424 | mov eax, DWORD PTR 8[esp] | ||
425 | mov ebx, DWORD PTR 12[esp] | ||
426 | jz $L005encrypt_finish | ||
427 | L006encrypt_loop: | ||
428 | mov ecx, DWORD PTR [esi] | ||
429 | mov edx, DWORD PTR 4[esi] | ||
430 | xor eax, ecx | ||
431 | xor ebx, edx | ||
432 | mov DWORD PTR 8[esp],eax | ||
433 | mov DWORD PTR 12[esp],ebx | ||
434 | call _RC5_32_encrypt | ||
435 | mov eax, DWORD PTR 8[esp] | ||
436 | mov ebx, DWORD PTR 12[esp] | ||
437 | mov DWORD PTR [edi],eax | ||
438 | mov DWORD PTR 4[edi],ebx | ||
439 | add esi, 8 | ||
440 | add edi, 8 | ||
441 | sub ebp, 8 | ||
442 | jnz L006encrypt_loop | ||
443 | $L005encrypt_finish: | ||
444 | mov ebp, DWORD PTR 52[esp] | ||
445 | and ebp, 7 | ||
446 | jz $L007finish | ||
447 | xor ecx, ecx | ||
448 | xor edx, edx | ||
449 | mov ebp, DWORD PTR $L008cbc_enc_jmp_table[ebp*4] | ||
450 | jmp ebp | ||
451 | L009ej7: | ||
452 | mov dh, BYTE PTR 6[esi] | ||
453 | shl edx, 8 | ||
454 | L010ej6: | ||
455 | mov dh, BYTE PTR 5[esi] | ||
456 | L011ej5: | ||
457 | mov dl, BYTE PTR 4[esi] | ||
458 | L012ej4: | ||
459 | mov ecx, DWORD PTR [esi] | ||
460 | jmp $L013ejend | ||
461 | L014ej3: | ||
462 | mov ch, BYTE PTR 2[esi] | ||
463 | shl ecx, 8 | ||
464 | L015ej2: | ||
465 | mov ch, BYTE PTR 1[esi] | ||
466 | L016ej1: | ||
467 | mov cl, BYTE PTR [esi] | ||
468 | $L013ejend: | ||
469 | xor eax, ecx | ||
470 | xor ebx, edx | ||
471 | mov DWORD PTR 8[esp],eax | ||
472 | mov DWORD PTR 12[esp],ebx | ||
473 | call _RC5_32_encrypt | ||
474 | mov eax, DWORD PTR 8[esp] | ||
475 | mov ebx, DWORD PTR 12[esp] | ||
476 | mov DWORD PTR [edi],eax | ||
477 | mov DWORD PTR 4[edi],ebx | ||
478 | jmp $L007finish | ||
479 | $L004decrypt: | ||
480 | and ebp, 4294967288 | ||
481 | mov eax, DWORD PTR 16[esp] | ||
482 | mov ebx, DWORD PTR 20[esp] | ||
483 | jz $L017decrypt_finish | ||
484 | L018decrypt_loop: | ||
485 | mov eax, DWORD PTR [esi] | ||
486 | mov ebx, DWORD PTR 4[esi] | ||
487 | mov DWORD PTR 8[esp],eax | ||
488 | mov DWORD PTR 12[esp],ebx | ||
489 | call _RC5_32_decrypt | ||
490 | mov eax, DWORD PTR 8[esp] | ||
491 | mov ebx, DWORD PTR 12[esp] | ||
492 | mov ecx, DWORD PTR 16[esp] | ||
493 | mov edx, DWORD PTR 20[esp] | ||
494 | xor ecx, eax | ||
495 | xor edx, ebx | ||
496 | mov eax, DWORD PTR [esi] | ||
497 | mov ebx, DWORD PTR 4[esi] | ||
498 | mov DWORD PTR [edi],ecx | ||
499 | mov DWORD PTR 4[edi],edx | ||
500 | mov DWORD PTR 16[esp],eax | ||
501 | mov DWORD PTR 20[esp],ebx | ||
502 | add esi, 8 | ||
503 | add edi, 8 | ||
504 | sub ebp, 8 | ||
505 | jnz L018decrypt_loop | ||
506 | $L017decrypt_finish: | ||
507 | mov ebp, DWORD PTR 52[esp] | ||
508 | and ebp, 7 | ||
509 | jz $L007finish | ||
510 | mov eax, DWORD PTR [esi] | ||
511 | mov ebx, DWORD PTR 4[esi] | ||
512 | mov DWORD PTR 8[esp],eax | ||
513 | mov DWORD PTR 12[esp],ebx | ||
514 | call _RC5_32_decrypt | ||
515 | mov eax, DWORD PTR 8[esp] | ||
516 | mov ebx, DWORD PTR 12[esp] | ||
517 | mov ecx, DWORD PTR 16[esp] | ||
518 | mov edx, DWORD PTR 20[esp] | ||
519 | xor ecx, eax | ||
520 | xor edx, ebx | ||
521 | mov eax, DWORD PTR [esi] | ||
522 | mov ebx, DWORD PTR 4[esi] | ||
523 | L019dj7: | ||
524 | ror edx, 16 | ||
525 | mov BYTE PTR 6[edi],dl | ||
526 | shr edx, 16 | ||
527 | L020dj6: | ||
528 | mov BYTE PTR 5[edi],dh | ||
529 | L021dj5: | ||
530 | mov BYTE PTR 4[edi],dl | ||
531 | L022dj4: | ||
532 | mov DWORD PTR [edi],ecx | ||
533 | jmp $L023djend | ||
534 | L024dj3: | ||
535 | ror ecx, 16 | ||
536 | mov BYTE PTR 2[edi],cl | ||
537 | shl ecx, 16 | ||
538 | L025dj2: | ||
539 | mov BYTE PTR 1[esi],ch | ||
540 | L026dj1: | ||
541 | mov BYTE PTR [esi], cl | ||
542 | $L023djend: | ||
543 | jmp $L007finish | ||
544 | $L007finish: | ||
545 | mov ecx, DWORD PTR 60[esp] | ||
546 | add esp, 24 | ||
547 | mov DWORD PTR [ecx],eax | ||
548 | mov DWORD PTR 4[ecx],ebx | ||
549 | pop edi | ||
550 | pop esi | ||
551 | pop ebx | ||
552 | pop ebp | ||
553 | ret | ||
554 | $L008cbc_enc_jmp_table: | ||
555 | DD 0 | ||
556 | DD L016ej1 | ||
557 | DD L015ej2 | ||
558 | DD L014ej3 | ||
559 | DD L012ej4 | ||
560 | DD L011ej5 | ||
561 | DD L010ej6 | ||
562 | DD L009ej7 | ||
563 | L027cbc_dec_jmp_table: | ||
564 | DD 0 | ||
565 | DD L026dj1 | ||
566 | DD L025dj2 | ||
567 | DD L024dj3 | ||
568 | DD L022dj4 | ||
569 | DD L021dj5 | ||
570 | DD L020dj6 | ||
571 | DD L019dj7 | ||
572 | _RC5_32_cbc_encrypt ENDP | ||
573 | _TEXT ENDS | ||
574 | 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 @@ | |||
1 | /* Run the C pre-processor over this file with one of the following defined | ||
2 | * ELF - elf object files, | ||
3 | * OUT - a.out object files, | ||
4 | * BSDI - BSDI style a.out object files | ||
5 | * SOL - Solaris style elf | ||
6 | */ | ||
7 | |||
8 | #define TYPE(a,b) .type a,b | ||
9 | #define SIZE(a,b) .size a,b | ||
10 | |||
11 | #if defined(OUT) || defined(BSDI) | ||
12 | #define RC5_32_encrypt _RC5_32_encrypt | ||
13 | #define RC5_32_decrypt _RC5_32_decrypt | ||
14 | #define RC5_32_cbc_encrypt _RC5_32_cbc_encrypt | ||
15 | |||
16 | #endif | ||
17 | |||
18 | #ifdef OUT | ||
19 | #define OK 1 | ||
20 | #define ALIGN 4 | ||
21 | #endif | ||
22 | |||
23 | #ifdef BSDI | ||
24 | #define OK 1 | ||
25 | #define ALIGN 4 | ||
26 | #undef SIZE | ||
27 | #undef TYPE | ||
28 | #define SIZE(a,b) | ||
29 | #define TYPE(a,b) | ||
30 | #endif | ||
31 | |||
32 | #if defined(ELF) || defined(SOL) | ||
33 | #define OK 1 | ||
34 | #define ALIGN 16 | ||
35 | #endif | ||
36 | |||
37 | #ifndef OK | ||
38 | You need to define one of | ||
39 | ELF - elf systems - linux-elf, NetBSD and DG-UX | ||
40 | OUT - a.out systems - linux-a.out and FreeBSD | ||
41 | SOL - solaris systems, which are elf with strange comment lines | ||
42 | BSDI - a.out with a very primative version of as. | ||
43 | #endif | ||
44 | |||
45 | /* Let the Assembler begin :-) */ | ||
46 | /* Don't even think of reading this code */ | ||
47 | /* It was automatically generated by rc5-586.pl */ | ||
48 | /* Which is a perl program used to generate the x86 assember for */ | ||
49 | /* any of elf, a.out, BSDI,Win32, or Solaris */ | ||
50 | /* eric <eay@cryptsoft.com> */ | ||
51 | |||
52 | .file "rc5-586.s" | ||
53 | .version "01.01" | ||
54 | gcc2_compiled.: | ||
55 | .text | ||
56 | .align ALIGN | ||
57 | .globl RC5_32_encrypt | ||
58 | TYPE(RC5_32_encrypt,@function) | ||
59 | RC5_32_encrypt: | ||
60 | |||
61 | pushl %ebp | ||
62 | pushl %esi | ||
63 | pushl %edi | ||
64 | movl 16(%esp), %edx | ||
65 | movl 20(%esp), %ebp | ||
66 | /* Load the 2 words */ | ||
67 | movl (%edx), %edi | ||
68 | movl 4(%edx), %esi | ||
69 | pushl %ebx | ||
70 | movl (%ebp), %ebx | ||
71 | addl 4(%ebp), %edi | ||
72 | addl 8(%ebp), %esi | ||
73 | xorl %esi, %edi | ||
74 | movl 12(%ebp), %eax | ||
75 | movl %esi, %ecx | ||
76 | roll %cl, %edi | ||
77 | addl %eax, %edi | ||
78 | xorl %edi, %esi | ||
79 | movl 16(%ebp), %eax | ||
80 | movl %edi, %ecx | ||
81 | roll %cl, %esi | ||
82 | addl %eax, %esi | ||
83 | xorl %esi, %edi | ||
84 | movl 20(%ebp), %eax | ||
85 | movl %esi, %ecx | ||
86 | roll %cl, %edi | ||
87 | addl %eax, %edi | ||
88 | xorl %edi, %esi | ||
89 | movl 24(%ebp), %eax | ||
90 | movl %edi, %ecx | ||
91 | roll %cl, %esi | ||
92 | addl %eax, %esi | ||
93 | xorl %esi, %edi | ||
94 | movl 28(%ebp), %eax | ||
95 | movl %esi, %ecx | ||
96 | roll %cl, %edi | ||
97 | addl %eax, %edi | ||
98 | xorl %edi, %esi | ||
99 | movl 32(%ebp), %eax | ||
100 | movl %edi, %ecx | ||
101 | roll %cl, %esi | ||
102 | addl %eax, %esi | ||
103 | xorl %esi, %edi | ||
104 | movl 36(%ebp), %eax | ||
105 | movl %esi, %ecx | ||
106 | roll %cl, %edi | ||
107 | addl %eax, %edi | ||
108 | xorl %edi, %esi | ||
109 | movl 40(%ebp), %eax | ||
110 | movl %edi, %ecx | ||
111 | roll %cl, %esi | ||
112 | addl %eax, %esi | ||
113 | xorl %esi, %edi | ||
114 | movl 44(%ebp), %eax | ||
115 | movl %esi, %ecx | ||
116 | roll %cl, %edi | ||
117 | addl %eax, %edi | ||
118 | xorl %edi, %esi | ||
119 | movl 48(%ebp), %eax | ||
120 | movl %edi, %ecx | ||
121 | roll %cl, %esi | ||
122 | addl %eax, %esi | ||
123 | xorl %esi, %edi | ||
124 | movl 52(%ebp), %eax | ||
125 | movl %esi, %ecx | ||
126 | roll %cl, %edi | ||
127 | addl %eax, %edi | ||
128 | xorl %edi, %esi | ||
129 | movl 56(%ebp), %eax | ||
130 | movl %edi, %ecx | ||
131 | roll %cl, %esi | ||
132 | addl %eax, %esi | ||
133 | xorl %esi, %edi | ||
134 | movl 60(%ebp), %eax | ||
135 | movl %esi, %ecx | ||
136 | roll %cl, %edi | ||
137 | addl %eax, %edi | ||
138 | xorl %edi, %esi | ||
139 | movl 64(%ebp), %eax | ||
140 | movl %edi, %ecx | ||
141 | roll %cl, %esi | ||
142 | addl %eax, %esi | ||
143 | xorl %esi, %edi | ||
144 | movl 68(%ebp), %eax | ||
145 | movl %esi, %ecx | ||
146 | roll %cl, %edi | ||
147 | addl %eax, %edi | ||
148 | xorl %edi, %esi | ||
149 | movl 72(%ebp), %eax | ||
150 | movl %edi, %ecx | ||
151 | roll %cl, %esi | ||
152 | addl %eax, %esi | ||
153 | cmpl $8, %ebx | ||
154 | je .L000rc5_exit | ||
155 | xorl %esi, %edi | ||
156 | movl 76(%ebp), %eax | ||
157 | movl %esi, %ecx | ||
158 | roll %cl, %edi | ||
159 | addl %eax, %edi | ||
160 | xorl %edi, %esi | ||
161 | movl 80(%ebp), %eax | ||
162 | movl %edi, %ecx | ||
163 | roll %cl, %esi | ||
164 | addl %eax, %esi | ||
165 | xorl %esi, %edi | ||
166 | movl 84(%ebp), %eax | ||
167 | movl %esi, %ecx | ||
168 | roll %cl, %edi | ||
169 | addl %eax, %edi | ||
170 | xorl %edi, %esi | ||
171 | movl 88(%ebp), %eax | ||
172 | movl %edi, %ecx | ||
173 | roll %cl, %esi | ||
174 | addl %eax, %esi | ||
175 | xorl %esi, %edi | ||
176 | movl 92(%ebp), %eax | ||
177 | movl %esi, %ecx | ||
178 | roll %cl, %edi | ||
179 | addl %eax, %edi | ||
180 | xorl %edi, %esi | ||
181 | movl 96(%ebp), %eax | ||
182 | movl %edi, %ecx | ||
183 | roll %cl, %esi | ||
184 | addl %eax, %esi | ||
185 | xorl %esi, %edi | ||
186 | movl 100(%ebp), %eax | ||
187 | movl %esi, %ecx | ||
188 | roll %cl, %edi | ||
189 | addl %eax, %edi | ||
190 | xorl %edi, %esi | ||
191 | movl 104(%ebp), %eax | ||
192 | movl %edi, %ecx | ||
193 | roll %cl, %esi | ||
194 | addl %eax, %esi | ||
195 | cmpl $12, %ebx | ||
196 | je .L000rc5_exit | ||
197 | xorl %esi, %edi | ||
198 | movl 108(%ebp), %eax | ||
199 | movl %esi, %ecx | ||
200 | roll %cl, %edi | ||
201 | addl %eax, %edi | ||
202 | xorl %edi, %esi | ||
203 | movl 112(%ebp), %eax | ||
204 | movl %edi, %ecx | ||
205 | roll %cl, %esi | ||
206 | addl %eax, %esi | ||
207 | xorl %esi, %edi | ||
208 | movl 116(%ebp), %eax | ||
209 | movl %esi, %ecx | ||
210 | roll %cl, %edi | ||
211 | addl %eax, %edi | ||
212 | xorl %edi, %esi | ||
213 | movl 120(%ebp), %eax | ||
214 | movl %edi, %ecx | ||
215 | roll %cl, %esi | ||
216 | addl %eax, %esi | ||
217 | xorl %esi, %edi | ||
218 | movl 124(%ebp), %eax | ||
219 | movl %esi, %ecx | ||
220 | roll %cl, %edi | ||
221 | addl %eax, %edi | ||
222 | xorl %edi, %esi | ||
223 | movl 128(%ebp), %eax | ||
224 | movl %edi, %ecx | ||
225 | roll %cl, %esi | ||
226 | addl %eax, %esi | ||
227 | xorl %esi, %edi | ||
228 | movl 132(%ebp), %eax | ||
229 | movl %esi, %ecx | ||
230 | roll %cl, %edi | ||
231 | addl %eax, %edi | ||
232 | xorl %edi, %esi | ||
233 | movl 136(%ebp), %eax | ||
234 | movl %edi, %ecx | ||
235 | roll %cl, %esi | ||
236 | addl %eax, %esi | ||
237 | .L000rc5_exit: | ||
238 | movl %edi, (%edx) | ||
239 | movl %esi, 4(%edx) | ||
240 | popl %ebx | ||
241 | popl %edi | ||
242 | popl %esi | ||
243 | popl %ebp | ||
244 | ret | ||
245 | .RC5_32_encrypt_end: | ||
246 | SIZE(RC5_32_encrypt,.RC5_32_encrypt_end-RC5_32_encrypt) | ||
247 | .ident "desasm.pl" | ||
248 | .text | ||
249 | .align ALIGN | ||
250 | .globl RC5_32_decrypt | ||
251 | TYPE(RC5_32_decrypt,@function) | ||
252 | RC5_32_decrypt: | ||
253 | |||
254 | pushl %ebp | ||
255 | pushl %esi | ||
256 | pushl %edi | ||
257 | movl 16(%esp), %edx | ||
258 | movl 20(%esp), %ebp | ||
259 | /* Load the 2 words */ | ||
260 | movl (%edx), %edi | ||
261 | movl 4(%edx), %esi | ||
262 | pushl %ebx | ||
263 | movl (%ebp), %ebx | ||
264 | cmpl $12, %ebx | ||
265 | je .L001rc5_dec_12 | ||
266 | cmpl $8, %ebx | ||
267 | je .L002rc5_dec_8 | ||
268 | movl 136(%ebp), %eax | ||
269 | subl %eax, %esi | ||
270 | movl %edi, %ecx | ||
271 | rorl %cl, %esi | ||
272 | xorl %edi, %esi | ||
273 | movl 132(%ebp), %eax | ||
274 | subl %eax, %edi | ||
275 | movl %esi, %ecx | ||
276 | rorl %cl, %edi | ||
277 | xorl %esi, %edi | ||
278 | movl 128(%ebp), %eax | ||
279 | subl %eax, %esi | ||
280 | movl %edi, %ecx | ||
281 | rorl %cl, %esi | ||
282 | xorl %edi, %esi | ||
283 | movl 124(%ebp), %eax | ||
284 | subl %eax, %edi | ||
285 | movl %esi, %ecx | ||
286 | rorl %cl, %edi | ||
287 | xorl %esi, %edi | ||
288 | movl 120(%ebp), %eax | ||
289 | subl %eax, %esi | ||
290 | movl %edi, %ecx | ||
291 | rorl %cl, %esi | ||
292 | xorl %edi, %esi | ||
293 | movl 116(%ebp), %eax | ||
294 | subl %eax, %edi | ||
295 | movl %esi, %ecx | ||
296 | rorl %cl, %edi | ||
297 | xorl %esi, %edi | ||
298 | movl 112(%ebp), %eax | ||
299 | subl %eax, %esi | ||
300 | movl %edi, %ecx | ||
301 | rorl %cl, %esi | ||
302 | xorl %edi, %esi | ||
303 | movl 108(%ebp), %eax | ||
304 | subl %eax, %edi | ||
305 | movl %esi, %ecx | ||
306 | rorl %cl, %edi | ||
307 | xorl %esi, %edi | ||
308 | .L001rc5_dec_12: | ||
309 | movl 104(%ebp), %eax | ||
310 | subl %eax, %esi | ||
311 | movl %edi, %ecx | ||
312 | rorl %cl, %esi | ||
313 | xorl %edi, %esi | ||
314 | movl 100(%ebp), %eax | ||
315 | subl %eax, %edi | ||
316 | movl %esi, %ecx | ||
317 | rorl %cl, %edi | ||
318 | xorl %esi, %edi | ||
319 | movl 96(%ebp), %eax | ||
320 | subl %eax, %esi | ||
321 | movl %edi, %ecx | ||
322 | rorl %cl, %esi | ||
323 | xorl %edi, %esi | ||
324 | movl 92(%ebp), %eax | ||
325 | subl %eax, %edi | ||
326 | movl %esi, %ecx | ||
327 | rorl %cl, %edi | ||
328 | xorl %esi, %edi | ||
329 | movl 88(%ebp), %eax | ||
330 | subl %eax, %esi | ||
331 | movl %edi, %ecx | ||
332 | rorl %cl, %esi | ||
333 | xorl %edi, %esi | ||
334 | movl 84(%ebp), %eax | ||
335 | subl %eax, %edi | ||
336 | movl %esi, %ecx | ||
337 | rorl %cl, %edi | ||
338 | xorl %esi, %edi | ||
339 | movl 80(%ebp), %eax | ||
340 | subl %eax, %esi | ||
341 | movl %edi, %ecx | ||
342 | rorl %cl, %esi | ||
343 | xorl %edi, %esi | ||
344 | movl 76(%ebp), %eax | ||
345 | subl %eax, %edi | ||
346 | movl %esi, %ecx | ||
347 | rorl %cl, %edi | ||
348 | xorl %esi, %edi | ||
349 | .L002rc5_dec_8: | ||
350 | movl 72(%ebp), %eax | ||
351 | subl %eax, %esi | ||
352 | movl %edi, %ecx | ||
353 | rorl %cl, %esi | ||
354 | xorl %edi, %esi | ||
355 | movl 68(%ebp), %eax | ||
356 | subl %eax, %edi | ||
357 | movl %esi, %ecx | ||
358 | rorl %cl, %edi | ||
359 | xorl %esi, %edi | ||
360 | movl 64(%ebp), %eax | ||
361 | subl %eax, %esi | ||
362 | movl %edi, %ecx | ||
363 | rorl %cl, %esi | ||
364 | xorl %edi, %esi | ||
365 | movl 60(%ebp), %eax | ||
366 | subl %eax, %edi | ||
367 | movl %esi, %ecx | ||
368 | rorl %cl, %edi | ||
369 | xorl %esi, %edi | ||
370 | movl 56(%ebp), %eax | ||
371 | subl %eax, %esi | ||
372 | movl %edi, %ecx | ||
373 | rorl %cl, %esi | ||
374 | xorl %edi, %esi | ||
375 | movl 52(%ebp), %eax | ||
376 | subl %eax, %edi | ||
377 | movl %esi, %ecx | ||
378 | rorl %cl, %edi | ||
379 | xorl %esi, %edi | ||
380 | movl 48(%ebp), %eax | ||
381 | subl %eax, %esi | ||
382 | movl %edi, %ecx | ||
383 | rorl %cl, %esi | ||
384 | xorl %edi, %esi | ||
385 | movl 44(%ebp), %eax | ||
386 | subl %eax, %edi | ||
387 | movl %esi, %ecx | ||
388 | rorl %cl, %edi | ||
389 | xorl %esi, %edi | ||
390 | movl 40(%ebp), %eax | ||
391 | subl %eax, %esi | ||
392 | movl %edi, %ecx | ||
393 | rorl %cl, %esi | ||
394 | xorl %edi, %esi | ||
395 | movl 36(%ebp), %eax | ||
396 | subl %eax, %edi | ||
397 | movl %esi, %ecx | ||
398 | rorl %cl, %edi | ||
399 | xorl %esi, %edi | ||
400 | movl 32(%ebp), %eax | ||
401 | subl %eax, %esi | ||
402 | movl %edi, %ecx | ||
403 | rorl %cl, %esi | ||
404 | xorl %edi, %esi | ||
405 | movl 28(%ebp), %eax | ||
406 | subl %eax, %edi | ||
407 | movl %esi, %ecx | ||
408 | rorl %cl, %edi | ||
409 | xorl %esi, %edi | ||
410 | movl 24(%ebp), %eax | ||
411 | subl %eax, %esi | ||
412 | movl %edi, %ecx | ||
413 | rorl %cl, %esi | ||
414 | xorl %edi, %esi | ||
415 | movl 20(%ebp), %eax | ||
416 | subl %eax, %edi | ||
417 | movl %esi, %ecx | ||
418 | rorl %cl, %edi | ||
419 | xorl %esi, %edi | ||
420 | movl 16(%ebp), %eax | ||
421 | subl %eax, %esi | ||
422 | movl %edi, %ecx | ||
423 | rorl %cl, %esi | ||
424 | xorl %edi, %esi | ||
425 | movl 12(%ebp), %eax | ||
426 | subl %eax, %edi | ||
427 | movl %esi, %ecx | ||
428 | rorl %cl, %edi | ||
429 | xorl %esi, %edi | ||
430 | subl 8(%ebp), %esi | ||
431 | subl 4(%ebp), %edi | ||
432 | .L003rc5_exit: | ||
433 | movl %edi, (%edx) | ||
434 | movl %esi, 4(%edx) | ||
435 | popl %ebx | ||
436 | popl %edi | ||
437 | popl %esi | ||
438 | popl %ebp | ||
439 | ret | ||
440 | .RC5_32_decrypt_end: | ||
441 | SIZE(RC5_32_decrypt,.RC5_32_decrypt_end-RC5_32_decrypt) | ||
442 | .ident "desasm.pl" | ||
443 | .text | ||
444 | .align ALIGN | ||
445 | .globl RC5_32_cbc_encrypt | ||
446 | TYPE(RC5_32_cbc_encrypt,@function) | ||
447 | RC5_32_cbc_encrypt: | ||
448 | |||
449 | pushl %ebp | ||
450 | pushl %ebx | ||
451 | pushl %esi | ||
452 | pushl %edi | ||
453 | movl 28(%esp), %ebp | ||
454 | /* getting iv ptr from parameter 4 */ | ||
455 | movl 36(%esp), %ebx | ||
456 | movl (%ebx), %esi | ||
457 | movl 4(%ebx), %edi | ||
458 | pushl %edi | ||
459 | pushl %esi | ||
460 | pushl %edi | ||
461 | pushl %esi | ||
462 | movl %esp, %ebx | ||
463 | movl 36(%esp), %esi | ||
464 | movl 40(%esp), %edi | ||
465 | /* getting encrypt flag from parameter 5 */ | ||
466 | movl 56(%esp), %ecx | ||
467 | /* get and push parameter 3 */ | ||
468 | movl 48(%esp), %eax | ||
469 | pushl %eax | ||
470 | pushl %ebx | ||
471 | cmpl $0, %ecx | ||
472 | jz .L004decrypt | ||
473 | andl $4294967288, %ebp | ||
474 | movl 8(%esp), %eax | ||
475 | movl 12(%esp), %ebx | ||
476 | jz .L005encrypt_finish | ||
477 | .L006encrypt_loop: | ||
478 | movl (%esi), %ecx | ||
479 | movl 4(%esi), %edx | ||
480 | xorl %ecx, %eax | ||
481 | xorl %edx, %ebx | ||
482 | movl %eax, 8(%esp) | ||
483 | movl %ebx, 12(%esp) | ||
484 | call RC5_32_encrypt | ||
485 | movl 8(%esp), %eax | ||
486 | movl 12(%esp), %ebx | ||
487 | movl %eax, (%edi) | ||
488 | movl %ebx, 4(%edi) | ||
489 | addl $8, %esi | ||
490 | addl $8, %edi | ||
491 | subl $8, %ebp | ||
492 | jnz .L006encrypt_loop | ||
493 | .L005encrypt_finish: | ||
494 | movl 52(%esp), %ebp | ||
495 | andl $7, %ebp | ||
496 | jz .L007finish | ||
497 | xorl %ecx, %ecx | ||
498 | xorl %edx, %edx | ||
499 | movl .L008cbc_enc_jmp_table(,%ebp,4),%ebp | ||
500 | jmp *%ebp | ||
501 | .L009ej7: | ||
502 | movb 6(%esi), %dh | ||
503 | sall $8, %edx | ||
504 | .L010ej6: | ||
505 | movb 5(%esi), %dh | ||
506 | .L011ej5: | ||
507 | movb 4(%esi), %dl | ||
508 | .L012ej4: | ||
509 | movl (%esi), %ecx | ||
510 | jmp .L013ejend | ||
511 | .L014ej3: | ||
512 | movb 2(%esi), %ch | ||
513 | sall $8, %ecx | ||
514 | .L015ej2: | ||
515 | movb 1(%esi), %ch | ||
516 | .L016ej1: | ||
517 | movb (%esi), %cl | ||
518 | .L013ejend: | ||
519 | xorl %ecx, %eax | ||
520 | xorl %edx, %ebx | ||
521 | movl %eax, 8(%esp) | ||
522 | movl %ebx, 12(%esp) | ||
523 | call RC5_32_encrypt | ||
524 | movl 8(%esp), %eax | ||
525 | movl 12(%esp), %ebx | ||
526 | movl %eax, (%edi) | ||
527 | movl %ebx, 4(%edi) | ||
528 | jmp .L007finish | ||
529 | .align ALIGN | ||
530 | .L004decrypt: | ||
531 | andl $4294967288, %ebp | ||
532 | movl 16(%esp), %eax | ||
533 | movl 20(%esp), %ebx | ||
534 | jz .L017decrypt_finish | ||
535 | .L018decrypt_loop: | ||
536 | movl (%esi), %eax | ||
537 | movl 4(%esi), %ebx | ||
538 | movl %eax, 8(%esp) | ||
539 | movl %ebx, 12(%esp) | ||
540 | call RC5_32_decrypt | ||
541 | movl 8(%esp), %eax | ||
542 | movl 12(%esp), %ebx | ||
543 | movl 16(%esp), %ecx | ||
544 | movl 20(%esp), %edx | ||
545 | xorl %eax, %ecx | ||
546 | xorl %ebx, %edx | ||
547 | movl (%esi), %eax | ||
548 | movl 4(%esi), %ebx | ||
549 | movl %ecx, (%edi) | ||
550 | movl %edx, 4(%edi) | ||
551 | movl %eax, 16(%esp) | ||
552 | movl %ebx, 20(%esp) | ||
553 | addl $8, %esi | ||
554 | addl $8, %edi | ||
555 | subl $8, %ebp | ||
556 | jnz .L018decrypt_loop | ||
557 | .L017decrypt_finish: | ||
558 | movl 52(%esp), %ebp | ||
559 | andl $7, %ebp | ||
560 | jz .L007finish | ||
561 | movl (%esi), %eax | ||
562 | movl 4(%esi), %ebx | ||
563 | movl %eax, 8(%esp) | ||
564 | movl %ebx, 12(%esp) | ||
565 | call RC5_32_decrypt | ||
566 | movl 8(%esp), %eax | ||
567 | movl 12(%esp), %ebx | ||
568 | movl 16(%esp), %ecx | ||
569 | movl 20(%esp), %edx | ||
570 | xorl %eax, %ecx | ||
571 | xorl %ebx, %edx | ||
572 | movl (%esi), %eax | ||
573 | movl 4(%esi), %ebx | ||
574 | .L019dj7: | ||
575 | rorl $16, %edx | ||
576 | movb %dl, 6(%edi) | ||
577 | shrl $16, %edx | ||
578 | .L020dj6: | ||
579 | movb %dh, 5(%edi) | ||
580 | .L021dj5: | ||
581 | movb %dl, 4(%edi) | ||
582 | .L022dj4: | ||
583 | movl %ecx, (%edi) | ||
584 | jmp .L023djend | ||
585 | .L024dj3: | ||
586 | rorl $16, %ecx | ||
587 | movb %cl, 2(%edi) | ||
588 | sall $16, %ecx | ||
589 | .L025dj2: | ||
590 | movb %ch, 1(%esi) | ||
591 | .L026dj1: | ||
592 | movb %cl, (%esi) | ||
593 | .L023djend: | ||
594 | jmp .L007finish | ||
595 | .align ALIGN | ||
596 | .L007finish: | ||
597 | movl 60(%esp), %ecx | ||
598 | addl $24, %esp | ||
599 | movl %eax, (%ecx) | ||
600 | movl %ebx, 4(%ecx) | ||
601 | popl %edi | ||
602 | popl %esi | ||
603 | popl %ebx | ||
604 | popl %ebp | ||
605 | ret | ||
606 | .align ALIGN | ||
607 | .L008cbc_enc_jmp_table: | ||
608 | .long 0 | ||
609 | .long .L016ej1 | ||
610 | .long .L015ej2 | ||
611 | .long .L014ej3 | ||
612 | .long .L012ej4 | ||
613 | .long .L011ej5 | ||
614 | .long .L010ej6 | ||
615 | .long .L009ej7 | ||
616 | .align ALIGN | ||
617 | .L027cbc_dec_jmp_table: | ||
618 | .long 0 | ||
619 | .long .L026dj1 | ||
620 | .long .L025dj2 | ||
621 | .long .L024dj3 | ||
622 | .long .L022dj4 | ||
623 | .long .L021dj5 | ||
624 | .long .L020dj6 | ||
625 | .long .L019dj7 | ||
626 | .RC5_32_cbc_encrypt_end: | ||
627 | SIZE(RC5_32_cbc_encrypt,.RC5_32_cbc_encrypt_end-RC5_32_cbc_encrypt) | ||
628 | .ident "desasm.pl" | ||
diff --git a/src/lib/libcrypto/rc5/asm/rc5-586.pl b/src/lib/libcrypto/rc5/asm/rc5-586.pl new file mode 100644 index 0000000000..172bd9ee1b --- /dev/null +++ b/src/lib/libcrypto/rc5/asm/rc5-586.pl | |||
@@ -0,0 +1,109 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | push(@INC,"perlasm","../../perlasm"); | ||
4 | require "x86asm.pl"; | ||
5 | require "cbc.pl"; | ||
6 | |||
7 | &asm_init($ARGV[0],"rc5-586.pl"); | ||
8 | |||
9 | $RC5_MAX_ROUNDS=16; | ||
10 | $RC5_32_OFF=($RC5_MAX_ROUNDS+2)*4; | ||
11 | $A="edi"; | ||
12 | $B="esi"; | ||
13 | $S="ebp"; | ||
14 | $tmp1="eax"; | ||
15 | $r="ebx"; | ||
16 | $tmpc="ecx"; | ||
17 | $tmp4="edx"; | ||
18 | |||
19 | &RC5_32_encrypt("RC5_32_encrypt",1); | ||
20 | &RC5_32_encrypt("RC5_32_decrypt",0); | ||
21 | &cbc("RC5_32_cbc_encrypt","RC5_32_encrypt","RC5_32_decrypt",0,4,5,3,-1,-1); | ||
22 | &asm_finish(); | ||
23 | |||
24 | sub RC5_32_encrypt | ||
25 | { | ||
26 | local($name,$enc)=@_; | ||
27 | |||
28 | &function_begin_B($name,""); | ||
29 | |||
30 | &comment(""); | ||
31 | |||
32 | &push("ebp"); | ||
33 | &push("esi"); | ||
34 | &push("edi"); | ||
35 | &mov($tmp4,&wparam(0)); | ||
36 | &mov($S,&wparam(1)); | ||
37 | |||
38 | &comment("Load the 2 words"); | ||
39 | &mov($A,&DWP(0,$tmp4,"",0)); | ||
40 | &mov($B,&DWP(4,$tmp4,"",0)); | ||
41 | |||
42 | &push($r); | ||
43 | &mov($r, &DWP(0,$S,"",0)); | ||
44 | |||
45 | # encrypting part | ||
46 | |||
47 | if ($enc) | ||
48 | { | ||
49 | &add($A, &DWP(4+0,$S,"",0)); | ||
50 | &add($B, &DWP(4+4,$S,"",0)); | ||
51 | |||
52 | for ($i=0; $i<$RC5_MAX_ROUNDS; $i++) | ||
53 | { | ||
54 | &xor($A, $B); | ||
55 | &mov($tmp1, &DWP(12+$i*8,$S,"",0)); | ||
56 | &mov($tmpc, $B); | ||
57 | &rotl($A, &LB("ecx")); | ||
58 | &add($A, $tmp1); | ||
59 | |||
60 | &xor($B, $A); | ||
61 | &mov($tmp1, &DWP(16+$i*8,$S,"",0)); | ||
62 | &mov($tmpc, $A); | ||
63 | &rotl($B, &LB("ecx")); | ||
64 | &add($B, $tmp1); | ||
65 | if (($i == 7) || ($i == 11)) | ||
66 | { | ||
67 | &cmp($r, $i+1); | ||
68 | &je(&label("rc5_exit")); | ||
69 | } | ||
70 | } | ||
71 | } | ||
72 | else | ||
73 | { | ||
74 | &cmp($r, 12); | ||
75 | &je(&label("rc5_dec_12")); | ||
76 | &cmp($r, 8); | ||
77 | &je(&label("rc5_dec_8")); | ||
78 | for ($i=$RC5_MAX_ROUNDS; $i > 0; $i--) | ||
79 | { | ||
80 | &set_label("rc5_dec_$i") if ($i == 12) || ($i == 8); | ||
81 | &mov($tmp1, &DWP($i*8+8,$S,"",0)); | ||
82 | &sub($B, $tmp1); | ||
83 | &mov($tmpc, $A); | ||
84 | &rotr($B, &LB("ecx")); | ||
85 | &xor($B, $A); | ||
86 | |||
87 | &mov($tmp1, &DWP($i*8+4,$S,"",0)); | ||
88 | &sub($A, $tmp1); | ||
89 | &mov($tmpc, $B); | ||
90 | &rotr($A, &LB("ecx")); | ||
91 | &xor($A, $B); | ||
92 | } | ||
93 | &sub($B, &DWP(4+4,$S,"",0)); | ||
94 | &sub($A, &DWP(4+0,$S,"",0)); | ||
95 | } | ||
96 | |||
97 | &set_label("rc5_exit"); | ||
98 | &mov(&DWP(0,$tmp4,"",0),$A); | ||
99 | &mov(&DWP(4,$tmp4,"",0),$B); | ||
100 | |||
101 | &pop("ebx"); | ||
102 | &pop("edi"); | ||
103 | &pop("esi"); | ||
104 | &pop("ebp"); | ||
105 | &ret(); | ||
106 | &function_end_B($name); | ||
107 | } | ||
108 | |||
109 | |||
diff --git a/src/lib/libcrypto/ripemd/Makefile.ssl b/src/lib/libcrypto/ripemd/Makefile.ssl new file mode 100644 index 0000000000..67d47ceb2c --- /dev/null +++ b/src/lib/libcrypto/ripemd/Makefile.ssl | |||
@@ -0,0 +1,104 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/ripemd/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= ripemd | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | CPP= $(CC) -E | ||
9 | INCLUDES= | ||
10 | CFLAG=-g | ||
11 | INSTALLTOP=/usr/local/ssl | ||
12 | MAKE= make -f Makefile.ssl | ||
13 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
14 | MAKEFILE= Makefile.ssl | ||
15 | AR= ar r | ||
16 | |||
17 | RIP_ASM_OBJ= | ||
18 | |||
19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
20 | |||
21 | GENERAL=Makefile | ||
22 | TEST=rmdtest.c | ||
23 | APPS=rmd160.c | ||
24 | |||
25 | LIB=$(TOP)/libcrypto.a | ||
26 | LIBSRC=rmd_dgst.c rmd_one.c | ||
27 | LIBOBJ=rmd_dgst.o rmd_one.o $(RMD160_ASM_OBJ) | ||
28 | |||
29 | SRC= $(LIBSRC) | ||
30 | |||
31 | EXHEADER= ripemd.h | ||
32 | HEADER= rmd_locl.h rmdconst.h $(EXHEADER) | ||
33 | |||
34 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
35 | |||
36 | top: | ||
37 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
38 | |||
39 | all: lib | ||
40 | |||
41 | lib: $(LIBOBJ) | ||
42 | $(AR) $(LIB) $(LIBOBJ) | ||
43 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
44 | @touch lib | ||
45 | |||
46 | # elf | ||
47 | asm/rm86-elf.o: asm/rm86unix.cpp | ||
48 | $(CPP) -DELF asm/rm86unix.cpp | as -o asm/rm86-elf.o | ||
49 | |||
50 | # solaris | ||
51 | asm/rm86-sol.o: asm/rm86unix.cpp | ||
52 | $(CC) -E -DSOL asm/rm86unix.cpp | sed 's/^#.*//' > asm/rm86-sol.s | ||
53 | as -o asm/rm86-sol.o asm/rm86-sol.s | ||
54 | rm -f asm/rm86-sol.s | ||
55 | |||
56 | # a.out | ||
57 | asm/rm86-out.o: asm/rm86unix.cpp | ||
58 | $(CPP) -DOUT asm/rm86unix.cpp | as -o asm/rm86-out.o | ||
59 | |||
60 | # bsdi | ||
61 | asm/rm86bsdi.o: asm/rm86unix.cpp | ||
62 | $(CPP) -DBSDI asm/rm86unix.cpp | as -o asm/rm86bsdi.o | ||
63 | |||
64 | asm/rm86unix.cpp: | ||
65 | (cd asm; perl rmd-586.pl cpp >rm86unix.cpp) | ||
66 | |||
67 | files: | ||
68 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
69 | |||
70 | links: | ||
71 | /bin/rm -f Makefile | ||
72 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
73 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
74 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
75 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
76 | |||
77 | install: | ||
78 | @for i in $(EXHEADER) ; \ | ||
79 | do \ | ||
80 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
81 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
82 | done; | ||
83 | |||
84 | tags: | ||
85 | ctags $(SRC) | ||
86 | |||
87 | tests: | ||
88 | |||
89 | lint: | ||
90 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
91 | |||
92 | depend: | ||
93 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
94 | |||
95 | dclean: | ||
96 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
97 | mv -f Makefile.new $(MAKEFILE) | ||
98 | |||
99 | clean: | ||
100 | /bin/rm -f *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
101 | |||
102 | errors: | ||
103 | |||
104 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | # Targets | ||
2 | # make - twidle the options yourself :-) | ||
3 | # make cc - standard cc options | ||
4 | # make gcc - standard gcc options | ||
5 | # make x86-elf - linux-elf etc | ||
6 | # make x86-out - linux-a.out, FreeBSD etc | ||
7 | # make x86-solaris | ||
8 | # make x86-bdsi | ||
9 | |||
10 | DIR= md5 | ||
11 | TOP= . | ||
12 | CC= gcc | ||
13 | CFLAG= -O3 -fomit-frame-pointer | ||
14 | |||
15 | CPP= $(CC) -E | ||
16 | INCLUDES= | ||
17 | INSTALLTOP=/usr/local/lib | ||
18 | MAKE= make | ||
19 | MAKEDEPEND= makedepend | ||
20 | MAKEFILE= Makefile.uni | ||
21 | AR= ar r | ||
22 | |||
23 | MD5_ASM_OBJ= | ||
24 | |||
25 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
26 | |||
27 | GENERAL=Makefile | ||
28 | TEST=md5test | ||
29 | APPS=md5 | ||
30 | |||
31 | LIB=libmd5.a | ||
32 | LIBSRC=md5_dgst.c md5_one.c | ||
33 | LIBOBJ=md5_dgst.o md5_one.o $(MD5_ASM_OBJ) | ||
34 | |||
35 | SRC= $(LIBSRC) | ||
36 | |||
37 | EXHEADER= md5.h | ||
38 | HEADER= md5_locl.h $(EXHEADER) | ||
39 | |||
40 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
41 | |||
42 | all: $(LIB) $(TEST) $(APPS) | ||
43 | |||
44 | $(LIB): $(LIBOBJ) | ||
45 | $(AR) $(LIB) $(LIBOBJ) | ||
46 | sh $(TOP)/ranlib.sh $(LIB) | ||
47 | |||
48 | # elf | ||
49 | asm/mx86-elf.o: asm/mx86unix.cpp | ||
50 | $(CPP) -DELF asm/mx86unix.cpp | as -o asm/mx86-elf.o | ||
51 | |||
52 | # solaris | ||
53 | asm/mx86-sol.o: asm/mx86unix.cpp | ||
54 | $(CC) -E -DSOL asm/mx86unix.cpp | sed 's/^#.*//' > asm/mx86-sol.s | ||
55 | as -o asm/mx86-sol.o asm/mx86-sol.s | ||
56 | rm -f asm/mx86-sol.s | ||
57 | |||
58 | # a.out | ||
59 | asm/mx86-out.o: asm/mx86unix.cpp | ||
60 | $(CPP) -DOUT asm/mx86unix.cpp | as -o asm/mx86-out.o | ||
61 | |||
62 | # bsdi | ||
63 | asm/mx86bsdi.o: asm/mx86unix.cpp | ||
64 | $(CPP) -DBSDI asm/mx86unix.cpp | as -o asm/mx86bsdi.o | ||
65 | |||
66 | asm/mx86unix.cpp: | ||
67 | (cd asm; perl md5-586.pl cpp >mx86unix.cpp) | ||
68 | |||
69 | test: $(TEST) | ||
70 | ./$(TEST) | ||
71 | |||
72 | $(TEST): $(TEST).c $(LIB) | ||
73 | $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) | ||
74 | |||
75 | $(APPS): $(APPS).c $(LIB) | ||
76 | $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) | ||
77 | |||
78 | lint: | ||
79 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
80 | |||
81 | depend: | ||
82 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
83 | |||
84 | dclean: | ||
85 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
86 | mv -f Makefile.new $(MAKEFILE) | ||
87 | |||
88 | clean: | ||
89 | /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
90 | |||
91 | cc: | ||
92 | $(MAKE) MD5_ASM_OBJ="" CC="cc" CFLAG="-O" all | ||
93 | |||
94 | gcc: | ||
95 | $(MAKE) MD5_ASM_OBJ="" CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all | ||
96 | |||
97 | x86-elf: | ||
98 | $(MAKE) MD5_ASM_OBJ="asm/mx86-elf.o" CFLAG="-DELF -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all | ||
99 | |||
100 | x86-out: | ||
101 | $(MAKE) MD5_ASM_OBJ="asm/mx86-out.o" CFLAG="-DOUT -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all | ||
102 | |||
103 | x86-solaris: | ||
104 | $(MAKE) MD5_ASM_OBJ="asm/mx86-sol.o" CFLAG="-DSOL -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all | ||
105 | |||
106 | x86-bdsi: | ||
107 | $(MAKE) MD5_ASM_OBJ="asm/mx86-bdsi.o" CFLAG="-DBDSI -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all | ||
108 | |||
109 | # 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 @@ | |||
1 | ; Don't even think of reading this code | ||
2 | ; It was automatically generated by rmd-586.pl | ||
3 | ; Which is a perl program used to generate the x86 assember for | ||
4 | ; any of elf, a.out, BSDI,Win32, or Solaris | ||
5 | ; eric <eay@cryptsoft.com> | ||
6 | ; | ||
7 | TITLE rmd-586.asm | ||
8 | .386 | ||
9 | .model FLAT | ||
10 | _TEXT SEGMENT | ||
11 | PUBLIC _ripemd160_block_x86 | ||
12 | |||
13 | _ripemd160_block_x86 PROC NEAR | ||
14 | push esi | ||
15 | mov ecx, DWORD PTR 16[esp] | ||
16 | push edi | ||
17 | mov esi, DWORD PTR 16[esp] | ||
18 | push ebp | ||
19 | add ecx, esi | ||
20 | push ebx | ||
21 | sub ecx, 64 | ||
22 | sub esp, 88 | ||
23 | mov DWORD PTR [esp],ecx | ||
24 | mov edi, DWORD PTR 108[esp] | ||
25 | L000start: | ||
26 | ; | ||
27 | mov eax, DWORD PTR [esi] | ||
28 | mov ebx, DWORD PTR 4[esi] | ||
29 | mov DWORD PTR 4[esp],eax | ||
30 | mov DWORD PTR 8[esp],ebx | ||
31 | mov eax, DWORD PTR 8[esi] | ||
32 | mov ebx, DWORD PTR 12[esi] | ||
33 | mov DWORD PTR 12[esp],eax | ||
34 | mov DWORD PTR 16[esp],ebx | ||
35 | mov eax, DWORD PTR 16[esi] | ||
36 | mov ebx, DWORD PTR 20[esi] | ||
37 | mov DWORD PTR 20[esp],eax | ||
38 | mov DWORD PTR 24[esp],ebx | ||
39 | mov eax, DWORD PTR 24[esi] | ||
40 | mov ebx, DWORD PTR 28[esi] | ||
41 | mov DWORD PTR 28[esp],eax | ||
42 | mov DWORD PTR 32[esp],ebx | ||
43 | mov eax, DWORD PTR 32[esi] | ||
44 | mov ebx, DWORD PTR 36[esi] | ||
45 | mov DWORD PTR 36[esp],eax | ||
46 | mov DWORD PTR 40[esp],ebx | ||
47 | mov eax, DWORD PTR 40[esi] | ||
48 | mov ebx, DWORD PTR 44[esi] | ||
49 | mov DWORD PTR 44[esp],eax | ||
50 | mov DWORD PTR 48[esp],ebx | ||
51 | mov eax, DWORD PTR 48[esi] | ||
52 | mov ebx, DWORD PTR 52[esi] | ||
53 | mov DWORD PTR 52[esp],eax | ||
54 | mov DWORD PTR 56[esp],ebx | ||
55 | mov eax, DWORD PTR 56[esi] | ||
56 | mov ebx, DWORD PTR 60[esi] | ||
57 | mov DWORD PTR 60[esp],eax | ||
58 | mov DWORD PTR 64[esp],ebx | ||
59 | add esi, 64 | ||
60 | mov eax, DWORD PTR [edi] | ||
61 | mov DWORD PTR 112[esp],esi | ||
62 | mov ebx, DWORD PTR 4[edi] | ||
63 | mov ecx, DWORD PTR 8[edi] | ||
64 | mov edx, DWORD PTR 12[edi] | ||
65 | mov ebp, DWORD PTR 16[edi] | ||
66 | ; 0 | ||
67 | mov esi, ecx | ||
68 | xor esi, edx | ||
69 | mov edi, DWORD PTR 4[esp] | ||
70 | xor esi, ebx | ||
71 | add eax, edi | ||
72 | rol ecx, 10 | ||
73 | add eax, esi | ||
74 | mov esi, ebx | ||
75 | rol eax, 11 | ||
76 | add eax, ebp | ||
77 | ; 1 | ||
78 | xor esi, ecx | ||
79 | mov edi, DWORD PTR 8[esp] | ||
80 | xor esi, eax | ||
81 | add ebp, esi | ||
82 | mov esi, eax | ||
83 | rol ebx, 10 | ||
84 | add ebp, edi | ||
85 | xor esi, ebx | ||
86 | rol ebp, 14 | ||
87 | add ebp, edx | ||
88 | ; 2 | ||
89 | mov edi, DWORD PTR 12[esp] | ||
90 | xor esi, ebp | ||
91 | add edx, edi | ||
92 | rol eax, 10 | ||
93 | add edx, esi | ||
94 | mov esi, ebp | ||
95 | rol edx, 15 | ||
96 | add edx, ecx | ||
97 | ; 3 | ||
98 | xor esi, eax | ||
99 | mov edi, DWORD PTR 16[esp] | ||
100 | xor esi, edx | ||
101 | add ecx, esi | ||
102 | mov esi, edx | ||
103 | rol ebp, 10 | ||
104 | add ecx, edi | ||
105 | xor esi, ebp | ||
106 | rol ecx, 12 | ||
107 | add ecx, ebx | ||
108 | ; 4 | ||
109 | mov edi, DWORD PTR 20[esp] | ||
110 | xor esi, ecx | ||
111 | add ebx, edi | ||
112 | rol edx, 10 | ||
113 | add ebx, esi | ||
114 | mov esi, ecx | ||
115 | rol ebx, 5 | ||
116 | add ebx, eax | ||
117 | ; 5 | ||
118 | xor esi, edx | ||
119 | mov edi, DWORD PTR 24[esp] | ||
120 | xor esi, ebx | ||
121 | add eax, esi | ||
122 | mov esi, ebx | ||
123 | rol ecx, 10 | ||
124 | add eax, edi | ||
125 | xor esi, ecx | ||
126 | rol eax, 8 | ||
127 | add eax, ebp | ||
128 | ; 6 | ||
129 | mov edi, DWORD PTR 28[esp] | ||
130 | xor esi, eax | ||
131 | add ebp, edi | ||
132 | rol ebx, 10 | ||
133 | add ebp, esi | ||
134 | mov esi, eax | ||
135 | rol ebp, 7 | ||
136 | add ebp, edx | ||
137 | ; 7 | ||
138 | xor esi, ebx | ||
139 | mov edi, DWORD PTR 32[esp] | ||
140 | xor esi, ebp | ||
141 | add edx, esi | ||
142 | mov esi, ebp | ||
143 | rol eax, 10 | ||
144 | add edx, edi | ||
145 | xor esi, eax | ||
146 | rol edx, 9 | ||
147 | add edx, ecx | ||
148 | ; 8 | ||
149 | mov edi, DWORD PTR 36[esp] | ||
150 | xor esi, edx | ||
151 | add ecx, edi | ||
152 | rol ebp, 10 | ||
153 | add ecx, esi | ||
154 | mov esi, edx | ||
155 | rol ecx, 11 | ||
156 | add ecx, ebx | ||
157 | ; 9 | ||
158 | xor esi, ebp | ||
159 | mov edi, DWORD PTR 40[esp] | ||
160 | xor esi, ecx | ||
161 | add ebx, esi | ||
162 | mov esi, ecx | ||
163 | rol edx, 10 | ||
164 | add ebx, edi | ||
165 | xor esi, edx | ||
166 | rol ebx, 13 | ||
167 | add ebx, eax | ||
168 | ; 10 | ||
169 | mov edi, DWORD PTR 44[esp] | ||
170 | xor esi, ebx | ||
171 | add eax, edi | ||
172 | rol ecx, 10 | ||
173 | add eax, esi | ||
174 | mov esi, ebx | ||
175 | rol eax, 14 | ||
176 | add eax, ebp | ||
177 | ; 11 | ||
178 | xor esi, ecx | ||
179 | mov edi, DWORD PTR 48[esp] | ||
180 | xor esi, eax | ||
181 | add ebp, esi | ||
182 | mov esi, eax | ||
183 | rol ebx, 10 | ||
184 | add ebp, edi | ||
185 | xor esi, ebx | ||
186 | rol ebp, 15 | ||
187 | add ebp, edx | ||
188 | ; 12 | ||
189 | mov edi, DWORD PTR 52[esp] | ||
190 | xor esi, ebp | ||
191 | add edx, edi | ||
192 | rol eax, 10 | ||
193 | add edx, esi | ||
194 | mov esi, ebp | ||
195 | rol edx, 6 | ||
196 | add edx, ecx | ||
197 | ; 13 | ||
198 | xor esi, eax | ||
199 | mov edi, DWORD PTR 56[esp] | ||
200 | xor esi, edx | ||
201 | add ecx, esi | ||
202 | mov esi, edx | ||
203 | rol ebp, 10 | ||
204 | add ecx, edi | ||
205 | xor esi, ebp | ||
206 | rol ecx, 7 | ||
207 | add ecx, ebx | ||
208 | ; 14 | ||
209 | mov edi, DWORD PTR 60[esp] | ||
210 | xor esi, ecx | ||
211 | add ebx, edi | ||
212 | rol edx, 10 | ||
213 | add ebx, esi | ||
214 | mov esi, ecx | ||
215 | rol ebx, 9 | ||
216 | add ebx, eax | ||
217 | ; 15 | ||
218 | xor esi, edx | ||
219 | mov edi, DWORD PTR 64[esp] | ||
220 | xor esi, ebx | ||
221 | add eax, esi | ||
222 | mov esi, -1 | ||
223 | rol ecx, 10 | ||
224 | add eax, edi | ||
225 | mov edi, DWORD PTR 32[esp] | ||
226 | rol eax, 8 | ||
227 | add eax, ebp | ||
228 | ; 16 | ||
229 | add ebp, edi | ||
230 | mov edi, ebx | ||
231 | sub esi, eax | ||
232 | and edi, eax | ||
233 | and esi, ecx | ||
234 | or edi, esi | ||
235 | mov esi, DWORD PTR 20[esp] | ||
236 | rol ebx, 10 | ||
237 | lea ebp, DWORD PTR 1518500249[edi*1+ebp] | ||
238 | mov edi, -1 | ||
239 | rol ebp, 7 | ||
240 | add ebp, edx | ||
241 | ; 17 | ||
242 | add edx, esi | ||
243 | mov esi, eax | ||
244 | sub edi, ebp | ||
245 | and esi, ebp | ||
246 | and edi, ebx | ||
247 | or esi, edi | ||
248 | mov edi, DWORD PTR 56[esp] | ||
249 | rol eax, 10 | ||
250 | lea edx, DWORD PTR 1518500249[esi*1+edx] | ||
251 | mov esi, -1 | ||
252 | rol edx, 6 | ||
253 | add edx, ecx | ||
254 | ; 18 | ||
255 | add ecx, edi | ||
256 | mov edi, ebp | ||
257 | sub esi, edx | ||
258 | and edi, edx | ||
259 | and esi, eax | ||
260 | or edi, esi | ||
261 | mov esi, DWORD PTR 8[esp] | ||
262 | rol ebp, 10 | ||
263 | lea ecx, DWORD PTR 1518500249[edi*1+ecx] | ||
264 | mov edi, -1 | ||
265 | rol ecx, 8 | ||
266 | add ecx, ebx | ||
267 | ; 19 | ||
268 | add ebx, esi | ||
269 | mov esi, edx | ||
270 | sub edi, ecx | ||
271 | and esi, ecx | ||
272 | and edi, ebp | ||
273 | or esi, edi | ||
274 | mov edi, DWORD PTR 44[esp] | ||
275 | rol edx, 10 | ||
276 | lea ebx, DWORD PTR 1518500249[esi*1+ebx] | ||
277 | mov esi, -1 | ||
278 | rol ebx, 13 | ||
279 | add ebx, eax | ||
280 | ; 20 | ||
281 | add eax, edi | ||
282 | mov edi, ecx | ||
283 | sub esi, ebx | ||
284 | and edi, ebx | ||
285 | and esi, edx | ||
286 | or edi, esi | ||
287 | mov esi, DWORD PTR 28[esp] | ||
288 | rol ecx, 10 | ||
289 | lea eax, DWORD PTR 1518500249[edi*1+eax] | ||
290 | mov edi, -1 | ||
291 | rol eax, 11 | ||
292 | add eax, ebp | ||
293 | ; 21 | ||
294 | add ebp, esi | ||
295 | mov esi, ebx | ||
296 | sub edi, eax | ||
297 | and esi, eax | ||
298 | and edi, ecx | ||
299 | or esi, edi | ||
300 | mov edi, DWORD PTR 64[esp] | ||
301 | rol ebx, 10 | ||
302 | lea ebp, DWORD PTR 1518500249[esi*1+ebp] | ||
303 | mov esi, -1 | ||
304 | rol ebp, 9 | ||
305 | add ebp, edx | ||
306 | ; 22 | ||
307 | add edx, edi | ||
308 | mov edi, eax | ||
309 | sub esi, ebp | ||
310 | and edi, ebp | ||
311 | and esi, ebx | ||
312 | or edi, esi | ||
313 | mov esi, DWORD PTR 16[esp] | ||
314 | rol eax, 10 | ||
315 | lea edx, DWORD PTR 1518500249[edi*1+edx] | ||
316 | mov edi, -1 | ||
317 | rol edx, 7 | ||
318 | add edx, ecx | ||
319 | ; 23 | ||
320 | add ecx, esi | ||
321 | mov esi, ebp | ||
322 | sub edi, edx | ||
323 | and esi, edx | ||
324 | and edi, eax | ||
325 | or esi, edi | ||
326 | mov edi, DWORD PTR 52[esp] | ||
327 | rol ebp, 10 | ||
328 | lea ecx, DWORD PTR 1518500249[esi*1+ecx] | ||
329 | mov esi, -1 | ||
330 | rol ecx, 15 | ||
331 | add ecx, ebx | ||
332 | ; 24 | ||
333 | add ebx, edi | ||
334 | mov edi, edx | ||
335 | sub esi, ecx | ||
336 | and edi, ecx | ||
337 | and esi, ebp | ||
338 | or edi, esi | ||
339 | mov esi, DWORD PTR 4[esp] | ||
340 | rol edx, 10 | ||
341 | lea ebx, DWORD PTR 1518500249[edi*1+ebx] | ||
342 | mov edi, -1 | ||
343 | rol ebx, 7 | ||
344 | add ebx, eax | ||
345 | ; 25 | ||
346 | add eax, esi | ||
347 | mov esi, ecx | ||
348 | sub edi, ebx | ||
349 | and esi, ebx | ||
350 | and edi, edx | ||
351 | or esi, edi | ||
352 | mov edi, DWORD PTR 40[esp] | ||
353 | rol ecx, 10 | ||
354 | lea eax, DWORD PTR 1518500249[esi*1+eax] | ||
355 | mov esi, -1 | ||
356 | rol eax, 12 | ||
357 | add eax, ebp | ||
358 | ; 26 | ||
359 | add ebp, edi | ||
360 | mov edi, ebx | ||
361 | sub esi, eax | ||
362 | and edi, eax | ||
363 | and esi, ecx | ||
364 | or edi, esi | ||
365 | mov esi, DWORD PTR 24[esp] | ||
366 | rol ebx, 10 | ||
367 | lea ebp, DWORD PTR 1518500249[edi*1+ebp] | ||
368 | mov edi, -1 | ||
369 | rol ebp, 15 | ||
370 | add ebp, edx | ||
371 | ; 27 | ||
372 | add edx, esi | ||
373 | mov esi, eax | ||
374 | sub edi, ebp | ||
375 | and esi, ebp | ||
376 | and edi, ebx | ||
377 | or esi, edi | ||
378 | mov edi, DWORD PTR 12[esp] | ||
379 | rol eax, 10 | ||
380 | lea edx, DWORD PTR 1518500249[esi*1+edx] | ||
381 | mov esi, -1 | ||
382 | rol edx, 9 | ||
383 | add edx, ecx | ||
384 | ; 28 | ||
385 | add ecx, edi | ||
386 | mov edi, ebp | ||
387 | sub esi, edx | ||
388 | and edi, edx | ||
389 | and esi, eax | ||
390 | or edi, esi | ||
391 | mov esi, DWORD PTR 60[esp] | ||
392 | rol ebp, 10 | ||
393 | lea ecx, DWORD PTR 1518500249[edi*1+ecx] | ||
394 | mov edi, -1 | ||
395 | rol ecx, 11 | ||
396 | add ecx, ebx | ||
397 | ; 29 | ||
398 | add ebx, esi | ||
399 | mov esi, edx | ||
400 | sub edi, ecx | ||
401 | and esi, ecx | ||
402 | and edi, ebp | ||
403 | or esi, edi | ||
404 | mov edi, DWORD PTR 48[esp] | ||
405 | rol edx, 10 | ||
406 | lea ebx, DWORD PTR 1518500249[esi*1+ebx] | ||
407 | mov esi, -1 | ||
408 | rol ebx, 7 | ||
409 | add ebx, eax | ||
410 | ; 30 | ||
411 | add eax, edi | ||
412 | mov edi, ecx | ||
413 | sub esi, ebx | ||
414 | and edi, ebx | ||
415 | and esi, edx | ||
416 | or edi, esi | ||
417 | mov esi, DWORD PTR 36[esp] | ||
418 | rol ecx, 10 | ||
419 | lea eax, DWORD PTR 1518500249[edi*1+eax] | ||
420 | mov edi, -1 | ||
421 | rol eax, 13 | ||
422 | add eax, ebp | ||
423 | ; 31 | ||
424 | add ebp, esi | ||
425 | mov esi, ebx | ||
426 | sub edi, eax | ||
427 | and esi, eax | ||
428 | and edi, ecx | ||
429 | or esi, edi | ||
430 | mov edi, -1 | ||
431 | rol ebx, 10 | ||
432 | lea ebp, DWORD PTR 1518500249[esi*1+ebp] | ||
433 | sub edi, eax | ||
434 | rol ebp, 12 | ||
435 | add ebp, edx | ||
436 | ; 32 | ||
437 | mov esi, DWORD PTR 16[esp] | ||
438 | or edi, ebp | ||
439 | add edx, esi | ||
440 | xor edi, ebx | ||
441 | mov esi, -1 | ||
442 | rol eax, 10 | ||
443 | lea edx, DWORD PTR 1859775393[edi*1+edx] | ||
444 | sub esi, ebp | ||
445 | rol edx, 11 | ||
446 | add edx, ecx | ||
447 | ; 33 | ||
448 | mov edi, DWORD PTR 44[esp] | ||
449 | or esi, edx | ||
450 | add ecx, edi | ||
451 | xor esi, eax | ||
452 | mov edi, -1 | ||
453 | rol ebp, 10 | ||
454 | lea ecx, DWORD PTR 1859775393[esi*1+ecx] | ||
455 | sub edi, edx | ||
456 | rol ecx, 13 | ||
457 | add ecx, ebx | ||
458 | ; 34 | ||
459 | mov esi, DWORD PTR 60[esp] | ||
460 | or edi, ecx | ||
461 | add ebx, esi | ||
462 | xor edi, ebp | ||
463 | mov esi, -1 | ||
464 | rol edx, 10 | ||
465 | lea ebx, DWORD PTR 1859775393[edi*1+ebx] | ||
466 | sub esi, ecx | ||
467 | rol ebx, 6 | ||
468 | add ebx, eax | ||
469 | ; 35 | ||
470 | mov edi, DWORD PTR 20[esp] | ||
471 | or esi, ebx | ||
472 | add eax, edi | ||
473 | xor esi, edx | ||
474 | mov edi, -1 | ||
475 | rol ecx, 10 | ||
476 | lea eax, DWORD PTR 1859775393[esi*1+eax] | ||
477 | sub edi, ebx | ||
478 | rol eax, 7 | ||
479 | add eax, ebp | ||
480 | ; 36 | ||
481 | mov esi, DWORD PTR 40[esp] | ||
482 | or edi, eax | ||
483 | add ebp, esi | ||
484 | xor edi, ecx | ||
485 | mov esi, -1 | ||
486 | rol ebx, 10 | ||
487 | lea ebp, DWORD PTR 1859775393[edi*1+ebp] | ||
488 | sub esi, eax | ||
489 | rol ebp, 14 | ||
490 | add ebp, edx | ||
491 | ; 37 | ||
492 | mov edi, DWORD PTR 64[esp] | ||
493 | or esi, ebp | ||
494 | add edx, edi | ||
495 | xor esi, ebx | ||
496 | mov edi, -1 | ||
497 | rol eax, 10 | ||
498 | lea edx, DWORD PTR 1859775393[esi*1+edx] | ||
499 | sub edi, ebp | ||
500 | rol edx, 9 | ||
501 | add edx, ecx | ||
502 | ; 38 | ||
503 | mov esi, DWORD PTR 36[esp] | ||
504 | or edi, edx | ||
505 | add ecx, esi | ||
506 | xor edi, eax | ||
507 | mov esi, -1 | ||
508 | rol ebp, 10 | ||
509 | lea ecx, DWORD PTR 1859775393[edi*1+ecx] | ||
510 | sub esi, edx | ||
511 | rol ecx, 13 | ||
512 | add ecx, ebx | ||
513 | ; 39 | ||
514 | mov edi, DWORD PTR 8[esp] | ||
515 | or esi, ecx | ||
516 | add ebx, edi | ||
517 | xor esi, ebp | ||
518 | mov edi, -1 | ||
519 | rol edx, 10 | ||
520 | lea ebx, DWORD PTR 1859775393[esi*1+ebx] | ||
521 | sub edi, ecx | ||
522 | rol ebx, 15 | ||
523 | add ebx, eax | ||
524 | ; 40 | ||
525 | mov esi, DWORD PTR 12[esp] | ||
526 | or edi, ebx | ||
527 | add eax, esi | ||
528 | xor edi, edx | ||
529 | mov esi, -1 | ||
530 | rol ecx, 10 | ||
531 | lea eax, DWORD PTR 1859775393[edi*1+eax] | ||
532 | sub esi, ebx | ||
533 | rol eax, 14 | ||
534 | add eax, ebp | ||
535 | ; 41 | ||
536 | mov edi, DWORD PTR 32[esp] | ||
537 | or esi, eax | ||
538 | add ebp, edi | ||
539 | xor esi, ecx | ||
540 | mov edi, -1 | ||
541 | rol ebx, 10 | ||
542 | lea ebp, DWORD PTR 1859775393[esi*1+ebp] | ||
543 | sub edi, eax | ||
544 | rol ebp, 8 | ||
545 | add ebp, edx | ||
546 | ; 42 | ||
547 | mov esi, DWORD PTR 4[esp] | ||
548 | or edi, ebp | ||
549 | add edx, esi | ||
550 | xor edi, ebx | ||
551 | mov esi, -1 | ||
552 | rol eax, 10 | ||
553 | lea edx, DWORD PTR 1859775393[edi*1+edx] | ||
554 | sub esi, ebp | ||
555 | rol edx, 13 | ||
556 | add edx, ecx | ||
557 | ; 43 | ||
558 | mov edi, DWORD PTR 28[esp] | ||
559 | or esi, edx | ||
560 | add ecx, edi | ||
561 | xor esi, eax | ||
562 | mov edi, -1 | ||
563 | rol ebp, 10 | ||
564 | lea ecx, DWORD PTR 1859775393[esi*1+ecx] | ||
565 | sub edi, edx | ||
566 | rol ecx, 6 | ||
567 | add ecx, ebx | ||
568 | ; 44 | ||
569 | mov esi, DWORD PTR 56[esp] | ||
570 | or edi, ecx | ||
571 | add ebx, esi | ||
572 | xor edi, ebp | ||
573 | mov esi, -1 | ||
574 | rol edx, 10 | ||
575 | lea ebx, DWORD PTR 1859775393[edi*1+ebx] | ||
576 | sub esi, ecx | ||
577 | rol ebx, 5 | ||
578 | add ebx, eax | ||
579 | ; 45 | ||
580 | mov edi, DWORD PTR 48[esp] | ||
581 | or esi, ebx | ||
582 | add eax, edi | ||
583 | xor esi, edx | ||
584 | mov edi, -1 | ||
585 | rol ecx, 10 | ||
586 | lea eax, DWORD PTR 1859775393[esi*1+eax] | ||
587 | sub edi, ebx | ||
588 | rol eax, 12 | ||
589 | add eax, ebp | ||
590 | ; 46 | ||
591 | mov esi, DWORD PTR 24[esp] | ||
592 | or edi, eax | ||
593 | add ebp, esi | ||
594 | xor edi, ecx | ||
595 | mov esi, -1 | ||
596 | rol ebx, 10 | ||
597 | lea ebp, DWORD PTR 1859775393[edi*1+ebp] | ||
598 | sub esi, eax | ||
599 | rol ebp, 7 | ||
600 | add ebp, edx | ||
601 | ; 47 | ||
602 | mov edi, DWORD PTR 52[esp] | ||
603 | or esi, ebp | ||
604 | add edx, edi | ||
605 | xor esi, ebx | ||
606 | mov edi, -1 | ||
607 | rol eax, 10 | ||
608 | lea edx, DWORD PTR 1859775393[esi*1+edx] | ||
609 | mov esi, eax | ||
610 | rol edx, 5 | ||
611 | add edx, ecx | ||
612 | ; 48 | ||
613 | sub edi, eax | ||
614 | and esi, edx | ||
615 | and edi, ebp | ||
616 | or edi, esi | ||
617 | mov esi, DWORD PTR 8[esp] | ||
618 | rol ebp, 10 | ||
619 | lea ecx, DWORD PTR 2400959708[edi+ecx] | ||
620 | mov edi, -1 | ||
621 | add ecx, esi | ||
622 | mov esi, ebp | ||
623 | rol ecx, 11 | ||
624 | add ecx, ebx | ||
625 | ; 49 | ||
626 | sub edi, ebp | ||
627 | and esi, ecx | ||
628 | and edi, edx | ||
629 | or edi, esi | ||
630 | mov esi, DWORD PTR 40[esp] | ||
631 | rol edx, 10 | ||
632 | lea ebx, DWORD PTR 2400959708[edi+ebx] | ||
633 | mov edi, -1 | ||
634 | add ebx, esi | ||
635 | mov esi, edx | ||
636 | rol ebx, 12 | ||
637 | add ebx, eax | ||
638 | ; 50 | ||
639 | sub edi, edx | ||
640 | and esi, ebx | ||
641 | and edi, ecx | ||
642 | or edi, esi | ||
643 | mov esi, DWORD PTR 48[esp] | ||
644 | rol ecx, 10 | ||
645 | lea eax, DWORD PTR 2400959708[edi+eax] | ||
646 | mov edi, -1 | ||
647 | add eax, esi | ||
648 | mov esi, ecx | ||
649 | rol eax, 14 | ||
650 | add eax, ebp | ||
651 | ; 51 | ||
652 | sub edi, ecx | ||
653 | and esi, eax | ||
654 | and edi, ebx | ||
655 | or edi, esi | ||
656 | mov esi, DWORD PTR 44[esp] | ||
657 | rol ebx, 10 | ||
658 | lea ebp, DWORD PTR 2400959708[edi+ebp] | ||
659 | mov edi, -1 | ||
660 | add ebp, esi | ||
661 | mov esi, ebx | ||
662 | rol ebp, 15 | ||
663 | add ebp, edx | ||
664 | ; 52 | ||
665 | sub edi, ebx | ||
666 | and esi, ebp | ||
667 | and edi, eax | ||
668 | or edi, esi | ||
669 | mov esi, DWORD PTR 4[esp] | ||
670 | rol eax, 10 | ||
671 | lea edx, DWORD PTR 2400959708[edi+edx] | ||
672 | mov edi, -1 | ||
673 | add edx, esi | ||
674 | mov esi, eax | ||
675 | rol edx, 14 | ||
676 | add edx, ecx | ||
677 | ; 53 | ||
678 | sub edi, eax | ||
679 | and esi, edx | ||
680 | and edi, ebp | ||
681 | or edi, esi | ||
682 | mov esi, DWORD PTR 36[esp] | ||
683 | rol ebp, 10 | ||
684 | lea ecx, DWORD PTR 2400959708[edi+ecx] | ||
685 | mov edi, -1 | ||
686 | add ecx, esi | ||
687 | mov esi, ebp | ||
688 | rol ecx, 15 | ||
689 | add ecx, ebx | ||
690 | ; 54 | ||
691 | sub edi, ebp | ||
692 | and esi, ecx | ||
693 | and edi, edx | ||
694 | or edi, esi | ||
695 | mov esi, DWORD PTR 52[esp] | ||
696 | rol edx, 10 | ||
697 | lea ebx, DWORD PTR 2400959708[edi+ebx] | ||
698 | mov edi, -1 | ||
699 | add ebx, esi | ||
700 | mov esi, edx | ||
701 | rol ebx, 9 | ||
702 | add ebx, eax | ||
703 | ; 55 | ||
704 | sub edi, edx | ||
705 | and esi, ebx | ||
706 | and edi, ecx | ||
707 | or edi, esi | ||
708 | mov esi, DWORD PTR 20[esp] | ||
709 | rol ecx, 10 | ||
710 | lea eax, DWORD PTR 2400959708[edi+eax] | ||
711 | mov edi, -1 | ||
712 | add eax, esi | ||
713 | mov esi, ecx | ||
714 | rol eax, 8 | ||
715 | add eax, ebp | ||
716 | ; 56 | ||
717 | sub edi, ecx | ||
718 | and esi, eax | ||
719 | and edi, ebx | ||
720 | or edi, esi | ||
721 | mov esi, DWORD PTR 56[esp] | ||
722 | rol ebx, 10 | ||
723 | lea ebp, DWORD PTR 2400959708[edi+ebp] | ||
724 | mov edi, -1 | ||
725 | add ebp, esi | ||
726 | mov esi, ebx | ||
727 | rol ebp, 9 | ||
728 | add ebp, edx | ||
729 | ; 57 | ||
730 | sub edi, ebx | ||
731 | and esi, ebp | ||
732 | and edi, eax | ||
733 | or edi, esi | ||
734 | mov esi, DWORD PTR 16[esp] | ||
735 | rol eax, 10 | ||
736 | lea edx, DWORD PTR 2400959708[edi+edx] | ||
737 | mov edi, -1 | ||
738 | add edx, esi | ||
739 | mov esi, eax | ||
740 | rol edx, 14 | ||
741 | add edx, ecx | ||
742 | ; 58 | ||
743 | sub edi, eax | ||
744 | and esi, edx | ||
745 | and edi, ebp | ||
746 | or edi, esi | ||
747 | mov esi, DWORD PTR 32[esp] | ||
748 | rol ebp, 10 | ||
749 | lea ecx, DWORD PTR 2400959708[edi+ecx] | ||
750 | mov edi, -1 | ||
751 | add ecx, esi | ||
752 | mov esi, ebp | ||
753 | rol ecx, 5 | ||
754 | add ecx, ebx | ||
755 | ; 59 | ||
756 | sub edi, ebp | ||
757 | and esi, ecx | ||
758 | and edi, edx | ||
759 | or edi, esi | ||
760 | mov esi, DWORD PTR 64[esp] | ||
761 | rol edx, 10 | ||
762 | lea ebx, DWORD PTR 2400959708[edi+ebx] | ||
763 | mov edi, -1 | ||
764 | add ebx, esi | ||
765 | mov esi, edx | ||
766 | rol ebx, 6 | ||
767 | add ebx, eax | ||
768 | ; 60 | ||
769 | sub edi, edx | ||
770 | and esi, ebx | ||
771 | and edi, ecx | ||
772 | or edi, esi | ||
773 | mov esi, DWORD PTR 60[esp] | ||
774 | rol ecx, 10 | ||
775 | lea eax, DWORD PTR 2400959708[edi+eax] | ||
776 | mov edi, -1 | ||
777 | add eax, esi | ||
778 | mov esi, ecx | ||
779 | rol eax, 8 | ||
780 | add eax, ebp | ||
781 | ; 61 | ||
782 | sub edi, ecx | ||
783 | and esi, eax | ||
784 | and edi, ebx | ||
785 | or edi, esi | ||
786 | mov esi, DWORD PTR 24[esp] | ||
787 | rol ebx, 10 | ||
788 | lea ebp, DWORD PTR 2400959708[edi+ebp] | ||
789 | mov edi, -1 | ||
790 | add ebp, esi | ||
791 | mov esi, ebx | ||
792 | rol ebp, 6 | ||
793 | add ebp, edx | ||
794 | ; 62 | ||
795 | sub edi, ebx | ||
796 | and esi, ebp | ||
797 | and edi, eax | ||
798 | or edi, esi | ||
799 | mov esi, DWORD PTR 28[esp] | ||
800 | rol eax, 10 | ||
801 | lea edx, DWORD PTR 2400959708[edi+edx] | ||
802 | mov edi, -1 | ||
803 | add edx, esi | ||
804 | mov esi, eax | ||
805 | rol edx, 5 | ||
806 | add edx, ecx | ||
807 | ; 63 | ||
808 | sub edi, eax | ||
809 | and esi, edx | ||
810 | and edi, ebp | ||
811 | or edi, esi | ||
812 | mov esi, DWORD PTR 12[esp] | ||
813 | rol ebp, 10 | ||
814 | lea ecx, DWORD PTR 2400959708[edi+ecx] | ||
815 | mov edi, -1 | ||
816 | add ecx, esi | ||
817 | sub edi, ebp | ||
818 | rol ecx, 12 | ||
819 | add ecx, ebx | ||
820 | ; 64 | ||
821 | mov esi, DWORD PTR 20[esp] | ||
822 | or edi, edx | ||
823 | add ebx, esi | ||
824 | xor edi, ecx | ||
825 | mov esi, -1 | ||
826 | rol edx, 10 | ||
827 | lea ebx, DWORD PTR 2840853838[edi*1+ebx] | ||
828 | sub esi, edx | ||
829 | rol ebx, 9 | ||
830 | add ebx, eax | ||
831 | ; 65 | ||
832 | mov edi, DWORD PTR 4[esp] | ||
833 | or esi, ecx | ||
834 | add eax, edi | ||
835 | xor esi, ebx | ||
836 | mov edi, -1 | ||
837 | rol ecx, 10 | ||
838 | lea eax, DWORD PTR 2840853838[esi*1+eax] | ||
839 | sub edi, ecx | ||
840 | rol eax, 15 | ||
841 | add eax, ebp | ||
842 | ; 66 | ||
843 | mov esi, DWORD PTR 24[esp] | ||
844 | or edi, ebx | ||
845 | add ebp, esi | ||
846 | xor edi, eax | ||
847 | mov esi, -1 | ||
848 | rol ebx, 10 | ||
849 | lea ebp, DWORD PTR 2840853838[edi*1+ebp] | ||
850 | sub esi, ebx | ||
851 | rol ebp, 5 | ||
852 | add ebp, edx | ||
853 | ; 67 | ||
854 | mov edi, DWORD PTR 40[esp] | ||
855 | or esi, eax | ||
856 | add edx, edi | ||
857 | xor esi, ebp | ||
858 | mov edi, -1 | ||
859 | rol eax, 10 | ||
860 | lea edx, DWORD PTR 2840853838[esi*1+edx] | ||
861 | sub edi, eax | ||
862 | rol edx, 11 | ||
863 | add edx, ecx | ||
864 | ; 68 | ||
865 | mov esi, DWORD PTR 32[esp] | ||
866 | or edi, ebp | ||
867 | add ecx, esi | ||
868 | xor edi, edx | ||
869 | mov esi, -1 | ||
870 | rol ebp, 10 | ||
871 | lea ecx, DWORD PTR 2840853838[edi*1+ecx] | ||
872 | sub esi, ebp | ||
873 | rol ecx, 6 | ||
874 | add ecx, ebx | ||
875 | ; 69 | ||
876 | mov edi, DWORD PTR 52[esp] | ||
877 | or esi, edx | ||
878 | add ebx, edi | ||
879 | xor esi, ecx | ||
880 | mov edi, -1 | ||
881 | rol edx, 10 | ||
882 | lea ebx, DWORD PTR 2840853838[esi*1+ebx] | ||
883 | sub edi, edx | ||
884 | rol ebx, 8 | ||
885 | add ebx, eax | ||
886 | ; 70 | ||
887 | mov esi, DWORD PTR 12[esp] | ||
888 | or edi, ecx | ||
889 | add eax, esi | ||
890 | xor edi, ebx | ||
891 | mov esi, -1 | ||
892 | rol ecx, 10 | ||
893 | lea eax, DWORD PTR 2840853838[edi*1+eax] | ||
894 | sub esi, ecx | ||
895 | rol eax, 13 | ||
896 | add eax, ebp | ||
897 | ; 71 | ||
898 | mov edi, DWORD PTR 44[esp] | ||
899 | or esi, ebx | ||
900 | add ebp, edi | ||
901 | xor esi, eax | ||
902 | mov edi, -1 | ||
903 | rol ebx, 10 | ||
904 | lea ebp, DWORD PTR 2840853838[esi*1+ebp] | ||
905 | sub edi, ebx | ||
906 | rol ebp, 12 | ||
907 | add ebp, edx | ||
908 | ; 72 | ||
909 | mov esi, DWORD PTR 60[esp] | ||
910 | or edi, eax | ||
911 | add edx, esi | ||
912 | xor edi, ebp | ||
913 | mov esi, -1 | ||
914 | rol eax, 10 | ||
915 | lea edx, DWORD PTR 2840853838[edi*1+edx] | ||
916 | sub esi, eax | ||
917 | rol edx, 5 | ||
918 | add edx, ecx | ||
919 | ; 73 | ||
920 | mov edi, DWORD PTR 8[esp] | ||
921 | or esi, ebp | ||
922 | add ecx, edi | ||
923 | xor esi, edx | ||
924 | mov edi, -1 | ||
925 | rol ebp, 10 | ||
926 | lea ecx, DWORD PTR 2840853838[esi*1+ecx] | ||
927 | sub edi, ebp | ||
928 | rol ecx, 12 | ||
929 | add ecx, ebx | ||
930 | ; 74 | ||
931 | mov esi, DWORD PTR 16[esp] | ||
932 | or edi, edx | ||
933 | add ebx, esi | ||
934 | xor edi, ecx | ||
935 | mov esi, -1 | ||
936 | rol edx, 10 | ||
937 | lea ebx, DWORD PTR 2840853838[edi*1+ebx] | ||
938 | sub esi, edx | ||
939 | rol ebx, 13 | ||
940 | add ebx, eax | ||
941 | ; 75 | ||
942 | mov edi, DWORD PTR 36[esp] | ||
943 | or esi, ecx | ||
944 | add eax, edi | ||
945 | xor esi, ebx | ||
946 | mov edi, -1 | ||
947 | rol ecx, 10 | ||
948 | lea eax, DWORD PTR 2840853838[esi*1+eax] | ||
949 | sub edi, ecx | ||
950 | rol eax, 14 | ||
951 | add eax, ebp | ||
952 | ; 76 | ||
953 | mov esi, DWORD PTR 48[esp] | ||
954 | or edi, ebx | ||
955 | add ebp, esi | ||
956 | xor edi, eax | ||
957 | mov esi, -1 | ||
958 | rol ebx, 10 | ||
959 | lea ebp, DWORD PTR 2840853838[edi*1+ebp] | ||
960 | sub esi, ebx | ||
961 | rol ebp, 11 | ||
962 | add ebp, edx | ||
963 | ; 77 | ||
964 | mov edi, DWORD PTR 28[esp] | ||
965 | or esi, eax | ||
966 | add edx, edi | ||
967 | xor esi, ebp | ||
968 | mov edi, -1 | ||
969 | rol eax, 10 | ||
970 | lea edx, DWORD PTR 2840853838[esi*1+edx] | ||
971 | sub edi, eax | ||
972 | rol edx, 8 | ||
973 | add edx, ecx | ||
974 | ; 78 | ||
975 | mov esi, DWORD PTR 64[esp] | ||
976 | or edi, ebp | ||
977 | add ecx, esi | ||
978 | xor edi, edx | ||
979 | mov esi, -1 | ||
980 | rol ebp, 10 | ||
981 | lea ecx, DWORD PTR 2840853838[edi*1+ecx] | ||
982 | sub esi, ebp | ||
983 | rol ecx, 5 | ||
984 | add ecx, ebx | ||
985 | ; 79 | ||
986 | mov edi, DWORD PTR 56[esp] | ||
987 | or esi, edx | ||
988 | add ebx, edi | ||
989 | xor esi, ecx | ||
990 | mov edi, DWORD PTR 108[esp] | ||
991 | rol edx, 10 | ||
992 | lea ebx, DWORD PTR 2840853838[esi*1+ebx] | ||
993 | mov DWORD PTR 68[esp],eax | ||
994 | rol ebx, 6 | ||
995 | add ebx, eax | ||
996 | mov eax, DWORD PTR [edi] | ||
997 | mov DWORD PTR 72[esp],ebx | ||
998 | mov DWORD PTR 76[esp],ecx | ||
999 | mov ebx, DWORD PTR 4[edi] | ||
1000 | mov DWORD PTR 80[esp],edx | ||
1001 | mov ecx, DWORD PTR 8[edi] | ||
1002 | mov DWORD PTR 84[esp],ebp | ||
1003 | mov edx, DWORD PTR 12[edi] | ||
1004 | mov ebp, DWORD PTR 16[edi] | ||
1005 | ; 80 | ||
1006 | mov edi, -1 | ||
1007 | sub edi, edx | ||
1008 | mov esi, DWORD PTR 24[esp] | ||
1009 | or edi, ecx | ||
1010 | add eax, esi | ||
1011 | xor edi, ebx | ||
1012 | mov esi, -1 | ||
1013 | rol ecx, 10 | ||
1014 | lea eax, DWORD PTR 1352829926[edi*1+eax] | ||
1015 | sub esi, ecx | ||
1016 | rol eax, 8 | ||
1017 | add eax, ebp | ||
1018 | ; 81 | ||
1019 | mov edi, DWORD PTR 60[esp] | ||
1020 | or esi, ebx | ||
1021 | add ebp, edi | ||
1022 | xor esi, eax | ||
1023 | mov edi, -1 | ||
1024 | rol ebx, 10 | ||
1025 | lea ebp, DWORD PTR 1352829926[esi*1+ebp] | ||
1026 | sub edi, ebx | ||
1027 | rol ebp, 9 | ||
1028 | add ebp, edx | ||
1029 | ; 82 | ||
1030 | mov esi, DWORD PTR 32[esp] | ||
1031 | or edi, eax | ||
1032 | add edx, esi | ||
1033 | xor edi, ebp | ||
1034 | mov esi, -1 | ||
1035 | rol eax, 10 | ||
1036 | lea edx, DWORD PTR 1352829926[edi*1+edx] | ||
1037 | sub esi, eax | ||
1038 | rol edx, 9 | ||
1039 | add edx, ecx | ||
1040 | ; 83 | ||
1041 | mov edi, DWORD PTR 4[esp] | ||
1042 | or esi, ebp | ||
1043 | add ecx, edi | ||
1044 | xor esi, edx | ||
1045 | mov edi, -1 | ||
1046 | rol ebp, 10 | ||
1047 | lea ecx, DWORD PTR 1352829926[esi*1+ecx] | ||
1048 | sub edi, ebp | ||
1049 | rol ecx, 11 | ||
1050 | add ecx, ebx | ||
1051 | ; 84 | ||
1052 | mov esi, DWORD PTR 40[esp] | ||
1053 | or edi, edx | ||
1054 | add ebx, esi | ||
1055 | xor edi, ecx | ||
1056 | mov esi, -1 | ||
1057 | rol edx, 10 | ||
1058 | lea ebx, DWORD PTR 1352829926[edi*1+ebx] | ||
1059 | sub esi, edx | ||
1060 | rol ebx, 13 | ||
1061 | add ebx, eax | ||
1062 | ; 85 | ||
1063 | mov edi, DWORD PTR 12[esp] | ||
1064 | or esi, ecx | ||
1065 | add eax, edi | ||
1066 | xor esi, ebx | ||
1067 | mov edi, -1 | ||
1068 | rol ecx, 10 | ||
1069 | lea eax, DWORD PTR 1352829926[esi*1+eax] | ||
1070 | sub edi, ecx | ||
1071 | rol eax, 15 | ||
1072 | add eax, ebp | ||
1073 | ; 86 | ||
1074 | mov esi, DWORD PTR 48[esp] | ||
1075 | or edi, ebx | ||
1076 | add ebp, esi | ||
1077 | xor edi, eax | ||
1078 | mov esi, -1 | ||
1079 | rol ebx, 10 | ||
1080 | lea ebp, DWORD PTR 1352829926[edi*1+ebp] | ||
1081 | sub esi, ebx | ||
1082 | rol ebp, 15 | ||
1083 | add ebp, edx | ||
1084 | ; 87 | ||
1085 | mov edi, DWORD PTR 20[esp] | ||
1086 | or esi, eax | ||
1087 | add edx, edi | ||
1088 | xor esi, ebp | ||
1089 | mov edi, -1 | ||
1090 | rol eax, 10 | ||
1091 | lea edx, DWORD PTR 1352829926[esi*1+edx] | ||
1092 | sub edi, eax | ||
1093 | rol edx, 5 | ||
1094 | add edx, ecx | ||
1095 | ; 88 | ||
1096 | mov esi, DWORD PTR 56[esp] | ||
1097 | or edi, ebp | ||
1098 | add ecx, esi | ||
1099 | xor edi, edx | ||
1100 | mov esi, -1 | ||
1101 | rol ebp, 10 | ||
1102 | lea ecx, DWORD PTR 1352829926[edi*1+ecx] | ||
1103 | sub esi, ebp | ||
1104 | rol ecx, 7 | ||
1105 | add ecx, ebx | ||
1106 | ; 89 | ||
1107 | mov edi, DWORD PTR 28[esp] | ||
1108 | or esi, edx | ||
1109 | add ebx, edi | ||
1110 | xor esi, ecx | ||
1111 | mov edi, -1 | ||
1112 | rol edx, 10 | ||
1113 | lea ebx, DWORD PTR 1352829926[esi*1+ebx] | ||
1114 | sub edi, edx | ||
1115 | rol ebx, 7 | ||
1116 | add ebx, eax | ||
1117 | ; 90 | ||
1118 | mov esi, DWORD PTR 64[esp] | ||
1119 | or edi, ecx | ||
1120 | add eax, esi | ||
1121 | xor edi, ebx | ||
1122 | mov esi, -1 | ||
1123 | rol ecx, 10 | ||
1124 | lea eax, DWORD PTR 1352829926[edi*1+eax] | ||
1125 | sub esi, ecx | ||
1126 | rol eax, 8 | ||
1127 | add eax, ebp | ||
1128 | ; 91 | ||
1129 | mov edi, DWORD PTR 36[esp] | ||
1130 | or esi, ebx | ||
1131 | add ebp, edi | ||
1132 | xor esi, eax | ||
1133 | mov edi, -1 | ||
1134 | rol ebx, 10 | ||
1135 | lea ebp, DWORD PTR 1352829926[esi*1+ebp] | ||
1136 | sub edi, ebx | ||
1137 | rol ebp, 11 | ||
1138 | add ebp, edx | ||
1139 | ; 92 | ||
1140 | mov esi, DWORD PTR 8[esp] | ||
1141 | or edi, eax | ||
1142 | add edx, esi | ||
1143 | xor edi, ebp | ||
1144 | mov esi, -1 | ||
1145 | rol eax, 10 | ||
1146 | lea edx, DWORD PTR 1352829926[edi*1+edx] | ||
1147 | sub esi, eax | ||
1148 | rol edx, 14 | ||
1149 | add edx, ecx | ||
1150 | ; 93 | ||
1151 | mov edi, DWORD PTR 44[esp] | ||
1152 | or esi, ebp | ||
1153 | add ecx, edi | ||
1154 | xor esi, edx | ||
1155 | mov edi, -1 | ||
1156 | rol ebp, 10 | ||
1157 | lea ecx, DWORD PTR 1352829926[esi*1+ecx] | ||
1158 | sub edi, ebp | ||
1159 | rol ecx, 14 | ||
1160 | add ecx, ebx | ||
1161 | ; 94 | ||
1162 | mov esi, DWORD PTR 16[esp] | ||
1163 | or edi, edx | ||
1164 | add ebx, esi | ||
1165 | xor edi, ecx | ||
1166 | mov esi, -1 | ||
1167 | rol edx, 10 | ||
1168 | lea ebx, DWORD PTR 1352829926[edi*1+ebx] | ||
1169 | sub esi, edx | ||
1170 | rol ebx, 12 | ||
1171 | add ebx, eax | ||
1172 | ; 95 | ||
1173 | mov edi, DWORD PTR 52[esp] | ||
1174 | or esi, ecx | ||
1175 | add eax, edi | ||
1176 | xor esi, ebx | ||
1177 | mov edi, -1 | ||
1178 | rol ecx, 10 | ||
1179 | lea eax, DWORD PTR 1352829926[esi*1+eax] | ||
1180 | mov esi, ecx | ||
1181 | rol eax, 6 | ||
1182 | add eax, ebp | ||
1183 | ; 96 | ||
1184 | sub edi, ecx | ||
1185 | and esi, eax | ||
1186 | and edi, ebx | ||
1187 | or edi, esi | ||
1188 | mov esi, DWORD PTR 28[esp] | ||
1189 | rol ebx, 10 | ||
1190 | lea ebp, DWORD PTR 1548603684[edi+ebp] | ||
1191 | mov edi, -1 | ||
1192 | add ebp, esi | ||
1193 | mov esi, ebx | ||
1194 | rol ebp, 9 | ||
1195 | add ebp, edx | ||
1196 | ; 97 | ||
1197 | sub edi, ebx | ||
1198 | and esi, ebp | ||
1199 | and edi, eax | ||
1200 | or edi, esi | ||
1201 | mov esi, DWORD PTR 48[esp] | ||
1202 | rol eax, 10 | ||
1203 | lea edx, DWORD PTR 1548603684[edi+edx] | ||
1204 | mov edi, -1 | ||
1205 | add edx, esi | ||
1206 | mov esi, eax | ||
1207 | rol edx, 13 | ||
1208 | add edx, ecx | ||
1209 | ; 98 | ||
1210 | sub edi, eax | ||
1211 | and esi, edx | ||
1212 | and edi, ebp | ||
1213 | or edi, esi | ||
1214 | mov esi, DWORD PTR 16[esp] | ||
1215 | rol ebp, 10 | ||
1216 | lea ecx, DWORD PTR 1548603684[edi+ecx] | ||
1217 | mov edi, -1 | ||
1218 | add ecx, esi | ||
1219 | mov esi, ebp | ||
1220 | rol ecx, 15 | ||
1221 | add ecx, ebx | ||
1222 | ; 99 | ||
1223 | sub edi, ebp | ||
1224 | and esi, ecx | ||
1225 | and edi, edx | ||
1226 | or edi, esi | ||
1227 | mov esi, DWORD PTR 32[esp] | ||
1228 | rol edx, 10 | ||
1229 | lea ebx, DWORD PTR 1548603684[edi+ebx] | ||
1230 | mov edi, -1 | ||
1231 | add ebx, esi | ||
1232 | mov esi, edx | ||
1233 | rol ebx, 7 | ||
1234 | add ebx, eax | ||
1235 | ; 100 | ||
1236 | sub edi, edx | ||
1237 | and esi, ebx | ||
1238 | and edi, ecx | ||
1239 | or edi, esi | ||
1240 | mov esi, DWORD PTR 4[esp] | ||
1241 | rol ecx, 10 | ||
1242 | lea eax, DWORD PTR 1548603684[edi+eax] | ||
1243 | mov edi, -1 | ||
1244 | add eax, esi | ||
1245 | mov esi, ecx | ||
1246 | rol eax, 12 | ||
1247 | add eax, ebp | ||
1248 | ; 101 | ||
1249 | sub edi, ecx | ||
1250 | and esi, eax | ||
1251 | and edi, ebx | ||
1252 | or edi, esi | ||
1253 | mov esi, DWORD PTR 56[esp] | ||
1254 | rol ebx, 10 | ||
1255 | lea ebp, DWORD PTR 1548603684[edi+ebp] | ||
1256 | mov edi, -1 | ||
1257 | add ebp, esi | ||
1258 | mov esi, ebx | ||
1259 | rol ebp, 8 | ||
1260 | add ebp, edx | ||
1261 | ; 102 | ||
1262 | sub edi, ebx | ||
1263 | and esi, ebp | ||
1264 | and edi, eax | ||
1265 | or edi, esi | ||
1266 | mov esi, DWORD PTR 24[esp] | ||
1267 | rol eax, 10 | ||
1268 | lea edx, DWORD PTR 1548603684[edi+edx] | ||
1269 | mov edi, -1 | ||
1270 | add edx, esi | ||
1271 | mov esi, eax | ||
1272 | rol edx, 9 | ||
1273 | add edx, ecx | ||
1274 | ; 103 | ||
1275 | sub edi, eax | ||
1276 | and esi, edx | ||
1277 | and edi, ebp | ||
1278 | or edi, esi | ||
1279 | mov esi, DWORD PTR 44[esp] | ||
1280 | rol ebp, 10 | ||
1281 | lea ecx, DWORD PTR 1548603684[edi+ecx] | ||
1282 | mov edi, -1 | ||
1283 | add ecx, esi | ||
1284 | mov esi, ebp | ||
1285 | rol ecx, 11 | ||
1286 | add ecx, ebx | ||
1287 | ; 104 | ||
1288 | sub edi, ebp | ||
1289 | and esi, ecx | ||
1290 | and edi, edx | ||
1291 | or edi, esi | ||
1292 | mov esi, DWORD PTR 60[esp] | ||
1293 | rol edx, 10 | ||
1294 | lea ebx, DWORD PTR 1548603684[edi+ebx] | ||
1295 | mov edi, -1 | ||
1296 | add ebx, esi | ||
1297 | mov esi, edx | ||
1298 | rol ebx, 7 | ||
1299 | add ebx, eax | ||
1300 | ; 105 | ||
1301 | sub edi, edx | ||
1302 | and esi, ebx | ||
1303 | and edi, ecx | ||
1304 | or edi, esi | ||
1305 | mov esi, DWORD PTR 64[esp] | ||
1306 | rol ecx, 10 | ||
1307 | lea eax, DWORD PTR 1548603684[edi+eax] | ||
1308 | mov edi, -1 | ||
1309 | add eax, esi | ||
1310 | mov esi, ecx | ||
1311 | rol eax, 7 | ||
1312 | add eax, ebp | ||
1313 | ; 106 | ||
1314 | sub edi, ecx | ||
1315 | and esi, eax | ||
1316 | and edi, ebx | ||
1317 | or edi, esi | ||
1318 | mov esi, DWORD PTR 36[esp] | ||
1319 | rol ebx, 10 | ||
1320 | lea ebp, DWORD PTR 1548603684[edi+ebp] | ||
1321 | mov edi, -1 | ||
1322 | add ebp, esi | ||
1323 | mov esi, ebx | ||
1324 | rol ebp, 12 | ||
1325 | add ebp, edx | ||
1326 | ; 107 | ||
1327 | sub edi, ebx | ||
1328 | and esi, ebp | ||
1329 | and edi, eax | ||
1330 | or edi, esi | ||
1331 | mov esi, DWORD PTR 52[esp] | ||
1332 | rol eax, 10 | ||
1333 | lea edx, DWORD PTR 1548603684[edi+edx] | ||
1334 | mov edi, -1 | ||
1335 | add edx, esi | ||
1336 | mov esi, eax | ||
1337 | rol edx, 7 | ||
1338 | add edx, ecx | ||
1339 | ; 108 | ||
1340 | sub edi, eax | ||
1341 | and esi, edx | ||
1342 | and edi, ebp | ||
1343 | or edi, esi | ||
1344 | mov esi, DWORD PTR 20[esp] | ||
1345 | rol ebp, 10 | ||
1346 | lea ecx, DWORD PTR 1548603684[edi+ecx] | ||
1347 | mov edi, -1 | ||
1348 | add ecx, esi | ||
1349 | mov esi, ebp | ||
1350 | rol ecx, 6 | ||
1351 | add ecx, ebx | ||
1352 | ; 109 | ||
1353 | sub edi, ebp | ||
1354 | and esi, ecx | ||
1355 | and edi, edx | ||
1356 | or edi, esi | ||
1357 | mov esi, DWORD PTR 40[esp] | ||
1358 | rol edx, 10 | ||
1359 | lea ebx, DWORD PTR 1548603684[edi+ebx] | ||
1360 | mov edi, -1 | ||
1361 | add ebx, esi | ||
1362 | mov esi, edx | ||
1363 | rol ebx, 15 | ||
1364 | add ebx, eax | ||
1365 | ; 110 | ||
1366 | sub edi, edx | ||
1367 | and esi, ebx | ||
1368 | and edi, ecx | ||
1369 | or edi, esi | ||
1370 | mov esi, DWORD PTR 8[esp] | ||
1371 | rol ecx, 10 | ||
1372 | lea eax, DWORD PTR 1548603684[edi+eax] | ||
1373 | mov edi, -1 | ||
1374 | add eax, esi | ||
1375 | mov esi, ecx | ||
1376 | rol eax, 13 | ||
1377 | add eax, ebp | ||
1378 | ; 111 | ||
1379 | sub edi, ecx | ||
1380 | and esi, eax | ||
1381 | and edi, ebx | ||
1382 | or edi, esi | ||
1383 | mov esi, DWORD PTR 12[esp] | ||
1384 | rol ebx, 10 | ||
1385 | lea ebp, DWORD PTR 1548603684[edi+ebp] | ||
1386 | mov edi, -1 | ||
1387 | add ebp, esi | ||
1388 | sub edi, eax | ||
1389 | rol ebp, 11 | ||
1390 | add ebp, edx | ||
1391 | ; 112 | ||
1392 | mov esi, DWORD PTR 64[esp] | ||
1393 | or edi, ebp | ||
1394 | add edx, esi | ||
1395 | xor edi, ebx | ||
1396 | mov esi, -1 | ||
1397 | rol eax, 10 | ||
1398 | lea edx, DWORD PTR 1836072691[edi*1+edx] | ||
1399 | sub esi, ebp | ||
1400 | rol edx, 9 | ||
1401 | add edx, ecx | ||
1402 | ; 113 | ||
1403 | mov edi, DWORD PTR 24[esp] | ||
1404 | or esi, edx | ||
1405 | add ecx, edi | ||
1406 | xor esi, eax | ||
1407 | mov edi, -1 | ||
1408 | rol ebp, 10 | ||
1409 | lea ecx, DWORD PTR 1836072691[esi*1+ecx] | ||
1410 | sub edi, edx | ||
1411 | rol ecx, 7 | ||
1412 | add ecx, ebx | ||
1413 | ; 114 | ||
1414 | mov esi, DWORD PTR 8[esp] | ||
1415 | or edi, ecx | ||
1416 | add ebx, esi | ||
1417 | xor edi, ebp | ||
1418 | mov esi, -1 | ||
1419 | rol edx, 10 | ||
1420 | lea ebx, DWORD PTR 1836072691[edi*1+ebx] | ||
1421 | sub esi, ecx | ||
1422 | rol ebx, 15 | ||
1423 | add ebx, eax | ||
1424 | ; 115 | ||
1425 | mov edi, DWORD PTR 16[esp] | ||
1426 | or esi, ebx | ||
1427 | add eax, edi | ||
1428 | xor esi, edx | ||
1429 | mov edi, -1 | ||
1430 | rol ecx, 10 | ||
1431 | lea eax, DWORD PTR 1836072691[esi*1+eax] | ||
1432 | sub edi, ebx | ||
1433 | rol eax, 11 | ||
1434 | add eax, ebp | ||
1435 | ; 116 | ||
1436 | mov esi, DWORD PTR 32[esp] | ||
1437 | or edi, eax | ||
1438 | add ebp, esi | ||
1439 | xor edi, ecx | ||
1440 | mov esi, -1 | ||
1441 | rol ebx, 10 | ||
1442 | lea ebp, DWORD PTR 1836072691[edi*1+ebp] | ||
1443 | sub esi, eax | ||
1444 | rol ebp, 8 | ||
1445 | add ebp, edx | ||
1446 | ; 117 | ||
1447 | mov edi, DWORD PTR 60[esp] | ||
1448 | or esi, ebp | ||
1449 | add edx, edi | ||
1450 | xor esi, ebx | ||
1451 | mov edi, -1 | ||
1452 | rol eax, 10 | ||
1453 | lea edx, DWORD PTR 1836072691[esi*1+edx] | ||
1454 | sub edi, ebp | ||
1455 | rol edx, 6 | ||
1456 | add edx, ecx | ||
1457 | ; 118 | ||
1458 | mov esi, DWORD PTR 28[esp] | ||
1459 | or edi, edx | ||
1460 | add ecx, esi | ||
1461 | xor edi, eax | ||
1462 | mov esi, -1 | ||
1463 | rol ebp, 10 | ||
1464 | lea ecx, DWORD PTR 1836072691[edi*1+ecx] | ||
1465 | sub esi, edx | ||
1466 | rol ecx, 6 | ||
1467 | add ecx, ebx | ||
1468 | ; 119 | ||
1469 | mov edi, DWORD PTR 40[esp] | ||
1470 | or esi, ecx | ||
1471 | add ebx, edi | ||
1472 | xor esi, ebp | ||
1473 | mov edi, -1 | ||
1474 | rol edx, 10 | ||
1475 | lea ebx, DWORD PTR 1836072691[esi*1+ebx] | ||
1476 | sub edi, ecx | ||
1477 | rol ebx, 14 | ||
1478 | add ebx, eax | ||
1479 | ; 120 | ||
1480 | mov esi, DWORD PTR 48[esp] | ||
1481 | or edi, ebx | ||
1482 | add eax, esi | ||
1483 | xor edi, edx | ||
1484 | mov esi, -1 | ||
1485 | rol ecx, 10 | ||
1486 | lea eax, DWORD PTR 1836072691[edi*1+eax] | ||
1487 | sub esi, ebx | ||
1488 | rol eax, 12 | ||
1489 | add eax, ebp | ||
1490 | ; 121 | ||
1491 | mov edi, DWORD PTR 36[esp] | ||
1492 | or esi, eax | ||
1493 | add ebp, edi | ||
1494 | xor esi, ecx | ||
1495 | mov edi, -1 | ||
1496 | rol ebx, 10 | ||
1497 | lea ebp, DWORD PTR 1836072691[esi*1+ebp] | ||
1498 | sub edi, eax | ||
1499 | rol ebp, 13 | ||
1500 | add ebp, edx | ||
1501 | ; 122 | ||
1502 | mov esi, DWORD PTR 52[esp] | ||
1503 | or edi, ebp | ||
1504 | add edx, esi | ||
1505 | xor edi, ebx | ||
1506 | mov esi, -1 | ||
1507 | rol eax, 10 | ||
1508 | lea edx, DWORD PTR 1836072691[edi*1+edx] | ||
1509 | sub esi, ebp | ||
1510 | rol edx, 5 | ||
1511 | add edx, ecx | ||
1512 | ; 123 | ||
1513 | mov edi, DWORD PTR 12[esp] | ||
1514 | or esi, edx | ||
1515 | add ecx, edi | ||
1516 | xor esi, eax | ||
1517 | mov edi, -1 | ||
1518 | rol ebp, 10 | ||
1519 | lea ecx, DWORD PTR 1836072691[esi*1+ecx] | ||
1520 | sub edi, edx | ||
1521 | rol ecx, 14 | ||
1522 | add ecx, ebx | ||
1523 | ; 124 | ||
1524 | mov esi, DWORD PTR 44[esp] | ||
1525 | or edi, ecx | ||
1526 | add ebx, esi | ||
1527 | xor edi, ebp | ||
1528 | mov esi, -1 | ||
1529 | rol edx, 10 | ||
1530 | lea ebx, DWORD PTR 1836072691[edi*1+ebx] | ||
1531 | sub esi, ecx | ||
1532 | rol ebx, 13 | ||
1533 | add ebx, eax | ||
1534 | ; 125 | ||
1535 | mov edi, DWORD PTR 4[esp] | ||
1536 | or esi, ebx | ||
1537 | add eax, edi | ||
1538 | xor esi, edx | ||
1539 | mov edi, -1 | ||
1540 | rol ecx, 10 | ||
1541 | lea eax, DWORD PTR 1836072691[esi*1+eax] | ||
1542 | sub edi, ebx | ||
1543 | rol eax, 13 | ||
1544 | add eax, ebp | ||
1545 | ; 126 | ||
1546 | mov esi, DWORD PTR 20[esp] | ||
1547 | or edi, eax | ||
1548 | add ebp, esi | ||
1549 | xor edi, ecx | ||
1550 | mov esi, -1 | ||
1551 | rol ebx, 10 | ||
1552 | lea ebp, DWORD PTR 1836072691[edi*1+ebp] | ||
1553 | sub esi, eax | ||
1554 | rol ebp, 7 | ||
1555 | add ebp, edx | ||
1556 | ; 127 | ||
1557 | mov edi, DWORD PTR 56[esp] | ||
1558 | or esi, ebp | ||
1559 | add edx, edi | ||
1560 | xor esi, ebx | ||
1561 | mov edi, DWORD PTR 36[esp] | ||
1562 | rol eax, 10 | ||
1563 | lea edx, DWORD PTR 1836072691[esi*1+edx] | ||
1564 | mov esi, -1 | ||
1565 | rol edx, 5 | ||
1566 | add edx, ecx | ||
1567 | ; 128 | ||
1568 | add ecx, edi | ||
1569 | mov edi, ebp | ||
1570 | sub esi, edx | ||
1571 | and edi, edx | ||
1572 | and esi, eax | ||
1573 | or edi, esi | ||
1574 | mov esi, DWORD PTR 28[esp] | ||
1575 | rol ebp, 10 | ||
1576 | lea ecx, DWORD PTR 2053994217[edi*1+ecx] | ||
1577 | mov edi, -1 | ||
1578 | rol ecx, 15 | ||
1579 | add ecx, ebx | ||
1580 | ; 129 | ||
1581 | add ebx, esi | ||
1582 | mov esi, edx | ||
1583 | sub edi, ecx | ||
1584 | and esi, ecx | ||
1585 | and edi, ebp | ||
1586 | or esi, edi | ||
1587 | mov edi, DWORD PTR 20[esp] | ||
1588 | rol edx, 10 | ||
1589 | lea ebx, DWORD PTR 2053994217[esi*1+ebx] | ||
1590 | mov esi, -1 | ||
1591 | rol ebx, 5 | ||
1592 | add ebx, eax | ||
1593 | ; 130 | ||
1594 | add eax, edi | ||
1595 | mov edi, ecx | ||
1596 | sub esi, ebx | ||
1597 | and edi, ebx | ||
1598 | and esi, edx | ||
1599 | or edi, esi | ||
1600 | mov esi, DWORD PTR 8[esp] | ||
1601 | rol ecx, 10 | ||
1602 | lea eax, DWORD PTR 2053994217[edi*1+eax] | ||
1603 | mov edi, -1 | ||
1604 | rol eax, 8 | ||
1605 | add eax, ebp | ||
1606 | ; 131 | ||
1607 | add ebp, esi | ||
1608 | mov esi, ebx | ||
1609 | sub edi, eax | ||
1610 | and esi, eax | ||
1611 | and edi, ecx | ||
1612 | or esi, edi | ||
1613 | mov edi, DWORD PTR 16[esp] | ||
1614 | rol ebx, 10 | ||
1615 | lea ebp, DWORD PTR 2053994217[esi*1+ebp] | ||
1616 | mov esi, -1 | ||
1617 | rol ebp, 11 | ||
1618 | add ebp, edx | ||
1619 | ; 132 | ||
1620 | add edx, edi | ||
1621 | mov edi, eax | ||
1622 | sub esi, ebp | ||
1623 | and edi, ebp | ||
1624 | and esi, ebx | ||
1625 | or edi, esi | ||
1626 | mov esi, DWORD PTR 48[esp] | ||
1627 | rol eax, 10 | ||
1628 | lea edx, DWORD PTR 2053994217[edi*1+edx] | ||
1629 | mov edi, -1 | ||
1630 | rol edx, 14 | ||
1631 | add edx, ecx | ||
1632 | ; 133 | ||
1633 | add ecx, esi | ||
1634 | mov esi, ebp | ||
1635 | sub edi, edx | ||
1636 | and esi, edx | ||
1637 | and edi, eax | ||
1638 | or esi, edi | ||
1639 | mov edi, DWORD PTR 64[esp] | ||
1640 | rol ebp, 10 | ||
1641 | lea ecx, DWORD PTR 2053994217[esi*1+ecx] | ||
1642 | mov esi, -1 | ||
1643 | rol ecx, 14 | ||
1644 | add ecx, ebx | ||
1645 | ; 134 | ||
1646 | add ebx, edi | ||
1647 | mov edi, edx | ||
1648 | sub esi, ecx | ||
1649 | and edi, ecx | ||
1650 | and esi, ebp | ||
1651 | or edi, esi | ||
1652 | mov esi, DWORD PTR 4[esp] | ||
1653 | rol edx, 10 | ||
1654 | lea ebx, DWORD PTR 2053994217[edi*1+ebx] | ||
1655 | mov edi, -1 | ||
1656 | rol ebx, 6 | ||
1657 | add ebx, eax | ||
1658 | ; 135 | ||
1659 | add eax, esi | ||
1660 | mov esi, ecx | ||
1661 | sub edi, ebx | ||
1662 | and esi, ebx | ||
1663 | and edi, edx | ||
1664 | or esi, edi | ||
1665 | mov edi, DWORD PTR 24[esp] | ||
1666 | rol ecx, 10 | ||
1667 | lea eax, DWORD PTR 2053994217[esi*1+eax] | ||
1668 | mov esi, -1 | ||
1669 | rol eax, 14 | ||
1670 | add eax, ebp | ||
1671 | ; 136 | ||
1672 | add ebp, edi | ||
1673 | mov edi, ebx | ||
1674 | sub esi, eax | ||
1675 | and edi, eax | ||
1676 | and esi, ecx | ||
1677 | or edi, esi | ||
1678 | mov esi, DWORD PTR 52[esp] | ||
1679 | rol ebx, 10 | ||
1680 | lea ebp, DWORD PTR 2053994217[edi*1+ebp] | ||
1681 | mov edi, -1 | ||
1682 | rol ebp, 6 | ||
1683 | add ebp, edx | ||
1684 | ; 137 | ||
1685 | add edx, esi | ||
1686 | mov esi, eax | ||
1687 | sub edi, ebp | ||
1688 | and esi, ebp | ||
1689 | and edi, ebx | ||
1690 | or esi, edi | ||
1691 | mov edi, DWORD PTR 12[esp] | ||
1692 | rol eax, 10 | ||
1693 | lea edx, DWORD PTR 2053994217[esi*1+edx] | ||
1694 | mov esi, -1 | ||
1695 | rol edx, 9 | ||
1696 | add edx, ecx | ||
1697 | ; 138 | ||
1698 | add ecx, edi | ||
1699 | mov edi, ebp | ||
1700 | sub esi, edx | ||
1701 | and edi, edx | ||
1702 | and esi, eax | ||
1703 | or edi, esi | ||
1704 | mov esi, DWORD PTR 56[esp] | ||
1705 | rol ebp, 10 | ||
1706 | lea ecx, DWORD PTR 2053994217[edi*1+ecx] | ||
1707 | mov edi, -1 | ||
1708 | rol ecx, 12 | ||
1709 | add ecx, ebx | ||
1710 | ; 139 | ||
1711 | add ebx, esi | ||
1712 | mov esi, edx | ||
1713 | sub edi, ecx | ||
1714 | and esi, ecx | ||
1715 | and edi, ebp | ||
1716 | or esi, edi | ||
1717 | mov edi, DWORD PTR 40[esp] | ||
1718 | rol edx, 10 | ||
1719 | lea ebx, DWORD PTR 2053994217[esi*1+ebx] | ||
1720 | mov esi, -1 | ||
1721 | rol ebx, 9 | ||
1722 | add ebx, eax | ||
1723 | ; 140 | ||
1724 | add eax, edi | ||
1725 | mov edi, ecx | ||
1726 | sub esi, ebx | ||
1727 | and edi, ebx | ||
1728 | and esi, edx | ||
1729 | or edi, esi | ||
1730 | mov esi, DWORD PTR 32[esp] | ||
1731 | rol ecx, 10 | ||
1732 | lea eax, DWORD PTR 2053994217[edi*1+eax] | ||
1733 | mov edi, -1 | ||
1734 | rol eax, 12 | ||
1735 | add eax, ebp | ||
1736 | ; 141 | ||
1737 | add ebp, esi | ||
1738 | mov esi, ebx | ||
1739 | sub edi, eax | ||
1740 | and esi, eax | ||
1741 | and edi, ecx | ||
1742 | or esi, edi | ||
1743 | mov edi, DWORD PTR 44[esp] | ||
1744 | rol ebx, 10 | ||
1745 | lea ebp, DWORD PTR 2053994217[esi*1+ebp] | ||
1746 | mov esi, -1 | ||
1747 | rol ebp, 5 | ||
1748 | add ebp, edx | ||
1749 | ; 142 | ||
1750 | add edx, edi | ||
1751 | mov edi, eax | ||
1752 | sub esi, ebp | ||
1753 | and edi, ebp | ||
1754 | and esi, ebx | ||
1755 | or edi, esi | ||
1756 | mov esi, DWORD PTR 60[esp] | ||
1757 | rol eax, 10 | ||
1758 | lea edx, DWORD PTR 2053994217[edi*1+edx] | ||
1759 | mov edi, -1 | ||
1760 | rol edx, 15 | ||
1761 | add edx, ecx | ||
1762 | ; 143 | ||
1763 | add ecx, esi | ||
1764 | mov esi, ebp | ||
1765 | sub edi, edx | ||
1766 | and esi, edx | ||
1767 | and edi, eax | ||
1768 | or edi, esi | ||
1769 | mov esi, edx | ||
1770 | rol ebp, 10 | ||
1771 | lea ecx, DWORD PTR 2053994217[edi*1+ecx] | ||
1772 | xor esi, ebp | ||
1773 | rol ecx, 8 | ||
1774 | add ecx, ebx | ||
1775 | ; 144 | ||
1776 | mov edi, DWORD PTR 52[esp] | ||
1777 | xor esi, ecx | ||
1778 | add ebx, edi | ||
1779 | rol edx, 10 | ||
1780 | add ebx, esi | ||
1781 | mov esi, ecx | ||
1782 | rol ebx, 8 | ||
1783 | add ebx, eax | ||
1784 | ; 145 | ||
1785 | xor esi, edx | ||
1786 | mov edi, DWORD PTR 64[esp] | ||
1787 | xor esi, ebx | ||
1788 | add eax, esi | ||
1789 | mov esi, ebx | ||
1790 | rol ecx, 10 | ||
1791 | add eax, edi | ||
1792 | xor esi, ecx | ||
1793 | rol eax, 5 | ||
1794 | add eax, ebp | ||
1795 | ; 146 | ||
1796 | mov edi, DWORD PTR 44[esp] | ||
1797 | xor esi, eax | ||
1798 | add ebp, edi | ||
1799 | rol ebx, 10 | ||
1800 | add ebp, esi | ||
1801 | mov esi, eax | ||
1802 | rol ebp, 12 | ||
1803 | add ebp, edx | ||
1804 | ; 147 | ||
1805 | xor esi, ebx | ||
1806 | mov edi, DWORD PTR 20[esp] | ||
1807 | xor esi, ebp | ||
1808 | add edx, esi | ||
1809 | mov esi, ebp | ||
1810 | rol eax, 10 | ||
1811 | add edx, edi | ||
1812 | xor esi, eax | ||
1813 | rol edx, 9 | ||
1814 | add edx, ecx | ||
1815 | ; 148 | ||
1816 | mov edi, DWORD PTR 8[esp] | ||
1817 | xor esi, edx | ||
1818 | add ecx, edi | ||
1819 | rol ebp, 10 | ||
1820 | add ecx, esi | ||
1821 | mov esi, edx | ||
1822 | rol ecx, 12 | ||
1823 | add ecx, ebx | ||
1824 | ; 149 | ||
1825 | xor esi, ebp | ||
1826 | mov edi, DWORD PTR 24[esp] | ||
1827 | xor esi, ecx | ||
1828 | add ebx, esi | ||
1829 | mov esi, ecx | ||
1830 | rol edx, 10 | ||
1831 | add ebx, edi | ||
1832 | xor esi, edx | ||
1833 | rol ebx, 5 | ||
1834 | add ebx, eax | ||
1835 | ; 150 | ||
1836 | mov edi, DWORD PTR 36[esp] | ||
1837 | xor esi, ebx | ||
1838 | add eax, edi | ||
1839 | rol ecx, 10 | ||
1840 | add eax, esi | ||
1841 | mov esi, ebx | ||
1842 | rol eax, 14 | ||
1843 | add eax, ebp | ||
1844 | ; 151 | ||
1845 | xor esi, ecx | ||
1846 | mov edi, DWORD PTR 32[esp] | ||
1847 | xor esi, eax | ||
1848 | add ebp, esi | ||
1849 | mov esi, eax | ||
1850 | rol ebx, 10 | ||
1851 | add ebp, edi | ||
1852 | xor esi, ebx | ||
1853 | rol ebp, 6 | ||
1854 | add ebp, edx | ||
1855 | ; 152 | ||
1856 | mov edi, DWORD PTR 28[esp] | ||
1857 | xor esi, ebp | ||
1858 | add edx, edi | ||
1859 | rol eax, 10 | ||
1860 | add edx, esi | ||
1861 | mov esi, ebp | ||
1862 | rol edx, 8 | ||
1863 | add edx, ecx | ||
1864 | ; 153 | ||
1865 | xor esi, eax | ||
1866 | mov edi, DWORD PTR 12[esp] | ||
1867 | xor esi, edx | ||
1868 | add ecx, esi | ||
1869 | mov esi, edx | ||
1870 | rol ebp, 10 | ||
1871 | add ecx, edi | ||
1872 | xor esi, ebp | ||
1873 | rol ecx, 13 | ||
1874 | add ecx, ebx | ||
1875 | ; 154 | ||
1876 | mov edi, DWORD PTR 56[esp] | ||
1877 | xor esi, ecx | ||
1878 | add ebx, edi | ||
1879 | rol edx, 10 | ||
1880 | add ebx, esi | ||
1881 | mov esi, ecx | ||
1882 | rol ebx, 6 | ||
1883 | add ebx, eax | ||
1884 | ; 155 | ||
1885 | xor esi, edx | ||
1886 | mov edi, DWORD PTR 60[esp] | ||
1887 | xor esi, ebx | ||
1888 | add eax, esi | ||
1889 | mov esi, ebx | ||
1890 | rol ecx, 10 | ||
1891 | add eax, edi | ||
1892 | xor esi, ecx | ||
1893 | rol eax, 5 | ||
1894 | add eax, ebp | ||
1895 | ; 156 | ||
1896 | mov edi, DWORD PTR 4[esp] | ||
1897 | xor esi, eax | ||
1898 | add ebp, edi | ||
1899 | rol ebx, 10 | ||
1900 | add ebp, esi | ||
1901 | mov esi, eax | ||
1902 | rol ebp, 15 | ||
1903 | add ebp, edx | ||
1904 | ; 157 | ||
1905 | xor esi, ebx | ||
1906 | mov edi, DWORD PTR 16[esp] | ||
1907 | xor esi, ebp | ||
1908 | add edx, esi | ||
1909 | mov esi, ebp | ||
1910 | rol eax, 10 | ||
1911 | add edx, edi | ||
1912 | xor esi, eax | ||
1913 | rol edx, 13 | ||
1914 | add edx, ecx | ||
1915 | ; 158 | ||
1916 | mov edi, DWORD PTR 40[esp] | ||
1917 | xor esi, edx | ||
1918 | add ecx, edi | ||
1919 | rol ebp, 10 | ||
1920 | add ecx, esi | ||
1921 | mov esi, edx | ||
1922 | rol ecx, 11 | ||
1923 | add ecx, ebx | ||
1924 | ; 159 | ||
1925 | xor esi, ebp | ||
1926 | mov edi, DWORD PTR 48[esp] | ||
1927 | xor esi, ecx | ||
1928 | add ebx, esi | ||
1929 | rol edx, 10 | ||
1930 | add ebx, edi | ||
1931 | mov edi, DWORD PTR 108[esp] | ||
1932 | rol ebx, 11 | ||
1933 | add ebx, eax | ||
1934 | mov esi, DWORD PTR 4[edi] | ||
1935 | add edx, esi | ||
1936 | mov esi, DWORD PTR 76[esp] | ||
1937 | add edx, esi | ||
1938 | mov esi, DWORD PTR 8[edi] | ||
1939 | add ebp, esi | ||
1940 | mov esi, DWORD PTR 80[esp] | ||
1941 | add ebp, esi | ||
1942 | mov esi, DWORD PTR 12[edi] | ||
1943 | add eax, esi | ||
1944 | mov esi, DWORD PTR 84[esp] | ||
1945 | add eax, esi | ||
1946 | mov esi, DWORD PTR 16[edi] | ||
1947 | add ebx, esi | ||
1948 | mov esi, DWORD PTR 68[esp] | ||
1949 | add ebx, esi | ||
1950 | mov esi, DWORD PTR [edi] | ||
1951 | add ecx, esi | ||
1952 | mov esi, DWORD PTR 72[esp] | ||
1953 | add ecx, esi | ||
1954 | mov DWORD PTR [edi],edx | ||
1955 | mov DWORD PTR 4[edi],ebp | ||
1956 | mov DWORD PTR 8[edi],eax | ||
1957 | mov DWORD PTR 12[edi],ebx | ||
1958 | mov DWORD PTR 16[edi],ecx | ||
1959 | mov edi, DWORD PTR [esp] | ||
1960 | mov esi, DWORD PTR 112[esp] | ||
1961 | cmp edi, esi | ||
1962 | mov edi, DWORD PTR 108[esp] | ||
1963 | jge L000start | ||
1964 | add esp, 88 | ||
1965 | pop ebx | ||
1966 | pop ebp | ||
1967 | pop edi | ||
1968 | pop esi | ||
1969 | ret | ||
1970 | _ripemd160_block_x86 ENDP | ||
1971 | _TEXT ENDS | ||
1972 | 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 @@ | |||
1 | /* Run the C pre-processor over this file with one of the following defined | ||
2 | * ELF - elf object files, | ||
3 | * OUT - a.out object files, | ||
4 | * BSDI - BSDI style a.out object files | ||
5 | * SOL - Solaris style elf | ||
6 | */ | ||
7 | |||
8 | #define TYPE(a,b) .type a,b | ||
9 | #define SIZE(a,b) .size a,b | ||
10 | |||
11 | #if defined(OUT) || defined(BSDI) | ||
12 | #define ripemd160_block_x86 _ripemd160_block_x86 | ||
13 | |||
14 | #endif | ||
15 | |||
16 | #ifdef OUT | ||
17 | #define OK 1 | ||
18 | #define ALIGN 4 | ||
19 | #endif | ||
20 | |||
21 | #ifdef BSDI | ||
22 | #define OK 1 | ||
23 | #define ALIGN 4 | ||
24 | #undef SIZE | ||
25 | #undef TYPE | ||
26 | #define SIZE(a,b) | ||
27 | #define TYPE(a,b) | ||
28 | #endif | ||
29 | |||
30 | #if defined(ELF) || defined(SOL) | ||
31 | #define OK 1 | ||
32 | #define ALIGN 16 | ||
33 | #endif | ||
34 | |||
35 | #ifndef OK | ||
36 | You need to define one of | ||
37 | ELF - elf systems - linux-elf, NetBSD and DG-UX | ||
38 | OUT - a.out systems - linux-a.out and FreeBSD | ||
39 | SOL - solaris systems, which are elf with strange comment lines | ||
40 | BSDI - a.out with a very primative version of as. | ||
41 | #endif | ||
42 | |||
43 | /* Let the Assembler begin :-) */ | ||
44 | /* Don't even think of reading this code */ | ||
45 | /* It was automatically generated by rmd-586.pl */ | ||
46 | /* Which is a perl program used to generate the x86 assember for */ | ||
47 | /* any of elf, a.out, BSDI,Win32, or Solaris */ | ||
48 | /* eric <eay@cryptsoft.com> */ | ||
49 | |||
50 | .file "rmd-586.s" | ||
51 | .version "01.01" | ||
52 | gcc2_compiled.: | ||
53 | .text | ||
54 | .align ALIGN | ||
55 | .globl ripemd160_block_x86 | ||
56 | TYPE(ripemd160_block_x86,@function) | ||
57 | ripemd160_block_x86: | ||
58 | pushl %esi | ||
59 | movl 16(%esp), %ecx | ||
60 | pushl %edi | ||
61 | movl 16(%esp), %esi | ||
62 | pushl %ebp | ||
63 | addl %esi, %ecx | ||
64 | pushl %ebx | ||
65 | subl $64, %ecx | ||
66 | subl $88, %esp | ||
67 | movl %ecx, (%esp) | ||
68 | movl 108(%esp), %edi | ||
69 | .L000start: | ||
70 | |||
71 | movl (%esi), %eax | ||
72 | movl 4(%esi), %ebx | ||
73 | movl %eax, 4(%esp) | ||
74 | movl %ebx, 8(%esp) | ||
75 | movl 8(%esi), %eax | ||
76 | movl 12(%esi), %ebx | ||
77 | movl %eax, 12(%esp) | ||
78 | movl %ebx, 16(%esp) | ||
79 | movl 16(%esi), %eax | ||
80 | movl 20(%esi), %ebx | ||
81 | movl %eax, 20(%esp) | ||
82 | movl %ebx, 24(%esp) | ||
83 | movl 24(%esi), %eax | ||
84 | movl 28(%esi), %ebx | ||
85 | movl %eax, 28(%esp) | ||
86 | movl %ebx, 32(%esp) | ||
87 | movl 32(%esi), %eax | ||
88 | movl 36(%esi), %ebx | ||
89 | movl %eax, 36(%esp) | ||
90 | movl %ebx, 40(%esp) | ||
91 | movl 40(%esi), %eax | ||
92 | movl 44(%esi), %ebx | ||
93 | movl %eax, 44(%esp) | ||
94 | movl %ebx, 48(%esp) | ||
95 | movl 48(%esi), %eax | ||
96 | movl 52(%esi), %ebx | ||
97 | movl %eax, 52(%esp) | ||
98 | movl %ebx, 56(%esp) | ||
99 | movl 56(%esi), %eax | ||
100 | movl 60(%esi), %ebx | ||
101 | movl %eax, 60(%esp) | ||
102 | movl %ebx, 64(%esp) | ||
103 | addl $64, %esi | ||
104 | movl (%edi), %eax | ||
105 | movl %esi, 112(%esp) | ||
106 | movl 4(%edi), %ebx | ||
107 | movl 8(%edi), %ecx | ||
108 | movl 12(%edi), %edx | ||
109 | movl 16(%edi), %ebp | ||
110 | /* 0 */ | ||
111 | movl %ecx, %esi | ||
112 | xorl %edx, %esi | ||
113 | movl 4(%esp), %edi | ||
114 | xorl %ebx, %esi | ||
115 | addl %edi, %eax | ||
116 | roll $10, %ecx | ||
117 | addl %esi, %eax | ||
118 | movl %ebx, %esi | ||
119 | roll $11, %eax | ||
120 | addl %ebp, %eax | ||
121 | /* 1 */ | ||
122 | xorl %ecx, %esi | ||
123 | movl 8(%esp), %edi | ||
124 | xorl %eax, %esi | ||
125 | addl %esi, %ebp | ||
126 | movl %eax, %esi | ||
127 | roll $10, %ebx | ||
128 | addl %edi, %ebp | ||
129 | xorl %ebx, %esi | ||
130 | roll $14, %ebp | ||
131 | addl %edx, %ebp | ||
132 | /* 2 */ | ||
133 | movl 12(%esp), %edi | ||
134 | xorl %ebp, %esi | ||
135 | addl %edi, %edx | ||
136 | roll $10, %eax | ||
137 | addl %esi, %edx | ||
138 | movl %ebp, %esi | ||
139 | roll $15, %edx | ||
140 | addl %ecx, %edx | ||
141 | /* 3 */ | ||
142 | xorl %eax, %esi | ||
143 | movl 16(%esp), %edi | ||
144 | xorl %edx, %esi | ||
145 | addl %esi, %ecx | ||
146 | movl %edx, %esi | ||
147 | roll $10, %ebp | ||
148 | addl %edi, %ecx | ||
149 | xorl %ebp, %esi | ||
150 | roll $12, %ecx | ||
151 | addl %ebx, %ecx | ||
152 | /* 4 */ | ||
153 | movl 20(%esp), %edi | ||
154 | xorl %ecx, %esi | ||
155 | addl %edi, %ebx | ||
156 | roll $10, %edx | ||
157 | addl %esi, %ebx | ||
158 | movl %ecx, %esi | ||
159 | roll $5, %ebx | ||
160 | addl %eax, %ebx | ||
161 | /* 5 */ | ||
162 | xorl %edx, %esi | ||
163 | movl 24(%esp), %edi | ||
164 | xorl %ebx, %esi | ||
165 | addl %esi, %eax | ||
166 | movl %ebx, %esi | ||
167 | roll $10, %ecx | ||
168 | addl %edi, %eax | ||
169 | xorl %ecx, %esi | ||
170 | roll $8, %eax | ||
171 | addl %ebp, %eax | ||
172 | /* 6 */ | ||
173 | movl 28(%esp), %edi | ||
174 | xorl %eax, %esi | ||
175 | addl %edi, %ebp | ||
176 | roll $10, %ebx | ||
177 | addl %esi, %ebp | ||
178 | movl %eax, %esi | ||
179 | roll $7, %ebp | ||
180 | addl %edx, %ebp | ||
181 | /* 7 */ | ||
182 | xorl %ebx, %esi | ||
183 | movl 32(%esp), %edi | ||
184 | xorl %ebp, %esi | ||
185 | addl %esi, %edx | ||
186 | movl %ebp, %esi | ||
187 | roll $10, %eax | ||
188 | addl %edi, %edx | ||
189 | xorl %eax, %esi | ||
190 | roll $9, %edx | ||
191 | addl %ecx, %edx | ||
192 | /* 8 */ | ||
193 | movl 36(%esp), %edi | ||
194 | xorl %edx, %esi | ||
195 | addl %edi, %ecx | ||
196 | roll $10, %ebp | ||
197 | addl %esi, %ecx | ||
198 | movl %edx, %esi | ||
199 | roll $11, %ecx | ||
200 | addl %ebx, %ecx | ||
201 | /* 9 */ | ||
202 | xorl %ebp, %esi | ||
203 | movl 40(%esp), %edi | ||
204 | xorl %ecx, %esi | ||
205 | addl %esi, %ebx | ||
206 | movl %ecx, %esi | ||
207 | roll $10, %edx | ||
208 | addl %edi, %ebx | ||
209 | xorl %edx, %esi | ||
210 | roll $13, %ebx | ||
211 | addl %eax, %ebx | ||
212 | /* 10 */ | ||
213 | movl 44(%esp), %edi | ||
214 | xorl %ebx, %esi | ||
215 | addl %edi, %eax | ||
216 | roll $10, %ecx | ||
217 | addl %esi, %eax | ||
218 | movl %ebx, %esi | ||
219 | roll $14, %eax | ||
220 | addl %ebp, %eax | ||
221 | /* 11 */ | ||
222 | xorl %ecx, %esi | ||
223 | movl 48(%esp), %edi | ||
224 | xorl %eax, %esi | ||
225 | addl %esi, %ebp | ||
226 | movl %eax, %esi | ||
227 | roll $10, %ebx | ||
228 | addl %edi, %ebp | ||
229 | xorl %ebx, %esi | ||
230 | roll $15, %ebp | ||
231 | addl %edx, %ebp | ||
232 | /* 12 */ | ||
233 | movl 52(%esp), %edi | ||
234 | xorl %ebp, %esi | ||
235 | addl %edi, %edx | ||
236 | roll $10, %eax | ||
237 | addl %esi, %edx | ||
238 | movl %ebp, %esi | ||
239 | roll $6, %edx | ||
240 | addl %ecx, %edx | ||
241 | /* 13 */ | ||
242 | xorl %eax, %esi | ||
243 | movl 56(%esp), %edi | ||
244 | xorl %edx, %esi | ||
245 | addl %esi, %ecx | ||
246 | movl %edx, %esi | ||
247 | roll $10, %ebp | ||
248 | addl %edi, %ecx | ||
249 | xorl %ebp, %esi | ||
250 | roll $7, %ecx | ||
251 | addl %ebx, %ecx | ||
252 | /* 14 */ | ||
253 | movl 60(%esp), %edi | ||
254 | xorl %ecx, %esi | ||
255 | addl %edi, %ebx | ||
256 | roll $10, %edx | ||
257 | addl %esi, %ebx | ||
258 | movl %ecx, %esi | ||
259 | roll $9, %ebx | ||
260 | addl %eax, %ebx | ||
261 | /* 15 */ | ||
262 | xorl %edx, %esi | ||
263 | movl 64(%esp), %edi | ||
264 | xorl %ebx, %esi | ||
265 | addl %esi, %eax | ||
266 | movl $-1, %esi | ||
267 | roll $10, %ecx | ||
268 | addl %edi, %eax | ||
269 | movl 32(%esp), %edi | ||
270 | roll $8, %eax | ||
271 | addl %ebp, %eax | ||
272 | /* 16 */ | ||
273 | addl %edi, %ebp | ||
274 | movl %ebx, %edi | ||
275 | subl %eax, %esi | ||
276 | andl %eax, %edi | ||
277 | andl %ecx, %esi | ||
278 | orl %esi, %edi | ||
279 | movl 20(%esp), %esi | ||
280 | roll $10, %ebx | ||
281 | leal 1518500249(%ebp,%edi,1),%ebp | ||
282 | movl $-1, %edi | ||
283 | roll $7, %ebp | ||
284 | addl %edx, %ebp | ||
285 | /* 17 */ | ||
286 | addl %esi, %edx | ||
287 | movl %eax, %esi | ||
288 | subl %ebp, %edi | ||
289 | andl %ebp, %esi | ||
290 | andl %ebx, %edi | ||
291 | orl %edi, %esi | ||
292 | movl 56(%esp), %edi | ||
293 | roll $10, %eax | ||
294 | leal 1518500249(%edx,%esi,1),%edx | ||
295 | movl $-1, %esi | ||
296 | roll $6, %edx | ||
297 | addl %ecx, %edx | ||
298 | /* 18 */ | ||
299 | addl %edi, %ecx | ||
300 | movl %ebp, %edi | ||
301 | subl %edx, %esi | ||
302 | andl %edx, %edi | ||
303 | andl %eax, %esi | ||
304 | orl %esi, %edi | ||
305 | movl 8(%esp), %esi | ||
306 | roll $10, %ebp | ||
307 | leal 1518500249(%ecx,%edi,1),%ecx | ||
308 | movl $-1, %edi | ||
309 | roll $8, %ecx | ||
310 | addl %ebx, %ecx | ||
311 | /* 19 */ | ||
312 | addl %esi, %ebx | ||
313 | movl %edx, %esi | ||
314 | subl %ecx, %edi | ||
315 | andl %ecx, %esi | ||
316 | andl %ebp, %edi | ||
317 | orl %edi, %esi | ||
318 | movl 44(%esp), %edi | ||
319 | roll $10, %edx | ||
320 | leal 1518500249(%ebx,%esi,1),%ebx | ||
321 | movl $-1, %esi | ||
322 | roll $13, %ebx | ||
323 | addl %eax, %ebx | ||
324 | /* 20 */ | ||
325 | addl %edi, %eax | ||
326 | movl %ecx, %edi | ||
327 | subl %ebx, %esi | ||
328 | andl %ebx, %edi | ||
329 | andl %edx, %esi | ||
330 | orl %esi, %edi | ||
331 | movl 28(%esp), %esi | ||
332 | roll $10, %ecx | ||
333 | leal 1518500249(%eax,%edi,1),%eax | ||
334 | movl $-1, %edi | ||
335 | roll $11, %eax | ||
336 | addl %ebp, %eax | ||
337 | /* 21 */ | ||
338 | addl %esi, %ebp | ||
339 | movl %ebx, %esi | ||
340 | subl %eax, %edi | ||
341 | andl %eax, %esi | ||
342 | andl %ecx, %edi | ||
343 | orl %edi, %esi | ||
344 | movl 64(%esp), %edi | ||
345 | roll $10, %ebx | ||
346 | leal 1518500249(%ebp,%esi,1),%ebp | ||
347 | movl $-1, %esi | ||
348 | roll $9, %ebp | ||
349 | addl %edx, %ebp | ||
350 | /* 22 */ | ||
351 | addl %edi, %edx | ||
352 | movl %eax, %edi | ||
353 | subl %ebp, %esi | ||
354 | andl %ebp, %edi | ||
355 | andl %ebx, %esi | ||
356 | orl %esi, %edi | ||
357 | movl 16(%esp), %esi | ||
358 | roll $10, %eax | ||
359 | leal 1518500249(%edx,%edi,1),%edx | ||
360 | movl $-1, %edi | ||
361 | roll $7, %edx | ||
362 | addl %ecx, %edx | ||
363 | /* 23 */ | ||
364 | addl %esi, %ecx | ||
365 | movl %ebp, %esi | ||
366 | subl %edx, %edi | ||
367 | andl %edx, %esi | ||
368 | andl %eax, %edi | ||
369 | orl %edi, %esi | ||
370 | movl 52(%esp), %edi | ||
371 | roll $10, %ebp | ||
372 | leal 1518500249(%ecx,%esi,1),%ecx | ||
373 | movl $-1, %esi | ||
374 | roll $15, %ecx | ||
375 | addl %ebx, %ecx | ||
376 | /* 24 */ | ||
377 | addl %edi, %ebx | ||
378 | movl %edx, %edi | ||
379 | subl %ecx, %esi | ||
380 | andl %ecx, %edi | ||
381 | andl %ebp, %esi | ||
382 | orl %esi, %edi | ||
383 | movl 4(%esp), %esi | ||
384 | roll $10, %edx | ||
385 | leal 1518500249(%ebx,%edi,1),%ebx | ||
386 | movl $-1, %edi | ||
387 | roll $7, %ebx | ||
388 | addl %eax, %ebx | ||
389 | /* 25 */ | ||
390 | addl %esi, %eax | ||
391 | movl %ecx, %esi | ||
392 | subl %ebx, %edi | ||
393 | andl %ebx, %esi | ||
394 | andl %edx, %edi | ||
395 | orl %edi, %esi | ||
396 | movl 40(%esp), %edi | ||
397 | roll $10, %ecx | ||
398 | leal 1518500249(%eax,%esi,1),%eax | ||
399 | movl $-1, %esi | ||
400 | roll $12, %eax | ||
401 | addl %ebp, %eax | ||
402 | /* 26 */ | ||
403 | addl %edi, %ebp | ||
404 | movl %ebx, %edi | ||
405 | subl %eax, %esi | ||
406 | andl %eax, %edi | ||
407 | andl %ecx, %esi | ||
408 | orl %esi, %edi | ||
409 | movl 24(%esp), %esi | ||
410 | roll $10, %ebx | ||
411 | leal 1518500249(%ebp,%edi,1),%ebp | ||
412 | movl $-1, %edi | ||
413 | roll $15, %ebp | ||
414 | addl %edx, %ebp | ||
415 | /* 27 */ | ||
416 | addl %esi, %edx | ||
417 | movl %eax, %esi | ||
418 | subl %ebp, %edi | ||
419 | andl %ebp, %esi | ||
420 | andl %ebx, %edi | ||
421 | orl %edi, %esi | ||
422 | movl 12(%esp), %edi | ||
423 | roll $10, %eax | ||
424 | leal 1518500249(%edx,%esi,1),%edx | ||
425 | movl $-1, %esi | ||
426 | roll $9, %edx | ||
427 | addl %ecx, %edx | ||
428 | /* 28 */ | ||
429 | addl %edi, %ecx | ||
430 | movl %ebp, %edi | ||
431 | subl %edx, %esi | ||
432 | andl %edx, %edi | ||
433 | andl %eax, %esi | ||
434 | orl %esi, %edi | ||
435 | movl 60(%esp), %esi | ||
436 | roll $10, %ebp | ||
437 | leal 1518500249(%ecx,%edi,1),%ecx | ||
438 | movl $-1, %edi | ||
439 | roll $11, %ecx | ||
440 | addl %ebx, %ecx | ||
441 | /* 29 */ | ||
442 | addl %esi, %ebx | ||
443 | movl %edx, %esi | ||
444 | subl %ecx, %edi | ||
445 | andl %ecx, %esi | ||
446 | andl %ebp, %edi | ||
447 | orl %edi, %esi | ||
448 | movl 48(%esp), %edi | ||
449 | roll $10, %edx | ||
450 | leal 1518500249(%ebx,%esi,1),%ebx | ||
451 | movl $-1, %esi | ||
452 | roll $7, %ebx | ||
453 | addl %eax, %ebx | ||
454 | /* 30 */ | ||
455 | addl %edi, %eax | ||
456 | movl %ecx, %edi | ||
457 | subl %ebx, %esi | ||
458 | andl %ebx, %edi | ||
459 | andl %edx, %esi | ||
460 | orl %esi, %edi | ||
461 | movl 36(%esp), %esi | ||
462 | roll $10, %ecx | ||
463 | leal 1518500249(%eax,%edi,1),%eax | ||
464 | movl $-1, %edi | ||
465 | roll $13, %eax | ||
466 | addl %ebp, %eax | ||
467 | /* 31 */ | ||
468 | addl %esi, %ebp | ||
469 | movl %ebx, %esi | ||
470 | subl %eax, %edi | ||
471 | andl %eax, %esi | ||
472 | andl %ecx, %edi | ||
473 | orl %edi, %esi | ||
474 | movl $-1, %edi | ||
475 | roll $10, %ebx | ||
476 | leal 1518500249(%ebp,%esi,1),%ebp | ||
477 | subl %eax, %edi | ||
478 | roll $12, %ebp | ||
479 | addl %edx, %ebp | ||
480 | /* 32 */ | ||
481 | movl 16(%esp), %esi | ||
482 | orl %ebp, %edi | ||
483 | addl %esi, %edx | ||
484 | xorl %ebx, %edi | ||
485 | movl $-1, %esi | ||
486 | roll $10, %eax | ||
487 | leal 1859775393(%edx,%edi,1),%edx | ||
488 | subl %ebp, %esi | ||
489 | roll $11, %edx | ||
490 | addl %ecx, %edx | ||
491 | /* 33 */ | ||
492 | movl 44(%esp), %edi | ||
493 | orl %edx, %esi | ||
494 | addl %edi, %ecx | ||
495 | xorl %eax, %esi | ||
496 | movl $-1, %edi | ||
497 | roll $10, %ebp | ||
498 | leal 1859775393(%ecx,%esi,1),%ecx | ||
499 | subl %edx, %edi | ||
500 | roll $13, %ecx | ||
501 | addl %ebx, %ecx | ||
502 | /* 34 */ | ||
503 | movl 60(%esp), %esi | ||
504 | orl %ecx, %edi | ||
505 | addl %esi, %ebx | ||
506 | xorl %ebp, %edi | ||
507 | movl $-1, %esi | ||
508 | roll $10, %edx | ||
509 | leal 1859775393(%ebx,%edi,1),%ebx | ||
510 | subl %ecx, %esi | ||
511 | roll $6, %ebx | ||
512 | addl %eax, %ebx | ||
513 | /* 35 */ | ||
514 | movl 20(%esp), %edi | ||
515 | orl %ebx, %esi | ||
516 | addl %edi, %eax | ||
517 | xorl %edx, %esi | ||
518 | movl $-1, %edi | ||
519 | roll $10, %ecx | ||
520 | leal 1859775393(%eax,%esi,1),%eax | ||
521 | subl %ebx, %edi | ||
522 | roll $7, %eax | ||
523 | addl %ebp, %eax | ||
524 | /* 36 */ | ||
525 | movl 40(%esp), %esi | ||
526 | orl %eax, %edi | ||
527 | addl %esi, %ebp | ||
528 | xorl %ecx, %edi | ||
529 | movl $-1, %esi | ||
530 | roll $10, %ebx | ||
531 | leal 1859775393(%ebp,%edi,1),%ebp | ||
532 | subl %eax, %esi | ||
533 | roll $14, %ebp | ||
534 | addl %edx, %ebp | ||
535 | /* 37 */ | ||
536 | movl 64(%esp), %edi | ||
537 | orl %ebp, %esi | ||
538 | addl %edi, %edx | ||
539 | xorl %ebx, %esi | ||
540 | movl $-1, %edi | ||
541 | roll $10, %eax | ||
542 | leal 1859775393(%edx,%esi,1),%edx | ||
543 | subl %ebp, %edi | ||
544 | roll $9, %edx | ||
545 | addl %ecx, %edx | ||
546 | /* 38 */ | ||
547 | movl 36(%esp), %esi | ||
548 | orl %edx, %edi | ||
549 | addl %esi, %ecx | ||
550 | xorl %eax, %edi | ||
551 | movl $-1, %esi | ||
552 | roll $10, %ebp | ||
553 | leal 1859775393(%ecx,%edi,1),%ecx | ||
554 | subl %edx, %esi | ||
555 | roll $13, %ecx | ||
556 | addl %ebx, %ecx | ||
557 | /* 39 */ | ||
558 | movl 8(%esp), %edi | ||
559 | orl %ecx, %esi | ||
560 | addl %edi, %ebx | ||
561 | xorl %ebp, %esi | ||
562 | movl $-1, %edi | ||
563 | roll $10, %edx | ||
564 | leal 1859775393(%ebx,%esi,1),%ebx | ||
565 | subl %ecx, %edi | ||
566 | roll $15, %ebx | ||
567 | addl %eax, %ebx | ||
568 | /* 40 */ | ||
569 | movl 12(%esp), %esi | ||
570 | orl %ebx, %edi | ||
571 | addl %esi, %eax | ||
572 | xorl %edx, %edi | ||
573 | movl $-1, %esi | ||
574 | roll $10, %ecx | ||
575 | leal 1859775393(%eax,%edi,1),%eax | ||
576 | subl %ebx, %esi | ||
577 | roll $14, %eax | ||
578 | addl %ebp, %eax | ||
579 | /* 41 */ | ||
580 | movl 32(%esp), %edi | ||
581 | orl %eax, %esi | ||
582 | addl %edi, %ebp | ||
583 | xorl %ecx, %esi | ||
584 | movl $-1, %edi | ||
585 | roll $10, %ebx | ||
586 | leal 1859775393(%ebp,%esi,1),%ebp | ||
587 | subl %eax, %edi | ||
588 | roll $8, %ebp | ||
589 | addl %edx, %ebp | ||
590 | /* 42 */ | ||
591 | movl 4(%esp), %esi | ||
592 | orl %ebp, %edi | ||
593 | addl %esi, %edx | ||
594 | xorl %ebx, %edi | ||
595 | movl $-1, %esi | ||
596 | roll $10, %eax | ||
597 | leal 1859775393(%edx,%edi,1),%edx | ||
598 | subl %ebp, %esi | ||
599 | roll $13, %edx | ||
600 | addl %ecx, %edx | ||
601 | /* 43 */ | ||
602 | movl 28(%esp), %edi | ||
603 | orl %edx, %esi | ||
604 | addl %edi, %ecx | ||
605 | xorl %eax, %esi | ||
606 | movl $-1, %edi | ||
607 | roll $10, %ebp | ||
608 | leal 1859775393(%ecx,%esi,1),%ecx | ||
609 | subl %edx, %edi | ||
610 | roll $6, %ecx | ||
611 | addl %ebx, %ecx | ||
612 | /* 44 */ | ||
613 | movl 56(%esp), %esi | ||
614 | orl %ecx, %edi | ||
615 | addl %esi, %ebx | ||
616 | xorl %ebp, %edi | ||
617 | movl $-1, %esi | ||
618 | roll $10, %edx | ||
619 | leal 1859775393(%ebx,%edi,1),%ebx | ||
620 | subl %ecx, %esi | ||
621 | roll $5, %ebx | ||
622 | addl %eax, %ebx | ||
623 | /* 45 */ | ||
624 | movl 48(%esp), %edi | ||
625 | orl %ebx, %esi | ||
626 | addl %edi, %eax | ||
627 | xorl %edx, %esi | ||
628 | movl $-1, %edi | ||
629 | roll $10, %ecx | ||
630 | leal 1859775393(%eax,%esi,1),%eax | ||
631 | subl %ebx, %edi | ||
632 | roll $12, %eax | ||
633 | addl %ebp, %eax | ||
634 | /* 46 */ | ||
635 | movl 24(%esp), %esi | ||
636 | orl %eax, %edi | ||
637 | addl %esi, %ebp | ||
638 | xorl %ecx, %edi | ||
639 | movl $-1, %esi | ||
640 | roll $10, %ebx | ||
641 | leal 1859775393(%ebp,%edi,1),%ebp | ||
642 | subl %eax, %esi | ||
643 | roll $7, %ebp | ||
644 | addl %edx, %ebp | ||
645 | /* 47 */ | ||
646 | movl 52(%esp), %edi | ||
647 | orl %ebp, %esi | ||
648 | addl %edi, %edx | ||
649 | xorl %ebx, %esi | ||
650 | movl $-1, %edi | ||
651 | roll $10, %eax | ||
652 | leal 1859775393(%edx,%esi,1),%edx | ||
653 | movl %eax, %esi | ||
654 | roll $5, %edx | ||
655 | addl %ecx, %edx | ||
656 | /* 48 */ | ||
657 | subl %eax, %edi | ||
658 | andl %edx, %esi | ||
659 | andl %ebp, %edi | ||
660 | orl %esi, %edi | ||
661 | movl 8(%esp), %esi | ||
662 | roll $10, %ebp | ||
663 | leal 2400959708(%ecx,%edi,),%ecx | ||
664 | movl $-1, %edi | ||
665 | addl %esi, %ecx | ||
666 | movl %ebp, %esi | ||
667 | roll $11, %ecx | ||
668 | addl %ebx, %ecx | ||
669 | /* 49 */ | ||
670 | subl %ebp, %edi | ||
671 | andl %ecx, %esi | ||
672 | andl %edx, %edi | ||
673 | orl %esi, %edi | ||
674 | movl 40(%esp), %esi | ||
675 | roll $10, %edx | ||
676 | leal 2400959708(%ebx,%edi,),%ebx | ||
677 | movl $-1, %edi | ||
678 | addl %esi, %ebx | ||
679 | movl %edx, %esi | ||
680 | roll $12, %ebx | ||
681 | addl %eax, %ebx | ||
682 | /* 50 */ | ||
683 | subl %edx, %edi | ||
684 | andl %ebx, %esi | ||
685 | andl %ecx, %edi | ||
686 | orl %esi, %edi | ||
687 | movl 48(%esp), %esi | ||
688 | roll $10, %ecx | ||
689 | leal 2400959708(%eax,%edi,),%eax | ||
690 | movl $-1, %edi | ||
691 | addl %esi, %eax | ||
692 | movl %ecx, %esi | ||
693 | roll $14, %eax | ||
694 | addl %ebp, %eax | ||
695 | /* 51 */ | ||
696 | subl %ecx, %edi | ||
697 | andl %eax, %esi | ||
698 | andl %ebx, %edi | ||
699 | orl %esi, %edi | ||
700 | movl 44(%esp), %esi | ||
701 | roll $10, %ebx | ||
702 | leal 2400959708(%ebp,%edi,),%ebp | ||
703 | movl $-1, %edi | ||
704 | addl %esi, %ebp | ||
705 | movl %ebx, %esi | ||
706 | roll $15, %ebp | ||
707 | addl %edx, %ebp | ||
708 | /* 52 */ | ||
709 | subl %ebx, %edi | ||
710 | andl %ebp, %esi | ||
711 | andl %eax, %edi | ||
712 | orl %esi, %edi | ||
713 | movl 4(%esp), %esi | ||
714 | roll $10, %eax | ||
715 | leal 2400959708(%edx,%edi,),%edx | ||
716 | movl $-1, %edi | ||
717 | addl %esi, %edx | ||
718 | movl %eax, %esi | ||
719 | roll $14, %edx | ||
720 | addl %ecx, %edx | ||
721 | /* 53 */ | ||
722 | subl %eax, %edi | ||
723 | andl %edx, %esi | ||
724 | andl %ebp, %edi | ||
725 | orl %esi, %edi | ||
726 | movl 36(%esp), %esi | ||
727 | roll $10, %ebp | ||
728 | leal 2400959708(%ecx,%edi,),%ecx | ||
729 | movl $-1, %edi | ||
730 | addl %esi, %ecx | ||
731 | movl %ebp, %esi | ||
732 | roll $15, %ecx | ||
733 | addl %ebx, %ecx | ||
734 | /* 54 */ | ||
735 | subl %ebp, %edi | ||
736 | andl %ecx, %esi | ||
737 | andl %edx, %edi | ||
738 | orl %esi, %edi | ||
739 | movl 52(%esp), %esi | ||
740 | roll $10, %edx | ||
741 | leal 2400959708(%ebx,%edi,),%ebx | ||
742 | movl $-1, %edi | ||
743 | addl %esi, %ebx | ||
744 | movl %edx, %esi | ||
745 | roll $9, %ebx | ||
746 | addl %eax, %ebx | ||
747 | /* 55 */ | ||
748 | subl %edx, %edi | ||
749 | andl %ebx, %esi | ||
750 | andl %ecx, %edi | ||
751 | orl %esi, %edi | ||
752 | movl 20(%esp), %esi | ||
753 | roll $10, %ecx | ||
754 | leal 2400959708(%eax,%edi,),%eax | ||
755 | movl $-1, %edi | ||
756 | addl %esi, %eax | ||
757 | movl %ecx, %esi | ||
758 | roll $8, %eax | ||
759 | addl %ebp, %eax | ||
760 | /* 56 */ | ||
761 | subl %ecx, %edi | ||
762 | andl %eax, %esi | ||
763 | andl %ebx, %edi | ||
764 | orl %esi, %edi | ||
765 | movl 56(%esp), %esi | ||
766 | roll $10, %ebx | ||
767 | leal 2400959708(%ebp,%edi,),%ebp | ||
768 | movl $-1, %edi | ||
769 | addl %esi, %ebp | ||
770 | movl %ebx, %esi | ||
771 | roll $9, %ebp | ||
772 | addl %edx, %ebp | ||
773 | /* 57 */ | ||
774 | subl %ebx, %edi | ||
775 | andl %ebp, %esi | ||
776 | andl %eax, %edi | ||
777 | orl %esi, %edi | ||
778 | movl 16(%esp), %esi | ||
779 | roll $10, %eax | ||
780 | leal 2400959708(%edx,%edi,),%edx | ||
781 | movl $-1, %edi | ||
782 | addl %esi, %edx | ||
783 | movl %eax, %esi | ||
784 | roll $14, %edx | ||
785 | addl %ecx, %edx | ||
786 | /* 58 */ | ||
787 | subl %eax, %edi | ||
788 | andl %edx, %esi | ||
789 | andl %ebp, %edi | ||
790 | orl %esi, %edi | ||
791 | movl 32(%esp), %esi | ||
792 | roll $10, %ebp | ||
793 | leal 2400959708(%ecx,%edi,),%ecx | ||
794 | movl $-1, %edi | ||
795 | addl %esi, %ecx | ||
796 | movl %ebp, %esi | ||
797 | roll $5, %ecx | ||
798 | addl %ebx, %ecx | ||
799 | /* 59 */ | ||
800 | subl %ebp, %edi | ||
801 | andl %ecx, %esi | ||
802 | andl %edx, %edi | ||
803 | orl %esi, %edi | ||
804 | movl 64(%esp), %esi | ||
805 | roll $10, %edx | ||
806 | leal 2400959708(%ebx,%edi,),%ebx | ||
807 | movl $-1, %edi | ||
808 | addl %esi, %ebx | ||
809 | movl %edx, %esi | ||
810 | roll $6, %ebx | ||
811 | addl %eax, %ebx | ||
812 | /* 60 */ | ||
813 | subl %edx, %edi | ||
814 | andl %ebx, %esi | ||
815 | andl %ecx, %edi | ||
816 | orl %esi, %edi | ||
817 | movl 60(%esp), %esi | ||
818 | roll $10, %ecx | ||
819 | leal 2400959708(%eax,%edi,),%eax | ||
820 | movl $-1, %edi | ||
821 | addl %esi, %eax | ||
822 | movl %ecx, %esi | ||
823 | roll $8, %eax | ||
824 | addl %ebp, %eax | ||
825 | /* 61 */ | ||
826 | subl %ecx, %edi | ||
827 | andl %eax, %esi | ||
828 | andl %ebx, %edi | ||
829 | orl %esi, %edi | ||
830 | movl 24(%esp), %esi | ||
831 | roll $10, %ebx | ||
832 | leal 2400959708(%ebp,%edi,),%ebp | ||
833 | movl $-1, %edi | ||
834 | addl %esi, %ebp | ||
835 | movl %ebx, %esi | ||
836 | roll $6, %ebp | ||
837 | addl %edx, %ebp | ||
838 | /* 62 */ | ||
839 | subl %ebx, %edi | ||
840 | andl %ebp, %esi | ||
841 | andl %eax, %edi | ||
842 | orl %esi, %edi | ||
843 | movl 28(%esp), %esi | ||
844 | roll $10, %eax | ||
845 | leal 2400959708(%edx,%edi,),%edx | ||
846 | movl $-1, %edi | ||
847 | addl %esi, %edx | ||
848 | movl %eax, %esi | ||
849 | roll $5, %edx | ||
850 | addl %ecx, %edx | ||
851 | /* 63 */ | ||
852 | subl %eax, %edi | ||
853 | andl %edx, %esi | ||
854 | andl %ebp, %edi | ||
855 | orl %esi, %edi | ||
856 | movl 12(%esp), %esi | ||
857 | roll $10, %ebp | ||
858 | leal 2400959708(%ecx,%edi,),%ecx | ||
859 | movl $-1, %edi | ||
860 | addl %esi, %ecx | ||
861 | subl %ebp, %edi | ||
862 | roll $12, %ecx | ||
863 | addl %ebx, %ecx | ||
864 | /* 64 */ | ||
865 | movl 20(%esp), %esi | ||
866 | orl %edx, %edi | ||
867 | addl %esi, %ebx | ||
868 | xorl %ecx, %edi | ||
869 | movl $-1, %esi | ||
870 | roll $10, %edx | ||
871 | leal 2840853838(%ebx,%edi,1),%ebx | ||
872 | subl %edx, %esi | ||
873 | roll $9, %ebx | ||
874 | addl %eax, %ebx | ||
875 | /* 65 */ | ||
876 | movl 4(%esp), %edi | ||
877 | orl %ecx, %esi | ||
878 | addl %edi, %eax | ||
879 | xorl %ebx, %esi | ||
880 | movl $-1, %edi | ||
881 | roll $10, %ecx | ||
882 | leal 2840853838(%eax,%esi,1),%eax | ||
883 | subl %ecx, %edi | ||
884 | roll $15, %eax | ||
885 | addl %ebp, %eax | ||
886 | /* 66 */ | ||
887 | movl 24(%esp), %esi | ||
888 | orl %ebx, %edi | ||
889 | addl %esi, %ebp | ||
890 | xorl %eax, %edi | ||
891 | movl $-1, %esi | ||
892 | roll $10, %ebx | ||
893 | leal 2840853838(%ebp,%edi,1),%ebp | ||
894 | subl %ebx, %esi | ||
895 | roll $5, %ebp | ||
896 | addl %edx, %ebp | ||
897 | /* 67 */ | ||
898 | movl 40(%esp), %edi | ||
899 | orl %eax, %esi | ||
900 | addl %edi, %edx | ||
901 | xorl %ebp, %esi | ||
902 | movl $-1, %edi | ||
903 | roll $10, %eax | ||
904 | leal 2840853838(%edx,%esi,1),%edx | ||
905 | subl %eax, %edi | ||
906 | roll $11, %edx | ||
907 | addl %ecx, %edx | ||
908 | /* 68 */ | ||
909 | movl 32(%esp), %esi | ||
910 | orl %ebp, %edi | ||
911 | addl %esi, %ecx | ||
912 | xorl %edx, %edi | ||
913 | movl $-1, %esi | ||
914 | roll $10, %ebp | ||
915 | leal 2840853838(%ecx,%edi,1),%ecx | ||
916 | subl %ebp, %esi | ||
917 | roll $6, %ecx | ||
918 | addl %ebx, %ecx | ||
919 | /* 69 */ | ||
920 | movl 52(%esp), %edi | ||
921 | orl %edx, %esi | ||
922 | addl %edi, %ebx | ||
923 | xorl %ecx, %esi | ||
924 | movl $-1, %edi | ||
925 | roll $10, %edx | ||
926 | leal 2840853838(%ebx,%esi,1),%ebx | ||
927 | subl %edx, %edi | ||
928 | roll $8, %ebx | ||
929 | addl %eax, %ebx | ||
930 | /* 70 */ | ||
931 | movl 12(%esp), %esi | ||
932 | orl %ecx, %edi | ||
933 | addl %esi, %eax | ||
934 | xorl %ebx, %edi | ||
935 | movl $-1, %esi | ||
936 | roll $10, %ecx | ||
937 | leal 2840853838(%eax,%edi,1),%eax | ||
938 | subl %ecx, %esi | ||
939 | roll $13, %eax | ||
940 | addl %ebp, %eax | ||
941 | /* 71 */ | ||
942 | movl 44(%esp), %edi | ||
943 | orl %ebx, %esi | ||
944 | addl %edi, %ebp | ||
945 | xorl %eax, %esi | ||
946 | movl $-1, %edi | ||
947 | roll $10, %ebx | ||
948 | leal 2840853838(%ebp,%esi,1),%ebp | ||
949 | subl %ebx, %edi | ||
950 | roll $12, %ebp | ||
951 | addl %edx, %ebp | ||
952 | /* 72 */ | ||
953 | movl 60(%esp), %esi | ||
954 | orl %eax, %edi | ||
955 | addl %esi, %edx | ||
956 | xorl %ebp, %edi | ||
957 | movl $-1, %esi | ||
958 | roll $10, %eax | ||
959 | leal 2840853838(%edx,%edi,1),%edx | ||
960 | subl %eax, %esi | ||
961 | roll $5, %edx | ||
962 | addl %ecx, %edx | ||
963 | /* 73 */ | ||
964 | movl 8(%esp), %edi | ||
965 | orl %ebp, %esi | ||
966 | addl %edi, %ecx | ||
967 | xorl %edx, %esi | ||
968 | movl $-1, %edi | ||
969 | roll $10, %ebp | ||
970 | leal 2840853838(%ecx,%esi,1),%ecx | ||
971 | subl %ebp, %edi | ||
972 | roll $12, %ecx | ||
973 | addl %ebx, %ecx | ||
974 | /* 74 */ | ||
975 | movl 16(%esp), %esi | ||
976 | orl %edx, %edi | ||
977 | addl %esi, %ebx | ||
978 | xorl %ecx, %edi | ||
979 | movl $-1, %esi | ||
980 | roll $10, %edx | ||
981 | leal 2840853838(%ebx,%edi,1),%ebx | ||
982 | subl %edx, %esi | ||
983 | roll $13, %ebx | ||
984 | addl %eax, %ebx | ||
985 | /* 75 */ | ||
986 | movl 36(%esp), %edi | ||
987 | orl %ecx, %esi | ||
988 | addl %edi, %eax | ||
989 | xorl %ebx, %esi | ||
990 | movl $-1, %edi | ||
991 | roll $10, %ecx | ||
992 | leal 2840853838(%eax,%esi,1),%eax | ||
993 | subl %ecx, %edi | ||
994 | roll $14, %eax | ||
995 | addl %ebp, %eax | ||
996 | /* 76 */ | ||
997 | movl 48(%esp), %esi | ||
998 | orl %ebx, %edi | ||
999 | addl %esi, %ebp | ||
1000 | xorl %eax, %edi | ||
1001 | movl $-1, %esi | ||
1002 | roll $10, %ebx | ||
1003 | leal 2840853838(%ebp,%edi,1),%ebp | ||
1004 | subl %ebx, %esi | ||
1005 | roll $11, %ebp | ||
1006 | addl %edx, %ebp | ||
1007 | /* 77 */ | ||
1008 | movl 28(%esp), %edi | ||
1009 | orl %eax, %esi | ||
1010 | addl %edi, %edx | ||
1011 | xorl %ebp, %esi | ||
1012 | movl $-1, %edi | ||
1013 | roll $10, %eax | ||
1014 | leal 2840853838(%edx,%esi,1),%edx | ||
1015 | subl %eax, %edi | ||
1016 | roll $8, %edx | ||
1017 | addl %ecx, %edx | ||
1018 | /* 78 */ | ||
1019 | movl 64(%esp), %esi | ||
1020 | orl %ebp, %edi | ||
1021 | addl %esi, %ecx | ||
1022 | xorl %edx, %edi | ||
1023 | movl $-1, %esi | ||
1024 | roll $10, %ebp | ||
1025 | leal 2840853838(%ecx,%edi,1),%ecx | ||
1026 | subl %ebp, %esi | ||
1027 | roll $5, %ecx | ||
1028 | addl %ebx, %ecx | ||
1029 | /* 79 */ | ||
1030 | movl 56(%esp), %edi | ||
1031 | orl %edx, %esi | ||
1032 | addl %edi, %ebx | ||
1033 | xorl %ecx, %esi | ||
1034 | movl 108(%esp), %edi | ||
1035 | roll $10, %edx | ||
1036 | leal 2840853838(%ebx,%esi,1),%ebx | ||
1037 | movl %eax, 68(%esp) | ||
1038 | roll $6, %ebx | ||
1039 | addl %eax, %ebx | ||
1040 | movl (%edi), %eax | ||
1041 | movl %ebx, 72(%esp) | ||
1042 | movl %ecx, 76(%esp) | ||
1043 | movl 4(%edi), %ebx | ||
1044 | movl %edx, 80(%esp) | ||
1045 | movl 8(%edi), %ecx | ||
1046 | movl %ebp, 84(%esp) | ||
1047 | movl 12(%edi), %edx | ||
1048 | movl 16(%edi), %ebp | ||
1049 | /* 80 */ | ||
1050 | movl $-1, %edi | ||
1051 | subl %edx, %edi | ||
1052 | movl 24(%esp), %esi | ||
1053 | orl %ecx, %edi | ||
1054 | addl %esi, %eax | ||
1055 | xorl %ebx, %edi | ||
1056 | movl $-1, %esi | ||
1057 | roll $10, %ecx | ||
1058 | leal 1352829926(%eax,%edi,1),%eax | ||
1059 | subl %ecx, %esi | ||
1060 | roll $8, %eax | ||
1061 | addl %ebp, %eax | ||
1062 | /* 81 */ | ||
1063 | movl 60(%esp), %edi | ||
1064 | orl %ebx, %esi | ||
1065 | addl %edi, %ebp | ||
1066 | xorl %eax, %esi | ||
1067 | movl $-1, %edi | ||
1068 | roll $10, %ebx | ||
1069 | leal 1352829926(%ebp,%esi,1),%ebp | ||
1070 | subl %ebx, %edi | ||
1071 | roll $9, %ebp | ||
1072 | addl %edx, %ebp | ||
1073 | /* 82 */ | ||
1074 | movl 32(%esp), %esi | ||
1075 | orl %eax, %edi | ||
1076 | addl %esi, %edx | ||
1077 | xorl %ebp, %edi | ||
1078 | movl $-1, %esi | ||
1079 | roll $10, %eax | ||
1080 | leal 1352829926(%edx,%edi,1),%edx | ||
1081 | subl %eax, %esi | ||
1082 | roll $9, %edx | ||
1083 | addl %ecx, %edx | ||
1084 | /* 83 */ | ||
1085 | movl 4(%esp), %edi | ||
1086 | orl %ebp, %esi | ||
1087 | addl %edi, %ecx | ||
1088 | xorl %edx, %esi | ||
1089 | movl $-1, %edi | ||
1090 | roll $10, %ebp | ||
1091 | leal 1352829926(%ecx,%esi,1),%ecx | ||
1092 | subl %ebp, %edi | ||
1093 | roll $11, %ecx | ||
1094 | addl %ebx, %ecx | ||
1095 | /* 84 */ | ||
1096 | movl 40(%esp), %esi | ||
1097 | orl %edx, %edi | ||
1098 | addl %esi, %ebx | ||
1099 | xorl %ecx, %edi | ||
1100 | movl $-1, %esi | ||
1101 | roll $10, %edx | ||
1102 | leal 1352829926(%ebx,%edi,1),%ebx | ||
1103 | subl %edx, %esi | ||
1104 | roll $13, %ebx | ||
1105 | addl %eax, %ebx | ||
1106 | /* 85 */ | ||
1107 | movl 12(%esp), %edi | ||
1108 | orl %ecx, %esi | ||
1109 | addl %edi, %eax | ||
1110 | xorl %ebx, %esi | ||
1111 | movl $-1, %edi | ||
1112 | roll $10, %ecx | ||
1113 | leal 1352829926(%eax,%esi,1),%eax | ||
1114 | subl %ecx, %edi | ||
1115 | roll $15, %eax | ||
1116 | addl %ebp, %eax | ||
1117 | /* 86 */ | ||
1118 | movl 48(%esp), %esi | ||
1119 | orl %ebx, %edi | ||
1120 | addl %esi, %ebp | ||
1121 | xorl %eax, %edi | ||
1122 | movl $-1, %esi | ||
1123 | roll $10, %ebx | ||
1124 | leal 1352829926(%ebp,%edi,1),%ebp | ||
1125 | subl %ebx, %esi | ||
1126 | roll $15, %ebp | ||
1127 | addl %edx, %ebp | ||
1128 | /* 87 */ | ||
1129 | movl 20(%esp), %edi | ||
1130 | orl %eax, %esi | ||
1131 | addl %edi, %edx | ||
1132 | xorl %ebp, %esi | ||
1133 | movl $-1, %edi | ||
1134 | roll $10, %eax | ||
1135 | leal 1352829926(%edx,%esi,1),%edx | ||
1136 | subl %eax, %edi | ||
1137 | roll $5, %edx | ||
1138 | addl %ecx, %edx | ||
1139 | /* 88 */ | ||
1140 | movl 56(%esp), %esi | ||
1141 | orl %ebp, %edi | ||
1142 | addl %esi, %ecx | ||
1143 | xorl %edx, %edi | ||
1144 | movl $-1, %esi | ||
1145 | roll $10, %ebp | ||
1146 | leal 1352829926(%ecx,%edi,1),%ecx | ||
1147 | subl %ebp, %esi | ||
1148 | roll $7, %ecx | ||
1149 | addl %ebx, %ecx | ||
1150 | /* 89 */ | ||
1151 | movl 28(%esp), %edi | ||
1152 | orl %edx, %esi | ||
1153 | addl %edi, %ebx | ||
1154 | xorl %ecx, %esi | ||
1155 | movl $-1, %edi | ||
1156 | roll $10, %edx | ||
1157 | leal 1352829926(%ebx,%esi,1),%ebx | ||
1158 | subl %edx, %edi | ||
1159 | roll $7, %ebx | ||
1160 | addl %eax, %ebx | ||
1161 | /* 90 */ | ||
1162 | movl 64(%esp), %esi | ||
1163 | orl %ecx, %edi | ||
1164 | addl %esi, %eax | ||
1165 | xorl %ebx, %edi | ||
1166 | movl $-1, %esi | ||
1167 | roll $10, %ecx | ||
1168 | leal 1352829926(%eax,%edi,1),%eax | ||
1169 | subl %ecx, %esi | ||
1170 | roll $8, %eax | ||
1171 | addl %ebp, %eax | ||
1172 | /* 91 */ | ||
1173 | movl 36(%esp), %edi | ||
1174 | orl %ebx, %esi | ||
1175 | addl %edi, %ebp | ||
1176 | xorl %eax, %esi | ||
1177 | movl $-1, %edi | ||
1178 | roll $10, %ebx | ||
1179 | leal 1352829926(%ebp,%esi,1),%ebp | ||
1180 | subl %ebx, %edi | ||
1181 | roll $11, %ebp | ||
1182 | addl %edx, %ebp | ||
1183 | /* 92 */ | ||
1184 | movl 8(%esp), %esi | ||
1185 | orl %eax, %edi | ||
1186 | addl %esi, %edx | ||
1187 | xorl %ebp, %edi | ||
1188 | movl $-1, %esi | ||
1189 | roll $10, %eax | ||
1190 | leal 1352829926(%edx,%edi,1),%edx | ||
1191 | subl %eax, %esi | ||
1192 | roll $14, %edx | ||
1193 | addl %ecx, %edx | ||
1194 | /* 93 */ | ||
1195 | movl 44(%esp), %edi | ||
1196 | orl %ebp, %esi | ||
1197 | addl %edi, %ecx | ||
1198 | xorl %edx, %esi | ||
1199 | movl $-1, %edi | ||
1200 | roll $10, %ebp | ||
1201 | leal 1352829926(%ecx,%esi,1),%ecx | ||
1202 | subl %ebp, %edi | ||
1203 | roll $14, %ecx | ||
1204 | addl %ebx, %ecx | ||
1205 | /* 94 */ | ||
1206 | movl 16(%esp), %esi | ||
1207 | orl %edx, %edi | ||
1208 | addl %esi, %ebx | ||
1209 | xorl %ecx, %edi | ||
1210 | movl $-1, %esi | ||
1211 | roll $10, %edx | ||
1212 | leal 1352829926(%ebx,%edi,1),%ebx | ||
1213 | subl %edx, %esi | ||
1214 | roll $12, %ebx | ||
1215 | addl %eax, %ebx | ||
1216 | /* 95 */ | ||
1217 | movl 52(%esp), %edi | ||
1218 | orl %ecx, %esi | ||
1219 | addl %edi, %eax | ||
1220 | xorl %ebx, %esi | ||
1221 | movl $-1, %edi | ||
1222 | roll $10, %ecx | ||
1223 | leal 1352829926(%eax,%esi,1),%eax | ||
1224 | movl %ecx, %esi | ||
1225 | roll $6, %eax | ||
1226 | addl %ebp, %eax | ||
1227 | /* 96 */ | ||
1228 | subl %ecx, %edi | ||
1229 | andl %eax, %esi | ||
1230 | andl %ebx, %edi | ||
1231 | orl %esi, %edi | ||
1232 | movl 28(%esp), %esi | ||
1233 | roll $10, %ebx | ||
1234 | leal 1548603684(%ebp,%edi,),%ebp | ||
1235 | movl $-1, %edi | ||
1236 | addl %esi, %ebp | ||
1237 | movl %ebx, %esi | ||
1238 | roll $9, %ebp | ||
1239 | addl %edx, %ebp | ||
1240 | /* 97 */ | ||
1241 | subl %ebx, %edi | ||
1242 | andl %ebp, %esi | ||
1243 | andl %eax, %edi | ||
1244 | orl %esi, %edi | ||
1245 | movl 48(%esp), %esi | ||
1246 | roll $10, %eax | ||
1247 | leal 1548603684(%edx,%edi,),%edx | ||
1248 | movl $-1, %edi | ||
1249 | addl %esi, %edx | ||
1250 | movl %eax, %esi | ||
1251 | roll $13, %edx | ||
1252 | addl %ecx, %edx | ||
1253 | /* 98 */ | ||
1254 | subl %eax, %edi | ||
1255 | andl %edx, %esi | ||
1256 | andl %ebp, %edi | ||
1257 | orl %esi, %edi | ||
1258 | movl 16(%esp), %esi | ||
1259 | roll $10, %ebp | ||
1260 | leal 1548603684(%ecx,%edi,),%ecx | ||
1261 | movl $-1, %edi | ||
1262 | addl %esi, %ecx | ||
1263 | movl %ebp, %esi | ||
1264 | roll $15, %ecx | ||
1265 | addl %ebx, %ecx | ||
1266 | /* 99 */ | ||
1267 | subl %ebp, %edi | ||
1268 | andl %ecx, %esi | ||
1269 | andl %edx, %edi | ||
1270 | orl %esi, %edi | ||
1271 | movl 32(%esp), %esi | ||
1272 | roll $10, %edx | ||
1273 | leal 1548603684(%ebx,%edi,),%ebx | ||
1274 | movl $-1, %edi | ||
1275 | addl %esi, %ebx | ||
1276 | movl %edx, %esi | ||
1277 | roll $7, %ebx | ||
1278 | addl %eax, %ebx | ||
1279 | /* 100 */ | ||
1280 | subl %edx, %edi | ||
1281 | andl %ebx, %esi | ||
1282 | andl %ecx, %edi | ||
1283 | orl %esi, %edi | ||
1284 | movl 4(%esp), %esi | ||
1285 | roll $10, %ecx | ||
1286 | leal 1548603684(%eax,%edi,),%eax | ||
1287 | movl $-1, %edi | ||
1288 | addl %esi, %eax | ||
1289 | movl %ecx, %esi | ||
1290 | roll $12, %eax | ||
1291 | addl %ebp, %eax | ||
1292 | /* 101 */ | ||
1293 | subl %ecx, %edi | ||
1294 | andl %eax, %esi | ||
1295 | andl %ebx, %edi | ||
1296 | orl %esi, %edi | ||
1297 | movl 56(%esp), %esi | ||
1298 | roll $10, %ebx | ||
1299 | leal 1548603684(%ebp,%edi,),%ebp | ||
1300 | movl $-1, %edi | ||
1301 | addl %esi, %ebp | ||
1302 | movl %ebx, %esi | ||
1303 | roll $8, %ebp | ||
1304 | addl %edx, %ebp | ||
1305 | /* 102 */ | ||
1306 | subl %ebx, %edi | ||
1307 | andl %ebp, %esi | ||
1308 | andl %eax, %edi | ||
1309 | orl %esi, %edi | ||
1310 | movl 24(%esp), %esi | ||
1311 | roll $10, %eax | ||
1312 | leal 1548603684(%edx,%edi,),%edx | ||
1313 | movl $-1, %edi | ||
1314 | addl %esi, %edx | ||
1315 | movl %eax, %esi | ||
1316 | roll $9, %edx | ||
1317 | addl %ecx, %edx | ||
1318 | /* 103 */ | ||
1319 | subl %eax, %edi | ||
1320 | andl %edx, %esi | ||
1321 | andl %ebp, %edi | ||
1322 | orl %esi, %edi | ||
1323 | movl 44(%esp), %esi | ||
1324 | roll $10, %ebp | ||
1325 | leal 1548603684(%ecx,%edi,),%ecx | ||
1326 | movl $-1, %edi | ||
1327 | addl %esi, %ecx | ||
1328 | movl %ebp, %esi | ||
1329 | roll $11, %ecx | ||
1330 | addl %ebx, %ecx | ||
1331 | /* 104 */ | ||
1332 | subl %ebp, %edi | ||
1333 | andl %ecx, %esi | ||
1334 | andl %edx, %edi | ||
1335 | orl %esi, %edi | ||
1336 | movl 60(%esp), %esi | ||
1337 | roll $10, %edx | ||
1338 | leal 1548603684(%ebx,%edi,),%ebx | ||
1339 | movl $-1, %edi | ||
1340 | addl %esi, %ebx | ||
1341 | movl %edx, %esi | ||
1342 | roll $7, %ebx | ||
1343 | addl %eax, %ebx | ||
1344 | /* 105 */ | ||
1345 | subl %edx, %edi | ||
1346 | andl %ebx, %esi | ||
1347 | andl %ecx, %edi | ||
1348 | orl %esi, %edi | ||
1349 | movl 64(%esp), %esi | ||
1350 | roll $10, %ecx | ||
1351 | leal 1548603684(%eax,%edi,),%eax | ||
1352 | movl $-1, %edi | ||
1353 | addl %esi, %eax | ||
1354 | movl %ecx, %esi | ||
1355 | roll $7, %eax | ||
1356 | addl %ebp, %eax | ||
1357 | /* 106 */ | ||
1358 | subl %ecx, %edi | ||
1359 | andl %eax, %esi | ||
1360 | andl %ebx, %edi | ||
1361 | orl %esi, %edi | ||
1362 | movl 36(%esp), %esi | ||
1363 | roll $10, %ebx | ||
1364 | leal 1548603684(%ebp,%edi,),%ebp | ||
1365 | movl $-1, %edi | ||
1366 | addl %esi, %ebp | ||
1367 | movl %ebx, %esi | ||
1368 | roll $12, %ebp | ||
1369 | addl %edx, %ebp | ||
1370 | /* 107 */ | ||
1371 | subl %ebx, %edi | ||
1372 | andl %ebp, %esi | ||
1373 | andl %eax, %edi | ||
1374 | orl %esi, %edi | ||
1375 | movl 52(%esp), %esi | ||
1376 | roll $10, %eax | ||
1377 | leal 1548603684(%edx,%edi,),%edx | ||
1378 | movl $-1, %edi | ||
1379 | addl %esi, %edx | ||
1380 | movl %eax, %esi | ||
1381 | roll $7, %edx | ||
1382 | addl %ecx, %edx | ||
1383 | /* 108 */ | ||
1384 | subl %eax, %edi | ||
1385 | andl %edx, %esi | ||
1386 | andl %ebp, %edi | ||
1387 | orl %esi, %edi | ||
1388 | movl 20(%esp), %esi | ||
1389 | roll $10, %ebp | ||
1390 | leal 1548603684(%ecx,%edi,),%ecx | ||
1391 | movl $-1, %edi | ||
1392 | addl %esi, %ecx | ||
1393 | movl %ebp, %esi | ||
1394 | roll $6, %ecx | ||
1395 | addl %ebx, %ecx | ||
1396 | /* 109 */ | ||
1397 | subl %ebp, %edi | ||
1398 | andl %ecx, %esi | ||
1399 | andl %edx, %edi | ||
1400 | orl %esi, %edi | ||
1401 | movl 40(%esp), %esi | ||
1402 | roll $10, %edx | ||
1403 | leal 1548603684(%ebx,%edi,),%ebx | ||
1404 | movl $-1, %edi | ||
1405 | addl %esi, %ebx | ||
1406 | movl %edx, %esi | ||
1407 | roll $15, %ebx | ||
1408 | addl %eax, %ebx | ||
1409 | /* 110 */ | ||
1410 | subl %edx, %edi | ||
1411 | andl %ebx, %esi | ||
1412 | andl %ecx, %edi | ||
1413 | orl %esi, %edi | ||
1414 | movl 8(%esp), %esi | ||
1415 | roll $10, %ecx | ||
1416 | leal 1548603684(%eax,%edi,),%eax | ||
1417 | movl $-1, %edi | ||
1418 | addl %esi, %eax | ||
1419 | movl %ecx, %esi | ||
1420 | roll $13, %eax | ||
1421 | addl %ebp, %eax | ||
1422 | /* 111 */ | ||
1423 | subl %ecx, %edi | ||
1424 | andl %eax, %esi | ||
1425 | andl %ebx, %edi | ||
1426 | orl %esi, %edi | ||
1427 | movl 12(%esp), %esi | ||
1428 | roll $10, %ebx | ||
1429 | leal 1548603684(%ebp,%edi,),%ebp | ||
1430 | movl $-1, %edi | ||
1431 | addl %esi, %ebp | ||
1432 | subl %eax, %edi | ||
1433 | roll $11, %ebp | ||
1434 | addl %edx, %ebp | ||
1435 | /* 112 */ | ||
1436 | movl 64(%esp), %esi | ||
1437 | orl %ebp, %edi | ||
1438 | addl %esi, %edx | ||
1439 | xorl %ebx, %edi | ||
1440 | movl $-1, %esi | ||
1441 | roll $10, %eax | ||
1442 | leal 1836072691(%edx,%edi,1),%edx | ||
1443 | subl %ebp, %esi | ||
1444 | roll $9, %edx | ||
1445 | addl %ecx, %edx | ||
1446 | /* 113 */ | ||
1447 | movl 24(%esp), %edi | ||
1448 | orl %edx, %esi | ||
1449 | addl %edi, %ecx | ||
1450 | xorl %eax, %esi | ||
1451 | movl $-1, %edi | ||
1452 | roll $10, %ebp | ||
1453 | leal 1836072691(%ecx,%esi,1),%ecx | ||
1454 | subl %edx, %edi | ||
1455 | roll $7, %ecx | ||
1456 | addl %ebx, %ecx | ||
1457 | /* 114 */ | ||
1458 | movl 8(%esp), %esi | ||
1459 | orl %ecx, %edi | ||
1460 | addl %esi, %ebx | ||
1461 | xorl %ebp, %edi | ||
1462 | movl $-1, %esi | ||
1463 | roll $10, %edx | ||
1464 | leal 1836072691(%ebx,%edi,1),%ebx | ||
1465 | subl %ecx, %esi | ||
1466 | roll $15, %ebx | ||
1467 | addl %eax, %ebx | ||
1468 | /* 115 */ | ||
1469 | movl 16(%esp), %edi | ||
1470 | orl %ebx, %esi | ||
1471 | addl %edi, %eax | ||
1472 | xorl %edx, %esi | ||
1473 | movl $-1, %edi | ||
1474 | roll $10, %ecx | ||
1475 | leal 1836072691(%eax,%esi,1),%eax | ||
1476 | subl %ebx, %edi | ||
1477 | roll $11, %eax | ||
1478 | addl %ebp, %eax | ||
1479 | /* 116 */ | ||
1480 | movl 32(%esp), %esi | ||
1481 | orl %eax, %edi | ||
1482 | addl %esi, %ebp | ||
1483 | xorl %ecx, %edi | ||
1484 | movl $-1, %esi | ||
1485 | roll $10, %ebx | ||
1486 | leal 1836072691(%ebp,%edi,1),%ebp | ||
1487 | subl %eax, %esi | ||
1488 | roll $8, %ebp | ||
1489 | addl %edx, %ebp | ||
1490 | /* 117 */ | ||
1491 | movl 60(%esp), %edi | ||
1492 | orl %ebp, %esi | ||
1493 | addl %edi, %edx | ||
1494 | xorl %ebx, %esi | ||
1495 | movl $-1, %edi | ||
1496 | roll $10, %eax | ||
1497 | leal 1836072691(%edx,%esi,1),%edx | ||
1498 | subl %ebp, %edi | ||
1499 | roll $6, %edx | ||
1500 | addl %ecx, %edx | ||
1501 | /* 118 */ | ||
1502 | movl 28(%esp), %esi | ||
1503 | orl %edx, %edi | ||
1504 | addl %esi, %ecx | ||
1505 | xorl %eax, %edi | ||
1506 | movl $-1, %esi | ||
1507 | roll $10, %ebp | ||
1508 | leal 1836072691(%ecx,%edi,1),%ecx | ||
1509 | subl %edx, %esi | ||
1510 | roll $6, %ecx | ||
1511 | addl %ebx, %ecx | ||
1512 | /* 119 */ | ||
1513 | movl 40(%esp), %edi | ||
1514 | orl %ecx, %esi | ||
1515 | addl %edi, %ebx | ||
1516 | xorl %ebp, %esi | ||
1517 | movl $-1, %edi | ||
1518 | roll $10, %edx | ||
1519 | leal 1836072691(%ebx,%esi,1),%ebx | ||
1520 | subl %ecx, %edi | ||
1521 | roll $14, %ebx | ||
1522 | addl %eax, %ebx | ||
1523 | /* 120 */ | ||
1524 | movl 48(%esp), %esi | ||
1525 | orl %ebx, %edi | ||
1526 | addl %esi, %eax | ||
1527 | xorl %edx, %edi | ||
1528 | movl $-1, %esi | ||
1529 | roll $10, %ecx | ||
1530 | leal 1836072691(%eax,%edi,1),%eax | ||
1531 | subl %ebx, %esi | ||
1532 | roll $12, %eax | ||
1533 | addl %ebp, %eax | ||
1534 | /* 121 */ | ||
1535 | movl 36(%esp), %edi | ||
1536 | orl %eax, %esi | ||
1537 | addl %edi, %ebp | ||
1538 | xorl %ecx, %esi | ||
1539 | movl $-1, %edi | ||
1540 | roll $10, %ebx | ||
1541 | leal 1836072691(%ebp,%esi,1),%ebp | ||
1542 | subl %eax, %edi | ||
1543 | roll $13, %ebp | ||
1544 | addl %edx, %ebp | ||
1545 | /* 122 */ | ||
1546 | movl 52(%esp), %esi | ||
1547 | orl %ebp, %edi | ||
1548 | addl %esi, %edx | ||
1549 | xorl %ebx, %edi | ||
1550 | movl $-1, %esi | ||
1551 | roll $10, %eax | ||
1552 | leal 1836072691(%edx,%edi,1),%edx | ||
1553 | subl %ebp, %esi | ||
1554 | roll $5, %edx | ||
1555 | addl %ecx, %edx | ||
1556 | /* 123 */ | ||
1557 | movl 12(%esp), %edi | ||
1558 | orl %edx, %esi | ||
1559 | addl %edi, %ecx | ||
1560 | xorl %eax, %esi | ||
1561 | movl $-1, %edi | ||
1562 | roll $10, %ebp | ||
1563 | leal 1836072691(%ecx,%esi,1),%ecx | ||
1564 | subl %edx, %edi | ||
1565 | roll $14, %ecx | ||
1566 | addl %ebx, %ecx | ||
1567 | /* 124 */ | ||
1568 | movl 44(%esp), %esi | ||
1569 | orl %ecx, %edi | ||
1570 | addl %esi, %ebx | ||
1571 | xorl %ebp, %edi | ||
1572 | movl $-1, %esi | ||
1573 | roll $10, %edx | ||
1574 | leal 1836072691(%ebx,%edi,1),%ebx | ||
1575 | subl %ecx, %esi | ||
1576 | roll $13, %ebx | ||
1577 | addl %eax, %ebx | ||
1578 | /* 125 */ | ||
1579 | movl 4(%esp), %edi | ||
1580 | orl %ebx, %esi | ||
1581 | addl %edi, %eax | ||
1582 | xorl %edx, %esi | ||
1583 | movl $-1, %edi | ||
1584 | roll $10, %ecx | ||
1585 | leal 1836072691(%eax,%esi,1),%eax | ||
1586 | subl %ebx, %edi | ||
1587 | roll $13, %eax | ||
1588 | addl %ebp, %eax | ||
1589 | /* 126 */ | ||
1590 | movl 20(%esp), %esi | ||
1591 | orl %eax, %edi | ||
1592 | addl %esi, %ebp | ||
1593 | xorl %ecx, %edi | ||
1594 | movl $-1, %esi | ||
1595 | roll $10, %ebx | ||
1596 | leal 1836072691(%ebp,%edi,1),%ebp | ||
1597 | subl %eax, %esi | ||
1598 | roll $7, %ebp | ||
1599 | addl %edx, %ebp | ||
1600 | /* 127 */ | ||
1601 | movl 56(%esp), %edi | ||
1602 | orl %ebp, %esi | ||
1603 | addl %edi, %edx | ||
1604 | xorl %ebx, %esi | ||
1605 | movl 36(%esp), %edi | ||
1606 | roll $10, %eax | ||
1607 | leal 1836072691(%edx,%esi,1),%edx | ||
1608 | movl $-1, %esi | ||
1609 | roll $5, %edx | ||
1610 | addl %ecx, %edx | ||
1611 | /* 128 */ | ||
1612 | addl %edi, %ecx | ||
1613 | movl %ebp, %edi | ||
1614 | subl %edx, %esi | ||
1615 | andl %edx, %edi | ||
1616 | andl %eax, %esi | ||
1617 | orl %esi, %edi | ||
1618 | movl 28(%esp), %esi | ||
1619 | roll $10, %ebp | ||
1620 | leal 2053994217(%ecx,%edi,1),%ecx | ||
1621 | movl $-1, %edi | ||
1622 | roll $15, %ecx | ||
1623 | addl %ebx, %ecx | ||
1624 | /* 129 */ | ||
1625 | addl %esi, %ebx | ||
1626 | movl %edx, %esi | ||
1627 | subl %ecx, %edi | ||
1628 | andl %ecx, %esi | ||
1629 | andl %ebp, %edi | ||
1630 | orl %edi, %esi | ||
1631 | movl 20(%esp), %edi | ||
1632 | roll $10, %edx | ||
1633 | leal 2053994217(%ebx,%esi,1),%ebx | ||
1634 | movl $-1, %esi | ||
1635 | roll $5, %ebx | ||
1636 | addl %eax, %ebx | ||
1637 | /* 130 */ | ||
1638 | addl %edi, %eax | ||
1639 | movl %ecx, %edi | ||
1640 | subl %ebx, %esi | ||
1641 | andl %ebx, %edi | ||
1642 | andl %edx, %esi | ||
1643 | orl %esi, %edi | ||
1644 | movl 8(%esp), %esi | ||
1645 | roll $10, %ecx | ||
1646 | leal 2053994217(%eax,%edi,1),%eax | ||
1647 | movl $-1, %edi | ||
1648 | roll $8, %eax | ||
1649 | addl %ebp, %eax | ||
1650 | /* 131 */ | ||
1651 | addl %esi, %ebp | ||
1652 | movl %ebx, %esi | ||
1653 | subl %eax, %edi | ||
1654 | andl %eax, %esi | ||
1655 | andl %ecx, %edi | ||
1656 | orl %edi, %esi | ||
1657 | movl 16(%esp), %edi | ||
1658 | roll $10, %ebx | ||
1659 | leal 2053994217(%ebp,%esi,1),%ebp | ||
1660 | movl $-1, %esi | ||
1661 | roll $11, %ebp | ||
1662 | addl %edx, %ebp | ||
1663 | /* 132 */ | ||
1664 | addl %edi, %edx | ||
1665 | movl %eax, %edi | ||
1666 | subl %ebp, %esi | ||
1667 | andl %ebp, %edi | ||
1668 | andl %ebx, %esi | ||
1669 | orl %esi, %edi | ||
1670 | movl 48(%esp), %esi | ||
1671 | roll $10, %eax | ||
1672 | leal 2053994217(%edx,%edi,1),%edx | ||
1673 | movl $-1, %edi | ||
1674 | roll $14, %edx | ||
1675 | addl %ecx, %edx | ||
1676 | /* 133 */ | ||
1677 | addl %esi, %ecx | ||
1678 | movl %ebp, %esi | ||
1679 | subl %edx, %edi | ||
1680 | andl %edx, %esi | ||
1681 | andl %eax, %edi | ||
1682 | orl %edi, %esi | ||
1683 | movl 64(%esp), %edi | ||
1684 | roll $10, %ebp | ||
1685 | leal 2053994217(%ecx,%esi,1),%ecx | ||
1686 | movl $-1, %esi | ||
1687 | roll $14, %ecx | ||
1688 | addl %ebx, %ecx | ||
1689 | /* 134 */ | ||
1690 | addl %edi, %ebx | ||
1691 | movl %edx, %edi | ||
1692 | subl %ecx, %esi | ||
1693 | andl %ecx, %edi | ||
1694 | andl %ebp, %esi | ||
1695 | orl %esi, %edi | ||
1696 | movl 4(%esp), %esi | ||
1697 | roll $10, %edx | ||
1698 | leal 2053994217(%ebx,%edi,1),%ebx | ||
1699 | movl $-1, %edi | ||
1700 | roll $6, %ebx | ||
1701 | addl %eax, %ebx | ||
1702 | /* 135 */ | ||
1703 | addl %esi, %eax | ||
1704 | movl %ecx, %esi | ||
1705 | subl %ebx, %edi | ||
1706 | andl %ebx, %esi | ||
1707 | andl %edx, %edi | ||
1708 | orl %edi, %esi | ||
1709 | movl 24(%esp), %edi | ||
1710 | roll $10, %ecx | ||
1711 | leal 2053994217(%eax,%esi,1),%eax | ||
1712 | movl $-1, %esi | ||
1713 | roll $14, %eax | ||
1714 | addl %ebp, %eax | ||
1715 | /* 136 */ | ||
1716 | addl %edi, %ebp | ||
1717 | movl %ebx, %edi | ||
1718 | subl %eax, %esi | ||
1719 | andl %eax, %edi | ||
1720 | andl %ecx, %esi | ||
1721 | orl %esi, %edi | ||
1722 | movl 52(%esp), %esi | ||
1723 | roll $10, %ebx | ||
1724 | leal 2053994217(%ebp,%edi,1),%ebp | ||
1725 | movl $-1, %edi | ||
1726 | roll $6, %ebp | ||
1727 | addl %edx, %ebp | ||
1728 | /* 137 */ | ||
1729 | addl %esi, %edx | ||
1730 | movl %eax, %esi | ||
1731 | subl %ebp, %edi | ||
1732 | andl %ebp, %esi | ||
1733 | andl %ebx, %edi | ||
1734 | orl %edi, %esi | ||
1735 | movl 12(%esp), %edi | ||
1736 | roll $10, %eax | ||
1737 | leal 2053994217(%edx,%esi,1),%edx | ||
1738 | movl $-1, %esi | ||
1739 | roll $9, %edx | ||
1740 | addl %ecx, %edx | ||
1741 | /* 138 */ | ||
1742 | addl %edi, %ecx | ||
1743 | movl %ebp, %edi | ||
1744 | subl %edx, %esi | ||
1745 | andl %edx, %edi | ||
1746 | andl %eax, %esi | ||
1747 | orl %esi, %edi | ||
1748 | movl 56(%esp), %esi | ||
1749 | roll $10, %ebp | ||
1750 | leal 2053994217(%ecx,%edi,1),%ecx | ||
1751 | movl $-1, %edi | ||
1752 | roll $12, %ecx | ||
1753 | addl %ebx, %ecx | ||
1754 | /* 139 */ | ||
1755 | addl %esi, %ebx | ||
1756 | movl %edx, %esi | ||
1757 | subl %ecx, %edi | ||
1758 | andl %ecx, %esi | ||
1759 | andl %ebp, %edi | ||
1760 | orl %edi, %esi | ||
1761 | movl 40(%esp), %edi | ||
1762 | roll $10, %edx | ||
1763 | leal 2053994217(%ebx,%esi,1),%ebx | ||
1764 | movl $-1, %esi | ||
1765 | roll $9, %ebx | ||
1766 | addl %eax, %ebx | ||
1767 | /* 140 */ | ||
1768 | addl %edi, %eax | ||
1769 | movl %ecx, %edi | ||
1770 | subl %ebx, %esi | ||
1771 | andl %ebx, %edi | ||
1772 | andl %edx, %esi | ||
1773 | orl %esi, %edi | ||
1774 | movl 32(%esp), %esi | ||
1775 | roll $10, %ecx | ||
1776 | leal 2053994217(%eax,%edi,1),%eax | ||
1777 | movl $-1, %edi | ||
1778 | roll $12, %eax | ||
1779 | addl %ebp, %eax | ||
1780 | /* 141 */ | ||
1781 | addl %esi, %ebp | ||
1782 | movl %ebx, %esi | ||
1783 | subl %eax, %edi | ||
1784 | andl %eax, %esi | ||
1785 | andl %ecx, %edi | ||
1786 | orl %edi, %esi | ||
1787 | movl 44(%esp), %edi | ||
1788 | roll $10, %ebx | ||
1789 | leal 2053994217(%ebp,%esi,1),%ebp | ||
1790 | movl $-1, %esi | ||
1791 | roll $5, %ebp | ||
1792 | addl %edx, %ebp | ||
1793 | /* 142 */ | ||
1794 | addl %edi, %edx | ||
1795 | movl %eax, %edi | ||
1796 | subl %ebp, %esi | ||
1797 | andl %ebp, %edi | ||
1798 | andl %ebx, %esi | ||
1799 | orl %esi, %edi | ||
1800 | movl 60(%esp), %esi | ||
1801 | roll $10, %eax | ||
1802 | leal 2053994217(%edx,%edi,1),%edx | ||
1803 | movl $-1, %edi | ||
1804 | roll $15, %edx | ||
1805 | addl %ecx, %edx | ||
1806 | /* 143 */ | ||
1807 | addl %esi, %ecx | ||
1808 | movl %ebp, %esi | ||
1809 | subl %edx, %edi | ||
1810 | andl %edx, %esi | ||
1811 | andl %eax, %edi | ||
1812 | orl %esi, %edi | ||
1813 | movl %edx, %esi | ||
1814 | roll $10, %ebp | ||
1815 | leal 2053994217(%ecx,%edi,1),%ecx | ||
1816 | xorl %ebp, %esi | ||
1817 | roll $8, %ecx | ||
1818 | addl %ebx, %ecx | ||
1819 | /* 144 */ | ||
1820 | movl 52(%esp), %edi | ||
1821 | xorl %ecx, %esi | ||
1822 | addl %edi, %ebx | ||
1823 | roll $10, %edx | ||
1824 | addl %esi, %ebx | ||
1825 | movl %ecx, %esi | ||
1826 | roll $8, %ebx | ||
1827 | addl %eax, %ebx | ||
1828 | /* 145 */ | ||
1829 | xorl %edx, %esi | ||
1830 | movl 64(%esp), %edi | ||
1831 | xorl %ebx, %esi | ||
1832 | addl %esi, %eax | ||
1833 | movl %ebx, %esi | ||
1834 | roll $10, %ecx | ||
1835 | addl %edi, %eax | ||
1836 | xorl %ecx, %esi | ||
1837 | roll $5, %eax | ||
1838 | addl %ebp, %eax | ||
1839 | /* 146 */ | ||
1840 | movl 44(%esp), %edi | ||
1841 | xorl %eax, %esi | ||
1842 | addl %edi, %ebp | ||
1843 | roll $10, %ebx | ||
1844 | addl %esi, %ebp | ||
1845 | movl %eax, %esi | ||
1846 | roll $12, %ebp | ||
1847 | addl %edx, %ebp | ||
1848 | /* 147 */ | ||
1849 | xorl %ebx, %esi | ||
1850 | movl 20(%esp), %edi | ||
1851 | xorl %ebp, %esi | ||
1852 | addl %esi, %edx | ||
1853 | movl %ebp, %esi | ||
1854 | roll $10, %eax | ||
1855 | addl %edi, %edx | ||
1856 | xorl %eax, %esi | ||
1857 | roll $9, %edx | ||
1858 | addl %ecx, %edx | ||
1859 | /* 148 */ | ||
1860 | movl 8(%esp), %edi | ||
1861 | xorl %edx, %esi | ||
1862 | addl %edi, %ecx | ||
1863 | roll $10, %ebp | ||
1864 | addl %esi, %ecx | ||
1865 | movl %edx, %esi | ||
1866 | roll $12, %ecx | ||
1867 | addl %ebx, %ecx | ||
1868 | /* 149 */ | ||
1869 | xorl %ebp, %esi | ||
1870 | movl 24(%esp), %edi | ||
1871 | xorl %ecx, %esi | ||
1872 | addl %esi, %ebx | ||
1873 | movl %ecx, %esi | ||
1874 | roll $10, %edx | ||
1875 | addl %edi, %ebx | ||
1876 | xorl %edx, %esi | ||
1877 | roll $5, %ebx | ||
1878 | addl %eax, %ebx | ||
1879 | /* 150 */ | ||
1880 | movl 36(%esp), %edi | ||
1881 | xorl %ebx, %esi | ||
1882 | addl %edi, %eax | ||
1883 | roll $10, %ecx | ||
1884 | addl %esi, %eax | ||
1885 | movl %ebx, %esi | ||
1886 | roll $14, %eax | ||
1887 | addl %ebp, %eax | ||
1888 | /* 151 */ | ||
1889 | xorl %ecx, %esi | ||
1890 | movl 32(%esp), %edi | ||
1891 | xorl %eax, %esi | ||
1892 | addl %esi, %ebp | ||
1893 | movl %eax, %esi | ||
1894 | roll $10, %ebx | ||
1895 | addl %edi, %ebp | ||
1896 | xorl %ebx, %esi | ||
1897 | roll $6, %ebp | ||
1898 | addl %edx, %ebp | ||
1899 | /* 152 */ | ||
1900 | movl 28(%esp), %edi | ||
1901 | xorl %ebp, %esi | ||
1902 | addl %edi, %edx | ||
1903 | roll $10, %eax | ||
1904 | addl %esi, %edx | ||
1905 | movl %ebp, %esi | ||
1906 | roll $8, %edx | ||
1907 | addl %ecx, %edx | ||
1908 | /* 153 */ | ||
1909 | xorl %eax, %esi | ||
1910 | movl 12(%esp), %edi | ||
1911 | xorl %edx, %esi | ||
1912 | addl %esi, %ecx | ||
1913 | movl %edx, %esi | ||
1914 | roll $10, %ebp | ||
1915 | addl %edi, %ecx | ||
1916 | xorl %ebp, %esi | ||
1917 | roll $13, %ecx | ||
1918 | addl %ebx, %ecx | ||
1919 | /* 154 */ | ||
1920 | movl 56(%esp), %edi | ||
1921 | xorl %ecx, %esi | ||
1922 | addl %edi, %ebx | ||
1923 | roll $10, %edx | ||
1924 | addl %esi, %ebx | ||
1925 | movl %ecx, %esi | ||
1926 | roll $6, %ebx | ||
1927 | addl %eax, %ebx | ||
1928 | /* 155 */ | ||
1929 | xorl %edx, %esi | ||
1930 | movl 60(%esp), %edi | ||
1931 | xorl %ebx, %esi | ||
1932 | addl %esi, %eax | ||
1933 | movl %ebx, %esi | ||
1934 | roll $10, %ecx | ||
1935 | addl %edi, %eax | ||
1936 | xorl %ecx, %esi | ||
1937 | roll $5, %eax | ||
1938 | addl %ebp, %eax | ||
1939 | /* 156 */ | ||
1940 | movl 4(%esp), %edi | ||
1941 | xorl %eax, %esi | ||
1942 | addl %edi, %ebp | ||
1943 | roll $10, %ebx | ||
1944 | addl %esi, %ebp | ||
1945 | movl %eax, %esi | ||
1946 | roll $15, %ebp | ||
1947 | addl %edx, %ebp | ||
1948 | /* 157 */ | ||
1949 | xorl %ebx, %esi | ||
1950 | movl 16(%esp), %edi | ||
1951 | xorl %ebp, %esi | ||
1952 | addl %esi, %edx | ||
1953 | movl %ebp, %esi | ||
1954 | roll $10, %eax | ||
1955 | addl %edi, %edx | ||
1956 | xorl %eax, %esi | ||
1957 | roll $13, %edx | ||
1958 | addl %ecx, %edx | ||
1959 | /* 158 */ | ||
1960 | movl 40(%esp), %edi | ||
1961 | xorl %edx, %esi | ||
1962 | addl %edi, %ecx | ||
1963 | roll $10, %ebp | ||
1964 | addl %esi, %ecx | ||
1965 | movl %edx, %esi | ||
1966 | roll $11, %ecx | ||
1967 | addl %ebx, %ecx | ||
1968 | /* 159 */ | ||
1969 | xorl %ebp, %esi | ||
1970 | movl 48(%esp), %edi | ||
1971 | xorl %ecx, %esi | ||
1972 | addl %esi, %ebx | ||
1973 | roll $10, %edx | ||
1974 | addl %edi, %ebx | ||
1975 | movl 108(%esp), %edi | ||
1976 | roll $11, %ebx | ||
1977 | addl %eax, %ebx | ||
1978 | movl 4(%edi), %esi | ||
1979 | addl %esi, %edx | ||
1980 | movl 76(%esp), %esi | ||
1981 | addl %esi, %edx | ||
1982 | movl 8(%edi), %esi | ||
1983 | addl %esi, %ebp | ||
1984 | movl 80(%esp), %esi | ||
1985 | addl %esi, %ebp | ||
1986 | movl 12(%edi), %esi | ||
1987 | addl %esi, %eax | ||
1988 | movl 84(%esp), %esi | ||
1989 | addl %esi, %eax | ||
1990 | movl 16(%edi), %esi | ||
1991 | addl %esi, %ebx | ||
1992 | movl 68(%esp), %esi | ||
1993 | addl %esi, %ebx | ||
1994 | movl (%edi), %esi | ||
1995 | addl %esi, %ecx | ||
1996 | movl 72(%esp), %esi | ||
1997 | addl %esi, %ecx | ||
1998 | movl %edx, (%edi) | ||
1999 | movl %ebp, 4(%edi) | ||
2000 | movl %eax, 8(%edi) | ||
2001 | movl %ebx, 12(%edi) | ||
2002 | movl %ecx, 16(%edi) | ||
2003 | movl (%esp), %edi | ||
2004 | movl 112(%esp), %esi | ||
2005 | cmpl %esi, %edi | ||
2006 | movl 108(%esp), %edi | ||
2007 | jge .L000start | ||
2008 | addl $88, %esp | ||
2009 | popl %ebx | ||
2010 | popl %ebp | ||
2011 | popl %edi | ||
2012 | popl %esi | ||
2013 | ret | ||
2014 | .ripemd160_block_x86_end: | ||
2015 | SIZE(ripemd160_block_x86,.ripemd160_block_x86_end-ripemd160_block_x86) | ||
2016 | .ident "desasm.pl" | ||
diff --git a/src/lib/libcrypto/rsa/Makefile.ssl b/src/lib/libcrypto/rsa/Makefile.ssl new file mode 100644 index 0000000000..d52f2e609e --- /dev/null +++ b/src/lib/libcrypto/rsa/Makefile.ssl | |||
@@ -0,0 +1,86 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/rsa/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= rsa | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | ERR=rsa | ||
19 | ERRC=rsa_err | ||
20 | GENERAL=Makefile | ||
21 | TEST= | ||
22 | APPS= | ||
23 | |||
24 | LIB=$(TOP)/libcrypto.a | ||
25 | LIBSRC= rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c $(ERRC).c \ | ||
26 | rsa_pk1.c rsa_ssl.c rsa_none.c | ||
27 | LIBOBJ= rsa_eay.o rsa_gen.o rsa_lib.o rsa_sign.o rsa_saos.o $(ERRC).o \ | ||
28 | rsa_pk1.o rsa_ssl.o rsa_none.o | ||
29 | |||
30 | SRC= $(LIBSRC) | ||
31 | |||
32 | EXHEADER= rsa.h | ||
33 | HEADER= $(EXHEADER) | ||
34 | |||
35 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
36 | |||
37 | top: | ||
38 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
39 | |||
40 | all: lib | ||
41 | |||
42 | lib: $(LIBOBJ) | ||
43 | $(AR) $(LIB) $(LIBOBJ) | ||
44 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
45 | @touch lib | ||
46 | |||
47 | files: | ||
48 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
49 | |||
50 | links: | ||
51 | /bin/rm -f Makefile | ||
52 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
53 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
54 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
55 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
56 | |||
57 | install: | ||
58 | @for i in $(EXHEADER) ; \ | ||
59 | do \ | ||
60 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
61 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
62 | done; | ||
63 | |||
64 | tags: | ||
65 | ctags $(SRC) | ||
66 | |||
67 | tests: | ||
68 | |||
69 | lint: | ||
70 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
71 | |||
72 | depend: | ||
73 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
74 | |||
75 | dclean: | ||
76 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
77 | mv -f Makefile.new $(MAKEFILE) | ||
78 | |||
79 | clean: | ||
80 | /bin/rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
81 | |||
82 | errors: | ||
83 | perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h | ||
84 | perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c | ||
85 | |||
86 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | /* Error codes for the RSA functions. */ | ||
2 | |||
3 | /* Function codes. */ | ||
4 | #define RSA_F_RSA_EAY_PRIVATE_DECRYPT 100 | ||
5 | #define RSA_F_RSA_EAY_PRIVATE_ENCRYPT 101 | ||
6 | #define RSA_F_RSA_EAY_PUBLIC_DECRYPT 102 | ||
7 | #define RSA_F_RSA_EAY_PUBLIC_ENCRYPT 103 | ||
8 | #define RSA_F_RSA_GENERATE_KEY 104 | ||
9 | #define RSA_F_RSA_NEW_METHOD 105 | ||
10 | #define RSA_F_RSA_PADDING_ADD_NONE 106 | ||
11 | #define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 107 | ||
12 | #define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 108 | ||
13 | #define RSA_F_RSA_PADDING_ADD_SSLV23 109 | ||
14 | #define RSA_F_RSA_PADDING_CHECK_NONE 110 | ||
15 | #define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 111 | ||
16 | #define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 112 | ||
17 | #define RSA_F_RSA_PADDING_CHECK_SSLV23 113 | ||
18 | #define RSA_F_RSA_PRINT 114 | ||
19 | #define RSA_F_RSA_PRINT_FP 115 | ||
20 | #define RSA_F_RSA_SIGN 116 | ||
21 | #define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 117 | ||
22 | #define RSA_F_RSA_VERIFY 118 | ||
23 | #define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 119 | ||
24 | |||
25 | /* Reason codes. */ | ||
26 | #define RSA_R_ALGORITHM_MISMATCH 100 | ||
27 | #define RSA_R_BAD_E_VALUE 101 | ||
28 | #define RSA_R_BAD_FIXED_HEADER_DECRYPT 102 | ||
29 | #define RSA_R_BAD_PAD_BYTE_COUNT 103 | ||
30 | #define RSA_R_BAD_SIGNATURE 104 | ||
31 | #define RSA_R_BAD_ZERO_BYTE 105 | ||
32 | #define RSA_R_BLOCK_TYPE_IS_NOT_01 106 | ||
33 | #define RSA_R_BLOCK_TYPE_IS_NOT_02 107 | ||
34 | #define RSA_R_DATA_GREATER_THAN_MOD_LEN 108 | ||
35 | #define RSA_R_DATA_TOO_LARGE 109 | ||
36 | #define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110 | ||
37 | #define RSA_R_DATA_TOO_SMALL 111 | ||
38 | #define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112 | ||
39 | #define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 | ||
40 | #define RSA_R_PADDING_CHECK_FAILED 114 | ||
41 | #define RSA_R_SSLV3_ROLLBACK_ATTACK 115 | ||
42 | #define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 | ||
43 | #define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 | ||
44 | #define RSA_R_UNKNOWN_PADDING_TYPE 118 | ||
45 | #define RSA_R_WRONG_SIGNATURE_LENGTH 119 | ||
diff --git a/src/lib/libcrypto/sha/Makefile.ssl b/src/lib/libcrypto/sha/Makefile.ssl new file mode 100644 index 0000000000..eeb545d140 --- /dev/null +++ b/src/lib/libcrypto/sha/Makefile.ssl | |||
@@ -0,0 +1,103 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/sha/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= sha | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | SHA1_ASM_OBJ= | ||
17 | |||
18 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
19 | |||
20 | GENERAL=Makefile | ||
21 | TEST=shatest.c sha1test.c | ||
22 | APPS= | ||
23 | |||
24 | LIB=$(TOP)/libcrypto.a | ||
25 | LIBSRC=sha_dgst.c sha1dgst.c sha_one.c sha1_one.c | ||
26 | LIBOBJ=sha_dgst.o sha1dgst.o sha_one.o sha1_one.o $(SHA1_ASM_OBJ) | ||
27 | |||
28 | SRC= $(LIBSRC) | ||
29 | |||
30 | EXHEADER= sha.h | ||
31 | HEADER= sha_locl.h $(EXHEADER) | ||
32 | |||
33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
34 | |||
35 | top: | ||
36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
37 | |||
38 | all: lib | ||
39 | |||
40 | lib: $(LIBOBJ) | ||
41 | $(AR) $(LIB) $(LIBOBJ) | ||
42 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
43 | @touch lib | ||
44 | |||
45 | # elf | ||
46 | asm/sx86-elf.o: asm/sx86unix.cpp | ||
47 | $(CPP) -DELF asm/sx86unix.cpp | as -o asm/sx86-elf.o | ||
48 | |||
49 | # solaris | ||
50 | asm/sx86-sol.o: asm/sx86unix.cpp | ||
51 | $(CC) -E -DSOL asm/sx86unix.cpp | sed 's/^#.*//' > asm/sx86-sol.s | ||
52 | as -o asm/sx86-sol.o asm/sx86-sol.s | ||
53 | rm -f asm/sx86-sol.s | ||
54 | |||
55 | # a.out | ||
56 | asm/sx86-out.o: asm/sx86unix.cpp | ||
57 | $(CPP) -DOUT asm/sx86unix.cpp | as -o asm/sx86-out.o | ||
58 | |||
59 | # bsdi | ||
60 | asm/sx86bsdi.o: asm/sx86unix.cpp | ||
61 | $(CPP) -DBSDI asm/sx86unix.cpp | as -o asm/sx86bsdi.o | ||
62 | |||
63 | asm/sx86unix.cpp: | ||
64 | (cd asm; perl sha1-586.pl cpp >sx86unix.cpp) | ||
65 | |||
66 | files: | ||
67 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
68 | |||
69 | links: | ||
70 | /bin/rm -f Makefile | ||
71 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
72 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
73 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
74 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
75 | |||
76 | install: | ||
77 | @for i in $(EXHEADER) ; \ | ||
78 | do \ | ||
79 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
80 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
81 | done; | ||
82 | |||
83 | tags: | ||
84 | ctags $(SRC) | ||
85 | |||
86 | tests: | ||
87 | |||
88 | lint: | ||
89 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
90 | |||
91 | depend: | ||
92 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
93 | |||
94 | dclean: | ||
95 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
96 | mv -f Makefile.new $(MAKEFILE) | ||
97 | |||
98 | clean: | ||
99 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff asm/*.o | ||
100 | |||
101 | errors: | ||
102 | |||
103 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | # Targets | ||
2 | # make - twidle the options yourself :-) | ||
3 | # make cc - standard cc options | ||
4 | # make gcc - standard gcc options | ||
5 | # make x86-elf - linux-elf etc | ||
6 | # make x86-out - linux-a.out, FreeBSD etc | ||
7 | # make x86-solaris | ||
8 | # make x86-bdsi | ||
9 | |||
10 | DIR= sha | ||
11 | TOP= . | ||
12 | CC= gcc | ||
13 | CFLAG= -O3 -fomit-frame-pointer | ||
14 | |||
15 | CPP= $(CC) -E | ||
16 | INCLUDES= | ||
17 | INSTALLTOP=/usr/local/lib | ||
18 | MAKE= make | ||
19 | MAKEDEPEND= makedepend | ||
20 | MAKEFILE= Makefile.uni | ||
21 | AR= ar r | ||
22 | |||
23 | SHA_ASM_OBJ= | ||
24 | |||
25 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
26 | |||
27 | GENERAL=Makefile | ||
28 | |||
29 | TEST1=shatest | ||
30 | TEST2=sha1test | ||
31 | APP1=sha | ||
32 | APP2=sha1 | ||
33 | |||
34 | TEST=$(TEST1) $(TEST2) | ||
35 | APPS=$(APP1) $(APP2) | ||
36 | |||
37 | LIB=libsha.a | ||
38 | LIBSRC=sha_dgst.c sha1dgst.c sha_one.c sha1_one.c | ||
39 | LIBOBJ=sha_dgst.o sha1dgst.o sha_one.o sha1_one.o $(SHA_ASM_OBJ) | ||
40 | |||
41 | SRC= $(LIBSRC) | ||
42 | |||
43 | EXHEADER= sha.h | ||
44 | HEADER= sha_locl.h $(EXHEADER) | ||
45 | |||
46 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
47 | |||
48 | all: $(LIB) $(TEST) $(APPS) | ||
49 | |||
50 | $(LIB): $(LIBOBJ) | ||
51 | $(AR) $(LIB) $(LIBOBJ) | ||
52 | sh $(TOP)/ranlib.sh $(LIB) | ||
53 | |||
54 | # elf | ||
55 | asm/sx86-elf.o: asm/sx86unix.cpp | ||
56 | $(CPP) -DELF asm/sx86unix.cpp | as -o asm/sx86-elf.o | ||
57 | |||
58 | # solaris | ||
59 | asm/sx86-sol.o: asm/sx86unix.cpp | ||
60 | $(CC) -E -DSOL asm/sx86unix.cpp | sed 's/^#.*//' > asm/sx86-sol.s | ||
61 | as -o asm/sx86-sol.o asm/sx86-sol.s | ||
62 | rm -f asm/sx86-sol.s | ||
63 | |||
64 | # a.out | ||
65 | asm/sx86-out.o: asm/sx86unix.cpp | ||
66 | $(CPP) -DOUT asm/sx86unix.cpp | as -o asm/sx86-out.o | ||
67 | |||
68 | # bsdi | ||
69 | asm/sx86bsdi.o: asm/sx86unix.cpp | ||
70 | $(CPP) -DBSDI asm/sx86unix.cpp | as -o asm/sx86bsdi.o | ||
71 | |||
72 | asm/sx86unix.cpp: | ||
73 | (cd asm; perl sha1-586.pl cpp >sx86unix.cpp) | ||
74 | |||
75 | test: $(TEST) | ||
76 | ./$(TEST1) | ||
77 | ./$(TEST2) | ||
78 | |||
79 | $(TEST1): $(TEST1).c $(LIB) | ||
80 | $(CC) -o $(TEST1) $(CFLAGS) $(TEST1).c $(LIB) | ||
81 | |||
82 | $(TEST2): $(TEST2).c $(LIB) | ||
83 | $(CC) -o $(TEST2) $(CFLAGS) $(TEST2).c $(LIB) | ||
84 | |||
85 | $(APP1): $(APP1).c $(LIB) | ||
86 | $(CC) -o $(APP1) $(CFLAGS) $(APP1).c $(LIB) | ||
87 | |||
88 | $(APP2): $(APP2).c $(LIB) | ||
89 | $(CC) -o $(APP2) $(CFLAGS) $(APP2).c $(LIB) | ||
90 | |||
91 | lint: | ||
92 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
93 | |||
94 | depend: | ||
95 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
96 | |||
97 | dclean: | ||
98 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
99 | mv -f Makefile.new $(MAKEFILE) | ||
100 | |||
101 | clean: | ||
102 | /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
103 | |||
104 | cc: | ||
105 | $(MAKE) SHA_ASM_OBJ="" CC="cc" CFLAG="-O" all | ||
106 | |||
107 | gcc: | ||
108 | $(MAKE) SHA_ASM_OBJ="" CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all | ||
109 | |||
110 | x86-elf: | ||
111 | $(MAKE) SHA_ASM_OBJ="asm/sx86-elf.o" CFLAG="-DELF -DSHA1_ASM -DL_ENDIAN $(CFLAGS)" all | ||
112 | |||
113 | x86-out: | ||
114 | $(MAKE) SHA_ASM_OBJ="asm/sx86-out.o" CFLAG="-DOUT -DSHA1_ASM -DL_ENDIAN $(CFLAGS)" all | ||
115 | |||
116 | x86-solaris: | ||
117 | $(MAKE) SHA_ASM_OBJ="asm/sx86-sol.o" CFLAG="-DSOL -DSHA1_ASM -DL_ENDIAN $(CFLAGS)" all | ||
118 | |||
119 | x86-bdsi: | ||
120 | $(MAKE) SHA_ASM_OBJ="asm/sx86-bdsi.o" CFLAG="-DBDSI -DSHA1_ASM -DL_ENDIAN $(CFLAGS)" all | ||
121 | |||
122 | # 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 @@ | |||
1 | ; Don't even think of reading this code | ||
2 | ; It was automatically generated by sha1-586.pl | ||
3 | ; Which is a perl program used to generate the x86 assember for | ||
4 | ; any of elf, a.out, BSDI,Win32, or Solaris | ||
5 | ; eric <eay@cryptsoft.com> | ||
6 | ; | ||
7 | TITLE sha1-586.asm | ||
8 | .486 | ||
9 | .model FLAT | ||
10 | _TEXT SEGMENT | ||
11 | PUBLIC _sha1_block_x86 | ||
12 | |||
13 | _sha1_block_x86 PROC NEAR | ||
14 | push esi | ||
15 | push ebp | ||
16 | mov eax, DWORD PTR 20[esp] | ||
17 | mov esi, DWORD PTR 16[esp] | ||
18 | add eax, esi | ||
19 | mov ebp, DWORD PTR 12[esp] | ||
20 | push ebx | ||
21 | sub eax, 64 | ||
22 | push edi | ||
23 | mov ebx, DWORD PTR 4[ebp] | ||
24 | sub esp, 72 | ||
25 | mov edx, DWORD PTR 12[ebp] | ||
26 | mov edi, DWORD PTR 16[ebp] | ||
27 | mov ecx, DWORD PTR 8[ebp] | ||
28 | mov DWORD PTR 68[esp],eax | ||
29 | ; First we need to setup the X array | ||
30 | mov eax, DWORD PTR [esi] | ||
31 | L000start: | ||
32 | ; First, load the words onto the stack in network byte order | ||
33 | bswap eax | ||
34 | mov DWORD PTR [esp],eax | ||
35 | mov eax, DWORD PTR 4[esi] | ||
36 | bswap eax | ||
37 | mov DWORD PTR 4[esp],eax | ||
38 | mov eax, DWORD PTR 8[esi] | ||
39 | bswap eax | ||
40 | mov DWORD PTR 8[esp],eax | ||
41 | mov eax, DWORD PTR 12[esi] | ||
42 | bswap eax | ||
43 | mov DWORD PTR 12[esp],eax | ||
44 | mov eax, DWORD PTR 16[esi] | ||
45 | bswap eax | ||
46 | mov DWORD PTR 16[esp],eax | ||
47 | mov eax, DWORD PTR 20[esi] | ||
48 | bswap eax | ||
49 | mov DWORD PTR 20[esp],eax | ||
50 | mov eax, DWORD PTR 24[esi] | ||
51 | bswap eax | ||
52 | mov DWORD PTR 24[esp],eax | ||
53 | mov eax, DWORD PTR 28[esi] | ||
54 | bswap eax | ||
55 | mov DWORD PTR 28[esp],eax | ||
56 | mov eax, DWORD PTR 32[esi] | ||
57 | bswap eax | ||
58 | mov DWORD PTR 32[esp],eax | ||
59 | mov eax, DWORD PTR 36[esi] | ||
60 | bswap eax | ||
61 | mov DWORD PTR 36[esp],eax | ||
62 | mov eax, DWORD PTR 40[esi] | ||
63 | bswap eax | ||
64 | mov DWORD PTR 40[esp],eax | ||
65 | mov eax, DWORD PTR 44[esi] | ||
66 | bswap eax | ||
67 | mov DWORD PTR 44[esp],eax | ||
68 | mov eax, DWORD PTR 48[esi] | ||
69 | bswap eax | ||
70 | mov DWORD PTR 48[esp],eax | ||
71 | mov eax, DWORD PTR 52[esi] | ||
72 | bswap eax | ||
73 | mov DWORD PTR 52[esp],eax | ||
74 | mov eax, DWORD PTR 56[esi] | ||
75 | bswap eax | ||
76 | mov DWORD PTR 56[esp],eax | ||
77 | mov eax, DWORD PTR 60[esi] | ||
78 | bswap eax | ||
79 | mov DWORD PTR 60[esp],eax | ||
80 | ; We now have the X array on the stack | ||
81 | ; starting at sp-4 | ||
82 | mov DWORD PTR 64[esp],esi | ||
83 | ; | ||
84 | ; Start processing | ||
85 | mov eax, DWORD PTR [ebp] | ||
86 | ; 00_15 0 | ||
87 | mov esi, ecx | ||
88 | mov ebp, eax | ||
89 | xor esi, edx | ||
90 | rol ebp, 5 | ||
91 | and esi, ebx | ||
92 | add ebp, edi | ||
93 | ror ebx, 1 | ||
94 | mov edi, DWORD PTR [esp] | ||
95 | ror ebx, 1 | ||
96 | xor esi, edx | ||
97 | lea ebp, DWORD PTR 1518500249[edi*1+ebp] | ||
98 | mov edi, ebx | ||
99 | add esi, ebp | ||
100 | xor edi, ecx | ||
101 | mov ebp, esi | ||
102 | and edi, eax | ||
103 | rol ebp, 5 | ||
104 | add ebp, edx | ||
105 | mov edx, DWORD PTR 4[esp] | ||
106 | ror eax, 1 | ||
107 | xor edi, ecx | ||
108 | ror eax, 1 | ||
109 | lea ebp, DWORD PTR 1518500249[edx*1+ebp] | ||
110 | add edi, ebp | ||
111 | ; 00_15 2 | ||
112 | mov edx, eax | ||
113 | mov ebp, edi | ||
114 | xor edx, ebx | ||
115 | rol ebp, 5 | ||
116 | and edx, esi | ||
117 | add ebp, ecx | ||
118 | ror esi, 1 | ||
119 | mov ecx, DWORD PTR 8[esp] | ||
120 | ror esi, 1 | ||
121 | xor edx, ebx | ||
122 | lea ebp, DWORD PTR 1518500249[ecx*1+ebp] | ||
123 | mov ecx, esi | ||
124 | add edx, ebp | ||
125 | xor ecx, eax | ||
126 | mov ebp, edx | ||
127 | and ecx, edi | ||
128 | rol ebp, 5 | ||
129 | add ebp, ebx | ||
130 | mov ebx, DWORD PTR 12[esp] | ||
131 | ror edi, 1 | ||
132 | xor ecx, eax | ||
133 | ror edi, 1 | ||
134 | lea ebp, DWORD PTR 1518500249[ebx*1+ebp] | ||
135 | add ecx, ebp | ||
136 | ; 00_15 4 | ||
137 | mov ebx, edi | ||
138 | mov ebp, ecx | ||
139 | xor ebx, esi | ||
140 | rol ebp, 5 | ||
141 | and ebx, edx | ||
142 | add ebp, eax | ||
143 | ror edx, 1 | ||
144 | mov eax, DWORD PTR 16[esp] | ||
145 | ror edx, 1 | ||
146 | xor ebx, esi | ||
147 | lea ebp, DWORD PTR 1518500249[eax*1+ebp] | ||
148 | mov eax, edx | ||
149 | add ebx, ebp | ||
150 | xor eax, edi | ||
151 | mov ebp, ebx | ||
152 | and eax, ecx | ||
153 | rol ebp, 5 | ||
154 | add ebp, esi | ||
155 | mov esi, DWORD PTR 20[esp] | ||
156 | ror ecx, 1 | ||
157 | xor eax, edi | ||
158 | ror ecx, 1 | ||
159 | lea ebp, DWORD PTR 1518500249[esi*1+ebp] | ||
160 | add eax, ebp | ||
161 | ; 00_15 6 | ||
162 | mov esi, ecx | ||
163 | mov ebp, eax | ||
164 | xor esi, edx | ||
165 | rol ebp, 5 | ||
166 | and esi, ebx | ||
167 | add ebp, edi | ||
168 | ror ebx, 1 | ||
169 | mov edi, DWORD PTR 24[esp] | ||
170 | ror ebx, 1 | ||
171 | xor esi, edx | ||
172 | lea ebp, DWORD PTR 1518500249[edi*1+ebp] | ||
173 | mov edi, ebx | ||
174 | add esi, ebp | ||
175 | xor edi, ecx | ||
176 | mov ebp, esi | ||
177 | and edi, eax | ||
178 | rol ebp, 5 | ||
179 | add ebp, edx | ||
180 | mov edx, DWORD PTR 28[esp] | ||
181 | ror eax, 1 | ||
182 | xor edi, ecx | ||
183 | ror eax, 1 | ||
184 | lea ebp, DWORD PTR 1518500249[edx*1+ebp] | ||
185 | add edi, ebp | ||
186 | ; 00_15 8 | ||
187 | mov edx, eax | ||
188 | mov ebp, edi | ||
189 | xor edx, ebx | ||
190 | rol ebp, 5 | ||
191 | and edx, esi | ||
192 | add ebp, ecx | ||
193 | ror esi, 1 | ||
194 | mov ecx, DWORD PTR 32[esp] | ||
195 | ror esi, 1 | ||
196 | xor edx, ebx | ||
197 | lea ebp, DWORD PTR 1518500249[ecx*1+ebp] | ||
198 | mov ecx, esi | ||
199 | add edx, ebp | ||
200 | xor ecx, eax | ||
201 | mov ebp, edx | ||
202 | and ecx, edi | ||
203 | rol ebp, 5 | ||
204 | add ebp, ebx | ||
205 | mov ebx, DWORD PTR 36[esp] | ||
206 | ror edi, 1 | ||
207 | xor ecx, eax | ||
208 | ror edi, 1 | ||
209 | lea ebp, DWORD PTR 1518500249[ebx*1+ebp] | ||
210 | add ecx, ebp | ||
211 | ; 00_15 10 | ||
212 | mov ebx, edi | ||
213 | mov ebp, ecx | ||
214 | xor ebx, esi | ||
215 | rol ebp, 5 | ||
216 | and ebx, edx | ||
217 | add ebp, eax | ||
218 | ror edx, 1 | ||
219 | mov eax, DWORD PTR 40[esp] | ||
220 | ror edx, 1 | ||
221 | xor ebx, esi | ||
222 | lea ebp, DWORD PTR 1518500249[eax*1+ebp] | ||
223 | mov eax, edx | ||
224 | add ebx, ebp | ||
225 | xor eax, edi | ||
226 | mov ebp, ebx | ||
227 | and eax, ecx | ||
228 | rol ebp, 5 | ||
229 | add ebp, esi | ||
230 | mov esi, DWORD PTR 44[esp] | ||
231 | ror ecx, 1 | ||
232 | xor eax, edi | ||
233 | ror ecx, 1 | ||
234 | lea ebp, DWORD PTR 1518500249[esi*1+ebp] | ||
235 | add eax, ebp | ||
236 | ; 00_15 12 | ||
237 | mov esi, ecx | ||
238 | mov ebp, eax | ||
239 | xor esi, edx | ||
240 | rol ebp, 5 | ||
241 | and esi, ebx | ||
242 | add ebp, edi | ||
243 | ror ebx, 1 | ||
244 | mov edi, DWORD PTR 48[esp] | ||
245 | ror ebx, 1 | ||
246 | xor esi, edx | ||
247 | lea ebp, DWORD PTR 1518500249[edi*1+ebp] | ||
248 | mov edi, ebx | ||
249 | add esi, ebp | ||
250 | xor edi, ecx | ||
251 | mov ebp, esi | ||
252 | and edi, eax | ||
253 | rol ebp, 5 | ||
254 | add ebp, edx | ||
255 | mov edx, DWORD PTR 52[esp] | ||
256 | ror eax, 1 | ||
257 | xor edi, ecx | ||
258 | ror eax, 1 | ||
259 | lea ebp, DWORD PTR 1518500249[edx*1+ebp] | ||
260 | add edi, ebp | ||
261 | ; 00_15 14 | ||
262 | mov edx, eax | ||
263 | mov ebp, edi | ||
264 | xor edx, ebx | ||
265 | rol ebp, 5 | ||
266 | and edx, esi | ||
267 | add ebp, ecx | ||
268 | ror esi, 1 | ||
269 | mov ecx, DWORD PTR 56[esp] | ||
270 | ror esi, 1 | ||
271 | xor edx, ebx | ||
272 | lea ebp, DWORD PTR 1518500249[ecx*1+ebp] | ||
273 | mov ecx, esi | ||
274 | add edx, ebp | ||
275 | xor ecx, eax | ||
276 | mov ebp, edx | ||
277 | and ecx, edi | ||
278 | rol ebp, 5 | ||
279 | add ebp, ebx | ||
280 | mov ebx, DWORD PTR 60[esp] | ||
281 | ror edi, 1 | ||
282 | xor ecx, eax | ||
283 | ror edi, 1 | ||
284 | lea ebp, DWORD PTR 1518500249[ebx*1+ebp] | ||
285 | add ecx, ebp | ||
286 | ; 16_19 16 | ||
287 | nop | ||
288 | mov ebp, DWORD PTR [esp] | ||
289 | mov ebx, DWORD PTR 8[esp] | ||
290 | xor ebx, ebp | ||
291 | mov ebp, DWORD PTR 32[esp] | ||
292 | xor ebx, ebp | ||
293 | mov ebp, DWORD PTR 52[esp] | ||
294 | xor ebx, ebp | ||
295 | mov ebp, edi | ||
296 | rol ebx, 1 | ||
297 | xor ebp, esi | ||
298 | mov DWORD PTR [esp],ebx | ||
299 | and ebp, edx | ||
300 | lea ebx, DWORD PTR 1518500249[eax*1+ebx] | ||
301 | xor ebp, esi | ||
302 | mov eax, ecx | ||
303 | add ebx, ebp | ||
304 | rol eax, 5 | ||
305 | ror edx, 1 | ||
306 | add ebx, eax | ||
307 | mov eax, DWORD PTR 4[esp] | ||
308 | mov ebp, DWORD PTR 12[esp] | ||
309 | xor eax, ebp | ||
310 | mov ebp, DWORD PTR 36[esp] | ||
311 | xor eax, ebp | ||
312 | mov ebp, DWORD PTR 56[esp] | ||
313 | ror edx, 1 | ||
314 | xor eax, ebp | ||
315 | rol eax, 1 | ||
316 | mov ebp, edx | ||
317 | xor ebp, edi | ||
318 | mov DWORD PTR 4[esp],eax | ||
319 | and ebp, ecx | ||
320 | lea eax, DWORD PTR 1518500249[esi*1+eax] | ||
321 | xor ebp, edi | ||
322 | mov esi, ebx | ||
323 | rol esi, 5 | ||
324 | ror ecx, 1 | ||
325 | add eax, esi | ||
326 | ror ecx, 1 | ||
327 | add eax, ebp | ||
328 | ; 16_19 18 | ||
329 | mov ebp, DWORD PTR 8[esp] | ||
330 | mov esi, DWORD PTR 16[esp] | ||
331 | xor esi, ebp | ||
332 | mov ebp, DWORD PTR 40[esp] | ||
333 | xor esi, ebp | ||
334 | mov ebp, DWORD PTR 60[esp] | ||
335 | xor esi, ebp | ||
336 | mov ebp, ecx | ||
337 | rol esi, 1 | ||
338 | xor ebp, edx | ||
339 | mov DWORD PTR 8[esp],esi | ||
340 | and ebp, ebx | ||
341 | lea esi, DWORD PTR 1518500249[edi*1+esi] | ||
342 | xor ebp, edx | ||
343 | mov edi, eax | ||
344 | add esi, ebp | ||
345 | rol edi, 5 | ||
346 | ror ebx, 1 | ||
347 | add esi, edi | ||
348 | mov edi, DWORD PTR 12[esp] | ||
349 | mov ebp, DWORD PTR 20[esp] | ||
350 | xor edi, ebp | ||
351 | mov ebp, DWORD PTR 44[esp] | ||
352 | xor edi, ebp | ||
353 | mov ebp, DWORD PTR [esp] | ||
354 | ror ebx, 1 | ||
355 | xor edi, ebp | ||
356 | rol edi, 1 | ||
357 | mov ebp, ebx | ||
358 | xor ebp, ecx | ||
359 | mov DWORD PTR 12[esp],edi | ||
360 | and ebp, eax | ||
361 | lea edi, DWORD PTR 1518500249[edx*1+edi] | ||
362 | xor ebp, ecx | ||
363 | mov edx, esi | ||
364 | rol edx, 5 | ||
365 | ror eax, 1 | ||
366 | add edi, edx | ||
367 | ror eax, 1 | ||
368 | add edi, ebp | ||
369 | ; 20_39 20 | ||
370 | mov edx, DWORD PTR 16[esp] | ||
371 | mov ebp, DWORD PTR 24[esp] | ||
372 | xor edx, ebp | ||
373 | mov ebp, DWORD PTR 48[esp] | ||
374 | xor edx, ebp | ||
375 | mov ebp, DWORD PTR 4[esp] | ||
376 | xor edx, ebp | ||
377 | mov ebp, esi | ||
378 | rol edx, 1 | ||
379 | xor ebp, eax | ||
380 | mov DWORD PTR 16[esp],edx | ||
381 | xor ebp, ebx | ||
382 | lea edx, DWORD PTR 1859775393[ecx*1+edx] | ||
383 | mov ecx, edi | ||
384 | rol ecx, 5 | ||
385 | ror esi, 1 | ||
386 | add ecx, ebp | ||
387 | ror esi, 1 | ||
388 | add edx, ecx | ||
389 | ; 20_39 21 | ||
390 | mov ecx, DWORD PTR 20[esp] | ||
391 | mov ebp, DWORD PTR 28[esp] | ||
392 | xor ecx, ebp | ||
393 | mov ebp, DWORD PTR 52[esp] | ||
394 | xor ecx, ebp | ||
395 | mov ebp, DWORD PTR 8[esp] | ||
396 | xor ecx, ebp | ||
397 | mov ebp, edi | ||
398 | rol ecx, 1 | ||
399 | xor ebp, esi | ||
400 | mov DWORD PTR 20[esp],ecx | ||
401 | xor ebp, eax | ||
402 | lea ecx, DWORD PTR 1859775393[ebx*1+ecx] | ||
403 | mov ebx, edx | ||
404 | rol ebx, 5 | ||
405 | ror edi, 1 | ||
406 | add ebx, ebp | ||
407 | ror edi, 1 | ||
408 | add ecx, ebx | ||
409 | ; 20_39 22 | ||
410 | mov ebx, DWORD PTR 24[esp] | ||
411 | mov ebp, DWORD PTR 32[esp] | ||
412 | xor ebx, ebp | ||
413 | mov ebp, DWORD PTR 56[esp] | ||
414 | xor ebx, ebp | ||
415 | mov ebp, DWORD PTR 12[esp] | ||
416 | xor ebx, ebp | ||
417 | mov ebp, edx | ||
418 | rol ebx, 1 | ||
419 | xor ebp, edi | ||
420 | mov DWORD PTR 24[esp],ebx | ||
421 | xor ebp, esi | ||
422 | lea ebx, DWORD PTR 1859775393[eax*1+ebx] | ||
423 | mov eax, ecx | ||
424 | rol eax, 5 | ||
425 | ror edx, 1 | ||
426 | add eax, ebp | ||
427 | ror edx, 1 | ||
428 | add ebx, eax | ||
429 | ; 20_39 23 | ||
430 | mov eax, DWORD PTR 28[esp] | ||
431 | mov ebp, DWORD PTR 36[esp] | ||
432 | xor eax, ebp | ||
433 | mov ebp, DWORD PTR 60[esp] | ||
434 | xor eax, ebp | ||
435 | mov ebp, DWORD PTR 16[esp] | ||
436 | xor eax, ebp | ||
437 | mov ebp, ecx | ||
438 | rol eax, 1 | ||
439 | xor ebp, edx | ||
440 | mov DWORD PTR 28[esp],eax | ||
441 | xor ebp, edi | ||
442 | lea eax, DWORD PTR 1859775393[esi*1+eax] | ||
443 | mov esi, ebx | ||
444 | rol esi, 5 | ||
445 | ror ecx, 1 | ||
446 | add esi, ebp | ||
447 | ror ecx, 1 | ||
448 | add eax, esi | ||
449 | ; 20_39 24 | ||
450 | mov esi, DWORD PTR 32[esp] | ||
451 | mov ebp, DWORD PTR 40[esp] | ||
452 | xor esi, ebp | ||
453 | mov ebp, DWORD PTR [esp] | ||
454 | xor esi, ebp | ||
455 | mov ebp, DWORD PTR 20[esp] | ||
456 | xor esi, ebp | ||
457 | mov ebp, ebx | ||
458 | rol esi, 1 | ||
459 | xor ebp, ecx | ||
460 | mov DWORD PTR 32[esp],esi | ||
461 | xor ebp, edx | ||
462 | lea esi, DWORD PTR 1859775393[edi*1+esi] | ||
463 | mov edi, eax | ||
464 | rol edi, 5 | ||
465 | ror ebx, 1 | ||
466 | add edi, ebp | ||
467 | ror ebx, 1 | ||
468 | add esi, edi | ||
469 | ; 20_39 25 | ||
470 | mov edi, DWORD PTR 36[esp] | ||
471 | mov ebp, DWORD PTR 44[esp] | ||
472 | xor edi, ebp | ||
473 | mov ebp, DWORD PTR 4[esp] | ||
474 | xor edi, ebp | ||
475 | mov ebp, DWORD PTR 24[esp] | ||
476 | xor edi, ebp | ||
477 | mov ebp, eax | ||
478 | rol edi, 1 | ||
479 | xor ebp, ebx | ||
480 | mov DWORD PTR 36[esp],edi | ||
481 | xor ebp, ecx | ||
482 | lea edi, DWORD PTR 1859775393[edx*1+edi] | ||
483 | mov edx, esi | ||
484 | rol edx, 5 | ||
485 | ror eax, 1 | ||
486 | add edx, ebp | ||
487 | ror eax, 1 | ||
488 | add edi, edx | ||
489 | ; 20_39 26 | ||
490 | mov edx, DWORD PTR 40[esp] | ||
491 | mov ebp, DWORD PTR 48[esp] | ||
492 | xor edx, ebp | ||
493 | mov ebp, DWORD PTR 8[esp] | ||
494 | xor edx, ebp | ||
495 | mov ebp, DWORD PTR 28[esp] | ||
496 | xor edx, ebp | ||
497 | mov ebp, esi | ||
498 | rol edx, 1 | ||
499 | xor ebp, eax | ||
500 | mov DWORD PTR 40[esp],edx | ||
501 | xor ebp, ebx | ||
502 | lea edx, DWORD PTR 1859775393[ecx*1+edx] | ||
503 | mov ecx, edi | ||
504 | rol ecx, 5 | ||
505 | ror esi, 1 | ||
506 | add ecx, ebp | ||
507 | ror esi, 1 | ||
508 | add edx, ecx | ||
509 | ; 20_39 27 | ||
510 | mov ecx, DWORD PTR 44[esp] | ||
511 | mov ebp, DWORD PTR 52[esp] | ||
512 | xor ecx, ebp | ||
513 | mov ebp, DWORD PTR 12[esp] | ||
514 | xor ecx, ebp | ||
515 | mov ebp, DWORD PTR 32[esp] | ||
516 | xor ecx, ebp | ||
517 | mov ebp, edi | ||
518 | rol ecx, 1 | ||
519 | xor ebp, esi | ||
520 | mov DWORD PTR 44[esp],ecx | ||
521 | xor ebp, eax | ||
522 | lea ecx, DWORD PTR 1859775393[ebx*1+ecx] | ||
523 | mov ebx, edx | ||
524 | rol ebx, 5 | ||
525 | ror edi, 1 | ||
526 | add ebx, ebp | ||
527 | ror edi, 1 | ||
528 | add ecx, ebx | ||
529 | ; 20_39 28 | ||
530 | mov ebx, DWORD PTR 48[esp] | ||
531 | mov ebp, DWORD PTR 56[esp] | ||
532 | xor ebx, ebp | ||
533 | mov ebp, DWORD PTR 16[esp] | ||
534 | xor ebx, ebp | ||
535 | mov ebp, DWORD PTR 36[esp] | ||
536 | xor ebx, ebp | ||
537 | mov ebp, edx | ||
538 | rol ebx, 1 | ||
539 | xor ebp, edi | ||
540 | mov DWORD PTR 48[esp],ebx | ||
541 | xor ebp, esi | ||
542 | lea ebx, DWORD PTR 1859775393[eax*1+ebx] | ||
543 | mov eax, ecx | ||
544 | rol eax, 5 | ||
545 | ror edx, 1 | ||
546 | add eax, ebp | ||
547 | ror edx, 1 | ||
548 | add ebx, eax | ||
549 | ; 20_39 29 | ||
550 | mov eax, DWORD PTR 52[esp] | ||
551 | mov ebp, DWORD PTR 60[esp] | ||
552 | xor eax, ebp | ||
553 | mov ebp, DWORD PTR 20[esp] | ||
554 | xor eax, ebp | ||
555 | mov ebp, DWORD PTR 40[esp] | ||
556 | xor eax, ebp | ||
557 | mov ebp, ecx | ||
558 | rol eax, 1 | ||
559 | xor ebp, edx | ||
560 | mov DWORD PTR 52[esp],eax | ||
561 | xor ebp, edi | ||
562 | lea eax, DWORD PTR 1859775393[esi*1+eax] | ||
563 | mov esi, ebx | ||
564 | rol esi, 5 | ||
565 | ror ecx, 1 | ||
566 | add esi, ebp | ||
567 | ror ecx, 1 | ||
568 | add eax, esi | ||
569 | ; 20_39 30 | ||
570 | mov esi, DWORD PTR 56[esp] | ||
571 | mov ebp, DWORD PTR [esp] | ||
572 | xor esi, ebp | ||
573 | mov ebp, DWORD PTR 24[esp] | ||
574 | xor esi, ebp | ||
575 | mov ebp, DWORD PTR 44[esp] | ||
576 | xor esi, ebp | ||
577 | mov ebp, ebx | ||
578 | rol esi, 1 | ||
579 | xor ebp, ecx | ||
580 | mov DWORD PTR 56[esp],esi | ||
581 | xor ebp, edx | ||
582 | lea esi, DWORD PTR 1859775393[edi*1+esi] | ||
583 | mov edi, eax | ||
584 | rol edi, 5 | ||
585 | ror ebx, 1 | ||
586 | add edi, ebp | ||
587 | ror ebx, 1 | ||
588 | add esi, edi | ||
589 | ; 20_39 31 | ||
590 | mov edi, DWORD PTR 60[esp] | ||
591 | mov ebp, DWORD PTR 4[esp] | ||
592 | xor edi, ebp | ||
593 | mov ebp, DWORD PTR 28[esp] | ||
594 | xor edi, ebp | ||
595 | mov ebp, DWORD PTR 48[esp] | ||
596 | xor edi, ebp | ||
597 | mov ebp, eax | ||
598 | rol edi, 1 | ||
599 | xor ebp, ebx | ||
600 | mov DWORD PTR 60[esp],edi | ||
601 | xor ebp, ecx | ||
602 | lea edi, DWORD PTR 1859775393[edx*1+edi] | ||
603 | mov edx, esi | ||
604 | rol edx, 5 | ||
605 | ror eax, 1 | ||
606 | add edx, ebp | ||
607 | ror eax, 1 | ||
608 | add edi, edx | ||
609 | ; 20_39 32 | ||
610 | mov edx, DWORD PTR [esp] | ||
611 | mov ebp, DWORD PTR 8[esp] | ||
612 | xor edx, ebp | ||
613 | mov ebp, DWORD PTR 32[esp] | ||
614 | xor edx, ebp | ||
615 | mov ebp, DWORD PTR 52[esp] | ||
616 | xor edx, ebp | ||
617 | mov ebp, esi | ||
618 | rol edx, 1 | ||
619 | xor ebp, eax | ||
620 | mov DWORD PTR [esp],edx | ||
621 | xor ebp, ebx | ||
622 | lea edx, DWORD PTR 1859775393[ecx*1+edx] | ||
623 | mov ecx, edi | ||
624 | rol ecx, 5 | ||
625 | ror esi, 1 | ||
626 | add ecx, ebp | ||
627 | ror esi, 1 | ||
628 | add edx, ecx | ||
629 | ; 20_39 33 | ||
630 | mov ecx, DWORD PTR 4[esp] | ||
631 | mov ebp, DWORD PTR 12[esp] | ||
632 | xor ecx, ebp | ||
633 | mov ebp, DWORD PTR 36[esp] | ||
634 | xor ecx, ebp | ||
635 | mov ebp, DWORD PTR 56[esp] | ||
636 | xor ecx, ebp | ||
637 | mov ebp, edi | ||
638 | rol ecx, 1 | ||
639 | xor ebp, esi | ||
640 | mov DWORD PTR 4[esp],ecx | ||
641 | xor ebp, eax | ||
642 | lea ecx, DWORD PTR 1859775393[ebx*1+ecx] | ||
643 | mov ebx, edx | ||
644 | rol ebx, 5 | ||
645 | ror edi, 1 | ||
646 | add ebx, ebp | ||
647 | ror edi, 1 | ||
648 | add ecx, ebx | ||
649 | ; 20_39 34 | ||
650 | mov ebx, DWORD PTR 8[esp] | ||
651 | mov ebp, DWORD PTR 16[esp] | ||
652 | xor ebx, ebp | ||
653 | mov ebp, DWORD PTR 40[esp] | ||
654 | xor ebx, ebp | ||
655 | mov ebp, DWORD PTR 60[esp] | ||
656 | xor ebx, ebp | ||
657 | mov ebp, edx | ||
658 | rol ebx, 1 | ||
659 | xor ebp, edi | ||
660 | mov DWORD PTR 8[esp],ebx | ||
661 | xor ebp, esi | ||
662 | lea ebx, DWORD PTR 1859775393[eax*1+ebx] | ||
663 | mov eax, ecx | ||
664 | rol eax, 5 | ||
665 | ror edx, 1 | ||
666 | add eax, ebp | ||
667 | ror edx, 1 | ||
668 | add ebx, eax | ||
669 | ; 20_39 35 | ||
670 | mov eax, DWORD PTR 12[esp] | ||
671 | mov ebp, DWORD PTR 20[esp] | ||
672 | xor eax, ebp | ||
673 | mov ebp, DWORD PTR 44[esp] | ||
674 | xor eax, ebp | ||
675 | mov ebp, DWORD PTR [esp] | ||
676 | xor eax, ebp | ||
677 | mov ebp, ecx | ||
678 | rol eax, 1 | ||
679 | xor ebp, edx | ||
680 | mov DWORD PTR 12[esp],eax | ||
681 | xor ebp, edi | ||
682 | lea eax, DWORD PTR 1859775393[esi*1+eax] | ||
683 | mov esi, ebx | ||
684 | rol esi, 5 | ||
685 | ror ecx, 1 | ||
686 | add esi, ebp | ||
687 | ror ecx, 1 | ||
688 | add eax, esi | ||
689 | ; 20_39 36 | ||
690 | mov esi, DWORD PTR 16[esp] | ||
691 | mov ebp, DWORD PTR 24[esp] | ||
692 | xor esi, ebp | ||
693 | mov ebp, DWORD PTR 48[esp] | ||
694 | xor esi, ebp | ||
695 | mov ebp, DWORD PTR 4[esp] | ||
696 | xor esi, ebp | ||
697 | mov ebp, ebx | ||
698 | rol esi, 1 | ||
699 | xor ebp, ecx | ||
700 | mov DWORD PTR 16[esp],esi | ||
701 | xor ebp, edx | ||
702 | lea esi, DWORD PTR 1859775393[edi*1+esi] | ||
703 | mov edi, eax | ||
704 | rol edi, 5 | ||
705 | ror ebx, 1 | ||
706 | add edi, ebp | ||
707 | ror ebx, 1 | ||
708 | add esi, edi | ||
709 | ; 20_39 37 | ||
710 | mov edi, DWORD PTR 20[esp] | ||
711 | mov ebp, DWORD PTR 28[esp] | ||
712 | xor edi, ebp | ||
713 | mov ebp, DWORD PTR 52[esp] | ||
714 | xor edi, ebp | ||
715 | mov ebp, DWORD PTR 8[esp] | ||
716 | xor edi, ebp | ||
717 | mov ebp, eax | ||
718 | rol edi, 1 | ||
719 | xor ebp, ebx | ||
720 | mov DWORD PTR 20[esp],edi | ||
721 | xor ebp, ecx | ||
722 | lea edi, DWORD PTR 1859775393[edx*1+edi] | ||
723 | mov edx, esi | ||
724 | rol edx, 5 | ||
725 | ror eax, 1 | ||
726 | add edx, ebp | ||
727 | ror eax, 1 | ||
728 | add edi, edx | ||
729 | ; 20_39 38 | ||
730 | mov edx, DWORD PTR 24[esp] | ||
731 | mov ebp, DWORD PTR 32[esp] | ||
732 | xor edx, ebp | ||
733 | mov ebp, DWORD PTR 56[esp] | ||
734 | xor edx, ebp | ||
735 | mov ebp, DWORD PTR 12[esp] | ||
736 | xor edx, ebp | ||
737 | mov ebp, esi | ||
738 | rol edx, 1 | ||
739 | xor ebp, eax | ||
740 | mov DWORD PTR 24[esp],edx | ||
741 | xor ebp, ebx | ||
742 | lea edx, DWORD PTR 1859775393[ecx*1+edx] | ||
743 | mov ecx, edi | ||
744 | rol ecx, 5 | ||
745 | ror esi, 1 | ||
746 | add ecx, ebp | ||
747 | ror esi, 1 | ||
748 | add edx, ecx | ||
749 | ; 20_39 39 | ||
750 | mov ecx, DWORD PTR 28[esp] | ||
751 | mov ebp, DWORD PTR 36[esp] | ||
752 | xor ecx, ebp | ||
753 | mov ebp, DWORD PTR 60[esp] | ||
754 | xor ecx, ebp | ||
755 | mov ebp, DWORD PTR 16[esp] | ||
756 | xor ecx, ebp | ||
757 | mov ebp, edi | ||
758 | rol ecx, 1 | ||
759 | xor ebp, esi | ||
760 | mov DWORD PTR 28[esp],ecx | ||
761 | xor ebp, eax | ||
762 | lea ecx, DWORD PTR 1859775393[ebx*1+ecx] | ||
763 | mov ebx, edx | ||
764 | rol ebx, 5 | ||
765 | ror edi, 1 | ||
766 | add ebx, ebp | ||
767 | ror edi, 1 | ||
768 | add ecx, ebx | ||
769 | ; 40_59 40 | ||
770 | mov ebx, DWORD PTR 32[esp] | ||
771 | mov ebp, DWORD PTR 40[esp] | ||
772 | xor ebx, ebp | ||
773 | mov ebp, DWORD PTR [esp] | ||
774 | xor ebx, ebp | ||
775 | mov ebp, DWORD PTR 20[esp] | ||
776 | xor ebx, ebp | ||
777 | mov ebp, edx | ||
778 | rol ebx, 1 | ||
779 | or ebp, edi | ||
780 | mov DWORD PTR 32[esp],ebx | ||
781 | and ebp, esi | ||
782 | lea ebx, DWORD PTR 2400959708[eax*1+ebx] | ||
783 | mov eax, edx | ||
784 | ror edx, 1 | ||
785 | and eax, edi | ||
786 | or ebp, eax | ||
787 | mov eax, ecx | ||
788 | rol eax, 5 | ||
789 | add ebp, eax | ||
790 | mov eax, DWORD PTR 36[esp] | ||
791 | add ebx, ebp | ||
792 | mov ebp, DWORD PTR 44[esp] | ||
793 | xor eax, ebp | ||
794 | mov ebp, DWORD PTR 4[esp] | ||
795 | xor eax, ebp | ||
796 | mov ebp, DWORD PTR 24[esp] | ||
797 | ror edx, 1 | ||
798 | xor eax, ebp | ||
799 | rol eax, 1 | ||
800 | mov ebp, ecx | ||
801 | mov DWORD PTR 36[esp],eax | ||
802 | or ebp, edx | ||
803 | lea eax, DWORD PTR 2400959708[esi*1+eax] | ||
804 | mov esi, ecx | ||
805 | and ebp, edi | ||
806 | and esi, edx | ||
807 | or ebp, esi | ||
808 | mov esi, ebx | ||
809 | rol esi, 5 | ||
810 | ror ecx, 1 | ||
811 | add ebp, esi | ||
812 | ror ecx, 1 | ||
813 | add eax, ebp | ||
814 | ; 40_59 41 | ||
815 | ; 40_59 42 | ||
816 | mov esi, DWORD PTR 40[esp] | ||
817 | mov ebp, DWORD PTR 48[esp] | ||
818 | xor esi, ebp | ||
819 | mov ebp, DWORD PTR 8[esp] | ||
820 | xor esi, ebp | ||
821 | mov ebp, DWORD PTR 28[esp] | ||
822 | xor esi, ebp | ||
823 | mov ebp, ebx | ||
824 | rol esi, 1 | ||
825 | or ebp, ecx | ||
826 | mov DWORD PTR 40[esp],esi | ||
827 | and ebp, edx | ||
828 | lea esi, DWORD PTR 2400959708[edi*1+esi] | ||
829 | mov edi, ebx | ||
830 | ror ebx, 1 | ||
831 | and edi, ecx | ||
832 | or ebp, edi | ||
833 | mov edi, eax | ||
834 | rol edi, 5 | ||
835 | add ebp, edi | ||
836 | mov edi, DWORD PTR 44[esp] | ||
837 | add esi, ebp | ||
838 | mov ebp, DWORD PTR 52[esp] | ||
839 | xor edi, ebp | ||
840 | mov ebp, DWORD PTR 12[esp] | ||
841 | xor edi, ebp | ||
842 | mov ebp, DWORD PTR 32[esp] | ||
843 | ror ebx, 1 | ||
844 | xor edi, ebp | ||
845 | rol edi, 1 | ||
846 | mov ebp, eax | ||
847 | mov DWORD PTR 44[esp],edi | ||
848 | or ebp, ebx | ||
849 | lea edi, DWORD PTR 2400959708[edx*1+edi] | ||
850 | mov edx, eax | ||
851 | and ebp, ecx | ||
852 | and edx, ebx | ||
853 | or ebp, edx | ||
854 | mov edx, esi | ||
855 | rol edx, 5 | ||
856 | ror eax, 1 | ||
857 | add ebp, edx | ||
858 | ror eax, 1 | ||
859 | add edi, ebp | ||
860 | ; 40_59 43 | ||
861 | ; 40_59 44 | ||
862 | mov edx, DWORD PTR 48[esp] | ||
863 | mov ebp, DWORD PTR 56[esp] | ||
864 | xor edx, ebp | ||
865 | mov ebp, DWORD PTR 16[esp] | ||
866 | xor edx, ebp | ||
867 | mov ebp, DWORD PTR 36[esp] | ||
868 | xor edx, ebp | ||
869 | mov ebp, esi | ||
870 | rol edx, 1 | ||
871 | or ebp, eax | ||
872 | mov DWORD PTR 48[esp],edx | ||
873 | and ebp, ebx | ||
874 | lea edx, DWORD PTR 2400959708[ecx*1+edx] | ||
875 | mov ecx, esi | ||
876 | ror esi, 1 | ||
877 | and ecx, eax | ||
878 | or ebp, ecx | ||
879 | mov ecx, edi | ||
880 | rol ecx, 5 | ||
881 | add ebp, ecx | ||
882 | mov ecx, DWORD PTR 52[esp] | ||
883 | add edx, ebp | ||
884 | mov ebp, DWORD PTR 60[esp] | ||
885 | xor ecx, ebp | ||
886 | mov ebp, DWORD PTR 20[esp] | ||
887 | xor ecx, ebp | ||
888 | mov ebp, DWORD PTR 40[esp] | ||
889 | ror esi, 1 | ||
890 | xor ecx, ebp | ||
891 | rol ecx, 1 | ||
892 | mov ebp, edi | ||
893 | mov DWORD PTR 52[esp],ecx | ||
894 | or ebp, esi | ||
895 | lea ecx, DWORD PTR 2400959708[ebx*1+ecx] | ||
896 | mov ebx, edi | ||
897 | and ebp, eax | ||
898 | and ebx, esi | ||
899 | or ebp, ebx | ||
900 | mov ebx, edx | ||
901 | rol ebx, 5 | ||
902 | ror edi, 1 | ||
903 | add ebp, ebx | ||
904 | ror edi, 1 | ||
905 | add ecx, ebp | ||
906 | ; 40_59 45 | ||
907 | ; 40_59 46 | ||
908 | mov ebx, DWORD PTR 56[esp] | ||
909 | mov ebp, DWORD PTR [esp] | ||
910 | xor ebx, ebp | ||
911 | mov ebp, DWORD PTR 24[esp] | ||
912 | xor ebx, ebp | ||
913 | mov ebp, DWORD PTR 44[esp] | ||
914 | xor ebx, ebp | ||
915 | mov ebp, edx | ||
916 | rol ebx, 1 | ||
917 | or ebp, edi | ||
918 | mov DWORD PTR 56[esp],ebx | ||
919 | and ebp, esi | ||
920 | lea ebx, DWORD PTR 2400959708[eax*1+ebx] | ||
921 | mov eax, edx | ||
922 | ror edx, 1 | ||
923 | and eax, edi | ||
924 | or ebp, eax | ||
925 | mov eax, ecx | ||
926 | rol eax, 5 | ||
927 | add ebp, eax | ||
928 | mov eax, DWORD PTR 60[esp] | ||
929 | add ebx, ebp | ||
930 | mov ebp, DWORD PTR 4[esp] | ||
931 | xor eax, ebp | ||
932 | mov ebp, DWORD PTR 28[esp] | ||
933 | xor eax, ebp | ||
934 | mov ebp, DWORD PTR 48[esp] | ||
935 | ror edx, 1 | ||
936 | xor eax, ebp | ||
937 | rol eax, 1 | ||
938 | mov ebp, ecx | ||
939 | mov DWORD PTR 60[esp],eax | ||
940 | or ebp, edx | ||
941 | lea eax, DWORD PTR 2400959708[esi*1+eax] | ||
942 | mov esi, ecx | ||
943 | and ebp, edi | ||
944 | and esi, edx | ||
945 | or ebp, esi | ||
946 | mov esi, ebx | ||
947 | rol esi, 5 | ||
948 | ror ecx, 1 | ||
949 | add ebp, esi | ||
950 | ror ecx, 1 | ||
951 | add eax, ebp | ||
952 | ; 40_59 47 | ||
953 | ; 40_59 48 | ||
954 | mov esi, DWORD PTR [esp] | ||
955 | mov ebp, DWORD PTR 8[esp] | ||
956 | xor esi, ebp | ||
957 | mov ebp, DWORD PTR 32[esp] | ||
958 | xor esi, ebp | ||
959 | mov ebp, DWORD PTR 52[esp] | ||
960 | xor esi, ebp | ||
961 | mov ebp, ebx | ||
962 | rol esi, 1 | ||
963 | or ebp, ecx | ||
964 | mov DWORD PTR [esp],esi | ||
965 | and ebp, edx | ||
966 | lea esi, DWORD PTR 2400959708[edi*1+esi] | ||
967 | mov edi, ebx | ||
968 | ror ebx, 1 | ||
969 | and edi, ecx | ||
970 | or ebp, edi | ||
971 | mov edi, eax | ||
972 | rol edi, 5 | ||
973 | add ebp, edi | ||
974 | mov edi, DWORD PTR 4[esp] | ||
975 | add esi, ebp | ||
976 | mov ebp, DWORD PTR 12[esp] | ||
977 | xor edi, ebp | ||
978 | mov ebp, DWORD PTR 36[esp] | ||
979 | xor edi, ebp | ||
980 | mov ebp, DWORD PTR 56[esp] | ||
981 | ror ebx, 1 | ||
982 | xor edi, ebp | ||
983 | rol edi, 1 | ||
984 | mov ebp, eax | ||
985 | mov DWORD PTR 4[esp],edi | ||
986 | or ebp, ebx | ||
987 | lea edi, DWORD PTR 2400959708[edx*1+edi] | ||
988 | mov edx, eax | ||
989 | and ebp, ecx | ||
990 | and edx, ebx | ||
991 | or ebp, edx | ||
992 | mov edx, esi | ||
993 | rol edx, 5 | ||
994 | ror eax, 1 | ||
995 | add ebp, edx | ||
996 | ror eax, 1 | ||
997 | add edi, ebp | ||
998 | ; 40_59 49 | ||
999 | ; 40_59 50 | ||
1000 | mov edx, DWORD PTR 8[esp] | ||
1001 | mov ebp, DWORD PTR 16[esp] | ||
1002 | xor edx, ebp | ||
1003 | mov ebp, DWORD PTR 40[esp] | ||
1004 | xor edx, ebp | ||
1005 | mov ebp, DWORD PTR 60[esp] | ||
1006 | xor edx, ebp | ||
1007 | mov ebp, esi | ||
1008 | rol edx, 1 | ||
1009 | or ebp, eax | ||
1010 | mov DWORD PTR 8[esp],edx | ||
1011 | and ebp, ebx | ||
1012 | lea edx, DWORD PTR 2400959708[ecx*1+edx] | ||
1013 | mov ecx, esi | ||
1014 | ror esi, 1 | ||
1015 | and ecx, eax | ||
1016 | or ebp, ecx | ||
1017 | mov ecx, edi | ||
1018 | rol ecx, 5 | ||
1019 | add ebp, ecx | ||
1020 | mov ecx, DWORD PTR 12[esp] | ||
1021 | add edx, ebp | ||
1022 | mov ebp, DWORD PTR 20[esp] | ||
1023 | xor ecx, ebp | ||
1024 | mov ebp, DWORD PTR 44[esp] | ||
1025 | xor ecx, ebp | ||
1026 | mov ebp, DWORD PTR [esp] | ||
1027 | ror esi, 1 | ||
1028 | xor ecx, ebp | ||
1029 | rol ecx, 1 | ||
1030 | mov ebp, edi | ||
1031 | mov DWORD PTR 12[esp],ecx | ||
1032 | or ebp, esi | ||
1033 | lea ecx, DWORD PTR 2400959708[ebx*1+ecx] | ||
1034 | mov ebx, edi | ||
1035 | and ebp, eax | ||
1036 | and ebx, esi | ||
1037 | or ebp, ebx | ||
1038 | mov ebx, edx | ||
1039 | rol ebx, 5 | ||
1040 | ror edi, 1 | ||
1041 | add ebp, ebx | ||
1042 | ror edi, 1 | ||
1043 | add ecx, ebp | ||
1044 | ; 40_59 51 | ||
1045 | ; 40_59 52 | ||
1046 | mov ebx, DWORD PTR 16[esp] | ||
1047 | mov ebp, DWORD PTR 24[esp] | ||
1048 | xor ebx, ebp | ||
1049 | mov ebp, DWORD PTR 48[esp] | ||
1050 | xor ebx, ebp | ||
1051 | mov ebp, DWORD PTR 4[esp] | ||
1052 | xor ebx, ebp | ||
1053 | mov ebp, edx | ||
1054 | rol ebx, 1 | ||
1055 | or ebp, edi | ||
1056 | mov DWORD PTR 16[esp],ebx | ||
1057 | and ebp, esi | ||
1058 | lea ebx, DWORD PTR 2400959708[eax*1+ebx] | ||
1059 | mov eax, edx | ||
1060 | ror edx, 1 | ||
1061 | and eax, edi | ||
1062 | or ebp, eax | ||
1063 | mov eax, ecx | ||
1064 | rol eax, 5 | ||
1065 | add ebp, eax | ||
1066 | mov eax, DWORD PTR 20[esp] | ||
1067 | add ebx, ebp | ||
1068 | mov ebp, DWORD PTR 28[esp] | ||
1069 | xor eax, ebp | ||
1070 | mov ebp, DWORD PTR 52[esp] | ||
1071 | xor eax, ebp | ||
1072 | mov ebp, DWORD PTR 8[esp] | ||
1073 | ror edx, 1 | ||
1074 | xor eax, ebp | ||
1075 | rol eax, 1 | ||
1076 | mov ebp, ecx | ||
1077 | mov DWORD PTR 20[esp],eax | ||
1078 | or ebp, edx | ||
1079 | lea eax, DWORD PTR 2400959708[esi*1+eax] | ||
1080 | mov esi, ecx | ||
1081 | and ebp, edi | ||
1082 | and esi, edx | ||
1083 | or ebp, esi | ||
1084 | mov esi, ebx | ||
1085 | rol esi, 5 | ||
1086 | ror ecx, 1 | ||
1087 | add ebp, esi | ||
1088 | ror ecx, 1 | ||
1089 | add eax, ebp | ||
1090 | ; 40_59 53 | ||
1091 | ; 40_59 54 | ||
1092 | mov esi, DWORD PTR 24[esp] | ||
1093 | mov ebp, DWORD PTR 32[esp] | ||
1094 | xor esi, ebp | ||
1095 | mov ebp, DWORD PTR 56[esp] | ||
1096 | xor esi, ebp | ||
1097 | mov ebp, DWORD PTR 12[esp] | ||
1098 | xor esi, ebp | ||
1099 | mov ebp, ebx | ||
1100 | rol esi, 1 | ||
1101 | or ebp, ecx | ||
1102 | mov DWORD PTR 24[esp],esi | ||
1103 | and ebp, edx | ||
1104 | lea esi, DWORD PTR 2400959708[edi*1+esi] | ||
1105 | mov edi, ebx | ||
1106 | ror ebx, 1 | ||
1107 | and edi, ecx | ||
1108 | or ebp, edi | ||
1109 | mov edi, eax | ||
1110 | rol edi, 5 | ||
1111 | add ebp, edi | ||
1112 | mov edi, DWORD PTR 28[esp] | ||
1113 | add esi, ebp | ||
1114 | mov ebp, DWORD PTR 36[esp] | ||
1115 | xor edi, ebp | ||
1116 | mov ebp, DWORD PTR 60[esp] | ||
1117 | xor edi, ebp | ||
1118 | mov ebp, DWORD PTR 16[esp] | ||
1119 | ror ebx, 1 | ||
1120 | xor edi, ebp | ||
1121 | rol edi, 1 | ||
1122 | mov ebp, eax | ||
1123 | mov DWORD PTR 28[esp],edi | ||
1124 | or ebp, ebx | ||
1125 | lea edi, DWORD PTR 2400959708[edx*1+edi] | ||
1126 | mov edx, eax | ||
1127 | and ebp, ecx | ||
1128 | and edx, ebx | ||
1129 | or ebp, edx | ||
1130 | mov edx, esi | ||
1131 | rol edx, 5 | ||
1132 | ror eax, 1 | ||
1133 | add ebp, edx | ||
1134 | ror eax, 1 | ||
1135 | add edi, ebp | ||
1136 | ; 40_59 55 | ||
1137 | ; 40_59 56 | ||
1138 | mov edx, DWORD PTR 32[esp] | ||
1139 | mov ebp, DWORD PTR 40[esp] | ||
1140 | xor edx, ebp | ||
1141 | mov ebp, DWORD PTR [esp] | ||
1142 | xor edx, ebp | ||
1143 | mov ebp, DWORD PTR 20[esp] | ||
1144 | xor edx, ebp | ||
1145 | mov ebp, esi | ||
1146 | rol edx, 1 | ||
1147 | or ebp, eax | ||
1148 | mov DWORD PTR 32[esp],edx | ||
1149 | and ebp, ebx | ||
1150 | lea edx, DWORD PTR 2400959708[ecx*1+edx] | ||
1151 | mov ecx, esi | ||
1152 | ror esi, 1 | ||
1153 | and ecx, eax | ||
1154 | or ebp, ecx | ||
1155 | mov ecx, edi | ||
1156 | rol ecx, 5 | ||
1157 | add ebp, ecx | ||
1158 | mov ecx, DWORD PTR 36[esp] | ||
1159 | add edx, ebp | ||
1160 | mov ebp, DWORD PTR 44[esp] | ||
1161 | xor ecx, ebp | ||
1162 | mov ebp, DWORD PTR 4[esp] | ||
1163 | xor ecx, ebp | ||
1164 | mov ebp, DWORD PTR 24[esp] | ||
1165 | ror esi, 1 | ||
1166 | xor ecx, ebp | ||
1167 | rol ecx, 1 | ||
1168 | mov ebp, edi | ||
1169 | mov DWORD PTR 36[esp],ecx | ||
1170 | or ebp, esi | ||
1171 | lea ecx, DWORD PTR 2400959708[ebx*1+ecx] | ||
1172 | mov ebx, edi | ||
1173 | and ebp, eax | ||
1174 | and ebx, esi | ||
1175 | or ebp, ebx | ||
1176 | mov ebx, edx | ||
1177 | rol ebx, 5 | ||
1178 | ror edi, 1 | ||
1179 | add ebp, ebx | ||
1180 | ror edi, 1 | ||
1181 | add ecx, ebp | ||
1182 | ; 40_59 57 | ||
1183 | ; 40_59 58 | ||
1184 | mov ebx, DWORD PTR 40[esp] | ||
1185 | mov ebp, DWORD PTR 48[esp] | ||
1186 | xor ebx, ebp | ||
1187 | mov ebp, DWORD PTR 8[esp] | ||
1188 | xor ebx, ebp | ||
1189 | mov ebp, DWORD PTR 28[esp] | ||
1190 | xor ebx, ebp | ||
1191 | mov ebp, edx | ||
1192 | rol ebx, 1 | ||
1193 | or ebp, edi | ||
1194 | mov DWORD PTR 40[esp],ebx | ||
1195 | and ebp, esi | ||
1196 | lea ebx, DWORD PTR 2400959708[eax*1+ebx] | ||
1197 | mov eax, edx | ||
1198 | ror edx, 1 | ||
1199 | and eax, edi | ||
1200 | or ebp, eax | ||
1201 | mov eax, ecx | ||
1202 | rol eax, 5 | ||
1203 | add ebp, eax | ||
1204 | mov eax, DWORD PTR 44[esp] | ||
1205 | add ebx, ebp | ||
1206 | mov ebp, DWORD PTR 52[esp] | ||
1207 | xor eax, ebp | ||
1208 | mov ebp, DWORD PTR 12[esp] | ||
1209 | xor eax, ebp | ||
1210 | mov ebp, DWORD PTR 32[esp] | ||
1211 | ror edx, 1 | ||
1212 | xor eax, ebp | ||
1213 | rol eax, 1 | ||
1214 | mov ebp, ecx | ||
1215 | mov DWORD PTR 44[esp],eax | ||
1216 | or ebp, edx | ||
1217 | lea eax, DWORD PTR 2400959708[esi*1+eax] | ||
1218 | mov esi, ecx | ||
1219 | and ebp, edi | ||
1220 | and esi, edx | ||
1221 | or ebp, esi | ||
1222 | mov esi, ebx | ||
1223 | rol esi, 5 | ||
1224 | ror ecx, 1 | ||
1225 | add ebp, esi | ||
1226 | ror ecx, 1 | ||
1227 | add eax, ebp | ||
1228 | ; 40_59 59 | ||
1229 | ; 20_39 60 | ||
1230 | mov esi, DWORD PTR 48[esp] | ||
1231 | mov ebp, DWORD PTR 56[esp] | ||
1232 | xor esi, ebp | ||
1233 | mov ebp, DWORD PTR 16[esp] | ||
1234 | xor esi, ebp | ||
1235 | mov ebp, DWORD PTR 36[esp] | ||
1236 | xor esi, ebp | ||
1237 | mov ebp, ebx | ||
1238 | rol esi, 1 | ||
1239 | xor ebp, ecx | ||
1240 | mov DWORD PTR 48[esp],esi | ||
1241 | xor ebp, edx | ||
1242 | lea esi, DWORD PTR 3395469782[edi*1+esi] | ||
1243 | mov edi, eax | ||
1244 | rol edi, 5 | ||
1245 | ror ebx, 1 | ||
1246 | add edi, ebp | ||
1247 | ror ebx, 1 | ||
1248 | add esi, edi | ||
1249 | ; 20_39 61 | ||
1250 | mov edi, DWORD PTR 52[esp] | ||
1251 | mov ebp, DWORD PTR 60[esp] | ||
1252 | xor edi, ebp | ||
1253 | mov ebp, DWORD PTR 20[esp] | ||
1254 | xor edi, ebp | ||
1255 | mov ebp, DWORD PTR 40[esp] | ||
1256 | xor edi, ebp | ||
1257 | mov ebp, eax | ||
1258 | rol edi, 1 | ||
1259 | xor ebp, ebx | ||
1260 | mov DWORD PTR 52[esp],edi | ||
1261 | xor ebp, ecx | ||
1262 | lea edi, DWORD PTR 3395469782[edx*1+edi] | ||
1263 | mov edx, esi | ||
1264 | rol edx, 5 | ||
1265 | ror eax, 1 | ||
1266 | add edx, ebp | ||
1267 | ror eax, 1 | ||
1268 | add edi, edx | ||
1269 | ; 20_39 62 | ||
1270 | mov edx, DWORD PTR 56[esp] | ||
1271 | mov ebp, DWORD PTR [esp] | ||
1272 | xor edx, ebp | ||
1273 | mov ebp, DWORD PTR 24[esp] | ||
1274 | xor edx, ebp | ||
1275 | mov ebp, DWORD PTR 44[esp] | ||
1276 | xor edx, ebp | ||
1277 | mov ebp, esi | ||
1278 | rol edx, 1 | ||
1279 | xor ebp, eax | ||
1280 | mov DWORD PTR 56[esp],edx | ||
1281 | xor ebp, ebx | ||
1282 | lea edx, DWORD PTR 3395469782[ecx*1+edx] | ||
1283 | mov ecx, edi | ||
1284 | rol ecx, 5 | ||
1285 | ror esi, 1 | ||
1286 | add ecx, ebp | ||
1287 | ror esi, 1 | ||
1288 | add edx, ecx | ||
1289 | ; 20_39 63 | ||
1290 | mov ecx, DWORD PTR 60[esp] | ||
1291 | mov ebp, DWORD PTR 4[esp] | ||
1292 | xor ecx, ebp | ||
1293 | mov ebp, DWORD PTR 28[esp] | ||
1294 | xor ecx, ebp | ||
1295 | mov ebp, DWORD PTR 48[esp] | ||
1296 | xor ecx, ebp | ||
1297 | mov ebp, edi | ||
1298 | rol ecx, 1 | ||
1299 | xor ebp, esi | ||
1300 | mov DWORD PTR 60[esp],ecx | ||
1301 | xor ebp, eax | ||
1302 | lea ecx, DWORD PTR 3395469782[ebx*1+ecx] | ||
1303 | mov ebx, edx | ||
1304 | rol ebx, 5 | ||
1305 | ror edi, 1 | ||
1306 | add ebx, ebp | ||
1307 | ror edi, 1 | ||
1308 | add ecx, ebx | ||
1309 | ; 20_39 64 | ||
1310 | mov ebx, DWORD PTR [esp] | ||
1311 | mov ebp, DWORD PTR 8[esp] | ||
1312 | xor ebx, ebp | ||
1313 | mov ebp, DWORD PTR 32[esp] | ||
1314 | xor ebx, ebp | ||
1315 | mov ebp, DWORD PTR 52[esp] | ||
1316 | xor ebx, ebp | ||
1317 | mov ebp, edx | ||
1318 | rol ebx, 1 | ||
1319 | xor ebp, edi | ||
1320 | mov DWORD PTR [esp],ebx | ||
1321 | xor ebp, esi | ||
1322 | lea ebx, DWORD PTR 3395469782[eax*1+ebx] | ||
1323 | mov eax, ecx | ||
1324 | rol eax, 5 | ||
1325 | ror edx, 1 | ||
1326 | add eax, ebp | ||
1327 | ror edx, 1 | ||
1328 | add ebx, eax | ||
1329 | ; 20_39 65 | ||
1330 | mov eax, DWORD PTR 4[esp] | ||
1331 | mov ebp, DWORD PTR 12[esp] | ||
1332 | xor eax, ebp | ||
1333 | mov ebp, DWORD PTR 36[esp] | ||
1334 | xor eax, ebp | ||
1335 | mov ebp, DWORD PTR 56[esp] | ||
1336 | xor eax, ebp | ||
1337 | mov ebp, ecx | ||
1338 | rol eax, 1 | ||
1339 | xor ebp, edx | ||
1340 | mov DWORD PTR 4[esp],eax | ||
1341 | xor ebp, edi | ||
1342 | lea eax, DWORD PTR 3395469782[esi*1+eax] | ||
1343 | mov esi, ebx | ||
1344 | rol esi, 5 | ||
1345 | ror ecx, 1 | ||
1346 | add esi, ebp | ||
1347 | ror ecx, 1 | ||
1348 | add eax, esi | ||
1349 | ; 20_39 66 | ||
1350 | mov esi, DWORD PTR 8[esp] | ||
1351 | mov ebp, DWORD PTR 16[esp] | ||
1352 | xor esi, ebp | ||
1353 | mov ebp, DWORD PTR 40[esp] | ||
1354 | xor esi, ebp | ||
1355 | mov ebp, DWORD PTR 60[esp] | ||
1356 | xor esi, ebp | ||
1357 | mov ebp, ebx | ||
1358 | rol esi, 1 | ||
1359 | xor ebp, ecx | ||
1360 | mov DWORD PTR 8[esp],esi | ||
1361 | xor ebp, edx | ||
1362 | lea esi, DWORD PTR 3395469782[edi*1+esi] | ||
1363 | mov edi, eax | ||
1364 | rol edi, 5 | ||
1365 | ror ebx, 1 | ||
1366 | add edi, ebp | ||
1367 | ror ebx, 1 | ||
1368 | add esi, edi | ||
1369 | ; 20_39 67 | ||
1370 | mov edi, DWORD PTR 12[esp] | ||
1371 | mov ebp, DWORD PTR 20[esp] | ||
1372 | xor edi, ebp | ||
1373 | mov ebp, DWORD PTR 44[esp] | ||
1374 | xor edi, ebp | ||
1375 | mov ebp, DWORD PTR [esp] | ||
1376 | xor edi, ebp | ||
1377 | mov ebp, eax | ||
1378 | rol edi, 1 | ||
1379 | xor ebp, ebx | ||
1380 | mov DWORD PTR 12[esp],edi | ||
1381 | xor ebp, ecx | ||
1382 | lea edi, DWORD PTR 3395469782[edx*1+edi] | ||
1383 | mov edx, esi | ||
1384 | rol edx, 5 | ||
1385 | ror eax, 1 | ||
1386 | add edx, ebp | ||
1387 | ror eax, 1 | ||
1388 | add edi, edx | ||
1389 | ; 20_39 68 | ||
1390 | mov edx, DWORD PTR 16[esp] | ||
1391 | mov ebp, DWORD PTR 24[esp] | ||
1392 | xor edx, ebp | ||
1393 | mov ebp, DWORD PTR 48[esp] | ||
1394 | xor edx, ebp | ||
1395 | mov ebp, DWORD PTR 4[esp] | ||
1396 | xor edx, ebp | ||
1397 | mov ebp, esi | ||
1398 | rol edx, 1 | ||
1399 | xor ebp, eax | ||
1400 | mov DWORD PTR 16[esp],edx | ||
1401 | xor ebp, ebx | ||
1402 | lea edx, DWORD PTR 3395469782[ecx*1+edx] | ||
1403 | mov ecx, edi | ||
1404 | rol ecx, 5 | ||
1405 | ror esi, 1 | ||
1406 | add ecx, ebp | ||
1407 | ror esi, 1 | ||
1408 | add edx, ecx | ||
1409 | ; 20_39 69 | ||
1410 | mov ecx, DWORD PTR 20[esp] | ||
1411 | mov ebp, DWORD PTR 28[esp] | ||
1412 | xor ecx, ebp | ||
1413 | mov ebp, DWORD PTR 52[esp] | ||
1414 | xor ecx, ebp | ||
1415 | mov ebp, DWORD PTR 8[esp] | ||
1416 | xor ecx, ebp | ||
1417 | mov ebp, edi | ||
1418 | rol ecx, 1 | ||
1419 | xor ebp, esi | ||
1420 | mov DWORD PTR 20[esp],ecx | ||
1421 | xor ebp, eax | ||
1422 | lea ecx, DWORD PTR 3395469782[ebx*1+ecx] | ||
1423 | mov ebx, edx | ||
1424 | rol ebx, 5 | ||
1425 | ror edi, 1 | ||
1426 | add ebx, ebp | ||
1427 | ror edi, 1 | ||
1428 | add ecx, ebx | ||
1429 | ; 20_39 70 | ||
1430 | mov ebx, DWORD PTR 24[esp] | ||
1431 | mov ebp, DWORD PTR 32[esp] | ||
1432 | xor ebx, ebp | ||
1433 | mov ebp, DWORD PTR 56[esp] | ||
1434 | xor ebx, ebp | ||
1435 | mov ebp, DWORD PTR 12[esp] | ||
1436 | xor ebx, ebp | ||
1437 | mov ebp, edx | ||
1438 | rol ebx, 1 | ||
1439 | xor ebp, edi | ||
1440 | mov DWORD PTR 24[esp],ebx | ||
1441 | xor ebp, esi | ||
1442 | lea ebx, DWORD PTR 3395469782[eax*1+ebx] | ||
1443 | mov eax, ecx | ||
1444 | rol eax, 5 | ||
1445 | ror edx, 1 | ||
1446 | add eax, ebp | ||
1447 | ror edx, 1 | ||
1448 | add ebx, eax | ||
1449 | ; 20_39 71 | ||
1450 | mov eax, DWORD PTR 28[esp] | ||
1451 | mov ebp, DWORD PTR 36[esp] | ||
1452 | xor eax, ebp | ||
1453 | mov ebp, DWORD PTR 60[esp] | ||
1454 | xor eax, ebp | ||
1455 | mov ebp, DWORD PTR 16[esp] | ||
1456 | xor eax, ebp | ||
1457 | mov ebp, ecx | ||
1458 | rol eax, 1 | ||
1459 | xor ebp, edx | ||
1460 | mov DWORD PTR 28[esp],eax | ||
1461 | xor ebp, edi | ||
1462 | lea eax, DWORD PTR 3395469782[esi*1+eax] | ||
1463 | mov esi, ebx | ||
1464 | rol esi, 5 | ||
1465 | ror ecx, 1 | ||
1466 | add esi, ebp | ||
1467 | ror ecx, 1 | ||
1468 | add eax, esi | ||
1469 | ; 20_39 72 | ||
1470 | mov esi, DWORD PTR 32[esp] | ||
1471 | mov ebp, DWORD PTR 40[esp] | ||
1472 | xor esi, ebp | ||
1473 | mov ebp, DWORD PTR [esp] | ||
1474 | xor esi, ebp | ||
1475 | mov ebp, DWORD PTR 20[esp] | ||
1476 | xor esi, ebp | ||
1477 | mov ebp, ebx | ||
1478 | rol esi, 1 | ||
1479 | xor ebp, ecx | ||
1480 | mov DWORD PTR 32[esp],esi | ||
1481 | xor ebp, edx | ||
1482 | lea esi, DWORD PTR 3395469782[edi*1+esi] | ||
1483 | mov edi, eax | ||
1484 | rol edi, 5 | ||
1485 | ror ebx, 1 | ||
1486 | add edi, ebp | ||
1487 | ror ebx, 1 | ||
1488 | add esi, edi | ||
1489 | ; 20_39 73 | ||
1490 | mov edi, DWORD PTR 36[esp] | ||
1491 | mov ebp, DWORD PTR 44[esp] | ||
1492 | xor edi, ebp | ||
1493 | mov ebp, DWORD PTR 4[esp] | ||
1494 | xor edi, ebp | ||
1495 | mov ebp, DWORD PTR 24[esp] | ||
1496 | xor edi, ebp | ||
1497 | mov ebp, eax | ||
1498 | rol edi, 1 | ||
1499 | xor ebp, ebx | ||
1500 | mov DWORD PTR 36[esp],edi | ||
1501 | xor ebp, ecx | ||
1502 | lea edi, DWORD PTR 3395469782[edx*1+edi] | ||
1503 | mov edx, esi | ||
1504 | rol edx, 5 | ||
1505 | ror eax, 1 | ||
1506 | add edx, ebp | ||
1507 | ror eax, 1 | ||
1508 | add edi, edx | ||
1509 | ; 20_39 74 | ||
1510 | mov edx, DWORD PTR 40[esp] | ||
1511 | mov ebp, DWORD PTR 48[esp] | ||
1512 | xor edx, ebp | ||
1513 | mov ebp, DWORD PTR 8[esp] | ||
1514 | xor edx, ebp | ||
1515 | mov ebp, DWORD PTR 28[esp] | ||
1516 | xor edx, ebp | ||
1517 | mov ebp, esi | ||
1518 | rol edx, 1 | ||
1519 | xor ebp, eax | ||
1520 | mov DWORD PTR 40[esp],edx | ||
1521 | xor ebp, ebx | ||
1522 | lea edx, DWORD PTR 3395469782[ecx*1+edx] | ||
1523 | mov ecx, edi | ||
1524 | rol ecx, 5 | ||
1525 | ror esi, 1 | ||
1526 | add ecx, ebp | ||
1527 | ror esi, 1 | ||
1528 | add edx, ecx | ||
1529 | ; 20_39 75 | ||
1530 | mov ecx, DWORD PTR 44[esp] | ||
1531 | mov ebp, DWORD PTR 52[esp] | ||
1532 | xor ecx, ebp | ||
1533 | mov ebp, DWORD PTR 12[esp] | ||
1534 | xor ecx, ebp | ||
1535 | mov ebp, DWORD PTR 32[esp] | ||
1536 | xor ecx, ebp | ||
1537 | mov ebp, edi | ||
1538 | rol ecx, 1 | ||
1539 | xor ebp, esi | ||
1540 | mov DWORD PTR 44[esp],ecx | ||
1541 | xor ebp, eax | ||
1542 | lea ecx, DWORD PTR 3395469782[ebx*1+ecx] | ||
1543 | mov ebx, edx | ||
1544 | rol ebx, 5 | ||
1545 | ror edi, 1 | ||
1546 | add ebx, ebp | ||
1547 | ror edi, 1 | ||
1548 | add ecx, ebx | ||
1549 | ; 20_39 76 | ||
1550 | mov ebx, DWORD PTR 48[esp] | ||
1551 | mov ebp, DWORD PTR 56[esp] | ||
1552 | xor ebx, ebp | ||
1553 | mov ebp, DWORD PTR 16[esp] | ||
1554 | xor ebx, ebp | ||
1555 | mov ebp, DWORD PTR 36[esp] | ||
1556 | xor ebx, ebp | ||
1557 | mov ebp, edx | ||
1558 | rol ebx, 1 | ||
1559 | xor ebp, edi | ||
1560 | mov DWORD PTR 48[esp],ebx | ||
1561 | xor ebp, esi | ||
1562 | lea ebx, DWORD PTR 3395469782[eax*1+ebx] | ||
1563 | mov eax, ecx | ||
1564 | rol eax, 5 | ||
1565 | ror edx, 1 | ||
1566 | add eax, ebp | ||
1567 | ror edx, 1 | ||
1568 | add ebx, eax | ||
1569 | ; 20_39 77 | ||
1570 | mov eax, DWORD PTR 52[esp] | ||
1571 | mov ebp, DWORD PTR 60[esp] | ||
1572 | xor eax, ebp | ||
1573 | mov ebp, DWORD PTR 20[esp] | ||
1574 | xor eax, ebp | ||
1575 | mov ebp, DWORD PTR 40[esp] | ||
1576 | xor eax, ebp | ||
1577 | mov ebp, ecx | ||
1578 | rol eax, 1 | ||
1579 | xor ebp, edx | ||
1580 | mov DWORD PTR 52[esp],eax | ||
1581 | xor ebp, edi | ||
1582 | lea eax, DWORD PTR 3395469782[esi*1+eax] | ||
1583 | mov esi, ebx | ||
1584 | rol esi, 5 | ||
1585 | ror ecx, 1 | ||
1586 | add esi, ebp | ||
1587 | ror ecx, 1 | ||
1588 | add eax, esi | ||
1589 | ; 20_39 78 | ||
1590 | mov esi, DWORD PTR 56[esp] | ||
1591 | mov ebp, DWORD PTR [esp] | ||
1592 | xor esi, ebp | ||
1593 | mov ebp, DWORD PTR 24[esp] | ||
1594 | xor esi, ebp | ||
1595 | mov ebp, DWORD PTR 44[esp] | ||
1596 | xor esi, ebp | ||
1597 | mov ebp, ebx | ||
1598 | rol esi, 1 | ||
1599 | xor ebp, ecx | ||
1600 | mov DWORD PTR 56[esp],esi | ||
1601 | xor ebp, edx | ||
1602 | lea esi, DWORD PTR 3395469782[edi*1+esi] | ||
1603 | mov edi, eax | ||
1604 | rol edi, 5 | ||
1605 | ror ebx, 1 | ||
1606 | add edi, ebp | ||
1607 | ror ebx, 1 | ||
1608 | add esi, edi | ||
1609 | ; 20_39 79 | ||
1610 | mov edi, DWORD PTR 60[esp] | ||
1611 | mov ebp, DWORD PTR 4[esp] | ||
1612 | xor edi, ebp | ||
1613 | mov ebp, DWORD PTR 28[esp] | ||
1614 | xor edi, ebp | ||
1615 | mov ebp, DWORD PTR 48[esp] | ||
1616 | xor edi, ebp | ||
1617 | mov ebp, eax | ||
1618 | rol edi, 1 | ||
1619 | xor ebp, ebx | ||
1620 | mov DWORD PTR 60[esp],edi | ||
1621 | xor ebp, ecx | ||
1622 | lea edi, DWORD PTR 3395469782[edx*1+edi] | ||
1623 | mov edx, esi | ||
1624 | rol edx, 5 | ||
1625 | add edx, ebp | ||
1626 | mov ebp, DWORD PTR 92[esp] | ||
1627 | ror eax, 1 | ||
1628 | add edi, edx | ||
1629 | ror eax, 1 | ||
1630 | ; End processing | ||
1631 | ; | ||
1632 | mov edx, DWORD PTR 12[ebp] | ||
1633 | add edx, ebx | ||
1634 | mov ebx, DWORD PTR 4[ebp] | ||
1635 | add ebx, esi | ||
1636 | mov esi, eax | ||
1637 | mov eax, DWORD PTR [ebp] | ||
1638 | mov DWORD PTR 12[ebp],edx | ||
1639 | add eax, edi | ||
1640 | mov edi, DWORD PTR 16[ebp] | ||
1641 | add edi, ecx | ||
1642 | mov ecx, DWORD PTR 8[ebp] | ||
1643 | add ecx, esi | ||
1644 | mov DWORD PTR [ebp],eax | ||
1645 | mov esi, DWORD PTR 64[esp] | ||
1646 | mov DWORD PTR 8[ebp],ecx | ||
1647 | add esi, 64 | ||
1648 | mov eax, DWORD PTR 68[esp] | ||
1649 | mov DWORD PTR 16[ebp],edi | ||
1650 | cmp eax, esi | ||
1651 | mov DWORD PTR 4[ebp],ebx | ||
1652 | jl $L001end | ||
1653 | mov eax, DWORD PTR [esi] | ||
1654 | jmp L000start | ||
1655 | $L001end: | ||
1656 | add esp, 72 | ||
1657 | pop edi | ||
1658 | pop ebx | ||
1659 | pop ebp | ||
1660 | pop esi | ||
1661 | ret | ||
1662 | _sha1_block_x86 ENDP | ||
1663 | _TEXT ENDS | ||
1664 | 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 @@ | |||
1 | /* Run the C pre-processor over this file with one of the following defined | ||
2 | * ELF - elf object files, | ||
3 | * OUT - a.out object files, | ||
4 | * BSDI - BSDI style a.out object files | ||
5 | * SOL - Solaris style elf | ||
6 | */ | ||
7 | |||
8 | #define TYPE(a,b) .type a,b | ||
9 | #define SIZE(a,b) .size a,b | ||
10 | |||
11 | #if defined(OUT) || defined(BSDI) | ||
12 | #define sha1_block_x86 _sha1_block_x86 | ||
13 | |||
14 | #endif | ||
15 | |||
16 | #ifdef OUT | ||
17 | #define OK 1 | ||
18 | #define ALIGN 4 | ||
19 | #endif | ||
20 | |||
21 | #ifdef BSDI | ||
22 | #define OK 1 | ||
23 | #define ALIGN 4 | ||
24 | #undef SIZE | ||
25 | #undef TYPE | ||
26 | #define SIZE(a,b) | ||
27 | #define TYPE(a,b) | ||
28 | #endif | ||
29 | |||
30 | #if defined(ELF) || defined(SOL) | ||
31 | #define OK 1 | ||
32 | #define ALIGN 16 | ||
33 | #endif | ||
34 | |||
35 | #ifndef OK | ||
36 | You need to define one of | ||
37 | ELF - elf systems - linux-elf, NetBSD and DG-UX | ||
38 | OUT - a.out systems - linux-a.out and FreeBSD | ||
39 | SOL - solaris systems, which are elf with strange comment lines | ||
40 | BSDI - a.out with a very primative version of as. | ||
41 | #endif | ||
42 | |||
43 | /* Let the Assembler begin :-) */ | ||
44 | /* Don't even think of reading this code */ | ||
45 | /* It was automatically generated by sha1-586.pl */ | ||
46 | /* Which is a perl program used to generate the x86 assember for */ | ||
47 | /* any of elf, a.out, BSDI,Win32, or Solaris */ | ||
48 | /* eric <eay@cryptsoft.com> */ | ||
49 | |||
50 | .file "sha1-586.s" | ||
51 | .version "01.01" | ||
52 | gcc2_compiled.: | ||
53 | .text | ||
54 | .align ALIGN | ||
55 | .globl sha1_block_x86 | ||
56 | TYPE(sha1_block_x86,@function) | ||
57 | sha1_block_x86: | ||
58 | pushl %esi | ||
59 | pushl %ebp | ||
60 | movl 20(%esp), %eax | ||
61 | movl 16(%esp), %esi | ||
62 | addl %esi, %eax | ||
63 | movl 12(%esp), %ebp | ||
64 | pushl %ebx | ||
65 | subl $64, %eax | ||
66 | pushl %edi | ||
67 | movl 4(%ebp), %ebx | ||
68 | subl $72, %esp | ||
69 | movl 12(%ebp), %edx | ||
70 | movl 16(%ebp), %edi | ||
71 | movl 8(%ebp), %ecx | ||
72 | movl %eax, 68(%esp) | ||
73 | /* First we need to setup the X array */ | ||
74 | movl (%esi), %eax | ||
75 | .L000start: | ||
76 | /* First, load the words onto the stack in network byte order */ | ||
77 | .byte 15 | ||
78 | .byte 200 /* bswapl %eax */ | ||
79 | movl %eax, (%esp) | ||
80 | movl 4(%esi), %eax | ||
81 | .byte 15 | ||
82 | .byte 200 /* bswapl %eax */ | ||
83 | movl %eax, 4(%esp) | ||
84 | movl 8(%esi), %eax | ||
85 | .byte 15 | ||
86 | .byte 200 /* bswapl %eax */ | ||
87 | movl %eax, 8(%esp) | ||
88 | movl 12(%esi), %eax | ||
89 | .byte 15 | ||
90 | .byte 200 /* bswapl %eax */ | ||
91 | movl %eax, 12(%esp) | ||
92 | movl 16(%esi), %eax | ||
93 | .byte 15 | ||
94 | .byte 200 /* bswapl %eax */ | ||
95 | movl %eax, 16(%esp) | ||
96 | movl 20(%esi), %eax | ||
97 | .byte 15 | ||
98 | .byte 200 /* bswapl %eax */ | ||
99 | movl %eax, 20(%esp) | ||
100 | movl 24(%esi), %eax | ||
101 | .byte 15 | ||
102 | .byte 200 /* bswapl %eax */ | ||
103 | movl %eax, 24(%esp) | ||
104 | movl 28(%esi), %eax | ||
105 | .byte 15 | ||
106 | .byte 200 /* bswapl %eax */ | ||
107 | movl %eax, 28(%esp) | ||
108 | movl 32(%esi), %eax | ||
109 | .byte 15 | ||
110 | .byte 200 /* bswapl %eax */ | ||
111 | movl %eax, 32(%esp) | ||
112 | movl 36(%esi), %eax | ||
113 | .byte 15 | ||
114 | .byte 200 /* bswapl %eax */ | ||
115 | movl %eax, 36(%esp) | ||
116 | movl 40(%esi), %eax | ||
117 | .byte 15 | ||
118 | .byte 200 /* bswapl %eax */ | ||
119 | movl %eax, 40(%esp) | ||
120 | movl 44(%esi), %eax | ||
121 | .byte 15 | ||
122 | .byte 200 /* bswapl %eax */ | ||
123 | movl %eax, 44(%esp) | ||
124 | movl 48(%esi), %eax | ||
125 | .byte 15 | ||
126 | .byte 200 /* bswapl %eax */ | ||
127 | movl %eax, 48(%esp) | ||
128 | movl 52(%esi), %eax | ||
129 | .byte 15 | ||
130 | .byte 200 /* bswapl %eax */ | ||
131 | movl %eax, 52(%esp) | ||
132 | movl 56(%esi), %eax | ||
133 | .byte 15 | ||
134 | .byte 200 /* bswapl %eax */ | ||
135 | movl %eax, 56(%esp) | ||
136 | movl 60(%esi), %eax | ||
137 | .byte 15 | ||
138 | .byte 200 /* bswapl %eax */ | ||
139 | movl %eax, 60(%esp) | ||
140 | /* We now have the X array on the stack */ | ||
141 | /* starting at sp-4 */ | ||
142 | movl %esi, 64(%esp) | ||
143 | |||
144 | /* Start processing */ | ||
145 | movl (%ebp), %eax | ||
146 | /* 00_15 0 */ | ||
147 | movl %ecx, %esi | ||
148 | movl %eax, %ebp | ||
149 | xorl %edx, %esi | ||
150 | roll $5, %ebp | ||
151 | andl %ebx, %esi | ||
152 | addl %edi, %ebp | ||
153 | .byte 209 | ||
154 | .byte 203 /* rorl $1 %ebx */ | ||
155 | movl (%esp), %edi | ||
156 | .byte 209 | ||
157 | .byte 203 /* rorl $1 %ebx */ | ||
158 | xorl %edx, %esi | ||
159 | leal 1518500249(%ebp,%edi,1),%ebp | ||
160 | movl %ebx, %edi | ||
161 | addl %ebp, %esi | ||
162 | xorl %ecx, %edi | ||
163 | movl %esi, %ebp | ||
164 | andl %eax, %edi | ||
165 | roll $5, %ebp | ||
166 | addl %edx, %ebp | ||
167 | movl 4(%esp), %edx | ||
168 | .byte 209 | ||
169 | .byte 200 /* rorl $1 %eax */ | ||
170 | xorl %ecx, %edi | ||
171 | .byte 209 | ||
172 | .byte 200 /* rorl $1 %eax */ | ||
173 | leal 1518500249(%ebp,%edx,1),%ebp | ||
174 | addl %ebp, %edi | ||
175 | /* 00_15 2 */ | ||
176 | movl %eax, %edx | ||
177 | movl %edi, %ebp | ||
178 | xorl %ebx, %edx | ||
179 | roll $5, %ebp | ||
180 | andl %esi, %edx | ||
181 | addl %ecx, %ebp | ||
182 | .byte 209 | ||
183 | .byte 206 /* rorl $1 %esi */ | ||
184 | movl 8(%esp), %ecx | ||
185 | .byte 209 | ||
186 | .byte 206 /* rorl $1 %esi */ | ||
187 | xorl %ebx, %edx | ||
188 | leal 1518500249(%ebp,%ecx,1),%ebp | ||
189 | movl %esi, %ecx | ||
190 | addl %ebp, %edx | ||
191 | xorl %eax, %ecx | ||
192 | movl %edx, %ebp | ||
193 | andl %edi, %ecx | ||
194 | roll $5, %ebp | ||
195 | addl %ebx, %ebp | ||
196 | movl 12(%esp), %ebx | ||
197 | .byte 209 | ||
198 | .byte 207 /* rorl $1 %edi */ | ||
199 | xorl %eax, %ecx | ||
200 | .byte 209 | ||
201 | .byte 207 /* rorl $1 %edi */ | ||
202 | leal 1518500249(%ebp,%ebx,1),%ebp | ||
203 | addl %ebp, %ecx | ||
204 | /* 00_15 4 */ | ||
205 | movl %edi, %ebx | ||
206 | movl %ecx, %ebp | ||
207 | xorl %esi, %ebx | ||
208 | roll $5, %ebp | ||
209 | andl %edx, %ebx | ||
210 | addl %eax, %ebp | ||
211 | .byte 209 | ||
212 | .byte 202 /* rorl $1 %edx */ | ||
213 | movl 16(%esp), %eax | ||
214 | .byte 209 | ||
215 | .byte 202 /* rorl $1 %edx */ | ||
216 | xorl %esi, %ebx | ||
217 | leal 1518500249(%ebp,%eax,1),%ebp | ||
218 | movl %edx, %eax | ||
219 | addl %ebp, %ebx | ||
220 | xorl %edi, %eax | ||
221 | movl %ebx, %ebp | ||
222 | andl %ecx, %eax | ||
223 | roll $5, %ebp | ||
224 | addl %esi, %ebp | ||
225 | movl 20(%esp), %esi | ||
226 | .byte 209 | ||
227 | .byte 201 /* rorl $1 %ecx */ | ||
228 | xorl %edi, %eax | ||
229 | .byte 209 | ||
230 | .byte 201 /* rorl $1 %ecx */ | ||
231 | leal 1518500249(%ebp,%esi,1),%ebp | ||
232 | addl %ebp, %eax | ||
233 | /* 00_15 6 */ | ||
234 | movl %ecx, %esi | ||
235 | movl %eax, %ebp | ||
236 | xorl %edx, %esi | ||
237 | roll $5, %ebp | ||
238 | andl %ebx, %esi | ||
239 | addl %edi, %ebp | ||
240 | .byte 209 | ||
241 | .byte 203 /* rorl $1 %ebx */ | ||
242 | movl 24(%esp), %edi | ||
243 | .byte 209 | ||
244 | .byte 203 /* rorl $1 %ebx */ | ||
245 | xorl %edx, %esi | ||
246 | leal 1518500249(%ebp,%edi,1),%ebp | ||
247 | movl %ebx, %edi | ||
248 | addl %ebp, %esi | ||
249 | xorl %ecx, %edi | ||
250 | movl %esi, %ebp | ||
251 | andl %eax, %edi | ||
252 | roll $5, %ebp | ||
253 | addl %edx, %ebp | ||
254 | movl 28(%esp), %edx | ||
255 | .byte 209 | ||
256 | .byte 200 /* rorl $1 %eax */ | ||
257 | xorl %ecx, %edi | ||
258 | .byte 209 | ||
259 | .byte 200 /* rorl $1 %eax */ | ||
260 | leal 1518500249(%ebp,%edx,1),%ebp | ||
261 | addl %ebp, %edi | ||
262 | /* 00_15 8 */ | ||
263 | movl %eax, %edx | ||
264 | movl %edi, %ebp | ||
265 | xorl %ebx, %edx | ||
266 | roll $5, %ebp | ||
267 | andl %esi, %edx | ||
268 | addl %ecx, %ebp | ||
269 | .byte 209 | ||
270 | .byte 206 /* rorl $1 %esi */ | ||
271 | movl 32(%esp), %ecx | ||
272 | .byte 209 | ||
273 | .byte 206 /* rorl $1 %esi */ | ||
274 | xorl %ebx, %edx | ||
275 | leal 1518500249(%ebp,%ecx,1),%ebp | ||
276 | movl %esi, %ecx | ||
277 | addl %ebp, %edx | ||
278 | xorl %eax, %ecx | ||
279 | movl %edx, %ebp | ||
280 | andl %edi, %ecx | ||
281 | roll $5, %ebp | ||
282 | addl %ebx, %ebp | ||
283 | movl 36(%esp), %ebx | ||
284 | .byte 209 | ||
285 | .byte 207 /* rorl $1 %edi */ | ||
286 | xorl %eax, %ecx | ||
287 | .byte 209 | ||
288 | .byte 207 /* rorl $1 %edi */ | ||
289 | leal 1518500249(%ebp,%ebx,1),%ebp | ||
290 | addl %ebp, %ecx | ||
291 | /* 00_15 10 */ | ||
292 | movl %edi, %ebx | ||
293 | movl %ecx, %ebp | ||
294 | xorl %esi, %ebx | ||
295 | roll $5, %ebp | ||
296 | andl %edx, %ebx | ||
297 | addl %eax, %ebp | ||
298 | .byte 209 | ||
299 | .byte 202 /* rorl $1 %edx */ | ||
300 | movl 40(%esp), %eax | ||
301 | .byte 209 | ||
302 | .byte 202 /* rorl $1 %edx */ | ||
303 | xorl %esi, %ebx | ||
304 | leal 1518500249(%ebp,%eax,1),%ebp | ||
305 | movl %edx, %eax | ||
306 | addl %ebp, %ebx | ||
307 | xorl %edi, %eax | ||
308 | movl %ebx, %ebp | ||
309 | andl %ecx, %eax | ||
310 | roll $5, %ebp | ||
311 | addl %esi, %ebp | ||
312 | movl 44(%esp), %esi | ||
313 | .byte 209 | ||
314 | .byte 201 /* rorl $1 %ecx */ | ||
315 | xorl %edi, %eax | ||
316 | .byte 209 | ||
317 | .byte 201 /* rorl $1 %ecx */ | ||
318 | leal 1518500249(%ebp,%esi,1),%ebp | ||
319 | addl %ebp, %eax | ||
320 | /* 00_15 12 */ | ||
321 | movl %ecx, %esi | ||
322 | movl %eax, %ebp | ||
323 | xorl %edx, %esi | ||
324 | roll $5, %ebp | ||
325 | andl %ebx, %esi | ||
326 | addl %edi, %ebp | ||
327 | .byte 209 | ||
328 | .byte 203 /* rorl $1 %ebx */ | ||
329 | movl 48(%esp), %edi | ||
330 | .byte 209 | ||
331 | .byte 203 /* rorl $1 %ebx */ | ||
332 | xorl %edx, %esi | ||
333 | leal 1518500249(%ebp,%edi,1),%ebp | ||
334 | movl %ebx, %edi | ||
335 | addl %ebp, %esi | ||
336 | xorl %ecx, %edi | ||
337 | movl %esi, %ebp | ||
338 | andl %eax, %edi | ||
339 | roll $5, %ebp | ||
340 | addl %edx, %ebp | ||
341 | movl 52(%esp), %edx | ||
342 | .byte 209 | ||
343 | .byte 200 /* rorl $1 %eax */ | ||
344 | xorl %ecx, %edi | ||
345 | .byte 209 | ||
346 | .byte 200 /* rorl $1 %eax */ | ||
347 | leal 1518500249(%ebp,%edx,1),%ebp | ||
348 | addl %ebp, %edi | ||
349 | /* 00_15 14 */ | ||
350 | movl %eax, %edx | ||
351 | movl %edi, %ebp | ||
352 | xorl %ebx, %edx | ||
353 | roll $5, %ebp | ||
354 | andl %esi, %edx | ||
355 | addl %ecx, %ebp | ||
356 | .byte 209 | ||
357 | .byte 206 /* rorl $1 %esi */ | ||
358 | movl 56(%esp), %ecx | ||
359 | .byte 209 | ||
360 | .byte 206 /* rorl $1 %esi */ | ||
361 | xorl %ebx, %edx | ||
362 | leal 1518500249(%ebp,%ecx,1),%ebp | ||
363 | movl %esi, %ecx | ||
364 | addl %ebp, %edx | ||
365 | xorl %eax, %ecx | ||
366 | movl %edx, %ebp | ||
367 | andl %edi, %ecx | ||
368 | roll $5, %ebp | ||
369 | addl %ebx, %ebp | ||
370 | movl 60(%esp), %ebx | ||
371 | .byte 209 | ||
372 | .byte 207 /* rorl $1 %edi */ | ||
373 | xorl %eax, %ecx | ||
374 | .byte 209 | ||
375 | .byte 207 /* rorl $1 %edi */ | ||
376 | leal 1518500249(%ebp,%ebx,1),%ebp | ||
377 | addl %ebp, %ecx | ||
378 | /* 16_19 16 */ | ||
379 | nop | ||
380 | movl (%esp), %ebp | ||
381 | movl 8(%esp), %ebx | ||
382 | xorl %ebp, %ebx | ||
383 | movl 32(%esp), %ebp | ||
384 | xorl %ebp, %ebx | ||
385 | movl 52(%esp), %ebp | ||
386 | xorl %ebp, %ebx | ||
387 | movl %edi, %ebp | ||
388 | .byte 209 | ||
389 | .byte 195 /* roll $1 %ebx */ | ||
390 | xorl %esi, %ebp | ||
391 | movl %ebx, (%esp) | ||
392 | andl %edx, %ebp | ||
393 | leal 1518500249(%ebx,%eax,1),%ebx | ||
394 | xorl %esi, %ebp | ||
395 | movl %ecx, %eax | ||
396 | addl %ebp, %ebx | ||
397 | roll $5, %eax | ||
398 | .byte 209 | ||
399 | .byte 202 /* rorl $1 %edx */ | ||
400 | addl %eax, %ebx | ||
401 | movl 4(%esp), %eax | ||
402 | movl 12(%esp), %ebp | ||
403 | xorl %ebp, %eax | ||
404 | movl 36(%esp), %ebp | ||
405 | xorl %ebp, %eax | ||
406 | movl 56(%esp), %ebp | ||
407 | .byte 209 | ||
408 | .byte 202 /* rorl $1 %edx */ | ||
409 | xorl %ebp, %eax | ||
410 | .byte 209 | ||
411 | .byte 192 /* roll $1 %eax */ | ||
412 | movl %edx, %ebp | ||
413 | xorl %edi, %ebp | ||
414 | movl %eax, 4(%esp) | ||
415 | andl %ecx, %ebp | ||
416 | leal 1518500249(%eax,%esi,1),%eax | ||
417 | xorl %edi, %ebp | ||
418 | movl %ebx, %esi | ||
419 | roll $5, %esi | ||
420 | .byte 209 | ||
421 | .byte 201 /* rorl $1 %ecx */ | ||
422 | addl %esi, %eax | ||
423 | .byte 209 | ||
424 | .byte 201 /* rorl $1 %ecx */ | ||
425 | addl %ebp, %eax | ||
426 | /* 16_19 18 */ | ||
427 | movl 8(%esp), %ebp | ||
428 | movl 16(%esp), %esi | ||
429 | xorl %ebp, %esi | ||
430 | movl 40(%esp), %ebp | ||
431 | xorl %ebp, %esi | ||
432 | movl 60(%esp), %ebp | ||
433 | xorl %ebp, %esi | ||
434 | movl %ecx, %ebp | ||
435 | .byte 209 | ||
436 | .byte 198 /* roll $1 %esi */ | ||
437 | xorl %edx, %ebp | ||
438 | movl %esi, 8(%esp) | ||
439 | andl %ebx, %ebp | ||
440 | leal 1518500249(%esi,%edi,1),%esi | ||
441 | xorl %edx, %ebp | ||
442 | movl %eax, %edi | ||
443 | addl %ebp, %esi | ||
444 | roll $5, %edi | ||
445 | .byte 209 | ||
446 | .byte 203 /* rorl $1 %ebx */ | ||
447 | addl %edi, %esi | ||
448 | movl 12(%esp), %edi | ||
449 | movl 20(%esp), %ebp | ||
450 | xorl %ebp, %edi | ||
451 | movl 44(%esp), %ebp | ||
452 | xorl %ebp, %edi | ||
453 | movl (%esp), %ebp | ||
454 | .byte 209 | ||
455 | .byte 203 /* rorl $1 %ebx */ | ||
456 | xorl %ebp, %edi | ||
457 | .byte 209 | ||
458 | .byte 199 /* roll $1 %edi */ | ||
459 | movl %ebx, %ebp | ||
460 | xorl %ecx, %ebp | ||
461 | movl %edi, 12(%esp) | ||
462 | andl %eax, %ebp | ||
463 | leal 1518500249(%edi,%edx,1),%edi | ||
464 | xorl %ecx, %ebp | ||
465 | movl %esi, %edx | ||
466 | roll $5, %edx | ||
467 | .byte 209 | ||
468 | .byte 200 /* rorl $1 %eax */ | ||
469 | addl %edx, %edi | ||
470 | .byte 209 | ||
471 | .byte 200 /* rorl $1 %eax */ | ||
472 | addl %ebp, %edi | ||
473 | /* 20_39 20 */ | ||
474 | movl 16(%esp), %edx | ||
475 | movl 24(%esp), %ebp | ||
476 | xorl %ebp, %edx | ||
477 | movl 48(%esp), %ebp | ||
478 | xorl %ebp, %edx | ||
479 | movl 4(%esp), %ebp | ||
480 | xorl %ebp, %edx | ||
481 | movl %esi, %ebp | ||
482 | .byte 209 | ||
483 | .byte 194 /* roll $1 %edx */ | ||
484 | xorl %eax, %ebp | ||
485 | movl %edx, 16(%esp) | ||
486 | xorl %ebx, %ebp | ||
487 | leal 1859775393(%edx,%ecx,1),%edx | ||
488 | movl %edi, %ecx | ||
489 | roll $5, %ecx | ||
490 | .byte 209 | ||
491 | .byte 206 /* rorl $1 %esi */ | ||
492 | addl %ebp, %ecx | ||
493 | .byte 209 | ||
494 | .byte 206 /* rorl $1 %esi */ | ||
495 | addl %ecx, %edx | ||
496 | /* 20_39 21 */ | ||
497 | movl 20(%esp), %ecx | ||
498 | movl 28(%esp), %ebp | ||
499 | xorl %ebp, %ecx | ||
500 | movl 52(%esp), %ebp | ||
501 | xorl %ebp, %ecx | ||
502 | movl 8(%esp), %ebp | ||
503 | xorl %ebp, %ecx | ||
504 | movl %edi, %ebp | ||
505 | .byte 209 | ||
506 | .byte 193 /* roll $1 %ecx */ | ||
507 | xorl %esi, %ebp | ||
508 | movl %ecx, 20(%esp) | ||
509 | xorl %eax, %ebp | ||
510 | leal 1859775393(%ecx,%ebx,1),%ecx | ||
511 | movl %edx, %ebx | ||
512 | roll $5, %ebx | ||
513 | .byte 209 | ||
514 | .byte 207 /* rorl $1 %edi */ | ||
515 | addl %ebp, %ebx | ||
516 | .byte 209 | ||
517 | .byte 207 /* rorl $1 %edi */ | ||
518 | addl %ebx, %ecx | ||
519 | /* 20_39 22 */ | ||
520 | movl 24(%esp), %ebx | ||
521 | movl 32(%esp), %ebp | ||
522 | xorl %ebp, %ebx | ||
523 | movl 56(%esp), %ebp | ||
524 | xorl %ebp, %ebx | ||
525 | movl 12(%esp), %ebp | ||
526 | xorl %ebp, %ebx | ||
527 | movl %edx, %ebp | ||
528 | .byte 209 | ||
529 | .byte 195 /* roll $1 %ebx */ | ||
530 | xorl %edi, %ebp | ||
531 | movl %ebx, 24(%esp) | ||
532 | xorl %esi, %ebp | ||
533 | leal 1859775393(%ebx,%eax,1),%ebx | ||
534 | movl %ecx, %eax | ||
535 | roll $5, %eax | ||
536 | .byte 209 | ||
537 | .byte 202 /* rorl $1 %edx */ | ||
538 | addl %ebp, %eax | ||
539 | .byte 209 | ||
540 | .byte 202 /* rorl $1 %edx */ | ||
541 | addl %eax, %ebx | ||
542 | /* 20_39 23 */ | ||
543 | movl 28(%esp), %eax | ||
544 | movl 36(%esp), %ebp | ||
545 | xorl %ebp, %eax | ||
546 | movl 60(%esp), %ebp | ||
547 | xorl %ebp, %eax | ||
548 | movl 16(%esp), %ebp | ||
549 | xorl %ebp, %eax | ||
550 | movl %ecx, %ebp | ||
551 | .byte 209 | ||
552 | .byte 192 /* roll $1 %eax */ | ||
553 | xorl %edx, %ebp | ||
554 | movl %eax, 28(%esp) | ||
555 | xorl %edi, %ebp | ||
556 | leal 1859775393(%eax,%esi,1),%eax | ||
557 | movl %ebx, %esi | ||
558 | roll $5, %esi | ||
559 | .byte 209 | ||
560 | .byte 201 /* rorl $1 %ecx */ | ||
561 | addl %ebp, %esi | ||
562 | .byte 209 | ||
563 | .byte 201 /* rorl $1 %ecx */ | ||
564 | addl %esi, %eax | ||
565 | /* 20_39 24 */ | ||
566 | movl 32(%esp), %esi | ||
567 | movl 40(%esp), %ebp | ||
568 | xorl %ebp, %esi | ||
569 | movl (%esp), %ebp | ||
570 | xorl %ebp, %esi | ||
571 | movl 20(%esp), %ebp | ||
572 | xorl %ebp, %esi | ||
573 | movl %ebx, %ebp | ||
574 | .byte 209 | ||
575 | .byte 198 /* roll $1 %esi */ | ||
576 | xorl %ecx, %ebp | ||
577 | movl %esi, 32(%esp) | ||
578 | xorl %edx, %ebp | ||
579 | leal 1859775393(%esi,%edi,1),%esi | ||
580 | movl %eax, %edi | ||
581 | roll $5, %edi | ||
582 | .byte 209 | ||
583 | .byte 203 /* rorl $1 %ebx */ | ||
584 | addl %ebp, %edi | ||
585 | .byte 209 | ||
586 | .byte 203 /* rorl $1 %ebx */ | ||
587 | addl %edi, %esi | ||
588 | /* 20_39 25 */ | ||
589 | movl 36(%esp), %edi | ||
590 | movl 44(%esp), %ebp | ||
591 | xorl %ebp, %edi | ||
592 | movl 4(%esp), %ebp | ||
593 | xorl %ebp, %edi | ||
594 | movl 24(%esp), %ebp | ||
595 | xorl %ebp, %edi | ||
596 | movl %eax, %ebp | ||
597 | .byte 209 | ||
598 | .byte 199 /* roll $1 %edi */ | ||
599 | xorl %ebx, %ebp | ||
600 | movl %edi, 36(%esp) | ||
601 | xorl %ecx, %ebp | ||
602 | leal 1859775393(%edi,%edx,1),%edi | ||
603 | movl %esi, %edx | ||
604 | roll $5, %edx | ||
605 | .byte 209 | ||
606 | .byte 200 /* rorl $1 %eax */ | ||
607 | addl %ebp, %edx | ||
608 | .byte 209 | ||
609 | .byte 200 /* rorl $1 %eax */ | ||
610 | addl %edx, %edi | ||
611 | /* 20_39 26 */ | ||
612 | movl 40(%esp), %edx | ||
613 | movl 48(%esp), %ebp | ||
614 | xorl %ebp, %edx | ||
615 | movl 8(%esp), %ebp | ||
616 | xorl %ebp, %edx | ||
617 | movl 28(%esp), %ebp | ||
618 | xorl %ebp, %edx | ||
619 | movl %esi, %ebp | ||
620 | .byte 209 | ||
621 | .byte 194 /* roll $1 %edx */ | ||
622 | xorl %eax, %ebp | ||
623 | movl %edx, 40(%esp) | ||
624 | xorl %ebx, %ebp | ||
625 | leal 1859775393(%edx,%ecx,1),%edx | ||
626 | movl %edi, %ecx | ||
627 | roll $5, %ecx | ||
628 | .byte 209 | ||
629 | .byte 206 /* rorl $1 %esi */ | ||
630 | addl %ebp, %ecx | ||
631 | .byte 209 | ||
632 | .byte 206 /* rorl $1 %esi */ | ||
633 | addl %ecx, %edx | ||
634 | /* 20_39 27 */ | ||
635 | movl 44(%esp), %ecx | ||
636 | movl 52(%esp), %ebp | ||
637 | xorl %ebp, %ecx | ||
638 | movl 12(%esp), %ebp | ||
639 | xorl %ebp, %ecx | ||
640 | movl 32(%esp), %ebp | ||
641 | xorl %ebp, %ecx | ||
642 | movl %edi, %ebp | ||
643 | .byte 209 | ||
644 | .byte 193 /* roll $1 %ecx */ | ||
645 | xorl %esi, %ebp | ||
646 | movl %ecx, 44(%esp) | ||
647 | xorl %eax, %ebp | ||
648 | leal 1859775393(%ecx,%ebx,1),%ecx | ||
649 | movl %edx, %ebx | ||
650 | roll $5, %ebx | ||
651 | .byte 209 | ||
652 | .byte 207 /* rorl $1 %edi */ | ||
653 | addl %ebp, %ebx | ||
654 | .byte 209 | ||
655 | .byte 207 /* rorl $1 %edi */ | ||
656 | addl %ebx, %ecx | ||
657 | /* 20_39 28 */ | ||
658 | movl 48(%esp), %ebx | ||
659 | movl 56(%esp), %ebp | ||
660 | xorl %ebp, %ebx | ||
661 | movl 16(%esp), %ebp | ||
662 | xorl %ebp, %ebx | ||
663 | movl 36(%esp), %ebp | ||
664 | xorl %ebp, %ebx | ||
665 | movl %edx, %ebp | ||
666 | .byte 209 | ||
667 | .byte 195 /* roll $1 %ebx */ | ||
668 | xorl %edi, %ebp | ||
669 | movl %ebx, 48(%esp) | ||
670 | xorl %esi, %ebp | ||
671 | leal 1859775393(%ebx,%eax,1),%ebx | ||
672 | movl %ecx, %eax | ||
673 | roll $5, %eax | ||
674 | .byte 209 | ||
675 | .byte 202 /* rorl $1 %edx */ | ||
676 | addl %ebp, %eax | ||
677 | .byte 209 | ||
678 | .byte 202 /* rorl $1 %edx */ | ||
679 | addl %eax, %ebx | ||
680 | /* 20_39 29 */ | ||
681 | movl 52(%esp), %eax | ||
682 | movl 60(%esp), %ebp | ||
683 | xorl %ebp, %eax | ||
684 | movl 20(%esp), %ebp | ||
685 | xorl %ebp, %eax | ||
686 | movl 40(%esp), %ebp | ||
687 | xorl %ebp, %eax | ||
688 | movl %ecx, %ebp | ||
689 | .byte 209 | ||
690 | .byte 192 /* roll $1 %eax */ | ||
691 | xorl %edx, %ebp | ||
692 | movl %eax, 52(%esp) | ||
693 | xorl %edi, %ebp | ||
694 | leal 1859775393(%eax,%esi,1),%eax | ||
695 | movl %ebx, %esi | ||
696 | roll $5, %esi | ||
697 | .byte 209 | ||
698 | .byte 201 /* rorl $1 %ecx */ | ||
699 | addl %ebp, %esi | ||
700 | .byte 209 | ||
701 | .byte 201 /* rorl $1 %ecx */ | ||
702 | addl %esi, %eax | ||
703 | /* 20_39 30 */ | ||
704 | movl 56(%esp), %esi | ||
705 | movl (%esp), %ebp | ||
706 | xorl %ebp, %esi | ||
707 | movl 24(%esp), %ebp | ||
708 | xorl %ebp, %esi | ||
709 | movl 44(%esp), %ebp | ||
710 | xorl %ebp, %esi | ||
711 | movl %ebx, %ebp | ||
712 | .byte 209 | ||
713 | .byte 198 /* roll $1 %esi */ | ||
714 | xorl %ecx, %ebp | ||
715 | movl %esi, 56(%esp) | ||
716 | xorl %edx, %ebp | ||
717 | leal 1859775393(%esi,%edi,1),%esi | ||
718 | movl %eax, %edi | ||
719 | roll $5, %edi | ||
720 | .byte 209 | ||
721 | .byte 203 /* rorl $1 %ebx */ | ||
722 | addl %ebp, %edi | ||
723 | .byte 209 | ||
724 | .byte 203 /* rorl $1 %ebx */ | ||
725 | addl %edi, %esi | ||
726 | /* 20_39 31 */ | ||
727 | movl 60(%esp), %edi | ||
728 | movl 4(%esp), %ebp | ||
729 | xorl %ebp, %edi | ||
730 | movl 28(%esp), %ebp | ||
731 | xorl %ebp, %edi | ||
732 | movl 48(%esp), %ebp | ||
733 | xorl %ebp, %edi | ||
734 | movl %eax, %ebp | ||
735 | .byte 209 | ||
736 | .byte 199 /* roll $1 %edi */ | ||
737 | xorl %ebx, %ebp | ||
738 | movl %edi, 60(%esp) | ||
739 | xorl %ecx, %ebp | ||
740 | leal 1859775393(%edi,%edx,1),%edi | ||
741 | movl %esi, %edx | ||
742 | roll $5, %edx | ||
743 | .byte 209 | ||
744 | .byte 200 /* rorl $1 %eax */ | ||
745 | addl %ebp, %edx | ||
746 | .byte 209 | ||
747 | .byte 200 /* rorl $1 %eax */ | ||
748 | addl %edx, %edi | ||
749 | /* 20_39 32 */ | ||
750 | movl (%esp), %edx | ||
751 | movl 8(%esp), %ebp | ||
752 | xorl %ebp, %edx | ||
753 | movl 32(%esp), %ebp | ||
754 | xorl %ebp, %edx | ||
755 | movl 52(%esp), %ebp | ||
756 | xorl %ebp, %edx | ||
757 | movl %esi, %ebp | ||
758 | .byte 209 | ||
759 | .byte 194 /* roll $1 %edx */ | ||
760 | xorl %eax, %ebp | ||
761 | movl %edx, (%esp) | ||
762 | xorl %ebx, %ebp | ||
763 | leal 1859775393(%edx,%ecx,1),%edx | ||
764 | movl %edi, %ecx | ||
765 | roll $5, %ecx | ||
766 | .byte 209 | ||
767 | .byte 206 /* rorl $1 %esi */ | ||
768 | addl %ebp, %ecx | ||
769 | .byte 209 | ||
770 | .byte 206 /* rorl $1 %esi */ | ||
771 | addl %ecx, %edx | ||
772 | /* 20_39 33 */ | ||
773 | movl 4(%esp), %ecx | ||
774 | movl 12(%esp), %ebp | ||
775 | xorl %ebp, %ecx | ||
776 | movl 36(%esp), %ebp | ||
777 | xorl %ebp, %ecx | ||
778 | movl 56(%esp), %ebp | ||
779 | xorl %ebp, %ecx | ||
780 | movl %edi, %ebp | ||
781 | .byte 209 | ||
782 | .byte 193 /* roll $1 %ecx */ | ||
783 | xorl %esi, %ebp | ||
784 | movl %ecx, 4(%esp) | ||
785 | xorl %eax, %ebp | ||
786 | leal 1859775393(%ecx,%ebx,1),%ecx | ||
787 | movl %edx, %ebx | ||
788 | roll $5, %ebx | ||
789 | .byte 209 | ||
790 | .byte 207 /* rorl $1 %edi */ | ||
791 | addl %ebp, %ebx | ||
792 | .byte 209 | ||
793 | .byte 207 /* rorl $1 %edi */ | ||
794 | addl %ebx, %ecx | ||
795 | /* 20_39 34 */ | ||
796 | movl 8(%esp), %ebx | ||
797 | movl 16(%esp), %ebp | ||
798 | xorl %ebp, %ebx | ||
799 | movl 40(%esp), %ebp | ||
800 | xorl %ebp, %ebx | ||
801 | movl 60(%esp), %ebp | ||
802 | xorl %ebp, %ebx | ||
803 | movl %edx, %ebp | ||
804 | .byte 209 | ||
805 | .byte 195 /* roll $1 %ebx */ | ||
806 | xorl %edi, %ebp | ||
807 | movl %ebx, 8(%esp) | ||
808 | xorl %esi, %ebp | ||
809 | leal 1859775393(%ebx,%eax,1),%ebx | ||
810 | movl %ecx, %eax | ||
811 | roll $5, %eax | ||
812 | .byte 209 | ||
813 | .byte 202 /* rorl $1 %edx */ | ||
814 | addl %ebp, %eax | ||
815 | .byte 209 | ||
816 | .byte 202 /* rorl $1 %edx */ | ||
817 | addl %eax, %ebx | ||
818 | /* 20_39 35 */ | ||
819 | movl 12(%esp), %eax | ||
820 | movl 20(%esp), %ebp | ||
821 | xorl %ebp, %eax | ||
822 | movl 44(%esp), %ebp | ||
823 | xorl %ebp, %eax | ||
824 | movl (%esp), %ebp | ||
825 | xorl %ebp, %eax | ||
826 | movl %ecx, %ebp | ||
827 | .byte 209 | ||
828 | .byte 192 /* roll $1 %eax */ | ||
829 | xorl %edx, %ebp | ||
830 | movl %eax, 12(%esp) | ||
831 | xorl %edi, %ebp | ||
832 | leal 1859775393(%eax,%esi,1),%eax | ||
833 | movl %ebx, %esi | ||
834 | roll $5, %esi | ||
835 | .byte 209 | ||
836 | .byte 201 /* rorl $1 %ecx */ | ||
837 | addl %ebp, %esi | ||
838 | .byte 209 | ||
839 | .byte 201 /* rorl $1 %ecx */ | ||
840 | addl %esi, %eax | ||
841 | /* 20_39 36 */ | ||
842 | movl 16(%esp), %esi | ||
843 | movl 24(%esp), %ebp | ||
844 | xorl %ebp, %esi | ||
845 | movl 48(%esp), %ebp | ||
846 | xorl %ebp, %esi | ||
847 | movl 4(%esp), %ebp | ||
848 | xorl %ebp, %esi | ||
849 | movl %ebx, %ebp | ||
850 | .byte 209 | ||
851 | .byte 198 /* roll $1 %esi */ | ||
852 | xorl %ecx, %ebp | ||
853 | movl %esi, 16(%esp) | ||
854 | xorl %edx, %ebp | ||
855 | leal 1859775393(%esi,%edi,1),%esi | ||
856 | movl %eax, %edi | ||
857 | roll $5, %edi | ||
858 | .byte 209 | ||
859 | .byte 203 /* rorl $1 %ebx */ | ||
860 | addl %ebp, %edi | ||
861 | .byte 209 | ||
862 | .byte 203 /* rorl $1 %ebx */ | ||
863 | addl %edi, %esi | ||
864 | /* 20_39 37 */ | ||
865 | movl 20(%esp), %edi | ||
866 | movl 28(%esp), %ebp | ||
867 | xorl %ebp, %edi | ||
868 | movl 52(%esp), %ebp | ||
869 | xorl %ebp, %edi | ||
870 | movl 8(%esp), %ebp | ||
871 | xorl %ebp, %edi | ||
872 | movl %eax, %ebp | ||
873 | .byte 209 | ||
874 | .byte 199 /* roll $1 %edi */ | ||
875 | xorl %ebx, %ebp | ||
876 | movl %edi, 20(%esp) | ||
877 | xorl %ecx, %ebp | ||
878 | leal 1859775393(%edi,%edx,1),%edi | ||
879 | movl %esi, %edx | ||
880 | roll $5, %edx | ||
881 | .byte 209 | ||
882 | .byte 200 /* rorl $1 %eax */ | ||
883 | addl %ebp, %edx | ||
884 | .byte 209 | ||
885 | .byte 200 /* rorl $1 %eax */ | ||
886 | addl %edx, %edi | ||
887 | /* 20_39 38 */ | ||
888 | movl 24(%esp), %edx | ||
889 | movl 32(%esp), %ebp | ||
890 | xorl %ebp, %edx | ||
891 | movl 56(%esp), %ebp | ||
892 | xorl %ebp, %edx | ||
893 | movl 12(%esp), %ebp | ||
894 | xorl %ebp, %edx | ||
895 | movl %esi, %ebp | ||
896 | .byte 209 | ||
897 | .byte 194 /* roll $1 %edx */ | ||
898 | xorl %eax, %ebp | ||
899 | movl %edx, 24(%esp) | ||
900 | xorl %ebx, %ebp | ||
901 | leal 1859775393(%edx,%ecx,1),%edx | ||
902 | movl %edi, %ecx | ||
903 | roll $5, %ecx | ||
904 | .byte 209 | ||
905 | .byte 206 /* rorl $1 %esi */ | ||
906 | addl %ebp, %ecx | ||
907 | .byte 209 | ||
908 | .byte 206 /* rorl $1 %esi */ | ||
909 | addl %ecx, %edx | ||
910 | /* 20_39 39 */ | ||
911 | movl 28(%esp), %ecx | ||
912 | movl 36(%esp), %ebp | ||
913 | xorl %ebp, %ecx | ||
914 | movl 60(%esp), %ebp | ||
915 | xorl %ebp, %ecx | ||
916 | movl 16(%esp), %ebp | ||
917 | xorl %ebp, %ecx | ||
918 | movl %edi, %ebp | ||
919 | .byte 209 | ||
920 | .byte 193 /* roll $1 %ecx */ | ||
921 | xorl %esi, %ebp | ||
922 | movl %ecx, 28(%esp) | ||
923 | xorl %eax, %ebp | ||
924 | leal 1859775393(%ecx,%ebx,1),%ecx | ||
925 | movl %edx, %ebx | ||
926 | roll $5, %ebx | ||
927 | .byte 209 | ||
928 | .byte 207 /* rorl $1 %edi */ | ||
929 | addl %ebp, %ebx | ||
930 | .byte 209 | ||
931 | .byte 207 /* rorl $1 %edi */ | ||
932 | addl %ebx, %ecx | ||
933 | /* 40_59 40 */ | ||
934 | movl 32(%esp), %ebx | ||
935 | movl 40(%esp), %ebp | ||
936 | xorl %ebp, %ebx | ||
937 | movl (%esp), %ebp | ||
938 | xorl %ebp, %ebx | ||
939 | movl 20(%esp), %ebp | ||
940 | xorl %ebp, %ebx | ||
941 | movl %edx, %ebp | ||
942 | .byte 209 | ||
943 | .byte 195 /* roll $1 %ebx */ | ||
944 | orl %edi, %ebp | ||
945 | movl %ebx, 32(%esp) | ||
946 | andl %esi, %ebp | ||
947 | leal 2400959708(%ebx,%eax,1),%ebx | ||
948 | movl %edx, %eax | ||
949 | .byte 209 | ||
950 | .byte 202 /* rorl $1 %edx */ | ||
951 | andl %edi, %eax | ||
952 | orl %eax, %ebp | ||
953 | movl %ecx, %eax | ||
954 | roll $5, %eax | ||
955 | addl %eax, %ebp | ||
956 | movl 36(%esp), %eax | ||
957 | addl %ebp, %ebx | ||
958 | movl 44(%esp), %ebp | ||
959 | xorl %ebp, %eax | ||
960 | movl 4(%esp), %ebp | ||
961 | xorl %ebp, %eax | ||
962 | movl 24(%esp), %ebp | ||
963 | .byte 209 | ||
964 | .byte 202 /* rorl $1 %edx */ | ||
965 | xorl %ebp, %eax | ||
966 | .byte 209 | ||
967 | .byte 192 /* roll $1 %eax */ | ||
968 | movl %ecx, %ebp | ||
969 | movl %eax, 36(%esp) | ||
970 | orl %edx, %ebp | ||
971 | leal 2400959708(%eax,%esi,1),%eax | ||
972 | movl %ecx, %esi | ||
973 | andl %edi, %ebp | ||
974 | andl %edx, %esi | ||
975 | orl %esi, %ebp | ||
976 | movl %ebx, %esi | ||
977 | roll $5, %esi | ||
978 | .byte 209 | ||
979 | .byte 201 /* rorl $1 %ecx */ | ||
980 | addl %esi, %ebp | ||
981 | .byte 209 | ||
982 | .byte 201 /* rorl $1 %ecx */ | ||
983 | addl %ebp, %eax | ||
984 | /* 40_59 41 */ | ||
985 | /* 40_59 42 */ | ||
986 | movl 40(%esp), %esi | ||
987 | movl 48(%esp), %ebp | ||
988 | xorl %ebp, %esi | ||
989 | movl 8(%esp), %ebp | ||
990 | xorl %ebp, %esi | ||
991 | movl 28(%esp), %ebp | ||
992 | xorl %ebp, %esi | ||
993 | movl %ebx, %ebp | ||
994 | .byte 209 | ||
995 | .byte 198 /* roll $1 %esi */ | ||
996 | orl %ecx, %ebp | ||
997 | movl %esi, 40(%esp) | ||
998 | andl %edx, %ebp | ||
999 | leal 2400959708(%esi,%edi,1),%esi | ||
1000 | movl %ebx, %edi | ||
1001 | .byte 209 | ||
1002 | .byte 203 /* rorl $1 %ebx */ | ||
1003 | andl %ecx, %edi | ||
1004 | orl %edi, %ebp | ||
1005 | movl %eax, %edi | ||
1006 | roll $5, %edi | ||
1007 | addl %edi, %ebp | ||
1008 | movl 44(%esp), %edi | ||
1009 | addl %ebp, %esi | ||
1010 | movl 52(%esp), %ebp | ||
1011 | xorl %ebp, %edi | ||
1012 | movl 12(%esp), %ebp | ||
1013 | xorl %ebp, %edi | ||
1014 | movl 32(%esp), %ebp | ||
1015 | .byte 209 | ||
1016 | .byte 203 /* rorl $1 %ebx */ | ||
1017 | xorl %ebp, %edi | ||
1018 | .byte 209 | ||
1019 | .byte 199 /* roll $1 %edi */ | ||
1020 | movl %eax, %ebp | ||
1021 | movl %edi, 44(%esp) | ||
1022 | orl %ebx, %ebp | ||
1023 | leal 2400959708(%edi,%edx,1),%edi | ||
1024 | movl %eax, %edx | ||
1025 | andl %ecx, %ebp | ||
1026 | andl %ebx, %edx | ||
1027 | orl %edx, %ebp | ||
1028 | movl %esi, %edx | ||
1029 | roll $5, %edx | ||
1030 | .byte 209 | ||
1031 | .byte 200 /* rorl $1 %eax */ | ||
1032 | addl %edx, %ebp | ||
1033 | .byte 209 | ||
1034 | .byte 200 /* rorl $1 %eax */ | ||
1035 | addl %ebp, %edi | ||
1036 | /* 40_59 43 */ | ||
1037 | /* 40_59 44 */ | ||
1038 | movl 48(%esp), %edx | ||
1039 | movl 56(%esp), %ebp | ||
1040 | xorl %ebp, %edx | ||
1041 | movl 16(%esp), %ebp | ||
1042 | xorl %ebp, %edx | ||
1043 | movl 36(%esp), %ebp | ||
1044 | xorl %ebp, %edx | ||
1045 | movl %esi, %ebp | ||
1046 | .byte 209 | ||
1047 | .byte 194 /* roll $1 %edx */ | ||
1048 | orl %eax, %ebp | ||
1049 | movl %edx, 48(%esp) | ||
1050 | andl %ebx, %ebp | ||
1051 | leal 2400959708(%edx,%ecx,1),%edx | ||
1052 | movl %esi, %ecx | ||
1053 | .byte 209 | ||
1054 | .byte 206 /* rorl $1 %esi */ | ||
1055 | andl %eax, %ecx | ||
1056 | orl %ecx, %ebp | ||
1057 | movl %edi, %ecx | ||
1058 | roll $5, %ecx | ||
1059 | addl %ecx, %ebp | ||
1060 | movl 52(%esp), %ecx | ||
1061 | addl %ebp, %edx | ||
1062 | movl 60(%esp), %ebp | ||
1063 | xorl %ebp, %ecx | ||
1064 | movl 20(%esp), %ebp | ||
1065 | xorl %ebp, %ecx | ||
1066 | movl 40(%esp), %ebp | ||
1067 | .byte 209 | ||
1068 | .byte 206 /* rorl $1 %esi */ | ||
1069 | xorl %ebp, %ecx | ||
1070 | .byte 209 | ||
1071 | .byte 193 /* roll $1 %ecx */ | ||
1072 | movl %edi, %ebp | ||
1073 | movl %ecx, 52(%esp) | ||
1074 | orl %esi, %ebp | ||
1075 | leal 2400959708(%ecx,%ebx,1),%ecx | ||
1076 | movl %edi, %ebx | ||
1077 | andl %eax, %ebp | ||
1078 | andl %esi, %ebx | ||
1079 | orl %ebx, %ebp | ||
1080 | movl %edx, %ebx | ||
1081 | roll $5, %ebx | ||
1082 | .byte 209 | ||
1083 | .byte 207 /* rorl $1 %edi */ | ||
1084 | addl %ebx, %ebp | ||
1085 | .byte 209 | ||
1086 | .byte 207 /* rorl $1 %edi */ | ||
1087 | addl %ebp, %ecx | ||
1088 | /* 40_59 45 */ | ||
1089 | /* 40_59 46 */ | ||
1090 | movl 56(%esp), %ebx | ||
1091 | movl (%esp), %ebp | ||
1092 | xorl %ebp, %ebx | ||
1093 | movl 24(%esp), %ebp | ||
1094 | xorl %ebp, %ebx | ||
1095 | movl 44(%esp), %ebp | ||
1096 | xorl %ebp, %ebx | ||
1097 | movl %edx, %ebp | ||
1098 | .byte 209 | ||
1099 | .byte 195 /* roll $1 %ebx */ | ||
1100 | orl %edi, %ebp | ||
1101 | movl %ebx, 56(%esp) | ||
1102 | andl %esi, %ebp | ||
1103 | leal 2400959708(%ebx,%eax,1),%ebx | ||
1104 | movl %edx, %eax | ||
1105 | .byte 209 | ||
1106 | .byte 202 /* rorl $1 %edx */ | ||
1107 | andl %edi, %eax | ||
1108 | orl %eax, %ebp | ||
1109 | movl %ecx, %eax | ||
1110 | roll $5, %eax | ||
1111 | addl %eax, %ebp | ||
1112 | movl 60(%esp), %eax | ||
1113 | addl %ebp, %ebx | ||
1114 | movl 4(%esp), %ebp | ||
1115 | xorl %ebp, %eax | ||
1116 | movl 28(%esp), %ebp | ||
1117 | xorl %ebp, %eax | ||
1118 | movl 48(%esp), %ebp | ||
1119 | .byte 209 | ||
1120 | .byte 202 /* rorl $1 %edx */ | ||
1121 | xorl %ebp, %eax | ||
1122 | .byte 209 | ||
1123 | .byte 192 /* roll $1 %eax */ | ||
1124 | movl %ecx, %ebp | ||
1125 | movl %eax, 60(%esp) | ||
1126 | orl %edx, %ebp | ||
1127 | leal 2400959708(%eax,%esi,1),%eax | ||
1128 | movl %ecx, %esi | ||
1129 | andl %edi, %ebp | ||
1130 | andl %edx, %esi | ||
1131 | orl %esi, %ebp | ||
1132 | movl %ebx, %esi | ||
1133 | roll $5, %esi | ||
1134 | .byte 209 | ||
1135 | .byte 201 /* rorl $1 %ecx */ | ||
1136 | addl %esi, %ebp | ||
1137 | .byte 209 | ||
1138 | .byte 201 /* rorl $1 %ecx */ | ||
1139 | addl %ebp, %eax | ||
1140 | /* 40_59 47 */ | ||
1141 | /* 40_59 48 */ | ||
1142 | movl (%esp), %esi | ||
1143 | movl 8(%esp), %ebp | ||
1144 | xorl %ebp, %esi | ||
1145 | movl 32(%esp), %ebp | ||
1146 | xorl %ebp, %esi | ||
1147 | movl 52(%esp), %ebp | ||
1148 | xorl %ebp, %esi | ||
1149 | movl %ebx, %ebp | ||
1150 | .byte 209 | ||
1151 | .byte 198 /* roll $1 %esi */ | ||
1152 | orl %ecx, %ebp | ||
1153 | movl %esi, (%esp) | ||
1154 | andl %edx, %ebp | ||
1155 | leal 2400959708(%esi,%edi,1),%esi | ||
1156 | movl %ebx, %edi | ||
1157 | .byte 209 | ||
1158 | .byte 203 /* rorl $1 %ebx */ | ||
1159 | andl %ecx, %edi | ||
1160 | orl %edi, %ebp | ||
1161 | movl %eax, %edi | ||
1162 | roll $5, %edi | ||
1163 | addl %edi, %ebp | ||
1164 | movl 4(%esp), %edi | ||
1165 | addl %ebp, %esi | ||
1166 | movl 12(%esp), %ebp | ||
1167 | xorl %ebp, %edi | ||
1168 | movl 36(%esp), %ebp | ||
1169 | xorl %ebp, %edi | ||
1170 | movl 56(%esp), %ebp | ||
1171 | .byte 209 | ||
1172 | .byte 203 /* rorl $1 %ebx */ | ||
1173 | xorl %ebp, %edi | ||
1174 | .byte 209 | ||
1175 | .byte 199 /* roll $1 %edi */ | ||
1176 | movl %eax, %ebp | ||
1177 | movl %edi, 4(%esp) | ||
1178 | orl %ebx, %ebp | ||
1179 | leal 2400959708(%edi,%edx,1),%edi | ||
1180 | movl %eax, %edx | ||
1181 | andl %ecx, %ebp | ||
1182 | andl %ebx, %edx | ||
1183 | orl %edx, %ebp | ||
1184 | movl %esi, %edx | ||
1185 | roll $5, %edx | ||
1186 | .byte 209 | ||
1187 | .byte 200 /* rorl $1 %eax */ | ||
1188 | addl %edx, %ebp | ||
1189 | .byte 209 | ||
1190 | .byte 200 /* rorl $1 %eax */ | ||
1191 | addl %ebp, %edi | ||
1192 | /* 40_59 49 */ | ||
1193 | /* 40_59 50 */ | ||
1194 | movl 8(%esp), %edx | ||
1195 | movl 16(%esp), %ebp | ||
1196 | xorl %ebp, %edx | ||
1197 | movl 40(%esp), %ebp | ||
1198 | xorl %ebp, %edx | ||
1199 | movl 60(%esp), %ebp | ||
1200 | xorl %ebp, %edx | ||
1201 | movl %esi, %ebp | ||
1202 | .byte 209 | ||
1203 | .byte 194 /* roll $1 %edx */ | ||
1204 | orl %eax, %ebp | ||
1205 | movl %edx, 8(%esp) | ||
1206 | andl %ebx, %ebp | ||
1207 | leal 2400959708(%edx,%ecx,1),%edx | ||
1208 | movl %esi, %ecx | ||
1209 | .byte 209 | ||
1210 | .byte 206 /* rorl $1 %esi */ | ||
1211 | andl %eax, %ecx | ||
1212 | orl %ecx, %ebp | ||
1213 | movl %edi, %ecx | ||
1214 | roll $5, %ecx | ||
1215 | addl %ecx, %ebp | ||
1216 | movl 12(%esp), %ecx | ||
1217 | addl %ebp, %edx | ||
1218 | movl 20(%esp), %ebp | ||
1219 | xorl %ebp, %ecx | ||
1220 | movl 44(%esp), %ebp | ||
1221 | xorl %ebp, %ecx | ||
1222 | movl (%esp), %ebp | ||
1223 | .byte 209 | ||
1224 | .byte 206 /* rorl $1 %esi */ | ||
1225 | xorl %ebp, %ecx | ||
1226 | .byte 209 | ||
1227 | .byte 193 /* roll $1 %ecx */ | ||
1228 | movl %edi, %ebp | ||
1229 | movl %ecx, 12(%esp) | ||
1230 | orl %esi, %ebp | ||
1231 | leal 2400959708(%ecx,%ebx,1),%ecx | ||
1232 | movl %edi, %ebx | ||
1233 | andl %eax, %ebp | ||
1234 | andl %esi, %ebx | ||
1235 | orl %ebx, %ebp | ||
1236 | movl %edx, %ebx | ||
1237 | roll $5, %ebx | ||
1238 | .byte 209 | ||
1239 | .byte 207 /* rorl $1 %edi */ | ||
1240 | addl %ebx, %ebp | ||
1241 | .byte 209 | ||
1242 | .byte 207 /* rorl $1 %edi */ | ||
1243 | addl %ebp, %ecx | ||
1244 | /* 40_59 51 */ | ||
1245 | /* 40_59 52 */ | ||
1246 | movl 16(%esp), %ebx | ||
1247 | movl 24(%esp), %ebp | ||
1248 | xorl %ebp, %ebx | ||
1249 | movl 48(%esp), %ebp | ||
1250 | xorl %ebp, %ebx | ||
1251 | movl 4(%esp), %ebp | ||
1252 | xorl %ebp, %ebx | ||
1253 | movl %edx, %ebp | ||
1254 | .byte 209 | ||
1255 | .byte 195 /* roll $1 %ebx */ | ||
1256 | orl %edi, %ebp | ||
1257 | movl %ebx, 16(%esp) | ||
1258 | andl %esi, %ebp | ||
1259 | leal 2400959708(%ebx,%eax,1),%ebx | ||
1260 | movl %edx, %eax | ||
1261 | .byte 209 | ||
1262 | .byte 202 /* rorl $1 %edx */ | ||
1263 | andl %edi, %eax | ||
1264 | orl %eax, %ebp | ||
1265 | movl %ecx, %eax | ||
1266 | roll $5, %eax | ||
1267 | addl %eax, %ebp | ||
1268 | movl 20(%esp), %eax | ||
1269 | addl %ebp, %ebx | ||
1270 | movl 28(%esp), %ebp | ||
1271 | xorl %ebp, %eax | ||
1272 | movl 52(%esp), %ebp | ||
1273 | xorl %ebp, %eax | ||
1274 | movl 8(%esp), %ebp | ||
1275 | .byte 209 | ||
1276 | .byte 202 /* rorl $1 %edx */ | ||
1277 | xorl %ebp, %eax | ||
1278 | .byte 209 | ||
1279 | .byte 192 /* roll $1 %eax */ | ||
1280 | movl %ecx, %ebp | ||
1281 | movl %eax, 20(%esp) | ||
1282 | orl %edx, %ebp | ||
1283 | leal 2400959708(%eax,%esi,1),%eax | ||
1284 | movl %ecx, %esi | ||
1285 | andl %edi, %ebp | ||
1286 | andl %edx, %esi | ||
1287 | orl %esi, %ebp | ||
1288 | movl %ebx, %esi | ||
1289 | roll $5, %esi | ||
1290 | .byte 209 | ||
1291 | .byte 201 /* rorl $1 %ecx */ | ||
1292 | addl %esi, %ebp | ||
1293 | .byte 209 | ||
1294 | .byte 201 /* rorl $1 %ecx */ | ||
1295 | addl %ebp, %eax | ||
1296 | /* 40_59 53 */ | ||
1297 | /* 40_59 54 */ | ||
1298 | movl 24(%esp), %esi | ||
1299 | movl 32(%esp), %ebp | ||
1300 | xorl %ebp, %esi | ||
1301 | movl 56(%esp), %ebp | ||
1302 | xorl %ebp, %esi | ||
1303 | movl 12(%esp), %ebp | ||
1304 | xorl %ebp, %esi | ||
1305 | movl %ebx, %ebp | ||
1306 | .byte 209 | ||
1307 | .byte 198 /* roll $1 %esi */ | ||
1308 | orl %ecx, %ebp | ||
1309 | movl %esi, 24(%esp) | ||
1310 | andl %edx, %ebp | ||
1311 | leal 2400959708(%esi,%edi,1),%esi | ||
1312 | movl %ebx, %edi | ||
1313 | .byte 209 | ||
1314 | .byte 203 /* rorl $1 %ebx */ | ||
1315 | andl %ecx, %edi | ||
1316 | orl %edi, %ebp | ||
1317 | movl %eax, %edi | ||
1318 | roll $5, %edi | ||
1319 | addl %edi, %ebp | ||
1320 | movl 28(%esp), %edi | ||
1321 | addl %ebp, %esi | ||
1322 | movl 36(%esp), %ebp | ||
1323 | xorl %ebp, %edi | ||
1324 | movl 60(%esp), %ebp | ||
1325 | xorl %ebp, %edi | ||
1326 | movl 16(%esp), %ebp | ||
1327 | .byte 209 | ||
1328 | .byte 203 /* rorl $1 %ebx */ | ||
1329 | xorl %ebp, %edi | ||
1330 | .byte 209 | ||
1331 | .byte 199 /* roll $1 %edi */ | ||
1332 | movl %eax, %ebp | ||
1333 | movl %edi, 28(%esp) | ||
1334 | orl %ebx, %ebp | ||
1335 | leal 2400959708(%edi,%edx,1),%edi | ||
1336 | movl %eax, %edx | ||
1337 | andl %ecx, %ebp | ||
1338 | andl %ebx, %edx | ||
1339 | orl %edx, %ebp | ||
1340 | movl %esi, %edx | ||
1341 | roll $5, %edx | ||
1342 | .byte 209 | ||
1343 | .byte 200 /* rorl $1 %eax */ | ||
1344 | addl %edx, %ebp | ||
1345 | .byte 209 | ||
1346 | .byte 200 /* rorl $1 %eax */ | ||
1347 | addl %ebp, %edi | ||
1348 | /* 40_59 55 */ | ||
1349 | /* 40_59 56 */ | ||
1350 | movl 32(%esp), %edx | ||
1351 | movl 40(%esp), %ebp | ||
1352 | xorl %ebp, %edx | ||
1353 | movl (%esp), %ebp | ||
1354 | xorl %ebp, %edx | ||
1355 | movl 20(%esp), %ebp | ||
1356 | xorl %ebp, %edx | ||
1357 | movl %esi, %ebp | ||
1358 | .byte 209 | ||
1359 | .byte 194 /* roll $1 %edx */ | ||
1360 | orl %eax, %ebp | ||
1361 | movl %edx, 32(%esp) | ||
1362 | andl %ebx, %ebp | ||
1363 | leal 2400959708(%edx,%ecx,1),%edx | ||
1364 | movl %esi, %ecx | ||
1365 | .byte 209 | ||
1366 | .byte 206 /* rorl $1 %esi */ | ||
1367 | andl %eax, %ecx | ||
1368 | orl %ecx, %ebp | ||
1369 | movl %edi, %ecx | ||
1370 | roll $5, %ecx | ||
1371 | addl %ecx, %ebp | ||
1372 | movl 36(%esp), %ecx | ||
1373 | addl %ebp, %edx | ||
1374 | movl 44(%esp), %ebp | ||
1375 | xorl %ebp, %ecx | ||
1376 | movl 4(%esp), %ebp | ||
1377 | xorl %ebp, %ecx | ||
1378 | movl 24(%esp), %ebp | ||
1379 | .byte 209 | ||
1380 | .byte 206 /* rorl $1 %esi */ | ||
1381 | xorl %ebp, %ecx | ||
1382 | .byte 209 | ||
1383 | .byte 193 /* roll $1 %ecx */ | ||
1384 | movl %edi, %ebp | ||
1385 | movl %ecx, 36(%esp) | ||
1386 | orl %esi, %ebp | ||
1387 | leal 2400959708(%ecx,%ebx,1),%ecx | ||
1388 | movl %edi, %ebx | ||
1389 | andl %eax, %ebp | ||
1390 | andl %esi, %ebx | ||
1391 | orl %ebx, %ebp | ||
1392 | movl %edx, %ebx | ||
1393 | roll $5, %ebx | ||
1394 | .byte 209 | ||
1395 | .byte 207 /* rorl $1 %edi */ | ||
1396 | addl %ebx, %ebp | ||
1397 | .byte 209 | ||
1398 | .byte 207 /* rorl $1 %edi */ | ||
1399 | addl %ebp, %ecx | ||
1400 | /* 40_59 57 */ | ||
1401 | /* 40_59 58 */ | ||
1402 | movl 40(%esp), %ebx | ||
1403 | movl 48(%esp), %ebp | ||
1404 | xorl %ebp, %ebx | ||
1405 | movl 8(%esp), %ebp | ||
1406 | xorl %ebp, %ebx | ||
1407 | movl 28(%esp), %ebp | ||
1408 | xorl %ebp, %ebx | ||
1409 | movl %edx, %ebp | ||
1410 | .byte 209 | ||
1411 | .byte 195 /* roll $1 %ebx */ | ||
1412 | orl %edi, %ebp | ||
1413 | movl %ebx, 40(%esp) | ||
1414 | andl %esi, %ebp | ||
1415 | leal 2400959708(%ebx,%eax,1),%ebx | ||
1416 | movl %edx, %eax | ||
1417 | .byte 209 | ||
1418 | .byte 202 /* rorl $1 %edx */ | ||
1419 | andl %edi, %eax | ||
1420 | orl %eax, %ebp | ||
1421 | movl %ecx, %eax | ||
1422 | roll $5, %eax | ||
1423 | addl %eax, %ebp | ||
1424 | movl 44(%esp), %eax | ||
1425 | addl %ebp, %ebx | ||
1426 | movl 52(%esp), %ebp | ||
1427 | xorl %ebp, %eax | ||
1428 | movl 12(%esp), %ebp | ||
1429 | xorl %ebp, %eax | ||
1430 | movl 32(%esp), %ebp | ||
1431 | .byte 209 | ||
1432 | .byte 202 /* rorl $1 %edx */ | ||
1433 | xorl %ebp, %eax | ||
1434 | .byte 209 | ||
1435 | .byte 192 /* roll $1 %eax */ | ||
1436 | movl %ecx, %ebp | ||
1437 | movl %eax, 44(%esp) | ||
1438 | orl %edx, %ebp | ||
1439 | leal 2400959708(%eax,%esi,1),%eax | ||
1440 | movl %ecx, %esi | ||
1441 | andl %edi, %ebp | ||
1442 | andl %edx, %esi | ||
1443 | orl %esi, %ebp | ||
1444 | movl %ebx, %esi | ||
1445 | roll $5, %esi | ||
1446 | .byte 209 | ||
1447 | .byte 201 /* rorl $1 %ecx */ | ||
1448 | addl %esi, %ebp | ||
1449 | .byte 209 | ||
1450 | .byte 201 /* rorl $1 %ecx */ | ||
1451 | addl %ebp, %eax | ||
1452 | /* 40_59 59 */ | ||
1453 | /* 20_39 60 */ | ||
1454 | movl 48(%esp), %esi | ||
1455 | movl 56(%esp), %ebp | ||
1456 | xorl %ebp, %esi | ||
1457 | movl 16(%esp), %ebp | ||
1458 | xorl %ebp, %esi | ||
1459 | movl 36(%esp), %ebp | ||
1460 | xorl %ebp, %esi | ||
1461 | movl %ebx, %ebp | ||
1462 | .byte 209 | ||
1463 | .byte 198 /* roll $1 %esi */ | ||
1464 | xorl %ecx, %ebp | ||
1465 | movl %esi, 48(%esp) | ||
1466 | xorl %edx, %ebp | ||
1467 | leal 3395469782(%esi,%edi,1),%esi | ||
1468 | movl %eax, %edi | ||
1469 | roll $5, %edi | ||
1470 | .byte 209 | ||
1471 | .byte 203 /* rorl $1 %ebx */ | ||
1472 | addl %ebp, %edi | ||
1473 | .byte 209 | ||
1474 | .byte 203 /* rorl $1 %ebx */ | ||
1475 | addl %edi, %esi | ||
1476 | /* 20_39 61 */ | ||
1477 | movl 52(%esp), %edi | ||
1478 | movl 60(%esp), %ebp | ||
1479 | xorl %ebp, %edi | ||
1480 | movl 20(%esp), %ebp | ||
1481 | xorl %ebp, %edi | ||
1482 | movl 40(%esp), %ebp | ||
1483 | xorl %ebp, %edi | ||
1484 | movl %eax, %ebp | ||
1485 | .byte 209 | ||
1486 | .byte 199 /* roll $1 %edi */ | ||
1487 | xorl %ebx, %ebp | ||
1488 | movl %edi, 52(%esp) | ||
1489 | xorl %ecx, %ebp | ||
1490 | leal 3395469782(%edi,%edx,1),%edi | ||
1491 | movl %esi, %edx | ||
1492 | roll $5, %edx | ||
1493 | .byte 209 | ||
1494 | .byte 200 /* rorl $1 %eax */ | ||
1495 | addl %ebp, %edx | ||
1496 | .byte 209 | ||
1497 | .byte 200 /* rorl $1 %eax */ | ||
1498 | addl %edx, %edi | ||
1499 | /* 20_39 62 */ | ||
1500 | movl 56(%esp), %edx | ||
1501 | movl (%esp), %ebp | ||
1502 | xorl %ebp, %edx | ||
1503 | movl 24(%esp), %ebp | ||
1504 | xorl %ebp, %edx | ||
1505 | movl 44(%esp), %ebp | ||
1506 | xorl %ebp, %edx | ||
1507 | movl %esi, %ebp | ||
1508 | .byte 209 | ||
1509 | .byte 194 /* roll $1 %edx */ | ||
1510 | xorl %eax, %ebp | ||
1511 | movl %edx, 56(%esp) | ||
1512 | xorl %ebx, %ebp | ||
1513 | leal 3395469782(%edx,%ecx,1),%edx | ||
1514 | movl %edi, %ecx | ||
1515 | roll $5, %ecx | ||
1516 | .byte 209 | ||
1517 | .byte 206 /* rorl $1 %esi */ | ||
1518 | addl %ebp, %ecx | ||
1519 | .byte 209 | ||
1520 | .byte 206 /* rorl $1 %esi */ | ||
1521 | addl %ecx, %edx | ||
1522 | /* 20_39 63 */ | ||
1523 | movl 60(%esp), %ecx | ||
1524 | movl 4(%esp), %ebp | ||
1525 | xorl %ebp, %ecx | ||
1526 | movl 28(%esp), %ebp | ||
1527 | xorl %ebp, %ecx | ||
1528 | movl 48(%esp), %ebp | ||
1529 | xorl %ebp, %ecx | ||
1530 | movl %edi, %ebp | ||
1531 | .byte 209 | ||
1532 | .byte 193 /* roll $1 %ecx */ | ||
1533 | xorl %esi, %ebp | ||
1534 | movl %ecx, 60(%esp) | ||
1535 | xorl %eax, %ebp | ||
1536 | leal 3395469782(%ecx,%ebx,1),%ecx | ||
1537 | movl %edx, %ebx | ||
1538 | roll $5, %ebx | ||
1539 | .byte 209 | ||
1540 | .byte 207 /* rorl $1 %edi */ | ||
1541 | addl %ebp, %ebx | ||
1542 | .byte 209 | ||
1543 | .byte 207 /* rorl $1 %edi */ | ||
1544 | addl %ebx, %ecx | ||
1545 | /* 20_39 64 */ | ||
1546 | movl (%esp), %ebx | ||
1547 | movl 8(%esp), %ebp | ||
1548 | xorl %ebp, %ebx | ||
1549 | movl 32(%esp), %ebp | ||
1550 | xorl %ebp, %ebx | ||
1551 | movl 52(%esp), %ebp | ||
1552 | xorl %ebp, %ebx | ||
1553 | movl %edx, %ebp | ||
1554 | .byte 209 | ||
1555 | .byte 195 /* roll $1 %ebx */ | ||
1556 | xorl %edi, %ebp | ||
1557 | movl %ebx, (%esp) | ||
1558 | xorl %esi, %ebp | ||
1559 | leal 3395469782(%ebx,%eax,1),%ebx | ||
1560 | movl %ecx, %eax | ||
1561 | roll $5, %eax | ||
1562 | .byte 209 | ||
1563 | .byte 202 /* rorl $1 %edx */ | ||
1564 | addl %ebp, %eax | ||
1565 | .byte 209 | ||
1566 | .byte 202 /* rorl $1 %edx */ | ||
1567 | addl %eax, %ebx | ||
1568 | /* 20_39 65 */ | ||
1569 | movl 4(%esp), %eax | ||
1570 | movl 12(%esp), %ebp | ||
1571 | xorl %ebp, %eax | ||
1572 | movl 36(%esp), %ebp | ||
1573 | xorl %ebp, %eax | ||
1574 | movl 56(%esp), %ebp | ||
1575 | xorl %ebp, %eax | ||
1576 | movl %ecx, %ebp | ||
1577 | .byte 209 | ||
1578 | .byte 192 /* roll $1 %eax */ | ||
1579 | xorl %edx, %ebp | ||
1580 | movl %eax, 4(%esp) | ||
1581 | xorl %edi, %ebp | ||
1582 | leal 3395469782(%eax,%esi,1),%eax | ||
1583 | movl %ebx, %esi | ||
1584 | roll $5, %esi | ||
1585 | .byte 209 | ||
1586 | .byte 201 /* rorl $1 %ecx */ | ||
1587 | addl %ebp, %esi | ||
1588 | .byte 209 | ||
1589 | .byte 201 /* rorl $1 %ecx */ | ||
1590 | addl %esi, %eax | ||
1591 | /* 20_39 66 */ | ||
1592 | movl 8(%esp), %esi | ||
1593 | movl 16(%esp), %ebp | ||
1594 | xorl %ebp, %esi | ||
1595 | movl 40(%esp), %ebp | ||
1596 | xorl %ebp, %esi | ||
1597 | movl 60(%esp), %ebp | ||
1598 | xorl %ebp, %esi | ||
1599 | movl %ebx, %ebp | ||
1600 | .byte 209 | ||
1601 | .byte 198 /* roll $1 %esi */ | ||
1602 | xorl %ecx, %ebp | ||
1603 | movl %esi, 8(%esp) | ||
1604 | xorl %edx, %ebp | ||
1605 | leal 3395469782(%esi,%edi,1),%esi | ||
1606 | movl %eax, %edi | ||
1607 | roll $5, %edi | ||
1608 | .byte 209 | ||
1609 | .byte 203 /* rorl $1 %ebx */ | ||
1610 | addl %ebp, %edi | ||
1611 | .byte 209 | ||
1612 | .byte 203 /* rorl $1 %ebx */ | ||
1613 | addl %edi, %esi | ||
1614 | /* 20_39 67 */ | ||
1615 | movl 12(%esp), %edi | ||
1616 | movl 20(%esp), %ebp | ||
1617 | xorl %ebp, %edi | ||
1618 | movl 44(%esp), %ebp | ||
1619 | xorl %ebp, %edi | ||
1620 | movl (%esp), %ebp | ||
1621 | xorl %ebp, %edi | ||
1622 | movl %eax, %ebp | ||
1623 | .byte 209 | ||
1624 | .byte 199 /* roll $1 %edi */ | ||
1625 | xorl %ebx, %ebp | ||
1626 | movl %edi, 12(%esp) | ||
1627 | xorl %ecx, %ebp | ||
1628 | leal 3395469782(%edi,%edx,1),%edi | ||
1629 | movl %esi, %edx | ||
1630 | roll $5, %edx | ||
1631 | .byte 209 | ||
1632 | .byte 200 /* rorl $1 %eax */ | ||
1633 | addl %ebp, %edx | ||
1634 | .byte 209 | ||
1635 | .byte 200 /* rorl $1 %eax */ | ||
1636 | addl %edx, %edi | ||
1637 | /* 20_39 68 */ | ||
1638 | movl 16(%esp), %edx | ||
1639 | movl 24(%esp), %ebp | ||
1640 | xorl %ebp, %edx | ||
1641 | movl 48(%esp), %ebp | ||
1642 | xorl %ebp, %edx | ||
1643 | movl 4(%esp), %ebp | ||
1644 | xorl %ebp, %edx | ||
1645 | movl %esi, %ebp | ||
1646 | .byte 209 | ||
1647 | .byte 194 /* roll $1 %edx */ | ||
1648 | xorl %eax, %ebp | ||
1649 | movl %edx, 16(%esp) | ||
1650 | xorl %ebx, %ebp | ||
1651 | leal 3395469782(%edx,%ecx,1),%edx | ||
1652 | movl %edi, %ecx | ||
1653 | roll $5, %ecx | ||
1654 | .byte 209 | ||
1655 | .byte 206 /* rorl $1 %esi */ | ||
1656 | addl %ebp, %ecx | ||
1657 | .byte 209 | ||
1658 | .byte 206 /* rorl $1 %esi */ | ||
1659 | addl %ecx, %edx | ||
1660 | /* 20_39 69 */ | ||
1661 | movl 20(%esp), %ecx | ||
1662 | movl 28(%esp), %ebp | ||
1663 | xorl %ebp, %ecx | ||
1664 | movl 52(%esp), %ebp | ||
1665 | xorl %ebp, %ecx | ||
1666 | movl 8(%esp), %ebp | ||
1667 | xorl %ebp, %ecx | ||
1668 | movl %edi, %ebp | ||
1669 | .byte 209 | ||
1670 | .byte 193 /* roll $1 %ecx */ | ||
1671 | xorl %esi, %ebp | ||
1672 | movl %ecx, 20(%esp) | ||
1673 | xorl %eax, %ebp | ||
1674 | leal 3395469782(%ecx,%ebx,1),%ecx | ||
1675 | movl %edx, %ebx | ||
1676 | roll $5, %ebx | ||
1677 | .byte 209 | ||
1678 | .byte 207 /* rorl $1 %edi */ | ||
1679 | addl %ebp, %ebx | ||
1680 | .byte 209 | ||
1681 | .byte 207 /* rorl $1 %edi */ | ||
1682 | addl %ebx, %ecx | ||
1683 | /* 20_39 70 */ | ||
1684 | movl 24(%esp), %ebx | ||
1685 | movl 32(%esp), %ebp | ||
1686 | xorl %ebp, %ebx | ||
1687 | movl 56(%esp), %ebp | ||
1688 | xorl %ebp, %ebx | ||
1689 | movl 12(%esp), %ebp | ||
1690 | xorl %ebp, %ebx | ||
1691 | movl %edx, %ebp | ||
1692 | .byte 209 | ||
1693 | .byte 195 /* roll $1 %ebx */ | ||
1694 | xorl %edi, %ebp | ||
1695 | movl %ebx, 24(%esp) | ||
1696 | xorl %esi, %ebp | ||
1697 | leal 3395469782(%ebx,%eax,1),%ebx | ||
1698 | movl %ecx, %eax | ||
1699 | roll $5, %eax | ||
1700 | .byte 209 | ||
1701 | .byte 202 /* rorl $1 %edx */ | ||
1702 | addl %ebp, %eax | ||
1703 | .byte 209 | ||
1704 | .byte 202 /* rorl $1 %edx */ | ||
1705 | addl %eax, %ebx | ||
1706 | /* 20_39 71 */ | ||
1707 | movl 28(%esp), %eax | ||
1708 | movl 36(%esp), %ebp | ||
1709 | xorl %ebp, %eax | ||
1710 | movl 60(%esp), %ebp | ||
1711 | xorl %ebp, %eax | ||
1712 | movl 16(%esp), %ebp | ||
1713 | xorl %ebp, %eax | ||
1714 | movl %ecx, %ebp | ||
1715 | .byte 209 | ||
1716 | .byte 192 /* roll $1 %eax */ | ||
1717 | xorl %edx, %ebp | ||
1718 | movl %eax, 28(%esp) | ||
1719 | xorl %edi, %ebp | ||
1720 | leal 3395469782(%eax,%esi,1),%eax | ||
1721 | movl %ebx, %esi | ||
1722 | roll $5, %esi | ||
1723 | .byte 209 | ||
1724 | .byte 201 /* rorl $1 %ecx */ | ||
1725 | addl %ebp, %esi | ||
1726 | .byte 209 | ||
1727 | .byte 201 /* rorl $1 %ecx */ | ||
1728 | addl %esi, %eax | ||
1729 | /* 20_39 72 */ | ||
1730 | movl 32(%esp), %esi | ||
1731 | movl 40(%esp), %ebp | ||
1732 | xorl %ebp, %esi | ||
1733 | movl (%esp), %ebp | ||
1734 | xorl %ebp, %esi | ||
1735 | movl 20(%esp), %ebp | ||
1736 | xorl %ebp, %esi | ||
1737 | movl %ebx, %ebp | ||
1738 | .byte 209 | ||
1739 | .byte 198 /* roll $1 %esi */ | ||
1740 | xorl %ecx, %ebp | ||
1741 | movl %esi, 32(%esp) | ||
1742 | xorl %edx, %ebp | ||
1743 | leal 3395469782(%esi,%edi,1),%esi | ||
1744 | movl %eax, %edi | ||
1745 | roll $5, %edi | ||
1746 | .byte 209 | ||
1747 | .byte 203 /* rorl $1 %ebx */ | ||
1748 | addl %ebp, %edi | ||
1749 | .byte 209 | ||
1750 | .byte 203 /* rorl $1 %ebx */ | ||
1751 | addl %edi, %esi | ||
1752 | /* 20_39 73 */ | ||
1753 | movl 36(%esp), %edi | ||
1754 | movl 44(%esp), %ebp | ||
1755 | xorl %ebp, %edi | ||
1756 | movl 4(%esp), %ebp | ||
1757 | xorl %ebp, %edi | ||
1758 | movl 24(%esp), %ebp | ||
1759 | xorl %ebp, %edi | ||
1760 | movl %eax, %ebp | ||
1761 | .byte 209 | ||
1762 | .byte 199 /* roll $1 %edi */ | ||
1763 | xorl %ebx, %ebp | ||
1764 | movl %edi, 36(%esp) | ||
1765 | xorl %ecx, %ebp | ||
1766 | leal 3395469782(%edi,%edx,1),%edi | ||
1767 | movl %esi, %edx | ||
1768 | roll $5, %edx | ||
1769 | .byte 209 | ||
1770 | .byte 200 /* rorl $1 %eax */ | ||
1771 | addl %ebp, %edx | ||
1772 | .byte 209 | ||
1773 | .byte 200 /* rorl $1 %eax */ | ||
1774 | addl %edx, %edi | ||
1775 | /* 20_39 74 */ | ||
1776 | movl 40(%esp), %edx | ||
1777 | movl 48(%esp), %ebp | ||
1778 | xorl %ebp, %edx | ||
1779 | movl 8(%esp), %ebp | ||
1780 | xorl %ebp, %edx | ||
1781 | movl 28(%esp), %ebp | ||
1782 | xorl %ebp, %edx | ||
1783 | movl %esi, %ebp | ||
1784 | .byte 209 | ||
1785 | .byte 194 /* roll $1 %edx */ | ||
1786 | xorl %eax, %ebp | ||
1787 | movl %edx, 40(%esp) | ||
1788 | xorl %ebx, %ebp | ||
1789 | leal 3395469782(%edx,%ecx,1),%edx | ||
1790 | movl %edi, %ecx | ||
1791 | roll $5, %ecx | ||
1792 | .byte 209 | ||
1793 | .byte 206 /* rorl $1 %esi */ | ||
1794 | addl %ebp, %ecx | ||
1795 | .byte 209 | ||
1796 | .byte 206 /* rorl $1 %esi */ | ||
1797 | addl %ecx, %edx | ||
1798 | /* 20_39 75 */ | ||
1799 | movl 44(%esp), %ecx | ||
1800 | movl 52(%esp), %ebp | ||
1801 | xorl %ebp, %ecx | ||
1802 | movl 12(%esp), %ebp | ||
1803 | xorl %ebp, %ecx | ||
1804 | movl 32(%esp), %ebp | ||
1805 | xorl %ebp, %ecx | ||
1806 | movl %edi, %ebp | ||
1807 | .byte 209 | ||
1808 | .byte 193 /* roll $1 %ecx */ | ||
1809 | xorl %esi, %ebp | ||
1810 | movl %ecx, 44(%esp) | ||
1811 | xorl %eax, %ebp | ||
1812 | leal 3395469782(%ecx,%ebx,1),%ecx | ||
1813 | movl %edx, %ebx | ||
1814 | roll $5, %ebx | ||
1815 | .byte 209 | ||
1816 | .byte 207 /* rorl $1 %edi */ | ||
1817 | addl %ebp, %ebx | ||
1818 | .byte 209 | ||
1819 | .byte 207 /* rorl $1 %edi */ | ||
1820 | addl %ebx, %ecx | ||
1821 | /* 20_39 76 */ | ||
1822 | movl 48(%esp), %ebx | ||
1823 | movl 56(%esp), %ebp | ||
1824 | xorl %ebp, %ebx | ||
1825 | movl 16(%esp), %ebp | ||
1826 | xorl %ebp, %ebx | ||
1827 | movl 36(%esp), %ebp | ||
1828 | xorl %ebp, %ebx | ||
1829 | movl %edx, %ebp | ||
1830 | .byte 209 | ||
1831 | .byte 195 /* roll $1 %ebx */ | ||
1832 | xorl %edi, %ebp | ||
1833 | movl %ebx, 48(%esp) | ||
1834 | xorl %esi, %ebp | ||
1835 | leal 3395469782(%ebx,%eax,1),%ebx | ||
1836 | movl %ecx, %eax | ||
1837 | roll $5, %eax | ||
1838 | .byte 209 | ||
1839 | .byte 202 /* rorl $1 %edx */ | ||
1840 | addl %ebp, %eax | ||
1841 | .byte 209 | ||
1842 | .byte 202 /* rorl $1 %edx */ | ||
1843 | addl %eax, %ebx | ||
1844 | /* 20_39 77 */ | ||
1845 | movl 52(%esp), %eax | ||
1846 | movl 60(%esp), %ebp | ||
1847 | xorl %ebp, %eax | ||
1848 | movl 20(%esp), %ebp | ||
1849 | xorl %ebp, %eax | ||
1850 | movl 40(%esp), %ebp | ||
1851 | xorl %ebp, %eax | ||
1852 | movl %ecx, %ebp | ||
1853 | .byte 209 | ||
1854 | .byte 192 /* roll $1 %eax */ | ||
1855 | xorl %edx, %ebp | ||
1856 | movl %eax, 52(%esp) | ||
1857 | xorl %edi, %ebp | ||
1858 | leal 3395469782(%eax,%esi,1),%eax | ||
1859 | movl %ebx, %esi | ||
1860 | roll $5, %esi | ||
1861 | .byte 209 | ||
1862 | .byte 201 /* rorl $1 %ecx */ | ||
1863 | addl %ebp, %esi | ||
1864 | .byte 209 | ||
1865 | .byte 201 /* rorl $1 %ecx */ | ||
1866 | addl %esi, %eax | ||
1867 | /* 20_39 78 */ | ||
1868 | movl 56(%esp), %esi | ||
1869 | movl (%esp), %ebp | ||
1870 | xorl %ebp, %esi | ||
1871 | movl 24(%esp), %ebp | ||
1872 | xorl %ebp, %esi | ||
1873 | movl 44(%esp), %ebp | ||
1874 | xorl %ebp, %esi | ||
1875 | movl %ebx, %ebp | ||
1876 | .byte 209 | ||
1877 | .byte 198 /* roll $1 %esi */ | ||
1878 | xorl %ecx, %ebp | ||
1879 | movl %esi, 56(%esp) | ||
1880 | xorl %edx, %ebp | ||
1881 | leal 3395469782(%esi,%edi,1),%esi | ||
1882 | movl %eax, %edi | ||
1883 | roll $5, %edi | ||
1884 | .byte 209 | ||
1885 | .byte 203 /* rorl $1 %ebx */ | ||
1886 | addl %ebp, %edi | ||
1887 | .byte 209 | ||
1888 | .byte 203 /* rorl $1 %ebx */ | ||
1889 | addl %edi, %esi | ||
1890 | /* 20_39 79 */ | ||
1891 | movl 60(%esp), %edi | ||
1892 | movl 4(%esp), %ebp | ||
1893 | xorl %ebp, %edi | ||
1894 | movl 28(%esp), %ebp | ||
1895 | xorl %ebp, %edi | ||
1896 | movl 48(%esp), %ebp | ||
1897 | xorl %ebp, %edi | ||
1898 | movl %eax, %ebp | ||
1899 | .byte 209 | ||
1900 | .byte 199 /* roll $1 %edi */ | ||
1901 | xorl %ebx, %ebp | ||
1902 | movl %edi, 60(%esp) | ||
1903 | xorl %ecx, %ebp | ||
1904 | leal 3395469782(%edi,%edx,1),%edi | ||
1905 | movl %esi, %edx | ||
1906 | roll $5, %edx | ||
1907 | addl %ebp, %edx | ||
1908 | movl 92(%esp), %ebp | ||
1909 | .byte 209 | ||
1910 | .byte 200 /* rorl $1 %eax */ | ||
1911 | addl %edx, %edi | ||
1912 | .byte 209 | ||
1913 | .byte 200 /* rorl $1 %eax */ | ||
1914 | /* End processing */ | ||
1915 | |||
1916 | movl 12(%ebp), %edx | ||
1917 | addl %ebx, %edx | ||
1918 | movl 4(%ebp), %ebx | ||
1919 | addl %esi, %ebx | ||
1920 | movl %eax, %esi | ||
1921 | movl (%ebp), %eax | ||
1922 | movl %edx, 12(%ebp) | ||
1923 | addl %edi, %eax | ||
1924 | movl 16(%ebp), %edi | ||
1925 | addl %ecx, %edi | ||
1926 | movl 8(%ebp), %ecx | ||
1927 | addl %esi, %ecx | ||
1928 | movl %eax, (%ebp) | ||
1929 | movl 64(%esp), %esi | ||
1930 | movl %ecx, 8(%ebp) | ||
1931 | addl $64, %esi | ||
1932 | movl 68(%esp), %eax | ||
1933 | movl %edi, 16(%ebp) | ||
1934 | cmpl %esi, %eax | ||
1935 | movl %ebx, 4(%ebp) | ||
1936 | jl .L001end | ||
1937 | movl (%esi), %eax | ||
1938 | jmp .L000start | ||
1939 | .L001end: | ||
1940 | addl $72, %esp | ||
1941 | popl %edi | ||
1942 | popl %ebx | ||
1943 | popl %ebp | ||
1944 | popl %esi | ||
1945 | ret | ||
1946 | .sha1_block_x86_end: | ||
1947 | SIZE(sha1_block_x86,.sha1_block_x86_end-sha1_block_x86) | ||
1948 | .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 @@ | |||
1 | /* crypto/sha/sha_sgst.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdlib.h> | ||
60 | #include <string.h> | ||
61 | |||
62 | #ifdef undef | ||
63 | /* one or the other needs to be defined */ | ||
64 | #ifndef SHA_1 /* FIPE 180-1 */ | ||
65 | #define SHA_0 /* FIPS 180 */ | ||
66 | #endif | ||
67 | #endif | ||
68 | |||
69 | #define ULONG unsigned long | ||
70 | #define UCHAR unsigned char | ||
71 | #define UINT unsigned int | ||
72 | |||
73 | #ifdef NOCONST | ||
74 | #define const | ||
75 | #endif | ||
76 | |||
77 | #undef c2nl | ||
78 | #define c2nl(c,l) (l =(((unsigned long)(*((c)++)))<<24), \ | ||
79 | l|=(((unsigned long)(*((c)++)))<<16), \ | ||
80 | l|=(((unsigned long)(*((c)++)))<< 8), \ | ||
81 | l|=(((unsigned long)(*((c)++))) )) | ||
82 | |||
83 | #undef p_c2nl | ||
84 | #define p_c2nl(c,l,n) { \ | ||
85 | switch (n) { \ | ||
86 | case 0: l =((unsigned long)(*((c)++)))<<24; \ | ||
87 | case 1: l|=((unsigned long)(*((c)++)))<<16; \ | ||
88 | case 2: l|=((unsigned long)(*((c)++)))<< 8; \ | ||
89 | case 3: l|=((unsigned long)(*((c)++))); \ | ||
90 | } \ | ||
91 | } | ||
92 | |||
93 | #undef c2nl_p | ||
94 | /* NOTE the pointer is not incremented at the end of this */ | ||
95 | #define c2nl_p(c,l,n) { \ | ||
96 | l=0; \ | ||
97 | (c)+=n; \ | ||
98 | switch (n) { \ | ||
99 | case 3: l =((unsigned long)(*(--(c))))<< 8; \ | ||
100 | case 2: l|=((unsigned long)(*(--(c))))<<16; \ | ||
101 | case 1: l|=((unsigned long)(*(--(c))))<<24; \ | ||
102 | } \ | ||
103 | } | ||
104 | |||
105 | #undef p_c2nl_p | ||
106 | #define p_c2nl_p(c,l,sc,len) { \ | ||
107 | switch (sc) \ | ||
108 | { \ | ||
109 | case 0: l =((unsigned long)(*((c)++)))<<24; \ | ||
110 | if (--len == 0) break; \ | ||
111 | case 1: l|=((unsigned long)(*((c)++)))<<16; \ | ||
112 | if (--len == 0) break; \ | ||
113 | case 2: l|=((unsigned long)(*((c)++)))<< 8; \ | ||
114 | } \ | ||
115 | } | ||
116 | |||
117 | #undef nl2c | ||
118 | #define nl2c(l,c) (*((c)++)=(unsigned char)(((l)>>24)&0xff), \ | ||
119 | *((c)++)=(unsigned char)(((l)>>16)&0xff), \ | ||
120 | *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ | ||
121 | *((c)++)=(unsigned char)(((l) )&0xff)) | ||
122 | |||
123 | #undef c2l | ||
124 | #define c2l(c,l) (l =(((unsigned long)(*((c)++))) ), \ | ||
125 | l|=(((unsigned long)(*((c)++)))<< 8), \ | ||
126 | l|=(((unsigned long)(*((c)++)))<<16), \ | ||
127 | l|=(((unsigned long)(*((c)++)))<<24)) | ||
128 | |||
129 | #undef p_c2l | ||
130 | #define p_c2l(c,l,n) { \ | ||
131 | switch (n) { \ | ||
132 | case 0: l =((unsigned long)(*((c)++))); \ | ||
133 | case 1: l|=((unsigned long)(*((c)++)))<< 8; \ | ||
134 | case 2: l|=((unsigned long)(*((c)++)))<<16; \ | ||
135 | case 3: l|=((unsigned long)(*((c)++)))<<24; \ | ||
136 | } \ | ||
137 | } | ||
138 | |||
139 | #undef c2l_p | ||
140 | /* NOTE the pointer is not incremented at the end of this */ | ||
141 | #define c2l_p(c,l,n) { \ | ||
142 | l=0; \ | ||
143 | (c)+=n; \ | ||
144 | switch (n) { \ | ||
145 | case 3: l =((unsigned long)(*(--(c))))<<16; \ | ||
146 | case 2: l|=((unsigned long)(*(--(c))))<< 8; \ | ||
147 | case 1: l|=((unsigned long)(*(--(c)))); \ | ||
148 | } \ | ||
149 | } | ||
150 | |||
151 | #undef p_c2l_p | ||
152 | #define p_c2l_p(c,l,sc,len) { \ | ||
153 | switch (sc) \ | ||
154 | { \ | ||
155 | case 0: l =((unsigned long)(*((c)++))); \ | ||
156 | if (--len == 0) break; \ | ||
157 | case 1: l|=((unsigned long)(*((c)++)))<< 8; \ | ||
158 | if (--len == 0) break; \ | ||
159 | case 2: l|=((unsigned long)(*((c)++)))<<16; \ | ||
160 | } \ | ||
161 | } | ||
162 | |||
163 | #undef l2c | ||
164 | #define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ | ||
165 | *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ | ||
166 | *((c)++)=(unsigned char)(((l)>>16)&0xff), \ | ||
167 | *((c)++)=(unsigned char)(((l)>>24)&0xff)) | ||
168 | |||
169 | #undef ROTATE | ||
170 | #if defined(WIN32) | ||
171 | #define ROTATE(a,n) _lrotl(a,n) | ||
172 | #else | ||
173 | #define ROTATE(a,n) (((a)<<(n))|(((a)&0xffffffff)>>(32-(n)))) | ||
174 | #endif | ||
175 | |||
176 | /* A nice byte order reversal from Wei Dai <weidai@eskimo.com> */ | ||
177 | #if defined(WIN32) | ||
178 | /* 5 instructions with rotate instruction, else 9 */ | ||
179 | #define Endian_Reverse32(a) \ | ||
180 | { \ | ||
181 | unsigned long l=(a); \ | ||
182 | (a)=((ROTATE(l,8)&0x00FF00FF)|(ROTATE(l,24)&0xFF00FF00)); \ | ||
183 | } | ||
184 | #else | ||
185 | /* 6 instructions with rotate instruction, else 8 */ | ||
186 | #define Endian_Reverse32(a) \ | ||
187 | { \ | ||
188 | unsigned long l=(a); \ | ||
189 | l=(((l&0xFF00FF00)>>8L)|((l&0x00FF00FF)<<8L)); \ | ||
190 | (a)=ROTATE(l,16L); \ | ||
191 | } | ||
192 | #endif | ||
193 | |||
194 | /* As pointed out by Wei Dai <weidai@eskimo.com>, F() below can be | ||
195 | * simplified to the code in F_00_19. Wei attributes these optimisations | ||
196 | * to Peter Gutmann's SHS code, and he attributes it to Rich Schroeppel. | ||
197 | * #define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) | ||
198 | * I've just become aware of another tweak to be made, again from Wei Dai, | ||
199 | * in F_40_59, (x&a)|(y&a) -> (x|y)&a | ||
200 | */ | ||
201 | #define F_00_19(b,c,d) ((((c) ^ (d)) & (b)) ^ (d)) | ||
202 | #define F_20_39(b,c,d) ((b) ^ (c) ^ (d)) | ||
203 | #define F_40_59(b,c,d) (((b) & (c)) | (((b)|(c)) & (d))) | ||
204 | #define F_60_79(b,c,d) F_20_39(b,c,d) | ||
205 | |||
206 | #ifdef SHA_0 | ||
207 | #undef Xupdate | ||
208 | #define Xupdate(a,i,ia,ib,ic,id) X[(i)&0x0f]=(a)=\ | ||
209 | (ia[(i)&0x0f]^ib[((i)+2)&0x0f]^ic[((i)+8)&0x0f]^id[((i)+13)&0x0f]); | ||
210 | #endif | ||
211 | #ifdef SHA_1 | ||
212 | #undef Xupdate | ||
213 | #define Xupdate(a,i,ia,ib,ic,id) (a)=\ | ||
214 | (ia[(i)&0x0f]^ib[((i)+2)&0x0f]^ic[((i)+8)&0x0f]^id[((i)+13)&0x0f]);\ | ||
215 | X[(i)&0x0f]=(a)=ROTATE((a),1); | ||
216 | #endif | ||
217 | |||
218 | #define BODY_00_15(i,a,b,c,d,e,f,xa) \ | ||
219 | (f)=xa[i]+(e)+K_00_19+ROTATE((a),5)+F_00_19((b),(c),(d)); \ | ||
220 | (b)=ROTATE((b),30); | ||
221 | |||
222 | #define BODY_16_19(i,a,b,c,d,e,f,xa,xb,xc,xd) \ | ||
223 | Xupdate(f,i,xa,xb,xc,xd); \ | ||
224 | (f)+=(e)+K_00_19+ROTATE((a),5)+F_00_19((b),(c),(d)); \ | ||
225 | (b)=ROTATE((b),30); | ||
226 | |||
227 | #define BODY_20_31(i,a,b,c,d,e,f,xa,xb,xc,xd) \ | ||
228 | Xupdate(f,i,xa,xb,xc,xd); \ | ||
229 | (f)+=(e)+K_20_39+ROTATE((a),5)+F_20_39((b),(c),(d)); \ | ||
230 | (b)=ROTATE((b),30); | ||
231 | |||
232 | #define BODY_32_39(i,a,b,c,d,e,f,xa) \ | ||
233 | Xupdate(f,i,xa,xa,xa,xa); \ | ||
234 | (f)+=(e)+K_20_39+ROTATE((a),5)+F_20_39((b),(c),(d)); \ | ||
235 | (b)=ROTATE((b),30); | ||
236 | |||
237 | #define BODY_40_59(i,a,b,c,d,e,f,xa) \ | ||
238 | Xupdate(f,i,xa,xa,xa,xa); \ | ||
239 | (f)+=(e)+K_40_59+ROTATE((a),5)+F_40_59((b),(c),(d)); \ | ||
240 | (b)=ROTATE((b),30); | ||
241 | |||
242 | #define BODY_60_79(i,a,b,c,d,e,f,xa) \ | ||
243 | Xupdate(f,i,xa,xa,xa,xa); \ | ||
244 | (f)=X[(i)&0x0f]+(e)+K_60_79+ROTATE((a),5)+F_60_79((b),(c),(d)); \ | ||
245 | (b)=ROTATE((b),30); | ||
246 | |||
diff --git a/src/lib/libcrypto/stack/Makefile.ssl b/src/lib/libcrypto/stack/Makefile.ssl new file mode 100644 index 0000000000..0d232c08cf --- /dev/null +++ b/src/lib/libcrypto/stack/Makefile.ssl | |||
@@ -0,0 +1,80 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/stack/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= stack | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | GENERAL=Makefile | ||
19 | TEST= | ||
20 | APPS= | ||
21 | |||
22 | LIB=$(TOP)/libcrypto.a | ||
23 | LIBSRC=stack.c | ||
24 | LIBOBJ=stack.o | ||
25 | |||
26 | SRC= $(LIBSRC) | ||
27 | |||
28 | EXHEADER= stack.h | ||
29 | HEADER= $(EXHEADER) | ||
30 | |||
31 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
32 | |||
33 | top: | ||
34 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
35 | |||
36 | all: lib | ||
37 | |||
38 | lib: $(LIBOBJ) | ||
39 | $(AR) $(LIB) $(LIBOBJ) | ||
40 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
41 | @touch lib | ||
42 | |||
43 | files: | ||
44 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
45 | |||
46 | links: | ||
47 | /bin/rm -f Makefile | ||
48 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
49 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
50 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
51 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
52 | |||
53 | install: | ||
54 | @for i in $(EXHEADER) ; \ | ||
55 | do \ | ||
56 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
57 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
58 | done; | ||
59 | |||
60 | tags: | ||
61 | ctags $(SRC) | ||
62 | |||
63 | tests: | ||
64 | |||
65 | lint: | ||
66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
67 | |||
68 | depend: | ||
69 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
70 | |||
71 | dclean: | ||
72 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
73 | mv -f Makefile.new $(MAKEFILE) | ||
74 | |||
75 | clean: | ||
76 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
77 | |||
78 | errors: | ||
79 | |||
80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
diff --git a/src/lib/libcrypto/txt_db/Makefile.ssl b/src/lib/libcrypto/txt_db/Makefile.ssl new file mode 100644 index 0000000000..76e511534f --- /dev/null +++ b/src/lib/libcrypto/txt_db/Makefile.ssl | |||
@@ -0,0 +1,80 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/txt_db/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= txt_db | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | GENERAL=Makefile | ||
19 | TEST= | ||
20 | APPS= | ||
21 | |||
22 | LIB=$(TOP)/libcrypto.a | ||
23 | LIBSRC=txt_db.c | ||
24 | LIBOBJ=txt_db.o | ||
25 | |||
26 | SRC= $(LIBSRC) | ||
27 | |||
28 | EXHEADER= txt_db.h | ||
29 | HEADER= $(EXHEADER) | ||
30 | |||
31 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
32 | |||
33 | top: | ||
34 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
35 | |||
36 | all: lib | ||
37 | |||
38 | lib: $(LIBOBJ) | ||
39 | $(AR) $(LIB) $(LIBOBJ) | ||
40 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
41 | @touch lib | ||
42 | |||
43 | files: | ||
44 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
45 | |||
46 | links: | ||
47 | /bin/rm -f Makefile | ||
48 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
49 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
50 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
51 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
52 | |||
53 | install: | ||
54 | @for i in $(EXHEADER) ; \ | ||
55 | do \ | ||
56 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
57 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
58 | done; | ||
59 | |||
60 | tags: | ||
61 | ctags $(SRC) | ||
62 | |||
63 | tests: | ||
64 | |||
65 | lint: | ||
66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
67 | |||
68 | depend: | ||
69 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
70 | |||
71 | dclean: | ||
72 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
73 | mv -f Makefile.new $(MAKEFILE) | ||
74 | |||
75 | clean: | ||
76 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
77 | |||
78 | errors: | ||
79 | |||
80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # A bit of an ugly shell script used to actually 'link' files. | ||
4 | # Used by 'make links' | ||
5 | # | ||
6 | |||
7 | PATH=$PATH:.:util:../util:../../util | ||
8 | export PATH | ||
9 | |||
10 | from=$1 | ||
11 | shift | ||
12 | |||
13 | here=`pwd` | ||
14 | tmp=`dirname $from` | ||
15 | while [ "$tmp"x != "x" -a "$tmp"x != ".x" ] | ||
16 | do | ||
17 | t=`basename $here` | ||
18 | here=`dirname $here` | ||
19 | to="/$t$to" | ||
20 | tmp=`dirname $tmp` | ||
21 | done | ||
22 | to=..$to | ||
23 | |||
24 | #echo from=$from | ||
25 | #echo to =$to | ||
26 | #exit 1 | ||
27 | |||
28 | if [ "$*"x != "x" ]; then | ||
29 | for i in $* | ||
30 | do | ||
31 | /bin/rm -f $from/$i | ||
32 | point.sh $to/$i $from/$i | ||
33 | done | ||
34 | fi | ||
35 | 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 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cwd=`pwd` | ||
4 | cd /tmp | ||
5 | |||
6 | if [ -s /bin/ranlib ] ; then | ||
7 | RL=/bin/ranlib | ||
8 | else if [ -s /usr/bin/ranlib ] ; then | ||
9 | RL=/usr/bin/ranlib | ||
10 | fi | ||
11 | fi | ||
12 | |||
13 | if [ "x$RL" != "x" ] | ||
14 | then | ||
15 | case "$1" in | ||
16 | /*) | ||
17 | $RL "$1" | ||
18 | ;; | ||
19 | *) | ||
20 | $RL "$cwd/$1" | ||
21 | ;; | ||
22 | esac | ||
23 | 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 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cwd=`pwd` | ||
4 | /bin/rm -fr tmp/* | ||
5 | |||
6 | cd crypto/des | ||
7 | make -f Makefile.uni tar | ||
8 | make -f Makefile.uni tar_lit | ||
9 | /bin/mv libdes.tgz $cwd/tmp | ||
10 | /bin/mv libdes-l.tgz $cwd/tmp | ||
11 | cd $cwd | ||
12 | |||
13 | for name in md5 sha cast bf idea rc4 rc2 | ||
14 | do | ||
15 | echo doing $name | ||
16 | (cd crypto; tar cfh - $name)|(cd tmp; tar xf -) | ||
17 | cd tmp/$name | ||
18 | /bin/rm -f Makefile | ||
19 | /bin/rm -f Makefile.ssl | ||
20 | /bin/rm -f Makefile.ssl.orig | ||
21 | /bin/rm -f *.old | ||
22 | /bin/mv Makefile.uni Makefile | ||
23 | |||
24 | cp $cwd/util/ranlib.sh . | ||
25 | chmod +x ranlib.sh | ||
26 | |||
27 | if [ -d asm ]; then | ||
28 | mkdir asm/perlasm | ||
29 | cp $cwd/crypto/perlasm/*.pl asm/perlasm | ||
30 | fi | ||
31 | cd .. | ||
32 | tar cf - $name|gzip >$name.tgz | ||
33 | # /bin/rm -fr $name | ||
34 | cd $cwd | ||
35 | done | ||
36 | |||
37 | |||
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 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | $#ARGV == 0 || die "usage: ssldir.pl /new/path\n"; | ||
4 | @files=('crypto/cryptlib.h', | ||
5 | 'Makefile.ssl', | ||
6 | 'tools/c_rehash', | ||
7 | 'util/mk1mf.pl', | ||
8 | ); | ||
9 | |||
10 | %cryptlib=( | ||
11 | '\sX509_CERT_AREA\s',"#define X509_CERT_AREA\t\t".'"%s"', | ||
12 | '\sX509_CERT_DIR\s', "#define X509_CERT_DIR\t\t".'"%s/certs"', | ||
13 | '\sX509_CERT_FILE\s', "#define X509_CERT_FILE\t\t".'"%s/cert.pem"', | ||
14 | '\sX509_PRIVATE_DIR\s',"#define X509_PRIVATE_DIR\t".'"%s/private"', | ||
15 | ); | ||
16 | |||
17 | %Makefile_ssl=( | ||
18 | '^INSTALLTOP=','INSTALLTOP=%s', | ||
19 | ); | ||
20 | |||
21 | %c_rehash=( | ||
22 | '^DIR=', 'DIR=%s', | ||
23 | ); | ||
24 | |||
25 | %mk1mf=( | ||
26 | '^$INSTALLTOP=','$INSTALLTOP="%s";', | ||
27 | ); | ||
28 | |||
29 | &dofile("crypto/cryptlib.h",$ARGV[0],%cryptlib); | ||
30 | &dofile("Makefile.ssl",$ARGV[0],%Makefile_ssl); | ||
31 | &dofile("tools/c_rehash",$ARGV[0],%c_rehash); | ||
32 | &dofile("util/mk1mf.pl",$ARGV[0],%mk1mf); | ||
33 | |||
34 | sub dofile | ||
35 | { | ||
36 | ($f,$p,%m)=@_; | ||
37 | |||
38 | open(IN,"<$f") || die "unable to open $f:$!\n"; | ||
39 | @a=<IN>; | ||
40 | close(IN); | ||
41 | foreach $k (keys %m) | ||
42 | { | ||
43 | grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a); | ||
44 | } | ||
45 | ($ff=$f) =~ s/\..*$//; | ||
46 | open(OUT,">$ff.new") || die "unable to open $f:$!\n"; | ||
47 | print OUT @a; | ||
48 | close(OUT); | ||
49 | rename($f,"$ff.old") || die "unable to rename $f\n"; | ||
50 | rename("$ff.new",$f) || die "unable to rename $ff.new\n"; | ||
51 | } | ||
52 | |||
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 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # | ||
3 | # Up the version numbers in the files. | ||
4 | # | ||
5 | |||
6 | @files=( | ||
7 | "crypto/crypto.h", | ||
8 | "crypto/des/ecb_enc.c", | ||
9 | "crypto/idea/i_ecb.c", | ||
10 | "crypto/lhash/lhash.c", | ||
11 | "crypto/conf/conf.c", | ||
12 | "crypto/md2/md2_dgst.c", | ||
13 | "crypto/md5/md5_dgst.c", | ||
14 | "crypto/ripemd/rmd_dgst.c", | ||
15 | "crypto/pem/pem_lib.c", | ||
16 | "crypto/bn/bn_lib.c", | ||
17 | "crypto/dh/dh_lib.c", | ||
18 | "crypto/rc2/rc2_ecb.c", | ||
19 | "crypto/rc4/rc4_skey.c", | ||
20 | "crypto/rc5/rc5_ecb.c", | ||
21 | "crypto/bf/bf_ecb.c", | ||
22 | "crypto/cast/c_ecb.c", | ||
23 | "crypto/rsa/rsa_lib.c", | ||
24 | "crypto/dsa/dsa_lib.c", | ||
25 | "crypto/sha/sha1dgst.c", | ||
26 | "crypto/sha/sha_dgst.c", | ||
27 | "crypto/asn1/asn1_lib.c", | ||
28 | "crypto/x509/x509_vfy.c", | ||
29 | "crypto/evp/evp_enc.c", | ||
30 | "crypto/rand/md_rand.c", | ||
31 | "crypto/stack/stack.c", | ||
32 | "crypto/txt_db/txt_db.c", | ||
33 | "crypto/cversion.c", | ||
34 | "ssl/ssl_lib.c", | ||
35 | "ssl/s2_lib.c", | ||
36 | "ssl/s3_lib.c", | ||
37 | "ssl/t1_lib.c", | ||
38 | "README", | ||
39 | ); | ||
40 | |||
41 | @month=('Jan','Feb','Mar','Apr','May','Jun', | ||
42 | 'Jul','Aug','Sep','Oct','Nov','Dec'); | ||
43 | @a=localtime(time()); | ||
44 | $time=sprintf("%02d-%s-%04d",$a[3],$month[$a[4]],$a[5]+1900); | ||
45 | |||
46 | $ver=$ARGV[0]; | ||
47 | ($ver ne "") || die "no version number specified\n"; | ||
48 | ($a,$b,$c,$d)=unpack('axaxac',$ver); | ||
49 | $d=defined($d)?$d-96:0; | ||
50 | $xver=sprintf("%x%x%x%x",$a,$b,$c,$d); | ||
51 | |||
52 | foreach $file (@files) | ||
53 | { | ||
54 | open(IN,"<$file") || die "unable to open $file:$!\n"; | ||
55 | open(OUT,">$file.new") || die "unable to open $file.new:$!\n"; | ||
56 | $found=0; | ||
57 | |||
58 | print STDERR "$file:"; | ||
59 | |||
60 | while (<IN>) | ||
61 | { | ||
62 | if ((s/SSLeay \d\.\d.\d[^"]*(\"|\s)/SSLeay $ver $time\1/) || | ||
63 | s/^(\#define\s+SSLEAY_VERSION_NUMBER\s+0x)[0-9a-zA-Z]+(.*)$/$1$xver$2/) | ||
64 | { | ||
65 | print STDERR " Done"; | ||
66 | $found++; | ||
67 | print OUT; | ||
68 | while (<IN>) { print OUT; } | ||
69 | last; | ||
70 | } | ||
71 | print OUT; | ||
72 | } | ||
73 | print STDERR "\n"; | ||
74 | close(IN); | ||
75 | close(OUT); | ||
76 | (!$found) && die "unable to update the version number in $file\n"; | ||
77 | rename($file,"$file.old") || die "unable to rename $file:$!\n"; | ||
78 | rename("$file.new",$file) || die "unable to rename $file.new:$!\n"; | ||
79 | } | ||
diff --git a/src/lib/libcrypto/x509/Makefile.ssl b/src/lib/libcrypto/x509/Makefile.ssl new file mode 100644 index 0000000000..1c1ca2ffa0 --- /dev/null +++ b/src/lib/libcrypto/x509/Makefile.ssl | |||
@@ -0,0 +1,96 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/x509/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= x509 | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALLTOP=/usr/local/ssl | ||
11 | MAKE= make -f Makefile.ssl | ||
12 | MAKEDEPEND= makedepend -f Makefile.ssl | ||
13 | MAKEFILE= Makefile.ssl | ||
14 | AR= ar r | ||
15 | |||
16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
17 | |||
18 | ERR=x509 | ||
19 | ERRC=x509_err | ||
20 | GENERAL=Makefile README | ||
21 | TEST= | ||
22 | APPS= | ||
23 | |||
24 | LIB=$(TOP)/libcrypto.a | ||
25 | LIBSRC= x509_def.c x509_d2.c x509_r2x.c x509_cmp.c \ | ||
26 | x509_obj.c x509_req.c x509_vfy.c \ | ||
27 | x509_set.c x509rset.c $(ERRC).c \ | ||
28 | x509name.c x509_v3.c x509_ext.c x509pack.c \ | ||
29 | x509type.c x509_lu.c x_all.c x509_txt.c \ | ||
30 | by_file.c by_dir.c \ | ||
31 | v3_net.c v3_x509.c | ||
32 | LIBOBJ= x509_def.o x509_d2.o x509_r2x.o x509_cmp.o \ | ||
33 | x509_obj.o x509_req.o x509_vfy.o \ | ||
34 | x509_set.o x509rset.o $(ERRC).o \ | ||
35 | x509name.o x509_v3.o x509_ext.o x509pack.o \ | ||
36 | x509type.o x509_lu.o x_all.o x509_txt.o \ | ||
37 | by_file.o by_dir.o \ | ||
38 | v3_net.o v3_x509.o | ||
39 | |||
40 | SRC= $(LIBSRC) | ||
41 | |||
42 | EXHEADER= x509.h x509_vfy.h | ||
43 | HEADER= $(EXHEADER) | ||
44 | |||
45 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
46 | |||
47 | top: | ||
48 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
49 | |||
50 | all: lib | ||
51 | |||
52 | lib: $(LIBOBJ) | ||
53 | $(AR) $(LIB) $(LIBOBJ) | ||
54 | sh $(TOP)/util/ranlib.sh $(LIB) | ||
55 | @touch lib | ||
56 | |||
57 | files: | ||
58 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
59 | |||
60 | links: | ||
61 | /bin/rm -f Makefile | ||
62 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
63 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | ||
64 | $(TOP)/util/mklink.sh ../../test $(TEST) | ||
65 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
66 | |||
67 | install: | ||
68 | @for i in $(EXHEADER) ; \ | ||
69 | do \ | ||
70 | (cp $$i $(INSTALLTOP)/include/$$i; \ | ||
71 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | ||
72 | done; | ||
73 | |||
74 | tags: | ||
75 | ctags $(SRC) | ||
76 | |||
77 | tests: | ||
78 | |||
79 | lint: | ||
80 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
81 | |||
82 | depend: | ||
83 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
84 | |||
85 | dclean: | ||
86 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
87 | mv -f Makefile.new $(MAKEFILE) | ||
88 | |||
89 | clean: | ||
90 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
91 | |||
92 | errors: | ||
93 | perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h | ||
94 | perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c | ||
95 | |||
96 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
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 @@ | |||
1 | |||
2 | PKCS7 | ||
3 | STACK of X509_ATTRIBUTES | ||
4 | ASN1_OBJECT | ||
5 | STACK of ASN1_TYPE | ||
6 | |||
7 | So it is | ||
8 | |||
9 | p7.xa[].obj | ||
10 | p7.xa[].data[] | ||
11 | |||
12 | get_obj_by_nid(STACK , nid) | ||
13 | get_num_by_nid(STACK , nid) | ||
14 | get_data_by_nid(STACK , nid, index) | ||
15 | |||
16 | X509_ATTRIBUTE *X509_ATTRIBUTE_new(void ); | ||
17 | void X509_ATTRIBUTE_free(X509_ATTRIBUTE *a); | ||
18 | |||
19 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **ex, | ||
20 | int nid, STACK *value); | ||
21 | |||
22 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **ex, | ||
23 | int nid, STACK *value); | ||
24 | |||
25 | int X509_ATTRIBUTE_set_object(X509_ATTRIBUTE *ex,ASN1_OBJECT *obj); | ||
26 | int X509_ATTRIBUTE_add_data(X509_ATTRIBUTE *ex, int index, | ||
27 | ASN1_TYPE *value); | ||
28 | |||
29 | ASN1_OBJECT * X509_ATTRIBUTE_get_object(X509_ATTRIBUTE *ex); | ||
30 | int X509_ATTRIBUTE_get_num(X509_ATTRIBUTE *ne); | ||
31 | ASN1_TYPE * X509_ATTRIBUTE_get_data(X509_ATTRIBUTE *ne,int index); | ||
32 | |||
33 | ASN1_TYPE * X509_ATTRIBUTE_get_data_by_NID(X509_ATTRIBUTE *ne, | ||
34 | ASN1_OBJECT *obj); | ||
35 | |||
36 | X509_ATTRUBUTE *PKCS7_get_s_att_by_NID(PKCS7 *p7,int nid); | ||
37 | X509_ATTRUBUTE *PKCS7_get_u_att_by_NID(PKCS7 *p7,int nid); | ||
38 | |||
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 @@ | |||
1 | /* crypto/x509/v3_net.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "stack.h" | ||
61 | #include "cryptlib.h" | ||
62 | #include "asn1.h" | ||
63 | #include "objects.h" | ||
64 | #include "x509.h" | ||
65 | |||
66 | #define NETSCAPE_X509_EXT_NUM 8 | ||
67 | |||
68 | static X509_EXTENSION_METHOD netscape_x509_ext[NETSCAPE_X509_EXT_NUM]={ | ||
69 | {NID_netscape_ca_policy_url, V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, | ||
70 | {NID_netscape_ssl_server_name, V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, | ||
71 | {NID_netscape_revocation_url, V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, | ||
72 | {NID_netscape_base_url,V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, | ||
73 | {NID_netscape_cert_type,V_ASN1_BIT_STRING,X509_EXT_PACK_STRING}, | ||
74 | {NID_netscape_ca_revocation_url,V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, | ||
75 | {NID_netscape_renewal_url,V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, | ||
76 | {NID_netscape_comment,V_ASN1_IA5STRING,X509_EXT_PACK_STRING}, | ||
77 | }; | ||
78 | |||
79 | int X509v3_add_netscape_extensions() | ||
80 | { | ||
81 | int i; | ||
82 | |||
83 | for (i=0; i<NETSCAPE_X509_EXT_NUM; i++) | ||
84 | if (!X509v3_add_extension(&(netscape_x509_ext[i]))) | ||
85 | return(0); | ||
86 | return(1); | ||
87 | } | ||
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 @@ | |||
1 | /* crypto/x509/v3_x509.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include <ctype.h> | ||
61 | #include "stack.h" | ||
62 | #include "cryptlib.h" | ||
63 | #include "bio.h" | ||
64 | #include "asn1.h" | ||
65 | #include "objects.h" | ||
66 | #include "x509.h" | ||
67 | |||
68 | #if 0 | ||
69 | static int i2a_key_usage(BIO *bp, X509 *x); | ||
70 | static int a2i_key_usage(X509 *x, char *str, int len); | ||
71 | #endif | ||
72 | |||
73 | int X509v3_get_key_usage(X509 *x); | ||
74 | int X509v3_set_key_usage(X509 *x,unsigned int use); | ||
75 | int i2a_X509v3_key_usage(BIO *bp, unsigned int use); | ||
76 | unsigned int a2i_X509v3_key_usage(char *p); | ||
77 | |||
78 | #define STD_X509_EXT_NUM 9 | ||
79 | |||
80 | #if 0 | ||
81 | static X509_OBJECTS std_x509_ext[STD_X509_EXT_NUM]={ | ||
82 | {NID_subject_key_identifier, NULL,NULL}, | ||
83 | {NID_key_usage, a2i_key_usage,i2a_key_usage}, /**/ | ||
84 | {NID_private_key_usage_period, NULL,NULL}, | ||
85 | {NID_subject_alt_name, NULL,NULL}, | ||
86 | {NID_issuer_alt_name, NULL,NULL}, | ||
87 | {NID_basic_constraints, NULL,NULL}, | ||
88 | {NID_crl_number, NULL,NULL}, | ||
89 | {NID_certificate_policies, NULL,NULL}, | ||
90 | {NID_authority_key_identifier, NULL,NULL}, | ||
91 | }; | ||
92 | #endif | ||
93 | |||
94 | int X509v3_add_standard_extensions() | ||
95 | { | ||
96 | |||
97 | #if 0 | ||
98 | for (i=0; i<STD_X509_EXT_NUM; i++) | ||
99 | if (!X509v3_add_extension(&(std_x509_ext[i]))) | ||
100 | return(0); | ||
101 | #endif | ||
102 | return(1); | ||
103 | } | ||
104 | |||
105 | int X509v3_get_key_usage(x) | ||
106 | X509 *x; | ||
107 | { | ||
108 | X509_EXTENSION *ext; | ||
109 | ASN1_STRING *st; | ||
110 | char *p; | ||
111 | int i; | ||
112 | |||
113 | i=X509_get_ext_by_NID(x,NID_key_usage,-1); | ||
114 | if (i < 0) return(X509v3_KU_UNDEF); | ||
115 | ext=X509_get_ext(x,i); | ||
116 | st=X509v3_unpack_string(NULL,V_ASN1_BIT_STRING, | ||
117 | X509_EXTENSION_get_data(X509_get_ext(x,i))); | ||
118 | |||
119 | p=(char *)ASN1_STRING_data(st); | ||
120 | if (ASN1_STRING_length(st) == 1) | ||
121 | i=p[0]; | ||
122 | else if (ASN1_STRING_length(st) == 2) | ||
123 | i=p[0]|(p[1]<<8); | ||
124 | else | ||
125 | i=0; | ||
126 | return(i); | ||
127 | } | ||
128 | |||
129 | static struct | ||
130 | { | ||
131 | char *name; | ||
132 | unsigned int value; | ||
133 | } key_usage_data[] ={ | ||
134 | {"digitalSignature", X509v3_KU_DIGITAL_SIGNATURE}, | ||
135 | {"nonRepudiation", X509v3_KU_NON_REPUDIATION}, | ||
136 | {"keyEncipherment", X509v3_KU_KEY_ENCIPHERMENT}, | ||
137 | {"dataEncipherment", X509v3_KU_DATA_ENCIPHERMENT}, | ||
138 | {"keyAgreement", X509v3_KU_KEY_AGREEMENT}, | ||
139 | {"keyCertSign", X509v3_KU_KEY_CERT_SIGN}, | ||
140 | {"cRLSign", X509v3_KU_CRL_SIGN}, | ||
141 | {"encipherOnly", X509v3_KU_ENCIPHER_ONLY}, | ||
142 | {"decipherOnly", X509v3_KU_DECIPHER_ONLY}, | ||
143 | {NULL,0}, | ||
144 | }; | ||
145 | |||
146 | #if 0 | ||
147 | static int a2i_key_usage(x,str,len) | ||
148 | X509 *x; | ||
149 | char *str; | ||
150 | int len; | ||
151 | { | ||
152 | return(X509v3_set_key_usage(x,a2i_X509v3_key_usage(str))); | ||
153 | } | ||
154 | |||
155 | static int i2a_key_usage(bp,x) | ||
156 | BIO *bp; | ||
157 | X509 *x; | ||
158 | { | ||
159 | return(i2a_X509v3_key_usage(bp,X509v3_get_key_usage(x))); | ||
160 | } | ||
161 | #endif | ||
162 | |||
163 | int i2a_X509v3_key_usage(bp,use) | ||
164 | BIO *bp; | ||
165 | unsigned int use; | ||
166 | { | ||
167 | int i=0,first=1; | ||
168 | |||
169 | for (;;) | ||
170 | { | ||
171 | if (use | key_usage_data[i].value) | ||
172 | { | ||
173 | BIO_printf(bp,"%s%s",((first)?"":" "), | ||
174 | key_usage_data[i].name); | ||
175 | first=0; | ||
176 | } | ||
177 | } | ||
178 | return(1); | ||
179 | } | ||
180 | |||
181 | unsigned int a2i_X509v3_key_usage(p) | ||
182 | char *p; | ||
183 | { | ||
184 | unsigned int ret=0; | ||
185 | char *q,*s; | ||
186 | int i,n; | ||
187 | |||
188 | q=p; | ||
189 | for (;;) | ||
190 | { | ||
191 | while ((*q != '\0') && isalnum(*q)) | ||
192 | q++; | ||
193 | if (*q == '\0') break; | ||
194 | s=q++; | ||
195 | while (isalnum(*q)) | ||
196 | q++; | ||
197 | n=q-s; | ||
198 | i=0; | ||
199 | for (;;) | ||
200 | { | ||
201 | if (strncmp(key_usage_data[i].name,s,n) == 0) | ||
202 | { | ||
203 | ret|=key_usage_data[i].value; | ||
204 | break; | ||
205 | } | ||
206 | i++; | ||
207 | if (key_usage_data[i].name == NULL) | ||
208 | return(X509v3_KU_UNDEF); | ||
209 | } | ||
210 | } | ||
211 | return(ret); | ||
212 | } | ||
213 | |||
214 | int X509v3_set_key_usage(x,use) | ||
215 | X509 *x; | ||
216 | unsigned int use; | ||
217 | { | ||
218 | ASN1_OCTET_STRING *os; | ||
219 | X509_EXTENSION *ext; | ||
220 | int i; | ||
221 | unsigned char data[4]; | ||
222 | |||
223 | i=X509_get_ext_by_NID(x,NID_key_usage,-1); | ||
224 | if (i < 0) | ||
225 | { | ||
226 | i=X509_get_ext_count(x)+1; | ||
227 | if ((ext=X509_EXTENSION_new()) == NULL) return(0); | ||
228 | if (!X509_add_ext(x,ext,i)) | ||
229 | { | ||
230 | X509_EXTENSION_free(ext); | ||
231 | return(0); | ||
232 | } | ||
233 | } | ||
234 | else | ||
235 | ext=X509_get_ext(x,i); | ||
236 | |||
237 | /* fill in 'ext' */ | ||
238 | os=X509_EXTENSION_get_data(ext); | ||
239 | |||
240 | i=0; | ||
241 | if (use > 0) | ||
242 | { | ||
243 | i=1; | ||
244 | data[0]=use&0xff; | ||
245 | } | ||
246 | if (use > 0xff) | ||
247 | { | ||
248 | i=2; | ||
249 | data[1]=(use>>8)&0xff; | ||
250 | } | ||
251 | return((X509v3_pack_string(&os,V_ASN1_BIT_STRING,data,i) == NULL)?0:1); | ||
252 | } | ||
253 | |||
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 @@ | |||
1 | X509_verify() | ||
2 | X509_sign() | ||
3 | |||
4 | X509_get_version() | ||
5 | X509_get_serialNumber() | ||
6 | X509_get_issuer() | ||
7 | X509_get_subject() | ||
8 | X509_get_notBefore() | ||
9 | X509_get_notAfter() | ||
10 | X509_get_pubkey() | ||
11 | |||
12 | X509_set_version() | ||
13 | X509_set_serialNumber() | ||
14 | X509_set_issuer() | ||
15 | X509_set_subject() | ||
16 | X509_set_notBefore() | ||
17 | X509_set_notAfter() | ||
18 | X509_set_pubkey() | ||
19 | |||
20 | X509_get_extensions() | ||
21 | X509_set_extensions() | ||
22 | |||
23 | X509_EXTENSIONS_clear() | ||
24 | X509_EXTENSIONS_retrieve() | ||
25 | X509_EXTENSIONS_add() | ||
26 | X509_EXTENSIONS_delete() | ||
27 | |||
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 @@ | |||
1 | /* Error codes for the X509 functions. */ | ||
2 | |||
3 | /* Function codes. */ | ||
4 | #define X509_F_ADD_CERT_DIR 100 | ||
5 | #define X509_F_BY_FILE_CTRL 101 | ||
6 | #define X509_F_DIR_CTRL 102 | ||
7 | #define X509_F_GET_CERT_BY_SUBJECT 103 | ||
8 | #define X509_F_X509V3_ADD_EXT 104 | ||
9 | #define X509_F_X509V3_ADD_EXTENSION 105 | ||
10 | #define X509_F_X509V3_PACK_STRING 106 | ||
11 | #define X509_F_X509V3_UNPACK_STRING 107 | ||
12 | #define X509_F_X509_EXTENSION_CREATE_BY_NID 108 | ||
13 | #define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 | ||
14 | #define X509_F_X509_GET_PUBKEY_PARAMETERS 110 | ||
15 | #define X509_F_X509_LOAD_CERT_FILE 111 | ||
16 | #define X509_F_X509_LOAD_CRL_FILE 112 | ||
17 | #define X509_F_X509_NAME_ADD_ENTRY 113 | ||
18 | #define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 | ||
19 | #define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 | ||
20 | #define X509_F_X509_NAME_ONELINE 116 | ||
21 | #define X509_F_X509_NAME_PRINT 117 | ||
22 | #define X509_F_X509_PRINT_FP 118 | ||
23 | #define X509_F_X509_PUBKEY_GET 119 | ||
24 | #define X509_F_X509_PUBKEY_SET 120 | ||
25 | #define X509_F_X509_REQ_PRINT 121 | ||
26 | #define X509_F_X509_REQ_PRINT_FP 122 | ||
27 | #define X509_F_X509_REQ_TO_X509 123 | ||
28 | #define X509_F_X509_STORE_ADD_CERT 124 | ||
29 | #define X509_F_X509_STORE_ADD_CRL 125 | ||
30 | #define X509_F_X509_TO_X509_REQ 126 | ||
31 | #define X509_F_X509_VERIFY_CERT 127 | ||
32 | |||
33 | /* Reason codes. */ | ||
34 | #define X509_R_BAD_X509_FILETYPE 100 | ||
35 | #define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 | ||
36 | #define X509_R_ERR_ASN1_LIB 102 | ||
37 | #define X509_R_LOADING_CERT_DIR 103 | ||
38 | #define X509_R_LOADING_DEFAULTS 104 | ||
39 | #define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 | ||
40 | #define X509_R_SHOULD_RETRY 106 | ||
41 | #define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 | ||
42 | #define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 | ||
43 | #define X509_R_UNKNOWN_NID 109 | ||
44 | #define X509_R_UNKNOWN_STRING_TYPE 110 | ||
45 | #define X509_R_UNSUPPORTED_ALGORITHM 111 | ||
46 | #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 @@ | |||
1 | /* crypto/x509/x509pack.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include "stack.h" | ||
61 | #include "cryptlib.h" | ||
62 | #include "asn1.h" | ||
63 | #include "objects.h" | ||
64 | #include "evp.h" | ||
65 | #include "x509.h" | ||
66 | |||
67 | ASN1_OCTET_STRING *X509v3_pack_string(ex,type,bytes,len) | ||
68 | ASN1_OCTET_STRING **ex; | ||
69 | int type; | ||
70 | unsigned char *bytes; | ||
71 | int len; | ||
72 | { | ||
73 | ASN1_OCTET_STRING *os; | ||
74 | ASN1_STRING str; | ||
75 | unsigned char *p; | ||
76 | int i; | ||
77 | |||
78 | if ((ex == NULL) || (*ex == NULL)) | ||
79 | os=ASN1_OCTET_STRING_new(); | ||
80 | else | ||
81 | os= *ex; | ||
82 | |||
83 | if (len < 0) len=strlen((char *)bytes); | ||
84 | str.length=len; | ||
85 | str.type=type; | ||
86 | str.data=bytes; | ||
87 | |||
88 | /* str now holds the data, we just have to copy it into ->value */ | ||
89 | |||
90 | switch (type) | ||
91 | { | ||
92 | case V_ASN1_BIT_STRING: | ||
93 | i=i2d_ASN1_BIT_STRING((ASN1_BIT_STRING *)&str,NULL); | ||
94 | if (!ASN1_STRING_set((ASN1_STRING *)os,NULL,i)) | ||
95 | goto err; | ||
96 | p=(unsigned char *)os->data; | ||
97 | i2d_ASN1_BIT_STRING((ASN1_BIT_STRING *)&str,&p); | ||
98 | break; | ||
99 | case V_ASN1_OCTET_STRING: | ||
100 | i=i2d_ASN1_OCTET_STRING((ASN1_OCTET_STRING *)&str,NULL); | ||
101 | if (!ASN1_STRING_set((ASN1_STRING *)os,NULL,i)) | ||
102 | goto err; | ||
103 | p=(unsigned char *)os->data; | ||
104 | i2d_ASN1_OCTET_STRING((ASN1_OCTET_STRING *)&str,&p); | ||
105 | break; | ||
106 | case V_ASN1_IA5STRING: | ||
107 | case V_ASN1_PRINTABLESTRING: | ||
108 | case V_ASN1_T61STRING: | ||
109 | i=i2d_ASN1_bytes(&str,NULL,type,V_ASN1_UNIVERSAL); | ||
110 | if (!ASN1_STRING_set((ASN1_STRING *)os,NULL,i)) | ||
111 | goto err; | ||
112 | p=(unsigned char *)os->data; | ||
113 | i=i2d_ASN1_bytes(&str,&p,type,V_ASN1_UNIVERSAL); | ||
114 | break; | ||
115 | default: | ||
116 | X509err(X509_F_X509V3_PACK_STRING,X509_R_UNKNOWN_STRING_TYPE); | ||
117 | goto err; | ||
118 | } | ||
119 | os->length=i; | ||
120 | |||
121 | if ((ex != NULL) && (os != *ex)) | ||
122 | *ex=os; | ||
123 | return(os); | ||
124 | err: | ||
125 | return(NULL); | ||
126 | } | ||
127 | |||
128 | ASN1_STRING *X509v3_unpack_string(ex,type,os) | ||
129 | ASN1_STRING **ex; | ||
130 | int type; | ||
131 | ASN1_OCTET_STRING *os; | ||
132 | { | ||
133 | unsigned char *p; | ||
134 | ASN1_STRING *ret=NULL; | ||
135 | |||
136 | p=os->data; | ||
137 | switch (type) | ||
138 | { | ||
139 | case V_ASN1_BIT_STRING: | ||
140 | ret=(ASN1_STRING *)d2i_ASN1_BIT_STRING( | ||
141 | (ASN1_BIT_STRING **)ex,&p,os->length); | ||
142 | break; | ||
143 | case V_ASN1_OCTET_STRING: | ||
144 | ret=(ASN1_STRING *)d2i_ASN1_OCTET_STRING( | ||
145 | (ASN1_BIT_STRING **)ex,&p,os->length); | ||
146 | break; | ||
147 | case V_ASN1_IA5STRING: | ||
148 | case V_ASN1_PRINTABLESTRING: | ||
149 | case V_ASN1_T61STRING: | ||
150 | ret=(ASN1_STRING *)d2i_ASN1_PRINTABLE(ex,&p,os->length); | ||
151 | break; | ||
152 | default: | ||
153 | X509err(X509_F_X509V3_UNPACK_STRING,X509_R_UNKNOWN_STRING_TYPE); | ||
154 | } | ||
155 | return(ret); | ||
156 | } | ||
157 | |||
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 @@ | |||
1 | The 'new' system. | ||
2 | |||
3 | The X509_EXTENSION_METHOD includes extensions and attributes and/or names. | ||
4 | Basically everthing that can be added to an X509 with an OID identifying it. | ||
5 | |||
6 | It operates via 2 methods per object id. | ||
7 | int a2i_XXX(X509 *x,char *str,int len); | ||
8 | int i2a_XXX(BIO *bp,X509 *x); | ||
9 | |||
10 | The a2i_XXX function will add the object with a value converted from the | ||
11 | string into the X509. Len can be -1 in which case the length is calculated | ||
12 | via strlen(str). Applications can always use direct knowledge to load and | ||
13 | unload the relevent objects themselves. | ||
14 | |||
15 | i2a_XXX will print to the passed BIO, a text representation of the | ||
16 | relevet object. Use a memory BIO if you want it printed to a buffer :-). | ||
17 | |||
18 | X509_add_by_NID(X509 *x,int nid,char *str,int len); | ||
19 | X509_add_by_OBJ(X509 *x,ASN1_OBJECT *obj,char *str,int len); | ||
20 | |||
21 | X509_print_by_name(BIO *bp,X509 *x); | ||
22 | X509_print_by_NID(BIO *bp,X509 *x); | ||
23 | X509_print_by_OBJ(BIO *bp,X509 *x); | ||
24 | |||
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 @@ | |||
1 | AuthorityKeyIdentifier | ||
2 | { | ||
3 | keyIdentifier [0] OCTET_STRING OPTIONAL | ||
4 | authorityCertIssuer [1] GeneralNames OPTIONAL | ||
5 | authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL | ||
6 | } | ||
7 | |||
8 | SubjectKeyIdentifier OCTET_STRING | ||
9 | |||
10 | KeyUsage | ||
11 | { | ||
12 | BIT_STRING | ||
13 | digitalSignature 0 | ||
14 | nonRepudiation 1 | ||
15 | keyEncipherment 2 | ||
16 | dataEncipherment 3 | ||
17 | keyAgreement 4 | ||
18 | keyCertSign 5 | ||
19 | cRLSign 6 | ||
20 | encipherOnly 7 | ||
21 | decipherOnly 8 | ||
22 | } | ||
23 | |||
24 | extKeyUsage | ||
25 | { | ||
26 | SEQUENCE of OBJECT_IDENTIFIER | ||
27 | } | ||
28 | |||
29 | privateKeyUsagePeriod | ||
30 | { | ||
31 | notBefore [0] GeneralizedTime OPTIONAL | ||
32 | notAfter [1] GeneralizedTime OPTIONAL | ||
33 | } | ||
34 | |||
35 | certificatePoliciesSyntax | ||
36 | SEQUENCE of PoliciesInformation | ||
37 | |||
38 | PoliciesInformation XXX | ||
39 | policyMappings XXX | ||
40 | supportedAlgorithms XXX | ||
41 | |||
42 | subjectAltName | ||
43 | GeneralNames sequence of GeneralName | ||
44 | |||
45 | GeneralName | ||
46 | { | ||
47 | otherName [0] INSTANCE OF OTHER-NAME | ||
48 | rfc882Name [1] IA5String | ||
49 | dNSName [2] IA5String | ||
50 | x400Address [3] ORAddress | ||
51 | directoryName [4] Name | ||
52 | ediPartyName [5] | ||
53 | { | ||
54 | nameAssigner [0] DirectoryString OPTIONAL | ||
55 | partyName [1] DirectoryString | ||
56 | } | ||
57 | uniformResourceIdentifier [6] IA5String | ||
58 | iPAddress [7] OCTET_STRING | ||
59 | registeredID [8] OBJECT_IDENTIFIER | ||
60 | } | ||
61 | |||
62 | issuerAltName | ||
63 | GeneralNames sequence of GeneralName | ||
64 | |||
65 | subjectDirectoryAttribute SEQUENCE of Attribute | ||
66 | |||
67 | basicConstraints | ||
68 | { | ||
69 | cA BOOLEAN default FALSE | ||
70 | pathLenConstraint INTEGER OPTIONAL | ||
71 | } | ||
72 | |||
73 | nameConstraints | ||
74 | { | ||
75 | permittedSubtrees [0] sequence of GeneralSubtree OPTIONAL | ||
76 | excludedSubtrees [1] sequence of GeneralSubtree OPTIONAL | ||
77 | } | ||
78 | |||
79 | GeneralSubtree | ||
80 | { | ||
81 | base GeneralName | ||
82 | minimum [0] BaseDistance DEFAULT 0 | ||
83 | maximum [1] BaseDistance OPTIONAL | ||
84 | } | ||
85 | |||
86 | PolicyConstraints | ||
87 | { | ||
88 | requiredExplicitPolicy [0] SkipCerts OPTIONAL | ||
89 | inhibitPolicyMapping [1] SkipCerts OPTIONAL | ||
90 | } | ||
91 | SkipCerts == INTEGER | ||
92 | |||
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 @@ | |||
1 | int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size) | ||
2 | int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a) | ||
3 | int i2d_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp) | ||
4 | ASN1_INTEGER * d2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp,long length) | ||
5 | |||
6 | |||
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 @@ | |||
1 | /* crypto/x509v3/v3_ku.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include <ctype.h> | ||
61 | #include "stack.h" | ||
62 | #include "cryptlib.h" | ||
63 | #include "bio.h" | ||
64 | #include "asn1.h" | ||
65 | #include "objects.h" | ||
66 | #include "x509.h" | ||
67 | |||
68 | X509_EXTENSION_METHOD X509v3_key_usage_method= | ||
69 | { | ||
70 | NID_key_usage, | ||
71 | ku_clear, | ||
72 | ex_get_bool, | ||
73 | ex_set_bool, | ||
74 | NULL, | ||
75 | NULL, | ||
76 | NULL, | ||
77 | NULL, | ||
78 | ku_a2i, | ||
79 | ku_i2a, | ||
80 | }; | ||
81 | |||
82 | static void ku_clear(a) | ||
83 | X509_EXTENSION *a; | ||
84 | { | ||
85 | } | ||
86 | |||
87 | static int ku_expand(a) | ||
88 | X509_EXTENSION *a; | ||
89 | { | ||
90 | ASN1_BIT_STRING *bs; | ||
91 | |||
92 | if (a->argp == NULL) | ||
93 | { | ||
94 | bs=X509v3_unpack_string(NULL,V_ASN1_BIT_STRING,value); | ||
95 | if (bs == NULL) return(0); | ||
96 | a->argp=(char *)bs; | ||
97 | a->ex_free=ASN1_STRING_free; | ||
98 | } | ||
99 | return(1); | ||
100 | } | ||
101 | |||
102 | static int ku_get_bool(a,num) | ||
103 | X509_EXTENSION *a; | ||
104 | int num; | ||
105 | { | ||
106 | int ret; | ||
107 | ASN1_BIT_STRING *bs; | ||
108 | |||
109 | if ((a->argp == NULL) && !ku_expand(a)) | ||
110 | return(-1); | ||
111 | bs=(ASN1_BIT_STRING *)a->argp; | ||
112 | ret=ASN1_BIT_STRING_get_bit(bs,num); | ||
113 | return(ret); | ||
114 | } | ||
115 | |||
116 | static int ku_set_bool(a,num,value) | ||
117 | X509_EXTENSION *a; | ||
118 | int num; | ||
119 | int value; | ||
120 | { | ||
121 | ASN1_BIT_STRING *a; | ||
122 | |||
123 | if ((a->argp == NULL) && !ku_expand(a)) | ||
124 | return(0); | ||
125 | bs=(ASN1_BIT_STRING *)a->argp; | ||
126 | ret=ASN1_BIT_STRING_set_bit(bs,num,value); | ||
127 | } | ||
128 | |||
129 | static int ku_a2i(bio,a,buf,len) | ||
130 | BIO *bio; | ||
131 | X509_EXTENSION *a; | ||
132 | char *buf; | ||
133 | int len; | ||
134 | { | ||
135 | get token | ||
136 | } | ||
137 | |||
138 | static char ku_names[X509v3_N_KU_NUM]={ | ||
139 | X509v3_S_KU_digitalSignature, | ||
140 | X509v3_S_KU_nonRepudiation, | ||
141 | X509v3_S_KU_keyEncipherment, | ||
142 | X509v3_S_KU_dataEncipherment, | ||
143 | X509v3_S_KU_keyAgreement, | ||
144 | X509v3_S_KU_keyCertSign, | ||
145 | X509v3_S_KU_cRLSign, | ||
146 | X509v3_S_KU_encipherOnly, | ||
147 | X509v3_S_KU_decipherOnly, | ||
148 | }; | ||
149 | |||
150 | static int ku_i2a(bio,a); | ||
151 | BIO *bio; | ||
152 | X509_EXTENSION *a; | ||
153 | { | ||
154 | int i,first=1; | ||
155 | char *c; | ||
156 | |||
157 | for (i=0; i<X509v3_N_KU_NUM; i++) | ||
158 | { | ||
159 | if (ku_get_bool(a,i) > 0) | ||
160 | { | ||
161 | BIO_printf(bio,"%s%s",((first)?"":" "),ku_names[i]); | ||
162 | first=0; | ||
163 | } | ||
164 | } | ||
165 | } | ||
166 | |||
167 | /***********************/ | ||
168 | |||
169 | int X509v3_get_key_usage(x,ret) | ||
170 | STACK *x; | ||
171 | unsigned long *ret; | ||
172 | { | ||
173 | X509_EXTENSION *ext; | ||
174 | ASN1_STRING *st; | ||
175 | char *p; | ||
176 | int i; | ||
177 | |||
178 | i=X509_get_ext_by_NID(x,NID_key_usage,-1); | ||
179 | if (i < 0) return(X509v3_KU_UNDEF); | ||
180 | ext=X509_get_ext(x,i); | ||
181 | st=X509v3_unpack_string(NULL,V_ASN1_BIT_STRING, | ||
182 | X509_EXTENSION_get_data(X509_get_ext(x,i))); | ||
183 | |||
184 | p=ASN1_STRING_data(st); | ||
185 | if (ASN1_STRING_length(st) == 1) | ||
186 | i=p[0]; | ||
187 | else if (ASN1_STRING_length(st) == 2) | ||
188 | i=p[0]|(p[1]<<8); | ||
189 | else | ||
190 | i=0; | ||
191 | return(i); | ||
192 | } | ||
193 | |||
194 | static struct | ||
195 | { | ||
196 | char *name; | ||
197 | unsigned int value; | ||
198 | } key_usage_data[] ={ | ||
199 | {"digitalSignature", X509v3_KU_DIGITAL_SIGNATURE}, | ||
200 | {"nonRepudiation", X509v3_KU_NON_REPUDIATION}, | ||
201 | {"keyEncipherment", X509v3_KU_KEY_ENCIPHERMENT}, | ||
202 | {"dataEncipherment", X509v3_KU_DATA_ENCIPHERMENT}, | ||
203 | {"keyAgreement", X509v3_KU_KEY_AGREEMENT}, | ||
204 | {"keyCertSign", X509v3_KU_KEY_CERT_SIGN}, | ||
205 | {"cRLSign", X509v3_KU_CRL_SIGN}, | ||
206 | {"encipherOnly", X509v3_KU_ENCIPHER_ONLY}, | ||
207 | {"decipherOnly", X509v3_KU_DECIPHER_ONLY}, | ||
208 | {NULL,0}, | ||
209 | }; | ||
210 | |||
211 | #if 0 | ||
212 | static int a2i_key_usage(x,str,len) | ||
213 | X509 *x; | ||
214 | char *str; | ||
215 | int len; | ||
216 | { | ||
217 | return(X509v3_set_key_usage(x,a2i_X509v3_key_usage(str))); | ||
218 | } | ||
219 | |||
220 | static int i2a_key_usage(bp,x) | ||
221 | BIO *bp; | ||
222 | X509 *x; | ||
223 | { | ||
224 | return(i2a_X509v3_key_usage(bp,X509v3_get_key_usage(x))); | ||
225 | } | ||
226 | #endif | ||
227 | |||
228 | int i2a_X509v3_key_usage(bp,use) | ||
229 | BIO *bp; | ||
230 | unsigned int use; | ||
231 | { | ||
232 | int i=0,first=1; | ||
233 | |||
234 | for (;;) | ||
235 | { | ||
236 | if (use | key_usage_data[i].value) | ||
237 | { | ||
238 | BIO_printf(bp,"%s%s",((first)?"":" "), | ||
239 | key_usage_data[i].name); | ||
240 | first=0; | ||
241 | } | ||
242 | } | ||
243 | return(1); | ||
244 | } | ||
245 | |||
246 | unsigned int a2i_X509v3_key_usage(p) | ||
247 | char *p; | ||
248 | { | ||
249 | unsigned int ret=0; | ||
250 | char *q,*s; | ||
251 | int i,n; | ||
252 | |||
253 | q=p; | ||
254 | for (;;) | ||
255 | { | ||
256 | while ((*q != '\0') && isalnum(*q)) | ||
257 | q++; | ||
258 | if (*q == '\0') break; | ||
259 | s=q++; | ||
260 | while (isalnum(*q)) | ||
261 | q++; | ||
262 | n=q-s; | ||
263 | i=0; | ||
264 | for (;;) | ||
265 | { | ||
266 | if (strncmp(key_usage_data[i].name,s,n) == 0) | ||
267 | { | ||
268 | ret|=key_usage_data[i].value; | ||
269 | break; | ||
270 | } | ||
271 | i++; | ||
272 | if (key_usage_data[i].name == NULL) | ||
273 | return(X509v3_KU_UNDEF); | ||
274 | } | ||
275 | } | ||
276 | return(ret); | ||
277 | } | ||
278 | |||
279 | int X509v3_set_key_usage(x,use) | ||
280 | X509 *x; | ||
281 | unsigned int use; | ||
282 | { | ||
283 | ASN1_OCTET_STRING *os; | ||
284 | X509_EXTENSION *ext; | ||
285 | int i; | ||
286 | unsigned char data[4]; | ||
287 | |||
288 | i=X509_get_ext_by_NID(x,NID_key_usage,-1); | ||
289 | if (i < 0) | ||
290 | { | ||
291 | i=X509_get_ext_count(x)+1; | ||
292 | if ((ext=X509_EXTENSION_new()) == NULL) return(0); | ||
293 | if (!X509_add_ext(x,ext,i)) | ||
294 | { | ||
295 | X509_EXTENSION_free(ext); | ||
296 | return(0); | ||
297 | } | ||
298 | } | ||
299 | else | ||
300 | ext=X509_get_ext(x,i); | ||
301 | |||
302 | /* fill in 'ext' */ | ||
303 | os=X509_EXTENSION_get_data(ext); | ||
304 | |||
305 | i=0; | ||
306 | if (use > 0) | ||
307 | { | ||
308 | i=1; | ||
309 | data[0]=use&0xff; | ||
310 | } | ||
311 | if (use > 0xff) | ||
312 | { | ||
313 | i=2; | ||
314 | data[1]=(use>>8)&0xff; | ||
315 | } | ||
316 | return((X509v3_pack_string(&os,V_ASN1_BIT_STRING,data,i) == NULL)?0:1); | ||
317 | } | ||
318 | |||