a ¹að ã @ sÔ d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlmZ d dlm Z m Z d dlmZ e dg d¢¡ZG dd „ d eƒZd d„ Zdd „ Zdd„ Zddd„Zdd„ ZG dd„ deƒZdd„ Zeejƒ e ¡ dS )é N)Úutils)Ú InternalError)ÚffiÚlib)ÚCONDITIONAL_NAMESÚ_OpenSSLErrorWithText)Úcoder ÚreasonZreason_textc @ s: e Zd Zdd„ Zdd„ Ze d¡Ze d¡Ze d¡Z dS ) Ú _OpenSSLErrorc C s || _ || _|| _d S ©N)Ú_codeÚ_libÚ_reason)Úselfr r r © r úR/usr/lib64/python3.9/site-packages/cryptography/hazmat/bindings/openssl/binding.pyÚ__init__ s z_OpenSSLError.__init__c C s || j ko|| jkS r )r r )r r r r r r Ú_lib_reason_match s z_OpenSSLError._lib_reason_matchr r r N) Ú__name__Ú __module__Ú__qualname__r r r Zread_only_propertyr r r r r r r r s r c C sB g }| ¡ }|dkrq>| |¡}| |¡}| t|||ƒ¡ q|S )Nr )Z ERR_get_errorZERR_GET_LIBZERR_GET_REASONÚappendr )r Úerrorsr Zerr_libZ err_reasonr r r Ú_consume_errors$ s r c C sV g }| D ]H}t dd¡}t |j|t|ƒ¡ t |¡}| t|j|j|j |ƒ¡ q|S )Nzchar[]é ) r Únewr ZERR_error_string_nr ÚlenÚstringr r r )r Úerrors_with_textÚerrÚbufZerr_text_reasonr r r Ú_errors_with_text3 s ÿÿr! c C s t t| ƒƒS r )r! r )r r r r Ú_consume_errors_with_textC s r" c C s0 |s,|d u rt | ƒ}t|ƒ}td |¡|ƒ‚d S )Nai Unknown OpenSSL error. This error is commonly encountered when another library is not cleaning up the OpenSSL error stack. If you are using cryptography with another library that uses OpenSSL try disabling it before reporting a bug. Otherwise please file an issue at https://github.com/pyca/cryptography/issues with information on how to reproduce this. ({0!r}))r r! r Úformat)r Úokr r r r r Ú_openssl_assertG s úør% c C sj t d¡}| |_tƒ }| ¡ D ]\}}t| |ƒs| |ƒ ¡ qt| ƒD ]}||vrFt||t| |ƒƒ qF|S )Nr ) ÚtypesÚ ModuleTypeZ _original_libÚsetÚitemsÚgetattrÚupdateÚdirÚsetattr)r Zconditional_namesZconditional_libZexcluded_namesZ conditionZnames_cbÚattrr r r Úbuild_conditional_libraryY s r/ c @ s€ e Zd ZU dZdZejed<