�
*�Kgs � �L � d dl Z d dlZd dlZ d dlZn
# e$ r dZY nw xY wdd�ZdS )� NTc � � ���� �� ��fd���S )a� Decorator raising SkipTest if a hashing algorithm is not available
The hashing algorithm could be missing or blocked by a strict crypto
policy.
If 'openssl' is True, then the decorator checks that OpenSSL provides
the algorithm. Otherwise the check falls back to built-in
implementations. The usedforsecurity flag is passed to the constructor.
ValueError: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS
ValueError: unsupported hash type md4
c �B �� � t � t � � re� j � d� � }|�!� fd�}� j dz |_ � j |_ n|j }t �|� � � � }|� _ � S t j
� � � �� ��fd�� � }|S )N�
setUpClassc �L �� t �| � � � � � d S )N)�superr )�cls�
func_or_classs ��2/usr/lib/python3.11/test/support/hashlib_helper.pyr z:requires_hashdigest.<locals>.decorator.<locals>.setUpClass s% �� ��-��-�-�8�8�:�:�:�:�:� z.setUpClassc �� �� �rt �t j ���� � nt j ���� � n&# t $ r t j d�� d�� � �w xY w �| i |��S )N)�usedforsecurityz
hash digest 'z' is not available.)�_hashlib�new�hashlib�
ValueError�unittest�SkipTest)�args�kwargs�
digestnamer �opensslr
s ����r
�wrapperz7requires_hashdigest.<locals>.decorator.<locals>.wrapper& |