int i;
const SSL_CONNECTION *sc = SSL_CONNECTION_FROM_CONST_SSL(s);
- if (sc == NULL)
+ if (size < 2 || buf == NULL)
return NULL;
- if (!sc->server
- || sc->peer_ciphers == NULL
- || size < 2)
+ buf[0] = '\0';
+
+ if (sc == NULL || !sc->server)
return NULL;
p = buf;
clntsk = sc->peer_ciphers;
srvrsk = SSL_get_ciphers(s);
- if (clntsk == NULL || srvrsk == NULL)
- return NULL;
- if (sk_SSL_CIPHER_num(clntsk) == 0 || sk_SSL_CIPHER_num(srvrsk) == 0)
- return NULL;
+ if (clntsk == NULL || sk_SSL_CIPHER_num(clntsk) == 0
+ || srvrsk == NULL || sk_SSL_CIPHER_num(srvrsk) == 0)
+ return buf;
for (i = 0; i < sk_SSL_CIPHER_num(clntsk); i++) {
int n;
}
/* No overlap */
- if (p == buf)
- return NULL;
+ if (p != buf)
+ p[-1] = '\0';
- p[-1] = '\0';
return buf;
}
NULL,
"AES128-SHA",
"AES128-SHA" },
+ { TLS1_2_VERSION,
+ "AES256-SHA",
+ NULL,
+ "AES128-SHA",
+ NULL,
+ "",
+ "" },
#endif
/*
* This test combines TLSv1.3 and TLSv1.2 ciphersuites so they must both be
"TLS_AES_256_GCM_SHA384",
"TLS_AES_256_GCM_SHA384",
"TLS_AES_256_GCM_SHA384" },
+ { TLS1_3_VERSION,
+ "AES128-SHA",
+ "TLS_AES_128_GCM_SHA256",
+ "AES256-SHA",
+ "TLS_AES_256_GCM_SHA384",
+ "",
+ "" },
#endif
};
int testresult = 0;
char buf[1024];
OSSL_LIB_CTX *tmplibctx = OSSL_LIB_CTX_new();
+ const char *expbuf = is_fips ? shared_ciphers_data[tst].fipsshared
+ : shared_ciphers_data[tst].shared;
+ int handshakeok = strcmp(expbuf, "") != 0;
if (!TEST_ptr(tmplibctx))
goto end;
shared_ciphers_data[tst].srvrtls13ciphers))))
goto end;
- if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl,
- NULL, NULL))
- || !TEST_true(create_ssl_connection(serverssl, clientssl,
- SSL_ERROR_NONE)))
+ if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL,
+ NULL)))
goto end;
+ if (handshakeok) {
+ if (!TEST_true(create_ssl_connection(serverssl, clientssl,
+ SSL_ERROR_NONE)))
+ goto end;
+ } else {
+ if (!TEST_false(create_ssl_connection(serverssl, clientssl,
+ SSL_ERROR_NONE)))
+ goto end;
+ }
+
if (!TEST_ptr(SSL_get_shared_ciphers(serverssl, buf, sizeof(buf)))
- || !TEST_int_eq(strcmp(buf,
- is_fips
- ? shared_ciphers_data[tst].fipsshared
- : shared_ciphers_data[tst].shared),
- 0)) {
+ || !TEST_int_eq(strcmp(buf, expbuf), 0)) {
TEST_info("Shared ciphers are: %s\n", buf);
goto end;
}