Commit Graph
1232 Commits
Author SHA1 Message Date
Martin Willi 313811b72d aesni: Add a GCM AEAD based on the AES-NI key schedule 2015-04-15 11:35:28 +02:00
Martin Willi 4284660677 aesni: Implement CMAC mode to provide a signer/prf
Compared to the cmac plugin using AESNI-CBC as backend, this improves
performance of AES-CMAC by ~45%.
2015-04-15 11:35:28 +02:00
Martin Willi 9d187f8711 aesni: Implement XCBC mode to provide a signer/prf
Compared to the xcbc plugin using AESNI-CBC as backend, this improves
performance of AES-XCBC by ~45%.
2015-04-15 11:35:28 +02:00
Martin Willi d48642b7eb aesni: Partially use separate code paths for different key sizes in CCM
Due to the serial nature of the CBC mac, this brings only a marginal speedup.
2015-04-15 11:35:28 +02:00
Martin Willi 1ae46dfba2 aesni: Add a CCM AEAD reusing the key schedule 2015-04-15 11:35:27 +02:00
Martin Willi 8488dea2f9 aesni: Use 4-way parallel AES-NI instructions for CTR en/decryption
CTR can be parallelized, and we do so by queueing instructions to the processor
pipeline. While we have enough registers for 128-bit decryption, the register
count is insufficient to hold all variables with larger key sizes. Nonetheless
is 4-way parallelism faster, depending on key size between ~10% and ~25%.
2015-04-15 11:35:27 +02:00
Martin Willi 9e47c1fe77 aesni: Use dedicated round count specific encryption functions in CTR mode
This allows us to unroll loops and hold the key schedule in local (register)
variables. This brings an impressive speedup of ~45%.
2015-04-15 11:35:27 +02:00
Martin Willi 74d43cbde9 aesni: Implement a AES-NI based CTR crypter using the key schedule 2015-04-15 11:35:27 +02:00
Martin Willi a3cb72e850 aesni: Use 4-way parallel AES-NI instructions for CBC decryption
CBC decryption can be parallelized, and we do so by queueing instructions
to the processor pipeline. While we have enough registers for 128-bit
decryption, the register count is insufficient to hold all variables with
larger key sizes. Nonetheless is 4-way parallelism faster, roughly by ~8%.
2015-04-15 11:35:27 +02:00
Martin Willi 95ef361415 aesni: Use separate en-/decryption CBC code paths for different key sizes
This allows us to unroll loops, and use local (register) variables for the
key schedule. This improves performance slightly for encryption, but a lot
for reorderable decryption (>30%).
2015-04-15 11:35:27 +02:00
Martin Willi 8f1fab93e9 aesni: Implement a AES-NI based CBC crypter using the key schedule 2015-04-15 11:35:27 +02:00
Martin Willi b2d96bfe25 aesni: Implement 256-bit key schedule 2015-04-15 11:35:27 +02:00
Martin Willi d7811415ff aesni: Implement 192-bit key schedule 2015-04-15 11:35:26 +02:00
Martin Willi 6d7671eb1c aesni: Implement 128-bit key schedule 2015-04-15 11:35:26 +02:00
Martin Willi 431f452ed4 aesni: Add a common key schedule class for AES 2015-04-15 11:35:26 +02:00
Martin Willi 78c04b5d4d aesni: Provide a plugin stub for AES-NI instruction based crypto primitives 2015-04-15 11:35:26 +02:00
Martin Willi ed6295944b test-vectors: Add some self-made additional AES-GCM test vectors
We missed test vectors for 192/256-bit key vectors for ICV8/12, and should
also have some for larger associated data chunk.
2015-04-15 11:35:26 +02:00
Martin Willi 5c419b2974 test-vectors: Define some additional CCM test vectors
We don't have any where plain or associated data is not a multiple of the block
size, but it is likely to find bugs here. Also, we miss some ICV12 test vectors
using 128- and 192-bit key sizes.
2015-04-15 11:35:26 +02:00
Martin Willi 3a5106caea crypto-tester: Use the plugin feature key size to benchmark crypters/aeads
We previously didn't pass the key size during algorithm registration, but this
resulted in benchmarking with the "default" key size the crypter uses when
passing 0 as key size.
2015-04-15 11:35:26 +02:00
Martin Willi 161a015782 utils: Use chunk_equals_const() for all cryptographic purposes 2015-04-14 12:02:51 +02:00
Martin Willi 71afe0a556 utils: Use memeq_const() for all cryptographic purposes 2015-04-14 11:53:31 +02:00
Martin Willi 63d1e5b930 rdrand: Reuse CPU feature detection to check for RDRAND instructions 2015-04-13 15:31:58 +02:00
Martin Willi 137079b56f padlock: Reuse common CPU feature detection to check for Padlock features 2015-04-13 15:31:58 +02:00
Martin Willi 6a84a4049d sqlite: Use our locking mechanism also when sqlite3_threadsafe() returns 0
We previously checked for older library versions without locking support at
all. But newer libraries can be built in single-threading mode as well, where
we have to care about the locking.
2015-04-13 15:31:58 +02:00
Martin Willi 4e621ada96 sqlite: Show SQLite library version and thread safety flag during startup 2015-04-13 15:31:58 +02:00
Martin Willi c2906c8f21 openssl: Don't pre-initialize OpenSSL HMAC with an empty key
With OpenSSL commit 929b0d70c19f60227f89fac63f22a21f21950823 setting an empty
key fails if no previous key has been set on that HMAC.

