65 static const char Hex[]=
"0123456789ABCDEF";
81 if (a->
neg) *(p++)=
'-';
83 for (i=a->
top-1; i >=0; i--)
85 for (j=BN_BITS2-8; j >= 0; j-=8)
88 v=((int)(a->
d[i]>>(
long)j))&0xff;
109 BN_ULONG *bn_data=NULL,*lp;
117 num=(i/10+i/1000+1)+1;
120 if ((buf == NULL) || (bn_data == NULL))
125 if ((t=
BN_dup(a)) == NULL)
goto err;
127 #define BUF_REMAIN (num+3 - (size_t)(p - buf))
152 while (lp != bn_data)
176 int neg=0,
h,m,i,j,
k,
c;
179 if ((a == NULL) || (*a ==
'\0'))
return(0);
181 if (*a ==
'-') { neg=1; a++; }
183 for (i=0; isxdigit((
unsigned char) a[i]); i++)
187 if (bn == NULL)
return(num);
192 if ((ret=
BN_new()) == NULL)
return(0);
201 if (
bn_expand(ret,i*4) == NULL)
goto err;
208 m=((BN_BYTES*2) <= j)?(BN_BYTES*2):j;
213 if ((c >=
'0') && (c <=
'9')) k=c-
'0';
214 else if ((c >=
'a') && (c <=
'f')) k=c-
'a'+10;
215 else if ((c >=
'A') && (c <=
'F')) k=c-
'A'+10;
246 if ((a == NULL) || (*a ==
'\0'))
return(0);
247 if (*a ==
'-') { neg=1; a++; }
249 for (i=0; isdigit((
unsigned char) a[i]); i++)
253 if (bn == NULL)
return(num);
259 if ((ret=
BN_new()) == NULL)
return(0);
268 if (
bn_expand(ret,i*4) == NULL)
goto err;
270 j=BN_DEC_NUM-(i%BN_DEC_NUM);
271 if (j == BN_DEC_NUM) j=0;
278 if (++j == BN_DEC_NUM)
303 if (p[0] ==
'0' && (p[1] ==
'X' || p[1] ==
'x'))
318 #ifndef OPENSSL_NO_BIO
319 #ifndef OPENSSL_NO_FP_API
341 for (i=a->
top-1; i >=0; i--)
343 for (j=BN_BITS2-4; j >= 0; j-=4)
346 v=((int)(a->
d[i]>>(
long)j))&0x0f;
364 static char data[16];
371 (
int)
sizeof(BN_ULLONG)*8,(
int)
sizeof(BN_ULONG)*8);
374 (
int)
sizeof(BN_ULONG)*8,(
int)
sizeof(BN_ULONG)*8);