-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from FStarLang/_taramana_ci_rust_bindings
DPE: Generate Rust bindings as part of CI
- Loading branch information
Showing
8 changed files
with
85 additions
and
28 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# The script generates .h files for external dependencies, | ||
# evercrypt and l0core (from DICE*) so far | ||
# The generated .h files are used to generate Rust bindings | ||
# using the rust bindgen tool | ||
# | ||
|
||
set -e | ||
set -x | ||
|
||
# chdir to the current directory | ||
unset CDPATH | ||
cd "$( dirname "${BASH_SOURCE[0]}" )" | ||
|
||
if [[ -z "$PULSE_HOME" ]] ; then | ||
PULSE_HOME=$(realpath $(pwd)/../../) | ||
fi | ||
|
||
# regenerate EverCrypt*.h and L0Core.h | ||
make -j -f c.Makefile | ||
cp $PULSE_HOME/share/pulse/examples/dice/external/c/hacl/EverCrypt_Base.h _output/ | ||
echo "// This file is generated by gen-rust-bindings.sh" > _output/bindings.h | ||
for f in _output/EverCrypt_*.h ; do echo '#include "'$(basename $f)'"' ; done >> _output/bindings.h | ||
echo '#include "L0Core.h"' >> _output/bindings.h |
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,34 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# Creates rust bindings for external dependencies of DPE | ||
# using docker | ||
# | ||
|
||
set -e | ||
set -x | ||
|
||
# chdir to the current directory | ||
unset CDPATH | ||
cd "$( dirname "${BASH_SOURCE[0]}" )" | ||
|
||
if [[ -z "$PULSE_HOME" ]] ; then | ||
PULSE_HOME=$(realpath $(pwd)/../../) | ||
fi | ||
|
||
# regenerate EverCrypt*.h and L0Core.h | ||
./gen-external-h.sh | ||
|
||
# generate evercrypt_gen.rs and l0core_gen in a Docker image | ||
DOCKER_IMAGE_NAME=haclrustbindingsimg"$$" | ||
echo $DOCKER_IMAGE_NAME | ||
docker build -t $DOCKER_IMAGE_NAME -f rust.Dockerfile . | ||
|
||
DPE_OUTPUT_DIR=$PULSE_HOME/pulse2rust/dpe/src/generated | ||
|
||
# copy evercrypt_gen.rs and l0core_gen.rs from the Docker image | ||
DOCKER_CONTAINER_NAME=haclrustbindingscont"$$" | ||
docker create --name $DOCKER_CONTAINER_NAME $DOCKER_IMAGE_NAME | ||
docker cp $DOCKER_CONTAINER_NAME:/usr/src/hacl/evercrypt_gen.rs $DPE_OUTPUT_DIR/ | ||
docker cp $DOCKER_CONTAINER_NAME:/usr/src/hacl/l0core_gen.rs $DPE_OUTPUT_DIR/ | ||
docker rm $DOCKER_CONTAINER_NAME |
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
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