]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sha1.h
The use of <net/ppp_defs.h> isn't guranteed to exist on Linux (e.g. uclibc, buildroot...
[ppp.git] / pppd / sha1.h
index 86f982d13cd3ed544db664227b0ccf919a725589..2325133251177e098a1bd2ad95ac125d42d87ba4 100644 (file)
@@ -1,25 +1,17 @@
 /* sha1.h */
 
-/* If OpenSSL is in use, then use that version of SHA-1 */
-#ifdef OPENSSL
-#include <t_sha.h>
-#define __SHA1_INCLUDE_
-#endif
+#ifndef PPP_SHA1_H
+#define PPP_SHA1_H
 
-#ifndef __SHA1_INCLUDE_
+#include "pppdconf.h"
 
-typedef struct {
-    unsigned long state[5];
-    unsigned long count[2];
-    unsigned char buffer[64];
-} SHA1_CTX;
+#ifndef USE_SHA
+#include <openssl/sha.h>
 
-extern void SHA1_Init(SHA1_CTX *);
-extern void SHA1_Update(SHA1_CTX *, const unsigned char *, unsigned int);
-extern void SHA1_Final(unsigned char[SHA1_SIGNATURE_SIZE], SHA1_CTX *);
+#define SHA1_CTX SHA_CTX
+#define SHA1_SIGNATURE_SIZE SHA_DIGEST_LENGTH
 
-#define __SHA1_INCLUDE_
-#endif /* __SHA1_INCLUDE_ */
+#else
 
 #ifndef SHA1_SIGNATURE_SIZE
 #ifdef SHA_DIGESTSIZE
@@ -28,3 +20,16 @@ extern void SHA1_Final(unsigned char[SHA1_SIGNATURE_SIZE], SHA1_CTX *);
 #define SHA1_SIGNATURE_SIZE 20
 #endif
 #endif
+
+typedef struct {
+    u_int32_t state[5];
+    u_int32_t count[2];
+    unsigned char buffer[64];
+} SHA1_CTX;
+
+extern void SHA1_Init(SHA1_CTX *);
+extern void SHA1_Update(SHA1_CTX *, const unsigned char *, unsigned int);
+extern void SHA1_Final(unsigned char[SHA1_SIGNATURE_SIZE], SHA1_CTX *);
+
+#endif /* USE_SHA */
+#endif /* PPP_SHA1_H */