summaryrefslogtreecommitdiffstats
path: root/tdecore/tdehw/tdecryptographiccarddevice.cpp
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2020-06-05 01:39:10 +0200
committerSlávek Banko <slavek.banko@axis.cz>2020-06-05 01:39:10 +0200
commit444839e053e8eebd4d8c8da72b361b63a458d8f4 (patch)
treeeb4d8cb06acfb2c0b25b22943fbf4fbeba241ad2 /tdecore/tdehw/tdecryptographiccarddevice.cpp
parent3f6bef6371b2e286471e2ada6048c6e5670fef53 (diff)
downloadtdelibs-444839e053e8eebd4d8c8da72b361b63a458d8f4.tar.gz
tdelibs-444839e053e8eebd4d8c8da72b361b63a458d8f4.zip
tdehwlib: Re-enable OpenSSL < 1.1 compatibility
in tdecryptographiccarddevice. Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'tdecore/tdehw/tdecryptographiccarddevice.cpp')
-rw-r--r--tdecore/tdehw/tdecryptographiccarddevice.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tdecore/tdehw/tdecryptographiccarddevice.cpp b/tdecore/tdehw/tdecryptographiccarddevice.cpp
index 1b8f9c4a6..d20dbbb03 100644
--- a/tdecore/tdehw/tdecryptographiccarddevice.cpp
+++ b/tdecore/tdehw/tdecryptographiccarddevice.cpp
@@ -643,10 +643,18 @@ TQString TDECryptographicCardDevice::autoPIN() {
int asn1SeqValueObjectTag;
int asn1SeqValueObjectClass;
int returnCode;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ uint8_t* asnSeqValueString = ASN1_STRING_data(asnValue->value.sequence);
+#else
const uint8_t* asnSeqValueString = ASN1_STRING_get0_data(asnValue->value.sequence);
+#endif
index = 0; // Search for the PIN field
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ asnSeqValueStack = ASN1_seq_unpack_ASN1_TYPE(asnSeqValueString, ASN1_STRING_length(asnValue->value.sequence), d2i_ASN1_TYPE, ASN1_TYPE_free);
+#else
asnSeqValueStack = d2i_ASN1_SEQUENCE_ANY(NULL, &asnSeqValueString, ASN1_STRING_length(asnValue->value.sequence));
+#endif
asnSeqValue = sk_ASN1_TYPE_value(asnSeqValueStack, index);
if (asnSeqValue) {
if (asnSeqValue->value.octet_string->data[0] == ((V_ASN1_CONSTRUCTED | V_ASN1_CONTEXT_SPECIFIC) + index)) {
@@ -655,13 +663,19 @@ TQString TDECryptographicCardDevice::autoPIN() {
if (!(returnCode & 0x80)) {
if (returnCode == (V_ASN1_CONSTRUCTED + index)) {
if (d2i_ASN1_GENERALSTRING(&asnGeneralString, &asn1SeqValueObjectData, asn1SeqValueObjectLength) != NULL) {
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ retString = TQString((const char *)ASN1_STRING_data(asnGeneralString));
+#else
retString = TQString((const char *)ASN1_STRING_get0_data(asnGeneralString));
+#endif
}
}
}
}
}
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
sk_ASN1_TYPE_pop_free(asnSeqValueStack, ASN1_TYPE_free);
+#endif
}
}
}