version 1.2, 1999/09/28 04:45:36 |
version 1.4, 1999/11/12 17:28:35 |
|
|
|
|
/* Get the value of in binary */ |
/* Get the value of in binary */ |
oi = BN_bn2bin(value, buf); |
oi = BN_bn2bin(value, buf); |
assert(oi == bin_size); |
if (oi != bin_size) |
|
fatal("buffer_put_bignum: BN_bn2bin() failed: oi %d != bin_size %d", |
|
oi, bin_size); |
|
|
/* Store the number of bits in the buffer in two bytes, msb first. */ |
/* Store the number of bits in the buffer in two bytes, msb first. */ |
PUT_16BIT(msg, bits); |
PUT_16BIT(msg, bits); |
|
|
bits = GET_16BIT(buf); |
bits = GET_16BIT(buf); |
/* Compute the number of binary bytes that follow. */ |
/* Compute the number of binary bytes that follow. */ |
bytes = (bits + 7) / 8; |
bytes = (bits + 7) / 8; |
bin = xmalloc(bytes); |
if (buffer_len(buffer) < bytes) |
buffer_get(buffer, bin, bytes); |
fatal("buffer_get_bignum: input buffer too small"); |
|
bin = buffer_ptr(buffer); |
BN_bin2bn(bin, bytes, value); |
BN_bin2bn(bin, bytes, value); |
xfree(bin); |
buffer_consume(buffer, bytes); |
|
|
return 2 + bytes; |
return 2 + bytes; |
} |
} |