comparison bignum.c @ 150:82fcf3185616

Cleaning out various dead wood found with -dead_strip bignum.c: mptobytes now resides in dss.c loginrec.c: remove lastlog code since it isn't used. dbutil.c: removed obselete usingsyslog variable channel.h: client channel type only defined for client compile common-algo.c: s/rijndael/aes/
author Matt Johnston <matt@ucc.asn.au>
date Mon, 20 Dec 2004 14:24:57 +0000
parents fe6bca95afa7
children c9483550701b
comparison
equal deleted inserted replaced
149:ed9ca2a9705c 150:82fcf3185616
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 /* convert an unsigned mp into an array of bytes, malloced.
56 * This array must be freed after use, len contains the length of the array,
57 * if len != NULL */
58 unsigned char* mptobytes(mp_int *mp, int *len) {
59
60 unsigned char* ret;
61 int size;
62
63 size = mp_unsigned_bin_size(mp);
64 ret = m_malloc(size);
65 if (mp_to_unsigned_bin(mp, ret) != MP_OKAY) {
66 dropbear_exit("mem alloc error");
67 }
68 if (len != NULL) {
69 *len = size;
70 }
71 return ret;
72 }
73
74 void bytestomp(mp_int *mp, unsigned char* bytes, unsigned int len) { 55 void bytestomp(mp_int *mp, unsigned char* bytes, unsigned int len) {
75 56
76 if (mp_read_unsigned_bin(mp, bytes, len) != MP_OKAY) { 57 if (mp_read_unsigned_bin(mp, bytes, len) != MP_OKAY) {
77 dropbear_exit("mem alloc error"); 58 dropbear_exit("mem alloc error");
78 } 59 }