summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorEtan Cohen <etancohen@google.com>2017-06-06 17:02:11 -0700
committerSteven Moreland <smoreland@google.com>2017-08-03 15:20:24 -0700
commite2cc4c4f80934fac9563d663f0ec1822678e61cc (patch)
tree50832a33126003e98fc7c4e110fd6ab6837acce7 /wifi
parent94293086f837aa74e244d9df45ace1b557979eff (diff)
downloadplatform_hardware_interfaces-e2cc4c4f80934fac9563d663f0ec1822678e61cc.tar.gz
platform_hardware_interfaces-e2cc4c4f80934fac9563d663f0ec1822678e61cc.tar.bz2
platform_hardware_interfaces-e2cc4c4f80934fac9563d663f0ec1822678e61cc.zip
[AWARE] Fix validity check on PMK + export PASSPHRASE lengths
Bug: 62376042 Bug: 36376126 Test: unit tests + integrated (sl4a) tests Change-Id: I90de33a36bdfdd746710b0c5b0e25458fe3c06c7 Merged-In: I4c0e19a21a268fe7f2d38e82f3743ac5a8e2c6cb
Diffstat (limited to 'wifi')
-rw-r--r--wifi/1.0/Android.mk46
-rw-r--r--wifi/1.0/default/hidl_struct_util.cpp16
-rw-r--r--wifi/1.0/types.hal1
3 files changed, 55 insertions, 8 deletions
diff --git a/wifi/1.0/Android.mk b/wifi/1.0/Android.mk
index e6ab1c4aef..bceb635203 100644
--- a/wifi/1.0/Android.mk
+++ b/wifi/1.0/Android.mk
@@ -3764,5 +3764,51 @@ LOCAL_GENERATED_SOURCES += $(GEN)
include $(BUILD_STATIC_JAVA_LIBRARY)
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.wifi-V1.0-java-constants
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(call local-generated-sources-dir, COMMON)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_0/Constants.java
+$(GEN): $(HIDL)
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/IWifi.hal
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiChip.hal
+$(GEN): $(LOCAL_PATH)/IWifiChipEventCallback.hal
+$(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiNanIfaceEventCallback.hal
+$(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): $(LOCAL_PATH)/IWifiRttControllerEventCallback.hal
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiStaIfaceEventCallback.hal
+
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava-constants \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.wifi@1.0
+
+$(GEN):
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+# Avoid dependency cycle of framework.jar -> this-library -> framework.jar
+LOCAL_NO_STANDARD_LIBRARIES := true
+LOCAL_JAVA_LIBRARIES := core-oj
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/wifi/1.0/default/hidl_struct_util.cpp b/wifi/1.0/default/hidl_struct_util.cpp
index ae4f95d5ff..710761aa87 100644
--- a/wifi/1.0/default/hidl_struct_util.cpp
+++ b/wifi/1.0/default/hidl_struct_util.cpp
@@ -1073,8 +1073,8 @@ bool convertHidlNanPublishRequestToLegacy(
legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK;
legacy_request->key_info.body.pmk_info.pmk_len =
hidl_request.baseConfigs.securityConfig.pmk.size();
- if (legacy_request->key_info.body.pmk_info.pmk_len > NAN_PMK_INFO_LEN) {
- LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: pmk_len too large";
+ if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) {
+ LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: invalid pmk_len";
return false;
}
memcpy(legacy_request->key_info.body.pmk_info.pmk,
@@ -1190,8 +1190,8 @@ bool convertHidlNanSubscribeRequestToLegacy(
legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK;
legacy_request->key_info.body.pmk_info.pmk_len =
hidl_request.baseConfigs.securityConfig.pmk.size();
- if (legacy_request->key_info.body.pmk_info.pmk_len > NAN_PMK_INFO_LEN) {
- LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: pmk_len too large";
+ if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) {
+ LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: invalid pmk_len";
return false;
}
memcpy(legacy_request->key_info.body.pmk_info.pmk,
@@ -1407,8 +1407,8 @@ bool convertHidlNanDataPathInitiatorRequestToLegacy(
if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) {
legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK;
legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size();
- if (legacy_request->key_info.body.pmk_info.pmk_len > NAN_PMK_INFO_LEN) {
- LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: pmk_len too large";
+ if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) {
+ LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: invalid pmk_len";
return false;
}
memcpy(legacy_request->key_info.body.pmk_info.pmk,
@@ -1471,8 +1471,8 @@ bool convertHidlNanDataPathIndicationResponseToLegacy(
if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) {
legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK;
legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size();
- if (legacy_request->key_info.body.pmk_info.pmk_len > NAN_PMK_INFO_LEN) {
- LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: pmk_len too large";
+ if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) {
+ LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: invalid pmk_len";
return false;
}
memcpy(legacy_request->key_info.body.pmk_info.pmk,
diff --git a/wifi/1.0/types.hal b/wifi/1.0/types.hal
index 1662312e67..1b5f8f7dad 100644
--- a/wifi/1.0/types.hal
+++ b/wifi/1.0/types.hal
@@ -588,6 +588,7 @@ enum StaRoamingState : uint8_t {
/**
* Size limits for parameters used in the NAN interface.
*/
+@export
enum NanParamSizeLimits : uint32_t {
/** Minimum length of Passphrase argument for data-path configuration */
MIN_PASSPHRASE_LENGTH = 8,