-
Notifications
You must be signed in to change notification settings - Fork 100
/
test_extras.h
58 lines (40 loc) · 1.65 KB
/
test_extras.h
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/********************************************************************************************
* SIDH: an efficient supersingular isogeny cryptography library
* Copyright (c) Microsoft Corporation
*
* Website: https://github.com/microsoft/PQCrypto-SIDH
* Released under MIT license
*
* Abstract: utility header file for tests
*********************************************************************************************/
#ifndef TEST_EXTRAS_H
#define TEST_EXTRAS_H
#include "../src/config.h"
#define PASSED 0
#define FAILED 1
#if (TARGET == TARGET_ARM || TARGET == TARGET_ARM64)
#define print_unit printf("nsec");
#else
#define print_unit printf("cycles");
#endif
// Access system counter for benchmarking
int64_t cpucycles(void);
// Comparing "nword" elements, a=b? : (1) a!=b, (0) a=b
int compare_words(digit_t* a, digit_t* b, unsigned int nwords);
// Generating a pseudo-random field element in [0, p434-1]
void fprandom434_test(digit_t* a);
// Generating a pseudo-random element in GF(p434^2)
void fp2random434_test(digit_t* a);
// Generating a pseudo-random field element in [0, p503-1]
void fprandom503_test(digit_t* a);
// Generating a pseudo-random element in GF(p503^2)
void fp2random503_test(digit_t* a);
// Generating a pseudo-random field element in [0, p546-1]
void fprandom610_test(digit_t* a);
// Generating a pseudo-random element in GF(p546^2)
void fp2random610_test(digit_t* a);
// Generating a pseudo-random field element in [0, p751-1]
void fprandom751_test(digit_t* a);
// Generating a pseudo-random element in GF(p751^2)
void fp2random751_test(digit_t* a);
#endif