gost94_nid_by_params: return NID_undef if memory allocation fails

Based on suggestion by Kurt Roeckx
pub_encode_gost01: check result of BN_new() calls

Based on suggestion by Kurt Roeckx