cffi 1.9.1 crashing with Segmentation fault 11 under python 3 but not 2
Created originally on Bitbucket by bsder (Andrew Lentvorski)
I'm on OS X 10.11.6 with both pythons and cffi installed via homebrew. Python 2.7.13 and Python 3.6.0--pip used to install cffi 1.9.1
My code works under Python2 but crashes reliably at the same point under Python3.
Code in question:
def check_ccm(self, kk, nn, ad, pt, ct, mm):
lggr.info("check...")
ffi = FFI()
lggr.info("ffi A...")
ffi.cdef("""
typedef int32_t (*tpf_ecb_aes_encrypt) (const uint8_t * pu8_plaintext, const uint8_t * pu8_key, uint8_t * pu8_ciphertext);
int32_t aes_ecb_block_encrypt(const uint8_t * pu8_plain, const uint8_t * pu8_key, uint8_t * pu8_cipher);
int ccm_init(tpf_ecb_aes_encrypt pf_ecb_aes_encrypt);
int ccm_deinit(void);
int ccm_auth_encrypt(uint8_t* pu8_plaintxt, uint16_t u16_plaintxt_sz, uint8_t* pu8_aad, uint16_t u16_aad_sz, uint8_t* pu8_key,
uint8_t* pu8_nonce, uint8_t u8_mac_sz, uint8_t* pu8_encr_mac, uint8_t* pu8_ciphertxt);
""")
lggr.info("cdef A...")
Result:
INFO:__main__:Starting: ccm_000...
INFO:__main__:ffi0...
INFO:__main__:aad
INFO:__main__:check...
INFO:__main__:ffi A...
Segmentation fault: 11