commit 227b4251d30da3d136bdcce173a10941d4a0e6df
parent 7a361a8bf0974d421d24a2adb3ddeae0e85fa456
Author: finwo <finwo@pm.me>
Date: Wed, 11 Aug 2021 23:45:25 +0200
Added test for memory hammering
Diffstat:
1 file changed, 25 insertions(+), 0 deletions(-)
diff --git a/test/0008-memory-hammering.js b/test/0008-memory-hammering.js
@@ -0,0 +1,25 @@
+// This test was built based on a user-submitted bug: https://github.com/finwo/supercop/issues/4
+
+const isBuffer = require('is-buffer');
+const crypto = require('crypto');
+const test = require('tape');
+const lib = require('../index');
+
+test('Message hammering',async t => {
+ t.plan(1);
+
+ const seed = crypto.randomBytes(32);
+ const keypair = await lib.createKeyPair(seed);
+
+ for(let size = 100; size <= 4096; size++) {
+ const message = Buffer.alloc(size);
+
+ // Intentionally discard signatures, we're just hammering the memory here
+ await keypair.sign(message);
+ await lib.sign(message, keypair.publicKey, keypair.secretKey);
+ }
+
+ t.ok(true, 'Thread survived hammering supercop\'s memory');
+
+
+});