Skip to content

Commit

Permalink
Merge pull request #82 from subrahmanyaman/Javacard_KM_40_AOSP_UPMERG…
Browse files Browse the repository at this point in the history
…E_0630

Merge KM41 changes to KM40
  • Loading branch information
mdwivedi authored Dec 10, 2021
2 parents d19e5db + d767b34 commit 672840b
Show file tree
Hide file tree
Showing 6 changed files with 352 additions and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void onRestore(Element element) {
keymasterState = element.readByte();
repository.onRestore(element, packageVersion, CURRENT_PACKAGE_VERSION);
seProvider.onRestore(element, packageVersion, CURRENT_PACKAGE_VERSION);
handleDataUpgradeToVersion1_1();
handleDataUpgradeToVersion2_0();
}

@Override
Expand Down Expand Up @@ -101,10 +101,10 @@ private short computePrimitveDataSize() {
private short computeObjectCount() {
return (short) 0;
}

public boolean isUpgradeAllowed(short version) {
boolean upgradeAllowed = false;
short oldMajorVersion = (short) (version >> 8 & 0x00FF);
short oldMajorVersion = (short) ((version >> 8) & 0x00FF);
short oldMinorVersion = (short) (version & 0x00FF);
short currentMajorVersion = (short) (CURRENT_PACKAGE_VERSION >> 8 & 0x00FF);
short currentMinorVersion = (short) (CURRENT_PACKAGE_VERSION & 0x00FF);
Expand All @@ -121,8 +121,8 @@ public boolean isUpgradeAllowed(short version) {
}
return upgradeAllowed;
}
public void handleDataUpgradeToVersion1_1() {

public void handleDataUpgradeToVersion2_0() {

if (packageVersion != 0) {
// No Data upgrade required.
Expand Down Expand Up @@ -185,7 +185,6 @@ public void handleDataUpgradeToVersion1_1() {
issuerLen,
(short) (certChaionOff + certChainLen + issuerLen), // cert expiry offset
certExpiryLen);


// Update computed HMAC key.
short blob = repository.getComputedHmacKey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ public void onRestore(Element element, short oldVersion, short currentVersion) {
preSharedKey = KMHmacKey.onRestore(element);
if (oldVersion == 0) {
// Previous versions does not contain version information.
handleDataUpgradeToVersion1_1();
handleDataUpgradeToVersion2_0();
} else {
computedHmacKey = KMHmacKey.onRestore(element);
}
Expand Down Expand Up @@ -1362,7 +1362,7 @@ public KMComputedHmacKey getComputedHmacKey() {
return computedHmacKey;
}

private void handleDataUpgradeToVersion1_1() {
private void handleDataUpgradeToVersion2_0() {
short totalLen = (short) (6 + KMConfigurations.CERT_CHAIN_MAX_SIZE +
KMConfigurations.CERT_ISSUER_MAX_SIZE + KMConfigurations.CERT_EXPIRY_MAX_SIZE);
byte[] oldBuffer = provisionData;
Expand Down
Loading

0 comments on commit 672840b

Please sign in to comment.