diff --git a/library/psa_crypto.c b/library/psa_crypto.c index b6989127d..90909243c 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -2687,7 +2687,7 @@ exit: operation->mac_size = 0; } - if (mac_size > operation->mac_size) { + if ((mac != NULL) && (mac_size > operation->mac_size)) { memset(&mac[operation->mac_size], '!', mac_size - operation->mac_size); }