Skip to content

Commit a6eec63

Browse files
committed
tlshd: Do not return remote peer IDs for x.509 handshakes
These were never adopted by the kernel x.509-based TLS consumers, and are to be replaced with handshake tags. Signed-off-by: Chuck Lever <[email protected]>
1 parent 1177c26 commit a6eec63

File tree

2 files changed

+3
-61
lines changed

2 files changed

+3
-61
lines changed

src/tlshd/client.c

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,7 @@ tlshd_x509_retrieve_key_cb(gnutls_session_t session,
206206
static int tlshd_client_x509_verify_function(gnutls_session_t session,
207207
struct tlshd_handshake_parms *parms)
208208
{
209-
const gnutls_datum_t *peercerts;
210-
unsigned int i, status;
209+
unsigned int status;
211210
int ret;
212211

213212
ret = gnutls_certificate_verify_peers3(session, parms->peername,
@@ -223,34 +222,6 @@ static int tlshd_client_x509_verify_function(gnutls_session_t session,
223222
* to get picky. Kernel would have to tell us what to look for
224223
* via a netlink attribute. */
225224

226-
peercerts = gnutls_certificate_get_peers(session,
227-
&parms->num_remote_peerids);
228-
if (!peercerts || parms->num_remote_peerids == 0) {
229-
tlshd_log_debug("The peer cert list is empty.\n");
230-
return GNUTLS_E_CERTIFICATE_ERROR;
231-
}
232-
233-
tlshd_log_debug("The peer offered %u certificate(s).\n",
234-
parms->num_remote_peerids);
235-
236-
if (parms->num_remote_peerids > ARRAY_SIZE(parms->remote_peerid))
237-
parms->num_remote_peerids = ARRAY_SIZE(parms->remote_peerid);
238-
for (i = 0; i < parms->num_remote_peerids; i++) {
239-
gnutls_x509_crt_t cert;
240-
241-
gnutls_x509_crt_init(&cert);
242-
ret = gnutls_x509_crt_import(cert, &peercerts[i],
243-
GNUTLS_X509_FMT_DER);
244-
if (ret != GNUTLS_E_SUCCESS) {
245-
tlshd_log_gnutls_error(ret);
246-
gnutls_x509_crt_deinit(cert);
247-
return GNUTLS_E_CERTIFICATE_ERROR;
248-
}
249-
parms->remote_peerid[i] =
250-
tlshd_keyring_create_cert(cert, parms->peername);
251-
gnutls_x509_crt_deinit(cert);
252-
}
253-
254225
return GNUTLS_E_SUCCESS;
255226
}
256227

src/tlshd/server.c

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,9 @@ tlshd_x509_retrieve_key_cb(gnutls_session_t session,
142142
* verification failed. The server sends an ALERT to the client.
143143
*/
144144
static int tlshd_server_x509_verify_function(gnutls_session_t session,
145-
struct tlshd_handshake_parms *parms)
145+
__attribute__ ((unused)) struct tlshd_handshake_parms *parms)
146146
{
147-
const gnutls_datum_t *peercerts;
148-
unsigned int i, status;
147+
unsigned int status;
149148
int ret;
150149

151150
ret = gnutls_certificate_verify_peers3(session, NULL, &status);
@@ -166,34 +165,6 @@ static int tlshd_server_x509_verify_function(gnutls_session_t session,
166165
* to get picky. Kernel would have to tell us what to look for
167166
* via a netlink attribute. */
168167

169-
peercerts = gnutls_certificate_get_peers(session,
170-
&parms->num_remote_peerids);
171-
if (!peercerts || parms->num_remote_peerids == 0) {
172-
tlshd_log_debug("The peer cert list is empty.");
173-
goto certificate_error;
174-
}
175-
176-
tlshd_log_debug("The peer offered %u certificate(s).",
177-
parms->num_remote_peerids);
178-
179-
if (parms->num_remote_peerids > ARRAY_SIZE(parms->remote_peerid))
180-
parms->num_remote_peerids = ARRAY_SIZE(parms->remote_peerid);
181-
for (i = 0; i < parms->num_remote_peerids; i++) {
182-
gnutls_x509_crt_t cert;
183-
184-
gnutls_x509_crt_init(&cert);
185-
ret = gnutls_x509_crt_import(cert, &peercerts[i],
186-
GNUTLS_X509_FMT_DER);
187-
if (ret != GNUTLS_E_SUCCESS) {
188-
tlshd_log_gnutls_error(ret);
189-
gnutls_x509_crt_deinit(cert);
190-
return GNUTLS_E_CERTIFICATE_ERROR;
191-
}
192-
parms->remote_peerid[i] =
193-
tlshd_keyring_create_cert(cert, parms->peername);
194-
gnutls_x509_crt_deinit(cert);
195-
}
196-
197168
return GNUTLS_E_SUCCESS;
198169

199170
certificate_error:

0 commit comments

Comments
 (0)