rsa-verify-test 644 Bytes
Newer Older
1
2
3
4
5
6
7
8
#! /bin/sh

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

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

9
10
11
if [ -x rsa-verify$EXEEXT ] ; then
  $EMULATOR ./rsa-sign testkey < "$data" > testsignature \
    && $EMULATOR ./rsa-verify testkey.pub testsignature < "$data" \
12
    || exit 1;
13
14
15
16
  
  # Try modifying the data
  sed s/128/129/ < "$data" >testdata

17
  if $EMULATOR ./rsa-verify testkey.pub testsignature < testdata 2>/dev/null; then
18
19
20
21
22
    exit 1
  fi
  
  # Try modifying the signature
  sed s/1/2/ <testsignature > testsignature2
23
  if $EMULATOR ./rsa-verify testkey.pub testsignature2 < "$data" 2>/dev/null; then
24
25
26
27
28
29
    exit 1;
  fi
  exit 0
else
  exit 77
fi