nodejs: make ECDH optional

This commit is contained in:
Anton Bolshakov 2015-08-02 09:13:20 +00:00
parent a3dfba5ba6
commit 4b6a0aed36
3 changed files with 114 additions and 9 deletions

View file

@ -1,4 +1,4 @@
AUX nodejs-0.12.7_bindist.patch 733 SHA256 b5c817c420cf1f64299df0c93198990670faf55afc72b318a4af94f3431c6e39 SHA512 e5f94f8b648e4a19e964121f7901f936a7da8fd10e33eeab744e76c638bb31ac48d4cc6aebc5dc017faaf4d69450e64739acedb42b8af433d091c9ad66ecb441 WHIRLPOOL 2996f4b42f5db67858d588aa9ffcff475b1b84eb80fe2c37e0a8cfb44e0eb7eae4358ab332419e429aa978b1fda30be4fb1ebeffa1e1e4e878d00ef22965d290
AUX nodejs-0.12.7_bindist.patch 3679 SHA256 57d13ea5e40b6eeef580e7be0d9ba8b96cb59d83735a998a4174130538c2e256 SHA512 2ebf1d490f2dcd49fff928927507e2299e2df5c1edbfe8af1f9230268ffcba269459594d1a08d5ae416982358d59f4ad908058ef0906f33369f889e3d7919536 WHIRLPOOL 1c3844f6563460808418e1474733a670e7c504405bf006fea828987867cc9b1563e82892995435403bc6697362a139f8b281efaff18137e2ee5304ae4c0871be
AUX nodejs-0.12.7_ssl.patch 863 SHA256 2e4952286c145892b65091321b9ec5af88d2fb3114b3500ec78d7520a8952eb8 SHA512 23ebfe5c36f4f0998552c1a66eb8c3719990fa5dbd41d00cefdf65c0b598de29d1d88378c5600e7ea62997b13635b6fac59ec9a060e086acb453490cfda48569 WHIRLPOOL 289edc5d86b08bdc2987382907126bd6d0401d95e2ea207260bdcc7deee7a947d5ea6049efb1028af3619ab4c469392f58f52a183d85e3387fc68b9bbbe045c7
DIST node-v0.12.7.tar.gz 20063992 SHA256 b23d64df051c9c969b0c583f802d5d71de342e53067127a5061415be7e12f39d SHA512 0c9cb7542530463e7703435c8d819949785c1c6497c6d98f9854ca615fe33a62f451833e856f0159b836a698b4dee5d165fa505bad5d474f664e1533090d8606 WHIRLPOOL 647391b8c49fda868c14bd4eb3089cac139f50e710ac6b141ea82e1013c4ff7d40cdb0e88d69604d06e3bd07775876c754211a2b099685cb7353ae5708812525
EBUILD nodejs-0.12.7-r1.ebuild 3632 SHA256 abe8c830edcfdbaf9d74172b235bce17e3287faf50f040e53ee5f719ccb2a5b8 SHA512 1d7063b462e298602af37eca9aa7d6128b6206df2ead4303058bf41a69d3a6e25f52aa4768d398440dfff1d77a7489483299677ef589ba30156a10e63b3bab68 WHIRLPOOL bec1fd28d6637f53a6510e813c6659abc6ce1a09bf7abb98f64413ffaee685e57cd5deede51ebec54df62fa7280943d8b6df4d89c8d8dfc1f4a9d2e09c810f26
EBUILD nodejs-0.12.7-r1.ebuild 3697 SHA256 7cefc9b0739dd229eff0e5f443d39801586b437515f405d0a7bbaade4c2fbe58 SHA512 2cb0c7cd23b23686126d9e715b7841ac8da5668d1eaa237fa02e9f00493fad33e05275947ec68f5ede1a2059790a9bf1c3320d7c295473506b2a2d9efb56c36f WHIRLPOOL a8d6dbe07704316461110da47111f27492fe17a5d89bb641901a32ee16b38ec309513b59687af6ec7dbdacf3547c0d11820be0c0a112f9f1a32cf83975cc705a

View file

