@@ -691,8 +691,8 @@ 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 ());
694+ // print(KMByteBlob.cast(nonce).getBuffer(), KMByteBlob.cast(nonce).getStartOff(),
695+ // KMByteBlob.cast(nonce).length());
696696 // prepare the response
697697 short resp = KMArray .instance ((short ) 2 );
698698 KMArray .cast (resp ).add ((short ) 0 , KMInteger .uint_16 (KMError .OK ));
@@ -771,9 +771,9 @@ private void processComputeSharedHmacCmd(APDU apdu) {
771771 short found = 0 ;
772772 //tmpVariables[9]
773773 short nonce = repository .getHmacNonce ();
774- print (KMByteBlob .cast (nonce ).getBuffer (),
775- KMByteBlob .cast (nonce ).getStartOff (),
776- KMByteBlob .cast (nonce ).length ());
774+ // print(KMByteBlob.cast(nonce).getBuffer(),
775+ // KMByteBlob.cast(nonce).getStartOff(),
776+ // KMByteBlob.cast(nonce).length());
777777
778778 while (paramIndex < paramsLen ) {
779779 // read HmacSharingParam
@@ -816,11 +816,11 @@ private void processComputeSharedHmacCmd(APDU apdu) {
816816 // Check if the nonce generated here is present in the hmacSharingParameters array.
817817 // Otherwise throw INVALID_ARGUMENT error.
818818 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 );
819+ // print(repository.getHeap(),
820+ // (short) (concateBuffer + bufferIndex),nonceLen);
821+ // print(KMByteBlob.cast(nonce).getBuffer(),
822+ // KMByteBlob.cast(nonce).getStartOff(),
823+ // nonceLen);
824824 if (0
825825 == Util .arrayCompare (
826826 repository .getHeap (),
@@ -1344,20 +1344,10 @@ protected short getBootKey(byte[] scratchPad){
13441344 short len = seProvider .getVerifiedBootHash (scratchPad ,(short )0 );
13451345 if (len != VERIFIED_BOOT_KEY_SIZE ) {
13461346 KMException .throwIt (KMError .UNKNOWN_ERROR );
1347+ }
13471348 return KMByteBlob .instance (scratchPad ,(short )0 , VERIFIED_BOOT_KEY_SIZE );
13481349 }
1349-
1350- private boolean isEmpty (byte [] buf , short offset , short len ) {
1351- boolean empty = true ;
1352- short index = 0 ;
1353- while (index < len ) {
1354- if (buf [(short ) (index + offset )] != 0 ) {
1355- empty = false ;
1356- break ;
1357- }
1358- index ++;
1359- }
1360-
1350+
13611351 protected short getVerifiedBootHash (byte [] scratchPad ){
13621352 Util .arrayFillNonAtomic (scratchPad , (short )0 , VERIFIED_BOOT_HASH_SIZE , (byte )0 );
13631353 short len = seProvider .getVerifiedBootHash (scratchPad ,(short )0 );
@@ -3023,6 +3013,18 @@ private void processInitStrongBoxCmd(APDU apdu) {
30233013 setOsVersion (osVersion );
30243014 setOsPatchLevel (osPatchLevel );
30253015 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());
30263028 }
30273029
30283030 public void reboot (){
@@ -3052,14 +3054,14 @@ protected void setOsVersion(short version){
30523054 KMInteger .cast (version ).length ());
30533055 }
30543056
3055- protected void setVendorPatchLevel (short patch ){
3057+ protected void setOsPatchLevel (short patch ){
30563058 repository .setOsPatch (
30573059 KMInteger .cast (patch ).getBuffer (),
30583060 KMInteger .cast (patch ).getStartOff (),
30593061 KMInteger .cast (patch ).length ());
30603062 }
30613063
3062- protected void setOsPatchLevel (short patch ){
3064+ protected void setVendorPatchLevel (short patch ){
30633065 repository .setVendorPatchLevel (
30643066 KMInteger .cast (patch ).getBuffer (),
30653067 KMInteger .cast (patch ).getStartOff (),
@@ -3129,15 +3131,15 @@ private void processGenerateKey(APDU apdu) {
31293131 KMArray .cast (resp ).add ((short ) 3 , data [CERTIFICATE ]);
31303132 sendOutgoing (apdu , resp );
31313133 }
3132-
3134+ /*
31333135 private static void print(byte[] buf, short start, short length){
31343136 StringBuilder sb = new StringBuilder(length * 2);
31353137 for(short i = start; i < (start+length); i ++){
31363138 sb.append(String.format("%02x", buf[i]));
31373139 }
31383140 System.out.println( sb.toString());
31393141 }
3140-
3142+ */
31413143 private void generateAttestation (byte [] scratchPad ){
31423144 KMAttestationCert cert = makeCert (scratchPad );
31433145 if (cert == null ) {// No certificate
@@ -3155,9 +3157,9 @@ private void generateAttestation(byte[] scratchPad){
31553157 KMByteBlob .cast (certData ).setStartOff (cert .getCertStart ());
31563158 KMByteBlob .cast (certData ).setLength (cert .getCertLength ());
31573159
3158- print (KMByteBlob .cast (certData ).getBuffer (),
3159- KMByteBlob .cast (certData ).getStartOff (),
3160- KMByteBlob .cast (certData ).length ());
3160+ // print(KMByteBlob.cast(certData).getBuffer(),
3161+ // KMByteBlob.cast(certData).getStartOff(),
3162+ // KMByteBlob.cast(certData).length());
31613163 // Initialize the certificate as array of blob
31623164 data [CERTIFICATE ] = KMArray .instance ((short )1 );
31633165 KMArray .cast (data [CERTIFICATE ]).add ((short )0 , certData );
0 commit comments