summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2019-06-21 09:27:48 +1000
committerPauli <paul.dale@oracle.com>2019-06-21 10:03:55 +1000
commit32ee452496f8cf4558d645f9db908b09df919f04 (patch)
tree0fa688bcaff971eb4124f6142c5e4ef08482c2bb
parent2d905f6715453034d1f942a0237b0d2b9d57326c (diff)
Remove OPENSSL_memcmp.
After avoiding OPENSSL_memcmp for EC curve comparison, there are no remaining uses in the source code. The function is only defined in an internal header and thus should be safe to remove for 3.0.0. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/9207)
-rw-r--r--Configurations/unix-Makefile.tmpl1
-rw-r--r--crypto/ec/ec_curve.c9
-rw-r--r--crypto/o_str.c12
-rw-r--r--crypto/x509/v3_tlsf.c1
-rw-r--r--include/internal/o_str.h17
-rw-r--r--util/libcrypto.num2
-rw-r--r--util/missingcrypto.txt1
7 files changed, 5 insertions, 38 deletions
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index ce93a4ed1c..52eeaa9a76 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -804,7 +804,6 @@ errors:
our @cryptoheaders =
qw( include/internal/dso.h
include/internal/o_dir.h
- include/internal/o_str.h
include/internal/err.h
include/internal/sslconf.h );
our @cryptoskipheaders = ( @sslheaders,
diff --git a/crypto/ec/ec_curve.c b/crypto/ec/ec_curve.c
index 6c7c9ddbc7..1ea85946d6 100644
--- a/crypto/ec/ec_curve.c
+++ b/crypto/ec/ec_curve.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2002-2019 The OpenSSL Project Authors. All Rights Reserved.
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
@@ -14,7 +14,6 @@
#include <openssl/obj_mac.h>
#include <openssl/opensslconf.h>
#include "internal/nelem.h"
-#include "internal/o_str.h"
typedef struct {
int field_type, /* either NID_X9_62_prime_field or
@@ -3302,10 +3301,10 @@ int ec_curve_nid_from_params(const EC_GROUP *group)
/* Check the optional seed (ignore if its not set) */
&& (data->seed_len == 0 || seed_len == 0
|| ((size_t)data->seed_len == seed_len
- && OPENSSL_memcmp(params_seed, seed, seed_len) == 0))
+ && memcmp(params_seed, seed, seed_len) == 0))
/* Check that the groups params match the built-in curve params */
- && OPENSSL_memcmp(param_bytes, params, param_len * NUM_BN_FIELDS)
- == 0) {
+ && memcmp(param_bytes, params, param_len * NUM_BN_FIELDS)
+ == 0) {
ret = curve.nid;
goto end;
}
diff --git a/crypto/o_str.c b/crypto/o_str.c
index 0403982004..467ceb2054 100644
--- a/crypto/o_str.c
+++ b/crypto/o_str.c
@@ -11,18 +11,6 @@
#include <limits.h>
#include <openssl/crypto.h>
#include "internal/cryptlib.h"
-#include "internal/o_str.h"
-
-int OPENSSL_memcmp(const void *v1, const void *v2, size_t n)
-{
- const unsigned char *c1 = v1, *c2 = v2;
- int ret = 0;
-
- while (n && (ret = *c1 - *c2) == 0)
- n--, c1++, c2++;
-
- return ret;
-}
char *CRYPTO_strdup(const char *str, const char* file, int line)
{
diff --git a/crypto/x509/v3_tlsf.c b/crypto/x509/v3_tlsf.c
index d3ab3f81ad..28e83bb2ae 100644
--- a/crypto/x509/v3_tlsf.c
+++ b/crypto/x509/v3_tlsf.c
@@ -10,7 +10,6 @@
#include "e_os.h"
#include "internal/cryptlib.h"
#include <stdio.h>
-#include "internal/o_str.h"
#include <openssl/asn1t.h>
#include <openssl/conf.h>
#include <openssl/x509v3.h>
diff --git a/include/internal/o_str.h b/include/internal/o_str.h
deleted file mode 100644
index dc236caa51..0000000000
--- a/include/internal/o_str.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright 2003-2016 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License"). You may not use
- * this file except in compliance with the License. You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_O_STR_H
-# define HEADER_O_STR_H
-
-# include <stddef.h> /* to get size_t */
-
-int OPENSSL_memcmp(const void *p1, const void *p2, size_t n);
-
-#endif
diff --git a/util/libcrypto.num b/util/libcrypto.num
index 0b181070eb..af6e2b96b4 100644
--- a/util/libcrypto.num
+++ b/util/libcrypto.num
@@ -462,7 +462,7 @@ X509v3_asid_add_id_or_range 462 3_0_0 EXIST::FUNCTION:RFC3779
X509_NAME_ENTRY_create_by_NID 463 3_0_0 EXIST::FUNCTION:
EC_KEY_METHOD_get_init 464 3_0_0 EXIST::FUNCTION:EC
ASN1_INTEGER_to_BN 465 3_0_0 EXIST::FUNCTION:
-OPENSSL_memcmp 466 3_0_0 EXIST::FUNCTION:
+OPENSSL_memcmp 466 3_0_0 NOEXIST::FUNCTION:
BUF_MEM_new 467 3_0_0 EXIST::FUNCTION:
DSO_set_filename 468 3_0_0 EXIST::FUNCTION:
DH_new 469 3_0_0 EXIST::FUNCTION:DH
diff --git a/util/missingcrypto.txt b/util/missingcrypto.txt
index e68ddc883e..30b1e2dda2 100644
--- a/util/missingcrypto.txt
+++ b/util/missingcrypto.txt
@@ -729,7 +729,6 @@ OPENSSL_gmtime_diff
OPENSSL_init
OPENSSL_isservice
OPENSSL_issetugid
-OPENSSL_memcmp
OPENSSL_sk_deep_copy
OPENSSL_sk_delete
OPENSSL_sk_delete_ptr