xform_ah.c (ec31427d3f2f35c68e07d0b41b1bb34ed82c82e4) | xform_ah.c (a0196c3c891ccf2ee88854f9798fd8e44d0e9f16) |
---|---|
1/* $FreeBSD$ */ 2/* $OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */ 3/*- 4 * The authors of this code are John Ioannidis (ji@tla.org), 5 * Angelos D. Keromytis (kermit@csd.uch.gr) and 6 * Niels Provos (provos@physnet.uni-hamburg.de). 7 * 8 * The original version of this code was written by John Ioannidis --- 187 unchanged lines hidden (view full) --- 196 197 sav->tdb_xform = xsp; 198 sav->tdb_authalgxform = thash; 199 200 /* Initialize crypto session. */ 201 bzero(cria, sizeof (*cria)); 202 cria->cri_alg = sav->tdb_authalgxform->type; 203 cria->cri_klen = _KEYBITS(sav->key_auth); | 1/* $FreeBSD$ */ 2/* $OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */ 3/*- 4 * The authors of this code are John Ioannidis (ji@tla.org), 5 * Angelos D. Keromytis (kermit@csd.uch.gr) and 6 * Niels Provos (provos@physnet.uni-hamburg.de). 7 * 8 * The original version of this code was written by John Ioannidis --- 187 unchanged lines hidden (view full) --- 196 197 sav->tdb_xform = xsp; 198 sav->tdb_authalgxform = thash; 199 200 /* Initialize crypto session. */ 201 bzero(cria, sizeof (*cria)); 202 cria->cri_alg = sav->tdb_authalgxform->type; 203 cria->cri_klen = _KEYBITS(sav->key_auth); |
204 cria->cri_key = _KEYBUF(sav->key_auth); | 204 cria->cri_key = sav->key_auth->key_data; |
205 206 return 0; 207} 208 209/* 210 * ah_init() is called when an SPI is being set up. 211 */ 212static int --- 13 unchanged lines hidden (view full) --- 226 * NB: public for use by esp_zeroize (XXX). 227 */ 228int 229ah_zeroize(struct secasvar *sav) 230{ 231 int err; 232 233 if (sav->key_auth) | 205 206 return 0; 207} 208 209/* 210 * ah_init() is called when an SPI is being set up. 211 */ 212static int --- 13 unchanged lines hidden (view full) --- 226 * NB: public for use by esp_zeroize (XXX). 227 */ 228int 229ah_zeroize(struct secasvar *sav) 230{ 231 int err; 232 233 if (sav->key_auth) |
234 bzero(_KEYBUF(sav->key_auth), _KEYLEN(sav->key_auth)); | 234 bzero(sav->key_auth->key_data, _KEYLEN(sav->key_auth)); |
235 236 err = crypto_freesession(sav->tdb_cryptoid); 237 sav->tdb_cryptoid = 0; 238 sav->tdb_authalgxform = NULL; 239 sav->tdb_xform = NULL; 240 return err; 241} 242 --- 374 unchanged lines hidden (view full) --- 617 IPSEC_ASSERT(crda != NULL, ("null crypto descriptor")); 618 619 crda->crd_skip = 0; 620 crda->crd_len = m->m_pkthdr.len; 621 crda->crd_inject = skip + rplen; 622 623 /* Authentication operation. */ 624 crda->crd_alg = ahx->type; | 235 236 err = crypto_freesession(sav->tdb_cryptoid); 237 sav->tdb_cryptoid = 0; 238 sav->tdb_authalgxform = NULL; 239 sav->tdb_xform = NULL; 240 return err; 241} 242 --- 374 unchanged lines hidden (view full) --- 617 IPSEC_ASSERT(crda != NULL, ("null crypto descriptor")); 618 619 crda->crd_skip = 0; 620 crda->crd_len = m->m_pkthdr.len; 621 crda->crd_inject = skip + rplen; 622 623 /* Authentication operation. */ 624 crda->crd_alg = ahx->type; |
625 crda->crd_key = _KEYBUF(sav->key_auth); | |
626 crda->crd_klen = _KEYBITS(sav->key_auth); | 625 crda->crd_klen = _KEYBITS(sav->key_auth); |
626 crda->crd_key = sav->key_auth->key_data; |
|
627 628 /* Find out if we've already done crypto. */ 629 for (mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_CRYPTO_DONE, NULL); 630 mtag != NULL; 631 mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_CRYPTO_DONE, mtag)) { 632 tdbi = (struct tdb_ident *) (mtag + 1); 633 if (tdbi->proto == sav->sah->saidx.proto && 634 tdbi->spi == sav->spi && --- 380 unchanged lines hidden (view full) --- 1015 crda = crp->crp_desc; 1016 1017 crda->crd_skip = 0; 1018 crda->crd_inject = skip + rplen; 1019 crda->crd_len = m->m_pkthdr.len; 1020 1021 /* Authentication operation. */ 1022 crda->crd_alg = ahx->type; | 627 628 /* Find out if we've already done crypto. */ 629 for (mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_CRYPTO_DONE, NULL); 630 mtag != NULL; 631 mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_CRYPTO_DONE, mtag)) { 632 tdbi = (struct tdb_ident *) (mtag + 1); 633 if (tdbi->proto == sav->sah->saidx.proto && 634 tdbi->spi == sav->spi && --- 380 unchanged lines hidden (view full) --- 1015 crda = crp->crp_desc; 1016 1017 crda->crd_skip = 0; 1018 crda->crd_inject = skip + rplen; 1019 crda->crd_len = m->m_pkthdr.len; 1020 1021 /* Authentication operation. */ 1022 crda->crd_alg = ahx->type; |
1023 crda->crd_key = _KEYBUF(sav->key_auth); | 1023 crda->crd_key = sav->key_auth->key_data; |
1024 crda->crd_klen = _KEYBITS(sav->key_auth); 1025 1026 /* Allocate IPsec-specific opaque crypto info. */ 1027 tc = (struct tdb_crypto *) malloc( 1028 sizeof(struct tdb_crypto) + skip, M_XDATA, M_NOWAIT|M_ZERO); 1029 if (tc == NULL) { 1030 crypto_freereq(crp); 1031 DPRINTF(("%s: failed to allocate tdb_crypto\n", __func__)); --- 178 unchanged lines hidden --- | 1024 crda->crd_klen = _KEYBITS(sav->key_auth); 1025 1026 /* Allocate IPsec-specific opaque crypto info. */ 1027 tc = (struct tdb_crypto *) malloc( 1028 sizeof(struct tdb_crypto) + skip, M_XDATA, M_NOWAIT|M_ZERO); 1029 if (tc == NULL) { 1030 crypto_freereq(crp); 1031 DPRINTF(("%s: failed to allocate tdb_crypto\n", __func__)); --- 178 unchanged lines hidden --- |