/* Provenance: openssl/openssl siv_cipher (fixed). * repo: openssl/openssl * commit: 00e2f5eea29994d19293ec4e8c8775ba73678598 * parent: 175fa8469fc78f6cf35dfb87d26899e60e9ff1d4 * commit_url: https://github.com/openssl/openssl/commit/00e2f5eea29994d19293ec4e8c8775ba73678598 * cve: CVE-2023-2975 * license: Apache-2.0 * function: siv_cipher * relpath: providers/implementations/ciphers/cipher_aes_siv.c */ static int siv_cipher(void *vctx, unsigned char *out, size_t *outl, size_t outsize, const unsigned char *in, size_t inl) { PROV_AES_SIV_CTX *ctx = (PROV_AES_SIV_CTX *)vctx; if (!ossl_prov_is_running()) return 0; /* Ignore just empty encryption/decryption call and not AAD. */ if (out != NULL) { if (inl == 0) { if (outl != NULL) *outl = 0; return 1; } if (outsize < inl) { ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL); return 0; } } if (ctx->hw->cipher(ctx, out, in, inl) <= 0) return 0; if (outl != NULL) *outl = inl; return 1; }