Skip to content

Commit

Permalink
libsodium 1.0.19
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed Sep 13, 2023
1 parent 10289df commit d96986a
Show file tree
Hide file tree
Showing 107 changed files with 1,011 additions and 87 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ $(MODULES_SUMO_DIR)/libsodium-sumo.js: wrapper/libsodium-pre.js wrapper/libsodiu
cat $(MODULES_SUMO_DIR)/libsodium-sumo.js $(MODULES_SUMO_DIR)/libsodium-wrappers.js > $(BROWSERS_SUMO_DIR)/sodium.js

$(LIBSODIUM_DIR)/test/default/browser/sodium_core.html: $(LIBSODIUM_DIR)/configure
cd $(LIBSODIUM_DIR) && ./dist-build/emscripten.sh --browser-tests
cd $(LIBSODIUM_DIR) && env CPPFLAGS="-DFAVOR_PERFORMANCE" ./dist-build/emscripten.sh --browser-tests
rm -f $(LIBSODIUM_DIR)/test/default/browser/*.asm.html $(LIBSODIUM_DIR)/test/default/browser/*.asm.js
rm -fr $(BROWSERS_TEST_DIR) && cp -R $(LIBSODIUM_DIR)/test/default/browser $(BROWSERS_TEST_DIR)

$(LIBSODIUM_JS_DIR)/lib/libsodium.js: $(LIBSODIUM_DIR)/configure
cd $(LIBSODIUM_DIR) && ./dist-build/emscripten.sh --standard
cd $(LIBSODIUM_DIR) && env CPPFLAGS="-DFAVOR_PERFORMANCE" ./dist-build/emscripten.sh --standard

$(LIBSODIUM_JS_SUMO_DIR)/lib/libsodium.js: $(LIBSODIUM_DIR)/configure
cd $(LIBSODIUM_DIR) && ./dist-build/emscripten.sh --sumo
cd $(LIBSODIUM_DIR) && env CPPFLAGS="-DFAVOR_PERFORMANCE" ./dist-build/emscripten.sh --sumo

$(LIBSODIUM_DIR)/configure: $(LIBSODIUM_DIR)/configure.ac
cd $(LIBSODIUM_DIR) && ./autogen.sh
Expand Down
File renamed without changes.
98 changes: 98 additions & 0 deletions browsers-test/aead_aegis128l.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<!doctype html>
<html>
<head>
<meta name="google" content="notranslate" />
<style>
body {
background: white;
color: black;
}
.test p {
margin: 1px;
}
.test {
font-family: monospace;
white-space: pre;
}
.err {
background: red;
color: white;
}
.passed {
background: green;
color: white;
}
</style>
</head>
<body>
<h1></h1>
<section class="test" id="test-res"></section>
<script>
var performance;
if (typeof performance !== 'object') {
performance = {
mark: function(s) { this[s] = new Date() },
measure: function(_t, s1, s2) { this.t = this[s2] - this[s1] },
getEntriesByName: function() { return [ { duration: this.t } ] }
};
}

var Module = { preRun: function() { performance.mark('bench_start') } };

function runTest(tname) {
var xhr, expected, hn, idx = 0, passed = true;

function outputReceived(e) {
var found = e.data;
var p = document.createElement('p');
if (found !== expected[idx++]) {
p.className = 'err';
passed = false;
}
p.appendChild(document.createTextNode(found));
document.getElementById('test-res').appendChild(p);
if (idx >= expected.length) {
if (passed) {
performance.mark('bench_end')
performance.measure('bench', 'bench_start', 'bench_end');
var duration = Math.round(performance.getEntriesByName('bench')[0].duration);
hn.appendChild(document.createTextNode(' - PASSED (time: ' + duration + ' ms)'));
hn.className = 'passed';
} else {
hn.appendChild(document.createTextNode(' - FAILED'));
hn.className = 'err';
}
}
}

hn = document.getElementsByTagName('h1')[0];
hn.appendChild(document.createTextNode('Test: ' + tname));

try {
xhr = new ActiveXObject('Microsoft.XMLHTTP');
} catch (e) {
xhr = new XMLHttpRequest();
}
xhr.open('GET', tname + '.exp');
xhr.onreadystatechange = function() {
if (xhr.readyState != 4 ||
(xhr.status != 200 && xhr.status != 302 && xhr.status != 0)) {
return;
}
expected = xhr.responseText.split('\n');
if (expected.length > 0 && expected[expected.length - 1] === '') {
expected.pop();
}
expected.push('--- SUCCESS ---');
window.addEventListener('test-output', outputReceived, false);
var s = document.getElementsByTagName('script')[0];
var st = document.createElement('script');
st.src = tname + '.js';
s.parentNode.insertBefore(st, s);
}
xhr.send(null);
}
runTest('aead_aegis128l');
</script>
</body>
</html>
1 change: 1 addition & 0 deletions browsers-test/aead_aegis128l.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions browsers-test/aead_aegis256.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OK
98 changes: 98 additions & 0 deletions browsers-test/aead_aegis256.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<!doctype html>
<html>
<head>
<meta name="google" content="notranslate" />
<style>
body {
background: white;
color: black;
}
.test p {
margin: 1px;
}
.test {
font-family: monospace;
white-space: pre;
}
.err {
background: red;
color: white;
}
.passed {
background: green;
color: white;
}
</style>
</head>
<body>
<h1></h1>
<section class="test" id="test-res"></section>
<script>
var performance;
if (typeof performance !== 'object') {
performance = {
mark: function(s) { this[s] = new Date() },
measure: function(_t, s1, s2) { this.t = this[s2] - this[s1] },
getEntriesByName: function() { return [ { duration: this.t } ] }
};
}

var Module = { preRun: function() { performance.mark('bench_start') } };

function runTest(tname) {
var xhr, expected, hn, idx = 0, passed = true;

function outputReceived(e) {
var found = e.data;
var p = document.createElement('p');
if (found !== expected[idx++]) {
p.className = 'err';
passed = false;
}
p.appendChild(document.createTextNode(found));
document.getElementById('test-res').appendChild(p);
if (idx >= expected.length) {
if (passed) {
performance.mark('bench_end')
performance.measure('bench', 'bench_start', 'bench_end');
var duration = Math.round(performance.getEntriesByName('bench')[0].duration);
hn.appendChild(document.createTextNode(' - PASSED (time: ' + duration + ' ms)'));
hn.className = 'passed';
} else {
hn.appendChild(document.createTextNode(' - FAILED'));
hn.className = 'err';
}
}
}

hn = document.getElementsByTagName('h1')[0];
hn.appendChild(document.createTextNode('Test: ' + tname));

try {
xhr = new ActiveXObject('Microsoft.XMLHTTP');
} catch (e) {
xhr = new XMLHttpRequest();
}
xhr.open('GET', tname + '.exp');
xhr.onreadystatechange = function() {
if (xhr.readyState != 4 ||
(xhr.status != 200 && xhr.status != 302 && xhr.status != 0)) {
return;
}
expected = xhr.responseText.split('\n');
if (expected.length > 0 && expected[expected.length - 1] === '') {
expected.pop();
}
expected.push('--- SUCCESS ---');
window.addEventListener('test-output', outputReceived, false);
var s = document.getElementsByTagName('script')[0];
var st = document.createElement('script');
st.src = tname + '.js';
s.parentNode.insertBefore(st, s);
}
xhr.send(null);
}
runTest('aead_aegis256');
</script>
</body>
</html>
1 change: 1 addition & 0 deletions browsers-test/aead_aegis256.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/aead_aes256gcm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/aead_aes256gcm2.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/aead_chacha20poly1305.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/aead_chacha20poly13052.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/aead_xchacha20poly1305.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/auth.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/auth2.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/auth3.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/auth5.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/auth6.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/auth7.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/box.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/box2.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/box7.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/box8.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/box_easy.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/box_easy2.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/box_seal.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/box_seed.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/chacha20.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/codecs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/core1.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/core2.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/core3.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/core4.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/core5.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/core6.js

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions browsers-test/core_ed25519.exp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,21 @@ sub1: f67c79849de0253ba142949e1db6224b13121212121212121212121212121202
add2: b02e8581ce62f69922427c23f970f7e951525252525252525252525252525202
sub2: 3da570db4b001cbeb35a7b7fe588e72aaeadadadadadadadadadadadadadad0d
mul: 4453ef38408c06677c1b810e4bf8b1991f01c88716fbfa2f075a518b77da400b
from_uniform_deterministic (0): b18e62cf804b022fec392b0e2d6539d0f059732616c11913f510f73ae2544ebc
from_uniform_deterministic (1): b9d23004e78c58e22da72e109550133e3d3bb9e46afcc066b82326319653d62c
from_uniform_deterministic (2): 14063782c8b8a677dce09c4e51719b1cf942bf71bc765c1ec9832a8b4446983c
from_uniform_deterministic (3): 02d6dbac70f6a14de72f4e17386016b08d6506336a086f10e719fbad8831d550
from_uniform_deterministic (4): 11c851408e7892c2eae37584423a8f9c797e3649d45946b53e64319318a750b0
from_uniform_deterministic (5): d4b9eaf70ffdc238c88725e294bdd02a6ce85577c5e7add7ca07041873019842
from_uniform_deterministic (6): 740a6141079285c1b9e84ed463dcce5d3d40a167fa13129463eaf97d2a7bf654
from_uniform_deterministic (7): e504a3e00bbf506cbe388784d85e85b10c428c37eba04ebd19a60948b71ad2cf
from_uniform_deterministic (8): 67cd50902c40c943f22c479c587fb3e5da2f8f1ad402049ac49ddc45ec20884c
from_uniform_deterministic (9): 658bffa23b425a91268ee17559073c4b1548209054ed7cf00ffe582696dda8dc
from_uniform_deterministic (10): b55b93e7a0fe554f86f1f4c991871a27756fee359a8c6bb7554ec91d5d552c49
from_uniform_deterministic (11): fbc2bb45df1d806489a5a6415898c719c45c932d3467b6ce948ee80c0e8122c9
from_uniform_deterministic (12): 93164e57b5e3ae6826ac9e0c31ddecf94e21a39a29ba9d1d24e9e588fe065d95
from_uniform_deterministic (13): 16824d74c9482890dc57b0ec843a0a5231b581d2ce3909934d7658389f169093
from_uniform_deterministic (14): 2f5b0336c7f0af520badeae99450f92835c27224ab4cd117f55b176afb6f0001
(L-1)*8: e5d3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010
8(L-1): e5d3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010
(L-1)^2: 0100000000000000000000000000000000000000000000000000000000000000
Expand Down
2 changes: 1 addition & 1 deletion browsers-test/core_ed25519.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/core_ristretto255.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/ed25519_convert.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/generichash.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/generichash2.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/generichash3.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/hash.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/hash3.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browsers-test/kdf.js

Large diffs are not rendered by default.

0 comments on commit d96986a

Please sign in to comment.