diff --git a/dsa-sign.c b/dsa-sign.c
index b87226fbfef852c5715f03bfa56a96de5cc59b03..ab5adb0b4d0858382c8bd648e6f983a3034e4141 100644
--- a/dsa-sign.c
+++ b/dsa-sign.c
@@ -37,11 +37,11 @@
 
 
 void
-dsa_sign(const struct dsa_public_key *pub,
-	 const struct dsa_private_key *key,
-	 void *random_ctx, nettle_random_func random,
-	 struct sha1_ctx *hash,
-	 struct dsa_signature *signature)
+dsa_sign_digest(const struct dsa_public_key *pub,
+		const struct dsa_private_key *key,
+		void *random_ctx, nettle_random_func random,
+		const uint8_t *digest,
+		struct dsa_signature *signature)
 {
   mpz_t k;
   mpz_t h;
@@ -61,7 +61,7 @@ dsa_sign(const struct dsa_public_key *pub,
 
   /* Compute hash */
   mpz_init(h);
-  _dsa_hash(h, hash);
+  nettle_mpz_set_str_256_u(h, SHA1_DIGEST_SIZE, digest);
 
   /* Compute k^-1 (mod q) */
   if (!mpz_invert(k, k, pub->q))
@@ -80,4 +80,18 @@ dsa_sign(const struct dsa_public_key *pub,
   mpz_clear(tmp);
 }
 
+void
+dsa_sign(const struct dsa_public_key *pub,
+	 const struct dsa_private_key *key,
+	 void *random_ctx, nettle_random_func random,
+	 struct sha1_ctx *hash,
+	 struct dsa_signature *signature)
+{
+  uint8_t digest[SHA1_DIGEST_SIZE];
+  sha1_digest(hash, sizeof(digest), digest);
+
+  dsa_sign_digest(pub, key, random_ctx, random,
+		  digest, signature);
+}
+
 #endif /* WITH_PUBLIC_KEY */
diff --git a/dsa-verify.c b/dsa-verify.c
index 43d76c77c0db5fb8810aa2b43fde44605e9d986d..87c2a48a091f2f8a94453bdafd2c16a4bc979fe1 100644
--- a/dsa-verify.c
+++ b/dsa-verify.c
@@ -5,7 +5,7 @@
 
 /* nettle, low-level cryptographics library
  *
- * Copyright (C) 2002 Niels M�ller
+ * Copyright (C) 2002, 2003 Niels M�ller
  *  
  * The nettle library is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -31,12 +31,14 @@
 
 #include "dsa.h"
 
+#include "bignum.h"
+
 #include <stdlib.h>
 
 int
-dsa_verify(const struct dsa_public_key *key,
-	   struct sha1_ctx *hash,
-	   const struct dsa_signature *signature)
+dsa_verify_digest(const struct dsa_public_key *key,
+		  const uint8_t *digest,
+		  const struct dsa_signature *signature)
 {
   mpz_t w;
   mpz_t tmp;
@@ -65,12 +67,11 @@ dsa_verify(const struct dsa_public_key *key,
 
   mpz_init(tmp);
   mpz_init(v);
-  
-  /* Compute hash */
-  _dsa_hash(tmp, hash);
+
+  /* The message digest */
+  nettle_mpz_set_str_256_u(tmp, SHA1_DIGEST_SIZE, digest);
   
   /* v = g^{w * h (mod q)} (mod p)  */
-
   mpz_mul(tmp, tmp, w);
   mpz_fdiv_r(tmp, tmp, key->q);
 
@@ -97,4 +98,15 @@ dsa_verify(const struct dsa_public_key *key,
   return res;
 }
 
+int
+dsa_verify(const struct dsa_public_key *key,
+	   struct sha1_ctx *hash,
+	   const struct dsa_signature *signature)
+{
+  uint8_t digest[SHA1_DIGEST_SIZE];
+  sha1_digest(hash, sizeof(digest), digest);
+
+  return dsa_verify_digest(key, digest, signature);
+}
+
 #endif /* WITH_PUBLIC_KEY */