diff options
Diffstat (limited to 'lib/libsecureboot/openpgp')
-rw-r--r-- | lib/libsecureboot/openpgp/Makefile.inc | 2 | ||||
-rw-r--r-- | lib/libsecureboot/openpgp/dearmor.c | 2 | ||||
-rw-r--r-- | lib/libsecureboot/openpgp/decode.c | 2 | ||||
-rw-r--r-- | lib/libsecureboot/openpgp/decode.h | 1 | ||||
-rw-r--r-- | lib/libsecureboot/openpgp/opgp_key.c | 2 | ||||
-rw-r--r-- | lib/libsecureboot/openpgp/opgp_sig.c | 39 | ||||
-rw-r--r-- | lib/libsecureboot/openpgp/packet.h | 1 |
7 files changed, 24 insertions, 25 deletions
diff --git a/lib/libsecureboot/openpgp/Makefile.inc b/lib/libsecureboot/openpgp/Makefile.inc index 5e8777c1221f..3a216d205fe3 100644 --- a/lib/libsecureboot/openpgp/Makefile.inc +++ b/lib/libsecureboot/openpgp/Makefile.inc @@ -1,5 +1,3 @@ -# $FreeBSD$ - # decode OpenPGP signatures per rfc4880 .PATH: ${.PARSEDIR} diff --git a/lib/libsecureboot/openpgp/dearmor.c b/lib/libsecureboot/openpgp/dearmor.c index 3d53b54474dc..452722ff1a10 100644 --- a/lib/libsecureboot/openpgp/dearmor.c +++ b/lib/libsecureboot/openpgp/dearmor.c @@ -24,8 +24,6 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - #define NEED_BRSSL_H #include <libsecureboot.h> #include <brssl.h> diff --git a/lib/libsecureboot/openpgp/decode.c b/lib/libsecureboot/openpgp/decode.c index fd6a19ad1bea..c59b5722c29e 100644 --- a/lib/libsecureboot/openpgp/decode.c +++ b/lib/libsecureboot/openpgp/decode.c @@ -24,8 +24,6 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - #include <libsecureboot.h> #include "decode.h" diff --git a/lib/libsecureboot/openpgp/decode.h b/lib/libsecureboot/openpgp/decode.h index 8da39c9cf14b..1e7e2ea1f915 100644 --- a/lib/libsecureboot/openpgp/decode.h +++ b/lib/libsecureboot/openpgp/decode.h @@ -23,7 +23,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* - * $FreeBSD$ */ #ifdef USE_BEARSSL diff --git a/lib/libsecureboot/openpgp/opgp_key.c b/lib/libsecureboot/openpgp/opgp_key.c index c108cd2fa328..568d334ec117 100644 --- a/lib/libsecureboot/openpgp/opgp_key.c +++ b/lib/libsecureboot/openpgp/opgp_key.c @@ -24,8 +24,6 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - #include "../libsecureboot-priv.h" #include "decode.h" diff --git a/lib/libsecureboot/openpgp/opgp_sig.c b/lib/libsecureboot/openpgp/opgp_sig.c index fcf4a708c4c3..8846296d7122 100644 --- a/lib/libsecureboot/openpgp/opgp_sig.c +++ b/lib/libsecureboot/openpgp/opgp_sig.c @@ -26,8 +26,6 @@ * RCSid: * from: signer.c,v 1.10 2018/03/23 01:14:30 sjg * - * @(#) Copyright (c) 2012 Simon J. Gerraty - * * This file is provided in the hope that it will * be of use. There is absolutely NO WARRANTY. * Permission to copy, redistribute or otherwise @@ -40,8 +38,6 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - #include "../libsecureboot-priv.h" #ifdef _STANDALONE #define warnx printf @@ -75,7 +71,7 @@ initialize (void) #include <openssl/err.h> /** - * @brief intialize OpenSSL + * @brief initialize OpenSSL */ void initialize(void) @@ -343,8 +339,19 @@ openpgp_verify(const char *filename, mlen = br_sha256_SIZE; hash_oid = BR_HASH_OID_SHA256; break; + case 9: /* sha384 */ + md = &br_sha384_vtable; + mlen = br_sha384_SIZE; + hash_oid = BR_HASH_OID_SHA384; + break; + case 10: /* sha512 */ + md = &br_sha512_vtable; + mlen = br_sha512_SIZE; + hash_oid = BR_HASH_OID_SHA512; + break; default: warnx("unsupported hash algorithm: %s", hname); + rc = -1; goto oops; } md->init(&mctx.vtable); @@ -464,20 +471,22 @@ verify_asc(const char *sigfile, int flags) size_t n; unsigned char *fdata, *sdata; size_t fbytes, sbytes; - + + fdata = NULL; if ((sdata = read_file(sigfile, &sbytes))) { n = strlcpy(pbuf, sigfile, sizeof(pbuf)); - if ((cp = strrchr(pbuf, '.'))) - *cp = '\0'; - if ((fdata = read_file(pbuf, &fbytes))) { - if (openpgp_verify(pbuf, fdata, fbytes, sdata, - sbytes, flags)) { - free(fdata); - fdata = NULL; + if (n < sizeof(pbuf)) { + if ((cp = strrchr(pbuf, '.'))) + *cp = '\0'; + if ((fdata = read_file(pbuf, &fbytes))) { + if (openpgp_verify(pbuf, fdata, fbytes, sdata, + sbytes, flags)) { + free(fdata); + fdata = NULL; + } } } - } else - fdata = NULL; + } free(sdata); return (fdata); } diff --git a/lib/libsecureboot/openpgp/packet.h b/lib/libsecureboot/openpgp/packet.h index 28ac3c9b40fe..58f797cd1651 100644 --- a/lib/libsecureboot/openpgp/packet.h +++ b/lib/libsecureboot/openpgp/packet.h @@ -23,7 +23,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* - * $FreeBSD$ */ #include <sys/queue.h> |