-
Notifications
You must be signed in to change notification settings - Fork 705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for x86_64-fortanix-unknown-sgx target #738
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e86ca3a
Implement entropy source for SGX
7c29308
Disable AES/GCM `Fallback` implementations on SGX
2cb1d0c
Optionally use std::is_x86_feature_detected for feature detection
3759ffa
Add x86_64-fortanix-unknown-sgx to CI
5b5b379
Add SGX-specific notes to the documentation
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/usr/bin/env perl | ||
|
||
# Copyright (c) 2015, Google Inc. | ||
# | ||
# Permission to use, copy, modify, and/or distribute this software for any | ||
# purpose with or without fee is hereby granted, provided that the above | ||
# copyright notice and this permission notice appear in all copies. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | ||
# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | ||
# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | ||
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ | ||
|
||
$flavour = shift; | ||
$output = shift; | ||
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } | ||
|
||
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; | ||
( $xlate="${dir}../../../perlasm/x86_64-xlate.pl" and -f $xlate) or | ||
die "can't locate x86_64-xlate.pl"; | ||
|
||
open OUT,"| \"$^X\" $xlate $flavour $output"; | ||
*STDOUT=*OUT; | ||
|
||
print<<___; | ||
.text | ||
|
||
# CRYPTO_rdrand writes eight bytes of random data from the hardware RNG to | ||
# |out|. It returns one on success or zero on hardware failure. | ||
# int CRYPTO_rdrand(uint8_t out[8]); | ||
.globl CRYPTO_rdrand | ||
.type CRYPTO_rdrand,\@function,1 | ||
.align 16 | ||
CRYPTO_rdrand: | ||
.cfi_startproc | ||
xorq %rax, %rax | ||
# This is rdrand %rcx. It sets rcx to a random value and sets the carry | ||
# flag on success. | ||
.byte 0x48, 0x0f, 0xc7, 0xf1 | ||
# An add-with-carry of zero effectively sets %rax to the carry flag. | ||
adcq %rax, %rax | ||
movq %rcx, 0(%rdi) | ||
retq | ||
.cfi_endproc | ||
|
||
# CRYPTO_rdrand_multiple8_buf fills |len| bytes at |buf| with random data from | ||
# the hardware RNG. The |len| argument must be a multiple of eight. It returns | ||
# one on success and zero on hardware failure. | ||
# int CRYPTO_rdrand_multiple8_buf(uint8_t *buf, size_t len); | ||
.globl CRYPTO_rdrand_multiple8_buf | ||
.type CRYPTO_rdrand_multiple8_buf,\@function,2 | ||
.align 16 | ||
CRYPTO_rdrand_multiple8_buf: | ||
.cfi_startproc | ||
test %rsi, %rsi | ||
jz .Lout | ||
movq \$8, %rdx | ||
.Lloop: | ||
# This is rdrand %rcx. It sets rcx to a random value and sets the carry | ||
# flag on success. | ||
.byte 0x48, 0x0f, 0xc7, 0xf1 | ||
jnc .Lerr | ||
movq %rcx, 0(%rdi) | ||
addq %rdx, %rdi | ||
subq %rdx, %rsi | ||
jnz .Lloop | ||
.Lout: | ||
movq \$1, %rax | ||
retq | ||
.Lerr: | ||
xorq %rax, %rax | ||
retq | ||
.cfi_endproc | ||
___ | ||
|
||
close STDOUT; # flush |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When will this target be in stable Rust?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will land in beta if rust-lang/rust#57659 is accepted for backporting, which will put it in stable at 1.33.0. However, that version won't include the fixes for LTO and building on Ubuntu 14.04.