diff options
Diffstat (limited to 'snxxx/1.1/SecureElement.cpp')
-rwxr-xr-x | snxxx/1.1/SecureElement.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/snxxx/1.1/SecureElement.cpp b/snxxx/1.1/SecureElement.cpp index 409811f..3a2834c 100755 --- a/snxxx/1.1/SecureElement.cpp +++ b/snxxx/1.1/SecureElement.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright 2018-2020 NXP + * Copyright 2018-2021 NXP * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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" @@ -565,13 +567,17 @@ Return<SecureElementStatus> SecureElement::internalCloseChannel( LOG(ERROR) << "Acquired the lock in SPI internalCloseChannel"; LOG(INFO) << StringPrintf("mMaxChannelCount = %d, Closing Channel = %d", mMaxChannelCount, channelNumber); - if ((int8_t)channelNumber < DEFAULT_BASIC_CHANNEL || - channelNumber >= mMaxChannelCount) { + if (channelNumber >= mMaxChannelCount) { LOG(ERROR) << StringPrintf("invalid channel!!! %d", channelNumber); } else if (channelNumber > DEFAULT_BASIC_CHANNEL) { 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 */ |