Commit graph

2468 commits

Author SHA1 Message Date
AnotherTest
e015ffd5f0 LibCrypto: Ensure that EME padding does not contain zeros
With this fix, we can now reliably open TLS connections!
2020-05-02 12:24:10 +02:00
AnotherTest
05e2c7d9cf LibCrypto+LibTLS: Reformat everything
I have no idea how I'll squash _this_ one...
2020-05-02 12:24:10 +02:00
AnotherTest
a1e1570552 LibCrypto+LibTLS: Generalise the use of IV length
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-02 12:24:10 +02:00
AnotherTest
72d56b46b5 LibTLS: Make enough stuff work to have a demo run
...maybe, sometimes :^)
2020-05-02 12:24:10 +02:00
AnotherTest
7670e5ccf0 LibCore+LibHTTP: Move out the HTTP handler and add HTTPS 2020-05-02 12:24:10 +02:00
AnotherTest
8d20a526e5 LibCrypto: Preallocate 128 words of space for UnsignedBigInteger
This shaves off 1 second of runtime
2020-05-02 12:24:10 +02:00
AnotherTest
2247036acf LibTLS: Implement a preliminary version of the TLS protocol
TLS::TLSv12 is a Core::Socket, however, I think splitting that into a
TLS::Socket would probably be beneficial
2020-05-02 12:24:10 +02:00
AnotherTest
7eb72c72e8 LibCore: Mark Socket::{common_,}connect() virtual and add a on_write 2020-05-02 12:24:10 +02:00
AnotherTest
f1578d7e9e LibCrypto: Fix issues in the Crypto stack
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-02 12:24:10 +02:00
AnotherTest
7adb93ede9 LibCrypto: Implement RSA in terms of UnsignedBigInteger
This commit also adds enough ASN.1/DER to parse RSA keys
2020-05-02 12:24:10 +02:00
AnotherTest
6b742c69bd LibCrypto: Add ::import_data() and ::export_data() to UnsignedBigInteger
These functions allow conversion to-and-from big-endian buffers
This commit also adds a ""_bigint operator for easy bigint use
2020-05-02 12:24:10 +02:00
Itamar
c52d3e65b9 LibCrypto: Cleanup UnsignedBigInteger a bit
- Add missing 'explicit' to the constructor
- Remove unneeded 'AK::' in AK::Vector
- Avoid copying 'words' in constructor
2020-05-02 12:24:10 +02:00
Itamar
2125a4debb LibCrypto: Add base-10 string de/serialization methods for bigint 2020-05-02 12:24:10 +02:00
Itamar
709c691f38 LibCrypto: Fix bug in big int subtraction
A regression test was added to the suite.

This commit also generally simplifies the subtraction method.
2020-05-02 12:24:10 +02:00
Itamar
0d2777752e LibCrypto: Add UnsignedBigInteger division
The division operation returns both the quotient and the remainder.
2020-05-02 12:24:10 +02:00
Itamar
2959c4a5e9 LibCrypto: Add UnsignedBigInteger multiplication
Also added documentation for the runtime complexity of some operations.
2020-05-02 12:24:10 +02:00
Itamar
2843dce498 LibCrypto: Fix a bug in big int addition
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-02 12:24:10 +02:00
Itamar
e0cf40518c LibCrypto: Add UnsignedBigInteger subtraction and comparison 2020-05-02 12:24:10 +02:00
Itamar
6201f741d4 LibCrypto: Add UnsignedBigInteger and implement addition
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-02 12:24:10 +02:00
AnotherTest
8c645916b4 LibCrypto: Add SHA512
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-02 12:24:10 +02:00
AnotherTest
ca097b093b LibCrypto: Add SHA256 hash function 2020-05-02 12:24:10 +02:00
AnotherTest
f2cd004d11 LibCrypto: Implement HMAC 2020-05-02 12:24:10 +02:00
AnotherTest
4f89a377a4 LibCrypto: Move each subsection into its own namespace 2020-05-02 12:24:10 +02:00
AnotherTest
bffb2c7542 LibCrypto: Add HashFunction and implement MD5 2020-05-02 12:24:10 +02:00
AnotherTest
899ca245ae LibCrypto: Implement Cipher and AES_CBC
Also adds a test program to userland
2020-05-02 12:24:10 +02:00
AnotherTest
7f1d3f6d62 LibLine: Handle ^L while in search mode
This commit fixes the following misbehaviour:
```
> <- search prompt moves here
>
> ^R^L <- actual prompt stays here
```
2020-05-02 11:57:21 +02:00
Emanuele Torre
be1a5bf3f7 LibJS: Add ConsoleMessage concept
A ConsoleMessage is a struct cointaining:
 * AK::String text;         represents the text of the message sent
                             to the console.
 * ConsoleMessageKind kind; represents the kind of JS `console` function
                             from which the message was sent.

Now, Javascript `console` functions only send a ConsoleMessage to the
Interpreter's Console instead of printing text directly to stdout.
The Console then stores the recived ConsoleMessage in
Console::m_messages; the Console does not print to stdout by default.

You can set Console::on_new_message to a void(ConsoleMessage&); this
function will get call everytime a new message is added to the Console's
messages and can be used, for example, to print ConsoleMessages to
stdout or to color the output based on the kind of ConsoleMessage.

