summaryrefslogtreecommitdiff
path: root/Libraries/LibCrypto
AgeCommit message (Collapse)Author
2020-11-29LibCrypto: Require intent parameter in CTR constructorLuke
This was preventing clang from building.
2020-11-14LibCrypto: Implement GCM modeAnotherTest
2020-11-14LibCrypto: Move out 'VerificationConsistency' into its own header fileAnotherTest
2020-11-14LibCrypto: Templatise CTR<T> on the increment functionAnotherTest
2020-10-30LibCrypto: Remove spammy ModPow debug logAnotherTest
2020-10-20Everywhere: Redundant inline specifier on constexpr functions (#3807)Lenny Maiorani
Problem: - `constexpr` functions are decorated with the `inline` specifier keyword. This is redundant because `constexpr` functions are implicitly `inline`. - [dcl.constexpr], ยง7.1.5/2 in the C++11 standard): "constexpr functions and constexpr constructors are implicitly inline (7.1.2)". Solution: - Remove the redundant `inline` keyword.
2020-09-25Meta+LibC through LibHTTP: Make clang-format-10 cleanBen Wiederhake
Why break at LibHTTP? Because "Meta+Libraries" would be insanely large, and breaking between LibHTTP and LibJS makes the commits roughly evenly large.
2020-08-28LibCrypto: Do not silently ignore key size mismatchBen Wiederhake
Before, when the actually passed key was too long, the extra bytes were silently ignored. This can lead to all sorts of trouble, so ... don't do that. The original intention was maybe to support non-integer amounts of key bytes. But that doesn't happen anyway with AES.
2020-08-25AK: Add Endian.h header to replace NetworkOrdered.h.asynts
2020-08-23LibCrypto: Don't cause errors when function unusedBen Wiederhake
Any (future) program that includes this header would fail to compile, because the private symbol 'kind_name' is defined, along with a bunch of code, but unused. A good way to see this is by #include'ing LibCrypto/ASN1/ASN1.h in an unrelated .cpp-file, for example Userland/md.cpp. No other headers seem to have this problem.
2020-08-17LibCrypto: Don't include <Libraries/...>Andreas Kling
2020-08-17LibCrypto: Call bytes() explicitly instead of implicitly.asynts
This was a careless mistake. https://github.com/SerenityOS/serenity/pull/3166#discussion_r471131732
2020-08-16LibCrypto: Fix MB => MiB build issueAndreas Kling
2020-08-16LibCrypto: Move large functions to cpp fileBen Wiederhake
If they use up so much stack space, contain (sometimes several) loops, and take a noticable amount of time anyway, then 'inline' is probably going to be ignored by the compiler anyway.
2020-08-16LibCrypto: Fix random generation and primality testsBen Wiederhake
It was quite silly that LibCrypto thought that 30! is a prime number! :P
2020-08-16LibCrypto: Document word order (endianness) of bigintBen Wiederhake
2020-08-16LibCrypto: Fix random number generationBen Wiederhake
2020-08-15Refactor: Use ReadonlyBytes instead of const ReadonlyBytes&.asynts
2020-08-15AK: Rename span() to bytes() when appropriate.asynts
I originally defined the bytes() method for the String class, because it made it obvious that it's a span of bytes instead of span of characters. This commit makes this more consistent by defining a bytes() method when the type of the span is known to be u8. Additionaly, the cast operator to Bytes is overloaded for ByteBuffer and such.
2020-08-11LibCrypto+LibTLS+Kernel: Switch the Cipher::Mode interface to use SpanAnotherTest
This shaves 2.5 more runtime seconds off 'disasm /bin/id', and makes the Mode<T> interface a lot more allocation-friendly.
2020-08-11Crypto: Make AES call malloc much less oftenNico Weber
ByteBuffer::slice_view() allocates a new ByteBuffer object, which as a RefPtr and everything. Nowadays it should probably return a Bytes / Span<u8>, but AES was only using slice_view() to extract the pointer again. So just add ady a range check at the top, and do pointer arithmetic to do the same thing faster. Reduces time to run `disasm /bin/id` by a bit under 40%, from ~8.3s to ~5s (min-of-3 runs).
2020-08-05LibTLS + LibCrypto: Suppress unobserved Optoinal<T> return values.Brian Gianforcaro
2020-08-02LibCrypto: Format the comments in ASN1/PEM.h correctlyAnotherTest
2020-07-31LibCrypto: Do not trim leading zeros in export_data by defaultAnotherTest
This fixes the issue with the exported data having a leading zero, causing RSA::encrypt to trim the block down, and ruining the encryption. Fixes #2691 :^)
2020-07-30LibCrypto: Add some checksum algorithmsstelar7
Namely CRC32 and Adler32
2020-07-28LibCrypto: Implement and test CTR decryptionBen Wiederhake
2020-07-28LibCrypto: Fix broken CTR mode, implement RFC 3686 Test VectorsBen Wiederhake
2020-07-28LibCrypto: Document CTR weirdness in depthBen Wiederhake
2020-07-28LibCrypto: Already using strong cryptoBen Wiederhake
ModularFunctions::random_number calls into AK::fill_with_random calls (on Serenity) into arc4random_buf calls into Process::sys calls into get_good_random_bytes, which is cryptographically secure.
2020-07-27LibCrypto: Change the signatures of RSA::import_[XXX]_key to use Span.asynts
2020-07-27LibCrypto: Change the signature of decode_pem to use Span.asynts
2020-07-27LibCrypto: Change the signature of RSA::parse_rsa_key to use Span.asynts
2020-07-27LibCrypto: Change [XXX]BigInteger::export_data() to use Span.asynts
2020-07-27LibCrypto: This method wrote to a const pointer.asynts
2020-07-25LibCrypto: Optimize UnsignedBigInteger import_data/export_dataTom
No need to do complicated math to import or export numbers, just convert the byte stream to words and vice versa.
2020-06-25LibCrypto: Add CTR cipher modePeter Elliott
Kernel: Changed fortuna implementation to use CTR mode instead of manually implementing a counter.
2020-06-25LibCrypto: Add missing <AK/StringView.h> includePeter Elliott
2020-06-07LibCrypto: Add bitwise operations (and/or/xor)AnotherTest
2020-06-07LibCrypto: Make ModularFunctions.h compile as part of LagomLinus Groh
Compiler was complaining about two ambiguous overloads. Also make some functions "inline" to fix warnings about unused functions.
2020-06-07LibCrypto: Fix to_base10() for zero-value BigIntegersLinus Groh
All the magic is happening in a "while != 0" loop, so we ended up with an empty string for zero-value BigIntegers. Now we just check that upfront and return early.
2020-06-05LibCrypto: Add a simple SignedBigIntegerAnotherTest
This patchset adds a simple SignedBigInteger that is entirely defined in terms of UnsignedBigInteger. It also adds a NumberTheory::Power function, which is terribly inefficient, but since the use of exponentiation is very much discouraged for large inputs, no particular attempts were made to make it more performant.
2020-06-04LibCrypto: Correctly pad blocks with FinalBlockSize < size < BlockSizeAnotherTest
This fixes #2488
2020-05-29LibCrypto: Fix some issues preventing compilation w/ clang 10AnotherTest
2020-05-29LibCrypto: Format all files with clang-format 10AnotherTest
2020-05-29Meta: Add a script check the presence of "#pragma once" in header filesEmanuele Torre
.. and make travis run it. I renamed check-license-headers.sh to check-style.sh and expanded it so that it now also checks for the presence of "#pragma once" in .h files. It also checks the presence of a (single) blank line above and below the "#pragma once" line. I also added "#pragma once" to all the files that need it: even the ones we are not check. I also added/removed blank lines in order to make the script not fail. I also ran clang-format on the files I modified.
2020-05-27LibCrypto+LibTLS: Use AK/Random.hAndreas Kling
This makes it possible to build both of these on Linux.
2020-05-26LibCrypto: Put some debug spam behind CRYPTO_DEBUGAndreas Kling
2020-05-14Build: Switch to CMake :^)Sergey Bugaev
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-07LibCrypto: Cache the "trimmed length" of UnsignedBigIntegersAndreas Kling
This avoids repeated traversals of the underlying words and gives a 30% speed-up on "test-crypto -t pk" :^)
2020-05-03LibCrypto: Manage vector sizing manually in performance-critical placesAndreas Kling
Use Vector::resize_and_keep_capacity() to resize BigInt vectors to just the right size without risking deallocation. Then do direct indexed accesses to the underlying words (or use memset/memcpy.) This gives a ~40% speed-up on the RSA tests in "test-crypto -t pk" :^)