diff options
Diffstat (limited to 'deps/openssl/openssl/crypto/bf')
22 files changed, 91 insertions, 2280 deletions
diff --git a/deps/openssl/openssl/crypto/bf/COPYRIGHT b/deps/openssl/openssl/crypto/bf/COPYRIGHT deleted file mode 100644 index 6857223506..0000000000 --- a/deps/openssl/openssl/crypto/bf/COPYRIGHT +++ /dev/null @@ -1,46 +0,0 @@ -Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) -All rights reserved. - -This package is an Blowfish implementation written -by Eric Young (eay@cryptsoft.com). - -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. - -Copyright remains Eric Young's, and as such any Copyright notices in -the code are not to be removed. - -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 software developed by Eric Young (eay@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 license 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 distrubution license -[including the GNU Public License.] - -The reason behind this being stated in this direct manner is past -experience in code simply being copied and the attribution removed -from it and then being distributed as part of other packages. This -implementation was a non-trivial and unpaid effort. diff --git a/deps/openssl/openssl/crypto/bf/INSTALL b/deps/openssl/openssl/crypto/bf/INSTALL deleted file mode 100644 index 3b25923532..0000000000 --- a/deps/openssl/openssl/crypto/bf/INSTALL +++ /dev/null @@ -1,14 +0,0 @@ -This Eric Young's blowfish implementation, taken from his SSLeay library -and made available as a separate library. - -The version number (0.7.2m) is the SSLeay version that this library was -taken from. - -To build, just unpack and type make. -If you are not using gcc, edit the Makefile. -If you are compiling for an x86 box, try the assembler (it needs improving). -There are also some compile time options that can improve performance, -these are documented in the Makefile. - -eric 15-Apr-1997 - diff --git a/deps/openssl/openssl/crypto/bf/Makefile b/deps/openssl/openssl/crypto/bf/Makefile deleted file mode 100644 index 6dd2015537..0000000000 --- a/deps/openssl/openssl/crypto/bf/Makefile +++ /dev/null @@ -1,103 +0,0 @@ -# -# OpenSSL/crypto/blowfish/Makefile -# - -DIR= bf -TOP= ../.. -CC= cc -CPP= $(CC) -E -INCLUDES= -CFLAG=-g -MAKEFILE= Makefile -AR= ar r - -BF_ENC= bf_enc.o - -CFLAGS= $(INCLUDES) $(CFLAG) -ASFLAGS= $(INCLUDES) $(ASFLAG) -AFLAGS= $(ASFLAGS) - -GENERAL=Makefile -TEST=bftest.c -APPS= - -LIB=$(TOP)/libcrypto.a -LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c -LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cfb64.o bf_ofb64.o - -SRC= $(LIBSRC) - -EXHEADER= blowfish.h -HEADER= bf_pi.h bf_locl.h $(EXHEADER) - -ALL= $(GENERAL) $(SRC) $(HEADER) - -top: - (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) - -all: lib - -lib: $(LIBOBJ) - $(AR) $(LIB) $(LIBOBJ) - $(RANLIB) $(LIB) || echo Never mind. - @touch lib - -bf-586.s: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl - $(PERL) asm/bf-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ - -files: - $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO - -links: - @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) - @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) - @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) - -# We need to use force because 'install' matches 'INSTALL' on case -# insensitive systems -FRC.install: -install: FRC.install - @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... - @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ - do \ - (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ - chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ - done; - -tags: - ctags $(SRC) - -tests: - -lint: - lint -DLINT $(INCLUDES) $(SRC)>fluff - -update: depend - -depend: - @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... - $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) - -dclean: - $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new - mv -f Makefile.new $(MAKEFILE) - -clean: - rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -bf_cfb64.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h -bf_cfb64.o: ../../include/openssl/opensslconf.h bf_cfb64.c bf_locl.h -bf_ecb.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h -bf_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h -bf_ecb.o: bf_ecb.c bf_locl.h -bf_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h -bf_enc.o: ../../include/openssl/opensslconf.h bf_enc.c bf_locl.h -bf_ofb64.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h -bf_ofb64.o: ../../include/openssl/opensslconf.h bf_locl.h bf_ofb64.c -bf_skey.o: ../../include/openssl/blowfish.h ../../include/openssl/crypto.h -bf_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h -bf_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h -bf_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h -bf_skey.o: ../../include/openssl/symhacks.h bf_locl.h bf_pi.h bf_skey.c diff --git a/deps/openssl/openssl/crypto/bf/README b/deps/openssl/openssl/crypto/bf/README deleted file mode 100644 index f2712fd0e7..0000000000 --- a/deps/openssl/openssl/crypto/bf/README +++ /dev/null @@ -1,8 +0,0 @@ -This is a quick packaging up of my blowfish code into a library. -It has been lifted from SSLeay. -The copyright notices seem a little harsh because I have not spent the -time to rewrite the conditions from the normal SSLeay ones. - -Basically if you just want to play with the library, not a problem. - -eric 15-Apr-1997 diff --git a/deps/openssl/openssl/crypto/bf/VERSION b/deps/openssl/openssl/crypto/bf/VERSION deleted file mode 100644 index be995855e4..0000000000 --- a/deps/openssl/openssl/crypto/bf/VERSION +++ /dev/null @@ -1,6 +0,0 @@ -The version numbers will follow my SSL implementation - -0.7.2r - Some reasonable default compiler options from - Peter Gutman <pgut001@cs.auckland.ac.nz> - -0.7.2m - the first release diff --git a/deps/openssl/openssl/crypto/bf/asm/bf-586.pl b/deps/openssl/openssl/crypto/bf/asm/bf-586.pl index b74cfbafd4..ebc24f48a1 100644 --- a/deps/openssl/openssl/crypto/bf/asm/bf-586.pl +++ b/deps/openssl/openssl/crypto/bf/asm/bf-586.pl @@ -1,10 +1,20 @@ -#!/usr/local/bin/perl +#! /usr/bin/env perl +# Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. +# +# Licensed under the OpenSSL license (the "License"). You may not use +# this file except in compliance with the License. You can obtain a copy +# in the file LICENSE in the source distribution or at +# https://www.openssl.org/source/license.html + $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; push(@INC,"${dir}","${dir}../../perlasm"); require "x86asm.pl"; require "cbc.pl"; +$output = pop; +open STDOUT,">$output"; + &asm_init($ARGV[0],"bf-586.pl",$ARGV[$#ARGV] eq "386"); $BF_ROUNDS=16; @@ -22,6 +32,8 @@ $tmp4="edx"; &cbc("BF_cbc_encrypt","BF_encrypt","BF_decrypt",1,4,5,3,-1,-1); &asm_finish(); +close STDOUT; + sub BF_encrypt { local($name,$enc)=@_; diff --git a/deps/openssl/openssl/crypto/bf/asm/bf-686.pl b/deps/openssl/openssl/crypto/bf/asm/bf-686.pl deleted file mode 100644 index 8e4c25f598..0000000000 --- a/deps/openssl/openssl/crypto/bf/asm/bf-686.pl +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/local/bin/perl - -push(@INC,"perlasm","../../perlasm"); -require "x86asm.pl"; -require "cbc.pl"; - -&asm_init($ARGV[0],"bf-686.pl"); - -$BF_ROUNDS=16; -$BF_OFF=($BF_ROUNDS+2)*4; -$L="ecx"; -$R="edx"; -$P="edi"; -$tot="esi"; -$tmp1="eax"; -$tmp2="ebx"; -$tmp3="ebp"; - -&des_encrypt("BF_encrypt",1); -&des_encrypt("BF_decrypt",0); -&cbc("BF_cbc_encrypt","BF_encrypt","BF_decrypt",1,4,5,3,-1,-1); - -&asm_finish(); - -&file_end(); - -sub des_encrypt - { - local($name,$enc)=@_; - - &function_begin($name,""); - - &comment(""); - &comment("Load the 2 words"); - &mov("eax",&wparam(0)); - &mov($L,&DWP(0,"eax","",0)); - &mov($R,&DWP(4,"eax","",0)); - - &comment(""); - &comment("P pointer, s and enc flag"); - &mov($P,&wparam(1)); - - &xor( $tmp1, $tmp1); - &xor( $tmp2, $tmp2); - - # encrypting part - - if ($enc) - { - &xor($L,&DWP(0,$P,"",0)); - for ($i=0; $i<$BF_ROUNDS; $i+=2) - { - &comment(""); - &comment("Round $i"); - &BF_ENCRYPT($i+1,$R,$L,$P,$tot,$tmp1,$tmp2,$tmp3); - - &comment(""); - &comment("Round ".sprintf("%d",$i+1)); - &BF_ENCRYPT($i+2,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3); - } - &xor($R,&DWP(($BF_ROUNDS+1)*4,$P,"",0)); - - &mov("eax",&wparam(0)); - &mov(&DWP(0,"eax","",0),$R); - &mov(&DWP(4,"eax","",0),$L); - &function_end_A($name); - } - else - { - &xor($L,&DWP(($BF_ROUNDS+1)*4,$P,"",0)); - for ($i=$BF_ROUNDS; $i>0; $i-=2) - { - &comment(""); - &comment("Round $i"); - &BF_ENCRYPT($i,$R,$L,$P,$tot,$tmp1,$tmp2,$tmp3); - &comment(""); - &comment("Round ".sprintf("%d",$i-1)); - &BF_ENCRYPT($i-1,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3); - } - &xor($R,&DWP(0,$P,"",0)); - - &mov("eax",&wparam(0)); - &mov(&DWP(0,"eax","",0),$R); - &mov(&DWP(4,"eax","",0),$L); - &function_end_A($name); - } - - &function_end_B($name); - } - -sub BF_ENCRYPT - { - local($i,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3)=@_; - - &rotr( $R, 16); - &mov( $tot, &DWP(&n2a($i*4),$P,"",0)); - - &movb( &LB($tmp1), &HB($R)); - &movb( &LB($tmp2), &LB($R)); - - &rotr( $R, 16); - &xor( $L, $tot); - - &mov( $tot, &DWP(&n2a($BF_OFF+0x0000),$P,$tmp1,4)); - &mov( $tmp3, &DWP(&n2a($BF_OFF+0x0400),$P,$tmp2,4)); - - &movb( &LB($tmp1), &HB($R)); - &movb( &LB($tmp2), &LB($R)); - - &add( $tot, $tmp3); - &mov( $tmp1, &DWP(&n2a($BF_OFF+0x0800),$P,$tmp1,4)); # delay - - &xor( $tot, $tmp1); - &mov( $tmp3, &DWP(&n2a($BF_OFF+0x0C00),$P,$tmp2,4)); - - &add( $tot, $tmp3); - &xor( $tmp1, $tmp1); - - &xor( $L, $tot); - # delay - } - -sub n2a - { - sprintf("%d",$_[0]); - } - diff --git a/deps/openssl/openssl/crypto/bf/asm/readme b/deps/openssl/openssl/crypto/bf/asm/readme deleted file mode 100644 index 2385fa3812..0000000000 --- a/deps/openssl/openssl/crypto/bf/asm/readme +++ /dev/null @@ -1,10 +0,0 @@ -There are blowfish assembler generation scripts. -bf-586.pl version is for the pentium and -bf-686.pl is my original version, which is faster on the pentium pro. - -When using a bf-586.pl, the pentium pro/II is %8 slower than using -bf-686.pl. When using a bf-686.pl, the pentium is %16 slower -than bf-586.pl - -So the default is bf-586.pl - diff --git a/deps/openssl/openssl/crypto/bf/bf_cbc.c b/deps/openssl/openssl/crypto/bf/bf_cbc.c index de827a1a3c..6ed62578ac 100644 --- a/deps/openssl/openssl/crypto/bf/bf_cbc.c +++ b/deps/openssl/openssl/crypto/bf/bf_cbc.c @@ -1,59 +1,10 @@ -/* crypto/bf/bf_cbc.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. +/* + * Copyright 1995-2016 The OpenSSL Project Authors. 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.] + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html */ #include <openssl/blowfish.h> diff --git a/deps/openssl/openssl/crypto/bf/bf_cfb64.c b/deps/openssl/openssl/crypto/bf/bf_cfb64.c index ddeab6eb77..ce6e13b5a4 100644 --- a/deps/openssl/openssl/crypto/bf/bf_cfb64.c +++ b/deps/openssl/openssl/crypto/bf/bf_cfb64.c @@ -1,59 +1,10 @@ -/* crypto/bf/bf_cfb64.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. * - * 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.] + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html */ #include <openssl/blowfish.h> diff --git a/deps/openssl/openssl/crypto/bf/bf_ecb.c b/deps/openssl/openssl/crypto/bf/bf_ecb.c index 967a7f5507..aa73540f35 100644 --- a/deps/openssl/openssl/crypto/bf/bf_ecb.c +++ b/deps/openssl/openssl/crypto/bf/bf_ecb.c @@ -1,59 +1,10 @@ -/* crypto/bf/bf_ecb.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. * - * 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.] + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html */ #include <openssl/blowfish.h> @@ -66,17 +17,9 @@ * SECURITY WORKSHOP, CAMBRIDGE, U.K., DECEMBER 9-11, 1993) */ -const char BF_version[] = "Blowfish" OPENSSL_VERSION_PTEXT; - const char *BF_options(void) { -#ifdef BF_PTR return ("blowfish(ptr)"); -#elif defined(BF_PTR2) - return ("blowfish(ptr2)"); -#else - return ("blowfish(idx)"); -#endif } void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, diff --git a/deps/openssl/openssl/crypto/bf/bf_enc.c b/deps/openssl/openssl/crypto/bf/bf_enc.c index b268795f5b..9f80c56d57 100644 --- a/deps/openssl/openssl/crypto/bf/bf_enc.c +++ b/deps/openssl/openssl/crypto/bf/bf_enc.c @@ -1,59 +1,10 @@ -/* crypto/bf/bf_enc.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. * - * 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.] + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html */ #include <openssl/blowfish.h> @@ -72,7 +23,6 @@ to modify the code. void BF_encrypt(BF_LONG *data, const BF_KEY *key) { -#ifndef BF_PTR2 register BF_LONG l, r; register const BF_LONG *p, *s; @@ -106,50 +56,14 @@ void BF_encrypt(BF_LONG *data, const BF_KEY *key) # endif r ^= p[BF_ROUNDS + 1]; - data[1] = l & 0xffffffffL; - data[0] = r & 0xffffffffL; -#else - register BF_LONG l, r, t, *k; - - l = data[0]; - r = data[1]; - k = (BF_LONG *)key; - - l ^= k[0]; - BF_ENC(r, l, k, 1); - BF_ENC(l, r, k, 2); - BF_ENC(r, l, k, 3); - BF_ENC(l, r, k, 4); - BF_ENC(r, l, k, 5); - BF_ENC(l, r, k, 6); - BF_ENC(r, l, k, 7); - BF_ENC(l, r, k, 8); - BF_ENC(r, l, k, 9); - BF_ENC(l, r, k, 10); - BF_ENC(r, l, k, 11); - BF_ENC(l, r, k, 12); - BF_ENC(r, l, k, 13); - BF_ENC(l, r, k, 14); - BF_ENC(r, l, k, 15); - BF_ENC(l, r, k, 16); -# if BF_ROUNDS == 20 - BF_ENC(r, l, k, 17); - BF_ENC(l, r, k, 18); - BF_ENC(r, l, k, 19); - BF_ENC(l, r, k, 20); -# endif - r ^= k[BF_ROUNDS + 1]; - - data[1] = l & 0xffffffffL; - data[0] = r & 0xffffffffL; -#endif + data[1] = l & 0xffffffffU; + data[0] = r & 0xffffffffU; } #ifndef BF_DEFAULT_OPTIONS void BF_decrypt(BF_LONG *data, const BF_KEY *key) { -# ifndef BF_PTR2 register BF_LONG l, r; register const BF_LONG *p, *s; @@ -183,43 +97,8 @@ void BF_decrypt(BF_LONG *data, const BF_KEY *key) BF_ENC(l, r, s, p[1]); r ^= p[0]; - data[1] = l & 0xffffffffL; - data[0] = r & 0xffffffffL; -# else - register BF_LONG l, r, t, *k; - - l = data[0]; - r = data[1]; - k = (BF_LONG *)key; - - l ^= k[BF_ROUNDS + 1]; -# if BF_ROUNDS == 20 - BF_ENC(r, l, k, 20); - BF_ENC(l, r, k, 19); - BF_ENC(r, l, k, 18); - BF_ENC(l, r, k, 17); -# endif - BF_ENC(r, l, k, 16); - BF_ENC(l, r, k, 15); - BF_ENC(r, l, k, 14); - BF_ENC(l, r, k, 13); - BF_ENC(r, l, k, 12); - BF_ENC(l, r, k, 11); - BF_ENC(r, l, k, 10); - BF_ENC(l, r, k, 9); - BF_ENC(r, l, k, 8); - BF_ENC(l, r, k, 7); - BF_ENC(r, l, k, 6); - BF_ENC(l, r, k, 5); - BF_ENC(r, l, k, 4); - BF_ENC(l, r, k, 3); - BF_ENC(r, l, k, 2); - BF_ENC(l, r, k, 1); - r ^= k[0]; - - data[1] = l & 0xffffffffL; - data[0] = r & 0xffffffffL; -# endif + data[1] = l & 0xffffffffU; + data[0] = r & 0xffffffffU; } void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, diff --git a/deps/openssl/openssl/crypto/bf/bf_locl.h b/deps/openssl/openssl/crypto/bf/bf_locl.h index 9448aed424..b1a415e513 100644 --- a/deps/openssl/openssl/crypto/bf/bf_locl.h +++ b/deps/openssl/openssl/crypto/bf/bf_locl.h @@ -1,109 +1,15 @@ -/* crypto/bf/bf_locl.h */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. * - * 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.] + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html */ #ifndef HEADER_BF_LOCL_H # define HEADER_BF_LOCL_H -# include <openssl/opensslconf.h>/* BF_PTR, BF_PTR2 */ - -# undef c2l -# define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ - l|=((unsigned long)(*((c)++)))<< 8L, \ - l|=((unsigned long)(*((c)++)))<<16L, \ - l|=((unsigned long)(*((c)++)))<<24L) - -/* NOTE - c is not incremented as per c2l */ -# undef c2ln -# define c2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((unsigned long)(*(--(c))))<<24L; \ - case 7: l2|=((unsigned long)(*(--(c))))<<16L; \ - case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \ - case 5: l2|=((unsigned long)(*(--(c)))); \ - case 4: l1 =((unsigned long)(*(--(c))))<<24L; \ - case 3: l1|=((unsigned long)(*(--(c))))<<16L; \ - case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \ - case 1: l1|=((unsigned long)(*(--(c)))); \ - } \ - } - -# undef l2c -# define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>24L)&0xff)) - -/* NOTE - c is not incremented as per l2c */ -# undef l2cn -# define l2cn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ - } \ - } +# include <openssl/opensslconf.h> /* NOTE - c is not incremented as per n2l */ # define n2ln(c,l1,l2,n) { \ @@ -111,12 +17,19 @@ l1=l2=0; \ switch (n) { \ case 8: l2 =((unsigned long)(*(--(c)))) ; \ + /* fall thru */ \ case 7: l2|=((unsigned long)(*(--(c))))<< 8; \ + /* fall thru */ \ case 6: l2|=((unsigned long)(*(--(c))))<<16; \ + /* fall thru */ \ case 5: l2|=((unsigned long)(*(--(c))))<<24; \ + /* fall thru */ \ case 4: l1 =((unsigned long)(*(--(c)))) ; \ + /* fall thru */ \ case 3: l1|=((unsigned long)(*(--(c))))<< 8; \ + /* fall thru */ \ case 2: l1|=((unsigned long)(*(--(c))))<<16; \ + /* fall thru */ \ case 1: l1|=((unsigned long)(*(--(c))))<<24; \ } \ } @@ -126,12 +39,19 @@ c+=n; \ switch (n) { \ case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ + /* fall thru */ \ case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ + /* fall thru */ \ case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ + /* fall thru */ \ case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ + /* fall thru */ \ case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ + /* fall thru */ \ case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ + /* fall thru */ \ case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ + /* fall thru */ \ case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ } \ } @@ -153,69 +73,12 @@ * to lookup array 0 */ -# if defined(BF_PTR2) - -/* - * This is basically a special Intel version. Point is that Intel - * doesn't have many registers, but offers a reach choice of addressing - * modes. So we spare some registers by directly traversing BF_KEY - * structure and hiring the most decorated addressing mode. The code - * generated by EGCS is *perfectly* competitive with assembler - * implementation! - */ -# define BF_ENC(LL,R,KEY,Pi) (\ - LL^=KEY[Pi], \ - t= KEY[BF_ROUNDS+2 + 0 + ((R>>24)&0xFF)], \ - t+= KEY[BF_ROUNDS+2 + 256 + ((R>>16)&0xFF)], \ - t^= KEY[BF_ROUNDS+2 + 512 + ((R>>8 )&0xFF)], \ - t+= KEY[BF_ROUNDS+2 + 768 + ((R )&0xFF)], \ - LL^=t \ - ) - -# elif defined(BF_PTR) - -# ifndef BF_LONG_LOG2 -# define BF_LONG_LOG2 2 /* default to BF_LONG being 32 bits */ -# endif -# define BF_M (0xFF<<BF_LONG_LOG2) -# define BF_0 (24-BF_LONG_LOG2) -# define BF_1 (16-BF_LONG_LOG2) -# define BF_2 ( 8-BF_LONG_LOG2) -# define BF_3 BF_LONG_LOG2 /* left shift */ - -/* - * This is normally very good on RISC platforms where normally you - * have to explicitly "multiply" array index by sizeof(BF_LONG) - * in order to calculate the effective address. This implementation - * excuses CPU from this extra work. Power[PC] uses should have most - * fun as (R>>BF_i)&BF_M gets folded into a single instruction, namely - * rlwinm. So let'em double-check if their compiler does it. - */ - -# define BF_ENC(LL,R,S,P) ( \ - LL^=P, \ - LL^= (((*(BF_LONG *)((unsigned char *)&(S[ 0])+((R>>BF_0)&BF_M))+ \ - *(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \ - *(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \ - *(BF_LONG *)((unsigned char *)&(S[768])+((R<<BF_3)&BF_M))) \ - ) -# else - -/* - * This is a *generic* version. Seem to perform best on platforms that - * offer explicit support for extraction of 8-bit nibbles preferably - * complemented with "multiplying" of array index by sizeof(BF_LONG). - * For the moment of this writing the list comprises Alpha CPU featuring - * extbl and s[48]addq instructions. - */ - -# define BF_ENC(LL,R,S,P) ( \ +# define BF_ENC(LL,R,S,P) ( \ LL^=P, \ - LL^=((( S[ ((int)(R>>24)&0xff)] + \ - S[0x0100+((int)(R>>16)&0xff)])^ \ - S[0x0200+((int)(R>> 8)&0xff)])+ \ - S[0x0300+((int)(R )&0xff)])&0xffffffffL \ + LL^=((( S[ ((R>>24)&0xff)] + \ + S[0x0100+((R>>16)&0xff)])^ \ + S[0x0200+((R>> 8)&0xff)])+ \ + S[0x0300+((R )&0xff)])&0xffffffffU \ ) -# endif #endif diff --git a/deps/openssl/openssl/crypto/bf/bf_ofb64.c b/deps/openssl/openssl/crypto/bf/bf_ofb64.c index a8d190b5dd..6418217b30 100644 --- a/deps/openssl/openssl/crypto/bf/bf_ofb64.c +++ b/deps/openssl/openssl/crypto/bf/bf_ofb64.c @@ -1,59 +1,10 @@ -/* crypto/bf/bf_ofb64.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. * - * 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.] + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html */ #include <openssl/blowfish.h> diff --git a/deps/openssl/openssl/crypto/bf/bf_opts.c b/deps/openssl/openssl/crypto/bf/bf_opts.c deleted file mode 100644 index f85495cf9d..0000000000 --- a/deps/openssl/openssl/crypto/bf/bf_opts.c +++ /dev/null @@ -1,324 +0,0 @@ -/* crypto/bf/bf_opts.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* - * define PART1, PART2, PART3 or PART4 to build only with a few of the - * options. This is for machines with 64k code segment size restrictions. - */ - -#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) -# define TIMES -#endif - -#include <stdio.h> - -#include <openssl/e_os2.h> -#include OPENSSL_UNISTD_IO -OPENSSL_DECLARE_EXIT -#ifndef OPENSSL_SYS_NETWARE -# include <signal.h> -#endif -#ifndef _IRIX -# include <time.h> -#endif -#ifdef TIMES -# include <sys/types.h> -# include <sys/times.h> -#endif - /* - * Depending on the VMS version, the tms structure is perhaps defined. - * The __TMS macro will show if it was. If it wasn't defined, we should - * undefine TIMES, since that tells the rest of the program how things - * should be handled. -- Richard Levitte - */ -#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) -# undef TIMES -#endif -#ifndef TIMES -# include <sys/timeb.h> -#endif -#if defined(sun) || defined(__ultrix) -# define _POSIX_SOURCE -# include <limits.h> -# include <sys/param.h> -#endif -#include <openssl/blowfish.h> -#define BF_DEFAULT_OPTIONS -#undef BF_ENC -#define BF_encrypt BF_encrypt_normal -#undef HEADER_BF_LOCL_H -#include "bf_enc.c" -#define BF_PTR -#undef BF_PTR2 -#undef BF_ENC -#undef BF_encrypt -#define BF_encrypt BF_encrypt_ptr -#undef HEADER_BF_LOCL_H -#include "bf_enc.c" -#undef BF_PTR -#define BF_PTR2 -#undef BF_ENC -#undef BF_encrypt -#define BF_encrypt BF_encrypt_ptr2 -#undef HEADER_BF_LOCL_H -#include "bf_enc.c" -/* The following if from times(3) man page. It may need to be changed */ -#ifndef HZ -# ifndef CLK_TCK -# ifndef _BSD_CLK_TCK_ /* FreeBSD fix */ -# define HZ 100.0 -# else /* _BSD_CLK_TCK_ */ -# define HZ ((double)_BSD_CLK_TCK_) -# endif -# else /* CLK_TCK */ -# define HZ ((double)CLK_TCK) -# endif -#endif -#define BUFSIZE ((long)1024) -long run = 0; - -double Time_F(int s); -#ifdef SIGALRM -# if defined(__STDC__) || defined(sgi) -# define SIGRETTYPE void -# else -# define SIGRETTYPE int -# endif - -SIGRETTYPE sig_done(int sig); -SIGRETTYPE sig_done(int sig) -{ - signal(SIGALRM, sig_done); - run = 0; -# ifdef LINT - sig = sig; -# endif -} -#endif - -#define START 0 -#define STOP 1 - -double Time_F(int s) -{ - double ret; -#ifdef TIMES - static struct tms tstart, tend; - - if (s == START) { - times(&tstart); - return (0); - } else { - times(&tend); - ret = ((double)(tend.tms_utime - tstart.tms_utime)) / HZ; - return ((ret == 0.0) ? 1e-6 : ret); - } -#else /* !times() */ - static struct timeb tstart, tend; - long i; - - if (s == START) { - ftime(&tstart); - return (0); - } else { - ftime(&tend); - i = (long)tend.millitm - (long)tstart.millitm; - ret = ((double)(tend.time - tstart.time)) + ((double)i) / 1000.0; - return ((ret == 0.0) ? 1e-6 : ret); - } -#endif -} - -#ifdef SIGALRM -# define print_name(name) fprintf(stderr,"Doing %s's for 10 seconds\n",name); alarm(10); -#else -# define print_name(name) fprintf(stderr,"Doing %s %ld times\n",name,cb); -#endif - -#define time_it(func,name,index) \ - print_name(name); \ - Time_F(START); \ - for (count=0,run=1; COND(cb); count+=4) \ - { \ - unsigned long d[2]; \ - func(d,&sch); \ - func(d,&sch); \ - func(d,&sch); \ - func(d,&sch); \ - } \ - tm[index]=Time_F(STOP); \ - fprintf(stderr,"%ld %s's in %.2f second\n",count,name,tm[index]); \ - tm[index]=((double)COUNT(cb))/tm[index]; - -#define print_it(name,index) \ - fprintf(stderr,"%s bytes per sec = %12.2f (%5.1fuS)\n",name, \ - tm[index]*8,1.0e6/tm[index]); - -int main(int argc, char **argv) -{ - long count; - static unsigned char buf[BUFSIZE]; - static char key[16] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, - 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 - }; - BF_KEY sch; - double d, tm[16], max = 0; - int rank[16]; - char *str[16]; - int max_idx = 0, i, num = 0, j; -#ifndef SIGALARM - long ca, cb, cc, cd, ce; -#endif - - for (i = 0; i < 12; i++) { - tm[i] = 0.0; - rank[i] = 0; - } - -#ifndef TIMES - fprintf(stderr, "To get the most accurate results, try to run this\n"); - fprintf(stderr, "program when this computer is idle.\n"); -#endif - - BF_set_key(&sch, 16, key); - -#ifndef SIGALRM - fprintf(stderr, "First we calculate the approximate speed ...\n"); - count = 10; - do { - long i; - unsigned long data[2]; - - count *= 2; - Time_F(START); - for (i = count; i; i--) - BF_encrypt(data, &sch); - d = Time_F(STOP); - } while (d < 3.0); - ca = count; - cb = count * 3; - cc = count * 3 * 8 / BUFSIZE + 1; - cd = count * 8 / BUFSIZE + 1; - - ce = count / 20 + 1; -# define COND(d) (count != (d)) -# define COUNT(d) (d) -#else -# define COND(c) (run) -# define COUNT(d) (count) - signal(SIGALRM, sig_done); - alarm(10); -#endif - - time_it(BF_encrypt_normal, "BF_encrypt_normal ", 0); - time_it(BF_encrypt_ptr, "BF_encrypt_ptr ", 1); - time_it(BF_encrypt_ptr2, "BF_encrypt_ptr2 ", 2); - num += 3; - - str[0] = "<nothing>"; - print_it("BF_encrypt_normal ", 0); - max = tm[0]; - max_idx = 0; - str[1] = "ptr "; - print_it("BF_encrypt_ptr ", 1); - if (max < tm[1]) { - max = tm[1]; - max_idx = 1; - } - str[2] = "ptr2 "; - print_it("BF_encrypt_ptr2 ", 2); - if (max < tm[2]) { - max = tm[2]; - max_idx = 2; - } - - printf("options BF ecb/s\n"); - printf("%s %12.2f 100.0%%\n", str[max_idx], tm[max_idx]); - d = tm[max_idx]; - tm[max_idx] = -2.0; - max = -1.0; - for (;;) { - for (i = 0; i < 3; i++) { - if (max < tm[i]) { - max = tm[i]; - j = i; - } - } - if (max < 0.0) - break; - printf("%s %12.2f %4.1f%%\n", str[j], tm[j], tm[j] / d * 100.0); - tm[j] = -2.0; - max = -1.0; - } - - switch (max_idx) { - case 0: - printf("-DBF_DEFAULT_OPTIONS\n"); - break; - case 1: - printf("-DBF_PTR\n"); - break; - case 2: - printf("-DBF_PTR2\n"); - break; - } - exit(0); -#if defined(LINT) || defined(OPENSSL_SYS_MSDOS) - return (0); -#endif -} diff --git a/deps/openssl/openssl/crypto/bf/bf_pi.h b/deps/openssl/openssl/crypto/bf/bf_pi.h index 46a26739be..a054b03f81 100644 --- a/deps/openssl/openssl/crypto/bf/bf_pi.h +++ b/deps/openssl/openssl/crypto/bf/bf_pi.h @@ -1,59 +1,10 @@ -/* crypto/bf/bf_pi.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. +/* + * Copyright 1995-2016 The OpenSSL Project Authors. 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.] + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html */ static const BF_KEY bf_init = { diff --git a/deps/openssl/openssl/crypto/bf/bf_skey.c b/deps/openssl/openssl/crypto/bf/bf_skey.c index 2cb3c66c8f..a4903a2a71 100644 --- a/deps/openssl/openssl/crypto/bf/bf_skey.c +++ b/deps/openssl/openssl/crypto/bf/bf_skey.c @@ -1,77 +1,19 @@ -/* crypto/bf/bf_skey.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. +/* + * Copyright 1995-2016 The OpenSSL Project Authors. 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.] + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html */ #include <stdio.h> #include <string.h> -#include <openssl/crypto.h> #include <openssl/blowfish.h> #include "bf_locl.h" #include "bf_pi.h" void BF_set_key(BF_KEY *key, int len, const unsigned char *data) -#ifdef OPENSSL_FIPS -{ - fips_cipher_abort(BLOWFISH); - private_BF_set_key(key, len, data); -} - -void private_BF_set_key(BF_KEY *key, int len, const unsigned char *data) -#endif { int i; BF_LONG *p, ri, in[2]; diff --git a/deps/openssl/openssl/crypto/bf/bfs.cpp b/deps/openssl/openssl/crypto/bf/bfs.cpp deleted file mode 100644 index d74c457760..0000000000 --- a/deps/openssl/openssl/crypto/bf/bfs.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// -// gettsc.inl -// -// gives access to the Pentium's (secret) cycle counter -// -// This software was written by Leonard Janke (janke@unixg.ubc.ca) -// in 1996-7 and is entered, by him, into the public domain. - -#if defined(__WATCOMC__) -void GetTSC(unsigned long&); -#pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; -#elif defined(__GNUC__) -inline -void GetTSC(unsigned long& tsc) -{ - asm volatile(".byte 15, 49\n\t" - : "=eax" (tsc) - : - : "%edx", "%eax"); -} -#elif defined(_MSC_VER) -inline -void GetTSC(unsigned long& tsc) -{ - unsigned long a; - __asm _emit 0fh - __asm _emit 31h - __asm mov a, eax; - tsc=a; -} -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <openssl/blowfish.h> - -void main(int argc,char *argv[]) - { - BF_KEY key; - unsigned long s1,s2,e1,e2; - unsigned long data[2]; - int i,j; - - for (j=0; j<6; j++) - { - for (i=0; i<1000; i++) /**/ - { - BF_encrypt(&data[0],&key); - GetTSC(s1); - BF_encrypt(&data[0],&key); - BF_encrypt(&data[0],&key); - BF_encrypt(&data[0],&key); - GetTSC(e1); - GetTSC(s2); - BF_encrypt(&data[0],&key); - BF_encrypt(&data[0],&key); - BF_encrypt(&data[0],&key); - BF_encrypt(&data[0],&key); - GetTSC(e2); - BF_encrypt(&data[0],&key); - } - - printf("blowfish %d %d (%d)\n", - e1-s1,e2-s2,((e2-s2)-(e1-s1))); - } - } - diff --git a/deps/openssl/openssl/crypto/bf/bfspeed.c b/deps/openssl/openssl/crypto/bf/bfspeed.c deleted file mode 100644 index 305ad8bcbe..0000000000 --- a/deps/openssl/openssl/crypto/bf/bfspeed.c +++ /dev/null @@ -1,265 +0,0 @@ -/* crypto/bf/bfspeed.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ -/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ - -#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) -# define TIMES -#endif - -#include <stdio.h> - -#include <openssl/e_os2.h> -#include OPENSSL_UNISTD_IO -OPENSSL_DECLARE_EXIT -#ifndef OPENSSL_SYS_NETWARE -# include <signal.h> -#endif -#ifndef _IRIX -# include <time.h> -#endif -#ifdef TIMES -# include <sys/types.h> -# include <sys/times.h> -#endif - /* - * Depending on the VMS version, the tms structure is perhaps defined. - * The __TMS macro will show if it was. If it wasn't defined, we should - * undefine TIMES, since that tells the rest of the program how things - * should be handled. -- Richard Levitte - */ -#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) -# undef TIMES -#endif -#ifndef TIMES -# include <sys/timeb.h> -#endif -#if defined(sun) || defined(__ultrix) -# define _POSIX_SOURCE -# include <limits.h> -# include <sys/param.h> -#endif -#include <openssl/blowfish.h> -/* The following if from times(3) man page. It may need to be changed */ -#ifndef HZ -# ifndef CLK_TCK -# define HZ 100.0 -# else /* CLK_TCK */ -# define HZ ((double)CLK_TCK) -# endif -#endif -#define BUFSIZE ((long)1024) -long run = 0; - -double Time_F(int s); -#ifdef SIGALRM -# if defined(__STDC__) || defined(sgi) || defined(_AIX) -# define SIGRETTYPE void -# else -# define SIGRETTYPE int -# endif - -SIGRETTYPE sig_done(int sig); -SIGRETTYPE sig_done(int sig) -{ - signal(SIGALRM, sig_done); - run = 0; -# ifdef LINT - sig = sig; -# endif -} -#endif - -#define START 0 -#define STOP 1 - -double Time_F(int s) -{ - double ret; -#ifdef TIMES - static struct tms tstart, tend; - - if (s == START) { - times(&tstart); - return (0); - } else { - times(&tend); - ret = ((double)(tend.tms_utime - tstart.tms_utime)) / HZ; - return ((ret == 0.0) ? 1e-6 : ret); - } -#else /* !times() */ - static struct timeb tstart, tend; - long i; - - if (s == START) { - ftime(&tstart); - return (0); - } else { - ftime(&tend); - i = (long)tend.millitm - (long)tstart.millitm; - ret = ((double)(tend.time - tstart.time)) + ((double)i) / 1e3; - return ((ret == 0.0) ? 1e-6 : ret); - } -#endif -} - -int main(int argc, char **argv) -{ - long count; - static unsigned char buf[BUFSIZE]; - static unsigned char key[] = { - 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, - 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, - }; - BF_KEY sch; - double a, b, c, d; -#ifndef SIGALRM - long ca, cb, cc; -#endif - -#ifndef TIMES - printf("To get the most accurate results, try to run this\n"); - printf("program when this computer is idle.\n"); -#endif - -#ifndef SIGALRM - printf("First we calculate the approximate speed ...\n"); - BF_set_key(&sch, 16, key); - count = 10; - do { - long i; - BF_LONG data[2]; - - count *= 2; - Time_F(START); - for (i = count; i; i--) - BF_encrypt(data, &sch); - d = Time_F(STOP); - } while (d < 3.0); - ca = count / 512; - cb = count; - cc = count * 8 / BUFSIZE + 1; - printf("Doing BF_set_key %ld times\n", ca); -# define COND(d) (count != (d)) -# define COUNT(d) (d) -#else -# define COND(c) (run) -# define COUNT(d) (count) - signal(SIGALRM, sig_done); - printf("Doing BF_set_key for 10 seconds\n"); - alarm(10); -#endif - - Time_F(START); - for (count = 0, run = 1; COND(ca); count += 4) { - BF_set_key(&sch, 16, key); - BF_set_key(&sch, 16, key); - BF_set_key(&sch, 16, key); - BF_set_key(&sch, 16, key); - } - d = Time_F(STOP); - printf("%ld BF_set_key's in %.2f seconds\n", count, d); - a = ((double)COUNT(ca)) / d; - -#ifdef SIGALRM - printf("Doing BF_encrypt's for 10 seconds\n"); - alarm(10); -#else - printf("Doing BF_encrypt %ld times\n", cb); -#endif - Time_F(START); - for (count = 0, run = 1; COND(cb); count += 4) { - BF_LONG data[2]; - - BF_encrypt(data, &sch); - BF_encrypt(data, &sch); - BF_encrypt(data, &sch); - BF_encrypt(data, &sch); - } - d = Time_F(STOP); - printf("%ld BF_encrypt's in %.2f second\n", count, d); - b = ((double)COUNT(cb) * 8) / d; - -#ifdef SIGALRM - printf("Doing BF_cbc_encrypt on %ld byte blocks for 10 seconds\n", - BUFSIZE); - alarm(10); -#else - printf("Doing BF_cbc_encrypt %ld times on %ld byte blocks\n", cc, - BUFSIZE); -#endif - Time_F(START); - for (count = 0, run = 1; COND(cc); count++) - BF_cbc_encrypt(buf, buf, BUFSIZE, &sch, &(key[0]), BF_ENCRYPT); - d = Time_F(STOP); - printf("%ld BF_cbc_encrypt's of %ld byte blocks in %.2f second\n", - count, BUFSIZE, d); - c = ((double)COUNT(cc) * BUFSIZE) / d; - - printf("Blowfish set_key per sec = %12.3f (%9.3fuS)\n", a, - 1.0e6 / a); - printf("Blowfish raw ecb bytes per sec = %12.3f (%9.3fuS)\n", b, - 8.0e6 / b); - printf("Blowfish cbc bytes per sec = %12.3f (%9.3fuS)\n", c, - 8.0e6 / c); - exit(0); -#if defined(LINT) || defined(OPENSSL_SYS_MSDOS) - return (0); -#endif -} diff --git a/deps/openssl/openssl/crypto/bf/bftest.c b/deps/openssl/openssl/crypto/bf/bftest.c deleted file mode 100644 index bd20a8e211..0000000000 --- a/deps/openssl/openssl/crypto/bf/bftest.c +++ /dev/null @@ -1,538 +0,0 @@ -/* crypto/bf/bftest.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* - * This has been a quickly hacked 'ideatest.c'. When I add tests for other - * RC2 modes, more of the code will be uncommented. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <openssl/opensslconf.h> /* To see if OPENSSL_NO_BF is defined */ - -#include "../e_os.h" - -#ifdef OPENSSL_NO_BF -int main(int argc, char *argv[]) -{ - printf("No BF support\n"); - return (0); -} -#else -# include <openssl/blowfish.h> - -# ifdef CHARSET_EBCDIC -# include <openssl/ebcdic.h> -# endif - -static char *bf_key[2] = { - "abcdefghijklmnopqrstuvwxyz", - "Who is John Galt?" -}; - -/* big endian */ -static BF_LONG bf_plain[2][2] = { - {0x424c4f57L, 0x46495348L}, - {0xfedcba98L, 0x76543210L} -}; - -static BF_LONG bf_cipher[2][2] = { - {0x324ed0feL, 0xf413a203L}, - {0xcc91732bL, 0x8022f684L} -}; - -/************/ - -/* Lets use the DES test vectors :-) */ -# define NUM_TESTS 34 -static unsigned char ecb_data[NUM_TESTS][8] = { - {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} -}; - -static unsigned char plain_data[NUM_TESTS][8] = { - {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} -}; - -static unsigned char cipher_data[NUM_TESTS][8] = { - {0x4E, 0xF9, 0x97, 0x45, 0x61, 0x98, 0xDD, 0x78}, - {0x51, 0x86, 0x6F, 0xD5, 0xB8, 0x5E, 0xCB, 0x8A}, - {0x7D, 0x85, 0x6F, 0x9A, 0x61, 0x30, 0x63, 0xF2}, - {0x24, 0x66, 0xDD, 0x87, 0x8B, 0x96, 0x3C, 0x9D}, - {0x61, 0xF9, 0xC3, 0x80, 0x22, 0x81, 0xB0, 0x96}, - {0x7D, 0x0C, 0xC6, 0x30, 0xAF, 0xDA, 0x1E, 0xC7}, - {0x4E, 0xF9, 0x97, 0x45, 0x61, 0x98, 0xDD, 0x78}, - {0x0A, 0xCE, 0xAB, 0x0F, 0xC6, 0xA0, 0xA2, 0x8D}, - {0x59, 0xC6, 0x82, 0x45, 0xEB, 0x05, 0x28, 0x2B}, - {0xB1, 0xB8, 0xCC, 0x0B, 0x25, 0x0F, 0x09, 0xA0}, - {0x17, 0x30, 0xE5, 0x77, 0x8B, 0xEA, 0x1D, 0xA4}, - {0xA2, 0x5E, 0x78, 0x56, 0xCF, 0x26, 0x51, 0xEB}, - {0x35, 0x38, 0x82, 0xB1, 0x09, 0xCE, 0x8F, 0x1A}, - {0x48, 0xF4, 0xD0, 0x88, 0x4C, 0x37, 0x99, 0x18}, - {0x43, 0x21, 0x93, 0xB7, 0x89, 0x51, 0xFC, 0x98}, - {0x13, 0xF0, 0x41, 0x54, 0xD6, 0x9D, 0x1A, 0xE5}, - {0x2E, 0xED, 0xDA, 0x93, 0xFF, 0xD3, 0x9C, 0x79}, - {0xD8, 0x87, 0xE0, 0x39, 0x3C, 0x2D, 0xA6, 0xE3}, - {0x5F, 0x99, 0xD0, 0x4F, 0x5B, 0x16, 0x39, 0x69}, - {0x4A, 0x05, 0x7A, 0x3B, 0x24, 0xD3, 0x97, 0x7B}, - {0x45, 0x20, 0x31, 0xC1, 0xE4, 0xFA, 0xDA, 0x8E}, - {0x75, 0x55, 0xAE, 0x39, 0xF5, 0x9B, 0x87, 0xBD}, - {0x53, 0xC5, 0x5F, 0x9C, 0xB4, 0x9F, 0xC0, 0x19}, - {0x7A, 0x8E, 0x7B, 0xFA, 0x93, 0x7E, 0x89, 0xA3}, - {0xCF, 0x9C, 0x5D, 0x7A, 0x49, 0x86, 0xAD, 0xB5}, - {0xD1, 0xAB, 0xB2, 0x90, 0x65, 0x8B, 0xC7, 0x78}, - {0x55, 0xCB, 0x37, 0x74, 0xD1, 0x3E, 0xF2, 0x01}, - {0xFA, 0x34, 0xEC, 0x48, 0x47, 0xB2, 0x68, 0xB2}, - {0xA7, 0x90, 0x79, 0x51, 0x08, 0xEA, 0x3C, 0xAE}, - {0xC3, 0x9E, 0x07, 0x2D, 0x9F, 0xAC, 0x63, 0x1D}, - {0x01, 0x49, 0x33, 0xE0, 0xCD, 0xAF, 0xF6, 0xE4}, - {0xF2, 0x1E, 0x9A, 0x77, 0xB7, 0x1C, 0x49, 0xBC}, - {0x24, 0x59, 0x46, 0x88, 0x57, 0x54, 0x36, 0x9A}, - {0x6B, 0x5C, 0x5A, 0x9C, 0x5D, 0x9E, 0x0A, 0x5A}, -}; - -static unsigned char cbc_key[16] = { - 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, - 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 -}; -static unsigned char cbc_iv[8] = - { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }; -static char cbc_data[40] = "7654321 Now is the time for "; -static unsigned char cbc_ok[32] = { - 0x6B, 0x77, 0xB4, 0xD6, 0x30, 0x06, 0xDE, 0xE6, - 0x05, 0xB1, 0x56, 0xE2, 0x74, 0x03, 0x97, 0x93, - 0x58, 0xDE, 0xB9, 0xE7, 0x15, 0x46, 0x16, 0xD9, - 0x59, 0xF1, 0x65, 0x2B, 0xD5, 0xFF, 0x92, 0xCC -}; - -static unsigned char cfb64_ok[] = { - 0xE7, 0x32, 0x14, 0xA2, 0x82, 0x21, 0x39, 0xCA, - 0xF2, 0x6E, 0xCF, 0x6D, 0x2E, 0xB9, 0xE7, 0x6E, - 0x3D, 0xA3, 0xDE, 0x04, 0xD1, 0x51, 0x72, 0x00, - 0x51, 0x9D, 0x57, 0xA6, 0xC3 -}; - -static unsigned char ofb64_ok[] = { - 0xE7, 0x32, 0x14, 0xA2, 0x82, 0x21, 0x39, 0xCA, - 0x62, 0xB3, 0x43, 0xCC, 0x5B, 0x65, 0x58, 0x73, - 0x10, 0xDD, 0x90, 0x8D, 0x0C, 0x24, 0x1B, 0x22, - 0x63, 0xC2, 0xCF, 0x80, 0xDA -}; - -# define KEY_TEST_NUM 25 -static unsigned char key_test[KEY_TEST_NUM] = { - 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, - 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f, - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88 -}; - -static unsigned char key_data[8] = - { 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10 }; - -static unsigned char key_out[KEY_TEST_NUM][8] = { - {0xF9, 0xAD, 0x59, 0x7C, 0x49, 0xDB, 0x00, 0x5E}, - {0xE9, 0x1D, 0x21, 0xC1, 0xD9, 0x61, 0xA6, 0xD6}, - {0xE9, 0xC2, 0xB7, 0x0A, 0x1B, 0xC6, 0x5C, 0xF3}, - {0xBE, 0x1E, 0x63, 0x94, 0x08, 0x64, 0x0F, 0x05}, - {0xB3, 0x9E, 0x44, 0x48, 0x1B, 0xDB, 0x1E, 0x6E}, - {0x94, 0x57, 0xAA, 0x83, 0xB1, 0x92, 0x8C, 0x0D}, - {0x8B, 0xB7, 0x70, 0x32, 0xF9, 0x60, 0x62, 0x9D}, - {0xE8, 0x7A, 0x24, 0x4E, 0x2C, 0xC8, 0x5E, 0x82}, - {0x15, 0x75, 0x0E, 0x7A, 0x4F, 0x4E, 0xC5, 0x77}, - {0x12, 0x2B, 0xA7, 0x0B, 0x3A, 0xB6, 0x4A, 0xE0}, - {0x3A, 0x83, 0x3C, 0x9A, 0xFF, 0xC5, 0x37, 0xF6}, - {0x94, 0x09, 0xDA, 0x87, 0xA9, 0x0F, 0x6B, 0xF2}, - {0x88, 0x4F, 0x80, 0x62, 0x50, 0x60, 0xB8, 0xB4}, - {0x1F, 0x85, 0x03, 0x1C, 0x19, 0xE1, 0x19, 0x68}, - {0x79, 0xD9, 0x37, 0x3A, 0x71, 0x4C, 0xA3, 0x4F}, - {0x93, 0x14, 0x28, 0x87, 0xEE, 0x3B, 0xE1, 0x5C}, - {0x03, 0x42, 0x9E, 0x83, 0x8C, 0xE2, 0xD1, 0x4B}, - {0xA4, 0x29, 0x9E, 0x27, 0x46, 0x9F, 0xF6, 0x7B}, - {0xAF, 0xD5, 0xAE, 0xD1, 0xC1, 0xBC, 0x96, 0xA8}, - {0x10, 0x85, 0x1C, 0x0E, 0x38, 0x58, 0xDA, 0x9F}, - {0xE6, 0xF5, 0x1E, 0xD7, 0x9B, 0x9D, 0xB2, 0x1F}, - {0x64, 0xA6, 0xE1, 0x4A, 0xFD, 0x36, 0xB4, 0x6F}, - {0x80, 0xC7, 0xD7, 0xD4, 0x5A, 0x54, 0x79, 0xAD}, - {0x05, 0x04, 0x4B, 0x62, 0xFA, 0x52, 0xD0, 0x80}, -}; - -static int test(void); -static int print_test_data(void); -int main(int argc, char *argv[]) -{ - int ret; - - if (argc > 1) - ret = print_test_data(); - else - ret = test(); - -# ifdef OPENSSL_SYS_NETWARE - if (ret) - printf("ERROR: %d\n", ret); -# endif - EXIT(ret); - return (0); -} - -static int print_test_data(void) -{ - unsigned int i, j; - - printf("ecb test data\n"); - printf("key bytes\t\tclear bytes\t\tcipher bytes\n"); - for (i = 0; i < NUM_TESTS; i++) { - for (j = 0; j < 8; j++) - printf("%02X", ecb_data[i][j]); - printf("\t"); - for (j = 0; j < 8; j++) - printf("%02X", plain_data[i][j]); - printf("\t"); - for (j = 0; j < 8; j++) - printf("%02X", cipher_data[i][j]); - printf("\n"); - } - - printf("set_key test data\n"); - printf("data[8]= "); - for (j = 0; j < 8; j++) - printf("%02X", key_data[j]); - printf("\n"); - for (i = 0; i < KEY_TEST_NUM - 1; i++) { - printf("c="); - for (j = 0; j < 8; j++) - printf("%02X", key_out[i][j]); - printf(" k[%2u]=", i + 1); - for (j = 0; j < i + 1; j++) - printf("%02X", key_test[j]); - printf("\n"); - } - - printf("\nchaining mode test data\n"); - printf("key[16] = "); - for (j = 0; j < 16; j++) - printf("%02X", cbc_key[j]); - printf("\niv[8] = "); - for (j = 0; j < 8; j++) - printf("%02X", cbc_iv[j]); - printf("\ndata[%d] = '%s'", (int)strlen(cbc_data) + 1, cbc_data); - printf("\ndata[%d] = ", (int)strlen(cbc_data) + 1); - for (j = 0; j < strlen(cbc_data) + 1; j++) - printf("%02X", cbc_data[j]); - printf("\n"); - printf("cbc cipher text\n"); - printf("cipher[%d]= ", 32); - for (j = 0; j < 32; j++) - printf("%02X", cbc_ok[j]); - printf("\n"); - - printf("cfb64 cipher text\n"); - printf("cipher[%d]= ", (int)strlen(cbc_data) + 1); - for (j = 0; j < strlen(cbc_data) + 1; j++) - printf("%02X", cfb64_ok[j]); - printf("\n"); - - printf("ofb64 cipher text\n"); - printf("cipher[%d]= ", (int)strlen(cbc_data) + 1); - for (j = 0; j < strlen(cbc_data) + 1; j++) - printf("%02X", ofb64_ok[j]); - printf("\n"); - return (0); -} - -static int test(void) -{ - unsigned char cbc_in[40], cbc_out[40], iv[8]; - int i, n, err = 0; - BF_KEY key; - BF_LONG data[2]; - unsigned char out[8]; - BF_LONG len; - -# ifdef CHARSET_EBCDIC - ebcdic2ascii(cbc_data, cbc_data, strlen(cbc_data)); -# endif - - printf("testing blowfish in raw ecb mode\n"); - for (n = 0; n < 2; n++) { -# ifdef CHARSET_EBCDIC - ebcdic2ascii(bf_key[n], bf_key[n], strlen(bf_key[n])); -# endif - BF_set_key(&key, strlen(bf_key[n]), (unsigned char *)bf_key[n]); - - data[0] = bf_plain[n][0]; - data[1] = bf_plain[n][1]; - BF_encrypt(data, &key); - if (memcmp(&(bf_cipher[n][0]), &(data[0]), 8) != 0) { - printf("BF_encrypt error encrypting\n"); - printf("got :"); - for (i = 0; i < 2; i++) - printf("%08lX ", (unsigned long)data[i]); - printf("\n"); - printf("expected:"); - for (i = 0; i < 2; i++) - printf("%08lX ", (unsigned long)bf_cipher[n][i]); - err = 1; - printf("\n"); - } - - BF_decrypt(&(data[0]), &key); - if (memcmp(&(bf_plain[n][0]), &(data[0]), 8) != 0) { - printf("BF_encrypt error decrypting\n"); - printf("got :"); - for (i = 0; i < 2; i++) - printf("%08lX ", (unsigned long)data[i]); - printf("\n"); - printf("expected:"); - for (i = 0; i < 2; i++) - printf("%08lX ", (unsigned long)bf_plain[n][i]); - printf("\n"); - err = 1; - } - } - - printf("testing blowfish in ecb mode\n"); - - for (n = 0; n < NUM_TESTS; n++) { - BF_set_key(&key, 8, ecb_data[n]); - - BF_ecb_encrypt(&(plain_data[n][0]), out, &key, BF_ENCRYPT); - if (memcmp(&(cipher_data[n][0]), out, 8) != 0) { - printf("BF_ecb_encrypt blowfish error encrypting\n"); - printf("got :"); - for (i = 0; i < 8; i++) - printf("%02X ", out[i]); - printf("\n"); - printf("expected:"); - for (i = 0; i < 8; i++) - printf("%02X ", cipher_data[n][i]); - err = 1; - printf("\n"); - } - - BF_ecb_encrypt(out, out, &key, BF_DECRYPT); - if (memcmp(&(plain_data[n][0]), out, 8) != 0) { - printf("BF_ecb_encrypt error decrypting\n"); - printf("got :"); - for (i = 0; i < 8; i++) - printf("%02X ", out[i]); - printf("\n"); - printf("expected:"); - for (i = 0; i < 8; i++) - printf("%02X ", plain_data[n][i]); - printf("\n"); - err = 1; - } - } - - printf("testing blowfish set_key\n"); - for (n = 1; n < KEY_TEST_NUM; n++) { - BF_set_key(&key, n, key_test); - BF_ecb_encrypt(key_data, out, &key, BF_ENCRYPT); - /* mips-sgi-irix6.5-gcc vv -mabi=64 bug workaround */ - if (memcmp(out, &(key_out[i = n - 1][0]), 8) != 0) { - printf("blowfish setkey error\n"); - err = 1; - } - } - - printf("testing blowfish in cbc mode\n"); - len = strlen(cbc_data) + 1; - - BF_set_key(&key, 16, cbc_key); - memset(cbc_in, 0, sizeof(cbc_in)); - memset(cbc_out, 0, sizeof(cbc_out)); - memcpy(iv, cbc_iv, sizeof(iv)); - BF_cbc_encrypt((unsigned char *)cbc_data, cbc_out, len, - &key, iv, BF_ENCRYPT); - if (memcmp(cbc_out, cbc_ok, 32) != 0) { - err = 1; - printf("BF_cbc_encrypt encrypt error\n"); - for (i = 0; i < 32; i++) - printf("0x%02X,", cbc_out[i]); - } - memcpy(iv, cbc_iv, 8); - BF_cbc_encrypt(cbc_out, cbc_in, len, &key, iv, BF_DECRYPT); - if (memcmp(cbc_in, cbc_data, strlen(cbc_data) + 1) != 0) { - printf("BF_cbc_encrypt decrypt error\n"); - err = 1; - } - - printf("testing blowfish in cfb64 mode\n"); - - BF_set_key(&key, 16, cbc_key); - memset(cbc_in, 0, 40); - memset(cbc_out, 0, 40); - memcpy(iv, cbc_iv, 8); - n = 0; - BF_cfb64_encrypt((unsigned char *)cbc_data, cbc_out, (long)13, - &key, iv, &n, BF_ENCRYPT); - BF_cfb64_encrypt((unsigned char *)&(cbc_data[13]), &(cbc_out[13]), - len - 13, &key, iv, &n, BF_ENCRYPT); - if (memcmp(cbc_out, cfb64_ok, (int)len) != 0) { - err = 1; - printf("BF_cfb64_encrypt encrypt error\n"); - for (i = 0; i < (int)len; i++) - printf("0x%02X,", cbc_out[i]); - } - n = 0; - memcpy(iv, cbc_iv, 8); - BF_cfb64_encrypt(cbc_out, cbc_in, 17, &key, iv, &n, BF_DECRYPT); - BF_cfb64_encrypt(&(cbc_out[17]), &(cbc_in[17]), len - 17, - &key, iv, &n, BF_DECRYPT); - if (memcmp(cbc_in, cbc_data, (int)len) != 0) { - printf("BF_cfb64_encrypt decrypt error\n"); - err = 1; - } - - printf("testing blowfish in ofb64\n"); - - BF_set_key(&key, 16, cbc_key); - memset(cbc_in, 0, 40); - memset(cbc_out, 0, 40); - memcpy(iv, cbc_iv, 8); - n = 0; - BF_ofb64_encrypt((unsigned char *)cbc_data, cbc_out, (long)13, &key, iv, - &n); - BF_ofb64_encrypt((unsigned char *)&(cbc_data[13]), &(cbc_out[13]), - len - 13, &key, iv, &n); - if (memcmp(cbc_out, ofb64_ok, (int)len) != 0) { - err = 1; - printf("BF_ofb64_encrypt encrypt error\n"); - for (i = 0; i < (int)len; i++) - printf("0x%02X,", cbc_out[i]); - } - n = 0; - memcpy(iv, cbc_iv, 8); - BF_ofb64_encrypt(cbc_out, cbc_in, 17, &key, iv, &n); - BF_ofb64_encrypt(&(cbc_out[17]), &(cbc_in[17]), len - 17, &key, iv, &n); - if (memcmp(cbc_in, cbc_data, (int)len) != 0) { - printf("BF_ofb64_encrypt decrypt error\n"); - err = 1; - } - - return (err); -} -#endif diff --git a/deps/openssl/openssl/crypto/bf/blowfish.h b/deps/openssl/openssl/crypto/bf/blowfish.h deleted file mode 100644 index 832930272c..0000000000 --- a/deps/openssl/openssl/crypto/bf/blowfish.h +++ /dev/null @@ -1,130 +0,0 @@ -/* crypto/bf/blowfish.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef HEADER_BLOWFISH_H -# define HEADER_BLOWFISH_H - -# include <openssl/e_os2.h> - -#ifdef __cplusplus -extern "C" { -#endif - -# ifdef OPENSSL_NO_BF -# error BF is disabled. -# endif - -# define BF_ENCRYPT 1 -# define BF_DECRYPT 0 - -/*- - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! BF_LONG has to be at least 32 bits wide. If it's wider, then ! - * ! BF_LONG_LOG2 has to be defined along. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ - -# if defined(__LP32__) -# define BF_LONG unsigned long -# elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) -# define BF_LONG unsigned long -# define BF_LONG_LOG2 3 -/* - * _CRAY note. I could declare short, but I have no idea what impact - * does it have on performance on none-T3E machines. I could declare - * int, but at least on C90 sizeof(int) can be chosen at compile time. - * So I've chosen long... - * <appro@fy.chalmers.se> - */ -# else -# define BF_LONG unsigned int -# endif - -# define BF_ROUNDS 16 -# define BF_BLOCK 8 - -typedef struct bf_key_st { - BF_LONG P[BF_ROUNDS + 2]; - BF_LONG S[4 * 256]; -} BF_KEY; - -# ifdef OPENSSL_FIPS -void private_BF_set_key(BF_KEY *key, int len, const unsigned char *data); -# endif -void BF_set_key(BF_KEY *key, int len, const unsigned char *data); - -void BF_encrypt(BF_LONG *data, const BF_KEY *key); -void BF_decrypt(BF_LONG *data, const BF_KEY *key); - -void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, - const BF_KEY *key, int enc); -void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - const BF_KEY *schedule, unsigned char *ivec, int enc); -void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const BF_KEY *schedule, - unsigned char *ivec, int *num, int enc); -void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const BF_KEY *schedule, - unsigned char *ivec, int *num); -const char *BF_options(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/deps/openssl/openssl/crypto/bf/build.info b/deps/openssl/openssl/crypto/bf/build.info new file mode 100644 index 0000000000..37a004ea5b --- /dev/null +++ b/deps/openssl/openssl/crypto/bf/build.info @@ -0,0 +1,6 @@ +LIBS=../../libcrypto +SOURCE[../../libcrypto]=bf_skey.c bf_ecb.c bf_cfb64.c bf_ofb64.c \ + {- $target{bf_asm_src} -} + +GENERATE[bf-586.s]=asm/bf-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(LIB_CFLAGS) $(PROCESSOR) +DEPEND[bf-586.s]=../perlasm/x86asm.pl ../perlasm/cbc.pl |