ffddlZddlZddlZddlZddlZddlZddlmZddlmZ ddl Z dZ n #e $rdZ YnwxYwdZ dZ iiifdZdS) N) unhexlify)FileNotFoundErrorTFcd}g}Gddt}d}d}d} |dz }|} | s|||n| } | ds| sd} c| dr/|||d}|| | r/|dz }d } ||||d ||fz|}t jd | } | s|xj| gz c_n| d } | d  } | | d}|?t| d zdkrd | z} t|| tj| nt|| || |S)zLoad and parse a test vector file Return a list of objects, one per group of adjacent KV lines or for a single line in the form "[.*]". For a group of lines, the object has one attribute per line. rceZdZdZdS)_load_tests..TestVectorc0||_||_g|_dS)N)desccountothers)self descriptionr s x/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/SelfTest/loader.py__init__z(_load_tests..TestVector.__init__=s#DIDJDKKKN)__name__ __module__ __qualname__rrr TestVectorr<s#     rrNT#[Fz%s (#%d)z([A-Za-z0-9]+) = ?(.*)0)objectreadlineappendstrip startswithrematchr grouplowergetlensetattrbinasciir) dir_compsfile_inr conversions line_numberresultsr test_vectorr new_grouplinerestokendata conversions r _load_testsr40s8KGV K EI)>q !! &{+++ zz|| ??3   t I  ??3   &{+++K NN4   O QJEI&{+++$*Z;2F%FNNKh/66 >   4& (   IIaLL&&((E99Q<<%%''D$55J!t99q=A%%:D UH,>t,D,DEEEE UJJt,<,<===S)>X Nrc&d} ts7ttjt jtj||d|d}tjtj }tj t jj |g|R|}t|5}t||||}dddn #1swxYwYn/#t$r"tjd|ztdYnwxYw|S)aLoad and parse a test vector file, formatted using the NIST style. Args: dir_comps (list of strings): The path components under the ``pycryptodome_test_vectors`` package. For instance ``("Cipher", "AES")``. file_name (string): The name of the file with the test vectors. description (string): A description applicable to the test vectors in the file. conversions (dictionary): The dictionary contains functions. Values in the file that have an entry in this dictionary will be converted usign the matching function. Otherwise, values will be considered as hexadecimal and converted to binary. Returns: A list of test vector objects. The file is formatted in the following way: - Lines starting with "#" are comments and will be ignored. - Each test vector is a sequence of 1 or more adjacent lines, where each lines is an assignement. - Test vectors are separated by an empty line, a comment, or a line starting with "[". A test vector object has the following attributes: - desc (string): description - counter (int): the order of the test vector in the file (from 1) - others (list): zero or more lines of the test vector that were not assignments - left-hand side of each assignment (lowercase): the value of the assignement, either converted or bytes. Nz test ()%Warning: skipping extended tests for r stacklevel)test_vectors_availablererrnoENOENTosstrerrorpathdirnamepycryptodome_test_vectors__file__joinopenr4warningswarn UserWarning)r( file_namer r*r,init_dirfull_file_namer)s rload_test_vectorsrKuslLG$% /#EL$&K $=$=$-// /)4 YYY? 7??#<#EFFbgl8&Hi&H&H&H)TT . ! ! PW!)Wk;OOG P P P P P P P P P P P P P P P $$$ = K!!" $ $ $ $ $ $$ Ns6B3C"7C C"CC"CC"")D Dc Rg} ts7ttjt jtj|tjtj }tj t jj |g|R|}t|5} tj | } dddn #1swxYwYn1#t$r$tjd|zt d|cYSwxYwGddt"} i} |D]\} }|| | | <| dD]S}i}|D]\} }|||| <|dD]}| }| D]\} }t'|| ||D]\} }t'|| ||d|_|d |_d D]*}||vr$t'||t-||+||_|D]\} }t'|| || |d d k|_|d d k|_||U|S)Nr7rr8ceZdZdS)0load_test_vectors_wycheproof..TestVectorN)rrrrrrrrNs rr testGroupsteststcIdcomment) keyivaadmsgcttaglabelikmsaltinfookmsigresultinvalid acceptable)r:rr;r<r=r>r?r@rArBrCrDjsonloadrErFrGritemsr&idrRrfilenamevalidwarningr)r(rHr root_tag group_tagunit_tagr_rIrJr)tv_treer common_rootkvr" common_grouptesttvattrs rload_test_vectors_wycheproofrts>F% /#EL$&K $=$=$-// /7??#<#EFFbgl8&Hi&H&H&H)TT . ! ! )Wi((G ) ) ) ) ) ) ) ) ) ) ) ) ) ) )  = K!!" $ $ $ $       V   K  $$17 A& OO%% ' 'DAqahhLOO'N  DB#))++ " "1Aq!!!!$**,, " "1Aq!!!!LBEiBJl = =4<<BiT &;&;<<<#BK (( ( (1Aqqww''''H~2BHh<7BJ MM"    ) , Ms6B+C/C CCCCC+D  D )r=r rbr;r'rErCrypto.Util.py3compatrrAr: ImportErrorr4rKrtrrrrws> 333333#$$$$!###"#BBBJ:::|+-R888888s -77