Commit 4ba7ce8
Fix RSA->Ed25519 crosscert: use raw RSA signing to match Tor's format
Tor's rsa_ed25519_crosscert_check uses RSA_public_decrypt (raw RSA) to
recover a 32-byte SHA256 hash from the signature, then compares it with
SHA256(prefix || ed_key || expiration).
Our code was using EVP_DigestSign(SHA-256) which produces a PKCS#1v1.5
signature with DigestInfo wrapping (~51 bytes when decrypted), causing
Tor to report: "The signature was good, but it didn't match the data".
Fix: compute SHA256 ourselves, then sign the raw 32-byte hash using
EVP_PKEY_sign with RSA_PKCS1_PADDING and no digest (equivalent to Tor's
crypto_pk_private_sign / RSA_private_encrypt).
Also removes diagnostic debug logging from CERTS cell creation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 0fd7ba8 commit 4ba7ce8
File tree
3 files changed
+69
-53
lines changed- include/tor/crypto
- src
- crypto
- protocol
3 files changed
+69
-53
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
180 | 185 | | |
181 | 186 | | |
182 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
647 | 648 | | |
648 | 649 | | |
649 | 650 | | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
650 | 695 | | |
651 | 696 | | |
652 | 697 | | |
| |||
657 | 702 | | |
658 | 703 | | |
659 | 704 | | |
660 | | - | |
661 | | - | |
| 705 | + | |
| 706 | + | |
662 | 707 | | |
663 | 708 | | |
664 | 709 | | |
665 | 710 | | |
666 | 711 | | |
667 | 712 | | |
668 | | - | |
| 713 | + | |
669 | 714 | | |
670 | | - | |
671 | | - | |
| 715 | + | |
| 716 | + | |
672 | 717 | | |
673 | | - | |
| 718 | + | |
674 | 719 | | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
682 | 732 | | |
683 | 733 | | |
684 | 734 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | | - | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
| |||
162 | 160 | | |
163 | 161 | | |
164 | 162 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | 163 | | |
187 | 164 | | |
188 | 165 | | |
| |||
227 | 204 | | |
228 | 205 | | |
229 | 206 | | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
| 207 | + | |
247 | 208 | | |
248 | 209 | | |
249 | 210 | | |
| |||
0 commit comments