hash_test.c File Reference

#include <config.h>
#include <atf-c.h>
#include <stdio.h>
#include <string.h>
#include <isc/crc64.h>
#include <isc/hmacmd5.h>
#include <isc/hmacsha.h>
#include <isc/md5.h>
#include <isc/sha1.h>
#include <isc/util.h>

Go to the source code of this file.

Data Structures

struct  hash_testcase
struct  hash_test_key

Defines

#define TEST_INPUT(x)   (x), sizeof(x)-1

Typedefs

typedef struct hash_testcase hash_testcase_t
typedef struct hash_test_key hash_test_key_t

Functions

isc_result_t tohexstr (unsigned char *d, unsigned int len, char *out)
 ATF_TC (isc_sha1)
 ATF_TC_HEAD (isc_sha1, tc)
 ATF_TC_BODY (isc_sha1, tc)
 ATF_TC (isc_sha224)
 ATF_TC_HEAD (isc_sha224, tc)
 ATF_TC_BODY (isc_sha224, tc)
 ATF_TC (isc_sha256)
 ATF_TC_HEAD (isc_sha256, tc)
 ATF_TC_BODY (isc_sha256, tc)
 ATF_TC (isc_sha384)
 ATF_TC_HEAD (isc_sha384, tc)
 ATF_TC_BODY (isc_sha384, tc)
 ATF_TC (isc_sha512)
 ATF_TC_HEAD (isc_sha512, tc)
 ATF_TC_BODY (isc_sha512, tc)
 ATF_TC (isc_md5)
 ATF_TC_HEAD (isc_md5, tc)
 ATF_TC_BODY (isc_md5, tc)
 ATF_TC (isc_hmacsha1)
 ATF_TC_HEAD (isc_hmacsha1, tc)
 ATF_TC_BODY (isc_hmacsha1, tc)
 ATF_TC (isc_hmacsha224)
 ATF_TC_HEAD (isc_hmacsha224, tc)
 ATF_TC_BODY (isc_hmacsha224, tc)
 ATF_TC (isc_hmacsha256)
 ATF_TC_HEAD (isc_hmacsha256, tc)
 ATF_TC_BODY (isc_hmacsha256, tc)
 ATF_TC (isc_hmacsha384)
 ATF_TC_HEAD (isc_hmacsha384, tc)
 ATF_TC_BODY (isc_hmacsha384, tc)
 ATF_TC (isc_hmacsha512)
 ATF_TC_HEAD (isc_hmacsha512, tc)
 ATF_TC_BODY (isc_hmacsha512, tc)
 ATF_TC (isc_hmacmd5)
 ATF_TC_HEAD (isc_hmacmd5, tc)
 ATF_TC_BODY (isc_hmacmd5, tc)
 ATF_TC (isc_crc64)
 ATF_TC_HEAD (isc_crc64, tc)
 ATF_TC_BODY (isc_crc64, tc)
 ATF_TP_ADD_TCS (tp)

Variables

unsigned char digest [ISC_SHA512_DIGESTLENGTH]
unsigned char buffer [1024]
const char * s
char str [2 *ISC_SHA512_DIGESTLENGTH+3]
unsigned char key [20]


Define Documentation

#define TEST_INPUT (  )     (x), sizeof(x)-1

Definition at line 75 of file hash_test.c.

Referenced by ATF_TC_BODY().


Typedef Documentation

typedef struct hash_testcase hash_testcase_t

typedef struct hash_test_key hash_test_key_t


Function Documentation

isc_result_t tohexstr ( unsigned char *  d,
unsigned int  len,
char *  out 
)

Definition at line 60 of file hash_test.c.

References ISC_R_SUCCESS.

Referenced by ATF_TC_BODY().

ATF_TC ( isc_sha1   ) 

ATF_TC_HEAD ( isc_sha1  ,
tc   
)

Definition at line 92 of file hash_test.c.

ATF_TC_BODY ( isc_sha1  ,
tc   
)

Definition at line 95 of file hash_test.c.

