]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sha1.h
Fix include paths for plugins to use the public API of pppd
[ppp.git] / pppd / sha1.h
index dff8da88bd91a041f616e9fb34020c9958144099..e7e557308ee8e1f446c4295cc09d1c84bfda5e75 100644 (file)
@@ -1,18 +1,35 @@
 /* sha1.h */
 
+#include "pppdconf.h"
+
 #ifndef __SHA1_INCLUDE_
+#define __SHA1_INCLUDE_
+
+#ifndef USE_SHA
+#include <openssl/sha.h>
+
+#define SHA1_CTX SHA_CTX
+#define SHA1_SIGNATURE_SIZE SHA_DIGEST_LENGTH
+
+#else
+
+#ifndef SHA1_SIGNATURE_SIZE
+#ifdef SHA_DIGESTSIZE
+#define SHA1_SIGNATURE_SIZE SHA_DIGESTSIZE
+#else
+#define SHA1_SIGNATURE_SIZE 20
+#endif
+#endif
 
 typedef struct {
-    unsigned long state[5];
-    unsigned long count[2];
+    u_int32_t state[5];
+    u_int32_t count[2];
     unsigned char buffer[64];
 } SHA1_CTX;
 
-#define SHA1_SIGNATURE_SIZE 20
-
 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_INCLUDE_
+#endif /* USE_SHA */
 #endif /* __SHA1_INCLUDE_ */