添加ssl_cipher_suites_convert函数

This commit is contained in:
崔一鸣
2019-05-24 23:15:58 +08:00
parent 4bac00157b
commit 72d170aec2
3 changed files with 233 additions and 5 deletions

View File

@@ -50,6 +50,7 @@ int ssl2_test(){
printf("\n\n");
ssl_chello_free(chello);
chello = NULL;
return 0;
}
int ssl3_test(){
@@ -77,6 +78,7 @@ int ssl3_test(){
printf("\n\n");
ssl_chello_free(chello1);
chello1 = NULL;
return 0;
}
int tls12_test(){
@@ -108,11 +110,16 @@ int tls12_test(){
unsigned char cipher_suites[1024];
memcpy(cipher_suites, chello->cipher_suites, chello->cipher_suites_len);
printf("cipher suites: \n", chello->cipher_suites);
char target_common[1024], target_tls13[1024];
ssl_cipher_suites_convert(chello->cipher_suites, chello->cipher_suites_len, target_common, target_tls13);
printf("cipher suites: \n");
for(int i = 0; i < chello->cipher_suites_len; i++){
printf("0x%02x ", cipher_suites[i]);
}
printf("\n");
printf("target_common: %s\n", target_common);
printf("target_tls13: %s\n", target_tls13);
printf("\n");
printf("sni: %s\n", chello->sni);
@@ -145,7 +152,7 @@ int tls12_test(){
}
else{
memcpy(supported_groups, chello->supported_groups, chello->supported_groups_len);
printf("supported groups is \n", supported_groups);
printf("supported groups is:\n");
for(int i = 0; i < chello->supported_groups_len; i++){
printf("0x%02x ", supported_groups[i]);
}
@@ -153,6 +160,7 @@ int tls12_test(){
printf("\n\n");
ssl_chello_free(chello);
chello = NULL;
return 0;
}
int tls13_test(){
@@ -201,11 +209,16 @@ int tls13_test(){
unsigned char cipher_suites[1024];
memcpy(cipher_suites, chello->cipher_suites, chello->cipher_suites_len);
printf("cipher suites: \n", chello->cipher_suites);
char target_common[1024], target_tls13[1024];
ssl_cipher_suites_convert(chello->cipher_suites, chello->cipher_suites_len, target_common, target_tls13);
printf("cipher suites: \n");
for(int i = 0; i < chello->cipher_suites_len; i++){
printf("0x%02x ", cipher_suites[i]);
}
printf("\n");
printf("target_common: %s\n", target_common);
printf("target_tls13: %s\n", target_tls13);
printf("\n");
printf("sni: %s\n", chello->sni);
@@ -225,7 +238,7 @@ int tls13_test(){
unsigned char supported_groups[1024];
memcpy(supported_groups, chello->supported_groups, chello->supported_groups_len);
supported_groups[chello->supported_groups_len] = '\0';
printf("supported groups is \n", supported_groups);
printf("supported groups is: \n");
for(int i = 0; i < chello->supported_groups_len; i++){
printf("0x%02x ", supported_groups[i]);
}
@@ -233,6 +246,7 @@ int tls13_test(){
ssl_chello_free(chello);
chello = NULL;
return 0;
}
int main()