mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: Add option --weak-digest to gpg and gpgv.
* g10/options.h: Add weak_digests linked list to opts. * g10/main.h: Declare weakhash linked list struct and additional_weak_digest() function to insert newly-declared weak digests into opts. * g10/misc.c: (additional_weak_digest): New function. (print_digest_algo_note): Check for deprecated digests. * g10/sig-check.c: (do_check): Reject all weak digests. * g10/gpg.c: Add --weak-digest option to gpg. * doc/gpg.texi: Document gpg --weak-digest option. * g10/gpgv.c: Add --weak-digest option to gpgv. * doc/gpgv.texi: Document gpgv --weak-digest option. -- gpg and gpgv treat signatures made over MD5 as unreliable, unless the user supplies --allow-weak-digests to gpg. Signatures over any other digest are considered acceptable. Despite SHA-1 being a mandatory-to-implement digest algorithm in RFC 4880, the collision-resistance of SHA-1 is weaker than anyone would like it to be. Some operators of high-value targets that depend on OpenPGP signatures may wish to require their signers to use a stronger digest algorithm than SHA1, even if the OpenPGP ecosystem at large cannot deprecate SHA1 entirely today. This changeset adds a new "--weak-digest DIGEST" option for both gpg and gpgv, which makes it straightforward for anyone to treat any signature or certification made over the specified digest as unreliable. This option can be supplied multiple times if the operator wishes to deprecate multiple digest algorithms, and will be ignored completely if the operator supplies --allow-weak-digests (as before). MD5 is always considered weak, regardless of any further --weak-digest options supplied. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net> (this is a rough cherry-pick of applying the following commits to STABLE-BRANCH-1-4:76afaed65e
b98939812a
91015d021b
)
This commit is contained in:
parent
43e5d28c6d
commit
924518b10d
8 changed files with 92 additions and 18 deletions
|
@ -60,6 +60,7 @@ enum cmd_and_opt_values { aNull = 0,
|
|||
oStatusFD,
|
||||
oLoggerFD,
|
||||
oHomedir,
|
||||
oWeakDigest,
|
||||
aTest };
|
||||
|
||||
|
||||
|
@ -75,6 +76,7 @@ static ARGPARSE_OPTS opts[] = {
|
|||
{ oStatusFD, "status-fd" ,1, N_("|FD|write status info to this FD") },
|
||||
{ oLoggerFD, "logger-fd",1, "@" },
|
||||
{ oHomedir, "homedir", 2, "@" }, /* defaults to "~/.gnupg" */
|
||||
{ oWeakDigest, "weak-digest", 2, "@" }, /* defaults to "~/.gnupg" */
|
||||
|
||||
{0} };
|
||||
|
||||
|
@ -143,6 +145,7 @@ main( int argc, char **argv )
|
|||
opt.keyserver_options.options|=KEYSERVER_AUTO_KEY_RETRIEVE;
|
||||
opt.trust_model = TM_ALWAYS;
|
||||
opt.batch = 1;
|
||||
opt.weak_digests = NULL;
|
||||
|
||||
opt.homedir = default_homedir ();
|
||||
|
||||
|
@ -151,6 +154,7 @@ main( int argc, char **argv )
|
|||
dotlock_disable ();
|
||||
|
||||
set_native_charset (NULL); /* Try to auto set the character set */
|
||||
additional_weak_digest("MD5");
|
||||
|
||||
pargs.argc = &argc;
|
||||
pargs.argv = &argv;
|
||||
|
@ -164,6 +168,7 @@ main( int argc, char **argv )
|
|||
case oStatusFD: set_status_fd( pargs.r.ret_int ); break;
|
||||
case oLoggerFD: log_set_logfile( NULL, pargs.r.ret_int ); break;
|
||||
case oHomedir: opt.homedir = pargs.r.ret_str; break;
|
||||
case oWeakDigest: additional_weak_digest(pargs.r.ret_str); break;
|
||||
case oIgnoreTimeConflict: opt.ignore_time_conflict = 1; break;
|
||||
default : pargs.err = 2; break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue