mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
sctp: store cookie secret change time as time_t
Reported by: Coverity Scan CID: 1492349 CID: 1493281 MFC after: 3 days
This commit is contained in:
parent
0b272e0926
commit
9d8a3718e2
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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++;
|
||||
|
Loading…
Reference in New Issue
Block a user