summaryrefslogtreecommitdiffstats
path: root/sys/geom/eli/g_eli.c
Commit message (Collapse)AuthorAgeFilesLines
* Use correct part of the Master-Key for generating encryption keys.pjd2012-07-041-0/+2
| | | | | | | | | | | | Before this change the IV-Key was used to generate encryption keys, which was incorrect, but safe - for the XTS mode this key was unused anyway and for CBC mode it was used differently to generate IV vectors, so there is no risk that IV vector collides with encryption key somehow. Bump version number and keep compatibility for older versions. MFC after: 2 weeks
* replace uses of libkern gets with cngetsavg2011-12-171-1/+2
| | | | MFC after: 2 months
* Before this change when GELI detected hardware crypto acceleration it willpjd2011-10-271-12/+4
| | | | | | | | | | | | | | | | | | | start only one worker thread. For software crypto it will start by default N worker threads where N is the number of available CPUs. This is not optimal if hardware crypto is AES-NI, which uses CPU for AES calculations. Change that to always start one worker thread for every available CPU. Number of worker threads per GELI provider can be easly reduced with kern.geom.eli.threads sysctl/tunable and even for software crypto it should be reduced when using more providers. While here, when number of threads exceeds number of CPUs avilable don't reduce this number, assume the user knows what he is doing. Reported by: Yuri Karaban <dev@dev97.com> MFC after: 3 days
* Add support for creating GELI devices with older metadata version for usepjd2011-10-251-0/+2
| | | | | | | | | | | | | | with older FreeBSD versions: - Add -V option to 'geli init' to specify version number. If no -V is given the most recent version is used. - If -V is given don't allow to use features not supported by this version. - Print version in 'geli list' output. - Update manual page and add table describing which GELI version is supported by which FreeBSD version, so one can use it when preparing GELI device for older FreeBSD version. Inspired by: Garrett Cooper <yanegomi@gmail.com> MFC after: 3 days
* Prefer G_ELI_VERSION_* defines for version numbers over plain digits.pjd2011-10-251-3/+5
| | | | MFC after: 3 days
* Fit lines into 80 chars.pjd2011-10-251-4/+6
| | | | MFC after: 3 days
* Include sys/sbuf.h directly.ae2011-07-111-0/+1
| | | | Reviewed by: pjd
* MFCattilio2011-05-081-1/+14
|\
| * Export GELI class version via sysctl kern.geom.eli.version.pjd2011-05-081-0/+3
| | | | | | | | MFC after: 1 week
| * When support for multiple encryption keys was committed, GELI integrity modepjd2011-05-081-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | was not updated to pass CRD_F_KEY_EXPLICIT flag to opencrypto. This resulted in always using first key. We need to support providers created with this bug, so set special G_ELI_FLAG_FIRST_KEY flag for GELI provider in integrity mode with version smaller than 6 and pass the CRD_F_KEY_EXPLICIT flag to opencrypto only if G_ELI_FLAG_FIRST_KEY doesn't exist. Reported by: Anton Yuzhaninov <citrin@citrin.ru> MFC after: 1 week
* | Commit the support for removing cpumask_t and replacing it directly withattilio2011-05-051-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cpuset_t objects. That is going to offer the underlying support for a simple bump of MAXCPU and then support for number of cpus > 32 (as it is today). Right now, cpumask_t is an int, 32 bits on all our supported architecture. cpumask_t on the other side is implemented as an array of longs, and easilly extendible by definition. The architectures touched by this commit are the following: - amd64 - i386 - pc98 - arm - ia64 - XEN while the others are still missing. Userland is believed to be fully converted with the changes contained here. Some technical notes: - This commit may be considered an ABI nop for all the architectures different from amd64 and ia64 (and sparc64 in the future) - per-cpu members, which are now converted to cpuset_t, needs to be accessed avoiding migration, because the size of cpuset_t should be considered unknown - size of cpuset_t objects is different from kernel and userland (this is primirally done in order to leave some more space in userland to cope with KBI extensions). If you need to access kernel cpuset_t from the userland please refer to example in this patch on how to do that correctly (kgdb may be a good source, for example). - Support for other architectures is going to be added soon - Only MAXCPU for amd64 is bumped now The patch has been tested by sbruno and Nicholas Esborn on opteron 4 x 12 pack CPUs. More testing on big SMP is expected to came soon. pluknet tested the patch with his 8-ways on both amd64 and i386. Tested by: pluknet, sbruno, gianni, Nicholas Esborn Reviewed by: jeff, jhb, sbruno
* Remove "for a moment" assignment. struct g_geom zeroed when allocated.ae2011-05-041-2/+0
| | | | MFC after: 1 week
* Instead of allocating memory for all the keys at device attach,pjd2011-04-211-41/+10
| | | | | | | | | | | create reasonably large cache for the keys that is filled when needed. The previous version was problematic for very large providers (hundreds of terabytes or serval petabytes). Every terabyte of data needs around 256kB for keys. Make the default cache limit big enough to fit all the keys needed for 4TB providers, which will eat at most 1MB of memory. MFC after: 2 weeks
* In g_eli_read_done() and g_eli_write_done(), for a bio withtrociny2011-04-031-2/+2
| | | | | | | | | bio_children > 1, g_destroy_bio() is never called and the bio leaks. Fix this by calling g_destroy_bio() earlier, before the check. Submitted by: Victor Balada Diaz <victor@bsdes.net> (initial version) Approved by: pjd (mentor) MFC after: 1 week
* Add some FEATURE macros for various GEOM classes.netchild2011-02-251-0/+1
| | | | | | | | | | | No FreeBSD version bump, the userland application to query the features will be committed last and can serve as an indication of the availablility if needed. Sponsored by: Google Summer of Code 2010 Submitted by: kibab Reviewed by: silence on geom@ during 2 weeks X-MFC after: to be determined in last commit with code from this project
* Use the preload_fetch_addr() and preload_fetch_size() conveniencemarcel2011-02-131-13/+12
| | | | | | functions to obtain the address and size of the preloaded key files. Sponsored by: Juniper Networks.
* Add support for asterisk characters when filling in the GELI passworded2010-11-141-2/+2
| | | | | | | | | | | during boot. Change the last argument of gets() to indicate a visibility flag and add definitions for the numerical constants. Except for the value 2, gets() will behave exactly the same, so existing consumers shouldn't break. We only use it in two places, though. Submitted by: lme (older version)
* Add State tag, so 'geli status' will report active/suspended status, eg:pjd2010-10-221-0/+2
| | | | | | | # geli status Name Status Components da0.eli SUSPENDED da0 da1.eli ACTIVE da1
* Encryption keys array might be NULL if device is suspended. Check for this, sopjd2010-10-221-3/+6
| | | | we don't panic when we detach suspended device.
* Move sc_akeyctx and sc_ivctx initialization to the g_eli_mkey_propagate()pjd2010-10-221-24/+0
| | | | | function which eliminates code duplication and will ensure proper order of operation.
* Free opencrypto sessions on suspend, as they also might keep encryption keys.pjd2010-10-211-35/+80
|
* Fix a bug introduced in r213067 where we use authentication key beforepjd2010-10-211-9/+10
| | | | initializing it.
* Bring in geli suspend/resume functionality (finally).pjd2010-10-201-26/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change if you wanted to suspend your laptop and be sure that your encryption keys are safe, you had to stop all processes that use file system stored on encrypted device, unmount the file system and detach geli provider. This isn't very handy. If you are a lucky user of a laptop where suspend/resume actually works with FreeBSD (I'm not!) you most likely want to suspend your laptop, because you don't want to start everything over again when you turn your laptop back on. And this is where geli suspend/resume steps in. When you execute: # geli suspend -a geli will wait for all in-flight I/O requests, suspend new I/O requests, remove all geli sensitive data from the kernel memory (like encryption keys) and will wait for either 'geli resume' or 'geli detach'. Now with no keys in memory you can suspend your laptop without stopping any processes or unmounting any file systems. When you resume your laptop you have to resume geli devices using 'geli resume' command. You need to provide your passphrase, etc. again so the keys can be restored and suspended I/O requests released. Of course you need to remember that 'geli suspend' won't clear file system cache and other places where data from your geli-encrypted file system might be present. But to get rid of those stopping processes and unmounting file system won't help either - you have to turn your laptop off. Be warned. Also note, that suspending geli device which contains file system with geli utility (or anything used by 'geli resume') is not very good idea, as you won't be able to resume it - when you execute geli(8), the kernel will try to read it and this read I/O request will be suspended.
* - Add missing comments.pjd2010-10-201-2/+4
| | | | - Make a comment consistent with others.
* Change g_eli_debug to int, so one can turn off any GELI output by settingpjd2010-09-251-2/+2
| | | | | | kern.geom.eli.debug sysctl to -1. MFC after: 2 weeks
* Update copyright years.pjd2010-09-231-1/+1
| | | | MFC after: 1 week
* Add support for AES-XTS. This will be the default now.pjd2010-09-231-9/+31
| | | | MFC after: 1 week
* Implement switching of data encryption key every 2^20 blocks.pjd2010-09-231-24/+67
| | | | | | | This ensures the same encryption key won't be used for more than 2^20 blocks (sectors). This will be the default now. MFC after: 1 week
* Define default overwrite count, so that userland can use it.pjd2010-09-231-1/+1
| | | | MFC after: 1 week
* Correct offset conversion to little endian. It was implemented in version 2,pjd2010-08-281-3/+5
| | | | | | | | but because of a bug it was a no-op, so we were still using offsets in native byte order for the host. Do it properly this time, bump version to 4 and set the G_ELI_FLAG_NATIVE_BYTE_ORDER flag when version is under 4. MFC after: 2 weeks
* Use lower priority for GELI worker threads. This improves systempjd2010-04-151-3/+2
| | | | | | responsiveness under heavy GELI load. MFC after: 3 days
* Detach GELI providers on shutdown/reboot, which will allow providers underneathpjd2009-03-161-1/+55
| | | | | | | to close properly. Reported, reviewed and tested by: guido MFC after: 1 week
* Backout this commit whil a better solution is developedguido2009-03-131-1/+0
|
* When attaching a geli on boot make sure that it is detachedguido2009-03-101-0/+1
| | | | | upon last close. (needed for a gmirror to properly shutdown upon reboot when a geli is on top the gmirror)
* Style(9).pjd2008-08-121-3/+4
|
* Clear passphrase buffer after use.pjd2008-07-201-0/+2
| | | | Submitted by: Fabian Keil <fk@fabiankeil.de> (a bit different version)
* Rename the kthread_xxx (e.g. kthread_create()) callsjulian2007-10-201-2/+2
| | | | | | | | | | | to kproc_xxx as they actually make whole processes. Thos makes way for us to add REAL kthread_create() and friends that actually make theads. it turns out that most of these calls actually end up being moved back to the thread version when it's added. but we need to make this cosmetic change first. I'd LOVE to do this rename in 7.0 so that we can eventually MFC the new kthread_xxx() calls.
* Commit 14/14 of sched_lock decomposition.jeff2007-06-051-2/+2
| | | | | | | | | | | - Use thread_lock() rather than sched_lock for per-thread scheduling sychronization. - Use the per-process spinlock rather than the sched_lock for per-process scheduling synchronization. Tested by: kris, current@ Tested on: i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc. Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
* Use root_mounted().pjd2007-04-081-1/+1
|
* Overhaul driver/subsystem api's:sam2007-03-211-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o make all crypto drivers have a device_t; pseudo drivers like the s/w crypto driver synthesize one o change the api between the crypto subsystem and drivers to use kobj; cryptodev_if.m defines this api o use the fact that all crypto drivers now have a device_t to add support for specifying which of several potential devices to use when doing crypto operations o add new ioctls that allow user apps to select a specific crypto device to use (previous ioctls maintained for compatibility) o overhaul crypto subsystem code to eliminate lots of cruft and hide implementation details from drivers o bring in numerous fixes from Michale Richardson/hifn; mostly for 795x parts o add an optional mechanism for mmap'ing the hifn 795x public key h/w to user space for use by openssl (not enabled by default) o update crypto test tools to use new ioctl's and add cmd line options to specify a device to use for tests These changes will also enable much future work on improving the core crypto subsystem; including proper load balancing and interposing code between the core and drivers to dispatch small operations to the s/w driver as appropriate. These changes were instigated by the work of Michael Richardson. Reviewed by: pjd Approved by: re
* Fix geli after last commit for UP systems that are running SMP kernel.pjd2007-03-021-1/+2
| | | | | Submitted by: Hyo geol, Lee <hyogeollee@gmail.com> MFC after: 1 week
* It is possible that GEOM taste provider before SMP is started.pjd2007-01-281-0/+7
| | | | | | | | We can't bind to a CPU which is not yet on-line, so add code that wait for CPUs to go on-line before binding to them. Reported by: Alin-Adrian Anton <aanton@spintech.ro> MFC after: 2 weeks
* I want CPU number here.pjd2006-11-021-1/+1
| | | | Noticed by: ru
* Skip disabled CPU, because after we sched_bind() to a disabled CPU,pjd2006-11-011-1/+16
| | | | | | | | | | we won't be able to exit from the thread. Function g_eli_cpu_is_disabled() stoled from kern_pmc.c. PR: 104669 Reported by: Nikolay Mirin <nik@optim.com.ru> MFC after: 1 week
* Implement BIO_FLUSH handling by simply passing it down to the components.pjd2006-10-311-0/+2
| | | | Sponsored by: home.pl
* Remove trailing spaces.pjd2006-09-301-1/+1
|
* Before using byte offset for IV creation, covert it to little endian.pjd2006-08-111-2/+8
| | | | | | | | | | This way one will be able to use provider encrypted on eg. i386 on eg. sparc64. This doesn't really buy us much today, because UFS isn't endian agnostic. We retain backward compatibility by setting G_ELI_FLAG_NATIVE_BYTE_ORDER flag on devices with version number less than 2 and not converting the offset.
* Allow geli to operate on read-only providers.pjd2006-08-091-6/+16
| | | | | Initial patch from: vd MFC after: 2 weeks
* Fix what looks like a typo: MODULE_DEPEND() takes module names,yar2006-07-271-1/+1
| | | | | | | not KLD file names; and GELI module's name is g_eli, not geom_eli. Approved by: pjd (silence) MFC after: 5 days
* Implement data integrity verification (data authentication) for geli(8).pjd2006-06-051-250/+121
| | | | Supported by: Wheel Sp. z o.o. (http://www.wheel.pl)
OpenPOWER on IntegriCloud