* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifdef USE_GNUTLS
+# include <gnutls/gnutls.h>
+# include <gnutls/crypto.h>
+#else
+# include <openssl/sha.h>
+#endif
+
/* -------------------------------------------------------------------------- */
/* Length of the preallocated buffer for the "answer" from the dns/txt
callback function. This should match the maximum RDLENGTH from DNS. */
/* Some required forward declarations, please ignore */
typedef struct pdkim_stringlist pdkim_stringlist;
typedef struct pdkim_str pdkim_str;
-typedef struct sha1_context sha1_context;
-typedef struct sha2_context sha2_context;
-#define HAVE_SHA1_CONTEXT
-#define HAVE_SHA2_CONTEXT
/* -------------------------------------------------------------------------- */
/* Some concessions towards Redmond */
/* Properties below this point are used internally only ------------- */
/* Per-signature helper variables ----------------------------------- */
- sha1_context *sha1_body; /* SHA1 block */
- sha2_context *sha2_body; /* SHA256 block */
+#ifdef USE_GNUTLS
+ gnutls_hash_hd_t sha_body; /* Either SHA1 or SHA256 block */
+#else
+ SHA_CTX sha1_body; /* SHA1 block */
+ SHA256_CTX sha2_body; /* SHA256 block */
+#endif
unsigned long signed_body_bytes; /* How many body bytes we hashed */
- pdkim_stringlist *headers; /* Raw headers included in the sig */
+ pdkim_stringlist *headers; /* Raw headers included in the sig */
/* Signing specific ------------------------------------------------- */
char *rsa_privkey; /* Private RSA key */
char *sign_headers; /* To-be-signed header names */
#endif
DLLEXPORT
-pdkim_ctx *pdkim_init_sign (char *, char *, char *);
+pdkim_ctx *pdkim_init_sign (char *, char *, char *, int);
DLLEXPORT
pdkim_ctx *pdkim_init_verify (int(*)(char *, char *));
DLLEXPORT
int pdkim_set_optional (pdkim_ctx *, char *, char *,int, int,
- long, int,
+ long,
unsigned long,
unsigned long);