#include <openssl/opensslconf.h>
#include <openssl/types.h>
-#include <string.h>
-
#ifdef __cplusplus
extern "C" {
#endif
EC_KEY *eckey));
#endif /* OPENSSL_NO_DEPRECATED_3_0 */
-#define EVP_EC_gen(curve) \
- EVP_PKEY_Q_keygen(NULL, NULL, "EC", (char *)(strstr(curve, "")))
/* strstr is used to enable type checking for the variadic string arg */
#define ECParameters_dup(x) ASN1_dup_of(EC_KEY, i2d_ECParameters, \
d2i_ECParameters, x)
#endif
#include <stdarg.h>
+#include <string.h>
#ifndef OPENSSL_NO_STDIO
#include <stdio.h>
EVP_SKEY *EVP_SKEY_to_provider(EVP_SKEY *skey, OSSL_LIB_CTX *libctx,
OSSL_PROVIDER *prov, const char *propquery);
+/*
+ * The seemingly redundant expression (char *)(strstr(curve, "")) serves to
+ * cast const char * to char *, while avoiding accidental casting of improper
+ * (non-string) types.
+ * The direct cast of the result of strstr() to char * is necessary in C++,
+ * where strstr can return const char *.
+ */
+#define EVP_EC_gen(curve) \
+ EVP_PKEY_Q_keygen(NULL, NULL, "EC", \
+ (curve) ? (char *)(strstr(curve, "")) : NULL)
int EVP_EC_affine2oct(const BIGNUM *x, const BIGNUM *y, size_t field_len,
unsigned char **pbuf, size_t *pbsize);