1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-25 13:05:08 -07:00
libsodium/test/default/scalarmult8.c
2014-04-14 15:51:03 -07:00

33 lines
785 B
C

#include <stdio.h>
#include <string.h>
#define TEST_NAME "scalarmult7"
#include "cmptest.h"
unsigned char p1[32] = {
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
};
unsigned char p2[32] = {
0x25,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
unsigned char scalar[32];
unsigned char out1[32];
unsigned char out2[32];
int main(void)
{
scalar[0] = 1U;
crypto_scalarmult_curve25519(out1, scalar, p1);
crypto_scalarmult_curve25519(out2, scalar, p2);
printf("%d\n", memcmp(out1, out2, sizeof out1));
return 0;
}