Commit 40c763a18d0b58d603f28befc480bdd2fdce32fb

Francois Perrad 2017-10-15T16:11:09

literal suffix in call function

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
diff --git a/bn_fast_mp_invmod.c b/bn_fast_mp_invmod.c
index cabed0c..6be44f8 100644
--- a/bn_fast_mp_invmod.c
+++ b/bn_fast_mp_invmod.c
@@ -59,7 +59,7 @@ int fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c)
    if ((res = mp_copy(&y, &v)) != MP_OKAY) {
       goto LBL_ERR;
    }
-   mp_set(&D, 1);
+   mp_set(&D, 1uL);
 
 top:
    /* 4.  while u is even do */
@@ -128,7 +128,7 @@ top:
    /* now a = C, b = D, gcd == g*v */
 
    /* if v != 1 then there is no inverse */
-   if (mp_cmp_d(&v, 1) != MP_EQ) {
+   if (mp_cmp_d(&v, 1uL) != MP_EQ) {
       res = MP_VAL;
       goto LBL_ERR;
    }
diff --git a/bn_mp_div.c b/bn_mp_div.c
index dbfdc03..acf0d78 100644
--- a/bn_mp_div.c
+++ b/bn_mp_div.c
@@ -47,7 +47,7 @@ int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d)
    }
 
 
-   mp_set(&tq, 1);
+   mp_set(&tq, 1uL);
    n = mp_count_bits(a) - mp_count_bits(b);
    if (((res = mp_abs(a, &ta)) != MP_OKAY) ||
        ((res = mp_abs(b, &tb)) != MP_OKAY) ||
diff --git a/bn_mp_expt_d_ex.c b/bn_mp_expt_d_ex.c
index 99319a5..d8d6b45 100644
--- a/bn_mp_expt_d_ex.c
+++ b/bn_mp_expt_d_ex.c
@@ -28,7 +28,7 @@ int mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast)
    }
 
    /* set initial result */
