File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ pub(crate) enum AlertDescription {
62
62
UserCanceled = 90 ,
63
63
NoRenegotiation = 100 ,
64
64
UnsupportedExtension = 110 ,
65
+ UnknownPskIdentity = 115 ,
65
66
Invalid ,
66
67
}
67
68
@@ -93,6 +94,7 @@ impl fmt::Display for AlertDescription {
93
94
AlertDescription :: UserCanceled => write ! ( f, "UserCanceled" ) ,
94
95
AlertDescription :: NoRenegotiation => write ! ( f, "NoRenegotiation" ) ,
95
96
AlertDescription :: UnsupportedExtension => write ! ( f, "UnsupportedExtension" ) ,
97
+ AlertDescription :: UnknownPskIdentity => write ! ( f, "UnknownPskIdentity" ) ,
96
98
_ => write ! ( f, "Invalid alert description" ) ,
97
99
}
98
100
}
@@ -126,6 +128,7 @@ impl From<u8> for AlertDescription {
126
128
90 => AlertDescription :: UserCanceled ,
127
129
100 => AlertDescription :: NoRenegotiation ,
128
130
110 => AlertDescription :: UnsupportedExtension ,
131
+ 115 => AlertDescription :: UnknownPskIdentity ,
129
132
_ => AlertDescription :: Invalid ,
130
133
}
131
134
}
Original file line number Diff line number Diff line change @@ -968,7 +968,20 @@ impl DTLSConn {
968
968
Ok ( pkt) => pkt,
969
969
Err ( err) => {
970
970
debug ! ( "{}: decrypt failed: {}" , srv_cli_str( ctx. is_client) , err) ;
971
- return ( false , None , None ) ;
971
+
972
+ // If we get an error for PSK we need to return an error.
973
+ if cipher_suite. is_psk ( ) {
974
+ return (
975
+ false ,
976
+ Some ( Alert {
977
+ alert_level : AlertLevel :: Fatal ,
978
+ alert_description : AlertDescription :: UnknownPskIdentity ,
979
+ } ) ,
980
+ None ,
981
+ ) ;
982
+ } else {
983
+ return ( false , None , None ) ;
984
+ }
972
985
}
973
986
} ;
974
987
}
You can’t perform that action at this time.
0 commit comments