Add mac not NULL check before calling memset

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index b698912..9090924 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -2687,7 +2687,7 @@
         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);
     }