improve PBKDF2 performance
authorallanjude <allanjude@FreeBSD.org>
Sun, 19 Feb 2017 19:30:31 +0000 (19:30 +0000)
committerallanjude <allanjude@FreeBSD.org>
Sun, 19 Feb 2017 19:30:31 +0000 (19:30 +0000)
commit8557f8f2df21d6624dde01d4161b565d881c4ff2
tree35ba2d9a31ef6814e5266457ff48d5834f0e07b1
parent7cca07966d75e4b197be43b74d1cc3986fb31dfd
improve PBKDF2 performance

The PBKDF2 in sys/geom/eli/pkcs5v2.c is around half the speed it could be

GELI's PBKDF2 uses a simple benchmark to determine a number of iterations
that will takes approximately 2 seconds. The security provided is actually
half what is expected, because an attacker could use the optimized
algorithm to brute force the key in half the expected time.

With this change, all newly generated GELI keys will be approximately 2x
as strong. Previously generated keys will talk half as long to calculate,
resulting in faster mounting of encrypted volumes. Users may choose to
rekey, to generate a new key with the larger default number of iterations
using the geli(8) setkey command.

Security of existing data is not compromised, as ~1 second per brute force
attempt is still a very high threshold.

PR: 202365
Original Research: https://jbp.io/2015/08/11/pbkdf2-performance-matters/
Submitted by: Joe Pixton <jpixton@gmail.com> (Original Version), jmg (Later Version)
Reviewed by: ed, pjd, delphij
Approved by: secteam, pjd (maintainer)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D8236
etc/mtree/BSD.tests.dist
sys/boot/geli/Makefile
sys/geom/eli/g_eli.h
sys/geom/eli/g_eli_hmac.c
sys/geom/eli/pkcs5v2.c
tests/sys/geom/Makefile
tests/sys/geom/eli/Makefile [new file with mode: 0644]
tests/sys/geom/eli/pbkdf2/Makefile [new file with mode: 0644]
tests/sys/geom/eli/pbkdf2/gentestvect.py [new file with mode: 0644]
tests/sys/geom/eli/pbkdf2/hmactest.c [new file with mode: 0644]
tests/sys/geom/eli/pbkdf2/testvect.h [new file with mode: 0644]