LESS-MAIN
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c: In function ‘microbench’:
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:58:19: error: expected identifier or ‘(’ before ‘&’ token
58 | generator_rnd(&G);
| ^
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:50:12: error: ‘N’ undeclared (first use in this function)
50 | #define NN N
| ^
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:59:29: note: in expansion of macro ‘NN’
59 | uint8_t is_pivot_column[NN];
| ^~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:50:12: note: each undeclared identifier is reported only once for each function it appears in
50 | #define NN N
| ^
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:59:29: note: in expansion of macro ‘NN’
59 | uint8_t is_pivot_column[NN];
| ^~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:64:9: error: too many arguments to function ‘generator_RREF’
64 | generator_RREF(&G,is_pivot_column);
| ^~~~~~~~~~~~~~
In file included from /home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:32:
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/./include/generator.h:17:5: note: declared here
17 | int generator_RREF(generator_mat_t *matrix);
| ^~~~~~~~~~~~~~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:59:13: warning: unused variable ‘is_pivot_column’ [-Wunused-variable]
59 | uint8_t is_pivot_column[NN];
| ^~~~~~~~~~~~~~~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c: In function ‘info’:
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:74:61: error: ‘N’ undeclared (first use in this function); did you mean ‘NN’?
74 | fprintf(stdout,"Code parameters: n= %d, k= %d, q=%d\n", N,K,Q);
| ^
| NN
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:74:63: error: ‘K’ undeclared (first use in this function)
74 | fprintf(stdout,"Code parameters: n= %d, k= %d, q=%d\n", N,K,Q);
| ^
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:74:65: error: ‘Q’ undeclared (first use in this function)
74 | fprintf(stdout,"Code parameters: n= %d, k= %d, q=%d\n", N,K,Q);
| ^
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:77:50: error: ‘prikey_t’ undeclared (first use in this function); did you mean ‘key_t’?
77 | fprintf(stdout,"Private key: %luB\n", sizeof(prikey_t));
| ^~~~~~~~
| key_t
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:78:48: error: ‘pubkey_t’ undeclared (first use in this function); did you mean ‘key_t’?
78 | fprintf(stdout,"Public key %luB\n", sizeof(pubkey_t));
| ^~~~~~~~
| key_t
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:79:52: error: ‘sign_t’ undeclared (first use in this function); did you mean ‘size_t’?
79 | fprintf(stdout,"Signature: %luB, %f\n", sizeof(sign_t), ((float) sizeof(sign_t))/1024);
| ^~~~~~
| size_t
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c: In function ‘LESS_sign_verify_speed’:
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:86:5: error: unknown type name ‘pubkey_t’; did you mean ‘key_t’?
86 | pubkey_t pk;
| ^~~~~~~~
| key_t
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:87:5: error: unknown type name ‘prikey_t’; did you mean ‘key_t’?
87 | prikey_t sk;
| ^~~~~~~~
| key_t
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:88:5: error: unknown type name ‘sign_t’; did you mean ‘size_t’?
88 | sign_t signature;
| ^~~~~~
| size_t
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:96:9: warning: implicit declaration of function ‘LESS_keygen’ [-Wimplicit-function-declaration]
96 | LESS_keygen(&sk,&pk);
| ^~~~~~~~~~~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:106:9: warning: implicit declaration of function ‘LESS_sign’ [-Wimplicit-function-declaration]
106 | LESS_sign(&sk,message,8,&signature);
| ^~~~~~~~~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:117:27: warning: implicit declaration of function ‘LESS_verify’ [-Wimplicit-function-declaration]
117 | is_signature_ok = LESS_verify(&pk,message,8,&signature);
| ^~~~~~~~~~~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c: In function ‘main’:
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:135:5: error: unknown type name ‘csprng_state’
135 | csprng_state platform_csprng_state; // 定义csprng_state类型
| ^~~~~~~~~~~~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:136:5: warning: implicit declaration of function ‘initialize_csprng’ [-Wimplicit-function-declaration]
136 | initialize_csprng(&platform_csprng_state,
| ^~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/LESS_benchmark_cat_1_SHORT_SIG.dir/build.make:202:CMakeFiles/LESS_benchmark_cat_1_SHORT_SIG.dir/lib/less_benchmark.c.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:109:CMakeFiles/LESS_benchmark_cat_1_SHORT_SIG.dir/all] 错误 2
make: *** [Makefile:91:all] 错误 2
ifndef GENERATOR_H
define GENERATOR_H
// 假设 generator_mat_t 是一个矩阵结构体
typedef struct {
int rows;
int cols;
double **data; // 矩阵数据
} generator_mat_t;
// 假设 generator_rnd 是一个随机数生成器的结构体
typedef struct {
unsigned long seed; // 随机数种子
} generator_rnd;
// 函数声明: 生成一个矩阵的 RREF (简化列最简形式)
int generator_RREF(generator_mat_t *matrix);
// 其他您需要的函数声明
void generator_init(generator_rnd *rnd, unsigned long seed);
double generator_random(generator_rnd *rnd);
endif // GENERATOR_H
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:32:10: fatal error: generator.h: 没有那个文件或目录
32 | #include "generator.h" // 假设这个头文件包含了generator_mat_t, generator_rnd, generator_RREF的定义
| ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/LESS_benchmark_cat_1_SHORT_SIG.dir/build.make:202:CMakeFiles/LESS_benchmark_cat_1_SHORT_SIG.dir/lib/less_benchmark.c.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:109:CMakeFiles/LESS_benchmark_cat_1_SHORT_SIG.dir/all] 错误 2
make: *** [Makefile:91:all] 错误 2
/**
- Reference ISO-C11 Implementation of LESS.
- @version 1.0 (February 2022)
- @author Alessandro Barenghi alessandro.barenghi@polimi.it
- This code is hereby placed in the public domain.
- THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**/
include <stdio.h>
include <stdlib.h>
include <string.h>
include <time.h>
include "timing_and_stat.h"
include "LESS.h"
include "rng.h"
include "generator.h" // 假设这个头文件包含了generator_mat_t, generator_rnd, generator_RREF的定义
// 定义常量和类型
define NUM_KEYPAIRS 100
define T 10
define W 5
if defined(CATEGORY_5)
define NUM_TESTS 6
elif defined(CATEGORY_3)
define NUM_TESTS 12
else
define NUM_TESTS 24
endif
ifdef N_pad
define NN N_pad
else
define NN N
endif
void microbench(){
welford_t timer;
welford_init(&timer);
generator_mat_t G;
generator_rnd(&G);
uint8_t is_pivot_column[NN];
uint64_t cycles;
for(int i = 0; i <NUM_TESTS; i++) {
cycles = x86_64_rtdsc();
generator_RREF(&G,is_pivot_column);
welford_update(&timer,(x86_64_rtdsc()-cycles)/1000.0);
}
fprintf(stdout,"Gaussian elimination kCycles (avg,stddev):");
welford_print(timer);
printf("\n");
}
void info(){
fprintf(stdout,"Code parameters: n= %d, k= %d, q=%d\n", N,K,Q);
fprintf(stdout,"num. keypairs = %d\n",NUM_KEYPAIRS);
fprintf(stdout,"Fixed weight challenge vector: %d rounds, weight %d \n",T,W);
fprintf(stdout,"Private key: %luB\n", sizeof(prikey_t));
fprintf(stdout,"Public key %luB\n", sizeof(pubkey_t));
fprintf(stdout,"Signature: %luB, %f\n", sizeof(sign_t), ((float) sizeof(sign_t))/1024);
}
void LESS_sign_verify_speed(){
fprintf(stdout,"Computing number of clock cycles as the average of %d runs\n", NUM_TESTS);
welford_t timer;
uint64_t cycles;
pubkey_t pk;
prikey_t sk;
sign_t signature;
char message[8] = "Signme!";
info();
printf("Timings (kcycles):\n");
welford_init(&timer);
for(int i = 0; i <NUM_TESTS; i++) {
cycles = x86_64_rtdsc();
LESS_keygen(&sk,&pk);
welford_update(&timer,(x86_64_rtdsc()-cycles)/1000.0);
}
printf("Key generation kCycles (avg,stddev): ");
welford_print(timer);
printf("\n");
welford_init(&timer);
for(int i = 0; i <NUM_TESTS; i++) {
cycles = x86_64_rtdsc();
LESS_sign(&sk,message,8,&signature);
welford_update(&timer,(x86_64_rtdsc()-cycles)/1000.0);
}
printf("Signature kCycles (avg,stddev): ");
welford_print(timer);
printf("\n");
int is_signature_ok;
welford_init(&timer);
for(int i = 0; i <NUM_TESTS; i++) {
cycles = x86_64_rtdsc();
is_signature_ok = LESS_verify(&pk,message,8,&signature);
welford_update(&timer,(x86_64_rtdsc()-cycles)/1000.0);
}
printf("Verification kCycles (avg,stddev):");
welford_print(timer);
printf("\n");
fprintf(stdout,"Keygen-Sign-Verify: %s", is_signature_ok == 1 ? "functional\n": "not functional\n" );
}
int iteration = 0;
int main(int argc, char* argv[]){
ifdef APPLE
ifdef aarch64
__m1_setup_rdtsc();
endif
endif
csprng_state platform_csprng_state; // 定义csprng_state类型
initialize_csprng(&platform_csprng_state,
(const unsigned char *)"0123456789012345",16);
fprintf(stdout,"LESS reference implementation benchmarking tool\n");
microbench();
LESS_sign_verify_speed();
return 0;
}
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:52:5: error: unknown type name ‘generator_mat_t’
52 | generator_mat_t G;
| ^~~~~~~~~~~~~~~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:53:5: warning: implicit declaration of function ‘generator_rnd’ [-Wimplicit-function-declaration]
53 | generator_rnd(&G);
| ^~~~~~~~~~~~~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:45:12: error: ‘N’ undeclared (first use in this function)
45 | #define NN N
| ^
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:54:29: note: in expansion of macro ‘NN’
54 | uint8_t is_pivot_column[NN];
| ^~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:45:12: note: each undeclared identifier is reported only once for each function it appears in
45 | #define NN N
| ^
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:54:29: note: in expansion of macro ‘NN’
54 | uint8_t is_pivot_column[NN];
| ^~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:59:9: warning: implicit declaration of function ‘generator_RREF’ [-Wimplicit-function-declaration]
59 | generator_RREF(&G,is_pivot_column);
| ^~~~~~~~~~~~~~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:54:13: warning: unused variable ‘is_pivot_column’ [-Wunused-variable]
54 | uint8_t is_pivot_column[NN];
| ^~~~~~~~~~~~~~~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c: In function ‘info’:
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:69:61: error: ‘N’ undeclared (first use in this function); did you mean ‘NN’?
69 | fprintf(stdout,"Code parameters: n= %d, k= %d, q=%d\n", N,K,Q);
| ^
| NN
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:69:63: error: ‘K’ undeclared (first use in this function)
69 | fprintf(stdout,"Code parameters: n= %d, k= %d, q=%d\n", N,K,Q);
| ^
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:69:65: error: ‘Q’ undeclared (first use in this function)
69 | fprintf(stdout,"Code parameters: n= %d, k= %d, q=%d\n", N,K,Q);
| ^
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:70:43: error: ‘NUM_KEYPAIRS’ undeclared (first use in this function)
70 | fprintf(stdout,"num. keypairs = %d\n",NUM_KEYPAIRS);
| ^~~~~~~~~~~~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:71:77: error: ‘T’ undeclared (first use in this function)
71 | f(stdout,"Fixed weight challenge vector: %d rounds, weight %d \n",T,W);
| ^
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:71:79: error: ‘W’ undeclared (first use in this function)
71 | f(stdout,"Fixed weight challenge vector: %d rounds, weight %d \n",T,W);
| ^
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:72:50: error: ‘prikey_t’ undeclared (first use in this function); did you mean ‘key_t’?
72 | fprintf(stdout,"Private key: %luB\n", sizeof(prikey_t));
| ^~~~~~~~
| key_t
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:73:48: error: ‘pubkey_t’ undeclared (first use in this function); did you mean ‘key_t’?
73 | fprintf(stdout,"Public key %luB\n", sizeof(pubkey_t));
| ^~~~~~~~
| key_t
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:74:52: error: ‘sign_t’ undeclared (first use in this function); did you mean ‘size_t’?
74 | fprintf(stdout,"Signature: %luB, %f\n", sizeof(sign_t), ((float) sizeof(sign_t))/1024);
| ^~~~~~
| size_t
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c: In function ‘LESS_sign_verify_speed’:
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:81:5: error: unknown type name ‘pubkey_t’; did you mean ‘key_t’?
81 | pubkey_t pk;
| ^~~~~~~~
| key_t
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:82:5: error: unknown type name ‘prikey_t’; did you mean ‘key_t’?
82 | prikey_t sk;
| ^~~~~~~~
| key_t
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:83:5: error: unknown type name ‘sign_t’; did you mean ‘size_t’?
83 | sign_t signature;
| ^~~~~~
| size_t
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:91:9: warning: implicit declaration of function ‘LESS_keygen’ [-Wimplicit-function-declaration]
91 | LESS_keygen(&sk,&pk);
| ^~~~~~~~~~~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:101:9: warning: implicit declaration of function ‘LESS_sign’ [-Wimplicit-function-declaration]
101 | LESS_sign(&sk,message,8,&signature);
| ^~~~~~~~~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:112:27: warning: implicit declaration of function ‘LESS_verify’ [-Wimplicit-function-declaration]
112 | is_signature_ok = LESS_verify(&pk,message,8,&signature);
| ^~~~~~~~~~~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c: In function ‘main’:
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:130:5: warning: implicit declaration of function ‘initialize_csprng’ [-Wimplicit-function-declaration]
130 | initialize_csprng(&platform_csprng_state,
| ^~~~~~~~~~~~~~~~~
/home/yoga/桌面/LESS-main/Utilities/Benchmarking/lib/less_benchmark.c:130:24: error: ‘platform_csprng_state’ undeclared (first use in this function)
130 | initialize_csprng(&platform_csprng_state,
| ^~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/LESS_benchmark_cat_1_SHORT_SIG.dir/build.make:202:CMakeFiles/LESS_benchmark_cat_1_SHORT_SIG.dir/lib/less_benchmark.c.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:109:CMakeFiles/LESS_benchmark_cat_1_SHORT_SIG.dir/all] 错误 2
make: *** [Makefile:91:all] 错误 2
浙公网安备 33010602011771号