+#include "testutil.h"
+
+#define ENCRYPT 1
+#define DECRYPT 0
+
+#define DATA_SIZE 1024
+#define MAX_IV 32
+#define BUF_SIZE (DATA_SIZE + MAX_IV)
+
+static const unsigned char KEY[] = {
+ 0x51, 0x50, 0xd1, 0x77, 0x2f, 0x50, 0x83, 0x4a,
+ 0x50, 0x3e, 0x06, 0x9a, 0x97, 0x3f, 0xbd, 0x7c,
+ 0xe6, 0x1c, 0x43, 0x2b, 0x72, 0x0b, 0x19, 0xd1,
+ 0x8e, 0xc8, 0xd8, 0x4b, 0xdc, 0x63, 0x15, 0x1b
+};
+
+static const unsigned char IV[] = {
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08
+};
+
+static int do_bio_cipher(const EVP_CIPHER* cipher, const unsigned char* key,
+ const unsigned char* iv)