a a! @ s@ d dl Z d dlmZ d dlmZ d dlmZ G dd deZdS ) N)utils)AlreadyFinalized)ciphersc @ s^ e Zd ZdejejdddZeddddZ edd d Z edddd Zd dddZdS )CMACN) algorithmbackendc C sH t |tjstd|| _|d u r>ddlm} || j| _n|| _d S )Nz*Expected instance of BlockCipherAlgorithm.r )r ) isinstancer BlockCipherAlgorithm TypeError _algorithmZ,cryptography.hazmat.backends.openssl.backendr Zcreate_cmac_ctx_ctx)selfr r ctxZossl r I/usr/lib64/python3.9/site-packages/cryptography/hazmat/primitives/cmac.py__init__ s z CMAC.__init__)datareturnc C s. | j d u rtdtd| | j | d S )NContext was already finalized.r )r r r _check_bytesupdate)r r r r r r # s zCMAC.update)r c C s&