Remove DES_check_key global
authorRich Salz <rsalz@akamai.com>
Mon, 1 Jul 2019 18:41:19 +0000 (14:41 -0400)
committerRich Salz <rsalz@akamai.com>
Mon, 1 Jul 2019 23:42:12 +0000 (19:42 -0400)
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9284)

CHANGES
crypto/des/set_key.c
doc/man3/DES_random_key.pod
include/openssl/des.h
util/libcrypto.num
util/missingcrypto.txt

diff --git a/CHANGES b/CHANGES
index f23e9b2febf5b911b5acf8d203a01ca5467794ef..accaee53fa988418aa66b865e35ccf98d30462b6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
   *) Removed NextStep support and the macro OPENSSL_UNISTD
      [Rich Salz]
 
   *) Removed NextStep support and the macro OPENSSL_UNISTD
      [Rich Salz]
 
+  *) Removed DES_check_key.  Also removed OPENSSL_IMPLEMENT_GLOBAL,
+     OPENSSL_GLOBAL_REF, OPENSSL_DECLARE_GLOBAL.
+     [Rich Salz]
+
   *) RC5_32_set_key has been changed to return an int type, with 0 indicating
      an error and 1 indicating success. In previous versions of OpenSSL this
      was a void type. If a key was set longer than the maximum possible this
   *) RC5_32_set_key has been changed to return an int type, with 0 indicating
      an error and 1 indicating success. In previous versions of OpenSSL this
      was a void type. If a key was set longer than the maximum possible this
index 4726bb224d5ee97d4efe3aa6f6cf5f7563ad3518..d42cebdadc6f1b6d0d227257655dcf8d16ff5e19 100644 (file)
@@ -18,9 +18,6 @@
 #include <openssl/crypto.h>
 #include "des_locl.h"
 
 #include <openssl/crypto.h>
 #include "des_locl.h"
 
-/* defaults to false */
-OPENSSL_IMPLEMENT_GLOBAL(int, DES_check_key, 0)
-
 static const unsigned char odd_parity[256] = {
     1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14,
     16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31,
 static const unsigned char odd_parity[256] = {
     1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14,
     16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31,
@@ -277,12 +274,7 @@ static const DES_LONG des_skb[8][64] = {
 
 int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule)
 {
 
 int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule)
 {
-    if (DES_check_key) {
-        return DES_set_key_checked(key, schedule);
-    } else {
-        DES_set_key_unchecked(key, schedule);
-        return 0;
-    }
+    return DES_set_key_checked(key, schedule);
 }
 
 /*-
 }
 
 /*-
index a1480004e529a6ffe43d678c05d03bd9d79b8507..1506923dcc6dbf13c345eabd379405ddb70ef18f 100644 (file)
@@ -119,11 +119,8 @@ and is not a weak or semi-weak key.  If the parity is wrong, then -1
 is returned.  If the key is a weak key, then -2 is returned.  If an
 error is returned, the key schedule is not generated.
 
 is returned.  If the key is a weak key, then -2 is returned.  If an
 error is returned, the key schedule is not generated.
 
-DES_set_key() works like
-DES_set_key_checked() if the I<DES_check_key> flag is non-zero,
-otherwise like DES_set_key_unchecked().  These functions are available
-for compatibility; it is recommended to use a function that does not
-depend on a global variable.
+DES_set_key() works like DES_set_key_checked() and remains for
+backward compatibility.
 
 DES_set_odd_parity() sets the parity of the passed I<key> to odd.
 
 
 DES_set_odd_parity() sets the parity of the passed I<key> to odd.
 
index a0f5f3ce8d93734d95a75d73741b7f57addff4c3..f74412ba1658bfdc4b1a9048d273d543798a0004 100644 (file)
@@ -63,9 +63,6 @@ typedef struct DES_ks {
 # define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
         DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
 
 # define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
         DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
 
-OPENSSL_DECLARE_GLOBAL(int, DES_check_key); /* defaults to false */
-# define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key)
-
 const char *DES_options(void);
 void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
                       DES_key_schedule *ks1, DES_key_schedule *ks2,
 const char *DES_options(void);
 void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
                       DES_key_schedule *ks1, DES_key_schedule *ks2,
@@ -148,8 +145,7 @@ int DES_check_key_parity(const_DES_cblock *key);
 int DES_is_weak_key(const_DES_cblock *key);
 /*
  * DES_set_key (= set_key = DES_key_sched = key_sched) calls
 int DES_is_weak_key(const_DES_cblock *key);
 /*
  * DES_set_key (= set_key = DES_key_sched = key_sched) calls
- * DES_set_key_checked if global variable DES_check_key is set,
- * DES_set_key_unchecked otherwise.
+ * DES_set_key_unchecked
  */
 int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule);
 int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule);
  */
 int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule);
 int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule);
index 38ca30af6db4ab4a208230be16f6a74a28af5373..9d95dabaaa58c6429725d32268e6bfad70942fc9 100644 (file)
@@ -2052,8 +2052,8 @@ ENGINE_unregister_RSA                   2033      3_0_0   EXIST::FUNCTION:ENGINE
 EC_GROUP_order_bits                     2034   3_0_0   EXIST::FUNCTION:EC
 d2i_CMS_bio                             2035   3_0_0   EXIST::FUNCTION:CMS
 OPENSSL_sk_num                          2036   3_0_0   EXIST::FUNCTION:
 EC_GROUP_order_bits                     2034   3_0_0   EXIST::FUNCTION:EC
 d2i_CMS_bio                             2035   3_0_0   EXIST::FUNCTION:CMS
 OPENSSL_sk_num                          2036   3_0_0   EXIST::FUNCTION:
-_shadow_DES_check_key                   2037   3_0_0   EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:DES
-_shadow_DES_check_key                   2037   3_0_0   EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:DES
+_shadow_DES_check_key                   2037   3_0_0   NOEXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:DES
+_shadow_DES_check_key                   2037   3_0_0   NOEXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:DES
 CMS_RecipientInfo_set0_pkey             2038   3_0_0   EXIST::FUNCTION:CMS
 X509_STORE_CTX_set_default              2039   3_0_0   EXIST::FUNCTION:
 AES_wrap_key                            2040   3_0_0   EXIST::FUNCTION:
 CMS_RecipientInfo_set0_pkey             2038   3_0_0   EXIST::FUNCTION:CMS
 X509_STORE_CTX_set_default              2039   3_0_0   EXIST::FUNCTION:
 AES_wrap_key                            2040   3_0_0   EXIST::FUNCTION:
index a7cc467b7487a8f3ed1af0f3a255c6685e0b22b1..a227b1082af28552c242a66f03b0922f4e3f009f 100644 (file)
@@ -1441,7 +1441,6 @@ ZINT64_it
 ZLONG_it
 ZUINT32_it
 ZUINT64_it
 ZLONG_it
 ZUINT32_it
 ZUINT64_it
-_shadow_DES_check_key
 a2d_ASN1_OBJECT
 a2i_ASN1_ENUMERATED
 a2i_ASN1_INTEGER
 a2d_ASN1_OBJECT
 a2i_ASN1_ENUMERATED
 a2i_ASN1_INTEGER