Revert all changes unrelated to the new *client_CA* functionality.
diff --git a/src/ssl/context.c b/src/ssl/context.c
index a3d798e..d03e92c 100644
--- a/src/ssl/context.c
+++ b/src/ssl/context.c
@@ -347,17 +347,11 @@
 static PyTypeObject *
 import_crypto_type(const char *name, size_t objsize)
 {
-    PyObject *module, *type;
+    PyObject *module, *type, *name_attr;
     PyTypeObject *res;
-    char modname[] = "OpenSSL.crypto";
-    char buffer[256] = "OpenSSL.crypto.";
+    int right_name;
 
-    if (strlen(buffer) + strlen(name) >= sizeof(buffer)) {
-        PyErr_BadInternalCall();
-        return NULL;
-    }
-    strcat(buffer, name);
-    module = PyImport_ImportModule(modname);
+    module = PyImport_ImportModule("OpenSSL.crypto");
     if (module == NULL) {
         return NULL;
     }
@@ -370,8 +364,16 @@
         Py_DECREF(type);
         return type_modified_error(name);
     }
+    name_attr = PyObject_GetAttrString(type, "__name__");
+    if (name_attr == NULL) {
+        Py_DECREF(type);
+        return NULL;
+    }
+    right_name = (PyString_CheckExact(name_attr) &&
+                  strcmp(name, PyString_AsString(name_attr)) == 0);
+    Py_DECREF(name_attr);
     res = (PyTypeObject *)type;
-    if (strcmp(buffer, res->tp_name) != 0 || res->tp_basicsize != objsize) {
+    if (!right_name || res->tp_basicsize != objsize) {
         Py_DECREF(type);
         return type_modified_error(name);
     }