| 730 | |
| 731 | #if defined SUPPORT_XXH3 || defined USE_OPENSSL |
| 732 | static 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 | |
| 781 | void init_checksum_choices() |
no test coverage detected