Files
.github
CMakeModules
LICENSES
dist
externals
FidelityFX-FSR
SDL
Vulkan-Headers
cmake-modules
cpp-httplib
cpp-jwt
cubeb
discord-rpc
dynarmic
enet
ffmpeg
find-modules
getopt
glad
inih
libressl
libusb
mbedtls
.github
ChangeLog.d
configs
doxygen
include
library
programs
scripts
tests
.jenkins
configs
data_files
git-scripts
scripts
suites
helpers.function
host_test.function
main_test.function
target_test.function
test_suite_aes.cbc.data
test_suite_aes.cfb.data
test_suite_aes.ecb.data
test_suite_aes.function
test_suite_aes.ofb.data
test_suite_aes.rest.data
test_suite_aes.xts.data
test_suite_arc4.data
test_suite_arc4.function
test_suite_aria.data
test_suite_aria.function
test_suite_asn1write.data
test_suite_asn1write.function
test_suite_base64.data
test_suite_base64.function
test_suite_blowfish.data
test_suite_blowfish.function
test_suite_camellia.data
test_suite_camellia.function
test_suite_ccm.data
test_suite_ccm.function
test_suite_chacha20.data
test_suite_chacha20.function
test_suite_chachapoly.data
test_suite_chachapoly.function
test_suite_cipher.aes.data
test_suite_cipher.arc4.data
test_suite_cipher.blowfish.data
test_suite_cipher.camellia.data
test_suite_cipher.ccm.data
test_suite_cipher.chacha20.data
test_suite_cipher.chachapoly.data
test_suite_cipher.des.data
test_suite_cipher.function
test_suite_cipher.gcm.data
test_suite_cipher.misc.data
test_suite_cipher.null.data
test_suite_cipher.padding.data
test_suite_cmac.data
test_suite_cmac.function
test_suite_ctr_drbg.data
test_suite_ctr_drbg.function
test_suite_debug.data
test_suite_debug.function
test_suite_des.data
test_suite_des.function
test_suite_dhm.data
test_suite_dhm.function
test_suite_ecdh.data
test_suite_ecdh.function
test_suite_ecdsa.data
test_suite_ecdsa.function
test_suite_ecjpake.data
test_suite_ecjpake.function
test_suite_ecp.data
test_suite_ecp.function
test_suite_entropy.data
test_suite_entropy.function
test_suite_error.data
test_suite_error.function
test_suite_gcm.aes128_de.data
test_suite_gcm.aes128_en.data
test_suite_gcm.aes192_de.data
test_suite_gcm.aes192_en.data
test_suite_gcm.aes256_de.data
test_suite_gcm.aes256_en.data
test_suite_gcm.camellia.data
test_suite_gcm.function
test_suite_gcm.misc.data
test_suite_hkdf.data
test_suite_hkdf.function
test_suite_hmac_drbg.function
test_suite_hmac_drbg.misc.data
test_suite_hmac_drbg.no_reseed.data
test_suite_hmac_drbg.nopr.data
test_suite_hmac_drbg.pr.data
test_suite_md.data
test_suite_md.function
test_suite_mdx.data
test_suite_mdx.function
test_suite_memory_buffer_alloc.data
test_suite_memory_buffer_alloc.function
test_suite_mpi.data
test_suite_mpi.function
test_suite_nist_kw.data
test_suite_nist_kw.function
test_suite_pem.data
test_suite_pem.function
test_suite_pk.data
test_suite_pk.function
test_suite_pkcs1_v15.data
test_suite_pkcs1_v15.function
test_suite_pkcs1_v21.data
test_suite_pkcs1_v21.function
test_suite_pkcs5.data
test_suite_pkcs5.function
test_suite_pkparse.data
test_suite_pkparse.function
test_suite_pkwrite.data
test_suite_pkwrite.function
test_suite_poly1305.data
test_suite_poly1305.function
test_suite_rsa.data
test_suite_rsa.function
test_suite_shax.data
test_suite_shax.function
test_suite_ssl.data
test_suite_ssl.function
test_suite_timing.data
test_suite_timing.function
test_suite_version.data
test_suite_version.function
test_suite_x509parse.data
test_suite_x509parse.function
test_suite_x509write.data
test_suite_x509write.function
test_suite_xtea.data
test_suite_xtea.function
.gitignore
CMakeLists.txt
Descriptions.txt
Makefile
compat.sh
ssl-opt.sh
visualc
.gitignore
.globalrc
.pylintrc
.travis.yml
CMakeLists.txt
CONTRIBUTING.md
ChangeLog
DartConfiguration.tcl
LICENSE
Makefile
README.md
apache-2.0.txt
dco.txt
gpl-2.0.txt
microprofile
opus
sirit
vcpkg
xbyak
CMakeLists.txt
hooks
patches
src
CMakeLists.txt
CONTRIBUTING.md
Doxyfile
LICENSE.txt
README.md
license.txt
vcpkg.json
yuzu/externals/mbedtls/tests/suites/test_suite_mdx.function
2021-03-06 01:41:47 +01:00

