2006-02-01 13:55:03 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1982, 1986, 1988, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2007-10-07 20:44:24 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
2006-02-01 13:55:03 +00:00
|
|
|
#include "opt_ipsec.h"
|
2009-02-03 11:00:43 +00:00
|
|
|
#include "opt_sctp.h"
|
2006-02-01 13:55:03 +00:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
2008-03-14 16:38:11 +00:00
|
|
|
#include <sys/errno.h>
|
2006-02-01 13:55:03 +00:00
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/malloc.h>
|
|
|
|
#include <sys/mbuf.h>
|
|
|
|
#include <sys/protosw.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/socketvar.h>
|
|
|
|
#include <sys/sysctl.h>
|
|
|
|
|
|
|
|
#include <net/if.h>
|
2013-10-26 17:58:36 +00:00
|
|
|
#include <net/if_var.h>
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
#include <net/vnet.h>
|
2006-02-01 13:55:03 +00:00
|
|
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/in_systm.h>
|
|
|
|
#include <netinet/in_var.h>
|
|
|
|
#include <netinet/ip.h>
|
|
|
|
#include <netinet/in_pcb.h>
|
|
|
|
#include <netinet/ip_var.h>
|
|
|
|
#include <netinet/ip_options.h>
|
|
|
|
#include <netinet/ip_ipsec.h>
|
2009-02-03 11:00:43 +00:00
|
|
|
#ifdef SCTP
|
|
|
|
#include <netinet/sctp_crc32.h>
|
|
|
|
#endif
|
2006-02-01 13:55:03 +00:00
|
|
|
|
|
|
|
#include <machine/in_cksum.h>
|
|
|
|
|
|
|
|
#include <netipsec/ipsec.h>
|
|
|
|
#include <netipsec/xform.h>
|
|
|
|
#include <netipsec/key.h>
|
|
|
|
|
|
|
|
extern struct protosw inetsw[];
|
|
|
|
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
#ifdef IPSEC_FILTERTUNNEL
|
2010-11-22 19:32:54 +00:00
|
|
|
static VNET_DEFINE(int, ip4_ipsec_filtertunnel) = 1;
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
#else
|
2010-11-22 19:32:54 +00:00
|
|
|
static VNET_DEFINE(int, ip4_ipsec_filtertunnel) = 0;
|
2009-05-23 16:42:38 +00:00
|
|
|
#endif
|
2009-07-16 21:13:04 +00:00
|
|
|
#define V_ip4_ipsec_filtertunnel VNET(ip4_ipsec_filtertunnel)
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
|
|
|
|
SYSCTL_DECL(_net_inet_ipsec);
|
2014-11-07 09:39:05 +00:00
|
|
|
SYSCTL_INT(_net_inet_ipsec, OID_AUTO, filtertunnel,
|
|
|
|
CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip4_ipsec_filtertunnel), 0,
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
"If set filter packets from an IPsec tunnel.");
|
2009-05-23 16:42:38 +00:00
|
|
|
|
2006-02-01 13:55:03 +00:00
|
|
|
/*
|
|
|
|
* Check if we have to jump over firewall processing for this packet.
|
|
|
|
* Called from ip_input().
|
|
|
|
* 1 = jump over firewall, 0 = packet goes through firewall.
|
|
|
|
*/
|
|
|
|
int
|
2007-08-05 16:16:15 +00:00
|
|
|
ip_ipsec_filtertunnel(struct mbuf *m)
|
2006-02-01 13:55:03 +00:00
|
|
|
{
|
2009-05-23 16:42:38 +00:00
|
|
|
|
2006-02-01 13:55:03 +00:00
|
|
|
/*
|
2011-06-08 03:02:11 +00:00
|
|
|
* Bypass packet filtering for packets previously handled by IPsec.
|
2006-02-01 13:55:03 +00:00
|
|
|
*/
|
2009-05-23 16:42:38 +00:00
|
|
|
if (!V_ip4_ipsec_filtertunnel &&
|
|
|
|
m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL) != NULL)
|
2006-02-01 13:55:03 +00:00
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check if this packet has an active SA and needs to be dropped instead
|
|
|
|
* of forwarded.
|
2014-12-11 16:53:29 +00:00
|
|
|
* Called from ip_forward().
|
2006-02-01 13:55:03 +00:00
|
|
|
* 1 = drop packet, 0 = forward packet.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
ip_ipsec_fwd(struct mbuf *m)
|
|
|
|
{
|
2014-12-11 18:55:54 +00:00
|
|
|
|
|
|
|
return (ipsec4_in_reject(m, NULL));
|
2006-02-01 13:55:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check if protocol type doesn't have a further header and do IPSEC
|
|
|
|
* decryption or reject right now. Protocols with further headers get
|
|
|
|
* their IPSEC treatment within the protocol specific processing.
|
|
|
|
* Called from ip_input().
|
|
|
|
* 1 = drop packet, 0 = continue processing packet.
|
|
|
|
*/
|
|
|
|
int
|
2014-12-11 14:58:55 +00:00
|
|
|
ip_ipsec_input(struct mbuf *m, int nxt)
|
2006-02-01 13:55:03 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* enforce IPsec policy checking if we are seeing last header.
|
|
|
|
* note that we do not visit this with protocols with pcb layer
|
|
|
|
* code - like udp/tcp/raw ip.
|
|
|
|
*/
|
2014-12-11 18:55:54 +00:00
|
|
|
if ((inetsw[ip_protox[nxt]].pr_flags & PR_LASTHDR) != 0)
|
|
|
|
return (ipsec4_in_reject(m, NULL));
|
2014-12-11 14:58:55 +00:00
|
|
|
return (0);
|
2006-02-01 13:55:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Compute the MTU for a forwarded packet that gets IPSEC encapsulated.
|
|
|
|
* Called from ip_forward().
|
|
|
|
* Returns MTU suggestion for ICMP needfrag reply.
|
|
|
|
*/
|
|
|
|
int
|
2008-04-09 05:17:18 +00:00
|
|
|
ip_ipsec_mtu(struct mbuf *m, int mtu)
|
2006-02-01 13:55:03 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* If the packet is routed over IPsec tunnel, tell the
|
|
|
|
* originator the tunnel MTU.
|
|
|
|
* tunnel MTU = if MTU - sizeof(IP) - ESP/AH hdrsiz
|
|
|
|
* XXX quickhack!!!
|
|
|
|
*/
|
2014-12-02 04:20:50 +00:00
|
|
|
return (mtu - ipsec_hdrsiz(m, IPSEC_DIR_OUTBOUND, NULL));
|
2006-02-01 13:55:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Called from ip_output().
|
|
|
|
* 1 = drop packet, 0 = continue processing packet,
|
2007-07-03 12:13:45 +00:00
|
|
|
* -1 = packet was reinjected and stop processing packet
|
2006-02-01 13:55:03 +00:00
|
|
|
*/
|
|
|
|
int
|
2014-12-11 18:35:34 +00:00
|
|
|
ip_ipsec_output(struct mbuf **m, struct inpcb *inp, int *error)
|
2006-02-01 13:55:03 +00:00
|
|
|
{
|
2014-12-11 14:43:44 +00:00
|
|
|
struct secpolicy *sp;
|
2015-10-27 00:42:15 +00:00
|
|
|
|
2015-10-29 21:26:32 +00:00
|
|
|
if (!key_havesp(IPSEC_DIR_OUTBOUND))
|
2015-10-27 00:42:15 +00:00
|
|
|
return 0;
|
|
|
|
|
2006-02-01 13:55:03 +00:00
|
|
|
/*
|
|
|
|
* Check the security policy (SP) for the packet and, if
|
|
|
|
* required, do IPsec-related processing. There are two
|
|
|
|
* cases here; the first time a packet is sent through
|
|
|
|
* it will be untagged and handled by ipsec4_checkpolicy.
|
|
|
|
* If the packet is resubmitted to ip_output (e.g. after
|
|
|
|
* AH, ESP, etc. processing), there will be a tag to bypass
|
|
|
|
* the lookup and related policy checking.
|
|
|
|
*/
|
2014-12-11 14:43:44 +00:00
|
|
|
if (m_tag_find(*m, PACKET_TAG_IPSEC_OUT_DONE, NULL) != NULL) {
|
|
|
|
*error = 0;
|
|
|
|
return (0);
|
2006-02-01 13:55:03 +00:00
|
|
|
}
|
2014-12-11 18:35:34 +00:00
|
|
|
sp = ipsec4_checkpolicy(*m, IPSEC_DIR_OUTBOUND, error, inp);
|
2006-02-01 13:55:03 +00:00
|
|
|
/*
|
|
|
|
* There are four return cases:
|
|
|
|
* sp != NULL apply IPsec policy
|
|
|
|
* sp == NULL, error == 0 no IPsec handling needed
|
|
|
|
* sp == NULL, error == -EINVAL discard packet w/o error
|
|
|
|
* sp == NULL, error != 0 discard packet, report error
|
|
|
|
*/
|
|
|
|
if (sp != NULL) {
|
|
|
|
/*
|
|
|
|
* Do delayed checksums now because we send before
|
|
|
|
* this is done in the normal processing path.
|
|
|
|
*/
|
|
|
|
if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
|
|
|
|
in_delayed_cksum(*m);
|
|
|
|
(*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
|
|
|
|
}
|
2009-02-03 11:00:43 +00:00
|
|
|
#ifdef SCTP
|
|
|
|
if ((*m)->m_pkthdr.csum_flags & CSUM_SCTP) {
|
2012-10-22 21:09:03 +00:00
|
|
|
struct ip *ip = mtod(*m, struct ip *);
|
|
|
|
|
2010-03-12 22:58:52 +00:00
|
|
|
sctp_delayed_cksum(*m, (uint32_t)(ip->ip_hl << 2));
|
2009-02-03 11:00:43 +00:00
|
|
|
(*m)->m_pkthdr.csum_flags &= ~CSUM_SCTP;
|
|
|
|
}
|
|
|
|
#endif
|
2006-02-01 13:55:03 +00:00
|
|
|
|
|
|
|
/* NB: callee frees mbuf */
|
2014-12-11 17:34:49 +00:00
|
|
|
*error = ipsec4_process_packet(*m, sp->req);
|
2015-09-30 08:16:33 +00:00
|
|
|
KEY_FREESP(&sp);
|
2008-03-14 16:38:11 +00:00
|
|
|
if (*error == EJUSTRETURN) {
|
|
|
|
/*
|
|
|
|
* We had a SP with a level of 'use' and no SA. We
|
|
|
|
* will just continue to process the packet without
|
|
|
|
* IPsec processing and return without error.
|
|
|
|
*/
|
|
|
|
*error = 0;
|
|
|
|
goto done;
|
|
|
|
}
|
2006-02-01 13:55:03 +00:00
|
|
|
/*
|
|
|
|
* Preserve KAME behaviour: ENOENT can be returned
|
|
|
|
* when an SA acquire is in progress. Don't propagate
|
|
|
|
* this to user-level; it confuses applications.
|
|
|
|
*
|
|
|
|
* XXX this will go away when the SADB is redone.
|
|
|
|
*/
|
|
|
|
if (*error == ENOENT)
|
|
|
|
*error = 0;
|
|
|
|
goto reinjected;
|
|
|
|
} else { /* sp == NULL */
|
|
|
|
|
|
|
|
if (*error != 0) {
|
|
|
|
/*
|
|
|
|
* Hack: -EINVAL is used to signal that a packet
|
|
|
|
* should be silently discarded. This is typically
|
|
|
|
* because we asked key management for an SA and
|
|
|
|
* it was delayed (e.g. kicked up to IKE).
|
|
|
|
*/
|
|
|
|
if (*error == -EINVAL)
|
|
|
|
*error = 0;
|
|
|
|
goto bad;
|
|
|
|
}
|
2014-12-11 14:43:44 +00:00
|
|
|
/* No IPsec processing for this packet. */
|
2006-02-01 13:55:03 +00:00
|
|
|
}
|
|
|
|
done:
|
2015-04-27 01:11:09 +00:00
|
|
|
return (0);
|
2006-02-01 13:55:03 +00:00
|
|
|
reinjected:
|
2015-04-27 00:55:56 +00:00
|
|
|
return (-1);
|
2006-02-01 13:55:03 +00:00
|
|
|
bad:
|
|
|
|
if (sp != NULL)
|
|
|
|
KEY_FREESP(&sp);
|
|
|
|
return 1;
|
|
|
|
}
|