[svn] GnuPG - r3859 - trunk/g10
svn author dshaw
cvs at cvs.gnupg.org
Fri Aug 5 21:54:08 CEST 2005
Author: dshaw
Date: 2005-08-05 21:54:06 +0200 (Fri, 05 Aug 2005)
New Revision: 3859
Modified:
trunk/g10/ChangeLog
trunk/g10/g10.c
trunk/g10/passphrase.c
Log:
* g10.c (main), passphrase.c (set_passphrase_from_string): New
--passphrase command line option. Only useful in very special
circumstances.
Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog 2005-08-05 16:30:12 UTC (rev 3858)
+++ trunk/g10/ChangeLog 2005-08-05 19:54:06 UTC (rev 3859)
@@ -1,3 +1,9 @@
+2005-08-05 David Shaw <dshaw at jabberwocky.com>
+
+ * g10.c (main), passphrase.c (set_passphrase_from_string): New
+ --passphrase command line option. Only useful in very special
+ circumstances.
+
2005-08-05 Werner Koch <wk at g10code.com>
* gpgv.c (keyserver_import_fprint): New stub.
Modified: trunk/g10/g10.c
===================================================================
--- trunk/g10/g10.c 2005-08-05 16:30:12 UTC (rev 3858)
+++ trunk/g10/g10.c 2005-08-05 19:54:06 UTC (rev 3859)
@@ -211,6 +211,7 @@
oCompressLevel,
oBZ2CompressLevel,
oBZ2DecompressLowmem,
+ oPasswd,
oPasswdFD,
oPasswdFile,
oCommandFD,
@@ -558,6 +559,7 @@
/* { aListTrustPath, "list-trust-path",0, "@"}, */
{ aPipeMode, "pipemode", 0, "@" },
{ oKOption, NULL, 0, "@"},
+ { oPasswd, "passphrase",2, "@" },
{ oPasswdFD, "passphrase-fd",1, "@" },
{ oPasswdFile, "passphrase-file",2, "@" },
{ oCommandFD, "command-fd",1, "@" },
@@ -2270,6 +2272,9 @@
case oCompressLevel: opt.compress_level = pargs.r.ret_int; break;
case oBZ2CompressLevel: opt.bz2_compress_level = pargs.r.ret_int; break;
case oBZ2DecompressLowmem: opt.bz2_decompress_lowmem=1; break;
+ case oPasswd:
+ set_passphrase_from_string(pargs.r.ret_str);
+ break;
case oPasswdFD:
pwfd = iobuf_translate_file_handle (pargs.r.ret_int, 0);
opt.use_agent = 0;
Modified: trunk/g10/passphrase.c
===================================================================
--- trunk/g10/passphrase.c 2005-08-05 16:30:12 UTC (rev 3858)
+++ trunk/g10/passphrase.c 2005-08-05 19:54:06 UTC (rev 3859)
@@ -115,8 +115,21 @@
return p;
}
+/* Here's an interesting question: since this passphrase was passed in
+ on the command line, is there really any point in using secure
+ memory for it? I'm going with 'yes', since it doesn't hurt, and
+ might help in some small way (swapping). */
void
+set_passphrase_from_string(const char *pass)
+{
+ xfree( fd_passwd );
+ fd_passwd = xmalloc_secure(strlen(pass)+1);
+ strcpy(fd_passwd,pass);
+}
+
+
+void
read_passphrase_from_fd( int fd )
{
int i, len;
More information about the Gnupg-commits
mailing list