-   mp_set(c, 1);
+   mp_set(c, 1uL);
 
    if (fast != 0) {
       while (b > 0) {
diff --git a/bn_mp_exptmod_fast.c b/bn_mp_exptmod_fast.c
index 4a188d0..84eb114 100644
--- a/bn_mp_exptmod_fast.c
+++ b/bn_mp_exptmod_fast.c
@@ -160,7 +160,7 @@ int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y
       goto LBL_RES;
 #endif
    } else {
-      mp_set(&res, 1);
+      mp_set(&res, 1uL);
       if ((err = mp_mod(G, P, &M[1])) != MP_OKAY) {
          goto LBL_RES;
       }
diff --git a/bn_mp_exteuclid.c b/bn_mp_exteuclid.c
index 08e5ff2..67018ac 100644
--- a/bn_mp_exteuclid.c
+++ b/bn_mp_exteuclid.c
@@ -28,13 +28,13 @@ int mp_exteuclid(const mp_int *a, const mp_int *b, mp_int *U1, mp_int *U2, mp_in
    }
 
    /* initialize, (u1,u2,u3) = (1,0,a) */
-   mp_set(&u1, 1);
+   mp_set(&u1, 1uL);
    if ((err = mp_copy(a, &u3)) != MP_OKAY)                                        {
       goto LBL_ERR;
    }
 
    /* initialize, (v1,v2,v3) = (0,1,b) */
-   mp_set(&v2, 1);
+   mp_set(&v2, 1uL);
    if ((err = mp_copy(b, &v3)) != MP_OKAY)                                        {
       goto LBL_ERR;
    }
diff --git a/bn_mp_fread.c b/bn_mp_fread.c
index 85e5ee3..807be70 100644
--- a/bn_mp_fread.c
+++ b/bn_mp_fread.c
@@ -56,7 +56,7 @@ int mp_fread(mp_int *a, int radix, FILE *stream)
 
       ch = fgetc(stream);
    }
-   if (mp_cmp_d(a, 0) != MP_EQ) {
+   if (mp_cmp_d(a, 0uL) != MP_EQ) {
       a->sign = neg;
    }
 
diff --git a/bn_mp_invmod.c b/bn_mp_invmod.c
index 528b0c7..96717ea 100644
--- a/bn_mp_invmod.c
+++ b/bn_mp_invmod.c
@@ -19,7 +19,7 @@
 int mp_invmod(const mp_int *a, const mp_int *b, mp_int *c)
 {
    /* b cannot be negative and has to be >1 */
-   if ((b->sign == MP_NEG) || (mp_cmp_d(b, 1) != MP_GT)) {
+   if ((b->sign == MP_NEG) || (mp_cmp_d(b, 1uL) != MP_GT)) {
       return MP_VAL;
    }
 
diff --git a/bn_mp_invmod_slow.c b/bn_mp_invmod_slow.c
index 2bb5196..360f161 100644
--- a/bn_mp_invmod_slow.c
+++ b/bn_mp_invmod_slow.c
@@ -53,8 +53,8 @@ int mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c)
    if ((res = mp_copy(&y, &v)) != MP_OKAY) {
       goto LBL_ERR;
    }
-   mp_set(&A, 1);
-   mp_set(&D, 1);
+   mp_set(&A, 1uL);
+   mp_set(&D, 1uL);
 
 top:
    /* 4.  while u is even do */
@@ -143,13 +143,13 @@ top:
    /* now a = C, b = D, gcd == g*v */
 
    /* if v != 1 then there is no inverse */
-   if (mp_cmp_d(&v, 1) != MP_EQ) {
+   if (mp_cmp_d(&v, 1uL) != MP_EQ) {
       res = MP_VAL;
       goto LBL_ERR;
    }
 
    /* if its too low */
-   while (mp_cmp_d(&C, 0) == MP_LT) {
+   while (mp_cmp_d(&C, 0uL) == MP_LT) {
       if ((res = mp_add(&C, b, &C)) != MP_OKAY) {
          goto LBL_ERR;
       }
diff --git a/bn_mp_is_square.c b/bn_mp_is_square.c
index dd5150e..9547a53 100644
--- a/bn_mp_is_square.c
+++ b/bn_mp_is_square.c
@@ -63,7 +63,7 @@ int mp_is_square(const mp_int *arg, int *ret)
    }
 
    /* Next check mod 105 (3*5*7) */
-   if ((res = mp_mod_d(arg, 105, &c)) != MP_OKAY) {
+   if ((res = mp_mod_d(arg, 105uL, &c)) != MP_OKAY) {
       return res;
    }
    if (rem_105[c] == 1) {
diff --git a/bn_mp_jacobi.c b/bn_mp_jacobi.c
index c314c82..63df203 100644
--- a/bn_mp_jacobi.c
+++ b/bn_mp_jacobi.c
@@ -32,14 +32,14 @@ int mp_jacobi(const mp_int *a, const mp_int *n, int *c)
    }
 
    /* if n <= 0 return MP_VAL */
-   if (mp_cmp_d(n, 0) != MP_GT) {
+   if (mp_cmp_d(n, 0uL) != MP_GT) {
       return MP_VAL;
    }
 
    /* step 1. handle case of a == 0 */
    if (mp_iszero(a) == MP_YES) {
       /* special case of a == 0 and n == 1 */
-      if (mp_cmp_d(n, 1) == MP_EQ) {
+      if (mp_cmp_d(n, 1uL) == MP_EQ) {
          *c = 1;
       } else {
          *c = 0;
@@ -48,7 +48,7 @@ int mp_jacobi(const mp_int *a, const mp_int *n, int *c)
    }
 
    /* step 2.  if a == 1, return 1 */
-   if (mp_cmp_d(a, 1) == MP_EQ) {
+   if (mp_cmp_d(a, 1uL) == MP_EQ) {
       *c = 1;
       return MP_OKAY;
    }
@@ -91,7 +91,7 @@ int mp_jacobi(const mp_int *a, const mp_int *n, int *c)
    }
 
    /* if a1 == 1 we're done */
-   if (mp_cmp_d(&a1, 1) == MP_EQ) {
+   if (mp_cmp_d(&a1, 1uL) == MP_EQ) {
       *c = s;
    } else {
       /* n1 = n mod a1 */
diff --git a/bn_mp_montgomery_calc_normalization.c b/bn_mp_montgomery_calc_normalization.c
index f2b0856..360e3e5 100644
--- a/bn_mp_montgomery_calc_normalization.c
+++ b/bn_mp_montgomery_calc_normalization.c
@@ -33,7 +33,7 @@ int mp_montgomery_calc_normalization(mp_int *a, const mp_int *b)
          return res;
       }
    } else {
-      mp_set(a, 1);
+      mp_set(a, 1uL);
       bits = 1;
    }
 
diff --git a/bn_mp_n_root_ex.c b/bn_mp_n_root_ex.c
index ca50649..f5d7da5 100644
--- a/bn_mp_n_root_ex.c
+++ b/bn_mp_n_root_ex.c
@@ -52,7 +52,7 @@ int mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast)
    a_.sign = MP_ZPOS;
 
    /* t2 = 2 */
-   mp_set(&t2, 2);
+   mp_set(&t2, 2uL);
 
    do {
       /* t1 = t2 */
@@ -101,7 +101,7 @@ int mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast)
       }
 
       if (mp_cmp(&t2, &a_) == MP_GT) {
-         if ((res = mp_sub_d(&t1, 1, &t1)) != MP_OKAY) {
+         if ((res = mp_sub_d(&t1, 1uL, &t1)) != MP_OKAY) {
             goto LBL_T3;
          }
       } else {
diff --git a/bn_mp_prime_fermat.c b/bn_mp_prime_fermat.c
index 9c15435..e71e0ae 100644
--- a/bn_mp_prime_fermat.c
+++ b/bn_mp_prime_fermat.c
@@ -32,7 +32,7 @@ int mp_prime_fermat(const mp_int *a, const mp_int *b, int *result)
    *result = MP_NO;
 
    /* ensure b > 1 */
-   if (mp_cmp_d(b, 1) != MP_GT) {
+   if (mp_cmp_d(b, 1uL) != MP_GT) {
       return MP_VAL;
    }
 
diff --git a/bn_mp_prime_miller_rabin.c b/bn_mp_prime_miller_rabin.c
index 5de5f05..34c4d1c 100644
--- a/bn_mp_prime_miller_rabin.c
+++ b/bn_mp_prime_miller_rabin.c
@@ -31,7 +31,7 @@ int mp_prime_miller_rabin(const mp_int *a, const mp_int *b, int *result)
    *result = MP_NO;
 
    /* ensure b > 1 */
-   if (mp_cmp_d(b, 1) != MP_GT) {
+   if (mp_cmp_d(b, 1uL) != MP_GT) {
       return MP_VAL;
    }
 
@@ -39,7 +39,7 @@ int mp_prime_miller_rabin(const mp_int *a, const mp_int *b, int *result)
    if ((err = mp_init_copy(&n1, a)) != MP_OKAY) {
       return err;
    }
-   if ((err = mp_sub_d(&n1, 1, &n1)) != MP_OKAY) {
+   if ((err = mp_sub_d(&n1, 1uL, &n1)) != MP_OKAY) {
       goto LBL_N1;
    }
 
@@ -67,7 +67,7 @@ int mp_prime_miller_rabin(const mp_int *a, const mp_int *b, int *result)
    }
 
    /* if y != 1 and y != n1 do */
-   if ((mp_cmp_d(&y, 1) != MP_EQ) && (mp_cmp(&y, &n1) != MP_EQ)) {
+   if ((mp_cmp_d(&y, 1uL) != MP_EQ) && (mp_cmp(&y, &n1) != MP_EQ)) {
       j = 1;
       /* while j <= s-1 and y != n1 */
       while ((j <= (s - 1)) && (mp_cmp(&y, &n1) != MP_EQ)) {
@@ -76,7 +76,7 @@ int mp_prime_miller_rabin(const mp_int *a, const mp_int *b, int *result)
          }
 
          /* if y == 1 then composite */
-         if (mp_cmp_d(&y, 1) == MP_EQ) {
+         if (mp_cmp_d(&y, 1uL) == MP_EQ) {
             goto LBL_Y;
          }
 
diff --git a/bn_mp_prime_next_prime.c b/bn_mp_prime_next_prime.c
index f383cbb..1dfa2be 100644
--- a/bn_mp_prime_next_prime.c
+++ b/bn_mp_prime_next_prime.c
@@ -62,8 +62,8 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style)
          }
       }
       /* at this point a maybe 1 */
-      if (mp_cmp_d(a, 1) == MP_EQ) {
-         mp_set(a, 2);
+      if (mp_cmp_d(a, 1uL) == MP_EQ) {
+         mp_set(a, 2uL);
          return MP_OKAY;
       }
       /* fall through to the sieve */
@@ -88,7 +88,7 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style)
    } else {
       if (mp_iseven(a) == MP_YES) {
          /* force odd */
-         if ((err = mp_sub_d(a, 1, a)) != MP_OKAY) {
+         if ((err = mp_sub_d(a, 1uL, a)) != MP_OKAY) {
             return err;
          }
       }
diff --git a/bn_mp_prime_random_ex.c b/bn_mp_prime_random_ex.c
index d3d6f3d..9acfdee 100644
--- a/bn_mp_prime_random_ex.c
+++ b/bn_mp_prime_random_ex.c
@@ -100,7 +100,7 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback
 
       if ((flags & LTM_PRIME_SAFE) != 0) {
          /* see if (a-1)/2 is prime */
-         if ((err = mp_sub_d(a, 1, a)) != MP_OKAY)                    {
+         if ((err = mp_sub_d(a, 1uL, a)) != MP_OKAY)                  {
             goto error;
          }
          if ((err = mp_div_2(a, a)) != MP_OKAY)                       {
@@ -119,7 +119,7 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback
       if ((err = mp_mul_2(a, a)) != MP_OKAY)                          {
          goto error;
       }
-      if ((err = mp_add_d(a, 1, a)) != MP_OKAY)                       {
+      if ((err = mp_add_d(a, 1uL, a)) != MP_OKAY)                     {
          goto error;
       }
    }
diff --git a/bn_mp_reduce.c b/bn_mp_reduce.c
index bbc521f..9e8b962 100644
--- a/bn_mp_reduce.c
+++ b/bn_mp_reduce.c
@@ -73,8 +73,8 @@ int mp_reduce(mp_int *x, const mp_int *m, const mp_int *mu)
    }
 
    /* If x < 0, add b**(k+1) to it */
-   if (mp_cmp_d(x, 0) == MP_LT) {
-      mp_set(&q, 1);
+   if (mp_cmp_d(x, 0uL) == MP_LT) {
+      mp_set(&q, 1uL);
       if ((res = mp_lshd(&q, um + 1)) != MP_OKAY)
          goto CLEANUP;
       if ((res = mp_add(x, &q, x)) != MP_OKAY)
diff --git a/bn_mp_sqrtmod_prime.c b/bn_mp_sqrtmod_prime.c
index 261723e..d76ef6b 100644
--- a/bn_mp_sqrtmod_prime.c
+++ b/bn_mp_sqrtmod_prime.c
@@ -22,11 +22,11 @@ int mp_sqrtmod_prime(const mp_int *n, const mp_int *prime, mp_int *ret)
    mp_digit i;
 
    /* first handle the simple cases */
-   if (mp_cmp_d(n, 0) == MP_EQ) {
+   if (mp_cmp_d(n, 0uL) == MP_EQ) {
       mp_zero(ret);
       return MP_OKAY;
    }
-   if (mp_cmp_d(prime, 2) == MP_EQ)                              return MP_VAL; /* prime must be odd */
+   if (mp_cmp_d(prime, 2uL) == MP_EQ)                            return MP_VAL; /* prime must be odd */
    if ((res = mp_jacobi(n, prime, &legendre)) != MP_OKAY)        return res;
    if (legendre == -1)                                           return MP_VAL; /* quadratic non-residue mod prime */
 
@@ -38,9 +38,9 @@ int mp_sqrtmod_prime(const mp_int *n, const mp_int *prime, mp_int *ret)
     * compute directly: res = n^(prime+1)/4 mod prime
     * Handbook of Applied Cryptography algorithm 3.36
     */
-   if ((res = mp_mod_d(prime, 4, &i)) != MP_OKAY)                goto cleanup;
+   if ((res = mp_mod_d(prime, 4uL, &i)) != MP_OKAY)               goto cleanup;
    if (i == 3) {
-      if ((res = mp_add_d(prime, 1, &t1)) != MP_OKAY)             goto cleanup;
+      if ((res = mp_add_d(prime, 1uL, &t1)) != MP_OKAY)           goto cleanup;
       if ((res = mp_div_2(&t1, &t1)) != MP_OKAY)                  goto cleanup;
       if ((res = mp_div_2(&t1, &t1)) != MP_OKAY)                  goto cleanup;
       if ((res = mp_exptmod(n, &t1, prime, ret)) != MP_OKAY)      goto cleanup;
@@ -52,14 +52,14 @@ int mp_sqrtmod_prime(const mp_int *n, const mp_int *prime, mp_int *ret)
 
    /* factor out powers of 2 from prime-1, defining Q and S as: prime-1 = Q*2^S */
    if ((res = mp_copy(prime, &Q)) != MP_OKAY)                    goto cleanup;
-   if ((res = mp_sub_d(&Q, 1, &Q)) != MP_OKAY)                   goto cleanup;
+   if ((res = mp_sub_d(&Q, 1uL, &Q)) != MP_OKAY)                 goto cleanup;
    /* Q = prime - 1 */
    mp_zero(&S);
    /* S = 0 */
    while (mp_iseven(&Q) != MP_NO) {
       if ((res = mp_div_2(&Q, &Q)) != MP_OKAY)                    goto cleanup;
       /* Q = Q / 2 */
-      if ((res = mp_add_d(&S, 1, &S)) != MP_OKAY)                 goto cleanup;
+      if ((res = mp_add_d(&S, 1uL, &S)) != MP_OKAY)               goto cleanup;
       /* S = S + 1 */
    }
 
@@ -69,13 +69,13 @@ int mp_sqrtmod_prime(const mp_int *n, const mp_int *prime, mp_int *ret)
    while (1) {
       if ((res = mp_jacobi(&Z, prime, &legendre)) != MP_OKAY)     goto cleanup;
       if (legendre == -1) break;
-      if ((res = mp_add_d(&Z, 1, &Z)) != MP_OKAY)                 goto cleanup;
+      if ((res = mp_add_d(&Z, 1uL, &Z)) != MP_OKAY)               goto cleanup;
       /* Z = Z + 1 */
    }
 
    if ((res = mp_exptmod(&Z, &Q, prime, &C)) != MP_OKAY)         goto cleanup;
    /* C = Z ^ Q mod prime */
-   if ((res = mp_add_d(&Q, 1, &t1)) != MP_OKAY)                  goto cleanup;
+   if ((res = mp_add_d(&Q, 1uL, &t1)) != MP_OKAY)                goto cleanup;
    if ((res = mp_div_2(&t1, &t1)) != MP_OKAY)                    goto cleanup;
    /* t1 = (Q + 1) / 2 */
    if ((res = mp_exptmod(n, &t1, prime, &R)) != MP_OKAY)         goto cleanup;
@@ -91,7 +91,7 @@ int mp_sqrtmod_prime(const mp_int *n, const mp_int *prime, mp_int *ret)
       if ((res = mp_copy(&T, &t1)) != MP_OKAY)                    goto cleanup;
       i = 0;
       while (1) {
-         if (mp_cmp_d(&t1, 1) == MP_EQ) break;
+         if (mp_cmp_d(&t1, 1uL) == MP_EQ) break;
          if ((res = mp_exptmod(&t1, &two, prime, &t1)) != MP_OKAY) goto cleanup;
          i++;
       }
@@ -101,7 +101,7 @@ int mp_sqrtmod_prime(const mp_int *n, const mp_int *prime, mp_int *ret)
          goto cleanup;
       }
       if ((res = mp_sub_d(&M, i, &t1)) != MP_OKAY)                goto cleanup;
-      if ((res = mp_sub_d(&t1, 1, &t1)) != MP_OKAY)               goto cleanup;
+      if ((res = mp_sub_d(&t1, 1uL, &t1)) != MP_OKAY)             goto cleanup;
       if ((res = mp_exptmod(&two, &t1, prime, &t1)) != MP_OKAY)   goto cleanup;
       /* t1 = 2 ^ (M - i - 1) */
       if ((res = mp_exptmod(&C, &t1, prime, &t1)) != MP_OKAY)     goto cleanup;
diff --git a/bn_mp_toom_mul.c b/bn_mp_toom_mul.c
index 3554ea8..00b6bfb 100644
--- a/bn_mp_toom_mul.c
+++ b/bn_mp_toom_mul.c
@@ -219,7 +219,7 @@ int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c)
       goto ERR;
    }
    /* 3r2 - r1 - r3 */
-   if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) {
+   if ((res = mp_mul_d(&w2, 3uL, &w2)) != MP_OKAY) {
       goto ERR;
    }
    if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) {
diff --git a/bn_mp_toom_sqr.c b/bn_mp_toom_sqr.c
index b985435..183de20 100644
--- a/bn_mp_toom_sqr.c
+++ b/bn_mp_toom_sqr.c
@@ -162,7 +162,7 @@ int mp_toom_sqr(const mp_int *a, mp_int *b)
       goto ERR;
    }
    /* 3r2 - r1 - r3 */
-   if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) {
+   if ((res = mp_mul_d(&w2, 3uL, &w2)) != MP_OKAY) {
       goto ERR;
    }
    if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) {
diff --git a/bn_s_mp_exptmod.c b/bn_s_mp_exptmod.c
index a886361..1535b2e 100644
--- a/bn_s_mp_exptmod.c
+++ b/bn_s_mp_exptmod.c
@@ -133,7 +133,7 @@ int s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, i
    if ((err = mp_init(&res)) != MP_OKAY) {
       goto LBL_MU;
    }
-   mp_set(&res, 1);
+   mp_set(&res, 1uL);
 
    /* set initial mode and bit cnt */
    mode   = 0;