
    hs                     L    d dl Z d dlZd dlZ	 d dlZn# e$ r dZY nw xY wddZdS )    NTc                       fd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          }|! fd} j        dz   |_         j        |_        n|j        }t           |                    }| _         S t          j
                    fd            }|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                      	 rt           t          j                   nt          j                   n&# t          $ r t	          j        d d          w xY 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&   s     Mx3L_MMMMMK
OLLLL   'CJCCC   !=$1&111s	   6: #A)
isinstancetype__dict__get__qualname__
__module____func__classmethodr   	functoolswraps)r	   r   r   	decoratorr   r   r   s   `  r
   r#   z&requires_hashdigest.<locals>.decorator   s    mT** 	!&/33LAAJ!; ; ; ; ;*7*D}*T
'(5(@
%%'0
$YYz%:%:;;J'1M$  		'	'
	2 
	2 
	2 
	2 
	2 
	2 
	2 
(	'
	2 r    )r   r   r   r#   s   ```@r
   requires_hashdigestr%      s6           6 r   )NT)r!   r   r   r   ImportErrorr%   r$   r   r
   <module>r'      su         OOOO   HHH( ( ( ( ( (s    