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 {
6262 UserCanceled = 90 ,
6363 NoRenegotiation = 100 ,
6464 UnsupportedExtension = 110 ,
65+ UnknownPskIdentity = 115 ,
6566 Invalid ,
6667}
6768
@@ -93,6 +94,7 @@ impl fmt::Display for AlertDescription {
9394 AlertDescription :: UserCanceled => write ! ( f, "UserCanceled" ) ,
9495 AlertDescription :: NoRenegotiation => write ! ( f, "NoRenegotiation" ) ,
9596 AlertDescription :: UnsupportedExtension => write ! ( f, "UnsupportedExtension" ) ,
97+ AlertDescription :: UnknownPskIdentity => write ! ( f, "UnknownPskIdentity" ) ,
9698 _ => write ! ( f, "Invalid alert description" ) ,
9799 }
98100 }
@@ -126,6 +128,7 @@ impl From<u8> for AlertDescription {
126128 90 => AlertDescription :: UserCanceled ,
127129 100 => AlertDescription :: NoRenegotiation ,
128130 110 => AlertDescription :: UnsupportedExtension ,
131+ 115 => AlertDescription :: UnknownPskIdentity ,
129132 _ => AlertDescription :: Invalid ,
130133 }
131134 }
Original file line number Diff line number Diff line change @@ -968,7 +968,20 @@ impl DTLSConn {
968968 Ok ( pkt) => pkt,
969969 Err ( err) => {
970970 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+ }
972985 }
973986 } ;
974987 }
You can’t perform that action at this time.
0 commit comments