File: //usr/lib64/python3.9/site-packages/ntp/__pycache__/ntpc.cpython-39.pyo
a
\��dh � @ s� d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl Z
dZdd� Zdd� Z
d d
� Ze
� Zej�ed�Zej�ed�jZej�ed
�jZej�ed�jZdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� ZejZ de _!ejejge _"ej#Z$de$_!ejge$_"ej%Z&eje&_!ejge&_"ej'Z(ej)e(_!ejge(_"ejZ*eje*_!ejejge*_"ej+Z,ej-e,_!ej)ge,_"ej.Z/ej-e/_!ej)ge/_"dS )z#Access libntp funtions from Python.� )�absolute_importNZntpcc C s4 t j�d�rdS t j�d�r dS t j�d�r0dS dS )zProduce library naming scheme.�darwinzlib%s.dylibZwin32z%s.dll�cygwinz lib%s.dllzlib%s.so)�sys�platform�
startswith� r r �./usr/lib64/python3.9/site-packages/ntp/ntpc.py�_fmt s r
c C sX g } t �tj�dd� }| �tj�|t� t g �� tj �
t�}|rP| �|� t| �S )z1Load the ntpc library or throw an OSError trying.N���)�__file__�split�os�sep�append�joinr
�LIB�ctypes�utilZfind_library�_dlo)Z
ntpc_paths�j� ntpc_pathr r r �
_importado s
r c C s~ | D ]h}zPt j|dd�}d}tj�t j�|d�j�}||krPtj �
d||f � |W S tyj Y q0 qtdt ��dS )z Try opening library from a list.T)Z use_errnoz1.2.2a�versionz$ntp.ntpc wrong version '%s' != '%s'
zCan't find %s libraryN)
r ZCDLL�ntp�poly�polystr�c_char_p�in_dll�valuer �stderr�write�OSErrorr )�pathsr �libZwrap_versionZclib_versionr r r r ) s
r �prognameZSYS_TYPEZ PEER_TYPEZ
CLOCK_TYPEc C s, t jtj_tj�| �}t jgtj_ t�|�S )z(Check if name is a valid algorithm name.)
r �c_int�_ntpcZdo_checkname�restyper r � polybytesr �argtypes)�name� mid_bytesr r r � checknameD s
r- c C s~ t �� }t jd � }d|_dtj_t�tj� |�tj� | �t
| �tj� |�t
|�t �|�t �|�� tj� t|�d|j� �S )z8Compute HMAC or CMAC from data, key, and algorithm name.�@ s@ N)
r Zc_size_tZc_ubyter r'