]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
curve25519: Use of public_key_info_encode()
authorAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 26 Dec 2024 10:40:41 +0000 (11:40 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Fri, 18 Jul 2025 11:07:01 +0000 (13:07 +0200)
src/libstrongswan/plugins/curve25519/curve25519_private_key.c
src/libstrongswan/plugins/curve25519/curve25519_public_key.c

index bf5c41486dc623655803f34219fe76b4100a6af1..9c4ebec905c878666eb03b932b1ee1d3a5e3d3d2 100644 (file)
@@ -133,7 +133,7 @@ METHOD(private_key_t, get_public_key, public_key_t*,
        public_key_t *public;
        chunk_t pubkey;
 
-       pubkey = curve25519_public_key_info_encode(this->pubkey);
+       pubkey = public_key_info_encode(this->pubkey, OID_ED25519);
        public = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, KEY_ED25519,
                                                                BUILD_BLOB_ASN1_DER, pubkey, BUILD_END);
        free(pubkey.ptr);
index 2c20549e984f44da9bc99169c74bbdb51aa2b496..1f74590591f6c001f9c8854c5af5a3cbe4097851 100644 (file)
@@ -159,7 +159,7 @@ METHOD(public_key_t, get_encoding, bool,
 {
        bool success = TRUE;
 
-       *encoding = curve25519_public_key_info_encode(this->pubkey);
+       *encoding = public_key_info_encode(this->pubkey, OID_ED25519);
 
        if (type != PUBKEY_SPKI_ASN1_DER)
        {
@@ -325,17 +325,6 @@ curve25519_public_key_t *curve25519_public_key_load(key_type_t type,
        return &this->public;
 }
 
-/**
- * See header.
- */
-chunk_t curve25519_public_key_info_encode(chunk_t pubkey)
-{
-       return asn1_wrap(ASN1_SEQUENCE, "mm",
-                                       asn1_wrap(ASN1_SEQUENCE, "m",
-                                               asn1_build_known_oid(OID_ED25519)),
-                                       asn1_bitstring("c", pubkey));
-}
-
 /**
  * See header.
  */
@@ -351,7 +340,7 @@ bool curve25519_public_key_fingerprint(chunk_t pubkey,
                        key = chunk_clone(pubkey);
                        break;
                case KEYID_PUBKEY_INFO_SHA1:
-                       key = curve25519_public_key_info_encode(pubkey);
+                       key = public_key_info_encode(pubkey, OID_ED25519);
                        break;
                default:
                        return FALSE;