| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e45e5b8 commit 9b30bc4
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2096,27 +2096,38 @@ void SSLWrap<Base>::GetEphemeralKeyInfo( | |||
| 2096 | 2096 | EVP_PKEY* key; | |
| 2097 | 2097 | ||
| 2098 | 2098 | if (SSL_get_server_tmp_key(w->ssl_, &key)) { | |
| 2099 | - switch (EVP_PKEY_id(key)) { | ||
| 2099 | + int kid = EVP_PKEY_id(key); | ||
| 2100 | + switch (kid) { | ||
| 2100 | 2101 | case EVP_PKEY_DH: | |
| 2101 | 2102 | info->Set(context, env->type_string(), | |
| 2102 | 2103 | FIXED_ONE_BYTE_STRING(env->isolate(), "DH")).FromJust(); | |
| 2103 | 2104 | info->Set(context, env->size_string(), | |
| 2104 | 2105 | Integer::New(env->isolate(), EVP_PKEY_bits(key))).FromJust(); | |
| 2105 | 2106 | break; | |
| 2106 | 2107 | case EVP_PKEY_EC: | |
| 2108 | + // TODO(shigeki) Change this to EVP_PKEY_X25519 and add EVP_PKEY_X448 | ||
| 2109 | + // after upgrading to 1.1.1. | ||
| 2110 | + case NID_X25519: | ||
| 2107 | 2111 | { | |
| 2108 | - EC_KEY* ec = EVP_PKEY_get1_EC_KEY(key); | ||
| 2109 | - int nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec)); | ||
| 2110 | - EC_KEY_free(ec); | ||
| 2112 | + const char* curve_name; | ||
| 2113 | + if (kid == EVP_PKEY_EC) { | ||
| 2114 | + EC_KEY* ec = EVP_PKEY_get1_EC_KEY(key); | ||
| 2115 | + int nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec)); | ||
| 2116 | + curve_name = OBJ_nid2sn(nid); | ||
| 2117 | + EC_KEY_free(ec); | ||
| 2118 | + } else { | ||
| 2119 | + curve_name = OBJ_nid2sn(kid); | ||
| 2120 | + } | ||
| 2111 | 2121 | info->Set(context, env->type_string(), | |
| 2112 | 2122 | FIXED_ONE_BYTE_STRING(env->isolate(), "ECDH")).FromJust(); | |
| 2113 | 2123 | info->Set(context, env->name_string(), | |
| 2114 | 2124 | OneByteString(args.GetIsolate(), | |
| 2115 | - OBJ_nid2sn(nid))).FromJust(); | ||
| 2125 | + curve_name)).FromJust(); | ||
| 2116 | 2126 | info->Set(context, env->size_string(), | |
| 2117 | 2127 | Integer::New(env->isolate(), | |
| 2118 | 2128 | EVP_PKEY_bits(key))).FromJust(); | |
| 2119 | 2129 | } | |
| 2130 | + break; | ||
| 2120 | 2131 | } | |
| 2121 | 2132 | EVP_PKEY_free(key); | |
| 2122 | 2133 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -44,6 +44,8 @@ | |||
| 44 | 44 | #endif // !OPENSSL_NO_ENGINE | |
| 45 | 45 | #include <openssl/err.h> | |
| 46 | 46 | #include <openssl/evp.h> | |
| 47 | + // TODO(shigeki) Remove this after upgrading to 1.1.1 | ||
| 48 | + #include <openssl/obj_mac.h> | ||
| 47 | 49 | #include <openssl/pem.h> | |
| 48 | 50 | #include <openssl/x509.h> | |
| 49 | 51 | #include <openssl/x509v3.h> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -82,13 +82,18 @@ function testECDHE256() { | |||
| 82 | 82 | } | |
| 83 | 83 | ||
| 84 | 84 | function testECDHE512() { | |
| 85 | - test(521, 'ECDH', 'secp521r1', null); | ||
| 85 | + test(521, 'ECDH', 'secp521r1', testX25519); | ||
| 86 | + ntests++; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + function testX25519() { | ||
| 90 | + test(253, 'ECDH', 'X25519', null); | ||
| 86 | 91 | ntests++; | |
| 87 | 92 | } | |
| 88 | 93 | ||
| 89 | 94 | testNOT_PFS(); | |
| 90 | 95 | ||
| 91 | 96 | process.on('exit', function() { | |
| 92 | 97 | assert.strictEqual(ntests, nsuccess); | |
| 93 | - assert.strictEqual(ntests, 5); | ||
| 98 | + assert.strictEqual(ntests, 6); | ||
| 94 | 99 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments