Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to openssl-1.0.2a (Part1) #1325

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
38 changes: 38 additions & 0 deletions benchmark/crypto/aes-gcm-throughput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
var common = require('../common.js');
var crypto = require('crypto');
var keylen = {'aes-128-gcm': 16, 'aes-192-gcm': 24, 'aes-256-gcm': 32};
var bench = common.createBenchmark(main, {
n: [500],
cipher: ['aes-128-gcm', 'aes-192-gcm', 'aes-256-gcm'],
len: [1024, 4 * 1024, 16 * 1024, 64 * 1024, 256 * 1024, 1024 * 1024]
});

function main(conf) {
var message = (new Buffer(conf.len)).fill('b');
var key = crypto.randomBytes(keylen[conf.cipher]);
var iv = crypto.randomBytes(12);
var associate_data = (new Buffer(16)).fill('z');
bench.start();
AEAD_Bench(conf.cipher, message, associate_data, key, iv, conf.n, conf.len);
}

function AEAD_Bench(cipher, message, associate_data, key, iv, n, len) {
var written = n * len;
var bits = written * 8;
var mbits = bits / (1024 * 1024);

for (var i = 0; i < n; i++) {
var alice = crypto.createCipheriv(cipher, key, iv);
alice.setAAD(associate_data);
var enc = alice.update(message);
alice.final();
var tag = alice.getAuthTag();
var bob = crypto.createDecipheriv(cipher, key, iv);
bob.setAuthTag(tag);
bob.setAAD(associate_data);
var clear = bob.update(enc);
bob.final();
}

bench.end(mbits);
}
2 changes: 1 addition & 1 deletion benchmark/crypto/hash-stream-throughput.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var crypto = require('crypto');

var bench = common.createBenchmark(main, {
writes: [500],
algo: [ 'sha256', 'md5' ],
algo: ['sha1', 'sha256', 'sha512'],
type: ['asc', 'utf', 'buf'],
len: [2, 1024, 102400, 1024 * 1024],
api: ['legacy', 'stream']
Expand Down
45 changes: 45 additions & 0 deletions benchmark/crypto/rsa-encrypt-decrypt-throughput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// throughput benchmark in signing and verifying
var common = require('../common.js');
var crypto = require('crypto');
var fs = require('fs');
var path = require('path');
var fixtures_keydir = path.resolve(__dirname, '../../test/fixtures/keys/');
var keylen_list = ['1024', '2048', '4096'];
var RSA_PublicPem = {};
var RSA_PrivatePem = {};

keylen_list.forEach(function(key) {
RSA_PublicPem[key] = fs.readFileSync(fixtures_keydir +
'/rsa_public_' + key + '.pem');
RSA_PrivatePem[key] = fs.readFileSync(fixtures_keydir +
'/rsa_private_' + key + '.pem');
});

var bench = common.createBenchmark(main, {
n: [500],
keylen: keylen_list,
len: [16, 32, 64]
});

function main(conf) {
var crypto = require('crypto');
var message = (new Buffer(conf.len)).fill('b');

bench.start();
StreamWrite(conf.algo, conf.keylen, message, conf.n, conf.len);
}

function StreamWrite(algo, keylen, message, n, len) {
var written = n * len;
var bits = written * 8;
var kbits = bits / (1024);

var privateKey = RSA_PrivatePem[keylen];
var publicKey = RSA_PublicPem[keylen];
for (var i = 0; i < n; i++) {
var enc = crypto.privateEncrypt(privateKey, message);
var clear = crypto.publicDecrypt(publicKey, enc);
}

bench.end(kbits);
}
53 changes: 53 additions & 0 deletions benchmark/crypto/rsa-sign-verify-throughput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// throughput benchmark in signing and verifying
var common = require('../common.js');
var crypto = require('crypto');
var fs = require('fs');
var path = require('path');
var fixtures_keydir = path.resolve(__dirname, '../../test/fixtures/keys/');
var keylen_list = ['1024', '2048'];
var RSA_PublicPem = {};
var RSA_PrivatePem = {};

keylen_list.forEach(function(key) {
RSA_PublicPem[key] = fs.readFileSync(fixtures_keydir +
'/rsa_public_' + key + '.pem');
RSA_PrivatePem[key] = fs.readFileSync(fixtures_keydir +
'/rsa_private_' + key + '.pem');
});

var bench = common.createBenchmark(main, {
writes: [500],
algo: ['RSA-SHA1', 'RSA-SHA224', 'RSA-SHA256', 'RSA-SHA384', 'RSA-SHA512'],
keylen: keylen_list,
len: [1024, 102400, 2 * 102400, 3 * 102400, 1024 * 1024]
});

function main(conf) {
var crypto = require('crypto');
var message = (new Buffer(conf.len)).fill('b');

bench.start();
StreamWrite(conf.algo, conf.keylen, message, conf.writes, conf.len);
}

function StreamWrite(algo, keylen, message, writes, len) {
var written = writes * len;
var bits = written * 8;
var kbits = bits / (1024);

var privateKey = RSA_PrivatePem[keylen];
var publicKey = RSA_PublicPem[keylen];
var s = crypto.createSign(algo);
var v = crypto.createVerify(algo);

while (writes-- > 0) {
s.update(message);
v.update(message);
}

var sign = s.sign(privateKey, 'binary');
s.end();
v.end();

bench.end(kbits);
}
44 changes: 44 additions & 0 deletions deps/openssl/masm_compile.gypi
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
'conditions': [
['target_arch=="ia32"', {
'rules': [
{
'rule_name': 'Assemble',
'extension': 'asm',
'inputs': [],
'outputs': [
'<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
],
'action': [
'ml.exe',
'/Zi',
'/safeseh',
'/Fo', '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
'/c', '<(RULE_INPUT_PATH)',
],
'process_outputs_as_sources': 0,
'message': 'Assembling <(RULE_INPUT_PATH) to <(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj.',
}
],
}, 'target_arch=="x64"', {
'rules': [
{
'rule_name': 'Assemble',
'extension': 'asm',
'inputs': [],
'outputs': [
'<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
],
'action': [
'ml64.exe',
'/Zi',
'/Fo', '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
'/c', '<(RULE_INPUT_PATH)',
],
'process_outputs_as_sources': 0,
'message': 'Assembling <(RULE_INPUT_PATH) to <(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj.',
}
],
}],
],
}
24 changes: 24 additions & 0 deletions deps/openssl/openssl-cli.gypi
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
'target_name': 'openssl-cli',
'type': 'executable',
'dependencies': ['openssl'],
'defines': [
'MONOLITH'
],
'sources': ['<@(openssl_cli_sources)'],
'conditions': [
['OS=="solaris"', {
'libraries': ['<@(openssl_cli_libraries_solaris)']
}, 'OS=="win"', {
'link_settings': {
'libraries': ['<@(openssl_cli_libraries_win)'],
},
}, 'OS in "linux android"', {
'link_settings': {
'libraries': [
'-ldl',
],
},
}],
],
}
Loading