Skip to content

More various fixes to reports from static analyzers#100

Open
gasbytes wants to merge 1 commit intowolfSSL:masterfrom
gasbytes:2026-04-14-various-fixes
Open

More various fixes to reports from static analyzers#100
gasbytes wants to merge 1 commit intowolfSSL:masterfrom
gasbytes:2026-04-14-various-fixes

Conversation

@gasbytes
Copy link
Copy Markdown
Contributor

  • add esp encapsulation to tcp_send_empty_immediate so pure acks on ipsec
  • basedd connections are not sent in plaintext when the tx fifo is full
  • (and the link layer is being used)
  • add esp encapsulation to tcp_send_zero_wnd_probe so zero_window probes on ipsec-protected connections are not sent in plaintext
  • add esp encapsulation to wolfip_forwad_packet so forwarded ip packets
  • are not sent in plaintext when the egresse interface has esp sa
  • ocnfigureed
  • reset sift-sdown cursor to root on each iteration of
  • timers_binheapp_poop so that skipping cancelled timers does not b reak
  • the min-heap invariant
  • send syn-ack immediately in the listen to syn_rcvd transition instead of deferring it until accept() or the ctrl_rto timer fires.
  • validate arp reply sender ip against broadcast, multicast, zero and own address before caching, matching the existing arp request handler checks
  • deconfigure the offered ip address when dhcp request retries are exhausted so the device does not keep using unconfirmed lease.
  • extend multicast classification tests to cover the 225-239 range and boundaries so mask constant mutations are detected
  • add ssrr source routine drop test to cover 0x89 variant type branch alongside the existing lsrr test
  • add multicast source address test for ip_recv to cover the wolfip_ip_is_multicast branch of the rfc 1122 source validation
  • add multicast sender test for arp request validation to cover the wolfip_ip_is_multicast branch of the cache poisoning guard.
  • add esp encapsulation to tcp_send_reset_reply so rst segments toward esp_protected peers are not sent in plaintext
  • nclude tcp timestamp option in zero-window probes when timestamps are negotiated, per rfc 7323 (around section 3.2)
  • process ack+fin segments in syn_rcvd state per rfc 9293 instead of silently discarding non-pure acks.
  • Compute ICMP TTL exceeded and destination unreachable original packet
  • quote size from the actual IP header length so packets with IP options
  • include the full header plus 8 bytes of transport data.
  • seed ipcounter with a random value at init so ip identification fields on non-df packets are not predictable from zero
  • set the df bit on tcp rst replies to match the normal tcp output patch and prevent ip id observability
  • zero hmac hash buffers on the stack after icv comparison and copy to prevent residual keyed hash output from persisting
  • zero gcm/gmac nonce buffers on the stack after use to prevent residual implicit salt bytes from persisting

@gasbytes gasbytes force-pushed the 2026-04-14-various-fixes branch from 6c9bb04 to 7022abc Compare April 14, 2026 17:05
…psec

- basedd connections are not sent in plaintext when the tx fifo is full
- (and the link layer is being used)
- add esp encapsulation to tcp_send_zero_wnd_probe so zero_window probes on ipsec-protected connections are not sent in plaintext
- add esp encapsulation to wolfip_forwad_packet so forwarded ip packets
- are not sent in plaintext when the egresse interface has esp sa
- ocnfigureed
- reset sift-sdown cursor to root on each iteration of
- timers_binheapp_poop so that skipping cancelled timers does  not b reak
- the min-heap invariant
- send syn-ack immediately in the listen to syn_rcvd transition instead of deferring it until accept() or the ctrl_rto timer fires.
- validate arp reply sender ip against broadcast, multicast, zero and own address before caching, matching the existing arp request handler checks
- deconfigure the offered ip address when dhcp request retries are exhausted so the device does not keep using unconfirmed lease.
- extend multicast classification tests to cover the 225-239 range and boundaries so mask constant mutations are detected
- add ssrr source routine drop test to cover 0x89 variant type branch alongside the existing lsrr test
- add multicast source address test for ip_recv to cover the wolfip_ip_is_multicast branch of the rfc 1122 source validation
- add multicast sender test for arp request validation to cover the wolfip_ip_is_multicast branch of the cache poisoning guard.
- add esp encapsulation to tcp_send_reset_reply so rst segments toward esp_protected peers are not sent in plaintext
- nclude tcp timestamp option in zero-window probes when timestamps are negotiated, per rfc 7323 (around section 3.2)
- process ack+fin segments in syn_rcvd state per rfc 9293 instead of silently discarding non-pure acks.
- Compute ICMP TTL exceeded and destination unreachable original packet
- quote size from the actual IP header length so packets with IP options
- include the full header plus 8 bytes of transport data.
- seed ipcounter with a random value at init so ip identification fields on non-df packets are not predictable from zero
- set the df bit on tcp rst replies to match the normal tcp output patch and prevent ip id observability
- zero hmac hash buffers on the stack after icv comparison and copy to prevent residual keyed hash output from persisting
- zero gcm/gmac nonce buffers on the stack after use to prevent residual implicit salt bytes from persisting
@gasbytes gasbytes force-pushed the 2026-04-14-various-fixes branch from 7022abc to d0b0188 Compare April 14, 2026 18:27
@gasbytes gasbytes marked this pull request as ready for review April 14, 2026 18:51
@gasbytes gasbytes requested a review from danielinux April 14, 2026 18:51
@gasbytes gasbytes requested a review from philljj April 14, 2026 19:05
if (err == 0) {
memcpy(icv, hash, esp_sa->icv_len);
}
wc_ForceZero(hash, sizeof(hash));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think force zeroing this hash is necessary.

The ICV is a public value, and is calculated from public material (the transmitted payload).

}

rfc4106_dec_out:
wc_ForceZero(nonce, sizeof(nonce));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is necessary.

The nonce is

| 4 byte salt | 8 byte iv|

The iv is public, and transmitted in the packet.

The salt has no secrecy requirement per RFC4106:

   Salt                                                                         
      The salt field is a four-octet value that is assigned at the              
      beginning of the security association, and then remains constant          
      for the life of the security association.  The salt SHOULD be             
      unpredictable (i.e., chosen at random) before it is selected, but         
      need not be secret.

I guess force zeroing just the 4 byte salt portion could be justified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants