#! /bin/sh

if [ -z "$srcdir" ] ; then
  srcdir=`pwd`
fi

data="$srcdir/nettle-benchmark.c"

if [ -x rsa-encrypt ] ; then
  if ./rsa-encrypt -r rsa-decrypt testkey.pub < "$data" > testciphertext ; then
    :
  else
    exit 1
  fi
  if ./rsa-decrypt testkey < testciphertext > testcleartext ; then
    :
  else
    exit 1
  fi
  if cmp "$data" testcleartext ; then
    exit 0
  else
    exit 1
  fi
else
  exit 77
fi
