aboutsummaryrefslogtreecommitdiffstats
path: root/main/openntpd/fix-cdecls.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/openntpd/fix-cdecls.patch')
-rw-r--r--main/openntpd/fix-cdecls.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/main/openntpd/fix-cdecls.patch b/main/openntpd/fix-cdecls.patch
new file mode 100644
index 0000000000..be3d081484
--- /dev/null
+++ b/main/openntpd/fix-cdecls.patch
@@ -0,0 +1,56 @@
+--- ./include/sha2_openbsd.h.orig
++++ ./include/sha2_openbsd.h
+@@ -63,7 +63,10 @@
+ u_int8_t buffer[SHA512_BLOCK_LENGTH];
+ } SHA2_CTX;
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ void SHA224Init(SHA2_CTX *);
+ void SHA224Transform(u_int32_t state[8], const u_int8_t [SHA224_BLOCK_LENGTH]);
+ void SHA224Update(SHA2_CTX *, const u_int8_t *, size_t)
+@@ -131,6 +134,8 @@
+ char *SHA512Data(const u_int8_t *, size_t, char *)
+ __attribute__((__bounded__(__string__,1,2)))
+ __attribute__((__bounded__(__minbytes__,3,SHA512_DIGEST_STRING_LENGTH)));
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /* _SHA2_H */
+--- ./include/md5_openbsd.h.orig
++++ ./include/md5_openbsd.h
+@@ -15,6 +15,8 @@
+ #ifndef _MD5_H_
+ #define _MD5_H_
+
++#include <sys/types.h>
++
+ #define MD5_BLOCK_LENGTH 64
+ #define MD5_DIGEST_LENGTH 16
+ #define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_LENGTH * 2 + 1)
+@@ -25,7 +27,9 @@
+ u_int8_t buffer[MD5_BLOCK_LENGTH]; /* input buffer */
+ } MD5_CTX;
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ void MD5Init(MD5_CTX *);
+ void MD5Update(MD5_CTX *, const u_int8_t *, size_t)
+ __attribute__((__bounded__(__string__,2,3)));
+@@ -44,6 +48,8 @@
+ char *MD5Data(const u_int8_t *, size_t, char *)
+ __attribute__((__bounded__(__string__,1,2)))
+ __attribute__((__bounded__(__minbytes__,3,MD5_DIGEST_STRING_LENGTH)));
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /* _MD5_H_ */