Blame SOURCES/0001-Fix-the-build-with-older-gcrypt-in-RHEL-7.patch

87bbff
From 3cc1bcebd9da74f8d2fa8648e076ba715e76c657 Mon Sep 17 00:00:00 2001
87bbff
From: Kalev Lember <klember@redhat.com>
87bbff
Date: Fri, 25 May 2018 18:43:32 +0200
87bbff
Subject: [PATCH] Fix the build with older gcrypt in RHEL 7
87bbff
87bbff
Use deprecated GCRY_PK_ECDSA instead of GCRY_PK_ECC (which will be
87bbff
mapped to GCRY_PK_ECC in newer versions).
87bbff
---
87bbff
 pkcs11/gkm/gkm-crypto.c            |  4 ++--
87bbff
 pkcs11/gkm/gkm-data-der.c          | 10 +++++-----
87bbff
 pkcs11/gkm/gkm-private-xsa-key.c   |  4 ++--
87bbff
 pkcs11/gkm/gkm-public-xsa-key.c    |  4 ++--
87bbff
 pkcs11/gkm/gkm-sexp-key.c          |  4 ++--
87bbff
 pkcs11/gkm/gkm-sexp.c              |  2 +-
87bbff
 pkcs11/gkm/test-sexp.c             |  2 +-
87bbff
 pkcs11/ssh-store/gkm-ssh-openssh.c |  4 ++--
87bbff
 8 files changed, 17 insertions(+), 17 deletions(-)
