diff --git a/lib/libpcsc-cpp/include/pcsc-cpp/pcsc-cpp.hpp b/lib/libpcsc-cpp/include/pcsc-cpp/pcsc-cpp.hpp index 2a4fd76..0e226ce 100644 --- a/lib/libpcsc-cpp/include/pcsc-cpp/pcsc-cpp.hpp +++ b/lib/libpcsc-cpp/include/pcsc-cpp/pcsc-cpp.hpp @@ -172,6 +172,9 @@ struct CommandApdu byte_vector data, byte_type le) : CommandApdu {cls, ins, p1, p2, std::move(data)} { +#if defined(__GNUC__) && __GNUC__ == 15 // Apply workaround for GCC 15 + d.reserve(d.size() + 1); +#endif d.push_back(le); } diff --git a/src/electronic-ids/pcsc/FinEID.cpp b/src/electronic-ids/pcsc/FinEID.cpp index 6aeadf1..3b6b064 100644 --- a/src/electronic-ids/pcsc/FinEID.cpp +++ b/src/electronic-ids/pcsc/FinEID.cpp @@ -106,20 +106,21 @@ byte_vector FinEIDv3::sign(const HashAlgorithm hashAlgo, const byte_vector& hash } switch (hashAlgo) { - case HashAlgorithm::SHA224: - case HashAlgorithm::SHA3_224: + using enum HashAlgorithm::HashAlgorithmEnum; + case SHA224: + case SHA3_224: signatureAlgo |= 0x30; break; - case HashAlgorithm::SHA256: - case HashAlgorithm::SHA3_256: + case SHA256: + case SHA3_256: signatureAlgo |= 0x40; break; - case HashAlgorithm::SHA384: - case HashAlgorithm::SHA3_384: + case SHA384: + case SHA3_384: signatureAlgo |= 0x50; break; - case HashAlgorithm::SHA512: - case HashAlgorithm::SHA3_512: + case SHA512: + case SHA3_512: signatureAlgo |= 0x60; break; default: @@ -161,7 +162,7 @@ byte_vector FinEIDv3::sign(const HashAlgorithm hashAlgo, const byte_vector& hash ElectronicID::PinRetriesRemainingAndMax FinEIDv3::pinRetriesLeft(byte_type pinReference) const { const pcsc_cpp::CommandApdu GET_DATA { - 0x00, 0xCB, 0x00, 0xFF, {0xA0, 0x03, 0x83, 0x01, pinReference}}; + 0x00, 0xCB, 0x00, 0xFF, {0xA0, 0x03, 0x83, 0x01, pinReference}, 0x00}; const auto response = card->transmit(GET_DATA); if (!response.isOK()) { THROW(SmartCardError, "Command GET DATA failed with error " + response); diff --git a/tests/mock/select-certificate-script-FIN-V3.hpp b/tests/mock/select-certificate-script-FIN-V3.hpp index 1bef1cc..fc88d5b 100644 --- a/tests/mock/select-certificate-script-FIN-V3.hpp +++ b/tests/mock/select-certificate-script-FIN-V3.hpp @@ -180,7 +180,7 @@ const PcscMock::ApduScript FINEID_V3_SELECT_AUTH_CERTIFICATE_AND_AUTHENTICATE = // 2. PIN Retry count // Get retry count - {{0x00, 0xcb, 0x00, 0xff, 0x05, 0xa0, 0x03, 0x83, 0x01, 0x11}, + {{0x00, 0xcb, 0x00, 0xff, 0x05, 0xa0, 0x03, 0x83, 0x01, 0x11, 0x00}, {0xa0, 0x23, 0x83, 0x01, 0x11, 0x8c, 0x04, 0xf0, 0x00, 0x00, 0x00, 0x9c, 0x04, 0xf0, 0x00, 0x00, 0x00, 0xdf, 0x21, 0x04, 0x05, 0xff, 0xa5, 0x03, 0xdf, 0x27, 0x02, 0xff, 0xff, 0xdf, 0x28, 0x01, 0x0c, 0xdf, 0x2f, 0x01, 0x01, 0x90, 0x00}}, @@ -362,7 +362,7 @@ const PcscMock::ApduScript FINEID_V3_SELECT_SIGN_CERTIFICATE_AND_SIGNING = { // 2. PIN Retry count // Get retry count - {{0x00, 0xcb, 0x00, 0xff, 0x05, 0xa0, 0x03, 0x83, 0x01, 0x82}, + {{0x00, 0xcb, 0x00, 0xff, 0x05, 0xa0, 0x03, 0x83, 0x01, 0x82, 0x00}, {0xa0, 0x23, 0x83, 0x01, 0x82, 0x8c, 0x04, 0xf0, 0x00, 0x00, 0x00, 0x9c, 0x04, 0xf0, 0x00, 0x00, 0x00, 0xdf, 0x21, 0x04, 0x05, 0xff, 0xa5, 0x03, 0xdf, 0x27, 0x02, 0xff, 0xff, 0xdf, 0x28, 0x01, 0x0c, 0xdf, 0x2f, 0x01, 0x01, 0x90, 0x00}}, diff --git a/tests/mock/select-certificate-script-FIN-V4.hpp b/tests/mock/select-certificate-script-FIN-V4.hpp index e362332..b1cd4ec 100644 --- a/tests/mock/select-certificate-script-FIN-V4.hpp +++ b/tests/mock/select-certificate-script-FIN-V4.hpp @@ -132,7 +132,7 @@ const PcscMock::ApduScript FINEID_V4_SELECT_AUTH_CERTIFICATE_AND_AUTHENTICATE { // 2. PIN Retry count // Get retry count - {{0x00, 0xcb, 0x00, 0xff, 0x05, 0xa0, 0x03, 0x83, 0x01, 0x11}, + {{0x00, 0xcb, 0x00, 0xff, 0x05, 0xa0, 0x03, 0x83, 0x01, 0x11, 0x00}, {0xa0, 0x23, 0x83, 0x01, 0x11, 0x8c, 0x04, 0xf0, 0x00, 0x00, 0x00, 0x9c, 0x04, 0xf0, 0x00, 0x00, 0x00, 0xdf, 0x21, 0x04, 0x05, 0xff, 0xa5, 0x03, 0xdf, 0x27, 0x02, 0xff, 0xff, 0xdf, 0x28, 0x01, 0x0c, 0xdf, 0x2f, 0x01, 0x01, 0x90, 0x00}}, @@ -275,7 +275,7 @@ const PcscMock::ApduScript FINEID_V4_SELECT_SIGN_CERTIFICATE_AND_SIGNING { // 2. PIN Retry count // Get retry count - {{0x00, 0xcb, 0x00, 0xff, 0x05, 0xa0, 0x03, 0x83, 0x01, 0x82}, + {{0x00, 0xcb, 0x00, 0xff, 0x05, 0xa0, 0x03, 0x83, 0x01, 0x82, 0x00}, {0xa0, 0x23, 0x83, 0x01, 0x82, 0x8c, 0x04, 0xf0, 0x00, 0x00, 0x00, 0x9c, 0x04, 0xf0, 0x00, 0x00, 0x00, 0xdf, 0x21, 0x04, 0x05, 0xff, 0xa5, 0x03, 0xdf, 0x27, 0x02, 0xff, 0xff, 0xdf, 0x28, 0x01, 0x0c, 0xdf, 0x2f, 0x01, 0x01, 0x90, 0x00}},