[pypy-commit] pypy openssl-1.1: There are builtins for this

stefanor pypy.commits at gmail.com
Fri Oct 28 19:36:15 EDT 2016


Author: Stefano Rivera <stefano at rivera.za.net>
Branch: openssl-1.1
Changeset: r87981:4858b6983f08
Date: 2016-10-28 15:34 -0700
http://bitbucket.org/pypy/pypy/changeset/4858b6983f08/

Log:	There are builtins for this

diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py
--- a/pypy/module/_ssl/interp_ssl.py
+++ b/pypy/module/_ssl/interp_ssl.py
@@ -647,7 +647,7 @@
         method_type = intmask(libssl_COMP_get_type(comp_method))
         if method_type == NID_undef:
             return space.w_None
-        short_name = libssl_OBJ_nid2sn(method_type)
+        short_name = libssl_COMP_get_name(comp_method)
         if not short_name:
             return space.w_None
         return space.wrap(rffi.charp2str(short_name))
diff --git a/rpython/rlib/ropenssl.py b/rpython/rlib/ropenssl.py
--- a/rpython/rlib/ropenssl.py
+++ b/rpython/rlib/ropenssl.py
@@ -60,15 +60,16 @@
         '#define pypy_DIST_POINT_fullname(obj) (obj->distpoint->name.fullname)',
         # Backwards compatibility for functions introduced in 1.1
         '#if (OPENSSL_VERSION_NUMBER < 0x10100000)',
+        '#  define COMP_get_name(meth) (meth->name)',
+        '#  define COMP_get_type(meth) (meth->type)',
+        '#  define EVP_MD_CTX_free EVP_MD_CTX_destroy',
+        '#  define EVP_MD_CTX_new EVP_MD_CTX_create',
+        '#  define TLS_method SSLv23_method',
+        '#  define X509_NAME_ENTRY_set(ne) (ne->set)',
         '#  define X509_OBJECT_get0_X509(obj) (obj->data.x509)',
         '#  define X509_OBJECT_get_type(obj) (obj->type)',
-        '#  define COMP_get_type(meth) (meth->type)',
-        '#  define X509_NAME_ENTRY_set(ne) (ne->set)',
         '#  define X509_STORE_get0_objects(store) (store->objs)',
         '#  define X509_STORE_get0_param(store) (store->param)',
-        '#  define TLS_method SSLv23_method',
-        '#  define EVP_MD_CTX_new EVP_MD_CTX_create',
-        '#  define EVP_MD_CTX_free EVP_MD_CTX_destroy',
         '#else /* (OPENSSL_VERSION_NUMBER < 0x10100000) */',
         '#  define OPENSSL_NO_SSL2',
         '#endif /* (OPENSSL_VERSION_NUMBER < 0x10100000) */',
@@ -452,6 +453,8 @@
              macro=bool(OPENSSL_VERSION_NUMBER < 0x10100000) or None)
 ssl_external('X509_OBJECT_get_type', [X509_OBJECT], rffi.INT,
              macro=bool(OPENSSL_VERSION_NUMBER < 0x10100000) or None)
+ssl_external('COMP_get_name', [COMP_METHOD], rffi.CCHARP,
+             macro=bool(OPENSSL_VERSION_NUMBER < 0x10100000) or None)
 ssl_external('COMP_get_type', [COMP_METHOD], rffi.INT,
              macro=bool(OPENSSL_VERSION_NUMBER < 0x10100000) or None)
 ssl_external('sk_DIST_POINT_num', [stack_st_DIST_POINT], rffi.INT,


More information about the pypy-commit mailing list