Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/netpgp/dist/src/lib Fix signing of in-me...



details:   https://anonhg.NetBSD.org/src/rev/bf1f8f9e6bb0
branches:  trunk
changeset: 343492:bf1f8f9e6bb0
user:      agc <agc%NetBSD.org@localhost>
date:      Sun Feb 07 05:03:36 2016 +0000

description:
Fix signing of in-memory data with SSH keys

diffstat:

 crypto/external/bsd/netpgp/dist/src/lib/netpgp.c |  17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r 3bcdf4ff8e1f -r bf1f8f9e6bb0 crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c  Sat Feb 06 22:48:07 2016 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c  Sun Feb 07 05:03:36 2016 +0000
@@ -34,7 +34,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: netpgp.c,v 1.96 2012/02/22 06:58:54 agc Exp $");
+__RCSID("$NetBSD: netpgp.c,v 1.97 2016/02/07 05:03:36 agc Exp $");
 #endif
 
 #include <sys/types.h>
@@ -1501,10 +1501,17 @@
                                        &pubkey->key.pubkey, 0);
                        }
                }
-               /* now decrypt key */
-               seckey = pgp_decrypt_seckey(keypair, netpgp->passfp);
-               if (seckey == NULL) {
-                       (void) fprintf(io->errs, "Bad passphrase\n");
+               if (netpgp_getvar(netpgp, "ssh keys") == NULL) {
+                       /* now decrypt key */
+                       seckey = pgp_decrypt_seckey(keypair, netpgp->passfp);
+                       if (seckey == NULL) {
+                               (void) fprintf(io->errs, "Bad passphrase\n");
+                       }
+               } else {
+                       pgp_keyring_t   *secring;
+
+                       secring = netpgp->secring;
+                       seckey = &secring->keys[0].key.seckey;
                }
        }
        if (seckey == NULL) {



Home | Main Index | Thread Index | Old Index