| ... | ... | @@ -127,12 +127,10 @@ pub const Edwards25519 = struct { |
| 127 | 127 | /// Check that the point does not generate a low-order group. |
| 128 | 128 | /// Return a `WeakPublicKey` error if it does. |
| 129 | 129 | pub fn rejectLowOrder(p: Edwards25519) WeakPublicKeyError!void { |
| 130 | | const zi = p.z.invert(); |
| 131 | | const x = p.x.mul(zi); |
| 132 | | const y = p.y.mul(zi); |
| 133 | | const x_neg = x.neg(); |
| 134 | | const iy = Fe.sqrtm1.mul(y); |
| 135 | | if (x.isZero() or y.isZero() or iy.equivalent(x) or iy.equivalent(x_neg)) { |
| 130 | const y_sqrtm1 = Fe.sqrtm1.mul(p.y); |
| 131 | if (p.x.isZero() or p.y.isZero() or p.z.isZero() or |
| 132 | y_sqrtm1.sub(p.x).isZero() or y_sqrtm1.add(p.x).isZero()) |
| 133 | { |
| 136 | 134 | return error.WeakPublicKey; |
| 137 | 135 | } |
| 138 | 136 | } |