aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
Commit message (Collapse)AuthorAgeFilesLines
* Make Stream_Cipher::set_iv() pure virtualRené Korthaus2016-07-205-7/+15
| | | | | | | | | | It provided a default implementation that only checked that the length was correct, but ignored the actual data and did not notify the caller, which seemed like a rather odd behaviour. The only implementation that used this default implementation, RC4, now throws an exception.
* Merge GH #541 More ECIES testsJack Lloyd2016-07-191-2/+2
|\
| * add more ECIES testsDaniel Neus2016-07-191-2/+2
| |
* | Compile fixJack Lloyd2016-07-181-1/+1
| |
* | Fix proc_walk - would always return 0 entropy collected.Jack Lloyd2016-07-182-7/+10
| | | | | | | | | | | | Fix BeOS stat reader - was calling wrong function on the rng. Remove entropy estimate defines from build.h, no longer used.
* | Merge GH #520 RNG changesJack Lloyd2016-07-1843-695/+837
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds Stateful_RNG base class which handles reseeding after some amount of output (configurable at instantiation time, defaults to the build.h value) as well as detecting forks (just using pid comparisons, so still vulnerable to pid wraparound). Implemented by HMAC_RNG and HMAC_DRBG. I did not update X9.31 since its underlying RNG should already be fork safe and handle reseeding at the appropriate time, since a new block is taken from the underlying RNG (for the datetime vector) for each block of output. Adds RNG::randomize_with_input which for most PRNGs is just a call to add_entropy followed by randomize. However for HMAC_DRBG it is used for additional input. Adds tests for HMAC_DRBG with AD from the CAVS file. RNG::add_entropy is implemented by System_RNG now, as both CryptGenRandom and /dev/urandom support receiving application provided data. The AutoSeeded_RNG underlying type is currently selectable in build.h and defaults to HMAC_DRBG(SHA-256). AutoSeeded_RNG provides additional input with each output request, consisting of the current pid, a counter, and timestamp (unless the application explicitly calls randomize_with_input, in which case we just take what they provided). This is the same hedge used in HMAC_RNGs output PRF. AutoSeeded_RNG is part of the base library now and cannot be compiled out. Removes Entropy_Accumulator type (which just served to bridge between the RNG and the entropy source), instead the Entropy_Source is passed a reference to the RNG being reseeded, and it can call add_entropy on whatever it can come up with.
| * Address some review comments from @cordneyJack Lloyd2016-07-179-27/+29
| | | | | | | | | | | | | | | | | | Use consistent naming for the max output before reseed parameter. The constant (default) value is renamed to BOTAN_RNG_DEFAULT_MAX_OUTPUT_BEFORE_RESEED, since without the DEFAULT_ it reads like a compile time maximum instead. Use uint8_t instead of byte.
| * Fix assignmentJack Lloyd2016-07-171-1/+1
| |
| * Revamp entropy pollingJack Lloyd2016-07-1730-377/+294
| | | | | | | | | | Remove Entropy_Accumulator, instead have entropy sources directly add entropy to the RNG.
| * Move poll logic to Entropy_SourcesJack Lloyd2016-07-173-18/+27
| |
| * Add Stateful_RNGJack Lloyd2016-07-1713-170/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Handles fork checking for HMAC_RNG and HMAC_DRBG AutoSeeded_RNG change - switch to HMAC_DRBG as default. Start removing the io buffer from entropy poller. Update default RNG poll bits to 256. Fix McEliece test, was using wrong RNG API. Update docs.
| * Make the DRBG hash selectable in build.h with BOTAN_AUTO_RNG_DRBG_HASH_FUNCTIONJack Lloyd2016-07-172-3/+3
| | | | | | | | Add some missing overrides
| * If EPERM when writing to the random device, return silently.Jack Lloyd2016-07-171-1/+13
| | | | | | | | | | | | | | | | | | That failure seems like an explicit system policy decision, so accept it as such. Versus say EBADF or EFAULT which would instead suggest a library bug. This return is seen on OS X Travis CI, unclear if this is a problem with OS X or with how Travis does OS X containers.
| * Switch to HMAC_DRBG for all RNG generation.Jack Lloyd2016-07-1711-241/+414
| | | | | | | | | | | | | | | | Add support and tests for additional_data param to HMAC_DRBG Add Stateful_RNG class which has fork detection and periodic reseeding. AutoSeeded_RNG passes the current pid and time as additional_data
* | Merge GH #535 Use Cipher_Mode instead of Pipe in ECIESJack Lloyd2016-07-173-22/+20
|\ \
| * | replace (deprecated) Pipe API with Cipher_Mode in ECIESDaniel Neus2016-07-133-22/+20
| | |
* | | Merge GH #533 DLIES changesJack Lloyd2016-07-173-100/+261
|\ \ \
| * | | DLIES reworkDaniel Neus2016-07-133-100/+261
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With these fixes the implementation is now compatible with bouncycastle and it should operate as it is specified in "DHIES: An encryption scheme based on Diffie-Hellman Problem" or in BSI technical guideline TR-02102-1. In addition to the already present XOR-encrypion/decryption mode it's now possible to use DLIES with a block cipher. Previously the input to the KDF was the concatenation of the (ephemeral) public key and the secret value derived by the key agreement operation: ``` secure_vector<byte> vz(m_my_key.begin(), m_my_key.end()); vz += m_ka.derive_key(0, m_other_key).bits_of(); const size_t K_LENGTH = length + m_mac_keylen; secure_vector<byte> K = m_kdf->derive_key(K_LENGTH, vz); ``` I don't know why this was implemented like this. But now the input to the KDF is only the secret value obtained by the key agreement operation. Furthermore the order of the output was changed from {public key, tag, ciphertext} to {public key, ciphertext, tag}. Multiple test vectors added that were generated with bouncycastle and some with botan itself.
* | | Merge GH #537 Add test vectors for KDF1/ISO18033Jack Lloyd2016-07-172-3/+3
|\ \ \ | |_|/ |/| |
| * | Add test vectors for KDF1/ISO18033René Korthaus2016-07-152-3/+3
| |/
* | Fix SecRandomCopyBytes call with older OS X SDKsJack Lloyd2016-07-151-0/+1
| | | | | | | | | | | | | | | | | | | | In 10.8 (and presumably older) versions, the header for SecRandomCopyBytes is SecRandom.h, and Security.h does not include SecRandom.h With this change, the include of Security.h may be redundant for all versions, but I have no way to test this. GH #528
* | Fix undefined behavior in donna128 typeJack Lloyd2016-07-151-6/+12
|/ | | | | | | Caused Curve25519 tests to fail when compiled by Clang on ARM, may have affected other 32-bit platforms. GH #532
* Add test vectors for block cipher padding modesRené Korthaus2016-07-112-2/+5
| | | | | | | | | | | Exports get_bc_pad() to be used from tests. Adds separate handcrafted tests for block cipher padding modes. They were previously only tested implicitly during the block cipher modes of operation tests, though not all padding modes were covered. And in case a mode of operation is not part of the enabled modules, the previously tested padding modes are not covered at all. Fixes an off-by-one bug in the previously untested ANSI X9.23 padding mode, where the number of zero bytes in the pad was one more than allowed by the standard.
* Merge GH #526 Some PKCS #11 fixes when used with BSI policyJack Lloyd2016-07-051-1/+0
|\
| * remove rfc6979 module dependency for pkcs11Daniel Neus2016-07-051-1/+0
| | | | | | | | no longer needed since hash_for_emsa() is now in emsa.h
* | prevent massive amount of MSVC C4100 warningsDaniel Neus2016-07-051-0/+5
|/
* Merge GH #507 Add PKCS #11 support. Previous merge 360a3a5 missed later commitsJack Lloyd2016-07-047-37/+12
|\
| * remove unnecessary includeDaniel Neus2016-06-281-1/+0
| |
| * fix some warnings and one compile errorDaniel Neus2016-06-284-6/+7
| |
| * reuse BigInt::encode_1363 instead of self written logicDaniel Neus2016-06-281-6/+1
| |
| * use NULL_RNG to make clear that the RNG is not usedDaniel Neus2016-06-282-24/+4
| |
* | Merge GH #522 Update BSI policy, fix TLSJack Lloyd2016-07-042-3/+8
|\ \
| * | Remove unused kdf2 dependency from tls moduleRené Korthaus2016-07-041-1/+0
| | |
| * | Various fixes with bsi module policyRené Korthaus2016-07-042-2/+8
| | |
* | | Merge GH #507 Add PKCS #11 supportJack Lloyd2016-07-0429-12/+7304
|\ \ \ | |/ / |/| / | |/
| * add PKCS#11 supportDaniel Neus2016-06-1729-12/+7304
| |
* | Add missing override annotation. Fix formatting in ECIES testsJack Lloyd2016-06-301-1/+1
| |
* | Add ECKDSA OIDs for SHA signaturesJack Lloyd2016-06-221-0/+4
| | | | | | | | From http://rootca.kisa.or.kr/kcac/down/Guide/Object%20Identifier%20Guideline%20for%20the%20Electronic%20Signature%20Certification%20System.pdf
* | Update KDF1-ISO 18033 with KDF label argumentJack Lloyd2016-06-202-2/+5
| |
* | Merge GH #504 Add ECKCDSAJack Lloyd2016-06-2019-26/+431
|\ \
| * | Add ECKCDSA signature algorithmRené Korthaus2016-06-1421-26/+439
| |/
* | Merge GH #483 Add ECIES and KDF1 from ISO 18033Jack Lloyd2016-06-207-0/+782
|\ \
| * \ Merge remote-tracking branch 'remotes/origin/master' into eciesPhilipp Weber2016-05-3027-90/+82
| |\ \
| * | | ecies review change: decrypt only if mac is correct and catch exceptions ↵Philipp Weber2016-05-231-11/+25
| | | | | | | | | | | | | | | | during decryption
| * | | add ecies implementation according to iso-18033Philipp Weber2016-04-273-0/+687
| | | |
| * | | add kdf1 implementation according to iso-18033 (preparation for ecies)Philipp Weber2016-04-274-0/+81
| | | |
* | | | Merge GH #497 Add StreamCipher::seek and implementation for ChaChaJack Lloyd2016-06-1812-4/+64
|\ \ \ \ | | | | | | | | | | | | | | | Also adds ChaCha8 support
| * | | | Adding StreamCipher::seek interface, supporting seek in ChaCha, and also ↵SimCog2016-06-1812-4/+64
| | |_|/ | |/| | | | | | | | | | adding ChaCha8 support
* | | | Merge GH #487 Remove CVC certificates and EMSA1_BSI signature encodingJack Lloyd2016-06-1724-2437/+1
|\ \ \ \
| * | | | remove the already bitrotting and probably broken CVC implementationDaniel Neus2016-05-1818-2350/+0
| | | | |