Sfoglia il codice sorgente

Require source files define __STDC_FORMAT_MACROS to use BN FMT macros.

inttypes.h kindly requires a feature macro in C++ on some platforms, due
to a bizarre footnote in C99 (see footnote 191 in section 7.8.1). As
bn.h is a public header, we must leak this wart to the consumer. On
platforms with unfriendly inttypes.h headers, using BN_DEC_FMT1 and
friends now require the feature macro be defined externally.

This broke the Chromium Android Clang builder:
http://build.chromium.org/p/chromium.linux/builders/Android%20Clang%20Builder%20%28dbg%29/builds/59288

Change-Id: I88275a6788c7babd0eae32cae86f115bfa93a591
Reviewed-on: https://boringssl-review.googlesource.com/4688
Reviewed-by: Adam Langley <agl@google.com>
kris/onging/CECPQ3_patch15
David Benjamin 9 anni fa
committed by Adam Langley
parent
commit
c561aa64b6
3 ha cambiato i file con 11 aggiunte e 8 eliminazioni
  1. +5
    -1
      crypto/bn/bn_test.cc
  2. +0
    -6
      crypto/bn/internal.h
  3. +6
    -1
      include/openssl/bn.h

+ 5
- 1
crypto/bn/bn_test.cc Vedi File

@@ -67,6 +67,11 @@
* Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems
* Laboratories. */

/* For BIGNUM format macros. */
#if !defined(__STDC_FORMAT_MACROS)
#define __STDC_FORMAT_MACROS
#endif

#include <stdio.h>
#include <string.h>

@@ -76,7 +81,6 @@
#include <openssl/mem.h>

#include "../crypto/test/scoped_types.h"
#include "internal.h"


static const int num0 = 100; // number of tests


+ 0
- 6
crypto/bn/internal.h Vedi File

@@ -125,12 +125,6 @@

#include <openssl/base.h>

/* Some versions of inttypes.h will not define print macros in C++ unless
* __STDC_FORMAT_MACROS is set. */
#if !defined(__STDC_FORMAT_MACROS)
#define __STDC_FORMAT_MACROS
#endif

#if defined(OPENSSL_X86_64) && defined(_MSC_VER) && _MSC_VER >= 1400
#pragma warning(push, 3)
#include <intrin.h>


+ 6
- 1
include/openssl/bn.h Vedi File

@@ -139,7 +139,12 @@ extern "C" {
* will allow you to work with numbers until you run out of memory. */


/* BN_ULONG is the native word size when working with big integers. */
/* BN_ULONG is the native word size when working with big integers.
*
* Note: on some platforms, inttypes.h does not define print format macros in
* C++ unless |__STDC_FORMAT_MACROS| defined. As this is a public header, bn.h
* does not define |__STDC_FORMAT_MACROS| itself. C++ source files which use the
* FMT macros must define it externally. */
#if defined(OPENSSL_64_BIT)
#define BN_ULONG uint64_t
#define BN_BITS2 64


Caricamento…
Annulla
Salva