References digest, hash_testcase::input, hash_testcase::input_len, ISC_SHA1_DIGESTLENGTH, isc_sha1_final(), isc_sha1_init(), isc_sha1_update(), hash_testcase::repeats, hash_testcase::result, str, TEST_INPUT, tohexstr(), and UNUSED.

ATF_TC ( isc_sha224   ) 

ATF_TC_HEAD ( isc_sha224  ,
tc   
)

Definition at line 221 of file hash_test.c.

ATF_TC_BODY ( isc_sha224  ,
tc   
)

Definition at line 224 of file hash_test.c.

References digest, hash_testcase::input, hash_testcase::input_len, ISC_SHA224_DIGESTLENGTH, isc_sha224_final(), isc_sha224_init(), isc_sha224_update(), hash_testcase::repeats, hash_testcase::result, str, TEST_INPUT, tohexstr(), and UNUSED.

ATF_TC ( isc_sha256   ) 

ATF_TC_HEAD ( isc_sha256  ,
tc   
)

Definition at line 354 of file hash_test.c.

ATF_TC_BODY ( isc_sha256  ,
tc   
)

Definition at line 357 of file hash_test.c.

References digest, hash_testcase::input, hash_testcase::input_len, ISC_SHA256_DIGESTLENGTH, isc_sha256_final(), isc_sha256_init(), isc_sha256_update(), hash_testcase::repeats, hash_testcase::result, str, TEST_INPUT, tohexstr(), and UNUSED.

ATF_TC ( isc_sha384   ) 

ATF_TC_HEAD ( isc_sha384  ,
tc   
)

Definition at line 486 of file hash_test.c.

ATF_TC_BODY ( isc_sha384  ,
tc   
)

Definition at line 489 of file hash_test.c.

References digest, hash_testcase::input, hash_testcase::input_len, ISC_SHA384_DIGESTLENGTH, isc_sha384_final(), isc_sha384_init(), isc_sha384_update(), hash_testcase::repeats, hash_testcase::result, str, TEST_INPUT, tohexstr(), and UNUSED.

ATF_TC ( isc_sha512   ) 

ATF_TC_HEAD ( isc_sha512  ,
tc   
)

Definition at line 632 of file hash_test.c.

ATF_TC_BODY ( isc_sha512  ,
tc   
)

Definition at line 635 of file hash_test.c.

References digest, hash_testcase::input, hash_testcase::input_len, ISC_SHA512_DIGESTLENGTH, isc_sha512_final(), isc_sha512_init(), isc_sha512_update(), hash_testcase::repeats, hash_testcase::result, str, TEST_INPUT, tohexstr(), and UNUSED.

ATF_TC ( isc_md5   ) 

ATF_TC_HEAD ( isc_md5  ,
tc   
)

Definition at line 779 of file hash_test.c.

ATF_TC_BODY ( isc_md5  ,
tc   
)

Definition at line 782 of file hash_test.c.

References digest, hash_testcase::input, hash_testcase::input_len, ISC_MD5_DIGESTLENGTH, isc_md5_final(), isc_md5_init(), isc_md5_update(), hash_testcase::repeats, hash_testcase::result, str, TEST_INPUT, tohexstr(), and UNUSED.

ATF_TC ( isc_hmacsha1   ) 

ATF_TC_HEAD ( isc_hmacsha1  ,
tc   
)

Definition at line 853 of file hash_test.c.

ATF_TC_BODY ( isc_hmacsha1  ,
tc   
)

Definition at line 856 of file hash_test.c.

References buffer, digest, hmacsha1, hash_testcase::input, hash_testcase::input_len, isc_hmacsha1_init(), isc_hmacsha1_sign(), isc_hmacsha1_update(), ISC_SHA1_DIGESTLENGTH, hash_test_key::key, hash_test_key::len, hash_testcase::result, str, TEST_INPUT, tohexstr(), and UNUSED.

ATF_TC ( isc_hmacsha224   ) 

ATF_TC_HEAD ( isc_hmacsha224  ,
tc   
)

Definition at line 983 of file hash_test.c.

ATF_TC_BODY ( isc_hmacsha224  ,
tc   
)

