hidl: add setOcsp and getOcsp methods for OCSP support

Bug: 136720092
Test: atest VtsHalWifiSupplicantV1_3TargetTest
Change-Id: Ided7fc29eaa19b45f3630ee7bc79ba0276b073df
diff --git a/wpa_supplicant/hidl/1.3/sta_network.cpp b/wpa_supplicant/hidl/1.3/sta_network.cpp
index 8606619..799981b 100644
--- a/wpa_supplicant/hidl/1.3/sta_network.cpp
+++ b/wpa_supplicant/hidl/1.3/sta_network.cpp
@@ -791,6 +791,20 @@
 	    &StaNetwork::setSaePasswordIdInternal, _hidl_cb, sae_password_id);
 }
 
+Return<void> StaNetwork::setOcsp(
+    OcspType ocspType, setOcsp_cb _hidl_cb) {
+	return validateAndCall(
+	    this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
+	    &StaNetwork::setOcspInternal, _hidl_cb, ocspType);
+}
+
+Return<void> StaNetwork::getOcsp(
+    getOcsp_cb _hidl_cb)
+{
+	return validateAndCall(
+	    this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
+	    &StaNetwork::getOcspInternal, _hidl_cb);
+}
 std::pair<SupplicantStatus, uint32_t> StaNetwork::getIdInternal()
 {
 	return {{SupplicantStatusCode::SUCCESS, ""}, network_id_};
@@ -1946,6 +1960,24 @@
 		wpa_ssid->group_mgmt_cipher & kAllowedGroupMgmtCipherMask};
 }
 
+SupplicantStatus StaNetwork::setOcspInternal(OcspType ocspType) {
+	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
+	if (ocspType < OcspType::NONE || ocspType > OcspType::REQUIRE_ALL_CERTS_STATUS) {
+		return{ SupplicantStatusCode::FAILURE_ARGS_INVALID, "" };
+	}
+	wpa_ssid->eap.ocsp = (int) ocspType;
+	wpa_printf(
+	    MSG_MSGDUMP, "ocsp: %d", wpa_ssid->eap.ocsp);
+	resetInternalStateAfterParamsUpdate();
+	return {SupplicantStatusCode::SUCCESS, ""};
+}
+
+std::pair<SupplicantStatus, OcspType> StaNetwork::getOcspInternal()
+{
+	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
+	return {{SupplicantStatusCode::SUCCESS, ""},
+		(OcspType) wpa_ssid->eap.ocsp};
+}
 /**
  * Retrieve the underlying |wpa_ssid| struct pointer for
  * this network.
diff --git a/wpa_supplicant/hidl/1.3/sta_network.h b/wpa_supplicant/hidl/1.3/sta_network.h
index 8d78519..f018a10 100644
--- a/wpa_supplicant/hidl/1.3/sta_network.h
+++ b/wpa_supplicant/hidl/1.3/sta_network.h
@@ -15,7 +15,7 @@
 
 #include <android-base/macros.h>
 
-#include <android/hardware/wifi/supplicant/1.2/ISupplicantStaNetwork.h>
+#include <android/hardware/wifi/supplicant/1.3/ISupplicantStaNetwork.h>
 #include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetworkCallback.h>
 
 extern "C"
@@ -38,13 +38,14 @@
 namespace implementation {
 using namespace android::hardware::wifi::supplicant::V1_0;
 using namespace android::hardware::wifi::supplicant::V1_1;
+using namespace android::hardware::wifi::supplicant::V1_2;
 
 /**
  * Implementation of StaNetwork hidl object. Each unique hidl
  * object is used for control operations on a specific network
  * controlled by wpa_supplicant.
  */
-class StaNetwork : public V1_2::ISupplicantStaNetwork
+class StaNetwork : public V1_3::ISupplicantStaNetwork
 {
 public:
 	StaNetwork(
@@ -225,6 +226,10 @@
 	Return<void> setSaePasswordId(
 	    const hidl_string& sae_password_id,
 	    setSaePasswordId_cb _hidl_cb) override;
+	Return<void> setOcsp(
+	    OcspType ocspType, setOcsp_cb _hidl_cb) override;
+	Return<void> getOcsp(
+	    getOcsp_cb _hidl_cb) override;
 
 private:
 	// Corresponding worker functions for the HIDL methods.
@@ -341,6 +346,8 @@
 	    const std::string& sae_password_id);
 	SupplicantStatus setGroupMgmtCipherInternal(uint32_t group_mgmt_cipher_mask);
 	std::pair<SupplicantStatus, uint32_t> getGroupMgmtCipherInternal();
+	SupplicantStatus setOcspInternal(OcspType ocspType);
+	std::pair<SupplicantStatus, OcspType> getOcspInternal();
 
 	struct wpa_ssid* retrieveNetworkPtr();
 	struct wpa_supplicant* retrieveIfacePtr();