Pass full struct to peer certificate callbacks

This makes it easier to add new information to the callbacks without
having to modify each callback function type in EAPOL and EAP code every
time.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2019-06-11 04:20:18 +03:00
parent 82b9de98c3
commit bc0634da4a
9 changed files with 64 additions and 77 deletions

View file

@ -2097,12 +2097,8 @@ static void eap_peer_sm_tls_event(void *ctx, enum tls_event ev,
}
}
sm->eapol_cb->notify_cert(sm->eapol_ctx,
data->peer_cert.depth,
data->peer_cert.subject,
data->peer_cert.altsubject,
data->peer_cert.num_altsubject,
hash_hex, data->peer_cert.cert);
sm->eapol_cb->notify_cert(sm->eapol_ctx, &data->peer_cert,
hash_hex);
break;
case TLS_ALERT:
if (data->alert.is_local)

View file

@ -16,6 +16,7 @@
struct eap_sm;
struct wpa_config_blob;
struct wpabuf;
struct tls_cert_data;
struct eap_method_type {
int vendor;
@ -226,16 +227,11 @@ struct eapol_callbacks {
/**
* notify_cert - Notification of a peer certificate
* @ctx: eapol_ctx from eap_peer_sm_init() call
* @depth: Depth in certificate chain (0 = server)
* @subject: Subject of the peer certificate
* @altsubject: Select fields from AltSubject of the peer certificate
* @num_altsubject: Number of altsubject values
* @cert: Certificate information
* @cert_hash: SHA-256 hash of the certificate
* @cert: Peer certificate
*/
void (*notify_cert)(void *ctx, int depth, const char *subject,
const char *altsubject[], int num_altsubject,
const char *cert_hash, const struct wpabuf *cert);
void (*notify_cert)(void *ctx, struct tls_cert_data *cert,
const char *cert_hash);
/**
* notify_status - Notification of the current EAP state