Commit 374fc66b authored by Oleksii Beketov's avatar Oleksii Beketov Committed by Randeep

Ssladapter unit tests update

Ssladapter unit tests updated to correspond new ciphersuites list

Change-Id: I0f4a6327f0eb9aa6038974db89a8b3bb2c6814c3
Signed-off-by: default avatarOleksii Beketov <ol.beketov@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16323Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: default avatarChul Lee <chuls.lee@samsung.com>
Reviewed-by: Randeep's avatarRandeep Singh <randeep.s@samsung.com>
parent eb93a876
......@@ -971,7 +971,7 @@ static void socketConnect()
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
error("ERROR opening socket");
server = gethostbyname(SERVER_NAME);
server = gethostbyname2(SERVER_NAME, AF_INET);
if (server == NULL) {
fprintf(stderr,"ERROR, no such host\n");
exit(0);
......@@ -1212,6 +1212,7 @@ static void * client(void *)
mbedtls_ssl_init( &ssl );
mbedtls_ssl_config_init( &conf );
mbedtls_x509_crt_init( &cacert );
mbedtls_x509_crt_init( &owncert );
mbedtls_ctr_drbg_init( &ctr_drbg );
mbedtls_pk_init( &pkey );
......@@ -1983,13 +1984,13 @@ TEST(TLSAdaper, Test_2)
* *************************/
unsigned char predictedClientHello[] = {
0x16, 0x03, 0x01, 0x00, 0x63, 0x01, 0x00, 0x00, 0x5f, 0x03, 0x03, 0x57, 0xf2, 0x5f, 0x21, 0x04,
0x16, 0x03, 0x03, 0x00, 0x61, 0x01, 0x00, 0x00, 0x5d, 0x03, 0x03, 0x58, 0x74, 0xba, 0x3f, 0x04,
0xb1, 0x3b, 0xda, 0x55, 0xa4, 0x8e, 0xcc, 0x3f, 0xe9, 0x45, 0x5c, 0xaf, 0xcb, 0x19, 0x2e, 0x1f,
0x4b, 0xd5, 0x84, 0x5c, 0x4b, 0xd7, 0x7d, 0x38, 0xa2, 0xfa, 0x3d, 0x00, 0x00, 0x06, 0xc0, 0xac,
0xc0, 0xae, 0x00, 0xff, 0x01, 0x00, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x16, 0x00, 0x14, 0x06, 0x03,
0x06, 0x01, 0x05, 0x03, 0x05, 0x01, 0x04, 0x03, 0x04, 0x01, 0x03, 0x03, 0x03, 0x01, 0x02, 0x03,
0x02, 0x01, 0x00, 0x0a, 0x00, 0x04, 0x00, 0x02, 0x00, 0x17, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00,
0x00, 0x16, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00
0x4b, 0xd5, 0x84, 0x5c, 0x4b, 0xd7, 0x7d, 0x38, 0xa2, 0xfa, 0x3d, 0x00, 0x00, 0x04, 0xc0, 0xac,
0x00, 0xff, 0x01, 0x00, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x16, 0x00, 0x14, 0x06, 0x03, 0x06, 0x01,
0x05, 0x03, 0x05, 0x01, 0x04, 0x03, 0x04, 0x01, 0x03, 0x03, 0x03, 0x01, 0x02, 0x03, 0x02, 0x01,
0x00, 0x0a, 0x00, 0x04, 0x00, 0x02, 0x00, 0x17, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, 0x00, 0x16,
0x00, 0x00, 0x00, 0x17, 0x00, 0x00
};
static unsigned char controlBuf[sizeof(predictedClientHello)];
static char controlBufLen = 0;
......@@ -2974,6 +2975,12 @@ static int testCAsetTlsCipherSuite()
ret += 1;
}
status = CAsetTlsCipherSuite(MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256);
if (SSL_RSA_WITH_AES_128_GCM_SHA256 != g_caSslContext->cipher || status != CA_STATUS_OK)
{
ret += 1;
}
status = CAsetTlsCipherSuite(MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256);
if (SSL_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 != g_caSslContext->cipher || status != CA_STATUS_OK)
{
......@@ -3015,14 +3022,14 @@ static int testCAsetTlsCipherSuite()
ret += 1;
}
status = CAsetTlsCipherSuite(MBEDTLS_TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256);
if (SSL_ECDH_ANON_WITH_AES_128_CBC_SHA256 != g_caSslContext->cipher || status != CA_STATUS_OK)
status = CAsetTlsCipherSuite(MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256);
if (SSL_ECDHE_RSA_WITH_AES_128_CBC_SHA256 != g_caSslContext->cipher || status != CA_STATUS_OK)
{
ret += 1;
}
status = CAsetTlsCipherSuite(dummyHandler);
if (CA_STATUS_FAILED != status)
status = CAsetTlsCipherSuite(MBEDTLS_TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256);
if (SSL_ECDH_ANON_WITH_AES_128_CBC_SHA256 != g_caSslContext->cipher || status != CA_STATUS_OK)
{
ret += 1;
}
......@@ -3125,6 +3132,7 @@ static void * testCAsslGenerateOwnerPsk(void * arg)
g_getCredentialTypesCallback = clutch;
CAsetTlsCipherSuite(MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256);
g_caSslContext->selectedCipher = MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256;
CAsetPskCredentialsCallback(GetDtlsPskCredentials);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment