Commit 5ade630
committed
Enable support for mandatory PSKs
Add a new option to require that an external Pre-Shared Key is negotiated
for a handshake to succeed, configured via the new APIs
wolfSSL_CTX_require_psk()/wolfSSL_require_psk(). When set, a handshake
that completes without negotiating an external PSK is aborted with
PSK_MISSING_ERROR instead of falling back to a certificate handshake, so
the PSK acts as an additional security factor.
This is a TLS 1.3 / DTLS 1.3 feature. In (D)TLS 1.2 the use of a PSK is
determined by the negotiated cipher suite, so a mandatory PSK is instead
configured there by restricting the cipher suite list to PSK suites; the
new APIs therefore reject non-TLS-1.3 contexts with BAD_FUNC_ARG.
The requirement applies to external PSKs only (not session tickets):
session-ticket resumption is exempt. To preserve forward secrecy a
mandatory external PSK must also use an (EC)DHE key exchange; a pure
psk_ke handshake is rejected with PSK_KEY_ERROR. When used with
WOLFSSL_CERT_WITH_EXTERN_PSK, it also ensures that peers are properly
authenticated with both the PSK and via certificates.
The new APIs live alongside the existing wolfSSL_[CTX_]no_dhe_psk()/
only_dhe_psk() PSK options and do not depend on certificate support, so
the feature is usable in NO_CERTS (PSK-only) builds.
Added unit tests for the new APIs and enforcement.1 parent 4de8190 commit 5ade630
9 files changed
Lines changed: 927 additions & 11 deletions
File tree
- doc/dox_comments/header_files
- src
- tests
- api
- wolfssl
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14134 | 14134 | | |
14135 | 14135 | | |
14136 | 14136 | | |
| 14137 | + | |
| 14138 | + | |
| 14139 | + | |
| 14140 | + | |
| 14141 | + | |
| 14142 | + | |
| 14143 | + | |
| 14144 | + | |
| 14145 | + | |
| 14146 | + | |
| 14147 | + | |
| 14148 | + | |
| 14149 | + | |
| 14150 | + | |
| 14151 | + | |
| 14152 | + | |
| 14153 | + | |
| 14154 | + | |
| 14155 | + | |
| 14156 | + | |
| 14157 | + | |
| 14158 | + | |
| 14159 | + | |
| 14160 | + | |
| 14161 | + | |
| 14162 | + | |
| 14163 | + | |
| 14164 | + | |
| 14165 | + | |
| 14166 | + | |
| 14167 | + | |
| 14168 | + | |
| 14169 | + | |
| 14170 | + | |
| 14171 | + | |
| 14172 | + | |
| 14173 | + | |
| 14174 | + | |
| 14175 | + | |
| 14176 | + | |
| 14177 | + | |
| 14178 | + | |
| 14179 | + | |
| 14180 | + | |
| 14181 | + | |
| 14182 | + | |
| 14183 | + | |
| 14184 | + | |
| 14185 | + | |
| 14186 | + | |
| 14187 | + | |
| 14188 | + | |
| 14189 | + | |
| 14190 | + | |
| 14191 | + | |
| 14192 | + | |
| 14193 | + | |
| 14194 | + | |
| 14195 | + | |
| 14196 | + | |
| 14197 | + | |
| 14198 | + | |
| 14199 | + | |
| 14200 | + | |
| 14201 | + | |
14137 | 14202 | | |
14138 | 14203 | | |
14139 | 14204 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7279 | 7279 | | |
7280 | 7280 | | |
7281 | 7281 | | |
| 7282 | + | |
7282 | 7283 | | |
7283 | 7284 | | |
7284 | 7285 | | |
| |||
27955 | 27956 | | |
27956 | 27957 | | |
27957 | 27958 | | |
| 27959 | + | |
| 27960 | + | |
| 27961 | + | |
27958 | 27962 | | |
27959 | 27963 | | |
27960 | 27964 | | |
| |||
36210 | 36214 | | |
36211 | 36215 | | |
36212 | 36216 | | |
| 36217 | + | |
36213 | 36218 | | |
36214 | 36219 | | |
36215 | 36220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4386 | 4386 | | |
4387 | 4387 | | |
4388 | 4388 | | |
4389 | | - | |
| 4389 | + | |
| 4390 | + | |
| 4391 | + | |
| 4392 | + | |
| 4393 | + | |
4390 | 4394 | | |
4391 | 4395 | | |
4392 | 4396 | | |
| |||
5907 | 5911 | | |
5908 | 5912 | | |
5909 | 5913 | | |
| 5914 | + | |
| 5915 | + | |
| 5916 | + | |
| 5917 | + | |
| 5918 | + | |
| 5919 | + | |
| 5920 | + | |
| 5921 | + | |
| 5922 | + | |
| 5923 | + | |
| 5924 | + | |
| 5925 | + | |
5910 | 5926 | | |
5911 | 5927 | | |
5912 | 5928 | | |
| |||
6670 | 6686 | | |
6671 | 6687 | | |
6672 | 6688 | | |
| 6689 | + | |
| 6690 | + | |
| 6691 | + | |
| 6692 | + | |
| 6693 | + | |
| 6694 | + | |
| 6695 | + | |
| 6696 | + | |
| 6697 | + | |
| 6698 | + | |
6673 | 6699 | | |
6674 | 6700 | | |
6675 | 6701 | | |
| |||
6731 | 6757 | | |
6732 | 6758 | | |
6733 | 6759 | | |
| 6760 | + | |
| 6761 | + | |
| 6762 | + | |
| 6763 | + | |
| 6764 | + | |
| 6765 | + | |
| 6766 | + | |
| 6767 | + | |
| 6768 | + | |
| 6769 | + | |
6734 | 6770 | | |
6735 | 6771 | | |
6736 | 6772 | | |
| |||
6892 | 6928 | | |
6893 | 6929 | | |
6894 | 6930 | | |
6895 | | - | |
| 6931 | + | |
| 6932 | + | |
| 6933 | + | |
| 6934 | + | |
| 6935 | + | |
6896 | 6936 | | |
6897 | 6937 | | |
6898 | 6938 | | |
| |||
6911 | 6951 | | |
6912 | 6952 | | |
6913 | 6953 | | |
| 6954 | + | |
| 6955 | + | |
6914 | 6956 | | |
6915 | 6957 | | |
6916 | 6958 | | |
| |||
11852 | 11894 | | |
11853 | 11895 | | |
11854 | 11896 | | |
| 11897 | + | |
| 11898 | + | |
| 11899 | + | |
| 11900 | + | |
| 11901 | + | |
| 11902 | + | |
| 11903 | + | |
| 11904 | + | |
| 11905 | + | |
| 11906 | + | |
| 11907 | + | |
| 11908 | + | |
| 11909 | + | |
| 11910 | + | |
| 11911 | + | |
11855 | 11912 | | |
11856 | 11913 | | |
11857 | 11914 | | |
| |||
14969 | 15026 | | |
14970 | 15027 | | |
14971 | 15028 | | |
| 15029 | + | |
| 15030 | + | |
| 15031 | + | |
| 15032 | + | |
| 15033 | + | |
| 15034 | + | |
| 15035 | + | |
| 15036 | + | |
| 15037 | + | |
| 15038 | + | |
| 15039 | + | |
| 15040 | + | |
| 15041 | + | |
| 15042 | + | |
| 15043 | + | |
| 15044 | + | |
| 15045 | + | |
| 15046 | + | |
| 15047 | + | |
| 15048 | + | |
| 15049 | + | |
| 15050 | + | |
| 15051 | + | |
| 15052 | + | |
| 15053 | + | |
| 15054 | + | |
| 15055 | + | |
| 15056 | + | |
| 15057 | + | |
| 15058 | + | |
| 15059 | + | |
| 15060 | + | |
| 15061 | + | |
| 15062 | + | |
| 15063 | + | |
| 15064 | + | |
| 15065 | + | |
| 15066 | + | |
14972 | 15067 | | |
14973 | 15068 | | |
14974 | 15069 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28384 | 28384 | | |
28385 | 28385 | | |
28386 | 28386 | | |
28387 | | - | |
| 28387 | + | |
28388 | 28388 | | |
28389 | 28389 | | |
28390 | 28390 | | |
| |||
0 commit comments