xform_ipcomp.c (281695) | xform_ipcomp.c (282046) |
---|---|
1/* $FreeBSD: head/sys/netipsec/xform_ipcomp.c 281695 2015-04-18 16:58:33Z ae $ */ | 1/* $FreeBSD: head/sys/netipsec/xform_ipcomp.c 282046 2015-04-27 00:55:56Z ae $ */ |
2/* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */ 3 4/*- 5 * Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org) 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 477 unchanged lines hidden (view full) --- 487 int error, skip; 488 489 tc = (struct tdb_crypto *) crp->crp_opaque; 490 IPSEC_ASSERT(tc != NULL, ("null opaque data area!")); 491 m = (struct mbuf *) crp->crp_buf; 492 skip = tc->tc_skip; 493 494 isr = tc->tc_isr; | 2/* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */ 3 4/*- 5 * Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org) 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 477 unchanged lines hidden (view full) --- 487 int error, skip; 488 489 tc = (struct tdb_crypto *) crp->crp_opaque; 490 IPSEC_ASSERT(tc != NULL, ("null opaque data area!")); 491 m = (struct mbuf *) crp->crp_buf; 492 skip = tc->tc_skip; 493 494 isr = tc->tc_isr; |
495 IPSEC_ASSERT(isr->sp != NULL, ("NULL isr->sp")); |
|
495 IPSECREQUEST_LOCK(isr); 496 sav = tc->tc_sav; 497 /* With the isr lock released SA pointer can be updated. */ 498 if (sav != isr->sav) { 499 IPCOMPSTAT_INC(ipcomps_notdb); 500 DPRINTF(("%s: SA expired while in crypto\n", __func__)); 501 error = ENOBUFS; /*XXX*/ 502 goto bad; --- 98 unchanged lines hidden (view full) --- 601 /* Release the crypto descriptor */ 602 free(tc, M_XDATA); 603 crypto_freereq(crp); 604 605 /* NB: m is reclaimed by ipsec_process_done. */ 606 error = ipsec_process_done(m, isr); 607 KEY_FREESAV(&sav); 608 IPSECREQUEST_UNLOCK(isr); | 496 IPSECREQUEST_LOCK(isr); 497 sav = tc->tc_sav; 498 /* With the isr lock released SA pointer can be updated. */ 499 if (sav != isr->sav) { 500 IPCOMPSTAT_INC(ipcomps_notdb); 501 DPRINTF(("%s: SA expired while in crypto\n", __func__)); 502 error = ENOBUFS; /*XXX*/ 503 goto bad; --- 98 unchanged lines hidden (view full) --- 602 /* Release the crypto descriptor */ 603 free(tc, M_XDATA); 604 crypto_freereq(crp); 605 606 /* NB: m is reclaimed by ipsec_process_done. */ 607 error = ipsec_process_done(m, isr); 608 KEY_FREESAV(&sav); 609 IPSECREQUEST_UNLOCK(isr); |
609 return error; | 610 KEY_FREESP(&isr->sp); 611 return (error); |
610bad: 611 if (sav) 612 KEY_FREESAV(&sav); 613 IPSECREQUEST_UNLOCK(isr); | 612bad: 613 if (sav) 614 KEY_FREESAV(&sav); 615 IPSECREQUEST_UNLOCK(isr); |
616 KEY_FREESP(&isr->sp); |
|
614 if (m) 615 m_freem(m); 616 free(tc, M_XDATA); 617 crypto_freereq(crp); | 617 if (m) 618 m_freem(m); 619 free(tc, M_XDATA); 620 crypto_freereq(crp); |
618 return error; | 621 return (error); |
619} 620 621static struct xformsw ipcomp_xformsw = { 622 XF_IPCOMP, XFT_COMP, "IPcomp", 623 ipcomp_init, ipcomp_zeroize, ipcomp_input, 624 ipcomp_output 625}; 626 627static void 628ipcomp_attach(void) 629{ 630 631 xform_register(&ipcomp_xformsw); 632} 633 634SYSINIT(ipcomp_xform_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, ipcomp_attach, NULL); | 622} 623 624static struct xformsw ipcomp_xformsw = { 625 XF_IPCOMP, XFT_COMP, "IPcomp", 626 ipcomp_init, ipcomp_zeroize, ipcomp_input, 627 ipcomp_output 628}; 629 630static void 631ipcomp_attach(void) 632{ 633 634 xform_register(&ipcomp_xformsw); 635} 636 637SYSINIT(ipcomp_xform_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, ipcomp_attach, NULL); |