HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/cryptography/hazmat/bindings/openssl/__pycache__/binding.cpython-38.pyc
U

�e�]��@s�ddlmZmZmZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
mZddlmZe�ddd	d
ddg�ZGd
d�de�Zdd�Zdd�Zdd�ZGdd�de�Zdd�Zdd�Zeej�e��eej�dS)�)�absolute_import�division�print_functionN)�utils)�
InternalError)�ffi�lib)�CONDITIONAL_NAMES�_OpenSSLErrorWithText�coder�func�reasonZreason_textc@sDeZdZdd�Zdd�Ze�d�Ze�d�Ze�d�Z	e�d�Z
d	S)
�
_OpenSSLErrorcCs||_||_||_||_dS�N)�_code�_lib�_func�_reason)�selfrrrr
�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_matchrrrrN)�__name__�
__module__�__qualname__rrrZread_only_propertyrrrr
rrrrrs


rcCsNg}|��}|dkrqJ|�|�}|�|�}|�|�}|�t||||��q|S)Nr)Z
ERR_get_errorZERR_GET_LIBZERR_GET_FUNCZERR_GET_REASON�appendr)r�errorsrZerr_libZerr_funcZ
err_reasonrrr�_consume_errors's


rc	Csv|srt|�}g}|D]L}t�dd�}|�|j|t|��t�|�}|�t|j|j	|j
|j|��qtd�
|�|��dS)Nzchar[]�aiUnknown 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�newZERR_error_string_nr�len�stringrr
rrr
r�format)r�okrZerrors_with_text�errZbufZerr_text_reasonrrr�_openssl_assert7s,
����r&cCsjt�d�}||_t�}|��D]\}}t||�s|�|��qt|�D]}||krFt||t||��qF|S)Nr)	�types�
ModuleTypeZ
_original_lib�set�items�getattr�update�dir�setattr)rZconditional_namesZconditional_libZexcluded_namesZ	conditionZnames_cb�attrrrr�build_conditional_libraryRs

r0c@sXeZdZdZdZeZdZe��Z	e��Z
dd�Zedd��Z
edd	��Zed
d��ZdS)�Bindingz
    OpenSSL API wrapper.
    NFcCs|��dSr)�_ensure_ffi_initialized)rrrrrkszBinding.__init__cCs0|j��|jjr,|j��}t|j|dk�dS)N)��)rZERR_clear_errorZCryptography_HAS_ENGINEZ Cryptography_add_osrandom_enginer&)�cls�resultrrr�_register_osrandom_enginens

z!Binding._register_osrandom_enginec	CsT|j�D|jsFttt�|_d|_|j��|j��|j��|��W5QRXdS)NT)	�
_init_lock�_lib_loadedr0rr	ZSSL_library_initZOpenSSL_add_all_algorithmsZSSL_load_error_stringsr7)r5rrrr2zs


zBinding._ensure_ffi_initializedc	Csf|j�V|��td�|jjr2|j��|jjkr@W5QR�dSt��}t	|j|dk�W5QRXdS)NZ_sslr3)
�_lock_init_lockr2�
__import__rZ"Cryptography_HAS_LOCKING_CALLBACKSZCRYPTO_get_locking_callbackrZNULLZCryptography_setup_ssl_threadsr&)r5�resrrr�init_static_locks�s�zBinding.init_static_locks)rrr�__doc__rrr9�	threadingZLockr8r:r�classmethodr7r2r=rrrrr1as


r1cCs|jr|jst�dtj�dS)Nz�OpenSSL version 1.0.1 is no longer supported by the OpenSSL project, please upgrade. The next version of cryptography will drop support for it.)Z"CRYPTOGRAPHY_OPENSSL_LESS_THAN_102ZCRYPTOGRAPHY_IS_LIBRESSL�warnings�warnrZCryptographyDeprecationWarning)rrrr�_verify_openssl_version�s���rCcCs.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: {})rr"rZCRYPTOGRAPHY_PACKAGE_VERSION�encode�ImportErrorr#)�versionZso_package_versionrrr�_verify_package_version�s��rH)Z
__future__rrr�collectionsr?r'rAZcryptographyrZcryptography.exceptionsrZ%cryptography.hazmat.bindings._opensslrrZ1cryptography.hazmat.bindings.openssl._conditionalr	�
namedtupler
�objectrrr&r0r1rCrH�__version__r=rrrr�<module>s.�9