Remove OPENSSL_memcmp.
authorPauli <paul.dale@oracle.com>
Thu, 20 Jun 2019 23:27:48 +0000 (09:27 +1000)
committerPauli <paul.dale@oracle.com>
Fri, 21 Jun 2019 00:03:55 +0000 (10:03 +1000)
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)

Configurations/unix-Makefile.tmpl
crypto/ec/ec_curve.c
crypto/o_str.c
crypto/x509/v3_tlsf.c
include/internal/o_str.h [deleted file]
util/libcrypto.num
util/missingcrypto.txt

index ce93a4ed1c84a2cb5b783fa696a60ebbe4944bf8..52eeaa9a7623021b5a6b0401561cc8d9457c4d1e 100644 (file)
@@ -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,
index 6c7c9ddbc79e9731d88c755589b6b68f9edd69c6..1ea85946d6a6424f5cb00893c9b9a5b72523e1a7 100644 (file)
@@ -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;
         }
index 0403982004affc6576817173b1c6faed2a375946..467ceb2054e72a7c1968355b68869f5f449596f2 100644 (file)
 #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)
 {
index d3ab3f81ad988c58a4bf2b4aba374ab926d5cf92..28e83bb2aea277ca839728818a53dce2e6928964 100644 (file)
@@ -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 (file)
index dc236ca..0000000
+++ /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
index 0b181070eb498cf60f7f4266cae2efbabc49dd12..af6e2b96b465bf69027617e40ff79317e555305e 100644 (file)
@@ -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
index e68ddc883e1201737cda8d27f6f923c63d11e96c..30b1e2dda2e46b387747784773710a1c91ae1cbf 100644 (file)
@@ -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