| ... | @@ -135,8 +135,8 @@ pub fn Ecdsa(comptime Curve: type, comptime Hash: type) type { | ... | @@ -135,8 +135,8 @@ pub fn Ecdsa(comptime Curve: type, comptime Hash: type) type { |
| 135 | /// The function returns a slice, that can be shorter than der_encoded_length_max. | 135 | /// The function returns a slice, that can be shorter than der_encoded_length_max. |
| 136 | pub fn toDer(sig: Signature, buf: *[der_encoded_length_max]u8) []u8 { | 136 | pub fn toDer(sig: Signature, buf: *[der_encoded_length_max]u8) []u8 { |
| 137 | var w: std.Io.Writer = .fixed(buf); | 137 | var w: std.Io.Writer = .fixed(buf); |
| 138 | const sig_r = mem.trimLeft(u8, &sig.r, &.{0}); | 138 | const sig_r = mem.trimStart(u8, &sig.r, &.{0}); |
| 139 | const sig_s = mem.trimLeft(u8, &sig.s, &.{0}); | 139 | const sig_s = mem.trimStart(u8, &sig.s, &.{0}); |
| 140 | const r_len = @as(u8, @intCast(sig_r.len + (sig_r[0] >> 7))); | 140 | const r_len = @as(u8, @intCast(sig_r.len + (sig_r[0] >> 7))); |
| 141 | const s_len = @as(u8, @intCast(sig_s.len + (sig_s[0] >> 7))); | 141 | const s_len = @as(u8, @intCast(sig_s.len + (sig_s[0] >> 7))); |
| 142 | const seq_len = @as(u8, @intCast(2 + r_len + 2 + s_len)); | 142 | const seq_len = @as(u8, @intCast(2 + r_len + 2 + s_len)); |