Skip to content

Commit f8b7256

Browse files
author
Chirag Pathak
committed
Merge branch 'Keymint' of https://github.com/cpathak/JavaCardKeymaster into Keymint
2 parents ac2d6d4 + 70c0106 commit f8b7256

File tree

1 file changed

+3
-34
lines changed

1 file changed

+3
-34
lines changed

Applet/src/com/android/javacard/keymaster/KMKeymasterApplet.java

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,6 @@ private void processGetHmacSharingParamCmd(APDU apdu) {
691691
short seed = KMByteBlob.instance((short) 0);
692692
KMHmacSharingParameters.cast(params).setNonce(nonce);
693693
KMHmacSharingParameters.cast(params).setSeed(seed);
694-
//print(KMByteBlob.cast(nonce).getBuffer(), KMByteBlob.cast(nonce).getStartOff(),
695-
// KMByteBlob.cast(nonce).length());
696694
// prepare the response
697695
short resp = KMArray.instance((short) 2);
698696
KMArray.cast(resp).add((short) 0, KMInteger.uint_16(KMError.OK));
@@ -771,9 +769,6 @@ private void processComputeSharedHmacCmd(APDU apdu) {
771769
short found = 0;
772770
//tmpVariables[9]
773771
short nonce = repository.getHmacNonce();
774-
//print(KMByteBlob.cast(nonce).getBuffer(),
775-
// KMByteBlob.cast(nonce).getStartOff(),
776-
// KMByteBlob.cast(nonce).length());
777772

778773
while (paramIndex < paramsLen) {
779774
// read HmacSharingParam
@@ -816,11 +811,6 @@ private void processComputeSharedHmacCmd(APDU apdu) {
816811
// Check if the nonce generated here is present in the hmacSharingParameters array.
817812
// Otherwise throw INVALID_ARGUMENT error.
818813
if (found == 1) {
819-
//print(repository.getHeap(),
820-
// (short) (concateBuffer + bufferIndex),nonceLen);
821-
//print(KMByteBlob.cast(nonce).getBuffer(),
822-
// KMByteBlob.cast(nonce).getStartOff(),
823-
// nonceLen);
824814
if (0
825815
== Util.arrayCompare(
826816
repository.getHeap(),
@@ -3013,18 +3003,6 @@ private void processInitStrongBoxCmd(APDU apdu) {
30133003
setOsVersion(osVersion);
30143004
setOsPatchLevel(osPatchLevel);
30153005
setVendorPatchLevel(vendorPatchLevel);
3016-
System.out.println("============ OS Version et al ==========");
3017-
// print(KMInteger.cast(osVersion).getBuffer(),
3018-
// KMInteger.cast(osVersion).getStartOff(),
3019-
// KMInteger.cast(osVersion).length());
3020-
3021-
// print(KMInteger.cast(osPatchLevel).getBuffer(),
3022-
// KMInteger.cast(osPatchLevel).getStartOff(),
3023-
// KMInteger.cast(osPatchLevel).length());
3024-
3025-
// print(KMInteger.cast(vendorPatchLevel).getBuffer(),
3026-
// KMInteger.cast(vendorPatchLevel).getStartOff(),
3027-
// KMInteger.cast(vendorPatchLevel).length());
30283006
}
30293007

30303008
public void reboot(){
@@ -3118,6 +3096,7 @@ private void processGenerateKey(APDU apdu) {
31183096
KMException.throwIt(KMError.UNSUPPORTED_ALGORITHM);
31193097
break;
31203098
}
3099+
31213100
// create key blob and associated attestation.
31223101
data[ORIGIN] = KMType.GENERATED;
31233102
makeKeyCharacteristics(scratchPad);
@@ -3131,21 +3110,14 @@ private void processGenerateKey(APDU apdu) {
31313110
KMArray.cast(resp).add((short) 3, data[CERTIFICATE]);
31323111
sendOutgoing(apdu, resp);
31333112
}
3134-
/*
3135-
private static void print(byte[] buf, short start, short length){
3136-
StringBuilder sb = new StringBuilder(length * 2);
3137-
for(short i = start; i < (start+length); i ++){
3138-
sb.append(String.format("%02x", buf[i]));
3139-
}
3140-
System.out.println( sb.toString());
3141-
}
3142-
*/
3113+
31433114
private void generateAttestation(byte[] scratchPad){
31443115
KMAttestationCert cert = makeCert(scratchPad);
31453116
if(cert == null) {// No certificate
31463117
data[CERTIFICATE] = KMArray.instance((short)0);
31473118
return;
31483119
}
3120+
31493121
// Allocate memory
31503122
short certData = KMByteBlob.instance(MAX_CERT_SIZE);
31513123
cert.buffer(KMByteBlob.cast(certData).getBuffer(),
@@ -3157,9 +3129,6 @@ private void generateAttestation(byte[] scratchPad){
31573129
KMByteBlob.cast(certData).setStartOff(cert.getCertStart());
31583130
KMByteBlob.cast(certData).setLength(cert.getCertLength());
31593131

3160-
//print(KMByteBlob.cast(certData).getBuffer(),
3161-
// KMByteBlob.cast(certData).getStartOff(),
3162-
// KMByteBlob.cast(certData).length());
31633132
// Initialize the certificate as array of blob
31643133
data[CERTIFICATE] = KMArray.instance((short)1);
31653134
KMArray.cast(data[CERTIFICATE]).add((short)0, certData);

0 commit comments

Comments
 (0)