Commit a5a2316
committed
async: fix overwrite of keylen params between calls
The `kse->pubKeyLen` parameter is used as an input parameter to `DhGenKeyPair`
to provide the size of the `pubKey` buffer (the same size as the prime p). After
that, `kse->pubKeyLen` is used to check that the public key generated is of the
same length as the prime p. If this is not the case, the public key is
padded. If the key generation is asynchronous, then `TLSX_KeyShare_GenDhKey` may
be invoked twice. The second time, the `kse->pubKeyLen` value, updated
asynchronously by the async code, is overwritten with the prime size at the
beginning of the function. When this happens, a wrong public key value is used,
and the shared secret computed is incorrect.
Similar reasoning can be applied to `kse->keyLen`1 parent 3e4b95e commit a5a2316
1 file changed
Lines changed: 13 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6724 | 6724 | | |
6725 | 6725 | | |
6726 | 6726 | | |
6727 | | - | |
| 6727 | + | |
6728 | 6728 | | |
6729 | 6729 | | |
6730 | 6730 | | |
6731 | 6731 | | |
6732 | 6732 | | |
6733 | | - | |
| 6733 | + | |
6734 | 6734 | | |
6735 | 6735 | | |
6736 | 6736 | | |
6737 | 6737 | | |
6738 | 6738 | | |
6739 | | - | |
| 6739 | + | |
6740 | 6740 | | |
6741 | 6741 | | |
6742 | 6742 | | |
6743 | 6743 | | |
6744 | 6744 | | |
6745 | | - | |
| 6745 | + | |
6746 | 6746 | | |
6747 | 6747 | | |
6748 | 6748 | | |
6749 | 6749 | | |
6750 | 6750 | | |
6751 | | - | |
| 6751 | + | |
6752 | 6752 | | |
6753 | 6753 | | |
6754 | 6754 | | |
| |||
6757 | 6757 | | |
6758 | 6758 | | |
6759 | 6759 | | |
6760 | | - | |
6761 | 6760 | | |
6762 | | - | |
6763 | | - | |
| 6761 | + | |
| 6762 | + | |
6764 | 6763 | | |
6765 | 6764 | | |
6766 | 6765 | | |
6767 | 6766 | | |
6768 | 6767 | | |
6769 | 6768 | | |
6770 | | - | |
6771 | 6769 | | |
6772 | | - | |
6773 | 6770 | | |
6774 | 6771 | | |
6775 | 6772 | | |
| |||
6794 | 6791 | | |
6795 | 6792 | | |
6796 | 6793 | | |
6797 | | - | |
| 6794 | + | |
6798 | 6795 | | |
6799 | 6796 | | |
6800 | 6797 | | |
6801 | 6798 | | |
6802 | 6799 | | |
6803 | 6800 | | |
6804 | | - | |
| 6801 | + | |
6805 | 6802 | | |
6806 | 6803 | | |
6807 | 6804 | | |
| |||
6810 | 6807 | | |
6811 | 6808 | | |
6812 | 6809 | | |
| 6810 | + | |
| 6811 | + | |
6813 | 6812 | | |
6814 | 6813 | | |
6815 | 6814 | | |
| |||
6823 | 6822 | | |
6824 | 6823 | | |
6825 | 6824 | | |
| 6825 | + | |
| 6826 | + | |
6826 | 6827 | | |
6827 | 6828 | | |
6828 | 6829 | | |
| |||
0 commit comments