Changeset 133


Ignore:
Timestamp:
10/24/17 12:09:55 (7 years ago)
Author:
tim
Message:

fixed segfault in certificate cloning. now using pyopenssl's cffi object for interfacing with the C library

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/bletchley/ssltls.py

    r131 r133  
    214214    https://github.com/pyca/pyopenssl/issues/152
    215215    '''
    216     ffi = cffi.FFI()
    217     ffi.cdef('''void* X509_delete_ext(void* x, int loc);''')
    218 
     216    from OpenSSL._util import lib as libssl
     217
     218    #ffi = cffi.FFI()
     219    #ffi.cdef('''void* X509_delete_ext(void* x, int loc);''')
     220    #ffi.cdef('''int X509_get_ext_count(const void* x);''')
     221   
    219222    # Try to load libssl using several recent names because package
    220223    # maintainers have the blinders on and don't have a universal
    221224    # symlink to the most recent version.
    222     libssl = None
    223     for libname in ('libssl.so','libssl.so.1.0.2', 'libssl.so.1.0.1', 'libssl.so.1.0.0','libssl.so.0.9.8'):
    224         try:
    225             libssl = ffi.dlopen(libname)
    226             break
    227         except OSError as e:
    228             pass
    229    
     225   
     226    #libssl = None
     227    #for libname in ('libssl.so','libssl.so.1.0.2', 'libssl.so.1.0.1', 'libssl.so.1.0.0','libssl.so.0.9.8'):
     228    #    try:
     229    #        libssl = ffi.dlopen(libname)
     230    #        break
     231    #    except OSError as e:
     232    #        pass
     233
     234    #print(certificate._x509, index)
     235    #print(libssl.X509_get_ext_count(certificate._x509))
    230236    ext = libssl.X509_delete_ext(certificate._x509, index)
    231237    #XXX: memory leak.  supposed to free ext here
Note: See TracChangeset for help on using the changeset viewer.