87bbff
87bbff
diff --git a/pkcs11/gkm/gkm-crypto.c b/pkcs11/gkm/gkm-crypto.c
87bbff
index 7195e0a..cafe251 100644
87bbff
--- a/pkcs11/gkm/gkm-crypto.c
87bbff
+++ b/pkcs11/gkm/gkm-crypto.c
87bbff
@@ -306,7 +306,7 @@ gkm_crypto_sign_xsa (gcry_sexp_t sexp, CK_MECHANISM_TYPE mech, CK_BYTE_PTR data,
87bbff
 		rv = gkm_dsa_mechanism_sign (sexp, data, n_data, signature, n_signature);
87bbff
 		break;
87bbff
 	case CKM_ECDSA:
87bbff
-		g_return_val_if_fail (algorithm == GCRY_PK_ECC, CKR_GENERAL_ERROR);
87bbff
+		g_return_val_if_fail (algorithm == GCRY_PK_ECDSA, CKR_GENERAL_ERROR);
87bbff
 		rv = gkm_ecdsa_mechanism_sign (sexp, data, n_data, signature, n_signature);
87bbff
 		break;
87bbff
 	default:
87bbff
@@ -370,7 +370,7 @@ gkm_crypto_verify_xsa (gcry_sexp_t sexp, CK_MECHANISM_TYPE mech, CK_BYTE_PTR dat
87bbff
 		rv = gkm_dsa_mechanism_verify (sexp, data, n_data, signature, n_signature);
87bbff
 		break;
87bbff
 	case CKM_ECDSA:
87bbff
-		g_return_val_if_fail (algorithm == GCRY_PK_ECC, CKR_GENERAL_ERROR);
87bbff
+		g_return_val_if_fail (algorithm == GCRY_PK_ECDSA, CKR_GENERAL_ERROR);
87bbff
 		rv = gkm_ecdsa_mechanism_verify (sexp, data, n_data, signature, n_signature);
87bbff
 		break;
87bbff
 	default:
87bbff
diff --git a/pkcs11/gkm/gkm-data-der.c b/pkcs11/gkm/gkm-data-der.c
87bbff
index 68f41d4..2f91eaf 100644
87bbff
--- a/pkcs11/gkm/gkm-data-der.c
87bbff
+++ b/pkcs11/gkm/gkm-data-der.c
87bbff
@@ -800,7 +800,7 @@ gkm_data_der_read_private_pkcs8_plain (GBytes *data,
87bbff
 	else if (key_algo == OID_PKIX1_DSA)
87bbff
 		algorithm = GCRY_PK_DSA;
87bbff
 	else if (key_algo == OID_PKIX1_ECDSA)
87bbff
-		algorithm = GCRY_PK_ECC;
87bbff
+		algorithm = GCRY_PK_ECDSA;
87bbff
 
87bbff
 	if (!algorithm) {
87bbff
 		ret = GKM_DATA_UNRECOGNIZED;
87bbff
@@ -829,7 +829,7 @@ done:
87bbff
 			if (ret == GKM_DATA_UNRECOGNIZED && params)
87bbff
 				ret = gkm_data_der_read_private_key_dsa_parts (keydata, params, s_key);
87bbff
 			break;
87bbff
-		case GCRY_PK_ECC:
87bbff
+		case GCRY_PK_ECDSA:
87bbff
 			ret = gkm_data_der_read_private_key_ecdsa (keydata, s_key);
87bbff
 			break;
87bbff
 		default:
87bbff
@@ -1325,7 +1325,7 @@ gkm_data_der_write_public_key (gcry_sexp_t s_key)
87bbff
 		return gkm_data_der_write_public_key_rsa (s_key);
87bbff
 	case GCRY_PK_DSA:
87bbff
 		return gkm_data_der_write_public_key_dsa (s_key);
87bbff
-	case GCRY_PK_ECC:
87bbff
+	case GCRY_PK_ECDSA:
87bbff
 		return gkm_data_der_write_public_key_ecdsa (s_key);
87bbff
 	default:
87bbff
 		g_return_val_if_reached (NULL);
87bbff
@@ -1350,7 +1350,7 @@ gkm_data_der_write_private_key (gcry_sexp_t s_key)
87bbff
 		return gkm_data_der_write_private_key_rsa (s_key);
87bbff
 	case GCRY_PK_DSA:
87bbff
 		return gkm_data_der_write_private_key_dsa (s_key);
87bbff
-	case GCRY_PK_ECC:
87bbff
+	case GCRY_PK_ECDSA:
87bbff
 		return gkm_data_der_write_private_key_ecdsa (s_key);
87bbff
 	default:
87bbff
 		g_return_val_if_reached (NULL);
87bbff
@@ -1460,7 +1460,7 @@ gkm_data_der_write_private_pkcs8_plain (gcry_sexp_t skey)
87bbff
 		params = gkm_data_der_write_private_key_dsa_params (skey);
87bbff
 		break;
87bbff
 
87bbff
-	case GCRY_PK_ECC:
87bbff
+	case GCRY_PK_ECDSA:
87bbff
 		oid = OID_PKIX1_ECDSA;
87bbff
 		params = NULL;
87bbff
 		key = gkm_data_der_write_private_key_ecdsa (skey);
87bbff
diff --git a/pkcs11/gkm/gkm-private-xsa-key.c b/pkcs11/gkm/gkm-private-xsa-key.c
87bbff
index 3dbbd12..878d5f0 100644
87bbff
--- a/pkcs11/gkm/gkm-private-xsa-key.c
87bbff
+++ b/pkcs11/gkm/gkm-private-xsa-key.c
87bbff
@@ -361,10 +361,10 @@ gkm_private_xsa_key_real_get_attribute (GkmObject *base, GkmSession *session, CK
87bbff
 		return gkm_sexp_key_set_part (GKM_SEXP_KEY (self), GCRY_PK_DSA, "g", attr);
87bbff
 
87bbff
 	case CKA_EC_POINT:
87bbff
-		return gkm_sexp_key_set_ec_q (GKM_SEXP_KEY (self), GCRY_PK_ECC, attr);
87bbff
+		return gkm_sexp_key_set_ec_q (GKM_SEXP_KEY (self), GCRY_PK_ECDSA, attr);
87bbff
 
87bbff
 	case CKA_EC_PARAMS:
87bbff
-		return gkm_sexp_key_set_ec_params (GKM_SEXP_KEY (self), GCRY_PK_ECC, attr);
87bbff
+		return gkm_sexp_key_set_ec_params (GKM_SEXP_KEY (self), GCRY_PK_ECDSA, attr);
87bbff
 
87bbff
 	/* (EC)DSA private parts */
87bbff
 	case CKA_VALUE:
87bbff
diff --git a/pkcs11/gkm/gkm-public-xsa-key.c b/pkcs11/gkm/gkm-public-xsa-key.c
87bbff
index 5cc93f3..fced172 100644
87bbff
--- a/pkcs11/gkm/gkm-public-xsa-key.c
87bbff
+++ b/pkcs11/gkm/gkm-public-xsa-key.c
87bbff
@@ -267,10 +267,10 @@ gkm_public_xsa_key_real_get_attribute (GkmObject *base, GkmSession *session, CK_
87bbff
 		return gkm_sexp_key_set_part (GKM_SEXP_KEY (self), GCRY_PK_DSA, "y", attr);
87bbff
 
87bbff
 	case CKA_EC_POINT:
87bbff
-		return gkm_sexp_key_set_ec_q (GKM_SEXP_KEY (self), GCRY_PK_ECC, attr);
87bbff
+		return gkm_sexp_key_set_ec_q (GKM_SEXP_KEY (self), GCRY_PK_ECDSA, attr);
87bbff
 
87bbff
 	case CKA_EC_PARAMS:
87bbff
-		return gkm_sexp_key_set_ec_params (GKM_SEXP_KEY (self), GCRY_PK_ECC, attr);
87bbff
+		return gkm_sexp_key_set_ec_params (GKM_SEXP_KEY (self), GCRY_PK_ECDSA, attr);
87bbff
 	};
87bbff
 
87bbff
 	return GKM_OBJECT_CLASS (gkm_public_xsa_key_parent_class)->get_attribute (base, session, attr);
87bbff
diff --git a/pkcs11/gkm/gkm-sexp-key.c b/pkcs11/gkm/gkm-sexp-key.c
87bbff
index 8b98bdc..9d0f233 100644
87bbff
--- a/pkcs11/gkm/gkm-sexp-key.c
87bbff
+++ b/pkcs11/gkm/gkm-sexp-key.c
87bbff
@@ -65,7 +65,7 @@ gkm_sexp_key_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIB
87bbff
 				return gkm_attribute_set_ulong (attr, CKK_RSA);
87bbff
 			case GCRY_PK_DSA:
87bbff
 				return gkm_attribute_set_ulong (attr, CKK_DSA);
87bbff
-			case GCRY_PK_ECC:
87bbff
+			case GCRY_PK_ECDSA:
87bbff
 				return gkm_attribute_set_ulong (attr, CKK_ECDSA);
87bbff
 			default:
87bbff
 				g_return_val_if_reached (CKR_GENERAL_ERROR);
87bbff
@@ -104,7 +104,7 @@ gkm_sexp_key_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIB
87bbff
 		case GCRY_PK_DSA:
87bbff
 			return gkm_attribute_set_data (attr, (CK_VOID_PTR)GKM_DSA_MECHANISMS,
87bbff
 			                               sizeof (GKM_DSA_MECHANISMS));
87bbff
-		case GCRY_PK_ECC:
87bbff
+		case GCRY_PK_ECDSA:
87bbff
 			return gkm_attribute_set_data (attr, (CK_VOID_PTR)GKM_ECDSA_MECHANISMS,
87bbff
 			                               sizeof (GKM_ECDSA_MECHANISMS));
87bbff
 		default:
87bbff
diff --git a/pkcs11/gkm/gkm-sexp.c b/pkcs11/gkm/gkm-sexp.c
87bbff
index 287f874..d2c8a53 100644
87bbff
--- a/pkcs11/gkm/gkm-sexp.c
87bbff
+++ b/pkcs11/gkm/gkm-sexp.c
87bbff
@@ -235,7 +235,7 @@ gkm_sexp_key_to_public (gcry_sexp_t privkey, gcry_sexp_t *pubkey)
87bbff
 	case GCRY_PK_DSA:
87bbff
 		*pubkey = dsa_numbers_to_public (numbers);
87bbff
 		break;
87bbff
-	case GCRY_PK_ECC:
87bbff
+	case GCRY_PK_ECDSA:
87bbff
 		*pubkey = ecdsa_numbers_to_public (numbers);
87bbff
 		break;
87bbff
 	default:
87bbff
diff --git a/pkcs11/gkm/test-sexp.c b/pkcs11/gkm/test-sexp.c
87bbff
index ba104a0..78cc08e 100644
87bbff
--- a/pkcs11/gkm/test-sexp.c
87bbff
+++ b/pkcs11/gkm/test-sexp.c
87bbff
@@ -152,7 +152,7 @@ test_parse_key (Test *test, gconstpointer unused)
87bbff
 	/* Get the private key out */
87bbff
 	ret = gkm_sexp_parse_key (test->ecdsakey, &algorithm, &is_priv, &sexp;;
87bbff
 	g_assert (ret);
87bbff
-	g_assert (algorithm == GCRY_PK_ECC);
87bbff
+	g_assert (algorithm == GCRY_PK_ECDSA);
87bbff
 	g_assert (is_priv == TRUE);
87bbff
 	g_assert (sexp != NULL);
87bbff
 	gcry_sexp_release (sexp);
87bbff
diff --git a/pkcs11/ssh-store/gkm-ssh-openssh.c b/pkcs11/ssh-store/gkm-ssh-openssh.c
87bbff
index 6c21264..c1644d5 100644
87bbff
--- a/pkcs11/ssh-store/gkm-ssh-openssh.c
87bbff
+++ b/pkcs11/ssh-store/gkm-ssh-openssh.c
87bbff
@@ -34,7 +34,7 @@ keytype_to_algo (const gchar *salgo)
87bbff
 	else if ((strcmp (salgo, "ecdsa-sha2-nistp256") == 0)
87bbff
 	    || (strcmp (salgo, "ecdsa-sha2-nistp384") == 0)
87bbff
 	    || (strcmp (salgo, "ecdsa-sha2-nistp521") == 0))
87bbff
-		return GCRY_PK_ECC;
87bbff
+		return GCRY_PK_ECDSA;
87bbff
 	return 0;
87bbff
 }
87bbff
 
87bbff
@@ -190,7 +190,7 @@ read_public (EggBuffer *req, gsize *offset, gcry_sexp_t *key, int *algo)
87bbff
 	case GCRY_PK_DSA:
87bbff
 		ret = read_public_dsa (req, offset, key);
87bbff
 		break;
87bbff
-	case GCRY_PK_ECC:
87bbff
+	case GCRY_PK_ECDSA:
87bbff
 		ret = read_public_ecdsa (req, offset, key);
87bbff
 		break;
87bbff
 	default:
87bbff
-- 
87bbff
1.8.3.1
87bbff