diff --git a/examples/eckeygen.c b/examples/eckeygen.c index a37f4fc6..4617b68e 100644 --- a/examples/eckeygen.c +++ b/examples/eckeygen.c @@ -55,12 +55,13 @@ static int parse_hex_key_id(const char *input, unsigned char **output, size_t *s return -1; } *size = len / 2; - *output = OPENSSL_zalloc(*size); + *output = OPENSSL_malloc(*size); if (!*output) { return -1; } + memset(*output, 0, *size); for (i = 0; i < *size; i++) { - sscanf(input + (i * 2), "%2hhx", &(*output)[i]); + sscanf(input + (i * 2), "%2hhx", *output + i); } return 0; } diff --git a/examples/rsakeygen.c b/examples/rsakeygen.c index 8e1afb7e..e249fa1f 100644 --- a/examples/rsakeygen.c +++ b/examples/rsakeygen.c @@ -55,12 +55,13 @@ static int parse_hex_key_id(const char *input, unsigned char **output, size_t *s return -1; } *size = len / 2; - *output = OPENSSL_zalloc(*size); + *output = OPENSSL_malloc(*size); if (!*output) { return -1; } + memset(*output, 0, *size); for (i = 0; i < *size; i++) { - sscanf(input + (i * 2), "%2hhx", &(*output)[i]); + sscanf(input + (i * 2), "%2hhx", *output + i); } return 0; } diff --git a/src/p11_ec.c b/src/p11_ec.c index 765ac791..eb49358f 100644 --- a/src/p11_ec.c +++ b/src/p11_ec.c @@ -62,8 +62,11 @@ typedef int (*compute_key_fn)(void *, size_t, void *(*)(const void *, size_t, void *, size_t *)); #endif static compute_key_fn ossl_ecdh_compute_key; + +#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) static void (*ossl_ec_finish)(EC_KEY *); static int (*ossl_ec_copy)(EC_KEY *, const EC_KEY *); +#endif /* OPENSSL_VERSION_NUMBER */ static int ec_ex_index = 0; @@ -445,6 +448,8 @@ static int pkcs11_ecdsa_sign(const unsigned char *msg, unsigned int msg_len, return ck_sigsize; } +#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) + static void pkcs11_ec_finish(EC_KEY *ec) { PKCS11_OBJECT_private *key; @@ -458,6 +463,8 @@ static void pkcs11_ec_finish(EC_KEY *ec) ossl_ec_finish(ec); } +#endif /* OPENSSL_VERSION_NUMBER */ + /** * ECDSA signing method (replaces ossl_ecdsa_sign_sig) *