diff options
| author | jsg <> | 2014-04-15 12:27:34 +0000 | 
|---|---|---|
| committer | jsg <> | 2014-04-15 12:27:34 +0000 | 
| commit | 36cdbdfdef277e9387c3a72c08b3f2b556c447c9 (patch) | |
| tree | 7b46d36ee15bc455e72fbd721910267d9c52fcdc /src/lib/libc | |
| parent | 77afecbffa1e8f369da9f08671b443afd1dba1a4 (diff) | |
| download | openbsd-36cdbdfdef277e9387c3a72c08b3f2b556c447c9.tar.gz openbsd-36cdbdfdef277e9387c3a72c08b3f2b556c447c9.tar.bz2 openbsd-36cdbdfdef277e9387c3a72c08b3f2b556c447c9.zip | |
remove pentium specific benchmark code
ok miod@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/bf/bfs.cpp | 67 | ||||
| -rw-r--r-- | src/lib/libcrypto/cast/casts.cpp | 70 | ||||
| -rw-r--r-- | src/lib/libcrypto/des/des3s.cpp | 67 | ||||
| -rw-r--r-- | src/lib/libcrypto/des/dess.cpp | 67 | ||||
| -rw-r--r-- | src/lib/libcrypto/md4/md4s.cpp | 78 | ||||
| -rw-r--r-- | src/lib/libcrypto/md5/md5s.cpp | 78 | ||||
| -rw-r--r-- | src/lib/libcrypto/rc4/rc4s.cpp | 73 | ||||
| -rw-r--r-- | src/lib/libcrypto/rc5/rc5s.cpp | 70 | ||||
| -rw-r--r-- | src/lib/libcrypto/ripemd/asm/rips.cpp | 82 | 
9 files changed, 0 insertions, 652 deletions
| diff --git a/src/lib/libcrypto/bf/bfs.cpp b/src/lib/libcrypto/bf/bfs.cpp deleted file mode 100644 index d74c457760..0000000000 --- a/src/lib/libcrypto/bf/bfs.cpp +++ /dev/null | |||
| @@ -1,67 +0,0 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/blowfish.h> | ||
| 36 | |||
| 37 | void main(int argc,char *argv[]) | ||
| 38 | { | ||
| 39 | BF_KEY key; | ||
| 40 | unsigned long s1,s2,e1,e2; | ||
| 41 | unsigned long data[2]; | ||
| 42 | int i,j; | ||
| 43 | |||
| 44 | for (j=0; j<6; j++) | ||
| 45 | { | ||
| 46 | for (i=0; i<1000; i++) /**/ | ||
| 47 | { | ||
| 48 | BF_encrypt(&data[0],&key); | ||
| 49 | GetTSC(s1); | ||
| 50 | BF_encrypt(&data[0],&key); | ||
| 51 | BF_encrypt(&data[0],&key); | ||
| 52 | BF_encrypt(&data[0],&key); | ||
| 53 | GetTSC(e1); | ||
| 54 | GetTSC(s2); | ||
| 55 | BF_encrypt(&data[0],&key); | ||
| 56 | BF_encrypt(&data[0],&key); | ||
| 57 | BF_encrypt(&data[0],&key); | ||
| 58 | BF_encrypt(&data[0],&key); | ||
| 59 | GetTSC(e2); | ||
| 60 | BF_encrypt(&data[0],&key); | ||
| 61 | } | ||
| 62 | |||
| 63 | printf("blowfish %d %d (%d)\n", | ||
| 64 | e1-s1,e2-s2,((e2-s2)-(e1-s1))); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
| diff --git a/src/lib/libcrypto/cast/casts.cpp b/src/lib/libcrypto/cast/casts.cpp deleted file mode 100644 index 8d7bd468d2..0000000000 --- a/src/lib/libcrypto/cast/casts.cpp +++ /dev/null | |||
| @@ -1,70 +0,0 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/cast.h> | ||
| 36 | |||
| 37 | void main(int argc,char *argv[]) | ||
| 38 | { | ||
| 39 | CAST_KEY key; | ||
| 40 | unsigned long s1,s2,e1,e2; | ||
| 41 | unsigned long data[2]; | ||
| 42 | int i,j; | ||
| 43 | static unsigned char d[16]={0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}; | ||
| 44 | |||
| 45 | CAST_set_key(&key, 16,d); | ||
| 46 | |||
| 47 | for (j=0; j<6; j++) | ||
| 48 | { | ||
| 49 | for (i=0; i<1000; i++) /**/ | ||
| 50 | { | ||
| 51 | CAST_encrypt(&data[0],&key); | ||
| 52 | GetTSC(s1); | ||
| 53 | CAST_encrypt(&data[0],&key); | ||
| 54 | CAST_encrypt(&data[0],&key); | ||
| 55 | CAST_encrypt(&data[0],&key); | ||
| 56 | GetTSC(e1); | ||
| 57 | GetTSC(s2); | ||
| 58 | CAST_encrypt(&data[0],&key); | ||
| 59 | CAST_encrypt(&data[0],&key); | ||
| 60 | CAST_encrypt(&data[0],&key); | ||
| 61 | CAST_encrypt(&data[0],&key); | ||
| 62 | GetTSC(e2); | ||
| 63 | CAST_encrypt(&data[0],&key); | ||
| 64 | } | ||
| 65 | |||
| 66 | printf("cast %d %d (%d)\n", | ||
| 67 | e1-s1,e2-s2,((e2-s2)-(e1-s1))); | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| diff --git a/src/lib/libcrypto/des/des3s.cpp b/src/lib/libcrypto/des/des3s.cpp deleted file mode 100644 index 02d527c057..0000000000 --- a/src/lib/libcrypto/des/des3s.cpp +++ /dev/null | |||
| @@ -1,67 +0,0 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/des.h> | ||
| 36 | |||
| 37 | void main(int argc,char *argv[]) | ||
| 38 | { | ||
| 39 | des_key_schedule key1,key2,key3; | ||
| 40 | unsigned long s1,s2,e1,e2; | ||
| 41 | unsigned long data[2]; | ||
| 42 | int i,j; | ||
| 43 | |||
| 44 | for (j=0; j<6; j++) | ||
| 45 | { | ||
| 46 | for (i=0; i<1000; i++) /**/ | ||
| 47 | { | ||
| 48 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 49 | GetTSC(s1); | ||
| 50 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 51 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 52 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 53 | GetTSC(e1); | ||
| 54 | GetTSC(s2); | ||
| 55 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 56 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 57 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 58 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 59 | GetTSC(e2); | ||
| 60 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 61 | } | ||
| 62 | |||
| 63 | printf("des %d %d (%d)\n", | ||
| 64 | e1-s1,e2-s2,((e2-s2)-(e1-s1))); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
| diff --git a/src/lib/libcrypto/des/dess.cpp b/src/lib/libcrypto/des/dess.cpp deleted file mode 100644 index 5549bab90a..0000000000 --- a/src/lib/libcrypto/des/dess.cpp +++ /dev/null | |||
| @@ -1,67 +0,0 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/des.h> | ||
| 36 | |||
| 37 | void main(int argc,char *argv[]) | ||
| 38 | { | ||
| 39 | des_key_schedule key; | ||
| 40 | unsigned long s1,s2,e1,e2; | ||
| 41 | unsigned long data[2]; | ||
| 42 | int i,j; | ||
| 43 | |||
| 44 | for (j=0; j<6; j++) | ||
| 45 | { | ||
| 46 | for (i=0; i<1000; i++) /**/ | ||
| 47 | { | ||
| 48 | des_encrypt1(&data[0],key,1); | ||
| 49 | GetTSC(s1); | ||
| 50 | des_encrypt1(&data[0],key,1); | ||
| 51 | des_encrypt1(&data[0],key,1); | ||
| 52 | des_encrypt1(&data[0],key,1); | ||
| 53 | GetTSC(e1); | ||
| 54 | GetTSC(s2); | ||
| 55 | des_encrypt1(&data[0],key,1); | ||
| 56 | des_encrypt1(&data[0],key,1); | ||
| 57 | des_encrypt1(&data[0],key,1); | ||
| 58 | des_encrypt1(&data[0],key,1); | ||
| 59 | GetTSC(e2); | ||
| 60 | des_encrypt1(&data[0],key,1); | ||
| 61 | } | ||
| 62 | |||
| 63 | printf("des %d %d (%d)\n", | ||
| 64 | e1-s1,e2-s2,((e2-s2)-(e1-s1))); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
| diff --git a/src/lib/libcrypto/md4/md4s.cpp b/src/lib/libcrypto/md4/md4s.cpp deleted file mode 100644 index c0ec97fc9f..0000000000 --- a/src/lib/libcrypto/md4/md4s.cpp +++ /dev/null | |||
| @@ -1,78 +0,0 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/md4.h> | ||
| 36 | |||
| 37 | extern "C" { | ||
| 38 | void md4_block_x86(MD4_CTX *ctx, unsigned char *buffer,int num); | ||
| 39 | } | ||
| 40 | |||
| 41 | void main(int argc,char *argv[]) | ||
| 42 | { | ||
| 43 | unsigned char buffer[64*256]; | ||
| 44 | MD4_CTX ctx; | ||
| 45 | unsigned long s1,s2,e1,e2; | ||
| 46 | unsigned char k[16]; | ||
| 47 | unsigned long data[2]; | ||
| 48 | unsigned char iv[8]; | ||
| 49 | int i,num=0,numm; | ||
| 50 | int j=0; | ||
| 51 | |||
| 52 | if (argc >= 2) | ||
| 53 | num=atoi(argv[1]); | ||
| 54 | |||
| 55 | if (num == 0) num=16; | ||
| 56 | if (num > 250) num=16; | ||
| 57 | numm=num+2; | ||
| 58 | num*=64; | ||
| 59 | numm*=64; | ||
| 60 | |||
| 61 | for (j=0; j<6; j++) | ||
| 62 | { | ||
| 63 | for (i=0; i<10; i++) /**/ | ||
| 64 | { | ||
| 65 | md4_block_x86(&ctx,buffer,numm); | ||
| 66 | GetTSC(s1); | ||
| 67 | md4_block_x86(&ctx,buffer,numm); | ||
| 68 | GetTSC(e1); | ||
| 69 | GetTSC(s2); | ||
| 70 | md4_block_x86(&ctx,buffer,num); | ||
| 71 | GetTSC(e2); | ||
| 72 | md4_block_x86(&ctx,buffer,num); | ||
| 73 | } | ||
| 74 | printf("md4 (%d bytes) %d %d (%.2f)\n",num, | ||
| 75 | e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2); | ||
| 76 | } | ||
| 77 | } | ||
| 78 | |||
| diff --git a/src/lib/libcrypto/md5/md5s.cpp b/src/lib/libcrypto/md5/md5s.cpp deleted file mode 100644 index dd343fd4e6..0000000000 --- a/src/lib/libcrypto/md5/md5s.cpp +++ /dev/null | |||
| @@ -1,78 +0,0 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/md5.h> | ||
| 36 | |||
| 37 | extern "C" { | ||
| 38 | void md5_block_x86(MD5_CTX *ctx, unsigned char *buffer,int num); | ||
| 39 | } | ||
| 40 | |||
| 41 | void main(int argc,char *argv[]) | ||
| 42 | { | ||
| 43 | unsigned char buffer[64*256]; | ||
| 44 | MD5_CTX ctx; | ||
| 45 | unsigned long s1,s2,e1,e2; | ||
| 46 | unsigned char k[16]; | ||
| 47 | unsigned long data[2]; | ||
| 48 | unsigned char iv[8]; | ||
| 49 | int i,num=0,numm; | ||
| 50 | int j=0; | ||
| 51 | |||
| 52 | if (argc >= 2) | ||
| 53 | num=atoi(argv[1]); | ||
| 54 | |||
| 55 | if (num == 0) num=16; | ||
| 56 | if (num > 250) num=16; | ||
| 57 | numm=num+2; | ||
| 58 | num*=64; | ||
| 59 | numm*=64; | ||
| 60 | |||
| 61 | for (j=0; j<6; j++) | ||
| 62 | { | ||
| 63 | for (i=0; i<10; i++) /**/ | ||
| 64 | { | ||
| 65 | md5_block_x86(&ctx,buffer,numm); | ||
| 66 | GetTSC(s1); | ||
| 67 | md5_block_x86(&ctx,buffer,numm); | ||
| 68 | GetTSC(e1); | ||
| 69 | GetTSC(s2); | ||
| 70 | md5_block_x86(&ctx,buffer,num); | ||
| 71 | GetTSC(e2); | ||
| 72 | md5_block_x86(&ctx,buffer,num); | ||
| 73 | } | ||
| 74 | printf("md5 (%d bytes) %d %d (%.2f)\n",num, | ||
| 75 | e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2); | ||
| 76 | } | ||
| 77 | } | ||
| 78 | |||
| diff --git a/src/lib/libcrypto/rc4/rc4s.cpp b/src/lib/libcrypto/rc4/rc4s.cpp deleted file mode 100644 index 3814fde997..0000000000 --- a/src/lib/libcrypto/rc4/rc4s.cpp +++ /dev/null | |||
| @@ -1,73 +0,0 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/rc4.h> | ||
| 36 | |||
| 37 | void main(int argc,char *argv[]) | ||
| 38 | { | ||
| 39 | unsigned char buffer[1024]; | ||
| 40 | RC4_KEY ctx; | ||
| 41 | unsigned long s1,s2,e1,e2; | ||
| 42 | unsigned char k[16]; | ||
| 43 | unsigned long data[2]; | ||
| 44 | unsigned char iv[8]; | ||
| 45 | int i,num=64,numm; | ||
| 46 | int j=0; | ||
| 47 | |||
| 48 | if (argc >= 2) | ||
| 49 | num=atoi(argv[1]); | ||
| 50 | |||
| 51 | if (num == 0) num=256; | ||
| 52 | if (num > 1024-16) num=1024-16; | ||
| 53 | numm=num+8; | ||
| 54 | |||
| 55 | for (j=0; j<6; j++) | ||
| 56 | { | ||
| 57 | for (i=0; i<10; i++) /**/ | ||
| 58 | { | ||
| 59 | RC4(&ctx,numm,buffer,buffer); | ||
| 60 | GetTSC(s1); | ||
| 61 | RC4(&ctx,numm,buffer,buffer); | ||
| 62 | GetTSC(e1); | ||
| 63 | GetTSC(s2); | ||
| 64 | RC4(&ctx,num,buffer,buffer); | ||
| 65 | GetTSC(e2); | ||
| 66 | RC4(&ctx,num,buffer,buffer); | ||
| 67 | } | ||
| 68 | |||
| 69 | printf("RC4 (%d bytes) %d %d (%d) - 8 bytes\n",num, | ||
| 70 | e1-s1,e2-s2,(e1-s1)-(e2-s2)); | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| diff --git a/src/lib/libcrypto/rc5/rc5s.cpp b/src/lib/libcrypto/rc5/rc5s.cpp deleted file mode 100644 index 1c5518bc80..0000000000 --- a/src/lib/libcrypto/rc5/rc5s.cpp +++ /dev/null | |||
| @@ -1,70 +0,0 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/rc5.h> | ||
| 36 | |||
| 37 | void main(int argc,char *argv[]) | ||
| 38 | { | ||
| 39 | RC5_32_KEY key; | ||
| 40 | unsigned long s1,s2,e1,e2; | ||
| 41 | unsigned long data[2]; | ||
| 42 | int i,j; | ||
| 43 | static unsigned char d[16]={0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}; | ||
| 44 | |||
| 45 | RC5_32_set_key(&key, 16,d,12); | ||
| 46 | |||
| 47 | for (j=0; j<6; j++) | ||
| 48 | { | ||
| 49 | for (i=0; i<1000; i++) /**/ | ||
| 50 | { | ||
| 51 | RC5_32_encrypt(&data[0],&key); | ||
| 52 | GetTSC(s1); | ||
| 53 | RC5_32_encrypt(&data[0],&key); | ||
| 54 | RC5_32_encrypt(&data[0],&key); | ||
| 55 | RC5_32_encrypt(&data[0],&key); | ||
| 56 | GetTSC(e1); | ||
| 57 | GetTSC(s2); | ||
| 58 | RC5_32_encrypt(&data[0],&key); | ||
| 59 | RC5_32_encrypt(&data[0],&key); | ||
| 60 | RC5_32_encrypt(&data[0],&key); | ||
| 61 | RC5_32_encrypt(&data[0],&key); | ||
| 62 | GetTSC(e2); | ||
| 63 | RC5_32_encrypt(&data[0],&key); | ||
| 64 | } | ||
| 65 | |||
| 66 | printf("cast %d %d (%d)\n", | ||
| 67 | e1-s1,e2-s2,((e2-s2)-(e1-s1))); | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| diff --git a/src/lib/libcrypto/ripemd/asm/rips.cpp b/src/lib/libcrypto/ripemd/asm/rips.cpp deleted file mode 100644 index f7a13677a9..0000000000 --- a/src/lib/libcrypto/ripemd/asm/rips.cpp +++ /dev/null | |||
| @@ -1,82 +0,0 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/ripemd.h> | ||
| 36 | |||
| 37 | #define ripemd160_block_x86 ripemd160_block_asm_host_order | ||
| 38 | |||
| 39 | extern "C" { | ||
| 40 | void ripemd160_block_x86(RIPEMD160_CTX *ctx, unsigned char *buffer,int num); | ||
| 41 | } | ||
| 42 | |||
| 43 | void main(int argc,char *argv[]) | ||
| 44 | { | ||
| 45 | unsigned char buffer[64*256]; | ||
| 46 | RIPEMD160_CTX ctx; | ||
| 47 | unsigned long s1,s2,e1,e2; | ||
| 48 | unsigned char k[16]; | ||
| 49 | unsigned long data[2]; | ||
| 50 | unsigned char iv[8]; | ||
| 51 | int i,num=0,numm; | ||
| 52 | int j=0; | ||
| 53 | |||
| 54 | if (argc >= 2) | ||
| 55 | num=atoi(argv[1]); | ||
| 56 | |||
| 57 | if (num == 0) num=16; | ||
| 58 | if (num > 250) num=16; | ||
| 59 | numm=num+2; | ||
| 60 | #if 0 | ||
| 61 | num*=64; | ||
| 62 | numm*=64; | ||
| 63 | #endif | ||
| 64 | |||
| 65 | for (j=0; j<6; j++) | ||
| 66 | { | ||
| 67 | for (i=0; i<10; i++) /**/ | ||
| 68 | { | ||
| 69 | ripemd160_block_x86(&ctx,buffer,numm); | ||
| 70 | GetTSC(s1); | ||
| 71 | ripemd160_block_x86(&ctx,buffer,numm); | ||
| 72 | GetTSC(e1); | ||
| 73 | GetTSC(s2); | ||
| 74 | ripemd160_block_x86(&ctx,buffer,num); | ||
| 75 | GetTSC(e2); | ||
| 76 | ripemd160_block_x86(&ctx,buffer,num); | ||
| 77 | } | ||
| 78 | printf("ripemd160 (%d bytes) %d %d (%.2f)\n",num*64, | ||
| 79 | e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2); | ||
| 80 | } | ||
| 81 | } | ||
| 82 | |||
