Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fb35ca3

Browse filesBrowse files
sam-githubItalo A. Casas
authored andcommitted
test: test hmac binding robustness
The Hmac binding layer is not documented as part of the API, and is not intended to be used, but it should be robust to misuse, and contains defensive checks for misuse. This test checks that updates without init throw (as opposed to abort or misbehave in some other way). PR-URL: #10923 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent c4b9f0a commit fb35ca3
Copy full SHA for fb35ca3

File tree

Expand file treeCollapse file tree

1 file changed

+8
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-0
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-crypto-hmac.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-crypto-hmac.js
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ if (!common.hasCrypto) {
88
}
99
var crypto = require('crypto');
1010

11+
// Test for binding layer robustness
12+
{
13+
const binding = process.binding('crypto');
14+
const h = new binding.Hmac();
15+
// Fail to init the Hmac with an algorithm.
16+
assert.throws(() => h.update('hello'), /^TypeError: HmacUpdate fail$/);
17+
}
18+
1119
// Test HMAC
1220
var h1 = crypto.createHmac('sha1', 'Node')
1321
.update('some data')

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.