File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,12 @@ impl Session {
125125 . into_result ( Function :: DecryptFinal ) ?;
126126 }
127127
128+ // Some pkcs11 modules might finalize the operation when there
129+ // no more output even if we pass in NULL.
130+ if data_len == 0 {
131+ return Ok ( Vec :: new ( ) ) ;
132+ }
133+
128134 let mut data = vec ! [ 0 ; data_len. try_into( ) ?] ;
129135
130136 unsafe {
Original file line number Diff line number Diff line change @@ -124,6 +124,12 @@ impl Session {
124124 . into_result ( Function :: EncryptFinal ) ?;
125125 }
126126
127+ // Some pkcs11 modules might finalize the operation when there
128+ // no more output even if we pass in NULL.
129+ if encrypted_data_len == 0 {
130+ return Ok ( Vec :: new ( ) ) ;
131+ }
132+
127133 let mut encrypted_data = vec ! [ 0 ; encrypted_data_len. try_into( ) ?] ;
128134
129135 unsafe {
You can’t perform that action at this time.
0 commit comments