Skip to content

Commit b66a481

Browse files
committed
Remove DES_check_key global
Reviewed-by: Tim Hudson <[email protected]> Reviewed-by: Paul Dale <[email protected]> (Merged from openssl#9284)
1 parent 6b10d29 commit b66a481

File tree

6 files changed

+10
-22
lines changed

6 files changed

+10
-22
lines changed

CHANGES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
*) Removed NextStep support and the macro OPENSSL_UNISTD
1313
[Rich Salz]
1414

15+
*) Removed DES_check_key. Also removed OPENSSL_IMPLEMENT_GLOBAL,
16+
OPENSSL_GLOBAL_REF, OPENSSL_DECLARE_GLOBAL.
17+
[Rich Salz]
18+
1519
*) RC5_32_set_key has been changed to return an int type, with 0 indicating
1620
an error and 1 indicating success. In previous versions of OpenSSL this
1721
was a void type. If a key was set longer than the maximum possible this

crypto/des/set_key.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
#include <openssl/crypto.h>
1919
#include "des_locl.h"
2020

21-
/* defaults to false */
22-
OPENSSL_IMPLEMENT_GLOBAL(int, DES_check_key, 0)
23-
2421
static const unsigned char odd_parity[256] = {
2522
1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14,
2623
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] = {
277274

278275
int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule)
279276
{
280-
if (DES_check_key) {
281-
return DES_set_key_checked(key, schedule);
282-
} else {
283-
DES_set_key_unchecked(key, schedule);
284-
return 0;
285-
}
277+
return DES_set_key_checked(key, schedule);
286278
}
287279

288280
/*-

doc/man3/DES_random_key.pod

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,8 @@ and is not a weak or semi-weak key. If the parity is wrong, then -1
119119
is returned. If the key is a weak key, then -2 is returned. If an
120120
error is returned, the key schedule is not generated.
121121

122-
DES_set_key() works like
123-
DES_set_key_checked() if the I<DES_check_key> flag is non-zero,
124-
otherwise like DES_set_key_unchecked(). These functions are available
125-
for compatibility; it is recommended to use a function that does not
126-
depend on a global variable.
122+
DES_set_key() works like DES_set_key_checked() and remains for
123+
backward compatibility.
127124

128125
DES_set_odd_parity() sets the parity of the passed I<key> to odd.
129126

include/openssl/des.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ typedef struct DES_ks {
6363
# define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
6464
DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
6565

66-
OPENSSL_DECLARE_GLOBAL(int, DES_check_key); /* defaults to false */
67-
# define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key)
68-
6966
const char *DES_options(void);
7067
void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
7168
DES_key_schedule *ks1, DES_key_schedule *ks2,
@@ -148,8 +145,7 @@ int DES_check_key_parity(const_DES_cblock *key);
148145
int DES_is_weak_key(const_DES_cblock *key);
149146
/*
150147
* DES_set_key (= set_key = DES_key_sched = key_sched) calls
151-
* DES_set_key_checked if global variable DES_check_key is set,
152-
* DES_set_key_unchecked otherwise.
148+
* DES_set_key_unchecked
153149
*/
154150
int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule);
155151
int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule);

util/libcrypto.num

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,8 +2052,8 @@ ENGINE_unregister_RSA 2033 3_0_0 EXIST::FUNCTION:ENGINE
20522052
EC_GROUP_order_bits 2034 3_0_0 EXIST::FUNCTION:EC
20532053
d2i_CMS_bio 2035 3_0_0 EXIST::FUNCTION:CMS
20542054
OPENSSL_sk_num 2036 3_0_0 EXIST::FUNCTION:
2055-
_shadow_DES_check_key 2037 3_0_0 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:DES
2056-
_shadow_DES_check_key 2037 3_0_0 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:DES
2055+
_shadow_DES_check_key 2037 3_0_0 NOEXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:DES
2056+
_shadow_DES_check_key 2037 3_0_0 NOEXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:DES
20572057
CMS_RecipientInfo_set0_pkey 2038 3_0_0 EXIST::FUNCTION:CMS
20582058
X509_STORE_CTX_set_default 2039 3_0_0 EXIST::FUNCTION:
20592059
AES_wrap_key 2040 3_0_0 EXIST::FUNCTION:

util/missingcrypto.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,6 @@ ZINT64_it
14411441
ZLONG_it
14421442
ZUINT32_it
14431443
ZUINT64_it
1444-
_shadow_DES_check_key
14451444
a2d_ASN1_OBJECT
14461445
a2i_ASN1_ENUMERATED
14471446
a2i_ASN1_INTEGER

0 commit comments

Comments
 (0)