2 * Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 /* Internal tests for the mdc2 module */
15 #include <openssl/mdc2.h>
17 #include "internal/nelem.h"
21 const unsigned char expected[MDC2_DIGEST_LENGTH];
25 /**********************************************************************
31 static TESTDATA tests[] = {
33 "Now is the time for all ",
35 0x42, 0xE5, 0x0C, 0xD2, 0x24, 0xBA, 0xCE, 0xBA,
36 0x76, 0x0B, 0xDD, 0x2B, 0xD4, 0x09, 0x28, 0x1A
41 /**********************************************************************
43 * Test of mdc2 internal functions
47 static int test_mdc2(int idx)
49 unsigned char md[MDC2_DIGEST_LENGTH];
51 const TESTDATA testdata = tests[idx];
54 MDC2_Update(&c, (const unsigned char *)testdata.input,
55 strlen(testdata.input));
56 MDC2_Final(&(md[0]), &c);
58 if (!TEST_mem_eq(testdata.expected, MDC2_DIGEST_LENGTH,
59 md, MDC2_DIGEST_LENGTH)) {
60 TEST_info("mdc2 test %d: unexpected output", idx);
69 ADD_ALL_TESTS(test_mdc2, OSSL_NELEM(tests));