static int check_var_length_output(struct evp_test *t,
                                   const unsigned char *expected,
                                   size_t expected_len,
                                   const unsigned char *received,
                                   size_t received_len)
{
    if (expected_len == received_len &&
        memcmp(expected, received, expected_len) == 0) {
        return 0;
    }

    /* The result printing code expects a non-NULL buffer. */
    t->out_expected = OPENSSL_memdup(expected, expected_len ? expected_len : 1);
    t->out_expected_len = expected_len;
    t->out_received = OPENSSL_memdup(received, received_len ? received_len : 1);
    t->out_received_len = received_len;
    if (t->out_expected == NULL || t->out_received == NULL) {
        fprintf(stderr, "Memory allocation error!\n");
        exit(1);
    }
    return 1;
}