File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,21 +64,20 @@ rej_bounded_poly:
6464 addi x7 , x0 , 0
6565 addi x8 , x0 , 1
6666
67+ / * Initialize the WDRs th at hold intermediate results with randomness. * /
68+ bn.wsrr w4 , URND
69+ bn.wsrr w5 , URND
70+ bn.wsrr w10 , URND
71+ bn.wsrr w11 , URND
72+
6773 / *
6874 * The following loop unfolds in two parts. First , rejection sample a
6975 * Boolean shared vector x consisting of 8 4 - bit coefficients in the interval
7076 * [ 0 , 14 ] . Second , compute x mod 5 and convert the coefficients to
7177 * arithmetic shares. Repe at this 32 times until all the coefficients of the
7278 * polynomial have been sampled.
7379 * /
74- loopi 32 , 42
75-
76- / * Initialize the WDRs th at hold intermediate results with randomness. * /
77- bn.wsrr w4 , URND
78- bn.wsrr w5 , URND
79- bn.wsrr w10 , URND
80- bn.wsrr w11 , URND
81-
80+ loopi 32 , 38
8281 loopi 8 , 27
8382 / * If the squeezed buffer is empty re - squeeze a new batch of 64 4 - bit
8483 coefficients. * /
Original file line number Diff line number Diff line change @@ -99,14 +99,13 @@ _bit_unpack_s:
9999 bn. not w13 , w31
100100 bn.shv.8s w13 , w13 >> 29
101101
102+ / * Initialize the WDRs th at hold intermediate results with randomness. * /
103+ bn.wsrr w0 , URND
104+ bn.wsrr w1 , URND
105+
102106 / * In each iteration , we decode 8 Boolean - shared coefficients th at are
103107 bit - unpacked and converted to arithmetic shares in w0 and w1. * /
104- loopi 8 , 21
105-
106- / * Initialize the WDRs th at hold intermediate results with randomness. * /
107- bn.wsrr w0 , URND
108- bn.wsrr w1 , URND
109-
108+ loopi 8 , 19
110109 loopi 8 , 9
111110
112111 / * Randomness to shift into registers when a coefficient is extracted.
Original file line number Diff line number Diff line change @@ -51,8 +51,28 @@ sample_mask_poly:
5151 addi x4 , x0 , 0
5252 addi x5 , x0 , 1
5353
54+ / * Initialize the registers th at hold the compressed polynomial shares with
55+ randomness. This avoids isolating secrets bits in an all - zero register
56+ during the shifting operations. * /
57+
58+ / * Share 0 . * /
59+ bn.wsrr w0 , URND
60+ bn.wsrr w3 , URND
61+ bn.wsrr w4 , URND
62+ bn.wsrr w5 , URND
63+ bn.wsrr w6 , URND
64+ bn.wsrr w7 , URND
65+
66+ / * Share 1 . * /
67+ bn.wsrr w1 , URND
68+ bn.wsrr w8 , URND
69+ bn.wsrr w9 , URND
70+ bn.wsrr w10 , URND
71+ bn.wsrr w11 , URND
72+ bn.wsrr w12 , URND
73+
5474 / * In each iteration , we sample 64 coefficients. * /
55- loopi 4 , 51
75+ loopi 4 , 49
5676
5777 / *
5878 * Each coefficient of the mask polynomial has a size of 20 bits. Since
@@ -87,11 +107,7 @@ sample_mask_poly:
87107 bn. mov w12 , w30
88108
89109 / * Sample 64 coefficients in steps of eight at at time. * /
90- loopi 8 , 29
91-
92- / * Initialize the WDRs th at hold intermediate results with randomness. * /
93- bn.wsrr w0 , URND
94- bn.wsrr w1 , URND
110+ loopi 8 , 27
95111
96112 / * Sample one shared vector of eight coefficients. * /
97113 loopi 8 , 17
You can’t perform that action at this time.
0 commit comments