diff options
| author | Marvin W <git@larma.de> | 2026-08-24 11:48:22 +0200 |
|---|---|---|
| committer | Marvin W <git@larma.de> | 2026-10-23 16:59:59 +0200 |
| commit | 49f4ae03b742e73b6efdf9edf50dee92ebae1448 (patch) | |
| tree | 58cab75ad0a864ca043ac62c46a896a503be2483 /plugins/ice/src/openssl_utils.c | |
| parent | 98ef191bfb3cc5694b9d1001e46a9b00abbd7195 (diff) | |
Move DLTS-SRTP into libdino
Diffstat (limited to 'plugins/ice/src/openssl_utils.c')
| -rw-r--r-- | plugins/ice/src/openssl_utils.c | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/plugins/ice/src/openssl_utils.c b/plugins/ice/src/openssl_utils.c deleted file mode 100644 index 7f4bf331..00000000 --- a/plugins/ice/src/openssl_utils.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "openssl_utils.h" -#include <openssl/opensslv.h> -#include <openssl/ec.h> - -#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x30000000L -// This is for OpenSSL 3.0.0 and newer - -EVP_PKEY *EVP_PKEY_new_generate_ecdsa (const char* curve) { - // Generate EVP_PKEY directly - EVP_PKEY *pkey = EVP_EC_gen (curve); - return pkey; -} - -#else -// This is for OpenSSL before 3.0.0 and forks of earlier OpenSSL versions like LibreSSL - -EVP_PKEY *EVP_PKEY_new_generate_ecdsa (const char* curve) { - // Get NID from curve name - int nid = OBJ_sn2nid (curve); - if (nid == NID_undef) return NULL; - - // Create EC_KEY - EC_KEY *ec_key = EC_KEY_new_by_curve_name (nid); - if (!ec_key) return NULL; - - // Generate key - if (!EC_KEY_generate_key (ec_key)) { - EC_KEY_free (ec_key); - return NULL; - } - - // Create EVP_PKEY - EVP_PKEY *pkey = EVP_PKEY_new (); - if (!pkey) { - EC_KEY_free (ec_key); - return NULL; - } - - // Assign EC_KEY to EVP_PKEY - if (!EVP_PKEY_assign_EC_KEY (pkey, ec_key)) { - EC_KEY_free (ec_key); - return NULL; - } - - // EVP_PKEY_assign_EC_KEY takes ownership of ec_key, no need to free it explicitly - return pkey; -} - -#endif |