Definition at line 986 of file hash_test.c.

References buffer, digest, hmacsha224, hash_testcase::input, hash_testcase::input_len, isc_hmacsha224_init(), isc_hmacsha224_sign(), isc_hmacsha224_update(), ISC_SHA224_DIGESTLENGTH, hash_test_key::key, hash_test_key::len, hash_testcase::result, str, TEST_INPUT, tohexstr(), and UNUSED.

ATF_TC ( isc_hmacsha256   ) 

ATF_TC_HEAD ( isc_hmacsha256  ,
tc   
)

Definition at line 1146 of file hash_test.c.

ATF_TC_BODY ( isc_hmacsha256  ,
tc   
)

Definition at line 1149 of file hash_test.c.

References buffer, digest, hmacsha256, hash_testcase::input, hash_testcase::input_len, isc_hmacsha256_init(), isc_hmacsha256_sign(), isc_hmacsha256_update(), ISC_SHA256_DIGESTLENGTH, hash_test_key::key, hash_test_key::len, hash_testcase::result, str, TEST_INPUT, tohexstr(), and UNUSED.

ATF_TC ( isc_hmacsha384   ) 

ATF_TC_HEAD ( isc_hmacsha384  ,
tc   
)

Definition at line 1309 of file hash_test.c.

ATF_TC_BODY ( isc_hmacsha384  ,
tc   
)

Definition at line 1312 of file hash_test.c.

References buffer, digest, hmacsha384, hash_testcase::input, hash_testcase::input_len, isc_hmacsha384_init(), isc_hmacsha384_sign(), isc_hmacsha384_update(), ISC_SHA384_DIGESTLENGTH, hash_test_key::key, hash_test_key::len, hash_testcase::result, str, TEST_INPUT, tohexstr(), and UNUSED.

ATF_TC ( isc_hmacsha512   ) 

ATF_TC_HEAD ( isc_hmacsha512  ,
tc   
)

Definition at line 1478 of file hash_test.c.

ATF_TC_BODY ( isc_hmacsha512  ,
tc   
)

Definition at line 1481 of file hash_test.c.

References buffer, digest, hmacsha512, hash_testcase::input, hash_testcase::input_len, isc_hmacsha512_init(), isc_hmacsha512_sign(), isc_hmacsha512_update(), ISC_SHA512_DIGESTLENGTH, hash_test_key::key, hash_test_key::len, hash_testcase::result, str, TEST_INPUT, tohexstr(), and UNUSED.

ATF_TC ( isc_hmacmd5   ) 

ATF_TC_HEAD ( isc_hmacmd5  ,
tc   
)

Definition at line 1648 of file hash_test.c.

ATF_TC_BODY ( isc_hmacmd5  ,
tc   
)

Definition at line 1651 of file hash_test.c.

References buffer, digest, hmacmd5, hash_testcase::input, hash_testcase::input_len, isc_hmacmd5_init(), isc_hmacmd5_sign(), isc_hmacmd5_update(), ISC_MD5_DIGESTLENGTH, hash_test_key::key, hash_test_key::len, hash_testcase::result, str, TEST_INPUT, tohexstr(), and UNUSED.

ATF_TC ( isc_crc64   ) 

ATF_TC_HEAD ( isc_crc64  ,
tc   
)

Definition at line 1790 of file hash_test.c.

ATF_TC_BODY ( isc_crc64  ,
tc   
)

Definition at line 1793 of file hash_test.c.

References hash_testcase::input, hash_testcase::input_len, isc_crc64_final(), isc_crc64_init(), isc_crc64_update(), hash_testcase::repeats, hash_testcase::result, str, TEST_INPUT, tohexstr(), and UNUSED.

ATF_TP_ADD_TCS ( tp   ) 

Definition at line 1853 of file hash_test.c.


Variable Documentation

unsigned char digest[ISC_SHA512_DIGESTLENGTH]

Definition at line 40 of file hash_test.c.

