MCPcopy Create free account
hub / github.com/RsyncProject/rsync / verify_digest

Function verify_digest

checksum.c:732–778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

730
731#if defined SUPPORT_XXH3 || defined USE_OPENSSL
732static void verify_digest(struct name_num_item *nni, BOOL check_auth_list)
733{
734#ifdef SUPPORT_XXH3
735 static int xxh3_result = 0;
736#endif
737#ifdef USE_OPENSSL
738 static int prior_num = 0, prior_flags = 0, prior_result = 0;
739#endif
740
741#ifdef SUPPORT_XXH3
742 if (nni->num == CSUM_XXH3_64 || nni->num == CSUM_XXH3_128) {
743 if (!xxh3_result) {
744 char buf[32816];
745 int j;
746 for (j = 0; j < (int)sizeof buf; j++)
747 buf[j] = ' ' + (j % 96);
748 sum_init(nni, 0);
749 sum_update(buf, 32816);
750 sum_update(buf, 31152);
751 sum_update(buf, 32474);
752 sum_update(buf, 9322);
753 xxh3_result = XXH3_64bits_digest(xxh3_state) != 0xadbcf16d4678d1de ? -1 : 1;
754 }
755 if (xxh3_result < 0)
756 nni->num = CSUM_gone;
757 return;
758 }
759#endif
760
761#ifdef USE_OPENSSL
762 if (BITS_SETnUNSET(nni->flags, NNI_EVP, NNI_BUILTIN|NNI_EVP_OK)) {
763 if (nni->num == prior_num && nni->flags == prior_flags) {
764 nni->flags = prior_result;
765 if (!(nni->flags & NNI_EVP))
766 nni->num = CSUM_gone;
767 } else {
768 prior_num = nni->num;
769 prior_flags = nni->flags;
770 if (!csum_evp_md(nni))
771 nni->num = CSUM_gone;
772 prior_result = nni->flags;
773 if (check_auth_list && (nni = get_nni_by_num(&valid_auth_checksums, prior_num)) != NULL)
774 verify_digest(nni, False);
775 }
776 }
777#endif
778}
779#endif
780
781void init_checksum_choices()

Callers 1

init_checksum_choicesFunction · 0.85

Calls 4

sum_initFunction · 0.85
sum_updateFunction · 0.85
csum_evp_mdFunction · 0.85
get_nni_by_numFunction · 0.85

Tested by

no test coverage detected