Protocols with function-dependent preprocessing.

This commit is contained in:
Marcel Keller
2025-05-30 13:32:54 +10:00
parent 96aac1e886
commit 9f2a641a94
278 changed files with 7829 additions and 1033 deletions

32
Scripts/astra-common.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
HERE=$(cd `dirname $0`; pwd)
SPDZROOT=$HERE/..
killall $PROTOCOL-party.x $PROTOCOL-prep-party.x
for dir in Player-Data/3-$PROTOCOL-{{R,B}-64,2-{40,128}}; do
mkdir $dir 2> /dev/null
rm $dir/*
for t in $(seq 0 100); do
mkfifo $dir/{Protocol,Outputs}-{edaBits-,}P{0,1,2}-T$t
done
done
export PLAYERS=3
export LOG_SUFFIX=prep-
. $HERE/run-common.sh
screen_prefix=p
run_player $PROTOCOL-prep-party.x $* &
export PLAYERS=2
export LOG_SUFFIX=
export PORT=
. $HERE/run-common.sh
screen_prefix=
run_player $PROTOCOL-party.x $* || exit 1

10
Scripts/astra-online.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
HERE=$(cd `dirname $0`; pwd)
SPDZROOT=$HERE/..
export PLAYERS=2
. $HERE/run-common.sh
run_player astra-party.x $* || exit 1

12
Scripts/astra-prep.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
HERE=$(cd `dirname $0`; pwd)
SPDZROOT=$HERE/..
rm Player-Data/3-astra-*/*
export PLAYERS=3
. $HERE/run-common.sh
run_player astra-prep-party.x $* || exit 1

6
Scripts/astra.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
HERE=$(cd `dirname $0`; pwd)
PROTOCOL=astra
. $HERE/astra-common.sh

View File

@@ -15,6 +15,10 @@ gdb_screen()
screen -S :$1 -d -m bash -l -c "echo $*; echo $LIBRARY_PATH; gdb $prog -ex \"run $*\""
}
if ! test -e bmr-program-tparty.x -a -e bmr-program-party.x; then
make bmr
fi
killall -9 bmr-party.x bmr-tparty.x memcheck-amd64-valgrind callgrind-amd64-valgrind bmr-program-party.x bmr-program-tparty.x gdb
dir=$(mktemp -d)
rm -R bmr-log

View File

@@ -23,4 +23,4 @@ echo AVX_OT = 0 >> CONFIG.mine
build '-maes -mpclmul -DCHECK_AES -DCHECK_PCLMUL -DCHECK_AVX' amd64 -DENABLE_AVX=OFF
echo AVX_OT = 1 >> CONFIG.mine
build '-msse4.1 -maes -mpclmul -mavx -mavx2 -mbmi2 -madx -DCHECK_ADX' avx2 -DENABLE_AVX=ON
build '-msse4.1 -maes -mpclmul -mavx -mavx2 -mbmi2 -madx' adx -DENABLE_AVX=ON

View File

@@ -11,6 +11,8 @@ if len(sys.argv) <= 1:
print('Usage: %s <program>' % sys.argv[0])
for tapename in Program.read_tapes(sys.argv[1]):
with open('Programs/Bytecode/%s.asm' % tapename, 'w') as out:
filename = 'Programs/Bytecode/%s.asm' % tapename
print('Creating', filename)
with open(filename, 'w') as out:
for i, inst in enumerate(Tape.read_instructions(tapename)):
print(inst, '#', i, file=out)

13
Scripts/get-brew.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
if ! type brew; then
echo Do you want me to install Homebrew?
echo Press RETURN to continue or any other key to abort
read ans
if test "$ans"; then
echo Aborting
exit 1
else
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
fi

View File

@@ -13,7 +13,7 @@ gdb_screen()
IFS=
name=${*/-/}
IFS=' '
screen -S :$name -d -m bash -l -c "echo $*; echo $LIBRARY_PATH; gdb $prog -ex \"run $*\""
screen -S :$screen_prefix$name -d -m bash -l -c "echo $*; echo $LIBRARY_PATH; gdb $prog -ex \"run $*\""
}
valgrind_screen()
@@ -56,7 +56,7 @@ run_player() {
params="$params -N $players"
fi
if test "$prog"; then
log_prefix=$prog-
log_prefix=$LOG_PREFIX$prog-
fi
if test "$BENCH"; then
log_prefix=$log_prefix$bin-$(echo "$*" | sed 's/ /-/g')-N$players-
@@ -70,7 +70,7 @@ run_player() {
fi
front_player=${GDB_PLAYER:-0}
>&2 echo Running $my_prefix $SPDZROOT/$bin $i $params
log=logs/$log_prefix$i
log=logs/$log_prefix$LOG_SUFFIX$i
$my_prefix $SPDZROOT/$bin $i $params 2>&1 |
{
if test "$BENCH"; then

View File

@@ -14,4 +14,5 @@ for i in `seq 0 $[n-1]`; do
openssl req -newkey rsa -nodes -x509 -out $ssl_dir/P$i.pem -keyout $ssl_dir/P$i.key -subj "/CN=P$i"
done
c_rehash $ssl_dir
rm -v $ssl_dir/*.0
c_rehash -v $ssl_dir

View File

@@ -89,6 +89,12 @@ if test $dabit != 0; then
test_vm semi2k $run_opts
fi
if test `uname` != Darwin -a -z "$run_opts"; then
./compile.py -E astra tutorial
test_vm astra $run_opts
test_vm trio $run_opts
fi
./compile.py tutorial
if test $no_top_gear; then

View File

@@ -3,17 +3,6 @@
if test `uname` = "Linux"; then
flags='cat /proc/cpuinfo'
elif test `uname` = Darwin; then
if ! type brew; then
echo Do you want me to install Homebrew?
echo Press RETURN to continue or any other key to abort
read ans
if test "$ans"; then
echo Aborting
exit 1
else
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
fi
make mac-setup
make tldr
else
@@ -22,8 +11,8 @@ else
fi
if test "$flags"; then
if $flags | grep -q avx2; then
cpu=avx2
if $flags | grep -q adx; then
cpu=adx
else
if test `uname -m` != x86_64; then
echo Binaries are not available for `uname -m`

10
Scripts/trio-online.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
HERE=$(cd `dirname $0`; pwd)
SPDZROOT=$HERE/..
export PLAYERS=2
. $HERE/run-common.sh
run_player trio-party.x $* || exit 1

12
Scripts/trio-prep.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
HERE=$(cd `dirname $0`; pwd)
SPDZROOT=$HERE/..
rm Player-Data/3-trio-*/*
export PLAYERS=3
. $HERE/run-common.sh
run_player trio-prep-party.x $* || exit 1

6
Scripts/trio.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
HERE=$(cd `dirname $0`; pwd)
PROTOCOL=trio
. $HERE/astra-common.sh