BIO_puts(out, ":");
nid = groups[i];
const char *name = SSL_group_to_name(s, nid);
- BIO_puts(out, ((name != NULL) ? name : "(null)"));
+ if (name == NULL)
+ BIO_printf(out, "%d", nid);
+ else
+ BIO_puts(out, name);
}
OPENSSL_free(groups);
if (noshared) {
BIO_puts(out, ":");
nid = SSL_get_shared_group(s, i);
const char *name = SSL_group_to_name(s, nid);
- BIO_puts(out, ((name != NULL) ? name : "(null)"));
+ if (name == NULL)
+ BIO_printf(out, "%d", nid);
+ else
+ BIO_puts(out, name);
}
if (ngroups == 0)
BIO_puts(out, "NONE");
EVP_PKEY *key;
if (!SSL_get_peer_tmp_key(s, &key)) {
- if (SSL_version(s) == TLS1_3_VERSION)
- BIO_printf(out, "Negotiated TLS1.3 group: %s\n",
- SSL_group_to_name(s, SSL_get_negotiated_group(s)));
+ if (SSL_version(s) == TLS1_3_VERSION) {
+ int nid = SSL_get_negotiated_group(s);
+ const char *name = SSL_group_to_name(s, nid);
+
+ if (name == NULL)
+ BIO_printf(out, "Negotiated TLS1.3 group: %d\n", nid);
+ else
+ BIO_printf(out, "Negotiated TLS1.3 group: %s\n", name);
+ }
return 1;
}
estat = SSL_ech_get1_status(s, &inner, &outer);
print_ech_status(bio, s, estat);
if (estat == SSL_ECH_STATUS_SUCCESS) {
- BIO_printf(bio, "ECH: inner: %s\n", inner);
- BIO_printf(bio, "ECH: outer: %s\n", outer);
+ BIO_printf(bio, "ECH: inner: %s\n", inner == NULL ? "<NULL>" : inner);
+ BIO_printf(bio, "ECH: outer: %s\n", outer == NULL ? "<NULL>" : outer);
}
if (estat == SSL_ECH_STATUS_FAILED_ECH
|| estat == SSL_ECH_STATUS_FAILED_ECH_BAD_NAME)
BIO *BIO_new_file(const char *filename, const char *mode)
{
BIO *ret;
- FILE *file = openssl_fopen(filename, mode);
+ FILE *file;
int fp_flags = BIO_CLOSE;
if (strchr(mode, 'b') == NULL)
fp_flags |= BIO_FP_TEXT;
+ if (filename == NULL) {
+ ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER, __func__);
+ return NULL;
+ }
+
+ file = openssl_fopen(filename, mode);
if (file == NULL) {
ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
"calling fopen(%s, %s)",
if (!(num & BIO_FP_TEXT))
OPENSSL_strlcat(p, "b", sizeof(p));
#endif
+ if (ptr == NULL) {
+ ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER, __func__);
+ ret = 0;
+ break;
+ }
fp = openssl_fopen(ptr, p);
if (fp == NULL) {
ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
void test_output_bignum(const char *name, const BIGNUM *bn)
{
if (bn == NULL || BN_is_zero(bn)) {
- test_printf_stderr("bignum: '%s' = %s\n", name,
+ test_printf_stderr("bignum: '%s' = %s\n",
+ name == NULL ? "<NULL>" : name,
test_bignum_zero_null(bn));
} else if (BN_num_bytes(bn) <= BN_OUTPUT_SIZE) {
unsigned char buf[BN_OUTPUT_SIZE];
hex_convert_memory(buf, n, p, BN_OUTPUT_SIZE);
while (*p == '0' && *++p != '\0')
;
- test_printf_stderr("bignum: '%s' = %s0x%s\n", name,
+ test_printf_stderr("bignum: '%s' = %s0x%s\n",
+ name == NULL ? "<NULL>" : name,
BN_is_negative(bn) ? "-" : "", p);
} else {
test_fail_bignum_common("bignum", NULL, 0, NULL, NULL, NULL, name,