summaryrefslogtreecommitdiff
path: root/Libraries/LibCrypto
AgeCommit message (Collapse)Author
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" :^)
2020-05-03LibCrypto: Added BigInteger 'division by u16' operatorDexesTTP
2020-05-03LibCrypto: Changed ModularFunctions to use non-allocating operationsDexesTTP
This change leads to between 10% and 35% performance improvement when executing the RSA decryption method. The main impact is to drastically reduce the number of allocations done in this method from around 50% of the profile hits to less than 2%.
2020-05-03LibCrypto: Added static non-allocating UnsignedBigInteger operatorsDexesTTP
This changes the plus, minus, etc... operators from UnsignedBigInteger to use a static helper method. The static methods do not allocate any variables, instead all the required BigInteger output and temporary variables are required on call as parameters. This change already optimizes the number of allocations in complex operations such as multiply or divide, by having a single allocation per call (instead of one per loop). This new API also provides a way to limit the number of allocations for complex computations in other parts of the code. This is done by using these helpers in any place that currently makes use of the standard operators.
2020-05-03LibCrypto: Small fixes in BigInteger & test-cryptoDexesTTP
2020-05-03LibCrypto: Correct RFC5246 un-padding behaviourAnotherTest
The decrypted data is legally allowed to have any amount of padding, so long as it is block-aligned, we should not assume that padding bytes fall inside the same block, or that an entire block cannot be padding. Fixes #2072
2020-05-02LibCrypto: Make UnsignedBigInteger as fast as architecturally possibleAnotherTest
This commit attempts to make UnsignedBigInteger as fast as possible without changing the underlaying architecture. This effort involves - Preallocating space for vector operations - Avoiding calls to computationally expensive functions - Inlining or flattening functions (sensibly)
2020-05-02LibCrypto: Tweak ::prune_padding() to be more intuitive with loop boundsAnotherTest
2020-05-02LibCrypto: Rename UnsignedBigInteger APIs to match their actionsAnotherTest
2020-05-02LibCrypto: Preallocate capacity and cache trimmed_length() in UnsignedBigIntegerAnotherTest
2020-05-02LibTLS: Switch to Hash::Manager for hashing and add SHA1AnotherTest
Now we can talk to google.com
2020-05-02LibCrypto: Add a Hash::Manager that can act as any one of the hashesAnotherTest
2020-05-02LibCrypto: Implement SHA1 Hash FunctionAnotherTest
2020-05-02LibCrypto: Ensure that EME padding does not contain zerosAnotherTest
With this fix, we can now reliably open TLS connections!
2020-05-02LibCrypto+LibTLS: Reformat everythingAnotherTest
I have no idea how I'll squash _this_ one...
2020-05-02LibCrypto+LibTLS: Generalise the use of IV lengthAnotherTest
This is in preparation for the upcoming Galois/Counter mode, which conventionally has 12 bytes of IV as opposed to CBC's 16 bytes. ...Also fixes a lot of style issues, since the author finally found the project's clang config file in the repository root :^)
2020-05-02LibCrypto: Preallocate 128 words of space for UnsignedBigIntegerAnotherTest
This shaves off 1 second of runtime
2020-05-02LibTLS: Implement a preliminary version of the TLS protocolAnotherTest
TLS::TLSv12 is a Core::Socket, however, I think splitting that into a TLS::Socket would probably be beneficial
2020-05-02LibCrypto: Fix issues in the Crypto stackAnotherTest
This commit fixes up the following: - HMAC should not reuse a single hasher when successively updating - AES Key should not assume its user key is valid signed char* - Mode should have a virtual destructor And adds a RFC5246 padding mode, which is required for TLS
2020-05-02LibCrypto: Implement RSA in terms of UnsignedBigIntegerAnotherTest
This commit also adds enough ASN.1/DER to parse RSA keys
2020-05-02LibCrypto: Add ::import_data() and ::export_data() to UnsignedBigIntegerAnotherTest
These functions allow conversion to-and-from big-endian buffers This commit also adds a ""_bigint operator for easy bigint use
2020-05-02LibCrypto: Cleanup UnsignedBigInteger a bitItamar
- Add missing 'explicit' to the constructor - Remove unneeded 'AK::' in AK::Vector - Avoid copying 'words' in constructor
2020-05-02LibCrypto: Add base-10 string de/serialization methods for bigintItamar
2020-05-02LibCrypto: Fix bug in big int subtractionItamar
A regression test was added to the suite. This commit also generally simplifies the subtraction method.
2020-05-02LibCrypto: Add UnsignedBigInteger divisionItamar
The division operation returns both the quotient and the remainder.
2020-05-02LibCrypto: Add UnsignedBigInteger multiplicationItamar
Also added documentation for the runtime complexity of some operations.
2020-05-02LibCrypto: Fix a bug in big int additionItamar
There was a bug when dealing with a carry when the addition result for the current word was UINT32_MAX. This commit also adds a regression test for the bug.
2020-05-02LibCrypto: Add UnsignedBigInteger subtraction and comparisonItamar
2020-05-02LibCrypto: Add UnsignedBigInteger and implement additionItamar
UnsignedBigInteger stores an unsigned ainteger of arbitrary length. A big integer is represented as a vector of word. Each word is an unsigned int.
2020-05-02LibCrypto: Add SHA512AnotherTest
There is quite a bit of avoidable duplication, however, I could not get the compiler to be happy about SHA2<Size> (see FIXMEs)
2020-05-02LibCrypto: Add SHA256 hash functionAnotherTest
2020-05-02LibCrypto: Implement HMACAnotherTest
2020-05-02LibCrypto: Move each subsection into its own namespaceAnotherTest
2020-05-02LibCrypto: Add HashFunction and implement MD5AnotherTest
2020-05-02LibCrypto: Implement Cipher and AES_CBCAnotherTest
Also adds a test program to userland