@ -1,19 +1,96 @@
--- src/node_constants.cc.orig 2015-07-10 06:41:19.000000000 +0800
+++ src/node_constants.cc 2015-07-31 18:28:15.699044453 +0800
@@ -33,7 +33,11 @@
+++ src/node_constants.cc 2015-08-02 16:28:48.000000000 +0800
@@ -33,11 +33,17 @@
#include <sys/stat.h>
#if HAVE_OPENSSL
-# include <openssl/ec.h>
-# include <openssl/ssl.h>
-# ifndef OPENSSL_NO_ENGINE
-# include <openssl/engine.h>
-# endif // !OPENSSL_NO_ENGINE
+
+#include <openssl/ssl.h>
+
+#ifndef OPENSSL_NO_EC
# include <openssl/ec.h>
+#include <openssl/ec.h>
+#endif
+
# include <openssl/ssl.h>
# ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
+#ifndef OPENSSL_NO_ENGINE
+#include <openssl/engine.h>
+#endif // !OPENSSL_NO_ENGINE
+
#endif
namespace node {
@@ -976,7 +982,7 @@
NODE_DEFINE_CONSTANT(target, RSA_PKCS1_PSS_PADDING);
#endif
-#if HAVE_OPENSSL
+#ifndef OPENSSL_NO_EC
// NOTE: These are not defines
NODE_DEFINE_CONSTANT(target, POINT_CONVERSION_COMPRESSED);
--- src/node_crypto.cc.orig 2015-07-10 06:41:19.000000000 +0800
+++ src/node_crypto.cc 2015-08-02 16:30:39.000000000 +0800
@@ -275,7 +275,9 @@
NODE_SET_PROTOTYPE_METHOD(t, "addCRL", SecureContext::AddCRL);
NODE_SET_PROTOTYPE_METHOD(t, "addRootCerts", SecureContext::AddRootCerts);
NODE_SET_PROTOTYPE_METHOD(t, "setCiphers", SecureContext::SetCiphers);
+#ifndef OPENSSL_NO_EC
NODE_SET_PROTOTYPE_METHOD(t, "setECDHCurve", SecureContext::SetECDHCurve);
+#endif
NODE_SET_PROTOTYPE_METHOD(t, "setDHParam", SecureContext::SetDHParam);
NODE_SET_PROTOTYPE_METHOD(t, "setOptions", SecureContext::SetOptions);
NODE_SET_PROTOTYPE_METHOD(t, "setSessionIdContext",
@@ -741,7 +743,7 @@
SSL_CTX_set_cipher_list(sc->ctx_, *ciphers);
}
-
+#ifndef OPENSSL_NO_EC
void SecureContext::SetECDHCurve(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
@@ -768,7 +770,7 @@
EC_KEY_free(ecdh);
}
-
+#endif
void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
@@ -4152,7 +4154,7 @@
return true;
}
-
+#ifndef OPENSSL_NO_EC
void ECDH::Initialize(Environment* env, Handle<Object> target) {
HandleScope scope(env->isolate());
@@ -4369,6 +4371,7 @@
if (!r)
return env->ThrowError("Failed to convert BN to a private key");
}
+#endif // OPENSSL_NO_EC
class PBKDF2Request : public AsyncWrap {
@@ -5142,7 +5145,9 @@
Connection::Initialize(env, target);
CipherBase::Initialize(env, target);
DiffieHellman::Initialize(env, target);
+#ifndef OPENSSL_NO_EC
ECDH::Initialize(env, target);
+#endif
Hmac::Initialize(env, target);
Hash::Initialize(env, target);
Sign::Initialize(env, target);
--- src/node_crypto.h.orig 2015-07-10 06:41:19.000000000 +0800
+++ src/node_crypto.h 2015-07-31 18:28:37.043044258 +0800
+++ src/node_crypto.h 2015-08-02 16:14:31.000000000 +0800
@@ -39,8 +39,15 @@
#include "v8.h"
@ -30,3 +107,29 @@
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif // !OPENSSL_NO_ENGINE
@@ -98,7 +105,9 @@
static void AddCRL(const v8::FunctionCallbackInfo<v8::Value>& args);
static void AddRootCerts(const v8::FunctionCallbackInfo<v8::Value>& args);
static void SetCiphers(const v8::FunctionCallbackInfo<v8::Value>& args);
+#ifndef OPENSSL_NO_EC
static void SetECDHCurve(const v8::FunctionCallbackInfo<v8::Value>& args);
+#endif
static void SetDHParam(const v8::FunctionCallbackInfo<v8::Value>& args);
static void SetOptions(const v8::FunctionCallbackInfo<v8::Value>& args);
static void SetSessionIdContext(
@@ -646,6 +655,7 @@
DH* dh;
};
+#ifndef OPENSSL_NO_EC
class ECDH : public BaseObject {
public:
~ECDH() {
@@ -681,6 +691,7 @@
EC_KEY* key_;
const EC_GROUP* group_;
};
+#endif
class Certificate : public AsyncWrap {
public:

View file

@ -33,7 +33,9 @@ S="${WORKDIR}/node-v${PV}"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
src_prepare() {
#https://github.com/joyent/node/pull/25461
epatch "${FILESDIR}"/"${P}"_ssl.patch
#make ECDH optional
epatch "${FILESDIR}"/"${P}"_bindist.patch
tc-export CC CXX PKG_CONFIG