Hi Jelena,
On 2/11/26 17:01, Jelena Sehovac wrote:
> Check if the provided decryption key string starts with the "pkcs11"
> identifier.
> This condition determines whether the key uses PKCS#11 (Public Key
> Cryptography Standard #11)
> for hardware security module or cryptographic token operations.
>
> Signed-off-by: sjelena <
jelena....@chipglobe.com>
> ---
> core/decrypt_keys.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/core/decrypt_keys.c b/core/decrypt_keys.c
> index 95c7c13b..9d3bf047 100644
> --- a/core/decrypt_keys.c
> +++ b/core/decrypt_keys.c
> @@ -84,10 +84,10 @@ int set_aes_key(const char *key, const char *ivt)
> ret = ascii_to_bin(decrypt_keys->ivt, AES_BLK_SIZE, ivt);
> keylen = strlen(key);
>
> - if (!strcmp("pkcs11", key)) {
> + const char *pkcs11_prefix = "pkcs11";
> + if (strncmp(key, pkcs11_prefix, strlen(pkcs11_prefix)) == 0) {
Apart using the strncmp function, can you better elaborate this and
where is the bug ? I have not got it.
"if (!strcmp("pkcs11", key))" and "if (strncmp(key, pkcs11_prefix,
strlen(pkcs11_prefix)) == 0)" are exactly the same.
Best regards,
Stefano Babic
> is_pkcs11 = true;
> decrypt_keys->keylen = keylen;
> -
> } else {
> switch (keylen) {
> case AES_128_KEY_LEN * 2:
> --
> 2.25.1
>
> --
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
swupdate+u...@googlegroups.com
> <mailto:
swupdate+u...@googlegroups.com>.
> To view this discussion visit
https://groups.google.com/d/msgid/
> swupdate/dc448922-028e-453f-989c-405f9bd3dd29n%
40googlegroups.com
> <
https://groups.google.com/d/msgid/swupdate/
> dc448922-028e-453f-989c-405f9bd3dd29n%
40googlegroups.com?
> utm_medium=email&utm_source=footer>.