Module Name: src
Committed By: agc
Date: Tue Jun 9 02:19:47 UTC 2009
Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: reader.c
Log Message:
Fix a bug in decryption whereby a bad passphrase would cause a segmentation
violation
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 \
src/crypto/external/bsd/netpgp/dist/src/lib/reader.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/crypto/external/bsd/netpgp/dist/src/lib/reader.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.18 src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.19
--- src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.18 Tue Jun 9 00:51:02 2009
+++ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c Tue Jun 9 02:19:47 2009
@@ -54,7 +54,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: reader.c,v 1.18 2009/06/09 00:51:02 agc Exp $");
+__RCSID("$NetBSD: reader.c,v 1.19 2009/06/09 02:19:47 agc Exp $");
#endif
#include <sys/types.h>
@@ -2179,17 +2179,19 @@
seckey.u.skey_passphrase.passphrase =
&cbinfo->cryptinfo.passphrase;
CALLBACK(OPS_GET_PASSPHRASE, cbinfo, &seckey);
- if (!cbinfo->cryptinfo.passphrase) {
- fprintf(stderr,
- "can't get passphrase\n");
- return 0;
- }
}
/* then it must be encrypted */
- secret = __ops_decrypt_seckey(cbinfo->cryptinfo.keydata,
- cbinfo->cryptinfo.passphrase);
+ secret = __ops_decrypt_seckey(
+ cbinfo->cryptinfo.keydata,
+ cbinfo->cryptinfo.passphrase);
+ if (!secret) {
+ (void) __ops_forget(
+ cbinfo->cryptinfo.passphrase,
+ strlen(cbinfo->cryptinfo.passphrase));
+ cbinfo->cryptinfo.passphrase = NULL;
+ (void) fprintf(stderr, "Bad passphrase\n");
+ }
}
-
*content->get_seckey.seckey = secret;
break;