summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2020-06-02 20:45:40 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2020-06-03 06:43:00 -0500
commitef2c98aa2bb834de42014b1588440230118e4789 (patch)
treecf83d107a4ee694584c460f4460637118a067d99
parent7471b0548d17f2f643d4d99502dbd8f04b4b08d2 (diff)
downloadsmartcardauth-ef2c98aa.tar.gz
smartcardauth-ef2c98aa.zip
Update card PIN check utility for modern OpenSSL library versions
Signed-off-by: Timothy Pearson <kb9vqf@pearsoncomputing.net>
-rw-r--r--src/cardpincheck.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/cardpincheck.c b/src/cardpincheck.c
index ae1da9a..ed884e1 100644
--- a/src/cardpincheck.c
+++ b/src/cardpincheck.c
@@ -1,5 +1,5 @@
/* Cryptographic card PIN check and RSA decryption utility
- * Copyright (C) 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
+ * Copyright (C) 2015 - 2020 Timothy Pearson <kb9vqf@pearsoncomputing.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,6 +16,7 @@
*/
#include <stdio.h>
+#include <stdint.h>
#include <termios.h>
#include <unistd.h>
#include <string.h>
@@ -138,9 +139,10 @@ char* tde_autopin(X509* x509_cert) {
int asn1SeqValueObjectTag;
int asn1SeqValueObjectClass;
int returnCode;
+ const uint8_t* asnSeqValueString = ASN1_STRING_get0_data(asnValue->value.sequence);
index = 0; // Search for the PIN field
- asnSeqValueStack = ASN1_seq_unpack_ASN1_TYPE(ASN1_STRING_data(asnValue->value.sequence), ASN1_STRING_length(asnValue->value.sequence), d2i_ASN1_TYPE, ASN1_TYPE_free);
+ asnSeqValueStack = d2i_ASN1_SEQUENCE_ANY(NULL, &asnSeqValueString, ASN1_STRING_length(asnValue->value.sequence));
asnSeqValue = sk_ASN1_TYPE_value(asnSeqValueStack, index);
if (asnSeqValue) {
if (asnSeqValue->value.octet_string->data[0] == ((V_ASN1_CONSTRUCTED | V_ASN1_CONTEXT_SPECIFIC) + index)) {
@@ -149,12 +151,13 @@ char* tde_autopin(X509* x509_cert) {
if (!(returnCode & 0x80)) {
if (returnCode == (V_ASN1_CONSTRUCTED + index)) {
if (d2i_ASN1_GENERALSTRING(&asnGeneralString, &asn1SeqValueObjectData, asn1SeqValueObjectLength) != NULL) {
- retString = strdup(ASN1_STRING_data(asnGeneralString));
+ retString = strdup(ASN1_STRING_get0_data(asnGeneralString));
}
}
}
}
}
+ sk_ASN1_TYPE_pop_free(asnSeqValueStack, ASN1_TYPE_free);
}
}
}