Skip to content

Commit 9dcb89c

Browse files
committed
8.0.13 release
1 parent d282c71 commit 9dcb89c

17 files changed

+228
-28
lines changed

ChangeLog.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11

22
ChangeLog for jsrsasign
33

4+
* Changes from 8.0.12 to 8.0.13 (2020-Mar-31)
5+
- LICENSE.txt
6+
- fixed wrong description from BSD to MIT License
7+
- ext/ec.js
8+
- mitigate Minerva timing attack in ECPointFp.multiply method
9+
   https://minerva.crocs.fi.muni.cz/
10+
- test/qunit-do-crypto-ecdsa.html
11+
- testcase fix
12+
- sample_node/tsr2certs added
13+
- script to extract certificates from timestamp response or token
14+
- npm
15+
- ECPointFp, ECCurveFp and ECFieldElementFp are now exported.
16+
417
* Changes from 8.0.11 to 8.0.12 (2018-Apr-22)
518
- base64x 1.1.13 to 1.1.14
619
- function iptohex added

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
THE SOFTWARE.
2323

24-
LICENSE: BSD License
24+
LICENSE: MIT License
2525
----
2626

2727
RSA and ECC in JavaScript

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ FILES_MIN = \
2222
min/jwsjs-2.0.min.js
2323

2424
FILES_EXT_MIN = \
25+
ext/ec-min.js \
2526
ext/rsa-min.js \
2627
ext/rsa2-min.js
2728

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "kjur-jsrsasign",
3-
"version": "8.0.12",
3+
"version": "8.0.13",
44
"main": "jsrsasign-all-min.js",
55
"description": "The 'jsrsasign' (RSA-Sign JavaScript Library) is an opensource free cryptography library supporting RSA/RSAPSS/ECDSA/DSA signing/validation, ASN.1, PKCS#1/5/8 private/public key, X.509 certificate, CRL, OCSP, CMS SignedData, TimeStamp, CAdES, JWS and JWT in pure JavaScript.",
66
"license": "MIT",

ext/ec-min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/ec.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,25 @@ function pointFpTwice() {
182182

183183
// Simple NAF (Non-Adjacent Form) multiplication algorithm
184184
// TODO: modularize the multiplication algorithm
185+
// UPDATE: 2020.03.30 mitigate Minerva timing attack https://minerva.crocs.fi.muni.cz/
186+
// Constant time execution on multiply method.
185187
function pointFpMultiply(k) {
186188
if(this.isInfinity()) return this;
187189
if(k.signum() == 0) return this.curve.getInfinity();
188190

189-
var e = k;
191+
// initialize for multiply
192+
var e = k; // e = k
190193
var h = e.multiply(new BigInteger("3"));
191-
192194
var neg = this.negate();
193195
var R = this;
194196

197+
// initialize for dummy to mitigate timing attack
198+
var e2 = this.curve.q.subtract(k); // e2 = q - k
199+
var h2 = e2.multiply(new BigInteger("3"));
200+
var R2 = new ECPointFp(this.curve, this.x, this.y);
201+
var neg2 = R2.negate();
202+
203+
// calculate multiply
195204
var i;
196205
for(i = h.bitLength() - 2; i > 0; --i) {
197206
R = R.twice();
@@ -204,6 +213,18 @@ function pointFpMultiply(k) {
204213
}
205214
}
206215

216+
// calculate dummy to mitigate timing attack
217+
for(i = h2.bitLength() - 2; i > 0; --i) {
218+
R2 = R2.twice();
219+
220+
var h2Bit = h2.testBit(i);
221+
var e2Bit = e2.testBit(i);
222+
223+
if (h2Bit != e2Bit) {
224+
R2 = R2.add(h2Bit ? R2 : neg2);
225+
}
226+
}
227+
207228
return R;
208229
}
209230

0 commit comments

Comments
 (0)