projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add more complete support for libctx/propq in the EC code
[openssl.git]
/
crypto
/
ec
/
ec_kmeth.c
diff --git
a/crypto/ec/ec_kmeth.c
b/crypto/ec/ec_kmeth.c
index 7aa9865d29dc17c4c5f6628f83f16a356db7fedb..3fec8a4d814b37e89e1e42f5129fcb79c609e527 100644
(file)
--- a/
crypto/ec/ec_kmeth.c
+++ b/
crypto/ec/ec_kmeth.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright 2015-20
18
The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2015-20
20
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
*
* 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
@@
-65,7
+65,7
@@
int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth)
if (finish != NULL)
finish(key);
if (finish != NULL)
finish(key);
-#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE)
+#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MOD
UL
E)
ENGINE_finish(key->engine);
key->engine = NULL;
#endif
ENGINE_finish(key->engine);
key->engine = NULL;
#endif
@@
-76,7
+76,8
@@
int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth)
return 1;
}
return 1;
}
-EC_KEY *ec_key_new_method_int(OPENSSL_CTX *libctx, ENGINE *engine)
+EC_KEY *ec_key_new_method_int(OPENSSL_CTX *libctx, const char *propq,
+ ENGINE *engine)
{
EC_KEY *ret = OPENSSL_zalloc(sizeof(*ret));
{
EC_KEY *ret = OPENSSL_zalloc(sizeof(*ret));
@@
-86,17
+87,23
@@
EC_KEY *ec_key_new_method_int(OPENSSL_CTX *libctx, ENGINE *engine)
}
ret->libctx = libctx;
}
ret->libctx = libctx;
+ if (propq != NULL) {
+ ret->propq = OPENSSL_strdup(propq);
+ if (ret->propq == NULL) {
+ ECerr(EC_F_EC_KEY_NEW_METHOD_INT, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ }
ret->references = 1;
ret->lock = CRYPTO_THREAD_lock_new();
if (ret->lock == NULL) {
ECerr(EC_F_EC_KEY_NEW_METHOD_INT, ERR_R_MALLOC_FAILURE);
ret->references = 1;
ret->lock = CRYPTO_THREAD_lock_new();
if (ret->lock == NULL) {
ECerr(EC_F_EC_KEY_NEW_METHOD_INT, ERR_R_MALLOC_FAILURE);
- OPENSSL_free(ret);
- return NULL;
+ goto err;
}
ret->meth = EC_KEY_get_default_method();
}
ret->meth = EC_KEY_get_default_method();
-#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE)
+#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MOD
UL
E)
if (engine != NULL) {
if (!ENGINE_init(engine)) {
ECerr(EC_F_EC_KEY_NEW_METHOD_INT, ERR_R_ENGINE_LIB);
if (engine != NULL) {
if (!ENGINE_init(engine)) {
ECerr(EC_F_EC_KEY_NEW_METHOD_INT, ERR_R_ENGINE_LIB);
@@
-118,7
+125,7
@@
EC_KEY *ec_key_new_method_int(OPENSSL_CTX *libctx, ENGINE *engine)
ret->conv_form = POINT_CONVERSION_UNCOMPRESSED;
/* No ex_data inside the FIPS provider */
ret->conv_form = POINT_CONVERSION_UNCOMPRESSED;
/* No ex_data inside the FIPS provider */
-#ifndef FIPS_MODE
+#ifndef FIPS_MOD
UL
E
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_EC_KEY, ret, &ret->ex_data)) {
goto err;
}
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_EC_KEY, ret, &ret->ex_data)) {
goto err;
}
@@
-135,10
+142,10
@@
EC_KEY *ec_key_new_method_int(OPENSSL_CTX *libctx, ENGINE *engine)
return NULL;
}
return NULL;
}
-#ifndef FIPS_MODE
+#ifndef FIPS_MOD
UL
E
EC_KEY *EC_KEY_new_method(ENGINE *engine)
{
EC_KEY *EC_KEY_new_method(ENGINE *engine)
{
- return ec_key_new_method_int(NULL, engine);
+ return ec_key_new_method_int(NULL,
NULL,
engine);
}
#endif
}
#endif