ARM assembly pack: make it work with older toolchain.
[openssl.git] / crypto / bn / bn_print.c
index 055d048856cd3801e50d562e15b883d69676732a..1743b6a7e212f19bcc94f0816c71493b1270961f 100644 (file)
@@ -62,7 +62,7 @@
 #include <openssl/buffer.h>
 #include "bn_lcl.h"
 
-static const char *Hex="0123456789ABCDEF";
+static const char Hex[]="0123456789ABCDEF";
 
 /* Must 'OPENSSL_free' the returned data */
 char *BN_bn2hex(const BIGNUM *a)
@@ -294,6 +294,27 @@ err:
        return(0);
        }
 
+int BN_asc2bn(BIGNUM **bn, const char *a)
+       {
+       const char *p = a;
+       if (*p == '-')
+               p++;
+
+       if (p[0] == '0' && (p[1] == 'X' || p[1] == 'x'))
+               {               
+               if (!BN_hex2bn(bn, p + 2))
+                       return 0;
+               }
+       else
+               {
+               if (!BN_dec2bn(bn, p))
+                       return 0;
+               }
+       if (*a == '-')
+               (*bn)->neg = 1;
+       return 1;
+       }
+
 #ifndef OPENSSL_NO_BIO
 #ifndef OPENSSL_NO_FP_API
 int BN_print_fp(FILE *fp, const BIGNUM *a)
@@ -336,3 +357,22 @@ end:
        return(ret);
        }
 #endif
+
+char *BN_options(void)
+       {
+       static int init=0;
+       static char data[16];
+
+       if (!init)
+               {
+               init++;
+#ifdef BN_LLONG
+               BIO_snprintf(data,sizeof data,"bn(%d,%d)",
+                            (int)sizeof(BN_ULLONG)*8,(int)sizeof(BN_ULONG)*8);
+#else
+               BIO_snprintf(data,sizeof data,"bn(%d,%d)",
+                            (int)sizeof(BN_ULONG)*8,(int)sizeof(BN_ULONG)*8);
+#endif
+               }
+       return(data);
+       }