File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 1+ # Changelog
2+
3+ All notable changes to this project will be documented in this file.
4+
5+ The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ )
6+ and this project adheres to the following versioning pattern:
7+
8+ Given a version number MAJOR.MINOR.PATCH, increment:
9+
10+ - MAJOR version when ** breaking changes** are introduced;
11+ - MINOR version when ** backwards compatible changes** are introduced;
12+ - PATCH version when backwards compatible bug ** fixes** are implemented.
13+
14+
15+ ## [ Unreleased]
16+ ### Fixed
17+ - signature r and s range check
18+
19+ ## [ 1.0.0] - 2020-04-14
20+ ### Added
21+ - first official version
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ defmodule EllipticCurve.Ecdsa do
8585
8686 inv = Math . inv ( signature . s , curveData . "N" )
8787
88- signature . r ==
88+ result = signature . r ==
8989 Math . add (
9090 Math . multiply (
9191 curveData . "G" ,
@@ -104,5 +104,11 @@ defmodule EllipticCurve.Ecdsa do
104104 curveData . "A" ,
105105 curveData . "P"
106106 ) . x
107+
108+ cond do
109+ signature . r < 1 || signature . r >= curveData . "N" -> false
110+ signature . s < 1 || signature . s >= curveData . "N" -> false
111+ true -> result
112+ end
107113 end
108114end
You can’t perform that action at this time.
0 commit comments