summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCrypto/BigInt
AgeCommit message (Collapse)Author
2021-07-01LibCrypto: Replace use of negate() in SignedBigInteger::bitwise_orGal Horowitz
Calling negate() on a big integer does not make it negative, but rather flips its sign, so this was not actually acting as an OR.
2021-06-29LibCrypto: Replace from_base{2,8,10,16}() & to_base10 with from_base(N)Idan Horowitz
This allows us to support parsing and serializing BigIntegers to and from any base N (such that 2 <= N <= 36).
2021-06-26LibJS+LibCrypto: Allow '_' as a numeric literal separator :^)Andreas Kling
This patch adds support for the NumericLiteralSeparator concept from the ECMAScript grammar.
2021-06-14LibCrypto: Add {Signed,Unsigned}BigInteger::from_base{2, 8, 16} helpersIdan Horowitz
These can be used to create BigInteger instances from non-decimal number strings.
2021-06-14LibJS: Add all of the DataView.prototype.set* methodsIdan Horowitz
2021-06-14LibJS: Add all of the DataView.prototype.get* methodsIdan Horowitz
2021-06-09LibCrypto: Add hash methods to {Signed, Unsigned}BigIntegerIdan Horowitz
These just use hash the underlying bytes that make up the integer words
2021-05-14LibCrypto: Prevent a signed overflow during BigInt Modular PowerDexesTTP
The algorithm isn't explicit about what type this needs to be. But this passes all of the tests, so that's probably fine.
2021-05-13LibCrypto: Reduce the UnsignedBigInteger inline size to 32 wordsDexesTTP
We never really needed the 512 words in the first place, and this does reduce the stack allocations in montgomery modular power from 32Kb to a more manageable 2Kb :^) Note that the 32 words size doesn't provide any performance benefits or drawbacks compared to other values. All values seem to have equivalent performances (the tested values were 1, 2, 4, ..., 512). But since the previous value of 512 was definitely too big, let's reduce it for now!
2021-05-13LibCrypto: Add the montgomery modular power algorithmDexesTTP
This algorithm allows for much faster computations of modular powers (around a 5x-10x speedup of the Crypto test). However, it is only valid for odd modulo values, and therefore the old algorithm must be kept for computations involving even modulo values.
2021-05-13LibCrypto: Add a += operation to UnsignedBigIntegerAlgorithmsDexesTTP
This new operation is immediately used in several existing algorithms.
2021-05-13LibCrypto: Add the UnsignedBigInteger::Word aliasDexesTTP
This makes it clearer which variables are operating on words instead of directly operating on raw values.
2021-05-13LibCrypto: Split BigInteger operations into an Algorithms classDexesTTP
Since the operations are already complicated and will become even more so soon, let's split them into their own files. We can also integrate the NumberTheory operations that would better fit there into this class as well. This commit doesn't change behaviors, but moves the allocation of some variables into caller classes.
2021-05-13LibCrypto: Fix an out-of-bounds access in UnsignedBigIntegerDexesTTP
This is working fine for TLS because we have a big enough inline capacity, but in theory we could have crashed at any time even with our 512 words of inline capacity.
2021-04-29Everywhere: "indexes" => "indices"Andreas Kling
I've wasted a silly amount of time in the past fretting over which of these words to use. Let's just choose one and use it everywhere. :^)
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-03LibCrypto: Avoid overly big allocs in intermediate ModularPower resultsAnotherTest
If we don't limit the sizes of the intermediate results, they will grow indefinitely, causing each iteration to take longer and longer (in both memcpy time, and algorithm runtime). While calculating the trimmed length is fairly expensive, it's a small cost to pay for uniform iteration times.
2021-03-12Everywhere: Remove klog(), dbg() and purge all LogStream usage :^)Andreas Kling
Good-bye LogStream. Long live AK::Format!
2021-03-08Everywhere: Remove unnecessary whitespace at the end of some lines.Emanuele Torre
2021-02-26Everywhere: Remove a bunch of redundant 'AK::' namespace prefixesLinus Groh
This is basically just for consistency, it's quite strange to see multiple AK container types next to each other, some with and some without the namespace prefix - we're 'using AK::Foo;' a lot and should leverage that. :^)
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-02-14LibCrypto: memcmp() all bytes in UnsignedBigInteger::operator==Linus Groh
`length` is only the (trimmed) size of the word vector, so we have to multiply it with the size of each element to ensure all bytes are compared. Fixes #5335.
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling