From nobody Fri May 10 19:31:27 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 4VbfBm0zrVz5KJ4L; Fri, 10 May 2024 19:31:28 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VbfBm0Pkcz4Pnq; Fri, 10 May 2024 19:31:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715369488; 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=3I8YMlCTDGcESEabS2NZNF1D47+lWmBI+bHBJvHNMug=; b=RxLIsc4X0dml32v3fyZ9HST+W3mR4yV8H9O203ay9LsB1tk9jRH2AwdnkFYN06p63Dji+E DrIHYPmaHCAu17SVA6QlNczz0fRA4bQozIoru6hW4RhzqOb3EEsr97a1rJjwjx3NdLS4AI /aa2+fBNLAlc/fpcYEUIYpEof/AkNAFLyRoU2WrO2/ir6xA5KcTYbh5e99/lPpK6jzOf8i 2gRXzg/K4pVhYUZS+EwLTaRUI8ZBC3kc302JP11ntG/GIIPcfJsmBCxMqbfHb5bipaVIwc fXR/rE6VbdPk5HlAW7qfFvarlfQ/vhgBaEHtqyg2lTDtQpQv+BXEPF9+P+v79A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715369488; a=rsa-sha256; cv=none; b=Jf3abKlJl7r8XjOol+7VC7cXAfe4jUeWRcVJEm1LwognIj9lvOAhdBGmELkvg8FVw1fAgr H+NGnJQDoK58kn7S+cXCdGuWA6RnncwCAJGC/HEA8tthLxdayWXoXrm10fft26sOgWKoDN PGIfASdHNZeKXR2nt/g7yZuVV02YFC6v0yCC5AR7wA2RPO8cuhoxTlB/AQR5+3Pc38U1g3 MS7Z95Bx3dvgDdGC/46EqAexvN7pY6s7pr/WyiWXzdg6jgep//OJuUKlRtb7PSXtfzTJI1 MrHW6j4OEtS1scVwKsaRjHj2bNdHINuL+DQ49VxDFwpEt4H9n+pxT8M1Scx8ag== 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=1715369488; 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=3I8YMlCTDGcESEabS2NZNF1D47+lWmBI+bHBJvHNMug=; b=VDiQ6l45FfNuy2wG/ehq9uHYGpZOAbzcLQ8rbA2+cnPyYcM4DdxOnTGJFWQpClnr5y/aij 5bjw3qcmjhX5nlUOSL0Kj6patnLWS3tvXzCMxuq/O+PW4WSNTDekW6GEc0jxmq79f/c9/d rAc4t6TIjApvkwLqDd+UJYjuKQzfU8L+mmMCmT96q+fEWjmg+I0Erwbq6Nr2JkZUyZw/iD j/j+2k4nGPElTdzZGXezm8mxHaEtP0GlAOOe5Pbc8e9KCy8datVoq0C3Q96oLKhLOW/ggN 985Ailj8Gi/w00UYDA2hQQR3J1L5ZtdcafIGzSElOgfVTZtTj/ELW9UBS4QwfQ== 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 4VbfBl74TVzqbf; Fri, 10 May 2024 19:31:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44AJVRcc004804; Fri, 10 May 2024 19:31:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44AJVRaL004801; Fri, 10 May 2024 19:31:27 GMT (envelope-from git) Date: Fri, 10 May 2024 19:31:27 GMT Message-Id: <202405101931.44AJVRaL004801@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 9d8a3718e24c - main - sctp: store cookie secret change time as time_t Reported by: Coverity Scan CID: 1492349 CID: 1493281 MFC after: 3 days 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/main X-Git-Reftype: branch X-Git-Commit: 9d8a3718e24c9ec1ffca6efba64aba3e308aee96 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=9d8a3718e24c9ec1ffca6efba64aba3e308aee96 commit 9d8a3718e24c9ec1ffca6efba64aba3e308aee96 Author: Michael Tuexen AuthorDate: 2024-05-10 18:09:06 +0000 Commit: Michael Tuexen CommitDate: 2024-05-10 18:14:16 +0000 sctp: store cookie secret change time as time_t Reported by: Coverity Scan CID: 1492349 CID: 1493281 MFC after: 3 days --- 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 1509ac13901e..65ac584827e0 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 b23efd9c8968..22d45d150544 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++;