X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=test%2Frc5test.c;h=8e0747602313e0dbc18a218f1d0467b97b54a834;hb=4e6e57cfcdd75b827ff7171927d87e95b5b86ae8;hp=bd02f72353dd90c4ea1fc59ee9ce3d36caaee0e4;hpb=a9c6d221055c3a85edb23b1364cd60baafed4b9f;p=oweals%2Fopenssl.git diff --git a/test/rc5test.c b/test/rc5test.c index bd02f72353..8e07476023 100644 --- a/test/rc5test.c +++ b/test/rc5test.c @@ -1,15 +1,21 @@ /* - * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * - * Licensed under the OpenSSL license (the "License"). You may not use + * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ +/* + * RC5 low level APIs are deprecated for public use, but still ok for internal + * use. + */ +#include "internal/deprecated.h" + #include -#include "../e_os.h" +#include "internal/nelem.h" #include "testutil.h" #ifndef OPENSSL_NO_RC5 @@ -181,7 +187,8 @@ static int test_rc5_ecb(int n) RC5_32_KEY key; unsigned char buf[8], buf2[8]; - RC5_32_set_key(&key, 16, &RC5key[n][0], 12); + if (!TEST_true(RC5_32_set_key(&key, 16, &RC5key[n][0], 12))) + return 0; RC5_32_ecb_encrypt(&RC5plain[n][0], buf, &key, RC5_ENCRYPT); if (!TEST_mem_eq(&RC5cipher[n][0], sizeof(RC5cipher[0]), buf, sizeof(buf))) @@ -203,7 +210,9 @@ static int test_rc5_cbc(int n) i = rc5_cbc_rounds[n]; if (i >= 8) { - RC5_32_set_key(&key, rc5_cbc_key[n][0], &rc5_cbc_key[n][1], i); + if (!TEST_true(RC5_32_set_key(&key, rc5_cbc_key[n][0], + &rc5_cbc_key[n][1], i))) + return 0; memcpy(ivb, &rc5_cbc_iv[n][0], 8); RC5_32_cbc_encrypt(&rc5_cbc_plain[n][0], buf, 8, @@ -216,7 +225,7 @@ static int test_rc5_cbc(int n) memcpy(ivb, &rc5_cbc_iv[n][0], 8); RC5_32_cbc_encrypt(buf, buf2, 8, &key, &ivb[0], RC5_DECRYPT); if (!TEST_mem_eq(&rc5_cbc_plain[n][0], sizeof(rc5_cbc_plain[0]), - buf2, sizeof(buf2)) != 0) + buf2, sizeof(buf2))) testresult = 0; } @@ -224,10 +233,11 @@ static int test_rc5_cbc(int n) } #endif -void register_tests(void) +int setup_tests(void) { #ifndef OPENSSL_NO_RC5 ADD_ALL_TESTS(test_rc5_ecb, OSSL_NELEM(RC5key)); ADD_ALL_TESTS(test_rc5_cbc, RC5_CBC_NUM); #endif + return 1; }