summaryrefslogtreecommitdiff
path: root/t/testsign.c
blob: b4af02e011f268e556958fceb82f5edfa2cf4f9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "defs.h"
#include <stdio.h>
#include <assert.h>

#include "testv.h"

/* check sign, pk can't be NULL */
void testsign(const test_t *tests, int ntest)
{
    int i, j;
    unsigned char bsk[114];
    unsigned char bsign[114];
    unsigned char mysign[114];
    for (j = 0; j < ntest; j++)
    {
        hex2bin(bsk, tests[j].sk);
        hex2bin(bsk + 57, tests[j].pk);
        hex2bin(bsign, tests[j].sign);
        crypto_sign_ed448_detached(mysign, NULL, tests[j].msg, tests[j].mlen, bsk);
        for (i = 0; i < 114; i++)
        {
            assert(bsign[i] == mysign[i]);
        }
        printf("test sign %d good\n", j);
    }
}

int main()
{
    testsign(tests, NTESTS);
    return 0;
}