123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #include <tommath.h>
- #ifdef BN_MP_GROW_C
- int mp_grow (mp_int * a, int size)
- {
- int i;
- mp_digit *tmp;
-
- if (a->alloc < size) {
-
- size += (MP_PREC * 2) - (size % MP_PREC);
-
- tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * size);
- if (tmp == NULL) {
-
- return MP_MEM;
- }
-
- a->dp = tmp;
-
- i = a->alloc;
- a->alloc = size;
- for (; i < a->alloc; i++) {
- a->dp[i] = 0;
- }
- }
- return MP_OKAY;
- }
- #endif
|