From faed12a6989447baa7691180f687dc366e03302b Mon Sep 17 00:00:00 2001 From: David Shaw Date: Wed, 7 Aug 2002 19:47:57 +0000 Subject: [PATCH] * md.c (md_algo_present): New function to check if a given algo is in use for a given MD_HANDLE. --- cipher/ChangeLog | 6 +++++- cipher/md.c | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/cipher/ChangeLog b/cipher/ChangeLog index 7b8c87f2f..7bda5084f 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,8 @@ +2002-08-07 David Shaw + + * md.c (md_algo_present): New function to check if a given algo is + in use for a given MD_HANDLE. + 2002-08-04 Werner Koch * blowfish.h, cast5.h, des.h: Removed after moving all prototypes to @@ -438,7 +443,6 @@ Mon Oct 4 21:23:04 CEST 1999 Werner Koch Sat Sep 18 12:51:51 CEST 1999 Werner Koch - * Makefile.am: Never compile mingw32 as module Wed Sep 15 14:39:59 CEST 1999 Michael Roth diff --git a/cipher/md.c b/cipher/md.c index 85c1f5b2a..73a2b33cf 100644 --- a/cipher/md.c +++ b/cipher/md.c @@ -408,6 +408,23 @@ md_get_algo( MD_HANDLE a ) return 0; } +/* Returns true if a given algo is in use in a md */ +int +md_algo_present( MD_HANDLE a, int algo ) +{ + struct md_digest_list_s *r=a->list; + + while(r) + { + if(r->algo==algo) + return 1; + + r=r->next; + } + + return 0; +} + /**************** * Return the length of the digest */ @@ -485,4 +502,3 @@ md_stop_debug( MD_HANDLE md ) } #endif } -