Make sure we handle input NULL with length 0
[openssl.git] / providers / implementations / ciphers / cipher_aes_siv.c
index 18be36e9b32120c4bb78e4df2102a7f49c3c0a88..864ebc725edfb934644d29512728c373da114193 100644 (file)
@@ -76,6 +76,11 @@ static int siv_cipher(void *vctx, unsigned char *out, size_t *outl,
 {
     PROV_AES_SIV_CTX *ctx = (PROV_AES_SIV_CTX *)vctx;
 
+    if (inl == 0) {
+        *outl = 0;
+        return 1;
+    }
+
     if (outsize < inl) {
         ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
         return 0;