Avoid unused variables and warnings when building against OpenSSL 1.1
This commit is contained in:
+26
-22
@@ -627,20 +627,19 @@ static bool request_certificate(ykpiv_state *state, enum enum_key_format key_for
|
||||
EVP_PKEY *public_key = NULL;
|
||||
const EVP_MD *md;
|
||||
bool ret = false;
|
||||
unsigned char digest[EVP_MAX_MD_SIZE + MAX_OID_LEN];
|
||||
unsigned int digest_len;
|
||||
unsigned int md_len;
|
||||
unsigned char algorithm;
|
||||
int key = 0;
|
||||
unsigned char *signinput;
|
||||
size_t len = 0;
|
||||
size_t oid_len;
|
||||
const unsigned char *oid;
|
||||
#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
|
||||
unsigned char digest[EVP_MAX_MD_SIZE + MAX_OID_LEN];
|
||||
unsigned int md_len;
|
||||
unsigned int digest_len;
|
||||
unsigned char *signinput;
|
||||
size_t len = 0;
|
||||
int nid;
|
||||
ASN1_TYPE null_parameter;
|
||||
|
||||
null_parameter.type = V_ASN1_NULL;
|
||||
null_parameter.value.ptr = NULL;
|
||||
#endif
|
||||
|
||||
key = get_slot_hex(slot);
|
||||
|
||||
@@ -674,9 +673,6 @@ static bool request_certificate(ykpiv_state *state, enum enum_key_format key_for
|
||||
goto request_out;
|
||||
}
|
||||
|
||||
md_len = (unsigned int)EVP_MD_size(md);
|
||||
digest_len = sizeof(digest) - md_len;
|
||||
|
||||
req = X509_REQ_new();
|
||||
if(!req) {
|
||||
fprintf(stderr, "Failed to allocate request structure.\n");
|
||||
@@ -700,6 +696,12 @@ static bool request_certificate(ykpiv_state *state, enum enum_key_format key_for
|
||||
}
|
||||
|
||||
#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
|
||||
null_parameter.type = V_ASN1_NULL;
|
||||
null_parameter.value.ptr = NULL;
|
||||
|
||||
md_len = (unsigned int)EVP_MD_size(md);
|
||||
digest_len = sizeof(digest) - md_len;
|
||||
|
||||
memcpy(digest, oid, oid_len);
|
||||
/* XXX: this should probably use X509_REQ_digest() but that's buggy */
|
||||
if(!ASN1_item_digest(ASN1_ITEM_rptr(X509_REQ_INFO), md, req->req_info,
|
||||
@@ -785,22 +787,21 @@ static bool selfsign_certificate(ykpiv_state *state, enum enum_key_format key_fo
|
||||
X509 *x509 = NULL;
|
||||
X509_NAME *name = NULL;
|
||||
const EVP_MD *md;
|
||||
unsigned char digest[EVP_MAX_MD_SIZE + MAX_OID_LEN];
|
||||
unsigned int digest_len;
|
||||
unsigned char algorithm;
|
||||
int key = 0;
|
||||
unsigned char *signinput;
|
||||
size_t len = 0;
|
||||
size_t oid_len;
|
||||
const unsigned char *oid;
|
||||
int nid;
|
||||
unsigned int md_len;
|
||||
ASN1_INTEGER *sno = ASN1_INTEGER_new();
|
||||
BIGNUM *ser = NULL;
|
||||
#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
|
||||
unsigned char digest[EVP_MAX_MD_SIZE + MAX_OID_LEN];
|
||||
unsigned int digest_len;
|
||||
unsigned int md_len;
|
||||
unsigned char *signinput;
|
||||
size_t len = 0;
|
||||
ASN1_TYPE null_parameter;
|
||||
|
||||
null_parameter.type = V_ASN1_NULL;
|
||||
null_parameter.value.ptr = NULL;
|
||||
#endif
|
||||
|
||||
key = get_slot_hex(slot);
|
||||
|
||||
@@ -833,9 +834,6 @@ static bool selfsign_certificate(ykpiv_state *state, enum enum_key_format key_fo
|
||||
if(md == NULL) {
|
||||
goto selfsign_out;
|
||||
}
|
||||
md_len = (unsigned int)EVP_MD_size(md);
|
||||
digest_len = sizeof(digest) - md_len;
|
||||
|
||||
x509 = X509_new();
|
||||
if(!x509) {
|
||||
fprintf(stderr, "Failed to allocate certificate structure.\n");
|
||||
@@ -904,6 +902,12 @@ static bool selfsign_certificate(ykpiv_state *state, enum enum_key_format key_fo
|
||||
goto selfsign_out;
|
||||
}
|
||||
#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
|
||||
null_parameter.type = V_ASN1_NULL;
|
||||
null_parameter.value.ptr = NULL;
|
||||
|
||||
md_len = (unsigned int)EVP_MD_size(md);
|
||||
digest_len = sizeof(digest) - md_len;
|
||||
|
||||
if(YKPIV_IS_RSA(algorithm)) {
|
||||
signinput = digest;
|
||||
len = oid_len + md_len;
|
||||
|
||||
Reference in New Issue
Block a user