| ... | ... | @@ -595,11 +595,14 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In |
| 595 | 595 | const key = try Ecdsa.PublicKey.fromSec1(main_cert_pub_key); |
| 596 | 596 | try sig.verify(verify_bytes, key); |
| 597 | 597 | }, |
| 598 | | .rsa_pss_rsae_sha256 => { |
| 598 | inline .rsa_pss_rsae_sha256, |
| 599 | .rsa_pss_rsae_sha384, |
| 600 | .rsa_pss_rsae_sha512, |
| 601 | => |comptime_scheme| { |
| 599 | 602 | if (main_cert_pub_key_algo != .rsaEncryption) |
| 600 | 603 | return error.TlsBadSignatureScheme; |
| 601 | 604 | |
| 602 | | const Hash = crypto.hash.sha2.Sha256; |
| 605 | const Hash = SchemeHash(comptime_scheme); |
| 603 | 606 | const rsa = Certificate.rsa; |
| 604 | 607 | const components = try rsa.PublicKey.parseDer(main_cert_pub_key); |
| 605 | 608 | const exponent = components.exponent; |
| ... | ... | @@ -1295,6 +1298,15 @@ fn SchemeEcdsa(comptime scheme: tls.SignatureScheme) type { |
| 1295 | 1298 | }; |
| 1296 | 1299 | } |
| 1297 | 1300 | |
| 1301 | fn SchemeHash(comptime scheme: tls.SignatureScheme) type { |
| 1302 | return switch (scheme) { |
| 1303 | .rsa_pss_rsae_sha256 => crypto.hash.sha2.Sha256, |
| 1304 | .rsa_pss_rsae_sha384 => crypto.hash.sha2.Sha384, |
| 1305 | .rsa_pss_rsae_sha512 => crypto.hash.sha2.Sha512, |
| 1306 | else => @compileError("bad scheme"), |
| 1307 | }; |
| 1308 | } |
| 1309 | |
| 1298 | 1310 | /// Abstraction for sending multiple byte buffers to a slice of iovecs. |
| 1299 | 1311 | const VecPut = struct { |
| 1300 | 1312 | iovecs: []const std.os.iovec, |