* Initialize transform support in an sav. */
| 209 | * Initialize transform support in an sav. |
| 210 | */ |
| 211 | int |
| 212 | xform_init(struct secasvar *sav, u_short xftype) |
| 213 | { |
| 214 | struct xformsw *entry; |
| 215 | int ret; |
| 216 | |
| 217 | IPSEC_ASSERT(sav->tdb_xform == NULL, |
| 218 | ("tdb_xform is already initialized")); |
| 219 | |
| 220 | XFORMS_LOCK(); |
| 221 | LIST_FOREACH(entry, &xforms, chain) { |
| 222 | if (entry->xf_type == xftype) { |
| 223 | ret = ipsec_kmod_enter(&entry->xf_cntr); |
| 224 | XFORMS_UNLOCK(); |
| 225 | if (ret != 0) |
| 226 | return (ret); |
| 227 | ret = (*entry->xf_init)(sav, entry); |
| 228 | ipsec_kmod_exit(&entry->xf_cntr); |
| 229 | return (ret); |
| 230 | } |
| 231 | } |
| 232 | XFORMS_UNLOCK(); |
| 233 | return (EINVAL); |
| 234 | } |
| 235 | |
| 236 | #ifdef IPSEC_SUPPORT |
| 237 | /* |
no test coverage detected