관리-도구
편집 파일: poly1305.cpython-36.pyc
3 y�_s � @ sH d dl mZmZmZ d dlmZ d dlmZ dZdZ G dd� de �ZdS ) � )�absolute_import�division�print_function)�InvalidSignature)� constant_time� � c @ s, e Zd Zdd� Zdd� Zdd� Zdd� Zd S ) �_Poly1305Contextc C s� || _ | j jj|�}| j jj| j jj| j jj|t|��}| j j|| j jjk� | j jj || j jj �| _| j jj� }| j j|| j jjk� | j jj || j jj �| _| j jj| j| j jj| j jj| j jj| j�}| j j|dk� d S )N� )�_backend�_ffi�from_buffer�_libZEVP_PKEY_new_raw_private_keyZNID_poly1305ZNULL�len�openssl_assert�gcZ EVP_PKEY_freeZ _evp_pkeyZCryptography_EVP_MD_CTX_newZCryptography_EVP_MD_CTX_free�_ctxZEVP_DigestSignInit)�selfZbackend�keyZkey_ptrZevp_pkeyZctx�res� r � /usr/lib64/python3.6/poly1305.py�__init__ s* z_Poly1305Context.__init__c C s: | j jj|�}| j jj| j|t|��}| j j|dk� d S )Nr )r r r r ZEVP_DigestSignUpdater r r )r �dataZdata_ptrr r r r �update/ s z_Poly1305Context.updatec C sp | j jjdt�}| j jjd�}| j jj| j||�}| j j|dk� | j j|d tk� | j jj|�d |d � S )Nzunsigned char[]zsize_t *r ) r r �new�_POLY1305_TAG_SIZEr ZEVP_DigestSignFinalr r �buffer)r ZbufZoutlenr r r r �finalize6 s z_Poly1305Context.finalizec C s | j � }tj||�std��d S )Nz!Value did not match computed tag.)r r Zbytes_eqr )r �tagZmacr r r �verify>