In 9138f49e we explicitly added the check we remove now, as HMAC_Update()
might crash if HMAC_Init_ex() has not been called yet. To avoid that, we
set and check a flag locally to let any get_mac() call fail if set_key() has
not yet been called.
2015-04-13 14:52:30 +02:00
Martin Willi 280f752c56 fips-prf: Remove superfluous <arpa/inet.h> include
As we make no use of htonl() and friends, this is unneeded, but actually
prevents a Windows build.
2015-04-13 09:31:28 +02:00
Andreas Steffen ff96400d13 Wipe auxiliary key store 2015-03-28 10:44:23 +01:00
Martin Willi b234fdfce8 fips-prf: Fail when trying to use append mode on FIPS-PRF
Append mode hardly makes sense for the special stateful FIPS-PRF, which is
different to other PRFs.
2015-03-28 08:36:35 +01:00
Martin Willi bc1876bc9a cmac: Reset state before doing set_key() 2015-03-27 16:07:53 +01:00
Martin Willi 4075e9d7a4 af-alg: Reset hmac/xcbc state before doing set_key() 2015-03-27 16:06:21 +01:00
Martin Willi eedd92b53b xcbc: Reset XCBC state in set_key()
If some partial data has been appended, a truncated key gets invalid if it
is calculated from the pending state.
2015-03-27 15:53:52 +01:00
Martin Willi bfb029c82a hmac: Reset the underlying hasher before doing set_key() with longer keys
The user might have done a non-complete append, having some state in the
hasher.

Fixes #909.
2015-03-27 15:53:50 +01:00
Martin Willi 0356089d0f diffie-hellman: Verify public DH values in backends 2015-03-23 17:54:03 +01:00
Martin Willi a777155ffe diffie-hellman: Add a bool return value to set_other_public_value() 2015-03-23 17:54:03 +01:00
Martin Willi 42431690e0 diffie-hellman: Add a bool return value to get_my_public_value() 2015-03-23 17:54:03 +01:00
Martin Willi bace1d6479 diffie-hellman: Use bool instead of status_t as get_shared_secret() return value
While such a change is not unproblematic, keeping status_t makes the API
inconsistent once we introduce return values for the public value operations.
2015-03-23 17:54:02 +01:00
Tobias Brunner 1735d80f38 files: Add simple plugin to load files from file:// URIs 2015-03-09 16:08:52 +01:00
Tobias Brunner 1bfa5e0cac plugin-loader: Increase log level for warning about plugin features that failed to load
Since we can't get rid of all unmet dependencies (at least not in every
possible plugin configuration) the message is more confusing than
helpful.  In particular because a detailed warning about plugin features
that failed to load due to unmet dependencies is only logged on level 2.
2015-03-09 15:45:29 +01:00
Tobias Brunner e5009fbb66 pkcs11: Convert RFC 3279 ECDSA signatures when verifying
References #873.
2015-03-09 15:37:07 +01:00
Tobias Brunner b258ed0192 pkcs11: Properly encode RFC 3279 ECDSA signatures
Fixes #873.
2015-03-09 15:37:07 +01:00
Tobias Brunner 8c9a0b5fb5 pkcs11: Properly encode EC_POINTs created on a token
Some tokens might not fail when creating EC public keys in the incorrect
format, but they will later not be able to use them to verify signatures.

References #872.
2015-03-09 15:37:01 +01:00
Tobias Brunner 4aab3153a4 pkcs11: Properly handle EC_POINTs returned as ASN.1 octet string
This is the correct encoding but we internally only use unwrapped keys
and some tokens return them unwrapped.

Fixes #872.
2015-03-09 15:36:07 +01:00
Tobias Brunner 6133770db4 x509: Use subjectKeyIdentifier provided by issuer cert when checking CRL issuer
Some CAs don't use SHA-1 hashes of the public key as subjectKeyIdentifier and
authorityKeyIdentifier.  If that's the case we can't force the
calculation of the hash to compare that to authorityKeyIdentifier in the CRL,
instead we use the subjectKeyIdentifier stored in the issuer certificate, if
available.  Otherwise, we fall back to the SHA-1 hash (or comparing the
DNs) as before.
2015-03-06 16:49:12 +01:00
Tobias Brunner faafaf35f4 bliss: Add generated Huffman codes to the repository
While these files are generated they don't really change and are not
architecture dependant.  The previous solution prevented cross-compilation
from the repository as `bliss_huffman` was built for the target system but
was then executed on the build host to create the source files, which
naturally was bound to fail.

The `recreate-bliss-huffman` make target can be used inside the bliss
directory to update the source files if needed.

Fixes #812.
2015-03-02 12:05:07 +01:00
Andreas Steffen 03b4d11ace Fixed compiler warnings 2015-02-27 08:44:16 +01:00
Andreas Steffen 27bd0fed93 Allow SHA256 and SHA384 data hash for BLISS signatures.
The default is SHA512 since this hash function is also
used for the c_indices random oracle.
2015-02-26 08:56:12 +01:00
Andreas Steffen a7f0ab786d unit-tests: Completed BLISS tests 2015-02-25 21:45:34 +01:00
Andreas Steffen bfb708ea23 Check for null pointer before applying memwipe() 2015-02-25 21:45:34 +01:00
Andreas Steffen c2aca9eed2 Implemented improved BLISS-B signature algorithm 2015-02-25 21:45:34 +01:00