From nobody Thu Aug 01 21:06:34 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WZhNB3cKWz5RS0f; Thu, 01 Aug 2024 21:06:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WZhNB35bTz4Qj6; Thu, 1 Aug 2024 21:06:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722546394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nJFbDbI6wvaknenLeTXwzJW23t8soN4h+ZaRsLBny0o=; b=veMMeik6Lm1Nmnq1weuRFQkaqRtKoViUlrduiAIOcWd9uAIF3TQJbPIAHmTpQNP82G8a/9 MlH6p3zexKaamQmbgoJNo3h300IB3xWC5CNbtQpS+9dc74tkqKfN+tfB5p1NaJktRussK5 dqL/aqrTXPySbkz8kiXD42EFGwO+Uultcbb3DbpxXI5w1tL1TX//uh6En9eMf2M5O0+vyq tU4hmdQKylvw0sw2yuDXSzAEwmiaujIva0k8piW9aCnTr4ag47vH+Nit7Tdu6Rz2u5Sai1 6CDhWX9nRukiSMm8YXpPxQJSVnEEG+vcoZUZmCzm2Fcs7zcc4fB5TpRYXRstag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722546394; a=rsa-sha256; cv=none; b=FyoS1uAdc7i3eOS64VvAw3+cl5FrmLBYgKbrE4Tf7RG9fbtM13QWBEPu/OR6g+SYlDbWwi V5pGrzvvF2r9ePumivLAwjOYGs/TmejmVksMUkbbQA14PqwU7D1mPdeYtV2KNRUl9c3Kml 3BckLGZCjqAh+PgXyeZlBukp0uVbISnJ3uCJxNiaencKpNabzpkN8xvPNvWGU4AwtuQfYZ Wvv6PeOtc3Qh194NVb7BpA+r3/SfOz+0+oO3wCBUTgOAODS0d/FgCJyEPRTLs00a0vayKv Dz7GsqqHL8zWqQeBtFsXiEGz6mBnxkgV07iGDRBXTQPW4rEncqX1Ymz3xuDyrA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722546394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nJFbDbI6wvaknenLeTXwzJW23t8soN4h+ZaRsLBny0o=; b=gghtRo/pL1fyVUY7BblHzZklKIEf7vVu8DAGg1f1cKmsWmxxnEG8gYjb1mwiLYER/aIbbX 3bIOA5n7XDAuqKfpKf5TTlKHGCVgNuvSxJwJrJcSAfhyvUJ+7bJmfQRjzY6uWh65oVNDFN h8zGbRTUu/KRC4qtRgree0TaflnlIQjmEH1dDqenEWnEdfdBlHv0ybs7jyGv1u0nYGPQvi x/5k+7SVstiEP0ZKGolusS3Q6sEWiPUsPmDoj9WQ95jAxbJ3jlVxgGDdj0LlZGGkR2Enmr b5PNnUeR42Ti180lKwGHBR4G7a78TQxkvlQFvzZmNuvD3F4KluBYvId+CRxNqg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WZhNB2hvTz10pr; Thu, 1 Aug 2024 21:06:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 471L6YxW091120; Thu, 1 Aug 2024 21:06:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 471L6YMn091117; Thu, 1 Aug 2024 21:06:34 GMT (envelope-from git) Date: Thu, 1 Aug 2024 21:06:34 GMT Message-Id: <202408012106.471L6YMn091117@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: e25611e85841 - stable/13 - sctp: store cookie secret change time as time_t List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e25611e8584178822a6587d74591db5557b5db69 Auto-Submitted: auto-generated The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=e25611e8584178822a6587d74591db5557b5db69 commit e25611e8584178822a6587d74591db5557b5db69 Author: Michael Tuexen AuthorDate: 2024-05-10 18:09:06 +0000 Commit: Michael Tuexen CommitDate: 2024-08-01 21:05:57 +0000 sctp: store cookie secret change time as time_t Reported by: Coverity Scan CID: 1492349 CID: 1493281 (cherry picked from commit 9d8a3718e24c9ec1ffca6efba64aba3e308aee96) --- sys/netinet/sctp_input.c | 4 ++-- sys/netinet/sctp_pcb.c | 2 +- sys/netinet/sctp_pcb.h | 4 ++-- sys/netinet/sctputil.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index b6239b0d9ad6..65a60d539a5e 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -2327,7 +2327,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset, } ep = &(*inp_p)->sctp_ep; /* which cookie is it? */ - if ((cookie->time_entered.tv_sec < (long)ep->time_of_secret_change) && + if ((cookie->time_entered.tv_sec < ep->time_of_secret_change) && (ep->current_secret_number != ep->last_secret_number)) { /* it's the old cookie */ (void)sctp_hmac_m(SCTP_HMAC, @@ -2350,7 +2350,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset, /* compare the received digest with the computed digest */ if (timingsafe_bcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) != 0) { /* try the old cookie? */ - if ((cookie->time_entered.tv_sec == (long)ep->time_of_secret_change) && + if ((cookie->time_entered.tv_sec == ep->time_of_secret_change) && (ep->current_secret_number != ep->last_secret_number)) { /* compute digest with old */ (void)sctp_hmac_m(SCTP_HMAC, diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 3435377e1064..5d603a3f26d0 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -2569,7 +2569,7 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id) /* Setup the initial secret */ (void)SCTP_GETTIME_TIMEVAL(&time); - m->time_of_secret_change = (unsigned int)time.tv_sec; + m->time_of_secret_change = time.tv_sec; for (i = 0; i < SCTP_NUMBER_OF_SECRETS; i++) { m->secret_key[0][i] = sctp_select_initial_TSN(m); diff --git a/sys/netinet/sctp_pcb.h b/sys/netinet/sctp_pcb.h index ca51f519a24d..4334595f208f 100644 --- a/sys/netinet/sctp_pcb.h +++ b/sys/netinet/sctp_pcb.h @@ -263,8 +263,8 @@ struct sctp_base_info { * access /dev/random. */ struct sctp_pcb { - unsigned int time_of_secret_change; /* number of seconds from - * timeval.tv_sec */ + time_t time_of_secret_change; /* number of seconds from + * timeval.tv_sec */ uint32_t secret_key[SCTP_HOW_MANY_SECRETS][SCTP_NUMBER_OF_SECRETS]; unsigned int size_of_a_cookie; diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 8b2e95158ebc..68484409d038 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1942,7 +1942,7 @@ sctp_timeout_handler(void *t) type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timosecret); (void)SCTP_GETTIME_TIMEVAL(&tv); - inp->sctp_ep.time_of_secret_change = (unsigned int)tv.tv_sec; + inp->sctp_ep.time_of_secret_change = tv.tv_sec; inp->sctp_ep.last_secret_number = inp->sctp_ep.current_secret_number; inp->sctp_ep.current_secret_number++;