comparison bignum.c @ 1250:2bb4c662d1c2

more hard tab
author Francois Perrad <francois.perrad@gadz.org>
date Fri, 01 Jan 2016 15:02:09 +0100
parents 7540c0822374
children c98e242dc505
comparison
equal deleted inserted replaced
1249:c6346c63281b 1250:2bb4c662d1c2
37 37
38 /* simplified duplication of bn_mp_multi's mp_init_multi, but die fatally 38 /* simplified duplication of bn_mp_multi's mp_init_multi, but die fatally
39 * on error */ 39 * on error */
40 void m_mp_init_multi(mp_int *mp, ...) 40 void m_mp_init_multi(mp_int *mp, ...)
41 { 41 {
42 mp_int* cur_arg = mp; 42 mp_int* cur_arg = mp;
43 va_list args; 43 va_list args;
44 44
45 va_start(args, mp); /* init args to next argument from caller */ 45 va_start(args, mp); /* init args to next argument from caller */
46 while (cur_arg != NULL) { 46 while (cur_arg != NULL) {
47 if (mp_init(cur_arg) != MP_OKAY) { 47 if (mp_init(cur_arg) != MP_OKAY) {
48 dropbear_exit("Mem alloc error"); 48 dropbear_exit("Mem alloc error");
49 } 49 }
50 cur_arg = va_arg(args, mp_int*); 50 cur_arg = va_arg(args, mp_int*);
51 } 51 }
52 va_end(args); 52 va_end(args);
53 } 53 }
54 54
55 void m_mp_alloc_init_multi(mp_int **mp, ...) 55 void m_mp_alloc_init_multi(mp_int **mp, ...)
56 { 56 {
57 mp_int** cur_arg = mp; 57 mp_int** cur_arg = mp;
58 va_list args; 58 va_list args;
59 59
60 va_start(args, mp); /* init args to next argument from caller */ 60 va_start(args, mp); /* init args to next argument from caller */
61 while (cur_arg != NULL) { 61 while (cur_arg != NULL) {
62 *cur_arg = m_malloc(sizeof(mp_int)); 62 *cur_arg = m_malloc(sizeof(mp_int));
63 if (mp_init(*cur_arg) != MP_OKAY) { 63 if (mp_init(*cur_arg) != MP_OKAY) {
64 dropbear_exit("Mem alloc error"); 64 dropbear_exit("Mem alloc error");
65 } 65 }
66 cur_arg = va_arg(args, mp_int**); 66 cur_arg = va_arg(args, mp_int**);
67 } 67 }
68 va_end(args); 68 va_end(args);
69 } 69 }
70 70
71 void bytes_to_mp(mp_int *mp, const unsigned char* bytes, unsigned int len) { 71 void bytes_to_mp(mp_int *mp, const unsigned char* bytes, unsigned int len) {
72 72
73 if (mp_read_unsigned_bin(mp, (unsigned char*)bytes, len) != MP_OKAY) { 73 if (mp_read_unsigned_bin(mp, (unsigned char*)bytes, len) != MP_OKAY) {