Home | History | Annotate | Line # | Download | only in default
      1  1.1  riastrad 
      2  1.1  riastrad #define TEST_NAME "scalarmult7"
      3  1.1  riastrad #include "cmptest.h"
      4  1.1  riastrad 
      5  1.1  riastrad static unsigned char p1[32] = {
      6  1.1  riastrad     0x72, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54, 0x74, 0x8b, 0x7d,
      7  1.1  riastrad     0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38,
      8  1.1  riastrad     0x1a, 0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0xea
      9  1.1  riastrad };
     10  1.1  riastrad 
     11  1.1  riastrad static unsigned char p2[32] = {
     12  1.1  riastrad     0x85, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54, 0x74, 0x8b, 0x7d,
     13  1.1  riastrad     0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38,
     14  1.1  riastrad     0x1a, 0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a
     15  1.1  riastrad };
     16  1.1  riastrad 
     17  1.1  riastrad static unsigned char scalar[32];
     18  1.1  riastrad static unsigned char out1[32];
     19  1.1  riastrad static unsigned char out2[32];
     20  1.1  riastrad 
     21  1.1  riastrad int
     22  1.1  riastrad main(void)
     23  1.1  riastrad {
     24  1.1  riastrad     int ret;
     25  1.1  riastrad 
     26  1.1  riastrad     scalar[0] = 1U;
     27  1.1  riastrad     ret       = crypto_scalarmult_curve25519(out1, scalar, p1);
     28  1.1  riastrad     assert(ret == 0);
     29  1.1  riastrad     ret = crypto_scalarmult_curve25519(out2, scalar, p2);
     30  1.1  riastrad     assert(ret == 0);
     31  1.1  riastrad     printf("%d\n", !!memcmp(out1, out2, 32));
     32  1.1  riastrad 
     33  1.1  riastrad     return 0;
     34  1.1  riastrad }
     35