Referenced by ATF_TC_BODY(), digest_afsdb(), digest_any_tsig(), digest_caa(), digest_cdnskey(), digest_cds(), digest_cert(), digest_ch_a(), digest_cname(), digest_dlv(), digest_dname(), digest_dnskey(), digest_ds(), digest_eui48(), digest_eui64(), digest_gpos(), digest_hinfo(), digest_hip(), digest_hs_a(), digest_in_a(), digest_in_a6(), digest_in_aaaa(), digest_in_apl(), digest_in_dhcid(), digest_in_kx(), digest_in_nsap(), digest_in_nsap_ptr(), digest_in_px(), digest_in_srv(), digest_in_wks(), digest_ipseckey(), digest_isdn(), digest_key(), digest_keydata(), digest_l32(), digest_l64(), digest_loc(), digest_lp(), digest_mb(), digest_md(), digest_mf(), digest_mg(), digest_minfo(), digest_mr(), digest_mx(), digest_naptr(), digest_nid(), digest_ns(), digest_nsec(), digest_nsec3(), digest_nsec3param(), digest_null(), digest_nxt(), digest_openpgpkey(), digest_opt(), digest_ptr(), digest_rp(), digest_rrsig(), digest_rt(), digest_sig(), digest_soa(), digest_spf(), digest_sshfp(), digest_tkey(), digest_tlsa(), digest_txt(), digest_unspec(), digest_uri(), digest_x25(), disable_ds_digests(), disabled_ds_digests(), dns_ds_buildrdata(), hmacmd5_sign(), hmacsha1_sign(), hmacsha224_sign(), hmacsha256_sign(), hmacsha384_sign(), hmacsha512_sign(), isc_entropy_getdata(), sign(), and verify().

unsigned char buffer[1024]

Definition at line 41 of file hash_test.c.

Referenced by add_nsec(), add_sigs(), add_test_data(), addoptout(), ATF_TC_BODY(), build_msghdr_recv(), build_msghdr_send(), check_dual_stack(), check_test_data(), checkowner_nsec3(), client_request(), client_send(), clone_buffer(), compute_tag(), configure_alternates(), configure_session_key(), configure_view(), configure_zone(), dns_badcache_add(), dns_byaddr_createptrname2(), dns_db_getsoaserial(), dns_dlz_writeablezone(), dns_journal_writediff(), dns_master_dumpnodetostream(), dns_message_peekheader(), dns_name_digest(), dns_name_downcase(), dns_nsec3_addnsec3(), dns_nsec3_delnsec3(), dns_nsec3_maxiterations(), dns_nsec3_noexistnodata(), dns_rbt_zero_header(), dns_test_makezone(), dns_view_create(), dns_view_setnewzones(), dns_view_untrust(), doio_recv(), dst__privstruct_writefile(), dst_gssapi_identitymatchesrealmkrb5(), dst_gssapi_identitymatchesrealmms(), dump_key(), dumpnode(), dumptostreaminc(), fixup_nsec3param(), fromtext_afsdb(), fromtext_any_tsig(), fromtext_ch_a(), fromtext_cname(), fromtext_dname(), fromtext_hip(), fromtext_in_a6(), fromtext_in_kx(), fromtext_in_nsap_ptr(), fromtext_in_px(), fromtext_in_srv(), fromtext_ipseckey(), fromtext_lp(), fromtext_mb(), fromtext_md(), fromtext_mf(), fromtext_mg(), fromtext_minfo(), fromtext_mr(), fromtext_mx(), fromtext_naptr(), fromtext_ns(), fromtext_nsec(), fromtext_nxt(), fromtext_ptr(), fromtext_rp(), fromtext_rrsig(), fromtext_rt(), fromtext_sig(), fromtext_soa(), fromtext_tkey(), generate(), ip2name(), isc_bufferlist_availablecount(), isc_bufferlist_usedcount(), isc_lex_gettoken(), isdelegation(), launch_next_query(), load_text(), load_zone(), logfmtpacket(), maybe_numeric(), modrdataset(), ns_client_dumpmessage(), ns_client_sendraw(), printnodename(), query_dns64(), query_filter64(), rbtdb_zero_header(), report(), sign_a_node(), trust_key(), verifynsec(), verifyzone(), writeheader(), zone_name_tostr(), zone_namerd_tostr(), zone_rdclass_tostr(), and zone_viewname_tostr().

