summaryrefslogtreecommitdiff
path: root/src/crypto
diff options
context:
space:
mode:
authorRobert Sloan <varomodt@google.com>2017-10-05 12:50:08 -0700
committerRobert Sloan <varomodt@google.com>2017-10-05 15:14:20 -0700
commitae1abf960be4d4a40ea2699f1373506023d4e207 (patch)
tree9c5cc61d9912303d762abd978afae2bc91eb295e /src/crypto
parentc9df3a1ff1d0cddebf2fc32ad8a03a429c0e834c (diff)
downloadboringssl-ae1abf960be4d4a40ea2699f1373506023d4e207.tar.gz
external/boringssl: Sync to 392cedd0a28f15b693c81c8b877ee3d74c122d42.
... b/c OPENSSL_VERSION_NUMBER was messed up in the previous sync. This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/575334657fcb66a4861c9d125430b2aef60476a6..392cedd0a28f15b693c81c8b877ee3d74c122d42 Test: BoringSSL CTS Presubmits. Change-Id: I7fedea67d6bb3e50aeebaf2d7183ea69dfc7b79f
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/CMakeLists.txt2
-rw-r--r--src/crypto/bio/bio_test.cc4
-rw-r--r--src/crypto/bio/printf.c4
-rw-r--r--src/crypto/dh/dh.c2
-rw-r--r--src/crypto/err/err.c38
-rw-r--r--src/crypto/fipsmodule/sha/sha1.c8
-rw-r--r--src/crypto/lhash/lhash_test.cc4
-rw-r--r--src/crypto/mem.c4
-rw-r--r--src/crypto/x509/x_name.c2
9 files changed, 19 insertions, 49 deletions
diff --git a/src/crypto/CMakeLists.txt b/src/crypto/CMakeLists.txt
index 8541bbb7..1cd84589 100644
--- a/src/crypto/CMakeLists.txt
+++ b/src/crypto/CMakeLists.txt
@@ -40,7 +40,7 @@ if(NOT OPENSSL_NO_ASM)
# CMake does not add -isysroot and -arch flags to assembly.
if (APPLE)
if (CMAKE_OSX_SYSROOT)
- set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -isysroot ${CMAKE_OSX_SYSROOT}")
+ set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -isysroot \"${CMAKE_OSX_SYSROOT}\"")
endif()
foreach(arch ${CMAKE_OSX_ARCHITECTURES})
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -arch ${arch}")
diff --git a/src/crypto/bio/bio_test.cc b/src/crypto/bio/bio_test.cc
index 3d78635e..eb54f7e1 100644
--- a/src/crypto/bio/bio_test.cc
+++ b/src/crypto/bio/bio_test.cc
@@ -12,10 +12,6 @@
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
-#if !defined(_POSIX_C_SOURCE)
-#define _POSIX_C_SOURCE 201410L
-#endif
-
#include <algorithm>
#include <string>
diff --git a/src/crypto/bio/printf.c b/src/crypto/bio/printf.c
index 28162e6d..4f9d8a18 100644
--- a/src/crypto/bio/printf.c
+++ b/src/crypto/bio/printf.c
@@ -54,10 +54,6 @@
* copied and put under another distribution licence
* [including the GNU Public Licence.] */
-#if !defined(_POSIX_C_SOURCE)
-#define _POSIX_C_SOURCE 201410L // for snprintf, vprintf etc
-#endif
-
#include <openssl/bio.h>
#include <assert.h>
diff --git a/src/crypto/dh/dh.c b/src/crypto/dh/dh.c
index 04e245e8..7b7b8335 100644
--- a/src/crypto/dh/dh.c
+++ b/src/crypto/dh/dh.c
@@ -167,7 +167,7 @@ int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g) {
dh->q = q;
}
- if (g == NULL) {
+ if (g != NULL) {
BN_free(dh->g);
dh->g = g;
}
diff --git a/src/crypto/err/err.c b/src/crypto/err/err.c
index 2c567cec..a620fc7e 100644
--- a/src/crypto/err/err.c
+++ b/src/crypto/err/err.c
@@ -129,18 +129,9 @@ extern const uint32_t kOpenSSLReasonValues[];
extern const size_t kOpenSSLReasonValuesLen;
extern const char kOpenSSLReasonStringData[];
-// err_clear_data frees the optional |data| member of the given error.
-static void err_clear_data(struct err_error_st *error) {
- if ((error->flags & ERR_FLAG_MALLOCED) != 0) {
- OPENSSL_free(error->data);
- }
- error->data = NULL;
- error->flags &= ~ERR_FLAG_MALLOCED;
-}
-
// err_clear clears the given queued error.
static void err_clear(struct err_error_st *error) {
- err_clear_data(error);
+ OPENSSL_free(error->data);
OPENSSL_memset(error, 0, sizeof(struct err_error_st));
}
@@ -227,7 +218,7 @@ static uint32_t get_error_values(int inc, int top, const char **file, int *line,
} else {
*data = error->data;
if (flags != NULL) {
- *flags = error->flags & ERR_FLAG_PUBLIC_MASK;
+ *flags = ERR_FLAG_STRING;
}
// If this error is being removed, take ownership of data from
// the error. The semantics are such that the caller doesn't
@@ -235,12 +226,11 @@ static uint32_t get_error_values(int inc, int top, const char **file, int *line,
// ownership and retains it until the next call that affects the
// error queue.
if (inc) {
- if (error->flags & ERR_FLAG_MALLOCED) {
+ if (error->data != NULL) {
OPENSSL_free(state->to_free);
state->to_free = error->data;
}
error->data = NULL;
- error->flags = 0;
}
}
}
@@ -585,24 +575,20 @@ void ERR_print_errors_fp(FILE *file) {
ERR_print_errors_cb(print_errors_to_file, file);
}
-// err_set_error_data sets the data on the most recent error. The |flags|
-// argument is a combination of the |ERR_FLAG_*| values.
-static void err_set_error_data(char *data, int flags) {
+// err_set_error_data sets the data on the most recent error.
+static void err_set_error_data(char *data) {
ERR_STATE *const state = err_get_state();
struct err_error_st *error;
if (state == NULL || state->top == state->bottom) {
- if (flags & ERR_FLAG_MALLOCED) {
- OPENSSL_free(data);
- }
+ OPENSSL_free(data);
return;
}
error = &state->errors[state->top];
- err_clear_data(error);
+ OPENSSL_free(error->data);
error->data = data;
- error->flags = flags;
}
void ERR_put_error(int library, int unused, int reason, const char *file,
@@ -680,7 +666,7 @@ static void err_add_error_vdata(unsigned num, va_list args) {
}
buf[len] = 0;
- err_set_error_data(buf, ERR_FLAG_MALLOCED | ERR_FLAG_STRING);
+ err_set_error_data(buf);
}
void ERR_add_error_data(unsigned count, ...) {
@@ -708,7 +694,7 @@ void ERR_add_error_dataf(const char *format, ...) {
buf[buf_len] = 0;
va_end(ap);
- err_set_error_data(buf, ERR_FLAG_MALLOCED | ERR_FLAG_STRING);
+ err_set_error_data(buf);
}
int ERR_set_mark(void) {
@@ -717,7 +703,7 @@ int ERR_set_mark(void) {
if (state == NULL || state->bottom == state->top) {
return 0;
}
- state->errors[state->top].flags |= ERR_FLAG_MARK;
+ state->errors[state->top].mark = 1;
return 1;
}
@@ -731,8 +717,8 @@ int ERR_pop_to_mark(void) {
while (state->bottom != state->top) {
struct err_error_st *error = &state->errors[state->top];
- if ((error->flags & ERR_FLAG_MARK) != 0) {
- error->flags &= ~ERR_FLAG_MARK;
+ if (error->mark) {
+ error->mark = 0;
return 1;
}
diff --git a/src/crypto/fipsmodule/sha/sha1.c b/src/crypto/fipsmodule/sha/sha1.c
index 7ce01938..e5b4ba62 100644
--- a/src/crypto/fipsmodule/sha/sha1.c
+++ b/src/crypto/fipsmodule/sha/sha1.c
@@ -63,10 +63,10 @@
#include "../../internal.h"
-#if !defined(OPENSSL_NO_ASM) && \
- (defined(OPENSSL_X86) || defined(OPENSSL_X86_64) || \
- defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64) || \
- defined(OPENSSL_PPC64LE))
+#if (!defined(OPENSSL_NO_ASM) && \
+ (defined(OPENSSL_X86) || defined(OPENSSL_X86_64) || \
+ defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64))) || \
+ defined(OPENSSL_PPC64LE)
#define SHA1_ASM
#endif
diff --git a/src/crypto/lhash/lhash_test.cc b/src/crypto/lhash/lhash_test.cc
index cc146e87..0859eeb6 100644
--- a/src/crypto/lhash/lhash_test.cc
+++ b/src/crypto/lhash/lhash_test.cc
@@ -12,10 +12,6 @@
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
-#if !defined(_POSIX_C_SOURCE)
-#define _POSIX_C_SOURCE 201410L
-#endif
-
#include <openssl/lhash.h>
#include <stdio.h>
diff --git a/src/crypto/mem.c b/src/crypto/mem.c
index 09f3159a..67f74b79 100644
--- a/src/crypto/mem.c
+++ b/src/crypto/mem.c
@@ -54,10 +54,6 @@
* copied and put under another distribution licence
* [including the GNU Public Licence.] */
-#if !defined(_POSIX_C_SOURCE)
-#define _POSIX_C_SOURCE 201410L // needed for strdup, snprintf, vprintf etc
-#endif
-
#include <openssl/mem.h>
#include <assert.h>
diff --git a/src/crypto/x509/x_name.c b/src/crypto/x509/x_name.c
index 0980463e..f132e6b6 100644
--- a/src/crypto/x509/x_name.c
+++ b/src/crypto/x509/x_name.c
@@ -244,7 +244,7 @@ static int x509_name_ex_d2i(ASN1_VALUE **val,
entry->set = i;
if (!sk_X509_NAME_ENTRY_push(nm.x->entries, entry))
goto err;
- sk_X509_NAME_ENTRY_set(entries, j, NULL);
+ (void)sk_X509_NAME_ENTRY_set(entries, j, NULL);
}
}
ret = x509_name_canon(nm.x);