Commit c5652d4623 for strongswan.org
commit c5652d46231f9513c5e84ac4aa2e2e109db15624
Author: Tobias Brunner <tobias@strongswan.org>
Date: Tue Sep 22 15:56:33 2026 +0200
pkcs11: Remove redundant calls to chunk_skip_zero()
Since the previous commit, zero-padding is stripped automatically by
`asn1_integer()`, so we don't have to do it explicitly anymore.
diff --git a/src/libstrongswan/plugins/pkcs11/pkcs11_private_key.c b/src/libstrongswan/plugins/pkcs11/pkcs11_private_key.c
index 6a54b3f3fe..b247ea514b 100644
--- a/src/libstrongswan/plugins/pkcs11/pkcs11_private_key.c
+++ b/src/libstrongswan/plugins/pkcs11/pkcs11_private_key.c
@@ -509,19 +509,12 @@ METHOD(private_key_t, sign, bool,
case SIGN_ECDSA_WITH_SHA256_DER:
case SIGN_ECDSA_WITH_SHA384_DER:
case SIGN_ECDSA_WITH_SHA512_DER:
- {
- chunk_t r, s;
-
- /* return an ASN.1 encoded sequence of integers r and s, removing
- * any zero-padding */
len /= 2;
- r = chunk_skip_zero(chunk_create(buf, len));
- s = chunk_skip_zero(chunk_create(buf+len, len));
*signature = asn1_wrap(ASN1_SEQUENCE, "mm",
- asn1_integer("c", r), asn1_integer("c", s));
+ asn1_integer("c", chunk_create(buf, len)),
+ asn1_integer("c", chunk_create(buf+len, len)));
free(buf);
break;
- }
default:
*signature = chunk_create(buf, len);
break;