handle the case when BN_new returns NULL