Latest update.
This commit is contained in:
+7
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2019 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
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
double align;
|
||||
OSSL_UNION_ALIGN;
|
||||
DES_key_schedule ks[3];
|
||||
} ks;
|
||||
union {
|
||||
@@ -280,15 +280,17 @@ static int des3_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
|
||||
{
|
||||
|
||||
DES_cblock *deskey = ptr;
|
||||
int kl;
|
||||
|
||||
switch (type) {
|
||||
case EVP_CTRL_RAND_KEY:
|
||||
if (RAND_priv_bytes(ptr, EVP_CIPHER_CTX_key_length(ctx)) <= 0)
|
||||
kl = EVP_CIPHER_CTX_key_length(ctx);
|
||||
if (kl < 0 || RAND_priv_bytes(ptr, kl) <= 0)
|
||||
return 0;
|
||||
DES_set_odd_parity(deskey);
|
||||
if (EVP_CIPHER_CTX_key_length(ctx) >= 16)
|
||||
if (kl >= 16)
|
||||
DES_set_odd_parity(deskey + 1);
|
||||
if (EVP_CIPHER_CTX_key_length(ctx) >= 24)
|
||||
if (kl >= 24)
|
||||
DES_set_odd_parity(deskey + 2);
|
||||
return 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user