Skip to content

Commit cca7995

Browse files
rluboskrish2718
authored andcommitted
[nrf fromtree] net: lib: tls_credentials: Rename TLS_CREDENTIAL_SERVER_CERTIFICATE
TLS_CREDENTIAL_SERVER_CERTIFICATE credential type is misleading, as in fact it just represents a public certificate, it does not matter if the certificate belongs to a server or a client. And actually, it was already used in-tree for clients as well, for example in LwM2M. Therefore rename the credential type to a more generic TLS_CREDENTIAL_PUBLIC_CERTIFICATE and deprecate the old one. Signed-off-by: Robert Lubos <[email protected]> (cherry picked from commit a61287e)
1 parent 6b778f3 commit cca7995

File tree

19 files changed

+42
-31
lines changed

19 files changed

+42
-31
lines changed

doc/connectivity/networking/api/sockets.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ socket options.
9393
The following TLS credential types can be registered in the system:
9494

9595
- ``TLS_CREDENTIAL_CA_CERTIFICATE``
96-
- ``TLS_CREDENTIAL_SERVER_CERTIFICATE``
96+
- ``TLS_CREDENTIAL_PUBLIC_CERTIFICATE``
9797
- ``TLS_CREDENTIAL_PRIVATE_KEY``
9898
- ``TLS_CREDENTIAL_PSK``
9999
- ``TLS_CREDENTIAL_PSK_ID``

doc/releases/migration-guide-4.2.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ Networking
7272
(because the addr is not a pointer) and must be changed to ``if (lladdr->len == 0)``
7373
if the code wants to check that the link address is not set.
7474

75+
* TLS credential type ``TLS_CREDENTIAL_SERVER_CERTIFICATE`` was renamed to
76+
more generic :c:enumerator:`TLS_CREDENTIAL_PUBLIC_CERTIFICATE` to better
77+
reflect the purpose of this credential type.
78+
7579
SPI
7680
===
7781

doc/releases/release-notes-4.2.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ Deprecated APIs and options
5757
renamed and deprecated. Use :kconfig:option:`CONFIG_SCHED_SIMPLE` and
5858
:kconfig:option:`CONFIG_WAITQ_SIMPLE` instead.
5959

60+
* TLS credential type ``TLS_CREDENTIAL_SERVER_CERTIFICATE`` was renamed and
61+
deprecated, use :c:enumerator:`TLS_CREDENTIAL_PUBLIC_CERTIFICATE` instead.
62+
6063
===========================
6164

6265
New APIs and options

drivers/wifi/eswifi/eswifi_socket_offload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static int map_credentials(int sd, const void *optval, socklen_t optlen)
191191
case TLS_CREDENTIAL_CA_CERTIFICATE:
192192
id = 0;
193193
break;
194-
case TLS_CREDENTIAL_SERVER_CERTIFICATE:
194+
case TLS_CREDENTIAL_PUBLIC_CERTIFICATE:
195195
id = 1;
196196
break;
197197
case TLS_CREDENTIAL_PRIVATE_KEY:

drivers/wifi/simplelink/simplelink_sockets.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ static int map_credentials(int sd, const void *optval, socklen_t optlen)
674674
case TLS_CREDENTIAL_CA_CERTIFICATE:
675675
opt = SL_SO_SECURE_FILES_CA_FILE_NAME;
676676
break;
677-
case TLS_CREDENTIAL_SERVER_CERTIFICATE:
677+
case TLS_CREDENTIAL_PUBLIC_CERTIFICATE:
678678
opt = SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME;
679679
break;
680680
case TLS_CREDENTIAL_PRIVATE_KEY:

include/zephyr/net/tls_credentials.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,15 @@ enum tls_credential_type {
3636
*/
3737
TLS_CREDENTIAL_CA_CERTIFICATE,
3838

39-
/** A public server certificate. Use this to register your own server
39+
/** A public client or server certificate. Use this to register your own
4040
* certificate. Should be registered together with a corresponding
4141
* private key. Used with certificate-based ciphersuites.
4242
*/
43-
TLS_CREDENTIAL_SERVER_CERTIFICATE,
43+
TLS_CREDENTIAL_PUBLIC_CERTIFICATE,
44+
45+
/** @deprecated Use TLS_CREDENTIAL_PUBLIC_CERTIFICATE instead.
46+
*/
47+
TLS_CREDENTIAL_SERVER_CERTIFICATE = TLS_CREDENTIAL_PUBLIC_CERTIFICATE,
4448

4549
/** Private key. Should be registered together with a corresponding
4650
* public certificate. Used with certificate-based ciphersuites.
@@ -64,7 +68,7 @@ enum tls_credential_type {
6468
* in the system.
6569
*
6670
* @note Some TLS credentials come in pairs:
67-
* - TLS_CREDENTIAL_SERVER_CERTIFICATE with TLS_CREDENTIAL_PRIVATE_KEY,
71+
* - TLS_CREDENTIAL_PUBLIC_CERTIFICATE with TLS_CREDENTIAL_PRIVATE_KEY,
6872
* - TLS_CREDENTIAL_PSK with TLS_CREDENTIAL_PSK_ID.
6973
* Such pairs of credentials must be assigned the same secure tag to be
7074
* correctly handled in the system.

modules/thrift/src/thrift/transport/TSSLSocket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ void TSSLSocketFactory::loadCertificateFromBuffer(const char *aCertificate, cons
450450

451451
if (strcmp(format, "PEM") == 0) {
452452
const int status = tls_credential_add(Thrift_TLS_SERVER_CERT_TAG,
453-
TLS_CREDENTIAL_SERVER_CERTIFICATE,
453+
TLS_CREDENTIAL_PUBLIC_CERTIFICATE,
454454
aCertificate, strlen(aCertificate) + 1);
455455

456456
if (status != 0) {

samples/net/prometheus/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static void setup_tls(void)
120120
}
121121
#endif /* defined(CONFIG_NET_SAMPLE_CERTS_WITH_SC) */
122122

123-
err = tls_credential_add(HTTP_SERVER_CERTIFICATE_TAG, TLS_CREDENTIAL_SERVER_CERTIFICATE,
123+
err = tls_credential_add(HTTP_SERVER_CERTIFICATE_TAG, TLS_CREDENTIAL_PUBLIC_CERTIFICATE,
124124
server_certificate, sizeof(server_certificate));
125125
if (err < 0) {
126126
LOG_ERR("Failed to register public certificate: %d", err);

samples/net/sockets/dumb_http_server_mt/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ int main(void)
413413
{
414414
#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS)
415415
int err = tls_credential_add(SERVER_CERTIFICATE_TAG,
416-
TLS_CREDENTIAL_SERVER_CERTIFICATE,
416+
TLS_CREDENTIAL_PUBLIC_CERTIFICATE,
417417
server_certificate,
418418
sizeof(server_certificate));
419419
if (err < 0) {

samples/net/sockets/echo_server/src/echo-server.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static void init_app(void)
153153
#endif /* defined(CONFIG_NET_SAMPLE_CERTS_WITH_SC) */
154154

155155
err = tls_credential_add(SERVER_CERTIFICATE_TAG,
156-
TLS_CREDENTIAL_SERVER_CERTIFICATE,
156+
TLS_CREDENTIAL_PUBLIC_CERTIFICATE,
157157
server_certificate,
158158
sizeof(server_certificate));
159159
if (err < 0) {

0 commit comments

Comments
 (0)