summaryrefslogtreecommitdiff
path: root/cipher/md.c
diff options
context:
space:
mode:
authorMoritz Schulte <mo@g10code.com>2003-03-04 18:05:00 +0000
committerMoritz Schulte <mo@g10code.com>2003-03-04 18:05:00 +0000
commitfbbb5dc27d299fb1862a706864cba149d7d53023 (patch)
tree2cbcf4c334ff986dd161917835716b991c502a99 /cipher/md.c
parent5b5237c23ffda1415f239407eeed3983a8e0adbe (diff)
downloadlibgcrypt-fbbb5dc27d299fb1862a706864cba149d7d53023.tar.gz
2003-03-03 Moritz Schulte <moritz@g10code.com>
* md.c (gcry_md_ctl): Rewritten to use same style like the other functions dispatchers.
Diffstat (limited to 'cipher/md.c')
-rw-r--r--cipher/md.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/cipher/md.c b/cipher/md.c
index 40bf6e64..0cb4f341 100644
--- a/cipher/md.c
+++ b/cipher/md.c
@@ -615,23 +615,27 @@ int
gcry_md_ctl( GCRY_MD_HD hd, int cmd, byte *buffer, size_t buflen)
{
int rc = 0;
- if( cmd == GCRYCTL_FINALIZE )
- md_final( hd );
- else if( cmd == GCRYCTL_SET_KEY ) {
- rc = gcry_md_setkey ( hd, buffer, buflen );
- }
- else if( cmd == GCRYCTL_START_DUMP ) {
- md_start_debug( hd, buffer );
- }
- else if( cmd == GCRYCTL_STOP_DUMP ) {
+
+ switch (cmd)
+ {
+ case GCRYCTL_FINALIZE:
+ md_final (hd);
+ break;
+ case GCRYCTL_SET_KEY:
+ rc = gcry_md_setkey (hd, buffer, buflen);
+ break;
+ case GCRYCTL_START_DUMP:
+ md_start_debug (hd, buffer);
+ break;
+ case GCRYCTL_STOP_DUMP:
md_stop_debug( hd );
- }
- else
+ break;
+ default:
rc = GCRYERR_INV_OP;
+ }
return set_lasterr( rc );
}
-
int
gcry_md_setkey( GCRY_MD_HD hd, const void *key, size_t keylen )
{