sl@0: /* crypto/des/des_opts.c */ sl@0: /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) sl@0: * All rights reserved. sl@0: * sl@0: * This package is an SSL implementation written sl@0: * by Eric Young (eay@cryptsoft.com). sl@0: * The implementation was written so as to conform with Netscapes SSL. sl@0: * sl@0: * This library is free for commercial and non-commercial use as long as sl@0: * the following conditions are aheared to. The following conditions sl@0: * apply to all code found in this distribution, be it the RC4, RSA, sl@0: * lhash, DES, etc., code; not just the SSL code. The SSL documentation sl@0: * included with this distribution is covered by the same copyright terms sl@0: * except that the holder is Tim Hudson (tjh@cryptsoft.com). sl@0: * sl@0: * Copyright remains Eric Young's, and as such any Copyright notices in sl@0: * the code are not to be removed. sl@0: * If this package is used in a product, Eric Young should be given attribution sl@0: * as the author of the parts of the library used. sl@0: * This can be in the form of a textual message at program startup or sl@0: * in documentation (online or textual) provided with the package. sl@0: * sl@0: * Redistribution and use in source and binary forms, with or without sl@0: * modification, are permitted provided that the following conditions sl@0: * are met: sl@0: * 1. Redistributions of source code must retain the copyright sl@0: * notice, this list of conditions and the following disclaimer. sl@0: * 2. Redistributions in binary form must reproduce the above copyright sl@0: * notice, this list of conditions and the following disclaimer in the sl@0: * documentation and/or other materials provided with the distribution. sl@0: * 3. All advertising materials mentioning features or use of this software sl@0: * must display the following acknowledgement: sl@0: * "This product includes cryptographic software written by sl@0: * Eric Young (eay@cryptsoft.com)" sl@0: * The word 'cryptographic' can be left out if the rouines from the library sl@0: * being used are not cryptographic related :-). sl@0: * 4. If you include any Windows specific code (or a derivative thereof) from sl@0: * the apps directory (application code) you must include an acknowledgement: sl@0: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" sl@0: * sl@0: * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND sl@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE sl@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE sl@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE sl@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL sl@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS sl@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) sl@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT sl@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY sl@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF sl@0: * SUCH DAMAGE. sl@0: * sl@0: * The licence and distribution terms for any publically available version or sl@0: * derivative of this code cannot be changed. i.e. this code cannot simply be sl@0: * copied and put under another distribution licence sl@0: * [including the GNU Public Licence.] sl@0: */ sl@0: sl@0: /* define PART1, PART2, PART3 or PART4 to build only with a few of the options. sl@0: * This is for machines with 64k code segment size restrictions. */ sl@0: sl@0: #if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) sl@0: #define TIMES sl@0: #endif sl@0: sl@0: #include sl@0: #ifndef OPENSSL_SYS_MSDOS sl@0: #include sl@0: #include OPENSSL_UNISTD sl@0: #else sl@0: #include sl@0: extern void exit(); sl@0: #endif sl@0: sl@0: #ifndef OPENSSL_SYS_NETWARE sl@0: #include sl@0: #endif sl@0: sl@0: #ifndef _IRIX sl@0: #include sl@0: #endif sl@0: #ifdef TIMES sl@0: #include sl@0: #include sl@0: #endif sl@0: sl@0: /* Depending on the VMS version, the tms structure is perhaps defined. sl@0: The __TMS macro will show if it was. If it wasn't defined, we should sl@0: undefine TIMES, since that tells the rest of the program how things sl@0: should be handled. -- Richard Levitte */ sl@0: #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) sl@0: #undef TIMES sl@0: #endif sl@0: sl@0: #ifndef TIMES sl@0: #include sl@0: #endif sl@0: sl@0: sl@0: #if defined(sun) || defined(__ultrix) sl@0: #define _POSIX_SOURCE sl@0: #include sl@0: #include sl@0: #endif sl@0: sl@0: #include sl@0: #include "spr.h" sl@0: sl@0: #define DES_DEFAULT_OPTIONS sl@0: sl@0: #if !defined(PART1) && !defined(PART2) && !defined(PART3) && !defined(PART4) sl@0: #define PART1 sl@0: #define PART2 sl@0: #define PART3 sl@0: #define PART4 sl@0: #endif sl@0: sl@0: #ifdef PART1 sl@0: sl@0: #undef DES_UNROLL sl@0: #undef DES_RISC1 sl@0: #undef DES_RISC2 sl@0: #undef DES_PTR sl@0: #undef D_ENCRYPT sl@0: #define DES_encrypt1 des_encrypt_u4_cisc_idx sl@0: #define DES_encrypt2 des_encrypt2_u4_cisc_idx sl@0: #define DES_encrypt3 des_encrypt3_u4_cisc_idx sl@0: #define DES_decrypt3 des_decrypt3_u4_cisc_idx sl@0: #undef HEADER_DES_LOCL_H sl@0: #include "des_enc.c" sl@0: sl@0: #define DES_UNROLL sl@0: #undef DES_RISC1 sl@0: #undef DES_RISC2 sl@0: #undef DES_PTR sl@0: #undef D_ENCRYPT sl@0: #undef DES_encrypt1 sl@0: #undef DES_encrypt2 sl@0: #undef DES_encrypt3 sl@0: #undef DES_decrypt3 sl@0: #define DES_encrypt1 des_encrypt_u16_cisc_idx sl@0: #define DES_encrypt2 des_encrypt2_u16_cisc_idx sl@0: #define DES_encrypt3 des_encrypt3_u16_cisc_idx sl@0: #define DES_decrypt3 des_decrypt3_u16_cisc_idx sl@0: #undef HEADER_DES_LOCL_H sl@0: #include "des_enc.c" sl@0: sl@0: #undef DES_UNROLL sl@0: #define DES_RISC1 sl@0: #undef DES_RISC2 sl@0: #undef DES_PTR sl@0: #undef D_ENCRYPT sl@0: #undef DES_encrypt1 sl@0: #undef DES_encrypt2 sl@0: #undef DES_encrypt3 sl@0: #undef DES_decrypt3 sl@0: #define DES_encrypt1 des_encrypt_u4_risc1_idx sl@0: #define DES_encrypt2 des_encrypt2_u4_risc1_idx sl@0: #define DES_encrypt3 des_encrypt3_u4_risc1_idx sl@0: #define DES_decrypt3 des_decrypt3_u4_risc1_idx sl@0: #undef HEADER_DES_LOCL_H sl@0: #include "des_enc.c" sl@0: sl@0: #endif sl@0: sl@0: #ifdef PART2 sl@0: sl@0: #undef DES_UNROLL sl@0: #undef DES_RISC1 sl@0: #define DES_RISC2 sl@0: #undef DES_PTR sl@0: #undef D_ENCRYPT sl@0: #undef DES_encrypt1 sl@0: #undef DES_encrypt2 sl@0: #undef DES_encrypt3 sl@0: #undef DES_decrypt3 sl@0: #define DES_encrypt1 des_encrypt_u4_risc2_idx sl@0: #define DES_encrypt2 des_encrypt2_u4_risc2_idx sl@0: #define DES_encrypt3 des_encrypt3_u4_risc2_idx sl@0: #define DES_decrypt3 des_decrypt3_u4_risc2_idx sl@0: #undef HEADER_DES_LOCL_H sl@0: #include "des_enc.c" sl@0: sl@0: #define DES_UNROLL sl@0: #define DES_RISC1 sl@0: #undef DES_RISC2 sl@0: #undef DES_PTR sl@0: #undef D_ENCRYPT sl@0: #undef DES_encrypt1 sl@0: #undef DES_encrypt2 sl@0: #undef DES_encrypt3 sl@0: #undef DES_decrypt3 sl@0: #define DES_encrypt1 des_encrypt_u16_risc1_idx sl@0: #define DES_encrypt2 des_encrypt2_u16_risc1_idx sl@0: #define DES_encrypt3 des_encrypt3_u16_risc1_idx sl@0: #define DES_decrypt3 des_decrypt3_u16_risc1_idx sl@0: #undef HEADER_DES_LOCL_H sl@0: #include "des_enc.c" sl@0: sl@0: #define DES_UNROLL sl@0: #undef DES_RISC1 sl@0: #define DES_RISC2 sl@0: #undef DES_PTR sl@0: #undef D_ENCRYPT sl@0: #undef DES_encrypt1 sl@0: #undef DES_encrypt2 sl@0: #undef DES_encrypt3 sl@0: #undef DES_decrypt3 sl@0: #define DES_encrypt1 des_encrypt_u16_risc2_idx sl@0: #define DES_encrypt2 des_encrypt2_u16_risc2_idx sl@0: #define DES_encrypt3 des_encrypt3_u16_risc2_idx sl@0: #define DES_decrypt3 des_decrypt3_u16_risc2_idx sl@0: #undef HEADER_DES_LOCL_H sl@0: #include "des_enc.c" sl@0: sl@0: #endif sl@0: sl@0: #ifdef PART3 sl@0: sl@0: #undef DES_UNROLL sl@0: #undef DES_RISC1 sl@0: #undef DES_RISC2 sl@0: #define DES_PTR sl@0: #undef D_ENCRYPT sl@0: #undef DES_encrypt1 sl@0: #undef DES_encrypt2 sl@0: #undef DES_encrypt3 sl@0: #undef DES_decrypt3 sl@0: #define DES_encrypt1 des_encrypt_u4_cisc_ptr sl@0: #define DES_encrypt2 des_encrypt2_u4_cisc_ptr sl@0: #define DES_encrypt3 des_encrypt3_u4_cisc_ptr sl@0: #define DES_decrypt3 des_decrypt3_u4_cisc_ptr sl@0: #undef HEADER_DES_LOCL_H sl@0: #include "des_enc.c" sl@0: sl@0: #define DES_UNROLL sl@0: #undef DES_RISC1 sl@0: #undef DES_RISC2 sl@0: #define DES_PTR sl@0: #undef D_ENCRYPT sl@0: #undef DES_encrypt1 sl@0: #undef DES_encrypt2 sl@0: #undef DES_encrypt3 sl@0: #undef DES_decrypt3 sl@0: #define DES_encrypt1 des_encrypt_u16_cisc_ptr sl@0: #define DES_encrypt2 des_encrypt2_u16_cisc_ptr sl@0: #define DES_encrypt3 des_encrypt3_u16_cisc_ptr sl@0: #define DES_decrypt3 des_decrypt3_u16_cisc_ptr sl@0: #undef HEADER_DES_LOCL_H sl@0: #include "des_enc.c" sl@0: sl@0: #undef DES_UNROLL sl@0: #define DES_RISC1 sl@0: #undef DES_RISC2 sl@0: #define DES_PTR sl@0: #undef D_ENCRYPT sl@0: #undef DES_encrypt1 sl@0: #undef DES_encrypt2 sl@0: #undef DES_encrypt3 sl@0: #undef DES_decrypt3 sl@0: #define DES_encrypt1 des_encrypt_u4_risc1_ptr sl@0: #define DES_encrypt2 des_encrypt2_u4_risc1_ptr sl@0: #define DES_encrypt3 des_encrypt3_u4_risc1_ptr sl@0: #define DES_decrypt3 des_decrypt3_u4_risc1_ptr sl@0: #undef HEADER_DES_LOCL_H sl@0: #include "des_enc.c" sl@0: sl@0: #endif sl@0: sl@0: #ifdef PART4 sl@0: sl@0: #undef DES_UNROLL sl@0: #undef DES_RISC1 sl@0: #define DES_RISC2 sl@0: #define DES_PTR sl@0: #undef D_ENCRYPT sl@0: #undef DES_encrypt1 sl@0: #undef DES_encrypt2 sl@0: #undef DES_encrypt3 sl@0: #undef DES_decrypt3 sl@0: #define DES_encrypt1 des_encrypt_u4_risc2_ptr sl@0: #define DES_encrypt2 des_encrypt2_u4_risc2_ptr sl@0: #define DES_encrypt3 des_encrypt3_u4_risc2_ptr sl@0: #define DES_decrypt3 des_decrypt3_u4_risc2_ptr sl@0: #undef HEADER_DES_LOCL_H sl@0: #include "des_enc.c" sl@0: sl@0: #define DES_UNROLL sl@0: #define DES_RISC1 sl@0: #undef DES_RISC2 sl@0: #define DES_PTR sl@0: #undef D_ENCRYPT sl@0: #undef DES_encrypt1 sl@0: #undef DES_encrypt2 sl@0: #undef DES_encrypt3 sl@0: #undef DES_decrypt3 sl@0: #define DES_encrypt1 des_encrypt_u16_risc1_ptr sl@0: #define DES_encrypt2 des_encrypt2_u16_risc1_ptr sl@0: #define DES_encrypt3 des_encrypt3_u16_risc1_ptr sl@0: #define DES_decrypt3 des_decrypt3_u16_risc1_ptr sl@0: #undef HEADER_DES_LOCL_H sl@0: #include "des_enc.c" sl@0: sl@0: #define DES_UNROLL sl@0: #undef DES_RISC1 sl@0: #define DES_RISC2 sl@0: #define DES_PTR sl@0: #undef D_ENCRYPT sl@0: #undef DES_encrypt1 sl@0: #undef DES_encrypt2 sl@0: #undef DES_encrypt3 sl@0: #undef DES_decrypt3 sl@0: #define DES_encrypt1 des_encrypt_u16_risc2_ptr sl@0: #define DES_encrypt2 des_encrypt2_u16_risc2_ptr sl@0: #define DES_encrypt3 des_encrypt3_u16_risc2_ptr sl@0: #define DES_decrypt3 des_decrypt3_u16_risc2_ptr sl@0: #undef HEADER_DES_LOCL_H sl@0: #include "des_enc.c" sl@0: sl@0: #endif sl@0: sl@0: /* The following if from times(3) man page. It may need to be changed */ sl@0: #ifndef HZ sl@0: # ifndef CLK_TCK sl@0: # ifndef _BSD_CLK_TCK_ /* FreeBSD fix */ sl@0: # define HZ 100.0 sl@0: # else /* _BSD_CLK_TCK_ */ sl@0: # define HZ ((double)_BSD_CLK_TCK_) sl@0: # endif sl@0: # else /* CLK_TCK */ sl@0: # define HZ ((double)CLK_TCK) sl@0: # endif sl@0: #endif sl@0: sl@0: #define BUFSIZE ((long)1024) sl@0: long run=0; sl@0: sl@0: double Time_F(int s); sl@0: #ifdef SIGALRM sl@0: #if defined(__STDC__) || defined(sgi) sl@0: #define SIGRETTYPE void sl@0: #else sl@0: #define SIGRETTYPE int sl@0: #endif sl@0: sl@0: SIGRETTYPE sig_done(int sig); sl@0: SIGRETTYPE sig_done(int sig) sl@0: { sl@0: signal(SIGALRM,sig_done); sl@0: run=0; sl@0: #ifdef LINT sl@0: sig=sig; sl@0: #endif sl@0: } sl@0: #endif sl@0: sl@0: #define START 0 sl@0: #define STOP 1 sl@0: sl@0: double Time_F(int s) sl@0: { sl@0: double ret; sl@0: #ifdef TIMES sl@0: static struct tms tstart,tend; sl@0: sl@0: if (s == START) sl@0: { sl@0: times(&tstart); sl@0: return(0); sl@0: } sl@0: else sl@0: { sl@0: times(&tend); sl@0: ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; sl@0: return((ret == 0.0)?1e-6:ret); sl@0: } sl@0: #else /* !times() */ sl@0: static struct timeb tstart,tend; sl@0: long i; sl@0: sl@0: if (s == START) sl@0: { sl@0: ftime(&tstart); sl@0: return(0); sl@0: } sl@0: else sl@0: { sl@0: ftime(&tend); sl@0: i=(long)tend.millitm-(long)tstart.millitm; sl@0: ret=((double)(tend.time-tstart.time))+((double)i)/1000.0; sl@0: return((ret == 0.0)?1e-6:ret); sl@0: } sl@0: #endif sl@0: } sl@0: sl@0: #ifdef SIGALRM sl@0: #define print_name(name) fprintf(stderr,"Doing %s's for 10 seconds\n",name); alarm(10); sl@0: #else sl@0: #define print_name(name) fprintf(stderr,"Doing %s %ld times\n",name,cb); sl@0: #endif sl@0: sl@0: #define time_it(func,name,index) \ sl@0: print_name(name); \ sl@0: Time_F(START); \ sl@0: for (count=0,run=1; COND(cb); count++) \ sl@0: { \ sl@0: unsigned long d[2]; \ sl@0: func(d,&sch,DES_ENCRYPT); \ sl@0: } \ sl@0: tm[index]=Time_F(STOP); \ sl@0: fprintf(stderr,"%ld %s's in %.2f second\n",count,name,tm[index]); \ sl@0: tm[index]=((double)COUNT(cb))/tm[index]; sl@0: sl@0: #define print_it(name,index) \ sl@0: fprintf(stderr,"%s bytes per sec = %12.2f (%5.1fuS)\n",name, \ sl@0: tm[index]*8,1.0e6/tm[index]); sl@0: sl@0: int main(int argc, char **argv) sl@0: { sl@0: long count; sl@0: static unsigned char buf[BUFSIZE]; sl@0: static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; sl@0: static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12}; sl@0: static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34}; sl@0: DES_key_schedule sch,sch2,sch3; sl@0: double d,tm[16],max=0; sl@0: int rank[16]; sl@0: char *str[16]; sl@0: int max_idx=0,i,num=0,j; sl@0: #ifndef SIGALARM sl@0: long ca,cb,cc,cd,ce; sl@0: #endif sl@0: sl@0: for (i=0; i<12; i++) sl@0: { sl@0: tm[i]=0.0; sl@0: rank[i]=0; sl@0: } sl@0: sl@0: #ifndef TIMES sl@0: fprintf(stderr,"To get the most accurate results, try to run this\n"); sl@0: fprintf(stderr,"program when this computer is idle.\n"); sl@0: #endif sl@0: sl@0: DES_set_key_unchecked(&key,&sch); sl@0: DES_set_key_unchecked(&key2,&sch2); sl@0: DES_set_key_unchecked(&key3,&sch3); sl@0: sl@0: #ifndef SIGALRM sl@0: fprintf(stderr,"First we calculate the approximate speed ...\n"); sl@0: DES_set_key_unchecked(&key,sch); sl@0: count=10; sl@0: do { sl@0: long i; sl@0: unsigned long data[2]; sl@0: sl@0: count*=2; sl@0: Time_F(START); sl@0: for (i=count; i; i--) sl@0: DES_encrypt1(data,&(sch[0]),DES_ENCRYPT); sl@0: d=Time_F(STOP); sl@0: } while (d < 3.0); sl@0: ca=count; sl@0: cb=count*3; sl@0: cc=count*3*8/BUFSIZE+1; sl@0: cd=count*8/BUFSIZE+1; sl@0: sl@0: ce=count/20+1; sl@0: #define COND(d) (count != (d)) sl@0: #define COUNT(d) (d) sl@0: #else sl@0: #define COND(c) (run) sl@0: #define COUNT(d) (count) sl@0: signal(SIGALRM,sig_done); sl@0: alarm(10); sl@0: #endif sl@0: sl@0: #ifdef PART1 sl@0: time_it(des_encrypt_u4_cisc_idx, "des_encrypt_u4_cisc_idx ", 0); sl@0: time_it(des_encrypt_u16_cisc_idx, "des_encrypt_u16_cisc_idx ", 1); sl@0: time_it(des_encrypt_u4_risc1_idx, "des_encrypt_u4_risc1_idx ", 2); sl@0: num+=3; sl@0: #endif sl@0: #ifdef PART2 sl@0: time_it(des_encrypt_u16_risc1_idx,"des_encrypt_u16_risc1_idx", 3); sl@0: time_it(des_encrypt_u4_risc2_idx, "des_encrypt_u4_risc2_idx ", 4); sl@0: time_it(des_encrypt_u16_risc2_idx,"des_encrypt_u16_risc2_idx", 5); sl@0: num+=3; sl@0: #endif sl@0: #ifdef PART3 sl@0: time_it(des_encrypt_u4_cisc_ptr, "des_encrypt_u4_cisc_ptr ", 6); sl@0: time_it(des_encrypt_u16_cisc_ptr, "des_encrypt_u16_cisc_ptr ", 7); sl@0: time_it(des_encrypt_u4_risc1_ptr, "des_encrypt_u4_risc1_ptr ", 8); sl@0: num+=3; sl@0: #endif sl@0: #ifdef PART4 sl@0: time_it(des_encrypt_u16_risc1_ptr,"des_encrypt_u16_risc1_ptr", 9); sl@0: time_it(des_encrypt_u4_risc2_ptr, "des_encrypt_u4_risc2_ptr ",10); sl@0: time_it(des_encrypt_u16_risc2_ptr,"des_encrypt_u16_risc2_ptr",11); sl@0: num+=3; sl@0: #endif sl@0: sl@0: #ifdef PART1 sl@0: str[0]=" 4 c i"; sl@0: print_it("des_encrypt_u4_cisc_idx ",0); sl@0: max=tm[0]; sl@0: max_idx=0; sl@0: str[1]="16 c i"; sl@0: print_it("des_encrypt_u16_cisc_idx ",1); sl@0: if (max < tm[1]) { max=tm[1]; max_idx=1; } sl@0: str[2]=" 4 r1 i"; sl@0: print_it("des_encrypt_u4_risc1_idx ",2); sl@0: if (max < tm[2]) { max=tm[2]; max_idx=2; } sl@0: #endif sl@0: #ifdef PART2 sl@0: str[3]="16 r1 i"; sl@0: print_it("des_encrypt_u16_risc1_idx",3); sl@0: if (max < tm[3]) { max=tm[3]; max_idx=3; } sl@0: str[4]=" 4 r2 i"; sl@0: print_it("des_encrypt_u4_risc2_idx ",4); sl@0: if (max < tm[4]) { max=tm[4]; max_idx=4; } sl@0: str[5]="16 r2 i"; sl@0: print_it("des_encrypt_u16_risc2_idx",5); sl@0: if (max < tm[5]) { max=tm[5]; max_idx=5; } sl@0: #endif sl@0: #ifdef PART3 sl@0: str[6]=" 4 c p"; sl@0: print_it("des_encrypt_u4_cisc_ptr ",6); sl@0: if (max < tm[6]) { max=tm[6]; max_idx=6; } sl@0: str[7]="16 c p"; sl@0: print_it("des_encrypt_u16_cisc_ptr ",7); sl@0: if (max < tm[7]) { max=tm[7]; max_idx=7; } sl@0: str[8]=" 4 r1 p"; sl@0: print_it("des_encrypt_u4_risc1_ptr ",8); sl@0: if (max < tm[8]) { max=tm[8]; max_idx=8; } sl@0: #endif sl@0: #ifdef PART4 sl@0: str[9]="16 r1 p"; sl@0: print_it("des_encrypt_u16_risc1_ptr",9); sl@0: if (max < tm[9]) { max=tm[9]; max_idx=9; } sl@0: str[10]=" 4 r2 p"; sl@0: print_it("des_encrypt_u4_risc2_ptr ",10); sl@0: if (max < tm[10]) { max=tm[10]; max_idx=10; } sl@0: str[11]="16 r2 p"; sl@0: print_it("des_encrypt_u16_risc2_ptr",11); sl@0: if (max < tm[11]) { max=tm[11]; max_idx=11; } sl@0: #endif sl@0: printf("options des ecb/s\n"); sl@0: printf("%s %12.2f 100.0%%\n",str[max_idx],tm[max_idx]); sl@0: d=tm[max_idx]; sl@0: tm[max_idx]= -2.0; sl@0: max= -1.0; sl@0: for (;;) sl@0: { sl@0: for (i=0; i<12; i++) sl@0: { sl@0: if (max < tm[i]) { max=tm[i]; j=i; } sl@0: } sl@0: if (max < 0.0) break; sl@0: printf("%s %12.2f %4.1f%%\n",str[j],tm[j],tm[j]/d*100.0); sl@0: tm[j]= -2.0; sl@0: max= -1.0; sl@0: } sl@0: sl@0: switch (max_idx) sl@0: { sl@0: case 0: sl@0: printf("-DDES_DEFAULT_OPTIONS\n"); sl@0: break; sl@0: case 1: sl@0: printf("-DDES_UNROLL\n"); sl@0: break; sl@0: case 2: sl@0: printf("-DDES_RISC1\n"); sl@0: break; sl@0: case 3: sl@0: printf("-DDES_UNROLL -DDES_RISC1\n"); sl@0: break; sl@0: case 4: sl@0: printf("-DDES_RISC2\n"); sl@0: break; sl@0: case 5: sl@0: printf("-DDES_UNROLL -DDES_RISC2\n"); sl@0: break; sl@0: case 6: sl@0: printf("-DDES_PTR\n"); sl@0: break; sl@0: case 7: sl@0: printf("-DDES_UNROLL -DDES_PTR\n"); sl@0: break; sl@0: case 8: sl@0: printf("-DDES_RISC1 -DDES_PTR\n"); sl@0: break; sl@0: case 9: sl@0: printf("-DDES_UNROLL -DDES_RISC1 -DDES_PTR\n"); sl@0: break; sl@0: case 10: sl@0: printf("-DDES_RISC2 -DDES_PTR\n"); sl@0: break; sl@0: case 11: sl@0: printf("-DDES_UNROLL -DDES_RISC2 -DDES_PTR\n"); sl@0: break; sl@0: } sl@0: exit(0); sl@0: #if defined(LINT) || defined(OPENSSL_SYS_MSDOS) sl@0: return(0); sl@0: #endif sl@0: }