# Path: petlib/bindings.py
#     _FFI = ffi
#     _C = lib
#     _C = None
#     _FFI = None
#     _OPENSSL_VERSION = get_openssl_version(_C)
#     _OPENSSL_VERSION = OpenSSLVersion.V1_1
#     POINT_CONVERSION_COMPRESSED = 2,
#     POINT_CONVERSION_UNCOMPRESSED = 4,
#     POINT_CONVERSION_HYBRID = 6
#     G = EcGroup()
# class Const:
# class InitCiphers(object):
# def version():
# def get_errors():
#     def __init__(self):
#     def __del__(self):
# def test_double_load():
# def test_version():
# def test_errors():
# def test_locks():
# def test_multithread():
#     def worker():


from .bindings import _FFI, _C, _OPENSSL_VERSION, OpenSSLVersion
from binascii import hexlify
import pytest




def _check(return_val):
    """Checks the return code of the C calls"""
    if isinstance(return_val, int) and return_val == 1:
        return
    if isinstance(return_val, bool) and return_val == True:
        return

    raise Exception("HMAC exception")


def secure_compare(a1, a2):
    """A constant-time comparison function. Returns True if the two strings are equal and False otherwise.

    Args:
        a1 (str): the first string
        a2 (str): the second string

    Returns:
        bool: whether the two stings are equal.
    """
    _check(isinstance(a1, type(a2)))

    if len(a1) != len(a2):
        return False


# Path: petlib/bindings.py
#     _FFI = ffi
#     _C = lib
#     _C = None
#     _FFI = None
#     _OPENSSL_VERSION = get_openssl_version(_C)
#     _OPENSSL_VERSION = OpenSSLVersion.V1_1
#     POINT_CONVERSION_COMPRESSED = 2,
#     POINT_CONVERSION_UNCOMPRESSED = 4,
#     POINT_CONVERSION_HYBRID = 6
#     G = EcGroup()
# class Const:
# class InitCiphers(object):
# def version():
# def get_errors():
#     def __init__(self):
#     def __del__(self):
# def test_double_load():
# def test_version():
# def test_errors():
# def test_locks():
# def test_multithread():
#     def worker():


# Path: petlib/hmac.py
from .bindings import _FFI, _C, _OPENSSL_VERSION, OpenSSLVersion
from binascii import hexlify
import pytest





def _check(return_val):
    """Checks the return code of the C calls"""
    if isinstance(return_val, int) and return_val == 1:
        return
    if isinstance(return_val, bool) and return_val == True:
        return

    raise Exception("HMAC exception")


def secure_compare(a1, a2):
    """A constant-time comparison function. Returns True if the two strings are equal and False otherwise.

    Args:
        a1 (str): the first string
        a2 (str): the second string

    Returns:
        bool: whether the two stings are equal.
    """
    _check(isinstance(a1, type(a2)))

    if len(a1) != len(a2):
        return False


    x = _C.CRYPTO_memcmp(a1, a2, len(a1))