File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ where
131
131
let x = Coordinate :: < C > :: from_be_bytes ( & bytes[ 1 ..] ) . ok_or_else ( Error :: new) ?;
132
132
let rec_id = bytes[ 0 ] & 1 ;
133
133
let point = FromCompressed :: decompress ( x, & rec_id) . ok_or_else ( Error :: new) ?;
134
+ // Decompressed point will never be identity
134
135
Ok ( Self { point } )
135
136
}
136
137
@@ -139,7 +140,7 @@ where
139
140
let x = Coordinate :: < C > :: from_be_bytes ( x_bytes) . ok_or_else ( Error :: new) ?;
140
141
let y = Coordinate :: < C > :: from_be_bytes ( y_bytes) . ok_or_else ( Error :: new) ?;
141
142
let point = <C as IntrinsicCurve >:: Point :: from_xy ( x, y) . ok_or_else ( Error :: new) ?;
142
- Ok ( Self { point } )
143
+ Self :: from_affine ( point)
143
144
}
144
145
145
146
_ => Err ( Error :: new ( ) ) ,
Original file line number Diff line number Diff line change @@ -47,5 +47,9 @@ pub fn k256_sec1_decoding_test_vectors() -> Vec<Sec1DecodingTestVector> {
47
47
bytes: hex!( "04" "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc30" "4218f20ae6c646b363db68605822fb14264ca8d2587fdd6fbc750d587e76a7ee" ) . to_vec( ) ,
48
48
ok: false ,
49
49
} ,
50
+ Sec1DecodingTestVector {
51
+ bytes: hex!( "04" "0000000000000000000000000000000000000000000000000000000000000000" "0000000000000000000000000000000000000000000000000000000000000000" ) . to_vec( ) ,
52
+ ok: false ,
53
+ }
50
54
]
51
55
}
You can’t perform that action at this time.
0 commit comments