diff options
author | Werner Koch <[email protected]> | 2000-10-04 11:16:19 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2000-10-04 11:16:19 +0000 |
commit | 9c20f65cbe9d3d806b02f0f90a2051a20f3857db (patch) | |
tree | 6c784f870b191b2a1b3f16f86cff3a5af59ff2f6 /cipher/md.c | |
parent | See ChangeLog: Mon Sep 18 16:35:45 CEST 2000 Werner Koch (diff) | |
download | gnupg-9c20f65cbe9d3d806b02f0f90a2051a20f3857db.tar.gz gnupg-9c20f65cbe9d3d806b02f0f90a2051a20f3857db.zip |
See ChangeLog: Wed Oct 4 13:16:18 CEST 2000 Werner Koch
Diffstat (limited to 'cipher/md.c')
-rw-r--r-- | cipher/md.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/cipher/md.c b/cipher/md.c index e8ac8ac24..29d6afed8 100644 --- a/cipher/md.c +++ b/cipher/md.c @@ -557,10 +557,7 @@ gcry_md_ctl( GCRY_MD_HD hd, int cmd, byte *buffer, size_t buflen) if( cmd == GCRYCTL_FINALIZE ) md_final( hd ); else if( cmd == GCRYCTL_SET_KEY ) { - if( !(hd->ctx->macpads ) ) - rc = GCRYERR_CONFLICT; - else if ( !(rc = prepare_macpads( hd, buffer, buflen )) ) - gcry_md_reset( hd ); + rc = gcry_md_setkey ( hd, buffer, buflen ); } else if( cmd == GCRYCTL_START_DUMP ) { md_start_debug( hd, buffer ); @@ -574,6 +571,20 @@ gcry_md_ctl( GCRY_MD_HD hd, int cmd, byte *buffer, size_t buflen) } +int +gcry_md_setkey( GCRY_MD_HD hd, const char *key, size_t keylen ) +{ + int rc = 0; + + if( !(hd->ctx->macpads ) ) + rc = GCRYERR_CONFLICT; + else if ( !(rc = prepare_macpads( hd, key, keylen )) ) + gcry_md_reset( hd ); + + return rc; +} + + /**************** * if ALGO is null get the digest for the used algo (which should be only one) */ |