Commit 84e643f2cc for strongswan.org
commit 84e643f2cc2cd176a75745ddddfd711c0f68b433
Author: Tobias Brunner <tobias@strongswan.org>
Date: Thu Mar 12 18:35:56 2026 +0100
wolfssl: Support encoding the ECDSA curve as OID
diff --git a/src/libstrongswan/plugins/wolfssl/wolfssl_ec_public_key.c b/src/libstrongswan/plugins/wolfssl/wolfssl_ec_public_key.c
index b2fa07a732..670a5bccbe 100644
--- a/src/libstrongswan/plugins/wolfssl/wolfssl_ec_public_key.c
+++ b/src/libstrongswan/plugins/wolfssl/wolfssl_ec_public_key.c
@@ -27,6 +27,7 @@
#include "wolfssl_ec_public_key.h"
#include "wolfssl_util.h"
+#include <asn1/asn1.h>
#include <utils/debug.h>
#include <wolfssl/wolfcrypt/ecc.h>
@@ -270,6 +271,20 @@ METHOD(public_key_t, get_encoding, bool,
bool success = TRUE;
int len;
+ if (type == PUBKEY_ECDSA_CURVE_DER)
+ {
+ const byte *oid = NULL;
+ word32 len = 0;
+
+ if (wc_ecc_get_oid(this->ec.dp->oidSum, &oid, &len) > 0 && len)
+ {
+ *encoding = asn1_simple_object(ASN1_OID,
+ chunk_create((u_char*)oid, len));
+ return TRUE;
+ }
+ return FALSE;
+ }
+
/* space for algorithmIdentifier/bitString + one byte for the point type */
*encoding = chunk_alloc(2 * this->ec.dp->size + 2 * MAX_SEQ_SZ +
2 * MAX_ALGO_SZ + TRAILING_ZERO + 1);