2016-07-16 18:08:01 +02:00
|
|
|
#!/bin/bash -eu
|
2016-01-23 19:33:03 +01:00
|
|
|
|
2016-01-23 20:17:34 +01:00
|
|
|
# Run the set of "canonical" benchmarks that are shown on
|
|
|
|
# https://nuetzlich.net/gocryptfs/comparison/
|
|
|
|
|
2016-07-16 18:08:01 +02:00
|
|
|
cd "$(dirname "$0")"
|
2016-11-23 21:54:55 +01:00
|
|
|
MYNAME=$(basename "$0")
|
2016-01-23 19:33:03 +01:00
|
|
|
|
2016-11-23 21:54:55 +01:00
|
|
|
function usage {
|
|
|
|
echo "Usage: $MYNAME [-encfs] [DIR]"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# Print help text on too many arguments or "-h"
|
|
|
|
if [[ $# -gt 2 ]]; then
|
|
|
|
usage
|
|
|
|
elif [[ $# -ge 1 ]] && [[ $1 == "-h" ]]; then
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set $DIR and $MODE
|
|
|
|
MODE=gocryptfs
|
|
|
|
DIR=/tmp
|
|
|
|
if [[ $# -eq 2 ]]; then
|
|
|
|
if [[ $1 != "-encfs" ]]; then
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
MODE=encfs
|
|
|
|
DIR=$2
|
|
|
|
elif [[ $# -eq 1 ]]; then
|
|
|
|
if [[ $1 == "-encfs" ]]; then
|
|
|
|
MODE=encfs
|
|
|
|
else
|
|
|
|
DIR=$1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Create directories
|
|
|
|
CRYPT=$(mktemp -d "$DIR/$MYNAME.XXX")
|
2016-07-16 18:08:01 +02:00
|
|
|
MNT=$CRYPT.mnt
|
|
|
|
mkdir $MNT
|
2016-07-11 22:10:41 +02:00
|
|
|
|
2016-07-16 18:08:01 +02:00
|
|
|
# Mount
|
2016-11-23 21:54:55 +01:00
|
|
|
if [[ $MODE == encfs ]]; then
|
|
|
|
echo "Testing EncFS at $CRYPT"
|
2016-07-16 18:08:01 +02:00
|
|
|
encfs --extpass="echo test" --standard $CRYPT $MNT > /dev/null
|
2016-07-11 22:10:41 +02:00
|
|
|
else
|
2016-11-23 21:54:55 +01:00
|
|
|
echo "Testing gocryptfs at $CRYPT"
|
2016-07-16 18:08:01 +02:00
|
|
|
gocryptfs -q -init -extpass="echo test" -scryptn=10 $CRYPT
|
2016-12-10 21:14:57 +01:00
|
|
|
# By default, gocryptfs decides between OpenSSL and Go GCM:
|
2016-07-16 18:08:01 +02:00
|
|
|
gocryptfs -q -extpass="echo test" $CRYPT $MNT
|
2016-12-10 21:14:57 +01:00
|
|
|
# Force use of OpenSSL:
|
|
|
|
#gocryptfs -q -extpass="echo test" -openssl=true $CRYPT $MNT
|
|
|
|
# Force use of Go GCM:
|
|
|
|
#gocryptfs -q -extpass="echo test" -openssl=false $CRYPT $MNT
|
2016-07-11 22:10:41 +02:00
|
|
|
fi
|
2016-07-16 18:08:01 +02:00
|
|
|
|
|
|
|
# Cleanup trap
|
|
|
|
trap "cd /; fusermount -u -z $MNT; rm -rf $CRYPT $MNT" EXIT
|
2016-01-23 19:33:03 +01:00
|
|
|
|
|
|
|
# Benchmarks
|
2016-07-16 18:08:01 +02:00
|
|
|
./tests/canonical-benchmarks.bash $MNT
|
2016-01-23 19:33:03 +01:00
|
|
|
|