if (ret != YACA_ERROR_NONE)
return ret;
+ /* Fix for OpenSSL error in 3DES CFB1 */
+ int nid = EVP_CIPHER_CTX_nid(c->cipher_ctx);
+ if (nid == NID_des_ede3_cfb1)
+ EVP_CIPHER_CTX_set_flags(c->cipher_ctx, EVP_CIPH_FLAG_LENGTH_BITS);
+
if (liv != NULL)
iv_data = (unsigned char*)liv->d;
if (input == NULL || output == NULL)
return YACA_ERROR_INVALID_PARAMETER;
+ /* Fix for OpenSSL error in 3DES CFB1 */
+ if ((c->cipher_ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) != 0) {
+ if (input_len > INT_MAX / 8)
+ return YACA_ERROR_INVALID_PARAMETER;
+ input_len *= 8;
+ }
+
ret = EVP_CipherUpdate(c->cipher_ctx, output, &loutput_len, input, input_len);
if (ret != 1 || loutput_len < 0) {
ret = YACA_ERROR_INTERNAL;
}
*output_len = loutput_len;
+
+ /* Fix for OpenSSL error in 3DES CFB1 */
+ if ((c->cipher_ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) != 0)
+ *output_len /= 8;
+
return YACA_ERROR_NONE;
}
}
*output_len = loutput_len;
+
+ /* Fix for OpenSSL error in 3DES CFB1 */
+ if ((c->cipher_ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) != 0)
+ *output_len /= 8;
+
return YACA_ERROR_NONE;
}