|
|
@ -635,7 +635,6 @@ TQString TDECryptographicCardDevice::autoPIN() {
|
|
|
|
ASN1_TYPE* asnValue = otherName->value;
|
|
|
|
ASN1_TYPE* asnValue = otherName->value;
|
|
|
|
if (asnValue) {
|
|
|
|
if (asnValue) {
|
|
|
|
// Found autopin structure
|
|
|
|
// Found autopin structure
|
|
|
|
int index;
|
|
|
|
|
|
|
|
ASN1_TYPE* asnSeqValue = NULL;
|
|
|
|
ASN1_TYPE* asnSeqValue = NULL;
|
|
|
|
ASN1_GENERALSTRING* asnGeneralString = NULL;
|
|
|
|
ASN1_GENERALSTRING* asnGeneralString = NULL;
|
|
|
|
STACK_OF(ASN1_TYPE) *asnSeqValueStack = NULL;
|
|
|
|
STACK_OF(ASN1_TYPE) *asnSeqValueStack = NULL;
|
|
|
@ -643,17 +642,14 @@ TQString TDECryptographicCardDevice::autoPIN() {
|
|
|
|
int asn1SeqValueObjectTag;
|
|
|
|
int asn1SeqValueObjectTag;
|
|
|
|
int asn1SeqValueObjectClass;
|
|
|
|
int asn1SeqValueObjectClass;
|
|
|
|
int returnCode;
|
|
|
|
int returnCode;
|
|
|
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
|
|
|
|
int index = 0; // Search for the PIN field
|
|
|
|
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)
|
|
|
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
|
|
|
|
const uint8_t* asnSeqValueString = ASN1_STRING_get0_data(asnValue->value.sequence);
|
|
|
|
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));
|
|
|
|
asnSeqValueStack = d2i_ASN1_SEQUENCE_ANY(NULL, &asnSeqValueString, ASN1_STRING_length(asnValue->value.sequence));
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
uint8_t* asnSeqValueString = ASN1_STRING_data(asnValue->value.sequence);
|
|
|
|
|
|
|
|
asnSeqValueStack = ASN1_seq_unpack_ASN1_TYPE(asnSeqValueString, ASN1_STRING_length(asnValue->value.sequence), d2i_ASN1_TYPE, ASN1_TYPE_free);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
asnSeqValue = sk_ASN1_TYPE_value(asnSeqValueStack, index);
|
|
|
|
asnSeqValue = sk_ASN1_TYPE_value(asnSeqValueStack, index);
|
|
|
|
if (asnSeqValue) {
|
|
|
|
if (asnSeqValue) {
|
|
|
@ -663,10 +659,10 @@ TQString TDECryptographicCardDevice::autoPIN() {
|
|
|
|
if (!(returnCode & 0x80)) {
|
|
|
|
if (!(returnCode & 0x80)) {
|
|
|
|
if (returnCode == (V_ASN1_CONSTRUCTED + index)) {
|
|
|
|
if (returnCode == (V_ASN1_CONSTRUCTED + index)) {
|
|
|
|
if (d2i_ASN1_GENERALSTRING(&asnGeneralString, &asn1SeqValueObjectData, asn1SeqValueObjectLength) != NULL) {
|
|
|
|
if (d2i_ASN1_GENERALSTRING(&asnGeneralString, &asn1SeqValueObjectData, asn1SeqValueObjectLength) != NULL) {
|
|
|
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
|
|
|
|
#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));
|
|
|
|
retString = TQString((const char *)ASN1_STRING_get0_data(asnGeneralString));
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
retString = TQString((const char *)ASN1_STRING_data(asnGeneralString));
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|