summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_init_size.c
diff options
context:
space:
mode:
Diffstat (limited to 'libtommath/bn_mp_init_size.c')
-rw-r--r--libtommath/bn_mp_init_size.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/libtommath/bn_mp_init_size.c b/libtommath/bn_mp_init_size.c
index 4446773..623a03f 100644
--- a/libtommath/bn_mp_init_size.c
+++ b/libtommath/bn_mp_init_size.c
@@ -16,30 +16,30 @@
*/
/* init an mp_init for a given size */
-int mp_init_size (mp_int * a, int size)
+int mp_init_size(mp_int *a, int size)
{
- int x;
+ int x;
- /* pad size so there are always extra digits */
- size += (MP_PREC * 2) - (size % MP_PREC);
-
- /* alloc mem */
- a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * size);
- if (a->dp == NULL) {
- return MP_MEM;
- }
+ /* pad size so there are always extra digits */
+ size += (MP_PREC * 2) - (size % MP_PREC);
- /* set the members */
- a->used = 0;
- a->alloc = size;
- a->sign = MP_ZPOS;
+ /* alloc mem */
+ a->dp = OPT_CAST(mp_digit) XMALLOC(sizeof(mp_digit) * size);
+ if (a->dp == NULL) {
+ return MP_MEM;
+ }
- /* zero the digits */
- for (x = 0; x < size; x++) {
+ /* set the members */
+ a->used = 0;
+ a->alloc = size;
+ a->sign = MP_ZPOS;
+
+ /* zero the digits */
+ for (x = 0; x < size; x++) {
a->dp[x] = 0;
- }
+ }
- return MP_OKAY;
+ return MP_OKAY;
}
#endif