Test crypto_box_seed_keypair

This commit is contained in:
Jan Varho 2014-05-23 10:22:52 +03:00
parent c565993885
commit f438116b6b
4 changed files with 43 additions and 0 deletions

1
.gitignore vendored
View File

@ -65,6 +65,7 @@ test/default/box7
test/default/box8
test/default/box_easy
test/default/box_easy2
test/default/box_seed
test/default/chacha20
test/default/core1
test/default/core2

View File

@ -14,6 +14,7 @@ EXTRA_DIST = \
box8.exp \
box_easy.exp \
box_easy2.exp \
box_seed.exp \
chacha20.exp \
core1.exp \
core2.exp \
@ -69,6 +70,7 @@ DISTCLEANFILES = \
box8.res \
box_easy.res \
box_easy2.res \
box_seed.res \
chacha20.res \
core1.res \
core2.res \
@ -132,6 +134,7 @@ TESTS_TARGETS = \
box8 \
box_easy \
box_easy2 \
box_seed \
chacha20 \
core1 \
core2 \
@ -217,6 +220,9 @@ box_easy_LDADD = $(TESTS_LDADD)
box_easy2_SOURCE = cmptest.h box_easy2.c
box_easy2_LDADD = $(TESTS_LDADD)
box_seed_SOURCE = cmptest.h box_seed.c
box_seed_LDADD = $(TESTS_LDADD)
chacha20_SOURCE = cmptest.h chacha20.c
chacha20_LDADD = $(TESTS_LDADD)

28
test/default/box_seed.c Normal file
View File

@ -0,0 +1,28 @@
#include <stdio.h>
#define TEST_NAME "box_seed"
#include "cmptest.h"
unsigned char seed[32] = {
0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d
,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45
,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a
,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a
};
int main(void)
{
int i;
unsigned char sk[32];
unsigned char pk[32];
crypto_box_curve25519xsalsa20poly1305_seed_keypair(pk, sk, seed);
for (i = 0;i < 32;++i) {
printf(",0x%02x",(unsigned int) pk[i]);
if (i % 8 == 7) printf("\n");
}
for (i = 0;i < 32;++i) {
printf(",0x%02x",(unsigned int) sk[i]);
if (i % 8 == 7) printf("\n");
}
return 0;
}

View File

@ -0,0 +1,8 @@
,0x85,0x20,0xf0,0x09,0x89,0x30,0xa7,0x54
,0x74,0x8b,0x7d,0xdc,0xb4,0x3e,0xf7,0x5a
,0x0d,0xbf,0x3a,0x0d,0x26,0x38,0x1a,0xf4
,0xeb,0xa4,0xa9,0x8e,0xaa,0x9b,0x4e,0x6a
,0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d
,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45
,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a
,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a