File: 0003-Support-SHELL-tests-in-chromium.patch

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (1243 lines) | stat: -rw-r--r-- 56,222 bytes parent folder | download | duplicates (18)
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
diff --git a/context_test.cc b/context_test.cc
index 73436a9..9f35334 100644
--- a/context_test.cc
+++ b/context_test.cc
@@ -33,7 +33,7 @@ TYPED_TEST_SUITE(ContextTest, rlwe::testing::ModularIntTypes);
 
 TYPED_TEST(ContextTest, CreateWorks) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
   }
@@ -41,7 +41,7 @@ TYPED_TEST(ContextTest, CreateWorks) {
 
 TYPED_TEST(ContextTest, ParametersMatch) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
 
diff --git a/error_params_test.cc b/error_params_test.cc
index fe1fd55..7cc3c8b 100644
--- a/error_params_test.cc
+++ b/error_params_test.cc
@@ -120,7 +120,7 @@ TYPED_TEST_SUITE(ErrorParamsTest, rlwe::testing::ModularIntTypes);
 
 TYPED_TEST(ErrorParamsTest, CreateError) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
 
@@ -140,7 +140,7 @@ TYPED_TEST(ErrorParamsTest, CreateError) {
 
 TYPED_TEST(ErrorParamsTest, PlaintextError) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
 
@@ -161,7 +161,7 @@ TYPED_TEST(ErrorParamsTest, PlaintextError) {
 
 TYPED_TEST(ErrorParamsTest, EncryptionError) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     ASSERT_OK_AND_ASSIGN(auto key, this->SampleKey(context.get()));
@@ -186,7 +186,7 @@ TYPED_TEST(ErrorParamsTest, EncryptionError) {
 
 TYPED_TEST(ErrorParamsTest, RelinearizationErrorScalesWithT) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     // Error scales by (T / logT) when all other constants are fixed.
diff --git a/galois_key_test.cc b/galois_key_test.cc
index 022ddd5..b73a4d4 100644
--- a/galois_key_test.cc
+++ b/galois_key_test.cc
@@ -17,6 +17,7 @@
 
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
+#include <google/protobuf/util/message_differencer.h>
 #include "constants.h"
 #include "montgomery.h"
 #include "ntt_parameters.h"
@@ -408,7 +409,7 @@ TEST_F(GaloisKeyTest, SerializationsOfIdentialKeysEqual) {
   ASSERT_OK_AND_ASSIGN(auto serialized_copy, galois_key_copy.Serialize());
 
   // Check that two serializations of the same matrix are equal.
-  EXPECT_THAT(serialized_copy, EqualsProto(serialized));
+  EXPECT_EQ(serialized_copy.SerializeAsString(), serialized.SerializeAsString());
 }
 
 }  //  namespace
diff --git a/int256.cc b/int256.cc
index 1096c98..f9a40fc 100644
--- a/int256.cc
+++ b/int256.cc
@@ -40,7 +40,7 @@ const uint256_pod kuint256max = {absl::kuint128max, absl::kuint128max};
     }                                         \
   } while (0)
 static inline int Fls64(Uint64 n) {
-  DCHECK_NE(0, n);
+  //DCHECK_NE(0, n);
   int pos = 0;
   STEP(Uint64, n, pos, 0x20);
   Uint32 n32 = n;
diff --git a/montgomery_test.cc b/montgomery_test.cc
index 7fe438f..7caf459 100644
--- a/montgomery_test.cc
+++ b/montgomery_test.cc
@@ -102,7 +102,7 @@ TYPED_TEST(MontgomeryTest, ParamsInvModulus) {
   using Int = typename TypeParam::Int;
   using BigInt = typename internal::BigInt<Int>::value_type;
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     EXPECT_EQ(modulus_params->r * modulus_params->inv_r -
@@ -118,7 +118,7 @@ TYPED_TEST(MontgomeryTest, ImportExportInt) {
   unsigned int seed = 0;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
 
@@ -140,7 +140,7 @@ TYPED_TEST(MontgomeryTest, AddSub) {
   unsigned int seed = 0;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     for (int i = 0; i < kTestingRounds; i++) {
@@ -173,7 +173,7 @@ TYPED_TEST(MontgomeryTest, InlineAddSub) {
   unsigned int seed = 0;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     for (int i = 0; i < kTestingRounds; i++) {
@@ -209,7 +209,7 @@ TYPED_TEST(MontgomeryTest, Equality) {
   unsigned int seed = 0;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     for (int i = 0; i < kTestingRounds; i++) {
@@ -251,7 +251,7 @@ TYPED_TEST(MontgomeryTest, Negate) {
   using Int = typename TypeParam::Int;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     for (Int i = 0; i < 4 * kNewhopeModulus; i++) {
@@ -271,7 +271,7 @@ TYPED_TEST(MontgomeryTest, AddRepeatedly) {
   unsigned int seed = 0;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     for (int i = 0; i < kTestingRounds; i++) {
@@ -307,7 +307,7 @@ TYPED_TEST(MontgomeryTest, Multiply) {
   unsigned int seed = 0;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     // Test over many random values.
@@ -346,7 +346,7 @@ TYPED_TEST(MontgomeryTest, MulInPlace) {
   unsigned int seed = 0;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     // Test over many random values.
@@ -375,7 +375,7 @@ TYPED_TEST(MontgomeryTest, MulConstantInPlace) {
   unsigned int seed = 0;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     // Test over many random values.
@@ -387,7 +387,9 @@ TYPED_TEST(MontgomeryTest, MulConstantInPlace) {
       auto ma_clone = ma;
       ASSERT_OK_AND_ASSIGN(auto mb,
                            TypeParam::ImportInt(b, modulus_params.get()));
-      auto [constant, constant_barrett] = mb.GetConstant(modulus_params.get());
+      auto constants_tuple = mb.GetConstant(modulus_params.get());
+      auto constant = std::get<0>(constants_tuple);
+      auto constant_barrett = std::get<1>(constants_tuple);
       ma.MulInPlace(mb, modulus_params.get());
       ma_clone.MulConstantInPlace(constant, constant_barrett,
                                   modulus_params.get());
@@ -407,7 +409,7 @@ TYPED_TEST(MontgomeryTest, MultiplyRepeatedly) {
   unsigned int seed = 0;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     for (int i = 0; i < kTestingRounds; i++) {
@@ -436,7 +438,7 @@ TYPED_TEST(MontgomeryTest, SmallModulus) {
   using BigInt = typename internal::BigInt<Int>::value_type;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     const BigInt modulus = static_cast<BigInt>(modulus_params->modulus);
@@ -501,7 +503,7 @@ TYPED_TEST(MontgomeryTest, ModExpModulus) {
   unsigned int seed = 0;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     const BigInt modulus = static_cast<BigInt>(modulus_params->modulus);
@@ -529,7 +531,7 @@ TYPED_TEST(MontgomeryTest, InverseModulus) {
   unsigned int seed = 0;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     for (int i = 0; i < kTestingRounds; i++) {
@@ -548,7 +550,7 @@ TYPED_TEST(MontgomeryTest, Serialization) {
   using Int = typename TypeParam::Int;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     for (Int i = 0; i < kExhaustiveTest; i++) {
@@ -587,7 +589,7 @@ TYPED_TEST(MontgomeryTest, ExceedMaxNumCoeffVectorSerialization) {
   int num_coeffs = kMaxNumCoeffs + 1;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
 
@@ -605,7 +607,7 @@ TYPED_TEST(MontgomeryTest, ExceedMaxNumCoeffVectorSerialization) {
 
 TYPED_TEST(MontgomeryTest, EmptyVectorSerialization) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     std::vector<TypeParam> coeffs;
@@ -620,7 +622,7 @@ TYPED_TEST(MontgomeryTest, VectorSerialization) {
   auto prng = absl::make_unique<rlwe::testing::TestingPrng>(0);
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
 
@@ -653,7 +655,7 @@ TYPED_TEST(MontgomeryTest, ExceedMaxNumCoeffVectorDeserialization) {
   int num_coeffs = kMaxNumCoeffs + 1;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
 
@@ -670,7 +672,7 @@ TYPED_TEST(MontgomeryTest, NegativeVectorDeserialization) {
   int num_coeffs = -1;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     EXPECT_THAT(
@@ -686,7 +688,7 @@ TYPED_TEST(MontgomeryTest, ImportRandomWithPrngWithSameKeys) {
   unsigned int seed_prng = GenerateRandom<unsigned int>(&seed);
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
 
@@ -707,7 +709,7 @@ TYPED_TEST(MontgomeryTest, ImportRandomWithPrngWithDifferentKeys) {
   unsigned int seed_prng2 = seed_prng1 + 1;  // Different seed
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
 
@@ -727,7 +729,7 @@ TYPED_TEST(MontgomeryTest, VerifyBarrett) {
   using BigInt = typename internal::BigInt<Int>::value_type;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
 
@@ -754,7 +756,7 @@ TYPED_TEST(MontgomeryTest, BatchOperations) {
   auto prng = absl::make_unique<rlwe::testing::TestingPrng>(seed_prng);
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
 
@@ -765,8 +767,9 @@ TYPED_TEST(MontgomeryTest, BatchOperations) {
       TypeParam scalar =
           TypeParam::ImportRandom(prng.get(), modulus_params.get())
               .ValueOrDie();
-      auto [scalar_constant, scalar_constant_barrett] =
-          scalar.GetConstant(modulus_params.get());
+      auto scalar_constants_tuple = scalar.GetConstant(modulus_params.get());
+      auto scalar_constant = std::get<0>(scalar_constants_tuple);
+      auto scalar_constant_barrett = std::get<1>(scalar_constants_tuple);
       std::vector<TypeParam> expected_add_scalar, expected_sub_scalar,
           expected_mul_scalar;
       for (size_t i = 0; i < length; i++) {
@@ -774,8 +777,9 @@ TYPED_TEST(MontgomeryTest, BatchOperations) {
                         .ValueOrDie());
         b.push_back(TypeParam::ImportRandom(prng.get(), modulus_params.get())
                         .ValueOrDie());
-        auto [constant, constant_barrett] =
-            b[i].GetConstant(modulus_params.get());
+        auto constants_tuple = b[i].GetConstant(modulus_params.get());
+        auto constant = std::get<0>(constants_tuple);
+        auto constant_barrett = std::get<1>(constants_tuple); 
         b_constant.push_back(constant);
         b_constant_barrett.push_back(constant_barrett);
         expected_add.push_back(a[i].Add(b[i], modulus_params.get()));
@@ -844,7 +848,7 @@ TYPED_TEST(MontgomeryTest, BatchOperationsFailsWithVectorsOfDifferentSize) {
   using Int = typename TypeParam::Int;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     for (size_t length_a : {1, 2, 7, 32, 500, 1024}) {
@@ -911,7 +915,7 @@ class FakePrng {
 
 TYPED_TEST(MontgomeryTest, PrngTemplateParameterizationWorks) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
                          TypeParam::Params::Create(params.modulus));
     FakePrng prng;
diff --git a/ntt_parameters_test.cc b/ntt_parameters_test.cc
index 189c096..5425de7 100644
--- a/ntt_parameters_test.cc
+++ b/ntt_parameters_test.cc
@@ -39,7 +39,7 @@ TYPED_TEST_SUITE(NttParametersTest, rlwe::testing::ModularIntTypes);
 
 TYPED_TEST(NttParametersTest, LogNumCoeffsTooLarge) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     // Do not create a context, since it creates NttParameters already. Instead,
     // create the modulus parameters manually.
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
@@ -71,7 +71,7 @@ TYPED_TEST(NttParametersTest, PrimitiveNthRootOfUnity) {
   unsigned int len = 5;
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     // Do not create a context, since it creates NttParameters already. Instead,
     // create the modulus parameters manually.
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
@@ -97,7 +97,7 @@ TYPED_TEST(NttParametersTest, PrimitiveNthRootOfUnity) {
 
 TYPED_TEST(NttParametersTest, NttPsis) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     // Do not create a context, since it creates NttParameters already. Instead,
     // create the modulus parameters manually.
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
@@ -131,7 +131,7 @@ TYPED_TEST(NttParametersTest, NttPsis) {
 
 TYPED_TEST(NttParametersTest, NttPsisBitrev) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     // Do not create a context, since it creates NttParameters already. Instead,
     // create the modulus parameters manually.
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
@@ -159,7 +159,7 @@ TYPED_TEST(NttParametersTest, NttPsisBitrev) {
 
 TYPED_TEST(NttParametersTest, NttPsisInvBitrev) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     // Do not create a context, since it creates NttParameters already. Instead,
     // create the modulus parameters manually.
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
@@ -208,7 +208,7 @@ TEST(NttParametersRegularTest, Bitrev) {
 
 TYPED_TEST(NttParametersTest, IncorrectNTTParams) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     // Do not create a context, since it creates NttParameters already. Instead,
     // create the modulus parameters manually.
     // modulus + 2, will no longer be 1 mod 2*n
@@ -227,7 +227,7 @@ TYPED_TEST(NttParametersTest, IncorrectNTTParams) {
 // Test all the NTT Parameter fields.
 TYPED_TEST(NttParametersTest, Initialize) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     // Do not create a context, since it creates NttParameters already. Instead,
     // create the modulus parameters manually.
     ASSERT_OK_AND_ASSIGN(auto modulus_params,
diff --git a/prng/chacha_prng_util.cc b/prng/chacha_prng_util.cc
index c49c82d..e63bb61 100644
--- a/prng/chacha_prng_util.cc
+++ b/prng/chacha_prng_util.cc
@@ -31,16 +31,27 @@ absl::Status ChaChaPrngResalt(absl::string_view key, int buffer_size,
                               int* salt_counter, int* position_in_buffer,
                               std::vector<Uint8>* buffer) {
   buffer->assign(buffer_size, 0);
-  std::string salt = "salt";
-  if (salt.size() > kChaChaNonceSize) {
-    return absl::InternalError("The salt length is too large.");
+
+  // Following https://tools.ietf.org/html/rfc7539, Sec 2.3, we create the
+  // nonce as a kChaChaNonceSize (=12) bytes string, where the 4 first
+  // bytes are fixed, and the next 8 bytes correspond to the counter.
+  std::string nonce = "salt00000000";
+  if (nonce.size() != kChaChaNonceSize) {
+    return absl::InternalError("The salt length is incorrect.");
+  }
+  Uint64 counter = static_cast<Uint64>(*salt_counter);
+  for (int i = 0; i < 8; i++) {
+    nonce[4 + i] = counter & 0xFF;
+    counter >>= 8;
   }
-  salt.resize(kChaChaNonceSize, 0);
 
+  // We call the CRYPTO_chacha_20() function from OpenSSL. Note that the last
+  // parameter is a *block* counter. The salt counter needs instead to be
+  // included in the nonce.
   CRYPTO_chacha_20(buffer->data(), buffer->data(), buffer->size(),
                    reinterpret_cast<const Uint8*>(key.data()),
-                   reinterpret_cast<const Uint8*>(salt.data()),
-                   static_cast<uint32_t>(*salt_counter));
+                   reinterpret_cast<const Uint8*>(nonce.data()),
+                   /* counter = */ 0);
 
   ++(*salt_counter);
   *position_in_buffer = 0;
diff --git a/prng/prng_test.cc b/prng/prng_test.cc
index de7eacc..f98d98e 100644
--- a/prng/prng_test.cc
+++ b/prng/prng_test.cc
@@ -142,5 +142,29 @@ TYPED_TEST(PrngTest, ReplayDifferentInKeyTest) {
   EXPECT_NE(r64, other_r64);
 }
 
+TYPED_TEST(PrngTest, GeneratesUniqueRandomStrings) {
+  const int kKeySize = 20;
+  const int kIterations = 10000;
+  const char charset[] = "abcdefghijklmnopqrstuvwxyz0123456789";
+
+  std::vector<std::string> keys;
+  for (int i = 0; i < kIterations; i++) {
+    // Create a random key
+    std::string key(kKeySize, 0);
+    for (int j = 0; j < kKeySize; j++) {
+      ASSERT_OK_AND_ASSIGN(auto v, this->prng_->Rand8());
+      key[j] = charset[static_cast<int>(v) % sizeof(charset)];
+    }
+
+    // With very high probability (~(1/36)^20), a key will only appear once.
+    int count = 0;
+    for (auto k : keys) {
+      if (k == key) count++;
+    }
+    ASSERT_EQ(count, 0);
+    keys.push_back(key);
+  }
+}
+
 }  // namespace
 }  // namespace rlwe
diff --git a/sample_error_test.cc b/sample_error_test.cc
index 49bb495..41071c0 100644
--- a/sample_error_test.cc
+++ b/sample_error_test.cc
@@ -46,7 +46,7 @@ TYPED_TEST(SampleErrorTest, CheckUpperBoundOnNoise) {
   auto prng = absl::make_unique<rlwe::testing::TestingPrng>(0);
 
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
 
@@ -73,7 +73,7 @@ TYPED_TEST(SampleErrorTest, CheckUpperBoundOnNoise) {
 TYPED_TEST(SampleErrorTest, FailOnTooLargeVariance) {
   auto prng = absl::make_unique<rlwe::testing::TestingPrng>(0);
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
 
diff --git a/serialization.proto b/serialization.proto
index 6d02b74..b7fefcf 100644
--- a/serialization.proto
+++ b/serialization.proto
@@ -15,6 +15,8 @@
 
 syntax = "proto2";
 
+option optimize_for = LITE_RUNTIME;
+
 package rlwe;
 
 // NTT Polynomial
diff --git a/symmetric_encryption_test.cc b/symmetric_encryption_test.cc
index 6e58422..6c05be2 100644
--- a/symmetric_encryption_test.cc
+++ b/symmetric_encryption_test.cc
@@ -91,7 +91,7 @@ TYPED_TEST_SUITE(SymmetricRlweEncryptionTest, rlwe::testing::ModularIntTypes);
 TYPED_TEST(SymmetricRlweEncryptionTest, RemoveErrorNegative) {
   unsigned int seed = 0;
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
 
@@ -136,7 +136,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, RemoveErrorNegative) {
 // different values of t.
 TYPED_TEST(SymmetricRlweEncryptionTest, RemoveErrorPositive) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     unsigned int seed = 0;
@@ -167,7 +167,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, RemoveErrorPositive) {
 // Ensure that the encryption scheme can decrypt its own ciphertexts.
 TYPED_TEST(SymmetricRlweEncryptionTest, CanDecrypt) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     for (unsigned int i = 0; i < kTestingRounds; i++) {
@@ -187,7 +187,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, CanDecrypt) {
 // Accessing out of bounds raises errors
 TYPED_TEST(SymmetricRlweEncryptionTest, OutOfBoundsIndex) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     ASSERT_OK_AND_ASSIGN(auto key, this->SampleKey(context.get()));
@@ -208,7 +208,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, OutOfBoundsIndex) {
 // Check that the HE scheme is additively homomorphic.
 TYPED_TEST(SymmetricRlweEncryptionTest, AdditivelyHomomorphic) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     for (unsigned int i = 0; i < kTestingRounds; i++) {
@@ -252,7 +252,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, AdditivelyHomomorphic) {
 // Check that homomorphic addition can be performed in place.
 TYPED_TEST(SymmetricRlweEncryptionTest, AddHomomorphicallyInPlace) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     for (unsigned int i = 0; i < kTestingRounds; i++) {
@@ -302,7 +302,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, AddHomomorphicallyInPlace) {
 // plaintext.
 TYPED_TEST(SymmetricRlweEncryptionTest, AddToZero) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     for (unsigned int i = 0; i < kTestingRounds; i++) {
@@ -329,7 +329,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, AddToZero) {
 // Check that homomorphic absorption works.
 TYPED_TEST(SymmetricRlweEncryptionTest, Absorb) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     for (unsigned int i = 0; i < kTestingRounds; i++) {
@@ -388,7 +388,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, Absorb) {
 // Check that homomorphic absorption in place works.
 TYPED_TEST(SymmetricRlweEncryptionTest, AbsorbInPlace) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     for (unsigned int i = 0; i < kTestingRounds; i++) {
@@ -447,7 +447,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, AbsorbInPlace) {
 // Check that homomorphic absorption of a scalar works.
 TYPED_TEST(SymmetricRlweEncryptionTest, AbsorbScalar) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     unsigned int seed = 0;
@@ -500,7 +500,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, AbsorbScalar) {
 // Check that homomorphic absorption of a scalar in place works.
 TYPED_TEST(SymmetricRlweEncryptionTest, AbsorbScalarInPlace) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     unsigned int seed = 0;
@@ -553,7 +553,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, AbsorbScalarInPlace) {
 // Check that we cannot multiply with an empty ciphertext.
 TYPED_TEST(SymmetricRlweEncryptionTest, EmptyCipherMultiplication) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     ASSERT_OK_AND_ASSIGN(auto key, this->SampleKey(context.get()));
@@ -601,7 +601,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, MultiplicativelyHomomorphic) {
   if (sizeof(TypeParam) > 2) {  // No multiplicative homomorphism possible when
                                 // TypeParam = Uint16
     for (const auto& params :
-         rlwe::testing::ContextParameters<TypeParam>::value) {
+         rlwe::testing::ContextParameters<TypeParam>::Value()) {
       ASSERT_OK_AND_ASSIGN(auto context,
                            rlwe::RlweContext<TypeParam>::Create(params));
       for (int i = 0; i < kTestingRounds; i++) {
@@ -658,7 +658,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, MultiplicativelyHomomorphic) {
 // Check that many homomorphic additions can be performed.
 TYPED_TEST(SymmetricRlweEncryptionTest, ManyHomomorphicAdds) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     // Sample a starting plaintext and ciphertext and create aggregators;
@@ -705,7 +705,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, ManyHomomorphicAdds) {
 TYPED_TEST(SymmetricRlweEncryptionTest,
            ExceedMaxNumCoeffDeserializeCiphertext) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
 
@@ -733,7 +733,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest,
 // Check that ciphertext serialization works.
 TYPED_TEST(SymmetricRlweEncryptionTest, SerializeCiphertext) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     for (int i = 0; i < kTestingRounds; i++) {
@@ -768,7 +768,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, SerializeCiphertext) {
 // Check that key serialization works.
 TYPED_TEST(SymmetricRlweEncryptionTest, SerializeKey) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     for (int i = 0; i < kTestingRounds; i++) {
@@ -809,7 +809,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, SerializeKey) {
 // Try an ill-formed key modulus switching
 TYPED_TEST(SymmetricRlweEncryptionTest, FailingKeyModulusReduction) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     // p is the original modulus and q is the new modulus we want to switch to
@@ -836,7 +836,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, FailingKeyModulusReduction) {
 // Try an ill-formed ciphertext modulus switching
 TYPED_TEST(SymmetricRlweEncryptionTest, FailingCiphertextModulusReduction) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     // p is the original modulus and q is the new modulus we want to switch to
@@ -871,8 +871,9 @@ TYPED_TEST(SymmetricRlweEncryptionTest, FailingCiphertextModulusReduction) {
 
 // Test modulus switching.
 TYPED_TEST(SymmetricRlweEncryptionTest, ModulusReduction) {
-  for (const auto& [params1, params2] :
-       rlwe::testing::ContextParametersModulusSwitching<TypeParam>::value) {
+  for (const auto& params :
+       rlwe::testing::ContextParametersModulusSwitching<TypeParam>::Value()) {
+    auto params1 = std::get<0>(params), params2 = std::get<1>(params);
     ASSERT_OK_AND_ASSIGN(auto context1,
                          rlwe::RlweContext<TypeParam>::Create(params1));
     ASSERT_OK_AND_ASSIGN(auto context2,
@@ -913,8 +914,9 @@ TYPED_TEST(SymmetricRlweEncryptionTest, ModulusReduction) {
 
 // Check that modulus switching reduces the error.
 TYPED_TEST(SymmetricRlweEncryptionTest, ModulusSwitchingReducesLargeError) {
-  for (const auto& [params1, params2] :
-       rlwe::testing::ContextParametersModulusSwitching<TypeParam>::value) {
+  for (const auto& params :
+       rlwe::testing::ContextParametersModulusSwitching<TypeParam>::Value()) {
+    auto params1 = std::get<0>(params), params2 = std::get<1>(params);
     ASSERT_OK_AND_ASSIGN(auto context1,
                          rlwe::RlweContext<TypeParam>::Create(params1));
     ASSERT_OK_AND_ASSIGN(auto context2,
@@ -968,7 +970,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, ModulusSwitchingReducesLargeError) {
 // different powers of s.
 TYPED_TEST(SymmetricRlweEncryptionTest, OperationsFailOnMismatchedPowersOfS) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     ASSERT_OK_AND_ASSIGN(auto key, this->SampleKey(context.get()));
@@ -1002,7 +1004,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, OperationsFailOnMismatchedPowersOfS) {
 // Verifies that the power of S changes as expected in adds / mults.
 TYPED_TEST(SymmetricRlweEncryptionTest, AddsAndMultPreservePowerOfS) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     ASSERT_OK_AND_ASSIGN(auto key, this->SampleKey(context.get()));
@@ -1037,7 +1039,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, AddsAndMultPreservePowerOfS) {
 // Check that substitutions of the form 2^k + 1 work.
 TYPED_TEST(SymmetricRlweEncryptionTest, Substitutes) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     for (int k = 1; k < context->GetLogN(); k++) {
@@ -1083,7 +1085,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, Substitutes) {
 // Check that substitution of 2 does not work.
 TYPED_TEST(SymmetricRlweEncryptionTest, SubstitutionFailsOnEvenPower) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     ASSERT_OK_AND_ASSIGN(auto key, this->SampleKey(context.get()));
@@ -1102,7 +1104,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, SubstitutionFailsOnEvenPower) {
 // Check that the power of s updates after several substitutions.
 TYPED_TEST(SymmetricRlweEncryptionTest, PowerOfSUpdatedAfterRepeatedSubs) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     int substitution_power = 5;
@@ -1127,7 +1129,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, PowerOfSUpdatedAfterRepeatedSubs) {
 // Check that operations can only be performed when powers of s match.
 TYPED_TEST(SymmetricRlweEncryptionTest, PowersOfSMustMatchOnOperations) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     int substitution_power = 5;
@@ -1160,7 +1162,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, PowersOfSMustMatchOnOperations) {
 // Check that the null key has value 0.
 TYPED_TEST(SymmetricRlweEncryptionTest, NullKeyHasValueZero) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     rlwe::Polynomial<TypeParam> zero(context->GetN(),
@@ -1179,7 +1181,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, NullKeyHasValueZero) {
 // Check the addition and subtraction of keys.
 TYPED_TEST(SymmetricRlweEncryptionTest, AddAndSubKeys) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     ASSERT_OK_AND_ASSIGN(auto key_1, this->SampleKey(context.get()));
@@ -1203,7 +1205,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, AddAndSubKeys) {
 // Check that decryption works with added and subtracted keys.
 TYPED_TEST(SymmetricRlweEncryptionTest, EncryptAndDecryptWithAddAndSubKeys) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     ASSERT_OK_AND_ASSIGN(auto key_1, this->SampleKey(context.get()));
@@ -1231,7 +1233,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, EncryptAndDecryptWithAddAndSubKeys) {
 // Check that the scheme is key homomorphic.
 TYPED_TEST(SymmetricRlweEncryptionTest, IsKeyHomomorphic) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     ASSERT_OK_AND_ASSIGN(auto prng_seed,
@@ -1319,7 +1321,7 @@ TYPED_TEST(SymmetricRlweEncryptionTest, IsKeyHomomorphic) {
 // Check that incompatible key cannot be added or subtracted.
 TYPED_TEST(SymmetricRlweEncryptionTest, CannotAddOrSubIncompatibleKeys) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     ASSERT_OK_AND_ASSIGN(auto context_different_variance,
diff --git a/symmetric_encryption_with_prng_test.cc b/symmetric_encryption_with_prng_test.cc
index 88e86e3..beb1324 100644
--- a/symmetric_encryption_with_prng_test.cc
+++ b/symmetric_encryption_with_prng_test.cc
@@ -110,7 +110,7 @@ TYPED_TEST_SUITE(SymmetricEncryptionWithPrngTest,
 // ciphertext.
 TYPED_TEST(SymmetricEncryptionWithPrngTest, EncryptDecryptSingleCompressed) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     for (unsigned int i = 0; i < kTestingRounds; ++i) {
@@ -126,7 +126,7 @@ TYPED_TEST(SymmetricEncryptionWithPrngTest, EncryptDecryptSingleCompressed) {
 // ciphertexts.
 TYPED_TEST(SymmetricEncryptionWithPrngTest, EncryptDecryptMultipleCompressed) {
   for (const auto& params :
-       rlwe::testing::ContextParameters<TypeParam>::value) {
+       rlwe::testing::ContextParameters<TypeParam>::Value()) {
     ASSERT_OK_AND_ASSIGN(auto context,
                          rlwe::RlweContext<TypeParam>::Create(params));
     for (unsigned int i = 0; i < kTestingRounds; ++i) {
diff --git a/testing/coefficient_polynomial.h b/testing/coefficient_polynomial.h
index 4f32f18..fcff1a2 100644
--- a/testing/coefficient_polynomial.h
+++ b/testing/coefficient_polynomial.h
@@ -29,7 +29,8 @@
 #include "statusor.h"
 #include "testing/coefficient_polynomial.pb.h"
 
-namespace rlwe::testing {
+namespace rlwe {
+namespace testing {
 
 // A polynomial with ModularInt coefficients that is automatically reduced
 // modulo <x^n + 1>, where n is the number of coefficients provided in the
@@ -264,6 +265,7 @@ class CoefficientPolynomial {
   const ModularIntParams* modulus_params_;
 };
 
-}  // namespace rlwe::testing
+}  // namespace testing
+}  // namespace rlwe
 
 #endif  // RLWE_TESTING_COEFFICIENT_POLYNOMIAL_H_
diff --git a/testing/coefficient_polynomial.proto b/testing/coefficient_polynomial.proto
index b378557..35f02ef 100644
--- a/testing/coefficient_polynomial.proto
+++ b/testing/coefficient_polynomial.proto
@@ -15,6 +15,8 @@
 
 syntax = "proto2";
 
+option optimize_for = LITE_RUNTIME;
+
 package rlwe;
 
 // Polynomial in coefficient representation
diff --git a/testing/coefficient_polynomial_ciphertext.h b/testing/coefficient_polynomial_ciphertext.h
index 0ed2caa..a8a78de 100644
--- a/testing/coefficient_polynomial_ciphertext.h
+++ b/testing/coefficient_polynomial_ciphertext.h
@@ -27,7 +27,8 @@
 #include "symmetric_encryption.h"
 #include "testing/coefficient_polynomial.h"
 
-namespace rlwe::testing {
+namespace rlwe {
+namespace testing {
 
 // Container for a vector of polynomials in coefficient representation. This
 // class is the analogue of SymmetricRlweCiphertext with component polynomials
@@ -52,8 +53,8 @@ class CoefficientPolynomialCiphertext {
       const ErrorParams<ModularInt>* error_params)
       : p_(std::move(p)),
         modulus_params_(p_[0].ModulusParams()),
-        power_of_s_(power_of_s),
-        error_params_(error_params) {}
+        error_params_(error_params), 
+        power_of_s_(power_of_s){}
 
   // Static method that creates a CoefficientPolynomialCiphertext from a
   // SymmetricRlweCiphertext by performing InverseNtt on each ciphertext
@@ -163,13 +164,14 @@ class CoefficientPolynomialCiphertext {
   // ErrorParams.
   const rlwe::ErrorParams<ModularInt>* error_params_;
 
-  // A heuristic on the amount of error in the ciphertext.
-  double error_;
-
   // The power a in s(x^a) that the ciphertext can be decrypted with.
   int power_of_s_;
+
+  // A heuristic on the amount of error in the ciphertext.
+  double error_;
 };
 
-}  //  namespace rlwe::testing
+}  //  namespace testing
+}  //  namespace rlwe
 
 #endif  // RLWE_TESTING_COEFFICIENT_POLYNOMIAL_CIPHERTEXT_H_
diff --git a/testing/coefficient_polynomial_test.cc b/testing/coefficient_polynomial_test.cc
index db3e184..bf43ee6 100644
--- a/testing/coefficient_polynomial_test.cc
+++ b/testing/coefficient_polynomial_test.cc
@@ -18,6 +18,7 @@
 #include <random>
 #include <vector>
 
+#include <google/protobuf/message_lite.h>
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 #include "constants.h"
@@ -415,7 +416,7 @@ TEST_F(PolynomialTest, Serialize) {
                          p.Serialize());
     ASSERT_OK_AND_ASSIGN(rlwe::SerializedCoefficientPolynomial serialized_q,
                          q.Serialize());
-    EXPECT_THAT(serialized_p, EqualsProto(serialized_q));
+    EXPECT_EQ(serialized_p.SerializeAsString(), serialized_q.SerializeAsString());
 
     // Ensure that a serialized polynomial can be deserialized.
     ASSERT_OK_AND_ASSIGN(
diff --git a/testing/parameters.h b/testing/parameters.h
index 05864f0..6f7a08c 100644
--- a/testing/parameters.h
+++ b/testing/parameters.h
@@ -26,7 +26,8 @@
 #include "integral_types.h"
 #include "montgomery.h"
 
-namespace rlwe::testing {
+namespace rlwe {
+namespace testing {
 
 // ModularInt types for typed tests. A typed test can be defined as follows in
 // test files.
@@ -54,50 +55,54 @@ typedef ::testing::Types<
 // }
 template <typename ModularInt>
 struct ContextParameters {
-  constexpr static std::array<typename RlweContext<ModularInt>::Parameters, 0>
-      value = {};
+  static std::vector<typename RlweContext<ModularInt>::Parameters> Value() {
+    return {};
+  }
 };
 
 template <>
 struct ContextParameters<MontgomeryInt<Uint16>> {
-  constexpr static std::array<RlweContext<MontgomeryInt<Uint16>>::Parameters, 1>
-      value = {
+  static std::vector<RlweContext<MontgomeryInt<Uint16>>::Parameters> Value() {
+      return {
           RlweContext<MontgomeryInt<Uint16>>::Parameters{
               .modulus = kNewhopeModulus,
               .log_n = 10,
               .log_t = 1,
               .variance = 8},
       };
+  }
 };
 
 template <>
 struct ContextParameters<MontgomeryInt<Uint32>> {
-  constexpr static std::array<RlweContext<MontgomeryInt<Uint32>>::Parameters, 2>
-      value = {
+  static std::vector<RlweContext<MontgomeryInt<Uint32>>::Parameters> Value() {
+      return {
           RlweContext<MontgomeryInt<Uint32>>::Parameters{
               .modulus = kModulus25, .log_n = 10, .log_t = 1, .variance = 8},
           RlweContext<MontgomeryInt<Uint32>>::Parameters{
               .modulus = kModulus29, .log_n = 11, .log_t = 5, .variance = 8},
       };
+  }
 };
 
 template <>
 struct ContextParameters<MontgomeryInt<Uint64>> {
-  constexpr static std::array<RlweContext<MontgomeryInt<Uint64>>::Parameters, 1>
-      value = {
+  static std::vector<RlweContext<MontgomeryInt<Uint64>>::Parameters> Value() {
+      return {
           RlweContext<MontgomeryInt<Uint64>>::Parameters{
               .modulus = kModulus59, .log_n = 11, .log_t = 10, .variance = 8},
       };
+  }
 };
 
 template <>
 struct ContextParameters<MontgomeryInt<absl::uint128>> {
-  constexpr static std::array<
-      RlweContext<MontgomeryInt<absl::uint128>>::Parameters, 1>
-      value = {
+  static std::vector<RlweContext<MontgomeryInt<absl::uint128>>::Parameters> Value() {
+      return {
           RlweContext<MontgomeryInt<absl::uint128>>::Parameters{
               .modulus = kModulus80, .log_n = 11, .log_t = 11, .variance = 8},
       };
+  }
 };
 
 // Parameters for testing of modulus switching. These parameters must be
@@ -120,13 +125,16 @@ struct ContextParameters<MontgomeryInt<absl::uint128>> {
 template <typename ModularInt>
 struct ContextParametersModulusSwitching {
   using Params = typename RlweContext<ModularInt>::Parameters;
-  constexpr static std::array<std::tuple<Params, Params>, 0> value = {};
+  static std::vector<std::tuple<Params, Params>> Value() {
+    return {};
+  }
 };
 
 template <>
 struct ContextParametersModulusSwitching<MontgomeryInt<Uint64>> {
   using Params = typename RlweContext<MontgomeryInt<Uint64>>::Parameters;
-  constexpr static std::array<std::tuple<Params, Params>, 1> value = {
+  static std::vector<std::tuple<Params, Params>> Value() {
+    return {
       std::make_tuple(
           Params{.modulus = 17592186028033ULL,
                  .log_n = 10,
@@ -134,12 +142,14 @@ struct ContextParametersModulusSwitching<MontgomeryInt<Uint64>> {
                  .variance = 8},
           Params{
               .modulus = 1589249ULL, .log_n = 10, .log_t = 4, .variance = 8})};
+  }
 };
 
 template <>
 struct ContextParametersModulusSwitching<MontgomeryInt<absl::uint128>> {
   using Params = typename RlweContext<MontgomeryInt<absl::uint128>>::Parameters;
-  constexpr static std::array<std::tuple<Params, Params>, 1> value = {
+  static std::vector<std::tuple<Params, Params>> Value() {
+    return {
       std::make_tuple(
           Params{.modulus = absl::MakeUint128(4611686018427387903ULL,
                                               18446744073709355009ULL),
@@ -150,8 +160,10 @@ struct ContextParametersModulusSwitching<MontgomeryInt<absl::uint128>> {
                  .log_n = 10,
                  .log_t = 2,
                  .variance = 8})};
+  }
 };
 
-}  // namespace rlwe::testing
+}  // namespace testing
+}  // namespace rlwe
 
 #endif  // RLWE_TESTING_INSTANCES_H_
diff --git a/testing/protobuf_matchers.h b/testing/protobuf_matchers.h
index 504ef78..0c7df16 100644
--- a/testing/protobuf_matchers.h
+++ b/testing/protobuf_matchers.h
@@ -18,6 +18,7 @@
 #define RLWE_TESTING_PROTOBUF_MATCHERS_H_
 
 #include <google/protobuf/message.h>
+#include <google/protobuf/message_lite.h>
 #include <google/protobuf/util/message_differencer.h>
 #include <gmock/gmock.h>
 
@@ -29,7 +30,7 @@ class EqualsProtoImpl
  public:
   EqualsProtoImpl(const google::protobuf::Message& other) : other_(&other) {}
 
-  bool MatchAndExplain(
+  inline bool MatchAndExplain(
       const google::protobuf::Message& message,
       ::testing::MatchResultListener* listener) const override {
     if (!google::protobuf::util::MessageDifferencer::Equals(message, *other_)) {
@@ -39,11 +40,11 @@ class EqualsProtoImpl
     return true;
   }
 
-  void DescribeTo(std::ostream* os) const override {
+  inline void DescribeTo(std::ostream* os) const override {
     *os << "is equal to another protocol buffer";
   }
 
-  void DescribeNegationTo(std::ostream* os) const override {
+  inline void DescribeNegationTo(std::ostream* os) const override {
     *os << "is not equal to another protocol buffer";
   }
 
@@ -51,11 +52,45 @@ class EqualsProtoImpl
   const google::protobuf::Message* other_;  // not owned
 };
 
-::testing::Matcher<const google::protobuf::Message&> EqualsProto(
+inline ::testing::Matcher<const google::protobuf::Message&> EqualsProto(
     const google::protobuf::Message& other) {
   return ::testing::Matcher<const google::protobuf::Message&>(new EqualsProtoImpl(other));
 }
 
+class EqualsProtoLiteImpl
+    : public ::testing::MatcherInterface<const google::protobuf::MessageLite&> {
+ public:
+  EqualsProtoLiteImpl(const google::protobuf::MessageLite& other) : other_(&other) {}
+
+  bool MatchAndExplain(
+      const google::protobuf::MessageLite& message,
+      ::testing::MatchResultListener* listener) const override {
+    // TODO(b/159369884): Implement robust equality checks.
+    if (message.SerializeAsString() != other_->SerializeAsString()) {
+      *listener << "protobufs were not equal";
+      return false;
+    }
+    return true;
+  }
+
+  void DescribeTo(std::ostream* os) const override {
+    *os << "is equal to another protocol buffer";
+  }
+
+  void DescribeNegationTo(std::ostream* os) const override {
+    *os << "is not equal to another protocol buffer";
+  }
+
+ private:
+  const google::protobuf::MessageLite* other_;  // not owned
+};
+
+inline ::testing::Matcher<const google::protobuf::MessageLite&> EqualsProto(
+    const google::protobuf::MessageLite& other) {
+  return ::testing::Matcher<const google::protobuf::MessageLite&>(
+      new EqualsProtoLiteImpl(other));
+}
+
 }  // namespace testing
 }  // namespace rlwe
 
diff --git a/testing/protobuf_matchers_test.cc b/testing/protobuf_matchers_test.cc
index 48865f7..7ef759a 100644
--- a/testing/protobuf_matchers_test.cc
+++ b/testing/protobuf_matchers_test.cc
@@ -24,11 +24,11 @@ namespace {
 TEST(EqualsProtoTest, EqualsProtoWorks) {
   rlwe::SerializedCoefficientPolynomial coeffs;
   coeffs.set_num_coeffs(10);
-  EXPECT_THAT(coeffs, rlwe::testing::EqualsProto(coeffs));
+  EXPECT_EQ(coeffs.SerializeAsString(), coeffs.SerializeAsString());
 
   rlwe::SerializedCoefficientPolynomial coeffs_other;
   coeffs_other.set_num_coeffs(20);
-  EXPECT_THAT(coeffs, ::testing::Not(rlwe::testing::EqualsProto(coeffs_other)));
+  EXPECT_NE(coeffs.SerializeAsString(), coeffs_other.SerializeAsString());
 }
 
 }  // namespace
diff --git a/testing/status_matchers.h b/testing/status_matchers.h
index 52f9b0a..c482dae 100644
--- a/testing/status_matchers.h
+++ b/testing/status_matchers.h
@@ -28,10 +28,10 @@ namespace internal {
 
 // This function and its overload allow the same matcher to be used for Status
 // and StatusOr tests.
-absl::Status GetStatus(const absl::Status& status) { return status; }
+inline absl::Status GetStatus(const absl::Status& status) { return status; }
 
 template <typename T>
-absl::Status GetStatus(const rlwe::StatusOr<T>& statusor) {
+inline absl::Status GetStatus(const rlwe::StatusOr<T>& statusor) {
   return statusor.status();
 }
 
@@ -42,7 +42,7 @@ class StatusIsImpl : public ::testing::MatcherInterface<StatusType> {
                const ::testing::Matcher<const std::string&>& message)
       : code_(code), message_(message) {}
 
-  bool MatchAndExplain(StatusType status,
+  inline bool MatchAndExplain(StatusType status,
                        ::testing::MatchResultListener* listener) const {
     ::testing::StringMatchResultListener str_listener;
     absl::Status real_status = GetStatus(status);
@@ -58,14 +58,14 @@ class StatusIsImpl : public ::testing::MatcherInterface<StatusType> {
     return true;
   }
 
-  void DescribeTo(std::ostream* os) const {
+  inline void DescribeTo(std::ostream* os) const {
     *os << "has a status code that ";
     code_.DescribeTo(os);
     *os << " and a message that ";
     message_.DescribeTo(os);
   }
 
-  void DescribeNegationto(std::ostream* os) const {
+  inline void DescribeNegationto(std::ostream* os) const {
     *os << "has a status code that ";
     code_.DescribeNegationTo(os);
     *os << " and a message that ";
@@ -99,7 +99,7 @@ class StatusIsPoly {
 
 // This function allows us to avoid a template parameter when writing tests, so
 // that we can transparently test both Status and StatusOr returns.
-internal::StatusIsPoly StatusIs(
+inline internal::StatusIsPoly StatusIs(
     ::testing::Matcher<absl::StatusCode>&& code,
     ::testing::Matcher<const std::string&>&& message) {
   return internal::StatusIsPoly(