diff options
Diffstat (limited to 'deps/openssl/openssl/crypto/rc5')
-rw-r--r-- | deps/openssl/openssl/crypto/rc5/Makefile | 96 | ||||
-rw-r--r-- | deps/openssl/openssl/crypto/rc5/asm/rc5-586.pl | 14 | ||||
-rw-r--r-- | deps/openssl/openssl/crypto/rc5/build.info | 6 | ||||
-rw-r--r-- | deps/openssl/openssl/crypto/rc5/rc5.h | 115 | ||||
-rw-r--r-- | deps/openssl/openssl/crypto/rc5/rc5_ecb.c | 63 | ||||
-rw-r--r-- | deps/openssl/openssl/crypto/rc5/rc5_enc.c | 61 | ||||
-rw-r--r-- | deps/openssl/openssl/crypto/rc5/rc5_locl.h | 97 | ||||
-rw-r--r-- | deps/openssl/openssl/crypto/rc5/rc5_skey.c | 61 | ||||
-rw-r--r-- | deps/openssl/openssl/crypto/rc5/rc5cfb64.c | 61 | ||||
-rw-r--r-- | deps/openssl/openssl/crypto/rc5/rc5ofb64.c | 61 | ||||
-rw-r--r-- | deps/openssl/openssl/crypto/rc5/rc5s.cpp | 70 | ||||
-rw-r--r-- | deps/openssl/openssl/crypto/rc5/rc5speed.c | 265 | ||||
-rw-r--r-- | deps/openssl/openssl/crypto/rc5/rc5test.c | 381 |
13 files changed, 87 insertions, 1264 deletions
diff --git a/deps/openssl/openssl/crypto/rc5/Makefile b/deps/openssl/openssl/crypto/rc5/Makefile deleted file mode 100644 index 6ca0037c68..0000000000 --- a/deps/openssl/openssl/crypto/rc5/Makefile +++ /dev/null @@ -1,96 +0,0 @@ -# -# OpenSSL/crypto/rc5/Makefile -# - -DIR= rc5 -TOP= ../.. -CC= cc -CPP= $(CC) -E -INCLUDES= -CFLAG=-g -MAKEFILE= Makefile -AR= ar r - -RC5_ENC= rc5_enc.o - -CFLAGS= $(INCLUDES) $(CFLAG) -ASFLAGS= $(INCLUDES) $(ASFLAG) -AFLAGS= $(ASFLAGS) - -GENERAL=Makefile -TEST=rc5test.c -APPS= - -LIB=$(TOP)/libcrypto.a -LIBSRC=rc5_skey.c rc5_ecb.c rc5_enc.c rc5cfb64.c rc5ofb64.c -LIBOBJ=rc5_skey.o rc5_ecb.o $(RC5_ENC) rc5cfb64.o rc5ofb64.o - -SRC= $(LIBSRC) - -EXHEADER= rc5.h -HEADER= rc5_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 - -rc5-586.s: asm/rc5-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl - $(PERL) asm/rc5-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@ - -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) - -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. - -rc5_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h -rc5_ecb.o: ../../include/openssl/rc5.h rc5_ecb.c rc5_locl.h -rc5_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc5.h -rc5_enc.o: rc5_enc.c rc5_locl.h -rc5_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc5.h -rc5_skey.o: rc5_locl.h rc5_skey.c -rc5cfb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc5.h -rc5cfb64.o: rc5_locl.h rc5cfb64.c -rc5ofb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc5.h -rc5ofb64.o: rc5_locl.h rc5ofb64.c diff --git a/deps/openssl/openssl/crypto/rc5/asm/rc5-586.pl b/deps/openssl/openssl/crypto/rc5/asm/rc5-586.pl index 61ac6effc6..e3e1c64242 100644 --- a/deps/openssl/openssl/crypto/rc5/asm/rc5-586.pl +++ b/deps/openssl/openssl/crypto/rc5/asm/rc5-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],"rc5-586.pl"); $RC5_MAX_ROUNDS=16; @@ -22,6 +32,8 @@ $tmp4="edx"; &cbc("RC5_32_cbc_encrypt","RC5_32_encrypt","RC5_32_decrypt",0,4,5,3,-1,-1); &asm_finish(); +close STDOUT; + sub RC5_32_encrypt { local($name,$enc)=@_; diff --git a/deps/openssl/openssl/crypto/rc5/build.info b/deps/openssl/openssl/crypto/rc5/build.info new file mode 100644 index 0000000000..baf8a0effe --- /dev/null +++ b/deps/openssl/openssl/crypto/rc5/build.info @@ -0,0 +1,6 @@ +LIBS=../../libcrypto +SOURCE[../../libcrypto]=\ + rc5_skey.c rc5_ecb.c {- $target{rc5_asm_src} -} rc5cfb64.c rc5ofb64.c + +GENERATE[rc5-586.s]=asm/rc5-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(LIB_CFLAGS) +DEPEND[rc5-586.s]=../perlasm/x86asm.pl ../perlasm/cbc.pl diff --git a/deps/openssl/openssl/crypto/rc5/rc5.h b/deps/openssl/openssl/crypto/rc5/rc5.h deleted file mode 100644 index fba613713d..0000000000 --- a/deps/openssl/openssl/crypto/rc5/rc5.h +++ /dev/null @@ -1,115 +0,0 @@ -/* crypto/rc5/rc5.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_RC5_H -# define HEADER_RC5_H - -# include <openssl/opensslconf.h>/* OPENSSL_NO_RC5 */ - -#ifdef __cplusplus -extern "C" { -#endif - -# ifdef OPENSSL_NO_RC5 -# error RC5 is disabled. -# endif - -# define RC5_ENCRYPT 1 -# define RC5_DECRYPT 0 - -/* 32 bit. For Alpha, things may get weird */ -# define RC5_32_INT unsigned long - -# define RC5_32_BLOCK 8 -# define RC5_32_KEY_LENGTH 16/* This is a default, max is 255 */ - -/* - * This are the only values supported. Tweak the code if you want more The - * most supported modes will be RC5-32/12/16 RC5-32/16/8 - */ -# define RC5_8_ROUNDS 8 -# define RC5_12_ROUNDS 12 -# define RC5_16_ROUNDS 16 - -typedef struct rc5_key_st { - /* Number of rounds */ - int rounds; - RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)]; -} RC5_32_KEY; - -void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, - int rounds); -void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out, - RC5_32_KEY *key, int enc); -void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key); -void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key); -void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out, - long length, RC5_32_KEY *ks, unsigned char *iv, - int enc); -void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC5_32_KEY *schedule, - unsigned char *ivec, int *num, int enc); -void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC5_32_KEY *schedule, - unsigned char *ivec, int *num); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/deps/openssl/openssl/crypto/rc5/rc5_ecb.c b/deps/openssl/openssl/crypto/rc5/rc5_ecb.c index e657a93b9a..c32f38e473 100644 --- a/deps/openssl/openssl/crypto/rc5/rc5_ecb.c +++ b/deps/openssl/openssl/crypto/rc5/rc5_ecb.c @@ -1,67 +1,16 @@ -/* crypto/rc5/rc5_ecb.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/rc5.h> #include "rc5_locl.h" #include <openssl/opensslv.h> -const char RC5_version[] = "RC5" OPENSSL_VERSION_PTEXT; - void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out, RC5_32_KEY *ks, int encrypt) { diff --git a/deps/openssl/openssl/crypto/rc5/rc5_enc.c b/deps/openssl/openssl/crypto/rc5/rc5_enc.c index 06b89d83a1..58631dee20 100644 --- a/deps/openssl/openssl/crypto/rc5/rc5_enc.c +++ b/deps/openssl/openssl/crypto/rc5/rc5_enc.c @@ -1,59 +1,10 @@ -/* crypto/rc5/rc5_enc.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> diff --git a/deps/openssl/openssl/crypto/rc5/rc5_locl.h b/deps/openssl/openssl/crypto/rc5/rc5_locl.h index ee757e6477..41130fe33b 100644 --- a/deps/openssl/openssl/crypto/rc5/rc5_locl.h +++ b/deps/openssl/openssl/crypto/rc5/rc5_locl.h @@ -1,59 +1,10 @@ -/* crypto/rc5/rc5_locl.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 */ #include <stdlib.h> @@ -71,13 +22,20 @@ l1=l2=0; \ switch (n) { \ case 8: l2 =((unsigned long)(*(--(c))))<<24L; \ + /* fall thru */ \ case 7: l2|=((unsigned long)(*(--(c))))<<16L; \ + /* fall thru */ \ case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \ - case 5: l2|=((unsigned long)(*(--(c)))); \ + /* fall thru */ \ + case 5: l2|=((unsigned long)(*(--(c)))); \ + /* fall thru */ \ case 4: l1 =((unsigned long)(*(--(c))))<<24L; \ + /* fall thru */ \ case 3: l1|=((unsigned long)(*(--(c))))<<16L; \ + /* fall thru */ \ case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \ - case 1: l1|=((unsigned long)(*(--(c)))); \ + /* fall thru */ \ + case 1: l1|=((unsigned long)(*(--(c)))); \ } \ } @@ -93,12 +51,19 @@ c+=n; \ switch (n) { \ case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ + /* fall thru */ \ case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ + /* fall thru */ \ case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ + /* fall thru */ \ case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ + /* fall thru */ \ case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ + /* fall thru */ \ case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ + /* fall thru */ \ case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ + /* fall thru */ \ case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ } \ } @@ -109,12 +74,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; \ } \ } @@ -124,12 +96,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); \ } \ } @@ -171,10 +150,10 @@ # endif #endif #ifndef ROTATE_l32 -# define ROTATE_l32(a,n) (((a)<<(n&0x1f))|(((a)&0xffffffff)>>(32-(n&0x1f)))) +# define ROTATE_l32(a,n) (((a)<<(n&0x1f))|(((a)&0xffffffff)>>((32-n)&0x1f))) #endif #ifndef ROTATE_r32 -# define ROTATE_r32(a,n) (((a)<<(32-(n&0x1f)))|(((a)&0xffffffff)>>(n&0x1f))) +# define ROTATE_r32(a,n) (((a)<<((32-n)&0x1f))|(((a)&0xffffffff)>>(n&0x1f))) #endif #define RC5_32_MASK 0xffffffffL diff --git a/deps/openssl/openssl/crypto/rc5/rc5_skey.c b/deps/openssl/openssl/crypto/rc5/rc5_skey.c index 5dd4a52743..943a7849bb 100644 --- a/deps/openssl/openssl/crypto/rc5/rc5_skey.c +++ b/deps/openssl/openssl/crypto/rc5/rc5_skey.c @@ -1,59 +1,10 @@ -/* crypto/rc5/rc5_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 <openssl/rc5.h> diff --git a/deps/openssl/openssl/crypto/rc5/rc5cfb64.c b/deps/openssl/openssl/crypto/rc5/rc5cfb64.c index a3813e030b..9a8aa6b244 100644 --- a/deps/openssl/openssl/crypto/rc5/rc5cfb64.c +++ b/deps/openssl/openssl/crypto/rc5/rc5cfb64.c @@ -1,59 +1,10 @@ -/* crypto/rc5/rc5cfb64.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/rc5.h> diff --git a/deps/openssl/openssl/crypto/rc5/rc5ofb64.c b/deps/openssl/openssl/crypto/rc5/rc5ofb64.c index d3c63067b7..3a41d773cb 100644 --- a/deps/openssl/openssl/crypto/rc5/rc5ofb64.c +++ b/deps/openssl/openssl/crypto/rc5/rc5ofb64.c @@ -1,59 +1,10 @@ -/* crypto/rc5/rc5ofb64.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/rc5.h> diff --git a/deps/openssl/openssl/crypto/rc5/rc5s.cpp b/deps/openssl/openssl/crypto/rc5/rc5s.cpp deleted file mode 100644 index 1c5518bc80..0000000000 --- a/deps/openssl/openssl/crypto/rc5/rc5s.cpp +++ /dev/null @@ -1,70 +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/rc5.h> - -void main(int argc,char *argv[]) - { - RC5_32_KEY key; - unsigned long s1,s2,e1,e2; - unsigned long data[2]; - int i,j; - static unsigned char d[16]={0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}; - - RC5_32_set_key(&key, 16,d,12); - - for (j=0; j<6; j++) - { - for (i=0; i<1000; i++) /**/ - { - RC5_32_encrypt(&data[0],&key); - GetTSC(s1); - RC5_32_encrypt(&data[0],&key); - RC5_32_encrypt(&data[0],&key); - RC5_32_encrypt(&data[0],&key); - GetTSC(e1); - GetTSC(s2); - RC5_32_encrypt(&data[0],&key); - RC5_32_encrypt(&data[0],&key); - RC5_32_encrypt(&data[0],&key); - RC5_32_encrypt(&data[0],&key); - GetTSC(e2); - RC5_32_encrypt(&data[0],&key); - } - - printf("cast %d %d (%d)\n", - e1-s1,e2-s2,((e2-s2)-(e1-s1))); - } - } - diff --git a/deps/openssl/openssl/crypto/rc5/rc5speed.c b/deps/openssl/openssl/crypto/rc5/rc5speed.c deleted file mode 100644 index 3f595704a9..0000000000 --- a/deps/openssl/openssl/crypto/rc5/rc5speed.c +++ /dev/null @@ -1,265 +0,0 @@ -/* crypto/rc5/rc5speed.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/rc5.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, - }; - RC5_32_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"); - RC5_32_set_key(&sch, 16, key, 12); - count = 10; - do { - long i; - unsigned long data[2]; - - count *= 2; - Time_F(START); - for (i = count; i; i--) - RC5_32_encrypt(data, &sch); - d = Time_F(STOP); - } while (d < 3.0); - ca = count / 512; - cb = count; - cc = count * 8 / BUFSIZE + 1; - printf("Doing RC5_32_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 RC5_32_set_key for 10 seconds\n"); - alarm(10); -#endif - - Time_F(START); - for (count = 0, run = 1; COND(ca); count += 4) { - RC5_32_set_key(&sch, 16, key, 12); - RC5_32_set_key(&sch, 16, key, 12); - RC5_32_set_key(&sch, 16, key, 12); - RC5_32_set_key(&sch, 16, key, 12); - } - d = Time_F(STOP); - printf("%ld RC5_32_set_key's in %.2f seconds\n", count, d); - a = ((double)COUNT(ca)) / d; - -#ifdef SIGALRM - printf("Doing RC5_32_encrypt's for 10 seconds\n"); - alarm(10); -#else - printf("Doing RC5_32_encrypt %ld times\n", cb); -#endif - Time_F(START); - for (count = 0, run = 1; COND(cb); count += 4) { - unsigned long data[2]; - - RC5_32_encrypt(data, &sch); - RC5_32_encrypt(data, &sch); - RC5_32_encrypt(data, &sch); - RC5_32_encrypt(data, &sch); - } - d = Time_F(STOP); - printf("%ld RC5_32_encrypt's in %.2f second\n", count, d); - b = ((double)COUNT(cb) * 8) / d; - -#ifdef SIGALRM - printf("Doing RC5_32_cbc_encrypt on %ld byte blocks for 10 seconds\n", - BUFSIZE); - alarm(10); -#else - printf("Doing RC5_32_cbc_encrypt %ld times on %ld byte blocks\n", cc, - BUFSIZE); -#endif - Time_F(START); - for (count = 0, run = 1; COND(cc); count++) - RC5_32_cbc_encrypt(buf, buf, BUFSIZE, &sch, &(key[0]), RC5_ENCRYPT); - d = Time_F(STOP); - printf("%ld RC5_32_cbc_encrypt's of %ld byte blocks in %.2f second\n", - count, BUFSIZE, d); - c = ((double)COUNT(cc) * BUFSIZE) / d; - - printf("RC5_32/12/16 set_key per sec = %12.2f (%9.3fuS)\n", a, - 1.0e6 / a); - printf("RC5_32/12/16 raw ecb bytes per sec = %12.2f (%9.3fuS)\n", b, - 8.0e6 / b); - printf("RC5_32/12/16 cbc bytes per sec = %12.2f (%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/rc5/rc5test.c b/deps/openssl/openssl/crypto/rc5/rc5test.c deleted file mode 100644 index b29a436cec..0000000000 --- a/deps/openssl/openssl/crypto/rc5/rc5test.c +++ /dev/null @@ -1,381 +0,0 @@ -/* crypto/rc5/rc5test.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 - * RC5 modes, more of the code will be uncommented. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#include "../e_os.h" - -#ifdef OPENSSL_NO_RC5 -int main(int argc, char *argv[]) -{ - printf("No RC5 support\n"); - return (0); -} -#else -# include <openssl/rc5.h> - -static unsigned char RC5key[5][16] = { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x91, 0x5f, 0x46, 0x19, 0xbe, 0x41, 0xb2, 0x51, - 0x63, 0x55, 0xa5, 0x01, 0x10, 0xa9, 0xce, 0x91}, - {0x78, 0x33, 0x48, 0xe7, 0x5a, 0xeb, 0x0f, 0x2f, - 0xd7, 0xb1, 0x69, 0xbb, 0x8d, 0xc1, 0x67, 0x87}, - {0xdc, 0x49, 0xdb, 0x13, 0x75, 0xa5, 0x58, 0x4f, - 0x64, 0x85, 0xb4, 0x13, 0xb5, 0xf1, 0x2b, 0xaf}, - {0x52, 0x69, 0xf1, 0x49, 0xd4, 0x1b, 0xa0, 0x15, - 0x24, 0x97, 0x57, 0x4d, 0x7f, 0x15, 0x31, 0x25}, -}; - -static unsigned char RC5plain[5][8] = { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x21, 0xA5, 0xDB, 0xEE, 0x15, 0x4B, 0x8F, 0x6D}, - {0xF7, 0xC0, 0x13, 0xAC, 0x5B, 0x2B, 0x89, 0x52}, - {0x2F, 0x42, 0xB3, 0xB7, 0x03, 0x69, 0xFC, 0x92}, - {0x65, 0xC1, 0x78, 0xB2, 0x84, 0xD1, 0x97, 0xCC}, -}; - -static unsigned char RC5cipher[5][8] = { - {0x21, 0xA5, 0xDB, 0xEE, 0x15, 0x4B, 0x8F, 0x6D}, - {0xF7, 0xC0, 0x13, 0xAC, 0x5B, 0x2B, 0x89, 0x52}, - {0x2F, 0x42, 0xB3, 0xB7, 0x03, 0x69, 0xFC, 0x92}, - {0x65, 0xC1, 0x78, 0xB2, 0x84, 0xD1, 0x97, 0xCC}, - {0xEB, 0x44, 0xE4, 0x15, 0xDA, 0x31, 0x98, 0x24}, -}; - -# define RC5_CBC_NUM 27 -static unsigned char rc5_cbc_cipher[RC5_CBC_NUM][8] = { - {0x7a, 0x7b, 0xba, 0x4d, 0x79, 0x11, 0x1d, 0x1e}, - {0x79, 0x7b, 0xba, 0x4d, 0x78, 0x11, 0x1d, 0x1e}, - {0x7a, 0x7b, 0xba, 0x4d, 0x79, 0x11, 0x1d, 0x1f}, - {0x7a, 0x7b, 0xba, 0x4d, 0x79, 0x11, 0x1d, 0x1f}, - {0x8b, 0x9d, 0xed, 0x91, 0xce, 0x77, 0x94, 0xa6}, - {0x2f, 0x75, 0x9f, 0xe7, 0xad, 0x86, 0xa3, 0x78}, - {0xdc, 0xa2, 0x69, 0x4b, 0xf4, 0x0e, 0x07, 0x88}, - {0xdc, 0xa2, 0x69, 0x4b, 0xf4, 0x0e, 0x07, 0x88}, - {0xdc, 0xfe, 0x09, 0x85, 0x77, 0xec, 0xa5, 0xff}, - {0x96, 0x46, 0xfb, 0x77, 0x63, 0x8f, 0x9c, 0xa8}, - {0xb2, 0xb3, 0x20, 0x9d, 0xb6, 0x59, 0x4d, 0xa4}, - {0x54, 0x5f, 0x7f, 0x32, 0xa5, 0xfc, 0x38, 0x36}, - {0x82, 0x85, 0xe7, 0xc1, 0xb5, 0xbc, 0x74, 0x02}, - {0xfc, 0x58, 0x6f, 0x92, 0xf7, 0x08, 0x09, 0x34}, - {0xcf, 0x27, 0x0e, 0xf9, 0x71, 0x7f, 0xf7, 0xc4}, - {0xe4, 0x93, 0xf1, 0xc1, 0xbb, 0x4d, 0x6e, 0x8c}, - {0x5c, 0x4c, 0x04, 0x1e, 0x0f, 0x21, 0x7a, 0xc3}, - {0x92, 0x1f, 0x12, 0x48, 0x53, 0x73, 0xb4, 0xf7}, - {0x5b, 0xa0, 0xca, 0x6b, 0xbe, 0x7f, 0x5f, 0xad}, - {0xc5, 0x33, 0x77, 0x1c, 0xd0, 0x11, 0x0e, 0x63}, - {0x29, 0x4d, 0xdb, 0x46, 0xb3, 0x27, 0x8d, 0x60}, - {0xda, 0xd6, 0xbd, 0xa9, 0xdf, 0xe8, 0xf7, 0xe8}, - {0x97, 0xe0, 0x78, 0x78, 0x37, 0xed, 0x31, 0x7f}, - {0x78, 0x75, 0xdb, 0xf6, 0x73, 0x8c, 0x64, 0x78}, - {0x8f, 0x34, 0xc3, 0xc6, 0x81, 0xc9, 0x96, 0x95}, - {0x7c, 0xb3, 0xf1, 0xdf, 0x34, 0xf9, 0x48, 0x11}, - {0x7f, 0xd1, 0xa0, 0x23, 0xa5, 0xbb, 0xa2, 0x17}, -}; - -static unsigned char rc5_cbc_key[RC5_CBC_NUM][17] = { - {1, 0x00}, - {1, 0x00}, - {1, 0x00}, - {1, 0x00}, - {1, 0x00}, - {1, 0x11}, - {1, 0x00}, - {4, 0x00, 0x00, 0x00, 0x00}, - {1, 0x00}, - {1, 0x00}, - {1, 0x00}, - {1, 0x00}, - {4, 0x01, 0x02, 0x03, 0x04}, - {4, 0x01, 0x02, 0x03, 0x04}, - {4, 0x01, 0x02, 0x03, 0x04}, - {8, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - {8, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - {8, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - {8, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - {16, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}, - {16, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}, - {16, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}, - {5, 0x01, 0x02, 0x03, 0x04, 0x05}, - {5, 0x01, 0x02, 0x03, 0x04, 0x05}, - {5, 0x01, 0x02, 0x03, 0x04, 0x05}, - {5, 0x01, 0x02, 0x03, 0x04, 0x05}, - {5, 0x01, 0x02, 0x03, 0x04, 0x05}, -}; - -static unsigned char rc5_cbc_plain[RC5_CBC_NUM][8] = { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, - {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}, - {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}, - {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}, - {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}, - {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}, - {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}, - {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}, - {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x01}, -}; - -static int rc5_cbc_rounds[RC5_CBC_NUM] = { - 0, 0, 0, 0, 0, 1, 2, 2, - 8, 8, 12, 16, 8, 12, 16, 12, - 8, 12, 16, 8, 12, 16, 12, 8, - 8, 8, 8, -}; - -static unsigned char rc5_cbc_iv[RC5_CBC_NUM][8] = { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x78, 0x75, 0xdb, 0xf6, 0x73, 0x8c, 0x64, 0x78}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x7c, 0xb3, 0xf1, 0xdf, 0x34, 0xf9, 0x48, 0x11}, -}; - -int main(int argc, char *argv[]) -{ - int i, n, err = 0; - RC5_32_KEY key; - unsigned char buf[8], buf2[8], ivb[8]; - - for (n = 0; n < 5; n++) { - RC5_32_set_key(&key, 16, &(RC5key[n][0]), 12); - - RC5_32_ecb_encrypt(&(RC5plain[n][0]), buf, &key, RC5_ENCRYPT); - if (memcmp(&(RC5cipher[n][0]), buf, 8) != 0) { - printf("ecb RC5 error encrypting (%d)\n", n + 1); - printf("got :"); - for (i = 0; i < 8; i++) - printf("%02X ", buf[i]); - printf("\n"); - printf("expected:"); - for (i = 0; i < 8; i++) - printf("%02X ", RC5cipher[n][i]); - err = 20; - printf("\n"); - } - - RC5_32_ecb_encrypt(buf, buf2, &key, RC5_DECRYPT); - if (memcmp(&(RC5plain[n][0]), buf2, 8) != 0) { - printf("ecb RC5 error decrypting (%d)\n", n + 1); - printf("got :"); - for (i = 0; i < 8; i++) - printf("%02X ", buf2[i]); - printf("\n"); - printf("expected:"); - for (i = 0; i < 8; i++) - printf("%02X ", RC5plain[n][i]); - printf("\n"); - err = 3; - } - } - if (err == 0) - printf("ecb RC5 ok\n"); - - for (n = 0; n < RC5_CBC_NUM; n++) { - i = rc5_cbc_rounds[n]; - if (i < 8) - continue; - - RC5_32_set_key(&key, rc5_cbc_key[n][0], &(rc5_cbc_key[n][1]), i); - - memcpy(ivb, &(rc5_cbc_iv[n][0]), 8); - RC5_32_cbc_encrypt(&(rc5_cbc_plain[n][0]), buf, 8, - &key, &(ivb[0]), RC5_ENCRYPT); - - if (memcmp(&(rc5_cbc_cipher[n][0]), buf, 8) != 0) { - printf("cbc RC5 error encrypting (%d)\n", n + 1); - printf("got :"); - for (i = 0; i < 8; i++) - printf("%02X ", buf[i]); - printf("\n"); - printf("expected:"); - for (i = 0; i < 8; i++) - printf("%02X ", rc5_cbc_cipher[n][i]); - err = 30; - printf("\n"); - } - - memcpy(ivb, &(rc5_cbc_iv[n][0]), 8); - RC5_32_cbc_encrypt(buf, buf2, 8, &key, &(ivb[0]), RC5_DECRYPT); - if (memcmp(&(rc5_cbc_plain[n][0]), buf2, 8) != 0) { - printf("cbc RC5 error decrypting (%d)\n", n + 1); - printf("got :"); - for (i = 0; i < 8; i++) - printf("%02X ", buf2[i]); - printf("\n"); - printf("expected:"); - for (i = 0; i < 8; i++) - printf("%02X ", rc5_cbc_plain[n][i]); - printf("\n"); - err = 3; - } - } - if (err == 0) - printf("cbc RC5 ok\n"); - - EXIT(err); - return (err); -} - -# ifdef undef -static int cfb64_test(unsigned char *cfb_cipher) -{ - IDEA_KEY_SCHEDULE eks, dks; - int err = 0, i, n; - - idea_set_encrypt_key(cfb_key, &eks); - idea_set_decrypt_key(&eks, &dks); - memcpy(cfb_tmp, cfb_iv, 8); - n = 0; - idea_cfb64_encrypt(plain, cfb_buf1, (long)12, &eks, - cfb_tmp, &n, IDEA_ENCRYPT); - idea_cfb64_encrypt(&(plain[12]), &(cfb_buf1[12]), - (long)CFB_TEST_SIZE - 12, &eks, - cfb_tmp, &n, IDEA_ENCRYPT); - if (memcmp(cfb_cipher, cfb_buf1, CFB_TEST_SIZE) != 0) { - err = 1; - printf("idea_cfb64_encrypt encrypt error\n"); - for (i = 0; i < CFB_TEST_SIZE; i += 8) - printf("%s\n", pt(&(cfb_buf1[i]))); - } - memcpy(cfb_tmp, cfb_iv, 8); - n = 0; - idea_cfb64_encrypt(cfb_buf1, cfb_buf2, (long)17, &eks, - cfb_tmp, &n, IDEA_DECRYPT); - idea_cfb64_encrypt(&(cfb_buf1[17]), &(cfb_buf2[17]), - (long)CFB_TEST_SIZE - 17, &dks, - cfb_tmp, &n, IDEA_DECRYPT); - if (memcmp(plain, cfb_buf2, CFB_TEST_SIZE) != 0) { - err = 1; - printf("idea_cfb_encrypt decrypt error\n"); - for (i = 0; i < 24; i += 8) - printf("%s\n", pt(&(cfb_buf2[i]))); - } - return (err); -} - -static char *pt(unsigned char *p) -{ - static char bufs[10][20]; - static int bnum = 0; - char *ret; - int i; - static char *f = "0123456789ABCDEF"; - - ret = &(bufs[bnum++][0]); - bnum %= 10; - for (i = 0; i < 8; i++) { - ret[i * 2] = f[(p[i] >> 4) & 0xf]; - ret[i * 2 + 1] = f[p[i] & 0xf]; - } - ret[16] = '\0'; - return (ret); -} - -# endif -#endif |