From: Andy Polyakov Date: Fri, 7 Apr 2017 18:26:59 +0000 (+0200) Subject: bio/b_print.c: drop dependency on BN config. X-Git-Tag: OpenSSL_1_1_0f~83 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=00eae742694a87978e5e07593109f3cd895b4bc8;p=openssl bio/b_print.c: drop dependency on BN config. This might seem controversial, but it doesn't actually affect anything. Or rather it doesn't make worse cases when it was problematic [with code additions to 1.1.0]. One of such rare cases is 32-bit PA-RISC target with *vendor* compiler. Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/3148) --- diff --git a/crypto/bio/b_print.c b/crypto/bio/b_print.c index e91ab6de22..7bbc551c59 100644 --- a/crypto/bio/b_print.c +++ b/crypto/bio/b_print.c @@ -12,18 +12,8 @@ #include #include "internal/numbers.h" #include "internal/cryptlib.h" -#ifndef NO_SYS_TYPES_H -# include -#endif -#include /* To get BN_LLONG properly defined */ #include -#if defined(BN_LLONG) || defined(SIXTY_FOUR_BIT) -# ifndef HAVE_LONG_LONG -# define HAVE_LONG_LONG 1 -# endif -#endif - /* * Copyright Patrick Powell 1995 * This code is based on code written by Patrick Powell @@ -37,20 +27,10 @@ # define LDOUBLE double #endif -#ifdef HAVE_LONG_LONG -# if defined(_WIN32) && !defined(__GNUC__) -# define LLONG __int64 -# else -# define LLONG long long -# endif -#else -# define LLONG long -#endif - static int fmtstr(char **, char **, size_t *, size_t *, const char *, int, int, int); static int fmtint(char **, char **, size_t *, size_t *, - LLONG, int, int, int, int); + int64_t, int, int, int, int); static int fmtfp(char **, char **, size_t *, size_t *, LDOUBLE, int, int, int, int); static int doapr_outch(char **, char **, size_t *, size_t *, int); @@ -106,7 +86,7 @@ _dopr(char **sbuffer, size_t *retlen, int *truncated, const char *format, va_list args) { char ch; - LLONG value; + int64_t value; LDOUBLE fvalue; char *strvalue; int min; @@ -231,7 +211,7 @@ _dopr(char **sbuffer, value = va_arg(args, long int); break; case DP_C_LLONG: - value = va_arg(args, LLONG); + value = va_arg(args, int64_t); break; default: value = va_arg(args, int); @@ -253,13 +233,13 @@ _dopr(char **sbuffer, value = (unsigned short int)va_arg(args, unsigned int); break; case DP_C_LONG: - value = (LLONG) va_arg(args, unsigned long int); + value = va_arg(args, unsigned long int); break; case DP_C_LLONG: - value = va_arg(args, unsigned LLONG); + value = va_arg(args, uint64_t); break; default: - value = (LLONG) va_arg(args, unsigned int); + value = va_arg(args, unsigned int); break; } if (!fmtint(sbuffer, buffer, &currlen, maxlen, value, @@ -331,9 +311,9 @@ _dopr(char **sbuffer, num = va_arg(args, long int *); *num = (long int)currlen; } else if (cflags == DP_C_LLONG) { /* XXX */ - LLONG *num; - num = va_arg(args, LLONG *); - *num = (LLONG) currlen; + int64_t *num; + num = va_arg(args, int64_t *); + *num = (int64_t)currlen; } else { int *num; num = va_arg(args, int *); @@ -434,11 +414,11 @@ static int fmtint(char **sbuffer, char **buffer, size_t *currlen, - size_t *maxlen, LLONG value, int base, int min, int max, int flags) + size_t *maxlen, int64_t value, int base, int min, int max, int flags) { int signvalue = 0; const char *prefix = ""; - unsigned LLONG uvalue; + uint64_t uvalue; char convert[DECIMAL_SIZE(value) + 3]; int place = 0; int spadlen = 0; @@ -451,7 +431,7 @@ fmtint(char **sbuffer, if (!(flags & DP_F_UNSIGNED)) { if (value < 0) { signvalue = '-'; - uvalue = 0 - (unsigned LLONG)value; + uvalue = 0 - (uint64_t)value; } else if (flags & DP_F_PLUS) signvalue = '+'; else if (flags & DP_F_SPACE)