summaryrefslogtreecommitdiff
path: root/snxxx/1.0/SecureElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'snxxx/1.0/SecureElement.cpp')
-rwxr-xr-xsnxxx/1.0/SecureElement.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/snxxx/1.0/SecureElement.cpp b/snxxx/1.0/SecureElement.cpp
index 61f1e7f..18c5176 100755
--- a/snxxx/1.0/SecureElement.cpp
+++ b/snxxx/1.0/SecureElement.cpp
@@ -16,8 +16,10 @@
*
******************************************************************************/
#include "SecureElement.h"
+
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
+
#include "NxpEse.h"
#include "eSEClient.h"
#include "hal_nxpese.h"
@@ -502,8 +504,7 @@ SecureElement::internalCloseChannel(uint8_t channelNumber) {
LOG(ERROR) << "Acquired the lock in SPI internalCloseChannel";
LOG(INFO) << StringPrintf("mMaxChannelCount = %d, Closing Channel = %d",
mMaxChannelCount, channelNumber);
- if (channelNumber < DEFAULT_BASIC_CHANNEL ||
- channelNumber >= mMaxChannelCount) {
+ if (channelNumber >= mMaxChannelCount) {
LOG(ERROR) << StringPrintf("invalid channel!!! %d for %d", channelNumber,
mOpenedChannels[channelNumber]);
sestatus = SecureElementStatus::FAILED;
@@ -511,6 +512,11 @@ SecureElement::internalCloseChannel(uint8_t channelNumber) {
phNxpEse_memset(&cpdu, 0x00, sizeof(phNxpEse_7816_cpdu_t));
phNxpEse_memset(&rpdu, 0x00, sizeof(phNxpEse_7816_rpdu_t));
cpdu.cla = channelNumber; /* Class of instruction */
+ // For Suplementary Channel update CLA byte according to GP
+ if ((channelNumber > 0x03) && (channelNumber < 0x14)) {
+ /* update CLA byte accoridng to GP spec Table 11-12*/
+ cpdu.cla = 0x40 + (channelNumber - 4); /* Class of instruction */
+ }
cpdu.ins = 0x70; /* Instruction code */
cpdu.p1 = 0x80; /* Instruction parameter 1 */
cpdu.p2 = channelNumber; /* Instruction parameter 2 */