--- sbin/geom/class/eli/geom_eli.c (revision 226241) +++ sbin/geom/class/eli/geom_eli.c (working copy) @@ -60,6 +60,7 @@ #define GELI_BACKUP_DIR "/var/backups/" #define GELI_ENC_ALGO "aes" +#define GELI_VERSION "6" static void eli_main(struct gctl_req *req, unsigned flags); static void eli_init(struct gctl_req *req); @@ -81,7 +82,7 @@ /* * Available commands: * - * init [-bhPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] prov + * init [-bhPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-V version] prov * label - alias for 'init' * attach [-dprv] [-j passfile] [-k keyfile] prov * detach [-fl] prov ... @@ -112,9 +113,10 @@ { 'l', "keylen", "0", G_TYPE_NUMBER }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, { 's', "sectorsize", "0", G_TYPE_NUMBER }, + { 'V', "eliversion", GELI_VERSION, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - "[-bPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] prov" + "[-bPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov" }, { "label", G_FLAG_VERBOSE, eli_main, { @@ -128,6 +130,7 @@ { 'l', "keylen", "0", G_TYPE_NUMBER }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, { 's', "sectorsize", "0", G_TYPE_NUMBER }, + { 'V', "eliversion", GELI_VERSION, G_TYPE_NUMBER }, G_OPT_SENTINEL }, "- an alias for 'init'" @@ -673,9 +676,16 @@ return; } + version = gctl_get_intmax(req, "eliversion"); + if (G_ELI_VERSION_06 < version) { + gctl_error(req, "Invalid metadata version (must be between %d " + "and %d): %d", G_ELI_VERSION_00, G_ELI_VERSION_06, + version); + return; + } bzero(&md, sizeof(md)); strlcpy(md.md_magic, G_ELI_MAGIC, sizeof(md.md_magic)); - md.md_version = G_ELI_VERSION; + md.md_version = version; md.md_flags = 0; if (gctl_get_int(req, "boot")) md.md_flags |= G_ELI_FLAG_BOOT; --- sbin/geom/class/eli/geli.8 (revision 226241) +++ sbin/geom/class/eli/geli.8 (working copy) @@ -60,6 +60,7 @@ .Op Fl K Ar newkeyfile .Op Fl l Ar keylen .Op Fl s Ar sectorsize +.Op Fl V Ar eliversion .Ar prov .Nm .Cm label - an alias for @@ -319,6 +320,11 @@ Increasing sector size allows to increase performance, because we need to generate an IV and do encrypt/decrypt for every single sector - less number of sectors means less work to do. +.It Fl V Ar eliversion +Use a specific encryption metadata version when creating encrypted devices. +This defaults to whatever version was compiled into the +.Nm +binary. .El .It Cm attach Attach the given provider.