1 /****h* silcmath/silcmp.h
9 * Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
11 * Copyright (C) 1997 - 2000 Pekka Riikonen
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
32 /* SILC MP library definitions. We use GNU MP library as default
33 MP library. However, to make possible future changes easier (SILC
34 might have its own MP library in the future) we implement our own
35 MP API with simple macros. */
37 typedef MP_INT SilcInt;
38 #define silc_mp_abs(a, b) mpz_abs((a), (b))
39 #define silc_mp_add(a, b, c) mpz_add((a), (b), (c))
40 #define silc_mp_add_ui(a, b, c) mpz_add_ui((a), (b), (c))
41 #define silc_mp_and(a, b, c) mpz_and((a), (b), (c))
42 #define silc_mp_cdiv_q(a, b, c) mpz_cdiv_q((a), (b), (c))
43 #define silc_mp_cdiv_q_ui(a, b, c) mpz_cdiv_q_ui((a), (b), (c))
44 #define silc_mp_cdiv_r(a, b, c) mpz_cdiv_r((a), (b), (c))
45 #define silc_mp_cdiv_r_ui(a, b, c) mpz_cdiv_r_ui((a), (b), (c))
46 #define silc_mp_cdiv_ui(a, b) mpz_cdiv_ui((a), (b))
47 #define silc_mp_clear(a) mpz_clear((a))
48 #define silc_mp_clrbit(a, b) mpz_clrbit((a), (b))
49 #define silc_mp_cmp(a, b) mpz_cmp((a), (b))
50 #define silc_mp_cmp_si(a, b) mpz_cmp_si((a), (b))
51 #define silc_mp_cmp_ui(a, b) mpz_cmp_ui((a), (b))
52 #define silc_mp_com(a, b) mpz_com((a), (b))
53 #define silc_mp_divexact(a, b, c) mpz_divexact((a), (b), (c))
54 #define silc_mp_div(a, b, c) mpz_div((a), (b), (c))
55 #define silc_mp_div_ui(a, b, c) mpz_div_ui((a), (b), (c))
56 #define silc_mp_fdiv_ui(a, b) mpz_fdiv_ui((a), (b))
57 #define silc_mp_fdiv_q(a, b, c) mpz_fdiv_q((a), (b), (c))
58 #define silc_mp_fdiv_q_2exp(a, b, c) mpz_fdiv_q_2exp((a), (b), (c))
59 #define silc_mp_fdiv_q_ui(a, b, c) mpz_fdiv_q_ui((a), (b), (c))
60 #define silc_mp_fdiv_qr(a, b, c, d) mpz_fdiv_qr((a), (b), (c), (d))
61 #define silc_mp_fdiv_qr_ui(a, b, c, d) mpz_fdiv_qr_ui((a), (b), (c), (d))
62 #define silc_mp_fdiv_r(a, b, c) mpz_fdiv_r((a), (b), (c))
63 #define silc_mp_fdiv_r_2exp(a, b, c) mpz_fdiv_r_2exp((a), (b), (c))
64 #define silc_mp_fdiv_r_ui(a, b, c) mpz_fdiv_r_ui((a), (b), (c))
65 #define silc_mp_fdiv_ui(a, b) mpz_fdiv_ui((a), (b))
66 #define silc_mp_gcd(a, b, c) mpz_gcd((a), (b), (c))
67 #define silc_mp_gcd_ui(a, b, c) mpz_gcd_ui((a), (b), (c))
68 #define silc_mp_gcdext(a, b, c, d, e) mpz_gcdext((a), (b), (c), (d), (e))
69 #define silc_mp_get_ui(a) mpz_get_ui((a))
70 #define silc_mp_init(a) mpz_init((a))
71 #define silc_mp_init_set(a, b) mpz_init_set((a), (b))
72 #define silc_mp_init_set_d(a, b) mpz_init_set_d((a), (b))
73 #define silc_mp_init_set_si(a, b) mpz_init_set_si((a), (b))
74 #define silc_mp_init_set_str(a, b, c) mpz_init_set_str((a), (b), (c))
75 #define silc_mp_init_set_ui(a, b) mpz_init_set_ui((a), (b))
76 #define silc_mp_invert(a, b, c) mpz_invert((a), (b), (c))
77 #define silc_mp_ior(a, b, c) mpz_ior((a), (b), (c))
78 #define silc_mp_mod(a, b, c) mpz_mod((a), (b), (c))
79 #define silc_mp_mod_2exp(a, b, c) mpz_mod_2exp((a), (b), (c))
80 #define silc_mp_mod_ui(a, b, c) mpz_mod_ui((a), (b), (c))
81 #define silc_mp_mul(a, b, c) mpz_mul((a), (b), (c))
82 #define silc_mp_mul_2exp(a, b, c) mpz_mul_2exp((a), (b), (c))
83 #define silc_mp_mul_ui(a, b, c) mpz_mul_ui((a), (b), (c))
84 #define silc_mp_neg(a, b) mpz_neg((a), (b))
85 #define silc_mp_pow_ui(a, b, c) mpz_pow_ui((a), (b), (c))
86 #define silc_mp_powm(a, b, c, d) mpz_powm((a), (b), (c), (d))
87 #define silc_mp_powm_ui(a, b, c, d) mpz_powm_ui((a), (b), (c), (d))
88 #define silc_mp_probab_prime_p(a, b) mpz_probab_prime_p((a), (b))
89 #define silc_mp_set(a, b) mpz_set((a), (b))
90 #define silc_mp_set_d(a, b) mpz_set_d((a), (b))
91 #define silc_mp_set_f(a, b) mpz_set_f((a), (b))
92 #define silc_mp_set_q(a, b) mpz_set_q((a), (b))
93 #define silc_mp_set_si(a, b) mpz_set_si((a), (b))
94 #define silc_mp_set_str(a, b, c) mpz_set_str((a), (b), (c))
95 #define silc_mp_set_ui(a, b) mpz_set_ui((a), (b))
96 #define silc_mp_setbit(a, b) mpz_setbit((a), (b))
97 #define silc_mp_size(a) mpz_size((a))
98 #define silc_mp_sizeinbase(a, b) mpz_sizeinbase((a), (b))
99 #define silc_mp_sqrt(a, b) mpz_sqrt((a), (b))
100 #define silc_mp_sqrtrem(a, b, c) mpz_sqrtrem((a), (b), (c))
101 #define silc_mp_sub(a, b, c) mpz_sub((a), (b), (c))
102 #define silc_mp_sub_ui(a, b, c) mpz_sub_ui((a), (b), (c))
103 #define silc_mp_tdiv_ui(a, b) mpz_tdiv_ui((a), (b))
104 #define silc_mp_tdiv_q(a, b, c) mpz_tdiv_q((a), (b), (c))
105 #define silc_mp_tdiv_q_2exp(a, b, c) mpz_tdiv_q_2exp((a), (b), (c))
106 #define silc_mp_tdiv_q_ui(a, b, c) mpz_tdiv_q_ui((a), (b), (c))
107 #define silc_mp_tdiv_qr(a, b, c, d) mpz_tdiv_qr((a), (b), (c), (d))
108 #define silc_mp_tdiv_qr_ui(a, b, c, d) mpz_tdiv_qr_ui((a), (b), (c), (d))
109 #define silc_mp_tdiv_r(a, b, c) mpz_tdiv_r((a), (b), (c))
110 #define silc_mp_tdiv_r_2exp(a, b, c) mpz_tdiv_r_2exp((a), (b), (c))
111 #define silc_mp_tdiv_r_ui(a, b, c) mpz_tdiv_r_ui((a), (b), (c))
112 #define silc_mp_tdiv_ui(a, b) mpz_tdiv_ui((a), (b))
113 #define silc_mp_ui_pow_ui(a, b, c) mpz_ui_pow_ui((a), (b), (c))
114 #define silc_mp_get_str(a, b, c) mpz_get_str((a), (b), (c))
115 #define silc_mp_out_str(a, b, c) mpz_out_str((a), (b), (c))
119 /* SILC MP Library Interface. This interface defines the arbitrary
120 precision arithmetic routines for SILC. Currently the actual routines
121 are implemented separately, usually by some other MP library. The
122 interface is generic but is mainly intended for crypto usage. This
123 interface is used by SILC routines that needs big numbers, such as
124 RSA implementation, Diffie-Hellman implementation etc. */
126 /* XXX Move this to implementation specific files */
127 #define SILC_MP_INT MP_INT
129 /****d* silcmath/SilcMPAPI/SilcMPInt
133 * typedef SILC_MP_INT SilcMPInt;
137 * The SILC MP Integer definition. This is the actual MP integer.
138 * The type is defined as SILC_MP_INT as it is implementation specific
139 * and is unknown to the application.
143 typedef SILC_MP_INT SilcMPInt;
146 /****f* silcmath/SilcMPAPI/silc_mp_alloc
150 * void silc_mp_init(SilcMPInt mp);
154 * Initializes the SilcMPInt *that is the actual MP Integer.
155 * This must be called before any of the silc_mp_ routines can be
156 * used. The integer is uninitialized with the silc_mp_uninit function.
159 void silc_mp_init(SilcMPInt *mp);
161 /****f* silcmath/SilcMPAPI/silc_mp_free
165 * void silc_mp_uninit(SilcMPInt *mp);
169 * Uninitializes the MP Integer.
172 void silc_mp_uninit(SilcMPInt *mp);
174 /****f* silcmath/SilcMPAPI/silc_mp_abs
178 * void silc_mp_abs(SilcMPInt *src, SilcMPInt *dst);
182 * Assign the absolute value of `src' to `dst'.
185 void silc_mp_abs(SilcMPInt *dst, SilcMPInt *src);
187 /****f* silcmath/SilcMPAPI/silc_mp_add
191 * void silc_mp_add(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
195 * Add two integers `mp1' and `mp2' and save the result to `dst'.
198 void silc_mp_add(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
200 /****f* silcmath/SilcMPAPI/silc_mp_add_ui
204 * void silc_mp_add_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
208 * Add two integers `mp1' and unsigned word `ui' and save the result
212 void silc_mp_add_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
214 /****f* silcmath/SilcMPAPI/silc_mp_and
218 * void silc_mp_and(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
222 * Logical and operator. The result is saved to `dst'.
225 void silc_mp_and(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
227 /****f* silcmath/SilcMPAPI/silc_mp_cmp
231 * int silc_mp_cmp(SilcMPInt *mp1, SilcMPInt *mp2);
235 * Compare `mp1' and `mp2'. Returns posivite, zero, or negative
236 * if `mp1' > `mp2', `mp1' == `mp2', or `mp1' < `mp2', respectively.
239 int silc_mp_cmp(SilcMPInt *mp1, SilcMPInt *mp2);
241 /****f* silcmath/SilcMPAPI/silc_mp_cmp_si
245 * int silc_mp_cmp_si(SilcMPInt *mp1, int32 si);
249 * Compare `mp1' and single word `si'. Returns posivite, zero, or negative
250 * if `mp1' > `si', `mp1' == `si', or `mp1' < `si', respectively.
253 int silc_mp_cmp_si(SilcMPInt *mp1, int32 si);
255 /****f* silcmath/SilcMPAPI/silc_mp_cmp_ui
259 * int silc_mp_cmp_ui(SilcMPInt *mp1, uint32 ui);
263 * Compare `mp1' and unsigned word `ui'. Returns posivite, zero, or
264 * negative if `mp1' > `ui', `mp1' == `ui', or `mp1' < `ui',
268 int silc_mp_cmp_ui(SilcMPInt *mp1, uint32 ui);
270 /****f* silcmath/SilcMPAPI/silc_mp_div
274 * void silc_mp_div(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
278 * Divide the `mp1' and `mp2' and save the result to the `dst'. This
279 * is equivalent to dst = mp1 / mp2;
282 void silc_mp_div(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
284 /****f* silcmath/SilcMPAPI/silc_mp_div_ui
288 * void silc_mp_div(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
292 * Divide the `mp1' and unsigned word `ui' and save the result to the
293 * `dst'. This is equivalent to dst = mp1 / ui;
296 void silc_mp_div_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
298 /****f* silcmath/SilcMPAPI/silc_mp_div_qr
302 * void silc_mp_div_qr(SilcMPInt *q, SilcMPInt *r, SilcMPInt *mp1,
307 * Divide the `mp1' and `mp2' and save the quotient to the `q' and
308 * the remainder to the `r'. This is equivalent to the q = mp1 / mp2,
309 * r = mp1 mod mp2 (or mp1 = mp2 * q + r). If the `q' or `r' is NULL
310 * then the operation is omitted.
313 void silc_mp_div_qr(SilcMPInt *q, SilcMPInt *r, SilcMPInt *mp1, SilcMPInt *mp2);
315 /****f* silcmath/SilcMPAPI/silc_mp_div_2exp
319 * void silc_mp_div_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
323 * Divide the `mp1' with 2 ** `exp' and save the result to `dst'.
324 * This is equivalent to dst = mp1 / (2 ^ exp).
327 void silc_mp_div_2exp(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp);
329 /****f* silcmath/SilcMPAPI/silc_mp_div_2exp
333 * void silc_mp_div_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
337 * Divide the `mp1' with 2 ** `exp' and save the quotient to `q' and
338 * the remainder to `r'. This is equivalent to q = mp1 / (2 ^ exp),
339 * r = mp1 mod (2 ^ exp). If the `q' or `r' is NULL then the operation
343 void silc_mp_div_2exp_qr(SilcMPInt *q, SilcMPInt *r, SilcMPInt *mp1, uint32 exp);
345 /****f* silcmath/SilcMPAPI/silc_mp_gcd
349 * void silc_mp_gcd(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
353 * Calculate the greatest common divisor of the integers `mp1' and `mp2'
354 * and save the result to `dst'.
357 void silc_mp_gcd(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
359 /****f* silcmath/SilcMPAPI/silc_mp_gcdext
363 * void silc_mp_gcdext(SilcMPInt *g, SilcMPInt *s, SilcMPInt *t, SilcMPInt *mp1,
368 * Calculate the extended greatest common divisor `g', `s' and `t' such
369 * that g = mp1 * s + mp2 * + t.
372 void silc_mp_gcdext(SilcMPInt *g, SilcMPInt *s, SilcMPInt *t, SilcMPInt *mp1,
375 /****f* silcmath/SilcMPAPI/silc_mp_get_ui
379 * uint32 silc_mp_get_ui(SilcMPInt *mp);
383 * Returns the least significant unsigned word from `mp'.
386 uint32 silc_mp_get_ui(SilcMPInt *mp);
388 /****f* silcmath/SilcMPAPI/silc_mp_get_str
392 * void silc_mp_get_str(char *str, SilcMPInt *mp, int base);
396 * Converts integer `mp' into a string of base `base'. The `str'
397 * must already have space allocated. The function returns the same
398 * as `str' or NULL on error.
401 char *silc_mp_get_str(char *str, SilcMPInt *mp, int base);
403 /****f* silcmath/SilcMPAPI/silc_mp_or
407 * void silc_mp_or(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
411 * Logical inclusive OR operator. The result is saved to `dst'.
414 void silc_mp_or(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
416 /****f* silcmath/SilcMPAPI/silc_mp_mod
420 * void silc_mp_or(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
424 * Mathematical MOD function. Produces the remainder of `mp1' and `mp2'
425 * and saves the result to `dst'. This is equivalent to dst = mp1 mod mp2.
426 * The same result can also be get with silc_mp_div_qr as that function
427 * returns the remainder as well.
430 void silc_mp_mod(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
432 /****f* silcmath/SilcMPAPI/silc_mp_mod_ui
436 * void silc_mp_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
440 * Mathematical MOD function. Produces the remainder of `mp1' and
441 * unsigned word `ui' and saves the result to `dst'. This is equivalent
442 * to dst = mp1 mod ui.
445 void silc_mp_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
447 /****f* silcmath/SilcMPAPI/silc_mp_mod_2exp
451 * void silc_mp_mod_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
455 * Computes the remainder of `mp1' with 2 ** `exp' and saves the
456 * result to `dst'. This is equivalent to dst = mp1 mod (2 ^ exp).
457 * The same result can also be get with silc_mp_div_2exp_qr as that
458 * function returns the remainder as well.
461 void silc_mp_mod_2exp(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
463 /****f* silcmath/SilcMPAPI/silc_mp_mul
467 * void silc_mp_mul(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
471 * Multiply two integers `mp1' and `mp2' and save the result to `dst'.
474 void silc_mp_mul(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
476 /****f* silcmath/SilcMPAPI/silc_mp_mul_ui
480 * void silc_mp_mul(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
484 * Multiply integer `mp1' and unsigned word `ui' and save the result
488 void silc_mp_mul_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
490 /****f* silcmath/SilcMPAPI/silc_mp_mul_2exp
494 * void silc_mp_mul_2exp(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp);
498 * Multiply integers `mp1' with 2 ** `exp' and save the result to
499 * `dst'. This is equivalent to dst = mp1 * (2 ^ exp).
502 void silc_mp_mul_2exp(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp);
504 /****f* silcmath/SilcMPAPI/silc_mp_neg
508 * void silc_mp_neg(SilcMPInt *dst, SilcMPInt *src);
512 * Negate `src' and save the result to `dst'.
515 void silc_mp_neg(SilcMPInt *dst, SilcMPInt *src);
517 /****f* silcmath/SilcMPAPI/silc_mp_pow
521 * void silc_mp_pow(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *exp);
525 * Compute `mp1' ** `exp' and save the result to `dst'. This is
526 * equivalent to dst = mp1 ^ exp.
529 void silc_mp_pow(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *exp);
531 /****f* silcmath/SilcMPAPI/silc_mp_pow_ui
535 * void silc_mp_pow_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp);
539 * Compute `mp1' ** `exp' and save the result to `dst'. This is
540 * equivalent to dst = mp1 ^ exp.
543 void silc_mp_pow_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp);
545 /****f* silcmath/SilcMPAPI/silc_mp_pow_mod
549 * void silc_mp_pow_mod(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *exp,
554 * Compute (`mp1' ** `exp') mod `mod' and save the result to `dst'.
555 * This is equivalent to dst = (mp1 ^ exp) mod mod.
558 void silc_mp_pow_mod(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *exp,
561 /****f* silcmath/SilcMPAPI/silc_mp_pow_mod_ui
565 * void silc_mp_pow_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp,
570 * Compute (`mp1' ** `exp') mod `mod' and save the result to `dst'.
571 * This is equivalent to dst = (mp1 ^ exp) mod mod.
574 void silc_mp_pow_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp,
577 /****f* silcmath/SilcMPAPI/silc_mp_modinv
581 * void silc_mp_modinv(SilcMPInt *inv, SilcMPInt *a, SilcMPInt *n);
585 * Find multiplicative inverse using Euclid's extended algorithm.
586 * Computes inverse such that a * inv mod n = 1, where 0 < a < n.
587 * Algorithm goes like this:
593 * g(i+1) = g(i-1) - y * g(i) = g(i)-1 mod g(i)
594 * v(i+1) = v(i-1) - y * v(i)
596 * do until g(i) = 0, then inverse = v(i-1). If inverse is negative then n,
597 * is added to inverse making it positive again. (Sometimes the algorithm
598 * has a variable u defined too and it behaves just like v, except that
599 * initalize values are swapped (i.e. u(0) = 1, u(1) = 0). However, u is
600 * not needed by the algorithm so it does not have to be included.)
603 void silc_mp_modinv(SilcMPInt *inv, SilcMPInt *a, SilcMPInt *n);
605 /****f* silcmath/SilcMPAPI/silc_mp_mp2bin
609 * unsigned char *silc_mp_mp2bin(SilcMPInt *val, uint32 len,
614 * Encodes MP integer into binary data. Returns allocated data that
615 * must be free'd by the caller. If `len' is provided the destination
616 * buffer is allocated that large. If zero then the size is approximated.
619 unsigned char *silc_mp_mp2bin(SilcMPInt *val, uint32 len, uint32 *ret_len);
621 /****f* silcmath/SilcMPAPI/silc_mp_mp2bin_noalloc
625 * void silc_mp_mp2bin_noalloc(SilcMPInt val, unsigned char *dst,
630 * Same as silc_mp_mp2bin but does not allocate any memory. The
631 * encoded data is returned into `dst' and it's length to the `ret_len'.
634 void silc_mp_mp2bin_noalloc(SilcMPInt val, unsigned char *dst,
637 /****f* silcmath/SilcMPAPI/silc_mp_bin2mp
641 * void silc_mp_bin2mp(unsigned char *data, uint32 len, SilcMPInt *ret);
645 * Decodes binary data into MP integer. The integer sent as argument
646 * must be initialized.
649 void silc_mp_bin2mp(unsigned char *data, uint32 len, SilcMPInt *ret);
651 /****f* silcmath/SilcMPAPI/silc_mp_set
655 * void silc_mp_set(SilcMPInt *dst, SilcMPInt *src);
659 * Set `dst' integer from `src' integer.
662 void silc_mp_set(SilcMPInt *dst, SilcMPInt *src);
664 void silc_mp_set_ui(SilcMPInt *dst, uint32 ui);
665 void silc_mp_set_ui64(SilcMPInt *dst, uint64 ui);
666 void silc_mp_set_si(SilcMPInt *dst, uint32 ui);
667 void silc_mp_set_si64(SilcMPInt *dst, uint64 ui);
668 void silc_mp_set_str(SilcMPInt *dst, const char *str, int base);
669 size_t silc_mp_size(SilcMPInt *mp);
670 size_t silc_mp_sizeinbase(SilcMPInt *mp, int base);
671 void silc_mp_sqrt(SilcMPInt *dst, SilcMPInt *src);
672 void silc_mp_sub(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2);
673 void silc_mp_sub_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);