# 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
import pytest
        >>> plaintext += dec.finalize()
        >>> plaintext == ref # Check resulting plaintest matches referece one.
        True

    """

    __slots__ = ["alg", "gcm"]

    def __init__(self, name, _alg=None):
        """Initialize the cipher by name."""

        if _alg:
            self.alg = _alg
            self.gcm = True
            return
        else:

            self.alg = _C.EVP_get_cipherbyname(name.encode("utf8"))
            self.gcm = False
            if self.alg == _FFI.NULL:
                raise Exception("Unknown cipher: %s" % name)

        if "gcm" in name.lower():
            self.gcm = True

        if "ccm" in name.lower():
            raise Exception("CCM mode not supported")

    def len_IV(self):
        """Return the Initialization Vector length in bytes."""

# 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/cipher.py
from .bindings import _FFI, _C, _OPENSSL_VERSION, OpenSSLVersion
import pytest

        >>> plaintext += dec.finalize()
        >>> plaintext == ref # Check resulting plaintest matches referece one.
        True

    """

    __slots__ = ["alg", "gcm"]

    def __init__(self, name, _alg=None):
        """Initialize the cipher by name."""

        if _alg:
            self.alg = _alg
            self.gcm = True
            return
        else:

            self.alg = _C.EVP_get_cipherbyname(name.encode("utf8"))
            self.gcm = False
            if self.alg == _FFI.NULL:
                raise Exception("Unknown cipher: %s" % name)

        if "gcm" in name.lower():
            self.gcm = True

        if "ccm" in name.lower():
            raise Exception("CCM mode not supported")

    def len_IV(self):
        """Return the Initialization Vector length in bytes."""

        if _OPENSSL_VERSION == OpenSSLVersion.V1_0: