Change tls_named_curve_name to tls_curve_name

This commit is contained in:
Zhi Guan
2024-02-04 11:40:58 +08:00
parent 3f05cf98c8
commit 9cfc64d34b
4 changed files with 36 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
* Copyright 2014-2024 The GmSSL Project. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
@@ -11,7 +11,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include <unistd.h>
#include <time.h>
#include <gmssl/tls.h>
#include <gmssl/x509.h>
@@ -271,9 +270,7 @@ const char *tls_curve_type_name(int type)
return NULL;
}
// FIXME: 是否应该将函数名改为 tls_curve_name() 这样和 TLS_curve_xxx 保持一致
const char *tls_named_curve_name(int curve)
const char *tls_curve_name(int curve)
{
switch (curve) {
case TLS_curve_secp256k1: return "secp256k1";
@@ -382,7 +379,7 @@ int tls_extension_print(FILE *fp, int type, const uint8_t *data, size_t datalen,
uint16_t curve;
tls_uint16_from_bytes(&curve, &p, &len);
format_print(fp, format, indent, "%s (%d)\n",
tls_named_curve_name(curve), curve);
tls_curve_name(curve), curve);
}
break;
case TLS_extension_ec_point_formats:
@@ -428,7 +425,7 @@ int tls_extension_print(FILE *fp, int type, const uint8_t *data, size_t datalen,
error_print();
return -1;
}
format_print(fp, format, indent, "group: %s (%d)\n", tls_named_curve_name(group), group);
format_print(fp, format, indent, "group: %s (%d)\n", tls_curve_name(group), group);
format_bytes(fp, format, indent, "key_exchange", key_exch, key_exch_len);
}
break;
@@ -669,7 +666,7 @@ int tls_server_key_exchange_ecdhe_print(FILE *fp, const uint8_t *data, size_t da
return -1;
}
format_print(fp, format, indent + 8, "named_curve: %s (%d)\n",
tls_named_curve_name(curve), curve);
tls_curve_name(curve), curve);
if (tls_uint8array_from_bytes(&octets, &octetslen, &data, &datalen) != 1) {
error_print();
return -1;