* Compute TCP-MD5 hash of an *OUTBOUND* TCP segment. * Parameters: * m pointer to head of mbuf chain * th pointer to TCP header * buf pointer to storage for computed MD5 digest * * Return 0 if successful, otherwise return error code. */
| 295 | * Return 0 if successful, otherwise return error code. |
| 296 | */ |
| 297 | static int |
| 298 | tcp_ipsec_output(struct mbuf *m, struct tcphdr *th, u_char *buf) |
| 299 | { |
| 300 | struct secasindex saidx; |
| 301 | struct secasvar *sav; |
| 302 | |
| 303 | setsockaddrs(m, &saidx.src, &saidx.dst); |
| 304 | saidx.proto = IPPROTO_TCP; |
| 305 | saidx.mode = IPSEC_MODE_TCPMD5; |
| 306 | saidx.reqid = 0; |
| 307 | sav = key_allocsa_tcpmd5(&saidx); |
| 308 | if (sav == NULL) { |
| 309 | KMOD_TCPSTAT_INC(tcps_sig_err_buildsig); |
| 310 | return (EACCES); |
| 311 | } |
| 312 | tcp_signature_compute(m, th, sav, buf); |
| 313 | key_freesav(&sav); |
| 314 | return (0); |
| 315 | } |
| 316 | |
| 317 | /* |
| 318 | * Initialize a TCP-MD5 SA. Called when the SA is being set up. |
nothing calls this directly
no test coverage detected