* Output buffer must be provided, bv_len must indicate buffer size
* Hex input can be "0x1234" or "'1234'H"
*
* Output buffer must be provided, bv_len must indicate buffer size
* Hex input can be "0x1234" or "'1234'H"
*
* Note: High bit of binary form is always the sign bit. If the number
* is supposed to be positive but has the high bit set, a zero byte
* is prepended. It is assumed that this has already been handled on
* Note: High bit of binary form is always the sign bit. If the number
* is supposed to be positive but has the high bit set, a zero byte
* is prepended. It is assumed that this has already been handled on
char *end;
int i, chunk, len, rc = 0, hex = 0;
if ( !out || !out->bv_val || out->bv_len < in->bv_len )
char *end;
int i, chunk, len, rc = 0, hex = 0;
if ( !out || !out->bv_val || out->bv_len < in->bv_len )
/* tmp must be at least as large as outbuf */
if ( out->bv_len > sizeof(tmpbuf)) {
tmp = ber_memalloc_x( out->bv_len, ctx );
/* tmp must be at least as large as outbuf */
if ( out->bv_len > sizeof(tmpbuf)) {
tmp = ber_memalloc_x( out->bv_len, ctx );