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 {
125
125
. into_result ( Function :: DecryptFinal ) ?;
126
126
}
127
127
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
+
128
134
let mut data = vec ! [ 0 ; data_len. try_into( ) ?] ;
129
135
130
136
unsafe {
Original file line number Diff line number Diff line change @@ -124,6 +124,12 @@ impl Session {
124
124
. into_result ( Function :: EncryptFinal ) ?;
125
125
}
126
126
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
+
127
133
let mut encrypted_data = vec ! [ 0 ; encrypted_data_len. try_into( ) ?] ;
128
134
129
135
unsafe {
You can’t perform that action at this time.
0 commit comments