-
Notifications
You must be signed in to change notification settings - Fork 0
/
sds_extract.c
50 lines (47 loc) · 1.52 KB
/
sds_extract.c
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
#include <stdio.h>
#include "sot_extract.h"
#include "sds_extract.h"
/********* SDS extract for CLASSICAL SOT *********/
void sds_classic_sot_extract
(SST* sst, VSTclassic vst,\
const uint256 m0, const uint256 sigma0[HALF_KEY_NUM],\
const uint256 m1, const uint256 sigma1[HALF_KEY_NUM]){
if (eq256(m0,m1)){
printf("Refuse to extract: Input messages are similar\n");
return;
}
if (!sds_classic_sot_ver(&vst, m0, sigma0)) {
printf("Refuse to extract: First pair of message-signature is not valid\n");
return;
}
vst.cnt--;
if (!sds_classic_sot_ver(&vst, m1, sigma1)) {
printf("Refuse to extract: Second pair of message-signature is not valid\n");
return;
}
vst.cnt--;
classic_sot_extract (&(sst->sk), m0, sigma0, m1, sigma1);
sst->cnt = vst.cnt;
}
/********* SDS extract for OPTIMIZED SOT *********/
void sds_optimized_sot_extract
(SST* sst, VSToptimized vst,\
const uint256 m0, const uint256 sigma0[2][HALF_KEY_NUM],\
const uint256 m1, const uint256 sigma1[2][HALF_KEY_NUM]){
if (eq256(m0,m1)){
printf("Refuse to extract: input messages are similar\n");
return;
}
if (!sds_optimized_sot_ver(&vst, m0, sigma0)) {
printf("Refuse to extract: First pair of message-signature is not valid\n");
return;
}
vst.cnt--;
if (!sds_optimized_sot_ver(&vst, m1, sigma1)) {
printf("Refuse to extract: Second pair of message-signature is not valid\n");
return;
}
vst.cnt--;
optimized_sot_extract (&(sst->sk), m0, sigma0, m1, sigma1);
sst->cnt = vst.cnt;
}