HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/cryptography/hazmat/bindings/openssl/__pycache__/binding.cpython-38.pyc
U

�>b �@s�ddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
ddlmZe�
dddd	d
g�ZGdd�de�Zd
d�Zdd�Zdd�Zddd�Zdd�ZGdd�de�Zdd�Zeej�e��dS)�N)�utils)�
InternalError)�ffi�lib)�CONDITIONAL_NAMES�_OpenSSLErrorWithText�coder�reasonZreason_textc@s:eZdZdd�Zdd�Ze�d�Ze�d�Ze�d�Z	dS)	�
_OpenSSLErrorcCs||_||_||_dS�N)�_code�_lib�_reason)�selfrrr	�r�N/usr/lib/python3/dist-packages/cryptography/hazmat/bindings/openssl/binding.py�__init__sz_OpenSSLError.__init__cCs||jko||jkSr)rr	)rrr	rrr�_lib_reason_matchsz_OpenSSLError._lib_reason_matchrr
rN)
�__name__�
__module__�__qualname__rrr�read_only_propertyrrr	rrrrr
s


r
cCsBg}|��}|dkrq>|�|�}|�|�}|�t|||��q|S)Nr)�
ERR_get_errorZERR_GET_LIBZERR_GET_REASON�appendr
)r�errorsrZerr_libZ
err_reasonrrr�_consume_errors$s

rcCsVg}|D]H}t�dd�}t�|j|t|��t�|�}|�t|j|j|j	|��q|S)Nzchar[]�)
r�newrZERR_error_string_nr�len�stringrrr	)r�errors_with_text�err�bufZerr_text_reasonrrr�_errors_with_text3s
��r#cCstt|��Sr)r#r)rrrr�_consume_errors_with_textCsr$cCs0|s,|dkrt|�}t|�}td�|�|��dS)NaiUnknown 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}))rr#r�format)r�okrr rrr�_openssl_assertGs��r'cCsjt�d�}||_t�}|��D]\}}t||�s|�|��qt|�D]}||krFt||t||��qF|S)Nr)	�types�
ModuleType�
_original_lib�set�items�getattr�update�dir�setattr)rZconditional_namesZconditional_libZexcluded_names�	conditionZnames_cb�attrrrr�build_conditional_libraryYs

r3c@sxeZdZUdZdZejed<eZdZ	e
��ZdZ
ejed<dZejed<dd�Zed	d
��Zedd��Zed
d��ZdS)�Bindingz
    OpenSSL API wrapper.
    NrF�_legacy_provider�_default_providercCs|��dSr��_ensure_ffi_initialized)rrrrrtszBinding.__init__cCs0|j��|jjr,|j��}t|j|dk�dS)N)��)rZERR_clear_errorZ"CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINEZ Cryptography_add_osrandom_enginer')�cls�resultrrr�_register_osrandom_enginews

z!Binding._register_osrandom_enginec	Cs�|j��|js�ttt�|_d|_|j��|j��|��|jjr�|j�	|j
jd�|_t
|j|j|j
jk�|j�	|j
jd�|_t
|j|j|j
jk�W5QRXdS)NTslegacysdefault)�
_init_lock�_lib_loadedr3rrZSSL_library_init�OpenSSL_add_all_algorithmsr=Z#CRYPTOGRAPHY_OPENSSL_300_OR_GREATERZOSSL_PROVIDER_loadr�NULLr5r'r6�r;rrrr8�s0

����zBinding._ensure_ffi_initializedcCs|��dSrr7rBrrr�init_static_locks�szBinding.init_static_locks)rrr�__doc__r�typing�ClassVar�__annotations__rr?�	threading�Lockr>r5�Anyr6r�classmethodr=r8rCrrrrr4hs


r4cCs.t�tj�}|�d�|kr*td�||���dS)N�asciiaThe version of cryptography does not match the loaded shared object. This can happen if you have multiple copies of cryptography installed in your Python path. Please try creating a new virtual environment to resolve this issue. Loaded python version: {}, shared object version: {})rrrZCRYPTOGRAPHY_PACKAGE_VERSION�encode�ImportErrorr%)�versionZso_package_versionrrr�_verify_package_version�s��rP)N)�collectionsrHr(rE�cryptographyr�cryptography.exceptionsrZ%cryptography.hazmat.bindings._opensslrrZ1cryptography.hazmat.bindings.openssl._conditionalr�
namedtupler�objectr
rr#r$r'r3r4rP�__version__rCrrrr�<module>s,
�
>