fixup of the patch for SLE-11 (EVP_PKEY_base_id() is not existing there)

OBS-URL: https://build.opensuse.org/package/show/security/tpm-tools?expand=0&rev=37
This commit is contained in:
Matthias Gerstner 2017-11-10 09:07:34 +00:00 committed by Git OBS Bridge
parent 24602f72ea
commit 585aac949f

View File

@ -1,14 +1,14 @@
From 9c486d6b176e5dd7629ce2fe138b72f368f293ec Mon Sep 17 00:00:00 2001
From e6ef35d6a7dd4ab3d755c9cde5a5f589146af9e7 Mon Sep 17 00:00:00 2001
From: Matthias Gerstner <matthias.gerstner@suse.de>
Date: Thu, 9 Nov 2017 17:53:30 +0100
Subject: [PATCH] Fix build against OpenSSL 1.1.0 when P11 support is enabled
---
src/data_mgmt/data_import.c | 145 +++++++++++++++++++++++++++++++++++++-------
1 file changed, 124 insertions(+), 21 deletions(-)
src/data_mgmt/data_import.c | 154 ++++++++++++++++++++++++++++++++++++++------
1 file changed, 133 insertions(+), 21 deletions(-)
diff --git a/src/data_mgmt/data_import.c b/src/data_mgmt/data_import.c
index f534717..d699686 100644
index f534717..0ba4162 100644
--- a/src/data_mgmt/data_import.c
+++ b/src/data_mgmt/data_import.c
@@ -39,6 +39,9 @@
@ -21,7 +21,7 @@ index f534717..d699686 100644
/*
* Global variables
@@ -58,6 +61,95 @@ CK_ULONG g_ulIdLen = 0;
@@ -58,6 +61,104 @@ CK_ULONG g_ulIdLen = 0;
CK_BYTE *g_pchName = NULL; // LABEL attribute value
CK_ULONG g_ulNameLen = 0;
@ -113,20 +113,29 @@ index f534717..d699686 100644
+#endif
+}
+
+static int
+getEVPKeyType( EVP_PKEY *a_pKey ) {
+#ifdef USE_OPENSSL_110_API
+ return EVP_PKEY_base_id( a_pKey );
+#else
+ return EVP_PKEY_type( a_pKey->type );
+#endif
+}
+
+
/*
* parseCallback
* Process the command specific options.
@@ -372,7 +464,7 @@ readX509Cert( const char *a_pszFile,
@@ -372,7 +473,7 @@ readX509Cert( const char *a_pszFile,
goto out;
}
- if ( EVP_PKEY_type( pKey->type ) != EVP_PKEY_RSA ) {
+ if ( EVP_PKEY_base_id( pKey ) != EVP_PKEY_RSA ) {
+ if ( getEVPKeyType(pKey) != EVP_PKEY_RSA ) {
logError( TOKEN_RSA_KEY_ERROR );
X509_free( pX509 );
@@ -690,9 +782,11 @@ createRsaPubKeyObject( RSA *a_pRsa,
@@ -690,9 +791,11 @@ createRsaPubKeyObject( RSA *a_pRsa,
CK_OBJECT_HANDLE *a_hObject ) {
int rc = -1;
@ -140,7 +149,7 @@ index f534717..d699686 100644
CK_RV rv;
@@ -732,8 +826,8 @@ createRsaPubKeyObject( RSA *a_pRsa,
@@ -732,8 +835,8 @@ createRsaPubKeyObject( RSA *a_pRsa,
}
// Get binary representations of the RSA key information
@ -151,7 +160,7 @@ index f534717..d699686 100644
// Create the RSA public key object
rv = createObject( a_hSession, tAttr, ulAttrCount, a_hObject );
@@ -760,14 +854,23 @@ createRsaPrivKeyObject( RSA *a_pRsa,
@@ -760,14 +863,23 @@ createRsaPrivKeyObject( RSA *a_pRsa,
int rc = -1;
@ -183,7 +192,7 @@ index f534717..d699686 100644
CK_RV rv;
@@ -821,14 +924,14 @@ createRsaPrivKeyObject( RSA *a_pRsa,
@@ -821,14 +933,14 @@ createRsaPrivKeyObject( RSA *a_pRsa,
}
// Get binary representations of the RSA key information