Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/Cryptodome/Cipher/__pycache__/_mode_gcm.cpython-39.pyc
Ðазад
a c�h�S � @ s� d Z dgZddlmZ ddlmZmZ ddlmZ ddl m Z mZ ddlm Z ddlmZ dd lmZmZmZmZmZmZmZ dd lmZ dZdd � Zdd� Ze� Zdd� Ze� ZG dd� de�Z dd� Z!e!ddd�Z"G dd� de�Z#dd� Z$dS )z Galois/Counter Mode (GCM). �GcmMode� )� unhexlify)�bord�_copy_bytes)� is_buffer)� long_to_bytes� bytes_to_long)�BLAKE2s)�get_random_bytes)�load_pycryptodome_raw_lib�VoidPointer�create_string_buffer�get_raw_buffer�SmartPointer�c_size_t�c_uint8_ptr)� _cpu_featuresa` int ghash_%imp%(uint8_t y_out[16], const uint8_t block_data[], size_t len, const uint8_t y_in[16], const void *exp_key); int ghash_expand_%imp%(const uint8_t h[16], void **ghash_tables); int ghash_destroy_%imp%(void *ghash_tables); c sl ddl m} d}|d|�}z� �fdd�|D �}W n tyN d gd }Y n0 tt||��}|f i |��S )Nr )� namedtuple)�ghash�ghash_expand� ghash_destroyZ _GHash_Impc s g | ]}t � |d � ��qS )�_)�getattr��.0�x��lib�postfix� ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/Cryptodome/Cipher/_mode_gcm.py� <listcomp>H � z_build_impl.<locals>.<listcomp>� )�collectionsr �AttributeError�dict�zip)r r r �funcsZ GHASH_ImpZ imp_funcs�paramsr r r �_build_implB s r* c C s$ t �dd�} td| �}t|d�}|S )N�%imp%ZportablezCryptodome.Hash._ghash_portable)�_ghash_api_template�replacer r* ��apir �resultr r r �_get_ghash_portableO s r1 c C sL t �� sdS z$t�dd�} td| �}t|d�}W n tyF d}Y n0 |S )z4Return None if CLMUL implementation is not availableNr+ ZclmulzCryptodome.Hash._ghash_clmul)r Z have_clmulr, r- r r* �OSErrorr. r r r �_get_ghash_clmulW s r3 c @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) �_GHASHa GHASH function defined in NIST SP 800-38D, Algorithm 2. If X_1, X_2, .. X_m are the blocks of input data, the function computes: X_1*H^{m} + X_2*H^{m-1} + ... + X_m*H in the Galois field GF(2^256) using the reducing polynomial (x^128 + x^7 + x^2 + x + 1). c C sf t |�dksJ �|| _t� | _|�t|�| j�� �}|rDtd| ��t| j� � |j �| _td�| _d S )N� z&Error %d while expanding the GHASH key) �len�ghash_cr �_exp_keyr r Z address_of� ValueErrorr �getr r �_last_y)�self�subkeyr7 r0 r r r �__init__r s � �z_GHASH.__init__c C sR t |�d dksJ �| j�| jt|�tt |��| j| j�� �}|rNtd| ��| S )Nr5 r zError %d while updating GHASH) r6 r7 r r; r r r8 r: r9 )r<