ó Û_e[c@`sšddlmZmZmZddlmZddlmZmZm Z ddl m Z m Z ddl mZeje jƒdefd„ƒYƒZdS( i(tabsolute_importtdivisiontprint_function(tutils(tInvalidSignaturetUnsupportedAlgorithmt_Reasons(t constant_timetmac(tCBCt _CMACContextcB`sGeZdd„ZejdƒZd„Zd„Zd„Z d„Z RS(cC`sC|j|ƒs$tdtjƒ‚n||_|j|_||_|jd|_ |dkr6|jj }|t |ƒt f}||j|t ƒ}|jjjƒ}|jj||jjjkƒ|jjj||jjjƒ}|jjj||jt|jƒ||jjjƒ}|jj|dkƒn||_dS(Ns#This backend does not support CMAC.ii(tcmac_algorithm_supportedRRtUNSUPPORTED_CIPHERt_backendtkeyt_keyt _algorithmt block_sizet_output_lengthtNonet_cipher_registryttypeR t_libt CMAC_CTX_newtopenssl_assertt_ffitNULLtgct CMAC_CTX_freet CMAC_Inittlent_ctx(tselftbackendt algorithmtctxtregistrytadaptert evp_ciphertres((sQ/tmp/pip-install-KP2Jbq/cryptography/cryptography/hazmat/backends/openssl/cmac.pyt__init__s&     ! RcC`s>|jjj|j|t|ƒƒ}|jj|dkƒdS(Ni(R Rt CMAC_UpdateRRR(R tdataR'((sQ/tmp/pip-install-KP2Jbq/cryptography/cryptography/hazmat/backends/openssl/cmac.pytupdate1s$cC`s‡|jjjd|jƒ}|jjjd|jƒ}|jjj|j||ƒ}|jj|dkƒd|_|jjj |ƒS(Nsunsigned char[]ssize_t *i( R RtnewRRt CMAC_FinalRRRtbuffer(R tbuftlengthR'((sQ/tmp/pip-install-KP2Jbq/cryptography/cryptography/hazmat/backends/openssl/cmac.pytfinalize5s  cC`s}|jjjƒ}|jjj||jjjƒ}|jjj||jƒ}|jj|dkƒt |j|j d|ƒS(NiR#( R RRRRRt CMAC_CTX_copyRRR R(R t copied_ctxR'((sQ/tmp/pip-install-KP2Jbq/cryptography/cryptography/hazmat/backends/openssl/cmac.pytcopyAs  cC`s1|jƒ}tj||ƒs-tdƒ‚ndS(NsSignature did not match digest.(R1Rtbytes_eqR(R t signaturetdigest((sQ/tmp/pip-install-KP2Jbq/cryptography/cryptography/hazmat/backends/openssl/cmac.pytverifyNs N( t__name__t __module__RR(Rtread_only_propertyR"R+R1R4R8(((sQ/tmp/pip-install-KP2Jbq/cryptography/cryptography/hazmat/backends/openssl/cmac.pyR s    N(t __future__RRRt cryptographyRtcryptography.exceptionsRRRtcryptography.hazmat.primitivesRRt,cryptography.hazmat.primitives.ciphers.modesR tregister_interfacet MACContexttobjectR (((sQ/tmp/pip-install-KP2Jbq/cryptography/cryptography/hazmat/backends/openssl/cmac.pyts