Changeset View
Changeset View
Standalone View
Standalone View
head/stand/i386/zfsboot/zfsboot.c
Show First 20 Lines • Show All 539 Lines • ▼ Show 20 Lines | |||||
#if defined(GPT) || defined(LOADER_GELI_SUPPORT) | #if defined(GPT) || defined(LOADER_GELI_SUPPORT) | ||||
daddr_t elba; | daddr_t elba; | ||||
#endif | #endif | ||||
struct dos_partition *dp; | struct dos_partition *dp; | ||||
char *sec; | char *sec; | ||||
unsigned i; | unsigned i; | ||||
/* | |||||
* If we find a vdev on the whole disk, stop here. | |||||
*/ | |||||
if (vdev_probe(vdev_read2, zdsk, NULL) == 0) | |||||
return; | |||||
#ifdef LOADER_GELI_SUPPORT | #ifdef LOADER_GELI_SUPPORT | ||||
/* | /* | ||||
* Taste the disk, if it is GELI encrypted, decrypt it and check to see if | * Taste the disk, if it is GELI encrypted, decrypt it then dig out the | ||||
* it is a usable vdev then. Otherwise dig | * partition table and probe each slice/partition in turn for a vdev or | ||||
* out the partition table and probe each slice/partition | * GELI encrypted vdev. | ||||
* in turn for a vdev or GELI encrypted vdev. | |||||
*/ | */ | ||||
elba = drvsize_ext(zdsk); | elba = drvsize_ext(zdsk); | ||||
if (elba > 0) { | if (elba > 0) { | ||||
elba--; | elba--; | ||||
} | } | ||||
zdsk->gdev = geli_taste(vdev_read, zdsk, elba, "disk%u:0:"); | zdsk->gdev = geli_taste(vdev_read, zdsk, elba, "disk%u:0:"); | ||||
if (zdsk->gdev != NULL) { | if ((zdsk->gdev != NULL) && (geli_havekey(zdsk->gdev) == 0)) | ||||
if (geli_havekey(zdsk->gdev) == 0 || | geli_passphrase(zdsk->gdev, gelipw); | ||||
geli_passphrase(zdsk->gdev, gelipw) == 0) { | |||||
if (vdev_probe(vdev_read2, zdsk, NULL) == 0) { | |||||
return; | |||||
} | |||||
} | |||||
} | |||||
#endif /* LOADER_GELI_SUPPORT */ | #endif /* LOADER_GELI_SUPPORT */ | ||||
sec = dmadat->secbuf; | sec = dmadat->secbuf; | ||||
zdsk->dsk.start = 0; | zdsk->dsk.start = 0; | ||||
#ifdef GPT | #ifdef GPT | ||||
/* | /* | ||||
* First check for GPT. | * First check for GPT. | ||||
▲ Show 20 Lines • Show All 560 Lines • Show Last 20 Lines |