aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ecdsa/ecs_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/ecdsa/ecs_lib.c')
-rw-r--r--crypto/ecdsa/ecs_lib.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/crypto/ecdsa/ecs_lib.c b/crypto/ecdsa/ecs_lib.c
index 8dc1dda46259..f1dd47231793 100644
--- a/crypto/ecdsa/ecs_lib.c
+++ b/crypto/ecdsa/ecs_lib.c
@@ -203,9 +203,16 @@ ECDSA_DATA *ecdsa_check(EC_KEY *key)
*/
ecdsa_data_free(ecdsa_data);
ecdsa_data = (ECDSA_DATA *)data;
+ } else if (EC_KEY_get_key_method_data(key, ecdsa_data_dup,
+ ecdsa_data_free,
+ ecdsa_data_free) != ecdsa_data) {
+ /* Or an out of memory error in EC_KEY_insert_key_method_data. */
+ ecdsa_data_free(ecdsa_data);
+ return NULL;
}
- } else
+ } else {
ecdsa_data = (ECDSA_DATA *)data;
+ }
#ifdef OPENSSL_FIPS
if (FIPS_mode() && !(ecdsa_data->flags & ECDSA_FLAG_FIPS_METHOD)
&& !(EC_KEY_get_flags(key) & EC_FLAG_NON_FIPS_ALLOW)) {