24 Commits

Author SHA1 Message Date
Vijay Dhanraj 227b0d2053 [Pal] Add str_to_ulong() common function 2021-01-28 23:18:45 -08:00
Dmitrii Kuvaiskii 8eee4a4742 [LibOS,Pal,Examples,GSC,Docs] Move manifest parsing to TOML
The manifest syntax stays exactly the same, including 0 and 1
integers to denote boolean values (this is done for ease of porting
and can be fixed in future commits). The only visible change is
surrounding strings in the manifest with quotes (requirement of
TOML). All manifests and Makefiles of our tests and example apps are
ported to the new TOML syntax. Documentation is updated.
2020-11-12 05:45:07 -08:00
borysp 3014a0dd1c Miscelaneous inline asm fixes
Mostly adds missing "memory" clobber which caused some nasty bugs - gcc
optimized those inline asms and assumed values returned by them never
change.
2020-11-05 13:48:41 +01:00
Dmitrii Kuvaiskii 28050d051e [Pal/lib] Add strtoll() and funcs from ctype.h for string manipulation
These functions are required by the TOML C source code, which will
be embedded into Graphene in a future commit.
2020-10-29 02:02:05 -07:00
Michał Kowalczyk 4e26fe7e32 [LibOS+Pal] Clean up string handling utilities 2020-10-16 16:18:43 +02:00
Dmitrii Kuvaiskii 1ac4da9c0f [Pal/lib] Remove unused functions in manifest-config struct
Also move parse_size_str() to a more appropriate atoi.c file.
This is in preparation for replacing the old ad-hoc manifest
syntax with the TOML syntax.
2020-10-16 02:27:11 -07:00
Dmitrii Kuvaiskii bd5d56b1a0 [Pal/lib] Add strncmp() and strspn() string manipulation funcs
These functions are required by the TOML C source code, which will be
embedded into Graphene in a future commit.
2020-10-15 08:27:43 -07:00
Michał Kowalczyk ad477ec7bf Reformat repository to our C formatting rules (final iteration) 2020-09-15 02:00:54 +02:00
Michał Kowalczyk bdcf29ba33 [Pal] Simplify memset and clean up other string ops 2020-07-23 19:48:15 +02:00
Rafał Wojdyła cf84489cd5 [Linux-SGX] Add protected files implementation
Protected files (PF) are a new type of file that can be specified in
the manifest (SGX only). They are encrypted on disk and transparently
decrypted when accessed by the Graphene payload.

Other features:
- data is integrity protected (tamper resistance)
- file swap protection (a PF can only be accessed when in a specific path)
- transparency (Graphene payload sees PFs as regular files, no need to modify
  the payload)

See Linux-SGX/protected-files directory for implementation. PF format is
based on protected files from the SGX SDK:
https://github.com/intel/linux-sgx/tree/master/sdk/protected_fs

The following new manifest elements are added:

sgx.protected_files_key = <16-byte hex value>
sgx.protected_files.<name> = file:<host path>

sgx.protected_files_key specifies the encryption key and is only a temporary
implementation. This key should be provisioned with local/remote attestation
in the future.

Paths specifying PF entries can be files or directories. If a directory is
specified, all files/directories within are registered as protected
recursively (and are expected to be encrypted in the PF format).

Linux-SGX/tools directory contains the pf_crypt utility that converts files
to/from the protected format.
2020-07-13 20:19:42 +02:00
Stefan Berger f3425120d3 [Pal] Fix non-x86 implementation of memcpy
This patch fixes the following compile error:

string/memcpy.c: In function \u2018memcpy\u2019:
string/memcpy.c:32:16: warning: dereferencing \u2018void *\u2019 pointer
         *d++ = *src++;
                ^~~~~~
string/memcpy.c:32:14: error: void value not ignored as it ought to be
         *d++ = *src++;
2020-07-06 20:26:31 +02:00
Dmitrii Kuvaiskii 57bbbe321a [Pal/lib] Replace old memory-handling functions with simpler versions
Graphene used its own implementations of memory-handling functions like
memcmp(), memcpy(), etc. These implementations were copied from Glibc
and contained complicated code from year 2004. Modern HW and compilers
do better job at optimizing simple C implementations of these functions.
Thus, this commit replaces old implementations with simple ones taken
from Musl libc and adapted to our code style.

One particular optimization is made to memcpy() on x86-64. memcpy() is
heavily used in Linux-SGX PAL to copy data in/out of SGX enclave.
Experiments with Redis 5.0 show perf improvement of using "rep movsb" at
3-5% for 4KB payloads over the previous implementation based on Glibc.
2020-07-02 16:38:31 +00:00
Michał Kowalczyk 0f55c6de04 Use SPDX IDs for licenses in source files 2020-06-13 03:25:33 +02:00
Stefan Berger bf155c7bc9 [Pal/lib] Implement strstr() 2020-06-10 00:27:10 +00:00
Michał Kowalczyk f1c334357c Reformat repository to our clang-format rules (2nd iteration) 2020-01-09 02:35:50 +01:00
Thomas Knauth de5efcd53d [Pal/lib] Add strcmp() function 2019-12-19 20:07:06 -08:00
Michał Kowalczyk 2cf1b3cdc7 Remove __builtin_expect usages
We don't need this micro-optimization which just obfuscates the sources
for negligible performance gains. (Un)likeliness of branches in almost
all cases should be derived from profiling, not from hand-written hints,
using profile-guided optimization.
2019-10-10 14:44:52 +02:00
borysp 9cd6b34747 [Pal] Change the way argv[0] is handled
Before argv[0] was treated specially and was changed to a value
from manifest file. Now this happens only if binary was run as
a manifest i.e. `./pal_loader path_to_manifest_file`.
2019-09-25 19:16:48 +02:00
Michał Kowalczyk de42ebabe1 Reformat repository to our clang-format rules 2019-09-09 22:11:23 +02:00
Michał Kowalczyk 16d90cfe12 Fix parenthesizing and formatting of C macros 2019-05-23 19:14:23 +02:00
Don Porter 8d99e037ea Replace rsa implementation, from wolfssl to mbedtls. (#76)
Switch the RSA implementation from wolfssl to mbedtls
2017-10-23 01:41:24 +01:00
Don Porter b20e34cf5f Switch the AES-CMAC implementation from wolfssl to mbedtls. (#75)
* Switch the AES-CMAC implementation from wolfssl to mbedtls
2017-10-22 17:16:12 +01:00
Chia-Che Tsai 7f19f62f31 beta version 0.2
Plenty of bugfixes for Linux kernel later than 3.5 and Ubuntu later than 10.10.
More organized code to improve portability.
Regression tests for Pal to test completeness of implementation.
2015-05-20 14:15:52 -04:00
Chia-Che Tsai 10c06ad723 The first official release 2014-06-02 12:45:42 -04:00