Add log messages to the certificate callback path.

Logs are meant to test 2 theories regarding the
SIGSEGV in the attached bug:

 1. Failure is happening somewhere in the middle
    of the call path from tls_openssl to AIDL.
 2. sm struct becomes stale before the callback is
    used.

Bug: 275293332
Test: Connect to WPA-Enterprise network and verify logs.
Change-Id: I7b654d2a63f7f453f05b586f84c42702ac899d1e
diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c
index 29f0d18..edb3f0c 100644
--- a/src/crypto/tls_openssl.c
+++ b/src/crypto/tls_openssl.c
@@ -172,6 +172,7 @@
 	BIO *bio = NULL;
 	uint8_t *value = NULL;
 	if (tls_global != NULL && certificate_callback_global != NULL) {
+		wpa_printf(MSG_INFO, "Retrieving certificate using callback");
 		int length = (*certificate_callback_global)(tls_global->cb_ctx, alias, &value);
 		if (length != -1 && (bio = BIO_new(BIO_s_mem())) != NULL)
 			BIO_write(bio, value, length);
diff --git a/src/eap_peer/eap.c b/src/eap_peer/eap.c
index ce44a4f..8338c47 100644
--- a/src/eap_peer/eap.c
+++ b/src/eap_peer/eap.c
@@ -2200,6 +2200,7 @@
 ssize_t tls_certificate_callback(void* ctx, const char* alias, uint8_t** value) {
 	if (alias == NULL || ctx == NULL || value == NULL) return -1;
 	struct eap_sm *sm = (struct eap_sm*) ctx;
+	wpa_printf(MSG_INFO, "tls_certificate_callback: received sm=%p", (void*)sm);
 	if (sm->eapol_cb && sm->eapol_cb->get_certificate) {
 		return sm->eapol_cb->get_certificate(sm->eapol_ctx, alias, value);
 	}
@@ -2228,6 +2229,7 @@
 	struct tls_config tlsconf;
 
 	sm = os_zalloc(sizeof(*sm));
+	wpa_printf(MSG_INFO, "Init sm=%p", (void*)sm);
 	if (sm == NULL)
 		return NULL;
 	sm->eapol_ctx = eapol_ctx;
@@ -2277,6 +2279,7 @@
  */
 void eap_peer_sm_deinit(struct eap_sm *sm)
 {
+	wpa_printf(MSG_INFO, "Deinit sm=%p", (void*)sm);
 	if (sm == NULL)
 		return;
 	eap_deinit_prev_method(sm, "EAP deinit");
diff --git a/src/eapol_supp/eapol_supp_sm.c b/src/eapol_supp/eapol_supp_sm.c
index a8ac6fd..334ce6c 100644
--- a/src/eapol_supp/eapol_supp_sm.c
+++ b/src/eapol_supp/eapol_supp_sm.c
@@ -2116,6 +2116,7 @@
 eapol_sm_get_certificate(void *ctx, const char* alias, uint8_t** value)
 {
 	struct eapol_sm *sm = ctx;
+	wpa_printf(MSG_INFO, "eapol_sm_get_certificate");
 
 	if (sm->ctx->get_certificate_cb) {
 		return sm->ctx->get_certificate_cb(alias, value);
diff --git a/wpa_supplicant/aidl/aidl.cpp b/wpa_supplicant/aidl/aidl.cpp
index 5d578dd..b4518bf 100644
--- a/wpa_supplicant/aidl/aidl.cpp
+++ b/wpa_supplicant/aidl/aidl.cpp
@@ -1069,5 +1069,7 @@
 	if (!aidl_manager)
 		return -1;
 
+	wpa_printf(MSG_INFO, "Requesting certificate from framework");
+
 	return aidl_manager->getCertificate(alias, value);
 }
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index 32ddf1f..3122c58 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -1360,6 +1360,7 @@
 
 ssize_t wpas_get_certificate(const char *alias, uint8_t** value)
 {
+	wpa_printf(MSG_INFO, "wpas_get_certificate");
 	return wpas_aidl_get_certificate(alias, value);
 }
 
diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c
index 7d5ea4c..0921f52 100644
--- a/wpa_supplicant/wpas_glue.c
+++ b/wpa_supplicant/wpas_glue.c
@@ -1187,6 +1187,7 @@
 static ssize_t wpa_supplicant_get_certificate_cb(
 						const char* alias, uint8_t** value)
 {
+	wpa_printf(MSG_INFO, "wpa_supplicant_get_certificate_cb");
 	return wpas_get_certificate(alias, value);
 }