Changeset View
Changeset View
Standalone View
Standalone View
head/sys/geom/eli/g_eli_integrity.c
Show First 20 Lines • Show All 346 Lines • ▼ Show 20 Lines | g_eli_auth_write_done(struct cryptop *crp) | ||||
nsec = (nsec * sc->sc_bytes_per_sector) / cp->provider->sectorsize; | nsec = (nsec * sc->sc_bytes_per_sector) / cp->provider->sectorsize; | ||||
cbp->bio_length = cp->provider->sectorsize * nsec; | cbp->bio_length = cp->provider->sectorsize * nsec; | ||||
cbp->bio_offset = (bp->bio_offset / bp->bio_to->sectorsize) * sc->sc_bytes_per_sector; | cbp->bio_offset = (bp->bio_offset / bp->bio_to->sectorsize) * sc->sc_bytes_per_sector; | ||||
cbp->bio_data = bp->bio_driver2; | cbp->bio_data = bp->bio_driver2; | ||||
/* | /* | ||||
* We write more than what is requested, so we have to be ready to write | * We write more than what is requested, so we have to be ready to write | ||||
* more than MAXPHYS. | * more than maxphys. | ||||
*/ | */ | ||||
cbp2 = NULL; | cbp2 = NULL; | ||||
if (cbp->bio_length > MAXPHYS) { | if (cbp->bio_length > maxphys) { | ||||
cbp2 = g_duplicate_bio(bp); | cbp2 = g_duplicate_bio(bp); | ||||
cbp2->bio_length = cbp->bio_length - MAXPHYS; | cbp2->bio_length = cbp->bio_length - maxphys; | ||||
cbp2->bio_data = cbp->bio_data + MAXPHYS; | cbp2->bio_data = cbp->bio_data + maxphys; | ||||
cbp2->bio_offset = cbp->bio_offset + MAXPHYS; | cbp2->bio_offset = cbp->bio_offset + maxphys; | ||||
cbp2->bio_to = cp->provider; | cbp2->bio_to = cp->provider; | ||||
cbp2->bio_done = g_eli_write_done; | cbp2->bio_done = g_eli_write_done; | ||||
cbp->bio_length = MAXPHYS; | cbp->bio_length = maxphys; | ||||
} | } | ||||
/* | /* | ||||
* Send encrypted data to the provider. | * Send encrypted data to the provider. | ||||
*/ | */ | ||||
G_ELI_LOGREQ(2, cbp, "Sending request."); | G_ELI_LOGREQ(2, cbp, "Sending request."); | ||||
bp->bio_inbed = 0; | bp->bio_inbed = 0; | ||||
bp->bio_children = (cbp2 != NULL ? 2 : 1); | bp->bio_children = (cbp2 != NULL ? 2 : 1); | ||||
g_io_request(cbp, cp); | g_io_request(cbp, cp); | ||||
Show All 34 Lines | g_eli_auth_read(struct g_eli_softc *sc, struct bio *bp) | ||||
cbp->bio_data = bp->bio_driver2; | cbp->bio_data = bp->bio_driver2; | ||||
/* Clear the error array. */ | /* Clear the error array. */ | ||||
memset((char *)bp->bio_driver2 + cbp->bio_length, 0, | memset((char *)bp->bio_driver2 + cbp->bio_length, 0, | ||||
sizeof(int) * nsec); | sizeof(int) * nsec); | ||||
/* | /* | ||||
* We read more than what is requested, so we have to be ready to read | * We read more than what is requested, so we have to be ready to read | ||||
* more than MAXPHYS. | * more than maxphys. | ||||
*/ | */ | ||||
cbp2 = NULL; | cbp2 = NULL; | ||||
if (cbp->bio_length > MAXPHYS) { | if (cbp->bio_length > maxphys) { | ||||
cbp2 = g_duplicate_bio(bp); | cbp2 = g_duplicate_bio(bp); | ||||
cbp2->bio_length = cbp->bio_length - MAXPHYS; | cbp2->bio_length = cbp->bio_length - maxphys; | ||||
cbp2->bio_data = cbp->bio_data + MAXPHYS; | cbp2->bio_data = cbp->bio_data + maxphys; | ||||
cbp2->bio_offset = cbp->bio_offset + MAXPHYS; | cbp2->bio_offset = cbp->bio_offset + maxphys; | ||||
cbp2->bio_to = cp->provider; | cbp2->bio_to = cp->provider; | ||||
cbp2->bio_done = g_eli_read_done; | cbp2->bio_done = g_eli_read_done; | ||||
cbp->bio_length = MAXPHYS; | cbp->bio_length = maxphys; | ||||
} | } | ||||
/* | /* | ||||
* Read encrypted data from provider. | * Read encrypted data from provider. | ||||
*/ | */ | ||||
G_ELI_LOGREQ(2, cbp, "Sending request."); | G_ELI_LOGREQ(2, cbp, "Sending request."); | ||||
g_io_request(cbp, cp); | g_io_request(cbp, cp); | ||||
if (cbp2 != NULL) { | if (cbp2 != NULL) { | ||||
G_ELI_LOGREQ(2, cbp2, "Sending request."); | G_ELI_LOGREQ(2, cbp2, "Sending request."); | ||||
▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines |