boringssl/crypto
David Benjamin b529253bea Implement scrypt from RFC 7914.
This imports upstream's scrypt implementation, though it's been heavily
revised. I lost track of words vs. blocks vs. bigger blocks too many
times in the original code and introduced a typedef for the fixed-width
Salsa20 blocks. The downside is going from bytes to blocks is a bit
trickier, so I took advantage of our little-endian assumption.

This also adds an missing check for N < 2^32. Upstream's code is making
this assumption in Integerify. I'll send that change back upstream. I've
also removed the weird edge case where a NULL out_key parameter means to
validate N/r/p against max_mem and nothing else. That's just in there to
get a different error code out of their PKCS#12 code.

Performance-wise, the cleanup appears to be the same (up to what little
precision I was able to get here), but an optimization to use bitwise
AND rather than modulus makes us measurably faster. Though scrypt isn't
a fast operation to begin with, so hopefully it isn't anyone's
bottleneck.

This CL does not route scrypt up to the PKCS#12 code, though we could
write our own version of that if we need to later.

BUG=chromium:731993

Change-Id: Ib2f43344017ed37b6bafd85a2c2b103d695020b8
Reviewed-on: https://boringssl-review.googlesource.com/17084
Reviewed-by: Adam Langley <agl@google.com>
2017-06-12 20:32:21 +00:00
..
asn1 Remove some dead code from crypto/asn1. 2017-06-09 19:58:38 +00:00
base64 Optimize constant-time base64 implementation slightly. 2017-05-17 23:11:47 +00:00
bio Test with IPv6 by default, and IPv4 only if that fails. 2017-05-25 23:49:52 +00:00
bn_extra Move bn/ into crypto/fipsmodule/ 2017-05-01 22:51:25 +00:00
buf
bytestring Convert bytestring_test to GTest. 2017-04-17 14:19:47 +00:00
chacha Remove filename argument to x86 asm_init. 2017-05-12 14:58:27 +00:00
cipher_extra aead_test: Skip calls to EVP_AEAD_CTX_open_gather when not implemented. 2017-06-12 17:46:22 +00:00
cmac Convert cmac_test to GTest. 2017-04-24 20:25:22 +00:00
conf Fix out-of-memory condition in conf. 2017-03-21 16:19:22 +00:00
curve25519 Improve Curve25519 cswap x64 assembly 2017-05-23 22:51:48 +00:00
dh Remove ex_data's dup hook. 2017-05-23 22:43:59 +00:00
digest_extra Convert digest_test to GTest. 2017-05-18 14:50:06 +00:00
dsa Remove ex_data's dup hook. 2017-05-23 22:43:59 +00:00
ec_extra Tidy up FIPS module dependencies. 2017-05-05 23:10:24 +00:00
ecdh Convert a number of tests to GTest. 2017-06-01 17:02:13 +00:00
ecdsa_extra Tidy up FIPS module dependencies. 2017-05-05 23:10:24 +00:00
engine
err Implement scrypt from RFC 7914. 2017-06-12 20:32:21 +00:00
evp Implement scrypt from RFC 7914. 2017-06-12 20:32:21 +00:00
fipsmodule Add EVP_AEAD_CTX_{seal_scatter,open_gather}. 2017-06-09 23:10:49 +00:00
hkdf Convert various tests to GTest. 2017-05-23 22:34:09 +00:00
hmac_extra Convert a number of tests to GTest. 2017-06-01 17:02:13 +00:00
lhash Convert various tests to GTest. 2017-05-23 22:34:09 +00:00
obj Align EVP_PKEY Ed25519 API with upstream. 2017-06-12 12:04:11 +00:00
pem Delete some dead code from crypto/x509. 2017-06-09 19:58:08 +00:00
perlasm Remove filename argument to x86 asm_init. 2017-05-12 14:58:27 +00:00
pkcs7 Move pkcs{7,8}_test over to gtest 2017-06-02 16:53:41 +00:00
pkcs8 Convert remaining pkcs8 tests to gtest 2017-06-07 17:30:27 +00:00
poly1305 Convert a number of tests to GTest. 2017-06-01 17:02:13 +00:00
pool Convert various tests to GTest. 2017-05-23 22:34:09 +00:00
rand_extra Fix fuzzer build. 2017-04-25 16:42:28 +00:00
rc4
rsa_extra Add FIPS-compliant key generation that calls check_fips for RSA and EC. 2017-05-17 16:30:48 +00:00
stack Convert stack.h to use inline functions. 2017-05-22 15:06:04 +00:00
test Convert a number of tests to GTest. 2017-06-01 17:02:13 +00:00
x509 Align EVP_PKEY Ed25519 API with upstream. 2017-06-12 12:04:11 +00:00
x509v3 Delete some dead code from crypto/x509. 2017-06-09 19:58:08 +00:00
CMakeLists.txt Implement scrypt from RFC 7914. 2017-06-12 20:32:21 +00:00
compiler_test.cc Fix build on android_aarch64. 2017-04-21 22:52:10 +00:00
constant_time_test.cc Switch constant-time functions to using |crypto_word_t|. 2017-04-21 22:06:05 +00:00
cpu-aarch64-linux.c
cpu-arm-linux.c
cpu-arm.c
cpu-intel.c
cpu-ppc64le.c Make the POWER hardware capability value a global in crypto.c. 2017-04-04 18:19:19 +00:00
crypto.c Set static armcaps based on __ARM_FEATURE_CRYPTO. 2017-06-09 00:29:10 +00:00
ex_data.c Remove ex_data's dup hook. 2017-05-23 22:43:59 +00:00
internal.h Remove ex_data's dup hook. 2017-05-23 22:43:59 +00:00
mem.c
refcount_c11.c
refcount_lock.c
refcount_test.cc Convert various tests to GTest. 2017-05-23 22:34:09 +00:00
thread_none.c
thread_pthread.c
thread_test.cc Convert thread_test to GTest. 2017-06-05 22:30:35 +00:00
thread_win.c
thread.c