diff options
author | Anton Lindqvist <anton@cvs.openbsd.org> | 2024-06-03 06:14:33 +0000 |
---|---|---|
committer | Anton Lindqvist <anton@cvs.openbsd.org> | 2024-06-03 06:14:33 +0000 |
commit | aed7e8ed5e59f6ff5dc64100bc443f9c46dc5e91 (patch) | |
tree | 9a741a274c2893f1704eb64277ed0748fa78803b /usr.sbin | |
parent | 11555f0a52482927ca9b7108968b8bb2edac6217 (diff) |
Passing a NULL digest to SHA routines from libcrypto is no longer
supported.
ok tb@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/snmpd/parse.y | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/snmpd/parse.y b/usr.sbin/snmpd/parse.y index 541a65f21ef..3882b915ebd 100644 --- a/usr.sbin/snmpd/parse.y +++ b/usr.sbin/snmpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.90 2024/02/20 12:32:48 martijn Exp $ */ +/* $OpenBSD: parse.y,v 1.91 2024/06/03 06:14:32 anton Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org> @@ -142,6 +142,8 @@ static uint8_t engineid[SNMPD_MAXENGINEIDLEN]; static int32_t enginepen; static size_t engineidlen; +static unsigned char sha256[SHA256_DIGEST_LENGTH]; + int resolve_oid(struct ber_oid *, struct oid_sym *); int resolve_oids(void); int host(const char *, const char *, int, int, @@ -708,7 +710,7 @@ enginefmt : IP4 STRING { } engineid[engineidlen++] = SNMP_ENGINEID_FMT_HH; memcpy(engineid + engineidlen, - SHA256($2, strlen($2), NULL), + SHA256($2, strlen($2), sha256), sizeof(engineid) - engineidlen); engineidlen = sizeof(engineid); engineid[0] |= SNMP_ENGINEID_NEW; @@ -761,7 +763,7 @@ enginefmt_local : enginefmt engineid[engineidlen++] = SNMP_ENGINEID_FMT_HH; memcpy(engineid + engineidlen, - SHA256(hostname, strlen(hostname), NULL), + SHA256(hostname, strlen(hostname), sha256), sizeof(engineid) - engineidlen); engineidlen = sizeof(engineid); engineid[0] |= SNMP_ENGINEID_NEW; @@ -1860,7 +1862,7 @@ parse_config(const char *filename, u_int flags) conf->sc_engineid[conf->sc_engineid_len++] |= SNMP_ENGINEID_FMT_HH; memcpy(conf->sc_engineid + conf->sc_engineid_len, - SHA256(hostname, strlen(hostname), NULL), + SHA256(hostname, strlen(hostname), sha256), sizeof(conf->sc_engineid) - conf->sc_engineid_len); conf->sc_engineid_len = sizeof(conf->sc_engineid); conf->sc_engineid[0] |= SNMP_ENGINEID_NEW; |