Commit Graph

777 Commits

Author SHA1 Message Date
AnotherTest
ac701cb589 Userland: Send absolute paths to LaunchServer and show what failed 2020-05-10 00:39:14 +02:00
Andres Vieira
7433210fa6 Userland: Add unzip command
The unzip command will unzip a zip file passed as an argument into the
current pwd, with the syntax:
   unzip file.zip

This implementation is pretty barebones as it does not support things
like file access times, compression or even compression detection, so
if the user tries to unzip a compressed zip most probably he would find
wrong data inside the files.

However it's an starting point :^)
2020-05-09 23:50:44 +02:00
Linus Groh
325513b20d Userland: Add missing copyright header to test-crypto.cpp 2020-05-09 23:45:16 +02:00
Linus Groh
3153739d60 Userland: Add missing copyright header to disasm.cpp 2020-05-09 23:45:16 +02:00
Andreas Kling
00b87167fe ls: Make filenames in the output hyperlinked
This allows you to Ctrl+Click in Terminal to open files in "ls" output.
2020-05-09 16:17:47 +02:00
Nicholas Hollett
b7810a31c3 LibDesktop: Switch to LaunchServer for DesktopServices::open
Moves DirectoryServices out of LibCore (because we need to link with
LibIPC), renames it Desktop::Launcher (because Desktop::DesktopServices
doesn't scan right) and ports it to use the LaunchServer which is now
responsible for starting programs for a file.
2020-05-09 15:13:32 +02:00
Ben Wiederhake
eec99b23a0 Userland: Remove double-'#include' in date.cpp 2020-05-09 10:00:29 +02:00
Andreas Kling
5bfd893292 Kernel+Userland: Add "settime" pledge promise for setting system time
We now require the "settime" promise from pledged processes who want to
change the system time.
2020-05-08 22:54:17 +02:00
Linus Groh
9dbab2d05e Misc: Replace "String(string_view)" with "string_view.to_string()"
StringView::to_string() was added in 917ccb1 but not actually used
anywhere yet.
2020-05-06 19:28:59 +02:00
Andreas Kling
5c12f3fef0 js: Tighten up ReplConsoleClient::trace() a little bit
Remove a bunch of unnecessary String copying.
2020-05-05 11:49:14 +02:00
Linus Groh
a2e1f1a872 LibJS: Implement exponentiation assignment operator (**=) 2020-05-05 11:12:27 +02:00
Linus Groh
3e754a15d4 LibJS: Implement bitwise assignment operators (&=, |=, ^=) 2020-05-05 11:12:27 +02:00
Emanuele Torre
73a7a589c2 js: Customise the behaviour of JS::Console with ReplConsoleClient
This also makes our JavaScript tests not fail.
2020-05-05 09:15:16 +02:00
Emanuele Torre
046f9cf115 LibJS: Remove ConsoleMessage from LibJS
We don't need to store the past messages in LibJS.
We'll implement a way to let LibJS users expand the vanilla Console.
2020-05-05 09:15:16 +02:00
Andreas Kling
7dd49047f3 keymap: Fix crash introduced by 637ecdb
Just because a Vector has some inline capacity doesn't mean we can put
data at offsets < Vector::size().

Fixes #2104.
2020-05-05 00:12:51 +02:00
mattco98
adb4accab3 LibJS: Add template literals
Adds fully functioning template literals. Because template literals
contain expressions, most of the work has to be done in the Lexer rather
than the Parser. And because of the complexity of template literals
(expressions, nesting, escapes, etc), the Lexer needs to have some
template-related state.

When entering a new template literal, a TemplateLiteralStart token is
emitted. When inside a literal, all text will be parsed up until a '${'
or '`' (or EOF, but that's a syntax error) is seen, and then a
TemplateLiteralExprStart token is emitted. At this point, the Lexer
proceeds as normal, however it keeps track of the number of opening
and closing curly braces it has seen in order to determine the close
of the expression. Once it finds a matching curly brace for the '${',
a TemplateLiteralExprEnd token is emitted and the state is updated
accordingly.

When the Lexer is inside of a template literal, but not an expression,
and sees a '`', this must be the closing grave: a TemplateLiteralEnd
token is emitted.

The state required to correctly parse template strings consists of a
vector (for nesting) of two pieces of information: whether or not we
are in a template expression (as opposed to a template string); and
the count of the number of unmatched open curly braces we have seen
(only applicable if the Lexer is currently in a template expression).

TODO: Add support for template literal newlines in the JS REPL (this will
cause a syntax error currently):

    > `foo
    > bar`
    'foo
    bar'
2020-05-04 16:46:31 +02:00
Ben Wiederhake
f09a8f8a6e sysctl: Permit 'sysctl -a' invocation
The point of '-a' is to list all keys.
It is counter-intuitive to require the user to then
supply a specific key additionally.
2020-05-04 09:41:43 +02:00
Ben Wiederhake
e6547a7e95 sysctl: Fix newlines in error messages 2020-05-04 09:41:43 +02:00
Andreas Kling
e09b83c60c LibTextCodec: Start fleshing out a simple text codec library
We're starting with a very basic decoding API and only ISO-8859-1 and
UTF-8 decoding (and UTF-8 decoding is really a no-op since String is
expected to be UTF-8.)
2020-05-03 23:01:58 +02:00
Andreas Kling
eb6e35a1be ProtocolServer: Pass HTTP response headers to the client
We now store the response headers in a download object on the protocol
server side and pass it to the client when finishing up a download.

Response headers are passed as an IPC::Dictionary. :^)
2020-05-03 23:01:58 +02:00
DexesTTP
d008a38f93 LibCrypto: Small fixes in BigInteger & test-crypto 2020-05-03 14:31:26 +02:00
DexesTTP
8ad48cca29 test-crypto: Display execution time for passing tests 2020-05-03 14:31:26 +02:00
AnotherTest
06cf9d3fb7 ProtocolServer: Implement and handle download progress
Also updates `pro` to display download progress and speed on stderr
2020-05-03 12:59:26 +02:00
Shannon Booth
637ecdb415 Userland: Fix leak in keymap
Pretty harmless here, but eh
2020-05-03 11:42:32 +02:00
Linus Groh
ce0bed0482 js: Ignore property attributes for completion
Only being able to complete enumerable properties is annoying,
especially since we updated everything to use the correct attributes.

Most standard built-in objects are *not* enumerable.
2020-05-02 19:21:50 +02:00
AnotherTest
b394543d3c Userland: Tweak the tests in test-crypto
- Clarify the purpose of "AES | Specialised Encrypt"
- Decouple the TLS test from the host machine
- Add a "test" mode to run all available tests
2020-05-02 12:24:10 +02:00
AnotherTest
adab43987d LibCrypto: Rename UnsignedBigInteger APIs to match their actions 2020-05-02 12:24:10 +02:00
AnotherTest
75310003e5 Userland test-crypto: Add interactive mode for the tls 'mode'
For all your raw TLS testing needs :^)
2020-05-02 12:24:10 +02:00
AnotherTest
bb46e5f608 LibTLS: Switch to Hash::Manager for hashing and add SHA1
Now we can talk to google.com
2020-05-02 12:24:10 +02:00
AnotherTest
e997661e26 LibCrypto: Implement SHA1 Hash Function 2020-05-02 12:24:10 +02:00
AnotherTest
7384d58a0a Userland: Adapt test-crypto to the new AK::Result API 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
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
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
96dd7c2996 Userland: Add MD5 tests to test-crypto
This commit also reworks the test program to have a better interface:
`test-crypto <mode> [options]`
where each mode has its own default suite
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
Emanuele Torre
e861af2a5c js: Print ConsoleMessages and color the output based on their kind :^) 2020-05-02 11:41:35 +02:00
Linus Groh
43c1fa9965 LibJS: Implement (no-op) debugger statement 2020-05-01 22:07:13 +02:00