Fossil SCM

If Openssl is available, use its ssh1 implementation. Suggested by Baruch Burstein.

jan.nijtmans 2014-04-30 07:43 trunk
Commit 379309b6da2b73fddf4bb82204b935375a6d883f
1 file changed +10
+10
--- src/sha1.c
+++ src/sha1.c
@@ -3,10 +3,19 @@
33
*/
44
#include "config.h"
55
#include <sys/types.h>
66
#include "sha1.h"
77
8
+#ifdef FOSSIL_ENABLE_SSL
9
+
10
+# include <openssl/sha.h>
11
+# define SHA1Context SHA_CTX
12
+# define SHA1Init SHA1_Init
13
+# define SHA1Update SHA1_Update
14
+# define SHA1Final(a,b) SHA1_Final(b,a)
15
+
16
+#else
817
918
/*
1019
** The SHA1 implementation below is adapted from:
1120
**
1221
** $NetBSD: sha1.c,v 1.6 2009/11/06 20:31:18 joerg Exp $
@@ -198,10 +207,11 @@
198207
for (i = 0; i < 20; i++)
199208
digest[i] = (unsigned char)
200209
((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
201210
}
202211
}
212
+#endif
203213
204214
205215
/*
206216
** Convert a digest into base-16. digest should be declared as
207217
** "unsigned char digest[20]" in the calling function. The SHA1
208218
--- src/sha1.c
+++ src/sha1.c
@@ -3,10 +3,19 @@
3 */
4 #include "config.h"
5 #include <sys/types.h>
6 #include "sha1.h"
7
 
 
 
 
 
 
 
 
 
8
9 /*
10 ** The SHA1 implementation below is adapted from:
11 **
12 ** $NetBSD: sha1.c,v 1.6 2009/11/06 20:31:18 joerg Exp $
@@ -198,10 +207,11 @@
198 for (i = 0; i < 20; i++)
199 digest[i] = (unsigned char)
200 ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
201 }
202 }
 
203
204
205 /*
206 ** Convert a digest into base-16. digest should be declared as
207 ** "unsigned char digest[20]" in the calling function. The SHA1
208
--- src/sha1.c
+++ src/sha1.c
@@ -3,10 +3,19 @@
3 */
4 #include "config.h"
5 #include <sys/types.h>
6 #include "sha1.h"
7
8 #ifdef FOSSIL_ENABLE_SSL
9
10 # include <openssl/sha.h>
11 # define SHA1Context SHA_CTX
12 # define SHA1Init SHA1_Init
13 # define SHA1Update SHA1_Update
14 # define SHA1Final(a,b) SHA1_Final(b,a)
15
16 #else
17
18 /*
19 ** The SHA1 implementation below is adapted from:
20 **
21 ** $NetBSD: sha1.c,v 1.6 2009/11/06 20:31:18 joerg Exp $
@@ -198,10 +207,11 @@
207 for (i = 0; i < 20; i++)
208 digest[i] = (unsigned char)
209 ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
210 }
211 }
212 #endif
213
214
215 /*
216 ** Convert a digest into base-16. digest should be declared as
217 ** "unsigned char digest[20]" in the calling function. The SHA1
218

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button