summaryrefslogtreecommitdiff
path: root/cipher
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2003-07-18 11:31:20 +0000
committerWerner Koch <wk@gnupg.org>2003-07-18 11:31:20 +0000
commitdb5d31bc723275e44da612823280a1a882d0d4bb (patch)
tree426841c83fba7eb9804d09ea88fcecb593ab7010 /cipher
parent30fc8e91943911b7ec0d790084cb422e33f7fcbc (diff)
downloadlibgcrypt-db5d31bc723275e44da612823280a1a882d0d4bb.tar.gz
* md.c (gcry_md_hash_buffer): Convert ERR to gpg_error_t in
gpg_strerror. Solved a few conflicts.
Diffstat (limited to 'cipher')
-rw-r--r--cipher/ChangeLog13
-rw-r--r--cipher/md.c34
2 files changed, 37 insertions, 10 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index 5c528698..1302803e 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -1,3 +1,8 @@
+2003-07-18 Werner Koch <wk@gnupg.org>
+
+ * md.c (gcry_md_hash_buffer): Convert ERR to gpg_error_t in
+ gpg_strerror.
+
2003-07-14 Moritz Schulte <moritz@g10code.com>
* cipher.c (gcry_cipher_lookup_func_name): Also check the cipher
@@ -171,6 +176,14 @@
* ac.c: New file.
+2003-06-26 Werner Koch <wk@gnupg.org>
+
+ * md.c (gcry_md_hash_buffer): Trigger BUG correcly with new API.
+
+2003-06-19 Werner Koch <wk@gnupg.org>
+
+ * md.c (gcry_md_is_enabled): Fixed.
+
2003-06-18 Werner Koch <wk@gnupg.org>
* cipher.c (gcry_cipher_get_algo_keylen): New.
diff --git a/cipher/md.c b/cipher/md.c
index 6549261c..670de923 100644
--- a/cipher/md.c
+++ b/cipher/md.c
@@ -895,25 +895,26 @@ gcry_md_get (gcry_md_hd_t hd, int algo, byte *buffer, int buflen)
/****************
- * Shortcut function to hash a buffer with a given algo. The only supported
- * algorithm is RIPE-MD. The supplied digest buffer must be large enough
- * to store the resulting hash. No error is returned, the function will
- * abort on an invalid algo. DISABLED_ALGOS are ignored here.
- */
+ * Shortcut function to hash a buffer with a given algo. The only
+ * guarnteed supported algorithm is RIPE-MD. The supplied digest
+ * buffer must be large enough to store the resulting hash. No error
+ * is returned, the function will abort on an invalid algo.
+ * DISABLED_ALGOS are ignored here. */
void
-gcry_md_hash_buffer (int algo, void *digest, const void *buffer, size_t length)
+gcry_md_hash_buffer (int algo, void *digest,
+ const void *buffer, size_t length)
{
if (algo == GCRY_MD_RMD160)
_gcry_rmd160_hash_buffer (digest, buffer, length);
else
{
- /* for the others we do not have a fast function, so we use the
+ /* For the others we do not have a fast function, so we use the
normal functions to do it */
gcry_md_hd_t h;
- gcry_err_code_t err = md_open (&h, algo, 0, 0);
+ gpg_err_code_t err = md_open (&h, algo, 0, 0);
if (err)
- /* FIXME? */
- BUG(); /* algo not available */
+ log_bug ("gcry_md_open failed for algo %d: %s",
+ algo, gpg_strerror (gcry_error(err)));
md_write (h, (byte *) buffer, length);
md_final (h);
memcpy (digest, md_read (h, algo), md_digest_length (algo));
@@ -1177,10 +1178,22 @@ gcry_md_is_enabled (gcry_md_hd_t a, int algo)
{
size_t value;
+ value = sizeof algo;
if (gcry_md_info (a, GCRYCTL_IS_ALGO_ENABLED, &algo, &value))
value = 0;
return value;
}
+<<<<<<< md.c
+
+
+
+
+
+
+
+
+
+=======
/* Get a list consisting of the IDs of the loaded message digest
modules. If LIST is zero, write the number of loaded message
@@ -1200,3 +1213,4 @@ gcry_md_list (int *list, int *list_length)
return err;
}
+>>>>>>> 1.73