From 2d30d343e05f1145f441bdea25c3114558b94a34 Mon Sep 17 00:00:00 2001 From: Bill Welliver <bill@welliver.org> Date: Mon, 8 Dec 2014 01:17:23 +0100 Subject: [PATCH] windows: need stdint.h for uint* --- src/post_modules/Nettle/mac.cmod | 4 +++ src/post_modules/Nettle/nettle.cmod | 4 +++ src/post_modules/Nettle/nettle.h | 41 ++++++++++++++++------------- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/post_modules/Nettle/mac.cmod b/src/post_modules/Nettle/mac.cmod index cbfd294d18..a1ee17b757 100644 --- a/src/post_modules/Nettle/mac.cmod +++ b/src/post_modules/Nettle/mac.cmod @@ -20,6 +20,10 @@ DECLARATIONS +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif /* HAVE_STDINT_H */ + #include "nettle.h" #ifdef HAVE_NETTLE_POLY1305_H diff --git a/src/post_modules/Nettle/nettle.cmod b/src/post_modules/Nettle/nettle.cmod index 765ddd182d..a9cdeb2302 100644 --- a/src/post_modules/Nettle/nettle.cmod +++ b/src/post_modules/Nettle/nettle.cmod @@ -22,6 +22,10 @@ #include <stdio.h> #include <stdarg.h> +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif /* HAVE_STDINT_H */ + DECLARATIONS /*! @module Nettle diff --git a/src/post_modules/Nettle/nettle.h b/src/post_modules/Nettle/nettle.h index 6cd2e77684..b02ce114f0 100644 --- a/src/post_modules/Nettle/nettle.h +++ b/src/post_modules/Nettle/nettle.h @@ -50,25 +50,28 @@ typedef size_t pike_nettle_size_t; typedef unsigned pike_nettle_size_t; #endif -/* In Nettle 2.0 the nettle_*_func typedefs lost their pointers. */ -#ifdef HAVE_NETTLE_CRYPT_FUNC_IS_POINTER -/* Nettle 1.x */ -typedef nettle_crypt_func pike_nettle_crypt_func; -typedef nettle_hash_digest_func pike_nettle_hash_digest_func; -typedef nettle_hash_update_func pike_nettle_hash_update_func; -#else -/* Nettle 2.0 */ - -#ifdef dsa_params_init -/* Nettle 3.0 */ -typedef nettle_cipher_func *pike_nettle_crypt_func; -#else -typedef nettle_crypt_func *pike_nettle_crypt_func; -#endif - -typedef nettle_hash_digest_func *pike_nettle_hash_digest_func; -typedef nettle_hash_update_func *pike_nettle_hash_update_func; -#endif +/* In Nettle 2.0 the nettle_*_func typedefs lost their pointers. */ +#ifdef HAVE_NETTLE_CRYPT_FUNC_IS_POINTER +/* Nettle 1.x */ +typedef nettle_crypt_func pike_nettle_crypt_func; +typedef nettle_hash_digest_func pike_nettle_hash_digest_func; +typedef nettle_hash_update_func pike_nettle_hash_update_func; +#else +/* Nettle 2.0 */ +typedef void (*pike_nettle_crypt_func)(void *ctx, + unsigned length, uint8_t *dst, + const uint8_t *src); + +typedef void (*pike_nettle_hash_digest_func)(void *ctx, + unsigned length, uint8_t *dst); + +typedef void (*pike_nettle_hash_update_func)(void *ctx, + unsigned length, + const uint8_t *src); + +/* Nettle 3.0 */ + +#endif char *pike_crypt_md5(int pl, const char *const pw, -- GitLab