Index: xca-0.8.0/lib/pki_evp.cpp =================================================================== --- xca-0.8.0.orig/lib/pki_evp.cpp +++ xca-0.8.0/lib/pki_evp.cpp @@ -25,9 +25,11 @@ QString pki_evp::passHash = QString(); QPixmap *pki_evp::icon[2]= { NULL, NULL }; +#ifndef DISABLE_EC EC_builtin_curve *pki_evp::curves = NULL; size_t pki_evp::num_curves = 0; unsigned char *pki_evp::curve_flags = NULL; +#endif void pki_evp::erasePasswd() { @@ -107,7 +109,9 @@ void pki_evp::generate(int bits, int typ { RSA *rsakey; DSA *dsakey; +#ifndef DISABLE_EC EC_KEY *eckey; +#endif progress->setMinimum(0); progress->setMaximum(100); @@ -127,6 +131,7 @@ void pki_evp::generate(int bits, int typ if (dsakey) EVP_PKEY_set1_DSA(key, dsakey); break; +#ifndef DISABLE_EC case EVP_PKEY_EC: EC_GROUP *group = EC_GROUP_new_by_curve_name(curve_nid); if (!group) @@ -147,6 +152,7 @@ void pki_evp::generate(int bits, int typ EC_KEY_free(eckey); EC_GROUP_free(group); break; +#endif } openssl_error(); encryptKey(); @@ -190,8 +196,10 @@ static bool EVP_PKEY_isPrivKey(EVP_PKEY return key->pkey.rsa->d ? true: false; case EVP_PKEY_DSA: return key->pkey.dsa->priv_key ? true: false; +#ifndef DISABLE_EC case EVP_PKEY_EC: return EC_KEY_get0_private_key(key->pkey.ec) ? true: false; +#endif } return false; } @@ -236,6 +244,7 @@ void pki_evp::fromPEM_BIO(BIO *bio, QStr openssl_error(name); } +#ifndef DISABLE_EC static void search_ec_oid(EC_KEY *ec) { const EC_GROUP *ec_group = EC_KEY_get0_group(ec); @@ -260,6 +269,7 @@ static void search_ec_oid(EC_KEY *ec) } } } +#endif void pki_evp::fload(const QString fname) { @@ -301,8 +311,10 @@ void pki_evp::fload(const QString fname) } fclose(fp); if (pkey){ +#ifndef DISABLE_EC if (pkey->type == EVP_PKEY_EC) search_ec_oid(pkey->pkey.ec); +#endif if (key) EVP_PKEY_free(key); key = pkey; @@ -680,7 +692,9 @@ const EVP_MD *pki_evp::getDefaultMD() switch (key->type) { case EVP_PKEY_RSA: md = EVP_sha1(); break; case EVP_PKEY_DSA: md = EVP_dss1(); break; +#ifndef DISABLE_EC case EVP_PKEY_EC: md = EVP_ecdsa(); break; +#endif default: md = NULL; break; } return md; Index: xca-0.8.0/lib/pki_scard.cpp =================================================================== --- xca-0.8.0.orig/lib/pki_scard.cpp +++ xca-0.8.0/lib/pki_scard.cpp @@ -178,6 +178,7 @@ EVP_PKEY *pki_scard::load_pubkey(pkcs11 EVP_PKEY_set1_DSA(pkey, dsa); break; } +#ifndef DISABLE_EC case CKK_EC: { EC_KEY *ec = EC_KEY_new(); @@ -202,6 +203,7 @@ EVP_PKEY *pki_scard::load_pubkey(pkcs11 EVP_PKEY_set1_EC_KEY(pkey, ec); break; } +#endif default: throw errorEx(QString("Unsupported CKA_KEY_TYPE: %1\n").arg(keytype)); } @@ -304,8 +306,10 @@ const EVP_MD *pki_scard::getDefaultMD() return EVP_sha1(); if (mech_list.contains(CKM_DSA_SHA1)) return EVP_dss1(); +#ifndef DISABLE_EC if (mech_list.contains(CKM_ECDSA_SHA1)) return EVP_ecdsa(); +#endif if (mech_list.contains(CKM_SHA512_RSA_PKCS)) return EVP_sha512(); if (mech_list.contains(CKM_SHA384_RSA_PKCS)) Index: xca-0.8.0/widgets/KeyDetail.cpp =================================================================== --- xca-0.8.0.orig/widgets/KeyDetail.cpp +++ xca-0.8.0/widgets/KeyDetail.cpp @@ -25,6 +25,7 @@ KeyDetail::KeyDetail(QWidget *parent) keyDesc->setReadOnly(true); } +#ifndef DISABLE_EC static QString CurveComment(int nid) { for (size_t i=0; i<pki_evp::num_curves; i++) { @@ -33,6 +34,7 @@ static QString CurveComment(int nid) } return QString(); } +#endif void KeyDetail::setKey(pki_key *key) { @@ -75,6 +77,7 @@ void KeyDetail::setKey(pki_key *key) keyPubEx->setText(key->subprime()); keyModulus->setText(key->pubkey()); break; +#ifndef DISABLE_EC case EVP_PKEY_EC: nid = key->ecParamNid(); tlModulus->setText(tr("Public key")); @@ -84,6 +87,7 @@ void KeyDetail::setKey(pki_key *key) keyPubEx->setToolTip(CurveComment(nid)); keyModulus->setText(key->ecPubKey()); break; +#endif default: tlHeader->setText(tr("UNKNOWN Key")); } Index: xca-0.8.0/widgets/NewKey.cpp =================================================================== --- xca-0.8.0.orig/widgets/NewKey.cpp +++ xca-0.8.0/widgets/NewKey.cpp @@ -23,7 +23,9 @@ struct typelist { static const struct typelist typeList[] = { { "RSA", EVP_PKEY_RSA }, { "DSA", EVP_PKEY_DSA }, +#ifndef DISABLE_EC { "EC", EVP_PKEY_EC }, +#endif }; NewKey::NewKey(QWidget *parent, QString name) @@ -48,6 +50,7 @@ NewKey::NewKey(QWidget *parent, QString keyType->addItem(QString(typeList[i].name)); } +#ifndef DISABLE_EC for (i = 0; i<pki_evp::num_curves; i++) { const char *desc = pki_evp::curves[i].comment; const char *sn = OBJ_nid2sn(pki_evp::curves[i].nid); @@ -65,6 +68,8 @@ NewKey::NewKey(QWidget *parent, QString } curveBox->addItems(curve_x962); curveBox->addItems(curve_other); +#endif + keyLength->setCurrentIndex(0); keyDesc->setFocus(); } Index: xca-0.8.0/widgets/hashBox.cpp =================================================================== --- xca-0.8.0.orig/widgets/hashBox.cpp +++ xca-0.8.0/widgets/hashBox.cpp @@ -42,8 +42,10 @@ const EVP_MD *hashBox::currentHash() switch(key_type) { case EVP_PKEY_DSA: return EVP_dss1(); +#ifndef DISABLE_EC case EVP_PKEY_EC: return EVP_ecdsa(); +#endif default: QString hash = currentText(); for (unsigned i=0; i<ARRAY_SIZE(hashalgos); i++) { Index: xca-0.8.0/lib/pki_evp.h =================================================================== --- xca-0.8.0.orig/lib/pki_evp.h +++ xca-0.8.0/lib/pki_evp.h @@ -40,9 +40,11 @@ class pki_evp: public pki_key static void setOldPasswd(const char *pass); static QString md5passwd(const char *pass); static QString sha512passwd(QString pass, QString salt); +#ifndef DISABLE_EC static EC_builtin_curve *curves; static size_t num_curves; static unsigned char *curve_flags; +#endif void generate(int bits, int type, QProgressBar *progress); void generate(int bits, int type, QProgressBar *progress, Index: xca-0.8.0/lib/pki_key.cpp =================================================================== --- xca-0.8.0.orig/lib/pki_key.cpp +++ xca-0.8.0/lib/pki_key.cpp @@ -138,6 +138,7 @@ QString pki_key::pubkey() return QString(); } +#ifndef DISABLE_EC int pki_key::ecParamNid() { if (key->type != EVP_PKEY_EC) @@ -160,6 +161,7 @@ QString pki_key::ecPubKey() } return pub; } +#endif bool pki_key::compare(pki_base *ref) { Index: xca-0.8.0/widgets/MainWindow.cpp =================================================================== --- xca-0.8.0.orig/widgets/MainWindow.cpp +++ xca-0.8.0/widgets/MainWindow.cpp @@ -97,6 +97,7 @@ static const int other_curve_nids[] = { static void init_curves() { +#ifndef DISABLE_EC pki_evp::num_curves = EC_get_builtin_curves(NULL, 0); pki_evp::curves = (EC_builtin_curve*)OPENSSL_malloc( (int)(sizeof(EC_builtin_curve) *pki_evp::num_curves)); @@ -125,6 +126,7 @@ static void init_curves() } } } +#endif } void MainWindow::load_engine()