Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2758,9 +2758,9 @@ public void testUpgradeKey() {
{0, OS_PATCH_LEVEL+1, VENDOR_PATCH_LEVEL-1, BOOT_PATCH_LEVEL+1, NO_UPGRADE, KMError.INVALID_ARGUMENT },
};
for (int i = 0; i < test_data.length; i++) {
setAndroidOSSystemProperties(simulator, (short) test_data[i][0], (short) test_data[i][1],
(short) test_data[i][2]);
setBootParams(simulator, (short) test_data[i][3]);
setAndroidOSSystemProperties(simulator, (short) test_data[i][0], (short) test_data[i][1],
(short) test_data[i][2]);
ret = upgradeKey(
KMByteBlob.instance(keyBlob, (short) 0, (short) keyBlob.length),
null, null, test_data[i][5]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ public void process(APDU apdu) {
switch (apduIns) {
case INS_SET_BOOT_PARAMS_CMD:
if (seProvider.isBootSignalEventSupported()
&& (keymasterState == KMKeymasterApplet.ACTIVE_STATE)
&& (!seProvider.isDeviceRebooted())) {
ISOException.throwIt(ISO7816.SW_COMMAND_NOT_ALLOWED);
}
Expand Down
10 changes: 7 additions & 3 deletions HAL/keymaster/4.1/JavacardKeymaster4Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,11 @@ ErrorCode sendData(Instruction ins, std::vector<uint8_t>& inData, std::vector<ui
return (ErrorCode::OK);//success
}

static ErrorCode setAndroidSystemProperties(CborConverter& cborConverter_) {
/**
* Sends android system properties like os_version, os_patchlevel and vendor_patchlevel to
* the Applet.
*/
static ErrorCode setAndroidSystemProperties(CborConverter& cborConverter_, const std::unique_ptr<OperationContext>& oprCtx) {
ErrorCode errorCode = ErrorCode::UNKNOWN_ERROR;
cppbor::Array array;
std::unique_ptr<Item> item;
Expand All @@ -453,7 +457,7 @@ static ErrorCode setAndroidSystemProperties(CborConverter& cborConverter_) {
if (ErrorCode::OK == errorCode) {
//Skip last 2 bytes in cborData, it contains status.
std::tie(item, errorCode) = decodeData(cborConverter_, std::vector<uint8_t>(cborOutData.begin(), cborOutData.end()-2),
true);
true, oprCtx);
}
if (ErrorCode::OK != errorCode)
LOG(ERROR) << "Failed to set os_version, os_patchlevel and vendor_patchlevel err: " << (int32_t) errorCode;
Expand All @@ -471,7 +475,7 @@ JavacardKeymaster4Device::JavacardKeymaster4Device(): softKm_(new ::keymaster::A
// Send Android system properties like os_version, os_patchlevel and vendor_patchlevel
// to the Applet. Incase if setting system properties fails here, again try setting
// it from computeSharedHmac.
if (ErrorCode::OK == setAndroidSystemProperties(cborConverter_)) {
if (ErrorCode::OK == setAndroidSystemProperties(cborConverter_, oprCtx_)) {
isEachSystemPropertySet = true;
}

Expand Down