summaryrefslogtreecommitdiffstats
path: root/g10/passphrase.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1998-04-04 22:16:55 +0200
committerWerner Koch <wk@gnupg.org>1998-04-04 22:16:55 +0200
commit53a578711fe65b97c14539048dc9015dc5026da8 (patch)
tree2d358795a9d14fd7dcfe9f7a82e32363038ea8c5 /g10/passphrase.c
parentstarted with keyserver (diff)
downloadgnupg2-53a578711fe65b97c14539048dc9015dc5026da8.tar.xz
gnupg2-53a578711fe65b97c14539048dc9015dc5026da8.zip
cast5 does now work
Diffstat (limited to 'g10/passphrase.c')
-rw-r--r--g10/passphrase.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/g10/passphrase.c b/g10/passphrase.c
index ee5d4105b..46ff83163 100644
--- a/g10/passphrase.c
+++ b/g10/passphrase.c
@@ -156,6 +156,19 @@ hash_passphrase( DEK *dek, char *pw, byte *salt )
memcpy( dek->key, md_read(md,0), dek->keylen );
md_close(md);
}
+ else if( dek->algo == CIPHER_ALGO_CAST ) {
+ MD_HANDLE md;
+
+ md = md_open(DIGEST_ALGO_SHA1, 1);
+ if( salt )
+ md_write( md, salt, 8 );
+ md_write( md, pw, strlen(pw) );
+ md_final( md );
+ /* use only the low 128 bits */
+ dek->keylen = 16;
+ memcpy( dek->key, md_read(md,0), dek->keylen );
+ md_close(md);
+ }
else
rc = G10ERR_UNSUPPORTED;
return rc;