g_eli_privacy.c (213063) | g_eli_privacy.c (213067) |
---|---|
1/*- 2 * Copyright (c) 2005-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2005-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/geom/eli/g_eli_privacy.c 213063 2010-09-23 11:23:10Z pjd $"); | 28__FBSDID("$FreeBSD: head/sys/geom/eli/g_eli_privacy.c 213067 2010-09-23 11:49:47Z pjd $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/linker.h> 34#include <sys/module.h> 35#include <sys/lock.h> 36#include <sys/mutex.h> --- 210 unchanged lines hidden (view full) --- 247 crp->crp_flags = CRYPTO_F_IOV | CRYPTO_F_CBIFSYNC | CRYPTO_F_REL; 248 if (g_eli_batch) 249 crp->crp_flags |= CRYPTO_F_BATCH; 250 crp->crp_desc = crd; 251 252 crd->crd_skip = 0; 253 crd->crd_len = secsize; 254 crd->crd_flags = CRD_F_IV_EXPLICIT | CRD_F_IV_PRESENT; | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/linker.h> 34#include <sys/module.h> 35#include <sys/lock.h> 36#include <sys/mutex.h> --- 210 unchanged lines hidden (view full) --- 247 crp->crp_flags = CRYPTO_F_IOV | CRYPTO_F_CBIFSYNC | CRYPTO_F_REL; 248 if (g_eli_batch) 249 crp->crp_flags |= CRYPTO_F_BATCH; 250 crp->crp_desc = crd; 251 252 crd->crd_skip = 0; 253 crd->crd_len = secsize; 254 crd->crd_flags = CRD_F_IV_EXPLICIT | CRD_F_IV_PRESENT; |
255 if (sc->sc_nekeys > 1) 256 crd->crd_flags |= CRD_F_KEY_EXPLICIT; |
|
255 if (bp->bio_cmd == BIO_WRITE) 256 crd->crd_flags |= CRD_F_ENCRYPT; 257 crd->crd_alg = sc->sc_ealgo; | 257 if (bp->bio_cmd == BIO_WRITE) 258 crd->crd_flags |= CRD_F_ENCRYPT; 259 crd->crd_alg = sc->sc_ealgo; |
258 crd->crd_key = sc->sc_ekey; | 260 crd->crd_key = g_eli_crypto_key(sc, dstoff, secsize); |
259 crd->crd_klen = sc->sc_ekeylen; 260 g_eli_crypto_ivgen(sc, dstoff, crd->crd_iv, 261 sizeof(crd->crd_iv)); 262 crd->crd_next = NULL; 263 264 crp->crp_etype = 0; 265 err = crypto_dispatch(crp); 266 if (error == 0) 267 error = err; 268 } 269 if (bp->bio_error == 0) 270 bp->bio_error = error; 271} | 261 crd->crd_klen = sc->sc_ekeylen; 262 g_eli_crypto_ivgen(sc, dstoff, crd->crd_iv, 263 sizeof(crd->crd_iv)); 264 crd->crd_next = NULL; 265 266 crp->crp_etype = 0; 267 err = crypto_dispatch(crp); 268 if (error == 0) 269 error = err; 270 } 271 if (bp->bio_error == 0) 272 bp->bio_error = error; 273} |