From: Andreas Steffen Date: Thu, 26 Dec 2024 10:40:41 +0000 (+0100) Subject: curve25519: Use of public_key_info_encode() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97860a878a204e2204828f10cf1bd492dfe3555a;p=thirdparty%2Fstrongswan.git curve25519: Use of public_key_info_encode() --- diff --git a/src/libstrongswan/plugins/curve25519/curve25519_private_key.c b/src/libstrongswan/plugins/curve25519/curve25519_private_key.c index bf5c41486d..9c4ebec905 100644 --- a/src/libstrongswan/plugins/curve25519/curve25519_private_key.c +++ b/src/libstrongswan/plugins/curve25519/curve25519_private_key.c @@ -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); diff --git a/src/libstrongswan/plugins/curve25519/curve25519_public_key.c b/src/libstrongswan/plugins/curve25519/curve25519_public_key.c index 2c20549e98..1f74590591 100644 --- a/src/libstrongswan/plugins/curve25519/curve25519_public_key.c +++ b/src/libstrongswan/plugins/curve25519/curve25519_public_key.c @@ -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;