| ... | @@ -849,7 +849,7 @@ fn verifyRsa( | ... | @@ -849,7 +849,7 @@ fn verifyRsa( |
| 849 | inline 128, 256, 384, 512 => |modulus_len| { | 849 | inline 128, 256, 384, 512 => |modulus_len| { |
| 850 | const public_key = rsa.PublicKey.fromBytes(exponent, modulus) catch | 850 | const public_key = rsa.PublicKey.fromBytes(exponent, modulus) catch |
| 851 | return error.CertificateSignatureInvalid; | 851 | return error.CertificateSignatureInvalid; |
| 852 | rsa.PKCS1v1_5Signature.verify(modulus_len, sig[0..modulus_len].*, msg, public_key, Hash) catch | 852 | rsa.PKCS1v1_5Signature.verify(modulus_len, sig[0..modulus_len], msg, public_key, Hash) catch |
| 853 | return error.CertificateSignatureInvalid; | 853 | return error.CertificateSignatureInvalid; |
| 854 | }, | 854 | }, |
| 855 | else => return error.CertificateSignatureUnsupportedBitCount, | 855 | else => return error.CertificateSignatureUnsupportedBitCount, |
| ... | @@ -1039,7 +1039,7 @@ pub const rsa = struct { | ... | @@ -1039,7 +1039,7 @@ pub const rsa = struct { |
| 1039 | | 1039 | |
| 1040 | pub fn concatVerify( | 1040 | pub fn concatVerify( |
| 1041 | comptime modulus_len: usize, | 1041 | comptime modulus_len: usize, |
| 1042 | sig: [modulus_len]u8, | 1042 | sig: *const [modulus_len]u8, |
| 1043 | msg: []const []const u8, | 1043 | msg: []const []const u8, |
| 1044 | public_key: PublicKey, | 1044 | public_key: PublicKey, |
| 1045 | comptime Hash: type, | 1045 | comptime Hash: type, |
| ... | @@ -1192,7 +1192,7 @@ pub const rsa = struct { | ... | @@ -1192,7 +1192,7 @@ pub const rsa = struct { |
| 1192 | | 1192 | |
| 1193 | pub fn verify( | 1193 | pub fn verify( |
| 1194 | comptime modulus_len: usize, | 1194 | comptime modulus_len: usize, |
| 1195 | sig: [modulus_len]u8, | 1195 | sig: *const [modulus_len]u8, |
| 1196 | msg: []const u8, | 1196 | msg: []const u8, |
| 1197 | public_key: PublicKey, | 1197 | public_key: PublicKey, |
| 1198 | comptime Hash: type, | 1198 | comptime Hash: type, |
| ... | @@ -1202,7 +1202,7 @@ pub const rsa = struct { | ... | @@ -1202,7 +1202,7 @@ pub const rsa = struct { |
| 1202 | | 1202 | |
| 1203 | pub fn concatVerify( | 1203 | pub fn concatVerify( |
| 1204 | comptime modulus_len: usize, | 1204 | comptime modulus_len: usize, |
| 1205 | sig: [modulus_len]u8, | 1205 | sig: *const [modulus_len]u8, |
| 1206 | msg: []const []const u8, | 1206 | msg: []const []const u8, |
| 1207 | public_key: PublicKey, | 1207 | public_key: PublicKey, |
| 1208 | comptime Hash: type, | 1208 | comptime Hash: type, |
| ... | @@ -1348,8 +1348,8 @@ pub const rsa = struct { | ... | @@ -1348,8 +1348,8 @@ pub const rsa = struct { |
| 1348 | | 1348 | |
| 1349 | const EncryptError = error{MessageTooLong}; | 1349 | const EncryptError = error{MessageTooLong}; |
| 1350 | | 1350 | |
| 1351 | fn encrypt(comptime modulus_len: usize, msg: [modulus_len]u8, public_key: PublicKey) EncryptError![modulus_len]u8 { | 1351 | fn encrypt(comptime modulus_len: usize, msg: *const [modulus_len]u8, public_key: PublicKey) EncryptError![modulus_len]u8 { |
| 1352 | const m = Fe.fromBytes(public_key.n, &msg, .big) catch return error.MessageTooLong; | 1352 | const m = Fe.fromBytes(public_key.n, msg, .big) catch return error.MessageTooLong; |
| 1353 | const e = public_key.n.powPublic(m, public_key.e) catch unreachable; | 1353 | const e = public_key.n.powPublic(m, public_key.e) catch unreachable; |
| 1354 | var res: [modulus_len]u8 = undefined; | 1354 | var res: [modulus_len]u8 = undefined; |
| 1355 | e.toBytes(&res, .big) catch unreachable; | 1355 | e.toBytes(&res, .big) catch unreachable; |