From 7cfcf9956ef87973aed98f65656dc24f9b559d74 Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Tue, 19 Jul 2016 10:19:19 -0700 Subject: [PATCH 01/34] Cap node 6 at 6.2 temporarily --- .travis.yml | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8324af2fa..e4b861349 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ matrix: env: export NODE_VERSION="5.8" TARGET_ARCH="ia32" sudo: required - os: linux - env: export NODE_VERSION="6" TARGET_ARCH="ia32" + env: export NODE_VERSION="6.2" TARGET_ARCH="ia32" sudo: required git: diff --git a/appveyor.yml b/appveyor.yml index 3934f045e..8fc6cd256 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -30,7 +30,7 @@ environment: - nodejs_version: "0.12" - nodejs_version: "4.1" - nodejs_version: "5.8" - - nodejs_version: "6" + - nodejs_version: "6.2" matrix: fast_finish: true From 6951946fa6dd17309c82310bf855a48525809d5c Mon Sep 17 00:00:00 2001 From: Tyler Wanek Date: Tue, 19 Jul 2016 09:23:23 -0700 Subject: [PATCH 02/34] expose merge options in rebase optons --- generate/input/libgit2-supplement.json | 7 ++- lib/rebase.js | 61 ++++++++++++++------------ 2 files changed, 40 insertions(+), 28 deletions(-) diff --git a/generate/input/libgit2-supplement.json b/generate/input/libgit2-supplement.json index d8d34e5fa..0e46a5686 100644 --- a/generate/input/libgit2-supplement.json +++ b/generate/input/libgit2-supplement.json @@ -547,12 +547,17 @@ { "type": "git_checkout_options", "name": "checkout_options" + }, + { + "type": "git_merge_options", + "name": "merge_options" } ], "used": { "needs": [ "git_rebase_init_options", - "git_checkout_init_options" + "git_checkout_init_options", + "git_merge_init_options" ] } } diff --git a/lib/rebase.js b/lib/rebase.js index 8160428f7..419c596e7 100644 --- a/lib/rebase.js +++ b/lib/rebase.js @@ -18,28 +18,51 @@ var shallowClone = require("./utils/shallow_clone"); * @param {Function} callback * @return {Remote} */ - var init = Rebase.init; -Rebase.init = function(repository, branch, upstream, onto, options) { + +function defaultRebaseOptions(options, checkoutStrategy) { var checkoutOptions; + var mergeOptions; if (options) { options = shallowClone(options); checkoutOptions = options.checkoutOptions; + mergeOptions = options.mergeOptions; delete options.checkoutOptions; + delete options.mergeOptions; options = normalizeOptions(options, NodeGit.RebaseOptions); } else { options = normalizeOptions({}, NodeGit.RebaseOptions); - checkoutOptions = { - checkoutStrategy: NodeGit.Checkout.STRATEGY.FORCE - }; + if (checkoutStrategy) { + checkoutOptions = { + checkoutStrategy: checkoutStrategy + }; + } } if (checkoutOptions) { - options.checkoutOptions = - normalizeOptions(checkoutOptions, NodeGit.CheckoutOptions); + options.checkoutOptions = normalizeOptions( + checkoutOptions, + NodeGit.CheckoutOptions + ); } + if (mergeOptions) { + options.mergeOptions = normalizeOptions( + mergeOptions, + NodeGit.MergeOptions + ); + } + + return options; +} + + var init = Rebase.init; +Rebase.init = function(repository, branch, upstream, onto, options) { + options = defaultRebaseOptions( + options, + NodeGit.Checkout.STRATEGY.FORCE + ); return init(repository, branch, upstream, onto, options); }; @@ -54,25 +77,9 @@ Rebase.init = function(repository, branch, upstream, onto, options) { */ var rebaseOpen = Rebase.open; Rebase.open = function(repository, options) { - var checkoutOptions; - - if (options) { - options = shallowClone(options); - checkoutOptions = options.checkoutOptions; - delete options.checkoutOptions; - - options = normalizeOptions(options, NodeGit.RebaseOptions); - } else { - options = normalizeOptions({}, NodeGit.RebaseOptions); - checkoutOptions = { - checkoutStrategy: NodeGit.Checkout.STRATEGY.SAFE - }; - } - - if (checkoutOptions) { - options.checkoutOptions = - normalizeOptions(checkoutOptions, NodeGit.CheckoutOptions); - } - + options = defaultRebaseOptions( + options, + NodeGit.Checkout.STRATEGY.SAFE + ); return rebaseOpen(repository, options); }; From e53e7f67fae8ee8d0677f314919bc2a0553dd84f Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 20 Jul 2016 10:05:07 -0400 Subject: [PATCH 03/34] fix "is a directory" test to actually test that, retaining old test under a better name --- test/tests/tree_entry.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/tests/tree_entry.js b/test/tests/tree_entry.js index b4d3abb18..9c990dae6 100644 --- a/test/tests/tree_entry.js +++ b/test/tests/tree_entry.js @@ -122,10 +122,17 @@ describe("TreeEntry", function() { }); }); - it("can determine if an entry is a directory", function() { + it("can determine if an entry is not a file", function() { return this.commit.getEntry("example") .then(function(entry) { assert.equal(entry.isFile(), false); }); }); + + it("can determine if an entry is a directory", function() { + return this.commit.getEntry("example") + .then(function(entry) { + assert.equal(entry.isDirectory(), true); + }); + }); }); From 8e7d0354173930285b254ebfe7592812d78a5404 Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 20 Jul 2016 10:05:13 -0400 Subject: [PATCH 04/34] add isSubmodule() method --- lib/tree_entry.js | 8 ++++++++ test/tests/tree_entry.js | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/lib/tree_entry.js b/lib/tree_entry.js index 3b084c32e..cdb372314 100644 --- a/lib/tree_entry.js +++ b/lib/tree_entry.js @@ -31,6 +31,14 @@ TreeEntry.prototype.isDirectory = TreeEntry.prototype.isTree; */ TreeEntry.prototype.isBlob = TreeEntry.prototype.isFile; +/** + * Is this TreeEntry a submodule? + * @return {Boolean} + */ +TreeEntry.prototype.isSubmodule = function() { + return this.filemode() === TreeEntry.FILEMODE.COMMIT; +}; + /** * Retrieve the SHA for this TreeEntry. * @return {String} diff --git a/test/tests/tree_entry.js b/test/tests/tree_entry.js index 9c990dae6..178bf1168 100644 --- a/test/tests/tree_entry.js +++ b/test/tests/tree_entry.js @@ -135,4 +135,22 @@ describe("TreeEntry", function() { assert.equal(entry.isDirectory(), true); }); }); + + it("can determine if an entry is a submodule", function() { + var repo = this.repository; + return repo.getCommit("878ef6efbc5f85c4f63aeedf41addc262a621308") + .then(function(commit) { + return commit.getEntry("vendor/libgit2") + .then(function(entry) { + assert.equal(entry.isSubmodule(), true); + }); + }); + }); + + it("can determine if an entry is not a submodule", function() { + return this.commit.getEntry("example") + .then(function(entry) { + assert.equal(entry.isSubmodule(), false); + }); + }); }); From 78db7968e9cd1dd9bb7576ec13569023ad02e7f8 Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 20 Jul 2016 10:05:25 -0400 Subject: [PATCH 05/34] Fix two typos in the documentation for Commit#parents: 1. It doesn't take a callback 2. Possessive form needs a single quote instead of a double quote. --- lib/commit.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/commit.js b/lib/commit.js index 28145ecae..a016f7dfa 100644 --- a/lib/commit.js +++ b/lib/commit.js @@ -148,9 +148,8 @@ Commit.prototype.getParents = function(limit, callback) { }; /** - * Retrieve the commit"s parent shas. + * Retrieve the commit's parent shas. * - * @param {Function} callback * @return {Array} array of oids */ Commit.prototype.parents = function() { From 63f835e42bb286548cd77f45a4be091feefb54d6 Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 20 Jul 2016 10:05:45 -0400 Subject: [PATCH 06/34] fix Tree#entryByName function and add test --- generate/input/descriptor.json | 4 +--- lib/tree.js | 2 +- test/tests/tree.js | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/generate/input/descriptor.json b/generate/input/descriptor.json index 677029ff3..592af71a1 100644 --- a/generate/input/descriptor.json +++ b/generate/input/descriptor.json @@ -2499,9 +2499,7 @@ "jsFunctionName": "_entryByIndex" }, "git_tree_entry_byname": { - "return": { - "ownedByThis": true - } + "jsFunctionName": "_entryByName" }, "git_tree_entrycount": { "jsFunctionName": "entryCount" diff --git a/lib/tree.js b/lib/tree.js index 3f6ebb7ad..ba3d247a5 100644 --- a/lib/tree.js +++ b/lib/tree.js @@ -65,7 +65,7 @@ Tree.prototype.entryByIndex = function(i) { * @return {TreeEntry} */ Tree.prototype.entryByName = function(name) { - var entry = this.entryByName(name); + var entry = this._entryByName(name); entry.parent = this; return entry; }; diff --git a/test/tests/tree.js b/test/tests/tree.js index 630ba9cca..aa98d4f3d 100644 --- a/test/tests/tree.js +++ b/test/tests/tree.js @@ -5,15 +5,25 @@ var promisify = require("promisify-node"); var fse = promisify(require("fs-extra")); describe("Tree", function() { + var NodeGit = require("../../"); var RepoUtils = require("../utils/repository_setup"); var repoPath = local("../repos/tree"); + var existingPath = local("../repos/workdir"); + var oid = "5716e9757886eaf38d51c86b192258c960d9cfea"; beforeEach(function() { var test = this; return RepoUtils.createRepository(repoPath) .then(function(repo) { test.repository = repo; + }).then(function() { + return NodeGit.Repository.open(existingPath); + }).then(function(repository) { + test.existingRepo = repository; + return repository.getCommit(oid); + }).then(function(commit) { + test.commit = commit; }); }); @@ -21,6 +31,14 @@ describe("Tree", function() { return fse.remove(repoPath); }); + it("gets an entry by name", + function(done) { + this.commit.getTree().then(function(tree) { + var entry = tree.entryByName("README.md"); + assert(entry); + }).done(done); + }); + it("walks its entries and returns the same entries on both progress and end", function() { var repo = this.repository; From 542270c66f8727e04547a8de8b4682fe9671a740 Mon Sep 17 00:00:00 2001 From: Tyler Wanek Date: Wed, 20 Jul 2016 08:26:40 -0700 Subject: [PATCH 07/34] expose diff flags option for repo methods --- lib/repository.js | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/lib/repository.js b/lib/repository.js index e3d66a94e..417eb72ce 100644 --- a/lib/repository.js +++ b/lib/repository.js @@ -1240,14 +1240,19 @@ Repository.prototype.mergeheadForeach = function(callback) { * @param {Boolean} stageNew Set to stage new filemode. Unset to unstage. * @return {Number} 0 or an error code */ -Repository.prototype.stageFilemode = function(filePath, stageNew) { +Repository.prototype.stageFilemode = + function(filePath, stageNew, additionalDiffOptions) { var repo = this; var index; + var diffOptions = additionalDiffOptions ? { + flags: additionalDiffOptions + } : undefined; var diffPromise = stageNew ? NodeGit.Diff.indexToWorkdir(repo, index, { flags: NodeGit.Diff.OPTION.SHOW_UNTRACKED_CONTENT | - NodeGit.Diff.OPTION.RECURSE_UNTRACKED_DIRS + NodeGit.Diff.OPTION.RECURSE_UNTRACKED_DIRS | + (additionalDiffOptions || 0) }) : repo.getHeadCommit() @@ -1255,7 +1260,7 @@ Repository.prototype.stageFilemode = function(filePath, stageNew) { return commit.getTree(); }) .then(function getDiffFromTree(tree) { - return NodeGit.Diff.treeToIndex(repo, tree, index); + return NodeGit.Diff.treeToIndex(repo, tree, index, diffOptions); }); var filePaths = (filePath instanceof Array) ? filePath : [filePath]; @@ -1311,7 +1316,11 @@ Repository.prototype.stageFilemode = function(filePath, stageNew) { }); }; -function getPathHunks(repo, index, filePath, isStaged) { +function getPathHunks(repo, index, filePath, isStaged, additionalDiffOptions) { + var diffOptions = additionalDiffOptions ? { + flags: additionalDiffOptions + } : undefined; + return Promise.resolve() .then(function() { if (isStaged) { @@ -1320,14 +1329,15 @@ function getPathHunks(repo, index, filePath, isStaged) { return commit.getTree(); }) .then(function getDiffFromTree(tree) { - return NodeGit.Diff.treeToIndex(repo, tree, index); + return NodeGit.Diff.treeToIndex(repo, tree, index, diffOptions); }); } return NodeGit.Diff.indexToWorkdir(repo, index, { flags: NodeGit.Diff.OPTION.SHOW_UNTRACKED_CONTENT | - NodeGit.Diff.OPTION.RECURSE_UNTRACKED_DIRS + NodeGit.Diff.OPTION.RECURSE_UNTRACKED_DIRS | + (additionalDiffOptions || 0) }); }) .then(function(diff) { @@ -1465,7 +1475,7 @@ function applySelectedLinesToTarget * @return {Number} 0 or an error code */ Repository.prototype.stageLines = - function(filePath, selectedLines, isSelectionStaged) { + function(filePath, selectedLines, isSelectionStaged, additionalDiffOptions) { var repo = this; var index; @@ -1479,7 +1489,8 @@ Repository.prototype.stageLines = return NodeGit.Diff.indexToWorkdir(repo, index, { flags: NodeGit.Diff.OPTION.SHOW_UNTRACKED_CONTENT | - NodeGit.Diff.OPTION.RECURSE_UNTRACKED_DIRS + NodeGit.Diff.OPTION.RECURSE_UNTRACKED_DIRS | + (additionalDiffOptions || 0) }) .then(function(diff) { return diff.patches(); @@ -1516,7 +1527,13 @@ Repository.prototype.stageLines = .then(function(blob) { originalBlob = blob; - return getPathHunks(repo, index, filePath, isSelectionStaged); + return getPathHunks( + repo, + index, + filePath, + isSelectionStaged, + additionalDiffOptions + ); }) .then(function(hunks) { return applySelectedLinesToTarget( @@ -1559,7 +1576,8 @@ Repository.prototype.stageLines = * selected for discarding * @return {Number} 0 or an error code */ -Repository.prototype.discardLines = function(filePath, selectedLines) { +Repository.prototype.discardLines = + function(filePath, selectedLines, additionalDiffOptions) { var repo = this; var fullFilePath = path.join(repo.workdir(), filePath); var index; @@ -1574,7 +1592,7 @@ Repository.prototype.discardLines = function(filePath, selectedLines) { .then(function(content) { originalContent = content; - return getPathHunks(repo, index, filePath, false); + return getPathHunks(repo, index, filePath, false, additionalDiffOptions); }) .then(function(hunks) { return applySelectedLinesToTarget( From c76307942383007f0777bd3d80abae990f12b0ad Mon Sep 17 00:00:00 2001 From: Tyler Wanek Date: Wed, 20 Jul 2016 09:20:45 -0700 Subject: [PATCH 08/34] expose rebase options for rebaseBranches --- lib/repository.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/repository.js b/lib/repository.js index 417eb72ce..5f78740ba 100644 --- a/lib/repository.js +++ b/lib/repository.js @@ -979,14 +979,15 @@ Repository.prototype.rebaseBranches = function( upstream, onto, signature, - beforeNextFn + beforeNextFn, + rebaseOptions ) { var repo = this; var branchCommit; var upstreamCommit; var ontoCommit; - + var mergeOptions = (rebaseOptions || {}).mergeOptions; signature = signature || repo.defaultSignature(); return Promise.all([ @@ -1011,7 +1012,7 @@ Repository.prototype.rebaseBranches = function( .then(function(oid) { if (oid.toString() === branchCommit.id().toString()) { // we just need to fast-forward - return repo.mergeBranches(branch, upstream) + return repo.mergeBranches(branch, upstream, null, null, mergeOptions) .then(function() { // checkout 'branch' to match the behavior of rebase return repo.checkoutBranch(branch); @@ -1022,7 +1023,13 @@ Repository.prototype.rebaseBranches = function( return repo.checkoutBranch(branch); } - return NodeGit.Rebase.init(repo, branchCommit, upstreamCommit, ontoCommit) + return NodeGit.Rebase.init( + repo, + branchCommit, + upstreamCommit, + ontoCommit, + rebaseOptions + ) .then(function(rebase) { return performRebase(repo, rebase, signature, beforeNextFn); }) From cdc5767e5a1a94a2726e85513d2a2e2bdfb4a5c2 Mon Sep 17 00:00:00 2001 From: Kyle Smith Date: Tue, 26 Jul 2016 10:48:25 -0700 Subject: [PATCH 09/34] Memory management: duplicate time it's unsafe to use the signature's time directly since the signature could be freed. Instead duplicate the signature's time when it is requested and set it as self freeing. --- generate/input/descriptor.json | 3 +++ generate/templates/manual/include/functions/copy.h | 1 + generate/templates/manual/src/functions/copy.cc | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/generate/input/descriptor.json b/generate/input/descriptor.json index 677029ff3..9770f82c7 100644 --- a/generate/input/descriptor.json +++ b/generate/input/descriptor.json @@ -2453,6 +2453,9 @@ } } }, + "time": { + "dupFunction": "git_time_dup" + }, "trace": { "functions": { "git_trace_set": { diff --git a/generate/templates/manual/include/functions/copy.h b/generate/templates/manual/include/functions/copy.h index 69c733464..f7f942475 100644 --- a/generate/templates/manual/include/functions/copy.h +++ b/generate/templates/manual/include/functions/copy.h @@ -15,6 +15,7 @@ const git_time *git_time_dup(const git_time *arg); const git_diff_delta *git_diff_delta_dup(const git_diff_delta *arg); const git_diff_file *git_diff_file_dup(const git_diff_file *arg); +void git_time_dup(git_time **out, const git_time *arg); void git_transfer_progress_dup(git_transfer_progress **out, const git_transfer_progress *arg); #endif diff --git a/generate/templates/manual/src/functions/copy.cc b/generate/templates/manual/src/functions/copy.cc index d885f0ea4..f09f2cbaa 100644 --- a/generate/templates/manual/src/functions/copy.cc +++ b/generate/templates/manual/src/functions/copy.cc @@ -11,6 +11,11 @@ const git_error *git_error_dup(const git_error *arg) { return result; } +void git_time_dup(git_time **out, const git_time *arg) { + *out = (git_time *)malloc(sizeof(git_time)); + memcpy(*out, arg, sizeof(git_time)); +} + void git_transfer_progress_dup(git_transfer_progress **out, const git_transfer_progress *arg) { *out = (git_transfer_progress *)malloc(sizeof(git_transfer_progress)); memcpy(*out, arg, sizeof(git_transfer_progress)); From ce354331b751fb0c3629b1fe6f4f87c045e19110 Mon Sep 17 00:00:00 2001 From: Kyle Smith Date: Tue, 26 Jul 2016 15:51:12 -0700 Subject: [PATCH 10/34] Memory management: added test for duplicating time --- test/tests/signature.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/tests/signature.js b/test/tests/signature.js index 8841ffa29..9049a2720 100644 --- a/test/tests/signature.js +++ b/test/tests/signature.js @@ -2,6 +2,7 @@ var assert = require("assert"); var path = require("path"); var local = path.join.bind(path, __dirname); +var garbageCollect = require("../utils/garbage_collect.js"); var exec = require("../../utils/execPromise"); describe("Signature", function() { @@ -83,4 +84,26 @@ describe("Signature", function() { }); }); }); + + it("duplicates time", function() { + garbageCollect(); + var Time = NodeGit.Time; + var startSelfFreeingCount = Time.getSelfFreeingInstanceCount(); + var startNonSelfFreeingCount = + Time.getNonSelfFreeingConstructedCount(); + var time = Signature.now(name, email).when(); + + garbageCollect(); + var endSelfFreeingCount = Time.getSelfFreeingInstanceCount(); + var endNonSelfFreeingCount = Time.getNonSelfFreeingConstructedCount(); + // we should get one duplicated, self-freeing time + assert.equal(startSelfFreeingCount + 1, endSelfFreeingCount); + assert.equal(startNonSelfFreeingCount, endNonSelfFreeingCount); + + time = null; + garbageCollect(); + endSelfFreeingCount = Time.getSelfFreeingInstanceCount(); + // the self-freeing time should get freed + assert.equal(startSelfFreeingCount, endSelfFreeingCount); + }); }); From 86b2a56a092d14c977dec12948f87d26e13fce7a Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Fri, 15 Jul 2016 20:05:34 -0700 Subject: [PATCH 11/34] Sort methods For each type, i cleared out extra space between methods, and sorted them first doing Object.defineProperty, then static functions, then static functions on the type, then prototype functions. Within each category, sorted them alphabetically. --- lib/blob.js | 19 +- lib/clone.js | 2 +- lib/commit.js | 258 +++-- lib/convenient_hunks.js | 20 +- lib/convenient_patch.js | 127 ++- lib/diff.js | 107 +- lib/diff_line.js | 18 +- lib/index.js | 10 +- lib/object.js | 24 +- lib/oid.js | 4 +- lib/reference.js | 38 +- lib/repository.js | 2128 ++++++++++++++++++++------------------- lib/revert.js | 3 +- lib/revwalk.js | 159 ++- lib/stash.js | 26 +- lib/status_file.js | 64 +- lib/tree.js | 65 +- lib/tree_entry.js | 102 +- 18 files changed, 1585 insertions(+), 1589 deletions(-) diff --git a/lib/blob.js b/lib/blob.js index f55ff27da..073623fdd 100644 --- a/lib/blob.js +++ b/lib/blob.js @@ -3,7 +3,6 @@ var Blob = NodeGit.Blob; var LookupWrapper = NodeGit.Utils.lookupWrapper; var TreeEntry = NodeGit.TreeEntry; - /** * Retrieves the blob pointed to by the oid * @async @@ -22,15 +21,6 @@ Blob.prototype.content = function() { return this.rawcontent().toBuffer(this.rawsize()); }; -/** - * Retrieve the Blob's content as String. - * - * @return {String} Contents as a string. - */ -Blob.prototype.toString = function() { - return this.content().toString(); -}; - /** * Retrieve the Blob's type. * @@ -41,3 +31,12 @@ Blob.prototype.filemode = function() { return this.isBinary() ? FileMode.EXECUTABLE : FileMode.BLOB; }; + +/** + * Retrieve the Blob's content as String. + * + * @return {String} Contents as a string. + */ +Blob.prototype.toString = function() { + return this.content().toString(); +}; diff --git a/lib/clone.js b/lib/clone.js index 5b9a7710f..d1eb56b1d 100644 --- a/lib/clone.js +++ b/lib/clone.js @@ -3,7 +3,7 @@ var shallowClone = require("./utils/shallow_clone"); var normalizeOptions = NodeGit.Utils.normalizeOptions; var Clone = NodeGit.Clone; -var clone = Clone.clone; +var _clone = Clone.clone; /** * Patch repository cloning to automatically coerce objects. diff --git a/lib/commit.js b/lib/commit.js index a016f7dfa..a3f9aa2bf 100644 --- a/lib/commit.js +++ b/lib/commit.js @@ -13,19 +13,40 @@ var LookupWrapper = NodeGit.Utils.lookupWrapper; Commit.lookup = LookupWrapper(Commit); /** - * Retrieve the SHA. - * @return {String} + * Amend a commit + * @async + * @param {String} update_ref + * @param {Signature} author + * @param {Signature} committer + * @param {String} message_encoding + * @param {String} message + * @param {Tree|Oid} tree + * @param {Oid} callback */ -Commit.prototype.sha = function() { - return this.id().toString(); -}; +var amend = Commit.prototype.amend; +Commit.prototype.amend = function ( + updateRef, author, committer, message_encoding, message, tree, callback) { + var repo = this.repo; + var _this = this; + var treePromise; -/** - * Retrieve the commit time as a unix timestamp. - * @return {Number} - */ -Commit.prototype.timeMs = function() { - return this.time() * 1000; + if (tree instanceof NodeGit.Oid){ + treePromise = repo.getTree(tree); + } else { + treePromise = Promise.resolve(tree); + } + + return treePromise + .then(function(treeObject){ + return amend.call(_this, + updateRef, + author, + committer, + message_encoding, + message, + treeObject + ); + }); }; /** @@ -37,13 +58,51 @@ Commit.prototype.date = function() { }; /** - * Get the tree associated with this commit. + * Generate an array of diff trees showing changes between this commit + * and its parent(s). * * @async - * @return {Tree} + * @param {Function} callback + * @return {Array} an array of diffs */ -Commit.prototype.getTree = function(callback) { - return this.repo.getTree(this.treeId(), callback); +Commit.prototype.getDiff = function(callback) { + return this.getDiffWithOptions(null, callback); +}; + +/** + * Generate an array of diff trees showing changes between this commit + * and its parent(s). + * + * @async + * @param {Object} options + * @param {Function} callback + * @return {Array} an array of diffs + */ +Commit.prototype.getDiffWithOptions = function(options, callback) { + var commit = this; + + return commit.getTree().then(function(thisTree) { + return commit.getParents().then(function(parents) { + var diffs; + if (parents.length) { + diffs = parents.map(function(parent) { + return parent.getTree().then(function(parentTree) { + return thisTree.diffWithOptions(parentTree, options); + }); + }); + } else { + diffs = [thisTree.diffWithOptions(null, options)]; + } + + return Promise.all(diffs); + }); + }).then(function(diffs) { + if (typeof callback === "function") { + callback(null, diffs); + } + + return diffs; + }, callback); }; /** @@ -66,6 +125,52 @@ Commit.prototype.getEntry = function(path, callback) { }, callback); }; +/** + * Retrieve the commit's parents as commit objects. + * + * @async + * @param {number} limit Optional amount of parents to return. + * @param {Function} callback + * @return {Array} array of commits + */ +Commit.prototype.getParents = function(limit, callback) { + var parents = []; + + // Shift arguments. + if (typeof limit === "function") { + callback = limit; + } + + // If no limit was set, default to the maximum parents. + limit = typeof limit === "number" ? limit : this.parentcount(); + limit = Math.min(limit, this.parentcount()); + + for (var i = 0; i < limit; i++) { + var oid = this.parentId(i); + var parent = this.repo.getCommit(oid); + + parents.push(parent); + } + + // Wait for all parents to complete, before returning. + return Promise.all(parents).then(function(parents) { + if (typeof callback === "function") { + callback(null, parents); + } + + return parents; + }, callback); +}; + +/** + * Get the tree associated with this commit. + * + * @async + * @return {Tree} + */ +Commit.prototype.getTree = function(callback) { + return this.repo.getTree(this.treeId(), callback); +}; /** * Walk the history from this commit backwards. @@ -109,44 +214,6 @@ Commit.prototype.history = function() { return event; }; - -/** - * Retrieve the commit's parents as commit objects. - * - * @async - * @param {number} limit Optional amount of parents to return. - * @param {Function} callback - * @return {Array} array of commits - */ -Commit.prototype.getParents = function(limit, callback) { - var parents = []; - - // Shift arguments. - if (typeof limit === "function") { - callback = limit; - } - - // If no limit was set, default to the maximum parents. - limit = typeof limit === "number" ? limit : this.parentcount(); - limit = Math.min(limit, this.parentcount()); - - for (var i = 0; i < limit; i++) { - var oid = this.parentId(i); - var parent = this.repo.getCommit(oid); - - parents.push(parent); - } - - // Wait for all parents to complete, before returning. - return Promise.all(parents).then(function(parents) { - if (typeof callback === "function") { - callback(null, parents); - } - - return parents; - }, callback); -}; - /** * Retrieve the commit's parent shas. * @@ -163,90 +230,21 @@ Commit.prototype.parents = function() { }; /** - * Generate an array of diff trees showing changes between this commit - * and its parent(s). - * - * @async - * @param {Function} callback - * @return {Array} an array of diffs + * Retrieve the SHA. + * @return {String} */ -Commit.prototype.getDiff = function(callback) { - return this.getDiffWithOptions(null, callback); +Commit.prototype.sha = function() { + return this.id().toString(); }; /** - * Generate an array of diff trees showing changes between this commit - * and its parent(s). - * - * @async - * @param {Object} options - * @param {Function} callback - * @return {Array} an array of diffs + * Retrieve the commit time as a unix timestamp. + * @return {Number} */ -Commit.prototype.getDiffWithOptions = function(options, callback) { - var commit = this; - - return commit.getTree().then(function(thisTree) { - return commit.getParents().then(function(parents) { - var diffs; - if (parents.length) { - diffs = parents.map(function(parent) { - return parent.getTree().then(function(parentTree) { - return thisTree.diffWithOptions(parentTree, options); - }); - }); - } else { - diffs = [thisTree.diffWithOptions(null, options)]; - } - - return Promise.all(diffs); - }); - }).then(function(diffs) { - if (typeof callback === "function") { - callback(null, diffs); - } - - return diffs; - }, callback); +Commit.prototype.timeMs = function() { + return this.time() * 1000; }; -/** - * Amend a commit - * @async - * @param {String} update_ref - * @param {Signature} author - * @param {Signature} committer - * @param {String} message_encoding - * @param {String} message - * @param {Tree|Oid} tree - * @param {Oid} callback - */ -var amend = Commit.prototype.amend; -Commit.prototype.amend = function ( - updateRef, author, committer, message_encoding, message, tree, callback) { - var repo = this.repo; - var _this = this; - var treePromise; - - if (tree instanceof NodeGit.Oid){ - treePromise = repo.getTree(tree); - } else { - treePromise = Promise.resolve(tree); - } - - return treePromise - .then(function(treeObject){ - return amend.call(_this, - updateRef, - author, - committer, - message_encoding, - message, - treeObject - ); - }); - }; - /** * The sha of this commit * @return {String} diff --git a/lib/convenient_hunks.js b/lib/convenient_hunks.js index 774e8e4a3..dbbbbb7d3 100644 --- a/lib/convenient_hunks.js +++ b/lib/convenient_hunks.js @@ -10,12 +10,12 @@ var header = ConvenientHunk.prototype.header; */ ConvenientHunk.prototype.header = header; -var size = ConvenientHunk.prototype.size; +var headerLen = ConvenientHunk.prototype.headerLen; /** - * Number of lines in this hunk + * The length of the header * @return {Number} */ -ConvenientHunk.prototype.size = size; +ConvenientHunk.prototype.headerLen = headerLen; var lines = ConvenientHunk.prototype.lines; /** @@ -25,13 +25,6 @@ var lines = ConvenientHunk.prototype.lines; */ ConvenientHunk.prototype.lines = lines; -var headerLen = ConvenientHunk.prototype.headerLen; -/** - * The length of the header - * @return {Number} - */ -ConvenientHunk.prototype.headerLen = headerLen; - var newLines = ConvenientHunk.prototype.newLines; /** * The number of new lines in the hunk @@ -60,4 +53,11 @@ var oldStart = ConvenientHunk.prototype.oldStart; */ ConvenientHunk.prototype.oldStart = oldStart; +var size = ConvenientHunk.prototype.size; +/** + * Number of lines in this hunk + * @return {Number} + */ +ConvenientHunk.prototype.size = size; + module.exports = ConvenientHunk; diff --git a/lib/convenient_patch.js b/lib/convenient_patch.js index 518533554..d74ddda0a 100644 --- a/lib/convenient_patch.js +++ b/lib/convenient_patch.js @@ -2,27 +2,6 @@ var NodeGit = require("../"); var ConvenientPatch = NodeGit.ConvenientPatch; -var oldFile = ConvenientPatch.prototype.oldFile; -/** - * Old attributes of the file - * @return {DiffFile} - */ -ConvenientPatch.prototype.oldFile = oldFile; - -var newFile = ConvenientPatch.prototype.newFile; -/** - * New attributes of the file - * @return {DiffFile} - */ -ConvenientPatch.prototype.newFile = newFile; - -var size = ConvenientPatch.prototype.size; -/** - * The number of hunks in this patch - * @return {Number} - */ -ConvenientPatch.prototype.size = size; - var hunks = ConvenientPatch.prototype.hunks; /** * The hunks in this patch @@ -32,41 +11,26 @@ var hunks = ConvenientPatch.prototype.hunks; */ ConvenientPatch.prototype.hunks = hunks; -var status = ConvenientPatch.prototype.status; -/** - * The status of this patch (unmodified, added, deleted) - * @return {Number} - */ -ConvenientPatch.prototype.status = status; - -/** - * @typedef lineStats - * @type {Object} - * @property {number} total_context # of contexts in the patch - * @property {number} total_additions # of lines added in the patch - * @property {number} total_deletions # of lines deleted in the patch - */ - -var lineStats = ConvenientPatch.prototype.lineStats; +var isAdded = ConvenientPatch.prototype.isAdded; /** - * The line statistics of this patch (#contexts, #added, #deleted) - * @return {lineStats} + * Is this an added patch? + * @return {Boolean} */ -ConvenientPatch.prototype.lineStats = lineStats; +ConvenientPatch.prototype.isAdded = isAdded; -var isUnmodified = ConvenientPatch.prototype.isUnmodified; +var isConflicted = ConvenientPatch.prototype.isConflicted; /** - * Is this an unmodified patch? + * Is this a conflicted patch? * @return {Boolean} */ -ConvenientPatch.prototype.isUnmodified = isUnmodified; +ConvenientPatch.prototype.isConflicted = isConflicted; -var isAdded = ConvenientPatch.prototype.isAdded; +var isCopied = ConvenientPatch.prototype.isCopied; /** - * Is this an added patch? + * Is this a copied patch? * @return {Boolean} */ -ConvenientPatch.prototype.isAdded = isAdded; +ConvenientPatch.prototype.isCopied = isCopied; var isDeleted = ConvenientPatch.prototype.isDeleted; /** @@ -75,6 +39,13 @@ var isDeleted = ConvenientPatch.prototype.isDeleted; */ ConvenientPatch.prototype.isDeleted = isDeleted; +var isIgnored = ConvenientPatch.prototype.isIgnored; +/** + * Is this an ignored patch? + * @return {Boolean} + */ +ConvenientPatch.prototype.isIgnored = isIgnored; + var isModified = ConvenientPatch.prototype.isModified; /** * Is this an modified patch? @@ -89,19 +60,26 @@ var isRenamed = ConvenientPatch.prototype.isRenamed; */ ConvenientPatch.prototype.isRenamed = isRenamed; -var isCopied = ConvenientPatch.prototype.isCopied; +var isTypeChange = ConvenientPatch.prototype.isTypeChange; /** - * Is this a copied patch? + * Is this a type change? * @return {Boolean} */ -ConvenientPatch.prototype.isCopied = isCopied; +ConvenientPatch.prototype.isTypeChange = isTypeChange; -var isIgnored = ConvenientPatch.prototype.isIgnored; +var isUnmodified = ConvenientPatch.prototype.isUnmodified; /** - * Is this an ignored patch? + * Is this an unmodified patch? * @return {Boolean} */ -ConvenientPatch.prototype.isIgnored = isIgnored; +ConvenientPatch.prototype.isUnmodified = isUnmodified; + +var isUnreadable = ConvenientPatch.prototype.isUnreadable; +/** + * Is this an undreadable patch? + * @return {Boolean} + */ +ConvenientPatch.prototype.isUnreadable = isUnreadable; var isUntracked = ConvenientPatch.prototype.isUntracked; /** @@ -110,25 +88,46 @@ var isUntracked = ConvenientPatch.prototype.isUntracked; */ ConvenientPatch.prototype.isUntracked = isUntracked; -var isTypeChange = ConvenientPatch.prototype.isTypeChange; /** - * Is this a type change? - * @return {Boolean} + * @typedef lineStats + * @type {Object} + * @property {number} total_context # of contexts in the patch + * @property {number} total_additions # of lines added in the patch + * @property {number} total_deletions # of lines deleted in the patch */ -ConvenientPatch.prototype.isTypeChange = isTypeChange; +var lineStats = ConvenientPatch.prototype.lineStats; +/** + * The line statistics of this patch (#contexts, #added, #deleted) + * @return {lineStats} + */ +ConvenientPatch.prototype.lineStats = lineStats; -var isUnreadable = ConvenientPatch.prototype.isUnreadable; +var newFile = ConvenientPatch.prototype.newFile; /** - * Is this an undreadable patch? - * @return {Boolean} + * New attributes of the file + * @return {DiffFile} */ -ConvenientPatch.prototype.isUnreadable = isUnreadable; +ConvenientPatch.prototype.newFile = newFile; -var isConflicted = ConvenientPatch.prototype.isConflicted; +var oldFile = ConvenientPatch.prototype.oldFile; /** - * Is this a conflicted patch? - * @return {Boolean} + * Old attributes of the file + * @return {DiffFile} */ -ConvenientPatch.prototype.isConflicted = isConflicted; +ConvenientPatch.prototype.oldFile = oldFile; + +var size = ConvenientPatch.prototype.size; +/** + * The number of hunks in this patch + * @return {Number} + */ +ConvenientPatch.prototype.size = size; + +var status = ConvenientPatch.prototype.status; +/** + * The status of this patch (unmodified, added, deleted) + * @return {Number} + */ +ConvenientPatch.prototype.status = status; module.exports = ConvenientPatch; diff --git a/lib/diff.js b/lib/diff.js index c812c9f9b..d542c6811 100644 --- a/lib/diff.js +++ b/lib/diff.js @@ -3,60 +3,6 @@ var Diff = NodeGit.Diff; var normalizeOptions = NodeGit.Utils.normalizeOptions; var Patch = NodeGit.Patch; - -/** - * Retrieve patches in this difflist - * - * @async - * @return {Array} a promise that resolves to an array of - * ConvenientPatches - */ -Diff.prototype.patches = function() { - return Patch.convenientFromDiff(this); -}; - -// Override Diff.indexToWorkdir to normalize opts -var indexToWorkdir = Diff.indexToWorkdir; -Diff.indexToWorkdir = function(repo, index, opts) { - opts = normalizeOptions(opts, NodeGit.DiffOptions); - return indexToWorkdir(repo, index, opts); -}; - -// Override Diff.treeToIndex to normalize opts -var treeToIndex = Diff.treeToIndex; -Diff.treeToIndex = function(repo, tree, index, opts) { - opts = normalizeOptions(opts, NodeGit.DiffOptions); - return treeToIndex(repo, tree, index, opts); -}; - -// Override Diff.treeToTree to normalize opts -var treeToTree = Diff.treeToTree; -Diff.treeToTree = function(repo, from_tree, to_tree, opts) { - opts = normalizeOptions(opts, NodeGit.DiffOptions); - return treeToTree(repo, from_tree, to_tree, opts); -}; - -// Override Diff.treeToWorkdir to normalize opts -var treeToWorkdir = Diff.treeToWorkdir; -Diff.treeToWorkdir = function(repo, tree, opts) { - opts = normalizeOptions(opts, NodeGit.DiffOptions); - return treeToWorkdir(repo, tree, opts); -}; - -// Override Diff.treeToWorkdir to normalize opts -var treeToWorkdirWithIndex = Diff.treeToWorkdirWithIndex; -Diff.treeToWorkdirWithIndex = function(repo, tree, opts) { - opts = normalizeOptions(opts, NodeGit.DiffOptions); - return treeToWorkdirWithIndex(repo, tree, opts); -}; - -// Override Diff.findSimilar to normalize opts -var findSimilar = Diff.prototype.findSimilar; -Diff.prototype.findSimilar = function(opts) { - opts = normalizeOptions(opts, NodeGit.DiffFindOptions); - return findSimilar.call(this, opts); -}; - var blobToBuffer = Diff.blobToBuffer; /** * Directly run a diff between a blob and a buffer. @@ -110,3 +56,56 @@ Diff.blobToBuffer= function( line_cb, null); }; + +// Override Diff.indexToWorkdir to normalize opts +var indexToWorkdir = Diff.indexToWorkdir; +Diff.indexToWorkdir = function(repo, index, opts) { + opts = normalizeOptions(opts, NodeGit.DiffOptions); + return indexToWorkdir(repo, index, opts); +}; + +// Override Diff.treeToIndex to normalize opts +var treeToIndex = Diff.treeToIndex; +Diff.treeToIndex = function(repo, tree, index, opts) { + opts = normalizeOptions(opts, NodeGit.DiffOptions); + return treeToIndex(repo, tree, index, opts); +}; + +// Override Diff.treeToTree to normalize opts +var treeToTree = Diff.treeToTree; +Diff.treeToTree = function(repo, from_tree, to_tree, opts) { + opts = normalizeOptions(opts, NodeGit.DiffOptions); + return treeToTree(repo, from_tree, to_tree, opts); +}; + +// Override Diff.treeToWorkdir to normalize opts +var treeToWorkdir = Diff.treeToWorkdir; +Diff.treeToWorkdir = function(repo, tree, opts) { + opts = normalizeOptions(opts, NodeGit.DiffOptions); + return treeToWorkdir(repo, tree, opts); +}; + +// Override Diff.treeToWorkdir to normalize opts +var treeToWorkdirWithIndex = Diff.treeToWorkdirWithIndex; +Diff.treeToWorkdirWithIndex = function(repo, tree, opts) { + opts = normalizeOptions(opts, NodeGit.DiffOptions); + return treeToWorkdirWithIndex(repo, tree, opts); +}; + +// Override Diff.findSimilar to normalize opts +var findSimilar = Diff.prototype.findSimilar; +Diff.prototype.findSimilar = function(opts) { + opts = normalizeOptions(opts, NodeGit.DiffFindOptions); + return findSimilar.call(this, opts); +}; + +/** + * Retrieve patches in this difflist + * + * @async + * @return {Array} a promise that resolves to an array of + * ConvenientPatches + */ +Diff.prototype.patches = function() { + return Patch.convenientFromDiff(this); +}; diff --git a/lib/diff_line.js b/lib/diff_line.js index fdd2e9df6..ccd1f5617 100644 --- a/lib/diff_line.js +++ b/lib/diff_line.js @@ -1,15 +1,6 @@ var NodeGit = require("../"); var DiffLine = NodeGit.DiffLine; -/** -* The non utf8 translated text -* @return {String} -*/ -var rawContent = DiffLine.prototype.content; -DiffLine.prototype.rawContent = function() { - return rawContent.call(this); -}; - /** * The relevant line * @return {String} @@ -28,4 +19,13 @@ DiffLine.prototype.content = function() { return this._cache.content; }; +/** +* The non utf8 translated text +* @return {String} +*/ +var rawContent = DiffLine.prototype.content; +DiffLine.prototype.rawContent = function() { + return rawContent.call(this); +}; + NodeGit.DiffLine = DiffLine; diff --git a/lib/index.js b/lib/index.js index be905be60..17a9253f3 100644 --- a/lib/index.js +++ b/lib/index.js @@ -2,6 +2,11 @@ var NodeGit = require("../"); var Index = NodeGit.Index; +var addAll = Index.prototype.addAll; +Index.prototype.addAll = function(pathspec, flags, matchedCallback) { + return addAll.call(this, pathspec || "*", flags, matchedCallback, null); +}; + /** * Return an array of the entries in this index. * @return {Array} an array of IndexEntrys @@ -17,11 +22,6 @@ Index.prototype.entries = function() { return result; }; -var addAll = Index.prototype.addAll; -Index.prototype.addAll = function(pathspec, flags, matchedCallback) { - return addAll.call(this, pathspec || "*", flags, matchedCallback, null); -}; - var removeAll = Index.prototype.removeAll; Index.prototype.removeAll = function(pathspec, matchedCallback) { return removeAll.call(this, pathspec || "*", matchedCallback, null); diff --git a/lib/object.js b/lib/object.js index 21938883f..85917987a 100644 --- a/lib/object.js +++ b/lib/object.js @@ -3,33 +3,33 @@ var NodeGit = require("../"); var Obj = NodeGit.Object; /** - * Is this object a commit? + * Is this object a blob? * @return {Boolean} */ -Obj.prototype.isCommit = function() { - return this.type() == Obj.TYPE.COMMIT; +Obj.prototype.isBlob = function() { + return this.type() == Obj.TYPE.BLOB; }; /** - * Is this object a tree? + * Is this object a commit? * @return {Boolean} */ -Obj.prototype.isTree = function() { - return this.type() == Obj.TYPE.TREE; +Obj.prototype.isCommit = function() { + return this.type() == Obj.TYPE.COMMIT; }; /** - * Is this object a blob? + * Is this object a tag? * @return {Boolean} */ -Obj.prototype.isBlob = function() { - return this.type() == Obj.TYPE.BLOB; +Obj.prototype.isTag = function() { + return this.type() == Obj.TYPE.TAG; }; /** - * Is this object a tag? + * Is this object a tree? * @return {Boolean} */ -Obj.prototype.isTag = function() { - return this.type() == Obj.TYPE.TAG; +Obj.prototype.isTree = function() { + return this.type() == Obj.TYPE.TREE; }; diff --git a/lib/oid.js b/lib/oid.js index c3a84ecfb..fcbf9b48f 100644 --- a/lib/oid.js +++ b/lib/oid.js @@ -4,11 +4,11 @@ var Oid = NodeGit.Oid; // Backwards compatibility. Object.defineProperties(Oid.prototype, { - "toString": { + "allocfmt": { value: Oid.prototype.tostrS, enumerable: false }, - "allocfmt": { + "toString": { value: Oid.prototype.tostrS, enumerable: false } diff --git a/lib/reference.js b/lib/reference.js index d9b3b8c27..8cfdded6c 100644 --- a/lib/reference.js +++ b/lib/reference.js @@ -5,39 +5,39 @@ var Reference = NodeGit.Reference; var Branch = NodeGit.Branch; /** -* Retrieves the reference pointed to by the oid +* Retrieves the reference by it's short name * @async * @param {Repository} repo The repo that the reference lives in * @param {String|Reference} id The reference to lookup * @param {Function} callback * @return {Reference} */ -Reference.lookup = LookupWrapper(Reference); +Reference.dwim = LookupWrapper(Reference, Reference.dwim); /** -* Retrieves the reference by it's short name +* Retrieves the reference pointed to by the oid * @async * @param {Repository} repo The repo that the reference lives in * @param {String|Reference} id The reference to lookup * @param {Function} callback * @return {Reference} */ -Reference.dwim = LookupWrapper(Reference, Reference.dwim); +Reference.lookup = LookupWrapper(Reference); /** - * Returns true if this reference is valid + * Returns true if this reference is not symbolic * @return {Boolean} */ -Reference.prototype.isValid = function() { - return this.type() != Reference.TYPE.INVALID; +Reference.prototype.isConcrete = function() { + return this.type() == Reference.TYPE.OID; }; /** - * Returns true if this reference is not symbolic - * @return {Boolean} + * Returns if the ref is pointed at by HEAD + * @return {bool} */ -Reference.prototype.isConcrete = function() { - return this.type() == Reference.TYPE.OID; +Reference.prototype.isHead = function() { + return Branch.isHead(this); }; /** @@ -49,17 +49,17 @@ Reference.prototype.isSymbolic = function() { }; /** - * Returns the name of the reference. - * @return {String} + * Returns true if this reference is valid + * @return {Boolean} */ -Reference.prototype.toString = function() { - return this.name(); +Reference.prototype.isValid = function() { + return this.type() != Reference.TYPE.INVALID; }; /** - * Returns if the ref is pointed at by HEAD - * @return {bool} + * Returns the name of the reference. + * @return {String} */ -Reference.prototype.isHead = function() { - return Branch.isHead(this); +Reference.prototype.toString = function() { + return this.name(); }; diff --git a/lib/repository.js b/lib/repository.js index 5f78740ba..7adc83ce1 100644 --- a/lib/repository.js +++ b/lib/repository.js @@ -19,60 +19,203 @@ var Tag = NodeGit.Tag; var Tree = NodeGit.Tree; var TreeBuilder = NodeGit.Treebuilder; -/** - * Grabs a fresh copy of the index from the repository. Invalidates - * all previously grabbed indexes - * - * @async - * @return {Index} - */ -Repository.prototype.refreshIndex = function(callback) { - var repo = this; +function applySelectedLinesToTarget + (originalContent, newLines, pathHunks, isStaged, reverse) { + // 43: ascii code for '+' + // 45: ascii code for '-' + var lineTypes = { + ADDED: !reverse ? 43 : 45, + DELETED: !reverse ? 45 : 43 + }; + var newContent = ""; + var oldIndex = 0; + var linesPromises = []; - repo.setIndex(); // clear the index + // split the original file into lines + var oldLines = originalContent.toString().split("\n"); - return repo.index() - .then(function(index) { - if (typeof callback === "function") { - callback(null, index); + // if no selected lines were sent, return the original content + if (!newLines || newLines.length === 0) { + return originalContent; + } + + function lineEqualsFirstNewLine(hunkLine) { + return ((hunkLine.oldLineno() === newLines[0].oldLineno()) && + (hunkLine.newLineno() === newLines[0].newLineno())); + } + + function processSelectedLine(hunkLine) { + // if this hunk line is a selected line find the selected line + var newLine = newLines.filter(function(nLine) { + return ((hunkLine.oldLineno() === nLine.oldLineno()) && + (hunkLine.newLineno() === nLine.newLineno())); + }); + + if (hunkLine.content().indexOf("\\ No newline at end of file") !== -1) { + return false; + } + + // determine what to add to the new content + if ((isStaged && newLine && newLine.length > 0) || + (!isStaged && (!newLine || newLine.length === 0))) { + if (hunkLine.origin() !== lineTypes.ADDED) { + newContent += hunkLine.content(); + } + if ((isStaged && hunkLine.origin() !== lineTypes.DELETED) || + (!isStaged && hunkLine.origin() !== lineTypes.ADDED)) { + oldIndex++; + } + } + else { + switch (hunkLine.origin()) { + case lineTypes.ADDED: + newContent += hunkLine.content(); + if (isStaged) { + oldIndex++; + } + break; + case lineTypes.DELETED: + if (!isStaged) { + oldIndex++; + } + break; + default: + newContent += oldLines[oldIndex++]; + if (oldIndex < oldLines.length) { + newContent += "\n"; + } + break; } + } + } - return index; - }, callback); -}; + // find the affected hunk + pathHunks.forEach(function(pathHunk) { + linesPromises.push(pathHunk.lines()); + }); + + return Promise.all(linesPromises).then(function(results) { + for (var i = 0; i < results.length && newContent.length < 1; i++) { + var hunkStart = isStaged || reverse ? pathHunks[i].newStart() + : pathHunks[i].oldStart(); + var lines = results[i]; + if (lines.filter(lineEqualsFirstNewLine).length > 0) { + // add content that is before the hunk + while (hunkStart > (oldIndex + 1)) { + newContent += oldLines[oldIndex++] + "\n"; + } + + // modify the lines of the hunk according to the selection + lines.forEach(processSelectedLine); + + // add the rest of the file + while (oldLines.length > oldIndex) { + newContent += oldLines[oldIndex++] + + (oldLines.length > oldIndex ? "\n" : ""); + } + } + } + return newContent; + }); +} + +function getPathHunks(repo, index, filePath, isStaged, additionalDiffOptions) { + var diffOptions = additionalDiffOptions ? { + flags: additionalDiffOptions + } : undefined; + + return Promise.resolve() + .then(function() { + if (isStaged) { + return repo.getHeadCommit() + .then(function getTreeFromCommit(commit) { + return commit.getTree(); + }) + .then(function getDiffFromTree(tree) { + return NodeGit.Diff.treeToIndex(repo, tree, index, diffOptions); + }); + } + + return NodeGit.Diff.indexToWorkdir(repo, index, { + flags: + NodeGit.Diff.OPTION.SHOW_UNTRACKED_CONTENT | + NodeGit.Diff.OPTION.RECURSE_UNTRACKED_DIRS | + (additionalDiffOptions || 0) + }); + }) + .then(function(diff) { + if (!(NodeGit.Status.file(repo, filePath) & + NodeGit.Status.STATUS.WT_MODIFIED) && + !(NodeGit.Status.file(repo, filePath) & + NodeGit.Status.STATUS.INDEX_MODIFIED)) { + return Promise.reject + ("Selected staging is only available on modified files."); + } + + return diff.patches(); + }) + .then(function(patches) { + var pathPatch = patches.filter(function(patch) { + return patch.newFile().path() === filePath; + }); + + if (pathPatch.length !== 1) { + return Promise.reject("No differences found for this file."); + } + + return pathPatch[0].hunks(); + }); +} /** - * Creates a branch with the passed in name pointing to the commit + * Goes through a rebase's rebase operations and commits them if there are + * no merge conflicts * - * @async - * @param {String} name Branch name, e.g. "master" - * @param {Commit|String|Oid} commit The commit the branch will point to - * @param {bool} force Overwrite branch if it exists - * @param {Signature} signature Identity to use to populate reflog - * @param {String} logMessage One line message to be appended to the reflog - * @return {Reference} + * @param {Repository} repository The repository that the rebase is being + * performed in + * @param {Rebase} rebase The current rebase being performed + * @param {Signature} signature Identity of the one performing the rebase + * @param {Function} beforeNextFn Callback to be called before each + * invocation of next(). If the callback + * returns a promise, the next() will be + * called when the promise resolves. + * @return {Int|Index} An error code for an unsuccesful rebase or an index for + * a rebase with conflicts */ -Repository.prototype.createBranch = -function(name, commit, force) { - var repo = this; +function performRebase(repository, rebase, signature, beforeNextFn) { + var beforeNextFnResult; - if (commit instanceof Commit) { - return NodeGit.Branch.create( - repo, - name, - commit, - force ? 1 : 0); + function getPromise() { + return rebase.next() + .then(function() { + return repository.refreshIndex() + .then(function(index) { + if (index.hasConflicts()) { + throw index; + } + + rebase.commit(null, signature); + + return performRebase(repository, rebase, signature, beforeNextFn); + }); + }, function(error) { + if (error && error.errno === NodeGit.Error.CODE.ITEROVER) { + return rebase.finish(signature); + } else { + throw error; + } + }); } - else { - return repo.getCommit(commit).then(function(commit) { - return NodeGit.Branch.create( - repo, - name, - commit, - force ? 1 : 0); - }); + + if(beforeNextFn) { + beforeNextFnResult = beforeNextFn(rebase); + // if beforeNextFn returns a promise, chain the promise + return Promise.resolve(beforeNextFnResult) + .then(getPromise); } -}; + + return getPromise(); +} /** * Creates a branch with the passed in name pointing to the commit @@ -99,93 +242,11 @@ Repository.discover = function(startPath, acrossFs, ceilingDirs, callback) { }, callback); }; -/** - * Look up a refs's commit. - * - * @async - * @param {String|Reference} name Ref name, e.g. "master", "refs/heads/master" - * or Branch Ref - * @return {Commit} - */ -Repository.prototype.getReferenceCommit = function(name, callback) { - var repository = this; - - return this.getReference(name).then(function(reference) { - return repository.getCommit(reference.target()).then(function(commit) { - if (typeof callback === "function") { - callback(null, commit); - } - - return commit; - }); - }, callback); -}; - -/** -* Look up a branch. Alias for `getReference` -* -* @async -* @param {String|Reference} name Ref name, e.g. "master", "refs/heads/master" -* or Branch Ref -* @return {Reference} -*/ -Repository.prototype.getBranch = function(name, callback) { - return this.getReference(name, callback); -}; - -/** -* Look up a branch's most recent commit. Alias to `getReferenceCommit` -* -* @async -* @param {String|Reference} name Ref name, e.g. "master", "refs/heads/master" -* or Branch Ref -* @return {Commit} -*/ -Repository.prototype.getBranchCommit = function(name, callback) { - return this.getReferenceCommit(name, callback); -}; - -/** - * Gets the branch that HEAD currently points to - * Is an alias to head() - * - * @async - * @return {Reference} - */ -Repository.prototype.getCurrentBranch = function() { - return this.head(); -}; - -/** - * Lookup the reference with the given name. - * - * @async - * @param {String|Reference} name Ref name, e.g. "master", "refs/heads/master" - * or Branch Ref - * @return {Reference} - */ -Repository.prototype.getReference = function(name, callback) { - var repository = this; - - return Reference.dwim(this, name).then(function(reference) { - if (reference.isSymbolic()) { - return reference.resolve().then(function(reference) { - reference.repo = repository; - - if (typeof callback === "function") { - callback(null, reference); - } - - return reference; - }, callback); - } else { - reference.repo = repository; - if (typeof callback === "function") { - callback(null, reference); - } - return reference; - } - }, callback); +// Override Repository.initExt to normalize initoptions +var initExt = Repository.initExt; +Repository.initExt = function(repo_path, opts) { + opts = normalizeOptions(opts, NodeGit.RepositoryInitOptions); + return initExt(repo_path, opts); }; Repository.getReferences = function(repo, type, refNamesOnly, callback) { @@ -231,112 +292,249 @@ Repository.getReferences = function(repo, type, refNamesOnly, callback) { /** - * Lookup references for a repository. + * This will set the HEAD to point to the local branch and then attempt + * to update the index and working tree to match the content of the + * latest commit on that branch * * @async - * @param {Reference.TYPE} type Type of reference to look up - * @return {Array} + * @param {String|Reference} branch the branch to checkout + * @param {Object|CheckoutOptions} opts the options to use for the checkout */ -Repository.prototype.getReferences = function(type, callback) { - return Repository.getReferences(this, type, false, callback); +Repository.prototype.checkoutBranch = function(branch, opts) { + var repo = this; + + return repo.getReference(branch) + .then(function(ref) { + if (!ref.isBranch()) { + return false; + } + return repo.checkoutRef(ref, opts); + }); }; /** - * Lookup reference names for a repository. + * This will set the HEAD to point to the reference and then attempt + * to update the index and working tree to match the content of the + * latest commit on that reference * * @async - * @param {Reference.TYPE} type Type of reference to look up - * @return {Array} + * @param {Reference} reference the reference to checkout + * @param {Object|CheckoutOptions} opts the options to use for the checkout */ -Repository.prototype.getReferenceNames = function(type, callback) { - return Repository.getReferences(this, type, true, callback); +Repository.prototype.checkoutRef = function(reference, opts) { + var repo = this; + opts = opts || {}; + + opts.checkoutStrategy = opts.checkoutStrategy || + (NodeGit.Checkout.STRATEGY.SAFE | + NodeGit.Checkout.STRATEGY.RECREATE_MISSING); + return repo.getReferenceCommit(reference.name()) + .then(function(commit) { + return commit.getTree(); + }) + .then(function(tree) { + return Checkout.tree(repo, tree, opts); + }) + .then(function() { + var name = reference.name(); + return repo.setHead(name); + }); }; /** - * Retrieve the commit identified by oid. + * Continues an existing rebase * * @async - * @param {String|Oid} String sha or Oid - * @return {Commit} + * @param {Signature} signature Identity of the one performing the rebase + * @param {Function} beforeNextFn Callback to be called before each step + * of the rebase. If the callback returns a + * promise, the rebase will resume when the + * promise resolves. The rebase object is + * is passed to the callback. + * @return {Oid|Index} A commit id for a succesful merge or an index for a + * rebase with conflicts */ -Repository.prototype.getCommit = function(oid, callback) { - var repository = this; +Repository.prototype.continueRebase = function(signature, beforeNextFn) { + var repo = this; - return Commit.lookup(repository, oid).then(function(commit) { - commit.repo = repository; + signature = signature || repo.defaultSignature(); - if (typeof callback === "function") { - callback(null, commit); - } + return repo.refreshIndex() + .then(function(index) { + if (index.hasConflicts()) { + throw index; + } - return commit; - }, callback); + return NodeGit.Rebase.open(repo); + }) + .then(function(rebase) { + rebase.commit(null, signature); + + return performRebase(repo, rebase, signature, beforeNextFn); + }) + .then(function(error) { + if (error) { + throw error; + } + + return repo.getBranchCommit("HEAD"); + }); }; /** - * Retrieve the blob represented by the oid. + * Creates a branch with the passed in name pointing to the commit * * @async - * @param {String|Oid} String sha or Oid - * @return {Blob} + * @param {String} name Branch name, e.g. "master" + * @param {Commit|String|Oid} commit The commit the branch will point to + * @param {bool} force Overwrite branch if it exists + * @param {Signature} signature Identity to use to populate reflog + * @param {String} logMessage One line message to be appended to the reflog + * @return {Reference} */ -Repository.prototype.getBlob = function(oid, callback) { - var repository = this; - - return Blob.lookup(repository, oid).then(function(blob) { - blob.repo = repository; +Repository.prototype.createBranch = function(name, commit, force) { + var repo = this; - if (typeof callback === "function") { - callback(null, blob); - } + if (commit instanceof Commit) { + return NodeGit.Branch.create( + repo, + name, + commit, + force ? 1 : 0); + } + else { + return repo.getCommit(commit).then(function(commit) { + return NodeGit.Branch.create( + repo, + name, + commit, + force ? 1 : 0); + }); + } +}; - return blob; - }, callback); +/** + * Create a blob from a buffer + * + * @param {Buffer} buffer + * @return {Oid} + */ +Repository.prototype.createBlobFromBuffer = function(buffer, callback) { + return Blob.createFromBuffer(this, buffer, buffer.length, callback); }; /** - * Retrieve the tree represented by the oid. + * Create a commit * * @async - * @param {String|Oid} String sha or Oid - * @return {Tree} + * @param {String} updateRef + * @param {Signature} author + * @param {Signature} committer + * @param {String} message + * @param {Tree|Oid|String} Tree + * @param {Array} parents + * @return {Oid} The oid of the commit */ -Repository.prototype.getTree = function(oid, callback) { - var repository = this; +Repository.prototype.createCommit = function( + updateRef, author, committer, message, tree, parents, callback) { - return Tree.lookup(repository, oid).then(function(tree) { - tree.repo = repository; + var repo = this; + var promises = []; + + parents = parents || []; + + promises.push(repo.getTree(tree)); + + parents.forEach(function(parent) { + promises.push(repo.getCommit(parent)); + }); + + return Promise.all(promises).then(function(results) { + tree = results[0]; + + // Get the normalized values for our input into the function + var parentsLength = parents.length; + parents = []; + + for (var i = 0; i < parentsLength; i++) { + parents.push(results[i + 1]); + } + return Commit.create( + repo, + updateRef, + author, + committer, + null /* use default message encoding */, + message, + tree, + parents.length, + parents + ); + }).then(function(commit) { if (typeof callback === "function") { - callback(null, tree); + callback(null, commit); } - return tree; + return commit; }, callback); }; /** - * Creates a new annotated tag + * Creates a new commit on HEAD from the list of passed in files * * @async - * @param {String|Oid} String sha or Oid - * @param {String} name the name of the tag - * @param {String} message the description that will be attached to the - * annotated tag - * @return {Tag} + * @param {Array} filesToAdd + * @param {Signature} author + * @param {Signature} committer + * @param {String} message + * @return {Oid} The oid of the new commit */ -Repository.prototype.createTag = function(oid, name, message, callback) { - var repository = this; - var signature = repository.defaultSignature(); +Repository.prototype.createCommitOnHead = function( + filesToAdd, + author, + committer, + message, + callback) { - return Commit.lookup(repository, oid) - .then(function(commit) { - // Final argument is `force` which overwrites any previous tag - return Tag.create(repository, name, commit, signature, message, 0); + var repo = this; + + return repo.refreshIndex() + .then(function(index) { + if (!filesToAdd) { + filesToAdd = []; + } + + return filesToAdd + .reduce(function(lastFilePromise, filePath) { + return lastFilePromise + .then(function() { + return index.addByPath(filePath); + }); + }, Promise.resolve()) + .then(function() { + return index.write(); + }) + .then(function() { + return index.writeTree(); + }); }) - .then(function(tagOid) { - return repository.getTag(tagOid, callback); - }); + .then(function(treeOid) { + return repo.getHeadCommit() + .then(function(parent) { + if (parent !== null) { // To handle a fresh repo with no commits + parent = [parent]; + } + return repo.createCommit( + "HEAD", + author, + committer, + message, + treeOid, + parent + ); + }); + }, callback); }; /** @@ -361,49 +559,55 @@ Repository.prototype.createLightweightTag = function(oid, name, callback) { }; /** - * Retrieve the tag represented by the oid. + * Instantiate a new revision walker for browsing the Repository"s history. + * See also `Commit.prototype.history()` * - * @async * @param {String|Oid} String sha or Oid - * @return {Tag} + * @return {RevWalk} */ -Repository.prototype.getTag = function(oid, callback) { - var repository = this; - - return Tag.lookup(repository, oid).then(function(reference) { - reference.repo = repository; - - if (typeof callback === "function") { - callback(null, reference); - } - - return reference; - }, callback); +Repository.prototype.createRevWalk = function() { + return Revwalk.create(this); }; /** - * Retrieve the tag represented by the tag name. + * Creates a new annotated tag * * @async - * @param {String} Short or full tag name + * @param {String|Oid} String sha or Oid + * @param {String} name the name of the tag + * @param {String} message the description that will be attached to the + * annotated tag * @return {Tag} */ -Repository.prototype.getTagByName = function(name, callback) { - var repo = this; +Repository.prototype.createTag = function(oid, name, message, callback) { + var repository = this; + var signature = repository.defaultSignature(); - name = ~name.indexOf("refs/tags/") ? name : "refs/tags/" + name; + return Commit.lookup(repository, oid) + .then(function(commit) { + // Final argument is `force` which overwrites any previous tag + return Tag.create(repository, name, commit, signature, message, 0); + }) + .then(function(tagOid) { + return repository.getTag(tagOid, callback); + }); +}; - return Reference.nameToId(repo, name).then(function(oid) { - return Tag.lookup(repo, oid).then(function(reference) { - reference.repo = repo; - if (typeof callback === "function") { - callback(null, reference); - } - return reference; - }); - }, callback); + +/** + * Gets the default signature for the default user and now timestamp + * @return {Signature} + */ +Repository.prototype.defaultSignature = function() { + var result = NodeGit.Signature.default(this); + + if (!result || !result.name()) { + result = NodeGit.Signature.now("unknown", "unknown@unknown.com"); + } + + return result; }; /** @@ -421,542 +625,588 @@ Repository.prototype.deleteTagByName = function(name) { }; /** - * Instantiate a new revision walker for browsing the Repository"s history. - * See also `Commit.prototype.history()` - * - * @param {String|Oid} String sha or Oid - * @return {RevWalk} - */ -Repository.prototype.createRevWalk = function() { - return Revwalk.create(this); -}; - -/** - * Retrieve the master branch commit. + * Discard line selection of a specified file. + * Assumes selected lines are unstaged. * * @async - * @return {Commit} + * @param {String} filePath The relative path of this file in the repo + * @param {Array} selectedLines The array of DiffLine objects + * selected for discarding + * @return {Number} 0 or an error code */ -Repository.prototype.getMasterCommit = function(callback) { - return this.getBranchCommit("master", callback); +Repository.prototype.discardLines = + function(filePath, selectedLines, additionalDiffOptions) { + var repo = this; + var fullFilePath = path.join(repo.workdir(), filePath); + var index; + var originalContent; + + return repo.refreshIndex() + .then(function(indexResult) { + index = indexResult; + + return fse.readFile(fullFilePath, "utf8"); + }) + .then(function(content) { + originalContent = content; + + return getPathHunks(repo, index, filePath, false, additionalDiffOptions); + }) + .then(function(hunks) { + return applySelectedLinesToTarget( + originalContent, selectedLines, hunks, false, true + ); + }) + .then(function(newContent) { + return fse.writeFile(fullFilePath, newContent); + }); }; /** - * Retrieve the commit that HEAD is currently pointing to + * Fetches from a remote * * @async - * @return {Commit} + * @param {String|Remote} remote + * @param {Object|FetchOptions} fetchOptions Options for the fetch, includes + * callbacks for fetching */ -Repository.prototype.getHeadCommit = function(callback) { +Repository.prototype.fetch = function( + remote, + fetchOptions, + callback) +{ var repo = this; - return Reference.nameToId(repo, "HEAD") - .then(function(head) { - return repo.getCommit(head, callback); + function finallyFn(error) { + if (typeof callback === "function") { + callback(error); + } + } + + return repo.getRemote(remote) + .then(function(remote) { + return remote.fetch(null, fetchOptions, "Fetch from " + remote) + .then(function() { + return remote.disconnect(); + }); }) - .catch(function() { - return null; + .then(finallyFn) + .catch(function(error) { + finallyFn(error); + throw error; }); }; /** - * Create a commit + * Fetches from all remotes. This is done in series due to deadlocking issues + * with fetching from many remotes that can happen. * * @async - * @param {String} updateRef - * @param {Signature} author - * @param {Signature} committer - * @param {String} message - * @param {Tree|Oid|String} Tree - * @param {Array} parents - * @return {Oid} The oid of the commit + * @param {Object|FetchOptions} fetchOptions Options for the fetch, includes + * callbacks for fetching + * @param {Function} callback */ -Repository.prototype.createCommit = function( - updateRef, author, committer, message, tree, parents, callback) { - +Repository.prototype.fetchAll = function( + fetchOptions, + callback) +{ var repo = this; - var promises = []; - parents = parents || []; - - promises.push(repo.getTree(tree)); + function createCallbackWrapper(fn, remote) { + return function() { + var args = Array.prototype.slice.call(arguments); + args.push(remote); - parents.forEach(function(parent) { - promises.push(repo.getCommit(parent)); - }); + return fn.apply(this, args); + }.bind(this); + } - return Promise.all(promises).then(function(results) { - tree = results[0]; + fetchOptions = fetchOptions || {}; - // Get the normalized values for our input into the function - var parentsLength = parents.length; - parents = []; + var remoteCallbacks = fetchOptions.callbacks || {}; - for (var i = 0; i < parentsLength; i++) { - parents.push(results[i + 1]); - } + var credentials = remoteCallbacks.credentials; + var certificateCheck = remoteCallbacks.certificateCheck; + var transferProgress = remoteCallbacks.transferProgress; - return Commit.create( - repo, - updateRef, - author, - committer, - null /* use default message encoding */, - message, - tree, - parents.length, - parents - ); - }).then(function(commit) { - if (typeof callback === "function") { - callback(null, commit); - } + return repo.getRemotes() + .then(function(remotes) { + return remotes.reduce(function(fetchPromise, remote) { + var wrappedFetchOptions = shallowClone(fetchOptions); + var wrappedRemoteCallbacks = shallowClone(remoteCallbacks); - return commit; - }, callback); -}; + if (credentials) { + wrappedRemoteCallbacks.credentials = + createCallbackWrapper(credentials, remote); + } -/** - * Creates a new commit on HEAD from the list of passed in files - * - * @async - * @param {Array} filesToAdd - * @param {Signature} author - * @param {Signature} committer - * @param {String} message - * @return {Oid} The oid of the new commit - */ -Repository.prototype.createCommitOnHead = function( - filesToAdd, - author, - committer, - message, - callback) { + if (certificateCheck) { + wrappedRemoteCallbacks.certificateCheck = + createCallbackWrapper(certificateCheck, remote); + } - var repo = this; + if (transferProgress) { + wrappedRemoteCallbacks.transferProgress = + createCallbackWrapper(transferProgress, remote); + } - return repo.refreshIndex() - .then(function(index) { - if (!filesToAdd) { - filesToAdd = []; - } + wrappedFetchOptions.callbacks = wrappedRemoteCallbacks; - return filesToAdd - .reduce(function(lastFilePromise, filePath) { - return lastFilePromise - .then(function() { - return index.addByPath(filePath); - }); - }, Promise.resolve()) - .then(function() { - return index.write(); - }) - .then(function() { - return index.writeTree(); + return fetchPromise.then(function() { + return repo.fetch(remote, wrappedFetchOptions); }); + }, Promise.resolve()); }) - .then(function(treeOid) { - return repo.getHeadCommit() - .then(function(parent) { - if (parent !== null) { // To handle a fresh repo with no commits - parent = [parent]; - } - return repo.createCommit( - "HEAD", - author, - committer, - message, - treeOid, - parent - ); - }); - }, callback); + .then(function() { + if (typeof callback === "function") { + callback(); + } + }); }; +var fetchheadForeach = Repository.prototype.fetchheadForeach; /** - * Create a blob from a buffer - * - * @param {Buffer} buffer - * @return {Oid} + * @async + * @param {FetchheadForeachCb} callback The callback function to be called on + * each entry */ -Repository.prototype.createBlobFromBuffer = function(buffer, callback) { - return Blob.createFromBuffer(this, buffer, buffer.length, callback); +Repository.prototype.fetchheadForeach = function(callback) { + return fetchheadForeach.call(this, callback, null); }; /** - * Create a new tree builder. + * Retrieve the blob represented by the oid. * - * @param {Tree} tree + * @async + * @param {String|Oid} String sha or Oid + * @return {Blob} */ -Repository.prototype.treeBuilder = function() { - var builder = TreeBuilder.create(null); +Repository.prototype.getBlob = function(oid, callback) { + var repository = this; - builder.root = builder; - builder.repo = this; + return Blob.lookup(repository, oid).then(function(blob) { + blob.repo = repository; - return builder; + if (typeof callback === "function") { + callback(null, blob); + } + + return blob; + }, callback); }; /** - * Gets the default signature for the default user and now timestamp - * @return {Signature} - */ -Repository.prototype.defaultSignature = function() { - var result = NodeGit.Signature.default(this); - - if (!result || !result.name()) { - result = NodeGit.Signature.now("unknown", "unknown@unknown.com"); - } - - return result; +* Look up a branch. Alias for `getReference` +* +* @async +* @param {String|Reference} name Ref name, e.g. "master", "refs/heads/master" +* or Branch Ref +* @return {Reference} +*/ +Repository.prototype.getBranch = function(name, callback) { + return this.getReference(name, callback); }; /** -* Lists out the remotes in the given repository. +* Look up a branch's most recent commit. Alias to `getReferenceCommit` * * @async -* @param {Function} Optional callback -* @return {Object} Promise object. +* @param {String|Reference} name Ref name, e.g. "master", "refs/heads/master" +* or Branch Ref +* @return {Commit} */ -Repository.prototype.getRemotes = function(callback) { - return Remote.list(this).then(function(remotes) { - if (typeof callback === "function") { - callback(null, remotes); - } - - return remotes; - }, callback); +Repository.prototype.getBranchCommit = function(name, callback) { + return this.getReferenceCommit(name, callback); }; /** - * Gets a remote from the repo + * Retrieve the commit identified by oid. * * @async - * @param {String|Remote} remote - * @param {Function} callback - * @return {Remote} The remote object + * @param {String|Oid} String sha or Oid + * @return {Commit} */ -Repository.prototype.getRemote = function(remote, callback) { - if (remote instanceof NodeGit.Remote) { - return Promise.resolve(remote).then(function(remoteObj) { - if (typeof callback === "function") { - callback(null, remoteObj); - } +Repository.prototype.getCommit = function(oid, callback) { + var repository = this; - return remoteObj; - }, callback); - } + return Commit.lookup(repository, oid).then(function(commit) { + commit.repo = repository; - return NodeGit.Remote.lookup(this, remote).then(function(remoteObj) { if (typeof callback === "function") { - callback(null, remoteObj); + callback(null, commit); } - return remoteObj; + return commit; }, callback); }; /** - * Fetches from a remote + * Gets the branch that HEAD currently points to + * Is an alias to head() * * @async - * @param {String|Remote} remote - * @param {Object|FetchOptions} fetchOptions Options for the fetch, includes - * callbacks for fetching + * @return {Reference} */ -Repository.prototype.fetch = function( - remote, - fetchOptions, - callback) -{ - var repo = this; +Repository.prototype.getCurrentBranch = function() { + return this.head(); +}; - function finallyFn(error) { - if (typeof callback === "function") { - callback(error); - } - } +/** + * Retrieve the commit that HEAD is currently pointing to + * + * @async + * @return {Commit} + */ +Repository.prototype.getHeadCommit = function(callback) { + var repo = this; - return repo.getRemote(remote) - .then(function(remote) { - return remote.fetch(null, fetchOptions, "Fetch from " + remote) - .then(function() { - return remote.disconnect(); - }); + return Reference.nameToId(repo, "HEAD") + .then(function(head) { + return repo.getCommit(head, callback); }) - .then(finallyFn) - .catch(function(error) { - finallyFn(error); - throw error; + .catch(function() { + return null; }); }; /** - * Fetches from all remotes. This is done in series due to deadlocking issues - * with fetching from many remotes that can happen. + * Retrieve the master branch commit. * * @async - * @param {Object|FetchOptions} fetchOptions Options for the fetch, includes - * callbacks for fetching - * @param {Function} callback + * @return {Commit} */ -Repository.prototype.fetchAll = function( - fetchOptions, - callback) -{ - var repo = this; - - function createCallbackWrapper(fn, remote) { - return function() { - var args = Array.prototype.slice.call(arguments); - args.push(remote); - - return fn.apply(this, args); - }.bind(this); - } +Repository.prototype.getMasterCommit = function(callback) { + return this.getBranchCommit("master", callback); +}; - fetchOptions = fetchOptions || {}; +/** + * Lookup the reference with the given name. + * + * @async + * @param {String|Reference} name Ref name, e.g. "master", "refs/heads/master" + * or Branch Ref + * @return {Reference} + */ +Repository.prototype.getReference = function(name, callback) { + var repository = this; - var remoteCallbacks = fetchOptions.callbacks || {}; + return Reference.dwim(this, name).then(function(reference) { + if (reference.isSymbolic()) { + return reference.resolve().then(function(reference) { + reference.repo = repository; - var credentials = remoteCallbacks.credentials; - var certificateCheck = remoteCallbacks.certificateCheck; - var transferProgress = remoteCallbacks.transferProgress; + if (typeof callback === "function") { + callback(null, reference); + } - return repo.getRemotes() - .then(function(remotes) { - return remotes.reduce(function(fetchPromise, remote) { - var wrappedFetchOptions = shallowClone(fetchOptions); - var wrappedRemoteCallbacks = shallowClone(remoteCallbacks); + return reference; + }, callback); + } else { + reference.repo = repository; + if (typeof callback === "function") { + callback(null, reference); + } + return reference; + } + }, callback); +}; - if (credentials) { - wrappedRemoteCallbacks.credentials = - createCallbackWrapper(credentials, remote); - } +/** + * Look up a refs's commit. + * + * @async + * @param {String|Reference} name Ref name, e.g. "master", "refs/heads/master" + * or Branch Ref + * @return {Commit} + */ +Repository.prototype.getReferenceCommit = function(name, callback) { + var repository = this; - if (certificateCheck) { - wrappedRemoteCallbacks.certificateCheck = - createCallbackWrapper(certificateCheck, remote); - } + return this.getReference(name).then(function(reference) { + return repository.getCommit(reference.target()).then(function(commit) { + if (typeof callback === "function") { + callback(null, commit); + } - if (transferProgress) { - wrappedRemoteCallbacks.transferProgress = - createCallbackWrapper(transferProgress, remote); - } + return commit; + }); + }, callback); +}; - wrappedFetchOptions.callbacks = wrappedRemoteCallbacks; +/** + * Lookup reference names for a repository. + * + * @async + * @param {Reference.TYPE} type Type of reference to look up + * @return {Array} + */ +Repository.prototype.getReferenceNames = function(type, callback) { + return Repository.getReferences(this, type, true, callback); +}; - return fetchPromise.then(function() { - return repo.fetch(remote, wrappedFetchOptions); - }); - }, Promise.resolve()); - }) - .then(function() { +/** + * Lookup references for a repository. + * + * @async + * @param {Reference.TYPE} type Type of reference to look up + * @return {Array} + */ +Repository.prototype.getReferences = function(type, callback) { + return Repository.getReferences(this, type, false, callback); +}; + +/** + * Gets a remote from the repo + * + * @async + * @param {String|Remote} remote + * @param {Function} callback + * @return {Remote} The remote object + */ +Repository.prototype.getRemote = function(remote, callback) { + if (remote instanceof NodeGit.Remote) { + return Promise.resolve(remote).then(function(remoteObj) { if (typeof callback === "function") { - callback(); + callback(null, remoteObj); } - }); + + return remoteObj; + }, callback); + } + + return NodeGit.Remote.lookup(this, remote).then(function(remoteObj) { + if (typeof callback === "function") { + callback(null, remoteObj); + } + + return remoteObj; + }, callback); }; /** - * Merge a branch onto another branch +* Lists out the remotes in the given repository. +* +* @async +* @param {Function} Optional callback +* @return {Object} Promise object. +*/ +Repository.prototype.getRemotes = function(callback) { + return Remote.list(this).then(function(remotes) { + if (typeof callback === "function") { + callback(null, remotes); + } + + return remotes; + }, callback); +}; + +/** + * Get the status of a repo to it's working directory * * @async - * @param {String|Reference} to - * @param {String|Reference} from - * @param {Signature} signature - * @param {Merge.PREFERENCE} mergePreference - * @param {MergeOptions} mergeOptions - * @return {Oid|Index} A commit id for a succesful merge or an index for a - * merge with conflicts + * @param {obj} opts + * @return {Array} */ -Repository.prototype.mergeBranches = - function(to, from, signature, mergePreference, mergeOptions) { - var repo = this; - var fromBranch; - var toBranch; +Repository.prototype.getStatus = function(opts) { + var statuses = []; + var statusCallback = function(path, status) { + statuses.push(new StatusFile({path: path, status: status})); + }; - mergePreference = mergePreference || NodeGit.Merge.PREFERENCE.NONE; - mergeOptions = normalizeOptions(mergeOptions, NodeGit.MergeOptions); + if (!opts) { + opts = { + flags: Status.OPT.INCLUDE_UNTRACKED | + Status.OPT.RECURSE_UNTRACKED_DIRS + }; + } - signature = signature || repo.defaultSignature(); + return Status.foreachExt(this, opts, statusCallback).then(function() { + return statuses; + }); +}; - return Promise.all([ - repo.getBranch(to), - repo.getBranch(from) - ]).then(function(objects) { - toBranch = objects[0]; - fromBranch = objects[1]; +/** + * Get extended statuses of a repo to it's working directory. Status entries + * have `status`, `headToIndex` delta, and `indexToWorkdir` deltas + * + * @async + * @param {obj} opts + * @return {Array} + */ +Repository.prototype.getStatusExt = function(opts) { + var statuses = []; - return Promise.all([ - repo.getBranchCommit(toBranch), - repo.getBranchCommit(fromBranch) - ]); - }) - .then(function(branchCommits) { - var toCommitOid = branchCommits[0].toString(); - var fromCommitOid = branchCommits[1].toString(); + if (!opts) { + opts = { + flags: Status.OPT.INCLUDE_UNTRACKED | + Status.OPT.RECURSE_UNTRACKED_DIRS | + Status.OPT.RENAMES_INDEX_TO_WORKDIR | + Status.OPT.RENAMES_HEAD_TO_INDEX | + Status.OPT.RENAMES_FROM_REWRITES + }; + } - return NodeGit.Merge.base(repo, toCommitOid, fromCommitOid) - .then(function(baseCommit) { - if (baseCommit.toString() == fromCommitOid) { - // The commit we're merging to is already in our history. - // nothing to do so just return the commit the branch is on - return toCommitOid; + return StatusList.create(this, opts) + .then(function(list) { + for (var i = 0; i < list.entrycount(); i++) { + var entry = Status.byIndex(list, i); + statuses.push(new StatusFile({entry: entry})); } - else if (baseCommit.toString() == toCommitOid && - mergePreference !== NodeGit.Merge.PREFERENCE.NO_FASTFORWARD) { - // fast forward - var message = - "Fast forward branch " + - toBranch.shorthand() + - " to branch " + - fromBranch.shorthand(); - return branchCommits[1].getTree() - .then(function(tree) { - if (toBranch.isHead()) { - // Checkout the tree if we're on the branch - var opts = { - checkoutStrategy: NodeGit.Checkout.STRATEGY.SAFE | - NodeGit.Checkout.STRATEGY.RECREATE_MISSING - }; - return NodeGit.Checkout.tree(repo, tree, opts); - } - }) - .then(function() { - return toBranch.setTarget( - fromCommitOid, - message) - .then(function() { - return fromCommitOid; - }); - }); - } - else if (mergePreference !== NodeGit.Merge.PREFERENCE.FASTFORWARD_ONLY) { - var updateHead; - // We have to merge. Lets do it! - return NodeGit.Reference.lookup(repo, "HEAD") - .then(function(headRef) { - return headRef.resolve(); - }) - .then(function(headRef) { - updateHead = !!headRef && (headRef.name() === toBranch.name()); - return NodeGit.Merge.commits( - repo, - toCommitOid, - fromCommitOid, - mergeOptions - ); - }) - .then(function(index) { - // if we have conflicts then throw the index - if (index.hasConflicts()) { - throw index; - } + return statuses; + }); +}; - // No conflicts so just go ahead with the merge - return index.writeTreeTo(repo); - }) - .then(function(oid) { - var message = - "Merged " + - fromBranch.shorthand() + - " into " + - toBranch.shorthand(); +/** + * Get the names of the submodules in the repository. + * + * @async + * @return {Array} + */ +Repository.prototype.getSubmoduleNames = function(callback) { + var names = []; + var submoduleCallback = function(submodule, name, payload) { + names.push(name); + }; + + return Submodule.foreach(this, submoduleCallback).then(function() { + if (typeof callback === "function") { + callback(null, names); + } + + return names; + }); +}; + +/** + * Retrieve the tag represented by the oid. + * + * @async + * @param {String|Oid} String sha or Oid + * @return {Tag} + */ +Repository.prototype.getTag = function(oid, callback) { + var repository = this; + + return Tag.lookup(repository, oid).then(function(reference) { + reference.repo = repository; + + if (typeof callback === "function") { + callback(null, reference); + } + + return reference; + }, callback); +}; + +/** + * Retrieve the tag represented by the tag name. + * + * @async + * @param {String} Short or full tag name + * @return {Tag} + */ +Repository.prototype.getTagByName = function(name, callback) { + var repo = this; + + name = ~name.indexOf("refs/tags/") ? name : "refs/tags/" + name; + + return Reference.nameToId(repo, name).then(function(oid) { + return Tag.lookup(repo, oid).then(function(reference) { + reference.repo = repo; - return repo.createCommit( - toBranch.name(), - signature, - signature, - message, - oid, - [toCommitOid, fromCommitOid]); - }) - .then(function(commit) { - // we've updated the checked out branch, so make sure we update - // head so that our index isn't messed up - if (updateHead) { - return repo.getBranch(to) - .then(function(branch) { - return repo.getBranchCommit(branch); - }) - .then(function(branchCommit) { - return branchCommit.getTree(); - }) - .then(function(tree) { - var opts = { - checkoutStrategy: NodeGit.Checkout.STRATEGY.SAFE | - NodeGit.Checkout.STRATEGY.RECREATE_MISSING - }; - return NodeGit.Checkout.tree(repo, tree, opts); - }) - .then(function() { - return commit; - }); - } - else { - return commit; - } - }); - } - else { - // A non fast-forwardable merge with ff-only - return toCommitOid; + if (typeof callback === "function") { + callback(null, reference); } + + return reference; }); - }); + }, callback); }; /** - * Goes through a rebase's rebase operations and commits them if there are - * no merge conflicts + * Retrieve the tree represented by the oid. * - * @param {Repository} repository The repository that the rebase is being - * performed in - * @param {Rebase} rebase The current rebase being performed - * @param {Signature} signature Identity of the one performing the rebase - * @param {Function} beforeNextFn Callback to be called before each - * invocation of next(). If the callback - * returns a promise, the next() will be - * called when the promise resolves. - * @return {Int|Index} An error code for an unsuccesful rebase or an index for - * a rebase with conflicts + * @async + * @param {String|Oid} String sha or Oid + * @return {Tree} */ -function performRebase(repository, rebase, signature, beforeNextFn) { - var beforeNextFnResult; +Repository.prototype.getTree = function(oid, callback) { + var repository = this; - function getPromise() { - return rebase.next() - .then(function() { - return repository.refreshIndex() - .then(function(index) { - if (index.hasConflicts()) { - throw index; - } + return Tree.lookup(repository, oid).then(function(tree) { + tree.repo = repository; - rebase.commit(null, signature); + if (typeof callback === "function") { + callback(null, tree); + } - return performRebase(repository, rebase, signature, beforeNextFn); - }); - }, function(error) { - if (error && error.errno === NodeGit.Error.CODE.ITEROVER) { - return rebase.finish(signature); - } else { - throw error; - } - }); - } + return tree; + }, callback); +}; - if(beforeNextFn) { - beforeNextFnResult = beforeNextFn(rebase); - // if beforeNextFn returns a promise, chain the promise - return Promise.resolve(beforeNextFnResult) - .then(getPromise); - } +/** + * Returns true if the repository is in the APPLY_MAILBOX or + * APPLY_MAILBOX_OR_REBASE state. + * @return {Boolean} + */ +Repository.prototype.isApplyingMailbox = function() { + var state = this.state(); + return state === NodeGit.Repository.STATE.APPLY_MAILBOX || + state === NodeGit.Repository.STATE.APPLY_MAILBOX_OR_REBASE; +}; - return getPromise(); -} +/** + * Returns true if the repository is in the BISECT state. + * @return {Boolean} + */ +Repository.prototype.isBisecting = function() { + return this.state() === NodeGit.Repository.STATE.BISECT; +}; + +/** + * Returns true if the repository is in the CHERRYPICK state. + * @return {Boolean} + */ +Repository.prototype.isCherrypicking = function() { + return this.state() === NodeGit.Repository.STATE.CHERRYPICK; +}; + +/** + * Returns true if the repository is in the default NONE state. + * @return {Boolean} + */ +Repository.prototype.isDefaultState = function() { + return this.state() === NodeGit.Repository.STATE.NONE; +}; + +/** + * Returns true if the repository is in the MERGE state. + * @return {Boolean} + */ +Repository.prototype.isMerging = function() { + return this.state() === NodeGit.Repository.STATE.MERGE; +}; + +/** + * Returns true if the repository is in the REBASE, REBASE_INTERACTIVE, or + * REBASE_MERGE state. + * @return {Boolean} + */ +Repository.prototype.isRebasing = function() { + var state = this.state(); + return state === NodeGit.Repository.STATE.REBASE || + state === NodeGit.Repository.STATE.REBASE_INTERACTIVE || + state === NodeGit.Repository.STATE.REBASE_MERGE; +}; + +/** + * Returns true if the repository is in the REVERT state. + * @return {Boolean} + */ +Repository.prototype.isReverting = function() { + return this.state() === NodeGit.Repository.STATE.REVERT; +}; /** * Rebases a branch onto another branch @@ -1016,217 +1266,204 @@ Repository.prototype.rebaseBranches = function( .then(function() { // checkout 'branch' to match the behavior of rebase return repo.checkoutBranch(branch); - }); - } else if (oid.toString() === upstreamCommit.id().toString()) { - // 'branch' is already on top of 'upstream' - // checkout 'branch' to match the behavior of rebase - return repo.checkoutBranch(branch); - } - - return NodeGit.Rebase.init( - repo, - branchCommit, - upstreamCommit, - ontoCommit, - rebaseOptions - ) - .then(function(rebase) { - return performRebase(repo, rebase, signature, beforeNextFn); - }) - .then(function(error) { - if (error) { - throw error; - } - }); - }) - .then(function() { - return repo.getBranchCommit("HEAD"); - }); -}; - -/** - * Continues an existing rebase - * - * @async - * @param {Signature} signature Identity of the one performing the rebase - * @param {Function} beforeNextFn Callback to be called before each step - * of the rebase. If the callback returns a - * promise, the rebase will resume when the - * promise resolves. The rebase object is - * is passed to the callback. - * @return {Oid|Index} A commit id for a succesful merge or an index for a - * rebase with conflicts - */ -Repository.prototype.continueRebase = function(signature, beforeNextFn) { - var repo = this; - - signature = signature || repo.defaultSignature(); - - return repo.refreshIndex() - .then(function(index) { - if (index.hasConflicts()) { - throw index; - } - - return NodeGit.Rebase.open(repo); - }) - .then(function(rebase) { - rebase.commit(null, signature); - - return performRebase(repo, rebase, signature, beforeNextFn); - }) - .then(function(error) { - if (error) { - throw error; - } - - return repo.getBranchCommit("HEAD"); - }); -}; - -// Override Repository.initExt to normalize initoptions -var initExt = Repository.initExt; -Repository.initExt = function(repo_path, opts) { - opts = normalizeOptions(opts, NodeGit.RepositoryInitOptions); - return initExt(repo_path, opts); -}; - -/** - * Get the status of a repo to it's working directory - * - * @async - * @param {obj} opts - * @return {Array} - */ -Repository.prototype.getStatus = function(opts) { - var statuses = []; - var statusCallback = function(path, status) { - statuses.push(new StatusFile({path: path, status: status})); - }; - - if (!opts) { - opts = { - flags: Status.OPT.INCLUDE_UNTRACKED | - Status.OPT.RECURSE_UNTRACKED_DIRS - }; - } + }); + } else if (oid.toString() === upstreamCommit.id().toString()) { + // 'branch' is already on top of 'upstream' + // checkout 'branch' to match the behavior of rebase + return repo.checkoutBranch(branch); + } - return Status.foreachExt(this, opts, statusCallback).then(function() { - return statuses; + return NodeGit.Rebase.init( + repo, + branchCommit, + upstreamCommit, + ontoCommit, + rebaseOptions + ) + .then(function(rebase) { + return performRebase(repo, rebase, signature, beforeNextFn); + }) + .then(function(error) { + if (error) { + throw error; + } + }); + }) + .then(function() { + return repo.getBranchCommit("HEAD"); }); }; /** - * Get extended statuses of a repo to it's working directory. Status entries - * have `status`, `headToIndex` delta, and `indexToWorkdir` deltas + * Grabs a fresh copy of the index from the repository. Invalidates + * all previously grabbed indexes * * @async - * @param {obj} opts - * @return {Array} + * @return {Index} */ -Repository.prototype.getStatusExt = function(opts) { - var statuses = []; +Repository.prototype.refreshIndex = function(callback) { + var repo = this; - if (!opts) { - opts = { - flags: Status.OPT.INCLUDE_UNTRACKED | - Status.OPT.RECURSE_UNTRACKED_DIRS | - Status.OPT.RENAMES_INDEX_TO_WORKDIR | - Status.OPT.RENAMES_HEAD_TO_INDEX | - Status.OPT.RENAMES_FROM_REWRITES - }; - } + repo.setIndex(); // clear the index - return StatusList.create(this, opts) - .then(function(list) { - for (var i = 0; i < list.entrycount(); i++) { - var entry = Status.byIndex(list, i); - statuses.push(new StatusFile({entry: entry})); + return repo.index() + .then(function(index) { + if (typeof callback === "function") { + callback(null, index); } - return statuses; - }); + return index; + }, callback); }; /** - * Get the names of the submodules in the repository. + * Merge a branch onto another branch * * @async - * @return {Array} + * @param {String|Reference} to + * @param {String|Reference} from + * @param {Signature} signature + * @param {Merge.PREFERENCE} mergePreference + * @param {MergeOptions} mergeOptions + * @return {Oid|Index} A commit id for a succesful merge or an index for a + * merge with conflicts */ -Repository.prototype.getSubmoduleNames = function(callback) { - var names = []; - var submoduleCallback = function(submodule, name, payload) { - names.push(name); - }; +Repository.prototype.mergeBranches = + function(to, from, signature, mergePreference, mergeOptions) { + var repo = this; + var fromBranch; + var toBranch; - return Submodule.foreach(this, submoduleCallback).then(function() { - if (typeof callback === "function") { - callback(null, names); - } + mergePreference = mergePreference || NodeGit.Merge.PREFERENCE.NONE; + mergeOptions = normalizeOptions(mergeOptions, NodeGit.MergeOptions); - return names; - }); -}; + signature = signature || repo.defaultSignature(); -/** - * This will set the HEAD to point to the reference and then attempt - * to update the index and working tree to match the content of the - * latest commit on that reference - * - * @async - * @param {Reference} reference the reference to checkout - * @param {Object|CheckoutOptions} opts the options to use for the checkout - */ -Repository.prototype.checkoutRef = function(reference, opts) { - var repo = this; - opts = opts || {}; + return Promise.all([ + repo.getBranch(to), + repo.getBranch(from) + ]).then(function(objects) { + toBranch = objects[0]; + fromBranch = objects[1]; - opts.checkoutStrategy = opts.checkoutStrategy || - (NodeGit.Checkout.STRATEGY.SAFE | - NodeGit.Checkout.STRATEGY.RECREATE_MISSING); - return repo.getReferenceCommit(reference.name()) - .then(function(commit) { - return commit.getTree(); - }) - .then(function(tree) { - return Checkout.tree(repo, tree, opts); + return Promise.all([ + repo.getBranchCommit(toBranch), + repo.getBranchCommit(fromBranch) + ]); }) - .then(function() { - var name = reference.name(); - return repo.setHead(name); - }); -}; + .then(function(branchCommits) { + var toCommitOid = branchCommits[0].toString(); + var fromCommitOid = branchCommits[1].toString(); -/** - * This will set the HEAD to point to the local branch and then attempt - * to update the index and working tree to match the content of the - * latest commit on that branch - * - * @async - * @param {String|Reference} branch the branch to checkout - * @param {Object|CheckoutOptions} opts the options to use for the checkout - */ -Repository.prototype.checkoutBranch = function(branch, opts) { - var repo = this; + return NodeGit.Merge.base(repo, toCommitOid, fromCommitOid) + .then(function(baseCommit) { + if (baseCommit.toString() == fromCommitOid) { + // The commit we're merging to is already in our history. + // nothing to do so just return the commit the branch is on + return toCommitOid; + } + else if (baseCommit.toString() == toCommitOid && + mergePreference !== NodeGit.Merge.PREFERENCE.NO_FASTFORWARD) { + // fast forward + var message = + "Fast forward branch " + + toBranch.shorthand() + + " to branch " + + fromBranch.shorthand(); - return repo.getReference(branch) - .then(function(ref) { - if (!ref.isBranch()) { - return false; - } - return repo.checkoutRef(ref, opts); - }); -}; + return branchCommits[1].getTree() + .then(function(tree) { + if (toBranch.isHead()) { + // Checkout the tree if we're on the branch + var opts = { + checkoutStrategy: NodeGit.Checkout.STRATEGY.SAFE | + NodeGit.Checkout.STRATEGY.RECREATE_MISSING + }; + return NodeGit.Checkout.tree(repo, tree, opts); + } + }) + .then(function() { + return toBranch.setTarget( + fromCommitOid, + message) + .then(function() { + return fromCommitOid; + }); + }); + } + else if (mergePreference !== NodeGit.Merge.PREFERENCE.FASTFORWARD_ONLY) { + var updateHead; + // We have to merge. Lets do it! + return NodeGit.Reference.lookup(repo, "HEAD") + .then(function(headRef) { + return headRef.resolve(); + }) + .then(function(headRef) { + updateHead = !!headRef && (headRef.name() === toBranch.name()); + return NodeGit.Merge.commits( + repo, + toCommitOid, + fromCommitOid, + mergeOptions + ); + }) + .then(function(index) { + // if we have conflicts then throw the index + if (index.hasConflicts()) { + throw index; + } -var fetchheadForeach = Repository.prototype.fetchheadForeach; -/** - * @async - * @param {FetchheadForeachCb} callback The callback function to be called on - * each entry - */ -Repository.prototype.fetchheadForeach = function(callback) { - return fetchheadForeach.call(this, callback, null); + // No conflicts so just go ahead with the merge + return index.writeTreeTo(repo); + }) + .then(function(oid) { + var message = + "Merged " + + fromBranch.shorthand() + + " into " + + toBranch.shorthand(); + + return repo.createCommit( + toBranch.name(), + signature, + signature, + message, + oid, + [toCommitOid, fromCommitOid]); + }) + .then(function(commit) { + // we've updated the checked out branch, so make sure we update + // head so that our index isn't messed up + if (updateHead) { + return repo.getBranch(to) + .then(function(branch) { + return repo.getBranchCommit(branch); + }) + .then(function(branchCommit) { + return branchCommit.getTree(); + }) + .then(function(tree) { + var opts = { + checkoutStrategy: NodeGit.Checkout.STRATEGY.SAFE | + NodeGit.Checkout.STRATEGY.RECREATE_MISSING + }; + return NodeGit.Checkout.tree(repo, tree, opts); + }) + .then(function() { + return commit; + }); + } + else { + return commit; + } + }); + } + else { + // A non fast-forwardable merge with ff-only + return toCommitOid; + } + }); + }); }; var mergeheadForeach = Repository.prototype.mergeheadForeach; @@ -1323,154 +1560,6 @@ Repository.prototype.stageFilemode = }); }; -function getPathHunks(repo, index, filePath, isStaged, additionalDiffOptions) { - var diffOptions = additionalDiffOptions ? { - flags: additionalDiffOptions - } : undefined; - - return Promise.resolve() - .then(function() { - if (isStaged) { - return repo.getHeadCommit() - .then(function getTreeFromCommit(commit) { - return commit.getTree(); - }) - .then(function getDiffFromTree(tree) { - return NodeGit.Diff.treeToIndex(repo, tree, index, diffOptions); - }); - } - - return NodeGit.Diff.indexToWorkdir(repo, index, { - flags: - NodeGit.Diff.OPTION.SHOW_UNTRACKED_CONTENT | - NodeGit.Diff.OPTION.RECURSE_UNTRACKED_DIRS | - (additionalDiffOptions || 0) - }); - }) - .then(function(diff) { - if (!(NodeGit.Status.file(repo, filePath) & - NodeGit.Status.STATUS.WT_MODIFIED) && - !(NodeGit.Status.file(repo, filePath) & - NodeGit.Status.STATUS.INDEX_MODIFIED)) { - return Promise.reject - ("Selected staging is only available on modified files."); - } - - return diff.patches(); - }) - .then(function(patches) { - var pathPatch = patches.filter(function(patch) { - return patch.newFile().path() === filePath; - }); - - if (pathPatch.length !== 1) { - return Promise.reject("No differences found for this file."); - } - - return pathPatch[0].hunks(); - }); -} - -function applySelectedLinesToTarget - (originalContent, newLines, pathHunks, isStaged, reverse) { - // 43: ascii code for '+' - // 45: ascii code for '-' - var lineTypes = { - ADDED: !reverse ? 43 : 45, - DELETED: !reverse ? 45 : 43 - }; - var newContent = ""; - var oldIndex = 0; - var linesPromises = []; - - // split the original file into lines - var oldLines = originalContent.toString().split("\n"); - - // if no selected lines were sent, return the original content - if (!newLines || newLines.length === 0) { - return originalContent; - } - - function lineEqualsFirstNewLine(hunkLine) { - return ((hunkLine.oldLineno() === newLines[0].oldLineno()) && - (hunkLine.newLineno() === newLines[0].newLineno())); - } - - function processSelectedLine(hunkLine) { - // if this hunk line is a selected line find the selected line - var newLine = newLines.filter(function(nLine) { - return ((hunkLine.oldLineno() === nLine.oldLineno()) && - (hunkLine.newLineno() === nLine.newLineno())); - }); - - if (hunkLine.content().indexOf("\\ No newline at end of file") !== -1) { - return false; - } - - // determine what to add to the new content - if ((isStaged && newLine && newLine.length > 0) || - (!isStaged && (!newLine || newLine.length === 0))) { - if (hunkLine.origin() !== lineTypes.ADDED) { - newContent += hunkLine.content(); - } - if ((isStaged && hunkLine.origin() !== lineTypes.DELETED) || - (!isStaged && hunkLine.origin() !== lineTypes.ADDED)) { - oldIndex++; - } - } - else { - switch (hunkLine.origin()) { - case lineTypes.ADDED: - newContent += hunkLine.content(); - if (isStaged) { - oldIndex++; - } - break; - case lineTypes.DELETED: - if (!isStaged) { - oldIndex++; - } - break; - default: - newContent += oldLines[oldIndex++]; - if (oldIndex < oldLines.length) { - newContent += "\n"; - } - break; - } - } - } - - // find the affected hunk - pathHunks.forEach(function(pathHunk) { - linesPromises.push(pathHunk.lines()); - }); - - return Promise.all(linesPromises).then(function(results) { - for (var i = 0; i < results.length && newContent.length < 1; i++) { - var hunkStart = isStaged || reverse ? pathHunks[i].newStart() - : pathHunks[i].oldStart(); - var lines = results[i]; - if (lines.filter(lineEqualsFirstNewLine).length > 0) { - // add content that is before the hunk - while (hunkStart > (oldIndex + 1)) { - newContent += oldLines[oldIndex++] + "\n"; - } - - // modify the lines of the hunk according to the selection - lines.forEach(processSelectedLine); - - // add the rest of the file - while (oldLines.length > oldIndex) { - newContent += oldLines[oldIndex++] + - (oldLines.length > oldIndex ? "\n" : ""); - } - } - } - return newContent; - }); -} - /** * Stages or unstages line selection of a specified file * @@ -1574,104 +1663,17 @@ Repository.prototype.stageLines = }; /** - * Discard line selection of a specified file. - * Assumes selected lines are unstaged. + * Create a new tree builder. * - * @async - * @param {String} filePath The relative path of this file in the repo - * @param {Array} selectedLines The array of DiffLine objects - * selected for discarding - * @return {Number} 0 or an error code - */ -Repository.prototype.discardLines = - function(filePath, selectedLines, additionalDiffOptions) { - var repo = this; - var fullFilePath = path.join(repo.workdir(), filePath); - var index; - var originalContent; - - return repo.refreshIndex() - .then(function(indexResult) { - index = indexResult; - - return fse.readFile(fullFilePath, "utf8"); - }) - .then(function(content) { - originalContent = content; - - return getPathHunks(repo, index, filePath, false, additionalDiffOptions); - }) - .then(function(hunks) { - return applySelectedLinesToTarget( - originalContent, selectedLines, hunks, false, true - ); - }) - .then(function(newContent) { - return fse.writeFile(fullFilePath, newContent); - }); -}; - -/** - * Returns true if the repository is in the default NONE state. - * @return {Boolean} - */ -Repository.prototype.isDefaultState = function() { - return this.state() === NodeGit.Repository.STATE.NONE; -}; - -/** - * Returns true if the repository is in the APPLY_MAILBOX or - * APPLY_MAILBOX_OR_REBASE state. - * @return {Boolean} - */ -Repository.prototype.isApplyingMailbox = function() { - var state = this.state(); - return state === NodeGit.Repository.STATE.APPLY_MAILBOX || - state === NodeGit.Repository.STATE.APPLY_MAILBOX_OR_REBASE; -}; - -/** - * Returns true if the repository is in the BISECT state. - * @return {Boolean} - */ -Repository.prototype.isBisecting = function() { - return this.state() === NodeGit.Repository.STATE.BISECT; -}; - -/** - * Returns true if the repository is in the CHERRYPICK state. - * @return {Boolean} - */ -Repository.prototype.isCherrypicking = function() { - return this.state() === NodeGit.Repository.STATE.CHERRYPICK; -}; - -/** - * Returns true if the repository is in the MERGE state. - * @return {Boolean} + * @param {Tree} tree */ -Repository.prototype.isMerging = function() { - return this.state() === NodeGit.Repository.STATE.MERGE; -}; +Repository.prototype.treeBuilder = function() { + var builder = TreeBuilder.create(null); -/** - * Returns true if the repository is in the REBASE, REBASE_INTERACTIVE, or - * REBASE_MERGE state. - * @return {Boolean} - */ -Repository.prototype.isRebasing = function() { - var state = this.state(); - return state === NodeGit.Repository.STATE.REBASE || - state === NodeGit.Repository.STATE.REBASE_INTERACTIVE || - state === NodeGit.Repository.STATE.REBASE_MERGE; -}; + builder.root = builder; + builder.repo = this; -/** - * Returns true if the repository is in the REVERT state. - * @return {Boolean} - */ -Repository.prototype.isReverting = function() { - return this.state() === NodeGit.Repository.STATE.REVERT; + return builder; }; module.exports = Repository; diff --git a/lib/revert.js b/lib/revert.js index 90022508d..eb366b4e2 100644 --- a/lib/revert.js +++ b/lib/revert.js @@ -24,7 +24,8 @@ Revert.commit = function( mainline, merge_options, callback -) { +) +{ merge_options = normalizeOptions(merge_options, NodeGit.MergeOptions); return commit.call( diff --git a/lib/revwalk.js b/lib/revwalk.js index 36d60a034..a866c6aff 100644 --- a/lib/revwalk.js +++ b/lib/revwalk.js @@ -5,61 +5,56 @@ Object.defineProperty(Revwalk.prototype, "repo", { get: function () { return this.repository(); } }); -var oldSorting = Revwalk.prototype.sorting; - /** - * Set the sort order for the revwalk. This function takes variable arguments - * like `revwalk.sorting(NodeGit.RevWalk.Topological, NodeGit.RevWalk.Reverse).` - * - * @param {Number} sort + * @typedef historyEntry + * @type {Object} + * @property {Commit} commit the commit for this entry + * @property {Number} status the status of the file in the commit + * @property {String} newName the new name that is provided when status is + * renamed + * @property {String} oldName the old name that is provided when status is + * renamed */ -Revwalk.prototype.sorting = function() { - var sort = 0; - - for (var i = 0; i < arguments.length; i++) { - sort |= arguments[i]; - } - - oldSorting.call(this, sort); -}; +var fileHistoryWalk = Revwalk.prototype.fileHistoryWalk; +/** + * @param {String} filePath + * @param {Number} max_count + * @async + * @return {Array} + */ +Revwalk.prototype.fileHistoryWalk = fileHistoryWalk; /** - * Walk the history from the given oid. The callback is invoked for each commit; - * When the walk is over, the callback is invoked with `(null, null)`. + * Get a number of commits. * - * @param {Oid} oid - * @param {Function} callback - * @return {Commit} + * @async + * @param {Number} count (default: 10) + * @return {Array} */ -Revwalk.prototype.walk = function(oid, callback) { - var revwalk = this; - - this.push(oid); +Revwalk.prototype.getCommits = function(count) { + count = count || 10; + var promises = []; + var walker = this; - function walk() { - revwalk.next().done(function(oid) { - if (!oid) { - if (typeof callback === "function") { - return callback(); - } + function walkCommitsCount(count) { + if (count === 0) { return; } - return; + return walker.next().then(function(oid) { + promises.push(walker.repo.getCommit(oid)); + return walkCommitsCount(count - 1); + }) + .catch(function(error) { + if (error.errno !== NodeGit.Error.CODE.ITEROVER) { + throw error; } - - revwalk.repo.getCommit(oid).then(function(commit) { - if (typeof callback === "function") { - callback(null, commit); - } - - walk(); - }); - }, callback); + }); } - walk(); + return walkCommitsCount(count).then(function() { + return Promise.all(promises); + }); }; - /** * Walk the history grabbing commits until the checkFn called with the * current commit returns false. @@ -94,52 +89,54 @@ Revwalk.prototype.getCommitsUntil = function(checkFn) { }; /** - * Get a number of commits. + * Set the sort order for the revwalk. This function takes variable arguments + * like `revwalk.sorting(NodeGit.RevWalk.Topological, NodeGit.RevWalk.Reverse).` * - * @async - * @param {Number} count (default: 10) - * @return {Array} + * @param {Number} sort */ -Revwalk.prototype.getCommits = function(count) { - count = count || 10; - var promises = []; - var walker = this; - - function walkCommitsCount(count) { - if (count === 0) { return; } +var oldSorting = Revwalk.prototype.sorting; +Revwalk.prototype.sorting = function() { + var sort = 0; - return walker.next().then(function(oid) { - promises.push(walker.repo.getCommit(oid)); - return walkCommitsCount(count - 1); - }) - .catch(function(error) { - if (error.errno !== NodeGit.Error.CODE.ITEROVER) { - throw error; - } - }); + for (var i = 0; i < arguments.length; i++) { + sort |= arguments[i]; } - return walkCommitsCount(count).then(function() { - return Promise.all(promises); - }); + oldSorting.call(this, sort); }; /** - * @typedef historyEntry - * @type {Object} - * @property {Commit} commit the commit for this entry - * @property {Number} status the status of the file in the commit - * @property {String} newName the new name that is provided when status is - * renamed - * @property {String} oldName the old name that is provided when status is - * renamed + * Walk the history from the given oid. The callback is invoked for each commit; + * When the walk is over, the callback is invoked with `(null, null)`. + * + * @param {Oid} oid + * @param {Function} callback + * @return {Commit} */ +Revwalk.prototype.walk = function(oid, callback) { + var revwalk = this; -var fileHistoryWalk = Revwalk.prototype.fileHistoryWalk; -/** - * @param {String} filePath - * @param {Number} max_count - * @async - * @return {Array} - */ -Revwalk.prototype.fileHistoryWalk = fileHistoryWalk; + this.push(oid); + + function walk() { + revwalk.next().done(function(oid) { + if (!oid) { + if (typeof callback === "function") { + return callback(); + } + + return; + } + + revwalk.repo.getCommit(oid).then(function(commit) { + if (typeof callback === "function") { + callback(null, commit); + } + + walk(); + }); + }, callback); + } + + walk(); +}; diff --git a/lib/stash.js b/lib/stash.js index fbc1ca170..a382bd7b9 100644 --- a/lib/stash.js +++ b/lib/stash.js @@ -3,19 +3,6 @@ var normalizeOptions = NodeGit.Utils.normalizeOptions; var shallowClone = require("./utils/shallow_clone"); var Stash = NodeGit.Stash; -// Override Stash.foreach to eliminate the need to pass null payload -var foreach = Stash.foreach; -Stash.foreach = function(repo, callback) { - function wrappedCallback(index, message, oid) { - // We need to copy the OID since libgit2 types are getting cleaned up - // incorrectly right now in callbacks - - return callback(index, message, oid.copy()); - } - - return foreach(repo, wrappedCallback, null); -}; - var sApply = Stash.apply; Stash.apply = function(repo, index, options) { var checkoutOptions; @@ -38,6 +25,19 @@ Stash.apply = function(repo, index, options) { return sApply(repo, index, options); }; +// Override Stash.foreach to eliminate the need to pass null payload +var foreach = Stash.foreach; +Stash.foreach = function(repo, callback) { + function wrappedCallback(index, message, oid) { + // We need to copy the OID since libgit2 types are getting cleaned up + // incorrectly right now in callbacks + + return callback(index, message, oid.copy()); + } + + return foreach(repo, wrappedCallback, null); +}; + var pop = Stash.pop; Stash.pop = function(repo, index, options) { var checkoutOptions; diff --git a/lib/status_file.js b/lib/status_file.js index 2d02dbeb3..ac6b124e3 100644 --- a/lib/status_file.js +++ b/lib/status_file.js @@ -37,12 +37,6 @@ var StatusFile = function(args) { }; return { - status: function() { - return data.statuses; - }, - statusBit: function() { - return data.statusBit; - }, headToIndex: function() { if (data.entry) { return entry.headToIndex(); @@ -57,48 +51,54 @@ var StatusFile = function(args) { return undefined; } }, - path: function() { - return data.path; + inIndex: function() { + return status & codes.INDEX_NEW || + status & codes.INDEX_MODIFIED || + status & codes.INDEX_DELETED || + status & codes.INDEX_TYPECHANGE || + status & codes.INDEX_RENAMED; }, - isNew: function() { + inWorkingTree: function() { return status & codes.WT_NEW || - status & codes.INDEX_NEW; + status & codes.WT_MODIFIED || + status & codes.WT_DELETED || + status & codes.WT_TYPECHANGE || + status & codes.WT_RENAMED; }, - isModified: function() { - return status & codes.WT_MODIFIED || - status & codes.INDEX_MODIFIED; + isConflicted: function() { + return status & codes.CONFLICTED; }, isDeleted: function() { return status & codes.WT_DELETED || status & codes.INDEX_DELETED; }, - isTypechange: function() { - return status & codes.WT_TYPECHANGE || - status & codes.INDEX_TYPECHANGE; + isIgnored: function() { + return status & codes.IGNORED; + }, + isModified: function() { + return status & codes.WT_MODIFIED || + status & codes.INDEX_MODIFIED; + }, + isNew: function() { + return status & codes.WT_NEW || + status & codes.INDEX_NEW; }, isRenamed: function() { return status & codes.WT_RENAMED || status & codes.INDEX_RENAMED; }, - isIgnored: function() { - return status & codes.IGNORED; + isTypechange: function() { + return status & codes.WT_TYPECHANGE || + status & codes.INDEX_TYPECHANGE; }, - isConflicted: function() { - return status & codes.CONFLICTED; + path: function() { + return data.path; }, - inWorkingTree: function() { - return status & codes.WT_NEW || - status & codes.WT_MODIFIED || - status & codes.WT_DELETED || - status & codes.WT_TYPECHANGE || - status & codes.WT_RENAMED; + status: function() { + return data.statuses; }, - inIndex: function() { - return status & codes.INDEX_NEW || - status & codes.INDEX_MODIFIED || - status & codes.INDEX_DELETED || - status & codes.INDEX_TYPECHANGE || - status & codes.INDEX_RENAMED; + statusBit: function() { + return data.statusBit; } }; }; diff --git a/lib/tree.js b/lib/tree.js index ba3d247a5..0ece24abc 100644 --- a/lib/tree.js +++ b/lib/tree.js @@ -6,7 +6,6 @@ var LookupWrapper = NodeGit.Utils.lookupWrapper; var Tree = NodeGit.Tree; var Treebuilder = NodeGit.Treebuilder; - /** * Retrieves the tree pointed to by the oid * @async @@ -17,6 +16,19 @@ var Treebuilder = NodeGit.Treebuilder; */ Tree.lookup = LookupWrapper(Tree); +/** + * Make builder. This is helpful for modifying trees. + * @return {Treebuilder} + */ +Tree.prototype.builder = function() { + var builder = Treebuilder.create(this); + + builder.root = builder; + builder.repo = this.repo; + + return builder; +}; + /** * Diff two trees * @async @@ -46,6 +58,21 @@ Tree.prototype.diffWithOptions = function(tree, options, callback) { }, callback); }; +/** + * Return an array of the entries in this tree (excluding its children). + * @return {Array} an array of TreeEntrys + */ +Tree.prototype.entries = function() { + var size = this.entryCount(); + var result = []; + + for (var i = 0; i < size; i++) { + result.push(this.entryByIndex(i)); + } + + return result; +}; + /** * Get an entry at the ith position. * @@ -93,18 +120,11 @@ Tree.prototype.getEntry = function(filePath, callback) { }; /** - * Return an array of the entries in this tree (excluding its children). - * @return {Array} an array of TreeEntrys + * Return the path of this tree, like `/lib/foo/bar` + * @return {String} */ -Tree.prototype.entries = function() { - var size = this.entryCount(); - var result = []; - - for (var i = 0; i < size; i++) { - result.push(this.entryByIndex(i)); - } - - return result; +Tree.prototype.path = function(blobsOnly) { + return this.entry ? this.entry.path() : ""; }; /** @@ -166,24 +186,3 @@ Tree.prototype.walk = function(blobsOnly) { return event; }; - -/** - * Return the path of this tree, like `/lib/foo/bar` - * @return {String} - */ -Tree.prototype.path = function(blobsOnly) { - return this.entry ? this.entry.path() : ""; -}; - -/** - * Make builder. This is helpful for modifying trees. - * @return {Treebuilder} - */ -Tree.prototype.builder = function() { - var builder = Treebuilder.create(this); - - builder.root = builder; - builder.repo = this.repo; - - return builder; -}; diff --git a/lib/tree_entry.js b/lib/tree_entry.js index cdb372314..3de231b4b 100644 --- a/lib/tree_entry.js +++ b/lib/tree_entry.js @@ -3,22 +3,45 @@ var NodeGit = require("../"); var TreeEntry = NodeGit.TreeEntry; /** - * Is this TreeEntry a blob? (i.e., a file) - * @return {Boolean} + * Retrieve the blob for this entry. Make sure to call `isBlob` first! + * @async + * @return {Blob} */ -TreeEntry.prototype.isFile = function() { - return this.filemode() === TreeEntry.FILEMODE.BLOB || - this.filemode() === TreeEntry.FILEMODE.EXECUTABLE; +TreeEntry.prototype.getBlob = function(callback) { + return this.parent.repo.getBlob(this.id()).then(function(blob) { + if (typeof callback === "function") { + callback(null, blob); + } + + return blob; + }, callback); }; /** - * Is this TreeEntry a tree? (i.e., a directory) - * @return {Boolean} + * Retrieve the tree for this entry. Make sure to call `isTree` first! + * @async + * @return {Tree} */ -TreeEntry.prototype.isTree = function() { - return this.filemode() === TreeEntry.FILEMODE.TREE; +TreeEntry.prototype.getTree = function(callback) { + var entry = this; + + return this.parent.repo.getTree(this.id()).then(function(tree) { + tree.entry = entry; + + if (typeof callback === "function") { + callback(null, tree); + } + + return tree; + }, callback); }; +/** + * Is this TreeEntry a blob? Alias for `isFile` + * @return {Boolean} + */ +TreeEntry.prototype.isBlob = TreeEntry.prototype.isFile; + /** * Is this TreeEntry a directory? Alias for `isTree` * @return {Boolean} @@ -26,10 +49,13 @@ TreeEntry.prototype.isTree = function() { TreeEntry.prototype.isDirectory = TreeEntry.prototype.isTree; /** - * Is this TreeEntry a blob? Alias for `isFile` + * Is this TreeEntry a blob? (i.e., a file) * @return {Boolean} */ -TreeEntry.prototype.isBlob = TreeEntry.prototype.isFile; +TreeEntry.prototype.isFile = function() { + return this.filemode() === TreeEntry.FILEMODE.BLOB || + this.filemode() === TreeEntry.FILEMODE.EXECUTABLE; +}; /** * Is this TreeEntry a submodule? @@ -40,46 +66,18 @@ TreeEntry.prototype.isSubmodule = function() { }; /** - * Retrieve the SHA for this TreeEntry. - * @return {String} - */ -TreeEntry.prototype.sha = function() { - return this.id().toString(); -}; - -/** - * Retrieve the tree for this entry. Make sure to call `isTree` first! - * @async - * @return {Tree} + * Is this TreeEntry a tree? (i.e., a directory) + * @return {Boolean} */ -TreeEntry.prototype.getTree = function(callback) { - var entry = this; - - return this.parent.repo.getTree(this.id()).then(function(tree) { - tree.entry = entry; - - if (typeof callback === "function") { - callback(null, tree); - } - - return tree; - }, callback); +TreeEntry.prototype.isTree = function() { + return this.filemode() === TreeEntry.FILEMODE.TREE; }; /** - * Retrieve the blob for this entry. Make sure to call `isBlob` first! - * @async - * @return {Blob} + * Retrieve the SHA for this TreeEntry. Alias for `sha` + * @return {String} */ -TreeEntry.prototype.getBlob = function(callback) { - return this.parent.repo.getBlob(this.id()).then(function(blob) { - if (typeof callback === "function") { - callback(null, blob); - } - - return blob; - }, callback); -}; +TreeEntry.prototype.oid = TreeEntry.prototype.sha; /** * Returns the path for this entry. @@ -90,13 +88,17 @@ TreeEntry.prototype.path = function(callback) { return path.join(this.parent.path(), dirtoparent, this.name()); }; +/** + * Retrieve the SHA for this TreeEntry. + * @return {String} + */ +TreeEntry.prototype.sha = function() { + return this.id().toString(); +}; + /** * Alias for `path` */ TreeEntry.prototype.toString = function() { return this.path(); }; - -TreeEntry.prototype.oid = function() { - return this.id().toString(); -}; From de1435327bb21dbebbf6a548c60bc6d62208b6b0 Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Fri, 15 Jul 2016 20:08:19 -0700 Subject: [PATCH 12/34] Stop re-exporting things from lib All of our stuff is put directly on `Nodegit.{type}`, so no need to assign that {type} object to module.exports. What was still there was a holdover from how we used to do that, which caused issues so we stopped. --- lib/convenient_hunks.js | 2 -- lib/convenient_patch.js | 2 -- lib/diff_file.js | 2 -- lib/remote.js | 2 -- lib/repository.js | 2 -- lib/reset.js | 2 -- lib/revert.js | 2 -- 7 files changed, 14 deletions(-) diff --git a/lib/convenient_hunks.js b/lib/convenient_hunks.js index dbbbbb7d3..ef8070d06 100644 --- a/lib/convenient_hunks.js +++ b/lib/convenient_hunks.js @@ -59,5 +59,3 @@ var size = ConvenientHunk.prototype.size; * @return {Number} */ ConvenientHunk.prototype.size = size; - -module.exports = ConvenientHunk; diff --git a/lib/convenient_patch.js b/lib/convenient_patch.js index d74ddda0a..1e825382b 100644 --- a/lib/convenient_patch.js +++ b/lib/convenient_patch.js @@ -129,5 +129,3 @@ var status = ConvenientPatch.prototype.status; * @return {Number} */ ConvenientPatch.prototype.status = status; - -module.exports = ConvenientPatch; diff --git a/lib/diff_file.js b/lib/diff_file.js index 2c2dc757e..34ce315ce 100644 --- a/lib/diff_file.js +++ b/lib/diff_file.js @@ -36,5 +36,3 @@ var size = DiffFile.prototype.size; * @return {Number} */ DiffFile.prototype.size = size; - -module.exports = DiffFile; diff --git a/lib/remote.js b/lib/remote.js index c28c3ede2..606d75fef 100644 --- a/lib/remote.js +++ b/lib/remote.js @@ -132,5 +132,3 @@ Remote.prototype.push = function(refSpecs, opts) { return push.call(this, refSpecs, opts); }; - -module.exports = Remote; diff --git a/lib/repository.js b/lib/repository.js index 7adc83ce1..b25757bec 100644 --- a/lib/repository.js +++ b/lib/repository.js @@ -1675,5 +1675,3 @@ Repository.prototype.treeBuilder = function() { return builder; }; - -module.exports = Repository; diff --git a/lib/reset.js b/lib/reset.js index be9bc5455..4bff9c40d 100644 --- a/lib/reset.js +++ b/lib/reset.js @@ -49,5 +49,3 @@ Reset.reset = function(repo, target, resetType, opts) { return reset.call(this, repo, target, resetType, opts); }; - -module.exports = Reset; diff --git a/lib/revert.js b/lib/revert.js index eb366b4e2..7efe2507b 100644 --- a/lib/revert.js +++ b/lib/revert.js @@ -44,5 +44,3 @@ Revert.commit = function( return result; }, callback); }; - -module.exports = Revert; From ba081a71edc3b092df6e419f614415d1637bafd5 Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Fri, 15 Jul 2016 20:10:18 -0700 Subject: [PATCH 13/34] pull shallow clone off utils object Instead of requiring it, pull it of NodeGit.Utils the same way we do with other utils files. Follows the spirit of the last commit, in that it gets rid of requiring individual modules. --- lib/cherrypick.js | 2 +- lib/clone.js | 2 +- lib/rebase.js | 2 +- lib/remote.js | 2 +- lib/stash.js | 2 +- lib/utils/shallow_clone.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/cherrypick.js b/lib/cherrypick.js index 8afd9fc17..cf003c2a5 100644 --- a/lib/cherrypick.js +++ b/lib/cherrypick.js @@ -1,5 +1,5 @@ var NodeGit = require("../"); -var shallowClone = require("./utils/shallow_clone"); +var shallowClone = NodeGit.Utils.shallowClone; var normalizeOptions = NodeGit.Utils.normalizeOptions; var Cherrypick = NodeGit.Cherrypick; diff --git a/lib/clone.js b/lib/clone.js index d1eb56b1d..56c199f85 100644 --- a/lib/clone.js +++ b/lib/clone.js @@ -1,5 +1,5 @@ var NodeGit = require("../"); -var shallowClone = require("./utils/shallow_clone"); +var shallowClone = NodeGit.Utils.shallowClone; var normalizeOptions = NodeGit.Utils.normalizeOptions; var Clone = NodeGit.Clone; diff --git a/lib/rebase.js b/lib/rebase.js index 419c596e7..5ea5632c6 100644 --- a/lib/rebase.js +++ b/lib/rebase.js @@ -1,7 +1,7 @@ var NodeGit = require("../"); var Rebase = NodeGit.Rebase; var normalizeOptions = NodeGit.Utils.normalizeOptions; -var shallowClone = require("./utils/shallow_clone"); +var shallowClone = NodeGit.Utils.shallowClone; /** * Initializes a rebase diff --git a/lib/remote.js b/lib/remote.js index 606d75fef..93c752494 100644 --- a/lib/remote.js +++ b/lib/remote.js @@ -1,7 +1,7 @@ var NodeGit = require("../"); var normalizeOptions = NodeGit.Utils.normalizeOptions; var lookupWrapper = NodeGit.Utils.lookupWrapper; -var shallowClone = require("./utils/shallow_clone"); +var shallowClone = NodeGit.Utils.shallowClone; var Remote = NodeGit.Remote; var connect = Remote.prototype.connect; diff --git a/lib/stash.js b/lib/stash.js index a382bd7b9..c3634b11a 100644 --- a/lib/stash.js +++ b/lib/stash.js @@ -1,6 +1,6 @@ var NodeGit = require("../"); var normalizeOptions = NodeGit.Utils.normalizeOptions; -var shallowClone = require("./utils/shallow_clone"); +var shallowClone = NodeGit.Utils.shallowClone; var Stash = NodeGit.Stash; var sApply = Stash.apply; diff --git a/lib/utils/shallow_clone.js b/lib/utils/shallow_clone.js index 1d536274b..0dbe4113e 100644 --- a/lib/utils/shallow_clone.js +++ b/lib/utils/shallow_clone.js @@ -11,4 +11,4 @@ function shallowClone() { }, {}); } -NodeGit.Utils.shallowClone = module.exports = shallowClone; +NodeGit.Utils.shallowClone = shallowClone; From cd5c051320f1dc8d4fb97d139371fad8f1819c20 Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Mon, 18 Jul 2016 09:10:57 -0700 Subject: [PATCH 14/34] Normalize fn names for overrides When we override a function on a nodegit type, what we generally do is pull the function out and save it, and write a new function to the object that calls the old saved value. The names we used to save things were never consistant. Using the made up reset.getCommit as an example, we might have `originalGetCommit`, `_getCommit`, `resetGetCommit`, or if it wasn't a keyword, just `getCommit`. I changed them all to `_getCommit`. Also sometimes they would be at tht eotp of the file, sometimes down by the override. I moved them all up top. --- lib/blame.js | 1 + lib/clone.js | 2 +- lib/commit.js | 4 ++-- lib/diff.js | 30 ++++++++++++++++-------------- lib/diff_line.js | 5 +++-- lib/index.js | 13 +++++++------ lib/merge.js | 8 ++++---- lib/note.js | 5 +++-- lib/odb.js | 5 +++-- lib/rebase.js | 8 ++++---- lib/remote.js | 16 ++++++++-------- lib/repository.js | 22 ++++++++++------------ lib/reset.js | 8 ++++---- lib/revert.js | 4 ++-- lib/revwalk.js | 4 ++-- lib/stash.js | 13 +++++++------ lib/status.js | 9 +++++---- lib/status_list.js | 5 +++-- lib/submodule.js | 5 +++-- 19 files changed, 88 insertions(+), 79 deletions(-) diff --git a/lib/blame.js b/lib/blame.js index f2950d231..77f3ad9a3 100644 --- a/lib/blame.js +++ b/lib/blame.js @@ -1,6 +1,7 @@ var NodeGit = require("../"); var normalizeOptions = NodeGit.Utils.normalizeOptions; var Blame = NodeGit.Blame; + var _file = Blame.file; /** diff --git a/lib/clone.js b/lib/clone.js index 56c199f85..8dab5c3c3 100644 --- a/lib/clone.js +++ b/lib/clone.js @@ -54,7 +54,7 @@ Clone.clone = function(url, local_path, options) { return NodeGit.Repository.open(local_path); }; - return clone.call(this, url, local_path, options) + return _clone.call(this, url, local_path, options) .then(freeRepository) .then(openRepository); }; diff --git a/lib/commit.js b/lib/commit.js index a3f9aa2bf..73d3f62b4 100644 --- a/lib/commit.js +++ b/lib/commit.js @@ -3,6 +3,7 @@ var NodeGit = require("../"); var Commit = NodeGit.Commit; var LookupWrapper = NodeGit.Utils.lookupWrapper; +var _amend = Commit.prototype.amend; /** * Retrieves the commit pointed to by the oid * @async @@ -23,7 +24,6 @@ Commit.lookup = LookupWrapper(Commit); * @param {Tree|Oid} tree * @param {Oid} callback */ -var amend = Commit.prototype.amend; Commit.prototype.amend = function ( updateRef, author, committer, message_encoding, message, tree, callback) { var repo = this.repo; @@ -38,7 +38,7 @@ Commit.prototype.amend = function ( return treePromise .then(function(treeObject){ - return amend.call(_this, + return _amend.call(_this, updateRef, author, committer, diff --git a/lib/diff.js b/lib/diff.js index d542c6811..b393595f8 100644 --- a/lib/diff.js +++ b/lib/diff.js @@ -3,7 +3,15 @@ var Diff = NodeGit.Diff; var normalizeOptions = NodeGit.Utils.normalizeOptions; var Patch = NodeGit.Patch; -var blobToBuffer = Diff.blobToBuffer; +var _blobToBuffer = Diff.blobToBuffer; +var _indexToWorkdir = Diff.indexToWorkdir; +var _treeToIndex = Diff.treeToIndex; +var _treeToTree = Diff.treeToTree; +var _treeToWorkdir = Diff.treeToWorkdir; +var _treeToWorkdirWithIndex = Diff.treeToWorkdirWithIndex; + +var _findSimilar = Diff.prototype.findSimilar; + /** * Directly run a diff between a blob and a buffer. * @async @@ -42,7 +50,7 @@ Diff.blobToBuffer= function( opts = normalizeOptions(opts, NodeGit.DiffOptions); - return blobToBuffer.call( + return _blobToBuffer.call( this, old_blob, old_as_path, @@ -58,45 +66,39 @@ Diff.blobToBuffer= function( }; // Override Diff.indexToWorkdir to normalize opts -var indexToWorkdir = Diff.indexToWorkdir; Diff.indexToWorkdir = function(repo, index, opts) { opts = normalizeOptions(opts, NodeGit.DiffOptions); - return indexToWorkdir(repo, index, opts); + return _indexToWorkdir(repo, index, opts); }; // Override Diff.treeToIndex to normalize opts -var treeToIndex = Diff.treeToIndex; Diff.treeToIndex = function(repo, tree, index, opts) { opts = normalizeOptions(opts, NodeGit.DiffOptions); - return treeToIndex(repo, tree, index, opts); + return _treeToIndex(repo, tree, index, opts); }; // Override Diff.treeToTree to normalize opts -var treeToTree = Diff.treeToTree; Diff.treeToTree = function(repo, from_tree, to_tree, opts) { opts = normalizeOptions(opts, NodeGit.DiffOptions); - return treeToTree(repo, from_tree, to_tree, opts); + return _treeToTree(repo, from_tree, to_tree, opts); }; // Override Diff.treeToWorkdir to normalize opts -var treeToWorkdir = Diff.treeToWorkdir; Diff.treeToWorkdir = function(repo, tree, opts) { opts = normalizeOptions(opts, NodeGit.DiffOptions); - return treeToWorkdir(repo, tree, opts); + return _treeToWorkdir(repo, tree, opts); }; // Override Diff.treeToWorkdir to normalize opts -var treeToWorkdirWithIndex = Diff.treeToWorkdirWithIndex; Diff.treeToWorkdirWithIndex = function(repo, tree, opts) { opts = normalizeOptions(opts, NodeGit.DiffOptions); - return treeToWorkdirWithIndex(repo, tree, opts); + return _treeToWorkdirWithIndex(repo, tree, opts); }; // Override Diff.findSimilar to normalize opts -var findSimilar = Diff.prototype.findSimilar; Diff.prototype.findSimilar = function(opts) { opts = normalizeOptions(opts, NodeGit.DiffFindOptions); - return findSimilar.call(this, opts); + return _findSimilar.call(this, opts); }; /** diff --git a/lib/diff_line.js b/lib/diff_line.js index ccd1f5617..83e434401 100644 --- a/lib/diff_line.js +++ b/lib/diff_line.js @@ -1,6 +1,8 @@ var NodeGit = require("../"); var DiffLine = NodeGit.DiffLine; +var _rawContent = DiffLine.prototype.content; + /** * The relevant line * @return {String} @@ -23,9 +25,8 @@ DiffLine.prototype.content = function() { * The non utf8 translated text * @return {String} */ -var rawContent = DiffLine.prototype.content; DiffLine.prototype.rawContent = function() { - return rawContent.call(this); + return _rawContent.call(this); }; NodeGit.DiffLine = DiffLine; diff --git a/lib/index.js b/lib/index.js index 17a9253f3..cb87784d3 100644 --- a/lib/index.js +++ b/lib/index.js @@ -2,9 +2,12 @@ var NodeGit = require("../"); var Index = NodeGit.Index; -var addAll = Index.prototype.addAll; +var _addAll = Index.prototype.addAll; +var _removeAll = Index.prototype.removeAll; +var _updateAll = Index.prototype.updateAll; + Index.prototype.addAll = function(pathspec, flags, matchedCallback) { - return addAll.call(this, pathspec || "*", flags, matchedCallback, null); + return _addAll.call(this, pathspec || "*", flags, matchedCallback, null); }; /** @@ -22,12 +25,10 @@ Index.prototype.entries = function() { return result; }; -var removeAll = Index.prototype.removeAll; Index.prototype.removeAll = function(pathspec, matchedCallback) { - return removeAll.call(this, pathspec || "*", matchedCallback, null); + return _removeAll.call(this, pathspec || "*", matchedCallback, null); }; -var updateAll = Index.prototype.updateAll; Index.prototype.updateAll = function(pathspec, matchedCallback) { - return updateAll.call(this, pathspec || "*", matchedCallback, null); + return _updateAll.call(this, pathspec || "*", matchedCallback, null); }; diff --git a/lib/merge.js b/lib/merge.js index 818f95c02..e9b9b5c18 100644 --- a/lib/merge.js +++ b/lib/merge.js @@ -2,8 +2,8 @@ var NodeGit = require("../"); var normalizeOptions = NodeGit.Utils.normalizeOptions; var Merge = NodeGit.Merge; -var mergeCommits = Merge.commits; -var mergeMerge = Merge.merge; +var _commits = Merge.commits; +var _merge = Merge.merge; /** * Merge 2 commits together and create an new index that can @@ -21,7 +21,7 @@ Merge.commits = function(repo, ourCommit, theirCommit, options) { repo.getCommit(ourCommit), repo.getCommit(theirCommit) ]).then(function(commits) { - return mergeCommits.call(this, repo, commits[0], commits[1], options); + return _commits.call(this, repo, commits[0], commits[1], options); }); }; @@ -42,6 +42,6 @@ Merge.merge = function(repo, theirHead, mergeOpts, checkoutOpts) { // exactly one to have been passed in or it will throw an error... ¯\_(ツ)_/¯ var theirHeads = [theirHead]; - return mergeMerge.call(this, repo, theirHeads, theirHeads.length, + return _merge.call(this, repo, theirHeads, theirHeads.length, mergeOpts, checkoutOpts); }; diff --git a/lib/note.js b/lib/note.js index 4f3ff76bb..8e46427cf 100644 --- a/lib/note.js +++ b/lib/note.js @@ -2,8 +2,9 @@ var NodeGit = require("../"); var Note = NodeGit.Note; +var _foreach = Note.foreach; + // Override Note.foreach to eliminate the need to pass null payload -var foreach = Note.foreach; Note.foreach = function(repo, notesRef, callback) { function wrapperCallback(blobId, objectId) { // We need to copy the OID since libgit2 types are getting cleaned up @@ -12,5 +13,5 @@ Note.foreach = function(repo, notesRef, callback) { return callback(blobId.copy(), objectId.copy()); } - return foreach(repo, notesRef, wrapperCallback, null); + return _foreach(repo, notesRef, wrapperCallback, null); }; diff --git a/lib/odb.js b/lib/odb.js index 85a764928..8bbd15a62 100644 --- a/lib/odb.js +++ b/lib/odb.js @@ -1,10 +1,11 @@ var NodeGit = require("../"); var Odb = NodeGit.Odb; -var read = Odb.prototype.read; + +var _read = Odb.prototype.read; Odb.prototype.read = function(oid, callback) { - return read.call(this, oid).then(function(odbObject) { + return _read.call(this, oid).then(function(odbObject) { if (typeof callback === "function") { callback(null, odbObject); } diff --git a/lib/rebase.js b/lib/rebase.js index 5ea5632c6..22ca72c7d 100644 --- a/lib/rebase.js +++ b/lib/rebase.js @@ -3,6 +3,8 @@ var Rebase = NodeGit.Rebase; var normalizeOptions = NodeGit.Utils.normalizeOptions; var shallowClone = NodeGit.Utils.shallowClone; +var _init = Rebase.init; +var _open = Rebase.open; /** * Initializes a rebase * @async @@ -57,13 +59,12 @@ function defaultRebaseOptions(options, checkoutStrategy) { return options; } - var init = Rebase.init; Rebase.init = function(repository, branch, upstream, onto, options) { options = defaultRebaseOptions( options, NodeGit.Checkout.STRATEGY.FORCE ); - return init(repository, branch, upstream, onto, options); + return _init(repository, branch, upstream, onto, options); }; /** @@ -75,11 +76,10 @@ Rebase.init = function(repository, branch, upstream, onto, options) { * @param {Function} callback * @return {Remote} */ -var rebaseOpen = Rebase.open; Rebase.open = function(repository, options) { options = defaultRebaseOptions( options, NodeGit.Checkout.STRATEGY.SAFE ); - return rebaseOpen(repository, options); + return _open(repository, options); }; diff --git a/lib/remote.js b/lib/remote.js index 93c752494..4cd7e43a4 100644 --- a/lib/remote.js +++ b/lib/remote.js @@ -4,10 +4,10 @@ var lookupWrapper = NodeGit.Utils.lookupWrapper; var shallowClone = NodeGit.Utils.shallowClone; var Remote = NodeGit.Remote; -var connect = Remote.prototype.connect; -var download = Remote.prototype.download; -var fetch = Remote.prototype.fetch; -var push = Remote.prototype.push; +var _connect = Remote.prototype.connect; +var _download = Remote.prototype.download; +var _fetch = Remote.prototype.fetch; +var _push = Remote.prototype.push; /** * Retrieves the remote by name @@ -40,7 +40,7 @@ Remote.prototype.connect = function( proxyOpts = normalizeOptions(proxyOpts || {}, NodeGit.ProxyOptions); customHeaders = customHeaders || []; - return connect.call(this, direction, callbacks, proxyOpts, customHeaders); + return _connect.call(this, direction, callbacks, proxyOpts, customHeaders); }; /** @@ -70,7 +70,7 @@ Remote.prototype.download = function(refspecs, opts) { normalizeOptions(callbacks, NodeGit.RemoteCallbacks); } - return download.call(this, refspecs, opts); + return _download.call(this, refspecs, opts); }; /** @@ -101,7 +101,7 @@ Remote.prototype.fetch = function(refspecs, opts, reflog_message) { normalizeOptions(callbacks, NodeGit.RemoteCallbacks); } - return fetch.call(this, refspecs, opts, reflog_message); + return _fetch.call(this, refspecs, opts, reflog_message); }; /** @@ -130,5 +130,5 @@ Remote.prototype.push = function(refSpecs, opts) { normalizeOptions(callbacks, NodeGit.RemoteCallbacks); } - return push.call(this, refSpecs, opts); + return _push.call(this, refSpecs, opts); }; diff --git a/lib/repository.js b/lib/repository.js index b25757bec..87d000f40 100644 --- a/lib/repository.js +++ b/lib/repository.js @@ -19,6 +19,11 @@ var Tag = NodeGit.Tag; var Tree = NodeGit.Tree; var TreeBuilder = NodeGit.Treebuilder; +var _discover = Repository.discover; +var _initExt = Repository.initExt; +var _fetchheadForeach = Repository.prototype.fetchheadForeach; +var _mergeheadForeach = Repository.prototype.mergeheadForeach; + function applySelectedLinesToTarget (originalContent, newLines, pathHunks, isStaged, reverse) { // 43: ascii code for '+' @@ -230,9 +235,8 @@ function performRebase(repository, rebase, signature, beforeNextFn) { are hit. This may be set to null * @return {String} Path of the git repository */ -var discover = Repository.discover; Repository.discover = function(startPath, acrossFs, ceilingDirs, callback) { - return discover(startPath, acrossFs, ceilingDirs) + return _discover(startPath, acrossFs, ceilingDirs) .then(function(foundPath) { foundPath = path.resolve(foundPath); if (typeof callback === "function") { @@ -243,12 +247,12 @@ Repository.discover = function(startPath, acrossFs, ceilingDirs, callback) { }; // Override Repository.initExt to normalize initoptions -var initExt = Repository.initExt; Repository.initExt = function(repo_path, opts) { opts = normalizeOptions(opts, NodeGit.RepositoryInitOptions); - return initExt(repo_path, opts); + return _initExt(repo_path, opts); }; + Repository.getReferences = function(repo, type, refNamesOnly, callback) { return Reference.list(repo).then(function(refList) { var refFilterPromises = []; @@ -290,7 +294,6 @@ Repository.getReferences = function(repo, type, refNamesOnly, callback) { }); }; - /** * This will set the HEAD to point to the local branch and then attempt * to update the index and working tree to match the content of the @@ -593,9 +596,6 @@ Repository.prototype.createTag = function(oid, name, message, callback) { }); }; - - - /** * Gets the default signature for the default user and now timestamp * @return {Signature} @@ -764,14 +764,13 @@ Repository.prototype.fetchAll = function( }); }; -var fetchheadForeach = Repository.prototype.fetchheadForeach; /** * @async * @param {FetchheadForeachCb} callback The callback function to be called on * each entry */ Repository.prototype.fetchheadForeach = function(callback) { - return fetchheadForeach.call(this, callback, null); + return _fetchheadForeach.call(this, callback, null); }; /** @@ -1466,14 +1465,13 @@ Repository.prototype.mergeBranches = }); }; -var mergeheadForeach = Repository.prototype.mergeheadForeach; /** * @async * @param {MergeheadForeachCb} callback The callback function to be called on * each entry */ Repository.prototype.mergeheadForeach = function(callback) { - return mergeheadForeach.call(this, callback, null); + return _mergeheadForeach.call(this, callback, null); }; /** diff --git a/lib/reset.js b/lib/reset.js index 4bff9c40d..6c5933817 100644 --- a/lib/reset.js +++ b/lib/reset.js @@ -2,6 +2,8 @@ var NodeGit = require("../"); var normalizeOptions = NodeGit.Utils.normalizeOptions; var Reset = NodeGit.Reset; +var _default = Reset.default; +var _reset = Reset.reset; /** * Look up a refs's commit. @@ -14,9 +16,8 @@ var Reset = NodeGit.Reset; * * @return {Number} 0 on success or an error code */ -var defaultFn = Reset.default; Reset.default = function(repo, target, pathspecs) { - return defaultFn.call(this, repo, target, pathspecs); + return _default.call(this, repo, target, pathspecs); }; /** @@ -43,9 +44,8 @@ Reset.default = function(repo, target, pathspecs) { * * @return {Number} 0 on success or an error code */ -var reset = Reset.reset; Reset.reset = function(repo, target, resetType, opts) { opts = normalizeOptions(opts, NodeGit.CheckoutOptions); - return reset.call(this, repo, target, resetType, opts); + return _reset.call(this, repo, target, resetType, opts); }; diff --git a/lib/revert.js b/lib/revert.js index 7efe2507b..aee3f0baf 100644 --- a/lib/revert.js +++ b/lib/revert.js @@ -2,6 +2,7 @@ var NodeGit = require("../"); var normalizeOptions = NodeGit.Utils.normalizeOptions; var Revert = NodeGit.Revert; +var _commit = Revert.commit; /** * Reverts the given commit against the given "our" commit, producing an index @@ -16,7 +17,6 @@ var Revert = NodeGit.Revert; * * @return {Index} the index result */ -var commit = Revert.commit; Revert.commit = function( repo, revert_commit, @@ -28,7 +28,7 @@ Revert.commit = function( { merge_options = normalizeOptions(merge_options, NodeGit.MergeOptions); - return commit.call( + return _commit.call( this, repo, revert_commit, diff --git a/lib/revwalk.js b/lib/revwalk.js index a866c6aff..80205fb22 100644 --- a/lib/revwalk.js +++ b/lib/revwalk.js @@ -5,6 +5,7 @@ Object.defineProperty(Revwalk.prototype, "repo", { get: function () { return this.repository(); } }); +var _sorting = Revwalk.prototype.sorting; /** * @typedef historyEntry * @type {Object} @@ -94,7 +95,6 @@ Revwalk.prototype.getCommitsUntil = function(checkFn) { * * @param {Number} sort */ -var oldSorting = Revwalk.prototype.sorting; Revwalk.prototype.sorting = function() { var sort = 0; @@ -102,7 +102,7 @@ Revwalk.prototype.sorting = function() { sort |= arguments[i]; } - oldSorting.call(this, sort); + _sorting.call(this, sort); }; /** diff --git a/lib/stash.js b/lib/stash.js index c3634b11a..7067b24ce 100644 --- a/lib/stash.js +++ b/lib/stash.js @@ -3,7 +3,10 @@ var normalizeOptions = NodeGit.Utils.normalizeOptions; var shallowClone = NodeGit.Utils.shallowClone; var Stash = NodeGit.Stash; -var sApply = Stash.apply; +var _apply = Stash.apply; +var _foreach = Stash.foreach; +var _pop = Stash.pop; + Stash.apply = function(repo, index, options) { var checkoutOptions; @@ -22,11 +25,10 @@ Stash.apply = function(repo, index, options) { normalizeOptions(checkoutOptions, NodeGit.CheckoutOptions); } - return sApply(repo, index, options); + return _apply(repo, index, options); }; // Override Stash.foreach to eliminate the need to pass null payload -var foreach = Stash.foreach; Stash.foreach = function(repo, callback) { function wrappedCallback(index, message, oid) { // We need to copy the OID since libgit2 types are getting cleaned up @@ -35,10 +37,9 @@ Stash.foreach = function(repo, callback) { return callback(index, message, oid.copy()); } - return foreach(repo, wrappedCallback, null); + return _foreach(repo, wrappedCallback, null); }; -var pop = Stash.pop; Stash.pop = function(repo, index, options) { var checkoutOptions; @@ -57,5 +58,5 @@ Stash.pop = function(repo, index, options) { normalizeOptions(checkoutOptions, NodeGit.CheckoutOptions); } - return pop(repo, index, options); + return _pop(repo, index, options); }; diff --git a/lib/status.js b/lib/status.js index 964569df0..c5c762baa 100644 --- a/lib/status.js +++ b/lib/status.js @@ -3,15 +3,16 @@ var normalizeOptions = NodeGit.Utils.normalizeOptions; var Status = NodeGit.Status; +var _foreach = Status.foreach; +var _foreachExt = Status.foreachExt; + // Override Status.foreach to eliminate the need to pass null payload -var foreach = Status.foreach; Status.foreach = function(repo, callback) { - return foreach(repo, callback, null); + return _foreach(repo, callback, null); }; // Override Status.foreachExt to normalize opts -var foreachExt = Status.foreachExt; Status.foreachExt = function(repo, opts, callback) { opts = normalizeOptions(opts, NodeGit.StatusOptions); - return foreachExt(repo, opts, callback, null); + return _foreachExt(repo, opts, callback, null); }; diff --git a/lib/status_list.js b/lib/status_list.js index e05eede09..efccbad2e 100644 --- a/lib/status_list.js +++ b/lib/status_list.js @@ -3,9 +3,10 @@ var normalizeOptions = NodeGit.Utils.normalizeOptions; var StatusList = NodeGit.StatusList; +var _create = StatusList.create; + // Override StatusList.create to normalize opts -var create = StatusList.create; StatusList.create = function(repo, opts) { opts = normalizeOptions(opts, NodeGit.StatusOptions); - return create(repo, opts); + return _create(repo, opts); }; diff --git a/lib/submodule.js b/lib/submodule.js index 9265f4608..2b0cb530d 100644 --- a/lib/submodule.js +++ b/lib/submodule.js @@ -2,8 +2,9 @@ var NodeGit = require("../"); var Submodule = NodeGit.Submodule; +var _foreach = Submodule.foreach; + // Override Submodule.foreach to eliminate the need to pass null payload -var foreach = Submodule.foreach; Submodule.foreach = function(repo, callback) { - return foreach(repo, callback, null); + return _foreach(repo, callback, null); }; From 550616db01ad5bdcd43710ff67fa2b74dc3d50b3 Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Wed, 10 Aug 2016 10:48:38 -0700 Subject: [PATCH 15/34] make aliases their own functions --- lib/tree_entry.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/tree_entry.js b/lib/tree_entry.js index 3de231b4b..a65d85172 100644 --- a/lib/tree_entry.js +++ b/lib/tree_entry.js @@ -40,13 +40,17 @@ TreeEntry.prototype.getTree = function(callback) { * Is this TreeEntry a blob? Alias for `isFile` * @return {Boolean} */ -TreeEntry.prototype.isBlob = TreeEntry.prototype.isFile; +TreeEntry.prototype.isBlob = function() { + return this.isFile(); +}; /** * Is this TreeEntry a directory? Alias for `isTree` * @return {Boolean} */ -TreeEntry.prototype.isDirectory = TreeEntry.prototype.isTree; +TreeEntry.prototype.isDirectory = function() { + return this.isTree(); +}; /** * Is this TreeEntry a blob? (i.e., a file) @@ -77,7 +81,9 @@ TreeEntry.prototype.isTree = function() { * Retrieve the SHA for this TreeEntry. Alias for `sha` * @return {String} */ -TreeEntry.prototype.oid = TreeEntry.prototype.sha; +TreeEntry.prototype.oid = function() { + return this.sha(); +}; /** * Returns the path for this entry. From 2c5d6d5be7e6243e68634a1548d1926bcc604a18 Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Thu, 11 Aug 2016 15:21:40 -0700 Subject: [PATCH 16/34] use get/setPrivate instead of get/setHiddenValue --- generate/templates/manual/revwalk/fast_walk.cc | 2 +- generate/templates/partials/async_function.cc | 2 +- generate/templates/partials/callback_helpers.cc | 2 +- generate/templates/partials/field_accessors.cc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/generate/templates/manual/revwalk/fast_walk.cc b/generate/templates/manual/revwalk/fast_walk.cc index a7e3c54f3..0e61ab34c 100644 --- a/generate/templates/manual/revwalk/fast_walk.cc +++ b/generate/templates/manual/revwalk/fast_walk.cc @@ -124,7 +124,7 @@ void GitRevwalk::FastWalkWorker::HandleOKCallback() } Local nodeObj = node->ToObject(); - Local checkValue = nodeObj->GetHiddenValue(Nan::New("NodeGitPromiseError").ToLocalChecked()); + Local checkValue = nodeObj->GetPrivate(Nan::New("NodeGitPromiseError").ToLocalChecked()); if (!checkValue.IsEmpty() && !checkValue->IsNull() && !checkValue->IsUndefined()) { diff --git a/generate/templates/partials/async_function.cc b/generate/templates/partials/async_function.cc index edfae89df..5bc3a4cf1 100644 --- a/generate/templates/partials/async_function.cc +++ b/generate/templates/partials/async_function.cc @@ -192,7 +192,7 @@ void {{ cppClassName }}::{{ cppFunctionName }}Worker::HandleOKCallback() { } Local nodeObj = node->ToObject(); - Local checkValue = nodeObj->GetHiddenValue(Nan::New("NodeGitPromiseError").ToLocalChecked()); + Local checkValue = nodeObj->GetPrivate(Nan::New("NodeGitPromiseError").ToLocalChecked()); if (!checkValue.IsEmpty() && !checkValue->IsNull() && !checkValue->IsUndefined()) { Local argv[1] = { diff --git a/generate/templates/partials/callback_helpers.cc b/generate/templates/partials/callback_helpers.cc index f0870f2d1..bb7281a42 100644 --- a/generate/templates/partials/callback_helpers.cc +++ b/generate/templates/partials/callback_helpers.cc @@ -128,7 +128,7 @@ void {{ cppClassName }}::{{ cppFunctionName }}_{{ cbFunction.name }}_promiseComp {% if arg.payload == true %}{{arg.name}}{% elsif arg.lastArg %}{{arg.name}}{% endif %} {% endeach %}); Local parent = instance->handle(); - parent->SetHiddenValue(Nan::New("NodeGitPromiseError").ToLocalChecked(), result); + parent->SetPrivate(Nan::New("NodeGitPromiseError").ToLocalChecked(), result); baton->result = {{ cbFunction.return.error }}; } diff --git a/generate/templates/partials/field_accessors.cc b/generate/templates/partials/field_accessors.cc index 0b3b881d6..ca8a8ee3a 100644 --- a/generate/templates/partials/field_accessors.cc +++ b/generate/templates/partials/field_accessors.cc @@ -249,7 +249,7 @@ {% if arg.payload == true %}{{arg.name}}{% elsif arg.lastArg %}{{arg.name}}{% endif %} {% endeach %}); Local parent = instance->handle(); - parent->SetHiddenValue(Nan::New("NodeGitPromiseError").ToLocalChecked(), result); + parent->SetPrivate(Nan::New("NodeGitPromiseError").ToLocalChecked(), result); baton->result = {{ field.return.error }}; } From 38bcb340bbac946d3a389d3b13ffe1f62f0958b6 Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Thu, 11 Aug 2016 16:12:36 -0700 Subject: [PATCH 17/34] use nan-esque wrapper --- generate/templates/manual/include/nodegit.h | 7 ++++ .../templates/manual/revwalk/fast_walk.cc | 2 +- generate/templates/partials/async_function.cc | 2 +- .../templates/partials/callback_helpers.cc | 2 +- .../templates/partials/field_accessors.cc | 2 +- generate/templates/templates/class_content.cc | 1 + generate/templates/templates/nodegit.cc | 38 +++++++++++++++++++ .../templates/templates/struct_content.cc | 1 + 8 files changed, 51 insertions(+), 4 deletions(-) diff --git a/generate/templates/manual/include/nodegit.h b/generate/templates/manual/include/nodegit.h index 4408b8ea7..a9cef2950 100644 --- a/generate/templates/manual/include/nodegit.h +++ b/generate/templates/manual/include/nodegit.h @@ -5,4 +5,11 @@ extern ThreadPool libgit2ThreadPool; +v8::Local GetPrivate(v8::Local object, + v8::Local key); + +void SetPrivate(v8::Local object, + v8::Local key, + v8::Local value); + #endif diff --git a/generate/templates/manual/revwalk/fast_walk.cc b/generate/templates/manual/revwalk/fast_walk.cc index 0e61ab34c..2f263f83f 100644 --- a/generate/templates/manual/revwalk/fast_walk.cc +++ b/generate/templates/manual/revwalk/fast_walk.cc @@ -124,7 +124,7 @@ void GitRevwalk::FastWalkWorker::HandleOKCallback() } Local nodeObj = node->ToObject(); - Local checkValue = nodeObj->GetPrivate(Nan::New("NodeGitPromiseError").ToLocalChecked()); + Local checkValue = GetPrivate(nodeObj, Nan::New("NodeGitPromiseError").ToLocalChecked()); if (!checkValue.IsEmpty() && !checkValue->IsNull() && !checkValue->IsUndefined()) { diff --git a/generate/templates/partials/async_function.cc b/generate/templates/partials/async_function.cc index 5bc3a4cf1..3d3227d4a 100644 --- a/generate/templates/partials/async_function.cc +++ b/generate/templates/partials/async_function.cc @@ -192,7 +192,7 @@ void {{ cppClassName }}::{{ cppFunctionName }}Worker::HandleOKCallback() { } Local nodeObj = node->ToObject(); - Local checkValue = nodeObj->GetPrivate(Nan::New("NodeGitPromiseError").ToLocalChecked()); + Local checkValue = GetPrivate(nodeObj, Nan::New("NodeGitPromiseError").ToLocalChecked()); if (!checkValue.IsEmpty() && !checkValue->IsNull() && !checkValue->IsUndefined()) { Local argv[1] = { diff --git a/generate/templates/partials/callback_helpers.cc b/generate/templates/partials/callback_helpers.cc index bb7281a42..c4b435787 100644 --- a/generate/templates/partials/callback_helpers.cc +++ b/generate/templates/partials/callback_helpers.cc @@ -128,7 +128,7 @@ void {{ cppClassName }}::{{ cppFunctionName }}_{{ cbFunction.name }}_promiseComp {% if arg.payload == true %}{{arg.name}}{% elsif arg.lastArg %}{{arg.name}}{% endif %} {% endeach %}); Local parent = instance->handle(); - parent->SetPrivate(Nan::New("NodeGitPromiseError").ToLocalChecked(), result); + SetPrivate(parent, Nan::New("NodeGitPromiseError").ToLocalChecked(), result); baton->result = {{ cbFunction.return.error }}; } diff --git a/generate/templates/partials/field_accessors.cc b/generate/templates/partials/field_accessors.cc index ca8a8ee3a..0098d06b4 100644 --- a/generate/templates/partials/field_accessors.cc +++ b/generate/templates/partials/field_accessors.cc @@ -249,7 +249,7 @@ {% if arg.payload == true %}{{arg.name}}{% elsif arg.lastArg %}{{arg.name}}{% endif %} {% endeach %}); Local parent = instance->handle(); - parent->SetPrivate(Nan::New("NodeGitPromiseError").ToLocalChecked(), result); + SetPrivate(parent, Nan::New("NodeGitPromiseError").ToLocalChecked(), result); baton->result = {{ field.return.error }}; } diff --git a/generate/templates/templates/class_content.cc b/generate/templates/templates/class_content.cc index 834361884..a6f2a180e 100644 --- a/generate/templates/templates/class_content.cc +++ b/generate/templates/templates/class_content.cc @@ -8,6 +8,7 @@ extern "C" { {% endeach %} } +#include "../include/nodegit.h" #include "../include/lock_master.h" #include "../include/functions/copy.h" #include "../include/{{ filename }}.h" diff --git a/generate/templates/templates/nodegit.cc b/generate/templates/templates/nodegit.cc index 2cde41c12..23adae3b5 100644 --- a/generate/templates/templates/nodegit.cc +++ b/generate/templates/templates/nodegit.cc @@ -22,6 +22,44 @@ #include "../include/convenient_patch.h" #include "../include/convenient_hunk.h" +#if (NODE_MODULE_VERSION > 48) + v8::Local GetPrivate(v8::Local object, + v8::Local key) { + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Local context = isolate->GetCurrentContext(); + v8::Local privateKey = v8::Private::ForApi(isolate, key); + v8::Local value; + v8::Maybe result = object->HasPrivate(context, privateKey); + if (!(result.IsJust() && result.FromJust())) + return v8::Local(); + if (object->GetPrivate(context, privateKey).ToLocal(&value)) + return value; + return v8::Local(); + } + + void SetPrivate(v8::Local object, + v8::Local key, + v8::Local value) { + if (value.IsEmpty()) + return; + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Local context = isolate->GetCurrentContext(); + v8::Local privateKey = v8::Private::ForApi(isolate, key); + object->SetPrivate(context, privateKey, value); + } +#else + v8::Local GetPrivate(v8::Local object, + v8::Local key) { + return object->GetHiddenValue(key); + } + + void SetPrivate(v8::Local object, + v8::Local key, + v8::Local value) { + object->SetHiddenValue(key, value); + } +#endif + void LockMasterEnable(const FunctionCallbackInfo& info) { LockMaster::Enable(); } diff --git a/generate/templates/templates/struct_content.cc b/generate/templates/templates/struct_content.cc index bc620d582..14b3db242 100644 --- a/generate/templates/templates/struct_content.cc +++ b/generate/templates/templates/struct_content.cc @@ -14,6 +14,7 @@ extern "C" { } #include +#include "../include/nodegit.h" #include "../include/lock_master.h" #include "../include/functions/copy.h" #include "../include/{{ filename }}.h" From 2441feef1e6963447da58f11665c3dfd85c98f46 Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Thu, 11 Aug 2016 16:55:48 -0700 Subject: [PATCH 18/34] Bump --- .../openssl/asm/x64-elf-gas/aes/aes-x86_64.s | 70 +- .../asm/x64-elf-gas/aes/aesni-mb-x86_64.s | 2 +- .../asm/x64-elf-gas/aes/aesni-sha256-x86_64.s | 44 +- .../asm/x64-elf-gas/aes/aesni-x86_64.s | 82 +- .../asm/x64-elf-gas/aes/bsaes-x86_64.s | 158 +- .../asm/x64-elf-gas/aes/vpaes-x86_64.s | 20 +- vendor/openssl/asm/x64-elf-gas/bn/rsaz-avx2.s | 246 ++- .../openssl/asm/x64-elf-gas/bn/rsaz-x86_64.s | 300 +++- .../openssl/asm/x64-elf-gas/bn/x86_64-gf2m.s | 2 +- .../openssl/asm/x64-elf-gas/bn/x86_64-mont.s | 269 +-- .../openssl/asm/x64-elf-gas/bn/x86_64-mont5.s | 1439 +++++++++++----- .../asm/x64-elf-gas/camellia/cmll-x86_64.s | 2 +- .../asm/x64-elf-gas/ec/ecp_nistz256-x86_64.s | 76 +- .../openssl/asm/x64-elf-gas/md5/md5-x86_64.s | 34 +- .../asm/x64-elf-gas/modes/aesni-gcm-x86_64.s | 144 +- .../asm/x64-elf-gas/modes/ghash-x86_64.s | 212 +-- .../asm/x64-elf-gas/sha/sha1-mb-x86_64.s | 4 +- .../asm/x64-elf-gas/sha/sha256-mb-x86_64.s | 68 +- .../asm/x64-elf-gas/sha/sha256-x86_64.s | 44 +- vendor/openssl/asm/x64-elf-gas/x86_64cpuid.s | 48 +- .../asm/x64-macosx-gas/aes/aes-x86_64.s | 70 +- .../asm/x64-macosx-gas/aes/aesni-mb-x86_64.s | 2 +- .../x64-macosx-gas/aes/aesni-sha256-x86_64.s | 44 +- .../asm/x64-macosx-gas/aes/aesni-x86_64.s | 82 +- .../asm/x64-macosx-gas/aes/bsaes-x86_64.s | 158 +- .../asm/x64-macosx-gas/aes/vpaes-x86_64.s | 20 +- .../openssl/asm/x64-macosx-gas/bn/rsaz-avx2.s | 246 ++- .../asm/x64-macosx-gas/bn/rsaz-x86_64.s | 301 +++- .../asm/x64-macosx-gas/bn/x86_64-gf2m.s | 2 +- .../asm/x64-macosx-gas/bn/x86_64-mont.s | 269 +-- .../asm/x64-macosx-gas/bn/x86_64-mont5.s | 1433 +++++++++++----- .../asm/x64-macosx-gas/camellia/cmll-x86_64.s | 2 +- .../x64-macosx-gas/ec/ecp_nistz256-x86_64.s | 76 +- .../asm/x64-macosx-gas/md5/md5-x86_64.s | 34 +- .../x64-macosx-gas/modes/aesni-gcm-x86_64.s | 144 +- .../asm/x64-macosx-gas/modes/ghash-x86_64.s | 212 +-- .../asm/x64-macosx-gas/sha/sha1-mb-x86_64.s | 4 +- .../asm/x64-macosx-gas/sha/sha256-mb-x86_64.s | 68 +- .../asm/x64-macosx-gas/sha/sha256-x86_64.s | 44 +- .../openssl/asm/x64-macosx-gas/x86_64cpuid.s | 48 +- .../asm/x64-win32-masm/bn/rsaz-avx2.asm | 171 +- .../asm/x64-win32-masm/bn/rsaz-x86_64.asm | 353 +++- .../asm/x64-win32-masm/bn/x86_64-mont.asm | 261 ++- .../asm/x64-win32-masm/bn/x86_64-mont5.asm | 1483 ++++++++++++----- .../x64-win32-masm/ec/ecp_nistz256-x86_64.asm | 22 +- .../x64-win32-masm/modes/aesni-gcm-x86_64.asm | 2 +- vendor/openssl/asm/x86-elf-gas/bn/x86-mont.s | 78 +- .../openssl/asm/x86-macosx-gas/bn/x86-mont.s | 84 +- .../asm/x86-win32-masm/bn/x86-mont.asm | 78 +- .../asm_obsolete/x64-elf-gas/aes/aes-x86_64.s | 70 +- .../x64-elf-gas/aes/aesni-x86_64.s | 82 +- .../x64-elf-gas/aes/bsaes-x86_64.s | 158 +- .../x64-elf-gas/aes/vpaes-x86_64.s | 20 +- .../asm_obsolete/x64-elf-gas/bn/rsaz-x86_64.s | 218 ++- .../asm_obsolete/x64-elf-gas/bn/x86_64-gf2m.s | 2 +- .../asm_obsolete/x64-elf-gas/bn/x86_64-mont.s | 139 +- .../x64-elf-gas/bn/x86_64-mont5.s | 942 ++++++++--- .../x64-elf-gas/camellia/cmll-x86_64.s | 2 +- .../x64-elf-gas/ec/ecp_nistz256-x86_64.s | 27 +- .../asm_obsolete/x64-elf-gas/md5/md5-x86_64.s | 34 +- .../x64-elf-gas/modes/ghash-x86_64.s | 34 +- .../x64-elf-gas/sha/sha1-mb-x86_64.s | 4 +- .../x64-elf-gas/sha/sha256-mb-x86_64.s | 68 +- .../x64-elf-gas/sha/sha256-x86_64.s | 44 +- .../asm_obsolete/x64-elf-gas/x86_64cpuid.s | 48 +- .../x64-macosx-gas/aes/aes-x86_64.s | 70 +- .../x64-macosx-gas/aes/aesni-x86_64.s | 82 +- .../x64-macosx-gas/aes/bsaes-x86_64.s | 158 +- .../x64-macosx-gas/aes/vpaes-x86_64.s | 20 +- .../x64-macosx-gas/bn/rsaz-x86_64.s | 219 ++- .../x64-macosx-gas/bn/x86_64-gf2m.s | 2 +- .../x64-macosx-gas/bn/x86_64-mont.s | 139 +- .../x64-macosx-gas/bn/x86_64-mont5.s | 938 ++++++++--- .../x64-macosx-gas/camellia/cmll-x86_64.s | 2 +- .../x64-macosx-gas/ec/ecp_nistz256-x86_64.s | 27 +- .../x64-macosx-gas/md5/md5-x86_64.s | 34 +- .../x64-macosx-gas/modes/ghash-x86_64.s | 34 +- .../x64-macosx-gas/sha/sha1-mb-x86_64.s | 4 +- .../x64-macosx-gas/sha/sha256-mb-x86_64.s | 68 +- .../x64-macosx-gas/sha/sha256-x86_64.s | 44 +- .../asm_obsolete/x64-macosx-gas/x86_64cpuid.s | 48 +- .../x64-win32-masm/bn/rsaz-x86_64.asm | 291 +++- .../x64-win32-masm/bn/x86_64-mont.asm | 139 +- .../x64-win32-masm/bn/x86_64-mont5.asm | 976 ++++++++--- .../x64-win32-masm/ec/ecp_nistz256-x86_64.asm | 11 +- .../asm_obsolete/x86-elf-gas/bn/x86-mont.s | 78 +- .../asm_obsolete/x86-macosx-gas/bn/x86-mont.s | 84 +- .../x86-win32-masm/bn/x86-mont.asm | 78 +- vendor/openssl/config/Makefile | 3 +- .../config/archs/BSD-x86/opensslconf.h | 12 + .../config/archs/BSD-x86_64/opensslconf.h | 12 + .../config/archs/VC-WIN32/opensslconf.h | 12 + .../config/archs/VC-WIN64A/opensslconf.h | 12 + .../config/archs/aix-gcc/opensslconf.h | 12 + .../config/archs/aix64-gcc/opensslconf.h | 12 + .../config/archs/darwin-i386-cc/opensslconf.h | 12 + .../archs/darwin64-x86_64-cc/opensslconf.h | 12 + .../config/archs/linux-aarch64/opensslconf.h | 12 + .../config/archs/linux-armv4/opensslconf.h | 12 + .../config/archs/linux-elf/opensslconf.h | 12 + .../config/archs/linux-ppc/opensslconf.h | 12 + .../config/archs/linux-ppc64/opensslconf.h | 12 + .../config/archs/linux-x32/opensslconf.h | 12 + .../config/archs/linux-x86_64/opensslconf.h | 12 + .../config/archs/linux32-s390x/opensslconf.h | 270 +++ .../config/archs/linux64-s390x/opensslconf.h | 270 +++ .../archs/solaris-x86-gcc/opensslconf.h | 12 + .../archs/solaris64-x86_64-gcc/opensslconf.h | 12 + vendor/openssl/config/opensslconf.h | 8 + vendor/openssl/doc/UPGRADING.md | 235 ++- vendor/openssl/openssl.gyp | 47 +- vendor/openssl/openssl.gypi | 24 +- vendor/openssl/openssl/ACKNOWLEDGMENTS | 32 +- vendor/openssl/openssl/CHANGES | 279 +++- vendor/openssl/openssl/Configure | 41 +- vendor/openssl/openssl/INSTALL | 8 +- vendor/openssl/openssl/LICENSE | 2 +- vendor/openssl/openssl/Makefile | 76 +- vendor/openssl/openssl/Makefile.bak | 102 +- vendor/openssl/openssl/Makefile.org | 38 +- vendor/openssl/openssl/Makefile.shared | 6 +- vendor/openssl/openssl/NEWS | 31 + vendor/openssl/openssl/README | 13 +- vendor/openssl/openssl/apps/CA.pl | 13 +- vendor/openssl/openssl/apps/app_rand.c | 3 + vendor/openssl/openssl/apps/apps.c | 8 +- vendor/openssl/openssl/apps/apps.h | 2 +- vendor/openssl/openssl/apps/engine.c | 2 +- vendor/openssl/openssl/apps/ocsp.c | 2 +- vendor/openssl/openssl/apps/pkcs12.c | 42 +- vendor/openssl/openssl/apps/pkcs7.c | 12 +- vendor/openssl/openssl/apps/pkeyutl.c | 116 +- vendor/openssl/openssl/apps/req.c | 4 +- vendor/openssl/openssl/apps/rsautl.c | 6 +- vendor/openssl/openssl/apps/s_client.c | 4 +- vendor/openssl/openssl/apps/s_server.c | 51 +- vendor/openssl/openssl/apps/speed.c | 2 +- vendor/openssl/openssl/apps/x509.c | 7 +- vendor/openssl/openssl/config | 3 +- vendor/openssl/openssl/crypto/aes/aes.h | 2 +- vendor/openssl/openssl/crypto/aes/aes_cbc.c | 2 +- vendor/openssl/openssl/crypto/aes/aes_cfb.c | 2 +- vendor/openssl/openssl/crypto/aes/aes_core.c | 2 +- vendor/openssl/openssl/crypto/aes/aes_ctr.c | 2 +- vendor/openssl/openssl/crypto/aes/aes_ecb.c | 2 +- vendor/openssl/openssl/crypto/aes/aes_ige.c | 2 +- vendor/openssl/openssl/crypto/aes/aes_locl.h | 2 +- vendor/openssl/openssl/crypto/aes/aes_misc.c | 2 +- vendor/openssl/openssl/crypto/aes/aes_ofb.c | 2 +- .../openssl/openssl/crypto/aes/aes_x86core.c | 2 +- .../openssl/openssl/crypto/aes/asm/aes-ppc.pl | 4 +- .../openssl/crypto/aes/asm/aes-s390x.pl | 29 +- .../openssl/crypto/aes/asm/aesni-mb-x86_64.pl | 2 +- .../crypto/aes/asm/aesni-sha1-x86_64.pl | 2 +- .../crypto/aes/asm/aesni-sha256-x86_64.pl | 2 +- vendor/openssl/openssl/crypto/asn1/a_bytes.c | 4 +- vendor/openssl/openssl/crypto/asn1/a_d2i_fp.c | 36 +- vendor/openssl/openssl/crypto/asn1/a_type.c | 2 - vendor/openssl/openssl/crypto/asn1/asn1_lib.c | 18 +- vendor/openssl/openssl/crypto/asn1/asn1_par.c | 17 +- vendor/openssl/openssl/crypto/asn1/t_x509.c | 3 +- vendor/openssl/openssl/crypto/asn1/tasn_dec.c | 16 +- vendor/openssl/openssl/crypto/asn1/tasn_enc.c | 2 - vendor/openssl/openssl/crypto/asn1/x_name.c | 11 + vendor/openssl/openssl/crypto/asn1/x_x509.c | 16 +- vendor/openssl/openssl/crypto/bio/b_print.c | 187 ++- vendor/openssl/openssl/crypto/bio/bio.h | 10 +- vendor/openssl/openssl/crypto/bio/bss_bio.c | 2 +- vendor/openssl/openssl/crypto/bio/bss_conn.c | 31 +- vendor/openssl/openssl/crypto/bio/bss_dgram.c | 2 - vendor/openssl/openssl/crypto/bio/bss_mem.c | 6 +- vendor/openssl/openssl/crypto/bn/Makefile | 4 +- .../openssl/openssl/crypto/bn/asm/ppc-mont.pl | 10 +- vendor/openssl/openssl/crypto/bn/asm/ppc.pl | 10 +- .../openssl/crypto/bn/asm/ppc64-mont.pl | 12 +- .../openssl/crypto/bn/asm/rsaz-avx2.pl | 219 ++- .../openssl/crypto/bn/asm/rsaz-x86_64.pl | 377 ++++- .../openssl/openssl/crypto/bn/asm/x86-mont.pl | 15 + .../openssl/crypto/bn/asm/x86_64-mont.pl | 271 +-- .../openssl/crypto/bn/asm/x86_64-mont5.pl | 1339 ++++++++------- vendor/openssl/openssl/crypto/bn/bn.h | 14 +- vendor/openssl/openssl/crypto/bn/bn_exp.c | 144 +- vendor/openssl/openssl/crypto/bn/bn_print.c | 17 +- vendor/openssl/openssl/crypto/bn/bn_recp.c | 1 + vendor/openssl/openssl/crypto/bn/exptest.c | 82 +- .../openssl/crypto/camellia/camellia.c | 4 +- .../openssl/crypto/camellia/camellia.h | 2 +- .../openssl/crypto/camellia/cmll_cbc.c | 2 +- .../openssl/crypto/camellia/cmll_cfb.c | 2 +- .../openssl/crypto/camellia/cmll_ctr.c | 2 +- .../openssl/crypto/camellia/cmll_ecb.c | 2 +- .../openssl/crypto/camellia/cmll_locl.h | 2 +- .../openssl/crypto/camellia/cmll_misc.c | 2 +- .../openssl/crypto/camellia/cmll_ofb.c | 2 +- .../openssl/crypto/camellia/cmll_utl.c | 2 +- vendor/openssl/openssl/crypto/cmac/cmac.c | 8 + vendor/openssl/openssl/crypto/comp/comp.h | 4 + vendor/openssl/openssl/crypto/cryptlib.c | 6 +- vendor/openssl/openssl/crypto/crypto.h | 2 +- vendor/openssl/openssl/crypto/des/des_old.c | 2 +- vendor/openssl/openssl/crypto/des/des_old.h | 2 +- vendor/openssl/openssl/crypto/des/des_old2.c | 2 +- vendor/openssl/openssl/crypto/dh/dh.h | 1 + vendor/openssl/openssl/crypto/dh/dh_check.c | 34 +- vendor/openssl/openssl/crypto/dh/dhtest.c | 85 +- vendor/openssl/openssl/crypto/dsa/dsa_ameth.c | 22 +- vendor/openssl/openssl/crypto/dsa/dsa_ossl.c | 8 +- vendor/openssl/openssl/crypto/dso/dso.h | 2 +- vendor/openssl/openssl/crypto/dso/dso_dl.c | 2 +- vendor/openssl/openssl/crypto/dso/dso_dlfcn.c | 2 +- vendor/openssl/openssl/crypto/dso/dso_lib.c | 3 +- vendor/openssl/openssl/crypto/dso/dso_vms.c | 2 +- vendor/openssl/openssl/crypto/dso/dso_win32.c | 2 +- .../crypto/ec/asm/ecp_nistz256-x86_64.pl | 13 +- vendor/openssl/openssl/crypto/ec/ec2_smpl.c | 1 + vendor/openssl/openssl/crypto/ec/ec_key.c | 2 + .../openssl/openssl/crypto/ec/ecp_nistp224.c | 4 +- .../openssl/openssl/crypto/ec/ecp_nistp256.c | 4 +- .../openssl/openssl/crypto/ec/ecp_nistp521.c | 4 +- .../openssl/crypto/ec/ecp_nistz256_table.c | 2 +- vendor/openssl/openssl/crypto/ec/ectest.c | 11 +- .../openssl/openssl/crypto/engine/eng_all.c | 2 +- .../openssl/openssl/crypto/engine/eng_dyn.c | 4 +- vendor/openssl/openssl/crypto/evp/Makefile | 13 +- vendor/openssl/openssl/crypto/evp/digest.c | 4 +- .../openssl/crypto/evp/e_aes_cbc_hmac_sha1.c | 3 + .../crypto/evp/e_aes_cbc_hmac_sha256.c | 3 + .../openssl/openssl/crypto/evp/e_camellia.c | 2 +- vendor/openssl/openssl/crypto/evp/e_des.c | 11 +- vendor/openssl/openssl/crypto/evp/e_des3.c | 13 +- vendor/openssl/openssl/crypto/evp/e_old.c | 2 +- vendor/openssl/openssl/crypto/evp/e_seed.c | 2 +- vendor/openssl/openssl/crypto/evp/encode.c | 12 +- vendor/openssl/openssl/crypto/evp/evp_enc.c | 2 +- vendor/openssl/openssl/crypto/mem_clr.c | 2 +- .../crypto/modes/asm/aesni-gcm-x86_64.pl | 6 +- .../openssl/crypto/modes/asm/ghash-s390x.pl | 4 +- .../openssl/crypto/modes/asm/ghash-x86_64.pl | 4 +- vendor/openssl/openssl/crypto/modes/ctr128.c | 41 +- vendor/openssl/openssl/crypto/o_dir.c | 2 +- vendor/openssl/openssl/crypto/o_dir.h | 2 +- vendor/openssl/openssl/crypto/o_dir_test.c | 2 +- vendor/openssl/openssl/crypto/o_str.c | 2 +- vendor/openssl/openssl/crypto/o_str.h | 2 +- vendor/openssl/openssl/crypto/o_time.c | 2 +- vendor/openssl/openssl/crypto/o_time.h | 2 +- vendor/openssl/openssl/crypto/opensslv.h | 6 +- vendor/openssl/openssl/crypto/pem/pem_lib.c | 2 +- vendor/openssl/openssl/crypto/pem/pvkfmt.c | 7 + .../openssl/crypto/perlasm/x86_64-xlate.pl | 9 +- .../openssl/openssl/crypto/pkcs7/pk7_smime.c | 17 + vendor/openssl/openssl/crypto/rand/rand_vms.c | 2 +- vendor/openssl/openssl/crypto/rc4/rc4_utl.c | 2 +- vendor/openssl/openssl/crypto/rsa/rsa_chk.c | 2 +- vendor/openssl/openssl/crypto/s390xcpuid.S | 44 +- vendor/openssl/openssl/crypto/seed/seed_cbc.c | 2 +- vendor/openssl/openssl/crypto/seed/seed_cfb.c | 2 +- vendor/openssl/openssl/crypto/seed/seed_ecb.c | 2 +- vendor/openssl/openssl/crypto/seed/seed_ofb.c | 2 +- .../openssl/crypto/sha/asm/sha1-mb-x86_64.pl | 2 +- .../openssl/crypto/sha/asm/sha1-ppc.pl | 6 +- .../openssl/crypto/sha/asm/sha1-s390x.pl | 7 +- .../openssl/crypto/sha/asm/sha1-x86_64.pl | 2 +- .../crypto/sha/asm/sha256-mb-x86_64.pl | 2 +- .../openssl/crypto/sha/asm/sha512-ppc.pl | 8 +- .../openssl/crypto/sha/asm/sha512-s390x.pl | 7 +- .../openssl/crypto/sha/asm/sha512-x86_64.pl | 2 +- vendor/openssl/openssl/crypto/sha/sha1test.c | 2 +- vendor/openssl/openssl/crypto/srp/srp.h | 10 + vendor/openssl/openssl/crypto/srp/srp_vfy.c | 57 +- vendor/openssl/openssl/crypto/stack/stack.c | 2 +- vendor/openssl/openssl/crypto/store/store.h | 2 +- vendor/openssl/openssl/crypto/store/str_lib.c | 2 +- .../openssl/openssl/crypto/store/str_locl.h | 2 +- vendor/openssl/openssl/crypto/store/str_mem.c | 2 +- .../openssl/openssl/crypto/store/str_meth.c | 2 +- .../openssl/openssl/crypto/ts/ts_rsp_verify.c | 3 +- vendor/openssl/openssl/crypto/ui/ui.h | 2 +- vendor/openssl/openssl/crypto/ui/ui_compat.c | 2 +- vendor/openssl/openssl/crypto/ui/ui_compat.h | 2 +- vendor/openssl/openssl/crypto/ui/ui_lib.c | 2 +- vendor/openssl/openssl/crypto/ui/ui_locl.h | 2 +- vendor/openssl/openssl/crypto/ui/ui_openssl.c | 2 +- vendor/openssl/openssl/crypto/ui/ui_util.c | 2 +- vendor/openssl/openssl/crypto/x509/x509.h | 1 + vendor/openssl/openssl/crypto/x509/x509_err.c | 1 + vendor/openssl/openssl/crypto/x509/x509_obj.c | 26 +- vendor/openssl/openssl/crypto/x509/x509_vfy.c | 109 +- vendor/openssl/openssl/crypto/x509/x509_vfy.h | 2 +- vendor/openssl/openssl/crypto/x509/x509_vpm.c | 4 +- vendor/openssl/openssl/crypto/x509v3/v3_pci.c | 2 +- .../openssl/openssl/crypto/x509v3/v3_pcia.c | 2 +- vendor/openssl/openssl/crypto/x509v3/v3_utl.c | 3 +- .../openssl/crypto/x509v3/v3nametest.c | 10 + .../openssl/openssl/demos/easy_tls/easy-tls.c | 2 +- .../openssl/openssl/demos/easy_tls/easy-tls.h | 2 +- vendor/openssl/openssl/demos/tunala/tunala.c | 2 +- vendor/openssl/openssl/doc/apps/ciphers.pod | 59 +- vendor/openssl/openssl/doc/apps/ocsp.pod | 2 +- vendor/openssl/openssl/doc/apps/pkeyutl.pod | 13 + vendor/openssl/openssl/doc/apps/req.pod | 9 +- vendor/openssl/openssl/doc/apps/s_client.pod | 12 +- vendor/openssl/openssl/doc/apps/s_server.pod | 8 +- vendor/openssl/openssl/doc/apps/s_time.pod | 4 +- .../openssl/doc/crypto/BIO_s_connect.pod | 4 +- .../openssl/openssl/doc/crypto/BIO_s_mem.pod | 4 +- .../openssl/doc/crypto/EVP_EncodeInit.pod | 127 ++ vendor/openssl/openssl/doc/crypto/evp.pod | 5 + .../openssl/openssl/doc/ssl/SSL_CONF_cmd.pod | 33 +- .../openssl/openssl/doc/ssl/SSL_CTX_new.pod | 168 +- .../ssl/SSL_CTX_set1_verify_cert_store.pod | 8 +- .../doc/ssl/SSL_CTX_set_alpn_select_cb.pod | 126 ++ .../openssl/doc/ssl/SSL_CTX_set_options.pod | 10 + .../doc/ssl/SSL_CTX_set_tlsext_status_cb.pod | 73 + .../doc/ssl/SSL_CTX_set_tmp_dh_callback.pod | 29 +- .../doc/ssl/SSL_CTX_use_serverinfo.pod | 8 + vendor/openssl/openssl/doc/ssl/ssl.pod | 77 +- vendor/openssl/openssl/engines/e_capi.c | 32 + vendor/openssl/openssl/engines/e_chil.c | 2 +- vendor/openssl/openssl/include/openssl/aes.h | 2 +- vendor/openssl/openssl/include/openssl/bio.h | 10 +- vendor/openssl/openssl/include/openssl/bn.h | 14 +- .../openssl/include/openssl/camellia.h | 2 +- vendor/openssl/openssl/include/openssl/comp.h | 4 + .../openssl/openssl/include/openssl/crypto.h | 2 +- .../openssl/openssl/include/openssl/des_old.h | 2 +- vendor/openssl/openssl/include/openssl/dh.h | 1 + vendor/openssl/openssl/include/openssl/dso.h | 2 +- vendor/openssl/openssl/include/openssl/kssl.h | 2 +- .../openssl/include/openssl/opensslv.h | 6 +- vendor/openssl/openssl/include/openssl/srp.h | 10 + vendor/openssl/openssl/include/openssl/ssl.h | 9 +- vendor/openssl/openssl/include/openssl/ui.h | 2 +- .../openssl/include/openssl/ui_compat.h | 2 +- vendor/openssl/openssl/include/openssl/x509.h | 1 + .../openssl/include/openssl/x509_vfy.h | 2 +- vendor/openssl/openssl/ms/uplink-x86.pl | 4 +- vendor/openssl/openssl/openssl.spec | 2 +- vendor/openssl/openssl/ssl/Makefile | 69 +- vendor/openssl/openssl/ssl/d1_both.c | 72 +- vendor/openssl/openssl/ssl/kssl.c | 2 +- vendor/openssl/openssl/ssl/kssl.h | 2 +- vendor/openssl/openssl/ssl/kssl_lcl.h | 2 +- vendor/openssl/openssl/ssl/s2_lib.c | 22 +- vendor/openssl/openssl/ssl/s2_meth.c | 14 +- vendor/openssl/openssl/ssl/s2_srvr.c | 20 +- vendor/openssl/openssl/ssl/s3_clnt.c | 65 +- vendor/openssl/openssl/ssl/s3_lib.c | 161 +- vendor/openssl/openssl/ssl/s3_srvr.c | 25 +- vendor/openssl/openssl/ssl/ssl.h | 9 +- vendor/openssl/openssl/ssl/ssl_cert.c | 11 +- vendor/openssl/openssl/ssl/ssl_ciph.c | 16 +- vendor/openssl/openssl/ssl/ssl_conf.c | 10 +- vendor/openssl/openssl/ssl/ssl_err.c | 1 + vendor/openssl/openssl/ssl/ssl_lib.c | 34 +- vendor/openssl/openssl/ssl/ssl_locl.h | 7 +- vendor/openssl/openssl/ssl/ssl_rsa.c | 28 +- vendor/openssl/openssl/ssl/ssl_sess.c | 3 - vendor/openssl/openssl/ssl/ssltest.c | 181 +- vendor/openssl/openssl/ssl/sslv2conftest.c | 231 +++ vendor/openssl/openssl/ssl/t1_enc.c | 2 +- vendor/openssl/openssl/ssl/t1_lib.c | 116 +- vendor/openssl/openssl/test/Makefile | 35 +- vendor/openssl/openssl/test/bctest | 111 ++ vendor/openssl/openssl/test/evptests.txt | 86 +- vendor/openssl/openssl/test/igetest.c | 2 +- vendor/openssl/openssl/test/testfipsssl | 8 +- vendor/openssl/openssl/test/testssl | 19 + vendor/openssl/openssl/tools/c_rehash | 3 +- vendor/openssl/openssl/util/domd | 4 +- vendor/openssl/openssl/util/libeay.num | 20 +- vendor/openssl/openssl/util/mk1mf.pl | 13 +- vendor/openssl/openssl/util/mkdef.pl | 6 +- vendor/openssl/openssl/util/pl/BC-32.pl | 4 +- vendor/openssl/openssl/util/pl/Mingw32.pl | 2 +- vendor/openssl/openssl/util/pl/OS2-EMX.pl | 4 +- vendor/openssl/openssl/util/pl/VC-32.pl | 18 +- vendor/openssl/openssl/util/pl/linux.pl | 2 +- vendor/openssl/openssl/util/pl/netware.pl | 8 +- vendor/openssl/openssl/util/pl/ultrix.pl | 2 +- vendor/openssl/openssl/util/pl/unix.pl | 2 +- vendor/openssl/openssl/util/pod2mantest | 58 + vendor/openssl/openssl/util/shlib_wrap.sh | 9 + vendor/openssl/openssl/util/ssleay.num | 6 +- 384 files changed, 15500 insertions(+), 7110 deletions(-) create mode 100755 vendor/openssl/config/archs/linux32-s390x/opensslconf.h create mode 100755 vendor/openssl/config/archs/linux64-s390x/opensslconf.h create mode 100755 vendor/openssl/openssl/doc/crypto/EVP_EncodeInit.pod create mode 100755 vendor/openssl/openssl/doc/ssl/SSL_CTX_set_alpn_select_cb.pod create mode 100755 vendor/openssl/openssl/doc/ssl/SSL_CTX_set_tlsext_status_cb.pod create mode 100755 vendor/openssl/openssl/ssl/sslv2conftest.c create mode 100755 vendor/openssl/openssl/test/bctest create mode 100755 vendor/openssl/openssl/util/pod2mantest diff --git a/vendor/openssl/asm/x64-elf-gas/aes/aes-x86_64.s b/vendor/openssl/asm/x64-elf-gas/aes/aes-x86_64.s index 0bdfe91fc..c21cce10f 100644 --- a/vendor/openssl/asm/x64-elf-gas/aes/aes-x86_64.s +++ b/vendor/openssl/asm/x64-elf-gas/aes/aes-x86_64.s @@ -81,8 +81,8 @@ _x86_64_AES_encrypt: movl 0(%r14,%rdi,8),%edi movl 0(%r14,%rbp,8),%ebp - andl $65280,%edi - andl $65280,%ebp + andl $0x0000ff00,%edi + andl $0x0000ff00,%ebp xorl %edi,%r10d xorl %ebp,%r11d @@ -94,8 +94,8 @@ _x86_64_AES_encrypt: movl 0(%r14,%rsi,8),%esi movl 0(%r14,%rdi,8),%edi - andl $65280,%esi - andl $65280,%edi + andl $0x0000ff00,%esi + andl $0x0000ff00,%edi shrl $16,%ebx xorl %esi,%r12d xorl %edi,%r8d @@ -108,9 +108,9 @@ _x86_64_AES_encrypt: movl 0(%r14,%rdi,8),%edi movl 0(%r14,%rbp,8),%ebp - andl $16711680,%esi - andl $16711680,%edi - andl $16711680,%ebp + andl $0x00ff0000,%esi + andl $0x00ff0000,%edi + andl $0x00ff0000,%ebp xorl %esi,%r10d xorl %edi,%r11d @@ -123,9 +123,9 @@ _x86_64_AES_encrypt: movl 2(%r14,%rdi,8),%edi movl 2(%r14,%rbp,8),%ebp - andl $16711680,%esi - andl $4278190080,%edi - andl $4278190080,%ebp + andl $0x00ff0000,%esi + andl $0xff000000,%edi + andl $0xff000000,%ebp xorl %esi,%r8d xorl %edi,%r10d @@ -138,8 +138,8 @@ _x86_64_AES_encrypt: movl 2(%r14,%rdi,8),%edi movl 16+0(%r15),%eax - andl $4278190080,%esi - andl $4278190080,%edi + andl $0xff000000,%esi + andl $0xff000000,%edi xorl %esi,%r12d xorl %edi,%r8d @@ -241,8 +241,8 @@ _x86_64_AES_encrypt_compact: xorl %r8d,%edx cmpq 16(%rsp),%r15 je .Lenc_compact_done - movl $2155905152,%r10d - movl $2155905152,%r11d + movl $0x80808080,%r10d + movl $0x80808080,%r11d andl %eax,%r10d andl %ebx,%r11d movl %r10d,%esi @@ -253,10 +253,10 @@ _x86_64_AES_encrypt_compact: leal (%rbx,%rbx,1),%r9d subl %r10d,%esi subl %r11d,%edi - andl $4278124286,%r8d - andl $4278124286,%r9d - andl $454761243,%esi - andl $454761243,%edi + andl $0xfefefefe,%r8d + andl $0xfefefefe,%r9d + andl $0x1b1b1b1b,%esi + andl $0x1b1b1b1b,%edi movl %eax,%r10d movl %ebx,%r11d xorl %esi,%r8d @@ -264,9 +264,9 @@ _x86_64_AES_encrypt_compact: xorl %r8d,%eax xorl %r9d,%ebx - movl $2155905152,%r12d + movl $0x80808080,%r12d roll $24,%eax - movl $2155905152,%ebp + movl $0x80808080,%ebp roll $24,%ebx andl %ecx,%r12d andl %edx,%ebp @@ -289,10 +289,10 @@ _x86_64_AES_encrypt_compact: xorl %r10d,%eax xorl %r11d,%ebx - andl $4278124286,%r8d - andl $4278124286,%r9d - andl $454761243,%esi - andl $454761243,%edi + andl $0xfefefefe,%r8d + andl $0xfefefefe,%r9d + andl $0x1b1b1b1b,%esi + andl $0x1b1b1b1b,%edi movl %ecx,%r12d movl %edx,%ebp xorl %esi,%r8d @@ -345,7 +345,7 @@ AES_encrypt: andq $-64,%rsp subq %rsp,%rcx negq %rcx - andq $960,%rcx + andq $0x3c0,%rcx subq %rcx,%rsp subq $32,%rsp @@ -370,7 +370,7 @@ AES_encrypt: leaq .LAES_Te+2048(%rip),%r14 leaq 768(%rsp),%rbp subq %r14,%rbp - andq $768,%rbp + andq $0x300,%rbp leaq (%r14,%rbp,1),%r14 call _x86_64_AES_encrypt_compact @@ -792,7 +792,7 @@ AES_decrypt: andq $-64,%rsp subq %rsp,%rcx negq %rcx - andq $960,%rcx + andq $0x3c0,%rcx subq %rcx,%rsp subq $32,%rsp @@ -817,7 +817,7 @@ AES_decrypt: leaq .LAES_Td+2048(%rip),%r14 leaq 768(%rsp),%rbp subq %r14,%rbp - andq $768,%rbp + andq $0x300,%rbp leaq (%r14,%rbp,1),%r14 shrq $3,%rbp addq %rbp,%r14 @@ -1333,9 +1333,9 @@ AES_cbc_encrypt: movq %r14,%r10 leaq 2304(%r14),%r11 movq %r15,%r12 - andq $4095,%r10 - andq $4095,%r11 - andq $4095,%r12 + andq $0xFFF,%r10 + andq $0xFFF,%r11 + andq $0xFFF,%r12 cmpq %r11,%r12 jb .Lcbc_te_break_out @@ -1344,7 +1344,7 @@ AES_cbc_encrypt: jmp .Lcbc_te_ok .Lcbc_te_break_out: subq %r10,%r12 - andq $4095,%r12 + andq $0xFFF,%r12 addq $320,%r12 subq %r12,%r15 .align 4 @@ -1370,7 +1370,7 @@ AES_cbc_encrypt: movq %r15,%r10 subq %r14,%r10 - andq $4095,%r10 + andq $0xfff,%r10 cmpq $2304,%r10 jb .Lcbc_do_ecopy cmpq $4096-248,%r10 @@ -1557,7 +1557,7 @@ AES_cbc_encrypt: leaq -88-63(%rcx),%r10 subq %rbp,%r10 negq %r10 - andq $960,%r10 + andq $0x3c0,%r10 subq %r10,%rbp xchgq %rsp,%rbp @@ -1586,7 +1586,7 @@ AES_cbc_encrypt: leaq 2048(%r14),%r14 leaq 768-8(%rsp),%rax subq %r14,%rax - andq $768,%rax + andq $0x300,%rax leaq (%r14,%rax,1),%r14 cmpq $0,%rbx diff --git a/vendor/openssl/asm/x64-elf-gas/aes/aesni-mb-x86_64.s b/vendor/openssl/asm/x64-elf-gas/aes/aesni-mb-x86_64.s index 543b58831..d49379783 100644 --- a/vendor/openssl/asm/x64-elf-gas/aes/aesni-mb-x86_64.s +++ b/vendor/openssl/asm/x64-elf-gas/aes/aesni-mb-x86_64.s @@ -1120,7 +1120,7 @@ _avx_cbc_dec_shortcut: vpxor %xmm15,%xmm8,%xmm8 vmovdqu %xmm9,112(%rbp) vpxor %xmm15,%xmm9,%xmm9 - xorq $128,%rbp + xorq $0x80,%rbp movl $1,%ecx jmp .Loop_dec8x diff --git a/vendor/openssl/asm/x64-elf-gas/aes/aesni-sha256-x86_64.s b/vendor/openssl/asm/x64-elf-gas/aes/aesni-sha256-x86_64.s index 3df7f1bf5..139ebe361 100644 --- a/vendor/openssl/asm/x64-elf-gas/aes/aesni-sha256-x86_64.s +++ b/vendor/openssl/asm/x64-elf-gas/aes/aesni-sha256-x86_64.s @@ -4015,9 +4015,9 @@ aesni_cbc_sha256_enc_shaext: movups 16(%rcx),%xmm4 leaq 112(%rcx),%rcx - pshufd $27,%xmm1,%xmm0 - pshufd $177,%xmm1,%xmm1 - pshufd $27,%xmm2,%xmm2 + pshufd $0x1b,%xmm1,%xmm0 + pshufd $0xb1,%xmm1,%xmm1 + pshufd $0x1b,%xmm2,%xmm2 movdqa %xmm3,%xmm7 .byte 102,15,58,15,202,8 punpcklqdq %xmm0,%xmm2 @@ -4043,7 +4043,7 @@ aesni_cbc_sha256_enc_shaext: movups -80(%rcx),%xmm5 aesenc %xmm4,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movups -64(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,202 @@ -4055,7 +4055,7 @@ aesni_cbc_sha256_enc_shaext: movups -48(%rcx),%xmm5 aesenc %xmm4,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movups -32(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,202 @@ -4067,7 +4067,7 @@ aesni_cbc_sha256_enc_shaext: movups -16(%rcx),%xmm5 aesenc %xmm4,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm13,%xmm3 .byte 102,65,15,58,15,220,4 paddd %xmm3,%xmm10 @@ -4082,7 +4082,7 @@ aesni_cbc_sha256_enc_shaext: movups 16(%rcx),%xmm5 aesenc %xmm4,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movups 32(%rcx),%xmm4 aesenc %xmm5,%xmm6 movdqa %xmm10,%xmm3 @@ -4096,7 +4096,7 @@ aesni_cbc_sha256_enc_shaext: movups 48(%rcx),%xmm5 aesenc %xmm4,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 paddd %xmm3,%xmm12 @@ -4129,7 +4129,7 @@ aesni_cbc_sha256_enc_shaext: movups -64(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm12,%xmm3 .byte 102,65,15,58,15,219,4 paddd %xmm3,%xmm13 @@ -4143,7 +4143,7 @@ aesni_cbc_sha256_enc_shaext: movups -32(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm13,%xmm3 .byte 102,65,15,58,15,220,4 paddd %xmm3,%xmm10 @@ -4157,7 +4157,7 @@ aesni_cbc_sha256_enc_shaext: movups 0(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm10,%xmm3 .byte 102,65,15,58,15,221,4 paddd %xmm3,%xmm11 @@ -4171,7 +4171,7 @@ aesni_cbc_sha256_enc_shaext: movups 32(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 paddd %xmm3,%xmm12 @@ -4206,7 +4206,7 @@ aesni_cbc_sha256_enc_shaext: movups -64(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm12,%xmm3 .byte 102,65,15,58,15,219,4 paddd %xmm3,%xmm13 @@ -4220,7 +4220,7 @@ aesni_cbc_sha256_enc_shaext: movups -32(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm13,%xmm3 .byte 102,65,15,58,15,220,4 paddd %xmm3,%xmm10 @@ -4234,7 +4234,7 @@ aesni_cbc_sha256_enc_shaext: movups 0(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm10,%xmm3 .byte 102,65,15,58,15,221,4 paddd %xmm3,%xmm11 @@ -4248,7 +4248,7 @@ aesni_cbc_sha256_enc_shaext: movups 32(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 paddd %xmm3,%xmm12 @@ -4275,7 +4275,7 @@ aesni_cbc_sha256_enc_shaext: movups 16-112(%rcx),%xmm4 nop .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm12,%xmm3 .byte 102,65,15,58,15,219,4 paddd %xmm3,%xmm13 @@ -4296,7 +4296,7 @@ aesni_cbc_sha256_enc_shaext: movups -48(%rcx),%xmm5 aesenc %xmm4,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movups -32(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,202 @@ -4308,7 +4308,7 @@ aesni_cbc_sha256_enc_shaext: movups 0(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movups 16(%rcx),%xmm5 aesenc %xmm4,%xmm6 .byte 15,56,203,202 @@ -4341,9 +4341,9 @@ aesni_cbc_sha256_enc_shaext: leaq 64(%rdi),%rdi jnz .Loop_shaext - pshufd $177,%xmm2,%xmm2 - pshufd $27,%xmm1,%xmm3 - pshufd $177,%xmm1,%xmm1 + pshufd $0xb1,%xmm2,%xmm2 + pshufd $0x1b,%xmm1,%xmm3 + pshufd $0xb1,%xmm1,%xmm1 punpckhqdq %xmm2,%xmm1 .byte 102,15,58,15,211,8 diff --git a/vendor/openssl/asm/x64-elf-gas/aes/aesni-x86_64.s b/vendor/openssl/asm/x64-elf-gas/aes/aesni-x86_64.s index 6573fe4be..2317f0e55 100644 --- a/vendor/openssl/asm/x64-elf-gas/aes/aesni-x86_64.s +++ b/vendor/openssl/asm/x64-elf-gas/aes/aesni-x86_64.s @@ -503,7 +503,7 @@ aesni_ecb_encrypt: testl %r8d,%r8d jz .Lecb_decrypt - cmpq $128,%rdx + cmpq $0x80,%rdx jb .Lecb_enc_tail movdqu (%rdi),%xmm2 @@ -515,7 +515,7 @@ aesni_ecb_encrypt: movdqu 96(%rdi),%xmm8 movdqu 112(%rdi),%xmm9 leaq 128(%rdi),%rdi - subq $128,%rdx + subq $0x80,%rdx jmp .Lecb_enc_loop8_enter .align 16 .Lecb_enc_loop8: @@ -543,7 +543,7 @@ aesni_ecb_encrypt: call _aesni_encrypt8 - subq $128,%rdx + subq $0x80,%rdx jnc .Lecb_enc_loop8 movups %xmm2,(%rsi) @@ -557,22 +557,22 @@ aesni_ecb_encrypt: movups %xmm8,96(%rsi) movups %xmm9,112(%rsi) leaq 128(%rsi),%rsi - addq $128,%rdx + addq $0x80,%rdx jz .Lecb_ret .Lecb_enc_tail: movups (%rdi),%xmm2 - cmpq $32,%rdx + cmpq $0x20,%rdx jb .Lecb_enc_one movups 16(%rdi),%xmm3 je .Lecb_enc_two movups 32(%rdi),%xmm4 - cmpq $64,%rdx + cmpq $0x40,%rdx jb .Lecb_enc_three movups 48(%rdi),%xmm5 je .Lecb_enc_four movups 64(%rdi),%xmm6 - cmpq $96,%rdx + cmpq $0x60,%rdx jb .Lecb_enc_five movups 80(%rdi),%xmm7 je .Lecb_enc_six @@ -646,7 +646,7 @@ aesni_ecb_encrypt: .align 16 .Lecb_decrypt: - cmpq $128,%rdx + cmpq $0x80,%rdx jb .Lecb_dec_tail movdqu (%rdi),%xmm2 @@ -658,7 +658,7 @@ aesni_ecb_encrypt: movdqu 96(%rdi),%xmm8 movdqu 112(%rdi),%xmm9 leaq 128(%rdi),%rdi - subq $128,%rdx + subq $0x80,%rdx jmp .Lecb_dec_loop8_enter .align 16 .Lecb_dec_loop8: @@ -687,7 +687,7 @@ aesni_ecb_encrypt: call _aesni_decrypt8 movups (%r11),%xmm0 - subq $128,%rdx + subq $0x80,%rdx jnc .Lecb_dec_loop8 movups %xmm2,(%rsi) @@ -709,22 +709,22 @@ aesni_ecb_encrypt: movups %xmm9,112(%rsi) pxor %xmm9,%xmm9 leaq 128(%rsi),%rsi - addq $128,%rdx + addq $0x80,%rdx jz .Lecb_ret .Lecb_dec_tail: movups (%rdi),%xmm2 - cmpq $32,%rdx + cmpq $0x20,%rdx jb .Lecb_dec_one movups 16(%rdi),%xmm3 je .Lecb_dec_two movups 32(%rdi),%xmm4 - cmpq $64,%rdx + cmpq $0x40,%rdx jb .Lecb_dec_three movups 48(%rdi),%xmm5 je .Lecb_dec_four movups 64(%rdi),%xmm6 - cmpq $96,%rdx + cmpq $0x60,%rdx jb .Lecb_dec_five movups 80(%rdi),%xmm7 je .Lecb_dec_six @@ -1598,7 +1598,7 @@ aesni_xts_encrypt: movdqa .Lxts_magic(%rip),%xmm8 movdqa %xmm2,%xmm15 - pshufd $95,%xmm2,%xmm9 + pshufd $0x5f,%xmm2,%xmm9 pxor %xmm0,%xmm1 movdqa %xmm9,%xmm14 paddd %xmm9,%xmm9 @@ -1697,7 +1697,7 @@ aesni_xts_encrypt: .byte 102,15,56,220,248 movups 64(%r11),%xmm0 movdqa %xmm8,80(%rsp) - pshufd $95,%xmm15,%xmm9 + pshufd $0x5f,%xmm15,%xmm9 jmp .Lxts_enc_loop6 .align 32 .Lxts_enc_loop6: @@ -1836,13 +1836,13 @@ aesni_xts_encrypt: jz .Lxts_enc_done pxor %xmm0,%xmm11 - cmpq $32,%rdx + cmpq $0x20,%rdx jb .Lxts_enc_one pxor %xmm0,%xmm12 je .Lxts_enc_two pxor %xmm0,%xmm13 - cmpq $64,%rdx + cmpq $0x40,%rdx jb .Lxts_enc_three pxor %xmm0,%xmm14 je .Lxts_enc_four @@ -2069,7 +2069,7 @@ aesni_xts_decrypt: movdqa .Lxts_magic(%rip),%xmm8 movdqa %xmm2,%xmm15 - pshufd $95,%xmm2,%xmm9 + pshufd $0x5f,%xmm2,%xmm9 pxor %xmm0,%xmm1 movdqa %xmm9,%xmm14 paddd %xmm9,%xmm9 @@ -2168,7 +2168,7 @@ aesni_xts_decrypt: .byte 102,15,56,222,248 movups 64(%r11),%xmm0 movdqa %xmm8,80(%rsp) - pshufd $95,%xmm15,%xmm9 + pshufd $0x5f,%xmm15,%xmm9 jmp .Lxts_dec_loop6 .align 32 .Lxts_dec_loop6: @@ -2308,13 +2308,13 @@ aesni_xts_decrypt: jz .Lxts_dec_done pxor %xmm0,%xmm12 - cmpq $32,%rdx + cmpq $0x20,%rdx jb .Lxts_dec_one pxor %xmm0,%xmm13 je .Lxts_dec_two pxor %xmm0,%xmm14 - cmpq $64,%rdx + cmpq $0x40,%rdx jb .Lxts_dec_three je .Lxts_dec_four @@ -2345,7 +2345,7 @@ aesni_xts_decrypt: pcmpgtd %xmm15,%xmm14 movdqu %xmm6,64(%rsi) leaq 80(%rsi),%rsi - pshufd $19,%xmm14,%xmm11 + pshufd $0x13,%xmm14,%xmm11 andq $15,%r9 jz .Lxts_dec_ret @@ -2634,7 +2634,7 @@ aesni_cbc_encrypt: leaq -8(%rax),%rbp movups (%r8),%xmm10 movl %r10d,%eax - cmpq $80,%rdx + cmpq $0x50,%rdx jbe .Lcbc_dec_tail movups (%rcx),%xmm0 @@ -2650,14 +2650,14 @@ aesni_cbc_encrypt: movdqu 80(%rdi),%xmm7 movdqa %xmm6,%xmm15 movl OPENSSL_ia32cap_P+4(%rip),%r9d - cmpq $112,%rdx + cmpq $0x70,%rdx jbe .Lcbc_dec_six_or_seven andl $71303168,%r9d - subq $80,%rdx + subq $0x50,%rdx cmpl $4194304,%r9d je .Lcbc_dec_loop6_enter - subq $32,%rdx + subq $0x20,%rdx leaq 112(%rcx),%rcx jmp .Lcbc_dec_loop8_enter .align 16 @@ -2672,7 +2672,7 @@ aesni_cbc_encrypt: movups 16-112(%rcx),%xmm1 pxor %xmm0,%xmm4 xorq %r11,%r11 - cmpq $112,%rdx + cmpq $0x70,%rdx pxor %xmm0,%xmm5 pxor %xmm0,%xmm6 pxor %xmm0,%xmm7 @@ -2857,21 +2857,21 @@ aesni_cbc_encrypt: movups %xmm8,96(%rsi) leaq 112(%rsi),%rsi - subq $128,%rdx + subq $0x80,%rdx ja .Lcbc_dec_loop8 movaps %xmm9,%xmm2 leaq -112(%rcx),%rcx - addq $112,%rdx + addq $0x70,%rdx jle .Lcbc_dec_clear_tail_collected movups %xmm9,(%rsi) leaq 16(%rsi),%rsi - cmpq $80,%rdx + cmpq $0x50,%rdx jbe .Lcbc_dec_tail movaps %xmm11,%xmm2 .Lcbc_dec_six_or_seven: - cmpq $96,%rdx + cmpq $0x60,%rdx ja .Lcbc_dec_seven movaps %xmm7,%xmm8 @@ -2964,33 +2964,33 @@ aesni_cbc_encrypt: movl %r10d,%eax movdqu %xmm6,64(%rsi) leaq 80(%rsi),%rsi - subq $96,%rdx + subq $0x60,%rdx ja .Lcbc_dec_loop6 movdqa %xmm7,%xmm2 - addq $80,%rdx + addq $0x50,%rdx jle .Lcbc_dec_clear_tail_collected movups %xmm7,(%rsi) leaq 16(%rsi),%rsi .Lcbc_dec_tail: movups (%rdi),%xmm2 - subq $16,%rdx + subq $0x10,%rdx jbe .Lcbc_dec_one movups 16(%rdi),%xmm3 movaps %xmm2,%xmm11 - subq $16,%rdx + subq $0x10,%rdx jbe .Lcbc_dec_two movups 32(%rdi),%xmm4 movaps %xmm3,%xmm12 - subq $16,%rdx + subq $0x10,%rdx jbe .Lcbc_dec_three movups 48(%rdi),%xmm5 movaps %xmm4,%xmm13 - subq $16,%rdx + subq $0x10,%rdx jbe .Lcbc_dec_four movups 64(%rdi),%xmm6 @@ -3015,7 +3015,7 @@ aesni_cbc_encrypt: movdqa %xmm6,%xmm2 pxor %xmm6,%xmm6 pxor %xmm7,%xmm7 - subq $16,%rdx + subq $0x10,%rdx jmp .Lcbc_dec_tail_collected .align 16 @@ -3332,7 +3332,7 @@ __aesni_set_encrypt_key: pslldq $4,%xmm0 pxor %xmm3,%xmm0 - pshufd $255,%xmm0,%xmm3 + pshufd $0xff,%xmm0,%xmm3 pxor %xmm1,%xmm3 pslldq $4,%xmm1 pxor %xmm1,%xmm3 @@ -3419,7 +3419,7 @@ __aesni_set_encrypt_key: decl %r10d jz .Ldone_key256 - pshufd $255,%xmm0,%xmm2 + pshufd $0xff,%xmm0,%xmm2 pxor %xmm3,%xmm3 .byte 102,15,56,221,211 diff --git a/vendor/openssl/asm/x64-elf-gas/aes/bsaes-x86_64.s b/vendor/openssl/asm/x64-elf-gas/aes/bsaes-x86_64.s index 5b363a5ee..0fd201167 100644 --- a/vendor/openssl/asm/x64-elf-gas/aes/bsaes-x86_64.s +++ b/vendor/openssl/asm/x64-elf-gas/aes/bsaes-x86_64.s @@ -324,45 +324,45 @@ _bsaes_encrypt8_bitslice: pxor %xmm2,%xmm5 decl %r10d jl .Lenc_done - pshufd $147,%xmm15,%xmm7 - pshufd $147,%xmm0,%xmm8 + pshufd $0x93,%xmm15,%xmm7 + pshufd $0x93,%xmm0,%xmm8 pxor %xmm7,%xmm15 - pshufd $147,%xmm3,%xmm9 + pshufd $0x93,%xmm3,%xmm9 pxor %xmm8,%xmm0 - pshufd $147,%xmm5,%xmm10 + pshufd $0x93,%xmm5,%xmm10 pxor %xmm9,%xmm3 - pshufd $147,%xmm2,%xmm11 + pshufd $0x93,%xmm2,%xmm11 pxor %xmm10,%xmm5 - pshufd $147,%xmm6,%xmm12 + pshufd $0x93,%xmm6,%xmm12 pxor %xmm11,%xmm2 - pshufd $147,%xmm1,%xmm13 + pshufd $0x93,%xmm1,%xmm13 pxor %xmm12,%xmm6 - pshufd $147,%xmm4,%xmm14 + pshufd $0x93,%xmm4,%xmm14 pxor %xmm13,%xmm1 pxor %xmm14,%xmm4 pxor %xmm15,%xmm8 pxor %xmm4,%xmm7 pxor %xmm4,%xmm8 - pshufd $78,%xmm15,%xmm15 + pshufd $0x4E,%xmm15,%xmm15 pxor %xmm0,%xmm9 - pshufd $78,%xmm0,%xmm0 + pshufd $0x4E,%xmm0,%xmm0 pxor %xmm2,%xmm12 pxor %xmm7,%xmm15 pxor %xmm6,%xmm13 pxor %xmm8,%xmm0 pxor %xmm5,%xmm11 - pshufd $78,%xmm2,%xmm7 + pshufd $0x4E,%xmm2,%xmm7 pxor %xmm1,%xmm14 - pshufd $78,%xmm6,%xmm8 + pshufd $0x4E,%xmm6,%xmm8 pxor %xmm3,%xmm10 - pshufd $78,%xmm5,%xmm2 + pshufd $0x4E,%xmm5,%xmm2 pxor %xmm4,%xmm10 - pshufd $78,%xmm4,%xmm6 + pshufd $0x4E,%xmm4,%xmm6 pxor %xmm4,%xmm11 - pshufd $78,%xmm1,%xmm5 + pshufd $0x4E,%xmm1,%xmm5 pxor %xmm11,%xmm7 - pshufd $78,%xmm3,%xmm1 + pshufd $0x4E,%xmm3,%xmm1 pxor %xmm12,%xmm8 pxor %xmm10,%xmm2 pxor %xmm14,%xmm6 @@ -796,24 +796,24 @@ _bsaes_decrypt8: decl %r10d jl .Ldec_done - pshufd $78,%xmm15,%xmm7 - pshufd $78,%xmm2,%xmm13 + pshufd $0x4E,%xmm15,%xmm7 + pshufd $0x4E,%xmm2,%xmm13 pxor %xmm15,%xmm7 - pshufd $78,%xmm4,%xmm14 + pshufd $0x4E,%xmm4,%xmm14 pxor %xmm2,%xmm13 - pshufd $78,%xmm0,%xmm8 + pshufd $0x4E,%xmm0,%xmm8 pxor %xmm4,%xmm14 - pshufd $78,%xmm5,%xmm9 + pshufd $0x4E,%xmm5,%xmm9 pxor %xmm0,%xmm8 - pshufd $78,%xmm3,%xmm10 + pshufd $0x4E,%xmm3,%xmm10 pxor %xmm5,%xmm9 pxor %xmm13,%xmm15 pxor %xmm13,%xmm0 - pshufd $78,%xmm1,%xmm11 + pshufd $0x4E,%xmm1,%xmm11 pxor %xmm3,%xmm10 pxor %xmm7,%xmm5 pxor %xmm8,%xmm3 - pshufd $78,%xmm6,%xmm12 + pshufd $0x4E,%xmm6,%xmm12 pxor %xmm1,%xmm11 pxor %xmm14,%xmm0 pxor %xmm9,%xmm1 @@ -827,45 +827,45 @@ _bsaes_decrypt8: pxor %xmm14,%xmm1 pxor %xmm14,%xmm6 pxor %xmm12,%xmm4 - pshufd $147,%xmm15,%xmm7 - pshufd $147,%xmm0,%xmm8 + pshufd $0x93,%xmm15,%xmm7 + pshufd $0x93,%xmm0,%xmm8 pxor %xmm7,%xmm15 - pshufd $147,%xmm5,%xmm9 + pshufd $0x93,%xmm5,%xmm9 pxor %xmm8,%xmm0 - pshufd $147,%xmm3,%xmm10 + pshufd $0x93,%xmm3,%xmm10 pxor %xmm9,%xmm5 - pshufd $147,%xmm1,%xmm11 + pshufd $0x93,%xmm1,%xmm11 pxor %xmm10,%xmm3 - pshufd $147,%xmm6,%xmm12 + pshufd $0x93,%xmm6,%xmm12 pxor %xmm11,%xmm1 - pshufd $147,%xmm2,%xmm13 + pshufd $0x93,%xmm2,%xmm13 pxor %xmm12,%xmm6 - pshufd $147,%xmm4,%xmm14 + pshufd $0x93,%xmm4,%xmm14 pxor %xmm13,%xmm2 pxor %xmm14,%xmm4 pxor %xmm15,%xmm8 pxor %xmm4,%xmm7 pxor %xmm4,%xmm8 - pshufd $78,%xmm15,%xmm15 + pshufd $0x4E,%xmm15,%xmm15 pxor %xmm0,%xmm9 - pshufd $78,%xmm0,%xmm0 + pshufd $0x4E,%xmm0,%xmm0 pxor %xmm1,%xmm12 pxor %xmm7,%xmm15 pxor %xmm6,%xmm13 pxor %xmm8,%xmm0 pxor %xmm3,%xmm11 - pshufd $78,%xmm1,%xmm7 + pshufd $0x4E,%xmm1,%xmm7 pxor %xmm2,%xmm14 - pshufd $78,%xmm6,%xmm8 + pshufd $0x4E,%xmm6,%xmm8 pxor %xmm5,%xmm10 - pshufd $78,%xmm3,%xmm1 + pshufd $0x4E,%xmm3,%xmm1 pxor %xmm4,%xmm10 - pshufd $78,%xmm4,%xmm6 + pshufd $0x4E,%xmm4,%xmm6 pxor %xmm4,%xmm11 - pshufd $78,%xmm2,%xmm3 + pshufd $0x4E,%xmm2,%xmm3 pxor %xmm11,%xmm7 - pshufd $78,%xmm5,%xmm2 + pshufd $0x4E,%xmm5,%xmm2 pxor %xmm12,%xmm8 pxor %xmm1,%xmm10 pxor %xmm14,%xmm6 @@ -1552,20 +1552,20 @@ bsaes_xts_encrypt: movdqa %xmm7,(%rax) andq $-16,%r14 - subq $128,%rsp + subq $0x80,%rsp movdqa 32(%rbp),%xmm6 pxor %xmm14,%xmm14 movdqa .Lxts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - subq $128,%r14 + subq $0x80,%r14 jc .Lxts_enc_short jmp .Lxts_enc_loop .align 16 .Lxts_enc_loop: - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm15 movdqa %xmm6,0(%rsp) @@ -1573,7 +1573,7 @@ bsaes_xts_encrypt: pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm0 movdqa %xmm6,16(%rsp) @@ -1582,7 +1582,7 @@ bsaes_xts_encrypt: pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 movdqu 0(%r12),%xmm7 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm1 movdqa %xmm6,32(%rsp) @@ -1592,7 +1592,7 @@ bsaes_xts_encrypt: pxor %xmm13,%xmm6 movdqu 16(%r12),%xmm8 pxor %xmm7,%xmm15 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm2 movdqa %xmm6,48(%rsp) @@ -1602,7 +1602,7 @@ bsaes_xts_encrypt: pxor %xmm13,%xmm6 movdqu 32(%r12),%xmm9 pxor %xmm8,%xmm0 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm3 movdqa %xmm6,64(%rsp) @@ -1612,7 +1612,7 @@ bsaes_xts_encrypt: pxor %xmm13,%xmm6 movdqu 48(%r12),%xmm10 pxor %xmm9,%xmm1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm4 movdqa %xmm6,80(%rsp) @@ -1622,7 +1622,7 @@ bsaes_xts_encrypt: pxor %xmm13,%xmm6 movdqu 64(%r12),%xmm11 pxor %xmm10,%xmm2 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm5 movdqa %xmm6,96(%rsp) @@ -1666,20 +1666,20 @@ bsaes_xts_encrypt: pxor %xmm14,%xmm14 movdqa .Lxts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 paddq %xmm6,%xmm6 pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - subq $128,%r14 + subq $0x80,%r14 jnc .Lxts_enc_loop .Lxts_enc_short: - addq $128,%r14 + addq $0x80,%r14 jz .Lxts_enc_done - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm15 movdqa %xmm6,0(%rsp) @@ -1687,7 +1687,7 @@ bsaes_xts_encrypt: pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm0 movdqa %xmm6,16(%rsp) @@ -1698,7 +1698,7 @@ bsaes_xts_encrypt: movdqu 0(%r12),%xmm7 cmpq $16,%r14 je .Lxts_enc_1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm1 movdqa %xmm6,32(%rsp) @@ -1710,7 +1710,7 @@ bsaes_xts_encrypt: cmpq $32,%r14 je .Lxts_enc_2 pxor %xmm7,%xmm15 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm2 movdqa %xmm6,48(%rsp) @@ -1722,7 +1722,7 @@ bsaes_xts_encrypt: cmpq $48,%r14 je .Lxts_enc_3 pxor %xmm8,%xmm0 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm3 movdqa %xmm6,64(%rsp) @@ -1734,7 +1734,7 @@ bsaes_xts_encrypt: cmpq $64,%r14 je .Lxts_enc_4 pxor %xmm9,%xmm1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm4 movdqa %xmm6,80(%rsp) @@ -1746,7 +1746,7 @@ bsaes_xts_encrypt: cmpq $80,%r14 je .Lxts_enc_5 pxor %xmm10,%xmm2 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm5 movdqa %xmm6,96(%rsp) @@ -2011,20 +2011,20 @@ bsaes_xts_decrypt: shlq $4,%rax subq %rax,%r14 - subq $128,%rsp + subq $0x80,%rsp movdqa 32(%rbp),%xmm6 pxor %xmm14,%xmm14 movdqa .Lxts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - subq $128,%r14 + subq $0x80,%r14 jc .Lxts_dec_short jmp .Lxts_dec_loop .align 16 .Lxts_dec_loop: - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm15 movdqa %xmm6,0(%rsp) @@ -2032,7 +2032,7 @@ bsaes_xts_decrypt: pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm0 movdqa %xmm6,16(%rsp) @@ -2041,7 +2041,7 @@ bsaes_xts_decrypt: pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 movdqu 0(%r12),%xmm7 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm1 movdqa %xmm6,32(%rsp) @@ -2051,7 +2051,7 @@ bsaes_xts_decrypt: pxor %xmm13,%xmm6 movdqu 16(%r12),%xmm8 pxor %xmm7,%xmm15 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm2 movdqa %xmm6,48(%rsp) @@ -2061,7 +2061,7 @@ bsaes_xts_decrypt: pxor %xmm13,%xmm6 movdqu 32(%r12),%xmm9 pxor %xmm8,%xmm0 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm3 movdqa %xmm6,64(%rsp) @@ -2071,7 +2071,7 @@ bsaes_xts_decrypt: pxor %xmm13,%xmm6 movdqu 48(%r12),%xmm10 pxor %xmm9,%xmm1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm4 movdqa %xmm6,80(%rsp) @@ -2081,7 +2081,7 @@ bsaes_xts_decrypt: pxor %xmm13,%xmm6 movdqu 64(%r12),%xmm11 pxor %xmm10,%xmm2 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm5 movdqa %xmm6,96(%rsp) @@ -2125,20 +2125,20 @@ bsaes_xts_decrypt: pxor %xmm14,%xmm14 movdqa .Lxts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 paddq %xmm6,%xmm6 pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - subq $128,%r14 + subq $0x80,%r14 jnc .Lxts_dec_loop .Lxts_dec_short: - addq $128,%r14 + addq $0x80,%r14 jz .Lxts_dec_done - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm15 movdqa %xmm6,0(%rsp) @@ -2146,7 +2146,7 @@ bsaes_xts_decrypt: pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm0 movdqa %xmm6,16(%rsp) @@ -2157,7 +2157,7 @@ bsaes_xts_decrypt: movdqu 0(%r12),%xmm7 cmpq $16,%r14 je .Lxts_dec_1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm1 movdqa %xmm6,32(%rsp) @@ -2169,7 +2169,7 @@ bsaes_xts_decrypt: cmpq $32,%r14 je .Lxts_dec_2 pxor %xmm7,%xmm15 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm2 movdqa %xmm6,48(%rsp) @@ -2181,7 +2181,7 @@ bsaes_xts_decrypt: cmpq $48,%r14 je .Lxts_dec_3 pxor %xmm8,%xmm0 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm3 movdqa %xmm6,64(%rsp) @@ -2193,7 +2193,7 @@ bsaes_xts_decrypt: cmpq $64,%r14 je .Lxts_dec_4 pxor %xmm9,%xmm1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm4 movdqa %xmm6,80(%rsp) @@ -2205,7 +2205,7 @@ bsaes_xts_decrypt: cmpq $80,%r14 je .Lxts_dec_5 pxor %xmm10,%xmm2 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm5 movdqa %xmm6,96(%rsp) @@ -2382,7 +2382,7 @@ bsaes_xts_decrypt: pxor %xmm14,%xmm14 movdqa .Lxts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 movdqa %xmm6,%xmm5 paddq %xmm6,%xmm6 pand %xmm12,%xmm13 diff --git a/vendor/openssl/asm/x64-elf-gas/aes/vpaes-x86_64.s b/vendor/openssl/asm/x64-elf-gas/aes/vpaes-x86_64.s index b9d6df513..bf7c2b0b6 100644 --- a/vendor/openssl/asm/x64-elf-gas/aes/vpaes-x86_64.s +++ b/vendor/openssl/asm/x64-elf-gas/aes/vpaes-x86_64.s @@ -60,7 +60,7 @@ _vpaes_encrypt_core: addq $16,%r11 pxor %xmm0,%xmm3 .byte 102,15,56,0,193 - andq $48,%r11 + andq $0x30,%r11 subq $1,%rax pxor %xmm3,%xmm0 @@ -120,10 +120,10 @@ _vpaes_decrypt_core: pand %xmm9,%xmm0 .byte 102,15,56,0,208 movdqa .Lk_dipt+16(%rip),%xmm0 - xorq $48,%r11 + xorq $0x30,%r11 leaq .Lk_dsbd(%rip),%r10 .byte 102,15,56,0,193 - andq $48,%r11 + andq $0x30,%r11 pxor %xmm5,%xmm2 movdqa .Lk_mc_forward+48(%rip),%xmm5 pxor %xmm2,%xmm0 @@ -242,7 +242,7 @@ _vpaes_schedule_core: movdqa (%r8,%r10,1),%xmm1 .byte 102,15,56,0,217 movdqu %xmm3,(%rdx) - xorq $48,%r8 + xorq $0x30,%r8 .Lschedule_go: cmpl $192,%esi @@ -332,7 +332,7 @@ _vpaes_schedule_core: call _vpaes_schedule_mangle - pshufd $255,%xmm0,%xmm0 + pshufd $0xFF,%xmm0,%xmm0 movdqa %xmm7,%xmm5 movdqa %xmm6,%xmm7 call _vpaes_schedule_low_round @@ -399,8 +399,8 @@ _vpaes_schedule_core: .type _vpaes_schedule_192_smear,@function .align 16 _vpaes_schedule_192_smear: - pshufd $128,%xmm6,%xmm1 - pshufd $254,%xmm7,%xmm0 + pshufd $0x80,%xmm6,%xmm1 + pshufd $0xFE,%xmm7,%xmm0 pxor %xmm1,%xmm6 pxor %xmm1,%xmm1 pxor %xmm0,%xmm6 @@ -437,7 +437,7 @@ _vpaes_schedule_round: pxor %xmm1,%xmm7 - pshufd $255,%xmm0,%xmm0 + pshufd $0xFF,%xmm0,%xmm0 .byte 102,15,58,15,192,1 @@ -596,7 +596,7 @@ _vpaes_schedule_mangle: movdqa (%r8,%r10,1),%xmm1 .byte 102,15,56,0,217 addq $-16,%r8 - andq $48,%r8 + andq $0x30,%r8 movdqu %xmm3,(%rdx) .byte 0xf3,0xc3 .size _vpaes_schedule_mangle,.-_vpaes_schedule_mangle @@ -614,7 +614,7 @@ vpaes_set_encrypt_key: movl %eax,240(%rdx) movl $0,%ecx - movl $48,%r8d + movl $0x30,%r8d call _vpaes_schedule_core xorl %eax,%eax .byte 0xf3,0xc3 diff --git a/vendor/openssl/asm/x64-elf-gas/bn/rsaz-avx2.s b/vendor/openssl/asm/x64-elf-gas/bn/rsaz-avx2.s index 8f356fc3d..d3d84e3f7 100644 --- a/vendor/openssl/asm/x64-elf-gas/bn/rsaz-avx2.s +++ b/vendor/openssl/asm/x64-elf-gas/bn/rsaz-avx2.s @@ -270,9 +270,9 @@ rsaz_1024_sqr_avx2: vpsrlq $29,%ymm1,%ymm11 vpand %ymm15,%ymm1,%ymm1 - vpermq $147,%ymm14,%ymm14 + vpermq $0x93,%ymm14,%ymm14 vpxor %ymm9,%ymm9,%ymm9 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpblendd $3,%ymm9,%ymm14,%ymm10 vpblendd $3,%ymm14,%ymm11,%ymm14 @@ -297,7 +297,7 @@ rsaz_1024_sqr_avx2: movq %rax,%r9 imull %ecx,%eax - andl $536870911,%eax + andl $0x1fffffff,%eax vmovd %eax,%xmm12 movq %rax,%rdx @@ -317,7 +317,7 @@ rsaz_1024_sqr_avx2: movq %r10,%rax imull %ecx,%eax - andl $536870911,%eax + andl $0x1fffffff,%eax movl $9,%r14d jmp .LOOP_REDUCE_1024 @@ -353,7 +353,7 @@ rsaz_1024_sqr_avx2: imull %ecx,%eax vpaddq %ymm14,%ymm5,%ymm5 vpmuludq 192-128(%r13),%ymm12,%ymm11 - andl $536870911,%eax + andl $0x1fffffff,%eax vpaddq %ymm11,%ymm6,%ymm6 vpmuludq 224-128(%r13),%ymm12,%ymm10 vpaddq %ymm10,%ymm7,%ymm7 @@ -389,7 +389,7 @@ rsaz_1024_sqr_avx2: vpaddq %ymm11,%ymm4,%ymm4 vpmuludq %ymm13,%ymm10,%ymm10 .byte 0xc4,0x41,0x7e,0x6f,0x9d,0x58,0x00,0x00,0x00 - andl $536870911,%eax + andl $0x1fffffff,%eax vpaddq %ymm10,%ymm5,%ymm5 vpmuludq %ymm13,%ymm14,%ymm14 vmovdqu 256-8-128(%r13),%ymm10 @@ -442,7 +442,7 @@ rsaz_1024_sqr_avx2: imull %ecx,%eax vpaddq %ymm11,%ymm8,%ymm8 vpmuludq %ymm12,%ymm10,%ymm10 - andl $536870911,%eax + andl $0x1fffffff,%eax vmovd %eax,%xmm12 vmovdqu 96-24-128(%r13),%ymm11 .byte 0x67 @@ -483,7 +483,7 @@ rsaz_1024_sqr_avx2: vpmuludq %ymm0,%ymm10,%ymm10 vpaddq %ymm11,%ymm6,%ymm5 vmovdqu 288-24-128(%r13),%ymm11 - andl $536870911,%eax + andl $0x1fffffff,%eax vpaddq %ymm10,%ymm7,%ymm6 vpmuludq %ymm0,%ymm14,%ymm14 addq 24(%rsp),%rdx @@ -514,15 +514,15 @@ rsaz_1024_sqr_avx2: vpsrlq $29,%ymm1,%ymm11 vpand %ymm15,%ymm1,%ymm1 vpsrlq $29,%ymm2,%ymm12 - vpermq $147,%ymm14,%ymm14 + vpermq $0x93,%ymm14,%ymm14 vpand %ymm15,%ymm2,%ymm2 vpsrlq $29,%ymm3,%ymm13 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpand %ymm15,%ymm3,%ymm3 - vpermq $147,%ymm12,%ymm12 + vpermq $0x93,%ymm12,%ymm12 vpblendd $3,%ymm9,%ymm14,%ymm10 - vpermq $147,%ymm13,%ymm13 + vpermq $0x93,%ymm13,%ymm13 vpblendd $3,%ymm14,%ymm11,%ymm14 vpaddq %ymm10,%ymm0,%ymm0 vpblendd $3,%ymm11,%ymm12,%ymm11 @@ -538,15 +538,15 @@ rsaz_1024_sqr_avx2: vpsrlq $29,%ymm1,%ymm11 vpand %ymm15,%ymm1,%ymm1 vpsrlq $29,%ymm2,%ymm12 - vpermq $147,%ymm14,%ymm14 + vpermq $0x93,%ymm14,%ymm14 vpand %ymm15,%ymm2,%ymm2 vpsrlq $29,%ymm3,%ymm13 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpand %ymm15,%ymm3,%ymm3 - vpermq $147,%ymm12,%ymm12 + vpermq $0x93,%ymm12,%ymm12 vpblendd $3,%ymm9,%ymm14,%ymm10 - vpermq $147,%ymm13,%ymm13 + vpermq $0x93,%ymm13,%ymm13 vpblendd $3,%ymm14,%ymm11,%ymm14 vpaddq %ymm10,%ymm0,%ymm0 vpblendd $3,%ymm11,%ymm12,%ymm11 @@ -565,18 +565,18 @@ rsaz_1024_sqr_avx2: vpsrlq $29,%ymm5,%ymm11 vpand %ymm15,%ymm5,%ymm5 vpsrlq $29,%ymm6,%ymm12 - vpermq $147,%ymm14,%ymm14 + vpermq $0x93,%ymm14,%ymm14 vpand %ymm15,%ymm6,%ymm6 vpsrlq $29,%ymm7,%ymm13 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpand %ymm15,%ymm7,%ymm7 vpsrlq $29,%ymm8,%ymm0 - vpermq $147,%ymm12,%ymm12 + vpermq $0x93,%ymm12,%ymm12 vpand %ymm15,%ymm8,%ymm8 - vpermq $147,%ymm13,%ymm13 + vpermq $0x93,%ymm13,%ymm13 vpblendd $3,%ymm9,%ymm14,%ymm10 - vpermq $147,%ymm0,%ymm0 + vpermq $0x93,%ymm0,%ymm0 vpblendd $3,%ymm14,%ymm11,%ymm14 vpaddq %ymm10,%ymm4,%ymm4 vpblendd $3,%ymm11,%ymm12,%ymm11 @@ -592,18 +592,18 @@ rsaz_1024_sqr_avx2: vpsrlq $29,%ymm5,%ymm11 vpand %ymm15,%ymm5,%ymm5 vpsrlq $29,%ymm6,%ymm12 - vpermq $147,%ymm14,%ymm14 + vpermq $0x93,%ymm14,%ymm14 vpand %ymm15,%ymm6,%ymm6 vpsrlq $29,%ymm7,%ymm13 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpand %ymm15,%ymm7,%ymm7 vpsrlq $29,%ymm8,%ymm0 - vpermq $147,%ymm12,%ymm12 + vpermq $0x93,%ymm12,%ymm12 vpand %ymm15,%ymm8,%ymm8 - vpermq $147,%ymm13,%ymm13 + vpermq $0x93,%ymm13,%ymm13 vpblendd $3,%ymm9,%ymm14,%ymm10 - vpermq $147,%ymm0,%ymm0 + vpermq $0x93,%ymm0,%ymm0 vpblendd $3,%ymm14,%ymm11,%ymm14 vpaddq %ymm10,%ymm4,%ymm4 vpblendd $3,%ymm11,%ymm12,%ymm11 @@ -740,7 +740,7 @@ rsaz_1024_mul_avx2: movq %rax,%r9 imull %r8d,%eax - andl $536870911,%eax + andl $0x1fffffff,%eax movq %rbx,%r11 imulq 16-128(%rsi),%r11 @@ -765,7 +765,7 @@ rsaz_1024_mul_avx2: vpmuludq 192-128(%rsi),%ymm10,%ymm13 vpaddq %ymm13,%ymm6,%ymm6 vpmuludq 224-128(%rsi),%ymm10,%ymm0 - vpermq $147,%ymm9,%ymm9 + vpermq $0x93,%ymm9,%ymm9 vpaddq %ymm0,%ymm7,%ymm7 vpmuludq 256-128(%rsi),%ymm10,%ymm12 vpbroadcastq 8(%r13),%ymm10 @@ -816,7 +816,7 @@ rsaz_1024_mul_avx2: movq %r10,%rax imull %r8d,%eax - andl $536870911,%eax + andl $0x1fffffff,%eax imulq 16-128(%rsi),%rbx addq %rbx,%r12 @@ -896,7 +896,7 @@ rsaz_1024_mul_avx2: vmovdqu -16+64-128(%rsi),%ymm12 movq %rax,%r11 imull %r8d,%eax - andl $536870911,%eax + andl $0x1fffffff,%eax imulq 8-128(%rsi),%rbx addq %rbx,%r12 @@ -973,7 +973,7 @@ rsaz_1024_mul_avx2: movq %r12,%rax imull %r8d,%eax - andl $536870911,%eax + andl $0x1fffffff,%eax vpmuludq %ymm10,%ymm0,%ymm0 vmovd %eax,%xmm11 @@ -1052,16 +1052,16 @@ rsaz_1024_mul_avx2: vpsrlq $29,%ymm1,%ymm13 vpand %ymm15,%ymm1,%ymm1 vpsrlq $29,%ymm2,%ymm10 - vpermq $147,%ymm12,%ymm12 + vpermq $0x93,%ymm12,%ymm12 vpand %ymm15,%ymm2,%ymm2 vpsrlq $29,%ymm3,%ymm11 - vpermq $147,%ymm13,%ymm13 + vpermq $0x93,%ymm13,%ymm13 vpand %ymm15,%ymm3,%ymm3 vpblendd $3,%ymm14,%ymm12,%ymm9 - vpermq $147,%ymm10,%ymm10 + vpermq $0x93,%ymm10,%ymm10 vpblendd $3,%ymm12,%ymm13,%ymm12 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpaddq %ymm9,%ymm0,%ymm0 vpblendd $3,%ymm13,%ymm10,%ymm13 vpaddq %ymm12,%ymm1,%ymm1 @@ -1076,15 +1076,15 @@ rsaz_1024_mul_avx2: vpsrlq $29,%ymm1,%ymm13 vpand %ymm15,%ymm1,%ymm1 vpsrlq $29,%ymm2,%ymm10 - vpermq $147,%ymm12,%ymm12 + vpermq $0x93,%ymm12,%ymm12 vpand %ymm15,%ymm2,%ymm2 vpsrlq $29,%ymm3,%ymm11 - vpermq $147,%ymm13,%ymm13 + vpermq $0x93,%ymm13,%ymm13 vpand %ymm15,%ymm3,%ymm3 - vpermq $147,%ymm10,%ymm10 + vpermq $0x93,%ymm10,%ymm10 vpblendd $3,%ymm14,%ymm12,%ymm9 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpblendd $3,%ymm12,%ymm13,%ymm12 vpaddq %ymm9,%ymm0,%ymm0 vpblendd $3,%ymm13,%ymm10,%ymm13 @@ -1104,18 +1104,18 @@ rsaz_1024_mul_avx2: vpsrlq $29,%ymm5,%ymm13 vpand %ymm15,%ymm5,%ymm5 vpsrlq $29,%ymm6,%ymm10 - vpermq $147,%ymm12,%ymm12 + vpermq $0x93,%ymm12,%ymm12 vpand %ymm15,%ymm6,%ymm6 vpsrlq $29,%ymm7,%ymm11 - vpermq $147,%ymm13,%ymm13 + vpermq $0x93,%ymm13,%ymm13 vpand %ymm15,%ymm7,%ymm7 vpsrlq $29,%ymm8,%ymm0 - vpermq $147,%ymm10,%ymm10 + vpermq $0x93,%ymm10,%ymm10 vpand %ymm15,%ymm8,%ymm8 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpblendd $3,%ymm14,%ymm12,%ymm9 - vpermq $147,%ymm0,%ymm0 + vpermq $0x93,%ymm0,%ymm0 vpblendd $3,%ymm12,%ymm13,%ymm12 vpaddq %ymm9,%ymm4,%ymm4 vpblendd $3,%ymm13,%ymm10,%ymm13 @@ -1131,18 +1131,18 @@ rsaz_1024_mul_avx2: vpsrlq $29,%ymm5,%ymm13 vpand %ymm15,%ymm5,%ymm5 vpsrlq $29,%ymm6,%ymm10 - vpermq $147,%ymm12,%ymm12 + vpermq $0x93,%ymm12,%ymm12 vpand %ymm15,%ymm6,%ymm6 vpsrlq $29,%ymm7,%ymm11 - vpermq $147,%ymm13,%ymm13 + vpermq $0x93,%ymm13,%ymm13 vpand %ymm15,%ymm7,%ymm7 vpsrlq $29,%ymm8,%ymm0 - vpermq $147,%ymm10,%ymm10 + vpermq $0x93,%ymm10,%ymm10 vpand %ymm15,%ymm8,%ymm8 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpblendd $3,%ymm14,%ymm12,%ymm9 - vpermq $147,%ymm0,%ymm0 + vpermq $0x93,%ymm0,%ymm0 vpblendd $3,%ymm12,%ymm13,%ymm12 vpaddq %ymm9,%ymm4,%ymm4 vpblendd $3,%ymm13,%ymm10,%ymm13 @@ -1374,7 +1374,7 @@ rsaz_1024_red2norm_avx2: rsaz_1024_norm2red_avx2: subq $-128,%rdi movq (%rsi),%r8 - movl $536870911,%eax + movl $0x1fffffff,%eax movq 8(%rsi),%r9 movq %r8,%r11 shrq $0,%r11 @@ -1554,54 +1554,116 @@ rsaz_1024_scatter5_avx2: .type rsaz_1024_gather5_avx2,@function .align 32 rsaz_1024_gather5_avx2: - leaq .Lgather_table(%rip),%r11 - movl %edx,%eax - andl $3,%edx - shrl $2,%eax - shll $4,%edx - - vmovdqu -32(%r11),%ymm7 - vpbroadcastb 8(%r11,%rax,1),%xmm8 - vpbroadcastb 7(%r11,%rax,1),%xmm9 - vpbroadcastb 6(%r11,%rax,1),%xmm10 - vpbroadcastb 5(%r11,%rax,1),%xmm11 - vpbroadcastb 4(%r11,%rax,1),%xmm12 - vpbroadcastb 3(%r11,%rax,1),%xmm13 - vpbroadcastb 2(%r11,%rax,1),%xmm14 - vpbroadcastb 1(%r11,%rax,1),%xmm15 - - leaq 64(%rsi,%rdx,1),%rsi - movq $64,%r11 - movl $9,%eax - jmp .Loop_gather_1024 + vzeroupper + movq %rsp,%r11 + leaq -256(%rsp),%rsp + andq $-32,%rsp + leaq .Linc(%rip),%r10 + leaq -128(%rsp),%rax + + vmovd %edx,%xmm4 + vmovdqa (%r10),%ymm0 + vmovdqa 32(%r10),%ymm1 + vmovdqa 64(%r10),%ymm5 + vpbroadcastd %xmm4,%ymm4 + + vpaddd %ymm5,%ymm0,%ymm2 + vpcmpeqd %ymm4,%ymm0,%ymm0 + vpaddd %ymm5,%ymm1,%ymm3 + vpcmpeqd %ymm4,%ymm1,%ymm1 + vmovdqa %ymm0,0+128(%rax) + vpaddd %ymm5,%ymm2,%ymm0 + vpcmpeqd %ymm4,%ymm2,%ymm2 + vmovdqa %ymm1,32+128(%rax) + vpaddd %ymm5,%ymm3,%ymm1 + vpcmpeqd %ymm4,%ymm3,%ymm3 + vmovdqa %ymm2,64+128(%rax) + vpaddd %ymm5,%ymm0,%ymm2 + vpcmpeqd %ymm4,%ymm0,%ymm0 + vmovdqa %ymm3,96+128(%rax) + vpaddd %ymm5,%ymm1,%ymm3 + vpcmpeqd %ymm4,%ymm1,%ymm1 + vmovdqa %ymm0,128+128(%rax) + vpaddd %ymm5,%ymm2,%ymm8 + vpcmpeqd %ymm4,%ymm2,%ymm2 + vmovdqa %ymm1,160+128(%rax) + vpaddd %ymm5,%ymm3,%ymm9 + vpcmpeqd %ymm4,%ymm3,%ymm3 + vmovdqa %ymm2,192+128(%rax) + vpaddd %ymm5,%ymm8,%ymm10 + vpcmpeqd %ymm4,%ymm8,%ymm8 + vmovdqa %ymm3,224+128(%rax) + vpaddd %ymm5,%ymm9,%ymm11 + vpcmpeqd %ymm4,%ymm9,%ymm9 + vpaddd %ymm5,%ymm10,%ymm12 + vpcmpeqd %ymm4,%ymm10,%ymm10 + vpaddd %ymm5,%ymm11,%ymm13 + vpcmpeqd %ymm4,%ymm11,%ymm11 + vpaddd %ymm5,%ymm12,%ymm14 + vpcmpeqd %ymm4,%ymm12,%ymm12 + vpaddd %ymm5,%ymm13,%ymm15 + vpcmpeqd %ymm4,%ymm13,%ymm13 + vpcmpeqd %ymm4,%ymm14,%ymm14 + vpcmpeqd %ymm4,%ymm15,%ymm15 + + vmovdqa -32(%r10),%ymm7 + leaq 128(%rsi),%rsi + movl $9,%edx -.align 32 .Loop_gather_1024: - vpand -64(%rsi),%xmm8,%xmm0 - vpand (%rsi),%xmm9,%xmm1 - vpand 64(%rsi),%xmm10,%xmm2 - vpand (%rsi,%r11,2),%xmm11,%xmm3 - vpor %xmm0,%xmm1,%xmm1 - vpand 64(%rsi,%r11,2),%xmm12,%xmm4 - vpor %xmm2,%xmm3,%xmm3 - vpand (%rsi,%r11,4),%xmm13,%xmm5 - vpor %xmm1,%xmm3,%xmm3 - vpand 64(%rsi,%r11,4),%xmm14,%xmm6 + vmovdqa 0-128(%rsi),%ymm0 + vmovdqa 32-128(%rsi),%ymm1 + vmovdqa 64-128(%rsi),%ymm2 + vmovdqa 96-128(%rsi),%ymm3 + vpand 0+128(%rax),%ymm0,%ymm0 + vpand 32+128(%rax),%ymm1,%ymm1 + vpand 64+128(%rax),%ymm2,%ymm2 + vpor %ymm0,%ymm1,%ymm4 + vpand 96+128(%rax),%ymm3,%ymm3 + vmovdqa 128-128(%rsi),%ymm0 + vmovdqa 160-128(%rsi),%ymm1 + vpor %ymm2,%ymm3,%ymm5 + vmovdqa 192-128(%rsi),%ymm2 + vmovdqa 224-128(%rsi),%ymm3 + vpand 128+128(%rax),%ymm0,%ymm0 + vpand 160+128(%rax),%ymm1,%ymm1 + vpand 192+128(%rax),%ymm2,%ymm2 + vpor %ymm0,%ymm4,%ymm4 + vpand 224+128(%rax),%ymm3,%ymm3 + vpand 256-128(%rsi),%ymm8,%ymm0 + vpor %ymm1,%ymm5,%ymm5 + vpand 288-128(%rsi),%ymm9,%ymm1 + vpor %ymm2,%ymm4,%ymm4 + vpand 320-128(%rsi),%ymm10,%ymm2 + vpor %ymm3,%ymm5,%ymm5 + vpand 352-128(%rsi),%ymm11,%ymm3 + vpor %ymm0,%ymm4,%ymm4 + vpand 384-128(%rsi),%ymm12,%ymm0 + vpor %ymm1,%ymm5,%ymm5 + vpand 416-128(%rsi),%ymm13,%ymm1 + vpor %ymm2,%ymm4,%ymm4 + vpand 448-128(%rsi),%ymm14,%ymm2 + vpor %ymm3,%ymm5,%ymm5 + vpand 480-128(%rsi),%ymm15,%ymm3 + leaq 512(%rsi),%rsi + vpor %ymm0,%ymm4,%ymm4 + vpor %ymm1,%ymm5,%ymm5 + vpor %ymm2,%ymm4,%ymm4 + vpor %ymm3,%ymm5,%ymm5 + + vpor %ymm5,%ymm4,%ymm4 + vextracti128 $1,%ymm4,%xmm5 vpor %xmm4,%xmm5,%xmm5 - vpand -128(%rsi,%r11,8),%xmm15,%xmm2 - leaq (%rsi,%r11,8),%rsi - vpor %xmm3,%xmm5,%xmm5 - vpor %xmm2,%xmm6,%xmm6 - vpor %xmm5,%xmm6,%xmm6 - vpermd %ymm6,%ymm7,%ymm6 - vmovdqu %ymm6,(%rdi) + vpermd %ymm5,%ymm7,%ymm5 + vmovdqu %ymm5,(%rdi) leaq 32(%rdi),%rdi - decl %eax + decl %edx jnz .Loop_gather_1024 vpxor %ymm0,%ymm0,%ymm0 vmovdqu %ymm0,(%rdi) vzeroupper + leaq (%r11),%rsp .byte 0xf3,0xc3 .size rsaz_1024_gather5_avx2,.-rsaz_1024_gather5_avx2 @@ -1627,6 +1689,8 @@ rsaz_avx2_eligible: .long 0,2,4,6,7,7,7,7 .Lgather_permd: .long 0,7,1,7,2,7,3,7 -.Lgather_table: -.byte 0,0,0,0,0,0,0,0, 0xff,0,0,0,0,0,0,0 +.Linc: +.long 0,0,0,0, 1,1,1,1 +.long 2,2,2,2, 3,3,3,3 +.long 4,4,4,4, 4,4,4,4 .align 64 diff --git a/vendor/openssl/asm/x64-elf-gas/bn/rsaz-x86_64.s b/vendor/openssl/asm/x64-elf-gas/bn/rsaz-x86_64.s index f42075571..b6797a684 100644 --- a/vendor/openssl/asm/x64-elf-gas/bn/rsaz-x86_64.s +++ b/vendor/openssl/asm/x64-elf-gas/bn/rsaz-x86_64.s @@ -19,9 +19,9 @@ rsaz_512_sqr: movq (%rsi),%rdx movq 8(%rsi),%rax movq %rcx,128(%rsp) - movl $524544,%r11d + movl $0x80100,%r11d andl OPENSSL_ia32cap_P+8(%rip),%r11d - cmpl $524544,%r11d + cmpl $0x80100,%r11d je .Loop_sqrx jmp .Loop_sqr @@ -684,9 +684,9 @@ rsaz_512_mul: .byte 102,72,15,110,199 .byte 102,72,15,110,201 movq %r8,128(%rsp) - movl $524544,%r11d + movl $0x80100,%r11d andl OPENSSL_ia32cap_P+8(%rip),%r11d - cmpl $524544,%r11d + cmpl $0x80100,%r11d je .Lmulx movq (%rdx),%rbx movq %rdx,%rbp @@ -762,52 +762,98 @@ rsaz_512_mul_gather4: pushq %r14 pushq %r15 - movl %r9d,%r9d - subq $128+24,%rsp + subq $152,%rsp .Lmul_gather4_body: - movl $524544,%r11d + movd %r9d,%xmm8 + movdqa .Linc+16(%rip),%xmm1 + movdqa .Linc(%rip),%xmm0 + + pshufd $0,%xmm8,%xmm8 + movdqa %xmm1,%xmm7 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm8,%xmm0 + movdqa %xmm7,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm8,%xmm1 + movdqa %xmm7,%xmm4 + paddd %xmm2,%xmm3 + pcmpeqd %xmm8,%xmm2 + movdqa %xmm7,%xmm5 + paddd %xmm3,%xmm4 + pcmpeqd %xmm8,%xmm3 + movdqa %xmm7,%xmm6 + paddd %xmm4,%xmm5 + pcmpeqd %xmm8,%xmm4 + paddd %xmm5,%xmm6 + pcmpeqd %xmm8,%xmm5 + paddd %xmm6,%xmm7 + pcmpeqd %xmm8,%xmm6 + pcmpeqd %xmm8,%xmm7 + + movdqa 0(%rdx),%xmm8 + movdqa 16(%rdx),%xmm9 + movdqa 32(%rdx),%xmm10 + movdqa 48(%rdx),%xmm11 + pand %xmm0,%xmm8 + movdqa 64(%rdx),%xmm12 + pand %xmm1,%xmm9 + movdqa 80(%rdx),%xmm13 + pand %xmm2,%xmm10 + movdqa 96(%rdx),%xmm14 + pand %xmm3,%xmm11 + movdqa 112(%rdx),%xmm15 + leaq 128(%rdx),%rbp + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd $0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 + movl $0x80100,%r11d andl OPENSSL_ia32cap_P+8(%rip),%r11d - cmpl $524544,%r11d + cmpl $0x80100,%r11d je .Lmulx_gather - movl 64(%rdx,%r9,4),%eax -.byte 102,72,15,110,199 - movl (%rdx,%r9,4),%ebx -.byte 102,72,15,110,201 +.byte 102,76,15,126,195 + movq %r8,128(%rsp) + movq %rdi,128+8(%rsp) + movq %rcx,128+16(%rsp) - shlq $32,%rax - orq %rax,%rbx movq (%rsi),%rax movq 8(%rsi),%rcx - leaq 128(%rdx,%r9,4),%rbp mulq %rbx movq %rax,(%rsp) movq %rcx,%rax movq %rdx,%r8 mulq %rbx - movd (%rbp),%xmm4 addq %rax,%r8 movq 16(%rsi),%rax movq %rdx,%r9 adcq $0,%r9 mulq %rbx - movd 64(%rbp),%xmm5 addq %rax,%r9 movq 24(%rsi),%rax movq %rdx,%r10 adcq $0,%r10 mulq %rbx - pslldq $4,%xmm5 addq %rax,%r10 movq 32(%rsi),%rax movq %rdx,%r11 adcq $0,%r11 mulq %rbx - por %xmm5,%xmm4 addq %rax,%r11 movq 40(%rsi),%rax movq %rdx,%r12 @@ -820,14 +866,12 @@ rsaz_512_mul_gather4: adcq $0,%r13 mulq %rbx - leaq 128(%rbp),%rbp addq %rax,%r13 movq 56(%rsi),%rax movq %rdx,%r14 adcq $0,%r14 mulq %rbx -.byte 102,72,15,126,227 addq %rax,%r14 movq (%rsi),%rax movq %rdx,%r15 @@ -839,6 +883,35 @@ rsaz_512_mul_gather4: .align 32 .Loop_mul_gather: + movdqa 0(%rbp),%xmm8 + movdqa 16(%rbp),%xmm9 + movdqa 32(%rbp),%xmm10 + movdqa 48(%rbp),%xmm11 + pand %xmm0,%xmm8 + movdqa 64(%rbp),%xmm12 + pand %xmm1,%xmm9 + movdqa 80(%rbp),%xmm13 + pand %xmm2,%xmm10 + movdqa 96(%rbp),%xmm14 + pand %xmm3,%xmm11 + movdqa 112(%rbp),%xmm15 + leaq 128(%rbp),%rbp + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd $0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 +.byte 102,76,15,126,195 + mulq %rbx addq %rax,%r8 movq 8(%rsi),%rax @@ -847,7 +920,6 @@ rsaz_512_mul_gather4: adcq $0,%r8 mulq %rbx - movd (%rbp),%xmm4 addq %rax,%r9 movq 16(%rsi),%rax adcq $0,%rdx @@ -856,7 +928,6 @@ rsaz_512_mul_gather4: adcq $0,%r9 mulq %rbx - movd 64(%rbp),%xmm5 addq %rax,%r10 movq 24(%rsi),%rax adcq $0,%rdx @@ -865,7 +936,6 @@ rsaz_512_mul_gather4: adcq $0,%r10 mulq %rbx - pslldq $4,%xmm5 addq %rax,%r11 movq 32(%rsi),%rax adcq $0,%rdx @@ -874,7 +944,6 @@ rsaz_512_mul_gather4: adcq $0,%r11 mulq %rbx - por %xmm5,%xmm4 addq %rax,%r12 movq 40(%rsi),%rax adcq $0,%rdx @@ -899,7 +968,6 @@ rsaz_512_mul_gather4: adcq $0,%r14 mulq %rbx -.byte 102,72,15,126,227 addq %rax,%r15 movq (%rsi),%rax adcq $0,%rdx @@ -907,7 +975,6 @@ rsaz_512_mul_gather4: movq %rdx,%r15 adcq $0,%r15 - leaq 128(%rbp),%rbp leaq 8(%rdi),%rdi decl %ecx @@ -922,8 +989,8 @@ rsaz_512_mul_gather4: movq %r14,48(%rdi) movq %r15,56(%rdi) -.byte 102,72,15,126,199 -.byte 102,72,15,126,205 + movq 128+8(%rsp),%rdi + movq 128+16(%rsp),%rbp movq (%rsp),%r8 movq 8(%rsp),%r9 @@ -939,45 +1006,37 @@ rsaz_512_mul_gather4: .align 32 .Lmulx_gather: - movl 64(%rdx,%r9,4),%eax -.byte 102,72,15,110,199 - leaq 128(%rdx,%r9,4),%rbp - movl (%rdx,%r9,4),%edx -.byte 102,72,15,110,201 +.byte 102,76,15,126,194 + movq %r8,128(%rsp) + movq %rdi,128+8(%rsp) + movq %rcx,128+16(%rsp) - shlq $32,%rax - orq %rax,%rdx mulxq (%rsi),%rbx,%r8 movq %rbx,(%rsp) xorl %edi,%edi mulxq 8(%rsi),%rax,%r9 - movd (%rbp),%xmm4 mulxq 16(%rsi),%rbx,%r10 - movd 64(%rbp),%xmm5 adcxq %rax,%r8 mulxq 24(%rsi),%rax,%r11 - pslldq $4,%xmm5 adcxq %rbx,%r9 mulxq 32(%rsi),%rbx,%r12 - por %xmm5,%xmm4 adcxq %rax,%r10 mulxq 40(%rsi),%rax,%r13 adcxq %rbx,%r11 mulxq 48(%rsi),%rbx,%r14 - leaq 128(%rbp),%rbp adcxq %rax,%r12 mulxq 56(%rsi),%rax,%r15 -.byte 102,72,15,126,226 adcxq %rbx,%r13 adcxq %rax,%r14 +.byte 0x67 movq %r8,%rbx adcxq %rdi,%r15 @@ -986,24 +1045,48 @@ rsaz_512_mul_gather4: .align 32 .Loop_mulx_gather: - mulxq (%rsi),%rax,%r8 + movdqa 0(%rbp),%xmm8 + movdqa 16(%rbp),%xmm9 + movdqa 32(%rbp),%xmm10 + movdqa 48(%rbp),%xmm11 + pand %xmm0,%xmm8 + movdqa 64(%rbp),%xmm12 + pand %xmm1,%xmm9 + movdqa 80(%rbp),%xmm13 + pand %xmm2,%xmm10 + movdqa 96(%rbp),%xmm14 + pand %xmm3,%xmm11 + movdqa 112(%rbp),%xmm15 + leaq 128(%rbp),%rbp + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd $0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 +.byte 102,76,15,126,194 + +.byte 0xc4,0x62,0xfb,0xf6,0x86,0x00,0x00,0x00,0x00 adcxq %rax,%rbx adoxq %r9,%r8 mulxq 8(%rsi),%rax,%r9 -.byte 0x66,0x0f,0x6e,0xa5,0x00,0x00,0x00,0x00 adcxq %rax,%r8 adoxq %r10,%r9 mulxq 16(%rsi),%rax,%r10 - movd 64(%rbp),%xmm5 - leaq 128(%rbp),%rbp adcxq %rax,%r9 adoxq %r11,%r10 .byte 0xc4,0x62,0xfb,0xf6,0x9e,0x18,0x00,0x00,0x00 - pslldq $4,%xmm5 - por %xmm5,%xmm4 adcxq %rax,%r10 adoxq %r12,%r11 @@ -1017,10 +1100,10 @@ rsaz_512_mul_gather4: .byte 0xc4,0x62,0xfb,0xf6,0xb6,0x30,0x00,0x00,0x00 adcxq %rax,%r13 +.byte 0x67 adoxq %r15,%r14 mulxq 56(%rsi),%rax,%r15 -.byte 102,72,15,126,226 movq %rbx,64(%rsp,%rcx,8) adcxq %rax,%r14 adoxq %rdi,%r15 @@ -1039,10 +1122,10 @@ rsaz_512_mul_gather4: movq %r14,64+48(%rsp) movq %r15,64+56(%rsp) -.byte 102,72,15,126,199 -.byte 102,72,15,126,205 - movq 128(%rsp),%rdx + movq 128+8(%rsp),%rdi + movq 128+16(%rsp),%rbp + movq (%rsp),%r8 movq 8(%rsp),%r9 movq 16(%rsp),%r10 @@ -1092,16 +1175,16 @@ rsaz_512_mul_scatter4: movl %r9d,%r9d subq $128+24,%rsp .Lmul_scatter4_body: - leaq (%r8,%r9,4),%r8 + leaq (%r8,%r9,8),%r8 .byte 102,72,15,110,199 .byte 102,72,15,110,202 .byte 102,73,15,110,208 movq %rcx,128(%rsp) movq %rdi,%rbp - movl $524544,%r11d + movl $0x80100,%r11d andl OPENSSL_ia32cap_P+8(%rip),%r11d - cmpl $524544,%r11d + cmpl $0x80100,%r11d je .Lmulx_scatter movq (%rdi),%rbx call __rsaz_512_mul @@ -1155,30 +1238,14 @@ rsaz_512_mul_scatter4: call __rsaz_512_subtract - movl %r8d,0(%rsi) - shrq $32,%r8 - movl %r9d,128(%rsi) - shrq $32,%r9 - movl %r10d,256(%rsi) - shrq $32,%r10 - movl %r11d,384(%rsi) - shrq $32,%r11 - movl %r12d,512(%rsi) - shrq $32,%r12 - movl %r13d,640(%rsi) - shrq $32,%r13 - movl %r14d,768(%rsi) - shrq $32,%r14 - movl %r15d,896(%rsi) - shrq $32,%r15 - movl %r8d,64(%rsi) - movl %r9d,192(%rsi) - movl %r10d,320(%rsi) - movl %r11d,448(%rsi) - movl %r12d,576(%rsi) - movl %r13d,704(%rsi) - movl %r14d,832(%rsi) - movl %r15d,960(%rsi) + movq %r8,0(%rsi) + movq %r9,128(%rsi) + movq %r10,256(%rsi) + movq %r11,384(%rsi) + movq %r12,512(%rsi) + movq %r13,640(%rsi) + movq %r14,768(%rsi) + movq %r15,896(%rsi) leaq 128+24+48(%rsp),%rax movq -48(%rax),%r15 @@ -1225,8 +1292,8 @@ rsaz_512_mul_by_one: movdqa %xmm0,64(%rsp) movdqa %xmm0,80(%rsp) movdqa %xmm0,96(%rsp) - andl $524544,%eax - cmpl $524544,%eax + andl $0x80100,%eax + cmpl $0x80100,%eax je .Lby_one_callx call __rsaz_512_reduce jmp .Lby_one_tail @@ -1717,16 +1784,14 @@ __rsaz_512_mulx: .type rsaz_512_scatter4,@function .align 16 rsaz_512_scatter4: - leaq (%rdi,%rdx,4),%rdi + leaq (%rdi,%rdx,8),%rdi movl $8,%r9d jmp .Loop_scatter .align 16 .Loop_scatter: movq (%rsi),%rax leaq 8(%rsi),%rsi - movl %eax,(%rdi) - shrq $32,%rax - movl %eax,64(%rdi) + movq %rax,(%rdi) leaq 128(%rdi),%rdi decl %r9d jnz .Loop_scatter @@ -1737,19 +1802,72 @@ rsaz_512_scatter4: .type rsaz_512_gather4,@function .align 16 rsaz_512_gather4: - leaq (%rsi,%rdx,4),%rsi + movd %edx,%xmm8 + movdqa .Linc+16(%rip),%xmm1 + movdqa .Linc(%rip),%xmm0 + + pshufd $0,%xmm8,%xmm8 + movdqa %xmm1,%xmm7 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm8,%xmm0 + movdqa %xmm7,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm8,%xmm1 + movdqa %xmm7,%xmm4 + paddd %xmm2,%xmm3 + pcmpeqd %xmm8,%xmm2 + movdqa %xmm7,%xmm5 + paddd %xmm3,%xmm4 + pcmpeqd %xmm8,%xmm3 + movdqa %xmm7,%xmm6 + paddd %xmm4,%xmm5 + pcmpeqd %xmm8,%xmm4 + paddd %xmm5,%xmm6 + pcmpeqd %xmm8,%xmm5 + paddd %xmm6,%xmm7 + pcmpeqd %xmm8,%xmm6 + pcmpeqd %xmm8,%xmm7 movl $8,%r9d jmp .Loop_gather .align 16 .Loop_gather: - movl (%rsi),%eax - movl 64(%rsi),%r8d + movdqa 0(%rsi),%xmm8 + movdqa 16(%rsi),%xmm9 + movdqa 32(%rsi),%xmm10 + movdqa 48(%rsi),%xmm11 + pand %xmm0,%xmm8 + movdqa 64(%rsi),%xmm12 + pand %xmm1,%xmm9 + movdqa 80(%rsi),%xmm13 + pand %xmm2,%xmm10 + movdqa 96(%rsi),%xmm14 + pand %xmm3,%xmm11 + movdqa 112(%rsi),%xmm15 leaq 128(%rsi),%rsi - shlq $32,%r8 - orq %r8,%rax - movq %rax,(%rdi) + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd $0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 + movq %xmm8,(%rdi) leaq 8(%rdi),%rdi decl %r9d jnz .Loop_gather .byte 0xf3,0xc3 +.LSEH_end_rsaz_512_gather4: .size rsaz_512_gather4,.-rsaz_512_gather4 + +.align 64 +.Linc: +.long 0,0, 1,1 +.long 2,2, 2,2 diff --git a/vendor/openssl/asm/x64-elf-gas/bn/x86_64-gf2m.s b/vendor/openssl/asm/x64-elf-gas/bn/x86_64-gf2m.s index eed057ad6..f4e533756 100644 --- a/vendor/openssl/asm/x64-elf-gas/bn/x86_64-gf2m.s +++ b/vendor/openssl/asm/x64-elf-gas/bn/x86_64-gf2m.s @@ -242,7 +242,7 @@ bn_GF2m_mul_2x2: movq %rcx,56(%rsp) movq %r8,64(%rsp) - movq $15,%r8 + movq $0xf,%r8 movq %rsi,%rax movq %rcx,%rbp call _mul_1x1 diff --git a/vendor/openssl/asm/x64-elf-gas/bn/x86_64-mont.s b/vendor/openssl/asm/x64-elf-gas/bn/x86_64-mont.s index 45d19cd8b..b4fb5fe7e 100644 --- a/vendor/openssl/asm/x64-elf-gas/bn/x86_64-mont.s +++ b/vendor/openssl/asm/x64-elf-gas/bn/x86_64-mont.s @@ -35,6 +35,20 @@ bn_mul_mont: movq %r11,8(%rsp,%r9,8) .Lmul_body: + + + + + + + subq %rsp,%r11 + andq $-4096,%r11 +.Lmul_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x66,0x2e + jnc .Lmul_page_walk + movq %rdx,%r12 movq (%r8),%r8 movq (%r12),%rbx @@ -216,8 +230,8 @@ bn_mul_mont: .align 16 bn_mul4x_mont: .Lmul4x_enter: - andl $524544,%r11d - cmpl $524544,%r11d + andl $0x80100,%r11d + cmpl $0x80100,%r11d je .Lmulx4x_enter pushq %rbx pushq %rbp @@ -235,6 +249,14 @@ bn_mul4x_mont: movq %r11,8(%rsp,%r9,8) .Lmul4x_body: + subq %rsp,%r11 + andq $-4096,%r11 +.Lmul4x_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc .Lmul4x_page_walk + movq %rdi,16(%rsp,%r9,8) movq %rdx,%r12 movq (%r8),%r8 @@ -638,96 +660,131 @@ bn_sqr8x_mont: - leaq -64(%rsp,%r9,4),%r11 + leaq -64(%rsp,%r9,2),%r11 movq (%r8),%r8 subq %rsi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb .Lsqr8x_sp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,4),%rsp + leaq -64(%rsp,%r9,2),%rsp jmp .Lsqr8x_sp_done .align 32 .Lsqr8x_sp_alt: - leaq 4096-64(,%r9,4),%r10 - leaq -64(%rsp,%r9,4),%rsp + leaq 4096-64(,%r9,2),%r10 + leaq -64(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp .Lsqr8x_sp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +.Lsqr8x_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc .Lsqr8x_page_walk + movq %r9,%r10 negq %r9 - leaq 64(%rsp,%r9,2),%r11 movq %r8,32(%rsp) movq %rax,40(%rsp) .Lsqr8x_body: - movq %r9,%rbp -.byte 102,73,15,110,211 - shrq $3+2,%rbp - movl OPENSSL_ia32cap_P+8(%rip),%eax - jmp .Lsqr8x_copy_n - -.align 32 -.Lsqr8x_copy_n: - movq 0(%rcx),%xmm0 - movq 8(%rcx),%xmm1 - movq 16(%rcx),%xmm3 - movq 24(%rcx),%xmm4 - leaq 32(%rcx),%rcx - movdqa %xmm0,0(%r11) - movdqa %xmm1,16(%r11) - movdqa %xmm3,32(%r11) - movdqa %xmm4,48(%r11) - leaq 64(%r11),%r11 - decq %rbp - jnz .Lsqr8x_copy_n - +.byte 102,72,15,110,209 pxor %xmm0,%xmm0 .byte 102,72,15,110,207 .byte 102,73,15,110,218 - andl $524544,%eax - cmpl $524544,%eax + movl OPENSSL_ia32cap_P+8(%rip),%eax + andl $0x80100,%eax + cmpl $0x80100,%eax jne .Lsqr8x_nox call bn_sqrx8x_internal - pxor %xmm0,%xmm0 - leaq 48(%rsp),%rax - leaq 64(%rsp,%r9,2),%rdx - shrq $3+2,%r9 - movq 40(%rsp),%rsi - jmp .Lsqr8x_zero + + + + leaq (%r8,%rcx,1),%rbx + movq %rcx,%r9 + movq %rcx,%rdx +.byte 102,72,15,126,207 + sarq $3+2,%rcx + jmp .Lsqr8x_sub .align 32 .Lsqr8x_nox: call bn_sqr8x_internal + + + + leaq (%rdi,%r9,1),%rbx + movq %r9,%rcx + movq %r9,%rdx +.byte 102,72,15,126,207 + sarq $3+2,%rcx + jmp .Lsqr8x_sub + +.align 32 +.Lsqr8x_sub: + movq 0(%rbx),%r12 + movq 8(%rbx),%r13 + movq 16(%rbx),%r14 + movq 24(%rbx),%r15 + leaq 32(%rbx),%rbx + sbbq 0(%rbp),%r12 + sbbq 8(%rbp),%r13 + sbbq 16(%rbp),%r14 + sbbq 24(%rbp),%r15 + leaq 32(%rbp),%rbp + movq %r12,0(%rdi) + movq %r13,8(%rdi) + movq %r14,16(%rdi) + movq %r15,24(%rdi) + leaq 32(%rdi),%rdi + incq %rcx + jnz .Lsqr8x_sub + + sbbq $0,%rax + leaq (%rbx,%r9,1),%rbx + leaq (%rdi,%r9,1),%rdi + +.byte 102,72,15,110,200 pxor %xmm0,%xmm0 - leaq 48(%rsp),%rax - leaq 64(%rsp,%r9,2),%rdx - shrq $3+2,%r9 + pshufd $0,%xmm1,%xmm1 movq 40(%rsp),%rsi - jmp .Lsqr8x_zero + jmp .Lsqr8x_cond_copy .align 32 -.Lsqr8x_zero: - movdqa %xmm0,0(%rax) - movdqa %xmm0,16(%rax) - movdqa %xmm0,32(%rax) - movdqa %xmm0,48(%rax) - leaq 64(%rax),%rax - movdqa %xmm0,0(%rdx) - movdqa %xmm0,16(%rdx) - movdqa %xmm0,32(%rdx) - movdqa %xmm0,48(%rdx) - leaq 64(%rdx),%rdx - decq %r9 - jnz .Lsqr8x_zero +.Lsqr8x_cond_copy: + movdqa 0(%rbx),%xmm2 + movdqa 16(%rbx),%xmm3 + leaq 32(%rbx),%rbx + movdqu 0(%rdi),%xmm4 + movdqu 16(%rdi),%xmm5 + leaq 32(%rdi),%rdi + movdqa %xmm0,-32(%rbx) + movdqa %xmm0,-16(%rbx) + movdqa %xmm0,-32(%rbx,%rdx,1) + movdqa %xmm0,-16(%rbx,%rdx,1) + pcmpeqd %xmm1,%xmm0 + pand %xmm1,%xmm2 + pand %xmm1,%xmm3 + pand %xmm0,%xmm4 + pand %xmm0,%xmm5 + pxor %xmm0,%xmm0 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqu %xmm4,-32(%rdi) + movdqu %xmm5,-16(%rdi) + addq $32,%r9 + jnz .Lsqr8x_cond_copy movq $1,%rax movq -48(%rsi),%r15 @@ -758,8 +815,17 @@ bn_mulx4x_mont: subq %r9,%r10 movq (%r8),%r8 leaq -72(%rsp,%r10,1),%rsp - leaq (%rdx,%r9,1),%r10 andq $-128,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +.Lmulx4x_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x66,0x2e + jnc .Lmulx4x_page_walk + + leaq (%rdx,%r9,1),%r10 @@ -982,64 +1048,75 @@ bn_mulx4x_mont: adcq %rbp,%r15 subq 0(%rbx),%rbp adcq %r15,%r14 - movq -8(%rcx),%r8 sbbq %r15,%r15 movq %r14,-8(%rbx) cmpq 16(%rsp),%rdi jne .Lmulx4x_outer - subq %r14,%r8 - sbbq %r8,%r8 - orq %r8,%r15 - - negq %rax - xorq %rdx,%rdx + leaq 64(%rsp),%rbx + subq %rax,%rcx + negq %r15 + movq %rax,%rdx + shrq $3+2,%rax movq 32(%rsp),%rdi + jmp .Lmulx4x_sub + +.align 32 +.Lmulx4x_sub: + movq 0(%rbx),%r11 + movq 8(%rbx),%r12 + movq 16(%rbx),%r13 + movq 24(%rbx),%r14 + leaq 32(%rbx),%rbx + sbbq 0(%rcx),%r11 + sbbq 8(%rcx),%r12 + sbbq 16(%rcx),%r13 + sbbq 24(%rcx),%r14 + leaq 32(%rcx),%rcx + movq %r11,0(%rdi) + movq %r12,8(%rdi) + movq %r13,16(%rdi) + movq %r14,24(%rdi) + leaq 32(%rdi),%rdi + decq %rax + jnz .Lmulx4x_sub + + sbbq $0,%r15 leaq 64(%rsp),%rbx + subq %rdx,%rdi +.byte 102,73,15,110,207 pxor %xmm0,%xmm0 - movq 0(%rcx,%rax,1),%r8 - movq 8(%rcx,%rax,1),%r9 - negq %r8 - jmp .Lmulx4x_sub_entry + pshufd $0,%xmm1,%xmm1 + movq 40(%rsp),%rsi + jmp .Lmulx4x_cond_copy .align 32 -.Lmulx4x_sub: - movq 0(%rcx,%rax,1),%r8 - movq 8(%rcx,%rax,1),%r9 - notq %r8 -.Lmulx4x_sub_entry: - movq 16(%rcx,%rax,1),%r10 - notq %r9 - andq %r15,%r8 - movq 24(%rcx,%rax,1),%r11 - notq %r10 - andq %r15,%r9 - notq %r11 - andq %r15,%r10 - andq %r15,%r11 - - negq %rdx - adcq 0(%rbx),%r8 - adcq 8(%rbx),%r9 - movdqa %xmm0,(%rbx) - adcq 16(%rbx),%r10 - adcq 24(%rbx),%r11 - movdqa %xmm0,16(%rbx) +.Lmulx4x_cond_copy: + movdqa 0(%rbx),%xmm2 + movdqa 16(%rbx),%xmm3 leaq 32(%rbx),%rbx - sbbq %rdx,%rdx - - movq %r8,0(%rdi) - movq %r9,8(%rdi) - movq %r10,16(%rdi) - movq %r11,24(%rdi) + movdqu 0(%rdi),%xmm4 + movdqu 16(%rdi),%xmm5 leaq 32(%rdi),%rdi + movdqa %xmm0,-32(%rbx) + movdqa %xmm0,-16(%rbx) + pcmpeqd %xmm1,%xmm0 + pand %xmm1,%xmm2 + pand %xmm1,%xmm3 + pand %xmm0,%xmm4 + pand %xmm0,%xmm5 + pxor %xmm0,%xmm0 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqu %xmm4,-32(%rdi) + movdqu %xmm5,-16(%rdi) + subq $32,%rdx + jnz .Lmulx4x_cond_copy - addq $32,%rax - jnz .Lmulx4x_sub + movq %rdx,(%rbx) - movq 40(%rsp),%rsi movq $1,%rax movq -48(%rsi),%r15 movq -40(%rsi),%r14 diff --git a/vendor/openssl/asm/x64-elf-gas/bn/x86_64-mont5.s b/vendor/openssl/asm/x64-elf-gas/bn/x86_64-mont5.s index 41e96c8e9..e4dfd8346 100644 --- a/vendor/openssl/asm/x64-elf-gas/bn/x86_64-mont5.s +++ b/vendor/openssl/asm/x64-elf-gas/bn/x86_64-mont5.s @@ -15,46 +15,165 @@ bn_mul_mont_gather5: .Lmul_enter: movl %r9d,%r9d movq %rsp,%rax - movl 8(%rsp),%r10d + movd 8(%rsp),%xmm5 + leaq .Linc(%rip),%r10 pushq %rbx pushq %rbp pushq %r12 pushq %r13 pushq %r14 pushq %r15 + leaq 2(%r9),%r11 negq %r11 - leaq (%rsp,%r11,8),%rsp + leaq -264(%rsp,%r11,8),%rsp andq $-1024,%rsp movq %rax,8(%rsp,%r9,8) .Lmul_body: - movq %rdx,%r12 - movq %r10,%r11 - shrq $3,%r10 - andq $7,%r11 - notq %r10 - leaq .Lmagic_masks(%rip),%rax - andq $3,%r10 - leaq 96(%r12,%r11,8),%r12 - movq 0(%rax,%r10,8),%xmm4 - movq 8(%rax,%r10,8),%xmm5 - movq 16(%rax,%r10,8),%xmm6 - movq 24(%rax,%r10,8),%xmm7 - - movq -96(%r12),%xmm0 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - movq 96(%r12),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 + + + + + + + subq %rsp,%rax + andq $-4096,%rax +.Lmul_page_walk: + movq (%rsp,%rax,1),%r11 + subq $4096,%rax +.byte 0x2e + jnc .Lmul_page_walk + + leaq 128(%rdx),%r12 + movdqa 0(%r10),%xmm0 + movdqa 16(%r10),%xmm1 + leaq 24-112(%rsp,%r9,8),%r10 + andq $-16,%r10 + + pshufd $0,%xmm5,%xmm5 + movdqa %xmm1,%xmm4 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 +.byte 0x67 + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,112(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,128(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,144(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,160(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,176(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,192(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,208(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,224(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,240(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,256(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,272(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,288(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,304(%r10) + + paddd %xmm2,%xmm3 +.byte 0x67 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,320(%r10) + + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,336(%r10) + pand 64(%r12),%xmm0 + + pand 80(%r12),%xmm1 + pand 96(%r12),%xmm2 + movdqa %xmm3,352(%r10) + pand 112(%r12),%xmm3 por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -128(%r12),%xmm4 + movdqa -112(%r12),%xmm5 + movdqa -96(%r12),%xmm2 + pand 112(%r10),%xmm4 + movdqa -80(%r12),%xmm3 + pand 128(%r10),%xmm5 + por %xmm4,%xmm0 + pand 144(%r10),%xmm2 + por %xmm5,%xmm1 + pand 160(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -64(%r12),%xmm4 + movdqa -48(%r12),%xmm5 + movdqa -32(%r12),%xmm2 + pand 176(%r10),%xmm4 + movdqa -16(%r12),%xmm3 + pand 192(%r10),%xmm5 + por %xmm4,%xmm0 + pand 208(%r10),%xmm2 + por %xmm5,%xmm1 + pand 224(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa 0(%r12),%xmm4 + movdqa 16(%r12),%xmm5 + movdqa 32(%r12),%xmm2 + pand 240(%r10),%xmm4 + movdqa 48(%r12),%xmm3 + pand 256(%r10),%xmm5 + por %xmm4,%xmm0 + pand 272(%r10),%xmm2 + por %xmm5,%xmm1 + pand 288(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + por %xmm1,%xmm0 + pshufd $0x4e,%xmm0,%xmm1 + por %xmm1,%xmm0 leaq 256(%r12),%r12 - por %xmm3,%xmm0 - .byte 102,72,15,126,195 movq (%r8),%r8 @@ -63,29 +182,14 @@ bn_mul_mont_gather5: xorq %r14,%r14 xorq %r15,%r15 - movq -96(%r12),%xmm0 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - movq %r8,%rbp mulq %rbx movq %rax,%r10 movq (%rcx),%rax - movq 96(%r12),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 - imulq %r10,%rbp movq %rdx,%r11 - por %xmm2,%xmm0 - leaq 256(%r12),%r12 - por %xmm3,%xmm0 - mulq %rbp addq %rax,%r10 movq 8(%rsi),%rax @@ -118,14 +222,12 @@ bn_mul_mont_gather5: cmpq %r9,%r15 jne .L1st -.byte 102,72,15,126,195 addq %rax,%r13 - movq (%rsi),%rax adcq $0,%rdx addq %r11,%r13 adcq $0,%rdx - movq %r13,-16(%rsp,%r15,8) + movq %r13,-16(%rsp,%r9,8) movq %rdx,%r13 movq %r10,%r11 @@ -139,33 +241,78 @@ bn_mul_mont_gather5: jmp .Louter .align 16 .Louter: + leaq 24+128(%rsp,%r9,8),%rdx + andq $-16,%rdx + pxor %xmm4,%xmm4 + pxor %xmm5,%xmm5 + movdqa -128(%r12),%xmm0 + movdqa -112(%r12),%xmm1 + movdqa -96(%r12),%xmm2 + movdqa -80(%r12),%xmm3 + pand -128(%rdx),%xmm0 + pand -112(%rdx),%xmm1 + por %xmm0,%xmm4 + pand -96(%rdx),%xmm2 + por %xmm1,%xmm5 + pand -80(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa -64(%r12),%xmm0 + movdqa -48(%r12),%xmm1 + movdqa -32(%r12),%xmm2 + movdqa -16(%r12),%xmm3 + pand -64(%rdx),%xmm0 + pand -48(%rdx),%xmm1 + por %xmm0,%xmm4 + pand -32(%rdx),%xmm2 + por %xmm1,%xmm5 + pand -16(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 0(%r12),%xmm0 + movdqa 16(%r12),%xmm1 + movdqa 32(%r12),%xmm2 + movdqa 48(%r12),%xmm3 + pand 0(%rdx),%xmm0 + pand 16(%rdx),%xmm1 + por %xmm0,%xmm4 + pand 32(%rdx),%xmm2 + por %xmm1,%xmm5 + pand 48(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 64(%r12),%xmm0 + movdqa 80(%r12),%xmm1 + movdqa 96(%r12),%xmm2 + movdqa 112(%r12),%xmm3 + pand 64(%rdx),%xmm0 + pand 80(%rdx),%xmm1 + por %xmm0,%xmm4 + pand 96(%rdx),%xmm2 + por %xmm1,%xmm5 + pand 112(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + por %xmm5,%xmm4 + pshufd $0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 + leaq 256(%r12),%r12 + + movq (%rsi),%rax +.byte 102,72,15,126,195 + xorq %r15,%r15 movq %r8,%rbp movq (%rsp),%r10 - movq -96(%r12),%xmm0 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - mulq %rbx addq %rax,%r10 movq (%rcx),%rax adcq $0,%rdx - movq 96(%r12),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 - imulq %r10,%rbp movq %rdx,%r11 - por %xmm2,%xmm0 - leaq 256(%r12),%r12 - por %xmm3,%xmm0 - mulq %rbp addq %rax,%r10 movq 8(%rsi),%rax @@ -201,15 +348,12 @@ bn_mul_mont_gather5: cmpq %r9,%r15 jne .Linner -.byte 102,72,15,126,195 - addq %rax,%r13 - movq (%rsi),%rax adcq $0,%rdx addq %r10,%r13 - movq (%rsp,%r15,8),%r10 + movq (%rsp,%r9,8),%r10 adcq $0,%rdx - movq %r13,-16(%rsp,%r15,8) + movq %r13,-16(%rsp,%r9,8) movq %rdx,%r13 xorq %rdx,%rdx @@ -256,6 +400,7 @@ bn_mul_mont_gather5: movq 8(%rsp,%r9,8),%rsi movq $1,%rax + movq -48(%rsi),%r15 movq -40(%rsi),%r14 movq -32(%rsi),%r13 @@ -270,8 +415,8 @@ bn_mul_mont_gather5: .align 32 bn_mul4x_mont_gather5: .Lmul4x_enter: - andl $524544,%r11d - cmpl $524544,%r11d + andl $0x80108,%r11d + cmpl $0x80108,%r11d je .Lmulx4x_enter .byte 0x67 movq %rsp,%rax @@ -281,10 +426,10 @@ bn_mul4x_mont_gather5: pushq %r13 pushq %r14 pushq %r15 + .byte 0x67 - movl %r9d,%r10d shll $3,%r9d - shll $3+2,%r10d + leaq (%r9,%r9,2),%r10 negq %r9 @@ -294,25 +439,36 @@ bn_mul4x_mont_gather5: - leaq -64(%rsp,%r9,2),%r11 - subq %rsi,%r11 + + + leaq -320(%rsp,%r9,2),%r11 + subq %rdi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb .Lmul4xsp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,2),%rsp + leaq -320(%rsp,%r9,2),%rsp jmp .Lmul4xsp_done .align 32 .Lmul4xsp_alt: - leaq 4096-64(,%r9,2),%r10 - leaq -64(%rsp,%r9,2),%rsp + leaq 4096-320(,%r9,2),%r10 + leaq -320(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp .Lmul4xsp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +.Lmul4x_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc .Lmul4x_page_walk + negq %r9 movq %rax,40(%rsp) @@ -322,6 +478,7 @@ bn_mul4x_mont_gather5: movq 40(%rsp),%rsi movq $1,%rax + movq -48(%rsi),%r15 movq -40(%rsi),%r14 movq -32(%rsi),%r13 @@ -337,47 +494,141 @@ bn_mul4x_mont_gather5: .align 32 mul4x_internal: shlq $5,%r9 - movl 8(%rax),%r10d - leaq 256(%rdx,%r9,1),%r13 + movd 8(%rax),%xmm5 + leaq .Linc(%rip),%rax + leaq 128(%rdx,%r9,1),%r13 shrq $5,%r9 - movq %r10,%r11 - shrq $3,%r10 - andq $7,%r11 - notq %r10 - leaq .Lmagic_masks(%rip),%rax - andq $3,%r10 - leaq 96(%rdx,%r11,8),%r12 - movq 0(%rax,%r10,8),%xmm4 - movq 8(%rax,%r10,8),%xmm5 - addq $7,%r11 - movq 16(%rax,%r10,8),%xmm6 - movq 24(%rax,%r10,8),%xmm7 - andq $7,%r11 - - movq -96(%r12),%xmm0 - leaq 256(%r12),%r14 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - movq 96(%r12),%xmm3 - pand %xmm6,%xmm2 -.byte 0x67 - por %xmm1,%xmm0 - movq -96(%r14),%xmm1 -.byte 0x67 - pand %xmm7,%xmm3 -.byte 0x67 - por %xmm2,%xmm0 - movq -32(%r14),%xmm2 + movdqa 0(%rax),%xmm0 + movdqa 16(%rax),%xmm1 + leaq 88-112(%rsp,%r9,1),%r10 + leaq 128(%rdx),%r12 + + pshufd $0,%xmm5,%xmm5 + movdqa %xmm1,%xmm4 +.byte 0x67,0x67 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 .byte 0x67 - pand %xmm4,%xmm1 + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,112(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,128(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,144(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,160(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,176(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,192(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,208(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,224(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,240(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,256(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,272(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,288(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,304(%r10) + + paddd %xmm2,%xmm3 .byte 0x67 - por %xmm3,%xmm0 - movq 32(%r14),%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,320(%r10) + + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,336(%r10) + pand 64(%r12),%xmm0 + pand 80(%r12),%xmm1 + pand 96(%r12),%xmm2 + movdqa %xmm3,352(%r10) + pand 112(%r12),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -128(%r12),%xmm4 + movdqa -112(%r12),%xmm5 + movdqa -96(%r12),%xmm2 + pand 112(%r10),%xmm4 + movdqa -80(%r12),%xmm3 + pand 128(%r10),%xmm5 + por %xmm4,%xmm0 + pand 144(%r10),%xmm2 + por %xmm5,%xmm1 + pand 160(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -64(%r12),%xmm4 + movdqa -48(%r12),%xmm5 + movdqa -32(%r12),%xmm2 + pand 176(%r10),%xmm4 + movdqa -16(%r12),%xmm3 + pand 192(%r10),%xmm5 + por %xmm4,%xmm0 + pand 208(%r10),%xmm2 + por %xmm5,%xmm1 + pand 224(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa 0(%r12),%xmm4 + movdqa 16(%r12),%xmm5 + movdqa 32(%r12),%xmm2 + pand 240(%r10),%xmm4 + movdqa 48(%r12),%xmm3 + pand 256(%r10),%xmm5 + por %xmm4,%xmm0 + pand 272(%r10),%xmm2 + por %xmm5,%xmm1 + pand 288(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + por %xmm1,%xmm0 + pshufd $0x4e,%xmm0,%xmm1 + por %xmm1,%xmm0 + leaq 256(%r12),%r12 .byte 102,72,15,126,195 - movq 96(%r14),%xmm0 + movq %r13,16+8(%rsp) movq %rdi,56+8(%rsp) @@ -391,26 +642,10 @@ mul4x_internal: movq %rax,%r10 movq (%rcx),%rax - pand %xmm5,%xmm2 - pand %xmm6,%xmm3 - por %xmm2,%xmm1 - imulq %r10,%rbp - - - - - - - - leaq 64+8(%rsp,%r11,8),%r14 + leaq 64+8(%rsp),%r14 movq %rdx,%r11 - pand %xmm7,%xmm0 - por %xmm3,%xmm1 - leaq 512(%r12),%r12 - por %xmm1,%xmm0 - mulq %rbp addq %rax,%r10 movq 8(%rsi,%r9,1),%rax @@ -419,7 +654,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 - movq 16(%rcx),%rax + movq 8(%rcx),%rax adcq $0,%rdx movq %rdx,%r10 @@ -429,7 +664,7 @@ mul4x_internal: adcq $0,%rdx addq %r11,%rdi leaq 32(%r9),%r15 - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx adcq $0,%rdx movq %rdi,(%r14) movq %rdx,%r13 @@ -439,7 +674,7 @@ mul4x_internal: .L1st4x: mulq %rbx addq %rax,%r10 - movq -32(%rcx),%rax + movq -16(%rcx),%rax leaq 32(%r14),%r14 adcq $0,%rdx movq %rdx,%r11 @@ -455,7 +690,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 - movq -16(%rcx),%rax + movq -8(%rcx),%rax adcq $0,%rdx movq %rdx,%r10 @@ -485,7 +720,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 - movq 16(%rcx),%rax + movq 8(%rcx),%rax adcq $0,%rdx movq %rdx,%r10 @@ -494,7 +729,7 @@ mul4x_internal: movq 16(%rsi,%r15,1),%rax adcq $0,%rdx addq %r11,%rdi - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx adcq $0,%rdx movq %rdi,(%r14) movq %rdx,%r13 @@ -504,7 +739,7 @@ mul4x_internal: mulq %rbx addq %rax,%r10 - movq -32(%rcx),%rax + movq -16(%rcx),%rax leaq 32(%r14),%r14 adcq $0,%rdx movq %rdx,%r11 @@ -520,7 +755,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 - movq -16(%rcx),%rax + movq -8(%rcx),%rax adcq $0,%rdx movq %rdx,%r10 @@ -533,8 +768,7 @@ mul4x_internal: movq %rdi,-16(%r14) movq %rdx,%r13 -.byte 102,72,15,126,195 - leaq (%rcx,%r9,2),%rcx + leaq (%rcx,%r9,1),%rcx xorq %rdi,%rdi addq %r10,%r13 @@ -545,6 +779,63 @@ mul4x_internal: .align 32 .Louter4x: + leaq 16+128(%r14),%rdx + pxor %xmm4,%xmm4 + pxor %xmm5,%xmm5 + movdqa -128(%r12),%xmm0 + movdqa -112(%r12),%xmm1 + movdqa -96(%r12),%xmm2 + movdqa -80(%r12),%xmm3 + pand -128(%rdx),%xmm0 + pand -112(%rdx),%xmm1 + por %xmm0,%xmm4 + pand -96(%rdx),%xmm2 + por %xmm1,%xmm5 + pand -80(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa -64(%r12),%xmm0 + movdqa -48(%r12),%xmm1 + movdqa -32(%r12),%xmm2 + movdqa -16(%r12),%xmm3 + pand -64(%rdx),%xmm0 + pand -48(%rdx),%xmm1 + por %xmm0,%xmm4 + pand -32(%rdx),%xmm2 + por %xmm1,%xmm5 + pand -16(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 0(%r12),%xmm0 + movdqa 16(%r12),%xmm1 + movdqa 32(%r12),%xmm2 + movdqa 48(%r12),%xmm3 + pand 0(%rdx),%xmm0 + pand 16(%rdx),%xmm1 + por %xmm0,%xmm4 + pand 32(%rdx),%xmm2 + por %xmm1,%xmm5 + pand 48(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 64(%r12),%xmm0 + movdqa 80(%r12),%xmm1 + movdqa 96(%r12),%xmm2 + movdqa 112(%r12),%xmm3 + pand 64(%rdx),%xmm0 + pand 80(%rdx),%xmm1 + por %xmm0,%xmm4 + pand 96(%rdx),%xmm2 + por %xmm1,%xmm5 + pand 112(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + por %xmm5,%xmm4 + pshufd $0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 + leaq 256(%r12),%r12 +.byte 102,72,15,126,195 + movq (%r14,%r9,1),%r10 movq %r8,%rbp mulq %rbx @@ -552,25 +843,11 @@ mul4x_internal: movq (%rcx),%rax adcq $0,%rdx - movq -96(%r12),%xmm0 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - movq 96(%r12),%xmm3 - imulq %r10,%rbp -.byte 0x67 movq %rdx,%r11 movq %rdi,(%r14) - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 - por %xmm2,%xmm0 leaq (%r14,%r9,1),%r14 - leaq 256(%r12),%r12 - por %xmm3,%xmm0 mulq %rbp addq %rax,%r10 @@ -580,7 +857,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 - movq 16(%rcx),%rax + movq 8(%rcx),%rax adcq $0,%rdx addq 8(%r14),%r11 adcq $0,%rdx @@ -592,7 +869,7 @@ mul4x_internal: adcq $0,%rdx addq %r11,%rdi leaq 32(%r9),%r15 - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx adcq $0,%rdx movq %rdx,%r13 jmp .Linner4x @@ -601,7 +878,7 @@ mul4x_internal: .Linner4x: mulq %rbx addq %rax,%r10 - movq -32(%rcx),%rax + movq -16(%rcx),%rax adcq $0,%rdx addq 16(%r14),%r10 leaq 32(%r14),%r14 @@ -619,7 +896,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 - movq -16(%rcx),%rax + movq -8(%rcx),%rax adcq $0,%rdx addq -8(%r14),%r11 adcq $0,%rdx @@ -653,7 +930,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 - movq 16(%rcx),%rax + movq 8(%rcx),%rax adcq $0,%rdx addq 8(%r14),%r11 adcq $0,%rdx @@ -664,7 +941,7 @@ mul4x_internal: movq 16(%rsi,%r15,1),%rax adcq $0,%rdx addq %r11,%rdi - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx adcq $0,%rdx movq %r13,-8(%r14) movq %rdx,%r13 @@ -674,7 +951,7 @@ mul4x_internal: mulq %rbx addq %rax,%r10 - movq -32(%rcx),%rax + movq -16(%rcx),%rax adcq $0,%rdx addq 16(%r14),%r10 leaq 32(%r14),%r14 @@ -693,7 +970,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 movq %rbp,%rax - movq -16(%rcx),%rbp + movq -8(%rcx),%rbp adcq $0,%rdx addq -8(%r14),%r11 adcq $0,%rdx @@ -708,9 +985,8 @@ mul4x_internal: movq %r13,-24(%r14) movq %rdx,%r13 -.byte 102,72,15,126,195 movq %rdi,-16(%r14) - leaq (%rcx,%r9,2),%rcx + leaq (%rcx,%r9,1),%rcx xorq %rdi,%rdi addq %r10,%r13 @@ -721,24 +997,31 @@ mul4x_internal: cmpq 16+8(%rsp),%r12 jb .Louter4x + xorq %rax,%rax subq %r13,%rbp adcq %r15,%r15 orq %r15,%rdi - xorq $1,%rdi + subq %rdi,%rax leaq (%r14,%r9,1),%rbx - leaq (%rcx,%rdi,8),%rbp + movq (%rcx),%r12 + leaq (%rcx),%rbp movq %r9,%rcx sarq $3+2,%rcx movq 56+8(%rsp),%rdi - jmp .Lsqr4x_sub + decq %r12 + xorq %r10,%r10 + movq 8(%rbp),%r13 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 + jmp .Lsqr4x_sub_entry .size mul4x_internal,.-mul4x_internal .globl bn_power5 .type bn_power5,@function .align 32 bn_power5: movl OPENSSL_ia32cap_P+8(%rip),%r11d - andl $524544,%r11d - cmpl $524544,%r11d + andl $0x80108,%r11d + cmpl $0x80108,%r11d je .Lpowerx5_enter movq %rsp,%rax pushq %rbx @@ -747,9 +1030,9 @@ bn_power5: pushq %r13 pushq %r14 pushq %r15 - movl %r9d,%r10d + shll $3,%r9d - shll $3+2,%r10d + leal (%r9,%r9,2),%r10d negq %r9 movq (%r8),%r8 @@ -759,25 +1042,35 @@ bn_power5: - leaq -64(%rsp,%r9,2),%r11 - subq %rsi,%r11 + + leaq -320(%rsp,%r9,2),%r11 + subq %rdi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb .Lpwr_sp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,2),%rsp + leaq -320(%rsp,%r9,2),%rsp jmp .Lpwr_sp_done .align 32 .Lpwr_sp_alt: - leaq 4096-64(,%r9,2),%r10 - leaq -64(%rsp,%r9,2),%rsp + leaq 4096-320(,%r9,2),%r10 + leaq -320(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp .Lpwr_sp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +.Lpwr_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc .Lpwr_page_walk + movq %r9,%r10 negq %r9 @@ -799,10 +1092,15 @@ bn_power5: .byte 102,72,15,110,226 call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal .byte 102,72,15,126,209 .byte 102,72,15,126,226 @@ -1346,9 +1644,9 @@ __bn_sqr8x_internal: movq %rbx,-16(%rdi) movq %r8,-8(%rdi) .byte 102,72,15,126,213 -sqr8x_reduction: +__bn_sqr8x_reduction: xorq %rax,%rax - leaq (%rbp,%r9,2),%rcx + leaq (%r9,%rbp,1),%rcx leaq 48+8(%rsp,%r9,2),%rdx movq %rcx,0+8(%rsp) leaq 48+8(%rsp,%r9,1),%rdi @@ -1381,14 +1679,14 @@ sqr8x_reduction: .align 32 .L8x_reduce: mulq %rbx - movq 16(%rbp),%rax + movq 8(%rbp),%rax negq %r8 movq %rdx,%r8 adcq $0,%r8 mulq %rbx addq %rax,%r9 - movq 32(%rbp),%rax + movq 16(%rbp),%rax adcq $0,%rdx addq %r9,%r8 movq %rbx,48-8+8(%rsp,%rcx,8) @@ -1397,7 +1695,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r10 - movq 48(%rbp),%rax + movq 24(%rbp),%rax adcq $0,%rdx addq %r10,%r9 movq 32+8(%rsp),%rsi @@ -1406,7 +1704,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r11 - movq 64(%rbp),%rax + movq 32(%rbp),%rax adcq $0,%rdx imulq %r8,%rsi addq %r11,%r10 @@ -1415,7 +1713,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r12 - movq 80(%rbp),%rax + movq 40(%rbp),%rax adcq $0,%rdx addq %r12,%r11 movq %rdx,%r12 @@ -1423,7 +1721,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r13 - movq 96(%rbp),%rax + movq 48(%rbp),%rax adcq $0,%rdx addq %r13,%r12 movq %rdx,%r13 @@ -1431,7 +1729,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r14 - movq 112(%rbp),%rax + movq 56(%rbp),%rax adcq $0,%rdx addq %r14,%r13 movq %rdx,%r14 @@ -1449,7 +1747,7 @@ sqr8x_reduction: decl %ecx jnz .L8x_reduce - leaq 128(%rbp),%rbp + leaq 64(%rbp),%rbp xorq %rax,%rax movq 8+8(%rsp),%rdx cmpq 0+8(%rsp),%rbp @@ -1475,14 +1773,14 @@ sqr8x_reduction: .L8x_tail: mulq %rbx addq %rax,%r8 - movq 16(%rbp),%rax + movq 8(%rbp),%rax movq %r8,(%rdi) movq %rdx,%r8 adcq $0,%r8 mulq %rbx addq %rax,%r9 - movq 32(%rbp),%rax + movq 16(%rbp),%rax adcq $0,%rdx addq %r9,%r8 leaq 8(%rdi),%rdi @@ -1491,7 +1789,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r10 - movq 48(%rbp),%rax + movq 24(%rbp),%rax adcq $0,%rdx addq %r10,%r9 movq %rdx,%r10 @@ -1499,7 +1797,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r11 - movq 64(%rbp),%rax + movq 32(%rbp),%rax adcq $0,%rdx addq %r11,%r10 movq %rdx,%r11 @@ -1507,7 +1805,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r12 - movq 80(%rbp),%rax + movq 40(%rbp),%rax adcq $0,%rdx addq %r12,%r11 movq %rdx,%r12 @@ -1515,7 +1813,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r13 - movq 96(%rbp),%rax + movq 48(%rbp),%rax adcq $0,%rdx addq %r13,%r12 movq %rdx,%r13 @@ -1523,7 +1821,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r14 - movq 112(%rbp),%rax + movq 56(%rbp),%rax adcq $0,%rdx addq %r14,%r13 movq %rdx,%r14 @@ -1541,7 +1839,7 @@ sqr8x_reduction: decl %ecx jnz .L8x_tail - leaq 128(%rbp),%rbp + leaq 64(%rbp),%rbp movq 8+8(%rsp),%rdx cmpq 0+8(%rsp),%rbp jae .L8x_tail_done @@ -1587,7 +1885,7 @@ sqr8x_reduction: adcq 48(%rdi),%r14 adcq 56(%rdi),%r15 adcq $0,%rax - movq -16(%rbp),%rcx + movq -8(%rbp),%rcx xorq %rsi,%rsi .byte 102,72,15,126,213 @@ -1605,44 +1903,62 @@ sqr8x_reduction: cmpq %rdx,%rdi jb .L8x_reduction_loop - - subq %r15,%rcx + .byte 0xf3,0xc3 +.size bn_sqr8x_internal,.-bn_sqr8x_internal +.type __bn_post4x_internal,@function +.align 32 +__bn_post4x_internal: + movq 0(%rbp),%r12 leaq (%rdi,%r9,1),%rbx - adcq %rsi,%rsi movq %r9,%rcx - orq %rsi,%rax .byte 102,72,15,126,207 - xorq $1,%rax + negq %rax .byte 102,72,15,126,206 - leaq (%rbp,%rax,8),%rbp sarq $3+2,%rcx - jmp .Lsqr4x_sub + decq %r12 + xorq %r10,%r10 + movq 8(%rbp),%r13 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 + jmp .Lsqr4x_sub_entry -.align 32 +.align 16 .Lsqr4x_sub: -.byte 0x66 - movq 0(%rbx),%r12 - movq 8(%rbx),%r13 - sbbq 0(%rbp),%r12 - movq 16(%rbx),%r14 - sbbq 16(%rbp),%r13 - movq 24(%rbx),%r15 - leaq 32(%rbx),%rbx - sbbq 32(%rbp),%r14 + movq 0(%rbp),%r12 + movq 8(%rbp),%r13 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 +.Lsqr4x_sub_entry: + leaq 32(%rbp),%rbp + notq %r12 + notq %r13 + notq %r14 + notq %r15 + andq %rax,%r12 + andq %rax,%r13 + andq %rax,%r14 + andq %rax,%r15 + + negq %r10 + adcq 0(%rbx),%r12 + adcq 8(%rbx),%r13 + adcq 16(%rbx),%r14 + adcq 24(%rbx),%r15 movq %r12,0(%rdi) - sbbq 48(%rbp),%r15 - leaq 64(%rbp),%rbp + leaq 32(%rbx),%rbx movq %r13,8(%rdi) + sbbq %r10,%r10 movq %r14,16(%rdi) movq %r15,24(%rdi) leaq 32(%rdi),%rdi incq %rcx jnz .Lsqr4x_sub + movq %r9,%r10 negq %r9 .byte 0xf3,0xc3 -.size bn_sqr8x_internal,.-bn_sqr8x_internal +.size __bn_post4x_internal,.-__bn_post4x_internal .globl bn_from_montgomery .type bn_from_montgomery,@function .align 32 @@ -1664,10 +1980,9 @@ bn_from_mont8x: pushq %r13 pushq %r14 pushq %r15 -.byte 0x67 - movl %r9d,%r10d + shll $3,%r9d - shll $3+2,%r10d + leaq (%r9,%r9,2),%r10 negq %r9 movq (%r8),%r8 @@ -1677,25 +1992,35 @@ bn_from_mont8x: - leaq -64(%rsp,%r9,2),%r11 - subq %rsi,%r11 + + leaq -320(%rsp,%r9,2),%r11 + subq %rdi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb .Lfrom_sp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,2),%rsp + leaq -320(%rsp,%r9,2),%rsp jmp .Lfrom_sp_done .align 32 .Lfrom_sp_alt: - leaq 4096-64(,%r9,2),%r10 - leaq -64(%rsp,%r9,2),%rsp + leaq 4096-320(,%r9,2),%r10 + leaq -320(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp .Lfrom_sp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +.Lfrom_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc .Lfrom_page_walk + movq %r9,%r10 negq %r9 @@ -1741,12 +2066,13 @@ bn_from_mont8x: movq %rcx,%rbp .byte 102,73,15,110,218 movl OPENSSL_ia32cap_P+8(%rip),%r11d - andl $524544,%r11d - cmpl $524544,%r11d + andl $0x80108,%r11d + cmpl $0x80108,%r11d jne .Lfrom_mont_nox leaq (%rax,%r9,1),%rdi - call sqrx8x_reduction + call __bn_sqrx8x_reduction + call __bn_postx4x_internal pxor %xmm0,%xmm0 leaq 48(%rsp),%rax @@ -1755,7 +2081,8 @@ bn_from_mont8x: .align 32 .Lfrom_mont_nox: - call sqr8x_reduction + call __bn_sqr8x_reduction + call __bn_post4x_internal pxor %xmm0,%xmm0 leaq 48(%rsp),%rax @@ -1787,7 +2114,6 @@ bn_from_mont8x: .align 32 bn_mulx4x_mont_gather5: .Lmulx4x_enter: -.byte 0x67 movq %rsp,%rax pushq %rbx pushq %rbp @@ -1795,10 +2121,9 @@ bn_mulx4x_mont_gather5: pushq %r13 pushq %r14 pushq %r15 -.byte 0x67 - movl %r9d,%r10d + shll $3,%r9d - shll $3+2,%r10d + leaq (%r9,%r9,2),%r10 negq %r9 movq (%r8),%r8 @@ -1809,25 +2134,35 @@ bn_mulx4x_mont_gather5: - leaq -64(%rsp,%r9,2),%r11 - subq %rsi,%r11 + + + leaq -320(%rsp,%r9,2),%r11 + subq %rdi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb .Lmulx4xsp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,2),%rsp + leaq -320(%rsp,%r9,2),%rsp jmp .Lmulx4xsp_done -.align 32 .Lmulx4xsp_alt: - leaq 4096-64(,%r9,2),%r10 - leaq -64(%rsp,%r9,2),%rsp + leaq 4096-320(,%r9,2),%r10 + leaq -320(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp .Lmulx4xsp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +.Lmulx4x_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc .Lmulx4x_page_walk + @@ -1847,6 +2182,7 @@ bn_mulx4x_mont_gather5: movq 40(%rsp),%rsi movq $1,%rax + movq -48(%rsi),%r15 movq -40(%rsi),%r14 movq -32(%rsi),%r13 @@ -1861,63 +2197,150 @@ bn_mulx4x_mont_gather5: .type mulx4x_internal,@function .align 32 mulx4x_internal: -.byte 0x4c,0x89,0x8c,0x24,0x08,0x00,0x00,0x00 -.byte 0x67 + movq %r9,8(%rsp) + movq %r9,%r10 negq %r9 shlq $5,%r9 - leaq 256(%rdx,%r9,1),%r13 + negq %r10 + leaq 128(%rdx,%r9,1),%r13 shrq $5+5,%r9 - movl 8(%rax),%r10d + movd 8(%rax),%xmm5 subq $1,%r9 + leaq .Linc(%rip),%rax movq %r13,16+8(%rsp) movq %r9,24+8(%rsp) movq %rdi,56+8(%rsp) - movq %r10,%r11 - shrq $3,%r10 - andq $7,%r11 - notq %r10 - leaq .Lmagic_masks(%rip),%rax - andq $3,%r10 - leaq 96(%rdx,%r11,8),%rdi - movq 0(%rax,%r10,8),%xmm4 - movq 8(%rax,%r10,8),%xmm5 - addq $7,%r11 - movq 16(%rax,%r10,8),%xmm6 - movq 24(%rax,%r10,8),%xmm7 - andq $7,%r11 - - movq -96(%rdi),%xmm0 - leaq 256(%rdi),%rbx - movq -32(%rdi),%xmm1 - pand %xmm4,%xmm0 - movq 32(%rdi),%xmm2 - pand %xmm5,%xmm1 - movq 96(%rdi),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - movq -96(%rbx),%xmm1 - pand %xmm7,%xmm3 - por %xmm2,%xmm0 - movq -32(%rbx),%xmm2 - por %xmm3,%xmm0 -.byte 0x67,0x67 - pand %xmm4,%xmm1 - movq 32(%rbx),%xmm3 + movdqa 0(%rax),%xmm0 + movdqa 16(%rax),%xmm1 + leaq 88-112(%rsp,%r10,1),%r10 + leaq 128(%rdx),%rdi + pshufd $0,%xmm5,%xmm5 + movdqa %xmm1,%xmm4 +.byte 0x67 + movdqa %xmm1,%xmm2 +.byte 0x67 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,112(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,128(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,144(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,160(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,176(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,192(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,208(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,224(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,240(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,256(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,272(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,288(%r10) + movdqa %xmm4,%xmm3 +.byte 0x67 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,304(%r10) + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,320(%r10) + + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,336(%r10) + + pand 64(%rdi),%xmm0 + pand 80(%rdi),%xmm1 + pand 96(%rdi),%xmm2 + movdqa %xmm3,352(%r10) + pand 112(%rdi),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -128(%rdi),%xmm4 + movdqa -112(%rdi),%xmm5 + movdqa -96(%rdi),%xmm2 + pand 112(%r10),%xmm4 + movdqa -80(%rdi),%xmm3 + pand 128(%r10),%xmm5 + por %xmm4,%xmm0 + pand 144(%r10),%xmm2 + por %xmm5,%xmm1 + pand 160(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -64(%rdi),%xmm4 + movdqa -48(%rdi),%xmm5 + movdqa -32(%rdi),%xmm2 + pand 176(%r10),%xmm4 + movdqa -16(%rdi),%xmm3 + pand 192(%r10),%xmm5 + por %xmm4,%xmm0 + pand 208(%r10),%xmm2 + por %xmm5,%xmm1 + pand 224(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa 0(%rdi),%xmm4 + movdqa 16(%rdi),%xmm5 + movdqa 32(%rdi),%xmm2 + pand 240(%r10),%xmm4 + movdqa 48(%rdi),%xmm3 + pand 256(%r10),%xmm5 + por %xmm4,%xmm0 + pand 272(%r10),%xmm2 + por %xmm5,%xmm1 + pand 288(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + pxor %xmm1,%xmm0 + pshufd $0x4e,%xmm0,%xmm1 + por %xmm1,%xmm0 + leaq 256(%rdi),%rdi .byte 102,72,15,126,194 - movq 96(%rbx),%xmm0 - leaq 512(%rdi),%rdi - pand %xmm5,%xmm2 -.byte 0x67,0x67 - pand %xmm6,%xmm3 - - - - - - - - leaq 64+32+8(%rsp,%r11,8),%rbx + leaq 64+32+8(%rsp),%rbx movq %rdx,%r9 mulxq 0(%rsi),%r8,%rax @@ -1933,37 +2356,31 @@ mulx4x_internal: xorq %rbp,%rbp movq %r8,%rdx - por %xmm2,%xmm1 - pand %xmm7,%xmm0 - por %xmm3,%xmm1 movq %rdi,8+8(%rsp) - por %xmm1,%xmm0 -.byte 0x48,0x8d,0xb6,0x20,0x00,0x00,0x00 + leaq 32(%rsi),%rsi adcxq %rax,%r13 adcxq %rbp,%r14 mulxq 0(%rcx),%rax,%r10 adcxq %rax,%r15 adoxq %r11,%r10 - mulxq 16(%rcx),%rax,%r11 + mulxq 8(%rcx),%rax,%r11 adcxq %rax,%r10 adoxq %r12,%r11 - mulxq 32(%rcx),%rax,%r12 + mulxq 16(%rcx),%rax,%r12 movq 24+8(%rsp),%rdi -.byte 0x66 movq %r10,-32(%rbx) adcxq %rax,%r11 adoxq %r13,%r12 - mulxq 48(%rcx),%rax,%r15 -.byte 0x67,0x67 + mulxq 24(%rcx),%rax,%r15 movq %r9,%rdx movq %r11,-24(%rbx) adcxq %rax,%r12 adoxq %rbp,%r15 -.byte 0x48,0x8d,0x89,0x40,0x00,0x00,0x00 + leaq 32(%rcx),%rcx movq %r12,-16(%rbx) - + jmp .Lmulx4x_1st .align 32 .Lmulx4x_1st: @@ -1986,27 +2403,26 @@ mulx4x_internal: mulxq 0(%rcx),%rax,%r15 adcxq %rax,%r10 adoxq %r15,%r11 - mulxq 16(%rcx),%rax,%r15 + mulxq 8(%rcx),%rax,%r15 adcxq %rax,%r11 adoxq %r15,%r12 - mulxq 32(%rcx),%rax,%r15 + mulxq 16(%rcx),%rax,%r15 movq %r10,-40(%rbx) adcxq %rax,%r12 movq %r11,-32(%rbx) adoxq %r15,%r13 - mulxq 48(%rcx),%rax,%r15 + mulxq 24(%rcx),%rax,%r15 movq %r9,%rdx movq %r12,-24(%rbx) adcxq %rax,%r13 adoxq %rbp,%r15 - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx movq %r13,-16(%rbx) decq %rdi jnz .Lmulx4x_1st movq 8(%rsp),%rax -.byte 102,72,15,126,194 adcq %rbp,%r15 leaq (%rsi,%rax,1),%rsi addq %r15,%r14 @@ -2017,6 +2433,64 @@ mulx4x_internal: .align 32 .Lmulx4x_outer: + leaq 16-256(%rbx),%r10 + pxor %xmm4,%xmm4 +.byte 0x67,0x67 + pxor %xmm5,%xmm5 + movdqa -128(%rdi),%xmm0 + movdqa -112(%rdi),%xmm1 + movdqa -96(%rdi),%xmm2 + pand 256(%r10),%xmm0 + movdqa -80(%rdi),%xmm3 + pand 272(%r10),%xmm1 + por %xmm0,%xmm4 + pand 288(%r10),%xmm2 + por %xmm1,%xmm5 + pand 304(%r10),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa -64(%rdi),%xmm0 + movdqa -48(%rdi),%xmm1 + movdqa -32(%rdi),%xmm2 + pand 320(%r10),%xmm0 + movdqa -16(%rdi),%xmm3 + pand 336(%r10),%xmm1 + por %xmm0,%xmm4 + pand 352(%r10),%xmm2 + por %xmm1,%xmm5 + pand 368(%r10),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 0(%rdi),%xmm0 + movdqa 16(%rdi),%xmm1 + movdqa 32(%rdi),%xmm2 + pand 384(%r10),%xmm0 + movdqa 48(%rdi),%xmm3 + pand 400(%r10),%xmm1 + por %xmm0,%xmm4 + pand 416(%r10),%xmm2 + por %xmm1,%xmm5 + pand 432(%r10),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 64(%rdi),%xmm0 + movdqa 80(%rdi),%xmm1 + movdqa 96(%rdi),%xmm2 + pand 448(%r10),%xmm0 + movdqa 112(%rdi),%xmm3 + pand 464(%r10),%xmm1 + por %xmm0,%xmm4 + pand 480(%r10),%xmm2 + por %xmm1,%xmm5 + pand 496(%r10),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + por %xmm5,%xmm4 + pshufd $0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 + leaq 256(%rdi),%rdi +.byte 102,72,15,126,194 + movq %rbp,(%rbx) leaq 32(%rbx,%rax,1),%rbx mulxq 0(%rsi),%r8,%r11 @@ -2031,54 +2505,37 @@ mulx4x_internal: mulxq 24(%rsi),%rdx,%r14 adoxq -16(%rbx),%r12 adcxq %rdx,%r13 - leaq (%rcx,%rax,2),%rcx + leaq (%rcx,%rax,1),%rcx leaq 32(%rsi),%rsi adoxq -8(%rbx),%r13 adcxq %rbp,%r14 adoxq %rbp,%r14 -.byte 0x67 movq %r8,%r15 imulq 32+8(%rsp),%r8 - movq -96(%rdi),%xmm0 -.byte 0x67,0x67 movq %r8,%rdx - movq -32(%rdi),%xmm1 -.byte 0x67 - pand %xmm4,%xmm0 - movq 32(%rdi),%xmm2 -.byte 0x67 - pand %xmm5,%xmm1 - movq 96(%rdi),%xmm3 - addq $256,%rdi -.byte 0x67 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 xorq %rbp,%rbp movq %rdi,8+8(%rsp) mulxq 0(%rcx),%rax,%r10 adcxq %rax,%r15 adoxq %r11,%r10 - mulxq 16(%rcx),%rax,%r11 + mulxq 8(%rcx),%rax,%r11 adcxq %rax,%r10 adoxq %r12,%r11 - mulxq 32(%rcx),%rax,%r12 + mulxq 16(%rcx),%rax,%r12 adcxq %rax,%r11 adoxq %r13,%r12 - mulxq 48(%rcx),%rax,%r15 + mulxq 24(%rcx),%rax,%r15 movq %r9,%rdx - por %xmm2,%xmm0 movq 24+8(%rsp),%rdi movq %r10,-32(%rbx) - por %xmm3,%xmm0 adcxq %rax,%r12 movq %r11,-24(%rbx) adoxq %rbp,%r15 movq %r12,-16(%rbx) - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx jmp .Lmulx4x_inner .align 32 @@ -2106,17 +2563,17 @@ mulx4x_internal: mulxq 0(%rcx),%rax,%r15 adcxq %rax,%r10 adoxq %r15,%r11 - mulxq 16(%rcx),%rax,%r15 + mulxq 8(%rcx),%rax,%r15 adcxq %rax,%r11 adoxq %r15,%r12 - mulxq 32(%rcx),%rax,%r15 + mulxq 16(%rcx),%rax,%r15 movq %r10,-40(%rbx) adcxq %rax,%r12 adoxq %r15,%r13 movq %r11,-32(%rbx) - mulxq 48(%rcx),%rax,%r15 + mulxq 24(%rcx),%rax,%r15 movq %r9,%rdx - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx movq %r12,-24(%rbx) adcxq %rax,%r13 adoxq %rbp,%r15 @@ -2126,7 +2583,6 @@ mulx4x_internal: jnz .Lmulx4x_inner movq 0+8(%rsp),%rax -.byte 102,72,15,126,194 adcq %rbp,%r15 subq 0(%rbx),%rdi movq 8+8(%rsp),%rdi @@ -2139,26 +2595,31 @@ mulx4x_internal: cmpq %r10,%rdi jb .Lmulx4x_outer - movq -16(%rcx),%r10 + movq -8(%rcx),%r10 + movq %rbp,%r8 + movq (%rcx,%rax,1),%r12 + leaq (%rcx,%rax,1),%rbp + movq %rax,%rcx + leaq (%rbx,%rax,1),%rdi + xorl %eax,%eax xorq %r15,%r15 subq %r14,%r10 adcq %r15,%r15 - orq %r15,%rbp - xorq $1,%rbp - leaq (%rbx,%rax,1),%rdi - leaq (%rcx,%rax,2),%rcx -.byte 0x67,0x67 - sarq $3+2,%rax - leaq (%rcx,%rbp,8),%rbp + orq %r15,%r8 + sarq $3+2,%rcx + subq %r8,%rax movq 56+8(%rsp),%rdx - movq %rax,%rcx - jmp .Lsqrx4x_sub + decq %r12 + movq 8(%rbp),%r13 + xorq %r8,%r8 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 + jmp .Lsqrx4x_sub_entry .size mulx4x_internal,.-mulx4x_internal .type bn_powerx5,@function .align 32 bn_powerx5: .Lpowerx5_enter: -.byte 0x67 movq %rsp,%rax pushq %rbx pushq %rbp @@ -2166,10 +2627,9 @@ bn_powerx5: pushq %r13 pushq %r14 pushq %r15 -.byte 0x67 - movl %r9d,%r10d + shll $3,%r9d - shll $3+2,%r10d + leaq (%r9,%r9,2),%r10 negq %r9 movq (%r8),%r8 @@ -2179,25 +2639,35 @@ bn_powerx5: - leaq -64(%rsp,%r9,2),%r11 - subq %rsi,%r11 + + leaq -320(%rsp,%r9,2),%r11 + subq %rdi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb .Lpwrx_sp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,2),%rsp + leaq -320(%rsp,%r9,2),%rsp jmp .Lpwrx_sp_done .align 32 .Lpwrx_sp_alt: - leaq 4096-64(,%r9,2),%r10 - leaq -64(%rsp,%r9,2),%rsp + leaq 4096-320(,%r9,2),%r10 + leaq -320(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp .Lpwrx_sp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +.Lpwrx_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc .Lpwrx_page_walk + movq %r9,%r10 negq %r9 @@ -2222,10 +2692,15 @@ bn_powerx5: .Lpowerx5_body: call __bn_sqrx8x_internal + call __bn_postx4x_internal call __bn_sqrx8x_internal + call __bn_postx4x_internal call __bn_sqrx8x_internal + call __bn_postx4x_internal call __bn_sqrx8x_internal + call __bn_postx4x_internal call __bn_sqrx8x_internal + call __bn_postx4x_internal movq %r10,%r9 movq %rsi,%rdi @@ -2237,6 +2712,7 @@ bn_powerx5: movq 40(%rsp),%rsi movq $1,%rax + movq -48(%rsi),%r15 movq -40(%rsi),%r14 movq -32(%rsi),%r13 @@ -2649,11 +3125,11 @@ __bn_sqrx8x_internal: movq %rbx,56(%rdi) leaq 64(%rdi),%rdi .byte 102,72,15,126,213 -sqrx8x_reduction: +__bn_sqrx8x_reduction: xorl %eax,%eax movq 32+8(%rsp),%rbx movq 48+8(%rsp),%rdx - leaq -128(%rbp,%r9,2),%rcx + leaq -64(%rbp,%r9,1),%rcx movq %rcx,0+8(%rsp) movq %rdi,8+8(%rsp) @@ -2686,19 +3162,19 @@ sqrx8x_reduction: adcxq %rbx,%rax adoxq %r9,%r8 - mulxq 16(%rbp),%rbx,%r9 + mulxq 8(%rbp),%rbx,%r9 adcxq %rbx,%r8 adoxq %r10,%r9 - mulxq 32(%rbp),%rbx,%r10 + mulxq 16(%rbp),%rbx,%r10 adcxq %rbx,%r9 adoxq %r11,%r10 - mulxq 48(%rbp),%rbx,%r11 + mulxq 24(%rbp),%rbx,%r11 adcxq %rbx,%r10 adoxq %r12,%r11 -.byte 0xc4,0x62,0xe3,0xf6,0xa5,0x40,0x00,0x00,0x00 +.byte 0xc4,0x62,0xe3,0xf6,0xa5,0x20,0x00,0x00,0x00 movq %rdx,%rax movq %r8,%rdx adcxq %rbx,%r11 @@ -2708,15 +3184,15 @@ sqrx8x_reduction: movq %rax,%rdx movq %rax,64+48+8(%rsp,%rcx,8) - mulxq 80(%rbp),%rax,%r13 + mulxq 40(%rbp),%rax,%r13 adcxq %rax,%r12 adoxq %r14,%r13 - mulxq 96(%rbp),%rax,%r14 + mulxq 48(%rbp),%rax,%r14 adcxq %rax,%r13 adoxq %r15,%r14 - mulxq 112(%rbp),%rax,%r15 + mulxq 56(%rbp),%rax,%r15 movq %rbx,%rdx adcxq %rax,%r14 adoxq %rsi,%r15 @@ -2732,7 +3208,7 @@ sqrx8x_reduction: movq 48+8(%rsp),%rdx addq 0(%rdi),%r8 - leaq 128(%rbp),%rbp + leaq 64(%rbp),%rbp movq $-8,%rcx adcxq 8(%rdi),%r9 adcxq 16(%rdi),%r10 @@ -2755,31 +3231,31 @@ sqrx8x_reduction: adcxq %rax,%rbx adoxq %r9,%r8 - mulxq 16(%rbp),%rax,%r9 + mulxq 8(%rbp),%rax,%r9 adcxq %rax,%r8 adoxq %r10,%r9 - mulxq 32(%rbp),%rax,%r10 + mulxq 16(%rbp),%rax,%r10 adcxq %rax,%r9 adoxq %r11,%r10 - mulxq 48(%rbp),%rax,%r11 + mulxq 24(%rbp),%rax,%r11 adcxq %rax,%r10 adoxq %r12,%r11 -.byte 0xc4,0x62,0xfb,0xf6,0xa5,0x40,0x00,0x00,0x00 +.byte 0xc4,0x62,0xfb,0xf6,0xa5,0x20,0x00,0x00,0x00 adcxq %rax,%r11 adoxq %r13,%r12 - mulxq 80(%rbp),%rax,%r13 + mulxq 40(%rbp),%rax,%r13 adcxq %rax,%r12 adoxq %r14,%r13 - mulxq 96(%rbp),%rax,%r14 + mulxq 48(%rbp),%rax,%r14 adcxq %rax,%r13 adoxq %r15,%r14 - mulxq 112(%rbp),%rax,%r15 + mulxq 56(%rbp),%rax,%r15 movq 72+48+8(%rsp,%rcx,8),%rdx adcxq %rax,%r14 adoxq %rsi,%r15 @@ -2795,7 +3271,7 @@ sqrx8x_reduction: subq 16+8(%rsp),%rsi movq 48+8(%rsp),%rdx - leaq 128(%rbp),%rbp + leaq 64(%rbp),%rbp adcq 0(%rdi),%r8 adcq 8(%rdi),%r9 adcq 16(%rdi),%r10 @@ -2831,7 +3307,7 @@ sqrx8x_reduction: adcq 0(%rdi),%r8 .byte 102,72,15,126,217 adcq 8(%rdi),%r9 - movq 112(%rbp),%rsi + movq 56(%rbp),%rsi .byte 102,72,15,126,213 adcq 16(%rdi),%r10 adcq 24(%rdi),%r11 @@ -2857,45 +3333,58 @@ sqrx8x_reduction: leaq 64(%rdi,%rcx,1),%rdi cmpq 8+8(%rsp),%r8 jb .Lsqrx8x_reduction_loop - xorl %ebx,%ebx - subq %r15,%rsi - adcq %rbx,%rbx + .byte 0xf3,0xc3 +.size bn_sqrx8x_internal,.-bn_sqrx8x_internal +.align 32 +__bn_postx4x_internal: + movq 0(%rbp),%r12 movq %rcx,%r10 - orq %rbx,%rax movq %rcx,%r9 - xorq $1,%rax + negq %rax sarq $3+2,%rcx - leaq (%rbp,%rax,8),%rbp .byte 102,72,15,126,202 .byte 102,72,15,126,206 - jmp .Lsqrx4x_sub + decq %r12 + movq 8(%rbp),%r13 + xorq %r8,%r8 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 + jmp .Lsqrx4x_sub_entry -.align 32 +.align 16 .Lsqrx4x_sub: -.byte 0x66 - movq 0(%rdi),%r12 - movq 8(%rdi),%r13 - sbbq 0(%rbp),%r12 - movq 16(%rdi),%r14 - sbbq 16(%rbp),%r13 - movq 24(%rdi),%r15 - leaq 32(%rdi),%rdi - sbbq 32(%rbp),%r14 + movq 0(%rbp),%r12 + movq 8(%rbp),%r13 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 +.Lsqrx4x_sub_entry: + andnq %rax,%r12,%r12 + leaq 32(%rbp),%rbp + andnq %rax,%r13,%r13 + andnq %rax,%r14,%r14 + andnq %rax,%r15,%r15 + + negq %r8 + adcq 0(%rdi),%r12 + adcq 8(%rdi),%r13 + adcq 16(%rdi),%r14 + adcq 24(%rdi),%r15 movq %r12,0(%rdx) - sbbq 48(%rbp),%r15 - leaq 64(%rbp),%rbp + leaq 32(%rdi),%rdi movq %r13,8(%rdx) + sbbq %r8,%r8 movq %r14,16(%rdx) movq %r15,24(%rdx) leaq 32(%rdx),%rdx incq %rcx jnz .Lsqrx4x_sub + negq %r9 .byte 0xf3,0xc3 -.size bn_sqrx8x_internal,.-bn_sqrx8x_internal +.size __bn_postx4x_internal,.-__bn_postx4x_internal .globl bn_get_bits5 .type bn_get_bits5,@function .align 16 @@ -2935,45 +3424,169 @@ bn_scatter5: .globl bn_gather5 .type bn_gather5,@function -.align 16 +.align 32 bn_gather5: - movl %ecx,%r11d - shrl $3,%ecx - andq $7,%r11 - notl %ecx - leaq .Lmagic_masks(%rip),%rax - andl $3,%ecx - leaq 128(%rdx,%r11,8),%rdx - movq 0(%rax,%rcx,8),%xmm4 - movq 8(%rax,%rcx,8),%xmm5 - movq 16(%rax,%rcx,8),%xmm6 - movq 24(%rax,%rcx,8),%xmm7 +.LSEH_begin_bn_gather5: + +.byte 0x4c,0x8d,0x14,0x24 +.byte 0x48,0x81,0xec,0x08,0x01,0x00,0x00 + leaq .Linc(%rip),%rax + andq $-16,%rsp + + movd %ecx,%xmm5 + movdqa 0(%rax),%xmm0 + movdqa 16(%rax),%xmm1 + leaq 128(%rdx),%r11 + leaq 128(%rsp),%rax + + pshufd $0,%xmm5,%xmm5 + movdqa %xmm1,%xmm4 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,-128(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,-112(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,-96(%rax) + movdqa %xmm4,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,-80(%rax) + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,-64(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,-48(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,-32(%rax) + movdqa %xmm4,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,-16(%rax) + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,0(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,16(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,32(%rax) + movdqa %xmm4,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,48(%rax) + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,64(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,80(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,96(%rax) + movdqa %xmm4,%xmm2 + movdqa %xmm3,112(%rax) jmp .Lgather -.align 16 -.Lgather: - movq -128(%rdx),%xmm0 - movq -64(%rdx),%xmm1 - pand %xmm4,%xmm0 - movq 0(%rdx),%xmm2 - pand %xmm5,%xmm1 - movq 64(%rdx),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 -.byte 0x67,0x67 - por %xmm2,%xmm0 - leaq 256(%rdx),%rdx - por %xmm3,%xmm0 +.align 32 +.Lgather: + pxor %xmm4,%xmm4 + pxor %xmm5,%xmm5 + movdqa -128(%r11),%xmm0 + movdqa -112(%r11),%xmm1 + movdqa -96(%r11),%xmm2 + pand -128(%rax),%xmm0 + movdqa -80(%r11),%xmm3 + pand -112(%rax),%xmm1 + por %xmm0,%xmm4 + pand -96(%rax),%xmm2 + por %xmm1,%xmm5 + pand -80(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa -64(%r11),%xmm0 + movdqa -48(%r11),%xmm1 + movdqa -32(%r11),%xmm2 + pand -64(%rax),%xmm0 + movdqa -16(%r11),%xmm3 + pand -48(%rax),%xmm1 + por %xmm0,%xmm4 + pand -32(%rax),%xmm2 + por %xmm1,%xmm5 + pand -16(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 0(%r11),%xmm0 + movdqa 16(%r11),%xmm1 + movdqa 32(%r11),%xmm2 + pand 0(%rax),%xmm0 + movdqa 48(%r11),%xmm3 + pand 16(%rax),%xmm1 + por %xmm0,%xmm4 + pand 32(%rax),%xmm2 + por %xmm1,%xmm5 + pand 48(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 64(%r11),%xmm0 + movdqa 80(%r11),%xmm1 + movdqa 96(%r11),%xmm2 + pand 64(%rax),%xmm0 + movdqa 112(%r11),%xmm3 + pand 80(%rax),%xmm1 + por %xmm0,%xmm4 + pand 96(%rax),%xmm2 + por %xmm1,%xmm5 + pand 112(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + por %xmm5,%xmm4 + leaq 256(%r11),%r11 + pshufd $0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 movq %xmm0,(%rdi) leaq 8(%rdi),%rdi subl $1,%esi jnz .Lgather + + leaq (%r10),%rsp .byte 0xf3,0xc3 .LSEH_end_bn_gather5: .size bn_gather5,.-bn_gather5 .align 64 -.Lmagic_masks: -.long 0,0, 0,0, 0,0, -1,-1 -.long 0,0, 0,0, 0,0, 0,0 +.Linc: +.long 0,0, 1,1 +.long 2,2, 2,2 .byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105,112,108,105,99,97,116,105,111,110,32,119,105,116,104,32,115,99,97,116,116,101,114,47,103,97,116,104,101,114,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 diff --git a/vendor/openssl/asm/x64-elf-gas/camellia/cmll-x86_64.s b/vendor/openssl/asm/x64-elf-gas/camellia/cmll-x86_64.s index ac7da4dfc..1117381f3 100644 --- a/vendor/openssl/asm/x64-elf-gas/camellia/cmll-x86_64.s +++ b/vendor/openssl/asm/x64-elf-gas/camellia/cmll-x86_64.s @@ -1624,7 +1624,7 @@ Camellia_cbc_encrypt: leaq -64-63(%rcx),%r10 subq %rsp,%r10 negq %r10 - andq $960,%r10 + andq $0x3C0,%r10 subq %r10,%rsp diff --git a/vendor/openssl/asm/x64-elf-gas/ec/ecp_nistz256-x86_64.s b/vendor/openssl/asm/x64-elf-gas/ec/ecp_nistz256-x86_64.s index 3a999664c..6d1be614f 100644 --- a/vendor/openssl/asm/x64-elf-gas/ec/ecp_nistz256-x86_64.s +++ b/vendor/openssl/asm/x64-elf-gas/ec/ecp_nistz256-x86_64.s @@ -332,7 +332,7 @@ ecp_nistz256_neg: .type ecp_nistz256_to_mont,@function .align 32 ecp_nistz256_to_mont: - movl $524544,%ecx + movl $0x80100,%ecx andl OPENSSL_ia32cap_P+8(%rip),%ecx leaq .LRR(%rip),%rdx jmp .Lmul_mont @@ -348,7 +348,7 @@ ecp_nistz256_to_mont: .type ecp_nistz256_mul_mont,@function .align 32 ecp_nistz256_mul_mont: - movl $524544,%ecx + movl $0x80100,%ecx andl OPENSSL_ia32cap_P+8(%rip),%ecx .Lmul_mont: pushq %rbp @@ -357,7 +357,7 @@ ecp_nistz256_mul_mont: pushq %r13 pushq %r14 pushq %r15 - cmpl $524544,%ecx + cmpl $0x80100,%ecx je .Lmul_montx movq %rdx,%rbx movq 0(%rdx),%rax @@ -617,7 +617,7 @@ __ecp_nistz256_mul_montq: .type ecp_nistz256_sqr_mont,@function .align 32 ecp_nistz256_sqr_mont: - movl $524544,%ecx + movl $0x80100,%ecx andl OPENSSL_ia32cap_P+8(%rip),%ecx pushq %rbp pushq %rbx @@ -625,7 +625,7 @@ ecp_nistz256_sqr_mont: pushq %r13 pushq %r14 pushq %r15 - cmpl $524544,%ecx + cmpl $0x80100,%ecx je .Lsqr_montx movq 0(%rsi),%rax movq 8(%rsi),%r14 @@ -1581,9 +1581,9 @@ __ecp_nistz256_mul_by_2q: .type ecp_nistz256_point_double,@function .align 32 ecp_nistz256_point_double: - movl $524544,%ecx + movl $0x80100,%ecx andl OPENSSL_ia32cap_P+8(%rip),%ecx - cmpl $524544,%ecx + cmpl $0x80100,%ecx je .Lpoint_doublex pushq %rbp pushq %rbx @@ -1593,6 +1593,7 @@ ecp_nistz256_point_double: pushq %r15 subq $160+8,%rsp +.Lpoint_double_shortcutq: movdqu 0(%rsi),%xmm0 movq %rsi,%rbx movdqu 16(%rsi),%xmm1 @@ -1786,9 +1787,9 @@ ecp_nistz256_point_double: .type ecp_nistz256_point_add,@function .align 32 ecp_nistz256_point_add: - movl $524544,%ecx + movl $0x80100,%ecx andl OPENSSL_ia32cap_P+8(%rip),%ecx - cmpl $524544,%ecx + cmpl $0x80100,%ecx je .Lpoint_addx pushq %rbp pushq %rbx @@ -1817,7 +1818,7 @@ ecp_nistz256_point_add: por %xmm1,%xmm3 movdqu 0(%rsi),%xmm0 - pshufd $177,%xmm3,%xmm5 + pshufd $0xb1,%xmm3,%xmm5 movdqu 16(%rsi),%xmm1 movdqu 32(%rsi),%xmm2 por %xmm3,%xmm5 @@ -1827,7 +1828,7 @@ ecp_nistz256_point_add: movq 64+16(%rsi),%r15 movq 64+24(%rsi),%r8 movdqa %xmm0,480(%rsp) - pshufd $30,%xmm5,%xmm4 + pshufd $0x1e,%xmm5,%xmm4 movdqa %xmm1,480+16(%rsp) por %xmm0,%xmm1 .byte 102,72,15,110,199 @@ -1847,10 +1848,10 @@ ecp_nistz256_point_add: call __ecp_nistz256_sqr_montq pcmpeqd %xmm4,%xmm5 - pshufd $177,%xmm3,%xmm4 + pshufd $0xb1,%xmm3,%xmm4 por %xmm3,%xmm4 pshufd $0,%xmm5,%xmm5 - pshufd $30,%xmm4,%xmm3 + pshufd $0x1e,%xmm4,%xmm3 por %xmm3,%xmm4 pxor %xmm3,%xmm3 pcmpeqd %xmm3,%xmm4 @@ -1859,6 +1860,7 @@ ecp_nistz256_point_add: movq 64+8(%rbx),%r14 movq 64+16(%rbx),%r15 movq 64+24(%rbx),%r8 +.byte 102,72,15,110,203 leaq 64-0(%rbx),%rsi leaq 32(%rsp),%rdi @@ -1950,7 +1952,7 @@ ecp_nistz256_point_add: testq %r8,%r8 jnz .Ladd_proceedq testq %r9,%r9 - jz .Ladd_proceedq + jz .Ladd_doubleq .byte 102,72,15,126,199 pxor %xmm0,%xmm0 @@ -1962,6 +1964,13 @@ ecp_nistz256_point_add: movdqu %xmm0,80(%rdi) jmp .Ladd_doneq +.align 32 +.Ladd_doubleq: +.byte 102,72,15,126,206 +.byte 102,72,15,126,199 + addq $416,%rsp + jmp .Lpoint_double_shortcutq + .align 32 .Ladd_proceedq: movq 0+64(%rsp),%rax @@ -2179,9 +2188,9 @@ ecp_nistz256_point_add: .type ecp_nistz256_point_add_affine,@function .align 32 ecp_nistz256_point_add_affine: - movl $524544,%ecx + movl $0x80100,%ecx andl OPENSSL_ia32cap_P+8(%rip),%ecx - cmpl $524544,%ecx + cmpl $0x80100,%ecx je .Lpoint_add_affinex pushq %rbp pushq %rbx @@ -2213,13 +2222,13 @@ ecp_nistz256_point_add_affine: por %xmm1,%xmm3 movdqu 0(%rbx),%xmm0 - pshufd $177,%xmm3,%xmm5 + pshufd $0xb1,%xmm3,%xmm5 movdqu 16(%rbx),%xmm1 movdqu 32(%rbx),%xmm2 por %xmm3,%xmm5 movdqu 48(%rbx),%xmm3 movdqa %xmm0,416(%rsp) - pshufd $30,%xmm5,%xmm4 + pshufd $0x1e,%xmm5,%xmm4 movdqa %xmm1,416+16(%rsp) por %xmm0,%xmm1 .byte 102,72,15,110,199 @@ -2235,13 +2244,13 @@ ecp_nistz256_point_add_affine: call __ecp_nistz256_sqr_montq pcmpeqd %xmm4,%xmm5 - pshufd $177,%xmm3,%xmm4 + pshufd $0xb1,%xmm3,%xmm4 movq 0(%rbx),%rax movq %r12,%r9 por %xmm3,%xmm4 pshufd $0,%xmm5,%xmm5 - pshufd $30,%xmm4,%xmm3 + pshufd $0x1e,%xmm4,%xmm3 movq %r13,%r10 por %xmm3,%xmm4 pxor %xmm3,%xmm3 @@ -2621,6 +2630,7 @@ ecp_nistz256_point_doublex: pushq %r15 subq $160+8,%rsp +.Lpoint_double_shortcutx: movdqu 0(%rsi),%xmm0 movq %rsi,%rbx movdqu 16(%rsi),%xmm1 @@ -2841,7 +2851,7 @@ ecp_nistz256_point_addx: por %xmm1,%xmm3 movdqu 0(%rsi),%xmm0 - pshufd $177,%xmm3,%xmm5 + pshufd $0xb1,%xmm3,%xmm5 movdqu 16(%rsi),%xmm1 movdqu 32(%rsi),%xmm2 por %xmm3,%xmm5 @@ -2851,7 +2861,7 @@ ecp_nistz256_point_addx: movq 64+16(%rsi),%r15 movq 64+24(%rsi),%r8 movdqa %xmm0,480(%rsp) - pshufd $30,%xmm5,%xmm4 + pshufd $0x1e,%xmm5,%xmm4 movdqa %xmm1,480+16(%rsp) por %xmm0,%xmm1 .byte 102,72,15,110,199 @@ -2871,10 +2881,10 @@ ecp_nistz256_point_addx: call __ecp_nistz256_sqr_montx pcmpeqd %xmm4,%xmm5 - pshufd $177,%xmm3,%xmm4 + pshufd $0xb1,%xmm3,%xmm4 por %xmm3,%xmm4 pshufd $0,%xmm5,%xmm5 - pshufd $30,%xmm4,%xmm3 + pshufd $0x1e,%xmm4,%xmm3 por %xmm3,%xmm4 pxor %xmm3,%xmm3 pcmpeqd %xmm3,%xmm4 @@ -2883,6 +2893,7 @@ ecp_nistz256_point_addx: movq 64+8(%rbx),%r14 movq 64+16(%rbx),%r15 movq 64+24(%rbx),%r8 +.byte 102,72,15,110,203 leaq 64-128(%rbx),%rsi leaq 32(%rsp),%rdi @@ -2974,7 +2985,7 @@ ecp_nistz256_point_addx: testq %r8,%r8 jnz .Ladd_proceedx testq %r9,%r9 - jz .Ladd_proceedx + jz .Ladd_doublex .byte 102,72,15,126,199 pxor %xmm0,%xmm0 @@ -2986,6 +2997,13 @@ ecp_nistz256_point_addx: movdqu %xmm0,80(%rdi) jmp .Ladd_donex +.align 32 +.Ladd_doublex: +.byte 102,72,15,126,206 +.byte 102,72,15,126,199 + addq $416,%rsp + jmp .Lpoint_double_shortcutx + .align 32 .Ladd_proceedx: movq 0+64(%rsp),%rdx @@ -3233,13 +3251,13 @@ ecp_nistz256_point_add_affinex: por %xmm1,%xmm3 movdqu 0(%rbx),%xmm0 - pshufd $177,%xmm3,%xmm5 + pshufd $0xb1,%xmm3,%xmm5 movdqu 16(%rbx),%xmm1 movdqu 32(%rbx),%xmm2 por %xmm3,%xmm5 movdqu 48(%rbx),%xmm3 movdqa %xmm0,416(%rsp) - pshufd $30,%xmm5,%xmm4 + pshufd $0x1e,%xmm5,%xmm4 movdqa %xmm1,416+16(%rsp) por %xmm0,%xmm1 .byte 102,72,15,110,199 @@ -3255,13 +3273,13 @@ ecp_nistz256_point_add_affinex: call __ecp_nistz256_sqr_montx pcmpeqd %xmm4,%xmm5 - pshufd $177,%xmm3,%xmm4 + pshufd $0xb1,%xmm3,%xmm4 movq 0(%rbx),%rdx movq %r12,%r9 por %xmm3,%xmm4 pshufd $0,%xmm5,%xmm5 - pshufd $30,%xmm4,%xmm3 + pshufd $0x1e,%xmm4,%xmm3 movq %r13,%r10 por %xmm3,%xmm4 pxor %xmm3,%xmm3 diff --git a/vendor/openssl/asm/x64-elf-gas/md5/md5-x86_64.s b/vendor/openssl/asm/x64-elf-gas/md5/md5-x86_64.s index 53f44ff5f..fad85c498 100644 --- a/vendor/openssl/asm/x64-elf-gas/md5/md5-x86_64.s +++ b/vendor/openssl/asm/x64-elf-gas/md5/md5-x86_64.s @@ -493,14 +493,14 @@ md5_block_asm_data_order: movl %ecx,%r11d addl %ecx,%ebx movl 0(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d xorl %edx,%r11d leal -198630844(%rax,%r10,1),%eax orl %ebx,%r11d xorl %ecx,%r11d addl %r11d,%eax movl 28(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $6,%eax xorl %ecx,%r11d addl %ebx,%eax @@ -509,7 +509,7 @@ md5_block_asm_data_order: xorl %ebx,%r11d addl %r11d,%edx movl 56(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $10,%edx xorl %ebx,%r11d addl %eax,%edx @@ -518,7 +518,7 @@ md5_block_asm_data_order: xorl %eax,%r11d addl %r11d,%ecx movl 20(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $15,%ecx xorl %eax,%r11d addl %edx,%ecx @@ -527,7 +527,7 @@ md5_block_asm_data_order: xorl %edx,%r11d addl %r11d,%ebx movl 48(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $21,%ebx xorl %edx,%r11d addl %ecx,%ebx @@ -536,7 +536,7 @@ md5_block_asm_data_order: xorl %ecx,%r11d addl %r11d,%eax movl 12(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $6,%eax xorl %ecx,%r11d addl %ebx,%eax @@ -545,7 +545,7 @@ md5_block_asm_data_order: xorl %ebx,%r11d addl %r11d,%edx movl 40(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $10,%edx xorl %ebx,%r11d addl %eax,%edx @@ -554,7 +554,7 @@ md5_block_asm_data_order: xorl %eax,%r11d addl %r11d,%ecx movl 4(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $15,%ecx xorl %eax,%r11d addl %edx,%ecx @@ -563,7 +563,7 @@ md5_block_asm_data_order: xorl %edx,%r11d addl %r11d,%ebx movl 32(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $21,%ebx xorl %edx,%r11d addl %ecx,%ebx @@ -572,7 +572,7 @@ md5_block_asm_data_order: xorl %ecx,%r11d addl %r11d,%eax movl 60(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $6,%eax xorl %ecx,%r11d addl %ebx,%eax @@ -581,7 +581,7 @@ md5_block_asm_data_order: xorl %ebx,%r11d addl %r11d,%edx movl 24(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $10,%edx xorl %ebx,%r11d addl %eax,%edx @@ -590,7 +590,7 @@ md5_block_asm_data_order: xorl %eax,%r11d addl %r11d,%ecx movl 52(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $15,%ecx xorl %eax,%r11d addl %edx,%ecx @@ -599,7 +599,7 @@ md5_block_asm_data_order: xorl %edx,%r11d addl %r11d,%ebx movl 16(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $21,%ebx xorl %edx,%r11d addl %ecx,%ebx @@ -608,7 +608,7 @@ md5_block_asm_data_order: xorl %ecx,%r11d addl %r11d,%eax movl 44(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $6,%eax xorl %ecx,%r11d addl %ebx,%eax @@ -617,7 +617,7 @@ md5_block_asm_data_order: xorl %ebx,%r11d addl %r11d,%edx movl 8(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $10,%edx xorl %ebx,%r11d addl %eax,%edx @@ -626,7 +626,7 @@ md5_block_asm_data_order: xorl %eax,%r11d addl %r11d,%ecx movl 36(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $15,%ecx xorl %eax,%r11d addl %edx,%ecx @@ -635,7 +635,7 @@ md5_block_asm_data_order: xorl %edx,%r11d addl %r11d,%ebx movl 0(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $21,%ebx xorl %edx,%r11d addl %ecx,%ebx diff --git a/vendor/openssl/asm/x64-elf-gas/modes/aesni-gcm-x86_64.s b/vendor/openssl/asm/x64-elf-gas/modes/aesni-gcm-x86_64.s index 4e82736a3..58bf244ed 100644 --- a/vendor/openssl/asm/x64-elf-gas/modes/aesni-gcm-x86_64.s +++ b/vendor/openssl/asm/x64-elf-gas/modes/aesni-gcm-x86_64.s @@ -27,40 +27,40 @@ _aesni_ctr32_ghash_6x: .Lresume_ctr32: vmovdqu %xmm1,(%r8) - vpclmulqdq $16,%xmm3,%xmm7,%xmm5 + vpclmulqdq $0x10,%xmm3,%xmm7,%xmm5 vpxor %xmm15,%xmm12,%xmm12 vmovups 16-128(%rcx),%xmm2 - vpclmulqdq $1,%xmm3,%xmm7,%xmm6 + vpclmulqdq $0x01,%xmm3,%xmm7,%xmm6 xorq %r12,%r12 cmpq %r14,%r15 vaesenc %xmm2,%xmm9,%xmm9 vmovdqu 48+8(%rsp),%xmm0 vpxor %xmm15,%xmm13,%xmm13 - vpclmulqdq $0,%xmm3,%xmm7,%xmm1 + vpclmulqdq $0x00,%xmm3,%xmm7,%xmm1 vaesenc %xmm2,%xmm10,%xmm10 vpxor %xmm15,%xmm14,%xmm14 setnc %r12b - vpclmulqdq $17,%xmm3,%xmm7,%xmm7 + vpclmulqdq $0x11,%xmm3,%xmm7,%xmm7 vaesenc %xmm2,%xmm11,%xmm11 vmovdqu 16-32(%r9),%xmm3 negq %r12 vaesenc %xmm2,%xmm12,%xmm12 vpxor %xmm5,%xmm6,%xmm6 - vpclmulqdq $0,%xmm3,%xmm0,%xmm5 + vpclmulqdq $0x00,%xmm3,%xmm0,%xmm5 vpxor %xmm4,%xmm8,%xmm8 vaesenc %xmm2,%xmm13,%xmm13 vpxor %xmm5,%xmm1,%xmm4 - andq $96,%r12 + andq $0x60,%r12 vmovups 32-128(%rcx),%xmm15 - vpclmulqdq $16,%xmm3,%xmm0,%xmm1 + vpclmulqdq $0x10,%xmm3,%xmm0,%xmm1 vaesenc %xmm2,%xmm14,%xmm14 - vpclmulqdq $1,%xmm3,%xmm0,%xmm2 + vpclmulqdq $0x01,%xmm3,%xmm0,%xmm2 leaq (%r14,%r12,1),%r14 vaesenc %xmm15,%xmm9,%xmm9 vpxor 16+8(%rsp),%xmm8,%xmm8 - vpclmulqdq $17,%xmm3,%xmm0,%xmm3 + vpclmulqdq $0x11,%xmm3,%xmm0,%xmm3 vmovdqu 64+8(%rsp),%xmm0 vaesenc %xmm15,%xmm10,%xmm10 movbeq 88(%r14),%r13 @@ -75,15 +75,15 @@ _aesni_ctr32_ghash_6x: vmovups 48-128(%rcx),%xmm15 vpxor %xmm1,%xmm6,%xmm6 - vpclmulqdq $0,%xmm5,%xmm0,%xmm1 + vpclmulqdq $0x00,%xmm5,%xmm0,%xmm1 vaesenc %xmm15,%xmm9,%xmm9 vpxor %xmm2,%xmm6,%xmm6 - vpclmulqdq $16,%xmm5,%xmm0,%xmm2 + vpclmulqdq $0x10,%xmm5,%xmm0,%xmm2 vaesenc %xmm15,%xmm10,%xmm10 vpxor %xmm3,%xmm7,%xmm7 - vpclmulqdq $1,%xmm5,%xmm0,%xmm3 + vpclmulqdq $0x01,%xmm5,%xmm0,%xmm3 vaesenc %xmm15,%xmm11,%xmm11 - vpclmulqdq $17,%xmm5,%xmm0,%xmm5 + vpclmulqdq $0x11,%xmm5,%xmm0,%xmm5 vmovdqu 80+8(%rsp),%xmm0 vaesenc %xmm15,%xmm12,%xmm12 vaesenc %xmm15,%xmm13,%xmm13 @@ -93,17 +93,17 @@ _aesni_ctr32_ghash_6x: vmovups 64-128(%rcx),%xmm15 vpxor %xmm2,%xmm6,%xmm6 - vpclmulqdq $0,%xmm1,%xmm0,%xmm2 + vpclmulqdq $0x00,%xmm1,%xmm0,%xmm2 vaesenc %xmm15,%xmm9,%xmm9 vpxor %xmm3,%xmm6,%xmm6 - vpclmulqdq $16,%xmm1,%xmm0,%xmm3 + vpclmulqdq $0x10,%xmm1,%xmm0,%xmm3 vaesenc %xmm15,%xmm10,%xmm10 movbeq 72(%r14),%r13 vpxor %xmm5,%xmm7,%xmm7 - vpclmulqdq $1,%xmm1,%xmm0,%xmm5 + vpclmulqdq $0x01,%xmm1,%xmm0,%xmm5 vaesenc %xmm15,%xmm11,%xmm11 movbeq 64(%r14),%r12 - vpclmulqdq $17,%xmm1,%xmm0,%xmm1 + vpclmulqdq $0x11,%xmm1,%xmm0,%xmm1 vmovdqu 96+8(%rsp),%xmm0 vaesenc %xmm15,%xmm12,%xmm12 movq %r13,48+8(%rsp) @@ -115,18 +115,18 @@ _aesni_ctr32_ghash_6x: vmovups 80-128(%rcx),%xmm15 vpxor %xmm3,%xmm6,%xmm6 - vpclmulqdq $0,%xmm2,%xmm0,%xmm3 + vpclmulqdq $0x00,%xmm2,%xmm0,%xmm3 vaesenc %xmm15,%xmm9,%xmm9 vpxor %xmm5,%xmm6,%xmm6 - vpclmulqdq $16,%xmm2,%xmm0,%xmm5 + vpclmulqdq $0x10,%xmm2,%xmm0,%xmm5 vaesenc %xmm15,%xmm10,%xmm10 movbeq 56(%r14),%r13 vpxor %xmm1,%xmm7,%xmm7 - vpclmulqdq $1,%xmm2,%xmm0,%xmm1 + vpclmulqdq $0x01,%xmm2,%xmm0,%xmm1 vpxor 112+8(%rsp),%xmm8,%xmm8 vaesenc %xmm15,%xmm11,%xmm11 movbeq 48(%r14),%r12 - vpclmulqdq $17,%xmm2,%xmm0,%xmm2 + vpclmulqdq $0x11,%xmm2,%xmm0,%xmm2 vaesenc %xmm15,%xmm12,%xmm12 movq %r13,64+8(%rsp) vaesenc %xmm15,%xmm13,%xmm13 @@ -137,17 +137,17 @@ _aesni_ctr32_ghash_6x: vmovups 96-128(%rcx),%xmm15 vpxor %xmm5,%xmm6,%xmm6 - vpclmulqdq $16,%xmm3,%xmm8,%xmm5 + vpclmulqdq $0x10,%xmm3,%xmm8,%xmm5 vaesenc %xmm15,%xmm9,%xmm9 vpxor %xmm1,%xmm6,%xmm6 - vpclmulqdq $1,%xmm3,%xmm8,%xmm1 + vpclmulqdq $0x01,%xmm3,%xmm8,%xmm1 vaesenc %xmm15,%xmm10,%xmm10 movbeq 40(%r14),%r13 vpxor %xmm2,%xmm7,%xmm7 - vpclmulqdq $0,%xmm3,%xmm8,%xmm2 + vpclmulqdq $0x00,%xmm3,%xmm8,%xmm2 vaesenc %xmm15,%xmm11,%xmm11 movbeq 32(%r14),%r12 - vpclmulqdq $17,%xmm3,%xmm8,%xmm8 + vpclmulqdq $0x11,%xmm3,%xmm8,%xmm8 vaesenc %xmm15,%xmm12,%xmm12 movq %r13,80+8(%rsp) vaesenc %xmm15,%xmm13,%xmm13 @@ -169,7 +169,7 @@ _aesni_ctr32_ghash_6x: vaesenc %xmm15,%xmm11,%xmm11 movbeq 16(%r14),%r12 vpalignr $8,%xmm4,%xmm4,%xmm0 - vpclmulqdq $16,%xmm3,%xmm4,%xmm4 + vpclmulqdq $0x10,%xmm3,%xmm4,%xmm4 movq %r13,96+8(%rsp) vaesenc %xmm15,%xmm12,%xmm12 movq %r12,104+8(%rsp) @@ -255,7 +255,7 @@ _aesni_ctr32_ghash_6x: vmovdqu %xmm7,16+8(%rsp) vpalignr $8,%xmm4,%xmm4,%xmm8 vaesenc %xmm15,%xmm10,%xmm10 - vpclmulqdq $16,%xmm3,%xmm4,%xmm4 + vpclmulqdq $0x10,%xmm3,%xmm4,%xmm4 vpxor 0(%rdi),%xmm1,%xmm2 vaesenc %xmm15,%xmm11,%xmm11 vpxor 16(%rdi),%xmm1,%xmm0 @@ -286,8 +286,8 @@ _aesni_ctr32_ghash_6x: vaesenclast %xmm3,%xmm14,%xmm14 vpaddb %xmm2,%xmm7,%xmm3 - addq $96,%r10 - subq $6,%rdx + addq $0x60,%r10 + subq $0x6,%rdx jc .L6x_done vmovups %xmm9,-96(%rsi) @@ -316,7 +316,7 @@ _aesni_ctr32_ghash_6x: .align 32 aesni_gcm_decrypt: xorq %r10,%r10 - cmpq $96,%rdx + cmpq $0x60,%rdx jb .Lgcm_dec_abort leaq (%rsp),%rax @@ -333,7 +333,7 @@ aesni_gcm_decrypt: movl 12(%r8),%ebx leaq .Lbswap_mask(%rip),%r11 leaq -128(%rcx),%r14 - movq $3968,%r15 + movq $0xf80,%r15 vmovdqu (%r9),%xmm8 andq $-128,%rsp vmovdqu (%r11),%xmm0 @@ -510,7 +510,7 @@ aesni_gcm_encrypt: movl 12(%r8),%ebx leaq .Lbswap_mask(%rip),%r11 leaq -128(%rcx),%r14 - movq $3968,%r15 + movq $0xf80,%r15 leaq 128(%rcx),%rcx vmovdqu (%r11),%xmm0 andq $-128,%rsp @@ -573,137 +573,137 @@ aesni_gcm_encrypt: vmovdqu 48(%rsp),%xmm6 vmovdqu 16-32(%r9),%xmm0 vpunpckhqdq %xmm6,%xmm6,%xmm2 - vpclmulqdq $0,%xmm3,%xmm7,%xmm5 + vpclmulqdq $0x00,%xmm3,%xmm7,%xmm5 vpxor %xmm6,%xmm2,%xmm2 - vpclmulqdq $17,%xmm3,%xmm7,%xmm7 - vpclmulqdq $0,%xmm15,%xmm1,%xmm1 + vpclmulqdq $0x11,%xmm3,%xmm7,%xmm7 + vpclmulqdq $0x00,%xmm15,%xmm1,%xmm1 vmovdqu 64(%rsp),%xmm9 - vpclmulqdq $0,%xmm0,%xmm6,%xmm4 + vpclmulqdq $0x00,%xmm0,%xmm6,%xmm4 vmovdqu 48-32(%r9),%xmm3 vpxor %xmm5,%xmm4,%xmm4 vpunpckhqdq %xmm9,%xmm9,%xmm5 - vpclmulqdq $17,%xmm0,%xmm6,%xmm6 + vpclmulqdq $0x11,%xmm0,%xmm6,%xmm6 vpxor %xmm9,%xmm5,%xmm5 vpxor %xmm7,%xmm6,%xmm6 - vpclmulqdq $16,%xmm15,%xmm2,%xmm2 + vpclmulqdq $0x10,%xmm15,%xmm2,%xmm2 vmovdqu 80-32(%r9),%xmm15 vpxor %xmm1,%xmm2,%xmm2 vmovdqu 80(%rsp),%xmm1 - vpclmulqdq $0,%xmm3,%xmm9,%xmm7 + vpclmulqdq $0x00,%xmm3,%xmm9,%xmm7 vmovdqu 64-32(%r9),%xmm0 vpxor %xmm4,%xmm7,%xmm7 vpunpckhqdq %xmm1,%xmm1,%xmm4 - vpclmulqdq $17,%xmm3,%xmm9,%xmm9 + vpclmulqdq $0x11,%xmm3,%xmm9,%xmm9 vpxor %xmm1,%xmm4,%xmm4 vpxor %xmm6,%xmm9,%xmm9 - vpclmulqdq $0,%xmm15,%xmm5,%xmm5 + vpclmulqdq $0x00,%xmm15,%xmm5,%xmm5 vpxor %xmm2,%xmm5,%xmm5 vmovdqu 96(%rsp),%xmm2 - vpclmulqdq $0,%xmm0,%xmm1,%xmm6 + vpclmulqdq $0x00,%xmm0,%xmm1,%xmm6 vmovdqu 96-32(%r9),%xmm3 vpxor %xmm7,%xmm6,%xmm6 vpunpckhqdq %xmm2,%xmm2,%xmm7 - vpclmulqdq $17,%xmm0,%xmm1,%xmm1 + vpclmulqdq $0x11,%xmm0,%xmm1,%xmm1 vpxor %xmm2,%xmm7,%xmm7 vpxor %xmm9,%xmm1,%xmm1 - vpclmulqdq $16,%xmm15,%xmm4,%xmm4 + vpclmulqdq $0x10,%xmm15,%xmm4,%xmm4 vmovdqu 128-32(%r9),%xmm15 vpxor %xmm5,%xmm4,%xmm4 vpxor 112(%rsp),%xmm8,%xmm8 - vpclmulqdq $0,%xmm3,%xmm2,%xmm5 + vpclmulqdq $0x00,%xmm3,%xmm2,%xmm5 vmovdqu 112-32(%r9),%xmm0 vpunpckhqdq %xmm8,%xmm8,%xmm9 vpxor %xmm6,%xmm5,%xmm5 - vpclmulqdq $17,%xmm3,%xmm2,%xmm2 + vpclmulqdq $0x11,%xmm3,%xmm2,%xmm2 vpxor %xmm8,%xmm9,%xmm9 vpxor %xmm1,%xmm2,%xmm2 - vpclmulqdq $0,%xmm15,%xmm7,%xmm7 + vpclmulqdq $0x00,%xmm15,%xmm7,%xmm7 vpxor %xmm4,%xmm7,%xmm4 - vpclmulqdq $0,%xmm0,%xmm8,%xmm6 + vpclmulqdq $0x00,%xmm0,%xmm8,%xmm6 vmovdqu 0-32(%r9),%xmm3 vpunpckhqdq %xmm14,%xmm14,%xmm1 - vpclmulqdq $17,%xmm0,%xmm8,%xmm8 + vpclmulqdq $0x11,%xmm0,%xmm8,%xmm8 vpxor %xmm14,%xmm1,%xmm1 vpxor %xmm5,%xmm6,%xmm5 - vpclmulqdq $16,%xmm15,%xmm9,%xmm9 + vpclmulqdq $0x10,%xmm15,%xmm9,%xmm9 vmovdqu 32-32(%r9),%xmm15 vpxor %xmm2,%xmm8,%xmm7 vpxor %xmm4,%xmm9,%xmm6 vmovdqu 16-32(%r9),%xmm0 vpxor %xmm5,%xmm7,%xmm9 - vpclmulqdq $0,%xmm3,%xmm14,%xmm4 + vpclmulqdq $0x00,%xmm3,%xmm14,%xmm4 vpxor %xmm9,%xmm6,%xmm6 vpunpckhqdq %xmm13,%xmm13,%xmm2 - vpclmulqdq $17,%xmm3,%xmm14,%xmm14 + vpclmulqdq $0x11,%xmm3,%xmm14,%xmm14 vpxor %xmm13,%xmm2,%xmm2 vpslldq $8,%xmm6,%xmm9 - vpclmulqdq $0,%xmm15,%xmm1,%xmm1 + vpclmulqdq $0x00,%xmm15,%xmm1,%xmm1 vpxor %xmm9,%xmm5,%xmm8 vpsrldq $8,%xmm6,%xmm6 vpxor %xmm6,%xmm7,%xmm7 - vpclmulqdq $0,%xmm0,%xmm13,%xmm5 + vpclmulqdq $0x00,%xmm0,%xmm13,%xmm5 vmovdqu 48-32(%r9),%xmm3 vpxor %xmm4,%xmm5,%xmm5 vpunpckhqdq %xmm12,%xmm12,%xmm9 - vpclmulqdq $17,%xmm0,%xmm13,%xmm13 + vpclmulqdq $0x11,%xmm0,%xmm13,%xmm13 vpxor %xmm12,%xmm9,%xmm9 vpxor %xmm14,%xmm13,%xmm13 vpalignr $8,%xmm8,%xmm8,%xmm14 - vpclmulqdq $16,%xmm15,%xmm2,%xmm2 + vpclmulqdq $0x10,%xmm15,%xmm2,%xmm2 vmovdqu 80-32(%r9),%xmm15 vpxor %xmm1,%xmm2,%xmm2 - vpclmulqdq $0,%xmm3,%xmm12,%xmm4 + vpclmulqdq $0x00,%xmm3,%xmm12,%xmm4 vmovdqu 64-32(%r9),%xmm0 vpxor %xmm5,%xmm4,%xmm4 vpunpckhqdq %xmm11,%xmm11,%xmm1 - vpclmulqdq $17,%xmm3,%xmm12,%xmm12 + vpclmulqdq $0x11,%xmm3,%xmm12,%xmm12 vpxor %xmm11,%xmm1,%xmm1 vpxor %xmm13,%xmm12,%xmm12 vxorps 16(%rsp),%xmm7,%xmm7 - vpclmulqdq $0,%xmm15,%xmm9,%xmm9 + vpclmulqdq $0x00,%xmm15,%xmm9,%xmm9 vpxor %xmm2,%xmm9,%xmm9 - vpclmulqdq $16,16(%r11),%xmm8,%xmm8 + vpclmulqdq $0x10,16(%r11),%xmm8,%xmm8 vxorps %xmm14,%xmm8,%xmm8 - vpclmulqdq $0,%xmm0,%xmm11,%xmm5 + vpclmulqdq $0x00,%xmm0,%xmm11,%xmm5 vmovdqu 96-32(%r9),%xmm3 vpxor %xmm4,%xmm5,%xmm5 vpunpckhqdq %xmm10,%xmm10,%xmm2 - vpclmulqdq $17,%xmm0,%xmm11,%xmm11 + vpclmulqdq $0x11,%xmm0,%xmm11,%xmm11 vpxor %xmm10,%xmm2,%xmm2 vpalignr $8,%xmm8,%xmm8,%xmm14 vpxor %xmm12,%xmm11,%xmm11 - vpclmulqdq $16,%xmm15,%xmm1,%xmm1 + vpclmulqdq $0x10,%xmm15,%xmm1,%xmm1 vmovdqu 128-32(%r9),%xmm15 vpxor %xmm9,%xmm1,%xmm1 vxorps %xmm7,%xmm14,%xmm14 - vpclmulqdq $16,16(%r11),%xmm8,%xmm8 + vpclmulqdq $0x10,16(%r11),%xmm8,%xmm8 vxorps %xmm14,%xmm8,%xmm8 - vpclmulqdq $0,%xmm3,%xmm10,%xmm4 + vpclmulqdq $0x00,%xmm3,%xmm10,%xmm4 vmovdqu 112-32(%r9),%xmm0 vpxor %xmm5,%xmm4,%xmm4 vpunpckhqdq %xmm8,%xmm8,%xmm9 - vpclmulqdq $17,%xmm3,%xmm10,%xmm10 + vpclmulqdq $0x11,%xmm3,%xmm10,%xmm10 vpxor %xmm8,%xmm9,%xmm9 vpxor %xmm11,%xmm10,%xmm10 - vpclmulqdq $0,%xmm15,%xmm2,%xmm2 + vpclmulqdq $0x00,%xmm15,%xmm2,%xmm2 vpxor %xmm1,%xmm2,%xmm2 - vpclmulqdq $0,%xmm0,%xmm8,%xmm5 - vpclmulqdq $17,%xmm0,%xmm8,%xmm7 + vpclmulqdq $0x00,%xmm0,%xmm8,%xmm5 + vpclmulqdq $0x11,%xmm0,%xmm8,%xmm7 vpxor %xmm4,%xmm5,%xmm5 - vpclmulqdq $16,%xmm15,%xmm9,%xmm6 + vpclmulqdq $0x10,%xmm15,%xmm9,%xmm6 vpxor %xmm10,%xmm7,%xmm7 vpxor %xmm2,%xmm6,%xmm6 @@ -716,11 +716,11 @@ aesni_gcm_encrypt: vpxor %xmm6,%xmm7,%xmm7 vpalignr $8,%xmm8,%xmm8,%xmm2 - vpclmulqdq $16,%xmm3,%xmm8,%xmm8 + vpclmulqdq $0x10,%xmm3,%xmm8,%xmm8 vpxor %xmm2,%xmm8,%xmm8 vpalignr $8,%xmm8,%xmm8,%xmm2 - vpclmulqdq $16,%xmm3,%xmm8,%xmm8 + vpclmulqdq $0x10,%xmm3,%xmm8,%xmm8 vpxor %xmm7,%xmm2,%xmm2 vpxor %xmm2,%xmm8,%xmm8 vpshufb (%r11),%xmm8,%xmm8 diff --git a/vendor/openssl/asm/x64-elf-gas/modes/ghash-x86_64.s b/vendor/openssl/asm/x64-elf-gas/modes/ghash-x86_64.s index 1cfe19cb5..10f598741 100644 --- a/vendor/openssl/asm/x64-elf-gas/modes/ghash-x86_64.s +++ b/vendor/openssl/asm/x64-elf-gas/modes/ghash-x86_64.s @@ -20,14 +20,14 @@ gcm_gmult_4bit: movq $14,%rcx movq 8(%rsi,%rax,1),%r8 movq (%rsi,%rax,1),%r9 - andb $240,%bl + andb $0xf0,%bl movq %r8,%rdx jmp .Loop1 .align 16 .Loop1: shrq $4,%r8 - andq $15,%rdx + andq $0xf,%rdx movq %r9,%r10 movb (%rdi,%rcx,1),%al shrq $4,%r9 @@ -43,13 +43,13 @@ gcm_gmult_4bit: js .Lbreak1 shrq $4,%r8 - andq $15,%rdx + andq $0xf,%rdx movq %r9,%r10 shrq $4,%r9 xorq 8(%rsi,%rax,1),%r8 shlq $60,%r10 xorq (%rsi,%rax,1),%r9 - andb $240,%bl + andb $0xf0,%bl xorq (%r11,%rdx,8),%r9 movq %r8,%rdx xorq %r10,%r8 @@ -58,19 +58,19 @@ gcm_gmult_4bit: .align 16 .Lbreak1: shrq $4,%r8 - andq $15,%rdx + andq $0xf,%rdx movq %r9,%r10 shrq $4,%r9 xorq 8(%rsi,%rax,1),%r8 shlq $60,%r10 xorq (%rsi,%rax,1),%r9 - andb $240,%bl + andb $0xf0,%bl xorq (%r11,%rdx,8),%r9 movq %r8,%rdx xorq %r10,%r8 shrq $4,%r8 - andq $15,%rdx + andq $0xf,%rdx movq %r9,%r10 shrq $4,%r9 xorq 8(%rsi,%rbx,1),%r8 @@ -874,20 +874,20 @@ gcm_ghash_clmul: movdqu 32(%rsi),%xmm7 .byte 102,65,15,56,0,194 - subq $16,%rcx + subq $0x10,%rcx jz .Lodd_tail movdqu 16(%rsi),%xmm6 movl OPENSSL_ia32cap_P+4(%rip),%eax - cmpq $48,%rcx + cmpq $0x30,%rcx jb .Lskip4x andl $71303168,%eax cmpl $4194304,%eax je .Lskip4x - subq $48,%rcx - movq $11547335547999543296,%rax + subq $0x30,%rcx + movq $0xA040608020C0E000,%rax movdqu 48(%rsi),%xmm14 movdqu 64(%rsi),%xmm15 @@ -934,7 +934,7 @@ gcm_ghash_clmul: xorps %xmm13,%xmm5 leaq 64(%rdx),%rdx - subq $64,%rcx + subq $0x40,%rcx jc .Ltail4x jmp .Lmod4_loop @@ -1017,7 +1017,7 @@ gcm_ghash_clmul: xorps %xmm13,%xmm5 leaq 64(%rdx),%rdx - subq $64,%rcx + subq $0x40,%rcx jnc .Lmod4_loop .Ltail4x: @@ -1061,10 +1061,10 @@ gcm_ghash_clmul: pxor %xmm4,%xmm0 psrlq $1,%xmm0 pxor %xmm1,%xmm0 - addq $64,%rcx + addq $0x40,%rcx jz .Ldone movdqu 32(%rsi),%xmm7 - subq $16,%rcx + subq $0x10,%rcx jz .Lodd_tail .Lskip4x: @@ -1087,7 +1087,7 @@ gcm_ghash_clmul: leaq 32(%rdx),%rdx nop - subq $32,%rcx + subq $0x20,%rcx jbe .Leven_tail nop jmp .Lmod_loop @@ -1150,7 +1150,7 @@ gcm_ghash_clmul: .byte 102,15,58,68,231,0 pxor %xmm1,%xmm0 - subq $32,%rcx + subq $0x20,%rcx ja .Lmod_loop .Leven_tail: @@ -1278,9 +1278,9 @@ gcm_init_avx: vmovdqu %xmm5,-16(%rdi) vpunpckhqdq %xmm0,%xmm0,%xmm3 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $17,%xmm2,%xmm0,%xmm1 - vpclmulqdq $0,%xmm2,%xmm0,%xmm0 - vpclmulqdq $0,%xmm6,%xmm3,%xmm3 + vpclmulqdq $0x11,%xmm2,%xmm0,%xmm1 + vpclmulqdq $0x00,%xmm2,%xmm0,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm3,%xmm3 vpxor %xmm0,%xmm1,%xmm4 vpxor %xmm4,%xmm3,%xmm3 @@ -1309,9 +1309,9 @@ gcm_init_avx: vmovdqa %xmm0,%xmm5 vpunpckhqdq %xmm0,%xmm0,%xmm3 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $17,%xmm2,%xmm0,%xmm1 - vpclmulqdq $0,%xmm2,%xmm0,%xmm0 - vpclmulqdq $0,%xmm6,%xmm3,%xmm3 + vpclmulqdq $0x11,%xmm2,%xmm0,%xmm1 + vpclmulqdq $0x00,%xmm2,%xmm0,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm3,%xmm3 vpxor %xmm0,%xmm1,%xmm4 vpxor %xmm4,%xmm3,%xmm3 @@ -1369,9 +1369,9 @@ gcm_ghash_avx: leaq 64(%rsi),%rsi vmovdqu .Lbswap_mask(%rip),%xmm13 vpshufb %xmm13,%xmm10,%xmm10 - cmpq $128,%rcx + cmpq $0x80,%rcx jb .Lshort_avx - subq $128,%rcx + subq $0x80,%rcx vmovdqu 112(%rdx),%xmm14 vmovdqu 0-64(%rsi),%xmm6 @@ -1380,91 +1380,91 @@ gcm_ghash_avx: vpunpckhqdq %xmm14,%xmm14,%xmm9 vmovdqu 96(%rdx),%xmm15 - vpclmulqdq $0,%xmm6,%xmm14,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm14,%xmm0 vpxor %xmm14,%xmm9,%xmm9 vpshufb %xmm13,%xmm15,%xmm15 - vpclmulqdq $17,%xmm6,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm14,%xmm1 vmovdqu 16-64(%rsi),%xmm6 vpunpckhqdq %xmm15,%xmm15,%xmm8 vmovdqu 80(%rdx),%xmm14 - vpclmulqdq $0,%xmm7,%xmm9,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm9,%xmm2 vpxor %xmm15,%xmm8,%xmm8 vpshufb %xmm13,%xmm14,%xmm14 - vpclmulqdq $0,%xmm6,%xmm15,%xmm3 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm3 vpunpckhqdq %xmm14,%xmm14,%xmm9 - vpclmulqdq $17,%xmm6,%xmm15,%xmm4 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm4 vmovdqu 48-64(%rsi),%xmm6 vpxor %xmm14,%xmm9,%xmm9 vmovdqu 64(%rdx),%xmm15 - vpclmulqdq $16,%xmm7,%xmm8,%xmm5 + vpclmulqdq $0x10,%xmm7,%xmm8,%xmm5 vmovdqu 80-64(%rsi),%xmm7 vpshufb %xmm13,%xmm15,%xmm15 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm14,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm14,%xmm0 vpxor %xmm1,%xmm4,%xmm4 vpunpckhqdq %xmm15,%xmm15,%xmm8 - vpclmulqdq $17,%xmm6,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm14,%xmm1 vmovdqu 64-64(%rsi),%xmm6 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm9,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm9,%xmm2 vpxor %xmm15,%xmm8,%xmm8 vmovdqu 48(%rdx),%xmm14 vpxor %xmm3,%xmm0,%xmm0 - vpclmulqdq $0,%xmm6,%xmm15,%xmm3 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm3 vpxor %xmm4,%xmm1,%xmm1 vpshufb %xmm13,%xmm14,%xmm14 - vpclmulqdq $17,%xmm6,%xmm15,%xmm4 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm4 vmovdqu 96-64(%rsi),%xmm6 vpxor %xmm5,%xmm2,%xmm2 vpunpckhqdq %xmm14,%xmm14,%xmm9 - vpclmulqdq $16,%xmm7,%xmm8,%xmm5 + vpclmulqdq $0x10,%xmm7,%xmm8,%xmm5 vmovdqu 128-64(%rsi),%xmm7 vpxor %xmm14,%xmm9,%xmm9 vmovdqu 32(%rdx),%xmm15 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm14,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm14,%xmm0 vpxor %xmm1,%xmm4,%xmm4 vpshufb %xmm13,%xmm15,%xmm15 - vpclmulqdq $17,%xmm6,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm14,%xmm1 vmovdqu 112-64(%rsi),%xmm6 vpxor %xmm2,%xmm5,%xmm5 vpunpckhqdq %xmm15,%xmm15,%xmm8 - vpclmulqdq $0,%xmm7,%xmm9,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm9,%xmm2 vpxor %xmm15,%xmm8,%xmm8 vmovdqu 16(%rdx),%xmm14 vpxor %xmm3,%xmm0,%xmm0 - vpclmulqdq $0,%xmm6,%xmm15,%xmm3 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm3 vpxor %xmm4,%xmm1,%xmm1 vpshufb %xmm13,%xmm14,%xmm14 - vpclmulqdq $17,%xmm6,%xmm15,%xmm4 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm4 vmovdqu 144-64(%rsi),%xmm6 vpxor %xmm5,%xmm2,%xmm2 vpunpckhqdq %xmm14,%xmm14,%xmm9 - vpclmulqdq $16,%xmm7,%xmm8,%xmm5 + vpclmulqdq $0x10,%xmm7,%xmm8,%xmm5 vmovdqu 176-64(%rsi),%xmm7 vpxor %xmm14,%xmm9,%xmm9 vmovdqu (%rdx),%xmm15 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm14,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm14,%xmm0 vpxor %xmm1,%xmm4,%xmm4 vpshufb %xmm13,%xmm15,%xmm15 - vpclmulqdq $17,%xmm6,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm14,%xmm1 vmovdqu 160-64(%rsi),%xmm6 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $16,%xmm7,%xmm9,%xmm2 + vpclmulqdq $0x10,%xmm7,%xmm9,%xmm2 leaq 128(%rdx),%rdx - cmpq $128,%rcx + cmpq $0x80,%rcx jb .Ltail_avx vpxor %xmm10,%xmm15,%xmm15 - subq $128,%rcx + subq $0x80,%rcx jmp .Loop8x_avx .align 32 @@ -1473,36 +1473,36 @@ gcm_ghash_avx: vmovdqu 112(%rdx),%xmm14 vpxor %xmm0,%xmm3,%xmm3 vpxor %xmm15,%xmm8,%xmm8 - vpclmulqdq $0,%xmm6,%xmm15,%xmm10 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm10 vpshufb %xmm13,%xmm14,%xmm14 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $17,%xmm6,%xmm15,%xmm11 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm11 vmovdqu 0-64(%rsi),%xmm6 vpunpckhqdq %xmm14,%xmm14,%xmm9 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm8,%xmm12 + vpclmulqdq $0x00,%xmm7,%xmm8,%xmm12 vmovdqu 32-64(%rsi),%xmm7 vpxor %xmm14,%xmm9,%xmm9 vmovdqu 96(%rdx),%xmm15 - vpclmulqdq $0,%xmm6,%xmm14,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm14,%xmm0 vpxor %xmm3,%xmm10,%xmm10 vpshufb %xmm13,%xmm15,%xmm15 - vpclmulqdq $17,%xmm6,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm14,%xmm1 vxorps %xmm4,%xmm11,%xmm11 vmovdqu 16-64(%rsi),%xmm6 vpunpckhqdq %xmm15,%xmm15,%xmm8 - vpclmulqdq $0,%xmm7,%xmm9,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm9,%xmm2 vpxor %xmm5,%xmm12,%xmm12 vxorps %xmm15,%xmm8,%xmm8 vmovdqu 80(%rdx),%xmm14 vpxor %xmm10,%xmm12,%xmm12 - vpclmulqdq $0,%xmm6,%xmm15,%xmm3 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm3 vpxor %xmm11,%xmm12,%xmm12 vpslldq $8,%xmm12,%xmm9 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $17,%xmm6,%xmm15,%xmm4 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm4 vpsrldq $8,%xmm12,%xmm12 vpxor %xmm9,%xmm10,%xmm10 vmovdqu 48-64(%rsi),%xmm6 @@ -1510,81 +1510,81 @@ gcm_ghash_avx: vxorps %xmm12,%xmm11,%xmm11 vpxor %xmm1,%xmm4,%xmm4 vpunpckhqdq %xmm14,%xmm14,%xmm9 - vpclmulqdq $16,%xmm7,%xmm8,%xmm5 + vpclmulqdq $0x10,%xmm7,%xmm8,%xmm5 vmovdqu 80-64(%rsi),%xmm7 vpxor %xmm14,%xmm9,%xmm9 vpxor %xmm2,%xmm5,%xmm5 vmovdqu 64(%rdx),%xmm15 vpalignr $8,%xmm10,%xmm10,%xmm12 - vpclmulqdq $0,%xmm6,%xmm14,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm14,%xmm0 vpshufb %xmm13,%xmm15,%xmm15 vpxor %xmm3,%xmm0,%xmm0 - vpclmulqdq $17,%xmm6,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm14,%xmm1 vmovdqu 64-64(%rsi),%xmm6 vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm4,%xmm1,%xmm1 - vpclmulqdq $0,%xmm7,%xmm9,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm9,%xmm2 vxorps %xmm15,%xmm8,%xmm8 vpxor %xmm5,%xmm2,%xmm2 vmovdqu 48(%rdx),%xmm14 - vpclmulqdq $16,(%r10),%xmm10,%xmm10 - vpclmulqdq $0,%xmm6,%xmm15,%xmm3 + vpclmulqdq $0x10,(%r10),%xmm10,%xmm10 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm3 vpshufb %xmm13,%xmm14,%xmm14 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $17,%xmm6,%xmm15,%xmm4 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm4 vmovdqu 96-64(%rsi),%xmm6 vpunpckhqdq %xmm14,%xmm14,%xmm9 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $16,%xmm7,%xmm8,%xmm5 + vpclmulqdq $0x10,%xmm7,%xmm8,%xmm5 vmovdqu 128-64(%rsi),%xmm7 vpxor %xmm14,%xmm9,%xmm9 vpxor %xmm2,%xmm5,%xmm5 vmovdqu 32(%rdx),%xmm15 - vpclmulqdq $0,%xmm6,%xmm14,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm14,%xmm0 vpshufb %xmm13,%xmm15,%xmm15 vpxor %xmm3,%xmm0,%xmm0 - vpclmulqdq $17,%xmm6,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm14,%xmm1 vmovdqu 112-64(%rsi),%xmm6 vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm4,%xmm1,%xmm1 - vpclmulqdq $0,%xmm7,%xmm9,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm9,%xmm2 vpxor %xmm15,%xmm8,%xmm8 vpxor %xmm5,%xmm2,%xmm2 vxorps %xmm12,%xmm10,%xmm10 vmovdqu 16(%rdx),%xmm14 vpalignr $8,%xmm10,%xmm10,%xmm12 - vpclmulqdq $0,%xmm6,%xmm15,%xmm3 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm3 vpshufb %xmm13,%xmm14,%xmm14 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $17,%xmm6,%xmm15,%xmm4 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm4 vmovdqu 144-64(%rsi),%xmm6 - vpclmulqdq $16,(%r10),%xmm10,%xmm10 + vpclmulqdq $0x10,(%r10),%xmm10,%xmm10 vxorps %xmm11,%xmm12,%xmm12 vpunpckhqdq %xmm14,%xmm14,%xmm9 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $16,%xmm7,%xmm8,%xmm5 + vpclmulqdq $0x10,%xmm7,%xmm8,%xmm5 vmovdqu 176-64(%rsi),%xmm7 vpxor %xmm14,%xmm9,%xmm9 vpxor %xmm2,%xmm5,%xmm5 vmovdqu (%rdx),%xmm15 - vpclmulqdq $0,%xmm6,%xmm14,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm14,%xmm0 vpshufb %xmm13,%xmm15,%xmm15 - vpclmulqdq $17,%xmm6,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm14,%xmm1 vmovdqu 160-64(%rsi),%xmm6 vpxor %xmm12,%xmm15,%xmm15 - vpclmulqdq $16,%xmm7,%xmm9,%xmm2 + vpclmulqdq $0x10,%xmm7,%xmm9,%xmm2 vpxor %xmm10,%xmm15,%xmm15 leaq 128(%rdx),%rdx - subq $128,%rcx + subq $0x80,%rcx jnc .Loop8x_avx - addq $128,%rcx + addq $0x80,%rcx jmp .Ltail_no_xor_avx .align 32 @@ -1598,97 +1598,97 @@ gcm_ghash_avx: vmovdqa %xmm0,%xmm3 vmovdqa %xmm1,%xmm4 vmovdqa %xmm2,%xmm5 - subq $16,%rcx + subq $0x10,%rcx jz .Ltail_avx vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm15,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm0 vpxor %xmm15,%xmm8,%xmm8 vmovdqu -32(%rdx),%xmm14 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $17,%xmm6,%xmm15,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm1 vmovdqu 16-64(%rsi),%xmm6 vpshufb %xmm13,%xmm14,%xmm15 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm8,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm8,%xmm2 vpsrldq $8,%xmm7,%xmm7 - subq $16,%rcx + subq $0x10,%rcx jz .Ltail_avx vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm15,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm0 vpxor %xmm15,%xmm8,%xmm8 vmovdqu -48(%rdx),%xmm14 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $17,%xmm6,%xmm15,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm1 vmovdqu 48-64(%rsi),%xmm6 vpshufb %xmm13,%xmm14,%xmm15 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm8,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm8,%xmm2 vmovdqu 80-64(%rsi),%xmm7 - subq $16,%rcx + subq $0x10,%rcx jz .Ltail_avx vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm15,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm0 vpxor %xmm15,%xmm8,%xmm8 vmovdqu -64(%rdx),%xmm14 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $17,%xmm6,%xmm15,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm1 vmovdqu 64-64(%rsi),%xmm6 vpshufb %xmm13,%xmm14,%xmm15 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm8,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm8,%xmm2 vpsrldq $8,%xmm7,%xmm7 - subq $16,%rcx + subq $0x10,%rcx jz .Ltail_avx vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm15,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm0 vpxor %xmm15,%xmm8,%xmm8 vmovdqu -80(%rdx),%xmm14 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $17,%xmm6,%xmm15,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm1 vmovdqu 96-64(%rsi),%xmm6 vpshufb %xmm13,%xmm14,%xmm15 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm8,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm8,%xmm2 vmovdqu 128-64(%rsi),%xmm7 - subq $16,%rcx + subq $0x10,%rcx jz .Ltail_avx vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm15,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm0 vpxor %xmm15,%xmm8,%xmm8 vmovdqu -96(%rdx),%xmm14 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $17,%xmm6,%xmm15,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm1 vmovdqu 112-64(%rsi),%xmm6 vpshufb %xmm13,%xmm14,%xmm15 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm8,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm8,%xmm2 vpsrldq $8,%xmm7,%xmm7 - subq $16,%rcx + subq $0x10,%rcx jz .Ltail_avx vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm15,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm0 vpxor %xmm15,%xmm8,%xmm8 vmovdqu -112(%rdx),%xmm14 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $17,%xmm6,%xmm15,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm1 vmovdqu 144-64(%rsi),%xmm6 vpshufb %xmm13,%xmm14,%xmm15 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm8,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm8,%xmm2 vmovq 184-64(%rsi),%xmm7 - subq $16,%rcx + subq $0x10,%rcx jmp .Ltail_avx .align 32 @@ -1697,12 +1697,12 @@ gcm_ghash_avx: .Ltail_no_xor_avx: vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm15,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm0 vpxor %xmm15,%xmm8,%xmm8 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $17,%xmm6,%xmm15,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm1 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm8,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm8,%xmm2 vmovdqu (%r10),%xmm12 @@ -1717,11 +1717,11 @@ gcm_ghash_avx: vpxor %xmm9,%xmm10,%xmm10 vpxor %xmm5,%xmm11,%xmm11 - vpclmulqdq $16,%xmm12,%xmm10,%xmm9 + vpclmulqdq $0x10,%xmm12,%xmm10,%xmm9 vpalignr $8,%xmm10,%xmm10,%xmm10 vpxor %xmm9,%xmm10,%xmm10 - vpclmulqdq $16,%xmm12,%xmm10,%xmm9 + vpclmulqdq $0x10,%xmm12,%xmm10,%xmm9 vpalignr $8,%xmm10,%xmm10,%xmm10 vpxor %xmm11,%xmm10,%xmm10 vpxor %xmm9,%xmm10,%xmm10 diff --git a/vendor/openssl/asm/x64-elf-gas/sha/sha1-mb-x86_64.s b/vendor/openssl/asm/x64-elf-gas/sha/sha1-mb-x86_64.s index 8da489ea4..d2857f328 100644 --- a/vendor/openssl/asm/x64-elf-gas/sha/sha1-mb-x86_64.s +++ b/vendor/openssl/asm/x64-elf-gas/sha/sha1-mb-x86_64.s @@ -2859,8 +2859,8 @@ _shaext_shortcut: .byte 69,15,58,204,193,3 .byte 69,15,56,200,214 - pshufd $0,%xmm6,%xmm11 - pshufd $85,%xmm6,%xmm12 + pshufd $0x00,%xmm6,%xmm11 + pshufd $0x55,%xmm6,%xmm12 movdqa %xmm6,%xmm7 pcmpgtd %xmm4,%xmm11 pcmpgtd %xmm4,%xmm12 diff --git a/vendor/openssl/asm/x64-elf-gas/sha/sha256-mb-x86_64.s b/vendor/openssl/asm/x64-elf-gas/sha/sha256-mb-x86_64.s index 0c0609408..bd72a459a 100644 --- a/vendor/openssl/asm/x64-elf-gas/sha/sha256-mb-x86_64.s +++ b/vendor/openssl/asm/x64-elf-gas/sha/sha256-mb-x86_64.s @@ -2714,11 +2714,11 @@ _shaext_shortcut: movdqa %xmm2,%xmm0 movdqa %xmm15,112(%rsp) .byte 69,15,56,203,254 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 pxor %xmm12,%xmm4 movdqa %xmm12,64(%rsp) .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 pxor %xmm14,%xmm8 movdqa %xmm14,96(%rsp) movdqa 16-128(%rbp),%xmm1 @@ -2736,11 +2736,11 @@ _shaext_shortcut: .byte 102,68,15,56,0,211 prefetcht0 127(%r9) .byte 69,15,56,203,254 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 .byte 102,68,15,56,0,219 .byte 15,56,204,229 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 32-128(%rbp),%xmm1 paddd %xmm6,%xmm1 .byte 69,15,56,203,247 @@ -2753,14 +2753,14 @@ _shaext_shortcut: movdqa %xmm2,%xmm0 movdqa %xmm7,%xmm3 .byte 69,15,56,203,254 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 .byte 102,15,58,15,222,4 paddd %xmm3,%xmm4 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 .byte 15,56,204,238 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 48-128(%rbp),%xmm1 paddd %xmm7,%xmm1 .byte 69,15,56,203,247 @@ -2777,13 +2777,13 @@ _shaext_shortcut: .byte 102,15,58,15,223,4 .byte 69,15,56,203,254 .byte 69,15,56,205,195 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm5 movdqa %xmm8,%xmm3 .byte 102,65,15,58,15,219,4 .byte 15,56,204,247 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 64-128(%rbp),%xmm1 paddd %xmm4,%xmm1 .byte 69,15,56,203,247 @@ -2799,13 +2799,13 @@ _shaext_shortcut: .byte 102,15,58,15,220,4 .byte 69,15,56,203,254 .byte 69,15,56,205,200 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm6 movdqa %xmm9,%xmm3 .byte 102,65,15,58,15,216,4 .byte 15,56,204,252 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 80-128(%rbp),%xmm1 paddd %xmm5,%xmm1 .byte 69,15,56,203,247 @@ -2821,13 +2821,13 @@ _shaext_shortcut: .byte 102,15,58,15,221,4 .byte 69,15,56,203,254 .byte 69,15,56,205,209 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm7 movdqa %xmm10,%xmm3 .byte 102,65,15,58,15,217,4 .byte 15,56,204,229 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 96-128(%rbp),%xmm1 paddd %xmm6,%xmm1 .byte 69,15,56,203,247 @@ -2843,13 +2843,13 @@ _shaext_shortcut: .byte 102,15,58,15,222,4 .byte 69,15,56,203,254 .byte 69,15,56,205,218 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm4 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 .byte 15,56,204,238 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 112-128(%rbp),%xmm1 paddd %xmm7,%xmm1 .byte 69,15,56,203,247 @@ -2865,13 +2865,13 @@ _shaext_shortcut: .byte 102,15,58,15,223,4 .byte 69,15,56,203,254 .byte 69,15,56,205,195 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm5 movdqa %xmm8,%xmm3 .byte 102,65,15,58,15,219,4 .byte 15,56,204,247 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 128-128(%rbp),%xmm1 paddd %xmm4,%xmm1 .byte 69,15,56,203,247 @@ -2887,13 +2887,13 @@ _shaext_shortcut: .byte 102,15,58,15,220,4 .byte 69,15,56,203,254 .byte 69,15,56,205,200 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm6 movdqa %xmm9,%xmm3 .byte 102,65,15,58,15,216,4 .byte 15,56,204,252 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 144-128(%rbp),%xmm1 paddd %xmm5,%xmm1 .byte 69,15,56,203,247 @@ -2909,13 +2909,13 @@ _shaext_shortcut: .byte 102,15,58,15,221,4 .byte 69,15,56,203,254 .byte 69,15,56,205,209 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm7 movdqa %xmm10,%xmm3 .byte 102,65,15,58,15,217,4 .byte 15,56,204,229 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 160-128(%rbp),%xmm1 paddd %xmm6,%xmm1 .byte 69,15,56,203,247 @@ -2931,13 +2931,13 @@ _shaext_shortcut: .byte 102,15,58,15,222,4 .byte 69,15,56,203,254 .byte 69,15,56,205,218 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm4 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 .byte 15,56,204,238 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 176-128(%rbp),%xmm1 paddd %xmm7,%xmm1 .byte 69,15,56,203,247 @@ -2953,13 +2953,13 @@ _shaext_shortcut: .byte 102,15,58,15,223,4 .byte 69,15,56,203,254 .byte 69,15,56,205,195 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm5 movdqa %xmm8,%xmm3 .byte 102,65,15,58,15,219,4 .byte 15,56,204,247 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 192-128(%rbp),%xmm1 paddd %xmm4,%xmm1 .byte 69,15,56,203,247 @@ -2975,13 +2975,13 @@ _shaext_shortcut: .byte 102,15,58,15,220,4 .byte 69,15,56,203,254 .byte 69,15,56,205,200 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm6 movdqa %xmm9,%xmm3 .byte 102,65,15,58,15,216,4 .byte 15,56,204,252 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 208-128(%rbp),%xmm1 paddd %xmm5,%xmm1 .byte 69,15,56,203,247 @@ -2997,13 +2997,13 @@ _shaext_shortcut: .byte 102,15,58,15,221,4 .byte 69,15,56,203,254 .byte 69,15,56,205,209 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm7 movdqa %xmm10,%xmm3 .byte 102,65,15,58,15,217,4 nop .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 224-128(%rbp),%xmm1 paddd %xmm6,%xmm1 .byte 69,15,56,203,247 @@ -3020,13 +3020,13 @@ _shaext_shortcut: pxor %xmm6,%xmm6 .byte 69,15,56,203,254 .byte 69,15,56,205,218 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 movdqa 240-128(%rbp),%xmm1 paddd %xmm7,%xmm1 movq (%rbx),%xmm7 nop .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 240-128(%rbp),%xmm2 paddd %xmm11,%xmm2 .byte 69,15,56,203,247 @@ -3036,17 +3036,17 @@ _shaext_shortcut: cmovgeq %rsp,%r8 cmpl 4(%rbx),%ecx cmovgeq %rsp,%r9 - pshufd $0,%xmm7,%xmm9 + pshufd $0x00,%xmm7,%xmm9 .byte 69,15,56,203,236 movdqa %xmm2,%xmm0 - pshufd $85,%xmm7,%xmm10 + pshufd $0x55,%xmm7,%xmm10 movdqa %xmm7,%xmm11 .byte 69,15,56,203,254 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 pcmpgtd %xmm6,%xmm9 pcmpgtd %xmm6,%xmm10 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 pcmpgtd %xmm6,%xmm11 movdqa K256_shaext-16(%rip),%xmm3 .byte 69,15,56,203,247 diff --git a/vendor/openssl/asm/x64-elf-gas/sha/sha256-x86_64.s b/vendor/openssl/asm/x64-elf-gas/sha/sha256-x86_64.s index a2fbedaf8..23b932e1d 100644 --- a/vendor/openssl/asm/x64-elf-gas/sha/sha256-x86_64.s +++ b/vendor/openssl/asm/x64-elf-gas/sha/sha256-x86_64.s @@ -1762,9 +1762,9 @@ _shaext_shortcut: movdqu 16(%rdi),%xmm2 movdqa 512-128(%rcx),%xmm7 - pshufd $27,%xmm1,%xmm0 - pshufd $177,%xmm1,%xmm1 - pshufd $27,%xmm2,%xmm2 + pshufd $0x1b,%xmm1,%xmm0 + pshufd $0xb1,%xmm1,%xmm1 + pshufd $0x1b,%xmm2,%xmm2 movdqa %xmm7,%xmm8 .byte 102,15,58,15,202,8 punpcklqdq %xmm0,%xmm2 @@ -1783,7 +1783,7 @@ _shaext_shortcut: .byte 102,15,56,0,231 movdqa %xmm2,%xmm10 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 nop movdqa %xmm1,%xmm9 .byte 15,56,203,202 @@ -1792,7 +1792,7 @@ _shaext_shortcut: paddd %xmm4,%xmm0 .byte 102,15,56,0,239 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 leaq 64(%rsi),%rsi .byte 15,56,204,220 .byte 15,56,203,202 @@ -1801,7 +1801,7 @@ _shaext_shortcut: paddd %xmm5,%xmm0 .byte 102,15,56,0,247 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm6,%xmm7 .byte 102,15,58,15,253,4 nop @@ -1813,7 +1813,7 @@ _shaext_shortcut: paddd %xmm6,%xmm0 .byte 15,56,205,222 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm3,%xmm7 .byte 102,15,58,15,254,4 nop @@ -1824,7 +1824,7 @@ _shaext_shortcut: paddd %xmm3,%xmm0 .byte 15,56,205,227 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm4,%xmm7 .byte 102,15,58,15,251,4 nop @@ -1835,7 +1835,7 @@ _shaext_shortcut: paddd %xmm4,%xmm0 .byte 15,56,205,236 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm5,%xmm7 .byte 102,15,58,15,252,4 nop @@ -1846,7 +1846,7 @@ _shaext_shortcut: paddd %xmm5,%xmm0 .byte 15,56,205,245 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm6,%xmm7 .byte 102,15,58,15,253,4 nop @@ -1857,7 +1857,7 @@ _shaext_shortcut: paddd %xmm6,%xmm0 .byte 15,56,205,222 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm3,%xmm7 .byte 102,15,58,15,254,4 nop @@ -1868,7 +1868,7 @@ _shaext_shortcut: paddd %xmm3,%xmm0 .byte 15,56,205,227 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm4,%xmm7 .byte 102,15,58,15,251,4 nop @@ -1879,7 +1879,7 @@ _shaext_shortcut: paddd %xmm4,%xmm0 .byte 15,56,205,236 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm5,%xmm7 .byte 102,15,58,15,252,4 nop @@ -1890,7 +1890,7 @@ _shaext_shortcut: paddd %xmm5,%xmm0 .byte 15,56,205,245 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm6,%xmm7 .byte 102,15,58,15,253,4 nop @@ -1901,7 +1901,7 @@ _shaext_shortcut: paddd %xmm6,%xmm0 .byte 15,56,205,222 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm3,%xmm7 .byte 102,15,58,15,254,4 nop @@ -1912,7 +1912,7 @@ _shaext_shortcut: paddd %xmm3,%xmm0 .byte 15,56,205,227 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm4,%xmm7 .byte 102,15,58,15,251,4 nop @@ -1923,7 +1923,7 @@ _shaext_shortcut: paddd %xmm4,%xmm0 .byte 15,56,205,236 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm5,%xmm7 .byte 102,15,58,15,252,4 .byte 15,56,203,202 @@ -1932,7 +1932,7 @@ _shaext_shortcut: movdqa 448-128(%rcx),%xmm0 paddd %xmm5,%xmm0 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 .byte 15,56,205,245 movdqa %xmm8,%xmm7 .byte 15,56,203,202 @@ -1941,7 +1941,7 @@ _shaext_shortcut: paddd %xmm6,%xmm0 nop .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 decq %rdx nop .byte 15,56,203,202 @@ -1950,9 +1950,9 @@ _shaext_shortcut: paddd %xmm9,%xmm1 jnz .Loop_shaext - pshufd $177,%xmm2,%xmm2 - pshufd $27,%xmm1,%xmm7 - pshufd $177,%xmm1,%xmm1 + pshufd $0xb1,%xmm2,%xmm2 + pshufd $0x1b,%xmm1,%xmm7 + pshufd $0xb1,%xmm1,%xmm1 punpckhqdq %xmm2,%xmm1 .byte 102,15,58,15,215,8 diff --git a/vendor/openssl/asm/x64-elf-gas/x86_64cpuid.s b/vendor/openssl/asm/x64-elf-gas/x86_64cpuid.s index 656a5ce85..0e81a290e 100644 --- a/vendor/openssl/asm/x64-elf-gas/x86_64cpuid.s +++ b/vendor/openssl/asm/x64-elf-gas/x86_64cpuid.s @@ -44,43 +44,43 @@ OPENSSL_ia32_cpuid: movl %eax,%r11d xorl %eax,%eax - cmpl $1970169159,%ebx + cmpl $0x756e6547,%ebx setne %al movl %eax,%r9d - cmpl $1231384169,%edx + cmpl $0x49656e69,%edx setne %al orl %eax,%r9d - cmpl $1818588270,%ecx + cmpl $0x6c65746e,%ecx setne %al orl %eax,%r9d jz .Lintel - cmpl $1752462657,%ebx + cmpl $0x68747541,%ebx setne %al movl %eax,%r10d - cmpl $1769238117,%edx + cmpl $0x69746E65,%edx setne %al orl %eax,%r10d - cmpl $1145913699,%ecx + cmpl $0x444D4163,%ecx setne %al orl %eax,%r10d jnz .Lintel - movl $2147483648,%eax + movl $0x80000000,%eax cpuid - cmpl $2147483649,%eax + cmpl $0x80000001,%eax jb .Lintel movl %eax,%r10d - movl $2147483649,%eax + movl $0x80000001,%eax cpuid orl %ecx,%r9d - andl $2049,%r9d + andl $0x00000801,%r9d - cmpl $2147483656,%r10d + cmpl $0x80000008,%r10d jb .Lintel - movl $2147483656,%eax + movl $0x80000008,%eax cpuid movzbq %cl,%r10 incq %r10 @@ -92,7 +92,7 @@ OPENSSL_ia32_cpuid: shrl $16,%ebx cmpb %r10b,%bl ja .Lgeneric - andl $4026531839,%edx + andl $0xefffffff,%edx jmp .Lgeneric .Lintel: @@ -105,7 +105,7 @@ OPENSSL_ia32_cpuid: cpuid movl %eax,%r10d shrl $14,%r10d - andl $4095,%r10d + andl $0xfff,%r10d cmpl $7,%r11d jb .Lnocacheinfo @@ -118,29 +118,29 @@ OPENSSL_ia32_cpuid: .Lnocacheinfo: movl $1,%eax cpuid - andl $3220176895,%edx + andl $0xbfefffff,%edx cmpl $0,%r9d jne .Lnotintel - orl $1073741824,%edx + orl $0x40000000,%edx andb $15,%ah cmpb $15,%ah jne .Lnotintel - orl $1048576,%edx + orl $0x00100000,%edx .Lnotintel: btl $28,%edx jnc .Lgeneric - andl $4026531839,%edx + andl $0xefffffff,%edx cmpl $0,%r10d je .Lgeneric - orl $268435456,%edx + orl $0x10000000,%edx shrl $16,%ebx cmpb $1,%bl ja .Lgeneric - andl $4026531839,%edx + andl $0xefffffff,%edx .Lgeneric: - andl $2048,%r9d - andl $4294965247,%ecx + andl $0x00000800,%r9d + andl $0xfffff7ff,%ecx orl %ecx,%r9d movl %edx,%r10d @@ -152,9 +152,9 @@ OPENSSL_ia32_cpuid: cmpl $6,%eax je .Ldone .Lclear_avx: - movl $4026525695,%eax + movl $0xefffe7ff,%eax andl %eax,%r9d - andl $4294967263,8(%rdi) + andl $0xffffffdf,8(%rdi) .Ldone: shlq $32,%r9 movl %r10d,%eax diff --git a/vendor/openssl/asm/x64-macosx-gas/aes/aes-x86_64.s b/vendor/openssl/asm/x64-macosx-gas/aes/aes-x86_64.s index a50170a9a..cb2db3584 100644 --- a/vendor/openssl/asm/x64-macosx-gas/aes/aes-x86_64.s +++ b/vendor/openssl/asm/x64-macosx-gas/aes/aes-x86_64.s @@ -81,8 +81,8 @@ L$enc_loop: movl 0(%r14,%rdi,8),%edi movl 0(%r14,%rbp,8),%ebp - andl $65280,%edi - andl $65280,%ebp + andl $0x0000ff00,%edi + andl $0x0000ff00,%ebp xorl %edi,%r10d xorl %ebp,%r11d @@ -94,8 +94,8 @@ L$enc_loop: movl 0(%r14,%rsi,8),%esi movl 0(%r14,%rdi,8),%edi - andl $65280,%esi - andl $65280,%edi + andl $0x0000ff00,%esi + andl $0x0000ff00,%edi shrl $16,%ebx xorl %esi,%r12d xorl %edi,%r8d @@ -108,9 +108,9 @@ L$enc_loop: movl 0(%r14,%rdi,8),%edi movl 0(%r14,%rbp,8),%ebp - andl $16711680,%esi - andl $16711680,%edi - andl $16711680,%ebp + andl $0x00ff0000,%esi + andl $0x00ff0000,%edi + andl $0x00ff0000,%ebp xorl %esi,%r10d xorl %edi,%r11d @@ -123,9 +123,9 @@ L$enc_loop: movl 2(%r14,%rdi,8),%edi movl 2(%r14,%rbp,8),%ebp - andl $16711680,%esi - andl $4278190080,%edi - andl $4278190080,%ebp + andl $0x00ff0000,%esi + andl $0xff000000,%edi + andl $0xff000000,%ebp xorl %esi,%r8d xorl %edi,%r10d @@ -138,8 +138,8 @@ L$enc_loop: movl 2(%r14,%rdi,8),%edi movl 16+0(%r15),%eax - andl $4278190080,%esi - andl $4278190080,%edi + andl $0xff000000,%esi + andl $0xff000000,%edi xorl %esi,%r12d xorl %edi,%r8d @@ -241,8 +241,8 @@ L$enc_loop_compact: xorl %r8d,%edx cmpq 16(%rsp),%r15 je L$enc_compact_done - movl $2155905152,%r10d - movl $2155905152,%r11d + movl $0x80808080,%r10d + movl $0x80808080,%r11d andl %eax,%r10d andl %ebx,%r11d movl %r10d,%esi @@ -253,10 +253,10 @@ L$enc_loop_compact: leal (%rbx,%rbx,1),%r9d subl %r10d,%esi subl %r11d,%edi - andl $4278124286,%r8d - andl $4278124286,%r9d - andl $454761243,%esi - andl $454761243,%edi + andl $0xfefefefe,%r8d + andl $0xfefefefe,%r9d + andl $0x1b1b1b1b,%esi + andl $0x1b1b1b1b,%edi movl %eax,%r10d movl %ebx,%r11d xorl %esi,%r8d @@ -264,9 +264,9 @@ L$enc_loop_compact: xorl %r8d,%eax xorl %r9d,%ebx - movl $2155905152,%r12d + movl $0x80808080,%r12d roll $24,%eax - movl $2155905152,%ebp + movl $0x80808080,%ebp roll $24,%ebx andl %ecx,%r12d andl %edx,%ebp @@ -289,10 +289,10 @@ L$enc_loop_compact: xorl %r10d,%eax xorl %r11d,%ebx - andl $4278124286,%r8d - andl $4278124286,%r9d - andl $454761243,%esi - andl $454761243,%edi + andl $0xfefefefe,%r8d + andl $0xfefefefe,%r9d + andl $0x1b1b1b1b,%esi + andl $0x1b1b1b1b,%edi movl %ecx,%r12d movl %edx,%ebp xorl %esi,%r8d @@ -345,7 +345,7 @@ _AES_encrypt: andq $-64,%rsp subq %rsp,%rcx negq %rcx - andq $960,%rcx + andq $0x3c0,%rcx subq %rcx,%rsp subq $32,%rsp @@ -370,7 +370,7 @@ L$enc_prologue: leaq L$AES_Te+2048(%rip),%r14 leaq 768(%rsp),%rbp subq %r14,%rbp - andq $768,%rbp + andq $0x300,%rbp leaq (%r14,%rbp,1),%r14 call _x86_64_AES_encrypt_compact @@ -792,7 +792,7 @@ _AES_decrypt: andq $-64,%rsp subq %rsp,%rcx negq %rcx - andq $960,%rcx + andq $0x3c0,%rcx subq %rcx,%rsp subq $32,%rsp @@ -817,7 +817,7 @@ L$dec_prologue: leaq L$AES_Td+2048(%rip),%r14 leaq 768(%rsp),%rbp subq %r14,%rbp - andq $768,%rbp + andq $0x300,%rbp leaq (%r14,%rbp,1),%r14 shrq $3,%rbp addq %rbp,%r14 @@ -1333,9 +1333,9 @@ L$cbc_picked_te: movq %r14,%r10 leaq 2304(%r14),%r11 movq %r15,%r12 - andq $4095,%r10 - andq $4095,%r11 - andq $4095,%r12 + andq $0xFFF,%r10 + andq $0xFFF,%r11 + andq $0xFFF,%r12 cmpq %r11,%r12 jb L$cbc_te_break_out @@ -1344,7 +1344,7 @@ L$cbc_picked_te: jmp L$cbc_te_ok L$cbc_te_break_out: subq %r10,%r12 - andq $4095,%r12 + andq $0xFFF,%r12 addq $320,%r12 subq %r12,%r15 .p2align 2 @@ -1370,7 +1370,7 @@ L$cbc_fast_body: movq %r15,%r10 subq %r14,%r10 - andq $4095,%r10 + andq $0xfff,%r10 cmpq $2304,%r10 jb L$cbc_do_ecopy cmpq $4096-248,%r10 @@ -1557,7 +1557,7 @@ L$cbc_slow_prologue: leaq -88-63(%rcx),%r10 subq %rbp,%r10 negq %r10 - andq $960,%r10 + andq $0x3c0,%r10 subq %r10,%rbp xchgq %rsp,%rbp @@ -1586,7 +1586,7 @@ L$cbc_slow_body: leaq 2048(%r14),%r14 leaq 768-8(%rsp),%rax subq %r14,%rax - andq $768,%rax + andq $0x300,%rax leaq (%r14,%rax,1),%r14 cmpq $0,%rbx diff --git a/vendor/openssl/asm/x64-macosx-gas/aes/aesni-mb-x86_64.s b/vendor/openssl/asm/x64-macosx-gas/aes/aesni-mb-x86_64.s index ccd3c7090..f127e013e 100644 --- a/vendor/openssl/asm/x64-macosx-gas/aes/aesni-mb-x86_64.s +++ b/vendor/openssl/asm/x64-macosx-gas/aes/aesni-mb-x86_64.s @@ -1120,7 +1120,7 @@ L$dec8x_loop_grande: vpxor %xmm15,%xmm8,%xmm8 vmovdqu %xmm9,112(%rbp) vpxor %xmm15,%xmm9,%xmm9 - xorq $128,%rbp + xorq $0x80,%rbp movl $1,%ecx jmp L$oop_dec8x diff --git a/vendor/openssl/asm/x64-macosx-gas/aes/aesni-sha256-x86_64.s b/vendor/openssl/asm/x64-macosx-gas/aes/aesni-sha256-x86_64.s index 7d8bdff63..89faf4624 100644 --- a/vendor/openssl/asm/x64-macosx-gas/aes/aesni-sha256-x86_64.s +++ b/vendor/openssl/asm/x64-macosx-gas/aes/aesni-sha256-x86_64.s @@ -4015,9 +4015,9 @@ aesni_cbc_sha256_enc_shaext: movups 16(%rcx),%xmm4 leaq 112(%rcx),%rcx - pshufd $27,%xmm1,%xmm0 - pshufd $177,%xmm1,%xmm1 - pshufd $27,%xmm2,%xmm2 + pshufd $0x1b,%xmm1,%xmm0 + pshufd $0xb1,%xmm1,%xmm1 + pshufd $0x1b,%xmm2,%xmm2 movdqa %xmm3,%xmm7 .byte 102,15,58,15,202,8 punpcklqdq %xmm0,%xmm2 @@ -4043,7 +4043,7 @@ L$oop_shaext: movups -80(%rcx),%xmm5 aesenc %xmm4,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movups -64(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,202 @@ -4055,7 +4055,7 @@ L$oop_shaext: movups -48(%rcx),%xmm5 aesenc %xmm4,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movups -32(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,202 @@ -4067,7 +4067,7 @@ L$oop_shaext: movups -16(%rcx),%xmm5 aesenc %xmm4,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm13,%xmm3 .byte 102,65,15,58,15,220,4 paddd %xmm3,%xmm10 @@ -4082,7 +4082,7 @@ L$oop_shaext: movups 16(%rcx),%xmm5 aesenc %xmm4,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movups 32(%rcx),%xmm4 aesenc %xmm5,%xmm6 movdqa %xmm10,%xmm3 @@ -4096,7 +4096,7 @@ L$oop_shaext: movups 48(%rcx),%xmm5 aesenc %xmm4,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 paddd %xmm3,%xmm12 @@ -4129,7 +4129,7 @@ L$aesenclast1: movups -64(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm12,%xmm3 .byte 102,65,15,58,15,219,4 paddd %xmm3,%xmm13 @@ -4143,7 +4143,7 @@ L$aesenclast1: movups -32(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm13,%xmm3 .byte 102,65,15,58,15,220,4 paddd %xmm3,%xmm10 @@ -4157,7 +4157,7 @@ L$aesenclast1: movups 0(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm10,%xmm3 .byte 102,65,15,58,15,221,4 paddd %xmm3,%xmm11 @@ -4171,7 +4171,7 @@ L$aesenclast1: movups 32(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 paddd %xmm3,%xmm12 @@ -4206,7 +4206,7 @@ L$aesenclast2: movups -64(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm12,%xmm3 .byte 102,65,15,58,15,219,4 paddd %xmm3,%xmm13 @@ -4220,7 +4220,7 @@ L$aesenclast2: movups -32(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm13,%xmm3 .byte 102,65,15,58,15,220,4 paddd %xmm3,%xmm10 @@ -4234,7 +4234,7 @@ L$aesenclast2: movups 0(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm10,%xmm3 .byte 102,65,15,58,15,221,4 paddd %xmm3,%xmm11 @@ -4248,7 +4248,7 @@ L$aesenclast2: movups 32(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 paddd %xmm3,%xmm12 @@ -4275,7 +4275,7 @@ L$aesenclast3: movups 16-112(%rcx),%xmm4 nop .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm12,%xmm3 .byte 102,65,15,58,15,219,4 paddd %xmm3,%xmm13 @@ -4296,7 +4296,7 @@ L$aesenclast3: movups -48(%rcx),%xmm5 aesenc %xmm4,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movups -32(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,202 @@ -4308,7 +4308,7 @@ L$aesenclast3: movups 0(%rcx),%xmm4 aesenc %xmm5,%xmm6 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movups 16(%rcx),%xmm5 aesenc %xmm4,%xmm6 .byte 15,56,203,202 @@ -4341,9 +4341,9 @@ L$aesenclast4: leaq 64(%rdi),%rdi jnz L$oop_shaext - pshufd $177,%xmm2,%xmm2 - pshufd $27,%xmm1,%xmm3 - pshufd $177,%xmm1,%xmm1 + pshufd $0xb1,%xmm2,%xmm2 + pshufd $0x1b,%xmm1,%xmm3 + pshufd $0xb1,%xmm1,%xmm1 punpckhqdq %xmm2,%xmm1 .byte 102,15,58,15,211,8 diff --git a/vendor/openssl/asm/x64-macosx-gas/aes/aesni-x86_64.s b/vendor/openssl/asm/x64-macosx-gas/aes/aesni-x86_64.s index 41ad80eeb..dde837980 100644 --- a/vendor/openssl/asm/x64-macosx-gas/aes/aesni-x86_64.s +++ b/vendor/openssl/asm/x64-macosx-gas/aes/aesni-x86_64.s @@ -503,7 +503,7 @@ _aesni_ecb_encrypt: testl %r8d,%r8d jz L$ecb_decrypt - cmpq $128,%rdx + cmpq $0x80,%rdx jb L$ecb_enc_tail movdqu (%rdi),%xmm2 @@ -515,7 +515,7 @@ _aesni_ecb_encrypt: movdqu 96(%rdi),%xmm8 movdqu 112(%rdi),%xmm9 leaq 128(%rdi),%rdi - subq $128,%rdx + subq $0x80,%rdx jmp L$ecb_enc_loop8_enter .p2align 4 L$ecb_enc_loop8: @@ -543,7 +543,7 @@ L$ecb_enc_loop8_enter: call _aesni_encrypt8 - subq $128,%rdx + subq $0x80,%rdx jnc L$ecb_enc_loop8 movups %xmm2,(%rsi) @@ -557,22 +557,22 @@ L$ecb_enc_loop8_enter: movups %xmm8,96(%rsi) movups %xmm9,112(%rsi) leaq 128(%rsi),%rsi - addq $128,%rdx + addq $0x80,%rdx jz L$ecb_ret L$ecb_enc_tail: movups (%rdi),%xmm2 - cmpq $32,%rdx + cmpq $0x20,%rdx jb L$ecb_enc_one movups 16(%rdi),%xmm3 je L$ecb_enc_two movups 32(%rdi),%xmm4 - cmpq $64,%rdx + cmpq $0x40,%rdx jb L$ecb_enc_three movups 48(%rdi),%xmm5 je L$ecb_enc_four movups 64(%rdi),%xmm6 - cmpq $96,%rdx + cmpq $0x60,%rdx jb L$ecb_enc_five movups 80(%rdi),%xmm7 je L$ecb_enc_six @@ -646,7 +646,7 @@ L$ecb_enc_six: .p2align 4 L$ecb_decrypt: - cmpq $128,%rdx + cmpq $0x80,%rdx jb L$ecb_dec_tail movdqu (%rdi),%xmm2 @@ -658,7 +658,7 @@ L$ecb_decrypt: movdqu 96(%rdi),%xmm8 movdqu 112(%rdi),%xmm9 leaq 128(%rdi),%rdi - subq $128,%rdx + subq $0x80,%rdx jmp L$ecb_dec_loop8_enter .p2align 4 L$ecb_dec_loop8: @@ -687,7 +687,7 @@ L$ecb_dec_loop8_enter: call _aesni_decrypt8 movups (%r11),%xmm0 - subq $128,%rdx + subq $0x80,%rdx jnc L$ecb_dec_loop8 movups %xmm2,(%rsi) @@ -709,22 +709,22 @@ L$ecb_dec_loop8_enter: movups %xmm9,112(%rsi) pxor %xmm9,%xmm9 leaq 128(%rsi),%rsi - addq $128,%rdx + addq $0x80,%rdx jz L$ecb_ret L$ecb_dec_tail: movups (%rdi),%xmm2 - cmpq $32,%rdx + cmpq $0x20,%rdx jb L$ecb_dec_one movups 16(%rdi),%xmm3 je L$ecb_dec_two movups 32(%rdi),%xmm4 - cmpq $64,%rdx + cmpq $0x40,%rdx jb L$ecb_dec_three movups 48(%rdi),%xmm5 je L$ecb_dec_four movups 64(%rdi),%xmm6 - cmpq $96,%rdx + cmpq $0x60,%rdx jb L$ecb_dec_five movups 80(%rdi),%xmm7 je L$ecb_dec_six @@ -1598,7 +1598,7 @@ L$oop_enc1_8: movdqa L$xts_magic(%rip),%xmm8 movdqa %xmm2,%xmm15 - pshufd $95,%xmm2,%xmm9 + pshufd $0x5f,%xmm2,%xmm9 pxor %xmm0,%xmm1 movdqa %xmm9,%xmm14 paddd %xmm9,%xmm9 @@ -1697,7 +1697,7 @@ L$xts_enc_grandloop: .byte 102,15,56,220,248 movups 64(%r11),%xmm0 movdqa %xmm8,80(%rsp) - pshufd $95,%xmm15,%xmm9 + pshufd $0x5f,%xmm15,%xmm9 jmp L$xts_enc_loop6 .p2align 5 L$xts_enc_loop6: @@ -1836,13 +1836,13 @@ L$xts_enc_short: jz L$xts_enc_done pxor %xmm0,%xmm11 - cmpq $32,%rdx + cmpq $0x20,%rdx jb L$xts_enc_one pxor %xmm0,%xmm12 je L$xts_enc_two pxor %xmm0,%xmm13 - cmpq $64,%rdx + cmpq $0x40,%rdx jb L$xts_enc_three pxor %xmm0,%xmm14 je L$xts_enc_four @@ -2069,7 +2069,7 @@ L$oop_enc1_11: movdqa L$xts_magic(%rip),%xmm8 movdqa %xmm2,%xmm15 - pshufd $95,%xmm2,%xmm9 + pshufd $0x5f,%xmm2,%xmm9 pxor %xmm0,%xmm1 movdqa %xmm9,%xmm14 paddd %xmm9,%xmm9 @@ -2168,7 +2168,7 @@ L$xts_dec_grandloop: .byte 102,15,56,222,248 movups 64(%r11),%xmm0 movdqa %xmm8,80(%rsp) - pshufd $95,%xmm15,%xmm9 + pshufd $0x5f,%xmm15,%xmm9 jmp L$xts_dec_loop6 .p2align 5 L$xts_dec_loop6: @@ -2308,13 +2308,13 @@ L$xts_dec_short: jz L$xts_dec_done pxor %xmm0,%xmm12 - cmpq $32,%rdx + cmpq $0x20,%rdx jb L$xts_dec_one pxor %xmm0,%xmm13 je L$xts_dec_two pxor %xmm0,%xmm14 - cmpq $64,%rdx + cmpq $0x40,%rdx jb L$xts_dec_three je L$xts_dec_four @@ -2345,7 +2345,7 @@ L$xts_dec_short: pcmpgtd %xmm15,%xmm14 movdqu %xmm6,64(%rsi) leaq 80(%rsi),%rsi - pshufd $19,%xmm14,%xmm11 + pshufd $0x13,%xmm14,%xmm11 andq $15,%r9 jz L$xts_dec_ret @@ -2634,7 +2634,7 @@ L$cbc_decrypt_bulk: leaq -8(%rax),%rbp movups (%r8),%xmm10 movl %r10d,%eax - cmpq $80,%rdx + cmpq $0x50,%rdx jbe L$cbc_dec_tail movups (%rcx),%xmm0 @@ -2650,14 +2650,14 @@ L$cbc_decrypt_bulk: movdqu 80(%rdi),%xmm7 movdqa %xmm6,%xmm15 movl _OPENSSL_ia32cap_P+4(%rip),%r9d - cmpq $112,%rdx + cmpq $0x70,%rdx jbe L$cbc_dec_six_or_seven andl $71303168,%r9d - subq $80,%rdx + subq $0x50,%rdx cmpl $4194304,%r9d je L$cbc_dec_loop6_enter - subq $32,%rdx + subq $0x20,%rdx leaq 112(%rcx),%rcx jmp L$cbc_dec_loop8_enter .p2align 4 @@ -2672,7 +2672,7 @@ L$cbc_dec_loop8_enter: movups 16-112(%rcx),%xmm1 pxor %xmm0,%xmm4 xorq %r11,%r11 - cmpq $112,%rdx + cmpq $0x70,%rdx pxor %xmm0,%xmm5 pxor %xmm0,%xmm6 pxor %xmm0,%xmm7 @@ -2857,21 +2857,21 @@ L$cbc_dec_done: movups %xmm8,96(%rsi) leaq 112(%rsi),%rsi - subq $128,%rdx + subq $0x80,%rdx ja L$cbc_dec_loop8 movaps %xmm9,%xmm2 leaq -112(%rcx),%rcx - addq $112,%rdx + addq $0x70,%rdx jle L$cbc_dec_clear_tail_collected movups %xmm9,(%rsi) leaq 16(%rsi),%rsi - cmpq $80,%rdx + cmpq $0x50,%rdx jbe L$cbc_dec_tail movaps %xmm11,%xmm2 L$cbc_dec_six_or_seven: - cmpq $96,%rdx + cmpq $0x60,%rdx ja L$cbc_dec_seven movaps %xmm7,%xmm8 @@ -2964,33 +2964,33 @@ L$cbc_dec_loop6_enter: movl %r10d,%eax movdqu %xmm6,64(%rsi) leaq 80(%rsi),%rsi - subq $96,%rdx + subq $0x60,%rdx ja L$cbc_dec_loop6 movdqa %xmm7,%xmm2 - addq $80,%rdx + addq $0x50,%rdx jle L$cbc_dec_clear_tail_collected movups %xmm7,(%rsi) leaq 16(%rsi),%rsi L$cbc_dec_tail: movups (%rdi),%xmm2 - subq $16,%rdx + subq $0x10,%rdx jbe L$cbc_dec_one movups 16(%rdi),%xmm3 movaps %xmm2,%xmm11 - subq $16,%rdx + subq $0x10,%rdx jbe L$cbc_dec_two movups 32(%rdi),%xmm4 movaps %xmm3,%xmm12 - subq $16,%rdx + subq $0x10,%rdx jbe L$cbc_dec_three movups 48(%rdi),%xmm5 movaps %xmm4,%xmm13 - subq $16,%rdx + subq $0x10,%rdx jbe L$cbc_dec_four movups 64(%rdi),%xmm6 @@ -3015,7 +3015,7 @@ L$cbc_dec_tail: movdqa %xmm6,%xmm2 pxor %xmm6,%xmm6 pxor %xmm7,%xmm7 - subq $16,%rdx + subq $0x10,%rdx jmp L$cbc_dec_tail_collected .p2align 4 @@ -3332,7 +3332,7 @@ L$oop_key192: pslldq $4,%xmm0 pxor %xmm3,%xmm0 - pshufd $255,%xmm0,%xmm3 + pshufd $0xff,%xmm0,%xmm3 pxor %xmm1,%xmm3 pslldq $4,%xmm1 pxor %xmm1,%xmm3 @@ -3419,7 +3419,7 @@ L$oop_key256: decl %r10d jz L$done_key256 - pshufd $255,%xmm0,%xmm2 + pshufd $0xff,%xmm0,%xmm2 pxor %xmm3,%xmm3 .byte 102,15,56,221,211 diff --git a/vendor/openssl/asm/x64-macosx-gas/aes/bsaes-x86_64.s b/vendor/openssl/asm/x64-macosx-gas/aes/bsaes-x86_64.s index 2af36a90b..52ae782e9 100644 --- a/vendor/openssl/asm/x64-macosx-gas/aes/bsaes-x86_64.s +++ b/vendor/openssl/asm/x64-macosx-gas/aes/bsaes-x86_64.s @@ -324,45 +324,45 @@ L$enc_sbox: pxor %xmm2,%xmm5 decl %r10d jl L$enc_done - pshufd $147,%xmm15,%xmm7 - pshufd $147,%xmm0,%xmm8 + pshufd $0x93,%xmm15,%xmm7 + pshufd $0x93,%xmm0,%xmm8 pxor %xmm7,%xmm15 - pshufd $147,%xmm3,%xmm9 + pshufd $0x93,%xmm3,%xmm9 pxor %xmm8,%xmm0 - pshufd $147,%xmm5,%xmm10 + pshufd $0x93,%xmm5,%xmm10 pxor %xmm9,%xmm3 - pshufd $147,%xmm2,%xmm11 + pshufd $0x93,%xmm2,%xmm11 pxor %xmm10,%xmm5 - pshufd $147,%xmm6,%xmm12 + pshufd $0x93,%xmm6,%xmm12 pxor %xmm11,%xmm2 - pshufd $147,%xmm1,%xmm13 + pshufd $0x93,%xmm1,%xmm13 pxor %xmm12,%xmm6 - pshufd $147,%xmm4,%xmm14 + pshufd $0x93,%xmm4,%xmm14 pxor %xmm13,%xmm1 pxor %xmm14,%xmm4 pxor %xmm15,%xmm8 pxor %xmm4,%xmm7 pxor %xmm4,%xmm8 - pshufd $78,%xmm15,%xmm15 + pshufd $0x4E,%xmm15,%xmm15 pxor %xmm0,%xmm9 - pshufd $78,%xmm0,%xmm0 + pshufd $0x4E,%xmm0,%xmm0 pxor %xmm2,%xmm12 pxor %xmm7,%xmm15 pxor %xmm6,%xmm13 pxor %xmm8,%xmm0 pxor %xmm5,%xmm11 - pshufd $78,%xmm2,%xmm7 + pshufd $0x4E,%xmm2,%xmm7 pxor %xmm1,%xmm14 - pshufd $78,%xmm6,%xmm8 + pshufd $0x4E,%xmm6,%xmm8 pxor %xmm3,%xmm10 - pshufd $78,%xmm5,%xmm2 + pshufd $0x4E,%xmm5,%xmm2 pxor %xmm4,%xmm10 - pshufd $78,%xmm4,%xmm6 + pshufd $0x4E,%xmm4,%xmm6 pxor %xmm4,%xmm11 - pshufd $78,%xmm1,%xmm5 + pshufd $0x4E,%xmm1,%xmm5 pxor %xmm11,%xmm7 - pshufd $78,%xmm3,%xmm1 + pshufd $0x4E,%xmm3,%xmm1 pxor %xmm12,%xmm8 pxor %xmm10,%xmm2 pxor %xmm14,%xmm6 @@ -796,24 +796,24 @@ L$dec_sbox: decl %r10d jl L$dec_done - pshufd $78,%xmm15,%xmm7 - pshufd $78,%xmm2,%xmm13 + pshufd $0x4E,%xmm15,%xmm7 + pshufd $0x4E,%xmm2,%xmm13 pxor %xmm15,%xmm7 - pshufd $78,%xmm4,%xmm14 + pshufd $0x4E,%xmm4,%xmm14 pxor %xmm2,%xmm13 - pshufd $78,%xmm0,%xmm8 + pshufd $0x4E,%xmm0,%xmm8 pxor %xmm4,%xmm14 - pshufd $78,%xmm5,%xmm9 + pshufd $0x4E,%xmm5,%xmm9 pxor %xmm0,%xmm8 - pshufd $78,%xmm3,%xmm10 + pshufd $0x4E,%xmm3,%xmm10 pxor %xmm5,%xmm9 pxor %xmm13,%xmm15 pxor %xmm13,%xmm0 - pshufd $78,%xmm1,%xmm11 + pshufd $0x4E,%xmm1,%xmm11 pxor %xmm3,%xmm10 pxor %xmm7,%xmm5 pxor %xmm8,%xmm3 - pshufd $78,%xmm6,%xmm12 + pshufd $0x4E,%xmm6,%xmm12 pxor %xmm1,%xmm11 pxor %xmm14,%xmm0 pxor %xmm9,%xmm1 @@ -827,45 +827,45 @@ L$dec_sbox: pxor %xmm14,%xmm1 pxor %xmm14,%xmm6 pxor %xmm12,%xmm4 - pshufd $147,%xmm15,%xmm7 - pshufd $147,%xmm0,%xmm8 + pshufd $0x93,%xmm15,%xmm7 + pshufd $0x93,%xmm0,%xmm8 pxor %xmm7,%xmm15 - pshufd $147,%xmm5,%xmm9 + pshufd $0x93,%xmm5,%xmm9 pxor %xmm8,%xmm0 - pshufd $147,%xmm3,%xmm10 + pshufd $0x93,%xmm3,%xmm10 pxor %xmm9,%xmm5 - pshufd $147,%xmm1,%xmm11 + pshufd $0x93,%xmm1,%xmm11 pxor %xmm10,%xmm3 - pshufd $147,%xmm6,%xmm12 + pshufd $0x93,%xmm6,%xmm12 pxor %xmm11,%xmm1 - pshufd $147,%xmm2,%xmm13 + pshufd $0x93,%xmm2,%xmm13 pxor %xmm12,%xmm6 - pshufd $147,%xmm4,%xmm14 + pshufd $0x93,%xmm4,%xmm14 pxor %xmm13,%xmm2 pxor %xmm14,%xmm4 pxor %xmm15,%xmm8 pxor %xmm4,%xmm7 pxor %xmm4,%xmm8 - pshufd $78,%xmm15,%xmm15 + pshufd $0x4E,%xmm15,%xmm15 pxor %xmm0,%xmm9 - pshufd $78,%xmm0,%xmm0 + pshufd $0x4E,%xmm0,%xmm0 pxor %xmm1,%xmm12 pxor %xmm7,%xmm15 pxor %xmm6,%xmm13 pxor %xmm8,%xmm0 pxor %xmm3,%xmm11 - pshufd $78,%xmm1,%xmm7 + pshufd $0x4E,%xmm1,%xmm7 pxor %xmm2,%xmm14 - pshufd $78,%xmm6,%xmm8 + pshufd $0x4E,%xmm6,%xmm8 pxor %xmm5,%xmm10 - pshufd $78,%xmm3,%xmm1 + pshufd $0x4E,%xmm3,%xmm1 pxor %xmm4,%xmm10 - pshufd $78,%xmm4,%xmm6 + pshufd $0x4E,%xmm4,%xmm6 pxor %xmm4,%xmm11 - pshufd $78,%xmm2,%xmm3 + pshufd $0x4E,%xmm2,%xmm3 pxor %xmm11,%xmm7 - pshufd $78,%xmm5,%xmm2 + pshufd $0x4E,%xmm5,%xmm2 pxor %xmm12,%xmm8 pxor %xmm1,%xmm10 pxor %xmm14,%xmm6 @@ -1552,20 +1552,20 @@ L$xts_enc_prologue: movdqa %xmm7,(%rax) andq $-16,%r14 - subq $128,%rsp + subq $0x80,%rsp movdqa 32(%rbp),%xmm6 pxor %xmm14,%xmm14 movdqa L$xts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - subq $128,%r14 + subq $0x80,%r14 jc L$xts_enc_short jmp L$xts_enc_loop .p2align 4 L$xts_enc_loop: - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm15 movdqa %xmm6,0(%rsp) @@ -1573,7 +1573,7 @@ L$xts_enc_loop: pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm0 movdqa %xmm6,16(%rsp) @@ -1582,7 +1582,7 @@ L$xts_enc_loop: pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 movdqu 0(%r12),%xmm7 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm1 movdqa %xmm6,32(%rsp) @@ -1592,7 +1592,7 @@ L$xts_enc_loop: pxor %xmm13,%xmm6 movdqu 16(%r12),%xmm8 pxor %xmm7,%xmm15 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm2 movdqa %xmm6,48(%rsp) @@ -1602,7 +1602,7 @@ L$xts_enc_loop: pxor %xmm13,%xmm6 movdqu 32(%r12),%xmm9 pxor %xmm8,%xmm0 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm3 movdqa %xmm6,64(%rsp) @@ -1612,7 +1612,7 @@ L$xts_enc_loop: pxor %xmm13,%xmm6 movdqu 48(%r12),%xmm10 pxor %xmm9,%xmm1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm4 movdqa %xmm6,80(%rsp) @@ -1622,7 +1622,7 @@ L$xts_enc_loop: pxor %xmm13,%xmm6 movdqu 64(%r12),%xmm11 pxor %xmm10,%xmm2 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm5 movdqa %xmm6,96(%rsp) @@ -1666,20 +1666,20 @@ L$xts_enc_loop: pxor %xmm14,%xmm14 movdqa L$xts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 paddq %xmm6,%xmm6 pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - subq $128,%r14 + subq $0x80,%r14 jnc L$xts_enc_loop L$xts_enc_short: - addq $128,%r14 + addq $0x80,%r14 jz L$xts_enc_done - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm15 movdqa %xmm6,0(%rsp) @@ -1687,7 +1687,7 @@ L$xts_enc_short: pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm0 movdqa %xmm6,16(%rsp) @@ -1698,7 +1698,7 @@ L$xts_enc_short: movdqu 0(%r12),%xmm7 cmpq $16,%r14 je L$xts_enc_1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm1 movdqa %xmm6,32(%rsp) @@ -1710,7 +1710,7 @@ L$xts_enc_short: cmpq $32,%r14 je L$xts_enc_2 pxor %xmm7,%xmm15 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm2 movdqa %xmm6,48(%rsp) @@ -1722,7 +1722,7 @@ L$xts_enc_short: cmpq $48,%r14 je L$xts_enc_3 pxor %xmm8,%xmm0 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm3 movdqa %xmm6,64(%rsp) @@ -1734,7 +1734,7 @@ L$xts_enc_short: cmpq $64,%r14 je L$xts_enc_4 pxor %xmm9,%xmm1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm4 movdqa %xmm6,80(%rsp) @@ -1746,7 +1746,7 @@ L$xts_enc_short: cmpq $80,%r14 je L$xts_enc_5 pxor %xmm10,%xmm2 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm5 movdqa %xmm6,96(%rsp) @@ -2011,20 +2011,20 @@ L$xts_dec_prologue: shlq $4,%rax subq %rax,%r14 - subq $128,%rsp + subq $0x80,%rsp movdqa 32(%rbp),%xmm6 pxor %xmm14,%xmm14 movdqa L$xts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - subq $128,%r14 + subq $0x80,%r14 jc L$xts_dec_short jmp L$xts_dec_loop .p2align 4 L$xts_dec_loop: - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm15 movdqa %xmm6,0(%rsp) @@ -2032,7 +2032,7 @@ L$xts_dec_loop: pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm0 movdqa %xmm6,16(%rsp) @@ -2041,7 +2041,7 @@ L$xts_dec_loop: pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 movdqu 0(%r12),%xmm7 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm1 movdqa %xmm6,32(%rsp) @@ -2051,7 +2051,7 @@ L$xts_dec_loop: pxor %xmm13,%xmm6 movdqu 16(%r12),%xmm8 pxor %xmm7,%xmm15 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm2 movdqa %xmm6,48(%rsp) @@ -2061,7 +2061,7 @@ L$xts_dec_loop: pxor %xmm13,%xmm6 movdqu 32(%r12),%xmm9 pxor %xmm8,%xmm0 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm3 movdqa %xmm6,64(%rsp) @@ -2071,7 +2071,7 @@ L$xts_dec_loop: pxor %xmm13,%xmm6 movdqu 48(%r12),%xmm10 pxor %xmm9,%xmm1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm4 movdqa %xmm6,80(%rsp) @@ -2081,7 +2081,7 @@ L$xts_dec_loop: pxor %xmm13,%xmm6 movdqu 64(%r12),%xmm11 pxor %xmm10,%xmm2 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm5 movdqa %xmm6,96(%rsp) @@ -2125,20 +2125,20 @@ L$xts_dec_loop: pxor %xmm14,%xmm14 movdqa L$xts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 paddq %xmm6,%xmm6 pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - subq $128,%r14 + subq $0x80,%r14 jnc L$xts_dec_loop L$xts_dec_short: - addq $128,%r14 + addq $0x80,%r14 jz L$xts_dec_done - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm15 movdqa %xmm6,0(%rsp) @@ -2146,7 +2146,7 @@ L$xts_dec_short: pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm0 movdqa %xmm6,16(%rsp) @@ -2157,7 +2157,7 @@ L$xts_dec_short: movdqu 0(%r12),%xmm7 cmpq $16,%r14 je L$xts_dec_1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm1 movdqa %xmm6,32(%rsp) @@ -2169,7 +2169,7 @@ L$xts_dec_short: cmpq $32,%r14 je L$xts_dec_2 pxor %xmm7,%xmm15 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm2 movdqa %xmm6,48(%rsp) @@ -2181,7 +2181,7 @@ L$xts_dec_short: cmpq $48,%r14 je L$xts_dec_3 pxor %xmm8,%xmm0 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm3 movdqa %xmm6,64(%rsp) @@ -2193,7 +2193,7 @@ L$xts_dec_short: cmpq $64,%r14 je L$xts_dec_4 pxor %xmm9,%xmm1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm4 movdqa %xmm6,80(%rsp) @@ -2205,7 +2205,7 @@ L$xts_dec_short: cmpq $80,%r14 je L$xts_dec_5 pxor %xmm10,%xmm2 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm5 movdqa %xmm6,96(%rsp) @@ -2382,7 +2382,7 @@ L$xts_dec_done: pxor %xmm14,%xmm14 movdqa L$xts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 movdqa %xmm6,%xmm5 paddq %xmm6,%xmm6 pand %xmm12,%xmm13 diff --git a/vendor/openssl/asm/x64-macosx-gas/aes/vpaes-x86_64.s b/vendor/openssl/asm/x64-macosx-gas/aes/vpaes-x86_64.s index c724170ce..2ffd0bc10 100644 --- a/vendor/openssl/asm/x64-macosx-gas/aes/vpaes-x86_64.s +++ b/vendor/openssl/asm/x64-macosx-gas/aes/vpaes-x86_64.s @@ -60,7 +60,7 @@ L$enc_loop: addq $16,%r11 pxor %xmm0,%xmm3 .byte 102,15,56,0,193 - andq $48,%r11 + andq $0x30,%r11 subq $1,%rax pxor %xmm3,%xmm0 @@ -120,10 +120,10 @@ _vpaes_decrypt_core: pand %xmm9,%xmm0 .byte 102,15,56,0,208 movdqa L$k_dipt+16(%rip),%xmm0 - xorq $48,%r11 + xorq $0x30,%r11 leaq L$k_dsbd(%rip),%r10 .byte 102,15,56,0,193 - andq $48,%r11 + andq $0x30,%r11 pxor %xmm5,%xmm2 movdqa L$k_mc_forward+48(%rip),%xmm5 pxor %xmm2,%xmm0 @@ -242,7 +242,7 @@ L$schedule_am_decrypting: movdqa (%r8,%r10,1),%xmm1 .byte 102,15,56,0,217 movdqu %xmm3,(%rdx) - xorq $48,%r8 + xorq $0x30,%r8 L$schedule_go: cmpl $192,%esi @@ -332,7 +332,7 @@ L$oop_schedule_256: call _vpaes_schedule_mangle - pshufd $255,%xmm0,%xmm0 + pshufd $0xFF,%xmm0,%xmm0 movdqa %xmm7,%xmm5 movdqa %xmm6,%xmm7 call _vpaes_schedule_low_round @@ -399,8 +399,8 @@ L$schedule_mangle_last_dec: .p2align 4 _vpaes_schedule_192_smear: - pshufd $128,%xmm6,%xmm1 - pshufd $254,%xmm7,%xmm0 + pshufd $0x80,%xmm6,%xmm1 + pshufd $0xFE,%xmm7,%xmm0 pxor %xmm1,%xmm6 pxor %xmm1,%xmm1 pxor %xmm0,%xmm6 @@ -437,7 +437,7 @@ _vpaes_schedule_round: pxor %xmm1,%xmm7 - pshufd $255,%xmm0,%xmm0 + pshufd $0xFF,%xmm0,%xmm0 .byte 102,15,58,15,192,1 @@ -596,7 +596,7 @@ L$schedule_mangle_both: movdqa (%r8,%r10,1),%xmm1 .byte 102,15,56,0,217 addq $-16,%r8 - andq $48,%r8 + andq $0x30,%r8 movdqu %xmm3,(%rdx) .byte 0xf3,0xc3 @@ -614,7 +614,7 @@ _vpaes_set_encrypt_key: movl %eax,240(%rdx) movl $0,%ecx - movl $48,%r8d + movl $0x30,%r8d call _vpaes_schedule_core xorl %eax,%eax .byte 0xf3,0xc3 diff --git a/vendor/openssl/asm/x64-macosx-gas/bn/rsaz-avx2.s b/vendor/openssl/asm/x64-macosx-gas/bn/rsaz-avx2.s index 1819757f0..1dea50d90 100644 --- a/vendor/openssl/asm/x64-macosx-gas/bn/rsaz-avx2.s +++ b/vendor/openssl/asm/x64-macosx-gas/bn/rsaz-avx2.s @@ -270,9 +270,9 @@ L$sqr_entry_1024: vpsrlq $29,%ymm1,%ymm11 vpand %ymm15,%ymm1,%ymm1 - vpermq $147,%ymm14,%ymm14 + vpermq $0x93,%ymm14,%ymm14 vpxor %ymm9,%ymm9,%ymm9 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpblendd $3,%ymm9,%ymm14,%ymm10 vpblendd $3,%ymm14,%ymm11,%ymm14 @@ -297,7 +297,7 @@ L$sqr_entry_1024: movq %rax,%r9 imull %ecx,%eax - andl $536870911,%eax + andl $0x1fffffff,%eax vmovd %eax,%xmm12 movq %rax,%rdx @@ -317,7 +317,7 @@ L$sqr_entry_1024: movq %r10,%rax imull %ecx,%eax - andl $536870911,%eax + andl $0x1fffffff,%eax movl $9,%r14d jmp L$OOP_REDUCE_1024 @@ -353,7 +353,7 @@ L$OOP_REDUCE_1024: imull %ecx,%eax vpaddq %ymm14,%ymm5,%ymm5 vpmuludq 192-128(%r13),%ymm12,%ymm11 - andl $536870911,%eax + andl $0x1fffffff,%eax vpaddq %ymm11,%ymm6,%ymm6 vpmuludq 224-128(%r13),%ymm12,%ymm10 vpaddq %ymm10,%ymm7,%ymm7 @@ -389,7 +389,7 @@ L$OOP_REDUCE_1024: vpaddq %ymm11,%ymm4,%ymm4 vpmuludq %ymm13,%ymm10,%ymm10 .byte 0xc4,0x41,0x7e,0x6f,0x9d,0x58,0x00,0x00,0x00 - andl $536870911,%eax + andl $0x1fffffff,%eax vpaddq %ymm10,%ymm5,%ymm5 vpmuludq %ymm13,%ymm14,%ymm14 vmovdqu 256-8-128(%r13),%ymm10 @@ -442,7 +442,7 @@ L$OOP_REDUCE_1024: imull %ecx,%eax vpaddq %ymm11,%ymm8,%ymm8 vpmuludq %ymm12,%ymm10,%ymm10 - andl $536870911,%eax + andl $0x1fffffff,%eax vmovd %eax,%xmm12 vmovdqu 96-24-128(%r13),%ymm11 .byte 0x67 @@ -483,7 +483,7 @@ L$OOP_REDUCE_1024: vpmuludq %ymm0,%ymm10,%ymm10 vpaddq %ymm11,%ymm6,%ymm5 vmovdqu 288-24-128(%r13),%ymm11 - andl $536870911,%eax + andl $0x1fffffff,%eax vpaddq %ymm10,%ymm7,%ymm6 vpmuludq %ymm0,%ymm14,%ymm14 addq 24(%rsp),%rdx @@ -514,15 +514,15 @@ L$OOP_REDUCE_1024: vpsrlq $29,%ymm1,%ymm11 vpand %ymm15,%ymm1,%ymm1 vpsrlq $29,%ymm2,%ymm12 - vpermq $147,%ymm14,%ymm14 + vpermq $0x93,%ymm14,%ymm14 vpand %ymm15,%ymm2,%ymm2 vpsrlq $29,%ymm3,%ymm13 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpand %ymm15,%ymm3,%ymm3 - vpermq $147,%ymm12,%ymm12 + vpermq $0x93,%ymm12,%ymm12 vpblendd $3,%ymm9,%ymm14,%ymm10 - vpermq $147,%ymm13,%ymm13 + vpermq $0x93,%ymm13,%ymm13 vpblendd $3,%ymm14,%ymm11,%ymm14 vpaddq %ymm10,%ymm0,%ymm0 vpblendd $3,%ymm11,%ymm12,%ymm11 @@ -538,15 +538,15 @@ L$OOP_REDUCE_1024: vpsrlq $29,%ymm1,%ymm11 vpand %ymm15,%ymm1,%ymm1 vpsrlq $29,%ymm2,%ymm12 - vpermq $147,%ymm14,%ymm14 + vpermq $0x93,%ymm14,%ymm14 vpand %ymm15,%ymm2,%ymm2 vpsrlq $29,%ymm3,%ymm13 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpand %ymm15,%ymm3,%ymm3 - vpermq $147,%ymm12,%ymm12 + vpermq $0x93,%ymm12,%ymm12 vpblendd $3,%ymm9,%ymm14,%ymm10 - vpermq $147,%ymm13,%ymm13 + vpermq $0x93,%ymm13,%ymm13 vpblendd $3,%ymm14,%ymm11,%ymm14 vpaddq %ymm10,%ymm0,%ymm0 vpblendd $3,%ymm11,%ymm12,%ymm11 @@ -565,18 +565,18 @@ L$OOP_REDUCE_1024: vpsrlq $29,%ymm5,%ymm11 vpand %ymm15,%ymm5,%ymm5 vpsrlq $29,%ymm6,%ymm12 - vpermq $147,%ymm14,%ymm14 + vpermq $0x93,%ymm14,%ymm14 vpand %ymm15,%ymm6,%ymm6 vpsrlq $29,%ymm7,%ymm13 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpand %ymm15,%ymm7,%ymm7 vpsrlq $29,%ymm8,%ymm0 - vpermq $147,%ymm12,%ymm12 + vpermq $0x93,%ymm12,%ymm12 vpand %ymm15,%ymm8,%ymm8 - vpermq $147,%ymm13,%ymm13 + vpermq $0x93,%ymm13,%ymm13 vpblendd $3,%ymm9,%ymm14,%ymm10 - vpermq $147,%ymm0,%ymm0 + vpermq $0x93,%ymm0,%ymm0 vpblendd $3,%ymm14,%ymm11,%ymm14 vpaddq %ymm10,%ymm4,%ymm4 vpblendd $3,%ymm11,%ymm12,%ymm11 @@ -592,18 +592,18 @@ L$OOP_REDUCE_1024: vpsrlq $29,%ymm5,%ymm11 vpand %ymm15,%ymm5,%ymm5 vpsrlq $29,%ymm6,%ymm12 - vpermq $147,%ymm14,%ymm14 + vpermq $0x93,%ymm14,%ymm14 vpand %ymm15,%ymm6,%ymm6 vpsrlq $29,%ymm7,%ymm13 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpand %ymm15,%ymm7,%ymm7 vpsrlq $29,%ymm8,%ymm0 - vpermq $147,%ymm12,%ymm12 + vpermq $0x93,%ymm12,%ymm12 vpand %ymm15,%ymm8,%ymm8 - vpermq $147,%ymm13,%ymm13 + vpermq $0x93,%ymm13,%ymm13 vpblendd $3,%ymm9,%ymm14,%ymm10 - vpermq $147,%ymm0,%ymm0 + vpermq $0x93,%ymm0,%ymm0 vpblendd $3,%ymm14,%ymm11,%ymm14 vpaddq %ymm10,%ymm4,%ymm4 vpblendd $3,%ymm11,%ymm12,%ymm11 @@ -740,7 +740,7 @@ L$oop_mul_1024: movq %rax,%r9 imull %r8d,%eax - andl $536870911,%eax + andl $0x1fffffff,%eax movq %rbx,%r11 imulq 16-128(%rsi),%r11 @@ -765,7 +765,7 @@ L$oop_mul_1024: vpmuludq 192-128(%rsi),%ymm10,%ymm13 vpaddq %ymm13,%ymm6,%ymm6 vpmuludq 224-128(%rsi),%ymm10,%ymm0 - vpermq $147,%ymm9,%ymm9 + vpermq $0x93,%ymm9,%ymm9 vpaddq %ymm0,%ymm7,%ymm7 vpmuludq 256-128(%rsi),%ymm10,%ymm12 vpbroadcastq 8(%r13),%ymm10 @@ -816,7 +816,7 @@ L$oop_mul_1024: movq %r10,%rax imull %r8d,%eax - andl $536870911,%eax + andl $0x1fffffff,%eax imulq 16-128(%rsi),%rbx addq %rbx,%r12 @@ -896,7 +896,7 @@ L$oop_mul_1024: vmovdqu -16+64-128(%rsi),%ymm12 movq %rax,%r11 imull %r8d,%eax - andl $536870911,%eax + andl $0x1fffffff,%eax imulq 8-128(%rsi),%rbx addq %rbx,%r12 @@ -973,7 +973,7 @@ L$oop_mul_1024: movq %r12,%rax imull %r8d,%eax - andl $536870911,%eax + andl $0x1fffffff,%eax vpmuludq %ymm10,%ymm0,%ymm0 vmovd %eax,%xmm11 @@ -1052,16 +1052,16 @@ L$oop_mul_1024: vpsrlq $29,%ymm1,%ymm13 vpand %ymm15,%ymm1,%ymm1 vpsrlq $29,%ymm2,%ymm10 - vpermq $147,%ymm12,%ymm12 + vpermq $0x93,%ymm12,%ymm12 vpand %ymm15,%ymm2,%ymm2 vpsrlq $29,%ymm3,%ymm11 - vpermq $147,%ymm13,%ymm13 + vpermq $0x93,%ymm13,%ymm13 vpand %ymm15,%ymm3,%ymm3 vpblendd $3,%ymm14,%ymm12,%ymm9 - vpermq $147,%ymm10,%ymm10 + vpermq $0x93,%ymm10,%ymm10 vpblendd $3,%ymm12,%ymm13,%ymm12 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpaddq %ymm9,%ymm0,%ymm0 vpblendd $3,%ymm13,%ymm10,%ymm13 vpaddq %ymm12,%ymm1,%ymm1 @@ -1076,15 +1076,15 @@ L$oop_mul_1024: vpsrlq $29,%ymm1,%ymm13 vpand %ymm15,%ymm1,%ymm1 vpsrlq $29,%ymm2,%ymm10 - vpermq $147,%ymm12,%ymm12 + vpermq $0x93,%ymm12,%ymm12 vpand %ymm15,%ymm2,%ymm2 vpsrlq $29,%ymm3,%ymm11 - vpermq $147,%ymm13,%ymm13 + vpermq $0x93,%ymm13,%ymm13 vpand %ymm15,%ymm3,%ymm3 - vpermq $147,%ymm10,%ymm10 + vpermq $0x93,%ymm10,%ymm10 vpblendd $3,%ymm14,%ymm12,%ymm9 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpblendd $3,%ymm12,%ymm13,%ymm12 vpaddq %ymm9,%ymm0,%ymm0 vpblendd $3,%ymm13,%ymm10,%ymm13 @@ -1104,18 +1104,18 @@ L$oop_mul_1024: vpsrlq $29,%ymm5,%ymm13 vpand %ymm15,%ymm5,%ymm5 vpsrlq $29,%ymm6,%ymm10 - vpermq $147,%ymm12,%ymm12 + vpermq $0x93,%ymm12,%ymm12 vpand %ymm15,%ymm6,%ymm6 vpsrlq $29,%ymm7,%ymm11 - vpermq $147,%ymm13,%ymm13 + vpermq $0x93,%ymm13,%ymm13 vpand %ymm15,%ymm7,%ymm7 vpsrlq $29,%ymm8,%ymm0 - vpermq $147,%ymm10,%ymm10 + vpermq $0x93,%ymm10,%ymm10 vpand %ymm15,%ymm8,%ymm8 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpblendd $3,%ymm14,%ymm12,%ymm9 - vpermq $147,%ymm0,%ymm0 + vpermq $0x93,%ymm0,%ymm0 vpblendd $3,%ymm12,%ymm13,%ymm12 vpaddq %ymm9,%ymm4,%ymm4 vpblendd $3,%ymm13,%ymm10,%ymm13 @@ -1131,18 +1131,18 @@ L$oop_mul_1024: vpsrlq $29,%ymm5,%ymm13 vpand %ymm15,%ymm5,%ymm5 vpsrlq $29,%ymm6,%ymm10 - vpermq $147,%ymm12,%ymm12 + vpermq $0x93,%ymm12,%ymm12 vpand %ymm15,%ymm6,%ymm6 vpsrlq $29,%ymm7,%ymm11 - vpermq $147,%ymm13,%ymm13 + vpermq $0x93,%ymm13,%ymm13 vpand %ymm15,%ymm7,%ymm7 vpsrlq $29,%ymm8,%ymm0 - vpermq $147,%ymm10,%ymm10 + vpermq $0x93,%ymm10,%ymm10 vpand %ymm15,%ymm8,%ymm8 - vpermq $147,%ymm11,%ymm11 + vpermq $0x93,%ymm11,%ymm11 vpblendd $3,%ymm14,%ymm12,%ymm9 - vpermq $147,%ymm0,%ymm0 + vpermq $0x93,%ymm0,%ymm0 vpblendd $3,%ymm12,%ymm13,%ymm12 vpaddq %ymm9,%ymm4,%ymm4 vpblendd $3,%ymm13,%ymm10,%ymm13 @@ -1374,7 +1374,7 @@ _rsaz_1024_red2norm_avx2: _rsaz_1024_norm2red_avx2: subq $-128,%rdi movq (%rsi),%r8 - movl $536870911,%eax + movl $0x1fffffff,%eax movq 8(%rsi),%r9 movq %r8,%r11 shrq $0,%r11 @@ -1554,54 +1554,116 @@ L$oop_scatter_1024: .p2align 5 _rsaz_1024_gather5_avx2: - leaq L$gather_table(%rip),%r11 - movl %edx,%eax - andl $3,%edx - shrl $2,%eax - shll $4,%edx - - vmovdqu -32(%r11),%ymm7 - vpbroadcastb 8(%r11,%rax,1),%xmm8 - vpbroadcastb 7(%r11,%rax,1),%xmm9 - vpbroadcastb 6(%r11,%rax,1),%xmm10 - vpbroadcastb 5(%r11,%rax,1),%xmm11 - vpbroadcastb 4(%r11,%rax,1),%xmm12 - vpbroadcastb 3(%r11,%rax,1),%xmm13 - vpbroadcastb 2(%r11,%rax,1),%xmm14 - vpbroadcastb 1(%r11,%rax,1),%xmm15 - - leaq 64(%rsi,%rdx,1),%rsi - movq $64,%r11 - movl $9,%eax - jmp L$oop_gather_1024 + vzeroupper + movq %rsp,%r11 + leaq -256(%rsp),%rsp + andq $-32,%rsp + leaq L$inc(%rip),%r10 + leaq -128(%rsp),%rax + + vmovd %edx,%xmm4 + vmovdqa (%r10),%ymm0 + vmovdqa 32(%r10),%ymm1 + vmovdqa 64(%r10),%ymm5 + vpbroadcastd %xmm4,%ymm4 + + vpaddd %ymm5,%ymm0,%ymm2 + vpcmpeqd %ymm4,%ymm0,%ymm0 + vpaddd %ymm5,%ymm1,%ymm3 + vpcmpeqd %ymm4,%ymm1,%ymm1 + vmovdqa %ymm0,0+128(%rax) + vpaddd %ymm5,%ymm2,%ymm0 + vpcmpeqd %ymm4,%ymm2,%ymm2 + vmovdqa %ymm1,32+128(%rax) + vpaddd %ymm5,%ymm3,%ymm1 + vpcmpeqd %ymm4,%ymm3,%ymm3 + vmovdqa %ymm2,64+128(%rax) + vpaddd %ymm5,%ymm0,%ymm2 + vpcmpeqd %ymm4,%ymm0,%ymm0 + vmovdqa %ymm3,96+128(%rax) + vpaddd %ymm5,%ymm1,%ymm3 + vpcmpeqd %ymm4,%ymm1,%ymm1 + vmovdqa %ymm0,128+128(%rax) + vpaddd %ymm5,%ymm2,%ymm8 + vpcmpeqd %ymm4,%ymm2,%ymm2 + vmovdqa %ymm1,160+128(%rax) + vpaddd %ymm5,%ymm3,%ymm9 + vpcmpeqd %ymm4,%ymm3,%ymm3 + vmovdqa %ymm2,192+128(%rax) + vpaddd %ymm5,%ymm8,%ymm10 + vpcmpeqd %ymm4,%ymm8,%ymm8 + vmovdqa %ymm3,224+128(%rax) + vpaddd %ymm5,%ymm9,%ymm11 + vpcmpeqd %ymm4,%ymm9,%ymm9 + vpaddd %ymm5,%ymm10,%ymm12 + vpcmpeqd %ymm4,%ymm10,%ymm10 + vpaddd %ymm5,%ymm11,%ymm13 + vpcmpeqd %ymm4,%ymm11,%ymm11 + vpaddd %ymm5,%ymm12,%ymm14 + vpcmpeqd %ymm4,%ymm12,%ymm12 + vpaddd %ymm5,%ymm13,%ymm15 + vpcmpeqd %ymm4,%ymm13,%ymm13 + vpcmpeqd %ymm4,%ymm14,%ymm14 + vpcmpeqd %ymm4,%ymm15,%ymm15 + + vmovdqa -32(%r10),%ymm7 + leaq 128(%rsi),%rsi + movl $9,%edx -.p2align 5 L$oop_gather_1024: - vpand -64(%rsi),%xmm8,%xmm0 - vpand (%rsi),%xmm9,%xmm1 - vpand 64(%rsi),%xmm10,%xmm2 - vpand (%rsi,%r11,2),%xmm11,%xmm3 - vpor %xmm0,%xmm1,%xmm1 - vpand 64(%rsi,%r11,2),%xmm12,%xmm4 - vpor %xmm2,%xmm3,%xmm3 - vpand (%rsi,%r11,4),%xmm13,%xmm5 - vpor %xmm1,%xmm3,%xmm3 - vpand 64(%rsi,%r11,4),%xmm14,%xmm6 + vmovdqa 0-128(%rsi),%ymm0 + vmovdqa 32-128(%rsi),%ymm1 + vmovdqa 64-128(%rsi),%ymm2 + vmovdqa 96-128(%rsi),%ymm3 + vpand 0+128(%rax),%ymm0,%ymm0 + vpand 32+128(%rax),%ymm1,%ymm1 + vpand 64+128(%rax),%ymm2,%ymm2 + vpor %ymm0,%ymm1,%ymm4 + vpand 96+128(%rax),%ymm3,%ymm3 + vmovdqa 128-128(%rsi),%ymm0 + vmovdqa 160-128(%rsi),%ymm1 + vpor %ymm2,%ymm3,%ymm5 + vmovdqa 192-128(%rsi),%ymm2 + vmovdqa 224-128(%rsi),%ymm3 + vpand 128+128(%rax),%ymm0,%ymm0 + vpand 160+128(%rax),%ymm1,%ymm1 + vpand 192+128(%rax),%ymm2,%ymm2 + vpor %ymm0,%ymm4,%ymm4 + vpand 224+128(%rax),%ymm3,%ymm3 + vpand 256-128(%rsi),%ymm8,%ymm0 + vpor %ymm1,%ymm5,%ymm5 + vpand 288-128(%rsi),%ymm9,%ymm1 + vpor %ymm2,%ymm4,%ymm4 + vpand 320-128(%rsi),%ymm10,%ymm2 + vpor %ymm3,%ymm5,%ymm5 + vpand 352-128(%rsi),%ymm11,%ymm3 + vpor %ymm0,%ymm4,%ymm4 + vpand 384-128(%rsi),%ymm12,%ymm0 + vpor %ymm1,%ymm5,%ymm5 + vpand 416-128(%rsi),%ymm13,%ymm1 + vpor %ymm2,%ymm4,%ymm4 + vpand 448-128(%rsi),%ymm14,%ymm2 + vpor %ymm3,%ymm5,%ymm5 + vpand 480-128(%rsi),%ymm15,%ymm3 + leaq 512(%rsi),%rsi + vpor %ymm0,%ymm4,%ymm4 + vpor %ymm1,%ymm5,%ymm5 + vpor %ymm2,%ymm4,%ymm4 + vpor %ymm3,%ymm5,%ymm5 + + vpor %ymm5,%ymm4,%ymm4 + vextracti128 $1,%ymm4,%xmm5 vpor %xmm4,%xmm5,%xmm5 - vpand -128(%rsi,%r11,8),%xmm15,%xmm2 - leaq (%rsi,%r11,8),%rsi - vpor %xmm3,%xmm5,%xmm5 - vpor %xmm2,%xmm6,%xmm6 - vpor %xmm5,%xmm6,%xmm6 - vpermd %ymm6,%ymm7,%ymm6 - vmovdqu %ymm6,(%rdi) + vpermd %ymm5,%ymm7,%ymm5 + vmovdqu %ymm5,(%rdi) leaq 32(%rdi),%rdi - decl %eax + decl %edx jnz L$oop_gather_1024 vpxor %ymm0,%ymm0,%ymm0 vmovdqu %ymm0,(%rdi) vzeroupper + leaq (%r11),%rsp .byte 0xf3,0xc3 @@ -1627,6 +1689,8 @@ L$scatter_permd: .long 0,2,4,6,7,7,7,7 L$gather_permd: .long 0,7,1,7,2,7,3,7 -L$gather_table: -.byte 0,0,0,0,0,0,0,0, 0xff,0,0,0,0,0,0,0 +L$inc: +.long 0,0,0,0, 1,1,1,1 +.long 2,2,2,2, 3,3,3,3 +.long 4,4,4,4, 4,4,4,4 .p2align 6 diff --git a/vendor/openssl/asm/x64-macosx-gas/bn/rsaz-x86_64.s b/vendor/openssl/asm/x64-macosx-gas/bn/rsaz-x86_64.s index 23c540d3a..8a6e44932 100644 --- a/vendor/openssl/asm/x64-macosx-gas/bn/rsaz-x86_64.s +++ b/vendor/openssl/asm/x64-macosx-gas/bn/rsaz-x86_64.s @@ -19,9 +19,9 @@ L$sqr_body: movq (%rsi),%rdx movq 8(%rsi),%rax movq %rcx,128(%rsp) - movl $524544,%r11d + movl $0x80100,%r11d andl _OPENSSL_ia32cap_P+8(%rip),%r11d - cmpl $524544,%r11d + cmpl $0x80100,%r11d je L$oop_sqrx jmp L$oop_sqr @@ -684,9 +684,9 @@ L$mul_body: .byte 102,72,15,110,199 .byte 102,72,15,110,201 movq %r8,128(%rsp) - movl $524544,%r11d + movl $0x80100,%r11d andl _OPENSSL_ia32cap_P+8(%rip),%r11d - cmpl $524544,%r11d + cmpl $0x80100,%r11d je L$mulx movq (%rdx),%rbx movq %rdx,%rbp @@ -762,52 +762,98 @@ _rsaz_512_mul_gather4: pushq %r14 pushq %r15 - movl %r9d,%r9d - subq $128+24,%rsp + subq $152,%rsp L$mul_gather4_body: - movl $524544,%r11d + movd %r9d,%xmm8 + movdqa L$inc+16(%rip),%xmm1 + movdqa L$inc(%rip),%xmm0 + + pshufd $0,%xmm8,%xmm8 + movdqa %xmm1,%xmm7 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm8,%xmm0 + movdqa %xmm7,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm8,%xmm1 + movdqa %xmm7,%xmm4 + paddd %xmm2,%xmm3 + pcmpeqd %xmm8,%xmm2 + movdqa %xmm7,%xmm5 + paddd %xmm3,%xmm4 + pcmpeqd %xmm8,%xmm3 + movdqa %xmm7,%xmm6 + paddd %xmm4,%xmm5 + pcmpeqd %xmm8,%xmm4 + paddd %xmm5,%xmm6 + pcmpeqd %xmm8,%xmm5 + paddd %xmm6,%xmm7 + pcmpeqd %xmm8,%xmm6 + pcmpeqd %xmm8,%xmm7 + + movdqa 0(%rdx),%xmm8 + movdqa 16(%rdx),%xmm9 + movdqa 32(%rdx),%xmm10 + movdqa 48(%rdx),%xmm11 + pand %xmm0,%xmm8 + movdqa 64(%rdx),%xmm12 + pand %xmm1,%xmm9 + movdqa 80(%rdx),%xmm13 + pand %xmm2,%xmm10 + movdqa 96(%rdx),%xmm14 + pand %xmm3,%xmm11 + movdqa 112(%rdx),%xmm15 + leaq 128(%rdx),%rbp + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd $0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 + movl $0x80100,%r11d andl _OPENSSL_ia32cap_P+8(%rip),%r11d - cmpl $524544,%r11d + cmpl $0x80100,%r11d je L$mulx_gather - movl 64(%rdx,%r9,4),%eax -.byte 102,72,15,110,199 - movl (%rdx,%r9,4),%ebx -.byte 102,72,15,110,201 +.byte 102,76,15,126,195 + movq %r8,128(%rsp) + movq %rdi,128+8(%rsp) + movq %rcx,128+16(%rsp) - shlq $32,%rax - orq %rax,%rbx movq (%rsi),%rax movq 8(%rsi),%rcx - leaq 128(%rdx,%r9,4),%rbp mulq %rbx movq %rax,(%rsp) movq %rcx,%rax movq %rdx,%r8 mulq %rbx - movd (%rbp),%xmm4 addq %rax,%r8 movq 16(%rsi),%rax movq %rdx,%r9 adcq $0,%r9 mulq %rbx - movd 64(%rbp),%xmm5 addq %rax,%r9 movq 24(%rsi),%rax movq %rdx,%r10 adcq $0,%r10 mulq %rbx - pslldq $4,%xmm5 addq %rax,%r10 movq 32(%rsi),%rax movq %rdx,%r11 adcq $0,%r11 mulq %rbx - por %xmm5,%xmm4 addq %rax,%r11 movq 40(%rsi),%rax movq %rdx,%r12 @@ -820,14 +866,12 @@ L$mul_gather4_body: adcq $0,%r13 mulq %rbx - leaq 128(%rbp),%rbp addq %rax,%r13 movq 56(%rsi),%rax movq %rdx,%r14 adcq $0,%r14 mulq %rbx -.byte 102,72,15,126,227 addq %rax,%r14 movq (%rsi),%rax movq %rdx,%r15 @@ -839,6 +883,35 @@ L$mul_gather4_body: .p2align 5 L$oop_mul_gather: + movdqa 0(%rbp),%xmm8 + movdqa 16(%rbp),%xmm9 + movdqa 32(%rbp),%xmm10 + movdqa 48(%rbp),%xmm11 + pand %xmm0,%xmm8 + movdqa 64(%rbp),%xmm12 + pand %xmm1,%xmm9 + movdqa 80(%rbp),%xmm13 + pand %xmm2,%xmm10 + movdqa 96(%rbp),%xmm14 + pand %xmm3,%xmm11 + movdqa 112(%rbp),%xmm15 + leaq 128(%rbp),%rbp + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd $0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 +.byte 102,76,15,126,195 + mulq %rbx addq %rax,%r8 movq 8(%rsi),%rax @@ -847,7 +920,6 @@ L$oop_mul_gather: adcq $0,%r8 mulq %rbx - movd (%rbp),%xmm4 addq %rax,%r9 movq 16(%rsi),%rax adcq $0,%rdx @@ -856,7 +928,6 @@ L$oop_mul_gather: adcq $0,%r9 mulq %rbx - movd 64(%rbp),%xmm5 addq %rax,%r10 movq 24(%rsi),%rax adcq $0,%rdx @@ -865,7 +936,6 @@ L$oop_mul_gather: adcq $0,%r10 mulq %rbx - pslldq $4,%xmm5 addq %rax,%r11 movq 32(%rsi),%rax adcq $0,%rdx @@ -874,7 +944,6 @@ L$oop_mul_gather: adcq $0,%r11 mulq %rbx - por %xmm5,%xmm4 addq %rax,%r12 movq 40(%rsi),%rax adcq $0,%rdx @@ -899,7 +968,6 @@ L$oop_mul_gather: adcq $0,%r14 mulq %rbx -.byte 102,72,15,126,227 addq %rax,%r15 movq (%rsi),%rax adcq $0,%rdx @@ -907,7 +975,6 @@ L$oop_mul_gather: movq %rdx,%r15 adcq $0,%r15 - leaq 128(%rbp),%rbp leaq 8(%rdi),%rdi decl %ecx @@ -922,8 +989,8 @@ L$oop_mul_gather: movq %r14,48(%rdi) movq %r15,56(%rdi) -.byte 102,72,15,126,199 -.byte 102,72,15,126,205 + movq 128+8(%rsp),%rdi + movq 128+16(%rsp),%rbp movq (%rsp),%r8 movq 8(%rsp),%r9 @@ -939,45 +1006,37 @@ L$oop_mul_gather: .p2align 5 L$mulx_gather: - movl 64(%rdx,%r9,4),%eax -.byte 102,72,15,110,199 - leaq 128(%rdx,%r9,4),%rbp - movl (%rdx,%r9,4),%edx -.byte 102,72,15,110,201 +.byte 102,76,15,126,194 + movq %r8,128(%rsp) + movq %rdi,128+8(%rsp) + movq %rcx,128+16(%rsp) - shlq $32,%rax - orq %rax,%rdx mulxq (%rsi),%rbx,%r8 movq %rbx,(%rsp) xorl %edi,%edi mulxq 8(%rsi),%rax,%r9 - movd (%rbp),%xmm4 mulxq 16(%rsi),%rbx,%r10 - movd 64(%rbp),%xmm5 adcxq %rax,%r8 mulxq 24(%rsi),%rax,%r11 - pslldq $4,%xmm5 adcxq %rbx,%r9 mulxq 32(%rsi),%rbx,%r12 - por %xmm5,%xmm4 adcxq %rax,%r10 mulxq 40(%rsi),%rax,%r13 adcxq %rbx,%r11 mulxq 48(%rsi),%rbx,%r14 - leaq 128(%rbp),%rbp adcxq %rax,%r12 mulxq 56(%rsi),%rax,%r15 -.byte 102,72,15,126,226 adcxq %rbx,%r13 adcxq %rax,%r14 +.byte 0x67 movq %r8,%rbx adcxq %rdi,%r15 @@ -986,24 +1045,48 @@ L$mulx_gather: .p2align 5 L$oop_mulx_gather: - mulxq (%rsi),%rax,%r8 + movdqa 0(%rbp),%xmm8 + movdqa 16(%rbp),%xmm9 + movdqa 32(%rbp),%xmm10 + movdqa 48(%rbp),%xmm11 + pand %xmm0,%xmm8 + movdqa 64(%rbp),%xmm12 + pand %xmm1,%xmm9 + movdqa 80(%rbp),%xmm13 + pand %xmm2,%xmm10 + movdqa 96(%rbp),%xmm14 + pand %xmm3,%xmm11 + movdqa 112(%rbp),%xmm15 + leaq 128(%rbp),%rbp + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd $0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 +.byte 102,76,15,126,194 + +.byte 0xc4,0x62,0xfb,0xf6,0x86,0x00,0x00,0x00,0x00 adcxq %rax,%rbx adoxq %r9,%r8 mulxq 8(%rsi),%rax,%r9 -.byte 0x66,0x0f,0x6e,0xa5,0x00,0x00,0x00,0x00 adcxq %rax,%r8 adoxq %r10,%r9 mulxq 16(%rsi),%rax,%r10 - movd 64(%rbp),%xmm5 - leaq 128(%rbp),%rbp adcxq %rax,%r9 adoxq %r11,%r10 .byte 0xc4,0x62,0xfb,0xf6,0x9e,0x18,0x00,0x00,0x00 - pslldq $4,%xmm5 - por %xmm5,%xmm4 adcxq %rax,%r10 adoxq %r12,%r11 @@ -1017,10 +1100,10 @@ L$oop_mulx_gather: .byte 0xc4,0x62,0xfb,0xf6,0xb6,0x30,0x00,0x00,0x00 adcxq %rax,%r13 +.byte 0x67 adoxq %r15,%r14 mulxq 56(%rsi),%rax,%r15 -.byte 102,72,15,126,226 movq %rbx,64(%rsp,%rcx,8) adcxq %rax,%r14 adoxq %rdi,%r15 @@ -1039,10 +1122,10 @@ L$oop_mulx_gather: movq %r14,64+48(%rsp) movq %r15,64+56(%rsp) -.byte 102,72,15,126,199 -.byte 102,72,15,126,205 - movq 128(%rsp),%rdx + movq 128+8(%rsp),%rdi + movq 128+16(%rsp),%rbp + movq (%rsp),%r8 movq 8(%rsp),%r9 movq 16(%rsp),%r10 @@ -1092,16 +1175,16 @@ _rsaz_512_mul_scatter4: movl %r9d,%r9d subq $128+24,%rsp L$mul_scatter4_body: - leaq (%r8,%r9,4),%r8 + leaq (%r8,%r9,8),%r8 .byte 102,72,15,110,199 .byte 102,72,15,110,202 .byte 102,73,15,110,208 movq %rcx,128(%rsp) movq %rdi,%rbp - movl $524544,%r11d + movl $0x80100,%r11d andl _OPENSSL_ia32cap_P+8(%rip),%r11d - cmpl $524544,%r11d + cmpl $0x80100,%r11d je L$mulx_scatter movq (%rdi),%rbx call __rsaz_512_mul @@ -1155,30 +1238,14 @@ L$mul_scatter_tail: call __rsaz_512_subtract - movl %r8d,0(%rsi) - shrq $32,%r8 - movl %r9d,128(%rsi) - shrq $32,%r9 - movl %r10d,256(%rsi) - shrq $32,%r10 - movl %r11d,384(%rsi) - shrq $32,%r11 - movl %r12d,512(%rsi) - shrq $32,%r12 - movl %r13d,640(%rsi) - shrq $32,%r13 - movl %r14d,768(%rsi) - shrq $32,%r14 - movl %r15d,896(%rsi) - shrq $32,%r15 - movl %r8d,64(%rsi) - movl %r9d,192(%rsi) - movl %r10d,320(%rsi) - movl %r11d,448(%rsi) - movl %r12d,576(%rsi) - movl %r13d,704(%rsi) - movl %r14d,832(%rsi) - movl %r15d,960(%rsi) + movq %r8,0(%rsi) + movq %r9,128(%rsi) + movq %r10,256(%rsi) + movq %r11,384(%rsi) + movq %r12,512(%rsi) + movq %r13,640(%rsi) + movq %r14,768(%rsi) + movq %r15,896(%rsi) leaq 128+24+48(%rsp),%rax movq -48(%rax),%r15 @@ -1225,8 +1292,8 @@ L$mul_by_one_body: movdqa %xmm0,64(%rsp) movdqa %xmm0,80(%rsp) movdqa %xmm0,96(%rsp) - andl $524544,%eax - cmpl $524544,%eax + andl $0x80100,%eax + cmpl $0x80100,%eax je L$by_one_callx call __rsaz_512_reduce jmp L$by_one_tail @@ -1717,16 +1784,14 @@ L$oop_mulx: .p2align 4 _rsaz_512_scatter4: - leaq (%rdi,%rdx,4),%rdi + leaq (%rdi,%rdx,8),%rdi movl $8,%r9d jmp L$oop_scatter .p2align 4 L$oop_scatter: movq (%rsi),%rax leaq 8(%rsi),%rsi - movl %eax,(%rdi) - shrq $32,%rax - movl %eax,64(%rdi) + movq %rax,(%rdi) leaq 128(%rdi),%rdi decl %r9d jnz L$oop_scatter @@ -1737,18 +1802,72 @@ L$oop_scatter: .p2align 4 _rsaz_512_gather4: - leaq (%rsi,%rdx,4),%rsi + movd %edx,%xmm8 + movdqa L$inc+16(%rip),%xmm1 + movdqa L$inc(%rip),%xmm0 + + pshufd $0,%xmm8,%xmm8 + movdqa %xmm1,%xmm7 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm8,%xmm0 + movdqa %xmm7,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm8,%xmm1 + movdqa %xmm7,%xmm4 + paddd %xmm2,%xmm3 + pcmpeqd %xmm8,%xmm2 + movdqa %xmm7,%xmm5 + paddd %xmm3,%xmm4 + pcmpeqd %xmm8,%xmm3 + movdqa %xmm7,%xmm6 + paddd %xmm4,%xmm5 + pcmpeqd %xmm8,%xmm4 + paddd %xmm5,%xmm6 + pcmpeqd %xmm8,%xmm5 + paddd %xmm6,%xmm7 + pcmpeqd %xmm8,%xmm6 + pcmpeqd %xmm8,%xmm7 movl $8,%r9d jmp L$oop_gather .p2align 4 L$oop_gather: - movl (%rsi),%eax - movl 64(%rsi),%r8d + movdqa 0(%rsi),%xmm8 + movdqa 16(%rsi),%xmm9 + movdqa 32(%rsi),%xmm10 + movdqa 48(%rsi),%xmm11 + pand %xmm0,%xmm8 + movdqa 64(%rsi),%xmm12 + pand %xmm1,%xmm9 + movdqa 80(%rsi),%xmm13 + pand %xmm2,%xmm10 + movdqa 96(%rsi),%xmm14 + pand %xmm3,%xmm11 + movdqa 112(%rsi),%xmm15 leaq 128(%rsi),%rsi - shlq $32,%r8 - orq %r8,%rax - movq %rax,(%rdi) + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd $0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 + movq %xmm8,(%rdi) leaq 8(%rdi),%rdi decl %r9d jnz L$oop_gather .byte 0xf3,0xc3 +L$SEH_end_rsaz_512_gather4: + + +.p2align 6 +L$inc: +.long 0,0, 1,1 +.long 2,2, 2,2 diff --git a/vendor/openssl/asm/x64-macosx-gas/bn/x86_64-gf2m.s b/vendor/openssl/asm/x64-macosx-gas/bn/x86_64-gf2m.s index 040c324c4..c0f0b4bd6 100644 --- a/vendor/openssl/asm/x64-macosx-gas/bn/x86_64-gf2m.s +++ b/vendor/openssl/asm/x64-macosx-gas/bn/x86_64-gf2m.s @@ -242,7 +242,7 @@ L$body_mul_2x2: movq %rcx,56(%rsp) movq %r8,64(%rsp) - movq $15,%r8 + movq $0xf,%r8 movq %rsi,%rax movq %rcx,%rbp call _mul_1x1 diff --git a/vendor/openssl/asm/x64-macosx-gas/bn/x86_64-mont.s b/vendor/openssl/asm/x64-macosx-gas/bn/x86_64-mont.s index 03b9c7d94..bca9fbda7 100644 --- a/vendor/openssl/asm/x64-macosx-gas/bn/x86_64-mont.s +++ b/vendor/openssl/asm/x64-macosx-gas/bn/x86_64-mont.s @@ -35,6 +35,20 @@ L$mul_enter: movq %r11,8(%rsp,%r9,8) L$mul_body: + + + + + + + subq %rsp,%r11 + andq $-4096,%r11 +L$mul_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x66,0x2e + jnc L$mul_page_walk + movq %rdx,%r12 movq (%r8),%r8 movq (%r12),%rbx @@ -216,8 +230,8 @@ L$mul_epilogue: .p2align 4 bn_mul4x_mont: L$mul4x_enter: - andl $524544,%r11d - cmpl $524544,%r11d + andl $0x80100,%r11d + cmpl $0x80100,%r11d je L$mulx4x_enter pushq %rbx pushq %rbp @@ -235,6 +249,14 @@ L$mul4x_enter: movq %r11,8(%rsp,%r9,8) L$mul4x_body: + subq %rsp,%r11 + andq $-4096,%r11 +L$mul4x_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc L$mul4x_page_walk + movq %rdi,16(%rsp,%r9,8) movq %rdx,%r12 movq (%r8),%r8 @@ -638,96 +660,131 @@ L$sqr8x_enter: - leaq -64(%rsp,%r9,4),%r11 + leaq -64(%rsp,%r9,2),%r11 movq (%r8),%r8 subq %rsi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb L$sqr8x_sp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,4),%rsp + leaq -64(%rsp,%r9,2),%rsp jmp L$sqr8x_sp_done .p2align 5 L$sqr8x_sp_alt: - leaq 4096-64(,%r9,4),%r10 - leaq -64(%rsp,%r9,4),%rsp + leaq 4096-64(,%r9,2),%r10 + leaq -64(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp L$sqr8x_sp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +L$sqr8x_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc L$sqr8x_page_walk + movq %r9,%r10 negq %r9 - leaq 64(%rsp,%r9,2),%r11 movq %r8,32(%rsp) movq %rax,40(%rsp) L$sqr8x_body: - movq %r9,%rbp -.byte 102,73,15,110,211 - shrq $3+2,%rbp - movl _OPENSSL_ia32cap_P+8(%rip),%eax - jmp L$sqr8x_copy_n - -.p2align 5 -L$sqr8x_copy_n: - movq 0(%rcx),%xmm0 - movq 8(%rcx),%xmm1 - movq 16(%rcx),%xmm3 - movq 24(%rcx),%xmm4 - leaq 32(%rcx),%rcx - movdqa %xmm0,0(%r11) - movdqa %xmm1,16(%r11) - movdqa %xmm3,32(%r11) - movdqa %xmm4,48(%r11) - leaq 64(%r11),%r11 - decq %rbp - jnz L$sqr8x_copy_n - +.byte 102,72,15,110,209 pxor %xmm0,%xmm0 .byte 102,72,15,110,207 .byte 102,73,15,110,218 - andl $524544,%eax - cmpl $524544,%eax + movl _OPENSSL_ia32cap_P+8(%rip),%eax + andl $0x80100,%eax + cmpl $0x80100,%eax jne L$sqr8x_nox call _bn_sqrx8x_internal - pxor %xmm0,%xmm0 - leaq 48(%rsp),%rax - leaq 64(%rsp,%r9,2),%rdx - shrq $3+2,%r9 - movq 40(%rsp),%rsi - jmp L$sqr8x_zero + + + + leaq (%r8,%rcx,1),%rbx + movq %rcx,%r9 + movq %rcx,%rdx +.byte 102,72,15,126,207 + sarq $3+2,%rcx + jmp L$sqr8x_sub .p2align 5 L$sqr8x_nox: call _bn_sqr8x_internal + + + + leaq (%rdi,%r9,1),%rbx + movq %r9,%rcx + movq %r9,%rdx +.byte 102,72,15,126,207 + sarq $3+2,%rcx + jmp L$sqr8x_sub + +.p2align 5 +L$sqr8x_sub: + movq 0(%rbx),%r12 + movq 8(%rbx),%r13 + movq 16(%rbx),%r14 + movq 24(%rbx),%r15 + leaq 32(%rbx),%rbx + sbbq 0(%rbp),%r12 + sbbq 8(%rbp),%r13 + sbbq 16(%rbp),%r14 + sbbq 24(%rbp),%r15 + leaq 32(%rbp),%rbp + movq %r12,0(%rdi) + movq %r13,8(%rdi) + movq %r14,16(%rdi) + movq %r15,24(%rdi) + leaq 32(%rdi),%rdi + incq %rcx + jnz L$sqr8x_sub + + sbbq $0,%rax + leaq (%rbx,%r9,1),%rbx + leaq (%rdi,%r9,1),%rdi + +.byte 102,72,15,110,200 pxor %xmm0,%xmm0 - leaq 48(%rsp),%rax - leaq 64(%rsp,%r9,2),%rdx - shrq $3+2,%r9 + pshufd $0,%xmm1,%xmm1 movq 40(%rsp),%rsi - jmp L$sqr8x_zero + jmp L$sqr8x_cond_copy .p2align 5 -L$sqr8x_zero: - movdqa %xmm0,0(%rax) - movdqa %xmm0,16(%rax) - movdqa %xmm0,32(%rax) - movdqa %xmm0,48(%rax) - leaq 64(%rax),%rax - movdqa %xmm0,0(%rdx) - movdqa %xmm0,16(%rdx) - movdqa %xmm0,32(%rdx) - movdqa %xmm0,48(%rdx) - leaq 64(%rdx),%rdx - decq %r9 - jnz L$sqr8x_zero +L$sqr8x_cond_copy: + movdqa 0(%rbx),%xmm2 + movdqa 16(%rbx),%xmm3 + leaq 32(%rbx),%rbx + movdqu 0(%rdi),%xmm4 + movdqu 16(%rdi),%xmm5 + leaq 32(%rdi),%rdi + movdqa %xmm0,-32(%rbx) + movdqa %xmm0,-16(%rbx) + movdqa %xmm0,-32(%rbx,%rdx,1) + movdqa %xmm0,-16(%rbx,%rdx,1) + pcmpeqd %xmm1,%xmm0 + pand %xmm1,%xmm2 + pand %xmm1,%xmm3 + pand %xmm0,%xmm4 + pand %xmm0,%xmm5 + pxor %xmm0,%xmm0 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqu %xmm4,-32(%rdi) + movdqu %xmm5,-16(%rdi) + addq $32,%r9 + jnz L$sqr8x_cond_copy movq $1,%rax movq -48(%rsi),%r15 @@ -758,8 +815,17 @@ L$mulx4x_enter: subq %r9,%r10 movq (%r8),%r8 leaq -72(%rsp,%r10,1),%rsp - leaq (%rdx,%r9,1),%r10 andq $-128,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +L$mulx4x_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x66,0x2e + jnc L$mulx4x_page_walk + + leaq (%rdx,%r9,1),%r10 @@ -982,64 +1048,75 @@ L$mulx4x_inner: adcq %rbp,%r15 subq 0(%rbx),%rbp adcq %r15,%r14 - movq -8(%rcx),%r8 sbbq %r15,%r15 movq %r14,-8(%rbx) cmpq 16(%rsp),%rdi jne L$mulx4x_outer - subq %r14,%r8 - sbbq %r8,%r8 - orq %r8,%r15 - - negq %rax - xorq %rdx,%rdx + leaq 64(%rsp),%rbx + subq %rax,%rcx + negq %r15 + movq %rax,%rdx + shrq $3+2,%rax movq 32(%rsp),%rdi + jmp L$mulx4x_sub + +.p2align 5 +L$mulx4x_sub: + movq 0(%rbx),%r11 + movq 8(%rbx),%r12 + movq 16(%rbx),%r13 + movq 24(%rbx),%r14 + leaq 32(%rbx),%rbx + sbbq 0(%rcx),%r11 + sbbq 8(%rcx),%r12 + sbbq 16(%rcx),%r13 + sbbq 24(%rcx),%r14 + leaq 32(%rcx),%rcx + movq %r11,0(%rdi) + movq %r12,8(%rdi) + movq %r13,16(%rdi) + movq %r14,24(%rdi) + leaq 32(%rdi),%rdi + decq %rax + jnz L$mulx4x_sub + + sbbq $0,%r15 leaq 64(%rsp),%rbx + subq %rdx,%rdi +.byte 102,73,15,110,207 pxor %xmm0,%xmm0 - movq 0(%rcx,%rax,1),%r8 - movq 8(%rcx,%rax,1),%r9 - negq %r8 - jmp L$mulx4x_sub_entry + pshufd $0,%xmm1,%xmm1 + movq 40(%rsp),%rsi + jmp L$mulx4x_cond_copy .p2align 5 -L$mulx4x_sub: - movq 0(%rcx,%rax,1),%r8 - movq 8(%rcx,%rax,1),%r9 - notq %r8 -L$mulx4x_sub_entry: - movq 16(%rcx,%rax,1),%r10 - notq %r9 - andq %r15,%r8 - movq 24(%rcx,%rax,1),%r11 - notq %r10 - andq %r15,%r9 - notq %r11 - andq %r15,%r10 - andq %r15,%r11 - - negq %rdx - adcq 0(%rbx),%r8 - adcq 8(%rbx),%r9 - movdqa %xmm0,(%rbx) - adcq 16(%rbx),%r10 - adcq 24(%rbx),%r11 - movdqa %xmm0,16(%rbx) +L$mulx4x_cond_copy: + movdqa 0(%rbx),%xmm2 + movdqa 16(%rbx),%xmm3 leaq 32(%rbx),%rbx - sbbq %rdx,%rdx - - movq %r8,0(%rdi) - movq %r9,8(%rdi) - movq %r10,16(%rdi) - movq %r11,24(%rdi) + movdqu 0(%rdi),%xmm4 + movdqu 16(%rdi),%xmm5 leaq 32(%rdi),%rdi + movdqa %xmm0,-32(%rbx) + movdqa %xmm0,-16(%rbx) + pcmpeqd %xmm1,%xmm0 + pand %xmm1,%xmm2 + pand %xmm1,%xmm3 + pand %xmm0,%xmm4 + pand %xmm0,%xmm5 + pxor %xmm0,%xmm0 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqu %xmm4,-32(%rdi) + movdqu %xmm5,-16(%rdi) + subq $32,%rdx + jnz L$mulx4x_cond_copy - addq $32,%rax - jnz L$mulx4x_sub + movq %rdx,(%rbx) - movq 40(%rsp),%rsi movq $1,%rax movq -48(%rsi),%r15 movq -40(%rsi),%r14 diff --git a/vendor/openssl/asm/x64-macosx-gas/bn/x86_64-mont5.s b/vendor/openssl/asm/x64-macosx-gas/bn/x86_64-mont5.s index 99a16f850..5d987a122 100644 --- a/vendor/openssl/asm/x64-macosx-gas/bn/x86_64-mont5.s +++ b/vendor/openssl/asm/x64-macosx-gas/bn/x86_64-mont5.s @@ -15,46 +15,165 @@ _bn_mul_mont_gather5: L$mul_enter: movl %r9d,%r9d movq %rsp,%rax - movl 8(%rsp),%r10d + movd 8(%rsp),%xmm5 + leaq L$inc(%rip),%r10 pushq %rbx pushq %rbp pushq %r12 pushq %r13 pushq %r14 pushq %r15 + leaq 2(%r9),%r11 negq %r11 - leaq (%rsp,%r11,8),%rsp + leaq -264(%rsp,%r11,8),%rsp andq $-1024,%rsp movq %rax,8(%rsp,%r9,8) L$mul_body: - movq %rdx,%r12 - movq %r10,%r11 - shrq $3,%r10 - andq $7,%r11 - notq %r10 - leaq L$magic_masks(%rip),%rax - andq $3,%r10 - leaq 96(%r12,%r11,8),%r12 - movq 0(%rax,%r10,8),%xmm4 - movq 8(%rax,%r10,8),%xmm5 - movq 16(%rax,%r10,8),%xmm6 - movq 24(%rax,%r10,8),%xmm7 - - movq -96(%r12),%xmm0 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - movq 96(%r12),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 + + + + + + + subq %rsp,%rax + andq $-4096,%rax +L$mul_page_walk: + movq (%rsp,%rax,1),%r11 + subq $4096,%rax +.byte 0x2e + jnc L$mul_page_walk + + leaq 128(%rdx),%r12 + movdqa 0(%r10),%xmm0 + movdqa 16(%r10),%xmm1 + leaq 24-112(%rsp,%r9,8),%r10 + andq $-16,%r10 + + pshufd $0,%xmm5,%xmm5 + movdqa %xmm1,%xmm4 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 +.byte 0x67 + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,112(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,128(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,144(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,160(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,176(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,192(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,208(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,224(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,240(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,256(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,272(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,288(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,304(%r10) + + paddd %xmm2,%xmm3 +.byte 0x67 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,320(%r10) + + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,336(%r10) + pand 64(%r12),%xmm0 + + pand 80(%r12),%xmm1 + pand 96(%r12),%xmm2 + movdqa %xmm3,352(%r10) + pand 112(%r12),%xmm3 por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -128(%r12),%xmm4 + movdqa -112(%r12),%xmm5 + movdqa -96(%r12),%xmm2 + pand 112(%r10),%xmm4 + movdqa -80(%r12),%xmm3 + pand 128(%r10),%xmm5 + por %xmm4,%xmm0 + pand 144(%r10),%xmm2 + por %xmm5,%xmm1 + pand 160(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -64(%r12),%xmm4 + movdqa -48(%r12),%xmm5 + movdqa -32(%r12),%xmm2 + pand 176(%r10),%xmm4 + movdqa -16(%r12),%xmm3 + pand 192(%r10),%xmm5 + por %xmm4,%xmm0 + pand 208(%r10),%xmm2 + por %xmm5,%xmm1 + pand 224(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa 0(%r12),%xmm4 + movdqa 16(%r12),%xmm5 + movdqa 32(%r12),%xmm2 + pand 240(%r10),%xmm4 + movdqa 48(%r12),%xmm3 + pand 256(%r10),%xmm5 + por %xmm4,%xmm0 + pand 272(%r10),%xmm2 + por %xmm5,%xmm1 + pand 288(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + por %xmm1,%xmm0 + pshufd $0x4e,%xmm0,%xmm1 + por %xmm1,%xmm0 leaq 256(%r12),%r12 - por %xmm3,%xmm0 - .byte 102,72,15,126,195 movq (%r8),%r8 @@ -63,29 +182,14 @@ L$mul_body: xorq %r14,%r14 xorq %r15,%r15 - movq -96(%r12),%xmm0 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - movq %r8,%rbp mulq %rbx movq %rax,%r10 movq (%rcx),%rax - movq 96(%r12),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 - imulq %r10,%rbp movq %rdx,%r11 - por %xmm2,%xmm0 - leaq 256(%r12),%r12 - por %xmm3,%xmm0 - mulq %rbp addq %rax,%r10 movq 8(%rsi),%rax @@ -118,14 +222,12 @@ L$1st_enter: cmpq %r9,%r15 jne L$1st -.byte 102,72,15,126,195 addq %rax,%r13 - movq (%rsi),%rax adcq $0,%rdx addq %r11,%r13 adcq $0,%rdx - movq %r13,-16(%rsp,%r15,8) + movq %r13,-16(%rsp,%r9,8) movq %rdx,%r13 movq %r10,%r11 @@ -139,33 +241,78 @@ L$1st_enter: jmp L$outer .p2align 4 L$outer: + leaq 24+128(%rsp,%r9,8),%rdx + andq $-16,%rdx + pxor %xmm4,%xmm4 + pxor %xmm5,%xmm5 + movdqa -128(%r12),%xmm0 + movdqa -112(%r12),%xmm1 + movdqa -96(%r12),%xmm2 + movdqa -80(%r12),%xmm3 + pand -128(%rdx),%xmm0 + pand -112(%rdx),%xmm1 + por %xmm0,%xmm4 + pand -96(%rdx),%xmm2 + por %xmm1,%xmm5 + pand -80(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa -64(%r12),%xmm0 + movdqa -48(%r12),%xmm1 + movdqa -32(%r12),%xmm2 + movdqa -16(%r12),%xmm3 + pand -64(%rdx),%xmm0 + pand -48(%rdx),%xmm1 + por %xmm0,%xmm4 + pand -32(%rdx),%xmm2 + por %xmm1,%xmm5 + pand -16(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 0(%r12),%xmm0 + movdqa 16(%r12),%xmm1 + movdqa 32(%r12),%xmm2 + movdqa 48(%r12),%xmm3 + pand 0(%rdx),%xmm0 + pand 16(%rdx),%xmm1 + por %xmm0,%xmm4 + pand 32(%rdx),%xmm2 + por %xmm1,%xmm5 + pand 48(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 64(%r12),%xmm0 + movdqa 80(%r12),%xmm1 + movdqa 96(%r12),%xmm2 + movdqa 112(%r12),%xmm3 + pand 64(%rdx),%xmm0 + pand 80(%rdx),%xmm1 + por %xmm0,%xmm4 + pand 96(%rdx),%xmm2 + por %xmm1,%xmm5 + pand 112(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + por %xmm5,%xmm4 + pshufd $0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 + leaq 256(%r12),%r12 + + movq (%rsi),%rax +.byte 102,72,15,126,195 + xorq %r15,%r15 movq %r8,%rbp movq (%rsp),%r10 - movq -96(%r12),%xmm0 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - mulq %rbx addq %rax,%r10 movq (%rcx),%rax adcq $0,%rdx - movq 96(%r12),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 - imulq %r10,%rbp movq %rdx,%r11 - por %xmm2,%xmm0 - leaq 256(%r12),%r12 - por %xmm3,%xmm0 - mulq %rbp addq %rax,%r10 movq 8(%rsi),%rax @@ -201,15 +348,12 @@ L$inner_enter: cmpq %r9,%r15 jne L$inner -.byte 102,72,15,126,195 - addq %rax,%r13 - movq (%rsi),%rax adcq $0,%rdx addq %r10,%r13 - movq (%rsp,%r15,8),%r10 + movq (%rsp,%r9,8),%r10 adcq $0,%rdx - movq %r13,-16(%rsp,%r15,8) + movq %r13,-16(%rsp,%r9,8) movq %rdx,%r13 xorq %rdx,%rdx @@ -256,6 +400,7 @@ L$copy: movq 8(%rsp,%r9,8),%rsi movq $1,%rax + movq -48(%rsi),%r15 movq -40(%rsi),%r14 movq -32(%rsi),%r13 @@ -270,8 +415,8 @@ L$mul_epilogue: .p2align 5 bn_mul4x_mont_gather5: L$mul4x_enter: - andl $524544,%r11d - cmpl $524544,%r11d + andl $0x80108,%r11d + cmpl $0x80108,%r11d je L$mulx4x_enter .byte 0x67 movq %rsp,%rax @@ -281,10 +426,10 @@ L$mul4x_enter: pushq %r13 pushq %r14 pushq %r15 + .byte 0x67 - movl %r9d,%r10d shll $3,%r9d - shll $3+2,%r10d + leaq (%r9,%r9,2),%r10 negq %r9 @@ -294,25 +439,36 @@ L$mul4x_enter: - leaq -64(%rsp,%r9,2),%r11 - subq %rsi,%r11 + + + leaq -320(%rsp,%r9,2),%r11 + subq %rdi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb L$mul4xsp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,2),%rsp + leaq -320(%rsp,%r9,2),%rsp jmp L$mul4xsp_done .p2align 5 L$mul4xsp_alt: - leaq 4096-64(,%r9,2),%r10 - leaq -64(%rsp,%r9,2),%rsp + leaq 4096-320(,%r9,2),%r10 + leaq -320(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp L$mul4xsp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +L$mul4x_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc L$mul4x_page_walk + negq %r9 movq %rax,40(%rsp) @@ -322,6 +478,7 @@ L$mul4x_body: movq 40(%rsp),%rsi movq $1,%rax + movq -48(%rsi),%r15 movq -40(%rsi),%r14 movq -32(%rsi),%r13 @@ -337,47 +494,141 @@ L$mul4x_epilogue: .p2align 5 mul4x_internal: shlq $5,%r9 - movl 8(%rax),%r10d - leaq 256(%rdx,%r9,1),%r13 + movd 8(%rax),%xmm5 + leaq L$inc(%rip),%rax + leaq 128(%rdx,%r9,1),%r13 shrq $5,%r9 - movq %r10,%r11 - shrq $3,%r10 - andq $7,%r11 - notq %r10 - leaq L$magic_masks(%rip),%rax - andq $3,%r10 - leaq 96(%rdx,%r11,8),%r12 - movq 0(%rax,%r10,8),%xmm4 - movq 8(%rax,%r10,8),%xmm5 - addq $7,%r11 - movq 16(%rax,%r10,8),%xmm6 - movq 24(%rax,%r10,8),%xmm7 - andq $7,%r11 - - movq -96(%r12),%xmm0 - leaq 256(%r12),%r14 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - movq 96(%r12),%xmm3 - pand %xmm6,%xmm2 -.byte 0x67 - por %xmm1,%xmm0 - movq -96(%r14),%xmm1 -.byte 0x67 - pand %xmm7,%xmm3 -.byte 0x67 - por %xmm2,%xmm0 - movq -32(%r14),%xmm2 + movdqa 0(%rax),%xmm0 + movdqa 16(%rax),%xmm1 + leaq 88-112(%rsp,%r9,1),%r10 + leaq 128(%rdx),%r12 + + pshufd $0,%xmm5,%xmm5 + movdqa %xmm1,%xmm4 +.byte 0x67,0x67 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 .byte 0x67 - pand %xmm4,%xmm1 + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,112(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,128(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,144(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,160(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,176(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,192(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,208(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,224(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,240(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,256(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,272(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,288(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,304(%r10) + + paddd %xmm2,%xmm3 .byte 0x67 - por %xmm3,%xmm0 - movq 32(%r14),%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,320(%r10) + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,336(%r10) + pand 64(%r12),%xmm0 + + pand 80(%r12),%xmm1 + pand 96(%r12),%xmm2 + movdqa %xmm3,352(%r10) + pand 112(%r12),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -128(%r12),%xmm4 + movdqa -112(%r12),%xmm5 + movdqa -96(%r12),%xmm2 + pand 112(%r10),%xmm4 + movdqa -80(%r12),%xmm3 + pand 128(%r10),%xmm5 + por %xmm4,%xmm0 + pand 144(%r10),%xmm2 + por %xmm5,%xmm1 + pand 160(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -64(%r12),%xmm4 + movdqa -48(%r12),%xmm5 + movdqa -32(%r12),%xmm2 + pand 176(%r10),%xmm4 + movdqa -16(%r12),%xmm3 + pand 192(%r10),%xmm5 + por %xmm4,%xmm0 + pand 208(%r10),%xmm2 + por %xmm5,%xmm1 + pand 224(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa 0(%r12),%xmm4 + movdqa 16(%r12),%xmm5 + movdqa 32(%r12),%xmm2 + pand 240(%r10),%xmm4 + movdqa 48(%r12),%xmm3 + pand 256(%r10),%xmm5 + por %xmm4,%xmm0 + pand 272(%r10),%xmm2 + por %xmm5,%xmm1 + pand 288(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + por %xmm1,%xmm0 + pshufd $0x4e,%xmm0,%xmm1 + por %xmm1,%xmm0 + leaq 256(%r12),%r12 .byte 102,72,15,126,195 - movq 96(%r14),%xmm0 + movq %r13,16+8(%rsp) movq %rdi,56+8(%rsp) @@ -391,26 +642,10 @@ mul4x_internal: movq %rax,%r10 movq (%rcx),%rax - pand %xmm5,%xmm2 - pand %xmm6,%xmm3 - por %xmm2,%xmm1 - imulq %r10,%rbp - - - - - - - - leaq 64+8(%rsp,%r11,8),%r14 + leaq 64+8(%rsp),%r14 movq %rdx,%r11 - pand %xmm7,%xmm0 - por %xmm3,%xmm1 - leaq 512(%r12),%r12 - por %xmm1,%xmm0 - mulq %rbp addq %rax,%r10 movq 8(%rsi,%r9,1),%rax @@ -419,7 +654,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 - movq 16(%rcx),%rax + movq 8(%rcx),%rax adcq $0,%rdx movq %rdx,%r10 @@ -429,7 +664,7 @@ mul4x_internal: adcq $0,%rdx addq %r11,%rdi leaq 32(%r9),%r15 - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx adcq $0,%rdx movq %rdi,(%r14) movq %rdx,%r13 @@ -439,7 +674,7 @@ mul4x_internal: L$1st4x: mulq %rbx addq %rax,%r10 - movq -32(%rcx),%rax + movq -16(%rcx),%rax leaq 32(%r14),%r14 adcq $0,%rdx movq %rdx,%r11 @@ -455,7 +690,7 @@ L$1st4x: mulq %rbx addq %rax,%r11 - movq -16(%rcx),%rax + movq -8(%rcx),%rax adcq $0,%rdx movq %rdx,%r10 @@ -485,7 +720,7 @@ L$1st4x: mulq %rbx addq %rax,%r11 - movq 16(%rcx),%rax + movq 8(%rcx),%rax adcq $0,%rdx movq %rdx,%r10 @@ -494,7 +729,7 @@ L$1st4x: movq 16(%rsi,%r15,1),%rax adcq $0,%rdx addq %r11,%rdi - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx adcq $0,%rdx movq %rdi,(%r14) movq %rdx,%r13 @@ -504,7 +739,7 @@ L$1st4x: mulq %rbx addq %rax,%r10 - movq -32(%rcx),%rax + movq -16(%rcx),%rax leaq 32(%r14),%r14 adcq $0,%rdx movq %rdx,%r11 @@ -520,7 +755,7 @@ L$1st4x: mulq %rbx addq %rax,%r11 - movq -16(%rcx),%rax + movq -8(%rcx),%rax adcq $0,%rdx movq %rdx,%r10 @@ -533,8 +768,7 @@ L$1st4x: movq %rdi,-16(%r14) movq %rdx,%r13 -.byte 102,72,15,126,195 - leaq (%rcx,%r9,2),%rcx + leaq (%rcx,%r9,1),%rcx xorq %rdi,%rdi addq %r10,%r13 @@ -545,6 +779,63 @@ L$1st4x: .p2align 5 L$outer4x: + leaq 16+128(%r14),%rdx + pxor %xmm4,%xmm4 + pxor %xmm5,%xmm5 + movdqa -128(%r12),%xmm0 + movdqa -112(%r12),%xmm1 + movdqa -96(%r12),%xmm2 + movdqa -80(%r12),%xmm3 + pand -128(%rdx),%xmm0 + pand -112(%rdx),%xmm1 + por %xmm0,%xmm4 + pand -96(%rdx),%xmm2 + por %xmm1,%xmm5 + pand -80(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa -64(%r12),%xmm0 + movdqa -48(%r12),%xmm1 + movdqa -32(%r12),%xmm2 + movdqa -16(%r12),%xmm3 + pand -64(%rdx),%xmm0 + pand -48(%rdx),%xmm1 + por %xmm0,%xmm4 + pand -32(%rdx),%xmm2 + por %xmm1,%xmm5 + pand -16(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 0(%r12),%xmm0 + movdqa 16(%r12),%xmm1 + movdqa 32(%r12),%xmm2 + movdqa 48(%r12),%xmm3 + pand 0(%rdx),%xmm0 + pand 16(%rdx),%xmm1 + por %xmm0,%xmm4 + pand 32(%rdx),%xmm2 + por %xmm1,%xmm5 + pand 48(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 64(%r12),%xmm0 + movdqa 80(%r12),%xmm1 + movdqa 96(%r12),%xmm2 + movdqa 112(%r12),%xmm3 + pand 64(%rdx),%xmm0 + pand 80(%rdx),%xmm1 + por %xmm0,%xmm4 + pand 96(%rdx),%xmm2 + por %xmm1,%xmm5 + pand 112(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + por %xmm5,%xmm4 + pshufd $0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 + leaq 256(%r12),%r12 +.byte 102,72,15,126,195 + movq (%r14,%r9,1),%r10 movq %r8,%rbp mulq %rbx @@ -552,25 +843,11 @@ L$outer4x: movq (%rcx),%rax adcq $0,%rdx - movq -96(%r12),%xmm0 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - movq 96(%r12),%xmm3 - imulq %r10,%rbp -.byte 0x67 movq %rdx,%r11 movq %rdi,(%r14) - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 - por %xmm2,%xmm0 leaq (%r14,%r9,1),%r14 - leaq 256(%r12),%r12 - por %xmm3,%xmm0 mulq %rbp addq %rax,%r10 @@ -580,7 +857,7 @@ L$outer4x: mulq %rbx addq %rax,%r11 - movq 16(%rcx),%rax + movq 8(%rcx),%rax adcq $0,%rdx addq 8(%r14),%r11 adcq $0,%rdx @@ -592,7 +869,7 @@ L$outer4x: adcq $0,%rdx addq %r11,%rdi leaq 32(%r9),%r15 - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx adcq $0,%rdx movq %rdx,%r13 jmp L$inner4x @@ -601,7 +878,7 @@ L$outer4x: L$inner4x: mulq %rbx addq %rax,%r10 - movq -32(%rcx),%rax + movq -16(%rcx),%rax adcq $0,%rdx addq 16(%r14),%r10 leaq 32(%r14),%r14 @@ -619,7 +896,7 @@ L$inner4x: mulq %rbx addq %rax,%r11 - movq -16(%rcx),%rax + movq -8(%rcx),%rax adcq $0,%rdx addq -8(%r14),%r11 adcq $0,%rdx @@ -653,7 +930,7 @@ L$inner4x: mulq %rbx addq %rax,%r11 - movq 16(%rcx),%rax + movq 8(%rcx),%rax adcq $0,%rdx addq 8(%r14),%r11 adcq $0,%rdx @@ -664,7 +941,7 @@ L$inner4x: movq 16(%rsi,%r15,1),%rax adcq $0,%rdx addq %r11,%rdi - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx adcq $0,%rdx movq %r13,-8(%r14) movq %rdx,%r13 @@ -674,7 +951,7 @@ L$inner4x: mulq %rbx addq %rax,%r10 - movq -32(%rcx),%rax + movq -16(%rcx),%rax adcq $0,%rdx addq 16(%r14),%r10 leaq 32(%r14),%r14 @@ -693,7 +970,7 @@ L$inner4x: mulq %rbx addq %rax,%r11 movq %rbp,%rax - movq -16(%rcx),%rbp + movq -8(%rcx),%rbp adcq $0,%rdx addq -8(%r14),%r11 adcq $0,%rdx @@ -708,9 +985,8 @@ L$inner4x: movq %r13,-24(%r14) movq %rdx,%r13 -.byte 102,72,15,126,195 movq %rdi,-16(%r14) - leaq (%rcx,%r9,2),%rcx + leaq (%rcx,%r9,1),%rcx xorq %rdi,%rdi addq %r10,%r13 @@ -721,24 +997,31 @@ L$inner4x: cmpq 16+8(%rsp),%r12 jb L$outer4x + xorq %rax,%rax subq %r13,%rbp adcq %r15,%r15 orq %r15,%rdi - xorq $1,%rdi + subq %rdi,%rax leaq (%r14,%r9,1),%rbx - leaq (%rcx,%rdi,8),%rbp + movq (%rcx),%r12 + leaq (%rcx),%rbp movq %r9,%rcx sarq $3+2,%rcx movq 56+8(%rsp),%rdi - jmp L$sqr4x_sub + decq %r12 + xorq %r10,%r10 + movq 8(%rbp),%r13 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 + jmp L$sqr4x_sub_entry .globl _bn_power5 .p2align 5 _bn_power5: movl _OPENSSL_ia32cap_P+8(%rip),%r11d - andl $524544,%r11d - cmpl $524544,%r11d + andl $0x80108,%r11d + cmpl $0x80108,%r11d je L$powerx5_enter movq %rsp,%rax pushq %rbx @@ -747,9 +1030,9 @@ _bn_power5: pushq %r13 pushq %r14 pushq %r15 - movl %r9d,%r10d + shll $3,%r9d - shll $3+2,%r10d + leal (%r9,%r9,2),%r10d negq %r9 movq (%r8),%r8 @@ -759,25 +1042,35 @@ _bn_power5: - leaq -64(%rsp,%r9,2),%r11 - subq %rsi,%r11 + + leaq -320(%rsp,%r9,2),%r11 + subq %rdi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb L$pwr_sp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,2),%rsp + leaq -320(%rsp,%r9,2),%rsp jmp L$pwr_sp_done .p2align 5 L$pwr_sp_alt: - leaq 4096-64(,%r9,2),%r10 - leaq -64(%rsp,%r9,2),%rsp + leaq 4096-320(,%r9,2),%r10 + leaq -320(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp L$pwr_sp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +L$pwr_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc L$pwr_page_walk + movq %r9,%r10 negq %r9 @@ -799,10 +1092,15 @@ L$power5_body: .byte 102,72,15,110,226 call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal .byte 102,72,15,126,209 .byte 102,72,15,126,226 @@ -1346,9 +1644,9 @@ L$sqr4x_shift_n_add: movq %rbx,-16(%rdi) movq %r8,-8(%rdi) .byte 102,72,15,126,213 -sqr8x_reduction: +__bn_sqr8x_reduction: xorq %rax,%rax - leaq (%rbp,%r9,2),%rcx + leaq (%r9,%rbp,1),%rcx leaq 48+8(%rsp,%r9,2),%rdx movq %rcx,0+8(%rsp) leaq 48+8(%rsp,%r9,1),%rdi @@ -1381,14 +1679,14 @@ L$8x_reduction_loop: .p2align 5 L$8x_reduce: mulq %rbx - movq 16(%rbp),%rax + movq 8(%rbp),%rax negq %r8 movq %rdx,%r8 adcq $0,%r8 mulq %rbx addq %rax,%r9 - movq 32(%rbp),%rax + movq 16(%rbp),%rax adcq $0,%rdx addq %r9,%r8 movq %rbx,48-8+8(%rsp,%rcx,8) @@ -1397,7 +1695,7 @@ L$8x_reduce: mulq %rbx addq %rax,%r10 - movq 48(%rbp),%rax + movq 24(%rbp),%rax adcq $0,%rdx addq %r10,%r9 movq 32+8(%rsp),%rsi @@ -1406,7 +1704,7 @@ L$8x_reduce: mulq %rbx addq %rax,%r11 - movq 64(%rbp),%rax + movq 32(%rbp),%rax adcq $0,%rdx imulq %r8,%rsi addq %r11,%r10 @@ -1415,7 +1713,7 @@ L$8x_reduce: mulq %rbx addq %rax,%r12 - movq 80(%rbp),%rax + movq 40(%rbp),%rax adcq $0,%rdx addq %r12,%r11 movq %rdx,%r12 @@ -1423,7 +1721,7 @@ L$8x_reduce: mulq %rbx addq %rax,%r13 - movq 96(%rbp),%rax + movq 48(%rbp),%rax adcq $0,%rdx addq %r13,%r12 movq %rdx,%r13 @@ -1431,7 +1729,7 @@ L$8x_reduce: mulq %rbx addq %rax,%r14 - movq 112(%rbp),%rax + movq 56(%rbp),%rax adcq $0,%rdx addq %r14,%r13 movq %rdx,%r14 @@ -1449,7 +1747,7 @@ L$8x_reduce: decl %ecx jnz L$8x_reduce - leaq 128(%rbp),%rbp + leaq 64(%rbp),%rbp xorq %rax,%rax movq 8+8(%rsp),%rdx cmpq 0+8(%rsp),%rbp @@ -1475,14 +1773,14 @@ L$8x_reduce: L$8x_tail: mulq %rbx addq %rax,%r8 - movq 16(%rbp),%rax + movq 8(%rbp),%rax movq %r8,(%rdi) movq %rdx,%r8 adcq $0,%r8 mulq %rbx addq %rax,%r9 - movq 32(%rbp),%rax + movq 16(%rbp),%rax adcq $0,%rdx addq %r9,%r8 leaq 8(%rdi),%rdi @@ -1491,7 +1789,7 @@ L$8x_tail: mulq %rbx addq %rax,%r10 - movq 48(%rbp),%rax + movq 24(%rbp),%rax adcq $0,%rdx addq %r10,%r9 movq %rdx,%r10 @@ -1499,7 +1797,7 @@ L$8x_tail: mulq %rbx addq %rax,%r11 - movq 64(%rbp),%rax + movq 32(%rbp),%rax adcq $0,%rdx addq %r11,%r10 movq %rdx,%r11 @@ -1507,7 +1805,7 @@ L$8x_tail: mulq %rbx addq %rax,%r12 - movq 80(%rbp),%rax + movq 40(%rbp),%rax adcq $0,%rdx addq %r12,%r11 movq %rdx,%r12 @@ -1515,7 +1813,7 @@ L$8x_tail: mulq %rbx addq %rax,%r13 - movq 96(%rbp),%rax + movq 48(%rbp),%rax adcq $0,%rdx addq %r13,%r12 movq %rdx,%r13 @@ -1523,7 +1821,7 @@ L$8x_tail: mulq %rbx addq %rax,%r14 - movq 112(%rbp),%rax + movq 56(%rbp),%rax adcq $0,%rdx addq %r14,%r13 movq %rdx,%r14 @@ -1541,7 +1839,7 @@ L$8x_tail: decl %ecx jnz L$8x_tail - leaq 128(%rbp),%rbp + leaq 64(%rbp),%rbp movq 8+8(%rsp),%rdx cmpq 0+8(%rsp),%rbp jae L$8x_tail_done @@ -1587,7 +1885,7 @@ L$8x_no_tail: adcq 48(%rdi),%r14 adcq 56(%rdi),%r15 adcq $0,%rax - movq -16(%rbp),%rcx + movq -8(%rbp),%rcx xorq %rsi,%rsi .byte 102,72,15,126,213 @@ -1605,40 +1903,58 @@ L$8x_no_tail: cmpq %rdx,%rdi jb L$8x_reduction_loop + .byte 0xf3,0xc3 - subq %r15,%rcx + +.p2align 5 +__bn_post4x_internal: + movq 0(%rbp),%r12 leaq (%rdi,%r9,1),%rbx - adcq %rsi,%rsi movq %r9,%rcx - orq %rsi,%rax .byte 102,72,15,126,207 - xorq $1,%rax + negq %rax .byte 102,72,15,126,206 - leaq (%rbp,%rax,8),%rbp sarq $3+2,%rcx - jmp L$sqr4x_sub + decq %r12 + xorq %r10,%r10 + movq 8(%rbp),%r13 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 + jmp L$sqr4x_sub_entry -.p2align 5 +.p2align 4 L$sqr4x_sub: -.byte 0x66 - movq 0(%rbx),%r12 - movq 8(%rbx),%r13 - sbbq 0(%rbp),%r12 - movq 16(%rbx),%r14 - sbbq 16(%rbp),%r13 - movq 24(%rbx),%r15 - leaq 32(%rbx),%rbx - sbbq 32(%rbp),%r14 + movq 0(%rbp),%r12 + movq 8(%rbp),%r13 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 +L$sqr4x_sub_entry: + leaq 32(%rbp),%rbp + notq %r12 + notq %r13 + notq %r14 + notq %r15 + andq %rax,%r12 + andq %rax,%r13 + andq %rax,%r14 + andq %rax,%r15 + + negq %r10 + adcq 0(%rbx),%r12 + adcq 8(%rbx),%r13 + adcq 16(%rbx),%r14 + adcq 24(%rbx),%r15 movq %r12,0(%rdi) - sbbq 48(%rbp),%r15 - leaq 64(%rbp),%rbp + leaq 32(%rbx),%rbx movq %r13,8(%rdi) + sbbq %r10,%r10 movq %r14,16(%rdi) movq %r15,24(%rdi) leaq 32(%rdi),%rdi incq %rcx jnz L$sqr4x_sub + movq %r9,%r10 negq %r9 .byte 0xf3,0xc3 @@ -1664,10 +1980,9 @@ bn_from_mont8x: pushq %r13 pushq %r14 pushq %r15 -.byte 0x67 - movl %r9d,%r10d + shll $3,%r9d - shll $3+2,%r10d + leaq (%r9,%r9,2),%r10 negq %r9 movq (%r8),%r8 @@ -1677,25 +1992,35 @@ bn_from_mont8x: - leaq -64(%rsp,%r9,2),%r11 - subq %rsi,%r11 + + leaq -320(%rsp,%r9,2),%r11 + subq %rdi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb L$from_sp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,2),%rsp + leaq -320(%rsp,%r9,2),%rsp jmp L$from_sp_done .p2align 5 L$from_sp_alt: - leaq 4096-64(,%r9,2),%r10 - leaq -64(%rsp,%r9,2),%rsp + leaq 4096-320(,%r9,2),%r10 + leaq -320(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp L$from_sp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +L$from_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc L$from_page_walk + movq %r9,%r10 negq %r9 @@ -1741,12 +2066,13 @@ L$mul_by_1: movq %rcx,%rbp .byte 102,73,15,110,218 movl _OPENSSL_ia32cap_P+8(%rip),%r11d - andl $524544,%r11d - cmpl $524544,%r11d + andl $0x80108,%r11d + cmpl $0x80108,%r11d jne L$from_mont_nox leaq (%rax,%r9,1),%rdi - call sqrx8x_reduction + call __bn_sqrx8x_reduction + call __bn_postx4x_internal pxor %xmm0,%xmm0 leaq 48(%rsp),%rax @@ -1755,7 +2081,8 @@ L$mul_by_1: .p2align 5 L$from_mont_nox: - call sqr8x_reduction + call __bn_sqr8x_reduction + call __bn_post4x_internal pxor %xmm0,%xmm0 leaq 48(%rsp),%rax @@ -1787,7 +2114,6 @@ L$from_epilogue: .p2align 5 bn_mulx4x_mont_gather5: L$mulx4x_enter: -.byte 0x67 movq %rsp,%rax pushq %rbx pushq %rbp @@ -1795,10 +2121,9 @@ L$mulx4x_enter: pushq %r13 pushq %r14 pushq %r15 -.byte 0x67 - movl %r9d,%r10d + shll $3,%r9d - shll $3+2,%r10d + leaq (%r9,%r9,2),%r10 negq %r9 movq (%r8),%r8 @@ -1809,25 +2134,35 @@ L$mulx4x_enter: - leaq -64(%rsp,%r9,2),%r11 - subq %rsi,%r11 + + + leaq -320(%rsp,%r9,2),%r11 + subq %rdi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb L$mulx4xsp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,2),%rsp + leaq -320(%rsp,%r9,2),%rsp jmp L$mulx4xsp_done -.p2align 5 L$mulx4xsp_alt: - leaq 4096-64(,%r9,2),%r10 - leaq -64(%rsp,%r9,2),%rsp + leaq 4096-320(,%r9,2),%r10 + leaq -320(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp L$mulx4xsp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +L$mulx4x_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc L$mulx4x_page_walk + @@ -1847,6 +2182,7 @@ L$mulx4x_body: movq 40(%rsp),%rsi movq $1,%rax + movq -48(%rsi),%r15 movq -40(%rsi),%r14 movq -32(%rsi),%r13 @@ -1861,63 +2197,150 @@ L$mulx4x_epilogue: .p2align 5 mulx4x_internal: -.byte 0x4c,0x89,0x8c,0x24,0x08,0x00,0x00,0x00 -.byte 0x67 + movq %r9,8(%rsp) + movq %r9,%r10 negq %r9 shlq $5,%r9 - leaq 256(%rdx,%r9,1),%r13 + negq %r10 + leaq 128(%rdx,%r9,1),%r13 shrq $5+5,%r9 - movl 8(%rax),%r10d + movd 8(%rax),%xmm5 subq $1,%r9 + leaq L$inc(%rip),%rax movq %r13,16+8(%rsp) movq %r9,24+8(%rsp) movq %rdi,56+8(%rsp) - movq %r10,%r11 - shrq $3,%r10 - andq $7,%r11 - notq %r10 - leaq L$magic_masks(%rip),%rax - andq $3,%r10 - leaq 96(%rdx,%r11,8),%rdi - movq 0(%rax,%r10,8),%xmm4 - movq 8(%rax,%r10,8),%xmm5 - addq $7,%r11 - movq 16(%rax,%r10,8),%xmm6 - movq 24(%rax,%r10,8),%xmm7 - andq $7,%r11 - - movq -96(%rdi),%xmm0 - leaq 256(%rdi),%rbx - movq -32(%rdi),%xmm1 - pand %xmm4,%xmm0 - movq 32(%rdi),%xmm2 - pand %xmm5,%xmm1 - movq 96(%rdi),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - movq -96(%rbx),%xmm1 - pand %xmm7,%xmm3 - por %xmm2,%xmm0 - movq -32(%rbx),%xmm2 - por %xmm3,%xmm0 -.byte 0x67,0x67 - pand %xmm4,%xmm1 - movq 32(%rbx),%xmm3 + movdqa 0(%rax),%xmm0 + movdqa 16(%rax),%xmm1 + leaq 88-112(%rsp,%r10,1),%r10 + leaq 128(%rdx),%rdi + pshufd $0,%xmm5,%xmm5 + movdqa %xmm1,%xmm4 +.byte 0x67 + movdqa %xmm1,%xmm2 +.byte 0x67 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,112(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,128(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,144(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,160(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,176(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,192(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,208(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,224(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,240(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,256(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,272(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,288(%r10) + movdqa %xmm4,%xmm3 +.byte 0x67 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,304(%r10) + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,320(%r10) + + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,336(%r10) + + pand 64(%rdi),%xmm0 + pand 80(%rdi),%xmm1 + pand 96(%rdi),%xmm2 + movdqa %xmm3,352(%r10) + pand 112(%rdi),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -128(%rdi),%xmm4 + movdqa -112(%rdi),%xmm5 + movdqa -96(%rdi),%xmm2 + pand 112(%r10),%xmm4 + movdqa -80(%rdi),%xmm3 + pand 128(%r10),%xmm5 + por %xmm4,%xmm0 + pand 144(%r10),%xmm2 + por %xmm5,%xmm1 + pand 160(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -64(%rdi),%xmm4 + movdqa -48(%rdi),%xmm5 + movdqa -32(%rdi),%xmm2 + pand 176(%r10),%xmm4 + movdqa -16(%rdi),%xmm3 + pand 192(%r10),%xmm5 + por %xmm4,%xmm0 + pand 208(%r10),%xmm2 + por %xmm5,%xmm1 + pand 224(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa 0(%rdi),%xmm4 + movdqa 16(%rdi),%xmm5 + movdqa 32(%rdi),%xmm2 + pand 240(%r10),%xmm4 + movdqa 48(%rdi),%xmm3 + pand 256(%r10),%xmm5 + por %xmm4,%xmm0 + pand 272(%r10),%xmm2 + por %xmm5,%xmm1 + pand 288(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + pxor %xmm1,%xmm0 + pshufd $0x4e,%xmm0,%xmm1 + por %xmm1,%xmm0 + leaq 256(%rdi),%rdi .byte 102,72,15,126,194 - movq 96(%rbx),%xmm0 - leaq 512(%rdi),%rdi - pand %xmm5,%xmm2 -.byte 0x67,0x67 - pand %xmm6,%xmm3 - - - - - - - - leaq 64+32+8(%rsp,%r11,8),%rbx + leaq 64+32+8(%rsp),%rbx movq %rdx,%r9 mulxq 0(%rsi),%r8,%rax @@ -1933,37 +2356,31 @@ mulx4x_internal: xorq %rbp,%rbp movq %r8,%rdx - por %xmm2,%xmm1 - pand %xmm7,%xmm0 - por %xmm3,%xmm1 movq %rdi,8+8(%rsp) - por %xmm1,%xmm0 -.byte 0x48,0x8d,0xb6,0x20,0x00,0x00,0x00 + leaq 32(%rsi),%rsi adcxq %rax,%r13 adcxq %rbp,%r14 mulxq 0(%rcx),%rax,%r10 adcxq %rax,%r15 adoxq %r11,%r10 - mulxq 16(%rcx),%rax,%r11 + mulxq 8(%rcx),%rax,%r11 adcxq %rax,%r10 adoxq %r12,%r11 - mulxq 32(%rcx),%rax,%r12 + mulxq 16(%rcx),%rax,%r12 movq 24+8(%rsp),%rdi -.byte 0x66 movq %r10,-32(%rbx) adcxq %rax,%r11 adoxq %r13,%r12 - mulxq 48(%rcx),%rax,%r15 -.byte 0x67,0x67 + mulxq 24(%rcx),%rax,%r15 movq %r9,%rdx movq %r11,-24(%rbx) adcxq %rax,%r12 adoxq %rbp,%r15 -.byte 0x48,0x8d,0x89,0x40,0x00,0x00,0x00 + leaq 32(%rcx),%rcx movq %r12,-16(%rbx) - + jmp L$mulx4x_1st .p2align 5 L$mulx4x_1st: @@ -1986,27 +2403,26 @@ L$mulx4x_1st: mulxq 0(%rcx),%rax,%r15 adcxq %rax,%r10 adoxq %r15,%r11 - mulxq 16(%rcx),%rax,%r15 + mulxq 8(%rcx),%rax,%r15 adcxq %rax,%r11 adoxq %r15,%r12 - mulxq 32(%rcx),%rax,%r15 + mulxq 16(%rcx),%rax,%r15 movq %r10,-40(%rbx) adcxq %rax,%r12 movq %r11,-32(%rbx) adoxq %r15,%r13 - mulxq 48(%rcx),%rax,%r15 + mulxq 24(%rcx),%rax,%r15 movq %r9,%rdx movq %r12,-24(%rbx) adcxq %rax,%r13 adoxq %rbp,%r15 - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx movq %r13,-16(%rbx) decq %rdi jnz L$mulx4x_1st movq 8(%rsp),%rax -.byte 102,72,15,126,194 adcq %rbp,%r15 leaq (%rsi,%rax,1),%rsi addq %r15,%r14 @@ -2017,6 +2433,64 @@ L$mulx4x_1st: .p2align 5 L$mulx4x_outer: + leaq 16-256(%rbx),%r10 + pxor %xmm4,%xmm4 +.byte 0x67,0x67 + pxor %xmm5,%xmm5 + movdqa -128(%rdi),%xmm0 + movdqa -112(%rdi),%xmm1 + movdqa -96(%rdi),%xmm2 + pand 256(%r10),%xmm0 + movdqa -80(%rdi),%xmm3 + pand 272(%r10),%xmm1 + por %xmm0,%xmm4 + pand 288(%r10),%xmm2 + por %xmm1,%xmm5 + pand 304(%r10),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa -64(%rdi),%xmm0 + movdqa -48(%rdi),%xmm1 + movdqa -32(%rdi),%xmm2 + pand 320(%r10),%xmm0 + movdqa -16(%rdi),%xmm3 + pand 336(%r10),%xmm1 + por %xmm0,%xmm4 + pand 352(%r10),%xmm2 + por %xmm1,%xmm5 + pand 368(%r10),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 0(%rdi),%xmm0 + movdqa 16(%rdi),%xmm1 + movdqa 32(%rdi),%xmm2 + pand 384(%r10),%xmm0 + movdqa 48(%rdi),%xmm3 + pand 400(%r10),%xmm1 + por %xmm0,%xmm4 + pand 416(%r10),%xmm2 + por %xmm1,%xmm5 + pand 432(%r10),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 64(%rdi),%xmm0 + movdqa 80(%rdi),%xmm1 + movdqa 96(%rdi),%xmm2 + pand 448(%r10),%xmm0 + movdqa 112(%rdi),%xmm3 + pand 464(%r10),%xmm1 + por %xmm0,%xmm4 + pand 480(%r10),%xmm2 + por %xmm1,%xmm5 + pand 496(%r10),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + por %xmm5,%xmm4 + pshufd $0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 + leaq 256(%rdi),%rdi +.byte 102,72,15,126,194 + movq %rbp,(%rbx) leaq 32(%rbx,%rax,1),%rbx mulxq 0(%rsi),%r8,%r11 @@ -2031,54 +2505,37 @@ L$mulx4x_outer: mulxq 24(%rsi),%rdx,%r14 adoxq -16(%rbx),%r12 adcxq %rdx,%r13 - leaq (%rcx,%rax,2),%rcx + leaq (%rcx,%rax,1),%rcx leaq 32(%rsi),%rsi adoxq -8(%rbx),%r13 adcxq %rbp,%r14 adoxq %rbp,%r14 -.byte 0x67 movq %r8,%r15 imulq 32+8(%rsp),%r8 - movq -96(%rdi),%xmm0 -.byte 0x67,0x67 movq %r8,%rdx - movq -32(%rdi),%xmm1 -.byte 0x67 - pand %xmm4,%xmm0 - movq 32(%rdi),%xmm2 -.byte 0x67 - pand %xmm5,%xmm1 - movq 96(%rdi),%xmm3 - addq $256,%rdi -.byte 0x67 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 xorq %rbp,%rbp movq %rdi,8+8(%rsp) mulxq 0(%rcx),%rax,%r10 adcxq %rax,%r15 adoxq %r11,%r10 - mulxq 16(%rcx),%rax,%r11 + mulxq 8(%rcx),%rax,%r11 adcxq %rax,%r10 adoxq %r12,%r11 - mulxq 32(%rcx),%rax,%r12 + mulxq 16(%rcx),%rax,%r12 adcxq %rax,%r11 adoxq %r13,%r12 - mulxq 48(%rcx),%rax,%r15 + mulxq 24(%rcx),%rax,%r15 movq %r9,%rdx - por %xmm2,%xmm0 movq 24+8(%rsp),%rdi movq %r10,-32(%rbx) - por %xmm3,%xmm0 adcxq %rax,%r12 movq %r11,-24(%rbx) adoxq %rbp,%r15 movq %r12,-16(%rbx) - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx jmp L$mulx4x_inner .p2align 5 @@ -2106,17 +2563,17 @@ L$mulx4x_inner: mulxq 0(%rcx),%rax,%r15 adcxq %rax,%r10 adoxq %r15,%r11 - mulxq 16(%rcx),%rax,%r15 + mulxq 8(%rcx),%rax,%r15 adcxq %rax,%r11 adoxq %r15,%r12 - mulxq 32(%rcx),%rax,%r15 + mulxq 16(%rcx),%rax,%r15 movq %r10,-40(%rbx) adcxq %rax,%r12 adoxq %r15,%r13 movq %r11,-32(%rbx) - mulxq 48(%rcx),%rax,%r15 + mulxq 24(%rcx),%rax,%r15 movq %r9,%rdx - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx movq %r12,-24(%rbx) adcxq %rax,%r13 adoxq %rbp,%r15 @@ -2126,7 +2583,6 @@ L$mulx4x_inner: jnz L$mulx4x_inner movq 0+8(%rsp),%rax -.byte 102,72,15,126,194 adcq %rbp,%r15 subq 0(%rbx),%rdi movq 8+8(%rsp),%rdi @@ -2139,26 +2595,31 @@ L$mulx4x_inner: cmpq %r10,%rdi jb L$mulx4x_outer - movq -16(%rcx),%r10 + movq -8(%rcx),%r10 + movq %rbp,%r8 + movq (%rcx,%rax,1),%r12 + leaq (%rcx,%rax,1),%rbp + movq %rax,%rcx + leaq (%rbx,%rax,1),%rdi + xorl %eax,%eax xorq %r15,%r15 subq %r14,%r10 adcq %r15,%r15 - orq %r15,%rbp - xorq $1,%rbp - leaq (%rbx,%rax,1),%rdi - leaq (%rcx,%rax,2),%rcx -.byte 0x67,0x67 - sarq $3+2,%rax - leaq (%rcx,%rbp,8),%rbp + orq %r15,%r8 + sarq $3+2,%rcx + subq %r8,%rax movq 56+8(%rsp),%rdx - movq %rax,%rcx - jmp L$sqrx4x_sub + decq %r12 + movq 8(%rbp),%r13 + xorq %r8,%r8 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 + jmp L$sqrx4x_sub_entry .p2align 5 bn_powerx5: L$powerx5_enter: -.byte 0x67 movq %rsp,%rax pushq %rbx pushq %rbp @@ -2166,10 +2627,9 @@ L$powerx5_enter: pushq %r13 pushq %r14 pushq %r15 -.byte 0x67 - movl %r9d,%r10d + shll $3,%r9d - shll $3+2,%r10d + leaq (%r9,%r9,2),%r10 negq %r9 movq (%r8),%r8 @@ -2179,25 +2639,35 @@ L$powerx5_enter: - leaq -64(%rsp,%r9,2),%r11 - subq %rsi,%r11 + + leaq -320(%rsp,%r9,2),%r11 + subq %rdi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb L$pwrx_sp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,2),%rsp + leaq -320(%rsp,%r9,2),%rsp jmp L$pwrx_sp_done .p2align 5 L$pwrx_sp_alt: - leaq 4096-64(,%r9,2),%r10 - leaq -64(%rsp,%r9,2),%rsp + leaq 4096-320(,%r9,2),%r10 + leaq -320(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp L$pwrx_sp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +L$pwrx_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc L$pwrx_page_walk + movq %r9,%r10 negq %r9 @@ -2222,10 +2692,15 @@ L$pwrx_sp_done: L$powerx5_body: call __bn_sqrx8x_internal + call __bn_postx4x_internal call __bn_sqrx8x_internal + call __bn_postx4x_internal call __bn_sqrx8x_internal + call __bn_postx4x_internal call __bn_sqrx8x_internal + call __bn_postx4x_internal call __bn_sqrx8x_internal + call __bn_postx4x_internal movq %r10,%r9 movq %rsi,%rdi @@ -2237,6 +2712,7 @@ L$powerx5_body: movq 40(%rsp),%rsi movq $1,%rax + movq -48(%rsi),%r15 movq -40(%rsi),%r14 movq -32(%rsi),%r13 @@ -2649,11 +3125,11 @@ L$sqrx4x_shift_n_add_break: movq %rbx,56(%rdi) leaq 64(%rdi),%rdi .byte 102,72,15,126,213 -sqrx8x_reduction: +__bn_sqrx8x_reduction: xorl %eax,%eax movq 32+8(%rsp),%rbx movq 48+8(%rsp),%rdx - leaq -128(%rbp,%r9,2),%rcx + leaq -64(%rbp,%r9,1),%rcx movq %rcx,0+8(%rsp) movq %rdi,8+8(%rsp) @@ -2686,19 +3162,19 @@ L$sqrx8x_reduce: adcxq %rbx,%rax adoxq %r9,%r8 - mulxq 16(%rbp),%rbx,%r9 + mulxq 8(%rbp),%rbx,%r9 adcxq %rbx,%r8 adoxq %r10,%r9 - mulxq 32(%rbp),%rbx,%r10 + mulxq 16(%rbp),%rbx,%r10 adcxq %rbx,%r9 adoxq %r11,%r10 - mulxq 48(%rbp),%rbx,%r11 + mulxq 24(%rbp),%rbx,%r11 adcxq %rbx,%r10 adoxq %r12,%r11 -.byte 0xc4,0x62,0xe3,0xf6,0xa5,0x40,0x00,0x00,0x00 +.byte 0xc4,0x62,0xe3,0xf6,0xa5,0x20,0x00,0x00,0x00 movq %rdx,%rax movq %r8,%rdx adcxq %rbx,%r11 @@ -2708,15 +3184,15 @@ L$sqrx8x_reduce: movq %rax,%rdx movq %rax,64+48+8(%rsp,%rcx,8) - mulxq 80(%rbp),%rax,%r13 + mulxq 40(%rbp),%rax,%r13 adcxq %rax,%r12 adoxq %r14,%r13 - mulxq 96(%rbp),%rax,%r14 + mulxq 48(%rbp),%rax,%r14 adcxq %rax,%r13 adoxq %r15,%r14 - mulxq 112(%rbp),%rax,%r15 + mulxq 56(%rbp),%rax,%r15 movq %rbx,%rdx adcxq %rax,%r14 adoxq %rsi,%r15 @@ -2732,7 +3208,7 @@ L$sqrx8x_reduce: movq 48+8(%rsp),%rdx addq 0(%rdi),%r8 - leaq 128(%rbp),%rbp + leaq 64(%rbp),%rbp movq $-8,%rcx adcxq 8(%rdi),%r9 adcxq 16(%rdi),%r10 @@ -2755,31 +3231,31 @@ L$sqrx8x_tail: adcxq %rax,%rbx adoxq %r9,%r8 - mulxq 16(%rbp),%rax,%r9 + mulxq 8(%rbp),%rax,%r9 adcxq %rax,%r8 adoxq %r10,%r9 - mulxq 32(%rbp),%rax,%r10 + mulxq 16(%rbp),%rax,%r10 adcxq %rax,%r9 adoxq %r11,%r10 - mulxq 48(%rbp),%rax,%r11 + mulxq 24(%rbp),%rax,%r11 adcxq %rax,%r10 adoxq %r12,%r11 -.byte 0xc4,0x62,0xfb,0xf6,0xa5,0x40,0x00,0x00,0x00 +.byte 0xc4,0x62,0xfb,0xf6,0xa5,0x20,0x00,0x00,0x00 adcxq %rax,%r11 adoxq %r13,%r12 - mulxq 80(%rbp),%rax,%r13 + mulxq 40(%rbp),%rax,%r13 adcxq %rax,%r12 adoxq %r14,%r13 - mulxq 96(%rbp),%rax,%r14 + mulxq 48(%rbp),%rax,%r14 adcxq %rax,%r13 adoxq %r15,%r14 - mulxq 112(%rbp),%rax,%r15 + mulxq 56(%rbp),%rax,%r15 movq 72+48+8(%rsp,%rcx,8),%rdx adcxq %rax,%r14 adoxq %rsi,%r15 @@ -2795,7 +3271,7 @@ L$sqrx8x_tail: subq 16+8(%rsp),%rsi movq 48+8(%rsp),%rdx - leaq 128(%rbp),%rbp + leaq 64(%rbp),%rbp adcq 0(%rdi),%r8 adcq 8(%rdi),%r9 adcq 16(%rdi),%r10 @@ -2831,7 +3307,7 @@ L$sqrx8x_no_tail: adcq 0(%rdi),%r8 .byte 102,72,15,126,217 adcq 8(%rdi),%r9 - movq 112(%rbp),%rsi + movq 56(%rbp),%rsi .byte 102,72,15,126,213 adcq 16(%rdi),%r10 adcq 24(%rdi),%r11 @@ -2857,41 +3333,54 @@ L$sqrx8x_no_tail: leaq 64(%rdi,%rcx,1),%rdi cmpq 8+8(%rsp),%r8 jb L$sqrx8x_reduction_loop - xorl %ebx,%ebx - subq %r15,%rsi - adcq %rbx,%rbx + .byte 0xf3,0xc3 + +.p2align 5 +__bn_postx4x_internal: + movq 0(%rbp),%r12 movq %rcx,%r10 - orq %rbx,%rax movq %rcx,%r9 - xorq $1,%rax + negq %rax sarq $3+2,%rcx - leaq (%rbp,%rax,8),%rbp .byte 102,72,15,126,202 .byte 102,72,15,126,206 - jmp L$sqrx4x_sub + decq %r12 + movq 8(%rbp),%r13 + xorq %r8,%r8 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 + jmp L$sqrx4x_sub_entry -.p2align 5 +.p2align 4 L$sqrx4x_sub: -.byte 0x66 - movq 0(%rdi),%r12 - movq 8(%rdi),%r13 - sbbq 0(%rbp),%r12 - movq 16(%rdi),%r14 - sbbq 16(%rbp),%r13 - movq 24(%rdi),%r15 - leaq 32(%rdi),%rdi - sbbq 32(%rbp),%r14 + movq 0(%rbp),%r12 + movq 8(%rbp),%r13 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 +L$sqrx4x_sub_entry: + andnq %rax,%r12,%r12 + leaq 32(%rbp),%rbp + andnq %rax,%r13,%r13 + andnq %rax,%r14,%r14 + andnq %rax,%r15,%r15 + + negq %r8 + adcq 0(%rdi),%r12 + adcq 8(%rdi),%r13 + adcq 16(%rdi),%r14 + adcq 24(%rdi),%r15 movq %r12,0(%rdx) - sbbq 48(%rbp),%r15 - leaq 64(%rbp),%rbp + leaq 32(%rdi),%rdi movq %r13,8(%rdx) + sbbq %r8,%r8 movq %r14,16(%rdx) movq %r15,24(%rdx) leaq 32(%rdx),%rdx incq %rcx jnz L$sqrx4x_sub + negq %r9 .byte 0xf3,0xc3 @@ -2935,45 +3424,169 @@ L$scatter_epilogue: .globl _bn_gather5 -.p2align 4 +.p2align 5 _bn_gather5: - movl %ecx,%r11d - shrl $3,%ecx - andq $7,%r11 - notl %ecx - leaq L$magic_masks(%rip),%rax - andl $3,%ecx - leaq 128(%rdx,%r11,8),%rdx - movq 0(%rax,%rcx,8),%xmm4 - movq 8(%rax,%rcx,8),%xmm5 - movq 16(%rax,%rcx,8),%xmm6 - movq 24(%rax,%rcx,8),%xmm7 +L$SEH_begin_bn_gather5: + +.byte 0x4c,0x8d,0x14,0x24 +.byte 0x48,0x81,0xec,0x08,0x01,0x00,0x00 + leaq L$inc(%rip),%rax + andq $-16,%rsp + + movd %ecx,%xmm5 + movdqa 0(%rax),%xmm0 + movdqa 16(%rax),%xmm1 + leaq 128(%rdx),%r11 + leaq 128(%rsp),%rax + + pshufd $0,%xmm5,%xmm5 + movdqa %xmm1,%xmm4 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,-128(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,-112(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,-96(%rax) + movdqa %xmm4,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,-80(%rax) + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,-64(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,-48(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,-32(%rax) + movdqa %xmm4,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,-16(%rax) + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,0(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,16(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,32(%rax) + movdqa %xmm4,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,48(%rax) + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,64(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,80(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,96(%rax) + movdqa %xmm4,%xmm2 + movdqa %xmm3,112(%rax) jmp L$gather -.p2align 4 -L$gather: - movq -128(%rdx),%xmm0 - movq -64(%rdx),%xmm1 - pand %xmm4,%xmm0 - movq 0(%rdx),%xmm2 - pand %xmm5,%xmm1 - movq 64(%rdx),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 -.byte 0x67,0x67 - por %xmm2,%xmm0 - leaq 256(%rdx),%rdx - por %xmm3,%xmm0 +.p2align 5 +L$gather: + pxor %xmm4,%xmm4 + pxor %xmm5,%xmm5 + movdqa -128(%r11),%xmm0 + movdqa -112(%r11),%xmm1 + movdqa -96(%r11),%xmm2 + pand -128(%rax),%xmm0 + movdqa -80(%r11),%xmm3 + pand -112(%rax),%xmm1 + por %xmm0,%xmm4 + pand -96(%rax),%xmm2 + por %xmm1,%xmm5 + pand -80(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa -64(%r11),%xmm0 + movdqa -48(%r11),%xmm1 + movdqa -32(%r11),%xmm2 + pand -64(%rax),%xmm0 + movdqa -16(%r11),%xmm3 + pand -48(%rax),%xmm1 + por %xmm0,%xmm4 + pand -32(%rax),%xmm2 + por %xmm1,%xmm5 + pand -16(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 0(%r11),%xmm0 + movdqa 16(%r11),%xmm1 + movdqa 32(%r11),%xmm2 + pand 0(%rax),%xmm0 + movdqa 48(%r11),%xmm3 + pand 16(%rax),%xmm1 + por %xmm0,%xmm4 + pand 32(%rax),%xmm2 + por %xmm1,%xmm5 + pand 48(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 64(%r11),%xmm0 + movdqa 80(%r11),%xmm1 + movdqa 96(%r11),%xmm2 + pand 64(%rax),%xmm0 + movdqa 112(%r11),%xmm3 + pand 80(%rax),%xmm1 + por %xmm0,%xmm4 + pand 96(%rax),%xmm2 + por %xmm1,%xmm5 + pand 112(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + por %xmm5,%xmm4 + leaq 256(%r11),%r11 + pshufd $0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 movq %xmm0,(%rdi) leaq 8(%rdi),%rdi subl $1,%esi jnz L$gather + + leaq (%r10),%rsp .byte 0xf3,0xc3 L$SEH_end_bn_gather5: .p2align 6 -L$magic_masks: -.long 0,0, 0,0, 0,0, -1,-1 -.long 0,0, 0,0, 0,0, 0,0 +L$inc: +.long 0,0, 1,1 +.long 2,2, 2,2 .byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105,112,108,105,99,97,116,105,111,110,32,119,105,116,104,32,115,99,97,116,116,101,114,47,103,97,116,104,101,114,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 diff --git a/vendor/openssl/asm/x64-macosx-gas/camellia/cmll-x86_64.s b/vendor/openssl/asm/x64-macosx-gas/camellia/cmll-x86_64.s index 0a3145ad4..8025d088f 100644 --- a/vendor/openssl/asm/x64-macosx-gas/camellia/cmll-x86_64.s +++ b/vendor/openssl/asm/x64-macosx-gas/camellia/cmll-x86_64.s @@ -1624,7 +1624,7 @@ L$cbc_prologue: leaq -64-63(%rcx),%r10 subq %rsp,%r10 negq %r10 - andq $960,%r10 + andq $0x3C0,%r10 subq %r10,%rsp diff --git a/vendor/openssl/asm/x64-macosx-gas/ec/ecp_nistz256-x86_64.s b/vendor/openssl/asm/x64-macosx-gas/ec/ecp_nistz256-x86_64.s index f2eb8554e..b90788f45 100644 --- a/vendor/openssl/asm/x64-macosx-gas/ec/ecp_nistz256-x86_64.s +++ b/vendor/openssl/asm/x64-macosx-gas/ec/ecp_nistz256-x86_64.s @@ -332,7 +332,7 @@ _ecp_nistz256_neg: .p2align 5 _ecp_nistz256_to_mont: - movl $524544,%ecx + movl $0x80100,%ecx andl _OPENSSL_ia32cap_P+8(%rip),%ecx leaq L$RR(%rip),%rdx jmp L$mul_mont @@ -348,7 +348,7 @@ _ecp_nistz256_to_mont: .p2align 5 _ecp_nistz256_mul_mont: - movl $524544,%ecx + movl $0x80100,%ecx andl _OPENSSL_ia32cap_P+8(%rip),%ecx L$mul_mont: pushq %rbp @@ -357,7 +357,7 @@ L$mul_mont: pushq %r13 pushq %r14 pushq %r15 - cmpl $524544,%ecx + cmpl $0x80100,%ecx je L$mul_montx movq %rdx,%rbx movq 0(%rdx),%rax @@ -617,7 +617,7 @@ __ecp_nistz256_mul_montq: .p2align 5 _ecp_nistz256_sqr_mont: - movl $524544,%ecx + movl $0x80100,%ecx andl _OPENSSL_ia32cap_P+8(%rip),%ecx pushq %rbp pushq %rbx @@ -625,7 +625,7 @@ _ecp_nistz256_sqr_mont: pushq %r13 pushq %r14 pushq %r15 - cmpl $524544,%ecx + cmpl $0x80100,%ecx je L$sqr_montx movq 0(%rsi),%rax movq 8(%rsi),%r14 @@ -1581,9 +1581,9 @@ __ecp_nistz256_mul_by_2q: .p2align 5 _ecp_nistz256_point_double: - movl $524544,%ecx + movl $0x80100,%ecx andl _OPENSSL_ia32cap_P+8(%rip),%ecx - cmpl $524544,%ecx + cmpl $0x80100,%ecx je L$point_doublex pushq %rbp pushq %rbx @@ -1593,6 +1593,7 @@ _ecp_nistz256_point_double: pushq %r15 subq $160+8,%rsp +L$point_double_shortcutq: movdqu 0(%rsi),%xmm0 movq %rsi,%rbx movdqu 16(%rsi),%xmm1 @@ -1786,9 +1787,9 @@ _ecp_nistz256_point_double: .p2align 5 _ecp_nistz256_point_add: - movl $524544,%ecx + movl $0x80100,%ecx andl _OPENSSL_ia32cap_P+8(%rip),%ecx - cmpl $524544,%ecx + cmpl $0x80100,%ecx je L$point_addx pushq %rbp pushq %rbx @@ -1817,7 +1818,7 @@ _ecp_nistz256_point_add: por %xmm1,%xmm3 movdqu 0(%rsi),%xmm0 - pshufd $177,%xmm3,%xmm5 + pshufd $0xb1,%xmm3,%xmm5 movdqu 16(%rsi),%xmm1 movdqu 32(%rsi),%xmm2 por %xmm3,%xmm5 @@ -1827,7 +1828,7 @@ _ecp_nistz256_point_add: movq 64+16(%rsi),%r15 movq 64+24(%rsi),%r8 movdqa %xmm0,480(%rsp) - pshufd $30,%xmm5,%xmm4 + pshufd $0x1e,%xmm5,%xmm4 movdqa %xmm1,480+16(%rsp) por %xmm0,%xmm1 .byte 102,72,15,110,199 @@ -1847,10 +1848,10 @@ _ecp_nistz256_point_add: call __ecp_nistz256_sqr_montq pcmpeqd %xmm4,%xmm5 - pshufd $177,%xmm3,%xmm4 + pshufd $0xb1,%xmm3,%xmm4 por %xmm3,%xmm4 pshufd $0,%xmm5,%xmm5 - pshufd $30,%xmm4,%xmm3 + pshufd $0x1e,%xmm4,%xmm3 por %xmm3,%xmm4 pxor %xmm3,%xmm3 pcmpeqd %xmm3,%xmm4 @@ -1859,6 +1860,7 @@ _ecp_nistz256_point_add: movq 64+8(%rbx),%r14 movq 64+16(%rbx),%r15 movq 64+24(%rbx),%r8 +.byte 102,72,15,110,203 leaq 64-0(%rbx),%rsi leaq 32(%rsp),%rdi @@ -1950,7 +1952,7 @@ _ecp_nistz256_point_add: testq %r8,%r8 jnz L$add_proceedq testq %r9,%r9 - jz L$add_proceedq + jz L$add_doubleq .byte 102,72,15,126,199 pxor %xmm0,%xmm0 @@ -1962,6 +1964,13 @@ _ecp_nistz256_point_add: movdqu %xmm0,80(%rdi) jmp L$add_doneq +.p2align 5 +L$add_doubleq: +.byte 102,72,15,126,206 +.byte 102,72,15,126,199 + addq $416,%rsp + jmp L$point_double_shortcutq + .p2align 5 L$add_proceedq: movq 0+64(%rsp),%rax @@ -2179,9 +2188,9 @@ L$add_doneq: .p2align 5 _ecp_nistz256_point_add_affine: - movl $524544,%ecx + movl $0x80100,%ecx andl _OPENSSL_ia32cap_P+8(%rip),%ecx - cmpl $524544,%ecx + cmpl $0x80100,%ecx je L$point_add_affinex pushq %rbp pushq %rbx @@ -2213,13 +2222,13 @@ _ecp_nistz256_point_add_affine: por %xmm1,%xmm3 movdqu 0(%rbx),%xmm0 - pshufd $177,%xmm3,%xmm5 + pshufd $0xb1,%xmm3,%xmm5 movdqu 16(%rbx),%xmm1 movdqu 32(%rbx),%xmm2 por %xmm3,%xmm5 movdqu 48(%rbx),%xmm3 movdqa %xmm0,416(%rsp) - pshufd $30,%xmm5,%xmm4 + pshufd $0x1e,%xmm5,%xmm4 movdqa %xmm1,416+16(%rsp) por %xmm0,%xmm1 .byte 102,72,15,110,199 @@ -2235,13 +2244,13 @@ _ecp_nistz256_point_add_affine: call __ecp_nistz256_sqr_montq pcmpeqd %xmm4,%xmm5 - pshufd $177,%xmm3,%xmm4 + pshufd $0xb1,%xmm3,%xmm4 movq 0(%rbx),%rax movq %r12,%r9 por %xmm3,%xmm4 pshufd $0,%xmm5,%xmm5 - pshufd $30,%xmm4,%xmm3 + pshufd $0x1e,%xmm4,%xmm3 movq %r13,%r10 por %xmm3,%xmm4 pxor %xmm3,%xmm3 @@ -2621,6 +2630,7 @@ L$point_doublex: pushq %r15 subq $160+8,%rsp +L$point_double_shortcutx: movdqu 0(%rsi),%xmm0 movq %rsi,%rbx movdqu 16(%rsi),%xmm1 @@ -2841,7 +2851,7 @@ L$point_addx: por %xmm1,%xmm3 movdqu 0(%rsi),%xmm0 - pshufd $177,%xmm3,%xmm5 + pshufd $0xb1,%xmm3,%xmm5 movdqu 16(%rsi),%xmm1 movdqu 32(%rsi),%xmm2 por %xmm3,%xmm5 @@ -2851,7 +2861,7 @@ L$point_addx: movq 64+16(%rsi),%r15 movq 64+24(%rsi),%r8 movdqa %xmm0,480(%rsp) - pshufd $30,%xmm5,%xmm4 + pshufd $0x1e,%xmm5,%xmm4 movdqa %xmm1,480+16(%rsp) por %xmm0,%xmm1 .byte 102,72,15,110,199 @@ -2871,10 +2881,10 @@ L$point_addx: call __ecp_nistz256_sqr_montx pcmpeqd %xmm4,%xmm5 - pshufd $177,%xmm3,%xmm4 + pshufd $0xb1,%xmm3,%xmm4 por %xmm3,%xmm4 pshufd $0,%xmm5,%xmm5 - pshufd $30,%xmm4,%xmm3 + pshufd $0x1e,%xmm4,%xmm3 por %xmm3,%xmm4 pxor %xmm3,%xmm3 pcmpeqd %xmm3,%xmm4 @@ -2883,6 +2893,7 @@ L$point_addx: movq 64+8(%rbx),%r14 movq 64+16(%rbx),%r15 movq 64+24(%rbx),%r8 +.byte 102,72,15,110,203 leaq 64-128(%rbx),%rsi leaq 32(%rsp),%rdi @@ -2974,7 +2985,7 @@ L$point_addx: testq %r8,%r8 jnz L$add_proceedx testq %r9,%r9 - jz L$add_proceedx + jz L$add_doublex .byte 102,72,15,126,199 pxor %xmm0,%xmm0 @@ -2986,6 +2997,13 @@ L$point_addx: movdqu %xmm0,80(%rdi) jmp L$add_donex +.p2align 5 +L$add_doublex: +.byte 102,72,15,126,206 +.byte 102,72,15,126,199 + addq $416,%rsp + jmp L$point_double_shortcutx + .p2align 5 L$add_proceedx: movq 0+64(%rsp),%rdx @@ -3233,13 +3251,13 @@ L$point_add_affinex: por %xmm1,%xmm3 movdqu 0(%rbx),%xmm0 - pshufd $177,%xmm3,%xmm5 + pshufd $0xb1,%xmm3,%xmm5 movdqu 16(%rbx),%xmm1 movdqu 32(%rbx),%xmm2 por %xmm3,%xmm5 movdqu 48(%rbx),%xmm3 movdqa %xmm0,416(%rsp) - pshufd $30,%xmm5,%xmm4 + pshufd $0x1e,%xmm5,%xmm4 movdqa %xmm1,416+16(%rsp) por %xmm0,%xmm1 .byte 102,72,15,110,199 @@ -3255,13 +3273,13 @@ L$point_add_affinex: call __ecp_nistz256_sqr_montx pcmpeqd %xmm4,%xmm5 - pshufd $177,%xmm3,%xmm4 + pshufd $0xb1,%xmm3,%xmm4 movq 0(%rbx),%rdx movq %r12,%r9 por %xmm3,%xmm4 pshufd $0,%xmm5,%xmm5 - pshufd $30,%xmm4,%xmm3 + pshufd $0x1e,%xmm4,%xmm3 movq %r13,%r10 por %xmm3,%xmm4 pxor %xmm3,%xmm3 diff --git a/vendor/openssl/asm/x64-macosx-gas/md5/md5-x86_64.s b/vendor/openssl/asm/x64-macosx-gas/md5/md5-x86_64.s index 712a871d3..5b1f44ea0 100644 --- a/vendor/openssl/asm/x64-macosx-gas/md5/md5-x86_64.s +++ b/vendor/openssl/asm/x64-macosx-gas/md5/md5-x86_64.s @@ -493,14 +493,14 @@ L$loop: movl %ecx,%r11d addl %ecx,%ebx movl 0(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d xorl %edx,%r11d leal -198630844(%rax,%r10,1),%eax orl %ebx,%r11d xorl %ecx,%r11d addl %r11d,%eax movl 28(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $6,%eax xorl %ecx,%r11d addl %ebx,%eax @@ -509,7 +509,7 @@ L$loop: xorl %ebx,%r11d addl %r11d,%edx movl 56(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $10,%edx xorl %ebx,%r11d addl %eax,%edx @@ -518,7 +518,7 @@ L$loop: xorl %eax,%r11d addl %r11d,%ecx movl 20(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $15,%ecx xorl %eax,%r11d addl %edx,%ecx @@ -527,7 +527,7 @@ L$loop: xorl %edx,%r11d addl %r11d,%ebx movl 48(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $21,%ebx xorl %edx,%r11d addl %ecx,%ebx @@ -536,7 +536,7 @@ L$loop: xorl %ecx,%r11d addl %r11d,%eax movl 12(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $6,%eax xorl %ecx,%r11d addl %ebx,%eax @@ -545,7 +545,7 @@ L$loop: xorl %ebx,%r11d addl %r11d,%edx movl 40(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $10,%edx xorl %ebx,%r11d addl %eax,%edx @@ -554,7 +554,7 @@ L$loop: xorl %eax,%r11d addl %r11d,%ecx movl 4(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $15,%ecx xorl %eax,%r11d addl %edx,%ecx @@ -563,7 +563,7 @@ L$loop: xorl %edx,%r11d addl %r11d,%ebx movl 32(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $21,%ebx xorl %edx,%r11d addl %ecx,%ebx @@ -572,7 +572,7 @@ L$loop: xorl %ecx,%r11d addl %r11d,%eax movl 60(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $6,%eax xorl %ecx,%r11d addl %ebx,%eax @@ -581,7 +581,7 @@ L$loop: xorl %ebx,%r11d addl %r11d,%edx movl 24(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $10,%edx xorl %ebx,%r11d addl %eax,%edx @@ -590,7 +590,7 @@ L$loop: xorl %eax,%r11d addl %r11d,%ecx movl 52(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $15,%ecx xorl %eax,%r11d addl %edx,%ecx @@ -599,7 +599,7 @@ L$loop: xorl %edx,%r11d addl %r11d,%ebx movl 16(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $21,%ebx xorl %edx,%r11d addl %ecx,%ebx @@ -608,7 +608,7 @@ L$loop: xorl %ecx,%r11d addl %r11d,%eax movl 44(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $6,%eax xorl %ecx,%r11d addl %ebx,%eax @@ -617,7 +617,7 @@ L$loop: xorl %ebx,%r11d addl %r11d,%edx movl 8(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $10,%edx xorl %ebx,%r11d addl %eax,%edx @@ -626,7 +626,7 @@ L$loop: xorl %eax,%r11d addl %r11d,%ecx movl 36(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $15,%ecx xorl %eax,%r11d addl %edx,%ecx @@ -635,7 +635,7 @@ L$loop: xorl %edx,%r11d addl %r11d,%ebx movl 0(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $21,%ebx xorl %edx,%r11d addl %ecx,%ebx diff --git a/vendor/openssl/asm/x64-macosx-gas/modes/aesni-gcm-x86_64.s b/vendor/openssl/asm/x64-macosx-gas/modes/aesni-gcm-x86_64.s index 86665d6e9..39b2fb84e 100644 --- a/vendor/openssl/asm/x64-macosx-gas/modes/aesni-gcm-x86_64.s +++ b/vendor/openssl/asm/x64-macosx-gas/modes/aesni-gcm-x86_64.s @@ -27,40 +27,40 @@ L$oop6x: L$resume_ctr32: vmovdqu %xmm1,(%r8) - vpclmulqdq $16,%xmm3,%xmm7,%xmm5 + vpclmulqdq $0x10,%xmm3,%xmm7,%xmm5 vpxor %xmm15,%xmm12,%xmm12 vmovups 16-128(%rcx),%xmm2 - vpclmulqdq $1,%xmm3,%xmm7,%xmm6 + vpclmulqdq $0x01,%xmm3,%xmm7,%xmm6 xorq %r12,%r12 cmpq %r14,%r15 vaesenc %xmm2,%xmm9,%xmm9 vmovdqu 48+8(%rsp),%xmm0 vpxor %xmm15,%xmm13,%xmm13 - vpclmulqdq $0,%xmm3,%xmm7,%xmm1 + vpclmulqdq $0x00,%xmm3,%xmm7,%xmm1 vaesenc %xmm2,%xmm10,%xmm10 vpxor %xmm15,%xmm14,%xmm14 setnc %r12b - vpclmulqdq $17,%xmm3,%xmm7,%xmm7 + vpclmulqdq $0x11,%xmm3,%xmm7,%xmm7 vaesenc %xmm2,%xmm11,%xmm11 vmovdqu 16-32(%r9),%xmm3 negq %r12 vaesenc %xmm2,%xmm12,%xmm12 vpxor %xmm5,%xmm6,%xmm6 - vpclmulqdq $0,%xmm3,%xmm0,%xmm5 + vpclmulqdq $0x00,%xmm3,%xmm0,%xmm5 vpxor %xmm4,%xmm8,%xmm8 vaesenc %xmm2,%xmm13,%xmm13 vpxor %xmm5,%xmm1,%xmm4 - andq $96,%r12 + andq $0x60,%r12 vmovups 32-128(%rcx),%xmm15 - vpclmulqdq $16,%xmm3,%xmm0,%xmm1 + vpclmulqdq $0x10,%xmm3,%xmm0,%xmm1 vaesenc %xmm2,%xmm14,%xmm14 - vpclmulqdq $1,%xmm3,%xmm0,%xmm2 + vpclmulqdq $0x01,%xmm3,%xmm0,%xmm2 leaq (%r14,%r12,1),%r14 vaesenc %xmm15,%xmm9,%xmm9 vpxor 16+8(%rsp),%xmm8,%xmm8 - vpclmulqdq $17,%xmm3,%xmm0,%xmm3 + vpclmulqdq $0x11,%xmm3,%xmm0,%xmm3 vmovdqu 64+8(%rsp),%xmm0 vaesenc %xmm15,%xmm10,%xmm10 movbeq 88(%r14),%r13 @@ -75,15 +75,15 @@ L$resume_ctr32: vmovups 48-128(%rcx),%xmm15 vpxor %xmm1,%xmm6,%xmm6 - vpclmulqdq $0,%xmm5,%xmm0,%xmm1 + vpclmulqdq $0x00,%xmm5,%xmm0,%xmm1 vaesenc %xmm15,%xmm9,%xmm9 vpxor %xmm2,%xmm6,%xmm6 - vpclmulqdq $16,%xmm5,%xmm0,%xmm2 + vpclmulqdq $0x10,%xmm5,%xmm0,%xmm2 vaesenc %xmm15,%xmm10,%xmm10 vpxor %xmm3,%xmm7,%xmm7 - vpclmulqdq $1,%xmm5,%xmm0,%xmm3 + vpclmulqdq $0x01,%xmm5,%xmm0,%xmm3 vaesenc %xmm15,%xmm11,%xmm11 - vpclmulqdq $17,%xmm5,%xmm0,%xmm5 + vpclmulqdq $0x11,%xmm5,%xmm0,%xmm5 vmovdqu 80+8(%rsp),%xmm0 vaesenc %xmm15,%xmm12,%xmm12 vaesenc %xmm15,%xmm13,%xmm13 @@ -93,17 +93,17 @@ L$resume_ctr32: vmovups 64-128(%rcx),%xmm15 vpxor %xmm2,%xmm6,%xmm6 - vpclmulqdq $0,%xmm1,%xmm0,%xmm2 + vpclmulqdq $0x00,%xmm1,%xmm0,%xmm2 vaesenc %xmm15,%xmm9,%xmm9 vpxor %xmm3,%xmm6,%xmm6 - vpclmulqdq $16,%xmm1,%xmm0,%xmm3 + vpclmulqdq $0x10,%xmm1,%xmm0,%xmm3 vaesenc %xmm15,%xmm10,%xmm10 movbeq 72(%r14),%r13 vpxor %xmm5,%xmm7,%xmm7 - vpclmulqdq $1,%xmm1,%xmm0,%xmm5 + vpclmulqdq $0x01,%xmm1,%xmm0,%xmm5 vaesenc %xmm15,%xmm11,%xmm11 movbeq 64(%r14),%r12 - vpclmulqdq $17,%xmm1,%xmm0,%xmm1 + vpclmulqdq $0x11,%xmm1,%xmm0,%xmm1 vmovdqu 96+8(%rsp),%xmm0 vaesenc %xmm15,%xmm12,%xmm12 movq %r13,48+8(%rsp) @@ -115,18 +115,18 @@ L$resume_ctr32: vmovups 80-128(%rcx),%xmm15 vpxor %xmm3,%xmm6,%xmm6 - vpclmulqdq $0,%xmm2,%xmm0,%xmm3 + vpclmulqdq $0x00,%xmm2,%xmm0,%xmm3 vaesenc %xmm15,%xmm9,%xmm9 vpxor %xmm5,%xmm6,%xmm6 - vpclmulqdq $16,%xmm2,%xmm0,%xmm5 + vpclmulqdq $0x10,%xmm2,%xmm0,%xmm5 vaesenc %xmm15,%xmm10,%xmm10 movbeq 56(%r14),%r13 vpxor %xmm1,%xmm7,%xmm7 - vpclmulqdq $1,%xmm2,%xmm0,%xmm1 + vpclmulqdq $0x01,%xmm2,%xmm0,%xmm1 vpxor 112+8(%rsp),%xmm8,%xmm8 vaesenc %xmm15,%xmm11,%xmm11 movbeq 48(%r14),%r12 - vpclmulqdq $17,%xmm2,%xmm0,%xmm2 + vpclmulqdq $0x11,%xmm2,%xmm0,%xmm2 vaesenc %xmm15,%xmm12,%xmm12 movq %r13,64+8(%rsp) vaesenc %xmm15,%xmm13,%xmm13 @@ -137,17 +137,17 @@ L$resume_ctr32: vmovups 96-128(%rcx),%xmm15 vpxor %xmm5,%xmm6,%xmm6 - vpclmulqdq $16,%xmm3,%xmm8,%xmm5 + vpclmulqdq $0x10,%xmm3,%xmm8,%xmm5 vaesenc %xmm15,%xmm9,%xmm9 vpxor %xmm1,%xmm6,%xmm6 - vpclmulqdq $1,%xmm3,%xmm8,%xmm1 + vpclmulqdq $0x01,%xmm3,%xmm8,%xmm1 vaesenc %xmm15,%xmm10,%xmm10 movbeq 40(%r14),%r13 vpxor %xmm2,%xmm7,%xmm7 - vpclmulqdq $0,%xmm3,%xmm8,%xmm2 + vpclmulqdq $0x00,%xmm3,%xmm8,%xmm2 vaesenc %xmm15,%xmm11,%xmm11 movbeq 32(%r14),%r12 - vpclmulqdq $17,%xmm3,%xmm8,%xmm8 + vpclmulqdq $0x11,%xmm3,%xmm8,%xmm8 vaesenc %xmm15,%xmm12,%xmm12 movq %r13,80+8(%rsp) vaesenc %xmm15,%xmm13,%xmm13 @@ -169,7 +169,7 @@ L$resume_ctr32: vaesenc %xmm15,%xmm11,%xmm11 movbeq 16(%r14),%r12 vpalignr $8,%xmm4,%xmm4,%xmm0 - vpclmulqdq $16,%xmm3,%xmm4,%xmm4 + vpclmulqdq $0x10,%xmm3,%xmm4,%xmm4 movq %r13,96+8(%rsp) vaesenc %xmm15,%xmm12,%xmm12 movq %r12,104+8(%rsp) @@ -255,7 +255,7 @@ L$enc_tail: vmovdqu %xmm7,16+8(%rsp) vpalignr $8,%xmm4,%xmm4,%xmm8 vaesenc %xmm15,%xmm10,%xmm10 - vpclmulqdq $16,%xmm3,%xmm4,%xmm4 + vpclmulqdq $0x10,%xmm3,%xmm4,%xmm4 vpxor 0(%rdi),%xmm1,%xmm2 vaesenc %xmm15,%xmm11,%xmm11 vpxor 16(%rdi),%xmm1,%xmm0 @@ -286,8 +286,8 @@ L$enc_tail: vaesenclast %xmm3,%xmm14,%xmm14 vpaddb %xmm2,%xmm7,%xmm3 - addq $96,%r10 - subq $6,%rdx + addq $0x60,%r10 + subq $0x6,%rdx jc L$6x_done vmovups %xmm9,-96(%rsi) @@ -316,7 +316,7 @@ L$6x_done: .p2align 5 _aesni_gcm_decrypt: xorq %r10,%r10 - cmpq $96,%rdx + cmpq $0x60,%rdx jb L$gcm_dec_abort leaq (%rsp),%rax @@ -333,7 +333,7 @@ _aesni_gcm_decrypt: movl 12(%r8),%ebx leaq L$bswap_mask(%rip),%r11 leaq -128(%rcx),%r14 - movq $3968,%r15 + movq $0xf80,%r15 vmovdqu (%r9),%xmm8 andq $-128,%rsp vmovdqu (%r11),%xmm0 @@ -510,7 +510,7 @@ _aesni_gcm_encrypt: movl 12(%r8),%ebx leaq L$bswap_mask(%rip),%r11 leaq -128(%rcx),%r14 - movq $3968,%r15 + movq $0xf80,%r15 leaq 128(%rcx),%rcx vmovdqu (%r11),%xmm0 andq $-128,%rsp @@ -573,137 +573,137 @@ L$enc_no_key_aliasing: vmovdqu 48(%rsp),%xmm6 vmovdqu 16-32(%r9),%xmm0 vpunpckhqdq %xmm6,%xmm6,%xmm2 - vpclmulqdq $0,%xmm3,%xmm7,%xmm5 + vpclmulqdq $0x00,%xmm3,%xmm7,%xmm5 vpxor %xmm6,%xmm2,%xmm2 - vpclmulqdq $17,%xmm3,%xmm7,%xmm7 - vpclmulqdq $0,%xmm15,%xmm1,%xmm1 + vpclmulqdq $0x11,%xmm3,%xmm7,%xmm7 + vpclmulqdq $0x00,%xmm15,%xmm1,%xmm1 vmovdqu 64(%rsp),%xmm9 - vpclmulqdq $0,%xmm0,%xmm6,%xmm4 + vpclmulqdq $0x00,%xmm0,%xmm6,%xmm4 vmovdqu 48-32(%r9),%xmm3 vpxor %xmm5,%xmm4,%xmm4 vpunpckhqdq %xmm9,%xmm9,%xmm5 - vpclmulqdq $17,%xmm0,%xmm6,%xmm6 + vpclmulqdq $0x11,%xmm0,%xmm6,%xmm6 vpxor %xmm9,%xmm5,%xmm5 vpxor %xmm7,%xmm6,%xmm6 - vpclmulqdq $16,%xmm15,%xmm2,%xmm2 + vpclmulqdq $0x10,%xmm15,%xmm2,%xmm2 vmovdqu 80-32(%r9),%xmm15 vpxor %xmm1,%xmm2,%xmm2 vmovdqu 80(%rsp),%xmm1 - vpclmulqdq $0,%xmm3,%xmm9,%xmm7 + vpclmulqdq $0x00,%xmm3,%xmm9,%xmm7 vmovdqu 64-32(%r9),%xmm0 vpxor %xmm4,%xmm7,%xmm7 vpunpckhqdq %xmm1,%xmm1,%xmm4 - vpclmulqdq $17,%xmm3,%xmm9,%xmm9 + vpclmulqdq $0x11,%xmm3,%xmm9,%xmm9 vpxor %xmm1,%xmm4,%xmm4 vpxor %xmm6,%xmm9,%xmm9 - vpclmulqdq $0,%xmm15,%xmm5,%xmm5 + vpclmulqdq $0x00,%xmm15,%xmm5,%xmm5 vpxor %xmm2,%xmm5,%xmm5 vmovdqu 96(%rsp),%xmm2 - vpclmulqdq $0,%xmm0,%xmm1,%xmm6 + vpclmulqdq $0x00,%xmm0,%xmm1,%xmm6 vmovdqu 96-32(%r9),%xmm3 vpxor %xmm7,%xmm6,%xmm6 vpunpckhqdq %xmm2,%xmm2,%xmm7 - vpclmulqdq $17,%xmm0,%xmm1,%xmm1 + vpclmulqdq $0x11,%xmm0,%xmm1,%xmm1 vpxor %xmm2,%xmm7,%xmm7 vpxor %xmm9,%xmm1,%xmm1 - vpclmulqdq $16,%xmm15,%xmm4,%xmm4 + vpclmulqdq $0x10,%xmm15,%xmm4,%xmm4 vmovdqu 128-32(%r9),%xmm15 vpxor %xmm5,%xmm4,%xmm4 vpxor 112(%rsp),%xmm8,%xmm8 - vpclmulqdq $0,%xmm3,%xmm2,%xmm5 + vpclmulqdq $0x00,%xmm3,%xmm2,%xmm5 vmovdqu 112-32(%r9),%xmm0 vpunpckhqdq %xmm8,%xmm8,%xmm9 vpxor %xmm6,%xmm5,%xmm5 - vpclmulqdq $17,%xmm3,%xmm2,%xmm2 + vpclmulqdq $0x11,%xmm3,%xmm2,%xmm2 vpxor %xmm8,%xmm9,%xmm9 vpxor %xmm1,%xmm2,%xmm2 - vpclmulqdq $0,%xmm15,%xmm7,%xmm7 + vpclmulqdq $0x00,%xmm15,%xmm7,%xmm7 vpxor %xmm4,%xmm7,%xmm4 - vpclmulqdq $0,%xmm0,%xmm8,%xmm6 + vpclmulqdq $0x00,%xmm0,%xmm8,%xmm6 vmovdqu 0-32(%r9),%xmm3 vpunpckhqdq %xmm14,%xmm14,%xmm1 - vpclmulqdq $17,%xmm0,%xmm8,%xmm8 + vpclmulqdq $0x11,%xmm0,%xmm8,%xmm8 vpxor %xmm14,%xmm1,%xmm1 vpxor %xmm5,%xmm6,%xmm5 - vpclmulqdq $16,%xmm15,%xmm9,%xmm9 + vpclmulqdq $0x10,%xmm15,%xmm9,%xmm9 vmovdqu 32-32(%r9),%xmm15 vpxor %xmm2,%xmm8,%xmm7 vpxor %xmm4,%xmm9,%xmm6 vmovdqu 16-32(%r9),%xmm0 vpxor %xmm5,%xmm7,%xmm9 - vpclmulqdq $0,%xmm3,%xmm14,%xmm4 + vpclmulqdq $0x00,%xmm3,%xmm14,%xmm4 vpxor %xmm9,%xmm6,%xmm6 vpunpckhqdq %xmm13,%xmm13,%xmm2 - vpclmulqdq $17,%xmm3,%xmm14,%xmm14 + vpclmulqdq $0x11,%xmm3,%xmm14,%xmm14 vpxor %xmm13,%xmm2,%xmm2 vpslldq $8,%xmm6,%xmm9 - vpclmulqdq $0,%xmm15,%xmm1,%xmm1 + vpclmulqdq $0x00,%xmm15,%xmm1,%xmm1 vpxor %xmm9,%xmm5,%xmm8 vpsrldq $8,%xmm6,%xmm6 vpxor %xmm6,%xmm7,%xmm7 - vpclmulqdq $0,%xmm0,%xmm13,%xmm5 + vpclmulqdq $0x00,%xmm0,%xmm13,%xmm5 vmovdqu 48-32(%r9),%xmm3 vpxor %xmm4,%xmm5,%xmm5 vpunpckhqdq %xmm12,%xmm12,%xmm9 - vpclmulqdq $17,%xmm0,%xmm13,%xmm13 + vpclmulqdq $0x11,%xmm0,%xmm13,%xmm13 vpxor %xmm12,%xmm9,%xmm9 vpxor %xmm14,%xmm13,%xmm13 vpalignr $8,%xmm8,%xmm8,%xmm14 - vpclmulqdq $16,%xmm15,%xmm2,%xmm2 + vpclmulqdq $0x10,%xmm15,%xmm2,%xmm2 vmovdqu 80-32(%r9),%xmm15 vpxor %xmm1,%xmm2,%xmm2 - vpclmulqdq $0,%xmm3,%xmm12,%xmm4 + vpclmulqdq $0x00,%xmm3,%xmm12,%xmm4 vmovdqu 64-32(%r9),%xmm0 vpxor %xmm5,%xmm4,%xmm4 vpunpckhqdq %xmm11,%xmm11,%xmm1 - vpclmulqdq $17,%xmm3,%xmm12,%xmm12 + vpclmulqdq $0x11,%xmm3,%xmm12,%xmm12 vpxor %xmm11,%xmm1,%xmm1 vpxor %xmm13,%xmm12,%xmm12 vxorps 16(%rsp),%xmm7,%xmm7 - vpclmulqdq $0,%xmm15,%xmm9,%xmm9 + vpclmulqdq $0x00,%xmm15,%xmm9,%xmm9 vpxor %xmm2,%xmm9,%xmm9 - vpclmulqdq $16,16(%r11),%xmm8,%xmm8 + vpclmulqdq $0x10,16(%r11),%xmm8,%xmm8 vxorps %xmm14,%xmm8,%xmm8 - vpclmulqdq $0,%xmm0,%xmm11,%xmm5 + vpclmulqdq $0x00,%xmm0,%xmm11,%xmm5 vmovdqu 96-32(%r9),%xmm3 vpxor %xmm4,%xmm5,%xmm5 vpunpckhqdq %xmm10,%xmm10,%xmm2 - vpclmulqdq $17,%xmm0,%xmm11,%xmm11 + vpclmulqdq $0x11,%xmm0,%xmm11,%xmm11 vpxor %xmm10,%xmm2,%xmm2 vpalignr $8,%xmm8,%xmm8,%xmm14 vpxor %xmm12,%xmm11,%xmm11 - vpclmulqdq $16,%xmm15,%xmm1,%xmm1 + vpclmulqdq $0x10,%xmm15,%xmm1,%xmm1 vmovdqu 128-32(%r9),%xmm15 vpxor %xmm9,%xmm1,%xmm1 vxorps %xmm7,%xmm14,%xmm14 - vpclmulqdq $16,16(%r11),%xmm8,%xmm8 + vpclmulqdq $0x10,16(%r11),%xmm8,%xmm8 vxorps %xmm14,%xmm8,%xmm8 - vpclmulqdq $0,%xmm3,%xmm10,%xmm4 + vpclmulqdq $0x00,%xmm3,%xmm10,%xmm4 vmovdqu 112-32(%r9),%xmm0 vpxor %xmm5,%xmm4,%xmm4 vpunpckhqdq %xmm8,%xmm8,%xmm9 - vpclmulqdq $17,%xmm3,%xmm10,%xmm10 + vpclmulqdq $0x11,%xmm3,%xmm10,%xmm10 vpxor %xmm8,%xmm9,%xmm9 vpxor %xmm11,%xmm10,%xmm10 - vpclmulqdq $0,%xmm15,%xmm2,%xmm2 + vpclmulqdq $0x00,%xmm15,%xmm2,%xmm2 vpxor %xmm1,%xmm2,%xmm2 - vpclmulqdq $0,%xmm0,%xmm8,%xmm5 - vpclmulqdq $17,%xmm0,%xmm8,%xmm7 + vpclmulqdq $0x00,%xmm0,%xmm8,%xmm5 + vpclmulqdq $0x11,%xmm0,%xmm8,%xmm7 vpxor %xmm4,%xmm5,%xmm5 - vpclmulqdq $16,%xmm15,%xmm9,%xmm6 + vpclmulqdq $0x10,%xmm15,%xmm9,%xmm6 vpxor %xmm10,%xmm7,%xmm7 vpxor %xmm2,%xmm6,%xmm6 @@ -716,11 +716,11 @@ L$enc_no_key_aliasing: vpxor %xmm6,%xmm7,%xmm7 vpalignr $8,%xmm8,%xmm8,%xmm2 - vpclmulqdq $16,%xmm3,%xmm8,%xmm8 + vpclmulqdq $0x10,%xmm3,%xmm8,%xmm8 vpxor %xmm2,%xmm8,%xmm8 vpalignr $8,%xmm8,%xmm8,%xmm2 - vpclmulqdq $16,%xmm3,%xmm8,%xmm8 + vpclmulqdq $0x10,%xmm3,%xmm8,%xmm8 vpxor %xmm7,%xmm2,%xmm2 vpxor %xmm2,%xmm8,%xmm8 vpshufb (%r11),%xmm8,%xmm8 diff --git a/vendor/openssl/asm/x64-macosx-gas/modes/ghash-x86_64.s b/vendor/openssl/asm/x64-macosx-gas/modes/ghash-x86_64.s index 09ac73bc9..76f3b7cdf 100644 --- a/vendor/openssl/asm/x64-macosx-gas/modes/ghash-x86_64.s +++ b/vendor/openssl/asm/x64-macosx-gas/modes/ghash-x86_64.s @@ -20,14 +20,14 @@ L$gmult_prologue: movq $14,%rcx movq 8(%rsi,%rax,1),%r8 movq (%rsi,%rax,1),%r9 - andb $240,%bl + andb $0xf0,%bl movq %r8,%rdx jmp L$oop1 .p2align 4 L$oop1: shrq $4,%r8 - andq $15,%rdx + andq $0xf,%rdx movq %r9,%r10 movb (%rdi,%rcx,1),%al shrq $4,%r9 @@ -43,13 +43,13 @@ L$oop1: js L$break1 shrq $4,%r8 - andq $15,%rdx + andq $0xf,%rdx movq %r9,%r10 shrq $4,%r9 xorq 8(%rsi,%rax,1),%r8 shlq $60,%r10 xorq (%rsi,%rax,1),%r9 - andb $240,%bl + andb $0xf0,%bl xorq (%r11,%rdx,8),%r9 movq %r8,%rdx xorq %r10,%r8 @@ -58,19 +58,19 @@ L$oop1: .p2align 4 L$break1: shrq $4,%r8 - andq $15,%rdx + andq $0xf,%rdx movq %r9,%r10 shrq $4,%r9 xorq 8(%rsi,%rax,1),%r8 shlq $60,%r10 xorq (%rsi,%rax,1),%r9 - andb $240,%bl + andb $0xf0,%bl xorq (%r11,%rdx,8),%r9 movq %r8,%rdx xorq %r10,%r8 shrq $4,%r8 - andq $15,%rdx + andq $0xf,%rdx movq %r9,%r10 shrq $4,%r9 xorq 8(%rsi,%rbx,1),%r8 @@ -874,20 +874,20 @@ L$_ghash_clmul: movdqu 32(%rsi),%xmm7 .byte 102,65,15,56,0,194 - subq $16,%rcx + subq $0x10,%rcx jz L$odd_tail movdqu 16(%rsi),%xmm6 movl _OPENSSL_ia32cap_P+4(%rip),%eax - cmpq $48,%rcx + cmpq $0x30,%rcx jb L$skip4x andl $71303168,%eax cmpl $4194304,%eax je L$skip4x - subq $48,%rcx - movq $11547335547999543296,%rax + subq $0x30,%rcx + movq $0xA040608020C0E000,%rax movdqu 48(%rsi),%xmm14 movdqu 64(%rsi),%xmm15 @@ -934,7 +934,7 @@ L$_ghash_clmul: xorps %xmm13,%xmm5 leaq 64(%rdx),%rdx - subq $64,%rcx + subq $0x40,%rcx jc L$tail4x jmp L$mod4_loop @@ -1017,7 +1017,7 @@ L$mod4_loop: xorps %xmm13,%xmm5 leaq 64(%rdx),%rdx - subq $64,%rcx + subq $0x40,%rcx jnc L$mod4_loop L$tail4x: @@ -1061,10 +1061,10 @@ L$tail4x: pxor %xmm4,%xmm0 psrlq $1,%xmm0 pxor %xmm1,%xmm0 - addq $64,%rcx + addq $0x40,%rcx jz L$done movdqu 32(%rsi),%xmm7 - subq $16,%rcx + subq $0x10,%rcx jz L$odd_tail L$skip4x: @@ -1087,7 +1087,7 @@ L$skip4x: leaq 32(%rdx),%rdx nop - subq $32,%rcx + subq $0x20,%rcx jbe L$even_tail nop jmp L$mod_loop @@ -1150,7 +1150,7 @@ L$mod_loop: .byte 102,15,58,68,231,0 pxor %xmm1,%xmm0 - subq $32,%rcx + subq $0x20,%rcx ja L$mod_loop L$even_tail: @@ -1278,9 +1278,9 @@ L$init_loop_avx: vmovdqu %xmm5,-16(%rdi) vpunpckhqdq %xmm0,%xmm0,%xmm3 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $17,%xmm2,%xmm0,%xmm1 - vpclmulqdq $0,%xmm2,%xmm0,%xmm0 - vpclmulqdq $0,%xmm6,%xmm3,%xmm3 + vpclmulqdq $0x11,%xmm2,%xmm0,%xmm1 + vpclmulqdq $0x00,%xmm2,%xmm0,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm3,%xmm3 vpxor %xmm0,%xmm1,%xmm4 vpxor %xmm4,%xmm3,%xmm3 @@ -1309,9 +1309,9 @@ L$init_start_avx: vmovdqa %xmm0,%xmm5 vpunpckhqdq %xmm0,%xmm0,%xmm3 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $17,%xmm2,%xmm0,%xmm1 - vpclmulqdq $0,%xmm2,%xmm0,%xmm0 - vpclmulqdq $0,%xmm6,%xmm3,%xmm3 + vpclmulqdq $0x11,%xmm2,%xmm0,%xmm1 + vpclmulqdq $0x00,%xmm2,%xmm0,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm3,%xmm3 vpxor %xmm0,%xmm1,%xmm4 vpxor %xmm4,%xmm3,%xmm3 @@ -1369,9 +1369,9 @@ _gcm_ghash_avx: leaq 64(%rsi),%rsi vmovdqu L$bswap_mask(%rip),%xmm13 vpshufb %xmm13,%xmm10,%xmm10 - cmpq $128,%rcx + cmpq $0x80,%rcx jb L$short_avx - subq $128,%rcx + subq $0x80,%rcx vmovdqu 112(%rdx),%xmm14 vmovdqu 0-64(%rsi),%xmm6 @@ -1380,91 +1380,91 @@ _gcm_ghash_avx: vpunpckhqdq %xmm14,%xmm14,%xmm9 vmovdqu 96(%rdx),%xmm15 - vpclmulqdq $0,%xmm6,%xmm14,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm14,%xmm0 vpxor %xmm14,%xmm9,%xmm9 vpshufb %xmm13,%xmm15,%xmm15 - vpclmulqdq $17,%xmm6,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm14,%xmm1 vmovdqu 16-64(%rsi),%xmm6 vpunpckhqdq %xmm15,%xmm15,%xmm8 vmovdqu 80(%rdx),%xmm14 - vpclmulqdq $0,%xmm7,%xmm9,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm9,%xmm2 vpxor %xmm15,%xmm8,%xmm8 vpshufb %xmm13,%xmm14,%xmm14 - vpclmulqdq $0,%xmm6,%xmm15,%xmm3 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm3 vpunpckhqdq %xmm14,%xmm14,%xmm9 - vpclmulqdq $17,%xmm6,%xmm15,%xmm4 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm4 vmovdqu 48-64(%rsi),%xmm6 vpxor %xmm14,%xmm9,%xmm9 vmovdqu 64(%rdx),%xmm15 - vpclmulqdq $16,%xmm7,%xmm8,%xmm5 + vpclmulqdq $0x10,%xmm7,%xmm8,%xmm5 vmovdqu 80-64(%rsi),%xmm7 vpshufb %xmm13,%xmm15,%xmm15 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm14,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm14,%xmm0 vpxor %xmm1,%xmm4,%xmm4 vpunpckhqdq %xmm15,%xmm15,%xmm8 - vpclmulqdq $17,%xmm6,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm14,%xmm1 vmovdqu 64-64(%rsi),%xmm6 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm9,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm9,%xmm2 vpxor %xmm15,%xmm8,%xmm8 vmovdqu 48(%rdx),%xmm14 vpxor %xmm3,%xmm0,%xmm0 - vpclmulqdq $0,%xmm6,%xmm15,%xmm3 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm3 vpxor %xmm4,%xmm1,%xmm1 vpshufb %xmm13,%xmm14,%xmm14 - vpclmulqdq $17,%xmm6,%xmm15,%xmm4 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm4 vmovdqu 96-64(%rsi),%xmm6 vpxor %xmm5,%xmm2,%xmm2 vpunpckhqdq %xmm14,%xmm14,%xmm9 - vpclmulqdq $16,%xmm7,%xmm8,%xmm5 + vpclmulqdq $0x10,%xmm7,%xmm8,%xmm5 vmovdqu 128-64(%rsi),%xmm7 vpxor %xmm14,%xmm9,%xmm9 vmovdqu 32(%rdx),%xmm15 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm14,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm14,%xmm0 vpxor %xmm1,%xmm4,%xmm4 vpshufb %xmm13,%xmm15,%xmm15 - vpclmulqdq $17,%xmm6,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm14,%xmm1 vmovdqu 112-64(%rsi),%xmm6 vpxor %xmm2,%xmm5,%xmm5 vpunpckhqdq %xmm15,%xmm15,%xmm8 - vpclmulqdq $0,%xmm7,%xmm9,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm9,%xmm2 vpxor %xmm15,%xmm8,%xmm8 vmovdqu 16(%rdx),%xmm14 vpxor %xmm3,%xmm0,%xmm0 - vpclmulqdq $0,%xmm6,%xmm15,%xmm3 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm3 vpxor %xmm4,%xmm1,%xmm1 vpshufb %xmm13,%xmm14,%xmm14 - vpclmulqdq $17,%xmm6,%xmm15,%xmm4 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm4 vmovdqu 144-64(%rsi),%xmm6 vpxor %xmm5,%xmm2,%xmm2 vpunpckhqdq %xmm14,%xmm14,%xmm9 - vpclmulqdq $16,%xmm7,%xmm8,%xmm5 + vpclmulqdq $0x10,%xmm7,%xmm8,%xmm5 vmovdqu 176-64(%rsi),%xmm7 vpxor %xmm14,%xmm9,%xmm9 vmovdqu (%rdx),%xmm15 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm14,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm14,%xmm0 vpxor %xmm1,%xmm4,%xmm4 vpshufb %xmm13,%xmm15,%xmm15 - vpclmulqdq $17,%xmm6,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm14,%xmm1 vmovdqu 160-64(%rsi),%xmm6 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $16,%xmm7,%xmm9,%xmm2 + vpclmulqdq $0x10,%xmm7,%xmm9,%xmm2 leaq 128(%rdx),%rdx - cmpq $128,%rcx + cmpq $0x80,%rcx jb L$tail_avx vpxor %xmm10,%xmm15,%xmm15 - subq $128,%rcx + subq $0x80,%rcx jmp L$oop8x_avx .p2align 5 @@ -1473,36 +1473,36 @@ L$oop8x_avx: vmovdqu 112(%rdx),%xmm14 vpxor %xmm0,%xmm3,%xmm3 vpxor %xmm15,%xmm8,%xmm8 - vpclmulqdq $0,%xmm6,%xmm15,%xmm10 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm10 vpshufb %xmm13,%xmm14,%xmm14 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $17,%xmm6,%xmm15,%xmm11 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm11 vmovdqu 0-64(%rsi),%xmm6 vpunpckhqdq %xmm14,%xmm14,%xmm9 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm8,%xmm12 + vpclmulqdq $0x00,%xmm7,%xmm8,%xmm12 vmovdqu 32-64(%rsi),%xmm7 vpxor %xmm14,%xmm9,%xmm9 vmovdqu 96(%rdx),%xmm15 - vpclmulqdq $0,%xmm6,%xmm14,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm14,%xmm0 vpxor %xmm3,%xmm10,%xmm10 vpshufb %xmm13,%xmm15,%xmm15 - vpclmulqdq $17,%xmm6,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm14,%xmm1 vxorps %xmm4,%xmm11,%xmm11 vmovdqu 16-64(%rsi),%xmm6 vpunpckhqdq %xmm15,%xmm15,%xmm8 - vpclmulqdq $0,%xmm7,%xmm9,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm9,%xmm2 vpxor %xmm5,%xmm12,%xmm12 vxorps %xmm15,%xmm8,%xmm8 vmovdqu 80(%rdx),%xmm14 vpxor %xmm10,%xmm12,%xmm12 - vpclmulqdq $0,%xmm6,%xmm15,%xmm3 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm3 vpxor %xmm11,%xmm12,%xmm12 vpslldq $8,%xmm12,%xmm9 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $17,%xmm6,%xmm15,%xmm4 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm4 vpsrldq $8,%xmm12,%xmm12 vpxor %xmm9,%xmm10,%xmm10 vmovdqu 48-64(%rsi),%xmm6 @@ -1510,81 +1510,81 @@ L$oop8x_avx: vxorps %xmm12,%xmm11,%xmm11 vpxor %xmm1,%xmm4,%xmm4 vpunpckhqdq %xmm14,%xmm14,%xmm9 - vpclmulqdq $16,%xmm7,%xmm8,%xmm5 + vpclmulqdq $0x10,%xmm7,%xmm8,%xmm5 vmovdqu 80-64(%rsi),%xmm7 vpxor %xmm14,%xmm9,%xmm9 vpxor %xmm2,%xmm5,%xmm5 vmovdqu 64(%rdx),%xmm15 vpalignr $8,%xmm10,%xmm10,%xmm12 - vpclmulqdq $0,%xmm6,%xmm14,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm14,%xmm0 vpshufb %xmm13,%xmm15,%xmm15 vpxor %xmm3,%xmm0,%xmm0 - vpclmulqdq $17,%xmm6,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm14,%xmm1 vmovdqu 64-64(%rsi),%xmm6 vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm4,%xmm1,%xmm1 - vpclmulqdq $0,%xmm7,%xmm9,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm9,%xmm2 vxorps %xmm15,%xmm8,%xmm8 vpxor %xmm5,%xmm2,%xmm2 vmovdqu 48(%rdx),%xmm14 - vpclmulqdq $16,(%r10),%xmm10,%xmm10 - vpclmulqdq $0,%xmm6,%xmm15,%xmm3 + vpclmulqdq $0x10,(%r10),%xmm10,%xmm10 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm3 vpshufb %xmm13,%xmm14,%xmm14 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $17,%xmm6,%xmm15,%xmm4 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm4 vmovdqu 96-64(%rsi),%xmm6 vpunpckhqdq %xmm14,%xmm14,%xmm9 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $16,%xmm7,%xmm8,%xmm5 + vpclmulqdq $0x10,%xmm7,%xmm8,%xmm5 vmovdqu 128-64(%rsi),%xmm7 vpxor %xmm14,%xmm9,%xmm9 vpxor %xmm2,%xmm5,%xmm5 vmovdqu 32(%rdx),%xmm15 - vpclmulqdq $0,%xmm6,%xmm14,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm14,%xmm0 vpshufb %xmm13,%xmm15,%xmm15 vpxor %xmm3,%xmm0,%xmm0 - vpclmulqdq $17,%xmm6,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm14,%xmm1 vmovdqu 112-64(%rsi),%xmm6 vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm4,%xmm1,%xmm1 - vpclmulqdq $0,%xmm7,%xmm9,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm9,%xmm2 vpxor %xmm15,%xmm8,%xmm8 vpxor %xmm5,%xmm2,%xmm2 vxorps %xmm12,%xmm10,%xmm10 vmovdqu 16(%rdx),%xmm14 vpalignr $8,%xmm10,%xmm10,%xmm12 - vpclmulqdq $0,%xmm6,%xmm15,%xmm3 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm3 vpshufb %xmm13,%xmm14,%xmm14 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $17,%xmm6,%xmm15,%xmm4 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm4 vmovdqu 144-64(%rsi),%xmm6 - vpclmulqdq $16,(%r10),%xmm10,%xmm10 + vpclmulqdq $0x10,(%r10),%xmm10,%xmm10 vxorps %xmm11,%xmm12,%xmm12 vpunpckhqdq %xmm14,%xmm14,%xmm9 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $16,%xmm7,%xmm8,%xmm5 + vpclmulqdq $0x10,%xmm7,%xmm8,%xmm5 vmovdqu 176-64(%rsi),%xmm7 vpxor %xmm14,%xmm9,%xmm9 vpxor %xmm2,%xmm5,%xmm5 vmovdqu (%rdx),%xmm15 - vpclmulqdq $0,%xmm6,%xmm14,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm14,%xmm0 vpshufb %xmm13,%xmm15,%xmm15 - vpclmulqdq $17,%xmm6,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm14,%xmm1 vmovdqu 160-64(%rsi),%xmm6 vpxor %xmm12,%xmm15,%xmm15 - vpclmulqdq $16,%xmm7,%xmm9,%xmm2 + vpclmulqdq $0x10,%xmm7,%xmm9,%xmm2 vpxor %xmm10,%xmm15,%xmm15 leaq 128(%rdx),%rdx - subq $128,%rcx + subq $0x80,%rcx jnc L$oop8x_avx - addq $128,%rcx + addq $0x80,%rcx jmp L$tail_no_xor_avx .p2align 5 @@ -1598,97 +1598,97 @@ L$short_avx: vmovdqa %xmm0,%xmm3 vmovdqa %xmm1,%xmm4 vmovdqa %xmm2,%xmm5 - subq $16,%rcx + subq $0x10,%rcx jz L$tail_avx vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm15,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm0 vpxor %xmm15,%xmm8,%xmm8 vmovdqu -32(%rdx),%xmm14 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $17,%xmm6,%xmm15,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm1 vmovdqu 16-64(%rsi),%xmm6 vpshufb %xmm13,%xmm14,%xmm15 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm8,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm8,%xmm2 vpsrldq $8,%xmm7,%xmm7 - subq $16,%rcx + subq $0x10,%rcx jz L$tail_avx vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm15,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm0 vpxor %xmm15,%xmm8,%xmm8 vmovdqu -48(%rdx),%xmm14 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $17,%xmm6,%xmm15,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm1 vmovdqu 48-64(%rsi),%xmm6 vpshufb %xmm13,%xmm14,%xmm15 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm8,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm8,%xmm2 vmovdqu 80-64(%rsi),%xmm7 - subq $16,%rcx + subq $0x10,%rcx jz L$tail_avx vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm15,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm0 vpxor %xmm15,%xmm8,%xmm8 vmovdqu -64(%rdx),%xmm14 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $17,%xmm6,%xmm15,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm1 vmovdqu 64-64(%rsi),%xmm6 vpshufb %xmm13,%xmm14,%xmm15 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm8,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm8,%xmm2 vpsrldq $8,%xmm7,%xmm7 - subq $16,%rcx + subq $0x10,%rcx jz L$tail_avx vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm15,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm0 vpxor %xmm15,%xmm8,%xmm8 vmovdqu -80(%rdx),%xmm14 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $17,%xmm6,%xmm15,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm1 vmovdqu 96-64(%rsi),%xmm6 vpshufb %xmm13,%xmm14,%xmm15 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm8,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm8,%xmm2 vmovdqu 128-64(%rsi),%xmm7 - subq $16,%rcx + subq $0x10,%rcx jz L$tail_avx vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm15,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm0 vpxor %xmm15,%xmm8,%xmm8 vmovdqu -96(%rdx),%xmm14 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $17,%xmm6,%xmm15,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm1 vmovdqu 112-64(%rsi),%xmm6 vpshufb %xmm13,%xmm14,%xmm15 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm8,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm8,%xmm2 vpsrldq $8,%xmm7,%xmm7 - subq $16,%rcx + subq $0x10,%rcx jz L$tail_avx vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm15,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm0 vpxor %xmm15,%xmm8,%xmm8 vmovdqu -112(%rdx),%xmm14 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $17,%xmm6,%xmm15,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm1 vmovdqu 144-64(%rsi),%xmm6 vpshufb %xmm13,%xmm14,%xmm15 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm8,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm8,%xmm2 vmovq 184-64(%rsi),%xmm7 - subq $16,%rcx + subq $0x10,%rcx jmp L$tail_avx .p2align 5 @@ -1697,12 +1697,12 @@ L$tail_avx: L$tail_no_xor_avx: vpunpckhqdq %xmm15,%xmm15,%xmm8 vpxor %xmm0,%xmm3,%xmm3 - vpclmulqdq $0,%xmm6,%xmm15,%xmm0 + vpclmulqdq $0x00,%xmm6,%xmm15,%xmm0 vpxor %xmm15,%xmm8,%xmm8 vpxor %xmm1,%xmm4,%xmm4 - vpclmulqdq $17,%xmm6,%xmm15,%xmm1 + vpclmulqdq $0x11,%xmm6,%xmm15,%xmm1 vpxor %xmm2,%xmm5,%xmm5 - vpclmulqdq $0,%xmm7,%xmm8,%xmm2 + vpclmulqdq $0x00,%xmm7,%xmm8,%xmm2 vmovdqu (%r10),%xmm12 @@ -1717,11 +1717,11 @@ L$tail_no_xor_avx: vpxor %xmm9,%xmm10,%xmm10 vpxor %xmm5,%xmm11,%xmm11 - vpclmulqdq $16,%xmm12,%xmm10,%xmm9 + vpclmulqdq $0x10,%xmm12,%xmm10,%xmm9 vpalignr $8,%xmm10,%xmm10,%xmm10 vpxor %xmm9,%xmm10,%xmm10 - vpclmulqdq $16,%xmm12,%xmm10,%xmm9 + vpclmulqdq $0x10,%xmm12,%xmm10,%xmm9 vpalignr $8,%xmm10,%xmm10,%xmm10 vpxor %xmm11,%xmm10,%xmm10 vpxor %xmm9,%xmm10,%xmm10 diff --git a/vendor/openssl/asm/x64-macosx-gas/sha/sha1-mb-x86_64.s b/vendor/openssl/asm/x64-macosx-gas/sha/sha1-mb-x86_64.s index c164fc3c4..ac6ad9bb8 100644 --- a/vendor/openssl/asm/x64-macosx-gas/sha/sha1-mb-x86_64.s +++ b/vendor/openssl/asm/x64-macosx-gas/sha/sha1-mb-x86_64.s @@ -2859,8 +2859,8 @@ L$oop_shaext: .byte 69,15,58,204,193,3 .byte 69,15,56,200,214 - pshufd $0,%xmm6,%xmm11 - pshufd $85,%xmm6,%xmm12 + pshufd $0x00,%xmm6,%xmm11 + pshufd $0x55,%xmm6,%xmm12 movdqa %xmm6,%xmm7 pcmpgtd %xmm4,%xmm11 pcmpgtd %xmm4,%xmm12 diff --git a/vendor/openssl/asm/x64-macosx-gas/sha/sha256-mb-x86_64.s b/vendor/openssl/asm/x64-macosx-gas/sha/sha256-mb-x86_64.s index 77c24f1cf..897dacd5b 100644 --- a/vendor/openssl/asm/x64-macosx-gas/sha/sha256-mb-x86_64.s +++ b/vendor/openssl/asm/x64-macosx-gas/sha/sha256-mb-x86_64.s @@ -2714,11 +2714,11 @@ L$oop_shaext: movdqa %xmm2,%xmm0 movdqa %xmm15,112(%rsp) .byte 69,15,56,203,254 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 pxor %xmm12,%xmm4 movdqa %xmm12,64(%rsp) .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 pxor %xmm14,%xmm8 movdqa %xmm14,96(%rsp) movdqa 16-128(%rbp),%xmm1 @@ -2736,11 +2736,11 @@ L$oop_shaext: .byte 102,68,15,56,0,211 prefetcht0 127(%r9) .byte 69,15,56,203,254 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 .byte 102,68,15,56,0,219 .byte 15,56,204,229 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 32-128(%rbp),%xmm1 paddd %xmm6,%xmm1 .byte 69,15,56,203,247 @@ -2753,14 +2753,14 @@ L$oop_shaext: movdqa %xmm2,%xmm0 movdqa %xmm7,%xmm3 .byte 69,15,56,203,254 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 .byte 102,15,58,15,222,4 paddd %xmm3,%xmm4 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 .byte 15,56,204,238 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 48-128(%rbp),%xmm1 paddd %xmm7,%xmm1 .byte 69,15,56,203,247 @@ -2777,13 +2777,13 @@ L$oop_shaext: .byte 102,15,58,15,223,4 .byte 69,15,56,203,254 .byte 69,15,56,205,195 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm5 movdqa %xmm8,%xmm3 .byte 102,65,15,58,15,219,4 .byte 15,56,204,247 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 64-128(%rbp),%xmm1 paddd %xmm4,%xmm1 .byte 69,15,56,203,247 @@ -2799,13 +2799,13 @@ L$oop_shaext: .byte 102,15,58,15,220,4 .byte 69,15,56,203,254 .byte 69,15,56,205,200 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm6 movdqa %xmm9,%xmm3 .byte 102,65,15,58,15,216,4 .byte 15,56,204,252 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 80-128(%rbp),%xmm1 paddd %xmm5,%xmm1 .byte 69,15,56,203,247 @@ -2821,13 +2821,13 @@ L$oop_shaext: .byte 102,15,58,15,221,4 .byte 69,15,56,203,254 .byte 69,15,56,205,209 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm7 movdqa %xmm10,%xmm3 .byte 102,65,15,58,15,217,4 .byte 15,56,204,229 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 96-128(%rbp),%xmm1 paddd %xmm6,%xmm1 .byte 69,15,56,203,247 @@ -2843,13 +2843,13 @@ L$oop_shaext: .byte 102,15,58,15,222,4 .byte 69,15,56,203,254 .byte 69,15,56,205,218 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm4 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 .byte 15,56,204,238 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 112-128(%rbp),%xmm1 paddd %xmm7,%xmm1 .byte 69,15,56,203,247 @@ -2865,13 +2865,13 @@ L$oop_shaext: .byte 102,15,58,15,223,4 .byte 69,15,56,203,254 .byte 69,15,56,205,195 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm5 movdqa %xmm8,%xmm3 .byte 102,65,15,58,15,219,4 .byte 15,56,204,247 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 128-128(%rbp),%xmm1 paddd %xmm4,%xmm1 .byte 69,15,56,203,247 @@ -2887,13 +2887,13 @@ L$oop_shaext: .byte 102,15,58,15,220,4 .byte 69,15,56,203,254 .byte 69,15,56,205,200 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm6 movdqa %xmm9,%xmm3 .byte 102,65,15,58,15,216,4 .byte 15,56,204,252 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 144-128(%rbp),%xmm1 paddd %xmm5,%xmm1 .byte 69,15,56,203,247 @@ -2909,13 +2909,13 @@ L$oop_shaext: .byte 102,15,58,15,221,4 .byte 69,15,56,203,254 .byte 69,15,56,205,209 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm7 movdqa %xmm10,%xmm3 .byte 102,65,15,58,15,217,4 .byte 15,56,204,229 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 160-128(%rbp),%xmm1 paddd %xmm6,%xmm1 .byte 69,15,56,203,247 @@ -2931,13 +2931,13 @@ L$oop_shaext: .byte 102,15,58,15,222,4 .byte 69,15,56,203,254 .byte 69,15,56,205,218 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm4 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 .byte 15,56,204,238 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 176-128(%rbp),%xmm1 paddd %xmm7,%xmm1 .byte 69,15,56,203,247 @@ -2953,13 +2953,13 @@ L$oop_shaext: .byte 102,15,58,15,223,4 .byte 69,15,56,203,254 .byte 69,15,56,205,195 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm5 movdqa %xmm8,%xmm3 .byte 102,65,15,58,15,219,4 .byte 15,56,204,247 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 192-128(%rbp),%xmm1 paddd %xmm4,%xmm1 .byte 69,15,56,203,247 @@ -2975,13 +2975,13 @@ L$oop_shaext: .byte 102,15,58,15,220,4 .byte 69,15,56,203,254 .byte 69,15,56,205,200 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm6 movdqa %xmm9,%xmm3 .byte 102,65,15,58,15,216,4 .byte 15,56,204,252 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 208-128(%rbp),%xmm1 paddd %xmm5,%xmm1 .byte 69,15,56,203,247 @@ -2997,13 +2997,13 @@ L$oop_shaext: .byte 102,15,58,15,221,4 .byte 69,15,56,203,254 .byte 69,15,56,205,209 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm7 movdqa %xmm10,%xmm3 .byte 102,65,15,58,15,217,4 nop .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 224-128(%rbp),%xmm1 paddd %xmm6,%xmm1 .byte 69,15,56,203,247 @@ -3020,13 +3020,13 @@ L$oop_shaext: pxor %xmm6,%xmm6 .byte 69,15,56,203,254 .byte 69,15,56,205,218 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 movdqa 240-128(%rbp),%xmm1 paddd %xmm7,%xmm1 movq (%rbx),%xmm7 nop .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 240-128(%rbp),%xmm2 paddd %xmm11,%xmm2 .byte 69,15,56,203,247 @@ -3036,17 +3036,17 @@ L$oop_shaext: cmovgeq %rsp,%r8 cmpl 4(%rbx),%ecx cmovgeq %rsp,%r9 - pshufd $0,%xmm7,%xmm9 + pshufd $0x00,%xmm7,%xmm9 .byte 69,15,56,203,236 movdqa %xmm2,%xmm0 - pshufd $85,%xmm7,%xmm10 + pshufd $0x55,%xmm7,%xmm10 movdqa %xmm7,%xmm11 .byte 69,15,56,203,254 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 pcmpgtd %xmm6,%xmm9 pcmpgtd %xmm6,%xmm10 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 pcmpgtd %xmm6,%xmm11 movdqa K256_shaext-16(%rip),%xmm3 .byte 69,15,56,203,247 diff --git a/vendor/openssl/asm/x64-macosx-gas/sha/sha256-x86_64.s b/vendor/openssl/asm/x64-macosx-gas/sha/sha256-x86_64.s index b66bd3440..3cbe0a170 100644 --- a/vendor/openssl/asm/x64-macosx-gas/sha/sha256-x86_64.s +++ b/vendor/openssl/asm/x64-macosx-gas/sha/sha256-x86_64.s @@ -1762,9 +1762,9 @@ _shaext_shortcut: movdqu 16(%rdi),%xmm2 movdqa 512-128(%rcx),%xmm7 - pshufd $27,%xmm1,%xmm0 - pshufd $177,%xmm1,%xmm1 - pshufd $27,%xmm2,%xmm2 + pshufd $0x1b,%xmm1,%xmm0 + pshufd $0xb1,%xmm1,%xmm1 + pshufd $0x1b,%xmm2,%xmm2 movdqa %xmm7,%xmm8 .byte 102,15,58,15,202,8 punpcklqdq %xmm0,%xmm2 @@ -1783,7 +1783,7 @@ L$oop_shaext: .byte 102,15,56,0,231 movdqa %xmm2,%xmm10 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 nop movdqa %xmm1,%xmm9 .byte 15,56,203,202 @@ -1792,7 +1792,7 @@ L$oop_shaext: paddd %xmm4,%xmm0 .byte 102,15,56,0,239 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 leaq 64(%rsi),%rsi .byte 15,56,204,220 .byte 15,56,203,202 @@ -1801,7 +1801,7 @@ L$oop_shaext: paddd %xmm5,%xmm0 .byte 102,15,56,0,247 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm6,%xmm7 .byte 102,15,58,15,253,4 nop @@ -1813,7 +1813,7 @@ L$oop_shaext: paddd %xmm6,%xmm0 .byte 15,56,205,222 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm3,%xmm7 .byte 102,15,58,15,254,4 nop @@ -1824,7 +1824,7 @@ L$oop_shaext: paddd %xmm3,%xmm0 .byte 15,56,205,227 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm4,%xmm7 .byte 102,15,58,15,251,4 nop @@ -1835,7 +1835,7 @@ L$oop_shaext: paddd %xmm4,%xmm0 .byte 15,56,205,236 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm5,%xmm7 .byte 102,15,58,15,252,4 nop @@ -1846,7 +1846,7 @@ L$oop_shaext: paddd %xmm5,%xmm0 .byte 15,56,205,245 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm6,%xmm7 .byte 102,15,58,15,253,4 nop @@ -1857,7 +1857,7 @@ L$oop_shaext: paddd %xmm6,%xmm0 .byte 15,56,205,222 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm3,%xmm7 .byte 102,15,58,15,254,4 nop @@ -1868,7 +1868,7 @@ L$oop_shaext: paddd %xmm3,%xmm0 .byte 15,56,205,227 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm4,%xmm7 .byte 102,15,58,15,251,4 nop @@ -1879,7 +1879,7 @@ L$oop_shaext: paddd %xmm4,%xmm0 .byte 15,56,205,236 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm5,%xmm7 .byte 102,15,58,15,252,4 nop @@ -1890,7 +1890,7 @@ L$oop_shaext: paddd %xmm5,%xmm0 .byte 15,56,205,245 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm6,%xmm7 .byte 102,15,58,15,253,4 nop @@ -1901,7 +1901,7 @@ L$oop_shaext: paddd %xmm6,%xmm0 .byte 15,56,205,222 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm3,%xmm7 .byte 102,15,58,15,254,4 nop @@ -1912,7 +1912,7 @@ L$oop_shaext: paddd %xmm3,%xmm0 .byte 15,56,205,227 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm4,%xmm7 .byte 102,15,58,15,251,4 nop @@ -1923,7 +1923,7 @@ L$oop_shaext: paddd %xmm4,%xmm0 .byte 15,56,205,236 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm5,%xmm7 .byte 102,15,58,15,252,4 .byte 15,56,203,202 @@ -1932,7 +1932,7 @@ L$oop_shaext: movdqa 448-128(%rcx),%xmm0 paddd %xmm5,%xmm0 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 .byte 15,56,205,245 movdqa %xmm8,%xmm7 .byte 15,56,203,202 @@ -1941,7 +1941,7 @@ L$oop_shaext: paddd %xmm6,%xmm0 nop .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 decq %rdx nop .byte 15,56,203,202 @@ -1950,9 +1950,9 @@ L$oop_shaext: paddd %xmm9,%xmm1 jnz L$oop_shaext - pshufd $177,%xmm2,%xmm2 - pshufd $27,%xmm1,%xmm7 - pshufd $177,%xmm1,%xmm1 + pshufd $0xb1,%xmm2,%xmm2 + pshufd $0x1b,%xmm1,%xmm7 + pshufd $0xb1,%xmm1,%xmm1 punpckhqdq %xmm2,%xmm1 .byte 102,15,58,15,215,8 diff --git a/vendor/openssl/asm/x64-macosx-gas/x86_64cpuid.s b/vendor/openssl/asm/x64-macosx-gas/x86_64cpuid.s index 5d69baad8..ef623d596 100644 --- a/vendor/openssl/asm/x64-macosx-gas/x86_64cpuid.s +++ b/vendor/openssl/asm/x64-macosx-gas/x86_64cpuid.s @@ -45,43 +45,43 @@ _OPENSSL_ia32_cpuid: movl %eax,%r11d xorl %eax,%eax - cmpl $1970169159,%ebx + cmpl $0x756e6547,%ebx setne %al movl %eax,%r9d - cmpl $1231384169,%edx + cmpl $0x49656e69,%edx setne %al orl %eax,%r9d - cmpl $1818588270,%ecx + cmpl $0x6c65746e,%ecx setne %al orl %eax,%r9d jz L$intel - cmpl $1752462657,%ebx + cmpl $0x68747541,%ebx setne %al movl %eax,%r10d - cmpl $1769238117,%edx + cmpl $0x69746E65,%edx setne %al orl %eax,%r10d - cmpl $1145913699,%ecx + cmpl $0x444D4163,%ecx setne %al orl %eax,%r10d jnz L$intel - movl $2147483648,%eax + movl $0x80000000,%eax cpuid - cmpl $2147483649,%eax + cmpl $0x80000001,%eax jb L$intel movl %eax,%r10d - movl $2147483649,%eax + movl $0x80000001,%eax cpuid orl %ecx,%r9d - andl $2049,%r9d + andl $0x00000801,%r9d - cmpl $2147483656,%r10d + cmpl $0x80000008,%r10d jb L$intel - movl $2147483656,%eax + movl $0x80000008,%eax cpuid movzbq %cl,%r10 incq %r10 @@ -93,7 +93,7 @@ _OPENSSL_ia32_cpuid: shrl $16,%ebx cmpb %r10b,%bl ja L$generic - andl $4026531839,%edx + andl $0xefffffff,%edx jmp L$generic L$intel: @@ -106,7 +106,7 @@ L$intel: cpuid movl %eax,%r10d shrl $14,%r10d - andl $4095,%r10d + andl $0xfff,%r10d cmpl $7,%r11d jb L$nocacheinfo @@ -119,29 +119,29 @@ L$intel: L$nocacheinfo: movl $1,%eax cpuid - andl $3220176895,%edx + andl $0xbfefffff,%edx cmpl $0,%r9d jne L$notintel - orl $1073741824,%edx + orl $0x40000000,%edx andb $15,%ah cmpb $15,%ah jne L$notintel - orl $1048576,%edx + orl $0x00100000,%edx L$notintel: btl $28,%edx jnc L$generic - andl $4026531839,%edx + andl $0xefffffff,%edx cmpl $0,%r10d je L$generic - orl $268435456,%edx + orl $0x10000000,%edx shrl $16,%ebx cmpb $1,%bl ja L$generic - andl $4026531839,%edx + andl $0xefffffff,%edx L$generic: - andl $2048,%r9d - andl $4294965247,%ecx + andl $0x00000800,%r9d + andl $0xfffff7ff,%ecx orl %ecx,%r9d movl %edx,%r10d @@ -153,9 +153,9 @@ L$generic: cmpl $6,%eax je L$done L$clear_avx: - movl $4026525695,%eax + movl $0xefffe7ff,%eax andl %eax,%r9d - andl $4294967263,8(%rdi) + andl $0xffffffdf,8(%rdi) L$done: shlq $32,%r9 movl %r10d,%eax diff --git a/vendor/openssl/asm/x64-win32-masm/bn/rsaz-avx2.asm b/vendor/openssl/asm/x64-win32-masm/bn/rsaz-avx2.asm index 0d3107834..c24d0c5e6 100644 --- a/vendor/openssl/asm/x64-win32-masm/bn/rsaz-avx2.asm +++ b/vendor/openssl/asm/x64-win32-masm/bn/rsaz-avx2.asm @@ -1628,8 +1628,9 @@ PUBLIC rsaz_1024_gather5_avx2 ALIGN 32 rsaz_1024_gather5_avx2 PROC PUBLIC - lea rax,QWORD PTR[((-136))+rsp] vzeroupper + mov r11,rsp + lea rax,QWORD PTR[((-136))+rsp] $L$SEH_begin_rsaz_1024_gather5:: DB 048h,08dh,060h,0e0h @@ -1643,66 +1644,125 @@ DB 0c5h,078h,029h,060h,040h DB 0c5h,078h,029h,068h,050h DB 0c5h,078h,029h,070h,060h DB 0c5h,078h,029h,078h,070h - lea r11,QWORD PTR[$L$gather_table] - mov eax,r8d - and r8d,3 - shr eax,2 - shl r8d,4 - - vmovdqu ymm7,YMMWORD PTR[((-32))+r11] - vpbroadcastb xmm8,BYTE PTR[8+rax*1+r11] - vpbroadcastb xmm9,BYTE PTR[7+rax*1+r11] - vpbroadcastb xmm10,BYTE PTR[6+rax*1+r11] - vpbroadcastb xmm11,BYTE PTR[5+rax*1+r11] - vpbroadcastb xmm12,BYTE PTR[4+rax*1+r11] - vpbroadcastb xmm13,BYTE PTR[3+rax*1+r11] - vpbroadcastb xmm14,BYTE PTR[2+rax*1+r11] - vpbroadcastb xmm15,BYTE PTR[1+rax*1+r11] - - lea rdx,QWORD PTR[64+r8*1+rdx] - mov r11,64 - mov eax,9 - jmp $L$oop_gather_1024 + lea rsp,QWORD PTR[((-256))+rsp] + and rsp,-32 + lea r10,QWORD PTR[$L$inc] + lea rax,QWORD PTR[((-128))+rsp] + + vmovd xmm4,r8d + vmovdqa ymm0,YMMWORD PTR[r10] + vmovdqa ymm1,YMMWORD PTR[32+r10] + vmovdqa ymm5,YMMWORD PTR[64+r10] + vpbroadcastd ymm4,xmm4 + + vpaddd ymm2,ymm0,ymm5 + vpcmpeqd ymm0,ymm0,ymm4 + vpaddd ymm3,ymm1,ymm5 + vpcmpeqd ymm1,ymm1,ymm4 + vmovdqa YMMWORD PTR[(0+128)+rax],ymm0 + vpaddd ymm0,ymm2,ymm5 + vpcmpeqd ymm2,ymm2,ymm4 + vmovdqa YMMWORD PTR[(32+128)+rax],ymm1 + vpaddd ymm1,ymm3,ymm5 + vpcmpeqd ymm3,ymm3,ymm4 + vmovdqa YMMWORD PTR[(64+128)+rax],ymm2 + vpaddd ymm2,ymm0,ymm5 + vpcmpeqd ymm0,ymm0,ymm4 + vmovdqa YMMWORD PTR[(96+128)+rax],ymm3 + vpaddd ymm3,ymm1,ymm5 + vpcmpeqd ymm1,ymm1,ymm4 + vmovdqa YMMWORD PTR[(128+128)+rax],ymm0 + vpaddd ymm8,ymm2,ymm5 + vpcmpeqd ymm2,ymm2,ymm4 + vmovdqa YMMWORD PTR[(160+128)+rax],ymm1 + vpaddd ymm9,ymm3,ymm5 + vpcmpeqd ymm3,ymm3,ymm4 + vmovdqa YMMWORD PTR[(192+128)+rax],ymm2 + vpaddd ymm10,ymm8,ymm5 + vpcmpeqd ymm8,ymm8,ymm4 + vmovdqa YMMWORD PTR[(224+128)+rax],ymm3 + vpaddd ymm11,ymm9,ymm5 + vpcmpeqd ymm9,ymm9,ymm4 + vpaddd ymm12,ymm10,ymm5 + vpcmpeqd ymm10,ymm10,ymm4 + vpaddd ymm13,ymm11,ymm5 + vpcmpeqd ymm11,ymm11,ymm4 + vpaddd ymm14,ymm12,ymm5 + vpcmpeqd ymm12,ymm12,ymm4 + vpaddd ymm15,ymm13,ymm5 + vpcmpeqd ymm13,ymm13,ymm4 + vpcmpeqd ymm14,ymm14,ymm4 + vpcmpeqd ymm15,ymm15,ymm4 + + vmovdqa ymm7,YMMWORD PTR[((-32))+r10] + lea rdx,QWORD PTR[128+rdx] + mov r8d,9 -ALIGN 32 $L$oop_gather_1024:: - vpand xmm0,xmm8,XMMWORD PTR[((-64))+rdx] - vpand xmm1,xmm9,XMMWORD PTR[rdx] - vpand xmm2,xmm10,XMMWORD PTR[64+rdx] - vpand xmm3,xmm11,XMMWORD PTR[r11*2+rdx] - vpor xmm1,xmm1,xmm0 - vpand xmm4,xmm12,XMMWORD PTR[64+r11*2+rdx] - vpor xmm3,xmm3,xmm2 - vpand xmm5,xmm13,XMMWORD PTR[r11*4+rdx] - vpor xmm3,xmm3,xmm1 - vpand xmm6,xmm14,XMMWORD PTR[64+r11*4+rdx] + vmovdqa ymm0,YMMWORD PTR[((0-128))+rdx] + vmovdqa ymm1,YMMWORD PTR[((32-128))+rdx] + vmovdqa ymm2,YMMWORD PTR[((64-128))+rdx] + vmovdqa ymm3,YMMWORD PTR[((96-128))+rdx] + vpand ymm0,ymm0,YMMWORD PTR[((0+128))+rax] + vpand ymm1,ymm1,YMMWORD PTR[((32+128))+rax] + vpand ymm2,ymm2,YMMWORD PTR[((64+128))+rax] + vpor ymm4,ymm1,ymm0 + vpand ymm3,ymm3,YMMWORD PTR[((96+128))+rax] + vmovdqa ymm0,YMMWORD PTR[((128-128))+rdx] + vmovdqa ymm1,YMMWORD PTR[((160-128))+rdx] + vpor ymm5,ymm3,ymm2 + vmovdqa ymm2,YMMWORD PTR[((192-128))+rdx] + vmovdqa ymm3,YMMWORD PTR[((224-128))+rdx] + vpand ymm0,ymm0,YMMWORD PTR[((128+128))+rax] + vpand ymm1,ymm1,YMMWORD PTR[((160+128))+rax] + vpand ymm2,ymm2,YMMWORD PTR[((192+128))+rax] + vpor ymm4,ymm4,ymm0 + vpand ymm3,ymm3,YMMWORD PTR[((224+128))+rax] + vpand ymm0,ymm8,YMMWORD PTR[((256-128))+rdx] + vpor ymm5,ymm5,ymm1 + vpand ymm1,ymm9,YMMWORD PTR[((288-128))+rdx] + vpor ymm4,ymm4,ymm2 + vpand ymm2,ymm10,YMMWORD PTR[((320-128))+rdx] + vpor ymm5,ymm5,ymm3 + vpand ymm3,ymm11,YMMWORD PTR[((352-128))+rdx] + vpor ymm4,ymm4,ymm0 + vpand ymm0,ymm12,YMMWORD PTR[((384-128))+rdx] + vpor ymm5,ymm5,ymm1 + vpand ymm1,ymm13,YMMWORD PTR[((416-128))+rdx] + vpor ymm4,ymm4,ymm2 + vpand ymm2,ymm14,YMMWORD PTR[((448-128))+rdx] + vpor ymm5,ymm5,ymm3 + vpand ymm3,ymm15,YMMWORD PTR[((480-128))+rdx] + lea rdx,QWORD PTR[512+rdx] + vpor ymm4,ymm4,ymm0 + vpor ymm5,ymm5,ymm1 + vpor ymm4,ymm4,ymm2 + vpor ymm5,ymm5,ymm3 + + vpor ymm4,ymm4,ymm5 + vextracti128 xmm5,ymm4,1 vpor xmm5,xmm5,xmm4 - vpand xmm2,xmm15,XMMWORD PTR[((-128))+r11*8+rdx] - lea rdx,QWORD PTR[r11*8+rdx] - vpor xmm5,xmm5,xmm3 - vpor xmm6,xmm6,xmm2 - vpor xmm6,xmm6,xmm5 - vpermd ymm6,ymm7,ymm6 - vmovdqu YMMWORD PTR[rcx],ymm6 + vpermd ymm5,ymm7,ymm5 + vmovdqu YMMWORD PTR[rcx],ymm5 lea rcx,QWORD PTR[32+rcx] - dec eax + dec r8d jnz $L$oop_gather_1024 vpxor ymm0,ymm0,ymm0 vmovdqu YMMWORD PTR[rcx],ymm0 vzeroupper - movaps xmm6,XMMWORD PTR[rsp] - movaps xmm7,XMMWORD PTR[16+rsp] - movaps xmm8,XMMWORD PTR[32+rsp] - movaps xmm9,XMMWORD PTR[48+rsp] - movaps xmm10,XMMWORD PTR[64+rsp] - movaps xmm11,XMMWORD PTR[80+rsp] - movaps xmm12,XMMWORD PTR[96+rsp] - movaps xmm13,XMMWORD PTR[112+rsp] - movaps xmm14,XMMWORD PTR[128+rsp] - movaps xmm15,XMMWORD PTR[144+rsp] - lea rsp,QWORD PTR[168+rsp] + movaps xmm6,XMMWORD PTR[((-168))+r11] + movaps xmm7,XMMWORD PTR[((-152))+r11] + movaps xmm8,XMMWORD PTR[((-136))+r11] + movaps xmm9,XMMWORD PTR[((-120))+r11] + movaps xmm10,XMMWORD PTR[((-104))+r11] + movaps xmm11,XMMWORD PTR[((-88))+r11] + movaps xmm12,XMMWORD PTR[((-72))+r11] + movaps xmm13,XMMWORD PTR[((-56))+r11] + movaps xmm14,XMMWORD PTR[((-40))+r11] + movaps xmm15,XMMWORD PTR[((-24))+r11] $L$SEH_end_rsaz_1024_gather5:: + lea rsp,QWORD PTR[r11] DB 0F3h,0C3h ;repret rsaz_1024_gather5_avx2 ENDP EXTERN OPENSSL_ia32cap_P:NEAR @@ -1728,8 +1788,10 @@ $L$scatter_permd:: DD 0,2,4,6,7,7,7,7 $L$gather_permd:: DD 0,7,1,7,2,7,3,7 -$L$gather_table:: -DB 0,0,0,0,0,0,0,0,0ffh,0,0,0,0,0,0,0 +$L$inc:: + DD 0,0,0,0,1,1,1,1 + DD 2,2,2,2,3,3,3,3 + DD 4,4,4,4,4,4,4,4 ALIGN 64 EXTERN __imp_RtlVirtualUnwind:NEAR @@ -1850,7 +1912,7 @@ DB 9,0,0,0 DD imagerel rsaz_se_handler DD imagerel $L$mul_1024_body,imagerel $L$mul_1024_epilogue $L$SEH_info_rsaz_1024_gather5:: -DB 001h,033h,016h,000h +DB 001h,036h,017h,00bh DB 036h,0f8h,009h,000h DB 031h,0e8h,008h,000h DB 02ch,0d8h,007h,000h @@ -1862,6 +1924,7 @@ DB 013h,088h,002h,000h DB 00eh,078h,001h,000h DB 009h,068h,000h,000h DB 004h,001h,015h,000h +DB 000h,0b3h,000h,000h .xdata ENDS END diff --git a/vendor/openssl/asm/x64-win32-masm/bn/rsaz-x86_64.asm b/vendor/openssl/asm/x64-win32-masm/bn/rsaz-x86_64.asm index 1c6440470..e431b6209 100644 --- a/vendor/openssl/asm/x64-win32-masm/bn/rsaz-x86_64.asm +++ b/vendor/openssl/asm/x64-win32-masm/bn/rsaz-x86_64.asm @@ -803,52 +803,108 @@ $L$SEH_begin_rsaz_512_mul_gather4:: push r14 push r15 - mov r9d,r9d - sub rsp,128+24 + sub rsp,328 + movaps XMMWORD PTR[160+rsp],xmm6 + movaps XMMWORD PTR[176+rsp],xmm7 + movaps XMMWORD PTR[192+rsp],xmm8 + movaps XMMWORD PTR[208+rsp],xmm9 + movaps XMMWORD PTR[224+rsp],xmm10 + movaps XMMWORD PTR[240+rsp],xmm11 + movaps XMMWORD PTR[256+rsp],xmm12 + movaps XMMWORD PTR[272+rsp],xmm13 + movaps XMMWORD PTR[288+rsp],xmm14 + movaps XMMWORD PTR[304+rsp],xmm15 $L$mul_gather4_body:: + movd xmm8,r9d + movdqa xmm1,XMMWORD PTR[(($L$inc+16))] + movdqa xmm0,XMMWORD PTR[$L$inc] + + pshufd xmm8,xmm8,0 + movdqa xmm7,xmm1 + movdqa xmm2,xmm1 + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm8 + movdqa xmm3,xmm7 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm8 + movdqa xmm4,xmm7 + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm8 + movdqa xmm5,xmm7 + paddd xmm4,xmm3 + pcmpeqd xmm3,xmm8 + movdqa xmm6,xmm7 + paddd xmm5,xmm4 + pcmpeqd xmm4,xmm8 + paddd xmm6,xmm5 + pcmpeqd xmm5,xmm8 + paddd xmm7,xmm6 + pcmpeqd xmm6,xmm8 + pcmpeqd xmm7,xmm8 + + movdqa xmm8,XMMWORD PTR[rdx] + movdqa xmm9,XMMWORD PTR[16+rdx] + movdqa xmm10,XMMWORD PTR[32+rdx] + movdqa xmm11,XMMWORD PTR[48+rdx] + pand xmm8,xmm0 + movdqa xmm12,XMMWORD PTR[64+rdx] + pand xmm9,xmm1 + movdqa xmm13,XMMWORD PTR[80+rdx] + pand xmm10,xmm2 + movdqa xmm14,XMMWORD PTR[96+rdx] + pand xmm11,xmm3 + movdqa xmm15,XMMWORD PTR[112+rdx] + lea rbp,QWORD PTR[128+rdx] + pand xmm12,xmm4 + pand xmm13,xmm5 + pand xmm14,xmm6 + pand xmm15,xmm7 + por xmm8,xmm10 + por xmm9,xmm11 + por xmm8,xmm12 + por xmm9,xmm13 + por xmm8,xmm14 + por xmm9,xmm15 + + por xmm8,xmm9 + pshufd xmm9,xmm8,04eh + por xmm8,xmm9 mov r11d,080100h and r11d,DWORD PTR[((OPENSSL_ia32cap_P+8))] cmp r11d,080100h je $L$mulx_gather - mov eax,DWORD PTR[64+r9*4+rdx] -DB 102,72,15,110,199 - mov ebx,DWORD PTR[r9*4+rdx] -DB 102,72,15,110,201 +DB 102,76,15,126,195 + mov QWORD PTR[128+rsp],r8 + mov QWORD PTR[((128+8))+rsp],rdi + mov QWORD PTR[((128+16))+rsp],rcx - shl rax,32 - or rbx,rax mov rax,QWORD PTR[rsi] mov rcx,QWORD PTR[8+rsi] - lea rbp,QWORD PTR[128+r9*4+rdx] mul rbx mov QWORD PTR[rsp],rax mov rax,rcx mov r8,rdx mul rbx - movd xmm4,DWORD PTR[rbp] add r8,rax mov rax,QWORD PTR[16+rsi] mov r9,rdx adc r9,0 mul rbx - movd xmm5,DWORD PTR[64+rbp] add r9,rax mov rax,QWORD PTR[24+rsi] mov r10,rdx adc r10,0 mul rbx - pslldq xmm5,4 add r10,rax mov rax,QWORD PTR[32+rsi] mov r11,rdx adc r11,0 mul rbx - por xmm4,xmm5 add r11,rax mov rax,QWORD PTR[40+rsi] mov r12,rdx @@ -861,14 +917,12 @@ DB 102,72,15,110,201 adc r13,0 mul rbx - lea rbp,QWORD PTR[128+rbp] add r13,rax mov rax,QWORD PTR[56+rsi] mov r14,rdx adc r14,0 mul rbx -DB 102,72,15,126,227 add r14,rax mov rax,QWORD PTR[rsi] mov r15,rdx @@ -880,6 +934,35 @@ DB 102,72,15,126,227 ALIGN 32 $L$oop_mul_gather:: + movdqa xmm8,XMMWORD PTR[rbp] + movdqa xmm9,XMMWORD PTR[16+rbp] + movdqa xmm10,XMMWORD PTR[32+rbp] + movdqa xmm11,XMMWORD PTR[48+rbp] + pand xmm8,xmm0 + movdqa xmm12,XMMWORD PTR[64+rbp] + pand xmm9,xmm1 + movdqa xmm13,XMMWORD PTR[80+rbp] + pand xmm10,xmm2 + movdqa xmm14,XMMWORD PTR[96+rbp] + pand xmm11,xmm3 + movdqa xmm15,XMMWORD PTR[112+rbp] + lea rbp,QWORD PTR[128+rbp] + pand xmm12,xmm4 + pand xmm13,xmm5 + pand xmm14,xmm6 + pand xmm15,xmm7 + por xmm8,xmm10 + por xmm9,xmm11 + por xmm8,xmm12 + por xmm9,xmm13 + por xmm8,xmm14 + por xmm9,xmm15 + + por xmm8,xmm9 + pshufd xmm9,xmm8,04eh + por xmm8,xmm9 +DB 102,76,15,126,195 + mul rbx add r8,rax mov rax,QWORD PTR[8+rsi] @@ -888,7 +971,6 @@ $L$oop_mul_gather:: adc r8,0 mul rbx - movd xmm4,DWORD PTR[rbp] add r9,rax mov rax,QWORD PTR[16+rsi] adc rdx,0 @@ -897,7 +979,6 @@ $L$oop_mul_gather:: adc r9,0 mul rbx - movd xmm5,DWORD PTR[64+rbp] add r10,rax mov rax,QWORD PTR[24+rsi] adc rdx,0 @@ -906,7 +987,6 @@ $L$oop_mul_gather:: adc r10,0 mul rbx - pslldq xmm5,4 add r11,rax mov rax,QWORD PTR[32+rsi] adc rdx,0 @@ -915,7 +995,6 @@ $L$oop_mul_gather:: adc r11,0 mul rbx - por xmm4,xmm5 add r12,rax mov rax,QWORD PTR[40+rsi] adc rdx,0 @@ -940,7 +1019,6 @@ $L$oop_mul_gather:: adc r14,0 mul rbx -DB 102,72,15,126,227 add r15,rax mov rax,QWORD PTR[rsi] adc rdx,0 @@ -948,7 +1026,6 @@ DB 102,72,15,126,227 mov r15,rdx adc r15,0 - lea rbp,QWORD PTR[128+rbp] lea rdi,QWORD PTR[8+rdi] dec ecx @@ -963,8 +1040,8 @@ DB 102,72,15,126,227 mov QWORD PTR[48+rdi],r14 mov QWORD PTR[56+rdi],r15 -DB 102,72,15,126,199 -DB 102,72,15,126,205 + mov rdi,QWORD PTR[((128+8))+rsp] + mov rbp,QWORD PTR[((128+16))+rsp] mov r8,QWORD PTR[rsp] mov r9,QWORD PTR[8+rsp] @@ -980,45 +1057,37 @@ DB 102,72,15,126,205 ALIGN 32 $L$mulx_gather:: - mov eax,DWORD PTR[64+r9*4+rdx] -DB 102,72,15,110,199 - lea rbp,QWORD PTR[128+r9*4+rdx] - mov edx,DWORD PTR[r9*4+rdx] -DB 102,72,15,110,201 +DB 102,76,15,126,194 + mov QWORD PTR[128+rsp],r8 + mov QWORD PTR[((128+8))+rsp],rdi + mov QWORD PTR[((128+16))+rsp],rcx - shl rax,32 - or rdx,rax mulx r8,rbx,QWORD PTR[rsi] mov QWORD PTR[rsp],rbx xor edi,edi mulx r9,rax,QWORD PTR[8+rsi] - movd xmm4,DWORD PTR[rbp] mulx r10,rbx,QWORD PTR[16+rsi] - movd xmm5,DWORD PTR[64+rbp] adcx r8,rax mulx r11,rax,QWORD PTR[24+rsi] - pslldq xmm5,4 adcx r9,rbx mulx r12,rbx,QWORD PTR[32+rsi] - por xmm4,xmm5 adcx r10,rax mulx r13,rax,QWORD PTR[40+rsi] adcx r11,rbx mulx r14,rbx,QWORD PTR[48+rsi] - lea rbp,QWORD PTR[128+rbp] adcx r12,rax mulx r15,rax,QWORD PTR[56+rsi] -DB 102,72,15,126,226 adcx r13,rbx adcx r14,rax +DB 067h mov rbx,r8 adcx r15,rdi @@ -1027,24 +1096,48 @@ DB 102,72,15,126,226 ALIGN 32 $L$oop_mulx_gather:: - mulx r8,rax,QWORD PTR[rsi] + movdqa xmm8,XMMWORD PTR[rbp] + movdqa xmm9,XMMWORD PTR[16+rbp] + movdqa xmm10,XMMWORD PTR[32+rbp] + movdqa xmm11,XMMWORD PTR[48+rbp] + pand xmm8,xmm0 + movdqa xmm12,XMMWORD PTR[64+rbp] + pand xmm9,xmm1 + movdqa xmm13,XMMWORD PTR[80+rbp] + pand xmm10,xmm2 + movdqa xmm14,XMMWORD PTR[96+rbp] + pand xmm11,xmm3 + movdqa xmm15,XMMWORD PTR[112+rbp] + lea rbp,QWORD PTR[128+rbp] + pand xmm12,xmm4 + pand xmm13,xmm5 + pand xmm14,xmm6 + pand xmm15,xmm7 + por xmm8,xmm10 + por xmm9,xmm11 + por xmm8,xmm12 + por xmm9,xmm13 + por xmm8,xmm14 + por xmm9,xmm15 + + por xmm8,xmm9 + pshufd xmm9,xmm8,04eh + por xmm8,xmm9 +DB 102,76,15,126,194 + +DB 0c4h,062h,0fbh,0f6h,086h,000h,000h,000h,000h adcx rbx,rax adox r8,r9 mulx r9,rax,QWORD PTR[8+rsi] -DB 066h,00fh,06eh,0a5h,000h,000h,000h,000h adcx r8,rax adox r9,r10 mulx r10,rax,QWORD PTR[16+rsi] - movd xmm5,DWORD PTR[64+rbp] - lea rbp,QWORD PTR[128+rbp] adcx r9,rax adox r10,r11 DB 0c4h,062h,0fbh,0f6h,09eh,018h,000h,000h,000h - pslldq xmm5,4 - por xmm4,xmm5 adcx r10,rax adox r11,r12 @@ -1058,10 +1151,10 @@ DB 0c4h,062h,0fbh,0f6h,09eh,018h,000h,000h,000h DB 0c4h,062h,0fbh,0f6h,0b6h,030h,000h,000h,000h adcx r13,rax +DB 067h adox r14,r15 mulx r15,rax,QWORD PTR[56+rsi] -DB 102,72,15,126,226 mov QWORD PTR[64+rcx*8+rsp],rbx adcx r14,rax adox r15,rdi @@ -1080,10 +1173,10 @@ DB 102,72,15,126,226 mov QWORD PTR[((64+48))+rsp],r14 mov QWORD PTR[((64+56))+rsp],r15 -DB 102,72,15,126,199 -DB 102,72,15,126,205 - mov rdx,QWORD PTR[128+rsp] + mov rdi,QWORD PTR[((128+8))+rsp] + mov rbp,QWORD PTR[((128+16))+rsp] + mov r8,QWORD PTR[rsp] mov r9,QWORD PTR[8+rsp] mov r10,QWORD PTR[16+rsp] @@ -1109,6 +1202,17 @@ $L$mul_gather_tail:: call __rsaz_512_subtract lea rax,QWORD PTR[((128+24+48))+rsp] + movaps xmm6,XMMWORD PTR[((160-200))+rax] + movaps xmm7,XMMWORD PTR[((176-200))+rax] + movaps xmm8,XMMWORD PTR[((192-200))+rax] + movaps xmm9,XMMWORD PTR[((208-200))+rax] + movaps xmm10,XMMWORD PTR[((224-200))+rax] + movaps xmm11,XMMWORD PTR[((240-200))+rax] + movaps xmm12,XMMWORD PTR[((256-200))+rax] + movaps xmm13,XMMWORD PTR[((272-200))+rax] + movaps xmm14,XMMWORD PTR[((288-200))+rax] + movaps xmm15,XMMWORD PTR[((304-200))+rax] + lea rax,QWORD PTR[176+rax] mov r15,QWORD PTR[((-48))+rax] mov r14,QWORD PTR[((-40))+rax] mov r13,QWORD PTR[((-32))+rax] @@ -1148,7 +1252,7 @@ $L$SEH_begin_rsaz_512_mul_scatter4:: mov r9d,r9d sub rsp,128+24 $L$mul_scatter4_body:: - lea r8,QWORD PTR[r9*4+r8] + lea r8,QWORD PTR[r9*8+r8] DB 102,72,15,110,199 DB 102,72,15,110,202 DB 102,73,15,110,208 @@ -1211,30 +1315,14 @@ DB 102,72,15,126,214 call __rsaz_512_subtract - mov DWORD PTR[rsi],r8d - shr r8,32 - mov DWORD PTR[128+rsi],r9d - shr r9,32 - mov DWORD PTR[256+rsi],r10d - shr r10,32 - mov DWORD PTR[384+rsi],r11d - shr r11,32 - mov DWORD PTR[512+rsi],r12d - shr r12,32 - mov DWORD PTR[640+rsi],r13d - shr r13,32 - mov DWORD PTR[768+rsi],r14d - shr r14,32 - mov DWORD PTR[896+rsi],r15d - shr r15,32 - mov DWORD PTR[64+rsi],r8d - mov DWORD PTR[192+rsi],r9d - mov DWORD PTR[320+rsi],r10d - mov DWORD PTR[448+rsi],r11d - mov DWORD PTR[576+rsi],r12d - mov DWORD PTR[704+rsi],r13d - mov DWORD PTR[832+rsi],r14d - mov DWORD PTR[960+rsi],r15d + mov QWORD PTR[rsi],r8 + mov QWORD PTR[128+rsi],r9 + mov QWORD PTR[256+rsi],r10 + mov QWORD PTR[384+rsi],r11 + mov QWORD PTR[512+rsi],r12 + mov QWORD PTR[640+rsi],r13 + mov QWORD PTR[768+rsi],r14 + mov QWORD PTR[896+rsi],r15 lea rax,QWORD PTR[((128+24+48))+rsp] mov r15,QWORD PTR[((-48))+rax] @@ -1789,16 +1877,14 @@ PUBLIC rsaz_512_scatter4 ALIGN 16 rsaz_512_scatter4 PROC PUBLIC - lea rcx,QWORD PTR[r8*4+rcx] + lea rcx,QWORD PTR[r8*8+rcx] mov r9d,8 jmp $L$oop_scatter ALIGN 16 $L$oop_scatter:: mov rax,QWORD PTR[rdx] lea rdx,QWORD PTR[8+rdx] - mov DWORD PTR[rcx],eax - shr rax,32 - mov DWORD PTR[64+rcx],eax + mov QWORD PTR[rcx],rax lea rcx,QWORD PTR[128+rcx] dec r9d jnz $L$oop_scatter @@ -1809,22 +1895,98 @@ PUBLIC rsaz_512_gather4 ALIGN 16 rsaz_512_gather4 PROC PUBLIC - lea rdx,QWORD PTR[r8*4+rdx] +$L$SEH_begin_rsaz_512_gather4:: +DB 048h,081h,0ech,0a8h,000h,000h,000h +DB 00fh,029h,034h,024h +DB 00fh,029h,07ch,024h,010h +DB 044h,00fh,029h,044h,024h,020h +DB 044h,00fh,029h,04ch,024h,030h +DB 044h,00fh,029h,054h,024h,040h +DB 044h,00fh,029h,05ch,024h,050h +DB 044h,00fh,029h,064h,024h,060h +DB 044h,00fh,029h,06ch,024h,070h +DB 044h,00fh,029h,0b4h,024h,080h,0,0,0 +DB 044h,00fh,029h,0bch,024h,090h,0,0,0 + movd xmm8,r8d + movdqa xmm1,XMMWORD PTR[(($L$inc+16))] + movdqa xmm0,XMMWORD PTR[$L$inc] + + pshufd xmm8,xmm8,0 + movdqa xmm7,xmm1 + movdqa xmm2,xmm1 + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm8 + movdqa xmm3,xmm7 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm8 + movdqa xmm4,xmm7 + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm8 + movdqa xmm5,xmm7 + paddd xmm4,xmm3 + pcmpeqd xmm3,xmm8 + movdqa xmm6,xmm7 + paddd xmm5,xmm4 + pcmpeqd xmm4,xmm8 + paddd xmm6,xmm5 + pcmpeqd xmm5,xmm8 + paddd xmm7,xmm6 + pcmpeqd xmm6,xmm8 + pcmpeqd xmm7,xmm8 mov r9d,8 jmp $L$oop_gather ALIGN 16 $L$oop_gather:: - mov eax,DWORD PTR[rdx] - mov r8d,DWORD PTR[64+rdx] + movdqa xmm8,XMMWORD PTR[rdx] + movdqa xmm9,XMMWORD PTR[16+rdx] + movdqa xmm10,XMMWORD PTR[32+rdx] + movdqa xmm11,XMMWORD PTR[48+rdx] + pand xmm8,xmm0 + movdqa xmm12,XMMWORD PTR[64+rdx] + pand xmm9,xmm1 + movdqa xmm13,XMMWORD PTR[80+rdx] + pand xmm10,xmm2 + movdqa xmm14,XMMWORD PTR[96+rdx] + pand xmm11,xmm3 + movdqa xmm15,XMMWORD PTR[112+rdx] lea rdx,QWORD PTR[128+rdx] - shl r8,32 - or rax,r8 - mov QWORD PTR[rcx],rax + pand xmm12,xmm4 + pand xmm13,xmm5 + pand xmm14,xmm6 + pand xmm15,xmm7 + por xmm8,xmm10 + por xmm9,xmm11 + por xmm8,xmm12 + por xmm9,xmm13 + por xmm8,xmm14 + por xmm9,xmm15 + + por xmm8,xmm9 + pshufd xmm9,xmm8,04eh + por xmm8,xmm9 + movq QWORD PTR[rcx],xmm8 lea rcx,QWORD PTR[8+rcx] dec r9d jnz $L$oop_gather + movaps xmm6,XMMWORD PTR[rsp] + movaps xmm7,XMMWORD PTR[16+rsp] + movaps xmm8,XMMWORD PTR[32+rsp] + movaps xmm9,XMMWORD PTR[48+rsp] + movaps xmm10,XMMWORD PTR[64+rsp] + movaps xmm11,XMMWORD PTR[80+rsp] + movaps xmm12,XMMWORD PTR[96+rsp] + movaps xmm13,XMMWORD PTR[112+rsp] + movaps xmm14,XMMWORD PTR[128+rsp] + movaps xmm15,XMMWORD PTR[144+rsp] + add rsp,0a8h DB 0F3h,0C3h ;repret +$L$SEH_end_rsaz_512_gather4:: rsaz_512_gather4 ENDP + +ALIGN 64 +$L$inc:: + DD 0,0,1,1 + DD 2,2,2,2 EXTERN __imp_RtlVirtualUnwind:NEAR ALIGN 16 @@ -1860,6 +2022,18 @@ se_handler PROC PRIVATE lea rax,QWORD PTR[((128+24+48))+rax] + lea rbx,QWORD PTR[$L$mul_gather4_epilogue] + cmp rbx,r10 + jne $L$se_not_in_mul_gather4 + + lea rax,QWORD PTR[176+rax] + + lea rsi,QWORD PTR[((-48-168))+rax] + lea rdi,QWORD PTR[512+r8] + mov ecx,20 + DD 0a548f3fch + +$L$se_not_in_mul_gather4:: mov rbx,QWORD PTR[((-8))+rax] mov rbp,QWORD PTR[((-16))+rax] mov r12,QWORD PTR[((-24))+rax] @@ -1936,6 +2110,10 @@ ALIGN 4 DD imagerel $L$SEH_end_rsaz_512_mul_by_one DD imagerel $L$SEH_info_rsaz_512_mul_by_one + DD imagerel $L$SEH_begin_rsaz_512_gather4 + DD imagerel $L$SEH_end_rsaz_512_gather4 + DD imagerel $L$SEH_info_rsaz_512_gather4 + .pdata ENDS .xdata SEGMENT READONLY ALIGN(8) ALIGN 8 @@ -1959,6 +2137,19 @@ $L$SEH_info_rsaz_512_mul_by_one:: DB 9,0,0,0 DD imagerel se_handler DD imagerel $L$mul_by_one_body,imagerel $L$mul_by_one_epilogue +$L$SEH_info_rsaz_512_gather4:: +DB 001h,046h,016h,000h +DB 046h,0f8h,009h,000h +DB 03dh,0e8h,008h,000h +DB 034h,0d8h,007h,000h +DB 02eh,0c8h,006h,000h +DB 028h,0b8h,005h,000h +DB 022h,0a8h,004h,000h +DB 01ch,098h,003h,000h +DB 016h,088h,002h,000h +DB 010h,078h,001h,000h +DB 00bh,068h,000h,000h +DB 007h,001h,015h,000h .xdata ENDS END diff --git a/vendor/openssl/asm/x64-win32-masm/bn/x86_64-mont.asm b/vendor/openssl/asm/x64-win32-masm/bn/x86_64-mont.asm index f25274506..ccc591b7c 100644 --- a/vendor/openssl/asm/x64-win32-masm/bn/x86_64-mont.asm +++ b/vendor/openssl/asm/x64-win32-masm/bn/x86_64-mont.asm @@ -48,6 +48,20 @@ $L$mul_enter:: mov QWORD PTR[8+r9*8+rsp],r11 $L$mul_body:: + + + + + + + sub r11,rsp + and r11,-4096 +$L$mul_page_walk:: + mov r10,QWORD PTR[r11*1+rsp] + sub r11,4096 +DB 066h,02eh + jnc $L$mul_page_walk + mov r12,rdx mov r8,QWORD PTR[r8] mov rbx,QWORD PTR[r12] @@ -263,6 +277,14 @@ $L$mul4x_enter:: mov QWORD PTR[8+r9*8+rsp],r11 $L$mul4x_body:: + sub r11,rsp + and r11,-4096 +$L$mul4x_page_walk:: + mov r10,QWORD PTR[r11*1+rsp] + sub r11,4096 +DB 02eh + jnc $L$mul4x_page_walk + mov QWORD PTR[16+r9*8+rsp],rdi mov r12,rdx mov r8,QWORD PTR[r8] @@ -681,96 +703,131 @@ $L$sqr8x_enter:: - lea r11,QWORD PTR[((-64))+r9*4+rsp] + lea r11,QWORD PTR[((-64))+r9*2+rsp] mov r8,QWORD PTR[r8] sub r11,rsi and r11,4095 cmp r10,r11 jb $L$sqr8x_sp_alt sub rsp,r11 - lea rsp,QWORD PTR[((-64))+r9*4+rsp] + lea rsp,QWORD PTR[((-64))+r9*2+rsp] jmp $L$sqr8x_sp_done ALIGN 32 $L$sqr8x_sp_alt:: - lea r10,QWORD PTR[((4096-64))+r9*4] - lea rsp,QWORD PTR[((-64))+r9*4+rsp] + lea r10,QWORD PTR[((4096-64))+r9*2] + lea rsp,QWORD PTR[((-64))+r9*2+rsp] sub r11,r10 mov r10,0 cmovc r11,r10 sub rsp,r11 $L$sqr8x_sp_done:: and rsp,-64 + mov r11,rax + sub r11,rsp + and r11,-4096 +$L$sqr8x_page_walk:: + mov r10,QWORD PTR[r11*1+rsp] + sub r11,4096 +DB 02eh + jnc $L$sqr8x_page_walk + mov r10,r9 neg r9 - lea r11,QWORD PTR[64+r9*2+rsp] mov QWORD PTR[32+rsp],r8 mov QWORD PTR[40+rsp],rax $L$sqr8x_body:: - mov rbp,r9 -DB 102,73,15,110,211 - shr rbp,3+2 - mov eax,DWORD PTR[((OPENSSL_ia32cap_P+8))] - jmp $L$sqr8x_copy_n - -ALIGN 32 -$L$sqr8x_copy_n:: - movq xmm0,QWORD PTR[rcx] - movq xmm1,QWORD PTR[8+rcx] - movq xmm3,QWORD PTR[16+rcx] - movq xmm4,QWORD PTR[24+rcx] - lea rcx,QWORD PTR[32+rcx] - movdqa XMMWORD PTR[r11],xmm0 - movdqa XMMWORD PTR[16+r11],xmm1 - movdqa XMMWORD PTR[32+r11],xmm3 - movdqa XMMWORD PTR[48+r11],xmm4 - lea r11,QWORD PTR[64+r11] - dec rbp - jnz $L$sqr8x_copy_n - +DB 102,72,15,110,209 pxor xmm0,xmm0 DB 102,72,15,110,207 DB 102,73,15,110,218 + mov eax,DWORD PTR[((OPENSSL_ia32cap_P+8))] and eax,080100h cmp eax,080100h jne $L$sqr8x_nox call bn_sqrx8x_internal - pxor xmm0,xmm0 - lea rax,QWORD PTR[48+rsp] - lea rdx,QWORD PTR[64+r9*2+rsp] - shr r9,3+2 - mov rsi,QWORD PTR[40+rsp] - jmp $L$sqr8x_zero + + + + lea rbx,QWORD PTR[rcx*1+r8] + mov r9,rcx + mov rdx,rcx +DB 102,72,15,126,207 + sar rcx,3+2 + jmp $L$sqr8x_sub ALIGN 32 $L$sqr8x_nox:: call bn_sqr8x_internal + + + + lea rbx,QWORD PTR[r9*1+rdi] + mov rcx,r9 + mov rdx,r9 +DB 102,72,15,126,207 + sar rcx,3+2 + jmp $L$sqr8x_sub + +ALIGN 32 +$L$sqr8x_sub:: + mov r12,QWORD PTR[rbx] + mov r13,QWORD PTR[8+rbx] + mov r14,QWORD PTR[16+rbx] + mov r15,QWORD PTR[24+rbx] + lea rbx,QWORD PTR[32+rbx] + sbb r12,QWORD PTR[rbp] + sbb r13,QWORD PTR[8+rbp] + sbb r14,QWORD PTR[16+rbp] + sbb r15,QWORD PTR[24+rbp] + lea rbp,QWORD PTR[32+rbp] + mov QWORD PTR[rdi],r12 + mov QWORD PTR[8+rdi],r13 + mov QWORD PTR[16+rdi],r14 + mov QWORD PTR[24+rdi],r15 + lea rdi,QWORD PTR[32+rdi] + inc rcx + jnz $L$sqr8x_sub + + sbb rax,0 + lea rbx,QWORD PTR[r9*1+rbx] + lea rdi,QWORD PTR[r9*1+rdi] + +DB 102,72,15,110,200 pxor xmm0,xmm0 - lea rax,QWORD PTR[48+rsp] - lea rdx,QWORD PTR[64+r9*2+rsp] - shr r9,3+2 + pshufd xmm1,xmm1,0 mov rsi,QWORD PTR[40+rsp] - jmp $L$sqr8x_zero + jmp $L$sqr8x_cond_copy ALIGN 32 -$L$sqr8x_zero:: - movdqa XMMWORD PTR[rax],xmm0 - movdqa XMMWORD PTR[16+rax],xmm0 - movdqa XMMWORD PTR[32+rax],xmm0 - movdqa XMMWORD PTR[48+rax],xmm0 - lea rax,QWORD PTR[64+rax] - movdqa XMMWORD PTR[rdx],xmm0 - movdqa XMMWORD PTR[16+rdx],xmm0 - movdqa XMMWORD PTR[32+rdx],xmm0 - movdqa XMMWORD PTR[48+rdx],xmm0 - lea rdx,QWORD PTR[64+rdx] - dec r9 - jnz $L$sqr8x_zero +$L$sqr8x_cond_copy:: + movdqa xmm2,XMMWORD PTR[rbx] + movdqa xmm3,XMMWORD PTR[16+rbx] + lea rbx,QWORD PTR[32+rbx] + movdqu xmm4,XMMWORD PTR[rdi] + movdqu xmm5,XMMWORD PTR[16+rdi] + lea rdi,QWORD PTR[32+rdi] + movdqa XMMWORD PTR[(-32)+rbx],xmm0 + movdqa XMMWORD PTR[(-16)+rbx],xmm0 + movdqa XMMWORD PTR[(-32)+rdx*1+rbx],xmm0 + movdqa XMMWORD PTR[(-16)+rdx*1+rbx],xmm0 + pcmpeqd xmm0,xmm1 + pand xmm2,xmm1 + pand xmm3,xmm1 + pand xmm4,xmm0 + pand xmm5,xmm0 + pxor xmm0,xmm0 + por xmm4,xmm2 + por xmm5,xmm3 + movdqu XMMWORD PTR[(-32)+rdi],xmm4 + movdqu XMMWORD PTR[(-16)+rdi],xmm5 + add r9,32 + jnz $L$sqr8x_cond_copy mov rax,1 mov r15,QWORD PTR[((-48))+rsi] @@ -816,8 +873,17 @@ DB 067h sub r10,r9 mov r8,QWORD PTR[r8] lea rsp,QWORD PTR[((-72))+r10*1+rsp] - lea r10,QWORD PTR[r9*1+rdx] and rsp,-128 + mov r11,rax + sub r11,rsp + and r11,-4096 +$L$mulx4x_page_walk:: + mov r10,QWORD PTR[r11*1+rsp] + sub r11,4096 +DB 066h,02eh + jnc $L$mulx4x_page_walk + + lea r10,QWORD PTR[r9*1+rdx] @@ -1040,64 +1106,75 @@ $L$mulx4x_inner:: adc r15,rbp sub rbp,QWORD PTR[rbx] adc r14,r15 - mov r8,QWORD PTR[((-8))+rcx] sbb r15,r15 mov QWORD PTR[((-8))+rbx],r14 cmp rdi,QWORD PTR[16+rsp] jne $L$mulx4x_outer - sub r8,r14 - sbb r8,r8 - or r15,r8 - - neg rax - xor rdx,rdx + lea rbx,QWORD PTR[64+rsp] + sub rcx,rax + neg r15 + mov rdx,rax + shr rax,3+2 mov rdi,QWORD PTR[32+rsp] + jmp $L$mulx4x_sub + +ALIGN 32 +$L$mulx4x_sub:: + mov r11,QWORD PTR[rbx] + mov r12,QWORD PTR[8+rbx] + mov r13,QWORD PTR[16+rbx] + mov r14,QWORD PTR[24+rbx] + lea rbx,QWORD PTR[32+rbx] + sbb r11,QWORD PTR[rcx] + sbb r12,QWORD PTR[8+rcx] + sbb r13,QWORD PTR[16+rcx] + sbb r14,QWORD PTR[24+rcx] + lea rcx,QWORD PTR[32+rcx] + mov QWORD PTR[rdi],r11 + mov QWORD PTR[8+rdi],r12 + mov QWORD PTR[16+rdi],r13 + mov QWORD PTR[24+rdi],r14 + lea rdi,QWORD PTR[32+rdi] + dec rax + jnz $L$mulx4x_sub + + sbb r15,0 lea rbx,QWORD PTR[64+rsp] + sub rdi,rdx +DB 102,73,15,110,207 pxor xmm0,xmm0 - mov r8,QWORD PTR[rax*1+rcx] - mov r9,QWORD PTR[8+rax*1+rcx] - neg r8 - jmp $L$mulx4x_sub_entry + pshufd xmm1,xmm1,0 + mov rsi,QWORD PTR[40+rsp] + jmp $L$mulx4x_cond_copy ALIGN 32 -$L$mulx4x_sub:: - mov r8,QWORD PTR[rax*1+rcx] - mov r9,QWORD PTR[8+rax*1+rcx] - not r8 -$L$mulx4x_sub_entry:: - mov r10,QWORD PTR[16+rax*1+rcx] - not r9 - and r8,r15 - mov r11,QWORD PTR[24+rax*1+rcx] - not r10 - and r9,r15 - not r11 - and r10,r15 - and r11,r15 - - neg rdx - adc r8,QWORD PTR[rbx] - adc r9,QWORD PTR[8+rbx] - movdqa XMMWORD PTR[rbx],xmm0 - adc r10,QWORD PTR[16+rbx] - adc r11,QWORD PTR[24+rbx] - movdqa XMMWORD PTR[16+rbx],xmm0 +$L$mulx4x_cond_copy:: + movdqa xmm2,XMMWORD PTR[rbx] + movdqa xmm3,XMMWORD PTR[16+rbx] lea rbx,QWORD PTR[32+rbx] - sbb rdx,rdx - - mov QWORD PTR[rdi],r8 - mov QWORD PTR[8+rdi],r9 - mov QWORD PTR[16+rdi],r10 - mov QWORD PTR[24+rdi],r11 + movdqu xmm4,XMMWORD PTR[rdi] + movdqu xmm5,XMMWORD PTR[16+rdi] lea rdi,QWORD PTR[32+rdi] + movdqa XMMWORD PTR[(-32)+rbx],xmm0 + movdqa XMMWORD PTR[(-16)+rbx],xmm0 + pcmpeqd xmm0,xmm1 + pand xmm2,xmm1 + pand xmm3,xmm1 + pand xmm4,xmm0 + pand xmm5,xmm0 + pxor xmm0,xmm0 + por xmm4,xmm2 + por xmm5,xmm3 + movdqu XMMWORD PTR[(-32)+rdi],xmm4 + movdqu XMMWORD PTR[(-16)+rdi],xmm5 + sub rdx,32 + jnz $L$mulx4x_cond_copy - add rax,32 - jnz $L$mulx4x_sub + mov QWORD PTR[rbx],rdx - mov rsi,QWORD PTR[40+rsp] mov rax,1 mov r15,QWORD PTR[((-48))+rsi] mov r14,QWORD PTR[((-40))+rsi] diff --git a/vendor/openssl/asm/x64-win32-masm/bn/x86_64-mont5.asm b/vendor/openssl/asm/x64-win32-masm/bn/x86_64-mont5.asm index eae2339ef..3c1a74afb 100644 --- a/vendor/openssl/asm/x64-win32-masm/bn/x86_64-mont5.asm +++ b/vendor/openssl/asm/x64-win32-masm/bn/x86_64-mont5.asm @@ -28,49 +28,165 @@ ALIGN 16 $L$mul_enter:: mov r9d,r9d mov rax,rsp - mov r10d,DWORD PTR[56+rsp] + movd xmm5,DWORD PTR[56+rsp] + lea r10,QWORD PTR[$L$inc] push rbx push rbp push r12 push r13 push r14 push r15 - lea rsp,QWORD PTR[((-40))+rsp] - movaps XMMWORD PTR[rsp],xmm6 - movaps XMMWORD PTR[16+rsp],xmm7 + lea r11,QWORD PTR[2+r9] neg r11 - lea rsp,QWORD PTR[r11*8+rsp] + lea rsp,QWORD PTR[((-264))+r11*8+rsp] and rsp,-1024 mov QWORD PTR[8+r9*8+rsp],rax $L$mul_body:: - mov r12,rdx - mov r11,r10 - shr r10,3 - and r11,7 - not r10 - lea rax,QWORD PTR[$L$magic_masks] - and r10,3 - lea r12,QWORD PTR[96+r11*8+r12] - movq xmm4,QWORD PTR[r10*8+rax] - movq xmm5,QWORD PTR[8+r10*8+rax] - movq xmm6,QWORD PTR[16+r10*8+rax] - movq xmm7,QWORD PTR[24+r10*8+rax] - - movq xmm0,QWORD PTR[((-96))+r12] - movq xmm1,QWORD PTR[((-32))+r12] - pand xmm0,xmm4 - movq xmm2,QWORD PTR[32+r12] - pand xmm1,xmm5 - movq xmm3,QWORD PTR[96+r12] - pand xmm2,xmm6 - por xmm0,xmm1 - pand xmm3,xmm7 + + + + + + + sub rax,rsp + and rax,-4096 +$L$mul_page_walk:: + mov r11,QWORD PTR[rax*1+rsp] + sub rax,4096 +DB 02eh + jnc $L$mul_page_walk + + lea r12,QWORD PTR[128+rdx] + movdqa xmm0,XMMWORD PTR[r10] + movdqa xmm1,XMMWORD PTR[16+r10] + lea r10,QWORD PTR[((24-112))+r9*8+rsp] + and r10,-16 + + pshufd xmm5,xmm5,0 + movdqa xmm4,xmm1 + movdqa xmm2,xmm1 + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 +DB 067h + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[112+r10],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[128+r10],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[144+r10],xmm2 + movdqa xmm2,xmm4 + + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[160+r10],xmm3 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[176+r10],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[192+r10],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[208+r10],xmm2 + movdqa xmm2,xmm4 + + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[224+r10],xmm3 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[240+r10],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[256+r10],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[272+r10],xmm2 + movdqa xmm2,xmm4 + + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[288+r10],xmm3 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[304+r10],xmm0 + + paddd xmm3,xmm2 +DB 067h + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[320+r10],xmm1 + + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[336+r10],xmm2 + pand xmm0,XMMWORD PTR[64+r12] + + pand xmm1,XMMWORD PTR[80+r12] + pand xmm2,XMMWORD PTR[96+r12] + movdqa XMMWORD PTR[352+r10],xmm3 + pand xmm3,XMMWORD PTR[112+r12] por xmm0,xmm2 + por xmm1,xmm3 + movdqa xmm4,XMMWORD PTR[((-128))+r12] + movdqa xmm5,XMMWORD PTR[((-112))+r12] + movdqa xmm2,XMMWORD PTR[((-96))+r12] + pand xmm4,XMMWORD PTR[112+r10] + movdqa xmm3,XMMWORD PTR[((-80))+r12] + pand xmm5,XMMWORD PTR[128+r10] + por xmm0,xmm4 + pand xmm2,XMMWORD PTR[144+r10] + por xmm1,xmm5 + pand xmm3,XMMWORD PTR[160+r10] + por xmm0,xmm2 + por xmm1,xmm3 + movdqa xmm4,XMMWORD PTR[((-64))+r12] + movdqa xmm5,XMMWORD PTR[((-48))+r12] + movdqa xmm2,XMMWORD PTR[((-32))+r12] + pand xmm4,XMMWORD PTR[176+r10] + movdqa xmm3,XMMWORD PTR[((-16))+r12] + pand xmm5,XMMWORD PTR[192+r10] + por xmm0,xmm4 + pand xmm2,XMMWORD PTR[208+r10] + por xmm1,xmm5 + pand xmm3,XMMWORD PTR[224+r10] + por xmm0,xmm2 + por xmm1,xmm3 + movdqa xmm4,XMMWORD PTR[r12] + movdqa xmm5,XMMWORD PTR[16+r12] + movdqa xmm2,XMMWORD PTR[32+r12] + pand xmm4,XMMWORD PTR[240+r10] + movdqa xmm3,XMMWORD PTR[48+r12] + pand xmm5,XMMWORD PTR[256+r10] + por xmm0,xmm4 + pand xmm2,XMMWORD PTR[272+r10] + por xmm1,xmm5 + pand xmm3,XMMWORD PTR[288+r10] + por xmm0,xmm2 + por xmm1,xmm3 + por xmm0,xmm1 + pshufd xmm1,xmm0,04eh + por xmm0,xmm1 lea r12,QWORD PTR[256+r12] - por xmm0,xmm3 - DB 102,72,15,126,195 mov r8,QWORD PTR[r8] @@ -79,29 +195,14 @@ DB 102,72,15,126,195 xor r14,r14 xor r15,r15 - movq xmm0,QWORD PTR[((-96))+r12] - movq xmm1,QWORD PTR[((-32))+r12] - pand xmm0,xmm4 - movq xmm2,QWORD PTR[32+r12] - pand xmm1,xmm5 - mov rbp,r8 mul rbx mov r10,rax mov rax,QWORD PTR[rcx] - movq xmm3,QWORD PTR[96+r12] - pand xmm2,xmm6 - por xmm0,xmm1 - pand xmm3,xmm7 - imul rbp,r10 mov r11,rdx - por xmm0,xmm2 - lea r12,QWORD PTR[256+r12] - por xmm0,xmm3 - mul rbp add r10,rax mov rax,QWORD PTR[8+rsi] @@ -134,14 +235,12 @@ $L$1st_enter:: cmp r15,r9 jne $L$1st -DB 102,72,15,126,195 add r13,rax - mov rax,QWORD PTR[rsi] adc rdx,0 add r13,r11 adc rdx,0 - mov QWORD PTR[((-16))+r15*8+rsp],r13 + mov QWORD PTR[((-16))+r9*8+rsp],r13 mov r13,rdx mov r11,r10 @@ -155,33 +254,78 @@ DB 102,72,15,126,195 jmp $L$outer ALIGN 16 $L$outer:: + lea rdx,QWORD PTR[((24+128))+r9*8+rsp] + and rdx,-16 + pxor xmm4,xmm4 + pxor xmm5,xmm5 + movdqa xmm0,XMMWORD PTR[((-128))+r12] + movdqa xmm1,XMMWORD PTR[((-112))+r12] + movdqa xmm2,XMMWORD PTR[((-96))+r12] + movdqa xmm3,XMMWORD PTR[((-80))+r12] + pand xmm0,XMMWORD PTR[((-128))+rdx] + pand xmm1,XMMWORD PTR[((-112))+rdx] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[((-96))+rdx] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[((-80))+rdx] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[((-64))+r12] + movdqa xmm1,XMMWORD PTR[((-48))+r12] + movdqa xmm2,XMMWORD PTR[((-32))+r12] + movdqa xmm3,XMMWORD PTR[((-16))+r12] + pand xmm0,XMMWORD PTR[((-64))+rdx] + pand xmm1,XMMWORD PTR[((-48))+rdx] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[((-32))+rdx] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[((-16))+rdx] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[r12] + movdqa xmm1,XMMWORD PTR[16+r12] + movdqa xmm2,XMMWORD PTR[32+r12] + movdqa xmm3,XMMWORD PTR[48+r12] + pand xmm0,XMMWORD PTR[rdx] + pand xmm1,XMMWORD PTR[16+rdx] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[32+rdx] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[48+rdx] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[64+r12] + movdqa xmm1,XMMWORD PTR[80+r12] + movdqa xmm2,XMMWORD PTR[96+r12] + movdqa xmm3,XMMWORD PTR[112+r12] + pand xmm0,XMMWORD PTR[64+rdx] + pand xmm1,XMMWORD PTR[80+rdx] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[96+rdx] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[112+rdx] + por xmm4,xmm2 + por xmm5,xmm3 + por xmm4,xmm5 + pshufd xmm0,xmm4,04eh + por xmm0,xmm4 + lea r12,QWORD PTR[256+r12] + + mov rax,QWORD PTR[rsi] +DB 102,72,15,126,195 + xor r15,r15 mov rbp,r8 mov r10,QWORD PTR[rsp] - movq xmm0,QWORD PTR[((-96))+r12] - movq xmm1,QWORD PTR[((-32))+r12] - pand xmm0,xmm4 - movq xmm2,QWORD PTR[32+r12] - pand xmm1,xmm5 - mul rbx add r10,rax mov rax,QWORD PTR[rcx] adc rdx,0 - movq xmm3,QWORD PTR[96+r12] - pand xmm2,xmm6 - por xmm0,xmm1 - pand xmm3,xmm7 - imul rbp,r10 mov r11,rdx - por xmm0,xmm2 - lea r12,QWORD PTR[256+r12] - por xmm0,xmm3 - mul rbp add r10,rax mov rax,QWORD PTR[8+rsi] @@ -217,15 +361,12 @@ $L$inner_enter:: cmp r15,r9 jne $L$inner -DB 102,72,15,126,195 - add r13,rax - mov rax,QWORD PTR[rsi] adc rdx,0 add r13,r10 - mov r10,QWORD PTR[r15*8+rsp] + mov r10,QWORD PTR[r9*8+rsp] adc rdx,0 - mov QWORD PTR[((-16))+r15*8+rsp],r13 + mov QWORD PTR[((-16))+r9*8+rsp],r13 mov r13,rdx xor rdx,rdx @@ -272,8 +413,7 @@ $L$copy:: mov rsi,QWORD PTR[8+r9*8+rsp] mov rax,1 - movaps xmm6,XMMWORD PTR[((-88))+rsi] - movaps xmm7,XMMWORD PTR[((-72))+rsi] + mov r15,QWORD PTR[((-48))+rsi] mov r14,QWORD PTR[((-40))+rsi] mov r13,QWORD PTR[((-32))+rsi] @@ -303,8 +443,8 @@ $L$SEH_begin_bn_mul4x_mont_gather5:: $L$mul4x_enter:: - and r11d,080100h - cmp r11d,080100h + and r11d,080108h + cmp r11d,080108h je $L$mulx4x_enter DB 067h mov rax,rsp @@ -314,13 +454,10 @@ DB 067h push r13 push r14 push r15 - lea rsp,QWORD PTR[((-40))+rsp] - movaps XMMWORD PTR[rsp],xmm6 - movaps XMMWORD PTR[16+rsp],xmm7 + DB 067h - mov r10d,r9d shl r9d,3 - shl r10d,3+2 + lea r10,QWORD PTR[r9*2+r9] neg r9 @@ -330,25 +467,36 @@ DB 067h - lea r11,QWORD PTR[((-64))+r9*2+rsp] - sub r11,rsi + + + lea r11,QWORD PTR[((-320))+r9*2+rsp] + sub r11,rdi and r11,4095 cmp r10,r11 jb $L$mul4xsp_alt sub rsp,r11 - lea rsp,QWORD PTR[((-64))+r9*2+rsp] + lea rsp,QWORD PTR[((-320))+r9*2+rsp] jmp $L$mul4xsp_done ALIGN 32 $L$mul4xsp_alt:: - lea r10,QWORD PTR[((4096-64))+r9*2] - lea rsp,QWORD PTR[((-64))+r9*2+rsp] + lea r10,QWORD PTR[((4096-320))+r9*2] + lea rsp,QWORD PTR[((-320))+r9*2+rsp] sub r11,r10 mov r10,0 cmovc r11,r10 sub rsp,r11 $L$mul4xsp_done:: and rsp,-64 + mov r11,rax + sub r11,rsp + and r11,-4096 +$L$mul4x_page_walk:: + mov r10,QWORD PTR[r11*1+rsp] + sub r11,4096 +DB 02eh + jnc $L$mul4x_page_walk + neg r9 mov QWORD PTR[40+rsp],rax @@ -358,8 +506,7 @@ $L$mul4x_body:: mov rsi,QWORD PTR[40+rsp] mov rax,1 - movaps xmm6,XMMWORD PTR[((-88))+rsi] - movaps xmm7,XMMWORD PTR[((-72))+rsi] + mov r15,QWORD PTR[((-48))+rsi] mov r14,QWORD PTR[((-40))+rsi] mov r13,QWORD PTR[((-32))+rsi] @@ -378,47 +525,141 @@ bn_mul4x_mont_gather5 ENDP ALIGN 32 mul4x_internal PROC PRIVATE shl r9,5 - mov r10d,DWORD PTR[56+rax] - lea r13,QWORD PTR[256+r9*1+rdx] + movd xmm5,DWORD PTR[56+rax] + lea rax,QWORD PTR[$L$inc] + lea r13,QWORD PTR[128+r9*1+rdx] shr r9,5 - mov r11,r10 - shr r10,3 - and r11,7 - not r10 - lea rax,QWORD PTR[$L$magic_masks] - and r10,3 - lea r12,QWORD PTR[96+r11*8+rdx] - movq xmm4,QWORD PTR[r10*8+rax] - movq xmm5,QWORD PTR[8+r10*8+rax] - add r11,7 - movq xmm6,QWORD PTR[16+r10*8+rax] - movq xmm7,QWORD PTR[24+r10*8+rax] - and r11,7 - - movq xmm0,QWORD PTR[((-96))+r12] - lea r14,QWORD PTR[256+r12] - movq xmm1,QWORD PTR[((-32))+r12] - pand xmm0,xmm4 - movq xmm2,QWORD PTR[32+r12] - pand xmm1,xmm5 - movq xmm3,QWORD PTR[96+r12] - pand xmm2,xmm6 -DB 067h - por xmm0,xmm1 - movq xmm1,QWORD PTR[((-96))+r14] -DB 067h - pand xmm3,xmm7 -DB 067h - por xmm0,xmm2 - movq xmm2,QWORD PTR[((-32))+r14] + movdqa xmm0,XMMWORD PTR[rax] + movdqa xmm1,XMMWORD PTR[16+rax] + lea r10,QWORD PTR[((88-112))+r9*1+rsp] + lea r12,QWORD PTR[128+rdx] + + pshufd xmm5,xmm5,0 + movdqa xmm4,xmm1 +DB 067h,067h + movdqa xmm2,xmm1 + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 DB 067h - pand xmm1,xmm4 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[112+r10],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[128+r10],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[144+r10],xmm2 + movdqa xmm2,xmm4 + + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[160+r10],xmm3 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[176+r10],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[192+r10],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[208+r10],xmm2 + movdqa xmm2,xmm4 + + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[224+r10],xmm3 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[240+r10],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[256+r10],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[272+r10],xmm2 + movdqa xmm2,xmm4 + + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[288+r10],xmm3 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[304+r10],xmm0 + + paddd xmm3,xmm2 DB 067h - por xmm0,xmm3 - movq xmm3,QWORD PTR[32+r14] + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[320+r10],xmm1 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[336+r10],xmm2 + pand xmm0,XMMWORD PTR[64+r12] + + pand xmm1,XMMWORD PTR[80+r12] + pand xmm2,XMMWORD PTR[96+r12] + movdqa XMMWORD PTR[352+r10],xmm3 + pand xmm3,XMMWORD PTR[112+r12] + por xmm0,xmm2 + por xmm1,xmm3 + movdqa xmm4,XMMWORD PTR[((-128))+r12] + movdqa xmm5,XMMWORD PTR[((-112))+r12] + movdqa xmm2,XMMWORD PTR[((-96))+r12] + pand xmm4,XMMWORD PTR[112+r10] + movdqa xmm3,XMMWORD PTR[((-80))+r12] + pand xmm5,XMMWORD PTR[128+r10] + por xmm0,xmm4 + pand xmm2,XMMWORD PTR[144+r10] + por xmm1,xmm5 + pand xmm3,XMMWORD PTR[160+r10] + por xmm0,xmm2 + por xmm1,xmm3 + movdqa xmm4,XMMWORD PTR[((-64))+r12] + movdqa xmm5,XMMWORD PTR[((-48))+r12] + movdqa xmm2,XMMWORD PTR[((-32))+r12] + pand xmm4,XMMWORD PTR[176+r10] + movdqa xmm3,XMMWORD PTR[((-16))+r12] + pand xmm5,XMMWORD PTR[192+r10] + por xmm0,xmm4 + pand xmm2,XMMWORD PTR[208+r10] + por xmm1,xmm5 + pand xmm3,XMMWORD PTR[224+r10] + por xmm0,xmm2 + por xmm1,xmm3 + movdqa xmm4,XMMWORD PTR[r12] + movdqa xmm5,XMMWORD PTR[16+r12] + movdqa xmm2,XMMWORD PTR[32+r12] + pand xmm4,XMMWORD PTR[240+r10] + movdqa xmm3,XMMWORD PTR[48+r12] + pand xmm5,XMMWORD PTR[256+r10] + por xmm0,xmm4 + pand xmm2,XMMWORD PTR[272+r10] + por xmm1,xmm5 + pand xmm3,XMMWORD PTR[288+r10] + por xmm0,xmm2 + por xmm1,xmm3 + por xmm0,xmm1 + pshufd xmm1,xmm0,04eh + por xmm0,xmm1 + lea r12,QWORD PTR[256+r12] DB 102,72,15,126,195 - movq xmm0,QWORD PTR[96+r14] + mov QWORD PTR[((16+8))+rsp],r13 mov QWORD PTR[((56+8))+rsp],rdi @@ -432,26 +673,10 @@ DB 102,72,15,126,195 mov r10,rax mov rax,QWORD PTR[rcx] - pand xmm2,xmm5 - pand xmm3,xmm6 - por xmm1,xmm2 - imul rbp,r10 - - - - - - - - lea r14,QWORD PTR[((64+8))+r11*8+rsp] + lea r14,QWORD PTR[((64+8))+rsp] mov r11,rdx - pand xmm0,xmm7 - por xmm1,xmm3 - lea r12,QWORD PTR[512+r12] - por xmm0,xmm1 - mul rbp add r10,rax mov rax,QWORD PTR[8+r9*1+rsi] @@ -460,7 +685,7 @@ DB 102,72,15,126,195 mul rbx add r11,rax - mov rax,QWORD PTR[16+rcx] + mov rax,QWORD PTR[8+rcx] adc rdx,0 mov r10,rdx @@ -470,7 +695,7 @@ DB 102,72,15,126,195 adc rdx,0 add rdi,r11 lea r15,QWORD PTR[32+r9] - lea rcx,QWORD PTR[64+rcx] + lea rcx,QWORD PTR[32+rcx] adc rdx,0 mov QWORD PTR[r14],rdi mov r13,rdx @@ -480,7 +705,7 @@ ALIGN 32 $L$1st4x:: mul rbx add r10,rax - mov rax,QWORD PTR[((-32))+rcx] + mov rax,QWORD PTR[((-16))+rcx] lea r14,QWORD PTR[32+r14] adc rdx,0 mov r11,rdx @@ -496,7 +721,7 @@ $L$1st4x:: mul rbx add r11,rax - mov rax,QWORD PTR[((-16))+rcx] + mov rax,QWORD PTR[((-8))+rcx] adc rdx,0 mov r10,rdx @@ -526,7 +751,7 @@ $L$1st4x:: mul rbx add r11,rax - mov rax,QWORD PTR[16+rcx] + mov rax,QWORD PTR[8+rcx] adc rdx,0 mov r10,rdx @@ -535,7 +760,7 @@ $L$1st4x:: mov rax,QWORD PTR[16+r15*1+rsi] adc rdx,0 add rdi,r11 - lea rcx,QWORD PTR[64+rcx] + lea rcx,QWORD PTR[32+rcx] adc rdx,0 mov QWORD PTR[r14],rdi mov r13,rdx @@ -545,7 +770,7 @@ $L$1st4x:: mul rbx add r10,rax - mov rax,QWORD PTR[((-32))+rcx] + mov rax,QWORD PTR[((-16))+rcx] lea r14,QWORD PTR[32+r14] adc rdx,0 mov r11,rdx @@ -561,7 +786,7 @@ $L$1st4x:: mul rbx add r11,rax - mov rax,QWORD PTR[((-16))+rcx] + mov rax,QWORD PTR[((-8))+rcx] adc rdx,0 mov r10,rdx @@ -574,8 +799,7 @@ $L$1st4x:: mov QWORD PTR[((-16))+r14],rdi mov r13,rdx -DB 102,72,15,126,195 - lea rcx,QWORD PTR[r9*2+rcx] + lea rcx,QWORD PTR[r9*1+rcx] xor rdi,rdi add r13,r10 @@ -586,6 +810,63 @@ DB 102,72,15,126,195 ALIGN 32 $L$outer4x:: + lea rdx,QWORD PTR[((16+128))+r14] + pxor xmm4,xmm4 + pxor xmm5,xmm5 + movdqa xmm0,XMMWORD PTR[((-128))+r12] + movdqa xmm1,XMMWORD PTR[((-112))+r12] + movdqa xmm2,XMMWORD PTR[((-96))+r12] + movdqa xmm3,XMMWORD PTR[((-80))+r12] + pand xmm0,XMMWORD PTR[((-128))+rdx] + pand xmm1,XMMWORD PTR[((-112))+rdx] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[((-96))+rdx] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[((-80))+rdx] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[((-64))+r12] + movdqa xmm1,XMMWORD PTR[((-48))+r12] + movdqa xmm2,XMMWORD PTR[((-32))+r12] + movdqa xmm3,XMMWORD PTR[((-16))+r12] + pand xmm0,XMMWORD PTR[((-64))+rdx] + pand xmm1,XMMWORD PTR[((-48))+rdx] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[((-32))+rdx] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[((-16))+rdx] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[r12] + movdqa xmm1,XMMWORD PTR[16+r12] + movdqa xmm2,XMMWORD PTR[32+r12] + movdqa xmm3,XMMWORD PTR[48+r12] + pand xmm0,XMMWORD PTR[rdx] + pand xmm1,XMMWORD PTR[16+rdx] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[32+rdx] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[48+rdx] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[64+r12] + movdqa xmm1,XMMWORD PTR[80+r12] + movdqa xmm2,XMMWORD PTR[96+r12] + movdqa xmm3,XMMWORD PTR[112+r12] + pand xmm0,XMMWORD PTR[64+rdx] + pand xmm1,XMMWORD PTR[80+rdx] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[96+rdx] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[112+rdx] + por xmm4,xmm2 + por xmm5,xmm3 + por xmm4,xmm5 + pshufd xmm0,xmm4,04eh + por xmm0,xmm4 + lea r12,QWORD PTR[256+r12] +DB 102,72,15,126,195 + mov r10,QWORD PTR[r9*1+r14] mov rbp,r8 mul rbx @@ -593,25 +874,11 @@ $L$outer4x:: mov rax,QWORD PTR[rcx] adc rdx,0 - movq xmm0,QWORD PTR[((-96))+r12] - movq xmm1,QWORD PTR[((-32))+r12] - pand xmm0,xmm4 - movq xmm2,QWORD PTR[32+r12] - pand xmm1,xmm5 - movq xmm3,QWORD PTR[96+r12] - imul rbp,r10 -DB 067h mov r11,rdx mov QWORD PTR[r14],rdi - pand xmm2,xmm6 - por xmm0,xmm1 - pand xmm3,xmm7 - por xmm0,xmm2 lea r14,QWORD PTR[r9*1+r14] - lea r12,QWORD PTR[256+r12] - por xmm0,xmm3 mul rbp add r10,rax @@ -621,7 +888,7 @@ DB 067h mul rbx add r11,rax - mov rax,QWORD PTR[16+rcx] + mov rax,QWORD PTR[8+rcx] adc rdx,0 add r11,QWORD PTR[8+r14] adc rdx,0 @@ -633,7 +900,7 @@ DB 067h adc rdx,0 add rdi,r11 lea r15,QWORD PTR[32+r9] - lea rcx,QWORD PTR[64+rcx] + lea rcx,QWORD PTR[32+rcx] adc rdx,0 mov r13,rdx jmp $L$inner4x @@ -642,7 +909,7 @@ ALIGN 32 $L$inner4x:: mul rbx add r10,rax - mov rax,QWORD PTR[((-32))+rcx] + mov rax,QWORD PTR[((-16))+rcx] adc rdx,0 add r10,QWORD PTR[16+r14] lea r14,QWORD PTR[32+r14] @@ -660,7 +927,7 @@ $L$inner4x:: mul rbx add r11,rax - mov rax,QWORD PTR[((-16))+rcx] + mov rax,QWORD PTR[((-8))+rcx] adc rdx,0 add r11,QWORD PTR[((-8))+r14] adc rdx,0 @@ -694,7 +961,7 @@ $L$inner4x:: mul rbx add r11,rax - mov rax,QWORD PTR[16+rcx] + mov rax,QWORD PTR[8+rcx] adc rdx,0 add r11,QWORD PTR[8+r14] adc rdx,0 @@ -705,7 +972,7 @@ $L$inner4x:: mov rax,QWORD PTR[16+r15*1+rsi] adc rdx,0 add rdi,r11 - lea rcx,QWORD PTR[64+rcx] + lea rcx,QWORD PTR[32+rcx] adc rdx,0 mov QWORD PTR[((-8))+r14],r13 mov r13,rdx @@ -715,7 +982,7 @@ $L$inner4x:: mul rbx add r10,rax - mov rax,QWORD PTR[((-32))+rcx] + mov rax,QWORD PTR[((-16))+rcx] adc rdx,0 add r10,QWORD PTR[16+r14] lea r14,QWORD PTR[32+r14] @@ -734,7 +1001,7 @@ $L$inner4x:: mul rbx add r11,rax mov rax,rbp - mov rbp,QWORD PTR[((-16))+rcx] + mov rbp,QWORD PTR[((-8))+rcx] adc rdx,0 add r11,QWORD PTR[((-8))+r14] adc rdx,0 @@ -749,9 +1016,8 @@ $L$inner4x:: mov QWORD PTR[((-24))+r14],r13 mov r13,rdx -DB 102,72,15,126,195 mov QWORD PTR[((-16))+r14],rdi - lea rcx,QWORD PTR[r9*2+rcx] + lea rcx,QWORD PTR[r9*1+rcx] xor rdi,rdi add r13,r10 @@ -762,16 +1028,23 @@ DB 102,72,15,126,195 cmp r12,QWORD PTR[((16+8))+rsp] jb $L$outer4x + xor rax,rax sub rbp,r13 adc r15,r15 or rdi,r15 - xor rdi,1 + sub rax,rdi lea rbx,QWORD PTR[r9*1+r14] - lea rbp,QWORD PTR[rdi*8+rcx] + mov r12,QWORD PTR[rcx] + lea rbp,QWORD PTR[rcx] mov rcx,r9 sar rcx,3+2 mov rdi,QWORD PTR[((56+8))+rsp] - jmp $L$sqr4x_sub + dec r12 + xor r10,r10 + mov r13,QWORD PTR[8+rbp] + mov r14,QWORD PTR[16+rbp] + mov r15,QWORD PTR[24+rbp] + jmp $L$sqr4x_sub_entry mul4x_internal ENDP PUBLIC bn_power5 @@ -790,8 +1063,8 @@ $L$SEH_begin_bn_power5:: mov r11d,DWORD PTR[((OPENSSL_ia32cap_P+8))] - and r11d,080100h - cmp r11d,080100h + and r11d,080108h + cmp r11d,080108h je $L$powerx5_enter mov rax,rsp push rbx @@ -800,12 +1073,9 @@ $L$SEH_begin_bn_power5:: push r13 push r14 push r15 - lea rsp,QWORD PTR[((-40))+rsp] - movaps XMMWORD PTR[rsp],xmm6 - movaps XMMWORD PTR[16+rsp],xmm7 - mov r10d,r9d + shl r9d,3 - shl r10d,3+2 + lea r10d,DWORD PTR[r9*2+r9] neg r9 mov r8,QWORD PTR[r8] @@ -815,25 +1085,35 @@ $L$SEH_begin_bn_power5:: - lea r11,QWORD PTR[((-64))+r9*2+rsp] - sub r11,rsi + + lea r11,QWORD PTR[((-320))+r9*2+rsp] + sub r11,rdi and r11,4095 cmp r10,r11 jb $L$pwr_sp_alt sub rsp,r11 - lea rsp,QWORD PTR[((-64))+r9*2+rsp] + lea rsp,QWORD PTR[((-320))+r9*2+rsp] jmp $L$pwr_sp_done ALIGN 32 $L$pwr_sp_alt:: - lea r10,QWORD PTR[((4096-64))+r9*2] - lea rsp,QWORD PTR[((-64))+r9*2+rsp] + lea r10,QWORD PTR[((4096-320))+r9*2] + lea rsp,QWORD PTR[((-320))+r9*2+rsp] sub r11,r10 mov r10,0 cmovc r11,r10 sub rsp,r11 $L$pwr_sp_done:: and rsp,-64 + mov r11,rax + sub r11,rsp + and r11,-4096 +$L$pwr_page_walk:: + mov r10,QWORD PTR[r11*1+rsp] + sub r11,4096 +DB 02eh + jnc $L$pwr_page_walk + mov r10,r9 neg r9 @@ -855,10 +1135,15 @@ DB 102,73,15,110,218 DB 102,72,15,110,226 call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal DB 102,72,15,126,209 DB 102,72,15,126,226 @@ -1405,9 +1690,9 @@ DB 067h mov QWORD PTR[((-16))+rdi],rbx mov QWORD PTR[((-8))+rdi],r8 DB 102,72,15,126,213 -sqr8x_reduction:: +__bn_sqr8x_reduction:: xor rax,rax - lea rcx,QWORD PTR[r9*2+rbp] + lea rcx,QWORD PTR[rbp*1+r9] lea rdx,QWORD PTR[((48+8))+r9*2+rsp] mov QWORD PTR[((0+8))+rsp],rcx lea rdi,QWORD PTR[((48+8))+r9*1+rsp] @@ -1440,14 +1725,14 @@ DB 067h ALIGN 32 $L$8x_reduce:: mul rbx - mov rax,QWORD PTR[16+rbp] + mov rax,QWORD PTR[8+rbp] neg r8 mov r8,rdx adc r8,0 mul rbx add r9,rax - mov rax,QWORD PTR[32+rbp] + mov rax,QWORD PTR[16+rbp] adc rdx,0 add r8,r9 mov QWORD PTR[((48-8+8))+rcx*8+rsp],rbx @@ -1456,7 +1741,7 @@ $L$8x_reduce:: mul rbx add r10,rax - mov rax,QWORD PTR[48+rbp] + mov rax,QWORD PTR[24+rbp] adc rdx,0 add r9,r10 mov rsi,QWORD PTR[((32+8))+rsp] @@ -1465,7 +1750,7 @@ $L$8x_reduce:: mul rbx add r11,rax - mov rax,QWORD PTR[64+rbp] + mov rax,QWORD PTR[32+rbp] adc rdx,0 imul rsi,r8 add r10,r11 @@ -1474,7 +1759,7 @@ $L$8x_reduce:: mul rbx add r12,rax - mov rax,QWORD PTR[80+rbp] + mov rax,QWORD PTR[40+rbp] adc rdx,0 add r11,r12 mov r12,rdx @@ -1482,7 +1767,7 @@ $L$8x_reduce:: mul rbx add r13,rax - mov rax,QWORD PTR[96+rbp] + mov rax,QWORD PTR[48+rbp] adc rdx,0 add r12,r13 mov r13,rdx @@ -1490,7 +1775,7 @@ $L$8x_reduce:: mul rbx add r14,rax - mov rax,QWORD PTR[112+rbp] + mov rax,QWORD PTR[56+rbp] adc rdx,0 add r13,r14 mov r14,rdx @@ -1508,7 +1793,7 @@ $L$8x_reduce:: dec ecx jnz $L$8x_reduce - lea rbp,QWORD PTR[128+rbp] + lea rbp,QWORD PTR[64+rbp] xor rax,rax mov rdx,QWORD PTR[((8+8))+rsp] cmp rbp,QWORD PTR[((0+8))+rsp] @@ -1534,14 +1819,14 @@ ALIGN 32 $L$8x_tail:: mul rbx add r8,rax - mov rax,QWORD PTR[16+rbp] + mov rax,QWORD PTR[8+rbp] mov QWORD PTR[rdi],r8 mov r8,rdx adc r8,0 mul rbx add r9,rax - mov rax,QWORD PTR[32+rbp] + mov rax,QWORD PTR[16+rbp] adc rdx,0 add r8,r9 lea rdi,QWORD PTR[8+rdi] @@ -1550,7 +1835,7 @@ $L$8x_tail:: mul rbx add r10,rax - mov rax,QWORD PTR[48+rbp] + mov rax,QWORD PTR[24+rbp] adc rdx,0 add r9,r10 mov r10,rdx @@ -1558,7 +1843,7 @@ $L$8x_tail:: mul rbx add r11,rax - mov rax,QWORD PTR[64+rbp] + mov rax,QWORD PTR[32+rbp] adc rdx,0 add r10,r11 mov r11,rdx @@ -1566,7 +1851,7 @@ $L$8x_tail:: mul rbx add r12,rax - mov rax,QWORD PTR[80+rbp] + mov rax,QWORD PTR[40+rbp] adc rdx,0 add r11,r12 mov r12,rdx @@ -1574,7 +1859,7 @@ $L$8x_tail:: mul rbx add r13,rax - mov rax,QWORD PTR[96+rbp] + mov rax,QWORD PTR[48+rbp] adc rdx,0 add r12,r13 mov r13,rdx @@ -1582,7 +1867,7 @@ $L$8x_tail:: mul rbx add r14,rax - mov rax,QWORD PTR[112+rbp] + mov rax,QWORD PTR[56+rbp] adc rdx,0 add r13,r14 mov r14,rdx @@ -1600,7 +1885,7 @@ $L$8x_tail:: dec ecx jnz $L$8x_tail - lea rbp,QWORD PTR[128+rbp] + lea rbp,QWORD PTR[64+rbp] mov rdx,QWORD PTR[((8+8))+rsp] cmp rbp,QWORD PTR[((0+8))+rsp] jae $L$8x_tail_done @@ -1646,7 +1931,7 @@ $L$8x_no_tail:: adc r14,QWORD PTR[48+rdi] adc r15,QWORD PTR[56+rdi] adc rax,0 - mov rcx,QWORD PTR[((-16))+rbp] + mov rcx,QWORD PTR[((-8))+rbp] xor rsi,rsi DB 102,72,15,126,213 @@ -1664,44 +1949,62 @@ DB 102,73,15,126,217 cmp rdi,rdx jb $L$8x_reduction_loop + DB 0F3h,0C3h ;repret +bn_sqr8x_internal ENDP - sub rcx,r15 +ALIGN 32 +__bn_post4x_internal PROC PRIVATE + mov r12,QWORD PTR[rbp] lea rbx,QWORD PTR[r9*1+rdi] - adc rsi,rsi mov rcx,r9 - or rax,rsi DB 102,72,15,126,207 - xor rax,1 + neg rax DB 102,72,15,126,206 - lea rbp,QWORD PTR[rax*8+rbp] sar rcx,3+2 - jmp $L$sqr4x_sub + dec r12 + xor r10,r10 + mov r13,QWORD PTR[8+rbp] + mov r14,QWORD PTR[16+rbp] + mov r15,QWORD PTR[24+rbp] + jmp $L$sqr4x_sub_entry -ALIGN 32 +ALIGN 16 $L$sqr4x_sub:: -DB 066h - mov r12,QWORD PTR[rbx] - mov r13,QWORD PTR[8+rbx] - sbb r12,QWORD PTR[rbp] - mov r14,QWORD PTR[16+rbx] - sbb r13,QWORD PTR[16+rbp] - mov r15,QWORD PTR[24+rbx] - lea rbx,QWORD PTR[32+rbx] - sbb r14,QWORD PTR[32+rbp] + mov r12,QWORD PTR[rbp] + mov r13,QWORD PTR[8+rbp] + mov r14,QWORD PTR[16+rbp] + mov r15,QWORD PTR[24+rbp] +$L$sqr4x_sub_entry:: + lea rbp,QWORD PTR[32+rbp] + not r12 + not r13 + not r14 + not r15 + and r12,rax + and r13,rax + and r14,rax + and r15,rax + + neg r10 + adc r12,QWORD PTR[rbx] + adc r13,QWORD PTR[8+rbx] + adc r14,QWORD PTR[16+rbx] + adc r15,QWORD PTR[24+rbx] mov QWORD PTR[rdi],r12 - sbb r15,QWORD PTR[48+rbp] - lea rbp,QWORD PTR[64+rbp] + lea rbx,QWORD PTR[32+rbx] mov QWORD PTR[8+rdi],r13 + sbb r10,r10 mov QWORD PTR[16+rdi],r14 mov QWORD PTR[24+rdi],r15 lea rdi,QWORD PTR[32+rdi] inc rcx jnz $L$sqr4x_sub + mov r10,r9 neg r9 DB 0F3h,0C3h ;repret -bn_sqr8x_internal ENDP +__bn_post4x_internal ENDP PUBLIC bn_from_montgomery ALIGN 32 @@ -1735,13 +2038,9 @@ DB 067h push r13 push r14 push r15 - lea rsp,QWORD PTR[((-40))+rsp] - movaps XMMWORD PTR[rsp],xmm6 - movaps XMMWORD PTR[16+rsp],xmm7 -DB 067h - mov r10d,r9d + shl r9d,3 - shl r10d,3+2 + lea r10,QWORD PTR[r9*2+r9] neg r9 mov r8,QWORD PTR[r8] @@ -1751,25 +2050,35 @@ DB 067h - lea r11,QWORD PTR[((-64))+r9*2+rsp] - sub r11,rsi + + lea r11,QWORD PTR[((-320))+r9*2+rsp] + sub r11,rdi and r11,4095 cmp r10,r11 jb $L$from_sp_alt sub rsp,r11 - lea rsp,QWORD PTR[((-64))+r9*2+rsp] + lea rsp,QWORD PTR[((-320))+r9*2+rsp] jmp $L$from_sp_done ALIGN 32 $L$from_sp_alt:: - lea r10,QWORD PTR[((4096-64))+r9*2] - lea rsp,QWORD PTR[((-64))+r9*2+rsp] + lea r10,QWORD PTR[((4096-320))+r9*2] + lea rsp,QWORD PTR[((-320))+r9*2+rsp] sub r11,r10 mov r10,0 cmovc r11,r10 sub rsp,r11 $L$from_sp_done:: and rsp,-64 + mov r11,rax + sub r11,rsp + and r11,-4096 +$L$from_page_walk:: + mov r10,QWORD PTR[r11*1+rsp] + sub r11,4096 +DB 02eh + jnc $L$from_page_walk + mov r10,r9 neg r9 @@ -1815,12 +2124,13 @@ DB 067h mov rbp,rcx DB 102,73,15,110,218 mov r11d,DWORD PTR[((OPENSSL_ia32cap_P+8))] - and r11d,080100h - cmp r11d,080100h + and r11d,080108h + cmp r11d,080108h jne $L$from_mont_nox lea rdi,QWORD PTR[r9*1+rax] - call sqrx8x_reduction + call __bn_sqrx8x_reduction + call __bn_postx4x_internal pxor xmm0,xmm0 lea rax,QWORD PTR[48+rsp] @@ -1829,7 +2139,8 @@ DB 102,73,15,110,218 ALIGN 32 $L$from_mont_nox:: - call sqr8x_reduction + call __bn_sqr8x_reduction + call __bn_post4x_internal pxor xmm0,xmm0 lea rax,QWORD PTR[48+rsp] @@ -1876,7 +2187,6 @@ $L$SEH_begin_bn_mulx4x_mont_gather5:: $L$mulx4x_enter:: -DB 067h mov rax,rsp push rbx push rbp @@ -1884,13 +2194,9 @@ DB 067h push r13 push r14 push r15 - lea rsp,QWORD PTR[((-40))+rsp] - movaps XMMWORD PTR[rsp],xmm6 - movaps XMMWORD PTR[16+rsp],xmm7 -DB 067h - mov r10d,r9d + shl r9d,3 - shl r10d,3+2 + lea r10,QWORD PTR[r9*2+r9] neg r9 mov r8,QWORD PTR[r8] @@ -1901,25 +2207,35 @@ DB 067h - lea r11,QWORD PTR[((-64))+r9*2+rsp] - sub r11,rsi + + + lea r11,QWORD PTR[((-320))+r9*2+rsp] + sub r11,rdi and r11,4095 cmp r10,r11 jb $L$mulx4xsp_alt sub rsp,r11 - lea rsp,QWORD PTR[((-64))+r9*2+rsp] + lea rsp,QWORD PTR[((-320))+r9*2+rsp] jmp $L$mulx4xsp_done -ALIGN 32 $L$mulx4xsp_alt:: - lea r10,QWORD PTR[((4096-64))+r9*2] - lea rsp,QWORD PTR[((-64))+r9*2+rsp] + lea r10,QWORD PTR[((4096-320))+r9*2] + lea rsp,QWORD PTR[((-320))+r9*2+rsp] sub r11,r10 mov r10,0 cmovc r11,r10 sub rsp,r11 $L$mulx4xsp_done:: and rsp,-64 + mov r11,rax + sub r11,rsp + and r11,-4096 +$L$mulx4x_page_walk:: + mov r10,QWORD PTR[r11*1+rsp] + sub r11,4096 +DB 02eh + jnc $L$mulx4x_page_walk + @@ -1939,8 +2255,7 @@ $L$mulx4x_body:: mov rsi,QWORD PTR[40+rsp] mov rax,1 - movaps xmm6,XMMWORD PTR[((-88))+rsi] - movaps xmm7,XMMWORD PTR[((-72))+rsi] + mov r15,QWORD PTR[((-48))+rsi] mov r14,QWORD PTR[((-40))+rsi] mov r13,QWORD PTR[((-32))+rsi] @@ -1958,63 +2273,150 @@ bn_mulx4x_mont_gather5 ENDP ALIGN 32 mulx4x_internal PROC PRIVATE -DB 04ch,089h,08ch,024h,008h,000h,000h,000h -DB 067h + mov QWORD PTR[8+rsp],r9 + mov r10,r9 neg r9 shl r9,5 - lea r13,QWORD PTR[256+r9*1+rdx] + neg r10 + lea r13,QWORD PTR[128+r9*1+rdx] shr r9,5+5 - mov r10d,DWORD PTR[56+rax] + movd xmm5,DWORD PTR[56+rax] sub r9,1 + lea rax,QWORD PTR[$L$inc] mov QWORD PTR[((16+8))+rsp],r13 mov QWORD PTR[((24+8))+rsp],r9 mov QWORD PTR[((56+8))+rsp],rdi - mov r11,r10 - shr r10,3 - and r11,7 - not r10 - lea rax,QWORD PTR[$L$magic_masks] - and r10,3 - lea rdi,QWORD PTR[96+r11*8+rdx] - movq xmm4,QWORD PTR[r10*8+rax] - movq xmm5,QWORD PTR[8+r10*8+rax] - add r11,7 - movq xmm6,QWORD PTR[16+r10*8+rax] - movq xmm7,QWORD PTR[24+r10*8+rax] - and r11,7 - - movq xmm0,QWORD PTR[((-96))+rdi] - lea rbx,QWORD PTR[256+rdi] - movq xmm1,QWORD PTR[((-32))+rdi] - pand xmm0,xmm4 - movq xmm2,QWORD PTR[32+rdi] - pand xmm1,xmm5 - movq xmm3,QWORD PTR[96+rdi] - pand xmm2,xmm6 - por xmm0,xmm1 - movq xmm1,QWORD PTR[((-96))+rbx] - pand xmm3,xmm7 - por xmm0,xmm2 - movq xmm2,QWORD PTR[((-32))+rbx] - por xmm0,xmm3 -DB 067h,067h - pand xmm1,xmm4 - movq xmm3,QWORD PTR[32+rbx] + movdqa xmm0,XMMWORD PTR[rax] + movdqa xmm1,XMMWORD PTR[16+rax] + lea r10,QWORD PTR[((88-112))+r10*1+rsp] + lea rdi,QWORD PTR[128+rdx] + pshufd xmm5,xmm5,0 + movdqa xmm4,xmm1 +DB 067h + movdqa xmm2,xmm1 +DB 067h + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[112+r10],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[128+r10],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[144+r10],xmm2 + movdqa xmm2,xmm4 + + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[160+r10],xmm3 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[176+r10],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[192+r10],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[208+r10],xmm2 + movdqa xmm2,xmm4 + + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[224+r10],xmm3 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[240+r10],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[256+r10],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[272+r10],xmm2 + movdqa xmm2,xmm4 + + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[288+r10],xmm3 + movdqa xmm3,xmm4 +DB 067h + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[304+r10],xmm0 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[320+r10],xmm1 + + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[336+r10],xmm2 + + pand xmm0,XMMWORD PTR[64+rdi] + pand xmm1,XMMWORD PTR[80+rdi] + pand xmm2,XMMWORD PTR[96+rdi] + movdqa XMMWORD PTR[352+r10],xmm3 + pand xmm3,XMMWORD PTR[112+rdi] + por xmm0,xmm2 + por xmm1,xmm3 + movdqa xmm4,XMMWORD PTR[((-128))+rdi] + movdqa xmm5,XMMWORD PTR[((-112))+rdi] + movdqa xmm2,XMMWORD PTR[((-96))+rdi] + pand xmm4,XMMWORD PTR[112+r10] + movdqa xmm3,XMMWORD PTR[((-80))+rdi] + pand xmm5,XMMWORD PTR[128+r10] + por xmm0,xmm4 + pand xmm2,XMMWORD PTR[144+r10] + por xmm1,xmm5 + pand xmm3,XMMWORD PTR[160+r10] + por xmm0,xmm2 + por xmm1,xmm3 + movdqa xmm4,XMMWORD PTR[((-64))+rdi] + movdqa xmm5,XMMWORD PTR[((-48))+rdi] + movdqa xmm2,XMMWORD PTR[((-32))+rdi] + pand xmm4,XMMWORD PTR[176+r10] + movdqa xmm3,XMMWORD PTR[((-16))+rdi] + pand xmm5,XMMWORD PTR[192+r10] + por xmm0,xmm4 + pand xmm2,XMMWORD PTR[208+r10] + por xmm1,xmm5 + pand xmm3,XMMWORD PTR[224+r10] + por xmm0,xmm2 + por xmm1,xmm3 + movdqa xmm4,XMMWORD PTR[rdi] + movdqa xmm5,XMMWORD PTR[16+rdi] + movdqa xmm2,XMMWORD PTR[32+rdi] + pand xmm4,XMMWORD PTR[240+r10] + movdqa xmm3,XMMWORD PTR[48+rdi] + pand xmm5,XMMWORD PTR[256+r10] + por xmm0,xmm4 + pand xmm2,XMMWORD PTR[272+r10] + por xmm1,xmm5 + pand xmm3,XMMWORD PTR[288+r10] + por xmm0,xmm2 + por xmm1,xmm3 + pxor xmm0,xmm1 + pshufd xmm1,xmm0,04eh + por xmm0,xmm1 + lea rdi,QWORD PTR[256+rdi] DB 102,72,15,126,194 - movq xmm0,QWORD PTR[96+rbx] - lea rdi,QWORD PTR[512+rdi] - pand xmm2,xmm5 -DB 067h,067h - pand xmm3,xmm6 - - - - - - - - lea rbx,QWORD PTR[((64+32+8))+r11*8+rsp] + lea rbx,QWORD PTR[((64+32+8))+rsp] mov r9,rdx mulx rax,r8,QWORD PTR[rsi] @@ -2030,37 +2432,31 @@ DB 067h,067h xor rbp,rbp mov rdx,r8 - por xmm1,xmm2 - pand xmm0,xmm7 - por xmm1,xmm3 mov QWORD PTR[((8+8))+rsp],rdi - por xmm0,xmm1 -DB 048h,08dh,0b6h,020h,000h,000h,000h + lea rsi,QWORD PTR[32+rsi] adcx r13,rax adcx r14,rbp mulx r10,rax,QWORD PTR[rcx] adcx r15,rax adox r10,r11 - mulx r11,rax,QWORD PTR[16+rcx] + mulx r11,rax,QWORD PTR[8+rcx] adcx r10,rax adox r11,r12 - mulx r12,rax,QWORD PTR[32+rcx] + mulx r12,rax,QWORD PTR[16+rcx] mov rdi,QWORD PTR[((24+8))+rsp] -DB 066h mov QWORD PTR[((-32))+rbx],r10 adcx r11,rax adox r12,r13 - mulx r15,rax,QWORD PTR[48+rcx] -DB 067h,067h + mulx r15,rax,QWORD PTR[24+rcx] mov rdx,r9 mov QWORD PTR[((-24))+rbx],r11 adcx r12,rax adox r15,rbp -DB 048h,08dh,089h,040h,000h,000h,000h + lea rcx,QWORD PTR[32+rcx] mov QWORD PTR[((-16))+rbx],r12 - + jmp $L$mulx4x_1st ALIGN 32 $L$mulx4x_1st:: @@ -2083,27 +2479,26 @@ DB 067h,067h mulx r15,rax,QWORD PTR[rcx] adcx r10,rax adox r11,r15 - mulx r15,rax,QWORD PTR[16+rcx] + mulx r15,rax,QWORD PTR[8+rcx] adcx r11,rax adox r12,r15 - mulx r15,rax,QWORD PTR[32+rcx] + mulx r15,rax,QWORD PTR[16+rcx] mov QWORD PTR[((-40))+rbx],r10 adcx r12,rax mov QWORD PTR[((-32))+rbx],r11 adox r13,r15 - mulx r15,rax,QWORD PTR[48+rcx] + mulx r15,rax,QWORD PTR[24+rcx] mov rdx,r9 mov QWORD PTR[((-24))+rbx],r12 adcx r13,rax adox r15,rbp - lea rcx,QWORD PTR[64+rcx] + lea rcx,QWORD PTR[32+rcx] mov QWORD PTR[((-16))+rbx],r13 dec rdi jnz $L$mulx4x_1st mov rax,QWORD PTR[8+rsp] -DB 102,72,15,126,194 adc r15,rbp lea rsi,QWORD PTR[rax*1+rsi] add r14,r15 @@ -2114,6 +2509,64 @@ DB 102,72,15,126,194 ALIGN 32 $L$mulx4x_outer:: + lea r10,QWORD PTR[((16-256))+rbx] + pxor xmm4,xmm4 +DB 067h,067h + pxor xmm5,xmm5 + movdqa xmm0,XMMWORD PTR[((-128))+rdi] + movdqa xmm1,XMMWORD PTR[((-112))+rdi] + movdqa xmm2,XMMWORD PTR[((-96))+rdi] + pand xmm0,XMMWORD PTR[256+r10] + movdqa xmm3,XMMWORD PTR[((-80))+rdi] + pand xmm1,XMMWORD PTR[272+r10] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[288+r10] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[304+r10] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[((-64))+rdi] + movdqa xmm1,XMMWORD PTR[((-48))+rdi] + movdqa xmm2,XMMWORD PTR[((-32))+rdi] + pand xmm0,XMMWORD PTR[320+r10] + movdqa xmm3,XMMWORD PTR[((-16))+rdi] + pand xmm1,XMMWORD PTR[336+r10] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[352+r10] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[368+r10] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[rdi] + movdqa xmm1,XMMWORD PTR[16+rdi] + movdqa xmm2,XMMWORD PTR[32+rdi] + pand xmm0,XMMWORD PTR[384+r10] + movdqa xmm3,XMMWORD PTR[48+rdi] + pand xmm1,XMMWORD PTR[400+r10] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[416+r10] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[432+r10] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[64+rdi] + movdqa xmm1,XMMWORD PTR[80+rdi] + movdqa xmm2,XMMWORD PTR[96+rdi] + pand xmm0,XMMWORD PTR[448+r10] + movdqa xmm3,XMMWORD PTR[112+rdi] + pand xmm1,XMMWORD PTR[464+r10] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[480+r10] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[496+r10] + por xmm4,xmm2 + por xmm5,xmm3 + por xmm4,xmm5 + pshufd xmm0,xmm4,04eh + por xmm0,xmm4 + lea rdi,QWORD PTR[256+rdi] +DB 102,72,15,126,194 + mov QWORD PTR[rbx],rbp lea rbx,QWORD PTR[32+rax*1+rbx] mulx r11,r8,QWORD PTR[rsi] @@ -2128,54 +2581,37 @@ $L$mulx4x_outer:: mulx r14,rdx,QWORD PTR[24+rsi] adox r12,QWORD PTR[((-16))+rbx] adcx r13,rdx - lea rcx,QWORD PTR[rax*2+rcx] + lea rcx,QWORD PTR[rax*1+rcx] lea rsi,QWORD PTR[32+rsi] adox r13,QWORD PTR[((-8))+rbx] adcx r14,rbp adox r14,rbp -DB 067h mov r15,r8 imul r8,QWORD PTR[((32+8))+rsp] - movq xmm0,QWORD PTR[((-96))+rdi] -DB 067h,067h mov rdx,r8 - movq xmm1,QWORD PTR[((-32))+rdi] -DB 067h - pand xmm0,xmm4 - movq xmm2,QWORD PTR[32+rdi] -DB 067h - pand xmm1,xmm5 - movq xmm3,QWORD PTR[96+rdi] - add rdi,256 -DB 067h - pand xmm2,xmm6 - por xmm0,xmm1 - pand xmm3,xmm7 xor rbp,rbp mov QWORD PTR[((8+8))+rsp],rdi mulx r10,rax,QWORD PTR[rcx] adcx r15,rax adox r10,r11 - mulx r11,rax,QWORD PTR[16+rcx] + mulx r11,rax,QWORD PTR[8+rcx] adcx r10,rax adox r11,r12 - mulx r12,rax,QWORD PTR[32+rcx] + mulx r12,rax,QWORD PTR[16+rcx] adcx r11,rax adox r12,r13 - mulx r15,rax,QWORD PTR[48+rcx] + mulx r15,rax,QWORD PTR[24+rcx] mov rdx,r9 - por xmm0,xmm2 mov rdi,QWORD PTR[((24+8))+rsp] mov QWORD PTR[((-32))+rbx],r10 - por xmm0,xmm3 adcx r12,rax mov QWORD PTR[((-24))+rbx],r11 adox r15,rbp mov QWORD PTR[((-16))+rbx],r12 - lea rcx,QWORD PTR[64+rcx] + lea rcx,QWORD PTR[32+rcx] jmp $L$mulx4x_inner ALIGN 32 @@ -2203,17 +2639,17 @@ $L$mulx4x_inner:: mulx r15,rax,QWORD PTR[rcx] adcx r10,rax adox r11,r15 - mulx r15,rax,QWORD PTR[16+rcx] + mulx r15,rax,QWORD PTR[8+rcx] adcx r11,rax adox r12,r15 - mulx r15,rax,QWORD PTR[32+rcx] + mulx r15,rax,QWORD PTR[16+rcx] mov QWORD PTR[((-40))+rbx],r10 adcx r12,rax adox r13,r15 mov QWORD PTR[((-32))+rbx],r11 - mulx r15,rax,QWORD PTR[48+rcx] + mulx r15,rax,QWORD PTR[24+rcx] mov rdx,r9 - lea rcx,QWORD PTR[64+rcx] + lea rcx,QWORD PTR[32+rcx] mov QWORD PTR[((-24))+rbx],r12 adcx r13,rax adox r15,rbp @@ -2223,7 +2659,6 @@ $L$mulx4x_inner:: jnz $L$mulx4x_inner mov rax,QWORD PTR[((0+8))+rsp] -DB 102,72,15,126,194 adc r15,rbp sub rdi,QWORD PTR[rbx] mov rdi,QWORD PTR[((8+8))+rsp] @@ -2236,20 +2671,26 @@ DB 102,72,15,126,194 cmp rdi,r10 jb $L$mulx4x_outer - mov r10,QWORD PTR[((-16))+rcx] + mov r10,QWORD PTR[((-8))+rcx] + mov r8,rbp + mov r12,QWORD PTR[rax*1+rcx] + lea rbp,QWORD PTR[rax*1+rcx] + mov rcx,rax + lea rdi,QWORD PTR[rax*1+rbx] + xor eax,eax xor r15,r15 sub r10,r14 adc r15,r15 - or rbp,r15 - xor rbp,1 - lea rdi,QWORD PTR[rax*1+rbx] - lea rcx,QWORD PTR[rax*2+rcx] -DB 067h,067h - sar rax,3+2 - lea rbp,QWORD PTR[rbp*8+rcx] + or r8,r15 + sar rcx,3+2 + sub rax,r8 mov rdx,QWORD PTR[((56+8))+rsp] - mov rcx,rax - jmp $L$sqrx4x_sub + dec r12 + mov r13,QWORD PTR[8+rbp] + xor r8,r8 + mov r14,QWORD PTR[16+rbp] + mov r15,QWORD PTR[24+rbp] + jmp $L$sqrx4x_sub_entry mulx4x_internal ENDP ALIGN 32 @@ -2267,7 +2708,6 @@ $L$SEH_begin_bn_powerx5:: $L$powerx5_enter:: -DB 067h mov rax,rsp push rbx push rbp @@ -2275,13 +2715,9 @@ DB 067h push r13 push r14 push r15 - lea rsp,QWORD PTR[((-40))+rsp] - movaps XMMWORD PTR[rsp],xmm6 - movaps XMMWORD PTR[16+rsp],xmm7 -DB 067h - mov r10d,r9d + shl r9d,3 - shl r10d,3+2 + lea r10,QWORD PTR[r9*2+r9] neg r9 mov r8,QWORD PTR[r8] @@ -2291,25 +2727,35 @@ DB 067h - lea r11,QWORD PTR[((-64))+r9*2+rsp] - sub r11,rsi + + lea r11,QWORD PTR[((-320))+r9*2+rsp] + sub r11,rdi and r11,4095 cmp r10,r11 jb $L$pwrx_sp_alt sub rsp,r11 - lea rsp,QWORD PTR[((-64))+r9*2+rsp] + lea rsp,QWORD PTR[((-320))+r9*2+rsp] jmp $L$pwrx_sp_done ALIGN 32 $L$pwrx_sp_alt:: - lea r10,QWORD PTR[((4096-64))+r9*2] - lea rsp,QWORD PTR[((-64))+r9*2+rsp] + lea r10,QWORD PTR[((4096-320))+r9*2] + lea rsp,QWORD PTR[((-320))+r9*2+rsp] sub r11,r10 mov r10,0 cmovc r11,r10 sub rsp,r11 $L$pwrx_sp_done:: and rsp,-64 + mov r11,rax + sub r11,rsp + and r11,-4096 +$L$pwrx_page_walk:: + mov r10,QWORD PTR[r11*1+rsp] + sub r11,4096 +DB 02eh + jnc $L$pwrx_page_walk + mov r10,r9 neg r9 @@ -2334,10 +2780,15 @@ DB 102,72,15,110,226 $L$powerx5_body:: call __bn_sqrx8x_internal + call __bn_postx4x_internal call __bn_sqrx8x_internal + call __bn_postx4x_internal call __bn_sqrx8x_internal + call __bn_postx4x_internal call __bn_sqrx8x_internal + call __bn_postx4x_internal call __bn_sqrx8x_internal + call __bn_postx4x_internal mov r9,r10 mov rdi,rsi @@ -2349,8 +2800,7 @@ DB 102,72,15,126,226 mov rsi,QWORD PTR[40+rsp] mov rax,1 - movaps xmm6,XMMWORD PTR[((-88))+rsi] - movaps xmm7,XMMWORD PTR[((-72))+rsi] + mov r15,QWORD PTR[((-48))+rsi] mov r14,QWORD PTR[((-40))+rsi] mov r13,QWORD PTR[((-32))+rsi] @@ -2766,11 +3216,11 @@ $L$sqrx4x_shift_n_add_break:: mov QWORD PTR[56+rdi],rbx lea rdi,QWORD PTR[64+rdi] DB 102,72,15,126,213 -sqrx8x_reduction:: +__bn_sqrx8x_reduction:: xor eax,eax mov rbx,QWORD PTR[((32+8))+rsp] mov rdx,QWORD PTR[((48+8))+rsp] - lea rcx,QWORD PTR[((-128))+r9*2+rbp] + lea rcx,QWORD PTR[((-64))+r9*1+rbp] mov QWORD PTR[((0+8))+rsp],rcx mov QWORD PTR[((8+8))+rsp],rdi @@ -2803,19 +3253,19 @@ $L$sqrx8x_reduce:: adcx rax,rbx adox r8,r9 - mulx r9,rbx,QWORD PTR[16+rbp] + mulx r9,rbx,QWORD PTR[8+rbp] adcx r8,rbx adox r9,r10 - mulx r10,rbx,QWORD PTR[32+rbp] + mulx r10,rbx,QWORD PTR[16+rbp] adcx r9,rbx adox r10,r11 - mulx r11,rbx,QWORD PTR[48+rbp] + mulx r11,rbx,QWORD PTR[24+rbp] adcx r10,rbx adox r11,r12 -DB 0c4h,062h,0e3h,0f6h,0a5h,040h,000h,000h,000h +DB 0c4h,062h,0e3h,0f6h,0a5h,020h,000h,000h,000h mov rax,rdx mov rdx,r8 adcx r11,rbx @@ -2825,15 +3275,15 @@ DB 0c4h,062h,0e3h,0f6h,0a5h,040h,000h,000h,000h mov rdx,rax mov QWORD PTR[((64+48+8))+rcx*8+rsp],rax - mulx r13,rax,QWORD PTR[80+rbp] + mulx r13,rax,QWORD PTR[40+rbp] adcx r12,rax adox r13,r14 - mulx r14,rax,QWORD PTR[96+rbp] + mulx r14,rax,QWORD PTR[48+rbp] adcx r13,rax adox r14,r15 - mulx r15,rax,QWORD PTR[112+rbp] + mulx r15,rax,QWORD PTR[56+rbp] mov rdx,rbx adcx r14,rax adox r15,rsi @@ -2849,7 +3299,7 @@ DB 067h,067h,067h mov rdx,QWORD PTR[((48+8))+rsp] add r8,QWORD PTR[rdi] - lea rbp,QWORD PTR[128+rbp] + lea rbp,QWORD PTR[64+rbp] mov rcx,-8 adcx r9,QWORD PTR[8+rdi] adcx r10,QWORD PTR[16+rdi] @@ -2872,31 +3322,31 @@ $L$sqrx8x_tail:: adcx rbx,rax adox r8,r9 - mulx r9,rax,QWORD PTR[16+rbp] + mulx r9,rax,QWORD PTR[8+rbp] adcx r8,rax adox r9,r10 - mulx r10,rax,QWORD PTR[32+rbp] + mulx r10,rax,QWORD PTR[16+rbp] adcx r9,rax adox r10,r11 - mulx r11,rax,QWORD PTR[48+rbp] + mulx r11,rax,QWORD PTR[24+rbp] adcx r10,rax adox r11,r12 -DB 0c4h,062h,0fbh,0f6h,0a5h,040h,000h,000h,000h +DB 0c4h,062h,0fbh,0f6h,0a5h,020h,000h,000h,000h adcx r11,rax adox r12,r13 - mulx r13,rax,QWORD PTR[80+rbp] + mulx r13,rax,QWORD PTR[40+rbp] adcx r12,rax adox r13,r14 - mulx r14,rax,QWORD PTR[96+rbp] + mulx r14,rax,QWORD PTR[48+rbp] adcx r13,rax adox r14,r15 - mulx r15,rax,QWORD PTR[112+rbp] + mulx r15,rax,QWORD PTR[56+rbp] mov rdx,QWORD PTR[((72+48+8))+rcx*8+rsp] adcx r14,rax adox r15,rsi @@ -2912,7 +3362,7 @@ DB 0c4h,062h,0fbh,0f6h,0a5h,040h,000h,000h,000h sub rsi,QWORD PTR[((16+8))+rsp] mov rdx,QWORD PTR[((48+8))+rsp] - lea rbp,QWORD PTR[128+rbp] + lea rbp,QWORD PTR[64+rbp] adc r8,QWORD PTR[rdi] adc r9,QWORD PTR[8+rdi] adc r10,QWORD PTR[16+rdi] @@ -2948,7 +3398,7 @@ $L$sqrx8x_no_tail:: adc r8,QWORD PTR[rdi] DB 102,72,15,126,217 adc r9,QWORD PTR[8+rdi] - mov rsi,QWORD PTR[112+rbp] + mov rsi,QWORD PTR[56+rbp] DB 102,72,15,126,213 adc r10,QWORD PTR[16+rdi] adc r11,QWORD PTR[24+rdi] @@ -2974,45 +3424,58 @@ DB 102,72,15,126,213 lea rdi,QWORD PTR[64+rcx*1+rdi] cmp r8,QWORD PTR[((8+8))+rsp] jb $L$sqrx8x_reduction_loop - xor ebx,ebx - sub rsi,r15 - adc rbx,rbx + DB 0F3h,0C3h ;repret +bn_sqrx8x_internal ENDP +ALIGN 32 +__bn_postx4x_internal:: + mov r12,QWORD PTR[rbp] mov r10,rcx - or rax,rbx mov r9,rcx - xor rax,1 + neg rax sar rcx,3+2 - lea rbp,QWORD PTR[rax*8+rbp] DB 102,72,15,126,202 DB 102,72,15,126,206 - jmp $L$sqrx4x_sub + dec r12 + mov r13,QWORD PTR[8+rbp] + xor r8,r8 + mov r14,QWORD PTR[16+rbp] + mov r15,QWORD PTR[24+rbp] + jmp $L$sqrx4x_sub_entry -ALIGN 32 +ALIGN 16 $L$sqrx4x_sub:: -DB 066h - mov r12,QWORD PTR[rdi] - mov r13,QWORD PTR[8+rdi] - sbb r12,QWORD PTR[rbp] - mov r14,QWORD PTR[16+rdi] - sbb r13,QWORD PTR[16+rbp] - mov r15,QWORD PTR[24+rdi] - lea rdi,QWORD PTR[32+rdi] - sbb r14,QWORD PTR[32+rbp] + mov r12,QWORD PTR[rbp] + mov r13,QWORD PTR[8+rbp] + mov r14,QWORD PTR[16+rbp] + mov r15,QWORD PTR[24+rbp] +$L$sqrx4x_sub_entry:: + andn r12,r12,rax + lea rbp,QWORD PTR[32+rbp] + andn r13,r13,rax + andn r14,r14,rax + andn r15,r15,rax + + neg r8 + adc r12,QWORD PTR[rdi] + adc r13,QWORD PTR[8+rdi] + adc r14,QWORD PTR[16+rdi] + adc r15,QWORD PTR[24+rdi] mov QWORD PTR[rdx],r12 - sbb r15,QWORD PTR[48+rbp] - lea rbp,QWORD PTR[64+rbp] + lea rdi,QWORD PTR[32+rdi] mov QWORD PTR[8+rdx],r13 + sbb r8,r8 mov QWORD PTR[16+rdx],r14 mov QWORD PTR[24+rdx],r15 lea rdx,QWORD PTR[32+rdx] inc rcx jnz $L$sqrx4x_sub + neg r9 DB 0F3h,0C3h ;repret -bn_sqrx8x_internal ENDP + PUBLIC bn_get_bits5 ALIGN 16 @@ -3052,55 +3515,171 @@ bn_scatter5 ENDP PUBLIC bn_gather5 -ALIGN 16 +ALIGN 32 bn_gather5 PROC PUBLIC $L$SEH_begin_bn_gather5:: -DB 048h,083h,0ech,028h -DB 00fh,029h,034h,024h -DB 00fh,029h,07ch,024h,010h - mov r11d,r9d - shr r9d,3 - and r11,7 - not r9d - lea rax,QWORD PTR[$L$magic_masks] - and r9d,3 - lea r8,QWORD PTR[128+r11*8+r8] - movq xmm4,QWORD PTR[r9*8+rax] - movq xmm5,QWORD PTR[8+r9*8+rax] - movq xmm6,QWORD PTR[16+r9*8+rax] - movq xmm7,QWORD PTR[24+r9*8+rax] +DB 04ch,08dh,014h,024h +DB 048h,081h,0ech,008h,001h,000h,000h + lea rax,QWORD PTR[$L$inc] + and rsp,-16 + + movd xmm5,r9d + movdqa xmm0,XMMWORD PTR[rax] + movdqa xmm1,XMMWORD PTR[16+rax] + lea r11,QWORD PTR[128+r8] + lea rax,QWORD PTR[128+rsp] + + pshufd xmm5,xmm5,0 + movdqa xmm4,xmm1 + movdqa xmm2,xmm1 + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa xmm3,xmm4 + + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[(-128)+rax],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[(-112)+rax],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[(-96)+rax],xmm2 + movdqa xmm2,xmm4 + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[(-80)+rax],xmm3 + movdqa xmm3,xmm4 + + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[(-64)+rax],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[(-48)+rax],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[(-32)+rax],xmm2 + movdqa xmm2,xmm4 + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[(-16)+rax],xmm3 + movdqa xmm3,xmm4 + + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[rax],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[16+rax],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[32+rax],xmm2 + movdqa xmm2,xmm4 + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[48+rax],xmm3 + movdqa xmm3,xmm4 + + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[64+rax],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[80+rax],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[96+rax],xmm2 + movdqa xmm2,xmm4 + movdqa XMMWORD PTR[112+rax],xmm3 jmp $L$gather -ALIGN 16 -$L$gather:: - movq xmm0,QWORD PTR[((-128))+r8] - movq xmm1,QWORD PTR[((-64))+r8] - pand xmm0,xmm4 - movq xmm2,QWORD PTR[r8] - pand xmm1,xmm5 - movq xmm3,QWORD PTR[64+r8] - pand xmm2,xmm6 - por xmm0,xmm1 - pand xmm3,xmm7 -DB 067h,067h - por xmm0,xmm2 - lea r8,QWORD PTR[256+r8] - por xmm0,xmm3 +ALIGN 32 +$L$gather:: + pxor xmm4,xmm4 + pxor xmm5,xmm5 + movdqa xmm0,XMMWORD PTR[((-128))+r11] + movdqa xmm1,XMMWORD PTR[((-112))+r11] + movdqa xmm2,XMMWORD PTR[((-96))+r11] + pand xmm0,XMMWORD PTR[((-128))+rax] + movdqa xmm3,XMMWORD PTR[((-80))+r11] + pand xmm1,XMMWORD PTR[((-112))+rax] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[((-96))+rax] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[((-80))+rax] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[((-64))+r11] + movdqa xmm1,XMMWORD PTR[((-48))+r11] + movdqa xmm2,XMMWORD PTR[((-32))+r11] + pand xmm0,XMMWORD PTR[((-64))+rax] + movdqa xmm3,XMMWORD PTR[((-16))+r11] + pand xmm1,XMMWORD PTR[((-48))+rax] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[((-32))+rax] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[((-16))+rax] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[r11] + movdqa xmm1,XMMWORD PTR[16+r11] + movdqa xmm2,XMMWORD PTR[32+r11] + pand xmm0,XMMWORD PTR[rax] + movdqa xmm3,XMMWORD PTR[48+r11] + pand xmm1,XMMWORD PTR[16+rax] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[32+rax] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[48+rax] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[64+r11] + movdqa xmm1,XMMWORD PTR[80+r11] + movdqa xmm2,XMMWORD PTR[96+r11] + pand xmm0,XMMWORD PTR[64+rax] + movdqa xmm3,XMMWORD PTR[112+r11] + pand xmm1,XMMWORD PTR[80+rax] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[96+rax] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[112+rax] + por xmm4,xmm2 + por xmm5,xmm3 + por xmm4,xmm5 + lea r11,QWORD PTR[256+r11] + pshufd xmm0,xmm4,04eh + por xmm0,xmm4 movq QWORD PTR[rcx],xmm0 lea rcx,QWORD PTR[8+rcx] sub edx,1 jnz $L$gather - movaps xmm6,XMMWORD PTR[rsp] - movaps xmm7,XMMWORD PTR[16+rsp] - lea rsp,QWORD PTR[40+rsp] + + lea rsp,QWORD PTR[r10] DB 0F3h,0C3h ;repret $L$SEH_end_bn_gather5:: bn_gather5 ENDP ALIGN 64 -$L$magic_masks:: - DD 0,0,0,0,0,0,-1,-1 - DD 0,0,0,0,0,0,0,0 +$L$inc:: + DD 0,0,1,1 + DD 2,2,2,2 DB 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105 DB 112,108,105,99,97,116,105,111,110,32,119,105,116,104,32,115 DB 99,97,116,116,101,114,47,103,97,116,104,101,114,32,102,111 @@ -3142,19 +3721,16 @@ mul_handler PROC PRIVATE lea r10,QWORD PTR[$L$mul_epilogue] cmp rbx,r10 - jb $L$body_40 + ja $L$body_40 mov r10,QWORD PTR[192+r8] mov rax,QWORD PTR[8+r10*8+rax] + jmp $L$body_proceed $L$body_40:: mov rax,QWORD PTR[40+rax] $L$body_proceed:: - - movaps xmm0,XMMWORD PTR[((-88))+rax] - movaps xmm1,XMMWORD PTR[((-72))+rax] - mov rbx,QWORD PTR[((-8))+rax] mov rbp,QWORD PTR[((-16))+rax] mov r12,QWORD PTR[((-24))+rax] @@ -3167,8 +3743,6 @@ $L$body_proceed:: mov QWORD PTR[224+r8],r13 mov QWORD PTR[232+r8],r14 mov QWORD PTR[240+r8],r15 - movups XMMWORD PTR[512+r8],xmm0 - movups XMMWORD PTR[528+r8],xmm1 $L$common_seh_tail:: mov rdi,QWORD PTR[8+rax] @@ -3273,10 +3847,9 @@ DB 9,0,0,0 DD imagerel $L$powerx5_body,imagerel $L$powerx5_epilogue ALIGN 8 $L$SEH_info_bn_gather5:: -DB 001h,00dh,005h,000h -DB 00dh,078h,001h,000h -DB 008h,068h,000h,000h -DB 004h,042h,000h,000h +DB 001h,00bh,003h,00ah +DB 00bh,001h,021h,000h +DB 004h,0a3h,000h,000h ALIGN 8 .xdata ENDS diff --git a/vendor/openssl/asm/x64-win32-masm/ec/ecp_nistz256-x86_64.asm b/vendor/openssl/asm/x64-win32-masm/ec/ecp_nistz256-x86_64.asm index 3fa69816b..f38d253c1 100644 --- a/vendor/openssl/asm/x64-win32-masm/ec/ecp_nistz256-x86_64.asm +++ b/vendor/openssl/asm/x64-win32-masm/ec/ecp_nistz256-x86_64.asm @@ -1813,6 +1813,7 @@ $L$SEH_begin_ecp_nistz256_point_double:: push r15 sub rsp,32*5+8 +$L$point_double_shortcutq:: movdqu xmm0,XMMWORD PTR[rsi] mov rbx,rsi movdqu xmm1,XMMWORD PTR[16+rsi] @@ -2091,6 +2092,7 @@ DB 102,72,15,110,199 mov r14,QWORD PTR[((64+8))+rbx] mov r15,QWORD PTR[((64+16))+rbx] mov r8,QWORD PTR[((64+24))+rbx] +DB 102,72,15,110,203 lea rsi,QWORD PTR[((64-0))+rbx] lea rdi,QWORD PTR[32+rsp] @@ -2182,7 +2184,7 @@ DB 102,73,15,126,217 test r8,r8 jnz $L$add_proceedq test r9,r9 - jz $L$add_proceedq + jz $L$add_doubleq DB 102,72,15,126,199 pxor xmm0,xmm0 @@ -2194,6 +2196,13 @@ DB 102,72,15,126,199 movdqu XMMWORD PTR[80+rdi],xmm0 jmp $L$add_doneq +ALIGN 32 +$L$add_doubleq:: +DB 102,72,15,126,206 +DB 102,72,15,126,199 + add rsp,416 + jmp $L$point_double_shortcutq + ALIGN 32 $L$add_proceedq:: mov rax,QWORD PTR[((0+64))+rsp] @@ -2876,6 +2885,7 @@ $L$point_doublex:: push r15 sub rsp,32*5+8 +$L$point_double_shortcutx:: movdqu xmm0,XMMWORD PTR[rsi] mov rbx,rsi movdqu xmm1,XMMWORD PTR[16+rsi] @@ -3150,6 +3160,7 @@ DB 102,72,15,110,199 mov r14,QWORD PTR[((64+8))+rbx] mov r15,QWORD PTR[((64+16))+rbx] mov r8,QWORD PTR[((64+24))+rbx] +DB 102,72,15,110,203 lea rsi,QWORD PTR[((64-128))+rbx] lea rdi,QWORD PTR[32+rsp] @@ -3241,7 +3252,7 @@ DB 102,73,15,126,217 test r8,r8 jnz $L$add_proceedx test r9,r9 - jz $L$add_proceedx + jz $L$add_doublex DB 102,72,15,126,199 pxor xmm0,xmm0 @@ -3253,6 +3264,13 @@ DB 102,72,15,126,199 movdqu XMMWORD PTR[80+rdi],xmm0 jmp $L$add_donex +ALIGN 32 +$L$add_doublex:: +DB 102,72,15,126,206 +DB 102,72,15,126,199 + add rsp,416 + jmp $L$point_double_shortcutx + ALIGN 32 $L$add_proceedx:: mov rdx,QWORD PTR[((0+64))+rsp] diff --git a/vendor/openssl/asm/x64-win32-masm/modes/aesni-gcm-x86_64.asm b/vendor/openssl/asm/x64-win32-masm/modes/aesni-gcm-x86_64.asm index 0626d8f78..6552f7d01 100644 --- a/vendor/openssl/asm/x64-win32-masm/modes/aesni-gcm-x86_64.asm +++ b/vendor/openssl/asm/x64-win32-masm/modes/aesni-gcm-x86_64.asm @@ -412,7 +412,7 @@ $L$dec_no_key_aliasing:: vzeroupper movaps xmm6,XMMWORD PTR[((-216))+rax] - movaps xmm7,XMMWORD PTR[((-216))+rax] + movaps xmm7,XMMWORD PTR[((-200))+rax] movaps xmm8,XMMWORD PTR[((-184))+rax] movaps xmm9,XMMWORD PTR[((-168))+rax] movaps xmm10,XMMWORD PTR[((-152))+rax] diff --git a/vendor/openssl/asm/x86-elf-gas/bn/x86-mont.s b/vendor/openssl/asm/x86-elf-gas/bn/x86-mont.s index 1d815a047..2f7211d92 100644 --- a/vendor/openssl/asm/x86-elf-gas/bn/x86-mont.s +++ b/vendor/openssl/asm/x86-elf-gas/bn/x86-mont.s @@ -29,6 +29,14 @@ bn_mul_mont: xorl $2048,%edx subl %edx,%esp andl $-64,%esp + movl %ebp,%eax + subl %esp,%eax + andl $-4096,%eax +.L001page_walk: + movl (%esp,%eax,1),%edx + subl $4096,%eax +.byte 46 + jnc .L001page_walk movl (%esi),%eax movl 4(%esi),%ebx movl 8(%esi),%ecx @@ -44,7 +52,7 @@ bn_mul_mont: movl %ebp,24(%esp) leal OPENSSL_ia32cap_P,%eax btl $26,(%eax) - jnc .L001non_sse2 + jnc .L002non_sse2 movl $-1,%eax movd %eax,%mm7 movl 8(%esp),%esi @@ -68,7 +76,7 @@ bn_mul_mont: psrlq $32,%mm3 incl %ecx .align 16 -.L0021st: +.L0031st: pmuludq %mm4,%mm0 pmuludq %mm5,%mm1 paddq %mm0,%mm2 @@ -83,7 +91,7 @@ bn_mul_mont: psrlq $32,%mm3 leal 1(%ecx),%ecx cmpl %ebx,%ecx - jl .L0021st + jl .L0031st pmuludq %mm4,%mm0 pmuludq %mm5,%mm1 paddq %mm0,%mm2 @@ -97,7 +105,7 @@ bn_mul_mont: paddq %mm2,%mm3 movq %mm3,32(%esp,%ebx,4) incl %edx -.L003outer: +.L004outer: xorl %ecx,%ecx movd (%edi,%edx,4),%mm4 movd (%esi),%mm5 @@ -119,7 +127,7 @@ bn_mul_mont: paddq %mm6,%mm2 incl %ecx decl %ebx -.L004inner: +.L005inner: pmuludq %mm4,%mm0 pmuludq %mm5,%mm1 paddq %mm0,%mm2 @@ -136,7 +144,7 @@ bn_mul_mont: paddq %mm6,%mm2 decl %ebx leal 1(%ecx),%ecx - jnz .L004inner + jnz .L005inner movl %ecx,%ebx pmuludq %mm4,%mm0 pmuludq %mm5,%mm1 @@ -154,11 +162,11 @@ bn_mul_mont: movq %mm3,32(%esp,%ebx,4) leal 1(%edx),%edx cmpl %ebx,%edx - jle .L003outer + jle .L004outer emms - jmp .L005common_tail + jmp .L006common_tail .align 16 -.L001non_sse2: +.L002non_sse2: movl 8(%esp),%esi leal 1(%ebx),%ebp movl 12(%esp),%edi @@ -169,12 +177,12 @@ bn_mul_mont: leal 4(%edi,%ebx,4),%eax orl %edx,%ebp movl (%edi),%edi - jz .L006bn_sqr_mont + jz .L007bn_sqr_mont movl %eax,28(%esp) movl (%esi),%eax xorl %edx,%edx .align 16 -.L007mull: +.L008mull: movl %edx,%ebp mull %edi addl %eax,%ebp @@ -183,7 +191,7 @@ bn_mul_mont: movl (%esi,%ecx,4),%eax cmpl %ebx,%ecx movl %ebp,28(%esp,%ecx,4) - jl .L007mull + jl .L008mull movl %edx,%ebp mull %edi movl 20(%esp),%edi @@ -201,9 +209,9 @@ bn_mul_mont: movl 4(%esi),%eax adcl $0,%edx incl %ecx - jmp .L0082ndmadd + jmp .L0092ndmadd .align 16 -.L0091stmadd: +.L0101stmadd: movl %edx,%ebp mull %edi addl 32(%esp,%ecx,4),%ebp @@ -214,7 +222,7 @@ bn_mul_mont: adcl $0,%edx cmpl %ebx,%ecx movl %ebp,28(%esp,%ecx,4) - jl .L0091stmadd + jl .L0101stmadd movl %edx,%ebp mull %edi addl 32(%esp,%ebx,4),%eax @@ -237,7 +245,7 @@ bn_mul_mont: adcl $0,%edx movl $1,%ecx .align 16 -.L0082ndmadd: +.L0092ndmadd: movl %edx,%ebp mull %edi addl 32(%esp,%ecx,4),%ebp @@ -248,7 +256,7 @@ bn_mul_mont: adcl $0,%edx cmpl %ebx,%ecx movl %ebp,24(%esp,%ecx,4) - jl .L0082ndmadd + jl .L0092ndmadd movl %edx,%ebp mull %edi addl 32(%esp,%ebx,4),%ebp @@ -264,16 +272,16 @@ bn_mul_mont: movl %edx,32(%esp,%ebx,4) cmpl 28(%esp),%ecx movl %eax,36(%esp,%ebx,4) - je .L005common_tail + je .L006common_tail movl (%ecx),%edi movl 8(%esp),%esi movl %ecx,12(%esp) xorl %ecx,%ecx xorl %edx,%edx movl (%esi),%eax - jmp .L0091stmadd + jmp .L0101stmadd .align 16 -.L006bn_sqr_mont: +.L007bn_sqr_mont: movl %ebx,(%esp) movl %ecx,12(%esp) movl %edi,%eax @@ -284,7 +292,7 @@ bn_mul_mont: andl $1,%ebx incl %ecx .align 16 -.L010sqr: +.L011sqr: movl (%esi,%ecx,4),%eax movl %edx,%ebp mull %edi @@ -296,7 +304,7 @@ bn_mul_mont: cmpl (%esp),%ecx movl %eax,%ebx movl %ebp,28(%esp,%ecx,4) - jl .L010sqr + jl .L011sqr movl (%esi,%ecx,4),%eax movl %edx,%ebp mull %edi @@ -320,7 +328,7 @@ bn_mul_mont: movl 4(%esi),%eax movl $1,%ecx .align 16 -.L0113rdmadd: +.L0123rdmadd: movl %edx,%ebp mull %edi addl 32(%esp,%ecx,4),%ebp @@ -339,7 +347,7 @@ bn_mul_mont: adcl $0,%edx cmpl %ebx,%ecx movl %ebp,24(%esp,%ecx,4) - jl .L0113rdmadd + jl .L0123rdmadd movl %edx,%ebp mull %edi addl 32(%esp,%ebx,4),%ebp @@ -355,7 +363,7 @@ bn_mul_mont: movl %edx,32(%esp,%ebx,4) cmpl %ebx,%ecx movl %eax,36(%esp,%ebx,4) - je .L005common_tail + je .L006common_tail movl 4(%esi,%ecx,4),%edi leal 1(%ecx),%ecx movl %edi,%eax @@ -367,12 +375,12 @@ bn_mul_mont: xorl %ebp,%ebp cmpl %ebx,%ecx leal 1(%ecx),%ecx - je .L012sqrlast + je .L013sqrlast movl %edx,%ebx shrl $1,%edx andl $1,%ebx .align 16 -.L013sqradd: +.L014sqradd: movl (%esi,%ecx,4),%eax movl %edx,%ebp mull %edi @@ -388,13 +396,13 @@ bn_mul_mont: cmpl (%esp),%ecx movl %ebp,28(%esp,%ecx,4) movl %eax,%ebx - jle .L013sqradd + jle .L014sqradd movl %edx,%ebp addl %edx,%edx shrl $31,%ebp addl %ebx,%edx adcl $0,%ebp -.L012sqrlast: +.L013sqrlast: movl 20(%esp),%edi movl 16(%esp),%esi imull 32(%esp),%edi @@ -409,9 +417,9 @@ bn_mul_mont: adcl $0,%edx movl $1,%ecx movl 4(%esi),%eax - jmp .L0113rdmadd + jmp .L0123rdmadd .align 16 -.L005common_tail: +.L006common_tail: movl 16(%esp),%ebp movl 4(%esp),%edi leal 32(%esp),%esi @@ -419,13 +427,13 @@ bn_mul_mont: movl %ebx,%ecx xorl %edx,%edx .align 16 -.L014sub: +.L015sub: sbbl (%ebp,%edx,4),%eax movl %eax,(%edi,%edx,4) decl %ecx movl 4(%esi,%edx,4),%eax leal 1(%edx),%edx - jge .L014sub + jge .L015sub sbbl $0,%eax andl %eax,%esi notl %eax @@ -433,12 +441,12 @@ bn_mul_mont: andl %eax,%ebp orl %ebp,%esi .align 16 -.L015copy: +.L016copy: movl (%esi,%ebx,4),%eax movl %eax,(%edi,%ebx,4) movl %ecx,32(%esp,%ebx,4) decl %ebx - jge .L015copy + jge .L016copy movl 24(%esp),%esp movl $1,%eax .L000just_leave: diff --git a/vendor/openssl/asm/x86-macosx-gas/bn/x86-mont.s b/vendor/openssl/asm/x86-macosx-gas/bn/x86-mont.s index b544a46c6..accec0e51 100644 --- a/vendor/openssl/asm/x86-macosx-gas/bn/x86-mont.s +++ b/vendor/openssl/asm/x86-macosx-gas/bn/x86-mont.s @@ -28,6 +28,14 @@ L_bn_mul_mont_begin: xorl $2048,%edx subl %edx,%esp andl $-64,%esp + movl %ebp,%eax + subl %esp,%eax + andl $-4096,%eax +L001page_walk: + movl (%esp,%eax,1),%edx + subl $4096,%eax +.byte 46 + jnc L001page_walk movl (%esi),%eax movl 4(%esi),%ebx movl 8(%esi),%ecx @@ -41,12 +49,12 @@ L_bn_mul_mont_begin: movl %esi,20(%esp) leal -3(%edi),%ebx movl %ebp,24(%esp) - call L001PIC_me_up -L001PIC_me_up: + call L002PIC_me_up +L002PIC_me_up: popl %eax - movl L_OPENSSL_ia32cap_P$non_lazy_ptr-L001PIC_me_up(%eax),%eax + movl L_OPENSSL_ia32cap_P$non_lazy_ptr-L002PIC_me_up(%eax),%eax btl $26,(%eax) - jnc L002non_sse2 + jnc L003non_sse2 movl $-1,%eax movd %eax,%mm7 movl 8(%esp),%esi @@ -70,7 +78,7 @@ L001PIC_me_up: psrlq $32,%mm3 incl %ecx .align 4,0x90 -L0031st: +L0041st: pmuludq %mm4,%mm0 pmuludq %mm5,%mm1 paddq %mm0,%mm2 @@ -85,7 +93,7 @@ L0031st: psrlq $32,%mm3 leal 1(%ecx),%ecx cmpl %ebx,%ecx - jl L0031st + jl L0041st pmuludq %mm4,%mm0 pmuludq %mm5,%mm1 paddq %mm0,%mm2 @@ -99,7 +107,7 @@ L0031st: paddq %mm2,%mm3 movq %mm3,32(%esp,%ebx,4) incl %edx -L004outer: +L005outer: xorl %ecx,%ecx movd (%edi,%edx,4),%mm4 movd (%esi),%mm5 @@ -121,7 +129,7 @@ L004outer: paddq %mm6,%mm2 incl %ecx decl %ebx -L005inner: +L006inner: pmuludq %mm4,%mm0 pmuludq %mm5,%mm1 paddq %mm0,%mm2 @@ -138,7 +146,7 @@ L005inner: paddq %mm6,%mm2 decl %ebx leal 1(%ecx),%ecx - jnz L005inner + jnz L006inner movl %ecx,%ebx pmuludq %mm4,%mm0 pmuludq %mm5,%mm1 @@ -156,11 +164,11 @@ L005inner: movq %mm3,32(%esp,%ebx,4) leal 1(%edx),%edx cmpl %ebx,%edx - jle L004outer + jle L005outer emms - jmp L006common_tail + jmp L007common_tail .align 4,0x90 -L002non_sse2: +L003non_sse2: movl 8(%esp),%esi leal 1(%ebx),%ebp movl 12(%esp),%edi @@ -171,12 +179,12 @@ L002non_sse2: leal 4(%edi,%ebx,4),%eax orl %edx,%ebp movl (%edi),%edi - jz L007bn_sqr_mont + jz L008bn_sqr_mont movl %eax,28(%esp) movl (%esi),%eax xorl %edx,%edx .align 4,0x90 -L008mull: +L009mull: movl %edx,%ebp mull %edi addl %eax,%ebp @@ -185,7 +193,7 @@ L008mull: movl (%esi,%ecx,4),%eax cmpl %ebx,%ecx movl %ebp,28(%esp,%ecx,4) - jl L008mull + jl L009mull movl %edx,%ebp mull %edi movl 20(%esp),%edi @@ -203,9 +211,9 @@ L008mull: movl 4(%esi),%eax adcl $0,%edx incl %ecx - jmp L0092ndmadd + jmp L0102ndmadd .align 4,0x90 -L0101stmadd: +L0111stmadd: movl %edx,%ebp mull %edi addl 32(%esp,%ecx,4),%ebp @@ -216,7 +224,7 @@ L0101stmadd: adcl $0,%edx cmpl %ebx,%ecx movl %ebp,28(%esp,%ecx,4) - jl L0101stmadd + jl L0111stmadd movl %edx,%ebp mull %edi addl 32(%esp,%ebx,4),%eax @@ -239,7 +247,7 @@ L0101stmadd: adcl $0,%edx movl $1,%ecx .align 4,0x90 -L0092ndmadd: +L0102ndmadd: movl %edx,%ebp mull %edi addl 32(%esp,%ecx,4),%ebp @@ -250,7 +258,7 @@ L0092ndmadd: adcl $0,%edx cmpl %ebx,%ecx movl %ebp,24(%esp,%ecx,4) - jl L0092ndmadd + jl L0102ndmadd movl %edx,%ebp mull %edi addl 32(%esp,%ebx,4),%ebp @@ -266,16 +274,16 @@ L0092ndmadd: movl %edx,32(%esp,%ebx,4) cmpl 28(%esp),%ecx movl %eax,36(%esp,%ebx,4) - je L006common_tail + je L007common_tail movl (%ecx),%edi movl 8(%esp),%esi movl %ecx,12(%esp) xorl %ecx,%ecx xorl %edx,%edx movl (%esi),%eax - jmp L0101stmadd + jmp L0111stmadd .align 4,0x90 -L007bn_sqr_mont: +L008bn_sqr_mont: movl %ebx,(%esp) movl %ecx,12(%esp) movl %edi,%eax @@ -286,7 +294,7 @@ L007bn_sqr_mont: andl $1,%ebx incl %ecx .align 4,0x90 -L011sqr: +L012sqr: movl (%esi,%ecx,4),%eax movl %edx,%ebp mull %edi @@ -298,7 +306,7 @@ L011sqr: cmpl (%esp),%ecx movl %eax,%ebx movl %ebp,28(%esp,%ecx,4) - jl L011sqr + jl L012sqr movl (%esi,%ecx,4),%eax movl %edx,%ebp mull %edi @@ -322,7 +330,7 @@ L011sqr: movl 4(%esi),%eax movl $1,%ecx .align 4,0x90 -L0123rdmadd: +L0133rdmadd: movl %edx,%ebp mull %edi addl 32(%esp,%ecx,4),%ebp @@ -341,7 +349,7 @@ L0123rdmadd: adcl $0,%edx cmpl %ebx,%ecx movl %ebp,24(%esp,%ecx,4) - jl L0123rdmadd + jl L0133rdmadd movl %edx,%ebp mull %edi addl 32(%esp,%ebx,4),%ebp @@ -357,7 +365,7 @@ L0123rdmadd: movl %edx,32(%esp,%ebx,4) cmpl %ebx,%ecx movl %eax,36(%esp,%ebx,4) - je L006common_tail + je L007common_tail movl 4(%esi,%ecx,4),%edi leal 1(%ecx),%ecx movl %edi,%eax @@ -369,12 +377,12 @@ L0123rdmadd: xorl %ebp,%ebp cmpl %ebx,%ecx leal 1(%ecx),%ecx - je L013sqrlast + je L014sqrlast movl %edx,%ebx shrl $1,%edx andl $1,%ebx .align 4,0x90 -L014sqradd: +L015sqradd: movl (%esi,%ecx,4),%eax movl %edx,%ebp mull %edi @@ -390,13 +398,13 @@ L014sqradd: cmpl (%esp),%ecx movl %ebp,28(%esp,%ecx,4) movl %eax,%ebx - jle L014sqradd + jle L015sqradd movl %edx,%ebp addl %edx,%edx shrl $31,%ebp addl %ebx,%edx adcl $0,%ebp -L013sqrlast: +L014sqrlast: movl 20(%esp),%edi movl 16(%esp),%esi imull 32(%esp),%edi @@ -411,9 +419,9 @@ L013sqrlast: adcl $0,%edx movl $1,%ecx movl 4(%esi),%eax - jmp L0123rdmadd + jmp L0133rdmadd .align 4,0x90 -L006common_tail: +L007common_tail: movl 16(%esp),%ebp movl 4(%esp),%edi leal 32(%esp),%esi @@ -421,13 +429,13 @@ L006common_tail: movl %ebx,%ecx xorl %edx,%edx .align 4,0x90 -L015sub: +L016sub: sbbl (%ebp,%edx,4),%eax movl %eax,(%edi,%edx,4) decl %ecx movl 4(%esi,%edx,4),%eax leal 1(%edx),%edx - jge L015sub + jge L016sub sbbl $0,%eax andl %eax,%esi notl %eax @@ -435,12 +443,12 @@ L015sub: andl %eax,%ebp orl %ebp,%esi .align 4,0x90 -L016copy: +L017copy: movl (%esi,%ebx,4),%eax movl %eax,(%edi,%ebx,4) movl %ecx,32(%esp,%ebx,4) decl %ebx - jge L016copy + jge L017copy movl 24(%esp),%esp movl $1,%eax L000just_leave: diff --git a/vendor/openssl/asm/x86-win32-masm/bn/x86-mont.asm b/vendor/openssl/asm/x86-win32-masm/bn/x86-mont.asm index 9bfa4dc8e..4987f6fe9 100644 --- a/vendor/openssl/asm/x86-win32-masm/bn/x86-mont.asm +++ b/vendor/openssl/asm/x86-win32-masm/bn/x86-mont.asm @@ -45,6 +45,14 @@ $L_bn_mul_mont_begin:: xor edx,2048 sub esp,edx and esp,-64 + mov eax,ebp + sub eax,esp + and eax,-4096 +$L001page_walk: + mov edx,DWORD PTR [eax*1+esp] + sub eax,4096 +DB 46 + jnc $L001page_walk mov eax,DWORD PTR [esi] mov ebx,DWORD PTR 4[esi] mov ecx,DWORD PTR 8[esi] @@ -60,7 +68,7 @@ $L_bn_mul_mont_begin:: mov DWORD PTR 24[esp],ebp lea eax,DWORD PTR _OPENSSL_ia32cap_P bt DWORD PTR [eax],26 - jnc $L001non_sse2 + jnc $L002non_sse2 mov eax,-1 movd mm7,eax mov esi,DWORD PTR 8[esp] @@ -84,7 +92,7 @@ $L_bn_mul_mont_begin:: psrlq mm3,32 inc ecx ALIGN 16 -$L0021st: +$L0031st: pmuludq mm0,mm4 pmuludq mm1,mm5 paddq mm2,mm0 @@ -99,7 +107,7 @@ $L0021st: psrlq mm3,32 lea ecx,DWORD PTR 1[ecx] cmp ecx,ebx - jl $L0021st + jl $L0031st pmuludq mm0,mm4 pmuludq mm1,mm5 paddq mm2,mm0 @@ -113,7 +121,7 @@ $L0021st: paddq mm3,mm2 movq QWORD PTR 32[ebx*4+esp],mm3 inc edx -$L003outer: +$L004outer: xor ecx,ecx movd mm4,DWORD PTR [edx*4+edi] movd mm5,DWORD PTR [esi] @@ -135,7 +143,7 @@ $L003outer: paddq mm2,mm6 inc ecx dec ebx -$L004inner: +$L005inner: pmuludq mm0,mm4 pmuludq mm1,mm5 paddq mm2,mm0 @@ -152,7 +160,7 @@ $L004inner: paddq mm2,mm6 dec ebx lea ecx,DWORD PTR 1[ecx] - jnz $L004inner + jnz $L005inner mov ebx,ecx pmuludq mm0,mm4 pmuludq mm1,mm5 @@ -170,11 +178,11 @@ $L004inner: movq QWORD PTR 32[ebx*4+esp],mm3 lea edx,DWORD PTR 1[edx] cmp edx,ebx - jle $L003outer + jle $L004outer emms - jmp $L005common_tail + jmp $L006common_tail ALIGN 16 -$L001non_sse2: +$L002non_sse2: mov esi,DWORD PTR 8[esp] lea ebp,DWORD PTR 1[ebx] mov edi,DWORD PTR 12[esp] @@ -185,12 +193,12 @@ $L001non_sse2: lea eax,DWORD PTR 4[ebx*4+edi] or ebp,edx mov edi,DWORD PTR [edi] - jz $L006bn_sqr_mont + jz $L007bn_sqr_mont mov DWORD PTR 28[esp],eax mov eax,DWORD PTR [esi] xor edx,edx ALIGN 16 -$L007mull: +$L008mull: mov ebp,edx mul edi add ebp,eax @@ -199,7 +207,7 @@ $L007mull: mov eax,DWORD PTR [ecx*4+esi] cmp ecx,ebx mov DWORD PTR 28[ecx*4+esp],ebp - jl $L007mull + jl $L008mull mov ebp,edx mul edi mov edi,DWORD PTR 20[esp] @@ -217,9 +225,9 @@ $L007mull: mov eax,DWORD PTR 4[esi] adc edx,0 inc ecx - jmp $L0082ndmadd + jmp $L0092ndmadd ALIGN 16 -$L0091stmadd: +$L0101stmadd: mov ebp,edx mul edi add ebp,DWORD PTR 32[ecx*4+esp] @@ -230,7 +238,7 @@ $L0091stmadd: adc edx,0 cmp ecx,ebx mov DWORD PTR 28[ecx*4+esp],ebp - jl $L0091stmadd + jl $L0101stmadd mov ebp,edx mul edi add eax,DWORD PTR 32[ebx*4+esp] @@ -253,7 +261,7 @@ $L0091stmadd: adc edx,0 mov ecx,1 ALIGN 16 -$L0082ndmadd: +$L0092ndmadd: mov ebp,edx mul edi add ebp,DWORD PTR 32[ecx*4+esp] @@ -264,7 +272,7 @@ $L0082ndmadd: adc edx,0 cmp ecx,ebx mov DWORD PTR 24[ecx*4+esp],ebp - jl $L0082ndmadd + jl $L0092ndmadd mov ebp,edx mul edi add ebp,DWORD PTR 32[ebx*4+esp] @@ -280,16 +288,16 @@ $L0082ndmadd: mov DWORD PTR 32[ebx*4+esp],edx cmp ecx,DWORD PTR 28[esp] mov DWORD PTR 36[ebx*4+esp],eax - je $L005common_tail + je $L006common_tail mov edi,DWORD PTR [ecx] mov esi,DWORD PTR 8[esp] mov DWORD PTR 12[esp],ecx xor ecx,ecx xor edx,edx mov eax,DWORD PTR [esi] - jmp $L0091stmadd + jmp $L0101stmadd ALIGN 16 -$L006bn_sqr_mont: +$L007bn_sqr_mont: mov DWORD PTR [esp],ebx mov DWORD PTR 12[esp],ecx mov eax,edi @@ -300,7 +308,7 @@ $L006bn_sqr_mont: and ebx,1 inc ecx ALIGN 16 -$L010sqr: +$L011sqr: mov eax,DWORD PTR [ecx*4+esi] mov ebp,edx mul edi @@ -312,7 +320,7 @@ $L010sqr: cmp ecx,DWORD PTR [esp] mov ebx,eax mov DWORD PTR 28[ecx*4+esp],ebp - jl $L010sqr + jl $L011sqr mov eax,DWORD PTR [ecx*4+esi] mov ebp,edx mul edi @@ -336,7 +344,7 @@ $L010sqr: mov eax,DWORD PTR 4[esi] mov ecx,1 ALIGN 16 -$L0113rdmadd: +$L0123rdmadd: mov ebp,edx mul edi add ebp,DWORD PTR 32[ecx*4+esp] @@ -355,7 +363,7 @@ $L0113rdmadd: adc edx,0 cmp ecx,ebx mov DWORD PTR 24[ecx*4+esp],ebp - jl $L0113rdmadd + jl $L0123rdmadd mov ebp,edx mul edi add ebp,DWORD PTR 32[ebx*4+esp] @@ -371,7 +379,7 @@ $L0113rdmadd: mov DWORD PTR 32[ebx*4+esp],edx cmp ecx,ebx mov DWORD PTR 36[ebx*4+esp],eax - je $L005common_tail + je $L006common_tail mov edi,DWORD PTR 4[ecx*4+esi] lea ecx,DWORD PTR 1[ecx] mov eax,edi @@ -383,12 +391,12 @@ $L0113rdmadd: xor ebp,ebp cmp ecx,ebx lea ecx,DWORD PTR 1[ecx] - je $L012sqrlast + je $L013sqrlast mov ebx,edx shr edx,1 and ebx,1 ALIGN 16 -$L013sqradd: +$L014sqradd: mov eax,DWORD PTR [ecx*4+esi] mov ebp,edx mul edi @@ -404,13 +412,13 @@ $L013sqradd: cmp ecx,DWORD PTR [esp] mov DWORD PTR 28[ecx*4+esp],ebp mov ebx,eax - jle $L013sqradd + jle $L014sqradd mov ebp,edx add edx,edx shr ebp,31 add edx,ebx adc ebp,0 -$L012sqrlast: +$L013sqrlast: mov edi,DWORD PTR 20[esp] mov esi,DWORD PTR 16[esp] imul edi,DWORD PTR 32[esp] @@ -425,9 +433,9 @@ $L012sqrlast: adc edx,0 mov ecx,1 mov eax,DWORD PTR 4[esi] - jmp $L0113rdmadd + jmp $L0123rdmadd ALIGN 16 -$L005common_tail: +$L006common_tail: mov ebp,DWORD PTR 16[esp] mov edi,DWORD PTR 4[esp] lea esi,DWORD PTR 32[esp] @@ -435,13 +443,13 @@ $L005common_tail: mov ecx,ebx xor edx,edx ALIGN 16 -$L014sub: +$L015sub: sbb eax,DWORD PTR [edx*4+ebp] mov DWORD PTR [edx*4+edi],eax dec ecx mov eax,DWORD PTR 4[edx*4+esi] lea edx,DWORD PTR 1[edx] - jge $L014sub + jge $L015sub sbb eax,0 and esi,eax not eax @@ -449,12 +457,12 @@ $L014sub: and ebp,eax or esi,ebp ALIGN 16 -$L015copy: +$L016copy: mov eax,DWORD PTR [ebx*4+esi] mov DWORD PTR [ebx*4+edi],eax mov DWORD PTR 32[ebx*4+esp],ecx dec ebx - jge $L015copy + jge $L016copy mov esp,DWORD PTR 24[esp] mov eax,1 $L000just_leave: diff --git a/vendor/openssl/asm_obsolete/x64-elf-gas/aes/aes-x86_64.s b/vendor/openssl/asm_obsolete/x64-elf-gas/aes/aes-x86_64.s index 0bdfe91fc..c21cce10f 100644 --- a/vendor/openssl/asm_obsolete/x64-elf-gas/aes/aes-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-elf-gas/aes/aes-x86_64.s @@ -81,8 +81,8 @@ _x86_64_AES_encrypt: movl 0(%r14,%rdi,8),%edi movl 0(%r14,%rbp,8),%ebp - andl $65280,%edi - andl $65280,%ebp + andl $0x0000ff00,%edi + andl $0x0000ff00,%ebp xorl %edi,%r10d xorl %ebp,%r11d @@ -94,8 +94,8 @@ _x86_64_AES_encrypt: movl 0(%r14,%rsi,8),%esi movl 0(%r14,%rdi,8),%edi - andl $65280,%esi - andl $65280,%edi + andl $0x0000ff00,%esi + andl $0x0000ff00,%edi shrl $16,%ebx xorl %esi,%r12d xorl %edi,%r8d @@ -108,9 +108,9 @@ _x86_64_AES_encrypt: movl 0(%r14,%rdi,8),%edi movl 0(%r14,%rbp,8),%ebp - andl $16711680,%esi - andl $16711680,%edi - andl $16711680,%ebp + andl $0x00ff0000,%esi + andl $0x00ff0000,%edi + andl $0x00ff0000,%ebp xorl %esi,%r10d xorl %edi,%r11d @@ -123,9 +123,9 @@ _x86_64_AES_encrypt: movl 2(%r14,%rdi,8),%edi movl 2(%r14,%rbp,8),%ebp - andl $16711680,%esi - andl $4278190080,%edi - andl $4278190080,%ebp + andl $0x00ff0000,%esi + andl $0xff000000,%edi + andl $0xff000000,%ebp xorl %esi,%r8d xorl %edi,%r10d @@ -138,8 +138,8 @@ _x86_64_AES_encrypt: movl 2(%r14,%rdi,8),%edi movl 16+0(%r15),%eax - andl $4278190080,%esi - andl $4278190080,%edi + andl $0xff000000,%esi + andl $0xff000000,%edi xorl %esi,%r12d xorl %edi,%r8d @@ -241,8 +241,8 @@ _x86_64_AES_encrypt_compact: xorl %r8d,%edx cmpq 16(%rsp),%r15 je .Lenc_compact_done - movl $2155905152,%r10d - movl $2155905152,%r11d + movl $0x80808080,%r10d + movl $0x80808080,%r11d andl %eax,%r10d andl %ebx,%r11d movl %r10d,%esi @@ -253,10 +253,10 @@ _x86_64_AES_encrypt_compact: leal (%rbx,%rbx,1),%r9d subl %r10d,%esi subl %r11d,%edi - andl $4278124286,%r8d - andl $4278124286,%r9d - andl $454761243,%esi - andl $454761243,%edi + andl $0xfefefefe,%r8d + andl $0xfefefefe,%r9d + andl $0x1b1b1b1b,%esi + andl $0x1b1b1b1b,%edi movl %eax,%r10d movl %ebx,%r11d xorl %esi,%r8d @@ -264,9 +264,9 @@ _x86_64_AES_encrypt_compact: xorl %r8d,%eax xorl %r9d,%ebx - movl $2155905152,%r12d + movl $0x80808080,%r12d roll $24,%eax - movl $2155905152,%ebp + movl $0x80808080,%ebp roll $24,%ebx andl %ecx,%r12d andl %edx,%ebp @@ -289,10 +289,10 @@ _x86_64_AES_encrypt_compact: xorl %r10d,%eax xorl %r11d,%ebx - andl $4278124286,%r8d - andl $4278124286,%r9d - andl $454761243,%esi - andl $454761243,%edi + andl $0xfefefefe,%r8d + andl $0xfefefefe,%r9d + andl $0x1b1b1b1b,%esi + andl $0x1b1b1b1b,%edi movl %ecx,%r12d movl %edx,%ebp xorl %esi,%r8d @@ -345,7 +345,7 @@ AES_encrypt: andq $-64,%rsp subq %rsp,%rcx negq %rcx - andq $960,%rcx + andq $0x3c0,%rcx subq %rcx,%rsp subq $32,%rsp @@ -370,7 +370,7 @@ AES_encrypt: leaq .LAES_Te+2048(%rip),%r14 leaq 768(%rsp),%rbp subq %r14,%rbp - andq $768,%rbp + andq $0x300,%rbp leaq (%r14,%rbp,1),%r14 call _x86_64_AES_encrypt_compact @@ -792,7 +792,7 @@ AES_decrypt: andq $-64,%rsp subq %rsp,%rcx negq %rcx - andq $960,%rcx + andq $0x3c0,%rcx subq %rcx,%rsp subq $32,%rsp @@ -817,7 +817,7 @@ AES_decrypt: leaq .LAES_Td+2048(%rip),%r14 leaq 768(%rsp),%rbp subq %r14,%rbp - andq $768,%rbp + andq $0x300,%rbp leaq (%r14,%rbp,1),%r14 shrq $3,%rbp addq %rbp,%r14 @@ -1333,9 +1333,9 @@ AES_cbc_encrypt: movq %r14,%r10 leaq 2304(%r14),%r11 movq %r15,%r12 - andq $4095,%r10 - andq $4095,%r11 - andq $4095,%r12 + andq $0xFFF,%r10 + andq $0xFFF,%r11 + andq $0xFFF,%r12 cmpq %r11,%r12 jb .Lcbc_te_break_out @@ -1344,7 +1344,7 @@ AES_cbc_encrypt: jmp .Lcbc_te_ok .Lcbc_te_break_out: subq %r10,%r12 - andq $4095,%r12 + andq $0xFFF,%r12 addq $320,%r12 subq %r12,%r15 .align 4 @@ -1370,7 +1370,7 @@ AES_cbc_encrypt: movq %r15,%r10 subq %r14,%r10 - andq $4095,%r10 + andq $0xfff,%r10 cmpq $2304,%r10 jb .Lcbc_do_ecopy cmpq $4096-248,%r10 @@ -1557,7 +1557,7 @@ AES_cbc_encrypt: leaq -88-63(%rcx),%r10 subq %rbp,%r10 negq %r10 - andq $960,%r10 + andq $0x3c0,%r10 subq %r10,%rbp xchgq %rsp,%rbp @@ -1586,7 +1586,7 @@ AES_cbc_encrypt: leaq 2048(%r14),%r14 leaq 768-8(%rsp),%rax subq %r14,%rax - andq $768,%rax + andq $0x300,%rax leaq (%r14,%rax,1),%r14 cmpq $0,%rbx diff --git a/vendor/openssl/asm_obsolete/x64-elf-gas/aes/aesni-x86_64.s b/vendor/openssl/asm_obsolete/x64-elf-gas/aes/aesni-x86_64.s index 6573fe4be..2317f0e55 100644 --- a/vendor/openssl/asm_obsolete/x64-elf-gas/aes/aesni-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-elf-gas/aes/aesni-x86_64.s @@ -503,7 +503,7 @@ aesni_ecb_encrypt: testl %r8d,%r8d jz .Lecb_decrypt - cmpq $128,%rdx + cmpq $0x80,%rdx jb .Lecb_enc_tail movdqu (%rdi),%xmm2 @@ -515,7 +515,7 @@ aesni_ecb_encrypt: movdqu 96(%rdi),%xmm8 movdqu 112(%rdi),%xmm9 leaq 128(%rdi),%rdi - subq $128,%rdx + subq $0x80,%rdx jmp .Lecb_enc_loop8_enter .align 16 .Lecb_enc_loop8: @@ -543,7 +543,7 @@ aesni_ecb_encrypt: call _aesni_encrypt8 - subq $128,%rdx + subq $0x80,%rdx jnc .Lecb_enc_loop8 movups %xmm2,(%rsi) @@ -557,22 +557,22 @@ aesni_ecb_encrypt: movups %xmm8,96(%rsi) movups %xmm9,112(%rsi) leaq 128(%rsi),%rsi - addq $128,%rdx + addq $0x80,%rdx jz .Lecb_ret .Lecb_enc_tail: movups (%rdi),%xmm2 - cmpq $32,%rdx + cmpq $0x20,%rdx jb .Lecb_enc_one movups 16(%rdi),%xmm3 je .Lecb_enc_two movups 32(%rdi),%xmm4 - cmpq $64,%rdx + cmpq $0x40,%rdx jb .Lecb_enc_three movups 48(%rdi),%xmm5 je .Lecb_enc_four movups 64(%rdi),%xmm6 - cmpq $96,%rdx + cmpq $0x60,%rdx jb .Lecb_enc_five movups 80(%rdi),%xmm7 je .Lecb_enc_six @@ -646,7 +646,7 @@ aesni_ecb_encrypt: .align 16 .Lecb_decrypt: - cmpq $128,%rdx + cmpq $0x80,%rdx jb .Lecb_dec_tail movdqu (%rdi),%xmm2 @@ -658,7 +658,7 @@ aesni_ecb_encrypt: movdqu 96(%rdi),%xmm8 movdqu 112(%rdi),%xmm9 leaq 128(%rdi),%rdi - subq $128,%rdx + subq $0x80,%rdx jmp .Lecb_dec_loop8_enter .align 16 .Lecb_dec_loop8: @@ -687,7 +687,7 @@ aesni_ecb_encrypt: call _aesni_decrypt8 movups (%r11),%xmm0 - subq $128,%rdx + subq $0x80,%rdx jnc .Lecb_dec_loop8 movups %xmm2,(%rsi) @@ -709,22 +709,22 @@ aesni_ecb_encrypt: movups %xmm9,112(%rsi) pxor %xmm9,%xmm9 leaq 128(%rsi),%rsi - addq $128,%rdx + addq $0x80,%rdx jz .Lecb_ret .Lecb_dec_tail: movups (%rdi),%xmm2 - cmpq $32,%rdx + cmpq $0x20,%rdx jb .Lecb_dec_one movups 16(%rdi),%xmm3 je .Lecb_dec_two movups 32(%rdi),%xmm4 - cmpq $64,%rdx + cmpq $0x40,%rdx jb .Lecb_dec_three movups 48(%rdi),%xmm5 je .Lecb_dec_four movups 64(%rdi),%xmm6 - cmpq $96,%rdx + cmpq $0x60,%rdx jb .Lecb_dec_five movups 80(%rdi),%xmm7 je .Lecb_dec_six @@ -1598,7 +1598,7 @@ aesni_xts_encrypt: movdqa .Lxts_magic(%rip),%xmm8 movdqa %xmm2,%xmm15 - pshufd $95,%xmm2,%xmm9 + pshufd $0x5f,%xmm2,%xmm9 pxor %xmm0,%xmm1 movdqa %xmm9,%xmm14 paddd %xmm9,%xmm9 @@ -1697,7 +1697,7 @@ aesni_xts_encrypt: .byte 102,15,56,220,248 movups 64(%r11),%xmm0 movdqa %xmm8,80(%rsp) - pshufd $95,%xmm15,%xmm9 + pshufd $0x5f,%xmm15,%xmm9 jmp .Lxts_enc_loop6 .align 32 .Lxts_enc_loop6: @@ -1836,13 +1836,13 @@ aesni_xts_encrypt: jz .Lxts_enc_done pxor %xmm0,%xmm11 - cmpq $32,%rdx + cmpq $0x20,%rdx jb .Lxts_enc_one pxor %xmm0,%xmm12 je .Lxts_enc_two pxor %xmm0,%xmm13 - cmpq $64,%rdx + cmpq $0x40,%rdx jb .Lxts_enc_three pxor %xmm0,%xmm14 je .Lxts_enc_four @@ -2069,7 +2069,7 @@ aesni_xts_decrypt: movdqa .Lxts_magic(%rip),%xmm8 movdqa %xmm2,%xmm15 - pshufd $95,%xmm2,%xmm9 + pshufd $0x5f,%xmm2,%xmm9 pxor %xmm0,%xmm1 movdqa %xmm9,%xmm14 paddd %xmm9,%xmm9 @@ -2168,7 +2168,7 @@ aesni_xts_decrypt: .byte 102,15,56,222,248 movups 64(%r11),%xmm0 movdqa %xmm8,80(%rsp) - pshufd $95,%xmm15,%xmm9 + pshufd $0x5f,%xmm15,%xmm9 jmp .Lxts_dec_loop6 .align 32 .Lxts_dec_loop6: @@ -2308,13 +2308,13 @@ aesni_xts_decrypt: jz .Lxts_dec_done pxor %xmm0,%xmm12 - cmpq $32,%rdx + cmpq $0x20,%rdx jb .Lxts_dec_one pxor %xmm0,%xmm13 je .Lxts_dec_two pxor %xmm0,%xmm14 - cmpq $64,%rdx + cmpq $0x40,%rdx jb .Lxts_dec_three je .Lxts_dec_four @@ -2345,7 +2345,7 @@ aesni_xts_decrypt: pcmpgtd %xmm15,%xmm14 movdqu %xmm6,64(%rsi) leaq 80(%rsi),%rsi - pshufd $19,%xmm14,%xmm11 + pshufd $0x13,%xmm14,%xmm11 andq $15,%r9 jz .Lxts_dec_ret @@ -2634,7 +2634,7 @@ aesni_cbc_encrypt: leaq -8(%rax),%rbp movups (%r8),%xmm10 movl %r10d,%eax - cmpq $80,%rdx + cmpq $0x50,%rdx jbe .Lcbc_dec_tail movups (%rcx),%xmm0 @@ -2650,14 +2650,14 @@ aesni_cbc_encrypt: movdqu 80(%rdi),%xmm7 movdqa %xmm6,%xmm15 movl OPENSSL_ia32cap_P+4(%rip),%r9d - cmpq $112,%rdx + cmpq $0x70,%rdx jbe .Lcbc_dec_six_or_seven andl $71303168,%r9d - subq $80,%rdx + subq $0x50,%rdx cmpl $4194304,%r9d je .Lcbc_dec_loop6_enter - subq $32,%rdx + subq $0x20,%rdx leaq 112(%rcx),%rcx jmp .Lcbc_dec_loop8_enter .align 16 @@ -2672,7 +2672,7 @@ aesni_cbc_encrypt: movups 16-112(%rcx),%xmm1 pxor %xmm0,%xmm4 xorq %r11,%r11 - cmpq $112,%rdx + cmpq $0x70,%rdx pxor %xmm0,%xmm5 pxor %xmm0,%xmm6 pxor %xmm0,%xmm7 @@ -2857,21 +2857,21 @@ aesni_cbc_encrypt: movups %xmm8,96(%rsi) leaq 112(%rsi),%rsi - subq $128,%rdx + subq $0x80,%rdx ja .Lcbc_dec_loop8 movaps %xmm9,%xmm2 leaq -112(%rcx),%rcx - addq $112,%rdx + addq $0x70,%rdx jle .Lcbc_dec_clear_tail_collected movups %xmm9,(%rsi) leaq 16(%rsi),%rsi - cmpq $80,%rdx + cmpq $0x50,%rdx jbe .Lcbc_dec_tail movaps %xmm11,%xmm2 .Lcbc_dec_six_or_seven: - cmpq $96,%rdx + cmpq $0x60,%rdx ja .Lcbc_dec_seven movaps %xmm7,%xmm8 @@ -2964,33 +2964,33 @@ aesni_cbc_encrypt: movl %r10d,%eax movdqu %xmm6,64(%rsi) leaq 80(%rsi),%rsi - subq $96,%rdx + subq $0x60,%rdx ja .Lcbc_dec_loop6 movdqa %xmm7,%xmm2 - addq $80,%rdx + addq $0x50,%rdx jle .Lcbc_dec_clear_tail_collected movups %xmm7,(%rsi) leaq 16(%rsi),%rsi .Lcbc_dec_tail: movups (%rdi),%xmm2 - subq $16,%rdx + subq $0x10,%rdx jbe .Lcbc_dec_one movups 16(%rdi),%xmm3 movaps %xmm2,%xmm11 - subq $16,%rdx + subq $0x10,%rdx jbe .Lcbc_dec_two movups 32(%rdi),%xmm4 movaps %xmm3,%xmm12 - subq $16,%rdx + subq $0x10,%rdx jbe .Lcbc_dec_three movups 48(%rdi),%xmm5 movaps %xmm4,%xmm13 - subq $16,%rdx + subq $0x10,%rdx jbe .Lcbc_dec_four movups 64(%rdi),%xmm6 @@ -3015,7 +3015,7 @@ aesni_cbc_encrypt: movdqa %xmm6,%xmm2 pxor %xmm6,%xmm6 pxor %xmm7,%xmm7 - subq $16,%rdx + subq $0x10,%rdx jmp .Lcbc_dec_tail_collected .align 16 @@ -3332,7 +3332,7 @@ __aesni_set_encrypt_key: pslldq $4,%xmm0 pxor %xmm3,%xmm0 - pshufd $255,%xmm0,%xmm3 + pshufd $0xff,%xmm0,%xmm3 pxor %xmm1,%xmm3 pslldq $4,%xmm1 pxor %xmm1,%xmm3 @@ -3419,7 +3419,7 @@ __aesni_set_encrypt_key: decl %r10d jz .Ldone_key256 - pshufd $255,%xmm0,%xmm2 + pshufd $0xff,%xmm0,%xmm2 pxor %xmm3,%xmm3 .byte 102,15,56,221,211 diff --git a/vendor/openssl/asm_obsolete/x64-elf-gas/aes/bsaes-x86_64.s b/vendor/openssl/asm_obsolete/x64-elf-gas/aes/bsaes-x86_64.s index 5b363a5ee..0fd201167 100644 --- a/vendor/openssl/asm_obsolete/x64-elf-gas/aes/bsaes-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-elf-gas/aes/bsaes-x86_64.s @@ -324,45 +324,45 @@ _bsaes_encrypt8_bitslice: pxor %xmm2,%xmm5 decl %r10d jl .Lenc_done - pshufd $147,%xmm15,%xmm7 - pshufd $147,%xmm0,%xmm8 + pshufd $0x93,%xmm15,%xmm7 + pshufd $0x93,%xmm0,%xmm8 pxor %xmm7,%xmm15 - pshufd $147,%xmm3,%xmm9 + pshufd $0x93,%xmm3,%xmm9 pxor %xmm8,%xmm0 - pshufd $147,%xmm5,%xmm10 + pshufd $0x93,%xmm5,%xmm10 pxor %xmm9,%xmm3 - pshufd $147,%xmm2,%xmm11 + pshufd $0x93,%xmm2,%xmm11 pxor %xmm10,%xmm5 - pshufd $147,%xmm6,%xmm12 + pshufd $0x93,%xmm6,%xmm12 pxor %xmm11,%xmm2 - pshufd $147,%xmm1,%xmm13 + pshufd $0x93,%xmm1,%xmm13 pxor %xmm12,%xmm6 - pshufd $147,%xmm4,%xmm14 + pshufd $0x93,%xmm4,%xmm14 pxor %xmm13,%xmm1 pxor %xmm14,%xmm4 pxor %xmm15,%xmm8 pxor %xmm4,%xmm7 pxor %xmm4,%xmm8 - pshufd $78,%xmm15,%xmm15 + pshufd $0x4E,%xmm15,%xmm15 pxor %xmm0,%xmm9 - pshufd $78,%xmm0,%xmm0 + pshufd $0x4E,%xmm0,%xmm0 pxor %xmm2,%xmm12 pxor %xmm7,%xmm15 pxor %xmm6,%xmm13 pxor %xmm8,%xmm0 pxor %xmm5,%xmm11 - pshufd $78,%xmm2,%xmm7 + pshufd $0x4E,%xmm2,%xmm7 pxor %xmm1,%xmm14 - pshufd $78,%xmm6,%xmm8 + pshufd $0x4E,%xmm6,%xmm8 pxor %xmm3,%xmm10 - pshufd $78,%xmm5,%xmm2 + pshufd $0x4E,%xmm5,%xmm2 pxor %xmm4,%xmm10 - pshufd $78,%xmm4,%xmm6 + pshufd $0x4E,%xmm4,%xmm6 pxor %xmm4,%xmm11 - pshufd $78,%xmm1,%xmm5 + pshufd $0x4E,%xmm1,%xmm5 pxor %xmm11,%xmm7 - pshufd $78,%xmm3,%xmm1 + pshufd $0x4E,%xmm3,%xmm1 pxor %xmm12,%xmm8 pxor %xmm10,%xmm2 pxor %xmm14,%xmm6 @@ -796,24 +796,24 @@ _bsaes_decrypt8: decl %r10d jl .Ldec_done - pshufd $78,%xmm15,%xmm7 - pshufd $78,%xmm2,%xmm13 + pshufd $0x4E,%xmm15,%xmm7 + pshufd $0x4E,%xmm2,%xmm13 pxor %xmm15,%xmm7 - pshufd $78,%xmm4,%xmm14 + pshufd $0x4E,%xmm4,%xmm14 pxor %xmm2,%xmm13 - pshufd $78,%xmm0,%xmm8 + pshufd $0x4E,%xmm0,%xmm8 pxor %xmm4,%xmm14 - pshufd $78,%xmm5,%xmm9 + pshufd $0x4E,%xmm5,%xmm9 pxor %xmm0,%xmm8 - pshufd $78,%xmm3,%xmm10 + pshufd $0x4E,%xmm3,%xmm10 pxor %xmm5,%xmm9 pxor %xmm13,%xmm15 pxor %xmm13,%xmm0 - pshufd $78,%xmm1,%xmm11 + pshufd $0x4E,%xmm1,%xmm11 pxor %xmm3,%xmm10 pxor %xmm7,%xmm5 pxor %xmm8,%xmm3 - pshufd $78,%xmm6,%xmm12 + pshufd $0x4E,%xmm6,%xmm12 pxor %xmm1,%xmm11 pxor %xmm14,%xmm0 pxor %xmm9,%xmm1 @@ -827,45 +827,45 @@ _bsaes_decrypt8: pxor %xmm14,%xmm1 pxor %xmm14,%xmm6 pxor %xmm12,%xmm4 - pshufd $147,%xmm15,%xmm7 - pshufd $147,%xmm0,%xmm8 + pshufd $0x93,%xmm15,%xmm7 + pshufd $0x93,%xmm0,%xmm8 pxor %xmm7,%xmm15 - pshufd $147,%xmm5,%xmm9 + pshufd $0x93,%xmm5,%xmm9 pxor %xmm8,%xmm0 - pshufd $147,%xmm3,%xmm10 + pshufd $0x93,%xmm3,%xmm10 pxor %xmm9,%xmm5 - pshufd $147,%xmm1,%xmm11 + pshufd $0x93,%xmm1,%xmm11 pxor %xmm10,%xmm3 - pshufd $147,%xmm6,%xmm12 + pshufd $0x93,%xmm6,%xmm12 pxor %xmm11,%xmm1 - pshufd $147,%xmm2,%xmm13 + pshufd $0x93,%xmm2,%xmm13 pxor %xmm12,%xmm6 - pshufd $147,%xmm4,%xmm14 + pshufd $0x93,%xmm4,%xmm14 pxor %xmm13,%xmm2 pxor %xmm14,%xmm4 pxor %xmm15,%xmm8 pxor %xmm4,%xmm7 pxor %xmm4,%xmm8 - pshufd $78,%xmm15,%xmm15 + pshufd $0x4E,%xmm15,%xmm15 pxor %xmm0,%xmm9 - pshufd $78,%xmm0,%xmm0 + pshufd $0x4E,%xmm0,%xmm0 pxor %xmm1,%xmm12 pxor %xmm7,%xmm15 pxor %xmm6,%xmm13 pxor %xmm8,%xmm0 pxor %xmm3,%xmm11 - pshufd $78,%xmm1,%xmm7 + pshufd $0x4E,%xmm1,%xmm7 pxor %xmm2,%xmm14 - pshufd $78,%xmm6,%xmm8 + pshufd $0x4E,%xmm6,%xmm8 pxor %xmm5,%xmm10 - pshufd $78,%xmm3,%xmm1 + pshufd $0x4E,%xmm3,%xmm1 pxor %xmm4,%xmm10 - pshufd $78,%xmm4,%xmm6 + pshufd $0x4E,%xmm4,%xmm6 pxor %xmm4,%xmm11 - pshufd $78,%xmm2,%xmm3 + pshufd $0x4E,%xmm2,%xmm3 pxor %xmm11,%xmm7 - pshufd $78,%xmm5,%xmm2 + pshufd $0x4E,%xmm5,%xmm2 pxor %xmm12,%xmm8 pxor %xmm1,%xmm10 pxor %xmm14,%xmm6 @@ -1552,20 +1552,20 @@ bsaes_xts_encrypt: movdqa %xmm7,(%rax) andq $-16,%r14 - subq $128,%rsp + subq $0x80,%rsp movdqa 32(%rbp),%xmm6 pxor %xmm14,%xmm14 movdqa .Lxts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - subq $128,%r14 + subq $0x80,%r14 jc .Lxts_enc_short jmp .Lxts_enc_loop .align 16 .Lxts_enc_loop: - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm15 movdqa %xmm6,0(%rsp) @@ -1573,7 +1573,7 @@ bsaes_xts_encrypt: pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm0 movdqa %xmm6,16(%rsp) @@ -1582,7 +1582,7 @@ bsaes_xts_encrypt: pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 movdqu 0(%r12),%xmm7 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm1 movdqa %xmm6,32(%rsp) @@ -1592,7 +1592,7 @@ bsaes_xts_encrypt: pxor %xmm13,%xmm6 movdqu 16(%r12),%xmm8 pxor %xmm7,%xmm15 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm2 movdqa %xmm6,48(%rsp) @@ -1602,7 +1602,7 @@ bsaes_xts_encrypt: pxor %xmm13,%xmm6 movdqu 32(%r12),%xmm9 pxor %xmm8,%xmm0 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm3 movdqa %xmm6,64(%rsp) @@ -1612,7 +1612,7 @@ bsaes_xts_encrypt: pxor %xmm13,%xmm6 movdqu 48(%r12),%xmm10 pxor %xmm9,%xmm1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm4 movdqa %xmm6,80(%rsp) @@ -1622,7 +1622,7 @@ bsaes_xts_encrypt: pxor %xmm13,%xmm6 movdqu 64(%r12),%xmm11 pxor %xmm10,%xmm2 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm5 movdqa %xmm6,96(%rsp) @@ -1666,20 +1666,20 @@ bsaes_xts_encrypt: pxor %xmm14,%xmm14 movdqa .Lxts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 paddq %xmm6,%xmm6 pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - subq $128,%r14 + subq $0x80,%r14 jnc .Lxts_enc_loop .Lxts_enc_short: - addq $128,%r14 + addq $0x80,%r14 jz .Lxts_enc_done - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm15 movdqa %xmm6,0(%rsp) @@ -1687,7 +1687,7 @@ bsaes_xts_encrypt: pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm0 movdqa %xmm6,16(%rsp) @@ -1698,7 +1698,7 @@ bsaes_xts_encrypt: movdqu 0(%r12),%xmm7 cmpq $16,%r14 je .Lxts_enc_1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm1 movdqa %xmm6,32(%rsp) @@ -1710,7 +1710,7 @@ bsaes_xts_encrypt: cmpq $32,%r14 je .Lxts_enc_2 pxor %xmm7,%xmm15 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm2 movdqa %xmm6,48(%rsp) @@ -1722,7 +1722,7 @@ bsaes_xts_encrypt: cmpq $48,%r14 je .Lxts_enc_3 pxor %xmm8,%xmm0 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm3 movdqa %xmm6,64(%rsp) @@ -1734,7 +1734,7 @@ bsaes_xts_encrypt: cmpq $64,%r14 je .Lxts_enc_4 pxor %xmm9,%xmm1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm4 movdqa %xmm6,80(%rsp) @@ -1746,7 +1746,7 @@ bsaes_xts_encrypt: cmpq $80,%r14 je .Lxts_enc_5 pxor %xmm10,%xmm2 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm5 movdqa %xmm6,96(%rsp) @@ -2011,20 +2011,20 @@ bsaes_xts_decrypt: shlq $4,%rax subq %rax,%r14 - subq $128,%rsp + subq $0x80,%rsp movdqa 32(%rbp),%xmm6 pxor %xmm14,%xmm14 movdqa .Lxts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - subq $128,%r14 + subq $0x80,%r14 jc .Lxts_dec_short jmp .Lxts_dec_loop .align 16 .Lxts_dec_loop: - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm15 movdqa %xmm6,0(%rsp) @@ -2032,7 +2032,7 @@ bsaes_xts_decrypt: pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm0 movdqa %xmm6,16(%rsp) @@ -2041,7 +2041,7 @@ bsaes_xts_decrypt: pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 movdqu 0(%r12),%xmm7 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm1 movdqa %xmm6,32(%rsp) @@ -2051,7 +2051,7 @@ bsaes_xts_decrypt: pxor %xmm13,%xmm6 movdqu 16(%r12),%xmm8 pxor %xmm7,%xmm15 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm2 movdqa %xmm6,48(%rsp) @@ -2061,7 +2061,7 @@ bsaes_xts_decrypt: pxor %xmm13,%xmm6 movdqu 32(%r12),%xmm9 pxor %xmm8,%xmm0 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm3 movdqa %xmm6,64(%rsp) @@ -2071,7 +2071,7 @@ bsaes_xts_decrypt: pxor %xmm13,%xmm6 movdqu 48(%r12),%xmm10 pxor %xmm9,%xmm1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm4 movdqa %xmm6,80(%rsp) @@ -2081,7 +2081,7 @@ bsaes_xts_decrypt: pxor %xmm13,%xmm6 movdqu 64(%r12),%xmm11 pxor %xmm10,%xmm2 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm5 movdqa %xmm6,96(%rsp) @@ -2125,20 +2125,20 @@ bsaes_xts_decrypt: pxor %xmm14,%xmm14 movdqa .Lxts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 paddq %xmm6,%xmm6 pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - subq $128,%r14 + subq $0x80,%r14 jnc .Lxts_dec_loop .Lxts_dec_short: - addq $128,%r14 + addq $0x80,%r14 jz .Lxts_dec_done - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm15 movdqa %xmm6,0(%rsp) @@ -2146,7 +2146,7 @@ bsaes_xts_decrypt: pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm0 movdqa %xmm6,16(%rsp) @@ -2157,7 +2157,7 @@ bsaes_xts_decrypt: movdqu 0(%r12),%xmm7 cmpq $16,%r14 je .Lxts_dec_1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm1 movdqa %xmm6,32(%rsp) @@ -2169,7 +2169,7 @@ bsaes_xts_decrypt: cmpq $32,%r14 je .Lxts_dec_2 pxor %xmm7,%xmm15 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm2 movdqa %xmm6,48(%rsp) @@ -2181,7 +2181,7 @@ bsaes_xts_decrypt: cmpq $48,%r14 je .Lxts_dec_3 pxor %xmm8,%xmm0 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm3 movdqa %xmm6,64(%rsp) @@ -2193,7 +2193,7 @@ bsaes_xts_decrypt: cmpq $64,%r14 je .Lxts_dec_4 pxor %xmm9,%xmm1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm4 movdqa %xmm6,80(%rsp) @@ -2205,7 +2205,7 @@ bsaes_xts_decrypt: cmpq $80,%r14 je .Lxts_dec_5 pxor %xmm10,%xmm2 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm5 movdqa %xmm6,96(%rsp) @@ -2382,7 +2382,7 @@ bsaes_xts_decrypt: pxor %xmm14,%xmm14 movdqa .Lxts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 movdqa %xmm6,%xmm5 paddq %xmm6,%xmm6 pand %xmm12,%xmm13 diff --git a/vendor/openssl/asm_obsolete/x64-elf-gas/aes/vpaes-x86_64.s b/vendor/openssl/asm_obsolete/x64-elf-gas/aes/vpaes-x86_64.s index b9d6df513..bf7c2b0b6 100644 --- a/vendor/openssl/asm_obsolete/x64-elf-gas/aes/vpaes-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-elf-gas/aes/vpaes-x86_64.s @@ -60,7 +60,7 @@ _vpaes_encrypt_core: addq $16,%r11 pxor %xmm0,%xmm3 .byte 102,15,56,0,193 - andq $48,%r11 + andq $0x30,%r11 subq $1,%rax pxor %xmm3,%xmm0 @@ -120,10 +120,10 @@ _vpaes_decrypt_core: pand %xmm9,%xmm0 .byte 102,15,56,0,208 movdqa .Lk_dipt+16(%rip),%xmm0 - xorq $48,%r11 + xorq $0x30,%r11 leaq .Lk_dsbd(%rip),%r10 .byte 102,15,56,0,193 - andq $48,%r11 + andq $0x30,%r11 pxor %xmm5,%xmm2 movdqa .Lk_mc_forward+48(%rip),%xmm5 pxor %xmm2,%xmm0 @@ -242,7 +242,7 @@ _vpaes_schedule_core: movdqa (%r8,%r10,1),%xmm1 .byte 102,15,56,0,217 movdqu %xmm3,(%rdx) - xorq $48,%r8 + xorq $0x30,%r8 .Lschedule_go: cmpl $192,%esi @@ -332,7 +332,7 @@ _vpaes_schedule_core: call _vpaes_schedule_mangle - pshufd $255,%xmm0,%xmm0 + pshufd $0xFF,%xmm0,%xmm0 movdqa %xmm7,%xmm5 movdqa %xmm6,%xmm7 call _vpaes_schedule_low_round @@ -399,8 +399,8 @@ _vpaes_schedule_core: .type _vpaes_schedule_192_smear,@function .align 16 _vpaes_schedule_192_smear: - pshufd $128,%xmm6,%xmm1 - pshufd $254,%xmm7,%xmm0 + pshufd $0x80,%xmm6,%xmm1 + pshufd $0xFE,%xmm7,%xmm0 pxor %xmm1,%xmm6 pxor %xmm1,%xmm1 pxor %xmm0,%xmm6 @@ -437,7 +437,7 @@ _vpaes_schedule_round: pxor %xmm1,%xmm7 - pshufd $255,%xmm0,%xmm0 + pshufd $0xFF,%xmm0,%xmm0 .byte 102,15,58,15,192,1 @@ -596,7 +596,7 @@ _vpaes_schedule_mangle: movdqa (%r8,%r10,1),%xmm1 .byte 102,15,56,0,217 addq $-16,%r8 - andq $48,%r8 + andq $0x30,%r8 movdqu %xmm3,(%rdx) .byte 0xf3,0xc3 .size _vpaes_schedule_mangle,.-_vpaes_schedule_mangle @@ -614,7 +614,7 @@ vpaes_set_encrypt_key: movl %eax,240(%rdx) movl $0,%ecx - movl $48,%r8d + movl $0x30,%r8d call _vpaes_schedule_core xorl %eax,%eax .byte 0xf3,0xc3 diff --git a/vendor/openssl/asm_obsolete/x64-elf-gas/bn/rsaz-x86_64.s b/vendor/openssl/asm_obsolete/x64-elf-gas/bn/rsaz-x86_64.s index b43eb278e..4a1211329 100644 --- a/vendor/openssl/asm_obsolete/x64-elf-gas/bn/rsaz-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-elf-gas/bn/rsaz-x86_64.s @@ -461,48 +461,94 @@ rsaz_512_mul_gather4: pushq %r14 pushq %r15 - movl %r9d,%r9d - subq $128+24,%rsp + subq $152,%rsp .Lmul_gather4_body: - movl 64(%rdx,%r9,4),%eax -.byte 102,72,15,110,199 - movl (%rdx,%r9,4),%ebx -.byte 102,72,15,110,201 + movd %r9d,%xmm8 + movdqa .Linc+16(%rip),%xmm1 + movdqa .Linc(%rip),%xmm0 + + pshufd $0,%xmm8,%xmm8 + movdqa %xmm1,%xmm7 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm8,%xmm0 + movdqa %xmm7,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm8,%xmm1 + movdqa %xmm7,%xmm4 + paddd %xmm2,%xmm3 + pcmpeqd %xmm8,%xmm2 + movdqa %xmm7,%xmm5 + paddd %xmm3,%xmm4 + pcmpeqd %xmm8,%xmm3 + movdqa %xmm7,%xmm6 + paddd %xmm4,%xmm5 + pcmpeqd %xmm8,%xmm4 + paddd %xmm5,%xmm6 + pcmpeqd %xmm8,%xmm5 + paddd %xmm6,%xmm7 + pcmpeqd %xmm8,%xmm6 + pcmpeqd %xmm8,%xmm7 + + movdqa 0(%rdx),%xmm8 + movdqa 16(%rdx),%xmm9 + movdqa 32(%rdx),%xmm10 + movdqa 48(%rdx),%xmm11 + pand %xmm0,%xmm8 + movdqa 64(%rdx),%xmm12 + pand %xmm1,%xmm9 + movdqa 80(%rdx),%xmm13 + pand %xmm2,%xmm10 + movdqa 96(%rdx),%xmm14 + pand %xmm3,%xmm11 + movdqa 112(%rdx),%xmm15 + leaq 128(%rdx),%rbp + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd $0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 +.byte 102,76,15,126,195 + movq %r8,128(%rsp) + movq %rdi,128+8(%rsp) + movq %rcx,128+16(%rsp) - shlq $32,%rax - orq %rax,%rbx movq (%rsi),%rax movq 8(%rsi),%rcx - leaq 128(%rdx,%r9,4),%rbp mulq %rbx movq %rax,(%rsp) movq %rcx,%rax movq %rdx,%r8 mulq %rbx - movd (%rbp),%xmm4 addq %rax,%r8 movq 16(%rsi),%rax movq %rdx,%r9 adcq $0,%r9 mulq %rbx - movd 64(%rbp),%xmm5 addq %rax,%r9 movq 24(%rsi),%rax movq %rdx,%r10 adcq $0,%r10 mulq %rbx - pslldq $4,%xmm5 addq %rax,%r10 movq 32(%rsi),%rax movq %rdx,%r11 adcq $0,%r11 mulq %rbx - por %xmm5,%xmm4 addq %rax,%r11 movq 40(%rsi),%rax movq %rdx,%r12 @@ -515,14 +561,12 @@ rsaz_512_mul_gather4: adcq $0,%r13 mulq %rbx - leaq 128(%rbp),%rbp addq %rax,%r13 movq 56(%rsi),%rax movq %rdx,%r14 adcq $0,%r14 mulq %rbx -.byte 102,72,15,126,227 addq %rax,%r14 movq (%rsi),%rax movq %rdx,%r15 @@ -534,6 +578,35 @@ rsaz_512_mul_gather4: .align 32 .Loop_mul_gather: + movdqa 0(%rbp),%xmm8 + movdqa 16(%rbp),%xmm9 + movdqa 32(%rbp),%xmm10 + movdqa 48(%rbp),%xmm11 + pand %xmm0,%xmm8 + movdqa 64(%rbp),%xmm12 + pand %xmm1,%xmm9 + movdqa 80(%rbp),%xmm13 + pand %xmm2,%xmm10 + movdqa 96(%rbp),%xmm14 + pand %xmm3,%xmm11 + movdqa 112(%rbp),%xmm15 + leaq 128(%rbp),%rbp + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd $0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 +.byte 102,76,15,126,195 + mulq %rbx addq %rax,%r8 movq 8(%rsi),%rax @@ -542,7 +615,6 @@ rsaz_512_mul_gather4: adcq $0,%r8 mulq %rbx - movd (%rbp),%xmm4 addq %rax,%r9 movq 16(%rsi),%rax adcq $0,%rdx @@ -551,7 +623,6 @@ rsaz_512_mul_gather4: adcq $0,%r9 mulq %rbx - movd 64(%rbp),%xmm5 addq %rax,%r10 movq 24(%rsi),%rax adcq $0,%rdx @@ -560,7 +631,6 @@ rsaz_512_mul_gather4: adcq $0,%r10 mulq %rbx - pslldq $4,%xmm5 addq %rax,%r11 movq 32(%rsi),%rax adcq $0,%rdx @@ -569,7 +639,6 @@ rsaz_512_mul_gather4: adcq $0,%r11 mulq %rbx - por %xmm5,%xmm4 addq %rax,%r12 movq 40(%rsi),%rax adcq $0,%rdx @@ -594,7 +663,6 @@ rsaz_512_mul_gather4: adcq $0,%r14 mulq %rbx -.byte 102,72,15,126,227 addq %rax,%r15 movq (%rsi),%rax adcq $0,%rdx @@ -602,7 +670,6 @@ rsaz_512_mul_gather4: movq %rdx,%r15 adcq $0,%r15 - leaq 128(%rbp),%rbp leaq 8(%rdi),%rdi decl %ecx @@ -617,8 +684,8 @@ rsaz_512_mul_gather4: movq %r14,48(%rdi) movq %r15,56(%rdi) -.byte 102,72,15,126,199 -.byte 102,72,15,126,205 + movq 128+8(%rsp),%rdi + movq 128+16(%rsp),%rbp movq (%rsp),%r8 movq 8(%rsp),%r9 @@ -667,7 +734,7 @@ rsaz_512_mul_scatter4: movl %r9d,%r9d subq $128+24,%rsp .Lmul_scatter4_body: - leaq (%r8,%r9,4),%r8 + leaq (%r8,%r9,8),%r8 .byte 102,72,15,110,199 .byte 102,72,15,110,202 .byte 102,73,15,110,208 @@ -703,30 +770,14 @@ rsaz_512_mul_scatter4: call __rsaz_512_subtract - movl %r8d,0(%rsi) - shrq $32,%r8 - movl %r9d,128(%rsi) - shrq $32,%r9 - movl %r10d,256(%rsi) - shrq $32,%r10 - movl %r11d,384(%rsi) - shrq $32,%r11 - movl %r12d,512(%rsi) - shrq $32,%r12 - movl %r13d,640(%rsi) - shrq $32,%r13 - movl %r14d,768(%rsi) - shrq $32,%r14 - movl %r15d,896(%rsi) - shrq $32,%r15 - movl %r8d,64(%rsi) - movl %r9d,192(%rsi) - movl %r10d,320(%rsi) - movl %r11d,448(%rsi) - movl %r12d,576(%rsi) - movl %r13d,704(%rsi) - movl %r14d,832(%rsi) - movl %r15d,960(%rsi) + movq %r8,0(%rsi) + movq %r9,128(%rsi) + movq %r10,256(%rsi) + movq %r11,384(%rsi) + movq %r12,512(%rsi) + movq %r13,640(%rsi) + movq %r14,768(%rsi) + movq %r15,896(%rsi) leaq 128+24+48(%rsp),%rax movq -48(%rax),%r15 @@ -1079,16 +1130,14 @@ __rsaz_512_mul: .type rsaz_512_scatter4,@function .align 16 rsaz_512_scatter4: - leaq (%rdi,%rdx,4),%rdi + leaq (%rdi,%rdx,8),%rdi movl $8,%r9d jmp .Loop_scatter .align 16 .Loop_scatter: movq (%rsi),%rax leaq 8(%rsi),%rsi - movl %eax,(%rdi) - shrq $32,%rax - movl %eax,64(%rdi) + movq %rax,(%rdi) leaq 128(%rdi),%rdi decl %r9d jnz .Loop_scatter @@ -1099,19 +1148,72 @@ rsaz_512_scatter4: .type rsaz_512_gather4,@function .align 16 rsaz_512_gather4: - leaq (%rsi,%rdx,4),%rsi + movd %edx,%xmm8 + movdqa .Linc+16(%rip),%xmm1 + movdqa .Linc(%rip),%xmm0 + + pshufd $0,%xmm8,%xmm8 + movdqa %xmm1,%xmm7 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm8,%xmm0 + movdqa %xmm7,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm8,%xmm1 + movdqa %xmm7,%xmm4 + paddd %xmm2,%xmm3 + pcmpeqd %xmm8,%xmm2 + movdqa %xmm7,%xmm5 + paddd %xmm3,%xmm4 + pcmpeqd %xmm8,%xmm3 + movdqa %xmm7,%xmm6 + paddd %xmm4,%xmm5 + pcmpeqd %xmm8,%xmm4 + paddd %xmm5,%xmm6 + pcmpeqd %xmm8,%xmm5 + paddd %xmm6,%xmm7 + pcmpeqd %xmm8,%xmm6 + pcmpeqd %xmm8,%xmm7 movl $8,%r9d jmp .Loop_gather .align 16 .Loop_gather: - movl (%rsi),%eax - movl 64(%rsi),%r8d + movdqa 0(%rsi),%xmm8 + movdqa 16(%rsi),%xmm9 + movdqa 32(%rsi),%xmm10 + movdqa 48(%rsi),%xmm11 + pand %xmm0,%xmm8 + movdqa 64(%rsi),%xmm12 + pand %xmm1,%xmm9 + movdqa 80(%rsi),%xmm13 + pand %xmm2,%xmm10 + movdqa 96(%rsi),%xmm14 + pand %xmm3,%xmm11 + movdqa 112(%rsi),%xmm15 leaq 128(%rsi),%rsi - shlq $32,%r8 - orq %r8,%rax - movq %rax,(%rdi) + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd $0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 + movq %xmm8,(%rdi) leaq 8(%rdi),%rdi decl %r9d jnz .Loop_gather .byte 0xf3,0xc3 +.LSEH_end_rsaz_512_gather4: .size rsaz_512_gather4,.-rsaz_512_gather4 + +.align 64 +.Linc: +.long 0,0, 1,1 +.long 2,2, 2,2 diff --git a/vendor/openssl/asm_obsolete/x64-elf-gas/bn/x86_64-gf2m.s b/vendor/openssl/asm_obsolete/x64-elf-gas/bn/x86_64-gf2m.s index eed057ad6..f4e533756 100644 --- a/vendor/openssl/asm_obsolete/x64-elf-gas/bn/x86_64-gf2m.s +++ b/vendor/openssl/asm_obsolete/x64-elf-gas/bn/x86_64-gf2m.s @@ -242,7 +242,7 @@ bn_GF2m_mul_2x2: movq %rcx,56(%rsp) movq %r8,64(%rsp) - movq $15,%r8 + movq $0xf,%r8 movq %rsi,%rax movq %rcx,%rbp call _mul_1x1 diff --git a/vendor/openssl/asm_obsolete/x64-elf-gas/bn/x86_64-mont.s b/vendor/openssl/asm_obsolete/x64-elf-gas/bn/x86_64-mont.s index b09816921..0d36e3d47 100644 --- a/vendor/openssl/asm_obsolete/x64-elf-gas/bn/x86_64-mont.s +++ b/vendor/openssl/asm_obsolete/x64-elf-gas/bn/x86_64-mont.s @@ -34,6 +34,20 @@ bn_mul_mont: movq %r11,8(%rsp,%r9,8) .Lmul_body: + + + + + + + subq %rsp,%r11 + andq $-4096,%r11 +.Lmul_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x66,0x2e + jnc .Lmul_page_walk + movq %rdx,%r12 movq (%r8),%r8 movq (%r12),%rbx @@ -231,6 +245,14 @@ bn_mul4x_mont: movq %r11,8(%rsp,%r9,8) .Lmul4x_body: + subq %rsp,%r11 + andq $-4096,%r11 +.Lmul4x_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc .Lmul4x_page_walk + movq %rdi,16(%rsp,%r9,8) movq %rdx,%r12 movq (%r8),%r8 @@ -633,81 +655,112 @@ bn_sqr8x_mont: - leaq -64(%rsp,%r9,4),%r11 + leaq -64(%rsp,%r9,2),%r11 movq (%r8),%r8 subq %rsi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb .Lsqr8x_sp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,4),%rsp + leaq -64(%rsp,%r9,2),%rsp jmp .Lsqr8x_sp_done .align 32 .Lsqr8x_sp_alt: - leaq 4096-64(,%r9,4),%r10 - leaq -64(%rsp,%r9,4),%rsp + leaq 4096-64(,%r9,2),%r10 + leaq -64(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp .Lsqr8x_sp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +.Lsqr8x_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc .Lsqr8x_page_walk + movq %r9,%r10 negq %r9 - leaq 64(%rsp,%r9,2),%r11 movq %r8,32(%rsp) movq %rax,40(%rsp) .Lsqr8x_body: - movq %r9,%rbp -.byte 102,73,15,110,211 - shrq $3+2,%rbp - movl OPENSSL_ia32cap_P+8(%rip),%eax - jmp .Lsqr8x_copy_n - -.align 32 -.Lsqr8x_copy_n: - movq 0(%rcx),%xmm0 - movq 8(%rcx),%xmm1 - movq 16(%rcx),%xmm3 - movq 24(%rcx),%xmm4 - leaq 32(%rcx),%rcx - movdqa %xmm0,0(%r11) - movdqa %xmm1,16(%r11) - movdqa %xmm3,32(%r11) - movdqa %xmm4,48(%r11) - leaq 64(%r11),%r11 - decq %rbp - jnz .Lsqr8x_copy_n - +.byte 102,72,15,110,209 pxor %xmm0,%xmm0 .byte 102,72,15,110,207 .byte 102,73,15,110,218 call bn_sqr8x_internal + + + + leaq (%rdi,%r9,1),%rbx + movq %r9,%rcx + movq %r9,%rdx +.byte 102,72,15,126,207 + sarq $3+2,%rcx + jmp .Lsqr8x_sub + +.align 32 +.Lsqr8x_sub: + movq 0(%rbx),%r12 + movq 8(%rbx),%r13 + movq 16(%rbx),%r14 + movq 24(%rbx),%r15 + leaq 32(%rbx),%rbx + sbbq 0(%rbp),%r12 + sbbq 8(%rbp),%r13 + sbbq 16(%rbp),%r14 + sbbq 24(%rbp),%r15 + leaq 32(%rbp),%rbp + movq %r12,0(%rdi) + movq %r13,8(%rdi) + movq %r14,16(%rdi) + movq %r15,24(%rdi) + leaq 32(%rdi),%rdi + incq %rcx + jnz .Lsqr8x_sub + + sbbq $0,%rax + leaq (%rbx,%r9,1),%rbx + leaq (%rdi,%r9,1),%rdi + +.byte 102,72,15,110,200 pxor %xmm0,%xmm0 - leaq 48(%rsp),%rax - leaq 64(%rsp,%r9,2),%rdx - shrq $3+2,%r9 + pshufd $0,%xmm1,%xmm1 movq 40(%rsp),%rsi - jmp .Lsqr8x_zero + jmp .Lsqr8x_cond_copy .align 32 -.Lsqr8x_zero: - movdqa %xmm0,0(%rax) - movdqa %xmm0,16(%rax) - movdqa %xmm0,32(%rax) - movdqa %xmm0,48(%rax) - leaq 64(%rax),%rax - movdqa %xmm0,0(%rdx) - movdqa %xmm0,16(%rdx) - movdqa %xmm0,32(%rdx) - movdqa %xmm0,48(%rdx) - leaq 64(%rdx),%rdx - decq %r9 - jnz .Lsqr8x_zero +.Lsqr8x_cond_copy: + movdqa 0(%rbx),%xmm2 + movdqa 16(%rbx),%xmm3 + leaq 32(%rbx),%rbx + movdqu 0(%rdi),%xmm4 + movdqu 16(%rdi),%xmm5 + leaq 32(%rdi),%rdi + movdqa %xmm0,-32(%rbx) + movdqa %xmm0,-16(%rbx) + movdqa %xmm0,-32(%rbx,%rdx,1) + movdqa %xmm0,-16(%rbx,%rdx,1) + pcmpeqd %xmm1,%xmm0 + pand %xmm1,%xmm2 + pand %xmm1,%xmm3 + pand %xmm0,%xmm4 + pand %xmm0,%xmm5 + pxor %xmm0,%xmm0 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqu %xmm4,-32(%rdi) + movdqu %xmm5,-16(%rdi) + addq $32,%r9 + jnz .Lsqr8x_cond_copy movq $1,%rax movq -48(%rsi),%r15 diff --git a/vendor/openssl/asm_obsolete/x64-elf-gas/bn/x86_64-mont5.s b/vendor/openssl/asm_obsolete/x64-elf-gas/bn/x86_64-mont5.s index d2d1fbf4e..a503f6bd8 100644 --- a/vendor/openssl/asm_obsolete/x64-elf-gas/bn/x86_64-mont5.s +++ b/vendor/openssl/asm_obsolete/x64-elf-gas/bn/x86_64-mont5.s @@ -14,46 +14,165 @@ bn_mul_mont_gather5: .Lmul_enter: movl %r9d,%r9d movq %rsp,%rax - movl 8(%rsp),%r10d + movd 8(%rsp),%xmm5 + leaq .Linc(%rip),%r10 pushq %rbx pushq %rbp pushq %r12 pushq %r13 pushq %r14 pushq %r15 + leaq 2(%r9),%r11 negq %r11 - leaq (%rsp,%r11,8),%rsp + leaq -264(%rsp,%r11,8),%rsp andq $-1024,%rsp movq %rax,8(%rsp,%r9,8) .Lmul_body: - movq %rdx,%r12 - movq %r10,%r11 - shrq $3,%r10 - andq $7,%r11 - notq %r10 - leaq .Lmagic_masks(%rip),%rax - andq $3,%r10 - leaq 96(%r12,%r11,8),%r12 - movq 0(%rax,%r10,8),%xmm4 - movq 8(%rax,%r10,8),%xmm5 - movq 16(%rax,%r10,8),%xmm6 - movq 24(%rax,%r10,8),%xmm7 - - movq -96(%r12),%xmm0 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - movq 96(%r12),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 + + + + + + + subq %rsp,%rax + andq $-4096,%rax +.Lmul_page_walk: + movq (%rsp,%rax,1),%r11 + subq $4096,%rax +.byte 0x2e + jnc .Lmul_page_walk + + leaq 128(%rdx),%r12 + movdqa 0(%r10),%xmm0 + movdqa 16(%r10),%xmm1 + leaq 24-112(%rsp,%r9,8),%r10 + andq $-16,%r10 + + pshufd $0,%xmm5,%xmm5 + movdqa %xmm1,%xmm4 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 +.byte 0x67 + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,112(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,128(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,144(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,160(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,176(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,192(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,208(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,224(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,240(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,256(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,272(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,288(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,304(%r10) + + paddd %xmm2,%xmm3 +.byte 0x67 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,320(%r10) + + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,336(%r10) + pand 64(%r12),%xmm0 + + pand 80(%r12),%xmm1 + pand 96(%r12),%xmm2 + movdqa %xmm3,352(%r10) + pand 112(%r12),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -128(%r12),%xmm4 + movdqa -112(%r12),%xmm5 + movdqa -96(%r12),%xmm2 + pand 112(%r10),%xmm4 + movdqa -80(%r12),%xmm3 + pand 128(%r10),%xmm5 + por %xmm4,%xmm0 + pand 144(%r10),%xmm2 + por %xmm5,%xmm1 + pand 160(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -64(%r12),%xmm4 + movdqa -48(%r12),%xmm5 + movdqa -32(%r12),%xmm2 + pand 176(%r10),%xmm4 + movdqa -16(%r12),%xmm3 + pand 192(%r10),%xmm5 + por %xmm4,%xmm0 + pand 208(%r10),%xmm2 + por %xmm5,%xmm1 + pand 224(%r10),%xmm3 por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa 0(%r12),%xmm4 + movdqa 16(%r12),%xmm5 + movdqa 32(%r12),%xmm2 + pand 240(%r10),%xmm4 + movdqa 48(%r12),%xmm3 + pand 256(%r10),%xmm5 + por %xmm4,%xmm0 + pand 272(%r10),%xmm2 + por %xmm5,%xmm1 + pand 288(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + por %xmm1,%xmm0 + pshufd $0x4e,%xmm0,%xmm1 + por %xmm1,%xmm0 leaq 256(%r12),%r12 - por %xmm3,%xmm0 - .byte 102,72,15,126,195 movq (%r8),%r8 @@ -62,29 +181,14 @@ bn_mul_mont_gather5: xorq %r14,%r14 xorq %r15,%r15 - movq -96(%r12),%xmm0 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - movq %r8,%rbp mulq %rbx movq %rax,%r10 movq (%rcx),%rax - movq 96(%r12),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 - imulq %r10,%rbp movq %rdx,%r11 - por %xmm2,%xmm0 - leaq 256(%r12),%r12 - por %xmm3,%xmm0 - mulq %rbp addq %rax,%r10 movq 8(%rsi),%rax @@ -117,14 +221,12 @@ bn_mul_mont_gather5: cmpq %r9,%r15 jne .L1st -.byte 102,72,15,126,195 addq %rax,%r13 - movq (%rsi),%rax adcq $0,%rdx addq %r11,%r13 adcq $0,%rdx - movq %r13,-16(%rsp,%r15,8) + movq %r13,-16(%rsp,%r9,8) movq %rdx,%r13 movq %r10,%r11 @@ -138,33 +240,78 @@ bn_mul_mont_gather5: jmp .Louter .align 16 .Louter: + leaq 24+128(%rsp,%r9,8),%rdx + andq $-16,%rdx + pxor %xmm4,%xmm4 + pxor %xmm5,%xmm5 + movdqa -128(%r12),%xmm0 + movdqa -112(%r12),%xmm1 + movdqa -96(%r12),%xmm2 + movdqa -80(%r12),%xmm3 + pand -128(%rdx),%xmm0 + pand -112(%rdx),%xmm1 + por %xmm0,%xmm4 + pand -96(%rdx),%xmm2 + por %xmm1,%xmm5 + pand -80(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa -64(%r12),%xmm0 + movdqa -48(%r12),%xmm1 + movdqa -32(%r12),%xmm2 + movdqa -16(%r12),%xmm3 + pand -64(%rdx),%xmm0 + pand -48(%rdx),%xmm1 + por %xmm0,%xmm4 + pand -32(%rdx),%xmm2 + por %xmm1,%xmm5 + pand -16(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 0(%r12),%xmm0 + movdqa 16(%r12),%xmm1 + movdqa 32(%r12),%xmm2 + movdqa 48(%r12),%xmm3 + pand 0(%rdx),%xmm0 + pand 16(%rdx),%xmm1 + por %xmm0,%xmm4 + pand 32(%rdx),%xmm2 + por %xmm1,%xmm5 + pand 48(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 64(%r12),%xmm0 + movdqa 80(%r12),%xmm1 + movdqa 96(%r12),%xmm2 + movdqa 112(%r12),%xmm3 + pand 64(%rdx),%xmm0 + pand 80(%rdx),%xmm1 + por %xmm0,%xmm4 + pand 96(%rdx),%xmm2 + por %xmm1,%xmm5 + pand 112(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + por %xmm5,%xmm4 + pshufd $0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 + leaq 256(%r12),%r12 + + movq (%rsi),%rax +.byte 102,72,15,126,195 + xorq %r15,%r15 movq %r8,%rbp movq (%rsp),%r10 - movq -96(%r12),%xmm0 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - mulq %rbx addq %rax,%r10 movq (%rcx),%rax adcq $0,%rdx - movq 96(%r12),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 - imulq %r10,%rbp movq %rdx,%r11 - por %xmm2,%xmm0 - leaq 256(%r12),%r12 - por %xmm3,%xmm0 - mulq %rbp addq %rax,%r10 movq 8(%rsi),%rax @@ -200,15 +347,12 @@ bn_mul_mont_gather5: cmpq %r9,%r15 jne .Linner -.byte 102,72,15,126,195 - addq %rax,%r13 - movq (%rsi),%rax adcq $0,%rdx addq %r10,%r13 - movq (%rsp,%r15,8),%r10 + movq (%rsp,%r9,8),%r10 adcq $0,%rdx - movq %r13,-16(%rsp,%r15,8) + movq %r13,-16(%rsp,%r9,8) movq %rdx,%r13 xorq %rdx,%rdx @@ -255,6 +399,7 @@ bn_mul_mont_gather5: movq 8(%rsp,%r9,8),%rsi movq $1,%rax + movq -48(%rsi),%r15 movq -40(%rsi),%r14 movq -32(%rsi),%r13 @@ -277,10 +422,10 @@ bn_mul4x_mont_gather5: pushq %r13 pushq %r14 pushq %r15 + .byte 0x67 - movl %r9d,%r10d shll $3,%r9d - shll $3+2,%r10d + leaq (%r9,%r9,2),%r10 negq %r9 @@ -290,25 +435,36 @@ bn_mul4x_mont_gather5: - leaq -64(%rsp,%r9,2),%r11 - subq %rsi,%r11 + + + leaq -320(%rsp,%r9,2),%r11 + subq %rdi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb .Lmul4xsp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,2),%rsp + leaq -320(%rsp,%r9,2),%rsp jmp .Lmul4xsp_done .align 32 .Lmul4xsp_alt: - leaq 4096-64(,%r9,2),%r10 - leaq -64(%rsp,%r9,2),%rsp + leaq 4096-320(,%r9,2),%r10 + leaq -320(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp .Lmul4xsp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +.Lmul4x_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc .Lmul4x_page_walk + negq %r9 movq %rax,40(%rsp) @@ -318,6 +474,7 @@ bn_mul4x_mont_gather5: movq 40(%rsp),%rsi movq $1,%rax + movq -48(%rsi),%r15 movq -40(%rsi),%r14 movq -32(%rsi),%r13 @@ -333,47 +490,141 @@ bn_mul4x_mont_gather5: .align 32 mul4x_internal: shlq $5,%r9 - movl 8(%rax),%r10d - leaq 256(%rdx,%r9,1),%r13 + movd 8(%rax),%xmm5 + leaq .Linc(%rip),%rax + leaq 128(%rdx,%r9,1),%r13 shrq $5,%r9 - movq %r10,%r11 - shrq $3,%r10 - andq $7,%r11 - notq %r10 - leaq .Lmagic_masks(%rip),%rax - andq $3,%r10 - leaq 96(%rdx,%r11,8),%r12 - movq 0(%rax,%r10,8),%xmm4 - movq 8(%rax,%r10,8),%xmm5 - addq $7,%r11 - movq 16(%rax,%r10,8),%xmm6 - movq 24(%rax,%r10,8),%xmm7 - andq $7,%r11 - - movq -96(%r12),%xmm0 - leaq 256(%r12),%r14 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - movq 96(%r12),%xmm3 - pand %xmm6,%xmm2 -.byte 0x67 - por %xmm1,%xmm0 - movq -96(%r14),%xmm1 -.byte 0x67 - pand %xmm7,%xmm3 -.byte 0x67 - por %xmm2,%xmm0 - movq -32(%r14),%xmm2 + movdqa 0(%rax),%xmm0 + movdqa 16(%rax),%xmm1 + leaq 88-112(%rsp,%r9,1),%r10 + leaq 128(%rdx),%r12 + + pshufd $0,%xmm5,%xmm5 + movdqa %xmm1,%xmm4 +.byte 0x67,0x67 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 .byte 0x67 - pand %xmm4,%xmm1 + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,112(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,128(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,144(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,160(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,176(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,192(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,208(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,224(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,240(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,256(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,272(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,288(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,304(%r10) + + paddd %xmm2,%xmm3 .byte 0x67 - por %xmm3,%xmm0 - movq 32(%r14),%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,320(%r10) + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,336(%r10) + pand 64(%r12),%xmm0 + + pand 80(%r12),%xmm1 + pand 96(%r12),%xmm2 + movdqa %xmm3,352(%r10) + pand 112(%r12),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -128(%r12),%xmm4 + movdqa -112(%r12),%xmm5 + movdqa -96(%r12),%xmm2 + pand 112(%r10),%xmm4 + movdqa -80(%r12),%xmm3 + pand 128(%r10),%xmm5 + por %xmm4,%xmm0 + pand 144(%r10),%xmm2 + por %xmm5,%xmm1 + pand 160(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -64(%r12),%xmm4 + movdqa -48(%r12),%xmm5 + movdqa -32(%r12),%xmm2 + pand 176(%r10),%xmm4 + movdqa -16(%r12),%xmm3 + pand 192(%r10),%xmm5 + por %xmm4,%xmm0 + pand 208(%r10),%xmm2 + por %xmm5,%xmm1 + pand 224(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa 0(%r12),%xmm4 + movdqa 16(%r12),%xmm5 + movdqa 32(%r12),%xmm2 + pand 240(%r10),%xmm4 + movdqa 48(%r12),%xmm3 + pand 256(%r10),%xmm5 + por %xmm4,%xmm0 + pand 272(%r10),%xmm2 + por %xmm5,%xmm1 + pand 288(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + por %xmm1,%xmm0 + pshufd $0x4e,%xmm0,%xmm1 + por %xmm1,%xmm0 + leaq 256(%r12),%r12 .byte 102,72,15,126,195 - movq 96(%r14),%xmm0 + movq %r13,16+8(%rsp) movq %rdi,56+8(%rsp) @@ -387,26 +638,10 @@ mul4x_internal: movq %rax,%r10 movq (%rcx),%rax - pand %xmm5,%xmm2 - pand %xmm6,%xmm3 - por %xmm2,%xmm1 - imulq %r10,%rbp - - - - - - - - leaq 64+8(%rsp,%r11,8),%r14 + leaq 64+8(%rsp),%r14 movq %rdx,%r11 - pand %xmm7,%xmm0 - por %xmm3,%xmm1 - leaq 512(%r12),%r12 - por %xmm1,%xmm0 - mulq %rbp addq %rax,%r10 movq 8(%rsi,%r9,1),%rax @@ -415,7 +650,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 - movq 16(%rcx),%rax + movq 8(%rcx),%rax adcq $0,%rdx movq %rdx,%r10 @@ -425,7 +660,7 @@ mul4x_internal: adcq $0,%rdx addq %r11,%rdi leaq 32(%r9),%r15 - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx adcq $0,%rdx movq %rdi,(%r14) movq %rdx,%r13 @@ -435,7 +670,7 @@ mul4x_internal: .L1st4x: mulq %rbx addq %rax,%r10 - movq -32(%rcx),%rax + movq -16(%rcx),%rax leaq 32(%r14),%r14 adcq $0,%rdx movq %rdx,%r11 @@ -451,7 +686,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 - movq -16(%rcx),%rax + movq -8(%rcx),%rax adcq $0,%rdx movq %rdx,%r10 @@ -481,7 +716,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 - movq 16(%rcx),%rax + movq 8(%rcx),%rax adcq $0,%rdx movq %rdx,%r10 @@ -490,7 +725,7 @@ mul4x_internal: movq 16(%rsi,%r15,1),%rax adcq $0,%rdx addq %r11,%rdi - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx adcq $0,%rdx movq %rdi,(%r14) movq %rdx,%r13 @@ -500,7 +735,7 @@ mul4x_internal: mulq %rbx addq %rax,%r10 - movq -32(%rcx),%rax + movq -16(%rcx),%rax leaq 32(%r14),%r14 adcq $0,%rdx movq %rdx,%r11 @@ -516,7 +751,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 - movq -16(%rcx),%rax + movq -8(%rcx),%rax adcq $0,%rdx movq %rdx,%r10 @@ -529,8 +764,7 @@ mul4x_internal: movq %rdi,-16(%r14) movq %rdx,%r13 -.byte 102,72,15,126,195 - leaq (%rcx,%r9,2),%rcx + leaq (%rcx,%r9,1),%rcx xorq %rdi,%rdi addq %r10,%r13 @@ -541,6 +775,63 @@ mul4x_internal: .align 32 .Louter4x: + leaq 16+128(%r14),%rdx + pxor %xmm4,%xmm4 + pxor %xmm5,%xmm5 + movdqa -128(%r12),%xmm0 + movdqa -112(%r12),%xmm1 + movdqa -96(%r12),%xmm2 + movdqa -80(%r12),%xmm3 + pand -128(%rdx),%xmm0 + pand -112(%rdx),%xmm1 + por %xmm0,%xmm4 + pand -96(%rdx),%xmm2 + por %xmm1,%xmm5 + pand -80(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa -64(%r12),%xmm0 + movdqa -48(%r12),%xmm1 + movdqa -32(%r12),%xmm2 + movdqa -16(%r12),%xmm3 + pand -64(%rdx),%xmm0 + pand -48(%rdx),%xmm1 + por %xmm0,%xmm4 + pand -32(%rdx),%xmm2 + por %xmm1,%xmm5 + pand -16(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 0(%r12),%xmm0 + movdqa 16(%r12),%xmm1 + movdqa 32(%r12),%xmm2 + movdqa 48(%r12),%xmm3 + pand 0(%rdx),%xmm0 + pand 16(%rdx),%xmm1 + por %xmm0,%xmm4 + pand 32(%rdx),%xmm2 + por %xmm1,%xmm5 + pand 48(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 64(%r12),%xmm0 + movdqa 80(%r12),%xmm1 + movdqa 96(%r12),%xmm2 + movdqa 112(%r12),%xmm3 + pand 64(%rdx),%xmm0 + pand 80(%rdx),%xmm1 + por %xmm0,%xmm4 + pand 96(%rdx),%xmm2 + por %xmm1,%xmm5 + pand 112(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + por %xmm5,%xmm4 + pshufd $0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 + leaq 256(%r12),%r12 +.byte 102,72,15,126,195 + movq (%r14,%r9,1),%r10 movq %r8,%rbp mulq %rbx @@ -548,25 +839,11 @@ mul4x_internal: movq (%rcx),%rax adcq $0,%rdx - movq -96(%r12),%xmm0 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - movq 96(%r12),%xmm3 - imulq %r10,%rbp -.byte 0x67 movq %rdx,%r11 movq %rdi,(%r14) - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 - por %xmm2,%xmm0 leaq (%r14,%r9,1),%r14 - leaq 256(%r12),%r12 - por %xmm3,%xmm0 mulq %rbp addq %rax,%r10 @@ -576,7 +853,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 - movq 16(%rcx),%rax + movq 8(%rcx),%rax adcq $0,%rdx addq 8(%r14),%r11 adcq $0,%rdx @@ -588,7 +865,7 @@ mul4x_internal: adcq $0,%rdx addq %r11,%rdi leaq 32(%r9),%r15 - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx adcq $0,%rdx movq %rdx,%r13 jmp .Linner4x @@ -597,7 +874,7 @@ mul4x_internal: .Linner4x: mulq %rbx addq %rax,%r10 - movq -32(%rcx),%rax + movq -16(%rcx),%rax adcq $0,%rdx addq 16(%r14),%r10 leaq 32(%r14),%r14 @@ -615,7 +892,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 - movq -16(%rcx),%rax + movq -8(%rcx),%rax adcq $0,%rdx addq -8(%r14),%r11 adcq $0,%rdx @@ -649,7 +926,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 - movq 16(%rcx),%rax + movq 8(%rcx),%rax adcq $0,%rdx addq 8(%r14),%r11 adcq $0,%rdx @@ -660,7 +937,7 @@ mul4x_internal: movq 16(%rsi,%r15,1),%rax adcq $0,%rdx addq %r11,%rdi - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx adcq $0,%rdx movq %r13,-8(%r14) movq %rdx,%r13 @@ -670,7 +947,7 @@ mul4x_internal: mulq %rbx addq %rax,%r10 - movq -32(%rcx),%rax + movq -16(%rcx),%rax adcq $0,%rdx addq 16(%r14),%r10 leaq 32(%r14),%r14 @@ -689,7 +966,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 movq %rbp,%rax - movq -16(%rcx),%rbp + movq -8(%rcx),%rbp adcq $0,%rdx addq -8(%r14),%r11 adcq $0,%rdx @@ -704,9 +981,8 @@ mul4x_internal: movq %r13,-24(%r14) movq %rdx,%r13 -.byte 102,72,15,126,195 movq %rdi,-16(%r14) - leaq (%rcx,%r9,2),%rcx + leaq (%rcx,%r9,1),%rcx xorq %rdi,%rdi addq %r10,%r13 @@ -717,16 +993,23 @@ mul4x_internal: cmpq 16+8(%rsp),%r12 jb .Louter4x + xorq %rax,%rax subq %r13,%rbp adcq %r15,%r15 orq %r15,%rdi - xorq $1,%rdi + subq %rdi,%rax leaq (%r14,%r9,1),%rbx - leaq (%rcx,%rdi,8),%rbp + movq (%rcx),%r12 + leaq (%rcx),%rbp movq %r9,%rcx sarq $3+2,%rcx movq 56+8(%rsp),%rdi - jmp .Lsqr4x_sub + decq %r12 + xorq %r10,%r10 + movq 8(%rbp),%r13 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 + jmp .Lsqr4x_sub_entry .size mul4x_internal,.-mul4x_internal .globl bn_power5 .type bn_power5,@function @@ -739,9 +1022,9 @@ bn_power5: pushq %r13 pushq %r14 pushq %r15 - movl %r9d,%r10d + shll $3,%r9d - shll $3+2,%r10d + leal (%r9,%r9,2),%r10d negq %r9 movq (%r8),%r8 @@ -751,25 +1034,35 @@ bn_power5: - leaq -64(%rsp,%r9,2),%r11 - subq %rsi,%r11 + + leaq -320(%rsp,%r9,2),%r11 + subq %rdi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb .Lpwr_sp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,2),%rsp + leaq -320(%rsp,%r9,2),%rsp jmp .Lpwr_sp_done .align 32 .Lpwr_sp_alt: - leaq 4096-64(,%r9,2),%r10 - leaq -64(%rsp,%r9,2),%rsp + leaq 4096-320(,%r9,2),%r10 + leaq -320(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp .Lpwr_sp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +.Lpwr_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc .Lpwr_page_walk + movq %r9,%r10 negq %r9 @@ -791,10 +1084,15 @@ bn_power5: .byte 102,72,15,110,226 call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal .byte 102,72,15,126,209 .byte 102,72,15,126,226 @@ -1338,9 +1636,9 @@ __bn_sqr8x_internal: movq %rbx,-16(%rdi) movq %r8,-8(%rdi) .byte 102,72,15,126,213 -sqr8x_reduction: +__bn_sqr8x_reduction: xorq %rax,%rax - leaq (%rbp,%r9,2),%rcx + leaq (%r9,%rbp,1),%rcx leaq 48+8(%rsp,%r9,2),%rdx movq %rcx,0+8(%rsp) leaq 48+8(%rsp,%r9,1),%rdi @@ -1373,14 +1671,14 @@ sqr8x_reduction: .align 32 .L8x_reduce: mulq %rbx - movq 16(%rbp),%rax + movq 8(%rbp),%rax negq %r8 movq %rdx,%r8 adcq $0,%r8 mulq %rbx addq %rax,%r9 - movq 32(%rbp),%rax + movq 16(%rbp),%rax adcq $0,%rdx addq %r9,%r8 movq %rbx,48-8+8(%rsp,%rcx,8) @@ -1389,7 +1687,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r10 - movq 48(%rbp),%rax + movq 24(%rbp),%rax adcq $0,%rdx addq %r10,%r9 movq 32+8(%rsp),%rsi @@ -1398,7 +1696,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r11 - movq 64(%rbp),%rax + movq 32(%rbp),%rax adcq $0,%rdx imulq %r8,%rsi addq %r11,%r10 @@ -1407,7 +1705,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r12 - movq 80(%rbp),%rax + movq 40(%rbp),%rax adcq $0,%rdx addq %r12,%r11 movq %rdx,%r12 @@ -1415,7 +1713,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r13 - movq 96(%rbp),%rax + movq 48(%rbp),%rax adcq $0,%rdx addq %r13,%r12 movq %rdx,%r13 @@ -1423,7 +1721,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r14 - movq 112(%rbp),%rax + movq 56(%rbp),%rax adcq $0,%rdx addq %r14,%r13 movq %rdx,%r14 @@ -1441,7 +1739,7 @@ sqr8x_reduction: decl %ecx jnz .L8x_reduce - leaq 128(%rbp),%rbp + leaq 64(%rbp),%rbp xorq %rax,%rax movq 8+8(%rsp),%rdx cmpq 0+8(%rsp),%rbp @@ -1467,14 +1765,14 @@ sqr8x_reduction: .L8x_tail: mulq %rbx addq %rax,%r8 - movq 16(%rbp),%rax + movq 8(%rbp),%rax movq %r8,(%rdi) movq %rdx,%r8 adcq $0,%r8 mulq %rbx addq %rax,%r9 - movq 32(%rbp),%rax + movq 16(%rbp),%rax adcq $0,%rdx addq %r9,%r8 leaq 8(%rdi),%rdi @@ -1483,7 +1781,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r10 - movq 48(%rbp),%rax + movq 24(%rbp),%rax adcq $0,%rdx addq %r10,%r9 movq %rdx,%r10 @@ -1491,7 +1789,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r11 - movq 64(%rbp),%rax + movq 32(%rbp),%rax adcq $0,%rdx addq %r11,%r10 movq %rdx,%r11 @@ -1499,7 +1797,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r12 - movq 80(%rbp),%rax + movq 40(%rbp),%rax adcq $0,%rdx addq %r12,%r11 movq %rdx,%r12 @@ -1507,7 +1805,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r13 - movq 96(%rbp),%rax + movq 48(%rbp),%rax adcq $0,%rdx addq %r13,%r12 movq %rdx,%r13 @@ -1515,7 +1813,7 @@ sqr8x_reduction: mulq %rbx addq %rax,%r14 - movq 112(%rbp),%rax + movq 56(%rbp),%rax adcq $0,%rdx addq %r14,%r13 movq %rdx,%r14 @@ -1533,7 +1831,7 @@ sqr8x_reduction: decl %ecx jnz .L8x_tail - leaq 128(%rbp),%rbp + leaq 64(%rbp),%rbp movq 8+8(%rsp),%rdx cmpq 0+8(%rsp),%rbp jae .L8x_tail_done @@ -1579,7 +1877,7 @@ sqr8x_reduction: adcq 48(%rdi),%r14 adcq 56(%rdi),%r15 adcq $0,%rax - movq -16(%rbp),%rcx + movq -8(%rbp),%rcx xorq %rsi,%rsi .byte 102,72,15,126,213 @@ -1597,44 +1895,62 @@ sqr8x_reduction: cmpq %rdx,%rdi jb .L8x_reduction_loop - - subq %r15,%rcx + .byte 0xf3,0xc3 +.size bn_sqr8x_internal,.-bn_sqr8x_internal +.type __bn_post4x_internal,@function +.align 32 +__bn_post4x_internal: + movq 0(%rbp),%r12 leaq (%rdi,%r9,1),%rbx - adcq %rsi,%rsi movq %r9,%rcx - orq %rsi,%rax .byte 102,72,15,126,207 - xorq $1,%rax + negq %rax .byte 102,72,15,126,206 - leaq (%rbp,%rax,8),%rbp sarq $3+2,%rcx - jmp .Lsqr4x_sub + decq %r12 + xorq %r10,%r10 + movq 8(%rbp),%r13 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 + jmp .Lsqr4x_sub_entry -.align 32 +.align 16 .Lsqr4x_sub: -.byte 0x66 - movq 0(%rbx),%r12 - movq 8(%rbx),%r13 - sbbq 0(%rbp),%r12 - movq 16(%rbx),%r14 - sbbq 16(%rbp),%r13 - movq 24(%rbx),%r15 - leaq 32(%rbx),%rbx - sbbq 32(%rbp),%r14 + movq 0(%rbp),%r12 + movq 8(%rbp),%r13 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 +.Lsqr4x_sub_entry: + leaq 32(%rbp),%rbp + notq %r12 + notq %r13 + notq %r14 + notq %r15 + andq %rax,%r12 + andq %rax,%r13 + andq %rax,%r14 + andq %rax,%r15 + + negq %r10 + adcq 0(%rbx),%r12 + adcq 8(%rbx),%r13 + adcq 16(%rbx),%r14 + adcq 24(%rbx),%r15 movq %r12,0(%rdi) - sbbq 48(%rbp),%r15 - leaq 64(%rbp),%rbp + leaq 32(%rbx),%rbx movq %r13,8(%rdi) + sbbq %r10,%r10 movq %r14,16(%rdi) movq %r15,24(%rdi) leaq 32(%rdi),%rdi incq %rcx jnz .Lsqr4x_sub + movq %r9,%r10 negq %r9 .byte 0xf3,0xc3 -.size bn_sqr8x_internal,.-bn_sqr8x_internal +.size __bn_post4x_internal,.-__bn_post4x_internal .globl bn_from_montgomery .type bn_from_montgomery,@function .align 32 @@ -1656,10 +1972,9 @@ bn_from_mont8x: pushq %r13 pushq %r14 pushq %r15 -.byte 0x67 - movl %r9d,%r10d + shll $3,%r9d - shll $3+2,%r10d + leaq (%r9,%r9,2),%r10 negq %r9 movq (%r8),%r8 @@ -1669,25 +1984,35 @@ bn_from_mont8x: - leaq -64(%rsp,%r9,2),%r11 - subq %rsi,%r11 + + leaq -320(%rsp,%r9,2),%r11 + subq %rdi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb .Lfrom_sp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,2),%rsp + leaq -320(%rsp,%r9,2),%rsp jmp .Lfrom_sp_done .align 32 .Lfrom_sp_alt: - leaq 4096-64(,%r9,2),%r10 - leaq -64(%rsp,%r9,2),%rsp + leaq 4096-320(,%r9,2),%r10 + leaq -320(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp .Lfrom_sp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +.Lfrom_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc .Lfrom_page_walk + movq %r9,%r10 negq %r9 @@ -1732,7 +2057,8 @@ bn_from_mont8x: .byte 0x67 movq %rcx,%rbp .byte 102,73,15,110,218 - call sqr8x_reduction + call __bn_sqr8x_reduction + call __bn_post4x_internal pxor %xmm0,%xmm0 leaq 48(%rsp),%rax @@ -1799,45 +2125,169 @@ bn_scatter5: .globl bn_gather5 .type bn_gather5,@function -.align 16 +.align 32 bn_gather5: - movl %ecx,%r11d - shrl $3,%ecx - andq $7,%r11 - notl %ecx - leaq .Lmagic_masks(%rip),%rax - andl $3,%ecx - leaq 128(%rdx,%r11,8),%rdx - movq 0(%rax,%rcx,8),%xmm4 - movq 8(%rax,%rcx,8),%xmm5 - movq 16(%rax,%rcx,8),%xmm6 - movq 24(%rax,%rcx,8),%xmm7 +.LSEH_begin_bn_gather5: + +.byte 0x4c,0x8d,0x14,0x24 +.byte 0x48,0x81,0xec,0x08,0x01,0x00,0x00 + leaq .Linc(%rip),%rax + andq $-16,%rsp + + movd %ecx,%xmm5 + movdqa 0(%rax),%xmm0 + movdqa 16(%rax),%xmm1 + leaq 128(%rdx),%r11 + leaq 128(%rsp),%rax + + pshufd $0,%xmm5,%xmm5 + movdqa %xmm1,%xmm4 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,-128(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,-112(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,-96(%rax) + movdqa %xmm4,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,-80(%rax) + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,-64(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,-48(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,-32(%rax) + movdqa %xmm4,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,-16(%rax) + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,0(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,16(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,32(%rax) + movdqa %xmm4,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,48(%rax) + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,64(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,80(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,96(%rax) + movdqa %xmm4,%xmm2 + movdqa %xmm3,112(%rax) jmp .Lgather -.align 16 -.Lgather: - movq -128(%rdx),%xmm0 - movq -64(%rdx),%xmm1 - pand %xmm4,%xmm0 - movq 0(%rdx),%xmm2 - pand %xmm5,%xmm1 - movq 64(%rdx),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 -.byte 0x67,0x67 - por %xmm2,%xmm0 - leaq 256(%rdx),%rdx - por %xmm3,%xmm0 +.align 32 +.Lgather: + pxor %xmm4,%xmm4 + pxor %xmm5,%xmm5 + movdqa -128(%r11),%xmm0 + movdqa -112(%r11),%xmm1 + movdqa -96(%r11),%xmm2 + pand -128(%rax),%xmm0 + movdqa -80(%r11),%xmm3 + pand -112(%rax),%xmm1 + por %xmm0,%xmm4 + pand -96(%rax),%xmm2 + por %xmm1,%xmm5 + pand -80(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa -64(%r11),%xmm0 + movdqa -48(%r11),%xmm1 + movdqa -32(%r11),%xmm2 + pand -64(%rax),%xmm0 + movdqa -16(%r11),%xmm3 + pand -48(%rax),%xmm1 + por %xmm0,%xmm4 + pand -32(%rax),%xmm2 + por %xmm1,%xmm5 + pand -16(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 0(%r11),%xmm0 + movdqa 16(%r11),%xmm1 + movdqa 32(%r11),%xmm2 + pand 0(%rax),%xmm0 + movdqa 48(%r11),%xmm3 + pand 16(%rax),%xmm1 + por %xmm0,%xmm4 + pand 32(%rax),%xmm2 + por %xmm1,%xmm5 + pand 48(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 64(%r11),%xmm0 + movdqa 80(%r11),%xmm1 + movdqa 96(%r11),%xmm2 + pand 64(%rax),%xmm0 + movdqa 112(%r11),%xmm3 + pand 80(%rax),%xmm1 + por %xmm0,%xmm4 + pand 96(%rax),%xmm2 + por %xmm1,%xmm5 + pand 112(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + por %xmm5,%xmm4 + leaq 256(%r11),%r11 + pshufd $0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 movq %xmm0,(%rdi) leaq 8(%rdi),%rdi subl $1,%esi jnz .Lgather + + leaq (%r10),%rsp .byte 0xf3,0xc3 .LSEH_end_bn_gather5: .size bn_gather5,.-bn_gather5 .align 64 -.Lmagic_masks: -.long 0,0, 0,0, 0,0, -1,-1 -.long 0,0, 0,0, 0,0, 0,0 +.Linc: +.long 0,0, 1,1 +.long 2,2, 2,2 .byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105,112,108,105,99,97,116,105,111,110,32,119,105,116,104,32,115,99,97,116,116,101,114,47,103,97,116,104,101,114,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 diff --git a/vendor/openssl/asm_obsolete/x64-elf-gas/camellia/cmll-x86_64.s b/vendor/openssl/asm_obsolete/x64-elf-gas/camellia/cmll-x86_64.s index ac7da4dfc..1117381f3 100644 --- a/vendor/openssl/asm_obsolete/x64-elf-gas/camellia/cmll-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-elf-gas/camellia/cmll-x86_64.s @@ -1624,7 +1624,7 @@ Camellia_cbc_encrypt: leaq -64-63(%rcx),%r10 subq %rsp,%r10 negq %r10 - andq $960,%r10 + andq $0x3C0,%r10 subq %r10,%rsp diff --git a/vendor/openssl/asm_obsolete/x64-elf-gas/ec/ecp_nistz256-x86_64.s b/vendor/openssl/asm_obsolete/x64-elf-gas/ec/ecp_nistz256-x86_64.s index 393782329..7876e3829 100644 --- a/vendor/openssl/asm_obsolete/x64-elf-gas/ec/ecp_nistz256-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-elf-gas/ec/ecp_nistz256-x86_64.s @@ -1121,6 +1121,7 @@ ecp_nistz256_point_double: pushq %r15 subq $160+8,%rsp +.Lpoint_double_shortcutq: movdqu 0(%rsi),%xmm0 movq %rsi,%rbx movdqu 16(%rsi),%xmm1 @@ -1341,7 +1342,7 @@ ecp_nistz256_point_add: por %xmm1,%xmm3 movdqu 0(%rsi),%xmm0 - pshufd $177,%xmm3,%xmm5 + pshufd $0xb1,%xmm3,%xmm5 movdqu 16(%rsi),%xmm1 movdqu 32(%rsi),%xmm2 por %xmm3,%xmm5 @@ -1351,7 +1352,7 @@ ecp_nistz256_point_add: movq 64+16(%rsi),%r15 movq 64+24(%rsi),%r8 movdqa %xmm0,480(%rsp) - pshufd $30,%xmm5,%xmm4 + pshufd $0x1e,%xmm5,%xmm4 movdqa %xmm1,480+16(%rsp) por %xmm0,%xmm1 .byte 102,72,15,110,199 @@ -1371,10 +1372,10 @@ ecp_nistz256_point_add: call __ecp_nistz256_sqr_montq pcmpeqd %xmm4,%xmm5 - pshufd $177,%xmm3,%xmm4 + pshufd $0xb1,%xmm3,%xmm4 por %xmm3,%xmm4 pshufd $0,%xmm5,%xmm5 - pshufd $30,%xmm4,%xmm3 + pshufd $0x1e,%xmm4,%xmm3 por %xmm3,%xmm4 pxor %xmm3,%xmm3 pcmpeqd %xmm3,%xmm4 @@ -1383,6 +1384,7 @@ ecp_nistz256_point_add: movq 64+8(%rbx),%r14 movq 64+16(%rbx),%r15 movq 64+24(%rbx),%r8 +.byte 102,72,15,110,203 leaq 64-0(%rbx),%rsi leaq 32(%rsp),%rdi @@ -1474,7 +1476,7 @@ ecp_nistz256_point_add: testq %r8,%r8 jnz .Ladd_proceedq testq %r9,%r9 - jz .Ladd_proceedq + jz .Ladd_doubleq .byte 102,72,15,126,199 pxor %xmm0,%xmm0 @@ -1486,6 +1488,13 @@ ecp_nistz256_point_add: movdqu %xmm0,80(%rdi) jmp .Ladd_doneq +.align 32 +.Ladd_doubleq: +.byte 102,72,15,126,206 +.byte 102,72,15,126,199 + addq $416,%rsp + jmp .Lpoint_double_shortcutq + .align 32 .Ladd_proceedq: movq 0+64(%rsp),%rax @@ -1733,13 +1742,13 @@ ecp_nistz256_point_add_affine: por %xmm1,%xmm3 movdqu 0(%rbx),%xmm0 - pshufd $177,%xmm3,%xmm5 + pshufd $0xb1,%xmm3,%xmm5 movdqu 16(%rbx),%xmm1 movdqu 32(%rbx),%xmm2 por %xmm3,%xmm5 movdqu 48(%rbx),%xmm3 movdqa %xmm0,416(%rsp) - pshufd $30,%xmm5,%xmm4 + pshufd $0x1e,%xmm5,%xmm4 movdqa %xmm1,416+16(%rsp) por %xmm0,%xmm1 .byte 102,72,15,110,199 @@ -1755,13 +1764,13 @@ ecp_nistz256_point_add_affine: call __ecp_nistz256_sqr_montq pcmpeqd %xmm4,%xmm5 - pshufd $177,%xmm3,%xmm4 + pshufd $0xb1,%xmm3,%xmm4 movq 0(%rbx),%rax movq %r12,%r9 por %xmm3,%xmm4 pshufd $0,%xmm5,%xmm5 - pshufd $30,%xmm4,%xmm3 + pshufd $0x1e,%xmm4,%xmm3 movq %r13,%r10 por %xmm3,%xmm4 pxor %xmm3,%xmm3 diff --git a/vendor/openssl/asm_obsolete/x64-elf-gas/md5/md5-x86_64.s b/vendor/openssl/asm_obsolete/x64-elf-gas/md5/md5-x86_64.s index 53f44ff5f..fad85c498 100644 --- a/vendor/openssl/asm_obsolete/x64-elf-gas/md5/md5-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-elf-gas/md5/md5-x86_64.s @@ -493,14 +493,14 @@ md5_block_asm_data_order: movl %ecx,%r11d addl %ecx,%ebx movl 0(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d xorl %edx,%r11d leal -198630844(%rax,%r10,1),%eax orl %ebx,%r11d xorl %ecx,%r11d addl %r11d,%eax movl 28(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $6,%eax xorl %ecx,%r11d addl %ebx,%eax @@ -509,7 +509,7 @@ md5_block_asm_data_order: xorl %ebx,%r11d addl %r11d,%edx movl 56(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $10,%edx xorl %ebx,%r11d addl %eax,%edx @@ -518,7 +518,7 @@ md5_block_asm_data_order: xorl %eax,%r11d addl %r11d,%ecx movl 20(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $15,%ecx xorl %eax,%r11d addl %edx,%ecx @@ -527,7 +527,7 @@ md5_block_asm_data_order: xorl %edx,%r11d addl %r11d,%ebx movl 48(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $21,%ebx xorl %edx,%r11d addl %ecx,%ebx @@ -536,7 +536,7 @@ md5_block_asm_data_order: xorl %ecx,%r11d addl %r11d,%eax movl 12(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $6,%eax xorl %ecx,%r11d addl %ebx,%eax @@ -545,7 +545,7 @@ md5_block_asm_data_order: xorl %ebx,%r11d addl %r11d,%edx movl 40(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $10,%edx xorl %ebx,%r11d addl %eax,%edx @@ -554,7 +554,7 @@ md5_block_asm_data_order: xorl %eax,%r11d addl %r11d,%ecx movl 4(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $15,%ecx xorl %eax,%r11d addl %edx,%ecx @@ -563,7 +563,7 @@ md5_block_asm_data_order: xorl %edx,%r11d addl %r11d,%ebx movl 32(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $21,%ebx xorl %edx,%r11d addl %ecx,%ebx @@ -572,7 +572,7 @@ md5_block_asm_data_order: xorl %ecx,%r11d addl %r11d,%eax movl 60(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $6,%eax xorl %ecx,%r11d addl %ebx,%eax @@ -581,7 +581,7 @@ md5_block_asm_data_order: xorl %ebx,%r11d addl %r11d,%edx movl 24(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $10,%edx xorl %ebx,%r11d addl %eax,%edx @@ -590,7 +590,7 @@ md5_block_asm_data_order: xorl %eax,%r11d addl %r11d,%ecx movl 52(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $15,%ecx xorl %eax,%r11d addl %edx,%ecx @@ -599,7 +599,7 @@ md5_block_asm_data_order: xorl %edx,%r11d addl %r11d,%ebx movl 16(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $21,%ebx xorl %edx,%r11d addl %ecx,%ebx @@ -608,7 +608,7 @@ md5_block_asm_data_order: xorl %ecx,%r11d addl %r11d,%eax movl 44(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $6,%eax xorl %ecx,%r11d addl %ebx,%eax @@ -617,7 +617,7 @@ md5_block_asm_data_order: xorl %ebx,%r11d addl %r11d,%edx movl 8(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $10,%edx xorl %ebx,%r11d addl %eax,%edx @@ -626,7 +626,7 @@ md5_block_asm_data_order: xorl %eax,%r11d addl %r11d,%ecx movl 36(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $15,%ecx xorl %eax,%r11d addl %edx,%ecx @@ -635,7 +635,7 @@ md5_block_asm_data_order: xorl %edx,%r11d addl %r11d,%ebx movl 0(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $21,%ebx xorl %edx,%r11d addl %ecx,%ebx diff --git a/vendor/openssl/asm_obsolete/x64-elf-gas/modes/ghash-x86_64.s b/vendor/openssl/asm_obsolete/x64-elf-gas/modes/ghash-x86_64.s index 462ef7fe7..e3e9b813c 100644 --- a/vendor/openssl/asm_obsolete/x64-elf-gas/modes/ghash-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-elf-gas/modes/ghash-x86_64.s @@ -20,14 +20,14 @@ gcm_gmult_4bit: movq $14,%rcx movq 8(%rsi,%rax,1),%r8 movq (%rsi,%rax,1),%r9 - andb $240,%bl + andb $0xf0,%bl movq %r8,%rdx jmp .Loop1 .align 16 .Loop1: shrq $4,%r8 - andq $15,%rdx + andq $0xf,%rdx movq %r9,%r10 movb (%rdi,%rcx,1),%al shrq $4,%r9 @@ -43,13 +43,13 @@ gcm_gmult_4bit: js .Lbreak1 shrq $4,%r8 - andq $15,%rdx + andq $0xf,%rdx movq %r9,%r10 shrq $4,%r9 xorq 8(%rsi,%rax,1),%r8 shlq $60,%r10 xorq (%rsi,%rax,1),%r9 - andb $240,%bl + andb $0xf0,%bl xorq (%r11,%rdx,8),%r9 movq %r8,%rdx xorq %r10,%r8 @@ -58,19 +58,19 @@ gcm_gmult_4bit: .align 16 .Lbreak1: shrq $4,%r8 - andq $15,%rdx + andq $0xf,%rdx movq %r9,%r10 shrq $4,%r9 xorq 8(%rsi,%rax,1),%r8 shlq $60,%r10 xorq (%rsi,%rax,1),%r9 - andb $240,%bl + andb $0xf0,%bl xorq (%r11,%rdx,8),%r9 movq %r8,%rdx xorq %r10,%r8 shrq $4,%r8 - andq $15,%rdx + andq $0xf,%rdx movq %r9,%r10 shrq $4,%r9 xorq 8(%rsi,%rbx,1),%r8 @@ -874,20 +874,20 @@ gcm_ghash_clmul: movdqu 32(%rsi),%xmm7 .byte 102,65,15,56,0,194 - subq $16,%rcx + subq $0x10,%rcx jz .Lodd_tail movdqu 16(%rsi),%xmm6 movl OPENSSL_ia32cap_P+4(%rip),%eax - cmpq $48,%rcx + cmpq $0x30,%rcx jb .Lskip4x andl $71303168,%eax cmpl $4194304,%eax je .Lskip4x - subq $48,%rcx - movq $11547335547999543296,%rax + subq $0x30,%rcx + movq $0xA040608020C0E000,%rax movdqu 48(%rsi),%xmm14 movdqu 64(%rsi),%xmm15 @@ -934,7 +934,7 @@ gcm_ghash_clmul: xorps %xmm13,%xmm5 leaq 64(%rdx),%rdx - subq $64,%rcx + subq $0x40,%rcx jc .Ltail4x jmp .Lmod4_loop @@ -1017,7 +1017,7 @@ gcm_ghash_clmul: xorps %xmm13,%xmm5 leaq 64(%rdx),%rdx - subq $64,%rcx + subq $0x40,%rcx jnc .Lmod4_loop .Ltail4x: @@ -1061,10 +1061,10 @@ gcm_ghash_clmul: pxor %xmm4,%xmm0 psrlq $1,%xmm0 pxor %xmm1,%xmm0 - addq $64,%rcx + addq $0x40,%rcx jz .Ldone movdqu 32(%rsi),%xmm7 - subq $16,%rcx + subq $0x10,%rcx jz .Lodd_tail .Lskip4x: @@ -1087,7 +1087,7 @@ gcm_ghash_clmul: leaq 32(%rdx),%rdx nop - subq $32,%rcx + subq $0x20,%rcx jbe .Leven_tail nop jmp .Lmod_loop @@ -1150,7 +1150,7 @@ gcm_ghash_clmul: .byte 102,15,58,68,231,0 pxor %xmm1,%xmm0 - subq $32,%rcx + subq $0x20,%rcx ja .Lmod_loop .Leven_tail: diff --git a/vendor/openssl/asm_obsolete/x64-elf-gas/sha/sha1-mb-x86_64.s b/vendor/openssl/asm_obsolete/x64-elf-gas/sha/sha1-mb-x86_64.s index 8a1e5e7b5..dd4921b13 100644 --- a/vendor/openssl/asm_obsolete/x64-elf-gas/sha/sha1-mb-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-elf-gas/sha/sha1-mb-x86_64.s @@ -2857,8 +2857,8 @@ _shaext_shortcut: .byte 69,15,58,204,193,3 .byte 69,15,56,200,214 - pshufd $0,%xmm6,%xmm11 - pshufd $85,%xmm6,%xmm12 + pshufd $0x00,%xmm6,%xmm11 + pshufd $0x55,%xmm6,%xmm12 movdqa %xmm6,%xmm7 pcmpgtd %xmm4,%xmm11 pcmpgtd %xmm4,%xmm12 diff --git a/vendor/openssl/asm_obsolete/x64-elf-gas/sha/sha256-mb-x86_64.s b/vendor/openssl/asm_obsolete/x64-elf-gas/sha/sha256-mb-x86_64.s index 7f8e35a92..0f23c3043 100644 --- a/vendor/openssl/asm_obsolete/x64-elf-gas/sha/sha256-mb-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-elf-gas/sha/sha256-mb-x86_64.s @@ -2712,11 +2712,11 @@ _shaext_shortcut: movdqa %xmm2,%xmm0 movdqa %xmm15,112(%rsp) .byte 69,15,56,203,254 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 pxor %xmm12,%xmm4 movdqa %xmm12,64(%rsp) .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 pxor %xmm14,%xmm8 movdqa %xmm14,96(%rsp) movdqa 16-128(%rbp),%xmm1 @@ -2734,11 +2734,11 @@ _shaext_shortcut: .byte 102,68,15,56,0,211 prefetcht0 127(%r9) .byte 69,15,56,203,254 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 .byte 102,68,15,56,0,219 .byte 15,56,204,229 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 32-128(%rbp),%xmm1 paddd %xmm6,%xmm1 .byte 69,15,56,203,247 @@ -2751,14 +2751,14 @@ _shaext_shortcut: movdqa %xmm2,%xmm0 movdqa %xmm7,%xmm3 .byte 69,15,56,203,254 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 .byte 102,15,58,15,222,4 paddd %xmm3,%xmm4 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 .byte 15,56,204,238 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 48-128(%rbp),%xmm1 paddd %xmm7,%xmm1 .byte 69,15,56,203,247 @@ -2775,13 +2775,13 @@ _shaext_shortcut: .byte 102,15,58,15,223,4 .byte 69,15,56,203,254 .byte 69,15,56,205,195 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm5 movdqa %xmm8,%xmm3 .byte 102,65,15,58,15,219,4 .byte 15,56,204,247 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 64-128(%rbp),%xmm1 paddd %xmm4,%xmm1 .byte 69,15,56,203,247 @@ -2797,13 +2797,13 @@ _shaext_shortcut: .byte 102,15,58,15,220,4 .byte 69,15,56,203,254 .byte 69,15,56,205,200 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm6 movdqa %xmm9,%xmm3 .byte 102,65,15,58,15,216,4 .byte 15,56,204,252 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 80-128(%rbp),%xmm1 paddd %xmm5,%xmm1 .byte 69,15,56,203,247 @@ -2819,13 +2819,13 @@ _shaext_shortcut: .byte 102,15,58,15,221,4 .byte 69,15,56,203,254 .byte 69,15,56,205,209 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm7 movdqa %xmm10,%xmm3 .byte 102,65,15,58,15,217,4 .byte 15,56,204,229 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 96-128(%rbp),%xmm1 paddd %xmm6,%xmm1 .byte 69,15,56,203,247 @@ -2841,13 +2841,13 @@ _shaext_shortcut: .byte 102,15,58,15,222,4 .byte 69,15,56,203,254 .byte 69,15,56,205,218 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm4 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 .byte 15,56,204,238 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 112-128(%rbp),%xmm1 paddd %xmm7,%xmm1 .byte 69,15,56,203,247 @@ -2863,13 +2863,13 @@ _shaext_shortcut: .byte 102,15,58,15,223,4 .byte 69,15,56,203,254 .byte 69,15,56,205,195 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm5 movdqa %xmm8,%xmm3 .byte 102,65,15,58,15,219,4 .byte 15,56,204,247 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 128-128(%rbp),%xmm1 paddd %xmm4,%xmm1 .byte 69,15,56,203,247 @@ -2885,13 +2885,13 @@ _shaext_shortcut: .byte 102,15,58,15,220,4 .byte 69,15,56,203,254 .byte 69,15,56,205,200 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm6 movdqa %xmm9,%xmm3 .byte 102,65,15,58,15,216,4 .byte 15,56,204,252 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 144-128(%rbp),%xmm1 paddd %xmm5,%xmm1 .byte 69,15,56,203,247 @@ -2907,13 +2907,13 @@ _shaext_shortcut: .byte 102,15,58,15,221,4 .byte 69,15,56,203,254 .byte 69,15,56,205,209 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm7 movdqa %xmm10,%xmm3 .byte 102,65,15,58,15,217,4 .byte 15,56,204,229 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 160-128(%rbp),%xmm1 paddd %xmm6,%xmm1 .byte 69,15,56,203,247 @@ -2929,13 +2929,13 @@ _shaext_shortcut: .byte 102,15,58,15,222,4 .byte 69,15,56,203,254 .byte 69,15,56,205,218 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm4 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 .byte 15,56,204,238 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 176-128(%rbp),%xmm1 paddd %xmm7,%xmm1 .byte 69,15,56,203,247 @@ -2951,13 +2951,13 @@ _shaext_shortcut: .byte 102,15,58,15,223,4 .byte 69,15,56,203,254 .byte 69,15,56,205,195 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm5 movdqa %xmm8,%xmm3 .byte 102,65,15,58,15,219,4 .byte 15,56,204,247 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 192-128(%rbp),%xmm1 paddd %xmm4,%xmm1 .byte 69,15,56,203,247 @@ -2973,13 +2973,13 @@ _shaext_shortcut: .byte 102,15,58,15,220,4 .byte 69,15,56,203,254 .byte 69,15,56,205,200 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm6 movdqa %xmm9,%xmm3 .byte 102,65,15,58,15,216,4 .byte 15,56,204,252 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 208-128(%rbp),%xmm1 paddd %xmm5,%xmm1 .byte 69,15,56,203,247 @@ -2995,13 +2995,13 @@ _shaext_shortcut: .byte 102,15,58,15,221,4 .byte 69,15,56,203,254 .byte 69,15,56,205,209 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm7 movdqa %xmm10,%xmm3 .byte 102,65,15,58,15,217,4 nop .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 224-128(%rbp),%xmm1 paddd %xmm6,%xmm1 .byte 69,15,56,203,247 @@ -3018,13 +3018,13 @@ _shaext_shortcut: pxor %xmm6,%xmm6 .byte 69,15,56,203,254 .byte 69,15,56,205,218 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 movdqa 240-128(%rbp),%xmm1 paddd %xmm7,%xmm1 movq (%rbx),%xmm7 nop .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 240-128(%rbp),%xmm2 paddd %xmm11,%xmm2 .byte 69,15,56,203,247 @@ -3034,17 +3034,17 @@ _shaext_shortcut: cmovgeq %rsp,%r8 cmpl 4(%rbx),%ecx cmovgeq %rsp,%r9 - pshufd $0,%xmm7,%xmm9 + pshufd $0x00,%xmm7,%xmm9 .byte 69,15,56,203,236 movdqa %xmm2,%xmm0 - pshufd $85,%xmm7,%xmm10 + pshufd $0x55,%xmm7,%xmm10 movdqa %xmm7,%xmm11 .byte 69,15,56,203,254 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 pcmpgtd %xmm6,%xmm9 pcmpgtd %xmm6,%xmm10 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 pcmpgtd %xmm6,%xmm11 movdqa K256_shaext-16(%rip),%xmm3 .byte 69,15,56,203,247 diff --git a/vendor/openssl/asm_obsolete/x64-elf-gas/sha/sha256-x86_64.s b/vendor/openssl/asm_obsolete/x64-elf-gas/sha/sha256-x86_64.s index d2951d8ea..ab16a7b61 100644 --- a/vendor/openssl/asm_obsolete/x64-elf-gas/sha/sha256-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-elf-gas/sha/sha256-x86_64.s @@ -1754,9 +1754,9 @@ _shaext_shortcut: movdqu 16(%rdi),%xmm2 movdqa 512-128(%rcx),%xmm7 - pshufd $27,%xmm1,%xmm0 - pshufd $177,%xmm1,%xmm1 - pshufd $27,%xmm2,%xmm2 + pshufd $0x1b,%xmm1,%xmm0 + pshufd $0xb1,%xmm1,%xmm1 + pshufd $0x1b,%xmm2,%xmm2 movdqa %xmm7,%xmm8 .byte 102,15,58,15,202,8 punpcklqdq %xmm0,%xmm2 @@ -1775,7 +1775,7 @@ _shaext_shortcut: .byte 102,15,56,0,231 movdqa %xmm2,%xmm10 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 nop movdqa %xmm1,%xmm9 .byte 15,56,203,202 @@ -1784,7 +1784,7 @@ _shaext_shortcut: paddd %xmm4,%xmm0 .byte 102,15,56,0,239 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 leaq 64(%rsi),%rsi .byte 15,56,204,220 .byte 15,56,203,202 @@ -1793,7 +1793,7 @@ _shaext_shortcut: paddd %xmm5,%xmm0 .byte 102,15,56,0,247 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm6,%xmm7 .byte 102,15,58,15,253,4 nop @@ -1805,7 +1805,7 @@ _shaext_shortcut: paddd %xmm6,%xmm0 .byte 15,56,205,222 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm3,%xmm7 .byte 102,15,58,15,254,4 nop @@ -1816,7 +1816,7 @@ _shaext_shortcut: paddd %xmm3,%xmm0 .byte 15,56,205,227 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm4,%xmm7 .byte 102,15,58,15,251,4 nop @@ -1827,7 +1827,7 @@ _shaext_shortcut: paddd %xmm4,%xmm0 .byte 15,56,205,236 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm5,%xmm7 .byte 102,15,58,15,252,4 nop @@ -1838,7 +1838,7 @@ _shaext_shortcut: paddd %xmm5,%xmm0 .byte 15,56,205,245 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm6,%xmm7 .byte 102,15,58,15,253,4 nop @@ -1849,7 +1849,7 @@ _shaext_shortcut: paddd %xmm6,%xmm0 .byte 15,56,205,222 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm3,%xmm7 .byte 102,15,58,15,254,4 nop @@ -1860,7 +1860,7 @@ _shaext_shortcut: paddd %xmm3,%xmm0 .byte 15,56,205,227 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm4,%xmm7 .byte 102,15,58,15,251,4 nop @@ -1871,7 +1871,7 @@ _shaext_shortcut: paddd %xmm4,%xmm0 .byte 15,56,205,236 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm5,%xmm7 .byte 102,15,58,15,252,4 nop @@ -1882,7 +1882,7 @@ _shaext_shortcut: paddd %xmm5,%xmm0 .byte 15,56,205,245 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm6,%xmm7 .byte 102,15,58,15,253,4 nop @@ -1893,7 +1893,7 @@ _shaext_shortcut: paddd %xmm6,%xmm0 .byte 15,56,205,222 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm3,%xmm7 .byte 102,15,58,15,254,4 nop @@ -1904,7 +1904,7 @@ _shaext_shortcut: paddd %xmm3,%xmm0 .byte 15,56,205,227 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm4,%xmm7 .byte 102,15,58,15,251,4 nop @@ -1915,7 +1915,7 @@ _shaext_shortcut: paddd %xmm4,%xmm0 .byte 15,56,205,236 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm5,%xmm7 .byte 102,15,58,15,252,4 .byte 15,56,203,202 @@ -1924,7 +1924,7 @@ _shaext_shortcut: movdqa 448-128(%rcx),%xmm0 paddd %xmm5,%xmm0 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 .byte 15,56,205,245 movdqa %xmm8,%xmm7 .byte 15,56,203,202 @@ -1933,7 +1933,7 @@ _shaext_shortcut: paddd %xmm6,%xmm0 nop .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 decq %rdx nop .byte 15,56,203,202 @@ -1942,9 +1942,9 @@ _shaext_shortcut: paddd %xmm9,%xmm1 jnz .Loop_shaext - pshufd $177,%xmm2,%xmm2 - pshufd $27,%xmm1,%xmm7 - pshufd $177,%xmm1,%xmm1 + pshufd $0xb1,%xmm2,%xmm2 + pshufd $0x1b,%xmm1,%xmm7 + pshufd $0xb1,%xmm1,%xmm1 punpckhqdq %xmm2,%xmm1 .byte 102,15,58,15,215,8 diff --git a/vendor/openssl/asm_obsolete/x64-elf-gas/x86_64cpuid.s b/vendor/openssl/asm_obsolete/x64-elf-gas/x86_64cpuid.s index 656a5ce85..0e81a290e 100644 --- a/vendor/openssl/asm_obsolete/x64-elf-gas/x86_64cpuid.s +++ b/vendor/openssl/asm_obsolete/x64-elf-gas/x86_64cpuid.s @@ -44,43 +44,43 @@ OPENSSL_ia32_cpuid: movl %eax,%r11d xorl %eax,%eax - cmpl $1970169159,%ebx + cmpl $0x756e6547,%ebx setne %al movl %eax,%r9d - cmpl $1231384169,%edx + cmpl $0x49656e69,%edx setne %al orl %eax,%r9d - cmpl $1818588270,%ecx + cmpl $0x6c65746e,%ecx setne %al orl %eax,%r9d jz .Lintel - cmpl $1752462657,%ebx + cmpl $0x68747541,%ebx setne %al movl %eax,%r10d - cmpl $1769238117,%edx + cmpl $0x69746E65,%edx setne %al orl %eax,%r10d - cmpl $1145913699,%ecx + cmpl $0x444D4163,%ecx setne %al orl %eax,%r10d jnz .Lintel - movl $2147483648,%eax + movl $0x80000000,%eax cpuid - cmpl $2147483649,%eax + cmpl $0x80000001,%eax jb .Lintel movl %eax,%r10d - movl $2147483649,%eax + movl $0x80000001,%eax cpuid orl %ecx,%r9d - andl $2049,%r9d + andl $0x00000801,%r9d - cmpl $2147483656,%r10d + cmpl $0x80000008,%r10d jb .Lintel - movl $2147483656,%eax + movl $0x80000008,%eax cpuid movzbq %cl,%r10 incq %r10 @@ -92,7 +92,7 @@ OPENSSL_ia32_cpuid: shrl $16,%ebx cmpb %r10b,%bl ja .Lgeneric - andl $4026531839,%edx + andl $0xefffffff,%edx jmp .Lgeneric .Lintel: @@ -105,7 +105,7 @@ OPENSSL_ia32_cpuid: cpuid movl %eax,%r10d shrl $14,%r10d - andl $4095,%r10d + andl $0xfff,%r10d cmpl $7,%r11d jb .Lnocacheinfo @@ -118,29 +118,29 @@ OPENSSL_ia32_cpuid: .Lnocacheinfo: movl $1,%eax cpuid - andl $3220176895,%edx + andl $0xbfefffff,%edx cmpl $0,%r9d jne .Lnotintel - orl $1073741824,%edx + orl $0x40000000,%edx andb $15,%ah cmpb $15,%ah jne .Lnotintel - orl $1048576,%edx + orl $0x00100000,%edx .Lnotintel: btl $28,%edx jnc .Lgeneric - andl $4026531839,%edx + andl $0xefffffff,%edx cmpl $0,%r10d je .Lgeneric - orl $268435456,%edx + orl $0x10000000,%edx shrl $16,%ebx cmpb $1,%bl ja .Lgeneric - andl $4026531839,%edx + andl $0xefffffff,%edx .Lgeneric: - andl $2048,%r9d - andl $4294965247,%ecx + andl $0x00000800,%r9d + andl $0xfffff7ff,%ecx orl %ecx,%r9d movl %edx,%r10d @@ -152,9 +152,9 @@ OPENSSL_ia32_cpuid: cmpl $6,%eax je .Ldone .Lclear_avx: - movl $4026525695,%eax + movl $0xefffe7ff,%eax andl %eax,%r9d - andl $4294967263,8(%rdi) + andl $0xffffffdf,8(%rdi) .Ldone: shlq $32,%r9 movl %r10d,%eax diff --git a/vendor/openssl/asm_obsolete/x64-macosx-gas/aes/aes-x86_64.s b/vendor/openssl/asm_obsolete/x64-macosx-gas/aes/aes-x86_64.s index a50170a9a..cb2db3584 100644 --- a/vendor/openssl/asm_obsolete/x64-macosx-gas/aes/aes-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-macosx-gas/aes/aes-x86_64.s @@ -81,8 +81,8 @@ L$enc_loop: movl 0(%r14,%rdi,8),%edi movl 0(%r14,%rbp,8),%ebp - andl $65280,%edi - andl $65280,%ebp + andl $0x0000ff00,%edi + andl $0x0000ff00,%ebp xorl %edi,%r10d xorl %ebp,%r11d @@ -94,8 +94,8 @@ L$enc_loop: movl 0(%r14,%rsi,8),%esi movl 0(%r14,%rdi,8),%edi - andl $65280,%esi - andl $65280,%edi + andl $0x0000ff00,%esi + andl $0x0000ff00,%edi shrl $16,%ebx xorl %esi,%r12d xorl %edi,%r8d @@ -108,9 +108,9 @@ L$enc_loop: movl 0(%r14,%rdi,8),%edi movl 0(%r14,%rbp,8),%ebp - andl $16711680,%esi - andl $16711680,%edi - andl $16711680,%ebp + andl $0x00ff0000,%esi + andl $0x00ff0000,%edi + andl $0x00ff0000,%ebp xorl %esi,%r10d xorl %edi,%r11d @@ -123,9 +123,9 @@ L$enc_loop: movl 2(%r14,%rdi,8),%edi movl 2(%r14,%rbp,8),%ebp - andl $16711680,%esi - andl $4278190080,%edi - andl $4278190080,%ebp + andl $0x00ff0000,%esi + andl $0xff000000,%edi + andl $0xff000000,%ebp xorl %esi,%r8d xorl %edi,%r10d @@ -138,8 +138,8 @@ L$enc_loop: movl 2(%r14,%rdi,8),%edi movl 16+0(%r15),%eax - andl $4278190080,%esi - andl $4278190080,%edi + andl $0xff000000,%esi + andl $0xff000000,%edi xorl %esi,%r12d xorl %edi,%r8d @@ -241,8 +241,8 @@ L$enc_loop_compact: xorl %r8d,%edx cmpq 16(%rsp),%r15 je L$enc_compact_done - movl $2155905152,%r10d - movl $2155905152,%r11d + movl $0x80808080,%r10d + movl $0x80808080,%r11d andl %eax,%r10d andl %ebx,%r11d movl %r10d,%esi @@ -253,10 +253,10 @@ L$enc_loop_compact: leal (%rbx,%rbx,1),%r9d subl %r10d,%esi subl %r11d,%edi - andl $4278124286,%r8d - andl $4278124286,%r9d - andl $454761243,%esi - andl $454761243,%edi + andl $0xfefefefe,%r8d + andl $0xfefefefe,%r9d + andl $0x1b1b1b1b,%esi + andl $0x1b1b1b1b,%edi movl %eax,%r10d movl %ebx,%r11d xorl %esi,%r8d @@ -264,9 +264,9 @@ L$enc_loop_compact: xorl %r8d,%eax xorl %r9d,%ebx - movl $2155905152,%r12d + movl $0x80808080,%r12d roll $24,%eax - movl $2155905152,%ebp + movl $0x80808080,%ebp roll $24,%ebx andl %ecx,%r12d andl %edx,%ebp @@ -289,10 +289,10 @@ L$enc_loop_compact: xorl %r10d,%eax xorl %r11d,%ebx - andl $4278124286,%r8d - andl $4278124286,%r9d - andl $454761243,%esi - andl $454761243,%edi + andl $0xfefefefe,%r8d + andl $0xfefefefe,%r9d + andl $0x1b1b1b1b,%esi + andl $0x1b1b1b1b,%edi movl %ecx,%r12d movl %edx,%ebp xorl %esi,%r8d @@ -345,7 +345,7 @@ _AES_encrypt: andq $-64,%rsp subq %rsp,%rcx negq %rcx - andq $960,%rcx + andq $0x3c0,%rcx subq %rcx,%rsp subq $32,%rsp @@ -370,7 +370,7 @@ L$enc_prologue: leaq L$AES_Te+2048(%rip),%r14 leaq 768(%rsp),%rbp subq %r14,%rbp - andq $768,%rbp + andq $0x300,%rbp leaq (%r14,%rbp,1),%r14 call _x86_64_AES_encrypt_compact @@ -792,7 +792,7 @@ _AES_decrypt: andq $-64,%rsp subq %rsp,%rcx negq %rcx - andq $960,%rcx + andq $0x3c0,%rcx subq %rcx,%rsp subq $32,%rsp @@ -817,7 +817,7 @@ L$dec_prologue: leaq L$AES_Td+2048(%rip),%r14 leaq 768(%rsp),%rbp subq %r14,%rbp - andq $768,%rbp + andq $0x300,%rbp leaq (%r14,%rbp,1),%r14 shrq $3,%rbp addq %rbp,%r14 @@ -1333,9 +1333,9 @@ L$cbc_picked_te: movq %r14,%r10 leaq 2304(%r14),%r11 movq %r15,%r12 - andq $4095,%r10 - andq $4095,%r11 - andq $4095,%r12 + andq $0xFFF,%r10 + andq $0xFFF,%r11 + andq $0xFFF,%r12 cmpq %r11,%r12 jb L$cbc_te_break_out @@ -1344,7 +1344,7 @@ L$cbc_picked_te: jmp L$cbc_te_ok L$cbc_te_break_out: subq %r10,%r12 - andq $4095,%r12 + andq $0xFFF,%r12 addq $320,%r12 subq %r12,%r15 .p2align 2 @@ -1370,7 +1370,7 @@ L$cbc_fast_body: movq %r15,%r10 subq %r14,%r10 - andq $4095,%r10 + andq $0xfff,%r10 cmpq $2304,%r10 jb L$cbc_do_ecopy cmpq $4096-248,%r10 @@ -1557,7 +1557,7 @@ L$cbc_slow_prologue: leaq -88-63(%rcx),%r10 subq %rbp,%r10 negq %r10 - andq $960,%r10 + andq $0x3c0,%r10 subq %r10,%rbp xchgq %rsp,%rbp @@ -1586,7 +1586,7 @@ L$cbc_slow_body: leaq 2048(%r14),%r14 leaq 768-8(%rsp),%rax subq %r14,%rax - andq $768,%rax + andq $0x300,%rax leaq (%r14,%rax,1),%r14 cmpq $0,%rbx diff --git a/vendor/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s b/vendor/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s index 41ad80eeb..dde837980 100644 --- a/vendor/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s @@ -503,7 +503,7 @@ _aesni_ecb_encrypt: testl %r8d,%r8d jz L$ecb_decrypt - cmpq $128,%rdx + cmpq $0x80,%rdx jb L$ecb_enc_tail movdqu (%rdi),%xmm2 @@ -515,7 +515,7 @@ _aesni_ecb_encrypt: movdqu 96(%rdi),%xmm8 movdqu 112(%rdi),%xmm9 leaq 128(%rdi),%rdi - subq $128,%rdx + subq $0x80,%rdx jmp L$ecb_enc_loop8_enter .p2align 4 L$ecb_enc_loop8: @@ -543,7 +543,7 @@ L$ecb_enc_loop8_enter: call _aesni_encrypt8 - subq $128,%rdx + subq $0x80,%rdx jnc L$ecb_enc_loop8 movups %xmm2,(%rsi) @@ -557,22 +557,22 @@ L$ecb_enc_loop8_enter: movups %xmm8,96(%rsi) movups %xmm9,112(%rsi) leaq 128(%rsi),%rsi - addq $128,%rdx + addq $0x80,%rdx jz L$ecb_ret L$ecb_enc_tail: movups (%rdi),%xmm2 - cmpq $32,%rdx + cmpq $0x20,%rdx jb L$ecb_enc_one movups 16(%rdi),%xmm3 je L$ecb_enc_two movups 32(%rdi),%xmm4 - cmpq $64,%rdx + cmpq $0x40,%rdx jb L$ecb_enc_three movups 48(%rdi),%xmm5 je L$ecb_enc_four movups 64(%rdi),%xmm6 - cmpq $96,%rdx + cmpq $0x60,%rdx jb L$ecb_enc_five movups 80(%rdi),%xmm7 je L$ecb_enc_six @@ -646,7 +646,7 @@ L$ecb_enc_six: .p2align 4 L$ecb_decrypt: - cmpq $128,%rdx + cmpq $0x80,%rdx jb L$ecb_dec_tail movdqu (%rdi),%xmm2 @@ -658,7 +658,7 @@ L$ecb_decrypt: movdqu 96(%rdi),%xmm8 movdqu 112(%rdi),%xmm9 leaq 128(%rdi),%rdi - subq $128,%rdx + subq $0x80,%rdx jmp L$ecb_dec_loop8_enter .p2align 4 L$ecb_dec_loop8: @@ -687,7 +687,7 @@ L$ecb_dec_loop8_enter: call _aesni_decrypt8 movups (%r11),%xmm0 - subq $128,%rdx + subq $0x80,%rdx jnc L$ecb_dec_loop8 movups %xmm2,(%rsi) @@ -709,22 +709,22 @@ L$ecb_dec_loop8_enter: movups %xmm9,112(%rsi) pxor %xmm9,%xmm9 leaq 128(%rsi),%rsi - addq $128,%rdx + addq $0x80,%rdx jz L$ecb_ret L$ecb_dec_tail: movups (%rdi),%xmm2 - cmpq $32,%rdx + cmpq $0x20,%rdx jb L$ecb_dec_one movups 16(%rdi),%xmm3 je L$ecb_dec_two movups 32(%rdi),%xmm4 - cmpq $64,%rdx + cmpq $0x40,%rdx jb L$ecb_dec_three movups 48(%rdi),%xmm5 je L$ecb_dec_four movups 64(%rdi),%xmm6 - cmpq $96,%rdx + cmpq $0x60,%rdx jb L$ecb_dec_five movups 80(%rdi),%xmm7 je L$ecb_dec_six @@ -1598,7 +1598,7 @@ L$oop_enc1_8: movdqa L$xts_magic(%rip),%xmm8 movdqa %xmm2,%xmm15 - pshufd $95,%xmm2,%xmm9 + pshufd $0x5f,%xmm2,%xmm9 pxor %xmm0,%xmm1 movdqa %xmm9,%xmm14 paddd %xmm9,%xmm9 @@ -1697,7 +1697,7 @@ L$xts_enc_grandloop: .byte 102,15,56,220,248 movups 64(%r11),%xmm0 movdqa %xmm8,80(%rsp) - pshufd $95,%xmm15,%xmm9 + pshufd $0x5f,%xmm15,%xmm9 jmp L$xts_enc_loop6 .p2align 5 L$xts_enc_loop6: @@ -1836,13 +1836,13 @@ L$xts_enc_short: jz L$xts_enc_done pxor %xmm0,%xmm11 - cmpq $32,%rdx + cmpq $0x20,%rdx jb L$xts_enc_one pxor %xmm0,%xmm12 je L$xts_enc_two pxor %xmm0,%xmm13 - cmpq $64,%rdx + cmpq $0x40,%rdx jb L$xts_enc_three pxor %xmm0,%xmm14 je L$xts_enc_four @@ -2069,7 +2069,7 @@ L$oop_enc1_11: movdqa L$xts_magic(%rip),%xmm8 movdqa %xmm2,%xmm15 - pshufd $95,%xmm2,%xmm9 + pshufd $0x5f,%xmm2,%xmm9 pxor %xmm0,%xmm1 movdqa %xmm9,%xmm14 paddd %xmm9,%xmm9 @@ -2168,7 +2168,7 @@ L$xts_dec_grandloop: .byte 102,15,56,222,248 movups 64(%r11),%xmm0 movdqa %xmm8,80(%rsp) - pshufd $95,%xmm15,%xmm9 + pshufd $0x5f,%xmm15,%xmm9 jmp L$xts_dec_loop6 .p2align 5 L$xts_dec_loop6: @@ -2308,13 +2308,13 @@ L$xts_dec_short: jz L$xts_dec_done pxor %xmm0,%xmm12 - cmpq $32,%rdx + cmpq $0x20,%rdx jb L$xts_dec_one pxor %xmm0,%xmm13 je L$xts_dec_two pxor %xmm0,%xmm14 - cmpq $64,%rdx + cmpq $0x40,%rdx jb L$xts_dec_three je L$xts_dec_four @@ -2345,7 +2345,7 @@ L$xts_dec_short: pcmpgtd %xmm15,%xmm14 movdqu %xmm6,64(%rsi) leaq 80(%rsi),%rsi - pshufd $19,%xmm14,%xmm11 + pshufd $0x13,%xmm14,%xmm11 andq $15,%r9 jz L$xts_dec_ret @@ -2634,7 +2634,7 @@ L$cbc_decrypt_bulk: leaq -8(%rax),%rbp movups (%r8),%xmm10 movl %r10d,%eax - cmpq $80,%rdx + cmpq $0x50,%rdx jbe L$cbc_dec_tail movups (%rcx),%xmm0 @@ -2650,14 +2650,14 @@ L$cbc_decrypt_bulk: movdqu 80(%rdi),%xmm7 movdqa %xmm6,%xmm15 movl _OPENSSL_ia32cap_P+4(%rip),%r9d - cmpq $112,%rdx + cmpq $0x70,%rdx jbe L$cbc_dec_six_or_seven andl $71303168,%r9d - subq $80,%rdx + subq $0x50,%rdx cmpl $4194304,%r9d je L$cbc_dec_loop6_enter - subq $32,%rdx + subq $0x20,%rdx leaq 112(%rcx),%rcx jmp L$cbc_dec_loop8_enter .p2align 4 @@ -2672,7 +2672,7 @@ L$cbc_dec_loop8_enter: movups 16-112(%rcx),%xmm1 pxor %xmm0,%xmm4 xorq %r11,%r11 - cmpq $112,%rdx + cmpq $0x70,%rdx pxor %xmm0,%xmm5 pxor %xmm0,%xmm6 pxor %xmm0,%xmm7 @@ -2857,21 +2857,21 @@ L$cbc_dec_done: movups %xmm8,96(%rsi) leaq 112(%rsi),%rsi - subq $128,%rdx + subq $0x80,%rdx ja L$cbc_dec_loop8 movaps %xmm9,%xmm2 leaq -112(%rcx),%rcx - addq $112,%rdx + addq $0x70,%rdx jle L$cbc_dec_clear_tail_collected movups %xmm9,(%rsi) leaq 16(%rsi),%rsi - cmpq $80,%rdx + cmpq $0x50,%rdx jbe L$cbc_dec_tail movaps %xmm11,%xmm2 L$cbc_dec_six_or_seven: - cmpq $96,%rdx + cmpq $0x60,%rdx ja L$cbc_dec_seven movaps %xmm7,%xmm8 @@ -2964,33 +2964,33 @@ L$cbc_dec_loop6_enter: movl %r10d,%eax movdqu %xmm6,64(%rsi) leaq 80(%rsi),%rsi - subq $96,%rdx + subq $0x60,%rdx ja L$cbc_dec_loop6 movdqa %xmm7,%xmm2 - addq $80,%rdx + addq $0x50,%rdx jle L$cbc_dec_clear_tail_collected movups %xmm7,(%rsi) leaq 16(%rsi),%rsi L$cbc_dec_tail: movups (%rdi),%xmm2 - subq $16,%rdx + subq $0x10,%rdx jbe L$cbc_dec_one movups 16(%rdi),%xmm3 movaps %xmm2,%xmm11 - subq $16,%rdx + subq $0x10,%rdx jbe L$cbc_dec_two movups 32(%rdi),%xmm4 movaps %xmm3,%xmm12 - subq $16,%rdx + subq $0x10,%rdx jbe L$cbc_dec_three movups 48(%rdi),%xmm5 movaps %xmm4,%xmm13 - subq $16,%rdx + subq $0x10,%rdx jbe L$cbc_dec_four movups 64(%rdi),%xmm6 @@ -3015,7 +3015,7 @@ L$cbc_dec_tail: movdqa %xmm6,%xmm2 pxor %xmm6,%xmm6 pxor %xmm7,%xmm7 - subq $16,%rdx + subq $0x10,%rdx jmp L$cbc_dec_tail_collected .p2align 4 @@ -3332,7 +3332,7 @@ L$oop_key192: pslldq $4,%xmm0 pxor %xmm3,%xmm0 - pshufd $255,%xmm0,%xmm3 + pshufd $0xff,%xmm0,%xmm3 pxor %xmm1,%xmm3 pslldq $4,%xmm1 pxor %xmm1,%xmm3 @@ -3419,7 +3419,7 @@ L$oop_key256: decl %r10d jz L$done_key256 - pshufd $255,%xmm0,%xmm2 + pshufd $0xff,%xmm0,%xmm2 pxor %xmm3,%xmm3 .byte 102,15,56,221,211 diff --git a/vendor/openssl/asm_obsolete/x64-macosx-gas/aes/bsaes-x86_64.s b/vendor/openssl/asm_obsolete/x64-macosx-gas/aes/bsaes-x86_64.s index 2af36a90b..52ae782e9 100644 --- a/vendor/openssl/asm_obsolete/x64-macosx-gas/aes/bsaes-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-macosx-gas/aes/bsaes-x86_64.s @@ -324,45 +324,45 @@ L$enc_sbox: pxor %xmm2,%xmm5 decl %r10d jl L$enc_done - pshufd $147,%xmm15,%xmm7 - pshufd $147,%xmm0,%xmm8 + pshufd $0x93,%xmm15,%xmm7 + pshufd $0x93,%xmm0,%xmm8 pxor %xmm7,%xmm15 - pshufd $147,%xmm3,%xmm9 + pshufd $0x93,%xmm3,%xmm9 pxor %xmm8,%xmm0 - pshufd $147,%xmm5,%xmm10 + pshufd $0x93,%xmm5,%xmm10 pxor %xmm9,%xmm3 - pshufd $147,%xmm2,%xmm11 + pshufd $0x93,%xmm2,%xmm11 pxor %xmm10,%xmm5 - pshufd $147,%xmm6,%xmm12 + pshufd $0x93,%xmm6,%xmm12 pxor %xmm11,%xmm2 - pshufd $147,%xmm1,%xmm13 + pshufd $0x93,%xmm1,%xmm13 pxor %xmm12,%xmm6 - pshufd $147,%xmm4,%xmm14 + pshufd $0x93,%xmm4,%xmm14 pxor %xmm13,%xmm1 pxor %xmm14,%xmm4 pxor %xmm15,%xmm8 pxor %xmm4,%xmm7 pxor %xmm4,%xmm8 - pshufd $78,%xmm15,%xmm15 + pshufd $0x4E,%xmm15,%xmm15 pxor %xmm0,%xmm9 - pshufd $78,%xmm0,%xmm0 + pshufd $0x4E,%xmm0,%xmm0 pxor %xmm2,%xmm12 pxor %xmm7,%xmm15 pxor %xmm6,%xmm13 pxor %xmm8,%xmm0 pxor %xmm5,%xmm11 - pshufd $78,%xmm2,%xmm7 + pshufd $0x4E,%xmm2,%xmm7 pxor %xmm1,%xmm14 - pshufd $78,%xmm6,%xmm8 + pshufd $0x4E,%xmm6,%xmm8 pxor %xmm3,%xmm10 - pshufd $78,%xmm5,%xmm2 + pshufd $0x4E,%xmm5,%xmm2 pxor %xmm4,%xmm10 - pshufd $78,%xmm4,%xmm6 + pshufd $0x4E,%xmm4,%xmm6 pxor %xmm4,%xmm11 - pshufd $78,%xmm1,%xmm5 + pshufd $0x4E,%xmm1,%xmm5 pxor %xmm11,%xmm7 - pshufd $78,%xmm3,%xmm1 + pshufd $0x4E,%xmm3,%xmm1 pxor %xmm12,%xmm8 pxor %xmm10,%xmm2 pxor %xmm14,%xmm6 @@ -796,24 +796,24 @@ L$dec_sbox: decl %r10d jl L$dec_done - pshufd $78,%xmm15,%xmm7 - pshufd $78,%xmm2,%xmm13 + pshufd $0x4E,%xmm15,%xmm7 + pshufd $0x4E,%xmm2,%xmm13 pxor %xmm15,%xmm7 - pshufd $78,%xmm4,%xmm14 + pshufd $0x4E,%xmm4,%xmm14 pxor %xmm2,%xmm13 - pshufd $78,%xmm0,%xmm8 + pshufd $0x4E,%xmm0,%xmm8 pxor %xmm4,%xmm14 - pshufd $78,%xmm5,%xmm9 + pshufd $0x4E,%xmm5,%xmm9 pxor %xmm0,%xmm8 - pshufd $78,%xmm3,%xmm10 + pshufd $0x4E,%xmm3,%xmm10 pxor %xmm5,%xmm9 pxor %xmm13,%xmm15 pxor %xmm13,%xmm0 - pshufd $78,%xmm1,%xmm11 + pshufd $0x4E,%xmm1,%xmm11 pxor %xmm3,%xmm10 pxor %xmm7,%xmm5 pxor %xmm8,%xmm3 - pshufd $78,%xmm6,%xmm12 + pshufd $0x4E,%xmm6,%xmm12 pxor %xmm1,%xmm11 pxor %xmm14,%xmm0 pxor %xmm9,%xmm1 @@ -827,45 +827,45 @@ L$dec_sbox: pxor %xmm14,%xmm1 pxor %xmm14,%xmm6 pxor %xmm12,%xmm4 - pshufd $147,%xmm15,%xmm7 - pshufd $147,%xmm0,%xmm8 + pshufd $0x93,%xmm15,%xmm7 + pshufd $0x93,%xmm0,%xmm8 pxor %xmm7,%xmm15 - pshufd $147,%xmm5,%xmm9 + pshufd $0x93,%xmm5,%xmm9 pxor %xmm8,%xmm0 - pshufd $147,%xmm3,%xmm10 + pshufd $0x93,%xmm3,%xmm10 pxor %xmm9,%xmm5 - pshufd $147,%xmm1,%xmm11 + pshufd $0x93,%xmm1,%xmm11 pxor %xmm10,%xmm3 - pshufd $147,%xmm6,%xmm12 + pshufd $0x93,%xmm6,%xmm12 pxor %xmm11,%xmm1 - pshufd $147,%xmm2,%xmm13 + pshufd $0x93,%xmm2,%xmm13 pxor %xmm12,%xmm6 - pshufd $147,%xmm4,%xmm14 + pshufd $0x93,%xmm4,%xmm14 pxor %xmm13,%xmm2 pxor %xmm14,%xmm4 pxor %xmm15,%xmm8 pxor %xmm4,%xmm7 pxor %xmm4,%xmm8 - pshufd $78,%xmm15,%xmm15 + pshufd $0x4E,%xmm15,%xmm15 pxor %xmm0,%xmm9 - pshufd $78,%xmm0,%xmm0 + pshufd $0x4E,%xmm0,%xmm0 pxor %xmm1,%xmm12 pxor %xmm7,%xmm15 pxor %xmm6,%xmm13 pxor %xmm8,%xmm0 pxor %xmm3,%xmm11 - pshufd $78,%xmm1,%xmm7 + pshufd $0x4E,%xmm1,%xmm7 pxor %xmm2,%xmm14 - pshufd $78,%xmm6,%xmm8 + pshufd $0x4E,%xmm6,%xmm8 pxor %xmm5,%xmm10 - pshufd $78,%xmm3,%xmm1 + pshufd $0x4E,%xmm3,%xmm1 pxor %xmm4,%xmm10 - pshufd $78,%xmm4,%xmm6 + pshufd $0x4E,%xmm4,%xmm6 pxor %xmm4,%xmm11 - pshufd $78,%xmm2,%xmm3 + pshufd $0x4E,%xmm2,%xmm3 pxor %xmm11,%xmm7 - pshufd $78,%xmm5,%xmm2 + pshufd $0x4E,%xmm5,%xmm2 pxor %xmm12,%xmm8 pxor %xmm1,%xmm10 pxor %xmm14,%xmm6 @@ -1552,20 +1552,20 @@ L$xts_enc_prologue: movdqa %xmm7,(%rax) andq $-16,%r14 - subq $128,%rsp + subq $0x80,%rsp movdqa 32(%rbp),%xmm6 pxor %xmm14,%xmm14 movdqa L$xts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - subq $128,%r14 + subq $0x80,%r14 jc L$xts_enc_short jmp L$xts_enc_loop .p2align 4 L$xts_enc_loop: - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm15 movdqa %xmm6,0(%rsp) @@ -1573,7 +1573,7 @@ L$xts_enc_loop: pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm0 movdqa %xmm6,16(%rsp) @@ -1582,7 +1582,7 @@ L$xts_enc_loop: pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 movdqu 0(%r12),%xmm7 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm1 movdqa %xmm6,32(%rsp) @@ -1592,7 +1592,7 @@ L$xts_enc_loop: pxor %xmm13,%xmm6 movdqu 16(%r12),%xmm8 pxor %xmm7,%xmm15 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm2 movdqa %xmm6,48(%rsp) @@ -1602,7 +1602,7 @@ L$xts_enc_loop: pxor %xmm13,%xmm6 movdqu 32(%r12),%xmm9 pxor %xmm8,%xmm0 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm3 movdqa %xmm6,64(%rsp) @@ -1612,7 +1612,7 @@ L$xts_enc_loop: pxor %xmm13,%xmm6 movdqu 48(%r12),%xmm10 pxor %xmm9,%xmm1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm4 movdqa %xmm6,80(%rsp) @@ -1622,7 +1622,7 @@ L$xts_enc_loop: pxor %xmm13,%xmm6 movdqu 64(%r12),%xmm11 pxor %xmm10,%xmm2 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm5 movdqa %xmm6,96(%rsp) @@ -1666,20 +1666,20 @@ L$xts_enc_loop: pxor %xmm14,%xmm14 movdqa L$xts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 paddq %xmm6,%xmm6 pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - subq $128,%r14 + subq $0x80,%r14 jnc L$xts_enc_loop L$xts_enc_short: - addq $128,%r14 + addq $0x80,%r14 jz L$xts_enc_done - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm15 movdqa %xmm6,0(%rsp) @@ -1687,7 +1687,7 @@ L$xts_enc_short: pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm0 movdqa %xmm6,16(%rsp) @@ -1698,7 +1698,7 @@ L$xts_enc_short: movdqu 0(%r12),%xmm7 cmpq $16,%r14 je L$xts_enc_1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm1 movdqa %xmm6,32(%rsp) @@ -1710,7 +1710,7 @@ L$xts_enc_short: cmpq $32,%r14 je L$xts_enc_2 pxor %xmm7,%xmm15 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm2 movdqa %xmm6,48(%rsp) @@ -1722,7 +1722,7 @@ L$xts_enc_short: cmpq $48,%r14 je L$xts_enc_3 pxor %xmm8,%xmm0 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm3 movdqa %xmm6,64(%rsp) @@ -1734,7 +1734,7 @@ L$xts_enc_short: cmpq $64,%r14 je L$xts_enc_4 pxor %xmm9,%xmm1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm4 movdqa %xmm6,80(%rsp) @@ -1746,7 +1746,7 @@ L$xts_enc_short: cmpq $80,%r14 je L$xts_enc_5 pxor %xmm10,%xmm2 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm5 movdqa %xmm6,96(%rsp) @@ -2011,20 +2011,20 @@ L$xts_dec_prologue: shlq $4,%rax subq %rax,%r14 - subq $128,%rsp + subq $0x80,%rsp movdqa 32(%rbp),%xmm6 pxor %xmm14,%xmm14 movdqa L$xts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - subq $128,%r14 + subq $0x80,%r14 jc L$xts_dec_short jmp L$xts_dec_loop .p2align 4 L$xts_dec_loop: - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm15 movdqa %xmm6,0(%rsp) @@ -2032,7 +2032,7 @@ L$xts_dec_loop: pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm0 movdqa %xmm6,16(%rsp) @@ -2041,7 +2041,7 @@ L$xts_dec_loop: pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 movdqu 0(%r12),%xmm7 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm1 movdqa %xmm6,32(%rsp) @@ -2051,7 +2051,7 @@ L$xts_dec_loop: pxor %xmm13,%xmm6 movdqu 16(%r12),%xmm8 pxor %xmm7,%xmm15 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm2 movdqa %xmm6,48(%rsp) @@ -2061,7 +2061,7 @@ L$xts_dec_loop: pxor %xmm13,%xmm6 movdqu 32(%r12),%xmm9 pxor %xmm8,%xmm0 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm3 movdqa %xmm6,64(%rsp) @@ -2071,7 +2071,7 @@ L$xts_dec_loop: pxor %xmm13,%xmm6 movdqu 48(%r12),%xmm10 pxor %xmm9,%xmm1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm4 movdqa %xmm6,80(%rsp) @@ -2081,7 +2081,7 @@ L$xts_dec_loop: pxor %xmm13,%xmm6 movdqu 64(%r12),%xmm11 pxor %xmm10,%xmm2 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm5 movdqa %xmm6,96(%rsp) @@ -2125,20 +2125,20 @@ L$xts_dec_loop: pxor %xmm14,%xmm14 movdqa L$xts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 paddq %xmm6,%xmm6 pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - subq $128,%r14 + subq $0x80,%r14 jnc L$xts_dec_loop L$xts_dec_short: - addq $128,%r14 + addq $0x80,%r14 jz L$xts_dec_done - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm15 movdqa %xmm6,0(%rsp) @@ -2146,7 +2146,7 @@ L$xts_dec_short: pand %xmm12,%xmm13 pcmpgtd %xmm6,%xmm14 pxor %xmm13,%xmm6 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm0 movdqa %xmm6,16(%rsp) @@ -2157,7 +2157,7 @@ L$xts_dec_short: movdqu 0(%r12),%xmm7 cmpq $16,%r14 je L$xts_dec_1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm1 movdqa %xmm6,32(%rsp) @@ -2169,7 +2169,7 @@ L$xts_dec_short: cmpq $32,%r14 je L$xts_dec_2 pxor %xmm7,%xmm15 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm2 movdqa %xmm6,48(%rsp) @@ -2181,7 +2181,7 @@ L$xts_dec_short: cmpq $48,%r14 je L$xts_dec_3 pxor %xmm8,%xmm0 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm3 movdqa %xmm6,64(%rsp) @@ -2193,7 +2193,7 @@ L$xts_dec_short: cmpq $64,%r14 je L$xts_dec_4 pxor %xmm9,%xmm1 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm4 movdqa %xmm6,80(%rsp) @@ -2205,7 +2205,7 @@ L$xts_dec_short: cmpq $80,%r14 je L$xts_dec_5 pxor %xmm10,%xmm2 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 pxor %xmm14,%xmm14 movdqa %xmm6,%xmm5 movdqa %xmm6,96(%rsp) @@ -2382,7 +2382,7 @@ L$xts_dec_done: pxor %xmm14,%xmm14 movdqa L$xts_magic(%rip),%xmm12 pcmpgtd %xmm6,%xmm14 - pshufd $19,%xmm14,%xmm13 + pshufd $0x13,%xmm14,%xmm13 movdqa %xmm6,%xmm5 paddq %xmm6,%xmm6 pand %xmm12,%xmm13 diff --git a/vendor/openssl/asm_obsolete/x64-macosx-gas/aes/vpaes-x86_64.s b/vendor/openssl/asm_obsolete/x64-macosx-gas/aes/vpaes-x86_64.s index c724170ce..2ffd0bc10 100644 --- a/vendor/openssl/asm_obsolete/x64-macosx-gas/aes/vpaes-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-macosx-gas/aes/vpaes-x86_64.s @@ -60,7 +60,7 @@ L$enc_loop: addq $16,%r11 pxor %xmm0,%xmm3 .byte 102,15,56,0,193 - andq $48,%r11 + andq $0x30,%r11 subq $1,%rax pxor %xmm3,%xmm0 @@ -120,10 +120,10 @@ _vpaes_decrypt_core: pand %xmm9,%xmm0 .byte 102,15,56,0,208 movdqa L$k_dipt+16(%rip),%xmm0 - xorq $48,%r11 + xorq $0x30,%r11 leaq L$k_dsbd(%rip),%r10 .byte 102,15,56,0,193 - andq $48,%r11 + andq $0x30,%r11 pxor %xmm5,%xmm2 movdqa L$k_mc_forward+48(%rip),%xmm5 pxor %xmm2,%xmm0 @@ -242,7 +242,7 @@ L$schedule_am_decrypting: movdqa (%r8,%r10,1),%xmm1 .byte 102,15,56,0,217 movdqu %xmm3,(%rdx) - xorq $48,%r8 + xorq $0x30,%r8 L$schedule_go: cmpl $192,%esi @@ -332,7 +332,7 @@ L$oop_schedule_256: call _vpaes_schedule_mangle - pshufd $255,%xmm0,%xmm0 + pshufd $0xFF,%xmm0,%xmm0 movdqa %xmm7,%xmm5 movdqa %xmm6,%xmm7 call _vpaes_schedule_low_round @@ -399,8 +399,8 @@ L$schedule_mangle_last_dec: .p2align 4 _vpaes_schedule_192_smear: - pshufd $128,%xmm6,%xmm1 - pshufd $254,%xmm7,%xmm0 + pshufd $0x80,%xmm6,%xmm1 + pshufd $0xFE,%xmm7,%xmm0 pxor %xmm1,%xmm6 pxor %xmm1,%xmm1 pxor %xmm0,%xmm6 @@ -437,7 +437,7 @@ _vpaes_schedule_round: pxor %xmm1,%xmm7 - pshufd $255,%xmm0,%xmm0 + pshufd $0xFF,%xmm0,%xmm0 .byte 102,15,58,15,192,1 @@ -596,7 +596,7 @@ L$schedule_mangle_both: movdqa (%r8,%r10,1),%xmm1 .byte 102,15,56,0,217 addq $-16,%r8 - andq $48,%r8 + andq $0x30,%r8 movdqu %xmm3,(%rdx) .byte 0xf3,0xc3 @@ -614,7 +614,7 @@ _vpaes_set_encrypt_key: movl %eax,240(%rdx) movl $0,%ecx - movl $48,%r8d + movl $0x30,%r8d call _vpaes_schedule_core xorl %eax,%eax .byte 0xf3,0xc3 diff --git a/vendor/openssl/asm_obsolete/x64-macosx-gas/bn/rsaz-x86_64.s b/vendor/openssl/asm_obsolete/x64-macosx-gas/bn/rsaz-x86_64.s index 4e70deabb..b92f098e7 100644 --- a/vendor/openssl/asm_obsolete/x64-macosx-gas/bn/rsaz-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-macosx-gas/bn/rsaz-x86_64.s @@ -461,48 +461,94 @@ _rsaz_512_mul_gather4: pushq %r14 pushq %r15 - movl %r9d,%r9d - subq $128+24,%rsp + subq $152,%rsp L$mul_gather4_body: - movl 64(%rdx,%r9,4),%eax -.byte 102,72,15,110,199 - movl (%rdx,%r9,4),%ebx -.byte 102,72,15,110,201 + movd %r9d,%xmm8 + movdqa L$inc+16(%rip),%xmm1 + movdqa L$inc(%rip),%xmm0 + + pshufd $0,%xmm8,%xmm8 + movdqa %xmm1,%xmm7 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm8,%xmm0 + movdqa %xmm7,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm8,%xmm1 + movdqa %xmm7,%xmm4 + paddd %xmm2,%xmm3 + pcmpeqd %xmm8,%xmm2 + movdqa %xmm7,%xmm5 + paddd %xmm3,%xmm4 + pcmpeqd %xmm8,%xmm3 + movdqa %xmm7,%xmm6 + paddd %xmm4,%xmm5 + pcmpeqd %xmm8,%xmm4 + paddd %xmm5,%xmm6 + pcmpeqd %xmm8,%xmm5 + paddd %xmm6,%xmm7 + pcmpeqd %xmm8,%xmm6 + pcmpeqd %xmm8,%xmm7 + + movdqa 0(%rdx),%xmm8 + movdqa 16(%rdx),%xmm9 + movdqa 32(%rdx),%xmm10 + movdqa 48(%rdx),%xmm11 + pand %xmm0,%xmm8 + movdqa 64(%rdx),%xmm12 + pand %xmm1,%xmm9 + movdqa 80(%rdx),%xmm13 + pand %xmm2,%xmm10 + movdqa 96(%rdx),%xmm14 + pand %xmm3,%xmm11 + movdqa 112(%rdx),%xmm15 + leaq 128(%rdx),%rbp + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd $0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 +.byte 102,76,15,126,195 + movq %r8,128(%rsp) + movq %rdi,128+8(%rsp) + movq %rcx,128+16(%rsp) - shlq $32,%rax - orq %rax,%rbx movq (%rsi),%rax movq 8(%rsi),%rcx - leaq 128(%rdx,%r9,4),%rbp mulq %rbx movq %rax,(%rsp) movq %rcx,%rax movq %rdx,%r8 mulq %rbx - movd (%rbp),%xmm4 addq %rax,%r8 movq 16(%rsi),%rax movq %rdx,%r9 adcq $0,%r9 mulq %rbx - movd 64(%rbp),%xmm5 addq %rax,%r9 movq 24(%rsi),%rax movq %rdx,%r10 adcq $0,%r10 mulq %rbx - pslldq $4,%xmm5 addq %rax,%r10 movq 32(%rsi),%rax movq %rdx,%r11 adcq $0,%r11 mulq %rbx - por %xmm5,%xmm4 addq %rax,%r11 movq 40(%rsi),%rax movq %rdx,%r12 @@ -515,14 +561,12 @@ L$mul_gather4_body: adcq $0,%r13 mulq %rbx - leaq 128(%rbp),%rbp addq %rax,%r13 movq 56(%rsi),%rax movq %rdx,%r14 adcq $0,%r14 mulq %rbx -.byte 102,72,15,126,227 addq %rax,%r14 movq (%rsi),%rax movq %rdx,%r15 @@ -534,6 +578,35 @@ L$mul_gather4_body: .p2align 5 L$oop_mul_gather: + movdqa 0(%rbp),%xmm8 + movdqa 16(%rbp),%xmm9 + movdqa 32(%rbp),%xmm10 + movdqa 48(%rbp),%xmm11 + pand %xmm0,%xmm8 + movdqa 64(%rbp),%xmm12 + pand %xmm1,%xmm9 + movdqa 80(%rbp),%xmm13 + pand %xmm2,%xmm10 + movdqa 96(%rbp),%xmm14 + pand %xmm3,%xmm11 + movdqa 112(%rbp),%xmm15 + leaq 128(%rbp),%rbp + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd $0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 +.byte 102,76,15,126,195 + mulq %rbx addq %rax,%r8 movq 8(%rsi),%rax @@ -542,7 +615,6 @@ L$oop_mul_gather: adcq $0,%r8 mulq %rbx - movd (%rbp),%xmm4 addq %rax,%r9 movq 16(%rsi),%rax adcq $0,%rdx @@ -551,7 +623,6 @@ L$oop_mul_gather: adcq $0,%r9 mulq %rbx - movd 64(%rbp),%xmm5 addq %rax,%r10 movq 24(%rsi),%rax adcq $0,%rdx @@ -560,7 +631,6 @@ L$oop_mul_gather: adcq $0,%r10 mulq %rbx - pslldq $4,%xmm5 addq %rax,%r11 movq 32(%rsi),%rax adcq $0,%rdx @@ -569,7 +639,6 @@ L$oop_mul_gather: adcq $0,%r11 mulq %rbx - por %xmm5,%xmm4 addq %rax,%r12 movq 40(%rsi),%rax adcq $0,%rdx @@ -594,7 +663,6 @@ L$oop_mul_gather: adcq $0,%r14 mulq %rbx -.byte 102,72,15,126,227 addq %rax,%r15 movq (%rsi),%rax adcq $0,%rdx @@ -602,7 +670,6 @@ L$oop_mul_gather: movq %rdx,%r15 adcq $0,%r15 - leaq 128(%rbp),%rbp leaq 8(%rdi),%rdi decl %ecx @@ -617,8 +684,8 @@ L$oop_mul_gather: movq %r14,48(%rdi) movq %r15,56(%rdi) -.byte 102,72,15,126,199 -.byte 102,72,15,126,205 + movq 128+8(%rsp),%rdi + movq 128+16(%rsp),%rbp movq (%rsp),%r8 movq 8(%rsp),%r9 @@ -667,7 +734,7 @@ _rsaz_512_mul_scatter4: movl %r9d,%r9d subq $128+24,%rsp L$mul_scatter4_body: - leaq (%r8,%r9,4),%r8 + leaq (%r8,%r9,8),%r8 .byte 102,72,15,110,199 .byte 102,72,15,110,202 .byte 102,73,15,110,208 @@ -703,30 +770,14 @@ L$mul_scatter4_body: call __rsaz_512_subtract - movl %r8d,0(%rsi) - shrq $32,%r8 - movl %r9d,128(%rsi) - shrq $32,%r9 - movl %r10d,256(%rsi) - shrq $32,%r10 - movl %r11d,384(%rsi) - shrq $32,%r11 - movl %r12d,512(%rsi) - shrq $32,%r12 - movl %r13d,640(%rsi) - shrq $32,%r13 - movl %r14d,768(%rsi) - shrq $32,%r14 - movl %r15d,896(%rsi) - shrq $32,%r15 - movl %r8d,64(%rsi) - movl %r9d,192(%rsi) - movl %r10d,320(%rsi) - movl %r11d,448(%rsi) - movl %r12d,576(%rsi) - movl %r13d,704(%rsi) - movl %r14d,832(%rsi) - movl %r15d,960(%rsi) + movq %r8,0(%rsi) + movq %r9,128(%rsi) + movq %r10,256(%rsi) + movq %r11,384(%rsi) + movq %r12,512(%rsi) + movq %r13,640(%rsi) + movq %r14,768(%rsi) + movq %r15,896(%rsi) leaq 128+24+48(%rsp),%rax movq -48(%rax),%r15 @@ -1079,16 +1130,14 @@ L$oop_mul: .p2align 4 _rsaz_512_scatter4: - leaq (%rdi,%rdx,4),%rdi + leaq (%rdi,%rdx,8),%rdi movl $8,%r9d jmp L$oop_scatter .p2align 4 L$oop_scatter: movq (%rsi),%rax leaq 8(%rsi),%rsi - movl %eax,(%rdi) - shrq $32,%rax - movl %eax,64(%rdi) + movq %rax,(%rdi) leaq 128(%rdi),%rdi decl %r9d jnz L$oop_scatter @@ -1099,18 +1148,72 @@ L$oop_scatter: .p2align 4 _rsaz_512_gather4: - leaq (%rsi,%rdx,4),%rsi + movd %edx,%xmm8 + movdqa L$inc+16(%rip),%xmm1 + movdqa L$inc(%rip),%xmm0 + + pshufd $0,%xmm8,%xmm8 + movdqa %xmm1,%xmm7 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm8,%xmm0 + movdqa %xmm7,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm8,%xmm1 + movdqa %xmm7,%xmm4 + paddd %xmm2,%xmm3 + pcmpeqd %xmm8,%xmm2 + movdqa %xmm7,%xmm5 + paddd %xmm3,%xmm4 + pcmpeqd %xmm8,%xmm3 + movdqa %xmm7,%xmm6 + paddd %xmm4,%xmm5 + pcmpeqd %xmm8,%xmm4 + paddd %xmm5,%xmm6 + pcmpeqd %xmm8,%xmm5 + paddd %xmm6,%xmm7 + pcmpeqd %xmm8,%xmm6 + pcmpeqd %xmm8,%xmm7 movl $8,%r9d jmp L$oop_gather .p2align 4 L$oop_gather: - movl (%rsi),%eax - movl 64(%rsi),%r8d + movdqa 0(%rsi),%xmm8 + movdqa 16(%rsi),%xmm9 + movdqa 32(%rsi),%xmm10 + movdqa 48(%rsi),%xmm11 + pand %xmm0,%xmm8 + movdqa 64(%rsi),%xmm12 + pand %xmm1,%xmm9 + movdqa 80(%rsi),%xmm13 + pand %xmm2,%xmm10 + movdqa 96(%rsi),%xmm14 + pand %xmm3,%xmm11 + movdqa 112(%rsi),%xmm15 leaq 128(%rsi),%rsi - shlq $32,%r8 - orq %r8,%rax - movq %rax,(%rdi) + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd $0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 + movq %xmm8,(%rdi) leaq 8(%rdi),%rdi decl %r9d jnz L$oop_gather .byte 0xf3,0xc3 +L$SEH_end_rsaz_512_gather4: + + +.p2align 6 +L$inc: +.long 0,0, 1,1 +.long 2,2, 2,2 diff --git a/vendor/openssl/asm_obsolete/x64-macosx-gas/bn/x86_64-gf2m.s b/vendor/openssl/asm_obsolete/x64-macosx-gas/bn/x86_64-gf2m.s index 040c324c4..c0f0b4bd6 100644 --- a/vendor/openssl/asm_obsolete/x64-macosx-gas/bn/x86_64-gf2m.s +++ b/vendor/openssl/asm_obsolete/x64-macosx-gas/bn/x86_64-gf2m.s @@ -242,7 +242,7 @@ L$body_mul_2x2: movq %rcx,56(%rsp) movq %r8,64(%rsp) - movq $15,%r8 + movq $0xf,%r8 movq %rsi,%rax movq %rcx,%rbp call _mul_1x1 diff --git a/vendor/openssl/asm_obsolete/x64-macosx-gas/bn/x86_64-mont.s b/vendor/openssl/asm_obsolete/x64-macosx-gas/bn/x86_64-mont.s index 2ed1c0ff4..a5b25ebb4 100644 --- a/vendor/openssl/asm_obsolete/x64-macosx-gas/bn/x86_64-mont.s +++ b/vendor/openssl/asm_obsolete/x64-macosx-gas/bn/x86_64-mont.s @@ -34,6 +34,20 @@ L$mul_enter: movq %r11,8(%rsp,%r9,8) L$mul_body: + + + + + + + subq %rsp,%r11 + andq $-4096,%r11 +L$mul_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x66,0x2e + jnc L$mul_page_walk + movq %rdx,%r12 movq (%r8),%r8 movq (%r12),%rbx @@ -231,6 +245,14 @@ L$mul4x_enter: movq %r11,8(%rsp,%r9,8) L$mul4x_body: + subq %rsp,%r11 + andq $-4096,%r11 +L$mul4x_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc L$mul4x_page_walk + movq %rdi,16(%rsp,%r9,8) movq %rdx,%r12 movq (%r8),%r8 @@ -633,81 +655,112 @@ L$sqr8x_enter: - leaq -64(%rsp,%r9,4),%r11 + leaq -64(%rsp,%r9,2),%r11 movq (%r8),%r8 subq %rsi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb L$sqr8x_sp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,4),%rsp + leaq -64(%rsp,%r9,2),%rsp jmp L$sqr8x_sp_done .p2align 5 L$sqr8x_sp_alt: - leaq 4096-64(,%r9,4),%r10 - leaq -64(%rsp,%r9,4),%rsp + leaq 4096-64(,%r9,2),%r10 + leaq -64(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp L$sqr8x_sp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +L$sqr8x_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc L$sqr8x_page_walk + movq %r9,%r10 negq %r9 - leaq 64(%rsp,%r9,2),%r11 movq %r8,32(%rsp) movq %rax,40(%rsp) L$sqr8x_body: - movq %r9,%rbp -.byte 102,73,15,110,211 - shrq $3+2,%rbp - movl _OPENSSL_ia32cap_P+8(%rip),%eax - jmp L$sqr8x_copy_n - -.p2align 5 -L$sqr8x_copy_n: - movq 0(%rcx),%xmm0 - movq 8(%rcx),%xmm1 - movq 16(%rcx),%xmm3 - movq 24(%rcx),%xmm4 - leaq 32(%rcx),%rcx - movdqa %xmm0,0(%r11) - movdqa %xmm1,16(%r11) - movdqa %xmm3,32(%r11) - movdqa %xmm4,48(%r11) - leaq 64(%r11),%r11 - decq %rbp - jnz L$sqr8x_copy_n - +.byte 102,72,15,110,209 pxor %xmm0,%xmm0 .byte 102,72,15,110,207 .byte 102,73,15,110,218 call _bn_sqr8x_internal + + + + leaq (%rdi,%r9,1),%rbx + movq %r9,%rcx + movq %r9,%rdx +.byte 102,72,15,126,207 + sarq $3+2,%rcx + jmp L$sqr8x_sub + +.p2align 5 +L$sqr8x_sub: + movq 0(%rbx),%r12 + movq 8(%rbx),%r13 + movq 16(%rbx),%r14 + movq 24(%rbx),%r15 + leaq 32(%rbx),%rbx + sbbq 0(%rbp),%r12 + sbbq 8(%rbp),%r13 + sbbq 16(%rbp),%r14 + sbbq 24(%rbp),%r15 + leaq 32(%rbp),%rbp + movq %r12,0(%rdi) + movq %r13,8(%rdi) + movq %r14,16(%rdi) + movq %r15,24(%rdi) + leaq 32(%rdi),%rdi + incq %rcx + jnz L$sqr8x_sub + + sbbq $0,%rax + leaq (%rbx,%r9,1),%rbx + leaq (%rdi,%r9,1),%rdi + +.byte 102,72,15,110,200 pxor %xmm0,%xmm0 - leaq 48(%rsp),%rax - leaq 64(%rsp,%r9,2),%rdx - shrq $3+2,%r9 + pshufd $0,%xmm1,%xmm1 movq 40(%rsp),%rsi - jmp L$sqr8x_zero + jmp L$sqr8x_cond_copy .p2align 5 -L$sqr8x_zero: - movdqa %xmm0,0(%rax) - movdqa %xmm0,16(%rax) - movdqa %xmm0,32(%rax) - movdqa %xmm0,48(%rax) - leaq 64(%rax),%rax - movdqa %xmm0,0(%rdx) - movdqa %xmm0,16(%rdx) - movdqa %xmm0,32(%rdx) - movdqa %xmm0,48(%rdx) - leaq 64(%rdx),%rdx - decq %r9 - jnz L$sqr8x_zero +L$sqr8x_cond_copy: + movdqa 0(%rbx),%xmm2 + movdqa 16(%rbx),%xmm3 + leaq 32(%rbx),%rbx + movdqu 0(%rdi),%xmm4 + movdqu 16(%rdi),%xmm5 + leaq 32(%rdi),%rdi + movdqa %xmm0,-32(%rbx) + movdqa %xmm0,-16(%rbx) + movdqa %xmm0,-32(%rbx,%rdx,1) + movdqa %xmm0,-16(%rbx,%rdx,1) + pcmpeqd %xmm1,%xmm0 + pand %xmm1,%xmm2 + pand %xmm1,%xmm3 + pand %xmm0,%xmm4 + pand %xmm0,%xmm5 + pxor %xmm0,%xmm0 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqu %xmm4,-32(%rdi) + movdqu %xmm5,-16(%rdi) + addq $32,%r9 + jnz L$sqr8x_cond_copy movq $1,%rax movq -48(%rsi),%r15 diff --git a/vendor/openssl/asm_obsolete/x64-macosx-gas/bn/x86_64-mont5.s b/vendor/openssl/asm_obsolete/x64-macosx-gas/bn/x86_64-mont5.s index bcd5140eb..8bb7c34c3 100644 --- a/vendor/openssl/asm_obsolete/x64-macosx-gas/bn/x86_64-mont5.s +++ b/vendor/openssl/asm_obsolete/x64-macosx-gas/bn/x86_64-mont5.s @@ -14,46 +14,165 @@ _bn_mul_mont_gather5: L$mul_enter: movl %r9d,%r9d movq %rsp,%rax - movl 8(%rsp),%r10d + movd 8(%rsp),%xmm5 + leaq L$inc(%rip),%r10 pushq %rbx pushq %rbp pushq %r12 pushq %r13 pushq %r14 pushq %r15 + leaq 2(%r9),%r11 negq %r11 - leaq (%rsp,%r11,8),%rsp + leaq -264(%rsp,%r11,8),%rsp andq $-1024,%rsp movq %rax,8(%rsp,%r9,8) L$mul_body: - movq %rdx,%r12 - movq %r10,%r11 - shrq $3,%r10 - andq $7,%r11 - notq %r10 - leaq L$magic_masks(%rip),%rax - andq $3,%r10 - leaq 96(%r12,%r11,8),%r12 - movq 0(%rax,%r10,8),%xmm4 - movq 8(%rax,%r10,8),%xmm5 - movq 16(%rax,%r10,8),%xmm6 - movq 24(%rax,%r10,8),%xmm7 - - movq -96(%r12),%xmm0 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - movq 96(%r12),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 + + + + + + + subq %rsp,%rax + andq $-4096,%rax +L$mul_page_walk: + movq (%rsp,%rax,1),%r11 + subq $4096,%rax +.byte 0x2e + jnc L$mul_page_walk + + leaq 128(%rdx),%r12 + movdqa 0(%r10),%xmm0 + movdqa 16(%r10),%xmm1 + leaq 24-112(%rsp,%r9,8),%r10 + andq $-16,%r10 + + pshufd $0,%xmm5,%xmm5 + movdqa %xmm1,%xmm4 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 +.byte 0x67 + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,112(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,128(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,144(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,160(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,176(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,192(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,208(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,224(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,240(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,256(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,272(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,288(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,304(%r10) + + paddd %xmm2,%xmm3 +.byte 0x67 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,320(%r10) + + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,336(%r10) + pand 64(%r12),%xmm0 + + pand 80(%r12),%xmm1 + pand 96(%r12),%xmm2 + movdqa %xmm3,352(%r10) + pand 112(%r12),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -128(%r12),%xmm4 + movdqa -112(%r12),%xmm5 + movdqa -96(%r12),%xmm2 + pand 112(%r10),%xmm4 + movdqa -80(%r12),%xmm3 + pand 128(%r10),%xmm5 + por %xmm4,%xmm0 + pand 144(%r10),%xmm2 + por %xmm5,%xmm1 + pand 160(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -64(%r12),%xmm4 + movdqa -48(%r12),%xmm5 + movdqa -32(%r12),%xmm2 + pand 176(%r10),%xmm4 + movdqa -16(%r12),%xmm3 + pand 192(%r10),%xmm5 + por %xmm4,%xmm0 + pand 208(%r10),%xmm2 + por %xmm5,%xmm1 + pand 224(%r10),%xmm3 por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa 0(%r12),%xmm4 + movdqa 16(%r12),%xmm5 + movdqa 32(%r12),%xmm2 + pand 240(%r10),%xmm4 + movdqa 48(%r12),%xmm3 + pand 256(%r10),%xmm5 + por %xmm4,%xmm0 + pand 272(%r10),%xmm2 + por %xmm5,%xmm1 + pand 288(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + por %xmm1,%xmm0 + pshufd $0x4e,%xmm0,%xmm1 + por %xmm1,%xmm0 leaq 256(%r12),%r12 - por %xmm3,%xmm0 - .byte 102,72,15,126,195 movq (%r8),%r8 @@ -62,29 +181,14 @@ L$mul_body: xorq %r14,%r14 xorq %r15,%r15 - movq -96(%r12),%xmm0 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - movq %r8,%rbp mulq %rbx movq %rax,%r10 movq (%rcx),%rax - movq 96(%r12),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 - imulq %r10,%rbp movq %rdx,%r11 - por %xmm2,%xmm0 - leaq 256(%r12),%r12 - por %xmm3,%xmm0 - mulq %rbp addq %rax,%r10 movq 8(%rsi),%rax @@ -117,14 +221,12 @@ L$1st_enter: cmpq %r9,%r15 jne L$1st -.byte 102,72,15,126,195 addq %rax,%r13 - movq (%rsi),%rax adcq $0,%rdx addq %r11,%r13 adcq $0,%rdx - movq %r13,-16(%rsp,%r15,8) + movq %r13,-16(%rsp,%r9,8) movq %rdx,%r13 movq %r10,%r11 @@ -138,33 +240,78 @@ L$1st_enter: jmp L$outer .p2align 4 L$outer: + leaq 24+128(%rsp,%r9,8),%rdx + andq $-16,%rdx + pxor %xmm4,%xmm4 + pxor %xmm5,%xmm5 + movdqa -128(%r12),%xmm0 + movdqa -112(%r12),%xmm1 + movdqa -96(%r12),%xmm2 + movdqa -80(%r12),%xmm3 + pand -128(%rdx),%xmm0 + pand -112(%rdx),%xmm1 + por %xmm0,%xmm4 + pand -96(%rdx),%xmm2 + por %xmm1,%xmm5 + pand -80(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa -64(%r12),%xmm0 + movdqa -48(%r12),%xmm1 + movdqa -32(%r12),%xmm2 + movdqa -16(%r12),%xmm3 + pand -64(%rdx),%xmm0 + pand -48(%rdx),%xmm1 + por %xmm0,%xmm4 + pand -32(%rdx),%xmm2 + por %xmm1,%xmm5 + pand -16(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 0(%r12),%xmm0 + movdqa 16(%r12),%xmm1 + movdqa 32(%r12),%xmm2 + movdqa 48(%r12),%xmm3 + pand 0(%rdx),%xmm0 + pand 16(%rdx),%xmm1 + por %xmm0,%xmm4 + pand 32(%rdx),%xmm2 + por %xmm1,%xmm5 + pand 48(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 64(%r12),%xmm0 + movdqa 80(%r12),%xmm1 + movdqa 96(%r12),%xmm2 + movdqa 112(%r12),%xmm3 + pand 64(%rdx),%xmm0 + pand 80(%rdx),%xmm1 + por %xmm0,%xmm4 + pand 96(%rdx),%xmm2 + por %xmm1,%xmm5 + pand 112(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + por %xmm5,%xmm4 + pshufd $0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 + leaq 256(%r12),%r12 + + movq (%rsi),%rax +.byte 102,72,15,126,195 + xorq %r15,%r15 movq %r8,%rbp movq (%rsp),%r10 - movq -96(%r12),%xmm0 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - mulq %rbx addq %rax,%r10 movq (%rcx),%rax adcq $0,%rdx - movq 96(%r12),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 - imulq %r10,%rbp movq %rdx,%r11 - por %xmm2,%xmm0 - leaq 256(%r12),%r12 - por %xmm3,%xmm0 - mulq %rbp addq %rax,%r10 movq 8(%rsi),%rax @@ -200,15 +347,12 @@ L$inner_enter: cmpq %r9,%r15 jne L$inner -.byte 102,72,15,126,195 - addq %rax,%r13 - movq (%rsi),%rax adcq $0,%rdx addq %r10,%r13 - movq (%rsp,%r15,8),%r10 + movq (%rsp,%r9,8),%r10 adcq $0,%rdx - movq %r13,-16(%rsp,%r15,8) + movq %r13,-16(%rsp,%r9,8) movq %rdx,%r13 xorq %rdx,%rdx @@ -255,6 +399,7 @@ L$copy: movq 8(%rsp,%r9,8),%rsi movq $1,%rax + movq -48(%rsi),%r15 movq -40(%rsi),%r14 movq -32(%rsi),%r13 @@ -277,10 +422,10 @@ L$mul4x_enter: pushq %r13 pushq %r14 pushq %r15 + .byte 0x67 - movl %r9d,%r10d shll $3,%r9d - shll $3+2,%r10d + leaq (%r9,%r9,2),%r10 negq %r9 @@ -290,25 +435,36 @@ L$mul4x_enter: - leaq -64(%rsp,%r9,2),%r11 - subq %rsi,%r11 + + + leaq -320(%rsp,%r9,2),%r11 + subq %rdi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb L$mul4xsp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,2),%rsp + leaq -320(%rsp,%r9,2),%rsp jmp L$mul4xsp_done .p2align 5 L$mul4xsp_alt: - leaq 4096-64(,%r9,2),%r10 - leaq -64(%rsp,%r9,2),%rsp + leaq 4096-320(,%r9,2),%r10 + leaq -320(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp L$mul4xsp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +L$mul4x_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc L$mul4x_page_walk + negq %r9 movq %rax,40(%rsp) @@ -318,6 +474,7 @@ L$mul4x_body: movq 40(%rsp),%rsi movq $1,%rax + movq -48(%rsi),%r15 movq -40(%rsi),%r14 movq -32(%rsi),%r13 @@ -333,47 +490,141 @@ L$mul4x_epilogue: .p2align 5 mul4x_internal: shlq $5,%r9 - movl 8(%rax),%r10d - leaq 256(%rdx,%r9,1),%r13 + movd 8(%rax),%xmm5 + leaq L$inc(%rip),%rax + leaq 128(%rdx,%r9,1),%r13 shrq $5,%r9 - movq %r10,%r11 - shrq $3,%r10 - andq $7,%r11 - notq %r10 - leaq L$magic_masks(%rip),%rax - andq $3,%r10 - leaq 96(%rdx,%r11,8),%r12 - movq 0(%rax,%r10,8),%xmm4 - movq 8(%rax,%r10,8),%xmm5 - addq $7,%r11 - movq 16(%rax,%r10,8),%xmm6 - movq 24(%rax,%r10,8),%xmm7 - andq $7,%r11 - - movq -96(%r12),%xmm0 - leaq 256(%r12),%r14 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - movq 96(%r12),%xmm3 - pand %xmm6,%xmm2 -.byte 0x67 - por %xmm1,%xmm0 - movq -96(%r14),%xmm1 -.byte 0x67 - pand %xmm7,%xmm3 -.byte 0x67 - por %xmm2,%xmm0 - movq -32(%r14),%xmm2 + movdqa 0(%rax),%xmm0 + movdqa 16(%rax),%xmm1 + leaq 88-112(%rsp,%r9,1),%r10 + leaq 128(%rdx),%r12 + + pshufd $0,%xmm5,%xmm5 + movdqa %xmm1,%xmm4 +.byte 0x67,0x67 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 .byte 0x67 - pand %xmm4,%xmm1 + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,112(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,128(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,144(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,160(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,176(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,192(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,208(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,224(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,240(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,256(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,272(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,288(%r10) + movdqa %xmm4,%xmm3 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,304(%r10) + + paddd %xmm2,%xmm3 .byte 0x67 - por %xmm3,%xmm0 - movq 32(%r14),%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,320(%r10) + + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,336(%r10) + pand 64(%r12),%xmm0 + pand 80(%r12),%xmm1 + pand 96(%r12),%xmm2 + movdqa %xmm3,352(%r10) + pand 112(%r12),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -128(%r12),%xmm4 + movdqa -112(%r12),%xmm5 + movdqa -96(%r12),%xmm2 + pand 112(%r10),%xmm4 + movdqa -80(%r12),%xmm3 + pand 128(%r10),%xmm5 + por %xmm4,%xmm0 + pand 144(%r10),%xmm2 + por %xmm5,%xmm1 + pand 160(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa -64(%r12),%xmm4 + movdqa -48(%r12),%xmm5 + movdqa -32(%r12),%xmm2 + pand 176(%r10),%xmm4 + movdqa -16(%r12),%xmm3 + pand 192(%r10),%xmm5 + por %xmm4,%xmm0 + pand 208(%r10),%xmm2 + por %xmm5,%xmm1 + pand 224(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + movdqa 0(%r12),%xmm4 + movdqa 16(%r12),%xmm5 + movdqa 32(%r12),%xmm2 + pand 240(%r10),%xmm4 + movdqa 48(%r12),%xmm3 + pand 256(%r10),%xmm5 + por %xmm4,%xmm0 + pand 272(%r10),%xmm2 + por %xmm5,%xmm1 + pand 288(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 + por %xmm1,%xmm0 + pshufd $0x4e,%xmm0,%xmm1 + por %xmm1,%xmm0 + leaq 256(%r12),%r12 .byte 102,72,15,126,195 - movq 96(%r14),%xmm0 + movq %r13,16+8(%rsp) movq %rdi,56+8(%rsp) @@ -387,26 +638,10 @@ mul4x_internal: movq %rax,%r10 movq (%rcx),%rax - pand %xmm5,%xmm2 - pand %xmm6,%xmm3 - por %xmm2,%xmm1 - imulq %r10,%rbp - - - - - - - - leaq 64+8(%rsp,%r11,8),%r14 + leaq 64+8(%rsp),%r14 movq %rdx,%r11 - pand %xmm7,%xmm0 - por %xmm3,%xmm1 - leaq 512(%r12),%r12 - por %xmm1,%xmm0 - mulq %rbp addq %rax,%r10 movq 8(%rsi,%r9,1),%rax @@ -415,7 +650,7 @@ mul4x_internal: mulq %rbx addq %rax,%r11 - movq 16(%rcx),%rax + movq 8(%rcx),%rax adcq $0,%rdx movq %rdx,%r10 @@ -425,7 +660,7 @@ mul4x_internal: adcq $0,%rdx addq %r11,%rdi leaq 32(%r9),%r15 - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx adcq $0,%rdx movq %rdi,(%r14) movq %rdx,%r13 @@ -435,7 +670,7 @@ mul4x_internal: L$1st4x: mulq %rbx addq %rax,%r10 - movq -32(%rcx),%rax + movq -16(%rcx),%rax leaq 32(%r14),%r14 adcq $0,%rdx movq %rdx,%r11 @@ -451,7 +686,7 @@ L$1st4x: mulq %rbx addq %rax,%r11 - movq -16(%rcx),%rax + movq -8(%rcx),%rax adcq $0,%rdx movq %rdx,%r10 @@ -481,7 +716,7 @@ L$1st4x: mulq %rbx addq %rax,%r11 - movq 16(%rcx),%rax + movq 8(%rcx),%rax adcq $0,%rdx movq %rdx,%r10 @@ -490,7 +725,7 @@ L$1st4x: movq 16(%rsi,%r15,1),%rax adcq $0,%rdx addq %r11,%rdi - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx adcq $0,%rdx movq %rdi,(%r14) movq %rdx,%r13 @@ -500,7 +735,7 @@ L$1st4x: mulq %rbx addq %rax,%r10 - movq -32(%rcx),%rax + movq -16(%rcx),%rax leaq 32(%r14),%r14 adcq $0,%rdx movq %rdx,%r11 @@ -516,7 +751,7 @@ L$1st4x: mulq %rbx addq %rax,%r11 - movq -16(%rcx),%rax + movq -8(%rcx),%rax adcq $0,%rdx movq %rdx,%r10 @@ -529,8 +764,7 @@ L$1st4x: movq %rdi,-16(%r14) movq %rdx,%r13 -.byte 102,72,15,126,195 - leaq (%rcx,%r9,2),%rcx + leaq (%rcx,%r9,1),%rcx xorq %rdi,%rdi addq %r10,%r13 @@ -541,6 +775,63 @@ L$1st4x: .p2align 5 L$outer4x: + leaq 16+128(%r14),%rdx + pxor %xmm4,%xmm4 + pxor %xmm5,%xmm5 + movdqa -128(%r12),%xmm0 + movdqa -112(%r12),%xmm1 + movdqa -96(%r12),%xmm2 + movdqa -80(%r12),%xmm3 + pand -128(%rdx),%xmm0 + pand -112(%rdx),%xmm1 + por %xmm0,%xmm4 + pand -96(%rdx),%xmm2 + por %xmm1,%xmm5 + pand -80(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa -64(%r12),%xmm0 + movdqa -48(%r12),%xmm1 + movdqa -32(%r12),%xmm2 + movdqa -16(%r12),%xmm3 + pand -64(%rdx),%xmm0 + pand -48(%rdx),%xmm1 + por %xmm0,%xmm4 + pand -32(%rdx),%xmm2 + por %xmm1,%xmm5 + pand -16(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 0(%r12),%xmm0 + movdqa 16(%r12),%xmm1 + movdqa 32(%r12),%xmm2 + movdqa 48(%r12),%xmm3 + pand 0(%rdx),%xmm0 + pand 16(%rdx),%xmm1 + por %xmm0,%xmm4 + pand 32(%rdx),%xmm2 + por %xmm1,%xmm5 + pand 48(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 64(%r12),%xmm0 + movdqa 80(%r12),%xmm1 + movdqa 96(%r12),%xmm2 + movdqa 112(%r12),%xmm3 + pand 64(%rdx),%xmm0 + pand 80(%rdx),%xmm1 + por %xmm0,%xmm4 + pand 96(%rdx),%xmm2 + por %xmm1,%xmm5 + pand 112(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + por %xmm5,%xmm4 + pshufd $0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 + leaq 256(%r12),%r12 +.byte 102,72,15,126,195 + movq (%r14,%r9,1),%r10 movq %r8,%rbp mulq %rbx @@ -548,25 +839,11 @@ L$outer4x: movq (%rcx),%rax adcq $0,%rdx - movq -96(%r12),%xmm0 - movq -32(%r12),%xmm1 - pand %xmm4,%xmm0 - movq 32(%r12),%xmm2 - pand %xmm5,%xmm1 - movq 96(%r12),%xmm3 - imulq %r10,%rbp -.byte 0x67 movq %rdx,%r11 movq %rdi,(%r14) - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 - por %xmm2,%xmm0 leaq (%r14,%r9,1),%r14 - leaq 256(%r12),%r12 - por %xmm3,%xmm0 mulq %rbp addq %rax,%r10 @@ -576,7 +853,7 @@ L$outer4x: mulq %rbx addq %rax,%r11 - movq 16(%rcx),%rax + movq 8(%rcx),%rax adcq $0,%rdx addq 8(%r14),%r11 adcq $0,%rdx @@ -588,7 +865,7 @@ L$outer4x: adcq $0,%rdx addq %r11,%rdi leaq 32(%r9),%r15 - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx adcq $0,%rdx movq %rdx,%r13 jmp L$inner4x @@ -597,7 +874,7 @@ L$outer4x: L$inner4x: mulq %rbx addq %rax,%r10 - movq -32(%rcx),%rax + movq -16(%rcx),%rax adcq $0,%rdx addq 16(%r14),%r10 leaq 32(%r14),%r14 @@ -615,7 +892,7 @@ L$inner4x: mulq %rbx addq %rax,%r11 - movq -16(%rcx),%rax + movq -8(%rcx),%rax adcq $0,%rdx addq -8(%r14),%r11 adcq $0,%rdx @@ -649,7 +926,7 @@ L$inner4x: mulq %rbx addq %rax,%r11 - movq 16(%rcx),%rax + movq 8(%rcx),%rax adcq $0,%rdx addq 8(%r14),%r11 adcq $0,%rdx @@ -660,7 +937,7 @@ L$inner4x: movq 16(%rsi,%r15,1),%rax adcq $0,%rdx addq %r11,%rdi - leaq 64(%rcx),%rcx + leaq 32(%rcx),%rcx adcq $0,%rdx movq %r13,-8(%r14) movq %rdx,%r13 @@ -670,7 +947,7 @@ L$inner4x: mulq %rbx addq %rax,%r10 - movq -32(%rcx),%rax + movq -16(%rcx),%rax adcq $0,%rdx addq 16(%r14),%r10 leaq 32(%r14),%r14 @@ -689,7 +966,7 @@ L$inner4x: mulq %rbx addq %rax,%r11 movq %rbp,%rax - movq -16(%rcx),%rbp + movq -8(%rcx),%rbp adcq $0,%rdx addq -8(%r14),%r11 adcq $0,%rdx @@ -704,9 +981,8 @@ L$inner4x: movq %r13,-24(%r14) movq %rdx,%r13 -.byte 102,72,15,126,195 movq %rdi,-16(%r14) - leaq (%rcx,%r9,2),%rcx + leaq (%rcx,%r9,1),%rcx xorq %rdi,%rdi addq %r10,%r13 @@ -717,16 +993,23 @@ L$inner4x: cmpq 16+8(%rsp),%r12 jb L$outer4x + xorq %rax,%rax subq %r13,%rbp adcq %r15,%r15 orq %r15,%rdi - xorq $1,%rdi + subq %rdi,%rax leaq (%r14,%r9,1),%rbx - leaq (%rcx,%rdi,8),%rbp + movq (%rcx),%r12 + leaq (%rcx),%rbp movq %r9,%rcx sarq $3+2,%rcx movq 56+8(%rsp),%rdi - jmp L$sqr4x_sub + decq %r12 + xorq %r10,%r10 + movq 8(%rbp),%r13 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 + jmp L$sqr4x_sub_entry .globl _bn_power5 @@ -739,9 +1022,9 @@ _bn_power5: pushq %r13 pushq %r14 pushq %r15 - movl %r9d,%r10d + shll $3,%r9d - shll $3+2,%r10d + leal (%r9,%r9,2),%r10d negq %r9 movq (%r8),%r8 @@ -751,25 +1034,35 @@ _bn_power5: - leaq -64(%rsp,%r9,2),%r11 - subq %rsi,%r11 + + leaq -320(%rsp,%r9,2),%r11 + subq %rdi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb L$pwr_sp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,2),%rsp + leaq -320(%rsp,%r9,2),%rsp jmp L$pwr_sp_done .p2align 5 L$pwr_sp_alt: - leaq 4096-64(,%r9,2),%r10 - leaq -64(%rsp,%r9,2),%rsp + leaq 4096-320(,%r9,2),%r10 + leaq -320(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp L$pwr_sp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +L$pwr_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc L$pwr_page_walk + movq %r9,%r10 negq %r9 @@ -791,10 +1084,15 @@ L$power5_body: .byte 102,72,15,110,226 call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal .byte 102,72,15,126,209 .byte 102,72,15,126,226 @@ -1338,9 +1636,9 @@ L$sqr4x_shift_n_add: movq %rbx,-16(%rdi) movq %r8,-8(%rdi) .byte 102,72,15,126,213 -sqr8x_reduction: +__bn_sqr8x_reduction: xorq %rax,%rax - leaq (%rbp,%r9,2),%rcx + leaq (%r9,%rbp,1),%rcx leaq 48+8(%rsp,%r9,2),%rdx movq %rcx,0+8(%rsp) leaq 48+8(%rsp,%r9,1),%rdi @@ -1373,14 +1671,14 @@ L$8x_reduction_loop: .p2align 5 L$8x_reduce: mulq %rbx - movq 16(%rbp),%rax + movq 8(%rbp),%rax negq %r8 movq %rdx,%r8 adcq $0,%r8 mulq %rbx addq %rax,%r9 - movq 32(%rbp),%rax + movq 16(%rbp),%rax adcq $0,%rdx addq %r9,%r8 movq %rbx,48-8+8(%rsp,%rcx,8) @@ -1389,7 +1687,7 @@ L$8x_reduce: mulq %rbx addq %rax,%r10 - movq 48(%rbp),%rax + movq 24(%rbp),%rax adcq $0,%rdx addq %r10,%r9 movq 32+8(%rsp),%rsi @@ -1398,7 +1696,7 @@ L$8x_reduce: mulq %rbx addq %rax,%r11 - movq 64(%rbp),%rax + movq 32(%rbp),%rax adcq $0,%rdx imulq %r8,%rsi addq %r11,%r10 @@ -1407,7 +1705,7 @@ L$8x_reduce: mulq %rbx addq %rax,%r12 - movq 80(%rbp),%rax + movq 40(%rbp),%rax adcq $0,%rdx addq %r12,%r11 movq %rdx,%r12 @@ -1415,7 +1713,7 @@ L$8x_reduce: mulq %rbx addq %rax,%r13 - movq 96(%rbp),%rax + movq 48(%rbp),%rax adcq $0,%rdx addq %r13,%r12 movq %rdx,%r13 @@ -1423,7 +1721,7 @@ L$8x_reduce: mulq %rbx addq %rax,%r14 - movq 112(%rbp),%rax + movq 56(%rbp),%rax adcq $0,%rdx addq %r14,%r13 movq %rdx,%r14 @@ -1441,7 +1739,7 @@ L$8x_reduce: decl %ecx jnz L$8x_reduce - leaq 128(%rbp),%rbp + leaq 64(%rbp),%rbp xorq %rax,%rax movq 8+8(%rsp),%rdx cmpq 0+8(%rsp),%rbp @@ -1467,14 +1765,14 @@ L$8x_reduce: L$8x_tail: mulq %rbx addq %rax,%r8 - movq 16(%rbp),%rax + movq 8(%rbp),%rax movq %r8,(%rdi) movq %rdx,%r8 adcq $0,%r8 mulq %rbx addq %rax,%r9 - movq 32(%rbp),%rax + movq 16(%rbp),%rax adcq $0,%rdx addq %r9,%r8 leaq 8(%rdi),%rdi @@ -1483,7 +1781,7 @@ L$8x_tail: mulq %rbx addq %rax,%r10 - movq 48(%rbp),%rax + movq 24(%rbp),%rax adcq $0,%rdx addq %r10,%r9 movq %rdx,%r10 @@ -1491,7 +1789,7 @@ L$8x_tail: mulq %rbx addq %rax,%r11 - movq 64(%rbp),%rax + movq 32(%rbp),%rax adcq $0,%rdx addq %r11,%r10 movq %rdx,%r11 @@ -1499,7 +1797,7 @@ L$8x_tail: mulq %rbx addq %rax,%r12 - movq 80(%rbp),%rax + movq 40(%rbp),%rax adcq $0,%rdx addq %r12,%r11 movq %rdx,%r12 @@ -1507,7 +1805,7 @@ L$8x_tail: mulq %rbx addq %rax,%r13 - movq 96(%rbp),%rax + movq 48(%rbp),%rax adcq $0,%rdx addq %r13,%r12 movq %rdx,%r13 @@ -1515,7 +1813,7 @@ L$8x_tail: mulq %rbx addq %rax,%r14 - movq 112(%rbp),%rax + movq 56(%rbp),%rax adcq $0,%rdx addq %r14,%r13 movq %rdx,%r14 @@ -1533,7 +1831,7 @@ L$8x_tail: decl %ecx jnz L$8x_tail - leaq 128(%rbp),%rbp + leaq 64(%rbp),%rbp movq 8+8(%rsp),%rdx cmpq 0+8(%rsp),%rbp jae L$8x_tail_done @@ -1579,7 +1877,7 @@ L$8x_no_tail: adcq 48(%rdi),%r14 adcq 56(%rdi),%r15 adcq $0,%rax - movq -16(%rbp),%rcx + movq -8(%rbp),%rcx xorq %rsi,%rsi .byte 102,72,15,126,213 @@ -1597,40 +1895,58 @@ L$8x_no_tail: cmpq %rdx,%rdi jb L$8x_reduction_loop + .byte 0xf3,0xc3 - subq %r15,%rcx + +.p2align 5 +__bn_post4x_internal: + movq 0(%rbp),%r12 leaq (%rdi,%r9,1),%rbx - adcq %rsi,%rsi movq %r9,%rcx - orq %rsi,%rax .byte 102,72,15,126,207 - xorq $1,%rax + negq %rax .byte 102,72,15,126,206 - leaq (%rbp,%rax,8),%rbp sarq $3+2,%rcx - jmp L$sqr4x_sub + decq %r12 + xorq %r10,%r10 + movq 8(%rbp),%r13 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 + jmp L$sqr4x_sub_entry -.p2align 5 +.p2align 4 L$sqr4x_sub: -.byte 0x66 - movq 0(%rbx),%r12 - movq 8(%rbx),%r13 - sbbq 0(%rbp),%r12 - movq 16(%rbx),%r14 - sbbq 16(%rbp),%r13 - movq 24(%rbx),%r15 - leaq 32(%rbx),%rbx - sbbq 32(%rbp),%r14 + movq 0(%rbp),%r12 + movq 8(%rbp),%r13 + movq 16(%rbp),%r14 + movq 24(%rbp),%r15 +L$sqr4x_sub_entry: + leaq 32(%rbp),%rbp + notq %r12 + notq %r13 + notq %r14 + notq %r15 + andq %rax,%r12 + andq %rax,%r13 + andq %rax,%r14 + andq %rax,%r15 + + negq %r10 + adcq 0(%rbx),%r12 + adcq 8(%rbx),%r13 + adcq 16(%rbx),%r14 + adcq 24(%rbx),%r15 movq %r12,0(%rdi) - sbbq 48(%rbp),%r15 - leaq 64(%rbp),%rbp + leaq 32(%rbx),%rbx movq %r13,8(%rdi) + sbbq %r10,%r10 movq %r14,16(%rdi) movq %r15,24(%rdi) leaq 32(%rdi),%rdi incq %rcx jnz L$sqr4x_sub + movq %r9,%r10 negq %r9 .byte 0xf3,0xc3 @@ -1656,10 +1972,9 @@ bn_from_mont8x: pushq %r13 pushq %r14 pushq %r15 -.byte 0x67 - movl %r9d,%r10d + shll $3,%r9d - shll $3+2,%r10d + leaq (%r9,%r9,2),%r10 negq %r9 movq (%r8),%r8 @@ -1669,25 +1984,35 @@ bn_from_mont8x: - leaq -64(%rsp,%r9,2),%r11 - subq %rsi,%r11 + + leaq -320(%rsp,%r9,2),%r11 + subq %rdi,%r11 andq $4095,%r11 cmpq %r11,%r10 jb L$from_sp_alt subq %r11,%rsp - leaq -64(%rsp,%r9,2),%rsp + leaq -320(%rsp,%r9,2),%rsp jmp L$from_sp_done .p2align 5 L$from_sp_alt: - leaq 4096-64(,%r9,2),%r10 - leaq -64(%rsp,%r9,2),%rsp + leaq 4096-320(,%r9,2),%r10 + leaq -320(%rsp,%r9,2),%rsp subq %r10,%r11 movq $0,%r10 cmovcq %r10,%r11 subq %r11,%rsp L$from_sp_done: andq $-64,%rsp + movq %rax,%r11 + subq %rsp,%r11 + andq $-4096,%r11 +L$from_page_walk: + movq (%rsp,%r11,1),%r10 + subq $4096,%r11 +.byte 0x2e + jnc L$from_page_walk + movq %r9,%r10 negq %r9 @@ -1732,7 +2057,8 @@ L$mul_by_1: .byte 0x67 movq %rcx,%rbp .byte 102,73,15,110,218 - call sqr8x_reduction + call __bn_sqr8x_reduction + call __bn_post4x_internal pxor %xmm0,%xmm0 leaq 48(%rsp),%rax @@ -1799,45 +2125,169 @@ L$scatter_epilogue: .globl _bn_gather5 -.p2align 4 +.p2align 5 _bn_gather5: - movl %ecx,%r11d - shrl $3,%ecx - andq $7,%r11 - notl %ecx - leaq L$magic_masks(%rip),%rax - andl $3,%ecx - leaq 128(%rdx,%r11,8),%rdx - movq 0(%rax,%rcx,8),%xmm4 - movq 8(%rax,%rcx,8),%xmm5 - movq 16(%rax,%rcx,8),%xmm6 - movq 24(%rax,%rcx,8),%xmm7 +L$SEH_begin_bn_gather5: + +.byte 0x4c,0x8d,0x14,0x24 +.byte 0x48,0x81,0xec,0x08,0x01,0x00,0x00 + leaq L$inc(%rip),%rax + andq $-16,%rsp + + movd %ecx,%xmm5 + movdqa 0(%rax),%xmm0 + movdqa 16(%rax),%xmm1 + leaq 128(%rdx),%r11 + leaq 128(%rsp),%rax + + pshufd $0,%xmm5,%xmm5 + movdqa %xmm1,%xmm4 + movdqa %xmm1,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,-128(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,-112(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,-96(%rax) + movdqa %xmm4,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,-80(%rax) + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,-64(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,-48(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,-32(%rax) + movdqa %xmm4,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,-16(%rax) + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,0(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,16(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,32(%rax) + movdqa %xmm4,%xmm2 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,48(%rax) + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,64(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,80(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,96(%rax) + movdqa %xmm4,%xmm2 + movdqa %xmm3,112(%rax) jmp L$gather -.p2align 4 -L$gather: - movq -128(%rdx),%xmm0 - movq -64(%rdx),%xmm1 - pand %xmm4,%xmm0 - movq 0(%rdx),%xmm2 - pand %xmm5,%xmm1 - movq 64(%rdx),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 -.byte 0x67,0x67 - por %xmm2,%xmm0 - leaq 256(%rdx),%rdx - por %xmm3,%xmm0 +.p2align 5 +L$gather: + pxor %xmm4,%xmm4 + pxor %xmm5,%xmm5 + movdqa -128(%r11),%xmm0 + movdqa -112(%r11),%xmm1 + movdqa -96(%r11),%xmm2 + pand -128(%rax),%xmm0 + movdqa -80(%r11),%xmm3 + pand -112(%rax),%xmm1 + por %xmm0,%xmm4 + pand -96(%rax),%xmm2 + por %xmm1,%xmm5 + pand -80(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa -64(%r11),%xmm0 + movdqa -48(%r11),%xmm1 + movdqa -32(%r11),%xmm2 + pand -64(%rax),%xmm0 + movdqa -16(%r11),%xmm3 + pand -48(%rax),%xmm1 + por %xmm0,%xmm4 + pand -32(%rax),%xmm2 + por %xmm1,%xmm5 + pand -16(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 0(%r11),%xmm0 + movdqa 16(%r11),%xmm1 + movdqa 32(%r11),%xmm2 + pand 0(%rax),%xmm0 + movdqa 48(%r11),%xmm3 + pand 16(%rax),%xmm1 + por %xmm0,%xmm4 + pand 32(%rax),%xmm2 + por %xmm1,%xmm5 + pand 48(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqa 64(%r11),%xmm0 + movdqa 80(%r11),%xmm1 + movdqa 96(%r11),%xmm2 + pand 64(%rax),%xmm0 + movdqa 112(%r11),%xmm3 + pand 80(%rax),%xmm1 + por %xmm0,%xmm4 + pand 96(%rax),%xmm2 + por %xmm1,%xmm5 + pand 112(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + por %xmm5,%xmm4 + leaq 256(%r11),%r11 + pshufd $0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 movq %xmm0,(%rdi) leaq 8(%rdi),%rdi subl $1,%esi jnz L$gather + + leaq (%r10),%rsp .byte 0xf3,0xc3 L$SEH_end_bn_gather5: .p2align 6 -L$magic_masks: -.long 0,0, 0,0, 0,0, -1,-1 -.long 0,0, 0,0, 0,0, 0,0 +L$inc: +.long 0,0, 1,1 +.long 2,2, 2,2 .byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105,112,108,105,99,97,116,105,111,110,32,119,105,116,104,32,115,99,97,116,116,101,114,47,103,97,116,104,101,114,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 diff --git a/vendor/openssl/asm_obsolete/x64-macosx-gas/camellia/cmll-x86_64.s b/vendor/openssl/asm_obsolete/x64-macosx-gas/camellia/cmll-x86_64.s index 0a3145ad4..8025d088f 100644 --- a/vendor/openssl/asm_obsolete/x64-macosx-gas/camellia/cmll-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-macosx-gas/camellia/cmll-x86_64.s @@ -1624,7 +1624,7 @@ L$cbc_prologue: leaq -64-63(%rcx),%r10 subq %rsp,%r10 negq %r10 - andq $960,%r10 + andq $0x3C0,%r10 subq %r10,%rsp diff --git a/vendor/openssl/asm_obsolete/x64-macosx-gas/ec/ecp_nistz256-x86_64.s b/vendor/openssl/asm_obsolete/x64-macosx-gas/ec/ecp_nistz256-x86_64.s index a63b602b9..30456b900 100644 --- a/vendor/openssl/asm_obsolete/x64-macosx-gas/ec/ecp_nistz256-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-macosx-gas/ec/ecp_nistz256-x86_64.s @@ -1121,6 +1121,7 @@ _ecp_nistz256_point_double: pushq %r15 subq $160+8,%rsp +L$point_double_shortcutq: movdqu 0(%rsi),%xmm0 movq %rsi,%rbx movdqu 16(%rsi),%xmm1 @@ -1341,7 +1342,7 @@ _ecp_nistz256_point_add: por %xmm1,%xmm3 movdqu 0(%rsi),%xmm0 - pshufd $177,%xmm3,%xmm5 + pshufd $0xb1,%xmm3,%xmm5 movdqu 16(%rsi),%xmm1 movdqu 32(%rsi),%xmm2 por %xmm3,%xmm5 @@ -1351,7 +1352,7 @@ _ecp_nistz256_point_add: movq 64+16(%rsi),%r15 movq 64+24(%rsi),%r8 movdqa %xmm0,480(%rsp) - pshufd $30,%xmm5,%xmm4 + pshufd $0x1e,%xmm5,%xmm4 movdqa %xmm1,480+16(%rsp) por %xmm0,%xmm1 .byte 102,72,15,110,199 @@ -1371,10 +1372,10 @@ _ecp_nistz256_point_add: call __ecp_nistz256_sqr_montq pcmpeqd %xmm4,%xmm5 - pshufd $177,%xmm3,%xmm4 + pshufd $0xb1,%xmm3,%xmm4 por %xmm3,%xmm4 pshufd $0,%xmm5,%xmm5 - pshufd $30,%xmm4,%xmm3 + pshufd $0x1e,%xmm4,%xmm3 por %xmm3,%xmm4 pxor %xmm3,%xmm3 pcmpeqd %xmm3,%xmm4 @@ -1383,6 +1384,7 @@ _ecp_nistz256_point_add: movq 64+8(%rbx),%r14 movq 64+16(%rbx),%r15 movq 64+24(%rbx),%r8 +.byte 102,72,15,110,203 leaq 64-0(%rbx),%rsi leaq 32(%rsp),%rdi @@ -1474,7 +1476,7 @@ _ecp_nistz256_point_add: testq %r8,%r8 jnz L$add_proceedq testq %r9,%r9 - jz L$add_proceedq + jz L$add_doubleq .byte 102,72,15,126,199 pxor %xmm0,%xmm0 @@ -1486,6 +1488,13 @@ _ecp_nistz256_point_add: movdqu %xmm0,80(%rdi) jmp L$add_doneq +.p2align 5 +L$add_doubleq: +.byte 102,72,15,126,206 +.byte 102,72,15,126,199 + addq $416,%rsp + jmp L$point_double_shortcutq + .p2align 5 L$add_proceedq: movq 0+64(%rsp),%rax @@ -1733,13 +1742,13 @@ _ecp_nistz256_point_add_affine: por %xmm1,%xmm3 movdqu 0(%rbx),%xmm0 - pshufd $177,%xmm3,%xmm5 + pshufd $0xb1,%xmm3,%xmm5 movdqu 16(%rbx),%xmm1 movdqu 32(%rbx),%xmm2 por %xmm3,%xmm5 movdqu 48(%rbx),%xmm3 movdqa %xmm0,416(%rsp) - pshufd $30,%xmm5,%xmm4 + pshufd $0x1e,%xmm5,%xmm4 movdqa %xmm1,416+16(%rsp) por %xmm0,%xmm1 .byte 102,72,15,110,199 @@ -1755,13 +1764,13 @@ _ecp_nistz256_point_add_affine: call __ecp_nistz256_sqr_montq pcmpeqd %xmm4,%xmm5 - pshufd $177,%xmm3,%xmm4 + pshufd $0xb1,%xmm3,%xmm4 movq 0(%rbx),%rax movq %r12,%r9 por %xmm3,%xmm4 pshufd $0,%xmm5,%xmm5 - pshufd $30,%xmm4,%xmm3 + pshufd $0x1e,%xmm4,%xmm3 movq %r13,%r10 por %xmm3,%xmm4 pxor %xmm3,%xmm3 diff --git a/vendor/openssl/asm_obsolete/x64-macosx-gas/md5/md5-x86_64.s b/vendor/openssl/asm_obsolete/x64-macosx-gas/md5/md5-x86_64.s index 712a871d3..5b1f44ea0 100644 --- a/vendor/openssl/asm_obsolete/x64-macosx-gas/md5/md5-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-macosx-gas/md5/md5-x86_64.s @@ -493,14 +493,14 @@ L$loop: movl %ecx,%r11d addl %ecx,%ebx movl 0(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d xorl %edx,%r11d leal -198630844(%rax,%r10,1),%eax orl %ebx,%r11d xorl %ecx,%r11d addl %r11d,%eax movl 28(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $6,%eax xorl %ecx,%r11d addl %ebx,%eax @@ -509,7 +509,7 @@ L$loop: xorl %ebx,%r11d addl %r11d,%edx movl 56(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $10,%edx xorl %ebx,%r11d addl %eax,%edx @@ -518,7 +518,7 @@ L$loop: xorl %eax,%r11d addl %r11d,%ecx movl 20(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $15,%ecx xorl %eax,%r11d addl %edx,%ecx @@ -527,7 +527,7 @@ L$loop: xorl %edx,%r11d addl %r11d,%ebx movl 48(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $21,%ebx xorl %edx,%r11d addl %ecx,%ebx @@ -536,7 +536,7 @@ L$loop: xorl %ecx,%r11d addl %r11d,%eax movl 12(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $6,%eax xorl %ecx,%r11d addl %ebx,%eax @@ -545,7 +545,7 @@ L$loop: xorl %ebx,%r11d addl %r11d,%edx movl 40(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $10,%edx xorl %ebx,%r11d addl %eax,%edx @@ -554,7 +554,7 @@ L$loop: xorl %eax,%r11d addl %r11d,%ecx movl 4(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $15,%ecx xorl %eax,%r11d addl %edx,%ecx @@ -563,7 +563,7 @@ L$loop: xorl %edx,%r11d addl %r11d,%ebx movl 32(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $21,%ebx xorl %edx,%r11d addl %ecx,%ebx @@ -572,7 +572,7 @@ L$loop: xorl %ecx,%r11d addl %r11d,%eax movl 60(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $6,%eax xorl %ecx,%r11d addl %ebx,%eax @@ -581,7 +581,7 @@ L$loop: xorl %ebx,%r11d addl %r11d,%edx movl 24(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $10,%edx xorl %ebx,%r11d addl %eax,%edx @@ -590,7 +590,7 @@ L$loop: xorl %eax,%r11d addl %r11d,%ecx movl 52(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $15,%ecx xorl %eax,%r11d addl %edx,%ecx @@ -599,7 +599,7 @@ L$loop: xorl %edx,%r11d addl %r11d,%ebx movl 16(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $21,%ebx xorl %edx,%r11d addl %ecx,%ebx @@ -608,7 +608,7 @@ L$loop: xorl %ecx,%r11d addl %r11d,%eax movl 44(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $6,%eax xorl %ecx,%r11d addl %ebx,%eax @@ -617,7 +617,7 @@ L$loop: xorl %ebx,%r11d addl %r11d,%edx movl 8(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $10,%edx xorl %ebx,%r11d addl %eax,%edx @@ -626,7 +626,7 @@ L$loop: xorl %eax,%r11d addl %r11d,%ecx movl 36(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $15,%ecx xorl %eax,%r11d addl %edx,%ecx @@ -635,7 +635,7 @@ L$loop: xorl %edx,%r11d addl %r11d,%ebx movl 0(%rsi),%r10d - movl $4294967295,%r11d + movl $0xffffffff,%r11d roll $21,%ebx xorl %edx,%r11d addl %ecx,%ebx diff --git a/vendor/openssl/asm_obsolete/x64-macosx-gas/modes/ghash-x86_64.s b/vendor/openssl/asm_obsolete/x64-macosx-gas/modes/ghash-x86_64.s index f21b3013c..ba706df1d 100644 --- a/vendor/openssl/asm_obsolete/x64-macosx-gas/modes/ghash-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-macosx-gas/modes/ghash-x86_64.s @@ -20,14 +20,14 @@ L$gmult_prologue: movq $14,%rcx movq 8(%rsi,%rax,1),%r8 movq (%rsi,%rax,1),%r9 - andb $240,%bl + andb $0xf0,%bl movq %r8,%rdx jmp L$oop1 .p2align 4 L$oop1: shrq $4,%r8 - andq $15,%rdx + andq $0xf,%rdx movq %r9,%r10 movb (%rdi,%rcx,1),%al shrq $4,%r9 @@ -43,13 +43,13 @@ L$oop1: js L$break1 shrq $4,%r8 - andq $15,%rdx + andq $0xf,%rdx movq %r9,%r10 shrq $4,%r9 xorq 8(%rsi,%rax,1),%r8 shlq $60,%r10 xorq (%rsi,%rax,1),%r9 - andb $240,%bl + andb $0xf0,%bl xorq (%r11,%rdx,8),%r9 movq %r8,%rdx xorq %r10,%r8 @@ -58,19 +58,19 @@ L$oop1: .p2align 4 L$break1: shrq $4,%r8 - andq $15,%rdx + andq $0xf,%rdx movq %r9,%r10 shrq $4,%r9 xorq 8(%rsi,%rax,1),%r8 shlq $60,%r10 xorq (%rsi,%rax,1),%r9 - andb $240,%bl + andb $0xf0,%bl xorq (%r11,%rdx,8),%r9 movq %r8,%rdx xorq %r10,%r8 shrq $4,%r8 - andq $15,%rdx + andq $0xf,%rdx movq %r9,%r10 shrq $4,%r9 xorq 8(%rsi,%rbx,1),%r8 @@ -874,20 +874,20 @@ L$_ghash_clmul: movdqu 32(%rsi),%xmm7 .byte 102,65,15,56,0,194 - subq $16,%rcx + subq $0x10,%rcx jz L$odd_tail movdqu 16(%rsi),%xmm6 movl _OPENSSL_ia32cap_P+4(%rip),%eax - cmpq $48,%rcx + cmpq $0x30,%rcx jb L$skip4x andl $71303168,%eax cmpl $4194304,%eax je L$skip4x - subq $48,%rcx - movq $11547335547999543296,%rax + subq $0x30,%rcx + movq $0xA040608020C0E000,%rax movdqu 48(%rsi),%xmm14 movdqu 64(%rsi),%xmm15 @@ -934,7 +934,7 @@ L$_ghash_clmul: xorps %xmm13,%xmm5 leaq 64(%rdx),%rdx - subq $64,%rcx + subq $0x40,%rcx jc L$tail4x jmp L$mod4_loop @@ -1017,7 +1017,7 @@ L$mod4_loop: xorps %xmm13,%xmm5 leaq 64(%rdx),%rdx - subq $64,%rcx + subq $0x40,%rcx jnc L$mod4_loop L$tail4x: @@ -1061,10 +1061,10 @@ L$tail4x: pxor %xmm4,%xmm0 psrlq $1,%xmm0 pxor %xmm1,%xmm0 - addq $64,%rcx + addq $0x40,%rcx jz L$done movdqu 32(%rsi),%xmm7 - subq $16,%rcx + subq $0x10,%rcx jz L$odd_tail L$skip4x: @@ -1087,7 +1087,7 @@ L$skip4x: leaq 32(%rdx),%rdx nop - subq $32,%rcx + subq $0x20,%rcx jbe L$even_tail nop jmp L$mod_loop @@ -1150,7 +1150,7 @@ L$mod_loop: .byte 102,15,58,68,231,0 pxor %xmm1,%xmm0 - subq $32,%rcx + subq $0x20,%rcx ja L$mod_loop L$even_tail: diff --git a/vendor/openssl/asm_obsolete/x64-macosx-gas/sha/sha1-mb-x86_64.s b/vendor/openssl/asm_obsolete/x64-macosx-gas/sha/sha1-mb-x86_64.s index 010924530..4976be6d7 100644 --- a/vendor/openssl/asm_obsolete/x64-macosx-gas/sha/sha1-mb-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-macosx-gas/sha/sha1-mb-x86_64.s @@ -2857,8 +2857,8 @@ L$oop_shaext: .byte 69,15,58,204,193,3 .byte 69,15,56,200,214 - pshufd $0,%xmm6,%xmm11 - pshufd $85,%xmm6,%xmm12 + pshufd $0x00,%xmm6,%xmm11 + pshufd $0x55,%xmm6,%xmm12 movdqa %xmm6,%xmm7 pcmpgtd %xmm4,%xmm11 pcmpgtd %xmm4,%xmm12 diff --git a/vendor/openssl/asm_obsolete/x64-macosx-gas/sha/sha256-mb-x86_64.s b/vendor/openssl/asm_obsolete/x64-macosx-gas/sha/sha256-mb-x86_64.s index 5ad4c7bb1..796ce2c95 100644 --- a/vendor/openssl/asm_obsolete/x64-macosx-gas/sha/sha256-mb-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-macosx-gas/sha/sha256-mb-x86_64.s @@ -2712,11 +2712,11 @@ L$oop_shaext: movdqa %xmm2,%xmm0 movdqa %xmm15,112(%rsp) .byte 69,15,56,203,254 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 pxor %xmm12,%xmm4 movdqa %xmm12,64(%rsp) .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 pxor %xmm14,%xmm8 movdqa %xmm14,96(%rsp) movdqa 16-128(%rbp),%xmm1 @@ -2734,11 +2734,11 @@ L$oop_shaext: .byte 102,68,15,56,0,211 prefetcht0 127(%r9) .byte 69,15,56,203,254 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 .byte 102,68,15,56,0,219 .byte 15,56,204,229 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 32-128(%rbp),%xmm1 paddd %xmm6,%xmm1 .byte 69,15,56,203,247 @@ -2751,14 +2751,14 @@ L$oop_shaext: movdqa %xmm2,%xmm0 movdqa %xmm7,%xmm3 .byte 69,15,56,203,254 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 .byte 102,15,58,15,222,4 paddd %xmm3,%xmm4 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 .byte 15,56,204,238 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 48-128(%rbp),%xmm1 paddd %xmm7,%xmm1 .byte 69,15,56,203,247 @@ -2775,13 +2775,13 @@ L$oop_shaext: .byte 102,15,58,15,223,4 .byte 69,15,56,203,254 .byte 69,15,56,205,195 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm5 movdqa %xmm8,%xmm3 .byte 102,65,15,58,15,219,4 .byte 15,56,204,247 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 64-128(%rbp),%xmm1 paddd %xmm4,%xmm1 .byte 69,15,56,203,247 @@ -2797,13 +2797,13 @@ L$oop_shaext: .byte 102,15,58,15,220,4 .byte 69,15,56,203,254 .byte 69,15,56,205,200 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm6 movdqa %xmm9,%xmm3 .byte 102,65,15,58,15,216,4 .byte 15,56,204,252 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 80-128(%rbp),%xmm1 paddd %xmm5,%xmm1 .byte 69,15,56,203,247 @@ -2819,13 +2819,13 @@ L$oop_shaext: .byte 102,15,58,15,221,4 .byte 69,15,56,203,254 .byte 69,15,56,205,209 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm7 movdqa %xmm10,%xmm3 .byte 102,65,15,58,15,217,4 .byte 15,56,204,229 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 96-128(%rbp),%xmm1 paddd %xmm6,%xmm1 .byte 69,15,56,203,247 @@ -2841,13 +2841,13 @@ L$oop_shaext: .byte 102,15,58,15,222,4 .byte 69,15,56,203,254 .byte 69,15,56,205,218 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm4 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 .byte 15,56,204,238 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 112-128(%rbp),%xmm1 paddd %xmm7,%xmm1 .byte 69,15,56,203,247 @@ -2863,13 +2863,13 @@ L$oop_shaext: .byte 102,15,58,15,223,4 .byte 69,15,56,203,254 .byte 69,15,56,205,195 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm5 movdqa %xmm8,%xmm3 .byte 102,65,15,58,15,219,4 .byte 15,56,204,247 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 128-128(%rbp),%xmm1 paddd %xmm4,%xmm1 .byte 69,15,56,203,247 @@ -2885,13 +2885,13 @@ L$oop_shaext: .byte 102,15,58,15,220,4 .byte 69,15,56,203,254 .byte 69,15,56,205,200 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm6 movdqa %xmm9,%xmm3 .byte 102,65,15,58,15,216,4 .byte 15,56,204,252 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 144-128(%rbp),%xmm1 paddd %xmm5,%xmm1 .byte 69,15,56,203,247 @@ -2907,13 +2907,13 @@ L$oop_shaext: .byte 102,15,58,15,221,4 .byte 69,15,56,203,254 .byte 69,15,56,205,209 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm7 movdqa %xmm10,%xmm3 .byte 102,65,15,58,15,217,4 .byte 15,56,204,229 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 160-128(%rbp),%xmm1 paddd %xmm6,%xmm1 .byte 69,15,56,203,247 @@ -2929,13 +2929,13 @@ L$oop_shaext: .byte 102,15,58,15,222,4 .byte 69,15,56,203,254 .byte 69,15,56,205,218 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm4 movdqa %xmm11,%xmm3 .byte 102,65,15,58,15,218,4 .byte 15,56,204,238 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 176-128(%rbp),%xmm1 paddd %xmm7,%xmm1 .byte 69,15,56,203,247 @@ -2951,13 +2951,13 @@ L$oop_shaext: .byte 102,15,58,15,223,4 .byte 69,15,56,203,254 .byte 69,15,56,205,195 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm5 movdqa %xmm8,%xmm3 .byte 102,65,15,58,15,219,4 .byte 15,56,204,247 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 192-128(%rbp),%xmm1 paddd %xmm4,%xmm1 .byte 69,15,56,203,247 @@ -2973,13 +2973,13 @@ L$oop_shaext: .byte 102,15,58,15,220,4 .byte 69,15,56,203,254 .byte 69,15,56,205,200 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm6 movdqa %xmm9,%xmm3 .byte 102,65,15,58,15,216,4 .byte 15,56,204,252 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 208-128(%rbp),%xmm1 paddd %xmm5,%xmm1 .byte 69,15,56,203,247 @@ -2995,13 +2995,13 @@ L$oop_shaext: .byte 102,15,58,15,221,4 .byte 69,15,56,203,254 .byte 69,15,56,205,209 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 paddd %xmm3,%xmm7 movdqa %xmm10,%xmm3 .byte 102,65,15,58,15,217,4 nop .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 224-128(%rbp),%xmm1 paddd %xmm6,%xmm1 .byte 69,15,56,203,247 @@ -3018,13 +3018,13 @@ L$oop_shaext: pxor %xmm6,%xmm6 .byte 69,15,56,203,254 .byte 69,15,56,205,218 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 movdqa 240-128(%rbp),%xmm1 paddd %xmm7,%xmm1 movq (%rbx),%xmm7 nop .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 movdqa 240-128(%rbp),%xmm2 paddd %xmm11,%xmm2 .byte 69,15,56,203,247 @@ -3034,17 +3034,17 @@ L$oop_shaext: cmovgeq %rsp,%r8 cmpl 4(%rbx),%ecx cmovgeq %rsp,%r9 - pshufd $0,%xmm7,%xmm9 + pshufd $0x00,%xmm7,%xmm9 .byte 69,15,56,203,236 movdqa %xmm2,%xmm0 - pshufd $85,%xmm7,%xmm10 + pshufd $0x55,%xmm7,%xmm10 movdqa %xmm7,%xmm11 .byte 69,15,56,203,254 - pshufd $14,%xmm1,%xmm0 + pshufd $0x0e,%xmm1,%xmm0 pcmpgtd %xmm6,%xmm9 pcmpgtd %xmm6,%xmm10 .byte 69,15,56,203,229 - pshufd $14,%xmm2,%xmm0 + pshufd $0x0e,%xmm2,%xmm0 pcmpgtd %xmm6,%xmm11 movdqa K256_shaext-16(%rip),%xmm3 .byte 69,15,56,203,247 diff --git a/vendor/openssl/asm_obsolete/x64-macosx-gas/sha/sha256-x86_64.s b/vendor/openssl/asm_obsolete/x64-macosx-gas/sha/sha256-x86_64.s index aa507cada..5566d5876 100644 --- a/vendor/openssl/asm_obsolete/x64-macosx-gas/sha/sha256-x86_64.s +++ b/vendor/openssl/asm_obsolete/x64-macosx-gas/sha/sha256-x86_64.s @@ -1754,9 +1754,9 @@ _shaext_shortcut: movdqu 16(%rdi),%xmm2 movdqa 512-128(%rcx),%xmm7 - pshufd $27,%xmm1,%xmm0 - pshufd $177,%xmm1,%xmm1 - pshufd $27,%xmm2,%xmm2 + pshufd $0x1b,%xmm1,%xmm0 + pshufd $0xb1,%xmm1,%xmm1 + pshufd $0x1b,%xmm2,%xmm2 movdqa %xmm7,%xmm8 .byte 102,15,58,15,202,8 punpcklqdq %xmm0,%xmm2 @@ -1775,7 +1775,7 @@ L$oop_shaext: .byte 102,15,56,0,231 movdqa %xmm2,%xmm10 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 nop movdqa %xmm1,%xmm9 .byte 15,56,203,202 @@ -1784,7 +1784,7 @@ L$oop_shaext: paddd %xmm4,%xmm0 .byte 102,15,56,0,239 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 leaq 64(%rsi),%rsi .byte 15,56,204,220 .byte 15,56,203,202 @@ -1793,7 +1793,7 @@ L$oop_shaext: paddd %xmm5,%xmm0 .byte 102,15,56,0,247 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm6,%xmm7 .byte 102,15,58,15,253,4 nop @@ -1805,7 +1805,7 @@ L$oop_shaext: paddd %xmm6,%xmm0 .byte 15,56,205,222 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm3,%xmm7 .byte 102,15,58,15,254,4 nop @@ -1816,7 +1816,7 @@ L$oop_shaext: paddd %xmm3,%xmm0 .byte 15,56,205,227 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm4,%xmm7 .byte 102,15,58,15,251,4 nop @@ -1827,7 +1827,7 @@ L$oop_shaext: paddd %xmm4,%xmm0 .byte 15,56,205,236 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm5,%xmm7 .byte 102,15,58,15,252,4 nop @@ -1838,7 +1838,7 @@ L$oop_shaext: paddd %xmm5,%xmm0 .byte 15,56,205,245 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm6,%xmm7 .byte 102,15,58,15,253,4 nop @@ -1849,7 +1849,7 @@ L$oop_shaext: paddd %xmm6,%xmm0 .byte 15,56,205,222 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm3,%xmm7 .byte 102,15,58,15,254,4 nop @@ -1860,7 +1860,7 @@ L$oop_shaext: paddd %xmm3,%xmm0 .byte 15,56,205,227 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm4,%xmm7 .byte 102,15,58,15,251,4 nop @@ -1871,7 +1871,7 @@ L$oop_shaext: paddd %xmm4,%xmm0 .byte 15,56,205,236 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm5,%xmm7 .byte 102,15,58,15,252,4 nop @@ -1882,7 +1882,7 @@ L$oop_shaext: paddd %xmm5,%xmm0 .byte 15,56,205,245 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm6,%xmm7 .byte 102,15,58,15,253,4 nop @@ -1893,7 +1893,7 @@ L$oop_shaext: paddd %xmm6,%xmm0 .byte 15,56,205,222 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm3,%xmm7 .byte 102,15,58,15,254,4 nop @@ -1904,7 +1904,7 @@ L$oop_shaext: paddd %xmm3,%xmm0 .byte 15,56,205,227 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm4,%xmm7 .byte 102,15,58,15,251,4 nop @@ -1915,7 +1915,7 @@ L$oop_shaext: paddd %xmm4,%xmm0 .byte 15,56,205,236 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 movdqa %xmm5,%xmm7 .byte 102,15,58,15,252,4 .byte 15,56,203,202 @@ -1924,7 +1924,7 @@ L$oop_shaext: movdqa 448-128(%rcx),%xmm0 paddd %xmm5,%xmm0 .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 .byte 15,56,205,245 movdqa %xmm8,%xmm7 .byte 15,56,203,202 @@ -1933,7 +1933,7 @@ L$oop_shaext: paddd %xmm6,%xmm0 nop .byte 15,56,203,209 - pshufd $14,%xmm0,%xmm0 + pshufd $0x0e,%xmm0,%xmm0 decq %rdx nop .byte 15,56,203,202 @@ -1942,9 +1942,9 @@ L$oop_shaext: paddd %xmm9,%xmm1 jnz L$oop_shaext - pshufd $177,%xmm2,%xmm2 - pshufd $27,%xmm1,%xmm7 - pshufd $177,%xmm1,%xmm1 + pshufd $0xb1,%xmm2,%xmm2 + pshufd $0x1b,%xmm1,%xmm7 + pshufd $0xb1,%xmm1,%xmm1 punpckhqdq %xmm2,%xmm1 .byte 102,15,58,15,215,8 diff --git a/vendor/openssl/asm_obsolete/x64-macosx-gas/x86_64cpuid.s b/vendor/openssl/asm_obsolete/x64-macosx-gas/x86_64cpuid.s index 5d69baad8..ef623d596 100644 --- a/vendor/openssl/asm_obsolete/x64-macosx-gas/x86_64cpuid.s +++ b/vendor/openssl/asm_obsolete/x64-macosx-gas/x86_64cpuid.s @@ -45,43 +45,43 @@ _OPENSSL_ia32_cpuid: movl %eax,%r11d xorl %eax,%eax - cmpl $1970169159,%ebx + cmpl $0x756e6547,%ebx setne %al movl %eax,%r9d - cmpl $1231384169,%edx + cmpl $0x49656e69,%edx setne %al orl %eax,%r9d - cmpl $1818588270,%ecx + cmpl $0x6c65746e,%ecx setne %al orl %eax,%r9d jz L$intel - cmpl $1752462657,%ebx + cmpl $0x68747541,%ebx setne %al movl %eax,%r10d - cmpl $1769238117,%edx + cmpl $0x69746E65,%edx setne %al orl %eax,%r10d - cmpl $1145913699,%ecx + cmpl $0x444D4163,%ecx setne %al orl %eax,%r10d jnz L$intel - movl $2147483648,%eax + movl $0x80000000,%eax cpuid - cmpl $2147483649,%eax + cmpl $0x80000001,%eax jb L$intel movl %eax,%r10d - movl $2147483649,%eax + movl $0x80000001,%eax cpuid orl %ecx,%r9d - andl $2049,%r9d + andl $0x00000801,%r9d - cmpl $2147483656,%r10d + cmpl $0x80000008,%r10d jb L$intel - movl $2147483656,%eax + movl $0x80000008,%eax cpuid movzbq %cl,%r10 incq %r10 @@ -93,7 +93,7 @@ _OPENSSL_ia32_cpuid: shrl $16,%ebx cmpb %r10b,%bl ja L$generic - andl $4026531839,%edx + andl $0xefffffff,%edx jmp L$generic L$intel: @@ -106,7 +106,7 @@ L$intel: cpuid movl %eax,%r10d shrl $14,%r10d - andl $4095,%r10d + andl $0xfff,%r10d cmpl $7,%r11d jb L$nocacheinfo @@ -119,29 +119,29 @@ L$intel: L$nocacheinfo: movl $1,%eax cpuid - andl $3220176895,%edx + andl $0xbfefffff,%edx cmpl $0,%r9d jne L$notintel - orl $1073741824,%edx + orl $0x40000000,%edx andb $15,%ah cmpb $15,%ah jne L$notintel - orl $1048576,%edx + orl $0x00100000,%edx L$notintel: btl $28,%edx jnc L$generic - andl $4026531839,%edx + andl $0xefffffff,%edx cmpl $0,%r10d je L$generic - orl $268435456,%edx + orl $0x10000000,%edx shrl $16,%ebx cmpb $1,%bl ja L$generic - andl $4026531839,%edx + andl $0xefffffff,%edx L$generic: - andl $2048,%r9d - andl $4294965247,%ecx + andl $0x00000800,%r9d + andl $0xfffff7ff,%ecx orl %ecx,%r9d movl %edx,%r10d @@ -153,9 +153,9 @@ L$generic: cmpl $6,%eax je L$done L$clear_avx: - movl $4026525695,%eax + movl $0xefffe7ff,%eax andl %eax,%r9d - andl $4294967263,8(%rdi) + andl $0xffffffdf,8(%rdi) L$done: shlq $32,%r9 movl %r10d,%eax diff --git a/vendor/openssl/asm_obsolete/x64-win32-masm/bn/rsaz-x86_64.asm b/vendor/openssl/asm_obsolete/x64-win32-masm/bn/rsaz-x86_64.asm index 86e828d3d..89114311a 100644 --- a/vendor/openssl/asm_obsolete/x64-win32-masm/bn/rsaz-x86_64.asm +++ b/vendor/openssl/asm_obsolete/x64-win32-masm/bn/rsaz-x86_64.asm @@ -502,48 +502,104 @@ $L$SEH_begin_rsaz_512_mul_gather4:: push r14 push r15 - mov r9d,r9d - sub rsp,128+24 + sub rsp,328 + movaps XMMWORD PTR[160+rsp],xmm6 + movaps XMMWORD PTR[176+rsp],xmm7 + movaps XMMWORD PTR[192+rsp],xmm8 + movaps XMMWORD PTR[208+rsp],xmm9 + movaps XMMWORD PTR[224+rsp],xmm10 + movaps XMMWORD PTR[240+rsp],xmm11 + movaps XMMWORD PTR[256+rsp],xmm12 + movaps XMMWORD PTR[272+rsp],xmm13 + movaps XMMWORD PTR[288+rsp],xmm14 + movaps XMMWORD PTR[304+rsp],xmm15 $L$mul_gather4_body:: - mov eax,DWORD PTR[64+r9*4+rdx] -DB 102,72,15,110,199 - mov ebx,DWORD PTR[r9*4+rdx] -DB 102,72,15,110,201 + movd xmm8,r9d + movdqa xmm1,XMMWORD PTR[(($L$inc+16))] + movdqa xmm0,XMMWORD PTR[$L$inc] + + pshufd xmm8,xmm8,0 + movdqa xmm7,xmm1 + movdqa xmm2,xmm1 + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm8 + movdqa xmm3,xmm7 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm8 + movdqa xmm4,xmm7 + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm8 + movdqa xmm5,xmm7 + paddd xmm4,xmm3 + pcmpeqd xmm3,xmm8 + movdqa xmm6,xmm7 + paddd xmm5,xmm4 + pcmpeqd xmm4,xmm8 + paddd xmm6,xmm5 + pcmpeqd xmm5,xmm8 + paddd xmm7,xmm6 + pcmpeqd xmm6,xmm8 + pcmpeqd xmm7,xmm8 + + movdqa xmm8,XMMWORD PTR[rdx] + movdqa xmm9,XMMWORD PTR[16+rdx] + movdqa xmm10,XMMWORD PTR[32+rdx] + movdqa xmm11,XMMWORD PTR[48+rdx] + pand xmm8,xmm0 + movdqa xmm12,XMMWORD PTR[64+rdx] + pand xmm9,xmm1 + movdqa xmm13,XMMWORD PTR[80+rdx] + pand xmm10,xmm2 + movdqa xmm14,XMMWORD PTR[96+rdx] + pand xmm11,xmm3 + movdqa xmm15,XMMWORD PTR[112+rdx] + lea rbp,QWORD PTR[128+rdx] + pand xmm12,xmm4 + pand xmm13,xmm5 + pand xmm14,xmm6 + pand xmm15,xmm7 + por xmm8,xmm10 + por xmm9,xmm11 + por xmm8,xmm12 + por xmm9,xmm13 + por xmm8,xmm14 + por xmm9,xmm15 + + por xmm8,xmm9 + pshufd xmm9,xmm8,04eh + por xmm8,xmm9 +DB 102,76,15,126,195 + mov QWORD PTR[128+rsp],r8 + mov QWORD PTR[((128+8))+rsp],rdi + mov QWORD PTR[((128+16))+rsp],rcx - shl rax,32 - or rbx,rax mov rax,QWORD PTR[rsi] mov rcx,QWORD PTR[8+rsi] - lea rbp,QWORD PTR[128+r9*4+rdx] mul rbx mov QWORD PTR[rsp],rax mov rax,rcx mov r8,rdx mul rbx - movd xmm4,DWORD PTR[rbp] add r8,rax mov rax,QWORD PTR[16+rsi] mov r9,rdx adc r9,0 mul rbx - movd xmm5,DWORD PTR[64+rbp] add r9,rax mov rax,QWORD PTR[24+rsi] mov r10,rdx adc r10,0 mul rbx - pslldq xmm5,4 add r10,rax mov rax,QWORD PTR[32+rsi] mov r11,rdx adc r11,0 mul rbx - por xmm4,xmm5 add r11,rax mov rax,QWORD PTR[40+rsi] mov r12,rdx @@ -556,14 +612,12 @@ DB 102,72,15,110,201 adc r13,0 mul rbx - lea rbp,QWORD PTR[128+rbp] add r13,rax mov rax,QWORD PTR[56+rsi] mov r14,rdx adc r14,0 mul rbx -DB 102,72,15,126,227 add r14,rax mov rax,QWORD PTR[rsi] mov r15,rdx @@ -575,6 +629,35 @@ DB 102,72,15,126,227 ALIGN 32 $L$oop_mul_gather:: + movdqa xmm8,XMMWORD PTR[rbp] + movdqa xmm9,XMMWORD PTR[16+rbp] + movdqa xmm10,XMMWORD PTR[32+rbp] + movdqa xmm11,XMMWORD PTR[48+rbp] + pand xmm8,xmm0 + movdqa xmm12,XMMWORD PTR[64+rbp] + pand xmm9,xmm1 + movdqa xmm13,XMMWORD PTR[80+rbp] + pand xmm10,xmm2 + movdqa xmm14,XMMWORD PTR[96+rbp] + pand xmm11,xmm3 + movdqa xmm15,XMMWORD PTR[112+rbp] + lea rbp,QWORD PTR[128+rbp] + pand xmm12,xmm4 + pand xmm13,xmm5 + pand xmm14,xmm6 + pand xmm15,xmm7 + por xmm8,xmm10 + por xmm9,xmm11 + por xmm8,xmm12 + por xmm9,xmm13 + por xmm8,xmm14 + por xmm9,xmm15 + + por xmm8,xmm9 + pshufd xmm9,xmm8,04eh + por xmm8,xmm9 +DB 102,76,15,126,195 + mul rbx add r8,rax mov rax,QWORD PTR[8+rsi] @@ -583,7 +666,6 @@ $L$oop_mul_gather:: adc r8,0 mul rbx - movd xmm4,DWORD PTR[rbp] add r9,rax mov rax,QWORD PTR[16+rsi] adc rdx,0 @@ -592,7 +674,6 @@ $L$oop_mul_gather:: adc r9,0 mul rbx - movd xmm5,DWORD PTR[64+rbp] add r10,rax mov rax,QWORD PTR[24+rsi] adc rdx,0 @@ -601,7 +682,6 @@ $L$oop_mul_gather:: adc r10,0 mul rbx - pslldq xmm5,4 add r11,rax mov rax,QWORD PTR[32+rsi] adc rdx,0 @@ -610,7 +690,6 @@ $L$oop_mul_gather:: adc r11,0 mul rbx - por xmm4,xmm5 add r12,rax mov rax,QWORD PTR[40+rsi] adc rdx,0 @@ -635,7 +714,6 @@ $L$oop_mul_gather:: adc r14,0 mul rbx -DB 102,72,15,126,227 add r15,rax mov rax,QWORD PTR[rsi] adc rdx,0 @@ -643,7 +721,6 @@ DB 102,72,15,126,227 mov r15,rdx adc r15,0 - lea rbp,QWORD PTR[128+rbp] lea rdi,QWORD PTR[8+rdi] dec ecx @@ -658,8 +735,8 @@ DB 102,72,15,126,227 mov QWORD PTR[48+rdi],r14 mov QWORD PTR[56+rdi],r15 -DB 102,72,15,126,199 -DB 102,72,15,126,205 + mov rdi,QWORD PTR[((128+8))+rsp] + mov rbp,QWORD PTR[((128+16))+rsp] mov r8,QWORD PTR[rsp] mov r9,QWORD PTR[8+rsp] @@ -684,6 +761,17 @@ DB 102,72,15,126,205 call __rsaz_512_subtract lea rax,QWORD PTR[((128+24+48))+rsp] + movaps xmm6,XMMWORD PTR[((160-200))+rax] + movaps xmm7,XMMWORD PTR[((176-200))+rax] + movaps xmm8,XMMWORD PTR[((192-200))+rax] + movaps xmm9,XMMWORD PTR[((208-200))+rax] + movaps xmm10,XMMWORD PTR[((224-200))+rax] + movaps xmm11,XMMWORD PTR[((240-200))+rax] + movaps xmm12,XMMWORD PTR[((256-200))+rax] + movaps xmm13,XMMWORD PTR[((272-200))+rax] + movaps xmm14,XMMWORD PTR[((288-200))+rax] + movaps xmm15,XMMWORD PTR[((304-200))+rax] + lea rax,QWORD PTR[176+rax] mov r15,QWORD PTR[((-48))+rax] mov r14,QWORD PTR[((-40))+rax] mov r13,QWORD PTR[((-32))+rax] @@ -723,7 +811,7 @@ $L$SEH_begin_rsaz_512_mul_scatter4:: mov r9d,r9d sub rsp,128+24 $L$mul_scatter4_body:: - lea r8,QWORD PTR[r9*4+r8] + lea r8,QWORD PTR[r9*8+r8] DB 102,72,15,110,199 DB 102,72,15,110,202 DB 102,73,15,110,208 @@ -759,30 +847,14 @@ DB 102,72,15,126,214 call __rsaz_512_subtract - mov DWORD PTR[rsi],r8d - shr r8,32 - mov DWORD PTR[128+rsi],r9d - shr r9,32 - mov DWORD PTR[256+rsi],r10d - shr r10,32 - mov DWORD PTR[384+rsi],r11d - shr r11,32 - mov DWORD PTR[512+rsi],r12d - shr r12,32 - mov DWORD PTR[640+rsi],r13d - shr r13,32 - mov DWORD PTR[768+rsi],r14d - shr r14,32 - mov DWORD PTR[896+rsi],r15d - shr r15,32 - mov DWORD PTR[64+rsi],r8d - mov DWORD PTR[192+rsi],r9d - mov DWORD PTR[320+rsi],r10d - mov DWORD PTR[448+rsi],r11d - mov DWORD PTR[576+rsi],r12d - mov DWORD PTR[704+rsi],r13d - mov DWORD PTR[832+rsi],r14d - mov DWORD PTR[960+rsi],r15d + mov QWORD PTR[rsi],r8 + mov QWORD PTR[128+rsi],r9 + mov QWORD PTR[256+rsi],r10 + mov QWORD PTR[384+rsi],r11 + mov QWORD PTR[512+rsi],r12 + mov QWORD PTR[640+rsi],r13 + mov QWORD PTR[768+rsi],r14 + mov QWORD PTR[896+rsi],r15 lea rax,QWORD PTR[((128+24+48))+rsp] mov r15,QWORD PTR[((-48))+rax] @@ -1151,16 +1223,14 @@ PUBLIC rsaz_512_scatter4 ALIGN 16 rsaz_512_scatter4 PROC PUBLIC - lea rcx,QWORD PTR[r8*4+rcx] + lea rcx,QWORD PTR[r8*8+rcx] mov r9d,8 jmp $L$oop_scatter ALIGN 16 $L$oop_scatter:: mov rax,QWORD PTR[rdx] lea rdx,QWORD PTR[8+rdx] - mov DWORD PTR[rcx],eax - shr rax,32 - mov DWORD PTR[64+rcx],eax + mov QWORD PTR[rcx],rax lea rcx,QWORD PTR[128+rcx] dec r9d jnz $L$oop_scatter @@ -1171,22 +1241,98 @@ PUBLIC rsaz_512_gather4 ALIGN 16 rsaz_512_gather4 PROC PUBLIC - lea rdx,QWORD PTR[r8*4+rdx] +$L$SEH_begin_rsaz_512_gather4:: +DB 048h,081h,0ech,0a8h,000h,000h,000h +DB 00fh,029h,034h,024h +DB 00fh,029h,07ch,024h,010h +DB 044h,00fh,029h,044h,024h,020h +DB 044h,00fh,029h,04ch,024h,030h +DB 044h,00fh,029h,054h,024h,040h +DB 044h,00fh,029h,05ch,024h,050h +DB 044h,00fh,029h,064h,024h,060h +DB 044h,00fh,029h,06ch,024h,070h +DB 044h,00fh,029h,0b4h,024h,080h,0,0,0 +DB 044h,00fh,029h,0bch,024h,090h,0,0,0 + movd xmm8,r8d + movdqa xmm1,XMMWORD PTR[(($L$inc+16))] + movdqa xmm0,XMMWORD PTR[$L$inc] + + pshufd xmm8,xmm8,0 + movdqa xmm7,xmm1 + movdqa xmm2,xmm1 + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm8 + movdqa xmm3,xmm7 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm8 + movdqa xmm4,xmm7 + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm8 + movdqa xmm5,xmm7 + paddd xmm4,xmm3 + pcmpeqd xmm3,xmm8 + movdqa xmm6,xmm7 + paddd xmm5,xmm4 + pcmpeqd xmm4,xmm8 + paddd xmm6,xmm5 + pcmpeqd xmm5,xmm8 + paddd xmm7,xmm6 + pcmpeqd xmm6,xmm8 + pcmpeqd xmm7,xmm8 mov r9d,8 jmp $L$oop_gather ALIGN 16 $L$oop_gather:: - mov eax,DWORD PTR[rdx] - mov r8d,DWORD PTR[64+rdx] + movdqa xmm8,XMMWORD PTR[rdx] + movdqa xmm9,XMMWORD PTR[16+rdx] + movdqa xmm10,XMMWORD PTR[32+rdx] + movdqa xmm11,XMMWORD PTR[48+rdx] + pand xmm8,xmm0 + movdqa xmm12,XMMWORD PTR[64+rdx] + pand xmm9,xmm1 + movdqa xmm13,XMMWORD PTR[80+rdx] + pand xmm10,xmm2 + movdqa xmm14,XMMWORD PTR[96+rdx] + pand xmm11,xmm3 + movdqa xmm15,XMMWORD PTR[112+rdx] lea rdx,QWORD PTR[128+rdx] - shl r8,32 - or rax,r8 - mov QWORD PTR[rcx],rax + pand xmm12,xmm4 + pand xmm13,xmm5 + pand xmm14,xmm6 + pand xmm15,xmm7 + por xmm8,xmm10 + por xmm9,xmm11 + por xmm8,xmm12 + por xmm9,xmm13 + por xmm8,xmm14 + por xmm9,xmm15 + + por xmm8,xmm9 + pshufd xmm9,xmm8,04eh + por xmm8,xmm9 + movq QWORD PTR[rcx],xmm8 lea rcx,QWORD PTR[8+rcx] dec r9d jnz $L$oop_gather + movaps xmm6,XMMWORD PTR[rsp] + movaps xmm7,XMMWORD PTR[16+rsp] + movaps xmm8,XMMWORD PTR[32+rsp] + movaps xmm9,XMMWORD PTR[48+rsp] + movaps xmm10,XMMWORD PTR[64+rsp] + movaps xmm11,XMMWORD PTR[80+rsp] + movaps xmm12,XMMWORD PTR[96+rsp] + movaps xmm13,XMMWORD PTR[112+rsp] + movaps xmm14,XMMWORD PTR[128+rsp] + movaps xmm15,XMMWORD PTR[144+rsp] + add rsp,0a8h DB 0F3h,0C3h ;repret +$L$SEH_end_rsaz_512_gather4:: rsaz_512_gather4 ENDP + +ALIGN 64 +$L$inc:: + DD 0,0,1,1 + DD 2,2,2,2 EXTERN __imp_RtlVirtualUnwind:NEAR ALIGN 16 @@ -1222,6 +1368,18 @@ se_handler PROC PRIVATE lea rax,QWORD PTR[((128+24+48))+rax] + lea rbx,QWORD PTR[$L$mul_gather4_epilogue] + cmp rbx,r10 + jne $L$se_not_in_mul_gather4 + + lea rax,QWORD PTR[176+rax] + + lea rsi,QWORD PTR[((-48-168))+rax] + lea rdi,QWORD PTR[512+r8] + mov ecx,20 + DD 0a548f3fch + +$L$se_not_in_mul_gather4:: mov rbx,QWORD PTR[((-8))+rax] mov rbp,QWORD PTR[((-16))+rax] mov r12,QWORD PTR[((-24))+rax] @@ -1298,6 +1456,10 @@ ALIGN 4 DD imagerel $L$SEH_end_rsaz_512_mul_by_one DD imagerel $L$SEH_info_rsaz_512_mul_by_one + DD imagerel $L$SEH_begin_rsaz_512_gather4 + DD imagerel $L$SEH_end_rsaz_512_gather4 + DD imagerel $L$SEH_info_rsaz_512_gather4 + .pdata ENDS .xdata SEGMENT READONLY ALIGN(8) ALIGN 8 @@ -1321,6 +1483,19 @@ $L$SEH_info_rsaz_512_mul_by_one:: DB 9,0,0,0 DD imagerel se_handler DD imagerel $L$mul_by_one_body,imagerel $L$mul_by_one_epilogue +$L$SEH_info_rsaz_512_gather4:: +DB 001h,046h,016h,000h +DB 046h,0f8h,009h,000h +DB 03dh,0e8h,008h,000h +DB 034h,0d8h,007h,000h +DB 02eh,0c8h,006h,000h +DB 028h,0b8h,005h,000h +DB 022h,0a8h,004h,000h +DB 01ch,098h,003h,000h +DB 016h,088h,002h,000h +DB 010h,078h,001h,000h +DB 00bh,068h,000h,000h +DB 007h,001h,015h,000h .xdata ENDS END diff --git a/vendor/openssl/asm_obsolete/x64-win32-masm/bn/x86_64-mont.asm b/vendor/openssl/asm_obsolete/x64-win32-masm/bn/x86_64-mont.asm index afec83bd1..ed588a016 100644 --- a/vendor/openssl/asm_obsolete/x64-win32-masm/bn/x86_64-mont.asm +++ b/vendor/openssl/asm_obsolete/x64-win32-masm/bn/x86_64-mont.asm @@ -47,6 +47,20 @@ $L$mul_enter:: mov QWORD PTR[8+r9*8+rsp],r11 $L$mul_body:: + + + + + + + sub r11,rsp + and r11,-4096 +$L$mul_page_walk:: + mov r10,QWORD PTR[r11*1+rsp] + sub r11,4096 +DB 066h,02eh + jnc $L$mul_page_walk + mov r12,rdx mov r8,QWORD PTR[r8] mov rbx,QWORD PTR[r12] @@ -259,6 +273,14 @@ $L$mul4x_enter:: mov QWORD PTR[8+r9*8+rsp],r11 $L$mul4x_body:: + sub r11,rsp + and r11,-4096 +$L$mul4x_page_walk:: + mov r10,QWORD PTR[r11*1+rsp] + sub r11,4096 +DB 02eh + jnc $L$mul4x_page_walk + mov QWORD PTR[16+r9*8+rsp],rdi mov r12,rdx mov r8,QWORD PTR[r8] @@ -676,81 +698,112 @@ $L$sqr8x_enter:: - lea r11,QWORD PTR[((-64))+r9*4+rsp] + lea r11,QWORD PTR[((-64))+r9*2+rsp] mov r8,QWORD PTR[r8] sub r11,rsi and r11,4095 cmp r10,r11 jb $L$sqr8x_sp_alt sub rsp,r11 - lea rsp,QWORD PTR[((-64))+r9*4+rsp] + lea rsp,QWORD PTR[((-64))+r9*2+rsp] jmp $L$sqr8x_sp_done ALIGN 32 $L$sqr8x_sp_alt:: - lea r10,QWORD PTR[((4096-64))+r9*4] - lea rsp,QWORD PTR[((-64))+r9*4+rsp] + lea r10,QWORD PTR[((4096-64))+r9*2] + lea rsp,QWORD PTR[((-64))+r9*2+rsp] sub r11,r10 mov r10,0 cmovc r11,r10 sub rsp,r11 $L$sqr8x_sp_done:: and rsp,-64 + mov r11,rax + sub r11,rsp + and r11,-4096 +$L$sqr8x_page_walk:: + mov r10,QWORD PTR[r11*1+rsp] + sub r11,4096 +DB 02eh + jnc $L$sqr8x_page_walk + mov r10,r9 neg r9 - lea r11,QWORD PTR[64+r9*2+rsp] mov QWORD PTR[32+rsp],r8 mov QWORD PTR[40+rsp],rax $L$sqr8x_body:: - mov rbp,r9 -DB 102,73,15,110,211 - shr rbp,3+2 - mov eax,DWORD PTR[((OPENSSL_ia32cap_P+8))] - jmp $L$sqr8x_copy_n - -ALIGN 32 -$L$sqr8x_copy_n:: - movq xmm0,QWORD PTR[rcx] - movq xmm1,QWORD PTR[8+rcx] - movq xmm3,QWORD PTR[16+rcx] - movq xmm4,QWORD PTR[24+rcx] - lea rcx,QWORD PTR[32+rcx] - movdqa XMMWORD PTR[r11],xmm0 - movdqa XMMWORD PTR[16+r11],xmm1 - movdqa XMMWORD PTR[32+r11],xmm3 - movdqa XMMWORD PTR[48+r11],xmm4 - lea r11,QWORD PTR[64+r11] - dec rbp - jnz $L$sqr8x_copy_n - +DB 102,72,15,110,209 pxor xmm0,xmm0 DB 102,72,15,110,207 DB 102,73,15,110,218 call bn_sqr8x_internal + + + + lea rbx,QWORD PTR[r9*1+rdi] + mov rcx,r9 + mov rdx,r9 +DB 102,72,15,126,207 + sar rcx,3+2 + jmp $L$sqr8x_sub + +ALIGN 32 +$L$sqr8x_sub:: + mov r12,QWORD PTR[rbx] + mov r13,QWORD PTR[8+rbx] + mov r14,QWORD PTR[16+rbx] + mov r15,QWORD PTR[24+rbx] + lea rbx,QWORD PTR[32+rbx] + sbb r12,QWORD PTR[rbp] + sbb r13,QWORD PTR[8+rbp] + sbb r14,QWORD PTR[16+rbp] + sbb r15,QWORD PTR[24+rbp] + lea rbp,QWORD PTR[32+rbp] + mov QWORD PTR[rdi],r12 + mov QWORD PTR[8+rdi],r13 + mov QWORD PTR[16+rdi],r14 + mov QWORD PTR[24+rdi],r15 + lea rdi,QWORD PTR[32+rdi] + inc rcx + jnz $L$sqr8x_sub + + sbb rax,0 + lea rbx,QWORD PTR[r9*1+rbx] + lea rdi,QWORD PTR[r9*1+rdi] + +DB 102,72,15,110,200 pxor xmm0,xmm0 - lea rax,QWORD PTR[48+rsp] - lea rdx,QWORD PTR[64+r9*2+rsp] - shr r9,3+2 + pshufd xmm1,xmm1,0 mov rsi,QWORD PTR[40+rsp] - jmp $L$sqr8x_zero + jmp $L$sqr8x_cond_copy ALIGN 32 -$L$sqr8x_zero:: - movdqa XMMWORD PTR[rax],xmm0 - movdqa XMMWORD PTR[16+rax],xmm0 - movdqa XMMWORD PTR[32+rax],xmm0 - movdqa XMMWORD PTR[48+rax],xmm0 - lea rax,QWORD PTR[64+rax] - movdqa XMMWORD PTR[rdx],xmm0 - movdqa XMMWORD PTR[16+rdx],xmm0 - movdqa XMMWORD PTR[32+rdx],xmm0 - movdqa XMMWORD PTR[48+rdx],xmm0 - lea rdx,QWORD PTR[64+rdx] - dec r9 - jnz $L$sqr8x_zero +$L$sqr8x_cond_copy:: + movdqa xmm2,XMMWORD PTR[rbx] + movdqa xmm3,XMMWORD PTR[16+rbx] + lea rbx,QWORD PTR[32+rbx] + movdqu xmm4,XMMWORD PTR[rdi] + movdqu xmm5,XMMWORD PTR[16+rdi] + lea rdi,QWORD PTR[32+rdi] + movdqa XMMWORD PTR[(-32)+rbx],xmm0 + movdqa XMMWORD PTR[(-16)+rbx],xmm0 + movdqa XMMWORD PTR[(-32)+rdx*1+rbx],xmm0 + movdqa XMMWORD PTR[(-16)+rdx*1+rbx],xmm0 + pcmpeqd xmm0,xmm1 + pand xmm2,xmm1 + pand xmm3,xmm1 + pand xmm4,xmm0 + pand xmm5,xmm0 + pxor xmm0,xmm0 + por xmm4,xmm2 + por xmm5,xmm3 + movdqu XMMWORD PTR[(-32)+rdi],xmm4 + movdqu XMMWORD PTR[(-16)+rdi],xmm5 + add r9,32 + jnz $L$sqr8x_cond_copy mov rax,1 mov r15,QWORD PTR[((-48))+rsi] diff --git a/vendor/openssl/asm_obsolete/x64-win32-masm/bn/x86_64-mont5.asm b/vendor/openssl/asm_obsolete/x64-win32-masm/bn/x86_64-mont5.asm index 86acef32e..fb3c27a0f 100644 --- a/vendor/openssl/asm_obsolete/x64-win32-masm/bn/x86_64-mont5.asm +++ b/vendor/openssl/asm_obsolete/x64-win32-masm/bn/x86_64-mont5.asm @@ -27,49 +27,165 @@ ALIGN 16 $L$mul_enter:: mov r9d,r9d mov rax,rsp - mov r10d,DWORD PTR[56+rsp] + movd xmm5,DWORD PTR[56+rsp] + lea r10,QWORD PTR[$L$inc] push rbx push rbp push r12 push r13 push r14 push r15 - lea rsp,QWORD PTR[((-40))+rsp] - movaps XMMWORD PTR[rsp],xmm6 - movaps XMMWORD PTR[16+rsp],xmm7 + lea r11,QWORD PTR[2+r9] neg r11 - lea rsp,QWORD PTR[r11*8+rsp] + lea rsp,QWORD PTR[((-264))+r11*8+rsp] and rsp,-1024 mov QWORD PTR[8+r9*8+rsp],rax $L$mul_body:: - mov r12,rdx - mov r11,r10 - shr r10,3 - and r11,7 - not r10 - lea rax,QWORD PTR[$L$magic_masks] - and r10,3 - lea r12,QWORD PTR[96+r11*8+r12] - movq xmm4,QWORD PTR[r10*8+rax] - movq xmm5,QWORD PTR[8+r10*8+rax] - movq xmm6,QWORD PTR[16+r10*8+rax] - movq xmm7,QWORD PTR[24+r10*8+rax] - - movq xmm0,QWORD PTR[((-96))+r12] - movq xmm1,QWORD PTR[((-32))+r12] - pand xmm0,xmm4 - movq xmm2,QWORD PTR[32+r12] - pand xmm1,xmm5 - movq xmm3,QWORD PTR[96+r12] - pand xmm2,xmm6 - por xmm0,xmm1 - pand xmm3,xmm7 + + + + + + + sub rax,rsp + and rax,-4096 +$L$mul_page_walk:: + mov r11,QWORD PTR[rax*1+rsp] + sub rax,4096 +DB 02eh + jnc $L$mul_page_walk + + lea r12,QWORD PTR[128+rdx] + movdqa xmm0,XMMWORD PTR[r10] + movdqa xmm1,XMMWORD PTR[16+r10] + lea r10,QWORD PTR[((24-112))+r9*8+rsp] + and r10,-16 + + pshufd xmm5,xmm5,0 + movdqa xmm4,xmm1 + movdqa xmm2,xmm1 + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 +DB 067h + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[112+r10],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[128+r10],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[144+r10],xmm2 + movdqa xmm2,xmm4 + + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[160+r10],xmm3 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[176+r10],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[192+r10],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[208+r10],xmm2 + movdqa xmm2,xmm4 + + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[224+r10],xmm3 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[240+r10],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[256+r10],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[272+r10],xmm2 + movdqa xmm2,xmm4 + + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[288+r10],xmm3 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[304+r10],xmm0 + + paddd xmm3,xmm2 +DB 067h + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[320+r10],xmm1 + + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[336+r10],xmm2 + pand xmm0,XMMWORD PTR[64+r12] + + pand xmm1,XMMWORD PTR[80+r12] + pand xmm2,XMMWORD PTR[96+r12] + movdqa XMMWORD PTR[352+r10],xmm3 + pand xmm3,XMMWORD PTR[112+r12] + por xmm0,xmm2 + por xmm1,xmm3 + movdqa xmm4,XMMWORD PTR[((-128))+r12] + movdqa xmm5,XMMWORD PTR[((-112))+r12] + movdqa xmm2,XMMWORD PTR[((-96))+r12] + pand xmm4,XMMWORD PTR[112+r10] + movdqa xmm3,XMMWORD PTR[((-80))+r12] + pand xmm5,XMMWORD PTR[128+r10] + por xmm0,xmm4 + pand xmm2,XMMWORD PTR[144+r10] + por xmm1,xmm5 + pand xmm3,XMMWORD PTR[160+r10] + por xmm0,xmm2 + por xmm1,xmm3 + movdqa xmm4,XMMWORD PTR[((-64))+r12] + movdqa xmm5,XMMWORD PTR[((-48))+r12] + movdqa xmm2,XMMWORD PTR[((-32))+r12] + pand xmm4,XMMWORD PTR[176+r10] + movdqa xmm3,XMMWORD PTR[((-16))+r12] + pand xmm5,XMMWORD PTR[192+r10] + por xmm0,xmm4 + pand xmm2,XMMWORD PTR[208+r10] + por xmm1,xmm5 + pand xmm3,XMMWORD PTR[224+r10] por xmm0,xmm2 + por xmm1,xmm3 + movdqa xmm4,XMMWORD PTR[r12] + movdqa xmm5,XMMWORD PTR[16+r12] + movdqa xmm2,XMMWORD PTR[32+r12] + pand xmm4,XMMWORD PTR[240+r10] + movdqa xmm3,XMMWORD PTR[48+r12] + pand xmm5,XMMWORD PTR[256+r10] + por xmm0,xmm4 + pand xmm2,XMMWORD PTR[272+r10] + por xmm1,xmm5 + pand xmm3,XMMWORD PTR[288+r10] + por xmm0,xmm2 + por xmm1,xmm3 + por xmm0,xmm1 + pshufd xmm1,xmm0,04eh + por xmm0,xmm1 lea r12,QWORD PTR[256+r12] - por xmm0,xmm3 - DB 102,72,15,126,195 mov r8,QWORD PTR[r8] @@ -78,29 +194,14 @@ DB 102,72,15,126,195 xor r14,r14 xor r15,r15 - movq xmm0,QWORD PTR[((-96))+r12] - movq xmm1,QWORD PTR[((-32))+r12] - pand xmm0,xmm4 - movq xmm2,QWORD PTR[32+r12] - pand xmm1,xmm5 - mov rbp,r8 mul rbx mov r10,rax mov rax,QWORD PTR[rcx] - movq xmm3,QWORD PTR[96+r12] - pand xmm2,xmm6 - por xmm0,xmm1 - pand xmm3,xmm7 - imul rbp,r10 mov r11,rdx - por xmm0,xmm2 - lea r12,QWORD PTR[256+r12] - por xmm0,xmm3 - mul rbp add r10,rax mov rax,QWORD PTR[8+rsi] @@ -133,14 +234,12 @@ $L$1st_enter:: cmp r15,r9 jne $L$1st -DB 102,72,15,126,195 add r13,rax - mov rax,QWORD PTR[rsi] adc rdx,0 add r13,r11 adc rdx,0 - mov QWORD PTR[((-16))+r15*8+rsp],r13 + mov QWORD PTR[((-16))+r9*8+rsp],r13 mov r13,rdx mov r11,r10 @@ -154,33 +253,78 @@ DB 102,72,15,126,195 jmp $L$outer ALIGN 16 $L$outer:: + lea rdx,QWORD PTR[((24+128))+r9*8+rsp] + and rdx,-16 + pxor xmm4,xmm4 + pxor xmm5,xmm5 + movdqa xmm0,XMMWORD PTR[((-128))+r12] + movdqa xmm1,XMMWORD PTR[((-112))+r12] + movdqa xmm2,XMMWORD PTR[((-96))+r12] + movdqa xmm3,XMMWORD PTR[((-80))+r12] + pand xmm0,XMMWORD PTR[((-128))+rdx] + pand xmm1,XMMWORD PTR[((-112))+rdx] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[((-96))+rdx] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[((-80))+rdx] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[((-64))+r12] + movdqa xmm1,XMMWORD PTR[((-48))+r12] + movdqa xmm2,XMMWORD PTR[((-32))+r12] + movdqa xmm3,XMMWORD PTR[((-16))+r12] + pand xmm0,XMMWORD PTR[((-64))+rdx] + pand xmm1,XMMWORD PTR[((-48))+rdx] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[((-32))+rdx] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[((-16))+rdx] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[r12] + movdqa xmm1,XMMWORD PTR[16+r12] + movdqa xmm2,XMMWORD PTR[32+r12] + movdqa xmm3,XMMWORD PTR[48+r12] + pand xmm0,XMMWORD PTR[rdx] + pand xmm1,XMMWORD PTR[16+rdx] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[32+rdx] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[48+rdx] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[64+r12] + movdqa xmm1,XMMWORD PTR[80+r12] + movdqa xmm2,XMMWORD PTR[96+r12] + movdqa xmm3,XMMWORD PTR[112+r12] + pand xmm0,XMMWORD PTR[64+rdx] + pand xmm1,XMMWORD PTR[80+rdx] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[96+rdx] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[112+rdx] + por xmm4,xmm2 + por xmm5,xmm3 + por xmm4,xmm5 + pshufd xmm0,xmm4,04eh + por xmm0,xmm4 + lea r12,QWORD PTR[256+r12] + + mov rax,QWORD PTR[rsi] +DB 102,72,15,126,195 + xor r15,r15 mov rbp,r8 mov r10,QWORD PTR[rsp] - movq xmm0,QWORD PTR[((-96))+r12] - movq xmm1,QWORD PTR[((-32))+r12] - pand xmm0,xmm4 - movq xmm2,QWORD PTR[32+r12] - pand xmm1,xmm5 - mul rbx add r10,rax mov rax,QWORD PTR[rcx] adc rdx,0 - movq xmm3,QWORD PTR[96+r12] - pand xmm2,xmm6 - por xmm0,xmm1 - pand xmm3,xmm7 - imul rbp,r10 mov r11,rdx - por xmm0,xmm2 - lea r12,QWORD PTR[256+r12] - por xmm0,xmm3 - mul rbp add r10,rax mov rax,QWORD PTR[8+rsi] @@ -216,15 +360,12 @@ $L$inner_enter:: cmp r15,r9 jne $L$inner -DB 102,72,15,126,195 - add r13,rax - mov rax,QWORD PTR[rsi] adc rdx,0 add r13,r10 - mov r10,QWORD PTR[r15*8+rsp] + mov r10,QWORD PTR[r9*8+rsp] adc rdx,0 - mov QWORD PTR[((-16))+r15*8+rsp],r13 + mov QWORD PTR[((-16))+r9*8+rsp],r13 mov r13,rdx xor rdx,rdx @@ -271,8 +412,7 @@ $L$copy:: mov rsi,QWORD PTR[8+r9*8+rsp] mov rax,1 - movaps xmm6,XMMWORD PTR[((-88))+rsi] - movaps xmm7,XMMWORD PTR[((-72))+rsi] + mov r15,QWORD PTR[((-48))+rsi] mov r14,QWORD PTR[((-40))+rsi] mov r13,QWORD PTR[((-32))+rsi] @@ -310,13 +450,10 @@ DB 067h push r13 push r14 push r15 - lea rsp,QWORD PTR[((-40))+rsp] - movaps XMMWORD PTR[rsp],xmm6 - movaps XMMWORD PTR[16+rsp],xmm7 + DB 067h - mov r10d,r9d shl r9d,3 - shl r10d,3+2 + lea r10,QWORD PTR[r9*2+r9] neg r9 @@ -326,25 +463,36 @@ DB 067h - lea r11,QWORD PTR[((-64))+r9*2+rsp] - sub r11,rsi + + + lea r11,QWORD PTR[((-320))+r9*2+rsp] + sub r11,rdi and r11,4095 cmp r10,r11 jb $L$mul4xsp_alt sub rsp,r11 - lea rsp,QWORD PTR[((-64))+r9*2+rsp] + lea rsp,QWORD PTR[((-320))+r9*2+rsp] jmp $L$mul4xsp_done ALIGN 32 $L$mul4xsp_alt:: - lea r10,QWORD PTR[((4096-64))+r9*2] - lea rsp,QWORD PTR[((-64))+r9*2+rsp] + lea r10,QWORD PTR[((4096-320))+r9*2] + lea rsp,QWORD PTR[((-320))+r9*2+rsp] sub r11,r10 mov r10,0 cmovc r11,r10 sub rsp,r11 $L$mul4xsp_done:: and rsp,-64 + mov r11,rax + sub r11,rsp + and r11,-4096 +$L$mul4x_page_walk:: + mov r10,QWORD PTR[r11*1+rsp] + sub r11,4096 +DB 02eh + jnc $L$mul4x_page_walk + neg r9 mov QWORD PTR[40+rsp],rax @@ -354,8 +502,7 @@ $L$mul4x_body:: mov rsi,QWORD PTR[40+rsp] mov rax,1 - movaps xmm6,XMMWORD PTR[((-88))+rsi] - movaps xmm7,XMMWORD PTR[((-72))+rsi] + mov r15,QWORD PTR[((-48))+rsi] mov r14,QWORD PTR[((-40))+rsi] mov r13,QWORD PTR[((-32))+rsi] @@ -374,47 +521,141 @@ bn_mul4x_mont_gather5 ENDP ALIGN 32 mul4x_internal PROC PRIVATE shl r9,5 - mov r10d,DWORD PTR[56+rax] - lea r13,QWORD PTR[256+r9*1+rdx] + movd xmm5,DWORD PTR[56+rax] + lea rax,QWORD PTR[$L$inc] + lea r13,QWORD PTR[128+r9*1+rdx] shr r9,5 - mov r11,r10 - shr r10,3 - and r11,7 - not r10 - lea rax,QWORD PTR[$L$magic_masks] - and r10,3 - lea r12,QWORD PTR[96+r11*8+rdx] - movq xmm4,QWORD PTR[r10*8+rax] - movq xmm5,QWORD PTR[8+r10*8+rax] - add r11,7 - movq xmm6,QWORD PTR[16+r10*8+rax] - movq xmm7,QWORD PTR[24+r10*8+rax] - and r11,7 - - movq xmm0,QWORD PTR[((-96))+r12] - lea r14,QWORD PTR[256+r12] - movq xmm1,QWORD PTR[((-32))+r12] - pand xmm0,xmm4 - movq xmm2,QWORD PTR[32+r12] - pand xmm1,xmm5 - movq xmm3,QWORD PTR[96+r12] - pand xmm2,xmm6 -DB 067h - por xmm0,xmm1 - movq xmm1,QWORD PTR[((-96))+r14] -DB 067h - pand xmm3,xmm7 -DB 067h - por xmm0,xmm2 - movq xmm2,QWORD PTR[((-32))+r14] + movdqa xmm0,XMMWORD PTR[rax] + movdqa xmm1,XMMWORD PTR[16+rax] + lea r10,QWORD PTR[((88-112))+r9*1+rsp] + lea r12,QWORD PTR[128+rdx] + + pshufd xmm5,xmm5,0 + movdqa xmm4,xmm1 +DB 067h,067h + movdqa xmm2,xmm1 + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 DB 067h - pand xmm1,xmm4 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[112+r10],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[128+r10],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[144+r10],xmm2 + movdqa xmm2,xmm4 + + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[160+r10],xmm3 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[176+r10],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[192+r10],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[208+r10],xmm2 + movdqa xmm2,xmm4 + + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[224+r10],xmm3 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[240+r10],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[256+r10],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[272+r10],xmm2 + movdqa xmm2,xmm4 + + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[288+r10],xmm3 + movdqa xmm3,xmm4 + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[304+r10],xmm0 + + paddd xmm3,xmm2 DB 067h - por xmm0,xmm3 - movq xmm3,QWORD PTR[32+r14] + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[320+r10],xmm1 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[336+r10],xmm2 + pand xmm0,XMMWORD PTR[64+r12] + + pand xmm1,XMMWORD PTR[80+r12] + pand xmm2,XMMWORD PTR[96+r12] + movdqa XMMWORD PTR[352+r10],xmm3 + pand xmm3,XMMWORD PTR[112+r12] + por xmm0,xmm2 + por xmm1,xmm3 + movdqa xmm4,XMMWORD PTR[((-128))+r12] + movdqa xmm5,XMMWORD PTR[((-112))+r12] + movdqa xmm2,XMMWORD PTR[((-96))+r12] + pand xmm4,XMMWORD PTR[112+r10] + movdqa xmm3,XMMWORD PTR[((-80))+r12] + pand xmm5,XMMWORD PTR[128+r10] + por xmm0,xmm4 + pand xmm2,XMMWORD PTR[144+r10] + por xmm1,xmm5 + pand xmm3,XMMWORD PTR[160+r10] + por xmm0,xmm2 + por xmm1,xmm3 + movdqa xmm4,XMMWORD PTR[((-64))+r12] + movdqa xmm5,XMMWORD PTR[((-48))+r12] + movdqa xmm2,XMMWORD PTR[((-32))+r12] + pand xmm4,XMMWORD PTR[176+r10] + movdqa xmm3,XMMWORD PTR[((-16))+r12] + pand xmm5,XMMWORD PTR[192+r10] + por xmm0,xmm4 + pand xmm2,XMMWORD PTR[208+r10] + por xmm1,xmm5 + pand xmm3,XMMWORD PTR[224+r10] + por xmm0,xmm2 + por xmm1,xmm3 + movdqa xmm4,XMMWORD PTR[r12] + movdqa xmm5,XMMWORD PTR[16+r12] + movdqa xmm2,XMMWORD PTR[32+r12] + pand xmm4,XMMWORD PTR[240+r10] + movdqa xmm3,XMMWORD PTR[48+r12] + pand xmm5,XMMWORD PTR[256+r10] + por xmm0,xmm4 + pand xmm2,XMMWORD PTR[272+r10] + por xmm1,xmm5 + pand xmm3,XMMWORD PTR[288+r10] + por xmm0,xmm2 + por xmm1,xmm3 + por xmm0,xmm1 + pshufd xmm1,xmm0,04eh + por xmm0,xmm1 + lea r12,QWORD PTR[256+r12] DB 102,72,15,126,195 - movq xmm0,QWORD PTR[96+r14] + mov QWORD PTR[((16+8))+rsp],r13 mov QWORD PTR[((56+8))+rsp],rdi @@ -428,26 +669,10 @@ DB 102,72,15,126,195 mov r10,rax mov rax,QWORD PTR[rcx] - pand xmm2,xmm5 - pand xmm3,xmm6 - por xmm1,xmm2 - imul rbp,r10 - - - - - - - - lea r14,QWORD PTR[((64+8))+r11*8+rsp] + lea r14,QWORD PTR[((64+8))+rsp] mov r11,rdx - pand xmm0,xmm7 - por xmm1,xmm3 - lea r12,QWORD PTR[512+r12] - por xmm0,xmm1 - mul rbp add r10,rax mov rax,QWORD PTR[8+r9*1+rsi] @@ -456,7 +681,7 @@ DB 102,72,15,126,195 mul rbx add r11,rax - mov rax,QWORD PTR[16+rcx] + mov rax,QWORD PTR[8+rcx] adc rdx,0 mov r10,rdx @@ -466,7 +691,7 @@ DB 102,72,15,126,195 adc rdx,0 add rdi,r11 lea r15,QWORD PTR[32+r9] - lea rcx,QWORD PTR[64+rcx] + lea rcx,QWORD PTR[32+rcx] adc rdx,0 mov QWORD PTR[r14],rdi mov r13,rdx @@ -476,7 +701,7 @@ ALIGN 32 $L$1st4x:: mul rbx add r10,rax - mov rax,QWORD PTR[((-32))+rcx] + mov rax,QWORD PTR[((-16))+rcx] lea r14,QWORD PTR[32+r14] adc rdx,0 mov r11,rdx @@ -492,7 +717,7 @@ $L$1st4x:: mul rbx add r11,rax - mov rax,QWORD PTR[((-16))+rcx] + mov rax,QWORD PTR[((-8))+rcx] adc rdx,0 mov r10,rdx @@ -522,7 +747,7 @@ $L$1st4x:: mul rbx add r11,rax - mov rax,QWORD PTR[16+rcx] + mov rax,QWORD PTR[8+rcx] adc rdx,0 mov r10,rdx @@ -531,7 +756,7 @@ $L$1st4x:: mov rax,QWORD PTR[16+r15*1+rsi] adc rdx,0 add rdi,r11 - lea rcx,QWORD PTR[64+rcx] + lea rcx,QWORD PTR[32+rcx] adc rdx,0 mov QWORD PTR[r14],rdi mov r13,rdx @@ -541,7 +766,7 @@ $L$1st4x:: mul rbx add r10,rax - mov rax,QWORD PTR[((-32))+rcx] + mov rax,QWORD PTR[((-16))+rcx] lea r14,QWORD PTR[32+r14] adc rdx,0 mov r11,rdx @@ -557,7 +782,7 @@ $L$1st4x:: mul rbx add r11,rax - mov rax,QWORD PTR[((-16))+rcx] + mov rax,QWORD PTR[((-8))+rcx] adc rdx,0 mov r10,rdx @@ -570,8 +795,7 @@ $L$1st4x:: mov QWORD PTR[((-16))+r14],rdi mov r13,rdx -DB 102,72,15,126,195 - lea rcx,QWORD PTR[r9*2+rcx] + lea rcx,QWORD PTR[r9*1+rcx] xor rdi,rdi add r13,r10 @@ -582,6 +806,63 @@ DB 102,72,15,126,195 ALIGN 32 $L$outer4x:: + lea rdx,QWORD PTR[((16+128))+r14] + pxor xmm4,xmm4 + pxor xmm5,xmm5 + movdqa xmm0,XMMWORD PTR[((-128))+r12] + movdqa xmm1,XMMWORD PTR[((-112))+r12] + movdqa xmm2,XMMWORD PTR[((-96))+r12] + movdqa xmm3,XMMWORD PTR[((-80))+r12] + pand xmm0,XMMWORD PTR[((-128))+rdx] + pand xmm1,XMMWORD PTR[((-112))+rdx] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[((-96))+rdx] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[((-80))+rdx] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[((-64))+r12] + movdqa xmm1,XMMWORD PTR[((-48))+r12] + movdqa xmm2,XMMWORD PTR[((-32))+r12] + movdqa xmm3,XMMWORD PTR[((-16))+r12] + pand xmm0,XMMWORD PTR[((-64))+rdx] + pand xmm1,XMMWORD PTR[((-48))+rdx] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[((-32))+rdx] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[((-16))+rdx] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[r12] + movdqa xmm1,XMMWORD PTR[16+r12] + movdqa xmm2,XMMWORD PTR[32+r12] + movdqa xmm3,XMMWORD PTR[48+r12] + pand xmm0,XMMWORD PTR[rdx] + pand xmm1,XMMWORD PTR[16+rdx] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[32+rdx] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[48+rdx] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[64+r12] + movdqa xmm1,XMMWORD PTR[80+r12] + movdqa xmm2,XMMWORD PTR[96+r12] + movdqa xmm3,XMMWORD PTR[112+r12] + pand xmm0,XMMWORD PTR[64+rdx] + pand xmm1,XMMWORD PTR[80+rdx] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[96+rdx] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[112+rdx] + por xmm4,xmm2 + por xmm5,xmm3 + por xmm4,xmm5 + pshufd xmm0,xmm4,04eh + por xmm0,xmm4 + lea r12,QWORD PTR[256+r12] +DB 102,72,15,126,195 + mov r10,QWORD PTR[r9*1+r14] mov rbp,r8 mul rbx @@ -589,25 +870,11 @@ $L$outer4x:: mov rax,QWORD PTR[rcx] adc rdx,0 - movq xmm0,QWORD PTR[((-96))+r12] - movq xmm1,QWORD PTR[((-32))+r12] - pand xmm0,xmm4 - movq xmm2,QWORD PTR[32+r12] - pand xmm1,xmm5 - movq xmm3,QWORD PTR[96+r12] - imul rbp,r10 -DB 067h mov r11,rdx mov QWORD PTR[r14],rdi - pand xmm2,xmm6 - por xmm0,xmm1 - pand xmm3,xmm7 - por xmm0,xmm2 lea r14,QWORD PTR[r9*1+r14] - lea r12,QWORD PTR[256+r12] - por xmm0,xmm3 mul rbp add r10,rax @@ -617,7 +884,7 @@ DB 067h mul rbx add r11,rax - mov rax,QWORD PTR[16+rcx] + mov rax,QWORD PTR[8+rcx] adc rdx,0 add r11,QWORD PTR[8+r14] adc rdx,0 @@ -629,7 +896,7 @@ DB 067h adc rdx,0 add rdi,r11 lea r15,QWORD PTR[32+r9] - lea rcx,QWORD PTR[64+rcx] + lea rcx,QWORD PTR[32+rcx] adc rdx,0 mov r13,rdx jmp $L$inner4x @@ -638,7 +905,7 @@ ALIGN 32 $L$inner4x:: mul rbx add r10,rax - mov rax,QWORD PTR[((-32))+rcx] + mov rax,QWORD PTR[((-16))+rcx] adc rdx,0 add r10,QWORD PTR[16+r14] lea r14,QWORD PTR[32+r14] @@ -656,7 +923,7 @@ $L$inner4x:: mul rbx add r11,rax - mov rax,QWORD PTR[((-16))+rcx] + mov rax,QWORD PTR[((-8))+rcx] adc rdx,0 add r11,QWORD PTR[((-8))+r14] adc rdx,0 @@ -690,7 +957,7 @@ $L$inner4x:: mul rbx add r11,rax - mov rax,QWORD PTR[16+rcx] + mov rax,QWORD PTR[8+rcx] adc rdx,0 add r11,QWORD PTR[8+r14] adc rdx,0 @@ -701,7 +968,7 @@ $L$inner4x:: mov rax,QWORD PTR[16+r15*1+rsi] adc rdx,0 add rdi,r11 - lea rcx,QWORD PTR[64+rcx] + lea rcx,QWORD PTR[32+rcx] adc rdx,0 mov QWORD PTR[((-8))+r14],r13 mov r13,rdx @@ -711,7 +978,7 @@ $L$inner4x:: mul rbx add r10,rax - mov rax,QWORD PTR[((-32))+rcx] + mov rax,QWORD PTR[((-16))+rcx] adc rdx,0 add r10,QWORD PTR[16+r14] lea r14,QWORD PTR[32+r14] @@ -730,7 +997,7 @@ $L$inner4x:: mul rbx add r11,rax mov rax,rbp - mov rbp,QWORD PTR[((-16))+rcx] + mov rbp,QWORD PTR[((-8))+rcx] adc rdx,0 add r11,QWORD PTR[((-8))+r14] adc rdx,0 @@ -745,9 +1012,8 @@ $L$inner4x:: mov QWORD PTR[((-24))+r14],r13 mov r13,rdx -DB 102,72,15,126,195 mov QWORD PTR[((-16))+r14],rdi - lea rcx,QWORD PTR[r9*2+rcx] + lea rcx,QWORD PTR[r9*1+rcx] xor rdi,rdi add r13,r10 @@ -758,16 +1024,23 @@ DB 102,72,15,126,195 cmp r12,QWORD PTR[((16+8))+rsp] jb $L$outer4x + xor rax,rax sub rbp,r13 adc r15,r15 or rdi,r15 - xor rdi,1 + sub rax,rdi lea rbx,QWORD PTR[r9*1+r14] - lea rbp,QWORD PTR[rdi*8+rcx] + mov r12,QWORD PTR[rcx] + lea rbp,QWORD PTR[rcx] mov rcx,r9 sar rcx,3+2 mov rdi,QWORD PTR[((56+8))+rsp] - jmp $L$sqr4x_sub + dec r12 + xor r10,r10 + mov r13,QWORD PTR[8+rbp] + mov r14,QWORD PTR[16+rbp] + mov r15,QWORD PTR[24+rbp] + jmp $L$sqr4x_sub_entry mul4x_internal ENDP PUBLIC bn_power5 @@ -792,12 +1065,9 @@ $L$SEH_begin_bn_power5:: push r13 push r14 push r15 - lea rsp,QWORD PTR[((-40))+rsp] - movaps XMMWORD PTR[rsp],xmm6 - movaps XMMWORD PTR[16+rsp],xmm7 - mov r10d,r9d + shl r9d,3 - shl r10d,3+2 + lea r10d,DWORD PTR[r9*2+r9] neg r9 mov r8,QWORD PTR[r8] @@ -807,25 +1077,35 @@ $L$SEH_begin_bn_power5:: - lea r11,QWORD PTR[((-64))+r9*2+rsp] - sub r11,rsi + + lea r11,QWORD PTR[((-320))+r9*2+rsp] + sub r11,rdi and r11,4095 cmp r10,r11 jb $L$pwr_sp_alt sub rsp,r11 - lea rsp,QWORD PTR[((-64))+r9*2+rsp] + lea rsp,QWORD PTR[((-320))+r9*2+rsp] jmp $L$pwr_sp_done ALIGN 32 $L$pwr_sp_alt:: - lea r10,QWORD PTR[((4096-64))+r9*2] - lea rsp,QWORD PTR[((-64))+r9*2+rsp] + lea r10,QWORD PTR[((4096-320))+r9*2] + lea rsp,QWORD PTR[((-320))+r9*2+rsp] sub r11,r10 mov r10,0 cmovc r11,r10 sub rsp,r11 $L$pwr_sp_done:: and rsp,-64 + mov r11,rax + sub r11,rsp + and r11,-4096 +$L$pwr_page_walk:: + mov r10,QWORD PTR[r11*1+rsp] + sub r11,4096 +DB 02eh + jnc $L$pwr_page_walk + mov r10,r9 neg r9 @@ -847,10 +1127,15 @@ DB 102,73,15,110,218 DB 102,72,15,110,226 call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal DB 102,72,15,126,209 DB 102,72,15,126,226 @@ -1397,9 +1682,9 @@ DB 067h mov QWORD PTR[((-16))+rdi],rbx mov QWORD PTR[((-8))+rdi],r8 DB 102,72,15,126,213 -sqr8x_reduction:: +__bn_sqr8x_reduction:: xor rax,rax - lea rcx,QWORD PTR[r9*2+rbp] + lea rcx,QWORD PTR[rbp*1+r9] lea rdx,QWORD PTR[((48+8))+r9*2+rsp] mov QWORD PTR[((0+8))+rsp],rcx lea rdi,QWORD PTR[((48+8))+r9*1+rsp] @@ -1432,14 +1717,14 @@ DB 067h ALIGN 32 $L$8x_reduce:: mul rbx - mov rax,QWORD PTR[16+rbp] + mov rax,QWORD PTR[8+rbp] neg r8 mov r8,rdx adc r8,0 mul rbx add r9,rax - mov rax,QWORD PTR[32+rbp] + mov rax,QWORD PTR[16+rbp] adc rdx,0 add r8,r9 mov QWORD PTR[((48-8+8))+rcx*8+rsp],rbx @@ -1448,7 +1733,7 @@ $L$8x_reduce:: mul rbx add r10,rax - mov rax,QWORD PTR[48+rbp] + mov rax,QWORD PTR[24+rbp] adc rdx,0 add r9,r10 mov rsi,QWORD PTR[((32+8))+rsp] @@ -1457,7 +1742,7 @@ $L$8x_reduce:: mul rbx add r11,rax - mov rax,QWORD PTR[64+rbp] + mov rax,QWORD PTR[32+rbp] adc rdx,0 imul rsi,r8 add r10,r11 @@ -1466,7 +1751,7 @@ $L$8x_reduce:: mul rbx add r12,rax - mov rax,QWORD PTR[80+rbp] + mov rax,QWORD PTR[40+rbp] adc rdx,0 add r11,r12 mov r12,rdx @@ -1474,7 +1759,7 @@ $L$8x_reduce:: mul rbx add r13,rax - mov rax,QWORD PTR[96+rbp] + mov rax,QWORD PTR[48+rbp] adc rdx,0 add r12,r13 mov r13,rdx @@ -1482,7 +1767,7 @@ $L$8x_reduce:: mul rbx add r14,rax - mov rax,QWORD PTR[112+rbp] + mov rax,QWORD PTR[56+rbp] adc rdx,0 add r13,r14 mov r14,rdx @@ -1500,7 +1785,7 @@ $L$8x_reduce:: dec ecx jnz $L$8x_reduce - lea rbp,QWORD PTR[128+rbp] + lea rbp,QWORD PTR[64+rbp] xor rax,rax mov rdx,QWORD PTR[((8+8))+rsp] cmp rbp,QWORD PTR[((0+8))+rsp] @@ -1526,14 +1811,14 @@ ALIGN 32 $L$8x_tail:: mul rbx add r8,rax - mov rax,QWORD PTR[16+rbp] + mov rax,QWORD PTR[8+rbp] mov QWORD PTR[rdi],r8 mov r8,rdx adc r8,0 mul rbx add r9,rax - mov rax,QWORD PTR[32+rbp] + mov rax,QWORD PTR[16+rbp] adc rdx,0 add r8,r9 lea rdi,QWORD PTR[8+rdi] @@ -1542,7 +1827,7 @@ $L$8x_tail:: mul rbx add r10,rax - mov rax,QWORD PTR[48+rbp] + mov rax,QWORD PTR[24+rbp] adc rdx,0 add r9,r10 mov r10,rdx @@ -1550,7 +1835,7 @@ $L$8x_tail:: mul rbx add r11,rax - mov rax,QWORD PTR[64+rbp] + mov rax,QWORD PTR[32+rbp] adc rdx,0 add r10,r11 mov r11,rdx @@ -1558,7 +1843,7 @@ $L$8x_tail:: mul rbx add r12,rax - mov rax,QWORD PTR[80+rbp] + mov rax,QWORD PTR[40+rbp] adc rdx,0 add r11,r12 mov r12,rdx @@ -1566,7 +1851,7 @@ $L$8x_tail:: mul rbx add r13,rax - mov rax,QWORD PTR[96+rbp] + mov rax,QWORD PTR[48+rbp] adc rdx,0 add r12,r13 mov r13,rdx @@ -1574,7 +1859,7 @@ $L$8x_tail:: mul rbx add r14,rax - mov rax,QWORD PTR[112+rbp] + mov rax,QWORD PTR[56+rbp] adc rdx,0 add r13,r14 mov r14,rdx @@ -1592,7 +1877,7 @@ $L$8x_tail:: dec ecx jnz $L$8x_tail - lea rbp,QWORD PTR[128+rbp] + lea rbp,QWORD PTR[64+rbp] mov rdx,QWORD PTR[((8+8))+rsp] cmp rbp,QWORD PTR[((0+8))+rsp] jae $L$8x_tail_done @@ -1638,7 +1923,7 @@ $L$8x_no_tail:: adc r14,QWORD PTR[48+rdi] adc r15,QWORD PTR[56+rdi] adc rax,0 - mov rcx,QWORD PTR[((-16))+rbp] + mov rcx,QWORD PTR[((-8))+rbp] xor rsi,rsi DB 102,72,15,126,213 @@ -1656,44 +1941,62 @@ DB 102,73,15,126,217 cmp rdi,rdx jb $L$8x_reduction_loop + DB 0F3h,0C3h ;repret +bn_sqr8x_internal ENDP - sub rcx,r15 +ALIGN 32 +__bn_post4x_internal PROC PRIVATE + mov r12,QWORD PTR[rbp] lea rbx,QWORD PTR[r9*1+rdi] - adc rsi,rsi mov rcx,r9 - or rax,rsi DB 102,72,15,126,207 - xor rax,1 + neg rax DB 102,72,15,126,206 - lea rbp,QWORD PTR[rax*8+rbp] sar rcx,3+2 - jmp $L$sqr4x_sub + dec r12 + xor r10,r10 + mov r13,QWORD PTR[8+rbp] + mov r14,QWORD PTR[16+rbp] + mov r15,QWORD PTR[24+rbp] + jmp $L$sqr4x_sub_entry -ALIGN 32 +ALIGN 16 $L$sqr4x_sub:: -DB 066h - mov r12,QWORD PTR[rbx] - mov r13,QWORD PTR[8+rbx] - sbb r12,QWORD PTR[rbp] - mov r14,QWORD PTR[16+rbx] - sbb r13,QWORD PTR[16+rbp] - mov r15,QWORD PTR[24+rbx] - lea rbx,QWORD PTR[32+rbx] - sbb r14,QWORD PTR[32+rbp] + mov r12,QWORD PTR[rbp] + mov r13,QWORD PTR[8+rbp] + mov r14,QWORD PTR[16+rbp] + mov r15,QWORD PTR[24+rbp] +$L$sqr4x_sub_entry:: + lea rbp,QWORD PTR[32+rbp] + not r12 + not r13 + not r14 + not r15 + and r12,rax + and r13,rax + and r14,rax + and r15,rax + + neg r10 + adc r12,QWORD PTR[rbx] + adc r13,QWORD PTR[8+rbx] + adc r14,QWORD PTR[16+rbx] + adc r15,QWORD PTR[24+rbx] mov QWORD PTR[rdi],r12 - sbb r15,QWORD PTR[48+rbp] - lea rbp,QWORD PTR[64+rbp] + lea rbx,QWORD PTR[32+rbx] mov QWORD PTR[8+rdi],r13 + sbb r10,r10 mov QWORD PTR[16+rdi],r14 mov QWORD PTR[24+rdi],r15 lea rdi,QWORD PTR[32+rdi] inc rcx jnz $L$sqr4x_sub + mov r10,r9 neg r9 DB 0F3h,0C3h ;repret -bn_sqr8x_internal ENDP +__bn_post4x_internal ENDP PUBLIC bn_from_montgomery ALIGN 32 @@ -1727,13 +2030,9 @@ DB 067h push r13 push r14 push r15 - lea rsp,QWORD PTR[((-40))+rsp] - movaps XMMWORD PTR[rsp],xmm6 - movaps XMMWORD PTR[16+rsp],xmm7 -DB 067h - mov r10d,r9d + shl r9d,3 - shl r10d,3+2 + lea r10,QWORD PTR[r9*2+r9] neg r9 mov r8,QWORD PTR[r8] @@ -1743,25 +2042,35 @@ DB 067h - lea r11,QWORD PTR[((-64))+r9*2+rsp] - sub r11,rsi + + lea r11,QWORD PTR[((-320))+r9*2+rsp] + sub r11,rdi and r11,4095 cmp r10,r11 jb $L$from_sp_alt sub rsp,r11 - lea rsp,QWORD PTR[((-64))+r9*2+rsp] + lea rsp,QWORD PTR[((-320))+r9*2+rsp] jmp $L$from_sp_done ALIGN 32 $L$from_sp_alt:: - lea r10,QWORD PTR[((4096-64))+r9*2] - lea rsp,QWORD PTR[((-64))+r9*2+rsp] + lea r10,QWORD PTR[((4096-320))+r9*2] + lea rsp,QWORD PTR[((-320))+r9*2+rsp] sub r11,r10 mov r10,0 cmovc r11,r10 sub rsp,r11 $L$from_sp_done:: and rsp,-64 + mov r11,rax + sub r11,rsp + and r11,-4096 +$L$from_page_walk:: + mov r10,QWORD PTR[r11*1+rsp] + sub r11,4096 +DB 02eh + jnc $L$from_page_walk + mov r10,r9 neg r9 @@ -1806,7 +2115,8 @@ DB 102,72,15,110,209 DB 067h mov rbp,rcx DB 102,73,15,110,218 - call sqr8x_reduction + call __bn_sqr8x_reduction + call __bn_post4x_internal pxor xmm0,xmm0 lea rax,QWORD PTR[48+rsp] @@ -1876,55 +2186,171 @@ bn_scatter5 ENDP PUBLIC bn_gather5 -ALIGN 16 +ALIGN 32 bn_gather5 PROC PUBLIC $L$SEH_begin_bn_gather5:: -DB 048h,083h,0ech,028h -DB 00fh,029h,034h,024h -DB 00fh,029h,07ch,024h,010h - mov r11d,r9d - shr r9d,3 - and r11,7 - not r9d - lea rax,QWORD PTR[$L$magic_masks] - and r9d,3 - lea r8,QWORD PTR[128+r11*8+r8] - movq xmm4,QWORD PTR[r9*8+rax] - movq xmm5,QWORD PTR[8+r9*8+rax] - movq xmm6,QWORD PTR[16+r9*8+rax] - movq xmm7,QWORD PTR[24+r9*8+rax] +DB 04ch,08dh,014h,024h +DB 048h,081h,0ech,008h,001h,000h,000h + lea rax,QWORD PTR[$L$inc] + and rsp,-16 + + movd xmm5,r9d + movdqa xmm0,XMMWORD PTR[rax] + movdqa xmm1,XMMWORD PTR[16+rax] + lea r11,QWORD PTR[128+r8] + lea rax,QWORD PTR[128+rsp] + + pshufd xmm5,xmm5,0 + movdqa xmm4,xmm1 + movdqa xmm2,xmm1 + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa xmm3,xmm4 + + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[(-128)+rax],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[(-112)+rax],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[(-96)+rax],xmm2 + movdqa xmm2,xmm4 + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[(-80)+rax],xmm3 + movdqa xmm3,xmm4 + + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[(-64)+rax],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[(-48)+rax],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[(-32)+rax],xmm2 + movdqa xmm2,xmm4 + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[(-16)+rax],xmm3 + movdqa xmm3,xmm4 + + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[rax],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[16+rax],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[32+rax],xmm2 + movdqa xmm2,xmm4 + paddd xmm1,xmm0 + pcmpeqd xmm0,xmm5 + movdqa XMMWORD PTR[48+rax],xmm3 + movdqa xmm3,xmm4 + + paddd xmm2,xmm1 + pcmpeqd xmm1,xmm5 + movdqa XMMWORD PTR[64+rax],xmm0 + movdqa xmm0,xmm4 + + paddd xmm3,xmm2 + pcmpeqd xmm2,xmm5 + movdqa XMMWORD PTR[80+rax],xmm1 + movdqa xmm1,xmm4 + + paddd xmm0,xmm3 + pcmpeqd xmm3,xmm5 + movdqa XMMWORD PTR[96+rax],xmm2 + movdqa xmm2,xmm4 + movdqa XMMWORD PTR[112+rax],xmm3 jmp $L$gather -ALIGN 16 -$L$gather:: - movq xmm0,QWORD PTR[((-128))+r8] - movq xmm1,QWORD PTR[((-64))+r8] - pand xmm0,xmm4 - movq xmm2,QWORD PTR[r8] - pand xmm1,xmm5 - movq xmm3,QWORD PTR[64+r8] - pand xmm2,xmm6 - por xmm0,xmm1 - pand xmm3,xmm7 -DB 067h,067h - por xmm0,xmm2 - lea r8,QWORD PTR[256+r8] - por xmm0,xmm3 +ALIGN 32 +$L$gather:: + pxor xmm4,xmm4 + pxor xmm5,xmm5 + movdqa xmm0,XMMWORD PTR[((-128))+r11] + movdqa xmm1,XMMWORD PTR[((-112))+r11] + movdqa xmm2,XMMWORD PTR[((-96))+r11] + pand xmm0,XMMWORD PTR[((-128))+rax] + movdqa xmm3,XMMWORD PTR[((-80))+r11] + pand xmm1,XMMWORD PTR[((-112))+rax] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[((-96))+rax] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[((-80))+rax] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[((-64))+r11] + movdqa xmm1,XMMWORD PTR[((-48))+r11] + movdqa xmm2,XMMWORD PTR[((-32))+r11] + pand xmm0,XMMWORD PTR[((-64))+rax] + movdqa xmm3,XMMWORD PTR[((-16))+r11] + pand xmm1,XMMWORD PTR[((-48))+rax] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[((-32))+rax] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[((-16))+rax] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[r11] + movdqa xmm1,XMMWORD PTR[16+r11] + movdqa xmm2,XMMWORD PTR[32+r11] + pand xmm0,XMMWORD PTR[rax] + movdqa xmm3,XMMWORD PTR[48+r11] + pand xmm1,XMMWORD PTR[16+rax] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[32+rax] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[48+rax] + por xmm4,xmm2 + por xmm5,xmm3 + movdqa xmm0,XMMWORD PTR[64+r11] + movdqa xmm1,XMMWORD PTR[80+r11] + movdqa xmm2,XMMWORD PTR[96+r11] + pand xmm0,XMMWORD PTR[64+rax] + movdqa xmm3,XMMWORD PTR[112+r11] + pand xmm1,XMMWORD PTR[80+rax] + por xmm4,xmm0 + pand xmm2,XMMWORD PTR[96+rax] + por xmm5,xmm1 + pand xmm3,XMMWORD PTR[112+rax] + por xmm4,xmm2 + por xmm5,xmm3 + por xmm4,xmm5 + lea r11,QWORD PTR[256+r11] + pshufd xmm0,xmm4,04eh + por xmm0,xmm4 movq QWORD PTR[rcx],xmm0 lea rcx,QWORD PTR[8+rcx] sub edx,1 jnz $L$gather - movaps xmm6,XMMWORD PTR[rsp] - movaps xmm7,XMMWORD PTR[16+rsp] - lea rsp,QWORD PTR[40+rsp] + + lea rsp,QWORD PTR[r10] DB 0F3h,0C3h ;repret $L$SEH_end_bn_gather5:: bn_gather5 ENDP ALIGN 64 -$L$magic_masks:: - DD 0,0,0,0,0,0,-1,-1 - DD 0,0,0,0,0,0,0,0 +$L$inc:: + DD 0,0,1,1 + DD 2,2,2,2 DB 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105 DB 112,108,105,99,97,116,105,111,110,32,119,105,116,104,32,115 DB 99,97,116,116,101,114,47,103,97,116,104,101,114,32,102,111 @@ -1966,19 +2392,16 @@ mul_handler PROC PRIVATE lea r10,QWORD PTR[$L$mul_epilogue] cmp rbx,r10 - jb $L$body_40 + ja $L$body_40 mov r10,QWORD PTR[192+r8] mov rax,QWORD PTR[8+r10*8+rax] + jmp $L$body_proceed $L$body_40:: mov rax,QWORD PTR[40+rax] $L$body_proceed:: - - movaps xmm0,XMMWORD PTR[((-88))+rax] - movaps xmm1,XMMWORD PTR[((-72))+rax] - mov rbx,QWORD PTR[((-8))+rax] mov rbp,QWORD PTR[((-16))+rax] mov r12,QWORD PTR[((-24))+rax] @@ -1991,8 +2414,6 @@ $L$body_proceed:: mov QWORD PTR[224+r8],r13 mov QWORD PTR[232+r8],r14 mov QWORD PTR[240+r8],r15 - movups XMMWORD PTR[512+r8],xmm0 - movups XMMWORD PTR[528+r8],xmm1 $L$common_seh_tail:: mov rdi,QWORD PTR[8+rax] @@ -2080,10 +2501,9 @@ DB 9,0,0,0 DD imagerel $L$from_body,imagerel $L$from_epilogue ALIGN 8 $L$SEH_info_bn_gather5:: -DB 001h,00dh,005h,000h -DB 00dh,078h,001h,000h -DB 008h,068h,000h,000h -DB 004h,042h,000h,000h +DB 001h,00bh,003h,00ah +DB 00bh,001h,021h,000h +DB 004h,0a3h,000h,000h ALIGN 8 .xdata ENDS diff --git a/vendor/openssl/asm_obsolete/x64-win32-masm/ec/ecp_nistz256-x86_64.asm b/vendor/openssl/asm_obsolete/x64-win32-masm/ec/ecp_nistz256-x86_64.asm index ef9b22fbf..ca78bd52c 100644 --- a/vendor/openssl/asm_obsolete/x64-win32-masm/ec/ecp_nistz256-x86_64.asm +++ b/vendor/openssl/asm_obsolete/x64-win32-masm/ec/ecp_nistz256-x86_64.asm @@ -1303,6 +1303,7 @@ $L$SEH_begin_ecp_nistz256_point_double:: push r15 sub rsp,32*5+8 +$L$point_double_shortcutq:: movdqu xmm0,XMMWORD PTR[rsi] mov rbx,rsi movdqu xmm1,XMMWORD PTR[16+rsi] @@ -1577,6 +1578,7 @@ DB 102,72,15,110,199 mov r14,QWORD PTR[((64+8))+rbx] mov r15,QWORD PTR[((64+16))+rbx] mov r8,QWORD PTR[((64+24))+rbx] +DB 102,72,15,110,203 lea rsi,QWORD PTR[((64-0))+rbx] lea rdi,QWORD PTR[32+rsp] @@ -1668,7 +1670,7 @@ DB 102,73,15,126,217 test r8,r8 jnz $L$add_proceedq test r9,r9 - jz $L$add_proceedq + jz $L$add_doubleq DB 102,72,15,126,199 pxor xmm0,xmm0 @@ -1680,6 +1682,13 @@ DB 102,72,15,126,199 movdqu XMMWORD PTR[80+rdi],xmm0 jmp $L$add_doneq +ALIGN 32 +$L$add_doubleq:: +DB 102,72,15,126,206 +DB 102,72,15,126,199 + add rsp,416 + jmp $L$point_double_shortcutq + ALIGN 32 $L$add_proceedq:: mov rax,QWORD PTR[((0+64))+rsp] diff --git a/vendor/openssl/asm_obsolete/x86-elf-gas/bn/x86-mont.s b/vendor/openssl/asm_obsolete/x86-elf-gas/bn/x86-mont.s index 1d815a047..2f7211d92 100644 --- a/vendor/openssl/asm_obsolete/x86-elf-gas/bn/x86-mont.s +++ b/vendor/openssl/asm_obsolete/x86-elf-gas/bn/x86-mont.s @@ -29,6 +29,14 @@ bn_mul_mont: xorl $2048,%edx subl %edx,%esp andl $-64,%esp + movl %ebp,%eax + subl %esp,%eax + andl $-4096,%eax +.L001page_walk: + movl (%esp,%eax,1),%edx + subl $4096,%eax +.byte 46 + jnc .L001page_walk movl (%esi),%eax movl 4(%esi),%ebx movl 8(%esi),%ecx @@ -44,7 +52,7 @@ bn_mul_mont: movl %ebp,24(%esp) leal OPENSSL_ia32cap_P,%eax btl $26,(%eax) - jnc .L001non_sse2 + jnc .L002non_sse2 movl $-1,%eax movd %eax,%mm7 movl 8(%esp),%esi @@ -68,7 +76,7 @@ bn_mul_mont: psrlq $32,%mm3 incl %ecx .align 16 -.L0021st: +.L0031st: pmuludq %mm4,%mm0 pmuludq %mm5,%mm1 paddq %mm0,%mm2 @@ -83,7 +91,7 @@ bn_mul_mont: psrlq $32,%mm3 leal 1(%ecx),%ecx cmpl %ebx,%ecx - jl .L0021st + jl .L0031st pmuludq %mm4,%mm0 pmuludq %mm5,%mm1 paddq %mm0,%mm2 @@ -97,7 +105,7 @@ bn_mul_mont: paddq %mm2,%mm3 movq %mm3,32(%esp,%ebx,4) incl %edx -.L003outer: +.L004outer: xorl %ecx,%ecx movd (%edi,%edx,4),%mm4 movd (%esi),%mm5 @@ -119,7 +127,7 @@ bn_mul_mont: paddq %mm6,%mm2 incl %ecx decl %ebx -.L004inner: +.L005inner: pmuludq %mm4,%mm0 pmuludq %mm5,%mm1 paddq %mm0,%mm2 @@ -136,7 +144,7 @@ bn_mul_mont: paddq %mm6,%mm2 decl %ebx leal 1(%ecx),%ecx - jnz .L004inner + jnz .L005inner movl %ecx,%ebx pmuludq %mm4,%mm0 pmuludq %mm5,%mm1 @@ -154,11 +162,11 @@ bn_mul_mont: movq %mm3,32(%esp,%ebx,4) leal 1(%edx),%edx cmpl %ebx,%edx - jle .L003outer + jle .L004outer emms - jmp .L005common_tail + jmp .L006common_tail .align 16 -.L001non_sse2: +.L002non_sse2: movl 8(%esp),%esi leal 1(%ebx),%ebp movl 12(%esp),%edi @@ -169,12 +177,12 @@ bn_mul_mont: leal 4(%edi,%ebx,4),%eax orl %edx,%ebp movl (%edi),%edi - jz .L006bn_sqr_mont + jz .L007bn_sqr_mont movl %eax,28(%esp) movl (%esi),%eax xorl %edx,%edx .align 16 -.L007mull: +.L008mull: movl %edx,%ebp mull %edi addl %eax,%ebp @@ -183,7 +191,7 @@ bn_mul_mont: movl (%esi,%ecx,4),%eax cmpl %ebx,%ecx movl %ebp,28(%esp,%ecx,4) - jl .L007mull + jl .L008mull movl %edx,%ebp mull %edi movl 20(%esp),%edi @@ -201,9 +209,9 @@ bn_mul_mont: movl 4(%esi),%eax adcl $0,%edx incl %ecx - jmp .L0082ndmadd + jmp .L0092ndmadd .align 16 -.L0091stmadd: +.L0101stmadd: movl %edx,%ebp mull %edi addl 32(%esp,%ecx,4),%ebp @@ -214,7 +222,7 @@ bn_mul_mont: adcl $0,%edx cmpl %ebx,%ecx movl %ebp,28(%esp,%ecx,4) - jl .L0091stmadd + jl .L0101stmadd movl %edx,%ebp mull %edi addl 32(%esp,%ebx,4),%eax @@ -237,7 +245,7 @@ bn_mul_mont: adcl $0,%edx movl $1,%ecx .align 16 -.L0082ndmadd: +.L0092ndmadd: movl %edx,%ebp mull %edi addl 32(%esp,%ecx,4),%ebp @@ -248,7 +256,7 @@ bn_mul_mont: adcl $0,%edx cmpl %ebx,%ecx movl %ebp,24(%esp,%ecx,4) - jl .L0082ndmadd + jl .L0092ndmadd movl %edx,%ebp mull %edi addl 32(%esp,%ebx,4),%ebp @@ -264,16 +272,16 @@ bn_mul_mont: movl %edx,32(%esp,%ebx,4) cmpl 28(%esp),%ecx movl %eax,36(%esp,%ebx,4) - je .L005common_tail + je .L006common_tail movl (%ecx),%edi movl 8(%esp),%esi movl %ecx,12(%esp) xorl %ecx,%ecx xorl %edx,%edx movl (%esi),%eax - jmp .L0091stmadd + jmp .L0101stmadd .align 16 -.L006bn_sqr_mont: +.L007bn_sqr_mont: movl %ebx,(%esp) movl %ecx,12(%esp) movl %edi,%eax @@ -284,7 +292,7 @@ bn_mul_mont: andl $1,%ebx incl %ecx .align 16 -.L010sqr: +.L011sqr: movl (%esi,%ecx,4),%eax movl %edx,%ebp mull %edi @@ -296,7 +304,7 @@ bn_mul_mont: cmpl (%esp),%ecx movl %eax,%ebx movl %ebp,28(%esp,%ecx,4) - jl .L010sqr + jl .L011sqr movl (%esi,%ecx,4),%eax movl %edx,%ebp mull %edi @@ -320,7 +328,7 @@ bn_mul_mont: movl 4(%esi),%eax movl $1,%ecx .align 16 -.L0113rdmadd: +.L0123rdmadd: movl %edx,%ebp mull %edi addl 32(%esp,%ecx,4),%ebp @@ -339,7 +347,7 @@ bn_mul_mont: adcl $0,%edx cmpl %ebx,%ecx movl %ebp,24(%esp,%ecx,4) - jl .L0113rdmadd + jl .L0123rdmadd movl %edx,%ebp mull %edi addl 32(%esp,%ebx,4),%ebp @@ -355,7 +363,7 @@ bn_mul_mont: movl %edx,32(%esp,%ebx,4) cmpl %ebx,%ecx movl %eax,36(%esp,%ebx,4) - je .L005common_tail + je .L006common_tail movl 4(%esi,%ecx,4),%edi leal 1(%ecx),%ecx movl %edi,%eax @@ -367,12 +375,12 @@ bn_mul_mont: xorl %ebp,%ebp cmpl %ebx,%ecx leal 1(%ecx),%ecx - je .L012sqrlast + je .L013sqrlast movl %edx,%ebx shrl $1,%edx andl $1,%ebx .align 16 -.L013sqradd: +.L014sqradd: movl (%esi,%ecx,4),%eax movl %edx,%ebp mull %edi @@ -388,13 +396,13 @@ bn_mul_mont: cmpl (%esp),%ecx movl %ebp,28(%esp,%ecx,4) movl %eax,%ebx - jle .L013sqradd + jle .L014sqradd movl %edx,%ebp addl %edx,%edx shrl $31,%ebp addl %ebx,%edx adcl $0,%ebp -.L012sqrlast: +.L013sqrlast: movl 20(%esp),%edi movl 16(%esp),%esi imull 32(%esp),%edi @@ -409,9 +417,9 @@ bn_mul_mont: adcl $0,%edx movl $1,%ecx movl 4(%esi),%eax - jmp .L0113rdmadd + jmp .L0123rdmadd .align 16 -.L005common_tail: +.L006common_tail: movl 16(%esp),%ebp movl 4(%esp),%edi leal 32(%esp),%esi @@ -419,13 +427,13 @@ bn_mul_mont: movl %ebx,%ecx xorl %edx,%edx .align 16 -.L014sub: +.L015sub: sbbl (%ebp,%edx,4),%eax movl %eax,(%edi,%edx,4) decl %ecx movl 4(%esi,%edx,4),%eax leal 1(%edx),%edx - jge .L014sub + jge .L015sub sbbl $0,%eax andl %eax,%esi notl %eax @@ -433,12 +441,12 @@ bn_mul_mont: andl %eax,%ebp orl %ebp,%esi .align 16 -.L015copy: +.L016copy: movl (%esi,%ebx,4),%eax movl %eax,(%edi,%ebx,4) movl %ecx,32(%esp,%ebx,4) decl %ebx - jge .L015copy + jge .L016copy movl 24(%esp),%esp movl $1,%eax .L000just_leave: diff --git a/vendor/openssl/asm_obsolete/x86-macosx-gas/bn/x86-mont.s b/vendor/openssl/asm_obsolete/x86-macosx-gas/bn/x86-mont.s index b544a46c6..accec0e51 100644 --- a/vendor/openssl/asm_obsolete/x86-macosx-gas/bn/x86-mont.s +++ b/vendor/openssl/asm_obsolete/x86-macosx-gas/bn/x86-mont.s @@ -28,6 +28,14 @@ L_bn_mul_mont_begin: xorl $2048,%edx subl %edx,%esp andl $-64,%esp + movl %ebp,%eax + subl %esp,%eax + andl $-4096,%eax +L001page_walk: + movl (%esp,%eax,1),%edx + subl $4096,%eax +.byte 46 + jnc L001page_walk movl (%esi),%eax movl 4(%esi),%ebx movl 8(%esi),%ecx @@ -41,12 +49,12 @@ L_bn_mul_mont_begin: movl %esi,20(%esp) leal -3(%edi),%ebx movl %ebp,24(%esp) - call L001PIC_me_up -L001PIC_me_up: + call L002PIC_me_up +L002PIC_me_up: popl %eax - movl L_OPENSSL_ia32cap_P$non_lazy_ptr-L001PIC_me_up(%eax),%eax + movl L_OPENSSL_ia32cap_P$non_lazy_ptr-L002PIC_me_up(%eax),%eax btl $26,(%eax) - jnc L002non_sse2 + jnc L003non_sse2 movl $-1,%eax movd %eax,%mm7 movl 8(%esp),%esi @@ -70,7 +78,7 @@ L001PIC_me_up: psrlq $32,%mm3 incl %ecx .align 4,0x90 -L0031st: +L0041st: pmuludq %mm4,%mm0 pmuludq %mm5,%mm1 paddq %mm0,%mm2 @@ -85,7 +93,7 @@ L0031st: psrlq $32,%mm3 leal 1(%ecx),%ecx cmpl %ebx,%ecx - jl L0031st + jl L0041st pmuludq %mm4,%mm0 pmuludq %mm5,%mm1 paddq %mm0,%mm2 @@ -99,7 +107,7 @@ L0031st: paddq %mm2,%mm3 movq %mm3,32(%esp,%ebx,4) incl %edx -L004outer: +L005outer: xorl %ecx,%ecx movd (%edi,%edx,4),%mm4 movd (%esi),%mm5 @@ -121,7 +129,7 @@ L004outer: paddq %mm6,%mm2 incl %ecx decl %ebx -L005inner: +L006inner: pmuludq %mm4,%mm0 pmuludq %mm5,%mm1 paddq %mm0,%mm2 @@ -138,7 +146,7 @@ L005inner: paddq %mm6,%mm2 decl %ebx leal 1(%ecx),%ecx - jnz L005inner + jnz L006inner movl %ecx,%ebx pmuludq %mm4,%mm0 pmuludq %mm5,%mm1 @@ -156,11 +164,11 @@ L005inner: movq %mm3,32(%esp,%ebx,4) leal 1(%edx),%edx cmpl %ebx,%edx - jle L004outer + jle L005outer emms - jmp L006common_tail + jmp L007common_tail .align 4,0x90 -L002non_sse2: +L003non_sse2: movl 8(%esp),%esi leal 1(%ebx),%ebp movl 12(%esp),%edi @@ -171,12 +179,12 @@ L002non_sse2: leal 4(%edi,%ebx,4),%eax orl %edx,%ebp movl (%edi),%edi - jz L007bn_sqr_mont + jz L008bn_sqr_mont movl %eax,28(%esp) movl (%esi),%eax xorl %edx,%edx .align 4,0x90 -L008mull: +L009mull: movl %edx,%ebp mull %edi addl %eax,%ebp @@ -185,7 +193,7 @@ L008mull: movl (%esi,%ecx,4),%eax cmpl %ebx,%ecx movl %ebp,28(%esp,%ecx,4) - jl L008mull + jl L009mull movl %edx,%ebp mull %edi movl 20(%esp),%edi @@ -203,9 +211,9 @@ L008mull: movl 4(%esi),%eax adcl $0,%edx incl %ecx - jmp L0092ndmadd + jmp L0102ndmadd .align 4,0x90 -L0101stmadd: +L0111stmadd: movl %edx,%ebp mull %edi addl 32(%esp,%ecx,4),%ebp @@ -216,7 +224,7 @@ L0101stmadd: adcl $0,%edx cmpl %ebx,%ecx movl %ebp,28(%esp,%ecx,4) - jl L0101stmadd + jl L0111stmadd movl %edx,%ebp mull %edi addl 32(%esp,%ebx,4),%eax @@ -239,7 +247,7 @@ L0101stmadd: adcl $0,%edx movl $1,%ecx .align 4,0x90 -L0092ndmadd: +L0102ndmadd: movl %edx,%ebp mull %edi addl 32(%esp,%ecx,4),%ebp @@ -250,7 +258,7 @@ L0092ndmadd: adcl $0,%edx cmpl %ebx,%ecx movl %ebp,24(%esp,%ecx,4) - jl L0092ndmadd + jl L0102ndmadd movl %edx,%ebp mull %edi addl 32(%esp,%ebx,4),%ebp @@ -266,16 +274,16 @@ L0092ndmadd: movl %edx,32(%esp,%ebx,4) cmpl 28(%esp),%ecx movl %eax,36(%esp,%ebx,4) - je L006common_tail + je L007common_tail movl (%ecx),%edi movl 8(%esp),%esi movl %ecx,12(%esp) xorl %ecx,%ecx xorl %edx,%edx movl (%esi),%eax - jmp L0101stmadd + jmp L0111stmadd .align 4,0x90 -L007bn_sqr_mont: +L008bn_sqr_mont: movl %ebx,(%esp) movl %ecx,12(%esp) movl %edi,%eax @@ -286,7 +294,7 @@ L007bn_sqr_mont: andl $1,%ebx incl %ecx .align 4,0x90 -L011sqr: +L012sqr: movl (%esi,%ecx,4),%eax movl %edx,%ebp mull %edi @@ -298,7 +306,7 @@ L011sqr: cmpl (%esp),%ecx movl %eax,%ebx movl %ebp,28(%esp,%ecx,4) - jl L011sqr + jl L012sqr movl (%esi,%ecx,4),%eax movl %edx,%ebp mull %edi @@ -322,7 +330,7 @@ L011sqr: movl 4(%esi),%eax movl $1,%ecx .align 4,0x90 -L0123rdmadd: +L0133rdmadd: movl %edx,%ebp mull %edi addl 32(%esp,%ecx,4),%ebp @@ -341,7 +349,7 @@ L0123rdmadd: adcl $0,%edx cmpl %ebx,%ecx movl %ebp,24(%esp,%ecx,4) - jl L0123rdmadd + jl L0133rdmadd movl %edx,%ebp mull %edi addl 32(%esp,%ebx,4),%ebp @@ -357,7 +365,7 @@ L0123rdmadd: movl %edx,32(%esp,%ebx,4) cmpl %ebx,%ecx movl %eax,36(%esp,%ebx,4) - je L006common_tail + je L007common_tail movl 4(%esi,%ecx,4),%edi leal 1(%ecx),%ecx movl %edi,%eax @@ -369,12 +377,12 @@ L0123rdmadd: xorl %ebp,%ebp cmpl %ebx,%ecx leal 1(%ecx),%ecx - je L013sqrlast + je L014sqrlast movl %edx,%ebx shrl $1,%edx andl $1,%ebx .align 4,0x90 -L014sqradd: +L015sqradd: movl (%esi,%ecx,4),%eax movl %edx,%ebp mull %edi @@ -390,13 +398,13 @@ L014sqradd: cmpl (%esp),%ecx movl %ebp,28(%esp,%ecx,4) movl %eax,%ebx - jle L014sqradd + jle L015sqradd movl %edx,%ebp addl %edx,%edx shrl $31,%ebp addl %ebx,%edx adcl $0,%ebp -L013sqrlast: +L014sqrlast: movl 20(%esp),%edi movl 16(%esp),%esi imull 32(%esp),%edi @@ -411,9 +419,9 @@ L013sqrlast: adcl $0,%edx movl $1,%ecx movl 4(%esi),%eax - jmp L0123rdmadd + jmp L0133rdmadd .align 4,0x90 -L006common_tail: +L007common_tail: movl 16(%esp),%ebp movl 4(%esp),%edi leal 32(%esp),%esi @@ -421,13 +429,13 @@ L006common_tail: movl %ebx,%ecx xorl %edx,%edx .align 4,0x90 -L015sub: +L016sub: sbbl (%ebp,%edx,4),%eax movl %eax,(%edi,%edx,4) decl %ecx movl 4(%esi,%edx,4),%eax leal 1(%edx),%edx - jge L015sub + jge L016sub sbbl $0,%eax andl %eax,%esi notl %eax @@ -435,12 +443,12 @@ L015sub: andl %eax,%ebp orl %ebp,%esi .align 4,0x90 -L016copy: +L017copy: movl (%esi,%ebx,4),%eax movl %eax,(%edi,%ebx,4) movl %ecx,32(%esp,%ebx,4) decl %ebx - jge L016copy + jge L017copy movl 24(%esp),%esp movl $1,%eax L000just_leave: diff --git a/vendor/openssl/asm_obsolete/x86-win32-masm/bn/x86-mont.asm b/vendor/openssl/asm_obsolete/x86-win32-masm/bn/x86-mont.asm index 9bfa4dc8e..4987f6fe9 100644 --- a/vendor/openssl/asm_obsolete/x86-win32-masm/bn/x86-mont.asm +++ b/vendor/openssl/asm_obsolete/x86-win32-masm/bn/x86-mont.asm @@ -45,6 +45,14 @@ $L_bn_mul_mont_begin:: xor edx,2048 sub esp,edx and esp,-64 + mov eax,ebp + sub eax,esp + and eax,-4096 +$L001page_walk: + mov edx,DWORD PTR [eax*1+esp] + sub eax,4096 +DB 46 + jnc $L001page_walk mov eax,DWORD PTR [esi] mov ebx,DWORD PTR 4[esi] mov ecx,DWORD PTR 8[esi] @@ -60,7 +68,7 @@ $L_bn_mul_mont_begin:: mov DWORD PTR 24[esp],ebp lea eax,DWORD PTR _OPENSSL_ia32cap_P bt DWORD PTR [eax],26 - jnc $L001non_sse2 + jnc $L002non_sse2 mov eax,-1 movd mm7,eax mov esi,DWORD PTR 8[esp] @@ -84,7 +92,7 @@ $L_bn_mul_mont_begin:: psrlq mm3,32 inc ecx ALIGN 16 -$L0021st: +$L0031st: pmuludq mm0,mm4 pmuludq mm1,mm5 paddq mm2,mm0 @@ -99,7 +107,7 @@ $L0021st: psrlq mm3,32 lea ecx,DWORD PTR 1[ecx] cmp ecx,ebx - jl $L0021st + jl $L0031st pmuludq mm0,mm4 pmuludq mm1,mm5 paddq mm2,mm0 @@ -113,7 +121,7 @@ $L0021st: paddq mm3,mm2 movq QWORD PTR 32[ebx*4+esp],mm3 inc edx -$L003outer: +$L004outer: xor ecx,ecx movd mm4,DWORD PTR [edx*4+edi] movd mm5,DWORD PTR [esi] @@ -135,7 +143,7 @@ $L003outer: paddq mm2,mm6 inc ecx dec ebx -$L004inner: +$L005inner: pmuludq mm0,mm4 pmuludq mm1,mm5 paddq mm2,mm0 @@ -152,7 +160,7 @@ $L004inner: paddq mm2,mm6 dec ebx lea ecx,DWORD PTR 1[ecx] - jnz $L004inner + jnz $L005inner mov ebx,ecx pmuludq mm0,mm4 pmuludq mm1,mm5 @@ -170,11 +178,11 @@ $L004inner: movq QWORD PTR 32[ebx*4+esp],mm3 lea edx,DWORD PTR 1[edx] cmp edx,ebx - jle $L003outer + jle $L004outer emms - jmp $L005common_tail + jmp $L006common_tail ALIGN 16 -$L001non_sse2: +$L002non_sse2: mov esi,DWORD PTR 8[esp] lea ebp,DWORD PTR 1[ebx] mov edi,DWORD PTR 12[esp] @@ -185,12 +193,12 @@ $L001non_sse2: lea eax,DWORD PTR 4[ebx*4+edi] or ebp,edx mov edi,DWORD PTR [edi] - jz $L006bn_sqr_mont + jz $L007bn_sqr_mont mov DWORD PTR 28[esp],eax mov eax,DWORD PTR [esi] xor edx,edx ALIGN 16 -$L007mull: +$L008mull: mov ebp,edx mul edi add ebp,eax @@ -199,7 +207,7 @@ $L007mull: mov eax,DWORD PTR [ecx*4+esi] cmp ecx,ebx mov DWORD PTR 28[ecx*4+esp],ebp - jl $L007mull + jl $L008mull mov ebp,edx mul edi mov edi,DWORD PTR 20[esp] @@ -217,9 +225,9 @@ $L007mull: mov eax,DWORD PTR 4[esi] adc edx,0 inc ecx - jmp $L0082ndmadd + jmp $L0092ndmadd ALIGN 16 -$L0091stmadd: +$L0101stmadd: mov ebp,edx mul edi add ebp,DWORD PTR 32[ecx*4+esp] @@ -230,7 +238,7 @@ $L0091stmadd: adc edx,0 cmp ecx,ebx mov DWORD PTR 28[ecx*4+esp],ebp - jl $L0091stmadd + jl $L0101stmadd mov ebp,edx mul edi add eax,DWORD PTR 32[ebx*4+esp] @@ -253,7 +261,7 @@ $L0091stmadd: adc edx,0 mov ecx,1 ALIGN 16 -$L0082ndmadd: +$L0092ndmadd: mov ebp,edx mul edi add ebp,DWORD PTR 32[ecx*4+esp] @@ -264,7 +272,7 @@ $L0082ndmadd: adc edx,0 cmp ecx,ebx mov DWORD PTR 24[ecx*4+esp],ebp - jl $L0082ndmadd + jl $L0092ndmadd mov ebp,edx mul edi add ebp,DWORD PTR 32[ebx*4+esp] @@ -280,16 +288,16 @@ $L0082ndmadd: mov DWORD PTR 32[ebx*4+esp],edx cmp ecx,DWORD PTR 28[esp] mov DWORD PTR 36[ebx*4+esp],eax - je $L005common_tail + je $L006common_tail mov edi,DWORD PTR [ecx] mov esi,DWORD PTR 8[esp] mov DWORD PTR 12[esp],ecx xor ecx,ecx xor edx,edx mov eax,DWORD PTR [esi] - jmp $L0091stmadd + jmp $L0101stmadd ALIGN 16 -$L006bn_sqr_mont: +$L007bn_sqr_mont: mov DWORD PTR [esp],ebx mov DWORD PTR 12[esp],ecx mov eax,edi @@ -300,7 +308,7 @@ $L006bn_sqr_mont: and ebx,1 inc ecx ALIGN 16 -$L010sqr: +$L011sqr: mov eax,DWORD PTR [ecx*4+esi] mov ebp,edx mul edi @@ -312,7 +320,7 @@ $L010sqr: cmp ecx,DWORD PTR [esp] mov ebx,eax mov DWORD PTR 28[ecx*4+esp],ebp - jl $L010sqr + jl $L011sqr mov eax,DWORD PTR [ecx*4+esi] mov ebp,edx mul edi @@ -336,7 +344,7 @@ $L010sqr: mov eax,DWORD PTR 4[esi] mov ecx,1 ALIGN 16 -$L0113rdmadd: +$L0123rdmadd: mov ebp,edx mul edi add ebp,DWORD PTR 32[ecx*4+esp] @@ -355,7 +363,7 @@ $L0113rdmadd: adc edx,0 cmp ecx,ebx mov DWORD PTR 24[ecx*4+esp],ebp - jl $L0113rdmadd + jl $L0123rdmadd mov ebp,edx mul edi add ebp,DWORD PTR 32[ebx*4+esp] @@ -371,7 +379,7 @@ $L0113rdmadd: mov DWORD PTR 32[ebx*4+esp],edx cmp ecx,ebx mov DWORD PTR 36[ebx*4+esp],eax - je $L005common_tail + je $L006common_tail mov edi,DWORD PTR 4[ecx*4+esi] lea ecx,DWORD PTR 1[ecx] mov eax,edi @@ -383,12 +391,12 @@ $L0113rdmadd: xor ebp,ebp cmp ecx,ebx lea ecx,DWORD PTR 1[ecx] - je $L012sqrlast + je $L013sqrlast mov ebx,edx shr edx,1 and ebx,1 ALIGN 16 -$L013sqradd: +$L014sqradd: mov eax,DWORD PTR [ecx*4+esi] mov ebp,edx mul edi @@ -404,13 +412,13 @@ $L013sqradd: cmp ecx,DWORD PTR [esp] mov DWORD PTR 28[ecx*4+esp],ebp mov ebx,eax - jle $L013sqradd + jle $L014sqradd mov ebp,edx add edx,edx shr ebp,31 add edx,ebx adc ebp,0 -$L012sqrlast: +$L013sqrlast: mov edi,DWORD PTR 20[esp] mov esi,DWORD PTR 16[esp] imul edi,DWORD PTR 32[esp] @@ -425,9 +433,9 @@ $L012sqrlast: adc edx,0 mov ecx,1 mov eax,DWORD PTR 4[esi] - jmp $L0113rdmadd + jmp $L0123rdmadd ALIGN 16 -$L005common_tail: +$L006common_tail: mov ebp,DWORD PTR 16[esp] mov edi,DWORD PTR 4[esp] lea esi,DWORD PTR 32[esp] @@ -435,13 +443,13 @@ $L005common_tail: mov ecx,ebx xor edx,edx ALIGN 16 -$L014sub: +$L015sub: sbb eax,DWORD PTR [edx*4+ebp] mov DWORD PTR [edx*4+edi],eax dec ecx mov eax,DWORD PTR 4[edx*4+esi] lea edx,DWORD PTR 1[edx] - jge $L014sub + jge $L015sub sbb eax,0 and esi,eax not eax @@ -449,12 +457,12 @@ $L014sub: and ebp,eax or esi,ebp ALIGN 16 -$L015copy: +$L016copy: mov eax,DWORD PTR [ebx*4+esi] mov DWORD PTR [ebx*4+edi],eax mov DWORD PTR 32[ebx*4+esp],ecx dec ebx - jge $L015copy + jge $L016copy mov esp,DWORD PTR 24[esp] mov eax,1 $L000just_leave: diff --git a/vendor/openssl/config/Makefile b/vendor/openssl/config/Makefile index b56e9004c..c8155b16d 100644 --- a/vendor/openssl/config/Makefile +++ b/vendor/openssl/config/Makefile @@ -5,7 +5,8 @@ COPT = no-shared no-symlinks ARCHS = aix-gcc aix64-gcc BSD-x86 BSD-x86_64 VC-WIN32 \ VC-WIN64A darwin64-x86_64-cc darwin-i386-cc linux-aarch64 \ linux-armv4 linux-elf linux-x32 linux-x86_64 linux-ppc \ -linux-ppc64 solaris-x86-gcc solaris64-x86_64-gcc +linux-ppc64 linux32-s390x linux64-s390x solaris-x86-gcc \ +solaris64-x86_64-gcc CFG = opensslconf.h SRC_CFG = ../openssl/crypto/$(CFG) diff --git a/vendor/openssl/config/archs/BSD-x86/opensslconf.h b/vendor/openssl/config/archs/BSD-x86/opensslconf.h index 31e9f5416..769c15e05 100644 --- a/vendor/openssl/config/archs/BSD-x86/opensslconf.h +++ b/vendor/openssl/config/archs/BSD-x86/opensslconf.h @@ -38,12 +38,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -89,12 +95,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/archs/BSD-x86_64/opensslconf.h b/vendor/openssl/config/archs/BSD-x86_64/opensslconf.h index 865473bac..231c8f362 100644 --- a/vendor/openssl/config/archs/BSD-x86_64/opensslconf.h +++ b/vendor/openssl/config/archs/BSD-x86_64/opensslconf.h @@ -38,12 +38,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -89,12 +95,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/archs/VC-WIN32/opensslconf.h b/vendor/openssl/config/archs/VC-WIN32/opensslconf.h index d49ebfa3d..963b384b2 100644 --- a/vendor/openssl/config/archs/VC-WIN32/opensslconf.h +++ b/vendor/openssl/config/archs/VC-WIN32/opensslconf.h @@ -41,12 +41,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -89,12 +95,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/archs/VC-WIN64A/opensslconf.h b/vendor/openssl/config/archs/VC-WIN64A/opensslconf.h index b248dac02..2993295bd 100644 --- a/vendor/openssl/config/archs/VC-WIN64A/opensslconf.h +++ b/vendor/openssl/config/archs/VC-WIN64A/opensslconf.h @@ -41,12 +41,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -89,12 +95,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/archs/aix-gcc/opensslconf.h b/vendor/openssl/config/archs/aix-gcc/opensslconf.h index 7c71fad1c..0b5a4da21 100644 --- a/vendor/openssl/config/archs/aix-gcc/opensslconf.h +++ b/vendor/openssl/config/archs/aix-gcc/opensslconf.h @@ -41,12 +41,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -92,12 +98,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/archs/aix64-gcc/opensslconf.h b/vendor/openssl/config/archs/aix64-gcc/opensslconf.h index 37490dfb5..0cca4cae2 100644 --- a/vendor/openssl/config/archs/aix64-gcc/opensslconf.h +++ b/vendor/openssl/config/archs/aix64-gcc/opensslconf.h @@ -41,12 +41,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -92,12 +98,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/archs/darwin-i386-cc/opensslconf.h b/vendor/openssl/config/archs/darwin-i386-cc/opensslconf.h index 02328a533..584537094 100644 --- a/vendor/openssl/config/archs/darwin-i386-cc/opensslconf.h +++ b/vendor/openssl/config/archs/darwin-i386-cc/opensslconf.h @@ -41,12 +41,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -92,12 +98,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/archs/darwin64-x86_64-cc/opensslconf.h b/vendor/openssl/config/archs/darwin64-x86_64-cc/opensslconf.h index d7be6bbc4..1d7932d04 100644 --- a/vendor/openssl/config/archs/darwin64-x86_64-cc/opensslconf.h +++ b/vendor/openssl/config/archs/darwin64-x86_64-cc/opensslconf.h @@ -41,12 +41,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -92,12 +98,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/archs/linux-aarch64/opensslconf.h b/vendor/openssl/config/archs/linux-aarch64/opensslconf.h index 92d693774..bd4869d4c 100644 --- a/vendor/openssl/config/archs/linux-aarch64/opensslconf.h +++ b/vendor/openssl/config/archs/linux-aarch64/opensslconf.h @@ -38,12 +38,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -89,12 +95,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/archs/linux-armv4/opensslconf.h b/vendor/openssl/config/archs/linux-armv4/opensslconf.h index 24d98356f..4f6aa1c69 100644 --- a/vendor/openssl/config/archs/linux-armv4/opensslconf.h +++ b/vendor/openssl/config/archs/linux-armv4/opensslconf.h @@ -38,12 +38,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -89,12 +95,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/archs/linux-elf/opensslconf.h b/vendor/openssl/config/archs/linux-elf/opensslconf.h index 31e9f5416..769c15e05 100644 --- a/vendor/openssl/config/archs/linux-elf/opensslconf.h +++ b/vendor/openssl/config/archs/linux-elf/opensslconf.h @@ -38,12 +38,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -89,12 +95,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/archs/linux-ppc/opensslconf.h b/vendor/openssl/config/archs/linux-ppc/opensslconf.h index f5a03b47e..e0d62da24 100644 --- a/vendor/openssl/config/archs/linux-ppc/opensslconf.h +++ b/vendor/openssl/config/archs/linux-ppc/opensslconf.h @@ -38,12 +38,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -89,12 +95,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/archs/linux-ppc64/opensslconf.h b/vendor/openssl/config/archs/linux-ppc64/opensslconf.h index 900aa7017..3f7202d25 100644 --- a/vendor/openssl/config/archs/linux-ppc64/opensslconf.h +++ b/vendor/openssl/config/archs/linux-ppc64/opensslconf.h @@ -38,12 +38,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -89,12 +95,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/archs/linux-x32/opensslconf.h b/vendor/openssl/config/archs/linux-x32/opensslconf.h index 79706e45b..8e184bc81 100644 --- a/vendor/openssl/config/archs/linux-x32/opensslconf.h +++ b/vendor/openssl/config/archs/linux-x32/opensslconf.h @@ -38,12 +38,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -89,12 +95,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/archs/linux-x86_64/opensslconf.h b/vendor/openssl/config/archs/linux-x86_64/opensslconf.h index 865473bac..231c8f362 100644 --- a/vendor/openssl/config/archs/linux-x86_64/opensslconf.h +++ b/vendor/openssl/config/archs/linux-x86_64/opensslconf.h @@ -38,12 +38,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -89,12 +95,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/archs/linux32-s390x/opensslconf.h b/vendor/openssl/config/archs/linux32-s390x/opensslconf.h new file mode 100755 index 000000000..e0d0f8fa6 --- /dev/null +++ b/vendor/openssl/config/archs/linux32-s390x/opensslconf.h @@ -0,0 +1,270 @@ +/* opensslconf.h */ +/* WARNING: Generated automatically from opensslconf.h.in by Configure. */ + +#ifdef __cplusplus +extern "C" { +#endif +/* OpenSSL was configured with the following options: */ +#ifndef OPENSSL_DOING_MAKEDEPEND + + +#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 +# define OPENSSL_NO_EC_NISTP_64_GCC_128 +#endif +#ifndef OPENSSL_NO_GMP +# define OPENSSL_NO_GMP +#endif +#ifndef OPENSSL_NO_JPAKE +# define OPENSSL_NO_JPAKE +#endif +#ifndef OPENSSL_NO_KRB5 +# define OPENSSL_NO_KRB5 +#endif +#ifndef OPENSSL_NO_LIBUNBOUND +# define OPENSSL_NO_LIBUNBOUND +#endif +#ifndef OPENSSL_NO_MD2 +# define OPENSSL_NO_MD2 +#endif +#ifndef OPENSSL_NO_RC5 +# define OPENSSL_NO_RC5 +#endif +#ifndef OPENSSL_NO_RFC3779 +# define OPENSSL_NO_RFC3779 +#endif +#ifndef OPENSSL_NO_SCTP +# define OPENSSL_NO_SCTP +#endif +#ifndef OPENSSL_NO_SSL_TRACE +# define OPENSSL_NO_SSL_TRACE +#endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif +#ifndef OPENSSL_NO_STORE +# define OPENSSL_NO_STORE +#endif +#ifndef OPENSSL_NO_UNIT_TEST +# define OPENSSL_NO_UNIT_TEST +#endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif + +#endif /* OPENSSL_DOING_MAKEDEPEND */ + +#ifndef OPENSSL_THREADS +# define OPENSSL_THREADS +#endif +#ifndef OPENSSL_NO_DYNAMIC_ENGINE +# define OPENSSL_NO_DYNAMIC_ENGINE +#endif + +/* The OPENSSL_NO_* macros are also defined as NO_* if the application + asks for it. This is a transient feature that is provided for those + who haven't had the time to do the appropriate changes in their + applications. */ +#ifdef OPENSSL_ALGORITHM_DEFINES +# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128) +# define NO_EC_NISTP_64_GCC_128 +# endif +# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP) +# define NO_GMP +# endif +# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE) +# define NO_JPAKE +# endif +# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) +# define NO_KRB5 +# endif +# if defined(OPENSSL_NO_LIBUNBOUND) && !defined(NO_LIBUNBOUND) +# define NO_LIBUNBOUND +# endif +# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2) +# define NO_MD2 +# endif +# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5) +# define NO_RC5 +# endif +# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779) +# define NO_RFC3779 +# endif +# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP) +# define NO_SCTP +# endif +# if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) +# define NO_SSL_TRACE +# endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif +# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) +# define NO_STORE +# endif +# if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) +# define NO_UNIT_TEST +# endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif +#endif + + + +/* crypto/opensslconf.h.in */ + +/* Generate 80386 code? */ +#undef I386_ONLY + +#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ +#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) +#define ENGINESDIR "/usr/local/ssl/lib/engines" +#define OPENSSLDIR "/usr/local/ssl" +#endif +#endif + +#undef OPENSSL_UNISTD +#define OPENSSL_UNISTD + +#undef OPENSSL_EXPORT_VAR_AS_FUNCTION + +#if defined(HEADER_IDEA_H) && !defined(IDEA_INT) +#define IDEA_INT unsigned int +#endif + +#if defined(HEADER_MD2_H) && !defined(MD2_INT) +#define MD2_INT unsigned int +#endif + +#if defined(HEADER_RC2_H) && !defined(RC2_INT) +/* I need to put in a mod for the alpha - eay */ +#define RC2_INT unsigned int +#endif + +#if defined(HEADER_RC4_H) +#if !defined(RC4_INT) +/* using int types make the structure larger but make the code faster + * on most boxes I have tested - up to %20 faster. */ +/* + * I don't know what does "most" mean, but declaring "int" is a must on: + * - Intel P6 because partial register stalls are very expensive; + * - elder Alpha because it lacks byte load/store instructions; + */ +#define RC4_INT unsigned char +#endif +#if !defined(RC4_CHUNK) +/* + * This enables code handling data aligned at natural CPU word + * boundary. See crypto/rc4/rc4_enc.c for further details. + */ +#define RC4_CHUNK unsigned long +#endif +#endif + +#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) +/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a + * %20 speed up (longs are 8 bytes, int's are 4). */ +#ifndef DES_LONG +#define DES_LONG unsigned int +#endif +#endif + +#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) +#define CONFIG_HEADER_BN_H +#define BN_LLONG + +/* Should we define BN_DIV2W here? */ + +/* Only one for the following should be defined */ +#undef SIXTY_FOUR_BIT_LONG +#undef SIXTY_FOUR_BIT +#define THIRTY_TWO_BIT +#endif + +#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) +#define CONFIG_HEADER_RC4_LOCL_H +/* if this is defined data[i] is used instead of *data, this is a %20 + * speedup on x86 */ +#undef RC4_INDEX +#endif + +#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) +#define CONFIG_HEADER_BF_LOCL_H +#undef BF_PTR +#endif /* HEADER_BF_LOCL_H */ + +#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) +#define CONFIG_HEADER_DES_LOCL_H +#ifndef DES_DEFAULT_OPTIONS +/* the following is tweaked from a config script, that is why it is a + * protected undef/define */ +#ifndef DES_PTR +#undef DES_PTR +#endif + +/* This helps C compiler generate the correct code for multiple functional + * units. It reduces register dependancies at the expense of 2 more + * registers */ +#ifndef DES_RISC1 +#undef DES_RISC1 +#endif + +#ifndef DES_RISC2 +#undef DES_RISC2 +#endif + +#if defined(DES_RISC1) && defined(DES_RISC2) +#error YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! +#endif + +/* Unroll the inner loop, this sometimes helps, sometimes hinders. + * Very mucy CPU dependant */ +#ifndef DES_UNROLL +#define DES_UNROLL +#endif + +/* These default values were supplied by + * Peter Gutman + * They are only used if nothing else has been defined */ +#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined( __sun ) || defined ( sun ) /* Newer Sparc's */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#elif defined( __ultrix ) /* Older MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined( __osf1__ ) /* Alpha */ +# define DES_PTR +# define DES_RISC2 +#elif defined ( _AIX ) /* RS6000 */ + /* Unknown */ +#elif defined( __hpux ) /* HP-PA */ + /* Unknown */ +#elif defined( __aux ) /* 68K */ + /* Unknown */ +#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ +# define DES_UNROLL +#elif defined( __sgi ) /* Newer MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#endif /* Systems-specific speed defines */ +#endif + +#endif /* DES_DEFAULT_OPTIONS */ +#endif /* HEADER_DES_LOCL_H */ +#ifdef __cplusplus +} +#endif diff --git a/vendor/openssl/config/archs/linux64-s390x/opensslconf.h b/vendor/openssl/config/archs/linux64-s390x/opensslconf.h new file mode 100755 index 000000000..dbb034867 --- /dev/null +++ b/vendor/openssl/config/archs/linux64-s390x/opensslconf.h @@ -0,0 +1,270 @@ +/* opensslconf.h */ +/* WARNING: Generated automatically from opensslconf.h.in by Configure. */ + +#ifdef __cplusplus +extern "C" { +#endif +/* OpenSSL was configured with the following options: */ +#ifndef OPENSSL_DOING_MAKEDEPEND + + +#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 +# define OPENSSL_NO_EC_NISTP_64_GCC_128 +#endif +#ifndef OPENSSL_NO_GMP +# define OPENSSL_NO_GMP +#endif +#ifndef OPENSSL_NO_JPAKE +# define OPENSSL_NO_JPAKE +#endif +#ifndef OPENSSL_NO_KRB5 +# define OPENSSL_NO_KRB5 +#endif +#ifndef OPENSSL_NO_LIBUNBOUND +# define OPENSSL_NO_LIBUNBOUND +#endif +#ifndef OPENSSL_NO_MD2 +# define OPENSSL_NO_MD2 +#endif +#ifndef OPENSSL_NO_RC5 +# define OPENSSL_NO_RC5 +#endif +#ifndef OPENSSL_NO_RFC3779 +# define OPENSSL_NO_RFC3779 +#endif +#ifndef OPENSSL_NO_SCTP +# define OPENSSL_NO_SCTP +#endif +#ifndef OPENSSL_NO_SSL_TRACE +# define OPENSSL_NO_SSL_TRACE +#endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif +#ifndef OPENSSL_NO_STORE +# define OPENSSL_NO_STORE +#endif +#ifndef OPENSSL_NO_UNIT_TEST +# define OPENSSL_NO_UNIT_TEST +#endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif + +#endif /* OPENSSL_DOING_MAKEDEPEND */ + +#ifndef OPENSSL_THREADS +# define OPENSSL_THREADS +#endif +#ifndef OPENSSL_NO_DYNAMIC_ENGINE +# define OPENSSL_NO_DYNAMIC_ENGINE +#endif + +/* The OPENSSL_NO_* macros are also defined as NO_* if the application + asks for it. This is a transient feature that is provided for those + who haven't had the time to do the appropriate changes in their + applications. */ +#ifdef OPENSSL_ALGORITHM_DEFINES +# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128) +# define NO_EC_NISTP_64_GCC_128 +# endif +# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP) +# define NO_GMP +# endif +# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE) +# define NO_JPAKE +# endif +# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) +# define NO_KRB5 +# endif +# if defined(OPENSSL_NO_LIBUNBOUND) && !defined(NO_LIBUNBOUND) +# define NO_LIBUNBOUND +# endif +# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2) +# define NO_MD2 +# endif +# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5) +# define NO_RC5 +# endif +# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779) +# define NO_RFC3779 +# endif +# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP) +# define NO_SCTP +# endif +# if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) +# define NO_SSL_TRACE +# endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif +# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) +# define NO_STORE +# endif +# if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) +# define NO_UNIT_TEST +# endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif +#endif + + + +/* crypto/opensslconf.h.in */ + +/* Generate 80386 code? */ +#undef I386_ONLY + +#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ +#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) +#define ENGINESDIR "/usr/local/ssl/lib/engines" +#define OPENSSLDIR "/usr/local/ssl" +#endif +#endif + +#undef OPENSSL_UNISTD +#define OPENSSL_UNISTD + +#undef OPENSSL_EXPORT_VAR_AS_FUNCTION + +#if defined(HEADER_IDEA_H) && !defined(IDEA_INT) +#define IDEA_INT unsigned int +#endif + +#if defined(HEADER_MD2_H) && !defined(MD2_INT) +#define MD2_INT unsigned int +#endif + +#if defined(HEADER_RC2_H) && !defined(RC2_INT) +/* I need to put in a mod for the alpha - eay */ +#define RC2_INT unsigned int +#endif + +#if defined(HEADER_RC4_H) +#if !defined(RC4_INT) +/* using int types make the structure larger but make the code faster + * on most boxes I have tested - up to %20 faster. */ +/* + * I don't know what does "most" mean, but declaring "int" is a must on: + * - Intel P6 because partial register stalls are very expensive; + * - elder Alpha because it lacks byte load/store instructions; + */ +#define RC4_INT unsigned char +#endif +#if !defined(RC4_CHUNK) +/* + * This enables code handling data aligned at natural CPU word + * boundary. See crypto/rc4/rc4_enc.c for further details. + */ +#define RC4_CHUNK unsigned long +#endif +#endif + +#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) +/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a + * %20 speed up (longs are 8 bytes, int's are 4). */ +#ifndef DES_LONG +#define DES_LONG unsigned int +#endif +#endif + +#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) +#define CONFIG_HEADER_BN_H +#undef BN_LLONG + +/* Should we define BN_DIV2W here? */ + +/* Only one for the following should be defined */ +#define SIXTY_FOUR_BIT_LONG +#undef SIXTY_FOUR_BIT +#undef THIRTY_TWO_BIT +#endif + +#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) +#define CONFIG_HEADER_RC4_LOCL_H +/* if this is defined data[i] is used instead of *data, this is a %20 + * speedup on x86 */ +#undef RC4_INDEX +#endif + +#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) +#define CONFIG_HEADER_BF_LOCL_H +#undef BF_PTR +#endif /* HEADER_BF_LOCL_H */ + +#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) +#define CONFIG_HEADER_DES_LOCL_H +#ifndef DES_DEFAULT_OPTIONS +/* the following is tweaked from a config script, that is why it is a + * protected undef/define */ +#ifndef DES_PTR +#undef DES_PTR +#endif + +/* This helps C compiler generate the correct code for multiple functional + * units. It reduces register dependancies at the expense of 2 more + * registers */ +#ifndef DES_RISC1 +#undef DES_RISC1 +#endif + +#ifndef DES_RISC2 +#undef DES_RISC2 +#endif + +#if defined(DES_RISC1) && defined(DES_RISC2) +#error YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! +#endif + +/* Unroll the inner loop, this sometimes helps, sometimes hinders. + * Very mucy CPU dependant */ +#ifndef DES_UNROLL +#define DES_UNROLL +#endif + +/* These default values were supplied by + * Peter Gutman + * They are only used if nothing else has been defined */ +#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined( __sun ) || defined ( sun ) /* Newer Sparc's */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#elif defined( __ultrix ) /* Older MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined( __osf1__ ) /* Alpha */ +# define DES_PTR +# define DES_RISC2 +#elif defined ( _AIX ) /* RS6000 */ + /* Unknown */ +#elif defined( __hpux ) /* HP-PA */ + /* Unknown */ +#elif defined( __aux ) /* 68K */ + /* Unknown */ +#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ +# define DES_UNROLL +#elif defined( __sgi ) /* Newer MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#endif /* Systems-specific speed defines */ +#endif + +#endif /* DES_DEFAULT_OPTIONS */ +#endif /* HEADER_DES_LOCL_H */ +#ifdef __cplusplus +} +#endif diff --git a/vendor/openssl/config/archs/solaris-x86-gcc/opensslconf.h b/vendor/openssl/config/archs/solaris-x86-gcc/opensslconf.h index 31e9f5416..769c15e05 100644 --- a/vendor/openssl/config/archs/solaris-x86-gcc/opensslconf.h +++ b/vendor/openssl/config/archs/solaris-x86-gcc/opensslconf.h @@ -38,12 +38,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -89,12 +95,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/archs/solaris64-x86_64-gcc/opensslconf.h b/vendor/openssl/config/archs/solaris64-x86_64-gcc/opensslconf.h index 865473bac..231c8f362 100644 --- a/vendor/openssl/config/archs/solaris64-x86_64-gcc/opensslconf.h +++ b/vendor/openssl/config/archs/solaris64-x86_64-gcc/opensslconf.h @@ -38,12 +38,18 @@ extern "C" { #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif +#ifndef OPENSSL_NO_SSL2 +# define OPENSSL_NO_SSL2 +#endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif #endif /* OPENSSL_DOING_MAKEDEPEND */ @@ -89,12 +95,18 @@ extern "C" { # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif +# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) +# define NO_SSL2 +# endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif +# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +# define NO_WEAK_SSL_CIPHERS +# endif #endif diff --git a/vendor/openssl/config/opensslconf.h b/vendor/openssl/config/opensslconf.h index 9a7cda945..9b20fb648 100644 --- a/vendor/openssl/config/opensslconf.h +++ b/vendor/openssl/config/opensslconf.h @@ -27,6 +27,8 @@ | linux | arm64 | linux-aarch64 | o | | linux | ppc | linux-ppc | o | | linux | ppc64 | linux-ppc64 | o | + | linux | s390 | linux32-s390x | o | + | linux | s390x | linux64-s390x | o | | mac | ia32 | darwin-i386-cc | o | | mac | x64 | darwin64-x86-cc | o | | win | ia32 | VC-WIN32 | - | @@ -68,6 +70,8 @@ | | _ARCH_PPC | | ppc64 | __PPC64__ | | | _ARCH_PPC64 | + | s390 | __s390__ | + | s390x | __s390x__ | These are the list which is not implemented yet. @@ -124,6 +128,10 @@ # include "./archs/aix64-gcc/opensslconf.h" #elif defined(_AIX) && !defined(_ARCH_PPC64) && defined(_ARCH_PPC) # include "./archs/aix-gcc/opensslconf.h" +#elif defined(OPENSSL_LINUX) && defined(__s390x__) +# include "./archs/linux64-s390x/opensslconf.h" +#elif defined(OPENSSL_LINUX) && defined(__s390__) +# include "./archs/linux32-s390x/opensslconf.h" #else # include "./archs/linux-elf/opensslconf.h" #endif diff --git a/vendor/openssl/doc/UPGRADING.md b/vendor/openssl/doc/UPGRADING.md index aac92f730..5c8919d2c 100644 --- a/vendor/openssl/doc/UPGRADING.md +++ b/vendor/openssl/doc/UPGRADING.md @@ -1,8 +1,8 @@ ## How to upgrade openssl library in Node.js -This document describes the procedure to upgrade openssl from 1.0.2a -to 1.0.2c in Node.js. - +This document describes the procedure to upgrade openssl from 1.0.2e +to 1.0.2f in Node.js. This procedure might be applied to upgrading +any versions in 1.0.2. ### Build System and Upgrading Overview The openssl build system is based on the `Configure` perl script in @@ -31,6 +31,8 @@ The tested platform in CI are also listed. | --dest-os | --dest-cpu | conf | asm | openssl target | CI | |---------- |----------- |----- |----- |------------------- |--- | +| aix | ppc | o | x(*2)| aix-gcc | o | +| aix | ppc64 | o | x(*2)| aix64-gcc | o | | linux | ia32 | o | o |linux-elf | o | | linux | x32 | o | x(*2)|linux-x32 | x | | linux | x64 | o | o |linux-x86_64 | o | @@ -91,48 +93,197 @@ https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/crypto/sha/asm/sha5 otherwise asm_obsolete are used. The following is the detail instruction steps how to upgrade openssl -version from 1.0.2a to 1.0.2c in node. +version from 1.0.2e to 1.0.2f in node. + +*This needs to run Linux +enviroment.* ### 1. Replace openssl source in `deps/openssl/openssl` Remove old openssl sources in `deps/openssl/openssl` . Get original openssl sources from -https://www.openssl.org/source/openssl-1.0.2c.tar.gz and extract all +https://www.openssl.org/source/openssl-1.0.2f.tar.gz and extract all files into `deps/openssl/openssl` . -### 2. Apply private patches -There are three kinds of private patches to be applied in openssl-1.0.2c. - -- The two fixes of assembly error on ia32 win32. masm is no longer - supported in openssl. We should move to use nasm or yasm in future - version of node. - -- The fix of openssl-cli built on win. Key press requirement of - openssl-cli in win causes timeout failures of several tests. +```sh +ohtsu@ubuntu:~/github/node$ cd deps/openssl/ +ohtsu@ubuntu:~/github/node/deps/openssl$ rm -rf openssl +ohtsu@ubuntu:~/github/node/deps/openssl$ tar zxf ~/tmp/openssl-1.0.2f.tar.gz +ohtsu@ubuntu:~/github/node/deps/openssl$ mv openssl-1.0.2f openssl +ohtsu@ubuntu:~/github/node/deps/openssl$ git add --all openssl +ohtsu@ubuntu:~/github/node/deps/openssl$ git commit openssl +```` +The commit message can be -- A new `-no_rand_screen` option to openssl s_client. This makes test - time of test-tls-server-verify be much faster. +>deps: upgrade openssl sources to 1.0.2f +> +>This replaces all sources of openssl-1.0.2f.tar.gz into +>deps/openssl/openssl -### 3. Replace openssl header files in `deps/openssl/openssl/include/openssl` +### 2. Replace openssl header files in `deps/openssl/openssl/include/openssl` all header files in `deps/openssl/openssl/include/openssl/*.h` are symbolic links in the distributed release tar.gz. They cause issues in Windows. They are copied from the real files of symlink origin into the include directory. During installation, they also copied into `PREFIX/node/include` by tools/install.py. +`deps/openssl/openssl/include/openssl/opensslconf.h` and +`deps/openssl/openssl/crypto/opensslconf.h` needs to be changed so as +to refer the platform independent file of `deps/openssl/config/opensslconf.h` + +The following shell script (copy_symlink.sh) is my tool for working +this procedures to invoke it in the `deps/openssl/openssl/include/openssl/`. + +```sh +#!/bin/bash +for var in "$@" +do + if [ -L $var ]; then + origin=`readlink $var` + rm $var + cp $origin $var + fi +done +rm opensslconf.h +echo '#include "../../crypto/opensslconf.h"' > opensslconf.h +rm ../../crypto/opensslconf.h +echo '#include "../../config/opensslconf.h"' > ../../crypto/opensslconf.h +```` + +This step somehow gets troublesome since openssl-1.0.2f because +symlink headers are removed in tar.gz file and we have to execute +./config script to generate them. The config script also generate +unnecessary platform dependent files in the repository so that we have +to clean up them after committing header files. + +```sh +ohtsu@ubuntu:~/github/node/deps/openssl$ cd openssl/ +ohtsu@ubuntu:~/github/node/deps/openssl/openssl$ ./config + +make[1]: Leaving directory `/home/ohtsu/github/node/deps/openssl/openssl/test' + +Configured for linux-x86_64. +ohtsu@ubuntu:~/github/node/deps/openssl/openssl$ cd include/openssl/ +ohtsu@ubuntu:~/github/node/deps/openssl/openssl/include/openssl$ ~/copy_symlink.sh *.h +ohtsu@ubuntu:~/github/node/deps/openssl/openssl/include/openssl$ cd ../.. +ohtsu@ubuntu:~/github/node/deps/openssl/openssl$ git add include +ohtsu@ubuntu:~/github/node/deps/openssl/openssl$ git commit include/ crypto/opensslconf.h +ohtsu@ubuntu:~/github/node/deps/openssl/openssl$ git clean -f +ohtsu@ubuntu:~/github/node/deps/openssl/openssl$ git checkout Makefile Makefile.bak +```` +The commit message can be + +>deps: copy all openssl header files to include dir +> +>All symlink files in `deps/openssl/openssl/include/openssl/` +>are removed and replaced with real header files to avoid +>issues on Windows. Two files of opensslconf.h in crypto and +>include dir are replaced to refer config/opensslconf.h. + +### 3. Apply floating patches +At the time of writing, there are four floating patches to be applied +to openssl. + +- Two fixes for assembly errors on ia32 win32. + +- One fix for openssl-cli built on win. Key press requirement of + openssl-cli in win causes timeout failures of several tests. + +- Adding a new `-no_rand_screen` option to openssl s_client. This + makes test time of test-tls-server-verify be much faster. + +These fixes can be applied via cherry-pick. The first three will merge without conflict. +The last commit can be landed using a recursive strategy that prefers newer changes. + +```sh +git cherry-pick c66c3d9fa3f5bab0bdfe363dd947136cf8a3907f +git cherry-pick 42a8de2ac66b6953cbc731fdb0b128b8019643b2 +git cherry-pick 2eb170874aa5e84e71b62caab7ac9792fd59c10f +git cherry-pick --strategy=recursive -X theirs 664a659 +``` + +If you attempted to cherry-pick the last commit you would have the following conflict + +``` +# do not do this +git cherry-pick 664a6596960655e214fef25e74d3285097703e95 +error: could not apply 664a659... deps: add -no_rand_screen to openssl s_client +hint: after resolving the conflicts, mark the corrected paths +hint: with 'git add ' or 'git rm ' +hint: and commit the result with 'git commit' +git cherry-pi +``` + +the conflict is in `deps/openssl/openssl/apps/app_rand.c` as below. + +```sh +ohtsu@omb:openssl$ git diff +diff --cc deps/openssl/openssl/apps/app_rand.c +index 7f40bba,b6fe294..0000000 +--- a/deps/openssl/openssl/apps/app_rand.c ++++ b/deps/openssl/openssl/apps/app_rand.c +@@@ -124,7 -124,16 +124,20 @@@ int app_RAND_load_file(const char *file + char buffer[200]; + + #ifdef OPENSSL_SYS_WINDOWS + ++<<<<<<< HEAD + + RAND_screen(); + ++======= + + /* + + * allocate 2 to dont_warn not to use RAND_screen() via + + * -no_rand_screen option in s_client + + */ + + if (dont_warn != 2) { + + BIO_printf(bio_e, "Loading 'screen' into random state -"); + + BIO_flush(bio_e); + + RAND_screen(); + + BIO_printf(bio_e, " done\n"); + + } + ++>>>>>>> 664a659... deps: add -no_rand_screen to openssl s_client + #endif + + if (file == NULL) +```` + +We want to opt for the changes from 664a659 instead of the changes present on HEAD. +`git cherry-pick --strategy=recursive -X theirs` will do just that! ### 4. Change `opensslconf.h` so as to fit each platform. -No change. +opensslconf.h includes defines and macros which are platform +dependent. Each files can be generated via `deps/openssl/config/Makefile` +We can regenerate them and commit them if any diffs exist. + +```sh +ohtsu@ubuntu:~/github/node/deps/openssl$ cd config +ohtsu@ubuntu:~/github/node/deps/openssl/config$ make clean +find archs -name opensslconf.h -exec rm "{}" \; +ohtsu@ubuntu:~/github/node/deps/openssl/config$ make +cd ../openssl; perl ./Configure no-shared no-symlinks aix-gcc > /dev/null +ohtsu@ubuntu:~/github/node/deps/openssl/config$ git diff +ohtsu@ubuntu:~/github/node/deps/openssl/config$ git commit . +```` +The commit message can be + +>deps: update openssl config files +> +>Regenerate config files for supported platforms with Makefile. ### 5. Update openssl.gyp and openssl.gypi -No change. +This process is needed when source files are removed, renamed and added. +It seldom happen in the minor bug fix release. Build errors would be +thrown if it happens. In case of build errors, we need to check source +files in Makefiles of its platform and change openssl.gyp or +openssl.gypi according to the changes of source files. Please contact +@shigeki if it is needed. ### 6. ASM files for openssl We provide two sets of asm files. One is for the latest assembler -and the other is the older one. +and the other is the older one. sections 6.1 and 6.2 describe the two +types of files. Section 6.3 explains the steps to update the files. +In the case of upgrading 1.0.2f there were no changes to the asm files. ### 6.1. asm files for the latest compiler This was made in `deps/openssl/asm/Makefile` - Updated asm files for each platforms which are required in - openssl-1.0.2c. + openssl-1.0.2f. - Some perl files need CC and ASM envs. Added a check if these envs exist. Followed asm files are to be generated with CC=gcc and ASM=nasm on Linux. See @@ -148,8 +299,9 @@ This was made in `deps/openssl/asm/Makefile` With export environments of CC=gcc and ASM=nasm, then type make command and check if new asm files are generated. +If you don't have nasm please install it such as `apt-get install nasm`. -### 6.2.asm files for the older compiler +### 6.2. asm files for the older compiler For older assembler, the version check of CC and ASM should be skipped in generating asm file with perl scripts. Copy files from `deps/openssl/asm` into @@ -158,3 +310,42 @@ into this directories and remove the check of CC and ASM envs. Without environments of CC and ASM, then type make command and check if new asm files for older compilers are generated. + +The following steps includes version check of gcc and nasm. + +### 6.3 steps + +```sh +ohtsu@ubuntu:~/github/node/deps/openssl/config$ cd ../asm +ohtsu@ubuntu:~/github/node/deps/openssl/asm$ gcc --version +gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4 +Copyright (C) 2013 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +ohtsu@ubuntu:~/github/node/deps/openssl/asm$ nasm -v +NASM version 2.10.09 compiled on Dec 29 2013 +ohtsu@ubuntu:~/github/node/deps/openssl/asm$ export CC=gcc +ohtsu@ubuntu:~/github/node/deps/openssl/asm$ export ASM=nasm +ohtsu@ubuntu:~/github/node/deps/openssl/asm$ make clean +find . -iname '*.asm' -exec rm "{}" \; +find . -iname '*.s' -exec rm "{}" \; +find . -iname '*.S' -exec rm "{}" \; +ohtsu@ubuntu:~/github/node/deps/openssl/asm$ make +ohtsu@ubuntu:~/github/node/deps/openssl/asm$ cd ../asm_obsolete/ +ohtsu@ubuntu:~/github/node/deps/openssl/asm_obsolete$ unset CC +ohtsu@ubuntu:~/github/node/deps/openssl/asm_obsolete$ unset ASM +ohtsu@ubuntu:~/github/node/deps/openssl/asm_obsolete$ make clean +find . -iname '*.asm' -exec rm "{}" \; +find . -iname '*.s' -exec rm "{}" \; +find . -iname '*.S' -exec rm "{}" \; +ohtsu@ubuntu:~/github/node/deps/openssl$ git status +ohtsu@ubuntu:~/github/node/deps/openssl$ git commit asm asm_obsolete +```` +The commit message can be + +>deps: update openssl asm and asm_obsolete files +> +>Regenerate asm files with Makefile and CC=gcc and ASM=gcc where +>gcc-4.8.4. Also asm files in asm_obsolete dir to support old compiler +>and assembler are regenerated without CC and ASM envs. diff --git a/vendor/openssl/openssl.gyp b/vendor/openssl/openssl.gyp index 0428dcaf3..224fab0dd 100644 --- a/vendor/openssl/openssl.gyp +++ b/vendor/openssl/openssl.gyp @@ -8,8 +8,10 @@ 'gcc_version': 0, 'openssl_no_asm%': 0, 'llvm_version%': 0, + 'xcode_version%': 0, 'gas_version%': 0, 'use_obsolete_asm%': 'true', + 'openssl_fips%': 'false', }, 'targets': [ { @@ -21,13 +23,28 @@ ['exclude', 'md2/.*$'], ['exclude', 'store/.*$'] ], - 'defines': [ - 'L_ENDIAN', - 'PURIFY', - '_REENTRANT', - 'NO_WINDOWS_BRAINDEATH' - ], 'conditions': [ + # FIPS + ['openssl_fips != ""', { + 'defines': [ + 'OPENSSL_FIPS', + ], + 'include_dirs': [ + '<(openssl_fips)/include', + ], + + # Trick fipsld, it expects to see libcrypto.a + 'product_name': 'crypto', + + 'direct_dependent_settings': { + 'defines': [ + 'OPENSSL_FIPS', + ], + 'include_dirs': [ + '<(openssl_fips)/include', + ], + }, + }], [ 'OS=="aix"', { # AIX is missing /usr/include/endian.h 'defines': [ @@ -36,6 +53,13 @@ '__BYTE_ORDER=__BIG_ENDIAN', '__FLOAT_WORD_ORDER=__BIG_ENDIAN'], }], + [ 'node_byteorder=="big"', { + # Define Big Endian + 'defines': ['B_ENDIAN'] + }, { + # Define Little Endian + 'defines':['L_ENDIAN'] + }], ['openssl_no_asm!=0', { # Disable asm 'defines': [ @@ -98,10 +122,17 @@ }], # end of conditions of openssl_no_asm ['OS=="win"', { 'defines' : ['<@(openssl_defines_all_win)'], - 'includes': ['masm_compile.gypi',], }, { 'defines' : ['<@(openssl_defines_all_non_win)'] - }] + }], + ['target_arch=="ia32" and OS=="win"', { + 'msvs_settings': { + 'MASM': { + # Use /safeseh, see commit: 01fa5ee + 'UseSafeExceptionHandlers': 'true', + }, + }, + }], ], 'include_dirs': ['<@(openssl_include_dirs)'], 'direct_dependent_settings': { diff --git a/vendor/openssl/openssl.gypi b/vendor/openssl/openssl.gypi index 9db4009cb..3620e45c4 100644 --- a/vendor/openssl/openssl.gypi +++ b/vendor/openssl/openssl.gypi @@ -214,10 +214,6 @@ 'openssl/crypto/cms/cms_pwri.c', 'openssl/crypto/cms/cms_sd.c', 'openssl/crypto/cms/cms_smime.c', - 'openssl/crypto/comp/c_rle.c', - 'openssl/crypto/comp/c_zlib.c', - 'openssl/crypto/comp/comp_err.c', - 'openssl/crypto/comp/comp_lib.c', 'openssl/crypto/conf/conf_api.c', 'openssl/crypto/conf/conf_def.c', 'openssl/crypto/conf/conf_err.c', @@ -1039,7 +1035,8 @@ # https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/crypto/ec/asm/ecp_nistz256-avx2.pl#L45-L67 # 'conditions': [ - ['(OS=="win" and MSVS_VERSION>="2012") or use_obsolete_asm!="true"', { + ['(OS=="win" and MSVS_VERSION>="2012") or ' + 'llvm_version>="3.3" or xcode_version>="5.0" or gas_version>="2.23"', { 'openssl_sources_x64_win_masm': [ '<@(openssl_sources_asm_latest_x64_win_masm)', '<@(openssl_sources_common_x64_win_masm)', @@ -1247,13 +1244,16 @@ 'openssl/include', ], 'openssl_default_defines_all': [ - # No clue what these are for. - 'PURIFY', '_REENTRANT', - # SSLv2 is known broken and has been superseded by SSLv3 for almost - # twenty years now. - 'OPENSSL_NO_SSL2', + # PURIFY makes OpenSSL zero out some buffers. It also stops RAND_bytes() + # from using the existing contents of the destination buffer as a source + # of entropy, which according to some papers, is a possible attack vector + # for reducing the overall entropy. + 'PURIFY', + + # Compression is not used and considered insecure (CRIME.) + 'OPENSSL_NO_COMP', # SSLv3 is susceptible to downgrade attacks (POODLE.) 'OPENSSL_NO_SSL3', @@ -1272,10 +1272,6 @@ 'openssl_default_libraries_win': [ '-lgdi32.lib', '-luser32.lib', - '-lwsock32.lib', - '-lwinhttp.lib', - '-lcrypt32.lib', - '-lrpcrt4.lib' ], 'openssl_default_defines_not_win': [ # ENGINESDIR must be defined if OPENSSLDIR is. diff --git a/vendor/openssl/openssl/ACKNOWLEDGMENTS b/vendor/openssl/openssl/ACKNOWLEDGMENTS index 59c6f01f9..d21dccbb7 100644 --- a/vendor/openssl/openssl/ACKNOWLEDGMENTS +++ b/vendor/openssl/openssl/ACKNOWLEDGMENTS @@ -1,30 +1,2 @@ -The OpenSSL project depends on volunteer efforts and financial support from -the end user community. That support comes in the form of donations and paid -sponsorships, software support contracts, paid consulting services -and commissioned software development. - -Since all these activities support the continued development and improvement -of OpenSSL we consider all these clients and customers as sponsors of the -OpenSSL project. - -We would like to identify and thank the following such sponsors for their past -or current significant support of the OpenSSL project: - -Major support: - - Qualys http://www.qualys.com/ - -Very significant support: - - OpenGear: http://www.opengear.com/ - -Significant support: - - PSW Group: http://www.psw.net/ - Acano Ltd. http://acano.com/ - -Please note that we ask permission to identify sponsors and that some sponsors -we consider eligible for inclusion here have requested to remain anonymous. - -Additional sponsorship or financial support is always welcome: for more -information please contact the OpenSSL Software Foundation. +Please https://www.openssl.org/community/thanks.html for the current +acknowledgements. diff --git a/vendor/openssl/openssl/CHANGES b/vendor/openssl/openssl/CHANGES index 584f0dbd4..62658fe3e 100644 --- a/vendor/openssl/openssl/CHANGES +++ b/vendor/openssl/openssl/CHANGES @@ -2,6 +2,283 @@ OpenSSL CHANGES _______________ + Changes between 1.0.2g and 1.0.2h [3 May 2016] + + *) Prevent padding oracle in AES-NI CBC MAC check + + A MITM attacker can use a padding oracle attack to decrypt traffic + when the connection uses an AES CBC cipher and the server support + AES-NI. + + This issue was introduced as part of the fix for Lucky 13 padding + attack (CVE-2013-0169). The padding check was rewritten to be in + constant time by making sure that always the same bytes are read and + compared against either the MAC or padding bytes. But it no longer + checked that there was enough data to have both the MAC and padding + bytes. + + This issue was reported by Juraj Somorovsky using TLS-Attacker. + (CVE-2016-2107) + [Kurt Roeckx] + + *) Fix EVP_EncodeUpdate overflow + + An overflow can occur in the EVP_EncodeUpdate() function which is used for + Base64 encoding of binary data. If an attacker is able to supply very large + amounts of input data then a length check can overflow resulting in a heap + corruption. + + Internally to OpenSSL the EVP_EncodeUpdate() function is primarly used by + the PEM_write_bio* family of functions. These are mainly used within the + OpenSSL command line applications, so any application which processes data + from an untrusted source and outputs it as a PEM file should be considered + vulnerable to this issue. User applications that call these APIs directly + with large amounts of untrusted data may also be vulnerable. + + This issue was reported by Guido Vranken. + (CVE-2016-2105) + [Matt Caswell] + + *) Fix EVP_EncryptUpdate overflow + + An overflow can occur in the EVP_EncryptUpdate() function. If an attacker + is able to supply very large amounts of input data after a previous call to + EVP_EncryptUpdate() with a partial block then a length check can overflow + resulting in a heap corruption. Following an analysis of all OpenSSL + internal usage of the EVP_EncryptUpdate() function all usage is one of two + forms. The first form is where the EVP_EncryptUpdate() call is known to be + the first called function after an EVP_EncryptInit(), and therefore that + specific call must be safe. The second form is where the length passed to + EVP_EncryptUpdate() can be seen from the code to be some small value and + therefore there is no possibility of an overflow. Since all instances are + one of these two forms, it is believed that there can be no overflows in + internal code due to this problem. It should be noted that + EVP_DecryptUpdate() can call EVP_EncryptUpdate() in certain code paths. + Also EVP_CipherUpdate() is a synonym for EVP_EncryptUpdate(). All instances + of these calls have also been analysed too and it is believed there are no + instances in internal usage where an overflow could occur. + + This issue was reported by Guido Vranken. + (CVE-2016-2106) + [Matt Caswell] + + *) Prevent ASN.1 BIO excessive memory allocation + + When ASN.1 data is read from a BIO using functions such as d2i_CMS_bio() + a short invalid encoding can casuse allocation of large amounts of memory + potentially consuming excessive resources or exhausting memory. + + Any application parsing untrusted data through d2i BIO functions is + affected. The memory based functions such as d2i_X509() are *not* affected. + Since the memory based functions are used by the TLS library, TLS + applications are not affected. + + This issue was reported by Brian Carpenter. + (CVE-2016-2109) + [Stephen Henson] + + *) EBCDIC overread + + ASN1 Strings that are over 1024 bytes can cause an overread in applications + using the X509_NAME_oneline() function on EBCDIC systems. This could result + in arbitrary stack data being returned in the buffer. + + This issue was reported by Guido Vranken. + (CVE-2016-2176) + [Matt Caswell] + + *) Modify behavior of ALPN to invoke callback after SNI/servername + callback, such that updates to the SSL_CTX affect ALPN. + [Todd Short] + + *) Remove LOW from the DEFAULT cipher list. This removes singles DES from the + default. + [Kurt Roeckx] + + *) Only remove the SSLv2 methods with the no-ssl2-method option. When the + methods are enabled and ssl2 is disabled the methods return NULL. + [Kurt Roeckx] + + Changes between 1.0.2f and 1.0.2g [1 Mar 2016] + + * Disable weak ciphers in SSLv3 and up in default builds of OpenSSL. + Builds that are not configured with "enable-weak-ssl-ciphers" will not + provide any "EXPORT" or "LOW" strength ciphers. + [Viktor Dukhovni] + + * Disable SSLv2 default build, default negotiation and weak ciphers. SSLv2 + is by default disabled at build-time. Builds that are not configured with + "enable-ssl2" will not support SSLv2. Even if "enable-ssl2" is used, + users who want to negotiate SSLv2 via the version-flexible SSLv23_method() + will need to explicitly call either of: + + SSL_CTX_clear_options(ctx, SSL_OP_NO_SSLv2); + or + SSL_clear_options(ssl, SSL_OP_NO_SSLv2); + + as appropriate. Even if either of those is used, or the application + explicitly uses the version-specific SSLv2_method() or its client and + server variants, SSLv2 ciphers vulnerable to exhaustive search key + recovery have been removed. Specifically, the SSLv2 40-bit EXPORT + ciphers, and SSLv2 56-bit DES are no longer available. + (CVE-2016-0800) + [Viktor Dukhovni] + + *) Fix a double-free in DSA code + + A double free bug was discovered when OpenSSL parses malformed DSA private + keys and could lead to a DoS attack or memory corruption for applications + that receive DSA private keys from untrusted sources. This scenario is + considered rare. + + This issue was reported to OpenSSL by Adam Langley(Google/BoringSSL) using + libFuzzer. + (CVE-2016-0705) + [Stephen Henson] + + *) Disable SRP fake user seed to address a server memory leak. + + Add a new method SRP_VBASE_get1_by_user that handles the seed properly. + + SRP_VBASE_get_by_user had inconsistent memory management behaviour. + In order to fix an unavoidable memory leak, SRP_VBASE_get_by_user + was changed to ignore the "fake user" SRP seed, even if the seed + is configured. + + Users should use SRP_VBASE_get1_by_user instead. Note that in + SRP_VBASE_get1_by_user, caller must free the returned value. Note + also that even though configuring the SRP seed attempts to hide + invalid usernames by continuing the handshake with fake + credentials, this behaviour is not constant time and no strong + guarantees are made that the handshake is indistinguishable from + that of a valid user. + (CVE-2016-0798) + [Emilia Käsper] + + *) Fix BN_hex2bn/BN_dec2bn NULL pointer deref/heap corruption + + In the BN_hex2bn function the number of hex digits is calculated using an + int value |i|. Later |bn_expand| is called with a value of |i * 4|. For + large values of |i| this can result in |bn_expand| not allocating any + memory because |i * 4| is negative. This can leave the internal BIGNUM data + field as NULL leading to a subsequent NULL ptr deref. For very large values + of |i|, the calculation |i * 4| could be a positive value smaller than |i|. + In this case memory is allocated to the internal BIGNUM data field, but it + is insufficiently sized leading to heap corruption. A similar issue exists + in BN_dec2bn. This could have security consequences if BN_hex2bn/BN_dec2bn + is ever called by user applications with very large untrusted hex/dec data. + This is anticipated to be a rare occurrence. + + All OpenSSL internal usage of these functions use data that is not expected + to be untrusted, e.g. config file data or application command line + arguments. If user developed applications generate config file data based + on untrusted data then it is possible that this could also lead to security + consequences. This is also anticipated to be rare. + + This issue was reported to OpenSSL by Guido Vranken. + (CVE-2016-0797) + [Matt Caswell] + + *) Fix memory issues in BIO_*printf functions + + The internal |fmtstr| function used in processing a "%s" format string in + the BIO_*printf functions could overflow while calculating the length of a + string and cause an OOB read when printing very long strings. + + Additionally the internal |doapr_outch| function can attempt to write to an + OOB memory location (at an offset from the NULL pointer) in the event of a + memory allocation failure. In 1.0.2 and below this could be caused where + the size of a buffer to be allocated is greater than INT_MAX. E.g. this + could be in processing a very long "%s" format string. Memory leaks can + also occur. + + The first issue may mask the second issue dependent on compiler behaviour. + These problems could enable attacks where large amounts of untrusted data + is passed to the BIO_*printf functions. If applications use these functions + in this way then they could be vulnerable. OpenSSL itself uses these + functions when printing out human-readable dumps of ASN.1 data. Therefore + applications that print this data could be vulnerable if the data is from + untrusted sources. OpenSSL command line applications could also be + vulnerable where they print out ASN.1 data, or if untrusted data is passed + as command line arguments. + + Libssl is not considered directly vulnerable. Additionally certificates etc + received via remote connections via libssl are also unlikely to be able to + trigger these issues because of message size limits enforced within libssl. + + This issue was reported to OpenSSL Guido Vranken. + (CVE-2016-0799) + [Matt Caswell] + + *) Side channel attack on modular exponentiation + + A side-channel attack was found which makes use of cache-bank conflicts on + the Intel Sandy-Bridge microarchitecture which could lead to the recovery + of RSA keys. The ability to exploit this issue is limited as it relies on + an attacker who has control of code in a thread running on the same + hyper-threaded core as the victim thread which is performing decryptions. + + This issue was reported to OpenSSL by Yuval Yarom, The University of + Adelaide and NICTA, Daniel Genkin, Technion and Tel Aviv University, and + Nadia Heninger, University of Pennsylvania with more information at + http://cachebleed.info. + (CVE-2016-0702) + [Andy Polyakov] + + *) Change the req app to generate a 2048-bit RSA/DSA key by default, + if no keysize is specified with default_bits. This fixes an + omission in an earlier change that changed all RSA/DSA key generation + apps to use 2048 bits by default. + [Emilia Käsper] + + Changes between 1.0.2e and 1.0.2f [28 Jan 2016] + + *) DH small subgroups + + Historically OpenSSL only ever generated DH parameters based on "safe" + primes. More recently (in version 1.0.2) support was provided for + generating X9.42 style parameter files such as those required for RFC 5114 + support. The primes used in such files may not be "safe". Where an + application is using DH configured with parameters based on primes that are + not "safe" then an attacker could use this fact to find a peer's private + DH exponent. This attack requires that the attacker complete multiple + handshakes in which the peer uses the same private DH exponent. For example + this could be used to discover a TLS server's private DH exponent if it's + reusing the private DH exponent or it's using a static DH ciphersuite. + + OpenSSL provides the option SSL_OP_SINGLE_DH_USE for ephemeral DH (DHE) in + TLS. It is not on by default. If the option is not set then the server + reuses the same private DH exponent for the life of the server process and + would be vulnerable to this attack. It is believed that many popular + applications do set this option and would therefore not be at risk. + + The fix for this issue adds an additional check where a "q" parameter is + available (as is the case in X9.42 based parameters). This detects the + only known attack, and is the only possible defense for static DH + ciphersuites. This could have some performance impact. + + Additionally the SSL_OP_SINGLE_DH_USE option has been switched on by + default and cannot be disabled. This could have some performance impact. + + This issue was reported to OpenSSL by Antonio Sanso (Adobe). + (CVE-2016-0701) + [Matt Caswell] + + *) SSLv2 doesn't block disabled ciphers + + A malicious client can negotiate SSLv2 ciphers that have been disabled on + the server and complete SSLv2 handshakes even if all SSLv2 ciphers have + been disabled, provided that the SSLv2 protocol was not also disabled via + SSL_OP_NO_SSLv2. + + This issue was reported to OpenSSL on 26th December 2015 by Nimrod Aviram + and Sebastian Schinzel. + (CVE-2015-3197) + [Viktor Dukhovni] + + *) Reject DH handshakes with parameters shorter than 1024 bits. + [Kurt Roeckx] + Changes between 1.0.2d and 1.0.2e [3 Dec 2015] *) BN_mod_exp may produce incorrect results on x86_64 @@ -57,7 +334,7 @@ [Emilia Käsper] *) In DSA_generate_parameters_ex, if the provided seed is too short, - return an error + use a random seed, as already documented. [Rich Salz and Ismo Puustinen ] Changes between 1.0.2c and 1.0.2d [9 Jul 2015] diff --git a/vendor/openssl/openssl/Configure b/vendor/openssl/openssl/Configure index ac86cd6cf..c98107a48 100755 --- a/vendor/openssl/openssl/Configure +++ b/vendor/openssl/openssl/Configure @@ -58,6 +58,10 @@ my $usage="Usage: Configure [no- ...] [enable- ...] [experimenta # library and will be loaded in run-time by the OpenSSL library. # sctp include SCTP support # 386 generate 80386 code +# enable-weak-ssl-ciphers +# Enable EXPORT and LOW SSLv3 ciphers that are disabled by +# default. Note, weak SSLv2 ciphers are unconditionally +# disabled. # no-sse2 disables IA-32 SSE2 code, above option implies no-sse2 # no- build without specified algorithm (rsa, idea, rc5, ...) # - + compiler options are passed through @@ -124,6 +128,9 @@ my $clang_disabled_warnings = "-Wno-unused-parameter -Wno-missing-field-initiali # -Wextended-offsetof my $clang_devteam_warn = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof -Qunused-arguments"; +# Warn that "make depend" should be run? +my $warn_make_depend = 0; + my $strict_warnings = 0; my $x86_gcc_des="DES_PTR DES_RISC1 DES_UNROLL"; @@ -778,11 +785,13 @@ my %disabled = ( # "what" => "comment" [or special keyword "experimental "md2" => "default", "rc5" => "default", "rfc3779" => "default", - "sctp" => "default", + "sctp" => "default", "shared" => "default", "ssl-trace" => "default", + "ssl2" => "default", "store" => "experimental", "unit-test" => "default", + "weak-ssl-ciphers" => "default", "zlib" => "default", "zlib-dynamic" => "default" ); @@ -1513,7 +1522,7 @@ if ($target =~ /\-icc$/) # Intel C compiler # linker only when --prefix is not /usr. if ($target =~ /^BSD\-/) { - $shared_ldflag.=" -Wl,-rpath,\$(LIBRPATH)" if ($prefix !~ m|^/usr[/]*$|); + $shared_ldflag.=" -Wl,-rpath,\$\$(LIBRPATH)" if ($prefix !~ m|^/usr[/]*$|); } if ($sys_id ne "") @@ -2028,14 +2037,8 @@ EOF &dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s'); } if ($depflags ne $default_depflags && !$make_depend) { - print < (note that your message will be recorded in the request tracker publicly readable - via http://www.openssl.org/support/rt.html and will be forwarded to a - public mailing list). Include the output of "make report" in your message. - Please check out the request tracker. Maybe the bug was already - reported or has already been fixed. + at https://www.openssl.org/community/index.html#bugs and will be + forwarded to a public mailing list). Include the output of "make + report" in your message. Please check out the request tracker. Maybe + the bug was already reported or has already been fixed. [If you encounter assembler error messages, try the "no-asm" configuration option as an immediate fix.] diff --git a/vendor/openssl/openssl/LICENSE b/vendor/openssl/openssl/LICENSE index e47d101f1..fb03713dd 100644 --- a/vendor/openssl/openssl/LICENSE +++ b/vendor/openssl/openssl/LICENSE @@ -12,7 +12,7 @@ --------------- /* ==================================================================== - * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. + * Copyright (c) 1998-2016 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/vendor/openssl/openssl/Makefile b/vendor/openssl/openssl/Makefile index e2bbb475c..26325cc0d 100644 --- a/vendor/openssl/openssl/Makefile +++ b/vendor/openssl/openssl/Makefile @@ -4,7 +4,7 @@ ## Makefile for OpenSSL ## -VERSION=1.0.2e +VERSION=1.0.2h MAJOR=1 MINOR=0.2 SHLIB_VERSION_NUMBER=1.0.0 @@ -13,7 +13,7 @@ SHLIB_MAJOR=1 SHLIB_MINOR=0.0 SHLIB_EXT= PLATFORM=dist -OPTIONS= no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-libunbound no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-ssl-trace no-store no-unit-test no-zlib no-zlib-dynamic static-engine +OPTIONS= no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-libunbound no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-ssl-trace no-ssl2 no-store no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic static-engine CONFIGURE_ARGS=dist SHLIB_TARGET= @@ -61,11 +61,11 @@ OPENSSLDIR=/usr/local/ssl CC= cc CFLAG= -O -DEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_LIBUNBOUND -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST -PEX_LIBS= -EX_LIBS= -EXE_EXT= -ARFLAGS= +DEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_LIBUNBOUND -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOPENSSL_NO_SSL2 -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST -DOPENSSL_NO_WEAK_SSL_CIPHERS +PEX_LIBS= +EX_LIBS= +EXE_EXT= +ARFLAGS= AR= ar $(ARFLAGS) r RANLIB= /usr/bin/ranlib NM= nm @@ -85,26 +85,26 @@ ASFLAG=$(CFLAG) # For x86 assembler: Set PROCESSOR to 386 if you want to support # the 80386. -PROCESSOR= +PROCESSOR= # CPUID module collects small commonly used assembler snippets CPUID_OBJ= mem_clr.o BN_ASM= bn_asm.o -EC_ASM= +EC_ASM= DES_ENC= des_enc.o fcrypt_b.o AES_ENC= aes_core.o aes_cbc.o BF_ENC= bf_enc.o CAST_ENC= c_enc.o RC4_ENC= rc4_enc.o rc4_skey.o RC5_ENC= rc5_enc.o -MD5_ASM_OBJ= -SHA1_ASM_OBJ= -RMD160_ASM_OBJ= +MD5_ASM_OBJ= +SHA1_ASM_OBJ= +RMD160_ASM_OBJ= WP_ASM_OBJ= wp_block.o CMLL_ENC= camellia.o cmll_misc.o cmll_cbc.o -MODES_ASM_OBJ= -ENGINES_ASM_OBJ= -PERLASM_SCHEME= +MODES_ASM_OBJ= +ENGINES_ASM_OBJ= +PERLASM_SCHEME= # KRB5 stuff KRB5_INCLUDES= @@ -182,8 +182,7 @@ SHARED_LDFLAGS= GENERAL= Makefile BASENAME= openssl NAME= $(BASENAME)-$(VERSION) -TARFILE= $(NAME).tar -WTARFILE= $(NAME)-win.tar +TARFILE= ../$(NAME).tar EXHEADER= e_os2.h HEADER= e_os.h @@ -501,38 +500,35 @@ TABLE: Configure # would occur. Therefore the list of files is temporarily stored into a file # and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal # tar does not support the --files-from option. -TAR_COMMAND=$(TAR) $(TARFLAGS) --files-from ../$(TARFILE).list \ - --owner openssl:0 --group openssl:0 \ - --transform 's|^|openssl-$(VERSION)/|' \ +TAR_COMMAND=$(TAR) $(TARFLAGS) --files-from $(TARFILE).list \ + --owner 0 --group 0 \ + --transform 's|^|$(NAME)/|' \ -cvf - -../$(TARFILE).list: +$(TARFILE).list: find * \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \ \! -name '*.so' \! -name '*.so.*' \! -name 'openssl' \ - \! -name '*test' \! -name '.#*' \! -name '*~' \ - | sort > ../$(TARFILE).list + \( \! -name '*test' -o -name bctest -o -name pod2mantest \) \ + \! -name '.#*' \! -name '*~' \! -type l \ + | sort > $(TARFILE).list -tar: ../$(TARFILE).list +tar: $(TARFILE).list find . -type d -print | xargs chmod 755 find . -type f -print | xargs chmod a+r find . -type f -perm -0100 -print | xargs chmod a+x - $(TAR_COMMAND) | gzip --best >../$(TARFILE).gz - rm -f ../$(TARFILE).list - ls -l ../$(TARFILE).gz + $(TAR_COMMAND) | gzip --best > $(TARFILE).gz + rm -f $(TARFILE).list + ls -l $(TARFILE).gz -tar-snap: ../$(TARFILE).list - $(TAR_COMMAND) > ../$(TARFILE) - rm -f ../$(TARFILE).list - ls -l ../$(TARFILE) +tar-snap: $(TARFILE).list + $(TAR_COMMAND) > $(TARFILE) + rm -f $(TARFILE).list + ls -l $(TARFILE) -dist: +dist: $(PERL) Configure dist - @$(MAKE) dist_pem_h @$(MAKE) SDIRS='$(SDIRS)' clean - @$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' tar - -dist_pem_h: - (cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean) + @$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' $(DISTTARVARS) tar install: all install_docs install_sw @@ -586,9 +582,9 @@ install_sw: *ssl*) i=ssleay32.dll;; \ esac; \ echo installing $$i; \ - cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ - chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ - mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \ + cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ + chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ + mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \ fi; \ fi; \ done; \ diff --git a/vendor/openssl/openssl/Makefile.bak b/vendor/openssl/openssl/Makefile.bak index 27eb08cf3..507740dde 100644 --- a/vendor/openssl/openssl/Makefile.bak +++ b/vendor/openssl/openssl/Makefile.bak @@ -4,18 +4,18 @@ ## Makefile for OpenSSL ## -VERSION=1.0.2e-dev +VERSION=1.0.2h MAJOR=1 MINOR=0.2 SHLIB_VERSION_NUMBER=1.0.0 SHLIB_VERSION_HISTORY= SHLIB_MAJOR=1 SHLIB_MINOR=0.0 -SHLIB_EXT= -PLATFORM=gcc -OPTIONS= no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-libunbound no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-ssl-trace no-store no-unit-test no-zlib no-zlib-dynamic static-engine -CONFIGURE_ARGS=gcc -SHLIB_TARGET= +SHLIB_EXT=.so.$(SHLIB_MAJOR).$(SHLIB_MINOR) +PLATFORM=linux-x86_64 +OPTIONS=-Wa,--noexecstack no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-libunbound no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-ssl-trace no-ssl2 no-store no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic static-engine +CONFIGURE_ARGS=linux-x86_64 -Wa,--noexecstack +SHLIB_TARGET=linux-shared # HERE indicates where this Makefile lives. This can be used to indicate # where sub-Makefiles are expected to be. Currently has very limited usage, @@ -60,12 +60,12 @@ OPENSSLDIR=/usr/local/ssl # PKCS1_CHECK - pkcs1 tests. CC= gcc -CFLAG= -O3 -DEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_LIBUNBOUND -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST -PEX_LIBS= -EX_LIBS= -EXE_EXT= -ARFLAGS= +CFLAG= -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM +DEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_LIBUNBOUND -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOPENSSL_NO_SSL2 -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST -DOPENSSL_NO_WEAK_SSL_CIPHERS +PEX_LIBS= +EX_LIBS= -ldl +EXE_EXT= +ARFLAGS= AR= ar $(ARFLAGS) r RANLIB= /usr/bin/ranlib NM= nm @@ -85,26 +85,26 @@ ASFLAG=$(CFLAG) # For x86 assembler: Set PROCESSOR to 386 if you want to support # the 80386. -PROCESSOR= +PROCESSOR= # CPUID module collects small commonly used assembler snippets -CPUID_OBJ= mem_clr.o -BN_ASM= bn_asm.o -EC_ASM= +CPUID_OBJ= x86_64cpuid.o +BN_ASM= x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o rsaz_exp.o rsaz-x86_64.o rsaz-avx2.o +EC_ASM= ecp_nistz256.o ecp_nistz256-x86_64.o DES_ENC= des_enc.o fcrypt_b.o -AES_ENC= aes_core.o aes_cbc.o +AES_ENC= aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o aesni-sha256-x86_64.o aesni-mb-x86_64.o BF_ENC= bf_enc.o CAST_ENC= c_enc.o -RC4_ENC= rc4_enc.o rc4_skey.o +RC4_ENC= rc4-x86_64.o rc4-md5-x86_64.o RC5_ENC= rc5_enc.o -MD5_ASM_OBJ= -SHA1_ASM_OBJ= -RMD160_ASM_OBJ= -WP_ASM_OBJ= wp_block.o -CMLL_ENC= camellia.o cmll_misc.o cmll_cbc.o -MODES_ASM_OBJ= -ENGINES_ASM_OBJ= -PERLASM_SCHEME= +MD5_ASM_OBJ= md5-x86_64.o +SHA1_ASM_OBJ= sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o sha1-mb-x86_64.o sha256-mb-x86_64.o +RMD160_ASM_OBJ= +WP_ASM_OBJ= wp-x86_64.o +CMLL_ENC= cmll-x86_64.o cmll_misc.o +MODES_ASM_OBJ= ghash-x86_64.o aesni-gcm-x86_64.o +ENGINES_ASM_OBJ= +PERLASM_SCHEME= elf # KRB5 stuff KRB5_INCLUDES= @@ -176,14 +176,13 @@ LIBS= libcrypto.a libssl.a SHARED_CRYPTO=libcrypto$(SHLIB_EXT) SHARED_SSL=libssl$(SHLIB_EXT) SHARED_LIBS= -SHARED_LIBS_LINK_EXTS= -SHARED_LDFLAGS= +SHARED_LIBS_LINK_EXTS=.so.$(SHLIB_MAJOR) .so +SHARED_LDFLAGS=-m64 GENERAL= Makefile BASENAME= openssl NAME= $(BASENAME)-$(VERSION) -TARFILE= $(NAME).tar -WTARFILE= $(NAME)-win.tar +TARFILE= ../$(NAME).tar EXHEADER= e_os2.h HEADER= e_os.h @@ -501,38 +500,35 @@ TABLE: Configure # would occur. Therefore the list of files is temporarily stored into a file # and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal # tar does not support the --files-from option. -TAR_COMMAND=$(TAR) $(TARFLAGS) --files-from ../$(TARFILE).list \ - --owner openssl:0 --group openssl:0 \ - --transform 's|^|openssl-$(VERSION)/|' \ +TAR_COMMAND=$(TAR) $(TARFLAGS) --files-from $(TARFILE).list \ + --owner 0 --group 0 \ + --transform 's|^|$(NAME)/|' \ -cvf - -../$(TARFILE).list: +$(TARFILE).list: find * \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \ \! -name '*.so' \! -name '*.so.*' \! -name 'openssl' \ - \! -name '*test' \! -name '.#*' \! -name '*~' \ - | sort > ../$(TARFILE).list + \( \! -name '*test' -o -name bctest -o -name pod2mantest \) \ + \! -name '.#*' \! -name '*~' \! -type l \ + | sort > $(TARFILE).list -tar: ../$(TARFILE).list +tar: $(TARFILE).list find . -type d -print | xargs chmod 755 find . -type f -print | xargs chmod a+r find . -type f -perm -0100 -print | xargs chmod a+x - $(TAR_COMMAND) | gzip --best >../$(TARFILE).gz - rm -f ../$(TARFILE).list - ls -l ../$(TARFILE).gz + $(TAR_COMMAND) | gzip --best > $(TARFILE).gz + rm -f $(TARFILE).list + ls -l $(TARFILE).gz -tar-snap: ../$(TARFILE).list - $(TAR_COMMAND) > ../$(TARFILE) - rm -f ../$(TARFILE).list - ls -l ../$(TARFILE) +tar-snap: $(TARFILE).list + $(TAR_COMMAND) > $(TARFILE) + rm -f $(TARFILE).list + ls -l $(TARFILE) -dist: +dist: $(PERL) Configure dist - @$(MAKE) dist_pem_h @$(MAKE) SDIRS='$(SDIRS)' clean - @$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' tar - -dist_pem_h: - (cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean) + @$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' $(DISTTARVARS) tar install: all install_docs install_sw @@ -586,9 +582,9 @@ install_sw: *ssl*) i=ssleay32.dll;; \ esac; \ echo installing $$i; \ - cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ - chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ - mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \ + cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ + chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ + mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \ fi; \ fi; \ done; \ diff --git a/vendor/openssl/openssl/Makefile.org b/vendor/openssl/openssl/Makefile.org index 033364441..76fdbdf6a 100644 --- a/vendor/openssl/openssl/Makefile.org +++ b/vendor/openssl/openssl/Makefile.org @@ -180,8 +180,7 @@ SHARED_LDFLAGS= GENERAL= Makefile BASENAME= openssl NAME= $(BASENAME)-$(VERSION) -TARFILE= $(NAME).tar -WTARFILE= $(NAME)-win.tar +TARFILE= ../$(NAME).tar EXHEADER= e_os2.h HEADER= e_os.h @@ -499,38 +498,35 @@ TABLE: Configure # would occur. Therefore the list of files is temporarily stored into a file # and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal # tar does not support the --files-from option. -TAR_COMMAND=$(TAR) $(TARFLAGS) --files-from ../$(TARFILE).list \ - --owner openssl:0 --group openssl:0 \ - --transform 's|^|openssl-$(VERSION)/|' \ +TAR_COMMAND=$(TAR) $(TARFLAGS) --files-from $(TARFILE).list \ + --owner 0 --group 0 \ + --transform 's|^|$(NAME)/|' \ -cvf - -../$(TARFILE).list: +$(TARFILE).list: find * \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \ \! -name '*.so' \! -name '*.so.*' \! -name 'openssl' \ - \! -name '*test' \! -name '.#*' \! -name '*~' \ - | sort > ../$(TARFILE).list + \( \! -name '*test' -o -name bctest -o -name pod2mantest \) \ + \! -name '.#*' \! -name '*~' \! -type l \ + | sort > $(TARFILE).list -tar: ../$(TARFILE).list +tar: $(TARFILE).list find . -type d -print | xargs chmod 755 find . -type f -print | xargs chmod a+r find . -type f -perm -0100 -print | xargs chmod a+x - $(TAR_COMMAND) | gzip --best >../$(TARFILE).gz - rm -f ../$(TARFILE).list - ls -l ../$(TARFILE).gz + $(TAR_COMMAND) | gzip --best > $(TARFILE).gz + rm -f $(TARFILE).list + ls -l $(TARFILE).gz -tar-snap: ../$(TARFILE).list - $(TAR_COMMAND) > ../$(TARFILE) - rm -f ../$(TARFILE).list - ls -l ../$(TARFILE) +tar-snap: $(TARFILE).list + $(TAR_COMMAND) > $(TARFILE) + rm -f $(TARFILE).list + ls -l $(TARFILE) dist: $(PERL) Configure dist - @$(MAKE) dist_pem_h @$(MAKE) SDIRS='$(SDIRS)' clean - @$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' tar - -dist_pem_h: - (cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean) + @$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' $(DISTTARVARS) tar install: all install_docs install_sw diff --git a/vendor/openssl/openssl/Makefile.shared b/vendor/openssl/openssl/Makefile.shared index e753f44e1..a2aa9804c 100644 --- a/vendor/openssl/openssl/Makefile.shared +++ b/vendor/openssl/openssl/Makefile.shared @@ -272,7 +272,7 @@ link_o.cygwin: SHLIB_SOVER=${LIBVERSION:+"-$(LIBVERSION)"}; \ ALLSYMSFLAGS='-Wl,--whole-archive'; \ NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \ - SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base $$deffile -Wl,-s,-Bsymbolic"; \ + SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base $$deffile -Wl,-Bsymbolic"; \ $(LINK_SO_O) #for mingw target if def-file is in use dll-name should match library-name link_a.cygwin: @@ -289,7 +289,7 @@ link_a.cygwin: SHLIB_SOVER=32; \ extras="$(LIBNAME).def"; \ $(PERL) util/mkdef.pl 32 $$SHLIB > $$extras; \ - base=; [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \ + base=; [ $(LIBNAME) = "crypto" -a -n "$(FIPSCANLIB)" ] && base=-Wl,--image-base,0x63000000; \ fi; \ dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \ $(PERL) util/mkrc.pl $$dll_name | \ @@ -297,7 +297,7 @@ link_a.cygwin: extras="$$extras rc.o"; \ ALLSYMSFLAGS='-Wl,--whole-archive'; \ NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \ - SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-s,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a $$extras"; \ + SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a $$extras"; \ [ -f apps/$$dll_name ] && rm apps/$$dll_name; \ [ -f test/$$dll_name ] && rm test/$$dll_name; \ $(LINK_SO_A) || exit 1; \ diff --git a/vendor/openssl/openssl/NEWS b/vendor/openssl/openssl/NEWS index e1c78f834..6c85116fc 100644 --- a/vendor/openssl/openssl/NEWS +++ b/vendor/openssl/openssl/NEWS @@ -5,6 +5,37 @@ This file gives a brief overview of the major changes between each OpenSSL release. For more details please read the CHANGES file. + Major changes between OpenSSL 1.0.2g and OpenSSL 1.0.2h [3 May 2016] + + o Prevent padding oracle in AES-NI CBC MAC check (CVE-2016-2107) + o Fix EVP_EncodeUpdate overflow (CVE-2016-2105) + o Fix EVP_EncryptUpdate overflow (CVE-2016-2106) + o Prevent ASN.1 BIO excessive memory allocation (CVE-2016-2109) + o EBCDIC overread (CVE-2016-2176) + o Modify behavior of ALPN to invoke callback after SNI/servername + callback, such that updates to the SSL_CTX affect ALPN. + o Remove LOW from the DEFAULT cipher list. This removes singles DES from + the default. + o Only remove the SSLv2 methods with the no-ssl2-method option. + + Major changes between OpenSSL 1.0.2f and OpenSSL 1.0.2g [1 Mar 2016] + + o Disable weak ciphers in SSLv3 and up in default builds of OpenSSL. + o Disable SSLv2 default build, default negotiation and weak ciphers + (CVE-2016-0800) + o Fix a double-free in DSA code (CVE-2016-0705) + o Disable SRP fake user seed to address a server memory leak + (CVE-2016-0798) + o Fix BN_hex2bn/BN_dec2bn NULL pointer deref/heap corruption + (CVE-2016-0797) + o Fix memory issues in BIO_*printf functions (CVE-2016-0799) + o Fix side channel attack on modular exponentiation (CVE-2016-0702) + + Major changes between OpenSSL 1.0.2e and OpenSSL 1.0.2f [28 Jan 2016] + + o DH small subgroups (CVE-2016-0701) + o SSLv2 doesn't block disabled ciphers (CVE-2015-3197) + Major changes between OpenSSL 1.0.2d and OpenSSL 1.0.2e [3 Dec 2015] o BN_mod_exp may produce incorrect results on x86_64 (CVE-2015-3193) diff --git a/vendor/openssl/openssl/README b/vendor/openssl/openssl/README index 49c4c9f14..b880eec2d 100644 --- a/vendor/openssl/openssl/README +++ b/vendor/openssl/openssl/README @@ -1,5 +1,5 @@ - OpenSSL 1.0.2e 3 Dec 2015 + OpenSSL 1.0.2h 3 May 2016 Copyright (c) 1998-2015 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson @@ -90,11 +90,12 @@ In order to avoid spam, this is a moderated mailing list, and it might take a day for the ticket to show up. (We also scan posts to make sure - that security disclosures aren't publically posted by mistake.) Mail to - this address is recorded in the public RT (request tracker) database (see - https://www.openssl.org/support/rt.html for details) and also forwarded - the public openssl-dev mailing list. Confidential mail may be sent to - openssl-security@openssl.org (PGP key available from the key servers). + that security disclosures aren't publically posted by mistake.) Mail + to this address is recorded in the public RT (request tracker) database + (see https://www.openssl.org/community/index.html#bugs for details) and + also forwarded the public openssl-dev mailing list. Confidential mail + may be sent to openssl-security@openssl.org (PGP key available from the + key servers). Please do NOT use this for general assistance or support queries. Just because something doesn't work the way you expect does not mean it diff --git a/vendor/openssl/openssl/apps/CA.pl b/vendor/openssl/openssl/apps/CA.pl index a3965ecea..6bf9311a3 100644 --- a/vendor/openssl/openssl/apps/CA.pl +++ b/vendor/openssl/openssl/apps/CA.pl @@ -5,10 +5,10 @@ # things easier between now and when Eric is convinced to fix it :-) # # CA -newca ... will setup the right stuff -# CA -newreq[-nodes] ... will generate a certificate request -# CA -sign ... will sign the generated request and output +# CA -newreq[-nodes] ... will generate a certificate request +# CA -sign ... will sign the generated request and output # -# At the end of that grab newreq.pem and newcert.pem (one has the key +# At the end of that grab newreq.pem and newcert.pem (one has the key # and the other the certificate) and cat them together and that is what # you want/need ... I'll make even this a little cleaner later. # @@ -83,7 +83,7 @@ print "Request is in newreq.pem, private key is in newkey.pem\n"; } elsif (/^-newca$/) { # if explicitly asked for or it doesn't exist then setup the - # directory structure that Eric likes to manage things + # directory structure that Eric likes to manage things $NEW="1"; if ( "$NEW" || ! -f "${CATOP}/serial" ) { # create the directory hierarchy @@ -114,7 +114,7 @@ system ("$REQ -new -keyout " . "${CATOP}/private/$CAKEY -out ${CATOP}/$CAREQ"); system ("$CA -create_serial " . - "-out ${CATOP}/$CACERT $CADAYS -batch " . + "-out ${CATOP}/$CACERT $CADAYS -batch " . "-keyfile ${CATOP}/private/$CAKEY -selfsign " . "-extensions v3_ca " . "-infiles ${CATOP}/$CAREQ "); @@ -160,7 +160,7 @@ } else { system ("$VERIFY -CAfile $CATOP/$CACERT newcert.pem"); $RET=$?; - exit 0; + exit 0; } } else { print STDERR "Unknown arg $_\n"; @@ -186,4 +186,3 @@ sub cp_pem { } } } - diff --git a/vendor/openssl/openssl/apps/app_rand.c b/vendor/openssl/openssl/apps/app_rand.c index ef0dd2ba8..b6fe294a6 100644 --- a/vendor/openssl/openssl/apps/app_rand.c +++ b/vendor/openssl/openssl/apps/app_rand.c @@ -129,7 +129,10 @@ int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn) * -no_rand_screen option in s_client */ if (dont_warn != 2) { + BIO_printf(bio_e, "Loading 'screen' into random state -"); + BIO_flush(bio_e); RAND_screen(); + BIO_printf(bio_e, " done\n"); } #endif diff --git a/vendor/openssl/openssl/apps/apps.c b/vendor/openssl/openssl/apps/apps.c index 2e778054c..b1dd97038 100644 --- a/vendor/openssl/openssl/apps/apps.c +++ b/vendor/openssl/openssl/apps/apps.c @@ -2442,7 +2442,11 @@ int bio_to_mem(unsigned char **out, int maxlen, BIO *in) else len = 1024; len = BIO_read(in, tbuf, len); - if (len <= 0) + if (len < 0) { + BIO_free(mem); + return -1; + } + if (len == 0) break; if (BIO_write(mem, tbuf, len) != len) { BIO_free(mem); @@ -2459,7 +2463,7 @@ int bio_to_mem(unsigned char **out, int maxlen, BIO *in) return ret; } -int pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value) +int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value) { int rv; char *stmp, *vtmp = NULL; diff --git a/vendor/openssl/openssl/apps/apps.h b/vendor/openssl/openssl/apps/apps.h index 8276e7086..19bf5cc33 100644 --- a/vendor/openssl/openssl/apps/apps.h +++ b/vendor/openssl/openssl/apps/apps.h @@ -321,7 +321,7 @@ int args_verify(char ***pargs, int *pargc, int *badarg, BIO *err, X509_VERIFY_PARAM **pm); void policies_print(BIO *out, X509_STORE_CTX *ctx); int bio_to_mem(unsigned char **out, int maxlen, BIO *in); -int pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value); +int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value); int init_gen_str(BIO *err, EVP_PKEY_CTX **pctx, const char *algname, ENGINE *e, int do_param); int do_X509_sign(BIO *err, X509 *x, EVP_PKEY *pkey, const EVP_MD *md, diff --git a/vendor/openssl/openssl/apps/engine.c b/vendor/openssl/openssl/apps/engine.c index 460ec60cb..f54631b50 100644 --- a/vendor/openssl/openssl/apps/engine.c +++ b/vendor/openssl/openssl/apps/engine.c @@ -1,4 +1,4 @@ -/* apps/engine.c -*- mode: C; c-file-style: "eay" -*- */ +/* apps/engine.c */ /* * Written by Richard Levitte for the OpenSSL project * 2000. diff --git a/vendor/openssl/openssl/apps/ocsp.c b/vendor/openssl/openssl/apps/ocsp.c index 6ed255d4b..5da51df51 100644 --- a/vendor/openssl/openssl/apps/ocsp.c +++ b/vendor/openssl/openssl/apps/ocsp.c @@ -1041,7 +1041,7 @@ static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, bs = OCSP_BASICRESP_new(); thisupd = X509_gmtime_adj(NULL, 0); if (ndays != -1) - nextupd = X509_gmtime_adj(NULL, nmin * 60 + ndays * 3600 * 24); + nextupd = X509_time_adj_ex(NULL, ndays, nmin * 60, NULL); /* Examine each certificate id in the request */ for (i = 0; i < id_count; i++) { diff --git a/vendor/openssl/openssl/apps/pkcs12.c b/vendor/openssl/openssl/apps/pkcs12.c index e41b445a5..cbb75b7d5 100644 --- a/vendor/openssl/openssl/apps/pkcs12.c +++ b/vendor/openssl/openssl/apps/pkcs12.c @@ -79,7 +79,8 @@ const EVP_CIPHER *enc; # define CLCERTS 0x8 # define CACERTS 0x10 -int get_cert_chain(X509 *cert, X509_STORE *store, STACK_OF(X509) **chain); +static int get_cert_chain(X509 *cert, X509_STORE *store, + STACK_OF(X509) **chain); int dump_certs_keys_p12(BIO *out, PKCS12 *p12, char *pass, int passlen, int options, char *pempass); int dump_certs_pkeys_bags(BIO *out, STACK_OF(PKCS12_SAFEBAG) *bags, @@ -594,7 +595,7 @@ int MAIN(int argc, char **argv) vret = get_cert_chain(ucert, store, &chain2); X509_STORE_free(store); - if (!vret) { + if (vret == X509_V_OK) { /* Exclude verified certificate */ for (i = 1; i < sk_X509_num(chain2); i++) sk_X509_push(certs, sk_X509_value(chain2, i)); @@ -602,7 +603,7 @@ int MAIN(int argc, char **argv) X509_free(sk_X509_value(chain2, 0)); sk_X509_free(chain2); } else { - if (vret >= 0) + if (vret != X509_V_ERR_UNSPECIFIED) BIO_printf(bio_err, "Error %s getting chain.\n", X509_verify_cert_error_string(vret)); else @@ -906,36 +907,25 @@ int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bag, char *pass, /* Given a single certificate return a verified chain or NULL if error */ -/* Hope this is OK .... */ - -int get_cert_chain(X509 *cert, X509_STORE *store, STACK_OF(X509) **chain) +static int get_cert_chain(X509 *cert, X509_STORE *store, + STACK_OF(X509) **chain) { X509_STORE_CTX store_ctx; - STACK_OF(X509) *chn; + STACK_OF(X509) *chn = NULL; int i = 0; - /* - * FIXME: Should really check the return status of X509_STORE_CTX_init - * for an error, but how that fits into the return value of this function - * is less obvious. - */ - X509_STORE_CTX_init(&store_ctx, store, cert, NULL); - if (X509_verify_cert(&store_ctx) <= 0) { - i = X509_STORE_CTX_get_error(&store_ctx); - if (i == 0) - /* - * avoid returning 0 if X509_verify_cert() did not set an - * appropriate error value in the context - */ - i = -1; - chn = NULL; - goto err; - } else + if (!X509_STORE_CTX_init(&store_ctx, store, cert, NULL)) { + *chain = NULL; + return X509_V_ERR_UNSPECIFIED; + } + + if (X509_verify_cert(&store_ctx) > 0) chn = X509_STORE_CTX_get1_chain(&store_ctx); - err: + else if ((i = X509_STORE_CTX_get_error(&store_ctx)) == 0) + i = X509_V_ERR_UNSPECIFIED; + X509_STORE_CTX_cleanup(&store_ctx); *chain = chn; - return i; } diff --git a/vendor/openssl/openssl/apps/pkcs7.c b/vendor/openssl/openssl/apps/pkcs7.c index 643507f21..b67763318 100644 --- a/vendor/openssl/openssl/apps/pkcs7.c +++ b/vendor/openssl/openssl/apps/pkcs7.c @@ -235,12 +235,16 @@ int MAIN(int argc, char **argv) i = OBJ_obj2nid(p7->type); switch (i) { case NID_pkcs7_signed: - certs = p7->d.sign->cert; - crls = p7->d.sign->crl; + if (p7->d.sign != NULL) { + certs = p7->d.sign->cert; + crls = p7->d.sign->crl; + } break; case NID_pkcs7_signedAndEnveloped: - certs = p7->d.signed_and_enveloped->cert; - crls = p7->d.signed_and_enveloped->crl; + if (p7->d.signed_and_enveloped != NULL) { + certs = p7->d.signed_and_enveloped->cert; + crls = p7->d.signed_and_enveloped->crl; + } break; default: break; diff --git a/vendor/openssl/openssl/apps/pkeyutl.c b/vendor/openssl/openssl/apps/pkeyutl.c index aaa90740a..39faa451a 100644 --- a/vendor/openssl/openssl/apps/pkeyutl.c +++ b/vendor/openssl/openssl/apps/pkeyutl.c @@ -73,11 +73,12 @@ static void usage(void); #define PROG pkeyutl_main static EVP_PKEY_CTX *init_ctx(int *pkeysize, - char *keyfile, int keyform, int key_type, - char *passargin, int pkey_op, ENGINE *e); + const char *keyfile, int keyform, int key_type, + char *passargin, int pkey_op, ENGINE *e, + int impl); static int setup_peer(BIO *err, EVP_PKEY_CTX *ctx, int peerform, - const char *file); + const char *file, ENGINE* e); static int do_keyop(EVP_PKEY_CTX *ctx, int pkey_op, unsigned char *out, size_t *poutlen, @@ -97,10 +98,13 @@ int MAIN(int argc, char **argv) EVP_PKEY_CTX *ctx = NULL; char *passargin = NULL; int keysize = -1; - + int engine_impl = 0; unsigned char *buf_in = NULL, *buf_out = NULL, *sig = NULL; - size_t buf_outlen; + size_t buf_outlen = 0; int buf_inlen = 0, siglen = -1; + const char *inkey = NULL; + const char *peerkey = NULL; + STACK_OF(OPENSSL_STRING) *pkeyopts = NULL; int ret = 1, rv = -1; @@ -134,21 +138,13 @@ int MAIN(int argc, char **argv) } else if (!strcmp(*argv, "-inkey")) { if (--argc < 1) badarg = 1; - else { - ctx = init_ctx(&keysize, - *(++argv), keyform, key_type, - passargin, pkey_op, e); - if (!ctx) { - BIO_puts(bio_err, "Error initializing context\n"); - ERR_print_errors(bio_err); - badarg = 1; - } - } + else + inkey = *++argv; } else if (!strcmp(*argv, "-peerkey")) { if (--argc < 1) badarg = 1; - else if (!setup_peer(bio_err, ctx, peerform, *(++argv))) - badarg = 1; + else + peerkey = *++argv; } else if (!strcmp(*argv, "-passin")) { if (--argc < 1) badarg = 1; @@ -171,6 +167,8 @@ int MAIN(int argc, char **argv) badarg = 1; else e = setup_engine(bio_err, *(++argv), 0); + } else if (!strcmp(*argv, "-engine_impl")) { + engine_impl = 1; } #endif else if (!strcmp(*argv, "-pubin")) @@ -187,23 +185,21 @@ int MAIN(int argc, char **argv) pkey_op = EVP_PKEY_OP_VERIFY; else if (!strcmp(*argv, "-verifyrecover")) pkey_op = EVP_PKEY_OP_VERIFYRECOVER; - else if (!strcmp(*argv, "-rev")) - rev = 1; else if (!strcmp(*argv, "-encrypt")) pkey_op = EVP_PKEY_OP_ENCRYPT; else if (!strcmp(*argv, "-decrypt")) pkey_op = EVP_PKEY_OP_DECRYPT; else if (!strcmp(*argv, "-derive")) pkey_op = EVP_PKEY_OP_DERIVE; + else if (!strcmp(*argv, "-rev")) + rev = 1; else if (strcmp(*argv, "-pkeyopt") == 0) { if (--argc < 1) badarg = 1; - else if (!ctx) { - BIO_puts(bio_err, "-pkeyopt command before -inkey\n"); - badarg = 1; - } else if (pkey_ctrl_string(ctx, *(++argv)) <= 0) { - BIO_puts(bio_err, "parameter setting error\n"); - ERR_print_errors(bio_err); + else if ((pkeyopts == NULL && + (pkeyopts = sk_OPENSSL_STRING_new_null()) == NULL) || + sk_OPENSSL_STRING_push(pkeyopts, *++argv) == 0) { + BIO_puts(bio_err, "out of memory\n"); goto end; } } else @@ -216,10 +212,37 @@ int MAIN(int argc, char **argv) argv++; } - if (!ctx) { + if (inkey == NULL || + (peerkey != NULL && pkey_op != EVP_PKEY_OP_DERIVE)) { usage(); goto end; } + ctx = init_ctx(&keysize, inkey, keyform, key_type, + passargin, pkey_op, e, engine_impl); + if (!ctx) { + BIO_puts(bio_err, "Error initializing context\n"); + ERR_print_errors(bio_err); + goto end; + } + if (peerkey != NULL && !setup_peer(bio_err, ctx, peerform, peerkey, e)) { + BIO_puts(bio_err, "Error setting up peer key\n"); + ERR_print_errors(bio_err); + goto end; + } + if (pkeyopts != NULL) { + int num = sk_OPENSSL_STRING_num(pkeyopts); + int i; + + for (i = 0; i < num; ++i) { + const char *opt = sk_OPENSSL_STRING_value(pkeyopts, i); + + if (pkey_ctrl_string(ctx, opt) <= 0) { + BIO_puts(bio_err, "parameter setting error\n"); + ERR_print_errors(bio_err); + goto end; + } + } + } if (sigfile && (pkey_op != EVP_PKEY_OP_VERIFY)) { BIO_puts(bio_err, "Signature file specified for non verify\n"); @@ -269,7 +292,7 @@ int MAIN(int argc, char **argv) } siglen = bio_to_mem(&sig, keysize * 10, sigbio); BIO_free(sigbio); - if (siglen <= 0) { + if (siglen < 0) { BIO_printf(bio_err, "Error reading signature data\n"); goto end; } @@ -278,7 +301,7 @@ int MAIN(int argc, char **argv) if (in) { /* Read the input data */ buf_inlen = bio_to_mem(&buf_in, keysize * 10, in); - if (buf_inlen <= 0) { + if (buf_inlen < 0) { BIO_printf(bio_err, "Error reading input Data\n"); exit(1); } @@ -306,7 +329,7 @@ int MAIN(int argc, char **argv) } else { rv = do_keyop(ctx, pkey_op, NULL, (size_t *)&buf_outlen, buf_in, (size_t)buf_inlen); - if (rv > 0) { + if (rv > 0 && buf_outlen != 0) { buf_out = OPENSSL_malloc(buf_outlen); if (!buf_out) rv = -1; @@ -336,12 +359,14 @@ int MAIN(int argc, char **argv) EVP_PKEY_CTX_free(ctx); BIO_free(in); BIO_free_all(out); - if (buf_in) + if (buf_in != NULL) OPENSSL_free(buf_in); - if (buf_out) + if (buf_out != NULL) OPENSSL_free(buf_out); - if (sig) + if (sig != NULL) OPENSSL_free(sig); + if (pkeyopts != NULL) + sk_OPENSSL_STRING_free(pkeyopts); return ret; } @@ -368,18 +393,21 @@ static void usage() BIO_printf(bio_err, "-hexdump hex dump output\n"); #ifndef OPENSSL_NO_ENGINE BIO_printf(bio_err, - "-engine e use engine e, possibly a hardware device.\n"); + "-engine e use engine e, maybe a hardware device, for loading keys.\n"); + BIO_printf(bio_err, "-engine_impl also use engine given by -engine for crypto operations\n"); #endif BIO_printf(bio_err, "-passin arg pass phrase source\n"); } static EVP_PKEY_CTX *init_ctx(int *pkeysize, - char *keyfile, int keyform, int key_type, - char *passargin, int pkey_op, ENGINE *e) + const char *keyfile, int keyform, int key_type, + char *passargin, int pkey_op, ENGINE *e, + int engine_impl) { EVP_PKEY *pkey = NULL; EVP_PKEY_CTX *ctx = NULL; + ENGINE *impl = NULL; char *passin = NULL; int rv = -1; X509 *x; @@ -419,7 +447,12 @@ static EVP_PKEY_CTX *init_ctx(int *pkeysize, if (!pkey) goto end; - ctx = EVP_PKEY_CTX_new(pkey, e); +#ifndef OPENSSL_NO_ENGINE + if (engine_impl) + impl = e; +#endif + + ctx = EVP_PKEY_CTX_new(pkey, impl); EVP_PKEY_free(pkey); @@ -467,16 +500,15 @@ static EVP_PKEY_CTX *init_ctx(int *pkeysize, } static int setup_peer(BIO *err, EVP_PKEY_CTX *ctx, int peerform, - const char *file) + const char *file, ENGINE* e) { EVP_PKEY *peer = NULL; + ENGINE* engine = NULL; int ret; - if (!ctx) { - BIO_puts(err, "-peerkey command before -inkey\n"); - return 0; - } - peer = load_pubkey(bio_err, file, peerform, 0, NULL, NULL, "Peer Key"); + if (peerform == FORMAT_ENGINE) + engine = e; + peer = load_pubkey(bio_err, file, peerform, 0, NULL, engine, "Peer Key"); if (!peer) { BIO_printf(bio_err, "Error reading peer key %s\n", file); diff --git a/vendor/openssl/openssl/apps/req.c b/vendor/openssl/openssl/apps/req.c index 57781c93c..e818bd297 100644 --- a/vendor/openssl/openssl/apps/req.c +++ b/vendor/openssl/openssl/apps/req.c @@ -101,8 +101,8 @@ #define STRING_MASK "string_mask" #define UTF8_IN "utf8" -#define DEFAULT_KEY_LENGTH 512 -#define MIN_KEY_LENGTH 384 +#define DEFAULT_KEY_LENGTH 2048 +#define MIN_KEY_LENGTH 512 #undef PROG #define PROG req_main diff --git a/vendor/openssl/openssl/apps/rsautl.c b/vendor/openssl/openssl/apps/rsautl.c index d642f9ad9..5b6f849ea 100644 --- a/vendor/openssl/openssl/apps/rsautl.c +++ b/vendor/openssl/openssl/apps/rsautl.c @@ -250,7 +250,7 @@ int MAIN(int argc, char **argv) if (outfile) { if (!(out = BIO_new_file(outfile, "wb"))) { - BIO_printf(bio_err, "Error Reading Output File\n"); + BIO_printf(bio_err, "Error Writing Output File\n"); ERR_print_errors(bio_err); goto end; } @@ -276,7 +276,7 @@ int MAIN(int argc, char **argv) /* Read the input data */ rsa_inlen = BIO_read(in, rsa_in, keysize * 2); - if (rsa_inlen <= 0) { + if (rsa_inlen < 0) { BIO_printf(bio_err, "Error reading input Data\n"); exit(1); } @@ -311,7 +311,7 @@ int MAIN(int argc, char **argv) } - if (rsa_outlen <= 0) { + if (rsa_outlen < 0) { BIO_printf(bio_err, "RSA operation error\n"); ERR_print_errors(bio_err); goto end; diff --git a/vendor/openssl/openssl/apps/s_client.c b/vendor/openssl/openssl/apps/s_client.c index 95fe6d48c..bc8004a55 100644 --- a/vendor/openssl/openssl/apps/s_client.c +++ b/vendor/openssl/openssl/apps/s_client.c @@ -316,7 +316,7 @@ static void sc_usage(void) " -connect host:port - who to connect to (default is %s:%s)\n", SSL_HOST_NAME, PORT_STR); BIO_printf(bio_err, - " -verify_host host - check peer certificate matches \"host\"\n"); + " -verify_hostname host - check peer certificate matches \"host\"\n"); BIO_printf(bio_err, " -verify_email email - check peer certificate matches \"email\"\n"); BIO_printf(bio_err, @@ -398,8 +398,6 @@ static void sc_usage(void) " -no_tls1_2/-no_tls1_1/-no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n"); BIO_printf(bio_err, " -bugs - Switch on all SSL implementation bug workarounds\n"); - BIO_printf(bio_err, - " -serverpref - Use server's cipher preferences (only SSLv2)\n"); BIO_printf(bio_err, " -cipher - preferred cipher to use, use the 'openssl ciphers'\n"); BIO_printf(bio_err, diff --git a/vendor/openssl/openssl/apps/s_server.c b/vendor/openssl/openssl/apps/s_server.c index f19532b75..09c755b55 100644 --- a/vendor/openssl/openssl/apps/s_server.c +++ b/vendor/openssl/openssl/apps/s_server.c @@ -429,6 +429,8 @@ typedef struct srpsrvparm_st { static int MS_CALLBACK ssl_srp_server_param_cb(SSL *s, int *ad, void *arg) { srpsrvparm *p = (srpsrvparm *) arg; + int ret = SSL3_AL_FATAL; + if (p->login == NULL && p->user == NULL) { p->login = SSL_get_srp_username(s); BIO_printf(bio_err, "SRP username = \"%s\"\n", p->login); @@ -437,21 +439,25 @@ static int MS_CALLBACK ssl_srp_server_param_cb(SSL *s, int *ad, void *arg) if (p->user == NULL) { BIO_printf(bio_err, "User %s doesn't exist\n", p->login); - return SSL3_AL_FATAL; + goto err; } + if (SSL_set_srp_server_param (s, p->user->N, p->user->g, p->user->s, p->user->v, p->user->info) < 0) { *ad = SSL_AD_INTERNAL_ERROR; - return SSL3_AL_FATAL; + goto err; } BIO_printf(bio_err, "SRP parameters set: username = \"%s\" info=\"%s\" \n", p->login, p->user->info); - /* need to check whether there are memory leaks */ + ret = SSL_ERROR_NONE; + +err: + SRP_user_pwd_free(p->user); p->user = NULL; p->login = NULL; - return SSL_ERROR_NONE; + return ret; } #endif @@ -498,7 +504,7 @@ static void sv_usage(void) BIO_printf(bio_err, " -accept arg - port to accept on (default is %d)\n", PORT); BIO_printf(bio_err, - " -verify_host host - check peer certificate matches \"host\"\n"); + " -verify_hostname host - check peer certificate matches \"host\"\n"); BIO_printf(bio_err, " -verify_email email - check peer certificate matches \"email\"\n"); BIO_printf(bio_err, @@ -2452,9 +2458,10 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context) #ifndef OPENSSL_NO_SRP while (SSL_get_error(con, k) == SSL_ERROR_WANT_X509_LOOKUP) { BIO_printf(bio_s_out, "LOOKUP renego during write\n"); + SRP_user_pwd_free(srp_callback_parm.user); srp_callback_parm.user = - SRP_VBASE_get_by_user(srp_callback_parm.vb, - srp_callback_parm.login); + SRP_VBASE_get1_by_user(srp_callback_parm.vb, + srp_callback_parm.login); if (srp_callback_parm.user) BIO_printf(bio_s_out, "LOOKUP done %s\n", srp_callback_parm.user->info); @@ -2508,9 +2515,10 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context) #ifndef OPENSSL_NO_SRP while (SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP) { BIO_printf(bio_s_out, "LOOKUP renego during read\n"); + SRP_user_pwd_free(srp_callback_parm.user); srp_callback_parm.user = - SRP_VBASE_get_by_user(srp_callback_parm.vb, - srp_callback_parm.login); + SRP_VBASE_get1_by_user(srp_callback_parm.vb, + srp_callback_parm.login); if (srp_callback_parm.user) BIO_printf(bio_s_out, "LOOKUP done %s\n", srp_callback_parm.user->info); @@ -2605,9 +2613,10 @@ static int init_ssl_connection(SSL *con) while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP) { BIO_printf(bio_s_out, "LOOKUP during accept %s\n", srp_callback_parm.login); + SRP_user_pwd_free(srp_callback_parm.user); srp_callback_parm.user = - SRP_VBASE_get_by_user(srp_callback_parm.vb, - srp_callback_parm.login); + SRP_VBASE_get1_by_user(srp_callback_parm.vb, + srp_callback_parm.login); if (srp_callback_parm.user) BIO_printf(bio_s_out, "LOOKUP done %s\n", srp_callback_parm.user->info); @@ -2849,9 +2858,10 @@ static int www_body(char *hostname, int s, int stype, unsigned char *context) && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP) { BIO_printf(bio_s_out, "LOOKUP during accept %s\n", srp_callback_parm.login); + SRP_user_pwd_free(srp_callback_parm.user); srp_callback_parm.user = - SRP_VBASE_get_by_user(srp_callback_parm.vb, - srp_callback_parm.login); + SRP_VBASE_get1_by_user(srp_callback_parm.vb, + srp_callback_parm.login); if (srp_callback_parm.user) BIO_printf(bio_s_out, "LOOKUP done %s\n", srp_callback_parm.user->info); @@ -2891,9 +2901,10 @@ static int www_body(char *hostname, int s, int stype, unsigned char *context) if (BIO_should_io_special(io) && BIO_get_retry_reason(io) == BIO_RR_SSL_X509_LOOKUP) { BIO_printf(bio_s_out, "LOOKUP renego during read\n"); + SRP_user_pwd_free(srp_callback_parm.user); srp_callback_parm.user = - SRP_VBASE_get_by_user(srp_callback_parm.vb, - srp_callback_parm.login); + SRP_VBASE_get1_by_user(srp_callback_parm.vb, + srp_callback_parm.login); if (srp_callback_parm.user) BIO_printf(bio_s_out, "LOOKUP done %s\n", srp_callback_parm.user->info); @@ -3236,9 +3247,10 @@ static int rev_body(char *hostname, int s, int stype, unsigned char *context) if (BIO_should_io_special(io) && BIO_get_retry_reason(io) == BIO_RR_SSL_X509_LOOKUP) { BIO_printf(bio_s_out, "LOOKUP renego during accept\n"); + SRP_user_pwd_free(srp_callback_parm.user); srp_callback_parm.user = - SRP_VBASE_get_by_user(srp_callback_parm.vb, - srp_callback_parm.login); + SRP_VBASE_get1_by_user(srp_callback_parm.vb, + srp_callback_parm.login); if (srp_callback_parm.user) BIO_printf(bio_s_out, "LOOKUP done %s\n", srp_callback_parm.user->info); @@ -3264,9 +3276,10 @@ static int rev_body(char *hostname, int s, int stype, unsigned char *context) if (BIO_should_io_special(io) && BIO_get_retry_reason(io) == BIO_RR_SSL_X509_LOOKUP) { BIO_printf(bio_s_out, "LOOKUP renego during read\n"); + SRP_user_pwd_free(srp_callback_parm.user); srp_callback_parm.user = - SRP_VBASE_get_by_user(srp_callback_parm.vb, - srp_callback_parm.login); + SRP_VBASE_get1_by_user(srp_callback_parm.vb, + srp_callback_parm.login); if (srp_callback_parm.user) BIO_printf(bio_s_out, "LOOKUP done %s\n", srp_callback_parm.user->info); diff --git a/vendor/openssl/openssl/apps/speed.c b/vendor/openssl/openssl/apps/speed.c index 3697b71ec..95adcc19c 100644 --- a/vendor/openssl/openssl/apps/speed.c +++ b/vendor/openssl/openssl/apps/speed.c @@ -1,4 +1,4 @@ -/* apps/speed.c -*- mode:C; c-file-style: "eay" -*- */ +/* apps/speed.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/vendor/openssl/openssl/apps/x509.c b/vendor/openssl/openssl/apps/x509.c index 864a60dda..7c215bced 100644 --- a/vendor/openssl/openssl/apps/x509.c +++ b/vendor/openssl/openssl/apps/x509.c @@ -1226,12 +1226,7 @@ static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, if (X509_gmtime_adj(X509_get_notBefore(x), 0) == NULL) goto err; - /* Lets just make it 12:00am GMT, Jan 1 1970 */ - /* memcpy(x->cert_info->validity->notBefore,"700101120000Z",13); */ - /* 28 days to be certified */ - - if (X509_gmtime_adj(X509_get_notAfter(x), (long)60 * 60 * 24 * days) == - NULL) + if (X509_time_adj_ex(X509_get_notAfter(x), days, 0, NULL) == NULL) goto err; if (!X509_set_pubkey(x, pkey)) diff --git a/vendor/openssl/openssl/config b/vendor/openssl/openssl/config index 77f730f09..bba370c4f 100755 --- a/vendor/openssl/openssl/config +++ b/vendor/openssl/openssl/config @@ -852,7 +852,8 @@ case "$GUESSOS" in # *-dgux) OUT="dgux" ;; mips-sony-newsos4) OUT="newsos4-gcc" ;; *-*-cygwin_pre1.3) OUT="Cygwin-pre1.3" ;; - *-*-cygwin) OUT="Cygwin" ;; + i[3456]86-*-cygwin) OUT="Cygwin" ;; + *-*-cygwin) OUT="Cygwin-${MACHINE}" ;; t3e-cray-unicosmk) OUT="cray-t3e" ;; j90-cray-unicos) OUT="cray-j90" ;; nsr-tandem-nsk) OUT="tandem-c89" ;; diff --git a/vendor/openssl/openssl/crypto/aes/aes.h b/vendor/openssl/openssl/crypto/aes/aes.h index 87bf60f6f..faa66c491 100644 --- a/vendor/openssl/openssl/crypto/aes/aes.h +++ b/vendor/openssl/openssl/crypto/aes/aes.h @@ -1,4 +1,4 @@ -/* crypto/aes/aes.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/aes/aes.h */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/aes/aes_cbc.c b/vendor/openssl/openssl/crypto/aes/aes_cbc.c index e39231f17..805d0e260 100644 --- a/vendor/openssl/openssl/crypto/aes/aes_cbc.c +++ b/vendor/openssl/openssl/crypto/aes/aes_cbc.c @@ -1,4 +1,4 @@ -/* crypto/aes/aes_cbc.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/aes/aes_cbc.c */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/aes/aes_cfb.c b/vendor/openssl/openssl/crypto/aes/aes_cfb.c index 1c79ce2db..122500096 100644 --- a/vendor/openssl/openssl/crypto/aes/aes_cfb.c +++ b/vendor/openssl/openssl/crypto/aes/aes_cfb.c @@ -1,4 +1,4 @@ -/* crypto/aes/aes_cfb.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/aes/aes_cfb.c */ /* ==================================================================== * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/aes/aes_core.c b/vendor/openssl/openssl/crypto/aes/aes_core.c index 2ddb0860d..7019b5d7a 100644 --- a/vendor/openssl/openssl/crypto/aes/aes_core.c +++ b/vendor/openssl/openssl/crypto/aes/aes_core.c @@ -1,4 +1,4 @@ -/* crypto/aes/aes_core.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/aes/aes_core.c */ /** * rijndael-alg-fst.c * diff --git a/vendor/openssl/openssl/crypto/aes/aes_ctr.c b/vendor/openssl/openssl/crypto/aes/aes_ctr.c index 3ee382299..9e760c4b1 100644 --- a/vendor/openssl/openssl/crypto/aes/aes_ctr.c +++ b/vendor/openssl/openssl/crypto/aes/aes_ctr.c @@ -1,4 +1,4 @@ -/* crypto/aes/aes_ctr.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/aes/aes_ctr.c */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/aes/aes_ecb.c b/vendor/openssl/openssl/crypto/aes/aes_ecb.c index 2e0d20ca2..52151a5c7 100644 --- a/vendor/openssl/openssl/crypto/aes/aes_ecb.c +++ b/vendor/openssl/openssl/crypto/aes/aes_ecb.c @@ -1,4 +1,4 @@ -/* crypto/aes/aes_ecb.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/aes/aes_ecb.c */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/aes/aes_ige.c b/vendor/openssl/openssl/crypto/aes/aes_ige.c index cf31c9bba..8f2b77064 100644 --- a/vendor/openssl/openssl/crypto/aes/aes_ige.c +++ b/vendor/openssl/openssl/crypto/aes/aes_ige.c @@ -1,4 +1,4 @@ -/* crypto/aes/aes_ige.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/aes/aes_ige.c */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/aes/aes_locl.h b/vendor/openssl/openssl/crypto/aes/aes_locl.h index fabfd02ac..7acd74ec1 100644 --- a/vendor/openssl/openssl/crypto/aes/aes_locl.h +++ b/vendor/openssl/openssl/crypto/aes/aes_locl.h @@ -1,4 +1,4 @@ -/* crypto/aes/aes.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/aes/aes.h */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/aes/aes_misc.c b/vendor/openssl/openssl/crypto/aes/aes_misc.c index ab948ad85..fafad4d6f 100644 --- a/vendor/openssl/openssl/crypto/aes/aes_misc.c +++ b/vendor/openssl/openssl/crypto/aes/aes_misc.c @@ -1,4 +1,4 @@ -/* crypto/aes/aes_misc.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/aes/aes_misc.c */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/aes/aes_ofb.c b/vendor/openssl/openssl/crypto/aes/aes_ofb.c index e6153f99b..64a08caae 100644 --- a/vendor/openssl/openssl/crypto/aes/aes_ofb.c +++ b/vendor/openssl/openssl/crypto/aes/aes_ofb.c @@ -1,4 +1,4 @@ -/* crypto/aes/aes_ofb.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/aes/aes_ofb.c */ /* ==================================================================== * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/aes/aes_x86core.c b/vendor/openssl/openssl/crypto/aes/aes_x86core.c index c869ed719..b5dd69767 100644 --- a/vendor/openssl/openssl/crypto/aes/aes_x86core.c +++ b/vendor/openssl/openssl/crypto/aes/aes_x86core.c @@ -1,4 +1,4 @@ -/* crypto/aes/aes_core.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/aes/aes_core.c */ /** * rijndael-alg-fst.c * diff --git a/vendor/openssl/openssl/crypto/aes/asm/aes-ppc.pl b/vendor/openssl/openssl/crypto/aes/asm/aes-ppc.pl index 7a99fc3d0..5b83016ef 100644 --- a/vendor/openssl/openssl/crypto/aes/asm/aes-ppc.pl +++ b/vendor/openssl/openssl/crypto/aes/asm/aes-ppc.pl @@ -590,7 +590,7 @@ () xor $s2,$t2,$acc14 xor $s3,$t3,$acc15 addi $key,$key,16 - bdnz- Lenc_loop + bdnz Lenc_loop addi $Tbl2,$Tbl0,2048 nop @@ -1068,7 +1068,7 @@ () xor $s2,$t2,$acc14 xor $s3,$t3,$acc15 addi $key,$key,16 - bdnz- Ldec_loop + bdnz Ldec_loop addi $Tbl2,$Tbl0,2048 nop diff --git a/vendor/openssl/openssl/crypto/aes/asm/aes-s390x.pl b/vendor/openssl/openssl/crypto/aes/asm/aes-s390x.pl index e75dcd031..76ca8e521 100644 --- a/vendor/openssl/openssl/crypto/aes/asm/aes-s390x.pl +++ b/vendor/openssl/openssl/crypto/aes/asm/aes-s390x.pl @@ -818,13 +818,9 @@ () tmhl %r0,0x4000 # check for message-security assist jz .Lekey_internal - lghi %r0,0 # query capability vector - la %r1,16($sp) - .long 0xb92f0042 # kmc %r4,%r2 - - llihh %r1,0x8000 - srlg %r1,%r1,0(%r5) - ng %r1,16($sp) + llihh %r0,0x8000 + srlg %r0,%r0,0(%r5) + ng %r0,48(%r1) # check kmc capability vector jz .Lekey_internal lmg %r0,%r1,0($inp) # just copy 128 bits... @@ -1444,13 +1440,10 @@ () llgfr $s0,%r0 lgr $s1,%r1 - lghi %r0,0 - la %r1,16($sp) - .long 0xb92d2042 # kmctr %r4,%r2,%r2 - + larl %r1,OPENSSL_s390xcap_P llihh %r0,0x8000 # check if kmctr supports the function code srlg %r0,%r0,0($s0) - ng %r0,16($sp) + ng %r0,64(%r1) # check kmctr capability vector lgr %r0,$s0 lgr %r1,$s1 jz .Lctr32_km_loop @@ -1597,12 +1590,10 @@ () llgfr $s0,%r0 # put aside the function code lghi $s1,0x7f nr $s1,%r0 - lghi %r0,0 # query capability vector - la %r1,$tweak-16($sp) - .long 0xb92e0042 # km %r4,%r2 - llihh %r1,0x8000 - srlg %r1,%r1,32($s1) # check for 32+function code - ng %r1,$tweak-16($sp) + larl %r1,OPENSSL_s390xcap_P + llihh %r0,0x8000 + srlg %r0,%r0,32($s1) # check for 32+function code + ng %r0,32(%r1) # check km capability vector lgr %r0,$s0 # restore the function code la %r1,0($key1) # restore $key1 jz .Lxts_km_vanilla @@ -2229,7 +2220,7 @@ () } $code.=<<___; .string "AES for s390x, CRYPTOGAMS by " -.comm OPENSSL_s390xcap_P,16,8 +.comm OPENSSL_s390xcap_P,80,8 ___ $code =~ s/\`([^\`]*)\`/eval $1/gem; diff --git a/vendor/openssl/openssl/crypto/aes/asm/aesni-mb-x86_64.pl b/vendor/openssl/openssl/crypto/aes/asm/aesni-mb-x86_64.pl index 5a100fa89..d7ad7882c 100644 --- a/vendor/openssl/openssl/crypto/aes/asm/aesni-mb-x86_64.pl +++ b/vendor/openssl/openssl/crypto/aes/asm/aesni-mb-x86_64.pl @@ -63,7 +63,7 @@ $avx = ($1>=10) + ($1>=11); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([3-9]\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } diff --git a/vendor/openssl/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl b/vendor/openssl/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl index c803cdebc..8c8426085 100644 --- a/vendor/openssl/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl +++ b/vendor/openssl/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl @@ -94,7 +94,7 @@ $avx=1 if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) && `ml64 2>&1` =~ /Version ([0-9]+)\./ && $1>=10); -$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([3-9]\.[0-9]+)/ && $2>=3.0); +$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/ && $2>=3.0); $shaext=1; ### set to zero if compiling for 1.0.1 diff --git a/vendor/openssl/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl b/vendor/openssl/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl index bfe29268c..72f44ecf6 100644 --- a/vendor/openssl/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl +++ b/vendor/openssl/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl @@ -59,7 +59,7 @@ $avx = ($1>=10) + ($1>=12); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([3-9]\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } diff --git a/vendor/openssl/openssl/crypto/asn1/a_bytes.c b/vendor/openssl/openssl/crypto/asn1/a_bytes.c index 12715a728..385b53986 100644 --- a/vendor/openssl/openssl/crypto/asn1/a_bytes.c +++ b/vendor/openssl/openssl/crypto/asn1/a_bytes.c @@ -200,13 +200,13 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, } else { if (len != 0) { if ((ret->length < len) || (ret->data == NULL)) { - if (ret->data != NULL) - OPENSSL_free(ret->data); s = (unsigned char *)OPENSSL_malloc((int)len + 1); if (s == NULL) { i = ERR_R_MALLOC_FAILURE; goto err; } + if (ret->data != NULL) + OPENSSL_free(ret->data); } else s = ret->data; memcpy(s, p, (int)len); diff --git a/vendor/openssl/openssl/crypto/asn1/a_d2i_fp.c b/vendor/openssl/openssl/crypto/asn1/a_d2i_fp.c index a1864b42c..51b6f245a 100644 --- a/vendor/openssl/openssl/crypto/asn1/a_d2i_fp.c +++ b/vendor/openssl/openssl/crypto/asn1/a_d2i_fp.c @@ -141,6 +141,7 @@ void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x) #endif #define HEADER_SIZE 8 +#define ASN1_CHUNK_INITIAL_SIZE (16 * 1024) static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb) { BUF_MEM *b; @@ -217,29 +218,44 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb) /* suck in c.slen bytes of data */ want = c.slen; if (want > (len - off)) { + size_t chunk_max = ASN1_CHUNK_INITIAL_SIZE; + want -= (len - off); if (want > INT_MAX /* BIO_read takes an int length */ || len + want < len) { ASN1err(ASN1_F_ASN1_D2I_READ_BIO, ASN1_R_TOO_LONG); goto err; } - if (!BUF_MEM_grow_clean(b, len + want)) { - ASN1err(ASN1_F_ASN1_D2I_READ_BIO, ERR_R_MALLOC_FAILURE); - goto err; - } while (want > 0) { - i = BIO_read(in, &(b->data[len]), want); - if (i <= 0) { - ASN1err(ASN1_F_ASN1_D2I_READ_BIO, - ASN1_R_NOT_ENOUGH_DATA); + /* + * Read content in chunks of increasing size + * so we can return an error for EOF without + * having to allocate the entire content length + * in one go. + */ + size_t chunk = want > chunk_max ? chunk_max : want; + + if (!BUF_MEM_grow_clean(b, len + chunk)) { + ASN1err(ASN1_F_ASN1_D2I_READ_BIO, ERR_R_MALLOC_FAILURE); goto err; } + want -= chunk; + while (chunk > 0) { + i = BIO_read(in, &(b->data[len]), chunk); + if (i <= 0) { + ASN1err(ASN1_F_ASN1_D2I_READ_BIO, + ASN1_R_NOT_ENOUGH_DATA); + goto err; + } /* * This can't overflow because |len+want| didn't * overflow. */ - len += i; - want -= i; + len += i; + chunk -= i; + } + if (chunk_max < INT_MAX/2) + chunk_max *= 2; } } if (off + c.slen < off) { diff --git a/vendor/openssl/openssl/crypto/asn1/a_type.c b/vendor/openssl/openssl/crypto/asn1/a_type.c index af795306b..bb166e856 100644 --- a/vendor/openssl/openssl/crypto/asn1/a_type.c +++ b/vendor/openssl/openssl/crypto/asn1/a_type.c @@ -126,9 +126,7 @@ int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b) result = 0; /* They do not have content. */ break; case V_ASN1_INTEGER: - case V_ASN1_NEG_INTEGER: case V_ASN1_ENUMERATED: - case V_ASN1_NEG_ENUMERATED: case V_ASN1_BIT_STRING: case V_ASN1_OCTET_STRING: case V_ASN1_SEQUENCE: diff --git a/vendor/openssl/openssl/crypto/asn1/asn1_lib.c b/vendor/openssl/openssl/crypto/asn1/asn1_lib.c index 0b61fc930..874b1af8b 100644 --- a/vendor/openssl/openssl/crypto/asn1/asn1_lib.c +++ b/vendor/openssl/openssl/crypto/asn1/asn1_lib.c @@ -63,7 +63,7 @@ #include static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, - int max); + long max); static void asn1_put_length(unsigned char **pp, int length); const char ASN1_version[] = "ASN.1" OPENSSL_VERSION_PTEXT; @@ -131,7 +131,7 @@ int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, } *ptag = tag; *pclass = xclass; - if (!asn1_get_length(&p, &inf, plength, (int)max)) + if (!asn1_get_length(&p, &inf, plength, max)) goto err; if (inf && !(ret & V_ASN1_CONSTRUCTED)) @@ -159,14 +159,14 @@ int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, } static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, - int max) + long max) { const unsigned char *p = *pp; unsigned long ret = 0; - unsigned int i; + unsigned long i; if (max-- < 1) - return (0); + return 0; if (*p == 0x80) { *inf = 1; ret = 0; @@ -175,15 +175,11 @@ static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, *inf = 0; i = *p & 0x7f; if (*(p++) & 0x80) { - if (i > sizeof(long)) + if (i > sizeof(ret) || max < (long)i) return 0; - if (max-- == 0) - return (0); while (i-- > 0) { ret <<= 8L; ret |= *(p++); - if (max-- == 0) - return (0); } } else ret = i; @@ -192,7 +188,7 @@ static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, return 0; *pp = p; *rl = (long)ret; - return (1); + return 1; } /* diff --git a/vendor/openssl/openssl/crypto/asn1/asn1_par.c b/vendor/openssl/openssl/crypto/asn1/asn1_par.c index 0ca985a2b..e85e3398b 100644 --- a/vendor/openssl/openssl/crypto/asn1/asn1_par.c +++ b/vendor/openssl/openssl/crypto/asn1/asn1_par.c @@ -173,6 +173,8 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, if (!asn1_print_info(bp, tag, xclass, j, (indent) ? depth : 0)) goto end; if (j & V_ASN1_CONSTRUCTED) { + const unsigned char *sp; + ep = p + len; if (BIO_write(bp, "\n", 1) <= 0) goto end; @@ -182,6 +184,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, goto end; } if ((j == 0x21) && (len == 0)) { + sp = p; for (;;) { r = asn1_parse2(bp, &p, (long)(tot - p), offset + (p - *pp), depth + 1, @@ -190,19 +193,25 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, ret = 0; goto end; } - if ((r == 2) || (p >= tot)) + if ((r == 2) || (p >= tot)) { + len = p - sp; break; + } } - } else + } else { + long tmp = len; + while (p < ep) { - r = asn1_parse2(bp, &p, (long)len, - offset + (p - *pp), depth + 1, + sp = p; + r = asn1_parse2(bp, &p, tmp, offset + (p - *pp), depth + 1, indent, dump); if (r == 0) { ret = 0; goto end; } + tmp -= p - sp; } + } } else if (xclass != 0) { p += len; if (BIO_write(bp, "\n", 1) <= 0) diff --git a/vendor/openssl/openssl/crypto/asn1/t_x509.c b/vendor/openssl/openssl/crypto/asn1/t_x509.c index 8aab55130..8888396f8 100644 --- a/vendor/openssl/openssl/crypto/asn1/t_x509.c +++ b/vendor/openssl/openssl/crypto/asn1/t_x509.c @@ -140,7 +140,8 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, goto err; bs = X509_get_serialNumber(x); - if (bs->length <= (int)sizeof(long)) { + if (bs->length < (int)sizeof(long) + || (bs->length == sizeof(long) && (bs->data[0] & 0x80) == 0)) { l = ASN1_INTEGER_get(bs); if (bs->type == V_ASN1_NEG_INTEGER) { l = -l; diff --git a/vendor/openssl/openssl/crypto/asn1/tasn_dec.c b/vendor/openssl/openssl/crypto/asn1/tasn_dec.c index 9256049d1..6bdcd5c54 100644 --- a/vendor/openssl/openssl/crypto/asn1/tasn_dec.c +++ b/vendor/openssl/openssl/crypto/asn1/tasn_dec.c @@ -717,7 +717,7 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, long plen; char cst, inf, free_cont = 0; const unsigned char *p; - BUF_MEM buf; + BUF_MEM buf = { 0, NULL, 0 }; const unsigned char *cont = NULL; long len; if (!pval) { @@ -793,7 +793,6 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, } else { len = p - cont + plen; p += plen; - buf.data = NULL; } } else if (cst) { if (utype == V_ASN1_NULL || utype == V_ASN1_BOOLEAN @@ -802,9 +801,9 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_TYPE_NOT_PRIMITIVE); return 0; } - buf.length = 0; - buf.max = 0; - buf.data = NULL; + + /* Free any returned 'buf' content */ + free_cont = 1; /* * Should really check the internal tags are correct but some things * may get this wrong. The relevant specs say that constructed string @@ -812,18 +811,16 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, * So instead just check for UNIVERSAL class and ignore the tag. */ if (!asn1_collect(&buf, &p, plen, inf, -1, V_ASN1_UNIVERSAL, 0)) { - free_cont = 1; goto err; } len = buf.length; /* Append a final null to string */ if (!BUF_MEM_grow_clean(&buf, len + 1)) { ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_MALLOC_FAILURE); - return 0; + goto err; } buf.data[len] = 0; cont = (const unsigned char *)buf.data; - free_cont = 1; } else { cont = p; len = plen; @@ -831,6 +828,7 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, } /* We now have content length and type: translate into a structure */ + /* asn1_ex_c2i may reuse allocated buffer, and so sets free_cont to 0 */ if (!asn1_ex_c2i(pval, cont, len, utype, &free_cont, it)) goto err; @@ -903,9 +901,7 @@ int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, break; case V_ASN1_INTEGER: - case V_ASN1_NEG_INTEGER: case V_ASN1_ENUMERATED: - case V_ASN1_NEG_ENUMERATED: tint = (ASN1_INTEGER **)pval; if (!c2i_ASN1_INTEGER(tint, &cont, len)) goto err; diff --git a/vendor/openssl/openssl/crypto/asn1/tasn_enc.c b/vendor/openssl/openssl/crypto/asn1/tasn_enc.c index f04a6892a..f7f83e56a 100644 --- a/vendor/openssl/openssl/crypto/asn1/tasn_enc.c +++ b/vendor/openssl/openssl/crypto/asn1/tasn_enc.c @@ -611,9 +611,7 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype, break; case V_ASN1_INTEGER: - case V_ASN1_NEG_INTEGER: case V_ASN1_ENUMERATED: - case V_ASN1_NEG_ENUMERATED: /* * These are all have the same content format as ASN1_INTEGER */ diff --git a/vendor/openssl/openssl/crypto/asn1/x_name.c b/vendor/openssl/openssl/crypto/asn1/x_name.c index 737c426f2..a858c2993 100644 --- a/vendor/openssl/openssl/crypto/asn1/x_name.c +++ b/vendor/openssl/openssl/crypto/asn1/x_name.c @@ -66,6 +66,13 @@ typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; DECLARE_STACK_OF(STACK_OF_X509_NAME_ENTRY) +/* + * Maximum length of X509_NAME: much larger than anything we should + * ever see in practice. + */ + +#define X509_NAME_MAX (1024 * 1024) + static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it, @@ -192,6 +199,10 @@ static int x509_name_ex_d2i(ASN1_VALUE **val, int i, j, ret; STACK_OF(X509_NAME_ENTRY) *entries; X509_NAME_ENTRY *entry; + if (len > X509_NAME_MAX) { + ASN1err(ASN1_F_X509_NAME_EX_D2I, ASN1_R_TOO_LONG); + return 0; + } q = p; /* Get internal representation of Name */ diff --git a/vendor/openssl/openssl/crypto/asn1/x_x509.c b/vendor/openssl/openssl/crypto/asn1/x_x509.c index e2cac8369..e31e1e750 100644 --- a/vendor/openssl/openssl/crypto/asn1/x_x509.c +++ b/vendor/openssl/openssl/crypto/asn1/x_x509.c @@ -201,10 +201,20 @@ X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length) int i2d_X509_AUX(X509 *a, unsigned char **pp) { - int length; + int length, tmplen; + unsigned char *start = pp != NULL ? *pp : NULL; length = i2d_X509(a, pp); - if (a) - length += i2d_X509_CERT_AUX(a->aux, pp); + if (length < 0 || a == NULL) + return length; + + tmplen = i2d_X509_CERT_AUX(a->aux, pp); + if (tmplen < 0) { + if (start != NULL) + *pp = start; + return tmplen; + } + length += tmplen; + return length; } diff --git a/vendor/openssl/openssl/crypto/bio/b_print.c b/vendor/openssl/openssl/crypto/bio/b_print.c index 7c81e25d4..90248fa2a 100644 --- a/vendor/openssl/openssl/crypto/bio/b_print.c +++ b/vendor/openssl/openssl/crypto/bio/b_print.c @@ -125,16 +125,16 @@ # define LLONG long #endif -static void fmtstr(char **, char **, size_t *, size_t *, - const char *, int, int, int); -static void fmtint(char **, char **, size_t *, size_t *, - LLONG, int, int, int, int); -static void fmtfp(char **, char **, size_t *, size_t *, - LDOUBLE, int, int, int); -static void doapr_outch(char **, char **, size_t *, size_t *, int); -static void _dopr(char **sbuffer, char **buffer, - size_t *maxlen, size_t *retlen, int *truncated, - const char *format, va_list args); +static int fmtstr(char **, char **, size_t *, size_t *, + const char *, int, int, int); +static int fmtint(char **, char **, size_t *, size_t *, + LLONG, int, int, int, int); +static int fmtfp(char **, char **, size_t *, size_t *, + LDOUBLE, int, int, int); +static int doapr_outch(char **, char **, size_t *, size_t *, int); +static int _dopr(char **sbuffer, char **buffer, + size_t *maxlen, size_t *retlen, int *truncated, + const char *format, va_list args); /* format read states */ #define DP_S_DEFAULT 0 @@ -165,7 +165,7 @@ static void _dopr(char **sbuffer, char **buffer, #define char_to_int(p) (p - '0') #define OSSL_MAX(p,q) ((p >= q) ? p : q) -static void +static int _dopr(char **sbuffer, char **buffer, size_t *maxlen, @@ -196,7 +196,8 @@ _dopr(char **sbuffer, if (ch == '%') state = DP_S_FLAGS; else - doapr_outch(sbuffer, buffer, &currlen, maxlen, ch); + if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch)) + return 0; ch = *format++; break; case DP_S_FLAGS: @@ -302,8 +303,9 @@ _dopr(char **sbuffer, value = va_arg(args, int); break; } - fmtint(sbuffer, buffer, &currlen, maxlen, - value, 10, min, max, flags); + if (!fmtint(sbuffer, buffer, &currlen, maxlen, value, 10, min, + max, flags)) + return 0; break; case 'X': flags |= DP_F_UP; @@ -326,17 +328,19 @@ _dopr(char **sbuffer, value = (LLONG) va_arg(args, unsigned int); break; } - fmtint(sbuffer, buffer, &currlen, maxlen, value, - ch == 'o' ? 8 : (ch == 'u' ? 10 : 16), - min, max, flags); + if (!fmtint(sbuffer, buffer, &currlen, maxlen, value, + ch == 'o' ? 8 : (ch == 'u' ? 10 : 16), + min, max, flags)) + return 0; break; case 'f': if (cflags == DP_C_LDOUBLE) fvalue = va_arg(args, LDOUBLE); else fvalue = va_arg(args, double); - fmtfp(sbuffer, buffer, &currlen, maxlen, - fvalue, min, max, flags); + if (!fmtfp(sbuffer, buffer, &currlen, maxlen, fvalue, min, max, + flags)) + return 0; break; case 'E': flags |= DP_F_UP; @@ -355,8 +359,9 @@ _dopr(char **sbuffer, fvalue = va_arg(args, double); break; case 'c': - doapr_outch(sbuffer, buffer, &currlen, maxlen, - va_arg(args, int)); + if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, + va_arg(args, int))) + return 0; break; case 's': strvalue = va_arg(args, char *); @@ -366,13 +371,15 @@ _dopr(char **sbuffer, else max = *maxlen; } - fmtstr(sbuffer, buffer, &currlen, maxlen, strvalue, - flags, min, max); + if (!fmtstr(sbuffer, buffer, &currlen, maxlen, strvalue, + flags, min, max)) + return 0; break; case 'p': value = (long)va_arg(args, void *); - fmtint(sbuffer, buffer, &currlen, maxlen, - value, 16, min, max, flags | DP_F_NUM); + if (!fmtint(sbuffer, buffer, &currlen, maxlen, + value, 16, min, max, flags | DP_F_NUM)) + return 0; break; case 'n': /* XXX */ if (cflags == DP_C_SHORT) { @@ -394,7 +401,8 @@ _dopr(char **sbuffer, } break; case '%': - doapr_outch(sbuffer, buffer, &currlen, maxlen, ch); + if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch)) + return 0; break; case 'w': /* not supported yet, treat as next char */ @@ -418,46 +426,56 @@ _dopr(char **sbuffer, *truncated = (currlen > *maxlen - 1); if (*truncated) currlen = *maxlen - 1; - doapr_outch(sbuffer, buffer, &currlen, maxlen, '\0'); + if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, '\0')) + return 0; *retlen = currlen - 1; - return; + return 1; } -static void +static int fmtstr(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, const char *value, int flags, int min, int max) { - int padlen, strln; + int padlen; + size_t strln; int cnt = 0; if (value == 0) value = ""; - for (strln = 0; value[strln]; ++strln) ; + + strln = strlen(value); + if (strln > INT_MAX) + strln = INT_MAX; + padlen = min - strln; - if (padlen < 0) + if (min < 0 || padlen < 0) padlen = 0; if (flags & DP_F_MINUS) padlen = -padlen; while ((padlen > 0) && (cnt < max)) { - doapr_outch(sbuffer, buffer, currlen, maxlen, ' '); + if(!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) + return 0; --padlen; ++cnt; } while (*value && (cnt < max)) { - doapr_outch(sbuffer, buffer, currlen, maxlen, *value++); + if(!doapr_outch(sbuffer, buffer, currlen, maxlen, *value++)) + return 0; ++cnt; } while ((padlen < 0) && (cnt < max)) { - doapr_outch(sbuffer, buffer, currlen, maxlen, ' '); + if(!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) + return 0; ++padlen; ++cnt; } + return 1; } -static void +static int fmtint(char **sbuffer, char **buffer, size_t *currlen, @@ -517,37 +535,44 @@ fmtint(char **sbuffer, /* spaces */ while (spadlen > 0) { - doapr_outch(sbuffer, buffer, currlen, maxlen, ' '); + if(!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) + return 0; --spadlen; } /* sign */ if (signvalue) - doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue); + if(!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue)) + return 0; /* prefix */ while (*prefix) { - doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix); + if(!doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix)) + return 0; prefix++; } /* zeros */ if (zpadlen > 0) { while (zpadlen > 0) { - doapr_outch(sbuffer, buffer, currlen, maxlen, '0'); + if(!doapr_outch(sbuffer, buffer, currlen, maxlen, '0')) + return 0; --zpadlen; } } /* digits */ - while (place > 0) - doapr_outch(sbuffer, buffer, currlen, maxlen, convert[--place]); + while (place > 0) { + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, convert[--place])) + return 0; + } /* left justified spaces */ while (spadlen < 0) { - doapr_outch(sbuffer, buffer, currlen, maxlen, ' '); + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) + return 0; ++spadlen; } - return; + return 1; } static LDOUBLE abs_val(LDOUBLE value) @@ -578,7 +603,7 @@ static long roundv(LDOUBLE value) return intpart; } -static void +static int fmtfp(char **sbuffer, char **buffer, size_t *currlen, @@ -657,47 +682,61 @@ fmtfp(char **sbuffer, if ((flags & DP_F_ZERO) && (padlen > 0)) { if (signvalue) { - doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue); + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue)) + return 0; --padlen; signvalue = 0; } while (padlen > 0) { - doapr_outch(sbuffer, buffer, currlen, maxlen, '0'); + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0')) + return 0; --padlen; } } while (padlen > 0) { - doapr_outch(sbuffer, buffer, currlen, maxlen, ' '); + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) + return 0; --padlen; } - if (signvalue) - doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue); + if (signvalue && !doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue)) + return 0; - while (iplace > 0) - doapr_outch(sbuffer, buffer, currlen, maxlen, iconvert[--iplace]); + while (iplace > 0) { + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, iconvert[--iplace])) + return 0; + } /* * Decimal point. This should probably use locale to find the correct * char to print out. */ if (max > 0 || (flags & DP_F_NUM)) { - doapr_outch(sbuffer, buffer, currlen, maxlen, '.'); + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '.')) + return 0; - while (fplace > 0) - doapr_outch(sbuffer, buffer, currlen, maxlen, fconvert[--fplace]); + while (fplace > 0) { + if(!doapr_outch(sbuffer, buffer, currlen, maxlen, + fconvert[--fplace])) + return 0; + } } while (zpadlen > 0) { - doapr_outch(sbuffer, buffer, currlen, maxlen, '0'); + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0')) + return 0; --zpadlen; } while (padlen < 0) { - doapr_outch(sbuffer, buffer, currlen, maxlen, ' '); + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) + return 0; ++padlen; } + return 1; } -static void +#define BUFFER_INC 1024 + +static int doapr_outch(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, int c) { @@ -708,24 +747,25 @@ doapr_outch(char **sbuffer, assert(*currlen <= *maxlen); if (buffer && *currlen == *maxlen) { - *maxlen += 1024; + if (*maxlen > INT_MAX - BUFFER_INC) + return 0; + + *maxlen += BUFFER_INC; if (*buffer == NULL) { *buffer = OPENSSL_malloc(*maxlen); - if (!*buffer) { - /* Panic! Can't really do anything sensible. Just return */ - return; - } + if (*buffer == NULL) + return 0; if (*currlen > 0) { assert(*sbuffer != NULL); memcpy(*buffer, *sbuffer, *currlen); } *sbuffer = NULL; } else { - *buffer = OPENSSL_realloc(*buffer, *maxlen); - if (!*buffer) { - /* Panic! Can't really do anything sensible. Just return */ - return; - } + char *tmpbuf; + tmpbuf = OPENSSL_realloc(*buffer, *maxlen); + if (tmpbuf == NULL) + return 0; + *buffer = tmpbuf; } } @@ -736,7 +776,7 @@ doapr_outch(char **sbuffer, (*buffer)[(*currlen)++] = (char)c; } - return; + return 1; } /***************************************************************************/ @@ -768,7 +808,11 @@ int BIO_vprintf(BIO *bio, const char *format, va_list args) dynbuf = NULL; CRYPTO_push_info("doapr()"); - _dopr(&hugebufp, &dynbuf, &hugebufsize, &retlen, &ignored, format, args); + if (!_dopr(&hugebufp, &dynbuf, &hugebufsize, &retlen, &ignored, format, + args)) { + OPENSSL_free(dynbuf); + return -1; + } if (dynbuf) { ret = BIO_write(bio, dynbuf, (int)retlen); OPENSSL_free(dynbuf); @@ -803,7 +847,8 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) size_t retlen; int truncated; - _dopr(&buf, NULL, &n, &retlen, &truncated, format, args); + if(!_dopr(&buf, NULL, &n, &retlen, &truncated, format, args)) + return -1; if (truncated) /* diff --git a/vendor/openssl/openssl/crypto/bio/bio.h b/vendor/openssl/openssl/crypto/bio/bio.h index f78796b06..6790aed28 100644 --- a/vendor/openssl/openssl/crypto/bio/bio.h +++ b/vendor/openssl/openssl/crypto/bio/bio.h @@ -479,11 +479,11 @@ struct bio_dgram_sctp_prinfo { # define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) # define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) # define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2) -# define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0) +# define BIO_get_conn_int_port(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL) # define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) -/* BIO_s_accept_socket() */ +/* BIO_s_accept() */ # define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name) # define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0) /* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ @@ -496,6 +496,7 @@ struct bio_dgram_sctp_prinfo { # define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) # define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) +/* BIO_s_accept() and BIO_s_connect() */ # define BIO_do_connect(b) BIO_do_handshake(b) # define BIO_do_accept(b) BIO_do_handshake(b) # define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) @@ -515,12 +516,15 @@ struct bio_dgram_sctp_prinfo { # define BIO_get_url(b,url) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url)) # define BIO_get_no_connect_return(b) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL) +/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */ # define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) # define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c) +/* BIO_s_file() */ # define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp) # define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp) +/* BIO_s_fd() and BIO_s_file() */ # define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) # define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) @@ -685,7 +689,7 @@ long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, long argl, long ret); BIO_METHOD *BIO_s_mem(void); -BIO *BIO_new_mem_buf(void *buf, int len); +BIO *BIO_new_mem_buf(const void *buf, int len); BIO_METHOD *BIO_s_socket(void); BIO_METHOD *BIO_s_connect(void); BIO_METHOD *BIO_s_accept(void); diff --git a/vendor/openssl/openssl/crypto/bio/bss_bio.c b/vendor/openssl/openssl/crypto/bio/bss_bio.c index d629a37a5..4d8727f8f 100644 --- a/vendor/openssl/openssl/crypto/bio/bss_bio.c +++ b/vendor/openssl/openssl/crypto/bio/bss_bio.c @@ -1,4 +1,4 @@ -/* crypto/bio/bss_bio.c -*- Mode: C; c-file-style: "eay" -*- */ +/* crypto/bio/bss_bio.c */ /* ==================================================================== * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/bio/bss_conn.c b/vendor/openssl/openssl/crypto/bio/bss_conn.c index 42d0afffb..7d15ad29d 100644 --- a/vendor/openssl/openssl/crypto/bio/bss_conn.c +++ b/vendor/openssl/openssl/crypto/bio/bss_conn.c @@ -419,7 +419,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) { BIO *dbio; int *ip; - const char **pptr; + const char **pptr = NULL; long ret = 1; BIO_CONNECT *data; @@ -442,19 +442,28 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) case BIO_C_GET_CONNECT: if (ptr != NULL) { pptr = (const char **)ptr; - if (num == 0) { - *pptr = data->param_hostname; + } - } else if (num == 1) { - *pptr = data->param_port; - } else if (num == 2) { - *pptr = (char *)&(data->ip[0]); - } else if (num == 3) { - *((int *)ptr) = data->port; + if (b->init) { + if (pptr != NULL) { + ret = 1; + if (num == 0) { + *pptr = data->param_hostname; + } else if (num == 1) { + *pptr = data->param_port; + } else if (num == 2) { + *pptr = (char *)&(data->ip[0]); + } else { + ret = 0; + } + } + if (num == 3) { + ret = data->port; } - if ((!b->init) || (ptr == NULL)) + } else { + if (pptr != NULL) *pptr = "not initialized"; - ret = 1; + ret = 0; } break; case BIO_C_SET_CONNECT: diff --git a/vendor/openssl/openssl/crypto/bio/bss_dgram.c b/vendor/openssl/openssl/crypto/bio/bss_dgram.c index 7fcd831da..bdd7bf88e 100644 --- a/vendor/openssl/openssl/crypto/bio/bss_dgram.c +++ b/vendor/openssl/openssl/crypto/bio/bss_dgram.c @@ -519,10 +519,8 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) switch (cmd) { case BIO_CTRL_RESET: num = 0; - case BIO_C_FILE_SEEK: ret = 0; break; - case BIO_C_FILE_TELL: case BIO_CTRL_INFO: ret = 0; break; diff --git a/vendor/openssl/openssl/crypto/bio/bss_mem.c b/vendor/openssl/openssl/crypto/bio/bss_mem.c index d190765dc..b0394a960 100644 --- a/vendor/openssl/openssl/crypto/bio/bss_mem.c +++ b/vendor/openssl/openssl/crypto/bio/bss_mem.c @@ -91,7 +91,8 @@ BIO_METHOD *BIO_s_mem(void) return (&mem_method); } -BIO *BIO_new_mem_buf(void *buf, int len) + +BIO *BIO_new_mem_buf(const void *buf, int len) { BIO *ret; BUF_MEM *b; @@ -105,7 +106,8 @@ BIO *BIO_new_mem_buf(void *buf, int len) if (!(ret = BIO_new(BIO_s_mem()))) return NULL; b = (BUF_MEM *)ret->ptr; - b->data = buf; + /* Cast away const and trust in the MEM_RDONLY flag. */ + b->data = (void *)buf; b->length = sz; b->max = sz; ret->flags |= BIO_FLAGS_MEM_RDONLY; diff --git a/vendor/openssl/openssl/crypto/bn/Makefile b/vendor/openssl/openssl/crypto/bn/Makefile index 215855eca..c4c640951 100644 --- a/vendor/openssl/openssl/crypto/bn/Makefile +++ b/vendor/openssl/openssl/crypto/bn/Makefile @@ -252,8 +252,8 @@ bn_exp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h bn_exp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h bn_exp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h bn_exp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h -bn_exp.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_exp.c bn_lcl.h -bn_exp.o: rsaz_exp.h +bn_exp.o: ../../include/openssl/symhacks.h ../constant_time_locl.h +bn_exp.o: ../cryptlib.h bn_exp.c bn_lcl.h rsaz_exp.h bn_exp2.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h bn_exp2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h bn_exp2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h diff --git a/vendor/openssl/openssl/crypto/bn/asm/ppc-mont.pl b/vendor/openssl/openssl/crypto/bn/asm/ppc-mont.pl index da69c6aaa..6930a3ace 100644 --- a/vendor/openssl/openssl/crypto/bn/asm/ppc-mont.pl +++ b/vendor/openssl/openssl/crypto/bn/asm/ppc-mont.pl @@ -191,7 +191,7 @@ addi $j,$j,$BNSZ ; j++ addi $tp,$tp,$BNSZ ; tp++ - bdnz- L1st + bdnz L1st ;L1st addc $lo0,$alo,$hi0 addze $hi0,$ahi @@ -253,7 +253,7 @@ addze $hi1,$hi1 $ST $lo1,0($tp) ; tp[j-1] addi $tp,$tp,$BNSZ ; tp++ - bdnz- Linner + bdnz Linner ;Linner $LD $tj,$BNSZ($tp) ; tp[j] addc $lo0,$alo,$hi0 @@ -276,7 +276,7 @@ slwi $tj,$num,`log($BNSZ)/log(2)` $UCMP $i,$tj addi $i,$i,$BNSZ - ble- Louter + ble Louter addi $num,$num,2 ; restore $num subfc $j,$j,$j ; j=0 and "clear" XER[CA] @@ -289,7 +289,7 @@ subfe $aj,$nj,$tj ; tp[j]-np[j] $STX $aj,$rp,$j addi $j,$j,$BNSZ - bdnz- Lsub + bdnz Lsub li $j,0 mtctr $num @@ -304,7 +304,7 @@ $STX $tj,$rp,$j $STX $j,$tp,$j ; zap at once addi $j,$j,$BNSZ - bdnz- Lcopy + bdnz Lcopy $POP $tj,0($sp) li r3,1 diff --git a/vendor/openssl/openssl/crypto/bn/asm/ppc.pl b/vendor/openssl/openssl/crypto/bn/asm/ppc.pl index 04df1fe5c..446d8ba94 100644 --- a/vendor/openssl/openssl/crypto/bn/asm/ppc.pl +++ b/vendor/openssl/openssl/crypto/bn/asm/ppc.pl @@ -1556,7 +1556,7 @@ # if carry = 1 this is r7-r8. Else it # is r7-r8 -1 as we need. $STU r6,$BNSZ(r3) - bdnz- Lppcasm_sub_mainloop + bdnz Lppcasm_sub_mainloop Lppcasm_sub_adios: subfze r3,r0 # if carry bit is set then r3 = 0 else -1 andi. r3,r3,1 # keep only last bit. @@ -1603,7 +1603,7 @@ $LDU r8,$BNSZ(r5) adde r8,r7,r8 $STU r8,$BNSZ(r3) - bdnz- Lppcasm_add_mainloop + bdnz Lppcasm_add_mainloop Lppcasm_add_adios: addze r3,r0 #return carry bit. blr @@ -1762,7 +1762,7 @@ $UMULH r8,r6,r6 $STU r7,$BNSZ(r3) $STU r8,$BNSZ(r3) - bdnz- Lppcasm_sqr_mainloop + bdnz Lppcasm_sqr_mainloop Lppcasm_sqr_adios: blr .long 0 @@ -1827,7 +1827,7 @@ addi r3,r3,`4*$BNSZ` addi r4,r4,`4*$BNSZ` - bdnz- Lppcasm_mw_LOOP + bdnz Lppcasm_mw_LOOP Lppcasm_mw_REM: andi. r5,r5,0x3 @@ -1951,7 +1951,7 @@ $ST r11,`3*$BNSZ`(r3) addi r3,r3,`4*$BNSZ` addi r4,r4,`4*$BNSZ` - bdnz- Lppcasm_maw_mainloop + bdnz Lppcasm_maw_mainloop Lppcasm_maw_leftover: andi. r5,r5,0x3 diff --git a/vendor/openssl/openssl/crypto/bn/asm/ppc64-mont.pl b/vendor/openssl/openssl/crypto/bn/asm/ppc64-mont.pl index 9e3c12d78..595fc6d31 100644 --- a/vendor/openssl/openssl/crypto/bn/asm/ppc64-mont.pl +++ b/vendor/openssl/openssl/crypto/bn/asm/ppc64-mont.pl @@ -734,7 +734,7 @@ ___ } $code.=<<___; - bdnz- L1st + bdnz L1st fctid $dota,$dota fctid $dotb,$dotb @@ -1280,7 +1280,7 @@ ___ } $code.=<<___; - bdnz- Linner + bdnz Linner fctid $dota,$dota fctid $dotb,$dotb @@ -1490,7 +1490,7 @@ stdx $t0,$rp,$i stdx $t2,$t6,$i addi $i,$i,16 - bdnz- Lsub + bdnz Lsub li $i,0 subfe $ovf,$i,$ovf ; handle upmost overflow bit @@ -1517,7 +1517,7 @@ stdx $i,$tp,$i ; zap tp at once stdx $i,$t4,$i addi $i,$i,16 - bdnz- Lcopy + bdnz Lcopy ___ $code.=<<___ if ($SIZE_T==4); subf $np,$num,$np ; rewind np @@ -1550,7 +1550,7 @@ stw $t5,8($rp) stw $t6,12($rp) stwu $t7,16($rp) - bdnz- Lsub + bdnz Lsub li $i,0 subfe $ovf,$i,$ovf ; handle upmost overflow bit @@ -1582,7 +1582,7 @@ stwu $t3,16($rp) std $i,8($tp) ; zap tp at once stdu $i,16($tp) - bdnz- Lcopy + bdnz Lcopy ___ $code.=<<___; diff --git a/vendor/openssl/openssl/crypto/bn/asm/rsaz-avx2.pl b/vendor/openssl/openssl/crypto/bn/asm/rsaz-avx2.pl index 3b6ccf83d..712a77fe8 100755 --- a/vendor/openssl/openssl/crypto/bn/asm/rsaz-avx2.pl +++ b/vendor/openssl/openssl/crypto/bn/asm/rsaz-avx2.pl @@ -443,7 +443,7 @@ $TEMP3 = $Y1; $TEMP4 = $Y2; $code.=<<___; - #we need to fix indexes 32-39 to avoid overflow + # we need to fix indices 32-39 to avoid overflow vmovdqu 32*8(%rsp), $ACC8 # 32*8-192($tp0), vmovdqu 32*9(%rsp), $ACC1 # 32*9-192($tp0) vmovdqu 32*10(%rsp), $ACC2 # 32*10-192($tp0) @@ -1592,68 +1592,128 @@ .type rsaz_1024_gather5_avx2,\@abi-omnipotent .align 32 rsaz_1024_gather5_avx2: + vzeroupper + mov %rsp,%r11 ___ $code.=<<___ if ($win64); lea -0x88(%rsp),%rax - vzeroupper .LSEH_begin_rsaz_1024_gather5: # I can't trust assembler to use specific encoding:-( - .byte 0x48,0x8d,0x60,0xe0 #lea -0x20(%rax),%rsp - .byte 0xc5,0xf8,0x29,0x70,0xe0 #vmovaps %xmm6,-0x20(%rax) - .byte 0xc5,0xf8,0x29,0x78,0xf0 #vmovaps %xmm7,-0x10(%rax) - .byte 0xc5,0x78,0x29,0x40,0x00 #vmovaps %xmm8,0(%rax) - .byte 0xc5,0x78,0x29,0x48,0x10 #vmovaps %xmm9,0x10(%rax) - .byte 0xc5,0x78,0x29,0x50,0x20 #vmovaps %xmm10,0x20(%rax) - .byte 0xc5,0x78,0x29,0x58,0x30 #vmovaps %xmm11,0x30(%rax) - .byte 0xc5,0x78,0x29,0x60,0x40 #vmovaps %xmm12,0x40(%rax) - .byte 0xc5,0x78,0x29,0x68,0x50 #vmovaps %xmm13,0x50(%rax) - .byte 0xc5,0x78,0x29,0x70,0x60 #vmovaps %xmm14,0x60(%rax) - .byte 0xc5,0x78,0x29,0x78,0x70 #vmovaps %xmm15,0x70(%rax) + .byte 0x48,0x8d,0x60,0xe0 # lea -0x20(%rax),%rsp + .byte 0xc5,0xf8,0x29,0x70,0xe0 # vmovaps %xmm6,-0x20(%rax) + .byte 0xc5,0xf8,0x29,0x78,0xf0 # vmovaps %xmm7,-0x10(%rax) + .byte 0xc5,0x78,0x29,0x40,0x00 # vmovaps %xmm8,0(%rax) + .byte 0xc5,0x78,0x29,0x48,0x10 # vmovaps %xmm9,0x10(%rax) + .byte 0xc5,0x78,0x29,0x50,0x20 # vmovaps %xmm10,0x20(%rax) + .byte 0xc5,0x78,0x29,0x58,0x30 # vmovaps %xmm11,0x30(%rax) + .byte 0xc5,0x78,0x29,0x60,0x40 # vmovaps %xmm12,0x40(%rax) + .byte 0xc5,0x78,0x29,0x68,0x50 # vmovaps %xmm13,0x50(%rax) + .byte 0xc5,0x78,0x29,0x70,0x60 # vmovaps %xmm14,0x60(%rax) + .byte 0xc5,0x78,0x29,0x78,0x70 # vmovaps %xmm15,0x70(%rax) ___ $code.=<<___; - lea .Lgather_table(%rip),%r11 - mov $power,%eax - and \$3,$power - shr \$2,%eax # cache line number - shl \$4,$power # offset within cache line - - vmovdqu -32(%r11),%ymm7 # .Lgather_permd - vpbroadcastb 8(%r11,%rax), %xmm8 - vpbroadcastb 7(%r11,%rax), %xmm9 - vpbroadcastb 6(%r11,%rax), %xmm10 - vpbroadcastb 5(%r11,%rax), %xmm11 - vpbroadcastb 4(%r11,%rax), %xmm12 - vpbroadcastb 3(%r11,%rax), %xmm13 - vpbroadcastb 2(%r11,%rax), %xmm14 - vpbroadcastb 1(%r11,%rax), %xmm15 - - lea 64($inp,$power),$inp - mov \$64,%r11 # size optimization - mov \$9,%eax - jmp .Loop_gather_1024 + lea -0x100(%rsp),%rsp + and \$-32, %rsp + lea .Linc(%rip), %r10 + lea -128(%rsp),%rax # control u-op density + + vmovd $power, %xmm4 + vmovdqa (%r10),%ymm0 + vmovdqa 32(%r10),%ymm1 + vmovdqa 64(%r10),%ymm5 + vpbroadcastd %xmm4,%ymm4 + + vpaddd %ymm5, %ymm0, %ymm2 + vpcmpeqd %ymm4, %ymm0, %ymm0 + vpaddd %ymm5, %ymm1, %ymm3 + vpcmpeqd %ymm4, %ymm1, %ymm1 + vmovdqa %ymm0, 32*0+128(%rax) + vpaddd %ymm5, %ymm2, %ymm0 + vpcmpeqd %ymm4, %ymm2, %ymm2 + vmovdqa %ymm1, 32*1+128(%rax) + vpaddd %ymm5, %ymm3, %ymm1 + vpcmpeqd %ymm4, %ymm3, %ymm3 + vmovdqa %ymm2, 32*2+128(%rax) + vpaddd %ymm5, %ymm0, %ymm2 + vpcmpeqd %ymm4, %ymm0, %ymm0 + vmovdqa %ymm3, 32*3+128(%rax) + vpaddd %ymm5, %ymm1, %ymm3 + vpcmpeqd %ymm4, %ymm1, %ymm1 + vmovdqa %ymm0, 32*4+128(%rax) + vpaddd %ymm5, %ymm2, %ymm8 + vpcmpeqd %ymm4, %ymm2, %ymm2 + vmovdqa %ymm1, 32*5+128(%rax) + vpaddd %ymm5, %ymm3, %ymm9 + vpcmpeqd %ymm4, %ymm3, %ymm3 + vmovdqa %ymm2, 32*6+128(%rax) + vpaddd %ymm5, %ymm8, %ymm10 + vpcmpeqd %ymm4, %ymm8, %ymm8 + vmovdqa %ymm3, 32*7+128(%rax) + vpaddd %ymm5, %ymm9, %ymm11 + vpcmpeqd %ymm4, %ymm9, %ymm9 + vpaddd %ymm5, %ymm10, %ymm12 + vpcmpeqd %ymm4, %ymm10, %ymm10 + vpaddd %ymm5, %ymm11, %ymm13 + vpcmpeqd %ymm4, %ymm11, %ymm11 + vpaddd %ymm5, %ymm12, %ymm14 + vpcmpeqd %ymm4, %ymm12, %ymm12 + vpaddd %ymm5, %ymm13, %ymm15 + vpcmpeqd %ymm4, %ymm13, %ymm13 + vpcmpeqd %ymm4, %ymm14, %ymm14 + vpcmpeqd %ymm4, %ymm15, %ymm15 + + vmovdqa -32(%r10),%ymm7 # .Lgather_permd + lea 128($inp), $inp + mov \$9,$power -.align 32 .Loop_gather_1024: - vpand -64($inp), %xmm8,%xmm0 - vpand ($inp), %xmm9,%xmm1 - vpand 64($inp), %xmm10,%xmm2 - vpand ($inp,%r11,2), %xmm11,%xmm3 - vpor %xmm0,%xmm1,%xmm1 - vpand 64($inp,%r11,2), %xmm12,%xmm4 - vpor %xmm2,%xmm3,%xmm3 - vpand ($inp,%r11,4), %xmm13,%xmm5 - vpor %xmm1,%xmm3,%xmm3 - vpand 64($inp,%r11,4), %xmm14,%xmm6 - vpor %xmm4,%xmm5,%xmm5 - vpand -128($inp,%r11,8), %xmm15,%xmm2 - lea ($inp,%r11,8),$inp - vpor %xmm3,%xmm5,%xmm5 - vpor %xmm2,%xmm6,%xmm6 - vpor %xmm5,%xmm6,%xmm6 - vpermd %ymm6,%ymm7,%ymm6 - vmovdqu %ymm6,($out) + vmovdqa 32*0-128($inp), %ymm0 + vmovdqa 32*1-128($inp), %ymm1 + vmovdqa 32*2-128($inp), %ymm2 + vmovdqa 32*3-128($inp), %ymm3 + vpand 32*0+128(%rax), %ymm0, %ymm0 + vpand 32*1+128(%rax), %ymm1, %ymm1 + vpand 32*2+128(%rax), %ymm2, %ymm2 + vpor %ymm0, %ymm1, %ymm4 + vpand 32*3+128(%rax), %ymm3, %ymm3 + vmovdqa 32*4-128($inp), %ymm0 + vmovdqa 32*5-128($inp), %ymm1 + vpor %ymm2, %ymm3, %ymm5 + vmovdqa 32*6-128($inp), %ymm2 + vmovdqa 32*7-128($inp), %ymm3 + vpand 32*4+128(%rax), %ymm0, %ymm0 + vpand 32*5+128(%rax), %ymm1, %ymm1 + vpand 32*6+128(%rax), %ymm2, %ymm2 + vpor %ymm0, %ymm4, %ymm4 + vpand 32*7+128(%rax), %ymm3, %ymm3 + vpand 32*8-128($inp), %ymm8, %ymm0 + vpor %ymm1, %ymm5, %ymm5 + vpand 32*9-128($inp), %ymm9, %ymm1 + vpor %ymm2, %ymm4, %ymm4 + vpand 32*10-128($inp),%ymm10, %ymm2 + vpor %ymm3, %ymm5, %ymm5 + vpand 32*11-128($inp),%ymm11, %ymm3 + vpor %ymm0, %ymm4, %ymm4 + vpand 32*12-128($inp),%ymm12, %ymm0 + vpor %ymm1, %ymm5, %ymm5 + vpand 32*13-128($inp),%ymm13, %ymm1 + vpor %ymm2, %ymm4, %ymm4 + vpand 32*14-128($inp),%ymm14, %ymm2 + vpor %ymm3, %ymm5, %ymm5 + vpand 32*15-128($inp),%ymm15, %ymm3 + lea 32*16($inp), $inp + vpor %ymm0, %ymm4, %ymm4 + vpor %ymm1, %ymm5, %ymm5 + vpor %ymm2, %ymm4, %ymm4 + vpor %ymm3, %ymm5, %ymm5 + + vpor %ymm5, %ymm4, %ymm4 + vextracti128 \$1, %ymm4, %xmm5 # upper half is cleared + vpor %xmm4, %xmm5, %xmm5 + vpermd %ymm5,%ymm7,%ymm5 + vmovdqu %ymm5,($out) lea 32($out),$out - dec %eax + dec $power jnz .Loop_gather_1024 vpxor %ymm0,%ymm0,%ymm0 @@ -1661,20 +1721,20 @@ vzeroupper ___ $code.=<<___ if ($win64); - movaps (%rsp),%xmm6 - movaps 0x10(%rsp),%xmm7 - movaps 0x20(%rsp),%xmm8 - movaps 0x30(%rsp),%xmm9 - movaps 0x40(%rsp),%xmm10 - movaps 0x50(%rsp),%xmm11 - movaps 0x60(%rsp),%xmm12 - movaps 0x70(%rsp),%xmm13 - movaps 0x80(%rsp),%xmm14 - movaps 0x90(%rsp),%xmm15 - lea 0xa8(%rsp),%rsp + movaps -0xa8(%r11),%xmm6 + movaps -0x98(%r11),%xmm7 + movaps -0x88(%r11),%xmm8 + movaps -0x78(%r11),%xmm9 + movaps -0x68(%r11),%xmm10 + movaps -0x58(%r11),%xmm11 + movaps -0x48(%r11),%xmm12 + movaps -0x38(%r11),%xmm13 + movaps -0x28(%r11),%xmm14 + movaps -0x18(%r11),%xmm15 .LSEH_end_rsaz_1024_gather5: ___ $code.=<<___; + lea (%r11),%rsp ret .size rsaz_1024_gather5_avx2,.-rsaz_1024_gather5_avx2 ___ @@ -1708,8 +1768,10 @@ .long 0,2,4,6,7,7,7,7 .Lgather_permd: .long 0,7,1,7,2,7,3,7 -.Lgather_table: - .byte 0,0,0,0,0,0,0,0, 0xff,0,0,0,0,0,0,0 +.Linc: + .long 0,0,0,0, 1,1,1,1 + .long 2,2,2,2, 3,3,3,3 + .long 4,4,4,4, 4,4,4,4 .align 64 ___ @@ -1837,18 +1899,19 @@ .rva rsaz_se_handler .rva .Lmul_1024_body,.Lmul_1024_epilogue .LSEH_info_rsaz_1024_gather5: - .byte 0x01,0x33,0x16,0x00 - .byte 0x36,0xf8,0x09,0x00 #vmovaps 0x90(rsp),xmm15 - .byte 0x31,0xe8,0x08,0x00 #vmovaps 0x80(rsp),xmm14 - .byte 0x2c,0xd8,0x07,0x00 #vmovaps 0x70(rsp),xmm13 - .byte 0x27,0xc8,0x06,0x00 #vmovaps 0x60(rsp),xmm12 - .byte 0x22,0xb8,0x05,0x00 #vmovaps 0x50(rsp),xmm11 - .byte 0x1d,0xa8,0x04,0x00 #vmovaps 0x40(rsp),xmm10 - .byte 0x18,0x98,0x03,0x00 #vmovaps 0x30(rsp),xmm9 - .byte 0x13,0x88,0x02,0x00 #vmovaps 0x20(rsp),xmm8 - .byte 0x0e,0x78,0x01,0x00 #vmovaps 0x10(rsp),xmm7 - .byte 0x09,0x68,0x00,0x00 #vmovaps 0x00(rsp),xmm6 - .byte 0x04,0x01,0x15,0x00 #sub rsp,0xa8 + .byte 0x01,0x36,0x17,0x0b + .byte 0x36,0xf8,0x09,0x00 # vmovaps 0x90(rsp),xmm15 + .byte 0x31,0xe8,0x08,0x00 # vmovaps 0x80(rsp),xmm14 + .byte 0x2c,0xd8,0x07,0x00 # vmovaps 0x70(rsp),xmm13 + .byte 0x27,0xc8,0x06,0x00 # vmovaps 0x60(rsp),xmm12 + .byte 0x22,0xb8,0x05,0x00 # vmovaps 0x50(rsp),xmm11 + .byte 0x1d,0xa8,0x04,0x00 # vmovaps 0x40(rsp),xmm10 + .byte 0x18,0x98,0x03,0x00 # vmovaps 0x30(rsp),xmm9 + .byte 0x13,0x88,0x02,0x00 # vmovaps 0x20(rsp),xmm8 + .byte 0x0e,0x78,0x01,0x00 # vmovaps 0x10(rsp),xmm7 + .byte 0x09,0x68,0x00,0x00 # vmovaps 0x00(rsp),xmm6 + .byte 0x04,0x01,0x15,0x00 # sub rsp,0xa8 + .byte 0x00,0xb3,0x00,0x00 # set_frame r11 ___ } diff --git a/vendor/openssl/openssl/crypto/bn/asm/rsaz-x86_64.pl b/vendor/openssl/openssl/crypto/bn/asm/rsaz-x86_64.pl index 12b571c28..87ce2c34d 100755 --- a/vendor/openssl/openssl/crypto/bn/asm/rsaz-x86_64.pl +++ b/vendor/openssl/openssl/crypto/bn/asm/rsaz-x86_64.pl @@ -113,7 +113,7 @@ $addx = ($1>=12); } -if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([3-9])\.([0-9]+)/) { +if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9])\.([0-9]+)/) { my $ver = $2 + $3/100.0; # 3.1->3.01, 3.10->3.10 $addx = ($ver>=3.03); } @@ -915,9 +915,76 @@ push %r14 push %r15 - mov $pwr, $pwr - subq \$128+24, %rsp + subq \$`128+24+($win64?0xb0:0)`, %rsp +___ +$code.=<<___ if ($win64); + movaps %xmm6,0xa0(%rsp) + movaps %xmm7,0xb0(%rsp) + movaps %xmm8,0xc0(%rsp) + movaps %xmm9,0xd0(%rsp) + movaps %xmm10,0xe0(%rsp) + movaps %xmm11,0xf0(%rsp) + movaps %xmm12,0x100(%rsp) + movaps %xmm13,0x110(%rsp) + movaps %xmm14,0x120(%rsp) + movaps %xmm15,0x130(%rsp) +___ +$code.=<<___; .Lmul_gather4_body: + movd $pwr,%xmm8 + movdqa .Linc+16(%rip),%xmm1 # 00000002000000020000000200000002 + movdqa .Linc(%rip),%xmm0 # 00000001000000010000000000000000 + + pshufd \$0,%xmm8,%xmm8 # broadcast $power + movdqa %xmm1,%xmm7 + movdqa %xmm1,%xmm2 +___ +######################################################################## +# calculate mask by comparing 0..15 to $power +# +for($i=0;$i<4;$i++) { +$code.=<<___; + paddd %xmm`$i`,%xmm`$i+1` + pcmpeqd %xmm8,%xmm`$i` + movdqa %xmm7,%xmm`$i+3` +___ +} +for(;$i<7;$i++) { +$code.=<<___; + paddd %xmm`$i`,%xmm`$i+1` + pcmpeqd %xmm8,%xmm`$i` +___ +} +$code.=<<___; + pcmpeqd %xmm8,%xmm7 + + movdqa 16*0($bp),%xmm8 + movdqa 16*1($bp),%xmm9 + movdqa 16*2($bp),%xmm10 + movdqa 16*3($bp),%xmm11 + pand %xmm0,%xmm8 + movdqa 16*4($bp),%xmm12 + pand %xmm1,%xmm9 + movdqa 16*5($bp),%xmm13 + pand %xmm2,%xmm10 + movdqa 16*6($bp),%xmm14 + pand %xmm3,%xmm11 + movdqa 16*7($bp),%xmm15 + leaq 128($bp), %rbp + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd \$0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 ___ $code.=<<___ if ($addx); movl \$0x80100,%r11d @@ -926,45 +993,38 @@ je .Lmulx_gather ___ $code.=<<___; - movl 64($bp,$pwr,4), %eax - movq $out, %xmm0 # off-load arguments - movl ($bp,$pwr,4), %ebx - movq $mod, %xmm1 - movq $n0, 128(%rsp) + movq %xmm8,%rbx + + movq $n0, 128(%rsp) # off-load arguments + movq $out, 128+8(%rsp) + movq $mod, 128+16(%rsp) - shlq \$32, %rax - or %rax, %rbx movq ($ap), %rax movq 8($ap), %rcx - leaq 128($bp,$pwr,4), %rbp mulq %rbx # 0 iteration movq %rax, (%rsp) movq %rcx, %rax movq %rdx, %r8 mulq %rbx - movd (%rbp), %xmm4 addq %rax, %r8 movq 16($ap), %rax movq %rdx, %r9 adcq \$0, %r9 mulq %rbx - movd 64(%rbp), %xmm5 addq %rax, %r9 movq 24($ap), %rax movq %rdx, %r10 adcq \$0, %r10 mulq %rbx - pslldq \$4, %xmm5 addq %rax, %r10 movq 32($ap), %rax movq %rdx, %r11 adcq \$0, %r11 mulq %rbx - por %xmm5, %xmm4 addq %rax, %r11 movq 40($ap), %rax movq %rdx, %r12 @@ -977,14 +1037,12 @@ adcq \$0, %r13 mulq %rbx - leaq 128(%rbp), %rbp addq %rax, %r13 movq 56($ap), %rax movq %rdx, %r14 adcq \$0, %r14 mulq %rbx - movq %xmm4, %rbx addq %rax, %r14 movq ($ap), %rax movq %rdx, %r15 @@ -996,6 +1054,35 @@ .align 32 .Loop_mul_gather: + movdqa 16*0(%rbp),%xmm8 + movdqa 16*1(%rbp),%xmm9 + movdqa 16*2(%rbp),%xmm10 + movdqa 16*3(%rbp),%xmm11 + pand %xmm0,%xmm8 + movdqa 16*4(%rbp),%xmm12 + pand %xmm1,%xmm9 + movdqa 16*5(%rbp),%xmm13 + pand %xmm2,%xmm10 + movdqa 16*6(%rbp),%xmm14 + pand %xmm3,%xmm11 + movdqa 16*7(%rbp),%xmm15 + leaq 128(%rbp), %rbp + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd \$0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 + movq %xmm8,%rbx + mulq %rbx addq %rax, %r8 movq 8($ap), %rax @@ -1004,7 +1091,6 @@ adcq \$0, %r8 mulq %rbx - movd (%rbp), %xmm4 addq %rax, %r9 movq 16($ap), %rax adcq \$0, %rdx @@ -1013,7 +1099,6 @@ adcq \$0, %r9 mulq %rbx - movd 64(%rbp), %xmm5 addq %rax, %r10 movq 24($ap), %rax adcq \$0, %rdx @@ -1022,7 +1107,6 @@ adcq \$0, %r10 mulq %rbx - pslldq \$4, %xmm5 addq %rax, %r11 movq 32($ap), %rax adcq \$0, %rdx @@ -1031,7 +1115,6 @@ adcq \$0, %r11 mulq %rbx - por %xmm5, %xmm4 addq %rax, %r12 movq 40($ap), %rax adcq \$0, %rdx @@ -1056,7 +1139,6 @@ adcq \$0, %r14 mulq %rbx - movq %xmm4, %rbx addq %rax, %r15 movq ($ap), %rax adcq \$0, %rdx @@ -1064,7 +1146,6 @@ movq %rdx, %r15 adcq \$0, %r15 - leaq 128(%rbp), %rbp leaq 8(%rdi), %rdi decl %ecx @@ -1079,8 +1160,8 @@ movq %r14, 48(%rdi) movq %r15, 56(%rdi) - movq %xmm0, $out - movq %xmm1, %rbp + movq 128+8(%rsp), $out + movq 128+16(%rsp), %rbp movq (%rsp), %r8 movq 8(%rsp), %r9 @@ -1098,45 +1179,37 @@ .align 32 .Lmulx_gather: - mov 64($bp,$pwr,4), %eax - movq $out, %xmm0 # off-load arguments - lea 128($bp,$pwr,4), %rbp - mov ($bp,$pwr,4), %edx - movq $mod, %xmm1 - mov $n0, 128(%rsp) + movq %xmm8,%rdx + + mov $n0, 128(%rsp) # off-load arguments + mov $out, 128+8(%rsp) + mov $mod, 128+16(%rsp) - shl \$32, %rax - or %rax, %rdx mulx ($ap), %rbx, %r8 # 0 iteration mov %rbx, (%rsp) xor %edi, %edi # cf=0, of=0 mulx 8($ap), %rax, %r9 - movd (%rbp), %xmm4 mulx 16($ap), %rbx, %r10 - movd 64(%rbp), %xmm5 adcx %rax, %r8 mulx 24($ap), %rax, %r11 - pslldq \$4, %xmm5 adcx %rbx, %r9 mulx 32($ap), %rbx, %r12 - por %xmm5, %xmm4 adcx %rax, %r10 mulx 40($ap), %rax, %r13 adcx %rbx, %r11 mulx 48($ap), %rbx, %r14 - lea 128(%rbp), %rbp adcx %rax, %r12 mulx 56($ap), %rax, %r15 - movq %xmm4, %rdx adcx %rbx, %r13 adcx %rax, %r14 + .byte 0x67 mov %r8, %rbx adcx %rdi, %r15 # %rdi is 0 @@ -1145,24 +1218,48 @@ .align 32 .Loop_mulx_gather: - mulx ($ap), %rax, %r8 + movdqa 16*0(%rbp),%xmm8 + movdqa 16*1(%rbp),%xmm9 + movdqa 16*2(%rbp),%xmm10 + movdqa 16*3(%rbp),%xmm11 + pand %xmm0,%xmm8 + movdqa 16*4(%rbp),%xmm12 + pand %xmm1,%xmm9 + movdqa 16*5(%rbp),%xmm13 + pand %xmm2,%xmm10 + movdqa 16*6(%rbp),%xmm14 + pand %xmm3,%xmm11 + movdqa 16*7(%rbp),%xmm15 + leaq 128(%rbp), %rbp + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd \$0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 + movq %xmm8,%rdx + + .byte 0xc4,0x62,0xfb,0xf6,0x86,0x00,0x00,0x00,0x00 # mulx ($ap), %rax, %r8 adcx %rax, %rbx adox %r9, %r8 mulx 8($ap), %rax, %r9 - .byte 0x66,0x0f,0x6e,0xa5,0x00,0x00,0x00,0x00 # movd (%rbp), %xmm4 adcx %rax, %r8 adox %r10, %r9 mulx 16($ap), %rax, %r10 - movd 64(%rbp), %xmm5 - lea 128(%rbp), %rbp adcx %rax, %r9 adox %r11, %r10 .byte 0xc4,0x62,0xfb,0xf6,0x9e,0x18,0x00,0x00,0x00 # mulx 24($ap), %rax, %r11 - pslldq \$4, %xmm5 - por %xmm5, %xmm4 adcx %rax, %r10 adox %r12, %r11 @@ -1176,10 +1273,10 @@ .byte 0xc4,0x62,0xfb,0xf6,0xb6,0x30,0x00,0x00,0x00 # mulx 48($ap), %rax, %r14 adcx %rax, %r13 + .byte 0x67 adox %r15, %r14 mulx 56($ap), %rax, %r15 - movq %xmm4, %rdx mov %rbx, 64(%rsp,%rcx,8) adcx %rax, %r14 adox %rdi, %r15 @@ -1198,10 +1295,10 @@ mov %r14, 64+48(%rsp) mov %r15, 64+56(%rsp) - movq %xmm0, $out - movq %xmm1, %rbp + mov 128(%rsp), %rdx # pull arguments + mov 128+8(%rsp), $out + mov 128+16(%rsp), %rbp - mov 128(%rsp), %rdx # pull $n0 mov (%rsp), %r8 mov 8(%rsp), %r9 mov 16(%rsp), %r10 @@ -1229,6 +1326,21 @@ call __rsaz_512_subtract leaq 128+24+48(%rsp), %rax +___ +$code.=<<___ if ($win64); + movaps 0xa0-0xc8(%rax),%xmm6 + movaps 0xb0-0xc8(%rax),%xmm7 + movaps 0xc0-0xc8(%rax),%xmm8 + movaps 0xd0-0xc8(%rax),%xmm9 + movaps 0xe0-0xc8(%rax),%xmm10 + movaps 0xf0-0xc8(%rax),%xmm11 + movaps 0x100-0xc8(%rax),%xmm12 + movaps 0x110-0xc8(%rax),%xmm13 + movaps 0x120-0xc8(%rax),%xmm14 + movaps 0x130-0xc8(%rax),%xmm15 + lea 0xb0(%rax),%rax +___ +$code.=<<___; movq -48(%rax), %r15 movq -40(%rax), %r14 movq -32(%rax), %r13 @@ -1258,7 +1370,7 @@ mov $pwr, $pwr subq \$128+24, %rsp .Lmul_scatter4_body: - leaq ($tbl,$pwr,4), $tbl + leaq ($tbl,$pwr,8), $tbl movq $out, %xmm0 # off-load arguments movq $mod, %xmm1 movq $tbl, %xmm2 @@ -1329,30 +1441,14 @@ call __rsaz_512_subtract - movl %r8d, 64*0($inp) # scatter - shrq \$32, %r8 - movl %r9d, 64*2($inp) - shrq \$32, %r9 - movl %r10d, 64*4($inp) - shrq \$32, %r10 - movl %r11d, 64*6($inp) - shrq \$32, %r11 - movl %r12d, 64*8($inp) - shrq \$32, %r12 - movl %r13d, 64*10($inp) - shrq \$32, %r13 - movl %r14d, 64*12($inp) - shrq \$32, %r14 - movl %r15d, 64*14($inp) - shrq \$32, %r15 - movl %r8d, 64*1($inp) - movl %r9d, 64*3($inp) - movl %r10d, 64*5($inp) - movl %r11d, 64*7($inp) - movl %r12d, 64*9($inp) - movl %r13d, 64*11($inp) - movl %r14d, 64*13($inp) - movl %r15d, 64*15($inp) + movq %r8, 128*0($inp) # scatter + movq %r9, 128*1($inp) + movq %r10, 128*2($inp) + movq %r11, 128*3($inp) + movq %r12, 128*4($inp) + movq %r13, 128*5($inp) + movq %r14, 128*6($inp) + movq %r15, 128*7($inp) leaq 128+24+48(%rsp), %rax movq -48(%rax), %r15 @@ -1956,16 +2052,14 @@ .type rsaz_512_scatter4,\@abi-omnipotent .align 16 rsaz_512_scatter4: - leaq ($out,$power,4), $out + leaq ($out,$power,8), $out movl \$8, %r9d jmp .Loop_scatter .align 16 .Loop_scatter: movq ($inp), %rax leaq 8($inp), $inp - movl %eax, ($out) - shrq \$32, %rax - movl %eax, 64($out) + movq %rax, ($out) leaq 128($out), $out decl %r9d jnz .Loop_scatter @@ -1976,22 +2070,106 @@ .type rsaz_512_gather4,\@abi-omnipotent .align 16 rsaz_512_gather4: - leaq ($inp,$power,4), $inp +___ +$code.=<<___ if ($win64); +.LSEH_begin_rsaz_512_gather4: + .byte 0x48,0x81,0xec,0xa8,0x00,0x00,0x00 # sub $0xa8,%rsp + .byte 0x0f,0x29,0x34,0x24 # movaps %xmm6,(%rsp) + .byte 0x0f,0x29,0x7c,0x24,0x10 # movaps %xmm7,0x10(%rsp) + .byte 0x44,0x0f,0x29,0x44,0x24,0x20 # movaps %xmm8,0x20(%rsp) + .byte 0x44,0x0f,0x29,0x4c,0x24,0x30 # movaps %xmm9,0x30(%rsp) + .byte 0x44,0x0f,0x29,0x54,0x24,0x40 # movaps %xmm10,0x40(%rsp) + .byte 0x44,0x0f,0x29,0x5c,0x24,0x50 # movaps %xmm11,0x50(%rsp) + .byte 0x44,0x0f,0x29,0x64,0x24,0x60 # movaps %xmm12,0x60(%rsp) + .byte 0x44,0x0f,0x29,0x6c,0x24,0x70 # movaps %xmm13,0x70(%rsp) + .byte 0x44,0x0f,0x29,0xb4,0x24,0x80,0,0,0 # movaps %xmm14,0x80(%rsp) + .byte 0x44,0x0f,0x29,0xbc,0x24,0x90,0,0,0 # movaps %xmm15,0x90(%rsp) +___ +$code.=<<___; + movd $power,%xmm8 + movdqa .Linc+16(%rip),%xmm1 # 00000002000000020000000200000002 + movdqa .Linc(%rip),%xmm0 # 00000001000000010000000000000000 + + pshufd \$0,%xmm8,%xmm8 # broadcast $power + movdqa %xmm1,%xmm7 + movdqa %xmm1,%xmm2 +___ +######################################################################## +# calculate mask by comparing 0..15 to $power +# +for($i=0;$i<4;$i++) { +$code.=<<___; + paddd %xmm`$i`,%xmm`$i+1` + pcmpeqd %xmm8,%xmm`$i` + movdqa %xmm7,%xmm`$i+3` +___ +} +for(;$i<7;$i++) { +$code.=<<___; + paddd %xmm`$i`,%xmm`$i+1` + pcmpeqd %xmm8,%xmm`$i` +___ +} +$code.=<<___; + pcmpeqd %xmm8,%xmm7 movl \$8, %r9d jmp .Loop_gather .align 16 .Loop_gather: - movl ($inp), %eax - movl 64($inp), %r8d + movdqa 16*0($inp),%xmm8 + movdqa 16*1($inp),%xmm9 + movdqa 16*2($inp),%xmm10 + movdqa 16*3($inp),%xmm11 + pand %xmm0,%xmm8 + movdqa 16*4($inp),%xmm12 + pand %xmm1,%xmm9 + movdqa 16*5($inp),%xmm13 + pand %xmm2,%xmm10 + movdqa 16*6($inp),%xmm14 + pand %xmm3,%xmm11 + movdqa 16*7($inp),%xmm15 leaq 128($inp), $inp - shlq \$32, %r8 - or %r8, %rax - movq %rax, ($out) + pand %xmm4,%xmm12 + pand %xmm5,%xmm13 + pand %xmm6,%xmm14 + pand %xmm7,%xmm15 + por %xmm10,%xmm8 + por %xmm11,%xmm9 + por %xmm12,%xmm8 + por %xmm13,%xmm9 + por %xmm14,%xmm8 + por %xmm15,%xmm9 + + por %xmm9,%xmm8 + pshufd \$0x4e,%xmm8,%xmm9 + por %xmm9,%xmm8 + movq %xmm8,($out) leaq 8($out), $out decl %r9d jnz .Loop_gather +___ +$code.=<<___ if ($win64); + movaps 0x00(%rsp),%xmm6 + movaps 0x10(%rsp),%xmm7 + movaps 0x20(%rsp),%xmm8 + movaps 0x30(%rsp),%xmm9 + movaps 0x40(%rsp),%xmm10 + movaps 0x50(%rsp),%xmm11 + movaps 0x60(%rsp),%xmm12 + movaps 0x70(%rsp),%xmm13 + movaps 0x80(%rsp),%xmm14 + movaps 0x90(%rsp),%xmm15 + add \$0xa8,%rsp +___ +$code.=<<___; ret +.LSEH_end_rsaz_512_gather4: .size rsaz_512_gather4,.-rsaz_512_gather4 + +.align 64 +.Linc: + .long 0,0, 1,1 + .long 2,2, 2,2 ___ } @@ -2039,6 +2217,18 @@ lea 128+24+48(%rax),%rax + lea .Lmul_gather4_epilogue(%rip),%rbx + cmp %r10,%rbx + jne .Lse_not_in_mul_gather4 + + lea 0xb0(%rax),%rax + + lea -48-0xa8(%rax),%rsi + lea 512($context),%rdi + mov \$20,%ecx + .long 0xa548f3fc # cld; rep movsq + +.Lse_not_in_mul_gather4: mov -8(%rax),%rbx mov -16(%rax),%rbp mov -24(%rax),%r12 @@ -2090,7 +2280,7 @@ pop %rdi pop %rsi ret -.size sqr_handler,.-sqr_handler +.size se_handler,.-se_handler .section .pdata .align 4 @@ -2114,6 +2304,10 @@ .rva .LSEH_end_rsaz_512_mul_by_one .rva .LSEH_info_rsaz_512_mul_by_one + .rva .LSEH_begin_rsaz_512_gather4 + .rva .LSEH_end_rsaz_512_gather4 + .rva .LSEH_info_rsaz_512_gather4 + .section .xdata .align 8 .LSEH_info_rsaz_512_sqr: @@ -2136,6 +2330,19 @@ .byte 9,0,0,0 .rva se_handler .rva .Lmul_by_one_body,.Lmul_by_one_epilogue # HandlerData[] +.LSEH_info_rsaz_512_gather4: + .byte 0x01,0x46,0x16,0x00 + .byte 0x46,0xf8,0x09,0x00 # vmovaps 0x90(rsp),xmm15 + .byte 0x3d,0xe8,0x08,0x00 # vmovaps 0x80(rsp),xmm14 + .byte 0x34,0xd8,0x07,0x00 # vmovaps 0x70(rsp),xmm13 + .byte 0x2e,0xc8,0x06,0x00 # vmovaps 0x60(rsp),xmm12 + .byte 0x28,0xb8,0x05,0x00 # vmovaps 0x50(rsp),xmm11 + .byte 0x22,0xa8,0x04,0x00 # vmovaps 0x40(rsp),xmm10 + .byte 0x1c,0x98,0x03,0x00 # vmovaps 0x30(rsp),xmm9 + .byte 0x16,0x88,0x02,0x00 # vmovaps 0x20(rsp),xmm8 + .byte 0x10,0x78,0x01,0x00 # vmovaps 0x10(rsp),xmm7 + .byte 0x0b,0x68,0x00,0x00 # vmovaps 0x00(rsp),xmm6 + .byte 0x07,0x01,0x15,0x00 # sub rsp,0xa8 ___ } diff --git a/vendor/openssl/openssl/crypto/bn/asm/x86-mont.pl b/vendor/openssl/openssl/crypto/bn/asm/x86-mont.pl index e8f6b0508..89f4de61e 100755 --- a/vendor/openssl/openssl/crypto/bn/asm/x86-mont.pl +++ b/vendor/openssl/openssl/crypto/bn/asm/x86-mont.pl @@ -85,6 +85,21 @@ &and ("esp",-64); # align to cache line + # Some OSes, *cough*-dows, insist on stack being "wired" to + # physical memory in strictly sequential manner, i.e. if stack + # allocation spans two pages, then reference to farmost one can + # be punishable by SEGV. But page walking can do good even on + # other OSes, because it guarantees that villain thread hits + # the guard page before it can make damage to innocent one... + &mov ("eax","ebp"); + &sub ("eax","esp"); + &and ("eax",-4096); +&set_label("page_walk"); + &mov ("edx",&DWP(0,"esp","eax")); + &sub ("eax",4096); + &data_byte(0x2e); + &jnc (&label("page_walk")); + ################################# load argument block... &mov ("eax",&DWP(0*4,"esi"));# BN_ULONG *rp &mov ("ebx",&DWP(1*4,"esi"));# const BN_ULONG *ap diff --git a/vendor/openssl/openssl/crypto/bn/asm/x86_64-mont.pl b/vendor/openssl/openssl/crypto/bn/asm/x86_64-mont.pl index 725833d02..8fb6c994e 100755 --- a/vendor/openssl/openssl/crypto/bn/asm/x86_64-mont.pl +++ b/vendor/openssl/openssl/crypto/bn/asm/x86_64-mont.pl @@ -68,7 +68,7 @@ $addx = ($1>=12); } -if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([3-9])\.([0-9]+)/) { +if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9])\.([0-9]+)/) { my $ver = $2 + $3/100.0; # 3.1->3.01, 3.10->3.10 $addx = ($ver>=3.03); } @@ -130,6 +130,20 @@ mov %r11,8(%rsp,$num,8) # tp[num+1]=%rsp .Lmul_body: + # Some OSes, *cough*-dows, insist on stack being "wired" to + # physical memory in strictly sequential manner, i.e. if stack + # allocation spans two pages, then reference to farmost one can + # be punishable by SEGV. But page walking can do good even on + # other OSes, because it guarantees that villain thread hits + # the guard page before it can make damage to innocent one... + sub %rsp,%r11 + and \$-4096,%r11 +.Lmul_page_walk: + mov (%rsp,%r11),%r10 + sub \$4096,%r11 + .byte 0x66,0x2e # predict non-taken + jnc .Lmul_page_walk + mov $bp,%r12 # reassign $bp ___ $bp="%r12"; @@ -342,6 +356,14 @@ mov %r11,8(%rsp,$num,8) # tp[num+1]=%rsp .Lmul4x_body: + sub %rsp,%r11 + and \$-4096,%r11 +.Lmul4x_page_walk: + mov (%rsp,%r11),%r10 + sub \$4096,%r11 + .byte 0x2e # predict non-taken + jnc .Lmul4x_page_walk + mov $rp,16(%rsp,$num,8) # tp[num+2]=$rp mov %rdx,%r12 # reassign $bp ___ @@ -775,100 +797,135 @@ # 4096. this is done to allow memory disambiguation logic # do its job. # - lea -64(%rsp,$num,4),%r11 + lea -64(%rsp,$num,2),%r11 mov ($n0),$n0 # *n0 sub $aptr,%r11 and \$4095,%r11 cmp %r11,%r10 jb .Lsqr8x_sp_alt sub %r11,%rsp # align with $aptr - lea -64(%rsp,$num,4),%rsp # alloca(frame+4*$num) + lea -64(%rsp,$num,2),%rsp # alloca(frame+2*$num) jmp .Lsqr8x_sp_done .align 32 .Lsqr8x_sp_alt: - lea 4096-64(,$num,4),%r10 # 4096-frame-4*$num - lea -64(%rsp,$num,4),%rsp # alloca(frame+4*$num) + lea 4096-64(,$num,2),%r10 # 4096-frame-2*$num + lea -64(%rsp,$num,2),%rsp # alloca(frame+2*$num) sub %r10,%r11 mov \$0,%r10 cmovc %r10,%r11 sub %r11,%rsp .Lsqr8x_sp_done: and \$-64,%rsp - mov $num,%r10 + mov %rax,%r11 + sub %rsp,%r11 + and \$-4096,%r11 +.Lsqr8x_page_walk: + mov (%rsp,%r11),%r10 + sub \$4096,%r11 + .byte 0x2e # predict non-taken + jnc .Lsqr8x_page_walk + + mov $num,%r10 neg $num - lea 64(%rsp,$num,2),%r11 # copy of modulus mov $n0, 32(%rsp) mov %rax, 40(%rsp) # save original %rsp .Lsqr8x_body: - mov $num,$i - movq %r11, %xmm2 # save pointer to modulus copy - shr \$3+2,$i - mov OPENSSL_ia32cap_P+8(%rip),%eax - jmp .Lsqr8x_copy_n - -.align 32 -.Lsqr8x_copy_n: - movq 8*0($nptr),%xmm0 - movq 8*1($nptr),%xmm1 - movq 8*2($nptr),%xmm3 - movq 8*3($nptr),%xmm4 - lea 8*4($nptr),$nptr - movdqa %xmm0,16*0(%r11) - movdqa %xmm1,16*1(%r11) - movdqa %xmm3,16*2(%r11) - movdqa %xmm4,16*3(%r11) - lea 16*4(%r11),%r11 - dec $i - jnz .Lsqr8x_copy_n - + movq $nptr, %xmm2 # save pointer to modulus pxor %xmm0,%xmm0 movq $rptr,%xmm1 # save $rptr movq %r10, %xmm3 # -$num ___ $code.=<<___ if ($addx); + mov OPENSSL_ia32cap_P+8(%rip),%eax and \$0x80100,%eax cmp \$0x80100,%eax jne .Lsqr8x_nox call bn_sqrx8x_internal # see x86_64-mont5 module - - pxor %xmm0,%xmm0 - lea 48(%rsp),%rax - lea 64(%rsp,$num,2),%rdx - shr \$3+2,$num - mov 40(%rsp),%rsi # restore %rsp - jmp .Lsqr8x_zero + # %rax top-most carry + # %rbp nptr + # %rcx -8*num + # %r8 end of tp[2*num] + lea (%r8,%rcx),%rbx + mov %rcx,$num + mov %rcx,%rdx + movq %xmm1,$rptr + sar \$3+2,%rcx # %cf=0 + jmp .Lsqr8x_sub .align 32 .Lsqr8x_nox: ___ $code.=<<___; call bn_sqr8x_internal # see x86_64-mont5 module + # %rax top-most carry + # %rbp nptr + # %r8 -8*num + # %rdi end of tp[2*num] + lea (%rdi,$num),%rbx + mov $num,%rcx + mov $num,%rdx + movq %xmm1,$rptr + sar \$3+2,%rcx # %cf=0 + jmp .Lsqr8x_sub +.align 32 +.Lsqr8x_sub: + mov 8*0(%rbx),%r12 + mov 8*1(%rbx),%r13 + mov 8*2(%rbx),%r14 + mov 8*3(%rbx),%r15 + lea 8*4(%rbx),%rbx + sbb 8*0(%rbp),%r12 + sbb 8*1(%rbp),%r13 + sbb 8*2(%rbp),%r14 + sbb 8*3(%rbp),%r15 + lea 8*4(%rbp),%rbp + mov %r12,8*0($rptr) + mov %r13,8*1($rptr) + mov %r14,8*2($rptr) + mov %r15,8*3($rptr) + lea 8*4($rptr),$rptr + inc %rcx # preserves %cf + jnz .Lsqr8x_sub + + sbb \$0,%rax # top-most carry + lea (%rbx,$num),%rbx # rewind + lea ($rptr,$num),$rptr # rewind + + movq %rax,%xmm1 pxor %xmm0,%xmm0 - lea 48(%rsp),%rax - lea 64(%rsp,$num,2),%rdx - shr \$3+2,$num + pshufd \$0,%xmm1,%xmm1 mov 40(%rsp),%rsi # restore %rsp - jmp .Lsqr8x_zero + jmp .Lsqr8x_cond_copy .align 32 -.Lsqr8x_zero: - movdqa %xmm0,16*0(%rax) # wipe t - movdqa %xmm0,16*1(%rax) - movdqa %xmm0,16*2(%rax) - movdqa %xmm0,16*3(%rax) - lea 16*4(%rax),%rax - movdqa %xmm0,16*0(%rdx) # wipe n - movdqa %xmm0,16*1(%rdx) - movdqa %xmm0,16*2(%rdx) - movdqa %xmm0,16*3(%rdx) - lea 16*4(%rdx),%rdx - dec $num - jnz .Lsqr8x_zero +.Lsqr8x_cond_copy: + movdqa 16*0(%rbx),%xmm2 + movdqa 16*1(%rbx),%xmm3 + lea 16*2(%rbx),%rbx + movdqu 16*0($rptr),%xmm4 + movdqu 16*1($rptr),%xmm5 + lea 16*2($rptr),$rptr + movdqa %xmm0,-16*2(%rbx) # zero tp + movdqa %xmm0,-16*1(%rbx) + movdqa %xmm0,-16*2(%rbx,%rdx) + movdqa %xmm0,-16*1(%rbx,%rdx) + pcmpeqd %xmm1,%xmm0 + pand %xmm1,%xmm2 + pand %xmm1,%xmm3 + pand %xmm0,%xmm4 + pand %xmm0,%xmm5 + pxor %xmm0,%xmm0 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqu %xmm4,-16*2($rptr) + movdqu %xmm5,-16*1($rptr) + add \$32,$num + jnz .Lsqr8x_cond_copy mov \$1,%rax mov -48(%rsi),%r15 @@ -906,8 +963,17 @@ sub $num,%r10 # -$num mov ($n0),$n0 # *n0 lea -72(%rsp,%r10),%rsp # alloca(frame+$num+8) - lea ($bp,$num),%r10 and \$-128,%rsp + mov %rax,%r11 + sub %rsp,%r11 + and \$-4096,%r11 +.Lmulx4x_page_walk: + mov (%rsp,%r11),%r10 + sub \$4096,%r11 + .byte 0x66,0x2e # predict non-taken + jnc .Lmulx4x_page_walk + + lea ($bp,$num),%r10 ############################################################## # Stack layout # +0 num @@ -1135,64 +1201,75 @@ adc $zero,%r15 # modulo-scheduled sub 0*8($tptr),$zero # pull top-most carry adc %r15,%r14 - mov -8($nptr),$mi sbb %r15,%r15 # top-most carry mov %r14,-1*8($tptr) cmp 16(%rsp),$bptr jne .Lmulx4x_outer - sub %r14,$mi # compare top-most words - sbb $mi,$mi - or $mi,%r15 - - neg $num - xor %rdx,%rdx + lea 64(%rsp),$tptr + sub $num,$nptr # rewind $nptr + neg %r15 + mov $num,%rdx + shr \$3+2,$num # %cf=0 mov 32(%rsp),$rptr # restore rp + jmp .Lmulx4x_sub + +.align 32 +.Lmulx4x_sub: + mov 8*0($tptr),%r11 + mov 8*1($tptr),%r12 + mov 8*2($tptr),%r13 + mov 8*3($tptr),%r14 + lea 8*4($tptr),$tptr + sbb 8*0($nptr),%r11 + sbb 8*1($nptr),%r12 + sbb 8*2($nptr),%r13 + sbb 8*3($nptr),%r14 + lea 8*4($nptr),$nptr + mov %r11,8*0($rptr) + mov %r12,8*1($rptr) + mov %r13,8*2($rptr) + mov %r14,8*3($rptr) + lea 8*4($rptr),$rptr + dec $num # preserves %cf + jnz .Lmulx4x_sub + + sbb \$0,%r15 # top-most carry lea 64(%rsp),$tptr + sub %rdx,$rptr # rewind + movq %r15,%xmm1 pxor %xmm0,%xmm0 - mov 0*8($nptr,$num),%r8 - mov 1*8($nptr,$num),%r9 - neg %r8 - jmp .Lmulx4x_sub_entry + pshufd \$0,%xmm1,%xmm1 + mov 40(%rsp),%rsi # restore %rsp + jmp .Lmulx4x_cond_copy .align 32 -.Lmulx4x_sub: - mov 0*8($nptr,$num),%r8 - mov 1*8($nptr,$num),%r9 - not %r8 -.Lmulx4x_sub_entry: - mov 2*8($nptr,$num),%r10 - not %r9 - and %r15,%r8 - mov 3*8($nptr,$num),%r11 - not %r10 - and %r15,%r9 - not %r11 - and %r15,%r10 - and %r15,%r11 - - neg %rdx # mov %rdx,%cf - adc 0*8($tptr),%r8 - adc 1*8($tptr),%r9 - movdqa %xmm0,($tptr) - adc 2*8($tptr),%r10 - adc 3*8($tptr),%r11 - movdqa %xmm0,16($tptr) - lea 4*8($tptr),$tptr - sbb %rdx,%rdx # mov %cf,%rdx - - mov %r8,0*8($rptr) - mov %r9,1*8($rptr) - mov %r10,2*8($rptr) - mov %r11,3*8($rptr) - lea 4*8($rptr),$rptr +.Lmulx4x_cond_copy: + movdqa 16*0($tptr),%xmm2 + movdqa 16*1($tptr),%xmm3 + lea 16*2($tptr),$tptr + movdqu 16*0($rptr),%xmm4 + movdqu 16*1($rptr),%xmm5 + lea 16*2($rptr),$rptr + movdqa %xmm0,-16*2($tptr) # zero tp + movdqa %xmm0,-16*1($tptr) + pcmpeqd %xmm1,%xmm0 + pand %xmm1,%xmm2 + pand %xmm1,%xmm3 + pand %xmm0,%xmm4 + pand %xmm0,%xmm5 + pxor %xmm0,%xmm0 + por %xmm2,%xmm4 + por %xmm3,%xmm5 + movdqu %xmm4,-16*2($rptr) + movdqu %xmm5,-16*1($rptr) + sub \$32,%rdx + jnz .Lmulx4x_cond_copy - add \$32,$num - jnz .Lmulx4x_sub + mov %rdx,($tptr) - mov 40(%rsp),%rsi # restore %rsp mov \$1,%rax mov -48(%rsi),%r15 mov -40(%rsi),%r14 diff --git a/vendor/openssl/openssl/crypto/bn/asm/x86_64-mont5.pl b/vendor/openssl/openssl/crypto/bn/asm/x86_64-mont5.pl index 64e668f14..938e17081 100755 --- a/vendor/openssl/openssl/crypto/bn/asm/x86_64-mont5.pl +++ b/vendor/openssl/openssl/crypto/bn/asm/x86_64-mont5.pl @@ -53,7 +53,7 @@ $addx = ($1>=12); } -if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([3-9])\.([0-9]+)/) { +if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9])\.([0-9]+)/) { my $ver = $2 + $3/100.0; # 3.1->3.01, 3.10->3.10 $addx = ($ver>=3.03); } @@ -99,58 +99,125 @@ .Lmul_enter: mov ${num}d,${num}d mov %rsp,%rax - mov `($win64?56:8)`(%rsp),%r10d # load 7th argument + movd `($win64?56:8)`(%rsp),%xmm5 # load 7th argument + lea .Linc(%rip),%r10 push %rbx push %rbp push %r12 push %r13 push %r14 push %r15 -___ -$code.=<<___ if ($win64); - lea -0x28(%rsp),%rsp - movaps %xmm6,(%rsp) - movaps %xmm7,0x10(%rsp) -___ -$code.=<<___; + lea 2($num),%r11 neg %r11 - lea (%rsp,%r11,8),%rsp # tp=alloca(8*(num+2)) + lea -264(%rsp,%r11,8),%rsp # tp=alloca(8*(num+2)+256+8) and \$-1024,%rsp # minimize TLB usage mov %rax,8(%rsp,$num,8) # tp[num+1]=%rsp .Lmul_body: - mov $bp,%r12 # reassign $bp + # Some OSes, *cough*-dows, insist on stack being "wired" to + # physical memory in strictly sequential manner, i.e. if stack + # allocation spans two pages, then reference to farmost one can + # be punishable by SEGV. But page walking can do good even on + # other OSes, because it guarantees that villain thread hits + # the guard page before it can make damage to innocent one... + sub %rsp,%rax + and \$-4096,%rax +.Lmul_page_walk: + mov (%rsp,%rax),%r11 + sub \$4096,%rax + .byte 0x2e # predict non-taken + jnc .Lmul_page_walk + + lea 128($bp),%r12 # reassign $bp (+size optimization) ___ $bp="%r12"; $STRIDE=2**5*8; # 5 is "window size" $N=$STRIDE/4; # should match cache line size $code.=<<___; - mov %r10,%r11 - shr \$`log($N/8)/log(2)`,%r10 - and \$`$N/8-1`,%r11 - not %r10 - lea .Lmagic_masks(%rip),%rax - and \$`2**5/($N/8)-1`,%r10 # 5 is "window size" - lea 96($bp,%r11,8),$bp # pointer within 1st cache line - movq 0(%rax,%r10,8),%xmm4 # set of masks denoting which - movq 8(%rax,%r10,8),%xmm5 # cache line contains element - movq 16(%rax,%r10,8),%xmm6 # denoted by 7th argument - movq 24(%rax,%r10,8),%xmm7 - - movq `0*$STRIDE/4-96`($bp),%xmm0 - movq `1*$STRIDE/4-96`($bp),%xmm1 - pand %xmm4,%xmm0 - movq `2*$STRIDE/4-96`($bp),%xmm2 - pand %xmm5,%xmm1 - movq `3*$STRIDE/4-96`($bp),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 + movdqa 0(%r10),%xmm0 # 00000001000000010000000000000000 + movdqa 16(%r10),%xmm1 # 00000002000000020000000200000002 + lea 24-112(%rsp,$num,8),%r10# place the mask after tp[num+3] (+ICache optimization) + and \$-16,%r10 + + pshufd \$0,%xmm5,%xmm5 # broadcast index + movdqa %xmm1,%xmm4 + movdqa %xmm1,%xmm2 +___ +######################################################################## +# calculate mask by comparing 0..31 to index and save result to stack +# +$code.=<<___; + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 # compare to 1,0 + .byte 0x67 + movdqa %xmm4,%xmm3 +___ +for($k=0;$k<$STRIDE/16-4;$k+=4) { +$code.=<<___; + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 # compare to 3,2 + movdqa %xmm0,`16*($k+0)+112`(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 # compare to 5,4 + movdqa %xmm1,`16*($k+1)+112`(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 # compare to 7,6 + movdqa %xmm2,`16*($k+2)+112`(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,`16*($k+3)+112`(%r10) + movdqa %xmm4,%xmm3 +___ +} +$code.=<<___; # last iteration can be optimized + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,`16*($k+0)+112`(%r10) + + paddd %xmm2,%xmm3 + .byte 0x67 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,`16*($k+1)+112`(%r10) + + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,`16*($k+2)+112`(%r10) + pand `16*($k+0)-128`($bp),%xmm0 # while it's still in register + + pand `16*($k+1)-128`($bp),%xmm1 + pand `16*($k+2)-128`($bp),%xmm2 + movdqa %xmm3,`16*($k+3)+112`(%r10) + pand `16*($k+3)-128`($bp),%xmm3 por %xmm2,%xmm0 + por %xmm3,%xmm1 +___ +for($k=0;$k<$STRIDE/16-4;$k+=4) { +$code.=<<___; + movdqa `16*($k+0)-128`($bp),%xmm4 + movdqa `16*($k+1)-128`($bp),%xmm5 + movdqa `16*($k+2)-128`($bp),%xmm2 + pand `16*($k+0)+112`(%r10),%xmm4 + movdqa `16*($k+3)-128`($bp),%xmm3 + pand `16*($k+1)+112`(%r10),%xmm5 + por %xmm4,%xmm0 + pand `16*($k+2)+112`(%r10),%xmm2 + por %xmm5,%xmm1 + pand `16*($k+3)+112`(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 +___ +} +$code.=<<___; + por %xmm1,%xmm0 + pshufd \$0x4e,%xmm0,%xmm1 + por %xmm1,%xmm0 lea $STRIDE($bp),$bp - por %xmm3,%xmm0 - movq %xmm0,$m0 # m0=bp[0] mov ($n0),$n0 # pull n0[0] value @@ -159,29 +226,14 @@ xor $i,$i # i=0 xor $j,$j # j=0 - movq `0*$STRIDE/4-96`($bp),%xmm0 - movq `1*$STRIDE/4-96`($bp),%xmm1 - pand %xmm4,%xmm0 - movq `2*$STRIDE/4-96`($bp),%xmm2 - pand %xmm5,%xmm1 - mov $n0,$m1 mulq $m0 # ap[0]*bp[0] mov %rax,$lo0 mov ($np),%rax - movq `3*$STRIDE/4-96`($bp),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 - imulq $lo0,$m1 # "tp[0]"*n0 mov %rdx,$hi0 - por %xmm2,%xmm0 - lea $STRIDE($bp),$bp - por %xmm3,%xmm0 - mulq $m1 # np[0]*m1 add %rax,$lo0 # discarded mov 8($ap),%rax @@ -212,16 +264,14 @@ mulq $m1 # np[j]*m1 cmp $num,$j - jne .L1st - - movq %xmm0,$m0 # bp[1] + jne .L1st # note that upon exit $j==$num, so + # they can be used interchangeably add %rax,$hi1 - mov ($ap),%rax # ap[0] adc \$0,%rdx add $hi0,$hi1 # np[j]*m1+ap[j]*bp[0] adc \$0,%rdx - mov $hi1,-16(%rsp,$j,8) # tp[j-1] + mov $hi1,-16(%rsp,$num,8) # tp[num-1] mov %rdx,$hi1 mov $lo0,$hi0 @@ -235,33 +285,48 @@ jmp .Louter .align 16 .Louter: + lea 24+128(%rsp,$num,8),%rdx # where 256-byte mask is (+size optimization) + and \$-16,%rdx + pxor %xmm4,%xmm4 + pxor %xmm5,%xmm5 +___ +for($k=0;$k<$STRIDE/16;$k+=4) { +$code.=<<___; + movdqa `16*($k+0)-128`($bp),%xmm0 + movdqa `16*($k+1)-128`($bp),%xmm1 + movdqa `16*($k+2)-128`($bp),%xmm2 + movdqa `16*($k+3)-128`($bp),%xmm3 + pand `16*($k+0)-128`(%rdx),%xmm0 + pand `16*($k+1)-128`(%rdx),%xmm1 + por %xmm0,%xmm4 + pand `16*($k+2)-128`(%rdx),%xmm2 + por %xmm1,%xmm5 + pand `16*($k+3)-128`(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 +___ +} +$code.=<<___; + por %xmm5,%xmm4 + pshufd \$0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 + lea $STRIDE($bp),$bp + + mov ($ap),%rax # ap[0] + movq %xmm0,$m0 # m0=bp[i] + xor $j,$j # j=0 mov $n0,$m1 mov (%rsp),$lo0 - movq `0*$STRIDE/4-96`($bp),%xmm0 - movq `1*$STRIDE/4-96`($bp),%xmm1 - pand %xmm4,%xmm0 - movq `2*$STRIDE/4-96`($bp),%xmm2 - pand %xmm5,%xmm1 - mulq $m0 # ap[0]*bp[i] add %rax,$lo0 # ap[0]*bp[i]+tp[0] mov ($np),%rax adc \$0,%rdx - movq `3*$STRIDE/4-96`($bp),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 - imulq $lo0,$m1 # tp[0]*n0 mov %rdx,$hi0 - por %xmm2,%xmm0 - lea $STRIDE($bp),$bp - por %xmm3,%xmm0 - mulq $m1 # np[0]*m1 add %rax,$lo0 # discarded mov 8($ap),%rax @@ -295,17 +360,14 @@ mulq $m1 # np[j]*m1 cmp $num,$j - jne .Linner - - movq %xmm0,$m0 # bp[i+1] - + jne .Linner # note that upon exit $j==$num, so + # they can be used interchangeably add %rax,$hi1 - mov ($ap),%rax # ap[0] adc \$0,%rdx add $lo0,$hi1 # np[j]*m1+ap[j]*bp[i]+tp[j] - mov (%rsp,$j,8),$lo0 + mov (%rsp,$num,8),$lo0 adc \$0,%rdx - mov $hi1,-16(%rsp,$j,8) # tp[j-1] + mov $hi1,-16(%rsp,$num,8) # tp[num-1] mov %rdx,$hi1 xor %rdx,%rdx @@ -352,12 +414,7 @@ mov 8(%rsp,$num,8),%rsi # restore %rsp mov \$1,%rax -___ -$code.=<<___ if ($win64); - movaps -88(%rsi),%xmm6 - movaps -72(%rsi),%xmm7 -___ -$code.=<<___; + mov -48(%rsi),%r15 mov -40(%rsi),%r14 mov -32(%rsi),%r13 @@ -379,8 +436,8 @@ .Lmul4x_enter: ___ $code.=<<___ if ($addx); - and \$0x80100,%r11d - cmp \$0x80100,%r11d + and \$0x80108,%r11d + cmp \$0x80108,%r11d # check for AD*X+BMI2+BMI1 je .Lmulx4x_enter ___ $code.=<<___; @@ -392,45 +449,49 @@ push %r13 push %r14 push %r15 -___ -$code.=<<___ if ($win64); - lea -0x28(%rsp),%rsp - movaps %xmm6,(%rsp) - movaps %xmm7,0x10(%rsp) -___ -$code.=<<___; + .byte 0x67 - mov ${num}d,%r10d - shl \$3,${num}d - shl \$3+2,%r10d # 4*$num + shl \$3,${num}d # convert $num to bytes + lea ($num,$num,2),%r10 # 3*$num in bytes neg $num # -$num ############################################################## - # ensure that stack frame doesn't alias with $aptr+4*$num - # modulo 4096, which covers ret[num], am[num] and n[2*num] - # (see bn_exp.c). this is done to allow memory disambiguation - # logic do its magic. [excessive frame is allocated in order - # to allow bn_from_mont8x to clear it.] + # Ensure that stack frame doesn't alias with $rptr+3*$num + # modulo 4096, which covers ret[num], am[num] and n[num] + # (see bn_exp.c). This is done to allow memory disambiguation + # logic do its magic. [Extra [num] is allocated in order + # to align with bn_power5's frame, which is cleansed after + # completing exponentiation. Extra 256 bytes is for power mask + # calculated from 7th argument, the index.] # - lea -64(%rsp,$num,2),%r11 - sub $ap,%r11 + lea -320(%rsp,$num,2),%r11 + sub $rp,%r11 and \$4095,%r11 cmp %r11,%r10 jb .Lmul4xsp_alt - sub %r11,%rsp # align with $ap - lea -64(%rsp,$num,2),%rsp # alloca(128+num*8) + sub %r11,%rsp # align with $rp + lea -320(%rsp,$num,2),%rsp # alloca(frame+2*num*8+256) jmp .Lmul4xsp_done .align 32 .Lmul4xsp_alt: - lea 4096-64(,$num,2),%r10 - lea -64(%rsp,$num,2),%rsp # alloca(128+num*8) + lea 4096-320(,$num,2),%r10 + lea -320(%rsp,$num,2),%rsp # alloca(frame+2*num*8+256) sub %r10,%r11 mov \$0,%r10 cmovc %r10,%r11 sub %r11,%rsp .Lmul4xsp_done: and \$-64,%rsp + mov %rax,%r11 + sub %rsp,%r11 + and \$-4096,%r11 +.Lmul4x_page_walk: + mov (%rsp,%r11),%r10 + sub \$4096,%r11 + .byte 0x2e # predict non-taken + jnc .Lmul4x_page_walk + neg $num mov %rax,40(%rsp) @@ -440,12 +501,7 @@ mov 40(%rsp),%rsi # restore %rsp mov \$1,%rax -___ -$code.=<<___ if ($win64); - movaps -88(%rsi),%xmm6 - movaps -72(%rsi),%xmm7 -___ -$code.=<<___; + mov -48(%rsi),%r15 mov -40(%rsi),%r14 mov -32(%rsi),%r13 @@ -460,9 +516,10 @@ .type mul4x_internal,\@abi-omnipotent .align 32 mul4x_internal: - shl \$5,$num - mov `($win64?56:8)`(%rax),%r10d # load 7th argument - lea 256(%rdx,$num),%r13 + shl \$5,$num # $num was in bytes + movd `($win64?56:8)`(%rax),%xmm5 # load 7th argument, index + lea .Linc(%rip),%rax + lea 128(%rdx,$num),%r13 # end of powers table (+size optimization) shr \$5,$num # restore $num ___ $bp="%r12"; @@ -470,44 +527,92 @@ $N=$STRIDE/4; # should match cache line size $tp=$i; $code.=<<___; - mov %r10,%r11 - shr \$`log($N/8)/log(2)`,%r10 - and \$`$N/8-1`,%r11 - not %r10 - lea .Lmagic_masks(%rip),%rax - and \$`2**5/($N/8)-1`,%r10 # 5 is "window size" - lea 96(%rdx,%r11,8),$bp # pointer within 1st cache line - movq 0(%rax,%r10,8),%xmm4 # set of masks denoting which - movq 8(%rax,%r10,8),%xmm5 # cache line contains element - add \$7,%r11 - movq 16(%rax,%r10,8),%xmm6 # denoted by 7th argument - movq 24(%rax,%r10,8),%xmm7 - and \$7,%r11 - - movq `0*$STRIDE/4-96`($bp),%xmm0 - lea $STRIDE($bp),$tp # borrow $tp - movq `1*$STRIDE/4-96`($bp),%xmm1 - pand %xmm4,%xmm0 - movq `2*$STRIDE/4-96`($bp),%xmm2 - pand %xmm5,%xmm1 - movq `3*$STRIDE/4-96`($bp),%xmm3 - pand %xmm6,%xmm2 - .byte 0x67 - por %xmm1,%xmm0 - movq `0*$STRIDE/4-96`($tp),%xmm1 - .byte 0x67 - pand %xmm7,%xmm3 - .byte 0x67 - por %xmm2,%xmm0 - movq `1*$STRIDE/4-96`($tp),%xmm2 + movdqa 0(%rax),%xmm0 # 00000001000000010000000000000000 + movdqa 16(%rax),%xmm1 # 00000002000000020000000200000002 + lea 88-112(%rsp,$num),%r10 # place the mask after tp[num+1] (+ICache optimization) + lea 128(%rdx),$bp # size optimization + + pshufd \$0,%xmm5,%xmm5 # broadcast index + movdqa %xmm1,%xmm4 + .byte 0x67,0x67 + movdqa %xmm1,%xmm2 +___ +######################################################################## +# calculate mask by comparing 0..31 to index and save result to stack +# +$code.=<<___; + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 # compare to 1,0 .byte 0x67 - pand %xmm4,%xmm1 + movdqa %xmm4,%xmm3 +___ +for($i=0;$i<$STRIDE/16-4;$i+=4) { +$code.=<<___; + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 # compare to 3,2 + movdqa %xmm0,`16*($i+0)+112`(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 # compare to 5,4 + movdqa %xmm1,`16*($i+1)+112`(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 # compare to 7,6 + movdqa %xmm2,`16*($i+2)+112`(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,`16*($i+3)+112`(%r10) + movdqa %xmm4,%xmm3 +___ +} +$code.=<<___; # last iteration can be optimized + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,`16*($i+0)+112`(%r10) + + paddd %xmm2,%xmm3 .byte 0x67 - por %xmm3,%xmm0 - movq `2*$STRIDE/4-96`($tp),%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,`16*($i+1)+112`(%r10) + + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,`16*($i+2)+112`(%r10) + pand `16*($i+0)-128`($bp),%xmm0 # while it's still in register + pand `16*($i+1)-128`($bp),%xmm1 + pand `16*($i+2)-128`($bp),%xmm2 + movdqa %xmm3,`16*($i+3)+112`(%r10) + pand `16*($i+3)-128`($bp),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 +___ +for($i=0;$i<$STRIDE/16-4;$i+=4) { +$code.=<<___; + movdqa `16*($i+0)-128`($bp),%xmm4 + movdqa `16*($i+1)-128`($bp),%xmm5 + movdqa `16*($i+2)-128`($bp),%xmm2 + pand `16*($i+0)+112`(%r10),%xmm4 + movdqa `16*($i+3)-128`($bp),%xmm3 + pand `16*($i+1)+112`(%r10),%xmm5 + por %xmm4,%xmm0 + pand `16*($i+2)+112`(%r10),%xmm2 + por %xmm5,%xmm1 + pand `16*($i+3)+112`(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 +___ +} +$code.=<<___; + por %xmm1,%xmm0 + pshufd \$0x4e,%xmm0,%xmm1 + por %xmm1,%xmm0 + lea $STRIDE($bp),$bp movq %xmm0,$m0 # m0=bp[0] - movq `3*$STRIDE/4-96`($tp),%xmm0 + mov %r13,16+8(%rsp) # save end of b[num] mov $rp, 56+8(%rsp) # save $rp @@ -521,26 +626,10 @@ mov %rax,$A[0] mov ($np),%rax - pand %xmm5,%xmm2 - pand %xmm6,%xmm3 - por %xmm2,%xmm1 - imulq $A[0],$m1 # "tp[0]"*n0 - ############################################################## - # $tp is chosen so that writing to top-most element of the - # vector occurs just "above" references to powers table, - # "above" modulo cache-line size, which effectively precludes - # possibility of memory disambiguation logic failure when - # accessing the table. - # - lea 64+8(%rsp,%r11,8),$tp + lea 64+8(%rsp),$tp mov %rdx,$A[1] - pand %xmm7,%xmm0 - por %xmm3,%xmm1 - lea 2*$STRIDE($bp),$bp - por %xmm1,%xmm0 - mulq $m1 # np[0]*m1 add %rax,$A[0] # discarded mov 8($ap,$num),%rax @@ -549,7 +638,7 @@ mulq $m0 add %rax,$A[1] - mov 16*1($np),%rax # interleaved with 0, therefore 16*n + mov 8*1($np),%rax adc \$0,%rdx mov %rdx,$A[0] @@ -559,7 +648,7 @@ adc \$0,%rdx add $A[1],$N[1] lea 4*8($num),$j # j=4 - lea 16*4($np),$np + lea 8*4($np),$np adc \$0,%rdx mov $N[1],($tp) mov %rdx,$N[0] @@ -569,7 +658,7 @@ .L1st4x: mulq $m0 # ap[j]*bp[0] add %rax,$A[0] - mov -16*2($np),%rax + mov -8*2($np),%rax lea 32($tp),$tp adc \$0,%rdx mov %rdx,$A[1] @@ -585,7 +674,7 @@ mulq $m0 # ap[j]*bp[0] add %rax,$A[1] - mov -16*1($np),%rax + mov -8*1($np),%rax adc \$0,%rdx mov %rdx,$A[0] @@ -600,7 +689,7 @@ mulq $m0 # ap[j]*bp[0] add %rax,$A[0] - mov 16*0($np),%rax + mov 8*0($np),%rax adc \$0,%rdx mov %rdx,$A[1] @@ -615,7 +704,7 @@ mulq $m0 # ap[j]*bp[0] add %rax,$A[1] - mov 16*1($np),%rax + mov 8*1($np),%rax adc \$0,%rdx mov %rdx,$A[0] @@ -624,7 +713,7 @@ mov 16($ap,$j),%rax adc \$0,%rdx add $A[1],$N[1] # np[j]*m1+ap[j]*bp[0] - lea 16*4($np),$np + lea 8*4($np),$np adc \$0,%rdx mov $N[1],($tp) # tp[j-1] mov %rdx,$N[0] @@ -634,7 +723,7 @@ mulq $m0 # ap[j]*bp[0] add %rax,$A[0] - mov -16*2($np),%rax + mov -8*2($np),%rax lea 32($tp),$tp adc \$0,%rdx mov %rdx,$A[1] @@ -650,7 +739,7 @@ mulq $m0 # ap[j]*bp[0] add %rax,$A[1] - mov -16*1($np),%rax + mov -8*1($np),%rax adc \$0,%rdx mov %rdx,$A[0] @@ -663,8 +752,7 @@ mov $N[1],-16($tp) # tp[j-1] mov %rdx,$N[0] - movq %xmm0,$m0 # bp[1] - lea ($np,$num,2),$np # rewind $np + lea ($np,$num),$np # rewind $np xor $N[1],$N[1] add $A[0],$N[0] @@ -675,6 +763,33 @@ .align 32 .Louter4x: + lea 16+128($tp),%rdx # where 256-byte mask is (+size optimization) + pxor %xmm4,%xmm4 + pxor %xmm5,%xmm5 +___ +for($i=0;$i<$STRIDE/16;$i+=4) { +$code.=<<___; + movdqa `16*($i+0)-128`($bp),%xmm0 + movdqa `16*($i+1)-128`($bp),%xmm1 + movdqa `16*($i+2)-128`($bp),%xmm2 + movdqa `16*($i+3)-128`($bp),%xmm3 + pand `16*($i+0)-128`(%rdx),%xmm0 + pand `16*($i+1)-128`(%rdx),%xmm1 + por %xmm0,%xmm4 + pand `16*($i+2)-128`(%rdx),%xmm2 + por %xmm1,%xmm5 + pand `16*($i+3)-128`(%rdx),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 +___ +} +$code.=<<___; + por %xmm5,%xmm4 + pshufd \$0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 + lea $STRIDE($bp),$bp + movq %xmm0,$m0 # m0=bp[i] + mov ($tp,$num),$A[0] mov $n0,$m1 mulq $m0 # ap[0]*bp[i] @@ -682,25 +797,11 @@ mov ($np),%rax adc \$0,%rdx - movq `0*$STRIDE/4-96`($bp),%xmm0 - movq `1*$STRIDE/4-96`($bp),%xmm1 - pand %xmm4,%xmm0 - movq `2*$STRIDE/4-96`($bp),%xmm2 - pand %xmm5,%xmm1 - movq `3*$STRIDE/4-96`($bp),%xmm3 - imulq $A[0],$m1 # tp[0]*n0 - .byte 0x67 mov %rdx,$A[1] mov $N[1],($tp) # store upmost overflow bit - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 - por %xmm2,%xmm0 lea ($tp,$num),$tp # rewind $tp - lea $STRIDE($bp),$bp - por %xmm3,%xmm0 mulq $m1 # np[0]*m1 add %rax,$A[0] # "$N[0]", discarded @@ -710,7 +811,7 @@ mulq $m0 # ap[j]*bp[i] add %rax,$A[1] - mov 16*1($np),%rax # interleaved with 0, therefore 16*n + mov 8*1($np),%rax adc \$0,%rdx add 8($tp),$A[1] # +tp[1] adc \$0,%rdx @@ -722,7 +823,7 @@ adc \$0,%rdx add $A[1],$N[1] # np[j]*m1+ap[j]*bp[i]+tp[j] lea 4*8($num),$j # j=4 - lea 16*4($np),$np + lea 8*4($np),$np adc \$0,%rdx mov %rdx,$N[0] jmp .Linner4x @@ -731,7 +832,7 @@ .Linner4x: mulq $m0 # ap[j]*bp[i] add %rax,$A[0] - mov -16*2($np),%rax + mov -8*2($np),%rax adc \$0,%rdx add 16($tp),$A[0] # ap[j]*bp[i]+tp[j] lea 32($tp),$tp @@ -749,7 +850,7 @@ mulq $m0 # ap[j]*bp[i] add %rax,$A[1] - mov -16*1($np),%rax + mov -8*1($np),%rax adc \$0,%rdx add -8($tp),$A[1] adc \$0,%rdx @@ -766,7 +867,7 @@ mulq $m0 # ap[j]*bp[i] add %rax,$A[0] - mov 16*0($np),%rax + mov 8*0($np),%rax adc \$0,%rdx add ($tp),$A[0] # ap[j]*bp[i]+tp[j] adc \$0,%rdx @@ -783,7 +884,7 @@ mulq $m0 # ap[j]*bp[i] add %rax,$A[1] - mov 16*1($np),%rax + mov 8*1($np),%rax adc \$0,%rdx add 8($tp),$A[1] adc \$0,%rdx @@ -794,7 +895,7 @@ mov 16($ap,$j),%rax adc \$0,%rdx add $A[1],$N[1] - lea 16*4($np),$np + lea 8*4($np),$np adc \$0,%rdx mov $N[0],-8($tp) # tp[j-1] mov %rdx,$N[0] @@ -804,7 +905,7 @@ mulq $m0 # ap[j]*bp[i] add %rax,$A[0] - mov -16*2($np),%rax + mov -8*2($np),%rax adc \$0,%rdx add 16($tp),$A[0] # ap[j]*bp[i]+tp[j] lea 32($tp),$tp @@ -823,7 +924,7 @@ mulq $m0 # ap[j]*bp[i] add %rax,$A[1] mov $m1,%rax - mov -16*1($np),$m1 + mov -8*1($np),$m1 adc \$0,%rdx add -8($tp),$A[1] adc \$0,%rdx @@ -838,9 +939,8 @@ mov $N[0],-24($tp) # tp[j-1] mov %rdx,$N[0] - movq %xmm0,$m0 # bp[i+1] mov $N[1],-16($tp) # tp[j-1] - lea ($np,$num,2),$np # rewind $np + lea ($np,$num),$np # rewind $np xor $N[1],$N[1] add $A[0],$N[0] @@ -854,16 +954,23 @@ ___ if (1) { $code.=<<___; + xor %rax,%rax sub $N[0],$m1 # compare top-most words adc $j,$j # $j is zero or $j,$N[1] - xor \$1,$N[1] + sub $N[1],%rax # %rax=-$N[1] lea ($tp,$num),%rbx # tptr in .sqr4x_sub - lea ($np,$N[1],8),%rbp # nptr in .sqr4x_sub + mov ($np),%r12 + lea ($np),%rbp # nptr in .sqr4x_sub mov %r9,%rcx - sar \$3+2,%rcx # cf=0 + sar \$3+2,%rcx mov 56+8(%rsp),%rdi # rptr in .sqr4x_sub - jmp .Lsqr4x_sub + dec %r12 # so that after 'not' we get -n[0] + xor %r10,%r10 + mov 8*1(%rbp),%r13 + mov 8*2(%rbp),%r14 + mov 8*3(%rbp),%r15 + jmp .Lsqr4x_sub_entry ___ } else { my @ri=("%rax",$bp,$m0,$m1); @@ -930,8 +1037,8 @@ ___ $code.=<<___ if ($addx); mov OPENSSL_ia32cap_P+8(%rip),%r11d - and \$0x80100,%r11d - cmp \$0x80100,%r11d + and \$0x80108,%r11d + cmp \$0x80108,%r11d # check for AD*X+BMI2+BMI1 je .Lpowerx5_enter ___ $code.=<<___; @@ -942,44 +1049,47 @@ push %r13 push %r14 push %r15 -___ -$code.=<<___ if ($win64); - lea -0x28(%rsp),%rsp - movaps %xmm6,(%rsp) - movaps %xmm7,0x10(%rsp) -___ -$code.=<<___; - mov ${num}d,%r10d + shl \$3,${num}d # convert $num to bytes - shl \$3+2,%r10d # 4*$num + lea ($num,$num,2),%r10d # 3*$num neg $num mov ($n0),$n0 # *n0 ############################################################## - # ensure that stack frame doesn't alias with $aptr+4*$num - # modulo 4096, which covers ret[num], am[num] and n[2*num] - # (see bn_exp.c). this is done to allow memory disambiguation - # logic do its magic. + # Ensure that stack frame doesn't alias with $rptr+3*$num + # modulo 4096, which covers ret[num], am[num] and n[num] + # (see bn_exp.c). This is done to allow memory disambiguation + # logic do its magic. [Extra 256 bytes is for power mask + # calculated from 7th argument, the index.] # - lea -64(%rsp,$num,2),%r11 - sub $aptr,%r11 + lea -320(%rsp,$num,2),%r11 + sub $rptr,%r11 and \$4095,%r11 cmp %r11,%r10 jb .Lpwr_sp_alt sub %r11,%rsp # align with $aptr - lea -64(%rsp,$num,2),%rsp # alloca(frame+2*$num) + lea -320(%rsp,$num,2),%rsp # alloca(frame+2*num*8+256) jmp .Lpwr_sp_done .align 32 .Lpwr_sp_alt: - lea 4096-64(,$num,2),%r10 # 4096-frame-2*$num - lea -64(%rsp,$num,2),%rsp # alloca(frame+2*$num) + lea 4096-320(,$num,2),%r10 + lea -320(%rsp,$num,2),%rsp # alloca(frame+2*num*8+256) sub %r10,%r11 mov \$0,%r10 cmovc %r10,%r11 sub %r11,%rsp .Lpwr_sp_done: and \$-64,%rsp + mov %rax,%r11 + sub %rsp,%r11 + and \$-4096,%r11 +.Lpwr_page_walk: + mov (%rsp,%r11),%r10 + sub \$4096,%r11 + .byte 0x2e # predict non-taken + jnc .Lpwr_page_walk + mov $num,%r10 neg $num @@ -995,16 +1105,21 @@ mov $n0, 32(%rsp) mov %rax, 40(%rsp) # save original %rsp .Lpower5_body: - movq $rptr,%xmm1 # save $rptr + movq $rptr,%xmm1 # save $rptr, used in sqr8x movq $nptr,%xmm2 # save $nptr - movq %r10, %xmm3 # -$num + movq %r10, %xmm3 # -$num, used in sqr8x movq $bptr,%xmm4 call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal call __bn_sqr8x_internal + call __bn_post4x_internal movq %xmm2,$nptr movq %xmm4,$bptr @@ -1565,9 +1680,9 @@ $code.=<<___; movq %xmm2,$nptr -sqr8x_reduction: +__bn_sqr8x_reduction: xor %rax,%rax - lea ($nptr,$num,2),%rcx # end of n[] + lea ($nptr,$num),%rcx # end of n[] lea 48+8(%rsp,$num,2),%rdx # end of t[] buffer mov %rcx,0+8(%rsp) lea 48+8(%rsp,$num),$tptr # end of initial t[] window @@ -1593,21 +1708,21 @@ .byte 0x67 mov $m0,%r8 imulq 32+8(%rsp),$m0 # n0*a[0] - mov 16*0($nptr),%rax # n[0] + mov 8*0($nptr),%rax # n[0] mov \$8,%ecx jmp .L8x_reduce .align 32 .L8x_reduce: mulq $m0 - mov 16*1($nptr),%rax # n[1] + mov 8*1($nptr),%rax # n[1] neg %r8 mov %rdx,%r8 adc \$0,%r8 mulq $m0 add %rax,%r9 - mov 16*2($nptr),%rax + mov 8*2($nptr),%rax adc \$0,%rdx add %r9,%r8 mov $m0,48-8+8(%rsp,%rcx,8) # put aside n0*a[i] @@ -1616,7 +1731,7 @@ mulq $m0 add %rax,%r10 - mov 16*3($nptr),%rax + mov 8*3($nptr),%rax adc \$0,%rdx add %r10,%r9 mov 32+8(%rsp),$carry # pull n0, borrow $carry @@ -1625,7 +1740,7 @@ mulq $m0 add %rax,%r11 - mov 16*4($nptr),%rax + mov 8*4($nptr),%rax adc \$0,%rdx imulq %r8,$carry # modulo-scheduled add %r11,%r10 @@ -1634,7 +1749,7 @@ mulq $m0 add %rax,%r12 - mov 16*5($nptr),%rax + mov 8*5($nptr),%rax adc \$0,%rdx add %r12,%r11 mov %rdx,%r12 @@ -1642,7 +1757,7 @@ mulq $m0 add %rax,%r13 - mov 16*6($nptr),%rax + mov 8*6($nptr),%rax adc \$0,%rdx add %r13,%r12 mov %rdx,%r13 @@ -1650,7 +1765,7 @@ mulq $m0 add %rax,%r14 - mov 16*7($nptr),%rax + mov 8*7($nptr),%rax adc \$0,%rdx add %r14,%r13 mov %rdx,%r14 @@ -1659,7 +1774,7 @@ mulq $m0 mov $carry,$m0 # n0*a[i] add %rax,%r15 - mov 16*0($nptr),%rax # n[0] + mov 8*0($nptr),%rax # n[0] adc \$0,%rdx add %r15,%r14 mov %rdx,%r15 @@ -1668,7 +1783,7 @@ dec %ecx jnz .L8x_reduce - lea 16*8($nptr),$nptr + lea 8*8($nptr),$nptr xor %rax,%rax mov 8+8(%rsp),%rdx # pull end of t[] cmp 0+8(%rsp),$nptr # end of n[]? @@ -1687,21 +1802,21 @@ mov 48+56+8(%rsp),$m0 # pull n0*a[0] mov \$8,%ecx - mov 16*0($nptr),%rax + mov 8*0($nptr),%rax jmp .L8x_tail .align 32 .L8x_tail: mulq $m0 add %rax,%r8 - mov 16*1($nptr),%rax + mov 8*1($nptr),%rax mov %r8,($tptr) # save result mov %rdx,%r8 adc \$0,%r8 mulq $m0 add %rax,%r9 - mov 16*2($nptr),%rax + mov 8*2($nptr),%rax adc \$0,%rdx add %r9,%r8 lea 8($tptr),$tptr # $tptr++ @@ -1710,7 +1825,7 @@ mulq $m0 add %rax,%r10 - mov 16*3($nptr),%rax + mov 8*3($nptr),%rax adc \$0,%rdx add %r10,%r9 mov %rdx,%r10 @@ -1718,7 +1833,7 @@ mulq $m0 add %rax,%r11 - mov 16*4($nptr),%rax + mov 8*4($nptr),%rax adc \$0,%rdx add %r11,%r10 mov %rdx,%r11 @@ -1726,7 +1841,7 @@ mulq $m0 add %rax,%r12 - mov 16*5($nptr),%rax + mov 8*5($nptr),%rax adc \$0,%rdx add %r12,%r11 mov %rdx,%r12 @@ -1734,7 +1849,7 @@ mulq $m0 add %rax,%r13 - mov 16*6($nptr),%rax + mov 8*6($nptr),%rax adc \$0,%rdx add %r13,%r12 mov %rdx,%r13 @@ -1742,7 +1857,7 @@ mulq $m0 add %rax,%r14 - mov 16*7($nptr),%rax + mov 8*7($nptr),%rax adc \$0,%rdx add %r14,%r13 mov %rdx,%r14 @@ -1753,14 +1868,14 @@ add %rax,%r15 adc \$0,%rdx add %r15,%r14 - mov 16*0($nptr),%rax # pull n[0] + mov 8*0($nptr),%rax # pull n[0] mov %rdx,%r15 adc \$0,%r15 dec %ecx jnz .L8x_tail - lea 16*8($nptr),$nptr + lea 8*8($nptr),$nptr mov 8+8(%rsp),%rdx # pull end of t[] cmp 0+8(%rsp),$nptr # end of n[]? jae .L8x_tail_done # break out of loop @@ -1806,7 +1921,7 @@ adc 8*6($tptr),%r14 adc 8*7($tptr),%r15 adc \$0,%rax # top-most carry - mov -16($nptr),%rcx # np[num-1] + mov -8($nptr),%rcx # np[num-1] xor $carry,$carry movq %xmm2,$nptr # restore $nptr @@ -1824,6 +1939,8 @@ cmp %rdx,$tptr # end of t[]? jb .L8x_reduction_loop + ret +.size bn_sqr8x_internal,.-bn_sqr8x_internal ___ } ############################################################## @@ -1832,48 +1949,62 @@ { my ($tptr,$nptr)=("%rbx","%rbp"); $code.=<<___; - #xor %rsi,%rsi # %rsi was $carry above - sub %r15,%rcx # compare top-most words +.type __bn_post4x_internal,\@abi-omnipotent +.align 32 +__bn_post4x_internal: + mov 8*0($nptr),%r12 lea (%rdi,$num),$tptr # %rdi was $tptr above - adc %rsi,%rsi mov $num,%rcx - or %rsi,%rax movq %xmm1,$rptr # restore $rptr - xor \$1,%rax + neg %rax movq %xmm1,$aptr # prepare for back-to-back call - lea ($nptr,%rax,8),$nptr - sar \$3+2,%rcx # cf=0 - jmp .Lsqr4x_sub + sar \$3+2,%rcx + dec %r12 # so that after 'not' we get -n[0] + xor %r10,%r10 + mov 8*1($nptr),%r13 + mov 8*2($nptr),%r14 + mov 8*3($nptr),%r15 + jmp .Lsqr4x_sub_entry -.align 32 +.align 16 .Lsqr4x_sub: - .byte 0x66 - mov 8*0($tptr),%r12 - mov 8*1($tptr),%r13 - sbb 16*0($nptr),%r12 - mov 8*2($tptr),%r14 - sbb 16*1($nptr),%r13 - mov 8*3($tptr),%r15 - lea 8*4($tptr),$tptr - sbb 16*2($nptr),%r14 + mov 8*0($nptr),%r12 + mov 8*1($nptr),%r13 + mov 8*2($nptr),%r14 + mov 8*3($nptr),%r15 +.Lsqr4x_sub_entry: + lea 8*4($nptr),$nptr + not %r12 + not %r13 + not %r14 + not %r15 + and %rax,%r12 + and %rax,%r13 + and %rax,%r14 + and %rax,%r15 + + neg %r10 # mov %r10,%cf + adc 8*0($tptr),%r12 + adc 8*1($tptr),%r13 + adc 8*2($tptr),%r14 + adc 8*3($tptr),%r15 mov %r12,8*0($rptr) - sbb 16*3($nptr),%r15 - lea 16*4($nptr),$nptr + lea 8*4($tptr),$tptr mov %r13,8*1($rptr) + sbb %r10,%r10 # mov %cf,%r10 mov %r14,8*2($rptr) mov %r15,8*3($rptr) lea 8*4($rptr),$rptr inc %rcx # pass %cf jnz .Lsqr4x_sub -___ -} -$code.=<<___; + mov $num,%r10 # prepare for back-to-back call neg $num # restore $num ret -.size bn_sqr8x_internal,.-bn_sqr8x_internal +.size __bn_post4x_internal,.-__bn_post4x_internal ___ +} { $code.=<<___; .globl bn_from_montgomery @@ -1897,46 +2028,48 @@ push %r13 push %r14 push %r15 -___ -$code.=<<___ if ($win64); - lea -0x28(%rsp),%rsp - movaps %xmm6,(%rsp) - movaps %xmm7,0x10(%rsp) -___ -$code.=<<___; - .byte 0x67 - mov ${num}d,%r10d + shl \$3,${num}d # convert $num to bytes - shl \$3+2,%r10d # 4*$num + lea ($num,$num,2),%r10 # 3*$num in bytes neg $num mov ($n0),$n0 # *n0 ############################################################## - # ensure that stack frame doesn't alias with $aptr+4*$num - # modulo 4096, which covers ret[num], am[num] and n[2*num] - # (see bn_exp.c). this is done to allow memory disambiguation - # logic do its magic. + # Ensure that stack frame doesn't alias with $rptr+3*$num + # modulo 4096, which covers ret[num], am[num] and n[num] + # (see bn_exp.c). The stack is allocated to aligned with + # bn_power5's frame, and as bn_from_montgomery happens to be + # last operation, we use the opportunity to cleanse it. # - lea -64(%rsp,$num,2),%r11 - sub $aptr,%r11 + lea -320(%rsp,$num,2),%r11 + sub $rptr,%r11 and \$4095,%r11 cmp %r11,%r10 jb .Lfrom_sp_alt sub %r11,%rsp # align with $aptr - lea -64(%rsp,$num,2),%rsp # alloca(frame+2*$num) + lea -320(%rsp,$num,2),%rsp # alloca(frame+2*$num*8+256) jmp .Lfrom_sp_done .align 32 .Lfrom_sp_alt: - lea 4096-64(,$num,2),%r10 # 4096-frame-2*$num - lea -64(%rsp,$num,2),%rsp # alloca(frame+2*$num) + lea 4096-320(,$num,2),%r10 + lea -320(%rsp,$num,2),%rsp # alloca(frame+2*$num*8+256) sub %r10,%r11 mov \$0,%r10 cmovc %r10,%r11 sub %r11,%rsp .Lfrom_sp_done: and \$-64,%rsp - mov $num,%r10 + mov %rax,%r11 + sub %rsp,%r11 + and \$-4096,%r11 +.Lfrom_page_walk: + mov (%rsp,%r11),%r10 + sub \$4096,%r11 + .byte 0x2e # predict non-taken + jnc .Lfrom_page_walk + + mov $num,%r10 neg $num ############################################################## @@ -1983,12 +2116,13 @@ ___ $code.=<<___ if ($addx); mov OPENSSL_ia32cap_P+8(%rip),%r11d - and \$0x80100,%r11d - cmp \$0x80100,%r11d + and \$0x80108,%r11d + cmp \$0x80108,%r11d # check for AD*X+BMI2+BMI1 jne .Lfrom_mont_nox lea (%rax,$num),$rptr - call sqrx8x_reduction + call __bn_sqrx8x_reduction + call __bn_postx4x_internal pxor %xmm0,%xmm0 lea 48(%rsp),%rax @@ -1999,7 +2133,8 @@ .Lfrom_mont_nox: ___ $code.=<<___; - call sqr8x_reduction + call __bn_sqr8x_reduction + call __bn_post4x_internal pxor %xmm0,%xmm0 lea 48(%rsp),%rax @@ -2039,7 +2174,6 @@ .align 32 bn_mulx4x_mont_gather5: .Lmulx4x_enter: - .byte 0x67 mov %rsp,%rax push %rbx push %rbp @@ -2047,46 +2181,48 @@ push %r13 push %r14 push %r15 -___ -$code.=<<___ if ($win64); - lea -0x28(%rsp),%rsp - movaps %xmm6,(%rsp) - movaps %xmm7,0x10(%rsp) -___ -$code.=<<___; - .byte 0x67 - mov ${num}d,%r10d + shl \$3,${num}d # convert $num to bytes - shl \$3+2,%r10d # 4*$num + lea ($num,$num,2),%r10 # 3*$num in bytes neg $num # -$num mov ($n0),$n0 # *n0 ############################################################## - # ensure that stack frame doesn't alias with $aptr+4*$num - # modulo 4096, which covers a[num], ret[num] and n[2*num] - # (see bn_exp.c). this is done to allow memory disambiguation - # logic do its magic. [excessive frame is allocated in order - # to allow bn_from_mont8x to clear it.] + # Ensure that stack frame doesn't alias with $rptr+3*$num + # modulo 4096, which covers ret[num], am[num] and n[num] + # (see bn_exp.c). This is done to allow memory disambiguation + # logic do its magic. [Extra [num] is allocated in order + # to align with bn_power5's frame, which is cleansed after + # completing exponentiation. Extra 256 bytes is for power mask + # calculated from 7th argument, the index.] # - lea -64(%rsp,$num,2),%r11 - sub $ap,%r11 + lea -320(%rsp,$num,2),%r11 + sub $rp,%r11 and \$4095,%r11 cmp %r11,%r10 jb .Lmulx4xsp_alt sub %r11,%rsp # align with $aptr - lea -64(%rsp,$num,2),%rsp # alloca(frame+$num) + lea -320(%rsp,$num,2),%rsp # alloca(frame+2*$num*8+256) jmp .Lmulx4xsp_done -.align 32 .Lmulx4xsp_alt: - lea 4096-64(,$num,2),%r10 # 4096-frame-$num - lea -64(%rsp,$num,2),%rsp # alloca(frame+$num) + lea 4096-320(,$num,2),%r10 + lea -320(%rsp,$num,2),%rsp # alloca(frame+2*$num*8+256) sub %r10,%r11 mov \$0,%r10 cmovc %r10,%r11 sub %r11,%rsp .Lmulx4xsp_done: and \$-64,%rsp # ensure alignment + mov %rax,%r11 + sub %rsp,%r11 + and \$-4096,%r11 +.Lmulx4x_page_walk: + mov (%rsp,%r11),%r10 + sub \$4096,%r11 + .byte 0x2e # predict non-taken + jnc .Lmulx4x_page_walk + ############################################################## # Stack layout # +0 -num @@ -2106,12 +2242,7 @@ mov 40(%rsp),%rsi # restore %rsp mov \$1,%rax -___ -$code.=<<___ if ($win64); - movaps -88(%rsi),%xmm6 - movaps -72(%rsi),%xmm7 -___ -$code.=<<___; + mov -48(%rsi),%r15 mov -40(%rsi),%r14 mov -32(%rsi),%r13 @@ -2126,14 +2257,16 @@ .type mulx4x_internal,\@abi-omnipotent .align 32 mulx4x_internal: - .byte 0x4c,0x89,0x8c,0x24,0x08,0x00,0x00,0x00 # mov $num,8(%rsp) # save -$num - .byte 0x67 + mov $num,8(%rsp) # save -$num (it was in bytes) + mov $num,%r10 neg $num # restore $num shl \$5,$num - lea 256($bp,$num),%r13 + neg %r10 # restore $num + lea 128($bp,$num),%r13 # end of powers table (+size optimization) shr \$5+5,$num - mov `($win64?56:8)`(%rax),%r10d # load 7th argument + movd `($win64?56:8)`(%rax),%xmm5 # load 7th argument sub \$1,$num + lea .Linc(%rip),%rax mov %r13,16+8(%rsp) # end of b[num] mov $num,24+8(%rsp) # inner counter mov $rp, 56+8(%rsp) # save $rp @@ -2144,52 +2277,92 @@ my $STRIDE=2**5*8; # 5 is "window size" my $N=$STRIDE/4; # should match cache line size $code.=<<___; - mov %r10,%r11 - shr \$`log($N/8)/log(2)`,%r10 - and \$`$N/8-1`,%r11 - not %r10 - lea .Lmagic_masks(%rip),%rax - and \$`2**5/($N/8)-1`,%r10 # 5 is "window size" - lea 96($bp,%r11,8),$bptr # pointer within 1st cache line - movq 0(%rax,%r10,8),%xmm4 # set of masks denoting which - movq 8(%rax,%r10,8),%xmm5 # cache line contains element - add \$7,%r11 - movq 16(%rax,%r10,8),%xmm6 # denoted by 7th argument - movq 24(%rax,%r10,8),%xmm7 - and \$7,%r11 - - movq `0*$STRIDE/4-96`($bptr),%xmm0 - lea $STRIDE($bptr),$tptr # borrow $tptr - movq `1*$STRIDE/4-96`($bptr),%xmm1 - pand %xmm4,%xmm0 - movq `2*$STRIDE/4-96`($bptr),%xmm2 - pand %xmm5,%xmm1 - movq `3*$STRIDE/4-96`($bptr),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - movq `0*$STRIDE/4-96`($tptr),%xmm1 - pand %xmm7,%xmm3 - por %xmm2,%xmm0 - movq `1*$STRIDE/4-96`($tptr),%xmm2 - por %xmm3,%xmm0 - .byte 0x67,0x67 - pand %xmm4,%xmm1 - movq `2*$STRIDE/4-96`($tptr),%xmm3 + movdqa 0(%rax),%xmm0 # 00000001000000010000000000000000 + movdqa 16(%rax),%xmm1 # 00000002000000020000000200000002 + lea 88-112(%rsp,%r10),%r10 # place the mask after tp[num+1] (+ICache optimizaton) + lea 128($bp),$bptr # size optimization + pshufd \$0,%xmm5,%xmm5 # broadcast index + movdqa %xmm1,%xmm4 + .byte 0x67 + movdqa %xmm1,%xmm2 +___ +######################################################################## +# calculate mask by comparing 0..31 to index and save result to stack +# +$code.=<<___; + .byte 0x67 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 # compare to 1,0 + movdqa %xmm4,%xmm3 +___ +for($i=0;$i<$STRIDE/16-4;$i+=4) { +$code.=<<___; + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 # compare to 3,2 + movdqa %xmm0,`16*($i+0)+112`(%r10) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 # compare to 5,4 + movdqa %xmm1,`16*($i+1)+112`(%r10) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 # compare to 7,6 + movdqa %xmm2,`16*($i+2)+112`(%r10) + movdqa %xmm4,%xmm2 + + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 + movdqa %xmm3,`16*($i+3)+112`(%r10) + movdqa %xmm4,%xmm3 +___ +} +$code.=<<___; # last iteration can be optimized + .byte 0x67 + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 + movdqa %xmm0,`16*($i+0)+112`(%r10) + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 + movdqa %xmm1,`16*($i+1)+112`(%r10) + + pcmpeqd %xmm5,%xmm3 + movdqa %xmm2,`16*($i+2)+112`(%r10) + + pand `16*($i+0)-128`($bptr),%xmm0 # while it's still in register + pand `16*($i+1)-128`($bptr),%xmm1 + pand `16*($i+2)-128`($bptr),%xmm2 + movdqa %xmm3,`16*($i+3)+112`(%r10) + pand `16*($i+3)-128`($bptr),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 +___ +for($i=0;$i<$STRIDE/16-4;$i+=4) { +$code.=<<___; + movdqa `16*($i+0)-128`($bptr),%xmm4 + movdqa `16*($i+1)-128`($bptr),%xmm5 + movdqa `16*($i+2)-128`($bptr),%xmm2 + pand `16*($i+0)+112`(%r10),%xmm4 + movdqa `16*($i+3)-128`($bptr),%xmm3 + pand `16*($i+1)+112`(%r10),%xmm5 + por %xmm4,%xmm0 + pand `16*($i+2)+112`(%r10),%xmm2 + por %xmm5,%xmm1 + pand `16*($i+3)+112`(%r10),%xmm3 + por %xmm2,%xmm0 + por %xmm3,%xmm1 +___ +} +$code.=<<___; + pxor %xmm1,%xmm0 + pshufd \$0x4e,%xmm0,%xmm1 + por %xmm1,%xmm0 + lea $STRIDE($bptr),$bptr movq %xmm0,%rdx # bp[0] - movq `3*$STRIDE/4-96`($tptr),%xmm0 - lea 2*$STRIDE($bptr),$bptr # next &b[i] - pand %xmm5,%xmm2 - .byte 0x67,0x67 - pand %xmm6,%xmm3 - ############################################################## - # $tptr is chosen so that writing to top-most element of the - # vector occurs just "above" references to powers table, - # "above" modulo cache-line size, which effectively precludes - # possibility of memory disambiguation logic failure when - # accessing the table. - # - lea 64+8*4+8(%rsp,%r11,8),$tptr + lea 64+8*4+8(%rsp),$tptr mov %rdx,$bi mulx 0*8($aptr),$mi,%rax # a[0]*b[0] @@ -2205,37 +2378,31 @@ xor $zero,$zero # cf=0, of=0 mov $mi,%rdx - por %xmm2,%xmm1 - pand %xmm7,%xmm0 - por %xmm3,%xmm1 mov $bptr,8+8(%rsp) # off-load &b[i] - por %xmm1,%xmm0 - .byte 0x48,0x8d,0xb6,0x20,0x00,0x00,0x00 # lea 4*8($aptr),$aptr + lea 4*8($aptr),$aptr adcx %rax,%r13 adcx $zero,%r14 # cf=0 - mulx 0*16($nptr),%rax,%r10 + mulx 0*8($nptr),%rax,%r10 adcx %rax,%r15 # discarded adox %r11,%r10 - mulx 1*16($nptr),%rax,%r11 + mulx 1*8($nptr),%rax,%r11 adcx %rax,%r10 adox %r12,%r11 - mulx 2*16($nptr),%rax,%r12 + mulx 2*8($nptr),%rax,%r12 mov 24+8(%rsp),$bptr # counter value - .byte 0x66 mov %r10,-8*4($tptr) adcx %rax,%r11 adox %r13,%r12 - mulx 3*16($nptr),%rax,%r15 - .byte 0x67,0x67 + mulx 3*8($nptr),%rax,%r15 mov $bi,%rdx mov %r11,-8*3($tptr) adcx %rax,%r12 adox $zero,%r15 # of=0 - .byte 0x48,0x8d,0x89,0x40,0x00,0x00,0x00 # lea 4*16($nptr),$nptr + lea 4*8($nptr),$nptr mov %r12,-8*2($tptr) - #jmp .Lmulx4x_1st + jmp .Lmulx4x_1st .align 32 .Lmulx4x_1st: @@ -2255,30 +2422,29 @@ lea 4*8($tptr),$tptr adox %r15,%r10 - mulx 0*16($nptr),%rax,%r15 + mulx 0*8($nptr),%rax,%r15 adcx %rax,%r10 adox %r15,%r11 - mulx 1*16($nptr),%rax,%r15 + mulx 1*8($nptr),%rax,%r15 adcx %rax,%r11 adox %r15,%r12 - mulx 2*16($nptr),%rax,%r15 + mulx 2*8($nptr),%rax,%r15 mov %r10,-5*8($tptr) adcx %rax,%r12 mov %r11,-4*8($tptr) adox %r15,%r13 - mulx 3*16($nptr),%rax,%r15 + mulx 3*8($nptr),%rax,%r15 mov $bi,%rdx mov %r12,-3*8($tptr) adcx %rax,%r13 adox $zero,%r15 - lea 4*16($nptr),$nptr + lea 4*8($nptr),$nptr mov %r13,-2*8($tptr) dec $bptr # of=0, pass cf jnz .Lmulx4x_1st mov 8(%rsp),$num # load -num - movq %xmm0,%rdx # bp[1] adc $zero,%r15 # modulo-scheduled lea ($aptr,$num),$aptr # rewind $aptr add %r15,%r14 @@ -2289,6 +2455,34 @@ .align 32 .Lmulx4x_outer: + lea 16-256($tptr),%r10 # where 256-byte mask is (+density control) + pxor %xmm4,%xmm4 + .byte 0x67,0x67 + pxor %xmm5,%xmm5 +___ +for($i=0;$i<$STRIDE/16;$i+=4) { +$code.=<<___; + movdqa `16*($i+0)-128`($bptr),%xmm0 + movdqa `16*($i+1)-128`($bptr),%xmm1 + movdqa `16*($i+2)-128`($bptr),%xmm2 + pand `16*($i+0)+256`(%r10),%xmm0 + movdqa `16*($i+3)-128`($bptr),%xmm3 + pand `16*($i+1)+256`(%r10),%xmm1 + por %xmm0,%xmm4 + pand `16*($i+2)+256`(%r10),%xmm2 + por %xmm1,%xmm5 + pand `16*($i+3)+256`(%r10),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 +___ +} +$code.=<<___; + por %xmm5,%xmm4 + pshufd \$0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 + lea $STRIDE($bptr),$bptr + movq %xmm0,%rdx # m0=bp[i] + mov $zero,($tptr) # save top-most carry lea 4*8($tptr,$num),$tptr # rewind $tptr mulx 0*8($aptr),$mi,%r11 # a[0]*b[i] @@ -2303,54 +2497,37 @@ mulx 3*8($aptr),%rdx,%r14 adox -2*8($tptr),%r12 adcx %rdx,%r13 - lea ($nptr,$num,2),$nptr # rewind $nptr + lea ($nptr,$num),$nptr # rewind $nptr lea 4*8($aptr),$aptr adox -1*8($tptr),%r13 adcx $zero,%r14 adox $zero,%r14 - .byte 0x67 mov $mi,%r15 imulq 32+8(%rsp),$mi # "t[0]"*n0 - movq `0*$STRIDE/4-96`($bptr),%xmm0 - .byte 0x67,0x67 mov $mi,%rdx - movq `1*$STRIDE/4-96`($bptr),%xmm1 - .byte 0x67 - pand %xmm4,%xmm0 - movq `2*$STRIDE/4-96`($bptr),%xmm2 - .byte 0x67 - pand %xmm5,%xmm1 - movq `3*$STRIDE/4-96`($bptr),%xmm3 - add \$$STRIDE,$bptr # next &b[i] - .byte 0x67 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 xor $zero,$zero # cf=0, of=0 mov $bptr,8+8(%rsp) # off-load &b[i] - mulx 0*16($nptr),%rax,%r10 + mulx 0*8($nptr),%rax,%r10 adcx %rax,%r15 # discarded adox %r11,%r10 - mulx 1*16($nptr),%rax,%r11 + mulx 1*8($nptr),%rax,%r11 adcx %rax,%r10 adox %r12,%r11 - mulx 2*16($nptr),%rax,%r12 + mulx 2*8($nptr),%rax,%r12 adcx %rax,%r11 adox %r13,%r12 - mulx 3*16($nptr),%rax,%r15 + mulx 3*8($nptr),%rax,%r15 mov $bi,%rdx - por %xmm2,%xmm0 mov 24+8(%rsp),$bptr # counter value mov %r10,-8*4($tptr) - por %xmm3,%xmm0 adcx %rax,%r12 mov %r11,-8*3($tptr) adox $zero,%r15 # of=0 mov %r12,-8*2($tptr) - lea 4*16($nptr),$nptr + lea 4*8($nptr),$nptr jmp .Lmulx4x_inner .align 32 @@ -2375,20 +2552,20 @@ adcx $zero,%r14 # cf=0 adox %r15,%r10 - mulx 0*16($nptr),%rax,%r15 + mulx 0*8($nptr),%rax,%r15 adcx %rax,%r10 adox %r15,%r11 - mulx 1*16($nptr),%rax,%r15 + mulx 1*8($nptr),%rax,%r15 adcx %rax,%r11 adox %r15,%r12 - mulx 2*16($nptr),%rax,%r15 + mulx 2*8($nptr),%rax,%r15 mov %r10,-5*8($tptr) adcx %rax,%r12 adox %r15,%r13 mov %r11,-4*8($tptr) - mulx 3*16($nptr),%rax,%r15 + mulx 3*8($nptr),%rax,%r15 mov $bi,%rdx - lea 4*16($nptr),$nptr + lea 4*8($nptr),$nptr mov %r12,-3*8($tptr) adcx %rax,%r13 adox $zero,%r15 @@ -2398,7 +2575,6 @@ jnz .Lmulx4x_inner mov 0+8(%rsp),$num # load -num - movq %xmm0,%rdx # bp[i+1] adc $zero,%r15 # modulo-scheduled sub 0*8($tptr),$bptr # pull top-most carry to %cf mov 8+8(%rsp),$bptr # re-load &b[i] @@ -2411,20 +2587,26 @@ cmp %r10,$bptr jb .Lmulx4x_outer - mov -16($nptr),%r10 + mov -8($nptr),%r10 + mov $zero,%r8 + mov ($nptr,$num),%r12 + lea ($nptr,$num),%rbp # rewind $nptr + mov $num,%rcx + lea ($tptr,$num),%rdi # rewind $tptr + xor %eax,%eax xor %r15,%r15 sub %r14,%r10 # compare top-most words adc %r15,%r15 - or %r15,$zero - xor \$1,$zero - lea ($tptr,$num),%rdi # rewind $tptr - lea ($nptr,$num,2),$nptr # rewind $nptr - .byte 0x67,0x67 - sar \$3+2,$num # cf=0 - lea ($nptr,$zero,8),%rbp + or %r15,%r8 + sar \$3+2,%rcx + sub %r8,%rax # %rax=-%r8 mov 56+8(%rsp),%rdx # restore rp - mov $num,%rcx - jmp .Lsqrx4x_sub # common post-condition + dec %r12 # so that after 'not' we get -n[0] + mov 8*1(%rbp),%r13 + xor %r8,%r8 + mov 8*2(%rbp),%r14 + mov 8*3(%rbp),%r15 + jmp .Lsqrx4x_sub_entry # common post-condition .size mulx4x_internal,.-mulx4x_internal ___ } { @@ -2448,7 +2630,6 @@ .align 32 bn_powerx5: .Lpowerx5_enter: - .byte 0x67 mov %rsp,%rax push %rbx push %rbp @@ -2456,45 +2637,47 @@ push %r13 push %r14 push %r15 -___ -$code.=<<___ if ($win64); - lea -0x28(%rsp),%rsp - movaps %xmm6,(%rsp) - movaps %xmm7,0x10(%rsp) -___ -$code.=<<___; - .byte 0x67 - mov ${num}d,%r10d + shl \$3,${num}d # convert $num to bytes - shl \$3+2,%r10d # 4*$num + lea ($num,$num,2),%r10 # 3*$num in bytes neg $num mov ($n0),$n0 # *n0 ############################################################## - # ensure that stack frame doesn't alias with $aptr+4*$num - # modulo 4096, which covers ret[num], am[num] and n[2*num] - # (see bn_exp.c). this is done to allow memory disambiguation - # logic do its magic. + # Ensure that stack frame doesn't alias with $rptr+3*$num + # modulo 4096, which covers ret[num], am[num] and n[num] + # (see bn_exp.c). This is done to allow memory disambiguation + # logic do its magic. [Extra 256 bytes is for power mask + # calculated from 7th argument, the index.] # - lea -64(%rsp,$num,2),%r11 - sub $aptr,%r11 + lea -320(%rsp,$num,2),%r11 + sub $rptr,%r11 and \$4095,%r11 cmp %r11,%r10 jb .Lpwrx_sp_alt sub %r11,%rsp # align with $aptr - lea -64(%rsp,$num,2),%rsp # alloca(frame+2*$num) + lea -320(%rsp,$num,2),%rsp # alloca(frame+2*$num*8+256) jmp .Lpwrx_sp_done .align 32 .Lpwrx_sp_alt: - lea 4096-64(,$num,2),%r10 # 4096-frame-2*$num - lea -64(%rsp,$num,2),%rsp # alloca(frame+2*$num) + lea 4096-320(,$num,2),%r10 + lea -320(%rsp,$num,2),%rsp # alloca(frame+2*$num*8+256) sub %r10,%r11 mov \$0,%r10 cmovc %r10,%r11 sub %r11,%rsp .Lpwrx_sp_done: and \$-64,%rsp + mov %rax,%r11 + sub %rsp,%r11 + and \$-4096,%r11 +.Lpwrx_page_walk: + mov (%rsp,%r11),%r10 + sub \$4096,%r11 + .byte 0x2e # predict non-taken + jnc .Lpwrx_page_walk + mov $num,%r10 neg $num @@ -2519,10 +2702,15 @@ .Lpowerx5_body: call __bn_sqrx8x_internal + call __bn_postx4x_internal call __bn_sqrx8x_internal + call __bn_postx4x_internal call __bn_sqrx8x_internal + call __bn_postx4x_internal call __bn_sqrx8x_internal + call __bn_postx4x_internal call __bn_sqrx8x_internal + call __bn_postx4x_internal mov %r10,$num # -num mov $aptr,$rptr @@ -2534,12 +2722,7 @@ mov 40(%rsp),%rsi # restore %rsp mov \$1,%rax -___ -$code.=<<___ if ($win64); - movaps -88(%rsi),%xmm6 - movaps -72(%rsi),%xmm7 -___ -$code.=<<___; + mov -48(%rsi),%r15 mov -40(%rsi),%r14 mov -32(%rsi),%r13 @@ -2973,11 +3156,11 @@ $code.=<<___; movq %xmm2,$nptr -sqrx8x_reduction: +__bn_sqrx8x_reduction: xor %eax,%eax # initial top-most carry bit mov 32+8(%rsp),%rbx # n0 mov 48+8(%rsp),%rdx # "%r8", 8*0($tptr) - lea -128($nptr,$num,2),%rcx # end of n[] + lea -8*8($nptr,$num),%rcx # end of n[] #lea 48+8(%rsp,$num,2),$tptr # end of t[] buffer mov %rcx, 0+8(%rsp) # save end of n[] mov $tptr,8+8(%rsp) # save end of t[] @@ -3006,23 +3189,23 @@ .align 32 .Lsqrx8x_reduce: mov %r8, %rbx - mulx 16*0($nptr),%rax,%r8 # n[0] + mulx 8*0($nptr),%rax,%r8 # n[0] adcx %rbx,%rax # discarded adox %r9,%r8 - mulx 16*1($nptr),%rbx,%r9 # n[1] + mulx 8*1($nptr),%rbx,%r9 # n[1] adcx %rbx,%r8 adox %r10,%r9 - mulx 16*2($nptr),%rbx,%r10 + mulx 8*2($nptr),%rbx,%r10 adcx %rbx,%r9 adox %r11,%r10 - mulx 16*3($nptr),%rbx,%r11 + mulx 8*3($nptr),%rbx,%r11 adcx %rbx,%r10 adox %r12,%r11 - .byte 0xc4,0x62,0xe3,0xf6,0xa5,0x40,0x00,0x00,0x00 # mulx 16*4($nptr),%rbx,%r12 + .byte 0xc4,0x62,0xe3,0xf6,0xa5,0x20,0x00,0x00,0x00 # mulx 8*4($nptr),%rbx,%r12 mov %rdx,%rax mov %r8,%rdx adcx %rbx,%r11 @@ -3032,15 +3215,15 @@ mov %rax,%rdx mov %rax,64+48+8(%rsp,%rcx,8) # put aside n0*a[i] - mulx 16*5($nptr),%rax,%r13 + mulx 8*5($nptr),%rax,%r13 adcx %rax,%r12 adox %r14,%r13 - mulx 16*6($nptr),%rax,%r14 + mulx 8*6($nptr),%rax,%r14 adcx %rax,%r13 adox %r15,%r14 - mulx 16*7($nptr),%rax,%r15 + mulx 8*7($nptr),%rax,%r15 mov %rbx,%rdx adcx %rax,%r14 adox $carry,%r15 # $carry is 0 @@ -3056,7 +3239,7 @@ mov 48+8(%rsp),%rdx # pull n0*a[0] add 8*0($tptr),%r8 - lea 16*8($nptr),$nptr + lea 8*8($nptr),$nptr mov \$-8,%rcx adcx 8*1($tptr),%r9 adcx 8*2($tptr),%r10 @@ -3075,35 +3258,35 @@ .align 32 .Lsqrx8x_tail: mov %r8,%rbx - mulx 16*0($nptr),%rax,%r8 + mulx 8*0($nptr),%rax,%r8 adcx %rax,%rbx adox %r9,%r8 - mulx 16*1($nptr),%rax,%r9 + mulx 8*1($nptr),%rax,%r9 adcx %rax,%r8 adox %r10,%r9 - mulx 16*2($nptr),%rax,%r10 + mulx 8*2($nptr),%rax,%r10 adcx %rax,%r9 adox %r11,%r10 - mulx 16*3($nptr),%rax,%r11 + mulx 8*3($nptr),%rax,%r11 adcx %rax,%r10 adox %r12,%r11 - .byte 0xc4,0x62,0xfb,0xf6,0xa5,0x40,0x00,0x00,0x00 # mulx 16*4($nptr),%rax,%r12 + .byte 0xc4,0x62,0xfb,0xf6,0xa5,0x20,0x00,0x00,0x00 # mulx 8*4($nptr),%rax,%r12 adcx %rax,%r11 adox %r13,%r12 - mulx 16*5($nptr),%rax,%r13 + mulx 8*5($nptr),%rax,%r13 adcx %rax,%r12 adox %r14,%r13 - mulx 16*6($nptr),%rax,%r14 + mulx 8*6($nptr),%rax,%r14 adcx %rax,%r13 adox %r15,%r14 - mulx 16*7($nptr),%rax,%r15 + mulx 8*7($nptr),%rax,%r15 mov 72+48+8(%rsp,%rcx,8),%rdx # pull n0*a[i] adcx %rax,%r14 adox $carry,%r15 @@ -3119,7 +3302,7 @@ sub 16+8(%rsp),$carry # mov 16(%rsp),%cf mov 48+8(%rsp),%rdx # pull n0*a[0] - lea 16*8($nptr),$nptr + lea 8*8($nptr),$nptr adc 8*0($tptr),%r8 adc 8*1($tptr),%r9 adc 8*2($tptr),%r10 @@ -3155,7 +3338,7 @@ adc 8*0($tptr),%r8 movq %xmm3,%rcx adc 8*1($tptr),%r9 - mov 16*7($nptr),$carry + mov 8*7($nptr),$carry movq %xmm2,$nptr # restore $nptr adc 8*2($tptr),%r10 adc 8*3($tptr),%r11 @@ -3181,6 +3364,8 @@ lea 8*8($tptr,%rcx),$tptr # start of current t[] window cmp 8+8(%rsp),%r8 # end of t[]? jb .Lsqrx8x_reduction_loop + ret +.size bn_sqrx8x_internal,.-bn_sqrx8x_internal ___ } ############################################################## @@ -3188,52 +3373,59 @@ # { my ($rptr,$nptr)=("%rdx","%rbp"); -my @ri=map("%r$_",(10..13)); -my @ni=map("%r$_",(14..15)); $code.=<<___; - xor %ebx,%ebx - sub %r15,%rsi # compare top-most words - adc %rbx,%rbx +.align 32 +__bn_postx4x_internal: + mov 8*0($nptr),%r12 mov %rcx,%r10 # -$num - or %rbx,%rax mov %rcx,%r9 # -$num - xor \$1,%rax - sar \$3+2,%rcx # cf=0 + neg %rax + sar \$3+2,%rcx #lea 48+8(%rsp,%r9),$tptr - lea ($nptr,%rax,8),$nptr movq %xmm1,$rptr # restore $rptr movq %xmm1,$aptr # prepare for back-to-back call - jmp .Lsqrx4x_sub + dec %r12 # so that after 'not' we get -n[0] + mov 8*1($nptr),%r13 + xor %r8,%r8 + mov 8*2($nptr),%r14 + mov 8*3($nptr),%r15 + jmp .Lsqrx4x_sub_entry -.align 32 +.align 16 .Lsqrx4x_sub: - .byte 0x66 - mov 8*0($tptr),%r12 - mov 8*1($tptr),%r13 - sbb 16*0($nptr),%r12 - mov 8*2($tptr),%r14 - sbb 16*1($nptr),%r13 - mov 8*3($tptr),%r15 - lea 8*4($tptr),$tptr - sbb 16*2($nptr),%r14 + mov 8*0($nptr),%r12 + mov 8*1($nptr),%r13 + mov 8*2($nptr),%r14 + mov 8*3($nptr),%r15 +.Lsqrx4x_sub_entry: + andn %rax,%r12,%r12 + lea 8*4($nptr),$nptr + andn %rax,%r13,%r13 + andn %rax,%r14,%r14 + andn %rax,%r15,%r15 + + neg %r8 # mov %r8,%cf + adc 8*0($tptr),%r12 + adc 8*1($tptr),%r13 + adc 8*2($tptr),%r14 + adc 8*3($tptr),%r15 mov %r12,8*0($rptr) - sbb 16*3($nptr),%r15 - lea 16*4($nptr),$nptr + lea 8*4($tptr),$tptr mov %r13,8*1($rptr) + sbb %r8,%r8 # mov %cf,%r8 mov %r14,8*2($rptr) mov %r15,8*3($rptr) lea 8*4($rptr),$rptr inc %rcx jnz .Lsqrx4x_sub -___ -} -$code.=<<___; + neg %r9 # restore $num ret -.size bn_sqrx8x_internal,.-bn_sqrx8x_internal +.size __bn_postx4x_internal,.-__bn_postx4x_internal ___ +} }}} { my ($inp,$num,$tbl,$idx)=$win64?("%rcx","%edx","%r8", "%r9d") : # Win64 order @@ -3282,56 +3474,91 @@ .globl bn_gather5 .type bn_gather5,\@abi-omnipotent -.align 16 +.align 32 bn_gather5: -___ -$code.=<<___ if ($win64); -.LSEH_begin_bn_gather5: +.LSEH_begin_bn_gather5: # Win64 thing, but harmless in other cases # I can't trust assembler to use specific encoding:-( - .byte 0x48,0x83,0xec,0x28 #sub \$0x28,%rsp - .byte 0x0f,0x29,0x34,0x24 #movaps %xmm6,(%rsp) - .byte 0x0f,0x29,0x7c,0x24,0x10 #movdqa %xmm7,0x10(%rsp) + .byte 0x4c,0x8d,0x14,0x24 #lea (%rsp),%r10 + .byte 0x48,0x81,0xec,0x08,0x01,0x00,0x00 #sub $0x108,%rsp + lea .Linc(%rip),%rax + and \$-16,%rsp # shouldn't be formally required + + movd $idx,%xmm5 + movdqa 0(%rax),%xmm0 # 00000001000000010000000000000000 + movdqa 16(%rax),%xmm1 # 00000002000000020000000200000002 + lea 128($tbl),%r11 # size optimization + lea 128(%rsp),%rax # size optimization + + pshufd \$0,%xmm5,%xmm5 # broadcast $idx + movdqa %xmm1,%xmm4 + movdqa %xmm1,%xmm2 ___ +######################################################################## +# calculate mask by comparing 0..31 to $idx and save result to stack +# +for($i=0;$i<$STRIDE/16;$i+=4) { $code.=<<___; - mov $idx,%r11d - shr \$`log($N/8)/log(2)`,$idx - and \$`$N/8-1`,%r11 - not $idx - lea .Lmagic_masks(%rip),%rax - and \$`2**5/($N/8)-1`,$idx # 5 is "window size" - lea 128($tbl,%r11,8),$tbl # pointer within 1st cache line - movq 0(%rax,$idx,8),%xmm4 # set of masks denoting which - movq 8(%rax,$idx,8),%xmm5 # cache line contains element - movq 16(%rax,$idx,8),%xmm6 # denoted by 7th argument - movq 24(%rax,$idx,8),%xmm7 + paddd %xmm0,%xmm1 + pcmpeqd %xmm5,%xmm0 # compare to 1,0 +___ +$code.=<<___ if ($i); + movdqa %xmm3,`16*($i-1)-128`(%rax) +___ +$code.=<<___; + movdqa %xmm4,%xmm3 + + paddd %xmm1,%xmm2 + pcmpeqd %xmm5,%xmm1 # compare to 3,2 + movdqa %xmm0,`16*($i+0)-128`(%rax) + movdqa %xmm4,%xmm0 + + paddd %xmm2,%xmm3 + pcmpeqd %xmm5,%xmm2 # compare to 5,4 + movdqa %xmm1,`16*($i+1)-128`(%rax) + movdqa %xmm4,%xmm1 + + paddd %xmm3,%xmm0 + pcmpeqd %xmm5,%xmm3 # compare to 7,6 + movdqa %xmm2,`16*($i+2)-128`(%rax) + movdqa %xmm4,%xmm2 +___ +} +$code.=<<___; + movdqa %xmm3,`16*($i-1)-128`(%rax) jmp .Lgather -.align 16 -.Lgather: - movq `0*$STRIDE/4-128`($tbl),%xmm0 - movq `1*$STRIDE/4-128`($tbl),%xmm1 - pand %xmm4,%xmm0 - movq `2*$STRIDE/4-128`($tbl),%xmm2 - pand %xmm5,%xmm1 - movq `3*$STRIDE/4-128`($tbl),%xmm3 - pand %xmm6,%xmm2 - por %xmm1,%xmm0 - pand %xmm7,%xmm3 - .byte 0x67,0x67 - por %xmm2,%xmm0 - lea $STRIDE($tbl),$tbl - por %xmm3,%xmm0 +.align 32 +.Lgather: + pxor %xmm4,%xmm4 + pxor %xmm5,%xmm5 +___ +for($i=0;$i<$STRIDE/16;$i+=4) { +$code.=<<___; + movdqa `16*($i+0)-128`(%r11),%xmm0 + movdqa `16*($i+1)-128`(%r11),%xmm1 + movdqa `16*($i+2)-128`(%r11),%xmm2 + pand `16*($i+0)-128`(%rax),%xmm0 + movdqa `16*($i+3)-128`(%r11),%xmm3 + pand `16*($i+1)-128`(%rax),%xmm1 + por %xmm0,%xmm4 + pand `16*($i+2)-128`(%rax),%xmm2 + por %xmm1,%xmm5 + pand `16*($i+3)-128`(%rax),%xmm3 + por %xmm2,%xmm4 + por %xmm3,%xmm5 +___ +} +$code.=<<___; + por %xmm5,%xmm4 + lea $STRIDE(%r11),%r11 + pshufd \$0x4e,%xmm4,%xmm0 + por %xmm4,%xmm0 movq %xmm0,($out) # m0=bp[0] lea 8($out),$out sub \$1,$num jnz .Lgather -___ -$code.=<<___ if ($win64); - movaps (%rsp),%xmm6 - movaps 0x10(%rsp),%xmm7 - lea 0x28(%rsp),%rsp -___ -$code.=<<___; + + lea (%r10),%rsp ret .LSEH_end_bn_gather5: .size bn_gather5,.-bn_gather5 @@ -3339,9 +3566,9 @@ } $code.=<<___; .align 64 -.Lmagic_masks: - .long 0,0, 0,0, 0,0, -1,-1 - .long 0,0, 0,0, 0,0, 0,0 +.Linc: + .long 0,0, 1,1 + .long 2,2, 2,2 .asciz "Montgomery Multiplication with scatter/gather for x86_64, CRYPTOGAMS by " ___ @@ -3389,19 +3616,16 @@ lea .Lmul_epilogue(%rip),%r10 cmp %r10,%rbx - jb .Lbody_40 + ja .Lbody_40 mov 192($context),%r10 # pull $num mov 8(%rax,%r10,8),%rax # pull saved stack pointer + jmp .Lbody_proceed .Lbody_40: mov 40(%rax),%rax # pull saved stack pointer .Lbody_proceed: - - movaps -88(%rax),%xmm0 - movaps -72(%rax),%xmm1 - mov -8(%rax),%rbx mov -16(%rax),%rbp mov -24(%rax),%r12 @@ -3414,8 +3638,6 @@ mov %r13,224($context) # restore context->R13 mov %r14,232($context) # restore context->R14 mov %r15,240($context) # restore context->R15 - movups %xmm0,512($context) # restore context->Xmm6 - movups %xmm1,528($context) # restore context->Xmm7 .Lcommon_seh_tail: mov 8(%rax),%rdi @@ -3526,10 +3748,9 @@ $code.=<<___; .align 8 .LSEH_info_bn_gather5: - .byte 0x01,0x0d,0x05,0x00 - .byte 0x0d,0x78,0x01,0x00 #movaps 0x10(rsp),xmm7 - .byte 0x08,0x68,0x00,0x00 #movaps (rsp),xmm6 - .byte 0x04,0x42,0x00,0x00 #sub rsp,0x28 + .byte 0x01,0x0b,0x03,0x0a + .byte 0x0b,0x01,0x21,0x00 # sub rsp,0x108 + .byte 0x04,0xa3,0x00,0x00 # lea r10,(rsp) .align 8 ___ } diff --git a/vendor/openssl/openssl/crypto/bn/bn.h b/vendor/openssl/openssl/crypto/bn/bn.h index 5696965e9..86264ae63 100644 --- a/vendor/openssl/openssl/crypto/bn/bn.h +++ b/vendor/openssl/openssl/crypto/bn/bn.h @@ -125,6 +125,7 @@ #ifndef HEADER_BN_H # define HEADER_BN_H +# include # include # ifndef OPENSSL_NO_FP_API # include /* FILE */ @@ -721,8 +722,17 @@ const BIGNUM *BN_get0_nist_prime_521(void); /* library internal functions */ -# define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\ - (a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2)) +# define bn_expand(a,bits) \ + ( \ + bits > (INT_MAX - BN_BITS2 + 1) ? \ + NULL \ + : \ + (((bits+BN_BITS2-1)/BN_BITS2) <= (a)->dmax) ? \ + (a) \ + : \ + bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2) \ + ) + # define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words))) BIGNUM *bn_expand2(BIGNUM *a, int words); # ifndef OPENSSL_NO_DEPRECATED diff --git a/vendor/openssl/openssl/crypto/bn/bn_exp.c b/vendor/openssl/openssl/crypto/bn/bn_exp.c index 50cf3231b..1670f01d1 100644 --- a/vendor/openssl/openssl/crypto/bn/bn_exp.c +++ b/vendor/openssl/openssl/crypto/bn/bn_exp.c @@ -110,6 +110,7 @@ */ #include "cryptlib.h" +#include "constant_time_locl.h" #include "bn_lcl.h" #include @@ -282,9 +283,14 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, } bits = BN_num_bits(p); - if (bits == 0) { - ret = BN_one(r); + /* x**0 mod 1 is still zero. */ + if (BN_is_one(m)) { + ret = 1; + BN_zero(r); + } else { + ret = BN_one(r); + } return ret; } @@ -418,7 +424,13 @@ int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, } bits = BN_num_bits(p); if (bits == 0) { - ret = BN_one(rr); + /* x**0 mod 1 is still zero. */ + if (BN_is_one(m)) { + ret = 1; + BN_zero(rr); + } else { + ret = BN_one(rr); + } return ret; } @@ -595,15 +607,17 @@ static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos) static int MOD_EXP_CTIME_COPY_TO_PREBUF(const BIGNUM *b, int top, unsigned char *buf, int idx, - int width) + int window) { - size_t i, j; + int i, j; + int width = 1 << window; + BN_ULONG *table = (BN_ULONG *)buf; if (top > b->top) top = b->top; /* this works because 'buf' is explicitly * zeroed */ - for (i = 0, j = idx; i < top * sizeof b->d[0]; i++, j += width) { - buf[j] = ((unsigned char *)b->d)[i]; + for (i = 0, j = idx; i < top; i++, j += width) { + table[j] = b->d[i]; } return 1; @@ -611,15 +625,51 @@ static int MOD_EXP_CTIME_COPY_TO_PREBUF(const BIGNUM *b, int top, static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top, unsigned char *buf, int idx, - int width) + int window) { - size_t i, j; + int i, j; + int width = 1 << window; + volatile BN_ULONG *table = (volatile BN_ULONG *)buf; if (bn_wexpand(b, top) == NULL) return 0; - for (i = 0, j = idx; i < top * sizeof b->d[0]; i++, j += width) { - ((unsigned char *)b->d)[i] = buf[j]; + if (window <= 3) { + for (i = 0; i < top; i++, table += width) { + BN_ULONG acc = 0; + + for (j = 0; j < width; j++) { + acc |= table[j] & + ((BN_ULONG)0 - (constant_time_eq_int(j,idx)&1)); + } + + b->d[i] = acc; + } + } else { + int xstride = 1 << (window - 2); + BN_ULONG y0, y1, y2, y3; + + i = idx >> (window - 2); /* equivalent of idx / xstride */ + idx &= xstride - 1; /* equivalent of idx % xstride */ + + y0 = (BN_ULONG)0 - (constant_time_eq_int(i,0)&1); + y1 = (BN_ULONG)0 - (constant_time_eq_int(i,1)&1); + y2 = (BN_ULONG)0 - (constant_time_eq_int(i,2)&1); + y3 = (BN_ULONG)0 - (constant_time_eq_int(i,3)&1); + + for (i = 0; i < top; i++, table += width) { + BN_ULONG acc = 0; + + for (j = 0; j < xstride; j++) { + acc |= ( (table[j + 0 * xstride] & y0) | + (table[j + 1 * xstride] & y1) | + (table[j + 2 * xstride] & y2) | + (table[j + 3 * xstride] & y3) ) + & ((BN_ULONG)0 - (constant_time_eq_int(j,idx)&1)); + } + + b->d[i] = acc; + } } b->top = top; @@ -639,7 +689,7 @@ static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top, * precomputation memory layout to limit data-dependency to a minimum to * protect secret exponents (cf. the hyper-threading timing attacks pointed * out by Colin Percival, - * http://www.daemong-consideredperthreading-considered-harmful/) + * http://www.daemonology.net/hyperthreading-considered-harmful/) */ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, @@ -671,7 +721,13 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, bits = BN_num_bits(p); if (bits == 0) { - ret = BN_one(rr); + /* x**0 mod 1 is still zero. */ + if (BN_is_one(m)) { + ret = 1; + BN_zero(rr); + } else { + ret = BN_one(rr); + } return ret; } @@ -732,8 +788,8 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, if (window >= 5) { window = 5; /* ~5% improvement for RSA2048 sign, and even * for RSA4096 */ - if ((top & 7) == 0) - powerbufLen += 2 * top * sizeof(m->d[0]); + /* reserve space for mont->N.d[] copy */ + powerbufLen += top * sizeof(mont->N.d[0]); } #endif (void)0; @@ -954,7 +1010,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, const BN_ULONG *not_used, const BN_ULONG *np, const BN_ULONG *n0, int num); - BN_ULONG *np = mont->N.d, *n0 = mont->n0, *np2; + BN_ULONG *n0 = mont->n0, *np; /* * BN_to_montgomery can contaminate words above .top [in @@ -965,11 +1021,11 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, for (i = tmp.top; i < top; i++) tmp.d[i] = 0; - if (top & 7) - np2 = np; - else - for (np2 = am.d + top, i = 0; i < top; i++) - np2[2 * i] = np[i]; + /* + * copy mont->N.d[] to improve cache locality + */ + for (np = am.d + top, i = 0; i < top; i++) + np[i] = mont->N.d[i]; bn_scatter5(tmp.d, top, powerbuf, 0); bn_scatter5(am.d, am.top, powerbuf, 1); @@ -979,7 +1035,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, # if 0 for (i = 3; i < 32; i++) { /* Calculate a^i = a^(i-1) * a */ - bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np2, n0, top, i - 1); + bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1); bn_scatter5(tmp.d, top, powerbuf, i); } # else @@ -990,7 +1046,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, } for (i = 3; i < 8; i += 2) { int j; - bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np2, n0, top, i - 1); + bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1); bn_scatter5(tmp.d, top, powerbuf, i); for (j = 2 * i; j < 32; j *= 2) { bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top); @@ -998,13 +1054,13 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, } } for (; i < 16; i += 2) { - bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np2, n0, top, i - 1); + bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1); bn_scatter5(tmp.d, top, powerbuf, i); bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top); bn_scatter5(tmp.d, top, powerbuf, 2 * i); } for (; i < 32; i += 2) { - bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np2, n0, top, i - 1); + bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1); bn_scatter5(tmp.d, top, powerbuf, i); } # endif @@ -1033,11 +1089,11 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, while (bits >= 0) { wvalue = bn_get_bits5(p->d, bits - 4); bits -= 5; - bn_power5(tmp.d, tmp.d, powerbuf, np2, n0, top, wvalue); + bn_power5(tmp.d, tmp.d, powerbuf, np, n0, top, wvalue); } } - ret = bn_from_montgomery(tmp.d, tmp.d, NULL, np2, n0, top); + ret = bn_from_montgomery(tmp.d, tmp.d, NULL, np, n0, top); tmp.top = top; bn_correct_top(&tmp); if (ret) { @@ -1048,9 +1104,9 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, } else #endif { - if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, 0, numPowers)) + if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, 0, window)) goto err; - if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&am, top, powerbuf, 1, numPowers)) + if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&am, top, powerbuf, 1, window)) goto err; /* @@ -1062,15 +1118,15 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, if (window > 1) { if (!BN_mod_mul_montgomery(&tmp, &am, &am, mont, ctx)) goto err; - if (!MOD_EXP_CTIME_COPY_TO_PREBUF - (&tmp, top, powerbuf, 2, numPowers)) + if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, 2, + window)) goto err; for (i = 3; i < numPowers; i++) { /* Calculate a^i = a^(i-1) * a */ if (!BN_mod_mul_montgomery(&tmp, &am, &tmp, mont, ctx)) goto err; - if (!MOD_EXP_CTIME_COPY_TO_PREBUF - (&tmp, top, powerbuf, i, numPowers)) + if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, i, + window)) goto err; } } @@ -1078,8 +1134,8 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, bits--; for (wvalue = 0, i = bits % window; i >= 0; i--, bits--) wvalue = (wvalue << 1) + BN_is_bit_set(p, bits); - if (!MOD_EXP_CTIME_COPY_FROM_PREBUF - (&tmp, top, powerbuf, wvalue, numPowers)) + if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue, + window)) goto err; /* @@ -1099,8 +1155,8 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, /* * Fetch the appropriate pre-computed value from the pre-buf */ - if (!MOD_EXP_CTIME_COPY_FROM_PREBUF - (&am, top, powerbuf, wvalue, numPowers)) + if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&am, top, powerbuf, wvalue, + window)) goto err; /* Multiply the result into the intermediate result */ @@ -1182,8 +1238,9 @@ int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, if (BN_is_one(m)) { ret = 1; BN_zero(rr); - } else + } else { ret = BN_one(rr); + } return ret; } if (a == 0) { @@ -1297,9 +1354,14 @@ int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, } bits = BN_num_bits(p); - - if (bits == 0) { - ret = BN_one(r); + if (bits == 0) { + /* x**0 mod 1 is still zero. */ + if (BN_is_one(m)) { + ret = 1; + BN_zero(r); + } else { + ret = BN_one(r); + } return ret; } diff --git a/vendor/openssl/openssl/crypto/bn/bn_print.c b/vendor/openssl/openssl/crypto/bn/bn_print.c index ab10b957b..bfa31efc5 100644 --- a/vendor/openssl/openssl/crypto/bn/bn_print.c +++ b/vendor/openssl/openssl/crypto/bn/bn_print.c @@ -58,6 +58,7 @@ #include #include +#include #include "cryptlib.h" #include #include "bn_lcl.h" @@ -189,7 +190,11 @@ int BN_hex2bn(BIGNUM **bn, const char *a) a++; } - for (i = 0; isxdigit((unsigned char)a[i]); i++) ; + for (i = 0; i <= (INT_MAX/4) && isxdigit((unsigned char)a[i]); i++) + continue; + + if (i > INT_MAX/4) + goto err; num = i + neg; if (bn == NULL) @@ -204,7 +209,7 @@ int BN_hex2bn(BIGNUM **bn, const char *a) BN_zero(ret); } - /* i is the number of hex digests; */ + /* i is the number of hex digits */ if (bn_expand(ret, i * 4) == NULL) goto err; @@ -260,7 +265,11 @@ int BN_dec2bn(BIGNUM **bn, const char *a) a++; } - for (i = 0; isdigit((unsigned char)a[i]); i++) ; + for (i = 0; i <= (INT_MAX/4) && isdigit((unsigned char)a[i]); i++) + continue; + + if (i > INT_MAX/4) + goto err; num = i + neg; if (bn == NULL) @@ -278,7 +287,7 @@ int BN_dec2bn(BIGNUM **bn, const char *a) BN_zero(ret); } - /* i is the number of digests, a bit of an over expand; */ + /* i is the number of digits, a bit of an over expand */ if (bn_expand(ret, i * 4) == NULL) goto err; diff --git a/vendor/openssl/openssl/crypto/bn/bn_recp.c b/vendor/openssl/openssl/crypto/bn/bn_recp.c index 7497ac624..f047040ef 100644 --- a/vendor/openssl/openssl/crypto/bn/bn_recp.c +++ b/vendor/openssl/openssl/crypto/bn/bn_recp.c @@ -65,6 +65,7 @@ void BN_RECP_CTX_init(BN_RECP_CTX *recp) BN_init(&(recp->N)); BN_init(&(recp->Nr)); recp->num_bits = 0; + recp->shift = 0; recp->flags = 0; } diff --git a/vendor/openssl/openssl/crypto/bn/exptest.c b/vendor/openssl/openssl/crypto/bn/exptest.c index 8b3a4bae4..ac611c2e2 100644 --- a/vendor/openssl/openssl/crypto/bn/exptest.c +++ b/vendor/openssl/openssl/crypto/bn/exptest.c @@ -72,6 +72,25 @@ static const char rnd_seed[] = "string to make the random number generator think it has entropy"; +/* + * Test that r == 0 in test_exp_mod_zero(). Returns one on success, + * returns zero and prints debug output otherwise. + */ +static int a_is_zero_mod_one(const char *method, const BIGNUM *r, + const BIGNUM *a) { + if (!BN_is_zero(r)) { + fprintf(stderr, "%s failed:\n", method); + fprintf(stderr, "a ** 0 mod 1 = r (should be 0)\n"); + fprintf(stderr, "a = "); + BN_print_fp(stderr, a); + fprintf(stderr, "\nr = "); + BN_print_fp(stderr, r); + fprintf(stderr, "\n"); + return 0; + } + return 1; +} + /* * test_exp_mod_zero tests that x**0 mod 1 == 0. It returns zero on success. */ @@ -79,8 +98,9 @@ static int test_exp_mod_zero() { BIGNUM a, p, m; BIGNUM r; + BN_ULONG one_word = 1; BN_CTX *ctx = BN_CTX_new(); - int ret = 1; + int ret = 1, failed = 0; BN_init(&m); BN_one(&m); @@ -92,21 +112,65 @@ static int test_exp_mod_zero() BN_zero(&p); BN_init(&r); - BN_mod_exp(&r, &a, &p, &m, ctx); - BN_CTX_free(ctx); - if (BN_is_zero(&r)) - ret = 0; - else { - printf("1**0 mod 1 = "); - BN_print_fp(stdout, &r); - printf(", should be 0\n"); + if (!BN_rand(&a, 1024, 0, 0)) + goto err; + + if (!BN_mod_exp(&r, &a, &p, &m, ctx)) + goto err; + + if (!a_is_zero_mod_one("BN_mod_exp", &r, &a)) + failed = 1; + + if (!BN_mod_exp_recp(&r, &a, &p, &m, ctx)) + goto err; + + if (!a_is_zero_mod_one("BN_mod_exp_recp", &r, &a)) + failed = 1; + + if (!BN_mod_exp_simple(&r, &a, &p, &m, ctx)) + goto err; + + if (!a_is_zero_mod_one("BN_mod_exp_simple", &r, &a)) + failed = 1; + + if (!BN_mod_exp_mont(&r, &a, &p, &m, ctx, NULL)) + goto err; + + if (!a_is_zero_mod_one("BN_mod_exp_mont", &r, &a)) + failed = 1; + + if (!BN_mod_exp_mont_consttime(&r, &a, &p, &m, ctx, NULL)) { + goto err; + } + + if (!a_is_zero_mod_one("BN_mod_exp_mont_consttime", &r, &a)) + failed = 1; + + /* + * A different codepath exists for single word multiplication + * in non-constant-time only. + */ + if (!BN_mod_exp_mont_word(&r, one_word, &p, &m, ctx, NULL)) + goto err; + + if (!BN_is_zero(&r)) { + fprintf(stderr, "BN_mod_exp_mont_word failed:\n"); + fprintf(stderr, "1 ** 0 mod 1 = r (should be 0)\n"); + fprintf(stderr, "r = "); + BN_print_fp(stderr, &r); + fprintf(stderr, "\n"); + return 0; } + ret = failed; + + err: BN_free(&r); BN_free(&a); BN_free(&p); BN_free(&m); + BN_CTX_free(ctx); return ret; } diff --git a/vendor/openssl/openssl/crypto/camellia/camellia.c b/vendor/openssl/openssl/crypto/camellia/camellia.c index b4a6766c6..719fa61cf 100644 --- a/vendor/openssl/openssl/crypto/camellia/camellia.c +++ b/vendor/openssl/openssl/crypto/camellia/camellia.c @@ -1,4 +1,4 @@ -/* crypto/camellia/camellia.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/camellia/camellia.c */ /* ==================================================================== * Copyright 2006 NTT (Nippon Telegraph and Telephone Corporation) . * ALL RIGHTS RESERVED. @@ -67,7 +67,7 @@ /* * Algorithm Specification - * http://info.isl.llia/specicrypt/eng/camellia/specifications.html + * http://info.isl.ntt.co.jp/crypt/eng/camellia/specifications.html */ /* diff --git a/vendor/openssl/openssl/crypto/camellia/camellia.h b/vendor/openssl/openssl/crypto/camellia/camellia.h index 9be7c0fd9..45e8d25b1 100644 --- a/vendor/openssl/openssl/crypto/camellia/camellia.h +++ b/vendor/openssl/openssl/crypto/camellia/camellia.h @@ -1,4 +1,4 @@ -/* crypto/camellia/camellia.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/camellia/camellia.h */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/camellia/cmll_cbc.c b/vendor/openssl/openssl/crypto/camellia/cmll_cbc.c index a4907ca05..4017e00d9 100644 --- a/vendor/openssl/openssl/crypto/camellia/cmll_cbc.c +++ b/vendor/openssl/openssl/crypto/camellia/cmll_cbc.c @@ -1,4 +1,4 @@ -/* crypto/camellia/camellia_cbc.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/camellia/camellia_cbc.c */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/camellia/cmll_cfb.c b/vendor/openssl/openssl/crypto/camellia/cmll_cfb.c index 59b85225c..78f2ae456 100644 --- a/vendor/openssl/openssl/crypto/camellia/cmll_cfb.c +++ b/vendor/openssl/openssl/crypto/camellia/cmll_cfb.c @@ -1,4 +1,4 @@ -/* crypto/camellia/camellia_cfb.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/camellia/camellia_cfb.c */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/camellia/cmll_ctr.c b/vendor/openssl/openssl/crypto/camellia/cmll_ctr.c index b8f523d44..95e26621b 100644 --- a/vendor/openssl/openssl/crypto/camellia/cmll_ctr.c +++ b/vendor/openssl/openssl/crypto/camellia/cmll_ctr.c @@ -1,4 +1,4 @@ -/* crypto/camellia/camellia_ctr.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/camellia/camellia_ctr.c */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/camellia/cmll_ecb.c b/vendor/openssl/openssl/crypto/camellia/cmll_ecb.c index 16f1af86a..b030791b2 100644 --- a/vendor/openssl/openssl/crypto/camellia/cmll_ecb.c +++ b/vendor/openssl/openssl/crypto/camellia/cmll_ecb.c @@ -1,4 +1,4 @@ -/* crypto/camellia/camellia_ecb.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/camellia/camellia_ecb.c */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/camellia/cmll_locl.h b/vendor/openssl/openssl/crypto/camellia/cmll_locl.h index 4e4707b62..2bd79b8c4 100644 --- a/vendor/openssl/openssl/crypto/camellia/cmll_locl.h +++ b/vendor/openssl/openssl/crypto/camellia/cmll_locl.h @@ -1,4 +1,4 @@ -/* crypto/camellia/camellia_locl.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/camellia/camellia_locl.h */ /* ==================================================================== * Copyright 2006 NTT (Nippon Telegraph and Telephone Corporation) . * ALL RIGHTS RESERVED. diff --git a/vendor/openssl/openssl/crypto/camellia/cmll_misc.c b/vendor/openssl/openssl/crypto/camellia/cmll_misc.c index cbd250227..694d2fac8 100644 --- a/vendor/openssl/openssl/crypto/camellia/cmll_misc.c +++ b/vendor/openssl/openssl/crypto/camellia/cmll_misc.c @@ -1,4 +1,4 @@ -/* crypto/camellia/camellia_misc.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/camellia/camellia_misc.c */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/camellia/cmll_ofb.c b/vendor/openssl/openssl/crypto/camellia/cmll_ofb.c index 46c3ae2af..85eb89215 100644 --- a/vendor/openssl/openssl/crypto/camellia/cmll_ofb.c +++ b/vendor/openssl/openssl/crypto/camellia/cmll_ofb.c @@ -1,4 +1,4 @@ -/* crypto/camellia/camellia_ofb.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/camellia/camellia_ofb.c */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/camellia/cmll_utl.c b/vendor/openssl/openssl/crypto/camellia/cmll_utl.c index d19ee1931..d5eb6b4d6 100644 --- a/vendor/openssl/openssl/crypto/camellia/cmll_utl.c +++ b/vendor/openssl/openssl/crypto/camellia/cmll_utl.c @@ -1,4 +1,4 @@ -/* crypto/camellia/cmll_utl.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/camellia/cmll_utl.c */ /* ==================================================================== * Copyright (c) 2011 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/cmac/cmac.c b/vendor/openssl/openssl/crypto/cmac/cmac.c index 774e6dc91..2954b6eb7 100644 --- a/vendor/openssl/openssl/crypto/cmac/cmac.c +++ b/vendor/openssl/openssl/crypto/cmac/cmac.c @@ -160,6 +160,14 @@ int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, EVPerr(EVP_F_CMAC_INIT, EVP_R_DISABLED_FOR_FIPS); return 0; } + + /* Switch to FIPS cipher implementation if possible */ + if (cipher != NULL) { + const EVP_CIPHER *fcipher; + fcipher = FIPS_get_cipherbynid(EVP_CIPHER_nid(cipher)); + if (fcipher != NULL) + cipher = fcipher; + } /* * Other algorithm blocking will be done in FIPS_cmac_init, via * FIPS_cipherinit(). diff --git a/vendor/openssl/openssl/crypto/comp/comp.h b/vendor/openssl/openssl/crypto/comp/comp.h index 406c428aa..60a073404 100644 --- a/vendor/openssl/openssl/crypto/comp/comp.h +++ b/vendor/openssl/openssl/crypto/comp/comp.h @@ -4,6 +4,10 @@ # include +# ifdef OPENSSL_NO_COMP +# error COMP is disabled. +# endif + #ifdef __cplusplus extern "C" { #endif diff --git a/vendor/openssl/openssl/crypto/cryptlib.c b/vendor/openssl/openssl/crypto/cryptlib.c index c9f674ba8..1925428f5 100644 --- a/vendor/openssl/openssl/crypto/cryptlib.c +++ b/vendor/openssl/openssl/crypto/cryptlib.c @@ -1016,11 +1016,11 @@ void *OPENSSL_stderr(void) return stderr; } -int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len) +int CRYPTO_memcmp(const volatile void *in_a, const volatile void *in_b, size_t len) { size_t i; - const unsigned char *a = in_a; - const unsigned char *b = in_b; + const volatile unsigned char *a = in_a; + const volatile unsigned char *b = in_b; unsigned char x = 0; for (i = 0; i < len; i++) diff --git a/vendor/openssl/openssl/crypto/crypto.h b/vendor/openssl/openssl/crypto/crypto.h index c450d7a3c..6c644ce12 100644 --- a/vendor/openssl/openssl/crypto/crypto.h +++ b/vendor/openssl/openssl/crypto/crypto.h @@ -628,7 +628,7 @@ void OPENSSL_init(void); * into a defined order as the return value when a != b is undefined, other * than to be non-zero. */ -int CRYPTO_memcmp(const void *a, const void *b, size_t len); +int CRYPTO_memcmp(const volatile void *a, const volatile void *b, size_t len); /* BEGIN ERROR CODES */ /* diff --git a/vendor/openssl/openssl/crypto/des/des_old.c b/vendor/openssl/openssl/crypto/des/des_old.c index 54b0968e6..c5c5a00f0 100644 --- a/vendor/openssl/openssl/crypto/des/des_old.c +++ b/vendor/openssl/openssl/crypto/des/des_old.c @@ -1,4 +1,4 @@ -/* crypto/des/des_old.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/des/des_old.c */ /*- * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING diff --git a/vendor/openssl/openssl/crypto/des/des_old.h b/vendor/openssl/openssl/crypto/des/des_old.h index f1e1e2cb0..ee7607a24 100644 --- a/vendor/openssl/openssl/crypto/des/des_old.h +++ b/vendor/openssl/openssl/crypto/des/des_old.h @@ -1,4 +1,4 @@ -/* crypto/des/des_old.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/des/des_old.h */ /*- * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING diff --git a/vendor/openssl/openssl/crypto/des/des_old2.c b/vendor/openssl/openssl/crypto/des/des_old2.c index f7d28a671..247ff8dcf 100644 --- a/vendor/openssl/openssl/crypto/des/des_old2.c +++ b/vendor/openssl/openssl/crypto/des/des_old2.c @@ -1,4 +1,4 @@ -/* crypto/des/des_old.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/des/des_old.c */ /* * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING The diff --git a/vendor/openssl/openssl/crypto/dh/dh.h b/vendor/openssl/openssl/crypto/dh/dh.h index b17767328..a5bd9016a 100644 --- a/vendor/openssl/openssl/crypto/dh/dh.h +++ b/vendor/openssl/openssl/crypto/dh/dh.h @@ -174,6 +174,7 @@ struct dh_st { /* DH_check_pub_key error codes */ # define DH_CHECK_PUBKEY_TOO_SMALL 0x01 # define DH_CHECK_PUBKEY_TOO_LARGE 0x02 +# define DH_CHECK_PUBKEY_INVALID 0x04 /* * primes p where (p-1)/2 is prime too are called "safe"; we define this for diff --git a/vendor/openssl/openssl/crypto/dh/dh_check.c b/vendor/openssl/openssl/crypto/dh/dh_check.c index 347467c6a..027704111 100644 --- a/vendor/openssl/openssl/crypto/dh/dh_check.c +++ b/vendor/openssl/openssl/crypto/dh/dh_check.c @@ -151,23 +151,37 @@ int DH_check(const DH *dh, int *ret) int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret) { int ok = 0; - BIGNUM *q = NULL; + BIGNUM *tmp = NULL; + BN_CTX *ctx = NULL; *ret = 0; - q = BN_new(); - if (q == NULL) + ctx = BN_CTX_new(); + if (ctx == NULL) goto err; - BN_set_word(q, 1); - if (BN_cmp(pub_key, q) <= 0) + BN_CTX_start(ctx); + tmp = BN_CTX_get(ctx); + if (tmp == NULL || !BN_set_word(tmp, 1)) + goto err; + if (BN_cmp(pub_key, tmp) <= 0) *ret |= DH_CHECK_PUBKEY_TOO_SMALL; - BN_copy(q, dh->p); - BN_sub_word(q, 1); - if (BN_cmp(pub_key, q) >= 0) + if (BN_copy(tmp, dh->p) == NULL || !BN_sub_word(tmp, 1)) + goto err; + if (BN_cmp(pub_key, tmp) >= 0) *ret |= DH_CHECK_PUBKEY_TOO_LARGE; + if (dh->q != NULL) { + /* Check pub_key^q == 1 mod p */ + if (!BN_mod_exp(tmp, pub_key, dh->q, dh->p, ctx)) + goto err; + if (!BN_is_one(tmp)) + *ret |= DH_CHECK_PUBKEY_INVALID; + } + ok = 1; err: - if (q != NULL) - BN_free(q); + if (ctx != NULL) { + BN_CTX_end(ctx); + BN_CTX_free(ctx); + } return (ok); } diff --git a/vendor/openssl/openssl/crypto/dh/dhtest.c b/vendor/openssl/openssl/crypto/dh/dhtest.c index 6fe8ff4c0..c5d3d87ea 100644 --- a/vendor/openssl/openssl/crypto/dh/dhtest.c +++ b/vendor/openssl/openssl/crypto/dh/dhtest.c @@ -471,6 +471,31 @@ static const unsigned char dhtest_2048_256_Z[] = { 0xC2, 0x6C, 0x5D, 0x7C }; +static const unsigned char dhtest_rfc5114_2048_224_bad_y[] = { + 0x45, 0x32, 0x5F, 0x51, 0x07, 0xE5, 0xDF, 0x1C, 0xD6, 0x02, 0x82, 0xB3, + 0x32, 0x8F, 0xA4, 0x0F, 0x87, 0xB8, 0x41, 0xFE, 0xB9, 0x35, 0xDE, 0xAD, + 0xC6, 0x26, 0x85, 0xB4, 0xFF, 0x94, 0x8C, 0x12, 0x4C, 0xBF, 0x5B, 0x20, + 0xC4, 0x46, 0xA3, 0x26, 0xEB, 0xA4, 0x25, 0xB7, 0x68, 0x8E, 0xCC, 0x67, + 0xBA, 0xEA, 0x58, 0xD0, 0xF2, 0xE9, 0xD2, 0x24, 0x72, 0x60, 0xDA, 0x88, + 0x18, 0x9C, 0xE0, 0x31, 0x6A, 0xAD, 0x50, 0x6D, 0x94, 0x35, 0x8B, 0x83, + 0x4A, 0x6E, 0xFA, 0x48, 0x73, 0x0F, 0x83, 0x87, 0xFF, 0x6B, 0x66, 0x1F, + 0xA8, 0x82, 0xC6, 0x01, 0xE5, 0x80, 0xB5, 0xB0, 0x52, 0xD0, 0xE9, 0xD8, + 0x72, 0xF9, 0x7D, 0x5B, 0x8B, 0xA5, 0x4C, 0xA5, 0x25, 0x95, 0x74, 0xE2, + 0x7A, 0x61, 0x4E, 0xA7, 0x8F, 0x12, 0xE2, 0xD2, 0x9D, 0x8C, 0x02, 0x70, + 0x34, 0x44, 0x32, 0xC7, 0xB2, 0xF3, 0xB9, 0xFE, 0x17, 0x2B, 0xD6, 0x1F, + 0x8B, 0x7E, 0x4A, 0xFA, 0xA3, 0xB5, 0x3E, 0x7A, 0x81, 0x9A, 0x33, 0x66, + 0x62, 0xA4, 0x50, 0x18, 0x3E, 0xA2, 0x5F, 0x00, 0x07, 0xD8, 0x9B, 0x22, + 0xE4, 0xEC, 0x84, 0xD5, 0xEB, 0x5A, 0xF3, 0x2A, 0x31, 0x23, 0xD8, 0x44, + 0x22, 0x2A, 0x8B, 0x37, 0x44, 0xCC, 0xC6, 0x87, 0x4B, 0xBE, 0x50, 0x9D, + 0x4A, 0xC4, 0x8E, 0x45, 0xCF, 0x72, 0x4D, 0xC0, 0x89, 0xB3, 0x72, 0xED, + 0x33, 0x2C, 0xBC, 0x7F, 0x16, 0x39, 0x3B, 0xEB, 0xD2, 0xDD, 0xA8, 0x01, + 0x73, 0x84, 0x62, 0xB9, 0x29, 0xD2, 0xC9, 0x51, 0x32, 0x9E, 0x7A, 0x6A, + 0xCF, 0xC1, 0x0A, 0xDB, 0x0E, 0xE0, 0x62, 0x77, 0x6F, 0x59, 0x62, 0x72, + 0x5A, 0x69, 0xA6, 0x5B, 0x70, 0xCA, 0x65, 0xC4, 0x95, 0x6F, 0x9A, 0xC2, + 0xDF, 0x72, 0x6D, 0xB1, 0x1E, 0x54, 0x7B, 0x51, 0xB4, 0xEF, 0x7F, 0x89, + 0x93, 0x74, 0x89, 0x59 +}; + typedef struct { DH *(*get_param) (void); const unsigned char *xA; @@ -503,10 +528,15 @@ static const rfc5114_td rfctd[] = { static int run_rfc5114_tests(void) { int i; + DH *dhA = NULL; + DH *dhB = NULL; + unsigned char *Z1 = NULL; + unsigned char *Z2 = NULL; + const rfc5114_td *td = NULL; + BIGNUM *bady = NULL; + for (i = 0; i < (int)(sizeof(rfctd) / sizeof(rfc5114_td)); i++) { - DH *dhA, *dhB; - unsigned char *Z1 = NULL, *Z2 = NULL; - const rfc5114_td *td = rfctd + i; + td = rfctd + i; /* Set up DH structures setting key components */ dhA = td->get_param(); dhB = td->get_param(); @@ -549,14 +579,63 @@ static int run_rfc5114_tests(void) DH_free(dhB); OPENSSL_free(Z1); OPENSSL_free(Z2); + dhA = NULL; + dhB = NULL; + Z1 = NULL; + Z2 = NULL; + } + /* Now i == OSSL_NELEM(rfctd) */ + /* RFC5114 uses unsafe primes, so now test an invalid y value */ + dhA = DH_get_2048_224(); + if (dhA == NULL) + goto bad_err; + Z1 = OPENSSL_malloc(DH_size(dhA)); + if (Z1 == NULL) + goto bad_err; + + bady = BN_bin2bn(dhtest_rfc5114_2048_224_bad_y, + sizeof(dhtest_rfc5114_2048_224_bad_y), NULL); + if (bady == NULL) + goto bad_err; + + if (!DH_generate_key(dhA)) + goto bad_err; + + if (DH_compute_key(Z1, bady, dhA) != -1) { + /* + * DH_compute_key should fail with -1. If we get here we unexpectedly + * allowed an invalid y value + */ + goto err; } + /* We'll have a stale error on the queue from the above test so clear it */ + ERR_clear_error(); + + printf("RFC5114 parameter test %d OK\n", i + 1); + + BN_free(bady); + DH_free(dhA); + OPENSSL_free(Z1); + return 1; bad_err: + BN_free(bady); + DH_free(dhA); + DH_free(dhB); + OPENSSL_free(Z1); + OPENSSL_free(Z2); + fprintf(stderr, "Initalisation error RFC5114 set %d\n", i + 1); ERR_print_errors_fp(stderr); return 0; err: + BN_free(bady); + DH_free(dhA); + DH_free(dhB); + OPENSSL_free(Z1); + OPENSSL_free(Z2); + fprintf(stderr, "Test failed RFC5114 set %d\n", i + 1); return 0; } diff --git a/vendor/openssl/openssl/crypto/dsa/dsa_ameth.c b/vendor/openssl/openssl/crypto/dsa/dsa_ameth.c index c40e1777a..cc83d6e6a 100644 --- a/vendor/openssl/openssl/crypto/dsa/dsa_ameth.c +++ b/vendor/openssl/openssl/crypto/dsa/dsa_ameth.c @@ -191,6 +191,8 @@ static int dsa_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8) STACK_OF(ASN1_TYPE) *ndsa = NULL; DSA *dsa = NULL; + int ret = 0; + if (!PKCS8_pkey_get0(NULL, &p, &pklen, &palg, p8)) return 0; X509_ALGOR_get0(NULL, &ptype, &pval, palg); @@ -262,23 +264,21 @@ static int dsa_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8) } EVP_PKEY_assign_DSA(pkey, dsa); - BN_CTX_free(ctx); - if (ndsa) - sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); - else - ASN1_STRING_clear_free(privkey); - return 1; + ret = 1; + goto done; decerr: - DSAerr(DSA_F_DSA_PRIV_DECODE, EVP_R_DECODE_ERROR); + DSAerr(DSA_F_DSA_PRIV_DECODE, DSA_R_DECODE_ERROR); dsaerr: + DSA_free(dsa); + done: BN_CTX_free(ctx); - if (privkey) + if (ndsa) + sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); + else ASN1_STRING_clear_free(privkey); - sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); - DSA_free(dsa); - return 0; + return ret; } static int dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) diff --git a/vendor/openssl/openssl/crypto/dsa/dsa_ossl.c b/vendor/openssl/openssl/crypto/dsa/dsa_ossl.c index f0ec8faa8..efc4f1b6a 100644 --- a/vendor/openssl/openssl/crypto/dsa/dsa_ossl.c +++ b/vendor/openssl/openssl/crypto/dsa/dsa_ossl.c @@ -187,9 +187,6 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) if (!BN_mod_mul(s, s, kinv, dsa->q, ctx)) goto err; - ret = DSA_SIG_new(); - if (ret == NULL) - goto err; /* * Redo if r or s is zero as required by FIPS 186-3: this is very * unlikely. @@ -201,11 +198,14 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) } goto redo; } + ret = DSA_SIG_new(); + if (ret == NULL) + goto err; ret->r = r; ret->s = s; err: - if (!ret) { + if (ret == NULL) { DSAerr(DSA_F_DSA_DO_SIGN, reason); BN_free(r); BN_free(s); diff --git a/vendor/openssl/openssl/crypto/dso/dso.h b/vendor/openssl/openssl/crypto/dso/dso.h index 7c4a1dc4a..c9013f5ce 100644 --- a/vendor/openssl/openssl/crypto/dso/dso.h +++ b/vendor/openssl/openssl/crypto/dso/dso.h @@ -1,4 +1,4 @@ -/* dso.h -*- mode:C; c-file-style: "eay" -*- */ +/* dso.h */ /* * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project * 2000. diff --git a/vendor/openssl/openssl/crypto/dso/dso_dl.c b/vendor/openssl/openssl/crypto/dso/dso_dl.c index 0087ac54a..ceedf66e8 100644 --- a/vendor/openssl/openssl/crypto/dso/dso_dl.c +++ b/vendor/openssl/openssl/crypto/dso/dso_dl.c @@ -1,4 +1,4 @@ -/* dso_dl.c -*- mode:C; c-file-style: "eay" -*- */ +/* dso_dl.c */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2000. diff --git a/vendor/openssl/openssl/crypto/dso/dso_dlfcn.c b/vendor/openssl/openssl/crypto/dso/dso_dlfcn.c index f629f0380..78df723ff 100644 --- a/vendor/openssl/openssl/crypto/dso/dso_dlfcn.c +++ b/vendor/openssl/openssl/crypto/dso/dso_dlfcn.c @@ -1,4 +1,4 @@ -/* dso_dlfcn.c -*- mode:C; c-file-style: "eay" -*- */ +/* dso_dlfcn.c */ /* * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project * 2000. diff --git a/vendor/openssl/openssl/crypto/dso/dso_lib.c b/vendor/openssl/openssl/crypto/dso/dso_lib.c index 09b8eafcc..2beb7c1ba 100644 --- a/vendor/openssl/openssl/crypto/dso/dso_lib.c +++ b/vendor/openssl/openssl/crypto/dso/dso_lib.c @@ -1,4 +1,4 @@ -/* dso_lib.c -*- mode:C; c-file-style: "eay" -*- */ +/* dso_lib.c */ /* * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project * 2000. @@ -122,6 +122,7 @@ DSO *DSO_new_method(DSO_METHOD *meth) ret->meth = meth; ret->references = 1; if ((ret->meth->init != NULL) && !ret->meth->init(ret)) { + sk_void_free(ret->meth_data); OPENSSL_free(ret); ret = NULL; } diff --git a/vendor/openssl/openssl/crypto/dso/dso_vms.c b/vendor/openssl/openssl/crypto/dso/dso_vms.c index d0794b8fb..1efd84b94 100644 --- a/vendor/openssl/openssl/crypto/dso/dso_vms.c +++ b/vendor/openssl/openssl/crypto/dso/dso_vms.c @@ -1,4 +1,4 @@ -/* dso_vms.c -*- mode:C; c-file-style: "eay" -*- */ +/* dso_vms.c */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2000. diff --git a/vendor/openssl/openssl/crypto/dso/dso_win32.c b/vendor/openssl/openssl/crypto/dso/dso_win32.c index c65234e9c..706e754a3 100644 --- a/vendor/openssl/openssl/crypto/dso/dso_win32.c +++ b/vendor/openssl/openssl/crypto/dso/dso_win32.c @@ -1,4 +1,4 @@ -/* dso_win32.c -*- mode:C; c-file-style: "eay" -*- */ +/* dso_win32.c */ /* * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project * 2000. diff --git a/vendor/openssl/openssl/crypto/ec/asm/ecp_nistz256-x86_64.pl b/vendor/openssl/openssl/crypto/ec/asm/ecp_nistz256-x86_64.pl index 648c969be..7140860e2 100755 --- a/vendor/openssl/openssl/crypto/ec/asm/ecp_nistz256-x86_64.pl +++ b/vendor/openssl/openssl/crypto/ec/asm/ecp_nistz256-x86_64.pl @@ -81,7 +81,7 @@ $addx = ($1>=12); } -if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([3-9])\.([0-9]+)/) { +if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9])\.([0-9]+)/) { my $ver = $2 + $3/100.0; # 3.1->3.01, 3.10->3.10 $avx = ($ver>=3.0) + ($ver>=3.01); $addx = ($ver>=3.03); @@ -2001,6 +2001,7 @@ () push %r15 sub \$32*5+8, %rsp +.Lpoint_double_shortcut$x: movdqu 0x00($a_ptr), %xmm0 # copy *(P256_POINT *)$a_ptr.x mov $a_ptr, $b_ptr # backup copy movdqu 0x10($a_ptr), %xmm1 @@ -2291,6 +2292,7 @@ () mov 0x40+8*1($b_ptr), $acc6 mov 0x40+8*2($b_ptr), $acc7 mov 0x40+8*3($b_ptr), $acc0 + movq $b_ptr, %xmm1 lea 0x40-$bias($b_ptr), $a_ptr lea $Z1sqr(%rsp), $r_ptr # Z1^2 @@ -2346,7 +2348,7 @@ () test $acc0, $acc0 jnz .Ladd_proceed$x # (in1infty || in2infty)? test $acc1, $acc1 - jz .Ladd_proceed$x # is_equal(S1,S2)? + jz .Ladd_double$x # is_equal(S1,S2)? movq %xmm0, $r_ptr # restore $r_ptr pxor %xmm0, %xmm0 @@ -2358,6 +2360,13 @@ () movdqu %xmm0, 0x50($r_ptr) jmp .Ladd_done$x +.align 32 +.Ladd_double$x: + movq %xmm1, $a_ptr # restore $a_ptr + movq %xmm0, $r_ptr # restore $r_ptr + add \$`32*(18-5)`, %rsp # difference in frame sizes + jmp .Lpoint_double_shortcut$x + .align 32 .Ladd_proceed$x: `&load_for_sqr("$R(%rsp)", "$src0")` diff --git a/vendor/openssl/openssl/crypto/ec/ec2_smpl.c b/vendor/openssl/openssl/crypto/ec/ec2_smpl.c index 077c7fc8d..5b27b91fc 100644 --- a/vendor/openssl/openssl/crypto/ec/ec2_smpl.c +++ b/vendor/openssl/openssl/crypto/ec/ec2_smpl.c @@ -746,6 +746,7 @@ int ec_GF2m_simple_make_affine(const EC_GROUP *group, EC_POINT *point, goto err; if (!BN_one(&point->Z)) goto err; + point->Z_is_one = 1; ret = 1; diff --git a/vendor/openssl/openssl/crypto/ec/ec_key.c b/vendor/openssl/openssl/crypto/ec/ec_key.c index c784b6fd3..bc94ab566 100644 --- a/vendor/openssl/openssl/crypto/ec/ec_key.c +++ b/vendor/openssl/openssl/crypto/ec/ec_key.c @@ -387,6 +387,8 @@ int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, tx = BN_CTX_get(ctx); ty = BN_CTX_get(ctx); + if (ty == NULL) + goto err; #ifndef OPENSSL_NO_EC2M tmp_nid = EC_METHOD_get_field_type(EC_GROUP_method_of(key->group)); diff --git a/vendor/openssl/openssl/crypto/ec/ecp_nistp224.c b/vendor/openssl/openssl/crypto/ec/ecp_nistp224.c index ed09f97ad..d81cc9ce6 100644 --- a/vendor/openssl/openssl/crypto/ec/ecp_nistp224.c +++ b/vendor/openssl/openssl/crypto/ec/ecp_nistp224.c @@ -1657,8 +1657,7 @@ int ec_GFp_nistp224_precompute_mult(EC_GROUP *group, BN_CTX *ctx) */ if (0 == EC_POINT_cmp(group, generator, group->generator, ctx)) { memcpy(pre->g_pre_comp, gmul, sizeof(pre->g_pre_comp)); - ret = 1; - goto err; + goto done; } if ((!BN_to_felem(pre->g_pre_comp[0][1][0], &group->generator->X)) || (!BN_to_felem(pre->g_pre_comp[0][1][1], &group->generator->Y)) || @@ -1736,6 +1735,7 @@ int ec_GFp_nistp224_precompute_mult(EC_GROUP *group, BN_CTX *ctx) } make_points_affine(31, &(pre->g_pre_comp[0][1]), tmp_felems); + done: if (!EC_EX_DATA_set_data(&group->extra_data, pre, nistp224_pre_comp_dup, nistp224_pre_comp_free, nistp224_pre_comp_clear_free)) diff --git a/vendor/openssl/openssl/crypto/ec/ecp_nistp256.c b/vendor/openssl/openssl/crypto/ec/ecp_nistp256.c index a5887086c..78d191aac 100644 --- a/vendor/openssl/openssl/crypto/ec/ecp_nistp256.c +++ b/vendor/openssl/openssl/crypto/ec/ecp_nistp256.c @@ -2249,8 +2249,7 @@ int ec_GFp_nistp256_precompute_mult(EC_GROUP *group, BN_CTX *ctx) */ if (0 == EC_POINT_cmp(group, generator, group->generator, ctx)) { memcpy(pre->g_pre_comp, gmul, sizeof(pre->g_pre_comp)); - ret = 1; - goto err; + goto done; } if ((!BN_to_felem(x_tmp, &group->generator->X)) || (!BN_to_felem(y_tmp, &group->generator->Y)) || @@ -2337,6 +2336,7 @@ int ec_GFp_nistp256_precompute_mult(EC_GROUP *group, BN_CTX *ctx) } make_points_affine(31, &(pre->g_pre_comp[0][1]), tmp_smallfelems); + done: if (!EC_EX_DATA_set_data(&group->extra_data, pre, nistp256_pre_comp_dup, nistp256_pre_comp_free, nistp256_pre_comp_clear_free)) diff --git a/vendor/openssl/openssl/crypto/ec/ecp_nistp521.c b/vendor/openssl/openssl/crypto/ec/ecp_nistp521.c index 360b9a351..c53a61bbf 100644 --- a/vendor/openssl/openssl/crypto/ec/ecp_nistp521.c +++ b/vendor/openssl/openssl/crypto/ec/ecp_nistp521.c @@ -2056,8 +2056,7 @@ int ec_GFp_nistp521_precompute_mult(EC_GROUP *group, BN_CTX *ctx) */ if (0 == EC_POINT_cmp(group, generator, group->generator, ctx)) { memcpy(pre->g_pre_comp, gmul, sizeof(pre->g_pre_comp)); - ret = 1; - goto err; + goto done; } if ((!BN_to_felem(pre->g_pre_comp[1][0], &group->generator->X)) || (!BN_to_felem(pre->g_pre_comp[1][1], &group->generator->Y)) || @@ -2115,6 +2114,7 @@ int ec_GFp_nistp521_precompute_mult(EC_GROUP *group, BN_CTX *ctx) } make_points_affine(15, &(pre->g_pre_comp[1]), tmp_felems); + done: if (!EC_EX_DATA_set_data(&group->extra_data, pre, nistp521_pre_comp_dup, nistp521_pre_comp_free, nistp521_pre_comp_clear_free)) diff --git a/vendor/openssl/openssl/crypto/ec/ecp_nistz256_table.c b/vendor/openssl/openssl/crypto/ec/ecp_nistz256_table.c index 216d024e0..2f0797db6 100644 --- a/vendor/openssl/openssl/crypto/ec/ecp_nistz256_table.c +++ b/vendor/openssl/openssl/crypto/ec/ecp_nistz256_table.c @@ -17,7 +17,7 @@ __attribute((aligned(4096))) #elif defined(_MSC_VER) __declspec(align(4096)) #elif defined(__SUNPRO_C) -# pragma align 4096(ecp_nistz256_precomputed) +# pragma align 64(ecp_nistz256_precomputed) #endif static const BN_ULONG ecp_nistz256_precomputed[37][64 * sizeof(P256_POINT_AFFINE) / diff --git a/vendor/openssl/openssl/crypto/ec/ectest.c b/vendor/openssl/openssl/crypto/ec/ectest.c index fede530bc..40a1f0032 100644 --- a/vendor/openssl/openssl/crypto/ec/ectest.c +++ b/vendor/openssl/openssl/crypto/ec/ectest.c @@ -1591,7 +1591,7 @@ struct nistp_test_params { int degree; /* * Qx, Qy and D are taken from - * http://csrcdocut.gov/groups/ST/toolkit/documents/Examples/ECDSA_Prime.pdf + * http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/ECDSA_Prime.pdf * Otherwise, values are standard curve parameters from FIPS 180-3 */ const char *p, *a, *b, *Qx, *Qy, *Gx, *Gy, *order, *d; @@ -1758,9 +1758,18 @@ static void nistp_single_test(const struct nistp_test_params *test) if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT; + /* + * We have not performed precomputation so have_precompute mult should be + * false + */ + if (EC_GROUP_have_precompute_mult(NISTP)) + ABORT; + /* now repeat all tests with precomputation */ if (!EC_GROUP_precompute_mult(NISTP, ctx)) ABORT; + if (!EC_GROUP_have_precompute_mult(NISTP)) + ABORT; /* fixed point multiplication */ EC_POINT_mul(NISTP, Q, m, NULL, NULL, ctx); diff --git a/vendor/openssl/openssl/crypto/engine/eng_all.c b/vendor/openssl/openssl/crypto/engine/eng_all.c index 195a3a955..48ad0d26b 100644 --- a/vendor/openssl/openssl/crypto/engine/eng_all.c +++ b/vendor/openssl/openssl/crypto/engine/eng_all.c @@ -1,4 +1,4 @@ -/* crypto/engine/eng_all.c -*- mode: C; c-file-style: "eay" -*- */ +/* crypto/engine/eng_all.c */ /* * Written by Richard Levitte for the OpenSSL project * 2000. diff --git a/vendor/openssl/openssl/crypto/engine/eng_dyn.c b/vendor/openssl/openssl/crypto/engine/eng_dyn.c index 3169b09ad..40f30e9d5 100644 --- a/vendor/openssl/openssl/crypto/engine/eng_dyn.c +++ b/vendor/openssl/openssl/crypto/engine/eng_dyn.c @@ -243,8 +243,10 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) * If we lost the race to set the context, c is non-NULL and *ctx is the * context of the thread that won. */ - if (c) + if (c) { + sk_OPENSSL_STRING_free(c->dirs); OPENSSL_free(c); + } return 1; } diff --git a/vendor/openssl/openssl/crypto/evp/Makefile b/vendor/openssl/openssl/crypto/evp/Makefile index aaaad986e..fa138d0b1 100644 --- a/vendor/openssl/openssl/crypto/evp/Makefile +++ b/vendor/openssl/openssl/crypto/evp/Makefile @@ -199,8 +199,8 @@ e_aes.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h e_aes.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h e_aes.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h e_aes.o: ../modes/modes_lcl.h e_aes.c evp_locl.h -e_aes_cbc_hmac_sha1.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h -e_aes_cbc_hmac_sha1.o: ../../include/openssl/bio.h +e_aes_cbc_hmac_sha1.o: ../../e_os.h ../../include/openssl/aes.h +e_aes_cbc_hmac_sha1.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h e_aes_cbc_hmac_sha1.o: ../../include/openssl/crypto.h e_aes_cbc_hmac_sha1.o: ../../include/openssl/e_os2.h e_aes_cbc_hmac_sha1.o: ../../include/openssl/evp.h @@ -214,9 +214,9 @@ e_aes_cbc_hmac_sha1.o: ../../include/openssl/rand.h e_aes_cbc_hmac_sha1.o: ../../include/openssl/safestack.h e_aes_cbc_hmac_sha1.o: ../../include/openssl/sha.h e_aes_cbc_hmac_sha1.o: ../../include/openssl/stack.h -e_aes_cbc_hmac_sha1.o: ../../include/openssl/symhacks.h ../modes/modes_lcl.h -e_aes_cbc_hmac_sha1.o: e_aes_cbc_hmac_sha1.c -e_aes_cbc_hmac_sha256.o: ../../include/openssl/aes.h +e_aes_cbc_hmac_sha1.o: ../../include/openssl/symhacks.h ../constant_time_locl.h +e_aes_cbc_hmac_sha1.o: ../modes/modes_lcl.h e_aes_cbc_hmac_sha1.c +e_aes_cbc_hmac_sha256.o: ../../e_os.h ../../include/openssl/aes.h e_aes_cbc_hmac_sha256.o: ../../include/openssl/asn1.h e_aes_cbc_hmac_sha256.o: ../../include/openssl/bio.h e_aes_cbc_hmac_sha256.o: ../../include/openssl/crypto.h @@ -232,7 +232,8 @@ e_aes_cbc_hmac_sha256.o: ../../include/openssl/rand.h e_aes_cbc_hmac_sha256.o: ../../include/openssl/safestack.h e_aes_cbc_hmac_sha256.o: ../../include/openssl/sha.h e_aes_cbc_hmac_sha256.o: ../../include/openssl/stack.h -e_aes_cbc_hmac_sha256.o: ../../include/openssl/symhacks.h ../modes/modes_lcl.h +e_aes_cbc_hmac_sha256.o: ../../include/openssl/symhacks.h +e_aes_cbc_hmac_sha256.o: ../constant_time_locl.h ../modes/modes_lcl.h e_aes_cbc_hmac_sha256.o: e_aes_cbc_hmac_sha256.c e_bf.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h e_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/buffer.h diff --git a/vendor/openssl/openssl/crypto/evp/digest.c b/vendor/openssl/openssl/crypto/evp/digest.c index f2643f324..5b642b23f 100644 --- a/vendor/openssl/openssl/crypto/evp/digest.c +++ b/vendor/openssl/openssl/crypto/evp/digest.c @@ -212,8 +212,10 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) } #endif if (ctx->digest != type) { - if (ctx->digest && ctx->digest->ctx_size) + if (ctx->digest && ctx->digest->ctx_size) { OPENSSL_free(ctx->md_data); + ctx->md_data = NULL; + } ctx->digest = type; if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size) { ctx->update = type->update; diff --git a/vendor/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c b/vendor/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c index 8330964ee..6dfd590a4 100644 --- a/vendor/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c +++ b/vendor/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c @@ -60,6 +60,7 @@ # include # include # include "modes_lcl.h" +# include "constant_time_locl.h" # ifndef EVP_CIPH_FLAG_AEAD_CIPHER # define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000 @@ -578,6 +579,8 @@ static int aesni_cbc_hmac_sha1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, maxpad |= (255 - maxpad) >> (sizeof(maxpad) * 8 - 8); maxpad &= 255; + ret &= constant_time_ge(maxpad, pad); + inp_len = len - (SHA_DIGEST_LENGTH + pad + 1); mask = (0 - ((inp_len - len) >> (sizeof(inp_len) * 8 - 1))); inp_len &= mask; diff --git a/vendor/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c b/vendor/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c index 37800213c..46c9d0338 100644 --- a/vendor/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c +++ b/vendor/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c @@ -60,6 +60,7 @@ # include # include # include "modes_lcl.h" +# include "constant_time_locl.h" # ifndef EVP_CIPH_FLAG_AEAD_CIPHER # define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000 @@ -589,6 +590,8 @@ static int aesni_cbc_hmac_sha256_cipher(EVP_CIPHER_CTX *ctx, maxpad |= (255 - maxpad) >> (sizeof(maxpad) * 8 - 8); maxpad &= 255; + ret &= constant_time_ge(maxpad, pad); + inp_len = len - (SHA256_DIGEST_LENGTH + pad + 1); mask = (0 - ((inp_len - len) >> (sizeof(inp_len) * 8 - 1))); inp_len &= mask; diff --git a/vendor/openssl/openssl/crypto/evp/e_camellia.c b/vendor/openssl/openssl/crypto/evp/e_camellia.c index f9c840136..f273f9c94 100644 --- a/vendor/openssl/openssl/crypto/evp/e_camellia.c +++ b/vendor/openssl/openssl/crypto/evp/e_camellia.c @@ -1,4 +1,4 @@ -/* crypto/evp/e_camellia.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/evp/e_camellia.c */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/evp/e_des.c b/vendor/openssl/openssl/crypto/evp/e_des.c index aae13a675..8ca65cd03 100644 --- a/vendor/openssl/openssl/crypto/evp/e_des.c +++ b/vendor/openssl/openssl/crypto/evp/e_des.c @@ -71,12 +71,13 @@ typedef struct { DES_key_schedule ks; } ks; union { - void (*cbc) (const void *, void *, size_t, const void *, void *); + void (*cbc) (const void *, void *, size_t, + const DES_key_schedule *, unsigned char *); } stream; } EVP_DES_KEY; # if defined(AES_ASM) && (defined(__sparc) || defined(__sparc__)) -/* ---------^^^ this is not a typo, just a way to detect that +/* ----------^^^ this is not a typo, just a way to detect that * assembler support was in general requested... */ # include "sparc_arch.h" @@ -86,9 +87,9 @@ extern unsigned int OPENSSL_sparcv9cap_P[]; void des_t4_key_expand(const void *key, DES_key_schedule *ks); void des_t4_cbc_encrypt(const void *inp, void *out, size_t len, - DES_key_schedule *ks, unsigned char iv[8]); + const DES_key_schedule *ks, unsigned char iv[8]); void des_t4_cbc_decrypt(const void *inp, void *out, size_t len, - DES_key_schedule *ks, unsigned char iv[8]); + const DES_key_schedule *ks, unsigned char iv[8]); # endif static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, @@ -130,7 +131,7 @@ static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, { EVP_DES_KEY *dat = (EVP_DES_KEY *) ctx->cipher_data; - if (dat->stream.cbc) { + if (dat->stream.cbc != NULL) { (*dat->stream.cbc) (in, out, inl, &dat->ks.ks, ctx->iv); return 1; } diff --git a/vendor/openssl/openssl/crypto/evp/e_des3.c b/vendor/openssl/openssl/crypto/evp/e_des3.c index bf6c1d2d3..0e910d6d8 100644 --- a/vendor/openssl/openssl/crypto/evp/e_des3.c +++ b/vendor/openssl/openssl/crypto/evp/e_des3.c @@ -75,7 +75,8 @@ typedef struct { DES_key_schedule ks[3]; } ks; union { - void (*cbc) (const void *, void *, size_t, const void *, void *); + void (*cbc) (const void *, void *, size_t, + const DES_key_schedule *, unsigned char *); } stream; } DES_EDE_KEY; # define ks1 ks.ks[0] @@ -93,9 +94,9 @@ extern unsigned int OPENSSL_sparcv9cap_P[]; void des_t4_key_expand(const void *key, DES_key_schedule *ks); void des_t4_ede3_cbc_encrypt(const void *inp, void *out, size_t len, - DES_key_schedule *ks, unsigned char iv[8]); + const DES_key_schedule ks[3], unsigned char iv[8]); void des_t4_ede3_cbc_decrypt(const void *inp, void *out, size_t len, - DES_key_schedule *ks, unsigned char iv[8]); + const DES_key_schedule ks[3], unsigned char iv[8]); # endif static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, @@ -162,7 +163,7 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, } # endif /* KSSL_DEBUG */ if (dat->stream.cbc) { - (*dat->stream.cbc) (in, out, inl, &dat->ks, ctx->iv); + (*dat->stream.cbc) (in, out, inl, dat->ks.ks, ctx->iv); return 1; } @@ -395,7 +396,7 @@ static int des_ede3_unwrap(EVP_CIPHER_CTX *ctx, unsigned char *out, int rv = -1; if (inl < 24) return -1; - if (!out) + if (out == NULL) return inl - 16; memcpy(ctx->iv, wrap_iv, 8); /* Decrypt first block which will end up as icv */ @@ -438,7 +439,7 @@ static int des_ede3_wrap(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { unsigned char sha1tmp[SHA_DIGEST_LENGTH]; - if (!out) + if (out == NULL) return inl + 16; /* Copy input to output buffer + 8 so we have space for IV */ memmove(out + 8, in, inl); diff --git a/vendor/openssl/openssl/crypto/evp/e_old.c b/vendor/openssl/openssl/crypto/evp/e_old.c index c93f5a548..a23d143b7 100644 --- a/vendor/openssl/openssl/crypto/evp/e_old.c +++ b/vendor/openssl/openssl/crypto/evp/e_old.c @@ -1,4 +1,4 @@ -/* crypto/evp/e_old.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/evp/e_old.c */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2004. diff --git a/vendor/openssl/openssl/crypto/evp/e_seed.c b/vendor/openssl/openssl/crypto/evp/e_seed.c index c948a8f39..7249d1b1e 100644 --- a/vendor/openssl/openssl/crypto/evp/e_seed.c +++ b/vendor/openssl/openssl/crypto/evp/e_seed.c @@ -1,4 +1,4 @@ -/* crypto/evp/e_seed.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/evp/e_seed.c */ /* ==================================================================== * Copyright (c) 2007 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/evp/encode.c b/vendor/openssl/openssl/crypto/evp/encode.c index c6abc4ae8..c6c775e0a 100644 --- a/vendor/openssl/openssl/crypto/evp/encode.c +++ b/vendor/openssl/openssl/crypto/evp/encode.c @@ -57,6 +57,7 @@ */ #include +#include #include "cryptlib.h" #include @@ -151,13 +152,13 @@ void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl) { int i, j; - unsigned int total = 0; + size_t total = 0; *outl = 0; if (inl <= 0) return; OPENSSL_assert(ctx->length <= (int)sizeof(ctx->enc_data)); - if ((ctx->num + inl) < ctx->length) { + if (ctx->length - ctx->num > inl) { memcpy(&(ctx->enc_data[ctx->num]), in, inl); ctx->num += inl; return; @@ -174,7 +175,7 @@ void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, *out = '\0'; total = j + 1; } - while (inl >= ctx->length) { + while (inl >= ctx->length && total <= INT_MAX) { j = EVP_EncodeBlock(out, in, ctx->length); in += ctx->length; inl -= ctx->length; @@ -183,6 +184,11 @@ void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, *out = '\0'; total += j + 1; } + if (total > INT_MAX) { + /* Too much output data! */ + *outl = 0; + return; + } if (inl != 0) memcpy(&(ctx->enc_data[0]), in, inl); ctx->num = inl; diff --git a/vendor/openssl/openssl/crypto/evp/evp_enc.c b/vendor/openssl/openssl/crypto/evp/evp_enc.c index 65f0e0244..7d7be245b 100644 --- a/vendor/openssl/openssl/crypto/evp/evp_enc.c +++ b/vendor/openssl/openssl/crypto/evp/evp_enc.c @@ -347,7 +347,7 @@ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, bl = ctx->cipher->block_size; OPENSSL_assert(bl <= (int)sizeof(ctx->buf)); if (i != 0) { - if (i + inl < bl) { + if (bl - i > inl) { memcpy(&(ctx->buf[i]), in, inl); ctx->buf_len += inl; *outl = 0; diff --git a/vendor/openssl/openssl/crypto/mem_clr.c b/vendor/openssl/openssl/crypto/mem_clr.c index 1a06636d0..ab85344ee 100644 --- a/vendor/openssl/openssl/crypto/mem_clr.c +++ b/vendor/openssl/openssl/crypto/mem_clr.c @@ -1,4 +1,4 @@ -/* crypto/mem_clr.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/mem_clr.c */ /* * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project * 2002. diff --git a/vendor/openssl/openssl/crypto/modes/asm/aesni-gcm-x86_64.pl b/vendor/openssl/openssl/crypto/modes/asm/aesni-gcm-x86_64.pl index 4be25571e..980cfd23e 100644 --- a/vendor/openssl/openssl/crypto/modes/asm/aesni-gcm-x86_64.pl +++ b/vendor/openssl/openssl/crypto/modes/asm/aesni-gcm-x86_64.pl @@ -43,7 +43,7 @@ if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1` =~ /GNU assembler version ([2-9]\.[0-9]+)/) { - $avx = ($1>=2.19) + ($1>=2.22); + $avx = ($1>=2.20) + ($1>=2.22); } if (!$avx && $win64 && ($flavour =~ /nasm/ || $ENV{ASM} =~ /nasm/) && @@ -56,7 +56,7 @@ $avx = ($1>=10) + ($1>=11); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([3-9]\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } @@ -489,7 +489,7 @@ ___ $code.=<<___ if ($win64); movaps -0xd8(%rax),%xmm6 - movaps -0xd8(%rax),%xmm7 + movaps -0xc8(%rax),%xmm7 movaps -0xb8(%rax),%xmm8 movaps -0xa8(%rax),%xmm9 movaps -0x98(%rax),%xmm10 diff --git a/vendor/openssl/openssl/crypto/modes/asm/ghash-s390x.pl b/vendor/openssl/openssl/crypto/modes/asm/ghash-s390x.pl index 39096b423..be7d55f74 100644 --- a/vendor/openssl/openssl/crypto/modes/asm/ghash-s390x.pl +++ b/vendor/openssl/openssl/crypto/modes/asm/ghash-s390x.pl @@ -85,9 +85,7 @@ tmhl %r0,0x4000 # check for message-security-assist jz .Lsoft_gmult lghi %r0,0 - la %r1,16($sp) - .long 0xb93e0004 # kimd %r0,%r4 - lg %r1,24($sp) + lg %r1,24(%r1) # load second word of kimd capabilities vector tmhh %r1,0x4000 # check for function 65 jz .Lsoft_gmult stg %r0,16($sp) # arrange 16 bytes of zero input diff --git a/vendor/openssl/openssl/crypto/modes/asm/ghash-x86_64.pl b/vendor/openssl/openssl/crypto/modes/asm/ghash-x86_64.pl index 0bcb6d4e0..f889f2018 100644 --- a/vendor/openssl/openssl/crypto/modes/asm/ghash-x86_64.pl +++ b/vendor/openssl/openssl/crypto/modes/asm/ghash-x86_64.pl @@ -92,7 +92,7 @@ if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1` =~ /GNU assembler version ([2-9]\.[0-9]+)/) { - $avx = ($1>=2.19) + ($1>=2.22); + $avx = ($1>=2.20) + ($1>=2.22); } if (!$avx && $win64 && ($flavour =~ /nasm/ || $ENV{ASM} =~ /nasm/) && @@ -105,7 +105,7 @@ $avx = ($1>=10) + ($1>=11); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([3-9]\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } diff --git a/vendor/openssl/openssl/crypto/modes/ctr128.c b/vendor/openssl/openssl/crypto/modes/ctr128.c index f3bbcbf72..bcafd6b6b 100644 --- a/vendor/openssl/openssl/crypto/modes/ctr128.c +++ b/vendor/openssl/openssl/crypto/modes/ctr128.c @@ -67,23 +67,20 @@ /* increment counter (128-bit int) by 1 */ static void ctr128_inc(unsigned char *counter) { - u32 n = 16; - u8 c; + u32 n = 16, c = 1; do { --n; - c = counter[n]; - ++c; - counter[n] = c; - if (c) - return; + c += counter[n]; + counter[n] = (u8)c; + c >>= 8; } while (n); } #if !defined(OPENSSL_SMALL_FOOTPRINT) static void ctr128_inc_aligned(unsigned char *counter) { - size_t *data, c, n; + size_t *data, c, d, n; const union { long one; char little; @@ -91,20 +88,19 @@ static void ctr128_inc_aligned(unsigned char *counter) 1 }; - if (is_endian.little) { + if (is_endian.little || ((size_t)counter % sizeof(size_t)) != 0) { ctr128_inc(counter); return; } data = (size_t *)counter; + c = 1; n = 16 / sizeof(size_t); do { --n; - c = data[n]; - ++c; - data[n] = c; - if (c) - return; + d = data[n] += c; + /* did addition carry? */ + c = ((d - c) ^ d) >> (sizeof(size_t) * 8 - 1); } while (n); } #endif @@ -144,14 +140,14 @@ void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, } # if defined(STRICT_ALIGNMENT) - if (((size_t)in | (size_t)out | (size_t)ivec) % sizeof(size_t) != - 0) + if (((size_t)in | (size_t)out | (size_t)ecount_buf) + % sizeof(size_t) != 0) break; # endif while (len >= 16) { (*block) (ivec, ecount_buf, key); ctr128_inc_aligned(ivec); - for (; n < 16; n += sizeof(size_t)) + for (n = 0; n < 16; n += sizeof(size_t)) *(size_t *)(out + n) = *(size_t *)(in + n) ^ *(size_t *)(ecount_buf + n); len -= 16; @@ -189,16 +185,13 @@ void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, /* increment upper 96 bits of 128-bit counter by 1 */ static void ctr96_inc(unsigned char *counter) { - u32 n = 12; - u8 c; + u32 n = 12, c = 1; do { --n; - c = counter[n]; - ++c; - counter[n] = c; - if (c) - return; + c += counter[n]; + counter[n] = (u8)c; + c >>= 8; } while (n); } diff --git a/vendor/openssl/openssl/crypto/o_dir.c b/vendor/openssl/openssl/crypto/o_dir.c index 26242444c..f9dbed871 100644 --- a/vendor/openssl/openssl/crypto/o_dir.c +++ b/vendor/openssl/openssl/crypto/o_dir.c @@ -1,4 +1,4 @@ -/* crypto/o_dir.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/o_dir.c */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2004. diff --git a/vendor/openssl/openssl/crypto/o_dir.h b/vendor/openssl/openssl/crypto/o_dir.h index d55431194..bf45a14d0 100644 --- a/vendor/openssl/openssl/crypto/o_dir.h +++ b/vendor/openssl/openssl/crypto/o_dir.h @@ -1,4 +1,4 @@ -/* crypto/o_dir.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/o_dir.h */ /* * Copied from Richard Levitte's (richard@levitte.org) LP library. All * symbol names have been changed, with permission from the author. diff --git a/vendor/openssl/openssl/crypto/o_dir_test.c b/vendor/openssl/openssl/crypto/o_dir_test.c index 7cdbbbc40..60436b72c 100644 --- a/vendor/openssl/openssl/crypto/o_dir_test.c +++ b/vendor/openssl/openssl/crypto/o_dir_test.c @@ -1,4 +1,4 @@ -/* crypto/o_dir.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/o_dir.h */ /* * Copied from Richard Levitte's (richard@levitte.org) LP library. All * symbol names have been changed, with permission from the author. diff --git a/vendor/openssl/openssl/crypto/o_str.c b/vendor/openssl/openssl/crypto/o_str.c index 4e2d09670..7e61cde85 100644 --- a/vendor/openssl/openssl/crypto/o_str.c +++ b/vendor/openssl/openssl/crypto/o_str.c @@ -1,4 +1,4 @@ -/* crypto/o_str.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/o_str.c */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2003. diff --git a/vendor/openssl/openssl/crypto/o_str.h b/vendor/openssl/openssl/crypto/o_str.h index 5313528ed..fa512eb39 100644 --- a/vendor/openssl/openssl/crypto/o_str.h +++ b/vendor/openssl/openssl/crypto/o_str.h @@ -1,4 +1,4 @@ -/* crypto/o_str.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/o_str.h */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2003. diff --git a/vendor/openssl/openssl/crypto/o_time.c b/vendor/openssl/openssl/crypto/o_time.c index 58413fe97..635dae184 100644 --- a/vendor/openssl/openssl/crypto/o_time.c +++ b/vendor/openssl/openssl/crypto/o_time.c @@ -1,4 +1,4 @@ -/* crypto/o_time.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/o_time.c */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2001. diff --git a/vendor/openssl/openssl/crypto/o_time.h b/vendor/openssl/openssl/crypto/o_time.h index a83a3d247..f192c6dcc 100644 --- a/vendor/openssl/openssl/crypto/o_time.h +++ b/vendor/openssl/openssl/crypto/o_time.h @@ -1,4 +1,4 @@ -/* crypto/o_time.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/o_time.h */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2001. diff --git a/vendor/openssl/openssl/crypto/opensslv.h b/vendor/openssl/openssl/crypto/opensslv.h index abcef15b1..13fe44023 100644 --- a/vendor/openssl/openssl/crypto/opensslv.h +++ b/vendor/openssl/openssl/crypto/opensslv.h @@ -30,11 +30,11 @@ extern "C" { * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for * major minor fix final patch/beta) */ -# define OPENSSL_VERSION_NUMBER 0x1000205fL +# define OPENSSL_VERSION_NUMBER 0x1000208fL # ifdef OPENSSL_FIPS -# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2e-fips 3 Dec 2015" +# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2h-fips 3 May 2016" # else -# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2e 3 Dec 2015" +# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2h 3 May 2016" # endif # define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT diff --git a/vendor/openssl/openssl/crypto/pem/pem_lib.c b/vendor/openssl/openssl/crypto/pem/pem_lib.c index a29821aab..fe881d664 100644 --- a/vendor/openssl/openssl/crypto/pem/pem_lib.c +++ b/vendor/openssl/openssl/crypto/pem/pem_lib.c @@ -348,7 +348,7 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, if (enc != NULL) { objstr = OBJ_nid2sn(EVP_CIPHER_nid(enc)); - if (objstr == NULL) { + if (objstr == NULL || EVP_CIPHER_iv_length(enc) == 0) { PEMerr(PEM_F_PEM_ASN1_WRITE_BIO, PEM_R_UNSUPPORTED_CIPHER); goto err; } diff --git a/vendor/openssl/openssl/crypto/pem/pvkfmt.c b/vendor/openssl/openssl/crypto/pem/pvkfmt.c index 82d45273e..61864468f 100644 --- a/vendor/openssl/openssl/crypto/pem/pvkfmt.c +++ b/vendor/openssl/openssl/crypto/pem/pvkfmt.c @@ -131,6 +131,10 @@ static int read_lebn(const unsigned char **in, unsigned int nbyte, BIGNUM **r) # define MS_PVKMAGIC 0xb0b5f11eL /* Salt length for PVK files */ # define PVK_SALTLEN 0x10 +/* Maximum length in PVK header */ +# define PVK_MAX_KEYLEN 102400 +/* Maximum salt length */ +# define PVK_MAX_SALTLEN 10240 static EVP_PKEY *b2i_rsa(const unsigned char **in, unsigned int length, unsigned int bitlen, int ispub); @@ -644,6 +648,9 @@ static int do_PVK_header(const unsigned char **in, unsigned int length, *psaltlen = read_ledword(&p); *pkeylen = read_ledword(&p); + if (*pkeylen > PVK_MAX_KEYLEN || *psaltlen > PVK_MAX_SALTLEN) + return 0; + if (is_encrypted && !*psaltlen) { PEMerr(PEM_F_DO_PVK_HEADER, PEM_R_INCONSISTENT_HEADER); return 0; diff --git a/vendor/openssl/openssl/crypto/perlasm/x86_64-xlate.pl b/vendor/openssl/openssl/crypto/perlasm/x86_64-xlate.pl index 9c70b8c2c..7a3dd04b0 100755 --- a/vendor/openssl/openssl/crypto/perlasm/x86_64-xlate.pl +++ b/vendor/openssl/openssl/crypto/perlasm/x86_64-xlate.pl @@ -195,14 +195,17 @@ sub out { my $self = shift; + $self->{value} =~ s/\b(0b[0-1]+)/oct($1)/eig; if ($gas) { # Solaris /usr/ccs/bin/as can't handle multiplications # in $self->{value} - $self->{value} =~ s/(?{value} =~ s/([0-9]+\s*[\*\/\%]\s*[0-9]+)/eval($1)/eg; + my $value = $self->{value}; + $value =~ s/(?{value} = $value; + } sprintf "\$%s",$self->{value}; } else { - $self->{value} =~ s/(0b[0-1]+)/oct($1)/eig; $self->{value} =~ s/0x([0-9a-f]+)/0$1h/ig if ($masm); sprintf "%s",$self->{value}; } diff --git a/vendor/openssl/openssl/crypto/pkcs7/pk7_smime.c b/vendor/openssl/openssl/crypto/pkcs7/pk7_smime.c index c4d3724d2..dc9b48407 100644 --- a/vendor/openssl/openssl/crypto/pkcs7/pk7_smime.c +++ b/vendor/openssl/openssl/crypto/pkcs7/pk7_smime.c @@ -274,12 +274,29 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, PKCS7err(PKCS7_F_PKCS7_VERIFY, PKCS7_R_NO_CONTENT); return 0; } +#if 0 + /* + * NB: this test commented out because some versions of Netscape + * illegally include zero length content when signing data. Also + * Microsoft Authenticode includes a SpcIndirectDataContent data + * structure which describes the content to be protected by the + * signature, rather than directly embedding that content. So + * Authenticode implementations are also expected to use + * PKCS7_verify() with explicit external data, on non-detached + * PKCS#7 signatures. + * + * In OpenSSL 1.1 a new flag PKCS7_NO_DUAL_CONTENT has been + * introduced to disable this sanity check. For the 1.0.2 branch + * this change is not acceptable, so the check remains completely + * commented out (as it has been for a long time). + */ /* Check for data and content: two sets of data */ if (!PKCS7_get_detached(p7) && indata) { PKCS7err(PKCS7_F_PKCS7_VERIFY, PKCS7_R_CONTENT_AND_DATA_PRESENT); return 0; } +#endif sinfos = PKCS7_get_signer_info(p7); diff --git a/vendor/openssl/openssl/crypto/rand/rand_vms.c b/vendor/openssl/openssl/crypto/rand/rand_vms.c index a7179a4ba..0e10c363e 100644 --- a/vendor/openssl/openssl/crypto/rand/rand_vms.c +++ b/vendor/openssl/openssl/crypto/rand/rand_vms.c @@ -1,4 +1,4 @@ -/* crypto/rand/rand_vms.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/rand/rand_vms.c */ /* * Written by Richard Levitte for the OpenSSL project * 2000. diff --git a/vendor/openssl/openssl/crypto/rc4/rc4_utl.c b/vendor/openssl/openssl/crypto/rc4/rc4_utl.c index 7c6a15f1c..cbd4a24e4 100644 --- a/vendor/openssl/openssl/crypto/rc4/rc4_utl.c +++ b/vendor/openssl/openssl/crypto/rc4/rc4_utl.c @@ -1,4 +1,4 @@ -/* crypto/rc4/rc4_utl.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/rc4/rc4_utl.c */ /* ==================================================================== * Copyright (c) 2011 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/rsa/rsa_chk.c b/vendor/openssl/openssl/crypto/rsa/rsa_chk.c index f4383860b..607faa001 100644 --- a/vendor/openssl/openssl/crypto/rsa/rsa_chk.c +++ b/vendor/openssl/openssl/crypto/rsa/rsa_chk.c @@ -1,4 +1,4 @@ -/* crypto/rsa/rsa_chk.c -*- Mode: C; c-file-style: "eay" -*- */ +/* crypto/rsa/rsa_chk.c */ /* ==================================================================== * Copyright (c) 1999 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/s390xcpuid.S b/vendor/openssl/openssl/crypto/s390xcpuid.S index 06815347e..d91d5bc4b 100644 --- a/vendor/openssl/openssl/crypto/s390xcpuid.S +++ b/vendor/openssl/openssl/crypto/s390xcpuid.S @@ -5,14 +5,46 @@ .align 16 OPENSSL_s390x_facilities: lghi %r0,0 - larl %r2,OPENSSL_s390xcap_P - stg %r0,8(%r2) - .long 0xb2b02000 # stfle 0(%r2) + larl %r4,OPENSSL_s390xcap_P + stg %r0,8(%r4) # wipe capability vectors + stg %r0,16(%r4) + stg %r0,24(%r4) + stg %r0,32(%r4) + stg %r0,40(%r4) + stg %r0,48(%r4) + stg %r0,56(%r4) + stg %r0,64(%r4) + stg %r0,72(%r4) + + .long 0xb2b04000 # stfle 0(%r4) brc 8,.Ldone lghi %r0,1 - .long 0xb2b02000 # stfle 0(%r2) + .long 0xb2b04000 # stfle 0(%r4) .Ldone: - lg %r2,0(%r2) + lmg %r2,%r3,0(%r4) + tmhl %r2,0x4000 # check for message-security-assist + jz .Lret + + lghi %r0,0 # query kimd capabilities + la %r1,16(%r4) + .long 0xb93e0002 # kimd %r0,%r2 + + lghi %r0,0 # query km capability vector + la %r1,32(%r4) + .long 0xb92e0042 # km %r4,%r2 + + lghi %r0,0 # query kmc capability vector + la %r1,48(%r4) + .long 0xb92f0042 # kmc %r4,%r2 + + tmhh %r3,0x0004 # check for message-security-assist-4 + jz .Lret + + lghi %r0,0 # query kmctr capability vector + la %r1,64(%r4) + .long 0xb92d2042 # kmctr %r4,%r2,%r2 + +.Lret: br %r14 .size OPENSSL_s390x_facilities,.-OPENSSL_s390x_facilities @@ -96,4 +128,4 @@ OPENSSL_cleanse: .section .init brasl %r14,OPENSSL_cpuid_setup -.comm OPENSSL_s390xcap_P,16,8 +.comm OPENSSL_s390xcap_P,80,8 diff --git a/vendor/openssl/openssl/crypto/seed/seed_cbc.c b/vendor/openssl/openssl/crypto/seed/seed_cbc.c index 33e688774..ee1115b4c 100644 --- a/vendor/openssl/openssl/crypto/seed/seed_cbc.c +++ b/vendor/openssl/openssl/crypto/seed/seed_cbc.c @@ -1,4 +1,4 @@ -/* crypto/seed/seed_cbc.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/seed/seed_cbc.c */ /* ==================================================================== * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/seed/seed_cfb.c b/vendor/openssl/openssl/crypto/seed/seed_cfb.c index 3437d7b4e..b6a5648b3 100644 --- a/vendor/openssl/openssl/crypto/seed/seed_cfb.c +++ b/vendor/openssl/openssl/crypto/seed/seed_cfb.c @@ -1,4 +1,4 @@ -/* crypto/seed/seed_cfb.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/seed/seed_cfb.c */ /* ==================================================================== * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/seed/seed_ecb.c b/vendor/openssl/openssl/crypto/seed/seed_ecb.c index 937a31b42..9363d5508 100644 --- a/vendor/openssl/openssl/crypto/seed/seed_ecb.c +++ b/vendor/openssl/openssl/crypto/seed/seed_ecb.c @@ -1,4 +1,4 @@ -/* crypto/seed/seed_ecb.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/seed/seed_ecb.c */ /* ==================================================================== * Copyright (c) 2007 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/seed/seed_ofb.c b/vendor/openssl/openssl/crypto/seed/seed_ofb.c index 6974302ce..48b71224c 100644 --- a/vendor/openssl/openssl/crypto/seed/seed_ofb.c +++ b/vendor/openssl/openssl/crypto/seed/seed_ofb.c @@ -1,4 +1,4 @@ -/* crypto/seed/seed_ofb.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/seed/seed_ofb.c */ /* ==================================================================== * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/sha/asm/sha1-mb-x86_64.pl b/vendor/openssl/openssl/crypto/sha/asm/sha1-mb-x86_64.pl index f856bb888..a8d8708d4 100644 --- a/vendor/openssl/openssl/crypto/sha/asm/sha1-mb-x86_64.pl +++ b/vendor/openssl/openssl/crypto/sha/asm/sha1-mb-x86_64.pl @@ -58,7 +58,7 @@ $avx = ($1>=10) + ($1>=11); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([3-9]\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } diff --git a/vendor/openssl/openssl/crypto/sha/asm/sha1-ppc.pl b/vendor/openssl/openssl/crypto/sha/asm/sha1-ppc.pl index df5989610..ab655021c 100755 --- a/vendor/openssl/openssl/crypto/sha/asm/sha1-ppc.pl +++ b/vendor/openssl/openssl/crypto/sha/asm/sha1-ppc.pl @@ -227,7 +227,7 @@ sub BODY_40_59 { srwi. $t1,$t1,6 ; t1/=64 beq Lcross_page $UCMP $num,$t1 - ble- Laligned ; didn't cross the page boundary + ble Laligned ; didn't cross the page boundary mtctr $t1 subfc $num,$t1,$num bl Lsha1_block_private @@ -255,7 +255,7 @@ sub BODY_40_59 { bl Lsha1_block_private $POP $inp,`$FRAME-$SIZE_T*18`($sp) addic. $num,$num,-1 - bne- Lunaligned + bne Lunaligned Ldone: $POP r0,`$FRAME+$LRSAVE`($sp) @@ -329,7 +329,7 @@ sub BODY_40_59 { stw r20,16($ctx) mr $E,r20 addi $inp,$inp,`16*4` - bdnz- Lsha1_block_private + bdnz Lsha1_block_private blr .long 0 .byte 0,12,0x14,0,0,0,0,0 diff --git a/vendor/openssl/openssl/crypto/sha/asm/sha1-s390x.pl b/vendor/openssl/openssl/crypto/sha/asm/sha1-s390x.pl index 9193dda45..d5cf1640a 100644 --- a/vendor/openssl/openssl/crypto/sha/asm/sha1-s390x.pl +++ b/vendor/openssl/openssl/crypto/sha/asm/sha1-s390x.pl @@ -167,10 +167,7 @@ sub BODY_40_59 { lg %r0,0(%r1) tmhl %r0,0x4000 # check for message-security assist jz .Lsoftware - lghi %r0,0 - la %r1,`2*$SIZE_T`($sp) - .long 0xb93e0002 # kimd %r0,%r2 - lg %r0,`2*$SIZE_T`($sp) + lg %r0,16(%r1) # check kimd capabilities tmhh %r0,`0x8000>>$kimdfunc` jz .Lsoftware lghi %r0,$kimdfunc @@ -237,7 +234,7 @@ sub BODY_40_59 { br %r14 .size sha1_block_data_order,.-sha1_block_data_order .string "SHA1 block transform for s390x, CRYPTOGAMS by " -.comm OPENSSL_s390xcap_P,16,8 +.comm OPENSSL_s390xcap_P,80,8 ___ $code =~ s/\`([^\`]*)\`/eval $1/gem; diff --git a/vendor/openssl/openssl/crypto/sha/asm/sha1-x86_64.pl b/vendor/openssl/openssl/crypto/sha/asm/sha1-x86_64.pl index 9a6acc347..5f375fc68 100755 --- a/vendor/openssl/openssl/crypto/sha/asm/sha1-x86_64.pl +++ b/vendor/openssl/openssl/crypto/sha/asm/sha1-x86_64.pl @@ -107,7 +107,7 @@ $avx = ($1>=10) + ($1>=11); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([2-9]\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([2-9]\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } diff --git a/vendor/openssl/openssl/crypto/sha/asm/sha256-mb-x86_64.pl b/vendor/openssl/openssl/crypto/sha/asm/sha256-mb-x86_64.pl index 3d37ae31a..9770286b9 100644 --- a/vendor/openssl/openssl/crypto/sha/asm/sha256-mb-x86_64.pl +++ b/vendor/openssl/openssl/crypto/sha/asm/sha256-mb-x86_64.pl @@ -59,7 +59,7 @@ $avx = ($1>=10) + ($1>=11); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([3-9]\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } diff --git a/vendor/openssl/openssl/crypto/sha/asm/sha512-ppc.pl b/vendor/openssl/openssl/crypto/sha/asm/sha512-ppc.pl index 734f3c1ca..17fdc6e8e 100755 --- a/vendor/openssl/openssl/crypto/sha/asm/sha512-ppc.pl +++ b/vendor/openssl/openssl/crypto/sha/asm/sha512-ppc.pl @@ -259,7 +259,7 @@ sub ROUND_16_xx { andi. $t1,$t1,`4096-16*$SZ` ; distance to closest page boundary beq Lcross_page $UCMP $num,$t1 - ble- Laligned ; didn't cross the page boundary + ble Laligned ; didn't cross the page boundary subfc $num,$t1,$num add $t1,$inp,$t1 $PUSH $num,`$FRAME-$SIZE_T*25`($sp) ; save real remaining num @@ -317,7 +317,7 @@ sub ROUND_16_xx { $POP $inp,`$FRAME-$SIZE_T*26`($sp) ; restore real inp $POP $num,`$FRAME-$SIZE_T*25`($sp) ; restore real num addic. $num,$num,`-16*$SZ` ; num-- - bne- Lunaligned + bne Lunaligned Ldone: $POP r0,`$FRAME+$LRSAVE`($sp) @@ -396,7 +396,7 @@ sub ROUND_16_xx { unshift(@V,pop(@V)); } $code.=<<___; - bdnz- Lrounds + bdnz Lrounds $POP $ctx,`$FRAME-$SIZE_T*22`($sp) $POP $inp,`$FRAME-$SIZE_T*23`($sp) ; inp pointer @@ -644,7 +644,7 @@ sub ROUND_16_xx_ppc32 { ($a0,$a1,$a2,$a3) = ($a2,$a3,$a0,$a1); } $code.=<<___; - bdnz- Lrounds + bdnz Lrounds $POP $ctx,`$FRAME-$SIZE_T*22`($sp) $POP $inp,`$FRAME-$SIZE_T*23`($sp) ; inp pointer diff --git a/vendor/openssl/openssl/crypto/sha/asm/sha512-s390x.pl b/vendor/openssl/openssl/crypto/sha/asm/sha512-s390x.pl index 079a3fc78..9c10e4e9e 100644 --- a/vendor/openssl/openssl/crypto/sha/asm/sha512-s390x.pl +++ b/vendor/openssl/openssl/crypto/sha/asm/sha512-s390x.pl @@ -240,10 +240,7 @@ sub BODY_16_XX { lg %r0,0(%r1) tmhl %r0,0x4000 # check for message-security assist jz .Lsoftware - lghi %r0,0 - la %r1,`2*$SIZE_T`($sp) - .long 0xb93e0002 # kimd %r0,%r2 - lg %r0,`2*$SIZE_T`($sp) + lg %r0,16(%r1) # check kimd capabilities tmhh %r0,`0x8000>>$kimdfunc` jz .Lsoftware lghi %r0,$kimdfunc @@ -311,7 +308,7 @@ sub BODY_16_XX { br %r14 .size $Func,.-$Func .string "SHA${label} block transform for s390x, CRYPTOGAMS by " -.comm OPENSSL_s390xcap_P,16,8 +.comm OPENSSL_s390xcap_P,80,8 ___ $code =~ s/\`([^\`]*)\`/eval $1/gem; diff --git a/vendor/openssl/openssl/crypto/sha/asm/sha512-x86_64.pl b/vendor/openssl/openssl/crypto/sha/asm/sha512-x86_64.pl index 58665667f..78e445f3f 100755 --- a/vendor/openssl/openssl/crypto/sha/asm/sha512-x86_64.pl +++ b/vendor/openssl/openssl/crypto/sha/asm/sha512-x86_64.pl @@ -124,7 +124,7 @@ $avx = ($1>=10) + ($1>=11); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([3-9]\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } diff --git a/vendor/openssl/openssl/crypto/sha/sha1test.c b/vendor/openssl/openssl/crypto/sha/sha1test.c index 0052a95c7..551a348df 100644 --- a/vendor/openssl/openssl/crypto/sha/sha1test.c +++ b/vendor/openssl/openssl/crypto/sha/sha1test.c @@ -157,8 +157,8 @@ int main(int argc, char *argv[]) if (err) printf("ERROR: %d\n", err); # endif - EXIT(err); EVP_MD_CTX_cleanup(&c); + EXIT(err); return (0); } diff --git a/vendor/openssl/openssl/crypto/srp/srp.h b/vendor/openssl/openssl/crypto/srp/srp.h index d072536fe..028892a1f 100644 --- a/vendor/openssl/openssl/crypto/srp/srp.h +++ b/vendor/openssl/openssl/crypto/srp/srp.h @@ -82,16 +82,21 @@ typedef struct SRP_gN_cache_st { DECLARE_STACK_OF(SRP_gN_cache) typedef struct SRP_user_pwd_st { + /* Owned by us. */ char *id; BIGNUM *s; BIGNUM *v; + /* Not owned by us. */ const BIGNUM *g; const BIGNUM *N; + /* Owned by us. */ char *info; } SRP_user_pwd; DECLARE_STACK_OF(SRP_user_pwd) +void SRP_user_pwd_free(SRP_user_pwd *user_pwd); + typedef struct SRP_VBASE_st { STACK_OF(SRP_user_pwd) *users_pwd; STACK_OF(SRP_gN_cache) *gN_cache; @@ -115,7 +120,12 @@ DECLARE_STACK_OF(SRP_gN) SRP_VBASE *SRP_VBASE_new(char *seed_key); int SRP_VBASE_free(SRP_VBASE *vb); int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file); + +/* This method ignores the configured seed and fails for an unknown user. */ SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username); +/* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/ +SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username); + char *SRP_create_verifier(const char *user, const char *pass, char **salt, char **verifier, const char *N, const char *g); int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, diff --git a/vendor/openssl/openssl/crypto/srp/srp_vfy.c b/vendor/openssl/openssl/crypto/srp/srp_vfy.c index a3f1a8a0a..26ad3e07b 100644 --- a/vendor/openssl/openssl/crypto/srp/srp_vfy.c +++ b/vendor/openssl/openssl/crypto/srp/srp_vfy.c @@ -185,7 +185,7 @@ static char *t_tob64(char *dst, const unsigned char *src, int size) return olddst; } -static void SRP_user_pwd_free(SRP_user_pwd *user_pwd) +void SRP_user_pwd_free(SRP_user_pwd *user_pwd) { if (user_pwd == NULL) return; @@ -247,6 +247,24 @@ static int SRP_user_pwd_set_sv_BN(SRP_user_pwd *vinfo, BIGNUM *s, BIGNUM *v) return (vinfo->s != NULL && vinfo->v != NULL); } +static SRP_user_pwd *srp_user_pwd_dup(SRP_user_pwd *src) +{ + SRP_user_pwd *ret; + + if (src == NULL) + return NULL; + if ((ret = SRP_user_pwd_new()) == NULL) + return NULL; + + SRP_user_pwd_set_gN(ret, src->g, src->N); + if (!SRP_user_pwd_set_ids(ret, src->id, src->info) + || !SRP_user_pwd_set_sv_BN(ret, BN_dup(src->s), BN_dup(src->v))) { + SRP_user_pwd_free(ret); + return NULL; + } + return ret; +} + SRP_VBASE *SRP_VBASE_new(char *seed_key) { SRP_VBASE *vb = (SRP_VBASE *)OPENSSL_malloc(sizeof(SRP_VBASE)); @@ -468,21 +486,50 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file) } -SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username) +static SRP_user_pwd *find_user(SRP_VBASE *vb, char *username) { int i; SRP_user_pwd *user; - unsigned char digv[SHA_DIGEST_LENGTH]; - unsigned char digs[SHA_DIGEST_LENGTH]; - EVP_MD_CTX ctxt; if (vb == NULL) return NULL; + for (i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++) { user = sk_SRP_user_pwd_value(vb->users_pwd, i); if (strcmp(user->id, username) == 0) return user; } + + return NULL; +} + +/* + * This method ignores the configured seed and fails for an unknown user. + * Ownership of the returned pointer is not released to the caller. + * In other words, caller must not free the result. + */ +SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username) +{ + return find_user(vb, username); +} + +/* + * Ownership of the returned pointer is released to the caller. + * In other words, caller must free the result once done. + */ +SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username) +{ + SRP_user_pwd *user; + unsigned char digv[SHA_DIGEST_LENGTH]; + unsigned char digs[SHA_DIGEST_LENGTH]; + EVP_MD_CTX ctxt; + + if (vb == NULL) + return NULL; + + if ((user = find_user(vb, username)) != NULL) + return srp_user_pwd_dup(user); + if ((vb->seed_key == NULL) || (vb->default_g == NULL) || (vb->default_N == NULL)) return NULL; diff --git a/vendor/openssl/openssl/crypto/stack/stack.c b/vendor/openssl/openssl/crypto/stack/stack.c index de437acf6..fa50083e2 100644 --- a/vendor/openssl/openssl/crypto/stack/stack.c +++ b/vendor/openssl/openssl/crypto/stack/stack.c @@ -360,7 +360,7 @@ void *sk_set(_STACK *st, int i, void *value) void sk_sort(_STACK *st) { - if (st && !st->sorted) { + if (st && !st->sorted && st->comp != NULL) { int (*comp_func) (const void *, const void *); /* diff --git a/vendor/openssl/openssl/crypto/store/store.h b/vendor/openssl/openssl/crypto/store/store.h index 834334104..ce3709d9f 100644 --- a/vendor/openssl/openssl/crypto/store/store.h +++ b/vendor/openssl/openssl/crypto/store/store.h @@ -1,4 +1,4 @@ -/* crypto/store/store.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/store/store.h */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2003. diff --git a/vendor/openssl/openssl/crypto/store/str_lib.c b/vendor/openssl/openssl/crypto/store/str_lib.c index 227b797b5..e3d5da938 100644 --- a/vendor/openssl/openssl/crypto/store/str_lib.c +++ b/vendor/openssl/openssl/crypto/store/str_lib.c @@ -1,4 +1,4 @@ -/* crypto/store/str_lib.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/store/str_lib.c */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2003. diff --git a/vendor/openssl/openssl/crypto/store/str_locl.h b/vendor/openssl/openssl/crypto/store/str_locl.h index ac55784df..c0b40f0db 100644 --- a/vendor/openssl/openssl/crypto/store/str_locl.h +++ b/vendor/openssl/openssl/crypto/store/str_locl.h @@ -1,4 +1,4 @@ -/* crypto/store/str_locl.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/store/str_locl.h */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2003. diff --git a/vendor/openssl/openssl/crypto/store/str_mem.c b/vendor/openssl/openssl/crypto/store/str_mem.c index 8edd0eb41..6eee5bba2 100644 --- a/vendor/openssl/openssl/crypto/store/str_mem.c +++ b/vendor/openssl/openssl/crypto/store/str_mem.c @@ -1,4 +1,4 @@ -/* crypto/store/str_mem.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/store/str_mem.c */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2003. diff --git a/vendor/openssl/openssl/crypto/store/str_meth.c b/vendor/openssl/openssl/crypto/store/str_meth.c index d83a6de0f..c83fbc565 100644 --- a/vendor/openssl/openssl/crypto/store/str_meth.c +++ b/vendor/openssl/openssl/crypto/store/str_meth.c @@ -1,4 +1,4 @@ -/* crypto/store/str_meth.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/store/str_meth.c */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2003. diff --git a/vendor/openssl/openssl/crypto/ts/ts_rsp_verify.c b/vendor/openssl/openssl/crypto/ts/ts_rsp_verify.c index da8991173..29aa5a497 100644 --- a/vendor/openssl/openssl/crypto/ts/ts_rsp_verify.c +++ b/vendor/openssl/openssl/crypto/ts/ts_rsp_verify.c @@ -255,7 +255,8 @@ static int TS_verify_cert(X509_STORE *store, STACK_OF(X509) *untrusted, /* chain is an out argument. */ *chain = NULL; - X509_STORE_CTX_init(&cert_ctx, store, signer, untrusted); + if (!X509_STORE_CTX_init(&cert_ctx, store, signer, untrusted)) + return 0; X509_STORE_CTX_set_purpose(&cert_ctx, X509_PURPOSE_TIMESTAMP_SIGN); i = X509_verify_cert(&cert_ctx); if (i <= 0) { diff --git a/vendor/openssl/openssl/crypto/ui/ui.h b/vendor/openssl/openssl/crypto/ui/ui.h index b917edab3..0dc16330b 100644 --- a/vendor/openssl/openssl/crypto/ui/ui.h +++ b/vendor/openssl/openssl/crypto/ui/ui.h @@ -1,4 +1,4 @@ -/* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/ui/ui.h */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2001. diff --git a/vendor/openssl/openssl/crypto/ui/ui_compat.c b/vendor/openssl/openssl/crypto/ui/ui_compat.c index 0ca5284f9..e79d54eea 100644 --- a/vendor/openssl/openssl/crypto/ui/ui_compat.c +++ b/vendor/openssl/openssl/crypto/ui/ui_compat.c @@ -1,4 +1,4 @@ -/* crypto/ui/ui_compat.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/ui/ui_compat.c */ /* ==================================================================== * Copyright (c) 2001-2002 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/ui/ui_compat.h b/vendor/openssl/openssl/crypto/ui/ui_compat.h index 42fb9ff65..bf541542c 100644 --- a/vendor/openssl/openssl/crypto/ui/ui_compat.h +++ b/vendor/openssl/openssl/crypto/ui/ui_compat.h @@ -1,4 +1,4 @@ -/* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/ui/ui.h */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2001. diff --git a/vendor/openssl/openssl/crypto/ui/ui_lib.c b/vendor/openssl/openssl/crypto/ui/ui_lib.c index 5ddd7317e..2f580352c 100644 --- a/vendor/openssl/openssl/crypto/ui/ui_lib.c +++ b/vendor/openssl/openssl/crypto/ui/ui_lib.c @@ -1,4 +1,4 @@ -/* crypto/ui/ui_lib.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/ui/ui_lib.c */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2001. diff --git a/vendor/openssl/openssl/crypto/ui/ui_locl.h b/vendor/openssl/openssl/crypto/ui/ui_locl.h index 0d919cd7b..bebc13abf 100644 --- a/vendor/openssl/openssl/crypto/ui/ui_locl.h +++ b/vendor/openssl/openssl/crypto/ui/ui_locl.h @@ -1,4 +1,4 @@ -/* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/ui/ui.h */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2001. diff --git a/vendor/openssl/openssl/crypto/ui/ui_openssl.c b/vendor/openssl/openssl/crypto/ui/ui_openssl.c index 5d6627641..9ab259b8f 100644 --- a/vendor/openssl/openssl/crypto/ui/ui_openssl.c +++ b/vendor/openssl/openssl/crypto/ui/ui_openssl.c @@ -1,4 +1,4 @@ -/* crypto/ui/ui_openssl.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/ui/ui_openssl.c */ /* * Written by Richard Levitte (richard@levitte.org) and others for the * OpenSSL project 2001. diff --git a/vendor/openssl/openssl/crypto/ui/ui_util.c b/vendor/openssl/openssl/crypto/ui/ui_util.c index f65f80d71..0f290115d 100644 --- a/vendor/openssl/openssl/crypto/ui/ui_util.c +++ b/vendor/openssl/openssl/crypto/ui/ui_util.c @@ -1,4 +1,4 @@ -/* crypto/ui/ui_util.c -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/ui/ui_util.c */ /* ==================================================================== * Copyright (c) 2001-2002 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/crypto/x509/x509.h b/vendor/openssl/openssl/crypto/x509/x509.h index 99337b849..fc613ce63 100644 --- a/vendor/openssl/openssl/crypto/x509/x509.h +++ b/vendor/openssl/openssl/crypto/x509/x509.h @@ -1305,6 +1305,7 @@ void ERR_load_X509_strings(void); # define X509_R_LOADING_CERT_DIR 103 # define X509_R_LOADING_DEFAULTS 104 # define X509_R_METHOD_NOT_SUPPORTED 124 +# define X509_R_NAME_TOO_LONG 134 # define X509_R_NEWER_CRL_NOT_NEWER 132 # define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 # define X509_R_NO_CRL_NUMBER 130 diff --git a/vendor/openssl/openssl/crypto/x509/x509_err.c b/vendor/openssl/openssl/crypto/x509/x509_err.c index 43cde18e4..1e779fefd 100644 --- a/vendor/openssl/openssl/crypto/x509/x509_err.c +++ b/vendor/openssl/openssl/crypto/x509/x509_err.c @@ -151,6 +151,7 @@ static ERR_STRING_DATA X509_str_reasons[] = { {ERR_REASON(X509_R_LOADING_CERT_DIR), "loading cert dir"}, {ERR_REASON(X509_R_LOADING_DEFAULTS), "loading defaults"}, {ERR_REASON(X509_R_METHOD_NOT_SUPPORTED), "method not supported"}, + {ERR_REASON(X509_R_NAME_TOO_LONG), "name too long"}, {ERR_REASON(X509_R_NEWER_CRL_NOT_NEWER), "newer crl not newer"}, {ERR_REASON(X509_R_NO_CERT_SET_FOR_US_TO_VERIFY), "no cert set for us to verify"}, diff --git a/vendor/openssl/openssl/crypto/x509/x509_obj.c b/vendor/openssl/openssl/crypto/x509/x509_obj.c index d317f3af2..3de3ac720 100644 --- a/vendor/openssl/openssl/crypto/x509/x509_obj.c +++ b/vendor/openssl/openssl/crypto/x509/x509_obj.c @@ -63,6 +63,13 @@ #include #include +/* + * Limit to ensure we don't overflow: much greater than + * anything enountered in practice. + */ + +#define NAME_ONELINE_MAX (1024 * 1024) + char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) { X509_NAME_ENTRY *ne; @@ -86,6 +93,8 @@ char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) goto err; b->data[0] = '\0'; len = 200; + } else if (len == 0) { + return NULL; } if (a == NULL) { if (b) { @@ -110,6 +119,10 @@ char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) type = ne->value->type; num = ne->value->length; + if (num > NAME_ONELINE_MAX) { + X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); + goto end; + } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || @@ -117,8 +130,9 @@ char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_IA5STRING) { - ascii2ebcdic(ebcdic_buf, q, (num > sizeof ebcdic_buf) - ? sizeof ebcdic_buf : num); + if (num > (int)sizeof(ebcdic_buf)) + num = sizeof(ebcdic_buf); + ascii2ebcdic(ebcdic_buf, q, num); q = ebcdic_buf; } #endif @@ -154,6 +168,10 @@ char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) lold = l; l += 1 + l1 + 1 + l2; + if (l > NAME_ONELINE_MAX) { + X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); + goto end; + } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; @@ -206,7 +224,7 @@ char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); - if (b != NULL) - BUF_MEM_free(b); + end: + BUF_MEM_free(b); return (NULL); } diff --git a/vendor/openssl/openssl/crypto/x509/x509_vfy.c b/vendor/openssl/openssl/crypto/x509/x509_vfy.c index ab94948f0..4d34dbac9 100644 --- a/vendor/openssl/openssl/crypto/x509/x509_vfy.c +++ b/vendor/openssl/openssl/crypto/x509/x509_vfy.c @@ -194,6 +194,9 @@ int X509_verify_cert(X509_STORE_CTX *ctx) int num, j, retry; int (*cb) (int xok, X509_STORE_CTX *xctx); STACK_OF(X509) *sktmp = NULL; + int trust = X509_TRUST_UNTRUSTED; + int err; + if (ctx->cert == NULL) { X509err(X509_F_X509_VERIFY_CERT, X509_R_NO_CERT_SET_FOR_US_TO_VERIFY); return -1; @@ -216,7 +219,8 @@ int X509_verify_cert(X509_STORE_CTX *ctx) if (((ctx->chain = sk_X509_new_null()) == NULL) || (!sk_X509_push(ctx->chain, ctx->cert))) { X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); - goto end; + ok = -1; + goto err; } CRYPTO_add(&ctx->cert->references, 1, CRYPTO_LOCK_X509); ctx->last_untrusted = 1; @@ -225,7 +229,8 @@ int X509_verify_cert(X509_STORE_CTX *ctx) if (ctx->untrusted != NULL && (sktmp = sk_X509_dup(ctx->untrusted)) == NULL) { X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); - goto end; + ok = -1; + goto err; } num = sk_X509_num(ctx->chain); @@ -249,7 +254,7 @@ int X509_verify_cert(X509_STORE_CTX *ctx) if (ctx->param->flags & X509_V_FLAG_TRUSTED_FIRST) { ok = ctx->get_issuer(&xtmp, ctx, x); if (ok < 0) - goto end; + goto err; /* * If successful for now free up cert so it will be picked up * again later. @@ -266,7 +271,8 @@ int X509_verify_cert(X509_STORE_CTX *ctx) if (xtmp != NULL) { if (!sk_X509_push(ctx->chain, xtmp)) { X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); - goto end; + ok = -1; + goto err; } CRYPTO_add(&xtmp->references, 1, CRYPTO_LOCK_X509); (void)sk_X509_delete_ptr(sktmp, xtmp); @@ -314,7 +320,7 @@ int X509_verify_cert(X509_STORE_CTX *ctx) bad_chain = 1; ok = cb(0, ctx); if (!ok) - goto end; + goto err; } else { /* * We have a match: replace certificate with store @@ -347,25 +353,26 @@ int X509_verify_cert(X509_STORE_CTX *ctx) ok = ctx->get_issuer(&xtmp, ctx, x); if (ok < 0) - goto end; + goto err; if (ok == 0) break; x = xtmp; if (!sk_X509_push(ctx->chain, x)) { X509_free(xtmp); X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); - ok = 0; - goto end; + ok = -1; + goto err; } num++; } /* we now have our chain, lets check it... */ - i = check_trust(ctx); + if ((trust = check_trust(ctx)) == X509_TRUST_REJECTED) { + /* Callback already issued */ + ok = 0; + goto err; + } - /* If explicitly rejected error */ - if (i == X509_TRUST_REJECTED) - goto end; /* * If it's not explicitly trusted then check if there is an alternative * chain that could be used. We only do this if we haven't already @@ -373,14 +380,14 @@ int X509_verify_cert(X509_STORE_CTX *ctx) * chain checking */ retry = 0; - if (i != X509_TRUST_TRUSTED + if (trust != X509_TRUST_TRUSTED && !(ctx->param->flags & X509_V_FLAG_TRUSTED_FIRST) && !(ctx->param->flags & X509_V_FLAG_NO_ALT_CHAINS)) { while (j-- > 1) { xtmp2 = sk_X509_value(ctx->chain, j - 1); ok = ctx->get_issuer(&xtmp, ctx, xtmp2); if (ok < 0) - goto end; + goto err; /* Check if we found an alternate chain */ if (ok > 0) { /* @@ -410,7 +417,7 @@ int X509_verify_cert(X509_STORE_CTX *ctx) * self signed certificate in which case we've indicated an error already * and set bad_chain == 1 */ - if (i != X509_TRUST_TRUSTED && !bad_chain) { + if (trust != X509_TRUST_TRUSTED && !bad_chain) { if ((chain_ss == NULL) || !ctx->check_issued(ctx, x, chain_ss)) { if (ctx->last_untrusted >= num) ctx->error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY; @@ -431,26 +438,26 @@ int X509_verify_cert(X509_STORE_CTX *ctx) bad_chain = 1; ok = cb(0, ctx); if (!ok) - goto end; + goto err; } /* We have the chain complete: now we need to check its purpose */ ok = check_chain_extensions(ctx); if (!ok) - goto end; + goto err; /* Check name constraints */ ok = check_name_constraints(ctx); if (!ok) - goto end; + goto err; ok = check_id(ctx); if (!ok) - goto end; + goto err; /* We may as well copy down any DSA parameters that are required */ X509_get_pubkey_parameters(NULL, ctx->chain); @@ -462,16 +469,16 @@ int X509_verify_cert(X509_STORE_CTX *ctx) ok = ctx->check_revocation(ctx); if (!ok) - goto end; + goto err; - i = X509_chain_check_suiteb(&ctx->error_depth, NULL, ctx->chain, - ctx->param->flags); - if (i != X509_V_OK) { - ctx->error = i; + err = X509_chain_check_suiteb(&ctx->error_depth, NULL, ctx->chain, + ctx->param->flags); + if (err != X509_V_OK) { + ctx->error = err; ctx->current_cert = sk_X509_value(ctx->chain, ctx->error_depth); ok = cb(0, ctx); if (!ok) - goto end; + goto err; } /* At this point, we have a chain and need to verify it */ @@ -480,25 +487,28 @@ int X509_verify_cert(X509_STORE_CTX *ctx) else ok = internal_verify(ctx); if (!ok) - goto end; + goto err; #ifndef OPENSSL_NO_RFC3779 /* RFC 3779 path validation, now that CRL check has been done */ ok = v3_asid_validate_path(ctx); if (!ok) - goto end; + goto err; ok = v3_addr_validate_path(ctx); if (!ok) - goto end; + goto err; #endif /* If we get this far evaluate policies */ if (!bad_chain && (ctx->param->flags & X509_V_FLAG_POLICY_CHECK)) ok = ctx->check_policy(ctx); if (!ok) - goto end; + goto err; if (0) { - end: + err: + /* Ensure we return an error */ + if (ok > 0) + ok = 0; X509_get_pubkey_parameters(NULL, ctx->chain); } if (sktmp != NULL) @@ -2283,9 +2293,10 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, ctx->current_reasons = 0; ctx->tree = NULL; ctx->parent = NULL; + /* Zero ex_data to make sure we're cleanup-safe */ + memset(&ctx->ex_data, 0, sizeof(ctx->ex_data)); ctx->param = X509_VERIFY_PARAM_new(); - if (!ctx->param) { X509err(X509_F_X509_STORE_CTX_INIT, ERR_R_MALLOC_FAILURE); return 0; @@ -2294,7 +2305,6 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, /* * Inherit callbacks and flags from X509_STORE if not set use defaults. */ - if (store) ret = X509_VERIFY_PARAM_inherit(ctx->param, store->param); else @@ -2302,6 +2312,7 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, if (store) { ctx->verify_cb = store->verify_cb; + /* Seems to always be 0 in OpenSSL, else must be idempotent */ ctx->cleanup = store->cleanup; } else ctx->cleanup = 0; @@ -2312,7 +2323,7 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, if (ret == 0) { X509err(X509_F_X509_STORE_CTX_INIT, ERR_R_MALLOC_FAILURE); - return 0; + goto err; } if (store && store->check_issued) @@ -2367,19 +2378,18 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, ctx->check_policy = check_policy; + if (CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE_CTX, ctx, + &ctx->ex_data)) + return 1; + X509err(X509_F_X509_STORE_CTX_INIT, ERR_R_MALLOC_FAILURE); + + err: /* - * This memset() can't make any sense anyway, so it's removed. As - * X509_STORE_CTX_cleanup does a proper "free" on the ex_data, we put a - * corresponding "new" here and remove this bogus initialisation. + * On error clean up allocated storage, if the store context was not + * allocated with X509_STORE_CTX_new() this is our last chance to do so. */ - /* memset(&(ctx->ex_data),0,sizeof(CRYPTO_EX_DATA)); */ - if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE_CTX, ctx, - &(ctx->ex_data))) { - OPENSSL_free(ctx); - X509err(X509_F_X509_STORE_CTX_INIT, ERR_R_MALLOC_FAILURE); - return 0; - } - return 1; + X509_STORE_CTX_cleanup(ctx); + return 0; } /* @@ -2395,8 +2405,17 @@ void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk) void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx) { - if (ctx->cleanup) + /* + * We need to be idempotent because, unfortunately, free() also calls + * cleanup(), so the natural call sequence new(), init(), cleanup(), free() + * calls cleanup() for the same object twice! Thus we must zero the + * pointers below after they're freed! + */ + /* Seems to always be 0 in OpenSSL, do this at most once. */ + if (ctx->cleanup != NULL) { ctx->cleanup(ctx); + ctx->cleanup = NULL; + } if (ctx->param != NULL) { if (ctx->parent == NULL) X509_VERIFY_PARAM_free(ctx->param); diff --git a/vendor/openssl/openssl/crypto/x509/x509_vfy.h b/vendor/openssl/openssl/crypto/x509/x509_vfy.h index bd8613c62..2663e1c0a 100644 --- a/vendor/openssl/openssl/crypto/x509/x509_vfy.h +++ b/vendor/openssl/openssl/crypto/x509/x509_vfy.h @@ -313,7 +313,7 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) # define X509_V_OK 0 -/* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */ +# define X509_V_ERR_UNSPECIFIED 1 # define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 # define X509_V_ERR_UNABLE_TO_GET_CRL 3 diff --git a/vendor/openssl/openssl/crypto/x509/x509_vpm.c b/vendor/openssl/openssl/crypto/x509/x509_vpm.c index 592a8a5f6..1ac15a881 100644 --- a/vendor/openssl/openssl/crypto/x509/x509_vpm.c +++ b/vendor/openssl/openssl/crypto/x509/x509_vpm.c @@ -94,11 +94,11 @@ static int int_x509_param_set_hosts(X509_VERIFY_PARAM_ID *id, int mode, * Refuse names with embedded NUL bytes, except perhaps as final byte. * XXX: Do we need to push an error onto the error stack? */ - if (namelen == 0) + if (namelen == 0 || name == NULL) namelen = name ? strlen(name) : 0; else if (name && memchr(name, '\0', namelen > 1 ? namelen - 1 : namelen)) return 0; - if (name && name[namelen - 1] == '\0') + if (namelen > 0 && name[namelen - 1] == '\0') --namelen; if (mode == SET_HOST && id->hosts) { diff --git a/vendor/openssl/openssl/crypto/x509v3/v3_pci.c b/vendor/openssl/openssl/crypto/x509v3/v3_pci.c index 48ac0959c..34cad53cb 100644 --- a/vendor/openssl/openssl/crypto/x509v3/v3_pci.c +++ b/vendor/openssl/openssl/crypto/x509v3/v3_pci.c @@ -1,4 +1,4 @@ -/* v3_pci.c -*- mode:C; c-file-style: "eay" -*- */ +/* v3_pci.c */ /* * Contributed to the OpenSSL Project 2004 by Richard Levitte * (richard@levitte.org) diff --git a/vendor/openssl/openssl/crypto/x509v3/v3_pcia.c b/vendor/openssl/openssl/crypto/x509v3/v3_pcia.c index 43fd362ae..e53c82e8d 100644 --- a/vendor/openssl/openssl/crypto/x509v3/v3_pcia.c +++ b/vendor/openssl/openssl/crypto/x509v3/v3_pcia.c @@ -1,4 +1,4 @@ -/* v3_pcia.c -*- mode:C; c-file-style: "eay" -*- */ +/* v3_pcia.c */ /* * Contributed to the OpenSSL Project 2004 by Richard Levitte * (richard@levitte.org) diff --git a/vendor/openssl/openssl/crypto/x509v3/v3_utl.c b/vendor/openssl/openssl/crypto/x509v3/v3_utl.c index 4d1ecc58b..43b9cb9c5 100644 --- a/vendor/openssl/openssl/crypto/x509v3/v3_utl.c +++ b/vendor/openssl/openssl/crypto/x509v3/v3_utl.c @@ -841,7 +841,8 @@ static const unsigned char *valid_star(const unsigned char *p, size_t len, state = LABEL_START; ++dots; } else if (p[i] == '-') { - if ((state & LABEL_HYPHEN) != 0) + /* no domain/subdomain starts with '-' */ + if ((state & LABEL_START) != 0) return NULL; state |= LABEL_HYPHEN; } else diff --git a/vendor/openssl/openssl/crypto/x509v3/v3nametest.c b/vendor/openssl/openssl/crypto/x509v3/v3nametest.c index 7b5c1c8e5..ac5c9ff43 100644 --- a/vendor/openssl/openssl/crypto/x509v3/v3nametest.c +++ b/vendor/openssl/openssl/crypto/x509v3/v3nametest.c @@ -6,12 +6,16 @@ static const char *const names[] = { "a", "b", ".", "*", "@", ".a", "a.", ".b", "b.", ".*", "*.", "*@", "@*", "a@", "@a", "b@", "..", + "-example.com", "example-.com", "@@", "**", "*.com", "*com", "*.*.com", "*com", "com*", "*example.com", "*@example.com", "test@*.example.com", "example.com", "www.example.com", "test.www.example.com", "*.example.com", "*.www.example.com", "test.*.example.com", "www.*.com", ".www.example.com", "*www.example.com", "example.net", "xn--rger-koa.example.com", + "*.xn--rger-koa.example.com", "www.xn--rger-koa.example.com", + "*.good--example.com", "www.good--example.com", + "*.xn--bar.com", "xn--foo.xn--bar.com", "a.example.com", "b.example.com", "postmaster@example.com", "Postmaster@example.com", "postmaster@EXAMPLE.COM", @@ -27,6 +31,9 @@ static const char *const exceptions[] = { "set CN: host: [*.www.example.com] matches [.www.example.com]", "set CN: host: [*www.example.com] matches [www.example.com]", "set CN: host: [test.www.example.com] matches [.www.example.com]", + "set CN: host: [*.xn--rger-koa.example.com] matches [www.xn--rger-koa.example.com]", + "set CN: host: [*.xn--bar.com] matches [xn--foo.xn--bar.com]", + "set CN: host: [*.good--example.com] matches [www.good--example.com]", "set CN: host-no-wildcards: [*.www.example.com] matches [.www.example.com]", "set CN: host-no-wildcards: [test.www.example.com] matches [.www.example.com]", "set emailAddress: email: [postmaster@example.com] does not match [Postmaster@example.com]", @@ -43,6 +50,9 @@ static const char *const exceptions[] = { "set dnsName: host: [*.www.example.com] matches [.www.example.com]", "set dnsName: host: [*www.example.com] matches [www.example.com]", "set dnsName: host: [test.www.example.com] matches [.www.example.com]", + "set dnsName: host: [*.xn--rger-koa.example.com] matches [www.xn--rger-koa.example.com]", + "set dnsName: host: [*.xn--bar.com] matches [xn--foo.xn--bar.com]", + "set dnsName: host: [*.good--example.com] matches [www.good--example.com]", "set rfc822Name: email: [postmaster@example.com] does not match [Postmaster@example.com]", "set rfc822Name: email: [Postmaster@example.com] does not match [postmaster@example.com]", "set rfc822Name: email: [Postmaster@example.com] does not match [postmaster@EXAMPLE.COM]", diff --git a/vendor/openssl/openssl/demos/easy_tls/easy-tls.c b/vendor/openssl/openssl/demos/easy_tls/easy-tls.c index 5682e91a4..ebcadafa7 100644 --- a/vendor/openssl/openssl/demos/easy_tls/easy-tls.c +++ b/vendor/openssl/openssl/demos/easy_tls/easy-tls.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; c-file-style: "bsd" -*- */ +/* */ /*- * easy-tls.c -- generic TLS proxy. * $Id: easy-tls.c,v 1.4 2002/03/05 09:07:16 bodo Exp $ diff --git a/vendor/openssl/openssl/demos/easy_tls/easy-tls.h b/vendor/openssl/openssl/demos/easy_tls/easy-tls.h index 1c587b861..b88d21c57 100644 --- a/vendor/openssl/openssl/demos/easy_tls/easy-tls.h +++ b/vendor/openssl/openssl/demos/easy_tls/easy-tls.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; c-file-style: "bsd" -*- */ +/* */ /*- * easy-tls.h -- generic TLS proxy. * $Id: easy-tls.h,v 1.1 2001/09/17 19:06:59 bodo Exp $ diff --git a/vendor/openssl/openssl/demos/tunala/tunala.c b/vendor/openssl/openssl/demos/tunala/tunala.c index 11a7c5bb1..3ceea02fa 100644 --- a/vendor/openssl/openssl/demos/tunala/tunala.c +++ b/vendor/openssl/openssl/demos/tunala/tunala.c @@ -1154,7 +1154,7 @@ static int tunala_item_io(tunala_selector_t * selector, tunala_item_t * item) /* * This function name is attributed to the term donated by David Schwartz * on openssl-dev, message-ID: - * . :-) + * . :-) */ if (!state_machine_churn(&item->sm)) /* diff --git a/vendor/openssl/openssl/doc/apps/ciphers.pod b/vendor/openssl/openssl/doc/apps/ciphers.pod index 1c26e3b3d..922455725 100644 --- a/vendor/openssl/openssl/doc/apps/ciphers.pod +++ b/vendor/openssl/openssl/doc/apps/ciphers.pod @@ -38,25 +38,21 @@ SSL v2 and for SSL v3/TLS v1. Like B<-v>, but include cipher suite codes in output (hex format). -=item B<-ssl3> +=item B<-ssl3>, B<-tls1> -only include SSL v3 ciphers. +This lists ciphers compatible with any of SSLv3, TLSv1, TLSv1.1 or TLSv1.2. =item B<-ssl2> -only include SSL v2 ciphers. - -=item B<-tls1> - -only include TLS v1 ciphers. +Only include SSLv2 ciphers. =item B<-h>, B<-?> -print a brief usage message. +Print a brief usage message. =item B -a cipher list to convert to a cipher preference list. If it is not included +A cipher list to convert to a cipher preference list. If it is not included then the default cipher list will be used. The format is described below. =back @@ -109,9 +105,10 @@ The following is a list of all permitted cipher strings and their meanings. =item B -the default cipher list. This is determined at compile time and -is normally B. This must be the firstcipher string -specified. +The default cipher list. +This is determined at compile time and is normally +B. +When used, this must be the first cipherstring specified. =item B @@ -139,34 +136,46 @@ than 128 bits, and some cipher suites with 128-bit keys. =item B -"low" encryption cipher suites, currently those using 64 or 56 bit encryption algorithms -but excluding export cipher suites. +Low strength encryption cipher suites, currently those using 64 or 56 bit +encryption algorithms but excluding export cipher suites. +As of OpenSSL 1.0.2g, these are disabled in default builds. =item B, B -export encryption algorithms. Including 40 and 56 bits algorithms. +Export strength encryption algorithms. Including 40 and 56 bits algorithms. +As of OpenSSL 1.0.2g, these are disabled in default builds. =item B -40 bit export encryption algorithms +40-bit export encryption algorithms +As of OpenSSL 1.0.2g, these are disabled in default builds. =item B -56 bit export encryption algorithms. In OpenSSL 0.9.8c and later the set of +56-bit export encryption algorithms. In OpenSSL 0.9.8c and later the set of 56 bit export ciphers is empty unless OpenSSL has been explicitly configured with support for experimental ciphers. +As of OpenSSL 1.0.2g, these are disabled in default builds. =item B, B -the "NULL" ciphers that is those offering no encryption. Because these offer no -encryption at all and are a security risk they are disabled unless explicitly -included. +The "NULL" ciphers that is those offering no encryption. Because these offer no +encryption at all and are a security risk they are not enabled via either the +B or B cipher strings. +Be careful when building cipherlists out of lower-level primitives such as +B or B as these do overlap with the B ciphers. +When in doubt, include B in your cipherlist. =item B -the cipher suites offering no authentication. This is currently the anonymous +The cipher suites offering no authentication. This is currently the anonymous DH algorithms and anonymous ECDH algorithms. These cipher suites are vulnerable to a "man in the middle" attack and so their use is normally discouraged. +These are excluded from the B ciphers, but included in the B +ciphers. +Be careful when building cipherlists out of lower-level primitives such as +B or B as these do overlap with the B ciphers. +When in doubt, include B in your cipherlist. =item B, B @@ -582,11 +591,11 @@ Note: these ciphers can also be used in SSL v3. =head2 Deprecated SSL v2.0 cipher suites. SSL_CK_RC4_128_WITH_MD5 RC4-MD5 - SSL_CK_RC4_128_EXPORT40_WITH_MD5 EXP-RC4-MD5 - SSL_CK_RC2_128_CBC_WITH_MD5 RC2-MD5 - SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5 EXP-RC2-MD5 + SSL_CK_RC4_128_EXPORT40_WITH_MD5 Not implemented. + SSL_CK_RC2_128_CBC_WITH_MD5 RC2-CBC-MD5 + SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5 Not implemented. SSL_CK_IDEA_128_CBC_WITH_MD5 IDEA-CBC-MD5 - SSL_CK_DES_64_CBC_WITH_MD5 DES-CBC-MD5 + SSL_CK_DES_64_CBC_WITH_MD5 Not implemented. SSL_CK_DES_192_EDE3_CBC_WITH_MD5 DES-CBC3-MD5 =head1 NOTES diff --git a/vendor/openssl/openssl/doc/apps/ocsp.pod b/vendor/openssl/openssl/doc/apps/ocsp.pod index 4639502a0..9833f0813 100644 --- a/vendor/openssl/openssl/doc/apps/ocsp.pod +++ b/vendor/openssl/openssl/doc/apps/ocsp.pod @@ -29,7 +29,7 @@ B B [B<-path>] [B<-CApath dir>] [B<-CAfile file>] -[B<-no_alt_chains>]] +[B<-no_alt_chains>] [B<-VAfile file>] [B<-validity_period n>] [B<-status_age n>] diff --git a/vendor/openssl/openssl/doc/apps/pkeyutl.pod b/vendor/openssl/openssl/doc/apps/pkeyutl.pod index 27be9a900..5da347c97 100644 --- a/vendor/openssl/openssl/doc/apps/pkeyutl.pod +++ b/vendor/openssl/openssl/doc/apps/pkeyutl.pod @@ -137,6 +137,19 @@ Unless otherwise mentioned all algorithms support the B option which specifies the digest in use for sign, verify and verifyrecover operations. The value B should represent a digest name as used in the EVP_get_digestbyname() function for example B. +This value is used only for sanity-checking the lengths of data passed in to +the B and for creating the structures that make up the signature +(e.g. B in RSASSA PKCS#1 v1.5 signatures). +In case of RSA, ECDSA and DSA signatures, this utility +will not perform hashing on input data but rather use the data directly as +input of signature algorithm. Depending on key type, signature type and mode +of padding, the maximum acceptable lengths of input data differ. In general, +with RSA the signed data can't be longer than the key modulus, in case of ECDSA +and DSA the data shouldn't be longer than field size, otherwise it will be +silently truncated to field size. + +In other words, if the value of digest is B the input should be 20 bytes +long binary encoding of SHA-1 hash function output. =head1 RSA ALGORITHM diff --git a/vendor/openssl/openssl/doc/apps/req.pod b/vendor/openssl/openssl/doc/apps/req.pod index 54a4d394d..30653e509 100644 --- a/vendor/openssl/openssl/doc/apps/req.pod +++ b/vendor/openssl/openssl/doc/apps/req.pod @@ -347,9 +347,12 @@ configuration file values. =item B -This specifies the default key size in bits. If not specified then -512 is used. It is used if the B<-new> option is used. It can be -overridden by using the B<-newkey> option. +Specifies the default key size in bits. + +This option is used in conjunction with the B<-new> option to generate +a new key. It can be overridden by specifying an explicit key size in +the B<-newkey> option. The smallest accepted key size is 512 bits. If +no key size is specified then 2048 bits is used. =item B diff --git a/vendor/openssl/openssl/doc/apps/s_client.pod b/vendor/openssl/openssl/doc/apps/s_client.pod index 84d052706..618df9659 100644 --- a/vendor/openssl/openssl/doc/apps/s_client.pod +++ b/vendor/openssl/openssl/doc/apps/s_client.pod @@ -201,15 +201,11 @@ Use the PSK key B when using a PSK cipher suite. The key is given as a hexadecimal number without leading 0x, for example -psk 1a2b3c4d. -=item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1>, B<-no_tls1_1>, B<-no_tls1_2> +=item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-tls1_1>, B<-tls1_2>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1>, B<-no_tls1_1>, B<-no_tls1_2> -these options disable the use of certain SSL or TLS protocols. By default -the initial handshake uses a method which should be compatible with all -servers and permit them to use SSL v3, SSL v2 or TLS as appropriate. - -Unfortunately there are still ancient and broken servers in use which -cannot handle this technique and will fail to connect. Some servers only -work if TLS is turned off. +These options require or disable the use of the specified SSL or TLS protocols. +By default the initial handshake uses a I method which will +negotiate the highest mutually supported protocol version. =item B<-fallback_scsv> diff --git a/vendor/openssl/openssl/doc/apps/s_server.pod b/vendor/openssl/openssl/doc/apps/s_server.pod index baca77924..6f4acb700 100644 --- a/vendor/openssl/openssl/doc/apps/s_server.pod +++ b/vendor/openssl/openssl/doc/apps/s_server.pod @@ -217,11 +217,11 @@ Use the PSK key B when using a PSK cipher suite. The key is given as a hexadecimal number without leading 0x, for example -psk 1a2b3c4d. -=item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1> +=item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-tls1_1>, B<-tls1_2>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1>, B<-no_tls1_1>, B<-no_tls1_2> -these options disable the use of certain SSL or TLS protocols. By default -the initial handshake uses a method which should be compatible with all -servers and permit them to use SSL v3, SSL v2 or TLS as appropriate. +These options require or disable the use of the specified SSL or TLS protocols. +By default the initial handshake uses a I method which will +negotiate the highest mutually supported protocol version. =item B<-bugs> diff --git a/vendor/openssl/openssl/doc/apps/s_time.pod b/vendor/openssl/openssl/doc/apps/s_time.pod index 5a38aa2e0..9082d876f 100644 --- a/vendor/openssl/openssl/doc/apps/s_time.pod +++ b/vendor/openssl/openssl/doc/apps/s_time.pod @@ -26,7 +26,7 @@ B B =head1 DESCRIPTION -The B command implements a generic SSL/TLS client which connects to a +The B command implements a generic SSL/TLS client which connects to a remote host using SSL/TLS. It can request a page from the server and includes the time to transfer the payload data in its timing measurements. It measures the number of connections within a given timeframe, the amount of data @@ -127,7 +127,7 @@ and the link speed determine how many connections B can establish. =head1 NOTES -B can be used to measure the performance of an SSL connection. +B can be used to measure the performance of an SSL connection. To connect to an SSL HTTP server and get the default page the command openssl s_time -connect servername:443 -www / -CApath yourdir -CAfile yourfile.pem -cipher commoncipher [-ssl3] diff --git a/vendor/openssl/openssl/doc/crypto/BIO_s_connect.pod b/vendor/openssl/openssl/doc/crypto/BIO_s_connect.pod index 18ece4c91..345a468a5 100644 --- a/vendor/openssl/openssl/doc/crypto/BIO_s_connect.pod +++ b/vendor/openssl/openssl/doc/crypto/BIO_s_connect.pod @@ -21,8 +21,8 @@ BIO_set_nbio, BIO_do_connect - connect BIO long BIO_set_conn_int_port(BIO *b, char *port); char *BIO_get_conn_hostname(BIO *b); char *BIO_get_conn_port(BIO *b); - char *BIO_get_conn_ip(BIO *b, dummy); - long BIO_get_conn_int_port(BIO *b, int port); + char *BIO_get_conn_ip(BIO *b); + long BIO_get_conn_int_port(BIO *b); long BIO_set_nbio(BIO *b, long n); diff --git a/vendor/openssl/openssl/doc/crypto/BIO_s_mem.pod b/vendor/openssl/openssl/doc/crypto/BIO_s_mem.pod index 8f85e0dce..9f239648d 100644 --- a/vendor/openssl/openssl/doc/crypto/BIO_s_mem.pod +++ b/vendor/openssl/openssl/doc/crypto/BIO_s_mem.pod @@ -16,7 +16,7 @@ BIO_get_mem_ptr, BIO_new_mem_buf - memory BIO BIO_set_mem_buf(BIO *b,BUF_MEM *bm,int c) BIO_get_mem_ptr(BIO *b,BUF_MEM **pp) - BIO *BIO_new_mem_buf(void *buf, int len); + BIO *BIO_new_mem_buf(const void *buf, int len); =head1 DESCRIPTION @@ -61,7 +61,7 @@ BIO_get_mem_ptr() places the underlying BUF_MEM structure in B. It is a macro. BIO_new_mem_buf() creates a memory BIO using B bytes of data at B, -if B is -1 then the B is assumed to be null terminated and its +if B is -1 then the B is assumed to be nul terminated and its length is determined by B. The BIO is set to a read only state and as a result cannot be written to. This is useful when some data needs to be made available from a static area of memory in the form of a BIO. The diff --git a/vendor/openssl/openssl/doc/crypto/EVP_EncodeInit.pod b/vendor/openssl/openssl/doc/crypto/EVP_EncodeInit.pod new file mode 100755 index 000000000..c6f12674f --- /dev/null +++ b/vendor/openssl/openssl/doc/crypto/EVP_EncodeInit.pod @@ -0,0 +1,127 @@ +=pod + +=head1 NAME + +EVP_EncodeInit, EVP_EncodeUpdate, EVP_EncodeFinal, EVP_EncodeBlock, +EVP_DecodeInit, EVP_DecodeUpdate, EVP_DecodeFinal, EVP_DecodeBlock - EVP base 64 +encode/decode routines + +=head1 SYNOPSIS + + #include + + void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); + void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, + const unsigned char *in, int inl); + void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); + int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); + + void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); + int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, + const unsigned char *in, int inl); + int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned + char *out, int *outl); + int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); + +=head1 DESCRIPTION + +The EVP encode routines provide a high level interface to base 64 encoding and +decoding. Base 64 encoding converts binary data into a printable form that uses +the characters A-Z, a-z, 0-9, "+" and "/" to represent the data. For every 3 +bytes of binary data provided 4 bytes of base 64 encoded data will be produced +plus some occasional newlines (see below). If the input data length is not a +multiple of 3 then the output data will be padded at the end using the "=" +character. + +Encoding of binary data is performed in blocks of 48 input bytes (or less for +the final block). For each 48 byte input block encoded 64 bytes of base 64 data +is output plus an additional newline character (i.e. 65 bytes in total). The +final block (which may be less than 48 bytes) will output 4 bytes for every 3 +bytes of input. If the data length is not divisible by 3 then a full 4 bytes is +still output for the final 1 or 2 bytes of input. Similarly a newline character +will also be output. + +EVP_EncodeInit() initialises B for the start of a new encoding operation. + +EVP_EncodeUpdate() encode B bytes of data found in the buffer pointed to by +B. The output is stored in the buffer B and the number of bytes output +is stored in B<*outl>. It is the caller's responsibility to ensure that the +buffer at B is sufficiently large to accommodate the output data. Only full +blocks of data (48 bytes) will be immediately processed and output by this +function. Any remainder is held in the B object and will be processed by a +subsequent call to EVP_EncodeUpdate() or EVP_EncodeFinal(). To calculate the +required size of the output buffer add together the value of B with the +amount of unprocessed data held in B and divide the result by 48 (ignore +any remainder). This gives the number of blocks of data that will be processed. +Ensure the output buffer contains 65 bytes of storage for each block, plus an +additional byte for a NUL terminator. EVP_EncodeUpdate() may be called +repeatedly to process large amounts of input data. In the event of an error +EVP_EncodeUpdate() will set B<*outl> to 0. + +EVP_EncodeFinal() must be called at the end of an encoding operation. It will +process any partial block of data remaining in the B object. The output +data will be stored in B and the length of the data written will be stored +in B<*outl>. It is the caller's responsibility to ensure that B is +sufficiently large to accommodate the output data which will never be more than +65 bytes plus an additional NUL terminator (i.e. 66 bytes in total). + +EVP_EncodeBlock() encodes a full block of input data in B and of length +B and stores it in B. For every 3 bytes of input provided 4 bytes of +output data will be produced. If B is not divisible by 3 then the block is +encoded as a final block of data and the output is padded such that it is always +divisible by 4. Additionally a NUL terminator character will be added. For +example if 16 bytes of input data is provided then 24 bytes of encoded data is +created plus 1 byte for a NUL terminator (i.e. 25 bytes in total). The length of +the data generated I the NUL terminator is returned from the function. + +EVP_DecodeInit() initialises B for the start of a new decoding operation. + +EVP_DecodeUpdate() decodes B characters of data found in the buffer pointed +to by B. The output is stored in the buffer B and the number of bytes +output is stored in B<*outl>. It is the caller's responsibility to ensure that +the buffer at B is sufficiently large to accommodate the output data. This +function will attempt to decode as much data as possible in 4 byte chunks. Any +whitespace, newline or carriage return characters are ignored. Any partial chunk +of unprocessed data (1, 2 or 3 bytes) that remains at the end will be held in +the B object and processed by a subsequent call to EVP_DecodeUpdate(). If +any illegal base 64 characters are encountered or if the base 64 padding +character "=" is encountered in the middle of the data then the function returns +-1 to indicate an error. A return value of 0 or 1 indicates successful +processing of the data. A return value of 0 additionally indicates that the last +input data characters processed included the base 64 padding character "=" and +therefore no more non-padding character data is expected to be processed. For +every 4 valid base 64 bytes processed (ignoring whitespace, carriage returns and +line feeds), 3 bytes of binary output data will be produced (or less at the end +of the data where the padding character "=" has been used). + +EVP_DecodeFinal() must be called at the end of a decoding operation. If there +is any unprocessed data still in B then the input data must not have been +a multiple of 4 and therefore an error has occurred. The function will return -1 +in this case. Otherwise the function returns 1 on success. + +EVP_DecodeBlock() will decode the block of B characters of base 64 data +contained in B and store the result in B. Any leading whitespace will be +trimmed as will any trailing whitespace, newlines, carriage returns or EOF +characters. After such trimming the length of the data in B must be divisbile +by 4. For every 4 input bytes exactly 3 output bytes will be produced. The +output will be padded with 0 bits if necessary to ensure that the output is +always 3 bytes for every 4 input bytes. This function will return the length of +the data decoded or -1 on error. + +=head1 RETURN VALUES + +EVP_EncodeBlock() returns the number of bytes encoded excluding the NUL +terminator. + +EVP_DecodeUpdate() returns -1 on error and 0 or 1 on success. If 0 is returned +then no more non-padding base 64 characters are expected. + +EVP_DecodeFinal() returns -1 on error or 1 on success. + +EVP_DecodeBlock() returns the length of the data decoded or -1 on error. + +=head1 SEE ALSO + +L + +=cut diff --git a/vendor/openssl/openssl/doc/crypto/evp.pod b/vendor/openssl/openssl/doc/crypto/evp.pod index 29fab9fd5..303cd95a7 100644 --- a/vendor/openssl/openssl/doc/crypto/evp.pod +++ b/vendor/openssl/openssl/doc/crypto/evp.pod @@ -61,6 +61,10 @@ based encryption. Careful selection of the parameters will provide a PKCS#5 PBKD implementation. However, new applications should not typically use this (preferring, for example, PBKDF2 from PCKS#5). +The LI<...>|EVP_EncodeInit(3)> and +LI<...>|EVP_EncodeInit(3)> functions implement base 64 encoding +and decoding. + Algorithms are loaded with L. All the symmetric algorithms (ciphers), digests and asymmetric algorithms @@ -86,6 +90,7 @@ L, L, L, L, +L, L, L, L, diff --git a/vendor/openssl/openssl/doc/ssl/SSL_CONF_cmd.pod b/vendor/openssl/openssl/doc/ssl/SSL_CONF_cmd.pod index 2bf1a60e9..e81d76ae7 100644 --- a/vendor/openssl/openssl/doc/ssl/SSL_CONF_cmd.pod +++ b/vendor/openssl/openssl/doc/ssl/SSL_CONF_cmd.pod @@ -74,7 +74,7 @@ B). Curve names are case sensitive. =item B<-named_curve> -This sets the temporary curve used for ephemeral ECDH modes. Only used by +This sets the temporary curve used for ephemeral ECDH modes. Only used by servers The B argument is a curve name or the special value B which @@ -85,7 +85,7 @@ can be either the B name (e.g. B) or an OpenSSL OID name =item B<-cipher> Sets the cipher suite list to B. Note: syntax checking of B is -currently not performed unless a B or B structure is +currently not performed unless a B or B structure is associated with B. =item B<-cert> @@ -111,9 +111,9 @@ operations are permitted. =item B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1>, B<-no_tls1_1>, B<-no_tls1_2> -Disables protocol support for SSLv2, SSLv3, TLS 1.0, TLS 1.1 or TLS 1.2 -by setting the corresponding options B, B, -B, B and B respectively. +Disables protocol support for SSLv2, SSLv3, TLSv1.0, TLSv1.1 or TLSv1.2 +by setting the corresponding options B, B, +B, B and B respectively. =item B<-bugs> @@ -177,7 +177,7 @@ Note: the command prefix (if set) alters the recognised B values. =item B Sets the cipher suite list to B. Note: syntax checking of B is -currently not performed unless an B or B structure is +currently not performed unless an B or B structure is associated with B. =item B @@ -244,7 +244,7 @@ B). Curve names are case sensitive. =item B -This sets the temporary curve used for ephemeral ECDH modes. Only used by +This sets the temporary curve used for ephemeral ECDH modes. Only used by servers The B argument is a curve name or the special value B which @@ -258,10 +258,11 @@ The supported versions of the SSL or TLS protocol. The B argument is a comma separated list of supported protocols to enable or disable. If an protocol is preceded by B<-> that version is disabled. -All versions are enabled by default, though applications may choose to -explicitly disable some. Currently supported protocol values are B, -B, B, B and B. The special value B refers -to all supported versions. +Currently supported protocol values are B, B, B, +B and B. +All protocol versions other than B are enabled by default. +To avoid inadvertent enabling of B, when SSLv2 is disabled, it is not +possible to enable it via the B command. =item B @@ -339,16 +340,16 @@ The value is a directory name. The order of operations is significant. This can be used to set either defaults or values which cannot be overridden. For example if an application calls: - SSL_CONF_cmd(ctx, "Protocol", "-SSLv2"); + SSL_CONF_cmd(ctx, "Protocol", "-SSLv3"); SSL_CONF_cmd(ctx, userparam, uservalue); -it will disable SSLv2 support by default but the user can override it. If +it will disable SSLv3 support by default but the user can override it. If however the call sequence is: SSL_CONF_cmd(ctx, userparam, uservalue); - SSL_CONF_cmd(ctx, "Protocol", "-SSLv2"); + SSL_CONF_cmd(ctx, "Protocol", "-SSLv3"); -SSLv2 is B disabled and attempt to override this by the user are +then SSLv3 is B disabled and attempt to override this by the user are ignored. By checking the return code of SSL_CTX_cmd() it is possible to query if a @@ -372,7 +373,7 @@ can be checked instead. If -3 is returned a required argument is missing and an error is indicated. If 0 is returned some other error occurred and this can be reported back to the user. -The function SSL_CONF_cmd_value_type() can be used by applications to +The function SSL_CONF_cmd_value_type() can be used by applications to check for the existence of a command or to perform additional syntax checking or translation of the command value. For example if the return value is B an application could translate a relative diff --git a/vendor/openssl/openssl/doc/ssl/SSL_CTX_new.pod b/vendor/openssl/openssl/doc/ssl/SSL_CTX_new.pod index 491ac8c17..b8cc87978 100644 --- a/vendor/openssl/openssl/doc/ssl/SSL_CTX_new.pod +++ b/vendor/openssl/openssl/doc/ssl/SSL_CTX_new.pod @@ -2,13 +2,55 @@ =head1 NAME -SSL_CTX_new - create a new SSL_CTX object as framework for TLS/SSL enabled functions +SSL_CTX_new, +SSLv23_method, SSLv23_server_method, SSLv23_client_method, +TLSv1_2_method, TLSv1_2_server_method, TLSv1_2_client_method, +TLSv1_1_method, TLSv1_1_server_method, TLSv1_1_client_method, +TLSv1_method, TLSv1_server_method, TLSv1_client_method, +SSLv3_method, SSLv3_server_method, SSLv3_client_method, +SSLv2_method, SSLv2_server_method, SSLv2_client_method, +DTLS_method, DTLS_server_method, DTLS_client_method, +DTLSv1_2_method, DTLSv1_2_server_method, DTLSv1_2_client_method, +DTLSv1_method, DTLSv1_server_method, DTLSv1_client_method - +create a new SSL_CTX object as framework for TLS/SSL enabled functions =head1 SYNOPSIS #include SSL_CTX *SSL_CTX_new(const SSL_METHOD *method); + const SSL_METHOD *SSLv23_method(void); + const SSL_METHOD *SSLv23_server_method(void); + const SSL_METHOD *SSLv23_client_method(void); + const SSL_METHOD *TLSv1_2_method(void); + const SSL_METHOD *TLSv1_2_server_method(void); + const SSL_METHOD *TLSv1_2_client_method(void); + const SSL_METHOD *TLSv1_1_method(void); + const SSL_METHOD *TLSv1_1_server_method(void); + const SSL_METHOD *TLSv1_1_client_method(void); + const SSL_METHOD *TLSv1_method(void); + const SSL_METHOD *TLSv1_server_method(void); + const SSL_METHOD *TLSv1_client_method(void); + #ifndef OPENSSL_NO_SSL3_METHOD + const SSL_METHOD *SSLv3_method(void); + const SSL_METHOD *SSLv3_server_method(void); + const SSL_METHOD *SSLv3_client_method(void); + #endif + #ifndef OPENSSL_NO_SSL2 + const SSL_METHOD *SSLv2_method(void); + const SSL_METHOD *SSLv2_server_method(void); + const SSL_METHOD *SSLv2_client_method(void); + #endif + + const SSL_METHOD *DTLS_method(void); + const SSL_METHOD *DTLS_server_method(void); + const SSL_METHOD *DTLS_client_method(void); + const SSL_METHOD *DTLSv1_2_method(void); + const SSL_METHOD *DTLSv1_2_server_method(void); + const SSL_METHOD *DTLSv1_2_client_method(void); + const SSL_METHOD *DTLSv1_method(void); + const SSL_METHOD *DTLSv1_server_method(void); + const SSL_METHOD *DTLSv1_client_method(void); =head1 DESCRIPTION @@ -23,65 +65,88 @@ client only type. B can be of the following types: =over 4 -=item SSLv2_method(void), SSLv2_server_method(void), SSLv2_client_method(void) +=item SSLv23_method(), SSLv23_server_method(), SSLv23_client_method() + +These are the general-purpose I SSL/TLS methods. +The actual protocol version used will be negotiated to the highest version +mutually supported by the client and the server. +The supported protocols are SSLv2, SSLv3, TLSv1, TLSv1.1 and TLSv1.2. +Most applications should use these method, and avoid the version specific +methods described below. + +The list of protocols available can be further limited using the +B, B, B, +B and B options of the +L or L functions. +Clients should avoid creating "holes" in the set of protocols they support, +when disabling a protocol, make sure that you also disable either all previous +or all subsequent protocol versions. +In clients, when a protocol version is disabled without disabling I +previous protocol versions, the effect is to also disable all subsequent +protocol versions. + +The SSLv2 and SSLv3 protocols are deprecated and should generally not be used. +Applications should typically use L in combination with +the B flag to disable negotiation of SSLv3 via the above +I SSL/TLS methods. +The B option is set by default, and would need to be cleared +via L in order to enable negotiation of SSLv2. + +=item TLSv1_2_method(), TLSv1_2_server_method(), TLSv1_2_client_method() -A TLS/SSL connection established with these methods will only understand -the SSLv2 protocol. A client will send out SSLv2 client hello messages -and will also indicate that it only understand SSLv2. A server will only -understand SSLv2 client hello messages. +A TLS/SSL connection established with these methods will only understand the +TLSv1.2 protocol. A client will send out TLSv1.2 client hello messages and +will also indicate that it only understand TLSv1.2. A server will only +understand TLSv1.2 client hello messages. -=item SSLv3_method(void), SSLv3_server_method(void), SSLv3_client_method(void) +=item TLSv1_1_method(), TLSv1_1_server_method(), TLSv1_1_client_method() A TLS/SSL connection established with these methods will only understand the -SSLv3 protocol. A client will send out SSLv3 client hello messages -and will indicate that it only understands SSLv3. A server will only understand -SSLv3 client hello messages. This especially means, that it will -not understand SSLv2 client hello messages which are widely used for -compatibility reasons, see SSLv23_*_method(). +TLSv1.1 protocol. A client will send out TLSv1.1 client hello messages and +will also indicate that it only understand TLSv1.1. A server will only +understand TLSv1.1 client hello messages. -=item TLSv1_method(void), TLSv1_server_method(void), TLSv1_client_method(void) +=item TLSv1_method(), TLSv1_server_method(), TLSv1_client_method() A TLS/SSL connection established with these methods will only understand the -TLSv1 protocol. A client will send out TLSv1 client hello messages -and will indicate that it only understands TLSv1. A server will only understand -TLSv1 client hello messages. This especially means, that it will -not understand SSLv2 client hello messages which are widely used for -compatibility reasons, see SSLv23_*_method(). It will also not understand -SSLv3 client hello messages. - -=item SSLv23_method(void), SSLv23_server_method(void), SSLv23_client_method(void) - -A TLS/SSL connection established with these methods may understand the SSLv2, -SSLv3, TLSv1, TLSv1.1 and TLSv1.2 protocols. - -If the cipher list does not contain any SSLv2 ciphersuites (the default -cipher list does not) or extensions are required (for example server name) -a client will send out TLSv1 client hello messages including extensions and -will indicate that it also understands TLSv1.1, TLSv1.2 and permits a -fallback to SSLv3. A server will support SSLv3, TLSv1, TLSv1.1 and TLSv1.2 -protocols. This is the best choice when compatibility is a concern. - -If any SSLv2 ciphersuites are included in the cipher list and no extensions -are required then SSLv2 compatible client hellos will be used by clients and -SSLv2 will be accepted by servers. This is B recommended due to the -insecurity of SSLv2 and the limited nature of the SSLv2 client hello -prohibiting the use of extensions. +TLSv1 protocol. A client will send out TLSv1 client hello messages and will +indicate that it only understands TLSv1. A server will only understand TLSv1 +client hello messages. -=back +=item SSLv3_method(), SSLv3_server_method(), SSLv3_client_method() + +A TLS/SSL connection established with these methods will only understand the +SSLv3 protocol. A client will send out SSLv3 client hello messages and will +indicate that it only understands SSLv3. A server will only understand SSLv3 +client hello messages. The SSLv3 protocol is deprecated and should not be +used. + +=item SSLv2_method(), SSLv2_server_method(), SSLv2_client_method() + +A TLS/SSL connection established with these methods will only understand the +SSLv2 protocol. A client will send out SSLv2 client hello messages and will +also indicate that it only understand SSLv2. A server will only understand +SSLv2 client hello messages. The SSLv2 protocol offers little to no security +and should not be used. +As of OpenSSL 1.0.2g, EXPORT ciphers and 56-bit DES are no longer available +with SSLv2. -The list of protocols available can later be limited using the SSL_OP_NO_SSLv2, -SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1 and SSL_OP_NO_TLSv1_2 -options of the SSL_CTX_set_options() or SSL_set_options() functions. -Using these options it is possible to choose e.g. SSLv23_server_method() and -be able to negotiate with all possible clients, but to only allow newer -protocols like TLSv1, TLSv1.1 or TLS v1.2. +=item DTLS_method(), DTLS_server_method(), DTLS_client_method() -Applications which never want to support SSLv2 (even is the cipher string -is configured to use SSLv2 ciphersuites) can set SSL_OP_NO_SSLv2. +These are the version-flexible DTLS methods. + +=item DTLSv1_2_method(), DTLSv1_2_server_method(), DTLSv1_2_client_method() + +These are the version-specific methods for DTLSv1.2. + +=item DTLSv1_method(), DTLSv1_server_method(), DTLSv1_client_method() + +These are the version-specific methods for DTLSv1. + +=back -SSL_CTX_new() initializes the list of ciphers, the session cache setting, -the callbacks, the keys and certificates and the options to its default -values. +SSL_CTX_new() initializes the list of ciphers, the session cache setting, the +callbacks, the keys and certificates and the options to its default values. =head1 RETURN VALUES @@ -91,8 +156,8 @@ The following return values can occur: =item NULL -The creation of a new SSL_CTX object failed. Check the error stack to -find out the reason. +The creation of a new SSL_CTX object failed. Check the error stack to find out +the reason. =item Pointer to an SSL_CTX object @@ -102,6 +167,7 @@ The return value points to an allocated SSL_CTX object. =head1 SEE ALSO +L, L, L, L, L, L, L diff --git a/vendor/openssl/openssl/doc/ssl/SSL_CTX_set1_verify_cert_store.pod b/vendor/openssl/openssl/doc/ssl/SSL_CTX_set1_verify_cert_store.pod index 493cca481..3e3a4fa90 100644 --- a/vendor/openssl/openssl/doc/ssl/SSL_CTX_set1_verify_cert_store.pod +++ b/vendor/openssl/openssl/doc/ssl/SSL_CTX_set1_verify_cert_store.pod @@ -17,10 +17,10 @@ verification or chain store int SSL_CTX_set0_chain_cert_store(SSL_CTX *ctx, X509_STORE *st); int SSL_CTX_set1_chain_cert_store(SSL_CTX *ctx, X509_STORE *st); - int SSL_set0_verify_cert_store(SSL_CTX *ctx, X509_STORE *st); - int SSL_set1_verify_cert_store(SSL_CTX *ctx, X509_STORE *st); - int SSL_set0_chain_cert_store(SSL_CTX *ctx, X509_STORE *st); - int SSL_set1_chain_cert_store(SSL_CTX *ctx, X509_STORE *st); + int SSL_set0_verify_cert_store(SSL *ctx, X509_STORE *st); + int SSL_set1_verify_cert_store(SSL *ctx, X509_STORE *st); + int SSL_set0_chain_cert_store(SSL *ctx, X509_STORE *st); + int SSL_set1_chain_cert_store(SSL *ctx, X509_STORE *st); =head1 DESCRIPTION diff --git a/vendor/openssl/openssl/doc/ssl/SSL_CTX_set_alpn_select_cb.pod b/vendor/openssl/openssl/doc/ssl/SSL_CTX_set_alpn_select_cb.pod new file mode 100755 index 000000000..80ba8ab9c --- /dev/null +++ b/vendor/openssl/openssl/doc/ssl/SSL_CTX_set_alpn_select_cb.pod @@ -0,0 +1,126 @@ +=pod + +=head1 NAME + +SSL_CTX_set_alpn_protos, SSL_set_alpn_protos, SSL_CTX_set_alpn_select_cb, +SSL_select_next_proto, SSL_get0_alpn_selected - handle application layer +protocol negotiation (ALPN) + +=head1 SYNOPSIS + + #include + + int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, + unsigned protos_len); + int SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos, + unsigned protos_len); + void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, + int (*cb) (SSL *ssl, + const unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, + void *arg), void *arg); + int SSL_select_next_proto(unsigned char **out, unsigned char *outlen, + const unsigned char *server, + unsigned int server_len, + const unsigned char *client, + unsigned int client_len) + void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, + unsigned int *len); + +=head1 DESCRIPTION + +SSL_CTX_set_alpn_protos() and SSL_set_alpn_protos() are used by the client to +set the list of protocols available to be negotiated. The B must be in +protocol-list format, described below. The length of B is specified in +B. + +SSL_CTX_set_alpn_select_cb() sets the application callback B used by a +server to select which protocol to use for the incoming connection. When B +is NULL, ALPN is not used. The B value is a pointer which is passed to +the application callback. + +B is the application defined callback. The B, B parameters are a +vector in protocol-list format. The value of the B, B vector +should be set to the value of a single protocol selected from the B, +B vector. The B parameter is the pointer set via +SSL_CTX_set_alpn_select_cb(). + +SSL_select_next_proto() is a helper function used to select protocols. It +implements the standard protocol selection. It is expected that this function +is called from the application callback B. The protocol data in B, +B and B, B must be in the protocol-list format +described below. The first item in the B, B list that +matches an item in the B, B list is selected, and returned +in B, B. The B value will point into either B or +B, so it should be copied immediately. If no match is found, the first +item in B, B is returned in B, B. This +function can also be used in the NPN callback. + +SSL_get0_alpn_selected() returns a pointer to the selected protocol in B +with length B. It is not NUL-terminated. B is set to NULL and B +is set to 0 if no protocol has been selected. B must not be freed. + +=head1 NOTES + +The protocol-lists must be in wire-format, which is defined as a vector of +non-empty, 8-bit length-prefixed, byte strings. The length-prefix byte is not +included in the length. Each string is limited to 255 bytes. A byte-string +length of 0 is invalid. A truncated byte-string is invalid. The length of the +vector is not in the vector itself, but in a separate variable. + +Example: + + unsigned char vector[] = { + 6, 's', 'p', 'd', 'y', '/', '1', + 8, 'h', 't', 't', 'p', '/', '1', '.', '1' + }; + unsigned int length = sizeof(vector); + +The ALPN callback is executed after the servername callback; as that servername +callback may update the SSL_CTX, and subsequently, the ALPN callback. + +If there is no ALPN proposed in the ClientHello, the ALPN callback is not +invoked. + +=head1 RETURN VALUES + +SSL_CTX_set_alpn_protos() and SSL_set_alpn_protos() return 0 on success, and +non-0 on failure. WARNING: these functions reverse the return value convention. + +SSL_select_next_proto() returns one of the following: + +=over 4 + +=item OPENSSL_NPN_NEGOTIATED + +A match was found and is returned in B, B. + +=item OPENSSL_NPN_NO_OVERLAP + +No match was found. The first item in B, B is returned in +B, B. + +=back + +The ALPN select callback B, must return one of the following: + +=over 4 + +=item SSL_TLSEXT_ERR_OK + +ALPN protocol selected. + +=item SSL_TLSEXT_ERR_NOACK + +ALPN protocol not selected. + +=back + +=head1 SEE ALSO + +L, L, +L + +=cut diff --git a/vendor/openssl/openssl/doc/ssl/SSL_CTX_set_options.pod b/vendor/openssl/openssl/doc/ssl/SSL_CTX_set_options.pod index e80a72cd4..9a7e98c1d 100644 --- a/vendor/openssl/openssl/doc/ssl/SSL_CTX_set_options.pod +++ b/vendor/openssl/openssl/doc/ssl/SSL_CTX_set_options.pod @@ -189,15 +189,25 @@ browser has a cert, it will crash/hang. Works for 3.x and 4.xbeta =item SSL_OP_NO_SSLv2 Do not use the SSLv2 protocol. +As of OpenSSL 1.0.2g the B option is set by default. =item SSL_OP_NO_SSLv3 Do not use the SSLv3 protocol. +It is recommended that applications should set this option. =item SSL_OP_NO_TLSv1 Do not use the TLSv1 protocol. +=item SSL_OP_NO_TLSv1_1 + +Do not use the TLSv1.1 protocol. + +=item SSL_OP_NO_TLSv1_2 + +Do not use the TLSv1.2 protocol. + =item SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION When performing renegotiation as a server, always start a new session diff --git a/vendor/openssl/openssl/doc/ssl/SSL_CTX_set_tlsext_status_cb.pod b/vendor/openssl/openssl/doc/ssl/SSL_CTX_set_tlsext_status_cb.pod new file mode 100755 index 000000000..b8147baec --- /dev/null +++ b/vendor/openssl/openssl/doc/ssl/SSL_CTX_set_tlsext_status_cb.pod @@ -0,0 +1,73 @@ +=pod + +=head1 NAME + +SSL_CTX_set_tlsext_status_cb, SSL_CTX_set_tlsext_status_arg, +SSL_set_tlsext_status_type, SSL_get_tlsext_status_ocsp_resp, +SSL_set_tlsext_status_ocsp_resp - OCSP Certificate Status Request functions + +=head1 SYNOPSIS + + #include + + long SSL_CTX_set_tlsext_status_cb(SSL_CTX *ctx, + int (*callback)(SSL *, void *)); + long SSL_CTX_set_tlsext_status_arg(SSL_CTX *ctx, void *arg); + + long SSL_set_tlsext_status_type(SSL *s, int type); + + long SSL_get_tlsext_status_ocsp_resp(ssl, unsigned char **resp); + long SSL_set_tlsext_status_ocsp_resp(ssl, unsigned char *resp, int len); + +=head1 DESCRIPTION + +A client application may request that a server send back an OCSP status response +(also known as OCSP stapling). To do so the client should call the +SSL_set_tlsext_status_type() function prior to the start of the handshake. +Currently the only supported type is B. This value +should be passed in the B argument. The client should additionally provide +a callback function to decide what to do with the returned OCSP response by +calling SSL_CTX_set_tlsext_status_cb(). The callback function should determine +whether the returned OCSP response is acceptable or not. The callback will be +passed as an argument the value previously set via a call to +SSL_CTX_set_tlsext_status_arg(). Note that the callback will not be called in +the event of a handshake where session resumption occurs (because there are no +Certificates exchanged in such a handshake). + +The response returned by the server can be obtained via a call to +SSL_get_tlsext_status_ocsp_resp(). The value B<*resp> will be updated to point +to the OCSP response data and the return value will be the length of that data. +Typically a callback would obtain an OCSP_RESPONSE object from this data via a +call to the d2i_OCSP_RESPONSE() function. If the server has not provided any +response data then B<*resp> will be NULL and the return value from +SSL_get_tlsext_status_ocsp_resp() will be -1. + +A server application must also call the SSL_CTX_set_tlsext_status_cb() function +if it wants to be able to provide clients with OCSP Certificate Status +responses. Typically the server callback would obtain the server certificate +that is being sent back to the client via a call to SSL_get_certificate(); +obtain the OCSP response to be sent back; and then set that response data by +calling SSL_set_tlsext_status_ocsp_resp(). A pointer to the response data should +be provided in the B argument, and the length of that data should be in +the B argument. + +=head1 RETURN VALUES + +The callback when used on the client side should return a negative value on +error; 0 if the response is not acceptable (in which case the handshake will +fail) or a positive value if it is acceptable. + +The callback when used on the server side should return with either +SSL_TLSEXT_ERR_OK (meaning that the OCSP response that has been set should be +returned), SSL_TLSEXT_ERR_NOACK (meaning that an OCSP response should not be +returned) or SSL_TLSEXT_ERR_ALERT_FATAL (meaning that a fatal error has +occurred). + +SSL_CTX_set_tlsext_status_cb(), SSL_CTX_set_tlsext_status_arg(), +SSL_set_tlsext_status_type() and SSL_set_tlsext_status_ocsp_resp() return 0 on +error or 1 on success. + +SSL_get_tlsext_status_ocsp_resp() returns the length of the OCSP response data +or -1 if there is no OCSP response data. + +=cut diff --git a/vendor/openssl/openssl/doc/ssl/SSL_CTX_set_tmp_dh_callback.pod b/vendor/openssl/openssl/doc/ssl/SSL_CTX_set_tmp_dh_callback.pod index b754c16a8..234fbc845 100644 --- a/vendor/openssl/openssl/doc/ssl/SSL_CTX_set_tmp_dh_callback.pod +++ b/vendor/openssl/openssl/doc/ssl/SSL_CTX_set_tmp_dh_callback.pod @@ -48,25 +48,8 @@ even if he gets hold of the normal (certified) key, as this key was only used for signing. In order to perform a DH key exchange the server must use a DH group -(DH parameters) and generate a DH key. -The server will always generate a new DH key during the negotiation -if either the DH parameters are supplied via callback or the -SSL_OP_SINGLE_DH_USE option of SSL_CTX_set_options(3) is set (or both). -It will immediately create a DH key if DH parameters are supplied via -SSL_CTX_set_tmp_dh() and SSL_OP_SINGLE_DH_USE is not set. -In this case, -it may happen that a key is generated on initialization without later -being needed, while on the other hand the computer time during the -negotiation is being saved. - -If "strong" primes were used to generate the DH parameters, it is not strictly -necessary to generate a new key for each handshake but it does improve forward -secrecy. If it is not assured that "strong" primes were used, -SSL_OP_SINGLE_DH_USE must be used in order to prevent small subgroup -attacks. Always using SSL_OP_SINGLE_DH_USE has an impact on the -computer time needed during negotiation, but it is not very large, so -application authors/users should consider always enabling this option. -The option is required to implement perfect forward secrecy (PFS). +(DH parameters) and generate a DH key. The server will always generate +a new DH key during the negotiation. As generating DH parameters is extremely time consuming, an application should not generate the parameters on the fly but supply the parameters. @@ -93,10 +76,9 @@ can supply the DH parameters via a callback function. Previous versions of the callback used B and B parameters to control parameter generation for export and non-export cipher suites. Modern servers that do not support export ciphersuites -are advised to either use SSL_CTX_set_tmp_dh() in combination with -SSL_OP_SINGLE_DH_USE, or alternatively, use the callback but ignore -B and B and simply supply at least 2048-bit -parameters in the callback. +are advised to either use SSL_CTX_set_tmp_dh() or alternatively, use +the callback but ignore B and B and simply +supply at least 2048-bit parameters in the callback. =head1 EXAMPLES @@ -128,7 +110,6 @@ partly left out.) if (SSL_CTX_set_tmp_dh(ctx, dh_2048) != 1) { /* Error. */ } - SSL_CTX_set_options(ctx, SSL_OP_SINGLE_DH_USE); ... =head1 RETURN VALUES diff --git a/vendor/openssl/openssl/doc/ssl/SSL_CTX_use_serverinfo.pod b/vendor/openssl/openssl/doc/ssl/SSL_CTX_use_serverinfo.pod index 318e052e2..caeb28de7 100644 --- a/vendor/openssl/openssl/doc/ssl/SSL_CTX_use_serverinfo.pod +++ b/vendor/openssl/openssl/doc/ssl/SSL_CTX_use_serverinfo.pod @@ -30,6 +30,14 @@ must consist of a 2-byte Extension Type, a 2-byte length, and then length bytes of extension_data. Each PEM extension name must begin with the phrase "BEGIN SERVERINFO FOR ". +If more than one certificate (RSA/DSA) is installed using +SSL_CTX_use_certificate(), the serverinfo extension will be loaded into the +last certificate installed. If e.g. the last item was a RSA certificate, the +loaded serverinfo extension data will be loaded for that certificate. To +use the serverinfo extension for multiple certificates, +SSL_CTX_use_serverinfo() needs to be called multiple times, once B +each time a certificate is loaded. + =head1 NOTES =head1 RETURN VALUES diff --git a/vendor/openssl/openssl/doc/ssl/ssl.pod b/vendor/openssl/openssl/doc/ssl/ssl.pod index 242087e69..70cca178a 100644 --- a/vendor/openssl/openssl/doc/ssl/ssl.pod +++ b/vendor/openssl/openssl/doc/ssl/ssl.pod @@ -130,41 +130,86 @@ protocol methods defined in B structures. =over 4 -=item const SSL_METHOD *B(void); +=item const SSL_METHOD *B(void); -Constructor for the SSLv2 SSL_METHOD structure for a dedicated client. +Constructor for the I SSL_METHOD structure for +clients, servers or both. +See L for details. -=item const SSL_METHOD *B(void); +=item const SSL_METHOD *B(void); -Constructor for the SSLv2 SSL_METHOD structure for a dedicated server. +Constructor for the I SSL_METHOD structure for +clients. -=item const SSL_METHOD *B(void); +=item const SSL_METHOD *B(void); -Constructor for the SSLv2 SSL_METHOD structure for combined client and server. +Constructor for the I SSL_METHOD structure for +servers. -=item const SSL_METHOD *B(void); +=item const SSL_METHOD *B(void); -Constructor for the SSLv3 SSL_METHOD structure for a dedicated client. +Constructor for the TLSv1.2 SSL_METHOD structure for clients, servers +or both. -=item const SSL_METHOD *B(void); +=item const SSL_METHOD *B(void); -Constructor for the SSLv3 SSL_METHOD structure for a dedicated server. +Constructor for the TLSv1.2 SSL_METHOD structure for clients. -=item const SSL_METHOD *B(void); +=item const SSL_METHOD *B(void); + +Constructor for the TLSv1.2 SSL_METHOD structure for servers. + +=item const SSL_METHOD *B(void); -Constructor for the SSLv3 SSL_METHOD structure for combined client and server. +Constructor for the TLSv1.1 SSL_METHOD structure for clients, servers +or both. + +=item const SSL_METHOD *B(void); + +Constructor for the TLSv1.1 SSL_METHOD structure for clients. + +=item const SSL_METHOD *B(void); + +Constructor for the TLSv1.1 SSL_METHOD structure for servers. + +=item const SSL_METHOD *B(void); + +Constructor for the TLSv1 SSL_METHOD structure for clients, servers +or both. =item const SSL_METHOD *B(void); -Constructor for the TLSv1 SSL_METHOD structure for a dedicated client. +Constructor for the TLSv1 SSL_METHOD structure for clients. =item const SSL_METHOD *B(void); -Constructor for the TLSv1 SSL_METHOD structure for a dedicated server. +Constructor for the TLSv1 SSL_METHOD structure for servers. -=item const SSL_METHOD *B(void); +=item const SSL_METHOD *B(void); + +Constructor for the SSLv3 SSL_METHOD structure for clients, servers +or both. + +=item const SSL_METHOD *B(void); + +Constructor for the SSLv3 SSL_METHOD structure for clients. + +=item const SSL_METHOD *B(void); + +Constructor for the SSLv3 SSL_METHOD structure for servers. + +=item const SSL_METHOD *B(void); + +Constructor for the SSLv2 SSL_METHOD structure for clients, servers +or both. + +=item const SSL_METHOD *B(void); + +Constructor for the SSLv2 SSL_METHOD structure for clients. + +=item const SSL_METHOD *B(void); -Constructor for the TLSv1 SSL_METHOD structure for combined client and server. +Constructor for the SSLv2 SSL_METHOD structure for servers. =back diff --git a/vendor/openssl/openssl/engines/e_capi.c b/vendor/openssl/openssl/engines/e_capi.c index f4cd2ffe7..6e524633f 100644 --- a/vendor/openssl/openssl/engines/e_capi.c +++ b/vendor/openssl/openssl/engines/e_capi.c @@ -114,6 +114,26 @@ # define CERT_SYSTEM_STORE_CURRENT_USER 0x00010000 # endif +# ifndef ALG_SID_SHA_256 +# define ALG_SID_SHA_256 12 +# endif +# ifndef ALG_SID_SHA_384 +# define ALG_SID_SHA_384 13 +# endif +# ifndef ALG_SID_SHA_512 +# define ALG_SID_SHA_512 14 +# endif + +# ifndef CALG_SHA_256 +# define CALG_SHA_256 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_256) +# endif +# ifndef CALG_SHA_384 +# define CALG_SHA_384 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_384) +# endif +# ifndef CALG_SHA_512 +# define CALG_SHA_512 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_512) +# endif + # include # include # include @@ -800,6 +820,18 @@ int capi_rsa_sign(int dtype, const unsigned char *m, unsigned int m_len, } /* Convert the signature type to a CryptoAPI algorithm ID */ switch (dtype) { + case NID_sha256: + alg = CALG_SHA_256; + break; + + case NID_sha384: + alg = CALG_SHA_384; + break; + + case NID_sha512: + alg = CALG_SHA_512; + break; + case NID_sha1: alg = CALG_SHA1; break; diff --git a/vendor/openssl/openssl/engines/e_chil.c b/vendor/openssl/openssl/engines/e_chil.c index 72d14fe38..5dfab5134 100644 --- a/vendor/openssl/openssl/engines/e_chil.c +++ b/vendor/openssl/openssl/engines/e_chil.c @@ -1,4 +1,4 @@ -/* crypto/engine/e_chil.c -*- mode: C; c-file-style: "eay" -*- */ +/* crypto/engine/e_chil.c */ /* * Written by Richard Levitte (richard@levitte.org), Geoff Thorpe * (geoff@geoffthorpe.net) and Dr Stephen N Henson (steve@openssl.org) for diff --git a/vendor/openssl/openssl/include/openssl/aes.h b/vendor/openssl/openssl/include/openssl/aes.h index 87bf60f6f..faa66c491 100644 --- a/vendor/openssl/openssl/include/openssl/aes.h +++ b/vendor/openssl/openssl/include/openssl/aes.h @@ -1,4 +1,4 @@ -/* crypto/aes/aes.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/aes/aes.h */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/include/openssl/bio.h b/vendor/openssl/openssl/include/openssl/bio.h index f78796b06..6790aed28 100644 --- a/vendor/openssl/openssl/include/openssl/bio.h +++ b/vendor/openssl/openssl/include/openssl/bio.h @@ -479,11 +479,11 @@ struct bio_dgram_sctp_prinfo { # define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) # define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) # define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2) -# define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0) +# define BIO_get_conn_int_port(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL) # define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) -/* BIO_s_accept_socket() */ +/* BIO_s_accept() */ # define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name) # define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0) /* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ @@ -496,6 +496,7 @@ struct bio_dgram_sctp_prinfo { # define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) # define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) +/* BIO_s_accept() and BIO_s_connect() */ # define BIO_do_connect(b) BIO_do_handshake(b) # define BIO_do_accept(b) BIO_do_handshake(b) # define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) @@ -515,12 +516,15 @@ struct bio_dgram_sctp_prinfo { # define BIO_get_url(b,url) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url)) # define BIO_get_no_connect_return(b) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL) +/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */ # define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) # define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c) +/* BIO_s_file() */ # define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp) # define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp) +/* BIO_s_fd() and BIO_s_file() */ # define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) # define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) @@ -685,7 +689,7 @@ long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, long argl, long ret); BIO_METHOD *BIO_s_mem(void); -BIO *BIO_new_mem_buf(void *buf, int len); +BIO *BIO_new_mem_buf(const void *buf, int len); BIO_METHOD *BIO_s_socket(void); BIO_METHOD *BIO_s_connect(void); BIO_METHOD *BIO_s_accept(void); diff --git a/vendor/openssl/openssl/include/openssl/bn.h b/vendor/openssl/openssl/include/openssl/bn.h index 5696965e9..86264ae63 100644 --- a/vendor/openssl/openssl/include/openssl/bn.h +++ b/vendor/openssl/openssl/include/openssl/bn.h @@ -125,6 +125,7 @@ #ifndef HEADER_BN_H # define HEADER_BN_H +# include # include # ifndef OPENSSL_NO_FP_API # include /* FILE */ @@ -721,8 +722,17 @@ const BIGNUM *BN_get0_nist_prime_521(void); /* library internal functions */ -# define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\ - (a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2)) +# define bn_expand(a,bits) \ + ( \ + bits > (INT_MAX - BN_BITS2 + 1) ? \ + NULL \ + : \ + (((bits+BN_BITS2-1)/BN_BITS2) <= (a)->dmax) ? \ + (a) \ + : \ + bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2) \ + ) + # define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words))) BIGNUM *bn_expand2(BIGNUM *a, int words); # ifndef OPENSSL_NO_DEPRECATED diff --git a/vendor/openssl/openssl/include/openssl/camellia.h b/vendor/openssl/openssl/include/openssl/camellia.h index 9be7c0fd9..45e8d25b1 100644 --- a/vendor/openssl/openssl/include/openssl/camellia.h +++ b/vendor/openssl/openssl/include/openssl/camellia.h @@ -1,4 +1,4 @@ -/* crypto/camellia/camellia.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/camellia/camellia.h */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/include/openssl/comp.h b/vendor/openssl/openssl/include/openssl/comp.h index 406c428aa..60a073404 100644 --- a/vendor/openssl/openssl/include/openssl/comp.h +++ b/vendor/openssl/openssl/include/openssl/comp.h @@ -4,6 +4,10 @@ # include +# ifdef OPENSSL_NO_COMP +# error COMP is disabled. +# endif + #ifdef __cplusplus extern "C" { #endif diff --git a/vendor/openssl/openssl/include/openssl/crypto.h b/vendor/openssl/openssl/include/openssl/crypto.h index c450d7a3c..6c644ce12 100644 --- a/vendor/openssl/openssl/include/openssl/crypto.h +++ b/vendor/openssl/openssl/include/openssl/crypto.h @@ -628,7 +628,7 @@ void OPENSSL_init(void); * into a defined order as the return value when a != b is undefined, other * than to be non-zero. */ -int CRYPTO_memcmp(const void *a, const void *b, size_t len); +int CRYPTO_memcmp(const volatile void *a, const volatile void *b, size_t len); /* BEGIN ERROR CODES */ /* diff --git a/vendor/openssl/openssl/include/openssl/des_old.h b/vendor/openssl/openssl/include/openssl/des_old.h index f1e1e2cb0..ee7607a24 100644 --- a/vendor/openssl/openssl/include/openssl/des_old.h +++ b/vendor/openssl/openssl/include/openssl/des_old.h @@ -1,4 +1,4 @@ -/* crypto/des/des_old.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/des/des_old.h */ /*- * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING diff --git a/vendor/openssl/openssl/include/openssl/dh.h b/vendor/openssl/openssl/include/openssl/dh.h index b17767328..a5bd9016a 100644 --- a/vendor/openssl/openssl/include/openssl/dh.h +++ b/vendor/openssl/openssl/include/openssl/dh.h @@ -174,6 +174,7 @@ struct dh_st { /* DH_check_pub_key error codes */ # define DH_CHECK_PUBKEY_TOO_SMALL 0x01 # define DH_CHECK_PUBKEY_TOO_LARGE 0x02 +# define DH_CHECK_PUBKEY_INVALID 0x04 /* * primes p where (p-1)/2 is prime too are called "safe"; we define this for diff --git a/vendor/openssl/openssl/include/openssl/dso.h b/vendor/openssl/openssl/include/openssl/dso.h index 7c4a1dc4a..c9013f5ce 100644 --- a/vendor/openssl/openssl/include/openssl/dso.h +++ b/vendor/openssl/openssl/include/openssl/dso.h @@ -1,4 +1,4 @@ -/* dso.h -*- mode:C; c-file-style: "eay" -*- */ +/* dso.h */ /* * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project * 2000. diff --git a/vendor/openssl/openssl/include/openssl/kssl.h b/vendor/openssl/openssl/include/openssl/kssl.h index 9a5767280..ae8a51f47 100644 --- a/vendor/openssl/openssl/include/openssl/kssl.h +++ b/vendor/openssl/openssl/include/openssl/kssl.h @@ -1,4 +1,4 @@ -/* ssl/kssl.h -*- mode: C; c-file-style: "eay" -*- */ +/* ssl/kssl.h */ /* * Written by Vern Staats for the OpenSSL project * 2000. project 2000. diff --git a/vendor/openssl/openssl/include/openssl/opensslv.h b/vendor/openssl/openssl/include/openssl/opensslv.h index abcef15b1..13fe44023 100644 --- a/vendor/openssl/openssl/include/openssl/opensslv.h +++ b/vendor/openssl/openssl/include/openssl/opensslv.h @@ -30,11 +30,11 @@ extern "C" { * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for * major minor fix final patch/beta) */ -# define OPENSSL_VERSION_NUMBER 0x1000205fL +# define OPENSSL_VERSION_NUMBER 0x1000208fL # ifdef OPENSSL_FIPS -# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2e-fips 3 Dec 2015" +# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2h-fips 3 May 2016" # else -# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2e 3 Dec 2015" +# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2h 3 May 2016" # endif # define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT diff --git a/vendor/openssl/openssl/include/openssl/srp.h b/vendor/openssl/openssl/include/openssl/srp.h index d072536fe..028892a1f 100644 --- a/vendor/openssl/openssl/include/openssl/srp.h +++ b/vendor/openssl/openssl/include/openssl/srp.h @@ -82,16 +82,21 @@ typedef struct SRP_gN_cache_st { DECLARE_STACK_OF(SRP_gN_cache) typedef struct SRP_user_pwd_st { + /* Owned by us. */ char *id; BIGNUM *s; BIGNUM *v; + /* Not owned by us. */ const BIGNUM *g; const BIGNUM *N; + /* Owned by us. */ char *info; } SRP_user_pwd; DECLARE_STACK_OF(SRP_user_pwd) +void SRP_user_pwd_free(SRP_user_pwd *user_pwd); + typedef struct SRP_VBASE_st { STACK_OF(SRP_user_pwd) *users_pwd; STACK_OF(SRP_gN_cache) *gN_cache; @@ -115,7 +120,12 @@ DECLARE_STACK_OF(SRP_gN) SRP_VBASE *SRP_VBASE_new(char *seed_key); int SRP_VBASE_free(SRP_VBASE *vb); int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file); + +/* This method ignores the configured seed and fails for an unknown user. */ SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username); +/* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/ +SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username); + char *SRP_create_verifier(const char *user, const char *pass, char **salt, char **verifier, const char *N, const char *g); int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, diff --git a/vendor/openssl/openssl/include/openssl/ssl.h b/vendor/openssl/openssl/include/openssl/ssl.h index afec1f5bf..5ef56faa5 100644 --- a/vendor/openssl/openssl/include/openssl/ssl.h +++ b/vendor/openssl/openssl/include/openssl/ssl.h @@ -338,7 +338,7 @@ extern "C" { * The following cipher list is used by default. It also is substituted when * an application-defined cipher list string starts with 'DEFAULT'. */ -# define SSL_DEFAULT_CIPHER_LIST "ALL:!EXPORT:!aNULL:!eNULL:!SSLv2" +# define SSL_DEFAULT_CIPHER_LIST "ALL:!EXPORT:!LOW:!aNULL:!eNULL:!SSLv2" /* * As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always * starts with a reasonable order, and all we have to do for DEFAULT is @@ -625,7 +625,7 @@ struct ssl_session_st { # define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000L /* If set, always create a new key when using tmp_ecdh parameters */ # define SSL_OP_SINGLE_ECDH_USE 0x00080000L -/* If set, always create a new key when using tmp_dh parameters */ +/* Does nothing: retained for compatibility */ # define SSL_OP_SINGLE_DH_USE 0x00100000L /* Does nothing: retained for compatibiity */ # define SSL_OP_EPHEMERAL_RSA 0x0 @@ -2092,7 +2092,7 @@ DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) # define SSL_CTX_set1_sigalgs_list(ctx, s) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)s) # define SSL_set1_sigalgs(ctx, slist, slistlen) \ - SSL_ctrl(ctx,SSL_CTRL_SET_SIGALGS,clistlen,(int *)slist) + SSL_ctrl(ctx,SSL_CTRL_SET_SIGALGS,slistlen,(int *)slist) # define SSL_set1_sigalgs_list(ctx, s) \ SSL_ctrl(ctx,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)s) # define SSL_CTX_set1_client_sigalgs(ctx, slist, slistlen) \ @@ -2345,7 +2345,7 @@ const char *SSL_get_version(const SSL *s); /* This sets the 'default' SSL version that SSL_new() will create */ int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth); -# ifndef OPENSSL_NO_SSL2 +# ifndef OPENSSL_NO_SSL2_METHOD const SSL_METHOD *SSLv2_method(void); /* SSLv2 */ const SSL_METHOD *SSLv2_server_method(void); /* SSLv2 */ const SSL_METHOD *SSLv2_client_method(void); /* SSLv2 */ @@ -3056,6 +3056,7 @@ void ERR_load_SSL_strings(void); # define SSL_R_SERVERHELLO_TLSEXT 275 # define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277 # define SSL_R_SHORT_READ 219 +# define SSL_R_SHUTDOWN_WHILE_IN_INIT 407 # define SSL_R_SIGNATURE_ALGORITHMS_ERROR 360 # define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 # define SSL_R_SRP_A_CALC 361 diff --git a/vendor/openssl/openssl/include/openssl/ui.h b/vendor/openssl/openssl/include/openssl/ui.h index b917edab3..0dc16330b 100644 --- a/vendor/openssl/openssl/include/openssl/ui.h +++ b/vendor/openssl/openssl/include/openssl/ui.h @@ -1,4 +1,4 @@ -/* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/ui/ui.h */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2001. diff --git a/vendor/openssl/openssl/include/openssl/ui_compat.h b/vendor/openssl/openssl/include/openssl/ui_compat.h index 42fb9ff65..bf541542c 100644 --- a/vendor/openssl/openssl/include/openssl/ui_compat.h +++ b/vendor/openssl/openssl/include/openssl/ui_compat.h @@ -1,4 +1,4 @@ -/* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */ +/* crypto/ui/ui.h */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2001. diff --git a/vendor/openssl/openssl/include/openssl/x509.h b/vendor/openssl/openssl/include/openssl/x509.h index 99337b849..fc613ce63 100644 --- a/vendor/openssl/openssl/include/openssl/x509.h +++ b/vendor/openssl/openssl/include/openssl/x509.h @@ -1305,6 +1305,7 @@ void ERR_load_X509_strings(void); # define X509_R_LOADING_CERT_DIR 103 # define X509_R_LOADING_DEFAULTS 104 # define X509_R_METHOD_NOT_SUPPORTED 124 +# define X509_R_NAME_TOO_LONG 134 # define X509_R_NEWER_CRL_NOT_NEWER 132 # define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 # define X509_R_NO_CRL_NUMBER 130 diff --git a/vendor/openssl/openssl/include/openssl/x509_vfy.h b/vendor/openssl/openssl/include/openssl/x509_vfy.h index bd8613c62..2663e1c0a 100644 --- a/vendor/openssl/openssl/include/openssl/x509_vfy.h +++ b/vendor/openssl/openssl/include/openssl/x509_vfy.h @@ -313,7 +313,7 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) # define X509_V_OK 0 -/* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */ +# define X509_V_ERR_UNSPECIFIED 1 # define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 # define X509_V_ERR_UNABLE_TO_GET_CRL 3 diff --git a/vendor/openssl/openssl/ms/uplink-x86.pl b/vendor/openssl/openssl/ms/uplink-x86.pl index 0dffc14fc..53b998d27 100755 --- a/vendor/openssl/openssl/ms/uplink-x86.pl +++ b/vendor/openssl/openssl/ms/uplink-x86.pl @@ -14,11 +14,11 @@ for ($i=1;$i<=$N;$i++) { &function_begin_B("_\$lazy${i}"); &lea ("eax",&DWP(&label("OPENSSL_UplinkTable"))); - &push ("eax"); &push ($i); + &push ("eax"); &call (&label("OPENSSL_Uplink")); - &add ("esp",8); &pop ("eax"); + &add ("esp",4); &jmp_ptr(&DWP(4*$i,"eax")); &function_end_B("_\$lazy${i}"); } diff --git a/vendor/openssl/openssl/openssl.spec b/vendor/openssl/openssl/openssl.spec index 45e737ad1..55c05c4af 100644 --- a/vendor/openssl/openssl/openssl.spec +++ b/vendor/openssl/openssl/openssl.spec @@ -6,7 +6,7 @@ Release: 1 Summary: Secure Sockets Layer and cryptography libraries and tools Name: openssl -Version: 1.0.2e +Version: 1.0.2h Source0: ftp://ftp.openssl.org/source/%{name}-%{version}.tar.gz License: OpenSSL Group: System Environment/Libraries diff --git a/vendor/openssl/openssl/ssl/Makefile b/vendor/openssl/openssl/ssl/Makefile index 7b90fb037..b6dee5b5e 100644 --- a/vendor/openssl/openssl/ssl/Makefile +++ b/vendor/openssl/openssl/ssl/Makefile @@ -15,7 +15,7 @@ KRB5_INCLUDES= CFLAGS= $(INCLUDES) $(CFLAG) GENERAL=Makefile README ssl-lib.com install.com -TEST=ssltest.c heartbeat_test.c clienthellotest.c +TEST=ssltest.c heartbeat_test.c clienthellotest.c sslv2conftest.c APPS= LIB=$(TOP)/libssl.a @@ -399,14 +399,14 @@ s2_clnt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s2_clnt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s2_clnt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s2_clnt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h -s2_clnt.o: ../include/openssl/pqueue.h ../include/openssl/rand.h -s2_clnt.o: ../include/openssl/rsa.h ../include/openssl/safestack.h -s2_clnt.o: ../include/openssl/sha.h ../include/openssl/srtp.h -s2_clnt.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h -s2_clnt.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h -s2_clnt.o: ../include/openssl/stack.h ../include/openssl/symhacks.h -s2_clnt.o: ../include/openssl/tls1.h ../include/openssl/x509.h -s2_clnt.o: ../include/openssl/x509_vfy.h s2_clnt.c ssl_locl.h +s2_clnt.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h +s2_clnt.o: ../include/openssl/safestack.h ../include/openssl/sha.h +s2_clnt.o: ../include/openssl/srtp.h ../include/openssl/ssl.h +s2_clnt.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h +s2_clnt.o: ../include/openssl/ssl3.h ../include/openssl/stack.h +s2_clnt.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h +s2_clnt.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s2_clnt.c +s2_clnt.o: ssl_locl.h s2_enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s2_enc.o: ../include/openssl/buffer.h ../include/openssl/comp.h s2_enc.o: ../include/openssl/crypto.h ../include/openssl/dsa.h @@ -435,18 +435,18 @@ s2_lib.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s2_lib.o: ../include/openssl/ecdsa.h ../include/openssl/err.h s2_lib.o: ../include/openssl/evp.h ../include/openssl/hmac.h s2_lib.o: ../include/openssl/kssl.h ../include/openssl/lhash.h -s2_lib.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h -s2_lib.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h -s2_lib.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h -s2_lib.o: ../include/openssl/pem.h ../include/openssl/pem2.h -s2_lib.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h -s2_lib.o: ../include/openssl/rsa.h ../include/openssl/safestack.h -s2_lib.o: ../include/openssl/sha.h ../include/openssl/srtp.h -s2_lib.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h -s2_lib.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h -s2_lib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h -s2_lib.o: ../include/openssl/tls1.h ../include/openssl/x509.h -s2_lib.o: ../include/openssl/x509_vfy.h s2_lib.c ssl_locl.h +s2_lib.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h +s2_lib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h +s2_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h +s2_lib.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h +s2_lib.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h +s2_lib.o: ../include/openssl/safestack.h ../include/openssl/sha.h +s2_lib.o: ../include/openssl/srtp.h ../include/openssl/ssl.h +s2_lib.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h +s2_lib.o: ../include/openssl/ssl3.h ../include/openssl/stack.h +s2_lib.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h +s2_lib.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s2_lib.c +s2_lib.o: ssl_locl.h s2_meth.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s2_meth.o: ../include/openssl/buffer.h ../include/openssl/comp.h s2_meth.o: ../include/openssl/crypto.h ../include/openssl/dsa.h @@ -487,20 +487,19 @@ s2_pkt.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s2_pkt.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s2_pkt.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s2_pkt.c s2_pkt.o: ssl_locl.h -s2_srvr.o: ../crypto/constant_time_locl.h ../e_os.h ../include/openssl/asn1.h -s2_srvr.o: ../include/openssl/bio.h ../include/openssl/buffer.h -s2_srvr.o: ../include/openssl/comp.h ../include/openssl/crypto.h -s2_srvr.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h -s2_srvr.o: ../include/openssl/e_os2.h ../include/openssl/ec.h -s2_srvr.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h -s2_srvr.o: ../include/openssl/err.h ../include/openssl/evp.h -s2_srvr.o: ../include/openssl/hmac.h ../include/openssl/kssl.h -s2_srvr.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h -s2_srvr.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h -s2_srvr.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h -s2_srvr.o: ../include/openssl/pem.h ../include/openssl/pem2.h -s2_srvr.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h -s2_srvr.o: ../include/openssl/rand.h ../include/openssl/rsa.h +s2_srvr.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h +s2_srvr.o: ../include/openssl/buffer.h ../include/openssl/comp.h +s2_srvr.o: ../include/openssl/crypto.h ../include/openssl/dsa.h +s2_srvr.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h +s2_srvr.o: ../include/openssl/ec.h ../include/openssl/ecdh.h +s2_srvr.o: ../include/openssl/ecdsa.h ../include/openssl/err.h +s2_srvr.o: ../include/openssl/evp.h ../include/openssl/hmac.h +s2_srvr.o: ../include/openssl/kssl.h ../include/openssl/lhash.h +s2_srvr.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h +s2_srvr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h +s2_srvr.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h +s2_srvr.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h +s2_srvr.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h s2_srvr.o: ../include/openssl/safestack.h ../include/openssl/sha.h s2_srvr.o: ../include/openssl/srtp.h ../include/openssl/ssl.h s2_srvr.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h diff --git a/vendor/openssl/openssl/ssl/d1_both.c b/vendor/openssl/openssl/ssl/d1_both.c index c2c8d57e9..5d26c9492 100644 --- a/vendor/openssl/openssl/ssl/d1_both.c +++ b/vendor/openssl/openssl/ssl/d1_both.c @@ -295,8 +295,44 @@ int dtls1_do_write(SSL *s, int type) blocksize = 0; frag_off = 0; + s->rwstate = SSL_NOTHING; + /* s->init_num shouldn't ever be < 0...but just in case */ while (s->init_num > 0) { + if (type == SSL3_RT_HANDSHAKE && s->init_off != 0) { + /* We must be writing a fragment other than the first one */ + + if (frag_off > 0) { + /* This is the first attempt at writing out this fragment */ + + if (s->init_off <= DTLS1_HM_HEADER_LENGTH) { + /* + * Each fragment that was already sent must at least have + * contained the message header plus one other byte. + * Therefore |init_off| must have progressed by at least + * |DTLS1_HM_HEADER_LENGTH + 1| bytes. If not something went + * wrong. + */ + return -1; + } + + /* + * Adjust |init_off| and |init_num| to allow room for a new + * message header for this fragment. + */ + s->init_off -= DTLS1_HM_HEADER_LENGTH; + s->init_num += DTLS1_HM_HEADER_LENGTH; + } else { + /* + * We must have been called again after a retry so use the + * fragment offset from our last attempt. We do not need + * to adjust |init_off| and |init_num| as above, because + * that should already have been done before the retry. + */ + frag_off = s->d1->w_msg_hdr.frag_off; + } + } + used_len = BIO_wpending(SSL_get_wbio(s)) + DTLS1_RT_HEADER_LENGTH + mac_size + blocksize; if (s->d1->mtu > used_len) @@ -309,8 +345,10 @@ int dtls1_do_write(SSL *s, int type) * grr.. we could get an error if MTU picked was wrong */ ret = BIO_flush(SSL_get_wbio(s)); - if (ret <= 0) + if (ret <= 0) { + s->rwstate = SSL_WRITING; return ret; + } used_len = DTLS1_RT_HEADER_LENGTH + mac_size + blocksize; if (s->d1->mtu > used_len + DTLS1_HM_HEADER_LENGTH) { curr_mtu = s->d1->mtu - used_len; @@ -336,25 +374,6 @@ int dtls1_do_write(SSL *s, int type) * XDTLS: this function is too long. split out the CCS part */ if (type == SSL3_RT_HANDSHAKE) { - if (s->init_off != 0) { - OPENSSL_assert(s->init_off > DTLS1_HM_HEADER_LENGTH); - s->init_off -= DTLS1_HM_HEADER_LENGTH; - s->init_num += DTLS1_HM_HEADER_LENGTH; - - /* - * We just checked that s->init_num > 0 so this cast should - * be safe - */ - if (((unsigned int)s->init_num) > curr_mtu) - len = curr_mtu; - else - len = s->init_num; - } - - /* Shouldn't ever happen */ - if (len > INT_MAX) - len = INT_MAX; - if (len < DTLS1_HM_HEADER_LENGTH) { /* * len is so small that we really can't do anything sensible @@ -442,7 +461,16 @@ int dtls1_do_write(SSL *s, int type) } s->init_off += ret; s->init_num -= ret; - frag_off += (ret -= DTLS1_HM_HEADER_LENGTH); + ret -= DTLS1_HM_HEADER_LENGTH; + frag_off += ret; + + /* + * We save the fragment offset for the next fragment so we have it + * available in case of an IO retry. We don't know the length of the + * next fragment yet so just set that to 0 for now. It will be + * updated again later. + */ + dtls1_fix_message_header(s, frag_off, 0); } } return (0); @@ -1431,6 +1459,8 @@ int dtls1_process_heartbeat(SSL *s) * plus 2 bytes payload length, plus payload, plus padding */ buffer = OPENSSL_malloc(write_length); + if (buffer == NULL) + return -1; bp = buffer; /* Enter response type, length and copy payload */ diff --git a/vendor/openssl/openssl/ssl/kssl.c b/vendor/openssl/openssl/ssl/kssl.c index cf585679d..f2839bdcd 100644 --- a/vendor/openssl/openssl/ssl/kssl.c +++ b/vendor/openssl/openssl/ssl/kssl.c @@ -1,4 +1,4 @@ -/* ssl/kssl.c -*- mode: C; c-file-style: "eay" -*- */ +/* ssl/kssl.c */ /* * Written by Vern Staats for the OpenSSL project * 2000. diff --git a/vendor/openssl/openssl/ssl/kssl.h b/vendor/openssl/openssl/ssl/kssl.h index 9a5767280..ae8a51f47 100644 --- a/vendor/openssl/openssl/ssl/kssl.h +++ b/vendor/openssl/openssl/ssl/kssl.h @@ -1,4 +1,4 @@ -/* ssl/kssl.h -*- mode: C; c-file-style: "eay" -*- */ +/* ssl/kssl.h */ /* * Written by Vern Staats for the OpenSSL project * 2000. project 2000. diff --git a/vendor/openssl/openssl/ssl/kssl_lcl.h b/vendor/openssl/openssl/ssl/kssl_lcl.h index 46dcef22d..8e6a6d69e 100644 --- a/vendor/openssl/openssl/ssl/kssl_lcl.h +++ b/vendor/openssl/openssl/ssl/kssl_lcl.h @@ -1,4 +1,4 @@ -/* ssl/kssl.h -*- mode: C; c-file-style: "eay" -*- */ +/* ssl/kssl.h */ /* * Written by Vern Staats for the OpenSSL project * 2000. project 2000. diff --git a/vendor/openssl/openssl/ssl/s2_lib.c b/vendor/openssl/openssl/ssl/s2_lib.c index d55b93f76..88e67f083 100644 --- a/vendor/openssl/openssl/ssl/s2_lib.c +++ b/vendor/openssl/openssl/ssl/s2_lib.c @@ -150,12 +150,13 @@ OPENSSL_GLOBAL const SSL_CIPHER ssl2_ciphers[] = { SSL_RC4, SSL_MD5, SSL_SSLV2, - SSL_NOT_EXP | SSL_MEDIUM, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_MEDIUM, 0, 128, 128, }, +# if 0 /* RC4_128_EXPORT40_WITH_MD5 */ { 1, @@ -166,11 +167,12 @@ OPENSSL_GLOBAL const SSL_CIPHER ssl2_ciphers[] = { SSL_RC4, SSL_MD5, SSL_SSLV2, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL2_CF_5_BYTE_ENC, 40, 128, }, +# endif /* RC2_128_CBC_WITH_MD5 */ { @@ -182,12 +184,13 @@ OPENSSL_GLOBAL const SSL_CIPHER ssl2_ciphers[] = { SSL_RC2, SSL_MD5, SSL_SSLV2, - SSL_NOT_EXP | SSL_MEDIUM, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_MEDIUM, 0, 128, 128, }, +# if 0 /* RC2_128_CBC_EXPORT40_WITH_MD5 */ { 1, @@ -198,11 +201,12 @@ OPENSSL_GLOBAL const SSL_CIPHER ssl2_ciphers[] = { SSL_RC2, SSL_MD5, SSL_SSLV2, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL2_CF_5_BYTE_ENC, 40, 128, }, +# endif # ifndef OPENSSL_NO_IDEA /* IDEA_128_CBC_WITH_MD5 */ @@ -215,13 +219,14 @@ OPENSSL_GLOBAL const SSL_CIPHER ssl2_ciphers[] = { SSL_IDEA, SSL_MD5, SSL_SSLV2, - SSL_NOT_EXP | SSL_MEDIUM, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_MEDIUM, 0, 128, 128, }, # endif +# if 0 /* DES_64_CBC_WITH_MD5 */ { 1, @@ -232,11 +237,12 @@ OPENSSL_GLOBAL const SSL_CIPHER ssl2_ciphers[] = { SSL_DES, SSL_MD5, SSL_SSLV2, - SSL_NOT_EXP | SSL_LOW, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_LOW, 0, 56, 56, }, +# endif /* DES_192_EDE3_CBC_WITH_MD5 */ { @@ -248,7 +254,7 @@ OPENSSL_GLOBAL const SSL_CIPHER ssl2_ciphers[] = { SSL_3DES, SSL_MD5, SSL_SSLV2, - SSL_NOT_EXP | SSL_HIGH, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_HIGH, 0, 112, 168, @@ -265,7 +271,7 @@ OPENSSL_GLOBAL const SSL_CIPHER ssl2_ciphers[] = { SSL_RC4, SSL_MD5, SSL_SSLV2, - SSL_NOT_EXP | SSL_LOW, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_LOW, SSL2_CF_8_BYTE_ENC, 64, 64, diff --git a/vendor/openssl/openssl/ssl/s2_meth.c b/vendor/openssl/openssl/ssl/s2_meth.c index b312f1726..73885b7ec 100644 --- a/vendor/openssl/openssl/ssl/s2_meth.c +++ b/vendor/openssl/openssl/ssl/s2_meth.c @@ -57,7 +57,8 @@ */ #include "ssl_locl.h" -#ifndef OPENSSL_NO_SSL2 +#ifndef OPENSSL_NO_SSL2_METHOD +# ifndef OPENSSL_NO_SSL2 # include # include @@ -72,7 +73,16 @@ static const SSL_METHOD *ssl2_get_method(int ver) IMPLEMENT_ssl2_meth_func(SSLv2_method, ssl2_accept, ssl2_connect, ssl2_get_method) -#else /* !OPENSSL_NO_SSL2 */ + +# else /* !OPENSSL_NO_SSL2 */ + +const SSL_METHOD *SSLv2_method(void) { return NULL; } +const SSL_METHOD *SSLv2_client_method(void) { return NULL; } +const SSL_METHOD *SSLv2_server_method(void) { return NULL; } + +# endif + +#else /* !OPENSSL_NO_SSL2_METHOD */ # if PEDANTIC static void *dummy = &dummy; diff --git a/vendor/openssl/openssl/ssl/s2_srvr.c b/vendor/openssl/openssl/ssl/s2_srvr.c index 4289272b7..07e9df828 100644 --- a/vendor/openssl/openssl/ssl/s2_srvr.c +++ b/vendor/openssl/openssl/ssl/s2_srvr.c @@ -402,7 +402,7 @@ static int get_client_master_key(SSL *s) } cp = ssl2_get_cipher_by_char(p); - if (cp == NULL) { + if (cp == NULL || sk_SSL_CIPHER_find(s->session->ciphers, cp) < 0) { ssl2_return_error(s, SSL2_PE_NO_CIPHER); SSLerr(SSL_F_GET_CLIENT_MASTER_KEY, SSL_R_NO_CIPHER_MATCH); return (-1); @@ -598,6 +598,11 @@ static int get_client_hello(SSL *s) s->s2->tmp.cipher_spec_length = i; n2s(p, i); s->s2->tmp.session_id_length = i; + if ((i < 0) || (i > SSL_MAX_SSL_SESSION_ID_LENGTH)) { + ssl2_return_error(s, SSL2_PE_UNDEFINED_ERROR); + SSLerr(SSL_F_GET_CLIENT_HELLO, SSL_R_LENGTH_MISMATCH); + return -1; + } n2s(p, i); s->s2->challenge_length = i; if ((i < SSL2_MIN_CHALLENGE_LENGTH) || @@ -687,8 +692,12 @@ static int get_client_hello(SSL *s) prio = cs; allow = cl; } + + /* Generate list of SSLv2 ciphers shared between client and server */ for (z = 0; z < sk_SSL_CIPHER_num(prio); z++) { - if (sk_SSL_CIPHER_find(allow, sk_SSL_CIPHER_value(prio, z)) < 0) { + const SSL_CIPHER *cp = sk_SSL_CIPHER_value(prio, z); + if ((cp->algorithm_ssl & SSL_SSLV2) == 0 || + sk_SSL_CIPHER_find(allow, cp) < 0) { (void)sk_SSL_CIPHER_delete(prio, z); z--; } @@ -697,6 +706,13 @@ static int get_client_hello(SSL *s) sk_SSL_CIPHER_free(s->session->ciphers); s->session->ciphers = prio; } + + /* Make sure we have at least one cipher in common */ + if (sk_SSL_CIPHER_num(s->session->ciphers) == 0) { + ssl2_return_error(s, SSL2_PE_NO_CIPHER); + SSLerr(SSL_F_GET_CLIENT_HELLO, SSL_R_NO_CIPHER_MATCH); + return -1; + } /* * s->session->ciphers should now have a list of ciphers that are on * both the client and server. This list is ordered by the order the diff --git a/vendor/openssl/openssl/ssl/s3_clnt.c b/vendor/openssl/openssl/ssl/s3_clnt.c index bc5254c81..19dc8648b 100644 --- a/vendor/openssl/openssl/ssl/s3_clnt.c +++ b/vendor/openssl/openssl/ssl/s3_clnt.c @@ -2199,6 +2199,7 @@ int ssl3_get_certificate_request(SSL *s) SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST, ERR_R_MALLOC_FAILURE); goto err; } + xn = NULL; p += l; nc += l + 2; @@ -2222,6 +2223,7 @@ int ssl3_get_certificate_request(SSL *s) err: s->state = SSL_ST_ERR; done: + X509_NAME_free(xn); if (ca_sk != NULL) sk_X509_NAME_pop_free(ca_sk, X509_NAME_free); return (ret); @@ -2350,37 +2352,44 @@ int ssl3_get_cert_status(SSL *s) n = s->method->ssl_get_message(s, SSL3_ST_CR_CERT_STATUS_A, SSL3_ST_CR_CERT_STATUS_B, - SSL3_MT_CERTIFICATE_STATUS, 16384, &ok); + -1, 16384, &ok); if (!ok) return ((int)n); - if (n < 4) { - /* need at least status type + length */ - al = SSL_AD_DECODE_ERROR; - SSLerr(SSL_F_SSL3_GET_CERT_STATUS, SSL_R_LENGTH_MISMATCH); - goto f_err; - } - p = (unsigned char *)s->init_msg; - if (*p++ != TLSEXT_STATUSTYPE_ocsp) { - al = SSL_AD_DECODE_ERROR; - SSLerr(SSL_F_SSL3_GET_CERT_STATUS, SSL_R_UNSUPPORTED_STATUS_TYPE); - goto f_err; - } - n2l3(p, resplen); - if (resplen + 4 != n) { - al = SSL_AD_DECODE_ERROR; - SSLerr(SSL_F_SSL3_GET_CERT_STATUS, SSL_R_LENGTH_MISMATCH); - goto f_err; - } - if (s->tlsext_ocsp_resp) - OPENSSL_free(s->tlsext_ocsp_resp); - s->tlsext_ocsp_resp = BUF_memdup(p, resplen); - if (!s->tlsext_ocsp_resp) { - al = SSL_AD_INTERNAL_ERROR; - SSLerr(SSL_F_SSL3_GET_CERT_STATUS, ERR_R_MALLOC_FAILURE); - goto f_err; + + if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_STATUS) { + /* + * The CertificateStatus message is optional even if + * tlsext_status_expected is set + */ + s->s3->tmp.reuse_message = 1; + } else { + if (n < 4) { + /* need at least status type + length */ + al = SSL_AD_DECODE_ERROR; + SSLerr(SSL_F_SSL3_GET_CERT_STATUS, SSL_R_LENGTH_MISMATCH); + goto f_err; + } + p = (unsigned char *)s->init_msg; + if (*p++ != TLSEXT_STATUSTYPE_ocsp) { + al = SSL_AD_DECODE_ERROR; + SSLerr(SSL_F_SSL3_GET_CERT_STATUS, SSL_R_UNSUPPORTED_STATUS_TYPE); + goto f_err; + } + n2l3(p, resplen); + if (resplen + 4 != n) { + al = SSL_AD_DECODE_ERROR; + SSLerr(SSL_F_SSL3_GET_CERT_STATUS, SSL_R_LENGTH_MISMATCH); + goto f_err; + } + s->tlsext_ocsp_resp = BUF_memdup(p, resplen); + if (s->tlsext_ocsp_resp == NULL) { + al = SSL_AD_INTERNAL_ERROR; + SSLerr(SSL_F_SSL3_GET_CERT_STATUS, ERR_R_MALLOC_FAILURE); + goto f_err; + } + s->tlsext_ocsp_resplen = resplen; } - s->tlsext_ocsp_resplen = resplen; if (s->ctx->tlsext_status_cb) { int ret; ret = s->ctx->tlsext_status_cb(s, s->ctx->tlsext_status_arg); @@ -3603,7 +3612,7 @@ int ssl3_check_cert_and_algorithm(SSL *s) DH_free(dh_srvr); } - if ((!SSL_C_IS_EXPORT(s->s3->tmp.new_cipher) && dh_size < 768) + if ((!SSL_C_IS_EXPORT(s->s3->tmp.new_cipher) && dh_size < 1024) || (SSL_C_IS_EXPORT(s->s3->tmp.new_cipher) && dh_size < 512)) { SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_DH_KEY_TOO_SMALL); goto f_err; diff --git a/vendor/openssl/openssl/ssl/s3_lib.c b/vendor/openssl/openssl/ssl/s3_lib.c index 64793d6af..872e636af 100644 --- a/vendor/openssl/openssl/ssl/s3_lib.c +++ b/vendor/openssl/openssl/ssl/s3_lib.c @@ -198,6 +198,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { }, /* Cipher 03 */ +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_RSA_RC4_40_MD5, @@ -207,11 +208,12 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_RC4, SSL_MD5, SSL_SSLV3, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 40, 128, }, +#endif /* Cipher 04 */ { @@ -246,6 +248,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { }, /* Cipher 06 */ +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_RSA_RC2_40_MD5, @@ -255,11 +258,12 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_RC2, SSL_MD5, SSL_SSLV3, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 40, 128, }, +#endif /* Cipher 07 */ #ifndef OPENSSL_NO_IDEA @@ -280,6 +284,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { #endif /* Cipher 08 */ +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_RSA_DES_40_CBC_SHA, @@ -289,13 +294,15 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_SHA1, SSL_SSLV3, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 40, 56, }, +#endif /* Cipher 09 */ +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_RSA_DES_64_CBC_SHA, @@ -305,11 +312,12 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_SHA1, SSL_SSLV3, - SSL_NOT_EXP | SSL_LOW, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_LOW, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 56, 56, }, +#endif /* Cipher 0A */ { @@ -329,6 +337,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { /* The DH ciphers */ /* Cipher 0B */ +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 0, SSL3_TXT_DH_DSS_DES_40_CBC_SHA, @@ -338,13 +347,15 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_SHA1, SSL_SSLV3, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 40, 56, }, +#endif /* Cipher 0C */ +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_DH_DSS_DES_64_CBC_SHA, @@ -354,11 +365,12 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_SHA1, SSL_SSLV3, - SSL_NOT_EXP | SSL_LOW, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_LOW, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 56, 56, }, +#endif /* Cipher 0D */ { @@ -377,6 +389,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { }, /* Cipher 0E */ +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 0, SSL3_TXT_DH_RSA_DES_40_CBC_SHA, @@ -386,13 +399,15 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_SHA1, SSL_SSLV3, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 40, 56, }, +#endif /* Cipher 0F */ +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_DH_RSA_DES_64_CBC_SHA, @@ -402,11 +417,12 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_SHA1, SSL_SSLV3, - SSL_NOT_EXP | SSL_LOW, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_LOW, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 56, 56, }, +#endif /* Cipher 10 */ { @@ -426,6 +442,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { /* The Ephemeral DH ciphers */ /* Cipher 11 */ +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_EDH_DSS_DES_40_CBC_SHA, @@ -435,13 +452,15 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_SHA1, SSL_SSLV3, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 40, 56, }, +#endif /* Cipher 12 */ +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_EDH_DSS_DES_64_CBC_SHA, @@ -451,11 +470,12 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_SHA1, SSL_SSLV3, - SSL_NOT_EXP | SSL_LOW, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_LOW, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 56, 56, }, +#endif /* Cipher 13 */ { @@ -474,6 +494,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { }, /* Cipher 14 */ +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_EDH_RSA_DES_40_CBC_SHA, @@ -483,13 +504,15 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_SHA1, SSL_SSLV3, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 40, 56, }, +#endif /* Cipher 15 */ +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_EDH_RSA_DES_64_CBC_SHA, @@ -499,11 +522,12 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_SHA1, SSL_SSLV3, - SSL_NOT_EXP | SSL_LOW, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_LOW, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 56, 56, }, +#endif /* Cipher 16 */ { @@ -522,6 +546,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { }, /* Cipher 17 */ +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_ADH_RC4_40_MD5, @@ -531,11 +556,12 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_RC4, SSL_MD5, SSL_SSLV3, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 40, 128, }, +#endif /* Cipher 18 */ { @@ -547,13 +573,14 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_RC4, SSL_MD5, SSL_SSLV3, - SSL_NOT_EXP | SSL_MEDIUM, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_MEDIUM, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 128, 128, }, /* Cipher 19 */ +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_ADH_DES_40_CBC_SHA, @@ -563,13 +590,15 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_SHA1, SSL_SSLV3, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 40, 128, }, +#endif /* Cipher 1A */ +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_ADH_DES_64_CBC_SHA, @@ -579,11 +608,12 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_SHA1, SSL_SSLV3, - SSL_NOT_EXP | SSL_LOW, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_LOW, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 56, 56, }, +#endif /* Cipher 1B */ { @@ -595,7 +625,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_3DES, SSL_SHA1, SSL_SSLV3, - SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 112, 168, @@ -655,6 +685,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { #ifndef OPENSSL_NO_KRB5 /* The Kerberos ciphers*/ /* Cipher 1E */ +# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_KRB5_DES_64_CBC_SHA, @@ -664,11 +695,12 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_SHA1, SSL_SSLV3, - SSL_NOT_EXP | SSL_LOW, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_LOW, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 56, 56, }, +# endif /* Cipher 1F */ { @@ -719,6 +751,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { }, /* Cipher 22 */ +# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_KRB5_DES_64_CBC_MD5, @@ -728,11 +761,12 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_MD5, SSL_SSLV3, - SSL_NOT_EXP | SSL_LOW, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_LOW, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 56, 56, }, +# endif /* Cipher 23 */ { @@ -783,6 +817,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { }, /* Cipher 26 */ +# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_KRB5_DES_40_CBC_SHA, @@ -792,13 +827,15 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_SHA1, SSL_SSLV3, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 40, 56, }, +# endif /* Cipher 27 */ +# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_KRB5_RC2_40_CBC_SHA, @@ -808,13 +845,15 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_RC2, SSL_SHA1, SSL_SSLV3, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 40, 128, }, +# endif /* Cipher 28 */ +# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_KRB5_RC4_40_SHA, @@ -824,13 +863,15 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_RC4, SSL_SHA1, SSL_SSLV3, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 40, 128, }, +# endif /* Cipher 29 */ +# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_KRB5_DES_40_CBC_MD5, @@ -840,13 +881,15 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_MD5, SSL_SSLV3, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 40, 56, }, +# endif /* Cipher 2A */ +# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_KRB5_RC2_40_CBC_MD5, @@ -856,13 +899,15 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_RC2, SSL_MD5, SSL_SSLV3, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 40, 128, }, +# endif /* Cipher 2B */ +# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, SSL3_TXT_KRB5_RC4_40_MD5, @@ -872,11 +917,12 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_RC4, SSL_MD5, SSL_SSLV3, - SSL_EXPORT | SSL_EXP40, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP40, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 40, 128, }, +# endif #endif /* OPENSSL_NO_KRB5 */ /* New AES ciphersuites */ @@ -965,7 +1011,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_AES128, SSL_SHA1, SSL_TLSV1, - SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 128, 128, @@ -1060,7 +1106,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_AES256, SSL_SHA1, SSL_TLSV1, - SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 256, 256, @@ -1256,7 +1302,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_CAMELLIA128, SSL_SHA1, SSL_TLSV1, - SSL_NOT_EXP | SSL_HIGH, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_HIGH, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 128, 128, @@ -1276,7 +1322,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_RC4, SSL_MD5, SSL_TLSV1, - SSL_EXPORT | SSL_EXP56, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP56, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 56, 128, @@ -1292,7 +1338,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_RC2, SSL_MD5, SSL_TLSV1, - SSL_EXPORT | SSL_EXP56, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP56, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 56, 128, @@ -1300,6 +1346,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { # endif /* Cipher 62 */ +# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA, @@ -1309,13 +1356,15 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_SHA1, SSL_TLSV1, - SSL_EXPORT | SSL_EXP56, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP56, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 56, 56, }, +# endif /* Cipher 63 */ +# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA, @@ -1325,13 +1374,15 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_DES, SSL_SHA1, SSL_TLSV1, - SSL_EXPORT | SSL_EXP56, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP56, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 56, 56, }, +# endif /* Cipher 64 */ +# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA, @@ -1341,13 +1392,15 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_RC4, SSL_SHA1, SSL_TLSV1, - SSL_EXPORT | SSL_EXP56, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP56, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 56, 128, }, +# endif /* Cipher 65 */ +# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS { 1, TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA, @@ -1357,11 +1410,12 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_RC4, SSL_SHA1, SSL_TLSV1, - SSL_EXPORT | SSL_EXP56, + SSL_NOT_DEFAULT | SSL_EXPORT | SSL_EXP56, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 56, 128, }, +# endif /* Cipher 66 */ { @@ -1471,7 +1525,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_AES128, SSL_SHA256, SSL_TLSV1_2, - SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 128, 128, @@ -1487,7 +1541,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_AES256, SSL_SHA256, SSL_TLSV1_2, - SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 256, 256, @@ -1640,7 +1694,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_CAMELLIA256, SSL_SHA1, SSL_TLSV1, - SSL_NOT_EXP | SSL_HIGH, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_HIGH, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 256, 256, @@ -1806,7 +1860,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_SEED, SSL_SHA1, SSL_TLSV1, - SSL_NOT_EXP | SSL_MEDIUM, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_MEDIUM, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 128, 128, @@ -1986,7 +2040,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_AES128GCM, SSL_AEAD, SSL_TLSV1_2, - SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256, 128, 128, @@ -2002,7 +2056,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_AES256GCM, SSL_AEAD, SSL_TLSV1_2, - SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384, 256, 256, @@ -2370,7 +2424,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_RC4, SSL_SHA1, SSL_TLSV1, - SSL_NOT_EXP | SSL_MEDIUM, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_MEDIUM, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 128, 128, @@ -2386,7 +2440,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_3DES, SSL_SHA1, SSL_TLSV1, - SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 112, 168, @@ -2402,7 +2456,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_AES128, SSL_SHA1, SSL_TLSV1, - SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 128, 128, @@ -2418,7 +2472,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[] = { SSL_AES256, SSL_SHA1, SSL_TLSV1, - SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, + SSL_NOT_DEFAULT | SSL_NOT_EXP | SSL_HIGH | SSL_FIPS, SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF, 256, 256, @@ -3206,13 +3260,6 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) SSLerr(SSL_F_SSL3_CTRL, ERR_R_DH_LIB); return (ret); } - if (!(s->options & SSL_OP_SINGLE_DH_USE)) { - if (!DH_generate_key(dh)) { - DH_free(dh); - SSLerr(SSL_F_SSL3_CTRL, ERR_R_DH_LIB); - return (ret); - } - } if (s->cert->dh_tmp != NULL) DH_free(s->cert->dh_tmp); s->cert->dh_tmp = dh; @@ -3263,6 +3310,8 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) #ifndef OPENSSL_NO_TLSEXT case SSL_CTRL_SET_TLSEXT_HOSTNAME: if (larg == TLSEXT_NAMETYPE_host_name) { + size_t len; + if (s->tlsext_hostname != NULL) OPENSSL_free(s->tlsext_hostname); s->tlsext_hostname = NULL; @@ -3270,7 +3319,8 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) ret = 1; if (parg == NULL) break; - if (strlen((char *)parg) > TLSEXT_MAXLEN_host_name) { + len = strlen((char *)parg); + if (len == 0 || len > TLSEXT_MAXLEN_host_name) { SSLerr(SSL_F_SSL3_CTRL, SSL_R_SSL3_EXT_INVALID_SERVERNAME); return 0; } @@ -3710,13 +3760,6 @@ long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_DH_LIB); return 0; } - if (!(ctx->options & SSL_OP_SINGLE_DH_USE)) { - if (!DH_generate_key(new)) { - SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_DH_LIB); - DH_free(new); - return 0; - } - } if (cert->dh_tmp != NULL) DH_free(cert->dh_tmp); cert->dh_tmp = new; diff --git a/vendor/openssl/openssl/ssl/s3_srvr.c b/vendor/openssl/openssl/ssl/s3_srvr.c index ee83105b7..ab28702ee 100644 --- a/vendor/openssl/openssl/ssl/s3_srvr.c +++ b/vendor/openssl/openssl/ssl/s3_srvr.c @@ -1,4 +1,4 @@ -/* ssl/s3_srvr.c -*- mode:C; c-file-style: "eay" -*- */ +/* ssl/s3_srvr.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1004,6 +1004,12 @@ int ssl3_get_client_hello(SSL *s) goto f_err; } + if ((j < 0) || (j > SSL_MAX_SSL_SESSION_ID_LENGTH)) { + al = SSL_AD_DECODE_ERROR; + SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_LENGTH_MISMATCH); + goto f_err; + } + s->hit = 0; /* * Versions before 0.9.7 always allow clients to resume sessions in @@ -1681,20 +1687,9 @@ int ssl3_send_server_key_exchange(SSL *s) } s->s3->tmp.dh = dh; - if ((dhp->pub_key == NULL || - dhp->priv_key == NULL || - (s->options & SSL_OP_SINGLE_DH_USE))) { - if (!DH_generate_key(dh)) { - SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_DH_LIB); - goto err; - } - } else { - dh->pub_key = BN_dup(dhp->pub_key); - dh->priv_key = BN_dup(dhp->priv_key); - if ((dh->pub_key == NULL) || (dh->priv_key == NULL)) { - SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_DH_LIB); - goto err; - } + if (!DH_generate_key(dh)) { + SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_DH_LIB); + goto err; } r[0] = dh->p; r[1] = dh->g; diff --git a/vendor/openssl/openssl/ssl/ssl.h b/vendor/openssl/openssl/ssl/ssl.h index afec1f5bf..5ef56faa5 100644 --- a/vendor/openssl/openssl/ssl/ssl.h +++ b/vendor/openssl/openssl/ssl/ssl.h @@ -338,7 +338,7 @@ extern "C" { * The following cipher list is used by default. It also is substituted when * an application-defined cipher list string starts with 'DEFAULT'. */ -# define SSL_DEFAULT_CIPHER_LIST "ALL:!EXPORT:!aNULL:!eNULL:!SSLv2" +# define SSL_DEFAULT_CIPHER_LIST "ALL:!EXPORT:!LOW:!aNULL:!eNULL:!SSLv2" /* * As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always * starts with a reasonable order, and all we have to do for DEFAULT is @@ -625,7 +625,7 @@ struct ssl_session_st { # define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000L /* If set, always create a new key when using tmp_ecdh parameters */ # define SSL_OP_SINGLE_ECDH_USE 0x00080000L -/* If set, always create a new key when using tmp_dh parameters */ +/* Does nothing: retained for compatibility */ # define SSL_OP_SINGLE_DH_USE 0x00100000L /* Does nothing: retained for compatibiity */ # define SSL_OP_EPHEMERAL_RSA 0x0 @@ -2092,7 +2092,7 @@ DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) # define SSL_CTX_set1_sigalgs_list(ctx, s) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)s) # define SSL_set1_sigalgs(ctx, slist, slistlen) \ - SSL_ctrl(ctx,SSL_CTRL_SET_SIGALGS,clistlen,(int *)slist) + SSL_ctrl(ctx,SSL_CTRL_SET_SIGALGS,slistlen,(int *)slist) # define SSL_set1_sigalgs_list(ctx, s) \ SSL_ctrl(ctx,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)s) # define SSL_CTX_set1_client_sigalgs(ctx, slist, slistlen) \ @@ -2345,7 +2345,7 @@ const char *SSL_get_version(const SSL *s); /* This sets the 'default' SSL version that SSL_new() will create */ int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth); -# ifndef OPENSSL_NO_SSL2 +# ifndef OPENSSL_NO_SSL2_METHOD const SSL_METHOD *SSLv2_method(void); /* SSLv2 */ const SSL_METHOD *SSLv2_server_method(void); /* SSLv2 */ const SSL_METHOD *SSLv2_client_method(void); /* SSLv2 */ @@ -3056,6 +3056,7 @@ void ERR_load_SSL_strings(void); # define SSL_R_SERVERHELLO_TLSEXT 275 # define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277 # define SSL_R_SHORT_READ 219 +# define SSL_R_SHUTDOWN_WHILE_IN_INIT 407 # define SSL_R_SIGNATURE_ALGORITHMS_ERROR 360 # define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 # define SSL_R_SRP_A_CALC 361 diff --git a/vendor/openssl/openssl/ssl/ssl_cert.c b/vendor/openssl/openssl/ssl/ssl_cert.c index a73f866cb..f48ebaecc 100644 --- a/vendor/openssl/openssl/ssl/ssl_cert.c +++ b/vendor/openssl/openssl/ssl/ssl_cert.c @@ -504,6 +504,8 @@ void ssl_cert_free(CERT *c) #ifndef OPENSSL_NO_TLSEXT custom_exts_free(&c->cli_ext); custom_exts_free(&c->srv_ext); + if (c->alpn_proposed) + OPENSSL_free(c->alpn_proposed); #endif OPENSSL_free(c); } @@ -1057,13 +1059,18 @@ static int ssl_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x) unsigned char *p; n = i2d_X509(x, NULL); - if (!BUF_MEM_grow_clean(buf, (int)(n + (*l) + 3))) { + if (n < 0 || !BUF_MEM_grow_clean(buf, (int)(n + (*l) + 3))) { SSLerr(SSL_F_SSL_ADD_CERT_TO_BUF, ERR_R_BUF_LIB); return 0; } p = (unsigned char *)&(buf->data[*l]); l2n3(n, p); - i2d_X509(x, &p); + n = i2d_X509(x, &p); + if (n < 0) { + /* Shouldn't happen */ + SSLerr(SSL_F_SSL_ADD_CERT_TO_BUF, ERR_R_BUF_LIB); + return 0; + } *l += n + 3; return 1; diff --git a/vendor/openssl/openssl/ssl/ssl_ciph.c b/vendor/openssl/openssl/ssl/ssl_ciph.c index 6957bda78..302464e64 100644 --- a/vendor/openssl/openssl/ssl/ssl_ciph.c +++ b/vendor/openssl/openssl/ssl/ssl_ciph.c @@ -235,8 +235,7 @@ static const SSL_CIPHER cipher_aliases[] = { * "COMPLEMENTOFDEFAULT" (does *not* include ciphersuites not found in * ALL!) */ - {0, SSL_TXT_CMPDEF, 0, 0, SSL_aNULL, ~SSL_eNULL, 0, ~SSL_SSLV2, - SSL_EXP_MASK, 0, 0, 0}, + {0, SSL_TXT_CMPDEF, 0, 0, 0, 0, 0, 0, SSL_NOT_DEFAULT, 0, 0, 0}, /* * key exchange aliases (some of those using only a single bit here @@ -1030,10 +1029,6 @@ static void ssl_cipher_apply_rule(unsigned long cipher_id, if (cipher_id && cipher_id != cp->id) continue; #endif - if (algo_strength == SSL_EXP_MASK && SSL_C_IS_EXPORT(cp)) - goto ok; - if (alg_ssl == ~SSL_SSLV2 && cp->algorithm_ssl == SSL_SSLV2) - goto ok; if (alg_mkey && !(alg_mkey & cp->algorithm_mkey)) continue; if (alg_auth && !(alg_auth & cp->algorithm_auth)) @@ -1050,10 +1045,11 @@ static void ssl_cipher_apply_rule(unsigned long cipher_id, if ((algo_strength & SSL_STRONG_MASK) && !(algo_strength & SSL_STRONG_MASK & cp->algo_strength)) continue; + if ((algo_strength & SSL_NOT_DEFAULT) + && !(cp->algo_strength & SSL_NOT_DEFAULT)) + continue; } - ok: - #ifdef CIPHER_DEBUG fprintf(stderr, "Action = %d\n", rule); #endif @@ -1337,6 +1333,10 @@ static int ssl_cipher_process_rulestr(const char *rule_str, ca_list[j]->algo_strength & SSL_STRONG_MASK; } + if (ca_list[j]->algo_strength & SSL_NOT_DEFAULT) { + algo_strength |= SSL_NOT_DEFAULT; + } + if (ca_list[j]->valid) { /* * explicit ciphersuite found; its protocol version does not diff --git a/vendor/openssl/openssl/ssl/ssl_conf.c b/vendor/openssl/openssl/ssl/ssl_conf.c index 5478840de..8d3709d2b 100644 --- a/vendor/openssl/openssl/ssl/ssl_conf.c +++ b/vendor/openssl/openssl/ssl/ssl_conf.c @@ -330,11 +330,19 @@ static int cmd_Protocol(SSL_CONF_CTX *cctx, const char *value) SSL_FLAG_TBL_INV("TLSv1.1", SSL_OP_NO_TLSv1_1), SSL_FLAG_TBL_INV("TLSv1.2", SSL_OP_NO_TLSv1_2) }; + int ret; + int sslv2off; + if (!(cctx->flags & SSL_CONF_FLAG_FILE)) return -2; cctx->tbl = ssl_protocol_list; cctx->ntbl = sizeof(ssl_protocol_list) / sizeof(ssl_flag_tbl); - return CONF_parse_list(value, ',', 1, ssl_set_option_list, cctx); + + sslv2off = *cctx->poptions & SSL_OP_NO_SSLv2; + ret = CONF_parse_list(value, ',', 1, ssl_set_option_list, cctx); + /* Never turn on SSLv2 through configuration */ + *cctx->poptions |= sslv2off; + return ret; } static int cmd_Options(SSL_CONF_CTX *cctx, const char *value) diff --git a/vendor/openssl/openssl/ssl/ssl_err.c b/vendor/openssl/openssl/ssl/ssl_err.c index 6d1366f2a..704088dc4 100644 --- a/vendor/openssl/openssl/ssl/ssl_err.c +++ b/vendor/openssl/openssl/ssl/ssl_err.c @@ -647,6 +647,7 @@ static ERR_STRING_DATA SSL_str_reasons[] = { {ERR_REASON(SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED), "session id context uninitialized"}, {ERR_REASON(SSL_R_SHORT_READ), "short read"}, + {ERR_REASON(SSL_R_SHUTDOWN_WHILE_IN_INIT), "shutdown while in init"}, {ERR_REASON(SSL_R_SIGNATURE_ALGORITHMS_ERROR), "signature algorithms error"}, {ERR_REASON(SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE), diff --git a/vendor/openssl/openssl/ssl/ssl_lib.c b/vendor/openssl/openssl/ssl/ssl_lib.c index f2071db93..fd94325bb 100644 --- a/vendor/openssl/openssl/ssl/ssl_lib.c +++ b/vendor/openssl/openssl/ssl/ssl_lib.c @@ -244,7 +244,16 @@ int SSL_clear(SSL *s) ssl_clear_hash_ctx(&s->write_hash); s->first_packet = 0; - +#ifndef OPENSSL_NO_TLSEXT + if (s->cert != NULL) { + if (s->cert->alpn_proposed) { + OPENSSL_free(s->cert->alpn_proposed); + s->cert->alpn_proposed = NULL; + } + s->cert->alpn_proposed_len = 0; + s->cert->alpn_sent = 0; + } +#endif #if 1 /* * Check to see if we were changed into a different method, if so, revert @@ -1060,10 +1069,12 @@ int SSL_shutdown(SSL *s) return -1; } - if ((s != NULL) && !SSL_in_init(s)) - return (s->method->ssl_shutdown(s)); - else - return (1); + if (!SSL_in_init(s)) { + return s->method->ssl_shutdown(s); + } else { + SSLerr(SSL_F_SSL_SHUTDOWN, SSL_R_SHUTDOWN_WHILE_IN_INIT); + return -1; + } } int SSL_renegotiate(SSL *s) @@ -2052,6 +2063,13 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth) */ ret->options |= SSL_OP_LEGACY_SERVER_CONNECT; + /* + * Disable SSLv2 by default, callers that want to enable SSLv2 will have to + * explicitly clear this option via either of SSL_CTX_clear_options() or + * SSL_clear_options(). + */ + ret->options |= SSL_OP_NO_SSLv2; + return (ret); err: SSLerr(SSL_F_SSL_CTX_NEW, ERR_R_MALLOC_FAILURE); @@ -3165,6 +3183,12 @@ SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx) ssl->cert->ciphers_rawlen = ocert->ciphers_rawlen; ocert->ciphers_raw = NULL; } +#ifndef OPENSSL_NO_TLSEXT + ssl->cert->alpn_proposed = ocert->alpn_proposed; + ssl->cert->alpn_proposed_len = ocert->alpn_proposed_len; + ocert->alpn_proposed = NULL; + ssl->cert->alpn_sent = ocert->alpn_sent; +#endif ssl_cert_free(ocert); } diff --git a/vendor/openssl/openssl/ssl/ssl_locl.h b/vendor/openssl/openssl/ssl/ssl_locl.h index a8e4efceb..747e718a5 100644 --- a/vendor/openssl/openssl/ssl/ssl_locl.h +++ b/vendor/openssl/openssl/ssl/ssl_locl.h @@ -436,8 +436,9 @@ # define SSL_MEDIUM 0x00000040L # define SSL_HIGH 0x00000080L # define SSL_FIPS 0x00000100L +# define SSL_NOT_DEFAULT 0x00000200L -/* we have used 000001ff - 23 bits left to go */ +/* we have used 000003ff - 22 bits left to go */ /*- * Macros to check the export status and cipher strength for export ciphers. @@ -687,6 +688,10 @@ typedef struct cert_st { custom_ext_methods cli_ext; custom_ext_methods srv_ext; int references; /* >1 only if SSL_copy_session_id is used */ + /* non-optimal, but here due to compatibility */ + unsigned char *alpn_proposed; /* server */ + unsigned int alpn_proposed_len; + int alpn_sent; /* client */ } CERT; typedef struct sess_cert_st { diff --git a/vendor/openssl/openssl/ssl/ssl_rsa.c b/vendor/openssl/openssl/ssl/ssl_rsa.c index b0f75c913..82022470b 100644 --- a/vendor/openssl/openssl/ssl/ssl_rsa.c +++ b/vendor/openssl/openssl/ssl/ssl_rsa.c @@ -841,7 +841,7 @@ static int serverinfo_srv_add_cb(SSL *s, unsigned int ext_type, return 0; /* No extension found, don't send extension */ return 1; /* Send extension */ } - return -1; /* No serverinfo data found, don't send + return 0; /* No serverinfo data found, don't send * extension */ } @@ -870,12 +870,26 @@ static int serverinfo_process_buffer(const unsigned char *serverinfo, /* Register callbacks for extensions */ ext_type = (serverinfo[0] << 8) + serverinfo[1]; - if (ctx && !SSL_CTX_add_server_custom_ext(ctx, ext_type, - serverinfo_srv_add_cb, - NULL, NULL, - serverinfo_srv_parse_cb, - NULL)) - return 0; + if (ctx) { + int have_ext_cbs = 0; + size_t i; + custom_ext_methods *exts = &ctx->cert->srv_ext; + custom_ext_method *meth = exts->meths; + + for (i = 0; i < exts->meths_count; i++, meth++) { + if (ext_type == meth->ext_type) { + have_ext_cbs = 1; + break; + } + } + + if (!have_ext_cbs && !SSL_CTX_add_server_custom_ext(ctx, ext_type, + serverinfo_srv_add_cb, + NULL, NULL, + serverinfo_srv_parse_cb, + NULL)) + return 0; + } serverinfo += 2; serverinfo_length -= 2; diff --git a/vendor/openssl/openssl/ssl/ssl_sess.c b/vendor/openssl/openssl/ssl/ssl_sess.c index 68390d310..b18299834 100644 --- a/vendor/openssl/openssl/ssl/ssl_sess.c +++ b/vendor/openssl/openssl/ssl/ssl_sess.c @@ -573,9 +573,6 @@ int ssl_get_prev_session(SSL *s, unsigned char *session_id, int len, int r; #endif - if (len < 0 || len > SSL_MAX_SSL_SESSION_ID_LENGTH) - goto err; - if (session_id + len > limit) { fatal = 1; goto err; diff --git a/vendor/openssl/openssl/ssl/ssltest.c b/vendor/openssl/openssl/ssl/ssltest.c index aaf6c6bd8..1db84ad5f 100644 --- a/vendor/openssl/openssl/ssl/ssltest.c +++ b/vendor/openssl/openssl/ssl/ssltest.c @@ -217,6 +217,9 @@ # define TEST_CLIENT_CERT "../apps/client.pem" #endif +static SSL_CTX *s_ctx = NULL; +static SSL_CTX *s_ctx2 = NULL; + /* * There is really no standard for this, so let's assign some tentative * numbers. In any case, these numbers are only for this test @@ -300,9 +303,51 @@ static BIO *bio_err = NULL; static BIO *bio_stdout = NULL; static const char *alpn_client; -static const char *alpn_server; +static char *alpn_server; +static char *alpn_server2; static const char *alpn_expected; static unsigned char *alpn_selected; +static const char *sn_client; +static const char *sn_server1; +static const char *sn_server2; +static int sn_expect = 0; + +static int servername_cb(SSL *s, int *ad, void *arg) +{ + const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); + if (sn_server2 == NULL) { + BIO_printf(bio_stdout, "Servername 2 is NULL\n"); + return SSL_TLSEXT_ERR_NOACK; + } + + if (servername != NULL) { + if (s_ctx2 != NULL && sn_server2 != NULL && + !strcasecmp(servername, sn_server2)) { + BIO_printf(bio_stdout, "Switching server context.\n"); + SSL_set_SSL_CTX(s, s_ctx2); + } + } + return SSL_TLSEXT_ERR_OK; +} +static int verify_servername(SSL *client, SSL *server) +{ + /* just need to see if sn_context is what we expect */ + SSL_CTX* ctx = SSL_get_SSL_CTX(server); + if (sn_expect == 0) + return 0; + if (sn_expect == 1 && ctx == s_ctx) + return 0; + if (sn_expect == 2 && ctx == s_ctx2) + return 0; + BIO_printf(bio_stdout, "Servername: expected context %d\n", sn_expect); + if (ctx == s_ctx2) + BIO_printf(bio_stdout, "Servername: context is 2\n"); + else if (ctx == s_ctx) + BIO_printf(bio_stdout, "Servername: context is 1\n"); + else + BIO_printf(bio_stdout, "Servername: context is unknown\n"); + return -1; +} /*- * next_protos_parse parses a comma separated list of strings into a string @@ -350,11 +395,12 @@ static int cb_server_alpn(SSL *s, const unsigned char **out, { unsigned char *protos; unsigned short protos_len; + char* alpn_str = arg; - protos = next_protos_parse(&protos_len, alpn_server); + protos = next_protos_parse(&protos_len, alpn_str); if (protos == NULL) { fprintf(stderr, "failed to parser ALPN server protocol string: %s\n", - alpn_server); + alpn_str); abort(); } @@ -417,8 +463,17 @@ static int verify_alpn(SSL *client, SSL *server) BIO_printf(bio_stdout, "', server: '"); BIO_write(bio_stdout, server_proto, server_proto_len); BIO_printf(bio_stdout, "'\n"); - BIO_printf(bio_stdout, "ALPN configured: client: '%s', server: '%s'\n", - alpn_client, alpn_server); + BIO_printf(bio_stdout, "ALPN configured: client: '%s', server: ", + alpn_client); + if (SSL_get_SSL_CTX(server) == s_ctx2) { + BIO_printf(bio_stdout, "'%s'\n", + alpn_server2); + } else if (SSL_get_SSL_CTX(server) == s_ctx){ + BIO_printf(bio_stdout, "'%s'\n", + alpn_server); + } else { + BIO_printf(bio_stdout, "unknown\n"); + } return -1; } @@ -756,8 +811,15 @@ static void sv_usage(void) " -custom_ext - try various custom extension callbacks\n"); fprintf(stderr, " -alpn_client - have client side offer ALPN\n"); fprintf(stderr, " -alpn_server - have server side offer ALPN\n"); + fprintf(stderr, " -alpn_server1 - alias for -alpn_server\n"); + fprintf(stderr, " -alpn_server2 - have server side context 2 offer ALPN\n"); fprintf(stderr, " -alpn_expected - the ALPN protocol that should be negotiated\n"); + fprintf(stderr, " -sn_client - have client request this servername\n"); + fprintf(stderr, " -sn_server1 - have server context 1 respond to this servername\n"); + fprintf(stderr, " -sn_server2 - have server context 2 respond to this servername\n"); + fprintf(stderr, " -sn_expect1 - expected server 1\n"); + fprintf(stderr, " -sn_expect2 - expected server 2\n"); } static void print_details(SSL *c_ssl, const char *prefix) @@ -896,7 +958,6 @@ int main(int argc, char *argv[]) #ifndef OPENSSL_NO_ECDH char *named_curve = NULL; #endif - SSL_CTX *s_ctx = NULL; SSL_CTX *c_ctx = NULL; const SSL_METHOD *meth = NULL; SSL *c_ssl, *s_ssl; @@ -1151,14 +1212,35 @@ int main(int argc, char *argv[]) if (--argc < 1) goto bad; alpn_client = *(++argv); - } else if (strcmp(*argv, "-alpn_server") == 0) { + } else if (strcmp(*argv, "-alpn_server") == 0 || + strcmp(*argv, "-alpn_server1") == 0) { if (--argc < 1) goto bad; alpn_server = *(++argv); + } else if (strcmp(*argv, "-alpn_server2") == 0) { + if (--argc < 1) + goto bad; + alpn_server2 = *(++argv); } else if (strcmp(*argv, "-alpn_expected") == 0) { if (--argc < 1) goto bad; alpn_expected = *(++argv); + } else if (strcmp(*argv, "-sn_client") == 0) { + if (--argc < 1) + goto bad; + sn_client = *(++argv); + } else if (strcmp(*argv, "-sn_server1") == 0) { + if (--argc < 1) + goto bad; + sn_server1 = *(++argv); + } else if (strcmp(*argv, "-sn_server2") == 0) { + if (--argc < 1) + goto bad; + sn_server2 = *(++argv); + } else if (strcmp(*argv, "-sn_expect1") == 0) { + sn_expect = 1; + } else if (strcmp(*argv, "-sn_expect2") == 0) { + sn_expect = 2; } else { fprintf(stderr, "unknown option %s\n", *argv); badop = 1; @@ -1304,7 +1386,8 @@ int main(int argc, char *argv[]) c_ctx = SSL_CTX_new(meth); s_ctx = SSL_CTX_new(meth); - if ((c_ctx == NULL) || (s_ctx == NULL)) { + s_ctx2 = SSL_CTX_new(meth); /* no SSL_CTX_dup! */ + if ((c_ctx == NULL) || (s_ctx == NULL) || (s_ctx2 == NULL)) { ERR_print_errors(bio_err); goto end; } @@ -1312,7 +1395,9 @@ int main(int argc, char *argv[]) if (cipher != NULL) { SSL_CTX_set_cipher_list(c_ctx, cipher); SSL_CTX_set_cipher_list(s_ctx, cipher); + SSL_CTX_set_cipher_list(s_ctx2, cipher); } + #ifndef OPENSSL_NO_DH if (!no_dhe) { if (dhe1024dsa) { @@ -1320,12 +1405,14 @@ int main(int argc, char *argv[]) * use SSL_OP_SINGLE_DH_USE to avoid small subgroup attacks */ SSL_CTX_set_options(s_ctx, SSL_OP_SINGLE_DH_USE); + SSL_CTX_set_options(s_ctx2, SSL_OP_SINGLE_DH_USE); dh = get_dh1024dsa(); } else if (dhe512) dh = get_dh512(); else dh = get_dh1024(); SSL_CTX_set_tmp_dh(s_ctx, dh); + SSL_CTX_set_tmp_dh(s_ctx2, dh); DH_free(dh); } #else @@ -1353,7 +1440,9 @@ int main(int argc, char *argv[]) } SSL_CTX_set_tmp_ecdh(s_ctx, ecdh); + SSL_CTX_set_tmp_ecdh(s_ctx2, ecdh); SSL_CTX_set_options(s_ctx, SSL_OP_SINGLE_ECDH_USE); + SSL_CTX_set_options(s_ctx2, SSL_OP_SINGLE_ECDH_USE); EC_KEY_free(ecdh); } #else @@ -1362,15 +1451,18 @@ int main(int argc, char *argv[]) #ifndef OPENSSL_NO_RSA SSL_CTX_set_tmp_rsa_callback(s_ctx, tmp_rsa_cb); + SSL_CTX_set_tmp_rsa_callback(s_ctx2, tmp_rsa_cb); #endif #ifdef TLSEXT_TYPE_opaque_prf_input SSL_CTX_set_tlsext_opaque_prf_input_callback(c_ctx, opaque_prf_input_cb); SSL_CTX_set_tlsext_opaque_prf_input_callback(s_ctx, opaque_prf_input_cb); + SSL_CTX_set_tlsext_opaque_prf_input_callback(s_ctx2, opaque_prf_input_cb); /* or &co2 or NULL */ SSL_CTX_set_tlsext_opaque_prf_input_callback_arg(c_ctx, &co1); /* or &so2 or NULL */ SSL_CTX_set_tlsext_opaque_prf_input_callback_arg(s_ctx, &so1); + SSL_CTX_set_tlsext_opaque_prf_input_callback_arg(s_ctx2, &so1); #endif if (!SSL_CTX_use_certificate_file(s_ctx, server_cert, SSL_FILETYPE_PEM)) { @@ -1383,6 +1475,16 @@ int main(int argc, char *argv[]) goto end; } + if (!SSL_CTX_use_certificate_file(s_ctx2, server_cert, SSL_FILETYPE_PEM)) { + ERR_print_errors(bio_err); + } else if (!SSL_CTX_use_PrivateKey_file(s_ctx2, + (server_key ? server_key : + server_cert), + SSL_FILETYPE_PEM)) { + ERR_print_errors(bio_err); + goto end; + } + if (client_auth) { SSL_CTX_use_certificate_file(c_ctx, client_cert, SSL_FILETYPE_PEM); SSL_CTX_use_PrivateKey_file(c_ctx, @@ -1392,6 +1494,8 @@ int main(int argc, char *argv[]) if ((!SSL_CTX_load_verify_locations(s_ctx, CAfile, CApath)) || (!SSL_CTX_set_default_verify_paths(s_ctx)) || + (!SSL_CTX_load_verify_locations(s_ctx2, CAfile, CApath)) || + (!SSL_CTX_set_default_verify_paths(s_ctx2)) || (!SSL_CTX_load_verify_locations(c_ctx, CAfile, CApath)) || (!SSL_CTX_set_default_verify_paths(c_ctx))) { /* fprintf(stderr,"SSL_load_verify_locations\n"); */ @@ -1406,6 +1510,11 @@ int main(int argc, char *argv[]) verify_callback); SSL_CTX_set_cert_verify_callback(s_ctx, app_verify_callback, &app_verify_arg); + SSL_CTX_set_verify(s_ctx2, + SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, + verify_callback); + SSL_CTX_set_cert_verify_callback(s_ctx2, app_verify_callback, + &app_verify_arg); } if (server_auth) { BIO_printf(bio_err, "server authentication\n"); @@ -1418,6 +1527,8 @@ int main(int argc, char *argv[]) int session_id_context = 0; SSL_CTX_set_session_id_context(s_ctx, (void *)&session_id_context, sizeof session_id_context); + SSL_CTX_set_session_id_context(s_ctx2, (void *)&session_id_context, + sizeof session_id_context); } /* Use PSK only if PSK key is given */ @@ -1436,6 +1547,7 @@ int main(int argc, char *argv[]) #ifndef OPENSSL_NO_PSK SSL_CTX_set_psk_client_callback(c_ctx, psk_client_callback); SSL_CTX_set_psk_server_callback(s_ctx, psk_server_callback); + SSL_CTX_set_psk_server_callback(s_ctx2, psk_server_callback); if (debug) BIO_printf(bio_err, "setting PSK identity hint to s_ctx\n"); if (!SSL_CTX_use_psk_identity_hint(s_ctx, "ctx server identity_hint")) { @@ -1443,6 +1555,11 @@ int main(int argc, char *argv[]) ERR_print_errors(bio_err); goto end; } + if (!SSL_CTX_use_psk_identity_hint(s_ctx2, "ctx server identity_hint")) { + BIO_printf(bio_err, "error setting PSK identity hint to s_ctx2\n"); + ERR_print_errors(bio_err); + goto end; + } #endif } #ifndef OPENSSL_NO_SRP @@ -1461,8 +1578,11 @@ int main(int argc, char *argv[]) if (srp_server_arg.expected_user != NULL) { SSL_CTX_set_verify(s_ctx, SSL_VERIFY_NONE, verify_callback); + SSL_CTX_set_verify(s_ctx2, SSL_VERIFY_NONE, verify_callback); SSL_CTX_set_srp_cb_arg(s_ctx, &srp_server_arg); + SSL_CTX_set_srp_cb_arg(s_ctx2, &srp_server_arg); SSL_CTX_set_srp_username_callback(s_ctx, ssl_srp_server_param_cb); + SSL_CTX_set_srp_username_callback(s_ctx2, ssl_srp_server_param_cb); } #endif @@ -1475,11 +1595,16 @@ int main(int argc, char *argv[]) NULL, NULL, NULL, serverinfo_cli_parse_cb, NULL); - if (serverinfo_file) + if (serverinfo_file) { if (!SSL_CTX_use_serverinfo_file(s_ctx, serverinfo_file)) { BIO_printf(bio_err, "missing serverinfo file\n"); goto end; } + if (!SSL_CTX_use_serverinfo_file(s_ctx2, serverinfo_file)) { + BIO_printf(bio_err, "missing serverinfo file\n"); + goto end; + } + } if (custom_ext) { SSL_CTX_add_client_custom_ext(c_ctx, CUSTOM_EXT_TYPE_0, @@ -1515,10 +1640,29 @@ int main(int argc, char *argv[]) custom_ext_3_srv_add_cb, NULL, NULL, custom_ext_3_srv_parse_cb, NULL); + + SSL_CTX_add_server_custom_ext(s_ctx2, CUSTOM_EXT_TYPE_0, + custom_ext_0_srv_add_cb, + NULL, NULL, + custom_ext_0_srv_parse_cb, NULL); + SSL_CTX_add_server_custom_ext(s_ctx2, CUSTOM_EXT_TYPE_1, + custom_ext_1_srv_add_cb, + NULL, NULL, + custom_ext_1_srv_parse_cb, NULL); + SSL_CTX_add_server_custom_ext(s_ctx2, CUSTOM_EXT_TYPE_2, + custom_ext_2_srv_add_cb, + NULL, NULL, + custom_ext_2_srv_parse_cb, NULL); + SSL_CTX_add_server_custom_ext(s_ctx2, CUSTOM_EXT_TYPE_3, + custom_ext_3_srv_add_cb, + NULL, NULL, + custom_ext_3_srv_parse_cb, NULL); } if (alpn_server) - SSL_CTX_set_alpn_select_cb(s_ctx, cb_server_alpn, NULL); + SSL_CTX_set_alpn_select_cb(s_ctx, cb_server_alpn, alpn_server); + if (alpn_server2) + SSL_CTX_set_alpn_select_cb(s_ctx2, cb_server_alpn, alpn_server2); if (alpn_client) { unsigned short alpn_len; @@ -1532,9 +1676,15 @@ int main(int argc, char *argv[]) OPENSSL_free(alpn); } + if (sn_server1 || sn_server2) + SSL_CTX_set_tlsext_servername_callback(s_ctx, servername_cb); + c_ssl = SSL_new(c_ctx); s_ssl = SSL_new(s_ctx); + if (sn_client) + SSL_set_tlsext_host_name(c_ssl, sn_client); + #ifndef OPENSSL_NO_KRB5 if (c_ssl && c_ssl->kssl_ctx) { char localhost[MAXHOSTNAMELEN + 2]; @@ -1588,12 +1738,19 @@ int main(int argc, char *argv[]) #endif } + if (verify_alpn(c_ssl, s_ssl) < 0) + ret = 1; + if (verify_servername(c_ssl, s_ssl) < 0) + ret = 1; + SSL_free(s_ssl); SSL_free(c_ssl); end: if (s_ctx != NULL) SSL_CTX_free(s_ctx); + if (s_ctx2 != NULL) + SSL_CTX_free(s_ctx2); if (c_ctx != NULL) SSL_CTX_free(c_ctx); @@ -1961,10 +2118,6 @@ int doit_biopair(SSL *s_ssl, SSL *c_ssl, long count, ret = 1; goto err; } - if (verify_alpn(c_ssl, s_ssl) < 0) { - ret = 1; - goto err; - } if (custom_ext_error) { ret = 1; diff --git a/vendor/openssl/openssl/ssl/sslv2conftest.c b/vendor/openssl/openssl/ssl/sslv2conftest.c new file mode 100755 index 000000000..1fd748b11 --- /dev/null +++ b/vendor/openssl/openssl/ssl/sslv2conftest.c @@ -0,0 +1,231 @@ +/* Written by Matt Caswell for the OpenSSL Project */ +/* ==================================================================== + * Copyright (c) 2016 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include +#include +#include +#include + + +#define TOTAL_NUM_TESTS 2 +#define TEST_SSL_CTX 0 + +#define SSLV2ON 1 +#define SSLV2OFF 0 + +SSL_CONF_CTX *confctx; +SSL_CTX *ctx; +SSL *ssl; + +static int checksslv2(int test, int sslv2) +{ + int options; + if (test == TEST_SSL_CTX) { + options = SSL_CTX_get_options(ctx); + } else { + options = SSL_get_options(ssl); + } + return ((options & SSL_OP_NO_SSLv2) == 0) ^ (sslv2 == SSLV2OFF); +} + +int main(int argc, char *argv[]) +{ + BIO *err; + int testresult = 0; + int currtest; + + SSL_library_init(); + SSL_load_error_strings(); + + err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT); + + CRYPTO_malloc_debug_init(); + CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL); + CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); + + + confctx = SSL_CONF_CTX_new(); + ctx = SSL_CTX_new(SSLv23_method()); + ssl = SSL_new(ctx); + if (confctx == NULL || ctx == NULL) + goto end; + + SSL_CONF_CTX_set_flags(confctx, SSL_CONF_FLAG_FILE + | SSL_CONF_FLAG_CLIENT + | SSL_CONF_FLAG_SERVER); + + /* + * For each test set up an SSL_CTX and SSL and see whether SSLv2 is enabled + * as expected after various SSL_CONF_cmd("Protocol", ...) calls. + */ + for (currtest = 0; currtest < TOTAL_NUM_TESTS; currtest++) { + BIO_printf(err, "SSLv2 CONF Test number %d\n", currtest); + if (currtest == TEST_SSL_CTX) + SSL_CONF_CTX_set_ssl_ctx(confctx, ctx); + else + SSL_CONF_CTX_set_ssl(confctx, ssl); + + /* SSLv2 should be off by default */ + if (!checksslv2(currtest, SSLV2OFF)) { + BIO_printf(err, "SSLv2 CONF Test: Off by default test FAIL\n"); + goto end; + } + + if (SSL_CONF_cmd(confctx, "Protocol", "ALL") != 2 + || !SSL_CONF_CTX_finish(confctx)) { + BIO_printf(err, "SSLv2 CONF Test: SSL_CONF command FAIL\n"); + goto end; + } + + /* Should still be off even after ALL Protocols on */ + if (!checksslv2(currtest, SSLV2OFF)) { + BIO_printf(err, "SSLv2 CONF Test: Off after config #1 FAIL\n"); + goto end; + } + + if (SSL_CONF_cmd(confctx, "Protocol", "SSLv2") != 2 + || !SSL_CONF_CTX_finish(confctx)) { + BIO_printf(err, "SSLv2 CONF Test: SSL_CONF command FAIL\n"); + goto end; + } + + /* Should still be off even if explicitly asked for */ + if (!checksslv2(currtest, SSLV2OFF)) { + BIO_printf(err, "SSLv2 CONF Test: Off after config #2 FAIL\n"); + goto end; + } + + if (SSL_CONF_cmd(confctx, "Protocol", "-SSLv2") != 2 + || !SSL_CONF_CTX_finish(confctx)) { + BIO_printf(err, "SSLv2 CONF Test: SSL_CONF command FAIL\n");; + goto end; + } + + if (!checksslv2(currtest, SSLV2OFF)) { + BIO_printf(err, "SSLv2 CONF Test: Off after config #3 FAIL\n"); + goto end; + } + + if (currtest == TEST_SSL_CTX) + SSL_CTX_clear_options(ctx, SSL_OP_NO_SSLv2); + else + SSL_clear_options(ssl, SSL_OP_NO_SSLv2); + + if (!checksslv2(currtest, SSLV2ON)) { + BIO_printf(err, "SSLv2 CONF Test: On after clear FAIL\n"); + goto end; + } + + if (SSL_CONF_cmd(confctx, "Protocol", "ALL") != 2 + || !SSL_CONF_CTX_finish(confctx)) { + BIO_printf(err, "SSLv2 CONF Test: SSL_CONF command FAIL\n"); + goto end; + } + + /* Option has been cleared and config says have SSLv2 so should be on */ + if (!checksslv2(currtest, SSLV2ON)) { + BIO_printf(err, "SSLv2 CONF Test: On after config #1 FAIL\n"); + goto end; + } + + if (SSL_CONF_cmd(confctx, "Protocol", "SSLv2") != 2 + || !SSL_CONF_CTX_finish(confctx)) { + BIO_printf(err, "SSLv2 CONF Test: SSL_CONF command FAIL\n"); + goto end; + } + + /* Option has been cleared and config says have SSLv2 so should be on */ + if (!checksslv2(currtest, SSLV2ON)) { + BIO_printf(err, "SSLv2 CONF Test: On after config #2 FAIL\n"); + goto end; + } + + if (SSL_CONF_cmd(confctx, "Protocol", "-SSLv2") != 2 + || !SSL_CONF_CTX_finish(confctx)) { + BIO_printf(err, "SSLv2 CONF Test: SSL_CONF command FAIL\n"); + goto end; + } + + /* Option has been cleared but config says no SSLv2 so should be off */ + if (!checksslv2(currtest, SSLV2OFF)) { + BIO_printf(err, "SSLv2 CONF Test: Off after config #4 FAIL\n"); + goto end; + } + + } + + testresult = 1; + + end: + SSL_free(ssl); + SSL_CTX_free(ctx); + SSL_CONF_CTX_free(confctx); + + if (!testresult) { + printf("SSLv2 CONF test: FAILED (Test %d)\n", currtest); + ERR_print_errors(err); + } else { + printf("SSLv2 CONF test: PASSED\n"); + } + + ERR_free_strings(); + ERR_remove_thread_state(NULL); + EVP_cleanup(); + CRYPTO_cleanup_all_ex_data(); + CRYPTO_mem_leaks(err); + BIO_free(err); + + return testresult ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/vendor/openssl/openssl/ssl/t1_enc.c b/vendor/openssl/openssl/ssl/t1_enc.c index f46544b4d..514fcb3e4 100644 --- a/vendor/openssl/openssl/ssl/t1_enc.c +++ b/vendor/openssl/openssl/ssl/t1_enc.c @@ -1155,7 +1155,7 @@ int tls1_generate_master_secret(SSL *s, unsigned char *out, unsigned char *p, so = s->s3->server_opaque_prf_input; /* * must be same as col (see - * draft-resc-00.txts-opaque-prf-input-00.txt, section 3.1) + * draft-rescorla-tls-opaque-prf-input-00.txt, section 3.1) */ sol = s->s3->client_opaque_prf_input_len; } diff --git a/vendor/openssl/openssl/ssl/t1_lib.c b/vendor/openssl/openssl/ssl/t1_lib.c index 3176d1e3b..dd5bd0050 100644 --- a/vendor/openssl/openssl/ssl/t1_lib.c +++ b/vendor/openssl/openssl/ssl/t1_lib.c @@ -1539,6 +1539,7 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *buf, s2n(s->alpn_client_proto_list_len, ret); memcpy(ret, s->alpn_client_proto_list, s->alpn_client_proto_list_len); ret += s->alpn_client_proto_list_len; + s->cert->alpn_sent = 1; } # ifndef OPENSSL_NO_SRTP if (SSL_IS_DTLS(s) && SSL_get_srtp_profiles(s)) { @@ -1906,7 +1907,7 @@ static void ssl_check_for_safari(SSL *s, const unsigned char *data, # endif /* !OPENSSL_NO_EC */ /* - * tls1_alpn_handle_client_hello is called to process the ALPN extension in a + * tls1_alpn_handle_client_hello is called to save the ALPN extension in a * ClientHello. data: the contents of the extension, not including the type * and length. data_len: the number of bytes in |data| al: a pointer to the * alert value to send in the event of a non-zero return. returns: 0 on @@ -1917,12 +1918,6 @@ static int tls1_alpn_handle_client_hello(SSL *s, const unsigned char *data, { unsigned i; unsigned proto_len; - const unsigned char *selected; - unsigned char selected_len; - int r; - - if (s->ctx->alpn_select_cb == NULL) - return 0; if (data_len < 2) goto parse_error; @@ -1953,19 +1948,15 @@ static int tls1_alpn_handle_client_hello(SSL *s, const unsigned char *data, i += proto_len; } - r = s->ctx->alpn_select_cb(s, &selected, &selected_len, data, data_len, - s->ctx->alpn_select_cb_arg); - if (r == SSL_TLSEXT_ERR_OK) { - if (s->s3->alpn_selected) - OPENSSL_free(s->s3->alpn_selected); - s->s3->alpn_selected = OPENSSL_malloc(selected_len); - if (!s->s3->alpn_selected) { - *al = SSL_AD_INTERNAL_ERROR; - return -1; - } - memcpy(s->s3->alpn_selected, selected, selected_len); - s->s3->alpn_selected_len = selected_len; + if (s->cert->alpn_proposed != NULL) + OPENSSL_free(s->cert->alpn_proposed); + s->cert->alpn_proposed = OPENSSL_malloc(data_len); + if (s->cert->alpn_proposed == NULL) { + *al = SSL_AD_INTERNAL_ERROR; + return -1; } + memcpy(s->cert->alpn_proposed, data, data_len); + s->cert->alpn_proposed_len = data_len; return 0; parse_error: @@ -1973,6 +1964,43 @@ static int tls1_alpn_handle_client_hello(SSL *s, const unsigned char *data, return -1; } +/* + * Process the ALPN extension in a ClientHello. + * ret: a pointer to the TLSEXT return value: SSL_TLSEXT_ERR_* + * al: a pointer to the alert value to send in the event of a failure. + * returns 1 on success, 0 on failure: al/ret set only on failure + */ +static int tls1_alpn_handle_client_hello_late(SSL *s, int *ret, int *al) +{ + const unsigned char *selected = NULL; + unsigned char selected_len = 0; + + if (s->ctx->alpn_select_cb != NULL && s->cert->alpn_proposed != NULL) { + int r = s->ctx->alpn_select_cb(s, &selected, &selected_len, + s->cert->alpn_proposed, + s->cert->alpn_proposed_len, + s->ctx->alpn_select_cb_arg); + + if (r == SSL_TLSEXT_ERR_OK) { + OPENSSL_free(s->s3->alpn_selected); + s->s3->alpn_selected = OPENSSL_malloc(selected_len); + if (s->s3->alpn_selected == NULL) { + *al = SSL_AD_INTERNAL_ERROR; + *ret = SSL_TLSEXT_ERR_ALERT_FATAL; + return 0; + } + memcpy(s->s3->alpn_selected, selected, selected_len); + s->s3->alpn_selected_len = selected_len; +# ifndef OPENSSL_NO_NEXTPROTONEG + /* ALPN takes precedence over NPN. */ + s->s3->next_proto_neg_seen = 0; +# endif + } + } + + return 1; +} + static int ssl_scan_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *limit, int *al) { @@ -1992,6 +2020,12 @@ static int ssl_scan_clienthello_tlsext(SSL *s, unsigned char **p, OPENSSL_free(s->s3->alpn_selected); s->s3->alpn_selected = NULL; } + s->s3->alpn_selected_len = 0; + if (s->cert->alpn_proposed) { + OPENSSL_free(s->cert->alpn_proposed); + s->cert->alpn_proposed = NULL; + } + s->cert->alpn_proposed_len = 0; # ifndef OPENSSL_NO_HEARTBEATS s->tlsext_heartbeat &= ~(SSL_TLSEXT_HB_ENABLED | SSL_TLSEXT_HB_DONT_SEND_REQUESTS); @@ -2359,8 +2393,7 @@ static int ssl_scan_clienthello_tlsext(SSL *s, unsigned char **p, # endif # ifndef OPENSSL_NO_NEXTPROTONEG else if (type == TLSEXT_TYPE_next_proto_neg && - s->s3->tmp.finish_md_len == 0 && - s->s3->alpn_selected == NULL) { + s->s3->tmp.finish_md_len == 0) { /*- * We shouldn't accept this extension on a * renegotiation. @@ -2383,13 +2416,9 @@ static int ssl_scan_clienthello_tlsext(SSL *s, unsigned char **p, # endif else if (type == TLSEXT_TYPE_application_layer_protocol_negotiation && - s->ctx->alpn_select_cb && s->s3->tmp.finish_md_len == 0) { + s->s3->tmp.finish_md_len == 0) { if (tls1_alpn_handle_client_hello(s, data, size, al) != 0) return 0; -# ifndef OPENSSL_NO_NEXTPROTONEG - /* ALPN takes precedence over NPN. */ - s->s3->next_proto_neg_seen = 0; -# endif } /* session ticket processed earlier */ @@ -2698,7 +2727,7 @@ static int ssl_scan_serverhello_tlsext(SSL *s, unsigned char **p, unsigned len; /* We must have requested it. */ - if (s->alpn_client_proto_list == NULL) { + if (!s->cert->alpn_sent) { *al = TLS1_AD_UNSUPPORTED_EXTENSION; return 0; } @@ -2863,6 +2892,7 @@ int ssl_prepare_clienthello_tlsext(SSL *s) } # endif + s->cert->alpn_sent = 0; return 1; } @@ -3066,6 +3096,10 @@ int ssl_check_clienthello_tlsext_late(SSL *s) } else s->tlsext_status_expected = 0; + if (!tls1_alpn_handle_client_hello_late(s, &ret, &al)) { + goto err; + } + err: switch (ret) { case SSL_TLSEXT_ERR_ALERT_FATAL: @@ -3157,22 +3191,20 @@ int ssl_check_serverhello_tlsext(SSL *s) } # endif + OPENSSL_free(s->tlsext_ocsp_resp); + s->tlsext_ocsp_resp = NULL; + s->tlsext_ocsp_resplen = -1; /* * If we've requested certificate status and we wont get one tell the * callback */ if ((s->tlsext_status_type != -1) && !(s->tlsext_status_expected) - && s->ctx && s->ctx->tlsext_status_cb) { + && !(s->hit) && s->ctx && s->ctx->tlsext_status_cb) { int r; /* - * Set resp to NULL, resplen to -1 so callback knows there is no - * response. + * Call callback with resp == NULL and resplen == -1 so callback + * knows there is no response */ - if (s->tlsext_ocsp_resp) { - OPENSSL_free(s->tlsext_ocsp_resp); - s->tlsext_ocsp_resp = NULL; - } - s->tlsext_ocsp_resplen = -1; r = s->ctx->tlsext_status_cb(s, s->ctx->tlsext_status_arg); if (r == 0) { al = SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE; @@ -3417,8 +3449,10 @@ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick, p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx); eticklen -= 16 + EVP_CIPHER_CTX_iv_length(&ctx); sdec = OPENSSL_malloc(eticklen); - if (!sdec || EVP_DecryptUpdate(&ctx, sdec, &slen, p, eticklen) <= 0) { + if (sdec == NULL + || EVP_DecryptUpdate(&ctx, sdec, &slen, p, eticklen) <= 0) { EVP_CIPHER_CTX_cleanup(&ctx); + OPENSSL_free(sdec); return -1; } if (EVP_DecryptFinal(&ctx, sdec + slen, &mlen) <= 0) { @@ -3583,7 +3617,7 @@ static int tls12_get_pkey_idx(unsigned char sig_alg) static void tls1_lookup_sigalg(int *phash_nid, int *psign_nid, int *psignhash_nid, const unsigned char *data) { - int sign_nid = 0, hash_nid = 0; + int sign_nid = NID_undef, hash_nid = NID_undef; if (!phash_nid && !psign_nid && !psignhash_nid) return; if (phash_nid || psignhash_nid) { @@ -3599,9 +3633,9 @@ static void tls1_lookup_sigalg(int *phash_nid, int *psign_nid, *psign_nid = sign_nid; } if (psignhash_nid) { - if (sign_nid && hash_nid) - OBJ_find_sigid_by_algs(psignhash_nid, hash_nid, sign_nid); - else + if (sign_nid == NID_undef || hash_nid == NID_undef + || OBJ_find_sigid_by_algs(psignhash_nid, hash_nid, + sign_nid) <= 0) *psignhash_nid = NID_undef; } } @@ -3858,6 +3892,8 @@ int tls1_process_heartbeat(SSL *s) * plus 2 bytes payload length, plus payload, plus padding */ buffer = OPENSSL_malloc(1 + 2 + payload + padding); + if (buffer == NULL) + return -1; bp = buffer; /* Enter response type, length and copy payload */ diff --git a/vendor/openssl/openssl/test/Makefile b/vendor/openssl/openssl/test/Makefile index b180971b2..e566babfa 100644 --- a/vendor/openssl/openssl/test/Makefile +++ b/vendor/openssl/openssl/test/Makefile @@ -70,6 +70,7 @@ HEARTBEATTEST= heartbeat_test CONSTTIMETEST= constant_time_test VERIFYEXTRATEST= verify_extra_test CLIENTHELLOTEST= clienthellotest +SSLV2CONFTEST = sslv2conftest TESTS= alltests @@ -83,7 +84,7 @@ EXE= $(BNTEST)$(EXE_EXT) $(ECTEST)$(EXE_EXT) $(ECDSATEST)$(EXE_EXT) $(ECDHTEST) $(EVPTEST)$(EXE_EXT) $(EVPEXTRATEST)$(EXE_EXT) $(IGETEST)$(EXE_EXT) $(JPAKETEST)$(EXE_EXT) $(SRPTEST)$(EXE_EXT) \ $(ASN1TEST)$(EXE_EXT) $(V3NAMETEST)$(EXE_EXT) $(HEARTBEATTEST)$(EXE_EXT) \ $(CONSTTIMETEST)$(EXE_EXT) $(VERIFYEXTRATEST)$(EXE_EXT) \ - $(CLIENTHELLOTEST)$(EXE_EXT) + $(CLIENTHELLOTEST)$(EXE_EXT) $(SSLV2CONFTEST)$(EXE_EXT) # $(METHTEST)$(EXE_EXT) @@ -97,7 +98,7 @@ OBJ= $(BNTEST).o $(ECTEST).o $(ECDSATEST).o $(ECDHTEST).o $(IDEATEST).o \ $(BFTEST).o $(SSLTEST).o $(DSATEST).o $(EXPTEST).o $(RSATEST).o \ $(EVPTEST).o $(EVPEXTRATEST).o $(IGETEST).o $(JPAKETEST).o $(ASN1TEST).o $(V3NAMETEST).o \ $(HEARTBEATTEST).o $(CONSTTIMETEST).o $(VERIFYEXTRATEST).o \ - $(CLIENTHELLOTEST).o + $(CLIENTHELLOTEST).o $(SSLV2CONFTEST).o SRC= $(BNTEST).c $(ECTEST).c $(ECDSATEST).c $(ECDHTEST).c $(IDEATEST).c \ $(MD2TEST).c $(MD4TEST).c $(MD5TEST).c \ @@ -108,7 +109,7 @@ SRC= $(BNTEST).c $(ECTEST).c $(ECDSATEST).c $(ECDHTEST).c $(IDEATEST).c \ $(BFTEST).c $(SSLTEST).c $(DSATEST).c $(EXPTEST).c $(RSATEST).c \ $(EVPTEST).c $(EVPEXTRATEST).c $(IGETEST).c $(JPAKETEST).c $(SRPTEST).c $(ASN1TEST).c \ $(V3NAMETEST).c $(HEARTBEATTEST).c $(CONSTTIMETEST).c $(VERIFYEXTRATEST).c \ - $(CLIENTHELLOTEST).c + $(CLIENTHELLOTEST).c $(SSLV2CONFTEST).c EXHEADER= HEADER= testutil.h $(EXHEADER) @@ -152,7 +153,7 @@ alltests: \ test_gen test_req test_pkcs7 test_verify test_dh test_dsa \ test_ss test_ca test_engine test_evp test_evp_extra test_ssl test_tsa test_ige \ test_jpake test_srp test_cms test_ocsp test_v3name test_heartbeat \ - test_constant_time test_verify_extra test_clienthello + test_constant_time test_verify_extra test_clienthello test_sslv2conftest test_evp: $(EVPTEST)$(EXE_EXT) evptests.txt ../util/shlib_wrap.sh ./$(EVPTEST) evptests.txt @@ -361,6 +362,10 @@ test_clienthello: $(CLIENTHELLOTEST)$(EXE_EXT) @echo $(START) $@ ../util/shlib_wrap.sh ./$(CLIENTHELLOTEST) +test_sslv2conftest: $(SSLV2CONFTEST)$(EXE_EXT) + @echo $(START) $@ + ../util/shlib_wrap.sh ./$(SSLV2CONFTEST) + lint: lint -DLINT $(INCLUDES) $(SRC)>fluff @@ -538,6 +543,9 @@ $(VERIFYEXTRATEST)$(EXE_EXT): $(VERIFYEXTRATEST).o $(CLIENTHELLOTEST)$(EXE_EXT): $(CLIENTHELLOTEST).o @target=$(CLIENTHELLOTEST) $(BUILD_CMD) +$(SSLV2CONFTEST)$(EXE_EXT): $(SSLV2CONFTEST).o + @target=$(SSLV2CONFTEST) $(BUILD_CMD) + #$(AESTEST).o: $(AESTEST).c # $(CC) -c $(CFLAGS) -DINTERMEDIATE_VALUE_KAT -DTRACE_KAT_MCT $(AESTEST).c @@ -848,6 +856,25 @@ ssltest.o: ../include/openssl/ssl3.h ../include/openssl/stack.h ssltest.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h ssltest.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssltest.o: ../include/openssl/x509v3.h ssltest.c +sslv2conftest.o: ../include/openssl/asn1.h ../include/openssl/bio.h +sslv2conftest.o: ../include/openssl/buffer.h ../include/openssl/comp.h +sslv2conftest.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h +sslv2conftest.o: ../include/openssl/e_os2.h ../include/openssl/ec.h +sslv2conftest.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h +sslv2conftest.o: ../include/openssl/err.h ../include/openssl/evp.h +sslv2conftest.o: ../include/openssl/hmac.h ../include/openssl/kssl.h +sslv2conftest.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h +sslv2conftest.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h +sslv2conftest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h +sslv2conftest.o: ../include/openssl/pem.h ../include/openssl/pem2.h +sslv2conftest.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h +sslv2conftest.o: ../include/openssl/safestack.h ../include/openssl/sha.h +sslv2conftest.o: ../include/openssl/srtp.h ../include/openssl/ssl.h +sslv2conftest.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h +sslv2conftest.o: ../include/openssl/ssl3.h ../include/openssl/stack.h +sslv2conftest.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h +sslv2conftest.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h +sslv2conftest.o: sslv2conftest.c v3nametest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h v3nametest.o: ../include/openssl/buffer.h ../include/openssl/conf.h v3nametest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h diff --git a/vendor/openssl/openssl/test/bctest b/vendor/openssl/openssl/test/bctest new file mode 100755 index 000000000..bdb3218f7 --- /dev/null +++ b/vendor/openssl/openssl/test/bctest @@ -0,0 +1,111 @@ +#!/bin/sh + +# This script is used by test/Makefile.ssl to check whether a sane 'bc' +# is installed. +# ('make test_bn' should not try to run 'bc' if it does not exist or if +# it is a broken 'bc' version that is known to cause trouble.) +# +# If 'bc' works, we also test if it knows the 'print' command. +# +# In any case, output an appropriate command line for running (or not +# running) bc. + + +IFS=: +try_without_dir=true +# First we try "bc", then "$dir/bc" for each item in $PATH. +for dir in dummy:$PATH; do + if [ "$try_without_dir" = true ]; then + # first iteration + bc=bc + try_without_dir=false + else + # second and later iterations + bc="$dir/bc" + if [ ! -f "$bc" ]; then # '-x' is not available on Ultrix + bc='' + fi + fi + + if [ ! "$bc" = '' ]; then + failure=none + + + # Test for SunOS 5.[78] bc bug + "$bc" >tmp.bctest <<\EOF +obase=16 +ibase=16 +a=AD88C418F31B3FC712D0425001D522B3AE9134FF3A98C13C1FCC1682211195406C1A6C66C6A\ +CEEC1A0EC16950233F77F1C2F2363D56DD71A36C57E0B2511FC4BA8F22D261FE2E9356D99AF57\ +10F3817C0E05BF79C423C3F66FDF321BE8D3F18F625D91B670931C1EF25F28E489BDA1C5422D1\ +C3F6F7A1AD21585746ECC4F10A14A778AF56F08898E965E9909E965E0CB6F85B514150C644759\ +3BE731877B16EA07B552088FF2EA728AC5E0FF3A23EB939304519AB8B60F2C33D6BA0945B66F0\ +4FC3CADF855448B24A9D7640BCF473E +b=DCE91E7D120B983EA9A104B5A96D634DD644C37657B1C7860B45E6838999B3DCE5A555583C6\ +9209E41F413422954175A06E67FFEF6746DD652F0F48AEFECC3D8CAC13523BDAAD3F5AF4212BD\ +8B3CD64126E1A82E190228020C05B91C8B141F1110086FC2A4C6ED631EBA129D04BB9A19FC53D\ +3ED0E2017D60A68775B75481449 +(a/b)*b + (a%b) - a +EOF + if [ 0 != "`cat tmp.bctest`" ]; then + failure=SunOStest + fi + + + if [ "$failure" = none ]; then + # Test for SCO bc bug. + "$bc" >tmp.bctest <<\EOF +obase=16 +ibase=16 +-FFDD63BA1A4648F0D804F8A1C66C53F0D2110590E8A3907EC73B4AEC6F15AC177F176F2274D2\ +9DC8022EA0D7DD3ABE9746D2D46DD3EA5B5F6F69DF12877E0AC5E7F5ADFACEE54573F5D256A06\ +11B5D2BC24947724E22AE4EC3FB0C39D9B4694A01AFE5E43B4D99FB9812A0E4A5773D8B254117\ +1239157EC6E3D8D50199 * -FFDD63BA1A4648F0D804F8A1C66C53F0D2110590E8A3907EC73B4\ +AEC6F15AC177F176F2274D29DC8022EA0D7DD3ABE9746D2D46DD3EA5B5F6F69DF12877E0AC5E7\ +F5ADFACEE54573F5D256A0611B5D2BC24947724E22AE4EC3FB0C39D9B4694A01AFE5E43B4D99F\ +B9812A0E4A5773D8B2541171239157EC6E3D8D50199 - FFBACC221682DA464B6D7F123482522\ +02EDAEDCA38C3B69E9B7BBCD6165A9CD8716C4903417F23C09A85B851961F92C217258CEEB866\ +85EFCC5DD131853A02C07A873B8E2AF2E40C6D5ED598CD0E8F35AD49F3C3A17FDB7653E4E2DC4\ +A8D23CC34686EE4AD01F7407A7CD74429AC6D36DBF0CB6A3E302D0E5BDFCD048A3B90C1BE5AA8\ +E16C3D5884F9136B43FF7BB443764153D4AEC176C681B078F4CC53D6EB6AB76285537DDEE7C18\ +8C72441B52EDBDDBC77E02D34E513F2AABF92F44109CAFE8242BD0ECBAC5604A94B02EA44D43C\ +04E9476E6FBC48043916BFA1485C6093603600273C9C33F13114D78064AE42F3DC466C7DA543D\ +89C8D71 +AD534AFBED2FA39EE9F40E20FCF9E2C861024DB98DDCBA1CD118C49CA55EEBC20D6BA51B2271C\ +928B693D6A73F67FEB1B4571448588B46194617D25D910C6A9A130CC963155CF34079CB218A44\ +8A1F57E276D92A33386DDCA3D241DB78C8974ABD71DD05B0FA555709C9910D745185E6FE108E3\ +37F1907D0C56F8BFBF52B9704 % -E557905B56B13441574CAFCE2BD257A750B1A8B2C88D0E36\ +E18EF7C38DAC80D3948E17ED63AFF3B3467866E3B89D09A81B3D16B52F6A3C7134D3C6F5123E9\ +F617E3145BBFBE9AFD0D6E437EA4FF6F04BC67C4F1458B4F0F47B64 - 1C2BBBB19B74E86FD32\ +9E8DB6A8C3B1B9986D57ED5419C2E855F7D5469E35E76334BB42F4C43E3F3A31B9697C171DAC4\ +D97935A7E1A14AD209D6CF811F55C6DB83AA9E6DFECFCD6669DED7171EE22A40C6181615CAF3F\ +5296964 +EOF + if [ "0 +0" != "`cat tmp.bctest`" ]; then + failure=SCOtest + fi + fi + + + if [ "$failure" = none ]; then + # bc works; now check if it knows the 'print' command. + if [ "OK" = "`echo 'print \"OK\"' | $bc 2>/dev/null`" ] + then + echo "$bc" + else + echo "sed 's/print.*//' | $bc" + fi + exit 0 + fi + + echo "$bc does not work properly ('$failure' failed). Looking for another bc ..." >&2 + fi +done + +echo "No working bc found. Consider installing GNU bc." >&2 +if [ "$1" = ignore ]; then + echo "cat >/dev/null" + exit 0 +fi +exit 1 diff --git a/vendor/openssl/openssl/test/evptests.txt b/vendor/openssl/openssl/test/evptests.txt index 4e9958b3b..3b9bc13e8 100644 --- a/vendor/openssl/openssl/test/evptests.txt +++ b/vendor/openssl/openssl/test/evptests.txt @@ -66,29 +66,29 @@ AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::6BC1BEE22E409F96E93D7E117393172A:3 AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::AE2D8A571E03AC9C9EB76FAC45AF8E51:F5D3D58503B9699DE785895A96FDBAAF AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::30C81C46A35CE411E5FBC1191A0A52EF:43B1CD7F598ECE23881B00E3ED030688 AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::F69F2445DF4F9B17AD2B417BE66C3710:7B0C785E27E8AD3F8223207104725DD4 -# ECB-AES192.Encrypt and ECB-AES192.Decrypt +# ECB-AES192.Encrypt and ECB-AES192.Decrypt AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::6BC1BEE22E409F96E93D7E117393172A:BD334F1D6E45F25FF712A214571FA5CC AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::AE2D8A571E03AC9C9EB76FAC45AF8E51:974104846D0AD3AD7734ECB3ECEE4EEF AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::30C81C46A35CE411E5FBC1191A0A52EF:EF7AFD2270E2E60ADCE0BA2FACE6444E AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::F69F2445DF4F9B17AD2B417BE66C3710:9A4B41BA738D6C72FB16691603C18E0E -# ECB-AES256.Encrypt and ECB-AES256.Decrypt +# ECB-AES256.Encrypt and ECB-AES256.Decrypt AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::6BC1BEE22E409F96E93D7E117393172A:F3EED1BDB5D2A03C064B5A7E3DB181F8 AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::AE2D8A571E03AC9C9EB76FAC45AF8E51:591CCB10D410ED26DC5BA74A31362870 AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::30C81C46A35CE411E5FBC1191A0A52EF:B6ED21B99CA6F4F9F153E7B1BEAFED1D AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::F69F2445DF4F9B17AD2B417BE66C3710:23304B7A39F9F3FF067D8D8F9E24ECC7 # For all CBC encrypts and decrypts, the transformed sequence is # AES-bits-CBC:key:IV/ciphertext':plaintext:ciphertext:encdec -# CBC-AES128.Encrypt and CBC-AES128.Decrypt +# CBC-AES128.Encrypt and CBC-AES128.Decrypt AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:7649ABAC8119B246CEE98E9B12E9197D AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:7649ABAC8119B246CEE98E9B12E9197D:AE2D8A571E03AC9C9EB76FAC45AF8E51:5086CB9B507219EE95DB113A917678B2 AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:5086CB9B507219EE95DB113A917678B2:30C81C46A35CE411E5FBC1191A0A52EF:73BED6B8E3C1743B7116E69E22229516 AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:73BED6B8E3C1743B7116E69E22229516:F69F2445DF4F9B17AD2B417BE66C3710:3FF1CAA1681FAC09120ECA307586E1A7 -# CBC-AES192.Encrypt and CBC-AES192.Decrypt +# CBC-AES192.Encrypt and CBC-AES192.Decrypt AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:4F021DB243BC633D7178183A9FA071E8 AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:4F021DB243BC633D7178183A9FA071E8:AE2D8A571E03AC9C9EB76FAC45AF8E51:B4D9ADA9AD7DEDF4E5E738763F69145A AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:B4D9ADA9AD7DEDF4E5E738763F69145A:30C81C46A35CE411E5FBC1191A0A52EF:571B242012FB7AE07FA9BAAC3DF102E0 AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:571B242012FB7AE07FA9BAAC3DF102E0:F69F2445DF4F9B17AD2B417BE66C3710:08B0E27988598881D920A9E64F5615CD -# CBC-AES256.Encrypt and CBC-AES256.Decrypt +# CBC-AES256.Encrypt and CBC-AES256.Decrypt AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:F58C4C04D6E5F1BA779EABFB5F7BFBD6 AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:F58C4C04D6E5F1BA779EABFB5F7BFBD6:AE2D8A571E03AC9C9EB76FAC45AF8E51:9CFC4E967EDB808D679F777BC6702C7D AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:9CFC4E967EDB808D679F777BC6702C7D:30C81C46A35CE411E5FBC1191A0A52EF:39F23369A9D9BACFA530E26304231461 @@ -96,12 +96,12 @@ AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39F # We don't support CFB{1,8}-AESxxx.{En,De}crypt # For all CFB128 encrypts and decrypts, the transformed sequence is # AES-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec -# CFB128-AES128.Encrypt +# CFB128-AES128.Encrypt AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:1 AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:3B3FD92EB72DAD20333449F8E83CFB4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:C8A64537A0B3A93FCDE3CDAD9F1CE58B:1 AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:C8A64537A0B3A93FCDE3CDAD9F1CE58B:30C81C46A35CE411E5FBC1191A0A52EF:26751F67A3CBB140B1808CF187A4F4DF:1 AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:26751F67A3CBB140B1808CF187A4F4DF:F69F2445DF4F9B17AD2B417BE66C3710:C04B05357C5D1C0EEAC4C66F9FF7F2E6:1 -# CFB128-AES128.Decrypt +# CFB128-AES128.Decrypt AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:0 AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:3B3FD92EB72DAD20333449F8E83CFB4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:C8A64537A0B3A93FCDE3CDAD9F1CE58B:0 AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:C8A64537A0B3A93FCDE3CDAD9F1CE58B:30C81C46A35CE411E5FBC1191A0A52EF:26751F67A3CBB140B1808CF187A4F4DF:0 @@ -116,44 +116,44 @@ AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:0001020304050607080 AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:CDC80D6FDDF18CAB34C25909C99A4174:AE2D8A571E03AC9C9EB76FAC45AF8E51:67CE7F7F81173621961A2B70171D3D7A:0 AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:67CE7F7F81173621961A2B70171D3D7A:30C81C46A35CE411E5FBC1191A0A52EF:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:0 AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:F69F2445DF4F9B17AD2B417BE66C3710:C05F9F9CA9834FA042AE8FBA584B09FF:0 -# CFB128-AES256.Encrypt +# CFB128-AES256.Encrypt AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:1 AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DC7E84BFDA79164B7ECD8486985D3860:AE2D8A571E03AC9C9EB76FAC45AF8E51:39FFED143B28B1C832113C6331E5407B:1 AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39FFED143B28B1C832113C6331E5407B:30C81C46A35CE411E5FBC1191A0A52EF:DF10132415E54B92A13ED0A8267AE2F9:1 AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DF10132415E54B92A13ED0A8267AE2F9:F69F2445DF4F9B17AD2B417BE66C3710:75A385741AB9CEF82031623D55B1E471:1 -# CFB128-AES256.Decrypt +# CFB128-AES256.Decrypt AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:0 AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DC7E84BFDA79164B7ECD8486985D3860:AE2D8A571E03AC9C9EB76FAC45AF8E51:39FFED143B28B1C832113C6331E5407B:0 AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39FFED143B28B1C832113C6331E5407B:30C81C46A35CE411E5FBC1191A0A52EF:DF10132415E54B92A13ED0A8267AE2F9:0 AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DF10132415E54B92A13ED0A8267AE2F9:F69F2445DF4F9B17AD2B417BE66C3710:75A385741AB9CEF82031623D55B1E471:0 # For all OFB encrypts and decrypts, the transformed sequence is # AES-bits-CFB:key:IV/output':plaintext:ciphertext:encdec -# OFB-AES128.Encrypt -AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:1 -AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:7789508D16918F03F53C52DAC54ED825:1 -AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:9740051E9C5FECF64344F7A82260EDCC:1 -AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:304C6528F659C77866A510D9C1D6AE5E:1 -# OFB-AES128.Decrypt +# OFB-AES128.Encrypt +AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:1 +AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:7789508D16918F03F53C52DAC54ED825:1 +AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:9740051E9C5FECF64344F7A82260EDCC:1 +AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:304C6528F659C77866A510D9C1D6AE5E:1 +# OFB-AES128.Decrypt AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:0 AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:7789508D16918F03F53C52DAC54ED825:0 AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:9740051E9C5FECF64344F7A82260EDCC:0 AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:304C6528F659C77866A510D9C1D6AE5E:0 -# OFB-AES192.Encrypt -AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:1 -AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:FCC28B8D4C63837C09E81700C1100401:1 -AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:8D9A9AEAC0F6596F559C6D4DAF59A5F2:1 -AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:6D9F200857CA6C3E9CAC524BD9ACC92A:1 -# OFB-AES192.Decrypt -AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:0 -AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:FCC28B8D4C63837C09E81700C1100401:0 -AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:8D9A9AEAC0F6596F559C6D4DAF59A5F2:0 -AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:6D9F200857CA6C3E9CAC524BD9ACC92A:0 -# OFB-AES256.Encrypt +# OFB-AES192.Encrypt +AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:1 +AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:FCC28B8D4C63837C09E81700C1100401:1 +AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:8D9A9AEAC0F6596F559C6D4DAF59A5F2:1 +AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:6D9F200857CA6C3E9CAC524BD9ACC92A:1 +# OFB-AES192.Decrypt +AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:0 +AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:FCC28B8D4C63837C09E81700C1100401:0 +AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:8D9A9AEAC0F6596F559C6D4DAF59A5F2:0 +AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:6D9F200857CA6C3E9CAC524BD9ACC92A:0 +# OFB-AES256.Encrypt AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:1 AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:4FEBDC6740D20B3AC88F6AD82A4FB08D:1 AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:71AB47A086E86EEDF39D1C5BBA97C408:1 AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0126141D67F37BE8538F5A8BE740E484:1 -# OFB-AES256.Decrypt +# OFB-AES256.Decrypt AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:0 AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:4FEBDC6740D20B3AC88F6AD82A4FB08D:0 AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:71AB47A086E86EEDF39D1C5BBA97C408:0 @@ -209,19 +209,19 @@ CAMELLIA-128-ECB:000102030405060708090A0B0C0D0E0F::00112233445566778899AABBCCDDE CAMELLIA-192-ECB:000102030405060708090A0B0C0D0E0F1011121314151617::00112233445566778899AABBCCDDEEFF:B22F3C36B72D31329EEE8ADDC2906C68:1 CAMELLIA-256-ECB:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F::00112233445566778899AABBCCDDEEFF:2EDF1F3418D53B88841FC8985FB1ECF2:1 -# ECB-CAMELLIA128.Encrypt and ECB-CAMELLIA128.Decrypt +# ECB-CAMELLIA128.Encrypt and ECB-CAMELLIA128.Decrypt CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::6BC1BEE22E409F96E93D7E117393172A:432FC5DCD628115B7C388D770B270C96 CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::AE2D8A571E03AC9C9EB76FAC45AF8E51:0BE1F14023782A22E8384C5ABB7FAB2B CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::30C81C46A35CE411E5FBC1191A0A52EF:A0A1ABCD1893AB6FE0FE5B65DF5F8636 CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::F69F2445DF4F9B17AD2B417BE66C3710:E61925E0D5DFAA9BB29F815B3076E51A -# ECB-CAMELLIA192.Encrypt and ECB-CAMELLIA192.Decrypt +# ECB-CAMELLIA192.Encrypt and ECB-CAMELLIA192.Decrypt CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::6BC1BEE22E409F96E93D7E117393172A:CCCC6C4E138B45848514D48D0D3439D3 CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::AE2D8A571E03AC9C9EB76FAC45AF8E51:5713C62C14B2EC0F8393B6AFD6F5785A CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::30C81C46A35CE411E5FBC1191A0A52EF:B40ED2B60EB54D09D030CF511FEEF366 CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::F69F2445DF4F9B17AD2B417BE66C3710:909DBD95799096748CB27357E73E1D26 -# ECB-CAMELLIA256.Encrypt and ECB-CAMELLIA256.Decrypt +# ECB-CAMELLIA256.Encrypt and ECB-CAMELLIA256.Decrypt CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::6BC1BEE22E409F96E93D7E117393172A:BEFD219B112FA00098919CD101C9CCFA CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::AE2D8A571E03AC9C9EB76FAC45AF8E51:C91D3A8F1AEA08A9386CF4B66C0169EA CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::30C81C46A35CE411E5FBC1191A0A52EF:A623D711DC5F25A51BB8A80D56397D28 @@ -229,19 +229,19 @@ CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF # For all CBC encrypts and decrypts, the transformed sequence is # CAMELLIA-bits-CBC:key:IV/ciphertext':plaintext:ciphertext:encdec -# CBC-CAMELLIA128.Encrypt and CBC-CAMELLIA128.Decrypt +# CBC-CAMELLIA128.Encrypt and CBC-CAMELLIA128.Decrypt CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:1607CF494B36BBF00DAEB0B503C831AB CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:1607CF494B36BBF00DAEB0B503C831AB:AE2D8A571E03AC9C9EB76FAC45AF8E51:A2F2CF671629EF7840C5A5DFB5074887 CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:A2F2CF671629EF7840C5A5DFB5074887:30C81C46A35CE411E5FBC1191A0A52EF:0F06165008CF8B8B5A63586362543E54 CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:36A84CDAFD5F9A85ADA0F0A993D6D577:F69F2445DF4F9B17AD2B417BE66C3710:74C64268CDB8B8FAF5B34E8AF3732980 -# CBC-CAMELLIA192.Encrypt and CBC-CAMELLIA192.Decrypt +# CBC-CAMELLIA192.Encrypt and CBC-CAMELLIA192.Decrypt CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:2A4830AB5AC4A1A2405955FD2195CF93 CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2A4830AB5AC4A1A2405955FD2195CF93:AE2D8A571E03AC9C9EB76FAC45AF8E51:5D5A869BD14CE54264F892A6DD2EC3D5 CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:5D5A869BD14CE54264F892A6DD2EC3D5:30C81C46A35CE411E5FBC1191A0A52EF:37D359C3349836D884E310ADDF68C449 CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:37D359C3349836D884E310ADDF68C449:F69F2445DF4F9B17AD2B417BE66C3710:01FAAA930B4AB9916E9668E1428C6B08 -# CBC-CAMELLIA256.Encrypt and CBC-CAMELLIA256.Decrypt +# CBC-CAMELLIA256.Encrypt and CBC-CAMELLIA256.Decrypt CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:E6CFA35FC02B134A4D2C0B6737AC3EDA CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E6CFA35FC02B134A4D2C0B6737AC3EDA:AE2D8A571E03AC9C9EB76FAC45AF8E51:36CBEB73BD504B4070B1B7DE2B21EB50 CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:36CBEB73BD504B4070B1B7DE2B21EB50:30C81C46A35CE411E5FBC1191A0A52EF:E31A6055297D96CA3330CDF1B1860A83 @@ -250,13 +250,13 @@ CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF # We don't support CFB{1,8}-CAMELLIAxxx.{En,De}crypt # For all CFB128 encrypts and decrypts, the transformed sequence is # CAMELLIA-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec -# CFB128-CAMELLIA128.Encrypt +# CFB128-CAMELLIA128.Encrypt CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:1 CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:14F7646187817EB586599146B82BD719:AE2D8A571E03AC9C9EB76FAC45AF8E51:A53D28BB82DF741103EA4F921A44880B:1 CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:A53D28BB82DF741103EA4F921A44880B:30C81C46A35CE411E5FBC1191A0A52EF:9C2157A664626D1DEF9EA420FDE69B96:1 CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:9C2157A664626D1DEF9EA420FDE69B96:F69F2445DF4F9B17AD2B417BE66C3710:742A25F0542340C7BAEF24CA8482BB09:1 -# CFB128-CAMELLIA128.Decrypt +# CFB128-CAMELLIA128.Decrypt CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:0 CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:14F7646187817EB586599146B82BD719:AE2D8A571E03AC9C9EB76FAC45AF8E51:A53D28BB82DF741103EA4F921A44880B:0 CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:A53D28BB82DF741103EA4F921A44880B:30C81C46A35CE411E5FBC1191A0A52EF:9C2157A664626D1DEF9EA420FDE69B96:0 @@ -274,13 +274,13 @@ CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:C832BB9780677D CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:86F8491627906D780C7A6D46EA331F98:30C81C46A35CE411E5FBC1191A0A52EF:69511CCE594CF710CB98BB63D7221F01:0 CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:69511CCE594CF710CB98BB63D7221F01:F69F2445DF4F9B17AD2B417BE66C3710:D5B5378A3ABED55803F25565D8907B84:0 -# CFB128-CAMELLIA256.Encrypt +# CFB128-CAMELLIA256.Encrypt CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:1 CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:CF6107BB0CEA7D7FB1BD31F5E7B06C93:AE2D8A571E03AC9C9EB76FAC45AF8E51:89BEDB4CCDD864EA11BA4CBE849B5E2B:1 CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:89BEDB4CCDD864EA11BA4CBE849B5E2B:30C81C46A35CE411E5FBC1191A0A52EF:555FC3F34BDD2D54C62D9E3BF338C1C4:1 CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:555FC3F34BDD2D54C62D9E3BF338C1C4:F69F2445DF4F9B17AD2B417BE66C3710:5953ADCE14DB8C7F39F1BD39F359BFFA:1 -# CFB128-CAMELLIA256.Decrypt +# CFB128-CAMELLIA256.Decrypt CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:0 CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:CF6107BB0CEA7D7FB1BD31F5E7B06C93:AE2D8A571E03AC9C9EB76FAC45AF8E51:89BEDB4CCDD864EA11BA4CBE849B5E2B:0 CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:89BEDB4CCDD864EA11BA4CBE849B5E2B:30C81C46A35CE411E5FBC1191A0A52EF:555FC3F34BDD2D54C62D9E3BF338C1C4:0 @@ -288,37 +288,37 @@ CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF # For all OFB encrypts and decrypts, the transformed sequence is # CAMELLIA-bits-OFB:key:IV/output':plaintext:ciphertext:encdec -# OFB-CAMELLIA128.Encrypt +# OFB-CAMELLIA128.Encrypt CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:1 CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:25623DB569CA51E01482649977E28D84:1 CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:C776634A60729DC657D12B9FCA801E98:1 CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:D776379BE0E50825E681DA1A4C980E8E:1 -# OFB-CAMELLIA128.Decrypt +# OFB-CAMELLIA128.Decrypt CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:0 CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:25623DB569CA51E01482649977E28D84:0 CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:C776634A60729DC657D12B9FCA801E98:0 CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:D776379BE0E50825E681DA1A4C980E8E:0 -# OFB-CAMELLIA192.Encrypt +# OFB-CAMELLIA192.Encrypt CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:1 CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:8ECEB7D0350D72C7F78562AEBDF99339:1 CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:BDD62DBBB9700846C53B507F544696F0:1 CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:E28014E046B802F385C4C2E13EAD4A72:1 -# OFB-CAMELLIA192.Decrypt +# OFB-CAMELLIA192.Decrypt CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:0 CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:8ECEB7D0350D72C7F78562AEBDF99339:0 CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:BDD62DBBB9700846C53B507F544696F0:0 CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:E28014E046B802F385C4C2E13EAD4A72:0 -# OFB-CAMELLIA256.Encrypt +# OFB-CAMELLIA256.Encrypt CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:1 CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:127AD97E8E3994E4820027D7BA109368:1 CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:6BFF6265A6A6B7A535BC65A80B17214E:1 CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0A4A0404E26AA78A27CB271E8BF3CF20:1 -# OFB-CAMELLIA256.Decrypt +# OFB-CAMELLIA256.Decrypt CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:0 CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:127AD97E8E3994E4820027D7BA109368:0 CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:6BFF6265A6A6B7A535BC65A80B17214E:0 diff --git a/vendor/openssl/openssl/test/igetest.c b/vendor/openssl/openssl/test/igetest.c index 0c7b3573d..08f361a0a 100644 --- a/vendor/openssl/openssl/test/igetest.c +++ b/vendor/openssl/openssl/test/igetest.c @@ -1,4 +1,4 @@ -/* test/igetest.c -*- mode:C; c-file-style: "eay" -*- */ +/* test/igetest.c */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * diff --git a/vendor/openssl/openssl/test/testfipsssl b/vendor/openssl/openssl/test/testfipsssl index c4836edc2..b8bbb2593 100644 --- a/vendor/openssl/openssl/test/testfipsssl +++ b/vendor/openssl/openssl/test/testfipsssl @@ -38,8 +38,12 @@ fi echo test ssl3 is forbidden in FIPS mode $ssltest -ssl3 $extra && exit 1 -echo test ssl2 is forbidden in FIPS mode -$ssltest -ssl2 $extra && exit 1 +if ../util/shlib_wrap.sh ../apps/openssl ciphers SSLv2 >/dev/null 2>&1; then + echo test ssl2 is forbidden in FIPS mode + $ssltest -ssl2 $extra && exit 1 +else + echo ssl2 disabled: skipping test +fi echo test tls1 $ssltest -tls1 $extra || exit 1 diff --git a/vendor/openssl/openssl/test/testssl b/vendor/openssl/openssl/test/testssl index 747e4ba38..a6f9fa770 100644 --- a/vendor/openssl/openssl/test/testssl +++ b/vendor/openssl/openssl/test/testssl @@ -236,6 +236,17 @@ $ssltest -bio_pair -tls1 -serverinfo_file $serverinfo -serverinfo_tack || exit 1 $ssltest -bio_pair -tls1 -serverinfo_file $serverinfo -serverinfo_sct -serverinfo_tack || exit 1 $ssltest -bio_pair -tls1 -custom_ext -serverinfo_file $serverinfo -serverinfo_sct -serverinfo_tack || exit 1 +############################################################################# +# SNI tests + +$ssltest -bio_pair -sn_client foo || exit 1 +$ssltest -bio_pair -sn_server1 foo || exit 1 +$ssltest -bio_pair -sn_client foo -sn_server1 foo -sn_expect1 || exit 1 +$ssltest -bio_pair -sn_client foo -sn_server1 bar -sn_expect1 || exit 1 +$ssltest -bio_pair -sn_client foo -sn_server1 foo -sn_server2 bar -sn_expect1 || exit 1 +$ssltest -bio_pair -sn_client bar -sn_server1 foo -sn_server2 bar -sn_expect2 || exit 1 +# Negative test - make sure it doesn't crash, and doesn't switch contexts +$ssltest -bio_pair -sn_client foobar -sn_server1 foo -sn_server2 bar -sn_expect1 || exit 1 ############################################################################# # ALPN tests @@ -249,6 +260,14 @@ $ssltest -bio_pair -tls1 -alpn_client bar,foo -alpn_server bar,foo -alpn_expecte $ssltest -bio_pair -tls1 -alpn_client foo,bar -alpn_server bar,foo -alpn_expected bar || exit 1 $ssltest -bio_pair -tls1 -alpn_client baz -alpn_server bar,foo || exit 1 + +############################################################################# +# ALPN + SNI + +$ssltest -bio_pair -alpn_client foo,bar -sn_client alice -alpn_server1 foo,123 -sn_server1 alice -alpn_server2 bar,456 -sn_server2 bob -alpn_expected foo || exit 1 +$ssltest -bio_pair -alpn_client foo,bar -sn_client bob -alpn_server1 foo,123 -sn_server1 alice -alpn_server2 bar,456 -sn_server2 bob -alpn_expected bar || exit 1 +$ssltest -bio_pair -alpn_client foo,bar -sn_client bob -sn_server1 alice -alpn_server2 bar,456 -sn_server2 bob -alpn_expected bar || exit 1 + if ../util/shlib_wrap.sh ../apps/openssl no-srp; then echo skipping SRP tests else diff --git a/vendor/openssl/openssl/tools/c_rehash b/vendor/openssl/openssl/tools/c_rehash index 6a27c0224..c0caf1c9c 100644 --- a/vendor/openssl/openssl/tools/c_rehash +++ b/vendor/openssl/openssl/tools/c_rehash @@ -61,7 +61,7 @@ if(! -x $openssl) { $found = 1; $openssl = "$_/$openssl"; last; - } + } } if($found == 0) { print STDERR "c_rehash: rehashing skipped ('openssl' program not available)\n"; @@ -207,4 +207,3 @@ sub link_hash_crl { } $hashlist{$hash} = $fprint; } - diff --git a/vendor/openssl/openssl/util/domd b/vendor/openssl/openssl/util/domd index 6a628c7f9..95bb1b06e 100755 --- a/vendor/openssl/openssl/util/domd +++ b/vendor/openssl/openssl/util/domd @@ -14,8 +14,8 @@ if [ "$MAKEDEPEND" = "" ]; then MAKEDEPEND=makedepend; fi cp Makefile Makefile.save # fake the presence of Kerberos touch $TOP/krb5.h -if ${MAKEDEPEND} --version 2>&1 | grep -q "clang" || - echo $MAKEDEPEND | grep -q "gcc"; then +if ${MAKEDEPEND} --version 2>&1 | grep "clang" > /dev/null || + echo $MAKEDEPEND | grep "gcc" > /dev/null; then args="" while [ $# -gt 0 ]; do if [ "$1" != "--" ]; then args="$args $1"; fi diff --git a/vendor/openssl/openssl/util/libeay.num b/vendor/openssl/openssl/util/libeay.num index 7f7487df5..2094ab364 100755 --- a/vendor/openssl/openssl/util/libeay.num +++ b/vendor/openssl/openssl/util/libeay.num @@ -1065,8 +1065,8 @@ d2i_ASN1_BMPSTRING 1092 EXIST::FUNCTION: i2d_ASN1_BMPSTRING 1093 EXIST::FUNCTION: BIO_f_ber 1094 NOEXIST::FUNCTION: BN_init 1095 EXIST::FUNCTION: -COMP_CTX_new 1096 EXIST::FUNCTION: -COMP_CTX_free 1097 EXIST::FUNCTION: +COMP_CTX_new 1096 EXIST::FUNCTION:COMP +COMP_CTX_free 1097 EXIST::FUNCTION:COMP COMP_CTX_compress_block 1098 NOEXIST::FUNCTION: COMP_CTX_expand_block 1099 NOEXIST::FUNCTION: X509_STORE_CTX_get_ex_new_index 1100 EXIST::FUNCTION: @@ -1113,10 +1113,10 @@ PKCS7_digest_from_attributes 1140 EXIST::FUNCTION: PKCS7_get_attribute 1141 EXIST::FUNCTION: PKCS7_get_issuer_and_serial 1142 EXIST::FUNCTION: PKCS7_get_signed_attribute 1143 EXIST::FUNCTION: -COMP_compress_block 1144 EXIST::FUNCTION: -COMP_expand_block 1145 EXIST::FUNCTION: -COMP_rle 1146 EXIST::FUNCTION: -COMP_zlib 1147 EXIST::FUNCTION: +COMP_compress_block 1144 EXIST::FUNCTION:COMP +COMP_expand_block 1145 EXIST::FUNCTION:COMP +COMP_rle 1146 EXIST::FUNCTION:COMP +COMP_zlib 1147 EXIST::FUNCTION:COMP ms_time_diff 1148 NOEXIST::FUNCTION: ms_time_new 1149 NOEXIST::FUNCTION: ms_time_free 1150 NOEXIST::FUNCTION: @@ -1807,6 +1807,8 @@ ASN1_UTCTIME_get 2350 NOEXIST::FUNCTION: X509_REQ_digest 2362 EXIST::FUNCTION:EVP X509_CRL_digest 2391 EXIST::FUNCTION:EVP ASN1_STRING_clear_free 2392 EXIST::FUNCTION: +SRP_VBASE_get1_by_user 2393 EXIST::FUNCTION:SRP +SRP_user_pwd_free 2394 EXIST::FUNCTION:SRP d2i_ASN1_SET_OF_PKCS7 2397 NOEXIST::FUNCTION: X509_ALGOR_cmp 2398 EXIST::FUNCTION: EVP_CIPHER_CTX_set_key_length 2399 EXIST::FUNCTION: @@ -1943,7 +1945,7 @@ ENGINE_get_ctrl_function 2521 EXIST::FUNCTION:ENGINE ENGINE_set_ctrl_function 2522 EXIST::FUNCTION:ENGINE BN_pseudo_rand_range 2523 EXIST::FUNCTION: X509_STORE_CTX_set_verify_cb 2524 EXIST::FUNCTION: -ERR_load_COMP_strings 2525 EXIST::FUNCTION: +ERR_load_COMP_strings 2525 EXIST::FUNCTION:COMP PKCS12_item_decrypt_d2i 2526 EXIST::FUNCTION: ASN1_UTF8STRING_it 2527 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_UTF8STRING_it 2527 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: @@ -3543,8 +3545,8 @@ X509at_get0_data_by_OBJ 3931 EXIST::FUNCTION: ASN1_TYPE_set1 3932 EXIST::FUNCTION: ASN1_STRING_set0 3933 EXIST::FUNCTION: i2d_X509_ALGORS 3934 EXIST::FUNCTION: -BIO_f_zlib 3935 EXIST:ZLIB:FUNCTION: -COMP_zlib_cleanup 3936 EXIST::FUNCTION: +BIO_f_zlib 3935 EXIST:ZLIB:FUNCTION:COMP +COMP_zlib_cleanup 3936 EXIST::FUNCTION:COMP d2i_X509_ALGORS 3937 EXIST::FUNCTION: CMS_ReceiptRequest_free 3938 EXIST::FUNCTION:CMS PEM_write_CMS 3939 EXIST:!WIN16:FUNCTION:CMS diff --git a/vendor/openssl/openssl/util/mk1mf.pl b/vendor/openssl/openssl/util/mk1mf.pl index 99652aff9..128a405ef 100755 --- a/vendor/openssl/openssl/util/mk1mf.pl +++ b/vendor/openssl/openssl/util/mk1mf.pl @@ -290,8 +290,10 @@ $cflags.=" -DOPENSSL_FIPS" if $fips; $cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake; $cflags.=" -DOPENSSL_NO_EC2M" if $no_ec2m; -$cflags.= " -DZLIB" if $zlib_opt; -$cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; +$cflags.=" -DOPENSSL_NO_WEAK_SSL_CIPHERS" if $no_weak_ssl; +$cflags.=" -DZLIB" if $zlib_opt; +$cflags.=" -DZLIB_SHARED" if $zlib_opt == 2; +$cflags.=" -DOPENSSL_NO_COMP" if $no_comp; if ($no_static_engine) { @@ -482,7 +484,7 @@ # The OpenSSL directory SRC_D=$src_dir -LINK=$link +LINK_CMD=$link LFLAGS=$lflags RSC=$rsc @@ -849,6 +851,7 @@ sub var_add return("") if $no_gost && $dir =~ /\/ccgost/; return("") if $no_cms && $dir =~ /\/cms/; return("") if $no_jpake && $dir =~ /\/jpake/; + return("") if $no_comp && $dir =~ /\/comp/; if ($no_des && $dir =~ /\/des/) { if ($val =~ /read_pwd/) @@ -1197,6 +1200,7 @@ sub read_options "nw-mwasm" => \$nw_mwasm, "gaswin" => \$gaswin, "no-ssl2" => \$no_ssl2, + "no-ssl2-method" => 0, "no-ssl3" => \$no_ssl3, "no-ssl3-method" => 0, "no-tlsext" => \$no_tlsext, @@ -1205,6 +1209,7 @@ sub read_options "no-jpake" => \$no_jpake, "no-ec2m" => \$no_ec2m, "no-ec_nistp_64_gcc_128" => 0, + "no-weak-ssl-ciphers" => \$no_weak_ssl, "no-err" => \$no_err, "no-sock" => \$no_sock, "no-krb5" => \$no_krb5, @@ -1240,6 +1245,7 @@ sub read_options "no-unit-test" => 0, "no-libunbound" => 0, "no-multiblock" => 0, + "no-comp" => \$no_comp, "fips" => \$fips ); @@ -1257,7 +1263,6 @@ sub read_options } } } - elsif (/^no-comp$/) { $xcflags = "-DOPENSSL_NO_COMP $xcflags"; } elsif (/^enable-zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 } elsif (/^enable-zlib-dynamic$/) { diff --git a/vendor/openssl/openssl/util/mkdef.pl b/vendor/openssl/openssl/util/mkdef.pl index c57c7f748..b9b159a00 100755 --- a/vendor/openssl/openssl/util/mkdef.pl +++ b/vendor/openssl/openssl/util/mkdef.pl @@ -107,6 +107,8 @@ "CAPIENG", # SSL v2 "SSL2", + # SSL v2 method + "SSL2_METHOD", # SSL v3 method "SSL3_METHOD", # JPAKE @@ -145,7 +147,7 @@ my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng; my $no_jpake; my $no_srp; my $no_ssl2; my $no_ec2m; my $no_nistp_gcc; my $no_nextprotoneg; my $no_sctp; my $no_srtp; my $no_ssl_trace; -my $no_unit_test; my $no_ssl3_method; +my $no_unit_test; my $no_ssl3_method; my $no_ssl2_method; my $fips; @@ -240,6 +242,7 @@ elsif (/^no-ec_nistp_64_gcc_128$/) { $no_nistp_gcc=1; } elsif (/^no-nextprotoneg$/) { $no_nextprotoneg=1; } elsif (/^no-ssl2$/) { $no_ssl2=1; } + elsif (/^no-ssl2-method$/) { $no_ssl2_method=1; } elsif (/^no-ssl3-method$/) { $no_ssl3_method=1; } elsif (/^no-ssl-trace$/) { $no_ssl_trace=1; } elsif (/^no-capieng$/) { $no_capieng=1; } @@ -1215,6 +1218,7 @@ sub is_valid if ($keyword eq "EC_NISTP_64_GCC_128" && $no_nistp_gcc) { return 0; } if ($keyword eq "SSL2" && $no_ssl2) { return 0; } + if ($keyword eq "SSL2_METHOD" && $no_ssl2_method) { return 0; } if ($keyword eq "SSL3_METHOD" && $no_ssl3_method) { return 0; } if ($keyword eq "SSL_TRACE" && $no_ssl_trace) { return 0; } if ($keyword eq "CAPIENG" && $no_capieng) { return 0; } diff --git a/vendor/openssl/openssl/util/pl/BC-32.pl b/vendor/openssl/openssl/util/pl/BC-32.pl index f7161d7bf..375b0a76d 100644 --- a/vendor/openssl/openssl/util/pl/BC-32.pl +++ b/vendor/openssl/openssl/util/pl/BC-32.pl @@ -118,7 +118,7 @@ sub do_lib_rule { local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; $ex.=' ws2_32.lib gdi32.lib'; - $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n"; + $ret.="\t\$(LINK_CMD) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n"; } $ret.="\n"; return($ret); @@ -132,7 +132,7 @@ sub do_link_rule $file =~ s/\//$o/g if $o ne '/'; $n=&bname($target); $ret.="$target: $files $dep_libs\n"; - $ret.="\t\$(LINK) \$(LFLAGS) $files \$(APP_EX_OBJ), $target,, $libs\n\n"; + $ret.="\t\$(LINK_CMD) \$(LFLAGS) $files \$(APP_EX_OBJ), $target,, $libs\n\n"; return($ret); } diff --git a/vendor/openssl/openssl/util/pl/Mingw32.pl b/vendor/openssl/openssl/util/pl/Mingw32.pl index fe3fb27a7..55c85f644 100644 --- a/vendor/openssl/openssl/util/pl/Mingw32.pl +++ b/vendor/openssl/openssl/util/pl/Mingw32.pl @@ -98,7 +98,7 @@ sub do_link_rule $file =~ s/\//$o/g if $o ne '/'; $n=&bname($target); $ret.="$target: $files $dep_libs\n"; - $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; + $ret.="\t\$(LINK_CMD) ${efile}$target \$(LFLAGS) $files $libs\n\n"; return($ret); } 1; diff --git a/vendor/openssl/openssl/util/pl/OS2-EMX.pl b/vendor/openssl/openssl/util/pl/OS2-EMX.pl index 28cd11690..92a332e6e 100644 --- a/vendor/openssl/openssl/util/pl/OS2-EMX.pl +++ b/vendor/openssl/openssl/util/pl/OS2-EMX.pl @@ -99,7 +99,7 @@ sub do_lib_rule { local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; $ex.=' -lsocket'; - $ret.="\t\$(LINK) \$(SHLIB_CFLAGS) \$(MLFLAGS) $efile$target \$(SHLIB_EX_OBJ) \$(${Name}OBJ) $ex os2/${Name}.def\n"; + $ret.="\t\$(LINK_CMD) \$(SHLIB_CFLAGS) \$(MLFLAGS) $efile$target \$(SHLIB_EX_OBJ) \$(${Name}OBJ) $ex os2/${Name}.def\n"; $ret.="\temximp -o $out_def/$name.a os2/${Name}.def\n"; $ret.="\temximp -o $out_def/$name.lib os2/${Name}.def\n\n"; } @@ -113,7 +113,7 @@ sub do_link_rule $file =~ s/\//$o/g if $o ne '/'; $n=&bname($target); $ret.="$target: $files $dep_libs\n"; - $ret.="\t\$(LINK) ${efile}$target \$(CFLAG) \$(LFLAGS) $files $libs\n\n"; + $ret.="\t\$(LINK_CMD) ${efile}$target \$(CFLAG) \$(LFLAGS) $files $libs\n\n"; return($ret); } diff --git a/vendor/openssl/openssl/util/pl/VC-32.pl b/vendor/openssl/openssl/util/pl/VC-32.pl index 284fe0381..dba96cba5 100644 --- a/vendor/openssl/openssl/util/pl/VC-32.pl +++ b/vendor/openssl/openssl/util/pl/VC-32.pl @@ -330,7 +330,7 @@ sub do_lib_rule if ($fips && $target =~ /O_CRYPTO/) { $ret.="$target: $objs \$(PREMAIN_DSO_EXE)"; - $ret.="\n\tSET FIPS_LINK=\$(LINK)\n"; + $ret.="\n\tSET FIPS_LINK=\$(LINK_CMD)\n"; $ret.="\tSET FIPS_CC=\$(CC)\n"; $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n"; $ret.="\tSET PREMAIN_DSO_EXE=\$(PREMAIN_DSO_EXE)\n"; @@ -344,7 +344,7 @@ sub do_lib_rule else { $ret.="$target: $objs"; - $ret.="\n\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_EX_OBJ) $objs $ex \$(EX_LIBS)\n<<\n"; + $ret.="\n\t\$(LINK_CMD) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_EX_OBJ) $objs $ex \$(EX_LIBS)\n<<\n"; } $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;2\n\n"; } @@ -361,15 +361,19 @@ sub do_link_rule $ret.="$target: $files $dep_libs"; if ($standalone == 1) { - $ret.=" \$(OBJ_D)${o}applink.obj\n"; - $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n\t"; - $ret.= "\$(EX_LIBS) \$(OBJ_D)${o}applink.obj " if ($files =~ /O_FIPSCANISTER/ && !$fipscanisterbuild); + $ret.=" \$(OBJ_D)${o}applink.obj" if $shlib; + $ret.="\n"; + $ret.=" \$(LINK_CMD) \$(LFLAGS) $efile$target @<<\n\t"; + if ($files =~ /O_FIPSCANISTER/ && !$fipscanisterbuild) { + $ret.= "\$(EX_LIBS) "; + $ret.= "\$(OBJ_D)${o}applink.obj " if $shlib; + } $ret.="$files $libs\n<<\n"; } elsif ($standalone == 2) { $ret.="\n"; - $ret.="\tSET FIPS_LINK=\$(LINK)\n"; + $ret.="\tSET FIPS_LINK=\$(LINK_CMD)\n"; $ret.="\tSET FIPS_CC=\$(CC)\n"; $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n"; $ret.="\tSET PREMAIN_DSO_EXE=\n"; @@ -382,7 +386,7 @@ sub do_link_rule else { $ret.="\n"; - $ret.="\t\$(LINK) \$(LFLAGS) $efile$target @<<\n"; + $ret.="\t\$(LINK_CMD) \$(LFLAGS) $efile$target @<<\n"; $ret.="\t\$(APP_EX_OBJ) $files $libs\n<<\n"; } $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;1\n\n"; diff --git a/vendor/openssl/openssl/util/pl/linux.pl b/vendor/openssl/openssl/util/pl/linux.pl index d24f7b729..3362941f7 100644 --- a/vendor/openssl/openssl/util/pl/linux.pl +++ b/vendor/openssl/openssl/util/pl/linux.pl @@ -78,7 +78,7 @@ sub do_link_rule $file =~ s/\//$o/g if $o ne '/'; $n=&bname($target); $ret.="$target: $files $dep_libs\n"; - $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; + $ret.="\t\$(LINK_CMD) ${efile}$target \$(LFLAGS) $files $libs\n\n"; return($ret); } diff --git a/vendor/openssl/openssl/util/pl/netware.pl b/vendor/openssl/openssl/util/pl/netware.pl index fe80a9bb8..16f4f4ee3 100644 --- a/vendor/openssl/openssl/util/pl/netware.pl +++ b/vendor/openssl/openssl/util/pl/netware.pl @@ -506,22 +506,22 @@ sub do_link_rule if ($gnuc) { $ret.="\t\$(MKLIB) $lib_flags \$(TMP_D)${o}\$(E_EXE).a \$(filter-out \$(TMP_D)${o}\$(E_EXE)${obj},$files)\n"; - $ret.="\t\$(LINK) \$(LFLAGS) $def_file2\n"; + $ret.="\t\$(LINK_CMD) \$(LFLAGS) $def_file2\n"; $ret.="\t\@$mv \$(E_EXE)2.nlm \$(TEST_D)\n"; } else { - $ret.="\t\$(LINK) \$(LFLAGS) $def_file2 $files \"$prelude\" $libs -o $target2\n"; + $ret.="\t\$(LINK_CMD) \$(LFLAGS) $def_file2 $files \"$prelude\" $libs -o $target2\n"; } } if ($gnuc) { - $ret.="\t\$(LINK) \$(LFLAGS) $def_file\n"; + $ret.="\t\$(LINK_CMD) \$(LFLAGS) $def_file\n"; $ret.="\t\@$mv \$(\@F) \$(TEST_D)\n"; } else { - $ret.="\t\$(LINK) \$(LFLAGS) $def_file $files \"$prelude\" $libs -o $target\n"; + $ret.="\t\$(LINK_CMD) \$(LFLAGS) $def_file $files \"$prelude\" $libs -o $target\n"; } $ret.="\n"; diff --git a/vendor/openssl/openssl/util/pl/ultrix.pl b/vendor/openssl/openssl/util/pl/ultrix.pl index ea370c71f..0c76c83b4 100644 --- a/vendor/openssl/openssl/util/pl/ultrix.pl +++ b/vendor/openssl/openssl/util/pl/ultrix.pl @@ -31,7 +31,7 @@ sub do_link_rule $file =~ s/\//$o/g if $o ne '/'; $n=&bname($target); $ret.="$target: $files $dep_libs\n"; - $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; + $ret.="\t\$(LINK_CMD) ${efile}$target \$(LFLAGS) $files $libs\n\n"; return($ret); } diff --git a/vendor/openssl/openssl/util/pl/unix.pl b/vendor/openssl/openssl/util/pl/unix.pl index 1d4e9dc5d..8818c5bcb 100644 --- a/vendor/openssl/openssl/util/pl/unix.pl +++ b/vendor/openssl/openssl/util/pl/unix.pl @@ -164,7 +164,7 @@ sub do_link_rule $file =~ s/\//$o/g if $o ne '/'; $n=&bname($target); $ret.="$target: $files $dep_libs\n"; - $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; + $ret.="\t\$(LINK_CMD) ${efile}$target \$(LFLAGS) $files $libs\n\n"; return($ret); } diff --git a/vendor/openssl/openssl/util/pod2mantest b/vendor/openssl/openssl/util/pod2mantest new file mode 100755 index 000000000..384e683df --- /dev/null +++ b/vendor/openssl/openssl/util/pod2mantest @@ -0,0 +1,58 @@ +#!/bin/sh + +# This script is used by test/Makefile to check whether a sane 'pod2man' +# is installed. +# ('make install' should not try to run 'pod2man' if it does not exist or if +# it is a broken 'pod2man' version that is known to cause trouble. if we find +# the system 'pod2man' to be broken, we use our own copy instead) +# +# In any case, output an appropriate command line for running (or not +# running) pod2man. + + +IFS=: +if test "$OSTYPE" = "msdosdjgpp"; then IFS=";"; fi + +try_without_dir=true +# First we try "pod2man", then "$dir/pod2man" for each item in $PATH. +for dir in dummy${IFS}$PATH; do + if [ "$try_without_dir" = true ]; then + # first iteration + pod2man=pod2man + try_without_dir=false + else + # second and later iterations + pod2man="$dir/pod2man" + if [ ! -f "$pod2man" ]; then # '-x' is not available on Ultrix + pod2man='' + fi + fi + + if [ ! "$pod2man" = '' ]; then + failure=none + + if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | fgrep OpenSSL >/dev/null; then + : + else + failure=BasicTest + fi + + if [ "$failure" = none ]; then + if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | grep '^MARKER - ' >/dev/null; then + failure=MultilineTest + fi + fi + + + if [ "$failure" = none ]; then + echo "$pod2man" + exit 0 + fi + + echo "$pod2man does not work properly ('$failure' failed). Looking for another pod2man ..." >&2 + fi +done + +echo "No working pod2man found. Consider installing a new version." >&2 +echo "As a workaround, we'll use a bundled old copy of pod2man.pl." >&2 +echo "$1 ../../util/pod2man.pl" diff --git a/vendor/openssl/openssl/util/shlib_wrap.sh b/vendor/openssl/openssl/util/shlib_wrap.sh index 8775cb541..de111e9a3 100755 --- a/vendor/openssl/openssl/util/shlib_wrap.sh +++ b/vendor/openssl/openssl/util/shlib_wrap.sh @@ -27,6 +27,15 @@ SunOS|IRIX*) LD_PRELOAD_64="$LIBCRYPTOSO $LIBSSLSO"; export LD_PRELOAD_64 preload_var=LD_PRELOAD_64 ;; + *ELF\ 32*SPARC*|*ELF\ 32*80386*) + # We only need to change LD_PRELOAD_32 and LD_LIBRARY_PATH_32 + # on a multi-arch system. Otherwise, trust the fallbacks. + if [ -f /lib/64/ld.so.1 ]; then + [ -n "$LD_LIBRARY_PATH_32" ] && rld_var=LD_LIBRARY_PATH_32 + LD_PRELOAD_32="$LIBCRYPTOSO $LIBSSLSO"; export LD_PRELOAD_32 + preload_var=LD_PRELOAD_32 + fi + ;; # Why are newly built .so's preloaded anyway? Because run-time # .so lookup path embedded into application takes precedence # over LD_LIBRARY_PATH and as result application ends up linking diff --git a/vendor/openssl/openssl/util/ssleay.num b/vendor/openssl/openssl/util/ssleay.num index 5a8991350..5760bc42a 100755 --- a/vendor/openssl/openssl/util/ssleay.num +++ b/vendor/openssl/openssl/util/ssleay.num @@ -98,9 +98,9 @@ SSLeay_add_ssl_algorithms 109 NOEXIST::FUNCTION: SSLv23_client_method 110 EXIST::FUNCTION:RSA SSLv23_method 111 EXIST::FUNCTION:RSA SSLv23_server_method 112 EXIST::FUNCTION:RSA -SSLv2_client_method 113 EXIST::FUNCTION:RSA,SSL2 -SSLv2_method 114 EXIST::FUNCTION:RSA,SSL2 -SSLv2_server_method 115 EXIST::FUNCTION:RSA,SSL2 +SSLv2_client_method 113 EXIST::FUNCTION:RSA,SSL2_METHOD +SSLv2_method 114 EXIST::FUNCTION:RSA,SSL2_METHOD +SSLv2_server_method 115 EXIST::FUNCTION:RSA,SSL2_METHOD SSLv3_client_method 116 EXIST::FUNCTION:SSL3_METHOD SSLv3_method 117 EXIST::FUNCTION:SSL3_METHOD SSLv3_server_method 118 EXIST::FUNCTION:SSL3_METHOD From fa9817bba3fd0d96ce9c34065d6c096472b56bef Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Thu, 11 Aug 2016 21:39:09 -0700 Subject: [PATCH 19/34] default byteorder to fix node 0.12 --- vendor/openssl/openssl.gyp | 1 + 1 file changed, 1 insertion(+) diff --git a/vendor/openssl/openssl.gyp b/vendor/openssl/openssl.gyp index 224fab0dd..42bbd118d 100644 --- a/vendor/openssl/openssl.gyp +++ b/vendor/openssl/openssl.gyp @@ -12,6 +12,7 @@ 'gas_version%': 0, 'use_obsolete_asm%': 'true', 'openssl_fips%': 'false', + 'node_byteorder%': 'small' }, 'targets': [ { From 2d1274d145b81e875eef5c820446ce68365007c9 Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Thu, 11 Aug 2016 21:47:46 -0700 Subject: [PATCH 20/34] remove fips and add no_windows_braindeath --- vendor/openssl/openssl.gyp | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/vendor/openssl/openssl.gyp b/vendor/openssl/openssl.gyp index 42bbd118d..0cb4332fe 100644 --- a/vendor/openssl/openssl.gyp +++ b/vendor/openssl/openssl.gyp @@ -24,28 +24,12 @@ ['exclude', 'md2/.*$'], ['exclude', 'store/.*$'] ], + 'defines': [ + 'PURIFY', + '_REENTRANT', + 'NO_WINDOWS_BRAINDEATH' + ], 'conditions': [ - # FIPS - ['openssl_fips != ""', { - 'defines': [ - 'OPENSSL_FIPS', - ], - 'include_dirs': [ - '<(openssl_fips)/include', - ], - - # Trick fipsld, it expects to see libcrypto.a - 'product_name': 'crypto', - - 'direct_dependent_settings': { - 'defines': [ - 'OPENSSL_FIPS', - ], - 'include_dirs': [ - '<(openssl_fips)/include', - ], - }, - }], [ 'OS=="aix"', { # AIX is missing /usr/include/endian.h 'defines': [ From c45560f539723811e0c42e1c9bc408682bbaeaf0 Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Thu, 11 Aug 2016 22:01:38 -0700 Subject: [PATCH 21/34] add some missing libs to openssl --- vendor/openssl/openssl.gypi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vendor/openssl/openssl.gypi b/vendor/openssl/openssl.gypi index 3620e45c4..3fb68f04f 100644 --- a/vendor/openssl/openssl.gypi +++ b/vendor/openssl/openssl.gypi @@ -1272,6 +1272,10 @@ 'openssl_default_libraries_win': [ '-lgdi32.lib', '-luser32.lib', + '-lwsock32.lib', + '-lwinhttp.lib', + '-lcrypt32.lib', + '-lrpcrt4.lib' ], 'openssl_default_defines_not_win': [ # ENGINESDIR must be defined if OPENSSLDIR is. From 70141044438611823b9af755a9fa8cf3f423a956 Mon Sep 17 00:00:00 2001 From: James Bibby Date: Wed, 17 Aug 2016 16:59:32 -0400 Subject: [PATCH 22/34] Added instructions for CircleCI users The Circle CI instructions should be pretty obvious given the Ubuntu instructions, but this might save some people forgetting the -y flags or no knowing which part of the circle.yml to do this install in. --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index fdc5c7632..6f5d7ba49 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,16 @@ addons: - libstdc++-4.9-dev ``` +In CircleCI: + +``` yaml + dependencies: + pre: + - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + - sudo apt-get update + - sudo apt-get install -y libstdc++-4.9-dev +``` + If you are still encountering problems while installing, you should try the [Building from source](http://www.nodegit.org/guides/install/from-source/) instructions. From 8f61bf56d0908adead949e27bbe4d0b5bef30694 Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Wed, 14 Sep 2016 12:55:22 -0700 Subject: [PATCH 23/34] move preinstall to install? --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 8546739c8..61e7ca88b 100644 --- a/package.json +++ b/package.json @@ -72,14 +72,13 @@ "generateJson": "node generate/scripts/generateJson", "generateMissingTests": "node generate/scripts/generateMissingTests", "generateNativeCode": "node generate/scripts/generateNativeCode", - "install": "node lifecycleScripts/install", + "install": "node lifecycleScripts/preinstall && node lifecycleScripts/install", "installDebug": "BUILD_DEBUG=true npm install", "lint": "jshint lib test/tests test/utils examples lifecycleScripts", "mergecov": "lcov-result-merger 'test/**/*.info' 'test/coverage/merged.lcov' && ./lcov-1.10/bin/genhtml test/coverage/merged.lcov --output-directory test/coverage/report", "mocha": "mocha test/runner test/tests --timeout 15000", "mochaDebug": "mocha --debug-brk test/runner test/tests --timeout 15000", "postinstall": "node lifecycleScripts/postinstall", - "preinstall": "node lifecycleScripts/preinstall", "prepublish": "npm run babel", "rebuild": "node generate && npm run babel && node-gyp configure build", "rebuildDebug": "node generate && npm run babel && node-gyp configure --debug build", From f0b22dfe852fb7fe7da041fcb92540f8a518b5f1 Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Wed, 14 Sep 2016 11:11:32 -0700 Subject: [PATCH 24/34] patch libssh2 to work with vs2015 --- vendor/libssh2/win32/libssh2_config.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vendor/libssh2/win32/libssh2_config.h b/vendor/libssh2/win32/libssh2_config.h index 4e2ae290f..44728bb12 100644 --- a/vendor/libssh2/win32/libssh2_config.h +++ b/vendor/libssh2/win32/libssh2_config.h @@ -23,6 +23,7 @@ #define HAVE_SELECT #ifdef _MSC_VER +#if _MSC_VER < 1900 #define snprintf _snprintf #if _MSC_VER < 1500 #define vsnprintf _vsnprintf @@ -33,10 +34,10 @@ #else #define strncasecmp strnicmp #define strcasecmp stricmp +#endif #endif /* _MSC_VER */ /* Enable newer diffie-hellman-group-exchange-sha1 syntax */ #define LIBSSH2_DH_GEX_NEW 1 #endif /* LIBSSH2_CONFIG_H */ - From 68226340314f68fe1e5a34a3ea2f04257fe931fe Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Wed, 14 Sep 2016 11:16:12 -0700 Subject: [PATCH 25/34] Fix windows builds where node exports openssl --- generate/templates/templates/binding.gyp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/generate/templates/templates/binding.gyp b/generate/templates/templates/binding.gyp index dbc60874a..ccf254965 100644 --- a/generate/templates/templates/binding.gyp +++ b/generate/templates/templates/binding.gyp @@ -77,7 +77,27 @@ ], "defines": [ "_HAS_EXCEPTIONS=1" - ] + ], + "configurations": { + "Debug": { + "msvs_settings": { + "VCLinkerTool": { + "AdditionalOptions": [ + "/FORCE:MULTIPLE" + ] + } + } + }, + "Release": { + "msvs_settings": { + "VCLinkerTool": { + "AdditionalOptions": [ + "/FORCE:MULTIPLE" + ] + } + } + } + } } ], [ "OS=='linux' and ' Date: Wed, 14 Sep 2016 13:06:47 -0700 Subject: [PATCH 26/34] update versions of node for CI --- .travis.yml | 12 ++++++------ appveyor.yml | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index e4b861349..d65107654 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,9 +14,9 @@ sudo: false env: matrix: - export NODE_VERSION="0.12" TARGET_ARCH="x64" - - export NODE_VERSION="4.1" TARGET_ARCH="x64" - - export NODE_VERSION="5.8" TARGET_ARCH="x64" - - export NODE_VERSION="6" TARGET_ARCH="x64" + - export NODE_VERSION="4.5" TARGET_ARCH="x64" + - export NODE_VERSION="5.12" TARGET_ARCH="x64" + - export NODE_VERSION="6.5" TARGET_ARCH="x64" matrix: fast_finish: true @@ -25,13 +25,13 @@ matrix: env: export NODE_VERSION="0.12" TARGET_ARCH="ia32" sudo: required - os: linux - env: export NODE_VERSION="4.1" TARGET_ARCH="ia32" + env: export NODE_VERSION="4.5" TARGET_ARCH="ia32" sudo: required - os: linux - env: export NODE_VERSION="5.8" TARGET_ARCH="ia32" + env: export NODE_VERSION="5.12" TARGET_ARCH="ia32" sudo: required - os: linux - env: export NODE_VERSION="6.2" TARGET_ARCH="ia32" + env: export NODE_VERSION="6.5" TARGET_ARCH="ia32" sudo: required git: diff --git a/appveyor.yml b/appveyor.yml index 8fc6cd256..da168034d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,9 +28,9 @@ environment: matrix: # Node.js - nodejs_version: "0.12" - - nodejs_version: "4.1" - - nodejs_version: "5.8" - - nodejs_version: "6.2" + - nodejs_version: "4.5" + - nodejs_version: "5.12" + - nodejs_version: "6.5" matrix: fast_finish: true From fbd0a455c2aee27ee16a7f99d410ab5c75f6b9b3 Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Thu, 14 Jul 2016 23:26:02 -0700 Subject: [PATCH 27/34] Bump to 1.7.0 --- vendor/libssh2/1.4.3 | 0 vendor/libssh2/CMakeLists.txt | 101 + vendor/libssh2/COPYING | 2 +- vendor/libssh2/Makefile.OpenSSL.inc | 2 + vendor/libssh2/Makefile.WinCNG.inc | 2 + vendor/libssh2/Makefile.am | 19 +- vendor/libssh2/Makefile.in | 399 +- vendor/libssh2/Makefile.inc | 7 +- vendor/libssh2/Makefile.libgcrypt.inc | 2 + vendor/libssh2/Makefile.os400qc3.inc | 2 + vendor/libssh2/NEWS | 7214 +++++++++-------- vendor/libssh2/NMakefile | 7 +- vendor/libssh2/README | 90 +- vendor/libssh2/RELEASE-NOTES | 64 +- vendor/libssh2/aclocal.m4 | 729 +- .../CheckFunctionExistsMayNeedLibrary.cmake | 81 + .../cmake/CheckNonblockingSocketSupport.cmake | 119 + .../cmake/CopyRuntimeDependencies.cmake | 72 + vendor/libssh2/cmake/FindLibgcrypt.cmake | 53 + vendor/libssh2/cmake/SocketLibraries.cmake | 64 + vendor/libssh2/cmake/Toolchain-Linux-32.cmake | 42 + vendor/libssh2/cmake/max_warnings.cmake | 23 + vendor/libssh2/compile | 347 + vendor/libssh2/configure | 1887 ++++- vendor/libssh2/configure.ac | 130 +- vendor/libssh2/{ => docs}/AUTHORS | 0 vendor/libssh2/docs/CMakeLists.txt | 206 + vendor/libssh2/{ => docs}/HACKING | 0 vendor/libssh2/docs/HACKING.CRYPTO | 593 ++ .../{INSTALL => docs/INSTALL_AUTOTOOLS} | 89 + vendor/libssh2/docs/INSTALL_CMAKE | 174 + vendor/libssh2/docs/Makefile.am | 8 +- vendor/libssh2/docs/Makefile.in | 158 +- vendor/libssh2/{ => docs}/TODO | 0 vendor/libssh2/docs/libssh2_banner_set.3 | 2 +- vendor/libssh2/docs/libssh2_base64_decode.3 | 2 +- .../docs/libssh2_channel_get_exit_status.3 | 2 +- .../docs/libssh2_channel_window_write.3 | 2 +- .../docs/libssh2_channel_window_write_ex.3 | 4 +- vendor/libssh2/docs/libssh2_knownhost_add.3 | 2 +- vendor/libssh2/docs/libssh2_knownhost_addc.3 | 2 +- vendor/libssh2/docs/libssh2_knownhost_check.3 | 2 +- .../libssh2/docs/libssh2_knownhost_checkp.3 | 2 +- vendor/libssh2/docs/libssh2_poll.3 | 2 +- vendor/libssh2/docs/libssh2_scp_recv.3 | 3 + vendor/libssh2/docs/libssh2_scp_recv2.3 | 32 + .../libssh2/docs/libssh2_session_abstract.3 | 2 +- .../libssh2/docs/libssh2_session_banner_set.3 | 2 +- .../docs/libssh2_session_disconnect_ex.3 | 2 +- .../libssh2/docs/libssh2_session_handshake.3 | 40 + .../libssh2/docs/libssh2_session_last_errno.3 | 1 + .../libssh2/docs/libssh2_session_last_error.3 | 1 + .../docs/libssh2_session_method_pref.3 | 2 +- .../docs/libssh2_session_set_last_error.3 | 33 + .../docs/libssh2_session_supported_algs.3 | 4 +- .../libssh2/docs/libssh2_sftp_close_handle.3 | 2 +- vendor/libssh2/docs/libssh2_sftp_fstat_ex.3 | 4 +- vendor/libssh2/docs/libssh2_sftp_fsync.3 | 39 + vendor/libssh2/docs/libssh2_sftp_mkdir_ex.3 | 2 +- vendor/libssh2/docs/libssh2_sftp_rename_ex.3 | 2 +- vendor/libssh2/docs/libssh2_sftp_rewind.3 | 2 +- vendor/libssh2/docs/libssh2_sftp_stat.3 | 2 +- vendor/libssh2/docs/libssh2_sftp_symlink_ex.3 | 2 +- vendor/libssh2/docs/libssh2_userauth_list.3 | 2 +- .../libssh2_userauth_publickey_fromfile_ex.3 | 1 + .../libssh2_userauth_publickey_frommemory.3 | 56 + vendor/libssh2/example/CMakeLists.txt | 100 + vendor/libssh2/example/Makefile.am | 2 +- vendor/libssh2/example/Makefile.in | 325 +- vendor/libssh2/example/direct_tcpip.c | 61 +- vendor/libssh2/example/libssh2_config.h.in | 25 + .../libssh2/example/libssh2_config_cmake.h.in | 72 + vendor/libssh2/example/scp.c | 15 +- vendor/libssh2/example/scp_nonblock.c | 35 +- vendor/libssh2/example/scp_write.c | 7 +- vendor/libssh2/example/scp_write_nonblock.c | 7 +- vendor/libssh2/example/sftp.c | 7 +- vendor/libssh2/example/sftp_RW_nonblock.c | 7 +- vendor/libssh2/example/sftp_append.c | 7 +- vendor/libssh2/example/sftp_mkdir.c | 7 +- vendor/libssh2/example/sftp_mkdir_nonblock.c | 7 +- vendor/libssh2/example/sftp_nonblock.c | 19 +- vendor/libssh2/example/sftp_write.c | 7 +- vendor/libssh2/example/sftp_write_nonblock.c | 7 +- vendor/libssh2/example/sftp_write_sliding.c | 7 +- vendor/libssh2/example/sftpdir.c | 95 +- vendor/libssh2/example/sftpdir_nonblock.c | 7 +- vendor/libssh2/example/ssh2.c | 10 +- vendor/libssh2/example/ssh2_agent.c | 10 +- vendor/libssh2/example/ssh2_echo.c | 14 +- vendor/libssh2/example/ssh2_exec.c | 14 +- vendor/libssh2/example/subsystem_netconf.c | 35 +- vendor/libssh2/example/tcpip-forward.c | 50 +- vendor/libssh2/example/x11.c | 37 +- vendor/libssh2/include/libssh2.h | 172 +- vendor/libssh2/include/libssh2_publickey.h | 3 +- vendor/libssh2/include/libssh2_sftp.h | 1 + vendor/libssh2/libssh2.pc.in | 2 +- vendor/libssh2/ltmain.sh | 4 +- vendor/libssh2/m4/libtool.m4 | 24 +- vendor/libssh2/nw/GNUmakefile | 66 +- vendor/libssh2/nw/test/GNUmakefile | 4 +- vendor/libssh2/os400/README400 | 169 + vendor/libssh2/os400/ccsid.c | 252 + vendor/libssh2/os400/include/alloca.h | 50 + vendor/libssh2/os400/include/stdio.h | 72 + vendor/libssh2/os400/include/sys/socket.h | 75 + vendor/libssh2/os400/initscript.sh | 243 + vendor/libssh2/os400/libssh2_ccsid.h | 63 + .../libssh2/os400/libssh2rpg/libssh2.rpgle.in | 1704 ++++ .../os400/libssh2rpg/libssh2_ccsid.rpgle.in | 69 + .../os400/libssh2rpg/libssh2_publickey.rpgle | 141 + .../os400/libssh2rpg/libssh2_sftp.rpgle | 621 ++ vendor/libssh2/os400/macros.h | 168 + vendor/libssh2/os400/make-include.sh | 56 + vendor/libssh2/os400/make-rpg.sh | 92 + vendor/libssh2/os400/make-src.sh | 208 + vendor/libssh2/os400/make.sh | 49 + vendor/libssh2/os400/os400sys.c | 218 + vendor/libssh2/src/CMakeLists.txt | 398 + vendor/libssh2/src/Makefile.am | 17 +- vendor/libssh2/src/Makefile.in | 327 +- vendor/libssh2/src/NMakefile | 12 +- vendor/libssh2/src/agent.c | 44 +- vendor/libssh2/src/channel.c | 186 +- vendor/libssh2/src/comp.c | 50 +- vendor/libssh2/src/crypto.h | 30 +- vendor/libssh2/src/hostkey.c | 100 +- vendor/libssh2/src/keepalive.c | 7 +- vendor/libssh2/src/kex.c | 1041 ++- vendor/libssh2/src/knownhost.c | 326 +- vendor/libssh2/src/libgcrypt.c | 39 +- vendor/libssh2/src/libgcrypt.h | 37 +- vendor/libssh2/src/libssh2.pc.in | 17 + vendor/libssh2/src/libssh2_config.h.in | 25 + vendor/libssh2/src/libssh2_config_cmake.h.in | 105 + vendor/libssh2/src/libssh2_priv.h | 67 +- vendor/libssh2/src/mac.c | 100 + vendor/libssh2/src/misc.c | 64 +- vendor/libssh2/src/misc.h | 4 +- vendor/libssh2/src/openssl.c | 346 +- vendor/libssh2/src/openssl.h | 126 +- vendor/libssh2/src/os400qc3.c | 2513 ++++++ vendor/libssh2/src/os400qc3.h | 358 + vendor/libssh2/src/packet.c | 66 +- vendor/libssh2/src/pem.c | 127 +- vendor/libssh2/src/publickey.c | 7 +- vendor/libssh2/src/scp.c | 75 +- vendor/libssh2/src/session.c | 56 +- vendor/libssh2/src/sftp.c | 407 +- vendor/libssh2/src/sftp.h | 9 +- vendor/libssh2/src/transport.c | 15 +- vendor/libssh2/src/userauth.c | 314 +- vendor/libssh2/src/wincng.c | 2076 +++++ vendor/libssh2/src/wincng.h | 551 ++ vendor/libssh2/test-driver | 127 + vendor/libssh2/tests/CMakeLists.txt | 111 + vendor/libssh2/tests/Makefile.am | 2 + vendor/libssh2/tests/Makefile.in | 732 +- .../libssh2/tests/libssh2_config_cmake.h.in | 43 + vendor/libssh2/tests/mansyntax.sh | 10 +- vendor/libssh2/tests/ssh2.c | 20 +- vendor/libssh2/tests/sshd_fixture.sh.in | 53 + vendor/libssh2/vms/readme.vms | 6 +- vendor/libssh2/win32/GNUmakefile | 119 +- vendor/libssh2/win32/Makefile.Watcom | 39 +- vendor/libssh2/win32/config.mk | 38 +- vendor/libssh2/win32/libssh2.dsp | 169 +- vendor/libssh2/win32/libssh2.rc | 4 +- vendor/libssh2/win32/libssh2_config.h | 7 +- vendor/libssh2/win32/msvcproj.head | 153 +- vendor/libssh2/win32/test/GNUmakefile | 58 +- 172 files changed, 24771 insertions(+), 5428 deletions(-) delete mode 100644 vendor/libssh2/1.4.3 create mode 100644 vendor/libssh2/CMakeLists.txt create mode 100644 vendor/libssh2/Makefile.OpenSSL.inc create mode 100644 vendor/libssh2/Makefile.WinCNG.inc create mode 100644 vendor/libssh2/Makefile.libgcrypt.inc create mode 100644 vendor/libssh2/Makefile.os400qc3.inc create mode 100644 vendor/libssh2/cmake/CheckFunctionExistsMayNeedLibrary.cmake create mode 100644 vendor/libssh2/cmake/CheckNonblockingSocketSupport.cmake create mode 100644 vendor/libssh2/cmake/CopyRuntimeDependencies.cmake create mode 100644 vendor/libssh2/cmake/FindLibgcrypt.cmake create mode 100644 vendor/libssh2/cmake/SocketLibraries.cmake create mode 100644 vendor/libssh2/cmake/Toolchain-Linux-32.cmake create mode 100644 vendor/libssh2/cmake/max_warnings.cmake create mode 100755 vendor/libssh2/compile rename vendor/libssh2/{ => docs}/AUTHORS (100%) create mode 100644 vendor/libssh2/docs/CMakeLists.txt rename vendor/libssh2/{ => docs}/HACKING (100%) create mode 100644 vendor/libssh2/docs/HACKING.CRYPTO rename vendor/libssh2/{INSTALL => docs/INSTALL_AUTOTOOLS} (77%) create mode 100644 vendor/libssh2/docs/INSTALL_CMAKE rename vendor/libssh2/{ => docs}/TODO (100%) create mode 100644 vendor/libssh2/docs/libssh2_scp_recv2.3 create mode 100644 vendor/libssh2/docs/libssh2_session_handshake.3 create mode 100644 vendor/libssh2/docs/libssh2_session_set_last_error.3 create mode 100644 vendor/libssh2/docs/libssh2_sftp_fsync.3 create mode 100644 vendor/libssh2/docs/libssh2_userauth_publickey_frommemory.3 create mode 100644 vendor/libssh2/example/CMakeLists.txt create mode 100644 vendor/libssh2/example/libssh2_config_cmake.h.in create mode 100644 vendor/libssh2/os400/README400 create mode 100644 vendor/libssh2/os400/ccsid.c create mode 100644 vendor/libssh2/os400/include/alloca.h create mode 100644 vendor/libssh2/os400/include/stdio.h create mode 100644 vendor/libssh2/os400/include/sys/socket.h create mode 100644 vendor/libssh2/os400/initscript.sh create mode 100644 vendor/libssh2/os400/libssh2_ccsid.h create mode 100644 vendor/libssh2/os400/libssh2rpg/libssh2.rpgle.in create mode 100644 vendor/libssh2/os400/libssh2rpg/libssh2_ccsid.rpgle.in create mode 100644 vendor/libssh2/os400/libssh2rpg/libssh2_publickey.rpgle create mode 100644 vendor/libssh2/os400/libssh2rpg/libssh2_sftp.rpgle create mode 100644 vendor/libssh2/os400/macros.h create mode 100644 vendor/libssh2/os400/make-include.sh create mode 100644 vendor/libssh2/os400/make-rpg.sh create mode 100644 vendor/libssh2/os400/make-src.sh create mode 100644 vendor/libssh2/os400/make.sh create mode 100644 vendor/libssh2/os400/os400sys.c create mode 100644 vendor/libssh2/src/CMakeLists.txt create mode 100644 vendor/libssh2/src/libssh2.pc.in create mode 100644 vendor/libssh2/src/libssh2_config_cmake.h.in create mode 100644 vendor/libssh2/src/os400qc3.c create mode 100644 vendor/libssh2/src/os400qc3.h create mode 100755 vendor/libssh2/src/wincng.c create mode 100755 vendor/libssh2/src/wincng.h create mode 100755 vendor/libssh2/test-driver create mode 100644 vendor/libssh2/tests/CMakeLists.txt create mode 100644 vendor/libssh2/tests/libssh2_config_cmake.h.in create mode 100644 vendor/libssh2/tests/sshd_fixture.sh.in diff --git a/vendor/libssh2/1.4.3 b/vendor/libssh2/1.4.3 deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/libssh2/CMakeLists.txt b/vendor/libssh2/CMakeLists.txt new file mode 100644 index 000000000..dc585cd4d --- /dev/null +++ b/vendor/libssh2/CMakeLists.txt @@ -0,0 +1,101 @@ +# Copyright (c) 2014, 2015 Alexander Lamaison +# +# Redistribution and use in source and binary forms, +# with or without modification, are permitted provided +# that the following conditions are met: +# +# Redistributions of source code must retain the above +# copyright notice, this list of conditions and the +# following disclaimer. +# +# Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# Neither the name of the copyright holder nor the names +# of any other contributors may be used to endorse or +# promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +# OF SUCH DAMAGE. + +cmake_minimum_required(VERSION 2.8.11) + +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + +project(libssh2 C) +set(PROJECT_URL "https://www.libssh2.org/") +set(PROJECT_DESCRIPTION "The SSH library") + +option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF) + +# Parse version + +file(READ ${CMAKE_CURRENT_SOURCE_DIR}/include/libssh2.h _HEADER_CONTENTS) +string( + REGEX REPLACE ".*#define LIBSSH2_VERSION[ \t]+\"([^\"]+)\".*" "\\1" + LIBSSH2_VERSION "${_HEADER_CONTENTS}") +string( + REGEX REPLACE ".*#define LIBSSH2_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" + LIBSSH2_VERSION_MAJOR "${_HEADER_CONTENTS}") +string( + REGEX REPLACE ".*#define LIBSSH2_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" + LIBSSH2_VERSION_MINOR "${_HEADER_CONTENTS}") +string( + REGEX REPLACE ".*#define LIBSSH2_VERSION_PATCH[ \t]+([0-9]+).*" "\\1" + LIBSSH2_VERSION_PATCH "${_HEADER_CONTENTS}") + +if(NOT LIBSSH2_VERSION OR + NOT LIBSSH2_VERSION_MAJOR MATCHES "^[0-9]+$" OR + NOT LIBSSH2_VERSION_MINOR MATCHES "^[0-9]+$" OR + NOT LIBSSH2_VERSION_PATCH MATCHES "^[0-9]+$") + message( + FATAL_ERROR + "Unable to parse version from" + "${CMAKE_CURRENT_SOURCE_DIR}/include/libssh2.h") +endif() + +include(GNUInstallDirs) +install( + FILES docs/AUTHORS COPYING docs/HACKING README RELEASE-NOTES NEWS + DESTINATION ${CMAKE_INSTALL_DOCDIR}) + +include(max_warnings) +include(FeatureSummary) + +add_subdirectory(src) + +option(BUILD_EXAMPLES "Build libssh2 examples" ON) +if(BUILD_EXAMPLES) + add_subdirectory(example) +endif() + +option(BUILD_TESTING "Build libssh2 test suite" ON) +if(BUILD_TESTING) + enable_testing() + add_subdirectory(tests) +endif() + +add_subdirectory(docs) + +feature_summary(WHAT ALL) + +set(CPACK_PACKAGE_VERSION_MAJOR ${LIBSSH2_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${LIBSSH2_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${LIBSSH2_VERSION_PATCH}) +set(CPACK_PACKAGE_VERSION ${LIBSSH2_VERSION}) +include(CPack) diff --git a/vendor/libssh2/COPYING b/vendor/libssh2/COPYING index 1bd78c9cb..f2ca94772 100644 --- a/vendor/libssh2/COPYING +++ b/vendor/libssh2/COPYING @@ -2,7 +2,7 @@ * Copyright (c) 2005,2006 Mikhail Gusarov * Copyright (c) 2006-2007 The Written Word, Inc. * Copyright (c) 2007 Eli Fant - * Copyright (c) 2009 Daniel Stenberg + * Copyright (c) 2009-2014 Daniel Stenberg * Copyright (C) 2008, 2009 Simon Josefsson * All rights reserved. * diff --git a/vendor/libssh2/Makefile.OpenSSL.inc b/vendor/libssh2/Makefile.OpenSSL.inc new file mode 100644 index 000000000..76f3e85ca --- /dev/null +++ b/vendor/libssh2/Makefile.OpenSSL.inc @@ -0,0 +1,2 @@ +CRYPTO_CSOURCES = openssl.c +CRYPTO_HHEADERS = openssl.h diff --git a/vendor/libssh2/Makefile.WinCNG.inc b/vendor/libssh2/Makefile.WinCNG.inc new file mode 100644 index 000000000..c18350eed --- /dev/null +++ b/vendor/libssh2/Makefile.WinCNG.inc @@ -0,0 +1,2 @@ +CRYPTO_CSOURCES = wincng.c +CRYPTO_HHEADERS = wincng.h diff --git a/vendor/libssh2/Makefile.am b/vendor/libssh2/Makefile.am index 023200d0e..761733e73 100644 --- a/vendor/libssh2/Makefile.am +++ b/vendor/libssh2/Makefile.am @@ -32,8 +32,20 @@ win32/libssh2_config.h win32/config.mk win32/rules.mk \ win32/Makefile.Watcom win32/libssh2.dsw win32/tests.dsp $(DSP) \ win32/msvcproj.head win32/msvcproj.foot win32/libssh2.rc -EXTRA_DIST = $(WIN32FILES) buildconf $(NETWAREFILES) get_ver.awk HACKING \ - maketgz NMakefile TODO RELEASE-NOTES libssh2.pc.in $(VMSFILES) config.rpath +OS400FILES = os400/README400 os400/initscript.sh os400/make.sh \ +os400/make-src.sh os400/make-rpg.sh os400/make-include.sh \ +os400/os400sys.c os400/ccsid.c \ +os400/libssh2_config.h os400/macros.h os400/libssh2_ccsid.h \ +os400/include/alloca.h os400/include/sys/socket.h os400/include/stdio.h \ +os400/libssh2rpg/libssh2.rpgle.in \ +os400/libssh2rpg/libssh2_ccsid.rpgle.in \ +os400/libssh2rpg/libssh2_publickey.rpgle \ +os400/libssh2rpg/libssh2_sftp.rpgle \ +Makefile.os400qc3.inc + +EXTRA_DIST = $(WIN32FILES) buildconf $(NETWAREFILES) get_ver.awk \ + maketgz NMakefile RELEASE-NOTES libssh2.pc.in $(VMSFILES) config.rpath \ + CMakeLists.txt cmake $(OS400FILES) ACLOCAL_AMFLAGS = -I m4 @@ -75,6 +87,9 @@ gen-coverage: coverage: init-coverage build-coverage gen-coverage # DSP/VCPROJ generation adapted from libcurl +# only OpenSSL and WinCNG are supported with this build system +CRYPTO_CSOURCES = openssl.c wincng.c +CRYPTO_HHEADERS = openssl.h wincng.h # Makefile.inc provides the CSOURCES and HHEADERS defines include Makefile.inc diff --git a/vendor/libssh2/Makefile.in b/vendor/libssh2/Makefile.in index 88efc530f..624dfebd4 100644 --- a/vendor/libssh2/Makefile.in +++ b/vendor/libssh2/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -17,23 +16,61 @@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -53,12 +90,6 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @BUILD_EXAMPLES_TRUE@am__append_1 = example -DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/Makefile.inc $(srcdir)/libssh2.pc.in \ - $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ - TODO config.guess config.rpath config.sub depcomp install-sh \ - ltmain.sh missing subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/autobuild.m4 \ @@ -69,6 +100,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/autobuild.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(include_HEADERS) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d @@ -76,15 +109,28 @@ CONFIG_HEADER = $(top_builddir)/src/libssh2_config.h \ $(top_builddir)/example/libssh2_config.h CONFIG_CLEAN_FILES = libssh2.pc CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = SOURCES = DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -123,12 +169,37 @@ DATA = $(pkgconfig_DATA) HEADERS = $(include_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive -AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ - distdir dist dist-all distcheck +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +CSCOPE = cscope DIST_SUBDIRS = src tests docs example +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.inc \ + $(srcdir)/libssh2.pc.in COPYING ChangeLog NEWS README compile \ + config.guess config.rpath config.sub depcomp install-sh \ + ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -138,6 +209,7 @@ am__remove_distdir = \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi +am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ @@ -165,6 +237,7 @@ am__relativize = \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best +DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -172,6 +245,7 @@ distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -196,6 +270,8 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_LIBBCRYPT = @HAVE_LIBBCRYPT@ +HAVE_LIBCRYPT32 = @HAVE_LIBCRYPT32@ HAVE_LIBGCRYPT = @HAVE_LIBGCRYPT@ HAVE_LIBSSL = @HAVE_LIBSSL@ HAVE_LIBZ = @HAVE_LIBZ@ @@ -206,6 +282,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ +LIBBCRYPT = @LIBBCRYPT@ +LIBBCRYPT_PREFIX = @LIBBCRYPT_PREFIX@ +LIBCRYPT32 = @LIBCRYPT32@ +LIBCRYPT32_PREFIX = @LIBCRYPT32_PREFIX@ LIBGCRYPT = @LIBGCRYPT@ LIBGCRYPT_PREFIX = @LIBGCRYPT_PREFIX@ LIBOBJS = @LIBOBJS@ @@ -219,6 +299,8 @@ LIBZ = @LIBZ@ LIBZ_PREFIX = @LIBZ_PREFIX@ LIPO = @LIPO@ LN_S = @LN_S@ +LTLIBBCRYPT = @LTLIBBCRYPT@ +LTLIBCRYPT32 = @LTLIBCRYPT32@ LTLIBGCRYPT = @LTLIBGCRYPT@ LTLIBOBJS = @LTLIBOBJS@ LTLIBSSL = @LTLIBSSL@ @@ -292,6 +374,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -326,20 +409,34 @@ win32/libssh2_config.h win32/config.mk win32/rules.mk \ win32/Makefile.Watcom win32/libssh2.dsw win32/tests.dsp $(DSP) \ win32/msvcproj.head win32/msvcproj.foot win32/libssh2.rc -EXTRA_DIST = $(WIN32FILES) buildconf $(NETWAREFILES) get_ver.awk HACKING \ - maketgz NMakefile TODO RELEASE-NOTES libssh2.pc.in $(VMSFILES) config.rpath +OS400FILES = os400/README400 os400/initscript.sh os400/make.sh \ +os400/make-src.sh os400/make-rpg.sh os400/make-include.sh \ +os400/os400sys.c os400/ccsid.c \ +os400/libssh2_config.h os400/macros.h os400/libssh2_ccsid.h \ +os400/include/alloca.h os400/include/sys/socket.h os400/include/stdio.h \ +os400/libssh2rpg/libssh2.rpgle.in \ +os400/libssh2rpg/libssh2_ccsid.rpgle.in \ +os400/libssh2rpg/libssh2_publickey.rpgle \ +os400/libssh2rpg/libssh2_sftp.rpgle \ +Makefile.os400qc3.inc + +EXTRA_DIST = $(WIN32FILES) buildconf $(NETWAREFILES) get_ver.awk \ + maketgz NMakefile RELEASE-NOTES libssh2.pc.in $(VMSFILES) config.rpath \ + CMakeLists.txt cmake $(OS400FILES) ACLOCAL_AMFLAGS = -I m4 + +# DSP/VCPROJ generation adapted from libcurl +# only OpenSSL and WinCNG are supported with this build system +CRYPTO_CSOURCES = openssl.c wincng.c +CRYPTO_HHEADERS = openssl.h wincng.h CSOURCES = channel.c comp.c crypt.c hostkey.c kex.c mac.c misc.c \ packet.c publickey.c scp.c session.c sftp.c userauth.c transport.c \ - version.c knownhost.c agent.c openssl.c libgcrypt.c pem.c keepalive.c \ - global.c - -HHEADERS = libssh2_priv.h openssl.h libgcrypt.h transport.h channel.h \ - comp.h mac.h misc.h packet.h userauth.h session.h sftp.h crypto.h + version.c knownhost.c agent.c $(CRYPTO_CSOURCES) pem.c keepalive.c global.c +HHEADERS = libssh2_priv.h $(CRYPTO_HHEADERS) transport.h channel.h comp.h \ + mac.h misc.h packet.h userauth.h session.h sftp.h crypto.h -# DSP/VCPROJ generation adapted from libcurl # Makefile.inc provides the CSOURCES and HHEADERS defines WIN32SOURCES = $(CSOURCES) WIN32HEADERS = $(HHEADERS) libssh2_config.h @@ -361,7 +458,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/Ma echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -371,7 +467,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; -$(srcdir)/Makefile.inc: +$(srcdir)/Makefile.inc $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck @@ -436,22 +532,25 @@ uninstall-includeHEADERS: dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -466,57 +565,12 @@ $(RECURSIVE_TARGETS): $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ @@ -532,12 +586,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -549,15 +598,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -566,9 +611,31 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) +clean-cscope: + -rm -f cscope.files +cscope.files: clean-cscope cscopelist +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) @@ -639,40 +706,42 @@ distdir: $(DISTFILES) || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__remove_distdir) + $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz - $(am__remove_distdir) - -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) + $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-tarZ: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) + $(am__post_remove_distdir) dist-shar: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) + $(am__post_remove_distdir) -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another @@ -683,8 +752,6 @@ distcheck: dist GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ @@ -696,18 +763,19 @@ distcheck: dist *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod u+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ - && $(am__cd) $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + && $(am__cd) $(distdir)/_build/sub \ + && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ @@ -730,7 +798,7 @@ distcheck: dist && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 - $(am__remove_distdir) + $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' @@ -869,26 +937,27 @@ ps-am: uninstall-am: uninstall-includeHEADERS uninstall-pkgconfigDATA -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ - install-am install-strip tags-recursive - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am am--refresh check check-am clean clean-generic \ - clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ - dist-gzip dist-hook dist-lzip dist-lzma dist-shar dist-tarZ \ - dist-xz dist-zip distcheck distclean distclean-generic \ - distclean-libtool distclean-tags distcleancheck distdir \ - distuninstallcheck dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-includeHEADERS install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-pkgconfigDATA install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am \ - uninstall-includeHEADERS uninstall-pkgconfigDATA +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--refresh check check-am clean clean-cscope clean-generic \ + clean-libtool cscope cscopelist-am ctags ctags-am dist \ + dist-all dist-bzip2 dist-gzip dist-hook dist-lzip dist-shar \ + dist-tarZ dist-xz dist-zip distcheck distclean \ + distclean-generic distclean-libtool distclean-tags \ + distcleancheck distdir distuninstallcheck dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am \ + install-includeHEADERS install-info install-info-am \ + install-man install-pdf install-pdf-am install-pkgconfigDATA \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-includeHEADERS uninstall-pkgconfigDATA + +.PRECIOUS: Makefile .PHONY: ChangeLog diff --git a/vendor/libssh2/Makefile.inc b/vendor/libssh2/Makefile.inc index 12a89e536..8f2e570cb 100644 --- a/vendor/libssh2/Makefile.inc +++ b/vendor/libssh2/Makefile.inc @@ -1,7 +1,6 @@ CSOURCES = channel.c comp.c crypt.c hostkey.c kex.c mac.c misc.c \ packet.c publickey.c scp.c session.c sftp.c userauth.c transport.c \ - version.c knownhost.c agent.c openssl.c libgcrypt.c pem.c keepalive.c \ - global.c + version.c knownhost.c agent.c $(CRYPTO_CSOURCES) pem.c keepalive.c global.c -HHEADERS = libssh2_priv.h openssl.h libgcrypt.h transport.h channel.h \ - comp.h mac.h misc.h packet.h userauth.h session.h sftp.h crypto.h +HHEADERS = libssh2_priv.h $(CRYPTO_HHEADERS) transport.h channel.h comp.h \ + mac.h misc.h packet.h userauth.h session.h sftp.h crypto.h diff --git a/vendor/libssh2/Makefile.libgcrypt.inc b/vendor/libssh2/Makefile.libgcrypt.inc new file mode 100644 index 000000000..5d56292ce --- /dev/null +++ b/vendor/libssh2/Makefile.libgcrypt.inc @@ -0,0 +1,2 @@ +CRYPTO_CSOURCES = libgcrypt.c +CRYPTO_HHEADERS = libgcrypt.h diff --git a/vendor/libssh2/Makefile.os400qc3.inc b/vendor/libssh2/Makefile.os400qc3.inc new file mode 100644 index 000000000..e55094d9b --- /dev/null +++ b/vendor/libssh2/Makefile.os400qc3.inc @@ -0,0 +1,2 @@ +CRYPTO_CSOURCES = os400qc3.c +CRYPTO_HHEADERS = os400qc3.h diff --git a/vendor/libssh2/NEWS b/vendor/libssh2/NEWS index a5f3f77e5..52ba0d4ab 100644 --- a/vendor/libssh2/NEWS +++ b/vendor/libssh2/NEWS @@ -1,4682 +1,5430 @@ Changelog for the libssh2 project. Generated with git2news.pl -Version 1.4.3 (27 Nov 2012) - -Daniel Stenberg (27 Nov 2012) -- RELEASE-NOTES: fixed for 1.4.3 +Version 1.7.0 (23 Feb 2016) -- sftp_read: return error if a too large package arrives +Daniel Stenberg (23 Feb 2016) +- web: the site is now HTTPS -Peter Stuge (13 Nov 2012) -- Only define _libssh2_dsa_*() functions when building with DSA support +- RELEASE-NOTES: 1.7.0 release -Guenter Knauf (8 Nov 2012) -- Added .def file to output. +- diffie_hellman_sha256: convert bytes to bits + + As otherwise we get far too small numbers. + + Reported-by: Andreas Schneider + + CVE-2016-0787 -Kamil Dudka (1 Nov 2012) -- libssh2_hostkey_hash.3: update the description of return value +Alexander Lamaison (18 Feb 2016) +- Allow CI failures with VS 2008 x64. - The function returns NULL also if the hash algorithm is not available. + Appveyor doesn't support this combination. -Guenter Knauf (24 Oct 2012) -- Fixed mode acciedently committed. +Daniel Stenberg (16 Feb 2016) +- [Viktor Szakats brought this change] -- Ignore generated file. + GNUmakefile: list system libs after user libs + + Otherwise some referenced WinSock functions will fail to + resolve when linking against LibreSSL 2.3.x static libraries + with mingw. + + Closes #80 -- Added hack to make use of Makefile.inc. +- [Viktor Szakats brought this change] + + openssl: apply new HAVE_OPAQUE_STRUCTS macro - This should avoid further maintainance of the objects list. + Closes #81 -- Fixed MSVC NMakefile. +- [Viktor Szakats brought this change] + + openssl: fix LibreSSL support after OpenSSL 1.1.0-pre1/2 support + +Alexander Lamaison (14 Feb 2016) +- sftp.h: Fix non-C90 type. - Added missing source files; added resource for DLL. + uint64_t does not exist in C90. Use libssh2_uint64_t instead. -Kamil Dudka (22 Oct 2012) -- examples: use stderr for messages, stdout for data +- Exclude sshd tests from AppVeyor. - Reported by: Karel Srot - Bug: https://bugzilla.redhat.com/867462 + They fail complaining that sshd wasn't invoked with an absolute path. -- openssl: do not leak memory when handling errors +- Test on more versions of Visual Studio. + +- Fix Appveyor builds. + +Daniel Stenberg (14 Feb 2016) +- [Viktor Szakats brought this change] + + openssl: add OpenSSL 1.1.0-pre3-dev compatibility - ,.. in aes_ctr_init(). Detected by Coverity. + by using API instead of accessing an internal structure. + + Closes #83 -- channel: fix possible NULL dereference +- RELEASE-NOTES: synced with 996b04ececdf + +- include/libssh2.h: next version is 1.7.0 + +- configure: build "silent" if possible + +- sftp: re-indented some minor stuff + +- [Jakob Egger brought this change] + + sftp.c: ensure minimum read packet size - ... in libssh2_channel_get_exit_signal(). Detected by Coverity. + For optimum performance we need to ensure we don't request tiny packets. -- Revert "aes: the init function fails when OpenSSL has AES support" +- [Jakob Egger brought this change] + + sftp.c: Explicit return values & sanity checks + +- [Jakob Egger brought this change] + + sftp.c: Check Read Packet File Offset - This partially reverts commit f4f2298ef3635acd031cc2ee0e71026cdcda5864. + This commit adds a simple check to see if the offset of the read + request matches the expected file offset. - We need to use the EVP_aes_???_ctr() functions in FIPS mode. + We could try to recover, from this condition at some point in the future. + Right now it is better to return an error instead of corrupted data. -- crypt: use hard-wired cipher block sizes consistently +- [Jakob Egger brought this change] -- openssl: do not ignore failure of EVP_CipherInit() + sftp.c: Don't return EAGAIN if data was written to buffer -- kex: do not ignore failure of libssh2_md5_init() +- [Jakob Egger brought this change] + + sftp.c: Send at least one read request before reading - The MD5 algorithm is disabled when running in FIPS mode. + This commit ensures that we have sent at least one read request before + we try to read data in sftp_read(). + + Otherwise sftp_read() would return 0 bytes (indicating EOF) if the + socket is not ready for writing. -Daniel Stenberg (21 Aug 2012) -- [Peter Krempa brought this change] +- [Jakob Egger brought this change] - known_hosts: Fail when parsing unknown keys in known_hosts file. + sftp.c: stop reading when buffer is full - libssh2_knownhost_readfile() silently ignored problems when reading keys - in unsupported formats from the known hosts file. When the file is - written again from the internal structures of libssh2 it gets truntcated - to the point where the first unknown key was located. + Since we can only store data from a single chunk in filep, + we have to stop receiving data as soon as the buffer is full. - * src/knownhost.c:libssh2_knownhost_readfile() - return error if key - parsing fails + This adresses the following bug report: + https://github.com/libssh2/libssh2/issues/50 -- AUTHORS: synced with 42fec44c8a4 +Salvador Fandiño (21 Jan 2016) +- agent_disconnect_unix: unset the agent fd after closing it - 31 recent authors added + "agent_disconnect_unix", called by "libssh2_agent_disconnect", was + leaving the file descriptor in the agent structure unchanged. Later, + "libssh2_agent_free" would call again "libssh2_agent_disconnect" under + the hood and it would try to close again the same file descriptor. In + most cases that resulted in just a harmless error, but it is also + possible that the file descriptor had been reused between the two + calls resulting in the closing of an unrelated file descriptor. + + This patch sets agent->fd to LIBSSH2_INVALID_SOCKET avoiding that + issue. + + Signed-off-by: Salvador Fandiño -- [Dave Hayden brought this change] +Daniel Stenberg (18 Jan 2016) +- [Patrick Monnerat brought this change] - compression: add support for zlib@openssh.com + os400qc3: support encrypted private keys - Add a "use_in_auth" flag to the LIBSSH2_COMP_METHOD struct and a - separate "zlib@openssh.com" method, along with checking session->state - for LIBSSH2_STATE_AUTHENTICATED. Appears to work on the OpenSSH servers - I've tried against, and it should work as before with normal zlib - compression. + PKCS#8 EncryptedPrivateKeyinfo structures are recognized and decoded to get + values accepted by the Qc3 crypto library. -- [Dmitry Smirnov brought this change] +- [Patrick Monnerat brought this change] - configure: gcrypt doesn't come with pkg-config support + os400qc3: New PKCS#5 decoder - ... so use plain old -lgcrypt to the linker to link with it. + The Qc3 library is not able to handle PKCS#8 EncryptedPrivateKeyInfo structures + by itself. It is only capable of decrypting the (encrypted) PrivateKeyInfo + part, providing a key encryption key and an encryption algorithm are given. + Since the encryption key and algorithm description part in a PKCS#8 + EncryptedPrivateKeyInfo is a PKCS#5 structure, such a decoder is needed to + get the derived key method and hash, as well as encryption algorith and + initialisation vector. + +- [Patrick Monnerat brought this change] + + os400qc3: force continuous update on non-final hash/hmac computation + +- [Patrick Monnerat brought this change] + + os400qc3: Be sure hmac keys have a minimum length - Fixes #225 + The Qc3 library requires a minimum key length depending on the target + hash algorithm. Append binary zeroes to the given key if not long enough. + This matches RFC 2104 specifications. -- sftp_read: Value stored to 'next' is never read +- [Patrick Monnerat brought this change] + + os400qc3: Slave descriptor for key encryption key - Detected by clang-analyzer + The Qc3 library requires the key encryption key to exist as long as + the encrypted key is used. Its descriptor token is then kept as an + "encrypted key slave" for recursive release. -- publickey_init: errors are negative, fix check +- [Patrick Monnerat brought this change] + + os400qc3.c: comment PEM/DER decoding + +- [Patrick Monnerat brought this change] + + os400qc3.c: improve ASN.1 header byte checks + +- [Patrick Monnerat brought this change] + + os400qc3.c: improve OID matching + +- [Patrick Monnerat brought this change] + + os400: os400qc3.c: replace malloc by LIBSSH2_ALLOC or alloca where possible + +- [Patrick Monnerat brought this change] + + os400: asn1_new_from_bytes(): use data from a single element only + +- [Patrick Monnerat brought this change] + + os400: fix an ILE/RPG prototype + +- [Patrick Monnerat brought this change] + + os400: implement character encoding conversion support + +- [Patrick Monnerat brought this change] + + os400: do not miss some external prototypes - Detected by clang-analyzer. + Build procedure extproto() did not strip braces from header files, thus + possibly prepended them to true prototypes. This prevented the prototype to + be recognized as such. + The solution implemented here is to map braces to semicolons, effectively + considering them as potential prototype delimiters. -- [Maxime Larocque brought this change] +- [Patrick Monnerat brought this change] - session_free: wrong variable used for keeping state + os400: Really add specific README + +- [Patrick Monnerat brought this change] + + os400: Add specific README and include new files in dist tarball + +- [Patrick Monnerat brought this change] + + os400: add compilation scripts + +- [Patrick Monnerat brought this change] + + os400: include files for ILE/RPG - If libssh2_session_free is called without the channel being freed - previously by libssh2_channel_free a memory leak could occur. + In addition, file os400/macros.h declares all procedures originally + defined as macros. It must not be used for real inclusion and is only + intended to be used as a `database' for macro wrapping procedures generation. + +- [Patrick Monnerat brought this change] + + os400: add supplementary header files/wrappers. Define configuration. + +- [Patrick Monnerat brought this change] + + Protect callback function calls from macro substitution - A mismatch of states variables in session_free() prevent the call to - libssh2_channel_free function. session->state member is used instead of - session->free_state. + Some structure fields holding callback addresses have the same name as the + underlying system function (connect, send, recv). Set parentheses around + their reference to suppress a possible macro substitution. - It causes a leak of around 600 bytes on every connection on my systems - (Linux, x64 and PPC). + Use a macro for connect() on OS/400 to resolve a const/nonconst parameter + problem. + +- [Patrick Monnerat brought this change] + + Add interface for OS/400 crypto library QC3 + +- [Patrick Monnerat brought this change] + + misc: include stdarg.h for debug code + +- [Patrick Monnerat brought this change] + + Document crypto library interface + +- [Patrick Monnerat brought this change] + + Feature an optional crypto-specific macro to rsa sign a data fragment vector - (Debugging done under contract for Accedian Networks) + OS/400 crypto library is unable to sign a precomputed SHA1 hash: however + it does support a procedure that hashes data fragments and rsa signs. + If defined, the new macro _libssh2_rsa_sha1_signv() implements this function + and disables use of _libssh2_rsa_sha1_sign(). - Fixes #246 + The function described above requires that the struct iovec unused slacks are + cleared: for this reason, macro libssh2_prepare_iovec() has been introduced. + It should be defined as empty for crypto backends that are not sensitive + to struct iovec unused slack values. -Guenter Knauf (29 Jun 2012) -- Small NetWare makefile tweak. +- [Patrick Monnerat brought this change] -- Some small Win32 makefile fixes. + Fold long lines in include files -Daniel Stenberg (19 Jun 2012) -- libssh2_userauth_publickey_fromfile_ex.3: mention publickey == NULL +- [Viktor Szakats brought this change] -- comp_method_zlib_decomp: handle Z_BUF_ERROR when inflating - - When using libssh2 to perform an SFTP file transfer from the "JSCAPE MFT - Server" (http://www.jscape.com) the transfer failed. The default JSCAPE - configuration is to enforce zlib compression on SSH2 sessions so the - session was compressed. The relevant part of the debug trace contained: + kex.c: fix indentation - [libssh2] 1.052750 Transport: unhandled zlib error -5 - [libssh2] 1.052750 Failure Event: -29 - decompression failure + Closes #71 + +- [Viktor Szakats brought this change] + + add OpenSSL-1.1.0-pre2 compatibility - The trace comes from comp_method_zlib_decomp() in comp.c. The "unhandled - zlib error -5" is the status returned from the zlib function - inflate(). The -5 status corresponds to "Z_BUF_ERROR". + Closes #70 + +- [Viktor Szakats brought this change] + + add OpenSSL 1.1.0-pre1 compatibility - The inflate() function takes a pointer to a z_stream structure and - "inflates" (decompresses) as much as it can. The relevant fields of the - z_stream structure are: + * close https://github.com/libssh2/libssh2/issues/69 + * sync a declaration with the rest of similar ones + * handle EVP_MD_CTX_new() returning NULL with OpenSSL 1.1.0 + * fix potential memory leak with OpenSSL 1.1.0 in + _libssh2_*_init() functions, when EVP_MD_CTX_new() succeeds, + but EVP_DigestInit() fails. + +Marc Hoersken (22 Dec 2015) +- wincng.c: fixed _libssh2_wincng_hash_final return value - next_in - pointer to the input buffer containing compressed data - avail_in - the number of bytes available at next_in - next_out - pointer to the output buffer to be filled with uncompressed - data - avail_out - how much space available at next_out + _libssh2_wincng_hash_final was returning the internal BCRYPT + status code instead of a valid libssh2 return value (0 or -1). - To decompress data you set up a z_stream struct with the relevant fields - filled in and pass it to inflate(). On return the fields will have been - updated so next_in and avail_in show how much compressed data is yet to - be processed and next_out and avail_out show how much space is left in - the output buffer. + This also means that _libssh2_wincng_hash never returned 0. + +- wincng.c: fixed possible memory leak in _libssh2_wincng_hash - If the supplied output buffer is too small then on return there will be - compressed data yet to be processed (avail_in != 0) and inflate() will - return Z_OK. In this case the output buffer must be grown, avail_out - updated and inflate() called again. + If _libssh2_wincng_hash_update failed _libssh2_wincng_hash_final + would never have been called before. - If the supplied output buffer was big enough then on return the - compressed data will have been exhausted (avail_in == 0) and inflate() - will return Z_OK, so the data has all been uncompressed. + Reported by Zenju. + +Kamil Dudka (15 Dec 2015) +- [Paul Howarth brought this change] + + libssh2.pc.in: fix the output of pkg-config --libs - There is a corner case where inflate() makes no progress. That is, there - may be unprocessed compressed data and space available in the output - buffer and yet the function does nothing. In this case inflate() will - return Z_BUF_ERROR. From the zlib documentation and the source code it - is not clear under what circumstances this happens. It could be that it - needs to write multiple bytes (all in one go) from its internal state to - the output buffer before processing the next chunk of input but but - can't because there is not enough space (though my guesses as to the - cause are not really relevant). Recovery from Z_BUF_ERROR is pretty - simple - just grow the output buffer, update avail_out and call - inflate() again. + ... such that it does not include LDFLAGS used to build libssh2 itself. + There was a similar fix in the curl project long time ago: - The comp_method_zlib_decomp() function does not handle the case when - inflate() returns Z_BUF_ERROR. It treats it as a non-recoverable error - and basically aborts the session. + https://github.com/bagder/curl/commit/curl-7_19_7-56-g4c8adc8 - Fixes #240 + Bug: https://bugzilla.redhat.com/1279966 + Signed-off-by: Kamil Dudka -Guenter Knauf (12 Jun 2012) -- MinGW makefile tweaks. - - Use GNU tools when compiling on Linux. - Fixed dist and dev targets. +Marc Hoersken (6 Dec 2015) +- hostkey.c: align code path of ssh_rsa_init to ssh_dss_init -- NetWare makefile tweaks. +- hostkey.c: fix invalid memory access if libssh2_dsa_new fails - Changed to use Windows commandline tools instead of - GNU tools when compiling on Windows. Fixed dist and - dev targets. Enabled nlmconv error for unresolved - symbols. + Reported by dimmaq, fixes #66 -Daniel Stenberg (11 Jun 2012) -- Revert "config.rpath: generated file, no need to keep in git" +Daniel Stenberg (3 Nov 2015) +- [Will Cosgrove brought this change] + + gcrypt: define libssh2_sha256_ctx - This reverts commit 1ac7bd09cc685755577fb2c8829adcd081e7ab3c. + Looks like it didn't make it into the latest commit for whatever reason. - This file still used by lib/*m4 functions so we need to keep the file - around. - -- BINDINGS: added PySsh2, a Python-ctypes binding + Closes #58 -Guenter Knauf (8 Jun 2012) -- Fixed MinGW debug build. +- [Salvador Fandino brought this change] -Daniel Stenberg (5 Jun 2012) -- BINDINGS: Added the Cocoa/Objective-C one + libssh2_session_set_last_error: Add function - ... and sorted the bindings after the languages, alphabetically + Net::SSH2, the Perl wrapping module for libssh2 implements several features* + on top of libssh2 that can fail and so need some mechanism to report the error + condition to the user. - Reported by: Mike Abdullah + Until now, besides the error state maintained internally by libssh2, another + error state was maintained at the Perl level for every session object and then + additional logic was used to merge both error states. That is a maintenance + nighmare, and actually there is no way to do it correctly and consistently. + + In order to allow the high level language to add new features to the library + but still rely in its error reporting features the new function + libssh2_session_set_last_error (that just exposses _libssh2_error_flags) is + introduced. + + *) For instance, connecting to a remote SSH service giving the hostname and + port. + + Signed-off-by: Salvador Fandino + Signed-off-by: Salvador Fandiño -- BINDINGS: document the bindings we know of +- [Salvador Fandino brought this change] -Guenter Knauf (4 Jun 2012) -- Fixed LIBSSH2_INT64_T_FORMAT macro. + _libssh2_error: Support allocating the error message - Usually a format macro should hold the whole format, otherwise - it should be named a prefix. Also fixed usage of this macro in - scp.c for a signed var where it was used as prefix for unsigned. + Before this patch "_libssh2_error" required the error message to be a + static string. + + This patch adds a new function "_libssh2_error_flags" accepting an + additional "flags" argument and specifically the flag + "LIBSSH2_ERR_FLAG_DUP" indicating that the passed string must be + duplicated into the heap. + + Then, the method "_libssh2_error" has been rewritten to use that new + function under the hood. + + Signed-off-by: Salvador Fandino + Signed-off-by: Salvador Fandiño -- Removed obsolete define from makefiles. +- [Will Cosgrove brought this change] -- Renamed NetWare makefiles. + added engine.h include to fix warning -- Renamed NetWare makefiles. +- [sune brought this change] -- Synced MinGW makefiles with 56c64a6..39e438f. + kex.c: removed dupe entry from libssh2_kex_methods[] - Also synced MinGW test makefile with b092696..f8cb874. + Closes #51 -Peter Stuge (30 May 2012) -- Revert "sftp: Don't send attrs.permissions on read-only SSH_FXP_OPEN" +- [Salvador Fandiño brought this change] + + userauth: Fix off by one error when reading public key file - This reverts commit 04e79e0c798674a0796be8a55f63dd92e6877790. + After reading the public key from file the size was incorrectly + decremented by one. + + This was usually a harmless error as the last character on the public + key file is an unimportant EOL. But if due to some error the public key + file is empty, the public key size becomes (uint)(0 - 1), resulting in + an unrecoverable out of memory error later. + + Signed-off-by: Salvador Fandi??o -- sftp: Don't send attrs.permissions on read-only SSH_FXP_OPEN +- [Salvador Fandino brought this change] + + channel: Detect bad usage of libssh2_channel_process_startup - This works around a protocol violation in the ProFTPD 1.3.4 mod_sftp - server, as reported by Will Cosgrove in: + A common novice programmer error (at least among those using the + wrapping Perl module Net::SSH2), is to try to reuse channels. - http://libssh2.org/mail/libssh2-devel-archive-2012-05/0079.shtml + This patchs detects that incorrect usage and fails with a + LIBSSH2_ERROR_BAD_USE error instead of hanging. - Based on a suggested fix by TJ Saunders in: + Signed-off-by: Salvador Fandino + +- [Will Cosgrove brought this change] + + kex: Added diffie-hellman-group-exchange-sha256 support - http://libssh2.org/mail/libssh2-devel-archive-2012-05/0104.shtml + ... and fixed HMAC_Init depricated usage + + Closes #48 -Guenter Knauf (28 May 2012) -- Try to detect OpenSSL build type automatically. +Alexander Lamaison (21 Sep 2015) +- Prefixed new #defines to prevent collisions. - Also fixed recently added libgdi32 linkage which is only - required when OpenSSL libs are linked statically. + Other libraries might have their own USE_WIN32_*FILES. -Daniel Stenberg (25 May 2012) -- config.rpath: generated file, no need to keep in git +- [keith-daigle brought this change] -Guenter Knauf (22 May 2012) -- Updated dependency libary versions. + Update examples/scp.c to fix bug where large files on win32 would cause got to wrap and go negative -Daniel Stenberg (18 May 2012) -- 1.4.3: towards the future +- [David Byron brought this change] -Version 1.4.2 (18 May 2012) + add libssh2_scp_recv2 to support large (> 2GB) files on windows -Daniel Stenberg (18 May 2012) -- RELEASE-NOTES: synced with 92a9f952794 +Daniel Stenberg (17 Sep 2015) +- [sune brought this change] -Alexander Lamaison (15 May 2012) -- win32/libssh2_config.h: Remove hardcoded #define LIBSSH2_HAVE_ZLIB. - - Rationale: Everything else in this file states a fact about the win32 - platform that is unconditional for that platform. There is nothing - unconditional about the presence of zlib. It is neither included with - Windows nor with the platform SDK. Therefore, this is not an appropriate - place to assert its presence. Especially as, once asserted, it cannot be - overridden using a compiler flag. + WinCNG: support for SHA256/512 HMAC - In contrast, if it is omitted, then it can easily be reasserted by adding - a compiler flag defining LIBSSH2_HAVE_ZLIB. + Closes #47 -Daniel Stenberg (14 May 2012) -- RELEASE-NOTES: synced with 69a3354467c +- [brian m. carlson brought this change] -- _libssh2_packet_add: SSH_MSG_CHANNEL_REQUEST default to want_reply + Add support for HMAC-SHA-256 and HMAC-SHA-512. - RFC4254 says the default 'want_reply' is TRUE but the code defaulted to - FALSE. Now changed. + Implement support for these algorithms and wire them up to the libgcrypt + and OpenSSL backends. Increase the maximum MAC buffer size to 64 bytes + to prevent buffer overflows. Prefer HMAC-SHA-256 over HMAC-SHA-512, and + that over HMAC-SHA-1, as OpenSSH does. - Fixes #233 + Closes #40 -- gettimeofday: no need for a replacement under cygwin - - Fixes #224 +- [Zenju brought this change] -Alexander Lamaison (13 May 2012) -- Prevent sftp_packet_read accessing freed memory. + kex: free server host key before allocating it (again) - sftp_packet_add takes ownership of the packet passed to it and (now that we - handle zombies) might free the packet. sftp_packet_read uses the packet type - byte as its return code but by this point sftp_packet_add might have freed - it. This change fixes the problem by caching the packet type before calling - sftp_packet_add. + Fixes a memory leak when Synology server requests key exchange - I don't understand why sftp_packet_read uses the packet type as its return - code. A future change might get rid of this entirely. + Closes #43 -Daniel Stenberg (12 May 2012) -- sftp_packet_flush: flush zombies too - - As this function is called when the SFTP session is closed, it needs to - also kill all zombies left in the SFTP session to avoid leaking memory - just in case some zombie would still be in there. +- [Viktor Szakats brought this change] -- sftp_packetlist_flush: zombies must not have responses already + GNUmakefile: up OpenSSL version - When flushing the packetlist, we must only add the request as a zombie - if no response has already been received. Otherwise we could wrongly - make it a zombie even though the response was already received and then - we'd get a zombie stuck there "forever"... + closes #23 -- sftp_read: on EOF remove packet before flush - - Since the sftp_packetlist_flush() function will move all the existing - FXP_READ requests in this handle to the zombie list we must first remove - this just received packet as it is clearly not a zombie. +- [Viktor Szakats brought this change] -- sftp_packet_require: sftp_packet_read() returning 0 is not an error + GNUmakefile: add -m64 CFLAGS when targeting mingw64, add -m32/-m64 to LDFLAGS - Exactly as the comment in the code said, checking the return code from - sftp_packet_read() with <= was wrong and it should be < 0. With the new - filtering on incoming packets that are "zombies" we can now see this - getting zero returned. - -- sftp_packetlist_flush: only make it zombie if it was sent + libssh2 equivalent of curl patch https://github.com/bagder/curl/commit/d21b66835f2af781a3c2a685abc92ef9f0cd86be - The list of outgoing packets may also contain packets that never were - sent off and we better not make them zombies too. + This allows to build for the non-default target when using a multi-target mingw distro. + Also bump default OpenSSL dependency path to 1.0.2c. -- [Alexander Lamaison brought this change] +- [Viktor Szakats brought this change] - Mark outstanding read requests after EOF as zombies. + GNUmakefile: add support for LIBSSH2_LDFLAG_EXTRAS - In order to be fast, sftp_read sends many read requests at once. With a small - file, this can mean that when EOF is received back, many of these requests are - still outstanding. Responses arriving after we close the file and abandon the - file handle are queued in the SFTP packet queue and never collected. This - causes transfer speed to drop as a progressively longer queue must be searched - for every packet. + It is similar to existing LIBSSH2_CFLAG_EXTRAS, but for + extra linker options. - This change introduces a zombie request-ID list in the SFTP session that is - used to recognise these outstanding requests and prevent them being added to - the queue. + Also delete some line/file ending whitespace. + + closes #27 -Peter Stuge (23 Apr 2012) -- [Rafael Kitover brought this change] +- [nasacj brought this change] - Update win32/GNUmakefile to use OpenSSL 1.0.1a + hostkey.c: Fix compiling error when OPENSSL_NO_MD5 is defined - libcrypto on win32 now depends on gdi32.dll, so move the OpenSSL LDLIBS - block to before the compiler definitions, so that libcrypto gets added - first, and then add -lgdi32 into the following common LDLIBS for gcc. + Closes #32 -Guenter Knauf (23 Apr 2012) -- Changed 'Requires' to 'Requires.private'. - - Only static builds need to link against the crypto libs. +- [Mizunashi Mana brought this change] -- Fixed 'Requires:' names. + openssl.h: adjust the rsa/dsa includes - The 'Requires:' line lists the names of the .pc files. + ... to work when built without DSA support. + + Closes #36 -- Added 'Requires:' line to libssh2.pc. +Alexander Lamaison (26 Jul 2015) +- Let CMake build work as a subproject. - This is necessary so that other libs which lookup libssh2 info - via pkg-config can add the right crypto lib dependencies. + Patch contributed by JasonHaslam. -- Updated dependency lib versions. +- Fix builds with Visual Studio 2015. + + VS2015 moved stdio functions to the header files as inline function. That means check_function_exists can't detect them because it doesn't use header files - just does a link check. Instead we need to use check_symbol_exists with the correct headers. -Peter Stuge (18 Apr 2012) -- configure.ac: Add option to disable build of the example applications +Kamil Dudka (2 Jul 2015) +- cmake: include CMake files in the release tarballs - Examples are built by default. Any of the following options on the - configure command line will skip building them: + Despite we announced the CMake support in libssh2-1.6.0 release notes, + the files required by the CMake build system were not included in the + release tarballs. Hence, the only way to use CMake for build was the + upstream git repository. - --disable-examples-build - --enable-examples-build=no - --enable-examples-build=false + This commit makes CMake actually supported in the release tarballs. -- userauth.c: fread() from public key file to correctly detect any errors +- tests/mansyntax.sh: fix 'make distcheck' with recent autotools - If the filename parameter for file_read_publickey() was the name of a - directory instead of a file then libssh2 would spin trying to fgetc() - from the FILE * for the opened directory when trying to determine the - length of the encoded public key, since fgetc() can't report errors. + Do not create symbolic links off the build directory. Recent autotools + verify that out-of-source build works even if the source directory tree + is not writable. + +- openssl: fix memleak in _libssh2_dsa_sha1_verify() + +Daniel Stenberg (12 Jun 2015) +- openssl: make libssh2_sha1 return error code - Use fread() instead to correctly detect this error condition along - with many others. + - use the internal prefix _libssh2_ for non-exported functions - This fixes the problem reported in - http://www.libssh2.org/mail/libssh2-devel-archive-2012-04/0021.shtml + - removed libssh2_md5() since it wasn't used - Reported-by: Oleksiy Zagorskyi + Reported-by: Kamil Dudka -- Return LIBSSH2_ERROR_SOCKET_DISCONNECT on EOF when reading banner +- [LarsNordin-LNdata brought this change] -Guenter Knauf (17 Apr 2012) -- Fixed copyright year. + SFTP: Increase speed and datasize in SFTP read + + The function sftp_read never return more then 2000 bytes (as it should + when I asked Daniel). I increased the MAX_SFTP_READ_SIZE to 30000 but + didn't get the same speed as a sftp read in SecureSSH. I analyzed the + code and found that a return always was dona when a chunk has been read. + I changed it to a sliding buffer and worked on all available chunks. I + got an increase in speed and non of the test I have done has failed + (both local net and over Internet). Please review and test. I think + 30000 is still not the optimal MAX_SFTP_READ_SIZE, my next goal is to + make an API to enable changing this value (The SecureSSH sftp_read has + more complete filled packages when comparing the network traffic) -- Updated dependency lib versions in static makefiles. +- bump: start working on 1.6.1 -Daniel Stenberg (6 Apr 2012) -- version: bump to 1.4.2 - - We're on the 1.4.2 track now (at least) +Version 1.6.0 (5 Jun 2015) -Version 1.4.1 (4 Apr 2012) +Daniel Stenberg (5 Jun 2015) +- RELEASE-NOTES: synced with 858930cae5c6a -Daniel Stenberg (4 Apr 2012) -- RELEASE-NOTES: updated for 1.4.1 release +Marc Hoersken (19 May 2015) +- wincng.c: fixed indentation -- always do "forced" window updates +- [sbredahl brought this change] + + wincng.c: fixed memleak in (block) cipher destructor + +Alexander Lamaison (6 May 2015) +- [Jakob Egger brought this change] + + libssh2_channel_open: more detailed error message - When calling _libssh2_channel_receive_window_adjust() internally, we now - always use the 'force' option to prevent libssh2 to avoid sending the - update if the update isn't big enough. + The error message returned by libssh2_channel_open in case of a server side channel open failure is now more detailed and includes the four standard error conditions in RFC 4254. + +- [Hannes Domani brought this change] + + kex: fix libgcrypt memory leaks of bignum - It isn't fully analyzed but we have seen corner cases which made a - necessary window update not get send due to this and then the other side - doesn't send data our side then sits waiting for forever. + Fixes #168. -- channel_read: force window adjusts! +Marc Hoersken (3 Apr 2015) +- configure.ac: check for SecureZeroMemory for clear memory feature + +- Revert "wincng.c: fix clear memory feature compilation with mingw" - if there's not enough room to receive the data that's being requested, - the window adjustment needs to be sent to the remote and thus the force - option has to be used. _libssh2_channel_receive_window_adjust() would - otherwise "queue" small window adjustments for a later packet but that - is really terribly for the small buffer read that for example is the - final little piece of a very large file as then there is no logical next - packet! + This reverts commit 2d2744efdd0497b72b3e1ff6e732aa4c0037fc43. - Reported by: Armen Babakhanian - Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0130.shtml + Autobuilds show that this did not solve the issue. + And it seems like RtlFillMemory is defined to memset, + which would be optimized out by some compilers. -- [Paul Howarth brought this change] +- wincng.c: fix clear memory feature compilation with mingw - aes: the init function fails when OpenSSL has AES support - - The internal init function only worked fine when the configure script - didn't detect the OpenSSL AES_CTR function! +Alexander Lamaison (1 Apr 2015) +- [LarsNordin-LNdata brought this change] + + Enable use of OpenSSL that doesn't have DSA. - Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0111.shtml - Reported by: Paul Howarth + Added #if LIBSSH2_DSA for all DSA functions. -- [Matthew Booth brought this change] +- [LarsNordin-LNdata brought this change] - transport_send: Finish in-progress key exchange before sending data + Use correct no-blowfish #define with OpenSSL. - _libssh2_channel_write() first reads outstanding packets before writing - new data. If it reads a key exchange request, it will immediately start - key re-exchange, which will require sending a response. If the output - socket is full, this will result in a return from - _libssh2_transport_read() of LIBSSH2_ERROR_EAGAIN. In order not to block - a write because there is no data to read, this error is explicitly - ignored and the code continues marshalling a packet for sending. When it - is sent, the remote end immediately drops the connection because it was - expecting a continuation of the key exchange, but got a data packet. + The OpenSSL define is OPENSSL_NO_BF, not OPENSSL_NO_BLOWFISH. + +Marc Hoersken (25 Mar 2015) +- configure: error if explicitly enabled clear-memory is not supported - This change adds the same check for key exchange to - _libssh2_transport_send() that is in _libssh2_transport_read(). This - ensures that key exchange is completed before any data packet is sent. + This takes 22bd8d81d8fab956085e2079bf8c29872455ce59 and + b8289b625e291bbb785ed4add31f4759241067f3 into account, + but still makes it enabled by default if it is supported + and error out in case it is unsupported and was requested. -- channel_write: acknowledge transport errors +Daniel Stenberg (25 Mar 2015) +- configure: make clear-memory default but only WARN if backend unsupported - When draining data off the socket with _libssh2_transport_read() (which - in turn has to be done so that we can be sure to have read any possible - window-increasing packets), this code previously ignored errors which - could lead to nasty loops. Now all error codes except EAGAIN will cause - the error to be returned at once. + ... instead of previous ERROR. + +Marc Hoersken (24 Mar 2015) +- wincng.h: fix warning about computed return value not being used + +- nonblocking examples: fix warning about unused tvdiff on Mac OS X + +Daniel Stenberg (24 Mar 2015) +- openssl: fix compiler warnings + +- cofigure: fix --disable-clear-memory check + +Marc Hoersken (23 Mar 2015) +- scp.c: improved command length calculation - Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0068.shtml - Reported by: Matthew Booth + Reduced number of calls to strlen, because shell_quotearg already + returns the length of the resulting string (e.q. quoted path) + which we can add to the existing and known cmd_len. + Removed obsolete call to memset again, because we can put a final + NULL-byte at the end of the string using the calculated length. -- [Steven Dake brought this change] +- scp.c: improved and streamlined formatting - In examples/x11.c, Make sure sizeof passed to read operation is correct +- scp.c: fix that scp_recv may transmit not initialised memory + +- scp.c: fix that scp_send may transmit not initialised memory - sizeof(buf) expands to 8 or 4 (since its a pointer). This variable may - have been static in the past, leading to this error. + Fixes ticket 244. Thanks Torsten. + +- kex: do not ignore failure of libssh2_sha1_init() - Signed-off-by: Steven Dake + Based upon 43b730ce56f010e9d33573fcb020df49798c1ed8. + Fixes ticket 290. Thanks for the suggestion, mstrsn. -- [Steven Dake brought this change] +- wincng.h: fix return code of libssh2_md5_init() - Fix suspicious sizeof usage in examples/x11.c +- openssl.c: fix possible segfault in case EVP_DigestInit fails + +- wincng.c: fix possible use of uninitialized variables + +- wincng.c: fix unused argument warning if clear memory is not enabled + +- wincng: Added explicit clear memory feature to WinCNG backend - In the x11 example, sizeof(buf) = 8UL (on x86_64), when this should - probably represent the buffer size available. I am not sure how to - test that this change is actually correct, however. + This re-introduces the original feature proposed during + the development of the WinCNG crypto backend. It still needs + to be added to libssh2 itself and probably other backends. - Signed-off-by: Steven Dake + Memory is cleared using the function SecureZeroMemory which is + available on Windows systems, just like the WinCNG backend. -- sftp_packet_read: follow-up fix for EAGAIN/window adjust - - The commit in 7194a9bd7ba45 wasn't complete. This change makes sure - variables are initialized properly before used in the EAGAIN and window - adjust cases. +- wincng.c: fixed mixed line-endings -- sftp_packet_add: use named error code instead of number +- wincng.c: fixed use of invalid parameter types in a8d14c5dcf -- sftp_packet_add: verify the packet before accepting it +- wincng.c: only try to load keys corresponding to the algorithm + +- wincng.c: moved PEM headers into definitions + +- wincng.h: fixed invalid parameter name + +- wincng: fixed mismatch with declarations in crypto.h + +- userauth.c: fixed warning C6001: using uninitialized sig and sig_len + +- pem.c: fixed warning C6269: possible incorrect order of operations + +- wincng: add support for authentication keys to be passed in memory - In order to bail out as quickly as possible when things are wrong and - out of sync, make sure the SFTP message is one we understand. + Based upon 18cfec8336e and daa2dfa2db. -- SFTP: preserve the original error code more +- pem.c: add _libssh2_pem_parse_memory to parse PEM from memory - Lots of places in the code translated the original error into the more - generic LIBSSH2_ERROR_SOCKET_TIMEOUT but this turns out to distort the - original error reason a lot and makes tracking down the real origin of a - problem really hard. This change makes the original error code be - preserved to a larger extent when return up to the parent function. + Requirement to implement 18cfec8336e for Libgcrypt and WinCNG. -- sftp_packet_read: adjust window size as necessary +- pem.c: fix copy and paste mistake from 55d030089b8 + +- userauth.c: fix another possible dereference of a null pointer + +- userauth.c: fix possible dereference of a null pointer + +- pem.c: reduce number of calls to strlen in readline + +Alexander Lamaison (17 Mar 2015) +- [Will Cosgrove brought this change] + + Initialise HMAC_CTX in more places. - Commit 03ca9020756 tried to simplify the window sizing logic but broke - SFTP readdir as there was no window sizing code left there so large - directory listings no longer worked. + Missed a couple more places we init ctx to avoid openssl threading crash. + +- Build build breakage in WinCNG backend caused when adding libssh2_userauth_publickey_frommemory. - This change introduces window sizing logic to the sftp_packet_read() - function so that it now tells the remote about the local size having a - window size that suffice when it is about to ask for directory data. + The new feature isn't implemented for the WinCNG backend currently, but the WinCNG backend didn't contain any implementation of the required backend functions - even ones that returns an error. That caused link errors. - Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0069.shtml - Reported by: Eric + This change fixes the problem by providing an implementation of the backend functions that returns an error. -- [Steven Dake brought this change] +- Fix breakage in WinCNG backend caused by introducing libssh2_hmac_ctx_init. + + The macro was defined to nothing for the libgcrypt backend, but not for WinCNG. This brings the latter into line with the former. - Tell C compiler we don't care about return code of libssh2_init +Daniel Stenberg (15 Mar 2015) +- userauth_publickey_frommemory.3: add AVAILABILITY - The call of libssh2_init returns a return code, but nothing could be done - within the _libssh2_init_if_needed execution path. + ... it will be added in 1.6.0 + +- libssh2: next version will be called 1.6.0 - Signed-off-by: Steven Dake + ... since we just added a new function. -- [Steven Dake brought this change] +- docs: add libssh2_userauth_publickey_frommemory.3 to dist + + The function and man page were added in commit 18cfec8336e - Add comment indicating a resource leak is not really a resource leak +- [Jakob Egger brought this change] + + direct_tcpip: Fixed channel write - While possibly obvious to those investigating the code, coverity complains - about this out of scope leak. + There were 3 bugs in this loop: + 1) Started from beginning after partial writes + 2) Aborted when 0 bytes were sent + 3) Ignored LIBSSH2_ERROR_EAGAIN - Signed-off-by: Steven Dake + See also: + https://trac.libssh2.org/ticket/281 + https://trac.libssh2.org/ticket/293 -- [Steven Dake brought this change] +Alexander Lamaison (15 Mar 2015) +- [Will Cosgrove brought this change] - Use safer snprintf rather then sprintf in scp_send() + Must init HMAC_CTX before using it. - Signed-off-by: Steven Dake + Must init ctx before using it or openssl will reuse the hmac which is not thread safe and causes a crash. + Added libssh2_hmac_ctx_init macro. -- [Steven Dake brought this change] +- Add continuous integration configurations. + + Linux-based CI is done by Travis CI. Windows-based CI is done by Appveyor. - Use safer snprintf rather then sprintf in scp_recv() +- [David Calavera brought this change] + + Allow authentication keys to be passed in memory. - While the buffer is indeed allocated to a safe length, better safe then sorry. + All credits go to Joe Turpin, I'm just reaplying and cleaning his patch: + http://www.libssh2.org/mail/libssh2-devel-archive-2012-01/0015.shtml - Signed-off-by: Steven Dake + * Use an unimplemented error for extracting keys from memory with libgcrypt. -- [Steven Dake brought this change] +Daniel Stenberg (14 Mar 2015) +- docs: include the renamed INSTALL* files in dist - use snprintf in knownhost_writeline() rather then sprintf +Alexander Lamaison (13 Mar 2015) +- Prevent collisions between CMake and Autotools in examples/ and tests/. + +- Avoid clash between CMake build and Autotools. - Although the function checks the length, if the code was in error, there - could potentially be a buffer overrun with the use of sprintf. Instead replace - with snprintf. + Autotools expects a configuration template file at src/libssh2_config.h.in, which buildconf generates. But the CMake build system has its CMake-specific version of the file at this path. This means that, if you don't run buildconf, the Autotools build will fail because it configured the wrong header template. - Signed-off-by: Steven Dake - -- [Steven Dake brought this change] + See https://github.com/libssh2/libssh2/pull/8. - Add tracing to print packets left on session at libssh2_session_free +- Merge pull request #8 from alamaison/cmake - Signed-off-by: Steven Dake + CMake build system. -Peter Stuge (2 Mar 2012) -- Define and use LIBSSH2_INVALID_SOCKET instead of INVALID_SOCKET +- CMake build system. - INVALID_SOCKET is a special value in Windows representing a - non-valid socket identifier. We were #defining this to -1 on - non-Windows platforms, causing unneccessary namespace pollution. - Let's have our own identifier instead. + Tested: + - Windows: + - Visual C++ 2005/2008/2010/2012/2013/MinGW-w64 + - static/shared + - 32/64-bit + - OpenSSL/WinCNG + - Without zlib + - Linux: + - GCC 4.6.3/Clang 3.4 + - static/shared + - 32/64-bit + - OpenSSL/Libgcrypt + - With/Without zlib + - MacOS X + - AppleClang 6.0.0 + - static + - 64-bit + - OpenSSL + - Without zlib - Thanks to Matt Lawson for pointing this out. - -- nw/Makefile.netware: Fix project name typo to avoid needless confusion + Conflicts: + README -- example/x11: Set raw terminal mode manually instead of with cfmakeraw() - - OpenSolaris has no cfmakeraw() so to make the example more portable - we simply do the equivalent operations on struct termios ourselves. - - Thanks to Tom Weber for reporting this problem, and finding a solution. +- Man man syntax tests fail gracefully if man version is not suitable. -Daniel Stenberg (17 Feb 2012) -- sftp_write: cannot return acked data *and* EAGAIN +- Return valid code from test fixture on failure. - Whenever we have acked data and is about to call a function that *MAY* - return EAGAIN we must return the number now and wait to get called - again. Our API only allows data *or* EAGAIN and we must never try to get - both. + The sshd test fixture was returning -1 if an error occurred, but negative error codes aren't technically valid (google it). Bash on Windows converted them to 0 which made setup failure look as though all tests were passing. -Peter Stuge (13 Feb 2012) -- example/x11: Build only when sys/un.h is found by configure - - The example can't be built on systems without AF_UNIX sockets. +- Let mansyntax.sh work regardless of where it is called from. -Daniel Stenberg (10 Feb 2012) -- [Alexander Lamaison brought this change] +Daniel Stenberg (12 Mar 2015) +- [Viktor Szakáts brought this change] - Simplified sftp_read. + mingw build: allow to pass custom CFLAGS - Removed the total_read variable that originally must have tracked how - much data had been written to the buffer. With non-blocking reads, we - must return straight away once we have read data into the buffer so this - variable served not purpose. + Allow to pass custom `CFLAGS` options via environment variable + `LIBSSH2_CFLAG_EXTRAS`. Default and automatically added options of + `GNUmakefile` have preference over custom ones. This addition is useful + for passing f.e. custom CPU tuning or LTO optimization (`-flto + -ffat-lto-objects`) options. The only current way to do this is to edit + `GNUmakefile`. This patch makes it unnecessary. - I think it was still hanging around in case the initial processing of - 'leftover' data meant we wrote to the buffer but this case, like the - others, must return immediately. Now that it does, the last remaining - need for the variable is gone. + This is a mirror of similar libcurl patch: + https://github.com/bagder/curl/pull/136 -- [Alexander Lamaison brought this change] +- [Will Cosgrove brought this change] - Cleaned up sftp_read and added more explanation. + userauth: Fixed prompt text no longer being copied to the prompts struct - Replaced the gotos which were implementing the state machine with - a switch statement which makes the states more explicit. + Regression from 031566f9c -- sftp_read: avoid data *and* EAGAIN +- README: update the git repo locations + +- wait_socket: wrong use of difftime() - Whenever we have data and is about to call a function that *MAY* return - EAGAIN we must return the data now and wait to get called again. Our API - only allows data *or* EAGAIN and we must never try to get both. + With reversed arguments it would always return a negative value... + + Bug: https://github.com/bagder/libssh2/issues/1 -Peter Stuge (2 Feb 2012) -- Add a tcpip-forward example which demonstrates remote port forwarding +- bump: start working toward 1.5.1 now -- libssh2.h: Add missing prototype for libssh2_session_banner_set() +Version 1.5.0 (11 Mar 2015) -- example/subsystem_netconf.c: Return error when read buffer is too small - - Also remove a little redundancy in the read loop condition. +Daniel Stenberg (11 Mar 2015) +- RELEASE-NOTES: 1.5.0 release -- example/subsystem_netconf.c: Add a missing newline in an error message +- [Mariusz Ziulek brought this change] -- Fix undefined reference to _libssh_error in libgcrypt backend + kex: bail out on rubbish in the incoming packet - Commit 209de22299b4b58e582891dfba70f57e1e0492db introduced a function - call to a non-existing function, and since then the libgcrypt backend - has not been buildable. + CVE-2015-1782 + + Bug: http://www.libssh2.org/adv_20150311.html -Version 1.4.0 (31 Jan 2012) +- docs: move INSTALL, AUTHORS, HACKING and TODO to docs/ + + And with this, cleanup README to be shorter and mention the new source + code home. -Daniel Stenberg (31 Jan 2012) -- RELEASE-NOTES: synced with 6bd584d29 for 1.4.0 +- .gitignore: don't ignore INSTALL -- s/1.3.1/1.4.0 +Dan Fandrich (4 Mar 2015) +- examples/x11.c: include sys/select.h for improved portability + +Daniel Stenberg (4 Mar 2015) +- RELEASE-NOTES: synced with a8473c819bc068 - We're bumping the minor number + In preparation for the upcoming 1.5.0 release. -- [Jernej Kovacic brought this change] +Guenter Knauf (8 Jan 2015) +- NetWare build: added some missing exports. - libssh2_session_supported_algs: fix compiler warning +Marc Hoersken (29 Dec 2014) +- knownhost.c: fix use of uninitialized argument variable wrote + + Detected by clang scan in line 1195, column 18. -- [Jernej Kovacic brought this change] +- examples/x11.c: fix result of operation is garbage or undefined + + Fix use of uninitialized structure w_size_bck. + Detected by clang scan in line 386, column 28. - session_supported_algs docs: added an example +- examples/x11.c: remove dead assigments of some return values + + Detected by clang scan in line 212, column 9. + Detected by clang scan in line 222, column 13. + Detected by clang scan in line 410, column 13. -- [Gellule Xg brought this change] +- examples/x11.c: fix possible memory leak if read fails + + Detected by clang scan in line 224, column 21. - sftp-seek: clear EOF flag +- examples/x11.c: fix invalid removal of first list element - Set the EOF flag to False when calling seek64 to be able to get some - data back on a following read + Fix use of memory after it was being freed. + Detected by clang scan in line 56, column 12. -- [Peter Krempa brought this change] +- userauth.c: make sure that sp_len is positive and avoid overflows + + ... if the pointer subtraction of sp1 - pubkey - 1 resulted in a + negative or larger value than pubkey_len, memchr would fail. + + Reported by Coverity CID 89846. - userauth: Provide more informations if ssh pub key extraction fails +- channel.c: remove logically dead code, host cannot be NULL here - If the function that extracts/computes the public key from a private key - fails the errors it reports were masked by the function calling it. This - patch modifies the key extraction function to return errors using - _libssh_error() function. The error messages are tweaked to contain - reference to the failed operaton in addition to the reason. + ... host cannot be NULL in line 525, because it is always + valid (e.g. at least set to "0.0.0.0") after lines 430 and 431. - * AUTHORS: - add my name - * libgcrypt.c: _libssh2_pub_priv_keyfile(): - return a more verbose - error using - _libssh2_error() func. - * openssl.c: - modify call graph of _libssh2_pub_priv_keyfile() to use - _libssh2_error for error reporting(); - * userauth.c: - tweak functions calling _libssh2_pub_priv_keyfile() not - to shadow error messages + Reported by Coverity CID 89807. -- TODO: remove issues we (sort of) did already +- session.c: check return value of session_nonblock during startup + + Reported by Coverity CID 89803. -- ssh2_exec: skip error outputs for EAGAIN +- session.c: check return value of session_nonblock in debug mode - Since the example uses non-blocking mode, it will just flood the output - with this "nonsense" error. + Reported by Coverity CID 89805. -Guenter Knauf (30 Nov 2011) -- Some NetWare makefile tweaks. +- pem.c: fix mixed line-endings introduced with 8670f5da24 -Daniel Stenberg (18 Nov 2011) -- LIBSSH2_SFTP_PACKET_MAXLEN: increase to 80000 +- pem.c: make sure there's a trailing zero and b64data is not NULL - Some SFTP servers send SFTP packets larger than 40000. Since the limit - is only present to avoid insane sizes anyway, we can easily bump it. + ... if there is no base64 data between PEM header and footer. + Reported by Coverity CID 89823. + +- kex.c: make sure mlist is not set to NULL - The define was formerly in the public header libssh2_sftp.h but served - no external purpose and was moved into the source dir. + ... if the currently unsupported LANG methods are called. + Reported by Coverity CID 89834. + +- packet.c: i < 256 was always true and i would overflow to 0 - Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2011-11/0004.shtml - Reported by: Michael Harris + Visualize that the 0-termination is intentional, because the array + is later passed to strlen within _libssh2_packet_askv. -Alexander Lamaison (18 Nov 2011) -- [Peter Krempa brought this change] +- silence multiple data conversion warnings - knownhost_check(): Don't dereference ext if NULL is passed - - Documentation for libssh2_knownhost_checkp() and related functions - states that the last argument is filled with data if non-NULL. +Daniel Stenberg (23 Dec 2014) +- agent_connect_unix: make sure there's a trailing zero - "knownhost if set to non-NULL, it must be a pointer to a 'struct - libssh2_knownhost' pointer that gets filled in to point to info about a - known host that matches or partially matches." + ... if the path name was too long. Reported by Coverity CID 89801. + +Marc Hoersken (22 Dec 2014) +- examples on Windows: use native SOCKET-type instead of int - In this function ext is dereferenced even if set to NULL, causing - segfault in applications not needing the extra data. + And check return values accordingly. -Daniel Stenberg (11 Nov 2011) -- [Peter Krempa brought this change] +- userauth.c: improve readability and clarity of for-loops - knownhost_add: Avoid dereferencing uninitialized memory on error path. - - In function knownhost_add, memory is alocated for a new entry. If normal - alocation is used, memory is not initialized to 0 right after, but a - check is done to verify if correct key type is passed. This test is done - BEFORE setting the memory to null, and on the error path function - free_host() is called, that tries to dereference unititialized memory, - resulting into a glibc abort(). +Daniel Stenberg (22 Dec 2014) +- calloc: introduce LIBSSH2_CALLOC() - * knownhost.c - knownhost_add(): - move typemask check before alloc + A simple function using LIBSSH2_ALLOC + memset, since this pattern was + used in multiple places and this simplies code in general. -- windows build: add define to avoid compiler warning - - A recent mingw compiler has started to complain on "#warning Please - include winsock2.h before windows.h" unless the magic define is set - first. - - Reported by: Vincent Torri - Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2011-10/0064.shtml +Marc Hoersken (15 Dec 2014) +- libssh2_priv.h: Ignore session, context and format parameters -Henrik Nordstrom (31 Oct 2011) -- [Vincent Torri brought this change] +- x11 example: check return value of socket function - Correct Windows include file name case, simplifying cross-compilation - - When cross compiling to Windows, libssh2.h include Windows header files - with upper case filenames : BaseTsd.h and WinSock2.h. +- examples: fixed mixed line-endings introduced with aedfba25b8 + +- wincng.c: explicitly ignore BCrypt*AlgorithmProvider return codes - These files have lowercase names with mingw-w64 (iirc, it's the same with - mingw). And as on Windows, being lowercase or uppercase does not matter. + Fixes VS2012 code analysis warning C6031: + return value ignored: could return unexpected value -Daniel Stenberg (25 Oct 2011) -- [Jernej Kovacic brought this change] +- wincng.c: fix possible invalid memory write access + + Fixes VS2012 code analysis warning C6386: + buffer overrun: accessing 'pbOutput', the writable size is + 'cbOutput' bytes, but '3' bytes may be written: libssh2 wincng.c 610 - libssh2_session_supported_algs: added +- tests on Windows: check for WSAStartup return code + + Fixes VS2012 code analysis warning C6031: + return value ignored: could return unexpected value -- [Kamil Dudka brought this change] +- wincng.c: fix possible NULL pointer de-reference of bignum + + Fixes VS2012 code analysis warning C6011: + dereferencing NULL pointer 'bignum'. libssh2 wincng.c 1567 - example/sftp_RW_nonblock: do not ignore LIBSSH2_ERROR_EAGAIN +- wincng.c: fix possible use of uninitialized memory - Bug: https://bugzilla.redhat.com/745420 + Fixes VS2012 code analysis warning C6001: + using uninitialized memory 'cbDecoded'. libssh2 wincng.c 553 -Peter Stuge (5 Oct 2011) -- example/ssh2_agent: Print host key fingerprint before authentication +- packet.c: fix possible NULL pointer de-reference within listen_state - Also moves the comment about not being authenticated to before the - agent authentication takes place, so that it better matches the code. + Fixes VS2012 code analysis warning C6011: + dereferencing NULL pointer 'listen_state->channel'. libssh2 packet.c 221 -Daniel Stenberg (29 Sep 2011) -- OpenSSL EVP: fix threaded use of structs +- kex.c: fix possible NULL pointer de-reference with session->kex - Make sure we don't clear or reset static structs after first init so - that they work fine even when used from multiple threads. Init the - structs in the global init. + Fixes VS2012 code analysis warning C6011: + dereferencing NULL pointer 'session->kex'. libssh2 kex.c 1761 + +- agent.c: check return code of MapViewOfFile - Help and assistance by: John Engstrom + Fixes VS2012 code analysis warning C6387: 'p+4' may be '0': + this does not adhere to the specification for the function + 'memcpy': libssh2 agent.c 330 - Fixes #229 (again) + Fixes VS2012 code analysis warning C6387: 'p' may be '0': + this does not adhere to the specification for the function + 'UnmapViewOfFile': libssh2 agent.c 333 -- openssl: don't init static structs differently +- examples on Windows: check for socket return code - make_ctr_evp() is changed to take a struct pointer, and then each - _libssh2_EVP_aes_[keylen]_ctr function is made to pass in their own - static struct + Fixes VS2012 code analysis warning C28193: + The variable holds a value that must be examined + +- examples on Windows: check for WSAStartup return code - Reported by: John Engstrom - Fixes #229 + Fixes VS2012 code analysis warning C6031: + return value ignored: could return unexpected value -Guenter Knauf (27 Sep 2011) -- Removed obsolete include path. +Guenter Knauf (11 Dec 2014) +- wincng.c: silent some more gcc compiler warnings. -Daniel Stenberg (21 Sep 2011) -- read_state: clear the state variable better +- wincng.c: silent gcc compiler warnings. + +- Watcom build: added support for WinCNG build. + +- build: updated dependencies in makefiles. + +Daniel Stenberg (4 Dec 2014) +- configure: change LIBS not LDFLAGS when checking for libs - Set read_state back to idle before trying to send anything so that if - the state somehow is wrongly set. + Closes #289 - Also, avoid such a case of confusion by resetting the read_state when an - sftp handle is closed. + Patch-by: maurerpe -- sftp_read: remove leftover fprintf +Guenter Knauf (3 Dec 2014) +- MinGW build: some more GNUMakefile tweaks. - Reported by: Alexander Lamaison - -- sftp.h: fix the #ifdef to prevent multiple inclusions + test/GNUmakefile: added architecture autodetection; added switches to + CFLAGS and RCFLAGS to make sure that the right architecture is used. + Added support to build with WinCNG. -- sftp_read: use a state variable to avoid bad writes +- sftpdir.c: added authentication method detection. - When a channel_write call has gotten an EAGAIN back, we try harder to - continue the same write in the subsequent invoke. + Stuff copied over from ssh2.c to make testing a bit easier. -- window_size: explicit adjustments only - - Removed the automatic window_size adjustments from - _libssh2_channel_read() and instead all channel readers must now make - sure to enlarge the window sizes properly themselves. +- NMake build: fixed LIBS settings. + +- NMake build: added support for WinCNG build. + +- MinGW build: some GNUMakefile tweaks. - libssh2_channel_read_ex() - the public function, now grows the window - size according to the requested buffer size. Applications can still opt - to grow the window more on demand. Larger windows tend to give higher - performance. + Added architecture autodetection; added switches to CFLAGS and + RCFLAGS to make sure that the right architecture is used. + Added support to build with WinCNG. + +- MinGW build: Fixed redefine warnings. + +- Updated copyright year. + +Daniel Stenberg (31 Aug 2014) +- COPYING: bump the copyright year + +Dan Fandrich (28 Jul 2014) +- docs: fixed a bunch of typos + +- docs: added missing libssh2_session_handshake.3 file + +Marc Hoersken (19 May 2014) +- wincng.c: specify the required libraries for dependencies using MSVC - sftp_read() now uses the read-ahead logic to figure out a window_size. + Initially reported by Bob Kast as "for MS VS builds, specify the + libraries that are required so they don't need to go into all + project files that may use this library". Thanks a lot. -- libssh2.h: bump the default window size to 256K +- [Bob Kast brought this change] -- libssh2_userauth_keyboard_interactive.3: fix man warning + windows build: do not export externals from static library - It seemed to occur due to the excessive line length + If you are building a DLL, then you need to explicitly export each + entry point. When building a static library, you should not. + + libssh2 was exporting the entry points whether it was building a DLL or a + static library. To elaborate further, if libssh2 was used as a static + library, which was being linked into a DLL, the libssh2 API would be + exported from that separate DLL. +Daniel Stenberg (19 May 2014) - [Mikhail Gusarov brought this change] - Add missing .gitignore entries + Fix typos in manpages -- [Mikhail Gusarov brought this change] +Marc Hoersken (18 May 2014) +- wincng.c: Fixed memory leak in case of an error during ASN.1 decoding - Add manpage syntax checker to 'check' target +- configure: Display individual crypto backends on separate lines - In virtually every libssh2 release Debian's lintian catches syntax errors in - manpages. Prevent it by checking manpages as a part of testsuite. + This avoids line-wrapping in between parameters and makes the + error message look like the following: + + configure: error: No crypto library found! + Try --with-libssl-prefix=PATH + or --with-libgcrypt-prefix=PATH + or --with-wincng on Windows -- libssh2_banner_set.3: fix nroff syntax mistake +- [Bob Kast brought this change] -Guenter Knauf (10 Sep 2011) -- Use predefined resource compiler macro. + libssh2_priv.h: a 1 bit bit-field should be unsigned + + some compilers may not like this -- Added casts to silent compiler warnings. +- knownhost.c: Fixed warning that pointer targets differ in signedness -- Fixed uint64_t printf. +- wincng.c: Fixed warning about pointer targets differing in signedness -- Fixed macro function signatures. +- tcpip-forward.c: Fixed warning that pointer targets differ in signedness + + libssh2_channel_forward_listen_ex uses ints instead of unsigned ints. -- NetWare makefile tweaks. +- misc.c: Fixed warning about mixed declarations and code -- Removed unused var. +- libgcrypt.h: Fixed warning about pointer targets differing in signedness -- Added 2 samples not mentioned. +- wincng.h: Fixed warning about pointer targets differing in signedness -- Dont build x11 sample with MinGW. +- misc.c: Fixed warning about unused parameter abstract -- Fixed executable file description. +- tcpip-forward.c: Removed unused variables shost, sport and sockopt -- Removed unused var. +- wincng.h: Added forward declarations for all WinCNG functions + + Initially reported by Bob Kast as "Wincng - define function + prototypes for wincng routines". Thanks a lot. + + Also replaced structure definitions with type definitions. -- Kill stupid gcc 3.x uninitialized warning. +- [Bob Kast brought this change] -- Build all examples. + libssh2.h: on Windows, a socket is of type SOCKET, not int -- More MinGW makefile tweaks. +- win32: Added WinCNG targets to generated Visual Studio project - Renamed *.mingw makefiles to GNUmakefile since GNU make picks these - up automatically, and therefore win32/Makefile removed. - -- Removed forgotten WINSOCK_VERSION defines. - -Daniel Stenberg (9 Sep 2011) -- libssh2_session_startup(3) => libssh2_session_handshake(3) + Inspired by Bob Kast's reports, this commit enables the compilation + of libssh2 with WinCNG using the generated Visual Studio project files. + This commit adds WinCNG support to parts of the existing Win32 build + infrastructure, until new build systems, like pre-defined VS project + files or CMake files may be added. - Propagate for the current function in docs and examples. - libssh2_session_startup() is deprecated. + This commit and b20bfeb3e519119a48509a1099c06d65aa7da1d7 raise one + question: How to handle build systems, like VS project files, that + need to include all source files regardless of the desired target, + including all supported crypto backends? For now the mentioned commit + added a check for LIBSSH2_OPENSSL to openssl.c and with this commit + the supported crypto backends are hardcoded within Makefile.am. -- libssh2_banner_set => libssh2_session_banner_get +- libssh2_priv msvc: Removed redundant definition of inline keyword - Marked the old function as deprecated. Added the new name in the correct - name space with the same arguments and functionality. + Initially reported by Bob Kast as "Remove redundant 'inline' define". + Thanks a lot. -- new function: libssh2_session_banner_get +- wincng: Made data parameter to hash update function constant - Returns the banner from the server handshake - - Fixes #226 - -- libssh2.h: bump version to 1.4.0 for new function(s) + Initially reported by Bob Kast as "formal parameter must be const + since it is used in contexts where the actual parameter may be const". + Thanks a lot. -- remove embedded CVS/svn tags +- wincng: fix cross-compilation against the w64 mingw-runtime package -- [liuzl brought this change] +- openssl: Check for LIBSSH2_OPENSSL in order to compile with openssl - API add:libssh2_sftp_get_channel +- wincng: Fixed use of possible uninitialized variable pPaddingInfo - Return the channel of sftp, then caller can - control the channel's behavior. - - Signed-off-by: liuzl + Reported by Bob Kast, thanks a lot. -- _libssh2_channel_read: react on errors from receive_window_adjust - - Previously the function would ignore all errors except for EAGAIN. +- wincng: Added cast for double to unsigned long conversion -- sftp_read: extend and clarify the documentation +- wincng: Cleaned up includes and check NTSTATUS using macro + + Removed header file combination that is not supported on a real + Windows platform and can only be compiled using MinGW. Replaced + custom NTSTATUS return code checks with BCRYPT_SUCCESS macro. -- sftp_read: cap the read ahead maximum amount +Daniel Stenberg (16 Mar 2014) +- userauth_hostbased_fromfile: zero assign to avoid uninitialized use - Now we only go up to LIBSSH2_CHANNEL_WINDOW_DEFAULT*30 bytes SFTP read - ahead, which currently equals 64K*30 == 1966080 bytes. + Detected by clang-analyze -- _libssh2_channel_read: fix non-blocking window adjusting +- channel_receive_window_adjust: store windows size always - If EAGAIN is returned when adjusting the receive window, we must not - read from the transport directly until we've finished the adjusting. + Avoid it sometimes returning without storing it, leaving calling + functions with unknown content! + + Detected by clang-analyzer -Guenter Knauf (8 Sep 2011) -- Fix for systems which need sys/select.h. +- publickey_packet_receive: avoid junk in returned pointers + + clang-analyzer found this risk it would return a non-initialized pointer + in a success case -- The files were not gone but renamed ... +Peter Stuge (16 Mar 2014) +- [Marc Hoersken brought this change] -Daniel Stenberg (6 Sep 2011) -- sftp_read: added documenting comment - - Taken from some recent email conversations I added some descriptions of - the logic in sftp_read() to aid readers. + Added Windows Cryptography API: Next Generation based backend -- 1.3.1: start the work +- [Marc Hoersken brought this change] -Version 1.3.0 (6 Sep 2011) + knownhost.c: fixed that 'key_type_len' may be used uninitialized + + ../src/knownhost.c: In function 'libssh2_knownhost_readline': + ../src/knownhost.c:651:16: warning: 'key_type_len' may be used + uninitialized in this function [-Wmaybe-uninitialized] + rc = knownhost_add(hosts, hostbuf, NULL, + ^ + ../src/knownhost.c:745:12: note: 'key_type_len' was declared here + size_t key_type_len; + ^ -Daniel Stenberg (6 Sep 2011) -- Makefile.am: the Makefile.win32 files are gone +- [Marc Hoersken brought this change] -- RELEASE-NOTES: updated for 1.3.0 + pem.c: always compile pem.c independently of crypto backend -- sftp_read: a short read is not end of file +- Fix non-autotools builds: Always define the LIBSSH2_OPENSSL CPP macro - A returned READ packet that is short will now only reduce the - offset. + Commit d512b25f69a1b6778881f6b4b5ff9cfc6023be42 introduced a crypto + library abstraction in the autotools build system, to allow us to more + easily support new crypto libraries. In that process it was found that + all other build system which we support are hard-coded to build with + OpenSSL. Commit f5c1a0d98bd51aeb24aca3d49c7c81dcf8bd858d fixes automake + introduced into non-autotools build systems but still overlooked the + CPP macro saying that we are using OpenSSL. - This is a temporary fix as it is slightly better than the previous - approach but still not very good. + Thanks to Marc Hörsken for identifying this issue and proposing a fix + for win32/{GNUmakefile,config.mk}. This commit uses a slightly different + approach but the end result is the same. -- [liuzl brought this change] +Dan Fandrich (15 Mar 2014) +- channel_close: Close the channel even in the case of errors - _libssh2_packet_add: adjust window size when truncating +- sftp_close_handle: ensure the handle is always closed - When receiving more data than what the window size allows on a - particular channel, make sure that the window size is adjusted in that - case too. Previously it would only adjust the window in the non-error - case. - -Guenter Knauf (29 Aug 2011) -- Silent compiler warning with MinGW64. + Errors are reported on return, but otherwise the close path is + completed as much as possible and the handle is freed on exit. -- Fixed link to native Win32 awk tool. +Alexander Lamaison (6 Mar 2014) +- knownhost: Restore behaviour of `libssh2_knownhost_writeline` with short buffer. + + Commit 85c6627c changed the behaviour of `libssh2_knownhost_writeline` so that it stopped returning the number of bytes needed when the given buffer was too small. Also, the function changed such that is might write to part of the buffer before realising it is too small. + + This commit restores the original behaviour, whilst keeping the unknown-key-type functionality that 85c6627c. Instead of writing to the buffer piecemeal, the length of the various parts is calculated up front and the buffer written only if there is enough space. The calculated necessary size is output in `outlen` regardless of whether the buffer was written to. + + The main use-case for the original behaviour that this commit restores is to allow passing in a NULL buffer to get the actual buffer size needed, before calling the function again with the buffer allocated to the exact size required. -- Renamed MinGW makefiles. +- knownhost: Fix DSS keys being detected as unknown. + + I missing `else` meant ssh-dss format keys were being re-detected as unknown format. -- Some MinGW makefile tweaks. +Dan Fandrich (6 Mar 2014) +- knownhosts: Abort if the hosts buffer is too small - Enable build without GNU tools and with MinGW64 compiler. + This could otherwise cause a match on the wrong host -- Fixed aes_ctr_do_cipher() signature. +- agent_list_identities: Fixed memory leak on OOM -Daniel Stenberg (26 Aug 2011) -- [liuzl brought this change] +- Fixed a few typos - libssh2_sftp_seek64: flush packetlist and buffered data +- userauth: Fixed an attempt to free from stack on error + +- Fixed a few memory leaks in error paths + +- Fixed two potential use-after-frees of the payload buffer - When seeking to a new position, flush the packetlist and buffered data - to prevent already received or pending data to wrongly get used when - sftp-reading from the new offset within the file. + The first might occur if _libssh2_packet_add returns an error, as + fullpacket_state wasn't reset to idle so if it were possible for + fullpacket to be called again, it would return to the same state + handler and re-use the freed p->packet buffer. + + The second could occur if decrypt returned an error, as it freed the + packet buffer but did not clear total_num, meaning that freed buffer + could be written into again later. -- sftp_read: advance offset correctly for buffered copies +Alexander Lamaison (28 Nov 2013) +- Fix missing `_libssh2_error` in `_libssh2_channel_write`. - In the case where a read packet has been received from the server, but - the entire contents couldn't be copied to the user-buffer, the data is - instead buffered and copied to the user's buffer in the next invocation - of sftp_read(). When that "extra" copy is made, the 'offset' pointer was - not advanced accordingly. + In one case, the error code from `_libssh2_transport_read` was being returned from `_libssh2_channel_write` without setting it as the last error by calling `_libssh2_error`. This commit fixes that. - The biggest impact of this flaw was that the 'already' variable at the - top of the function that figures out how much data "ahead" that has - already been asked for would slowly go more and more out of sync, which - could lead to the file not being read all the way to the end. + Found when using a session whose socket had been inadvertently destroyed. The calling code got confused because via `libssh2_session_last_error` it appeared no error had occurred, despite one being returned from the previous function. + +Kamil Dudka (21 Nov 2013) +- [Mark McPherson brought this change] + + openssl: initialise the digest context before calling EVP_DigestInit() - This problem was most noticable in cases where the application would - only try to read the exact file size amount, like curl does. In the - examples libssh2 provides the sftp read function is most often called - with a fixed size large buffer and then the bug would not appear as - easily. + When using the OpenSSL libraries in FIPS mode, the function call + EVP_DigestInit() is actually #defined to FIPS_digestinit(). + Unfortunately wheres EVP_DigestInit() initialises the context and then + calls EVP_DigestInit_ex(), this function assumes that the context has + been pre-initialised and crashes when it isn't. - This bug was introduced in the SFTP rewrite in 1.2.8. + Bug: https://trac.libssh2.org/ticket/279 - Bug: http://curl.haxx.se/mail/lib-2011-08/0305.html - http://www.libssh2.org/mail/libssh2-devel-archive-2011-08/0085.shtml + Fixes #279 -- wrap some long lines < 80 columns +- [Marc Hörsken brought this change] -- LIBSSH2_RECV: fix typo, use the RECV_FD macro + .gitignore: Ignore files like src/libssh2_config.h.in~ -- subsystem_netconf.c: fix compiler warnings +Peter Stuge (13 Nov 2013) +- Move automake conditionals added by commit d512b25f out of Makefile.inc + + Commit d512b25f69a1b6778881f6b4b5ff9cfc6023be42 added automake + conditionals to Makefile.inc but since Makefile.inc is included + from Makefile for all other build systems that does not work. + + This commit instead adds Makefile.OpenSSL.inc and Makefile.libgcrypt.inc + and moves the automake conditional to its proper place, src/Makefile.am. + + The automake conditional includes the correct Makefile.$name.inc per + the crypto library selection/detection done by configure. + + All non-autotools build system files in libssh2 are hardcoded to use + OpenSSL and do not get a conditional but at least there is some reuse + because they can all include the new Makefile.OpenSSL.inc. -- [Henrik Nordstrom brought this change] +Daniel Stenberg (27 Oct 2013) +- [Salvador Fandino brought this change] - Custom callbacks for performing low level socket I/O + Set default window size to 2MB + + The default channel window size used until now was 256KB. This value is + too small and results on a bottleneck on real-life networks where + round-trip delays can easily reach 300ms. + + The issue was not visible because the configured channel window size + was being ignored and a hard-coded value of ~22MB being used instead, + but that was fixed on a previous commit. + + This patch just changes the default window size + (LIBSSH2_CHANNEL_WINDOW_DEFAULT) to 2MB. It is the same value used by + OpenSSH and in our opinion represents a good compromise between memory + used and transfer speed. + + Performance tests were run to determine the optimum value. The details + and related discussion are available from the following thread on the + libssh2 mailing-list: + + http://www.libssh2.org/mail/libssh2-devel-archive-2013-10/0018.shtml + http://article.gmane.org/gmane.network.ssh.libssh2.devel/6543 + + An excerpt follows: + + "I have been running some transfer test and measuring their speed. + + My setup was composed of a quad-core Linux machine running Ubuntu 13.10 + x86_64 with a LXC container inside. The data transfers were performed + from the container to the host (never crossing through a physical + network device). + + Network delays were simulated using the tc tool. And ping was used to + verify that they worked as intended during the tests. + + The operation performed was the equivalent to the following ssh command: + + $ ssh container "dd bs=16K count=8K if=/dev/zero" >/dev/null + + Though, establishment and closing of the SSH connection was excluded + from the timings. + + I run the tests several times transferring files of sizes up to 128MB + and the results were consistent between runs. + + The results corresponding to the 128MB transfer are available here: + + https://docs.google.com/spreadsheet/ccc?key=0Ao1yRmX6PQQzdG5wSFlrZl9HRWNET3ZyN0hnaGo5ZFE&usp=sharing + + It clearly shows that 256KB is too small as the default window size. + Moving to a 512MB generates a great improvement and after the 1MB mark + the returns rapidly diminish. Other factors (TCP window size, probably) + become more limiting than the channel window size + + For comparison I also performed the same transfers using OpenSSH. Its + speed is usually on par with that of libssh2 using a window size of 1MB + (even if it uses a 2MB window, maybe it is less aggressive sending the + window adjust msgs)." + + Signed-off-by: Salvador Fandino -- version bump: start working towards 1.3.0 +- [Salvador brought this change] -Version 1.2.9 (16 Aug 2011) + _libssh2_channel_read: Honour window_size_initial + + _libssh2_channel_read was using an arbitrary hard-coded limit to trigger + the window adjusting code. The adjustment used was also hard-coded and + arbitrary, 15MB actually, which would limit the usability of libssh2 on + systems with little RAM. + + This patch, uses the window_size parameter passed to + libssh2_channel_open_ex (stored as remote.window_size_initial) plus the + buflen as the base for the trigger and the adjustment calculation. + + The memory usage when using the default window size is reduced from 22MB + to 256KB per channel (actually, if compression is used, these numbers + should be incremented by ~50% to account for the errors between the + decompressed packet sizes and the predicted sizes). + + My tests indicate that this change does not impact the performance of + transfers across localhost or a LAN, being it on par with that of + OpenSSH. On the other hand, it will probably slow down transfers on + networks with high bandwidth*delay when the default window size + (LIBSSH2_CHANNEL_WINDOW_DEFAULT=256KB) is used. + + Signed-off-by: Salvador Fandino -Daniel Stenberg (16 Aug 2011) -- RELEASE-NOTES: synced with 95d69d3a81261 +- [Salvador Fandino brought this change] -- [Henrik Nordstrom brought this change] + knownhosts: handle unknown key types + + Store but don't use keys of unsupported types on the known_hosts file. + + Currently, when libssh2 parses a known_host file containing keys of some + type it doesn't natively support, it stops reading the file and returns + an error. + + That means, that the known_host file can not be safely shared with other + software supporting other key types (i.e. OpenSSH). + + This patch adds support for handling keys of unknown type. It can read + and write them, even if they are never going to be matched. + + At the source level the patch does the following things: + + - add a new unknown key type LIBSSH2_KNOWNHOST_KEY_UNKNOWN + + - add a new slot (key_type_name) on the known_host struct that is + used to store the key type in ascii form when it is not supported + + - parse correctly known_hosts entries with unknown key types and + populate the key_type_name slot + + - print correctly known_hosts entries of unknown type + + - when checking a host key ignore keys that do not match the key + + Fixes #276 - Document prototypes for macro defined functions +- windows build: fix build errors + + Fixes various link errors with VS2010 + + Reported-by: "kdekker" + Fixes #272 -- [Henrik Nordstrom brought this change] +- man page: add missing function argument + + for libssh2_userauth_publickey_fromfile_ex() + + Reported-by: "pastey" + + Fixes #262 - Avoid reuse after free when closing X11 channels +- [Salvador brought this change] -- _libssh2_channel_write: handle window_size == 0 better + Fix zlib deflate usage - When about to send data on the channel and the window size is 0, we must - not just return 0 if the transport_read() function returned EAGAIN as it - then causes a busy-loop. + Deflate may return Z_OK even when not all data has been compressed + if the output buffer becomes full. - Bug: http://libssh2.org/mail/libssh2-devel-archive-2011-08/0011.shtml - -- gettimeofday: fix name space pollution + In practice this is very unlikely to happen because the output buffer + size is always some KBs larger than the size of the data passed for + compression from the upper layers and I think that zlib never expands + the data so much, even on the worst cases. - For systems without its own gettimeofday() implementation, we still must - not provide one outside our namespace. + Anyway, this patch plays on the safe side checking that the output + buffer is not exhausted. - Reported by: Bill Segall - -Dan Fandrich (5 Aug 2011) -- libssh2.pc.in: Fixed spelling in pkgconfig file + Signed-off-by: Salvador -Peter Stuge (17 Jul 2011) -- example/subsystem_netconf.c: Add missing #include +- [Salvador brought this change] -- example/subsystem_netconf.c: Discard ]]>]]> and return only XML response + comp_method_zlib_decomp: Improve buffer growing algorithm + + The old algorithm was O(N^2), causing lots and lots of reallocations + when highly compressed data was transferred. + + This patch implements a simpler one that just doubles the buffer size + everytime it is exhausted. It results in O(N) complexity. + + Also a smaller inflate ratio is used to calculate the initial size (x4). + + Signed-off-by: Salvador -- example/subsystem_netconf.c: Fix uninitialized variable bug +- [Salvador brought this change] -- example: Add subsystem_netconf.c + Fix zlib usage - This example demonstrates how to use libssh2 to send a request to - the NETCONF subsystem available e.g. in JunOS. + Data may remain in zlib internal buffers when inflate() returns Z_OK + and avail_out == 0. In that case, inflate has to be called again. - See also http://tools.ietf.org/html/draft-ietf-netconf-ssh-06 + Also, once all the data has been inflated, it returns Z_BUF_ERROR to + signal that the input buffer has been exhausted. + + Until now, the way to detect that a packet payload had been completely + decompressed was to check that no data remained on the input buffer + but that didn't account for the case where data remained on the internal + zlib buffers. + + That resulted in packets not being completely decompressed and the + missing data reappearing on the next packet, though the bug was masked + by the buffer allocation algorithm most of the time and only manifested + when transferring highly compressible data. + + This patch fixes the zlib usage. + + Signed-off-by: Salvador -Daniel Stenberg (16 Jul 2011) -- man page cleanups: non-existing functions need no man pages +- [Salvador brought this change] -- libssh2_new_host_entry.3: removed + _libssh2_channel_read: fix data drop when out of window - This is just junk leftovers. + After filling the read buffer with data from the read queue, when the + window size was too small, "libssh2_channel_receive_window_adjust" was + called to increase it. In non-blocking mode that function could return + EAGAIN and, in that case, the EAGAIN was propagated upwards and the data + already read on the buffer lost. + + The function was also moving between the two read states + "libssh2_NB_state_idle" and "libssh2_NB_state_created" both of which + behave in the same way (excepting a debug statment). + + This commit modifies "_libssh2_channel_read" so that the + "libssh2_channel_receive_window_adjust" call is performed first (when + required) and if everything goes well, then it reads the data from the + queued packets into the read buffer. + + It also removes the useless "libssh2_NB_state_created" read state. + + Some rotted comments have also been updated. + + Signed-off-by: Salvador -- userauth_keyboard_interactive: fix buffer overflow +- [Salvador Fandino brought this change] + + window_size: redid window handling for flow control reasons - Partly reverse 566894494b4972ae12 which was simplifying the code far too - much and ended up overflowing a buffer within the LIBSSH2_SESSION - struct. Back to allocating the buffer properly like it used to do. + Until now, the window size (channel->remote.window_size) was being + updated just after receiving the packet from the transport layer. - Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2011-06/0032.shtml - Reported by: Alfred Gebert + That behaviour is wrong because the channel queue may grow uncontrolled + when data arrives from the network faster that the upper layer consumes + it. + + This patch adds a new counter, read_avail, which keeps a count of the + bytes available from the packet queue for reading. Also, now the window + size is adjusted when the data is actually read by an upper layer. + + That way, if the upper layer stops reading data, the window will + eventually fill and the remote host will stop sending data. When the + upper layers reads enough data, a window adjust packet is delivered and + the transfer resumes. + + The read_avail counter is used to detect the situation when the remote + server tries to send data surpassing the window size. In that case, the + extra data is discarded. + + Signed-off-by: Salvador -- keyboard-interactive man page: cleaned up +Peter Stuge (15 Sep 2013) +- configure.ac: Call zlib zlib and not libz in text but keep option names -- [Alfred Gebert brought this change] +- configure.ac: Reorder --with-* options in --help output - _libssh2_recv(): handle ENOENT error as EAGAIN - - A sftp session failed with error "failure establishing ssh session" on - Solaris and HP-UX. Sometimes the first recv() function call sets errno - to ENOENT. In the man pages for recv of Solaris and HP-UX the error - ENOENT is not documented. +- configure.ac: Rework crypto library detection - I tested Solaris SPARC and x86, HP-UX i64, AIX, Windows and Linux. + This further simplifies adding new crypto libraries. -- agent_list_identities: fix out of scope access +- Clean up crypto library abstraction in build system and source code - An auto variable out of scope was being referenced and used. + libssh2 used to explicitly check for libgcrypt and default to OpenSSL. - fixes #220 + Now all possible crypto libraries are checked for explicitly, making + the addition of further crypto libraries both simpler and cleaner. -- _libssh2_wait_socket: fix timeouts for poll() uses +- configure.ac: Add zlib to Requires.private in libssh2.pc if using zlib -- windows: inclusion fix +- Revert "Added Windows Cryptography API: Next Generation based backend" - include winsock2.h for all windows compilers + This reverts commit d385230e15715e67796f16f3e65fd899f21a638b. -- keyb-interactive: add the fixed buffer - - Belongs to commit 5668944 +Daniel Stenberg (7 Sep 2013) +- [Leif Salomonsson brought this change] -- code cleanup: don't use C99/c++ comments + sftp_statvfs: fix for servers not supporting statfvs extension - We aim for C89 compliance + Fixes issue arising when server does not support statfvs and or fstatvfs + extensions. sftp_statvfs() and sftp_fstatvfs() after this patch will + handle the case when SSH_FXP_STATUS is returned from server. -- keyb-interactive: allow zero length fields +- [Marc Hoersken brought this change] + + Added Windows Cryptography API: Next Generation based backend + +- [Kamil Dudka brought this change] + + partially revert "window_size: explicit adjustments only" - Allow zero length fields so they don't cause malloc(0) calls + This partially reverts commit 03ca9020756a4e16f0294e5b35e9826ee6af2364 + in order to fix extreme slowdown when uploading to localhost via SFTP. - Avoid free()ing NULL pointers + I was able to repeat the issue on RHEL-7 on localhost only. It did not + occur when uploading via network and it did not occur on a RHEL-6 box + with the same version of libssh2. - Avoid a malloc of a fixed 5 byte buffer. + The problem was that sftp_read() used a read-ahead logic to figure out + the window_size, but sftp_packet_read() called indirectly from + sftp_write() did not use any read-ahead logic. -- libssh2_channel_process_startup.3: clean up +- _libssh2_channel_write: client spins on write when window full - Remove the references to the macro-fied shortcuts as they have their own - individual man pages. + When there's no window to "write to", there's no point in waiting for + the socket to become writable since it most likely just will continue to + be. - Made the prototype different and more readable. + Patch-by: ncm + Fixes #258 -- man page: fix .BR lines +- _libssh2_channel_forward_cancel: avoid memory leaks on error - We don't use \fI etc on .BR lines + Fixes #257 -- userauth_keyboard_interactive: skip code on zero length auth +- _libssh2_packet_add: avoid using uninitialized memory + + In _libssh2_packet_add, called by _libssh2_packet_read, a call to + _libssh2_packet_send that is supposed to send a one-byte message + SSH_MSG_REQUEST_FAILURE would send an uninitialized byte upon re-entry + if its call to _send returns _EAGAIN. + + Fixes #259 -- libssh2_channel_forward_accept.3: mention how to get error +- _libssh2_channel_forward_cancel: accessed struct after free - Since this returns a pointer, libssh2_session_last_errno() must be used - to get the actual error code and it wasn't that clear before. + ... and the assignment was pointless anyway since the struct was about + to be freed. Bug introduced in dde2b094. + + Fixes #268 -- timeout docs: mention they're added in 1.2.9 +Peter Stuge (2 Jun 2013) +- [Marc Hoersken brought this change] -- sftp_write_sliding.c: indent fix - - Use the standard indenting and removed CVS leftover comment + Fixed compilation using mingw-w64 -- [zl liu brought this change] +- [Marc Hoersken brought this change] - sftp_write_sliding: send the complete file + knownhost.c: use LIBSSH2_FREE macro instead of free - When reaching the end of file there can still be data left not sent. + Use LIBSSH2_FREE instead of free since + _libssh2_base64_encode uses LIBSSH2_ALLOC -- [Douglas Masterson brought this change] +Daniel Stenberg (18 May 2013) +- [Matthias Kerestesch brought this change] - session_startup: init state properly + libssh2_agent_init: init ->fd to LIBSSH2_INVALID_SOCKET - libssh2_session_startup() didn't set the state correctly so it could get - confused. + ... previously it was left at 0 which is a valid file descriptor! - Fixes #218 - -- timeout: added man pages - -- BLOCK_ADJUST_ERRNO: move rc to right level + Bug: https://trac.libssh2.org/ticket/265 - We can't declare the variable within the block and use it in the final - do-while() expression to be properly portable C89. + Fixes #265 -- [Matt Lilley brought this change] - - adds a timeout to blocking calls +- userauth_password: pass on the underlying error code - Fixes bug #160 as per Daniel's suggestion + _libssh2_packet_requirev() may return different errors and we pass that + to the parent instead of rewriting it. - Adds libssh2_session_set_timeout() and libssh2_session_get_timeout() + Bug: http://libssh2.org/mail/libssh2-devel-archive-2013-04/0029.shtml + Reported by: Cosmin -- SCP: fix incorrect error code - - After an error occurs in libssh2_scp_recv() or libssh2_scp_send(), the - function libssh2_session_last_error() would return - LIBSSH2_ERROR_SOCKET_NONE on error. - - Bug: http://trac.libssh2.org/ticket/216 - Patch by: "littlesavage" - - Fixes #216 +Peter Stuge (9 May 2013) +- [Marc Hoersken brought this change] -Guenter Knauf (19 Apr 2011) -- Updated default (recommended) dependency versions. + libcrypt.c: Fix typo in _libssh2_rsa_sha1_sign() parameter type -Daniel Stenberg (17 Apr 2011) -- libssh2_session_block_directions: fix mistake - - The last LIBSSH2_SESSION_BLOCK_INBOUND should be - LIBSSH2_SESSION_BLOCK_OUTBOUND - - And I shortened the short description +Kamil Dudka (4 May 2013) +- configure.ac: replace AM_CONFIG_HEADER with AC_CONFIG_HEADERS - Reported by: "drswinghead" + Reported by: Quintus + Bug: https://trac.libssh2.org/ticket/261 -- msvcproj: added libs and debug stuff +Guenter Knauf (12 Apr 2013) +- Fixed copyright string for NetWare build. + +Daniel Stenberg (9 Apr 2013) +- [Richard W.M. Jones brought this change] + + sftp: Add support for fsync (OpenSSH extension). - Added libraries needed to link whether using openssl dynamically or - statically + The new libssh2_sftp_fsync API causes data and metadata in the + currently open file to be committed to disk at the server. - Added LIBSSH2DEBUG define to debug versions to enable tracing + This is an OpenSSH extension to the SFTP protocol. See: - URL: http://trac.libssh2.org/ticket/215 - Patch by: Mark Smith + https://bugzilla.mindrot.org/show_bug.cgi?id=1798 -- sftp_write: clean offsets on error - - When an error has occurred on FXP_WRITE, we must make sure that the - offset, sent offset and acked counter are reset properly. +- [Richard W.M. Jones brought this change] -- example/.gitignore: ignore built binaries + sftp: statvfs: Along error path, reset the correct 'state' variable. -- sftp_write: flush the packetlist on error - - When an error occurs during write, flush the entire list of pending - outgoing SFTP packets. +- [Richard W.M. Jones brought this change] -- keepalive: add first basic man pages + sftp: seek: Don't flush buffers on same offset - Someone on IRC pointed out that we don't have these documented so I - wrote up a first set based on the information in the wiki: - http://trac.libssh2.org/wiki/KeepAlive + Signed-off-by: Richard W.M. Jones -- scp_write_nonblock.c: remove pointless check - - libssh2_channel_write() cannot return a value that is larger than the - input length value +Guenter Knauf (9 Feb 2013) +- Updated dependency libs. -Mikhail Gusarov (9 Apr 2011) -- s/\.NF/.nf/ to fix wrong macro name caught by man --warnings +- Fixed tool macro names. -Daniel Stenberg (6 Apr 2011) -- version: bump to 1.2.9_dev - - Also update the copyright year range to include 2011 +Daniel Stenberg (29 Nov 2012) +- [Seth Willits brought this change] -- configure: fix $VERSION + compiler warnings: typecast strlen in macros - Stop using the $VERSION variable as it seems to be magically used by - autoconfig itself and thus gets set to the value set in AC_INIT() - without us wanting that. $LIBSSH2VER is now the libssh2 version as - detected. + ... in macro parameters to avoid compiler warnings about lost precision. - Reported by: Paul Howarth - Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2011-04/0008.shtml + Several macros in libssh2.h call strlen and pass the result directly to + unsigned int parameters of other functions, which warns about precision + loss because strlen returns size_t which is unsigned long on at least + some platforms (such as OS X). The fix is to simply typecast the + strlen() result to unsigned int. -- maketgz: use git2news.pl by the correct name +- libssh2.h: bump version to 1.4.4-DEV -Version 1.2.8 (4 Apr 2011) +Version 1.4.3 (27 Nov 2012) -Daniel Stenberg (4 Apr 2011) -- RELEASE-NOTES: synced with fabf1a45ee +Daniel Stenberg (27 Nov 2012) +- RELEASE-NOTES: fixed for 1.4.3 -- NEWS: auto-generated from git - - Starting now, the NEWS file is generated from git using the git2news.pl - script. This makes it always accurate and up-to-date, even for daily - snapshots etc. +- sftp_read: return error if a too large package arrives -- sftp_write: handle FXP_WRITE errors +Peter Stuge (13 Nov 2012) +- Only define _libssh2_dsa_*() functions when building with DSA support + +Guenter Knauf (8 Nov 2012) +- Added .def file to output. + +Kamil Dudka (1 Nov 2012) +- libssh2_hostkey_hash.3: update the description of return value - When an sftp server returns an error back on write, make sure the - function bails out and returns the proper error. + The function returns NULL also if the hash algorithm is not available. -- configure: stop using the deprecated AM_INIT_AUTOMAKE syntax +Guenter Knauf (24 Oct 2012) +- Fixed mode acciedently committed. -Alexander Lamaison (13 Mar 2011) -- Support unlimited number of host names in a single line of the known_hosts file. +- Ignore generated file. + +- Added hack to make use of Makefile.inc. - Previously the code assumed either a single host name or a hostname,ip-address pair. However, according to the spec [1], there can be any number of comma separated host names or IP addresses. + This should avoid further maintainance of the objects list. + +- Fixed MSVC NMakefile. - [1] http://www.openbsd.org/cgi-bin/man.cgi?query=sshd&sektion=8 + Added missing source files; added resource for DLL. -Daniel Stenberg (26 Feb 2011) -- libssh2_knownhost_readfile.3: clarify return value +Kamil Dudka (22 Oct 2012) +- examples: use stderr for messages, stdout for data - This function returns the number of parsed hosts on success, not just - zero as previously documented. + Reported by: Karel Srot + Bug: https://bugzilla.redhat.com/867462 -Peter Stuge (26 Feb 2011) -- Don't save allocated packet size until it has actually been allocated +- openssl: do not leak memory when handling errors - The allocated packet size is internal state which needs to match reality - in order to avoid problems. This commit fixes #211. + ,.. in aes_ctr_init(). Detected by Coverity. -Daniel Stenberg (21 Feb 2011) -- [Alfred Gebert brought this change] +- channel: fix possible NULL dereference + + ... in libssh2_channel_get_exit_signal(). Detected by Coverity. - session_startup: manage server data before server identification +- Revert "aes: the init function fails when OpenSSL has AES support" - Fix the bug that libssh2 could not connect if the sftp server - sends data before sending the version string. + This partially reverts commit f4f2298ef3635acd031cc2ee0e71026cdcda5864. - http://tools.ietf.org/html/rfc4253#section-4.2 + We need to use the EVP_aes_???_ctr() functions in FIPS mode. + +- crypt: use hard-wired cipher block sizes consistently + +- openssl: do not ignore failure of EVP_CipherInit() + +- kex: do not ignore failure of libssh2_md5_init() - "The server MAY send other lines of data before sending the version - string. Each line SHOULD be terminated by a Carriage Return and Line - Feed. Such lines MUST NOT begin with "SSH-", and SHOULD be encoded - in ISO-10646 UTF-8 [RFC3629] (language is not specified). Clients - MUST be able to process such lines." + The MD5 algorithm is disabled when running in FIPS mode. -- [Alfred Gebert brought this change] +Daniel Stenberg (21 Aug 2012) +- [Peter Krempa brought this change] - fullpacket: decompression only after init + known_hosts: Fail when parsing unknown keys in known_hosts file. - The buffer for the decompression (remote.comp_abstract) is initialised - in time when it is needed. With this fix decompression is disabled when - the buffer (remote.comp_abstract) is not initialised. + libssh2_knownhost_readfile() silently ignored problems when reading keys + in unsupported formats from the known hosts file. When the file is + written again from the internal structures of libssh2 it gets truntcated + to the point where the first unknown key was located. - Bug: http://trac.libssh2.org/ticket/200 + * src/knownhost.c:libssh2_knownhost_readfile() - return error if key + parsing fails -- _libssh2_channel_read: store last error +- AUTHORS: synced with 42fec44c8a4 - When the transport layer returns EAGAIN this function didn't call - _libssh2_error() which made the last_error not get set. + 31 recent authors added -- sftp_write: clarified the comment header +- [Dave Hayden brought this change] -- sftp_read: avoid wrapping counter to insanity - - As pointed out in bug #206, if a second invoke of libssh2_sftp_read() - would shrink the buffer size, libssh2 would go nuts and send out read - requests like crazy. This was due to an unsigned variable turning - "negative" by some wrong math, and that value would be the amount of - data attempt to pre-buffer! + compression: add support for zlib@openssh.com - Bug: http://trac.libssh2.org/ticket/206 + Add a "use_in_auth" flag to the LIBSSH2_COMP_METHOD struct and a + separate "zlib@openssh.com" method, along with checking session->state + for LIBSSH2_STATE_AUTHENTICATED. Appears to work on the OpenSSH servers + I've tried against, and it should work as before with normal zlib + compression. -- sftp_packet_read: use 32bit variables for 32bit data +- [Dmitry Smirnov brought this change] -- libssh2_sftp_stat_ex.3: cleaned up, extended + configure: gcrypt doesn't come with pkg-config support - Removed the macros from it as they have their own man pages. + ... so use plain old -lgcrypt to the linker to link with it. - Added the LIBSSH2_SFTP_ATTRIBUTES struct in here for easier reference. + Fixes #225 -- sftp_readdir: return error if buffer is too small +- sftp_read: Value stored to 'next' is never read - If asked to read data into a buffer and the buffer is too small to hold - the data, this function now returns an error instead of as previously - just copy as much as fits. + Detected by clang-analyzer -- sftp_symlink: return error if receive buffer too small - - and clean up some variable type mismatches +- publickey_init: errors are negative, fix check - Discussion: http://www.libssh2.org/mail/libssh2-devel-archive-2011-01/0001.shtml + Detected by clang-analyzer. -- docs: clarify what happens with a too small buffer - - This flaw is subject to change, but I figured it might be valuable to - users of existing code to know how it works. +- [Maxime Larocque brought this change] -- channel_request_pty_size: fix reqPTY_state + session_free: wrong variable used for keeping state - The state variable isn't properly set so every other call to the - function fails! + If libssh2_session_free is called without the channel being freed + previously by libssh2_channel_free a memory leak could occur. - Bug: http://libssh2.org/mail/libssh2-devel-archive-2010-12/0096.shtml - Reported by: Steve Legg - -- data size: cleanup + A mismatch of states variables in session_free() prevent the call to + libssh2_channel_free function. session->state member is used instead of + session->free_state. - Fix 64bit warnings by using (s)size_t and dedicated uint32_t types more. - -- [Pierre Joye brought this change] - - ssize_t: proper typedef with MSVC compilers + It causes a leak of around 600 bytes on every connection on my systems + (Linux, x64 and PPC). - As discussed on the mailing list, it was wrong for win64 and using the - VC-provided type is the safest approach instead of second- guessing - which one it should be. - -Guenter Knauf (22 Dec 2010) -- Updated OpenSSL version. + (Debugging done under contract for Accedian Networks) + + Fixes #246 -- Expanded tabs to spaces. +Guenter Knauf (29 Jun 2012) +- Small NetWare makefile tweak. -Peter Stuge (21 Dec 2010) -- [Joey Degges brought this change] +- Some small Win32 makefile fixes. - _libssh2_ntohu64: fix conversion from network bytes to uint64 - - Cast individual bytes to uint64 to avoid overflow in arithmetic. +Daniel Stenberg (19 Jun 2012) +- libssh2_userauth_publickey_fromfile_ex.3: mention publickey == NULL -Daniel Stenberg (20 Dec 2010) -- libssh2_userauth_list: language fix +- comp_method_zlib_decomp: handle Z_BUF_ERROR when inflating - "faily" is not a good English word, and I also cleaned up some other minor - mistakes + When using libssh2 to perform an SFTP file transfer from the "JSCAPE MFT + Server" (http://www.jscape.com) the transfer failed. The default JSCAPE + configuration is to enforce zlib compression on SSH2 sessions so the + session was compressed. The relevant part of the debug trace contained: + + [libssh2] 1.052750 Transport: unhandled zlib error -5 + [libssh2] 1.052750 Failure Event: -29 - decompression failure + + The trace comes from comp_method_zlib_decomp() in comp.c. The "unhandled + zlib error -5" is the status returned from the zlib function + inflate(). The -5 status corresponds to "Z_BUF_ERROR". + + The inflate() function takes a pointer to a z_stream structure and + "inflates" (decompresses) as much as it can. The relevant fields of the + z_stream structure are: + + next_in - pointer to the input buffer containing compressed data + avail_in - the number of bytes available at next_in + next_out - pointer to the output buffer to be filled with uncompressed + data + avail_out - how much space available at next_out + + To decompress data you set up a z_stream struct with the relevant fields + filled in and pass it to inflate(). On return the fields will have been + updated so next_in and avail_in show how much compressed data is yet to + be processed and next_out and avail_out show how much space is left in + the output buffer. + + If the supplied output buffer is too small then on return there will be + compressed data yet to be processed (avail_in != 0) and inflate() will + return Z_OK. In this case the output buffer must be grown, avail_out + updated and inflate() called again. + + If the supplied output buffer was big enough then on return the + compressed data will have been exhausted (avail_in == 0) and inflate() + will return Z_OK, so the data has all been uncompressed. + + There is a corner case where inflate() makes no progress. That is, there + may be unprocessed compressed data and space available in the output + buffer and yet the function does nothing. In this case inflate() will + return Z_BUF_ERROR. From the zlib documentation and the source code it + is not clear under what circumstances this happens. It could be that it + needs to write multiple bytes (all in one go) from its internal state to + the output buffer before processing the next chunk of input but but + can't because there is not enough space (though my guesses as to the + cause are not really relevant). Recovery from Z_BUF_ERROR is pretty + simple - just grow the output buffer, update avail_out and call + inflate() again. + + The comp_method_zlib_decomp() function does not handle the case when + inflate() returns Z_BUF_ERROR. It treats it as a non-recoverable error + and basically aborts the session. + + Fixes #240 -- crypto: unify the generic functions +Guenter Knauf (12 Jun 2012) +- MinGW makefile tweaks. - Added crypto.h that is the unified header to include when using crypto - functionality. It should be the only header that needs to adapt to the - underlying crypto library in use. It provides the set of prototypes that - are library agnostic. + Use GNU tools when compiling on Linux. + Fixed dist and dev targets. -- [Mark Smith brought this change] +- NetWare makefile tweaks. + + Changed to use Windows commandline tools instead of + GNU tools when compiling on Windows. Fixed dist and + dev targets. Enabled nlmconv error for unresolved + symbols. - userauth: derive publickey from private +Daniel Stenberg (11 Jun 2012) +- Revert "config.rpath: generated file, no need to keep in git" - Pass a NULL pointer for the publickey parameter of - libssh2_userauth_publickey_fromfile and - libssh2_userauth_hostbased_fromfile functions. In this case, the - functions recompute the public key from the private key file data. + This reverts commit 1ac7bd09cc685755577fb2c8829adcd081e7ab3c. - This is work done by Jean-Louis CHARTON - , then adapted by Mark Smith and - slightly edited further by me Daniel. + This file still used by lib/*m4 functions so we need to keep the file + around. + +- BINDINGS: added PySsh2, a Python-ctypes binding + +Guenter Knauf (8 Jun 2012) +- Fixed MinGW debug build. + +Daniel Stenberg (5 Jun 2012) +- BINDINGS: Added the Cocoa/Objective-C one - WARNING: this does leave the feature NOT WORKING when libssh2 is built - to use libgcrypt instead of OpenSSL simply due to lack of - implementation. + ... and sorted the bindings after the languages, alphabetically + + Reported by: Mike Abdullah -- ssh2_echo: Value stored to 'exitcode' is never read +- BINDINGS: document the bindings we know of -- _libssh2_packet_add: fix SSH_MSG_DEBUG weirdness +Guenter Knauf (4 Jun 2012) +- Fixed LIBSSH2_INT64_T_FORMAT macro. - I believe I may have caused this weird typo style error when I cleaned - up this function a while ago. Corrected now. + Usually a format macro should hold the whole format, otherwise + it should be named a prefix. Also fixed usage of this macro in + scp.c for a signed var where it was used as prefix for unsigned. -- uint32: more longs converted to proper types +- Removed obsolete define from makefiles. + +- Renamed NetWare makefiles. + +- Renamed NetWare makefiles. + +- Synced MinGW makefiles with 56c64a6..39e438f. - I also moved the MAC struct over to the mac.h header file and made sure - that the users of that struct include that file. + Also synced MinGW test makefile with b092696..f8cb874. -- SFTP: more types to uint32_t +Peter Stuge (30 May 2012) +- Revert "sftp: Don't send attrs.permissions on read-only SSH_FXP_OPEN" - The 'num_names' field in the SSH_FXP_NAME response is an unsigned 32bit - value so we make sure to treat it like that. + This reverts commit 04e79e0c798674a0796be8a55f63dd92e6877790. -- SFTP: request_ids are uint32_t +- sftp: Don't send attrs.permissions on read-only SSH_FXP_OPEN - I went over the code and made sure we use uint32_t all over for the - request_id data. It is an unsigned 32bit value on the wire. + This works around a protocol violation in the ProFTPD 1.3.4 mod_sftp + server, as reported by Will Cosgrove in: + + http://libssh2.org/mail/libssh2-devel-archive-2012-05/0079.shtml + + Based on a suggested fix by TJ Saunders in: + + http://libssh2.org/mail/libssh2-devel-archive-2012-05/0104.shtml -- SFTP: store request_id separately in packets +Guenter Knauf (28 May 2012) +- Try to detect OpenSSL build type automatically. - By using a new separate struct for incoming SFTP packets and not sharing - the generic packet struct, we can get rid of an unused field and add a - new one dedicated for holding the request_id for the incoming - package. As sftp_packet_ask() is called fairly often, a "mere" integer - comparison is MUCH faster than the previous memcmp() of (typically) 5 - bytes. + Also fixed recently added libgdi32 linkage which is only + required when OpenSSL libs are linked statically. -- libssh2_sftp_open_ex: man page extended and cleaned up +Daniel Stenberg (25 May 2012) +- config.rpath: generated file, no need to keep in git + +Guenter Knauf (22 May 2012) +- Updated dependency libary versions. + +Daniel Stenberg (18 May 2012) +- 1.4.3: towards the future + +Version 1.4.2 (18 May 2012) + +Daniel Stenberg (18 May 2012) +- RELEASE-NOTES: synced with 92a9f952794 + +Alexander Lamaison (15 May 2012) +- win32/libssh2_config.h: Remove hardcoded #define LIBSSH2_HAVE_ZLIB. - I added the missing documentation for the 'flags' argument. + Rationale: Everything else in this file states a fact about the win32 + platform that is unconditional for that platform. There is nothing + unconditional about the presence of zlib. It is neither included with + Windows nor with the platform SDK. Therefore, this is not an appropriate + place to assert its presence. Especially as, once asserted, it cannot be + overridden using a compiler flag. + + In contrast, if it is omitted, then it can easily be reasserted by adding + a compiler flag defining LIBSSH2_HAVE_ZLIB. -- SFTP: unify the READ/WRITE chunk structs +Daniel Stenberg (14 May 2012) +- RELEASE-NOTES: synced with 69a3354467c -- SFTP: fix memory leaks +- _libssh2_packet_add: SSH_MSG_CHANNEL_REQUEST default to want_reply - Make sure that we cleanup remainders when the handle is closed and when - the subsystem is shutdown. + RFC4254 says the default 'want_reply' is TRUE but the code defaulted to + FALSE. Now changed. - Existing flaw: if a single handle sends packets that haven't been - replied to yet at the time when the handle is closed, those packets will - arrive later and end up in the generic packet brigade queue and they - will remain in there until flushed. They will use unnecessary memory, - make things slower and they will ruin the SFTP handling if the - request_id counter ever wraps (highly unlikely to every happen). + Fixes #233 -- sftp_close_handle: packet list is generic +- gettimeofday: no need for a replacement under cygwin - Fix comment, simplify the loop logic + Fixes #224 -- sftp_read: pipeline reads +Alexander Lamaison (13 May 2012) +- Prevent sftp_packet_read accessing freed memory. - The SFTP read function now does transfers the same way the SFTP write - function was made to recently: it creates a list of many outgoing - FXP_READ packets that each asks for a small data chunk. The code then - tries to keep sending read request while collecting the acks for the - previous requests and returns the received data. + sftp_packet_add takes ownership of the packet passed to it and (now that we + handle zombies) might free the packet. sftp_packet_read uses the packet type + byte as its return code but by this point sftp_packet_add might have freed + it. This change fixes the problem by caching the packet type before calling + sftp_packet_add. + + I don't understand why sftp_packet_read uses the packet type as its return + code. A future change might get rid of this entirely. + +Daniel Stenberg (12 May 2012) +- sftp_packet_flush: flush zombies too + + As this function is called when the SFTP session is closed, it needs to + also kill all zombies left in the SFTP session to avoid leaking memory + just in case some zombie would still be in there. + +- sftp_packetlist_flush: zombies must not have responses already + + When flushing the packetlist, we must only add the request as a zombie + if no response has already been received. Otherwise we could wrongly + make it a zombie even though the response was already received and then + we'd get a zombie stuck there "forever"... + +- sftp_read: on EOF remove packet before flush + + Since the sftp_packetlist_flush() function will move all the existing + FXP_READ requests in this handle to the zombie list we must first remove + this just received packet as it is clearly not a zombie. + +- sftp_packet_require: sftp_packet_read() returning 0 is not an error + + Exactly as the comment in the code said, checking the return code from + sftp_packet_read() with <= was wrong and it should be < 0. With the new + filtering on incoming packets that are "zombies" we can now see this + getting zero returned. + +- sftp_packetlist_flush: only make it zombie if it was sent + + The list of outgoing packets may also contain packets that never were + sent off and we better not make them zombies too. + +- [Alexander Lamaison brought this change] + + Mark outstanding read requests after EOF as zombies. + + In order to be fast, sftp_read sends many read requests at once. With a small + file, this can mean that when EOF is received back, many of these requests are + still outstanding. Responses arriving after we close the file and abandon the + file handle are queued in the SFTP packet queue and never collected. This + causes transfer speed to drop as a progressively longer queue must be searched + for every packet. + + This change introduces a zombie request-ID list in the SFTP session that is + used to recognise these outstanding requests and prevent them being added to + the queue. + +Peter Stuge (23 Apr 2012) +- [Rafael Kitover brought this change] + + Update win32/GNUmakefile to use OpenSSL 1.0.1a + + libcrypto on win32 now depends on gdi32.dll, so move the OpenSSL LDLIBS + block to before the compiler definitions, so that libcrypto gets added + first, and then add -lgdi32 into the following common LDLIBS for gcc. + +Guenter Knauf (23 Apr 2012) +- Changed 'Requires' to 'Requires.private'. + + Only static builds need to link against the crypto libs. + +- Fixed 'Requires:' names. + + The 'Requires:' line lists the names of the .pc files. + +- Added 'Requires:' line to libssh2.pc. + + This is necessary so that other libs which lookup libssh2 info + via pkg-config can add the right crypto lib dependencies. + +- Updated dependency lib versions. + +Peter Stuge (18 Apr 2012) +- configure.ac: Add option to disable build of the example applications + + Examples are built by default. Any of the following options on the + configure command line will skip building them: + + --disable-examples-build + --enable-examples-build=no + --enable-examples-build=false + +- userauth.c: fread() from public key file to correctly detect any errors + + If the filename parameter for file_read_publickey() was the name of a + directory instead of a file then libssh2 would spin trying to fgetc() + from the FILE * for the opened directory when trying to determine the + length of the encoded public key, since fgetc() can't report errors. + + Use fread() instead to correctly detect this error condition along + with many others. + + This fixes the problem reported in + http://www.libssh2.org/mail/libssh2-devel-archive-2012-04/0021.shtml + + Reported-by: Oleksiy Zagorskyi + +- Return LIBSSH2_ERROR_SOCKET_DISCONNECT on EOF when reading banner + +Guenter Knauf (17 Apr 2012) +- Fixed copyright year. + +- Updated dependency lib versions in static makefiles. + +Daniel Stenberg (6 Apr 2012) +- version: bump to 1.4.2 + + We're on the 1.4.2 track now (at least) + +Version 1.4.1 (4 Apr 2012) + +Daniel Stenberg (4 Apr 2012) +- RELEASE-NOTES: updated for 1.4.1 release + +- always do "forced" window updates + + When calling _libssh2_channel_receive_window_adjust() internally, we now + always use the 'force' option to prevent libssh2 to avoid sending the + update if the update isn't big enough. + + It isn't fully analyzed but we have seen corner cases which made a + necessary window update not get send due to this and then the other side + doesn't send data our side then sits waiting for forever. + +- channel_read: force window adjusts! + + if there's not enough room to receive the data that's being requested, + the window adjustment needs to be sent to the remote and thus the force + option has to be used. _libssh2_channel_receive_window_adjust() would + otherwise "queue" small window adjustments for a later packet but that + is really terribly for the small buffer read that for example is the + final little piece of a very large file as then there is no logical next + packet! + + Reported by: Armen Babakhanian + Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0130.shtml + +- [Paul Howarth brought this change] + + aes: the init function fails when OpenSSL has AES support + + The internal init function only worked fine when the configure script + didn't detect the OpenSSL AES_CTR function! + + Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0111.shtml + Reported by: Paul Howarth + +- [Matthew Booth brought this change] + + transport_send: Finish in-progress key exchange before sending data + + _libssh2_channel_write() first reads outstanding packets before writing + new data. If it reads a key exchange request, it will immediately start + key re-exchange, which will require sending a response. If the output + socket is full, this will result in a return from + _libssh2_transport_read() of LIBSSH2_ERROR_EAGAIN. In order not to block + a write because there is no data to read, this error is explicitly + ignored and the code continues marshalling a packet for sending. When it + is sent, the remote end immediately drops the connection because it was + expecting a continuation of the key exchange, but got a data packet. + + This change adds the same check for key exchange to + _libssh2_transport_send() that is in _libssh2_transport_read(). This + ensures that key exchange is completed before any data packet is sent. + +- channel_write: acknowledge transport errors + + When draining data off the socket with _libssh2_transport_read() (which + in turn has to be done so that we can be sure to have read any possible + window-increasing packets), this code previously ignored errors which + could lead to nasty loops. Now all error codes except EAGAIN will cause + the error to be returned at once. + + Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0068.shtml + Reported by: Matthew Booth -- sftp_write: removed unused variable +- [Steven Dake brought this change] -- _libssh2_channel_close: don't call transport read if disconnected + In examples/x11.c, Make sure sizeof passed to read operation is correct - The loop that waits for remote.close to get set may end up looping - forever since session->socket_state gets set to - LIBSSH2_SOCKET_DISCONNECTED by the packet_add() function called from the - transport_read() function and after having been set to - LIBSSH2_SOCKET_DISCONNECTED, the transport_read() function will only - return 0. + sizeof(buf) expands to 8 or 4 (since its a pointer). This variable may + have been static in the past, leading to this error. - Bug: http://trac.libssh2.org/ticket/198 + Signed-off-by: Steven Dake -- libssh2_sftp_seek64: new man page - - Split off libssh2_sftp_seek64 from the libssh2_sftp_seek man page, and - mentioned that we consider the latter deprecated. Also added a mention - about the dangers of doing seek during writing or reading. +- [Steven Dake brought this change] -- sftp_seek: fix - - The new SFTP write code caused a regression as the seek function no - longer worked as it didn't set the write position properly. + Fix suspicious sizeof usage in examples/x11.c - It should be noted that seeking is STRONGLY PROHIBITED during upload, as - the upload magic uses two different offset positions and the multiple - outstanding packets etc make them sensitive to change in the midst of - operations. + In the x11 example, sizeof(buf) = 8UL (on x86_64), when this should + probably represent the buffer size available. I am not sure how to + test that this change is actually correct, however. - This functionality was just verified with the new example code - sftp_append. This bug was filed as bug #202: + Signed-off-by: Steven Dake + +- sftp_packet_read: follow-up fix for EAGAIN/window adjust - Bug: http://trac.libssh2.org/ticket/202 + The commit in 7194a9bd7ba45 wasn't complete. This change makes sure + variables are initialized properly before used in the EAGAIN and window + adjust cases. -- sftp_append: new example doing SFTP append +- sftp_packet_add: use named error code instead of number -- MAX_SFTP_OUTGOING_SIZE: 30000 - - I ran SFTP upload tests against localhost. It showed that to make the - app reach really good speeds, I needed to do a little code tweak and - change MAX_SFTP_OUTGOING_SIZE from 4000 to 30000. The tests I did before - with the high latency tests didn't show any real difference whatever I - had that size set to. +- sftp_packet_add: verify the packet before accepting it - This number is the size in bytes that libssh2 cuts off the large input - buffer and sends off as an individual sftp packet. + In order to bail out as quickly as possible when things are wrong and + out of sync, make sure the SFTP message is one we understand. -- sftp_write_sliding.c: new example +- SFTP: preserve the original error code more - This is an example that is very similar to sftp_write_nonblock.c, with - the exception that this uses + Lots of places in the code translated the original error into the more + generic LIBSSH2_ERROR_SOCKET_TIMEOUT but this turns out to distort the + original error reason a lot and makes tracking down the real origin of a + problem really hard. This change makes the original error code be + preserved to a larger extent when return up to the parent function. + +- sftp_packet_read: adjust window size as necessary - 1 - a larger upload buffer + Commit 03ca9020756 tried to simplify the window sizing logic but broke + SFTP readdir as there was no window sizing code left there so large + directory listings no longer worked. - 2 - a sliding buffer mechnism to allow the app to keep sending lots of - data to libssh2 without having to first drain the buffer. + This change introduces window sizing logic to the sftp_packet_read() + function so that it now tells the remote about the local size having a + window size that suffice when it is about to ask for directory data. - These are two key issues to make libssh2 SFTP uploads really perform - well at this point in time. + Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0069.shtml + Reported by: Eric -- cpp: s/#elsif/#elif - - This looks like a typo as #elsif is not really C... +- [Steven Dake brought this change] -- _libssh2_channel_write: revert channel_write() use - - The attempts made to have _libssh2_channel_write() accept larger pieces - of data and split up the data by itself into 32700 byte chunks and pass - them on to channel_write() in a loop as a way to do faster operations on - larger data blocks was a failed attempt. - - The reason why it is difficult: + Tell C compiler we don't care about return code of libssh2_init - The API only allows EAGAIN or a length to be returned. When looping over - multiple blocks to get sent, one block can get sent and the next might - not. And yet: when transport_send() has returned EAGAIN we must not call - it again with new data until it has returned OK on the existing data it - is still working on. This makes it a mess and we do get a much easier - job by simply returning the bytes or EAGAIN at once, as in the EAGAIN - case we can assume that we will be called with the same arguments again - and transport_send() will be happy. + The call of libssh2_init returns a return code, but nothing could be done + within the _libssh2_init_if_needed execution path. - Unfortunately, I think we take a small performance hit by not being able - to do this. + Signed-off-by: Steven Dake -- ssh2_echo: new example - - This is a new example snippet. The code is largely based on ssh2_exec, - and is written by Tommy Lindgren. I edited it into C90 compliance and to - conform to libssh2 indent style and some more. +- [Steven Dake brought this change] -- send_existing: return after send_existing + Add comment indicating a resource leak is not really a resource leak - When a piece of data is sent from the send_existing() function we must - make the parent function return afterwards. Otherwise we risk that the - parent function tries to send more data and ends up getting an EGAIN for - that more data and since it can only return one return code it doesn't - return info for the successfully sent data. + While possibly obvious to those investigating the code, coverity complains + about this out of scope leak. - As this change is a regression I now added a larger comment explaining - why it has to work like this. + Signed-off-by: Steven Dake -- _libssh2_channel_write: count resent data as written +- [Steven Dake brought this change] + + Use safer snprintf rather then sprintf in scp_send() - In the logic that resends data that was kept for that purpose due to a - previous EAGAIN, the data was not counted as sent causing badness. + Signed-off-by: Steven Dake -Peter Stuge (13 Nov 2010) -- Use fprintf(stderr, ) instead of write(2, ) for debugging +- [Steven Dake brought this change] -- session/transport: Correctly handle when _libssh2_send() returns -EAGAIN + Use safer snprintf rather then sprintf in scp_recv() + + While the buffer is indeed allocated to a safe length, better safe then sorry. + + Signed-off-by: Steven Dake -- src/agent.c: Simplify _libssh2_send() error checking ever so slightly +- [Steven Dake brought this change] -Daniel Stenberg (12 Nov 2010) -- send/recv: use _libssh2_recv and _libssh2_send now + use snprintf in knownhost_writeline() rather then sprintf - Starting now, we unconditionally use the internal replacement functions - for send() and recv() - creatively named _libssh2_recv() and - _libssh2_send(). + Although the function checks the length, if the code was in error, there + could potentially be a buffer overrun with the use of sprintf. Instead replace + with snprintf. - On errors, these functions return the negative 'errno' value instead of - the traditional -1. This design allows systems that have no "natural" - errno support to not have to invent it. It also means that no code - outside of these two transfer functions should use the errno variable. + Signed-off-by: Steven Dake -- channel_write: move some logic to _libssh2_channel_write - - Some checks are better done in _libssh2_channel_write just once per - write instead of in channel_write() since the looping will call the - latter function multiple times per _libssh2_channel_write() invoke. +- [Steven Dake brought this change] -- sftp_write: handle "left over" acked data - - The SFTP handle struct now buffers number of acked bytes that haven't - yet been returned. The way this is used is as following: + Add tracing to print packets left on session at libssh2_session_free - 1. sftp_write() gets called with a buffer of let say size 32000. We - split 32000 into 8 smaller packets and send them off one by one. One of - them gets acked before the function returns so 4000 is returned. + Signed-off-by: Steven Dake + +Peter Stuge (2 Mar 2012) +- Define and use LIBSSH2_INVALID_SOCKET instead of INVALID_SOCKET - 2. sftp_write() gets called again a short while after the previous one, - now with a much smaller size passed in to the function. Lets say 8000. - In the mean-time, all of the remaining packets from the previous call - have been acked (7*4000 = 28000). This function then returns 8000 as all - data passed in are already sent and it can't return any more than what - it got passed in. But we have 28000 bytes acked. We now store the - remaining 20000 in the handle->u.file.acked struct field to add up in - the next call. + INVALID_SOCKET is a special value in Windows representing a + non-valid socket identifier. We were #defining this to -1 on + non-Windows platforms, causing unneccessary namespace pollution. + Let's have our own identifier instead. - 3. sftp_write() gets called again, and now there's a backlogged 20000 - bytes to return as fine and that will get skipped from the beginning - of the buffer that is passed in. + Thanks to Matt Lawson for pointing this out. -- sftp_write: polished and simplified +- nw/Makefile.netware: Fix project name typo to avoid needless confusion + +- example/x11: Set raw terminal mode manually instead of with cfmakeraw() - Removed unnecessary struct fields and state changes within the function. + OpenSolaris has no cfmakeraw() so to make the example more portable + we simply do the equivalent operations on struct termios ourselves. - Made the loop that checks for ACKs only check chunks that were fully - sent. + Thanks to Tom Weber for reporting this problem, and finding a solution. -- SCP: on failure, show the numerical error reason +Daniel Stenberg (17 Feb 2012) +- sftp_write: cannot return acked data *and* EAGAIN - By calling libssh2_session_last_errno() - -- SFTP: provide the numerical error reason on failure + Whenever we have acked data and is about to call a function that *MAY* + return EAGAIN we must return the number now and wait to get called + again. Our API only allows data *or* EAGAIN and we must never try to get + both. -- SCP: clean up failure treatment +Peter Stuge (13 Feb 2012) +- example/x11: Build only when sys/un.h is found by configure - When SCP send or recv fails, it gets a special message from the server - with a warning or error message included. We have no current API to - expose that message but the foundation is there. Removed unnecessary use - of session struct fields. + The example can't be built on systems without AF_UNIX sockets. -- sftp_write: enlarge buffer to perform better +Daniel Stenberg (10 Feb 2012) +- [Alexander Lamaison brought this change] -- packets: code cleanup + Simplified sftp_read. - I added size checks in several places. I fixed the code flow to be easier - to read in some places. + Removed the total_read variable that originally must have tracked how + much data had been written to the buffer. With non-blocking reads, we + must return straight away once we have read data into the buffer so this + variable served not purpose. - I removed unnecessary zeroing of structs. I removed unused struct fields. - -- LIBSSH2_CALLBACK_MACERROR: clarify return code use - -- _libssh2_userauth_publickey: avoid shadowing - -- packet: avoid shadowing global symbols - -- sftp_readdir: avoid shadowing - -- shadowing: don't shadow the global compress - -- _libssh2_packet_add: turn ifs into a single switch - -- _libssh2_packet_add: check SSH_MSG_GLOBAL_REQUEST packet + I think it was still hanging around in case the initial processing of + 'leftover' data meant we wrote to the buffer but this case, like the + others, must return immediately. Now that it does, the last remaining + need for the variable is gone. -- _libssh2_packet_add: SSH_MSG_DEBUG length checks - - Verify lengths before using them. Read always_display from the correct - index. Don't copy stuff around just to provide zero-termination of the - strings. +- [Alexander Lamaison brought this change] -- _libssh2_packet_add: SSH_MSG_IGNORE skip memmove + Cleaned up sftp_read and added more explanation. - There's no promise of a zero termination of the data in the callback so - no longer perform ugly operation in order to provide it. + Replaced the gotos which were implementing the state machine with + a switch statement which makes the states more explicit. -- _libssh2_packet_add: SSH_MSG_DISCONNECT length checks +- sftp_read: avoid data *and* EAGAIN - Verify lengths before trying to read data. + Whenever we have data and is about to call a function that *MAY* return + EAGAIN we must return the data now and wait to get called again. Our API + only allows data *or* EAGAIN and we must never try to get both. -- indent: break lines at 80 columns +Peter Stuge (2 Feb 2012) +- Add a tcpip-forward example which demonstrates remote port forwarding -- SSH_MSG_CHANNEL_OPEN_FAILURE: used defined values - - We don't like magic numbers in the code. Now the acceptable failure - codes sent in the SSH_MSG_CHANNEL_OPEN_FAILURE message are added as - defined values in the private header file. +- libssh2.h: Add missing prototype for libssh2_session_banner_set() -- sftp_write: don't return EAGAIN if no EAGAIN was received +- example/subsystem_netconf.c: Return error when read buffer is too small - This function now only returns EAGAIN if a lower layer actually returned - EAGAIN to it. If nothing was acked and no EAGAIN was received, it will - now instead return 0. + Also remove a little redundancy in the read loop condition. -- _libssh2_wait_socket: detect nothing-to-wait-for - - If _libssh2_wait_socket() gets called but there's no direction set to - wait for, this causes a "hang". This code now detects this situation, - set a 1 second timeout instead and outputs a debug output about it. +- example/subsystem_netconf.c: Add a missing newline in an error message -- decomp: remove the free_dest argument +- Fix undefined reference to _libssh_error in libgcrypt backend - Since the decompress function ALWAYS returns allocated memory we get a - lot simpler code by removing the ability to return data unallocated. + Commit 209de22299b4b58e582891dfba70f57e1e0492db introduced a function + call to a non-existing function, and since then the libgcrypt backend + has not been buildable. -- decomp: cleaned off old compression stuff +Version 1.4.0 (31 Jan 2012) + +Daniel Stenberg (31 Jan 2012) +- RELEASE-NOTES: synced with 6bd584d29 for 1.4.0 + +- s/1.3.1/1.4.0 - I cleared off legacy code from when the compression and decompression - functions were a single unified function. Makes the code easier to read - too. + We're bumping the minor number -- [TJ Saunders brought this change] +- [Jernej Kovacic brought this change] - decomp: increase decompression buffer sizes + libssh2_session_supported_algs: fix compiler warning -- [TJ Saunders brought this change] +- [Jernej Kovacic brought this change] - zlib: Add debug tracing of zlib errors + session_supported_algs docs: added an example -- sftp_packet_read: handle partial reads of the length field +- [Gellule Xg brought this change] + + sftp-seek: clear EOF flag - SFTP packets come as [32 bit length][payload] and the code didn't - previously handle that the initial 32 bit field was read only partially - when it was read. + Set the EOF flag to False when calling seek64 to be able to get some + data back on a following read -- [Jasmeet Bagga brought this change] +- [Peter Krempa brought this change] - kex_agree_hostkey: fix NULL pointer derefence + userauth: Provide more informations if ssh pub key extraction fails - While setting up the session, ssh tries to determine the type of - encryption method it can use for the session. This requires looking at - the keys offered by the remote host and comparing these with the methods - supported by libssh2 (rsa & dss). To do this there is an iteration over - the array containing the methods supported by libssh2. + If the function that extracts/computes the public key from a private key + fails the errors it reports were masked by the function calling it. This + patch modifies the key extraction function to return errors using + _libssh_error() function. The error messages are tweaked to contain + reference to the failed operaton in addition to the reason. - If there is no agreement on the type of encryption we come to the 3rd - entry of the hostkeyp array. Here hostkeyp is valid but *hostkep is - NULL. Thus when we dereference that in (*hostkeyp)->name there is a - crash + * AUTHORS: - add my name + * libgcrypt.c: _libssh2_pub_priv_keyfile(): - return a more verbose + error using + _libssh2_error() func. + * openssl.c: - modify call graph of _libssh2_pub_priv_keyfile() to use + _libssh2_error for error reporting(); + * userauth.c: - tweak functions calling _libssh2_pub_priv_keyfile() not + to shadow error messages -- _libssh2_transport_send: remove dead assignment - - 'data' isn't accessed beyond this point so there's no need to assign it. +- TODO: remove issues we (sort of) did already -- scp_recv: remove dead assignment +- ssh2_exec: skip error outputs for EAGAIN - Instead of assigning a variable we won't read, we now use the more - explicit (void) prefix. - -- sftp_write: removed superfluous assignment + Since the example uses non-blocking mode, it will just flood the output + with this "nonsense" error. -- bugfix: avoid use of uninitialized value +Guenter Knauf (30 Nov 2011) +- Some NetWare makefile tweaks. -- sftp_packet_require: propagate error codes better +Daniel Stenberg (18 Nov 2011) +- LIBSSH2_SFTP_PACKET_MAXLEN: increase to 80000 - There were some chances that they would cause -1 to get returned by - public functions and as we're hunting down all such occurances and since - the underlying functions do return valuable information the code now - passes back proper return codes better. - -- [Alfred Gebert brought this change] + Some SFTP servers send SFTP packets larger than 40000. Since the limit + is only present to avoid insane sizes anyway, we can easily bump it. + + The define was formerly in the public header libssh2_sftp.h but served + no external purpose and was moved into the source dir. + + Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2011-11/0004.shtml + Reported by: Michael Harris - fix memory leaks (two times cipher_data) for each sftp session +Alexander Lamaison (18 Nov 2011) +- [Peter Krempa brought this change] -- libssh2_userauth_authenticated: make it work as documented + knownhost_check(): Don't dereference ext if NULL is passed - The man page clearly says it returns 1 for "already authenticated" but - the code said non-zero. I changed the code to use 1 now, as that is also - non-zero but it gets the benefit that it now matches the documentation. + Documentation for libssh2_knownhost_checkp() and related functions + states that the last argument is filled with data if non-NULL. - Using 1 instead of non-zero is better for two reasons: + "knownhost if set to non-NULL, it must be a pointer to a 'struct + libssh2_knownhost' pointer that gets filled in to point to info about a + known host that matches or partially matches." - 1. We have the opportunity to introduce other return codes in the future for - things like error and what not. - 2. We don't expose the internal bitmask variable value. + In this function ext is dereferenced even if set to NULL, causing + segfault in applications not needing the extra data. -- userauth_keyboard_interactive: fix indent +Daniel Stenberg (11 Nov 2011) +- [Peter Krempa brought this change] -- [Alfred Gebert brought this change] + knownhost_add: Avoid dereferencing uninitialized memory on error path. + + In function knownhost_add, memory is alocated for a new entry. If normal + alocation is used, memory is not initialized to 0 right after, but a + check is done to verify if correct key type is passed. This test is done + BEFORE setting the memory to null, and on the error path function + free_host() is called, that tries to dereference unititialized memory, + resulting into a glibc abort(). + + * knownhost.c - knownhost_add(): - move typemask check before alloc - fix memory leak in userauth_keyboard_interactive() +- windows build: add define to avoid compiler warning - First I wanted to free the memory in session_free() but then - I had still memory leaks because in my test case the function - userauth_keyboard_interactive() is called twice. It is called - twice perhaps because the server has this authentication - methods available: publickey,gssapi-with-mic,keyboard-interactive - The keyboard-interactive method is successful. + A recent mingw compiler has started to complain on "#warning Please + include winsock2.h before windows.h" unless the magic define is set + first. + + Reported by: Vincent Torri + Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2011-10/0064.shtml -- dist: include sftp.h in dist archives +Henrik Nordstrom (31 Oct 2011) +- [Vincent Torri brought this change] -Simon Josefsson (27 Oct 2010) -- Update header to match new function prototype, see c48840ba88. + Correct Windows include file name case, simplifying cross-compilation + + When cross compiling to Windows, libssh2.h include Windows header files + with upper case filenames : BaseTsd.h and WinSock2.h. + + These files have lowercase names with mingw-w64 (iirc, it's the same with + mingw). And as on Windows, being lowercase or uppercase does not matter. -Daniel Stenberg (26 Oct 2010) -- bugfixes: the transport rearrange left some subtle flaws now gone +Daniel Stenberg (25 Oct 2011) +- [Jernej Kovacic brought this change] -- libssh2_userauth_publickey_fromfile_ex.3: cleaned up looks + libssh2_session_supported_algs: added -- libssh2_userauth_publickey: add man page - - I found an undocumented public function and we can't have it like - that. The description here is incomplete, but should serve as a template - to allow filling in... +- [Kamil Dudka brought this change] -- libssh2_sftp_write.3: added blurb about the "write ahead" + example/sftp_RW_nonblock: do not ignore LIBSSH2_ERROR_EAGAIN - Documented the new SFTP write concept - -- sftp_close_handle: free any trailing write chunks + Bug: https://bugzilla.redhat.com/745420 -- _libssh2_channel_write: fix warnings +Peter Stuge (5 Oct 2011) +- example/ssh2_agent: Print host key fingerprint before authentication + + Also moves the comment about not being authenticated to before the + agent authentication takes place, so that it better matches the code. -- SFTP: bufgix, move more sftp stuff to sftp.h +Daniel Stenberg (29 Sep 2011) +- OpenSSL EVP: fix threaded use of structs - The sftp_write function shouldn't assume that the buffer pointer will be - the same in subsequent calls, even if it assumes that the data already - passed in before haven't changed. + Make sure we don't clear or reset static structs after first init so + that they work fine even when used from multiple threads. Init the + structs in the global init. - The sftp structs are now moved to sftp.h (which I forgot to add before) + Help and assistance by: John Engstrom + + Fixes #229 (again) -- SFTP: use multiple outgoing packets when writing +- openssl: don't init static structs differently - sftp_write was rewritten to split up outgoing data into multiple packets - and deal with the acks in a more asynchronous manner. This is meant to - help overcome latency and round-trip problems with the SFTP protocol. + make_ctr_evp() is changed to take a struct pointer, and then each + _libssh2_EVP_aes_[keylen]_ctr function is made to pass in their own + static struct + + Reported by: John Engstrom + Fixes #229 -- TODO: implemented a lot of the ideas now +Guenter Knauf (27 Sep 2011) +- Removed obsolete include path. -- _libssh2_channel_write: removed 32500 size limit +Daniel Stenberg (21 Sep 2011) +- read_state: clear the state variable better - Neither _libssh2_channel_write nor sftp_write now have the 32500 size - limit anymore and instead the channel writing function now has its own - logic to send data in multiple calls until everything is sent. + Set read_state back to idle before trying to send anything so that if + the state somehow is wrongly set. + + Also, avoid such a case of confusion by resetting the read_state when an + sftp handle is closed. -- send_existing: don't tell parent to return when drained +- sftp_read: remove leftover fprintf - That will just cause unnecessary code execution. + Reported by: Alexander Lamaison + +- sftp.h: fix the #ifdef to prevent multiple inclusions + +- sftp_read: use a state variable to avoid bad writes + + When a channel_write call has gotten an EAGAIN back, we try harder to + continue the same write in the subsequent invoke. -- _libssh2_channel_write: general code cleanup +- window_size: explicit adjustments only - simplified the function and removed some unused struct fields - -- _libssh2_transport_send: replaces _libssh2_transport_write + Removed the automatic window_size adjustments from + _libssh2_channel_read() and instead all channel readers must now make + sure to enlarge the window sizes properly themselves. - The new function takes two data areas, combines them and sends them as a - single SSH packet. This allows several functions to allocate and copy - less data. + libssh2_channel_read_ex() - the public function, now grows the window + size according to the requested buffer size. Applications can still opt + to grow the window more on demand. Larger windows tend to give higher + performance. - I also found and fixed a mixed up use of the compression function - arguments that I introduced in my rewrite in a recent commit. + sftp_read() now uses the read-ahead logic to figure out a window_size. -- scp_write_nonblock: use select() instead of busyloop +- libssh2.h: bump the default window size to 256K + +- libssh2_userauth_keyboard_interactive.3: fix man warning - Make this example nicer by not busylooping. + It seemed to occur due to the excessive line length -- send_existing: clear olen when the data is sent off +- [Mikhail Gusarov brought this change] -- _libssh2_transport_write: allow 256 extra bytes around the packet + Add missing .gitignore entries -- _libssh2_transport_write: remade to send without malloc +- [Mikhail Gusarov brought this change] -- compress: compression disabled by default + Add manpage syntax checker to 'check' target - We now allow libssh2_session_flag() to enable compression with a new - flag and I added documentation for the previous LIBSSH2_FLAG_SIGPIPE - flag which I wasn't really aware of! + In virtually every libssh2 release Debian's lintian catches syntax errors in + manpages. Prevent it by checking manpages as a part of testsuite. -- comp: split the compress function - - It is now made into two separate compress and decompress functions. In - preparation for upcoming further modficications. +- libssh2_banner_set.3: fix nroff syntax mistake -Dan Fandrich (20 Oct 2010) -- Added header file to allow compiling in older environments +Guenter Knauf (10 Sep 2011) +- Use predefined resource compiler macro. -Daniel Stenberg (20 Oct 2010) -- TODO: add a possible new API for SFTP transfers +- Added casts to silent compiler warnings. -- TODO: "New Transport API" added +- Fixed uint64_t printf. -- TODO: add buffering plans +- Fixed macro function signatures. -Simon Josefsson (13 Oct 2010) -- Mention libssh2_channel_get_exit_signal and give kudos. +- NetWare makefile tweaks. -- [Tommy Lindgren brought this change] +- Removed unused var. - Add libssh2_channel_get_exit_signal man page. - - Signed-off-by: Simon Josefsson +- Added 2 samples not mentioned. -- [Tommy Lindgren brought this change] +- Dont build x11 sample with MinGW. - Add libssh2_channel_get_exit_signal. - - Signed-off-by: Simon Josefsson +- Fixed executable file description. -- Add libssh2_free man page and fix typo. +- Removed unused var. -- Add libssh2_free. +- Kill stupid gcc 3.x uninitialized warning. -Daniel Stenberg (11 Oct 2010) -- scp_recv: improved treatment of channel_read() returning zero +- Build all examples. + +- More MinGW makefile tweaks. - As a zero return code from channel_read() is not an error we must make - sure that the SCP functions deal with that properly. channel_read() - always returns 0 if the channel is EOFed already so we check for EOF - after 0-reads to be able to return error properly. + Renamed *.mingw makefiles to GNUmakefile since GNU make picks these + up automatically, and therefore win32/Makefile removed. -- libssh2_session_methods.3: detail what can be asked for +- Removed forgotten WINSOCK_VERSION defines. -- compression: send zlib before none +Daniel Stenberg (9 Sep 2011) +- libssh2_session_startup(3) => libssh2_session_handshake(3) - As the list of algorithms in a preferred order we should send zlib - before none to increase the chances that the server will let us do - compression. + Propagate for the current function in docs and examples. + libssh2_session_startup() is deprecated. -- compress: faster check, better return codes - - In the transport functions we avoid a strcmp() now and just check a - boolean instead. +- libssh2_banner_set => libssh2_session_banner_get - The compress/decompress function's return code is now acknowledged and - used as actual return code in case of failures. + Marked the old function as deprecated. Added the new name in the correct + name space with the same arguments and functionality. -- libssh2_session_handshake: replaces libssh2_session_startup() +- new function: libssh2_session_banner_get - The function libssh2_session_startup() is now considered deprecated due - to the portability issue with the socket argument. - libssh2_session_handshake() is the name of the replacement. - -- libssh2_socket_t: now externally visible + Returns the banner from the server handshake - In preparation for upcominig changes, the libssh2_socket_t type is now - typedef'ed in the public header. + Fixes #226 -- _libssh2_transport_drain: removed - - This function proved not to be used nor useful. +- libssh2.h: bump version to 1.4.0 for new function(s) -- _libssh2_channel_write: don't iterate over transport writes +- remove embedded CVS/svn tags + +- [liuzl brought this change] + + API add:libssh2_sftp_get_channel - When a call to _libssh2_transport_write() succeeds, we must return from - _libssh2_channel_write() to allow the caller to provide the next chunk - of data. + Return the channel of sftp, then caller can + control the channel's behavior. - We cannot move on to send the next piece of data that may already have - been provided in this same function call, as we risk getting EAGAIN for - that and we can't return information both about sent data as well as - EAGAIN. So, by returning short now, the caller will call this function - again with new data to send. - -- _libssh2_transport_write: updated documentation blurb + Signed-off-by: liuzl -- _libssh2_transport_write: remove fprintf remainder +- _libssh2_channel_read: react on errors from receive_window_adjust - Mistake from previous debugging + Previously the function would ignore all errors except for EAGAIN. -- session: improved errors +- sftp_read: extend and clarify the documentation + +- sftp_read: cap the read ahead maximum amount - Replaced -1/SOCKET_NONE errors with appropriate error defines instead. + Now we only go up to LIBSSH2_CHANNEL_WINDOW_DEFAULT*30 bytes SFTP read + ahead, which currently equals 64K*30 == 1966080 bytes. + +- _libssh2_channel_read: fix non-blocking window adjusting - Made the verbose trace output during banner receiving less annoying for - non-blocking sessions. + If EAGAIN is returned when adjusting the receive window, we must not + read from the transport directly until we've finished the adjusting. -- crypt_init: use correct error define +Guenter Knauf (8 Sep 2011) +- Fix for systems which need sys/select.h. -- _libssh2_error: hide EAGAIN for non-blocking sessions +- The files were not gone but renamed ... + +Daniel Stenberg (6 Sep 2011) +- sftp_read: added documenting comment - In an attempt to make the trace output less cluttered for non-blocking - sessions the error function now avoids calling the debug function if the - error is the EAGAIN and the session is non-blocking. + Taken from some recent email conversations I added some descriptions of + the logic in sftp_read() to aid readers. -- agent: use better error defines +- 1.3.1: start the work -- comp_method_zlib_init: use correct error defines +Version 1.3.0 (6 Sep 2011) -- transport: better error codes - - LIBSSH2_SOCKET_NONE (-1) should no longer be used as error code as it is - (too) generic and we should instead use specific and dedicated error - codes to better describe the error. +Daniel Stenberg (6 Sep 2011) +- Makefile.am: the Makefile.win32 files are gone -- channel: return code and _libssh2_error cleanup - - Made sure that all transport_write() call failures get _libssh2_error - called. +- RELEASE-NOTES: updated for 1.3.0 -- _libssh2_channel_write: limit to 32700 bytes +- sftp_read: a short read is not end of file - The well known and used ssh server Dropbear has a maximum SSH packet - length at 32768 by default. Since the libssh2 design current have a - fixed one-to-one mapping from channel_write() to the packet size created - by transport_write() the previous limit of 32768 in the channel layer - caused the transport layer to create larger packets than 32768 at times - which Dropbear rejected forcibly (by closing the connection). + A returned READ packet that is short will now only reduce the + offset. - The long term fix is of course to remove the hard relation between the - outgoing SSH packet size and what the input length argument is in the - transport_write() function call. + This is a temporary fix as it is slightly better than the previous + approach but still not very good. -- libssh.h: add more dedicated error codes +- [liuzl brought this change] -- SCP: allow file names with bytes > 126 - - When parsing the SCP protocol and verifying that the data looks like a - valid file name, byte values over 126 must not be consider illegal since - UTF-8 file names will use such codes. + _libssh2_packet_add: adjust window size when truncating - Reported by: Uli Zappe - Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2010-08/0112.shtml + When receiving more data than what the window size allows on a + particular channel, make sure that the window size is adjusted in that + case too. Previously it would only adjust the window in the non-error + case. -Dan Fandrich (25 Aug 2010) -- Document the three sftp stat constants +Guenter Knauf (29 Aug 2011) +- Silent compiler warning with MinGW64. -Guenter Knauf (18 Aug 2010) -- Fixed Win32 makefile which was now broken at resource build. +- Fixed link to native Win32 awk tool. -- It is sufficient to pipe stderr to NUL to get rid of the nasty messages. +- Renamed MinGW makefiles. -- [Author: Guenter Knauf brought this change] +- Some MinGW makefile tweaks. + + Enable build without GNU tools and with MinGW64 compiler. - Removed Win32 ifdef completely for sys/uio.h. +- Fixed aes_ctr_do_cipher() signature. + +Daniel Stenberg (26 Aug 2011) +- [liuzl brought this change] + + libssh2_sftp_seek64: flush packetlist and buffered data + + When seeking to a new position, flush the packetlist and buffered data + to prevent already received or pending data to wrongly get used when + sftp-reading from the new offset within the file. + +- sftp_read: advance offset correctly for buffered copies + + In the case where a read packet has been received from the server, but + the entire contents couldn't be copied to the user-buffer, the data is + instead buffered and copied to the user's buffer in the next invocation + of sftp_read(). When that "extra" copy is made, the 'offset' pointer was + not advanced accordingly. + + The biggest impact of this flaw was that the 'already' variable at the + top of the function that figures out how much data "ahead" that has + already been asked for would slowly go more and more out of sync, which + could lead to the file not being read all the way to the end. + + This problem was most noticable in cases where the application would + only try to read the exact file size amount, like curl does. In the + examples libssh2 provides the sftp read function is most often called + with a fixed size large buffer and then the bug would not appear as + easily. + + This bug was introduced in the SFTP rewrite in 1.2.8. - No idea why we had this ifdef at all but MSVC, MingW32, Watcom - and Borland all have no sys/uio.h header; so if there's another - Win32 compiler which needs it then it should be added explicitely - instead of this negative list. + Bug: http://curl.haxx.se/mail/lib-2011-08/0305.html + http://www.libssh2.org/mail/libssh2-devel-archive-2011-08/0085.shtml -- New files should also be added to Makefile.am. - - Otherwise they will never be included with release and snapshot tarballs ... +- wrap some long lines < 80 columns -Daniel Stenberg (18 Aug 2010) -- version: bump to 1.2.8_DEV +- LIBSSH2_RECV: fix typo, use the RECV_FD macro -Version 1.2.7 (17 Aug 2010) +- subsystem_netconf.c: fix compiler warnings -Daniel Stenberg (17 Aug 2010) -- release: updated to hold 1.2.7 info +- [Henrik Nordstrom brought this change] -Guenter Knauf (17 Aug 2010) -- Use the new libssh2.rc file. + Custom callbacks for performing low level socket I/O -- Added resource file for libssh2.dll (shamelessly stolen from libcurl). +- version bump: start working towards 1.3.0 -- Updated Win32 MSVC dependencies versions. +Version 1.2.9 (16 Aug 2011) -- Added include for sys/select.h to get fd.set on some platforms. +Daniel Stenberg (16 Aug 2011) +- RELEASE-NOTES: synced with 95d69d3a81261 -- Added Watcom makefile borrowed from libcurl. - - This makefile compiles already all files fine for static lib, but needs - final touch when I have OpenSSL fully working with shared libs and Watcom. +- [Henrik Nordstrom brought this change] -- Added copyright define to libssh2.h and use it for binary builds. + Document prototypes for macro defined functions -- Moved version defines up in order to include from .rc file. - - Blocked rest of header with ifndef so its possible to let - the rc compiler only use the version defines. +- [Henrik Nordstrom brought this change] -- Some minor makefile tweaks. + Avoid reuse after free when closing X11 channels -Daniel Stenberg (2 Aug 2010) -- example: treat the libssh2_channel_read() return code properly +- _libssh2_channel_write: handle window_size == 0 better - A short read is not an error. Only negative values are errors! - -- libssh2_wait_socket: reset error code to "leak" EAGAIN less + When about to send data on the channel and the window size is 0, we must + not just return 0 if the transport_read() function returned EAGAIN as it + then causes a busy-loop. - Since libssh2 often sets LIBSSH2_ERROR_EAGAIN internally before - _libssh2_wait_socket is called, we can decrease some amount of - confusion in user programs by resetting the error code in this function - to reduce the risk of EAGAIN being stored as error when a blocking - function returns. + Bug: http://libssh2.org/mail/libssh2-devel-archive-2011-08/0011.shtml -- _libssh2_wait_socket: poll needs milliseconds +- gettimeofday: fix name space pollution - As reported on the mailing list, the code path using poll() should - multiple seconds with 1000 to get milliseconds, not divide! + For systems without its own gettimeofday() implementation, we still must + not provide one outside our namespace. - Reported by: Jan Van Boghout + Reported by: Bill Segall -- typedef: make ssize_t get typedef without LIBSSH2_WIN32 - - The condition around the ssize_t typedef depended on both LIBSSH2_WIN32 - *and* _MSC_VER being defined when it should be enough to depend on - _MSC_VER only. It also makes it nicer so libssh2-using code builds fine - without having custom defines. +Dan Fandrich (5 Aug 2011) +- libssh2.pc.in: Fixed spelling in pkgconfig file -- [John Little brought this change] +Peter Stuge (17 Jul 2011) +- example/subsystem_netconf.c: Add missing #include - session_free: free more data to avoid memory leaks +- example/subsystem_netconf.c: Discard ]]>]]> and return only XML response -- channel_free: ignore problems with channel_close() - - As was pointed out in bug #182, we must not return failure from - _libssh2_channel_free() when _libssh2_channel_close() returns an error - that isn't EAGAIN. It can effectively cause the function to never go - through, like it did now in the case where the socket was actually - closed but socket_state still said LIBSSH2_SOCKET_CONNECTED. - - I consider this fix the right thing as it now also survives other - errors, even if making sure socket_state isn't lying is also a good - idea. +- example/subsystem_netconf.c: Fix uninitialized variable bug -- publickey_list_free: no return value from a void function +- example: Add subsystem_netconf.c - Fixed a compiler warning I introduced previously when checking input - arguments more. I also added a check for the other pointer to avoid NULL - pointer dereferences. - -- [Lars Nordin brought this change] - - openssl: make use of the EVP interface + This example demonstrates how to use libssh2 to send a request to + the NETCONF subsystem available e.g. in JunOS. - Make use of the EVP interface for the AES-funktion. Using this method - supports the use of different ENGINES in OpenSSL for the AES function - (and the direct call to the AES_encrypt should not be used according to - openssl.org) + See also http://tools.ietf.org/html/draft-ietf-netconf-ssh-06 -Peter Stuge (23 Jun 2010) -- [Tor Arntsen brought this change] +Daniel Stenberg (16 Jul 2011) +- man page cleanups: non-existing functions need no man pages - Don't overflow MD5 server hostkey +- libssh2_new_host_entry.3: removed - Use SHA_DIGEST_LENGTH and MD5_DIGEST_LENGTH in memcpy instead of hardcoded - values. An incorrect value was used for MD5. + This is just junk leftovers. -- Fix message length bugs in libssh2_debug() +- userauth_keyboard_interactive: fix buffer overflow - There was a buffer overflow waiting to happen when a debug message was - longer than 1536 bytes. + Partly reverse 566894494b4972ae12 which was simplifying the code far too + much and ended up overflowing a buffer within the LIBSSH2_SESSION + struct. Back to allocating the buffer properly like it used to do. - Thanks to Daniel who spotted that there was a problem with the message - length passed to a trace handler also after commit - 0f0652a3093111fc7dac0205fdcf8d02bf16e89f. + Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2011-06/0032.shtml + Reported by: Alfred Gebert -- Make libssh2_debug() create a correctly terminated string - - Also use FILE *stderr rather than fd 2, which can very well be something - completely different. +- keyboard-interactive man page: cleaned up -Daniel Stenberg (23 Jun 2010) -- [TJ Saunders brought this change] +- [Alfred Gebert brought this change] - handshake: Compression enabled at the wrong time - - In KEXINIT messages, the client and server agree on, among other - things, whether to use compression. This method agreement occurs - in src/kex.c's kex_agree_methods() function. However, if - compression is enabled (either client->server, server->client, or - both), then the compression layer is initialized in - kex_agree_methods() -- before NEWKEYS has been received. - - Instead, the initialization of the compression layer should - happen after NEWKEYS has been received. This looks to occur - insrc/kex.c's diffie_hellman_sha1(), which even has the comment: - - /* The first key exchange has been performed, + _libssh2_recv(): handle ENOENT error as EAGAIN - switch to active crypt/comp/mac mode */ + A sftp session failed with error "failure establishing ssh session" on + Solaris and HP-UX. Sometimes the first recv() function call sets errno + to ENOENT. In the man pages for recv of Solaris and HP-UX the error + ENOENT is not documented. - There, after NEWKEYS is received, the cipher and mac algorithms - are initialized, and that is where the compression should be - initialized as well. + I tested Solaris SPARC and x86, HP-UX i64, AIX, Windows and Linux. + +- agent_list_identities: fix out of scope access - The current implementation fails if server->client compression is - enabled because most server implementations follow OpenSSH's - lead, where compression is initialized after NEWKEYS. Since the - server initializes compression after NEWKEYS, but libssh2 - initializes compression after KEXINIT (i.e. before NEWKEYS), they - are out of sync. + An auto variable out of scope was being referenced and used. - Reported in bug report #180 + fixes #220 -- [TJ Saunders brought this change] +- _libssh2_wait_socket: fix timeouts for poll() uses - userauth_hostbased_fromfile: packet length too short - - The packet length calculated in src/userauth.c's - userauth_hostbased_fromfile() function is too short by 4 bytes; - it forgets to add four bytes for the length of the hostname. - This causes hostbased authentication to fail, since the server - will read junk data. +- windows: inclusion fix - verified against proftpd's mod_sftp module + include winsock2.h for all windows compilers -- _libssh2_userauth_publickey: reject method names longer than the data - - This functions get the method length by looking at the first 32 - bit of data, and I now made it not accept method lengths that are - longer than the whole data set is, as given in the dedicated - function argument. +- keyb-interactive: add the fixed buffer - This was detected when the function was given bogus public key - data as an ascii string, which caused the first 32bits to create - a HUGE number. + Belongs to commit 5668944 -- NULL resistance: make more public functions survive NULL pointer input +- code cleanup: don't use C99/c++ comments - Sending in NULL as the primary pointer is now dealt with by more - public functions. I also narrowed the userauth.c code somewhat to - stay within 80 columns better. + We aim for C89 compliance -- agent: make libssh2_agent_userauth() work blocking properly +- keyb-interactive: allow zero length fields - previously it would always work in a non-blocking manner - -Peter Stuge (17 Jun 2010) -- Fix underscore typo for 64-bit printf format specifiers on Windows + Allow zero length fields so they don't cause malloc(0) calls - Commit 49ddf447ff4bd80285f926eac0115f4e595f9425 was missing underscores. - -Daniel Stenberg (16 Jun 2010) -- libssh2_session_callback_set: extended the man page - -- [John brought this change] + Avoid free()ing NULL pointers + + Avoid a malloc of a fixed 5 byte buffer. - LIBSSH2_DEBUG: macro uses incorrect function variable +- libssh2_channel_process_startup.3: clean up - The LIBSSH2_DEBUG macro, defined in libssh2_priv.h, incorrectly uses the - function variable ssh_msg_disconnect when it should use ssh_msg_debug. + Remove the references to the macro-fied shortcuts as they have their own + individual man pages. - This shows that the LIBSSH2_CALLBACK_DEBUG callback never has worked... + Made the prototype different and more readable. -- warning: fix a compiler warning 'pointer differs in signedness' +- man page: fix .BR lines - As reported in bug #177 + We don't use \fI etc on .BR lines -- portability: introduce LIBSSH2_INT64_T_FORMAT for 64bit printf()s +- userauth_keyboard_interactive: skip code on zero length auth + +- libssh2_channel_forward_accept.3: mention how to get error - As pointed out in bug #177, some of the Windows compilers use - %I64 to output 64 bit variables with the printf family. + Since this returns a pointer, libssh2_session_last_errno() must be used + to get the actual error code and it wasn't that clear before. -- debug: avoid sending NULL to sprintf %s +- timeout docs: mention they're added in 1.2.9 + +- sftp_write_sliding.c: indent fix - Via the _libssh2_debug() macro/function. Pointed out by john in bug report + Use the standard indenting and removed CVS leftover comment -- sftp docs: show macro on macro page, only function on function page +- [zl liu brought this change] + + sftp_write_sliding: send the complete file - The individual man pages for macros now show the full convenience - macro as defined, and then the man page for the actual function - only shows the function. + When reaching the end of file there can still be data left not sent. -- code police: make the code use less than 80 columns +- [Douglas Masterson brought this change] -- libssh2_channel_write_ex: remove macros, added wording on buffer size + session_startup: init state properly + + libssh2_session_startup() didn't set the state correctly so it could get + confused. + + Fixes #218 -- libssh2_sftp_write: document buffer size and changed some ordering +- timeout: added man pages -- libssh2_channel_write_stderr: show how the macro is defined +- BLOCK_ADJUST_ERRNO: move rc to right level + + We can't declare the variable within the block and use it in the final + do-while() expression to be properly portable C89. -- libssh2_channel_write: show how the macro is defined +- [Matt Lilley brought this change] -- SFTP: limit write() to not produce overly large packets + adds a timeout to blocking calls - sftp_write() now limits how much data it gets at a time even more - than before. Since this function creates a complete outgoing - packet based on what gets passed to it, it is crucial that it - doesn't create too large packets. + Fixes bug #160 as per Daniel's suggestion - With this method, there's also no longer any problem to use very - large buffers in your application and feed that to libssh2. I've - done numerous tests now with uploading data over SFTP using 100K - buffers and I've had no problems with that. + Adds libssh2_session_set_timeout() and libssh2_session_get_timeout() -- scp_write_nonblock: add transfer time info +- SCP: fix incorrect error code - Using the same timing logic and output format as - sftp_write_nonblock allows us to very easily run benchmarks on - SCP vs SFTP uploads using libssh2. + After an error occurs in libssh2_scp_recv() or libssh2_scp_send(), the + function libssh2_session_last_error() would return + LIBSSH2_ERROR_SOCKET_NONE on error. + + Bug: http://trac.libssh2.org/ticket/216 + Patch by: "littlesavage" + + Fixes #216 -- sftp_write_nonblock: select() on socket, use *BIG* buffer, time transfer +Guenter Knauf (19 Apr 2011) +- Updated default (recommended) dependency versions. + +Daniel Stenberg (17 Apr 2011) +- libssh2_session_block_directions: fix mistake - The select() is just to make it nicer so that it doesn't - crazy-loop on EAGAIN. The buffer size thing is mostly to verify - that this really work as supposed. + The last LIBSSH2_SESSION_BLOCK_INBOUND should be + LIBSSH2_SESSION_BLOCK_OUTBOUND - Transfer timing is just a minor thing, but it can just as well be - there and help us time and work on performance easier using out - of the box examples. + And I shortened the short description + + Reported by: "drswinghead" -- agent: use _libssh2_error() when returning errors +- msvcproj: added libs and debug stuff - As pointed out in bug report #173, this module basically never - used _libssh2_error() which made it work inconstently with other - parts of the libssh2 code base. This is my first take at making - this code more in line with the rest. + Added libraries needed to link whether using openssl dynamically or + statically + + Added LIBSSH2DEBUG define to debug versions to enable tracing + + URL: http://trac.libssh2.org/ticket/215 + Patch by: Mark Smith -- inputchecks: make lots of API functions check for NULL pointers +- sftp_write: clean offsets on error - If an application accidentally provides a NULL handle pointer to - the channel or sftp public functions, they now return an error - instead of segfaulting. + When an error has occurred on FXP_WRITE, we must make sure that the + offset, sent offset and acked counter are reset properly. -- libssh2_channel_eof: clarify that it returns negative on errors +- example/.gitignore: ignore built binaries -- SFTP: keep the sftp error code as 32 bit +- sftp_write: flush the packetlist on error - 'last_errno' holds to the error code from the SFTP protocol and - since that is 32 bits on the wire there's no point in using a - long for this internally which is larger on some platforms. + When an error occurs during write, flush the entire list of pending + outgoing SFTP packets. -- agent: make the code better deal with unexpected code flows +- keepalive: add first basic man pages - agent->ops gets initialized by the libssh2_agent_connect() call - but we need to make sure that we don't segfault even if a bad - sequence of function calls is used. + Someone on IRC pointed out that we don't have these documented so I + wrote up a first set based on the information in the wiki: + http://trac.libssh2.org/wiki/KeepAlive -Alexander Lamaison (10 Jun 2010) -- Better handling of invalid key files. +- scp_write_nonblock.c: remove pointless check - Passing an invalid public key to libssh2_userauth_publickey_fromfile_ex - triggered an assertion. Replaced this with a runtime check that rejects - obviously invalid key data. - -Daniel Stenberg (10 Jun 2010) -- version: we start working on 1.2.7 now - -Version 1.2.6 (10 Jun 2010) + libssh2_channel_write() cannot return a value that is larger than the + input length value -Daniel Stenberg (10 Jun 2010) -- NEWS: add the 1.2.6 release details +Mikhail Gusarov (9 Apr 2011) +- s/\.NF/.nf/ to fix wrong macro name caught by man --warnings -- RELEASE-NOTES: 1.2.6 details added +Daniel Stenberg (6 Apr 2011) +- version: bump to 1.2.9_dev + + Also update the copyright year range to include 2011 -Guenter Knauf (10 Jun 2010) -- fixed libssh2.dsw to use the generated libssh2.dsp; removed old *.dsp files. +- configure: fix $VERSION + + Stop using the $VERSION variable as it seems to be magically used by + autoconfig itself and thus gets set to the value set in AC_INIT() + without us wanting that. $LIBSSH2VER is now the libssh2 version as + detected. + + Reported by: Paul Howarth + Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2011-04/0008.shtml -- moved MSVC strdup define to libssh2_config.h which we include already. +- maketgz: use git2news.pl by the correct name -- added missing source files to src/NMakefile. +Version 1.2.8 (4 Apr 2011) -Daniel Stenberg (8 Jun 2010) -- libssh2_poll: refer to poll(3) and select(3) instead +Daniel Stenberg (4 Apr 2011) +- RELEASE-NOTES: synced with fabf1a45ee -- example: fix strdup() for MSVC compiles +- NEWS: auto-generated from git - MSVC has a _strdup() that we better use. This was reported in bug + Starting now, the NEWS file is generated from git using the git2news.pl + script. This makes it always accurate and up-to-date, even for daily + snapshots etc. -- SFTP: fail init SFTP if session isn't authenticated +- sftp_write: handle FXP_WRITE errors - Alexander Lamaison filed bug #172 - (http://trac.libssh2.org/ticket/172), and pointed out that SFTP - init would do bad if the session isn't yet authenticated at the - time of the call, so we now check for this situation and returns - an error if detected. Calling sftp_init() at this point is bad - usage to start with. + When an sftp server returns an error back on write, make sure the + function bails out and returns the proper error. -- direct_tcpip: bring back inclusion of libssh2_config.h +- configure: stop using the deprecated AM_INIT_AUTOMAKE syntax + +Alexander Lamaison (13 Mar 2011) +- Support unlimited number of host names in a single line of the known_hosts file. - In order to increase portability of this example, I'm bringing - the inclusion of libssh2_config.h back, and I also added an - require that header for this example to compile. + Previously the code assumed either a single host name or a hostname,ip-address pair. However, according to the spec [1], there can be any number of comma separated host names or IP addresses. - I also made all code lines fit within 80 columns. - -Guenter Knauf (3 Jun 2010) -- cast away a warning. + [1] http://www.openbsd.org/cgi-bin/man.cgi?query=sshd&sektion=8 -- moved CRT_SECURE_NO_DEPRECATE define up so its defined before the winsock headers are included. +Daniel Stenberg (26 Feb 2011) +- libssh2_knownhost_readfile.3: clarify return value + + This function returns the number of parsed hosts on success, not just + zero as previously documented. -- fixed platform detection for MingW32 test makefile. +Peter Stuge (26 Feb 2011) +- Don't save allocated packet size until it has actually been allocated + + The allocated packet size is internal state which needs to match reality + in order to avoid problems. This commit fixes #211. -- MingW32 has gettimeofday() implemented, so proper ifdef this function here. +Daniel Stenberg (21 Feb 2011) +- [Alfred Gebert brought this change] -- removed MSVC ifdef since seems we can use __int64 still with latest headers. + session_startup: manage server data before server identification + + Fix the bug that libssh2 could not connect if the sftp server + sends data before sending the version string. + + http://tools.ietf.org/html/rfc4253#section-4.2 + + "The server MAY send other lines of data before sending the version + string. Each line SHOULD be terminated by a Carriage Return and Line + Feed. Such lines MUST NOT begin with "SSH-", and SHOULD be encoded + in ISO-10646 UTF-8 [RFC3629] (language is not specified). Clients + MUST be able to process such lines." -- changed copyright notice for MinW32 and NetWare binaries. +- [Alfred Gebert brought this change] -- cleaned up MSVC ifdefs which where spreaded over 3 places. + fullpacket: decompression only after init + + The buffer for the decompression (remote.comp_abstract) is initialised + in time when it is needed. With this fix decompression is disabled when + the buffer (remote.comp_abstract) is not initialised. + + Bug: http://trac.libssh2.org/ticket/200 -- added uint8_t typedef for NetWare CLIB platform. +- _libssh2_channel_read: store last error + + When the transport layer returns EAGAIN this function didn't call + _libssh2_error() which made the last_error not get set. -- if the function declaration gets changed the header should be changed too. +- sftp_write: clarified the comment header -- this is MSVC specific and doesnt apply for all Win32 compilers; - the uint8_t typedef clashes with MingW32 headers. +- sftp_read: avoid wrapping counter to insanity + + As pointed out in bug #206, if a second invoke of libssh2_sftp_read() + would shrink the buffer size, libssh2 would go nuts and send out read + requests like crazy. This was due to an unsigned variable turning + "negative" by some wrong math, and that value would be the amount of + data attempt to pre-buffer! + + Bug: http://trac.libssh2.org/ticket/206 -- updated MingW32 makefiles for latest dependency lib versions. +- sftp_packet_read: use 32bit variables for 32bit data -- updated NetWare makefiles for latest dependency lib versions. +- libssh2_sftp_stat_ex.3: cleaned up, extended + + Removed the macros from it as they have their own man pages. + + Added the LIBSSH2_SFTP_ATTRIBUTES struct in here for easier reference. -Dan Fandrich (30 May 2010) -- Fixed compiling with libgcrypt +- sftp_readdir: return error if buffer is too small - A change of parameter types from unsigned long to size_t was - missed in the prototype in libgcrypt.h + If asked to read data into a buffer and the buffer is too small to hold + the data, this function now returns an error instead of as previously + just copy as much as fits. -Daniel Stenberg (28 May 2010) -- statvfs: use libssh2_sftp_statvfs only, no "_ex" +- sftp_symlink: return error if receive buffer too small - As the long-term goal is to get rid of the extensive set of - macros from the API we can just as well start small by not adding - new macros when we add new functions. Therefore we let the - function be libssh2_sftp_statvfs() plainly without using an _ex - suffix. + and clean up some variable type mismatches - I also made it use size_t instead of unsigned int for the string - length as that too is a long-term goal for the API. - -- [Grubsky Grigory brought this change] - - DSP: output lib name typo - -- [Grubsky Grigory brought this change] + Discussion: http://www.libssh2.org/mail/libssh2-devel-archive-2011-01/0001.shtml - win32: provide a uint8_t typedef for better building on windows +- docs: clarify what happens with a too small buffer + + This flaw is subject to change, but I figured it might be valuable to + users of existing code to know how it works. -- agent: win32: fix bad _libssh2_store_str call +- channel_request_pty_size: fix reqPTY_state - As pointed out by Grubsky Grigory , I - made a mistake when I added the _libssh2_store_str() call before - and I made a slightly different patch than what he suggested. - Based purely on taste. - -Peter Stuge (24 May 2010) -- [Joey Degges brought this change] + The state variable isn't properly set so every other call to the + function fails! + + Bug: http://libssh2.org/mail/libssh2-devel-archive-2010-12/0096.shtml + Reported by: Steve Legg - Add libssh2_sftp_statvfs() and libssh2_sftp_fstatvfs() +- data size: cleanup - These can be used to get file system statistics from servers that - support the statvfs@openssh.com and fstatvfs@openssh.com extensions. + Fix 64bit warnings by using (s)size_t and dedicated uint32_t types more. -Alexander Lamaison (22 May 2010) -- [Jose Baars brought this change] +- [Pierre Joye brought this change] - VMS specific: make sure final release can be installed over daily build + ssize_t: proper typedef with MSVC compilers + + As discussed on the mailing list, it was wrong for win64 and using the + VC-provided type is the safest approach instead of second- guessing + which one it should be. -- [Jose Baars brought this change] +Guenter Knauf (22 Dec 2010) +- Updated OpenSSL version. - VMS: small improvement to the man2help utilities +- Expanded tabs to spaces. -Peter Stuge (22 May 2010) +Peter Stuge (21 Dec 2010) - [Joey Degges brought this change] - libssh2_exit and libssh2_sftp_readdir man page fixes - -Daniel Stenberg (21 May 2010) -- spelling: s/sue/use - -Alexander Lamaison (21 May 2010) -- Change magic port number for generic knownhost check. + _libssh2_ntohu64: fix conversion from network bytes to uint64 - libssh2_knownhost_checkp took 0 as a magic port number that indicated - a 'generic' check should be performed. However, 0 is a valid port - number in its own right so this commit changes the magic value to any - negative int. - -Mikhail Gusarov (5 May 2010) -- Add re-discovered copyright holders to COPYING + Cast individual bytes to uint64 to avoid overflow in arithmetic. -- Restoring copyright statements from pre-git era +Daniel Stenberg (20 Dec 2010) +- libssh2_userauth_list: language fix - Eli Fant has contributed fragmenting SFTP requests + "faily" is not a good English word, and I also cleaned up some other minor + mistakes -- Restoring my copyright statements from pre-git era +- crypto: unify the generic functions - keyboard_interactive, 'exit-status' information packet, non-atomic read/write - under FreeBSD, multi-channel operation bugfixes. - -Daniel Stenberg (3 May 2010) -- pedantic: make the code C90 clean - -Peter Stuge (3 May 2010) -- Do proper keyboard-interactive user dialog in the sftp.c example + Added crypto.h that is the unified header to include when using crypto + functionality. It should be the only header that needs to adapt to the + underlying crypto library in use. It provides the set of prototypes that + are library agnostic. -Daniel Stenberg (3 May 2010) -- added to tarball: libssh2_knownhost_checkp.3 +- [Mark Smith brought this change] -- knownhost: support [host]:port in knownhost file + userauth: derive publickey from private - OpenSSH has ways to add hosts to the knownhosts file that include - a specific port number which makes the key associated with only - that specific host+port pair. libssh2 previously did not support - this, and I was forced to add a new function to the API to - properly expose this ability to applications: - libssh2_knownhost_checkp() + Pass a NULL pointer for the publickey parameter of + libssh2_userauth_publickey_fromfile and + libssh2_userauth_hostbased_fromfile functions. In this case, the + functions recompute the public key from the private key file data. - To *add* such hosts to the knownhosts file, you make sure to pass - on the host name in that manner to the libssh2_knownhost_addc() - function. - -- init/exit: mention these were added in 1.2.5 + This is work done by Jean-Louis CHARTON + , then adapted by Mark Smith and + slightly edited further by me Daniel. + + WARNING: this does leave the feature NOT WORKING when libssh2 is built + to use libgcrypt instead of OpenSSL simply due to lack of + implementation. -- libssh2_knownhost_check docs: correct the prototype +- ssh2_echo: Value stored to 'exitcode' is never read -- examples: avoid use of uninitialized variable 'sock' +- _libssh2_packet_add: fix SSH_MSG_DEBUG weirdness + + I believe I may have caused this weird typo style error when I cleaned + up this function a while ago. Corrected now. -- KEX: stop pretending we negotiate language +- uint32: more longs converted to proper types - There was some stub-like parts of an implementation for - implementing kex language negotiation that caused clang-analyzer - to warn and as it did nothing I've now removed the dead code. + I also moved the MAC struct over to the mac.h header file and made sure + that the users of that struct include that file. -- Uninitialized argument +- SFTP: more types to uint32_t + + The 'num_names' field in the SSH_FXP_NAME response is an unsigned 32bit + value so we make sure to treat it like that. -- sftpdir: removed dead assignment +- SFTP: request_ids are uint32_t + + I went over the code and made sure we use uint32_t all over for the + request_id data. It is an unsigned 32bit value on the wire. -- Makefile.am: include the VMS-specific config header as well +- SFTP: store request_id separately in packets + + By using a new separate struct for incoming SFTP packets and not sharing + the generic packet struct, we can get rid of an unused field and add a + new one dedicated for holding the request_id for the incoming + package. As sftp_packet_ask() is called fairly often, a "mere" integer + comparison is MUCH faster than the previous memcmp() of (typically) 5 + bytes. -- [Jose Baars brought this change] +- libssh2_sftp_open_ex: man page extended and cleaned up + + I added the missing documentation for the 'flags' argument. - Add VMS specific libssh2_config.h +- SFTP: unify the READ/WRITE chunk structs -- fix Value stored to 's' is never read warning +- SFTP: fix memory leaks - and moved variable declaration of s to be more local - -- kexinit: simplify the code and avoid scan-build warning + Make sure that we cleanup remainders when the handle is closed and when + the subsystem is shutdown. - Previously it would say "Value stored to 's' is never read" due - fourth increment of 's'. - -Alexander Lamaison (28 Apr 2010) -- Removed unecessary brackets. + Existing flaw: if a single handle sends packets that haven't been + replied to yet at the time when the handle is closed, those packets will + arrive later and end up in the generic packet brigade queue and they + will remain in there until flushed. They will use unnecessary memory, + make things slower and they will ruin the SFTP handling if the + request_id counter ever wraps (highly unlikely to every happen). -- Changed sftp_attrsize macro to a static function. +- sftp_close_handle: packet list is generic + + Fix comment, simplify the loop logic -Daniel Stenberg (28 Apr 2010) -- release: include the VMS-specific files +- sftp_read: pipeline reads + + The SFTP read function now does transfers the same way the SFTP write + function was made to recently: it creates a list of many outgoing + FXP_READ packets that each asks for a small data chunk. The code then + tries to keep sending read request while collecting the acks for the + previous requests and returns the received data. -- sftp_attrsize: protect the macro argument with proper parentheses +- sftp_write: removed unused variable -- ssh2_agent: avoid using 'session' uninitialized on failures +- _libssh2_channel_close: don't call transport read if disconnected + + The loop that waits for remote.close to get set may end up looping + forever since session->socket_state gets set to + LIBSSH2_SOCKET_DISCONNECTED by the packet_add() function called from the + transport_read() function and after having been set to + LIBSSH2_SOCKET_DISCONNECTED, the transport_read() function will only + return 0. + + Bug: http://trac.libssh2.org/ticket/198 -- examples: remove assignments of variable rc that's never used +- libssh2_sftp_seek64: new man page + + Split off libssh2_sftp_seek64 from the libssh2_sftp_seek man page, and + mentioned that we consider the latter deprecated. Also added a mention + about the dangers of doing seek during writing or reading. -- publickey_init: remove useless variable increment +- sftp_seek: fix + + The new SFTP write code caused a regression as the seek function no + longer worked as it didn't set the write position properly. + + It should be noted that seeking is STRONGLY PROHIBITED during upload, as + the upload magic uses two different offset positions and the multiple + outstanding packets etc make them sensitive to change in the midst of + operations. + + This functionality was just verified with the new example code + sftp_append. This bug was filed as bug #202: + + Bug: http://trac.libssh2.org/ticket/202 -- hostkey_method_ssh_rsa_init: remove useless variable increment +- sftp_append: new example doing SFTP append -- packet_x11_open: removed useless variable increment +- MAX_SFTP_OUTGOING_SIZE: 30000 - and made the declaration of a variable more local - -- packet_queue_listener: removed useless variable increment + I ran SFTP upload tests against localhost. It showed that to make the + app reach really good speeds, I needed to do a little code tweak and + change MAX_SFTP_OUTGOING_SIZE from 4000 to 30000. The tests I did before + with the high latency tests didn't show any real difference whatever I + had that size set to. - and made the declaration of a variable more local + This number is the size in bytes that libssh2 cuts off the large input + buffer and sends off as an individual sftp packet. -- sftp_read: move a read_responses array to where its used +- sftp_write_sliding.c: new example - I find that this increases readability since the array is used - only in the function call just immediately below and nowhere - else. - -- sftp_readdir: turn a small array static const and move it + This is an example that is very similar to sftp_write_nonblock.c, with + the exception that this uses + + 1 - a larger upload buffer + + 2 - a sliding buffer mechnism to allow the app to keep sending lots of + data to libssh2 without having to first drain the buffer. + + These are two key issues to make libssh2 SFTP uploads really perform + well at this point in time. -- sftp_attrsize: converted function to a macro +- cpp: s/#elsif/#elif - This way, the macro can evaluate a static number at compile time - for two out of four uses, and it probably runs faster for the - other two cases too. + This looks like a typo as #elsif is not really C... -- sftp_open: deal with short channel_write calls +- _libssh2_channel_write: revert channel_write() use + + The attempts made to have _libssh2_channel_write() accept larger pieces + of data and split up the data by itself into 32700 byte chunks and pass + them on to channel_write() in a loop as a way to do faster operations on + larger data blocks was a failed attempt. + + The reason why it is difficult: + + The API only allows EAGAIN or a length to be returned. When looping over + multiple blocks to get sent, one block can get sent and the next might + not. And yet: when transport_send() has returned EAGAIN we must not call + it again with new data until it has returned OK on the existing data it + is still working on. This makes it a mess and we do get a much easier + job by simply returning the bytes or EAGAIN at once, as in the EAGAIN + case we can assume that we will be called with the same arguments again + and transport_send() will be happy. - This was an old TODO that just wasn't done before. If - channel_write returns short, that is not an error. + Unfortunately, I think we take a small performance hit by not being able + to do this. -- sftp_open: clean up, better check of input data - - The clang-analyzer report made it look into this function and - I've went through it to remove a potential use of an - uninitialized variable and I also added some validation of input - data received from the server. +- ssh2_echo: new example - In general, lots of more code in this file need to validate the - input before assuming it is correct: there are servers out there - that have bugs or just have another idea of how to do the SFTP - protocol. - -- bugfix: avoid using the socket if it failed to create one - -- bugfix: potential use of NULL pointer + This is a new example snippet. The code is largely based on ssh2_exec, + and is written by Tommy Lindgren. I edited it into C90 compliance and to + conform to libssh2 indent style and some more. -- libssh2_userauth_password_ex: clarify errors somewhat +- send_existing: return after send_existing - The errors mentioned in this man page are possible return codes - but not necessarily the only return codes that this can return. + When a piece of data is sent from the send_existing() function we must + make the parent function return afterwards. Otherwise we risk that the + parent function tries to send more data and ends up getting an EGAIN for + that more data and since it can only return one return code it doesn't + return info for the successfully sent data. - Also reformatted the typ prototypes somewhat. + As this change is a regression I now added a larger comment explaining + why it has to work like this. -- examples: fixed and made them more similar +- _libssh2_channel_write: count resent data as written - The channel read/write functions can return 0 in legitimate cases - without it being an error, and we need to loop properly if they - return short. + In the logic that resends data that was kept for that purpose due to a + previous EAGAIN, the data was not counted as sent causing badness. -- [Jose Baars brought this change] +Peter Stuge (13 Nov 2010) +- Use fprintf(stderr, ) instead of write(2, ) for debugging - VMS port of libssh2; changes in the libssh2 common code +- session/transport: Correctly handle when _libssh2_send() returns -EAGAIN -- Makefile: added the two news headers userauth.h and session.h +- src/agent.c: Simplify _libssh2_send() error checking ever so slightly -- cleanup: prefer the internal functions +Daniel Stenberg (12 Nov 2010) +- send/recv: use _libssh2_recv and _libssh2_send now - To get the blocking vs non-blocking to work as smooth as possible - and behave better internally, we avoid using the external - interfaces when calling functions internally. + Starting now, we unconditionally use the internal replacement functions + for send() and recv() - creatively named _libssh2_recv() and + _libssh2_send(). - Renamed a few internal functions to use _libssh2 prefix when not - being private within a file, and removed the libssh2_ for one - that was private within the file. + On errors, these functions return the negative 'errno' value instead of + the traditional -1. This design allows systems that have no "natural" + errno support to not have to invent it. It also means that no code + outside of these two transfer functions should use the errno variable. -- session_free: remove dead code +- channel_write: move some logic to _libssh2_channel_write + + Some checks are better done in _libssh2_channel_write just once per + write instead of in channel_write() since the looping will call the + latter function multiple times per _libssh2_channel_write() invoke. -- libssh2_publickey_init: fixed to work better non-blocking +- sftp_write: handle "left over" acked data - This was triggered by a clang-analyzer complaint that turned out - to be valid, and it made me dig deeper and fix some generic non- - blocking problems I disovered in the code. + The SFTP handle struct now buffers number of acked bytes that haven't + yet been returned. The way this is used is as following: - While cleaning this up, I moved session-specific stuff over to a - new session.h header from the libssh2_priv.h header. + 1. sftp_write() gets called with a buffer of let say size 32000. We + split 32000 into 8 smaller packets and send them off one by one. One of + them gets acked before the function returns so 4000 is returned. + + 2. sftp_write() gets called again a short while after the previous one, + now with a much smaller size passed in to the function. Lets say 8000. + In the mean-time, all of the remaining packets from the previous call + have been acked (7*4000 = 28000). This function then returns 8000 as all + data passed in are already sent and it can't return any more than what + it got passed in. But we have 28000 bytes acked. We now store the + remaining 20000 in the handle->u.file.acked struct field to add up in + the next call. + + 3. sftp_write() gets called again, and now there's a backlogged 20000 + bytes to return as fine and that will get skipped from the beginning + of the buffer that is passed in. -- channel: reduce duplicated free and returns +- sftp_write: polished and simplified - Simplified the code by trying to free data and return on a single - spot. + Removed unnecessary struct fields and state changes within the function. + + Made the loop that checks for ACKs only check chunks that were fully + sent. -- channel: make variables more local +- SCP: on failure, show the numerical error reason - By making 'data' and 'data_len' more local in several places in - this file it will be easier to spot how they are used and we'll - get less risks to accidentally do bad things with them. + By calling libssh2_session_last_errno() -Mikhail Gusarov (24 Apr 2010) -- Fix typos in manpages, catched by Lintian +- SFTP: provide the numerical error reason on failure -Daniel Stenberg (24 Apr 2010) -- channel_request_pty: simplify the code +- SCP: clean up failure treatment - clang-analyzer pointed out how 'data' could be accessed as a NULL - pointer if the wrong state was set, and while I don't see that - happen in real-life the code flow is easier to read and follow by - moving the LIBSSH2_FREE() call into the block that is supposed to - deal with the data pointer anyway. + When SCP send or recv fails, it gets a special message from the server + with a warning or error message included. We have no current API to + expose that message but the foundation is there. Removed unnecessary use + of session struct fields. -- libssh2_channel_process_startup: simplify the code - - clang-analyzer pointed out how 'data' could be accessed as a NULL - pointer if the wrong state was set, and while I don't see that - happen in real-life the code flow is easier to read and follow by - moving the LIBSSH2_FREE() call into the block that is supposed to - deal with the data pointer anyway. +- sftp_write: enlarge buffer to perform better -- sftp_close_handle: add precation to not access NULL pointer +- packets: code cleanup - clang-analyzer pointed this out as a "Pass-by-value argument in - function call is undefined" but while I can't see exactly how - this can ever happen in reality I think a little check for safety - isn't such a bad thing here. + I added size checks in several places. I fixed the code flow to be easier + to read in some places. + + I removed unnecessary zeroing of structs. I removed unused struct fields. -- scp_write_nonblock: Value stored to 'nread' is never read +- LIBSSH2_CALLBACK_MACERROR: clarify return code use -- scp_write: Value stored to 'ptr' is never read +- _libssh2_userauth_publickey: avoid shadowing -- scp_write_nonblock: Value stored to 'ptr' is never read +- packet: avoid shadowing global symbols -- sftp_mkdir: less silly output but show failures +- sftp_readdir: avoid shadowing -- [Jose Baars brought this change] +- shadowing: don't shadow the global compress - VMS port of libssh2 including VMS specific build procedures +- _libssh2_packet_add: turn ifs into a single switch -- two variable types changes, made lines less than 80 columns - - The two variable type changes are only to match type variable - fields actually read from the binary protocol. +- _libssh2_packet_add: check SSH_MSG_GLOBAL_REQUEST packet -- remove check for negative padding_length +- _libssh2_packet_add: SSH_MSG_DEBUG length checks - It was silly, since it is read as an unsigned char... - -- hostkey_method_ssh_dss_init: Value stored to 's' is never read - -- libssh2_banner_set: avoid unnecessary increment and explain code + Verify lengths before using them. Read always_display from the correct + index. Don't copy stuff around just to provide zero-termination of the + strings. -- agent_transact_unix: remove unused variable +- _libssh2_packet_add: SSH_MSG_IGNORE skip memmove + + There's no promise of a zero termination of the data in the callback so + no longer perform ugly operation in order to provide it. -- remove two unnecessary increments +- _libssh2_packet_add: SSH_MSG_DISCONNECT length checks + + Verify lengths before trying to read data. -- more code converted to use _libssh2_store_*() +- indent: break lines at 80 columns -- libssh2_publickey_list_fetch: removed unused variables +- SSH_MSG_CHANNEL_OPEN_FAILURE: used defined values + + We don't like magic numbers in the code. Now the acceptable failure + codes sent in the SSH_MSG_CHANNEL_OPEN_FAILURE message are added as + defined values in the private header file. -- libssh2_publickey_init: remove unused variables +- sftp_write: don't return EAGAIN if no EAGAIN was received + + This function now only returns EAGAIN if a lower layer actually returned + EAGAIN to it. If nothing was acked and no EAGAIN was received, it will + now instead return 0. -- libssh2_scp_send64: added to API to provide large file transfers +- _libssh2_wait_socket: detect nothing-to-wait-for - The previously existing libssh2_scp_send_ex() function has no way - to send files that are larger than 'size_t' which on 32bit - systems mean 4GB. This new API uses a libssh2_int64_t type and - should thus on most modern systems be able to send enormous - files. + If _libssh2_wait_socket() gets called but there's no direction set to + wait for, this causes a "hang". This code now detects this situation, + set a 1 second timeout instead and outputs a debug output about it. -- sftp_init: remove unused variables and assignments +- decomp: remove the free_dest argument + + Since the decompress function ALWAYS returns allocated memory we get a + lot simpler code by removing the ability to return data unallocated. -- libssh2_knownhost_check: Value stored to 'keylen' is never read +- decomp: cleaned off old compression stuff + + I cleared off legacy code from when the compression and decompression + functions were a single unified function. Makes the code easier to read + too. -- hostkey: fix compiler warning +- [TJ Saunders brought this change] -- remove unused variable + decomp: increase decompression buffer sizes -- data types: convert more to use size_t and uint32_t +- [TJ Saunders brought this change] -- channel: variable type cleanups + zlib: Add debug tracing of zlib errors -- cleanups: better binary packet gen, size_t fixes and PACKET_* removal - - I'll introduce a new internal function set named - - _libssh2_store_u32 - _libssh2_store_u64 - _libssh2_store_str - - That can be used all through the library to build binary outgoing - packets. Using these instead of the current approach removes - hundreds of lines from the library while at the same time greatly - enhances readability. I've not yet fully converted everything to - use these functions. - - I've converted LOTS of 'unsigned long' to 'size_t' where - data/string lengths are dealt with internally. This is The Right - Thing and it will help us make the transition to our - size_t-polished API later on as well. - - I'm removing the PACKET_* error codes. They were originally - introduced as a set of separate error codes from the transport - layer, but having its own set of errors turned out to be very - awkward and they were then converted into a set of #defines that - simply maps them to the global libssh2 error codes instead. Now, - I'l take the next logical step and simply replace the PACKET_* - defines with the actual LIBSSH2_ERROR_* defines. It will increase - readability and decrease confusion. +- sftp_packet_read: handle partial reads of the length field - I also separated packet stuff into its own packet.h header file. + SFTP packets come as [32 bit length][payload] and the code didn't + previously handle that the initial 32 bit field was read only partially + when it was read. + +- [Jasmeet Bagga brought this change] -- clarified the return code + kex_agree_hostkey: fix NULL pointer derefence + + While setting up the session, ssh tries to determine the type of + encryption method it can use for the session. This requires looking at + the keys offered by the remote host and comparing these with the methods + supported by libssh2 (rsa & dss). To do this there is an iteration over + the array containing the methods supported by libssh2. + + If there is no agreement on the type of encryption we come to the 3rd + entry of the hostkeyp array. Here hostkeyp is valid but *hostkep is + NULL. Thus when we dereference that in (*hostkeyp)->name there is a + crash -- rename libssh2_error to the correct _libssh2_error +- _libssh2_transport_send: remove dead assignment - We reserve ^libssh2_ for public symbols and we use _libssh2 as - prefix for internal ones. I fixed the intendation of all these - edits with emacs afterwards, which then changed it slightly more - than just _libssh2_error() expressions but I didn't see any - obvious problems. + 'data' isn't accessed beyond this point so there's no need to assign it. -- data type cleanup: made lots of code use size_t etc +- scp_recv: remove dead assignment - A lot of code used 'unsigned long' and the likes when it should - rather just use plain 'int' or use size_t for data lengths. + Instead of assigning a variable we won't read, we now use the more + explicit (void) prefix. -- wait_socket: make c89 compliant and use two fd_sets for select() +- sftp_write: removed superfluous assignment -- sftp_readdir: always zero terminate, detail the return code - - I also added a description for the 'longentry' field which was - previously undocumented! +- bugfix: avoid use of uninitialized value -- sftp_readdir: simplified and bugfixed +- sftp_packet_require: propagate error codes better - This function no longer has any special purpose code for the - single entry case, as it was pointless. + There were some chances that they would cause -1 to get returned by + public functions and as we're hunting down all such occurances and since + the underlying functions do return valuable information the code now + passes back proper return codes better. + +- [Alfred Gebert brought this change] + + fix memory leaks (two times cipher_data) for each sftp session + +- libssh2_userauth_authenticated: make it work as documented - The previous code would overflow the buffers with an off-by-one - in case the file name or longentry data fields received from the - server were exactly as long as the buffer provided to - libssh2_sftp_readdir_ex. + The man page clearly says it returns 1 for "already authenticated" but + the code said non-zero. I changed the code to use 1 now, as that is also + non-zero but it gets the benefit that it now matches the documentation. - We now make sure that libssh2_sftp_readdir_ex() ALWAYS zero - terminate the buffers it fills in. + Using 1 instead of non-zero is better for two reasons: - The function no longer calls the libssh2_* function again, but - properly uses the internal sftp_* instead. + 1. We have the opportunity to introduce other return codes in the future for + things like error and what not. + 2. We don't expose the internal bitmask variable value. -- channel/transport: we now drain the outgoing send buffer when we ignore EAGAIN - - When we ignore the EAGAIN from the transport layer within channel_write, we - now drain the outgoing transport layer buffer so that remainders in that - won't cause any problems in the next invoke of _libssh2_transport_write() +- userauth_keyboard_interactive: fix indent -- channel_write: if data has been sent, don't return EAGAIN - - When sending data in a loop, we must not return EAGAIN if we - managed to send data in an earlier round. This was reported in - bug #126 => http://libssh2.stuge.se/ticket/126 +- [Alfred Gebert brought this change] -Simon Josefsson (14 Apr 2010) -- Fix OpenSSL AES-128-CTR detection. + fix memory leak in userauth_keyboard_interactive() - Patch from Paul Howarth . + First I wanted to free the memory in session_free() but then + I had still memory leaks because in my test case the function + userauth_keyboard_interactive() is called twice. It is called + twice perhaps because the server has this authentication + methods available: publickey,gssapi-with-mic,keyboard-interactive + The keyboard-interactive method is successful. -Daniel Stenberg (13 Apr 2010) -- version in header file now says 1.2.6-DEV +- dist: include sftp.h in dist archives -- 1.2.6: clean the RELEASE-NOTES for next release round +Simon Josefsson (27 Oct 2010) +- Update header to match new function prototype, see c48840ba88. -- NEWS: add the stuff from the version 1.2.5 RELEASE-NOTES +Daniel Stenberg (26 Oct 2010) +- bugfixes: the transport rearrange left some subtle flaws now gone -Version 1.2.5 (13 Apr 2010) +- libssh2_userauth_publickey_fromfile_ex.3: cleaned up looks -Daniel Stenberg (13 Apr 2010) -- channel_close: no longer wait for the SSH_MSG_CHANNEL_CLOSE message +- libssh2_userauth_publickey: add man page - As the packet may simply not arrive we cannot have the close - function wait for it unconditionally. + I found an undocumented public function and we can't have it like + that. The description here is incomplete, but should serve as a template + to allow filling in... -- less code duplication in the poll vs select code flows +- libssh2_sftp_write.3: added blurb about the "write ahead" - libssh2_keepalive_send and libssh2_session_block_directions are - now used outside of the #ifdef blocks. + Documented the new SFTP write concept -- make it C90 compliant +- sftp_close_handle: free any trailing write chunks -- updated with all changes and bugs since 1.2.4 +- _libssh2_channel_write: fix warnings -- Added LIBSSH2_SFTP_S_IS***() macros and updated docs +- SFTP: bufgix, move more sftp stuff to sftp.h - libssh2_sftp_fstat_ex.3 is now extended quite a lot to describe a - lot of the struct and the bits it uses and how to test for them. + The sftp_write function shouldn't assume that the buffer pointer will be + the same in subsequent calls, even if it assumes that the data already + passed in before haven't changed. + + The sftp structs are now moved to sftp.h (which I forgot to add before) -- sftp_init() deal with _libssh2_channel_write() returns short +- SFTP: use multiple outgoing packets when writing - When _libssh2_channel_write() is asked to send off 9 bytes, the - code needs to deal with the situation where less than 9 bytes - were sent off and prepare to send the remaining piece at a later - time. + sftp_write was rewritten to split up outgoing data into multiple packets + and deal with the acks in a more asynchronous manner. This is meant to + help overcome latency and round-trip problems with the SFTP protocol. -- handle a NULL password as if it was "" +- TODO: implemented a lot of the ideas now + +- _libssh2_channel_write: removed 32500 size limit - libssh2_userauth_publickey_fromfile_ex() takes a "passphrase" - but didn't deal with it being set to NULL. + Neither _libssh2_channel_write nor sftp_write now have the 32500 size + limit anymore and instead the channel writing function now has its own + logic to send data in multiple calls until everything is sent. -- Reduce used window sizes by factor 10 +- send_existing: don't tell parent to return when drained - As reported in bug report #166 http://libssh2.stuge.se/ticket/166 - by 'ptjm', the maximum window size must be less crazy for libssh2 - to do better with more server implementations. I did not do any - testing to see how this changes raw SCP performance, but the - maximum window size is still almost 4MB. This also has the upside - that libssh2 will use less memory. + That will just cause unnecessary code execution. -Peter Stuge (28 Mar 2010) -- Correctly clear blocking flag after sending multipart packet +- _libssh2_channel_write: general code cleanup - commit 7317edab61d2179febc38a2c2c4da0b951d74cbc cleared the outbound - blocking bit when send_existing() returned PACKET_NONE and *ret=0, as - opposed to before even calling send_existing(), but because *ret=1 when - sending parts 2..n of an existing packet, the bit would only be cleared - when calling libssh2_transport_write() for a new packet. + simplified the function and removed some unused struct fields + +- _libssh2_transport_send: replaces _libssh2_transport_write - Clear the direction flag after the final part of a packet has been sent. + The new function takes two data areas, combines them and sends them as a + single SSH packet. This allows several functions to allocate and copy + less data. + + I also found and fixed a mixed up use of the compression function + arguments that I introduced in my rewrite in a recent commit. -Daniel Stenberg (24 Mar 2010) -- Added man page for libssh2_knownhost_addc() +- scp_write_nonblock: use select() instead of busyloop - Added mention in libssh2_knownhost_add() docs that - libssh2_knownhost_addc() is the preferred function now. + Make this example nicer by not busylooping. -- at next soname bump remove libssh2_knownhost_add() +- send_existing: clear olen when the data is sent off -- ignore TAGS ("make tags" makes them) +- _libssh2_transport_write: allow 256 extra bytes around the packet -- fix memory leak - - we must not assign the pointer a NULL since it keeps allocated - data and at least parts of an error string +- _libssh2_transport_write: remade to send without malloc -- fixed the pattern for avoiding the poll check +- compress: compression disabled by default - added some comments about known problems with poll on darwin + We now allow libssh2_session_flag() to enable compression with a new + flag and I added documentation for the previous LIBSSH2_FLAG_SIGPIPE + flag which I wasn't really aware of! -- avoid checking for poll on some systems +- comp: split the compress function - darwin and interix are known to have broken poll implementations - so we skip the check on those and thus have them use select - unconditionally + It is now made into two separate compress and decompress functions. In + preparation for upcoming further modficications. -- ignore libssh2.dsp +Dan Fandrich (20 Oct 2010) +- Added header file to allow compiling in older environments -Simon Josefsson (23 Mar 2010) -- Fix logic in "on-the-fly" crypto init. +Daniel Stenberg (20 Oct 2010) +- TODO: add a possible new API for SFTP transfers -- Make sure keepalive is working even when poll is used. +- TODO: "New Transport API" added -- [Paul Querna brought this change] +- TODO: add buffering plans - Use poll when available on blocking API. +Simon Josefsson (13 Oct 2010) +- Mention libssh2_channel_get_exit_signal and give kudos. + +- [Tommy Lindgren brought this change] + + Add libssh2_channel_get_exit_signal man page. Signed-off-by: Simon Josefsson -Peter Stuge (20 Mar 2010) -- Fix speling +- [Tommy Lindgren brought this change] -Daniel Stenberg (19 Mar 2010) -- fix NULL dereference when window adjusting a non-existing channel + Add libssh2_channel_get_exit_signal. - Suyog Jadhav pointed out that when receiving a window adjust to - a channel not found, the code would reference a NULL pointer. - Now it will instead output a message about that fact. + Signed-off-by: Simon Josefsson -Simon Josefsson (19 Mar 2010) -- Fix build problem. +- Add libssh2_free man page and fix typo. -- Eat our own dog food, call libssh2_init and libssh2_exit in the examples. +- Add libssh2_free. -- Fix init/exit logic. Add self-test of it. +Daniel Stenberg (11 Oct 2010) +- scp_recv: improved treatment of channel_read() returning zero + + As a zero return code from channel_read() is not an error we must make + sure that the SCP functions deal with that properly. channel_read() + always returns 0 if the channel is EOFed already so we check for EOF + after 0-reads to be able to return error properly. -Daniel Stenberg (19 Mar 2010) -- fix typo +- libssh2_session_methods.3: detail what can be asked for -Simon Josefsson (19 Mar 2010) -- Add man page for libssh2_init and libssh2_exit. Fix libssh2_exit prototype. +- compression: send zlib before none + + As the list of algorithms in a preferred order we should send zlib + before none to increase the chances that the server will let us do + compression. -- Shorten constant a bit. More documentation. +- compress: faster check, better return codes + + In the transport functions we avoid a strcmp() now and just check a + boolean instead. + + The compress/decompress function's return code is now acknowledged and + used as actual return code in case of failures. -- Fix namespace pollution. +- libssh2_session_handshake: replaces libssh2_session_startup() + + The function libssh2_session_startup() is now considered deprecated due + to the portability issue with the socket argument. + libssh2_session_handshake() is the name of the replacement. -- Add global init/exit points, to do crypto initialization in one place. +- libssh2_socket_t: now externally visible - By Lars Nordin. + In preparation for upcominig changes, the libssh2_socket_t type is now + typedef'ed in the public header. -Daniel Stenberg (14 Mar 2010) -- libssh2 is released under the Modifed BSD license, not GPL +- _libssh2_transport_drain: removed + + This function proved not to be used nor useful. -Alexander Lamaison (14 Mar 2010) -- Add libssh2_knownhost_addc to handle comments. +- _libssh2_channel_write: don't iterate over transport writes - Comments in known_hosts file were not handle properly. They were parsed as - part of the key causing key matching to return a mismatch if the entry had a - comment. This adds a new API function that takes an optional comment and - changes libssh2_knownhost_readline to parse the comment as pass it to the - new function. + When a call to _libssh2_transport_write() succeeds, we must return from + _libssh2_channel_write() to allow the caller to provide the next chunk + of data. - Fixes #164. + We cannot move on to send the next piece of data that may already have + been provided in this same function call, as we risk getting EAGAIN for + that and we can't return information both about sent data as well as + EAGAIN. So, by returning short now, the caller will call this function + again with new data to send. -- Fix gettimeofday to compile with Visual C++ 6. - - Reported by Steven Van Ingelgem. +- _libssh2_transport_write: updated documentation blurb -Simon Josefsson (10 Mar 2010) -- Add. +- _libssh2_transport_write: remove fprintf remainder + + Mistake from previous debugging -- keepalive.c: Fix libssh2_error usage. +- session: improved errors + + Replaced -1/SOCKET_NONE errors with appropriate error defines instead. + + Made the verbose trace output during banner receiving less annoying for + non-blocking sessions. -- Fix typo in last commit. +- crypt_init: use correct error define -- Tidy up build option notice. +- _libssh2_error: hide EAGAIN for non-blocking sessions + + In an attempt to make the trace output less cluttered for non-blocking + sessions the error function now avoids calling the debug function if the + error is the EAGAIN and the session is non-blocking. -- Add entry about keep alive stuff. +- agent: use better error defines -- Add keep-alive support. +- comp_method_zlib_init: use correct error defines -Alexander Lamaison (7 Mar 2010) -- Untabify. +- transport: better error codes + + LIBSSH2_SOCKET_NONE (-1) should no longer be used as error code as it is + (too) generic and we should instead use specific and dedicated error + codes to better describe the error. -- Fix memory leak in libssh2_knownhost_add. +- channel: return code and _libssh2_error cleanup + + Made sure that all transport_write() call failures get _libssh2_error + called. -Daniel Stenberg (6 Mar 2010) -- change 'int' to 'libssh2_socket_t' in the public API for sockets +- _libssh2_channel_write: limit to 32700 bytes + + The well known and used ssh server Dropbear has a maximum SSH packet + length at 32768 by default. Since the libssh2 design current have a + fixed one-to-one mapping from channel_write() to the packet size created + by transport_write() the previous limit of 32768 in the channel layer + caused the transport layer to create larger packets than 32768 at times + which Dropbear rejected forcibly (by closing the connection). + + The long term fix is of course to remove the hard relation between the + outgoing SSH packet size and what the input length argument is in the + transport_write() function call. -- reduce code duplication and return underlying error better +- libssh.h: add more dedicated error codes -- acknowledge when _libssh2_packet_requirev() returns error +- SCP: allow file names with bytes > 126 - when _libssh2_packet_requirev() returns an error when waiting for - SSH_MSG_USERAUTH_SUCCESS or SSH_MSG_USERAUTH_FAILURE, it is an - error and it should be treated as such + When parsing the SCP protocol and verifying that the data looks like a + valid file name, byte values over 126 must not be consider illegal since + UTF-8 file names will use such codes. + + Reported by: Uli Zappe + Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2010-08/0112.shtml -- wrap long lines +Dan Fandrich (25 Aug 2010) +- Document the three sftp stat constants -- polished the phrasing in two error strings +Guenter Knauf (18 Aug 2010) +- Fixed Win32 makefile which was now broken at resource build. -- silence picky compiler warnings +- It is sufficient to pipe stderr to NUL to get rid of the nasty messages. -- silence picky compiler warnings +- [Author: Guenter Knauf brought this change] -- removed libssh2_error()'s forth argument + Removed Win32 ifdef completely for sys/uio.h. - libssh2_error() no longer allocates a string and only accepts a const - error string. I also made a lot of functions use the construct of - return libssh2_error(...) instead of having one call to - libssh2_error() and then a separate return call. In several of those - cases I then also changed the former -1 return code to a more - detailed one - something that I think will not change behaviors - anywhere but it's worth keeping an eye open for any such. + No idea why we had this ifdef at all but MSVC, MingW32, Watcom + and Borland all have no sys/uio.h header; so if there's another + Win32 compiler which needs it then it should be added explicitely + instead of this negative list. -- repaired --enable-debug +- New files should also be added to Makefile.am. + + Otherwise they will never be included with release and snapshot tarballs ... -Simon Josefsson (1 Mar 2010) -- Make ./configure output a summary of build options. +Daniel Stenberg (18 Aug 2010) +- version: bump to 1.2.8_DEV -Daniel Stenberg (1 Mar 2010) -- let the err_msg in the session struct be const too +Version 1.2.7 (17 Aug 2010) -Simon Josefsson (1 Mar 2010) -- Revert #ifdef change that pulled in AES-CTR code when explicitly disabled. +Daniel Stenberg (17 Aug 2010) +- release: updated to hold 1.2.7 info -Daniel Stenberg (1 Mar 2010) -- fix #ifdefs +Guenter Knauf (17 Aug 2010) +- Use the new libssh2.rc file. -- make function match the new proto +- Added resource file for libssh2.dll (shamelessly stolen from libcurl). -Simon Josefsson (1 Mar 2010) -- Improve AES-CTR check. +- Updated Win32 MSVC dependencies versions. -Daniel Stenberg (1 Mar 2010) -- use const to silence a bazillion warnings +- Added include for sys/select.h to get fd.set on some platforms. -Simon Josefsson (1 Mar 2010) -- Use AES-CTR from OpenSSL when available. +- Added Watcom makefile borrowed from libcurl. - Reported by Lars Nordin . + This makefile compiles already all files fine for static lib, but needs + final touch when I have OpenSSL fully working with shared libs and Watcom. -- Make it possible to disable DSA. - - Patch from Lars Nordin . +- Added copyright define to libssh2.h and use it for binary builds. -Peter Stuge (1 Mar 2010) -- Send and receive channel EOF before sending SSH_MSG_CHANNEL_CLOSE +- Moved version defines up in order to include from .rc file. - Sending SSH_MSG_CHANNEL_CLOSE without channel EOF is explicitly allowed - in RFC 4254, but some non-conforming servers will hang or time out when - the channel is closed before EOF. + Blocked rest of header with ifndef so its possible to let + the rc compiler only use the version defines. + +- Some minor makefile tweaks. + +Daniel Stenberg (2 Aug 2010) +- example: treat the libssh2_channel_read() return code properly - Other common clients send and receive EOF before closing, there are no - drawbacks, and some servers need it to work correctly. + A short read is not an error. Only negative values are errors! -Alexander Lamaison (26 Feb 2010) -- Style improvements to knownhost error handling. +- libssh2_wait_socket: reset error code to "leak" EAGAIN less - Made improvements as suggested by Peter Stuge: http://www.libssh2.org/mail/libssh2-devel-archive-2010-02/0161.shtml. + Since libssh2 often sets LIBSSH2_ERROR_EAGAIN internally before + _libssh2_wait_socket is called, we can decrease some amount of + confusion in user programs by resetting the error code in this function + to reduce the risk of EAGAIN being stored as error when a blocking + function returns. -- Call libssh2_error for every knownhost API failure. +- _libssh2_wait_socket: poll needs milliseconds - The libssh2 API calls should set the last error code and a message when - returning a failure by calling libssh2_error. This changeset adds these - calls to the libssh2_knownhost_* API as well as libssh2_base64_decode. + As reported on the mailing list, the code path using poll() should + multiple seconds with 1000 to get milliseconds, not divide! - This change also makes libssh2_error into a function rather than a macro. - Its implementation is moved to misc.c. This function returns the error - code passed to it allowing callers to return the error value directly - without duplicating the error code. + Reported by: Jan Van Boghout -- Fix LIBSSH2_ALLOC checks. +- typedef: make ssize_t get typedef without LIBSSH2_WIN32 - These appear to be cut-and paste errors where the wrong variable is checked - for NULLness after calling LIBSSH2_ALLOC. + The condition around the ssize_t typedef depended on both LIBSSH2_WIN32 + *and* _MSC_VER being defined when it should be enough to depend on + _MSC_VER only. It also makes it nicer so libssh2-using code builds fine + without having custom defines. -Simon Josefsson (23 Feb 2010) -- Silence compiler warning. +- [John Little brought this change] -- Make it portable; test uses = for string comparison (not ==). Indent. + session_free: free more data to avoid memory leaks -Alexander Lamaison (22 Feb 2010) -- libssh2_knownhost_del: fix write to freed memory. +- channel_free: ignore problems with channel_close() - When removing a known host, libssh2_knownhost_del would remove the node from the linked list, free its memory and then overwrite the struct parameter (which indicated which node to remove) with 0. However, this struct is actually allocated within the just-freed node meaning we're writing to freed memory. This made Windows very upset. + As was pointed out in bug #182, we must not return failure from + _libssh2_channel_free() when _libssh2_channel_close() returns an error + that isn't EAGAIN. It can effectively cause the function to never go + through, like it did now in the case where the socket was actually + closed but socket_state still said LIBSSH2_SOCKET_CONNECTED. - The fix is simply to overwrite the struct first before freeing the memory. - -Daniel Stenberg (21 Feb 2010) -- show more verbose error when SCP send fails - -- libssh2_socket_t is done, a library-free function is needed + I consider this fix the right thing as it now also survives other + errors, even if making sure socket_state isn't lying is also a good + idea. -- clarify that this frees all data associated with a session +- publickey_list_free: no return value from a void function + + Fixed a compiler warning I introduced previously when checking input + arguments more. I also added a check for the other pointer to avoid NULL + pointer dereferences. -- improved error handling +- [Lars Nordin brought this change] -- add missing libssh2_error() calls + openssl: make use of the EVP interface - To make sure the public API is functional and that the - BLOCK_ADJUST_ERRNO() macro works correctly we MUST make sure to - call libssh2_error() when we return errors. + Make use of the EVP interface for the AES-funktion. Using this method + supports the use of different ENGINES in OpenSSL for the AES function + (and the direct call to the AES_encrypt should not be used according to + openssl.org) -- fix memory leak in userauth_keyboard_interactive() +Peter Stuge (23 Jun 2010) +- [Tor Arntsen brought this change] + + Don't overflow MD5 server hostkey - Mr anonymous in bug #125 pointed out that the userauth_keyboard_interactive() - function does in fact assign the same pointer a second time to a new allocated - buffer without properly freeing the previous one, which caused a memory leak. + Use SHA_DIGEST_LENGTH and MD5_DIGEST_LENGTH in memcpy instead of hardcoded + values. An incorrect value was used for MD5. -- added missing error codes +- Fix message length bugs in libssh2_debug() - To allow the libssh2_session_last_error() function to work as - documented, userauth_password() now better makes sure to call - libssh2_error() everywhere before it returns error. + There was a buffer overflow waiting to happen when a debug message was + longer than 1536 bytes. - Pointed out by mr anonymous in bug #128 + Thanks to Daniel who spotted that there was a problem with the message + length passed to a trace handler also after commit + 0f0652a3093111fc7dac0205fdcf8d02bf16e89f. -Peter Stuge (16 Feb 2010) -- Fix resource and memory leaks in examples as reported by cppcheck +- Make libssh2_debug() create a correctly terminated string - Thanks to Ettl Martin for the report and patch. This fixes #132 + Also use FILE *stderr rather than fd 2, which can very well be something + completely different. -Daniel Stenberg (15 Feb 2010) -- mention the new man pages for macros +Daniel Stenberg (23 Jun 2010) +- [TJ Saunders brought this change] -- added man pages for API macros + handshake: Compression enabled at the wrong time - all #defined macros in the public headers are considered to be part - of the API and I've generated individual man pages for each of them - to A) make it easier to figure out what each function/macro actually - is for so that automated lookups work better and for B) make sure we - have all public functions document (both macros and functions) to - make it easier for us to work away from all the macros in a future - release. - -- Committed the patch by Yoichi Iwaki in bug #2929647 + In KEXINIT messages, the client and server agree on, among other + things, whether to use compression. This method agreement occurs + in src/kex.c's kex_agree_methods() function. However, if + compression is enabled (either client->server, server->client, or + both), then the compression layer is initialized in + kex_agree_methods() -- before NEWKEYS has been received. - Committed the patch by Yoichi Iwaki in bug #2929647, which fixed a memory - leak when an 'outbuf' was still allocated when a session was freed. - -- free "outbuf" when killing a session + Instead, the initialization of the compression layer should + happen after NEWKEYS has been received. This looks to occur + insrc/kex.c's diffie_hellman_sha1(), which even has the comment: - Fix memoary leak: if there was an "output" still allocated when a - session was torn down it needs to be freed in session_free() + /* The first key exchange has been performed, - Patch by Yoichi Iwaki in bug #2929647 - -- the working version name is now 1.2.5_DEV - -Version 1.2.4 (13 Feb 2010) - -Daniel Stenberg (13 Feb 2010) -- updated info for 1.2.4 - -Dan Fandrich (10 Feb 2010) -- Allow compiling with OpenSSL when AES isn't available. - -Peter Stuge (9 Feb 2010) -- [Dave McCaldon brought this change] - - Fix Tru64 socklen_t compile issue with example/direct_tcpip.c + switch to active crypt/comp/mac mode */ - Building libssh2-1.2.3 on Tru64 fails at line 48 and 166 because socklen_t - isn't defined on Tru64 unless _POSIX_PII_SOCKET is defined. + There, after NEWKEYS is received, the cipher and mac algorithms + are initialized, and that is where the compression should be + initialized as well. - This patch updates configure.ac to add -D_POSIX_PII_SOCKET when building - on Tru64 platform(s). + The current implementation fails if server->client compression is + enabled because most server implementations follow OpenSSH's + lead, where compression is initialized after NEWKEYS. Since the + server initializes compression after NEWKEYS, but libssh2 + initializes compression after KEXINIT (i.e. before NEWKEYS), they + are out of sync. + + Reported in bug report #180 -- [Dave McCaldon brought this change] +- [TJ Saunders brought this change] - Resolve compile issues on Solaris x64 and UltraSPARC + userauth_hostbased_fromfile: packet length too short - Solaris builds of libssh2-1.2.3 failed on both x64 and UltraSPARC - platforms because of two problems: + The packet length calculated in src/userauth.c's + userauth_hostbased_fromfile() function is too short by 4 bytes; + it forgets to add four bytes for the length of the hostname. + This causes hostbased authentication to fail, since the server + will read junk data. - 1) src/agent.c:145 sun is a reserved word when using the SUNWspro compiler - 2) example/direct_tcpip.c:84 INADDR_NONE is not defined - -Daniel Stenberg (3 Feb 2010) -- towards 1.2.4 now - -Version 1.2.3 (3 Feb 2010) - -Daniel Stenberg (3 Feb 2010) -- Version 1.2.3 (February 3, 2010) + verified against proftpd's mod_sftp module -- fix building out of source tree by proving better include path +- _libssh2_userauth_publickey: reject method names longer than the data - when building out of source tree, we provide -I$(top_builddir)/example - since the libssh2_config.h gets generated in that dir - -Peter Stuge (1 Feb 2010) -- [Sofian Brabez brought this change] + This functions get the method length by looking at the first 32 + bit of data, and I now made it not accept method lengths that are + longer than the whole data set is, as given in the dedicated + function argument. + + This was detected when the function was given bogus public key + data as an ascii string, which caused the first 32bits to create + a HUGE number. - Replace : in hexdump with " " (two spaces) +- NULL resistance: make more public functions survive NULL pointer input + + Sending in NULL as the primary pointer is now dealt with by more + public functions. I also narrowed the userauth.c code somewhat to + stay within 80 columns better. -- Detect when the forwarded connection is closed in example/direct_tcpip.c +- agent: make libssh2_agent_userauth() work blocking properly + + previously it would always work in a non-blocking manner -- Fix example/direct_tcpip.c to work also on WIN32 +Peter Stuge (17 Jun 2010) +- Fix underscore typo for 64-bit printf format specifiers on Windows - read() and write() are no good for WIN32 sockets, use recv() and send(). + Commit 49ddf447ff4bd80285f926eac0115f4e595f9425 was missing underscores. -- Ignore libssh2_config.h.in and stamp-h2 in example/ and remove .cvsignore +Daniel Stenberg (16 Jun 2010) +- libssh2_session_callback_set: extended the man page -- Simplify WIN32 ifdefs in example/direct_tcpip.c to allow standalone compile +- [John brought this change] -- Always #define INVALID_SOCKET -1 in libssh2_priv.h when not on win32 + LIBSSH2_DEBUG: macro uses incorrect function variable - Fix broken builds since commit abd9bd0bbe631efeada1f54552c70b54e1c490c1 - for all non-win32 platforms. - -- Include hmac-md5 and hmac-md5-96 only if crypto backend supports MD5 - -- Use LIBSSH2_HOSTKEY_HASH_SHA1 instead of _MD5 in examples and tests + The LIBSSH2_DEBUG macro, defined in libssh2_priv.h, incorrectly uses the + function variable ssh_msg_disconnect when it should use ssh_msg_debug. - MD5 support is optional and may not always be available, while SHA1 is both - required and recommended. - -- Update mailing list address in configure.ac to @cool.haxx.se + This shows that the LIBSSH2_CALLBACK_DEBUG callback never has worked... -- Make example/direct_tcpip.c compile for win32 +- warning: fix a compiler warning 'pointer differs in signedness' - One warning from FD_SET() remains, it is also in some other examples. - -- Correctly check for an invalid socket in session_startup() - -- Small documentation fix after Dave's _USERAUTH_FAILURE improvement + As reported in bug #177 -- [Dave McCaldon brought this change] +- portability: introduce LIBSSH2_INT64_T_FORMAT for 64bit printf()s + + As pointed out in bug #177, some of the Windows compilers use + %I64 to output 64 bit variables with the printf family. - Handle SSH_MSG_USERAUTH_FAILURE for password and kbd-int authentication +- debug: avoid sending NULL to sprintf %s - Neither libssh2_userauth_password_ex() nor - libssh2_userauth_keyboard_interactive_ex() would return a login failure - error if the server responded with a SSH_MSG_USERAUTH_FAILURE, instead - you would see whatever previous error had occurred, typically - LIBSSH2_ERROR_EAGAIN. + Via the _libssh2_debug() macro/function. Pointed out by john in bug report + +- sftp docs: show macro on macro page, only function on function page - This patch changes error code -18 to LIBSSH2_ERROR_AUTHENTICATION_FAILED - and makes LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED an alias for - LIBSSH2_ERROR_AUTHENTICATION_FAILED. In addition, new logic in - userauth_password() properly handles SSH_MSG_USERAUTH_FAILURE and both - this function and userauth_keyboard_interactive() now properly return - LIBSSH2_ERROR_AUTHENTICATION_FAILED. + The individual man pages for macros now show the full convenience + macro as defined, and then the man page for the actual function + only shows the function. -Simon Josefsson (28 Jan 2010) -- Fix. +- code police: make the code use less than 80 columns -- Also deal with GLOBAL_REQUEST keep-alives. +- libssh2_channel_write_ex: remove macros, added wording on buffer size -- Make OpenSSH-style keepalive work against libssh2 clients. +- libssh2_sftp_write: document buffer size and changed some ordering -Daniel Stenberg (27 Jan 2010) -- clarified +- libssh2_channel_write_stderr: show how the macro is defined -Peter Stuge (26 Jan 2010) -- [Dave McCaldon brought this change] +- libssh2_channel_write: show how the macro is defined - Fix trace context lookup in libssh2_debug() +- SFTP: limit write() to not produce overly large packets - The trace context is actually a bitmask so that tracing output can be - controlled by setting a bitmask using libssh2_trace(). However, the logic - in libssh2_debug() that converted the context to a string was using the - context value as an array index. Because the code used a bounds check on - the array, there was never a danger of a crash, but you would certainly - either get the wrong string, or "unknown". + sftp_write() now limits how much data it gets at a time even more + than before. Since this function creates a complete outgoing + packet based on what gets passed to it, it is crucial that it + doesn't create too large packets. - This patch adds a lookup that iterates over the context strings and uses - it's index to check for the corresponding bit in the context. - -- Fix typo in RELEASE-NOTES - -Daniel Stenberg (20 Jan 2010) -- updated for 1.2.3 with all the stuff I found in the log - -- ignore more generated files + With this method, there's also no longer any problem to use very + large buffers in your application and feed that to libssh2. I've + done numerous tests now with uploading data over SFTP using 100K + buffers and I've had no problems with that. -- [Dave McCaldon brought this change] +- scp_write_nonblock: add transfer time info + + Using the same timing logic and output format as + sftp_write_nonblock allows us to very easily run benchmarks on + SCP vs SFTP uploads using libssh2. - Pass user context through libssh2_trace_sethandler() to callback +- sftp_write_nonblock: select() on socket, use *BIG* buffer, time transfer - The libssh2_trace_sethandler() call allows the user to handle the output of libssh2 rather than having it written to stderr. This patch updates libssh2_trace_sethandler() to allow a user-defined void* context value to be passed back to the output handler. + The select() is just to make it nicer so that it doesn't + crazy-loop on EAGAIN. The buffer size thing is mostly to verify + that this really work as supposed. + + Transfer timing is just a minor thing, but it can just as well be + there and help us time and work on performance easier using out + of the box examples. -- [Dave McCaldon brought this change] +- agent: use _libssh2_error() when returning errors + + As pointed out in bug report #173, this module basically never + used _libssh2_error() which made it work inconstently with other + parts of the libssh2 code base. This is my first take at making + this code more in line with the rest. - Add libssh2_trace_sethandler() to the API (even more) +- inputchecks: make lots of API functions check for NULL pointers + + If an application accidentally provides a NULL handle pointer to + the channel or sftp public functions, they now return an error + instead of segfaulting. -- [Dave McCaldon brought this change] +- libssh2_channel_eof: clarify that it returns negative on errors - Add libssh2_trace_sethandler() to the API +- SFTP: keep the sftp error code as 32 bit + + 'last_errno' holds to the error code from the SFTP protocol and + since that is 32 bits on the wire there's no point in using a + long for this internally which is larger on some platforms. -- cleanup includes +- agent: make the code better deal with unexpected code flows - We now produce a local libssh2_config.h file in this dir for the - examples to use so I cleaned up the include path at the same time. + agent->ops gets initialized by the libssh2_agent_connect() call + but we need to make sure that we don't segfault even if a bad + sequence of function calls is used. -- generate a libssh2_config.h in the example dir +Alexander Lamaison (10 Jun 2010) +- Better handling of invalid key files. - buildconf copies the template to example/ and configure makes sure - to generate a proper file from it and the direct_tcpip.c example - is the first one to use it - to make sure it builds fine on more - paltforms + Passing an invalid public key to libssh2_userauth_publickey_fromfile_ex + triggered an assertion. Replaced this with a runtime check that rejects + obviously invalid key data. -Simon Josefsson (13 Jan 2010) -- Remove redundant #includes and reorder sys/types.h include. +Daniel Stenberg (10 Jun 2010) +- version: we start working on 1.2.7 now -Daniel Stenberg (10 Jan 2010) -- avoid a free(NULL) +Version 1.2.6 (10 Jun 2010) -Simon Josefsson (7 Jan 2010) -- Make it simpler to get more debug info. +Daniel Stenberg (10 Jun 2010) +- NEWS: add the 1.2.6 release details -Daiki Ueno (1 Jan 2010) -- Simplify the commit 63457dfa using type cast from size_t * to ulong *. +- RELEASE-NOTES: 1.2.6 details added -Alexander Lamaison (30 Dec 2009) -- Fixed memory leak in userauth_publickey(). - - userauth_publickey_fromfile() reads the key from a - file using file_read_publickey() which returns two - allocated strings, the decoded key and the key - method (such as "ssh-dss"). The latter can be - derived from the former but returning both avoids a - later allocation while doing so. - - Older versions of userauth_publickey_fromfile() used - this method string directly but when - userauth_publickey() was factored out of - userauth_publickey_fromfile() it derived the method - from the key itself. This resulted in the method - being allocated twice. - - This fix, which maintains the optimisation that - avoids an extra allocation, changes - userauth_publickey() so it doesn't allocate and - derive the method when userauth_pblc_method already - has a value. - - Signed-off-by: Alexander Lamaison +Guenter Knauf (10 Jun 2010) +- fixed libssh2.dsw to use the generated libssh2.dsp; removed old *.dsp files. -Daiki Ueno (25 Dec 2009) -- Fix the return value description of libssh2_knownhost_free(). +- moved MSVC strdup define to libssh2_config.h which we include already. -- Fix compiler warnings for size_t pointers on 32-bit Windows. +- added missing source files to src/NMakefile. -- Define INVALID_SOCKET and use it instead of SOCKET_BAD. +Daniel Stenberg (8 Jun 2010) +- libssh2_poll: refer to poll(3) and select(3) instead + +- example: fix strdup() for MSVC compiles - Revert the part of previous commit that defines SOCKET_BAD library wide. + MSVC has a _strdup() that we better use. This was reported in bug -- Use libssh2_socket_t in the ssh-agent stuff. - Define a portability macro SOCKET_BAD which means "invalid socket". +- SFTP: fail init SFTP if session isn't authenticated + + Alexander Lamaison filed bug #172 + (http://trac.libssh2.org/ticket/172), and pointed out that SFTP + init would do bad if the session isn't yet authenticated at the + time of the call, so we now check for this situation and returns + an error if detected. Calling sftp_init() at this point is bad + usage to start with. -- Mark/unmark connection to Pageant is open/close. +- direct_tcpip: bring back inclusion of libssh2_config.h + + In order to increase portability of this example, I'm bringing + the inclusion of libssh2_config.h back, and I also added an + require that header for this example to compile. + + I also made all code lines fit within 80 columns. -- Add test to check if the socket is connected. +Guenter Knauf (3 Jun 2010) +- cast away a warning. -Peter Stuge (24 Dec 2009) -- Add libssh2.pc to top-level .gitignore +- moved CRT_SECURE_NO_DEPRECATE define up so its defined before the winsock headers are included. -- Fix publickey authentication regression - - Commit 70b199f47659a74b8778c528beccf893843e5ecb introduced a parsing - bug in file_read_publickey() which made the algorithm name contain an - extra trailing space character, breaking all publickey authentication. +- fixed platform detection for MingW32 test makefile. -- Add a direct-tcpip example which shows local port forwarding +- MingW32 has gettimeofday() implemented, so proper ifdef this function here. -- Add session parameter and LIBSSH2_TRACE_SOCKET to libssh2_trace(3) man page +- removed MSVC ifdef since seems we can use __int64 still with latest headers. -- Add TODO: Expose error messages sent by the server +- changed copyright notice for MinW32 and NetWare binaries. -Daiki Ueno (23 Dec 2009) -- Fix doc comments. +- cleaned up MSVC ifdefs which where spreaded over 3 places. -- Add man pages for ssh-agent API. +- added uint8_t typedef for NetWare CLIB platform. -- Don't request userauthlist after authentication. +- if the function declaration gets changed the header should be changed too. -Simon Josefsson (21 Dec 2009) -- Add. +- this is MSVC specific and doesnt apply for all Win32 compilers; + the uint8_t typedef clashes with MingW32 headers. -- [Daiki Ueno brought this change] +- updated MingW32 makefiles for latest dependency lib versions. - Add an example to use ssh-agent API. - - Signed-off-by: Simon Josefsson +- updated NetWare makefiles for latest dependency lib versions. -- [Daiki Ueno brought this change] +Dan Fandrich (30 May 2010) +- Fixed compiling with libgcrypt + + A change of parameter types from unsigned long to size_t was + missed in the prototype in libgcrypt.h - Add ssh-agent API. +Daniel Stenberg (28 May 2010) +- statvfs: use libssh2_sftp_statvfs only, no "_ex" - Signed-off-by: Simon Josefsson + As the long-term goal is to get rid of the extensive set of + macros from the API we can just as well start small by not adding + new macros when we add new functions. Therefore we let the + function be libssh2_sftp_statvfs() plainly without using an _ex + suffix. + + I also made it use size_t instead of unsigned int for the string + length as that too is a long-term goal for the API. -- [Daiki Ueno brought this change] +- [Grubsky Grigory brought this change] - Add callback-based API for publickey auth. - - Signed-off-by: Simon Josefsson + DSP: output lib name typo -- Move examples from example/simple to example/. +- [Grubsky Grigory brought this change] -- Move examples from example/simple to example/. + win32: provide a uint8_t typedef for better building on windows -Daniel Stenberg (17 Dec 2009) -- _libssh2_list_insert() fixed to work +- agent: win32: fix bad _libssh2_store_str call - While this is code not currently in use, it is part of the generic linked - list code and since I found the error I thought I'd better fix it since we - might bring in this function into the code one day. + As pointed out by Grubsky Grigory , I + made a mistake when I added the _libssh2_store_str() call before + and I made a slightly different patch than what he suggested. + Based purely on taste. -Simon Josefsson (16 Dec 2009) -- Silence compiler warnings. +Peter Stuge (24 May 2010) +- [Joey Degges brought this change] + + Add libssh2_sftp_statvfs() and libssh2_sftp_fstatvfs() - Based on patch by Kamil Dudka in - . + These can be used to get file system statistics from servers that + support the statvfs@openssh.com and fstatvfs@openssh.com extensions. -- [Kamil Dudka brought this change] +Alexander Lamaison (22 May 2010) +- [Jose Baars brought this change] - libgcrypt: simplify code of _libssh2_dsa_sha1_sign - - Signed-off-by: Simon Josefsson + VMS specific: make sure final release can be installed over daily build -- [Kamil Dudka brought this change] +- [Jose Baars brought this change] - libgcrypt: follow-up for ssh-dss padding fix - - Signed-off-by: Simon Josefsson + VMS: small improvement to the man2help utilities -Dan Fandrich (15 Dec 2009) -- Check for the right environment variable in the test app +Peter Stuge (22 May 2010) +- [Joey Degges brought this change] -Simon Josefsson (14 Dec 2009) -- Silence warning about unused function parameter. - - Reported by Steven Van Ingelgem . + libssh2_exit and libssh2_sftp_readdir man page fixes -Daniel Stenberg (10 Dec 2009) -- avoid returning data to memory already freed +Daniel Stenberg (21 May 2010) +- spelling: s/sue/use + +Alexander Lamaison (21 May 2010) +- Change magic port number for generic knownhost check. - In case of failure we must make sure that the data we return - doesn't point to a memory area already freed. Reported anonymously - in the bug report #2910103. + libssh2_knownhost_checkp took 0 as a magic port number that indicated + a 'generic' check should be performed. However, 0 is a valid port + number in its own right so this commit changes the magic value to any + negative int. -Peter Stuge (8 Dec 2009) -- Use LIBSSH2_TRACE_* internally and remove redundant LIBSSH2_DBG_* +Mikhail Gusarov (5 May 2010) +- Add re-discovered copyright holders to COPYING -- Add LIBSSH2_TRACE_SOCKET context for tracing send() and recv() +- Restoring copyright statements from pre-git era - Helpful in debugging the -39 errors. + Eli Fant has contributed fragmenting SFTP requests -- Another transport layer fix for bogus -39 (LIBSSH2_ERROR_BAD_USE) errors - - Commit 683aa0f6b52fb1014873c961709102b5006372fc made send_existing() send - more than just the second part of a packet when the kernel did not accept - the full packet, but the function still overlooked the SSH protocol - overhead in each packet, often 48 bytes. +- Restoring my copyright statements from pre-git era - If only the last few bytes of a packet remained, then the packet would - erroneously be considered completely sent, and the next call to write - more data in the session would return a -39 error. - -Daniel Stenberg (6 Dec 2009) -- move local variable to be more localized + keyboard_interactive, 'exit-status' information packet, non-atomic read/write + under FreeBSD, multi-channel operation bugfixes. -- fixed some indent mistakes +Daniel Stenberg (3 May 2010) +- pedantic: make the code C90 clean -Peter Stuge (6 Dec 2009) -- Fix padding in ssh-dss signature blob encoding - - DSA signatures consist of two 160-bit integers called r and s. In ssh-dss - signature blobs r and s are stored directly after each other in binary - representation, making up a 320-bit (40 byte) string. (See RFC4253 p14.) - - The crypto wrappers in libssh2 would either pack r and s incorrectly, or - fail, when at least one integer was small enough to be stored in 19 bytes - or less. - - The patch ensures that r and s are always stored as two 160 bit numbers. +Peter Stuge (3 May 2010) +- Do proper keyboard-interactive user dialog in the sftp.c example -- Don't always clear write direction blocking flag - - When libssh2_transport_write() is called to continue sending a - partially sent packet the write direction flag must not be cleared - until the previous packet has been completely sent, or the app would - hang if the packet still isn't sent completely, since select() gets - called by the internal blocking emulation layer in libssh2 but would - then not be watching the socket for writability. +Daniel Stenberg (3 May 2010) +- added to tarball: libssh2_knownhost_checkp.3 + +- knownhost: support [host]:port in knownhost file - Clear the flag only once processing of previous packet data is - complete and a new packet is about to be prepared. + OpenSSH has ways to add hosts to the knownhosts file that include + a specific port number which makes the key associated with only + that specific host+port pair. libssh2 previously did not support + this, and I was forced to add a new function to the API to + properly expose this ability to applications: + libssh2_knownhost_checkp() + + To *add* such hosts to the knownhosts file, you make sure to pass + on the host name in that manner to the libssh2_knownhost_addc() + function. -Alexander Lamaison (24 Nov 2009) -- Detabify. +- init/exit: mention these were added in 1.2.5 -- [Daniel Stenberg brought this change] +- libssh2_knownhost_check docs: correct the prototype - Fixed memory leak in sftp_fstat(). +- examples: avoid use of uninitialized variable 'sock' -Simon Josefsson (17 Nov 2009) -- Mark date of 1.2.2 release. +- KEX: stop pretending we negotiate language + + There was some stub-like parts of an implementation for + implementing kex language negotiation that caused clang-analyzer + to warn and as it did nothing I've now removed the dead code. -- Merge branch 'master' of ssh://git.stuge.se/var/lib/git/libssh2 +- Uninitialized argument -Version 1.2.2 (16 Nov 2009) +- sftpdir: removed dead assignment -Daniel Stenberg (16 Nov 2009) -- prepared for 1.2.2 +- Makefile.am: include the VMS-specific config header as well -Simon Josefsson (16 Nov 2009) -- Improve NEWS items. +- [Jose Baars brought this change] -- Support AES-Counter ciphers. + Add VMS specific libssh2_config.h -- Silence compiler warning. +- fix Value stored to 's' is never read warning - Reported by Steven Van Ingelgem - in . - -- Mention libssh2-style.el. + and moved variable declaration of s to be more local -- Use memmove instead of memcpy on overlapping memory areas. +- kexinit: simplify the code and avoid scan-build warning - Reported by Bob Alexander in - . + Previously it would say "Value stored to 's' is never read" due + fourth increment of 's'. -- Add. +Alexander Lamaison (28 Apr 2010) +- Removed unecessary brackets. -- Protect against crash on too small SSH_MSG_IGNORE packets. - - Reported by Bob Alexander - in . +- Changed sftp_attrsize macro to a static function. -- add copyright line +Daniel Stenberg (28 Apr 2010) +- release: include the VMS-specific files -- support arcfour128 cipher per RFC 4345 +- sftp_attrsize: protect the macro argument with proper parentheses -Daniel Stenberg (21 Oct 2009) -- [Cristian Rodríguez brought this change] +- ssh2_agent: avoid using 'session' uninitialized on failures - add support for GCC visibility features +- examples: remove assignments of variable rc that's never used -Simon Josefsson (19 Oct 2009) -- less hard coding of cipher mode in libgcrypt backend +- publickey_init: remove useless variable increment -Daniel Stenberg (18 Oct 2009) -- [Juzna brought this change] +- hostkey_method_ssh_rsa_init: remove useless variable increment - libssh2_channel_forward_accept() and listening fixes +- packet_x11_open: removed useless variable increment - The forward accepting was not done right before, and the - packet_queue_listener function didn't assign a necessary - variable. All fixed by Juzna. I (Daniel) modified the - forward_accept() change somewhat. - -- added man page for libssh2_knownhost_free + and made the declaration of a variable more local -- more CVS => DEV conversions +- packet_queue_listener: removed useless variable increment + + and made the declaration of a variable more local -- remove references to "CVS" +- sftp_read: move a read_responses array to where its used + + I find that this increases readability since the array is used + only in the function call just immediately below and nowhere + else. -- we are on the 1.2.2 track nowadays +- sftp_readdir: turn a small array static const and move it -Peter Stuge (17 Oct 2009) -- Ensure that win32/libssh2.dsp will be generated with CRLF line endings +- sftp_attrsize: converted function to a macro - First, win32/msvcproj.{head,foot} are now committed with CRLF line endings, - and .gitattributes specifies that these should not be changed on checkout or - commit. These are win32 files so it makes sense to store them with native - line endings. + This way, the macro can evaluate a static number at compile time + for two out of four uses, and it probably runs faster for the + other two cases too. + +- sftp_open: deal with short channel_write calls - Second, the rules for generating libssh2.dsp and libssh2.vcproj are changed - so that the full file contents passes through awk, which strips all CR and - then prints each line with one CRLF line ending. Stripping CR is important - to avoid CRCRLF in case the input already comes with CRLF. + This was an old TODO that just wasn't done before. If + channel_write returns short, that is not an error. -Dan Fandrich (29 Sep 2009) -- Make sure permissions on the private host key file is tight enough that - sshd doesn't complain. Quote $srcdir to try to cope with embedded spaces. +- sftp_open: clean up, better check of input data + + The clang-analyzer report made it look into this function and + I've went through it to remove a potential use of an + uninitialized variable and I also added some validation of input + data received from the server. + + In general, lots of more code in this file need to validate the + input before assuming it is correct: there are servers out there + that have bugs or just have another idea of how to do the SFTP + protocol. -Peter Stuge (30 Sep 2009) -- Clarify the scp_write examples slightly and use an octal mask for the mode +- bugfix: avoid using the socket if it failed to create one -Version 1.2.1 (29 Sep 2009) +- bugfix: potential use of NULL pointer -Daniel Stenberg (29 Sep 2009) -- 1.2.1 preparations +- libssh2_userauth_password_ex: clarify errors somewhat + + The errors mentioned in this man page are possible return codes + but not necessarily the only return codes that this can return. + + Also reformatted the typ prototypes somewhat. -- remove ChangeLog and win32/libssh2.dsp only at make distclean +- examples: fixed and made them more similar + + The channel read/write functions can return 0 in legitimate cases + without it being an error, and we need to loop properly if they + return short. -Simon Josefsson (23 Sep 2009) -- Fix shell usage. +- [Jose Baars brought this change] -Daniel Stenberg (22 Sep 2009) -- clarify that the paths are the remote ones + VMS port of libssh2; changes in the libssh2 common code -- let hpux systems build with _REENTRANT defined as well +- Makefile: added the two news headers userauth.h and session.h -- updated to match reality +- cleanup: prefer the internal functions - I went over the commit log and added what I believe is all notable - changes and bugfixes since the 1.2 release + To get the blocking vs non-blocking to work as smooth as possible + and behave better internally, we avoid using the external + interfaces when calling functions internally. + + Renamed a few internal functions to use _libssh2 prefix when not + being private within a file, and removed the libssh2_ for one + that was private within the file. -Peter Stuge (20 Sep 2009) -- Fix scp examples to loop correctly over libssh2_channel_write() +- session_free: remove dead code -- Fix transport layer bug causing invalid -39 (LIBSSH2_ERROR_BAD_USE) errors - - The channel layer sends packets using the transport layer, possibly - calling _libssh2_transport_write() many times for each packet. +- libssh2_publickey_init: fixed to work better non-blocking - The transport layer uses the send_existing() helper to send out any - remaining parts of previous packets before a new packet is started. + This was triggered by a clang-analyzer complaint that turned out + to be valid, and it made me dig deeper and fix some generic non- + blocking problems I disovered in the code. - The bug made send_existing() consider the entire packet sent as soon as it - successfully sent the second part of a packet, even if the packet was not - completely done yet. - -Daniel Stenberg (19 Sep 2009) -- [Neil Gierman brought this change] + While cleaning this up, I moved session-specific stuff over to a + new session.h header from the libssh2_priv.h header. - Added gettimeofday() function for win32 +- channel: reduce duplicated free and returns - Neil Gierman's patch adds a gettimeofday() function for win32 - for the libssh2_trace() functionality. The code originates from - cygwin and was put in the public domain by the author - Danny Smith + Simplified the code by trying to free data and return on a single + spot. -- libssh2_channel_read_ex() must return 0 when closed +- channel: make variables more local - If the channel is already at EOF or even closed at the end of the - libssh2_channel_read_ex() function and there's no data to return, - we need to signal that back. We may have gotten that info while - draining the incoming transport layer until EAGAIN so we must not - be fooled by that return code. - -Dan Fandrich (16 Sep 2009) -- Ignore tags file + By making 'data' and 'data_len' more local in several places in + this file it will be easier to spot how they are used and we'll + get less risks to accidentally do bad things with them. -- Some platforms need sys/socket.h included before netinet/in.h. - Fixed an unused variable compiler warning. +Mikhail Gusarov (24 Apr 2010) +- Fix typos in manpages, catched by Lintian -Daniel Stenberg (16 Sep 2009) -- libssh2_channel_wait_closed() could hang +Daniel Stenberg (24 Apr 2010) +- channel_request_pty: simplify the code - libssh2_channel_wait_closed() had a bad loop waiting for the - channel to close, as it could easily miss the info and then if - the socket would be silent from that moment the funtion would - hang if in blocking-mode or just return EAGAIN wrongly to the - app. The drain-transport loop now correctly checks if the close - has arrived. + clang-analyzer pointed out how 'data' could be accessed as a NULL + pointer if the wrong state was set, and while I don't see that + happen in real-life the code flow is easier to read and follow by + moving the LIBSSH2_FREE() call into the block that is supposed to + deal with the data pointer anyway. -- make libssh2_scp_send/recv do blocking mode correctly +- libssh2_channel_process_startup: simplify the code - Somehow I had completely missed to make the libssh2_scp_send/recv - functions support the blocking mode the correct way so when I - cleaned up things the other day blocking mode broke for them... - Fixed now. - -Guenter Knauf (8 Sep 2009) -- changed NetWare test makefile static link order - -- removed conditional sources from Makefile.inc - added ifdef blocks to libgcrypt.c, pem.c, openssl.c - -Simon Josefsson (7 Sep 2009) -- Fix compilation errors. + clang-analyzer pointed out how 'data' could be accessed as a NULL + pointer if the wrong state was set, and while I don't see that + happen in real-life the code flow is easier to read and follow by + moving the LIBSSH2_FREE() call into the block that is supposed to + deal with the data pointer anyway. -Guenter Knauf (6 Sep 2009) -- some more NetWare build fixes. +- sftp_close_handle: add precation to not access NULL pointer + + clang-analyzer pointed this out as a "Pass-by-value argument in + function call is undefined" but while I can't see exactly how + this can ever happen in reality I think a little check for safety + isn't such a bad thing here. -- some more NetWare makefile fixes. +- scp_write_nonblock: Value stored to 'nread' is never read -- added sys/select.h include to samples for fd_set on NetWare. +- scp_write: Value stored to 'ptr' is never read -- accept CFLAGS from environment. +- scp_write_nonblock: Value stored to 'ptr' is never read -- some more .cvsignore / .gitignore fixes. +- sftp_mkdir: less silly output but show failures -- renamed .cvsignore to .gitignore. +- [Jose Baars brought this change] -- changed conditional into make language. + VMS port of libssh2 including VMS specific build procedures -- changed NetWare and MingW32 makefile to use Makefile.inc. +- two variable types changes, made lines less than 80 columns + + The two variable type changes are only to match type variable + fields actually read from the binary protocol. -Daniel Stenberg (2 Sep 2009) -- CVS leftovers removed +- remove check for negative padding_length + + It was silly, since it is read as an unsigned char... -- libssh2_version() exists since 1.1 +- hostkey_method_ssh_dss_init: Value stored to 's' is never read -Hacki (2 Sep 2009) -- added knownhost.c to makefiles. +- libssh2_banner_set: avoid unnecessary increment and explain code -Alexander Lamaison (2 Sep 2009) -- Pass private-key to OpenSSL as a filename with BIO_new_file(). - - This keeps all FILE* handling on the OpenSSL side of the DLL boundary avoiding crashes on Windows while removing the need for libssh2 to read the private key file into memory. This is now done by OpenSSL which is likely to do a better job of it. +- agent_transact_unix: remove unused variable -Daniel Stenberg (1 Sep 2009) -- generate and install libssh2.pc - - oh these are necessary libssh2.pc changes too +- remove two unnecessary increments -- first take at producing and installing a pkg-config file +- more code converted to use _libssh2_store_*() -- renamed to .ac +- libssh2_publickey_list_fetch: removed unused variables -- renamed to the modern name "configure.ac" +- libssh2_publickey_init: remove unused variables -- always braces and else and brace on the same line removed +- libssh2_scp_send64: added to API to provide large file transfers - I don't follow those particular guidelines myself so I think I'd - rather remove them here and keep my style than the opposite. As - I am the most frequent writer of code for the moment. + The previously existing libssh2_scp_send_ex() function has no way + to send files that are larger than 'size_t' which on 32bit + systems mean 4GB. This new API uses a libssh2_int64_t type and + should thus on most modern systems be able to send enormous + files. -- _libssh2_channel_write() only sends the 32K first bytes - - In theory we could split larger buffers into several smaller - packets to pass to transport_write(), but for now we instead only - deal with the first 32K in this call and assume the app will call - this function again with the rest! The 32K size is a - conservative limit based on the text in RFC4253 section 6.1. +- sftp_init: remove unused variables and assignments -- document _libssh2_channel_write's return code +- libssh2_knownhost_check: Value stored to 'keylen' is never read -- s/libssh2_channel_write_ex/_libssh2_channel_write internally +- hostkey: fix compiler warning -- call libssh2_error() when transport_write() returns EAGAIN - - _libssh2_channel_write() should never return error without - libssh2_error() getting called +- remove unused variable -- clarify that zero can be returned without meaning error +- data types: convert more to use size_t and uint32_t -- remove debug leftovers +- channel: variable type cleanups -- channel_read() was changed to _libssh2_channel_read() as lots of - internal code was changed to use that instead of wrongly using - libssh2_channel_read_ex(). Some files now need to include - channel.h to get this proto. +- cleanups: better binary packet gen, size_t fixes and PACKET_* removal - channel_read() calls libssh2_error() properly on transport_read() - failures + I'll introduce a new internal function set named - channel_read() was adjusted to not "invent" EAGAIN return code in - case the transport_read() didn't return it + _libssh2_store_u32 + _libssh2_store_u64 + _libssh2_store_str - channel_close() now returns 0 or error code, as - documented. Previously it would return number of bytes read in - the last read, which was confusing (and useless). - -- changed all return EAGAIN to return the variable instead + That can be used all through the library to build binary outgoing + packets. Using these instead of the current approach removes + hundreds of lines from the library while at the same time greatly + enhances readability. I've not yet fully converted everything to + use these functions. - I made this change just to easier grep for "return .*EAGAIN" cases - as they should be very rare or done wrongly. Already worked to find - a flaw, marked with "TODO FIXME THIS IS WRONG" in channel.c. I also - fixed a few cases to become more general returns now when we have - more unified return codes internally. - -- _libssh2_channel_write() must not invent EAGAIN situations + I've converted LOTS of 'unsigned long' to 'size_t' where + data/string lengths are dealt with internally. This is The Right + Thing and it will help us make the transition to our + size_t-polished API later on as well. - it is important that only the transport layer can generate EAGAIN - error codes so that we limit where we need to set direction bits - and more. When the local window is too small to send data we simply - stop trying to send and (risk) returning zero in - _libssh2_channel_write() - -- error code cleanup - -- remove all libssh2pack_t leftovers - -- removed the libssh2pack_t type + I'm removing the PACKET_* error codes. They were originally + introduced as a set of separate error codes from the transport + layer, but having its own set of errors turned out to be very + awkward and they were then converted into a set of #defines that + simply maps them to the global libssh2 error codes instead. Now, + I'l take the next logical step and simply replace the PACKET_* + defines with the actual LIBSSH2_ERROR_* defines. It will increase + readability and decrease confusion. - and a minor _libssh2_transport_read() simplification + I also separated packet stuff into its own packet.h header file. -- fix return codes, shortened a very long function name +- clarified the return code -- remove use of libssh2_channel_receive_window_adjust +- rename libssh2_error to the correct _libssh2_error - _libssh2_channel_receive_window_adjust is the new replacement that - is both the correct internal version instead of the external API one, - and it has the return code flaw fixed. I also fixed more return - codes to pass long the correct error found. - -- more proper return codes, added a missing libssh2_error() call + We reserve ^libssh2_ for public symbols and we use _libssh2 as + prefix for internal ones. I fixed the intendation of all these + edits with emacs afterwards, which then changed it slightly more + than just _libssh2_error() expressions but I didn't see any + obvious problems. -- clear socket_block_directions bits before send/recv +- data type cleanup: made lots of code use size_t etc - These two places are the only places where send and recv are called - outside of transport.c so make sure they clear/set the bits correctly. + A lot of code used 'unsigned long' and the likes when it should + rather just use plain 'int' or use size_t for data lengths. -- simplified fullpacket, clarified _libssh2_transport_write() comment +- wait_socket: make c89 compliant and use two fd_sets for select() -- cleaned up _libssh2_packet_add() +- sftp_readdir: always zero terminate, detail the return code - removed some code duplication, changed a few return -1 to return - error codes instead and added a missing libssh2_error() invoke - -- convert return -1 instances to return [proper error code] - -- simplify code by removing code duplication + I also added a description for the 'longentry' field which was + previously undocumented! -- fix several return -1 to return a proper error code +- sftp_readdir: simplified and bugfixed - On many places in the code there have been laziness return -1 - statements lying around that should be fixed to return sensible - error codes. Here's a take at fixing a few offenders. - -- change transport to use unified error codes + This function no longer has any special purpose code for the + single entry case, as it was pointless. - I added three new public error codes, and then modified the return - codes we use in the transport layer to use the generic error codes - so that there won't be any risk of internal confusions due to - different error code sets. - -- changes from int to libssh2_socket_t for sokcets + The previous code would overflow the buffers with an off-by-one + in case the file name or longentry data fields received from the + server were exactly as long as the buffer provided to + libssh2_sftp_readdir_ex. - modified two functions to use libssh2_socket_t instead of int - when referring to a socket descriptor - -- introducing libssh2_socket_t type and fixed iovec for windows + We now make sure that libssh2_sftp_readdir_ex() ALWAYS zero + terminate the buffers it fills in. - Steven Van Ingelgem introduces libssh2_socket_t as a generic socket - type to use internally to avoid compiler warnings and mistakes. Also, - the private struct iovec declaration for windows is now made to look - like the POSIX struct does. - -- linked list changes and minor bug fixes - -- linked list code is now converted to new functions - -- remove superfluous braces and re-indent somewhat + The function no longer calls the libssh2_* function again, but + properly uses the internal sftp_* instead. -- move over lots of code to the _libssh2_list_* functions +- channel/transport: we now drain the outgoing send buffer when we ignore EAGAIN - and I fixed a few minor bugs at the same time - -- converted listeners to the linked list functions + When we ignore the EAGAIN from the transport layer within channel_write, we + now drain the outgoing transport layer buffer so that remainders in that + won't cause any problems in the next invoke of _libssh2_transport_write() -- moved the handling of SFTP handles to new linked list code - - Each SFTP file handle is now handled by the "mother-struct" - using the generic linked list functions. The goal is to move - all custom linked list code to use this set of functions. - - I also moved the list declarations to the misc.h where they - belong and made misc.h no longer include libssh2_priv.h itself - since now libssh2_priv.h needs misc.h... +- channel_write: if data has been sent, don't return EAGAIN - In misc.c I added a #if 0'ed _libssh2_list_insert() function - because I ended up writing one, and I believe we may need it here - too once we move over more stuff to use the _libssh2_list* family. + When sending data in a loop, we must not return EAGAIN if we + managed to send data in an earlier round. This was reported in + bug #126 => http://libssh2.stuge.se/ticket/126 -- correct the comment for _libssh2_list_add() +Simon Josefsson (14 Apr 2010) +- Fix OpenSSL AES-128-CTR detection. - it adds the new node to the _end_ of the list - -Alexander Lamaison (16 Aug 2009) -- [Steven Van Ingelgem brought this change] - - Suppress signed/unsigned comparison warning. - -Daniel Stenberg (11 Aug 2009) -- added contributors from the 1.2 release notes + Patch from Paul Howarth . -Simon Josefsson (11 Aug 2009) -- Need to use $(EXEEXT) on programs in TESTS to fix mingw cross-compiles. +Daniel Stenberg (13 Apr 2010) +- version in header file now says 1.2.6-DEV -Daniel Stenberg (10 Aug 2009) -- start working on 1.2.1 +- 1.2.6: clean the RELEASE-NOTES for next release round -Version 1.2 (10 Aug 2009) +- NEWS: add the stuff from the version 1.2.5 RELEASE-NOTES -Daniel Stenberg (10 Aug 2009) -- Version 1.2 (August 10, 2009) +Version 1.2.5 (13 Apr 2010) -- revert parts of the b95fe985af3c80a2babcaaaf7da69a15b1237c49 commit - - Alexander Lamaison tracked down that my previous commit broke SFTP - reads in some aspects. The reversion now gets back to always recv() - until EAGAIN is returned so that the code no longer treats a short - read as an indication that it is "enough for now". +Daniel Stenberg (13 Apr 2010) +- channel_close: no longer wait for the SSH_MSG_CHANNEL_CLOSE message - The bad commit in particular had another independent change included, - which is to clear the direction-bits first in the transport read - and write functions, but this reversion does not revert that change. - Clearing those bits first is a good thing. + As the packet may simply not arrive we cannot have the close + function wait for it unconditionally. -- Fix some nroff formatting +- less code duplication in the poll vs select code flows - Patch by Sofian Brabez + libssh2_keepalive_send and libssh2_session_block_directions are + now used outside of the #ifdef blocks. -Alexander Lamaison (2 Aug 2009) -- Replaced calls to OpenSSL FILE-pointer functions. - - Passing a FILE* argument across a DLL boundary causes problems on Windows. Instead the keys are read into memory by libssh2 and passed to the OpenSSL functions as BIO* arguments. +- make it C90 compliant -Daniel Stenberg (31 Jul 2009) -- Add missing names - - I went over the NEWS and git log outputs and added all mentioned - contributors through the project's history. I want us to make an - effort to give credit to everyone who contributes, big or small. +- updated with all changes and bugs since 1.2.4 -- fix the C99 variadic macro use for _libssh2_debug() +- Added LIBSSH2_SFTP_S_IS***() macros and updated docs - George Neill pointed out that the C99 vararg marcro use was - wrong, and I edited his suggested patch slightly and unified - both prec99-GCC and C99 into the same macro. - -- Include RELEASE-NOTES in the release package + libssh2_sftp_fstat_ex.3 is now extended quite a lot to describe a + lot of the struct and the bits it uses and how to test for them. -- Release notes for the pending release +- sftp_init() deal with _libssh2_channel_write() returns short - I hope to maintain this file during development so that we also add - changes and bugfixes to it when we change things. Makes the daily - snapshots better and makes less of a hurdle when the release day - comes. + When _libssh2_channel_write() is asked to send off 9 bytes, the + code needs to deal with the situation where less than 9 bytes + were sent off and prepare to send the remaining piece at a later + time. -- bad debugdump() causes SIGSEGV, partial sends not done right +- handle a NULL password as if it was "" - The anonymous bug report #2822910 pointed out that debugdump() was - stupidly called within the send_existing() function. At closer - inspection was the report not only right, but it also revealed - another problem to me: when the _libssh2_send() function returns - after sending only a part of the buffer, it would then misbehave. - This probably is very rare though, which must be the reason we - haven't seen a bigger problem with this. + libssh2_userauth_publickey_fromfile_ex() takes a "passphrase" + but didn't deal with it being set to NULL. -Simon Josefsson (28 Jul 2009) -- Silcen compiler warnings. +- Reduce used window sizes by factor 10 + + As reported in bug report #166 http://libssh2.stuge.se/ticket/166 + by 'ptjm', the maximum window size must be less crazy for libssh2 + to do better with more server implementations. I did not do any + testing to see how this changes raw SCP performance, but the + maximum window size is still almost 4MB. This also has the upside + that libssh2 will use less memory. -Daniel Stenberg (27 Jul 2009) -- added two new issues to fix: socket type and better windowing +Peter Stuge (28 Mar 2010) +- Correctly clear blocking flag after sending multipart packet - * make sure the windowing code adapts better to slow situations so that it - doesn't then use as much memory as today + commit 7317edab61d2179febc38a2c2c4da0b951d74cbc cleared the outbound + blocking bit when send_existing() returned PACKET_NONE and *ret=0, as + opposed to before even calling send_existing(), but because *ret=1 when + sending parts 2..n of an existing packet, the bit would only be cleared + when calling libssh2_transport_write() for a new packet. - * Introduce a 'libssh2_socket_t' type for sockets in internal code + Clear the direction flag after the final part of a packet has been sent. -- remove superfluous check for large packets +Daniel Stenberg (24 Mar 2010) +- Added man page for libssh2_knownhost_addc() - as we're already doing the correct check further down anyway there's no point - in doing the (wrong) check further up as well. Paul Veldkamp pointed this out. - -Simon Josefsson (22 Jul 2009) -- Fix make distcheck problems. - -Daniel Stenberg (18 Jul 2009) -- parts of the previous VS project files commit + Added mention in libssh2_knownhost_add() docs that + libssh2_knownhost_addc() is the preferred function now. -- From: Neil Gierman - - Makefile changes to generate MSVS project files - - - I integrated the libssh2_lib.dsp and libssh2_dll.dsp into a single - libssh2.dsp with different targets for lib vs dll - - Since I run Visual Studio 2008 with VC++9 I did not do vcproj files since - I would have newer vc8proj.head|foot than what others will be running - - My patch only has changes to Makefile.am's. I noticed that Makefile.in's - are included in the daily snapshots but they should be generated from the - .am's - - The 3 new files are msvcproj.head and msvcproj.foot for the beginning and - ending of the dsp file, and a new Makefile.inc that will have the source and - header file names. NOTE: All new source files will need to be added to - Makefile.inc and NOT Makefile.am now. - - I moved the win32 dir before the include dir - - I modified the dsw file so it points to the new libssh2.dsp project file +- at next soname bump remove libssh2_knownhost_add() -- From: Alexander Lamaison - Make the public headers includable on their own +- ignore TAGS ("make tags" makes them) -- From: Steven Van Ingelgem - check first for libtoolize, and then for glibtoolize +- fix memory leak - Mac OS X (and others?) needs this + we must not assign the pointer a NULL since it keeps allocated + data and at least parts of an error string -- Fix knownhost checking of non-hashed hosts +- fixed the pattern for avoiding the poll check - From: Ben Kibbey + added some comments about known problems with poll on darwin -- Fix the functionality again with hashed host names again. +- avoid checking for poll on some systems - The breakage came with commit 8b46528c0476af50a43b6e619f2db318a0cad194. - -- [Peter Stuge brought this change] + darwin and interix are known to have broken poll implementations + so we skip the check on those and thus have them use select + unconditionally - Update mailing list URL to new address +- ignore libssh2.dsp -- const'ify two arguments to libssh2_knownhost_check() +Simon Josefsson (23 Mar 2010) +- Fix logic in "on-the-fly" crypto init. -- Fix compiler warnings appearing with VS2008. Based on Steven Van Ingelgem's - patch in #2787839 with a bunch of additional edits by yours truly. +- Make sure keepalive is working even when poll is used. -- Applied Francois Dupoux's extra checks for weird packet or padding length in - incoming packets. We really need to bail out this way on weird input. - bug report #2814613 +- [Paul Querna brought this change] -- Mark McPherson posted bug report #2815836 pointing out that the custom memory - functions were not given the correct data as argument. This is now fixed even - if I personally don't quite grasp why abstract is passed as a pointer to - pointer all over libssh2... + Use poll when available on blocking API. + + Signed-off-by: Simon Josefsson -- Ben Kibbey added a type parameter to the libssh2_session_hostkey() function, - which hasn't yet been in a public release so changing the API is fine! +Peter Stuge (20 Mar 2010) +- Fix speling -- Guenter Knauf fixed this example to build on win32 +Daniel Stenberg (19 Mar 2010) +- fix NULL dereference when window adjusting a non-existing channel + + Suyog Jadhav pointed out that when receiving a window adjust to + a channel not found, the code would reference a NULL pointer. + Now it will instead output a message about that fact. -- corrected (again) +Simon Josefsson (19 Mar 2010) +- Fix build problem. -- clarify +- Eat our own dog food, call libssh2_init and libssh2_exit in the examples. -- Neil Gierman pointed out in bug report #2809163 that these two files cannot - include the public libssh2.h header as it breaks the compile on window. I'll - adapt to this now, but in the long run I think we should rather fix the - includes so that we _can_ include the public headers properly. +- Fix init/exit logic. Add self-test of it. -- fixed the length check in knownhost_writeline() since <= is actually good - enough when the size includes the trailing zero +Daniel Stenberg (19 Mar 2010) +- fix typo -- After a mention from Ben Kibbey we now let knownhost_writeline() return the - length of the actual data it returns, excluding the trailing zero. I also - updated the man page for libssh2_knownhost_writeline() accordingly. +Simon Josefsson (19 Mar 2010) +- Add man page for libssh2_init and libssh2_exit. Fix libssh2_exit prototype. -- empty line removed +- Shorten constant a bit. More documentation. -- Ben Kibbey fixed the hostline() when parsing lines using only one hostname +- Fix namespace pollution. -- Merge branch 'master' of ssh://bagder@git.stuge.se/var/lib/git/libssh2 +- Add global init/exit points, to do crypto initialization in one place. + + By Lars Nordin. -- Provide a libssh2_scp_send() API for files larger than 4GB (32bit size) +Daniel Stenberg (14 Mar 2010) +- libssh2 is released under the Modifed BSD license, not GPL -- Olivier Hervieu provided this x11 forwarding example. This is the version - after my initial cleanup that I posted to the list on May 26th 2009. It still - has a few ugly spots that should be cleaned up, but until then it's will at - least be found in the repo. For this reason I don't add this to the makefile. +Alexander Lamaison (14 Mar 2010) +- Add libssh2_knownhost_addc to handle comments. + + Comments in known_hosts file were not handle properly. They were parsed as + part of the key causing key matching to return a mismatch if the entry had a + comment. This adds a new API function that takes an optional comment and + changes libssh2_knownhost_readline to parse the comment as pass it to the + new function. + + Fixes #164. -- New man page for libssh2_session_hostkey(3). We probably need to improve this - to also return the type of the key. +- Fix gettimeofday to compile with Visual C++ 6. + + Reported by Steven Van Ingelgem. -- Add check for and use of the _REENTRANT define for Solaris so that libssh2 - is then properly thread-safe on that OS. These autuconf macros are straight - from the cURL project and were mostly written by Yang Tse. They were only - very slightly edited by me when imported to here. +Simon Josefsson (10 Mar 2010) +- Add. -- [Tor Arntsen brought this change] +- keepalive.c: Fix libssh2_error usage. - Ignore generated files +- Fix typo in last commit. -- use the correct #if condition for strtoll(), pointed out in bug report +- Tidy up build option notice. -- define the HAVE_LIBSSH2_KNOWNHOST_API to the version number 1.1.1 to make apps - know that when this define exists, the API exists. And the version number can - be used for run-time checks. 1.1.1 is not likely to be the release version as - I think we'll go with 1.2 instead but 1.1.1 OR LATER should still work. +- Add entry about keep alive stuff. -- libssh2_knownhost_add() got an additional argument: 'store' so that an - application can get a pointer back to the internal representation of the host - it just added. Useful for example when the app wants to add a host, and then - convert that exact same host to a line for storing in a known host file. - 'store' can also be set to NULL to simple not care. +- Add keep-alive support. -- Added a call to libssh2_knownhost_writefile() - - Updated to the slightly modified libssh2_knownhost_check() proto +Alexander Lamaison (7 Mar 2010) +- Untabify. -- "struct libssh2_knownhost" is now part of the internal struct for each known - host so we now only return pointers to structs instead of having the app - allocate a full struct - - I moved the private struct definition into knownhosts.c instead of exposing it - wider in libssh2_priv.h - - I thus modified the proto for two functions that previously used 'struct - libssh2_knownhost *' to receive data. +- Fix memory leak in libssh2_knownhost_add. -- when a host is added, we must make sure the app also provides a key *type* even - though we don't use the type in this function +Daniel Stenberg (6 Mar 2010) +- change 'int' to 'libssh2_socket_t' in the public API for sockets -- Added man pages for the two newest members of the knownhosts API family: - libssh2_knownhost_readline() and libssh2_knownhost_writeline() +- reduce code duplication and return underlying error better -- introducing libssh2_knownhost_writeline() and some cleanups to use more - defined error codes instead of the simplified -1 previously used a little too - much here +- acknowledge when _libssh2_packet_requirev() returns error + + when _libssh2_packet_requirev() returns an error when waiting for + SSH_MSG_USERAUTH_SUCCESS or SSH_MSG_USERAUTH_FAILURE, it is an + error and it should be treated as such -- I think *readline() makes a better name +- wrap long lines -- clarify that the key "string" needs to be zero terminated too +- polished the phrasing in two error strings -- introducing libssh2_knownhost_read() that makes libssh2 read a single given - line - const'ified a few args to libssh2_knownhost_add() as well +- silence picky compiler warnings -- fix a warning for a comparison mixing signed and unsigned types +- silence picky compiler warnings -- After review/feedback/discussions on the mailing list. Rename two functions: +- removed libssh2_error()'s forth argument - s/libssh2_knownhost_parsefile/libssh2_knownhost_readfile - s/libssh2_knownhost_dumpfile/libssh2_knownhost_writefile + libssh2_error() no longer allocates a string and only accepts a const + error string. I also made a lot of functions use the construct of + return libssh2_error(...) instead of having one call to + libssh2_error() and then a separate return call. In several of those + cases I then also changed the former -1 return code to a more + detailed one - something that I think will not change behaviors + anywhere but it's worth keeping an eye open for any such. -- define removed +- repaired --enable-debug -- LIBSSH2_KNOWNHOST_TYPE_DEFAULT is not a good idea, scrap it +Simon Josefsson (1 Mar 2010) +- Make ./configure output a summary of build options. -- Added the initial man pages for the 7 new functions for known host handling +Daniel Stenberg (1 Mar 2010) +- let the err_msg in the session struct be const too -- first shot at implementing libssh2_knownhost_dumpfile() and some minor - cleanups +Simon Josefsson (1 Mar 2010) +- Revert #ifdef change that pulled in AES-CTR code when explicitly disabled. -- introducing libssh2_knownhost_get() to the public API +Daniel Stenberg (1 Mar 2010) +- fix #ifdefs -- clarified a comment +- make function match the new proto -- slighty better behavior and comments +Simon Josefsson (1 Mar 2010) +- Improve AES-CTR check. -- remove include since we don't use struct iovec in this file +Daniel Stenberg (1 Mar 2010) +- use const to silence a bazillion warnings -- These examples no longer need to explictly set the socket to non-blocking state - as libssh2 itself will always do that by itself. +Simon Josefsson (1 Mar 2010) +- Use AES-CTR from OpenSSL when available. + + Reported by Lars Nordin . -- add myself as copyright owner +- Make it possible to disable DSA. + + Patch from Lars Nordin . -- mention conversion of code to the new linked list code +Peter Stuge (1 Mar 2010) +- Send and receive channel EOF before sending SSH_MSG_CHANNEL_CLOSE + + Sending SSH_MSG_CHANNEL_CLOSE without channel EOF is explicitly allowed + in RFC 4254, but some non-conforming servers will hang or time out when + the channel is closed before EOF. + + Other common clients send and receive EOF before closing, there are no + drawbacks, and some servers need it to work correctly. -- remove #if 0'ed code +Alexander Lamaison (26 Feb 2010) +- Style improvements to knownhost error handling. + + Made improvements as suggested by Peter Stuge: http://www.libssh2.org/mail/libssh2-devel-archive-2010-02/0161.shtml. -- clarify the fix, as it wasn't a leak +- Call libssh2_error for every knownhost API failure. + + The libssh2 API calls should set the last error code and a message when + returning a failure by calling libssh2_error. This changeset adds these + calls to the libssh2_knownhost_* API as well as libssh2_base64_decode. + + This change also makes libssh2_error into a function rather than a macro. + Its implementation is moved to misc.c. This function returns the error + code passed to it allowing callers to return the error value directly + without duplicating the error code. -- spell fix a comment +- Fix LIBSSH2_ALLOC checks. + + These appear to be cut-and paste errors where the wrong variable is checked + for NULLness after calling LIBSSH2_ALLOC. -- Added some clarifying comments on how the 'sftpInit_sftp' and - 'sftpInit_channel' struct fields within the session struct are used. And made - sure to clear them both correctly when sftp_init() returns instead of at - shutdown time, as it must not touch them at shutdown time. This should make it - possible to properly make more than one SFTP handle. +Simon Josefsson (23 Feb 2010) +- Silence compiler warning. -- no need for LIBSSH2_ERROR_MEMORY when LIBSSH2_ERROR_ALLOC already exist! - added my own copyright line too now +- Make it portable; test uses = for string comparison (not ==). Indent. -- use LIBSSH2_ERROR_ALLOC instead of introducing a new error code +Alexander Lamaison (22 Feb 2010) +- libssh2_knownhost_del: fix write to freed memory. + + When removing a known host, libssh2_knownhost_del would remove the node from the linked list, free its memory and then overwrite the struct parameter (which indicated which node to remove) with 0. However, this struct is actually allocated within the just-freed node meaning we're writing to freed memory. This made Windows very upset. + + The fix is simply to overwrite the struct first before freeing the memory. -- clear session->sftpInit_sftp unconditionally +Daniel Stenberg (21 Feb 2010) +- show more verbose error when SCP send fails -- Fix my recent session->sftpInit_sftp fix which wasn't correct. The memory area - does not need to be freed (it already gets freed) but clearing the pointer is - a good idea. And it should be done _after_ the channel_free() call. +- libssh2_socket_t is done, a library-free function is needed -- add an assert to help debugging +- clarify that this frees all data associated with a session -- Without CVS we must not use cvs tools to generate the changelog. I'm not - confident enough with git to attempt to make one so I'll just make a dummy for - now. +- improved error handling -- - Anonymous bug report #2795816 revealed that libssh2_sftp_shutdown() did not - properly free/cleanup the SFTP handle so libssh2 leaked memory and caused - an assert() on subsequent libssh2_sftp_init() calls on the same session. +- add missing libssh2_error() calls + + To make sure the public API is functional and that the + BLOCK_ADJUST_ERRNO() macro works correctly we MUST make sure to + call libssh2_error() when we return errors. -- Fix _libssh2_channel_write(): fixed the write loop to also read from the - transport layer better, to avoid draining the window size when sending large - packets. I also fixed the return code for it to return the number of bytes - handled in this single invoke (and not the cumulative amount). +- fix memory leak in userauth_keyboard_interactive() + + Mr anonymous in bug #125 pointed out that the userauth_keyboard_interactive() + function does in fact assign the same pointer a second time to a new allocated + buffer without properly freeing the previous one, which caused a memory leak. -- First, only try to send max packet size *4 to channel write, as trying to send - much larger packages only cause internal problems and much larger allocations. +- added missing error codes - Also fix sftp_write() when _libssh2_channel_write() returns that a packet was - only partially sent as that is not an error. + To allow the libssh2_session_last_error() function to work as + documented, userauth_password() now better makes sure to call + libssh2_error() everywhere before it returns error. - Fixed a few error messages to more accurately point out the problem - -- If recv() returns something less than the full buffer we know we're done for - now, so skip looping and doing another read that then simply will cause an - EAGAIN as it may trick the user into believing things that aren't true. + Pointed out by mr anonymous in bug #128 -daniel (14 May 2009) -- remove the old style as it makes little sense to mention here anymore +Peter Stuge (16 Feb 2010) +- Fix resource and memory leaks in examples as reported by cppcheck + + Thanks to Ettl Martin for the report and patch. This fixes #132 -Daniel Stenberg (12 May 2009) -- typo +Daniel Stenberg (15 Feb 2010) +- mention the new man pages for macros -- comment typo and some indent fixes +- added man pages for API macros + + all #defined macros in the public headers are considered to be part + of the API and I've generated individual man pages for each of them + to A) make it easier to figure out what each function/macro actually + is for so that automated lookups work better and for B) make sure we + have all public functions document (both macros and functions) to + make it easier for us to work away from all the macros in a future + release. -- Partial fix based on the patch and discussions in #2788319 +- Committed the patch by Yoichi Iwaki in bug #2929647 + + Committed the patch by Yoichi Iwaki in bug #2929647, which fixed a memory + leak when an 'outbuf' was still allocated when a session was freed. -- clear the passed in struct when the entry has been removed to help prevent - mistakes due to re-use +- free "outbuf" when killing a session + + Fix memoary leak: if there was an "output" still allocated when a + session was torn down it needs to be freed in session_free() + + Patch by Yoichi Iwaki in bug #2929647 -- use a better example file name for the known_hosts file +- the working version name is now 1.2.5_DEV -- split out the knownhost code from hostkey.c into its own separate source file - now: knownhost.c +Version 1.2.4 (13 Feb 2010) -- this was never supposed to be added for real +Daniel Stenberg (13 Feb 2010) +- updated info for 1.2.4 -- My knownhost work as of right now. It works at least partly. More tests and - tweaks will come. +Dan Fandrich (10 Feb 2010) +- Allow compiling with OpenSSL when AES isn't available. -- get host, user, password and command from the command line +Peter Stuge (9 Feb 2010) +- [Dave McCaldon brought this change] -- Added ssh2_exec as a new example, showing how to run a command remotely with - libssh2 + Fix Tru64 socklen_t compile issue with example/direct_tcpip.c + + Building libssh2-1.2.3 on Tru64 fails at line 48 and 166 because socklen_t + isn't defined on Tru64 unless _POSIX_PII_SOCKET is defined. + + This patch updates configure.ac to add -D_POSIX_PII_SOCKET when building + on Tru64 platform(s). -- bug #2785173 pointed out that we really must call _libssh2_transport_read() - in loops until it returns < 0 when we call it, as if we just call it once we - may drain the socket for data and then leave unused in-memory data that we - won't detect because the socket is back to idle... +- [Dave McCaldon brought this change] -- Markus posted a bug report about a bad 0-return from libssh2_channel_read: - http://libssh2.haxx.se/mail/libssh2-devel-archive-2009-04/0076.shtml + Resolve compile issues on Solaris x64 and UltraSPARC - And it was indeed a bad loop that terminated too early due to a receveived - close packet. - -- remove pointless sleeps + Solaris builds of libssh2-1.2.3 failed on both x64 and UltraSPARC + platforms because of two problems: + + 1) src/agent.c:145 sun is a reserved word when using the SUNWspro compiler + 2) example/direct_tcpip.c:84 INADDR_NONE is not defined -- edited +Daniel Stenberg (3 Feb 2010) +- towards 1.2.4 now -- libssh2_poll() and libssh2_poll_channel_read() are now considered and - documented deprecated and they will be removed at next soname bump. It also - saves us from fixing some rather quirky bugs in libssh2_poll()... +Version 1.2.3 (3 Feb 2010) -Guenter Knauf (9 Apr 2009) -- some minor Makefile tweaks; mainly for crosscompiling. +Daniel Stenberg (3 Feb 2010) +- Version 1.2.3 (February 3, 2010) -Daniel Stenberg (6 Apr 2009) -- Jussi Mononen pointed out we used an unsigned variable to store negative - values in, when a plain int is much better anyway since it matches the return - type. +- fix building out of source tree by proving better include path + + when building out of source tree, we provide -I$(top_builddir)/example + since the libssh2_config.h gets generated in that dir -- and we're now on the 1.1.1 track +Peter Stuge (1 Feb 2010) +- [Sofian Brabez brought this change] -- release 1.1 + Replace : in hexdump with " " (two spaces) -- Sofian Brabez removed duplicate calls to libssh2_session_set_blocking() +- Detect when the forwarded connection is closed in example/direct_tcpip.c -- Uh, it is important that we don't set the local state 'local.close' to TRUE - until _after_ we're done as otherwise we might not get called again properly - to clean the entire thing since the close state is checked in - libssh2_channel_free +- Fix example/direct_tcpip.c to work also on WIN32 + + read() and write() are no good for WIN32 sockets, use recv() and send(). -- Removed the trace output that said "May block until packet of type..." since - it simply wasn't true for non-blocking operations. +- Ignore libssh2_config.h.in and stamp-h2 in example/ and remove .cvsignore -- made sure the SFTP code makes more use of internal non-blocking functions - instead of the external API entries +- Simplify WIN32 ifdefs in example/direct_tcpip.c to allow standalone compile -- Fixed the memory leak in in libssh2_userauth_hostbased_fromfile_ex() that - Jean-Louis Charton found. Additional minor indent and comment edits. +- Always #define INVALID_SOCKET -1 in libssh2_priv.h when not on win32 + + Fix broken builds since commit abd9bd0bbe631efeada1f54552c70b54e1c490c1 + for all non-win32 platforms. -- indent changes and removed libssh2_ prefix from static function +- Include hmac-md5 and hmac-md5-96 only if crypto backend supports MD5 -Yang Tse (28 Mar 2009) -- include libssh2_priv.h instead of libssh2.h in order to get - LIBSSH2_API properly defined on LIBSSH2_WIN32 build targets +- Use LIBSSH2_HOSTKEY_HASH_SHA1 instead of _MD5 in examples and tests + + MD5 support is optional and may not always be available, while SHA1 is both + required and recommended. -Daniel Stenberg (27 Mar 2009) -- Additional non-blocking fixes. +- Update mailing list address in configure.ac to @cool.haxx.se -- Me and my long fingers couldn't resist "merging" these statements in a previous - commit but of course that broke functionality and this is a revert of that - change. +- Make example/direct_tcpip.c compile for win32 + + One warning from FD_SET() remains, it is also in some other examples. -- Dump to stderr simply because the other tracing functions in misc.c already - use stderr and mixing output "channels" causes too much confusion for me! +- Correctly check for an invalid socket in session_startup() -- fixed sftp_shutdown() for the blockiness and fixed libssh2_channel_close() - to work properly non-blocking +- Small documentation fix after Dave's _USERAUTH_FAILURE improvement -- Fixed the order of the check in the BLOCK_ADJUST() macro so that it also works - for libssh2_session_free() +- [Dave McCaldon brought this change] -- kill warnings + Handle SSH_MSG_USERAUTH_FAILURE for password and kbd-int authentication + + Neither libssh2_userauth_password_ex() nor + libssh2_userauth_keyboard_interactive_ex() would return a login failure + error if the server responded with a SSH_MSG_USERAUTH_FAILURE, instead + you would see whatever previous error had occurred, typically + LIBSSH2_ERROR_EAGAIN. + + This patch changes error code -18 to LIBSSH2_ERROR_AUTHENTICATION_FAILED + and makes LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED an alias for + LIBSSH2_ERROR_AUTHENTICATION_FAILED. In addition, new logic in + userauth_password() properly handles SSH_MSG_USERAUTH_FAILURE and both + this function and userauth_keyboard_interactive() now properly return + LIBSSH2_ERROR_AUTHENTICATION_FAILED. -- Fix the BLOCK_ADJUST_ERRNO() macro to behave properly in blocking mode. +Simon Josefsson (28 Jan 2010) +- Fix. -Simon Josefsson (27 Mar 2009) -- Add AC_CONFIG_MACRO_DIR to avoid warnings with libtool v2.2.x. +- Also deal with GLOBAL_REQUEST keep-alives. -Daniel Stenberg (27 Mar 2009) -- fix comments, moved to htonu64 function to sftp.c and made it static +- Make OpenSSH-style keepalive work against libssh2 clients. -- More cleaning up converting libssh2_ to _libssh2_ for internal functions and - removing libssh2_ from static functions. Added mac.h. +Daniel Stenberg (27 Jan 2010) +- clarified -- comp.c only as a single _libssh2_ function, no external one +Peter Stuge (26 Jan 2010) +- [Dave McCaldon brought this change] -- * Renamed the functions in src/transport.c to be _libssh2_transport_ prefixed - and introduced a transport.h header. - - * Fixed the blocking mode to only change behavior not the actual underlying - socket mode so we now always work with non-blocking sockets. This also - introduces a new rule of thumb in libssh2 code: we don't call the - external function calls internally. We use the internal (non-blocking) - ones! + Fix trace context lookup in libssh2_debug() - * libssh2_channel_receive_window_adjust2 was added and - libssh2_channel_receive_window_adjust is now deprecated + The trace context is actually a bitmask so that tracing output can be + controlled by setting a bitmask using libssh2_trace(). However, the logic + in libssh2_debug() that converted the context to a string was using the + context value as an array index. Because the code used a bounds check on + the array, there was never a danger of a crash, but you would certainly + either get the wrong string, or "unknown". - * Introduced "local" header files with prototypes etc for different parts - instead of cramming everything into libssh2_priv.h. channel.h is the - first. - -- avoid some busy-looping - -- one function to remove, one proto to correct - -- Updated comments and removed "libssh2_" prefixes from static functions + This patch adds a lookup that iterates over the context strings and uses + it's index to check for the corresponding bit in the context. -- added basic docs +- Fix typo in RELEASE-NOTES -- quite possibly one of the most pointless functions in the libssh2 API...a +Daniel Stenberg (20 Jan 2010) +- updated for 1.2.3 with all the stuff I found in the log -- ENOTCONN obviously doesn't exist in win32 so don't try to map that +- ignore more generated files -- [no comment] +- [Dave McCaldon brought this change] -- EEK revert the part of the previous commit that was just my non-functional - attempts to make things work with blocking sockets. + Pass user context through libssh2_trace_sethandler() to callback + + The libssh2_trace_sethandler() call allows the user to handle the output of libssh2 rather than having it written to stderr. This patch updates libssh2_trace_sethandler() to allow a user-defined void* context value to be passed back to the output handler. -- I cut out the poll_socket argument from the protos for_libssh2_packet_askv() - and _libssh2_packet_ask() since they are internal and nothing in the code base - uses that functionality == simplicity with no drawbacks! +- [Dave McCaldon brought this change] -- pass in unsigned ints for u32 values and not longs + Add libssh2_trace_sethandler() to the API (even more) -- - (Mar 19 2009) Daniel Stenberg: based on a patch by "E L" we now use errno - properly after recv() and send() calls (that internally are now known as - _libssh2_recv() and _libssh2_send()) so that the API and more works fine on - windows too! +- [Dave McCaldon brought this change] -- I'm upgrading myself! + Add libssh2_trace_sethandler() to the API -Simon Josefsson (17 Mar 2009) -- Add StrictModes=no to work around cygwin problem. - Reported by Yang Tse . +- cleanup includes + + We now produce a local libssh2_config.h file in this dir for the + examples to use so I cleaned up the include path at the same time. -- Add UsePrivilegeSeparation=no for cygwin. - Reported by Yang Tse +- generate a libssh2_config.h in the example dir + + buildconf copies the template to example/ and configure makes sure + to generate a proper file from it and the direct_tcpip.c example + is the first one to use it - to make sure it builds fine on more + paltforms -Daniel Stenberg (17 Mar 2009) -- re-indented for clarity +Simon Josefsson (13 Jan 2010) +- Remove redundant #includes and reorder sys/types.h include. -- re-indented _libssh2_channel_packet_data_len() somewhat to make the huge - condition somewhat easier on the eye +Daniel Stenberg (10 Jan 2010) +- avoid a free(NULL) -- A cleanup effort: libssh2_ prefixes only on external APIs. Use _libssh2_ prefix - for library-wide internal functions. Don't use any of those on static functions. - I also did some comments and whitespace changes. +Simon Josefsson (7 Jan 2010) +- Make it simpler to get more debug info. -- bump packet default size to 32768 +Daiki Ueno (1 Jan 2010) +- Simplify the commit 63457dfa using type cast from size_t * to ulong *. -- Refer to the exact symbol name, which also is the exact file name of the man - page file. +Alexander Lamaison (30 Dec 2009) +- Fixed memory leak in userauth_publickey(). + + userauth_publickey_fromfile() reads the key from a + file using file_read_publickey() which returns two + allocated strings, the decoded key and the key + method (such as "ssh-dss"). The latter can be + derived from the former but returning both avoids a + later allocation while doing so. + + Older versions of userauth_publickey_fromfile() used + this method string directly but when + userauth_publickey() was factored out of + userauth_publickey_fromfile() it derived the method + from the key itself. This resulted in the method + being allocated twice. + + This fix, which maintains the optimisation that + avoids an extra allocation, changes + userauth_publickey() so it doesn't allocate and + derive the method when userauth_pblc_method already + has a value. + + Signed-off-by: Alexander Lamaison -Simon Josefsson (17 Mar 2009) -- Use libtool -export-symbols-regex to reduce numer of exported symbols. +Daiki Ueno (25 Dec 2009) +- Fix the return value description of libssh2_knownhost_free(). -Daniel Stenberg (16 Mar 2009) -- cleanup round +- Fix compiler warnings for size_t pointers on 32-bit Windows. -- Added (templates for) the 13 missing man pages +- Define INVALID_SOCKET and use it instead of SOCKET_BAD. + + Revert the part of previous commit that defines SOCKET_BAD library wide. -- two more renaming of man pages to the actual function name +- Use libssh2_socket_t in the ssh-agent stuff. + Define a portability macro SOCKET_BAD which means "invalid socket". -- rename the man page to use the same name as the actual function +- Mark/unmark connection to Pageant is open/close. -- mention the basic changes in my previous few commits +- Add test to check if the socket is connected. -- Patch from bug report #1960894 by "Heiner" applied, and edited by me. It makes - SCP recv and send deal with file names containing spaces (and other - shell-special letters) by quoting them before they are passed to the remote - server. +Peter Stuge (24 Dec 2009) +- Add libssh2.pc to top-level .gitignore -- fixed some wrong comments and did a minor code edit and some further - whitespace changes +- Fix publickey authentication regression + + Commit 70b199f47659a74b8778c528beccf893843e5ecb introduced a parsing + bug in file_read_publickey() which made the algorithm name contain an + extra trailing space character, breaking all publickey authentication. -- added three more public functions I found lacking man pages +- Add a direct-tcpip example which shows local port forwarding -- fix a compiler warning +- Add session parameter and LIBSSH2_TRACE_SOCKET to libssh2_trace(3) man page -- simplified how the "scp" command line is created in the libssh2_scp_recv() - function +- Add TODO: Expose error messages sent by the server -- Simplified libssh2_channel_read_ex() and made it send window adjustments less - frequent, use a few less struct fields in the channel struct and improved - reading from the network with libssh2_packet_read(). I also modified the - windowing algorithm and now use a much larger window. This greatly enhances - SSH/SCP performance. I also increased the size of the buffer the transport - layer uses from 4k to 16K. +Daiki Ueno (23 Dec 2009) +- Fix doc comments. -- oops, use %06d for the microseconds! +- Add man pages for ssh-agent API. -- re-indented and other whitespace edits +- Don't request userauthlist after authentication. -- improved trace logs with time stamps +Simon Josefsson (21 Dec 2009) +- Add. -- fixed to work quite similar to the sftp_nonblock example so that it waits - for the socket correctly and measures the transfer speed fine +- [Daiki Ueno brought this change] -- Cleanups, that do seem to have boosted SFTP download performance up to 300% in - some tests: - - * cut off "_ex" from several internal function names - - * corrected some log outputs - - * simplified libssh2_channel_read_ex() and made it much faster in the process - - * cut out {{{ and }}} comments that were incorrect anyway - - * fixed sftp_packet_ask() to return the correct packet by using memcmp() and - not strncmp() - - * fixed mkdir()'s wait for packet to use the correct request_id - it - semi-worked previously because strncmp() in sftp_packet_ask() made it - match far too easily. + Add an example to use ssh-agent API. - * took away the polling functionality from sftp_packet_ask() since it wasn't - used - -- improved non-blocking behavior for some of the initing stuff before the actual - data transfer begins - -- wait for socket action accordingly, and do some measurements on the transfer - to make this better to use for speed tests - -- - (Mar 7 2009) Olivier Hervieu pointed out a flaw in the - libssh2_channel_x11_req_ex() function that made it produce a crappy random - chunk of data. Peter Stuge improved the fix to not do out-of-boundary - writes. I (Daniel Stenberg) replaced the snprintf() with a plain sprintf() - since the size argument wasn't adding anything anyway. - -Guenter Knauf (6 Mar 2009) -- some minor Makefile tweaks. - -Daniel Stenberg (23 Feb 2009) -- - Added libssh2_version() + Signed-off-by: Simon Josefsson -- - (Feb 20 2009) libssh2_channel_direct_tcpip_ex() bug #1902169 fixed, which - caused it to fail when called a second time. +- [Daiki Ueno brought this change] -Mikhail Gusarov (17 Feb 2009) -- Fixed dash-as-minus warning in libssh2_base64_decode.3 manpage + Add ssh-agent API. + + Signed-off-by: Simon Josefsson -- Fixed syntax error in libssh2_banner_set.3 manpage +- [Daiki Ueno brought this change] -Simon Josefsson (16 Feb 2009) -- Bump ABI revision from 1.0.0 to 1.0.1 due to code changes. + Add callback-based API for publickey auth. + + Signed-off-by: Simon Josefsson -- Fix typo. +- Move examples from example/simple to example/. -- Add date for v1.0 release. +- Move examples from example/simple to example/. -Daniel Stenberg (12 Feb 2009) -- - (Feb 12 2009) Romain Bondue extended Markus Moeller fix from Feb 8, based on - a previous (uncommitted) patch by Erik Brossler. It improves - libssh2_channel_write_ex in blocking situations when the socket is set non- - blocking. +Daniel Stenberg (17 Dec 2009) +- _libssh2_list_insert() fixed to work + + While this is code not currently in use, it is part of the generic linked + list code and since I found the error I thought I'd better fix it since we + might bring in this function into the code one day. -- Markus Moeller fixed a flaw in libssh2_channel_write_ex() that would occur - on EAGAIN situations. +Simon Josefsson (16 Dec 2009) +- Silence compiler warnings. + + Based on patch by Kamil Dudka in + . -- I want to remove all those macros from the official API at next soname bump +- [Kamil Dudka brought this change] -- fixed compiler warnings, and stripped off "libssh2_" from static functions - as that makes shorter function names and then making the code look fine within - 80 columns is easier! + libgcrypt: simplify code of _libssh2_dsa_sha1_sign + + Signed-off-by: Simon Josefsson -- made the three public headers use (mostly) lines shorter than 80 columns as - HACKING says - it makes them much more readable to my old tired eyes... +- [Kamil Dudka brought this change] -- we're actually working on the 1.0.1 version now (or should it be 1.1?) + libgcrypt: follow-up for ssh-dss padding fix + + Signed-off-by: Simon Josefsson -- Added 'TODO' file (again) with some fresh things I could think of right now +Dan Fandrich (15 Dec 2009) +- Check for the right environment variable in the test app -- Added libssh2_trace man page +Simon Josefsson (14 Dec 2009) +- Silence warning about unused function parameter. + + Reported by Steven Van Ingelgem . -- libssh2_base64_decode is deprecated and subject for removal in a future - version (like on the next soname bump) +Daniel Stenberg (10 Dec 2009) +- avoid returning data to memory already freed + + In case of failure we must make sure that the data we return + doesn't point to a memory area already freed. Reported anonymously + in the bug report #2910103. -- wrote up a first libssh2_base64_decode man page, added a few missing man - pages to the tarball +Peter Stuge (8 Dec 2009) +- Use LIBSSH2_TRACE_* internally and remove redundant LIBSSH2_DBG_* -- based on Heiner Steven's report, fix the name and description of these man - pages! +- Add LIBSSH2_TRACE_SOCKET context for tracing send() and recv() + + Helpful in debugging the -39 errors. -- briefly mention my recent sftp-related fixes +- Another transport layer fix for bogus -39 (LIBSSH2_ERROR_BAD_USE) errors + + Commit 683aa0f6b52fb1014873c961709102b5006372fc made send_existing() send + more than just the second part of a packet when the kernel did not accept + the full packet, but the function still overlooked the SSH protocol + overhead in each packet, often 48 bytes. + + If only the last few bytes of a packet remained, then the packet would + erroneously be considered completely sent, and the next call to write + more data in the session would return a -39 error. -- mention web site and mailing list, as I think they're not mentioned anywhere - else in the package! +Daniel Stenberg (6 Dec 2009) +- move local variable to be more localized -- removed obviously superfluous comments +- fixed some indent mistakes -- use a single >>32 instead of "(value / 65536) / 65536", just make sure that - the shift is done on a 64bit type +Peter Stuge (6 Dec 2009) +- Fix padding in ssh-dss signature blob encoding + + DSA signatures consist of two 160-bit integers called r and s. In ssh-dss + signature blobs r and s are stored directly after each other in binary + representation, making up a 320-bit (40 byte) string. (See RFC4253 p14.) + + The crypto wrappers in libssh2 would either pack r and s incorrectly, or + fail, when at least one integer was small enough to be stored in 19 bytes + or less. + + The patch ensures that r and s are always stored as two 160 bit numbers. -- remove unused #ifndef, and two whitespace changes +- Don't always clear write direction blocking flag + + When libssh2_transport_write() is called to continue sending a + partially sent packet the write direction flag must not be cleared + until the previous packet has been completely sent, or the app would + hang if the packet still isn't sent completely, since select() gets + called by the internal blocking emulation layer in libssh2 but would + then not be watching the socket for writability. + + Clear the flag only once processing of previous packet data is + complete and a new packet is about to be prepared. -- style/indent changes only to enforce < 80 column lines more strict +Alexander Lamaison (24 Nov 2009) +- Detabify. -- libssh2_sftp_seek64() it is now for the 64bit seek function too as the seek2 - name has never been used in a release and it makes the naming consistent +- [Daniel Stenberg brought this change] -- 0.19 is now 1.0 + Fixed memory leak in sftp_fstat(). -- Based on Alexander Lamaison's patch, there's now a new - function called libssh2_sftp_tell64() that returns the 64 bit file offset, - as the existing libssh2_sftp_tell() only returns a size_t. +Simon Josefsson (17 Nov 2009) +- Mark date of 1.2.2 release. -- first conversion of a malloc => buffer in the sftp handle struct +- Merge branch 'master' of ssh://git.stuge.se/var/lib/git/libssh2 -- helper script for emacs users to get the code style done libssh2-style - automatically +Version 1.2.2 (16 Nov 2009) -- - Markus Moeller fixed the issue also reported by Alexander Lamaison which - caused SFTP reads with large buffers to fail. +Daniel Stenberg (16 Nov 2009) +- prepared for 1.2.2 -Simon Josefsson (17 Dec 2008) -- Sshd is slow to start on some systems. +Simon Josefsson (16 Nov 2009) +- Improve NEWS items. -Daniel Stenberg (17 Dec 2008) -- Avoid one malloc by putting the entire handle buffer in the handle struct - at once, use a define for the maximum size length of the handle instead of - '256' in the code. +- Support AES-Counter ciphers. -- removed some more libssh2_ prefixes from private functions +- Silence compiler warning. - Made the libssh2_sftp_open_ex() deal with servers that first responds with - STATUS OK and then sends the actual HANDLE. It seems openssh does this at - times and it screwed things up. To me it seems like a spec violation... - -- removed unused code, intended the code somewhat + Reported by Steven Van Ingelgem + in . -- Nothing used libssh2_sftp_packet_read's flush argument anymore so I removed - it and simplified the code somewhat thanks to that. I then renamed the function - to sftp_packet_read() only since it is private in this file anyway. +- Mention libssh2-style.el. -- renamed libssh2_sftp_packet_requirev to plain sftp_packet_requirev since it - is private in this file only and a shorter name is nicer +- Use memmove instead of memcpy on overlapping memory areas. - Removed a "flush" of the data in sftp_packet_requirev() that now seems to have - made SFTP operations a lot more reliable. It didn't make much sense to have it - there but if someone can present a reason for one I figure we should carefully - investigate one and only do it conditionally where/when needed. - -- Clarify that this is only fine to use after an actual SFTP protocol error - return code. + Reported by Bob Alexander in + . -Simon Josefsson (27 Nov 2008) -- Support EXEEXT in self-test. +- Add. -- Cygwin needs -lcrypto for -lssl. - Reported by "Yang Tse" . +- Protect against crash on too small SSH_MSG_IGNORE packets. + + Reported by Bob Alexander + in . -Daniel Stenberg (27 Nov 2008) -- oops, add missing file +- add copyright line -Yang Tse (26 Nov 2008) -- fix again cygwin build failure unreleased regression +- support arcfour128 cipher per RFC 4345 -Dan Fandrich (25 Nov 2008) -- Fixed a potential use of an uninitialized variable, the result of which lead - to an unneeded but harmless realloc. - Reduced the scope of some automatic variables. +Daniel Stenberg (21 Oct 2009) +- [Cristian Rodríguez brought this change] -- Fixed some typos in log messages + add support for GCC visibility features -Daniel Stenberg (24 Nov 2008) -- - Vlad Grachov brought the new function called - libssh2_session_block_directions() which returns a bitmask for what - directions the connection blocks. It is to be used applications that use - non-blocking sockets and when a libssh2 function returns - LIBSSH2_ERROR_EAGAIN this function can be used to figure out in which - direction the socket would block and thus it can wait for the socket to - again be ready for communication in that direction before it calls libssh2 - again. +Simon Josefsson (19 Oct 2009) +- less hard coding of cipher mode in libgcrypt backend -Simon Josefsson (21 Nov 2008) -- Add a more realistic self-test of libssh2. +Daniel Stenberg (18 Oct 2009) +- [Juzna brought this change] -- Ignore coverage/. + libssh2_channel_forward_accept() and listening fixes + + The forward accepting was not done right before, and the + packet_queue_listener function didn't assign a necessary + variable. All fixed by Juzna. I (Daniel) modified the + forward_accept() change somewhat. -- Add rules to generate a code coverage report. +- added man page for libssh2_knownhost_free -- Use AM_CPPFLAGS instead of deprecated INCLUDES. +- more CVS => DEV conversions -- Add self-test of base64 decode. +- remove references to "CVS" -- Add gcov files. +- we are on the 1.2.2 track nowadays -Dan Fandrich (21 Nov 2008) -- Use only C89-style comments +Peter Stuge (17 Oct 2009) +- Ensure that win32/libssh2.dsp will be generated with CRLF line endings + + First, win32/msvcproj.{head,foot} are now committed with CRLF line endings, + and .gitattributes specifies that these should not be changed on checkout or + commit. These are win32 files so it makes sense to store them with native + line endings. + + Second, the rules for generating libssh2.dsp and libssh2.vcproj are changed + so that the full file contents passes through awk, which strips all CR and + then prints each line with one CRLF line ending. Stripping CR is important + to avoid CRCRLF in case the input already comes with CRLF. -- Check LIBSSH2_HMAC_RIPEMD consistently +Dan Fandrich (29 Sep 2009) +- Make sure permissions on the private host key file is tight enough that + sshd doesn't complain. Quote $srcdir to try to cope with embedded spaces. -Simon Josefsson (20 Nov 2008) -- Fix compiler warnings. +Peter Stuge (30 Sep 2009) +- Clarify the scp_write examples slightly and use an octal mask for the mode -- Move pem.c to libgcrypt section, it is not needed for OpenSSL. +Version 1.2.1 (29 Sep 2009) -- Drop pkg-config test, not needed now. +Daniel Stenberg (29 Sep 2009) +- 1.2.1 preparations -- Rewrite OpenSSL+libz detection logic. +- remove ChangeLog and win32/libssh2.dsp only at make distclean -- Add more. +Simon Josefsson (23 Sep 2009) +- Fix shell usage. -Daniel Stenberg (11 Nov 2008) -- fix the include path to also point out the build dir's src/ dir for the cases - where we build the lot outside of the source dir +Daniel Stenberg (22 Sep 2009) +- clarify that the paths are the remote ones -- avoid duplicate function declarations on windows +- let hpux systems build with _REENTRANT defined as well -- WINSOCK_VERSION is no longer used (Richard W.M. Jones fixed) +- updated to match reality + + I went over the commit log and added what I believe is all notable + changes and bugfixes since the 1.2 release -- Richard W.M. Jones' 5 patches that enables libssh2 to get cross-compiled with - mingw +Peter Stuge (20 Sep 2009) +- Fix scp examples to loop correctly over libssh2_channel_write() -Paul Thomas (9 Nov 2008) -- Fixes a problem that the last code change apparently didn't fix. Verified - that this works correctly with another user. +- Fix transport layer bug causing invalid -39 (LIBSSH2_ERROR_BAD_USE) errors + + The channel layer sends packets using the transport layer, possibly + calling _libssh2_transport_write() many times for each packet. + + The transport layer uses the send_existing() helper to send out any + remaining parts of previous packets before a new packet is started. + + The bug made send_existing() consider the entire packet sent as soon as it + successfully sent the second part of a packet, even if the packet was not + completely done yet. -- Fixed an issue with a patch that I submitted where the channel_read_ex() - could get stuck in a busy read loop. +Daniel Stenberg (19 Sep 2009) +- [Neil Gierman brought this change] -Yang Tse (25 Oct 2008) -- fix cygwin build failure unreleased regression + Added gettimeofday() function for win32 + + Neil Gierman's patch adds a gettimeofday() function for win32 + for the libssh2_trace() functionality. The code originates from + cygwin and was put in the public domain by the author + Danny Smith -Paul Thomas (3 Oct 2008) -- Reformatted the code, updated line endings to match original file, - fixed the build problem, removed tabs and replaced with spaces - and removed C89 unfriendly comments. +- libssh2_channel_read_ex() must return 0 when closed + + If the channel is already at EOF or even closed at the end of the + libssh2_channel_read_ex() function and there's no data to return, + we need to signal that back. We may have gotten that info while + draining the incoming transport layer until EAGAIN so we must not + be fooled by that return code. -Daniel Stenberg (2 Oct 2008) -- mention libssh2_channel_request_pty_size_ex() +Dan Fandrich (16 Sep 2009) +- Ignore tags file -- two new committers! +- Some platforms need sys/socket.h included before netinet/in.h. + Fixed an unused variable compiler warning. -Paul Thomas (2 Oct 2008) -- This fix addresses bug# 2141548. Channel reads would fail despite - libssh2_poll() detecting that there was data ready to be read on - the socket. This is seen when small amounts of data are ready to - be read, typically 1-4 chars worth. +Daniel Stenberg (16 Sep 2009) +- libssh2_channel_wait_closed() could hang + + libssh2_channel_wait_closed() had a bad loop waiting for the + channel to close, as it could easily miss the info and then if + the socket would be silent from that moment the funtion would + hang if in blocking-mode or just return EAGAIN wrongly to the + app. The drain-transport loop now correctly checks if the close + has arrived. -- Committed changes to add in support for pty resizing. Credit for this - patch goes to Vincent Jaulin. +- make libssh2_scp_send/recv do blocking mode correctly + + Somehow I had completely missed to make the libssh2_scp_send/recv + functions support the blocking mode the correct way so when I + cleaned up things the other day blocking mode broke for them... + Fixed now. -- Fixed an issue with the libssh2_poll_channel_read function not - reading both normal and extended data when a non-zero value - is passed in as the 2nd parameter. This now matches the functionallity - described in the documentation. +Guenter Knauf (8 Sep 2009) +- changed NetWare test makefile static link order -Daniel Stenberg (30 Sep 2008) -- Carlo Bramini fixed the build for msys+mingw. Bug #1943976. +- removed conditional sources from Makefile.inc + added ifdef blocks to libgcrypt.c, pem.c, openssl.c -- Carlo Bramini's fixes for the nonblocking examples for msys/mingw +Simon Josefsson (7 Sep 2009) +- Fix compilation errors. -- Neil Gierman provided improved Visual Studio 2008 code in bug #1946268 +Guenter Knauf (6 Sep 2009) +- some more NetWare build fixes. -- - Bug #1862727 fixed libssh2_poll() to work on windows (by defining HAVE_SELECT). +- some more NetWare makefile fixes. -- - Based on bug #1815692, we introduce libssh2_sftp_seek2() that allows seeking - beyond the 2GB margin even on 32bit machines. +- added sys/select.h include to samples for fd_set on NetWare. -- - Based on a patch in bug #1878059 by Steven Ayre libssh2 now parses >2GB file - sizes when downloading SCP files. +- accept CFLAGS from environment. diff --git a/vendor/libssh2/NMakefile b/vendor/libssh2/NMakefile index f3fcce112..07bc2ddad 100644 --- a/vendor/libssh2/NMakefile +++ b/vendor/libssh2/NMakefile @@ -1,5 +1,10 @@ !include "win32/config.mk" +!if "$(WITH_WINCNG)" == "1" +!include "Makefile.WinCNG.inc" +!else +!include "Makefile.OpenSSL.inc" +!endif !include "Makefile.inc" OBJECTS=$(CSOURCES:.c=.obj) @@ -12,6 +17,7 @@ all-sub: win32\objects.mk clean: -rmdir 2>NUL /s/q $(TARGET) + -del 2>NUL win32\objects.mk real-clean vclean: clean -del 2>NUL libssh2.dll @@ -19,7 +25,6 @@ real-clean vclean: clean -del 2>NUL libssh2.ilk -del 2>NUL libssh2.lib -del 2>NUL *.pdb - -del 2>NUL win32\objects.mk win32\objects.mk: Makefile.inc @echo OBJECTS = \>$@ diff --git a/vendor/libssh2/README b/vendor/libssh2/README index 0ba17f926..39abc202e 100644 --- a/vendor/libssh2/README +++ b/vendor/libssh2/README @@ -8,90 +8,12 @@ Web site: http://www.libssh2.org/ Mailing list: http://cool.haxx.se/mailman/listinfo/libssh2-devel -Generic installation instructions are in INSTALL. Some ./configure -options deserve additional comments: +License: see COPYING - * --enable-crypt-none +Source code: https://github.com/libssh2/libssh2 - The SSH2 Transport allows for unencrypted data - transmission using the "none" cipher. Because this is - such a huge security hole, it is typically disabled on - SSH2 implementations and is disabled in libssh2 by - default as well. +Web site source code: https://github.com/libssh2/www - Enabling this option will allow for "none" as a - negotiable method, however it still requires that the - method be advertized by the remote end and that no - more-preferable methods are available. - - * --enable-mac-none - - The SSH2 Transport also allows implementations to - forego a message authentication code. While this is - less of a security risk than using a "none" cipher, it - is still not recommended as disabling MAC hashes - removes a layer of security. - - Enabling this option will allow for "none" as a - negotiable method, however it still requires that the - method be advertized by the remote end and that no - more-preferable methods are available. - - * --disable-gex-new - - The diffie-hellman-group-exchange-sha1 (dh-gex) key - exchange method originally defined an exchange - negotiation using packet type 30 to request a - generation pair based on a single target value. Later - refinement of dh-gex provided for range and target - values. By default libssh2 will use the newer range - method. - - If you experience trouble connecting to an old SSH - server using dh-gex, try this option to fallback on - the older more reliable method. - - * --with-libgcrypt - * --without-libgcrypt - * --with-libgcrypt-prefix=DIR - - libssh2 can use the Libgcrypt library - (http://www.gnupg.org/) for cryptographic operations. - Either Libgcrypt or OpenSSL is required. - - Configure will attempt to locate Libgcrypt - automatically. - - If your installation of Libgcrypt is in another - location, specify it using --with-libgcrypt-prefix. - - * --with-openssl - * --without-openssl - * --with-libssl-prefix=[DIR] - - libssh2 can use the OpenSSL library - (http://www.openssl.org) for cryptographic operations. - Either Libgcrypt or OpenSSL is required. - - Configure will attempt to locate OpenSSL in the - default location. - - If your installation of OpenSSL is in another - location, specify it using --with-libssl-prefix. - - * --with-libz - * --without-libz - * --with-libz-prefix=[DIR] - - If present, libssh2 will attempt to use the zlib - (http://www.zlib.org) for payload compression, however - zlib is not required. - - If your installation of Libz is in another location, - specify it using --with-libz-prefix. - - * --enable-debug - - Will make the build use more pedantic and strict compiler - options as well as enable the libssh2_trace() function (for - showing debug traces). +Installation instructions are in: + - docs/INSTALL_CMAKE for CMake + - docs/INSTALL_AUTOTOOLS for Autotools diff --git a/vendor/libssh2/RELEASE-NOTES b/vendor/libssh2/RELEASE-NOTES index eea78f874..2b22288ce 100644 --- a/vendor/libssh2/RELEASE-NOTES +++ b/vendor/libssh2/RELEASE-NOTES @@ -1,28 +1,56 @@ -libssh2 1.4.3 +libssh2 1.7.0 This release includes the following changes: - o compression: add support for zlib@openssh.com + o libssh2_session_set_last_error: Add function + o mac: Add support for HMAC-SHA-256 and HMAC-SHA-512 + o WinCNG: support for SHA256/512 HMAC + o kex: Added diffie-hellman-group-exchange-sha256 support + o OS/400 crypto library QC3 support -This release includes the following bugfixes: +This release includes the following security advisory: + + o diffie_hellman_sha256: convert bytes to bits + CVE-2016-0787: http://www.libssh2.org/adv_20160223.html - o sftp_read: return error if a too large package arrives - o libssh2_hostkey_hash.3: update the description of return value - o Fixed MSVC NMakefile - o examples: use stderr for messages, stdout for data - o openssl: do not leak memory when handling errors - o improved handling of disabled MD5 algorithm in OpenSSL - o known_hosts: Fail when parsing unknown keys in known_hosts file - o configure: gcrypt doesn't come with pkg-config support - o session_free: wrong variable used for keeping state - o libssh2_userauth_publickey_fromfile_ex.3: mention publickey == NULL - o comp_method_zlib_decomp: handle Z_BUF_ERROR when inflating +This release includes the following bugfixes: + o SFTP: Increase speed and datasize in SFTP read + o openssl: make libssh2_sha1 return error code + o openssl: fix memleak in _libssh2_dsa_sha1_verify() + o cmake: include CMake files in the release tarballs + o Fix builds with Visual Studio 2015 + o hostkey.c: Fix compiling error when OPENSSL_NO_MD5 is defined + o GNUmakefile: add support for LIBSSH2_LDFLAG_EXTRAS + o GNUmakefile: add -m64 CFLAGS when targeting mingw64 + o kex: free server host key before allocating it (again) + o SCP: add libssh2_scp_recv2 to support large (> 2GB) files on windows + o channel: Detect bad usage of libssh2_channel_process_startup + o userauth: Fix off by one error when reading public key file + o kex: removed dupe entry from libssh2_kex_methods + o _libssh2_error: Support allocating the error message + o hostkey: fix invalid memory access if libssh2_dsa_new fails + o hostkey: align code path of ssh_rsa_init to ssh_dss_init + o libssh2.pc.in: fix the output of pkg-config --libs + o wincng: fixed possible memory leak in _libssh2_wincng_hash + o wincng: fixed _libssh2_wincng_hash_final return value + o add OpenSSL 1.1.0-pre2 compatibility + o agent_disconnect_unix: unset the agent fd after closing it + o sftp: stop reading when buffer is full + o sftp: Send at least one read request before reading + o sftp: Don't return EAGAIN if data was written to buffer + o sftp: Check read packet file offset + o configure: build "silent" if possible + o openssl: add OpenSSL 1.1.0-pre3-dev compatibility + o GNUmakefile: list system libs after user libs + This release would not have looked like this without help, code, reports and advice from friends like these: - Guenter Knauf, Peter Stuge, TJ Saunders, Mike Abdullah, Maxime Larocque, - Dmitry Smirnov, Dave Hayden, Peter Krempa, Kamil Dudka - - Thanks! (and sorry if I forgot to mention someone) + Alexander Lamaison, Andreas Schneider, brian m. carlson, Daniel Stenberg, + David Byron, Jakob Egger, Kamil Dudka, Marc Hoersken, Mizunashi Mana, + Patrick Monnerat, Paul Howarth, Salvador Fandino, Salvador Fandiño, + Salvador Fandiño, Viktor Szakats, Will Cosgrove, + (16 contributors) + Thanks! (and sorry if I forgot to mention someone) diff --git a/vendor/libssh2/aclocal.m4 b/vendor/libssh2/aclocal.m4 index 80e968f52..41ad8c694 100644 --- a/vendor/libssh2/aclocal.m4 +++ b/vendor/libssh2/aclocal.m4 @@ -1,8 +1,7 @@ -# generated automatically by aclocal 1.11.6 -*- Autoconf -*- +# generated automatically by aclocal 1.15 -*- Autoconf -*- + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, -# Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -12,33 +11,31 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically `autoreconf'.])]) +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 2002-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 1 - # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.11' +[am__api_version='1.15' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11.6], [], +m4_if([$1], [1.15], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -54,24 +51,22 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11.6])dnl +[AM_AUTOMAKE_VERSION([1.15])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 1 - # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and @@ -90,7 +85,7 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you +# harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, @@ -108,30 +103,26 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 9 - # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ(2.52)dnl - ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl @@ -150,16 +141,14 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, -# 2010, 2011 Free Software Foundation, Inc. +# Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 12 -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing @@ -169,7 +158,7 @@ fi])]) # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was @@ -182,12 +171,13 @@ AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], UPC, [depcc="$UPC" am_compiler_list=], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], @@ -195,8 +185,8 @@ AC_CACHE_CHECK([dependency style of $depcc], # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're @@ -236,16 +226,16 @@ AC_CACHE_CHECK([dependency style of $depcc], : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -254,8 +244,8 @@ AC_CACHE_CHECK([dependency style of $depcc], test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else @@ -263,7 +253,7 @@ AC_CACHE_CHECK([dependency style of $depcc], fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -311,7 +301,7 @@ AM_CONDITIONAL([am__fastdep$1], [ # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl @@ -321,9 +311,13 @@ AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors]) +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' @@ -338,20 +332,18 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -#serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ - # Autoconf 2.62 quotes --file arguments for eval, but not when files + # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in @@ -364,7 +356,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but + # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. @@ -376,21 +368,19 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], continue fi # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. + # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue + test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` @@ -408,7 +398,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will +# is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], @@ -416,32 +406,23 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 8 - -# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. -AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) - # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 16 - # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- @@ -454,7 +435,7 @@ AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.62])dnl +[AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl @@ -483,33 +464,42 @@ AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, +m4_if( + m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AM_PROG_MKDIR_P])dnl -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl @@ -518,34 +508,82 @@ _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES(OBJC)], - [define([AC_PROG_OBJC], - defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) -_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl -dnl The `parallel-tests' driver may need to know about EXEEXT, so add the -dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro -dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) -dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) - # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. @@ -567,21 +605,18 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, -# Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 1 - # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -if test x"${install_sh}" != xset; then +if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; @@ -589,16 +624,14 @@ if test x"${install_sh}" != xset; then install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi -AC_SUBST(install_sh)]) +AC_SUBST([install_sh])]) -# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2003-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 2 - # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], @@ -615,20 +648,17 @@ AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008, -# 2011 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 5 - # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. -# Default is to disable them, unless `enable' is passed literally. -# For symmetry, `disable' may be passed as well. Anyway, the user +# Default is to disable them, unless 'enable' is passed literally. +# For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), @@ -639,10 +669,11 @@ AC_DEFUN([AM_MAINTAINER_MODE], AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], -[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful - (and sometimes confusing) to the casual installer], - [USE_MAINTAINER_MODE=$enableval], - [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], + am_maintainer_other[ make rules and dependencies not useful + (and sometimes confusing) to the casual installer])], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE @@ -650,18 +681,14 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) ] ) -AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) - # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 4 - # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. @@ -679,7 +706,7 @@ am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. +# Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include @@ -706,15 +733,12 @@ rm -f confinc confmf # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 6 - # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], @@ -722,11 +746,10 @@ AC_DEFUN([AM_MISSING_PROG], $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) - # AM_MISSING_HAS_RUN # ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl @@ -739,54 +762,22 @@ if test x"${MISSING+set}" != xset; then esac fi # Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " else am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) + AC_MSG_WARN(['missing' script is too old or missing]) fi ]) -# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, -# Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 1 - -# AM_PROG_MKDIR_P -# --------------- -# Check for `mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) - # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software -# Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 5 - # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], @@ -796,7 +787,7 @@ AC_DEFUN([_AM_MANGLE_OPTION], # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ @@ -810,24 +801,82 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Check to make sure that the build environment is sane. -*- Autoconf -*- +# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 -# Free Software Foundation, Inc. +# _AM_PROG_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 5 +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -838,32 +887,40 @@ case `pwd` in esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac -# Do `set' in a subshell so we don't clobber the current shell's +# Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done test "$[2]" = conftest.file ) then @@ -873,46 +930,118 @@ else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi -AC_MSG_RESULT(yes)]) +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) -# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# Copyright (C) 2009-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 1 +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- -# One issue with vendor `install' (even GNU) is that you can't +# One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize +# always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. +# Copyright (C) 2006-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 3 - # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. @@ -926,18 +1055,16 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. +# Copyright (C) 2004-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 2 - # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory @@ -947,76 +1074,114 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar +# AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) -m4_if([$1], [v7], - [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. + +# We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi + done rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR diff --git a/vendor/libssh2/cmake/CheckFunctionExistsMayNeedLibrary.cmake b/vendor/libssh2/cmake/CheckFunctionExistsMayNeedLibrary.cmake new file mode 100644 index 000000000..8ac61abe5 --- /dev/null +++ b/vendor/libssh2/cmake/CheckFunctionExistsMayNeedLibrary.cmake @@ -0,0 +1,81 @@ +# Copyright (c) 2014 Alexander Lamaison +# +# Redistribution and use in source and binary forms, +# with or without modification, are permitted provided +# that the following conditions are met: +# +# Redistributions of source code must retain the above +# copyright notice, this list of conditions and the +# following disclaimer. +# +# Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# Neither the name of the copyright holder nor the names +# of any other contributors may be used to endorse or +# promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +# OF SUCH DAMAGE. + + +# - check_function_exists_maybe_need_library( [lib1 ... libn]) +# +# Check if function is available for linking, first without extra libraries, and +# then, if not found that way, linking in each optional library as well. This +# function is similar to autotools AC_SEARCH_LIBS. +# +# If the function if found, this will define . +# +# If the function was only found by linking in an additional library, this +# will define NEED_LIB_LIBX, where LIBX is the one of lib1 to libn that +# makes the function available, in uppercase. +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# + +include(CheckFunctionExists) +include(CheckLibraryExists) + +function(check_function_exists_may_need_library function variable) + + check_function_exists(${function} ${variable}) + + if(NOT ${variable}) + foreach(lib ${ARGN}) + string(TOUPPER ${lib} UP_LIB) + # Use new variable to prevent cache from previous step shortcircuiting + # new test + check_library_exists(${lib} ${function} "" HAVE_${function}_IN_${lib}) + if(HAVE_${function}_IN_${lib}) + set(${variable} 1 CACHE INTERNAL + "Function ${function} found in library ${lib}") + set(NEED_LIB_${UP_LIB} 1 CACHE INTERNAL + "Need to link ${lib}") + break() + endif() + endforeach() + endif() + +endfunction() \ No newline at end of file diff --git a/vendor/libssh2/cmake/CheckNonblockingSocketSupport.cmake b/vendor/libssh2/cmake/CheckNonblockingSocketSupport.cmake new file mode 100644 index 000000000..74f4776a6 --- /dev/null +++ b/vendor/libssh2/cmake/CheckNonblockingSocketSupport.cmake @@ -0,0 +1,119 @@ +include(CheckCSourceCompiles) + +# - check_nonblocking_socket_support() +# +# Check for how to set a socket to non-blocking state. There seems to exist +# four known different ways, with the one used almost everywhere being POSIX +# and XPG3, while the other different ways for different systems (old BSD, +# Windows and Amiga). +# +# One of the following variables will be set indicating the supported +# method (if any): +# HAVE_O_NONBLOCK +# HAVE_FIONBIO +# HAVE_IOCTLSOCKET +# HAVE_IOCTLSOCKET_CASE +# HAVE_SO_NONBLOCK +# HAVE_DISABLED_NONBLOCKING +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# +macro(check_nonblocking_socket_support) + # There are two known platforms (AIX 3.x and SunOS 4.1.x) where the + # O_NONBLOCK define is found but does not work. + check_c_source_compiles(" +#include +#include +#include + +#if defined(sun) || defined(__sun__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) +# if defined(__SVR4) || defined(__srv4__) +# define PLATFORM_SOLARIS +# else +# define PLATFORM_SUNOS4 +# endif +#endif +#if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41) +# define PLATFORM_AIX_V3 +#endif + +#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__) +#error \"O_NONBLOCK does not work on this platform\" +#endif + +int main() +{ + int socket; + int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK); +}" + HAVE_O_NONBLOCK) + + if(NOT HAVE_O_NONBLOCK) + check_c_source_compiles("/* FIONBIO test (old-style unix) */ +#include +#include + +int main() +{ + int socket; + int flags = ioctl(socket, FIONBIO, &flags); +}" + HAVE_FIONBIO) + + if(NOT HAVE_FIONBIO) + check_c_source_compiles("/* ioctlsocket test (Windows) */ +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#include +#include + +int main() +{ + SOCKET sd; + unsigned long flags = 0; + sd = socket(0, 0, 0); + ioctlsocket(sd, FIONBIO, &flags); +}" + HAVE_IOCTLSOCKET) + + if(NOT HAVE_IOCTLSOCKET) + check_c_source_compiles("/* IoctlSocket test (Amiga?) */ +#include + +int main() +{ + int socket; + int flags = IoctlSocket(socket, FIONBIO, (long)1); +}" + HAVE_IOCTLSOCKET_CASE) + + if(NOT HAVE_IOCTLSOCKET_CASE) + check_c_source_compiles("/* SO_NONBLOCK test (BeOS) */ +#include + +int main() +{ + long b = 1; + int socket; + int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b)); +}" + HAVE_SO_NONBLOCK) + + if(NOT HAVE_SO_NONBLOCK) + # No non-blocking socket method found + set(HAVE_DISABLED_NONBLOCKING 1) + endif() + endif() + endif() + endif() + endif() +endmacro() \ No newline at end of file diff --git a/vendor/libssh2/cmake/CopyRuntimeDependencies.cmake b/vendor/libssh2/cmake/CopyRuntimeDependencies.cmake new file mode 100644 index 000000000..083f76268 --- /dev/null +++ b/vendor/libssh2/cmake/CopyRuntimeDependencies.cmake @@ -0,0 +1,72 @@ +# Copyright (c) 2014 Alexander Lamaison +# +# Redistribution and use in source and binary forms, +# with or without modification, are permitted provided +# that the following conditions are met: +# +# Redistributions of source code must retain the above +# copyright notice, this list of conditions and the +# following disclaimer. +# +# Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# Neither the name of the copyright holder nor the names +# of any other contributors may be used to endorse or +# promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +# OF SUCH DAMAGE. + +include(CMakeParseArguments) + +function(ADD_TARGET_TO_COPY_DEPENDENCIES) + set(options) + set(oneValueArgs TARGET) + set(multiValueArgs DEPENDENCIES BEFORE_TARGETS) + cmake_parse_arguments(COPY + "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT COPY_DEPENDENCIES) + return() + endif() + + # Using a custom target to drive custom commands stops multiple + # parallel builds trying to kick off the commands at the same time + add_custom_target(${COPY_TARGET}) + + foreach(target ${COPY_BEFORE_TARGETS}) + add_dependencies(${target} ${COPY_TARGET}) + endforeach() + + foreach(dependency ${COPY_DEPENDENCIES}) + + add_custom_command( + TARGET ${COPY_TARGET} + DEPENDS ${dependency} + # Make directory first otherwise file is copied in place of + # directory instead of into it + COMMAND ${CMAKE_COMMAND} + ARGS -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} + COMMAND ${CMAKE_COMMAND} + ARGS -E copy ${dependency} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} + VERBATIM) + + endforeach() + +endfunction() diff --git a/vendor/libssh2/cmake/FindLibgcrypt.cmake b/vendor/libssh2/cmake/FindLibgcrypt.cmake new file mode 100644 index 000000000..44a79873d --- /dev/null +++ b/vendor/libssh2/cmake/FindLibgcrypt.cmake @@ -0,0 +1,53 @@ +# Copyright (c) 2014 Alexander Lamaison +# +# Redistribution and use in source and binary forms, +# with or without modification, are permitted provided +# that the following conditions are met: +# +# Redistributions of source code must retain the above +# copyright notice, this list of conditions and the +# following disclaimer. +# +# Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# Neither the name of the copyright holder nor the names +# of any other contributors may be used to endorse or +# promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +# OF SUCH DAMAGE. + +# - Try to find Libgcrypt +# This will define all or none of: +# LIBGCRYPT_FOUND - if Libgcrypt headers and library was found +# LIBGCRYPT_INCLUDE_DIRS - The Libgcrypt include directories +# LIBGCRYPT_LIBRARIES - The libraries needed to use Libgcrypt + +find_path(LIBGCRYPT_INCLUDE_DIR gcrypt.h) + +find_library(LIBGCRYPT_LIBRARY NAMES gcrypt libgcrypt) + +set(LIBGCRYPT_LIBRARIES ${LIBGCRYPT_LIBRARY}) +set(LIBGCRYPT_INCLUDE_DIRS ${LIBGCRYPT_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libgcrypt DEFAULT_MSG + LIBGCRYPT_LIBRARY LIBGCRYPT_INCLUDE_DIR) + +mark_as_advanced(LIBGCRYPT_INCLUDE_DIR LIBGCRYPT_LIBRARY) \ No newline at end of file diff --git a/vendor/libssh2/cmake/SocketLibraries.cmake b/vendor/libssh2/cmake/SocketLibraries.cmake new file mode 100644 index 000000000..bfbbd711e --- /dev/null +++ b/vendor/libssh2/cmake/SocketLibraries.cmake @@ -0,0 +1,64 @@ +# Copyright (c) 2014 Alexander Lamaison +# +# Redistribution and use in source and binary forms, +# with or without modification, are permitted provided +# that the following conditions are met: +# +# Redistributions of source code must retain the above +# copyright notice, this list of conditions and the +# following disclaimer. +# +# Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# Neither the name of the copyright holder nor the names +# of any other contributors may be used to endorse or +# promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +# OF SUCH DAMAGE. + +# Some systems have their socket functions in a library. +# (Solaris -lsocket/-lnsl, Windows -lws2_32). This macro appends those +# libraries to the given list +macro(append_needed_socket_libraries LIBRARIES_LIST) + if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND CMAKE_SIZEOF_VOID_P EQUAL 4) + # x86 Windows uses STDCALL for these functions, so their names are mangled, + # meaning the platform checks don't work. Hardcoding these until we get + # a better solution. + set(HAVE_SOCKET 1) + set(HAVE_SELECT 1) + set(HAVE_INET_ADDR 1) + set(NEED_LIB_WS2_32 1) + else() + check_function_exists_may_need_library(socket HAVE_SOCKET socket ws2_32) + check_function_exists_may_need_library(select HAVE_SELECT ws2_32) + check_function_exists_may_need_library(inet_addr HAVE_INET_ADDR nsl ws2_32) + endif() + + if(NEED_LIB_SOCKET) + list(APPEND ${LIBRARIES_LIST} socket) + endif() + if(NEED_LIB_NSL) + list(APPEND ${LIBRARIES_LIST} nsl) + endif() + if(NEED_LIB_WS2_32) + list(APPEND ${LIBRARIES_LIST} ws2_32) + endif() + +endmacro() \ No newline at end of file diff --git a/vendor/libssh2/cmake/Toolchain-Linux-32.cmake b/vendor/libssh2/cmake/Toolchain-Linux-32.cmake new file mode 100644 index 000000000..6aad9b1e2 --- /dev/null +++ b/vendor/libssh2/cmake/Toolchain-Linux-32.cmake @@ -0,0 +1,42 @@ +# Copyright (c) 2014 Alexander Lamaison +# +# Redistribution and use in source and binary forms, +# with or without modification, are permitted provided +# that the following conditions are met: +# +# Redistributions of source code must retain the above +# copyright notice, this list of conditions and the +# following disclaimer. +# +# Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# Neither the name of the copyright holder nor the names +# of any other contributors may be used to endorse or +# promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +# OF SUCH DAMAGE. + +# Cross-compile 32-bit binary on 64-bit linux host +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_PROCESSOR "i386") + +set(CMAKE_CXX_COMPILER_ARG1 "-m32") +set(CMAKE_C_COMPILER_ARG1 "-m32") \ No newline at end of file diff --git a/vendor/libssh2/cmake/max_warnings.cmake b/vendor/libssh2/cmake/max_warnings.cmake new file mode 100644 index 000000000..b176d302d --- /dev/null +++ b/vendor/libssh2/cmake/max_warnings.cmake @@ -0,0 +1,23 @@ +if(MSVC) + # Use the highest warning level for visual studio. + if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") + string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") + endif() + if(CMAKE_C_FLAGS MATCHES "/W[0-4]") + string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") + endif() + + # Disable broken warnings + add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) +elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + endif() + if(NOT CMAKE_C_FLAGS MATCHES "-Wall") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") + endif() +endif() diff --git a/vendor/libssh2/compile b/vendor/libssh2/compile new file mode 100755 index 000000000..531136b06 --- /dev/null +++ b/vendor/libssh2/compile @@ -0,0 +1,347 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2012-10-14.11; # UTC + +# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/vendor/libssh2/configure b/vendor/libssh2/configure index 0445d8dda..8d323ac1a 100755 --- a/vendor/libssh2/configure +++ b/vendor/libssh2/configure @@ -641,17 +641,31 @@ HAVE_SYS_UN_H_FALSE HAVE_SYS_UN_H_TRUE BUILD_EXAMPLES_FALSE BUILD_EXAMPLES_TRUE +LIBSREQUIRED LIBZ_PREFIX LTLIBZ LIBZ HAVE_LIBZ +OS400QC3_FALSE +OS400QC3_TRUE +WINCNG_FALSE +WINCNG_TRUE +LIBCRYPT32_PREFIX +LTLIBCRYPT32 +LIBCRYPT32 +HAVE_LIBCRYPT32 +LIBBCRYPT_PREFIX +LTLIBBCRYPT +LIBBCRYPT +HAVE_LIBBCRYPT LIBGCRYPT_FALSE LIBGCRYPT_TRUE -LIBSREQUIRED LIBGCRYPT_PREFIX LTLIBGCRYPT LIBGCRYPT HAVE_LIBGCRYPT +OPENSSL_FALSE +OPENSSL_TRUE LIBSSL_PREFIX LTLIBSSL LIBSSL @@ -731,6 +745,10 @@ INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM SED +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE @@ -753,6 +771,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -776,6 +795,7 @@ ac_subst_files='' ac_user_opts=' enable_option_checking enable_maintainer_mode +enable_silent_rules enable_dependency_tracking enable_shared enable_static @@ -785,16 +805,20 @@ with_gnu_ld with_sysroot enable_libtool_lock enable_largefile -with_libgcrypt with_openssl +with_libgcrypt +with_wincng with_libz enable_rpath with_libssl_prefix with_libgcrypt_prefix +with_libbcrypt_prefix +with_libcrypt32_prefix with_libz_prefix enable_crypt_none enable_mac_none enable_gex_new +enable_clear_memory enable_debug enable_hidden_symbols enable_examples_build @@ -846,6 +870,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1098,6 +1123,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1235,7 +1269,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1388,6 +1422,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1426,10 +1461,15 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors + --enable-maintainer-mode + enable make rules and dependencies not useful (and + sometimes confusing) to the casual installer + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] @@ -1441,6 +1481,7 @@ Optional Features: --enable-mac-none Permit "none" MAC -- NOT RECOMMENDED --disable-gex-new Disable "new" diffie-hellman-group-exchange-sha1 method + --disable-clear-memory Disable clearing of memory before being freed --enable-debug Enable pedantic and debug options --disable-debug Disable debug options --enable-hidden-symbols Hide internal symbols in library @@ -1458,14 +1499,19 @@ Optional Packages: --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). - --with-libgcrypt Use Libgcrypt for crypto --with-openssl Use OpenSSL for crypto - --with-libz Use Libz for compression + --with-libgcrypt Use libgcrypt for crypto + --with-wincng Use Windows CNG for crypto + --with-libz Use zlib for compression --with-gnu-ld assume the C compiler uses GNU ld default=no --with-libssl-prefix[=DIR] search for libssl in DIR/include and DIR/lib --without-libssl-prefix don't search for libssl in includedir and libdir --with-libgcrypt-prefix[=DIR] search for libgcrypt in DIR/include and DIR/lib --without-libgcrypt-prefix don't search for libgcrypt in includedir and libdir + --with-libbcrypt-prefix[=DIR] search for libbcrypt in DIR/include and DIR/lib + --without-libbcrypt-prefix don't search for libbcrypt in includedir and libdir + --with-libcrypt32-prefix[=DIR] search for libcrypt32 in DIR/include and DIR/lib + --without-libcrypt32-prefix don't search for libcrypt32 in includedir and libdir --with-libz-prefix[=DIR] search for libz in DIR/include and DIR/lib --without-libz-prefix don't search for libz in includedir and libdir @@ -1874,6 +1920,52 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_func +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl + # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using @@ -2343,6 +2435,45 @@ fi MAINT=$MAINTAINER_MODE_TRUE +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=0;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + # Extract the first word of "sed", so it can be a program name with args. set dummy sed; ac_word=$2 @@ -2394,7 +2525,7 @@ $as_echo "$as_me: WARNING: sed was not found, this may ruin your chances to buil fi LIBSSH2VER=`$SED -ne 's/^#define LIBSSH2_VERSION *"\(.*\)"/\1/p' ${srcdir}/include/libssh2.h` -am__api_version='1.11' +am__api_version='1.15' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do @@ -2520,9 +2651,6 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -2533,32 +2661,40 @@ case `pwd` in esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac -# Do `set' in a subshell so we don't clobber the current shell's +# Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken -alias in your environment" "$LINENO" 5 - fi - + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done test "$2" = conftest.file ) then @@ -2570,6 +2706,16 @@ Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. @@ -2580,8 +2726,8 @@ test "$program_suffix" != NONE && ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in @@ -2592,15 +2738,15 @@ if test x"${MISSING+set}" != xset; then esac fi # Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi -if test x"${install_sh}" != xset; then +if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; @@ -2609,10 +2755,10 @@ if test x"${install_sh}" != xset; then esac fi -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. +# will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. @@ -2751,12 +2897,6 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } -mkdir_p="$MKDIR_P" -case $mkdir_p in - [\\/$]* | ?:[\\/]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac - for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -2889,18 +3029,71 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking libssh2 version" >&5 $as_echo_n "checking libssh2 version... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBSSH2VER" >&5 @@ -3058,7 +3251,7 @@ am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. +# Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include @@ -3891,6 +4084,65 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 @@ -3902,8 +4154,8 @@ else # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're @@ -3938,16 +4190,16 @@ else : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -3956,8 +4208,8 @@ else test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else @@ -3965,7 +4217,7 @@ else fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -5169,6 +5421,65 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 @@ -5180,8 +5491,8 @@ else # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're @@ -5216,16 +5527,16 @@ else : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -5234,8 +5545,8 @@ else test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else @@ -5243,7 +5554,7 @@ else fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -6369,7 +6680,8 @@ else ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -7883,7 +8195,7 @@ ia64-*-hpux*) rm -rf conftest* ;; -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext @@ -7899,9 +8211,19 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; - ppc64-*linux*|powerpc64-*linux*) + powerpc64le-*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) @@ -7920,7 +8242,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - ppc*-*linux*|powerpc*-*linux*) + powerpcle-*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) @@ -13041,7 +13366,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -13087,7 +13412,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -13111,7 +13436,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -13156,7 +13481,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -13180,7 +13505,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -13219,6 +13544,14 @@ fi # Configure parameters +# Check whether --with-openssl was given. +if test "${with_openssl+set}" = set; then : + withval=$with_openssl; use_openssl=$withval +else + use_openssl=auto +fi + + # Check whether --with-libgcrypt was given. if test "${with_libgcrypt+set}" = set; then : withval=$with_libgcrypt; use_libgcrypt=$withval @@ -13227,11 +13560,11 @@ else fi -# Check whether --with-openssl was given. -if test "${with_openssl+set}" = set; then : - withval=$with_openssl; use_openssl=$withval +# Check whether --with-wincng was given. +if test "${with_wincng+set}" = set; then : + withval=$with_wincng; use_wincng=$withval else - use_openssl=auto + use_wincng=auto fi @@ -13243,8 +13576,11 @@ else fi -# Look for OpenSSL (default) -if test "$use_openssl" != "no" && test "$use_libgcrypt" != "yes"; then +found_crypto=none +support_clear_memory=no + +# Look for OpenSSL +if test "$found_crypto" = "none" && test "$use_openssl" != "no"; then if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" @@ -13948,11 +14284,42 @@ $as_echo "$LIBSSL" >&6; } +fi +if test "$ac_cv_libssl" = "yes"; then + +$as_echo "#define LIBSSH2_OPENSSL 1" >>confdefs.h + LIBSREQUIRED=libssl,libcrypto + + # Not all OpenSSL have AES-CTR functions. + save_LIBS="$LIBS" + LIBS="$LIBS $LIBSSL" + for ac_func in EVP_aes_128_ctr +do : + ac_fn_c_check_func "$LINENO" "EVP_aes_128_ctr" "ac_cv_func_EVP_aes_128_ctr" +if test "x$ac_cv_func_EVP_aes_128_ctr" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_EVP_AES_128_CTR 1 +_ACEOF + +fi +done + + LIBS="$save_LIBS" + + found_crypto="OpenSSL (AES-CTR: ${ac_cv_func_EVP_aes_128_ctr:-N/A})" +fi + if test "$ac_cv_libssl" = "yes"; then + OPENSSL_TRUE= + OPENSSL_FALSE='#' +else + OPENSSL_TRUE='#' + OPENSSL_FALSE= fi + # Look for libgcrypt -if test "$ac_cv_libssl" != "yes" && test "$use_libgcrypt" != "no"; then +if test "$found_crypto" = "none" && test "$use_libgcrypt" != "no"; then @@ -14474,20 +14841,14 @@ $as_echo "$LIBGCRYPT" >&6; } - LIBS="$LIBS -lgcrypt" -fi - - - -if test "$ac_cv_libssl" != "yes" && test "$ac_cv_libgcrypt" != "yes"; then - as_fn_error $? "cannot find OpenSSL or Libgcrypt, -try --with-libssl-prefix=PATH or --with-libgcrypt-prefix=PATH" "$LINENO" 5 fi - if test "$ac_cv_libgcrypt" = "yes"; then $as_echo "#define LIBSSH2_LIBGCRYPT 1" >>confdefs.h + LIBSREQUIRED= # libgcrypt doesn't provide a .pc file. sad face. + LIBS="$LIBS -lgcrypt" + found_crypto=libgcrypt fi if test "$ac_cv_libgcrypt" = "yes"; then LIBGCRYPT_TRUE= @@ -14498,26 +14859,8 @@ else fi -# Not all OpenSSL have AES-CTR functions. -if test "$ac_cv_libssl" = "yes"; then - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $LIBSSL" - for ac_func in EVP_aes_128_ctr -do : - ac_fn_c_check_func "$LINENO" "EVP_aes_128_ctr" "ac_cv_func_EVP_aes_128_ctr" -if test "x$ac_cv_func_EVP_aes_128_ctr" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_EVP_AES_128_CTR 1 -_ACEOF - -fi -done - - LDFLAGS="$save_LDFLAGS" -fi - -# Look for Libz -if test "$use_libz" != "no"; then +# Look for Windows Cryptography API: Next Generation +if test "$found_crypto" = "none" && test "$use_wincng" != "no"; then @@ -14542,9 +14885,9 @@ if test "$use_libz" != "no"; then prefix="$acl_save_prefix" -# Check whether --with-libz-prefix was given. -if test "${with_libz_prefix+set}" = set; then : - withval=$with_libz_prefix; +# Check whether --with-libbcrypt-prefix was given. +if test "${with_libbcrypt_prefix+set}" = set; then : + withval=$with_libbcrypt_prefix; if test "X$withval" = "Xno"; then use_additional=no else @@ -14569,14 +14912,14 @@ if test "${with_libz_prefix+set}" = set; then : fi - LIBZ= - LTLIBZ= - INCZ= - LIBZ_PREFIX= + LIBBCRYPT= + LTLIBBCRYPT= + INCBCRYPT= + LIBBCRYPT_PREFIX= rpathdirs= ltrpathdirs= names_already_handled= - names_next_round='z ' + names_next_round='bcrypt ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= @@ -14595,9 +14938,9 @@ fi if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" - test -z "$value" || LIBZ="${LIBZ}${LIBZ:+ }$value" + test -z "$value" || LIBBCRYPT="${LIBBCRYPT}${LIBBCRYPT:+ }$value" eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$value" + test -z "$value" || LTLIBBCRYPT="${LTLIBBCRYPT}${LTLIBBCRYPT:+ }$value" else : fi @@ -14654,7 +14997,7 @@ fi fi fi if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBZ; do + for x in $LDFLAGS $LTLIBBCRYPT; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -14713,10 +15056,10 @@ fi done fi if test "X$found_dir" != "X"; then - LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$found_dir -l$name" + LTLIBBCRYPT="${LTLIBBCRYPT}${LTLIBBCRYPT:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then - LIBZ="${LIBZ}${LIBZ:+ }$found_so" + LIBBCRYPT="${LIBBCRYPT}${LIBBCRYPT:+ }$found_so" else haveit= for x in $ltrpathdirs; do @@ -14729,10 +15072,10 @@ fi ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$acl_hardcode_direct" = yes; then - LIBZ="${LIBZ}${LIBZ:+ }$found_so" + LIBBCRYPT="${LIBBCRYPT}${LIBBCRYPT:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - LIBZ="${LIBZ}${LIBZ:+ }$found_so" + LIBBCRYPT="${LIBBCRYPT}${LIBBCRYPT:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then @@ -14745,7 +15088,7 @@ fi fi else haveit= - for x in $LDFLAGS $LIBZ; do + for x in $LDFLAGS $LIBBCRYPT; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -14761,28 +15104,28 @@ fi fi done if test -z "$haveit"; then - LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir" + LIBBCRYPT="${LIBBCRYPT}${LIBBCRYPT:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then - LIBZ="${LIBZ}${LIBZ:+ }$found_so" + LIBBCRYPT="${LIBBCRYPT}${LIBBCRYPT:+ }$found_so" else - LIBZ="${LIBZ}${LIBZ:+ }-l$name" + LIBBCRYPT="${LIBBCRYPT}${LIBBCRYPT:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then - LIBZ="${LIBZ}${LIBZ:+ }$found_a" + LIBBCRYPT="${LIBBCRYPT}${LIBBCRYPT:+ }$found_a" else - LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir -l$name" + LIBBCRYPT="${LIBBCRYPT}${LIBBCRYPT:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - LIBZ_PREFIX="$basedir" + LIBBCRYPT_PREFIX="$basedir" additional_includedir="$basedir/include" ;; esac @@ -14797,7 +15140,7 @@ fi fi fi if test -z "$haveit"; then - for x in $CPPFLAGS $INCZ; do + for x in $CPPFLAGS $INCBCRYPT; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -14814,7 +15157,7 @@ fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then - INCZ="${INCZ}${INCZ:+ }-I$additional_includedir" + INCBCRYPT="${INCBCRYPT}${INCBCRYPT:+ }-I$additional_includedir" fi fi fi @@ -14842,7 +15185,7 @@ fi fi if test -z "$haveit"; then haveit= - for x in $LDFLAGS $LIBZ; do + for x in $LDFLAGS $LIBBCRYPT; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -14859,11 +15202,11 @@ fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then - LIBZ="${LIBZ}${LIBZ:+ }-L$additional_libdir" + LIBBCRYPT="${LIBBCRYPT}${LIBBCRYPT:+ }-L$additional_libdir" fi fi haveit= - for x in $LDFLAGS $LTLIBZ; do + for x in $LDFLAGS $LTLIBBCRYPT; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -14880,7 +15223,7 @@ fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then - LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$additional_libdir" + LTLIBBCRYPT="${LTLIBBCRYPT}${LTLIBBCRYPT:+ }-L$additional_libdir" fi fi fi @@ -14918,15 +15261,15 @@ fi names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) - LIBZ="${LIBZ}${LIBZ:+ }$dep" - LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$dep" + LIBBCRYPT="${LIBBCRYPT}${LIBBCRYPT:+ }$dep" + LTLIBBCRYPT="${LTLIBBCRYPT}${LTLIBBCRYPT:+ }$dep" ;; esac done fi else - LIBZ="${LIBZ}${LIBZ:+ }-l$name" - LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-l$name" + LIBBCRYPT="${LIBBCRYPT}${LIBBCRYPT:+ }-l$name" + LTLIBBCRYPT="${LTLIBBCRYPT}${LTLIBBCRYPT:+ }-l$name" fi fi fi @@ -14942,27 +15285,27 @@ fi libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" - LIBZ="${LIBZ}${LIBZ:+ }$flag" + LIBBCRYPT="${LIBBCRYPT}${LIBBCRYPT:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" - LIBZ="${LIBZ}${LIBZ:+ }$flag" + LIBBCRYPT="${LIBBCRYPT}${LIBBCRYPT:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do - LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-R$found_dir" + LTLIBBCRYPT="${LTLIBBCRYPT}${LTLIBBCRYPT:+ }-R$found_dir" done fi ac_save_CPPFLAGS="$CPPFLAGS" - for element in $INCZ; do + for element in $INCBCRYPT; do haveit= for x in $CPPFLAGS; do @@ -14985,17 +15328,20 @@ fi done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libz" >&5 -$as_echo_n "checking for libz... " >&6; } -if ${ac_cv_libz+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libbcrypt" >&5 +$as_echo_n "checking for libbcrypt... " >&6; } +if ${ac_cv_libbcrypt+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIBZ" + LIBS="$LIBS $LIBBCRYPT" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + + #include + #include + int main () { @@ -15005,25 +15351,1144 @@ main () } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_libz=yes + ac_cv_libbcrypt=yes else - ac_cv_libz=no + ac_cv_libbcrypt=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_save_LIBS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libz" >&5 -$as_echo "$ac_cv_libz" >&6; } - if test "$ac_cv_libz" = yes; then - HAVE_LIBZ=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libbcrypt" >&5 +$as_echo "$ac_cv_libbcrypt" >&6; } + if test "$ac_cv_libbcrypt" = yes; then + HAVE_LIBBCRYPT=yes -$as_echo "#define HAVE_LIBZ 1" >>confdefs.h +$as_echo "#define HAVE_LIBBCRYPT 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libz" >&5 -$as_echo_n "checking how to link with libz... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBZ" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libbcrypt" >&5 +$as_echo_n "checking how to link with libbcrypt... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBBCRYPT" >&5 +$as_echo "$LIBBCRYPT" >&6; } + else + HAVE_LIBBCRYPT=no + CPPFLAGS="$ac_save_CPPFLAGS" + LIBBCRYPT= + LTLIBBCRYPT= + LIBBCRYPT_PREFIX= + fi + + + + + + + + + + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libcrypt32-prefix was given. +if test "${with_libcrypt32_prefix+set}" = set; then : + withval=$with_libcrypt32_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + fi + fi + +fi + + LIBCRYPT32= + LTLIBCRYPT32= + INCCRYPT32= + LIBCRYPT32_PREFIX= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='crypt32 ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBCRYPT32="${LIBCRYPT32}${LIBCRYPT32:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBCRYPT32="${LTLIBCRYPT32}${LTLIBCRYPT32:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBCRYPT32; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBCRYPT32="${LTLIBCRYPT32}${LTLIBCRYPT32:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then + LIBCRYPT32="${LIBCRYPT32}${LIBCRYPT32:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBCRYPT32="${LIBCRYPT32}${LIBCRYPT32:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBCRYPT32="${LIBCRYPT32}${LIBCRYPT32:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBCRYPT32; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBCRYPT32="${LIBCRYPT32}${LIBCRYPT32:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBCRYPT32="${LIBCRYPT32}${LIBCRYPT32:+ }$found_so" + else + LIBCRYPT32="${LIBCRYPT32}${LIBCRYPT32:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBCRYPT32="${LIBCRYPT32}${LIBCRYPT32:+ }$found_a" + else + LIBCRYPT32="${LIBCRYPT32}${LIBCRYPT32:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + LIBCRYPT32_PREFIX="$basedir" + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCCRYPT32; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCCRYPT32="${INCCRYPT32}${INCCRYPT32:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBCRYPT32; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBCRYPT32="${LIBCRYPT32}${LIBCRYPT32:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBCRYPT32; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBCRYPT32="${LTLIBCRYPT32}${LTLIBCRYPT32:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBCRYPT32="${LIBCRYPT32}${LIBCRYPT32:+ }$dep" + LTLIBCRYPT32="${LTLIBCRYPT32}${LTLIBCRYPT32:+ }$dep" + ;; + esac + done + fi + else + LIBCRYPT32="${LIBCRYPT32}${LIBCRYPT32:+ }-l$name" + LTLIBCRYPT32="${LTLIBCRYPT32}${LTLIBCRYPT32:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBCRYPT32="${LIBCRYPT32}${LIBCRYPT32:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBCRYPT32="${LIBCRYPT32}${LIBCRYPT32:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBCRYPT32="${LTLIBCRYPT32}${LTLIBCRYPT32:+ }-R$found_dir" + done + fi + + + ac_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCCRYPT32; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcrypt32" >&5 +$as_echo_n "checking for libcrypt32... " >&6; } +if ${ac_cv_libcrypt32+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ac_save_LIBS="$LIBS" + LIBS="$LIBS $LIBCRYPT32" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_libcrypt32=yes +else + ac_cv_libcrypt32=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$ac_save_LIBS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libcrypt32" >&5 +$as_echo "$ac_cv_libcrypt32" >&6; } + if test "$ac_cv_libcrypt32" = yes; then + HAVE_LIBCRYPT32=yes + +$as_echo "#define HAVE_LIBCRYPT32 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libcrypt32" >&5 +$as_echo_n "checking how to link with libcrypt32... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBCRYPT32" >&5 +$as_echo "$LIBCRYPT32" >&6; } + else + HAVE_LIBCRYPT32=no + CPPFLAGS="$ac_save_CPPFLAGS" + LIBCRYPT32= + LTLIBCRYPT32= + LIBCRYPT32_PREFIX= + fi + + + + + + + + for ac_header in ntdef.h ntstatus.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " + #include + +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + ac_fn_c_check_decl "$LINENO" "SecureZeroMemory" "ac_cv_have_decl_SecureZeroMemory" " + #include + +" +if test "x$ac_cv_have_decl_SecureZeroMemory" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SECUREZEROMEMORY $ac_have_decl +_ACEOF + +fi +if test "$ac_cv_libbcrypt" = "yes"; then + +$as_echo "#define LIBSSH2_WINCNG 1" >>confdefs.h + + LIBSREQUIRED= # wincng doesn't provide a .pc file. sad face. + LIBS="$LIBS -lbcrypt" + if test "$ac_cv_libcrypt32" = "yes"; then + LIBS="$LIBS -lcrypt32" + fi + found_crypto="Windows Cryptography API: Next Generation" + if test "$ac_cv_have_decl_SecureZeroMemory" = "yes"; then + support_clear_memory=yes + fi +fi + if test "$ac_cv_libbcrypt" = "yes"; then + WINCNG_TRUE= + WINCNG_FALSE='#' +else + WINCNG_TRUE='#' + WINCNG_FALSE= +fi + + + if false; then + OS400QC3_TRUE= + OS400QC3_FALSE='#' +else + OS400QC3_TRUE='#' + OS400QC3_FALSE= +fi + + +# Check if crypto library was found +if test "$found_crypto" = "none"; then + as_fn_error $? "No crypto library found! +Try --with-libssl-prefix=PATH + or --with-libgcrypt-prefix=PATH + or --with-wincng on Windows\ +" "$LINENO" 5 +fi + +# Look for Libz +if test "$use_libz" != "no"; then + + + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libz-prefix was given. +if test "${with_libz_prefix+set}" = set; then : + withval=$with_libz_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + fi + fi + +fi + + LIBZ= + LTLIBZ= + INCZ= + LIBZ_PREFIX= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='z ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBZ="${LIBZ}${LIBZ:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBZ; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then + LIBZ="${LIBZ}${LIBZ:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBZ="${LIBZ}${LIBZ:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBZ="${LIBZ}${LIBZ:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBZ; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBZ="${LIBZ}${LIBZ:+ }$found_so" + else + LIBZ="${LIBZ}${LIBZ:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBZ="${LIBZ}${LIBZ:+ }$found_a" + else + LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + LIBZ_PREFIX="$basedir" + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCZ; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCZ="${INCZ}${INCZ:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBZ; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBZ="${LIBZ}${LIBZ:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBZ; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBZ="${LIBZ}${LIBZ:+ }$dep" + LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$dep" + ;; + esac + done + fi + else + LIBZ="${LIBZ}${LIBZ:+ }-l$name" + LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBZ="${LIBZ}${LIBZ:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBZ="${LIBZ}${LIBZ:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-R$found_dir" + done + fi + + + ac_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCZ; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libz" >&5 +$as_echo_n "checking for libz... " >&6; } +if ${ac_cv_libz+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ac_save_LIBS="$LIBS" + LIBS="$LIBS $LIBZ" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_libz=yes +else + ac_cv_libz=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$ac_save_LIBS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libz" >&5 +$as_echo "$ac_cv_libz" >&6; } + if test "$ac_cv_libz" = yes; then + HAVE_LIBZ=yes + +$as_echo "#define HAVE_LIBZ 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libz" >&5 +$as_echo_n "checking how to link with libz... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBZ" >&5 $as_echo "$LIBZ" >&6; } else HAVE_LIBZ=no @@ -15040,17 +16505,23 @@ $as_echo "$LIBZ" >&6; } if test "$ac_cv_libz" != yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Cannot find libz, disabling compression" >&5 -$as_echo "$as_me: Cannot find libz, disabling compression" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: Cannot find zlib, disabling compression" >&5 +$as_echo "$as_me: Cannot find zlib, disabling compression" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: Try --with-libz-prefix=PATH if you know you have it" >&5 $as_echo "$as_me: Try --with-libz-prefix=PATH if you know you have it" >&6;} else $as_echo "#define LIBSSH2_HAVE_ZLIB 1" >>confdefs.h + if test "${LIBSREQUIRED}" != ""; then + LIBSREQUIRED="${LIBSREQUIRED}," + fi + LIBSREQUIRED="${LIBSREQUIRED}zlib" fi fi + + # # Optional Settings # @@ -15081,6 +16552,36 @@ $as_echo "#define LIBSSH2_DH_GEX_NEW 1" >>confdefs.h fi +# Check whether --enable-clear-memory was given. +if test "${enable_clear_memory+set}" = set; then : + enableval=$enable_clear_memory; CLEAR_MEMORY=$enableval +fi + +if test "$CLEAR_MEMORY" != "no"; then + if test "$support_clear_memory" = "yes"; then + +$as_echo "#define LIBSSH2_CLEAR_MEMORY 1" >>confdefs.h + + enable_clear_memory=yes + else + if test "$CLEAR_MEMORY" = "yes"; then + as_fn_error $? "secure clearing/zeroing of memory is not supported by the selected crypto backend" "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: secure clearing/zeroing of memory is not supported by the selected crypto backend" >&5 +$as_echo "$as_me: WARNING: secure clearing/zeroing of memory is not supported by the selected crypto backend" >&2;} + fi + enable_clear_memory=unsupported + fi +else + if test "$support_clear_memory" = "yes"; then + enable_clear_memory=no + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: secure clearing/zeroing of memory is not supported by the selected crypto backend" >&5 +$as_echo "$as_me: WARNING: secure clearing/zeroing of memory is not supported by the selected crypto backend" >&2;} + enable_clear_memory=unsupported + fi +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable pedantic and debug compiler options" >&5 $as_echo_n "checking whether to enable pedantic and debug compiler options... " >&6; } # Check whether --enable-debug was given. @@ -16104,6 +17605,14 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +$as_echo_n "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -16129,10 +17638,22 @@ if test -z "${SSHD_TRUE}" && test -z "${SSHD_FALSE}"; then Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${OPENSSL_TRUE}" && test -z "${OPENSSL_FALSE}"; then + as_fn_error $? "conditional \"OPENSSL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${LIBGCRYPT_TRUE}" && test -z "${LIBGCRYPT_FALSE}"; then as_fn_error $? "conditional \"LIBGCRYPT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${WINCNG_TRUE}" && test -z "${WINCNG_FALSE}"; then + as_fn_error $? "conditional \"WINCNG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${OS400QC3_TRUE}" && test -z "${OS400QC3_FALSE}"; then + as_fn_error $? "conditional \"OS400QC3\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${BUILD_EXAMPLES_TRUE}" && test -z "${BUILD_EXAMPLES_FALSE}"; then as_fn_error $? "conditional \"BUILD_EXAMPLES\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -17618,7 +19139,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Autoconf 2.62 quotes --file arguments for eval, but not when files + # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in @@ -17631,7 +19152,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but + # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. @@ -17665,21 +19186,19 @@ $as_echo X"$mf" | continue fi # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. + # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue + test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || @@ -18392,11 +19911,12 @@ fi Compiler: ${CC} Compiler flags: ${CFLAGS} Library types: Shared=${enable_shared}, Static=${enable_static} - Crypto library: openssl: ${ac_cv_libssl:-no} (AES-CTR: ${ac_cv_func_EVP_aes_128_ctr:-N/A}) libgcrypt: ${ac_cv_libgcrypt:-no} + Crypto library: ${found_crypto} + Clear memory: $enable_clear_memory Debug build: $enable_debug Build examples: $build_examples Path to sshd: $ac_cv_path_SSHD (only for self-tests) - libz compression: $ac_cv_libz + zlib compression: $ac_cv_libz " >&5 $as_echo "$as_me: summary of build options: @@ -18406,9 +19926,10 @@ $as_echo "$as_me: summary of build options: Compiler: ${CC} Compiler flags: ${CFLAGS} Library types: Shared=${enable_shared}, Static=${enable_static} - Crypto library: openssl: ${ac_cv_libssl:-no} (AES-CTR: ${ac_cv_func_EVP_aes_128_ctr:-N/A}) libgcrypt: ${ac_cv_libgcrypt:-no} + Crypto library: ${found_crypto} + Clear memory: $enable_clear_memory Debug build: $enable_debug Build examples: $build_examples Path to sshd: $ac_cv_path_SSHD (only for self-tests) - libz compression: $ac_cv_libz + zlib compression: $ac_cv_libz " >&6;} diff --git a/vendor/libssh2/configure.ac b/vendor/libssh2/configure.ac index dfc698890..d6bdab4a9 100644 --- a/vendor/libssh2/configure.ac +++ b/vendor/libssh2/configure.ac @@ -2,8 +2,9 @@ AC_INIT(libssh2, [-], libssh2-devel@cool.haxx.se) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([src]) -AM_CONFIG_HEADER([src/libssh2_config.h example/libssh2_config.h]) +AC_CONFIG_HEADERS([src/libssh2_config.h example/libssh2_config.h]) AM_MAINTAINER_MODE +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) dnl SED is needed by some of the tools AC_PATH_PROG( SED, sed, sed-was-not-found-by-configure, @@ -83,59 +84,111 @@ dnl check for how to do large files AC_SYS_LARGEFILE # Configure parameters -AC_ARG_WITH(libgcrypt, - AC_HELP_STRING([--with-libgcrypt],[Use Libgcrypt for crypto]), - use_libgcrypt=$withval,use_libgcrypt=auto) AC_ARG_WITH(openssl, AC_HELP_STRING([--with-openssl],[Use OpenSSL for crypto]), use_openssl=$withval,use_openssl=auto) +AC_ARG_WITH(libgcrypt, + AC_HELP_STRING([--with-libgcrypt],[Use libgcrypt for crypto]), + use_libgcrypt=$withval,use_libgcrypt=auto) +AC_ARG_WITH(wincng, + AC_HELP_STRING([--with-wincng],[Use Windows CNG for crypto]), + use_wincng=$withval,use_wincng=auto) AC_ARG_WITH(libz, - AC_HELP_STRING([--with-libz],[Use Libz for compression]), + AC_HELP_STRING([--with-libz],[Use zlib for compression]), use_libz=$withval,use_libz=auto) -# Look for OpenSSL (default) -if test "$use_openssl" != "no" && test "$use_libgcrypt" != "yes"; then +found_crypto=none +support_clear_memory=no + +# Look for OpenSSL +if test "$found_crypto" = "none" && test "$use_openssl" != "no"; then AC_LIB_HAVE_LINKFLAGS([ssl], [crypto], [#include ]) +fi +if test "$ac_cv_libssl" = "yes"; then + AC_DEFINE(LIBSSH2_OPENSSL, 1, [Use OpenSSL]) LIBSREQUIRED=libssl,libcrypto + + # Not all OpenSSL have AES-CTR functions. + save_LIBS="$LIBS" + LIBS="$LIBS $LIBSSL" + AC_CHECK_FUNCS(EVP_aes_128_ctr) + LIBS="$save_LIBS" + + found_crypto="OpenSSL (AES-CTR: ${ac_cv_func_EVP_aes_128_ctr:-N/A})" fi +AM_CONDITIONAL(OPENSSL, test "$ac_cv_libssl" = "yes") # Look for libgcrypt -if test "$ac_cv_libssl" != "yes" && test "$use_libgcrypt" != "no"; then +if test "$found_crypto" = "none" && test "$use_libgcrypt" != "no"; then AC_LIB_HAVE_LINKFLAGS([gcrypt], [], [#include ]) - LIBS="$LIBS -lgcrypt" -fi - -AC_SUBST(LIBSREQUIRED) - -if test "$ac_cv_libssl" != "yes" && test "$ac_cv_libgcrypt" != "yes"; then - AC_MSG_ERROR([cannot find OpenSSL or Libgcrypt, -try --with-libssl-prefix=PATH or --with-libgcrypt-prefix=PATH]) fi - if test "$ac_cv_libgcrypt" = "yes"; then AC_DEFINE(LIBSSH2_LIBGCRYPT, 1, [Use libgcrypt]) + LIBSREQUIRED= # libgcrypt doesn't provide a .pc file. sad face. + LIBS="$LIBS -lgcrypt" + found_crypto=libgcrypt fi AM_CONDITIONAL(LIBGCRYPT, test "$ac_cv_libgcrypt" = "yes") -# Not all OpenSSL have AES-CTR functions. -if test "$ac_cv_libssl" = "yes"; then - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $LIBSSL" - AC_CHECK_FUNCS(EVP_aes_128_ctr) - LDFLAGS="$save_LDFLAGS" +# Look for Windows Cryptography API: Next Generation +if test "$found_crypto" = "none" && test "$use_wincng" != "no"; then + AC_LIB_HAVE_LINKFLAGS([bcrypt], [], [ + #include + #include + ]) + AC_LIB_HAVE_LINKFLAGS([crypt32], [], [ + #include + #include + ]) + AC_CHECK_HEADERS([ntdef.h ntstatus.h], [], [], [ + #include + ]) + AC_CHECK_DECLS([SecureZeroMemory], [], [], [ + #include + ]) +fi +if test "$ac_cv_libbcrypt" = "yes"; then + AC_DEFINE(LIBSSH2_WINCNG, 1, [Use Windows CNG]) + LIBSREQUIRED= # wincng doesn't provide a .pc file. sad face. + LIBS="$LIBS -lbcrypt" + if test "$ac_cv_libcrypt32" = "yes"; then + LIBS="$LIBS -lcrypt32" + fi + found_crypto="Windows Cryptography API: Next Generation" + if test "$ac_cv_have_decl_SecureZeroMemory" = "yes"; then + support_clear_memory=yes + fi +fi +AM_CONDITIONAL(WINCNG, test "$ac_cv_libbcrypt" = "yes") + +AM_CONDITIONAL(OS400QC3, false) + +# Check if crypto library was found +if test "$found_crypto" = "none"; then + AC_MSG_ERROR([No crypto library found! +Try --with-libssl-prefix=PATH + or --with-libgcrypt-prefix=PATH + or --with-wincng on Windows\ +]) fi # Look for Libz if test "$use_libz" != "no"; then AC_LIB_HAVE_LINKFLAGS([z], [], [#include ]) if test "$ac_cv_libz" != yes; then - AC_MSG_NOTICE([Cannot find libz, disabling compression]) + AC_MSG_NOTICE([Cannot find zlib, disabling compression]) AC_MSG_NOTICE([Try --with-libz-prefix=PATH if you know you have it]) else AC_DEFINE(LIBSSH2_HAVE_ZLIB, 1, [Compile in zlib support]) + if test "${LIBSREQUIRED}" != ""; then + LIBSREQUIRED="${LIBSREQUIRED}," + fi + LIBSREQUIRED="${LIBSREQUIRED}zlib" fi fi +AC_SUBST(LIBSREQUIRED) + # # Optional Settings # @@ -154,6 +207,30 @@ if test "$GEX_NEW" != "no"; then AC_DEFINE(LIBSSH2_DH_GEX_NEW, 1, [Enable newer diffie-hellman-group-exchange-sha1 syntax]) fi +AC_ARG_ENABLE(clear-memory, + AC_HELP_STRING([--disable-clear-memory],[Disable clearing of memory before being freed]), + [CLEAR_MEMORY=$enableval]) +if test "$CLEAR_MEMORY" != "no"; then + if test "$support_clear_memory" = "yes"; then + AC_DEFINE(LIBSSH2_CLEAR_MEMORY, 1, [Enable clearing of memory before being freed]) + enable_clear_memory=yes + else + if test "$CLEAR_MEMORY" = "yes"; then + AC_MSG_ERROR([secure clearing/zeroing of memory is not supported by the selected crypto backend]) + else + AC_MSG_WARN([secure clearing/zeroing of memory is not supported by the selected crypto backend]) + fi + enable_clear_memory=unsupported + fi +else + if test "$support_clear_memory" = "yes"; then + enable_clear_memory=no + else + AC_MSG_WARN([secure clearing/zeroing of memory is not supported by the selected crypto backend]) + enable_clear_memory=unsupported + fi +fi + dnl ************************************************************ dnl option to switch on compiler debug options dnl @@ -318,9 +395,10 @@ AC_MSG_NOTICE([summary of build options: Compiler: ${CC} Compiler flags: ${CFLAGS} Library types: Shared=${enable_shared}, Static=${enable_static} - Crypto library: openssl: ${ac_cv_libssl:-no} (AES-CTR: ${ac_cv_func_EVP_aes_128_ctr:-N/A}) libgcrypt: ${ac_cv_libgcrypt:-no} + Crypto library: ${found_crypto} + Clear memory: $enable_clear_memory Debug build: $enable_debug Build examples: $build_examples Path to sshd: $ac_cv_path_SSHD (only for self-tests) - libz compression: $ac_cv_libz + zlib compression: $ac_cv_libz ]) diff --git a/vendor/libssh2/AUTHORS b/vendor/libssh2/docs/AUTHORS similarity index 100% rename from vendor/libssh2/AUTHORS rename to vendor/libssh2/docs/AUTHORS diff --git a/vendor/libssh2/docs/CMakeLists.txt b/vendor/libssh2/docs/CMakeLists.txt new file mode 100644 index 000000000..3e9d165ef --- /dev/null +++ b/vendor/libssh2/docs/CMakeLists.txt @@ -0,0 +1,206 @@ +# Copyright (c) 2014 Alexander Lamaison +# +# Redistribution and use in source and binary forms, +# with or without modification, are permitted provided +# that the following conditions are met: +# +# Redistributions of source code must retain the above +# copyright notice, this list of conditions and the +# following disclaimer. +# +# Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# Neither the name of the copyright holder nor the names +# of any other contributors may be used to endorse or +# promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +# OF SUCH DAMAGE. + +set(MAN_PAGES + libssh2_agent_connect.3 + libssh2_agent_disconnect.3 + libssh2_agent_free.3 + libssh2_agent_get_identity.3 + libssh2_agent_init.3 + libssh2_agent_list_identities.3 + libssh2_agent_userauth.3 + libssh2_banner_set.3 + libssh2_base64_decode.3 + libssh2_channel_close.3 + libssh2_channel_direct_tcpip.3 + libssh2_channel_direct_tcpip_ex.3 + libssh2_channel_eof.3 + libssh2_channel_exec.3 + libssh2_channel_flush.3 + libssh2_channel_flush_ex.3 + libssh2_channel_flush_stderr.3 + libssh2_channel_forward_accept.3 + libssh2_channel_forward_cancel.3 + libssh2_channel_forward_listen.3 + libssh2_channel_forward_listen_ex.3 + libssh2_channel_free.3 + libssh2_channel_get_exit_signal.3 + libssh2_channel_get_exit_status.3 + libssh2_channel_handle_extended_data.3 + libssh2_channel_handle_extended_data2.3 + libssh2_channel_ignore_extended_data.3 + libssh2_channel_open_ex.3 + libssh2_channel_open_session.3 + libssh2_channel_process_startup.3 + libssh2_channel_read.3 + libssh2_channel_read_ex.3 + libssh2_channel_read_stderr.3 + libssh2_channel_receive_window_adjust.3 + libssh2_channel_receive_window_adjust2.3 + libssh2_channel_request_pty.3 + libssh2_channel_request_pty_ex.3 + libssh2_channel_request_pty_size.3 + libssh2_channel_request_pty_size_ex.3 + libssh2_channel_send_eof.3 + libssh2_channel_set_blocking.3 + libssh2_channel_setenv.3 + libssh2_channel_setenv_ex.3 + libssh2_channel_shell.3 + libssh2_channel_subsystem.3 + libssh2_channel_wait_closed.3 + libssh2_channel_wait_eof.3 + libssh2_channel_window_read.3 + libssh2_channel_window_read_ex.3 + libssh2_channel_window_write.3 + libssh2_channel_window_write_ex.3 + libssh2_channel_write.3 + libssh2_channel_write_ex.3 + libssh2_channel_write_stderr.3 + libssh2_channel_x11_req.3 + libssh2_channel_x11_req_ex.3 + libssh2_exit.3 + libssh2_free.3 + libssh2_hostkey_hash.3 + libssh2_init.3 + libssh2_keepalive_config.3 + libssh2_keepalive_send.3 + libssh2_knownhost_add.3 + libssh2_knownhost_addc.3 + libssh2_knownhost_check.3 + libssh2_knownhost_checkp.3 + libssh2_knownhost_del.3 + libssh2_knownhost_free.3 + libssh2_knownhost_get.3 + libssh2_knownhost_init.3 + libssh2_knownhost_readfile.3 + libssh2_knownhost_readline.3 + libssh2_knownhost_writefile.3 + libssh2_knownhost_writeline.3 + libssh2_poll.3 + libssh2_poll_channel_read.3 + libssh2_publickey_add.3 + libssh2_publickey_add_ex.3 + libssh2_publickey_init.3 + libssh2_publickey_list_fetch.3 + libssh2_publickey_list_free.3 + libssh2_publickey_remove.3 + libssh2_publickey_remove_ex.3 + libssh2_publickey_shutdown.3 + libssh2_scp_recv.3 + libssh2_scp_recv2.3 + libssh2_scp_send.3 + libssh2_scp_send64.3 + libssh2_scp_send_ex.3 + libssh2_session_abstract.3 + libssh2_session_banner_get.3 + libssh2_session_banner_set.3 + libssh2_session_block_directions.3 + libssh2_session_callback_set.3 + libssh2_session_disconnect.3 + libssh2_session_disconnect_ex.3 + libssh2_session_flag.3 + libssh2_session_free.3 + libssh2_session_get_blocking.3 + libssh2_session_get_timeout.3 + libssh2_session_hostkey.3 + libssh2_session_init.3 + libssh2_session_init_ex.3 + libssh2_session_last_errno.3 + libssh2_session_last_error.3 + libssh2_session_set_last_error.3 + libssh2_session_method_pref.3 + libssh2_session_methods.3 + libssh2_session_set_blocking.3 + libssh2_session_set_timeout.3 + libssh2_session_startup.3 + libssh2_session_supported_algs.3 + libssh2_sftp_close.3 + libssh2_sftp_close_handle.3 + libssh2_sftp_closedir.3 + libssh2_sftp_fsetstat.3 + libssh2_sftp_fstat.3 + libssh2_sftp_fstat_ex.3 + libssh2_sftp_fstatvfs.3 + libssh2_sftp_fsync.3 + libssh2_sftp_get_channel.3 + libssh2_sftp_init.3 + libssh2_sftp_last_error.3 + libssh2_sftp_lstat.3 + libssh2_sftp_mkdir.3 + libssh2_sftp_mkdir_ex.3 + libssh2_sftp_open.3 + libssh2_sftp_open_ex.3 + libssh2_sftp_opendir.3 + libssh2_sftp_read.3 + libssh2_sftp_readdir.3 + libssh2_sftp_readdir_ex.3 + libssh2_sftp_readlink.3 + libssh2_sftp_realpath.3 + libssh2_sftp_rename.3 + libssh2_sftp_rename_ex.3 + libssh2_sftp_rewind.3 + libssh2_sftp_rmdir.3 + libssh2_sftp_rmdir_ex.3 + libssh2_sftp_seek.3 + libssh2_sftp_seek64.3 + libssh2_sftp_setstat.3 + libssh2_sftp_shutdown.3 + libssh2_sftp_stat.3 + libssh2_sftp_stat_ex.3 + libssh2_sftp_statvfs.3 + libssh2_sftp_symlink.3 + libssh2_sftp_symlink_ex.3 + libssh2_sftp_tell.3 + libssh2_sftp_tell64.3 + libssh2_sftp_unlink.3 + libssh2_sftp_unlink_ex.3 + libssh2_sftp_write.3 + libssh2_trace.3 + libssh2_trace_sethandler.3 + libssh2_userauth_authenticated.3 + libssh2_userauth_hostbased_fromfile.3 + libssh2_userauth_hostbased_fromfile_ex.3 + libssh2_userauth_keyboard_interactive.3 + libssh2_userauth_keyboard_interactive_ex.3 + libssh2_userauth_list.3 + libssh2_userauth_password.3 + libssh2_userauth_password_ex.3 + libssh2_userauth_publickey.3 + libssh2_userauth_publickey_fromfile.3 + libssh2_userauth_publickey_fromfile_ex.3 + libssh2_version.3) + +include(GNUInstallDirs) +install(FILES ${MAN_PAGES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3) diff --git a/vendor/libssh2/HACKING b/vendor/libssh2/docs/HACKING similarity index 100% rename from vendor/libssh2/HACKING rename to vendor/libssh2/docs/HACKING diff --git a/vendor/libssh2/docs/HACKING.CRYPTO b/vendor/libssh2/docs/HACKING.CRYPTO new file mode 100644 index 000000000..a8a6a0618 --- /dev/null +++ b/vendor/libssh2/docs/HACKING.CRYPTO @@ -0,0 +1,593 @@ + Definitions needed to implement a specific crypto library + +This document offers some hints about implementing a new crypto library +interface. + +A crypto library interface consists of at least a header file, defining +entities referenced from the libssh2 core modules. +Real code implementation (if needed), is left at the implementor's choice. + +This document lists the entities that must/may be defined in the header file. + +Procedures listed as "void" may indeed have a result type: the void indication +indicates the libssh2 core modules never use the function result. + + +1) Crypto library initialization/termination. + +void libssh2_crypto_init(void); +Initializes the crypto library. May be an empty macro if not needed. + +void libssh2_crypto_exit(void); +Terminates the crypto library use. May be an empty macro if not needed. + + +2) HMAC + +libssh2_hmac_ctx +Type of an HMAC computation context. Generally a struct. +Used for all hash algorithms. + +void libssh2_hmac_ctx_init(libssh2_hmac_ctx ctx); +Initializes the HMAC computation context ctx. +Called before setting-up the hash algorithm. +Note: if the ctx parameter is modified by the underlying code, +this procedure must be implemented as a macro to map ctx --> &ctx. + +void libssh2_hmac_update(libssh2_hmac_ctx ctx, + const unsigned char *data, + int datalen); +Continue computation of an HMAC on datalen bytes at data using context ctx. +Note: if the ctx parameter is modified by the underlying code, +this procedure must be implemented as a macro to map ctx --> &ctx. + +void libssh2_hmac_final(libssh2_hmac_ctx ctx, + unsigned char output[]); +Get the computed HMAC from context ctx into the output buffer. The +minimum data buffer size depends on the HMAC hash algorithm. +Note: if the ctx parameter is modified by the underlying code, +this procedure must be implemented as a macro to map ctx --> &ctx. + +void libssh2_hmac_cleanup(libssh2_hmac_ctx *ctx); +Releases the HMAC computation context at ctx. + + +3) Hash algorithms. + +3.1) SHA-1 +Must always be implemented. + +SHA_DIGEST_LENGTH +#define to 20, the SHA-1 digest length. + +libssh2_sha1_ctx +Type of an SHA1 computation context. Generally a struct. + +int libssh2_sha1_init(libssh2_sha1_ctx *x); +Initializes the SHA-1 computation context at x. +Returns 1 for success and 0 for failure + +void libssh2_sha1_update(libssh2_sha1_ctx ctx, + const unsigned char *data, + size_t len); +Continue computation of SHA-1 on len bytes at data using context ctx. +Note: if the ctx parameter is modified by the underlying code, +this procedure must be implemented as a macro to map ctx --> &ctx. + +void libssh2_sha1_final(libssh2_sha1_ctx ctx, + unsigned char output[SHA1_DIGEST_LEN]); +Get the computed SHA-1 signature from context ctx and store it into the +output buffer. +Release the context. +Note: if the ctx parameter is modified by the underlying code, +this procedure must be implemented as a macro to map ctx --> &ctx. + +void libssh2_hmac_sha1_init(libssh2_hmac_ctx *ctx, + const void *key, + int keylen); +Setup the HMAC computation context ctx for an HMAC-SHA-1 computation using the +keylen-byte key. Is invoked just after libssh2_hmac_ctx_init(). + +3.2) SHA-256 +Must always be implemented. + +SHA256_DIGEST_LENGTH +#define to 32, the SHA-256 digest length. + +libssh2_sha256_ctx +Type of an SHA-256 computation context. Generally a struct. + +int libssh2_sha256_init(libssh2_sha256_ctx *x); +Initializes the SHA-256 computation context at x. +Returns 1 for success and 0 for failure + +void libssh2_sha256_update(libssh2_sha256_ctx ctx, + const unsigned char *data, + size_t len); +Continue computation of SHA-256 on len bytes at data using context ctx. +Note: if the ctx parameter is modified by the underlying code, +this procedure must be implemented as a macro to map ctx --> &ctx. + +void libssh2_sha256_final(libssh2_sha256_ctx ctx, + unsigned char output[SHA256_DIGEST_LENGTH]); +Gets the computed SHA-256 signature from context ctx into the output buffer. +Release the context. +Note: if the ctx parameter is modified by the underlying code, +this procedure must be implemented as a macro to map ctx --> &ctx. + +int libssh2_sha256(const unsigned char *message, + unsigned long len, + unsigned char output[SHA256_DIGEST_LENGTH]); +Computes the SHA-256 signature over the given message of length len and +store the result into the output buffer. +Return 1 if error, else 0. +Note: Seems unused in current code, but defined in each crypto library backend. + +LIBSSH2_HMAC_SHA256 +#define as 1 if the crypto library supports HMAC-SHA-256, else 0. +If defined as 0, the rest of this section can be omitted. + +void libssh2_hmac_sha256_init(libssh2_hmac_ctx *ctx, + const void *key, + int keylen); +Setup the HMAC computation context ctx for an HMAC-256 computation using the +keylen-byte key. Is invoked just after libssh2_hmac_ctx_init(). + +3.3) SHA-512 +LIBSSH2_HMAC_SHA512 +#define as 1 if the crypto library supports HMAC-SHA-512, else 0. +If defined as 0, the rest of this section can be omitted. + +SHA512_DIGEST_LENGTH +#define to 64, the SHA-512 digest length. + +void libssh2_hmac_sha512_init(libssh2_hmac_ctx *ctx, + const void *key, + int keylen); +Setup the HMAC computation context ctx for an HMAC-512 computation using the +keylen-byte key. Is invoked just after libssh2_hmac_ctx_init(). + +3.4) MD5 +LIBSSH2_MD5 +#define to 1 if the crypto library supports MD5, else 0. +If defined as 0, the rest of this section can be omitted. + +MD5_DIGEST_LENGTH +#define to 16, the MD5 digest length. + +libssh2_md5_ctx +Type of an MD5 computation context. Generally a struct. + +int libssh2_md5_init(libssh2_md5_ctx *x); +Initializes the MD5 computation context at x. +Returns 1 for success and 0 for failure + +void libssh2_md5_update(libssh2_md5_ctx ctx, + const unsigned char *data, + size_t len); +Continues computation of MD5 on len bytes at data using context ctx. +Returns 1 for success and 0 for failure. +Note: if the ctx parameter is modified by the underlying code, +this procedure must be implemented as a macro to map ctx --> &ctx. + +void libssh2_md5_final(libssh2_md5_ctx ctx, + unsigned char output[MD5_DIGEST_LENGTH]); +Gets the computed MD5 signature from context ctx into the output buffer. +Release the context. +Note: if the ctx parameter is modified by the underlying code, +this procedure must be implemented as a macro to map ctx --> &ctx. + +void libssh2_hmac_md5_init(libssh2_hmac_ctx *ctx, + const void *key, + int keylen); +Setup the HMAC computation context ctx for an HMAC-MD5 computation using the +keylen-byte key. Is invoked just after libssh2_hmac_ctx_init(). + +3.5) RIPEMD-160 +LIBSSH2_HMAC_RIPEMD +#define as 1 if the crypto library supports HMAC-RIPEMD-160, else 0. +If defined as 0, the rest of this section can be omitted. + +void libssh2_hmac_ripemd160_init(libssh2_hmac_ctx *ctx, + const void *key, + int keylen); +Setup the HMAC computation context ctx for an HMAC-RIPEMD-160 computation using +the keylen-byte key. Is invoked just after libssh2_hmac_ctx_init(). +Returns 1 for success and 0 for failure. + + +4) Bidirectional Key ciphers. + +_libssh2_cipher_ctx +Type of a cipher computation context. + +_libssh2_cipher_type(name); +Macro defining name as storage identifying a cipher algorithm for +the crypto library interface. No trailing semicolon. + +int _libssh2_cipher_init(_libssh2_cipher_ctx *h, + _libssh2_cipher_type(algo), + unsigned char *iv, + unsigned char *secret, + int encrypt); +Creates a cipher context for the given algorithm with the initialization vector +iv and the secret key secret. Prepare for encryption or decryption depending on +encrypt. +Return 0 if OK, else -1. +This procedure is already prototyped in crypto.h. + +int _libssh2_cipher_crypt(_libssh2_cipher_ctx *ctx, + _libssh2_cipher_type(algo), + int encrypt, + unsigned char *block, + size_t blocksize); +Encrypt or decrypt in-place data at (block, blocksize) using the given +context and/or algorithm. +Return 0 if OK, else -1. +This procedure is already prototyped in crypto.h. + +void _libssh2_cipher_dtor(_libssh2_cipher_ctx *ctx); +Release cipher context at ctx. + +4.1) AES +4.1.1) AES in CBC block mode. +LIBSSH2_AES +#define as 1 if the crypto library supports AES in CBC mode, else 0. +If defined as 0, the rest of this section can be omitted. + +_libssh2_cipher_aes128 +AES-128-CBC algorithm identifier initializer. +#define with constant value of type _libssh2_cipher_type(). + +_libssh2_cipher_aes192 +AES-192-CBC algorithm identifier initializer. +#define with constant value of type _libssh2_cipher_type(). + +_libssh2_cipher_aes256 +AES-256-CBC algorithm identifier initializer. +#define with constant value of type _libssh2_cipher_type(). + +4.1.2) AES in CTR block mode. +LIBSSH2_AES_CTR +#define as 1 if the crypto library supports AES in CTR mode, else 0. +If defined as 0, the rest of this section can be omitted. + +void _libssh2_init_aes_ctr(void); +Initialize static AES CTR ciphers. +This procedure is already prototyped in crypto.h. + +_libssh2_cipher_aes128ctr +AES-128-CTR algorithm identifier initializer. +#define with constant value of type _libssh2_cipher_type(). + +_libssh2_cipher_aes192ctr +AES-192-CTR algorithm identifier initializer. +#define with constant value of type _libssh2_cipher_type(). + +_libssh2_cipher_aes256ctr +AES-256-CTR algorithm identifier initializer. +#define with constant value of type _libssh2_cipher_type(). + +4.2) Blowfish in CBC block mode. +LIBSSH2_BLOWFISH +#define as 1 if the crypto library supports blowfish in CBC mode, else 0. +If defined as 0, the rest of this section can be omitted. + +_libssh2_cipher_blowfish +Blowfish-CBC algorithm identifier initializer. +#define with constant value of type _libssh2_cipher_type(). + +4.3) RC4. +LIBSSH2_RC4 +#define as 1 if the crypto library supports RC4 (arcfour), else 0. +If defined as 0, the rest of this section can be omitted. + +_libssh2_cipher_arcfour +RC4 algorithm identifier initializer. +#define with constant value of type _libssh2_cipher_type(). + +4.4) CAST5 in CBC block mode. +LIBSSH2_CAST +#define 1 if the crypto library supports cast, else 0. +If defined as 0, the rest of this section can be omitted. + +_libssh2_cipher_cast5 +CAST5-CBC algorithm identifier initializer. +#define with constant value of type _libssh2_cipher_type(). + +4.5) Tripple DES in CBC block mode. +LIBSSH2_3DES +#define as 1 if the crypto library supports TripleDES in CBC mode, else 0. +If defined as 0, the rest of this section can be omitted. + +_libssh2_cipher_3des +TripleDES-CBC algorithm identifier initializer. +#define with constant value of type _libssh2_cipher_type(). + + +5) Big numbers. +Positive multi-byte integers support is sufficient. + +5.1) Computation contexts. +This has a real meaning if the big numbers computations need some context +storage. If not, use a dummy type and functions (macros). + +_libssh2_bn_ctx +Type of multiple precision computation context. May not be empty. if not used, +#define as char, for example. + +libssh2_bn_ctx _libssh2_bn_ctx_new(void); +Returns a new multiple precision computation context. + +void _libssh2_bn_ctx_free(_libssh2_bn_ctx ctx); +Releases a multiple precision computation context. + +5.2) Computation support. +_libssh2_bn +Type of multiple precision numbers (aka bignumbers or huge integers) for the +crypto library. + +_libssh2_bn * _libssh2_bn_init(void); +Creates a multiple precision number (preset to zero). + +_libssh2_bn * _libssh2_bn_init_from_bin(void); +Create a multiple precision number intended to be set by the +_libssh2_bn_from_bin() function (see below). Unlike _libssh2_bn_init(), this +code may be a dummy initializer if the _libssh2_bn_from_bin() actually +allocates the number. Returns a value of type _libssh2_bn *. + +void _libssh2_bn_free(_libssh2_bn *bn); +Destroys the multiple precision number at bn. + +unsigned long _libssh2_bn_bytes(libssh2_bn *bn); +Get the number of bytes needed to store the bits of the multiple precision +number at bn. + +unsigned long _libssh2_bn_bits(_libssh2_bn *bn); +Returns the number of bits of multiple precision number at bn. + +int _libssh2_bn_set_word(_libssh2_bn *bn, unsigned long val); +Sets the value of bn to val. +Returns 1 on success, 0 otherwise. + +_libssh2_bn * _libssh2_bn_from_bin(_libssh2_bn *bn, int len, + const unsigned char *val); +Converts the positive integer in big-endian form of length len at val +into a _libssh2_bn and place it in bn. If bn is NULL, a new _libssh2_bn is +created. +Returns a pointer to target _libssh2_bn or NULL if error. + +int _libssh2_bn_to_bin(_libssh2_bn *bn, unsigned char *val); +Converts the absolute value of bn into big-endian form and store it at +val. val must point to _libssh2_bn_bytes(bn) bytes of memory. +Returns the length of the big-endian number. + +void _libssh2_bn_rand(_libssh2_bn *bn, int bits, int top, int bottom); +Generates a cryptographically strong pseudo-random number of bits in +length and stores it in bn. If top is -1, the most significant bit of the +random number can be zero. If top is 0, it is set to 1, and if top is 1, the +two most significant bits of the number will be set to 1, so that the product +of two such random numbers will always have 2*bits length. If bottom is true, +the number will be odd. + +void _libssh2_bn_mod_exp(_libssh2_bn *r, _libssh2_bn *a, + _libssh2_bn *p, _libssh2_bn *m, + _libssh2_bn_ctx *ctx); +Computes a to the p-th power modulo m and stores the result into r (r=a^p % m). +May use the given context. + + +6) Private key algorithms. +Format of an RSA public key: +a) "ssh-rsa". +b) RSA exponent, MSB first, with high order bit = 0. +c) RSA modulus, MSB first, with high order bit = 0. +Each item is preceded by its 32-bit byte length, MSB first. + +Format of a DSA public key: +a) "ssh-dss". +b) p, MSB first, with high order bit = 0. +c) q, MSB first, with high order bit = 0. +d) g, MSB first, with high order bit = 0. +e) pub_key, MSB first, with high order bit = 0. +Each item is preceded by its 32-bit byte length, MSB first. + +int _libssh2_pub_priv_keyfile(LIBSSH2_SESSION *session, + unsigned char **method, + size_t *method_len, + unsigned char **pubkeydata, + size_t *pubkeydata_len, + const char *privatekey, + const char *passphrase); +Reads a private key from file privatekey and extract the public key --> +(pubkeydata, pubkeydata_len). Store the associated method (ssh-rsa or ssh-dss) +into (method, method_len). +Both buffers have to be allocated using LIBSSH2_ALLOC(). +Returns 0 if OK, else -1. +This procedure is already prototyped in crypto.h. + +int _libssh2_pub_priv_keyfilememory(LIBSSH2_SESSION *session, + unsigned char **method, + size_t *method_len, + unsigned char **pubkeydata, + size_t *pubkeydata_len, + const char *privatekeydata, + size_t privatekeydata_len, + const char *passphrase); +Gets a private key from bytes at (privatekeydata, privatekeydata_len) and +extract the public key --> (pubkeydata, pubkeydata_len). Store the associated +method (ssh-rsa or ssh-dss) into (method, method_len). +Both buffers have to be allocated using LIBSSH2_ALLOC(). +Returns 0 if OK, else -1. +This procedure is already prototyped in crypto.h. + +6.1) RSA +LIBSSH2_RSA +#define as 1 if the crypto library supports RSA, else 0. +If defined as 0, the rest of this section can be omitted. + +libssh2_rsa_ctx +Type of an RSA computation context. Generally a struct. + +int _libssh2_rsa_new(libssh2_rsa_ctx **rsa, + const unsigned char *edata, + unsigned long elen, + const unsigned char *ndata, + unsigned long nlen, + const unsigned char *ddata, + unsigned long dlen, + const unsigned char *pdata, + unsigned long plen, + const unsigned char *qdata, + unsigned long qlen, + const unsigned char *e1data, + unsigned long e1len, + const unsigned char *e2data, + unsigned long e2len, + const unsigned char *coeffdata, unsigned long coefflen); +Creates a new context for RSA computations from key source values: + pdata, plen Prime number p. Only used if private key known (ddata). + qdata, qlen Prime number q. Only used if private key known (ddata). + ndata, nlen Modulus n. + edata, elen Exponent e. + ddata, dlen e^-1 % phi(n) = private key. May be NULL if unknown. + e1data, e1len dp = d % (p-1). Only used if private key known (dtata). + e2data, e2len dq = d % (q-1). Only used if private key known (dtata). + coeffdata, coefflen q^-1 % p. Only used if private key known. +Returns 0 if OK. +This procedure is already prototyped in crypto.h. +Note: the current generic code only calls this function with e and n (public +key parameters): unless used internally by the backend, it is not needed to +support the private key and the other parameters here. + +int _libssh2_rsa_new_private(libssh2_rsa_ctx **rsa, + LIBSSH2_SESSION *session, + const char *filename, + unsigned const char *passphrase); +Reads an RSA private key from file filename into a new RSA context. +Must call _libssh2_init_if_needed(). +Return 0 if OK, else -1. +This procedure is already prototyped in crypto.h. + +int _libssh2_rsa_new_private_frommemory(libssh2_rsa_ctx **rsa, + LIBSSH2_SESSION *session, + const char *data, + size_t data_len, + unsigned const char *passphrase); +Gets an RSA private key from data into a new RSA context. +Must call _libssh2_init_if_needed(). +Return 0 if OK, else -1. +This procedure is already prototyped in crypto.h. + +int _libssh2_rsa_sha1_verify(libssh2_rsa_ctx *rsa, + const unsigned char *sig, + unsigned long sig_len, + const unsigned char *m, unsigned long m_len); +Verify (sig, siglen) signature of (m, m_len) using an SHA-1 hash and the +RSA context. +Return 0 if OK, else -1. +This procedure is already prototyped in crypto.h. + +int _libssh2_rsa_sha1_signv(LIBSSH2_SESSION *session, + unsigned char **sig, size_t *siglen, + int count, const struct iovec vector[], + libssh2_rsa_ctx *ctx); +RSA signs the SHA-1 hash computed over the count data chunks in vector. +Signature is stored at (sig, siglen). +Signature buffer must be allocated from the given session. +Returns 0 if OK, else -1. +Note: this procedure is optional: if provided, it MUST be defined as a macro. + +int _libssh2_rsa_sha1_sign(LIBSSH2_SESSION *session, + libssh2_rsa_ctx *rsactx, + const unsigned char *hash, + size_t hash_len, + unsigned char **signature, + size_t *signature_len); +RSA signs the (hash, hashlen) SHA-1 hash bytes and stores the allocated +signature at (signature, signature_len). +Signature buffer must be allocated from the given session. +Returns 0 if OK, else -1. +This procedure is already prototyped in crypto.h. +Note: this procedure is not used if macro _libssh2_rsa_sha1_signv() is defined. + +void _libssh2_rsa_free(libssh2_rsa_ctx *rsactx); +Releases the RSA computation context at rsactx. + + +6.2) DSA +LIBSSH2_DSA +#define as 1 if the crypto library supports DSA, else 0. +If defined as 0, the rest of this section can be omitted. + + +libssh2_dsa_ctx +Type of a DSA computation context. Generally a struct. + +int _libssh2_dsa_new(libssh2_dsa_ctx **dsa, + const unsigned char *pdata, + unsigned long plen, + const unsigned char *qdata, + unsigned long qlen, + const unsigned char *gdata, + unsigned long glen, + const unsigned char *ydata, + unsigned long ylen, + const unsigned char *x, unsigned long x_len); +Creates a new context for DSA computations from source key values: + pdata, plen Prime number p. Only used if private key known (ddata). + qdata, qlen Prime number q. Only used if private key known (ddata). + gdata, glen G number. + ydata, ylen Public key. + xdata, xlen Private key. Only taken if xlen non-zero. +Returns 0 if OK. +This procedure is already prototyped in crypto.h. + +int _libssh2_dsa_new_private(libssh2_dsa_ctx **dsa, + LIBSSH2_SESSION *session, + const char *filename, + unsigned const char *passphrase); +Gets a DSA private key from file filename into a new DSA context. +Must call _libssh2_init_if_needed(). +Return 0 if OK, else -1. +This procedure is already prototyped in crypto.h. + +int _libssh2_dsa_new_private_frommemory(libssh2_dsa_ctx **dsa, + LIBSSH2_SESSION *session, + const char *data, + size_t data_len, + unsigned const char *passphrase); +Gets a DSA private key from the data_len-bytes data into a new DSA context. +Must call _libssh2_init_if_needed(). +Returns 0 if OK, else -1. +This procedure is already prototyped in crypto.h. + +int _libssh2_dsa_sha1_verify(libssh2_dsa_ctx *dsactx, + const unsigned char *sig, + const unsigned char *m, unsigned long m_len); +Verify (sig, siglen) signature of (m, m_len) using an SHA1 hash and the +DSA context. +Returns 0 if OK, else -1. +This procedure is already prototyped in crypto.h. + +int _libssh2_dsa_sha1_sign(libssh2_dsa_ctx *dsactx, + const unsigned char *hash, + unsigned long hash_len, unsigned char *sig); +DSA signs the (hash, hash_len) data using SHA-1 and store the signature at sig. +Returns 0 if OK, else -1. +This procedure is already prototyped in crypto.h. + +void _libssh2_dsa_free(libssh2_dsa_ctx *dsactx); +Releases the DSA computation context at dsactx. + + +7) Miscellaneous + +void libssh2_prepare_iovec(struct iovec *vector, unsigned int len); +Prepare len consecutive iovec slots before using them. +In example, this is needed to preset unused structure slacks on platforms +requiring it. +If this is not needed, it should be defined as an empty macro. + +void _libssh2_random(unsigned char *buf, int len); +Store len random bytes at buf. diff --git a/vendor/libssh2/INSTALL b/vendor/libssh2/docs/INSTALL_AUTOTOOLS similarity index 77% rename from vendor/libssh2/INSTALL rename to vendor/libssh2/docs/INSTALL_AUTOTOOLS index 23e5f25d0..bc5a0eb25 100644 --- a/vendor/libssh2/INSTALL +++ b/vendor/libssh2/docs/INSTALL_AUTOTOOLS @@ -234,3 +234,92 @@ configuration-related scripts to be executed by `/bin/bash'. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. +More configure options +====================== + +Some ./configure options deserve additional comments: + + * --enable-crypt-none + + The SSH2 Transport allows for unencrypted data + transmission using the "none" cipher. Because this is + such a huge security hole, it is typically disabled on + SSH2 implementations and is disabled in libssh2 by + default as well. + + Enabling this option will allow for "none" as a + negotiable method, however it still requires that the + method be advertized by the remote end and that no + more-preferable methods are available. + + * --enable-mac-none + + The SSH2 Transport also allows implementations to + forego a message authentication code. While this is + less of a security risk than using a "none" cipher, it + is still not recommended as disabling MAC hashes + removes a layer of security. + + Enabling this option will allow for "none" as a + negotiable method, however it still requires that the + method be advertized by the remote end and that no + more-preferable methods are available. + + * --disable-gex-new + + The diffie-hellman-group-exchange-sha1 (dh-gex) key + exchange method originally defined an exchange + negotiation using packet type 30 to request a + generation pair based on a single target value. Later + refinement of dh-gex provided for range and target + values. By default libssh2 will use the newer range + method. + + If you experience trouble connecting to an old SSH + server using dh-gex, try this option to fallback on + the older more reliable method. + + * --with-libgcrypt + * --without-libgcrypt + * --with-libgcrypt-prefix=DIR + + libssh2 can use the Libgcrypt library + (http://www.gnupg.org/) for cryptographic operations. + Either Libgcrypt or OpenSSL is required. + + Configure will attempt to locate Libgcrypt + automatically. + + If your installation of Libgcrypt is in another + location, specify it using --with-libgcrypt-prefix. + + * --with-openssl + * --without-openssl + * --with-libssl-prefix=[DIR] + + libssh2 can use the OpenSSL library + (http://www.openssl.org) for cryptographic operations. + Either Libgcrypt or OpenSSL is required. + + Configure will attempt to locate OpenSSL in the + default location. + + If your installation of OpenSSL is in another + location, specify it using --with-libssl-prefix. + + * --with-libz + * --without-libz + * --with-libz-prefix=[DIR] + + If present, libssh2 will attempt to use the zlib + (http://www.zlib.org) for payload compression, however + zlib is not required. + + If your installation of Libz is in another location, + specify it using --with-libz-prefix. + + * --enable-debug + + Will make the build use more pedantic and strict compiler + options as well as enable the libssh2_trace() function (for + showing debug traces). diff --git a/vendor/libssh2/docs/INSTALL_CMAKE b/vendor/libssh2/docs/INSTALL_CMAKE new file mode 100644 index 000000000..704037059 --- /dev/null +++ b/vendor/libssh2/docs/INSTALL_CMAKE @@ -0,0 +1,174 @@ +License: see COPYING + +Source code: https://github.com/libssh2/libssh2 + +Web site source code: https://github.com/libssh2/www + +Installation instructions are in docs/INSTALL +======= +To build libssh2 you will need CMake v2.8 or later [1] and one of the +following cryptography libraries: + +* OpenSSL +* Libgcrypt +* WinCNG + +Getting started +--------------- + +If you are happy with the default options, make a new build directory, +change to it, configure the build environment and build the project: + + mkdir bin + cd bin + cmake .. + cmake --build . + +libssh2 will be built as a static library and will use any +cryptography library available. The library binary will be put in +`bin/src`, with the examples in `bin/example` and the tests in +`bin/tests`. + +Customising the build +--------------------- + +Of course, you might want to customise the build options. You can +pass the options to CMake on the command line: + + cmake -D