-
Notifications
You must be signed in to change notification settings - Fork 342
/
Copy pathmiracl-core.patch
146 lines (127 loc) · 5.67 KB
/
miracl-core.patch
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
diff --git a/c/bls.c b/c/bls.c
index 2a04850..60c4f90 100644
--- a/c/bls.c
+++ b/c/bls.c
@@ -68,7 +68,7 @@ static void BLS_HASH_TO_POINT(ECP_ZZZ *P, octet *M)
char dst[50];
octet DST = {0,sizeof(dst),dst};
- OCT_jstring(&DST,(char *)"BLS_SIG_ZZZG1_XMD:SHA-256_SVDW_RO_NUL_");
+ OCT_jstring(&DST,(char *)"BLS_SIG_ZZZG1_XMD:SHA-256_SSWU_RO_NUL_");
hash_to_field(MC_SHA2,HASH_TYPE_ZZZ,u,&DST,M,2);
ECP_ZZZ_map2point(P,&u[0]);
diff --git a/c/config64.py b/c/config64.py
index 786fbb2..bde91a3 100755
--- a/c/config64.py
+++ b/c/config64.py
@@ -34,13 +34,15 @@ ignore_variables=False
my_compiler = "gcc"
generated_files = []
+prefix = ""
+output_prefix = ""
def copy_keep_file(file, target):
- shutil.copyfile(file, target)
+ shutil.copyfile(output_prefix + file, output_prefix + target)
def copy_temp_file(file, target):
- shutil.copyfile(file, target)
- generated_files.append(target)
+ shutil.copyfile(output_prefix + file, output_prefix + target)
+ generated_files.append(output_prefix + target)
def delete_file(expression):
for root, dirs, files in os.walk(os.path.abspath(os.path.dirname(__file__))):
@@ -76,15 +78,15 @@ def request_compile(compiler_path, cflags, optim, file, lib, bin):
class miracl_compile:
def compile_file(optim, file):
if (os.environ.get('CC') != None and not ignore_variables):
- request_compile(os.environ.get('CC'), os.environ.get('CFLAGS'), optim, file, None, None)
+ request_compile(os.environ.get('CC'), os.environ.get('CFLAGS'), optim, output_prefix + file, None, None)
else:
- request_compile(my_compiler, None, optim, file, None, None)
+ request_compile(my_compiler, None, optim, output_prefix + file, None, None)
def compile_binary(optim, file, lib, bin):
if (os.environ.get('CC') != None and not ignore_variables):
- request_compile(os.environ.get('CC'), os.environ.get('CFLAGS'), optim, file, lib, bin)
+ request_compile(os.environ.get('CC'), os.environ.get('CFLAGS'), optim, output_prefix + file, lib, bin)
else:
- request_compile(my_compiler, None, optim, file, lib, bin)
+ request_compile(my_compiler, None, optim, output_prefix + file, lib, bin)
def inline_mul1(N,base) :
str=""
@@ -213,13 +215,13 @@ def inline_redc1(N,base) :
def replace(namefile,oldtext,newtext):
- f = open(namefile,'r')
+ f = open(output_prefix + namefile,'r')
filedata = f.read()
f.close()
newdata = filedata.replace(oldtext,newtext)
- f = open(namefile,'w')
+ f = open(output_prefix + namefile,'w')
f.write(newdata)
f.close()
@@ -920,10 +922,12 @@ def usage():
print("Build Configuration:")
print(" -o --options=1 --options=64 Disable interactive mode and select specific options")
print(" -r --run-tests Disable interactive mode, select all options, build and run tests")
+ print(" -p --path Input path to arch.h")
+ print(" -x --output_path Output path to arch.h")
print(" (implies --disable-fastfail, --ignore-environment)\n")
def arg_manager(argv, build_options):
- global testing, arg_options, fast_fail, intr, ignore_variables
+ global testing, arg_options, fast_fail, intr, ignore_variables, prefix, output_prefix
# Account for legacy behaviour
# Should be removed in future releases
if len(argv) == 0:
@@ -938,7 +942,7 @@ def arg_manager(argv, build_options):
opts, args = getopt.getopt(
argv,
"hdiro:",
- ["help", "disable-fastfail", "ignore-environment", "run-tests", "options="]
+ ["help", "disable-fastfail", "ignore-environment", "run-tests", "path=", "output-path=", "options="]
)
except getopt.GetoptError as err:
print(err)
@@ -957,6 +961,16 @@ def arg_manager(argv, build_options):
testing = True
fast_fail = False
ignore_variables = True
+ elif opt in ['-p', '--path']:
+ if arg[-6:] != "arch.h":
+ print("config64.py: Error! You have passed an invalid option, exiting.")
+ sys.exit(1)
+ prefix = arg[:-6]
+ elif opt in ['-x', '--output-path']:
+ if arg[-6:] != "arch.h":
+ print("config64.py: Error! You have passed an invalid option, exiting.")
+ sys.exit(1)
+ output_prefix = arg[:-6]
elif opt in ['-o', '--options']:
arg_options = True
try:
@@ -977,9 +991,9 @@ def main(argv):
global testing, keep_querying, my_compiler, generated_files, arg_options, intr
options_list = []
- replace("arch.h","@WL@","64")
-
if not arg_manager(argv, options_list):
+ shutil.copytree(prefix, output_prefix, dirs_exist_ok=True)
+ replace("arch.h","@WL@","64")
if intr:
if not testing:
interactive_prompt_print()
@@ -997,6 +1011,8 @@ def main(argv):
print("config64.py: Invalid input, program terminating")
sys.exit(2)
else:
+ shutil.copytree(prefix, output_prefix, dirs_exist_ok=True)
+ replace("arch.h","@WL@","64")
for i in options_list:
interactive_prompt_exect(i)
diff --git a/c/config_curve.h b/c/config_curve.h
index 4685dc6..f973898 100644
--- a/c/config_curve.h
+++ b/c/config_curve.h
@@ -40,7 +40,7 @@
// Permit alternate compression method if 3 spare top bits in field representation
// Must be set manually
-//#define ALLOW_ALT_COMPRESS_ZZZ
+#define ALLOW_ALT_COMPRESS_ZZZ
#if PAIRING_FRIENDLY_ZZZ != NOT_PF