diff options
author | khorben <khorben@pkgsrc.org> | 2018-03-15 20:00:43 +0000 |
---|---|---|
committer | khorben <khorben@pkgsrc.org> | 2018-03-15 20:00:43 +0000 |
commit | bfa8be7f97b9161baa21dc889179e097aa581c80 (patch) | |
tree | d335174383cb05955fe93e6c77350131de7cc42a /security/netpgp | |
parent | 55653e86267962c8cd96e743b64f376dac1bd1d6 (diff) | |
download | pkgsrc-bfa8be7f97b9161baa21dc889179e097aa581c80.tar.gz |
Do not use random data for pass-phrases on EOF
Originally submitted on tech-pkg@ as:
[PATCH 04/11] Do not use random data for pass-phrases on EOF
Only modified for consistency with the coding style; as also applied in
NetBSD's src repository.
Tested on NetBSD/amd64.
Diffstat (limited to 'security/netpgp')
-rw-r--r-- | security/netpgp/Makefile | 4 | ||||
-rw-r--r-- | security/netpgp/distinfo | 4 | ||||
-rw-r--r-- | security/netpgp/patches/patch-src_lib_keyring.c | 20 |
3 files changed, 20 insertions, 8 deletions
diff --git a/security/netpgp/Makefile b/security/netpgp/Makefile index d09334c4e82..c8c78f0049b 100644 --- a/security/netpgp/Makefile +++ b/security/netpgp/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.26 2018/03/15 19:51:08 khorben Exp $ +# $NetBSD: Makefile,v 1.27 2018/03/15 20:00:43 khorben Exp $ DISTNAME= netpgp-20140220 -PKGREVISION= 4 +PKGREVISION= 5 CATEGORIES= security MASTER_SITES= ${MASTER_SITE_LOCAL} diff --git a/security/netpgp/distinfo b/security/netpgp/distinfo index ed0bcf6295c..f2b12cbb69e 100644 --- a/security/netpgp/distinfo +++ b/security/netpgp/distinfo @@ -1,8 +1,8 @@ -$NetBSD: distinfo,v 1.20 2018/03/15 19:51:08 khorben Exp $ +$NetBSD: distinfo,v 1.21 2018/03/15 20:00:43 khorben Exp $ SHA1 (netpgp-20140220.tar.gz) = 815418cbae5d02a1385cd7947618303e5aa06d5c RMD160 (netpgp-20140220.tar.gz) = 970f55292852d5dbfde3eb17a5fefd6a7c820c4e SHA512 (netpgp-20140220.tar.gz) = ec6cfa0131cd50aee273b81cd64f448258121d7e9c8d4914be39ba59b5c28149bced3866c57f521167480da04b60d9d9bd2b228319dc8baa31328fb7c37e6b96 Size (netpgp-20140220.tar.gz) = 1521820 bytes -SHA1 (patch-src_lib_keyring.c) = 937af3b82b07c2817b3b20e6d76043950c7afd29 +SHA1 (patch-src_lib_keyring.c) = b924af4877aaab98e542425b5d9427830ddd5b75 SHA1 (patch-src_lib_reader.c) = 2ebaddebbc2f6f42f7391933ebfef39e3a73a367 diff --git a/security/netpgp/patches/patch-src_lib_keyring.c b/security/netpgp/patches/patch-src_lib_keyring.c index d8d3a7887c1..8500d1f253c 100644 --- a/security/netpgp/patches/patch-src_lib_keyring.c +++ b/security/netpgp/patches/patch-src_lib_keyring.c @@ -1,9 +1,10 @@ -$NetBSD: patch-src_lib_keyring.c,v 1.2 2018/03/15 19:37:30 khorben Exp $ +$NetBSD: patch-src_lib_keyring.c,v 1.3 2018/03/15 20:00:43 khorben Exp $ Do not crash when listing keys without a keyring. +Do not use random data for pass-phrases on EOF. Do not ask for a passphrase when empty. ---- src/lib/keyring.c.orig 2018-03-15 19:31:30.000000000 +0000 +--- src/lib/keyring.c.orig 2011-06-25 00:37:44.000000000 +0000 +++ src/lib/keyring.c @@ -226,7 +226,7 @@ typedef struct { pgp_seckey_t *seckey; @@ -14,7 +15,18 @@ Do not ask for a passphrase when empty. decrypt_cb(const pgp_packet_t *pkt, pgp_cbdata_t *cbinfo) { const pgp_contents_t *content = &pkt->u; -@@ -292,6 +292,20 @@ decrypt_cb(const pgp_packet_t *pkt, pgp_ +@@ -244,7 +244,9 @@ decrypt_cb(const pgp_packet_t *pkt, pgp_ + break; + + case PGP_GET_PASSPHRASE: +- (void) pgp_getpassphrase(decrypt->passfp, pass, sizeof(pass)); ++ if (pgp_getpassphrase(decrypt->passfp, pass, sizeof(pass)) == 0) { ++ pass[0] = '\0'; ++ } + *content->skey_passphrase.passphrase = netpgp_strdup(pass); + pgp_forget(pass, (unsigned)sizeof(pass)); + return PGP_KEEP_MEMORY; +@@ -292,6 +294,20 @@ decrypt_cb(const pgp_packet_t *pkt, pgp_ return PGP_RELEASE_MEMORY; } @@ -35,7 +47,7 @@ Do not ask for a passphrase when empty. /** \ingroup Core_Keys \brief Decrypts secret key from given keydata with given passphrase -@@ -306,8 +320,18 @@ pgp_decrypt_seckey(const pgp_key_t *key, +@@ -306,8 +322,18 @@ pgp_decrypt_seckey(const pgp_key_t *key, const int printerrors = 1; decrypt_t decrypt; |