Latest update.
This commit is contained in:
+51
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2020 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
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* DH low level APIs are deprecated for public use, but still ok for
|
||||
* Low level key APIs (DH etc) are deprecated for public use, but still ok for
|
||||
* internal use.
|
||||
*/
|
||||
#include "internal/deprecated.h"
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include "crypto/evp.h"
|
||||
#include "crypto/dh.h"
|
||||
#include "internal/ffc.h"
|
||||
#include "internal/numbers.h"
|
||||
#include "internal/provider.h"
|
||||
#include "evp_local.h"
|
||||
@@ -234,6 +236,7 @@ static EVP_PKEY_CTX *int_ctx_new(OPENSSL_CTX *libctx,
|
||||
|
||||
ret = OPENSSL_zalloc(sizeof(*ret));
|
||||
if (ret == NULL) {
|
||||
EVP_KEYMGMT_free(keymgmt);
|
||||
#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE)
|
||||
ENGINE_finish(e);
|
||||
#endif
|
||||
@@ -808,11 +811,34 @@ static int legacy_ctrl_to_param(EVP_PKEY_CTX *ctx, int keytype, int optype,
|
||||
*/
|
||||
if (cmd == EVP_PKEY_CTRL_CIPHER)
|
||||
return -2;
|
||||
|
||||
# ifndef OPENSSL_NO_DH
|
||||
if (keytype == EVP_PKEY_DH) {
|
||||
switch (cmd) {
|
||||
case EVP_PKEY_CTRL_DH_PAD:
|
||||
return EVP_PKEY_CTX_set_dh_pad(ctx, p1);
|
||||
case EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN:
|
||||
return EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, p1);
|
||||
case EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN:
|
||||
return EVP_PKEY_CTX_set_dh_paramgen_subprime_len(ctx, p1);
|
||||
case EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR:
|
||||
return EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, p1);
|
||||
case EVP_PKEY_CTRL_DH_PARAMGEN_TYPE:
|
||||
return EVP_PKEY_CTX_set_dh_paramgen_type(ctx, p1);
|
||||
case EVP_PKEY_CTRL_DH_RFC5114:
|
||||
return EVP_PKEY_CTX_set_dh_rfc5114(ctx, p1);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
if (keytype == EVP_PKEY_DSA) {
|
||||
switch (cmd) {
|
||||
case EVP_PKEY_CTRL_DSA_PARAMGEN_BITS:
|
||||
return EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, p1);
|
||||
case EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS:
|
||||
return EVP_PKEY_CTX_set_dsa_paramgen_q_bits(ctx, p1);
|
||||
case EVP_PKEY_CTRL_DSA_PARAMGEN_MD:
|
||||
return EVP_PKEY_CTX_set_dsa_paramgen_md(ctx, p2);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
@@ -1000,8 +1026,30 @@ static int legacy_ctrl_str_to_param(EVP_PKEY_CTX *ctx, const char *name,
|
||||
name = OSSL_PKEY_PARAM_RSA_E;
|
||||
else if (strcmp(name, "rsa_keygen_primes") == 0)
|
||||
name = OSSL_PKEY_PARAM_RSA_PRIMES;
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
else if (strcmp(name, "dsa_paramgen_bits") == 0)
|
||||
name = OSSL_PKEY_PARAM_FFC_PBITS;
|
||||
else if (strcmp(name, "dsa_paramgen_q_bits") == 0)
|
||||
name = OSSL_PKEY_PARAM_FFC_QBITS;
|
||||
else if (strcmp(name, "dsa_paramgen_md") == 0)
|
||||
name = OSSL_PKEY_PARAM_FFC_DIGEST;
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_DH
|
||||
else if (strcmp(name, "dh_pad") == 0)
|
||||
else if (strcmp(name, "dh_paramgen_generator") == 0)
|
||||
name = OSSL_PKEY_PARAM_FFC_GENERATOR;
|
||||
else if (strcmp(name, "dh_paramgen_prime_len") == 0)
|
||||
name = OSSL_PKEY_PARAM_FFC_PBITS;
|
||||
else if (strcmp(name, "dh_paramgen_subprime_len") == 0)
|
||||
name = OSSL_PKEY_PARAM_FFC_QBITS;
|
||||
else if (strcmp(name, "dh_paramgen_type") == 0) {
|
||||
name = OSSL_PKEY_PARAM_FFC_TYPE;
|
||||
value = dh_gen_type_id2name(atoi(value));
|
||||
} else if (strcmp(name, "dh_param") == 0)
|
||||
name = OSSL_PKEY_PARAM_FFC_GROUP;
|
||||
else if (strcmp(name, "dh_rfc5114") == 0) {
|
||||
name = OSSL_PKEY_PARAM_FFC_GROUP;
|
||||
value = ffc_named_group_from_uid(atoi(value));
|
||||
} else if (strcmp(name, "dh_pad") == 0)
|
||||
name = OSSL_EXCHANGE_PARAM_PAD;
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_EC
|
||||
|
||||
Reference in New Issue
Block a user