From b608c7f2b175e121f2c22d53341a317153afdc8e Mon Sep 17 00:00:00 2001 From: beck <> Date: Sat, 15 Apr 2000 06:18:51 +0000 Subject: OpenSSL 0.9.5a merge --- src/lib/libcrypto/Attic/Makefile | 2 +- src/lib/libcrypto/Makefile.ssl | 2 +- src/lib/libcrypto/asn1/asn1_err.c | 3 +- src/lib/libcrypto/asn1/p5_pbe.c | 2 +- src/lib/libcrypto/asn1/p5_pbev2.c | 5 +- src/lib/libcrypto/asn1/t_req.c | 7 +- src/lib/libcrypto/asn1/x_pubkey.c | 2 + src/lib/libcrypto/bf/Makefile.ssl | 4 +- src/lib/libcrypto/bf/Makefile.uni | 157 -- src/lib/libcrypto/bf/asm/b-win32.asm | 906 ------- src/lib/libcrypto/bio/Makefile.ssl | 6 +- src/lib/libcrypto/bio/b_print.c | 230 +- src/lib/libcrypto/bio/bio.h | 2 +- src/lib/libcrypto/bio/bio_err.c | 3 +- src/lib/libcrypto/bio/bio_lib.c | 2 +- src/lib/libcrypto/bio/bss_bio.c | 39 +- src/lib/libcrypto/bio/bss_log.c | 220 +- src/lib/libcrypto/bn/Makefile.ssl | 9 +- src/lib/libcrypto/bn/asm/bn-win32.asm | 2122 ---------------- src/lib/libcrypto/bn/asm/x86w16.asm | 297 --- src/lib/libcrypto/bn/asm/x86w32.asm | 360 --- src/lib/libcrypto/bn/bn.h | 2 +- src/lib/libcrypto/bn/bn_err.c | 3 +- src/lib/libcrypto/bn/bn_mont.c | 7 +- src/lib/libcrypto/bn/bn_mul.c | 3 + src/lib/libcrypto/bn/bntest.c | 3 +- src/lib/libcrypto/buffer/buf_err.c | 3 +- src/lib/libcrypto/cast/Makefile.ssl | 4 +- src/lib/libcrypto/cast/Makefile.uni | 124 - src/lib/libcrypto/cast/asm/c-win32.asm | 953 ------- src/lib/libcrypto/cast/cast_lcl.h | 2 +- src/lib/libcrypto/comp/comp_err.c | 3 +- src/lib/libcrypto/conf/conf_err.c | 3 +- src/lib/libcrypto/cpt_err.c | 3 +- src/lib/libcrypto/crypto-lib.com | 7 +- src/lib/libcrypto/des/DES.pod | 16 - src/lib/libcrypto/des/MODES.DES | 84 - src/lib/libcrypto/des/Makefile.PL | 14 - src/lib/libcrypto/des/Makefile.lit | 250 -- src/lib/libcrypto/des/Makefile.ssl | 26 +- src/lib/libcrypto/des/Makefile.uni | 251 -- src/lib/libcrypto/des/PC1 | 28 - src/lib/libcrypto/des/PC2 | 57 - src/lib/libcrypto/des/asm/d-win32.asm | 3132 ------------------------ src/lib/libcrypto/des/asm/y-win32.asm | 929 ------- src/lib/libcrypto/des/des.c | 7 +- src/lib/libcrypto/des/des.h | 29 +- src/lib/libcrypto/des/des.man | 186 -- src/lib/libcrypto/des/des.pl | 552 ----- src/lib/libcrypto/des/des.pod | 217 ++ src/lib/libcrypto/des/des_crypt.man | 508 ---- src/lib/libcrypto/des/des_locl.h | 2 +- src/lib/libcrypto/des/destest.c | 69 +- src/lib/libcrypto/des/doIP | 46 - src/lib/libcrypto/des/doPC1 | 110 - src/lib/libcrypto/des/doPC2 | 94 - src/lib/libcrypto/des/fcrypt.c | 1 - src/lib/libcrypto/des/fcrypt_b.c | 2 +- src/lib/libcrypto/des/ncbc_enc.c | 5 + src/lib/libcrypto/des/podd.h | 75 - src/lib/libcrypto/des/qud_cksm.c | 31 +- src/lib/libcrypto/des/rand_key.c | 8 +- src/lib/libcrypto/des/set_key.c | 199 +- src/lib/libcrypto/des/shifts.pl | 198 -- src/lib/libcrypto/des/sk.h | 204 -- src/lib/libcrypto/des/testdes.pl | 167 -- src/lib/libcrypto/dh/dh_err.c | 3 +- src/lib/libcrypto/doc/DH_set_method.pod | 2 +- src/lib/libcrypto/doc/DSA_set_method.pod | 5 +- src/lib/libcrypto/doc/EVP_OpenInit.pod | 51 + src/lib/libcrypto/doc/EVP_SealInit.pod | 70 + src/lib/libcrypto/doc/EVP_SignInit.pod | 85 + src/lib/libcrypto/doc/EVP_VerifyInit.pod | 71 + src/lib/libcrypto/doc/RAND_add.pod | 25 +- src/lib/libcrypto/doc/RAND_set_rand_method.pod | 4 +- src/lib/libcrypto/doc/RSA_set_method.pod | 5 +- src/lib/libcrypto/doc/rsa.pod | 5 +- src/lib/libcrypto/dsa/dsa_err.c | 3 +- src/lib/libcrypto/dsa/dsa_key.c | 3 +- src/lib/libcrypto/err/err.c | 106 +- src/lib/libcrypto/evp/evp_err.c | 3 +- src/lib/libcrypto/evp/evp_pkey.c | 14 +- src/lib/libcrypto/evp/names.c | 5 + src/lib/libcrypto/hmac/hmac.c | 4 +- src/lib/libcrypto/lhash/lhash.c | 21 +- src/lib/libcrypto/lhash/lhash.h | 1 + src/lib/libcrypto/md5/Makefile.ssl | 4 +- src/lib/libcrypto/md5/Makefile.uni | 110 - src/lib/libcrypto/md5/asm/m5-win32.asm | 687 ------ src/lib/libcrypto/md5/md5_locl.h | 4 - src/lib/libcrypto/mem_dbg.c | 43 +- src/lib/libcrypto/objects/o_names.c | 2 +- src/lib/libcrypto/objects/obj_err.c | 3 +- src/lib/libcrypto/objects/objects.h | 2 +- src/lib/libcrypto/opensslv.h | 31 +- src/lib/libcrypto/pem/pem_err.c | 3 +- src/lib/libcrypto/pem/pem_lib.c | 2 +- src/lib/libcrypto/perlasm/x86asm.pl | 6 +- src/lib/libcrypto/perlasm/x86ms.pl | 2 +- src/lib/libcrypto/perlasm/x86unix.pl | 8 + src/lib/libcrypto/pkcs12/p12_crt.c | 6 +- src/lib/libcrypto/pkcs12/p12_key.c | 8 + src/lib/libcrypto/pkcs12/p12_kiss.c | 90 +- src/lib/libcrypto/pkcs12/p12_mutl.c | 2 +- src/lib/libcrypto/pkcs12/pk12err.c | 3 +- src/lib/libcrypto/pkcs12/pkcs12.h | 4 +- src/lib/libcrypto/pkcs7/README | 5 - src/lib/libcrypto/pkcs7/pk7_doit.c | 1 + src/lib/libcrypto/pkcs7/pkcs7err.c | 3 +- src/lib/libcrypto/rand/md_rand.c | 133 +- src/lib/libcrypto/rand/rand.h | 9 +- src/lib/libcrypto/rand/rand_egd.c | 2 +- src/lib/libcrypto/rand/rand_err.c | 5 +- src/lib/libcrypto/rand/rand_lib.c | 7 + src/lib/libcrypto/rand/randfile.c | 50 +- src/lib/libcrypto/rc2/Makefile.uni | 73 - src/lib/libcrypto/rc4/Makefile.ssl | 5 +- src/lib/libcrypto/rc4/Makefile.uni | 103 - src/lib/libcrypto/rc4/asm/r4-win32.asm | 314 --- src/lib/libcrypto/rc5/Makefile.ssl | 4 +- src/lib/libcrypto/rc5/Makefile.uni | 73 - src/lib/libcrypto/rc5/asm/r5-win32.asm | 574 ----- src/lib/libcrypto/ripemd/Makefile.ssl | 4 +- src/lib/libcrypto/ripemd/Makefile.uni | 109 - src/lib/libcrypto/ripemd/asm/rm-win32.asm | 1973 --------------- src/lib/libcrypto/ripemd/rmd_locl.h | 4 - src/lib/libcrypto/rsa/rsa_err.c | 3 +- src/lib/libcrypto/sha/Makefile.ssl | 5 +- src/lib/libcrypto/sha/Makefile.uni | 122 - src/lib/libcrypto/sha/asm/s1-win32.asm | 1716 ------------- src/lib/libcrypto/sha/asm/sha1-586.pl | 2 +- src/lib/libcrypto/sha/sha_locl.h | 4 - src/lib/libcrypto/util/libeay.num | 3 + src/lib/libcrypto/util/mk1mf.pl | 3 + src/lib/libcrypto/util/mkerr.pl | 26 +- src/lib/libcrypto/util/pl/BC-32.pl | 2 +- src/lib/libcrypto/util/pl/Mingw32.pl | 25 +- src/lib/libcrypto/util/selftest.pl | 20 +- src/lib/libcrypto/util/sep_lib.sh | 34 - src/lib/libcrypto/x509/x509.h | 4 +- src/lib/libcrypto/x509/x509_err.c | 3 +- src/lib/libcrypto/x509/x509_trs.c | 17 +- src/lib/libcrypto/x509/x509_vfy.c | 22 +- src/lib/libcrypto/x509/x509name.c | 2 +- src/lib/libcrypto/x509v3/v3_purp.c | 9 +- src/lib/libcrypto/x509v3/v3err.c | 3 +- src/lib/libcrypto/x509v3/x509v3.h | 7 +- 147 files changed, 1798 insertions(+), 18188 deletions(-) create mode 100644 src/lib/libcrypto/des/des.pod create mode 100644 src/lib/libcrypto/doc/EVP_OpenInit.pod create mode 100644 src/lib/libcrypto/doc/EVP_SealInit.pod create mode 100644 src/lib/libcrypto/doc/EVP_SignInit.pod create mode 100644 src/lib/libcrypto/doc/EVP_VerifyInit.pod (limited to 'src/lib/libcrypto') diff --git a/src/lib/libcrypto/Attic/Makefile b/src/lib/libcrypto/Attic/Makefile index 24b7f32fdd..b980f54dba 100644 --- a/src/lib/libcrypto/Attic/Makefile +++ b/src/lib/libcrypto/Attic/Makefile @@ -40,7 +40,7 @@ LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdi SRC= $(LIBSRC) EXHEADER= crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h -HEADER= cryptlib.h buildinf.h $(EXHEADER) +HEADER= cryptlib.h buildinf.h md32_common.h $(EXHEADER) ALL= $(GENERAL) $(SRC) $(HEADER) diff --git a/src/lib/libcrypto/Makefile.ssl b/src/lib/libcrypto/Makefile.ssl index cab75d9f80..f9b33586be 100644 --- a/src/lib/libcrypto/Makefile.ssl +++ b/src/lib/libcrypto/Makefile.ssl @@ -40,7 +40,7 @@ LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdi SRC= $(LIBSRC) EXHEADER= crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h -HEADER= cryptlib.h buildinf.h $(EXHEADER) +HEADER= cryptlib.h buildinf.h md32_common.h $(EXHEADER) ALL= $(GENERAL) $(SRC) $(HEADER) diff --git a/src/lib/libcrypto/asn1/asn1_err.c b/src/lib/libcrypto/asn1/asn1_err.c index b183814242..cecd555c88 100644 --- a/src/lib/libcrypto/asn1/asn1_err.c +++ b/src/lib/libcrypto/asn1/asn1_err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/asn1/p5_pbe.c b/src/lib/libcrypto/asn1/p5_pbe.c index 64e90237cc..a147ac3295 100644 --- a/src/lib/libcrypto/asn1/p5_pbe.c +++ b/src/lib/libcrypto/asn1/p5_pbe.c @@ -129,7 +129,7 @@ X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, } pbe->salt->length = saltlen; if (salt) memcpy (pbe->salt->data, salt, saltlen); - else if (RAND_bytes (pbe->salt->data, saltlen) <= 0) + else if (RAND_pseudo_bytes (pbe->salt->data, saltlen) < 0) return NULL; if (!(astype = ASN1_TYPE_new())) { diff --git a/src/lib/libcrypto/asn1/p5_pbev2.c b/src/lib/libcrypto/asn1/p5_pbev2.c index 4ce06a94ab..1bbdb10c71 100644 --- a/src/lib/libcrypto/asn1/p5_pbev2.c +++ b/src/lib/libcrypto/asn1/p5_pbev2.c @@ -194,7 +194,8 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, if(!(scheme->parameter = ASN1_TYPE_new())) goto merr; /* Create random IV */ - RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)); + if (RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0) + goto err; /* Dummy cipherinit to just setup the IV */ EVP_CipherInit(&ctx, cipher, NULL, iv, 0); @@ -212,7 +213,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, if (!(osalt->data = Malloc (saltlen))) goto merr; osalt->length = saltlen; if (salt) memcpy (osalt->data, salt, saltlen); - else if (RAND_bytes (osalt->data, saltlen) <= 0) goto merr; + else if (RAND_pseudo_bytes (osalt->data, saltlen) < 0) goto merr; if(iter <= 0) iter = PKCS5_DEFAULT_ITER; if(!ASN1_INTEGER_set(kdf->iter, iter)) goto merr; diff --git a/src/lib/libcrypto/asn1/t_req.c b/src/lib/libcrypto/asn1/t_req.c index 81dd6355a8..ea1af092db 100644 --- a/src/lib/libcrypto/asn1/t_req.c +++ b/src/lib/libcrypto/asn1/t_req.c @@ -119,7 +119,7 @@ int X509_REQ_print(BIO *bp, X509_REQ *x) pkey=X509_REQ_get_pubkey(x); #ifndef NO_RSA - if (pkey->type == EVP_PKEY_RSA) + if (pkey != NULL && pkey->type == EVP_PKEY_RSA) { BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","", BN_num_bits(pkey->pkey.rsa->n)); @@ -128,7 +128,7 @@ int X509_REQ_print(BIO *bp, X509_REQ *x) else #endif #ifndef NO_DSA - if (pkey->type == EVP_PKEY_DSA) + if (pkey != NULL && pkey->type == EVP_PKEY_DSA) { BIO_printf(bp,"%12sDSA Public Key:\n",""); DSA_print(bp,pkey->pkey.dsa,16); @@ -137,7 +137,8 @@ int X509_REQ_print(BIO *bp, X509_REQ *x) #endif BIO_printf(bp,"%12sUnknown Public Key:\n",""); - EVP_PKEY_free(pkey); + if (pkey != NULL) + EVP_PKEY_free(pkey); /* may not be */ sprintf(str,"%8sAttributes:\n",""); diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c index 81e9815222..7a05d575c9 100644 --- a/src/lib/libcrypto/asn1/x_pubkey.c +++ b/src/lib/libcrypto/asn1/x_pubkey.c @@ -183,8 +183,10 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) Free(s); +#if 0 CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY); pk->pkey=pkey; +#endif if (*x != NULL) X509_PUBKEY_free(*x); diff --git a/src/lib/libcrypto/bf/Makefile.ssl b/src/lib/libcrypto/bf/Makefile.ssl index 15f6a63987..cf2f7dd48e 100644 --- a/src/lib/libcrypto/bf/Makefile.ssl +++ b/src/lib/libcrypto/bf/Makefile.ssl @@ -49,7 +49,7 @@ lib: $(LIBOBJ) # elf asm/bx86-elf.o: asm/bx86unix.cpp - $(CPP) -DELF asm/bx86unix.cpp | as -o asm/bx86-elf.o + $(CPP) -DELF -x c asm/bx86unix.cpp | as -o asm/bx86-elf.o # solaris asm/bx86-sol.o: asm/bx86unix.cpp @@ -65,7 +65,7 @@ asm/bx86-out.o: asm/bx86unix.cpp asm/bx86bsdi.o: asm/bx86unix.cpp $(CPP) -DBSDI asm/bx86unix.cpp | sed 's/ :/:/' | as -o asm/bx86bsdi.o -asm/bx86unix.cpp: +asm/bx86unix.cpp: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl (cd asm; $(PERL) bf-586.pl cpp $(PROCESSOR) >bx86unix.cpp) files: diff --git a/src/lib/libcrypto/bf/Makefile.uni b/src/lib/libcrypto/bf/Makefile.uni index f67e5ca23b..e69de29bb2 100644 --- a/src/lib/libcrypto/bf/Makefile.uni +++ b/src/lib/libcrypto/bf/Makefile.uni @@ -1,157 +0,0 @@ -# Targets -# make - twidle the options yourself :-) -# make cc - standard cc options -# make gcc - standard gcc options -# make x86-elf - linux-elf etc -# make x86-out - linux-a.out, FreeBSD etc -# make x86-solaris -# make x86-bdsi - -DIR= bf -TOP= . -# use BF_PTR2 for intel boxes, -# BF_PTR for sparc and MIPS/SGI -# use nothing for Alpha and HP. - -# There are 3 possible performance options, experiment :-) -#OPTS= -DBF_PTR # usr for sparc and MIPS/SGI -#OPTS= -DBF_PTR2 # use for pentium -OPTS= # use for pentium pro, Alpha and HP - -MAKE=make -f Makefile -#CC=cc -#CFLAG= -O - -CC=gcc -#CFLAG= -O4 -funroll-loops -fomit-frame-pointer -CFLAG= -O3 -fomit-frame-pointer - -CFLAGS=$(OPTS) $(CFLAG) -CPP=$(CC) -E -AS=as -RANLIB=ranlib - -# Assember version of bf_encrypt(). -BF_ENC=bf_enc.o # normal C version -#BF_ENC=asm/bx86-elf.o # elf format x86 -#BF_ENC=asm/bx86-out.o # a.out format x86 -#BF_ENC=asm/bx86-sol.o # solaris format x86 -#BF_ENC=asm/bx86bsdi.o # bsdi format x86 - -LIBDIR=/usr/local/lib -BINDIR=/usr/local/bin -INCDIR=/usr/local/include -MANDIR=/usr/local/man -MAN1=1 -MAN3=3 -SHELL=/bin/sh -LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cfb64.o bf_ofb64.o -LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c - -GENERAL=Makefile Makefile.ssl Makefile.uni asm bf_locl.org README \ - COPYRIGHT blowfish.doc INSTALL - -TESTING= bftest bfspeed bf_opts -TESTING_SRC=bftest.c bfspeed.c bf_opts.c -HEADERS=bf_locl.h blowfish.h bf_pi.h - -ALL= $(GENERAL) $(TESTING_SRC) $(LIBSRC) $(HEADERS) - -BLIB= libblowfish.a - -all: $(BLIB) $(TESTING) - -cc: - $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all - -gcc: - $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all - -x86-elf: - $(MAKE) BF_ENC='asm/bx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all - -x86-out: - $(MAKE) BF_ENC='asm/bx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all - -x86-solaris: - $(MAKE) BF_ENC='asm/bx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all - -x86-bsdi: - $(MAKE) BF_ENC='asm/bx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all - -# elf -asm/bx86-elf.o: asm/bx86unix.cpp - $(CPP) -DELF asm/bx86unix.cpp | $(AS) -o asm/bx86-elf.o - -# solaris -asm/bx86-sol.o: asm/bx86unix.cpp - $(CC) -E -DSOL asm/bx86unix.cpp | sed 's/^#.*//' > asm/bx86-sol.s - as -o asm/bx86-sol.o asm/bx86-sol.s - rm -f asm/bx86-sol.s - -# a.out -asm/bx86-out.o: asm/bx86unix.cpp - $(CPP) -DOUT asm/bx86unix.cpp | $(AS) -o asm/bx86-out.o - -# bsdi -asm/bx86bsdi.o: asm/bx86unix.cpp - $(CPP) -DBSDI asm/bx86unix.cpp | $(AS) -o asm/bx86bsdi.o - -asm/bx86unix.cpp: - (cd asm; perl bf-586.pl cpp >bx86unix.cpp) - -test: all - ./bftest - -$(BLIB): $(LIBOBJ) - /bin/rm -f $(BLIB) - ar cr $(BLIB) $(LIBOBJ) - $(RANLIB) $(BLIB) - -bftest: bftest.o $(BLIB) - $(CC) $(CFLAGS) -o bftest bftest.o $(BLIB) - -bfspeed: bfspeed.o $(BLIB) - $(CC) $(CFLAGS) -o bfspeed bfspeed.o $(BLIB) - -bf_opts: bf_opts.o $(BLIB) - $(CC) $(CFLAGS) -o bf_opts bf_opts.o $(BLIB) - -tags: - ctags $(TESTING_SRC) $(LIBBF) - -tar: - tar chf libbf.tar $(ALL) - -shar: - shar $(ALL) >libbf.shar - -depend: - makedepend $(LIBBF) $(TESTING_SRC) - -clean: - /bin/rm -f *.o tags core $(TESTING) $(BLIB) .nfs* *.old *.bak asm/*.o - -dclean: - sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new - mv -f Makefile.new Makefile - -# Eric is probably going to choke when he next looks at this --tjh -install: $(BLIB) - if test $(INSTALLTOP); then \ - echo SSL style install; \ - cp $(BLIB) $(INSTALLTOP)/lib; \ - $(RANLIB) $(BLIB); \ - chmod 644 $(INSTALLTOP)/lib/$(BLIB); \ - cp blowfish.h $(INSTALLTOP)/include; \ - chmod 644 $(INSTALLTOP)/include/blowfish.h; \ - else \ - echo Standalone install; \ - cp $(BLIB) $(LIBDIR)/$(BLIB); \ - $(RANLIB) $(BLIB); \ - chmod 644 $(LIBDIR)/$(BLIB); \ - cp blowfish.h $(INCDIR)/blowfish.h; \ - chmod 644 $(INCDIR)/blowfish.h; \ - fi - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/bf/asm/b-win32.asm b/src/lib/libcrypto/bf/asm/b-win32.asm index 138c99d0aa..e69de29bb2 100644 --- a/src/lib/libcrypto/bf/asm/b-win32.asm +++ b/src/lib/libcrypto/bf/asm/b-win32.asm @@ -1,906 +0,0 @@ - ; Don't even think of reading this code - ; It was automatically generated by bf-586.pl - ; Which is a perl program used to generate the x86 assember for - ; any of elf, a.out, BSDI,Win32, or Solaris - ; eric - ; - TITLE bf-586.asm - .486 -.model FLAT -_TEXT SEGMENT -PUBLIC _BF_encrypt - -_BF_encrypt PROC NEAR - ; - push ebp - push ebx - mov ebx, DWORD PTR 12[esp] - mov ebp, DWORD PTR 16[esp] - push esi - push edi - ; Load the 2 words - mov edi, DWORD PTR [ebx] - mov esi, DWORD PTR 4[ebx] - xor eax, eax - mov ebx, DWORD PTR [ebp] - xor ecx, ecx - xor edi, ebx - ; - ; Round 0 - mov edx, DWORD PTR 4[ebp] - mov ebx, edi - xor esi, edx - shr ebx, 16 - mov edx, edi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor esi, ebx - ; - ; Round 1 - mov edx, DWORD PTR 8[ebp] - mov ebx, esi - xor edi, edx - shr ebx, 16 - mov edx, esi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor edi, ebx - ; - ; Round 2 - mov edx, DWORD PTR 12[ebp] - mov ebx, edi - xor esi, edx - shr ebx, 16 - mov edx, edi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor esi, ebx - ; - ; Round 3 - mov edx, DWORD PTR 16[ebp] - mov ebx, esi - xor edi, edx - shr ebx, 16 - mov edx, esi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor edi, ebx - ; - ; Round 4 - mov edx, DWORD PTR 20[ebp] - mov ebx, edi - xor esi, edx - shr ebx, 16 - mov edx, edi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor esi, ebx - ; - ; Round 5 - mov edx, DWORD PTR 24[ebp] - mov ebx, esi - xor edi, edx - shr ebx, 16 - mov edx, esi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor edi, ebx - ; - ; Round 6 - mov edx, DWORD PTR 28[ebp] - mov ebx, edi - xor esi, edx - shr ebx, 16 - mov edx, edi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor esi, ebx - ; - ; Round 7 - mov edx, DWORD PTR 32[ebp] - mov ebx, esi - xor edi, edx - shr ebx, 16 - mov edx, esi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor edi, ebx - ; - ; Round 8 - mov edx, DWORD PTR 36[ebp] - mov ebx, edi - xor esi, edx - shr ebx, 16 - mov edx, edi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor esi, ebx - ; - ; Round 9 - mov edx, DWORD PTR 40[ebp] - mov ebx, esi - xor edi, edx - shr ebx, 16 - mov edx, esi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor edi, ebx - ; - ; Round 10 - mov edx, DWORD PTR 44[ebp] - mov ebx, edi - xor esi, edx - shr ebx, 16 - mov edx, edi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor esi, ebx - ; - ; Round 11 - mov edx, DWORD PTR 48[ebp] - mov ebx, esi - xor edi, edx - shr ebx, 16 - mov edx, esi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor edi, ebx - ; - ; Round 12 - mov edx, DWORD PTR 52[ebp] - mov ebx, edi - xor esi, edx - shr ebx, 16 - mov edx, edi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor esi, ebx - ; - ; Round 13 - mov edx, DWORD PTR 56[ebp] - mov ebx, esi - xor edi, edx - shr ebx, 16 - mov edx, esi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor edi, ebx - ; - ; Round 14 - mov edx, DWORD PTR 60[ebp] - mov ebx, edi - xor esi, edx - shr ebx, 16 - mov edx, edi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor esi, ebx - ; - ; Round 15 - mov edx, DWORD PTR 64[ebp] - mov ebx, esi - xor edi, edx - shr ebx, 16 - mov edx, esi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - ; Load parameter 0 (16) enc=1 - mov eax, DWORD PTR 20[esp] - xor edi, ebx - mov edx, DWORD PTR 68[ebp] - xor esi, edx - mov DWORD PTR 4[eax],edi - mov DWORD PTR [eax],esi - pop edi - pop esi - pop ebx - pop ebp - ret -_BF_encrypt ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _BF_decrypt - -_BF_decrypt PROC NEAR - ; - push ebp - push ebx - mov ebx, DWORD PTR 12[esp] - mov ebp, DWORD PTR 16[esp] - push esi - push edi - ; Load the 2 words - mov edi, DWORD PTR [ebx] - mov esi, DWORD PTR 4[ebx] - xor eax, eax - mov ebx, DWORD PTR 68[ebp] - xor ecx, ecx - xor edi, ebx - ; - ; Round 16 - mov edx, DWORD PTR 64[ebp] - mov ebx, edi - xor esi, edx - shr ebx, 16 - mov edx, edi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor esi, ebx - ; - ; Round 15 - mov edx, DWORD PTR 60[ebp] - mov ebx, esi - xor edi, edx - shr ebx, 16 - mov edx, esi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor edi, ebx - ; - ; Round 14 - mov edx, DWORD PTR 56[ebp] - mov ebx, edi - xor esi, edx - shr ebx, 16 - mov edx, edi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor esi, ebx - ; - ; Round 13 - mov edx, DWORD PTR 52[ebp] - mov ebx, esi - xor edi, edx - shr ebx, 16 - mov edx, esi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor edi, ebx - ; - ; Round 12 - mov edx, DWORD PTR 48[ebp] - mov ebx, edi - xor esi, edx - shr ebx, 16 - mov edx, edi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor esi, ebx - ; - ; Round 11 - mov edx, DWORD PTR 44[ebp] - mov ebx, esi - xor edi, edx - shr ebx, 16 - mov edx, esi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor edi, ebx - ; - ; Round 10 - mov edx, DWORD PTR 40[ebp] - mov ebx, edi - xor esi, edx - shr ebx, 16 - mov edx, edi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor esi, ebx - ; - ; Round 9 - mov edx, DWORD PTR 36[ebp] - mov ebx, esi - xor edi, edx - shr ebx, 16 - mov edx, esi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor edi, ebx - ; - ; Round 8 - mov edx, DWORD PTR 32[ebp] - mov ebx, edi - xor esi, edx - shr ebx, 16 - mov edx, edi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor esi, ebx - ; - ; Round 7 - mov edx, DWORD PTR 28[ebp] - mov ebx, esi - xor edi, edx - shr ebx, 16 - mov edx, esi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor edi, ebx - ; - ; Round 6 - mov edx, DWORD PTR 24[ebp] - mov ebx, edi - xor esi, edx - shr ebx, 16 - mov edx, edi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor esi, ebx - ; - ; Round 5 - mov edx, DWORD PTR 20[ebp] - mov ebx, esi - xor edi, edx - shr ebx, 16 - mov edx, esi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor edi, ebx - ; - ; Round 4 - mov edx, DWORD PTR 16[ebp] - mov ebx, edi - xor esi, edx - shr ebx, 16 - mov edx, edi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor esi, ebx - ; - ; Round 3 - mov edx, DWORD PTR 12[ebp] - mov ebx, esi - xor edi, edx - shr ebx, 16 - mov edx, esi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor edi, ebx - ; - ; Round 2 - mov edx, DWORD PTR 8[ebp] - mov ebx, edi - xor esi, edx - shr ebx, 16 - mov edx, edi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - xor eax, eax - xor esi, ebx - ; - ; Round 1 - mov edx, DWORD PTR 4[ebp] - mov ebx, esi - xor edi, edx - shr ebx, 16 - mov edx, esi - mov al, bh - and ebx, 255 - mov cl, dh - and edx, 255 - mov eax, DWORD PTR 72[eax*4+ebp] - mov ebx, DWORD PTR 1096[ebx*4+ebp] - add ebx, eax - mov eax, DWORD PTR 2120[ecx*4+ebp] - xor ebx, eax - mov edx, DWORD PTR 3144[edx*4+ebp] - add ebx, edx - ; Load parameter 0 (1) enc=0 - mov eax, DWORD PTR 20[esp] - xor edi, ebx - mov edx, DWORD PTR [ebp] - xor esi, edx - mov DWORD PTR 4[eax],edi - mov DWORD PTR [eax],esi - pop edi - pop esi - pop ebx - pop ebp - ret -_BF_decrypt ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _BF_cbc_encrypt - -_BF_cbc_encrypt PROC NEAR - ; - push ebp - push ebx - push esi - push edi - mov ebp, DWORD PTR 28[esp] - ; getting iv ptr from parameter 4 - mov ebx, DWORD PTR 36[esp] - mov esi, DWORD PTR [ebx] - mov edi, DWORD PTR 4[ebx] - push edi - push esi - push edi - push esi - mov ebx, esp - mov esi, DWORD PTR 36[esp] - mov edi, DWORD PTR 40[esp] - ; getting encrypt flag from parameter 5 - mov ecx, DWORD PTR 56[esp] - ; get and push parameter 3 - mov eax, DWORD PTR 48[esp] - push eax - push ebx - cmp ecx, 0 - jz $L000decrypt - and ebp, 4294967288 - mov eax, DWORD PTR 8[esp] - mov ebx, DWORD PTR 12[esp] - jz $L001encrypt_finish -L002encrypt_loop: - mov ecx, DWORD PTR [esi] - mov edx, DWORD PTR 4[esi] - xor eax, ecx - xor ebx, edx - bswap eax - bswap ebx - mov DWORD PTR 8[esp],eax - mov DWORD PTR 12[esp],ebx - call _BF_encrypt - mov eax, DWORD PTR 8[esp] - mov ebx, DWORD PTR 12[esp] - bswap eax - bswap ebx - mov DWORD PTR [edi],eax - mov DWORD PTR 4[edi],ebx - add esi, 8 - add edi, 8 - sub ebp, 8 - jnz L002encrypt_loop -$L001encrypt_finish: - mov ebp, DWORD PTR 52[esp] - and ebp, 7 - jz $L003finish - xor ecx, ecx - xor edx, edx - mov ebp, DWORD PTR $L004cbc_enc_jmp_table[ebp*4] - jmp ebp -L005ej7: - mov dh, BYTE PTR 6[esi] - shl edx, 8 -L006ej6: - mov dh, BYTE PTR 5[esi] -L007ej5: - mov dl, BYTE PTR 4[esi] -L008ej4: - mov ecx, DWORD PTR [esi] - jmp $L009ejend -L010ej3: - mov ch, BYTE PTR 2[esi] - shl ecx, 8 -L011ej2: - mov ch, BYTE PTR 1[esi] -L012ej1: - mov cl, BYTE PTR [esi] -$L009ejend: - xor eax, ecx - xor ebx, edx - bswap eax - bswap ebx - mov DWORD PTR 8[esp],eax - mov DWORD PTR 12[esp],ebx - call _BF_encrypt - mov eax, DWORD PTR 8[esp] - mov ebx, DWORD PTR 12[esp] - bswap eax - bswap ebx - mov DWORD PTR [edi],eax - mov DWORD PTR 4[edi],ebx - jmp $L003finish -$L000decrypt: - and ebp, 4294967288 - mov eax, DWORD PTR 16[esp] - mov ebx, DWORD PTR 20[esp] - jz $L013decrypt_finish -L014decrypt_loop: - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] - bswap eax - bswap ebx - mov DWORD PTR 8[esp],eax - mov DWORD PTR 12[esp],ebx - call _BF_decrypt - mov eax, DWORD PTR 8[esp] - mov ebx, DWORD PTR 12[esp] - bswap eax - bswap ebx - mov ecx, DWORD PTR 16[esp] - mov edx, DWORD PTR 20[esp] - xor ecx, eax - xor edx, ebx - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] - mov DWORD PTR [edi],ecx - mov DWORD PTR 4[edi],edx - mov DWORD PTR 16[esp],eax - mov DWORD PTR 20[esp],ebx - add esi, 8 - add edi, 8 - sub ebp, 8 - jnz L014decrypt_loop -$L013decrypt_finish: - mov ebp, DWORD PTR 52[esp] - and ebp, 7 - jz $L003finish - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] - bswap eax - bswap ebx - mov DWORD PTR 8[esp],eax - mov DWORD PTR 12[esp],ebx - call _BF_decrypt - mov eax, DWORD PTR 8[esp] - mov ebx, DWORD PTR 12[esp] - bswap eax - bswap ebx - mov ecx, DWORD PTR 16[esp] - mov edx, DWORD PTR 20[esp] - xor ecx, eax - xor edx, ebx - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] -L015dj7: - ror edx, 16 - mov BYTE PTR 6[edi],dl - shr edx, 16 -L016dj6: - mov BYTE PTR 5[edi],dh -L017dj5: - mov BYTE PTR 4[edi],dl -L018dj4: - mov DWORD PTR [edi],ecx - jmp $L019djend -L020dj3: - ror ecx, 16 - mov BYTE PTR 2[edi],cl - shl ecx, 16 -L021dj2: - mov BYTE PTR 1[esi],ch -L022dj1: - mov BYTE PTR [esi], cl -$L019djend: - jmp $L003finish -$L003finish: - mov ecx, DWORD PTR 60[esp] - add esp, 24 - mov DWORD PTR [ecx],eax - mov DWORD PTR 4[ecx],ebx - pop edi - pop esi - pop ebx - pop ebp - ret -$L004cbc_enc_jmp_table: - DD 0 - DD L012ej1 - DD L011ej2 - DD L010ej3 - DD L008ej4 - DD L007ej5 - DD L006ej6 - DD L005ej7 -L023cbc_dec_jmp_table: - DD 0 - DD L022dj1 - DD L021dj2 - DD L020dj3 - DD L018dj4 - DD L017dj5 - DD L016dj6 - DD L015dj7 -_BF_cbc_encrypt ENDP -_TEXT ENDS -END diff --git a/src/lib/libcrypto/bio/Makefile.ssl b/src/lib/libcrypto/bio/Makefile.ssl index 2e7480ead9..755f255fe4 100644 --- a/src/lib/libcrypto/bio/Makefile.ssl +++ b/src/lib/libcrypto/bio/Makefile.ssl @@ -172,8 +172,10 @@ bss_acpt.o: ../../include/openssl/opensslconf.h bss_acpt.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h bss_acpt.o: ../../include/openssl/stack.h ../cryptlib.h bss_bio.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h -bss_bio.o: ../../include/openssl/err.h ../../include/openssl/opensslv.h -bss_bio.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +bss_bio.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +bss_bio.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h +bss_bio.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +bss_bio.o: ../../include/openssl/stack.h bss_conn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h bss_conn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h bss_conn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h diff --git a/src/lib/libcrypto/bio/b_print.c b/src/lib/libcrypto/bio/b_print.c index 2a5e8b58c9..b11b501512 100644 --- a/src/lib/libcrypto/bio/b_print.c +++ b/src/lib/libcrypto/bio/b_print.c @@ -64,6 +64,8 @@ #include #include #include +#include +#include #include "cryptlib.h" #ifndef NO_SYS_TYPES_H #include @@ -72,12 +74,16 @@ #ifdef BN_LLONG # ifndef HAVE_LONG_LONG -# define HAVE_LONG_LONG +# define HAVE_LONG_LONG 1 # endif #endif static void dopr (char *buffer, size_t maxlen, size_t *retlen, const char *format, va_list args); +#ifdef USE_ALLOCATING_PRINT +static void doapr (char **buffer, size_t *retlen, + const char *format, va_list args); +#endif int BIO_printf (BIO *bio, ...) { @@ -85,15 +91,32 @@ int BIO_printf (BIO *bio, ...) char *format; int ret; size_t retlen; +#ifdef USE_ALLOCATING_PRINT + char *hugebuf; +#else MS_STATIC char hugebuf[1024*2]; /* 10k in one chunk is the limit */ +#endif va_start(args, bio); format=va_arg(args, char *); +#ifndef USE_ALLOCATING_PRINT hugebuf[0]='\0'; dopr(hugebuf, sizeof(hugebuf), &retlen, format, args); - ret=BIO_write(bio, hugebuf, (int)retlen); +#else + hugebuf = NULL; + CRYPTO_push_info("doapr()"); + doapr(&hugebuf, &retlen, format, args); + if (hugebuf) + { +#endif + ret=BIO_write(bio, hugebuf, (int)retlen); +#ifdef USE_ALLOCATING_PRINT + Free(hugebuf); + } + CRYPTO_pop_info(); +#endif va_end(args); return(ret); } @@ -131,10 +154,26 @@ int BIO_printf (BIO *bio, ...) #define LLONG long #endif -static void fmtstr (char *, size_t *, size_t, char *, int, int, int); -static void fmtint (char *, size_t *, size_t, LLONG, int, int, int, int); -static void fmtfp (char *, size_t *, size_t, LDOUBLE, int, int, int); -static void dopr_outch (char *, size_t *, size_t, int); +static void fmtstr (void (*)(char **, size_t *, size_t *, int), + char **, size_t *, size_t *, const char *, int, int, + int); +static void fmtint (void (*)(char **, size_t *, size_t *, int), + char **, size_t *, size_t *, LLONG, int, int, int, int); +static void fmtfp (void (*)(char **, size_t *, size_t *, int), + char **, size_t *, size_t *, LDOUBLE, int, int, int); +#ifndef USE_ALLOCATING_PRINT +static int dopr_isbig (size_t, size_t); +static int dopr_copy (size_t); +static void dopr_outch (char **, size_t *, size_t *, int); +#else +static int doapr_isbig (size_t, size_t); +static int doapr_copy (size_t); +static void doapr_outch (char **, size_t *, size_t *, int); +#endif +static void _dopr(void (*)(char **, size_t *, size_t *, int), + int (*)(size_t, size_t), int (*)(size_t), + char **buffer, size_t *maxlen, size_t *retlen, + const char *format, va_list args); /* format read states */ #define DP_S_DEFAULT 0 @@ -165,6 +204,7 @@ static void dopr_outch (char *, size_t *, size_t, int); #define char_to_int(p) (p - '0') #define MAX(p,q) ((p >= q) ? p : q) +#ifndef USE_ALLOCATING_PRINT static void dopr( char *buffer, @@ -172,6 +212,35 @@ dopr( size_t *retlen, const char *format, va_list args) +{ + _dopr(dopr_outch, dopr_isbig, dopr_copy, + &buffer, &maxlen, retlen, format, args); +} + +#else +static void +doapr( + char **buffer, + size_t *retlen, + const char *format, + va_list args) +{ + size_t dummy_maxlen = 0; + _dopr(doapr_outch, doapr_isbig, doapr_copy, + buffer, &dummy_maxlen, retlen, format, args); +} +#endif + +static void +_dopr( + void (*outch_fn)(char **, size_t *, size_t *, int), + int (*isbig_fn)(size_t, size_t), + int (*copy_fn)(size_t), + char **buffer, + size_t *maxlen, + size_t *retlen, + const char *format, + va_list args) { char ch; LLONG value; @@ -190,7 +259,7 @@ dopr( ch = *format++; while (state != DP_S_DONE) { - if ((ch == '\0') || (currlen >= maxlen)) + if ((ch == '\0') || (*isbig_fn)(currlen, *maxlen)) state = DP_S_DONE; switch (state) { @@ -198,7 +267,7 @@ dopr( if (ch == '%') state = DP_S_FLAGS; else - dopr_outch(buffer, &currlen, maxlen, ch); + (*outch_fn)(buffer, &currlen, maxlen, ch); ch = *format++; break; case DP_S_FLAGS: @@ -304,7 +373,8 @@ dopr( value = va_arg(args, int); break; } - fmtint(buffer, &currlen, maxlen, value, 10, min, max, flags); + fmtint(outch_fn, buffer, &currlen, maxlen, + value, 10, min, max, flags); break; case 'X': flags |= DP_F_UP; @@ -329,7 +399,7 @@ dopr( unsigned int); break; } - fmtint(buffer, &currlen, maxlen, value, + fmtint(outch_fn, buffer, &currlen, maxlen, value, ch == 'o' ? 8 : (ch == 'u' ? 10 : 16), min, max, flags); break; @@ -338,7 +408,8 @@ dopr( fvalue = va_arg(args, LDOUBLE); else fvalue = va_arg(args, double); - fmtfp(buffer, &currlen, maxlen, fvalue, min, max, flags); + fmtfp(outch_fn, buffer, &currlen, maxlen, + fvalue, min, max, flags); break; case 'E': flags |= DP_F_UP; @@ -357,19 +428,19 @@ dopr( fvalue = va_arg(args, double); break; case 'c': - dopr_outch(buffer, &currlen, maxlen, + (*outch_fn)(buffer, &currlen, maxlen, va_arg(args, int)); break; case 's': strvalue = va_arg(args, char *); if (max < 0) - max = maxlen; - fmtstr(buffer, &currlen, maxlen, strvalue, - flags, min, max); + max = (*copy_fn)(*maxlen); + fmtstr(outch_fn, buffer, &currlen, maxlen, strvalue, + flags, min, max); break; case 'p': value = (long)va_arg(args, void *); - fmtint(buffer, &currlen, maxlen, + fmtint(outch_fn, buffer, &currlen, maxlen, value, 16, min, max, flags); break; case 'n': /* XXX */ @@ -392,7 +463,7 @@ dopr( } break; case '%': - dopr_outch(buffer, &currlen, maxlen, ch); + (*outch_fn)(buffer, &currlen, maxlen, ch); break; case 'w': /* not supported yet, treat as next char */ @@ -413,19 +484,20 @@ dopr( break; } } - if (currlen >= maxlen - 1) - currlen = maxlen - 1; - buffer[currlen] = '\0'; + if (currlen >= *maxlen - 1) + currlen = *maxlen - 1; + (*buffer)[currlen] = '\0'; *retlen = currlen; return; } static void fmtstr( - char *buffer, + void (*outch_fn)(char **, size_t *, size_t *, int), + char **buffer, size_t *currlen, - size_t maxlen, - char *value, + size_t *maxlen, + const char *value, int flags, int min, int max) @@ -444,16 +516,16 @@ fmtstr( padlen = -padlen; while ((padlen > 0) && (cnt < max)) { - dopr_outch(buffer, currlen, maxlen, ' '); + (*outch_fn)(buffer, currlen, maxlen, ' '); --padlen; ++cnt; } while (*value && (cnt < max)) { - dopr_outch(buffer, currlen, maxlen, *value++); + (*outch_fn)(buffer, currlen, maxlen, *value++); ++cnt; } while ((padlen < 0) && (cnt < max)) { - dopr_outch(buffer, currlen, maxlen, ' '); + (*outch_fn)(buffer, currlen, maxlen, ' '); ++padlen; ++cnt; } @@ -461,9 +533,10 @@ fmtstr( static void fmtint( - char *buffer, + void (*outch_fn)(char **, size_t *, size_t *, int), + char **buffer, size_t *currlen, - size_t maxlen, + size_t *maxlen, LLONG value, int base, int min, @@ -517,28 +590,28 @@ fmtint( /* spaces */ while (spadlen > 0) { - dopr_outch(buffer, currlen, maxlen, ' '); + (*outch_fn)(buffer, currlen, maxlen, ' '); --spadlen; } /* sign */ if (signvalue) - dopr_outch(buffer, currlen, maxlen, signvalue); + (*outch_fn)(buffer, currlen, maxlen, signvalue); /* zeros */ if (zpadlen > 0) { while (zpadlen > 0) { - dopr_outch(buffer, currlen, maxlen, '0'); + (*outch_fn)(buffer, currlen, maxlen, '0'); --zpadlen; } } /* digits */ while (place > 0) - dopr_outch(buffer, currlen, maxlen, convert[--place]); + (*outch_fn)(buffer, currlen, maxlen, convert[--place]); /* left justified spaces */ while (spadlen < 0) { - dopr_outch(buffer, currlen, maxlen, ' '); + (*outch_fn)(buffer, currlen, maxlen, ' '); ++spadlen; } return; @@ -577,9 +650,10 @@ round(LDOUBLE value) static void fmtfp( - char *buffer, + void (*outch_fn)(char **, size_t *, size_t *, int), + char **buffer, size_t *currlen, - size_t maxlen, + size_t *maxlen, LDOUBLE fvalue, int min, int max, @@ -657,54 +731,114 @@ fmtfp( if ((flags & DP_F_ZERO) && (padlen > 0)) { if (signvalue) { - dopr_outch(buffer, currlen, maxlen, signvalue); + (*outch_fn)(buffer, currlen, maxlen, signvalue); --padlen; signvalue = 0; } while (padlen > 0) { - dopr_outch(buffer, currlen, maxlen, '0'); + (*outch_fn)(buffer, currlen, maxlen, '0'); --padlen; } } while (padlen > 0) { - dopr_outch(buffer, currlen, maxlen, ' '); + (*outch_fn)(buffer, currlen, maxlen, ' '); --padlen; } if (signvalue) - dopr_outch(buffer, currlen, maxlen, signvalue); + (*outch_fn)(buffer, currlen, maxlen, signvalue); while (iplace > 0) - dopr_outch(buffer, currlen, maxlen, iconvert[--iplace]); + (*outch_fn)(buffer, currlen, maxlen, iconvert[--iplace]); /* * Decimal point. This should probably use locale to find the correct * char to print out. */ if (max > 0) { - dopr_outch(buffer, currlen, maxlen, '.'); + (*outch_fn)(buffer, currlen, maxlen, '.'); while (fplace > 0) - dopr_outch(buffer, currlen, maxlen, fconvert[--fplace]); + (*outch_fn)(buffer, currlen, maxlen, fconvert[--fplace]); } while (zpadlen > 0) { - dopr_outch(buffer, currlen, maxlen, '0'); + (*outch_fn)(buffer, currlen, maxlen, '0'); --zpadlen; } while (padlen < 0) { - dopr_outch(buffer, currlen, maxlen, ' '); + (*outch_fn)(buffer, currlen, maxlen, ' '); ++padlen; } } +static int +dopr_copy( + size_t len) +{ + return len; +} + +#ifdef USE_ALLOCATING_PRINT +static int +doapr_copy( + size_t len) +{ + /* Return as high an integer as possible */ + return INT_MAX; +} +#endif + +static int +dopr_isbig( + size_t currlen, + size_t maxlen) +{ + return currlen > maxlen; +} + +#ifdef USE_ALLOCATING_PRINT +static int +doapr_isbig( + size_t currlen, + size_t maxlen) +{ + return 0; +} +#endif + static void dopr_outch( - char *buffer, + char **buffer, size_t *currlen, - size_t maxlen, + size_t *maxlen, + int c) +{ + if (*currlen < *maxlen) + (*buffer)[(*currlen)++] = (char)c; + return; +} + +#ifdef USE_ALLOCATING_PRINT +static void +doapr_outch( + char **buffer, + size_t *currlen, + size_t *maxlen, int c) { - if (*currlen < maxlen) - buffer[(*currlen)++] = (char)c; + if (*buffer == NULL) { + if (*maxlen == 0) + *maxlen = 1024; + *buffer = Malloc(*maxlen); + } + while (*currlen >= *maxlen) { + *maxlen += 1024; + *buffer = Realloc(*buffer, *maxlen); + } + /* What to do if *buffer is NULL? */ + assert(*buffer != NULL); + + (*buffer)[(*currlen)++] = (char)c; return; } +#endif diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h index bc08401eeb..ebdb18170b 100644 --- a/src/lib/libcrypto/bio/bio.h +++ b/src/lib/libcrypto/bio/bio.h @@ -507,7 +507,7 @@ int BIO_set(BIO *a,BIO_METHOD *type); int BIO_free(BIO *a); int BIO_read(BIO *b, void *data, int len); int BIO_gets(BIO *bp,char *buf, int size); -int BIO_write(BIO *b, const char *data, int len); +int BIO_write(BIO *b, const void *data, int len); int BIO_puts(BIO *bp,const char *buf); long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); long BIO_callback_ctrl(BIO *bp,int cmd,void (*fp)()); diff --git a/src/lib/libcrypto/bio/bio_err.c b/src/lib/libcrypto/bio/bio_err.c index b5f07de5a0..f38e7b9178 100644 --- a/src/lib/libcrypto/bio/bio_err.c +++ b/src/lib/libcrypto/bio/bio_err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c index cf8e6150fd..e88dcc80f3 100644 --- a/src/lib/libcrypto/bio/bio_lib.c +++ b/src/lib/libcrypto/bio/bio_lib.c @@ -169,7 +169,7 @@ int BIO_read(BIO *b, void *out, int outl) return(i); } -int BIO_write(BIO *b, const char *in, int inl) +int BIO_write(BIO *b, const void *in, int inl) { int i; long (*cb)(); diff --git a/src/lib/libcrypto/bio/bss_bio.c b/src/lib/libcrypto/bio/bss_bio.c index 0d0f9356f7..1e2d7491f2 100644 --- a/src/lib/libcrypto/bio/bss_bio.c +++ b/src/lib/libcrypto/bio/bss_bio.c @@ -19,8 +19,14 @@ #include #include +#include #include +#include "openssl/e_os.h" +#ifndef SSIZE_MAX +# define SSIZE_MAX INT_MAX +#endif + static int bio_new(BIO *bio); static int bio_free(BIO *bio); static int bio_read(BIO *bio, char *buf, int size); @@ -205,10 +211,10 @@ static int bio_read(BIO *bio, char *buf, int size_) */ /* WARNING: The non-copying interface is largely untested as of yet * and may contain bugs. */ -static size_t bio_nread0(BIO *bio, char **buf) +static ssize_t bio_nread0(BIO *bio, char **buf) { struct bio_bio_st *b, *peer_b; - size_t num; + ssize_t num; BIO_clear_retry_flags(bio); @@ -243,15 +249,20 @@ static size_t bio_nread0(BIO *bio, char **buf) return num; } -static size_t bio_nread(BIO *bio, char **buf, size_t num) +static ssize_t bio_nread(BIO *bio, char **buf, size_t num_) { struct bio_bio_st *b, *peer_b; - size_t available; + ssize_t num, available; + + if (num_ > SSIZE_MAX) + num = SSIZE_MAX; + else + num = (ssize_t)num_; available = bio_nread0(bio, buf); if (num > available) num = available; - if (num == 0) + if (num <= 0) return num; b = bio->ptr; @@ -351,7 +362,7 @@ static int bio_write(BIO *bio, char *buf, int num_) * (example usage: bio_nwrite0(), write to buffer, bio_nwrite() * or just bio_nwrite(), write to buffer) */ -static size_t bio_nwrite0(BIO *bio, char **buf) +static ssize_t bio_nwrite0(BIO *bio, char **buf) { struct bio_bio_st *b; size_t num; @@ -399,15 +410,20 @@ static size_t bio_nwrite0(BIO *bio, char **buf) return num; } -static size_t bio_nwrite(BIO *bio, char **buf, size_t num) +static ssize_t bio_nwrite(BIO *bio, char **buf, size_t num_) { struct bio_bio_st *b; - size_t space; + ssize_t num, space; + + if (num_ > SSIZE_MAX) + num = SSIZE_MAX; + else + num = (ssize_t)num_; space = bio_nwrite0(bio, buf); if (num > space) num = space; - if (num == 0) + if (num <= 0) return num; b = bio->ptr; assert(b != NULL); @@ -509,6 +525,11 @@ static long bio_ctrl(BIO *bio, int cmd, long num, void *ptr) ret = 1; break; + case BIO_C_NREAD0: + /* prepare for non-copying read */ + ret = (long) bio_nread0(bio, ptr); + break; + case BIO_C_NREAD: /* non-copying read */ ret = (long) bio_nread(bio, ptr, (size_t) num); diff --git a/src/lib/libcrypto/bio/bss_log.c b/src/lib/libcrypto/bio/bss_log.c index 4308b19663..497eb1af72 100644 --- a/src/lib/libcrypto/bio/bss_log.c +++ b/src/lib/libcrypto/bio/bss_log.c @@ -57,8 +57,8 @@ Why BIO_s_log? BIO_s_log is useful for system daemons (or services under NT). - It is one-way BIO, it sends all stuff to syslogd (or event log - under NT). + It is one-way BIO, it sends all stuff to syslogd (on system that + commonly use that), or event log (on NT), or OPCOM (on OpenVMS). */ @@ -66,29 +66,58 @@ #include #include -#ifndef WIN32 -#ifdef __ultrix -#include -#else -#include -#endif -#else -#include +#if defined(WIN32) +# include +#elif defined(VMS) || defined(__VMS) +# include +# include +# include +# include +#elif defined(__ultrix) +# include +#elif !defined(MSDOS) /* Unix */ +# include #endif #include "cryptlib.h" #include #include + #ifndef NO_SYSLOG +#if defined(WIN32) +#define LOG_EMERG 0 +#define LOG_ALERT 1 +#define LOG_CRIT 2 +#define LOG_ERR 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_DEBUG 7 + +#define LOG_DAEMON (3<<3) +#elif defined(VMS) +/* On VMS, we don't really care about these, but we need them to compile */ +#define LOG_EMERG 0 +#define LOG_ALERT 1 +#define LOG_CRIT 2 +#define LOG_ERR 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_DEBUG 7 + +#define LOG_DAEMON OPC$M_NM_NTWORK +#endif static int MS_CALLBACK slg_write(BIO *h,char *buf,int num); static int MS_CALLBACK slg_puts(BIO *h,char *str); static long MS_CALLBACK slg_ctrl(BIO *h,int cmd,long arg1,char *arg2); static int MS_CALLBACK slg_new(BIO *h); static int MS_CALLBACK slg_free(BIO *data); -static int xopenlog(BIO* bp, const char* name, int level); -static int xcloselog(BIO* bp); +static void xopenlog(BIO* bp, const char* name, int level); +static void xsyslog(BIO* bp, int priority, const char* string); +static void xcloselog(BIO* bp); static BIO_METHOD methods_slg= { @@ -113,11 +142,7 @@ static int MS_CALLBACK slg_new(BIO *bi) bi->init=1; bi->num=0; bi->ptr=NULL; -#ifndef WIN32 xopenlog(bi, "application", LOG_DAEMON); -#else - xopenlog(bi, "application", 0); -#endif return(1); } @@ -133,43 +158,14 @@ static int MS_CALLBACK slg_write(BIO *b, char *in, int inl) int ret= inl; char* buf= in; char* pp; -#if defined(WIN32) - LPCSTR lpszStrings[2]; - WORD evtype= EVENTLOG_ERROR_TYPE; - int pid = _getpid(); - char pidbuf[20]; -#else int priority; -#endif if((buf= (char *)Malloc(inl+ 1)) == NULL){ return(0); } strncpy(buf, in, inl); buf[inl]= '\0'; -#if defined(WIN32) - if(strncmp(buf, "ERR ", 4) == 0){ - evtype= EVENTLOG_ERROR_TYPE; - pp= buf+ 4; - }else if(strncmp(buf, "WAR ", 4) == 0){ - evtype= EVENTLOG_WARNING_TYPE; - pp= buf+ 4; - }else if(strncmp(buf, "INF ", 4) == 0){ - evtype= EVENTLOG_INFORMATION_TYPE; - pp= buf+ 4; - }else{ - evtype= EVENTLOG_ERROR_TYPE; - pp= buf; - } - sprintf(pidbuf, "[%d] ", pid); - lpszStrings[0] = pidbuf; - lpszStrings[1] = pp; - - if(b->ptr) - ReportEvent(b->ptr, evtype, 0, 1024, NULL, 2, 0, - lpszStrings, NULL); -#else if(strncmp(buf, "ERR ", 4) == 0){ priority= LOG_ERR; pp= buf+ 4; @@ -184,8 +180,8 @@ static int MS_CALLBACK slg_write(BIO *b, char *in, int inl) pp= buf; } - syslog(priority, "%s", pp); -#endif + xsyslog(b, priority, pp); + Free(buf); return(ret); } @@ -213,28 +209,128 @@ static int MS_CALLBACK slg_puts(BIO *bp, char *str) return(ret); } -static int xopenlog(BIO* bp, const char* name, int level) -{ #if defined(WIN32) - if((bp->ptr= (char *)RegisterEventSource(NULL, name)) == NULL){ - return(0); - } -#else - openlog(name, LOG_PID|LOG_CONS, level); -#endif - return(1); + +static void xopenlog(BIO* bp, const char* name, int level) +{ + bp->ptr= (char *)RegisterEventSource(NULL, name); } -static int xcloselog(BIO* bp) +static void xsyslog(BIO *bp, int priority, const char *string) +{ + LPCSTR lpszStrings[2]; + WORD evtype= EVENTLOG_ERROR_TYPE; + int pid = _getpid(); + char pidbuf[20]; + + switch (priority) + { + case LOG_ERR: + evtype = EVENTLOG_ERROR_TYPE; + break; + case LOG_WARNING: + evtype = EVENTLOG_WARNING_TYPE; + break; + case LOG_INFO: + evtype = EVENTLOG_INFORMATION_TYPE; + break; + default: + evtype = EVENTLOG_ERROR_TYPE; + break; + } + + sprintf(pidbuf, "[%d] ", pid); + lpszStrings[0] = pidbuf; + lpszStrings[1] = string; + + if(bp->ptr) + ReportEvent(bp->ptr, evtype, 0, 1024, NULL, 2, 0, + lpszStrings, NULL); +} + +static void xcloselog(BIO* bp) { -#if defined(WIN32) if(bp->ptr) DeregisterEventSource((HANDLE)(bp->ptr)); bp->ptr= NULL; -#else +} + +#elif defined(VMS) + +static int VMS_OPC_target = LOG_DAEMON; + +static void xopenlog(BIO* bp, const char* name, int level) +{ + VMS_OPC_target = level; +} + +static void xsyslog(BIO *bp, int priority, const char *string) +{ + struct dsc$descriptor_s opc_dsc; + struct opcdef *opcdef_p; + char buf[10240]; + unsigned int len; + struct dsc$descriptor_s buf_dsc; + $DESCRIPTOR(fao_cmd, "!AZ: !AZ"); + char *priority_tag; + + switch (priority) + { + case LOG_EMERG: priority_tag = "Emergency"; break; + case LOG_ALERT: priority_tag = "Alert"; break; + case LOG_CRIT: priority_tag = "Critical"; break; + case LOG_ERR: priority_tag = "Error"; break; + case LOG_WARNING: priority_tag = "Warning"; break; + case LOG_NOTICE: priority_tag = "Notice"; break; + case LOG_INFO: priority_tag = "Info"; break; + case LOG_DEBUG: priority_tag = "DEBUG"; break; + } + + buf_dsc.dsc$b_dtype = DSC$K_DTYPE_T; + buf_dsc.dsc$b_class = DSC$K_CLASS_S; + buf_dsc.dsc$a_pointer = buf; + buf_dsc.dsc$w_length = sizeof(buf) - 1; + + lib$sys_fao(&fao_cmd, &len, &buf_dsc, priority_tag, string); + + /* we know there's an 8 byte header. That's documented */ + opcdef_p = (struct opcdef *) Malloc(8 + len); + opcdef_p->opc$b_ms_type = OPC$_RQ_RQST; + memcpy(opcdef_p->opc$z_ms_target_classes, &VMS_OPC_target, 3); + opcdef_p->opc$l_ms_rqstid = 0; + memcpy(&opcdef_p->opc$l_ms_text, buf, len); + + opc_dsc.dsc$b_dtype = DSC$K_DTYPE_T; + opc_dsc.dsc$b_class = DSC$K_CLASS_S; + opc_dsc.dsc$a_pointer = (char *)opcdef_p; + opc_dsc.dsc$w_length = len + 8; + + sys$sndopr(opc_dsc, 0); + + Free(opcdef_p); +} + +static void xcloselog(BIO* bp) +{ +} + +#else /* Unix */ + +static void xopenlog(BIO* bp, const char* name, int level) +{ + openlog(name, LOG_PID|LOG_CONS, level); +} + +static void xsyslog(BIO *bp, int priority, const char *string) +{ + syslog(priority, "%s", string); +} + +static void xcloselog(BIO* bp) +{ closelog(); -#endif - return(1); } -#endif +#endif /* Unix */ + +#endif /* NO_SYSLOG */ diff --git a/src/lib/libcrypto/bn/Makefile.ssl b/src/lib/libcrypto/bn/Makefile.ssl index fa23a43fa0..beb9c1b523 100644 --- a/src/lib/libcrypto/bn/Makefile.ssl +++ b/src/lib/libcrypto/bn/Makefile.ssl @@ -5,6 +5,7 @@ DIR= bn TOP= ../.. CC= cc +CPP= $(CC) -E INCLUDES= -I.. -I../../include CFLAG=-g INSTALL_PREFIX= @@ -72,10 +73,10 @@ lib: $(LIBOBJ) # elf asm/bn86-elf.o: asm/bn86unix.cpp - $(CPP) -DELF asm/bn86unix.cpp | as -o asm/bn86-elf.o + $(CPP) -DELF -x c asm/bn86unix.cpp | as -o asm/bn86-elf.o asm/co86-elf.o: asm/co86unix.cpp - $(CPP) -DELF asm/co86unix.cpp | as -o asm/co86-elf.o + $(CPP) -DELF -x c asm/co86unix.cpp | as -o asm/co86-elf.o # solaris asm/bn86-sol.o: asm/bn86unix.cpp @@ -102,10 +103,10 @@ asm/bn86bsdi.o: asm/bn86unix.cpp asm/co86bsdi.o: asm/co86unix.cpp $(CPP) -DBSDI asm/co86unix.cpp | sed 's/ :/:/' | as -o asm/co86bsdi.o -asm/bn86unix.cpp: asm/bn-586.pl +asm/bn86unix.cpp: asm/bn-586.pl ../perlasm/x86asm.pl (cd asm; $(PERL) bn-586.pl cpp >bn86unix.cpp ) -asm/co86unix.cpp: asm/co-586.pl +asm/co86unix.cpp: asm/co-586.pl ../perlasm/x86asm.pl (cd asm; $(PERL) co-586.pl cpp >co86unix.cpp ) asm/sparcv8.o: asm/sparcv8.S diff --git a/src/lib/libcrypto/bn/asm/bn-win32.asm b/src/lib/libcrypto/bn/asm/bn-win32.asm index 871bd88d77..e69de29bb2 100644 --- a/src/lib/libcrypto/bn/asm/bn-win32.asm +++ b/src/lib/libcrypto/bn/asm/bn-win32.asm @@ -1,2122 +0,0 @@ - ; Don't even think of reading this code - ; It was automatically generated by bn-586.pl - ; Which is a perl program used to generate the x86 assember for - ; any of elf, a.out, BSDI,Win32, or Solaris - ; eric - ; - TITLE bn-586.asm - .386 -.model FLAT -_TEXT SEGMENT -PUBLIC _bn_mul_add_words - -_bn_mul_add_words PROC NEAR - push ebp - push ebx - push esi - push edi - ; - xor esi, esi - mov edi, DWORD PTR 20[esp] - mov ecx, DWORD PTR 28[esp] - mov ebx, DWORD PTR 24[esp] - and ecx, 4294967288 - mov ebp, DWORD PTR 32[esp] - push ecx - jz $L000maw_finish -L001maw_loop: - mov DWORD PTR [esp],ecx - ; Round 0 - mov eax, DWORD PTR [ebx] - mul ebp - add eax, esi - mov esi, DWORD PTR [edi] - adc edx, 0 - add eax, esi - adc edx, 0 - mov DWORD PTR [edi],eax - mov esi, edx - ; Round 4 - mov eax, DWORD PTR 4[ebx] - mul ebp - add eax, esi - mov esi, DWORD PTR 4[edi] - adc edx, 0 - add eax, esi - adc edx, 0 - mov DWORD PTR 4[edi],eax - mov esi, edx - ; Round 8 - mov eax, DWORD PTR 8[ebx] - mul ebp - add eax, esi - mov esi, DWORD PTR 8[edi] - adc edx, 0 - add eax, esi - adc edx, 0 - mov DWORD PTR 8[edi],eax - mov esi, edx - ; Round 12 - mov eax, DWORD PTR 12[ebx] - mul ebp - add eax, esi - mov esi, DWORD PTR 12[edi] - adc edx, 0 - add eax, esi - adc edx, 0 - mov DWORD PTR 12[edi],eax - mov esi, edx - ; Round 16 - mov eax, DWORD PTR 16[ebx] - mul ebp - add eax, esi - mov esi, DWORD PTR 16[edi] - adc edx, 0 - add eax, esi - adc edx, 0 - mov DWORD PTR 16[edi],eax - mov esi, edx - ; Round 20 - mov eax, DWORD PTR 20[ebx] - mul ebp - add eax, esi - mov esi, DWORD PTR 20[edi] - adc edx, 0 - add eax, esi - adc edx, 0 - mov DWORD PTR 20[edi],eax - mov esi, edx - ; Round 24 - mov eax, DWORD PTR 24[ebx] - mul ebp - add eax, esi - mov esi, DWORD PTR 24[edi] - adc edx, 0 - add eax, esi - adc edx, 0 - mov DWORD PTR 24[edi],eax - mov esi, edx - ; Round 28 - mov eax, DWORD PTR 28[ebx] - mul ebp - add eax, esi - mov esi, DWORD PTR 28[edi] - adc edx, 0 - add eax, esi - adc edx, 0 - mov DWORD PTR 28[edi],eax - mov esi, edx - ; - mov ecx, DWORD PTR [esp] - add ebx, 32 - add edi, 32 - sub ecx, 8 - jnz L001maw_loop -$L000maw_finish: - mov ecx, DWORD PTR 32[esp] - and ecx, 7 - jnz $L002maw_finish2 - jmp $L003maw_end -$L002maw_finish2: - ; Tail Round 0 - mov eax, DWORD PTR [ebx] - mul ebp - add eax, esi - mov esi, DWORD PTR [edi] - adc edx, 0 - add eax, esi - adc edx, 0 - dec ecx - mov DWORD PTR [edi],eax - mov esi, edx - jz $L003maw_end - ; Tail Round 1 - mov eax, DWORD PTR 4[ebx] - mul ebp - add eax, esi - mov esi, DWORD PTR 4[edi] - adc edx, 0 - add eax, esi - adc edx, 0 - dec ecx - mov DWORD PTR 4[edi],eax - mov esi, edx - jz $L003maw_end - ; Tail Round 2 - mov eax, DWORD PTR 8[ebx] - mul ebp - add eax, esi - mov esi, DWORD PTR 8[edi] - adc edx, 0 - add eax, esi - adc edx, 0 - dec ecx - mov DWORD PTR 8[edi],eax - mov esi, edx - jz $L003maw_end - ; Tail Round 3 - mov eax, DWORD PTR 12[ebx] - mul ebp - add eax, esi - mov esi, DWORD PTR 12[edi] - adc edx, 0 - add eax, esi - adc edx, 0 - dec ecx - mov DWORD PTR 12[edi],eax - mov esi, edx - jz $L003maw_end - ; Tail Round 4 - mov eax, DWORD PTR 16[ebx] - mul ebp - add eax, esi - mov esi, DWORD PTR 16[edi] - adc edx, 0 - add eax, esi - adc edx, 0 - dec ecx - mov DWORD PTR 16[edi],eax - mov esi, edx - jz $L003maw_end - ; Tail Round 5 - mov eax, DWORD PTR 20[ebx] - mul ebp - add eax, esi - mov esi, DWORD PTR 20[edi] - adc edx, 0 - add eax, esi - adc edx, 0 - dec ecx - mov DWORD PTR 20[edi],eax - mov esi, edx - jz $L003maw_end - ; Tail Round 6 - mov eax, DWORD PTR 24[ebx] - mul ebp - add eax, esi - mov esi, DWORD PTR 24[edi] - adc edx, 0 - add eax, esi - adc edx, 0 - mov DWORD PTR 24[edi],eax - mov esi, edx -$L003maw_end: - mov eax, esi - pop ecx - pop edi - pop esi - pop ebx - pop ebp - ret -_bn_mul_add_words ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _bn_mul_words - -_bn_mul_words PROC NEAR - push ebp - push ebx - push esi - push edi - ; - xor esi, esi - mov edi, DWORD PTR 20[esp] - mov ebx, DWORD PTR 24[esp] - mov ebp, DWORD PTR 28[esp] - mov ecx, DWORD PTR 32[esp] - and ebp, 4294967288 - jz $L004mw_finish -L005mw_loop: - ; Round 0 - mov eax, DWORD PTR [ebx] - mul ecx - add eax, esi - adc edx, 0 - mov DWORD PTR [edi],eax - mov esi, edx - ; Round 4 - mov eax, DWORD PTR 4[ebx] - mul ecx - add eax, esi - adc edx, 0 - mov DWORD PTR 4[edi],eax - mov esi, edx - ; Round 8 - mov eax, DWORD PTR 8[ebx] - mul ecx - add eax, esi - adc edx, 0 - mov DWORD PTR 8[edi],eax - mov esi, edx - ; Round 12 - mov eax, DWORD PTR 12[ebx] - mul ecx - add eax, esi - adc edx, 0 - mov DWORD PTR 12[edi],eax - mov esi, edx - ; Round 16 - mov eax, DWORD PTR 16[ebx] - mul ecx - add eax, esi - adc edx, 0 - mov DWORD PTR 16[edi],eax - mov esi, edx - ; Round 20 - mov eax, DWORD PTR 20[ebx] - mul ecx - add eax, esi - adc edx, 0 - mov DWORD PTR 20[edi],eax - mov esi, edx - ; Round 24 - mov eax, DWORD PTR 24[ebx] - mul ecx - add eax, esi - adc edx, 0 - mov DWORD PTR 24[edi],eax - mov esi, edx - ; Round 28 - mov eax, DWORD PTR 28[ebx] - mul ecx - add eax, esi - adc edx, 0 - mov DWORD PTR 28[edi],eax - mov esi, edx - ; - add ebx, 32 - add edi, 32 - sub ebp, 8 - jz $L004mw_finish - jmp L005mw_loop -$L004mw_finish: - mov ebp, DWORD PTR 28[esp] - and ebp, 7 - jnz $L006mw_finish2 - jmp $L007mw_end -$L006mw_finish2: - ; Tail Round 0 - mov eax, DWORD PTR [ebx] - mul ecx - add eax, esi - adc edx, 0 - mov DWORD PTR [edi],eax - mov esi, edx - dec ebp - jz $L007mw_end - ; Tail Round 1 - mov eax, DWORD PTR 4[ebx] - mul ecx - add eax, esi - adc edx, 0 - mov DWORD PTR 4[edi],eax - mov esi, edx - dec ebp - jz $L007mw_end - ; Tail Round 2 - mov eax, DWORD PTR 8[ebx] - mul ecx - add eax, esi - adc edx, 0 - mov DWORD PTR 8[edi],eax - mov esi, edx - dec ebp - jz $L007mw_end - ; Tail Round 3 - mov eax, DWORD PTR 12[ebx] - mul ecx - add eax, esi - adc edx, 0 - mov DWORD PTR 12[edi],eax - mov esi, edx - dec ebp - jz $L007mw_end - ; Tail Round 4 - mov eax, DWORD PTR 16[ebx] - mul ecx - add eax, esi - adc edx, 0 - mov DWORD PTR 16[edi],eax - mov esi, edx - dec ebp - jz $L007mw_end - ; Tail Round 5 - mov eax, DWORD PTR 20[ebx] - mul ecx - add eax, esi - adc edx, 0 - mov DWORD PTR 20[edi],eax - mov esi, edx - dec ebp - jz $L007mw_end - ; Tail Round 6 - mov eax, DWORD PTR 24[ebx] - mul ecx - add eax, esi - adc edx, 0 - mov DWORD PTR 24[edi],eax - mov esi, edx -$L007mw_end: - mov eax, esi - pop edi - pop esi - pop ebx - pop ebp - ret -_bn_mul_words ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _bn_sqr_words - -_bn_sqr_words PROC NEAR - push ebp - push ebx - push esi - push edi - ; - mov esi, DWORD PTR 20[esp] - mov edi, DWORD PTR 24[esp] - mov ebx, DWORD PTR 28[esp] - and ebx, 4294967288 - jz $L008sw_finish -L009sw_loop: - ; Round 0 - mov eax, DWORD PTR [edi] - mul eax - mov DWORD PTR [esi],eax - mov DWORD PTR 4[esi],edx - ; Round 4 - mov eax, DWORD PTR 4[edi] - mul eax - mov DWORD PTR 8[esi],eax - mov DWORD PTR 12[esi],edx - ; Round 8 - mov eax, DWORD PTR 8[edi] - mul eax - mov DWORD PTR 16[esi],eax - mov DWORD PTR 20[esi],edx - ; Round 12 - mov eax, DWORD PTR 12[edi] - mul eax - mov DWORD PTR 24[esi],eax - mov DWORD PTR 28[esi],edx - ; Round 16 - mov eax, DWORD PTR 16[edi] - mul eax - mov DWORD PTR 32[esi],eax - mov DWORD PTR 36[esi],edx - ; Round 20 - mov eax, DWORD PTR 20[edi] - mul eax - mov DWORD PTR 40[esi],eax - mov DWORD PTR 44[esi],edx - ; Round 24 - mov eax, DWORD PTR 24[edi] - mul eax - mov DWORD PTR 48[esi],eax - mov DWORD PTR 52[esi],edx - ; Round 28 - mov eax, DWORD PTR 28[edi] - mul eax - mov DWORD PTR 56[esi],eax - mov DWORD PTR 60[esi],edx - ; - add edi, 32 - add esi, 64 - sub ebx, 8 - jnz L009sw_loop -$L008sw_finish: - mov ebx, DWORD PTR 28[esp] - and ebx, 7 - jz $L010sw_end - ; Tail Round 0 - mov eax, DWORD PTR [edi] - mul eax - mov DWORD PTR [esi],eax - dec ebx - mov DWORD PTR 4[esi],edx - jz $L010sw_end - ; Tail Round 1 - mov eax, DWORD PTR 4[edi] - mul eax - mov DWORD PTR 8[esi],eax - dec ebx - mov DWORD PTR 12[esi],edx - jz $L010sw_end - ; Tail Round 2 - mov eax, DWORD PTR 8[edi] - mul eax - mov DWORD PTR 16[esi],eax - dec ebx - mov DWORD PTR 20[esi],edx - jz $L010sw_end - ; Tail Round 3 - mov eax, DWORD PTR 12[edi] - mul eax - mov DWORD PTR 24[esi],eax - dec ebx - mov DWORD PTR 28[esi],edx - jz $L010sw_end - ; Tail Round 4 - mov eax, DWORD PTR 16[edi] - mul eax - mov DWORD PTR 32[esi],eax - dec ebx - mov DWORD PTR 36[esi],edx - jz $L010sw_end - ; Tail Round 5 - mov eax, DWORD PTR 20[edi] - mul eax - mov DWORD PTR 40[esi],eax - dec ebx - mov DWORD PTR 44[esi],edx - jz $L010sw_end - ; Tail Round 6 - mov eax, DWORD PTR 24[edi] - mul eax - mov DWORD PTR 48[esi],eax - mov DWORD PTR 52[esi],edx -$L010sw_end: - pop edi - pop esi - pop ebx - pop ebp - ret -_bn_sqr_words ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _bn_div_words - -_bn_div_words PROC NEAR - push ebp - push ebx - push esi - push edi - mov edx, DWORD PTR 20[esp] - mov eax, DWORD PTR 24[esp] - mov ebx, DWORD PTR 28[esp] - div ebx - pop edi - pop esi - pop ebx - pop ebp - ret -_bn_div_words ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _bn_add_words - -_bn_add_words PROC NEAR - push ebp - push ebx - push esi - push edi - ; - mov ebx, DWORD PTR 20[esp] - mov esi, DWORD PTR 24[esp] - mov edi, DWORD PTR 28[esp] - mov ebp, DWORD PTR 32[esp] - xor eax, eax - and ebp, 4294967288 - jz $L011aw_finish -L012aw_loop: - ; Round 0 - mov ecx, DWORD PTR [esi] - mov edx, DWORD PTR [edi] - add ecx, eax - mov eax, 0 - adc eax, eax - add ecx, edx - adc eax, 0 - mov DWORD PTR [ebx],ecx - ; Round 1 - mov ecx, DWORD PTR 4[esi] - mov edx, DWORD PTR 4[edi] - add ecx, eax - mov eax, 0 - adc eax, eax - add ecx, edx - adc eax, 0 - mov DWORD PTR 4[ebx],ecx - ; Round 2 - mov ecx, DWORD PTR 8[esi] - mov edx, DWORD PTR 8[edi] - add ecx, eax - mov eax, 0 - adc eax, eax - add ecx, edx - adc eax, 0 - mov DWORD PTR 8[ebx],ecx - ; Round 3 - mov ecx, DWORD PTR 12[esi] - mov edx, DWORD PTR 12[edi] - add ecx, eax - mov eax, 0 - adc eax, eax - add ecx, edx - adc eax, 0 - mov DWORD PTR 12[ebx],ecx - ; Round 4 - mov ecx, DWORD PTR 16[esi] - mov edx, DWORD PTR 16[edi] - add ecx, eax - mov eax, 0 - adc eax, eax - add ecx, edx - adc eax, 0 - mov DWORD PTR 16[ebx],ecx - ; Round 5 - mov ecx, DWORD PTR 20[esi] - mov edx, DWORD PTR 20[edi] - add ecx, eax - mov eax, 0 - adc eax, eax - add ecx, edx - adc eax, 0 - mov DWORD PTR 20[ebx],ecx - ; Round 6 - mov ecx, DWORD PTR 24[esi] - mov edx, DWORD PTR 24[edi] - add ecx, eax - mov eax, 0 - adc eax, eax - add ecx, edx - adc eax, 0 - mov DWORD PTR 24[ebx],ecx - ; Round 7 - mov ecx, DWORD PTR 28[esi] - mov edx, DWORD PTR 28[edi] - add ecx, eax - mov eax, 0 - adc eax, eax - add ecx, edx - adc eax, 0 - mov DWORD PTR 28[ebx],ecx - ; - add esi, 32 - add edi, 32 - add ebx, 32 - sub ebp, 8 - jnz L012aw_loop -$L011aw_finish: - mov ebp, DWORD PTR 32[esp] - and ebp, 7 - jz $L013aw_end - ; Tail Round 0 - mov ecx, DWORD PTR [esi] - mov edx, DWORD PTR [edi] - add ecx, eax - mov eax, 0 - adc eax, eax - add ecx, edx - adc eax, 0 - dec ebp - mov DWORD PTR [ebx],ecx - jz $L013aw_end - ; Tail Round 1 - mov ecx, DWORD PTR 4[esi] - mov edx, DWORD PTR 4[edi] - add ecx, eax - mov eax, 0 - adc eax, eax - add ecx, edx - adc eax, 0 - dec ebp - mov DWORD PTR 4[ebx],ecx - jz $L013aw_end - ; Tail Round 2 - mov ecx, DWORD PTR 8[esi] - mov edx, DWORD PTR 8[edi] - add ecx, eax - mov eax, 0 - adc eax, eax - add ecx, edx - adc eax, 0 - dec ebp - mov DWORD PTR 8[ebx],ecx - jz $L013aw_end - ; Tail Round 3 - mov ecx, DWORD PTR 12[esi] - mov edx, DWORD PTR 12[edi] - add ecx, eax - mov eax, 0 - adc eax, eax - add ecx, edx - adc eax, 0 - dec ebp - mov DWORD PTR 12[ebx],ecx - jz $L013aw_end - ; Tail Round 4 - mov ecx, DWORD PTR 16[esi] - mov edx, DWORD PTR 16[edi] - add ecx, eax - mov eax, 0 - adc eax, eax - add ecx, edx - adc eax, 0 - dec ebp - mov DWORD PTR 16[ebx],ecx - jz $L013aw_end - ; Tail Round 5 - mov ecx, DWORD PTR 20[esi] - mov edx, DWORD PTR 20[edi] - add ecx, eax - mov eax, 0 - adc eax, eax - add ecx, edx - adc eax, 0 - dec ebp - mov DWORD PTR 20[ebx],ecx - jz $L013aw_end - ; Tail Round 6 - mov ecx, DWORD PTR 24[esi] - mov edx, DWORD PTR 24[edi] - add ecx, eax - mov eax, 0 - adc eax, eax - add ecx, edx - adc eax, 0 - mov DWORD PTR 24[ebx],ecx -$L013aw_end: - pop edi - pop esi - pop ebx - pop ebp - ret -_bn_add_words ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _bn_sub_words - -_bn_sub_words PROC NEAR - push ebp - push ebx - push esi - push edi - ; - mov ebx, DWORD PTR 20[esp] - mov esi, DWORD PTR 24[esp] - mov edi, DWORD PTR 28[esp] - mov ebp, DWORD PTR 32[esp] - xor eax, eax - and ebp, 4294967288 - jz $L014aw_finish -L015aw_loop: - ; Round 0 - mov ecx, DWORD PTR [esi] - mov edx, DWORD PTR [edi] - sub ecx, eax - mov eax, 0 - adc eax, eax - sub ecx, edx - adc eax, 0 - mov DWORD PTR [ebx],ecx - ; Round 1 - mov ecx, DWORD PTR 4[esi] - mov edx, DWORD PTR 4[edi] - sub ecx, eax - mov eax, 0 - adc eax, eax - sub ecx, edx - adc eax, 0 - mov DWORD PTR 4[ebx],ecx - ; Round 2 - mov ecx, DWORD PTR 8[esi] - mov edx, DWORD PTR 8[edi] - sub ecx, eax - mov eax, 0 - adc eax, eax - sub ecx, edx - adc eax, 0 - mov DWORD PTR 8[ebx],ecx - ; Round 3 - mov ecx, DWORD PTR 12[esi] - mov edx, DWORD PTR 12[edi] - sub ecx, eax - mov eax, 0 - adc eax, eax - sub ecx, edx - adc eax, 0 - mov DWORD PTR 12[ebx],ecx - ; Round 4 - mov ecx, DWORD PTR 16[esi] - mov edx, DWORD PTR 16[edi] - sub ecx, eax - mov eax, 0 - adc eax, eax - sub ecx, edx - adc eax, 0 - mov DWORD PTR 16[ebx],ecx - ; Round 5 - mov ecx, DWORD PTR 20[esi] - mov edx, DWORD PTR 20[edi] - sub ecx, eax - mov eax, 0 - adc eax, eax - sub ecx, edx - adc eax, 0 - mov DWORD PTR 20[ebx],ecx - ; Round 6 - mov ecx, DWORD PTR 24[esi] - mov edx, DWORD PTR 24[edi] - sub ecx, eax - mov eax, 0 - adc eax, eax - sub ecx, edx - adc eax, 0 - mov DWORD PTR 24[ebx],ecx - ; Round 7 - mov ecx, DWORD PTR 28[esi] - mov edx, DWORD PTR 28[edi] - sub ecx, eax - mov eax, 0 - adc eax, eax - sub ecx, edx - adc eax, 0 - mov DWORD PTR 28[ebx],ecx - ; - add esi, 32 - add edi, 32 - add ebx, 32 - sub ebp, 8 - jnz L015aw_loop -$L014aw_finish: - mov ebp, DWORD PTR 32[esp] - and ebp, 7 - jz $L016aw_end - ; Tail Round 0 - mov ecx, DWORD PTR [esi] - mov edx, DWORD PTR [edi] - sub ecx, eax - mov eax, 0 - adc eax, eax - sub ecx, edx - adc eax, 0 - dec ebp - mov DWORD PTR [ebx],ecx - jz $L016aw_end - ; Tail Round 1 - mov ecx, DWORD PTR 4[esi] - mov edx, DWORD PTR 4[edi] - sub ecx, eax - mov eax, 0 - adc eax, eax - sub ecx, edx - adc eax, 0 - dec ebp - mov DWORD PTR 4[ebx],ecx - jz $L016aw_end - ; Tail Round 2 - mov ecx, DWORD PTR 8[esi] - mov edx, DWORD PTR 8[edi] - sub ecx, eax - mov eax, 0 - adc eax, eax - sub ecx, edx - adc eax, 0 - dec ebp - mov DWORD PTR 8[ebx],ecx - jz $L016aw_end - ; Tail Round 3 - mov ecx, DWORD PTR 12[esi] - mov edx, DWORD PTR 12[edi] - sub ecx, eax - mov eax, 0 - adc eax, eax - sub ecx, edx - adc eax, 0 - dec ebp - mov DWORD PTR 12[ebx],ecx - jz $L016aw_end - ; Tail Round 4 - mov ecx, DWORD PTR 16[esi] - mov edx, DWORD PTR 16[edi] - sub ecx, eax - mov eax, 0 - adc eax, eax - sub ecx, edx - adc eax, 0 - dec ebp - mov DWORD PTR 16[ebx],ecx - jz $L016aw_end - ; Tail Round 5 - mov ecx, DWORD PTR 20[esi] - mov edx, DWORD PTR 20[edi] - sub ecx, eax - mov eax, 0 - adc eax, eax - sub ecx, edx - adc eax, 0 - dec ebp - mov DWORD PTR 20[ebx],ecx - jz $L016aw_end - ; Tail Round 6 - mov ecx, DWORD PTR 24[esi] - mov edx, DWORD PTR 24[edi] - sub ecx, eax - mov eax, 0 - adc eax, eax - sub ecx, edx - adc eax, 0 - mov DWORD PTR 24[ebx],ecx -$L016aw_end: - pop edi - pop esi - pop ebx - pop ebp - ret -_bn_sub_words ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _bn_mul_comba8 - -_bn_mul_comba8 PROC NEAR - push esi - mov esi, DWORD PTR 12[esp] - push edi - mov edi, DWORD PTR 20[esp] - push ebp - push ebx - xor ebx, ebx - mov eax, DWORD PTR [esi] - xor ecx, ecx - mov edx, DWORD PTR [edi] - ; ################## Calculate word 0 - xor ebp, ebp - ; mul a[0]*b[0] - mul edx - add ebx, eax - mov eax, DWORD PTR 20[esp] - adc ecx, edx - mov edx, DWORD PTR [edi] - adc ebp, 0 - mov DWORD PTR [eax],ebx - mov eax, DWORD PTR 4[esi] - ; saved r[0] - ; ################## Calculate word 1 - xor ebx, ebx - ; mul a[1]*b[0] - mul edx - add ecx, eax - mov eax, DWORD PTR [esi] - adc ebp, edx - mov edx, DWORD PTR 4[edi] - adc ebx, 0 - ; mul a[0]*b[1] - mul edx - add ecx, eax - mov eax, DWORD PTR 20[esp] - adc ebp, edx - mov edx, DWORD PTR [edi] - adc ebx, 0 - mov DWORD PTR 4[eax],ecx - mov eax, DWORD PTR 8[esi] - ; saved r[1] - ; ################## Calculate word 2 - xor ecx, ecx - ; mul a[2]*b[0] - mul edx - add ebp, eax - mov eax, DWORD PTR 4[esi] - adc ebx, edx - mov edx, DWORD PTR 4[edi] - adc ecx, 0 - ; mul a[1]*b[1] - mul edx - add ebp, eax - mov eax, DWORD PTR [esi] - adc ebx, edx - mov edx, DWORD PTR 8[edi] - adc ecx, 0 - ; mul a[0]*b[2] - mul edx - add ebp, eax - mov eax, DWORD PTR 20[esp] - adc ebx, edx - mov edx, DWORD PTR [edi] - adc ecx, 0 - mov DWORD PTR 8[eax],ebp - mov eax, DWORD PTR 12[esi] - ; saved r[2] - ; ################## Calculate word 3 - xor ebp, ebp - ; mul a[3]*b[0] - mul edx - add ebx, eax - mov eax, DWORD PTR 8[esi] - adc ecx, edx - mov edx, DWORD PTR 4[edi] - adc ebp, 0 - ; mul a[2]*b[1] - mul edx - add ebx, eax - mov eax, DWORD PTR 4[esi] - adc ecx, edx - mov edx, DWORD PTR 8[edi] - adc ebp, 0 - ; mul a[1]*b[2] - mul edx - add ebx, eax - mov eax, DWORD PTR [esi] - adc ecx, edx - mov edx, DWORD PTR 12[edi] - adc ebp, 0 - ; mul a[0]*b[3] - mul edx - add ebx, eax - mov eax, DWORD PTR 20[esp] - adc ecx, edx - mov edx, DWORD PTR [edi] - adc ebp, 0 - mov DWORD PTR 12[eax],ebx - mov eax, DWORD PTR 16[esi] - ; saved r[3] - ; ################## Calculate word 4 - xor ebx, ebx - ; mul a[4]*b[0] - mul edx - add ecx, eax - mov eax, DWORD PTR 12[esi] - adc ebp, edx - mov edx, DWORD PTR 4[edi] - adc ebx, 0 - ; mul a[3]*b[1] - mul edx - add ecx, eax - mov eax, DWORD PTR 8[esi] - adc ebp, edx - mov edx, DWORD PTR 8[edi] - adc ebx, 0 - ; mul a[2]*b[2] - mul edx - add ecx, eax - mov eax, DWORD PTR 4[esi] - adc ebp, edx - mov edx, DWORD PTR 12[edi] - adc ebx, 0 - ; mul a[1]*b[3] - mul edx - add ecx, eax - mov eax, DWORD PTR [esi] - adc ebp, edx - mov edx, DWORD PTR 16[edi] - adc ebx, 0 - ; mul a[0]*b[4] - mul edx - add ecx, eax - mov eax, DWORD PTR 20[esp] - adc ebp, edx - mov edx, DWORD PTR [edi] - adc ebx, 0 - mov DWORD PTR 16[eax],ecx - mov eax, DWORD PTR 20[esi] - ; saved r[4] - ; ################## Calculate word 5 - xor ecx, ecx - ; mul a[5]*b[0] - mul edx - add ebp, eax - mov eax, DWORD PTR 16[esi] - adc ebx, edx - mov edx, DWORD PTR 4[edi] - adc ecx, 0 - ; mul a[4]*b[1] - mul edx - add ebp, eax - mov eax, DWORD PTR 12[esi] - adc ebx, edx - mov edx, DWORD PTR 8[edi] - adc ecx, 0 - ; mul a[3]*b[2] - mul edx - add ebp, eax - mov eax, DWORD PTR 8[esi] - adc ebx, edx - mov edx, DWORD PTR 12[edi] - adc ecx, 0 - ; mul a[2]*b[3] - mul edx - add ebp, eax - mov eax, DWORD PTR 4[esi] - adc ebx, edx - mov edx, DWORD PTR 16[edi] - adc ecx, 0 - ; mul a[1]*b[4] - mul edx - add ebp, eax - mov eax, DWORD PTR [esi] - adc ebx, edx - mov edx, DWORD PTR 20[edi] - adc ecx, 0 - ; mul a[0]*b[5] - mul edx - add ebp, eax - mov eax, DWORD PTR 20[esp] - adc ebx, edx - mov edx, DWORD PTR [edi] - adc ecx, 0 - mov DWORD PTR 20[eax],ebp - mov eax, DWORD PTR 24[esi] - ; saved r[5] - ; ################## Calculate word 6 - xor ebp, ebp - ; mul a[6]*b[0] - mul edx - add ebx, eax - mov eax, DWORD PTR 20[esi] - adc ecx, edx - mov edx, DWORD PTR 4[edi] - adc ebp, 0 - ; mul a[5]*b[1] - mul edx - add ebx, eax - mov eax, DWORD PTR 16[esi] - adc ecx, edx - mov edx, DWORD PTR 8[edi] - adc ebp, 0 - ; mul a[4]*b[2] - mul edx - add ebx, eax - mov eax, DWORD PTR 12[esi] - adc ecx, edx - mov edx, DWORD PTR 12[edi] - adc ebp, 0 - ; mul a[3]*b[3] - mul edx - add ebx, eax - mov eax, DWORD PTR 8[esi] - adc ecx, edx - mov edx, DWORD PTR 16[edi] - adc ebp, 0 - ; mul a[2]*b[4] - mul edx - add ebx, eax - mov eax, DWORD PTR 4[esi] - adc ecx, edx - mov edx, DWORD PTR 20[edi] - adc ebp, 0 - ; mul a[1]*b[5] - mul edx - add ebx, eax - mov eax, DWORD PTR [esi] - adc ecx, edx - mov edx, DWORD PTR 24[edi] - adc ebp, 0 - ; mul a[0]*b[6] - mul edx - add ebx, eax - mov eax, DWORD PTR 20[esp] - adc ecx, edx - mov edx, DWORD PTR [edi] - adc ebp, 0 - mov DWORD PTR 24[eax],ebx - mov eax, DWORD PTR 28[esi] - ; saved r[6] - ; ################## Calculate word 7 - xor ebx, ebx - ; mul a[7]*b[0] - mul edx - add ecx, eax - mov eax, DWORD PTR 24[esi] - adc ebp, edx - mov edx, DWORD PTR 4[edi] - adc ebx, 0 - ; mul a[6]*b[1] - mul edx - add ecx, eax - mov eax, DWORD PTR 20[esi] - adc ebp, edx - mov edx, DWORD PTR 8[edi] - adc ebx, 0 - ; mul a[5]*b[2] - mul edx - add ecx, eax - mov eax, DWORD PTR 16[esi] - adc ebp, edx - mov edx, DWORD PTR 12[edi] - adc ebx, 0 - ; mul a[4]*b[3] - mul edx - add ecx, eax - mov eax, DWORD PTR 12[esi] - adc ebp, edx - mov edx, DWORD PTR 16[edi] - adc ebx, 0 - ; mul a[3]*b[4] - mul edx - add ecx, eax - mov eax, DWORD PTR 8[esi] - adc ebp, edx - mov edx, DWORD PTR 20[edi] - adc ebx, 0 - ; mul a[2]*b[5] - mul edx - add ecx, eax - mov eax, DWORD PTR 4[esi] - adc ebp, edx - mov edx, DWORD PTR 24[edi] - adc ebx, 0 - ; mul a[1]*b[6] - mul edx - add ecx, eax - mov eax, DWORD PTR [esi] - adc ebp, edx - mov edx, DWORD PTR 28[edi] - adc ebx, 0 - ; mul a[0]*b[7] - mul edx - add ecx, eax - mov eax, DWORD PTR 20[esp] - adc ebp, edx - mov edx, DWORD PTR 4[edi] - adc ebx, 0 - mov DWORD PTR 28[eax],ecx - mov eax, DWORD PTR 28[esi] - ; saved r[7] - ; ################## Calculate word 8 - xor ecx, ecx - ; mul a[7]*b[1] - mul edx - add ebp, eax - mov eax, DWORD PTR 24[esi] - adc ebx, edx - mov edx, DWORD PTR 8[edi] - adc ecx, 0 - ; mul a[6]*b[2] - mul edx - add ebp, eax - mov eax, DWORD PTR 20[esi] - adc ebx, edx - mov edx, DWORD PTR 12[edi] - adc ecx, 0 - ; mul a[5]*b[3] - mul edx - add ebp, eax - mov eax, DWORD PTR 16[esi] - adc ebx, edx - mov edx, DWORD PTR 16[edi] - adc ecx, 0 - ; mul a[4]*b[4] - mul edx - add ebp, eax - mov eax, DWORD PTR 12[esi] - adc ebx, edx - mov edx, DWORD PTR 20[edi] - adc ecx, 0 - ; mul a[3]*b[5] - mul edx - add ebp, eax - mov eax, DWORD PTR 8[esi] - adc ebx, edx - mov edx, DWORD PTR 24[edi] - adc ecx, 0 - ; mul a[2]*b[6] - mul edx - add ebp, eax - mov eax, DWORD PTR 4[esi] - adc ebx, edx - mov edx, DWORD PTR 28[edi] - adc ecx, 0 - ; mul a[1]*b[7] - mul edx - add ebp, eax - mov eax, DWORD PTR 20[esp] - adc ebx, edx - mov edx, DWORD PTR 8[edi] - adc ecx, 0 - mov DWORD PTR 32[eax],ebp - mov eax, DWORD PTR 28[esi] - ; saved r[8] - ; ################## Calculate word 9 - xor ebp, ebp - ; mul a[7]*b[2] - mul edx - add ebx, eax - mov eax, DWORD PTR 24[esi] - adc ecx, edx - mov edx, DWORD PTR 12[edi] - adc ebp, 0 - ; mul a[6]*b[3] - mul edx - add ebx, eax - mov eax, DWORD PTR 20[esi] - adc ecx, edx - mov edx, DWORD PTR 16[edi] - adc ebp, 0 - ; mul a[5]*b[4] - mul edx - add ebx, eax - mov eax, DWORD PTR 16[esi] - adc ecx, edx - mov edx, DWORD PTR 20[edi] - adc ebp, 0 - ; mul a[4]*b[5] - mul edx - add ebx, eax - mov eax, DWORD PTR 12[esi] - adc ecx, edx - mov edx, DWORD PTR 24[edi] - adc ebp, 0 - ; mul a[3]*b[6] - mul edx - add ebx, eax - mov eax, DWORD PTR 8[esi] - adc ecx, edx - mov edx, DWORD PTR 28[edi] - adc ebp, 0 - ; mul a[2]*b[7] - mul edx - add ebx, eax - mov eax, DWORD PTR 20[esp] - adc ecx, edx - mov edx, DWORD PTR 12[edi] - adc ebp, 0 - mov DWORD PTR 36[eax],ebx - mov eax, DWORD PTR 28[esi] - ; saved r[9] - ; ################## Calculate word 10 - xor ebx, ebx - ; mul a[7]*b[3] - mul edx - add ecx, eax - mov eax, DWORD PTR 24[esi] - adc ebp, edx - mov edx, DWORD PTR 16[edi] - adc ebx, 0 - ; mul a[6]*b[4] - mul edx - add ecx, eax - mov eax, DWORD PTR 20[esi] - adc ebp, edx - mov edx, DWORD PTR 20[edi] - adc ebx, 0 - ; mul a[5]*b[5] - mul edx - add ecx, eax - mov eax, DWORD PTR 16[esi] - adc ebp, edx - mov edx, DWORD PTR 24[edi] - adc ebx, 0 - ; mul a[4]*b[6] - mul edx - add ecx, eax - mov eax, DWORD PTR 12[esi] - adc ebp, edx - mov edx, DWORD PTR 28[edi] - adc ebx, 0 - ; mul a[3]*b[7] - mul edx - add ecx, eax - mov eax, DWORD PTR 20[esp] - adc ebp, edx - mov edx, DWORD PTR 16[edi] - adc ebx, 0 - mov DWORD PTR 40[eax],ecx - mov eax, DWORD PTR 28[esi] - ; saved r[10] - ; ################## Calculate word 11 - xor ecx, ecx - ; mul a[7]*b[4] - mul edx - add ebp, eax - mov eax, DWORD PTR 24[esi] - adc ebx, edx - mov edx, DWORD PTR 20[edi] - adc ecx, 0 - ; mul a[6]*b[5] - mul edx - add ebp, eax - mov eax, DWORD PTR 20[esi] - adc ebx, edx - mov edx, DWORD PTR 24[edi] - adc ecx, 0 - ; mul a[5]*b[6] - mul edx - add ebp, eax - mov eax, DWORD PTR 16[esi] - adc ebx, edx - mov edx, DWORD PTR 28[edi] - adc ecx, 0 - ; mul a[4]*b[7] - mul edx - add ebp, eax - mov eax, DWORD PTR 20[esp] - adc ebx, edx - mov edx, DWORD PTR 20[edi] - adc ecx, 0 - mov DWORD PTR 44[eax],ebp - mov eax, DWORD PTR 28[esi] - ; saved r[11] - ; ################## Calculate word 12 - xor ebp, ebp - ; mul a[7]*b[5] - mul edx - add ebx, eax - mov eax, DWORD PTR 24[esi] - adc ecx, edx - mov edx, DWORD PTR 24[edi] - adc ebp, 0 - ; mul a[6]*b[6] - mul edx - add ebx, eax - mov eax, DWORD PTR 20[esi] - adc ecx, edx - mov edx, DWORD PTR 28[edi] - adc ebp, 0 - ; mul a[5]*b[7] - mul edx - add ebx, eax - mov eax, DWORD PTR 20[esp] - adc ecx, edx - mov edx, DWORD PTR 24[edi] - adc ebp, 0 - mov DWORD PTR 48[eax],ebx - mov eax, DWORD PTR 28[esi] - ; saved r[12] - ; ################## Calculate word 13 - xor ebx, ebx - ; mul a[7]*b[6] - mul edx - add ecx, eax - mov eax, DWORD PTR 24[esi] - adc ebp, edx - mov edx, DWORD PTR 28[edi] - adc ebx, 0 - ; mul a[6]*b[7] - mul edx - add ecx, eax - mov eax, DWORD PTR 20[esp] - adc ebp, edx - mov edx, DWORD PTR 28[edi] - adc ebx, 0 - mov DWORD PTR 52[eax],ecx - mov eax, DWORD PTR 28[esi] - ; saved r[13] - ; ################## Calculate word 14 - xor ecx, ecx - ; mul a[7]*b[7] - mul edx - add ebp, eax - mov eax, DWORD PTR 20[esp] - adc ebx, edx - adc ecx, 0 - mov DWORD PTR 56[eax],ebp - ; saved r[14] - ; save r[15] - mov DWORD PTR 60[eax],ebx - pop ebx - pop ebp - pop edi - pop esi - ret -_bn_mul_comba8 ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _bn_mul_comba4 - -_bn_mul_comba4 PROC NEAR - push esi - mov esi, DWORD PTR 12[esp] - push edi - mov edi, DWORD PTR 20[esp] - push ebp - push ebx - xor ebx, ebx - mov eax, DWORD PTR [esi] - xor ecx, ecx - mov edx, DWORD PTR [edi] - ; ################## Calculate word 0 - xor ebp, ebp - ; mul a[0]*b[0] - mul edx - add ebx, eax - mov eax, DWORD PTR 20[esp] - adc ecx, edx - mov edx, DWORD PTR [edi] - adc ebp, 0 - mov DWORD PTR [eax],ebx - mov eax, DWORD PTR 4[esi] - ; saved r[0] - ; ################## Calculate word 1 - xor ebx, ebx - ; mul a[1]*b[0] - mul edx - add ecx, eax - mov eax, DWORD PTR [esi] - adc ebp, edx - mov edx, DWORD PTR 4[edi] - adc ebx, 0 - ; mul a[0]*b[1] - mul edx - add ecx, eax - mov eax, DWORD PTR 20[esp] - adc ebp, edx - mov edx, DWORD PTR [edi] - adc ebx, 0 - mov DWORD PTR 4[eax],ecx - mov eax, DWORD PTR 8[esi] - ; saved r[1] - ; ################## Calculate word 2 - xor ecx, ecx - ; mul a[2]*b[0] - mul edx - add ebp, eax - mov eax, DWORD PTR 4[esi] - adc ebx, edx - mov edx, DWORD PTR 4[edi] - adc ecx, 0 - ; mul a[1]*b[1] - mul edx - add ebp, eax - mov eax, DWORD PTR [esi] - adc ebx, edx - mov edx, DWORD PTR 8[edi] - adc ecx, 0 - ; mul a[0]*b[2] - mul edx - add ebp, eax - mov eax, DWORD PTR 20[esp] - adc ebx, edx - mov edx, DWORD PTR [edi] - adc ecx, 0 - mov DWORD PTR 8[eax],ebp - mov eax, DWORD PTR 12[esi] - ; saved r[2] - ; ################## Calculate word 3 - xor ebp, ebp - ; mul a[3]*b[0] - mul edx - add ebx, eax - mov eax, DWORD PTR 8[esi] - adc ecx, edx - mov edx, DWORD PTR 4[edi] - adc ebp, 0 - ; mul a[2]*b[1] - mul edx - add ebx, eax - mov eax, DWORD PTR 4[esi] - adc ecx, edx - mov edx, DWORD PTR 8[edi] - adc ebp, 0 - ; mul a[1]*b[2] - mul edx - add ebx, eax - mov eax, DWORD PTR [esi] - adc ecx, edx - mov edx, DWORD PTR 12[edi] - adc ebp, 0 - ; mul a[0]*b[3] - mul edx - add ebx, eax - mov eax, DWORD PTR 20[esp] - adc ecx, edx - mov edx, DWORD PTR 4[edi] - adc ebp, 0 - mov DWORD PTR 12[eax],ebx - mov eax, DWORD PTR 12[esi] - ; saved r[3] - ; ################## Calculate word 4 - xor ebx, ebx - ; mul a[3]*b[1] - mul edx - add ecx, eax - mov eax, DWORD PTR 8[esi] - adc ebp, edx - mov edx, DWORD PTR 8[edi] - adc ebx, 0 - ; mul a[2]*b[2] - mul edx - add ecx, eax - mov eax, DWORD PTR 4[esi] - adc ebp, edx - mov edx, DWORD PTR 12[edi] - adc ebx, 0 - ; mul a[1]*b[3] - mul edx - add ecx, eax - mov eax, DWORD PTR 20[esp] - adc ebp, edx - mov edx, DWORD PTR 8[edi] - adc ebx, 0 - mov DWORD PTR 16[eax],ecx - mov eax, DWORD PTR 12[esi] - ; saved r[4] - ; ################## Calculate word 5 - xor ecx, ecx - ; mul a[3]*b[2] - mul edx - add ebp, eax - mov eax, DWORD PTR 8[esi] - adc ebx, edx - mov edx, DWORD PTR 12[edi] - adc ecx, 0 - ; mul a[2]*b[3] - mul edx - add ebp, eax - mov eax, DWORD PTR 20[esp] - adc ebx, edx - mov edx, DWORD PTR 12[edi] - adc ecx, 0 - mov DWORD PTR 20[eax],ebp - mov eax, DWORD PTR 12[esi] - ; saved r[5] - ; ################## Calculate word 6 - xor ebp, ebp - ; mul a[3]*b[3] - mul edx - add ebx, eax - mov eax, DWORD PTR 20[esp] - adc ecx, edx - adc ebp, 0 - mov DWORD PTR 24[eax],ebx - ; saved r[6] - ; save r[7] - mov DWORD PTR 28[eax],ecx - pop ebx - pop ebp - pop edi - pop esi - ret -_bn_mul_comba4 ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _bn_sqr_comba8 - -_bn_sqr_comba8 PROC NEAR - push esi - push edi - push ebp - push ebx - mov edi, DWORD PTR 20[esp] - mov esi, DWORD PTR 24[esp] - xor ebx, ebx - xor ecx, ecx - mov eax, DWORD PTR [esi] - ; ############### Calculate word 0 - xor ebp, ebp - ; sqr a[0]*a[0] - mul eax - add ebx, eax - adc ecx, edx - mov edx, DWORD PTR [esi] - adc ebp, 0 - mov DWORD PTR [edi],ebx - mov eax, DWORD PTR 4[esi] - ; saved r[0] - ; ############### Calculate word 1 - xor ebx, ebx - ; sqr a[1]*a[0] - mul edx - add eax, eax - adc edx, edx - adc ebx, 0 - add ecx, eax - adc ebp, edx - mov eax, DWORD PTR 8[esi] - adc ebx, 0 - mov DWORD PTR 4[edi],ecx - mov edx, DWORD PTR [esi] - ; saved r[1] - ; ############### Calculate word 2 - xor ecx, ecx - ; sqr a[2]*a[0] - mul edx - add eax, eax - adc edx, edx - adc ecx, 0 - add ebp, eax - adc ebx, edx - mov eax, DWORD PTR 4[esi] - adc ecx, 0 - ; sqr a[1]*a[1] - mul eax - add ebp, eax - adc ebx, edx - mov edx, DWORD PTR [esi] - adc ecx, 0 - mov DWORD PTR 8[edi],ebp - mov eax, DWORD PTR 12[esi] - ; saved r[2] - ; ############### Calculate word 3 - xor ebp, ebp - ; sqr a[3]*a[0] - mul edx - add eax, eax - adc edx, edx - adc ebp, 0 - add ebx, eax - adc ecx, edx - mov eax, DWORD PTR 8[esi] - adc ebp, 0 - mov edx, DWORD PTR 4[esi] - ; sqr a[2]*a[1] - mul edx - add eax, eax - adc edx, edx - adc ebp, 0 - add ebx, eax - adc ecx, edx - mov eax, DWORD PTR 16[esi] - adc ebp, 0 - mov DWORD PTR 12[edi],ebx - mov edx, DWORD PTR [esi] - ; saved r[3] - ; ############### Calculate word 4 - xor ebx, ebx - ; sqr a[4]*a[0] - mul edx - add eax, eax - adc edx, edx - adc ebx, 0 - add ecx, eax - adc ebp, edx - mov eax, DWORD PTR 12[esi] - adc ebx, 0 - mov edx, DWORD PTR 4[esi] - ; sqr a[3]*a[1] - mul edx - add eax, eax - adc edx, edx - adc ebx, 0 - add ecx, eax - adc ebp, edx - mov eax, DWORD PTR 8[esi] - adc ebx, 0 - ; sqr a[2]*a[2] - mul eax - add ecx, eax - adc ebp, edx - mov edx, DWORD PTR [esi] - adc ebx, 0 - mov DWORD PTR 16[edi],ecx - mov eax, DWORD PTR 20[esi] - ; saved r[4] - ; ############### Calculate word 5 - xor ecx, ecx - ; sqr a[5]*a[0] - mul edx - add eax, eax - adc edx, edx - adc ecx, 0 - add ebp, eax - adc ebx, edx - mov eax, DWORD PTR 16[esi] - adc ecx, 0 - mov edx, DWORD PTR 4[esi] - ; sqr a[4]*a[1] - mul edx - add eax, eax - adc edx, edx - adc ecx, 0 - add ebp, eax - adc ebx, edx - mov eax, DWORD PTR 12[esi] - adc ecx, 0 - mov edx, DWORD PTR 8[esi] - ; sqr a[3]*a[2] - mul edx - add eax, eax - adc edx, edx - adc ecx, 0 - add ebp, eax - adc ebx, edx - mov eax, DWORD PTR 24[esi] - adc ecx, 0 - mov DWORD PTR 20[edi],ebp - mov edx, DWORD PTR [esi] - ; saved r[5] - ; ############### Calculate word 6 - xor ebp, ebp - ; sqr a[6]*a[0] - mul edx - add eax, eax - adc edx, edx - adc ebp, 0 - add ebx, eax - adc ecx, edx - mov eax, DWORD PTR 20[esi] - adc ebp, 0 - mov edx, DWORD PTR 4[esi] - ; sqr a[5]*a[1] - mul edx - add eax, eax - adc edx, edx - adc ebp, 0 - add ebx, eax - adc ecx, edx - mov eax, DWORD PTR 16[esi] - adc ebp, 0 - mov edx, DWORD PTR 8[esi] - ; sqr a[4]*a[2] - mul edx - add eax, eax - adc edx, edx - adc ebp, 0 - add ebx, eax - adc ecx, edx - mov eax, DWORD PTR 12[esi] - adc ebp, 0 - ; sqr a[3]*a[3] - mul eax - add ebx, eax - adc ecx, edx - mov edx, DWORD PTR [esi] - adc ebp, 0 - mov DWORD PTR 24[edi],ebx - mov eax, DWORD PTR 28[esi] - ; saved r[6] - ; ############### Calculate word 7 - xor ebx, ebx - ; sqr a[7]*a[0] - mul edx - add eax, eax - adc edx, edx - adc ebx, 0 - add ecx, eax - adc ebp, edx - mov eax, DWORD PTR 24[esi] - adc ebx, 0 - mov edx, DWORD PTR 4[esi] - ; sqr a[6]*a[1] - mul edx - add eax, eax - adc edx, edx - adc ebx, 0 - add ecx, eax - adc ebp, edx - mov eax, DWORD PTR 20[esi] - adc ebx, 0 - mov edx, DWORD PTR 8[esi] - ; sqr a[5]*a[2] - mul edx - add eax, eax - adc edx, edx - adc ebx, 0 - add ecx, eax - adc ebp, edx - mov eax, DWORD PTR 16[esi] - adc ebx, 0 - mov edx, DWORD PTR 12[esi] - ; sqr a[4]*a[3] - mul edx - add eax, eax - adc edx, edx - adc ebx, 0 - add ecx, eax - adc ebp, edx - mov eax, DWORD PTR 28[esi] - adc ebx, 0 - mov DWORD PTR 28[edi],ecx - mov edx, DWORD PTR 4[esi] - ; saved r[7] - ; ############### Calculate word 8 - xor ecx, ecx - ; sqr a[7]*a[1] - mul edx - add eax, eax - adc edx, edx - adc ecx, 0 - add ebp, eax - adc ebx, edx - mov eax, DWORD PTR 24[esi] - adc ecx, 0 - mov edx, DWORD PTR 8[esi] - ; sqr a[6]*a[2] - mul edx - add eax, eax - adc edx, edx - adc ecx, 0 - add ebp, eax - adc ebx, edx - mov eax, DWORD PTR 20[esi] - adc ecx, 0 - mov edx, DWORD PTR 12[esi] - ; sqr a[5]*a[3] - mul edx - add eax, eax - adc edx, edx - adc ecx, 0 - add ebp, eax - adc ebx, edx - mov eax, DWORD PTR 16[esi] - adc ecx, 0 - ; sqr a[4]*a[4] - mul eax - add ebp, eax - adc ebx, edx - mov edx, DWORD PTR 8[esi] - adc ecx, 0 - mov DWORD PTR 32[edi],ebp - mov eax, DWORD PTR 28[esi] - ; saved r[8] - ; ############### Calculate word 9 - xor ebp, ebp - ; sqr a[7]*a[2] - mul edx - add eax, eax - adc edx, edx - adc ebp, 0 - add ebx, eax - adc ecx, edx - mov eax, DWORD PTR 24[esi] - adc ebp, 0 - mov edx, DWORD PTR 12[esi] - ; sqr a[6]*a[3] - mul edx - add eax, eax - adc edx, edx - adc ebp, 0 - add ebx, eax - adc ecx, edx - mov eax, DWORD PTR 20[esi] - adc ebp, 0 - mov edx, DWORD PTR 16[esi] - ; sqr a[5]*a[4] - mul edx - add eax, eax - adc edx, edx - adc ebp, 0 - add ebx, eax - adc ecx, edx - mov eax, DWORD PTR 28[esi] - adc ebp, 0 - mov DWORD PTR 36[edi],ebx - mov edx, DWORD PTR 12[esi] - ; saved r[9] - ; ############### Calculate word 10 - xor ebx, ebx - ; sqr a[7]*a[3] - mul edx - add eax, eax - adc edx, edx - adc ebx, 0 - add ecx, eax - adc ebp, edx - mov eax, DWORD PTR 24[esi] - adc ebx, 0 - mov edx, DWORD PTR 16[esi] - ; sqr a[6]*a[4] - mul edx - add eax, eax - adc edx, edx - adc ebx, 0 - add ecx, eax - adc ebp, edx - mov eax, DWORD PTR 20[esi] - adc ebx, 0 - ; sqr a[5]*a[5] - mul eax - add ecx, eax - adc ebp, edx - mov edx, DWORD PTR 16[esi] - adc ebx, 0 - mov DWORD PTR 40[edi],ecx - mov eax, DWORD PTR 28[esi] - ; saved r[10] - ; ############### Calculate word 11 - xor ecx, ecx - ; sqr a[7]*a[4] - mul edx - add eax, eax - adc edx, edx - adc ecx, 0 - add ebp, eax - adc ebx, edx - mov eax, DWORD PTR 24[esi] - adc ecx, 0 - mov edx, DWORD PTR 20[esi] - ; sqr a[6]*a[5] - mul edx - add eax, eax - adc edx, edx - adc ecx, 0 - add ebp, eax - adc ebx, edx - mov eax, DWORD PTR 28[esi] - adc ecx, 0 - mov DWORD PTR 44[edi],ebp - mov edx, DWORD PTR 20[esi] - ; saved r[11] - ; ############### Calculate word 12 - xor ebp, ebp - ; sqr a[7]*a[5] - mul edx - add eax, eax - adc edx, edx - adc ebp, 0 - add ebx, eax - adc ecx, edx - mov eax, DWORD PTR 24[esi] - adc ebp, 0 - ; sqr a[6]*a[6] - mul eax - add ebx, eax - adc ecx, edx - mov edx, DWORD PTR 24[esi] - adc ebp, 0 - mov DWORD PTR 48[edi],ebx - mov eax, DWORD PTR 28[esi] - ; saved r[12] - ; ############### Calculate word 13 - xor ebx, ebx - ; sqr a[7]*a[6] - mul edx - add eax, eax - adc edx, edx - adc ebx, 0 - add ecx, eax - adc ebp, edx - mov eax, DWORD PTR 28[esi] - adc ebx, 0 - mov DWORD PTR 52[edi],ecx - ; saved r[13] - ; ############### Calculate word 14 - xor ecx, ecx - ; sqr a[7]*a[7] - mul eax - add ebp, eax - adc ebx, edx - adc ecx, 0 - mov DWORD PTR 56[edi],ebp - ; saved r[14] - mov DWORD PTR 60[edi],ebx - pop ebx - pop ebp - pop edi - pop esi - ret -_bn_sqr_comba8 ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _bn_sqr_comba4 - -_bn_sqr_comba4 PROC NEAR - push esi - push edi - push ebp - push ebx - mov edi, DWORD PTR 20[esp] - mov esi, DWORD PTR 24[esp] - xor ebx, ebx - xor ecx, ecx - mov eax, DWORD PTR [esi] - ; ############### Calculate word 0 - xor ebp, ebp - ; sqr a[0]*a[0] - mul eax - add ebx, eax - adc ecx, edx - mov edx, DWORD PTR [esi] - adc ebp, 0 - mov DWORD PTR [edi],ebx - mov eax, DWORD PTR 4[esi] - ; saved r[0] - ; ############### Calculate word 1 - xor ebx, ebx - ; sqr a[1]*a[0] - mul edx - add eax, eax - adc edx, edx - adc ebx, 0 - add ecx, eax - adc ebp, edx - mov eax, DWORD PTR 8[esi] - adc ebx, 0 - mov DWORD PTR 4[edi],ecx - mov edx, DWORD PTR [esi] - ; saved r[1] - ; ############### Calculate word 2 - xor ecx, ecx - ; sqr a[2]*a[0] - mul edx - add eax, eax - adc edx, edx - adc ecx, 0 - add ebp, eax - adc ebx, edx - mov eax, DWORD PTR 4[esi] - adc ecx, 0 - ; sqr a[1]*a[1] - mul eax - add ebp, eax - adc ebx, edx - mov edx, DWORD PTR [esi] - adc ecx, 0 - mov DWORD PTR 8[edi],ebp - mov eax, DWORD PTR 12[esi] - ; saved r[2] - ; ############### Calculate word 3 - xor ebp, ebp - ; sqr a[3]*a[0] - mul edx - add eax, eax - adc edx, edx - adc ebp, 0 - add ebx, eax - adc ecx, edx - mov eax, DWORD PTR 8[esi] - adc ebp, 0 - mov edx, DWORD PTR 4[esi] - ; sqr a[2]*a[1] - mul edx - add eax, eax - adc edx, edx - adc ebp, 0 - add ebx, eax - adc ecx, edx - mov eax, DWORD PTR 12[esi] - adc ebp, 0 - mov DWORD PTR 12[edi],ebx - mov edx, DWORD PTR 4[esi] - ; saved r[3] - ; ############### Calculate word 4 - xor ebx, ebx - ; sqr a[3]*a[1] - mul edx - add eax, eax - adc edx, edx - adc ebx, 0 - add ecx, eax - adc ebp, edx - mov eax, DWORD PTR 8[esi] - adc ebx, 0 - ; sqr a[2]*a[2] - mul eax - add ecx, eax - adc ebp, edx - mov edx, DWORD PTR 8[esi] - adc ebx, 0 - mov DWORD PTR 16[edi],ecx - mov eax, DWORD PTR 12[esi] - ; saved r[4] - ; ############### Calculate word 5 - xor ecx, ecx - ; sqr a[3]*a[2] - mul edx - add eax, eax - adc edx, edx - adc ecx, 0 - add ebp, eax - adc ebx, edx - mov eax, DWORD PTR 12[esi] - adc ecx, 0 - mov DWORD PTR 20[edi],ebp - ; saved r[5] - ; ############### Calculate word 6 - xor ebp, ebp - ; sqr a[3]*a[3] - mul eax - add ebx, eax - adc ecx, edx - adc ebp, 0 - mov DWORD PTR 24[edi],ebx - ; saved r[6] - mov DWORD PTR 28[edi],ecx - pop ebx - pop ebp - pop edi - pop esi - ret -_bn_sqr_comba4 ENDP -_TEXT ENDS -END diff --git a/src/lib/libcrypto/bn/asm/x86w16.asm b/src/lib/libcrypto/bn/asm/x86w16.asm index 80a9ed6eef..e69de29bb2 100644 --- a/src/lib/libcrypto/bn/asm/x86w16.asm +++ b/src/lib/libcrypto/bn/asm/x86w16.asm @@ -1,297 +0,0 @@ -; Static Name Aliases -; - TITLE bn_mulw.c - .8087 -F_TEXT SEGMENT WORD PUBLIC 'CODE' -F_TEXT ENDS -_DATA SEGMENT WORD PUBLIC 'DATA' -_DATA ENDS -_CONST SEGMENT WORD PUBLIC 'CONST' -_CONST ENDS -_BSS SEGMENT WORD PUBLIC 'BSS' -_BSS ENDS -DGROUP GROUP _CONST, _BSS, _DATA - ASSUME DS: DGROUP, SS: DGROUP -F_TEXT SEGMENT - ASSUME CS: F_TEXT - PUBLIC _bn_mul_add_words -_bn_mul_add_words PROC FAR -; Line 58 - push bp - push bx - push si - push di - push ds - push es - mov bp,sp -; w = 26 -; num = 24 -; ap = 20 -; rp = 16 - xor si,si ;c=0; - mov di,WORD PTR [bp+16] ; load r - mov ds,WORD PTR [bp+18] ; load r - mov bx,WORD PTR [bp+20] ; load a - mov es,WORD PTR [bp+22] ; load a - mov cx,WORD PTR [bp+26] ; load w - mov bp,WORD PTR [bp+24] ; load num - - shr bp,1 ; div count by 4 and do groups of 4 - shr bp,1 - je $L555 - -$L546: - mov ax,cx - mul WORD PTR es:[bx] ; w* *a - add ax,WORD PTR ds:[di] ; + *r - adc dx,0 - adc ax,si - adc dx,0 - mov WORD PTR ds:[di],ax - mov si,dx - ; - mov ax,cx - mul WORD PTR es:[bx+2] ; w* *a - add ax,WORD PTR ds:[di+2] ; + *r - adc dx,0 - adc ax,si - adc dx,0 - mov WORD PTR ds:[di+2],ax - mov si,dx - ; - mov ax,cx - mul WORD PTR es:[bx+4] ; w* *a - add ax,WORD PTR ds:[di+4] ; + *r - adc dx,0 - adc ax,si - adc dx,0 - mov WORD PTR ds:[di+4],ax - mov si,dx - ; - mov ax,cx - mul WORD PTR es:[bx+6] ; w* *a - add ax,WORD PTR ds:[di+6] ; + *r - adc dx,0 - adc ax,si - adc dx,0 - mov WORD PTR ds:[di+6],ax - mov si,dx - ; - add bx,8 - add di,8 - ; - dec bp - je $L555 - jmp $L546 -; -; -$L555: - mov bp,sp - mov bp,WORD PTR [bp+24] ; load num - and bp,3 - dec bp - js $L547 - - mov ax,cx - mul WORD PTR es:[bx] ; w* *a - add ax,WORD PTR ds:[di] ; + *r - adc dx,0 - adc ax,si - adc dx,0 - mov WORD PTR ds:[di],ax - mov si,dx - dec bp - js $L547 ; Note that we are now testing for -1 - ; - mov ax,cx - mul WORD PTR es:[bx+2] ; w* *a - add ax,WORD PTR ds:[di+2] ; + *r - adc dx,0 - adc ax,si - adc dx,0 - mov WORD PTR ds:[di+2],ax - mov si,dx - dec bp - js $L547 - ; - mov ax,cx - mul WORD PTR es:[bx+4] ; w* *a - add ax,WORD PTR ds:[di+4] ; + *r - adc dx,0 - adc ax,si - adc dx,0 - mov WORD PTR ds:[di+4],ax - mov si,dx -$L547: - mov ax,si - pop es - pop ds - pop di - pop si - pop bx - pop bp - ret - nop - -_bn_mul_add_words ENDP - PUBLIC _bn_mul_words -_bn_mul_words PROC FAR -; Line 76 - push bp - push bx - push si - push di - push ds - push es - xor si,si - mov bp,sp - mov di,WORD PTR [bp+16] ; r - mov ds,WORD PTR [bp+18] - mov bx,WORD PTR [bp+20] ; a - mov es,WORD PTR [bp+22] - mov cx,WORD PTR [bp+26] ; w - mov bp,WORD PTR [bp+24] ; num -$FC743: - mov ax,cx - mul WORD PTR es:[bx] - add ax,si - adc dx,0 - mov WORD PTR ds:[di],ax - mov si,dx - dec bp - je $L764 - ; - mov ax,cx - mul WORD PTR es:[bx+2] - add ax,si - adc dx,0 - mov WORD PTR ds:[di+2],ax - mov si,dx - dec bp - je $L764 - ; - mov ax,cx - mul WORD PTR es:[bx+4] - add ax,si - adc dx,0 - mov WORD PTR ds:[di+4],ax - mov si,dx - dec bp - je $L764 - ; - mov ax,cx - mul WORD PTR es:[bx+6] - add ax,si - adc dx,0 - mov WORD PTR ds:[di+6],ax - mov si,dx - dec bp - je $L764 - ; - add bx,8 - add di,8 - jmp $FC743 - nop -$L764: - mov ax,si - pop es - pop ds - pop di - pop si - pop bx - pop bp - ret - nop -_bn_mul_words ENDP - PUBLIC _bn_sqr_words -_bn_sqr_words PROC FAR -; Line 92 - push bp - push bx - push si - push di - push ds - push es - mov bp,sp - mov si,WORD PTR [bp+16] - mov ds,WORD PTR [bp+18] - mov di,WORD PTR [bp+20] - mov es,WORD PTR [bp+22] - mov bx,WORD PTR [bp+24] - - mov bp,bx ; save a memory lookup later - shr bx,1 ; div count by 4 and do groups of 4 - shr bx,1 - je $L666 - -$L765: - mov ax,WORD PTR es:[di] - mul ax - mov WORD PTR ds:[si],ax - mov WORD PTR ds:[si+2],dx - ; - mov ax,WORD PTR es:[di+2] - mul ax - mov WORD PTR ds:[si+4],ax - mov WORD PTR ds:[si+6],dx - ; - mov ax,WORD PTR es:[di+4] - mul ax - mov WORD PTR ds:[si+8],ax - mov WORD PTR ds:[si+10],dx - ; - mov ax,WORD PTR es:[di+6] - mul ax - mov WORD PTR ds:[si+12],ax - mov WORD PTR ds:[si+14],dx - ; - add di,8 - add si,16 - dec bx - je $L666 - jmp $L765 -$L666: - and bp,3 - dec bp ; The copied value of bx (num) - js $L645 - ; - mov ax,WORD PTR es:[di] - mul ax - mov WORD PTR ds:[si],ax - mov WORD PTR ds:[si+2],dx - dec bp - js $L645 - ; - mov ax,WORD PTR es:[di+2] - mul ax - mov WORD PTR ds:[si+4],ax - mov WORD PTR ds:[si+6],dx - dec bp - js $L645 - ; - mov ax,WORD PTR es:[di+4] - mul ax - mov WORD PTR ds:[si+8],ax - mov WORD PTR ds:[si+10],dx -$L645: - pop es - pop ds - pop di - pop si - pop bx - pop bp - ret - -_bn_sqr_words ENDP - PUBLIC _bn_div64 -_bn_div64 PROC FAR - push bp - mov bp,sp - mov dx, WORD PTR [bp+6] - mov ax, WORD PTR [bp+8] - div WORD PTR [bp+10] - pop bp - ret -_bn_div64 ENDP -F_TEXT ENDS -END diff --git a/src/lib/libcrypto/bn/asm/x86w32.asm b/src/lib/libcrypto/bn/asm/x86w32.asm index 957d71e3b1..e69de29bb2 100644 --- a/src/lib/libcrypto/bn/asm/x86w32.asm +++ b/src/lib/libcrypto/bn/asm/x86w32.asm @@ -1,360 +0,0 @@ -; Static Name Aliases -; - TITLE bn_mulw.c - .386 -F_TEXT SEGMENT WORD USE16 PUBLIC 'CODE' -F_TEXT ENDS -_DATA SEGMENT WORD USE16 PUBLIC 'DATA' -_DATA ENDS -_CONST SEGMENT WORD USE16 PUBLIC 'CONST' -_CONST ENDS -_BSS SEGMENT WORD USE16 PUBLIC 'BSS' -_BSS ENDS -DGROUP GROUP _CONST, _BSS, _DATA - ASSUME DS: DGROUP, SS: DGROUP -F_TEXT SEGMENT - ASSUME CS: F_TEXT - PUBLIC _bn_mul_add_words -_bn_mul_add_words PROC FAR -; Line 58 - push bp - push bx - push esi - push di - push ds - push es - mov bp,sp -; w = 28 -; num = 26 -; ap = 22 -; rp = 18 - xor esi,esi ;c=0; - mov di,WORD PTR [bp+18] ; load r - mov ds,WORD PTR [bp+20] ; load r - mov bx,WORD PTR [bp+22] ; load a - mov es,WORD PTR [bp+24] ; load a - mov ecx,DWORD PTR [bp+28] ; load w - mov bp,WORD PTR [bp+26] ; load num - shr bp,1 ; div count by 4 and do groups of 4 - shr bp,1 - je $L555 - -$L546: - mov eax,ecx - mul DWORD PTR es:[bx] ; w* *a - add eax,DWORD PTR ds:[di] ; + *r - adc edx,0 - adc eax,esi - adc edx,0 - mov DWORD PTR ds:[di],eax - mov esi,edx - ; - mov eax,ecx - mul DWORD PTR es:[bx+4] ; w* *a - add eax,DWORD PTR ds:[di+4] ; + *r - adc edx,0 - adc eax,esi - adc edx,0 - mov DWORD PTR ds:[di+4],eax - mov esi,edx - ; - mov eax,ecx - mul DWORD PTR es:[bx+8] ; w* *a - add eax,DWORD PTR ds:[di+8] ; + *r - adc edx,0 - adc eax,esi - adc edx,0 - mov DWORD PTR ds:[di+8],eax - mov esi,edx - ; - mov eax,ecx - mul DWORD PTR es:[bx+12] ; w* *a - add eax,DWORD PTR ds:[di+12] ; + *r - adc edx,0 - adc eax,esi - adc edx,0 - mov DWORD PTR ds:[di+12],eax - mov esi,edx - ; - add bx,16 - add di,16 - ; - dec bp - je $L555 - jmp $L546 -; -; -$L555: - mov bp,sp - mov bp,WORD PTR [bp+26] ; load num - and bp,3 - dec bp - js $L547m - - mov eax,ecx - mul DWORD PTR es:[bx] ; w* *a - add eax,DWORD PTR ds:[di] ; + *r - adc edx,0 - adc eax,esi - adc edx,0 - mov DWORD PTR ds:[di],eax - mov esi,edx - dec bp - js $L547m ; Note that we are now testing for -1 - ; - mov eax,ecx - mul DWORD PTR es:[bx+4] ; w* *a - add eax,DWORD PTR ds:[di+4] ; + *r - adc edx,0 - adc eax,esi - adc edx,0 - mov DWORD PTR ds:[di+4],eax - mov esi,edx - dec bp - js $L547m - ; - mov eax,ecx - mul DWORD PTR es:[bx+8] ; w* *a - add eax,DWORD PTR ds:[di+8] ; + *r - adc edx,0 - adc eax,esi - adc edx,0 - mov DWORD PTR ds:[di+8],eax - mov esi,edx -$L547m: - mov eax,esi - mov edx,esi - shr edx,16 - pop es - pop ds - pop di - pop esi - pop bx - pop bp - ret - nop -_bn_mul_add_words ENDP - - PUBLIC _bn_mul_words -_bn_mul_words PROC FAR -; Line 76 - push bp - push bx - push esi - push di - push ds - push es - xor esi,esi - mov bp,sp - mov di,WORD PTR [bp+18] ; r - mov ds,WORD PTR [bp+20] - mov bx,WORD PTR [bp+22] ; a - mov es,WORD PTR [bp+24] - mov ecx,DWORD PTR [bp+28] ; w - mov bp,WORD PTR [bp+26] ; num - -$FC743: - mov eax,ecx - mul DWORD PTR es:[bx] - add eax,esi - adc edx,0 - mov DWORD PTR ds:[di],eax - mov esi,edx - dec bp - je $L764 - ; - mov eax,ecx - mul DWORD PTR es:[bx+4] - add eax,esi - adc edx,0 - mov DWORD PTR ds:[di+4],eax - mov esi,edx - dec bp - je $L764 - ; - mov eax,ecx - mul DWORD PTR es:[bx+8] - add eax,esi - adc edx,0 - mov DWORD PTR ds:[di+8],eax - mov esi,edx - dec bp - je $L764 - ; - mov eax,ecx - mul DWORD PTR es:[bx+12] - add eax,esi - adc edx,0 - mov DWORD PTR ds:[di+12],eax - mov esi,edx - dec bp - je $L764 - ; - add bx,16 - add di,16 - jmp $FC743 - nop -$L764: - mov eax,esi - mov edx,esi - shr edx,16 - pop es - pop ds - pop di - pop esi - pop bx - pop bp - ret - nop -_bn_mul_words ENDP - PUBLIC _bn_sqr_words -_bn_sqr_words PROC FAR -; Line 92 - push bp - push bx - push si - push di - push ds - push es - mov bp,sp - mov si,WORD PTR [bp+16] - mov ds,WORD PTR [bp+18] - mov di,WORD PTR [bp+20] - mov es,WORD PTR [bp+22] - mov bx,WORD PTR [bp+24] - - mov bp,bx ; save a memory lookup later - shr bx,1 ; div count by 4 and do groups of 4 - shr bx,1 - je $L666 - -$L765: - mov eax,DWORD PTR es:[di] - mul eax - mov DWORD PTR ds:[si],eax - mov DWORD PTR ds:[si+4],edx - ; - mov eax,DWORD PTR es:[di+4] - mul eax - mov DWORD PTR ds:[si+8],eax - mov DWORD PTR ds:[si+12],edx - ; - mov eax,DWORD PTR es:[di+8] - mul eax - mov DWORD PTR ds:[si+16],eax - mov DWORD PTR ds:[si+20],edx - ; - mov eax,DWORD PTR es:[di+12] - mul eax - mov DWORD PTR ds:[si+24],eax - mov DWORD PTR ds:[si+28],edx - ; - add di,16 - add si,32 - dec bx - je $L666 - jmp $L765 -$L666: - and bp,3 - dec bp ; The copied value of bx (num) - js $L645 - ; - mov eax,DWORD PTR es:[di] - mul eax - mov DWORD PTR ds:[si],eax - mov DWORD PTR ds:[si+4],edx - dec bp - js $L645 - ; - mov eax,DWORD PTR es:[di+4] - mul eax - mov DWORD PTR ds:[si+8],eax - mov DWORD PTR ds:[si+12],edx - dec bp - js $L645 - ; - mov eax,DWORD PTR es:[di+8] - mul eax - mov DWORD PTR ds:[si+16],eax - mov DWORD PTR ds:[si+20],edx -$L645: - pop es - pop ds - pop di - pop si - pop bx - pop bp - ret -_bn_sqr_words ENDP - - PUBLIC _bn_div64 -_bn_div64 PROC FAR - push bp - mov bp,sp - mov edx, DWORD PTR [bp+6] - mov eax, DWORD PTR [bp+10] - div DWORD PTR [bp+14] - mov edx,eax - shr edx,16 - pop bp - ret -_bn_div64 ENDP - - PUBLIC _bn_add_words -_bn_add_words PROC FAR -; Line 58 - push bp - push bx - push esi - push di - push ds - push es - mov bp,sp -; w = 28 -; num = 26 -; ap = 22 -; rp = 18 - xor esi,esi ;c=0; - mov bx,WORD PTR [bp+18] ; load low r - mov si,WORD PTR [bp+22] ; load a - mov es,WORD PTR [bp+24] ; load a - mov di,WORD PTR [bp+26] ; load b - mov ds,WORD PTR [bp+28] ; load b - - mov dx,WORD PTR [bp+30] ; load num - xor ecx,ecx - dec dx - js $L547a - -$L5477: - mov eax,DWORD PTR es:[si] ; *a - add eax,ecx - mov ecx,0 - adc ecx,0 - add si,4 ; a++ - add eax,DWORD PTR ds:[di] ; + *b - adc ecx,0 - mov ds,WORD PTR [bp+20] - add di,4 - mov DWORD PTR ds:[bx],eax - mov ds,WORD PTR [bp+28] - add bx,4 - dec dx - js $L547a ; Note that we are now testing for -1 - jmp $L5477 - ; -$L547a: - mov eax,ecx - mov edx,ecx - shr edx,16 - pop es - pop ds - pop di - pop esi - pop bx - pop bp - ret - nop -_bn_add_words ENDP -F_TEXT ENDS -END diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h index d8822610df..009b0eb685 100644 --- a/src/lib/libcrypto/bn/bn.h +++ b/src/lib/libcrypto/bn/bn.h @@ -89,7 +89,7 @@ extern "C" { * For machines with only one compiler (or shared libraries), this should * be on. Again this in only really a problem on machines * using "long long's", are 32bit, and are not using my assembler code. */ -#if defined(MSDOS) || defined(WINDOWS) || defined(linux) +#if defined(MSDOS) || defined(WINDOWS) || defined(WIN32) || defined(linux) #define BN_DIV2W #endif diff --git a/src/lib/libcrypto/bn/bn_err.c b/src/lib/libcrypto/bn/bn_err.c index f3b9497dca..988270bcf4 100644 --- a/src/lib/libcrypto/bn/bn_err.c +++ b/src/lib/libcrypto/bn/bn_err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c index 7bb0b91223..598fecbf0c 100644 --- a/src/lib/libcrypto/bn/bn_mont.c +++ b/src/lib/libcrypto/bn/bn_mont.c @@ -73,6 +73,7 @@ int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_MONT_CTX *mont, BN_CTX *ctx) { BIGNUM *tmp,*tmp2; + int ret=0; BN_CTX_start(ctx); tmp = BN_CTX_get(ctx); @@ -101,10 +102,10 @@ int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b, } /* reduce from aRR to aR */ if (!BN_from_montgomery(r,tmp,mont,ctx)) goto err; - BN_CTX_end(ctx); - return(1); + ret=1; err: - return(0); + BN_CTX_end(ctx); + return(ret); } int BN_from_montgomery(BIGNUM *ret, BIGNUM *a, BN_MONT_CTX *mont, diff --git a/src/lib/libcrypto/bn/bn_mul.c b/src/lib/libcrypto/bn/bn_mul.c index eb007e19e9..3e8baaad9a 100644 --- a/src/lib/libcrypto/bn/bn_mul.c +++ b/src/lib/libcrypto/bn/bn_mul.c @@ -61,6 +61,9 @@ #include "bn_lcl.h" #ifdef BN_RECURSION +/* Karatsuba recursive multiplication algorithm + * (cf. Knuth, The Art of Computer Programming, Vol. 2) */ + /* r is 2*n2 words in size, * a and b are both n2 words in size. * n2 must be a power of 2. diff --git a/src/lib/libcrypto/bn/bntest.c b/src/lib/libcrypto/bn/bntest.c index 41c22f5954..0a97af69c5 100644 --- a/src/lib/libcrypto/bn/bntest.c +++ b/src/lib/libcrypto/bn/bntest.c @@ -234,7 +234,8 @@ int main(int argc, char *argv[]) /**/ exit(0); err: - BIO_puts(out,"1\n"); /* make sure bc fails if we are piping to it */ + BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices + * the failure, see test_bn in test/Makefile.ssl*/ BIO_flush(out); ERR_load_crypto_strings(); ERR_print_errors_fp(stderr); diff --git a/src/lib/libcrypto/buffer/buf_err.c b/src/lib/libcrypto/buffer/buf_err.c index 7f9fd1f6c3..2f971a5f38 100644 --- a/src/lib/libcrypto/buffer/buf_err.c +++ b/src/lib/libcrypto/buffer/buf_err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/cast/Makefile.ssl b/src/lib/libcrypto/cast/Makefile.ssl index 763148e314..4c70d1e3e8 100644 --- a/src/lib/libcrypto/cast/Makefile.ssl +++ b/src/lib/libcrypto/cast/Makefile.ssl @@ -52,7 +52,7 @@ lib: $(LIBOBJ) # elf asm/cx86-elf.o: asm/cx86unix.cpp - $(CPP) -DELF asm/cx86unix.cpp | as -o asm/cx86-elf.o + $(CPP) -DELF -x c asm/cx86unix.cpp | as -o asm/cx86-elf.o # solaris asm/cx86-sol.o: asm/cx86unix.cpp @@ -68,7 +68,7 @@ asm/cx86-out.o: asm/cx86unix.cpp asm/cx86bsdi.o: asm/cx86unix.cpp $(CPP) -DBSDI asm/cx86unix.cpp | sed 's/ :/:/' | as -o asm/cx86bsdi.o -asm/cx86unix.cpp: asm/cast-586.pl +asm/cx86unix.cpp: asm/cast-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl (cd asm; $(PERL) cast-586.pl cpp $(PROCESSOR) >cx86unix.cpp) files: diff --git a/src/lib/libcrypto/cast/Makefile.uni b/src/lib/libcrypto/cast/Makefile.uni index a5870897cf..e69de29bb2 100644 --- a/src/lib/libcrypto/cast/Makefile.uni +++ b/src/lib/libcrypto/cast/Makefile.uni @@ -1,124 +0,0 @@ -# Targets -# make - twidle the options yourself :-) -# make cc - standard cc options -# make gcc - standard gcc options -# make x86-elf - linux-elf etc -# make x86-out - linux-a.out, FreeBSD etc -# make x86-solaris -# make x86-bdsi - -# There are 3 possible performance options, experiment :-) -#OPTS= -DBF_PTR -#OPTS= -DBF_PTR2 -OPTS= - -DIR= cast -TOP= . -CC= gcc -CFLAG= -O3 -fomit-frame-pointer - -CPP= $(CC) -E -INCLUDES= -INSTALLTOP=/usr/local/lib -MAKE= make -MAKEDEPEND= makedepend -MAKEFILE= Makefile.uni -AR= ar r -RANLIB= ranlib - -CAST_ENC=c_enc.o -# or use -#CAST_ENC=asm/cx86-elf.o -#CAST_ENC=asm/cx86-out.o -#CAST_ENC=asm/cx86-sol.o -#CAST_ENC=asm/cx86bdsi.o - -CFLAGS= $(OPTS) $(INCLUDES) $(CFLAG) -DFULL_TEST - -GENERAL=Makefile -TEST=casttest -APP1=cast_spd -APP2=castopts -APPS=$(APP1) $(APP2) - -LIB=libcast.a -LIBSRC=c_skey.c c_ecb.c c_enc.c c_cfb64.c c_ofb64.c -LIBOBJ=c_skey.o c_ecb.o $(CAST_ENC) c_cfb64.o c_ofb64.o - -SRC= $(LIBSRC) - -EXHEADER= cast.h -HEADER= cast_lcl.h $(EXHEADER) - -ALL= $(GENERAL) $(SRC) $(HEADER) - -all: $(LIB) $(TEST) $(APPS) - -$(LIB): $(LIBOBJ) - $(AR) $(LIB) $(LIBOBJ) - $(RANLIB) $(LIB) -# elf -asm/cx86-elf.o: asm/cx86unix.cpp - $(CPP) -DELF asm/cx86unix.cpp | as -o asm/cx86-elf.o - -# solaris -asm/cx86-sol.o: asm/cx86unix.cpp - $(CC) -E -DSOL asm/cx86unix.cpp | sed 's/^#.*//' > asm/cx86-sol.s - as -o asm/cx86-sol.o asm/cx86-sol.s - rm -f asm/cx86-sol.s - -# a.out -asm/cx86-out.o: asm/cx86unix.cpp - $(CPP) -DOUT asm/cx86unix.cpp | as -o asm/cx86-out.o - -# bsdi -asm/cx86bsdi.o: asm/cx86unix.cpp - $(CPP) -DBSDI asm/cx86unix.cpp | as -o asm/cx86bsdi.o - -asm/cx86unix.cpp: - (cd asm; perl cast-586.pl cpp >cx86unix.cpp) - -test: $(TEST) - ./$(TEST) - -$(TEST): $(TEST).c $(LIB) - $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) - -$(APP1): $(APP1).c $(LIB) - $(CC) -o $(APP1) $(CFLAGS) $(APP1).c $(LIB) - -$(APP2): $(APP2).c $(LIB) - $(CC) -o $(APP2) $(CFLAGS) $(APP2).c $(LIB) - -lint: - lint -DLINT $(INCLUDES) $(SRC)>fluff - -depend: - $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) - -dclean: - perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new - mv -f Makefile.new $(MAKEFILE) - -clean: - /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff - -cc: - $(MAKE) CC="cc" CFLAG="-O" all - -gcc: - $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all - -x86-elf: - $(MAKE) CAST_ENC="asm/cx86-elf.o" CFLAG="-DELF $(CFLAGS)" all - -x86-out: - $(MAKE) CAST_ENC="asm/cx86-out.o" CFLAG="-DOUT $(CFLAGS)" all - -x86-solaris: - $(MAKE) CAST_ENC="asm/cx86-sol.o" CFLAG="-DSOL $(CFLAGS)" all - -x86-bdsi: - $(MAKE) CAST_ENC="asm/cx86-bdsi.o" CFLAG="-DBDSI $(CFLAGS)" all - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/cast/asm/c-win32.asm b/src/lib/libcrypto/cast/asm/c-win32.asm index ba78a3c69c..e69de29bb2 100644 --- a/src/lib/libcrypto/cast/asm/c-win32.asm +++ b/src/lib/libcrypto/cast/asm/c-win32.asm @@ -1,953 +0,0 @@ - ; Don't even think of reading this code - ; It was automatically generated by cast-586.pl - ; Which is a perl program used to generate the x86 assember for - ; any of elf, a.out, BSDI,Win32, or Solaris - ; eric - ; - TITLE cast-586.asm - .486 -.model FLAT -_TEXT SEGMENT -PUBLIC _CAST_encrypt -EXTERN _CAST_S_table0:DWORD -EXTERN _CAST_S_table1:DWORD -EXTERN _CAST_S_table2:DWORD -EXTERN _CAST_S_table3:DWORD - -_CAST_encrypt PROC NEAR - ; - push ebp - push ebx - mov ebx, DWORD PTR 12[esp] - mov ebp, DWORD PTR 16[esp] - push esi - push edi - ; Load the 2 words - mov edi, DWORD PTR [ebx] - mov esi, DWORD PTR 4[ebx] - ; Get short key flag - mov eax, DWORD PTR 128[ebp] - push eax - xor eax, eax - ; round 0 - mov edx, DWORD PTR [ebp] - mov ecx, DWORD PTR 4[ebp] - add edx, esi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - add ecx, ebx - xor edi, ecx - ; round 1 - mov edx, DWORD PTR 8[ebp] - mov ecx, DWORD PTR 12[ebp] - xor edx, edi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - xor ecx, ebx - xor esi, ecx - ; round 2 - mov edx, DWORD PTR 16[ebp] - mov ecx, DWORD PTR 20[ebp] - sub edx, esi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - sub ecx, ebx - xor edi, ecx - ; round 3 - mov edx, DWORD PTR 24[ebp] - mov ecx, DWORD PTR 28[ebp] - add edx, edi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - add ecx, ebx - xor esi, ecx - ; round 4 - mov edx, DWORD PTR 32[ebp] - mov ecx, DWORD PTR 36[ebp] - xor edx, esi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - xor ecx, ebx - xor edi, ecx - ; round 5 - mov edx, DWORD PTR 40[ebp] - mov ecx, DWORD PTR 44[ebp] - sub edx, edi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - sub ecx, ebx - xor esi, ecx - ; round 6 - mov edx, DWORD PTR 48[ebp] - mov ecx, DWORD PTR 52[ebp] - add edx, esi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - add ecx, ebx - xor edi, ecx - ; round 7 - mov edx, DWORD PTR 56[ebp] - mov ecx, DWORD PTR 60[ebp] - xor edx, edi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - xor ecx, ebx - xor esi, ecx - ; round 8 - mov edx, DWORD PTR 64[ebp] - mov ecx, DWORD PTR 68[ebp] - sub edx, esi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - sub ecx, ebx - xor edi, ecx - ; round 9 - mov edx, DWORD PTR 72[ebp] - mov ecx, DWORD PTR 76[ebp] - add edx, edi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - add ecx, ebx - xor esi, ecx - ; round 10 - mov edx, DWORD PTR 80[ebp] - mov ecx, DWORD PTR 84[ebp] - xor edx, esi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - xor ecx, ebx - xor edi, ecx - ; round 11 - mov edx, DWORD PTR 88[ebp] - mov ecx, DWORD PTR 92[ebp] - sub edx, edi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - sub ecx, ebx - xor esi, ecx - ; test short key flag - pop edx - or edx, edx - jnz $L000cast_enc_done - ; round 12 - mov edx, DWORD PTR 96[ebp] - mov ecx, DWORD PTR 100[ebp] - add edx, esi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - add ecx, ebx - xor edi, ecx - ; round 13 - mov edx, DWORD PTR 104[ebp] - mov ecx, DWORD PTR 108[ebp] - xor edx, edi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - xor ecx, ebx - xor esi, ecx - ; round 14 - mov edx, DWORD PTR 112[ebp] - mov ecx, DWORD PTR 116[ebp] - sub edx, esi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - sub ecx, ebx - xor edi, ecx - ; round 15 - mov edx, DWORD PTR 120[ebp] - mov ecx, DWORD PTR 124[ebp] - add edx, edi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - add ecx, ebx - xor esi, ecx -$L000cast_enc_done: - nop - mov eax, DWORD PTR 20[esp] - mov DWORD PTR 4[eax],edi - mov DWORD PTR [eax],esi - pop edi - pop esi - pop ebx - pop ebp - ret -_CAST_encrypt ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _CAST_decrypt -EXTERN _CAST_S_table0:DWORD -EXTERN _CAST_S_table1:DWORD -EXTERN _CAST_S_table2:DWORD -EXTERN _CAST_S_table3:DWORD - -_CAST_decrypt PROC NEAR - ; - push ebp - push ebx - mov ebx, DWORD PTR 12[esp] - mov ebp, DWORD PTR 16[esp] - push esi - push edi - ; Load the 2 words - mov edi, DWORD PTR [ebx] - mov esi, DWORD PTR 4[ebx] - ; Get short key flag - mov eax, DWORD PTR 128[ebp] - or eax, eax - jnz $L001cast_dec_skip - xor eax, eax - ; round 15 - mov edx, DWORD PTR 120[ebp] - mov ecx, DWORD PTR 124[ebp] - add edx, esi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - add ecx, ebx - xor edi, ecx - ; round 14 - mov edx, DWORD PTR 112[ebp] - mov ecx, DWORD PTR 116[ebp] - sub edx, edi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - sub ecx, ebx - xor esi, ecx - ; round 13 - mov edx, DWORD PTR 104[ebp] - mov ecx, DWORD PTR 108[ebp] - xor edx, esi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - xor ecx, ebx - xor edi, ecx - ; round 12 - mov edx, DWORD PTR 96[ebp] - mov ecx, DWORD PTR 100[ebp] - add edx, edi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - add ecx, ebx - xor esi, ecx -$L001cast_dec_skip: - ; round 11 - mov edx, DWORD PTR 88[ebp] - mov ecx, DWORD PTR 92[ebp] - sub edx, esi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - sub ecx, ebx - xor edi, ecx - ; round 10 - mov edx, DWORD PTR 80[ebp] - mov ecx, DWORD PTR 84[ebp] - xor edx, edi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - xor ecx, ebx - xor esi, ecx - ; round 9 - mov edx, DWORD PTR 72[ebp] - mov ecx, DWORD PTR 76[ebp] - add edx, esi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - add ecx, ebx - xor edi, ecx - ; round 8 - mov edx, DWORD PTR 64[ebp] - mov ecx, DWORD PTR 68[ebp] - sub edx, edi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - sub ecx, ebx - xor esi, ecx - ; round 7 - mov edx, DWORD PTR 56[ebp] - mov ecx, DWORD PTR 60[ebp] - xor edx, esi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - xor ecx, ebx - xor edi, ecx - ; round 6 - mov edx, DWORD PTR 48[ebp] - mov ecx, DWORD PTR 52[ebp] - add edx, edi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - add ecx, ebx - xor esi, ecx - ; round 5 - mov edx, DWORD PTR 40[ebp] - mov ecx, DWORD PTR 44[ebp] - sub edx, esi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - sub ecx, ebx - xor edi, ecx - ; round 4 - mov edx, DWORD PTR 32[ebp] - mov ecx, DWORD PTR 36[ebp] - xor edx, edi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - xor ecx, ebx - xor esi, ecx - ; round 3 - mov edx, DWORD PTR 24[ebp] - mov ecx, DWORD PTR 28[ebp] - add edx, esi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - add ecx, ebx - xor edi, ecx - ; round 2 - mov edx, DWORD PTR 16[ebp] - mov ecx, DWORD PTR 20[ebp] - sub edx, edi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - sub ecx, ebx - xor esi, ecx - ; round 1 - mov edx, DWORD PTR 8[ebp] - mov ecx, DWORD PTR 12[ebp] - xor edx, esi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - add ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - xor ecx, ebx - xor edi, ecx - ; round 0 - mov edx, DWORD PTR [ebp] - mov ecx, DWORD PTR 4[ebp] - add edx, edi - rol edx, cl - mov ebx, edx - xor ecx, ecx - mov cl, dh - and ebx, 255 - shr edx, 16 - xor eax, eax - mov al, dh - and edx, 255 - mov ecx, DWORD PTR _CAST_S_table0[ecx*4] - mov ebx, DWORD PTR _CAST_S_table1[ebx*4] - xor ecx, ebx - mov ebx, DWORD PTR _CAST_S_table2[eax*4] - sub ecx, ebx - mov ebx, DWORD PTR _CAST_S_table3[edx*4] - add ecx, ebx - xor esi, ecx - nop - mov eax, DWORD PTR 20[esp] - mov DWORD PTR 4[eax],edi - mov DWORD PTR [eax],esi - pop edi - pop esi - pop ebx - pop ebp - ret -_CAST_decrypt ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _CAST_cbc_encrypt - -_CAST_cbc_encrypt PROC NEAR - ; - push ebp - push ebx - push esi - push edi - mov ebp, DWORD PTR 28[esp] - ; getting iv ptr from parameter 4 - mov ebx, DWORD PTR 36[esp] - mov esi, DWORD PTR [ebx] - mov edi, DWORD PTR 4[ebx] - push edi - push esi - push edi - push esi - mov ebx, esp - mov esi, DWORD PTR 36[esp] - mov edi, DWORD PTR 40[esp] - ; getting encrypt flag from parameter 5 - mov ecx, DWORD PTR 56[esp] - ; get and push parameter 3 - mov eax, DWORD PTR 48[esp] - push eax - push ebx - cmp ecx, 0 - jz $L002decrypt - and ebp, 4294967288 - mov eax, DWORD PTR 8[esp] - mov ebx, DWORD PTR 12[esp] - jz $L003encrypt_finish -L004encrypt_loop: - mov ecx, DWORD PTR [esi] - mov edx, DWORD PTR 4[esi] - xor eax, ecx - xor ebx, edx - bswap eax - bswap ebx - mov DWORD PTR 8[esp],eax - mov DWORD PTR 12[esp],ebx - call _CAST_encrypt - mov eax, DWORD PTR 8[esp] - mov ebx, DWORD PTR 12[esp] - bswap eax - bswap ebx - mov DWORD PTR [edi],eax - mov DWORD PTR 4[edi],ebx - add esi, 8 - add edi, 8 - sub ebp, 8 - jnz L004encrypt_loop -$L003encrypt_finish: - mov ebp, DWORD PTR 52[esp] - and ebp, 7 - jz $L005finish - xor ecx, ecx - xor edx, edx - mov ebp, DWORD PTR $L006cbc_enc_jmp_table[ebp*4] - jmp ebp -L007ej7: - xor edx, edx - mov dh, BYTE PTR 6[esi] - shl edx, 8 -L008ej6: - mov dh, BYTE PTR 5[esi] -L009ej5: - mov dl, BYTE PTR 4[esi] -L010ej4: - mov ecx, DWORD PTR [esi] - jmp $L011ejend -L012ej3: - mov ch, BYTE PTR 2[esi] - xor ecx, ecx - shl ecx, 8 -L013ej2: - mov ch, BYTE PTR 1[esi] -L014ej1: - mov cl, BYTE PTR [esi] -$L011ejend: - xor eax, ecx - xor ebx, edx - bswap eax - bswap ebx - mov DWORD PTR 8[esp],eax - mov DWORD PTR 12[esp],ebx - call _CAST_encrypt - mov eax, DWORD PTR 8[esp] - mov ebx, DWORD PTR 12[esp] - bswap eax - bswap ebx - mov DWORD PTR [edi],eax - mov DWORD PTR 4[edi],ebx - jmp $L005finish -$L002decrypt: - and ebp, 4294967288 - mov eax, DWORD PTR 16[esp] - mov ebx, DWORD PTR 20[esp] - jz $L015decrypt_finish -L016decrypt_loop: - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] - bswap eax - bswap ebx - mov DWORD PTR 8[esp],eax - mov DWORD PTR 12[esp],ebx - call _CAST_decrypt - mov eax, DWORD PTR 8[esp] - mov ebx, DWORD PTR 12[esp] - bswap eax - bswap ebx - mov ecx, DWORD PTR 16[esp] - mov edx, DWORD PTR 20[esp] - xor ecx, eax - xor edx, ebx - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] - mov DWORD PTR [edi],ecx - mov DWORD PTR 4[edi],edx - mov DWORD PTR 16[esp],eax - mov DWORD PTR 20[esp],ebx - add esi, 8 - add edi, 8 - sub ebp, 8 - jnz L016decrypt_loop -$L015decrypt_finish: - mov ebp, DWORD PTR 52[esp] - and ebp, 7 - jz $L005finish - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] - bswap eax - bswap ebx - mov DWORD PTR 8[esp],eax - mov DWORD PTR 12[esp],ebx - call _CAST_decrypt - mov eax, DWORD PTR 8[esp] - mov ebx, DWORD PTR 12[esp] - bswap eax - bswap ebx - mov ecx, DWORD PTR 16[esp] - mov edx, DWORD PTR 20[esp] - xor ecx, eax - xor edx, ebx - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] -L017dj7: - ror edx, 16 - mov BYTE PTR 6[edi],dl - shr edx, 16 -L018dj6: - mov BYTE PTR 5[edi],dh -L019dj5: - mov BYTE PTR 4[edi],dl -L020dj4: - mov DWORD PTR [edi],ecx - jmp $L021djend -L022dj3: - ror ecx, 16 - mov BYTE PTR 2[edi],cl - shl ecx, 16 -L023dj2: - mov BYTE PTR 1[esi],ch -L024dj1: - mov BYTE PTR [esi], cl -$L021djend: - jmp $L005finish -$L005finish: - mov ecx, DWORD PTR 60[esp] - add esp, 24 - mov DWORD PTR [ecx],eax - mov DWORD PTR 4[ecx],ebx - pop edi - pop esi - pop ebx - pop ebp - ret -$L006cbc_enc_jmp_table: - DD 0 - DD L014ej1 - DD L013ej2 - DD L012ej3 - DD L010ej4 - DD L009ej5 - DD L008ej6 - DD L007ej7 -L025cbc_dec_jmp_table: - DD 0 - DD L024dj1 - DD L023dj2 - DD L022dj3 - DD L020dj4 - DD L019dj5 - DD L018dj6 - DD L017dj7 -_CAST_cbc_encrypt ENDP -_TEXT ENDS -END diff --git a/src/lib/libcrypto/cast/cast_lcl.h b/src/lib/libcrypto/cast/cast_lcl.h index cfe3842e91..5fab8a43f6 100644 --- a/src/lib/libcrypto/cast/cast_lcl.h +++ b/src/lib/libcrypto/cast/cast_lcl.h @@ -151,7 +151,7 @@ *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ *((c)++)=(unsigned char)(((l) )&0xff)) -#if defined(WIN32) +#if defined(WIN32) && defined(_MSC_VER) #define ROTL(a,n) (_lrotl(a,n)) #else #define ROTL(a,n) ((((a)<<(n))&0xffffffffL)|((a)>>(32-(n)))) diff --git a/src/lib/libcrypto/comp/comp_err.c b/src/lib/libcrypto/comp/comp_err.c index 77a3f7070c..c10282a73c 100644 --- a/src/lib/libcrypto/comp/comp_err.c +++ b/src/lib/libcrypto/comp/comp_err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/conf/conf_err.c b/src/lib/libcrypto/conf/conf_err.c index eb4b3cfc70..5c1ca59090 100644 --- a/src/lib/libcrypto/conf/conf_err.c +++ b/src/lib/libcrypto/conf/conf_err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/cpt_err.c b/src/lib/libcrypto/cpt_err.c index c2a2dd4af6..dadd8d8d92 100644 --- a/src/lib/libcrypto/cpt_err.c +++ b/src/lib/libcrypto/cpt_err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/crypto-lib.com b/src/lib/libcrypto/crypto-lib.com index 79d86771e8..8ddeafbc06 100644 --- a/src/lib/libcrypto/crypto-lib.com +++ b/src/lib/libcrypto/crypto-lib.com @@ -186,7 +186,7 @@ $ LIB_DES = "set_key,ecb_enc,cbc_enc,"+ - "enc_read,enc_writ,ofb64enc,"+ - "ofb_enc,str2key,pcbc_enc,qud_cksm,rand_key,"+ - "des_enc,fcrypt_b,read2pwd,"+ - - "fcrypt,xcbc_enc,read_pwd,rpc_enc,cbc_cksm,supp,ede_cbcm_enc" + "fcrypt,xcbc_enc,read_pwd,rpc_enc,cbc_cksm,ede_cbcm_enc" $ LIB_RC2 = "rc2_ecb,rc2_skey,rc2_cbc,rc2cfb64,rc2ofb64" $ LIB_RC4 = "rc4_skey,rc4_enc" $ LIB_RC5 = "rc5_skey,rc5_ecb,rc5_enc,rc5cfb64,rc5ofb64" @@ -208,7 +208,7 @@ $ LIB_BIO = "bio_lib,bio_cb,bio_err,"+ - "bss_mem,bss_null,bss_fd,"+ - "bss_file,bss_sock,bss_conn,"+ - "bf_null,bf_buff,b_print,b_dump,"+ - - "b_sock,bss_acpt,bf_nbio,bss_rtcp,bss_bio" ! + ",bss_log" for syslog + "b_sock,bss_acpt,bf_nbio,bss_rtcp,bss_bio,bss_log" $ LIB_STACK = "stack" $ LIB_LHASH = "lhash,lh_stats" $ LIB_RAND = "md_rand,randfile,rand_lib,rand_err,rand_egd" @@ -266,7 +266,7 @@ $! $! Setup exceptional compilations $! $ COMPILEWITH_CC3 = ",bss_rtcp," -$ COMPILEWITH_CC4 = ",a_utctm," +$ COMPILEWITH_CC4 = ",a_utctm,bss_log," $ COMPILEWITH_CC5 = ",md2_dgst,md5_dgst,mdc2dgst,sha_dgst,sha1dgst," + - "rmd_dgst,bf_enc," $! @@ -1441,6 +1441,7 @@ $! $ IF P7 .NES. "" $ THEN $ ENCRYPT_TYPES = P7 +$! NYI: ENCRYPT_PROGRAMS = P7 $ ENDIF $! $! Time To RETURN... diff --git a/src/lib/libcrypto/des/DES.pod b/src/lib/libcrypto/des/DES.pod index 8a739e7ca0..e69de29bb2 100644 --- a/src/lib/libcrypto/des/DES.pod +++ b/src/lib/libcrypto/des/DES.pod @@ -1,16 +0,0 @@ -crypt <= crypt(buf,salt) -key <= set_odd_parity(key) -int <= is_weak_key(key) -keysched<= set_key(key) -key <= ecb_encrypt(string8,ks,enc) -key <= ecb3_encrypt(input,ks1,ks2,enc) -string <= cbc_encrypt(input,ks,ivec,enc) => ivec -string <= cbc3_encrypt(input,ks1,ks2,ivec1,ivec2,enc) => ivec1&ivec2 -ck1,ck2 <= cbc_cksum(input,ks,ivec) => ivec -string <= pcbc_encrypt(input,ks,ivec,enc) => ivec -string <= ofb_encrypt(input,numbits,ks,ivec) => ivec -string <= cfb_encrypt(input,numbits,ks,ivec,enc) => ivec -key <= random_key() -key <= string_to_key(string) -key1,key2<= string_to_2keys(string) - diff --git a/src/lib/libcrypto/des/MODES.DES b/src/lib/libcrypto/des/MODES.DES index 0cbc44f51d..e69de29bb2 100644 --- a/src/lib/libcrypto/des/MODES.DES +++ b/src/lib/libcrypto/des/MODES.DES @@ -1,84 +0,0 @@ -Modes of DES -Quite a bit of the following information has been taken from - AS 2805.5.2 - Australian Standard - Electronic funds transfer - Requirements for interfaces, - Part 5.2: Modes of operation for an n-bit block cipher algorithm - Appendix A - -There are several different modes in which DES can be used, they are -as follows. - -Electronic Codebook Mode (ECB) (des_ecb_encrypt()) -- 64 bits are enciphered at a time. -- The order of the blocks can be rearranged without detection. -- The same plaintext block always produces the same ciphertext block - (for the same key) making it vulnerable to a 'dictionary attack'. -- An error will only affect one ciphertext block. - -Cipher Block Chaining Mode (CBC) (des_cbc_encrypt()) -- a multiple of 64 bits are enciphered at a time. -- The CBC mode produces the same ciphertext whenever the same - plaintext is encrypted using the same key and starting variable. -- The chaining operation makes the ciphertext blocks dependent on the - current and all preceding plaintext blocks and therefore blocks can not - be rearranged. -- The use of different starting variables prevents the same plaintext - enciphering to the same ciphertext. -- An error will affect the current and the following ciphertext blocks. - -Cipher Feedback Mode (CFB) (des_cfb_encrypt()) -- a number of bits (j) <= 64 are enciphered at a time. -- The CFB mode produces the same ciphertext whenever the same - plaintext is encrypted using the same key and starting variable. -- The chaining operation makes the ciphertext variables dependent on the - current and all preceding variables and therefore j-bit variables are - chained together and con not be rearranged. -- The use of different starting variables prevents the same plaintext - enciphering to the same ciphertext. -- The strength of the CFB mode depends on the size of k (maximal if - j == k). In my implementation this is always the case. -- Selection of a small value for j will require more cycles through - the encipherment algorithm per unit of plaintext and thus cause - greater processing overheads. -- Only multiples of j bits can be enciphered. -- An error will affect the current and the following ciphertext variables. - -Output Feedback Mode (OFB) (des_ofb_encrypt()) -- a number of bits (j) <= 64 are enciphered at a time. -- The OFB mode produces the same ciphertext whenever the same - plaintext enciphered using the same key and starting variable. More - over, in the OFB mode the same key stream is produced when the same - key and start variable are used. Consequently, for security reasons - a specific start variable should be used only once for a given key. -- The absence of chaining makes the OFB more vulnerable to specific attacks. -- The use of different start variables values prevents the same - plaintext enciphering to the same ciphertext, by producing different - key streams. -- Selection of a small value for j will require more cycles through - the encipherment algorithm per unit of plaintext and thus cause - greater processing overheads. -- Only multiples of j bits can be enciphered. -- OFB mode of operation does not extend ciphertext errors in the - resultant plaintext output. Every bit error in the ciphertext causes - only one bit to be in error in the deciphered plaintext. -- OFB mode is not self-synchronising. If the two operation of - encipherment and decipherment get out of synchronism, the system needs - to be re-initialised. -- Each re-initialisation should use a value of the start variable -different from the start variable values used before with the same -key. The reason for this is that an identical bit stream would be -produced each time from the same parameters. This would be -susceptible to a 'known plaintext' attack. - -Triple ECB Mode (des_ecb3_encrypt()) -- Encrypt with key1, decrypt with key2 and encrypt with key1 again. -- As for ECB encryption but increases the effective key length to 112 bits. -- If both keys are the same it is equivalent to encrypting once with - just one key. - -Triple CBC Mode (des_3cbc_encrypt()) -- Encrypt with key1, decrypt with key2 and encrypt with key1 again. -- As for CBC encryption but increases the effective key length to 112 bits. -- If both keys are the same it is equivalent to encrypting once with - just one key. diff --git a/src/lib/libcrypto/des/Makefile.PL b/src/lib/libcrypto/des/Makefile.PL index b54a24387c..e69de29bb2 100644 --- a/src/lib/libcrypto/des/Makefile.PL +++ b/src/lib/libcrypto/des/Makefile.PL @@ -1,14 +0,0 @@ -use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile being created. -&writeMakefile( - 'potential_libs' => '', # e.g., '-lm' - 'INC' => '', # e.g., '-I/usr/include/other' - 'DISTNAME' => 'DES', - 'VERSION' => '0.1', - 'DEFINE' => '-DPERL5', - 'OBJECT' => 'DES.o cbc_cksm.o cbc_enc.o ecb_enc.o pcbc_enc.o \ - rand_key.o set_key.o str2key.o \ - enc_read.o enc_writ.o fcrypt.o cfb_enc.o \ - ecb3_enc.o ofb_enc.o cbc3_enc.o des_enc.o', - ); diff --git a/src/lib/libcrypto/des/Makefile.lit b/src/lib/libcrypto/des/Makefile.lit index c09f6969da..e69de29bb2 100644 --- a/src/lib/libcrypto/des/Makefile.lit +++ b/src/lib/libcrypto/des/Makefile.lit @@ -1,250 +0,0 @@ -# You must select the correct terminal control system to be used to -# turn character echo off when reading passwords. There a 5 systems -# SGTTY - the old BSD system -# TERMIO - most system V boxes -# TERMIOS - SGI (ala IRIX). -# VMS - the DEC operating system -# MSDOS - we all know what it is :-) -# read_pwd.c makes a reasonable guess at what is correct. - -# Targets -# make - twidle the options yourself :-) -# make cc - standard cc options -# make gcc - standard gcc options -# make x86-elf - linux-elf etc -# make x86-out - linux-a.out, FreeBSD etc -# make x86-solaris -# make x86-bdsi - -# If you are on a DEC Alpha, edit des.h and change the DES_LONG -# define to 'unsigned int'. I have seen this give a %20 speedup. - -OPTS0= -DLIBDES_LIT -DRAND -DTERMIO #-DNOCONST - -# Version 1.94 has changed the strings_to_key function so that it is -# now compatible with MITs when the string is longer than 8 characters. -# If you wish to keep the old version, uncomment the following line. -# This will affect the -E/-D options on des(1). -#OPTS1= -DOLD_STR_TO_KEY - -# There are 4 possible performance options -# -DDES_PTR -# -DDES_RISC1 -# -DDES_RISC2 (only one of DES_RISC1 and DES_RISC2) -# -DDES_UNROLL -# after the initial build, run 'des_opts' to see which options are best -# for your platform. There are some listed in options.txt -#OPTS2= -DDES_PTR -#OPTS3= -DDES_RISC1 # or DES_RISC2 -#OPTS4= -DDES_UNROLL - -OPTS= $(OPTS0) $(OPTS1) $(OPTS2) $(OPTS3) $(OPTS4) - -MAKE=make -f Makefile -#CC=cc -#CFLAG= -O - -CC=gcc -#CFLAG= -O4 -funroll-loops -fomit-frame-pointer -CFLAG= -O3 -fomit-frame-pointer - -CFLAGS=$(OPTS) $(CFLAG) -CPP=$(CC) -E -AS=as - -# Assember version of des_encrypt*(). -DES_ENC=des_enc.o fcrypt_b.o # normal C version -#DES_ENC=asm/dx86-elf.o asm/yx86-elf.o # elf format x86 -#DES_ENC=asm/dx86-out.o asm/yx86-out.o # a.out format x86 -#DES_ENC=asm/dx86-sol.o asm/yx86-sol.o # solaris format x86 -#DES_ENC=asm/dx86bsdi.o asm/yx86basi.o # bsdi format x86 - -LIBDIR=/usr/local/lib -BINDIR=/usr/local/bin -INCDIR=/usr/local/include -MANDIR=/usr/local/man -MAN1=1 -MAN3=3 -SHELL=/bin/sh -OBJ_LIT=cbc_enc.o ecb_enc.o $(DES_ENC) fcrypt.o set_key.o -OBJ_FULL=cbc_cksm.o $(OBJ_LIT) pcbc_enc.o \ - xcbc_enc.o qud_cksm.o \ - cfb64ede.o cfb64enc.o cfb_enc.o ecb3_enc.o \ - enc_read.o enc_writ.o ofb64ede.o ofb64enc.o ofb_enc.o \ - rand_key.o read_pwd.o read2pwd.o rpc_enc.o str2key.o supp.o - -GENERAL_LIT=COPYRIGHT INSTALL README VERSION Makefile des_crypt.man \ - des.doc options.txt asm -GENERAL_FULL=$(GENERAL_LIT) FILES Imakefile times vms.com KERBEROS MODES.DES \ - des.man DES.pm DES.pod DES.xs Makefile.PL dess.cpp des3s.cpp \ - Makefile.uni typemap t Makefile.ssl makefile.bc Makefile.lit \ - des.org des_locl.org -TESTING_LIT= destest speed des_opts -TESTING_FULL= rpw $(TESTING_LIT) -TESTING_SRC_LIT=destest.c speed.c des_opts.c -TESTING_SRC_FULL=rpw.c $(TESTING_SRC_LIT) -HEADERS_LIT=des_ver.h des.h des_locl.h podd.h sk.h spr.h -HEADERS_FULL= $(HEADERS_LIT) rpc_des.h -LIBDES_LIT=cbc_enc.c ecb_enc.c fcrypt.c set_key.c des_enc.c fcrypt_b.c -LIBDES_FULL= cbc_cksm.c pcbc_enc.c qud_cksm.c \ - cfb64ede.c cfb64enc.c cfb_enc.c ecb3_enc.c \ - enc_read.c enc_writ.c ofb64ede.c ofb64enc.c ofb_enc.c \ - rand_key.c rpc_enc.c str2key.c supp.c \ - xcbc_enc.c $(LIBDES_LIT) read_pwd.c read2pwd.c - -PERL= des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl - -OBJ= $(OBJ_LIT) -GENERAL=$(GENERAL_LIT) -TESTING=$(TESTING_LIT) -TESTING_SRC=$(TESTING_SRC_LIT) -HEADERS=$(HEADERS_LIT) -LIBDES= $(LIBDES_LIT) - -ALL= $(GENERAL) $(TESTING_SRC) $(LIBDES) $(PERL) $(HEADERS) - -DLIB= libdes.a - -all: $(DLIB) $(TESTING) - -cc: - $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all - -gcc: - $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all - -x86-elf: - $(MAKE) DES_ENC='asm/dx86-elf.o asm/yx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all - -x86-out: - $(MAKE) DES_ENC='asm/dx86-out.o asm/yx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all - -x86-solaris: - $(MAKE) DES_ENC='asm/dx86-sol.o asm/yx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all - -x86-bsdi: - $(MAKE) DES_ENC='asm/dx86bsdi.o asm/yx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all - -# elf -asm/dx86-elf.o: asm/dx86unix.cpp - $(CPP) -DELF asm/dx86unix.cpp | $(AS) -o asm/dx86-elf.o - -asm/yx86-elf.o: asm/yx86unix.cpp - $(CPP) -DELF asm/yx86unix.cpp | $(AS) -o asm/yx86-elf.o - -# solaris -asm/dx86-sol.o: asm/dx86unix.cpp - $(CC) -E -DSOL asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s - as -o asm/dx86-sol.o asm/dx86-sol.s - rm -f asm/dx86-sol.s - -asm/yx86-sol.o: asm/yx86unix.cpp - $(CC) -E -DSOL asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s - as -o asm/yx86-sol.o asm/yx86-sol.s - rm -f asm/yx86-sol.s - -# a.out -asm/dx86-out.o: asm/dx86unix.cpp - $(CPP) -DOUT asm/dx86unix.cpp | $(AS) -o asm/dx86-out.o - -asm/yx86-out.o: asm/yx86unix.cpp - $(CPP) -DOUT asm/yx86unix.cpp | $(AS) -o asm/yx86-out.o - -# bsdi -asm/dx86bsdi.o: asm/dx86unix.cpp - $(CPP) -DBSDI asm/dx86unix.cpp | $(AS) -o asm/dx86bsdi.o - -asm/yx86bsdi.o: asm/yx86unix.cpp - $(CPP) -DBSDI asm/yx86unix.cpp | $(AS) -o asm/yx86bsdi.o - -asm/dx86unix.cpp: - (cd asm; perl des-586.pl cpp >dx86unix.cpp) - -asm/yx86unix.cpp: - (cd asm; perl crypt586.pl cpp >yx86unix.cpp) - -test: all - ./destest - -$(DLIB): $(OBJ) - /bin/rm -f $(DLIB) - ar cr $(DLIB) $(OBJ) - -if test -s /bin/ranlib; then /bin/ranlib $(DLIB); \ - else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(DLIB); \ - else exit 0; fi; fi - -des_opts: des_opts.o $(DLIB) - $(CC) $(CFLAGS) -o des_opts des_opts.o $(DLIB) - -destest: destest.o $(DLIB) - $(CC) $(CFLAGS) -o destest destest.o $(DLIB) - -rpw: rpw.o $(DLIB) - $(CC) $(CFLAGS) -o rpw rpw.o $(DLIB) - -speed: speed.o $(DLIB) - $(CC) $(CFLAGS) -o speed speed.o $(DLIB) - -des: des.o $(DLIB) - $(CC) $(CFLAGS) -o des des.o $(DLIB) - -tags: - ctags $(TESTING_SRC) $(LIBDES) - -tar_lit: - /bin/mv Makefile Makefile.tmp - /bin/cp Makefile.lit Makefile - tar chf libdes-l.tar $(LIBDES_LIT) $(HEADERS_LIT) \ - $(GENERAL_LIT) $(TESTING_SRC_LIT) - /bin/rm -f Makefile - /bin/mv Makefile.tmp Makefile - -tar: - tar chf libdes.tar $(ALL) - -shar: - shar $(ALL) >libdes.shar - -depend: - makedepend $(LIBDES) $(TESTING_SRC) - -clean: - /bin/rm -f *.o tags core $(TESTING) $(DLIB) .nfs* *.old *.bak asm/*.o - -dclean: - sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new - mv -f Makefile.new Makefile - -# Eric is probably going to choke when he next looks at this --tjh -install: - if test $(INSTALLTOP); then \ - echo SSL style install; \ - cp $(DLIB) $(INSTALLTOP)/lib; \ - if test -s /bin/ranlib; then \ - /bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ - else \ - if test -s /usr/bin/ranlib; then \ - /usr/bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ - fi; fi; \ - chmod 644 $(INSTALLTOP)/lib/$(DLIB); \ - cp des.h $(INSTALLTOP)/include; \ - chmod 644 $(INSTALLTOP)/include/des.h; \ - else \ - echo Standalone install; \ - cp $(DLIB) $(LIBDIR)/$(DLIB); \ - if test -s /bin/ranlib; then \ - /bin/ranlib $(LIBDIR)/$(DLIB); \ - else \ - if test -s /usr/bin/ranlib; then \ - /usr/bin/ranlib $(LIBDIR)/$(DLIB); \ - fi; \ - fi; \ - chmod 644 $(LIBDIR)/$(DLIB); \ - cp des_crypt.man $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ - chmod 644 $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ - cp des.man $(MANDIR)/man$(MAN1)/des.$(MAN1); \ - chmod 644 $(MANDIR)/man$(MAN1)/des.$(MAN1); \ - cp des.h $(INCDIR)/des.h; \ - chmod 644 $(INCDIR)/des.h; \ - fi -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/des/Makefile.ssl b/src/lib/libcrypto/des/Makefile.ssl index 41976655e9..3eb0738b7b 100644 --- a/src/lib/libcrypto/des/Makefile.ssl +++ b/src/lib/libcrypto/des/Makefile.ssl @@ -32,21 +32,21 @@ LIBSRC= cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \ fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c \ qud_cksm.c rand_key.c read_pwd.c rpc_enc.c set_key.c \ des_enc.c fcrypt_b.c read2pwd.c \ - fcrypt.c xcbc_enc.c \ - str2key.c cfb64ede.c ofb64ede.c supp.c ede_cbcm_enc.c + xcbc_enc.c \ + str2key.c cfb64ede.c ofb64ede.c ede_cbcm_enc.c LIBOBJ= set_key.o ecb_enc.o cbc_enc.o \ ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o \ enc_read.o enc_writ.o ofb64enc.o \ ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o \ ${DES_ENC} read2pwd.o \ - fcrypt.o xcbc_enc.o read_pwd.o rpc_enc.o cbc_cksm.o supp.o \ + fcrypt.o xcbc_enc.o read_pwd.o rpc_enc.o cbc_cksm.o \ ede_cbcm_enc.o SRC= $(LIBSRC) EXHEADER= des.h -HEADER= des_locl.h rpc_des.h podd.h sk.h spr.h des_ver.h $(EXHEADER) +HEADER= des_locl.h rpc_des.h spr.h des_ver.h $(EXHEADER) ALL= $(GENERAL) $(SRC) $(HEADER) @@ -65,10 +65,10 @@ des: des.o cbc3_enc.o lib # elf asm/dx86-elf.o: asm/dx86unix.cpp - $(CPP) -DELF asm/dx86unix.cpp | as -o asm/dx86-elf.o + $(CPP) -DELF -x c asm/dx86unix.cpp | as -o asm/dx86-elf.o asm/yx86-elf.o: asm/yx86unix.cpp - $(CPP) -DELF asm/yx86unix.cpp | as -o asm/yx86-elf.o + $(CPP) -DELF -x c asm/yx86unix.cpp | as -o asm/yx86-elf.o # solaris asm/dx86-sol.o: asm/dx86unix.cpp @@ -95,10 +95,10 @@ asm/dx86bsdi.o: asm/dx86unix.cpp asm/yx86bsdi.o: asm/yx86unix.cpp $(CPP) -DBSDI asm/yx86unix.cpp | sed 's/ :/:/' | as -o asm/yx86bsdi.o -asm/dx86unix.cpp: asm/des-586.pl +asm/dx86unix.cpp: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl (cd asm; $(PERL) des-586.pl cpp >dx86unix.cpp) -asm/yx86unix.cpp: asm/crypt586.pl +asm/yx86unix.cpp: asm/crypt586.pl ../perlasm/x86asm.pl (cd asm; $(PERL) crypt586.pl cpp >yx86unix.cpp) files: @@ -172,10 +172,8 @@ enc_writ.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h enc_writ.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h enc_writ.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h enc_writ.o: ../cryptlib.h des_locl.h -fcrypt.o: ../../include/openssl/des.h ../../include/openssl/des.h -fcrypt.o: ../../include/openssl/e_os2.h ../../include/openssl/e_os2.h -fcrypt.o: ../../include/openssl/opensslconf.h -fcrypt.o: ../../include/openssl/opensslconf.h des_locl.h des_locl.h +fcrypt.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h +fcrypt.o: ../../include/openssl/opensslconf.h des_locl.h fcrypt_b.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h fcrypt_b.o: ../../include/openssl/opensslconf.h des_locl.h ofb64ede.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h @@ -201,10 +199,8 @@ read_pwd.o: ../../include/openssl/stack.h ../cryptlib.h des_locl.h rpc_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h rpc_enc.o: ../../include/openssl/opensslconf.h des_locl.h des_ver.h rpc_des.h set_key.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h -set_key.o: ../../include/openssl/opensslconf.h des_locl.h podd.h sk.h +set_key.o: ../../include/openssl/opensslconf.h des_locl.h str2key.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h str2key.o: ../../include/openssl/opensslconf.h des_locl.h -supp.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h -supp.o: ../../include/openssl/opensslconf.h des_locl.h xcbc_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h xcbc_enc.o: ../../include/openssl/opensslconf.h des_locl.h diff --git a/src/lib/libcrypto/des/Makefile.uni b/src/lib/libcrypto/des/Makefile.uni index ec19d75b81..e69de29bb2 100644 --- a/src/lib/libcrypto/des/Makefile.uni +++ b/src/lib/libcrypto/des/Makefile.uni @@ -1,251 +0,0 @@ -# You must select the correct terminal control system to be used to -# turn character echo off when reading passwords. There a 5 systems -# SGTTY - the old BSD system -# TERMIO - most system V boxes -# TERMIOS - SGI (ala IRIX). -# VMS - the DEC operating system -# MSDOS - we all know what it is :-) -# read_pwd.c makes a reasonable guess at what is correct. - -# Targets -# make - twidle the options yourself :-) -# make cc - standard cc options -# make gcc - standard gcc options -# make x86-elf - linux-elf etc -# make x86-out - linux-a.out, FreeBSD etc -# make x86-solaris -# make x86-bdsi - -# If you are on a DEC Alpha, edit des.h and change the DES_LONG -# define to 'unsigned int'. I have seen this give a %20 speedup. - -OPTS0= -DRAND -DTERMIO #-DNOCONST - -# Version 1.94 has changed the strings_to_key function so that it is -# now compatible with MITs when the string is longer than 8 characters. -# If you wish to keep the old version, uncomment the following line. -# This will affect the -E/-D options on des(1). -#OPTS1= -DOLD_STR_TO_KEY - -# There are 4 possible performance options -# -DDES_PTR -# -DDES_RISC1 -# -DDES_RISC2 (only one of DES_RISC1 and DES_RISC2) -# -DDES_UNROLL -# after the initial build, run 'des_opts' to see which options are best -# for your platform. There are some listed in options.txt -#OPTS2= -DDES_PTR -#OPTS3= -DDES_RISC1 # or DES_RISC2 -#OPTS4= -DDES_UNROLL - -OPTS= $(OPTS0) $(OPTS1) $(OPTS2) $(OPTS3) $(OPTS4) - -MAKE=make -f Makefile -#CC=cc -#CFLAG= -O - -CC=gcc -#CFLAG= -O4 -funroll-loops -fomit-frame-pointer -CFLAG= -O3 -fomit-frame-pointer - -CFLAGS=$(OPTS) $(CFLAG) -CPP=$(CC) -E -AS=as -RANLIB=ranlib - -# Assember version of des_encrypt*(). -DES_ENC=des_enc.o fcrypt_b.o # normal C version -#DES_ENC=asm/dx86-elf.o asm/yx86-elf.o # elf format x86 -#DES_ENC=asm/dx86-out.o asm/yx86-out.o # a.out format x86 -#DES_ENC=asm/dx86-sol.o asm/yx86-sol.o # solaris format x86 -#DES_ENC=asm/dx86bsdi.o asm/yx86basi.o # bsdi format x86 - -LIBDIR=/usr/local/lib -BINDIR=/usr/local/bin -INCDIR=/usr/local/include -MANDIR=/usr/local/man -MAN1=1 -MAN3=3 -SHELL=/bin/sh -OBJ_LIT=cbc_enc.o ecb_enc.o $(DES_ENC) fcrypt.o set_key.o -OBJ_FULL=cbc_cksm.o $(OBJ_LIT) pcbc_enc.o \ - xcbc_enc.o qud_cksm.o cbc3_enc.o \ - cfb64ede.o cfb64enc.o cfb_enc.o ecb3_enc.o \ - enc_read.o enc_writ.o ofb64ede.o ofb64enc.o ofb_enc.o \ - rand_key.o read_pwd.o read2pwd.o rpc_enc.o str2key.o supp.o - -GENERAL_LIT=COPYRIGHT INSTALL README VERSION Makefile des_crypt.man \ - des.doc options.txt asm -GENERAL_FULL=$(GENERAL_LIT) FILES Imakefile times vms.com KERBEROS MODES.DES \ - des.man DES.pm DES.pod DES.xs Makefile.PL dess.cpp des3s.cpp \ - Makefile.uni typemap t Makefile.ssl makefile.bc Makefile.lit \ - des.org des_locl.org -TESTING_LIT= destest speed des_opts -TESTING_FULL= rpw des $(TESTING_LIT) -TESTING_SRC_LIT=destest.c speed.c des_opts.c -TESTING_SRC_FULL=rpw.c des.c $(TESTING_SRC_LIT) -HEADERS_LIT=des_ver.h des.h des_locl.h podd.h sk.h spr.h -HEADERS_FULL= $(HEADERS_LIT) rpc_des.h -LIBDES_LIT=cbc_enc.c ecb_enc.c fcrypt.c set_key.c des_enc.c fcrypt_b.c -LIBDES_FULL= cbc_cksm.c pcbc_enc.c qud_cksm.c cbc3_enc.c \ - cfb64ede.c cfb64enc.c cfb_enc.c ecb3_enc.c \ - enc_read.c enc_writ.c ofb64ede.c ofb64enc.c ofb_enc.c \ - rand_key.c rpc_enc.c str2key.c supp.c \ - xcbc_enc.c $(LIBDES_LIT) read_pwd.c read2pwd.c - -PERL= des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl - -OBJ= $(OBJ_FULL) -GENERAL=$(GENERAL_FULL) -TESTING=$(TESTING_FULL) -TESTING_SRC=$(TESTING_SRC_FULL) -HEADERS=$(HEADERS_FULL) -LIBDES= $(LIBDES_FULL) - -ALL= $(GENERAL) $(TESTING_SRC) $(LIBDES) $(PERL) $(HEADERS) - -DLIB= libdes.a - -all: $(DLIB) $(TESTING) - -cc: - $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all - -gcc: - $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all - -x86-elf: - $(MAKE) DES_ENC='asm/dx86-elf.o asm/yx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all - -x86-out: - $(MAKE) DES_ENC='asm/dx86-out.o asm/yx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all - -x86-solaris: - $(MAKE) DES_ENC='asm/dx86-sol.o asm/yx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all - -x86-bsdi: - $(MAKE) DES_ENC='asm/dx86bsdi.o asm/yx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all - -# elf -asm/dx86-elf.o: asm/dx86unix.cpp - $(CPP) -DELF asm/dx86unix.cpp | $(AS) -o asm/dx86-elf.o - -asm/yx86-elf.o: asm/yx86unix.cpp - $(CPP) -DELF asm/yx86unix.cpp | $(AS) -o asm/yx86-elf.o - -# solaris -asm/dx86-sol.o: asm/dx86unix.cpp - $(CC) -E -DSOL asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s - as -o asm/dx86-sol.o asm/dx86-sol.s - rm -f asm/dx86-sol.s - -asm/yx86-sol.o: asm/yx86unix.cpp - $(CC) -E -DSOL asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s - as -o asm/yx86-sol.o asm/yx86-sol.s - rm -f asm/yx86-sol.s - -# a.out -asm/dx86-out.o: asm/dx86unix.cpp - $(CPP) -DOUT asm/dx86unix.cpp | $(AS) -o asm/dx86-out.o - -asm/yx86-out.o: asm/yx86unix.cpp - $(CPP) -DOUT asm/yx86unix.cpp | $(AS) -o asm/yx86-out.o - -# bsdi -asm/dx86bsdi.o: asm/dx86unix.cpp - $(CPP) -DBSDI asm/dx86unix.cpp | $(AS) -o asm/dx86bsdi.o - -asm/yx86bsdi.o: asm/yx86unix.cpp - $(CPP) -DBSDI asm/yx86unix.cpp | $(AS) -o asm/yx86bsdi.o - -asm/dx86unix.cpp: - (cd asm; perl des-586.pl cpp >dx86unix.cpp) - -asm/yx86unix.cpp: - (cd asm; perl crypt586.pl cpp >yx86unix.cpp) - -test: all - ./destest - -$(DLIB): $(OBJ) - /bin/rm -f $(DLIB) - ar cr $(DLIB) $(OBJ) - $(RANLIB) $(DLIB) - -des_opts: des_opts.o $(DLIB) - $(CC) $(CFLAGS) -o des_opts des_opts.o $(DLIB) - -destest: destest.o $(DLIB) - $(CC) $(CFLAGS) -o destest destest.o $(DLIB) - -rpw: rpw.o $(DLIB) - $(CC) $(CFLAGS) -o rpw rpw.o $(DLIB) - -speed: speed.o $(DLIB) - $(CC) $(CFLAGS) -o speed speed.o $(DLIB) - -des: des.o $(DLIB) - $(CC) $(CFLAGS) -o des des.o $(DLIB) - -tags: - ctags $(TESTING_SRC) $(LIBDES) - -tar_lit: - /bin/mv Makefile Makefile.tmp - /bin/cp Makefile.lit Makefile - for i in $(HEADERS_LIT) $(LIBDES_LIT) $(GENERAL_LIT) $(TESTING_SRC_LIT) ;\ - do \ - n="$$n des/$$i"; \ - done; \ - ( cd .. ; tar chf - $$n )| gzip > libdes-l.tgz - /bin/rm -f Makefile - /bin/mv Makefile.tmp Makefile - -tar: - mv Makefile Makefile.tmp - /bin/cp Makefile.uni Makefile - for i in $(ALL) ;\ - do \ - n="$$n des/$$i"; \ - done; \ - ( cd .. ; tar chf - $$n )| gzip > libdes.tgz - /bin/rm -f Makefile - /bin/mv Makefile.tmp Makefile - -shar: - shar $(ALL) >libdes.shar - -depend: - makedepend $(LIBDES) $(TESTING_SRC) - -clean: - /bin/rm -f *.o tags core $(TESTING) $(DLIB) .nfs* *.old *.bak asm/*.o - -dclean: - sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new - mv -f Makefile.new Makefile - -# Eric is probably going to choke when he next looks at this --tjh -install: des - if test $(INSTALLTOP); then \ - echo SSL style install; \ - cp $(DLIB) $(INSTALLTOP)/lib; \ - $(RANLIB) $(DLIB); \ - chmod 644 $(INSTALLTOP)/lib/$(DLIB); \ - cp des.h $(INSTALLTOP)/include; \ - chmod 644 $(INSTALLTOP)/include/des.h; \ - else \ - echo Standalone install; \ - cp $(DLIB) $(LIBDIR)/$(DLIB); \ - $(RANLIB) $(DLIB); \ - chmod 644 $(LIBDIR)/$(DLIB); \ - cp des $(BINDIR)/des; \ - chmod 711 $(BINDIR)/des; \ - cp des_crypt.man $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ - chmod 644 $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ - cp des.man $(MANDIR)/man$(MAN1)/des.$(MAN1); \ - chmod 644 $(MANDIR)/man$(MAN1)/des.$(MAN1); \ - cp des.h $(INCDIR)/des.h; \ - chmod 644 $(INCDIR)/des.h; \ - fi -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/des/PC1 b/src/lib/libcrypto/des/PC1 index efb8348b72..e69de29bb2 100644 --- a/src/lib/libcrypto/des/PC1 +++ b/src/lib/libcrypto/des/PC1 @@ -1,28 +0,0 @@ -#!/usr/local/bin/perl - -@PC1=( 57,49,41,33,25,17, 9, - 1,58,50,42,34,26,18, - 10, 2,59,51,43,35,27, - 19,11, 3,60,52,44,36, - "-","-","-","-", - 63,55,47,39,31,23,15, - 7,62,54,46,38,30,22, - 14, 6,61,53,45,37,29, - 21,13, 5,28,20,12, 4, - "-","-","-","-", - ); - -foreach (@PC1) - { - if ($_ ne "-") - { - $_--; - $_=int($_/8)*8+7-($_%8); - printf "%2d ",$_; - } - else - { print "-- "; } - print "\n" if (((++$i) % 8) == 0); - print "\n" if ((($i) % 32) == 0); - } - diff --git a/src/lib/libcrypto/des/PC2 b/src/lib/libcrypto/des/PC2 index 2d560270ec..e69de29bb2 100644 --- a/src/lib/libcrypto/des/PC2 +++ b/src/lib/libcrypto/des/PC2 @@ -1,57 +0,0 @@ -#!/usr/local/bin/perl - -@PC2_C=(14,17,11,24, 1, 5, - 3,28,15, 6,21,10, - 23,19,12, 4,26, 8, - 16, 7,27,20,13, 2, - ); - -@PC2_D=(41,52,31,37,47,55, - 30,40,51,45,33,48, - 44,49,39,56,34,53, - 46,42,50,36,29,32, - ); - -foreach (@PC2_C) { - if ($_ ne "-") - { - $_--; - printf "%2d ",$_; } - else { print "-- "; } - $C{$_}=1; - print "\n" if (((++$i) % 8) == 0); - } -$i=0; -print "\n"; -foreach (@PC2_D) { - if ($_ ne "-") - { - $_-=29; - printf "%2d ",$_; } - else { print "-- "; } - $D{$_}=1; - print "\n" if (((++$i) % 8) == 0); } - -print "\n"; -foreach $i (0 .. 27) - { - $_=$C{$i}; - if ($_ ne "-") {printf "%2d ",$_;} - else { print "-- "; } - print "\n" if (((++$i) % 8) == 0); - } -print "\n"; - -print "\n"; -foreach $i (0 .. 27) - { - $_=$D{$i}; - if ($_ ne "-") {printf "%2d ",$_;} - else { print "-- "; } - print "\n" if (((++$i) % 8) == 0); - } -print "\n"; -sub numsort - { - $a-$b; - } diff --git a/src/lib/libcrypto/des/asm/d-win32.asm b/src/lib/libcrypto/des/asm/d-win32.asm index 9e3dc9cd87..e69de29bb2 100644 --- a/src/lib/libcrypto/des/asm/d-win32.asm +++ b/src/lib/libcrypto/des/asm/d-win32.asm @@ -1,3132 +0,0 @@ - ; Don't even think of reading this code - ; It was automatically generated by des-586.pl - ; Which is a perl program used to generate the x86 assember for - ; any of elf, a.out, BSDI,Win32, or Solaris - ; eric - ; - TITLE des-586.asm - .386 -.model FLAT -_TEXT SEGMENT -PUBLIC _des_encrypt -EXTRN _des_SPtrans:DWORD -_des_encrypt PROC NEAR - push esi - push edi - ; - ; Load the 2 words - mov esi, DWORD PTR 12[esp] - xor ecx, ecx - push ebx - push ebp - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 28[esp] - mov edi, DWORD PTR 4[esi] - ; - ; IP - rol eax, 4 - mov esi, eax - xor eax, edi - and eax, 0f0f0f0f0h - xor esi, eax - xor edi, eax - ; - rol edi, 20 - mov eax, edi - xor edi, esi - and edi, 0fff0000fh - xor eax, edi - xor esi, edi - ; - rol eax, 14 - mov edi, eax - xor eax, esi - and eax, 033333333h - xor edi, eax - xor esi, eax - ; - rol esi, 22 - mov eax, esi - xor esi, edi - and esi, 003fc03fch - xor eax, esi - xor edi, esi - ; - rol eax, 9 - mov esi, eax - xor eax, edi - and eax, 0aaaaaaaah - xor esi, eax - xor edi, eax - ; - rol edi, 1 - mov ebp, DWORD PTR 24[esp] - cmp ebx, 0 - je $L000start_decrypt - ; - ; Round 0 - mov eax, DWORD PTR [ebp] - xor ebx, ebx - mov edx, DWORD PTR 4[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 1 - mov eax, DWORD PTR 8[ebp] - xor ebx, ebx - mov edx, DWORD PTR 12[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 2 - mov eax, DWORD PTR 16[ebp] - xor ebx, ebx - mov edx, DWORD PTR 20[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 3 - mov eax, DWORD PTR 24[ebp] - xor ebx, ebx - mov edx, DWORD PTR 28[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 4 - mov eax, DWORD PTR 32[ebp] - xor ebx, ebx - mov edx, DWORD PTR 36[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 5 - mov eax, DWORD PTR 40[ebp] - xor ebx, ebx - mov edx, DWORD PTR 44[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 6 - mov eax, DWORD PTR 48[ebp] - xor ebx, ebx - mov edx, DWORD PTR 52[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 7 - mov eax, DWORD PTR 56[ebp] - xor ebx, ebx - mov edx, DWORD PTR 60[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 8 - mov eax, DWORD PTR 64[ebp] - xor ebx, ebx - mov edx, DWORD PTR 68[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 9 - mov eax, DWORD PTR 72[ebp] - xor ebx, ebx - mov edx, DWORD PTR 76[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 10 - mov eax, DWORD PTR 80[ebp] - xor ebx, ebx - mov edx, DWORD PTR 84[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 11 - mov eax, DWORD PTR 88[ebp] - xor ebx, ebx - mov edx, DWORD PTR 92[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 12 - mov eax, DWORD PTR 96[ebp] - xor ebx, ebx - mov edx, DWORD PTR 100[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 13 - mov eax, DWORD PTR 104[ebp] - xor ebx, ebx - mov edx, DWORD PTR 108[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 14 - mov eax, DWORD PTR 112[ebp] - xor ebx, ebx - mov edx, DWORD PTR 116[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 15 - mov eax, DWORD PTR 120[ebp] - xor ebx, ebx - mov edx, DWORD PTR 124[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - jmp $L001end -$L000start_decrypt: - ; - ; Round 15 - mov eax, DWORD PTR 120[ebp] - xor ebx, ebx - mov edx, DWORD PTR 124[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 14 - mov eax, DWORD PTR 112[ebp] - xor ebx, ebx - mov edx, DWORD PTR 116[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 13 - mov eax, DWORD PTR 104[ebp] - xor ebx, ebx - mov edx, DWORD PTR 108[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 12 - mov eax, DWORD PTR 96[ebp] - xor ebx, ebx - mov edx, DWORD PTR 100[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 11 - mov eax, DWORD PTR 88[ebp] - xor ebx, ebx - mov edx, DWORD PTR 92[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 10 - mov eax, DWORD PTR 80[ebp] - xor ebx, ebx - mov edx, DWORD PTR 84[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 9 - mov eax, DWORD PTR 72[ebp] - xor ebx, ebx - mov edx, DWORD PTR 76[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 8 - mov eax, DWORD PTR 64[ebp] - xor ebx, ebx - mov edx, DWORD PTR 68[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 7 - mov eax, DWORD PTR 56[ebp] - xor ebx, ebx - mov edx, DWORD PTR 60[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 6 - mov eax, DWORD PTR 48[ebp] - xor ebx, ebx - mov edx, DWORD PTR 52[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 5 - mov eax, DWORD PTR 40[ebp] - xor ebx, ebx - mov edx, DWORD PTR 44[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 4 - mov eax, DWORD PTR 32[ebp] - xor ebx, ebx - mov edx, DWORD PTR 36[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 3 - mov eax, DWORD PTR 24[ebp] - xor ebx, ebx - mov edx, DWORD PTR 28[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 2 - mov eax, DWORD PTR 16[ebp] - xor ebx, ebx - mov edx, DWORD PTR 20[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 1 - mov eax, DWORD PTR 8[ebp] - xor ebx, ebx - mov edx, DWORD PTR 12[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 0 - mov eax, DWORD PTR [ebp] - xor ebx, ebx - mov edx, DWORD PTR 4[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx -$L001end: - ; - ; FP - mov edx, DWORD PTR 20[esp] - ror esi, 1 - mov eax, edi - xor edi, esi - and edi, 0aaaaaaaah - xor eax, edi - xor esi, edi - ; - rol eax, 23 - mov edi, eax - xor eax, esi - and eax, 003fc03fch - xor edi, eax - xor esi, eax - ; - rol edi, 10 - mov eax, edi - xor edi, esi - and edi, 033333333h - xor eax, edi - xor esi, edi - ; - rol esi, 18 - mov edi, esi - xor esi, eax - and esi, 0fff0000fh - xor edi, esi - xor eax, esi - ; - rol edi, 12 - mov esi, edi - xor edi, eax - and edi, 0f0f0f0f0h - xor esi, edi - xor eax, edi - ; - ror eax, 4 - mov DWORD PTR [edx],eax - mov DWORD PTR 4[edx],esi - pop ebp - pop ebx - pop edi - pop esi - ret -_des_encrypt ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _des_encrypt2 -EXTRN _des_SPtrans:DWORD -_des_encrypt2 PROC NEAR - push esi - push edi - ; - ; Load the 2 words - mov eax, DWORD PTR 12[esp] - xor ecx, ecx - push ebx - push ebp - mov esi, DWORD PTR [eax] - mov ebx, DWORD PTR 28[esp] - rol esi, 3 - mov edi, DWORD PTR 4[eax] - rol edi, 3 - mov ebp, DWORD PTR 24[esp] - cmp ebx, 0 - je $L002start_decrypt - ; - ; Round 0 - mov eax, DWORD PTR [ebp] - xor ebx, ebx - mov edx, DWORD PTR 4[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 1 - mov eax, DWORD PTR 8[ebp] - xor ebx, ebx - mov edx, DWORD PTR 12[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 2 - mov eax, DWORD PTR 16[ebp] - xor ebx, ebx - mov edx, DWORD PTR 20[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 3 - mov eax, DWORD PTR 24[ebp] - xor ebx, ebx - mov edx, DWORD PTR 28[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 4 - mov eax, DWORD PTR 32[ebp] - xor ebx, ebx - mov edx, DWORD PTR 36[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 5 - mov eax, DWORD PTR 40[ebp] - xor ebx, ebx - mov edx, DWORD PTR 44[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 6 - mov eax, DWORD PTR 48[ebp] - xor ebx, ebx - mov edx, DWORD PTR 52[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 7 - mov eax, DWORD PTR 56[ebp] - xor ebx, ebx - mov edx, DWORD PTR 60[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 8 - mov eax, DWORD PTR 64[ebp] - xor ebx, ebx - mov edx, DWORD PTR 68[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 9 - mov eax, DWORD PTR 72[ebp] - xor ebx, ebx - mov edx, DWORD PTR 76[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 10 - mov eax, DWORD PTR 80[ebp] - xor ebx, ebx - mov edx, DWORD PTR 84[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 11 - mov eax, DWORD PTR 88[ebp] - xor ebx, ebx - mov edx, DWORD PTR 92[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 12 - mov eax, DWORD PTR 96[ebp] - xor ebx, ebx - mov edx, DWORD PTR 100[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 13 - mov eax, DWORD PTR 104[ebp] - xor ebx, ebx - mov edx, DWORD PTR 108[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 14 - mov eax, DWORD PTR 112[ebp] - xor ebx, ebx - mov edx, DWORD PTR 116[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 15 - mov eax, DWORD PTR 120[ebp] - xor ebx, ebx - mov edx, DWORD PTR 124[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - jmp $L003end -$L002start_decrypt: - ; - ; Round 15 - mov eax, DWORD PTR 120[ebp] - xor ebx, ebx - mov edx, DWORD PTR 124[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 14 - mov eax, DWORD PTR 112[ebp] - xor ebx, ebx - mov edx, DWORD PTR 116[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 13 - mov eax, DWORD PTR 104[ebp] - xor ebx, ebx - mov edx, DWORD PTR 108[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 12 - mov eax, DWORD PTR 96[ebp] - xor ebx, ebx - mov edx, DWORD PTR 100[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 11 - mov eax, DWORD PTR 88[ebp] - xor ebx, ebx - mov edx, DWORD PTR 92[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 10 - mov eax, DWORD PTR 80[ebp] - xor ebx, ebx - mov edx, DWORD PTR 84[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 9 - mov eax, DWORD PTR 72[ebp] - xor ebx, ebx - mov edx, DWORD PTR 76[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 8 - mov eax, DWORD PTR 64[ebp] - xor ebx, ebx - mov edx, DWORD PTR 68[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 7 - mov eax, DWORD PTR 56[ebp] - xor ebx, ebx - mov edx, DWORD PTR 60[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 6 - mov eax, DWORD PTR 48[ebp] - xor ebx, ebx - mov edx, DWORD PTR 52[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 5 - mov eax, DWORD PTR 40[ebp] - xor ebx, ebx - mov edx, DWORD PTR 44[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 4 - mov eax, DWORD PTR 32[ebp] - xor ebx, ebx - mov edx, DWORD PTR 36[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 3 - mov eax, DWORD PTR 24[ebp] - xor ebx, ebx - mov edx, DWORD PTR 28[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 2 - mov eax, DWORD PTR 16[ebp] - xor ebx, ebx - mov edx, DWORD PTR 20[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 1 - mov eax, DWORD PTR 8[ebp] - xor ebx, ebx - mov edx, DWORD PTR 12[ebp] - xor eax, esi - xor edx, esi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 0 - mov eax, DWORD PTR [ebp] - xor ebx, ebx - mov edx, DWORD PTR 4[ebp] - xor eax, edi - xor edx, edi - and eax, 0fcfcfcfch - and edx, 0cfcfcfcfh - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx -$L003end: - ; - ; Fixup - ror edi, 3 - mov eax, DWORD PTR 20[esp] - ror esi, 3 - mov DWORD PTR [eax],edi - mov DWORD PTR 4[eax],esi - pop ebp - pop ebx - pop edi - pop esi - ret -_des_encrypt2 ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _des_encrypt3 - -_des_encrypt3 PROC NEAR - push ebx - mov ebx, DWORD PTR 8[esp] - push ebp - push esi - push edi - ; - ; Load the data words - mov edi, DWORD PTR [ebx] - mov esi, DWORD PTR 4[ebx] - sub esp, 12 - ; - ; IP - rol edi, 4 - mov edx, edi - xor edi, esi - and edi, 0f0f0f0f0h - xor edx, edi - xor esi, edi - ; - rol esi, 20 - mov edi, esi - xor esi, edx - and esi, 0fff0000fh - xor edi, esi - xor edx, esi - ; - rol edi, 14 - mov esi, edi - xor edi, edx - and edi, 033333333h - xor esi, edi - xor edx, edi - ; - rol edx, 22 - mov edi, edx - xor edx, esi - and edx, 003fc03fch - xor edi, edx - xor esi, edx - ; - rol edi, 9 - mov edx, edi - xor edi, esi - and edi, 0aaaaaaaah - xor edx, edi - xor esi, edi - ; - ror edx, 3 - ror esi, 2 - mov DWORD PTR 4[ebx],esi - mov eax, DWORD PTR 36[esp] - mov DWORD PTR [ebx],edx - mov edi, DWORD PTR 40[esp] - mov esi, DWORD PTR 44[esp] - mov DWORD PTR 8[esp],1 - mov DWORD PTR 4[esp],eax - mov DWORD PTR [esp],ebx - call _des_encrypt2 - mov DWORD PTR 8[esp],0 - mov DWORD PTR 4[esp],edi - mov DWORD PTR [esp],ebx - call _des_encrypt2 - mov DWORD PTR 8[esp],1 - mov DWORD PTR 4[esp],esi - mov DWORD PTR [esp],ebx - call _des_encrypt2 - add esp, 12 - mov edi, DWORD PTR [ebx] - mov esi, DWORD PTR 4[ebx] - ; - ; FP - rol esi, 2 - rol edi, 3 - mov eax, edi - xor edi, esi - and edi, 0aaaaaaaah - xor eax, edi - xor esi, edi - ; - rol eax, 23 - mov edi, eax - xor eax, esi - and eax, 003fc03fch - xor edi, eax - xor esi, eax - ; - rol edi, 10 - mov eax, edi - xor edi, esi - and edi, 033333333h - xor eax, edi - xor esi, edi - ; - rol esi, 18 - mov edi, esi - xor esi, eax - and esi, 0fff0000fh - xor edi, esi - xor eax, esi - ; - rol edi, 12 - mov esi, edi - xor edi, eax - and edi, 0f0f0f0f0h - xor esi, edi - xor eax, edi - ; - ror eax, 4 - mov DWORD PTR [ebx],eax - mov DWORD PTR 4[ebx],esi - pop edi - pop esi - pop ebp - pop ebx - ret -_des_encrypt3 ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _des_decrypt3 - -_des_decrypt3 PROC NEAR - push ebx - mov ebx, DWORD PTR 8[esp] - push ebp - push esi - push edi - ; - ; Load the data words - mov edi, DWORD PTR [ebx] - mov esi, DWORD PTR 4[ebx] - sub esp, 12 - ; - ; IP - rol edi, 4 - mov edx, edi - xor edi, esi - and edi, 0f0f0f0f0h - xor edx, edi - xor esi, edi - ; - rol esi, 20 - mov edi, esi - xor esi, edx - and esi, 0fff0000fh - xor edi, esi - xor edx, esi - ; - rol edi, 14 - mov esi, edi - xor edi, edx - and edi, 033333333h - xor esi, edi - xor edx, edi - ; - rol edx, 22 - mov edi, edx - xor edx, esi - and edx, 003fc03fch - xor edi, edx - xor esi, edx - ; - rol edi, 9 - mov edx, edi - xor edi, esi - and edi, 0aaaaaaaah - xor edx, edi - xor esi, edi - ; - ror edx, 3 - ror esi, 2 - mov DWORD PTR 4[ebx],esi - mov esi, DWORD PTR 36[esp] - mov DWORD PTR [ebx],edx - mov edi, DWORD PTR 40[esp] - mov eax, DWORD PTR 44[esp] - mov DWORD PTR 8[esp],0 - mov DWORD PTR 4[esp],eax - mov DWORD PTR [esp],ebx - call _des_encrypt2 - mov DWORD PTR 8[esp],1 - mov DWORD PTR 4[esp],edi - mov DWORD PTR [esp],ebx - call _des_encrypt2 - mov DWORD PTR 8[esp],0 - mov DWORD PTR 4[esp],esi - mov DWORD PTR [esp],ebx - call _des_encrypt2 - add esp, 12 - mov edi, DWORD PTR [ebx] - mov esi, DWORD PTR 4[ebx] - ; - ; FP - rol esi, 2 - rol edi, 3 - mov eax, edi - xor edi, esi - and edi, 0aaaaaaaah - xor eax, edi - xor esi, edi - ; - rol eax, 23 - mov edi, eax - xor eax, esi - and eax, 003fc03fch - xor edi, eax - xor esi, eax - ; - rol edi, 10 - mov eax, edi - xor edi, esi - and edi, 033333333h - xor eax, edi - xor esi, edi - ; - rol esi, 18 - mov edi, esi - xor esi, eax - and esi, 0fff0000fh - xor edi, esi - xor eax, esi - ; - rol edi, 12 - mov esi, edi - xor edi, eax - and edi, 0f0f0f0f0h - xor esi, edi - xor eax, edi - ; - ror eax, 4 - mov DWORD PTR [ebx],eax - mov DWORD PTR 4[ebx],esi - pop edi - pop esi - pop ebp - pop ebx - ret -_des_decrypt3 ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _des_ncbc_encrypt - -_des_ncbc_encrypt PROC NEAR - ; - push ebp - push ebx - push esi - push edi - mov ebp, DWORD PTR 28[esp] - ; getting iv ptr from parameter 4 - mov ebx, DWORD PTR 36[esp] - mov esi, DWORD PTR [ebx] - mov edi, DWORD PTR 4[ebx] - push edi - push esi - push edi - push esi - mov ebx, esp - mov esi, DWORD PTR 36[esp] - mov edi, DWORD PTR 40[esp] - ; getting encrypt flag from parameter 5 - mov ecx, DWORD PTR 56[esp] - ; get and push parameter 5 - push ecx - ; get and push parameter 3 - mov eax, DWORD PTR 52[esp] - push eax - push ebx - cmp ecx, 0 - jz $L004decrypt - and ebp, 4294967288 - mov eax, DWORD PTR 12[esp] - mov ebx, DWORD PTR 16[esp] - jz $L005encrypt_finish -L006encrypt_loop: - mov ecx, DWORD PTR [esi] - mov edx, DWORD PTR 4[esi] - xor eax, ecx - xor ebx, edx - mov DWORD PTR 12[esp],eax - mov DWORD PTR 16[esp],ebx - call _des_encrypt - mov eax, DWORD PTR 12[esp] - mov ebx, DWORD PTR 16[esp] - mov DWORD PTR [edi],eax - mov DWORD PTR 4[edi],ebx - add esi, 8 - add edi, 8 - sub ebp, 8 - jnz L006encrypt_loop -$L005encrypt_finish: - mov ebp, DWORD PTR 56[esp] - and ebp, 7 - jz $L007finish - xor ecx, ecx - xor edx, edx - mov ebp, DWORD PTR $L008cbc_enc_jmp_table[ebp*4] - jmp ebp -L009ej7: - mov dh, BYTE PTR 6[esi] - shl edx, 8 -L010ej6: - mov dh, BYTE PTR 5[esi] -L011ej5: - mov dl, BYTE PTR 4[esi] -L012ej4: - mov ecx, DWORD PTR [esi] - jmp $L013ejend -L014ej3: - mov ch, BYTE PTR 2[esi] - shl ecx, 8 -L015ej2: - mov ch, BYTE PTR 1[esi] -L016ej1: - mov cl, BYTE PTR [esi] -$L013ejend: - xor eax, ecx - xor ebx, edx - mov DWORD PTR 12[esp],eax - mov DWORD PTR 16[esp],ebx - call _des_encrypt - mov eax, DWORD PTR 12[esp] - mov ebx, DWORD PTR 16[esp] - mov DWORD PTR [edi],eax - mov DWORD PTR 4[edi],ebx - jmp $L007finish -$L004decrypt: - and ebp, 4294967288 - mov eax, DWORD PTR 20[esp] - mov ebx, DWORD PTR 24[esp] - jz $L017decrypt_finish -L018decrypt_loop: - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] - mov DWORD PTR 12[esp],eax - mov DWORD PTR 16[esp],ebx - call _des_encrypt - mov eax, DWORD PTR 12[esp] - mov ebx, DWORD PTR 16[esp] - mov ecx, DWORD PTR 20[esp] - mov edx, DWORD PTR 24[esp] - xor ecx, eax - xor edx, ebx - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] - mov DWORD PTR [edi],ecx - mov DWORD PTR 4[edi],edx - mov DWORD PTR 20[esp],eax - mov DWORD PTR 24[esp],ebx - add esi, 8 - add edi, 8 - sub ebp, 8 - jnz L018decrypt_loop -$L017decrypt_finish: - mov ebp, DWORD PTR 56[esp] - and ebp, 7 - jz $L007finish - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] - mov DWORD PTR 12[esp],eax - mov DWORD PTR 16[esp],ebx - call _des_encrypt - mov eax, DWORD PTR 12[esp] - mov ebx, DWORD PTR 16[esp] - mov ecx, DWORD PTR 20[esp] - mov edx, DWORD PTR 24[esp] - xor ecx, eax - xor edx, ebx - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] -L019dj7: - ror edx, 16 - mov BYTE PTR 6[edi],dl - shr edx, 16 -L020dj6: - mov BYTE PTR 5[edi],dh -L021dj5: - mov BYTE PTR 4[edi],dl -L022dj4: - mov DWORD PTR [edi],ecx - jmp $L023djend -L024dj3: - ror ecx, 16 - mov BYTE PTR 2[edi],cl - shl ecx, 16 -L025dj2: - mov BYTE PTR 1[esi],ch -L026dj1: - mov BYTE PTR [esi], cl -$L023djend: - jmp $L007finish -$L007finish: - mov ecx, DWORD PTR 64[esp] - add esp, 28 - mov DWORD PTR [ecx],eax - mov DWORD PTR 4[ecx],ebx - pop edi - pop esi - pop ebx - pop ebp - ret -$L008cbc_enc_jmp_table: - DD 0 - DD L016ej1 - DD L015ej2 - DD L014ej3 - DD L012ej4 - DD L011ej5 - DD L010ej6 - DD L009ej7 -L027cbc_dec_jmp_table: - DD 0 - DD L026dj1 - DD L025dj2 - DD L024dj3 - DD L022dj4 - DD L021dj5 - DD L020dj6 - DD L019dj7 -_des_ncbc_encrypt ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _des_ede3_cbc_encrypt - -_des_ede3_cbc_encrypt PROC NEAR - ; - push ebp - push ebx - push esi - push edi - mov ebp, DWORD PTR 28[esp] - ; getting iv ptr from parameter 6 - mov ebx, DWORD PTR 44[esp] - mov esi, DWORD PTR [ebx] - mov edi, DWORD PTR 4[ebx] - push edi - push esi - push edi - push esi - mov ebx, esp - mov esi, DWORD PTR 36[esp] - mov edi, DWORD PTR 40[esp] - ; getting encrypt flag from parameter 7 - mov ecx, DWORD PTR 64[esp] - ; get and push parameter 5 - mov eax, DWORD PTR 56[esp] - push eax - ; get and push parameter 4 - mov eax, DWORD PTR 56[esp] - push eax - ; get and push parameter 3 - mov eax, DWORD PTR 56[esp] - push eax - push ebx - cmp ecx, 0 - jz $L028decrypt - and ebp, 4294967288 - mov eax, DWORD PTR 16[esp] - mov ebx, DWORD PTR 20[esp] - jz $L029encrypt_finish -L030encrypt_loop: - mov ecx, DWORD PTR [esi] - mov edx, DWORD PTR 4[esi] - xor eax, ecx - xor ebx, edx - mov DWORD PTR 16[esp],eax - mov DWORD PTR 20[esp],ebx - call _des_encrypt3 - mov eax, DWORD PTR 16[esp] - mov ebx, DWORD PTR 20[esp] - mov DWORD PTR [edi],eax - mov DWORD PTR 4[edi],ebx - add esi, 8 - add edi, 8 - sub ebp, 8 - jnz L030encrypt_loop -$L029encrypt_finish: - mov ebp, DWORD PTR 60[esp] - and ebp, 7 - jz $L031finish - xor ecx, ecx - xor edx, edx - mov ebp, DWORD PTR $L032cbc_enc_jmp_table[ebp*4] - jmp ebp -L033ej7: - mov dh, BYTE PTR 6[esi] - shl edx, 8 -L034ej6: - mov dh, BYTE PTR 5[esi] -L035ej5: - mov dl, BYTE PTR 4[esi] -L036ej4: - mov ecx, DWORD PTR [esi] - jmp $L037ejend -L038ej3: - mov ch, BYTE PTR 2[esi] - shl ecx, 8 -L039ej2: - mov ch, BYTE PTR 1[esi] -L040ej1: - mov cl, BYTE PTR [esi] -$L037ejend: - xor eax, ecx - xor ebx, edx - mov DWORD PTR 16[esp],eax - mov DWORD PTR 20[esp],ebx - call _des_encrypt3 - mov eax, DWORD PTR 16[esp] - mov ebx, DWORD PTR 20[esp] - mov DWORD PTR [edi],eax - mov DWORD PTR 4[edi],ebx - jmp $L031finish -$L028decrypt: - and ebp, 4294967288 - mov eax, DWORD PTR 24[esp] - mov ebx, DWORD PTR 28[esp] - jz $L041decrypt_finish -L042decrypt_loop: - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] - mov DWORD PTR 16[esp],eax - mov DWORD PTR 20[esp],ebx - call _des_decrypt3 - mov eax, DWORD PTR 16[esp] - mov ebx, DWORD PTR 20[esp] - mov ecx, DWORD PTR 24[esp] - mov edx, DWORD PTR 28[esp] - xor ecx, eax - xor edx, ebx - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] - mov DWORD PTR [edi],ecx - mov DWORD PTR 4[edi],edx - mov DWORD PTR 24[esp],eax - mov DWORD PTR 28[esp],ebx - add esi, 8 - add edi, 8 - sub ebp, 8 - jnz L042decrypt_loop -$L041decrypt_finish: - mov ebp, DWORD PTR 60[esp] - and ebp, 7 - jz $L031finish - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] - mov DWORD PTR 16[esp],eax - mov DWORD PTR 20[esp],ebx - call _des_decrypt3 - mov eax, DWORD PTR 16[esp] - mov ebx, DWORD PTR 20[esp] - mov ecx, DWORD PTR 24[esp] - mov edx, DWORD PTR 28[esp] - xor ecx, eax - xor edx, ebx - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] -L043dj7: - ror edx, 16 - mov BYTE PTR 6[edi],dl - shr edx, 16 -L044dj6: - mov BYTE PTR 5[edi],dh -L045dj5: - mov BYTE PTR 4[edi],dl -L046dj4: - mov DWORD PTR [edi],ecx - jmp $L047djend -L048dj3: - ror ecx, 16 - mov BYTE PTR 2[edi],cl - shl ecx, 16 -L049dj2: - mov BYTE PTR 1[esi],ch -L050dj1: - mov BYTE PTR [esi], cl -$L047djend: - jmp $L031finish -$L031finish: - mov ecx, DWORD PTR 76[esp] - add esp, 32 - mov DWORD PTR [ecx],eax - mov DWORD PTR 4[ecx],ebx - pop edi - pop esi - pop ebx - pop ebp - ret -$L032cbc_enc_jmp_table: - DD 0 - DD L040ej1 - DD L039ej2 - DD L038ej3 - DD L036ej4 - DD L035ej5 - DD L034ej6 - DD L033ej7 -L051cbc_dec_jmp_table: - DD 0 - DD L050dj1 - DD L049dj2 - DD L048dj3 - DD L046dj4 - DD L045dj5 - DD L044dj6 - DD L043dj7 -_des_ede3_cbc_encrypt ENDP -_TEXT ENDS -END diff --git a/src/lib/libcrypto/des/asm/y-win32.asm b/src/lib/libcrypto/des/asm/y-win32.asm index af5c102422..e69de29bb2 100644 --- a/src/lib/libcrypto/des/asm/y-win32.asm +++ b/src/lib/libcrypto/des/asm/y-win32.asm @@ -1,929 +0,0 @@ - ; Don't even think of reading this code - ; It was automatically generated by crypt586.pl - ; Which is a perl program used to generate the x86 assember for - ; any of elf, a.out, BSDI,Win32, or Solaris - ; eric - ; - TITLE crypt586.asm - .386 -.model FLAT -_TEXT SEGMENT -PUBLIC _fcrypt_body -EXTRN _des_SPtrans:DWORD -_fcrypt_body PROC NEAR - push ebp - push ebx - push esi - push edi - ; - ; Load the 2 words - xor edi, edi - xor esi, esi - mov ebp, DWORD PTR 24[esp] - push 25 -L000start: - ; - ; Round 0 - mov eax, DWORD PTR 32[esp] - mov edx, esi - shr edx, 16 - mov ecx, DWORD PTR 36[esp] - xor edx, esi - and eax, edx - and edx, ecx - mov ebx, eax - shl ebx, 16 - mov ecx, edx - shl ecx, 16 - xor eax, ebx - xor edx, ecx - mov ebx, DWORD PTR [ebp] - xor eax, ebx - mov ecx, DWORD PTR 4[ebp] - xor eax, esi - xor edx, esi - xor edx, ecx - and eax, 0fcfcfcfch - xor ebx, ebx - and edx, 0cfcfcfcfh - xor ecx, ecx - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 28[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 1 - mov eax, DWORD PTR 32[esp] - mov edx, edi - shr edx, 16 - mov ecx, DWORD PTR 36[esp] - xor edx, edi - and eax, edx - and edx, ecx - mov ebx, eax - shl ebx, 16 - mov ecx, edx - shl ecx, 16 - xor eax, ebx - xor edx, ecx - mov ebx, DWORD PTR 8[ebp] - xor eax, ebx - mov ecx, DWORD PTR 12[ebp] - xor eax, edi - xor edx, edi - xor edx, ecx - and eax, 0fcfcfcfch - xor ebx, ebx - and edx, 0cfcfcfcfh - xor ecx, ecx - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 28[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 2 - mov eax, DWORD PTR 32[esp] - mov edx, esi - shr edx, 16 - mov ecx, DWORD PTR 36[esp] - xor edx, esi - and eax, edx - and edx, ecx - mov ebx, eax - shl ebx, 16 - mov ecx, edx - shl ecx, 16 - xor eax, ebx - xor edx, ecx - mov ebx, DWORD PTR 16[ebp] - xor eax, ebx - mov ecx, DWORD PTR 20[ebp] - xor eax, esi - xor edx, esi - xor edx, ecx - and eax, 0fcfcfcfch - xor ebx, ebx - and edx, 0cfcfcfcfh - xor ecx, ecx - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 28[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 3 - mov eax, DWORD PTR 32[esp] - mov edx, edi - shr edx, 16 - mov ecx, DWORD PTR 36[esp] - xor edx, edi - and eax, edx - and edx, ecx - mov ebx, eax - shl ebx, 16 - mov ecx, edx - shl ecx, 16 - xor eax, ebx - xor edx, ecx - mov ebx, DWORD PTR 24[ebp] - xor eax, ebx - mov ecx, DWORD PTR 28[ebp] - xor eax, edi - xor edx, edi - xor edx, ecx - and eax, 0fcfcfcfch - xor ebx, ebx - and edx, 0cfcfcfcfh - xor ecx, ecx - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 28[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 4 - mov eax, DWORD PTR 32[esp] - mov edx, esi - shr edx, 16 - mov ecx, DWORD PTR 36[esp] - xor edx, esi - and eax, edx - and edx, ecx - mov ebx, eax - shl ebx, 16 - mov ecx, edx - shl ecx, 16 - xor eax, ebx - xor edx, ecx - mov ebx, DWORD PTR 32[ebp] - xor eax, ebx - mov ecx, DWORD PTR 36[ebp] - xor eax, esi - xor edx, esi - xor edx, ecx - and eax, 0fcfcfcfch - xor ebx, ebx - and edx, 0cfcfcfcfh - xor ecx, ecx - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 28[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 5 - mov eax, DWORD PTR 32[esp] - mov edx, edi - shr edx, 16 - mov ecx, DWORD PTR 36[esp] - xor edx, edi - and eax, edx - and edx, ecx - mov ebx, eax - shl ebx, 16 - mov ecx, edx - shl ecx, 16 - xor eax, ebx - xor edx, ecx - mov ebx, DWORD PTR 40[ebp] - xor eax, ebx - mov ecx, DWORD PTR 44[ebp] - xor eax, edi - xor edx, edi - xor edx, ecx - and eax, 0fcfcfcfch - xor ebx, ebx - and edx, 0cfcfcfcfh - xor ecx, ecx - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 28[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 6 - mov eax, DWORD PTR 32[esp] - mov edx, esi - shr edx, 16 - mov ecx, DWORD PTR 36[esp] - xor edx, esi - and eax, edx - and edx, ecx - mov ebx, eax - shl ebx, 16 - mov ecx, edx - shl ecx, 16 - xor eax, ebx - xor edx, ecx - mov ebx, DWORD PTR 48[ebp] - xor eax, ebx - mov ecx, DWORD PTR 52[ebp] - xor eax, esi - xor edx, esi - xor edx, ecx - and eax, 0fcfcfcfch - xor ebx, ebx - and edx, 0cfcfcfcfh - xor ecx, ecx - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 28[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 7 - mov eax, DWORD PTR 32[esp] - mov edx, edi - shr edx, 16 - mov ecx, DWORD PTR 36[esp] - xor edx, edi - and eax, edx - and edx, ecx - mov ebx, eax - shl ebx, 16 - mov ecx, edx - shl ecx, 16 - xor eax, ebx - xor edx, ecx - mov ebx, DWORD PTR 56[ebp] - xor eax, ebx - mov ecx, DWORD PTR 60[ebp] - xor eax, edi - xor edx, edi - xor edx, ecx - and eax, 0fcfcfcfch - xor ebx, ebx - and edx, 0cfcfcfcfh - xor ecx, ecx - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 28[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 8 - mov eax, DWORD PTR 32[esp] - mov edx, esi - shr edx, 16 - mov ecx, DWORD PTR 36[esp] - xor edx, esi - and eax, edx - and edx, ecx - mov ebx, eax - shl ebx, 16 - mov ecx, edx - shl ecx, 16 - xor eax, ebx - xor edx, ecx - mov ebx, DWORD PTR 64[ebp] - xor eax, ebx - mov ecx, DWORD PTR 68[ebp] - xor eax, esi - xor edx, esi - xor edx, ecx - and eax, 0fcfcfcfch - xor ebx, ebx - and edx, 0cfcfcfcfh - xor ecx, ecx - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 28[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 9 - mov eax, DWORD PTR 32[esp] - mov edx, edi - shr edx, 16 - mov ecx, DWORD PTR 36[esp] - xor edx, edi - and eax, edx - and edx, ecx - mov ebx, eax - shl ebx, 16 - mov ecx, edx - shl ecx, 16 - xor eax, ebx - xor edx, ecx - mov ebx, DWORD PTR 72[ebp] - xor eax, ebx - mov ecx, DWORD PTR 76[ebp] - xor eax, edi - xor edx, edi - xor edx, ecx - and eax, 0fcfcfcfch - xor ebx, ebx - and edx, 0cfcfcfcfh - xor ecx, ecx - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 28[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 10 - mov eax, DWORD PTR 32[esp] - mov edx, esi - shr edx, 16 - mov ecx, DWORD PTR 36[esp] - xor edx, esi - and eax, edx - and edx, ecx - mov ebx, eax - shl ebx, 16 - mov ecx, edx - shl ecx, 16 - xor eax, ebx - xor edx, ecx - mov ebx, DWORD PTR 80[ebp] - xor eax, ebx - mov ecx, DWORD PTR 84[ebp] - xor eax, esi - xor edx, esi - xor edx, ecx - and eax, 0fcfcfcfch - xor ebx, ebx - and edx, 0cfcfcfcfh - xor ecx, ecx - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 28[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 11 - mov eax, DWORD PTR 32[esp] - mov edx, edi - shr edx, 16 - mov ecx, DWORD PTR 36[esp] - xor edx, edi - and eax, edx - and edx, ecx - mov ebx, eax - shl ebx, 16 - mov ecx, edx - shl ecx, 16 - xor eax, ebx - xor edx, ecx - mov ebx, DWORD PTR 88[ebp] - xor eax, ebx - mov ecx, DWORD PTR 92[ebp] - xor eax, edi - xor edx, edi - xor edx, ecx - and eax, 0fcfcfcfch - xor ebx, ebx - and edx, 0cfcfcfcfh - xor ecx, ecx - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 28[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 12 - mov eax, DWORD PTR 32[esp] - mov edx, esi - shr edx, 16 - mov ecx, DWORD PTR 36[esp] - xor edx, esi - and eax, edx - and edx, ecx - mov ebx, eax - shl ebx, 16 - mov ecx, edx - shl ecx, 16 - xor eax, ebx - xor edx, ecx - mov ebx, DWORD PTR 96[ebp] - xor eax, ebx - mov ecx, DWORD PTR 100[ebp] - xor eax, esi - xor edx, esi - xor edx, ecx - and eax, 0fcfcfcfch - xor ebx, ebx - and edx, 0cfcfcfcfh - xor ecx, ecx - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 28[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 13 - mov eax, DWORD PTR 32[esp] - mov edx, edi - shr edx, 16 - mov ecx, DWORD PTR 36[esp] - xor edx, edi - and eax, edx - and edx, ecx - mov ebx, eax - shl ebx, 16 - mov ecx, edx - shl ecx, 16 - xor eax, ebx - xor edx, ecx - mov ebx, DWORD PTR 104[ebp] - xor eax, ebx - mov ecx, DWORD PTR 108[ebp] - xor eax, edi - xor edx, edi - xor edx, ecx - and eax, 0fcfcfcfch - xor ebx, ebx - and edx, 0cfcfcfcfh - xor ecx, ecx - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 28[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - ; - ; Round 14 - mov eax, DWORD PTR 32[esp] - mov edx, esi - shr edx, 16 - mov ecx, DWORD PTR 36[esp] - xor edx, esi - and eax, edx - and edx, ecx - mov ebx, eax - shl ebx, 16 - mov ecx, edx - shl ecx, 16 - xor eax, ebx - xor edx, ecx - mov ebx, DWORD PTR 112[ebp] - xor eax, ebx - mov ecx, DWORD PTR 116[ebp] - xor eax, esi - xor edx, esi - xor edx, ecx - and eax, 0fcfcfcfch - xor ebx, ebx - and edx, 0cfcfcfcfh - xor ecx, ecx - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor edi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor edi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor edi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor edi, ebp - mov ebp, DWORD PTR 28[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor edi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor edi, ebx - ; - ; Round 15 - mov eax, DWORD PTR 32[esp] - mov edx, edi - shr edx, 16 - mov ecx, DWORD PTR 36[esp] - xor edx, edi - and eax, edx - and edx, ecx - mov ebx, eax - shl ebx, 16 - mov ecx, edx - shl ecx, 16 - xor eax, ebx - xor edx, ecx - mov ebx, DWORD PTR 120[ebp] - xor eax, ebx - mov ecx, DWORD PTR 124[ebp] - xor eax, edi - xor edx, edi - xor edx, ecx - and eax, 0fcfcfcfch - xor ebx, ebx - and edx, 0cfcfcfcfh - xor ecx, ecx - mov bl, al - mov cl, ah - ror edx, 4 - mov ebp, DWORD PTR _des_SPtrans[ebx] - mov bl, dl - xor esi, ebp - mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] - xor esi, ebp - mov cl, dh - shr eax, 16 - mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] - xor esi, ebp - mov bl, ah - shr edx, 16 - mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] - xor esi, ebp - mov ebp, DWORD PTR 28[esp] - mov cl, dh - and eax, 0ffh - and edx, 0ffh - mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0400h+eax] - xor esi, ebx - mov ebx, DWORD PTR _des_SPtrans[0500h+edx] - xor esi, ebx - mov ebx, DWORD PTR [esp] - mov eax, edi - dec ebx - mov edi, esi - mov esi, eax - mov DWORD PTR [esp],ebx - jnz L000start - ; - ; FP - mov edx, DWORD PTR 24[esp] - ror edi, 1 - mov eax, esi - xor esi, edi - and esi, 0aaaaaaaah - xor eax, esi - xor edi, esi - ; - rol eax, 23 - mov esi, eax - xor eax, edi - and eax, 003fc03fch - xor esi, eax - xor edi, eax - ; - rol esi, 10 - mov eax, esi - xor esi, edi - and esi, 033333333h - xor eax, esi - xor edi, esi - ; - rol edi, 18 - mov esi, edi - xor edi, eax - and edi, 0fff0000fh - xor esi, edi - xor eax, edi - ; - rol esi, 12 - mov edi, esi - xor esi, eax - and esi, 0f0f0f0f0h - xor edi, esi - xor eax, esi - ; - ror eax, 4 - mov DWORD PTR [edx],eax - mov DWORD PTR 4[edx],edi - pop ecx - pop edi - pop esi - pop ebx - pop ebp - ret -_fcrypt_body ENDP -_TEXT ENDS -END diff --git a/src/lib/libcrypto/des/des.c b/src/lib/libcrypto/des/des.c index 91d7153b34..0197489c9e 100644 --- a/src/lib/libcrypto/des/des.c +++ b/src/lib/libcrypto/des/des.c @@ -58,6 +58,7 @@ #include #include +#include #ifndef MSDOS #ifndef VMS #include @@ -69,7 +70,7 @@ #include #endif /* __DECC */ #endif /* VMS */ -#else +#else /* MSDOS */ #include #endif @@ -88,10 +89,6 @@ #include #include -#if defined(__STDC__) || defined(VMS) || defined(M_XENIX) || defined(MSDOS) -#include -#endif - void usage(void); void doencryption(void); int uufwrite(unsigned char *data, int size, unsigned int num, FILE *fp); diff --git a/src/lib/libcrypto/des/des.h b/src/lib/libcrypto/des/des.h index 98a9c4127c..ead67986d9 100644 --- a/src/lib/libcrypto/des/des.h +++ b/src/lib/libcrypto/des/des.h @@ -78,10 +78,7 @@ extern "C" { typedef unsigned char des_cblock[8]; typedef /* const */ unsigned char const_des_cblock[8]; /* With "const", gcc 2.8.1 on Solaris thinks that des_cblock * - * and const_des_cblock * are incompatible pointer types. - * I haven't seen that warning on other systems ... I'll look - * what the standard says. */ - + * and const_des_cblock * are incompatible pointer types. */ typedef struct des_ks_struct { @@ -141,8 +138,26 @@ void des_cfb_encrypt(const unsigned char *in,unsigned char *out,int numbits, int enc); void des_ecb_encrypt(const_des_cblock *input,des_cblock *output, des_key_schedule ks,int enc); + +/* This is the DES encryption function that gets called by just about + every other DES routine in the library. You should not use this + function except to implement 'modes' of DES. I say this because the + functions that call this routine do the conversion from 'char *' to + long, and this needs to be done to make sure 'non-aligned' memory + access do not occur. The characters are loaded 'little endian'. + Data is a pointer to 2 unsigned long's and ks is the + des_key_schedule to use. enc, is non zero specifies encryption, + zero if decryption. */ void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc); + +/* This functions is the same as des_encrypt() except that the DES + initial permutation (IP) and final permutation (FP) have been left + out. As for des_encrypt(), you should not use this function. + It is used by the routines in the library that implement triple DES. + IP() des_encrypt2() des_encrypt2() des_encrypt2() FP() is the same + as des_encrypt() des_encrypt() des_encrypt() except faster :-). */ void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc); + void des_encrypt3(DES_LONG *data, des_key_schedule ks1, des_key_schedule ks2, des_key_schedule ks3); void des_decrypt3(DES_LONG *data, des_key_schedule ks1, @@ -192,6 +207,7 @@ int des_read_2passwords(des_cblock *key1,des_cblock *key2, const char *prompt,int verify); int des_read_pw_string(char *buf,int length,const char *prompt,int verify); void des_set_odd_parity(des_cblock *key); +int des_check_key_parity(const_des_cblock *key); int des_is_weak_key(const_des_cblock *key); /* des_set_key (= set_key = des_key_sched = key_sched) calls * des_set_key_checked if global variable des_check_key is set, @@ -209,9 +225,6 @@ void des_ofb64_encrypt(const unsigned char *in,unsigned char *out,long length, des_key_schedule schedule,des_cblock *ivec,int *num); int des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify); -/* Extra functions from Mark Murray */ -void des_cblock_print_file(const_des_cblock *cb, FILE *fp); - /* The following definitions provide compatibility with the MIT Kerberos * library. The des_key_schedule structure is not binary compatible. */ @@ -241,11 +254,11 @@ void des_cblock_print_file(const_des_cblock *cb, FILE *fp); # define xcbc_encrypt des_xcbc_encrypt # define cbc_cksum des_cbc_cksum # define quad_cksum des_quad_cksum +# define check_parity des_check_key_parity #endif typedef des_key_schedule bit_64; #define des_fixup_key_parity des_set_odd_parity -#define des_check_key_parity check_parity #ifdef __cplusplus } diff --git a/src/lib/libcrypto/des/des.man b/src/lib/libcrypto/des/des.man index 7e06a1851a..e69de29bb2 100644 --- a/src/lib/libcrypto/des/des.man +++ b/src/lib/libcrypto/des/des.man @@ -1,186 +0,0 @@ -.TH DES 1 -.SH NAME -des - encrypt or decrypt data using Data Encryption Standard -.SH SYNOPSIS -.B des -( -.B \-e -| -.B \-E -) | ( -.B \-d -| -.B \-D -) | ( -.B \-\fR[\fPcC\fR][\fPckname\fR]\fP -) | -[ -.B \-b3hfs -] [ -.B \-k -.I key -] -] [ -.B \-u\fR[\fIuuname\fR] -[ -.I input-file -[ -.I output-file -] ] -.SH DESCRIPTION -.B des -encrypts and decrypts data using the -Data Encryption Standard algorithm. -One of -.B \-e, \-E -(for encrypt) or -.B \-d, \-D -(for decrypt) must be specified. -It is also possible to use -.B \-c -or -.B \-C -in conjunction or instead of the a encrypt/decrypt option to generate -a 16 character hexadecimal checksum, generated via the -.I des_cbc_cksum. -.LP -Two standard encryption modes are supported by the -.B des -program, Cipher Block Chaining (the default) and Electronic Code Book -(specified with -.B \-b -). -.LP -The key used for the DES -algorithm is obtained by prompting the user unless the -.B `\-k -.I key' -option is given. -If the key is an argument to the -.B des -command, it is potentially visible to users executing -.BR ps (1) -or a derivative. To minimise this possibility, -.B des -takes care to destroy the key argument immediately upon entry. -If your shell keeps a history file be careful to make sure it is not -world readable. -.LP -Since this program attempts to maintain compatability with sunOS's -des(1) command, there are 2 different methods used to convert the user -supplied key to a des key. -Whenever and one or more of -.B \-E, \-D, \-C -or -.B \-3 -options are used, the key conversion procedure will not be compatible -with the sunOS des(1) version but will use all the user supplied -character to generate the des key. -.B des -command reads from standard input unless -.I input-file -is specified and writes to standard output unless -.I output-file -is given. -.SH OPTIONS -.TP -.B \-b -Select ECB -(eight bytes at a time) encryption mode. -.TP -.B \-3 -Encrypt using triple encryption. -By default triple cbc encryption is used but if the -.B \-b -option is used then triple ecb encryption is performed. -If the key is less than 8 characters long, the flag has no effect. -.TP -.B \-e -Encrypt data using an 8 byte key in a manner compatible with sunOS -des(1). -.TP -.B \-E -Encrypt data using a key of nearly unlimited length (1024 bytes). -This will product a more secure encryption. -.TP -.B \-d -Decrypt data that was encrypted with the \-e option. -.TP -.B \-D -Decrypt data that was encrypted with the \-E option. -.TP -.B \-c -Generate a 16 character hexadecimal cbc checksum and output this to -stderr. -If a filename was specified after the -.B \-c -option, the checksum is output to that file. -The checksum is generated using a key generated in a sunOS compatible -manner. -.TP -.B \-C -A cbc checksum is generated in the same manner as described for the -.B \-c -option but the DES key is generated in the same manner as used for the -.B \-E -and -.B \-D -options -.TP -.B \-f -Does nothing - allowed for compatibility with sunOS des(1) command. -.TP -.B \-s -Does nothing - allowed for compatibility with sunOS des(1) command. -.TP -.B "\-k \fIkey\fP" -Use the encryption -.I key -specified. -.TP -.B "\-h" -The -.I key -is assumed to be a 16 character hexadecimal number. -If the -.B "\-3" -option is used the key is assumed to be a 32 character hexadecimal -number. -.TP -.B \-u -This flag is used to read and write uuencoded files. If decrypting, -the input file is assumed to contain uuencoded, DES encrypted data. -If encrypting, the characters following the -u are used as the name of -the uuencoded file to embed in the begin line of the uuencoded -output. If there is no name specified after the -u, the name text.des -will be embedded in the header. -.SH SEE ALSO -.B ps (1) -.B des_crypt(3) -.SH BUGS -.LP -The problem with using the -.B -e -option is the short key length. -It would be better to use a real 56-bit key rather than an -ASCII-based 56-bit pattern. Knowing that the key was derived from ASCII -radically reduces the time necessary for a brute-force cryptographic attack. -My attempt to remove this problem is to add an alternative text-key to -DES-key function. This alternative function (accessed via -.B -E, -D, -S -and -.B -3 -) -uses DES to help generate the key. -.LP -Be carefully when using the -u option. Doing des -ud will -not decrypt filename (the -u option will gobble the d option). -.LP -The VMS operating system operates in a world where files are always a -multiple of 512 bytes. This causes problems when encrypted data is -send from unix to VMS since a 88 byte file will suddenly be padded -with 424 null bytes. To get around this problem, use the -u option -to uuencode the data before it is send to the VMS system. -.SH AUTHOR -.LP -Eric Young (eay@cryptsoft.com) diff --git a/src/lib/libcrypto/des/des.pl b/src/lib/libcrypto/des/des.pl index 8a3f7e3ed6..e69de29bb2 100644 --- a/src/lib/libcrypto/des/des.pl +++ b/src/lib/libcrypto/des/des.pl @@ -1,552 +0,0 @@ -#!/usr/local/bin/perl -# des.pl - eric young 22/11/1991 eay@cryptsoft.com -# -# Copyright (C) 1993 Eric Young -# -# 11 April 1996 - patched to circumvent Perl 5 (through 5.002) problem -# with sign-extension on right shift operations. -# Ed Kubaitis - ejk@uiuc.edu -# -# eay - 92/08/31 - I think I have fixed all problems for 64bit -# versions of perl but I could be wrong since I have not tested it yet :-). -# -# This is an implementation of DES in perl. -# The two routines (des_set_key and des_ecb_encrypt) -# take 8 byte objects as arguments. -# -# des_set_key takes an 8 byte string as a key and returns a key schedule -# for use in calls to des_ecb_encrypt. -# des_ecb_encrypt takes three arguments, the first is a key schedule -# (make sure to pass it by reference with the *), the second is 1 -# to encrypt, 0 to decrypt. The third argument is an 8 byte object -# to encrypt. The function returns an 8 byte object that has been -# DES encrypted. -# -# example: -# require 'des.pl' -# -# $key =pack("C8",0x12,0x23,0x45,0x67,0x89,0xab,0xcd,0xef); -# @ks= &des_set_key($key); -# -# $outbytes= &des_ecb_encrypt(*ks,1,$data); -# @enc =unpack("C8",$outbytes); -# - -package des; - -eval("use integer;") if (int($]) > 4); - -# The following 8 arrays are used in des_set_key -@skb0=( -# for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 -0x00000000,0x00000010,0x20000000,0x20000010, -0x00010000,0x00010010,0x20010000,0x20010010, -0x00000800,0x00000810,0x20000800,0x20000810, -0x00010800,0x00010810,0x20010800,0x20010810, -0x00000020,0x00000030,0x20000020,0x20000030, -0x00010020,0x00010030,0x20010020,0x20010030, -0x00000820,0x00000830,0x20000820,0x20000830, -0x00010820,0x00010830,0x20010820,0x20010830, -0x00080000,0x00080010,0x20080000,0x20080010, -0x00090000,0x00090010,0x20090000,0x20090010, -0x00080800,0x00080810,0x20080800,0x20080810, -0x00090800,0x00090810,0x20090800,0x20090810, -0x00080020,0x00080030,0x20080020,0x20080030, -0x00090020,0x00090030,0x20090020,0x20090030, -0x00080820,0x00080830,0x20080820,0x20080830, -0x00090820,0x00090830,0x20090820,0x20090830, -); -@skb1=( -# for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 -0x00000000,0x02000000,0x00002000,0x02002000, -0x00200000,0x02200000,0x00202000,0x02202000, -0x00000004,0x02000004,0x00002004,0x02002004, -0x00200004,0x02200004,0x00202004,0x02202004, -0x00000400,0x02000400,0x00002400,0x02002400, -0x00200400,0x02200400,0x00202400,0x02202400, -0x00000404,0x02000404,0x00002404,0x02002404, -0x00200404,0x02200404,0x00202404,0x02202404, -0x10000000,0x12000000,0x10002000,0x12002000, -0x10200000,0x12200000,0x10202000,0x12202000, -0x10000004,0x12000004,0x10002004,0x12002004, -0x10200004,0x12200004,0x10202004,0x12202004, -0x10000400,0x12000400,0x10002400,0x12002400, -0x10200400,0x12200400,0x10202400,0x12202400, -0x10000404,0x12000404,0x10002404,0x12002404, -0x10200404,0x12200404,0x10202404,0x12202404, -); -@skb2=( -# for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 -0x00000000,0x00000001,0x00040000,0x00040001, -0x01000000,0x01000001,0x01040000,0x01040001, -0x00000002,0x00000003,0x00040002,0x00040003, -0x01000002,0x01000003,0x01040002,0x01040003, -0x00000200,0x00000201,0x00040200,0x00040201, -0x01000200,0x01000201,0x01040200,0x01040201, -0x00000202,0x00000203,0x00040202,0x00040203, -0x01000202,0x01000203,0x01040202,0x01040203, -0x08000000,0x08000001,0x08040000,0x08040001, -0x09000000,0x09000001,0x09040000,0x09040001, -0x08000002,0x08000003,0x08040002,0x08040003, -0x09000002,0x09000003,0x09040002,0x09040003, -0x08000200,0x08000201,0x08040200,0x08040201, -0x09000200,0x09000201,0x09040200,0x09040201, -0x08000202,0x08000203,0x08040202,0x08040203, -0x09000202,0x09000203,0x09040202,0x09040203, -); -@skb3=( -# for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 -0x00000000,0x00100000,0x00000100,0x00100100, -0x00000008,0x00100008,0x00000108,0x00100108, -0x00001000,0x00101000,0x00001100,0x00101100, -0x00001008,0x00101008,0x00001108,0x00101108, -0x04000000,0x04100000,0x04000100,0x04100100, -0x04000008,0x04100008,0x04000108,0x04100108, -0x04001000,0x04101000,0x04001100,0x04101100, -0x04001008,0x04101008,0x04001108,0x04101108, -0x00020000,0x00120000,0x00020100,0x00120100, -0x00020008,0x00120008,0x00020108,0x00120108, -0x00021000,0x00121000,0x00021100,0x00121100, -0x00021008,0x00121008,0x00021108,0x00121108, -0x04020000,0x04120000,0x04020100,0x04120100, -0x04020008,0x04120008,0x04020108,0x04120108, -0x04021000,0x04121000,0x04021100,0x04121100, -0x04021008,0x04121008,0x04021108,0x04121108, -); -@skb4=( -# for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 -0x00000000,0x10000000,0x00010000,0x10010000, -0x00000004,0x10000004,0x00010004,0x10010004, -0x20000000,0x30000000,0x20010000,0x30010000, -0x20000004,0x30000004,0x20010004,0x30010004, -0x00100000,0x10100000,0x00110000,0x10110000, -0x00100004,0x10100004,0x00110004,0x10110004, -0x20100000,0x30100000,0x20110000,0x30110000, -0x20100004,0x30100004,0x20110004,0x30110004, -0x00001000,0x10001000,0x00011000,0x10011000, -0x00001004,0x10001004,0x00011004,0x10011004, -0x20001000,0x30001000,0x20011000,0x30011000, -0x20001004,0x30001004,0x20011004,0x30011004, -0x00101000,0x10101000,0x00111000,0x10111000, -0x00101004,0x10101004,0x00111004,0x10111004, -0x20101000,0x30101000,0x20111000,0x30111000, -0x20101004,0x30101004,0x20111004,0x30111004, -); -@skb5=( -# for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 -0x00000000,0x08000000,0x00000008,0x08000008, -0x00000400,0x08000400,0x00000408,0x08000408, -0x00020000,0x08020000,0x00020008,0x08020008, -0x00020400,0x08020400,0x00020408,0x08020408, -0x00000001,0x08000001,0x00000009,0x08000009, -0x00000401,0x08000401,0x00000409,0x08000409, -0x00020001,0x08020001,0x00020009,0x08020009, -0x00020401,0x08020401,0x00020409,0x08020409, -0x02000000,0x0A000000,0x02000008,0x0A000008, -0x02000400,0x0A000400,0x02000408,0x0A000408, -0x02020000,0x0A020000,0x02020008,0x0A020008, -0x02020400,0x0A020400,0x02020408,0x0A020408, -0x02000001,0x0A000001,0x02000009,0x0A000009, -0x02000401,0x0A000401,0x02000409,0x0A000409, -0x02020001,0x0A020001,0x02020009,0x0A020009, -0x02020401,0x0A020401,0x02020409,0x0A020409, -); -@skb6=( -# for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 -0x00000000,0x00000100,0x00080000,0x00080100, -0x01000000,0x01000100,0x01080000,0x01080100, -0x00000010,0x00000110,0x00080010,0x00080110, -0x01000010,0x01000110,0x01080010,0x01080110, -0x00200000,0x00200100,0x00280000,0x00280100, -0x01200000,0x01200100,0x01280000,0x01280100, -0x00200010,0x00200110,0x00280010,0x00280110, -0x01200010,0x01200110,0x01280010,0x01280110, -0x00000200,0x00000300,0x00080200,0x00080300, -0x01000200,0x01000300,0x01080200,0x01080300, -0x00000210,0x00000310,0x00080210,0x00080310, -0x01000210,0x01000310,0x01080210,0x01080310, -0x00200200,0x00200300,0x00280200,0x00280300, -0x01200200,0x01200300,0x01280200,0x01280300, -0x00200210,0x00200310,0x00280210,0x00280310, -0x01200210,0x01200310,0x01280210,0x01280310, -); -@skb7=( -# for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 -0x00000000,0x04000000,0x00040000,0x04040000, -0x00000002,0x04000002,0x00040002,0x04040002, -0x00002000,0x04002000,0x00042000,0x04042000, -0x00002002,0x04002002,0x00042002,0x04042002, -0x00000020,0x04000020,0x00040020,0x04040020, -0x00000022,0x04000022,0x00040022,0x04040022, -0x00002020,0x04002020,0x00042020,0x04042020, -0x00002022,0x04002022,0x00042022,0x04042022, -0x00000800,0x04000800,0x00040800,0x04040800, -0x00000802,0x04000802,0x00040802,0x04040802, -0x00002800,0x04002800,0x00042800,0x04042800, -0x00002802,0x04002802,0x00042802,0x04042802, -0x00000820,0x04000820,0x00040820,0x04040820, -0x00000822,0x04000822,0x00040822,0x04040822, -0x00002820,0x04002820,0x00042820,0x04042820, -0x00002822,0x04002822,0x00042822,0x04042822, -); - -@shifts2=(0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0); - -# used in ecb_encrypt -@SP0=( -0x00410100, 0x00010000, 0x40400000, 0x40410100, -0x00400000, 0x40010100, 0x40010000, 0x40400000, -0x40010100, 0x00410100, 0x00410000, 0x40000100, -0x40400100, 0x00400000, 0x00000000, 0x40010000, -0x00010000, 0x40000000, 0x00400100, 0x00010100, -0x40410100, 0x00410000, 0x40000100, 0x00400100, -0x40000000, 0x00000100, 0x00010100, 0x40410000, -0x00000100, 0x40400100, 0x40410000, 0x00000000, -0x00000000, 0x40410100, 0x00400100, 0x40010000, -0x00410100, 0x00010000, 0x40000100, 0x00400100, -0x40410000, 0x00000100, 0x00010100, 0x40400000, -0x40010100, 0x40000000, 0x40400000, 0x00410000, -0x40410100, 0x00010100, 0x00410000, 0x40400100, -0x00400000, 0x40000100, 0x40010000, 0x00000000, -0x00010000, 0x00400000, 0x40400100, 0x00410100, -0x40000000, 0x40410000, 0x00000100, 0x40010100, -); -@SP1=( -0x08021002, 0x00000000, 0x00021000, 0x08020000, -0x08000002, 0x00001002, 0x08001000, 0x00021000, -0x00001000, 0x08020002, 0x00000002, 0x08001000, -0x00020002, 0x08021000, 0x08020000, 0x00000002, -0x00020000, 0x08001002, 0x08020002, 0x00001000, -0x00021002, 0x08000000, 0x00000000, 0x00020002, -0x08001002, 0x00021002, 0x08021000, 0x08000002, -0x08000000, 0x00020000, 0x00001002, 0x08021002, -0x00020002, 0x08021000, 0x08001000, 0x00021002, -0x08021002, 0x00020002, 0x08000002, 0x00000000, -0x08000000, 0x00001002, 0x00020000, 0x08020002, -0x00001000, 0x08000000, 0x00021002, 0x08001002, -0x08021000, 0x00001000, 0x00000000, 0x08000002, -0x00000002, 0x08021002, 0x00021000, 0x08020000, -0x08020002, 0x00020000, 0x00001002, 0x08001000, -0x08001002, 0x00000002, 0x08020000, 0x00021000, -); -@SP2=( -0x20800000, 0x00808020, 0x00000020, 0x20800020, -0x20008000, 0x00800000, 0x20800020, 0x00008020, -0x00800020, 0x00008000, 0x00808000, 0x20000000, -0x20808020, 0x20000020, 0x20000000, 0x20808000, -0x00000000, 0x20008000, 0x00808020, 0x00000020, -0x20000020, 0x20808020, 0x00008000, 0x20800000, -0x20808000, 0x00800020, 0x20008020, 0x00808000, -0x00008020, 0x00000000, 0x00800000, 0x20008020, -0x00808020, 0x00000020, 0x20000000, 0x00008000, -0x20000020, 0x20008000, 0x00808000, 0x20800020, -0x00000000, 0x00808020, 0x00008020, 0x20808000, -0x20008000, 0x00800000, 0x20808020, 0x20000000, -0x20008020, 0x20800000, 0x00800000, 0x20808020, -0x00008000, 0x00800020, 0x20800020, 0x00008020, -0x00800020, 0x00000000, 0x20808000, 0x20000020, -0x20800000, 0x20008020, 0x00000020, 0x00808000, -); -@SP3=( -0x00080201, 0x02000200, 0x00000001, 0x02080201, -0x00000000, 0x02080000, 0x02000201, 0x00080001, -0x02080200, 0x02000001, 0x02000000, 0x00000201, -0x02000001, 0x00080201, 0x00080000, 0x02000000, -0x02080001, 0x00080200, 0x00000200, 0x00000001, -0x00080200, 0x02000201, 0x02080000, 0x00000200, -0x00000201, 0x00000000, 0x00080001, 0x02080200, -0x02000200, 0x02080001, 0x02080201, 0x00080000, -0x02080001, 0x00000201, 0x00080000, 0x02000001, -0x00080200, 0x02000200, 0x00000001, 0x02080000, -0x02000201, 0x00000000, 0x00000200, 0x00080001, -0x00000000, 0x02080001, 0x02080200, 0x00000200, -0x02000000, 0x02080201, 0x00080201, 0x00080000, -0x02080201, 0x00000001, 0x02000200, 0x00080201, -0x00080001, 0x00080200, 0x02080000, 0x02000201, -0x00000201, 0x02000000, 0x02000001, 0x02080200, -); -@SP4=( -0x01000000, 0x00002000, 0x00000080, 0x01002084, -0x01002004, 0x01000080, 0x00002084, 0x01002000, -0x00002000, 0x00000004, 0x01000004, 0x00002080, -0x01000084, 0x01002004, 0x01002080, 0x00000000, -0x00002080, 0x01000000, 0x00002004, 0x00000084, -0x01000080, 0x00002084, 0x00000000, 0x01000004, -0x00000004, 0x01000084, 0x01002084, 0x00002004, -0x01002000, 0x00000080, 0x00000084, 0x01002080, -0x01002080, 0x01000084, 0x00002004, 0x01002000, -0x00002000, 0x00000004, 0x01000004, 0x01000080, -0x01000000, 0x00002080, 0x01002084, 0x00000000, -0x00002084, 0x01000000, 0x00000080, 0x00002004, -0x01000084, 0x00000080, 0x00000000, 0x01002084, -0x01002004, 0x01002080, 0x00000084, 0x00002000, -0x00002080, 0x01002004, 0x01000080, 0x00000084, -0x00000004, 0x00002084, 0x01002000, 0x01000004, -); -@SP5=( -0x10000008, 0x00040008, 0x00000000, 0x10040400, -0x00040008, 0x00000400, 0x10000408, 0x00040000, -0x00000408, 0x10040408, 0x00040400, 0x10000000, -0x10000400, 0x10000008, 0x10040000, 0x00040408, -0x00040000, 0x10000408, 0x10040008, 0x00000000, -0x00000400, 0x00000008, 0x10040400, 0x10040008, -0x10040408, 0x10040000, 0x10000000, 0x00000408, -0x00000008, 0x00040400, 0x00040408, 0x10000400, -0x00000408, 0x10000000, 0x10000400, 0x00040408, -0x10040400, 0x00040008, 0x00000000, 0x10000400, -0x10000000, 0x00000400, 0x10040008, 0x00040000, -0x00040008, 0x10040408, 0x00040400, 0x00000008, -0x10040408, 0x00040400, 0x00040000, 0x10000408, -0x10000008, 0x10040000, 0x00040408, 0x00000000, -0x00000400, 0x10000008, 0x10000408, 0x10040400, -0x10040000, 0x00000408, 0x00000008, 0x10040008, -); -@SP6=( -0x00000800, 0x00000040, 0x00200040, 0x80200000, -0x80200840, 0x80000800, 0x00000840, 0x00000000, -0x00200000, 0x80200040, 0x80000040, 0x00200800, -0x80000000, 0x00200840, 0x00200800, 0x80000040, -0x80200040, 0x00000800, 0x80000800, 0x80200840, -0x00000000, 0x00200040, 0x80200000, 0x00000840, -0x80200800, 0x80000840, 0x00200840, 0x80000000, -0x80000840, 0x80200800, 0x00000040, 0x00200000, -0x80000840, 0x00200800, 0x80200800, 0x80000040, -0x00000800, 0x00000040, 0x00200000, 0x80200800, -0x80200040, 0x80000840, 0x00000840, 0x00000000, -0x00000040, 0x80200000, 0x80000000, 0x00200040, -0x00000000, 0x80200040, 0x00200040, 0x00000840, -0x80000040, 0x00000800, 0x80200840, 0x00200000, -0x00200840, 0x80000000, 0x80000800, 0x80200840, -0x80200000, 0x00200840, 0x00200800, 0x80000800, -); -@SP7=( -0x04100010, 0x04104000, 0x00004010, 0x00000000, -0x04004000, 0x00100010, 0x04100000, 0x04104010, -0x00000010, 0x04000000, 0x00104000, 0x00004010, -0x00104010, 0x04004010, 0x04000010, 0x04100000, -0x00004000, 0x00104010, 0x00100010, 0x04004000, -0x04104010, 0x04000010, 0x00000000, 0x00104000, -0x04000000, 0x00100000, 0x04004010, 0x04100010, -0x00100000, 0x00004000, 0x04104000, 0x00000010, -0x00100000, 0x00004000, 0x04000010, 0x04104010, -0x00004010, 0x04000000, 0x00000000, 0x00104000, -0x04100010, 0x04004010, 0x04004000, 0x00100010, -0x04104000, 0x00000010, 0x00100010, 0x04004000, -0x04104010, 0x00100000, 0x04100000, 0x04000010, -0x00104000, 0x00004010, 0x04004010, 0x04100000, -0x00000010, 0x04104000, 0x00104010, 0x00000000, -0x04000000, 0x04100010, 0x00004000, 0x00104010, -); - -sub main'des_set_key - { - local($param)=@_; - local(@key); - local($c,$d,$i,$s,$t); - local(@ks)=(); - - # Get the bytes in the order we want. - @key=unpack("C8",$param); - - $c= ($key[0] )| - ($key[1]<< 8)| - ($key[2]<<16)| - ($key[3]<<24); - $d= ($key[4] )| - ($key[5]<< 8)| - ($key[6]<<16)| - ($key[7]<<24); - - &doPC1(*c,*d); - - for $i (@shifts2) - { - if ($i) - { - $c=($c>>2)|($c<<26); - $d=($d>>2)|($d<<26); - } - else - { - $c=($c>>1)|($c<<27); - $d=($d>>1)|($d<<27); - } - $c&=0x0fffffff; - $d&=0x0fffffff; - $s= $skb0[ ($c )&0x3f ]| - $skb1[(($c>> 6)&0x03)|(($c>> 7)&0x3c)]| - $skb2[(($c>>13)&0x0f)|(($c>>14)&0x30)]| - $skb3[(($c>>20)&0x01)|(($c>>21)&0x06) | - (($c>>22)&0x38)]; - $t= $skb4[ ($d )&0x3f ]| - $skb5[(($d>> 7)&0x03)|(($d>> 8)&0x3c)]| - $skb6[ ($d>>15)&0x3f ]| - $skb7[(($d>>21)&0x0f)|(($d>>22)&0x30)]; - push(@ks,(($t<<16)|($s&0x0000ffff))&0xffffffff); - $s= (($s>>16)&0x0000ffff)|($t&0xffff0000) ; - push(@ks,(($s<<4)|(($s>>28)&0xf))&0xffffffff); - } - @ks; - } - -sub doPC1 - { - local(*a,*b)=@_; - local($t); - - $t=(($b>>4)^$a)&0x0f0f0f0f; - $b^=($t<<4); $a^=$t; - # do $a first - $t=(($a<<18)^$a)&0xcccc0000; - $a=$a^$t^(($t>>18)&0x00003fff); - $t=(($a<<17)^$a)&0xaaaa0000; - $a=$a^$t^(($t>>17)&0x00007fff); - $t=(($a<< 8)^$a)&0x00ff0000; - $a=$a^$t^(($t>> 8)&0x00ffffff); - $t=(($a<<17)^$a)&0xaaaa0000; - $a=$a^$t^(($t>>17)&0x00007fff); - - # now do $b - $t=(($b<<24)^$b)&0xff000000; - $b=$b^$t^(($t>>24)&0x000000ff); - $t=(($b<< 8)^$b)&0x00ff0000; - $b=$b^$t^(($t>> 8)&0x00ffffff); - $t=(($b<<14)^$b)&0x33330000; - $b=$b^$t^(($t>>14)&0x0003ffff); - $b=(($b&0x00aa00aa)<<7)|(($b&0x55005500)>>7)|($b&0xaa55aa55); - $b=(($b>>8)&0x00ffffff)|((($a&0xf0000000)>>4)&0x0fffffff); - $a&=0x0fffffff; - } - -sub doIP - { - local(*a,*b)=@_; - local($t); - - $t=(($b>> 4)^$a)&0x0f0f0f0f; - $b^=($t<< 4); $a^=$t; - $t=(($a>>16)^$b)&0x0000ffff; - $a^=($t<<16); $b^=$t; - $t=(($b>> 2)^$a)&0x33333333; - $b^=($t<< 2); $a^=$t; - $t=(($a>> 8)^$b)&0x00ff00ff; - $a^=($t<< 8); $b^=$t; - $t=(($b>> 1)^$a)&0x55555555; - $b^=($t<< 1); $a^=$t; - $t=$a; - $a=$b&0xffffffff; - $b=$t&0xffffffff; - } - -sub doFP - { - local(*a,*b)=@_; - local($t); - - $t=(($b>> 1)^$a)&0x55555555; - $b^=($t<< 1); $a^=$t; - $t=(($a>> 8)^$b)&0x00ff00ff; - $a^=($t<< 8); $b^=$t; - $t=(($b>> 2)^$a)&0x33333333; - $b^=($t<< 2); $a^=$t; - $t=(($a>>16)^$b)&0x0000ffff; - $a^=($t<<16); $b^=$t; - $t=(($b>> 4)^$a)&0x0f0f0f0f; - $b^=($t<< 4); $a^=$t; - $a&=0xffffffff; - $b&=0xffffffff; - } - -sub main'des_ecb_encrypt - { - local(*ks,$encrypt,$in)=@_; - local($l,$r,$i,$t,$u,@input); - - @input=unpack("C8",$in); - # Get the bytes in the order we want. - $l= ($input[0] )| - ($input[1]<< 8)| - ($input[2]<<16)| - ($input[3]<<24); - $r= ($input[4] )| - ($input[5]<< 8)| - ($input[6]<<16)| - ($input[7]<<24); - - $l&=0xffffffff; - $r&=0xffffffff; - &doIP(*l,*r); - if ($encrypt) - { - for ($i=0; $i<32; $i+=4) - { - $t=((($r&0x7fffffff)<<1)|(($r>>31)&0x00000001)); - $u=$t^$ks[$i ]; - $t=$t^$ks[$i+1]; - $t2=(($t&0x0000000f)<<28); - - $t=((($t>>4)&0x0fffffff)|(($t&0x0000000f)<<28)); - $l^= $SP1[ $t &0x3f]| - $SP3[($t>> 8)&0x3f]| - $SP5[($t>>16)&0x3f]| - $SP7[($t>>24)&0x3f]| - $SP0[ $u &0x3f]| - $SP2[($u>> 8)&0x3f]| - $SP4[($u>>16)&0x3f]| - $SP6[($u>>24)&0x3f]; - - $t=(($l<<1)|(($l>>31)&0x1))&0xffffffff; - $u=$t^$ks[$i+2]; - $t=$t^$ks[$i+3]; - $t=((($t>>4)&0x0fffffff)|($t<<28))&0xffffffff; - $r^= $SP1[ $t &0x3f]| - $SP3[($t>> 8)&0x3f]| - $SP5[($t>>16)&0x3f]| - $SP7[($t>>24)&0x3f]| - $SP0[ $u &0x3f]| - $SP2[($u>> 8)&0x3f]| - $SP4[($u>>16)&0x3f]| - $SP6[($u>>24)&0x3f]; - } - } - else - { - for ($i=30; $i>0; $i-=4) - { - $t=(($r<<1)|(($r>>31)&0x1))&0xffffffff; - $u=$t^$ks[$i ]; - $t=$t^$ks[$i+1]; - $t=((($t>>4)&0x0fffffff)|($t<<28))&0xffffffff; - $l^= $SP1[ $t &0x3f]| - $SP3[($t>> 8)&0x3f]| - $SP5[($t>>16)&0x3f]| - $SP7[($t>>24)&0x3f]| - $SP0[ $u &0x3f]| - $SP2[($u>> 8)&0x3f]| - $SP4[($u>>16)&0x3f]| - $SP6[($u>>24)&0x3f]; - - $t=(($l<<1)|(($l>>31)&0x1))&0xffffffff; - $u=$t^$ks[$i-2]; - $t=$t^$ks[$i-1]; - $t=((($t>>4)&0x0fffffff)|($t<<28))&0xffffffff; - $r^= $SP1[ $t &0x3f]| - $SP3[($t>> 8)&0x3f]| - $SP5[($t>>16)&0x3f]| - $SP7[($t>>24)&0x3f]| - $SP0[ $u &0x3f]| - $SP2[($u>> 8)&0x3f]| - $SP4[($u>>16)&0x3f]| - $SP6[($u>>24)&0x3f]; - } - } - &doFP(*l,*r); - pack("C8",$l&0xff, - ($l>> 8)&0x00ffffff, - ($l>>16)&0x0000ffff, - ($l>>24)&0x000000ff, - $r&0xff, - ($r>> 8)&0x00ffffff, - ($r>>16)&0x0000ffff, - ($r>>24)&0x000000ff); - } diff --git a/src/lib/libcrypto/des/des.pod b/src/lib/libcrypto/des/des.pod new file mode 100644 index 0000000000..bf479e83d2 --- /dev/null +++ b/src/lib/libcrypto/des/des.pod @@ -0,0 +1,217 @@ +=pod + +=head1 NAME + +des - encrypt or decrypt data using Data Encryption Standard + +=head1 SYNOPSIS + +B +( +B<-e> +| +B<-E> +) | ( +B<-d> +| +B<-D> +) | ( +B<->[B][B] +) | +[ +B<-b3hfs> +] [ +B<-k> +I +] +] [ +B<-u>[I] +[ +I +[ +I +] ] + +=head1 NOTE + +This page describes the B stand-alone program, not the B +command. + +=head1 DESCRIPTION + +B +encrypts and decrypts data using the +Data Encryption Standard algorithm. +One of +B<-e>, B<-E> +(for encrypt) or +B<-d>, B<-D> +(for decrypt) must be specified. +It is also possible to use +B<-c> +or +B<-C> +in conjunction or instead of the a encrypt/decrypt option to generate +a 16 character hexadecimal checksum, generated via the +I. + +Two standard encryption modes are supported by the +B +program, Cipher Block Chaining (the default) and Electronic Code Book +(specified with +B<-b>). + +The key used for the DES +algorithm is obtained by prompting the user unless the +B<-k> +I +option is given. +If the key is an argument to the +B +command, it is potentially visible to users executing +ps(1) +or a derivative. To minimise this possibility, +B +takes care to destroy the key argument immediately upon entry. +If your shell keeps a history file be careful to make sure it is not +world readable. + +Since this program attempts to maintain compatibility with sunOS's +des(1) command, there are 2 different methods used to convert the user +supplied key to a des key. +Whenever and one or more of +B<-E>, B<-D>, B<-C> +or +B<-3> +options are used, the key conversion procedure will not be compatible +with the sunOS des(1) version but will use all the user supplied +character to generate the des key. +B +command reads from standard input unless +I +is specified and writes to standard output unless +I +is given. + +=head1 OPTIONS + +=over 4 + +=item B<-b> + +Select ECB +(eight bytes at a time) encryption mode. + +=item B<-3> + +Encrypt using triple encryption. +By default triple cbc encryption is used but if the +B<-b> +option is used then triple ECB encryption is performed. +If the key is less than 8 characters long, the flag has no effect. + +=item B<-e> + +Encrypt data using an 8 byte key in a manner compatible with sunOS +des(1). + +=item B<-E> + +Encrypt data using a key of nearly unlimited length (1024 bytes). +This will product a more secure encryption. + +=item B<-d> + +Decrypt data that was encrypted with the B<-e> option. + +=item B<-D> + +Decrypt data that was encrypted with the B<-E> option. + +=item B<-c> + +Generate a 16 character hexadecimal cbc checksum and output this to +stderr. +If a filename was specified after the +B<-c> +option, the checksum is output to that file. +The checksum is generated using a key generated in a sunOS compatible +manner. + +=item B<-C> + +A cbc checksum is generated in the same manner as described for the +B<-c> +option but the DES key is generated in the same manner as used for the +B<-E> +and +B<-D> +options + +=item B<-f> + +Does nothing - allowed for compatibility with sunOS des(1) command. + +=item B<-s> + +Does nothing - allowed for compatibility with sunOS des(1) command. + +=item B<-k> I + +Use the encryption +I +specified. + +=item B<-h> + +The +I +is assumed to be a 16 character hexadecimal number. +If the +B<-3> +option is used the key is assumed to be a 32 character hexadecimal +number. + +=item B<-u> + +This flag is used to read and write uuencoded files. If decrypting, +the input file is assumed to contain uuencoded, DES encrypted data. +If encrypting, the characters following the B<-u> are used as the name of +the uuencoded file to embed in the begin line of the uuencoded +output. If there is no name specified after the B<-u>, the name text.des +will be embedded in the header. + +=head1 SEE ALSO + +ps(1), +L + +=head1 BUGS + +The problem with using the +B<-e> +option is the short key length. +It would be better to use a real 56-bit key rather than an +ASCII-based 56-bit pattern. Knowing that the key was derived from ASCII +radically reduces the time necessary for a brute-force cryptographic attack. +My attempt to remove this problem is to add an alternative text-key to +DES-key function. This alternative function (accessed via +B<-E>, B<-D>, B<-S> +and +B<-3>) +uses DES to help generate the key. + +Be carefully when using the B<-u> option. Doing B I will +not decrypt filename (the B<-u> option will gobble the B<-d> option). + +The VMS operating system operates in a world where files are always a +multiple of 512 bytes. This causes problems when encrypted data is +send from Unix to VMS since a 88 byte file will suddenly be padded +with 424 null bytes. To get around this problem, use the B<-u> option +to uuencode the data before it is send to the VMS system. + +=head1 AUTHOR + +Eric Young (eay@cryptsoft.com) + +=cut diff --git a/src/lib/libcrypto/des/des_crypt.man b/src/lib/libcrypto/des/des_crypt.man index 0ecc416877..e69de29bb2 100644 --- a/src/lib/libcrypto/des/des_crypt.man +++ b/src/lib/libcrypto/des/des_crypt.man @@ -1,508 +0,0 @@ -.TH DES_CRYPT 3 -.SH NAME -des_read_password, des_read_2password, -des_string_to_key, des_string_to_2key, des_read_pw_string, -des_random_key, des_set_key, -des_key_sched, des_ecb_encrypt, des_ecb3_encrypt, des_cbc_encrypt, -des_3cbc_encrypt, -des_pcbc_encrypt, des_cfb_encrypt, des_ofb_encrypt, -des_cbc_cksum, des_quad_cksum, -des_enc_read, des_enc_write, des_set_odd_parity, -des_is_weak_key, crypt \- (non USA) DES encryption -.SH SYNOPSIS -.nf -.nj -.ft B -#include -.PP -.B int des_read_password(key,prompt,verify) -des_cblock *key; -char *prompt; -int verify; -.PP -.B int des_read_2password(key1,key2,prompt,verify) -des_cblock *key1,*key2; -char *prompt; -int verify; -.PP -.B int des_string_to_key(str,key) -char *str; -des_cblock *key; -.PP -.B int des_string_to_2keys(str,key1,key2) -char *str; -des_cblock *key1,*key2; -.PP -.B int des_read_pw_string(buf,length,prompt,verify) -char *buf; -int length; -char *prompt; -int verify; -.PP -.B int des_random_key(key) -des_cblock *key; -.PP -.B int des_set_key(key,schedule) -des_cblock *key; -des_key_schedule schedule; -.PP -.B int des_key_sched(key,schedule) -des_cblock *key; -des_key_schedule schedule; -.PP -.B int des_ecb_encrypt(input,output,schedule,encrypt) -des_cblock *input; -des_cblock *output; -des_key_schedule schedule; -int encrypt; -.PP -.B int des_ecb3_encrypt(input,output,ks1,ks2,encrypt) -des_cblock *input; -des_cblock *output; -des_key_schedule ks1,ks2; -int encrypt; -.PP -.B int des_cbc_encrypt(input,output,length,schedule,ivec,encrypt) -des_cblock *input; -des_cblock *output; -long length; -des_key_schedule schedule; -des_cblock *ivec; -int encrypt; -.PP -.B int des_3cbc_encrypt(input,output,length,sk1,sk2,ivec1,ivec2,encrypt) -des_cblock *input; -des_cblock *output; -long length; -des_key_schedule sk1; -des_key_schedule sk2; -des_cblock *ivec1; -des_cblock *ivec2; -int encrypt; -.PP -.B int des_pcbc_encrypt(input,output,length,schedule,ivec,encrypt) -des_cblock *input; -des_cblock *output; -long length; -des_key_schedule schedule; -des_cblock *ivec; -int encrypt; -.PP -.B int des_cfb_encrypt(input,output,numbits,length,schedule,ivec,encrypt) -unsigned char *input; -unsigned char *output; -int numbits; -long length; -des_key_schedule schedule; -des_cblock *ivec; -int encrypt; -.PP -.B int des_ofb_encrypt(input,output,numbits,length,schedule,ivec) -unsigned char *input,*output; -int numbits; -long length; -des_key_schedule schedule; -des_cblock *ivec; -.PP -.B unsigned long des_cbc_cksum(input,output,length,schedule,ivec) -des_cblock *input; -des_cblock *output; -long length; -des_key_schedule schedule; -des_cblock *ivec; -.PP -.B unsigned long des_quad_cksum(input,output,length,out_count,seed) -des_cblock *input; -des_cblock *output; -long length; -int out_count; -des_cblock *seed; -.PP -.B int des_check_key; -.PP -.B int des_enc_read(fd,buf,len,sched,iv) -int fd; -char *buf; -int len; -des_key_schedule sched; -des_cblock *iv; -.PP -.B int des_enc_write(fd,buf,len,sched,iv) -int fd; -char *buf; -int len; -des_key_schedule sched; -des_cblock *iv; -.PP -.B extern int des_rw_mode; -.PP -.B void des_set_odd_parity(key) -des_cblock *key; -.PP -.B int des_is_weak_key(key) -des_cblock *key; -.PP -.B char *crypt(passwd,salt) -char *passwd; -char *salt; -.PP -.fi -.SH DESCRIPTION -This library contains a fast implementation of the DES encryption -algorithm. -.PP -There are two phases to the use of DES encryption. -The first is the generation of a -.I des_key_schedule -from a key, -the second is the actual encryption. -A des key is of type -.I des_cblock. -This type is made from 8 characters with odd parity. -The least significant bit in the character is the parity bit. -The key schedule is an expanded form of the key; it is used to speed the -encryption process. -.PP -.I des_read_password -writes the string specified by prompt to the standard output, -turns off echo and reads an input string from standard input -until terminated with a newline. -If verify is non-zero, it prompts and reads the input again and verifies -that both entered passwords are the same. -The entered string is converted into a des key by using the -.I des_string_to_key -routine. -The new key is placed in the -.I des_cblock -that was passed (by reference) to the routine. -If there were no errors, -.I des_read_password -returns 0, --1 is returned if there was a terminal error and 1 is returned for -any other error. -.PP -.I des_read_2password -operates in the same way as -.I des_read_password -except that it generates 2 keys by using the -.I des_string_to_2key -function. -.PP -.I des_read_pw_string -is called by -.I des_read_password -to read and verify a string from a terminal device. -The string is returned in -.I buf. -The size of -.I buf -is passed to the routine via the -.I length -parameter. -.PP -.I des_string_to_key -converts a string into a valid des key. -.PP -.I des_string_to_2key -converts a string into 2 valid des keys. -This routine is best suited for used to generate keys for use with -.I des_ecb3_encrypt. -.PP -.I des_random_key -returns a random key that is made of a combination of process id, -time and an increasing counter. -.PP -Before a des key can be used it is converted into a -.I des_key_schedule -via the -.I des_set_key -routine. -If the -.I des_check_key -flag is non-zero, -.I des_set_key -will check that the key passed is of odd parity and is not a week or -semi-weak key. -If the parity is wrong, -then -1 is returned. -If the key is a weak key, -then -2 is returned. -If an error is returned, -the key schedule is not generated. -.PP -.I des_key_sched -is another name for the -.I des_set_key -function. -.PP -The following routines mostly operate on an input and output stream of -.I des_cblock's. -.PP -.I des_ecb_encrypt -is the basic DES encryption routine that encrypts or decrypts a single 8-byte -.I des_cblock -in -.I electronic code book -mode. -It always transforms the input data, pointed to by -.I input, -into the output data, -pointed to by the -.I output -argument. -If the -.I encrypt -argument is non-zero (DES_ENCRYPT), -the -.I input -(cleartext) is encrypted in to the -.I output -(ciphertext) using the key_schedule specified by the -.I schedule -argument, -previously set via -.I des_set_key. -If -.I encrypt -is zero (DES_DECRYPT), -the -.I input -(now ciphertext) -is decrypted into the -.I output -(now cleartext). -Input and output may overlap. -No meaningful value is returned. -.PP -.I des_ecb3_encrypt -encrypts/decrypts the -.I input -block by using triple ecb DES encryption. -This involves encrypting the input with -.I ks1, -decryption with the key schedule -.I ks2, -and then encryption with the first again. -This routine greatly reduces the chances of brute force breaking of -DES and has the advantage of if -.I ks1 -and -.I ks2 -are the same, it is equivalent to just encryption using ecb mode and -.I ks1 -as the key. -.PP -.I des_cbc_encrypt -encrypts/decrypts using the -.I cipher-block-chaining -mode of DES. -If the -.I encrypt -argument is non-zero, -the routine cipher-block-chain encrypts the cleartext data pointed to by the -.I input -argument into the ciphertext pointed to by the -.I output -argument, -using the key schedule provided by the -.I schedule -argument, -and initialisation vector provided by the -.I ivec -argument. -If the -.I length -argument is not an integral multiple of eight bytes, -the last block is copied to a temporary area and zero filled. -The output is always -an integral multiple of eight bytes. -To make multiple cbc encrypt calls on a large amount of data appear to -be one -.I des_cbc_encrypt -call, the -.I ivec -of subsequent calls should be the last 8 bytes of the output. -.PP -.I des_3cbc_encrypt -encrypts/decrypts the -.I input -block by using triple cbc DES encryption. -This involves encrypting the input with key schedule -.I ks1, -decryption with the key schedule -.I ks2, -and then encryption with the first again. -2 initialisation vectors are required, -.I ivec1 -and -.I ivec2. -Unlike -.I des_cbc_encrypt, -these initialisation vectors are modified by the subroutine. -This routine greatly reduces the chances of brute force breaking of -DES and has the advantage of if -.I ks1 -and -.I ks2 -are the same, it is equivalent to just encryption using cbc mode and -.I ks1 -as the key. -.PP -.I des_pcbc_encrypt -encrypt/decrypts using a modified block chaining mode. -It provides better error propagation characteristics than cbc -encryption. -.PP -.I des_cfb_encrypt -encrypt/decrypts using cipher feedback mode. This method takes an -array of characters as input and outputs and array of characters. It -does not require any padding to 8 character groups. Note: the ivec -variable is changed and the new changed value needs to be passed to -the next call to this function. Since this function runs a complete -DES ecb encryption per numbits, this function is only suggested for -use when sending small numbers of characters. -.PP -.I des_ofb_encrypt -encrypt using output feedback mode. This method takes an -array of characters as input and outputs and array of characters. It -does not require any padding to 8 character groups. Note: the ivec -variable is changed and the new changed value needs to be passed to -the next call to this function. Since this function runs a complete -DES ecb encryption per numbits, this function is only suggested for -use when sending small numbers of characters. -.PP -.I des_cbc_cksum -produces an 8 byte checksum based on the input stream (via cbc encryption). -The last 4 bytes of the checksum is returned and the complete 8 bytes is -placed in -.I output. -.PP -.I des_quad_cksum -returns a 4 byte checksum from the input bytes. -The algorithm can be iterated over the input, -depending on -.I out_count, -1, 2, 3 or 4 times. -If -.I output -is non-NULL, -the 8 bytes generated by each pass are written into -.I output. -.PP -.I des_enc_write -is used to write -.I len -bytes -to file descriptor -.I fd -from buffer -.I buf. -The data is encrypted via -.I pcbc_encrypt -(default) using -.I sched -for the key and -.I iv -as a starting vector. -The actual data send down -.I fd -consists of 4 bytes (in network byte order) containing the length of the -following encrypted data. The encrypted data then follows, padded with random -data out to a multiple of 8 bytes. -.PP -.I des_enc_read -is used to read -.I len -bytes -from file descriptor -.I fd -into buffer -.I buf. -The data being read from -.I fd -is assumed to have come from -.I des_enc_write -and is decrypted using -.I sched -for the key schedule and -.I iv -for the initial vector. -The -.I des_enc_read/des_enc_write -pair can be used to read/write to files, pipes and sockets. -I have used them in implementing a version of rlogin in which all -data is encrypted. -.PP -.I des_rw_mode -is used to specify the encryption mode to use with -.I des_enc_read -and -.I des_end_write. -If set to -.I DES_PCBC_MODE -(the default), des_pcbc_encrypt is used. -If set to -.I DES_CBC_MODE -des_cbc_encrypt is used. -These two routines and the variable are not part of the normal MIT library. -.PP -.I des_set_odd_parity -sets the parity of the passed -.I key -to odd. This routine is not part of the standard MIT library. -.PP -.I des_is_weak_key -returns 1 is the passed key is a weak key (pick again :-), -0 if it is ok. -This routine is not part of the standard MIT library. -.PP -.I crypt -is a replacement for the normal system crypt. -It is much faster than the system crypt. -.PP -.SH FILES -/usr/include/des.h -.br -/usr/lib/libdes.a -.PP -The encryption routines have been tested on 16bit, 32bit and 64bit -machines of various endian and even works under VMS. -.PP -.SH BUGS -.PP -If you think this manual is sparse, -read the des_crypt(3) manual from the MIT kerberos (or bones outside -of the USA) distribution. -.PP -.I des_cfb_encrypt -and -.I des_ofb_encrypt -operates on input of 8 bits. What this means is that if you set -numbits to 12, and length to 2, the first 12 bits will come from the 1st -input byte and the low half of the second input byte. The second 12 -bits will have the low 8 bits taken from the 3rd input byte and the -top 4 bits taken from the 4th input byte. The same holds for output. -This function has been implemented this way because most people will -be using a multiple of 8 and because once you get into pulling bytes input -bytes apart things get ugly! -.PP -.I des_read_pw_string -is the most machine/OS dependent function and normally generates the -most problems when porting this code. -.PP -.I des_string_to_key -is probably different from the MIT version since there are lots -of fun ways to implement one-way encryption of a text string. -.PP -The routines are optimised for 32 bit machines and so are not efficient -on IBM PCs. -.PP -NOTE: extensive work has been done on this library since this document -was origionally written. Please try to read des.doc from the libdes -distribution since it is far more upto date and documents more of the -functions. Libdes is now also being shipped as part of SSLeay, a -general cryptographic library that amonst other things implements -netscapes SSL protocoll. The most recent version can be found in -SSLeay distributions. -.SH AUTHOR -Eric Young (eay@cryptsoft.com) diff --git a/src/lib/libcrypto/des/des_locl.h b/src/lib/libcrypto/des/des_locl.h index 4dfed199a7..1ace8f5930 100644 --- a/src/lib/libcrypto/des/des_locl.h +++ b/src/lib/libcrypto/des/des_locl.h @@ -155,7 +155,7 @@ } \ } -#if defined(WIN32) +#if defined(WIN32) && defined(_MSC_VER) #define ROTATE(a,n) (_lrotr(a,n)) #else #define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) diff --git a/src/lib/libcrypto/des/destest.c b/src/lib/libcrypto/des/destest.c index 9ad4ecb072..df0d615d6b 100644 --- a/src/lib/libcrypto/des/destest.c +++ b/src/lib/libcrypto/des/destest.c @@ -336,8 +336,15 @@ int main(int argc, char *argv[]) unsigned char cbc_in[40]; unsigned char cbc_out[40]; DES_LONG cs; - unsigned char qret[4][4],cret[8]; - DES_LONG lqret[4]; + unsigned char cret[8]; +#ifdef _CRAY + struct { + int a:32; + int b:32; + } lqret[2]; +#else + DES_LONG lqret[4]; +#endif int num; char *str; @@ -701,43 +708,40 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]); } printf("Doing quad_cksum\n"); - /* This is obviously done this way especially to puzzle me. Although - quad_cksum returns up to 4 groups of 8 bytes, this test gets it to - produce 2 groups then treats them as 4 groups of 4 bytes. - Ben 13 Feb 1999 */ - cs=quad_cksum(cbc_data,(des_cblock *)qret,strlen((char *)cbc_data),2, - &cbc_iv); - - { /* Big-endian fix */ - static DES_LONG l=1; - static unsigned char *c=(unsigned char *)&l; - DES_LONG ll; - - j=sizeof(lqret[0])-4; - for (i=0; i<4; i++) + cs=quad_cksum(cbc_data,(des_cblock *)lqret, + (long)strlen((char *)cbc_data),2,(des_cblock *)cbc_iv); + if (cs != 0x70d7a63aL) { - lqret[i]=0; - memcpy(&(lqret[i]),&(qret[i][0]),4); - if (!c[0] && (j > 0)) - lqret[i]=lqret[i]>>(j*8); /* For Cray */ + printf("quad_cksum error, ret %08lx should be 70d7a63a\n", + (unsigned long)cs); + err=1; } - - if (!c[0]) +#ifdef _CRAY + if (lqret[0].a != 0x327eba8dL) { - ll=lqret[0]^lqret[3]; - lqret[0]^=ll; - lqret[3]^=ll; - ll=lqret[1]^lqret[2]; - lqret[1]^=ll; - lqret[2]^=ll; + printf("quad_cksum error, out[0] %08lx is not %08lx\n", + (unsigned long)lqret[0].a,0x327eba8dUL); + err=1; } - } - if (cs != 0x70d7a63aL) + if (lqret[0].b != 0x201a49ccL) { - printf("quad_cksum error, ret %08lx should be 70d7a63a\n", - (unsigned long)cs); + printf("quad_cksum error, out[1] %08lx is not %08lx\n", + (unsigned long)lqret[0].b,0x201a49ccUL); + err=1; + } + if (lqret[1].a != 0x70d7a63aL) + { + printf("quad_cksum error, out[2] %08lx is not %08lx\n", + (unsigned long)lqret[1].a,0x70d7a63aUL); err=1; } + if (lqret[1].b != 0x501c2c26L) + { + printf("quad_cksum error, out[3] %08lx is not %08lx\n", + (unsigned long)lqret[1].b,0x501c2c26UL); + err=1; + } +#else if (lqret[0] != 0x327eba8dL) { printf("quad_cksum error, out[0] %08lx is not %08lx\n", @@ -762,6 +766,7 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]); (unsigned long)lqret[3],0x501c2c26UL); err=1; } +#endif #endif printf("input word alignment test"); diff --git a/src/lib/libcrypto/des/doIP b/src/lib/libcrypto/des/doIP index 18cf231303..e69de29bb2 100644 --- a/src/lib/libcrypto/des/doIP +++ b/src/lib/libcrypto/des/doIP @@ -1,46 +0,0 @@ -#!/usr/local/bin/perl - -@l=( - 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9,10,11,12,13,14,15, - 16,17,18,19,20,21,22,23, - 24,25,26,27,28,29,30,31 - ); -@r=( - 32,33,34,35,36,37,38,39, - 40,41,42,43,44,45,46,47, - 48,49,50,51,52,53,54,55, - 56,57,58,59,60,61,62,63 - ); - -require 'shifts.pl'; - -sub PERM_OP - { - local(*a,*b,*t,$n,$m)=@_; - - @z=&shift(*a,-$n); - @z=&xor(*b,*z); - @z=&and(*z,$m); - @b=&xor(*b,*z); - @z=&shift(*z,$n); - @a=&xor(*a,*z); - } - - -@L=@l; -@R=@r; -&PERM_OP(*R,*L,*T,4,0x0f0f0f0f); -&PERM_OP(*L,*R,*T,16,0x0000ffff); -&PERM_OP(*R,*L,*T,2,0x33333333); -&PERM_OP(*L,*R,*T,8,0x00ff00ff); -&PERM_OP(*R,*L,*T,1,0x55555555); - &printit(@L); - &printit(@R); -&PERM_OP(*R,*L,*T,1,0x55555555); -&PERM_OP(*L,*R,*T,8,0x00ff00ff); -&PERM_OP(*R,*L,*T,2,0x33333333); -&PERM_OP(*L,*R,*T,16,0x0000ffff); -&PERM_OP(*R,*L,*T,4,0x0f0f0f0f); - &printit(@L); - &printit(@R); diff --git a/src/lib/libcrypto/des/doPC1 b/src/lib/libcrypto/des/doPC1 index 096afd8c46..e69de29bb2 100644 --- a/src/lib/libcrypto/des/doPC1 +++ b/src/lib/libcrypto/des/doPC1 @@ -1,110 +0,0 @@ -#!/usr/local/bin/perl - -@l=( - 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9,10,11,12,13,14,15, - 16,17,18,19,20,21,22,23, - 24,25,26,27,28,29,30,31 - ); -@r=( - 32,33,34,35,36,37,38,39, - 40,41,42,43,44,45,46,47, - 48,49,50,51,52,53,54,55, - 56,57,58,59,60,61,62,63 - ); - -require 'shifts.pl'; - -sub PERM_OP - { - local(*a,*b,*t,$n,$m)=@_; - - @z=&shift(*a,-$n); - @z=&xor(*b,*z); - @z=&and(*z,$m); - @b=&xor(*b,*z); - @z=&shift(*z,$n); - @a=&xor(*a,*z); - } - -sub HPERM_OP2 - { - local(*a,*t,$n,$m)=@_; - local(@x,@y,$i); - - @z=&shift(*a,16-$n); - @z=&xor(*a,*z); - @z=&and(*z,$m); - @a=&xor(*a,*z); - @z=&shift(*z,$n-16); - @a=&xor(*a,*z); - } - -sub HPERM_OP - { - local(*a,*t,$n,$m)=@_; - local(@x,@y,$i); - - for ($i=0; $i<16; $i++) - { - $x[$i]=$a[$i]; - $y[$i]=$a[16+$i]; - } - @z=&shift(*x,-$n); - @z=&xor(*y,*z); - @z=&and(*z,$m); - @y=&xor(*y,*z); - @z=&shift(*z,$n); - @x=&xor(*x,*z); - for ($i=0; $i<16; $i++) - { - $a[$i]=$x[$i]; - $a[16+$i]=$y[$i]; - } - } - -@L=@l; -@R=@r; - - print "---\n"; &printit(@R); -&PERM_OP(*R,*L,*T,4,0x0f0f0f0f); - print "---\n"; &printit(@R); -&HPERM_OP2(*L,*T,-2,0xcccc0000); -&HPERM_OP2(*R,*T,-2,0xcccc0000); - print "---\n"; &printit(@R); -&PERM_OP(*R,*L,*T,1,0x55555555); - print "---\n"; &printit(@R); -&PERM_OP(*L,*R,*T,8,0x00ff00ff); - print "---\n"; &printit(@R); -&PERM_OP(*R,*L,*T,1,0x55555555); - print "---\n"; &printit(@R); -# &printit(@L); - &printit(@R); -print <<"EOF"; -============================== -63 55 47 39 31 23 15 7 -62 54 46 38 30 22 14 6 -61 53 45 37 29 21 13 5 -60 52 44 36 -- -- -- -- - -57 49 41 33 25 17 9 1 -58 50 42 34 26 18 10 2 -59 51 43 35 27 19 11 3 -28 20 12 4 -- -- -- -- -EOF -exit(1); -@A=&and(*R,0x000000ff); -@A=&shift(*A,16); -@B=&and(*R,0x0000ff00); -@C=&and(*R,0x00ff0000); -@C=&shift(*C,-16); -@D=&and(*L,0xf0000000); -@D=&shift(*D,-4); -@A=&or(*A,*B); -@B=&or(*D,*C); -@R=&or(*A,*B); -@L=&and(*L,0x0fffffff); - - &printit(@L); - &printit(@R); - diff --git a/src/lib/libcrypto/des/doPC2 b/src/lib/libcrypto/des/doPC2 index fa5cf74cf7..e69de29bb2 100644 --- a/src/lib/libcrypto/des/doPC2 +++ b/src/lib/libcrypto/des/doPC2 @@ -1,94 +0,0 @@ -#!/usr/local/bin/perl - -@PC2_C=(14,17,11,24, 1, 5, - 3,28,15, 6,21,10, - 23,19,12, 4,26, 8, - 16, 7,27,20,13, 2, - ); - -@PC2_D=(41,52,31,37,47,55, - 30,40,51,45,33,48, - 44,49,39,56,34,53, - 46,42,50,36,29,32, - ); - -$i=0; -foreach (@PC2_C) { - $_--; -# printf "%2d,",$_; - $C{$_}=$i; - ++$i; -# print "\n" if ((($i) % 8) == 0); - } -$i=0; -#print "\n"; -foreach (@PC2_D) { - $_-=28; - $_--; -# printf "%2d,",$_; - $D{$_}=$i; - $i++; -# print "\n" if ((($i) % 8) == 0); - } - -#print "\n"; -foreach $i (0 .. 27) - { - $_=$C{$i}; -# printf "%2d,",$_; - $i++; -# print "\n" if ((($i) % 8) == 0); - } -#print "\n"; - -#print "\n"; -foreach $i (0 .. 27) - { - $_=$D{$i}; -# printf "%2d,",$_; - $i++; -# print "\n" if ((($i) % 8) == 0); - } -#print "\n"; - -print "static ulong skb[8][64]={\n"; -&doit("C",*C, 0, 1, 2, 3, 4, 5); -&doit("C",*C, 6, 7, 9,10,11,12); -&doit("C",*C,13,14,15,16,18,19); -&doit("C",*C,20,22,23,25,26,27); - -&doit("D",*D, 0, 1, 2, 3, 4, 5); -&doit("D",*D, 7, 8,10,11,12,13); -&doit("D",*D,15,16,17,18,19,20); -&doit("D",*D,21,22,23,24,26,27); -print "};\n"; - -sub doit - { - local($l,*A,@b)=@_; - local(@out); - - printf("/* for $l bits (numbered as per FIPS 46) %d %d %d %d %d %d */\n", - $b[0]+1, $b[1]+1, $b[2]+1, $b[3]+1, $b[4]+1, $b[5]+1); - for ($i=0; $i<64; $i++) - { - $out[$i]=0; - $j=1; -#print "\n"; - for ($k=0; $k<6; $k++) - { - $l=$A{$b[$k]}; -#print"$l - "; - if ((1<<$k) & $i) - { - $ll=int($l/6)*8+($l%6); - $out[$i]|=1<<($ll); - } - } - $pp=$out[$i]; - $pp=($pp&0xff0000ff)| (($pp&0x00ff0000)>>8)| - (($pp&0x0000ff00)<<8); - printf("0x%08X,",$pp); - print "\n" if (($i+1) % 4 == 0); - } - } diff --git a/src/lib/libcrypto/des/fcrypt.c b/src/lib/libcrypto/des/fcrypt.c index fa1b8aa34a..9b21f81cc2 100644 --- a/src/lib/libcrypto/des/fcrypt.c +++ b/src/lib/libcrypto/des/fcrypt.c @@ -3,7 +3,6 @@ /* This version of crypt has been developed from my MIT compatible * DES library. - * The library is available at pub/Crypto/DES at ftp.psy.uq.oz.au * Eric Young (eay@cryptsoft.com) */ diff --git a/src/lib/libcrypto/des/fcrypt_b.c b/src/lib/libcrypto/des/fcrypt_b.c index 83c94054e3..22c87f5983 100644 --- a/src/lib/libcrypto/des/fcrypt_b.c +++ b/src/lib/libcrypto/des/fcrypt_b.c @@ -97,7 +97,7 @@ void fcrypt_body(DES_LONG *out, des_key_schedule ks, DES_LONG Eswap0, for (j=0; j<25; j++) { -#ifdef DES_UNROLL +#ifndef DES_UNROLL register int i; for (i=0; i<32; i+=8) diff --git a/src/lib/libcrypto/des/ncbc_enc.c b/src/lib/libcrypto/des/ncbc_enc.c index e0e67a417d..3b681691a9 100644 --- a/src/lib/libcrypto/des/ncbc_enc.c +++ b/src/lib/libcrypto/des/ncbc_enc.c @@ -1,4 +1,9 @@ /* crypto/des/ncbc_enc.c */ +/* + * #included by: + * cbc_enc.c (des_cbc_encrypt) + * des_enc.c (des_ncbc_encrypt) + */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/src/lib/libcrypto/des/podd.h b/src/lib/libcrypto/des/podd.h index 1b2bfe0843..e69de29bb2 100644 --- a/src/lib/libcrypto/des/podd.h +++ b/src/lib/libcrypto/des/podd.h @@ -1,75 +0,0 @@ -/* crypto/des/podd.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -static const unsigned char odd_parity[256]={ - 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, - 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31, - 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47, - 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62, - 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79, - 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94, - 97, 97, 98, 98,100,100,103,103,104,104,107,107,109,109,110,110, -112,112,115,115,117,117,118,118,121,121,122,122,124,124,127,127, -128,128,131,131,133,133,134,134,137,137,138,138,140,140,143,143, -145,145,146,146,148,148,151,151,152,152,155,155,157,157,158,158, -161,161,162,162,164,164,167,167,168,168,171,171,173,173,174,174, -176,176,179,179,181,181,182,182,185,185,186,186,188,188,191,191, -193,193,194,194,196,196,199,199,200,200,203,203,205,205,206,206, -208,208,211,211,213,213,214,214,217,217,218,218,220,220,223,223, -224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239, -241,241,242,242,244,244,247,247,248,248,251,251,253,253,254,254}; diff --git a/src/lib/libcrypto/des/qud_cksm.c b/src/lib/libcrypto/des/qud_cksm.c index 6ce8c61b42..5f0ec5387f 100644 --- a/src/lib/libcrypto/des/qud_cksm.c +++ b/src/lib/libcrypto/des/qud_cksm.c @@ -80,10 +80,14 @@ DES_LONG des_quad_cksum(const unsigned char *input, des_cblock output[], int i; long l; const unsigned char *cp; - unsigned char *lp; +#ifdef _CRAY + short *lp; +#else + DES_LONG *lp; +#endif if (out_count < 1) out_count=1; - lp = &(output[0])[0]; + lp = (DES_LONG *) &(output[0])[0]; z0=Q_B0((*seed)[0])|Q_B1((*seed)[1])|Q_B2((*seed)[2])|Q_B3((*seed)[3]); z1=Q_B0((*seed)[4])|Q_B1((*seed)[5])|Q_B2((*seed)[6])|Q_B3((*seed)[7]); @@ -114,25 +118,10 @@ DES_LONG des_quad_cksum(const unsigned char *input, des_cblock output[], } if (lp != NULL) { - /* I believe I finally have things worked out. - * The MIT library assumes that the checksum - * is one huge number and it is returned in a - * host dependant byte order. - */ - static DES_LONG ltmp=1; - static unsigned char *c=(unsigned char *)<mp; - - if (c[0]) - { - l2c(z0,lp); - l2c(z1,lp); - } - else - { - lp = &(output[out_count-i-1])[0]; - l2n(z1,lp); - l2n(z0,lp); - } + /* The MIT library assumes that the checksum is + * composed of 2*out_count 32 bit ints */ + *lp++ = z0; + *lp++ = z1; } } return(z0); diff --git a/src/lib/libcrypto/des/rand_key.c b/src/lib/libcrypto/des/rand_key.c index 7816a8f25c..ee1a6c274e 100644 --- a/src/lib/libcrypto/des/rand_key.c +++ b/src/lib/libcrypto/des/rand_key.c @@ -63,7 +63,11 @@ void des_random_seed(des_cblock *key) int des_random_key(des_cblock *ret) { - int r = RAND_bytes((unsigned char *)ret, sizeof(des_cblock)); + do + { + if (RAND_bytes((unsigned char *)ret, sizeof(des_cblock)) != 1) + return (0); + } while (des_is_weak_key(ret)); des_set_odd_parity(ret); - return r; + return (1); } diff --git a/src/lib/libcrypto/des/set_key.c b/src/lib/libcrypto/des/set_key.c index bbdc71ba6b..09afd4fc03 100644 --- a/src/lib/libcrypto/des/set_key.c +++ b/src/lib/libcrypto/des/set_key.c @@ -64,12 +64,27 @@ * 1.0 First working version */ #include "des_locl.h" -#include "podd.h" -#include "sk.h" -static int check_parity(const_des_cblock *key); OPENSSL_GLOBAL int des_check_key=0; +static const unsigned char odd_parity[256]={ + 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, + 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31, + 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47, + 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62, + 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79, + 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94, + 97, 97, 98, 98,100,100,103,103,104,104,107,107,109,109,110,110, +112,112,115,115,117,117,118,118,121,121,122,122,124,124,127,127, +128,128,131,131,133,133,134,134,137,137,138,138,140,140,143,143, +145,145,146,146,148,148,151,151,152,152,155,155,157,157,158,158, +161,161,162,162,164,164,167,167,168,168,171,171,173,173,174,174, +176,176,179,179,181,181,182,182,185,185,186,186,188,188,191,191, +193,193,194,194,196,196,199,199,200,200,203,203,205,205,206,206, +208,208,211,211,213,213,214,214,217,217,218,218,220,220,223,223, +224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239, +241,241,242,242,244,244,247,247,248,248,251,251,253,253,254,254}; + void des_set_odd_parity(des_cblock *key) { int i; @@ -78,7 +93,7 @@ void des_set_odd_parity(des_cblock *key) (*key)[i]=odd_parity[(*key)[i]]; } -static int check_parity(const_des_cblock *key) +int des_check_key_parity(const_des_cblock *key) { int i; @@ -145,6 +160,153 @@ int des_is_weak_key(const_des_cblock *key) #define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\ (a)=(a)^(t)^(t>>(16-(n)))) +static const DES_LONG des_skb[8][64]={ + { + /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ + 0x00000000L,0x00000010L,0x20000000L,0x20000010L, + 0x00010000L,0x00010010L,0x20010000L,0x20010010L, + 0x00000800L,0x00000810L,0x20000800L,0x20000810L, + 0x00010800L,0x00010810L,0x20010800L,0x20010810L, + 0x00000020L,0x00000030L,0x20000020L,0x20000030L, + 0x00010020L,0x00010030L,0x20010020L,0x20010030L, + 0x00000820L,0x00000830L,0x20000820L,0x20000830L, + 0x00010820L,0x00010830L,0x20010820L,0x20010830L, + 0x00080000L,0x00080010L,0x20080000L,0x20080010L, + 0x00090000L,0x00090010L,0x20090000L,0x20090010L, + 0x00080800L,0x00080810L,0x20080800L,0x20080810L, + 0x00090800L,0x00090810L,0x20090800L,0x20090810L, + 0x00080020L,0x00080030L,0x20080020L,0x20080030L, + 0x00090020L,0x00090030L,0x20090020L,0x20090030L, + 0x00080820L,0x00080830L,0x20080820L,0x20080830L, + 0x00090820L,0x00090830L,0x20090820L,0x20090830L, + },{ + /* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ + 0x00000000L,0x02000000L,0x00002000L,0x02002000L, + 0x00200000L,0x02200000L,0x00202000L,0x02202000L, + 0x00000004L,0x02000004L,0x00002004L,0x02002004L, + 0x00200004L,0x02200004L,0x00202004L,0x02202004L, + 0x00000400L,0x02000400L,0x00002400L,0x02002400L, + 0x00200400L,0x02200400L,0x00202400L,0x02202400L, + 0x00000404L,0x02000404L,0x00002404L,0x02002404L, + 0x00200404L,0x02200404L,0x00202404L,0x02202404L, + 0x10000000L,0x12000000L,0x10002000L,0x12002000L, + 0x10200000L,0x12200000L,0x10202000L,0x12202000L, + 0x10000004L,0x12000004L,0x10002004L,0x12002004L, + 0x10200004L,0x12200004L,0x10202004L,0x12202004L, + 0x10000400L,0x12000400L,0x10002400L,0x12002400L, + 0x10200400L,0x12200400L,0x10202400L,0x12202400L, + 0x10000404L,0x12000404L,0x10002404L,0x12002404L, + 0x10200404L,0x12200404L,0x10202404L,0x12202404L, + },{ + /* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ + 0x00000000L,0x00000001L,0x00040000L,0x00040001L, + 0x01000000L,0x01000001L,0x01040000L,0x01040001L, + 0x00000002L,0x00000003L,0x00040002L,0x00040003L, + 0x01000002L,0x01000003L,0x01040002L,0x01040003L, + 0x00000200L,0x00000201L,0x00040200L,0x00040201L, + 0x01000200L,0x01000201L,0x01040200L,0x01040201L, + 0x00000202L,0x00000203L,0x00040202L,0x00040203L, + 0x01000202L,0x01000203L,0x01040202L,0x01040203L, + 0x08000000L,0x08000001L,0x08040000L,0x08040001L, + 0x09000000L,0x09000001L,0x09040000L,0x09040001L, + 0x08000002L,0x08000003L,0x08040002L,0x08040003L, + 0x09000002L,0x09000003L,0x09040002L,0x09040003L, + 0x08000200L,0x08000201L,0x08040200L,0x08040201L, + 0x09000200L,0x09000201L,0x09040200L,0x09040201L, + 0x08000202L,0x08000203L,0x08040202L,0x08040203L, + 0x09000202L,0x09000203L,0x09040202L,0x09040203L, + },{ + /* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ + 0x00000000L,0x00100000L,0x00000100L,0x00100100L, + 0x00000008L,0x00100008L,0x00000108L,0x00100108L, + 0x00001000L,0x00101000L,0x00001100L,0x00101100L, + 0x00001008L,0x00101008L,0x00001108L,0x00101108L, + 0x04000000L,0x04100000L,0x04000100L,0x04100100L, + 0x04000008L,0x04100008L,0x04000108L,0x04100108L, + 0x04001000L,0x04101000L,0x04001100L,0x04101100L, + 0x04001008L,0x04101008L,0x04001108L,0x04101108L, + 0x00020000L,0x00120000L,0x00020100L,0x00120100L, + 0x00020008L,0x00120008L,0x00020108L,0x00120108L, + 0x00021000L,0x00121000L,0x00021100L,0x00121100L, + 0x00021008L,0x00121008L,0x00021108L,0x00121108L, + 0x04020000L,0x04120000L,0x04020100L,0x04120100L, + 0x04020008L,0x04120008L,0x04020108L,0x04120108L, + 0x04021000L,0x04121000L,0x04021100L,0x04121100L, + 0x04021008L,0x04121008L,0x04021108L,0x04121108L, + },{ + /* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ + 0x00000000L,0x10000000L,0x00010000L,0x10010000L, + 0x00000004L,0x10000004L,0x00010004L,0x10010004L, + 0x20000000L,0x30000000L,0x20010000L,0x30010000L, + 0x20000004L,0x30000004L,0x20010004L,0x30010004L, + 0x00100000L,0x10100000L,0x00110000L,0x10110000L, + 0x00100004L,0x10100004L,0x00110004L,0x10110004L, + 0x20100000L,0x30100000L,0x20110000L,0x30110000L, + 0x20100004L,0x30100004L,0x20110004L,0x30110004L, + 0x00001000L,0x10001000L,0x00011000L,0x10011000L, + 0x00001004L,0x10001004L,0x00011004L,0x10011004L, + 0x20001000L,0x30001000L,0x20011000L,0x30011000L, + 0x20001004L,0x30001004L,0x20011004L,0x30011004L, + 0x00101000L,0x10101000L,0x00111000L,0x10111000L, + 0x00101004L,0x10101004L,0x00111004L,0x10111004L, + 0x20101000L,0x30101000L,0x20111000L,0x30111000L, + 0x20101004L,0x30101004L,0x20111004L,0x30111004L, + },{ + /* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ + 0x00000000L,0x08000000L,0x00000008L,0x08000008L, + 0x00000400L,0x08000400L,0x00000408L,0x08000408L, + 0x00020000L,0x08020000L,0x00020008L,0x08020008L, + 0x00020400L,0x08020400L,0x00020408L,0x08020408L, + 0x00000001L,0x08000001L,0x00000009L,0x08000009L, + 0x00000401L,0x08000401L,0x00000409L,0x08000409L, + 0x00020001L,0x08020001L,0x00020009L,0x08020009L, + 0x00020401L,0x08020401L,0x00020409L,0x08020409L, + 0x02000000L,0x0A000000L,0x02000008L,0x0A000008L, + 0x02000400L,0x0A000400L,0x02000408L,0x0A000408L, + 0x02020000L,0x0A020000L,0x02020008L,0x0A020008L, + 0x02020400L,0x0A020400L,0x02020408L,0x0A020408L, + 0x02000001L,0x0A000001L,0x02000009L,0x0A000009L, + 0x02000401L,0x0A000401L,0x02000409L,0x0A000409L, + 0x02020001L,0x0A020001L,0x02020009L,0x0A020009L, + 0x02020401L,0x0A020401L,0x02020409L,0x0A020409L, + },{ + /* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ + 0x00000000L,0x00000100L,0x00080000L,0x00080100L, + 0x01000000L,0x01000100L,0x01080000L,0x01080100L, + 0x00000010L,0x00000110L,0x00080010L,0x00080110L, + 0x01000010L,0x01000110L,0x01080010L,0x01080110L, + 0x00200000L,0x00200100L,0x00280000L,0x00280100L, + 0x01200000L,0x01200100L,0x01280000L,0x01280100L, + 0x00200010L,0x00200110L,0x00280010L,0x00280110L, + 0x01200010L,0x01200110L,0x01280010L,0x01280110L, + 0x00000200L,0x00000300L,0x00080200L,0x00080300L, + 0x01000200L,0x01000300L,0x01080200L,0x01080300L, + 0x00000210L,0x00000310L,0x00080210L,0x00080310L, + 0x01000210L,0x01000310L,0x01080210L,0x01080310L, + 0x00200200L,0x00200300L,0x00280200L,0x00280300L, + 0x01200200L,0x01200300L,0x01280200L,0x01280300L, + 0x00200210L,0x00200310L,0x00280210L,0x00280310L, + 0x01200210L,0x01200310L,0x01280210L,0x01280310L, + },{ + /* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ + 0x00000000L,0x04000000L,0x00040000L,0x04040000L, + 0x00000002L,0x04000002L,0x00040002L,0x04040002L, + 0x00002000L,0x04002000L,0x00042000L,0x04042000L, + 0x00002002L,0x04002002L,0x00042002L,0x04042002L, + 0x00000020L,0x04000020L,0x00040020L,0x04040020L, + 0x00000022L,0x04000022L,0x00040022L,0x04040022L, + 0x00002020L,0x04002020L,0x00042020L,0x04042020L, + 0x00002022L,0x04002022L,0x00042022L,0x04042022L, + 0x00000800L,0x04000800L,0x00040800L,0x04040800L, + 0x00000802L,0x04000802L,0x00040802L,0x04040802L, + 0x00002800L,0x04002800L,0x00042800L,0x04042800L, + 0x00002802L,0x04002802L,0x00042802L,0x04042802L, + 0x00000820L,0x04000820L,0x00040820L,0x04040820L, + 0x00000822L,0x04000822L,0x00040822L,0x04040822L, + 0x00002820L,0x04002820L,0x00042820L,0x04042820L, + 0x00002822L,0x04002822L,0x00042822L,0x04042822L, + }}; + int des_set_key(const_des_cblock *key, des_key_schedule schedule) { if (des_check_key) @@ -164,7 +326,7 @@ int des_set_key(const_des_cblock *key, des_key_schedule schedule) */ int des_set_key_checked(const_des_cblock *key, des_key_schedule schedule) { - if (!check_parity(key)) + if (!des_check_key_parity(key)) return(-1); if (des_is_weak_key(key)) return(-2); @@ -186,20 +348,7 @@ void des_set_key_unchecked(const_des_cblock *key, des_key_schedule schedule) c2l(in,c); c2l(in,d); - /* do PC1 in 60 simple operations */ -/* PERM_OP(d,c,t,4,0x0f0f0f0fL); - HPERM_OP(c,t,-2, 0xcccc0000L); - HPERM_OP(c,t,-1, 0xaaaa0000L); - HPERM_OP(c,t, 8, 0x00ff0000L); - HPERM_OP(c,t,-1, 0xaaaa0000L); - HPERM_OP(d,t,-8, 0xff000000L); - HPERM_OP(d,t, 8, 0x00ff0000L); - HPERM_OP(d,t, 2, 0x33330000L); - d=((d&0x00aa00aaL)<<7L)|((d&0x55005500L)>>7L)|(d&0xaa55aa55L); - d=(d>>8)|((c&0xf0000000L)>>4); - c&=0x0fffffffL; */ - - /* I now do it in 47 simple operations :-) + /* do PC1 in 47 simple operations :-) * Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov) * for the inspiration. :-) */ PERM_OP (d,c,t,4,0x0f0f0f0fL); @@ -223,9 +372,9 @@ void des_set_key_unchecked(const_des_cblock *key, des_key_schedule schedule) /* could be a few less shifts but I am to lazy at this * point in time to investigate */ s= des_skb[0][ (c )&0x3f ]| - des_skb[1][((c>> 6)&0x03)|((c>> 7L)&0x3c)]| - des_skb[2][((c>>13)&0x0f)|((c>>14L)&0x30)]| - des_skb[3][((c>>20)&0x01)|((c>>21L)&0x06) | + des_skb[1][((c>> 6L)&0x03)|((c>> 7L)&0x3c)]| + des_skb[2][((c>>13L)&0x0f)|((c>>14L)&0x30)]| + des_skb[3][((c>>20L)&0x01)|((c>>21L)&0x06) | ((c>>22L)&0x38)]; t= des_skb[4][ (d )&0x3f ]| des_skb[5][((d>> 7L)&0x03)|((d>> 8L)&0x3c)]| @@ -245,3 +394,9 @@ int des_key_sched(const_des_cblock *key, des_key_schedule schedule) { return(des_set_key(key,schedule)); } + +#undef des_fixup_key_parity +void des_fixup_key_parity(des_cblock *key) + { + des_set_odd_parity(key); + } diff --git a/src/lib/libcrypto/des/shifts.pl b/src/lib/libcrypto/des/shifts.pl index ba686d8ef5..e69de29bb2 100644 --- a/src/lib/libcrypto/des/shifts.pl +++ b/src/lib/libcrypto/des/shifts.pl @@ -1,198 +0,0 @@ -#!/usr/local/bin/perl - -sub lab_shift - { - local(*a,$n)=@_; - local(@r,$i,$j,$k,$d,@z); - - @r=&shift(*a,$n); - foreach $i (0 .. 31) - { - @z=split(/\^/,$r[$i]); - for ($j=0; $j <= $#z; $j++) - { - ($d)=($z[$j] =~ /^(..)/); - ($k)=($z[$j] =~ /\[(.*)\]$/); - $k.=",$n" if ($k ne ""); - $k="$n" if ($k eq ""); - $d="$d[$k]"; - $z[$j]=$d; - } - $r[$i]=join('^',@z); - } - return(@r); - } - -sub shift - { - local(*a,$n)=@_; - local(@f); - - if ($n > 0) - { - @f=&shiftl(*a,$n); - } - else - { - @f=&shiftr(*a,-$n); - } - return(@f); - } - -sub rotate - { - local(*a,$n)=@_; - local(@f); - - if ($n > 0) - { @f=&rotatel(*a,$n); } - else - { @f=&rotater(*a,-$n); } - return(@f); - } - -sub rotater - { - local(*a,$n)=@_; - local(@f,@g); - - @f=&shiftr(*a,$n); - @g=&shiftl(*a,32-$n); - $#f=31; - $#g=31; - return(&or(*f,*g)); - } - -sub rotatel - { - local(*a,$n)=@_; - local(@f,@g); - - @f=&shiftl(*a,$n); - @g=&shiftr(*a,32-$n); - $#f=31; - $#g=31; - return(&or(*f,*g)); - } - -sub shiftr - { - local(*a,$n)=@_; - local(@r,$i); - - $#r=31; - foreach $i (0 .. 31) - { - if (($i+$n) > 31) - { - $r[$i]="--"; - } - else - { - $r[$i]=$a[$i+$n]; - } - } - return(@r); - } - -sub shiftl - { - local(*a,$n)=@_; - local(@r,$i); - - $#r=31; - foreach $i (0 .. 31) - { - if ($i < $n) - { - $r[$i]="--"; - } - else - { - $r[$i]=$a[$i-$n]; - } - } - return(@r); - } - -sub printit - { - local(@a)=@_; - local($i); - - foreach $i (0 .. 31) - { - printf "%2s ",$a[$i]; - print "\n" if (($i%8) == 7); - } - print "\n"; - } - -sub xor - { - local(*a,*b)=@_; - local(@r,$i); - - $#r=31; - foreach $i (0 .. 31) - { - $r[$i]=&compress($a[$i].'^'.$b[$i]); -# $r[$i]=$a[$i]."^".$b[$i]; - } - return(@r); - } - -sub and - { - local(*a,$m)=@_; - local(@r,$i); - - $#r=31; - foreach $i (0 .. 31) - { - $r[$i]=(($m & (1<<$i))?($a[$i]):('--')); - } - return(@r); - } - -sub or - { - local(*a,*b)=@_; - local(@r,$i); - - $#r=31; - foreach $i (0 .. 31) - { - $r[$i]='--' if (($a[$i] eq '--') && ($b[$i] eq '--')); - $r[$i]=$a[$i] if (($a[$i] ne '--') && ($b[$i] eq '--')); - $r[$i]=$b[$i] if (($a[$i] eq '--') && ($b[$i] ne '--')); - $r[$i]='++' if (($a[$i] ne '--') && ($b[$i] ne '--')); - } - return(@r); - } - -sub compress - { - local($s)=@_; - local($_,$i,@a,%a,$r); - - $s =~ s/\^\^/\^/g; - $s =~ s/^\^//; - $s =~ s/\^$//; - @a=split(/\^/,$s); - - while ($#a >= 0) - { - $_=shift(@a); - next unless /\d/; - $a{$_}++; - } - foreach $i (sort keys %a) - { - next if ($a{$i}%2 == 0); - $r.="$i^"; - } - chop($r); - return($r); - } -1; diff --git a/src/lib/libcrypto/des/sk.h b/src/lib/libcrypto/des/sk.h index f2ade88c7c..e69de29bb2 100644 --- a/src/lib/libcrypto/des/sk.h +++ b/src/lib/libcrypto/des/sk.h @@ -1,204 +0,0 @@ -/* crypto/des/sk.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -static const DES_LONG des_skb[8][64]={ -{ -/* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ -0x00000000L,0x00000010L,0x20000000L,0x20000010L, -0x00010000L,0x00010010L,0x20010000L,0x20010010L, -0x00000800L,0x00000810L,0x20000800L,0x20000810L, -0x00010800L,0x00010810L,0x20010800L,0x20010810L, -0x00000020L,0x00000030L,0x20000020L,0x20000030L, -0x00010020L,0x00010030L,0x20010020L,0x20010030L, -0x00000820L,0x00000830L,0x20000820L,0x20000830L, -0x00010820L,0x00010830L,0x20010820L,0x20010830L, -0x00080000L,0x00080010L,0x20080000L,0x20080010L, -0x00090000L,0x00090010L,0x20090000L,0x20090010L, -0x00080800L,0x00080810L,0x20080800L,0x20080810L, -0x00090800L,0x00090810L,0x20090800L,0x20090810L, -0x00080020L,0x00080030L,0x20080020L,0x20080030L, -0x00090020L,0x00090030L,0x20090020L,0x20090030L, -0x00080820L,0x00080830L,0x20080820L,0x20080830L, -0x00090820L,0x00090830L,0x20090820L,0x20090830L, -},{ -/* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ -0x00000000L,0x02000000L,0x00002000L,0x02002000L, -0x00200000L,0x02200000L,0x00202000L,0x02202000L, -0x00000004L,0x02000004L,0x00002004L,0x02002004L, -0x00200004L,0x02200004L,0x00202004L,0x02202004L, -0x00000400L,0x02000400L,0x00002400L,0x02002400L, -0x00200400L,0x02200400L,0x00202400L,0x02202400L, -0x00000404L,0x02000404L,0x00002404L,0x02002404L, -0x00200404L,0x02200404L,0x00202404L,0x02202404L, -0x10000000L,0x12000000L,0x10002000L,0x12002000L, -0x10200000L,0x12200000L,0x10202000L,0x12202000L, -0x10000004L,0x12000004L,0x10002004L,0x12002004L, -0x10200004L,0x12200004L,0x10202004L,0x12202004L, -0x10000400L,0x12000400L,0x10002400L,0x12002400L, -0x10200400L,0x12200400L,0x10202400L,0x12202400L, -0x10000404L,0x12000404L,0x10002404L,0x12002404L, -0x10200404L,0x12200404L,0x10202404L,0x12202404L, -},{ -/* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ -0x00000000L,0x00000001L,0x00040000L,0x00040001L, -0x01000000L,0x01000001L,0x01040000L,0x01040001L, -0x00000002L,0x00000003L,0x00040002L,0x00040003L, -0x01000002L,0x01000003L,0x01040002L,0x01040003L, -0x00000200L,0x00000201L,0x00040200L,0x00040201L, -0x01000200L,0x01000201L,0x01040200L,0x01040201L, -0x00000202L,0x00000203L,0x00040202L,0x00040203L, -0x01000202L,0x01000203L,0x01040202L,0x01040203L, -0x08000000L,0x08000001L,0x08040000L,0x08040001L, -0x09000000L,0x09000001L,0x09040000L,0x09040001L, -0x08000002L,0x08000003L,0x08040002L,0x08040003L, -0x09000002L,0x09000003L,0x09040002L,0x09040003L, -0x08000200L,0x08000201L,0x08040200L,0x08040201L, -0x09000200L,0x09000201L,0x09040200L,0x09040201L, -0x08000202L,0x08000203L,0x08040202L,0x08040203L, -0x09000202L,0x09000203L,0x09040202L,0x09040203L, -},{ -/* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ -0x00000000L,0x00100000L,0x00000100L,0x00100100L, -0x00000008L,0x00100008L,0x00000108L,0x00100108L, -0x00001000L,0x00101000L,0x00001100L,0x00101100L, -0x00001008L,0x00101008L,0x00001108L,0x00101108L, -0x04000000L,0x04100000L,0x04000100L,0x04100100L, -0x04000008L,0x04100008L,0x04000108L,0x04100108L, -0x04001000L,0x04101000L,0x04001100L,0x04101100L, -0x04001008L,0x04101008L,0x04001108L,0x04101108L, -0x00020000L,0x00120000L,0x00020100L,0x00120100L, -0x00020008L,0x00120008L,0x00020108L,0x00120108L, -0x00021000L,0x00121000L,0x00021100L,0x00121100L, -0x00021008L,0x00121008L,0x00021108L,0x00121108L, -0x04020000L,0x04120000L,0x04020100L,0x04120100L, -0x04020008L,0x04120008L,0x04020108L,0x04120108L, -0x04021000L,0x04121000L,0x04021100L,0x04121100L, -0x04021008L,0x04121008L,0x04021108L,0x04121108L, -},{ -/* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ -0x00000000L,0x10000000L,0x00010000L,0x10010000L, -0x00000004L,0x10000004L,0x00010004L,0x10010004L, -0x20000000L,0x30000000L,0x20010000L,0x30010000L, -0x20000004L,0x30000004L,0x20010004L,0x30010004L, -0x00100000L,0x10100000L,0x00110000L,0x10110000L, -0x00100004L,0x10100004L,0x00110004L,0x10110004L, -0x20100000L,0x30100000L,0x20110000L,0x30110000L, -0x20100004L,0x30100004L,0x20110004L,0x30110004L, -0x00001000L,0x10001000L,0x00011000L,0x10011000L, -0x00001004L,0x10001004L,0x00011004L,0x10011004L, -0x20001000L,0x30001000L,0x20011000L,0x30011000L, -0x20001004L,0x30001004L,0x20011004L,0x30011004L, -0x00101000L,0x10101000L,0x00111000L,0x10111000L, -0x00101004L,0x10101004L,0x00111004L,0x10111004L, -0x20101000L,0x30101000L,0x20111000L,0x30111000L, -0x20101004L,0x30101004L,0x20111004L,0x30111004L, -},{ -/* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ -0x00000000L,0x08000000L,0x00000008L,0x08000008L, -0x00000400L,0x08000400L,0x00000408L,0x08000408L, -0x00020000L,0x08020000L,0x00020008L,0x08020008L, -0x00020400L,0x08020400L,0x00020408L,0x08020408L, -0x00000001L,0x08000001L,0x00000009L,0x08000009L, -0x00000401L,0x08000401L,0x00000409L,0x08000409L, -0x00020001L,0x08020001L,0x00020009L,0x08020009L, -0x00020401L,0x08020401L,0x00020409L,0x08020409L, -0x02000000L,0x0A000000L,0x02000008L,0x0A000008L, -0x02000400L,0x0A000400L,0x02000408L,0x0A000408L, -0x02020000L,0x0A020000L,0x02020008L,0x0A020008L, -0x02020400L,0x0A020400L,0x02020408L,0x0A020408L, -0x02000001L,0x0A000001L,0x02000009L,0x0A000009L, -0x02000401L,0x0A000401L,0x02000409L,0x0A000409L, -0x02020001L,0x0A020001L,0x02020009L,0x0A020009L, -0x02020401L,0x0A020401L,0x02020409L,0x0A020409L, -},{ -/* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ -0x00000000L,0x00000100L,0x00080000L,0x00080100L, -0x01000000L,0x01000100L,0x01080000L,0x01080100L, -0x00000010L,0x00000110L,0x00080010L,0x00080110L, -0x01000010L,0x01000110L,0x01080010L,0x01080110L, -0x00200000L,0x00200100L,0x00280000L,0x00280100L, -0x01200000L,0x01200100L,0x01280000L,0x01280100L, -0x00200010L,0x00200110L,0x00280010L,0x00280110L, -0x01200010L,0x01200110L,0x01280010L,0x01280110L, -0x00000200L,0x00000300L,0x00080200L,0x00080300L, -0x01000200L,0x01000300L,0x01080200L,0x01080300L, -0x00000210L,0x00000310L,0x00080210L,0x00080310L, -0x01000210L,0x01000310L,0x01080210L,0x01080310L, -0x00200200L,0x00200300L,0x00280200L,0x00280300L, -0x01200200L,0x01200300L,0x01280200L,0x01280300L, -0x00200210L,0x00200310L,0x00280210L,0x00280310L, -0x01200210L,0x01200310L,0x01280210L,0x01280310L, -},{ -/* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ -0x00000000L,0x04000000L,0x00040000L,0x04040000L, -0x00000002L,0x04000002L,0x00040002L,0x04040002L, -0x00002000L,0x04002000L,0x00042000L,0x04042000L, -0x00002002L,0x04002002L,0x00042002L,0x04042002L, -0x00000020L,0x04000020L,0x00040020L,0x04040020L, -0x00000022L,0x04000022L,0x00040022L,0x04040022L, -0x00002020L,0x04002020L,0x00042020L,0x04042020L, -0x00002022L,0x04002022L,0x00042022L,0x04042022L, -0x00000800L,0x04000800L,0x00040800L,0x04040800L, -0x00000802L,0x04000802L,0x00040802L,0x04040802L, -0x00002800L,0x04002800L,0x00042800L,0x04042800L, -0x00002802L,0x04002802L,0x00042802L,0x04042802L, -0x00000820L,0x04000820L,0x00040820L,0x04040820L, -0x00000822L,0x04000822L,0x00040822L,0x04040822L, -0x00002820L,0x04002820L,0x00042820L,0x04042820L, -0x00002822L,0x04002822L,0x00042822L,0x04042822L, -}}; diff --git a/src/lib/libcrypto/des/testdes.pl b/src/lib/libcrypto/des/testdes.pl index 01a165a963..e69de29bb2 100644 --- a/src/lib/libcrypto/des/testdes.pl +++ b/src/lib/libcrypto/des/testdes.pl @@ -1,167 +0,0 @@ -#!/usr/local/bin/perl - -# des.pl tesing code - -require 'des.pl'; - -$num_tests=34; -@key_data=( - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, - 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, - 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10, - 0x7C,0xA1,0x10,0x45,0x4A,0x1A,0x6E,0x57, - 0x01,0x31,0xD9,0x61,0x9D,0xC1,0x37,0x6E, - 0x07,0xA1,0x13,0x3E,0x4A,0x0B,0x26,0x86, - 0x38,0x49,0x67,0x4C,0x26,0x02,0x31,0x9E, - 0x04,0xB9,0x15,0xBA,0x43,0xFE,0xB5,0xB6, - 0x01,0x13,0xB9,0x70,0xFD,0x34,0xF2,0xCE, - 0x01,0x70,0xF1,0x75,0x46,0x8F,0xB5,0xE6, - 0x43,0x29,0x7F,0xAD,0x38,0xE3,0x73,0xFE, - 0x07,0xA7,0x13,0x70,0x45,0xDA,0x2A,0x16, - 0x04,0x68,0x91,0x04,0xC2,0xFD,0x3B,0x2F, - 0x37,0xD0,0x6B,0xB5,0x16,0xCB,0x75,0x46, - 0x1F,0x08,0x26,0x0D,0x1A,0xC2,0x46,0x5E, - 0x58,0x40,0x23,0x64,0x1A,0xBA,0x61,0x76, - 0x02,0x58,0x16,0x16,0x46,0x29,0xB0,0x07, - 0x49,0x79,0x3E,0xBC,0x79,0xB3,0x25,0x8F, - 0x4F,0xB0,0x5E,0x15,0x15,0xAB,0x73,0xA7, - 0x49,0xE9,0x5D,0x6D,0x4C,0xA2,0x29,0xBF, - 0x01,0x83,0x10,0xDC,0x40,0x9B,0x26,0xD6, - 0x1C,0x58,0x7F,0x1C,0x13,0x92,0x4F,0xEF, - 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, - 0x1F,0x1F,0x1F,0x1F,0x0E,0x0E,0x0E,0x0E, - 0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, - 0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10, - ); - -@plain_data=( - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x01, - 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, - 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, - 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, - 0x01,0xA1,0xD6,0xD0,0x39,0x77,0x67,0x42, - 0x5C,0xD5,0x4C,0xA8,0x3D,0xEF,0x57,0xDA, - 0x02,0x48,0xD4,0x38,0x06,0xF6,0x71,0x72, - 0x51,0x45,0x4B,0x58,0x2D,0xDF,0x44,0x0A, - 0x42,0xFD,0x44,0x30,0x59,0x57,0x7F,0xA2, - 0x05,0x9B,0x5E,0x08,0x51,0xCF,0x14,0x3A, - 0x07,0x56,0xD8,0xE0,0x77,0x47,0x61,0xD2, - 0x76,0x25,0x14,0xB8,0x29,0xBF,0x48,0x6A, - 0x3B,0xDD,0x11,0x90,0x49,0x37,0x28,0x02, - 0x26,0x95,0x5F,0x68,0x35,0xAF,0x60,0x9A, - 0x16,0x4D,0x5E,0x40,0x4F,0x27,0x52,0x32, - 0x6B,0x05,0x6E,0x18,0x75,0x9F,0x5C,0xCA, - 0x00,0x4B,0xD6,0xEF,0x09,0x17,0x60,0x62, - 0x48,0x0D,0x39,0x00,0x6E,0xE7,0x62,0xF2, - 0x43,0x75,0x40,0xC8,0x69,0x8F,0x3C,0xFA, - 0x07,0x2D,0x43,0xA0,0x77,0x07,0x52,0x92, - 0x02,0xFE,0x55,0x77,0x81,0x17,0xF1,0x2A, - 0x1D,0x9D,0x5C,0x50,0x18,0xF7,0x28,0xC2, - 0x30,0x55,0x32,0x28,0x6D,0x6F,0x29,0x5A, - 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, - 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, - 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF); - -@cipher_data=( - 0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7, - 0x73,0x59,0xB2,0x16,0x3E,0x4E,0xDC,0x58, - 0x95,0x8E,0x6E,0x62,0x7A,0x05,0x55,0x7B, - 0xF4,0x03,0x79,0xAB,0x9E,0x0E,0xC5,0x33, - 0x17,0x66,0x8D,0xFC,0x72,0x92,0x53,0x2D, - 0x8A,0x5A,0xE1,0xF8,0x1A,0xB8,0xF2,0xDD, - 0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7, - 0xED,0x39,0xD9,0x50,0xFA,0x74,0xBC,0xC4, - 0x69,0x0F,0x5B,0x0D,0x9A,0x26,0x93,0x9B, - 0x7A,0x38,0x9D,0x10,0x35,0x4B,0xD2,0x71, - 0x86,0x8E,0xBB,0x51,0xCA,0xB4,0x59,0x9A, - 0x71,0x78,0x87,0x6E,0x01,0xF1,0x9B,0x2A, - 0xAF,0x37,0xFB,0x42,0x1F,0x8C,0x40,0x95, - 0x86,0xA5,0x60,0xF1,0x0E,0xC6,0xD8,0x5B, - 0x0C,0xD3,0xDA,0x02,0x00,0x21,0xDC,0x09, - 0xEA,0x67,0x6B,0x2C,0xB7,0xDB,0x2B,0x7A, - 0xDF,0xD6,0x4A,0x81,0x5C,0xAF,0x1A,0x0F, - 0x5C,0x51,0x3C,0x9C,0x48,0x86,0xC0,0x88, - 0x0A,0x2A,0xEE,0xAE,0x3F,0xF4,0xAB,0x77, - 0xEF,0x1B,0xF0,0x3E,0x5D,0xFA,0x57,0x5A, - 0x88,0xBF,0x0D,0xB6,0xD7,0x0D,0xEE,0x56, - 0xA1,0xF9,0x91,0x55,0x41,0x02,0x0B,0x56, - 0x6F,0xBF,0x1C,0xAF,0xCF,0xFD,0x05,0x56, - 0x2F,0x22,0xE4,0x9B,0xAB,0x7C,0xA1,0xAC, - 0x5A,0x6B,0x61,0x2C,0xC2,0x6C,0xCE,0x4A, - 0x5F,0x4C,0x03,0x8E,0xD1,0x2B,0x2E,0x41, - 0x63,0xFA,0xC0,0xD0,0x34,0xD9,0xF7,0x93, - 0x61,0x7B,0x3A,0x0C,0xE8,0xF0,0x71,0x00, - 0xDB,0x95,0x86,0x05,0xF8,0xC8,0xC6,0x06, - 0xED,0xBF,0xD1,0xC6,0x6C,0x29,0xCC,0xC7, - 0x35,0x55,0x50,0xB2,0x15,0x0E,0x24,0x51, - 0xCA,0xAA,0xAF,0x4D,0xEA,0xF1,0xDB,0xAE, - 0xD5,0xD4,0x4F,0xF7,0x20,0x68,0x3D,0x0D, - 0x2A,0x2B,0xB0,0x08,0xDF,0x97,0xC2,0xF2); - -print "Doing ecb tests\n"; -for ($i=0; $i<$num_tests; $i++) - { - printf "Doing test $i\n"; - $key =pack("C8",splice(@key_data ,0,8)); - $data=pack("C8",splice(@plain_data ,0,8)); - $res =pack("C8",splice(@cipher_data,0,8)); - - @ks= &des_set_key($key); - $out1= &des_ecb_encrypt(*ks,1,$data); - $out2= &des_ecb_encrypt(*ks,0,$out1); - $out3= &des_ecb_encrypt(*ks,0,$res); - &eprint("encryption failure",$res,$out1) - if ($out1 ne $res); - &eprint("encryption/decryption failure",$data,$out2) - if ($out2 ne $data); - &eprint("decryption failure",$data,$out3) - if ($data ne $out3); - } -print "Done\n"; - -print "doing speed test over 30 seconds\n"; -$SIG{'ALRM'}='done'; -sub done {$done=1;} -$done=0; - -$count=0; -$d=pack("C8",0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef); -@ks= &des_set_key($d); -alarm(30); -$start=(times)[0]; -while (!$done) - { - $count++; - $d=&des_ecb_encrypt(*ks,1,$d); - } -$end=(times)[0]; -$t=$end-$start; -printf "$count DESs in %.2f seconds is %.2f DESs/sec or %.2f bytes/sec\n", - 1.0*$t,1.0*$count/$t,$count*8.0/$t; - -sub eprint - { - local($s,$c,$e)=@_; - local(@k); - - @k=unpack("C8",$c); - printf "%02x%02x%02x%02x %02x%02x%02x%02x - ",unpack("C8",$c); - printf "%02x%02x%02x%02x %02x%02x%02x%02x :",unpack("C8",$e); - print " $s\n"; - } diff --git a/src/lib/libcrypto/dh/dh_err.c b/src/lib/libcrypto/dh/dh_err.c index 0348bd24a2..ff2d1684c2 100644 --- a/src/lib/libcrypto/dh/dh_err.c +++ b/src/lib/libcrypto/dh/dh_err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/doc/DH_set_method.pod b/src/lib/libcrypto/doc/DH_set_method.pod index dca41d8dbc..a8f75bdd9d 100644 --- a/src/lib/libcrypto/doc/DH_set_method.pod +++ b/src/lib/libcrypto/doc/DH_set_method.pod @@ -56,7 +56,7 @@ the default method is used. /* compute shared secret */ int (*compute_key)(unsigned char *key, BIGNUM *pub_key, DH *dh); - /* compute r = a ^ p mod m. May be NULL */ + /* compute r = a ^ p mod m (May be NULL for some implementations) */ int (*bn_mod_exp)(DH *dh, BIGNUM *r, BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); diff --git a/src/lib/libcrypto/doc/DSA_set_method.pod b/src/lib/libcrypto/doc/DSA_set_method.pod index 0b13ec9237..edec46413d 100644 --- a/src/lib/libcrypto/doc/DSA_set_method.pod +++ b/src/lib/libcrypto/doc/DSA_set_method.pod @@ -62,12 +62,13 @@ struct int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, DSA *dsa); - /* compute rr = a1^p1 * a2^p2 mod m. May be NULL */ + /* compute rr = a1^p1 * a2^p2 mod m (May be NULL for some + implementations) */ int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont); - /* compute r = a ^ p mod m. May be NULL */ + /* compute r = a ^ p mod m (May be NULL for some implementations) */ int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); diff --git a/src/lib/libcrypto/doc/EVP_OpenInit.pod b/src/lib/libcrypto/doc/EVP_OpenInit.pod new file mode 100644 index 0000000000..9707a4b399 --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_OpenInit.pod @@ -0,0 +1,51 @@ +=pod + +=head1 NAME + +EVP_OpenInit, EVP_OpenUpdate, EVP_OpenFinal - EVP envelope decryption + +=head1 SYNOPSIS + + #include + + int EVP_OpenInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type,unsigned char *ek, + int ekl,unsigned char *iv,EVP_PKEY *priv); + void EVP_OpenUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, unsigned char *in, int inl); + void EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl); + +=head1 DESCRIPTION + +The EVP envelope routines are a high level interface to envelope +decryption. They decrypt a public key encrypted symmetric key and +then decrypt data using it. + +EVP_OpenInit() initialises a cipher context B for decryption +with cipher B. It decrypts the encrypted symmetric key of length +B bytes passed in the B parameter using the private key B. +The IV is supplied in the B parameter. + +EVP_OpenUpdate() and EVP_OpenFinal() have exactly the same properties +as the EVP_DecryptUpdate() and EVP_DecryptFinal() routines, as +documented on the L manual +page. + +=head1 RETURN VALUES + +EVP_OpenInit() returns -1 on error or an non zero integer (actually the +recovered secret key size) if successful. + +EVP_SealUpdate() does not return a value. + +EVP_SealFinal() returns 0 if the decrypt failed or 1 for success. + +=head1 SEE ALSO + +L,L +L, +L + +=head1 HISTORY + +=cut diff --git a/src/lib/libcrypto/doc/EVP_SealInit.pod b/src/lib/libcrypto/doc/EVP_SealInit.pod new file mode 100644 index 0000000000..1579d110fa --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_SealInit.pod @@ -0,0 +1,70 @@ +=pod + +=head1 NAME + +EVP_SealInit, EVP_SealUpdate, EVP_SealFinal - EVP envelope encryption + +=head1 SYNOPSIS + + #include + + int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek, + int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk); + void EVP_SealUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, unsigned char *in, int inl); + void EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl); + +=head1 DESCRIPTION + +The EVP envelope routines are a high level interface to envelope +encryption. They generate a random key and then "envelope" it by +using public key encryption. Data can then be encrypted using this +key. + +EVP_SealInit() initialises a cipher context B for encryption +with cipher B using a random secret key and IV supplied in +the B parameter. B is normally supplied by a function such +as EVP_des_cbc(). The secret key is encrypted using one or more public +keys, this allows the same encrypted data to be decrypted using any +of the corresponding private keys. B is an array of buffers where +the public key encrypted secret key will be written, each buffer must +contain enough room for the corresponding encrypted key: that is +B must have room for B bytes. The actual +size of each encrypted secret key is written to the array B. B is +an array of B public keys. + +EVP_SealUpdate() and EVP_SealFinal() have exactly the same properties +as the EVP_EncryptUpdate() and EVP_EncryptFinal() routines, as +documented on the L manual +page. + +=head1 RETURN VALUES + +EVP_SealInit() returns -1 on error or B if successful. + +EVP_SealUpdate() and EVP_SealFinal() do not return values. + +=head1 NOTES + +Because a random secret key is generated the random number generator +must be seeded before calling EVP_SealInit(). + +The public key must be RSA because it is the only OpenSSL public key +algorithm that supports key transport. + +Envelope encryption is the usual method of using public key encryption +on large amounts of data, this is because public key encryption is slow +but symmetric encryption is fast. So symmetric encryption is used for +bulk encryption and the small random symmetric key used is transferred +using public key encryption. + +=head1 SEE ALSO + +L,L +L, +L + +=head1 HISTORY + +=cut diff --git a/src/lib/libcrypto/doc/EVP_SignInit.pod b/src/lib/libcrypto/doc/EVP_SignInit.pod new file mode 100644 index 0000000000..bbc9203c9c --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_SignInit.pod @@ -0,0 +1,85 @@ +=pod + +=head1 NAME + +EVP_SignInit, EVP_SignUpdate, EVP_SignFinal - EVP signing functions + +=head1 SYNOPSIS + + #include + + void EVP_SignInit(EVP_MD_CTX *ctx, const EVP_MD *type); + void EVP_SignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); + int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *sig,unsigned int *s, EVP_PKEY *pkey); + + int EVP_PKEY_size(EVP_PKEY *pkey); + +=head1 DESCRIPTION + +The EVP signature routines are a high level interface to digital +signatures. + +EVP_SignInit() initialises a signing context B to using digest +B: this will typically be supplied by a function such as +EVP_sha1(). + +EVP_SignUpdate() hashes B bytes of data at B into the +signature context B. This funtion can be called several times on the +same B to include additional data. + +EVP_SignFinal() signs the data in B using the private key B +and places the signature in B. If the B parameter is not NULL +then the number of bytes of data written (i.e. the length of the signature) +will be written to the integer at B, at most EVP_PKEY_size(pkey) bytes +will be written. After calling EVP_SignFinal() no additional calls to +EVP_SignUpdate() can be made, but EVP_SignInit() can be called to initialiase +a new signature operation. + +EVP_PKEY_size() returns the maximum size of a signature in bytes. The actual +signature returned by EVP_SignFinal() may be smaller. + +=head1 RETURN VALUES + +EVP_SignInit() and EVP_SignUpdate() do not return values. + +EVP_SignFinal() returns 1 for success and 0 for failure. + +EVP_PKEY_size() returns the maximum size of a signature in bytes. + +The error codes can be obtained by L. + +=head1 NOTES + +The B interface to digital signatures should almost always be used in +preference to the low level interfaces. This is because the code then becomes +transparent to the algorithm used and much more flexible. + +Due to the link between message digests and public key algorithms the correct +digest algorithm must be used with the correct public key type. A list of +algorithms and associated public key algorithms appears in +L. + +When signing with DSA private keys the random number generator must be seeded +or the operation will fail. The random number generator does not need to be +seeded for RSA signatures. + +=head1 BUGS + +Several of the functions do not return values: maybe they should. Although the +internal digest operations will never fail some future hardware based operations +might. + +=head1 SEE ALSO + +L, +L, L, +L, L, L, +L, L, L, +L, L + +=head1 HISTORY + +EVP_SignInit(), EVP_SignUpdate() and EVP_SignFinal() are +available in all versions of SSLeay and OpenSSL. + +=cut diff --git a/src/lib/libcrypto/doc/EVP_VerifyInit.pod b/src/lib/libcrypto/doc/EVP_VerifyInit.pod new file mode 100644 index 0000000000..3b5e07f4ad --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_VerifyInit.pod @@ -0,0 +1,71 @@ +=pod + +=head1 NAME + +EVP_VerifyInit, EVP_VerifyUpdate, EVP_VerifyFinal - EVP signature verification functions + +=head1 SYNOPSIS + + #include + + void EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type); + void EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); + int EVP_VerifyFinal(EVP_MD_CTX *ctx,unsigned char *sigbuf, unsigned int siglen,EVP_PKEY *pkey); + +=head1 DESCRIPTION + +The EVP signature verification routines are a high level interface to digital +signatures. + +EVP_VerifyInit() initialises a verification context B to using digest +B: this will typically be supplied by a function such as EVP_sha1(). + +EVP_VerifyUpdate() hashes B bytes of data at B into the +verification context B. This funtion can be called several times on the +same B to include additional data. + +EVP_VerifyFinal() verifies the data in B using the public key B +and against the B bytes at B. After calling EVP_VerifyFinal() +no additional calls to EVP_VerifyUpdate() can be made, but EVP_VerifyInit() +can be called to initialiase a new verification operation. + +=head1 RETURN VALUES + +EVP_VerifyInit() and EVP_VerifyUpdate() do not return values. + +EVP_VerifyFinal() returns 1 for a correct signature, 0 for failure and -1 if some +other error occurred. + +The error codes can be obtained by L. + +=head1 NOTES + +The B interface to digital signatures should almost always be used in +preference to the low level interfaces. This is because the code then becomes +transparent to the algorithm used and much more flexible. + +Due to the link between message digests and public key algorithms the correct +digest algorithm must be used with the correct public key type. A list of +algorithms and associated public key algorithms appears in +L. + +=head1 BUGS + +Several of the functions do not return values: maybe they should. Although the +internal digest operations will never fail some future hardware based operations +might. + +=head1 SEE ALSO + +L, +L, L, +L, L, L, +L, L, L, +L, L + +=head1 HISTORY + +EVP_VerifyInit(), EVP_VerifyUpdate() and EVP_VerifyFinal() are +available in all versions of SSLeay and OpenSSL. + +=cut diff --git a/src/lib/libcrypto/doc/RAND_add.pod b/src/lib/libcrypto/doc/RAND_add.pod index 0a13ec2a92..67c66f3e0c 100644 --- a/src/lib/libcrypto/doc/RAND_add.pod +++ b/src/lib/libcrypto/doc/RAND_add.pod @@ -2,7 +2,8 @@ =head1 NAME -RAND_add, RAND_seed, RAND_screen - add entropy to the PRNG +RAND_add, RAND_seed, RAND_status, RAND_event, RAND_screen - add +entropy to the PRNG =head1 SYNOPSIS @@ -14,6 +15,7 @@ RAND_add, RAND_seed, RAND_screen - add entropy to the PRNG int RAND_status(void); + int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam); void RAND_screen(void); =head1 DESCRIPTION @@ -40,17 +42,24 @@ or L. RAND_seed() is equivalent to RAND_add() when B. +RAND_event() collects the entropy from Windows events such as mouse +movements and other user interaction. It should be called with the +B, B and B arguments of I messages sent to +the window procedure. It will estimate the entropy contained in the +event message (if any), and add it to the PRNG. The program can then +process the messages as usual. + The RAND_screen() function is available for the convenience of Windows programmers. It adds the current contents of the screen to the PRNG. -For applications that can catch Windows events, seeding the PRNG with -the parameters of B events is a significantly better -source of randomness. It should be noted that both methods cannot be -used on servers that run without user interaction. +For applications that can catch Windows events, seeding the PRNG by +calling RAND_event() is a significantly better source of +randomness. It should be noted that both methods cannot be used on +servers that run without user interaction. =head1 RETURN VALUES -RAND_status() returns 1 if the PRNG has been seeded with enough data, -0 otherwise. +RAND_status() and RAND_event() return 1 if the PRNG has been seeded +with enough data, 0 otherwise. The other functions do not return values. @@ -63,6 +72,6 @@ L, L RAND_seed() and RAND_screen() are available in all versions of SSLeay and OpenSSL. RAND_add() and RAND_status() have been added in OpenSSL -0.9.5. +0.9.5, RAND_event() in OpenSSL 0.9.5a. =cut diff --git a/src/lib/libcrypto/doc/RAND_set_rand_method.pod b/src/lib/libcrypto/doc/RAND_set_rand_method.pod index 466e9b8767..464eba416d 100644 --- a/src/lib/libcrypto/doc/RAND_set_rand_method.pod +++ b/src/lib/libcrypto/doc/RAND_set_rand_method.pod @@ -34,10 +34,12 @@ RAND_get_rand_method() returns a pointer to the current method. void (*cleanup)(void); void (*add)(const void *buf, int num, int entropy); int (*pseudorand)(unsigned char *buf, int num); + int (*status)(void); } RAND_METHOD; The components point to the implementation of RAND_seed(), -RAND_bytes(), RAND_cleanup(), RAND_add() and RAND_pseudo_rand(). +RAND_bytes(), RAND_cleanup(), RAND_add(), RAND_pseudo_rand() +and RAND_status(). Each component may be NULL if the function is not implemented. =head1 RETURN VALUES diff --git a/src/lib/libcrypto/doc/RSA_set_method.pod b/src/lib/libcrypto/doc/RSA_set_method.pod index deb1183a23..14b0b4cf35 100644 --- a/src/lib/libcrypto/doc/RSA_set_method.pod +++ b/src/lib/libcrypto/doc/RSA_set_method.pod @@ -87,10 +87,11 @@ the default method is used. int (*rsa_priv_dec)(int flen, unsigned char *from, unsigned char *to, RSA *rsa, int padding); - /* compute r0 = r0 ^ I mod rsa->n. May be NULL */ + /* compute r0 = r0 ^ I mod rsa->n (May be NULL for some + implementations) */ int (*rsa_mod_exp)(BIGNUM *r0, BIGNUM *I, RSA *rsa); - /* compute r = a ^ p mod m. May be NULL */ + /* compute r = a ^ p mod m (May be NULL for some implementations) */ int (*bn_mod_exp)(BIGNUM *r, BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); diff --git a/src/lib/libcrypto/doc/rsa.pod b/src/lib/libcrypto/doc/rsa.pod index 0486c044a6..eb8ba612c4 100644 --- a/src/lib/libcrypto/doc/rsa.pod +++ b/src/lib/libcrypto/doc/rsa.pod @@ -86,8 +86,9 @@ contain public as well as private RSA keys: In public keys, the private exponent and the related secret values are B. -B, B and B may be B in private keys, but the -RSA operations are much faster when these values are available. +B

, B, B, B and B may be B in private +keys, but the RSA operations are much faster when these values are +available. =head1 CONFORMING TO diff --git a/src/lib/libcrypto/dsa/dsa_err.c b/src/lib/libcrypto/dsa/dsa_err.c index 38e4af968c..2b3ab3a9ad 100644 --- a/src/lib/libcrypto/dsa/dsa_err.c +++ b/src/lib/libcrypto/dsa/dsa_err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/dsa/dsa_key.c b/src/lib/libcrypto/dsa/dsa_key.c index ab7f38fc7c..5aef2d5fcf 100644 --- a/src/lib/libcrypto/dsa/dsa_key.c +++ b/src/lib/libcrypto/dsa/dsa_key.c @@ -84,7 +84,8 @@ int DSA_generate_key(DSA *dsa) i=BN_num_bits(dsa->q); for (;;) { - BN_rand(priv_key,i,1,0); + if (!BN_rand(priv_key,i,1,0)) + goto err; if (BN_cmp(priv_key,dsa->q) >= 0) BN_sub(priv_key,priv_key,dsa->q); if (!BN_is_zero(priv_key)) break; diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c index 93c64cbc4f..eb8c76aa0b 100644 --- a/src/lib/libcrypto/err/err.c +++ b/src/lib/libcrypto/err/err.c @@ -55,9 +55,63 @@ * copied and put under another distribution licence * [including the GNU Public Licence.] */ +/* ==================================================================== + * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ #include #include +#include #include #include #include "cryptlib.h" @@ -154,6 +208,54 @@ static ERR_STRING_DATA ERR_str_reasons[]= {0,NULL}, }; + + +#define NUM_SYS_STR_REASONS 127 +#define LEN_SYS_STR_REASON 32 + +static ERR_STRING_DATA SYS_str_reasons[NUM_SYS_STR_REASONS + 1]; +/* SYS_str_reasons is filled with copies of strerror() results at + * initialization. + * 'errno' values up to 127 should cover all usual errors, + * others will be displayed numerically by ERR_error_string. + * It is crucial that we have something for each reason code + * that occurs in ERR_str_reasons, or bogus reason strings + * will be returned for SYSerr(), which always gets an errno + * value and never one of those 'standard' reason codes. */ + +static void build_SYS_str_reasons() + { + /* Malloc cannot be used here, use static storage instead */ + static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON]; + int i; + + CRYPTO_w_lock(CRYPTO_LOCK_ERR_HASH); + + for (i = 1; i <= NUM_SYS_STR_REASONS; i++) + { + ERR_STRING_DATA *str = &SYS_str_reasons[i - 1]; + + str->error = (unsigned long)i; + if (str->string == NULL) + { + char (*dest)[LEN_SYS_STR_REASON] = &(strerror_tab[i - 1]); + char *src = strerror(i); + if (src != NULL) + { + strncpy(*dest, src, sizeof *dest); + (*dest)[sizeof *dest - 1] = '\0'; + str->string = *dest; + } + } + if (str->string == NULL) + str->string = "unknown"; + } + + /* Now we still have SYS_str_reasons[NUM_SYS_STR_REASONS] = {0, NULL}, + * as required by ERR_load_strings. */ + + CRYPTO_w_unlock(CRYPTO_LOCK_ERR_HASH); + } #endif #define err_clear_data(p,i) \ @@ -191,14 +293,16 @@ void ERR_load_ERR_strings(void) CRYPTO_w_unlock(CRYPTO_LOCK_ERR); return; } - init=0; CRYPTO_w_unlock(CRYPTO_LOCK_ERR); #ifndef NO_ERR ERR_load_strings(0,ERR_str_libraries); ERR_load_strings(0,ERR_str_reasons); ERR_load_strings(ERR_LIB_SYS,ERR_str_functs); + build_SYS_str_reasons(); + ERR_load_strings(ERR_LIB_SYS,SYS_str_reasons); #endif + init=0; } } diff --git a/src/lib/libcrypto/evp/evp_err.c b/src/lib/libcrypto/evp/evp_err.c index 97953a0fc1..fc149cbb1a 100644 --- a/src/lib/libcrypto/evp/evp_err.c +++ b/src/lib/libcrypto/evp/evp_err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/evp/evp_pkey.c b/src/lib/libcrypto/evp/evp_pkey.c index d5e6f5880f..4ab091fa56 100644 --- a/src/lib/libcrypto/evp/evp_pkey.c +++ b/src/lib/libcrypto/evp/evp_pkey.c @@ -133,7 +133,7 @@ EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8) * SEQUENCE {parameters, priv_key} * SEQUENCE {pub_key, priv_key} */ - + t1 = (ASN1_TYPE *)sk_value(ndsa, 0); t2 = (ASN1_TYPE *)sk_value(ndsa, 1); if(t1->type == V_ASN1_SEQUENCE) { @@ -152,7 +152,14 @@ EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8) goto dsaerr; } privkey = t2->value.integer; - } else if (!(privkey=d2i_ASN1_INTEGER (NULL, &p, pkeylen))) { + } else { + if (!(privkey=d2i_ASN1_INTEGER (NULL, &p, pkeylen))) { + EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); + goto dsaerr; + } + param = p8->pkeyalg->parameter; + } + if (!param || (param->type != V_ASN1_SEQUENCE)) { EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); goto dsaerr; } @@ -186,7 +193,8 @@ EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8) EVP_PKEY_assign_DSA(pkey, dsa); BN_CTX_free (ctx); - sk_pop_free(ndsa, ASN1_TYPE_free); + if(ndsa) sk_pop_free(ndsa, ASN1_TYPE_free); + else ASN1_INTEGER_free(privkey); break; dsaerr: BN_CTX_free (ctx); diff --git a/src/lib/libcrypto/evp/names.c b/src/lib/libcrypto/evp/names.c index 3e8f460328..620f43feaa 100644 --- a/src/lib/libcrypto/evp/names.c +++ b/src/lib/libcrypto/evp/names.c @@ -114,5 +114,10 @@ void EVP_cleanup(void) { OBJ_NAME_cleanup(OBJ_NAME_TYPE_CIPHER_METH); OBJ_NAME_cleanup(OBJ_NAME_TYPE_MD_METH); + /* The above calls will only clean out the contents of the name + hash table, but not the hash table itself. The following line + does that part. -- Richard Levitte */ + OBJ_NAME_cleanup(-1); + EVP_PBE_cleanup(); } diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c index 23b7c98f8f..e1ec79e093 100644 --- a/src/lib/libcrypto/hmac/hmac.c +++ b/src/lib/libcrypto/hmac/hmac.c @@ -88,9 +88,11 @@ void HMAC_Init(HMAC_CTX *ctx, const void *key, int len, else { memcpy(ctx->key,key,len); - memset(&(ctx->key[len]),0,sizeof(ctx->key)-len); ctx->key_length=len; } + if(ctx->key_length != HMAC_MAX_MD_CBLOCK) + memset(&ctx->key[ctx->key_length], 0, + HMAC_MAX_MD_CBLOCK - ctx->key_length); } if (reset) diff --git a/src/lib/libcrypto/lhash/lhash.c b/src/lib/libcrypto/lhash/lhash.c index 6a340a2403..7eb92a18bc 100644 --- a/src/lib/libcrypto/lhash/lhash.c +++ b/src/lib/libcrypto/lhash/lhash.c @@ -159,7 +159,7 @@ void lh_free(LHASH *lh) unsigned int i; LHASH_NODE *n,*nn; - if(lh == NULL) + if (lh == NULL) return; for (i=0; inum_nodes; i++) @@ -422,21 +422,6 @@ static LHASH_NODE **getrn(LHASH *lh, void *data, unsigned long *rhash) return(ret); } -/* -unsigned long lh_strhash(char *str) - { - int i,l; - unsigned long ret=0; - unsigned short *s; - - if (str == NULL) return(0); - l=(strlen(str)+1)/2; - s=(unsigned short *)str; - for (i=0; i>16)^ret); } +unsigned long lh_num_items(LHASH *lh) + { + return lh ? lh->num_items : 0; + } diff --git a/src/lib/libcrypto/lhash/lhash.h b/src/lib/libcrypto/lhash/lhash.h index 6f6eeb2698..d315fd9c6d 100644 --- a/src/lib/libcrypto/lhash/lhash.h +++ b/src/lib/libcrypto/lhash/lhash.h @@ -124,6 +124,7 @@ void *lh_retrieve(LHASH *lh, void *data); void lh_doall(LHASH *lh, void (*func)(/*void *b*/)); void lh_doall_arg(LHASH *lh, void (*func)(/*void *a,void *b*/),void *arg); unsigned long lh_strhash(const char *c); +unsigned long lh_num_items(LHASH *lh); #ifndef NO_FP_API void lh_stats(LHASH *lh, FILE *out); diff --git a/src/lib/libcrypto/md5/Makefile.ssl b/src/lib/libcrypto/md5/Makefile.ssl index d50f967be7..45fbd04239 100644 --- a/src/lib/libcrypto/md5/Makefile.ssl +++ b/src/lib/libcrypto/md5/Makefile.ssl @@ -55,7 +55,7 @@ lib: $(LIBOBJ) # elf asm/mx86-elf.o: asm/mx86unix.cpp - $(CPP) -DELF asm/mx86unix.cpp | as -o asm/mx86-elf.o + $(CPP) -DELF -x c asm/mx86unix.cpp | as -o asm/mx86-elf.o # solaris asm/mx86-sol.o: asm/mx86unix.cpp @@ -71,7 +71,7 @@ asm/mx86-out.o: asm/mx86unix.cpp asm/mx86bsdi.o: asm/mx86unix.cpp $(CPP) -DBSDI asm/mx86unix.cpp | sed 's/ :/:/' | as -o asm/mx86bsdi.o -asm/mx86unix.cpp: asm/md5-586.pl +asm/mx86unix.cpp: asm/md5-586.pl ../perlasm/x86asm.pl (cd asm; $(PERL) md5-586.pl cpp >mx86unix.cpp) asm/md5-sparcv8plus.o: asm/md5-sparcv9.S diff --git a/src/lib/libcrypto/md5/Makefile.uni b/src/lib/libcrypto/md5/Makefile.uni index d21c72f3ea..e69de29bb2 100644 --- a/src/lib/libcrypto/md5/Makefile.uni +++ b/src/lib/libcrypto/md5/Makefile.uni @@ -1,110 +0,0 @@ -# Targets -# make - twidle the options yourself :-) -# make cc - standard cc options -# make gcc - standard gcc options -# make x86-elf - linux-elf etc -# make x86-out - linux-a.out, FreeBSD etc -# make x86-solaris -# make x86-bdsi - -DIR= md5 -TOP= . -CC= gcc -CFLAG= -O3 -fomit-frame-pointer - -CPP= $(CC) -E -INCLUDES= -INSTALLTOP=/usr/local/lib -MAKE= make -MAKEDEPEND= makedepend -MAKEFILE= Makefile.uni -AR= ar r -RANLIB= ranlib - -MD5_ASM_OBJ= - -CFLAGS= $(INCLUDES) $(CFLAG) - -GENERAL=Makefile -TEST=md5test -APPS=md5 - -LIB=libmd5.a -LIBSRC=md5_dgst.c md5_one.c -LIBOBJ=md5_dgst.o md5_one.o $(MD5_ASM_OBJ) - -SRC= $(LIBSRC) - -EXHEADER= md5.h -HEADER= md5_locl.h $(EXHEADER) - -ALL= $(GENERAL) $(SRC) $(HEADER) - -all: $(LIB) $(TEST) $(APPS) - -$(LIB): $(LIBOBJ) - $(AR) $(LIB) $(LIBOBJ) - $(RANLIB) $(LIB) - -# elf -asm/mx86-elf.o: asm/mx86unix.cpp - $(CPP) -DELF asm/mx86unix.cpp | as -o asm/mx86-elf.o - -# solaris -asm/mx86-sol.o: asm/mx86unix.cpp - $(CC) -E -DSOL asm/mx86unix.cpp | sed 's/^#.*//' > asm/mx86-sol.s - as -o asm/mx86-sol.o asm/mx86-sol.s - rm -f asm/mx86-sol.s - -# a.out -asm/mx86-out.o: asm/mx86unix.cpp - $(CPP) -DOUT asm/mx86unix.cpp | as -o asm/mx86-out.o - -# bsdi -asm/mx86bsdi.o: asm/mx86unix.cpp - $(CPP) -DBSDI asm/mx86unix.cpp | as -o asm/mx86bsdi.o - -asm/mx86unix.cpp: - (cd asm; perl md5-586.pl cpp >mx86unix.cpp) - -test: $(TEST) - ./$(TEST) - -$(TEST): $(TEST).c $(LIB) - $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) - -$(APPS): $(APPS).c $(LIB) - $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) - -lint: - lint -DLINT $(INCLUDES) $(SRC)>fluff - -depend: - $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) - -dclean: - perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new - mv -f Makefile.new $(MAKEFILE) - -clean: - /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff - -cc: - $(MAKE) MD5_ASM_OBJ="" CC="cc" CFLAG="-O" all - -gcc: - $(MAKE) MD5_ASM_OBJ="" CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all - -x86-elf: - $(MAKE) MD5_ASM_OBJ="asm/mx86-elf.o" CFLAG="-DELF -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all - -x86-out: - $(MAKE) MD5_ASM_OBJ="asm/mx86-out.o" CFLAG="-DOUT -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all - -x86-solaris: - $(MAKE) MD5_ASM_OBJ="asm/mx86-sol.o" CFLAG="-DSOL -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all - -x86-bdsi: - $(MAKE) MD5_ASM_OBJ="asm/mx86-bdsi.o" CFLAG="-DBDSI -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/md5/asm/m5-win32.asm b/src/lib/libcrypto/md5/asm/m5-win32.asm index 51f5f17ca3..e69de29bb2 100644 --- a/src/lib/libcrypto/md5/asm/m5-win32.asm +++ b/src/lib/libcrypto/md5/asm/m5-win32.asm @@ -1,687 +0,0 @@ - ; Don't even think of reading this code - ; It was automatically generated by md5-586.pl - ; Which is a perl program used to generate the x86 assember for - ; any of elf, a.out, BSDI,Win32, or Solaris - ; eric - ; - TITLE md5-586.asm - .386 -.model FLAT -_TEXT SEGMENT -PUBLIC _md5_block_asm_host_order - -_md5_block_asm_host_order PROC NEAR - push esi - push edi - mov edi, DWORD PTR 12[esp] - mov esi, DWORD PTR 16[esp] - mov ecx, DWORD PTR 20[esp] - push ebp - shl ecx, 6 - push ebx - add ecx, esi - sub ecx, 64 - mov eax, DWORD PTR [edi] - push ecx - mov ebx, DWORD PTR 4[edi] - mov ecx, DWORD PTR 8[edi] - mov edx, DWORD PTR 12[edi] -L000start: - ; - ; R0 section - mov edi, ecx - mov ebp, DWORD PTR [esi] - ; R0 0 - xor edi, edx - and edi, ebx - lea eax, DWORD PTR 3614090360[ebp*1+eax] - xor edi, edx - add eax, edi - mov edi, ebx - rol eax, 7 - mov ebp, DWORD PTR 4[esi] - add eax, ebx - ; R0 1 - xor edi, ecx - and edi, eax - lea edx, DWORD PTR 3905402710[ebp*1+edx] - xor edi, ecx - add edx, edi - mov edi, eax - rol edx, 12 - mov ebp, DWORD PTR 8[esi] - add edx, eax - ; R0 2 - xor edi, ebx - and edi, edx - lea ecx, DWORD PTR 606105819[ebp*1+ecx] - xor edi, ebx - add ecx, edi - mov edi, edx - rol ecx, 17 - mov ebp, DWORD PTR 12[esi] - add ecx, edx - ; R0 3 - xor edi, eax - and edi, ecx - lea ebx, DWORD PTR 3250441966[ebp*1+ebx] - xor edi, eax - add ebx, edi - mov edi, ecx - rol ebx, 22 - mov ebp, DWORD PTR 16[esi] - add ebx, ecx - ; R0 4 - xor edi, edx - and edi, ebx - lea eax, DWORD PTR 4118548399[ebp*1+eax] - xor edi, edx - add eax, edi - mov edi, ebx - rol eax, 7 - mov ebp, DWORD PTR 20[esi] - add eax, ebx - ; R0 5 - xor edi, ecx - and edi, eax - lea edx, DWORD PTR 1200080426[ebp*1+edx] - xor edi, ecx - add edx, edi - mov edi, eax - rol edx, 12 - mov ebp, DWORD PTR 24[esi] - add edx, eax - ; R0 6 - xor edi, ebx - and edi, edx - lea ecx, DWORD PTR 2821735955[ebp*1+ecx] - xor edi, ebx - add ecx, edi - mov edi, edx - rol ecx, 17 - mov ebp, DWORD PTR 28[esi] - add ecx, edx - ; R0 7 - xor edi, eax - and edi, ecx - lea ebx, DWORD PTR 4249261313[ebp*1+ebx] - xor edi, eax - add ebx, edi - mov edi, ecx - rol ebx, 22 - mov ebp, DWORD PTR 32[esi] - add ebx, ecx - ; R0 8 - xor edi, edx - and edi, ebx - lea eax, DWORD PTR 1770035416[ebp*1+eax] - xor edi, edx - add eax, edi - mov edi, ebx - rol eax, 7 - mov ebp, DWORD PTR 36[esi] - add eax, ebx - ; R0 9 - xor edi, ecx - and edi, eax - lea edx, DWORD PTR 2336552879[ebp*1+edx] - xor edi, ecx - add edx, edi - mov edi, eax - rol edx, 12 - mov ebp, DWORD PTR 40[esi] - add edx, eax - ; R0 10 - xor edi, ebx - and edi, edx - lea ecx, DWORD PTR 4294925233[ebp*1+ecx] - xor edi, ebx - add ecx, edi - mov edi, edx - rol ecx, 17 - mov ebp, DWORD PTR 44[esi] - add ecx, edx - ; R0 11 - xor edi, eax - and edi, ecx - lea ebx, DWORD PTR 2304563134[ebp*1+ebx] - xor edi, eax - add ebx, edi - mov edi, ecx - rol ebx, 22 - mov ebp, DWORD PTR 48[esi] - add ebx, ecx - ; R0 12 - xor edi, edx - and edi, ebx - lea eax, DWORD PTR 1804603682[ebp*1+eax] - xor edi, edx - add eax, edi - mov edi, ebx - rol eax, 7 - mov ebp, DWORD PTR 52[esi] - add eax, ebx - ; R0 13 - xor edi, ecx - and edi, eax - lea edx, DWORD PTR 4254626195[ebp*1+edx] - xor edi, ecx - add edx, edi - mov edi, eax - rol edx, 12 - mov ebp, DWORD PTR 56[esi] - add edx, eax - ; R0 14 - xor edi, ebx - and edi, edx - lea ecx, DWORD PTR 2792965006[ebp*1+ecx] - xor edi, ebx - add ecx, edi - mov edi, edx - rol ecx, 17 - mov ebp, DWORD PTR 60[esi] - add ecx, edx - ; R0 15 - xor edi, eax - and edi, ecx - lea ebx, DWORD PTR 1236535329[ebp*1+ebx] - xor edi, eax - add ebx, edi - mov edi, ecx - rol ebx, 22 - mov ebp, DWORD PTR 4[esi] - add ebx, ecx - ; - ; R1 section - ; R1 16 - lea eax, DWORD PTR 4129170786[ebp*1+eax] - xor edi, ebx - and edi, edx - mov ebp, DWORD PTR 24[esi] - xor edi, ecx - add eax, edi - mov edi, ebx - rol eax, 5 - add eax, ebx - ; R1 17 - lea edx, DWORD PTR 3225465664[ebp*1+edx] - xor edi, eax - and edi, ecx - mov ebp, DWORD PTR 44[esi] - xor edi, ebx - add edx, edi - mov edi, eax - rol edx, 9 - add edx, eax - ; R1 18 - lea ecx, DWORD PTR 643717713[ebp*1+ecx] - xor edi, edx - and edi, ebx - mov ebp, DWORD PTR [esi] - xor edi, eax - add ecx, edi - mov edi, edx - rol ecx, 14 - add ecx, edx - ; R1 19 - lea ebx, DWORD PTR 3921069994[ebp*1+ebx] - xor edi, ecx - and edi, eax - mov ebp, DWORD PTR 20[esi] - xor edi, edx - add ebx, edi - mov edi, ecx - rol ebx, 20 - add ebx, ecx - ; R1 20 - lea eax, DWORD PTR 3593408605[ebp*1+eax] - xor edi, ebx - and edi, edx - mov ebp, DWORD PTR 40[esi] - xor edi, ecx - add eax, edi - mov edi, ebx - rol eax, 5 - add eax, ebx - ; R1 21 - lea edx, DWORD PTR 38016083[ebp*1+edx] - xor edi, eax - and edi, ecx - mov ebp, DWORD PTR 60[esi] - xor edi, ebx - add edx, edi - mov edi, eax - rol edx, 9 - add edx, eax - ; R1 22 - lea ecx, DWORD PTR 3634488961[ebp*1+ecx] - xor edi, edx - and edi, ebx - mov ebp, DWORD PTR 16[esi] - xor edi, eax - add ecx, edi - mov edi, edx - rol ecx, 14 - add ecx, edx - ; R1 23 - lea ebx, DWORD PTR 3889429448[ebp*1+ebx] - xor edi, ecx - and edi, eax - mov ebp, DWORD PTR 36[esi] - xor edi, edx - add ebx, edi - mov edi, ecx - rol ebx, 20 - add ebx, ecx - ; R1 24 - lea eax, DWORD PTR 568446438[ebp*1+eax] - xor edi, ebx - and edi, edx - mov ebp, DWORD PTR 56[esi] - xor edi, ecx - add eax, edi - mov edi, ebx - rol eax, 5 - add eax, ebx - ; R1 25 - lea edx, DWORD PTR 3275163606[ebp*1+edx] - xor edi, eax - and edi, ecx - mov ebp, DWORD PTR 12[esi] - xor edi, ebx - add edx, edi - mov edi, eax - rol edx, 9 - add edx, eax - ; R1 26 - lea ecx, DWORD PTR 4107603335[ebp*1+ecx] - xor edi, edx - and edi, ebx - mov ebp, DWORD PTR 32[esi] - xor edi, eax - add ecx, edi - mov edi, edx - rol ecx, 14 - add ecx, edx - ; R1 27 - lea ebx, DWORD PTR 1163531501[ebp*1+ebx] - xor edi, ecx - and edi, eax - mov ebp, DWORD PTR 52[esi] - xor edi, edx - add ebx, edi - mov edi, ecx - rol ebx, 20 - add ebx, ecx - ; R1 28 - lea eax, DWORD PTR 2850285829[ebp*1+eax] - xor edi, ebx - and edi, edx - mov ebp, DWORD PTR 8[esi] - xor edi, ecx - add eax, edi - mov edi, ebx - rol eax, 5 - add eax, ebx - ; R1 29 - lea edx, DWORD PTR 4243563512[ebp*1+edx] - xor edi, eax - and edi, ecx - mov ebp, DWORD PTR 28[esi] - xor edi, ebx - add edx, edi - mov edi, eax - rol edx, 9 - add edx, eax - ; R1 30 - lea ecx, DWORD PTR 1735328473[ebp*1+ecx] - xor edi, edx - and edi, ebx - mov ebp, DWORD PTR 48[esi] - xor edi, eax - add ecx, edi - mov edi, edx - rol ecx, 14 - add ecx, edx - ; R1 31 - lea ebx, DWORD PTR 2368359562[ebp*1+ebx] - xor edi, ecx - and edi, eax - mov ebp, DWORD PTR 20[esi] - xor edi, edx - add ebx, edi - mov edi, ecx - rol ebx, 20 - add ebx, ecx - ; - ; R2 section - ; R2 32 - xor edi, edx - xor edi, ebx - lea eax, DWORD PTR 4294588738[ebp*1+eax] - add eax, edi - rol eax, 4 - mov ebp, DWORD PTR 32[esi] - mov edi, ebx - ; R2 33 - lea edx, DWORD PTR 2272392833[ebp*1+edx] - add eax, ebx - xor edi, ecx - xor edi, eax - mov ebp, DWORD PTR 44[esi] - add edx, edi - mov edi, eax - rol edx, 11 - add edx, eax - ; R2 34 - xor edi, ebx - xor edi, edx - lea ecx, DWORD PTR 1839030562[ebp*1+ecx] - add ecx, edi - rol ecx, 16 - mov ebp, DWORD PTR 56[esi] - mov edi, edx - ; R2 35 - lea ebx, DWORD PTR 4259657740[ebp*1+ebx] - add ecx, edx - xor edi, eax - xor edi, ecx - mov ebp, DWORD PTR 4[esi] - add ebx, edi - mov edi, ecx - rol ebx, 23 - add ebx, ecx - ; R2 36 - xor edi, edx - xor edi, ebx - lea eax, DWORD PTR 2763975236[ebp*1+eax] - add eax, edi - rol eax, 4 - mov ebp, DWORD PTR 16[esi] - mov edi, ebx - ; R2 37 - lea edx, DWORD PTR 1272893353[ebp*1+edx] - add eax, ebx - xor edi, ecx - xor edi, eax - mov ebp, DWORD PTR 28[esi] - add edx, edi - mov edi, eax - rol edx, 11 - add edx, eax - ; R2 38 - xor edi, ebx - xor edi, edx - lea ecx, DWORD PTR 4139469664[ebp*1+ecx] - add ecx, edi - rol ecx, 16 - mov ebp, DWORD PTR 40[esi] - mov edi, edx - ; R2 39 - lea ebx, DWORD PTR 3200236656[ebp*1+ebx] - add ecx, edx - xor edi, eax - xor edi, ecx - mov ebp, DWORD PTR 52[esi] - add ebx, edi - mov edi, ecx - rol ebx, 23 - add ebx, ecx - ; R2 40 - xor edi, edx - xor edi, ebx - lea eax, DWORD PTR 681279174[ebp*1+eax] - add eax, edi - rol eax, 4 - mov ebp, DWORD PTR [esi] - mov edi, ebx - ; R2 41 - lea edx, DWORD PTR 3936430074[ebp*1+edx] - add eax, ebx - xor edi, ecx - xor edi, eax - mov ebp, DWORD PTR 12[esi] - add edx, edi - mov edi, eax - rol edx, 11 - add edx, eax - ; R2 42 - xor edi, ebx - xor edi, edx - lea ecx, DWORD PTR 3572445317[ebp*1+ecx] - add ecx, edi - rol ecx, 16 - mov ebp, DWORD PTR 24[esi] - mov edi, edx - ; R2 43 - lea ebx, DWORD PTR 76029189[ebp*1+ebx] - add ecx, edx - xor edi, eax - xor edi, ecx - mov ebp, DWORD PTR 36[esi] - add ebx, edi - mov edi, ecx - rol ebx, 23 - add ebx, ecx - ; R2 44 - xor edi, edx - xor edi, ebx - lea eax, DWORD PTR 3654602809[ebp*1+eax] - add eax, edi - rol eax, 4 - mov ebp, DWORD PTR 48[esi] - mov edi, ebx - ; R2 45 - lea edx, DWORD PTR 3873151461[ebp*1+edx] - add eax, ebx - xor edi, ecx - xor edi, eax - mov ebp, DWORD PTR 60[esi] - add edx, edi - mov edi, eax - rol edx, 11 - add edx, eax - ; R2 46 - xor edi, ebx - xor edi, edx - lea ecx, DWORD PTR 530742520[ebp*1+ecx] - add ecx, edi - rol ecx, 16 - mov ebp, DWORD PTR 8[esi] - mov edi, edx - ; R2 47 - lea ebx, DWORD PTR 3299628645[ebp*1+ebx] - add ecx, edx - xor edi, eax - xor edi, ecx - mov ebp, DWORD PTR [esi] - add ebx, edi - mov edi, -1 - rol ebx, 23 - add ebx, ecx - ; - ; R3 section - ; R3 48 - xor edi, edx - or edi, ebx - lea eax, DWORD PTR 4096336452[ebp*1+eax] - xor edi, ecx - mov ebp, DWORD PTR 28[esi] - add eax, edi - mov edi, -1 - rol eax, 6 - xor edi, ecx - add eax, ebx - ; R3 49 - or edi, eax - lea edx, DWORD PTR 1126891415[ebp*1+edx] - xor edi, ebx - mov ebp, DWORD PTR 56[esi] - add edx, edi - mov edi, -1 - rol edx, 10 - xor edi, ebx - add edx, eax - ; R3 50 - or edi, edx - lea ecx, DWORD PTR 2878612391[ebp*1+ecx] - xor edi, eax - mov ebp, DWORD PTR 20[esi] - add ecx, edi - mov edi, -1 - rol ecx, 15 - xor edi, eax - add ecx, edx - ; R3 51 - or edi, ecx - lea ebx, DWORD PTR 4237533241[ebp*1+ebx] - xor edi, edx - mov ebp, DWORD PTR 48[esi] - add ebx, edi - mov edi, -1 - rol ebx, 21 - xor edi, edx - add ebx, ecx - ; R3 52 - or edi, ebx - lea eax, DWORD PTR 1700485571[ebp*1+eax] - xor edi, ecx - mov ebp, DWORD PTR 12[esi] - add eax, edi - mov edi, -1 - rol eax, 6 - xor edi, ecx - add eax, ebx - ; R3 53 - or edi, eax - lea edx, DWORD PTR 2399980690[ebp*1+edx] - xor edi, ebx - mov ebp, DWORD PTR 40[esi] - add edx, edi - mov edi, -1 - rol edx, 10 - xor edi, ebx - add edx, eax - ; R3 54 - or edi, edx - lea ecx, DWORD PTR 4293915773[ebp*1+ecx] - xor edi, eax - mov ebp, DWORD PTR 4[esi] - add ecx, edi - mov edi, -1 - rol ecx, 15 - xor edi, eax - add ecx, edx - ; R3 55 - or edi, ecx - lea ebx, DWORD PTR 2240044497[ebp*1+ebx] - xor edi, edx - mov ebp, DWORD PTR 32[esi] - add ebx, edi - mov edi, -1 - rol ebx, 21 - xor edi, edx - add ebx, ecx - ; R3 56 - or edi, ebx - lea eax, DWORD PTR 1873313359[ebp*1+eax] - xor edi, ecx - mov ebp, DWORD PTR 60[esi] - add eax, edi - mov edi, -1 - rol eax, 6 - xor edi, ecx - add eax, ebx - ; R3 57 - or edi, eax - lea edx, DWORD PTR 4264355552[ebp*1+edx] - xor edi, ebx - mov ebp, DWORD PTR 24[esi] - add edx, edi - mov edi, -1 - rol edx, 10 - xor edi, ebx - add edx, eax - ; R3 58 - or edi, edx - lea ecx, DWORD PTR 2734768916[ebp*1+ecx] - xor edi, eax - mov ebp, DWORD PTR 52[esi] - add ecx, edi - mov edi, -1 - rol ecx, 15 - xor edi, eax - add ecx, edx - ; R3 59 - or edi, ecx - lea ebx, DWORD PTR 1309151649[ebp*1+ebx] - xor edi, edx - mov ebp, DWORD PTR 16[esi] - add ebx, edi - mov edi, -1 - rol ebx, 21 - xor edi, edx - add ebx, ecx - ; R3 60 - or edi, ebx - lea eax, DWORD PTR 4149444226[ebp*1+eax] - xor edi, ecx - mov ebp, DWORD PTR 44[esi] - add eax, edi - mov edi, -1 - rol eax, 6 - xor edi, ecx - add eax, ebx - ; R3 61 - or edi, eax - lea edx, DWORD PTR 3174756917[ebp*1+edx] - xor edi, ebx - mov ebp, DWORD PTR 8[esi] - add edx, edi - mov edi, -1 - rol edx, 10 - xor edi, ebx - add edx, eax - ; R3 62 - or edi, edx - lea ecx, DWORD PTR 718787259[ebp*1+ecx] - xor edi, eax - mov ebp, DWORD PTR 36[esi] - add ecx, edi - mov edi, -1 - rol ecx, 15 - xor edi, eax - add ecx, edx - ; R3 63 - or edi, ecx - lea ebx, DWORD PTR 3951481745[ebp*1+ebx] - xor edi, edx - mov ebp, DWORD PTR 24[esp] - add ebx, edi - add esi, 64 - rol ebx, 21 - mov edi, DWORD PTR [ebp] - add ebx, ecx - add eax, edi - mov edi, DWORD PTR 4[ebp] - add ebx, edi - mov edi, DWORD PTR 8[ebp] - add ecx, edi - mov edi, DWORD PTR 12[ebp] - add edx, edi - mov DWORD PTR [ebp],eax - mov DWORD PTR 4[ebp],ebx - mov edi, DWORD PTR [esp] - mov DWORD PTR 8[ebp],ecx - mov DWORD PTR 12[ebp],edx - cmp edi, esi - jge L000start - pop eax - pop ebx - pop ebp - pop edi - pop esi - ret -_md5_block_asm_host_order ENDP -_TEXT ENDS -END diff --git a/src/lib/libcrypto/md5/md5_locl.h b/src/lib/libcrypto/md5/md5_locl.h index 06af633228..c912484122 100644 --- a/src/lib/libcrypto/md5/md5_locl.h +++ b/src/lib/libcrypto/md5/md5_locl.h @@ -135,11 +135,7 @@ void md5_block_data_order (MD5_CTX *c, const void *p,int num); */ #endif -#ifndef FLAT_INC -#include "../md32_common.h" -#else #include "md32_common.h" -#endif /* #define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) diff --git a/src/lib/libcrypto/mem_dbg.c b/src/lib/libcrypto/mem_dbg.c index 14770c0733..a399485300 100644 --- a/src/lib/libcrypto/mem_dbg.c +++ b/src/lib/libcrypto/mem_dbg.c @@ -640,19 +640,54 @@ void CRYPTO_mem_leaks(BIO *b) MEM_LEAK ml; char buf[80]; - if (mh == NULL) return; + if (mh == NULL && amih == NULL) + return; ml.bio=b; ml.bytes=0; ml.chunks=0; - CRYPTO_w_lock(CRYPTO_LOCK_MALLOC2); - lh_doall_arg(mh,(void (*)())print_leak,(char *)&ml); - CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC2); + MemCheck_off(); /* obtains CRYPTO_LOCK_MALLOC2 */ + if (mh != NULL) + lh_doall_arg(mh,(void (*)())print_leak,(char *)&ml); if (ml.chunks != 0) { sprintf(buf,"%ld bytes leaked in %d chunks\n", ml.bytes,ml.chunks); BIO_puts(b,buf); } + else + { + /* Make sure that, if we found no leaks, memory-leak debugging itself + * does not introduce memory leaks (which might irritate + * external debugging tools). + * (When someone enables leak checking, but does not call + * this function, we declare it to be their fault.) + * + * XXX This should be in CRYPTO_mem_leaks_cb, + * and CRYPTO_mem_leaks should be implemented by + * using CRYPTO_mem_leaks_cb. + * (Also their should be a variant of lh_doall_arg + * that takes a function pointer instead of a void *; + * this would obviate the ugly and illegal + * void_fn_to_char kludge in CRYPTO_mem_leaks_cb. + * Otherwise the code police will come and get us.) + */ + CRYPTO_w_lock(CRYPTO_LOCK_MALLOC); + if (mh != NULL) + { + lh_free(mh); + mh = NULL; + } + if (amih != NULL) + { + if (lh_num_items(amih) == 0) + { + lh_free(amih); + amih = NULL; + } + } + CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC); + } + MemCheck_on(); /* releases CRYPTO_LOCK_MALLOC2 */ #if 0 lh_stats_bio(mh,b); diff --git a/src/lib/libcrypto/objects/o_names.c b/src/lib/libcrypto/objects/o_names.c index d654eb220e..d9389a5e5a 100644 --- a/src/lib/libcrypto/objects/o_names.c +++ b/src/lib/libcrypto/objects/o_names.c @@ -22,7 +22,7 @@ typedef struct name_funcs_st DECLARE_STACK_OF(NAME_FUNCS) IMPLEMENT_STACK_OF(NAME_FUNCS) -STACK_OF(NAME_FUNCS) *name_funcs_stack; +static STACK_OF(NAME_FUNCS) *name_funcs_stack; static unsigned long obj_name_hash(OBJ_NAME *a); static int obj_name_cmp(OBJ_NAME *a,OBJ_NAME *b); diff --git a/src/lib/libcrypto/objects/obj_err.c b/src/lib/libcrypto/objects/obj_err.c index cef401db27..7aec0ed47a 100644 --- a/src/lib/libcrypto/objects/obj_err.c +++ b/src/lib/libcrypto/objects/obj_err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/objects/objects.h b/src/lib/libcrypto/objects/objects.h index d1a5ad2502..95c8a21568 100644 --- a/src/lib/libcrypto/objects/objects.h +++ b/src/lib/libcrypto/objects/objects.h @@ -949,7 +949,7 @@ extern "C" { #define NID_ad_ca_issuers 179 #define OBJ_ad_ca_issuers OBJ_id_ad,2L -#define SN_OSCP_sign "OCSPSigning" +#define SN_OCSP_sign "OCSPSigning" #define LN_OCSP_sign "OCSP Signing" #define NID_OCSP_sign 180 #define OBJ_OCSP_sign OBJ_id_kp,9L diff --git a/src/lib/libcrypto/opensslv.h b/src/lib/libcrypto/opensslv.h index 55d5d06cf5..55ec97389f 100644 --- a/src/lib/libcrypto/opensslv.h +++ b/src/lib/libcrypto/opensslv.h @@ -2,20 +2,31 @@ #define HEADER_OPENSSLV_H /* Numeric release version identifier: - * MMNNFFRBB: major minor fix final beta/patch + * MMNNFFPPS: major minor fix patch status + * The status nibble has one of the values 0 for development, 1 to e for betas + * 1 to 14, and f for release. The patch level is exactly that. * For example: * 0.9.3-dev 0x00903000 - * 0.9.3beta1 0x00903001 - * 0.9.3beta2-dev 0x00903002 - * 0.9.3beta2 0x00903002 (same as ...beta2-dev) - * 0.9.3 0x00903100 - * 0.9.3a 0x00903101 - * 0.9.4 0x00904100 - * 1.2.3z 0x1020311a + * 0.9.3-beta1 0x00903001 + * 0.9.3-beta2-dev 0x00903002 + * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) + * 0.9.3 0x0090300f + * 0.9.3a 0x0090301f + * 0.9.4 0x0090400f + * 1.2.3z 0x102031af + * + * For continuity reasons (because 0.9.5 is already out, and is coded + * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level + * part is slightly different, by setting the highest bit. This means + * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start + * with 0x0090600S... + * * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) + * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for + * major minor fix final patch/beta) */ -#define OPENSSL_VERSION_NUMBER 0x00905100L -#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.5 28 Feb 2000" +#define OPENSSL_VERSION_NUMBER 0x0090581fL +#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.5a 1 Apr 2000" #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT #endif /* HEADER_OPENSSLV_H */ diff --git a/src/lib/libcrypto/pem/pem_err.c b/src/lib/libcrypto/pem/pem_err.c index 642129da20..8b1789b11c 100644 --- a/src/lib/libcrypto/pem/pem_err.c +++ b/src/lib/libcrypto/pem/pem_err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c index 072211ba0f..b5e0a650f8 100644 --- a/src/lib/libcrypto/pem/pem_lib.c +++ b/src/lib/libcrypto/pem/pem_lib.c @@ -373,7 +373,7 @@ int PEM_ASN1_write_bio(int (*i2d)(), const char *name, BIO *bp, char *x, kstr=(unsigned char *)buf; } RAND_add(data,i,0);/* put in the RSA key. */ - if (RAND_bytes(iv,8) <= 0) /* Generate a salt */ + if (RAND_pseudo_bytes(iv,8) < 0) /* Generate a salt */ goto err; /* The 'iv' is used as the iv and as a salt. It is * NOT taken from the BytesToKey function */ diff --git a/src/lib/libcrypto/perlasm/x86asm.pl b/src/lib/libcrypto/perlasm/x86asm.pl index 44e330eb8d..81c6e64e87 100644 --- a/src/lib/libcrypto/perlasm/x86asm.pl +++ b/src/lib/libcrypto/perlasm/x86asm.pl @@ -18,11 +18,13 @@ sub main'asm_init ($type,$fn,$i386)=@_; $filename=$fn; - $cpp=$sol=$aout=$win32=0; + $cpp=$sol=$aout=$win32=$gaswin=0; if ( ($type eq "elf")) { require "x86unix.pl"; } elsif ( ($type eq "a.out")) { $aout=1; require "x86unix.pl"; } + elsif ( ($type eq "gaswin")) + { $gaswin=1; $aout=1; require "x86unix.pl"; } elsif ( ($type eq "sol")) { $sol=1; require "x86unix.pl"; } elsif ( ($type eq "cpp")) @@ -50,7 +52,7 @@ EOF &comment("Don't even think of reading this code"); &comment("It was automatically generated by $filename"); &comment("Which is a perl program used to generate the x86 assember for"); -&comment("any of elf, a.out, BSDI,Win32, or Solaris"); +&comment("any of elf, a.out, BSDI, Win32, gaswin (for GNU as on Win32) or Solaris"); &comment("eric "); &comment(""); diff --git a/src/lib/libcrypto/perlasm/x86ms.pl b/src/lib/libcrypto/perlasm/x86ms.pl index 252a57bdb5..206452341d 100644 --- a/src/lib/libcrypto/perlasm/x86ms.pl +++ b/src/lib/libcrypto/perlasm/x86ms.pl @@ -341,7 +341,7 @@ sub main'set_label $label{$_[0]}="${label}${_[0]}"; $label++; } - if((defined $_[1]) && ($_[1] == 1)) + if((defined $_[2]) && ($_[2] == 1)) { push(@out,"$label{$_[0]}::\n"); } diff --git a/src/lib/libcrypto/perlasm/x86unix.pl b/src/lib/libcrypto/perlasm/x86unix.pl index 60d75f5ce4..309060ea00 100644 --- a/src/lib/libcrypto/perlasm/x86unix.pl +++ b/src/lib/libcrypto/perlasm/x86unix.pl @@ -292,6 +292,8 @@ EOF push(@out,$tmp); if ($main'cpp) { $tmp=push(@out,"\tTYPE($func,\@function)\n"); } + elsif ($main'gaswin) + { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } else { $tmp=push(@out,"\t.type\t$func,\@function\n"); } push(@out,"$func:\n"); $tmp=<<"EOF"; @@ -320,6 +322,8 @@ EOF push(@out,$tmp); if ($main'cpp) { push(@out,"\tTYPE($func,\@function)\n"); } + elsif ($main'gaswin) + { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } else { push(@out,"\t.type $func,\@function\n"); } push(@out,"$func:\n"); $stack=4; @@ -342,6 +346,8 @@ EOF push(@out,$tmp); if ($main'cpp) { push(@out,"\tSIZE($func,.${func}_end-$func)\n"); } + elsif ($main'gaswin) + { $tmp=push(@out,"\t.align 4\n"); } else { push(@out,"\t.size\t$func,.${func}_end-$func\n"); } push(@out,".ident \"$func\"\n"); $stack=0; @@ -371,6 +377,8 @@ sub main'function_end_B push(@out,".L_${func}_end:\n"); if ($main'cpp) { push(@out,"\tSIZE($func,.L_${func}_end-$func)\n"); } + elsif ($main'gaswin) + { push(@out,"\t.align 4\n"); } else { push(@out,"\t.size\t$func,.L_${func}_end-$func\n"); } push(@out,".ident \"desasm.pl\"\n"); $stack=0; diff --git a/src/lib/libcrypto/pkcs12/p12_crt.c b/src/lib/libcrypto/pkcs12/p12_crt.c index 56d88b0759..ee8aed54c7 100644 --- a/src/lib/libcrypto/pkcs12/p12_crt.c +++ b/src/lib/libcrypto/pkcs12/p12_crt.c @@ -61,7 +61,7 @@ #include PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, - STACK *ca, int nid_key, int nid_cert, int iter, int mac_iter, + STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter, int mac_iter, int keytype) { PKCS12 *p12; @@ -103,8 +103,8 @@ PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, /* Add all other certificates */ if(ca) { - for(i = 0; i < sk_num(ca); i++) { - tcert = (X509 *)sk_value(ca, i); + for(i = 0; i < sk_X509_num(ca); i++) { + tcert = sk_X509_value(ca, i); if(!(bag = M_PKCS12_x5092certbag(tcert))) return NULL; if(!sk_push(bags, (char *)bag)) { PKCS12err(PKCS12_F_PKCS12_CREATE,ERR_R_MALLOC_FAILURE); diff --git a/src/lib/libcrypto/pkcs12/p12_key.c b/src/lib/libcrypto/pkcs12/p12_key.c index 02fdd20e2f..b364671ed2 100644 --- a/src/lib/libcrypto/pkcs12/p12_key.c +++ b/src/lib/libcrypto/pkcs12/p12_key.c @@ -104,6 +104,14 @@ int PKCS12_key_gen_uni (unsigned char *pass, int passlen, unsigned char *salt, #ifdef DEBUG_KEYGEN unsigned char *tmpout = out; int tmpn = n; +#endif + + if (!pass) { + PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_PASSED_NULL_PARAMETER); + return 0; + } + +#ifdef DEBUG_KEYGEN fprintf(stderr, "KEYGEN DEBUG\n"); fprintf(stderr, "ID %d, ITER %d\n", id, iter); fprintf(stderr, "Password (length %d):\n", passlen); diff --git a/src/lib/libcrypto/pkcs12/p12_kiss.c b/src/lib/libcrypto/pkcs12/p12_kiss.c index 08a60556e0..ee257ffbad 100644 --- a/src/lib/libcrypto/pkcs12/p12_kiss.c +++ b/src/lib/libcrypto/pkcs12/p12_kiss.c @@ -62,9 +62,17 @@ /* Simplified PKCS#12 routines */ -static int parse_pk12( PKCS12 *p12, const char *pass, int passlen, EVP_PKEY **pkey, X509 **cert, STACK **ca); -static int parse_bags( STACK *bags, const char *pass, int passlen, EVP_PKEY **pkey, X509 **cert, STACK **ca, ASN1_OCTET_STRING **keyid, char *keymatch); -static int parse_bag( PKCS12_SAFEBAG *bag, const char *pass, int passlen, EVP_PKEY **pkey, X509 **cert, STACK **ca, ASN1_OCTET_STRING **keyid, char *keymatch); +static int parse_pk12( PKCS12 *p12, const char *pass, int passlen, + EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca); + +static int parse_bags( STACK *bags, const char *pass, int passlen, + EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca, + ASN1_OCTET_STRING **keyid, char *keymatch); + +static int parse_bag( PKCS12_SAFEBAG *bag, const char *pass, int passlen, + EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca, + ASN1_OCTET_STRING **keyid, char *keymatch); + /* Parse and decrypt a PKCS#12 structure returning user key, user cert * and other (CA) certs. Note either ca should be NULL, *ca should be NULL, * or it should point to a valid STACK structure. pkey and cert can be @@ -72,54 +80,59 @@ static int parse_bag( PKCS12_SAFEBAG *bag, const char *pass, int passlen, EVP_PK */ int PKCS12_parse (PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, - STACK **ca) + STACK_OF(X509) **ca) { -/* Check for NULL PKCS12 structure */ - -if(!p12) { - PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_INVALID_NULL_PKCS12_POINTER); - return 0; -} + /* Check for NULL PKCS12 structure */ -/* Allocate stack for ca certificates if needed */ -if ((ca != NULL) && (*ca == NULL)) { - if (!(*ca = sk_new(NULL))) { - PKCS12err(PKCS12_F_PKCS12_PARSE,ERR_R_MALLOC_FAILURE); + if(!p12) + { + PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_INVALID_NULL_PKCS12_POINTER); return 0; - } -} + } + + /* Allocate stack for ca certificates if needed */ + if ((ca != NULL) && (*ca == NULL)) + { + if (!(*ca = sk_X509_new(NULL))) + { + PKCS12err(PKCS12_F_PKCS12_PARSE,ERR_R_MALLOC_FAILURE); + return 0; + } + } -if(pkey) *pkey = NULL; -if(cert) *cert = NULL; + if(pkey) *pkey = NULL; + if(cert) *cert = NULL; -/* Check the mac */ + /* Check the mac */ -if (!PKCS12_verify_mac (p12, pass, -1)) { - PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_MAC_VERIFY_FAILURE); - goto err; -} + if (!PKCS12_verify_mac (p12, pass, -1)) + { + PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_MAC_VERIFY_FAILURE); + goto err; + } -if (!parse_pk12 (p12, pass, -1, pkey, cert, ca)) { - PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_PARSE_ERROR); - goto err; -} + if (!parse_pk12 (p12, pass, -1, pkey, cert, ca)) + { + PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_PARSE_ERROR); + goto err; + } -return 1; + return 1; -err: + err: -if (pkey && *pkey) EVP_PKEY_free (*pkey); -if (cert && *cert) X509_free (*cert); -if (ca) sk_pop_free (*ca, X509_free); -return 0; + if (pkey && *pkey) EVP_PKEY_free (*pkey); + if (cert && *cert) X509_free (*cert); + if (ca) sk_X509_pop_free (*ca, X509_free); + return 0; } /* Parse the outer PKCS#12 structure */ static int parse_pk12 (PKCS12 *p12, const char *pass, int passlen, - EVP_PKEY **pkey, X509 **cert, STACK **ca) + EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca) { STACK *asafes, *bags; int i, bagnid; @@ -154,7 +167,7 @@ static int parse_pk12 (PKCS12 *p12, const char *pass, int passlen, static int parse_bags (STACK *bags, const char *pass, int passlen, - EVP_PKEY **pkey, X509 **cert, STACK **ca, + EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca, ASN1_OCTET_STRING **keyid, char *keymatch) { int i; @@ -171,7 +184,7 @@ static int parse_bags (STACK *bags, const char *pass, int passlen, #define MATCH_ALL 0x3 static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, - EVP_PKEY **pkey, X509 **cert, STACK **ca, + EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca, ASN1_OCTET_STRING **keyid, char *keymatch) { @@ -221,7 +234,10 @@ static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, if (lkey) { *keymatch |= MATCH_CERT; if (cert) *cert = x509; - } else if (ca) sk_push (*ca, (char *)x509); + } else { + if(ca) sk_X509_push (*ca, x509); + else X509_free(x509); + } break; case NID_safeContentsBag: diff --git a/src/lib/libcrypto/pkcs12/p12_mutl.c b/src/lib/libcrypto/pkcs12/p12_mutl.c index f1094b3840..369257ed4c 100644 --- a/src/lib/libcrypto/pkcs12/p12_mutl.c +++ b/src/lib/libcrypto/pkcs12/p12_mutl.c @@ -157,7 +157,7 @@ int PKCS12_setup_mac (PKCS12 *p12, int iter, unsigned char *salt, int saltlen, return 0; } if (!salt) { - if (RAND_bytes (p12->mac->salt->data, saltlen) <= 0) + if (RAND_pseudo_bytes (p12->mac->salt->data, saltlen) < 0) return 0; } else memcpy (p12->mac->salt->data, salt, saltlen); diff --git a/src/lib/libcrypto/pkcs12/pk12err.c b/src/lib/libcrypto/pkcs12/pk12err.c index 9d8de10e1e..12db54f49e 100644 --- a/src/lib/libcrypto/pkcs12/pk12err.c +++ b/src/lib/libcrypto/pkcs12/pk12err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/pkcs12/pkcs12.h b/src/lib/libcrypto/pkcs12/pkcs12.h index 254000fa12..dad356c00f 100644 --- a/src/lib/libcrypto/pkcs12/pkcs12.h +++ b/src/lib/libcrypto/pkcs12/pkcs12.h @@ -265,9 +265,9 @@ void PKCS12_SAFEBAG_free(PKCS12_SAFEBAG *a); void ERR_load_PKCS12_strings(void); void PKCS12_PBE_add(void); int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, - STACK **ca); + STACK_OF(X509) **ca); PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, - STACK *ca, int nid_key, int nid_cert, int iter, + STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter, int mac_iter, int keytype); int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12); int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12); diff --git a/src/lib/libcrypto/pkcs7/README b/src/lib/libcrypto/pkcs7/README index 27001c6970..e69de29bb2 100644 --- a/src/lib/libcrypto/pkcs7/README +++ b/src/lib/libcrypto/pkcs7/README @@ -1,5 +0,0 @@ -WARNING - -Everything in this directory is experimental and is subject to change. - -Do not rely on the stuff in here not changing in the next release diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c index 80ac5e34b4..4ab24a86f5 100644 --- a/src/lib/libcrypto/pkcs7/pk7_doit.c +++ b/src/lib/libcrypto/pkcs7/pk7_doit.c @@ -699,6 +699,7 @@ int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, BIO *bio, if (i <= 0) { PKCS7err(PKCS7_F_PKCS7_DATAVERIFY,ERR_R_X509_LIB); + X509_STORE_CTX_cleanup(ctx); goto err; } X509_STORE_CTX_cleanup(ctx); diff --git a/src/lib/libcrypto/pkcs7/pkcs7err.c b/src/lib/libcrypto/pkcs7/pkcs7err.c index 813a8af9ed..8ded8913db 100644 --- a/src/lib/libcrypto/pkcs7/pkcs7err.c +++ b/src/lib/libcrypto/pkcs7/pkcs7err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/rand/md_rand.c b/src/lib/libcrypto/rand/md_rand.c index 6b158f0349..da4258c479 100644 --- a/src/lib/libcrypto/rand/md_rand.c +++ b/src/lib/libcrypto/rand/md_rand.c @@ -55,6 +55,59 @@ * copied and put under another distribution licence * [including the GNU Public Licence.] */ +/* ==================================================================== + * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ #define ENTROPY_NEEDED 16 /* require 128 bits = 16 bytes of randomness */ @@ -130,6 +183,10 @@ #include +#ifdef BN_DEBUG +# define PREDICT +#endif + /* #define NORAND 1 */ /* #define PREDICT 1 */ @@ -141,6 +198,10 @@ static long md_count[2]={0,0}; static double entropy=0; static int initialized=0; +#ifdef PREDICT +int rand_predictable=0; +#endif + const char *RAND_version="RAND" OPENSSL_VERSION_PTEXT; static void ssleay_rand_cleanup(void); @@ -148,6 +209,7 @@ static void ssleay_rand_seed(const void *buf, int num); static void ssleay_rand_add(const void *buf, int num, double add_entropy); static int ssleay_rand_bytes(unsigned char *buf, int num); static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num); +static int ssleay_rand_status(void); RAND_METHOD rand_ssleay_meth={ ssleay_rand_seed, @@ -155,6 +217,7 @@ RAND_METHOD rand_ssleay_meth={ ssleay_rand_cleanup, ssleay_rand_add, ssleay_rand_pseudo_bytes, + ssleay_rand_status }; RAND_METHOD *RAND_SSLeay(void) @@ -306,6 +369,10 @@ static void ssleay_rand_initialize(void) FILE *fh; #endif +#ifdef NORAND + return; +#endif + CRYPTO_w_unlock(CRYPTO_LOCK_RAND); /* put in some default random data, we need more than just this */ #ifndef GETPID_IS_MEANINGLESS @@ -354,13 +421,14 @@ static int ssleay_rand_bytes(unsigned char *buf, int num) #endif #ifdef PREDICT - { - static unsigned char val=0; + if (rand_predictable) + { + static unsigned char val=0; - for (i=0; i= ENTROPY_NEEDED); + ret = entropy >= ENTROPY_NEEDED; + + CRYPTO_w_unlock(CRYPTO_LOCK_RAND); + + return ret; } #ifdef WINDOWS #include #include +int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam) + { + double add_entropy=0; + SYSTEMTIME t; + + switch (iMsg) + { + case WM_KEYDOWN: + { + static WPARAM key; + if (key != wParam) + add_entropy = 0.05; + key = wParam; + } + break; + case WM_MOUSEMOVE: + { + static int lastx,lasty,lastdx,lastdy; + int x,y,dx,dy; + + x=LOWORD(lParam); + y=HIWORD(lParam); + dx=lastx-x; + dy=lasty-y; + if (dx != 0 && dy != 0 && dx-lastdx != 0 && dy-lastdy != 0) + add_entropy=.2; + lastx=x, lasty=y; + lastdx=dx, lastdy=dy; + } + break; + } + + GetSystemTime(&t); + RAND_add(&iMsg, sizeof(iMsg), add_entropy); + RAND_add(&wParam, sizeof(wParam), 0); + RAND_add(&lParam, sizeof(lParam), 0); + RAND_add(&t, sizeof(t), 0); + + return (RAND_status()); + } + /***************************************************************************** * Initialisation function for the SSL random generator. Takes the contents * of the screen as random seed. diff --git a/src/lib/libcrypto/rand/rand.h b/src/lib/libcrypto/rand/rand.h index 28f45ec052..2973ee90e4 100644 --- a/src/lib/libcrypto/rand/rand.h +++ b/src/lib/libcrypto/rand/rand.h @@ -70,8 +70,13 @@ typedef struct rand_meth_st void (*cleanup)(void); void (*add)(const void *buf, int num, double entropy); int (*pseudorand)(unsigned char *buf, int num); + int (*status)(void); } RAND_METHOD; +#ifdef BN_DEBUG +extern int rand_predictable; +#endif + void RAND_set_rand_method(RAND_METHOD *meth); RAND_METHOD *RAND_get_rand_method(void ); RAND_METHOD *RAND_SSLeay(void); @@ -85,8 +90,10 @@ int RAND_write_file(const char *file); const char *RAND_file_name(char *file,int num); int RAND_status(void); int RAND_egd(const char *path); -#ifdef WINDOWS +#if defined(WINDOWS) || defined(WIN32) +#include void RAND_screen(void); +int RAND_event(UINT, WPARAM, LPARAM); #endif void ERR_load_RAND_strings(void); diff --git a/src/lib/libcrypto/rand/rand_egd.c b/src/lib/libcrypto/rand/rand_egd.c index d834408bd4..380c7828c3 100644 --- a/src/lib/libcrypto/rand/rand_egd.c +++ b/src/lib/libcrypto/rand/rand_egd.c @@ -97,7 +97,7 @@ int RAND_egd(const char *path) buf[1] = 255; write(fd, buf, 2); if (read(fd, buf, 1) != 1) goto err; - if (buf[0] == 0) goto err; + if (buf[0] == 0) goto err; num = read(fd, buf, 255); if (num < 1) goto err; RAND_seed(buf, num); diff --git a/src/lib/libcrypto/rand/rand_err.c b/src/lib/libcrypto/rand/rand_err.c index d1263edf80..1af0aa0b8a 100644 --- a/src/lib/libcrypto/rand/rand_err.c +++ b/src/lib/libcrypto/rand/rand_err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include @@ -71,7 +72,7 @@ static ERR_STRING_DATA RAND_str_functs[]= static ERR_STRING_DATA RAND_str_reasons[]= { -{RAND_R_PRNG_NOT_SEEDED ,"prng not seeded"}, +{RAND_R_PRNG_NOT_SEEDED ,"PRNG not seeded"}, {0,NULL} }; diff --git a/src/lib/libcrypto/rand/rand_lib.c b/src/lib/libcrypto/rand/rand_lib.c index b09a300c46..7da74aab0e 100644 --- a/src/lib/libcrypto/rand/rand_lib.c +++ b/src/lib/libcrypto/rand/rand_lib.c @@ -108,3 +108,10 @@ int RAND_pseudo_bytes(unsigned char *buf, int num) return rand_meth->pseudorand(buf,num); return(-1); } + +int RAND_status(void) + { + if (rand_meth != NULL) + return rand_meth->status(); + return 0; + } diff --git a/src/lib/libcrypto/rand/randfile.c b/src/lib/libcrypto/rand/randfile.c index 658a8d6b65..9ff3974cc7 100644 --- a/src/lib/libcrypto/rand/randfile.c +++ b/src/lib/libcrypto/rand/randfile.c @@ -133,35 +133,20 @@ int RAND_write_file(const char *file) int i,ret=0,err=0; FILE *out = NULL; int n; - -#ifdef VMS - /* Under VMS, fopen(file, "wb") will create a new version of the - same file. This is not good, so let's try updating an existing - one, and create file only if it doesn't already exist. */ - /* At the same time, if we just update a file, we also need to - truncate it, and unfortunately, ftruncate() and truncate() do - not exist everywhere. All that remains is to delete old versions - of the random data file (done at the end). */ -#if 0 - out=fopen(file,"rb+"); - if (out == NULL && errno != ENOENT) - goto err; -#endif + +#if defined(O_CREAT) && defined(O_EXCL) && !defined(WIN32) + /* For some reason Win32 can't write to files created this way */ + + /* chmod(..., 0600) is too late to protect the file, + * permissions should be restrictive from the start */ + int fd = open(file, O_CREAT | O_EXCL, 0600); + if (fd != -1) + out = fdopen(fd, "wb"); #endif + if (out == NULL) + out = fopen(file,"wb"); + if (out == NULL) goto err; - if (out == NULL) - { -#if defined O_CREAT && defined O_EXCL - /* chmod(..., 0600) is too late to protect the file, - * permissions should be restrictive from the start */ - int fd = open(file, O_CREAT | O_EXCL, 0600); - if (fd != -1) - out = fdopen(fd, "wb"); -#else - out=fopen(file,"wb"); -#endif - } - if (out == NULL) goto err; #ifndef NO_CHMOD chmod(file,0600); #endif @@ -180,14 +165,8 @@ int RAND_write_file(const char *file) } ret+=i; if (n <= 0) break; - } + } #ifdef VMS - /* We may have updated an existing file using mode "rb+", - * now remove any old extra bytes */ -#if 0 - if (ret > 0) - ftruncate(fileno(out), ret); -#else /* Try to delete older versions of the file, until there aren't any */ { @@ -205,8 +184,7 @@ int RAND_write_file(const char *file) some point... */ } } -#endif -#endif +#endif /* VMS */ fclose(out); memset(buf,0,BUFSIZE); diff --git a/src/lib/libcrypto/rc2/Makefile.uni b/src/lib/libcrypto/rc2/Makefile.uni index 4dc20c6fcf..e69de29bb2 100644 --- a/src/lib/libcrypto/rc2/Makefile.uni +++ b/src/lib/libcrypto/rc2/Makefile.uni @@ -1,73 +0,0 @@ -# Targets -# make - twidle the options yourself :-) -# make cc - standard cc options -# make gcc - standard gcc options - -DIR= rc2 -TOP= . -CC= gcc -CFLAG= -O3 -fomit-frame-pointer - -CPP= $(CC) -E -INCLUDES= -INSTALLTOP=/usr/local/lib -MAKE= make -MAKEDEPEND= makedepend -MAKEFILE= Makefile.uni -AR= ar r -RANLIB= ranlib - -IDEA_ENC=rc2_cbc.o - -CFLAGS= $(INCLUDES) $(CFLAG) - -GENERAL=Makefile -TEST=rc2test -APPS=rc2speed - -LIB=librc2.a -LIBSRC=rc2_skey.c rc2_ecb.c rc2_cbc.c rc2cfb64.c rc2ofb64.c -LIBOBJ=rc2_skey.o rc2_ecb.o $(IDEA_ENC) rc2cfb64.o rc2ofb64.o - -SRC= $(LIBSRC) - -EXHEADER= rc2.h -HEADER= rc2_locl.h $(EXHEADER) - -ALL= $(GENERAL) $(SRC) $(HEADER) - -all: $(LIB) $(TEST) $(APPS) - -$(LIB): $(LIBOBJ) - $(AR) $(LIB) $(LIBOBJ) - $(RANLIB) $(LIB) - -test: $(TEST) - ./$(TEST) - -$(TEST): $(TEST).c $(LIB) - $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) - -$(APPS): $(APPS).c $(LIB) - $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) - -lint: - lint -DLINT $(INCLUDES) $(SRC)>fluff - -depend: - $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) - -dclean: - perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new - mv -f Makefile.new $(MAKEFILE) - -clean: - /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff - -cc: - $(MAKE) CC="cc" CFLAG="-O" all - -gcc: - $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/rc4/Makefile.ssl b/src/lib/libcrypto/rc4/Makefile.ssl index 2ea95f0298..8d2a795c22 100644 --- a/src/lib/libcrypto/rc4/Makefile.ssl +++ b/src/lib/libcrypto/rc4/Makefile.ssl @@ -5,6 +5,7 @@ DIR= rc4 TOP= ../.. CC= cc +CPP= $(CC) -E INCLUDES= CFLAG=-g INSTALL_PREFIX= @@ -51,7 +52,7 @@ lib: $(LIBOBJ) # elf asm/rx86-elf.o: asm/rx86unix.cpp - $(CPP) -DELF asm/rx86unix.cpp | as -o asm/rx86-elf.o + $(CPP) -DELF -x c asm/rx86unix.cpp | as -o asm/rx86-elf.o # solaris asm/rx86-sol.o: asm/rx86unix.cpp @@ -67,7 +68,7 @@ asm/rx86-out.o: asm/rx86unix.cpp asm/rx86bsdi.o: asm/rx86unix.cpp $(CPP) -DBSDI asm/rx86unix.cpp | sed 's/ :/:/' | as -o asm/rx86bsdi.o -asm/rx86unix.cpp: asm/rc4-586.pl +asm/rx86unix.cpp: asm/rc4-586.pl ../perlasm/x86asm.pl (cd asm; $(PERL) rc4-586.pl cpp >rx86unix.cpp) files: diff --git a/src/lib/libcrypto/rc4/Makefile.uni b/src/lib/libcrypto/rc4/Makefile.uni index 855d9e50f3..e69de29bb2 100644 --- a/src/lib/libcrypto/rc4/Makefile.uni +++ b/src/lib/libcrypto/rc4/Makefile.uni @@ -1,103 +0,0 @@ -# Targets -# make - twidle the options yourself :-) -# make cc - standard cc options -# make gcc - standard gcc options -# make x86-elf - linux-elf etc -# make x86-out - linux-a.out, FreeBSD etc -# make x86-solaris -# make x86-bdsi - -DIR= rc4 -TOP= . -CC= gcc -CFLAG= -O3 -fomit-frame-pointer - -CPP= $(CC) -E -INCLUDES= -INSTALLTOP=/usr/local/lib -MAKE= make -MAKEDEPEND= makedepend -MAKEFILE= Makefile.uni -AR= ar r -RANLIB= ranlib - -RC4_ENC=rc4_enc.o -# or use -#RC4_ENC=asm/rx86-elf.o -#RC4_ENC=asm/rx86-out.o -#RC4_ENC=asm/rx86-sol.o -#RC4_ENC=asm/rx86bdsi.o - -CFLAGS= $(INCLUDES) $(CFLAG) - -GENERAL=Makefile -TEST=rc4test -APPS=rc4speed - -LIB=librc4.a -LIBSRC=rc4_skey.c rc4_enc.c -LIBOBJ=rc4_skey.o $(RC4_ENC) - -SRC= $(LIBSRC) - -EXHEADER= rc4.h -HEADER= $(EXHEADER) rc4_locl.h - -ALL= $(GENERAL) $(SRC) $(HEADER) - -all: $(LIB) $(TEST) $(APPS) - -$(LIB): $(LIBOBJ) - $(AR) $(LIB) $(LIBOBJ) - $(RANLIB) $(LIB) - -# elf -asm/rx86-elf.o: asm/rx86unix.cpp - $(CPP) -DELF asm/rx86unix.cpp | as -o asm/rx86-elf.o - -# solaris -asm/rx86-sol.o: asm/rx86unix.cpp - $(CC) -E -DSOL asm/rx86unix.cpp | sed 's/^#.*//' > asm/rx86-sol.s - as -o asm/rx86-sol.o asm/rx86-sol.s - rm -f asm/rx86-sol.s - -# a.out -asm/rx86-out.o: asm/rx86unix.cpp - $(CPP) -DOUT asm/rx86unix.cpp | as -o asm/rx86-out.o - -# bsdi -asm/rx86bsdi.o: asm/rx86unix.cpp - $(CPP) -DBSDI asm/rx86unix.cpp | as -o asm/rx86bsdi.o - -asm/rx86unix.cpp: - (cd asm; perl rc4-586.pl cpp >rx86unix.cpp) - -test: $(TEST) - ./$(TEST) - -$(TEST): $(TEST).c $(LIB) - $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) - -$(APPS): $(APPS).c $(LIB) - $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) - -lint: - lint -DLINT $(INCLUDES) $(SRC)>fluff - -depend: - $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) - -dclean: - perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new - mv -f Makefile.new $(MAKEFILE) - -clean: - /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff - -cc: - $(MAKE) CC="cc" CFLAG="-O" all - -gcc: - $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/rc4/asm/r4-win32.asm b/src/lib/libcrypto/rc4/asm/r4-win32.asm index 70b0f7484c..e69de29bb2 100644 --- a/src/lib/libcrypto/rc4/asm/r4-win32.asm +++ b/src/lib/libcrypto/rc4/asm/r4-win32.asm @@ -1,314 +0,0 @@ - ; Don't even think of reading this code - ; It was automatically generated by rc4-586.pl - ; Which is a perl program used to generate the x86 assember for - ; any of elf, a.out, BSDI,Win32, or Solaris - ; eric - ; - TITLE rc4-586.asm - .386 -.model FLAT -_TEXT SEGMENT -PUBLIC _RC4 - -_RC4 PROC NEAR - ; - push ebp - push ebx - mov ebp, DWORD PTR 12[esp] - mov ebx, DWORD PTR 16[esp] - push esi - push edi - mov ecx, DWORD PTR [ebp] - mov edx, DWORD PTR 4[ebp] - mov esi, DWORD PTR 28[esp] - inc ecx - sub esp, 12 - add ebp, 8 - and ecx, 255 - lea ebx, DWORD PTR [esi+ebx-8] - mov edi, DWORD PTR 44[esp] - mov DWORD PTR 8[esp],ebx - mov eax, DWORD PTR [ecx*4+ebp] - cmp ebx, esi - jl $L000end -L001start: - add esi, 8 - ; Round 0 - add edx, eax - and edx, 255 - inc ecx - mov ebx, DWORD PTR [edx*4+ebp] - mov DWORD PTR [ecx*4+ebp-4],ebx - add ebx, eax - and ecx, 255 - and ebx, 255 - mov DWORD PTR [edx*4+ebp],eax - nop - mov ebx, DWORD PTR [ebx*4+ebp] - mov eax, DWORD PTR [ecx*4+ebp] - mov BYTE PTR [esp], bl - ; Round 1 - add edx, eax - and edx, 255 - inc ecx - mov ebx, DWORD PTR [edx*4+ebp] - mov DWORD PTR [ecx*4+ebp-4],ebx - add ebx, eax - and ecx, 255 - and ebx, 255 - mov DWORD PTR [edx*4+ebp],eax - nop - mov ebx, DWORD PTR [ebx*4+ebp] - mov eax, DWORD PTR [ecx*4+ebp] - mov BYTE PTR 1[esp],bl - ; Round 2 - add edx, eax - and edx, 255 - inc ecx - mov ebx, DWORD PTR [edx*4+ebp] - mov DWORD PTR [ecx*4+ebp-4],ebx - add ebx, eax - and ecx, 255 - and ebx, 255 - mov DWORD PTR [edx*4+ebp],eax - nop - mov ebx, DWORD PTR [ebx*4+ebp] - mov eax, DWORD PTR [ecx*4+ebp] - mov BYTE PTR 2[esp],bl - ; Round 3 - add edx, eax - and edx, 255 - inc ecx - mov ebx, DWORD PTR [edx*4+ebp] - mov DWORD PTR [ecx*4+ebp-4],ebx - add ebx, eax - and ecx, 255 - and ebx, 255 - mov DWORD PTR [edx*4+ebp],eax - nop - mov ebx, DWORD PTR [ebx*4+ebp] - mov eax, DWORD PTR [ecx*4+ebp] - mov BYTE PTR 3[esp],bl - ; Round 4 - add edx, eax - and edx, 255 - inc ecx - mov ebx, DWORD PTR [edx*4+ebp] - mov DWORD PTR [ecx*4+ebp-4],ebx - add ebx, eax - and ecx, 255 - and ebx, 255 - mov DWORD PTR [edx*4+ebp],eax - nop - mov ebx, DWORD PTR [ebx*4+ebp] - mov eax, DWORD PTR [ecx*4+ebp] - mov BYTE PTR 4[esp],bl - ; Round 5 - add edx, eax - and edx, 255 - inc ecx - mov ebx, DWORD PTR [edx*4+ebp] - mov DWORD PTR [ecx*4+ebp-4],ebx - add ebx, eax - and ecx, 255 - and ebx, 255 - mov DWORD PTR [edx*4+ebp],eax - nop - mov ebx, DWORD PTR [ebx*4+ebp] - mov eax, DWORD PTR [ecx*4+ebp] - mov BYTE PTR 5[esp],bl - ; Round 6 - add edx, eax - and edx, 255 - inc ecx - mov ebx, DWORD PTR [edx*4+ebp] - mov DWORD PTR [ecx*4+ebp-4],ebx - add ebx, eax - and ecx, 255 - and ebx, 255 - mov DWORD PTR [edx*4+ebp],eax - nop - mov ebx, DWORD PTR [ebx*4+ebp] - mov eax, DWORD PTR [ecx*4+ebp] - mov BYTE PTR 6[esp],bl - ; Round 7 - add edx, eax - and edx, 255 - inc ecx - mov ebx, DWORD PTR [edx*4+ebp] - mov DWORD PTR [ecx*4+ebp-4],ebx - add ebx, eax - and ecx, 255 - and ebx, 255 - mov DWORD PTR [edx*4+ebp],eax - nop - mov ebx, DWORD PTR [ebx*4+ebp] - add edi, 8 - mov BYTE PTR 7[esp],bl - ; apply the cipher text - mov eax, DWORD PTR [esp] - mov ebx, DWORD PTR [esi-8] - xor eax, ebx - mov ebx, DWORD PTR [esi-4] - mov DWORD PTR [edi-8],eax - mov eax, DWORD PTR 4[esp] - xor eax, ebx - mov ebx, DWORD PTR 8[esp] - mov DWORD PTR [edi-4],eax - mov eax, DWORD PTR [ecx*4+ebp] - cmp esi, ebx - jle L001start -$L000end: - ; Round 0 - add ebx, 8 - inc esi - cmp ebx, esi - jl $L002finished - mov DWORD PTR 8[esp],ebx - add edx, eax - and edx, 255 - inc ecx - mov ebx, DWORD PTR [edx*4+ebp] - mov DWORD PTR [ecx*4+ebp-4],ebx - add ebx, eax - and ecx, 255 - and ebx, 255 - mov DWORD PTR [edx*4+ebp],eax - nop - mov ebx, DWORD PTR [ebx*4+ebp] - mov eax, DWORD PTR [ecx*4+ebp] - mov bh, BYTE PTR [esi-1] - xor bl, bh - mov BYTE PTR [edi], bl - ; Round 1 - mov ebx, DWORD PTR 8[esp] - cmp ebx, esi - jle $L002finished - inc esi - add edx, eax - and edx, 255 - inc ecx - mov ebx, DWORD PTR [edx*4+ebp] - mov DWORD PTR [ecx*4+ebp-4],ebx - add ebx, eax - and ecx, 255 - and ebx, 255 - mov DWORD PTR [edx*4+ebp],eax - nop - mov ebx, DWORD PTR [ebx*4+ebp] - mov eax, DWORD PTR [ecx*4+ebp] - mov bh, BYTE PTR [esi-1] - xor bl, bh - mov BYTE PTR 1[edi],bl - ; Round 2 - mov ebx, DWORD PTR 8[esp] - cmp ebx, esi - jle $L002finished - inc esi - add edx, eax - and edx, 255 - inc ecx - mov ebx, DWORD PTR [edx*4+ebp] - mov DWORD PTR [ecx*4+ebp-4],ebx - add ebx, eax - and ecx, 255 - and ebx, 255 - mov DWORD PTR [edx*4+ebp],eax - nop - mov ebx, DWORD PTR [ebx*4+ebp] - mov eax, DWORD PTR [ecx*4+ebp] - mov bh, BYTE PTR [esi-1] - xor bl, bh - mov BYTE PTR 2[edi],bl - ; Round 3 - mov ebx, DWORD PTR 8[esp] - cmp ebx, esi - jle $L002finished - inc esi - add edx, eax - and edx, 255 - inc ecx - mov ebx, DWORD PTR [edx*4+ebp] - mov DWORD PTR [ecx*4+ebp-4],ebx - add ebx, eax - and ecx, 255 - and ebx, 255 - mov DWORD PTR [edx*4+ebp],eax - nop - mov ebx, DWORD PTR [ebx*4+ebp] - mov eax, DWORD PTR [ecx*4+ebp] - mov bh, BYTE PTR [esi-1] - xor bl, bh - mov BYTE PTR 3[edi],bl - ; Round 4 - mov ebx, DWORD PTR 8[esp] - cmp ebx, esi - jle $L002finished - inc esi - add edx, eax - and edx, 255 - inc ecx - mov ebx, DWORD PTR [edx*4+ebp] - mov DWORD PTR [ecx*4+ebp-4],ebx - add ebx, eax - and ecx, 255 - and ebx, 255 - mov DWORD PTR [edx*4+ebp],eax - nop - mov ebx, DWORD PTR [ebx*4+ebp] - mov eax, DWORD PTR [ecx*4+ebp] - mov bh, BYTE PTR [esi-1] - xor bl, bh - mov BYTE PTR 4[edi],bl - ; Round 5 - mov ebx, DWORD PTR 8[esp] - cmp ebx, esi - jle $L002finished - inc esi - add edx, eax - and edx, 255 - inc ecx - mov ebx, DWORD PTR [edx*4+ebp] - mov DWORD PTR [ecx*4+ebp-4],ebx - add ebx, eax - and ecx, 255 - and ebx, 255 - mov DWORD PTR [edx*4+ebp],eax - nop - mov ebx, DWORD PTR [ebx*4+ebp] - mov eax, DWORD PTR [ecx*4+ebp] - mov bh, BYTE PTR [esi-1] - xor bl, bh - mov BYTE PTR 5[edi],bl - ; Round 6 - mov ebx, DWORD PTR 8[esp] - cmp ebx, esi - jle $L002finished - inc esi - add edx, eax - and edx, 255 - inc ecx - mov ebx, DWORD PTR [edx*4+ebp] - mov DWORD PTR [ecx*4+ebp-4],ebx - add ebx, eax - and ecx, 255 - and ebx, 255 - mov DWORD PTR [edx*4+ebp],eax - nop - mov ebx, DWORD PTR [ebx*4+ebp] - mov bh, BYTE PTR [esi-1] - xor bl, bh - mov BYTE PTR 6[edi],bl -$L002finished: - dec ecx - add esp, 12 - mov DWORD PTR [ebp-4],edx - mov BYTE PTR [ebp-8],cl - pop edi - pop esi - pop ebx - pop ebp - ret -_RC4 ENDP -_TEXT ENDS -END diff --git a/src/lib/libcrypto/rc5/Makefile.ssl b/src/lib/libcrypto/rc5/Makefile.ssl index 35abb9d0d1..5a54a162ba 100644 --- a/src/lib/libcrypto/rc5/Makefile.ssl +++ b/src/lib/libcrypto/rc5/Makefile.ssl @@ -49,7 +49,7 @@ lib: $(LIBOBJ) # elf asm/r586-elf.o: asm/r586unix.cpp - $(CPP) -DELF asm/r586unix.cpp | as -o asm/r586-elf.o + $(CPP) -DELF -x c asm/r586unix.cpp | as -o asm/r586-elf.o # solaris asm/r586-sol.o: asm/r586unix.cpp @@ -65,7 +65,7 @@ asm/r586-out.o: asm/r586unix.cpp asm/r586bsdi.o: asm/r586unix.cpp $(CPP) -DBSDI asm/r586unix.cpp | sed 's/ :/:/' | as -o asm/r586bsdi.o -asm/r586unix.cpp: +asm/r586unix.cpp: asm/rc5-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl (cd asm; $(PERL) rc5-586.pl cpp >r586unix.cpp) files: diff --git a/src/lib/libcrypto/rc5/Makefile.uni b/src/lib/libcrypto/rc5/Makefile.uni index 4dc20c6fcf..e69de29bb2 100644 --- a/src/lib/libcrypto/rc5/Makefile.uni +++ b/src/lib/libcrypto/rc5/Makefile.uni @@ -1,73 +0,0 @@ -# Targets -# make - twidle the options yourself :-) -# make cc - standard cc options -# make gcc - standard gcc options - -DIR= rc2 -TOP= . -CC= gcc -CFLAG= -O3 -fomit-frame-pointer - -CPP= $(CC) -E -INCLUDES= -INSTALLTOP=/usr/local/lib -MAKE= make -MAKEDEPEND= makedepend -MAKEFILE= Makefile.uni -AR= ar r -RANLIB= ranlib - -IDEA_ENC=rc2_cbc.o - -CFLAGS= $(INCLUDES) $(CFLAG) - -GENERAL=Makefile -TEST=rc2test -APPS=rc2speed - -LIB=librc2.a -LIBSRC=rc2_skey.c rc2_ecb.c rc2_cbc.c rc2cfb64.c rc2ofb64.c -LIBOBJ=rc2_skey.o rc2_ecb.o $(IDEA_ENC) rc2cfb64.o rc2ofb64.o - -SRC= $(LIBSRC) - -EXHEADER= rc2.h -HEADER= rc2_locl.h $(EXHEADER) - -ALL= $(GENERAL) $(SRC) $(HEADER) - -all: $(LIB) $(TEST) $(APPS) - -$(LIB): $(LIBOBJ) - $(AR) $(LIB) $(LIBOBJ) - $(RANLIB) $(LIB) - -test: $(TEST) - ./$(TEST) - -$(TEST): $(TEST).c $(LIB) - $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) - -$(APPS): $(APPS).c $(LIB) - $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) - -lint: - lint -DLINT $(INCLUDES) $(SRC)>fluff - -depend: - $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) - -dclean: - perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new - mv -f Makefile.new $(MAKEFILE) - -clean: - /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff - -cc: - $(MAKE) CC="cc" CFLAG="-O" all - -gcc: - $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/rc5/asm/r5-win32.asm b/src/lib/libcrypto/rc5/asm/r5-win32.asm index f43d3711f0..e69de29bb2 100644 --- a/src/lib/libcrypto/rc5/asm/r5-win32.asm +++ b/src/lib/libcrypto/rc5/asm/r5-win32.asm @@ -1,574 +0,0 @@ - ; Don't even think of reading this code - ; It was automatically generated by rc5-586.pl - ; Which is a perl program used to generate the x86 assember for - ; any of elf, a.out, BSDI,Win32, or Solaris - ; eric - ; - TITLE rc5-586.asm - .386 -.model FLAT -_TEXT SEGMENT -PUBLIC _RC5_32_encrypt - -_RC5_32_encrypt PROC NEAR - ; - push ebp - push esi - push edi - mov edx, DWORD PTR 16[esp] - mov ebp, DWORD PTR 20[esp] - ; Load the 2 words - mov edi, DWORD PTR [edx] - mov esi, DWORD PTR 4[edx] - push ebx - mov ebx, DWORD PTR [ebp] - add edi, DWORD PTR 4[ebp] - add esi, DWORD PTR 8[ebp] - xor edi, esi - mov eax, DWORD PTR 12[ebp] - mov ecx, esi - rol edi, cl - add edi, eax - xor esi, edi - mov eax, DWORD PTR 16[ebp] - mov ecx, edi - rol esi, cl - add esi, eax - xor edi, esi - mov eax, DWORD PTR 20[ebp] - mov ecx, esi - rol edi, cl - add edi, eax - xor esi, edi - mov eax, DWORD PTR 24[ebp] - mov ecx, edi - rol esi, cl - add esi, eax - xor edi, esi - mov eax, DWORD PTR 28[ebp] - mov ecx, esi - rol edi, cl - add edi, eax - xor esi, edi - mov eax, DWORD PTR 32[ebp] - mov ecx, edi - rol esi, cl - add esi, eax - xor edi, esi - mov eax, DWORD PTR 36[ebp] - mov ecx, esi - rol edi, cl - add edi, eax - xor esi, edi - mov eax, DWORD PTR 40[ebp] - mov ecx, edi - rol esi, cl - add esi, eax - xor edi, esi - mov eax, DWORD PTR 44[ebp] - mov ecx, esi - rol edi, cl - add edi, eax - xor esi, edi - mov eax, DWORD PTR 48[ebp] - mov ecx, edi - rol esi, cl - add esi, eax - xor edi, esi - mov eax, DWORD PTR 52[ebp] - mov ecx, esi - rol edi, cl - add edi, eax - xor esi, edi - mov eax, DWORD PTR 56[ebp] - mov ecx, edi - rol esi, cl - add esi, eax - xor edi, esi - mov eax, DWORD PTR 60[ebp] - mov ecx, esi - rol edi, cl - add edi, eax - xor esi, edi - mov eax, DWORD PTR 64[ebp] - mov ecx, edi - rol esi, cl - add esi, eax - xor edi, esi - mov eax, DWORD PTR 68[ebp] - mov ecx, esi - rol edi, cl - add edi, eax - xor esi, edi - mov eax, DWORD PTR 72[ebp] - mov ecx, edi - rol esi, cl - add esi, eax - cmp ebx, 8 - je $L000rc5_exit - xor edi, esi - mov eax, DWORD PTR 76[ebp] - mov ecx, esi - rol edi, cl - add edi, eax - xor esi, edi - mov eax, DWORD PTR 80[ebp] - mov ecx, edi - rol esi, cl - add esi, eax - xor edi, esi - mov eax, DWORD PTR 84[ebp] - mov ecx, esi - rol edi, cl - add edi, eax - xor esi, edi - mov eax, DWORD PTR 88[ebp] - mov ecx, edi - rol esi, cl - add esi, eax - xor edi, esi - mov eax, DWORD PTR 92[ebp] - mov ecx, esi - rol edi, cl - add edi, eax - xor esi, edi - mov eax, DWORD PTR 96[ebp] - mov ecx, edi - rol esi, cl - add esi, eax - xor edi, esi - mov eax, DWORD PTR 100[ebp] - mov ecx, esi - rol edi, cl - add edi, eax - xor esi, edi - mov eax, DWORD PTR 104[ebp] - mov ecx, edi - rol esi, cl - add esi, eax - cmp ebx, 12 - je $L000rc5_exit - xor edi, esi - mov eax, DWORD PTR 108[ebp] - mov ecx, esi - rol edi, cl - add edi, eax - xor esi, edi - mov eax, DWORD PTR 112[ebp] - mov ecx, edi - rol esi, cl - add esi, eax - xor edi, esi - mov eax, DWORD PTR 116[ebp] - mov ecx, esi - rol edi, cl - add edi, eax - xor esi, edi - mov eax, DWORD PTR 120[ebp] - mov ecx, edi - rol esi, cl - add esi, eax - xor edi, esi - mov eax, DWORD PTR 124[ebp] - mov ecx, esi - rol edi, cl - add edi, eax - xor esi, edi - mov eax, DWORD PTR 128[ebp] - mov ecx, edi - rol esi, cl - add esi, eax - xor edi, esi - mov eax, DWORD PTR 132[ebp] - mov ecx, esi - rol edi, cl - add edi, eax - xor esi, edi - mov eax, DWORD PTR 136[ebp] - mov ecx, edi - rol esi, cl - add esi, eax -$L000rc5_exit: - mov DWORD PTR [edx],edi - mov DWORD PTR 4[edx],esi - pop ebx - pop edi - pop esi - pop ebp - ret -_RC5_32_encrypt ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _RC5_32_decrypt - -_RC5_32_decrypt PROC NEAR - ; - push ebp - push esi - push edi - mov edx, DWORD PTR 16[esp] - mov ebp, DWORD PTR 20[esp] - ; Load the 2 words - mov edi, DWORD PTR [edx] - mov esi, DWORD PTR 4[edx] - push ebx - mov ebx, DWORD PTR [ebp] - cmp ebx, 12 - je $L001rc5_dec_12 - cmp ebx, 8 - je $L002rc5_dec_8 - mov eax, DWORD PTR 136[ebp] - sub esi, eax - mov ecx, edi - ror esi, cl - xor esi, edi - mov eax, DWORD PTR 132[ebp] - sub edi, eax - mov ecx, esi - ror edi, cl - xor edi, esi - mov eax, DWORD PTR 128[ebp] - sub esi, eax - mov ecx, edi - ror esi, cl - xor esi, edi - mov eax, DWORD PTR 124[ebp] - sub edi, eax - mov ecx, esi - ror edi, cl - xor edi, esi - mov eax, DWORD PTR 120[ebp] - sub esi, eax - mov ecx, edi - ror esi, cl - xor esi, edi - mov eax, DWORD PTR 116[ebp] - sub edi, eax - mov ecx, esi - ror edi, cl - xor edi, esi - mov eax, DWORD PTR 112[ebp] - sub esi, eax - mov ecx, edi - ror esi, cl - xor esi, edi - mov eax, DWORD PTR 108[ebp] - sub edi, eax - mov ecx, esi - ror edi, cl - xor edi, esi -$L001rc5_dec_12: - mov eax, DWORD PTR 104[ebp] - sub esi, eax - mov ecx, edi - ror esi, cl - xor esi, edi - mov eax, DWORD PTR 100[ebp] - sub edi, eax - mov ecx, esi - ror edi, cl - xor edi, esi - mov eax, DWORD PTR 96[ebp] - sub esi, eax - mov ecx, edi - ror esi, cl - xor esi, edi - mov eax, DWORD PTR 92[ebp] - sub edi, eax - mov ecx, esi - ror edi, cl - xor edi, esi - mov eax, DWORD PTR 88[ebp] - sub esi, eax - mov ecx, edi - ror esi, cl - xor esi, edi - mov eax, DWORD PTR 84[ebp] - sub edi, eax - mov ecx, esi - ror edi, cl - xor edi, esi - mov eax, DWORD PTR 80[ebp] - sub esi, eax - mov ecx, edi - ror esi, cl - xor esi, edi - mov eax, DWORD PTR 76[ebp] - sub edi, eax - mov ecx, esi - ror edi, cl - xor edi, esi -$L002rc5_dec_8: - mov eax, DWORD PTR 72[ebp] - sub esi, eax - mov ecx, edi - ror esi, cl - xor esi, edi - mov eax, DWORD PTR 68[ebp] - sub edi, eax - mov ecx, esi - ror edi, cl - xor edi, esi - mov eax, DWORD PTR 64[ebp] - sub esi, eax - mov ecx, edi - ror esi, cl - xor esi, edi - mov eax, DWORD PTR 60[ebp] - sub edi, eax - mov ecx, esi - ror edi, cl - xor edi, esi - mov eax, DWORD PTR 56[ebp] - sub esi, eax - mov ecx, edi - ror esi, cl - xor esi, edi - mov eax, DWORD PTR 52[ebp] - sub edi, eax - mov ecx, esi - ror edi, cl - xor edi, esi - mov eax, DWORD PTR 48[ebp] - sub esi, eax - mov ecx, edi - ror esi, cl - xor esi, edi - mov eax, DWORD PTR 44[ebp] - sub edi, eax - mov ecx, esi - ror edi, cl - xor edi, esi - mov eax, DWORD PTR 40[ebp] - sub esi, eax - mov ecx, edi - ror esi, cl - xor esi, edi - mov eax, DWORD PTR 36[ebp] - sub edi, eax - mov ecx, esi - ror edi, cl - xor edi, esi - mov eax, DWORD PTR 32[ebp] - sub esi, eax - mov ecx, edi - ror esi, cl - xor esi, edi - mov eax, DWORD PTR 28[ebp] - sub edi, eax - mov ecx, esi - ror edi, cl - xor edi, esi - mov eax, DWORD PTR 24[ebp] - sub esi, eax - mov ecx, edi - ror esi, cl - xor esi, edi - mov eax, DWORD PTR 20[ebp] - sub edi, eax - mov ecx, esi - ror edi, cl - xor edi, esi - mov eax, DWORD PTR 16[ebp] - sub esi, eax - mov ecx, edi - ror esi, cl - xor esi, edi - mov eax, DWORD PTR 12[ebp] - sub edi, eax - mov ecx, esi - ror edi, cl - xor edi, esi - sub esi, DWORD PTR 8[ebp] - sub edi, DWORD PTR 4[ebp] -L003rc5_exit: - mov DWORD PTR [edx],edi - mov DWORD PTR 4[edx],esi - pop ebx - pop edi - pop esi - pop ebp - ret -_RC5_32_decrypt ENDP -_TEXT ENDS -_TEXT SEGMENT -PUBLIC _RC5_32_cbc_encrypt - -_RC5_32_cbc_encrypt PROC NEAR - ; - push ebp - push ebx - push esi - push edi - mov ebp, DWORD PTR 28[esp] - ; getting iv ptr from parameter 4 - mov ebx, DWORD PTR 36[esp] - mov esi, DWORD PTR [ebx] - mov edi, DWORD PTR 4[ebx] - push edi - push esi - push edi - push esi - mov ebx, esp - mov esi, DWORD PTR 36[esp] - mov edi, DWORD PTR 40[esp] - ; getting encrypt flag from parameter 5 - mov ecx, DWORD PTR 56[esp] - ; get and push parameter 3 - mov eax, DWORD PTR 48[esp] - push eax - push ebx - cmp ecx, 0 - jz $L004decrypt - and ebp, 4294967288 - mov eax, DWORD PTR 8[esp] - mov ebx, DWORD PTR 12[esp] - jz $L005encrypt_finish -L006encrypt_loop: - mov ecx, DWORD PTR [esi] - mov edx, DWORD PTR 4[esi] - xor eax, ecx - xor ebx, edx - mov DWORD PTR 8[esp],eax - mov DWORD PTR 12[esp],ebx - call _RC5_32_encrypt - mov eax, DWORD PTR 8[esp] - mov ebx, DWORD PTR 12[esp] - mov DWORD PTR [edi],eax - mov DWORD PTR 4[edi],ebx - add esi, 8 - add edi, 8 - sub ebp, 8 - jnz L006encrypt_loop -$L005encrypt_finish: - mov ebp, DWORD PTR 52[esp] - and ebp, 7 - jz $L007finish - xor ecx, ecx - xor edx, edx - mov ebp, DWORD PTR $L008cbc_enc_jmp_table[ebp*4] - jmp ebp -L009ej7: - mov dh, BYTE PTR 6[esi] - shl edx, 8 -L010ej6: - mov dh, BYTE PTR 5[esi] -L011ej5: - mov dl, BYTE PTR 4[esi] -L012ej4: - mov ecx, DWORD PTR [esi] - jmp $L013ejend -L014ej3: - mov ch, BYTE PTR 2[esi] - shl ecx, 8 -L015ej2: - mov ch, BYTE PTR 1[esi] -L016ej1: - mov cl, BYTE PTR [esi] -$L013ejend: - xor eax, ecx - xor ebx, edx - mov DWORD PTR 8[esp],eax - mov DWORD PTR 12[esp],ebx - call _RC5_32_encrypt - mov eax, DWORD PTR 8[esp] - mov ebx, DWORD PTR 12[esp] - mov DWORD PTR [edi],eax - mov DWORD PTR 4[edi],ebx - jmp $L007finish -$L004decrypt: - and ebp, 4294967288 - mov eax, DWORD PTR 16[esp] - mov ebx, DWORD PTR 20[esp] - jz $L017decrypt_finish -L018decrypt_loop: - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] - mov DWORD PTR 8[esp],eax - mov DWORD PTR 12[esp],ebx - call _RC5_32_decrypt - mov eax, DWORD PTR 8[esp] - mov ebx, DWORD PTR 12[esp] - mov ecx, DWORD PTR 16[esp] - mov edx, DWORD PTR 20[esp] - xor ecx, eax - xor edx, ebx - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] - mov DWORD PTR [edi],ecx - mov DWORD PTR 4[edi],edx - mov DWORD PTR 16[esp],eax - mov DWORD PTR 20[esp],ebx - add esi, 8 - add edi, 8 - sub ebp, 8 - jnz L018decrypt_loop -$L017decrypt_finish: - mov ebp, DWORD PTR 52[esp] - and ebp, 7 - jz $L007finish - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] - mov DWORD PTR 8[esp],eax - mov DWORD PTR 12[esp],ebx - call _RC5_32_decrypt - mov eax, DWORD PTR 8[esp] - mov ebx, DWORD PTR 12[esp] - mov ecx, DWORD PTR 16[esp] - mov edx, DWORD PTR 20[esp] - xor ecx, eax - xor edx, ebx - mov eax, DWORD PTR [esi] - mov ebx, DWORD PTR 4[esi] -L019dj7: - ror edx, 16 - mov BYTE PTR 6[edi],dl - shr edx, 16 -L020dj6: - mov BYTE PTR 5[edi],dh -L021dj5: - mov BYTE PTR 4[edi],dl -L022dj4: - mov DWORD PTR [edi],ecx - jmp $L023djend -L024dj3: - ror ecx, 16 - mov BYTE PTR 2[edi],cl - shl ecx, 16 -L025dj2: - mov BYTE PTR 1[esi],ch -L026dj1: - mov BYTE PTR [esi], cl -$L023djend: - jmp $L007finish -$L007finish: - mov ecx, DWORD PTR 60[esp] - add esp, 24 - mov DWORD PTR [ecx],eax - mov DWORD PTR 4[ecx],ebx - pop edi - pop esi - pop ebx - pop ebp - ret -$L008cbc_enc_jmp_table: - DD 0 - DD L016ej1 - DD L015ej2 - DD L014ej3 - DD L012ej4 - DD L011ej5 - DD L010ej6 - DD L009ej7 -L027cbc_dec_jmp_table: - DD 0 - DD L026dj1 - DD L025dj2 - DD L024dj3 - DD L022dj4 - DD L021dj5 - DD L020dj6 - DD L019dj7 -_RC5_32_cbc_encrypt ENDP -_TEXT ENDS -END diff --git a/src/lib/libcrypto/ripemd/Makefile.ssl b/src/lib/libcrypto/ripemd/Makefile.ssl index c6153d4361..6ada9f067b 100644 --- a/src/lib/libcrypto/ripemd/Makefile.ssl +++ b/src/lib/libcrypto/ripemd/Makefile.ssl @@ -47,7 +47,7 @@ lib: $(LIBOBJ) # elf asm/rm86-elf.o: asm/rm86unix.cpp - $(CPP) -DELF asm/rm86unix.cpp | as -o asm/rm86-elf.o + $(CPP) -DELF -x c asm/rm86unix.cpp | as -o asm/rm86-elf.o # solaris asm/rm86-sol.o: asm/rm86unix.cpp @@ -63,7 +63,7 @@ asm/rm86-out.o: asm/rm86unix.cpp asm/rm86bsdi.o: asm/rm86unix.cpp $(CPP) -DBSDI asm/rm86unix.cpp | sed 's/ :/:/' | as -o asm/rm86bsdi.o -asm/rm86unix.cpp: asm/rmd-586.pl +asm/rm86unix.cpp: asm/rmd-586.pl ../perlasm/x86asm.pl (cd asm; $(PERL) rmd-586.pl cpp >rm86unix.cpp) files: diff --git a/src/lib/libcrypto/ripemd/Makefile.uni b/src/lib/libcrypto/ripemd/Makefile.uni index 5310020eb1..e69de29bb2 100644 --- a/src/lib/libcrypto/ripemd/Makefile.uni +++ b/src/lib/libcrypto/ripemd/Makefile.uni @@ -1,109 +0,0 @@ -# Targets -# make - twidle the options yourself :-) -# make cc - standard cc options -# make gcc - standard gcc options -# make x86-elf - linux-elf etc -# make x86-out - linux-a.out, FreeBSD etc -# make x86-solaris -# make x86-bdsi - -DIR= md5 -TOP= . -CC= gcc -CFLAG= -O3 -fomit-frame-pointer - -CPP= $(CC) -E -INCLUDES= -INSTALLTOP=/usr/local/lib -MAKE= make -MAKEDEPEND= makedepend -MAKEFILE= Makefile.uni -AR= ar r - -MD5_ASM_OBJ= - -CFLAGS= $(INCLUDES) $(CFLAG) - -GENERAL=Makefile -TEST=md5test -APPS=md5 - -LIB=libmd5.a -LIBSRC=md5_dgst.c md5_one.c -LIBOBJ=md5_dgst.o md5_one.o $(MD5_ASM_OBJ) - -SRC= $(LIBSRC) - -EXHEADER= md5.h -HEADER= md5_locl.h $(EXHEADER) - -ALL= $(GENERAL) $(SRC) $(HEADER) - -all: $(LIB) $(TEST) $(APPS) - -$(LIB): $(LIBOBJ) - $(AR) $(LIB) $(LIBOBJ) - $(RANLIB) $(LIB) - -# elf -asm/mx86-elf.o: asm/mx86unix.cpp - $(CPP) -DELF asm/mx86unix.cpp | as -o asm/mx86-elf.o - -# solaris -asm/mx86-sol.o: asm/mx86unix.cpp - $(CC) -E -DSOL asm/mx86unix.cpp | sed 's/^#.*//' > asm/mx86-sol.s - as -o asm/mx86-sol.o asm/mx86-sol.s - rm -f asm/mx86-sol.s - -# a.out -asm/mx86-out.o: asm/mx86unix.cpp - $(CPP) -DOUT asm/mx86unix.cpp | as -o asm/mx86-out.o - -# bsdi -asm/mx86bsdi.o: asm/mx86unix.cpp - $(CPP) -DBSDI asm/mx86unix.cpp | as -o asm/mx86bsdi.o - -asm/mx86unix.cpp: - (cd asm; perl md5-586.pl cpp >mx86unix.cpp) - -test: $(TEST) - ./$(TEST) - -$(TEST): $(TEST).c $(LIB) - $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) - -$(APPS): $(APPS).c $(LIB) - $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) - -lint: - lint -DLINT $(INCLUDES) $(SRC)>fluff - -depend: - $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) - -dclean: - perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new - mv -f Makefile.new $(MAKEFILE) - -clean: - /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff - -cc: - $(MAKE) MD5_ASM_OBJ="" CC="cc" CFLAG="-O" all - -gcc: - $(MAKE) MD5_ASM_OBJ="" CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all - -x86-elf: - $(MAKE) MD5_ASM_OBJ="asm/mx86-elf.o" CFLAG="-DELF -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all - -x86-out: - $(MAKE) MD5_ASM_OBJ="asm/mx86-out.o" CFLAG="-DOUT -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all - -x86-solaris: - $(MAKE) MD5_ASM_OBJ="asm/mx86-sol.o" CFLAG="-DSOL -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all - -x86-bdsi: - $(MAKE) MD5_ASM_OBJ="asm/mx86-bdsi.o" CFLAG="-DBDSI -DMD5_ASM -DL_ENDIAN $(CFLAGS)" all - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/ripemd/asm/rm-win32.asm b/src/lib/libcrypto/ripemd/asm/rm-win32.asm index f07d517857..e69de29bb2 100644 --- a/src/lib/libcrypto/ripemd/asm/rm-win32.asm +++ b/src/lib/libcrypto/ripemd/asm/rm-win32.asm @@ -1,1973 +0,0 @@ - ; Don't even think of reading this code - ; It was automatically generated by rmd-586.pl - ; Which is a perl program used to generate the x86 assember for - ; any of elf, a.out, BSDI,Win32, or Solaris - ; eric - ; - TITLE rmd-586.asm - .386 -.model FLAT -_TEXT SEGMENT -PUBLIC _ripemd160_block_asm_host_order - -_ripemd160_block_asm_host_order PROC NEAR - mov edx, DWORD PTR 4[esp] - mov eax, DWORD PTR 8[esp] - push esi - mov ecx, DWORD PTR [edx] - push edi - mov esi, DWORD PTR 4[edx] - push ebp - mov edi, DWORD PTR 8[edx] - push ebx - sub esp, 108 -L000start: - ; - mov ebx, DWORD PTR [eax] - mov ebp, DWORD PTR 4[eax] - mov DWORD PTR [esp],ebx - mov DWORD PTR 4[esp],ebp - mov ebx, DWORD PTR 8[eax] - mov ebp, DWORD PTR 12[eax] - mov DWORD PTR 8[esp],ebx - mov DWORD PTR 12[esp],ebp - mov ebx, DWORD PTR 16[eax] - mov ebp, DWORD PTR 20[eax] - mov DWORD PTR 16[esp],ebx - mov DWORD PTR 20[esp],ebp - mov ebx, DWORD PTR 24[eax] - mov ebp, DWORD PTR 28[eax] - mov DWORD PTR 24[esp],ebx - mov DWORD PTR 28[esp],ebp - mov ebx, DWORD PTR 32[eax] - mov ebp, DWORD PTR 36[eax] - mov DWORD PTR 32[esp],ebx - mov DWORD PTR 36[esp],ebp - mov ebx, DWORD PTR 40[eax] - mov ebp, DWORD PTR 44[eax] - mov DWORD PTR 40[esp],ebx - mov DWORD PTR 44[esp],ebp - mov ebx, DWORD PTR 48[eax] - mov ebp, DWORD PTR 52[eax] - mov DWORD PTR 48[esp],ebx - mov DWORD PTR 52[esp],ebp - mov ebx, DWORD PTR 56[eax] - mov ebp, DWORD PTR 60[eax] - mov DWORD PTR 56[esp],ebx - mov DWORD PTR 60[esp],ebp - mov eax, edi - mov ebx, DWORD PTR 12[edx] - mov ebp, DWORD PTR 16[edx] - ; 0 - xor eax, ebx - mov edx, DWORD PTR [esp] - xor eax, esi - add ecx, edx - rol edi, 10 - add ecx, eax - mov eax, esi - rol ecx, 11 - add ecx, ebp - ; 1 - xor eax, edi - mov edx, DWORD PTR 4[esp] - xor eax, ecx - add ebp, eax - mov eax, ecx - rol esi, 10 - add ebp, edx - xor eax, esi - rol ebp, 14 - add ebp, ebx - ; 2 - mov edx, DWORD PTR 8[esp] - xor eax, ebp - add ebx, edx - rol ecx, 10 - add ebx, eax - mov eax, ebp - rol ebx, 15 - add ebx, edi - ; 3 - xor eax, ecx - mov edx, DWORD PTR 12[esp] - xor eax, ebx - add edi, eax - mov eax, ebx - rol ebp, 10 - add edi, edx - xor eax, ebp - rol edi, 12 - add edi, esi - ; 4 - mov edx, DWORD PTR 16[esp] - xor eax, edi - add esi, edx - rol ebx, 10 - add esi, eax - mov eax, edi - rol esi, 5 - add esi, ecx - ; 5 - xor eax, ebx - mov edx, DWORD PTR 20[esp] - xor eax, esi - add ecx, eax - mov eax, esi - rol edi, 10 - add ecx, edx - xor eax, edi - rol ecx, 8 - add ecx, ebp - ; 6 - mov edx, DWORD PTR 24[esp] - xor eax, ecx - add ebp, edx - rol esi, 10 - add ebp, eax - mov eax, ecx - rol ebp, 7 - add ebp, ebx - ; 7 - xor eax, esi - mov edx, DWORD PTR 28[esp] - xor eax, ebp - add ebx, eax - mov eax, ebp - rol ecx, 10 - add ebx, edx - xor eax, ecx - rol ebx, 9 - add ebx, edi - ; 8 - mov edx, DWORD PTR 32[esp] - xor eax, ebx - add edi, edx - rol ebp, 10 - add edi, eax - mov eax, ebx - rol edi, 11 - add edi, esi - ; 9 - xor eax, ebp - mov edx, DWORD PTR 36[esp] - xor eax, edi - add esi, eax - mov eax, edi - rol ebx, 10 - add esi, edx - xor eax, ebx - rol esi, 13 - add esi, ecx - ; 10 - mov edx, DWORD PTR 40[esp] - xor eax, esi - add ecx, edx - rol edi, 10 - add ecx, eax - mov eax, esi - rol ecx, 14 - add ecx, ebp - ; 11 - xor eax, edi - mov edx, DWORD PTR 44[esp] - xor eax, ecx - add ebp, eax - mov eax, ecx - rol esi, 10 - add ebp, edx - xor eax, esi - rol ebp, 15 - add ebp, ebx - ; 12 - mov edx, DWORD PTR 48[esp] - xor eax, ebp - add ebx, edx - rol ecx, 10 - add ebx, eax - mov eax, ebp - rol ebx, 6 - add ebx, edi - ; 13 - xor eax, ecx - mov edx, DWORD PTR 52[esp] - xor eax, ebx - add edi, eax - mov eax, ebx - rol ebp, 10 - add edi, edx - xor eax, ebp - rol edi, 7 - add edi, esi - ; 14 - mov edx, DWORD PTR 56[esp] - xor eax, edi - add esi, edx - rol ebx, 10 - add esi, eax - mov eax, edi - rol esi, 9 - add esi, ecx - ; 15 - xor eax, ebx - mov edx, DWORD PTR 60[esp] - xor eax, esi - add ecx, eax - mov eax, -1 - rol edi, 10 - add ecx, edx - mov edx, DWORD PTR 28[esp] - rol ecx, 8 - add ecx, ebp - ; 16 - add ebp, edx - mov edx, esi - sub eax, ecx - and edx, ecx - and eax, edi - or edx, eax - mov eax, DWORD PTR 16[esp] - rol esi, 10 - lea ebp, DWORD PTR 1518500249[edx*1+ebp] - mov edx, -1 - rol ebp, 7 - add ebp, ebx - ; 17 - add ebx, eax - mov eax, ecx - sub edx, ebp - and eax, ebp - and edx, esi - or eax, edx - mov edx, DWORD PTR 52[esp] - rol ecx, 10 - lea ebx, DWORD PTR 1518500249[eax*1+ebx] - mov eax, -1 - rol ebx, 6 - add ebx, edi - ; 18 - add edi, edx - mov edx, ebp - sub eax, ebx - and edx, ebx - and eax, ecx - or edx, eax - mov eax, DWORD PTR 4[esp] - rol ebp, 10 - lea edi, DWORD PTR 1518500249[edx*1+edi] - mov edx, -1 - rol edi, 8 - add edi, esi - ; 19 - add esi, eax - mov eax, ebx - sub edx, edi - and eax, edi - and edx, ebp - or eax, edx - mov edx, DWORD PTR 40[esp] - rol ebx, 10 - lea esi, DWORD PTR 1518500249[eax*1+esi] - mov eax, -1 - rol esi, 13 - add esi, ecx - ; 20 - add ecx, edx - mov edx, edi - sub eax, esi - and edx, esi - and eax, ebx - or edx, eax - mov eax, DWORD PTR 24[esp] - rol edi, 10 - lea ecx, DWORD PTR 1518500249[edx*1+ecx] - mov edx, -1 - rol ecx, 11 - add ecx, ebp - ; 21 - add ebp, eax - mov eax, esi - sub edx, ecx - and eax, ecx - and edx, edi - or eax, edx - mov edx, DWORD PTR 60[esp] - rol esi, 10 - lea ebp, DWORD PTR 1518500249[eax*1+ebp] - mov eax, -1 - rol ebp, 9 - add ebp, ebx - ; 22 - add ebx, edx - mov edx, ecx - sub eax, ebp - and edx, ebp - and eax, esi - or edx, eax - mov eax, DWORD PTR 12[esp] - rol ecx, 10 - lea ebx, DWORD PTR 1518500249[edx*1+ebx] - mov edx, -1 - rol ebx, 7 - add ebx, edi - ; 23 - add edi, eax - mov eax, ebp - sub edx, ebx - and eax, ebx - and edx, ecx - or eax, edx - mov edx, DWORD PTR 48[esp] - rol ebp, 10 - lea edi, DWORD PTR 1518500249[eax*1+edi] - mov eax, -1 - rol edi, 15 - add edi, esi - ; 24 - add esi, edx - mov edx, ebx - sub eax, edi - and edx, edi - and eax, ebp - or edx, eax - mov eax, DWORD PTR [esp] - rol ebx, 10 - lea esi, DWORD PTR 1518500249[edx*1+esi] - mov edx, -1 - rol esi, 7 - add esi, ecx - ; 25 - add ecx, eax - mov eax, edi - sub edx, esi - and eax, esi - and edx, ebx - or eax, edx - mov edx, DWORD PTR 36[esp] - rol edi, 10 - lea ecx, DWORD PTR 1518500249[eax*1+ecx] - mov eax, -1 - rol ecx, 12 - add ecx, ebp - ; 26 - add ebp, edx - mov edx, esi - sub eax, ecx - and edx, ecx - and eax, edi - or edx, eax - mov eax, DWORD PTR 20[esp] - rol esi, 10 - lea ebp, DWORD PTR 1518500249[edx*1+ebp] - mov edx, -1 - rol ebp, 15 - add ebp, ebx - ; 27 - add ebx, eax - mov eax, ecx - sub edx, ebp - and eax, ebp - and edx, esi - or eax, edx - mov edx, DWORD PTR 8[esp] - rol ecx, 10 - lea ebx, DWORD PTR 1518500249[eax*1+ebx] - mov eax, -1 - rol ebx, 9 - add ebx, edi - ; 28 - add edi, edx - mov edx, ebp - sub eax, ebx - and edx, ebx - and eax, ecx - or edx, eax - mov eax, DWORD PTR 56[esp] - rol ebp, 10 - lea edi, DWORD PTR 1518500249[edx*1+edi] - mov edx, -1 - rol edi, 11 - add edi, esi - ; 29 - add esi, eax - mov eax, ebx - sub edx, edi - and eax, edi - and edx, ebp - or eax, edx - mov edx, DWORD PTR 44[esp] - rol ebx, 10 - lea esi, DWORD PTR 1518500249[eax*1+esi] - mov eax, -1 - rol esi, 7 - add esi, ecx - ; 30 - add ecx, edx - mov edx, edi - sub eax, esi - and edx, esi - and eax, ebx - or edx, eax - mov eax, DWORD PTR 32[esp] - rol edi, 10 - lea ecx, DWORD PTR 1518500249[edx*1+ecx] - mov edx, -1 - rol ecx, 13 - add ecx, ebp - ; 31 - add ebp, eax - mov eax, esi - sub edx, ecx - and eax, ecx - and edx, edi - or eax, edx - mov edx, -1 - rol esi, 10 - lea ebp, DWORD PTR 1518500249[eax*1+ebp] - sub edx, ecx - rol ebp, 12 - add ebp, ebx - ; 32 - mov eax, DWORD PTR 12[esp] - or edx, ebp - add ebx, eax - xor edx, esi - mov eax, -1 - rol ecx, 10 - lea ebx, DWORD PTR 1859775393[edx*1+ebx] - sub eax, ebp - rol ebx, 11 - add ebx, edi - ; 33 - mov edx, DWORD PTR 40[esp] - or eax, ebx - add edi, edx - xor eax, ecx - mov edx, -1 - rol ebp, 10 - lea edi, DWORD PTR 1859775393[eax*1+edi] - sub edx, ebx - rol edi, 13 - add edi, esi - ; 34 - mov eax, DWORD PTR 56[esp] - or edx, edi - add esi, eax - xor edx, ebp - mov eax, -1 - rol ebx, 10 - lea esi, DWORD PTR 1859775393[edx*1+esi] - sub eax, edi - rol esi, 6 - add esi, ecx - ; 35 - mov edx, DWORD PTR 16[esp] - or eax, esi - add ecx, edx - xor eax, ebx - mov edx, -1 - rol edi, 10 - lea ecx, DWORD PTR 1859775393[eax*1+ecx] - sub edx, esi - rol ecx, 7 - add ecx, ebp - ; 36 - mov eax, DWORD PTR 36[esp] - or edx, ecx - add ebp, eax - xor edx, edi - mov eax, -1 - rol esi, 10 - lea ebp, DWORD PTR 1859775393[edx*1+ebp] - sub eax, ecx - rol ebp, 14 - add ebp, ebx - ; 37 - mov edx, DWORD PTR 60[esp] - or eax, ebp - add ebx, edx - xor eax, esi - mov edx, -1 - rol ecx, 10 - lea ebx, DWORD PTR 1859775393[eax*1+ebx] - sub edx, ebp - rol ebx, 9 - add ebx, edi - ; 38 - mov eax, DWORD PTR 32[esp] - or edx, ebx - add edi, eax - xor edx, ecx - mov eax, -1 - rol ebp, 10 - lea edi, DWORD PTR 1859775393[edx*1+edi] - sub eax, ebx - rol edi, 13 - add edi, esi - ; 39 - mov edx, DWORD PTR 4[esp] - or eax, edi - add esi, edx - xor eax, ebp - mov edx, -1 - rol ebx, 10 - lea esi, DWORD PTR 1859775393[eax*1+esi] - sub edx, edi - rol esi, 15 - add esi, ecx - ; 40 - mov eax, DWORD PTR 8[esp] - or edx, esi - add ecx, eax - xor edx, ebx - mov eax, -1 - rol edi, 10 - lea ecx, DWORD PTR 1859775393[edx*1+ecx] - sub eax, esi - rol ecx, 14 - add ecx, ebp - ; 41 - mov edx, DWORD PTR 28[esp] - or eax, ecx - add ebp, edx - xor eax, edi - mov edx, -1 - rol esi, 10 - lea ebp, DWORD PTR 1859775393[eax*1+ebp] - sub edx, ecx - rol ebp, 8 - add ebp, ebx - ; 42 - mov eax, DWORD PTR [esp] - or edx, ebp - add ebx, eax - xor edx, esi - mov eax, -1 - rol ecx, 10 - lea ebx, DWORD PTR 1859775393[edx*1+ebx] - sub eax, ebp - rol ebx, 13 - add ebx, edi - ; 43 - mov edx, DWORD PTR 24[esp] - or eax, ebx - add edi, edx - xor eax, ecx - mov edx, -1 - rol ebp, 10 - lea edi, DWORD PTR 1859775393[eax*1+edi] - sub edx, ebx - rol edi, 6 - add edi, esi - ; 44 - mov eax, DWORD PTR 52[esp] - or edx, edi - add esi, eax - xor edx, ebp - mov eax, -1 - rol ebx, 10 - lea esi, DWORD PTR 1859775393[edx*1+esi] - sub eax, edi - rol esi, 5 - add esi, ecx - ; 45 - mov edx, DWORD PTR 44[esp] - or eax, esi - add ecx, edx - xor eax, ebx - mov edx, -1 - rol edi, 10 - lea ecx, DWORD PTR 1859775393[eax*1+ecx] - sub edx, esi - rol ecx, 12 - add ecx, ebp - ; 46 - mov eax, DWORD PTR 20[esp] - or edx, ecx - add ebp, eax - xor edx, edi - mov eax, -1 - rol esi, 10 - lea ebp, DWORD PTR 1859775393[edx*1+ebp] - sub eax, ecx - rol ebp, 7 - add ebp, ebx - ; 47 - mov edx, DWORD PTR 48[esp] - or eax, ebp - add ebx, edx - xor eax, esi - mov edx, -1 - rol ecx, 10 - lea ebx, DWORD PTR 1859775393[eax*1+ebx] - mov eax, ecx - rol ebx, 5 - add ebx, edi - ; 48 - sub edx, ecx - and eax, ebx - and edx, ebp - or edx, eax - mov eax, DWORD PTR 4[esp] - rol ebp, 10 - lea edi, DWORD PTR 2400959708[edx+edi] - mov edx, -1 - add edi, eax - mov eax, ebp - rol edi, 11 - add edi, esi - ; 49 - sub edx, ebp - and eax, edi - and edx, ebx - or edx, eax - mov eax, DWORD PTR 36[esp] - rol ebx, 10 - lea esi, DWORD PTR 2400959708[edx+esi] - mov edx, -1 - add esi, eax - mov eax, ebx - rol esi, 12 - add esi, ecx - ; 50 - sub edx, ebx - and eax, esi - and edx, edi - or edx, eax - mov eax, DWORD PTR 44[esp] - rol edi, 10 - lea ecx, DWORD PTR 2400959708[edx+ecx] - mov edx, -1 - add ecx, eax - mov eax, edi - rol ecx, 14 - add ecx, ebp - ; 51 - sub edx, edi - and eax, ecx - and edx, esi - or edx, eax - mov eax, DWORD PTR 40[esp] - rol esi, 10 - lea ebp, DWORD PTR 2400959708[edx+ebp] - mov edx, -1 - add ebp, eax - mov eax, esi - rol ebp, 15 - add ebp, ebx - ; 52 - sub edx, esi - and eax, ebp - and edx, ecx - or edx, eax - mov eax, DWORD PTR [esp] - rol ecx, 10 - lea ebx, DWORD PTR 2400959708[edx+ebx] - mov edx, -1 - add ebx, eax - mov eax, ecx - rol ebx, 14 - add ebx, edi - ; 53 - sub edx, ecx - and eax, ebx - and edx, ebp - or edx, eax - mov eax, DWORD PTR 32[esp] - rol ebp, 10 - lea edi, DWORD PTR 2400959708[edx+edi] - mov edx, -1 - add edi, eax - mov eax, ebp - rol edi, 15 - add edi, esi - ; 54 - sub edx, ebp - and eax, edi - and edx, ebx - or edx, eax - mov eax, DWORD PTR 48[esp] - rol ebx, 10 - lea esi, DWORD PTR 2400959708[edx+esi] - mov edx, -1 - add esi, eax - mov eax, ebx - rol esi, 9 - add esi, ecx - ; 55 - sub edx, ebx - and eax, esi - and edx, edi - or edx, eax - mov eax, DWORD PTR 16[esp] - rol edi, 10 - lea ecx, DWORD PTR 2400959708[edx+ecx] - mov edx, -1 - add ecx, eax - mov eax, edi - rol ecx, 8 - add ecx, ebp - ; 56 - sub edx, edi - and eax, ecx - and edx, esi - or edx, eax - mov eax, DWORD PTR 52[esp] - rol esi, 10 - lea ebp, DWORD PTR 2400959708[edx+ebp] - mov edx, -1 - add ebp, eax - mov eax, esi - rol ebp, 9 - add ebp, ebx - ; 57 - sub edx, esi - and eax, ebp - and edx, ecx - or edx, eax - mov eax, DWORD PTR 12[esp] - rol ecx, 10 - lea ebx, DWORD PTR 2400959708[edx+ebx] - mov edx, -1 - add ebx, eax - mov eax, ecx - rol ebx, 14 - add ebx, edi - ; 58 - sub edx, ecx - and eax, ebx - and edx, ebp - or edx, eax - mov eax, DWORD PTR 28[esp] - rol ebp, 10 - lea edi, DWORD PTR 2400959708[edx+edi] - mov edx, -1 - add edi, eax - mov eax, ebp - rol edi, 5 - add edi, esi - ; 59 - sub edx, ebp - and eax, edi - and edx, ebx - or edx, eax - mov eax, DWORD PTR 60[esp] - rol ebx, 10 - lea esi, DWORD PTR 2400959708[edx+esi] - mov edx, -1 - add esi, eax - mov eax, ebx - rol esi, 6 - add esi, ecx - ; 60 - sub edx, ebx - and eax, esi - and edx, edi - or edx, eax - mov eax, DWORD PTR 56[esp] - rol edi, 10 - lea ecx, DWORD PTR 2400959708[edx+ecx] - mov edx, -1 - add ecx, eax - mov eax, edi - rol ecx, 8 - add ecx, ebp - ; 61 - sub edx, edi - and eax, ecx - and edx, esi - or edx, eax - mov eax, DWORD PTR 20[esp] - rol esi, 10 - lea ebp, DWORD PTR 2400959708[edx+ebp] - mov edx, -1 - add ebp, eax - mov eax, esi - rol ebp, 6 - add ebp, ebx - ; 62 - sub edx, esi - and eax, ebp - and edx, ecx - or edx, eax - mov eax, DWORD PTR 24[esp] - rol ecx, 10 - lea ebx, DWORD PTR 2400959708[edx+ebx] - mov edx, -1 - add ebx, eax - mov eax, ecx - rol ebx, 5 - add ebx, edi - ; 63 - sub edx, ecx - and eax, ebx - and edx, ebp - or edx, eax - mov eax, DWORD PTR 8[esp] - rol ebp, 10 - lea edi, DWORD PTR 2400959708[edx+edi] - mov edx, -1 - add edi, eax - sub edx, ebp - rol edi, 12 - add edi, esi - ; 64 - mov eax, DWORD PTR 16[esp] - or edx, ebx - add esi, eax - xor edx, edi - mov eax, -1 - rol ebx, 10 - lea esi, DWORD PTR 2840853838[edx*1+esi] - sub eax, ebx - rol esi, 9 - add esi, ecx - ; 65 - mov edx, DWORD PTR [esp] - or eax, edi - add ecx, edx - xor eax, esi - mov edx, -1 - rol edi, 10 - lea ecx, DWORD PTR 2840853838[eax*1+ecx] - sub edx, edi - rol ecx, 15 - add ecx, ebp - ; 66 - mov eax, DWORD PTR 20[esp] - or edx, esi - add ebp, eax - xor edx, ecx - mov eax, -1 - rol esi, 10 - lea ebp, DWORD PTR 2840853838[edx*1+ebp] - sub eax, esi - rol ebp, 5 - add ebp, ebx - ; 67 - mov edx, DWORD PTR 36[esp] - or eax, ecx - add ebx, edx - xor eax, ebp - mov edx, -1 - rol ecx, 10 - lea ebx, DWORD PTR 2840853838[eax*1+ebx] - sub edx, ecx - rol ebx, 11 - add ebx, edi - ; 68 - mov eax, DWORD PTR 28[esp] - or edx, ebp - add edi, eax - xor edx, ebx - mov eax, -1 - rol ebp, 10 - lea edi, DWORD PTR 2840853838[edx*1+edi] - sub eax, ebp - rol edi, 6 - add edi, esi - ; 69 - mov edx, DWORD PTR 48[esp] - or eax, ebx - add esi, edx - xor eax, edi - mov edx, -1 - rol ebx, 10 - lea esi, DWORD PTR 2840853838[eax*1+esi] - sub edx, ebx - rol esi, 8 - add esi, ecx - ; 70 - mov eax, DWORD PTR 8[esp] - or edx, edi - add ecx, eax - xor edx, esi - mov eax, -1 - rol edi, 10 - lea ecx, DWORD PTR 2840853838[edx*1+ecx] - sub eax, edi - rol ecx, 13 - add ecx, ebp - ; 71 - mov edx, DWORD PTR 40[esp] - or eax, esi - add ebp, edx - xor eax, ecx - mov edx, -1 - rol esi, 10 - lea ebp, DWORD PTR 2840853838[eax*1+ebp] - sub edx, esi - rol ebp, 12 - add ebp, ebx - ; 72 - mov eax, DWORD PTR 56[esp] - or edx, ecx - add ebx, eax - xor edx, ebp - mov eax, -1 - rol ecx, 10 - lea ebx, DWORD PTR 2840853838[edx*1+ebx] - sub eax, ecx - rol ebx, 5 - add ebx, edi - ; 73 - mov edx, DWORD PTR 4[esp] - or eax, ebp - add edi, edx - xor eax, ebx - mov edx, -1 - rol ebp, 10 - lea edi, DWORD PTR 2840853838[eax*1+edi] - sub edx, ebp - rol edi, 12 - add edi, esi - ; 74 - mov eax, DWORD PTR 12[esp] - or edx, ebx - add esi, eax - xor edx, edi - mov eax, -1 - rol ebx, 10 - lea esi, DWORD PTR 2840853838[edx*1+esi] - sub eax, ebx - rol esi, 13 - add esi, ecx - ; 75 - mov edx, DWORD PTR 32[esp] - or eax, edi - add ecx, edx - xor eax, esi - mov edx, -1 - rol edi, 10 - lea ecx, DWORD PTR 2840853838[eax*1+ecx] - sub edx, edi - rol ecx, 14 - add ecx, ebp - ; 76 - mov eax, DWORD PTR 44[esp] - or edx, esi - add ebp, eax - xor edx, ecx - mov eax, -1 - rol esi, 10 - lea ebp, DWORD PTR 2840853838[edx*1+ebp] - sub eax, esi - rol ebp, 11 - add ebp, ebx - ; 77 - mov edx, DWORD PTR 24[esp] - or eax, ecx - add ebx, edx - xor eax, ebp - mov edx, -1 - rol ecx, 10 - lea ebx, DWORD PTR 2840853838[eax*1+ebx] - sub edx, ecx - rol ebx, 8 - add ebx, edi - ; 78 - mov eax, DWORD PTR 60[esp] - or edx, ebp - add edi, eax - xor edx, ebx - mov eax, -1 - rol ebp, 10 - lea edi, DWORD PTR 2840853838[edx*1+edi] - sub eax, ebp - rol edi, 5 - add edi, esi - ; 79 - mov edx, DWORD PTR 52[esp] - or eax, ebx - add esi, edx - xor eax, edi - mov edx, DWORD PTR 128[esp] - rol ebx, 10 - lea esi, DWORD PTR 2840853838[eax*1+esi] - mov DWORD PTR 64[esp],ecx - rol esi, 6 - add esi, ecx - mov ecx, DWORD PTR [edx] - mov DWORD PTR 68[esp],esi - mov DWORD PTR 72[esp],edi - mov esi, DWORD PTR 4[edx] - mov DWORD PTR 76[esp],ebx - mov edi, DWORD PTR 8[edx] - mov DWORD PTR 80[esp],ebp - mov ebx, DWORD PTR 12[edx] - mov ebp, DWORD PTR 16[edx] - ; 80 - mov edx, -1 - sub edx, ebx - mov eax, DWORD PTR 20[esp] - or edx, edi - add ecx, eax - xor edx, esi - mov eax, -1 - rol edi, 10 - lea ecx, DWORD PTR 1352829926[edx*1+ecx] - sub eax, edi - rol ecx, 8 - add ecx, ebp - ; 81 - mov edx, DWORD PTR 56[esp] - or eax, esi - add ebp, edx - xor eax, ecx - mov edx, -1 - rol esi, 10 - lea ebp, DWORD PTR 1352829926[eax*1+ebp] - sub edx, esi - rol ebp, 9 - add ebp, ebx - ; 82 - mov eax, DWORD PTR 28[esp] - or edx, ecx - add ebx, eax - xor edx, ebp - mov eax, -1 - rol ecx, 10 - lea ebx, DWORD PTR 1352829926[edx*1+ebx] - sub eax, ecx - rol ebx, 9 - add ebx, edi - ; 83 - mov edx, DWORD PTR [esp] - or eax, ebp - add edi, edx - xor eax, ebx - mov edx, -1 - rol ebp, 10 - lea edi, DWORD PTR 1352829926[eax*1+edi] - sub edx, ebp - rol edi, 11 - add edi, esi - ; 84 - mov eax, DWORD PTR 36[esp] - or edx, ebx - add esi, eax - xor edx, edi - mov eax, -1 - rol ebx, 10 - lea esi, DWORD PTR 1352829926[edx*1+esi] - sub eax, ebx - rol esi, 13 - add esi, ecx - ; 85 - mov edx, DWORD PTR 8[esp] - or eax, edi - add ecx, edx - xor eax, esi - mov edx, -1 - rol edi, 10 - lea ecx, DWORD PTR 1352829926[eax*1+ecx] - sub edx, edi - rol ecx, 15 - add ecx, ebp - ; 86 - mov eax, DWORD PTR 44[esp] - or edx, esi - add ebp, eax - xor edx, ecx - mov eax, -1 - rol esi, 10 - lea ebp, DWORD PTR 1352829926[edx*1+ebp] - sub eax, esi - rol ebp, 15 - add ebp, ebx - ; 87 - mov edx, DWORD PTR 16[esp] - or eax, ecx - add ebx, edx - xor eax, ebp - mov edx, -1 - rol ecx, 10 - lea ebx, DWORD PTR 1352829926[eax*1+ebx] - sub edx, ecx - rol ebx, 5 - add ebx, edi - ; 88 - mov eax, DWORD PTR 52[esp] - or edx, ebp - add edi, eax - xor edx, ebx - mov eax, -1 - rol ebp, 10 - lea edi, DWORD PTR 1352829926[edx*1+edi] - sub eax, ebp - rol edi, 7 - add edi, esi - ; 89 - mov edx, DWORD PTR 24[esp] - or eax, ebx - add esi, edx - xor eax, edi - mov edx, -1 - rol ebx, 10 - lea esi, DWORD PTR 1352829926[eax*1+esi] - sub edx, ebx - rol esi, 7 - add esi, ecx - ; 90 - mov eax, DWORD PTR 60[esp] - or edx, edi - add ecx, eax - xor edx, esi - mov eax, -1 - rol edi, 10 - lea ecx, DWORD PTR 1352829926[edx*1+ecx] - sub eax, edi - rol ecx, 8 - add ecx, ebp - ; 91 - mov edx, DWORD PTR 32[esp] - or eax, esi - add ebp, edx - xor eax, ecx - mov edx, -1 - rol esi, 10 - lea ebp, DWORD PTR 1352829926[eax*1+ebp] - sub edx, esi - rol ebp, 11 - add ebp, ebx - ; 92 - mov eax, DWORD PTR 4[esp] - or edx, ecx - add ebx, eax - xor edx, ebp - mov eax, -1 - rol ecx, 10 - lea ebx, DWORD PTR 1352829926[edx*1+ebx] - sub eax, ecx - rol ebx, 14 - add ebx, edi - ; 93 - mov edx, DWORD PTR 40[esp] - or eax, ebp - add edi, edx - xor eax, ebx - mov edx, -1 - rol ebp, 10 - lea edi, DWORD PTR 1352829926[eax*1+edi] - sub edx, ebp - rol edi, 14 - add edi, esi - ; 94 - mov eax, DWORD PTR 12[esp] - or edx, ebx - add esi, eax - xor edx, edi - mov eax, -1 - rol ebx, 10 - lea esi, DWORD PTR 1352829926[edx*1+esi] - sub eax, ebx - rol esi, 12 - add esi, ecx - ; 95 - mov edx, DWORD PTR 48[esp] - or eax, edi - add ecx, edx - xor eax, esi - mov edx, -1 - rol edi, 10 - lea ecx, DWORD PTR 1352829926[eax*1+ecx] - mov eax, edi - rol ecx, 6 - add ecx, ebp - ; 96 - sub edx, edi - and eax, ecx - and edx, esi - or edx, eax - mov eax, DWORD PTR 24[esp] - rol esi, 10 - lea ebp, DWORD PTR 1548603684[edx+ebp] - mov edx, -1 - add ebp, eax - mov eax, esi - rol ebp, 9 - add ebp, ebx - ; 97 - sub edx, esi - and eax, ebp - and edx, ecx - or edx, eax - mov eax, DWORD PTR 44[esp] - rol ecx, 10 - lea ebx, DWORD PTR 1548603684[edx+ebx] - mov edx, -1 - add ebx, eax - mov eax, ecx - rol ebx, 13 - add ebx, edi - ; 98 - sub edx, ecx - and eax, ebx - and edx, ebp - or edx, eax - mov eax, DWORD PTR 12[esp] - rol ebp, 10 - lea edi, DWORD PTR 1548603684[edx+edi] - mov edx, -1 - add edi, eax - mov eax, ebp - rol edi, 15 - add edi, esi - ; 99 - sub edx, ebp - and eax, edi - and edx, ebx - or edx, eax - mov eax, DWORD PTR 28[esp] - rol ebx, 10 - lea esi, DWORD PTR 1548603684[edx+esi] - mov edx, -1 - add esi, eax - mov eax, ebx - rol esi, 7 - add esi, ecx - ; 100 - sub edx, ebx - and eax, esi - and edx, edi - or edx, eax - mov eax, DWORD PTR [esp] - rol edi, 10 - lea ecx, DWORD PTR 1548603684[edx+ecx] - mov edx, -1 - add ecx, eax - mov eax, edi - rol ecx, 12 - add ecx, ebp - ; 101 - sub edx, edi - and eax, ecx - and edx, esi - or edx, eax - mov eax, DWORD PTR 52[esp] - rol esi, 10 - lea ebp, DWORD PTR 1548603684[edx+ebp] - mov edx, -1 - add ebp, eax - mov eax, esi - rol ebp, 8 - add ebp, ebx - ; 102 - sub edx, esi - and eax, ebp - and edx, ecx - or edx, eax - mov eax, DWORD PTR 20[esp] - rol ecx, 10 - lea ebx, DWORD PTR 1548603684[edx+ebx] - mov edx, -1 - add ebx, eax - mov eax, ecx - rol ebx, 9 - add ebx, edi - ; 103 - sub edx, ecx - and eax, ebx - and edx, ebp - or edx, eax - mov eax, DWORD PTR 40[esp] - rol ebp, 10 - lea edi, DWORD PTR 1548603684[edx+edi] - mov edx, -1 - add edi, eax - mov eax, ebp - rol edi, 11 - add edi, esi - ; 104 - sub edx, ebp - and eax, edi - and edx, ebx - or edx, eax - mov eax, DWORD PTR 56[esp] - rol ebx, 10 - lea esi, DWORD PTR 1548603684[edx+esi] - mov edx, -1 - add esi, eax - mov eax, ebx - rol esi, 7 - add esi, ecx - ; 105 - sub edx, ebx - and eax, esi - and edx, edi - or edx, eax - mov eax, DWORD PTR 60[esp] - rol edi, 10 - lea ecx, DWORD PTR 1548603684[edx+ecx] - mov edx, -1 - add ecx, eax - mov eax, edi - rol ecx, 7 - add ecx, ebp - ; 106 - sub edx, edi - and eax, ecx - and edx, esi - or edx, eax - mov eax, DWORD PTR 32[esp] - rol esi, 10 - lea ebp, DWORD PTR 1548603684[edx+ebp] - mov edx, -1 - add ebp, eax - mov eax, esi - rol ebp, 12 - add ebp, ebx - ; 107 - sub edx, esi - and eax, ebp - and edx, ecx - or edx, eax - mov eax, DWORD PTR 48[esp] - rol ecx, 10 - lea ebx, DWORD PTR 1548603684[edx+ebx] - mov edx, -1 - add ebx, eax - mov eax, ecx - rol ebx, 7 - add ebx, edi - ; 108 - sub edx, ecx - and eax, ebx - and edx, ebp - or edx, eax - mov eax, DWORD PTR 16[esp] - rol ebp, 10 - lea edi, DWORD PTR 1548603684[edx+edi] - mov edx, -1 - add edi, eax - mov eax, ebp - rol edi, 6 - add edi, esi - ; 109 - sub edx, ebp - and eax, edi - and edx, ebx - or edx, eax - mov eax, DWORD PTR 36[esp] - rol ebx, 10 - lea esi, DWORD PTR 1548603684[edx+esi] - mov edx, -1 - add esi, eax - mov eax, ebx - rol esi, 15 - add esi, ecx - ; 110 - sub edx, ebx - and eax, esi - and edx, edi - or edx, eax - mov eax, DWORD PTR 4[esp] - rol edi, 10 - lea ecx, DWORD PTR 1548603684[edx+ecx] - mov edx, -1 - add ecx, eax - mov eax, edi - rol ecx, 13 - add ecx, ebp - ; 111 - sub edx, edi - and eax, ecx - and edx, esi - or edx, eax - mov eax, DWORD PTR 8[esp] - rol esi, 10 - lea ebp, DWORD PTR 1548603684[edx+ebp] - mov edx, -1 - add ebp, eax - sub edx, ecx - rol ebp, 11 - add ebp, ebx - ; 112 - mov eax, DWORD PTR 60[esp] - or edx, ebp - add ebx, eax - xor edx, esi - mov eax, -1 - rol ecx, 10 - lea ebx, DWORD PTR 1836072691[edx*1+ebx] - sub eax, ebp - rol ebx, 9 - add ebx, edi - ; 113 - mov edx, DWORD PTR 20[esp] - or eax, ebx - add edi, edx - xor eax, ecx - mov edx, -1 - rol ebp, 10 - lea edi, DWORD PTR 1836072691[eax*1+edi] - sub edx, ebx - rol edi, 7 - add edi, esi - ; 114 - mov eax, DWORD PTR 4[esp] - or edx, edi - add esi, eax - xor edx, ebp - mov eax, -1 - rol ebx, 10 - lea esi, DWORD PTR 1836072691[edx*1+esi] - sub eax, edi - rol esi, 15 - add esi, ecx - ; 115 - mov edx, DWORD PTR 12[esp] - or eax, esi - add ecx, edx - xor eax, ebx - mov edx, -1 - rol edi, 10 - lea ecx, DWORD PTR 1836072691[eax*1+ecx] - sub edx, esi - rol ecx, 11 - add ecx, ebp - ; 116 - mov eax, DWORD PTR 28[esp] - or edx, ecx - add ebp, eax - xor edx, edi - mov eax, -1 - rol esi, 10 - lea ebp, DWORD PTR 1836072691[edx*1+ebp] - sub eax, ecx - rol ebp, 8 - add ebp, ebx - ; 117 - mov edx, DWORD PTR 56[esp] - or eax, ebp - add ebx, edx - xor eax, esi - mov edx, -1 - rol ecx, 10 - lea ebx, DWORD PTR 1836072691[eax*1+ebx] - sub edx, ebp - rol ebx, 6 - add ebx, edi - ; 118 - mov eax, DWORD PTR 24[esp] - or edx, ebx - add edi, eax - xor edx, ecx - mov eax, -1 - rol ebp, 10 - lea edi, DWORD PTR 1836072691[edx*1+edi] - sub eax, ebx - rol edi, 6 - add edi, esi - ; 119 - mov edx, DWORD PTR 36[esp] - or eax, edi - add esi, edx - xor eax, ebp - mov edx, -1 - rol ebx, 10 - lea esi, DWORD PTR 1836072691[eax*1+esi] - sub edx, edi - rol esi, 14 - add esi, ecx - ; 120 - mov eax, DWORD PTR 44[esp] - or edx, esi - add ecx, eax - xor edx, ebx - mov eax, -1 - rol edi, 10 - lea ecx, DWORD PTR 1836072691[edx*1+ecx] - sub eax, esi - rol ecx, 12 - add ecx, ebp - ; 121 - mov edx, DWORD PTR 32[esp] - or eax, ecx - add ebp, edx - xor eax, edi - mov edx, -1 - rol esi, 10 - lea ebp, DWORD PTR 1836072691[eax*1+ebp] - sub edx, ecx - rol ebp, 13 - add ebp, ebx - ; 122 - mov eax, DWORD PTR 48[esp] - or edx, ebp - add ebx, eax - xor edx, esi - mov eax, -1 - rol ecx, 10 - lea ebx, DWORD PTR 1836072691[edx*1+ebx] - sub eax, ebp - rol ebx, 5 - add ebx, edi - ; 123 - mov edx, DWORD PTR 8[esp] - or eax, ebx - add edi, edx - xor eax, ecx - mov edx, -1 - rol ebp, 10 - lea edi, DWORD PTR 1836072691[eax*1+edi] - sub edx, ebx - rol edi, 14 - add edi, esi - ; 124 - mov eax, DWORD PTR 40[esp] - or edx, edi - add esi, eax - xor edx, ebp - mov eax, -1 - rol ebx, 10 - lea esi, DWORD PTR 1836072691[edx*1+esi] - sub eax, edi - rol esi, 13 - add esi, ecx - ; 125 - mov edx, DWORD PTR [esp] - or eax, esi - add ecx, edx - xor eax, ebx - mov edx, -1 - rol edi, 10 - lea ecx, DWORD PTR 1836072691[eax*1+ecx] - sub edx, esi - rol ecx, 13 - add ecx, ebp - ; 126 - mov eax, DWORD PTR 16[esp] - or edx, ecx - add ebp, eax - xor edx, edi - mov eax, -1 - rol esi, 10 - lea ebp, DWORD PTR 1836072691[edx*1+ebp] - sub eax, ecx - rol ebp, 7 - add ebp, ebx - ; 127 - mov edx, DWORD PTR 52[esp] - or eax, ebp - add ebx, edx - xor eax, esi - mov edx, DWORD PTR 32[esp] - rol ecx, 10 - lea ebx, DWORD PTR 1836072691[eax*1+ebx] - mov eax, -1 - rol ebx, 5 - add ebx, edi - ; 128 - add edi, edx - mov edx, ebp - sub eax, ebx - and edx, ebx - and eax, ecx - or edx, eax - mov eax, DWORD PTR 24[esp] - rol ebp, 10 - lea edi, DWORD PTR 2053994217[edx*1+edi] - mov edx, -1 - rol edi, 15 - add edi, esi - ; 129 - add esi, eax - mov eax, ebx - sub edx, edi - and eax, edi - and edx, ebp - or eax, edx - mov edx, DWORD PTR 16[esp] - rol ebx, 10 - lea esi, DWORD PTR 2053994217[eax*1+esi] - mov eax, -1 - rol esi, 5 - add esi, ecx - ; 130 - add ecx, edx - mov edx, edi - sub eax, esi - and edx, esi - and eax, ebx - or edx, eax - mov eax, DWORD PTR 4[esp] - rol edi, 10 - lea ecx, DWORD PTR 2053994217[edx*1+ecx] - mov edx, -1 - rol ecx, 8 - add ecx, ebp - ; 131 - add ebp, eax - mov eax, esi - sub edx, ecx - and eax, ecx - and edx, edi - or eax, edx - mov edx, DWORD PTR 12[esp] - rol esi, 10 - lea ebp, DWORD PTR 2053994217[eax*1+ebp] - mov eax, -1 - rol ebp, 11 - add ebp, ebx - ; 132 - add ebx, edx - mov edx, ecx - sub eax, ebp - and edx, ebp - and eax, esi - or edx, eax - mov eax, DWORD PTR 44[esp] - rol ecx, 10 - lea ebx, DWORD PTR 2053994217[edx*1+ebx] - mov edx, -1 - rol ebx, 14 - add ebx, edi - ; 133 - add edi, eax - mov eax, ebp - sub edx, ebx - and eax, ebx - and edx, ecx - or eax, edx - mov edx, DWORD PTR 60[esp] - rol ebp, 10 - lea edi, DWORD PTR 2053994217[eax*1+edi] - mov eax, -1 - rol edi, 14 - add edi, esi - ; 134 - add esi, edx - mov edx, ebx - sub eax, edi - and edx, edi - and eax, ebp - or edx, eax - mov eax, DWORD PTR [esp] - rol ebx, 10 - lea esi, DWORD PTR 2053994217[edx*1+esi] - mov edx, -1 - rol esi, 6 - add esi, ecx - ; 135 - add ecx, eax - mov eax, edi - sub edx, esi - and eax, esi - and edx, ebx - or eax, edx - mov edx, DWORD PTR 20[esp] - rol edi, 10 - lea ecx, DWORD PTR 2053994217[eax*1+ecx] - mov eax, -1 - rol ecx, 14 - add ecx, ebp - ; 136 - add ebp, edx - mov edx, esi - sub eax, ecx - and edx, ecx - and eax, edi - or edx, eax - mov eax, DWORD PTR 48[esp] - rol esi, 10 - lea ebp, DWORD PTR 2053994217[edx*1+ebp] - mov edx, -1 - rol ebp, 6 - add ebp, ebx - ; 137 - add ebx, eax - mov eax, ecx - sub edx, ebp - and eax, ebp - and edx, esi - or eax, edx - mov edx, DWORD PTR 8[esp] - rol ecx, 10 - lea ebx, DWORD PTR 2053994217[eax*1+ebx] - mov eax, -1 - rol ebx, 9 - add ebx, edi - ; 138 - add edi, edx - mov edx, ebp - sub eax, ebx - and edx, ebx - and eax, ecx - or edx, eax - mov eax, DWORD PTR 52[esp] - rol ebp, 10 - lea edi, DWORD PTR 2053994217[edx*1+edi] - mov edx, -1 - rol edi, 12 - add edi, esi - ; 139 - add esi, eax - mov eax, ebx - sub edx, edi - and eax, edi - and edx, ebp - or eax, edx - mov edx, DWORD PTR 36[esp] - rol ebx, 10 - lea esi, DWORD PTR 2053994217[eax*1+esi] - mov eax, -1 - rol esi, 9 - add esi, ecx - ; 140 - add ecx, edx - mov edx, edi - sub eax, esi - and edx, esi - and eax, ebx - or edx, eax - mov eax, DWORD PTR 28[esp] - rol edi, 10 - lea ecx, DWORD PTR 2053994217[edx*1+ecx] - mov edx, -1 - rol ecx, 12 - add ecx, ebp - ; 141 - add ebp, eax - mov eax, esi - sub edx, ecx - and eax, ecx - and edx, edi - or eax, edx - mov edx, DWORD PTR 40[esp] - rol esi, 10 - lea ebp, DWORD PTR 2053994217[eax*1+ebp] - mov eax, -1 - rol ebp, 5 - add ebp, ebx - ; 142 - add ebx, edx - mov edx, ecx - sub eax, ebp - and edx, ebp - and eax, esi - or edx, eax - mov eax, DWORD PTR 56[esp] - rol ecx, 10 - lea ebx, DWORD PTR 2053994217[edx*1+ebx] - mov edx, -1 - rol ebx, 15 - add ebx, edi - ; 143 - add edi, eax - mov eax, ebp - sub edx, ebx - and eax, ebx - and edx, ecx - or edx, eax - mov eax, ebx - rol ebp, 10 - lea edi, DWORD PTR 2053994217[edx*1+edi] - xor eax, ebp - rol edi, 8 - add edi, esi - ; 144 - mov edx, DWORD PTR 48[esp] - xor eax, edi - add esi, edx - rol ebx, 10 - add esi, eax - mov eax, edi - rol esi, 8 - add esi, ecx - ; 145 - xor eax, ebx - mov edx, DWORD PTR 60[esp] - xor eax, esi - add ecx, eax - mov eax, esi - rol edi, 10 - add ecx, edx - xor eax, edi - rol ecx, 5 - add ecx, ebp - ; 146 - mov edx, DWORD PTR 40[esp] - xor eax, ecx - add ebp, edx - rol esi, 10 - add ebp, eax - mov eax, ecx - rol ebp, 12 - add ebp, ebx - ; 147 - xor eax, esi - mov edx, DWORD PTR 16[esp] - xor eax, ebp - add ebx, eax - mov eax, ebp - rol ecx, 10 - add ebx, edx - xor eax, ecx - rol ebx, 9 - add ebx, edi - ; 148 - mov edx, DWORD PTR 4[esp] - xor eax, ebx - add edi, edx - rol ebp, 10 - add edi, eax - mov eax, ebx - rol edi, 12 - add edi, esi - ; 149 - xor eax, ebp - mov edx, DWORD PTR 20[esp] - xor eax, edi - add esi, eax - mov eax, edi - rol ebx, 10 - add esi, edx - xor eax, ebx - rol esi, 5 - add esi, ecx - ; 150 - mov edx, DWORD PTR 32[esp] - xor eax, esi - add ecx, edx - rol edi, 10 - add ecx, eax - mov eax, esi - rol ecx, 14 - add ecx, ebp - ; 151 - xor eax, edi - mov edx, DWORD PTR 28[esp] - xor eax, ecx - add ebp, eax - mov eax, ecx - rol esi, 10 - add ebp, edx - xor eax, esi - rol ebp, 6 - add ebp, ebx - ; 152 - mov edx, DWORD PTR 24[esp] - xor eax, ebp - add ebx, edx - rol ecx, 10 - add ebx, eax - mov eax, ebp - rol ebx, 8 - add ebx, edi - ; 153 - xor eax, ecx - mov edx, DWORD PTR 8[esp] - xor eax, ebx - add edi, eax - mov eax, ebx - rol ebp, 10 - add edi, edx - xor eax, ebp - rol edi, 13 - add edi, esi - ; 154 - mov edx, DWORD PTR 52[esp] - xor eax, edi - add esi, edx - rol ebx, 10 - add esi, eax - mov eax, edi - rol esi, 6 - add esi, ecx - ; 155 - xor eax, ebx - mov edx, DWORD PTR 56[esp] - xor eax, esi - add ecx, eax - mov eax, esi - rol edi, 10 - add ecx, edx - xor eax, edi - rol ecx, 5 - add ecx, ebp - ; 156 - mov edx, DWORD PTR [esp] - xor eax, ecx - add ebp, edx - rol esi, 10 - add ebp, eax - mov eax, ecx - rol ebp, 15 - add ebp, ebx - ; 157 - xor eax, esi - mov edx, DWORD PTR 12[esp] - xor eax, ebp - add ebx, eax - mov eax, ebp - rol ecx, 10 - add ebx, edx - xor eax, ecx - rol ebx, 13 - add ebx, edi - ; 158 - mov edx, DWORD PTR 36[esp] - xor eax, ebx - add edi, edx - rol ebp, 10 - add edi, eax - mov eax, ebx - rol edi, 11 - add edi, esi - ; 159 - xor eax, ebp - mov edx, DWORD PTR 44[esp] - xor eax, edi - add esi, eax - rol ebx, 10 - add esi, edx - mov edx, DWORD PTR 128[esp] - rol esi, 11 - add esi, ecx - mov eax, DWORD PTR 4[edx] - add ebx, eax - mov eax, DWORD PTR 72[esp] - add ebx, eax - mov eax, DWORD PTR 8[edx] - add ebp, eax - mov eax, DWORD PTR 76[esp] - add ebp, eax - mov eax, DWORD PTR 12[edx] - add ecx, eax - mov eax, DWORD PTR 80[esp] - add ecx, eax - mov eax, DWORD PTR 16[edx] - add esi, eax - mov eax, DWORD PTR 64[esp] - add esi, eax - mov eax, DWORD PTR [edx] - add edi, eax - mov eax, DWORD PTR 68[esp] - add edi, eax - mov eax, DWORD PTR 136[esp] - mov DWORD PTR [edx],ebx - mov DWORD PTR 4[edx],ebp - mov DWORD PTR 8[edx],ecx - sub eax, 1 - mov DWORD PTR 12[edx],esi - mov DWORD PTR 16[edx],edi - jle $L001get_out - mov DWORD PTR 136[esp],eax - mov edi, ecx - mov eax, DWORD PTR 132[esp] - mov ecx, ebx - add eax, 64 - mov esi, ebp - mov DWORD PTR 132[esp],eax - jmp L000start -$L001get_out: - add esp, 108 - pop ebx - pop ebp - pop edi - pop esi - ret -_ripemd160_block_asm_host_order ENDP -_TEXT ENDS -END diff --git a/src/lib/libcrypto/ripemd/rmd_locl.h b/src/lib/libcrypto/ripemd/rmd_locl.h index 145cf316b9..f537b88867 100644 --- a/src/lib/libcrypto/ripemd/rmd_locl.h +++ b/src/lib/libcrypto/ripemd/rmd_locl.h @@ -106,11 +106,7 @@ void ripemd160_block_data_order (RIPEMD160_CTX *c, const void *p,int num); #define HASH_BLOCK_DATA_ORDER ripemd160_block_data_order #endif -#ifndef FLAT_INC -#include "../md32_common.h" -#else #include "md32_common.h" -#endif #if 0 #define F1(x,y,z) ((x)^(y)^(z)) diff --git a/src/lib/libcrypto/rsa/rsa_err.c b/src/lib/libcrypto/rsa/rsa_err.c index 5cfbea2b03..1cde7c0da4 100644 --- a/src/lib/libcrypto/rsa/rsa_err.c +++ b/src/lib/libcrypto/rsa/rsa_err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/sha/Makefile.ssl b/src/lib/libcrypto/sha/Makefile.ssl index 79ef43aa34..72acd8f046 100644 --- a/src/lib/libcrypto/sha/Makefile.ssl +++ b/src/lib/libcrypto/sha/Makefile.ssl @@ -5,6 +5,7 @@ DIR= sha TOP= ../.. CC= cc +CPP= $(CC) -E INCLUDES= CFLAG=-g INSTALL_PREFIX= @@ -46,7 +47,7 @@ lib: $(LIBOBJ) # elf asm/sx86-elf.o: asm/sx86unix.cpp - $(CPP) -DELF asm/sx86unix.cpp | as -o asm/sx86-elf.o + $(CPP) -DELF -x c asm/sx86unix.cpp | as -o asm/sx86-elf.o # solaris asm/sx86-sol.o: asm/sx86unix.cpp @@ -62,7 +63,7 @@ asm/sx86-out.o: asm/sx86unix.cpp asm/sx86bsdi.o: asm/sx86unix.cpp $(CPP) -DBSDI asm/sx86unix.cpp | sed 's/ :/:/' | as -o asm/sx86bsdi.o -asm/sx86unix.cpp: +asm/sx86unix.cpp: asm/sha1-586.pl ../perlasm/x86asm.pl (cd asm; $(PERL) sha1-586.pl cpp $(PROCESSOR) >sx86unix.cpp) files: diff --git a/src/lib/libcrypto/sha/Makefile.uni b/src/lib/libcrypto/sha/Makefile.uni index b7ec5caa4e..e69de29bb2 100644 --- a/src/lib/libcrypto/sha/Makefile.uni +++ b/src/lib/libcrypto/sha/Makefile.uni @@ -1,122 +0,0 @@ -# Targets -# make - twidle the options yourself :-) -# make cc - standard cc options -# make gcc - standard gcc options -# make x86-elf - linux-elf etc -# make x86-out - linux-a.out, FreeBSD etc -# make x86-solaris -# make x86-bdsi - -DIR= sha -TOP= . -CC= gcc -CFLAG= -O3 -fomit-frame-pointer - -CPP= $(CC) -E -INCLUDES= -INSTALLTOP=/usr/local/lib -MAKE= make -MAKEDEPEND= makedepend -MAKEFILE= Makefile.uni -AR= ar r - -SHA_ASM_OBJ= - -CFLAGS= $(INCLUDES) $(CFLAG) - -GENERAL=Makefile - -TEST1=shatest -TEST2=sha1test -APP1=sha -APP2=sha1 - -TEST=$(TEST1) $(TEST2) -APPS=$(APP1) $(APP2) - -LIB=libsha.a -LIBSRC=sha_dgst.c sha1dgst.c sha_one.c sha1_one.c -LIBOBJ=sha_dgst.o sha1dgst.o sha_one.o sha1_one.o $(SHA_ASM_OBJ) - -SRC= $(LIBSRC) - -EXHEADER= sha.h -HEADER= sha_locl.h $(EXHEADER) - -ALL= $(GENERAL) $(SRC) $(HEADER) - -all: $(LIB) $(TEST) $(APPS) - -$(LIB): $(LIBOBJ) - $(AR) $(LIB) $(LIBOBJ) - $(RANLIB) $(LIB) - -# elf -asm/sx86-elf.o: asm/sx86unix.cpp - $(CPP) -DELF asm/sx86unix.cpp | as -o asm/sx86-elf.o - -# solaris -asm/sx86-sol.o: asm/sx86unix.cpp - $(CC) -E -DSOL asm/sx86unix.cpp | sed 's/^#.*//' > asm/sx86-sol.s - as -o asm/sx86-sol.o asm/sx86-sol.s - rm -f asm/sx86-sol.s - -# a.out -asm/sx86-out.o: asm/sx86unix.cpp - $(CPP) -DOUT asm/sx86unix.cpp | as -o asm/sx86-out.o - -# bsdi -asm/sx86bsdi.o: asm/sx86unix.cpp - $(CPP) -DBSDI asm/sx86unix.cpp | as -o asm/sx86bsdi.o - -asm/sx86unix.cpp: - (cd asm; perl sha1-586.pl cpp >sx86unix.cpp) - -test: $(TEST) - ./$(TEST1) - ./$(TEST2) - -$(TEST1): $(TEST1).c $(LIB) - $(CC) -o $(TEST1) $(CFLAGS) $(TEST1).c $(LIB) - -$(TEST2): $(TEST2).c $(LIB) - $(CC) -o $(TEST2) $(CFLAGS) $(TEST2).c $(LIB) - -$(APP1): $(APP1).c $(LIB) - $(CC) -o $(APP1) $(CFLAGS) $(APP1).c $(LIB) - -$(APP2): $(APP2).c $(LIB) - $(CC) -o $(APP2) $(CFLAGS) $(APP2).c $(LIB) - -lint: - lint -DLINT $(INCLUDES) $(SRC)>fluff - -depend: - $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) - -dclean: - perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new - mv -f Makefile.new $(MAKEFILE) - -clean: - /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff - -cc: - $(MAKE) SHA_ASM_OBJ="" CC="cc" CFLAG="-O" all - -gcc: - $(MAKE) SHA_ASM_OBJ="" CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all - -x86-elf: - $(MAKE) SHA_ASM_OBJ="asm/sx86-elf.o" CFLAG="-DELF -DSHA1_ASM -DL_ENDIAN $(CFLAGS)" all - -x86-out: - $(MAKE) SHA_ASM_OBJ="asm/sx86-out.o" CFLAG="-DOUT -DSHA1_ASM -DL_ENDIAN $(CFLAGS)" all - -x86-solaris: - $(MAKE) SHA_ASM_OBJ="asm/sx86-sol.o" CFLAG="-DSOL -DSHA1_ASM -DL_ENDIAN $(CFLAGS)" all - -x86-bdsi: - $(MAKE) SHA_ASM_OBJ="asm/sx86-bdsi.o" CFLAG="-DBDSI -DSHA1_ASM -DL_ENDIAN $(CFLAGS)" all - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/sha/asm/s1-win32.asm b/src/lib/libcrypto/sha/asm/s1-win32.asm index 699afdb022..e69de29bb2 100644 --- a/src/lib/libcrypto/sha/asm/s1-win32.asm +++ b/src/lib/libcrypto/sha/asm/s1-win32.asm @@ -1,1716 +0,0 @@ - ; Don't even think of reading this code - ; It was automatically generated by sha1-586.pl - ; Which is a perl program used to generate the x86 assember for - ; any of elf, a.out, BSDI,Win32, or Solaris - ; eric - ; - TITLE sha1-586.asm - .486 -.model FLAT -_TEXT SEGMENT -PUBLIC _sha1_block_asm_data_order - -_sha1_block_asm_data_order PROC NEAR - mov ecx, DWORD PTR 12[esp] - push esi - shl ecx, 6 - mov esi, DWORD PTR 12[esp] - push ebp - add ecx, esi - push ebx - mov ebp, DWORD PTR 16[esp] - push edi - mov edx, DWORD PTR 12[ebp] - sub esp, 108 - mov edi, DWORD PTR 16[ebp] - mov ebx, DWORD PTR 8[ebp] - mov DWORD PTR 68[esp],ecx - ; First we need to setup the X array -L000start: - ; First, load the words onto the stack in network byte order - mov eax, DWORD PTR [esi] - mov ecx, DWORD PTR 4[esi] - bswap eax - bswap ecx - mov DWORD PTR [esp],eax - mov DWORD PTR 4[esp],ecx - mov eax, DWORD PTR 8[esi] - mov ecx, DWORD PTR 12[esi] - bswap eax - bswap ecx - mov DWORD PTR 8[esp],eax - mov DWORD PTR 12[esp],ecx - mov eax, DWORD PTR 16[esi] - mov ecx, DWORD PTR 20[esi] - bswap eax - bswap ecx - mov DWORD PTR 16[esp],eax - mov DWORD PTR 20[esp],ecx - mov eax, DWORD PTR 24[esi] - mov ecx, DWORD PTR 28[esi] - bswap eax - bswap ecx - mov DWORD PTR 24[esp],eax - mov DWORD PTR 28[esp],ecx - mov eax, DWORD PTR 32[esi] - mov ecx, DWORD PTR 36[esi] - bswap eax - bswap ecx - mov DWORD PTR 32[esp],eax - mov DWORD PTR 36[esp],ecx - mov eax, DWORD PTR 40[esi] - mov ecx, DWORD PTR 44[esi] - bswap eax - bswap ecx - mov DWORD PTR 40[esp],eax - mov DWORD PTR 44[esp],ecx - mov eax, DWORD PTR 48[esi] - mov ecx, DWORD PTR 52[esi] - bswap eax - bswap ecx - mov DWORD PTR 48[esp],eax - mov DWORD PTR 52[esp],ecx - mov eax, DWORD PTR 56[esi] - mov ecx, DWORD PTR 60[esi] - bswap eax - bswap ecx - mov DWORD PTR 56[esp],eax - mov DWORD PTR 60[esp],ecx - ; We now have the X array on the stack - ; starting at sp-4 - mov DWORD PTR 132[esp],esi -L001shortcut: - ; - ; Start processing - mov eax, DWORD PTR [ebp] - mov ecx, DWORD PTR 4[ebp] - ; 00_15 0 - mov esi, ebx - mov ebp, eax - xor esi, edx - rol ebp, 5 - and esi, ecx - add ebp, edi - ror ecx, 1 - mov edi, DWORD PTR [esp] - ror ecx, 1 - xor esi, edx - lea ebp, DWORD PTR 1518500249[edi*1+ebp] - mov edi, ecx - add esi, ebp - xor edi, ebx - mov ebp, esi - and edi, eax - rol ebp, 5 - add ebp, edx - mov edx, DWORD PTR 4[esp] - ror eax, 1 - xor edi, ebx - ror eax, 1 - lea ebp, DWORD PTR 1518500249[edx*1+ebp] - add edi, ebp - ; 00_15 2 - mov edx, eax - mov ebp, edi - xor edx, ecx - rol ebp, 5 - and edx, esi - add ebp, ebx - ror esi, 1 - mov ebx, DWORD PTR 8[esp] - ror esi, 1 - xor edx, ecx - lea ebp, DWORD PTR 1518500249[ebx*1+ebp] - mov ebx, esi - add edx, ebp - xor ebx, eax - mov ebp, edx - and ebx, edi - rol ebp, 5 - add ebp, ecx - mov ecx, DWORD PTR 12[esp] - ror edi, 1 - xor ebx, eax - ror edi, 1 - lea ebp, DWORD PTR 1518500249[ecx*1+ebp] - add ebx, ebp - ; 00_15 4 - mov ecx, edi - mov ebp, ebx - xor ecx, esi - rol ebp, 5 - and ecx, edx - add ebp, eax - ror edx, 1 - mov eax, DWORD PTR 16[esp] - ror edx, 1 - xor ecx, esi - lea ebp, DWORD PTR 1518500249[eax*1+ebp] - mov eax, edx - add ecx, ebp - xor eax, edi - mov ebp, ecx - and eax, ebx - rol ebp, 5 - add ebp, esi - mov esi, DWORD PTR 20[esp] - ror ebx, 1 - xor eax, edi - ror ebx, 1 - lea ebp, DWORD PTR 1518500249[esi*1+ebp] - add eax, ebp - ; 00_15 6 - mov esi, ebx - mov ebp, eax - xor esi, edx - rol ebp, 5 - and esi, ecx - add ebp, edi - ror ecx, 1 - mov edi, DWORD PTR 24[esp] - ror ecx, 1 - xor esi, edx - lea ebp, DWORD PTR 1518500249[edi*1+ebp] - mov edi, ecx - add esi, ebp - xor edi, ebx - mov ebp, esi - and edi, eax - rol ebp, 5 - add ebp, edx - mov edx, DWORD PTR 28[esp] - ror eax, 1 - xor edi, ebx - ror eax, 1 - lea ebp, DWORD PTR 1518500249[edx*1+ebp] - add edi, ebp - ; 00_15 8 - mov edx, eax - mov ebp, edi - xor edx, ecx - rol ebp, 5 - and edx, esi - add ebp, ebx - ror esi, 1 - mov ebx, DWORD PTR 32[esp] - ror esi, 1 - xor edx, ecx - lea ebp, DWORD PTR 1518500249[ebx*1+ebp] - mov ebx, esi - add edx, ebp - xor ebx, eax - mov ebp, edx - and ebx, edi - rol ebp, 5 - add ebp, ecx - mov ecx, DWORD PTR 36[esp] - ror edi, 1 - xor ebx, eax - ror edi, 1 - lea ebp, DWORD PTR 1518500249[ecx*1+ebp] - add ebx, ebp - ; 00_15 10 - mov ecx, edi - mov ebp, ebx - xor ecx, esi - rol ebp, 5 - and ecx, edx - add ebp, eax - ror edx, 1 - mov eax, DWORD PTR 40[esp] - ror edx, 1 - xor ecx, esi - lea ebp, DWORD PTR 1518500249[eax*1+ebp] - mov eax, edx - add ecx, ebp - xor eax, edi - mov ebp, ecx - and eax, ebx - rol ebp, 5 - add ebp, esi - mov esi, DWORD PTR 44[esp] - ror ebx, 1 - xor eax, edi - ror ebx, 1 - lea ebp, DWORD PTR 1518500249[esi*1+ebp] - add eax, ebp - ; 00_15 12 - mov esi, ebx - mov ebp, eax - xor esi, edx - rol ebp, 5 - and esi, ecx - add ebp, edi - ror ecx, 1 - mov edi, DWORD PTR 48[esp] - ror ecx, 1 - xor esi, edx - lea ebp, DWORD PTR 1518500249[edi*1+ebp] - mov edi, ecx - add esi, ebp - xor edi, ebx - mov ebp, esi - and edi, eax - rol ebp, 5 - add ebp, edx - mov edx, DWORD PTR 52[esp] - ror eax, 1 - xor edi, ebx - ror eax, 1 - lea ebp, DWORD PTR 1518500249[edx*1+ebp] - add edi, ebp - ; 00_15 14 - mov edx, eax - mov ebp, edi - xor edx, ecx - rol ebp, 5 - and edx, esi - add ebp, ebx - ror esi, 1 - mov ebx, DWORD PTR 56[esp] - ror esi, 1 - xor edx, ecx - lea ebp, DWORD PTR 1518500249[ebx*1+ebp] - mov ebx, esi - add edx, ebp - xor ebx, eax - mov ebp, edx - and ebx, edi - rol ebp, 5 - add ebp, ecx - mov ecx, DWORD PTR 60[esp] - ror edi, 1 - xor ebx, eax - ror edi, 1 - lea ebp, DWORD PTR 1518500249[ecx*1+ebp] - add ebx, ebp - ; 16_19 16 - nop - mov ebp, DWORD PTR [esp] - mov ecx, DWORD PTR 8[esp] - xor ecx, ebp - mov ebp, DWORD PTR 32[esp] - xor ecx, ebp - mov ebp, DWORD PTR 52[esp] - xor ecx, ebp - mov ebp, edi - rol ecx, 1 - xor ebp, esi - mov DWORD PTR [esp],ecx - and ebp, edx - lea ecx, DWORD PTR 1518500249[eax*1+ecx] - xor ebp, esi - mov eax, ebx - add ecx, ebp - rol eax, 5 - ror edx, 1 - add ecx, eax - mov eax, DWORD PTR 4[esp] - mov ebp, DWORD PTR 12[esp] - xor eax, ebp - mov ebp, DWORD PTR 36[esp] - xor eax, ebp - mov ebp, DWORD PTR 56[esp] - ror edx, 1 - xor eax, ebp - rol eax, 1 - mov ebp, edx - xor ebp, edi - mov DWORD PTR 4[esp],eax - and ebp, ebx - lea eax, DWORD PTR 1518500249[esi*1+eax] - xor ebp, edi - mov esi, ecx - rol esi, 5 - ror ebx, 1 - add eax, esi - ror ebx, 1 - add eax, ebp - ; 16_19 18 - mov ebp, DWORD PTR 8[esp] - mov esi, DWORD PTR 16[esp] - xor esi, ebp - mov ebp, DWORD PTR 40[esp] - xor esi, ebp - mov ebp, DWORD PTR 60[esp] - xor esi, ebp - mov ebp, ebx - rol esi, 1 - xor ebp, edx - mov DWORD PTR 8[esp],esi - and ebp, ecx - lea esi, DWORD PTR 1518500249[edi*1+esi] - xor ebp, edx - mov edi, eax - add esi, ebp - rol edi, 5 - ror ecx, 1 - add esi, edi - mov edi, DWORD PTR 12[esp] - mov ebp, DWORD PTR 20[esp] - xor edi, ebp - mov ebp, DWORD PTR 44[esp] - xor edi, ebp - mov ebp, DWORD PTR [esp] - ror ecx, 1 - xor edi, ebp - rol edi, 1 - mov ebp, ecx - xor ebp, ebx - mov DWORD PTR 12[esp],edi - and ebp, eax - lea edi, DWORD PTR 1518500249[edx*1+edi] - xor ebp, ebx - mov edx, esi - rol edx, 5 - ror eax, 1 - add edi, edx - ror eax, 1 - add edi, ebp - ; 20_39 20 - mov edx, DWORD PTR 16[esp] - mov ebp, DWORD PTR 24[esp] - xor edx, ebp - mov ebp, DWORD PTR 48[esp] - xor edx, ebp - mov ebp, DWORD PTR 4[esp] - xor edx, ebp - mov ebp, esi - rol edx, 1 - xor ebp, eax - mov DWORD PTR 16[esp],edx - xor ebp, ecx - lea edx, DWORD PTR 1859775393[ebx*1+edx] - mov ebx, edi - rol ebx, 5 - ror esi, 1 - add ebx, ebp - ror esi, 1 - add edx, ebx - ; 20_39 21 - mov ebx, DWORD PTR 20[esp] - mov ebp, DWORD PTR 28[esp] - xor ebx, ebp - mov ebp, DWORD PTR 52[esp] - xor ebx, ebp - mov ebp, DWORD PTR 8[esp] - xor ebx, ebp - mov ebp, edi - rol ebx, 1 - xor ebp, esi - mov DWORD PTR 20[esp],ebx - xor ebp, eax - lea ebx, DWORD PTR 1859775393[ecx*1+ebx] - mov ecx, edx - rol ecx, 5 - ror edi, 1 - add ecx, ebp - ror edi, 1 - add ebx, ecx - ; 20_39 22 - mov ecx, DWORD PTR 24[esp] - mov ebp, DWORD PTR 32[esp] - xor ecx, ebp - mov ebp, DWORD PTR 56[esp] - xor ecx, ebp - mov ebp, DWORD PTR 12[esp] - xor ecx, ebp - mov ebp, edx - rol ecx, 1 - xor ebp, edi - mov DWORD PTR 24[esp],ecx - xor ebp, esi - lea ecx, DWORD PTR 1859775393[eax*1+ecx] - mov eax, ebx - rol eax, 5 - ror edx, 1 - add eax, ebp - ror edx, 1 - add ecx, eax - ; 20_39 23 - mov eax, DWORD PTR 28[esp] - mov ebp, DWORD PTR 36[esp] - xor eax, ebp - mov ebp, DWORD PTR 60[esp] - xor eax, ebp - mov ebp, DWORD PTR 16[esp] - xor eax, ebp - mov ebp, ebx - rol eax, 1 - xor ebp, edx - mov DWORD PTR 28[esp],eax - xor ebp, edi - lea eax, DWORD PTR 1859775393[esi*1+eax] - mov esi, ecx - rol esi, 5 - ror ebx, 1 - add esi, ebp - ror ebx, 1 - add eax, esi - ; 20_39 24 - mov esi, DWORD PTR 32[esp] - mov ebp, DWORD PTR 40[esp] - xor esi, ebp - mov ebp, DWORD PTR [esp] - xor esi, ebp - mov ebp, DWORD PTR 20[esp] - xor esi, ebp - mov ebp, ecx - rol esi, 1 - xor ebp, ebx - mov DWORD PTR 32[esp],esi - xor ebp, edx - lea esi, DWORD PTR 1859775393[edi*1+esi] - mov edi, eax - rol edi, 5 - ror ecx, 1 - add edi, ebp - ror ecx, 1 - add esi, edi - ; 20_39 25 - mov edi, DWORD PTR 36[esp] - mov ebp, DWORD PTR 44[esp] - xor edi, ebp - mov ebp, DWORD PTR 4[esp] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - xor edi, ebp - mov ebp, eax - rol edi, 1 - xor ebp, ecx - mov DWORD PTR 36[esp],edi - xor ebp, ebx - lea edi, DWORD PTR 1859775393[edx*1+edi] - mov edx, esi - rol edx, 5 - ror eax, 1 - add edx, ebp - ror eax, 1 - add edi, edx - ; 20_39 26 - mov edx, DWORD PTR 40[esp] - mov ebp, DWORD PTR 48[esp] - xor edx, ebp - mov ebp, DWORD PTR 8[esp] - xor edx, ebp - mov ebp, DWORD PTR 28[esp] - xor edx, ebp - mov ebp, esi - rol edx, 1 - xor ebp, eax - mov DWORD PTR 40[esp],edx - xor ebp, ecx - lea edx, DWORD PTR 1859775393[ebx*1+edx] - mov ebx, edi - rol ebx, 5 - ror esi, 1 - add ebx, ebp - ror esi, 1 - add edx, ebx - ; 20_39 27 - mov ebx, DWORD PTR 44[esp] - mov ebp, DWORD PTR 52[esp] - xor ebx, ebp - mov ebp, DWORD PTR 12[esp] - xor ebx, ebp - mov ebp, DWORD PTR 32[esp] - xor ebx, ebp - mov ebp, edi - rol ebx, 1 - xor ebp, esi - mov DWORD PTR 44[esp],ebx - xor ebp, eax - lea ebx, DWORD PTR 1859775393[ecx*1+ebx] - mov ecx, edx - rol ecx, 5 - ror edi, 1 - add ecx, ebp - ror edi, 1 - add ebx, ecx - ; 20_39 28 - mov ecx, DWORD PTR 48[esp] - mov ebp, DWORD PTR 56[esp] - xor ecx, ebp - mov ebp, DWORD PTR 16[esp] - xor ecx, ebp - mov ebp, DWORD PTR 36[esp] - xor ecx, ebp - mov ebp, edx - rol ecx, 1 - xor ebp, edi - mov DWORD PTR 48[esp],ecx - xor ebp, esi - lea ecx, DWORD PTR 1859775393[eax*1+ecx] - mov eax, ebx - rol eax, 5 - ror edx, 1 - add eax, ebp - ror edx, 1 - add ecx, eax - ; 20_39 29 - mov eax, DWORD PTR 52[esp] - mov ebp, DWORD PTR 60[esp] - xor eax, ebp - mov ebp, DWORD PTR 20[esp] - xor eax, ebp - mov ebp, DWORD PTR 40[esp] - xor eax, ebp - mov ebp, ebx - rol eax, 1 - xor ebp, edx - mov DWORD PTR 52[esp],eax - xor ebp, edi - lea eax, DWORD PTR 1859775393[esi*1+eax] - mov esi, ecx - rol esi, 5 - ror ebx, 1 - add esi, ebp - ror ebx, 1 - add eax, esi - ; 20_39 30 - mov esi, DWORD PTR 56[esp] - mov ebp, DWORD PTR [esp] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - xor esi, ebp - mov ebp, DWORD PTR 44[esp] - xor esi, ebp - mov ebp, ecx - rol esi, 1 - xor ebp, ebx - mov DWORD PTR 56[esp],esi - xor ebp, edx - lea esi, DWORD PTR 1859775393[edi*1+esi] - mov edi, eax - rol edi, 5 - ror ecx, 1 - add edi, ebp - ror ecx, 1 - add esi, edi - ; 20_39 31 - mov edi, DWORD PTR 60[esp] - mov ebp, DWORD PTR 4[esp] - xor edi, ebp - mov ebp, DWORD PTR 28[esp] - xor edi, ebp - mov ebp, DWORD PTR 48[esp] - xor edi, ebp - mov ebp, eax - rol edi, 1 - xor ebp, ecx - mov DWORD PTR 60[esp],edi - xor ebp, ebx - lea edi, DWORD PTR 1859775393[edx*1+edi] - mov edx, esi - rol edx, 5 - ror eax, 1 - add edx, ebp - ror eax, 1 - add edi, edx - ; 20_39 32 - mov edx, DWORD PTR [esp] - mov ebp, DWORD PTR 8[esp] - xor edx, ebp - mov ebp, DWORD PTR 32[esp] - xor edx, ebp - mov ebp, DWORD PTR 52[esp] - xor edx, ebp - mov ebp, esi - rol edx, 1 - xor ebp, eax - mov DWORD PTR [esp],edx - xor ebp, ecx - lea edx, DWORD PTR 1859775393[ebx*1+edx] - mov ebx, edi - rol ebx, 5 - ror esi, 1 - add ebx, ebp - ror esi, 1 - add edx, ebx - ; 20_39 33 - mov ebx, DWORD PTR 4[esp] - mov ebp, DWORD PTR 12[esp] - xor ebx, ebp - mov ebp, DWORD PTR 36[esp] - xor ebx, ebp - mov ebp, DWORD PTR 56[esp] - xor ebx, ebp - mov ebp, edi - rol ebx, 1 - xor ebp, esi - mov DWORD PTR 4[esp],ebx - xor ebp, eax - lea ebx, DWORD PTR 1859775393[ecx*1+ebx] - mov ecx, edx - rol ecx, 5 - ror edi, 1 - add ecx, ebp - ror edi, 1 - add ebx, ecx - ; 20_39 34 - mov ecx, DWORD PTR 8[esp] - mov ebp, DWORD PTR 16[esp] - xor ecx, ebp - mov ebp, DWORD PTR 40[esp] - xor ecx, ebp - mov ebp, DWORD PTR 60[esp] - xor ecx, ebp - mov ebp, edx - rol ecx, 1 - xor ebp, edi - mov DWORD PTR 8[esp],ecx - xor ebp, esi - lea ecx, DWORD PTR 1859775393[eax*1+ecx] - mov eax, ebx - rol eax, 5 - ror edx, 1 - add eax, ebp - ror edx, 1 - add ecx, eax - ; 20_39 35 - mov eax, DWORD PTR 12[esp] - mov ebp, DWORD PTR 20[esp] - xor eax, ebp - mov ebp, DWORD PTR 44[esp] - xor eax, ebp - mov ebp, DWORD PTR [esp] - xor eax, ebp - mov ebp, ebx - rol eax, 1 - xor ebp, edx - mov DWORD PTR 12[esp],eax - xor ebp, edi - lea eax, DWORD PTR 1859775393[esi*1+eax] - mov esi, ecx - rol esi, 5 - ror ebx, 1 - add esi, ebp - ror ebx, 1 - add eax, esi - ; 20_39 36 - mov esi, DWORD PTR 16[esp] - mov ebp, DWORD PTR 24[esp] - xor esi, ebp - mov ebp, DWORD PTR 48[esp] - xor esi, ebp - mov ebp, DWORD PTR 4[esp] - xor esi, ebp - mov ebp, ecx - rol esi, 1 - xor ebp, ebx - mov DWORD PTR 16[esp],esi - xor ebp, edx - lea esi, DWORD PTR 1859775393[edi*1+esi] - mov edi, eax - rol edi, 5 - ror ecx, 1 - add edi, ebp - ror ecx, 1 - add esi, edi - ; 20_39 37 - mov edi, DWORD PTR 20[esp] - mov ebp, DWORD PTR 28[esp] - xor edi, ebp - mov ebp, DWORD PTR 52[esp] - xor edi, ebp - mov ebp, DWORD PTR 8[esp] - xor edi, ebp - mov ebp, eax - rol edi, 1 - xor ebp, ecx - mov DWORD PTR 20[esp],edi - xor ebp, ebx - lea edi, DWORD PTR 1859775393[edx*1+edi] - mov edx, esi - rol edx, 5 - ror eax, 1 - add edx, ebp - ror eax, 1 - add edi, edx - ; 20_39 38 - mov edx, DWORD PTR 24[esp] - mov ebp, DWORD PTR 32[esp] - xor edx, ebp - mov ebp, DWORD PTR 56[esp] - xor edx, ebp - mov ebp, DWORD PTR 12[esp] - xor edx, ebp - mov ebp, esi - rol edx, 1 - xor ebp, eax - mov DWORD PTR 24[esp],edx - xor ebp, ecx - lea edx, DWORD PTR 1859775393[ebx*1+edx] - mov ebx, edi - rol ebx, 5 - ror esi, 1 - add ebx, ebp - ror esi, 1 - add edx, ebx - ; 20_39 39 - mov ebx, DWORD PTR 28[esp] - mov ebp, DWORD PTR 36[esp] - xor ebx, ebp - mov ebp, DWORD PTR 60[esp] - xor ebx, ebp - mov ebp, DWORD PTR 16[esp] - xor ebx, ebp - mov ebp, edi - rol ebx, 1 - xor ebp, esi - mov DWORD PTR 28[esp],ebx - xor ebp, eax - lea ebx, DWORD PTR 1859775393[ecx*1+ebx] - mov ecx, edx - rol ecx, 5 - ror edi, 1 - add ecx, ebp - ror edi, 1 - add ebx, ecx - ; 40_59 40 - mov ecx, DWORD PTR 32[esp] - mov ebp, DWORD PTR 40[esp] - xor ecx, ebp - mov ebp, DWORD PTR [esp] - xor ecx, ebp - mov ebp, DWORD PTR 20[esp] - xor ecx, ebp - mov ebp, edx - rol ecx, 1 - or ebp, edi - mov DWORD PTR 32[esp],ecx - and ebp, esi - lea ecx, DWORD PTR 2400959708[eax*1+ecx] - mov eax, edx - ror edx, 1 - and eax, edi - or ebp, eax - mov eax, ebx - rol eax, 5 - add ebp, eax - mov eax, DWORD PTR 36[esp] - add ecx, ebp - mov ebp, DWORD PTR 44[esp] - xor eax, ebp - mov ebp, DWORD PTR 4[esp] - xor eax, ebp - mov ebp, DWORD PTR 24[esp] - ror edx, 1 - xor eax, ebp - rol eax, 1 - mov ebp, ebx - mov DWORD PTR 36[esp],eax - or ebp, edx - lea eax, DWORD PTR 2400959708[esi*1+eax] - mov esi, ebx - and ebp, edi - and esi, edx - or ebp, esi - mov esi, ecx - rol esi, 5 - ror ebx, 1 - add ebp, esi - ror ebx, 1 - add eax, ebp - ; 40_59 41 - ; 40_59 42 - mov esi, DWORD PTR 40[esp] - mov ebp, DWORD PTR 48[esp] - xor esi, ebp - mov ebp, DWORD PTR 8[esp] - xor esi, ebp - mov ebp, DWORD PTR 28[esp] - xor esi, ebp - mov ebp, ecx - rol esi, 1 - or ebp, ebx - mov DWORD PTR 40[esp],esi - and ebp, edx - lea esi, DWORD PTR 2400959708[edi*1+esi] - mov edi, ecx - ror ecx, 1 - and edi, ebx - or ebp, edi - mov edi, eax - rol edi, 5 - add ebp, edi - mov edi, DWORD PTR 44[esp] - add esi, ebp - mov ebp, DWORD PTR 52[esp] - xor edi, ebp - mov ebp, DWORD PTR 12[esp] - xor edi, ebp - mov ebp, DWORD PTR 32[esp] - ror ecx, 1 - xor edi, ebp - rol edi, 1 - mov ebp, eax - mov DWORD PTR 44[esp],edi - or ebp, ecx - lea edi, DWORD PTR 2400959708[edx*1+edi] - mov edx, eax - and ebp, ebx - and edx, ecx - or ebp, edx - mov edx, esi - rol edx, 5 - ror eax, 1 - add ebp, edx - ror eax, 1 - add edi, ebp - ; 40_59 43 - ; 40_59 44 - mov edx, DWORD PTR 48[esp] - mov ebp, DWORD PTR 56[esp] - xor edx, ebp - mov ebp, DWORD PTR 16[esp] - xor edx, ebp - mov ebp, DWORD PTR 36[esp] - xor edx, ebp - mov ebp, esi - rol edx, 1 - or ebp, eax - mov DWORD PTR 48[esp],edx - and ebp, ecx - lea edx, DWORD PTR 2400959708[ebx*1+edx] - mov ebx, esi - ror esi, 1 - and ebx, eax - or ebp, ebx - mov ebx, edi - rol ebx, 5 - add ebp, ebx - mov ebx, DWORD PTR 52[esp] - add edx, ebp - mov ebp, DWORD PTR 60[esp] - xor ebx, ebp - mov ebp, DWORD PTR 20[esp] - xor ebx, ebp - mov ebp, DWORD PTR 40[esp] - ror esi, 1 - xor ebx, ebp - rol ebx, 1 - mov ebp, edi - mov DWORD PTR 52[esp],ebx - or ebp, esi - lea ebx, DWORD PTR 2400959708[ecx*1+ebx] - mov ecx, edi - and ebp, eax - and ecx, esi - or ebp, ecx - mov ecx, edx - rol ecx, 5 - ror edi, 1 - add ebp, ecx - ror edi, 1 - add ebx, ebp - ; 40_59 45 - ; 40_59 46 - mov ecx, DWORD PTR 56[esp] - mov ebp, DWORD PTR [esp] - xor ecx, ebp - mov ebp, DWORD PTR 24[esp] - xor ecx, ebp - mov ebp, DWORD PTR 44[esp] - xor ecx, ebp - mov ebp, edx - rol ecx, 1 - or ebp, edi - mov DWORD PTR 56[esp],ecx - and ebp, esi - lea ecx, DWORD PTR 2400959708[eax*1+ecx] - mov eax, edx - ror edx, 1 - and eax, edi - or ebp, eax - mov eax, ebx - rol eax, 5 - add ebp, eax - mov eax, DWORD PTR 60[esp] - add ecx, ebp - mov ebp, DWORD PTR 4[esp] - xor eax, ebp - mov ebp, DWORD PTR 28[esp] - xor eax, ebp - mov ebp, DWORD PTR 48[esp] - ror edx, 1 - xor eax, ebp - rol eax, 1 - mov ebp, ebx - mov DWORD PTR 60[esp],eax - or ebp, edx - lea eax, DWORD PTR 2400959708[esi*1+eax] - mov esi, ebx - and ebp, edi - and esi, edx - or ebp, esi - mov esi, ecx - rol esi, 5 - ror ebx, 1 - add ebp, esi - ror ebx, 1 - add eax, ebp - ; 40_59 47 - ; 40_59 48 - mov esi, DWORD PTR [esp] - mov ebp, DWORD PTR 8[esp] - xor esi, ebp - mov ebp, DWORD PTR 32[esp] - xor esi, ebp - mov ebp, DWORD PTR 52[esp] - xor esi, ebp - mov ebp, ecx - rol esi, 1 - or ebp, ebx - mov DWORD PTR [esp],esi - and ebp, edx - lea esi, DWORD PTR 2400959708[edi*1+esi] - mov edi, ecx - ror ecx, 1 - and edi, ebx - or ebp, edi - mov edi, eax - rol edi, 5 - add ebp, edi - mov edi, DWORD PTR 4[esp] - add esi, ebp - mov ebp, DWORD PTR 12[esp] - xor edi, ebp - mov ebp, DWORD PTR 36[esp] - xor edi, ebp - mov ebp, DWORD PTR 56[esp] - ror ecx, 1 - xor edi, ebp - rol edi, 1 - mov ebp, eax - mov DWORD PTR 4[esp],edi - or ebp, ecx - lea edi, DWORD PTR 2400959708[edx*1+edi] - mov edx, eax - and ebp, ebx - and edx, ecx - or ebp, edx - mov edx, esi - rol edx, 5 - ror eax, 1 - add ebp, edx - ror eax, 1 - add edi, ebp - ; 40_59 49 - ; 40_59 50 - mov edx, DWORD PTR 8[esp] - mov ebp, DWORD PTR 16[esp] - xor edx, ebp - mov ebp, DWORD PTR 40[esp] - xor edx, ebp - mov ebp, DWORD PTR 60[esp] - xor edx, ebp - mov ebp, esi - rol edx, 1 - or ebp, eax - mov DWORD PTR 8[esp],edx - and ebp, ecx - lea edx, DWORD PTR 2400959708[ebx*1+edx] - mov ebx, esi - ror esi, 1 - and ebx, eax - or ebp, ebx - mov ebx, edi - rol ebx, 5 - add ebp, ebx - mov ebx, DWORD PTR 12[esp] - add edx, ebp - mov ebp, DWORD PTR 20[esp] - xor ebx, ebp - mov ebp, DWORD PTR 44[esp] - xor ebx, ebp - mov ebp, DWORD PTR [esp] - ror esi, 1 - xor ebx, ebp - rol ebx, 1 - mov ebp, edi - mov DWORD PTR 12[esp],ebx - or ebp, esi - lea ebx, DWORD PTR 2400959708[ecx*1+ebx] - mov ecx, edi - and ebp, eax - and ecx, esi - or ebp, ecx - mov ecx, edx - rol ecx, 5 - ror edi, 1 - add ebp, ecx - ror edi, 1 - add ebx, ebp - ; 40_59 51 - ; 40_59 52 - mov ecx, DWORD PTR 16[esp] - mov ebp, DWORD PTR 24[esp] - xor ecx, ebp - mov ebp, DWORD PTR 48[esp] - xor ecx, ebp - mov ebp, DWORD PTR 4[esp] - xor ecx, ebp - mov ebp, edx - rol ecx, 1 - or ebp, edi - mov DWORD PTR 16[esp],ecx - and ebp, esi - lea ecx, DWORD PTR 2400959708[eax*1+ecx] - mov eax, edx - ror edx, 1 - and eax, edi - or ebp, eax - mov eax, ebx - rol eax, 5 - add ebp, eax - mov eax, DWORD PTR 20[esp] - add ecx, ebp - mov ebp, DWORD PTR 28[esp] - xor eax, ebp - mov ebp, DWORD PTR 52[esp] - xor eax, ebp - mov ebp, DWORD PTR 8[esp] - ror edx, 1 - xor eax, ebp - rol eax, 1 - mov ebp, ebx - mov DWORD PTR 20[esp],eax - or ebp, edx - lea eax, DWORD PTR 2400959708[esi*1+eax] - mov esi, ebx - and ebp, edi - and esi, edx - or ebp, esi - mov esi, ecx - rol esi, 5 - ror ebx, 1 - add ebp, esi - ror ebx, 1 - add eax, ebp - ; 40_59 53 - ; 40_59 54 - mov esi, DWORD PTR 24[esp] - mov ebp, DWORD PTR 32[esp] - xor esi, ebp - mov ebp, DWORD PTR 56[esp] - xor esi, ebp - mov ebp, DWORD PTR 12[esp] - xor esi, ebp - mov ebp, ecx - rol esi, 1 - or ebp, ebx - mov DWORD PTR 24[esp],esi - and ebp, edx - lea esi, DWORD PTR 2400959708[edi*1+esi] - mov edi, ecx - ror ecx, 1 - and edi, ebx - or ebp, edi - mov edi, eax - rol edi, 5 - add ebp, edi - mov edi, DWORD PTR 28[esp] - add esi, ebp - mov ebp, DWORD PTR 36[esp] - xor edi, ebp - mov ebp, DWORD PTR 60[esp] - xor edi, ebp - mov ebp, DWORD PTR 16[esp] - ror ecx, 1 - xor edi, ebp - rol edi, 1 - mov ebp, eax - mov DWORD PTR 28[esp],edi - or ebp, ecx - lea edi, DWORD PTR 2400959708[edx*1+edi] - mov edx, eax - and ebp, ebx - and edx, ecx - or ebp, edx - mov edx, esi - rol edx, 5 - ror eax, 1 - add ebp, edx - ror eax, 1 - add edi, ebp - ; 40_59 55 - ; 40_59 56 - mov edx, DWORD PTR 32[esp] - mov ebp, DWORD PTR 40[esp] - xor edx, ebp - mov ebp, DWORD PTR [esp] - xor edx, ebp - mov ebp, DWORD PTR 20[esp] - xor edx, ebp - mov ebp, esi - rol edx, 1 - or ebp, eax - mov DWORD PTR 32[esp],edx - and ebp, ecx - lea edx, DWORD PTR 2400959708[ebx*1+edx] - mov ebx, esi - ror esi, 1 - and ebx, eax - or ebp, ebx - mov ebx, edi - rol ebx, 5 - add ebp, ebx - mov ebx, DWORD PTR 36[esp] - add edx, ebp - mov ebp, DWORD PTR 44[esp] - xor ebx, ebp - mov ebp, DWORD PTR 4[esp] - xor ebx, ebp - mov ebp, DWORD PTR 24[esp] - ror esi, 1 - xor ebx, ebp - rol ebx, 1 - mov ebp, edi - mov DWORD PTR 36[esp],ebx - or ebp, esi - lea ebx, DWORD PTR 2400959708[ecx*1+ebx] - mov ecx, edi - and ebp, eax - and ecx, esi - or ebp, ecx - mov ecx, edx - rol ecx, 5 - ror edi, 1 - add ebp, ecx - ror edi, 1 - add ebx, ebp - ; 40_59 57 - ; 40_59 58 - mov ecx, DWORD PTR 40[esp] - mov ebp, DWORD PTR 48[esp] - xor ecx, ebp - mov ebp, DWORD PTR 8[esp] - xor ecx, ebp - mov ebp, DWORD PTR 28[esp] - xor ecx, ebp - mov ebp, edx - rol ecx, 1 - or ebp, edi - mov DWORD PTR 40[esp],ecx - and ebp, esi - lea ecx, DWORD PTR 2400959708[eax*1+ecx] - mov eax, edx - ror edx, 1 - and eax, edi - or ebp, eax - mov eax, ebx - rol eax, 5 - add ebp, eax - mov eax, DWORD PTR 44[esp] - add ecx, ebp - mov ebp, DWORD PTR 52[esp] - xor eax, ebp - mov ebp, DWORD PTR 12[esp] - xor eax, ebp - mov ebp, DWORD PTR 32[esp] - ror edx, 1 - xor eax, ebp - rol eax, 1 - mov ebp, ebx - mov DWORD PTR 44[esp],eax - or ebp, edx - lea eax, DWORD PTR 2400959708[esi*1+eax] - mov esi, ebx - and ebp, edi - and esi, edx - or ebp, esi - mov esi, ecx - rol esi, 5 - ror ebx, 1 - add ebp, esi - ror ebx, 1 - add eax, ebp - ; 40_59 59 - ; 20_39 60 - mov esi, DWORD PTR 48[esp] - mov ebp, DWORD PTR 56[esp] - xor esi, ebp - mov ebp, DWORD PTR 16[esp] - xor esi, ebp - mov ebp, DWORD PTR 36[esp] - xor esi, ebp - mov ebp, ecx - rol esi, 1 - xor ebp, ebx - mov DWORD PTR 48[esp],esi - xor ebp, edx - lea esi, DWORD PTR 3395469782[edi*1+esi] - mov edi, eax - rol edi, 5 - ror ecx, 1 - add edi, ebp - ror ecx, 1 - add esi, edi - ; 20_39 61 - mov edi, DWORD PTR 52[esp] - mov ebp, DWORD PTR 60[esp] - xor edi, ebp - mov ebp, DWORD PTR 20[esp] - xor edi, ebp - mov ebp, DWORD PTR 40[esp] - xor edi, ebp - mov ebp, eax - rol edi, 1 - xor ebp, ecx - mov DWORD PTR 52[esp],edi - xor ebp, ebx - lea edi, DWORD PTR 3395469782[edx*1+edi] - mov edx, esi - rol edx, 5 - ror eax, 1 - add edx, ebp - ror eax, 1 - add edi, edx - ; 20_39 62 - mov edx, DWORD PTR 56[esp] - mov ebp, DWORD PTR [esp] - xor edx, ebp - mov ebp, DWORD PTR 24[esp] - xor edx, ebp - mov ebp, DWORD PTR 44[esp] - xor edx, ebp - mov ebp, esi - rol edx, 1 - xor ebp, eax - mov DWORD PTR 56[esp],edx - xor ebp, ecx - lea edx, DWORD PTR 3395469782[ebx*1+edx] - mov ebx, edi - rol ebx, 5 - ror esi, 1 - add ebx, ebp - ror esi, 1 - add edx, ebx - ; 20_39 63 - mov ebx, DWORD PTR 60[esp] - mov ebp, DWORD PTR 4[esp] - xor ebx, ebp - mov ebp, DWORD PTR 28[esp] - xor ebx, ebp - mov ebp, DWORD PTR 48[esp] - xor ebx, ebp - mov ebp, edi - rol ebx, 1 - xor ebp, esi - mov DWORD PTR 60[esp],ebx - xor ebp, eax - lea ebx, DWORD PTR 3395469782[ecx*1+ebx] - mov ecx, edx - rol ecx, 5 - ror edi, 1 - add ecx, ebp - ror edi, 1 - add ebx, ecx - ; 20_39 64 - mov ecx, DWORD PTR [esp] - mov ebp, DWORD PTR 8[esp] - xor ecx, ebp - mov ebp, DWORD PTR 32[esp] - xor ecx, ebp - mov ebp, DWORD PTR 52[esp] - xor ecx, ebp - mov ebp, edx - rol ecx, 1 - xor ebp, edi - mov DWORD PTR [esp],ecx - xor ebp, esi - lea ecx, DWORD PTR 3395469782[eax*1+ecx] - mov eax, ebx - rol eax, 5 - ror edx, 1 - add eax, ebp - ror edx, 1 - add ecx, eax - ; 20_39 65 - mov eax, DWORD PTR 4[esp] - mov ebp, DWORD PTR 12[esp] - xor eax, ebp - mov ebp, DWORD PTR 36[esp] - xor eax, ebp - mov ebp, DWORD PTR 56[esp] - xor eax, ebp - mov ebp, ebx - rol eax, 1 - xor ebp, edx - mov DWORD PTR 4[esp],eax - xor ebp, edi - lea eax, DWORD PTR 3395469782[esi*1+eax] - mov esi, ecx - rol esi, 5 - ror ebx, 1 - add esi, ebp - ror ebx, 1 - add eax, esi - ; 20_39 66 - mov esi, DWORD PTR 8[esp] - mov ebp, DWORD PTR 16[esp] - xor esi, ebp - mov ebp, DWORD PTR 40[esp] - xor esi, ebp - mov ebp, DWORD PTR 60[esp] - xor esi, ebp - mov ebp, ecx - rol esi, 1 - xor ebp, ebx - mov DWORD PTR 8[esp],esi - xor ebp, edx - lea esi, DWORD PTR 3395469782[edi*1+esi] - mov edi, eax - rol edi, 5 - ror ecx, 1 - add edi, ebp - ror ecx, 1 - add esi, edi - ; 20_39 67 - mov edi, DWORD PTR 12[esp] - mov ebp, DWORD PTR 20[esp] - xor edi, ebp - mov ebp, DWORD PTR 44[esp] - xor edi, ebp - mov ebp, DWORD PTR [esp] - xor edi, ebp - mov ebp, eax - rol edi, 1 - xor ebp, ecx - mov DWORD PTR 12[esp],edi - xor ebp, ebx - lea edi, DWORD PTR 3395469782[edx*1+edi] - mov edx, esi - rol edx, 5 - ror eax, 1 - add edx, ebp - ror eax, 1 - add edi, edx - ; 20_39 68 - mov edx, DWORD PTR 16[esp] - mov ebp, DWORD PTR 24[esp] - xor edx, ebp - mov ebp, DWORD PTR 48[esp] - xor edx, ebp - mov ebp, DWORD PTR 4[esp] - xor edx, ebp - mov ebp, esi - rol edx, 1 - xor ebp, eax - mov DWORD PTR 16[esp],edx - xor ebp, ecx - lea edx, DWORD PTR 3395469782[ebx*1+edx] - mov ebx, edi - rol ebx, 5 - ror esi, 1 - add ebx, ebp - ror esi, 1 - add edx, ebx - ; 20_39 69 - mov ebx, DWORD PTR 20[esp] - mov ebp, DWORD PTR 28[esp] - xor ebx, ebp - mov ebp, DWORD PTR 52[esp] - xor ebx, ebp - mov ebp, DWORD PTR 8[esp] - xor ebx, ebp - mov ebp, edi - rol ebx, 1 - xor ebp, esi - mov DWORD PTR 20[esp],ebx - xor ebp, eax - lea ebx, DWORD PTR 3395469782[ecx*1+ebx] - mov ecx, edx - rol ecx, 5 - ror edi, 1 - add ecx, ebp - ror edi, 1 - add ebx, ecx - ; 20_39 70 - mov ecx, DWORD PTR 24[esp] - mov ebp, DWORD PTR 32[esp] - xor ecx, ebp - mov ebp, DWORD PTR 56[esp] - xor ecx, ebp - mov ebp, DWORD PTR 12[esp] - xor ecx, ebp - mov ebp, edx - rol ecx, 1 - xor ebp, edi - mov DWORD PTR 24[esp],ecx - xor ebp, esi - lea ecx, DWORD PTR 3395469782[eax*1+ecx] - mov eax, ebx - rol eax, 5 - ror edx, 1 - add eax, ebp - ror edx, 1 - add ecx, eax - ; 20_39 71 - mov eax, DWORD PTR 28[esp] - mov ebp, DWORD PTR 36[esp] - xor eax, ebp - mov ebp, DWORD PTR 60[esp] - xor eax, ebp - mov ebp, DWORD PTR 16[esp] - xor eax, ebp - mov ebp, ebx - rol eax, 1 - xor ebp, edx - mov DWORD PTR 28[esp],eax - xor ebp, edi - lea eax, DWORD PTR 3395469782[esi*1+eax] - mov esi, ecx - rol esi, 5 - ror ebx, 1 - add esi, ebp - ror ebx, 1 - add eax, esi - ; 20_39 72 - mov esi, DWORD PTR 32[esp] - mov ebp, DWORD PTR 40[esp] - xor esi, ebp - mov ebp, DWORD PTR [esp] - xor esi, ebp - mov ebp, DWORD PTR 20[esp] - xor esi, ebp - mov ebp, ecx - rol esi, 1 - xor ebp, ebx - mov DWORD PTR 32[esp],esi - xor ebp, edx - lea esi, DWORD PTR 3395469782[edi*1+esi] - mov edi, eax - rol edi, 5 - ror ecx, 1 - add edi, ebp - ror ecx, 1 - add esi, edi - ; 20_39 73 - mov edi, DWORD PTR 36[esp] - mov ebp, DWORD PTR 44[esp] - xor edi, ebp - mov ebp, DWORD PTR 4[esp] - xor edi, ebp - mov ebp, DWORD PTR 24[esp] - xor edi, ebp - mov ebp, eax - rol edi, 1 - xor ebp, ecx - mov DWORD PTR 36[esp],edi - xor ebp, ebx - lea edi, DWORD PTR 3395469782[edx*1+edi] - mov edx, esi - rol edx, 5 - ror eax, 1 - add edx, ebp - ror eax, 1 - add edi, edx - ; 20_39 74 - mov edx, DWORD PTR 40[esp] - mov ebp, DWORD PTR 48[esp] - xor edx, ebp - mov ebp, DWORD PTR 8[esp] - xor edx, ebp - mov ebp, DWORD PTR 28[esp] - xor edx, ebp - mov ebp, esi - rol edx, 1 - xor ebp, eax - mov DWORD PTR 40[esp],edx - xor ebp, ecx - lea edx, DWORD PTR 3395469782[ebx*1+edx] - mov ebx, edi - rol ebx, 5 - ror esi, 1 - add ebx, ebp - ror esi, 1 - add edx, ebx - ; 20_39 75 - mov ebx, DWORD PTR 44[esp] - mov ebp, DWORD PTR 52[esp] - xor ebx, ebp - mov ebp, DWORD PTR 12[esp] - xor ebx, ebp - mov ebp, DWORD PTR 32[esp] - xor ebx, ebp - mov ebp, edi - rol ebx, 1 - xor ebp, esi - mov DWORD PTR 44[esp],ebx - xor ebp, eax - lea ebx, DWORD PTR 3395469782[ecx*1+ebx] - mov ecx, edx - rol ecx, 5 - ror edi, 1 - add ecx, ebp - ror edi, 1 - add ebx, ecx - ; 20_39 76 - mov ecx, DWORD PTR 48[esp] - mov ebp, DWORD PTR 56[esp] - xor ecx, ebp - mov ebp, DWORD PTR 16[esp] - xor ecx, ebp - mov ebp, DWORD PTR 36[esp] - xor ecx, ebp - mov ebp, edx - rol ecx, 1 - xor ebp, edi - mov DWORD PTR 48[esp],ecx - xor ebp, esi - lea ecx, DWORD PTR 3395469782[eax*1+ecx] - mov eax, ebx - rol eax, 5 - ror edx, 1 - add eax, ebp - ror edx, 1 - add ecx, eax - ; 20_39 77 - mov eax, DWORD PTR 52[esp] - mov ebp, DWORD PTR 60[esp] - xor eax, ebp - mov ebp, DWORD PTR 20[esp] - xor eax, ebp - mov ebp, DWORD PTR 40[esp] - xor eax, ebp - mov ebp, ebx - rol eax, 1 - xor ebp, edx - mov DWORD PTR 52[esp],eax - xor ebp, edi - lea eax, DWORD PTR 3395469782[esi*1+eax] - mov esi, ecx - rol esi, 5 - ror ebx, 1 - add esi, ebp - ror ebx, 1 - add eax, esi - ; 20_39 78 - mov esi, DWORD PTR 56[esp] - mov ebp, DWORD PTR [esp] - xor esi, ebp - mov ebp, DWORD PTR 24[esp] - xor esi, ebp - mov ebp, DWORD PTR 44[esp] - xor esi, ebp - mov ebp, ecx - rol esi, 1 - xor ebp, ebx - mov DWORD PTR 56[esp],esi - xor ebp, edx - lea esi, DWORD PTR 3395469782[edi*1+esi] - mov edi, eax - rol edi, 5 - ror ecx, 1 - add edi, ebp - ror ecx, 1 - add esi, edi - ; 20_39 79 - mov edi, DWORD PTR 60[esp] - mov ebp, DWORD PTR 4[esp] - xor edi, ebp - mov ebp, DWORD PTR 28[esp] - xor edi, ebp - mov ebp, DWORD PTR 48[esp] - xor edi, ebp - mov ebp, eax - rol edi, 1 - xor ebp, ecx - mov DWORD PTR 60[esp],edi - xor ebp, ebx - lea edi, DWORD PTR 3395469782[edx*1+edi] - mov edx, esi - rol edx, 5 - add edx, ebp - mov ebp, DWORD PTR 128[esp] - ror eax, 1 - add edi, edx - ror eax, 1 - ; End processing - ; - mov edx, DWORD PTR 12[ebp] - add edx, ecx - mov ecx, DWORD PTR 4[ebp] - add ecx, esi - mov esi, eax - mov eax, DWORD PTR [ebp] - mov DWORD PTR 12[ebp],edx - add eax, edi - mov edi, DWORD PTR 16[ebp] - add edi, ebx - mov ebx, DWORD PTR 8[ebp] - add ebx, esi - mov DWORD PTR [ebp],eax - mov esi, DWORD PTR 132[esp] - mov DWORD PTR 8[ebp],ebx - add esi, 64 - mov eax, DWORD PTR 68[esp] - mov DWORD PTR 16[ebp],edi - cmp esi, eax - mov DWORD PTR 4[ebp],ecx - jl L000start - add esp, 108 - pop edi - pop ebx - pop ebp - pop esi - ret -_TEXT SEGMENT -PUBLIC _sha1_block_asm_host_order - -_sha1_block_asm_host_order PROC NEAR - mov ecx, DWORD PTR 12[esp] - push esi - shl ecx, 6 - mov esi, DWORD PTR 12[esp] - push ebp - add ecx, esi - push ebx - mov ebp, DWORD PTR 16[esp] - push edi - mov edx, DWORD PTR 12[ebp] - sub esp, 108 - mov edi, DWORD PTR 16[ebp] - mov ebx, DWORD PTR 8[ebp] - mov DWORD PTR 68[esp],ecx - ; First we need to setup the X array - mov eax, DWORD PTR [esi] - mov ecx, DWORD PTR 4[esi] - mov DWORD PTR [esp],eax - mov DWORD PTR 4[esp],ecx - mov eax, DWORD PTR 8[esi] - mov ecx, DWORD PTR 12[esi] - mov DWORD PTR 8[esp],eax - mov DWORD PTR 12[esp],ecx - mov eax, DWORD PTR 16[esi] - mov ecx, DWORD PTR 20[esi] - mov DWORD PTR 16[esp],eax - mov DWORD PTR 20[esp],ecx - mov eax, DWORD PTR 24[esi] - mov ecx, DWORD PTR 28[esi] - mov DWORD PTR 24[esp],eax - mov DWORD PTR 28[esp],ecx - mov eax, DWORD PTR 32[esi] - mov ecx, DWORD PTR 36[esi] - mov DWORD PTR 32[esp],eax - mov DWORD PTR 36[esp],ecx - mov eax, DWORD PTR 40[esi] - mov ecx, DWORD PTR 44[esi] - mov DWORD PTR 40[esp],eax - mov DWORD PTR 44[esp],ecx - mov eax, DWORD PTR 48[esi] - mov ecx, DWORD PTR 52[esi] - mov DWORD PTR 48[esp],eax - mov DWORD PTR 52[esp],ecx - mov eax, DWORD PTR 56[esi] - mov ecx, DWORD PTR 60[esi] - mov DWORD PTR 56[esp],eax - mov DWORD PTR 60[esp],ecx - jmp L001shortcut -_sha1_block_asm_host_order ENDP -_TEXT ENDS -_sha1_block_asm_data_order ENDP -_TEXT ENDS -END diff --git a/src/lib/libcrypto/sha/asm/sha1-586.pl b/src/lib/libcrypto/sha/asm/sha1-586.pl index 48d9192a4e..09df993ecd 100644 --- a/src/lib/libcrypto/sha/asm/sha1-586.pl +++ b/src/lib/libcrypto/sha/asm/sha1-586.pl @@ -392,7 +392,7 @@ sub sha1_block_data &X_expand("esi"); &mov(&wparam(1),"esi"); - &set_label("shortcut", 1); + &set_label("shortcut", 0, 1); &comment(""); &comment("Start processing"); diff --git a/src/lib/libcrypto/sha/sha_locl.h b/src/lib/libcrypto/sha/sha_locl.h index 3e6f489b87..2f8aef83f3 100644 --- a/src/lib/libcrypto/sha/sha_locl.h +++ b/src/lib/libcrypto/sha/sha_locl.h @@ -130,11 +130,7 @@ # error "Either SHA_0 or SHA_1 must be defined." #endif -#ifndef FLAT_INC -#include "../md32_common.h" -#else #include "md32_common.h" -#endif #define INIT_DATA_h0 0x67452301UL #define INIT_DATA_h1 0xefcdab89UL diff --git a/src/lib/libcrypto/util/libeay.num b/src/lib/libcrypto/util/libeay.num index e3818ef6e4..f611d6b283 100644 --- a/src/lib/libcrypto/util/libeay.num +++ b/src/lib/libcrypto/util/libeay.num @@ -2227,3 +2227,6 @@ BIO_callback_ctrl 2252 RAND_egd 2253 RAND_status 2254 bn_dump1 2255 +des_check_key_parity 2256 +lh_num_items 2257 +RAND_event 2258 diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl index 6fbf3ceca6..100d76f279 100644 --- a/src/lib/libcrypto/util/mk1mf.pl +++ b/src/lib/libcrypto/util/mk1mf.pl @@ -8,6 +8,7 @@ $INSTALLTOP="/usr/local/ssl"; $OPTIONS=""; $ssl_version=""; +$banner="\t\@echo Building OpenSSL"; open(IN,") { @@ -59,6 +60,7 @@ and [options] can be one of just-ssl - remove all non-ssl keys/digest no-asm - No x86 asm nasm - Use NASM for x86 asm + gaswin - Use GNU as with Mingw32 no-socks - No socket code no-err - No error strings dll/shlib - Build shared libraries (MS) @@ -850,6 +852,7 @@ sub read_options elsif (/^no-hmac$/) { $no_hmac=1; } elsif (/^no-asm$/) { $no_asm=1; } elsif (/^nasm$/) { $nasm=1; } + elsif (/^gaswin$/) { $gaswin=1; } elsif (/^no-ssl2$/) { $no_ssl2=1; } elsif (/^no-ssl3$/) { $no_ssl3=1; } elsif (/^no-err$/) { $no_err=1; } diff --git a/src/lib/libcrypto/util/mkerr.pl b/src/lib/libcrypto/util/mkerr.pl index ebc059ef22..8e18f3c2df 100644 --- a/src/lib/libcrypto/util/mkerr.pl +++ b/src/lib/libcrypto/util/mkerr.pl @@ -284,6 +284,17 @@ EOF # Rewrite the C source file containing the error details. + # First, read any existing reason string definitions: + my %err_reason_strings; + if (open(IN,"<$cfile")) { + while () { + if (/\b(${lib}_R_\w*)\b.*\"(.*)\"/) { + $err_reason_strings{$1} = $2; + } + } + close(IN); + } + my $hincf; if($static) { $hfile =~ /([^\/]+)$/; @@ -352,7 +363,8 @@ EOF */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include @@ -385,9 +397,13 @@ EOF foreach $i (@reasons) { my $rn; my $nspc = 0; - $i =~ /^${lib}_R_(\S+)$/; - $rn = $1; - $rn =~ tr/_[A-Z]/ [a-z]/; + if (exists $err_reason_strings{$i}) { + $rn = $err_reason_strings{$i}; + } else { + $i =~ /^${lib}_R_(\S+)$/; + $rn = $1; + $rn =~ tr/_[A-Z]/ [a-z]/; + } $nspc = 40 - length($i) unless length($i) > 40; $nspc = " " x $nspc; print OUT "{${i}${nspc},\"$rn\"},\n"; @@ -465,7 +481,7 @@ EOF } close OUT; - + undef %err_reason_strings; } if($debug && defined(%notrans)) { diff --git a/src/lib/libcrypto/util/pl/BC-32.pl b/src/lib/libcrypto/util/pl/BC-32.pl index df6e2c742e..7f57809a16 100644 --- a/src/lib/libcrypto/util/pl/BC-32.pl +++ b/src/lib/libcrypto/util/pl/BC-32.pl @@ -109,7 +109,7 @@ sub do_lib_rule { # $ret.="\t\$(RM) \$(O_$Name)\n"; $ret.="\techo LIB $<\n"; - $ret.="\t\$(MKLIB) $lfile$target \$(addprefix +, $objs)\n"; + $ret.="\t&\$(MKLIB) $lfile$target -+\$**\n"; } else { diff --git a/src/lib/libcrypto/util/pl/Mingw32.pl b/src/lib/libcrypto/util/pl/Mingw32.pl index 585cacd820..c687d9b118 100644 --- a/src/lib/libcrypto/util/pl/Mingw32.pl +++ b/src/lib/libcrypto/util/pl/Mingw32.pl @@ -21,6 +21,30 @@ if ($debug) else { $cflags="-DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall"; } +if ($gaswin and !$no_asm) + { + $bn_asm_obj='$(OBJ_D)/bn-win32.o'; + $bn_asm_src='crypto/bn/asm/bn-win32.s'; + $des_enc_obj='$(OBJ_D)/d-win32.o $(OBJ_D)/y-win32.o'; + $des_enc_src='crypto/des/asm/d-win32.s crypto/des/asm/y-win32.s'; + $bf_enc_obj='$(OBJ_D)/b-win32.o'; + $bf_enc_src='crypto/bf/asm/b-win32.s'; +# $cast_enc_obj='$(OBJ_D)/c-win32.o'; +# $cast_enc_src='crypto/cast/asm/c-win32.s'; + $rc4_enc_obj='$(OBJ_D)/r4-win32.o'; + $rc4_enc_src='crypto/rc4/asm/r4-win32.s'; + $rc5_enc_obj='$(OBJ_D)/r5-win32.o'; + $rc5_enc_src='crypto/rc5/asm/r5-win32.s'; + $md5_asm_obj='$(OBJ_D)/m5-win32.o'; + $md5_asm_src='crypto/md5/asm/m5-win32.s'; + $rmd160_asm_obj='$(OBJ_D)/rm-win32.o'; + $rmd160_asm_src='crypto/ripemd/asm/rm-win32.s'; + $sha1_asm_obj='$(OBJ_D)/s1-win32.o'; + $sha1_asm_src='crypto/sha/asm/s1-win32.s'; + $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM"; + } + + $obj='.o'; $ofile='-o '; @@ -76,4 +100,3 @@ sub do_link_rule return($ret); } 1; - diff --git a/src/lib/libcrypto/util/selftest.pl b/src/lib/libcrypto/util/selftest.pl index 91e962a312..04b4425d7e 100644 --- a/src/lib/libcrypto/util/selftest.pl +++ b/src/lib/libcrypto/util/selftest.pl @@ -25,7 +25,7 @@ open(OUT,">$report") or die; print OUT "OpenSSL self-test report:\n\n"; $uname=`uname -a`; -$uname="??" if $uname eq ""; +$uname="??\n" if $uname eq ""; $c=`sh config -t`; foreach $_ (split("\n",$c)) { @@ -83,6 +83,11 @@ if (open(TEST,">cctest.c")) { print OUT "Compiler doesn't work.\n"; goto err; } + system("ar r cctest.a /dev/null"); + if (not -f "cctest.a") { + print OUT "Check your archive tool (ar).\n"; + goto err; + } } else { print OUT "Can't create cctest.c\n"; } @@ -129,14 +134,14 @@ if (/no-/) } print "Running make test...\n"; -if (system("make test 2>&1 | tee make.log") > 255) +if (system("make test 2>&1 | tee maketest.log") > 255) { print OUT "make test failed!\n"; } else { $ok=1; } -if ($ok and open(IN,") { $ok=2 if /^platform: $platform/; } @@ -155,6 +160,15 @@ if ($ok != 2) { } else { print OUT "make.log not found!\n"; } + if (open(IN,") { + print OUT; + } + close(IN); + print OUT $sep; + } else { + print OUT "maketest.log not found!\n"; + } } else { print OUT "Test passed.\n"; } diff --git a/src/lib/libcrypto/util/sep_lib.sh b/src/lib/libcrypto/util/sep_lib.sh index 34c2c9f8ba..e69de29bb2 100644 --- a/src/lib/libcrypto/util/sep_lib.sh +++ b/src/lib/libcrypto/util/sep_lib.sh @@ -1,34 +0,0 @@ -#!/bin/sh - -cwd=`pwd` -/bin/rm -fr tmp/* - -cd crypto/des -make -f Makefile.uni tar -make -f Makefile.uni tar_lit -/bin/mv libdes.tgz $cwd/tmp -/bin/mv libdes-l.tgz $cwd/tmp -cd $cwd - -for name in md5 sha cast bf idea rc4 rc2 -do - echo doing $name - (cd crypto; tar cfh - $name)|(cd tmp; tar xf -) - cd tmp/$name - /bin/rm -f Makefile - /bin/rm -f Makefile.ssl - /bin/rm -f Makefile.ssl.orig - /bin/rm -f *.old - /bin/mv Makefile.uni Makefile - - if [ -d asm ]; then - mkdir asm/perlasm - cp $cwd/crypto/perlasm/*.pl asm/perlasm - fi - cd .. - tar cf - $name|gzip >$name.tgz -# /bin/rm -fr $name - cd $cwd -done - - diff --git a/src/lib/libcrypto/x509/x509.h b/src/lib/libcrypto/x509/x509.h index d3336d9ceb..0192272e7c 100644 --- a/src/lib/libcrypto/x509/x509.h +++ b/src/lib/libcrypto/x509/x509.h @@ -284,7 +284,9 @@ DECLARE_STACK_OF(X509_TRUST) /* standard trust ids */ -#define X509_TRUST_ANY 1 +#define X509_TRUST_DEFAULT -1 /* Only valid in purpose settings */ + +#define X509_TRUST_COMPAT 1 #define X509_TRUST_SSL_CLIENT 2 #define X509_TRUST_SSL_SERVER 3 #define X509_TRUST_EMAIL 4 diff --git a/src/lib/libcrypto/x509/x509_err.c b/src/lib/libcrypto/x509/x509_err.c index fdedbdac34..848add56e9 100644 --- a/src/lib/libcrypto/x509/x509_err.c +++ b/src/lib/libcrypto/x509/x509_err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/x509/x509_trs.c b/src/lib/libcrypto/x509/x509_trs.c index 9f7d67952d..c779aaf94d 100644 --- a/src/lib/libcrypto/x509/x509_trs.c +++ b/src/lib/libcrypto/x509/x509_trs.c @@ -65,7 +65,7 @@ static int tr_cmp(X509_TRUST **a, X509_TRUST **b); static void trtable_free(X509_TRUST *p); static int trust_1oidany(X509_TRUST *trust, X509 *x, int flags); -static int trust_any(X509_TRUST *trust, X509 *x, int flags); +static int trust_compat(X509_TRUST *trust, X509 *x, int flags); static int obj_trust(int id, X509 *x, int flags); static int (*default_trust)(int id, X509 *x, int flags) = obj_trust; @@ -76,7 +76,7 @@ static int (*default_trust)(int id, X509 *x, int flags) = obj_trust; */ static X509_TRUST trstandard[] = { -{X509_TRUST_ANY, 0, trust_any, "Any", 0, NULL}, +{X509_TRUST_COMPAT, 0, trust_compat, "compatible", 0, NULL}, {X509_TRUST_SSL_CLIENT, 0, trust_1oidany, "SSL Client", NID_client_auth, NULL}, {X509_TRUST_SSL_SERVER, 0, trust_1oidany, "SSL Client", NID_server_auth, NULL}, {X509_TRUST_EMAIL, 0, trust_1oidany, "S/MIME email", NID_email_protect, NULL}, @@ -107,8 +107,8 @@ int X509_check_trust(X509 *x, int id, int flags) X509_TRUST *pt; int idx; if(id == -1) return 1; - if(!(idx = X509_TRUST_get_by_id(id))) - return default_trust(id, x, flags); + idx = X509_TRUST_get_by_id(id); + if(idx == -1) return default_trust(id, x, flags); pt = X509_TRUST_get0(idx); return pt->check_trust(pt, x, flags); } @@ -230,6 +230,11 @@ static int trust_1oidany(X509_TRUST *trust, X509 *x, int flags) /* we don't have any trust settings: for compatibility * we return trusted if it is self signed */ + return trust_compat(trust, x, flags); +} + +static int trust_compat(X509_TRUST *trust, X509 *x, int flags) +{ X509_check_purpose(x, -1, 0); if(x->ex_flags & EXFLAG_SS) return X509_TRUST_TRUSTED; else return X509_TRUST_UNTRUSTED; @@ -257,7 +262,3 @@ static int obj_trust(int id, X509 *x, int flags) return X509_TRUST_UNTRUSTED; } -static int trust_any(X509_TRUST *trust, X509 *x, int flags) -{ - return X509_TRUST_TRUSTED; -} diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c index 4fdff54124..3ddb2303d3 100644 --- a/src/lib/libcrypto/x509/x509_vfy.c +++ b/src/lib/libcrypto/x509/x509_vfy.c @@ -436,11 +436,14 @@ static int internal_verify(X509_STORE_CTX *ctx) } if (X509_verify(xs,pkey) <= 0) { - EVP_PKEY_free(pkey); ctx->error=X509_V_ERR_CERT_SIGNATURE_FAILURE; ctx->current_cert=xs; ok=(*cb)(0,ctx); - if (!ok) goto end; + if (!ok) + { + EVP_PKEY_free(pkey); + goto end; + } } EVP_PKEY_free(pkey); pkey=NULL; @@ -768,18 +771,25 @@ int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, if(!purpose) purpose = def_purpose; /* If we have a purpose then check it is valid */ if(purpose) { + X509_PURPOSE *ptmp; idx = X509_PURPOSE_get_by_id(purpose); if(idx == -1) { X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT, X509_R_UNKNOWN_PURPOSE_ID); return 0; } - /* If trust not set then get from purpose default */ - if(!trust) { - X509_PURPOSE *ptmp; + ptmp = X509_PURPOSE_get0(idx); + if(ptmp->trust == X509_TRUST_DEFAULT) { + idx = X509_PURPOSE_get_by_id(def_purpose); + if(idx == -1) { + X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT, + X509_R_UNKNOWN_PURPOSE_ID); + return 0; + } ptmp = X509_PURPOSE_get0(idx); - trust = ptmp->trust; } + /* If trust not set then get from purpose default */ + if(!trust) trust = ptmp->trust; } if(trust) { idx = X509_TRUST_get_by_id(trust); diff --git a/src/lib/libcrypto/x509/x509name.c b/src/lib/libcrypto/x509/x509name.c index cf2382d42c..4c20e03ece 100644 --- a/src/lib/libcrypto/x509/x509name.c +++ b/src/lib/libcrypto/x509/x509name.c @@ -352,7 +352,7 @@ int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, int i; if ((ne == NULL) || ((bytes == NULL) && (len != 0))) return(0); - if(type & MBSTRING_FLAG) + if((type > 0) && (type & MBSTRING_FLAG)) return ASN1_STRING_set_by_NID(&ne->value, bytes, len, type, OBJ_obj2nid(ne->object)) ? 1 : 0; diff --git a/src/lib/libcrypto/x509v3/v3_purp.c b/src/lib/libcrypto/x509v3/v3_purp.c index b7494ebcd5..5594a1d64f 100644 --- a/src/lib/libcrypto/x509v3/v3_purp.c +++ b/src/lib/libcrypto/x509v3/v3_purp.c @@ -71,6 +71,7 @@ static int purpose_smime(X509 *x, int ca); static int check_purpose_smime_sign(X509_PURPOSE *xp, X509 *x, int ca); static int check_purpose_smime_encrypt(X509_PURPOSE *xp, X509 *x, int ca); static int check_purpose_crl_sign(X509_PURPOSE *xp, X509 *x, int ca); +static int no_check(X509_PURPOSE *xp, X509 *x, int ca); static int xp_cmp(X509_PURPOSE **a, X509_PURPOSE **b); static void xptable_free(X509_PURPOSE *p); @@ -81,7 +82,8 @@ static X509_PURPOSE xstandard[] = { {X509_PURPOSE_NS_SSL_SERVER, X509_TRUST_SSL_SERVER, 0, check_purpose_ns_ssl_server, "Netscape SSL server", "nssslserver", NULL}, {X509_PURPOSE_SMIME_SIGN, X509_TRUST_EMAIL, 0, check_purpose_smime_sign, "S/MIME signing", "smimesign", NULL}, {X509_PURPOSE_SMIME_ENCRYPT, X509_TRUST_EMAIL, 0, check_purpose_smime_encrypt, "S/MIME encryption", "smimeencrypt", NULL}, - {X509_PURPOSE_CRL_SIGN, X509_TRUST_ANY, 0, check_purpose_crl_sign, "CRL signing", "crlsign", NULL}, + {X509_PURPOSE_CRL_SIGN, X509_TRUST_COMPAT, 0, check_purpose_crl_sign, "CRL signing", "crlsign", NULL}, + {X509_PURPOSE_ANY, X509_TRUST_DEFAULT, 0, no_check, "Any Purpose", "any", NULL}, }; #define X509_PURPOSE_COUNT (sizeof(xstandard)/sizeof(X509_PURPOSE)) @@ -454,3 +456,8 @@ static int check_purpose_crl_sign(X509_PURPOSE *xp, X509 *x, int ca) if(ku_reject(x, KU_CRL_SIGN)) return 0; return 1; } + +static int no_check(X509_PURPOSE *xp, X509 *x, int ca) +{ + return 1; +} diff --git a/src/lib/libcrypto/x509v3/v3err.c b/src/lib/libcrypto/x509v3/v3err.c index b7d4e350c4..aa4a605dc4 100644 --- a/src/lib/libcrypto/x509v3/v3err.c +++ b/src/lib/libcrypto/x509v3/v3err.c @@ -54,7 +54,8 @@ */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file. + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. */ #include diff --git a/src/lib/libcrypto/x509v3/x509v3.h b/src/lib/libcrypto/x509v3/x509v3.h index fe01755797..96ceb7c4fb 100644 --- a/src/lib/libcrypto/x509v3/x509v3.h +++ b/src/lib/libcrypto/x509v3/x509v3.h @@ -179,8 +179,8 @@ union { } GENERAL_NAME; typedef struct ACCESS_DESCRIPTION_st { -ASN1_OBJECT *method; -GENERAL_NAME *location; + ASN1_OBJECT *method; + GENERAL_NAME *location; } ACCESS_DESCRIPTION; DECLARE_STACK_OF(GENERAL_NAME) @@ -344,9 +344,10 @@ typedef struct x509_purpose_st { #define X509_PURPOSE_SMIME_SIGN 4 #define X509_PURPOSE_SMIME_ENCRYPT 5 #define X509_PURPOSE_CRL_SIGN 6 +#define X509_PURPOSE_ANY 7 #define X509_PURPOSE_MIN 1 -#define X509_PURPOSE_MAX 6 +#define X509_PURPOSE_MAX 7 DECLARE_STACK_OF(X509_PURPOSE) -- cgit v1.2.3-55-g6feb