aboutsummaryrefslogtreecommitdiff
path: root/contrib/ntp/libntp/a_md5encrypt.c
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2023-06-06 12:43:04 +0000
committerCy Schubert <cy@FreeBSD.org>2023-06-09 13:35:55 +0000
commit5d3fa3d71c3166f573b045a870e45e464399e2ef (patch)
tree4a7d4fbf837e96684e879cdb01772dda32d86bbf /contrib/ntp/libntp/a_md5encrypt.c
parent8eba66320128e4258b2e0b676d1e6b7a96f81532 (diff)
ntp: import ntp-4.2.8p17
Fixes two small bugs including one regression. Merge commit 'ab1f1aa8333369a83ff284848fc3fc2e52d5f29f' (cherry picked from commit e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5) ntp: Fix build Two files used to obtain time from reference clocks did not include ntp_types.h resulting in an undefined NONEMPTY_TRANSLATION_UNIT. Fixes: e6bfd18d21b2 (cherry picked from commit 82aa1470c94c55db31c0168d65f8a08fa1d41378)
Diffstat (limited to 'contrib/ntp/libntp/a_md5encrypt.c')
-rw-r--r--contrib/ntp/libntp/a_md5encrypt.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/contrib/ntp/libntp/a_md5encrypt.c b/contrib/ntp/libntp/a_md5encrypt.c
index 6011af52af6d..7a372969123f 100644
--- a/contrib/ntp/libntp/a_md5encrypt.c
+++ b/contrib/ntp/libntp/a_md5encrypt.c
@@ -9,7 +9,6 @@
#include "ntp_string.h"
#include "ntp_stdlib.h"
#include "ntp.h"
-#include "ntp_md5.h" /* provides OpenSSL digest API */
#include "isc/string.h"
typedef struct {
@@ -22,10 +21,12 @@ typedef struct {
size_t len;
} rwbuffT;
+
#if defined(OPENSSL) && defined(ENABLE_CMAC)
static size_t
cmac_ctx_size(
- CMAC_CTX * ctx)
+ CMAC_CTX * ctx
+ )
{
size_t mlen = 0;
@@ -36,14 +37,16 @@ cmac_ctx_size(
}
return mlen;
}
-#endif /*OPENSSL && ENABLE_CMAC*/
+#endif /* OPENSSL && ENABLE_CMAC */
+
static size_t
make_mac(
const rwbuffT * digest,
int ktype,
const robuffT * key,
- const robuffT * msg)
+ const robuffT * msg
+ )
{
/*
* Compute digest of key concatenated with packet. Note: the
@@ -66,8 +69,8 @@ make_mac(
/* adjust key size (zero padded buffer) if necessary */
if (AES_128_KEY_SIZE > key->len) {
memcpy(keybuf, keyptr, key->len);
- memset((keybuf + key->len), 0,
- (AES_128_KEY_SIZE - key->len));
+ zero_mem((keybuf + key->len),
+ (AES_128_KEY_SIZE - key->len));
keyptr = keybuf;
}
@@ -107,10 +110,10 @@ make_mac(
goto mac_fail;
}
- #ifdef EVP_MD_CTX_FLAG_NON_FIPS_ALLOW
+ #ifdef EVP_MD_CTX_FLAG_NON_FIPS_ALLOW
/* make sure MD5 is allowd */
EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
- #endif
+ #endif
/* [Bug 3457] DON'T use plain EVP_DigestInit! It would
* kill the flags! */
if (!EVP_DigestInit_ex(ctx, EVP_get_digestbynid(ktype), NULL)) {
@@ -239,8 +242,8 @@ MD5authdecrypt(
dlen = MAX_MDG_LEN;
if (size != (size_t)dlen + KEY_MAC_LEN) {
msyslog(LOG_ERR,
- "MAC decrypt: MAC length error: len=%zu key=%d",
- size, keyno);
+ "MAC decrypt: MAC length error: len=%u key=%d",
+ (u_int)size, keyno);
return (0);
}
return !isc_tsmemcmp(digest,