summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2020-06-05 09:13:48 +0200
committerSlávek Banko <slavek.banko@axis.cz>2020-06-05 09:13:48 +0200
commitf8116fd3ef168194065494b5c40eed8106370941 (patch)
treec9215e33f2aca229bc7353e3fe61946565652612
parent9ec2a99d6c4670faab2c062fd9a3b9c09f3f3561 (diff)
downloadsmartcardauth-f8116fd3ef168194065494b5c40eed8106370941.tar.gz
smartcardauth-f8116fd3ef168194065494b5c40eed8106370941.zip
Re-enable OpenSSL < 1.1 compatibility.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--src/cardpincheck.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cardpincheck.c b/src/cardpincheck.c
index ed884e1..e57f86c 100644
--- a/src/cardpincheck.c
+++ b/src/cardpincheck.c
@@ -139,10 +139,18 @@ char* tde_autopin(X509* x509_cert) {
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)) {
@@ -151,13 +159,19 @@ char* tde_autopin(X509* x509_cert) {
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 = strdup(ASN1_STRING_data(asnGeneralString));
+#else
retString = strdup(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
}
}
}