mirror of
https://github.com/QuasarApp/openssl.git
synced 2025-05-01 20:19:39 +00:00
speed: Use EVP for ciphers, cmac, ghash, rsa, dsa, and ecdsa
Fixes #13909 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14228)
This commit is contained in:
parent
a89cd8d87c
commit
f3ccfc76fe
@ -47,6 +47,13 @@ OpenSSL 3.0
|
|||||||
|
|
||||||
*Paul Dale*
|
*Paul Dale*
|
||||||
|
|
||||||
|
* The openssl speed command does not use low-level API calls anymore. This
|
||||||
|
implies some of the performance numbers might not be fully comparable
|
||||||
|
with the previous releases due to higher overhead. This applies
|
||||||
|
particularly to measuring performance on smaller data chunks.
|
||||||
|
|
||||||
|
*Tomáš Mráz*
|
||||||
|
|
||||||
* Combining the Configure options no-ec and no-dh no longer disables TLSv1.3.
|
* Combining the Configure options no-ec and no-dh no longer disables TLSv1.3.
|
||||||
Typically if OpenSSL has no EC or DH algorithms then it cannot support
|
Typically if OpenSSL has no EC or DH algorithms then it cannot support
|
||||||
connections with TLSv1.3. However OpenSSL now supports "pluggable" groups
|
connections with TLSv1.3. However OpenSSL now supports "pluggable" groups
|
||||||
|
1536
apps/speed.c
1536
apps/speed.c
File diff suppressed because it is too large
Load Diff
@ -7,8 +7,10 @@
|
|||||||
* https://www.openssl.org/source/license.html
|
* https://www.openssl.org/source/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <openssl/param_build.h>
|
||||||
|
|
||||||
/* used by speed.c */
|
/* used by speed.c */
|
||||||
DSA *get_dsa(int);
|
EVP_PKEY *get_dsa(int);
|
||||||
|
|
||||||
static unsigned char dsa512_priv[] = {
|
static unsigned char dsa512_priv[] = {
|
||||||
0x65, 0xe5, 0xc7, 0x38, 0x60, 0x24, 0xb5, 0x89, 0xd4, 0x9c, 0xeb, 0x4c,
|
0x65, 0xe5, 0xc7, 0x38, 0x60, 0x24, 0xb5, 0x89, 0xd4, 0x9c, 0xeb, 0x4c,
|
||||||
@ -211,11 +213,14 @@ typedef struct testdsa_st {
|
|||||||
st.q_l = sizeof(dsa##bits##_q); \
|
st.q_l = sizeof(dsa##bits##_q); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
DSA *get_dsa(int dsa_bits)
|
EVP_PKEY *get_dsa(int dsa_bits)
|
||||||
{
|
{
|
||||||
DSA *dsa;
|
EVP_PKEY *pkey = NULL;
|
||||||
BIGNUM *priv_key, *pub_key, *p, *q, *g;
|
BIGNUM *priv_key, *pub_key, *p, *q, *g;
|
||||||
|
EVP_PKEY_CTX *pctx;
|
||||||
testdsa dsa_t;
|
testdsa dsa_t;
|
||||||
|
OSSL_PARAM_BLD *tmpl = NULL;
|
||||||
|
OSSL_PARAM *params = NULL;
|
||||||
|
|
||||||
switch (dsa_bits) {
|
switch (dsa_bits) {
|
||||||
case 512:
|
case 512:
|
||||||
@ -231,30 +236,44 @@ DSA *get_dsa(int dsa_bits)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dsa = DSA_new()) == NULL)
|
if ((pctx = EVP_PKEY_CTX_new_from_name(NULL, "DSA", NULL)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
priv_key = BN_bin2bn(dsa_t.priv, dsa_t.priv_l, NULL);
|
priv_key = BN_bin2bn(dsa_t.priv, dsa_t.priv_l, NULL);
|
||||||
pub_key = BN_bin2bn(dsa_t.pub, dsa_t.pub_l, NULL);
|
pub_key = BN_bin2bn(dsa_t.pub, dsa_t.pub_l, NULL);
|
||||||
p = BN_bin2bn(dsa_t.p, dsa_t.p_l, NULL);
|
p = BN_bin2bn(dsa_t.p, dsa_t.p_l, NULL);
|
||||||
q = BN_bin2bn(dsa_t.q, dsa_t.q_l, NULL);
|
q = BN_bin2bn(dsa_t.q, dsa_t.q_l, NULL);
|
||||||
g = BN_bin2bn(dsa_t.g, dsa_t.g_l, NULL);
|
g = BN_bin2bn(dsa_t.g, dsa_t.g_l, NULL);
|
||||||
if ((priv_key == NULL) || (pub_key == NULL) || (p == NULL) || (q == NULL)
|
if (priv_key == NULL || pub_key == NULL || p == NULL || q == NULL
|
||||||
|| (g == NULL)) {
|
|| g == NULL) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (!DSA_set0_pqg(dsa, p, q, g))
|
if ((tmpl = OSSL_PARAM_BLD_new()) == NULL
|
||||||
|
|| !OSSL_PARAM_BLD_push_BN(tmpl, OSSL_PKEY_PARAM_FFC_P,
|
||||||
|
p)
|
||||||
|
|| !OSSL_PARAM_BLD_push_BN(tmpl, OSSL_PKEY_PARAM_FFC_Q,
|
||||||
|
q)
|
||||||
|
|| !OSSL_PARAM_BLD_push_BN(tmpl, OSSL_PKEY_PARAM_FFC_G,
|
||||||
|
g)
|
||||||
|
|| !OSSL_PARAM_BLD_push_BN(tmpl, OSSL_PKEY_PARAM_PRIV_KEY,
|
||||||
|
priv_key)
|
||||||
|
|| !OSSL_PARAM_BLD_push_BN(tmpl, OSSL_PKEY_PARAM_PUB_KEY,
|
||||||
|
pub_key)
|
||||||
|
|| (params = OSSL_PARAM_BLD_to_param(tmpl)) == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (!DSA_set0_key(dsa, pub_key, priv_key))
|
if (EVP_PKEY_fromdata_init(pctx) <= 0
|
||||||
goto err;
|
|| EVP_PKEY_fromdata(pctx, &pkey, EVP_PKEY_KEYPAIR,
|
||||||
|
params) <= 0)
|
||||||
return dsa;
|
pkey = NULL;
|
||||||
err:
|
err:
|
||||||
DSA_free(dsa);
|
OSSL_PARAM_BLD_free_params(params);
|
||||||
|
OSSL_PARAM_BLD_free(tmpl);
|
||||||
BN_free(priv_key);
|
BN_free(priv_key);
|
||||||
BN_free(pub_key);
|
BN_free(pub_key);
|
||||||
BN_free(p);
|
BN_free(p);
|
||||||
BN_free(q);
|
BN_free(q);
|
||||||
BN_free(g);
|
BN_free(g);
|
||||||
return NULL;
|
EVP_PKEY_CTX_free(pctx);
|
||||||
|
return pkey;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user