Mercurial > dropbear
comparison buffer.c @ 241:c5d3ef11155f
* use own assertions which should get logged properly
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 05 Sep 2005 15:16:10 +0000 |
parents | 161557a9dde8 |
children | 0e38c039a9c8 c3f2ec71e3d4 76097ec1a29a |
comparison
equal
deleted
inserted
replaced
238:e923801a7678 | 241:c5d3ef11155f |
---|---|
151 | 151 |
152 /* Get a byte from the buffer and increment the pos */ | 152 /* Get a byte from the buffer and increment the pos */ |
153 unsigned char buf_getbyte(buffer* buf) { | 153 unsigned char buf_getbyte(buffer* buf) { |
154 | 154 |
155 /* This check is really just ==, but the >= allows us to check for the | 155 /* This check is really just ==, but the >= allows us to check for the |
156 * assert()able case of pos > len, which should _never_ happen. */ | 156 * bad case of pos > len, which should _never_ happen. */ |
157 if (buf->pos >= buf->len) { | 157 if (buf->pos >= buf->len) { |
158 dropbear_exit("bad buf_getbyte"); | 158 dropbear_exit("bad buf_getbyte"); |
159 } | 159 } |
160 return buf->data[buf->pos++]; | 160 return buf->data[buf->pos++]; |
161 } | 161 } |
268 void buf_putmpint(buffer* buf, mp_int * mp) { | 268 void buf_putmpint(buffer* buf, mp_int * mp) { |
269 | 269 |
270 unsigned int len, pad = 0; | 270 unsigned int len, pad = 0; |
271 TRACE(("enter buf_putmpint")) | 271 TRACE(("enter buf_putmpint")) |
272 | 272 |
273 assert(mp != NULL); | 273 dropbear_assert(mp != NULL); |
274 | 274 |
275 if (SIGN(mp) == MP_NEG) { | 275 if (SIGN(mp) == MP_NEG) { |
276 dropbear_exit("negative bignum"); | 276 dropbear_exit("negative bignum"); |
277 } | 277 } |
278 | 278 |