115 lines
3.1 KiB
Plaintext
Executable File

/* BEGIN_HEADER */
#include "mbedtls/md2.h"
#include "mbedtls/md4.h"
#include "mbedtls/md5.h"
#include "mbedtls/ripemd160.h"
/* END_HEADER */
/* BEGIN_CASE depends_on:MBEDTLS_MD2_C */
void md2_text( char * text_src_string, data_t * hash )
{
int ret;
unsigned char src_str[100];
unsigned char output[16];
memset( src_str, 0x00, sizeof src_str );
memset( output, 0x00, sizeof output );
strncpy( (char *) src_str, text_src_string, sizeof(src_str) - 1 );
ret = mbedtls_md2_ret( src_str, strlen( (char *) src_str ), output );
TEST_ASSERT( ret == 0 ) ;
TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
sizeof output, hash->len ) == 0 );
}
/* END_CASE */
/* BEGIN_CASE depends_on:MBEDTLS_MD4_C */
void md4_text( char * text_src_string, data_t * hash )
{
int ret;
unsigned char src_str[100];
unsigned char output[16];
memset( src_str, 0x00, sizeof src_str );
memset( output, 0x00, sizeof output );
strncpy( (char *) src_str, text_src_string, sizeof(src_str) - 1 );
ret = mbedtls_md4_ret( src_str, strlen( (char *) src_str ), output );
TEST_ASSERT( ret == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
sizeof output, hash->len ) == 0 );
}
/* END_CASE */
/* BEGIN_CASE depends_on:MBEDTLS_MD5_C */
void md5_text( char * text_src_string, data_t * hash )
{
int ret;
unsigned char src_str[100];
unsigned char output[16];
memset( src_str, 0x00, sizeof src_str );
memset( output, 0x00, sizeof output );
strncpy( (char *) src_str, text_src_string, sizeof(src_str) - 1 );
ret = mbedtls_md5_ret( src_str, strlen( (char *) src_str ), output );
TEST_ASSERT( ret == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
sizeof output, hash->len ) == 0 );
}
/* END_CASE */
/* BEGIN_CASE depends_on:MBEDTLS_RIPEMD160_C */
void ripemd160_text( char * text_src_string, data_t * hash )
{
int ret;
unsigned char src_str[100];
unsigned char output[20];
memset(src_str, 0x00, sizeof src_str);
memset(output, 0x00, sizeof output);
strncpy( (char *) src_str, text_src_string, sizeof(src_str) - 1 );
ret = mbedtls_ripemd160_ret( src_str, strlen( (char *) src_str ), output );
TEST_ASSERT( ret == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
sizeof output, hash->len ) == 0 );
}
/* END_CASE */
/* BEGIN_CASE depends_on:MBEDTLS_MD2_C:MBEDTLS_SELF_TEST */
void md2_selftest( )
{
TEST_ASSERT( mbedtls_md2_self_test( 1 ) == 0 );
}
/* END_CASE */
/* BEGIN_CASE depends_on:MBEDTLS_MD4_C:MBEDTLS_SELF_TEST */
void md4_selftest( )
{
TEST_ASSERT( mbedtls_md4_self_test( 1 ) == 0 );
}
/* END_CASE */
/* BEGIN_CASE depends_on:MBEDTLS_MD5_C:MBEDTLS_SELF_TEST */
void md5_selftest( )
{
TEST_ASSERT( mbedtls_md5_self_test( 1 ) == 0 );
}
/* END_CASE */
/* BEGIN_CASE depends_on:MBEDTLS_RIPEMD160_C:MBEDTLS_SELF_TEST */
void ripemd160_selftest( )
{
TEST_ASSERT( mbedtls_ripemd160_self_test( 1 ) == 0 );
}
/* END_CASE */