diff options
author | djm <> | 2010-10-01 22:59:01 +0000 |
---|---|---|
committer | djm <> | 2010-10-01 22:59:01 +0000 |
commit | fe047d8b632246cb2db3234a0a4f32e5c318857b (patch) | |
tree | 939b752540947d33507b3acc48d76a8bfb7c3dc3 /src/lib/libcrypto/sha/sha1s.cpp | |
parent | 2ea67f4aa254b09ded62e6e14fc893bbe6381579 (diff) | |
download | openbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.tar.gz openbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.tar.bz2 openbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.zip |
resolve conflicts, fix local changes
Diffstat (limited to 'src/lib/libcrypto/sha/sha1s.cpp')
-rw-r--r-- | src/lib/libcrypto/sha/sha1s.cpp | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/src/lib/libcrypto/sha/sha1s.cpp b/src/lib/libcrypto/sha/sha1s.cpp deleted file mode 100644 index af23d1e0f2..0000000000 --- a/src/lib/libcrypto/sha/sha1s.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/sha.h> | ||
36 | |||
37 | #define sha1_block_x86 sha1_block_asm_data_order | ||
38 | extern "C" { | ||
39 | void sha1_block_x86(SHA_CTX *ctx, unsigned char *buffer,int num); | ||
40 | } | ||
41 | |||
42 | void main(int argc,char *argv[]) | ||
43 | { | ||
44 | unsigned char buffer[64*256]; | ||
45 | SHA_CTX ctx; | ||
46 | unsigned long s1,s2,e1,e2; | ||
47 | unsigned char k[16]; | ||
48 | unsigned long data[2]; | ||
49 | unsigned char iv[8]; | ||
50 | int i,num=0,numm; | ||
51 | int j=0; | ||
52 | |||
53 | if (argc >= 2) | ||
54 | num=atoi(argv[1]); | ||
55 | |||
56 | if (num == 0) num=16; | ||
57 | if (num > 250) num=16; | ||
58 | numm=num+2; | ||
59 | #if 0 | ||
60 | num*=64; | ||
61 | numm*=64; | ||
62 | #endif | ||
63 | |||
64 | for (j=0; j<6; j++) | ||
65 | { | ||
66 | for (i=0; i<10; i++) /**/ | ||
67 | { | ||
68 | sha1_block_x86(&ctx,buffer,numm); | ||
69 | GetTSC(s1); | ||
70 | sha1_block_x86(&ctx,buffer,numm); | ||
71 | GetTSC(e1); | ||
72 | GetTSC(s2); | ||
73 | sha1_block_x86(&ctx,buffer,num); | ||
74 | GetTSC(e2); | ||
75 | sha1_block_x86(&ctx,buffer,num); | ||
76 | } | ||
77 | |||
78 | printf("sha1 (%d bytes) %d %d (%.2f)\n",num*64, | ||
79 | e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2); | ||
80 | } | ||
81 | } | ||
82 | |||