const char* s

Definition at line 42 of file hash_test.c.

Referenced by axfr_rrstream_create(), axfr_rrstream_current(), axfr_rrstream_destroy(), axfr_rrstream_first(), axfr_rrstream_next(), axfr_rrstream_pause(), base32_decode_char(), base64_decode_char(), bind_ttl(), byte_atob(), check_enum(), compound_rrstream_create(), compound_rrstream_current(), compound_rrstream_destroy(), compound_rrstream_first(), compound_rrstream_next(), compound_rrstream_pause(), configure_session_key(), configure_view(), count_dots(), decvalue(), destroy_lookup(), dst__privstruct_writefile(), flush_lookup_list(), flush_server_list(), hash(), hex_decode_char(), hexvalue(), isc___mem_strdup(), isc_file_basename(), isc_file_template(), isc_mem_stats(), isc_sockaddr_hash(), isc_string_separate(), isc_string_strcasestr(), isc_string_strlcat(), isc_string_strlcpy(), isc_string_touint64(), isc_strtoul(), ixfr_rrstream_create(), ixfr_rrstream_current(), ixfr_rrstream_destroy(), ixfr_rrstream_first(), ixfr_rrstream_next(), multitxt_fromtext(), name_hash(), ns_tkeyctx_fromconfig(), nsu_strsep(), process_request(), setrl(), setup_keystr(), soa_rrstream_create(), soa_rrstream_current(), soa_rrstream_destroy(), token_addr(), try_proto(), and txt_fromtext().

char str[2 *ISC_SHA512_DIGESTLENGTH+3]

Definition at line 43 of file hash_test.c.

Referenced by ATF_TC_BODY(), cfgkeylist_find(), channel_fromconf(), check_dual_stack(), check_options(), check_orderent(), check_update_policy(), check_zoneconf(), configure_alternates(), configure_order(), configure_peer(), configure_rpz_zone(), configure_staticstub_servernames(), configure_view(), configure_view_nametable(), configure_zone_ssutable(), control_recvmessage(), controlkeylist_fromcfg(), create_empty_zone(), disable_algorithms(), disable_ds_digests(), disabled_algorithms(), disabled_ds_digests(), dns_rpz_policy2str(), dns_sdb_putsoa(), dns_sdlz_putsoa(), ip2name(), load_configuration(), mustbesecure(), ns_config_getzonetype(), ns_lwresd_parseeresolvconf(), ns_zone_configure(), on_disable_list(), and rndckey_exists().

unsigned char key[20]

Definition at line 44 of file hash_test.c.

Referenced by add(), add_initial_keys(), addkey(), ATF_TC_BODY(), bind9_check_controlskeys(), bind9_check_namedconf(), check_keylist(), control_recvmessage(), controlkeylist_fromcfg(), dns_dnssec_findmatchingkeys(), dns_dnssec_signs(), dns_message_checksig(), dns_nsec3_maxiterations(), dns_tsig_sign(), dns_tsig_verify(), dns_tsigkey_detach(), dns_tsigkey_find(), dns_view_untrust(), dns_zonekey_iszonekey(), emit(), free_controlkeylist(), free_tsignode(), freestruct_key(), fromstruct_key(), generate_session_key(), get_entry(), get_rndckey(), goodsig(), isccc_cc_checkdup(), isselfsigned(), key_collision(), keyfromds(), keythatsigned(), keythatsigned_unlocked(), load_view_keys(), loadds(), loadexplicitkeys(), loadkey(), logkey(), main(), mark_active_keys(), nameexist(), ns_client_isself(), ns_config_getipandkeylist(), parse_config(), read_sessionkey(), received(), signset(), table_fromwire(), tostruct_key(), tsig_verify_tcp(), validate(), validate_masters(), and writeset().


Generated on Tue Apr 28 17:41:18 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha