ff'ddlZddlZddlZddlmZddlmZejddkr=ddlZgZ ej D]&\Z Z Z e ejkre e 'n ddlmZejZ eefZGddeZ dejvrejjd kr ed dd lmZeZejZ e!e"d Z#e"d j$j%Z&dZ'dZ(e(Z)e(Z*e(Z+dZ,d,dZ-dZ.dZ/dZ0GddeZ1dZ2dZ3n#e$rddl4Z4ddl4m5Z5m6Z6m7Z7m(Z(m)Z)m,Z,m-Z-m+Z+m*Z*ddl8m9Z9ddl4m:Z&dZ gZ;dZ+dZ'dZ.dZ/e4j<Z=dZ>e4j?j@ZAe4j?jBZCe4jDZEe4jFe=ZGGd d!e4jHZId"Z0Gd#d$eZJd%Z2d&Z3YnwxYwGd'd(eZKd)ZLd*ZMd+ZNdS)-N) byte_string)pycryptodome_filename) machinerycNeZdZejdZejdZdS) _VoidPointercdS)z&Return the memory location we point toNselfs v/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Util/_raw_api.pygetz_VoidPointer.get:  cdS)z$Return a raw pointer to this pointerNr r s r address_ofz_VoidPointer.address_of?rrN)__name__ __module__ __qualname__abcabstractmethodrrr rr rr9sP rr__pypy__z0CFFI with optimize=2 fails due to pycparser bug.)FFIzconst uint8_t*z uint8_t[1]c ttdr:tjds&t|tj}nt|}t||S)zLoad a shared library and return a handle to it. @name, either an absolute path or the name of a library in the system search path. @cdecl, the C function declarations. RTLD_DEEPBINDPYCRYPTODOME_DISABLE_DEEPBIND)hasattrffiosgetenvdlopenrcdef)namecdecllibs r load_libr'Wse 3 ( ( #;Z1[1[ #**T3#455CC**T""C  rc|S)z)Convert a Python integer to unsigned longr xs r c_ulongr+grc|S)z"Convert a Python integer to size_tr r)s r c_size_tr.or,rct|trCtt|dz|}td|}||dd<n,|rt dtd|}|S)z7Allocate the given amount of bytes (initially set to 0)z uint8_t[]Nz Size must be specified once only) isinstancebytesmaxlenrnew ValueError) init_or_sizesizeresults r create_string_bufferr:ss lE * * 8s<((1,d33DWW[$//F$F111II E !CDDDWW[,77F rc6t|S)z.Convert a C string into a Python byte sequence)rstringc_strings r get_c_stringr?szz(###rcFt|ddS)z.Convert a C buffer into a Python byte sequenceN)rbufferbufs r get_raw_bufferrDszz#qqq!!rc&t|tr8ttt|St |st|tr|Stdt|zNz)Object type %s cannot be passed to C code) r1 _buffer_typercast uint8_t_type from_bufferr_Array TypeErrortype)datas r c_uint8_ptrrOsw dL ) ) V88L#//$*?*?@@ @    V*T6":": VKG$t**TUU Urc$eZdZdZdZdZdZdS)VoidPointer_cffi'Model a newly allocated pointer to voidcDtd|_dS)Nz void *[1])rr5_ppr s r __init__zVoidPointer_cffi.__init__sww{++DHHHrc|jdS)NrrTr s r rzVoidPointer_cffi.gets8A; rc|jSNrWr s r rzVoidPointer_cffi.address_ofs 8OrNrrr__doc__rUrrr rr rQrQsG55 , , ,        rrQctSrY)rQr rr VoidPointerr]s!!!rcffi) CDLLc_void_pbyrefr+ c_ulonglongr.r:c_ubytec_uint) find_library)Arraycdd|cxkrdksnttj|S)Nr) OverflowErrorctypesrc)cs r rcrcs3Q  // !~a   rcts"ddl}|tdd<t\}}d|vr:|ds%t |}|t d|z|}t |S)Nr.WinzCannot load library '%s')cached_architectureplatform architecture startswithreOSErrorr_)r$r%rpbitslinkage full_names r r'r's" = OOO%-%:%:%<%<  "+ g d??7#5#5e#<# ? ? ? ? ? $ #rr|ct|st|tr|St|trt |}t }t |t|t tj |j z}| |j tt|S#tt|wxYwtdt!|zrF)rr1rKrG _py_objectr|_PyObject_GetBufferra _PyBUF_SIMPLErjrcr4 from_addressrC_PyBuffer_ReleaserLrM)rNr}rC buffer_types r rOrOs t   V 4 8 8 VK l + + VT""C,,C U3ZZ ? ? ? .$nsw6 "//88!%**----!%**----G$t**TUU Us =-CC%c$eZdZdZdZdZdZdS)VoidPointer_ctypesrRc,t|_dSrY)r`_pr s r rUzVoidPointer_ctypes.__init__sjjDGGGrc|jSrY)rr s r rzVoidPointer_ctypes.gets 7Nrc*t|jSrY)rarr s r rzVoidPointer_ctypes.address_ofs>> !rNrZr rr rrsG55 ! ! !    " " " " "rrctSrY)rr rr r]r]s!###rrjc*eZdZdZdZdZdZdZdS) SmartPointerz+Class to hold a non-managed piece of memoryc"||_||_dSrY) _raw_pointer _destructor)r raw_pointer destructors r rUzSmartPointer.__init__ s'%rc|jSrYrr s r rzSmartPointer.gets   rc$|jdc}|_|SrYr)r rps r releasezSmartPointer.releases $ 14D  rc~ |j#||jd|_dSdS#t$rYdSwxYwrY)rrAttributeErrorr s r __del__zSmartPointer.__del__sa  ,  !2333$(!!!-,    DD s (. <<N)rrrr[rUrrrr rr rrsV55&&&!!!rrc |d}|dd|d}}g}tD]} ||z}t||}tj|s|d|zPt||cS#t$r2} |d|dt| Yd} ~ d} ~ wwxYwtd|dd |) zLoad a shared library and return a handle to it. @name, the name of the library expressed as a PyCryptodome module, for instance Crypto.Cipher._raw_cbc. @cdecl, the C function declarations. rmNrzNot found '%s'z Cannot load 'z': zCannot load native module 'z, ) splitextension_suffixesrr pathisfileappendr'rsstrjoin) r$r%r dir_compsbasenameattemptsextfilenamervexps r load_pycryptodome_raw_librs" JJsOOE*eBixIH! K K K#~H-iBBI7>>),,  08 ;<<<Iu-- - - - K K K OOOhhhCI J J J J J J J J K '$$$ (@S@S@ST U UUsA BB C(C  CcFt|tttfS)z5Return True if object x supports the buffer interface)r1r2 bytearray memoryviewr)s r is_bufferr8s a%J7 8 88rcft|tpt|to|j SrY)r1rrrr)s r is_writeable_bufferr=s/ q) $ $ ; : & & 9qz>rs> ------:::::: AJJJ))++++ S# #/ ! !  % %c * * *+ $#####"5:&      6   @111ci6HA6M6MkLMMM #%%C8L::cgg&67788L WW\ " " , 6F K FG    $$$"""VVV     <   """GGcccMMM??????????????????????((((((&&&&&&L!!!    !JM *=(9!J ++J@@@@@V%@@@& V V V" " " " " "\ " " "$$$GGGGcL6.VVV2999 <<<<