From nobody Sat Aug 03 22:25:53 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 4Wby2n66chz5RRgg; Sat, 03 Aug 2024 22:25:53 +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 4Wby2n5MM1z4G8B; Sat, 3 Aug 2024 22:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722723953; 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=ieLrD8SeRRuoACRPct9L5ciPwYylI8MXoSZcn32TrPk=; b=Wrm2Wpm+OXr4wa2Uf4E/Zm7wr/vF0nH2XX/s2euNvPMWXndaix4DS6RR/DvmvO5oKH8lOb GZy3pTEeCJsMrG3SUDR3wi80jpbRYMhXt2DCZIvBQMT0Dl/+S4xqTxd1Lv12RwiBkya+6d YIk6r3myigQGfBMroksE9DAVxyPCv1zyHfkpqZXH7vQF5/pMUUNBIU8Qxg1I/kw2gAzade KygtYO/tUQexLSzp3H63/stQmmUa+LPQWZqT8Ybu6QbHSRFg4EZKt/KKYZJvu7ptFOvc35 ljNt85xANnXyjoNoo9X4wGeTtFWw3OUcIKjMLoCEZB7GEnawI0JgXWtWkBeYEQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722723953; a=rsa-sha256; cv=none; b=pCwZrnm8tIikqg0ptRmctqwm+ef+0LadKyYwjQ8EorR91Oxxxzt3QS0oUNnqMbxnKCkTTt JRpHHzNYXW13c+m2XtYGNKY0/Dh0GIbLrcy1h98fO4RHwMf2/ja+H0XDvkOmfXAb5j3CZx 4yGZFUhWQXRIpzZLPSwSY43qiAnRUwyPjNuZEf/tS5eBfE8BIqzpXOp0aCv/PdzTHBtPIz WmzsymA101OGApURhO2uhLzn/+L/rP0/M8agZRpbEBNwZCnu+u4bzmCUEP9h0uiHx4hAaQ 7KCxzT1V6kEm8LFBA3BQFHyeF4QIGCddTO/eU1pI4NX4CTkx2D/RRzDDsDK7qA== 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=1722723953; 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=ieLrD8SeRRuoACRPct9L5ciPwYylI8MXoSZcn32TrPk=; b=tt5mgBJE3e/1+nHN2fOXVWMJITGpCymbOsNqpHvwg6Pzz9p9O6sS2eKufgyEh7hs4+pCTy AGelwmOl/uNxTDAxdJMP4XCI35qie3YxiAPpiK8MJYK/8q1HR4Dr3HgnLgY7vuwy1HUgA7 WGHdQAGb6oYJjvZwKLAmj4dR8BoDSbSSAlWBWePIYR/PGDqBr7HK8Z96Y65xVmtxYyVgpC jDpJ8QxCmRrDLZ9fNj++IMNsl/YThbs47xPe+1M0DUy/Uktk+vKxTPchaniQPJDntVMLrU 7J0o7Xpm56KS60xQ2SGw73mPLXMAZDpZdAUj+m4BE1SheZ2xI8wsiGHAeWfi8w== 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 4Wby2n4jB7zSyj; Sat, 3 Aug 2024 22:25:53 +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 473MPrE5026250; Sat, 3 Aug 2024 22:25:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 473MPrFx026247; Sat, 3 Aug 2024 22:25:53 GMT (envelope-from git) Date: Sat, 3 Aug 2024 22:25:53 GMT Message-Id: <202408032225.473MPrFx026247@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: 53da1bf035be - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 53da1bf035beef155fdb5d6e93215e01dc3090fd Auto-Submitted: auto-generated The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=53da1bf035beef155fdb5d6e93215e01dc3090fd commit 53da1bf035beef155fdb5d6e93215e01dc3090fd Author: Michael Tuexen AuthorDate: 2024-05-10 18:09:06 +0000 Commit: Michael Tuexen CommitDate: 2024-08-03 22:25:22 +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 0a8372a07362..dc31ffbc2161 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -2329,7 +2329,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, @@ -2352,7 +2352,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 a1742b2fffca..69c492bc58df 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -2570,7 +2570,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 e57e13654073..5c6ead92bf9b 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 19180b3cf725..e963c5cb466e 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1944,7 +1944,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++;