ctx->enc = enc;
if (iv != NULL) {
- if (ivlen != ctx->ivlen) {
- ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_IV_LENGTH);
+ if (!cipher_generic_initiv(vctx, iv, ivlen))
return 0;
- }
- memcpy(ctx->iv, iv, ivlen);
- xctx->iv_set = 1;
}
if (key != NULL) {
if (keylen != ctx->keylen) {
if (ctx->xts.key1 == NULL
|| ctx->xts.key2 == NULL
- || !ctx->iv_set
+ || !ctx->base.iv_set
|| out == NULL
|| in == NULL
|| inl < AES_BLOCK_SIZE)