In this patch, I also:
  * Re-implement all the previously implemented functions in the
     JavaScript ConsoleObject, as wrappers around Console functions
     that add new message to the Console.
  * Implement console.clear() like so:
    - m_messages get cleared;
    - a new_message with kind set ConsoleMessageKind::Clear gets added
       to m_messages, its text is an empty AK::String;
  * Give credit to linusg in Console.cpp since I used his
     console.trace() algorithm in Console::trace().

I think that having this abstration will help us in the implementation
of a browser console or a JS debugger. We could also add more MetaData
to ConsoleMessage, e.g. Object IDs of the arguments passed to console
functions in order to make hyperlinks, Timestamps, ecc.; which could be
interesting to see.

This will also help in implementing a `/bin/js` option to make, for
example, return a ConsoleMessageWrapper to console functions instead of
undefined. This will be useful to make tests for functions like
console.count() and console.countClear(). :^)
2020-05-02 11:41:35 +02:00
Emanuele Torre
e9c7d4524a LibJS: Implement ConsoleObject::count() as a Console::count() wrapper
Also implement ConsoleObject::count_clear() as a wrapper for
Console::count_clear()
2020-05-02 11:41:35 +02:00
Emanuele Torre
2e92c2e5e1 LibJS: Start implementing a Console class for the interpreter
The goal is to start factoring out core ConsoleObject functionality and
to make ConsoleObject only a JS wrapper around Console.
2020-05-02 11:41:35 +02:00
Andreas Kling
745b0b27fd WindowServer+LibGUI: Automatically close child windows with parent
If a window has child windows when it's destroyed, WindowServer will
now automatically tear down all of its children as well.

This is communicated to the client program through a vector of window
ID's included with the response to WindowServer::DestroyWindow.

This does feel a little bit awkward, but managing it on the client side
also seems a bit awkward.
2020-05-02 01:29:55 +02:00
Andreas Kling
828aee9932 LibGUI: Make ComboBox list pop-up windows frameless
This is much better than the hack we had of making them Tooltip windows
since frameless windows end up at the right layer in the window stack
automatically, and always get yanked above the parent window simply by
being child windows.
2020-05-02 01:29:55 +02:00
Andreas Kling
d847304cb9 WindowServer+LibGUI: Add "frameless" window flag
This allows you to create windows with no title bar or window frame.
2020-05-02 01:29:55 +02:00
Andreas Kling
bb7eb3e104 WindowServer+LibGUI: Remove unused Window::show_titlebar() flag
Nobody was using this flag, so let's stop maintaining it. It's easy to
add it back if we ever want the behavior.
2020-05-02 01:29:55 +02:00
Andreas Kling
6228f72b87 LibGUI+WindowServer: Inform WindowServer about parent/child windows
If a window has another window in its Core::Object ancestor chain,
we now communicate that relationship to WindowServer so that it can
act with awareness of parent/child windows.
2020-05-02 01:29:55 +02:00
LepkoQQ
c7f0de14b5 LibGfx: Decode paletted and grayscale images with 1/2/4 bit depth
When dealing with png data that has less than 8 bits per pixel, round
up to the next byte when allocating per row buffers and streamers. This
fixes decoding odd sized PNGs with less than 8 bits per pixel.

Also added a test page with some odd sized palleted PNGs.
2020-05-02 01:28:18 +02:00
Valtteri Koskivuori
61cea6a29d LibM: Implement fmodf() 2020-05-02 01:23:30 +02:00
Linus Groh
43c1fa9965 LibJS: Implement (no-op) debugger statement 2020-05-01 22:07:13 +02:00
Hüseyin ASLITÜRK
5c022ac939 LibGUI: INI file syntax highlighter 2020-05-01 16:58:18 +02:00
Hüseyin ASLITÜRK
5267ccbc22 LibGUI: Icon for INI file type 2020-05-01 16:58:18 +02:00
Linus Groh
79b829637e LibJS: Implement most of the Reflect object 2020-05-01 16:54:01 +02:00
Linus Groh
1ba2e6768d LibJS: Implement indexed access for StringObject 2020-05-01 16:54:01 +02:00
Linus Groh
a81bce8c2a LibJS: Make Array.length non-configurable
This was incorrect, it's only writable.
2020-05-01 16:54:01 +02:00
Linus Groh
65dbe17dd7 LibJS: Add Value::to_size_t() 2020-05-01 16:54:01 +02:00
Linus Groh
62671bea68 LibJS: Add Object::has_property()
Like Object::has_own_property() but going down the prototype chain.
2020-05-01 16:54:01 +02:00
Linus Groh
4cdd802927 LibJS: Return a bool from Object::put* to indicate success 2020-05-01 16:54:01 +02:00
Kesse Jones
6dbb5df81f LibJS: Add String.prototype.lastIndexOf 2020-05-01 16:50:37 +02:00
Emanuele Torre
46b79eaad9 LibJS: Implement console.countReset()
I chose to also make it print "<counter_name>: 0\n" when a counter gets
reset, similarly to how firefox behaves.
2020-05-01 13:02:01 +02:00
Emanuele Torre
8c60ba1e42 LibJS: Implement console.count() 2020-05-01 13:02:01 +02:00
Matthew Olsson
28ef654d13 LibJS: Add object literal method shorthand 2020-05-01 12:28:40 +02:00
Andreas Kling
770dedcc23 LibGUI: Remove some ancient unused debug logging 2020-04-30 22:42:02 +02:00