File tree Expand file tree Collapse file tree 2 files changed +25
-11
lines changed Expand file tree Collapse file tree 2 files changed +25
-11
lines changed Original file line number Diff line number Diff line change @@ -122,11 +122,16 @@ pub fn load_ak(
122
122
. with_decrypt ( true )
123
123
. with_encrypt ( true )
124
124
. build ( ) ;
125
- context. tr_sess_set_attributes (
126
- policy_auth_session,
127
- session_attributes,
128
- session_attributes_mask,
129
- ) ?;
125
+ context
126
+ . tr_sess_set_attributes (
127
+ policy_auth_session,
128
+ session_attributes,
129
+ session_attributes_mask,
130
+ )
131
+ . or_else ( |e| {
132
+ ctx. flush_context ( SessionHandle :: from ( policy_auth_session) . into ( ) ) ?;
133
+ Err ( e)
134
+ } ) ?;
130
135
131
136
let key_handle = context. execute_with_temporary_object (
132
137
SessionHandle :: from ( policy_auth_session) . into ( ) ,
@@ -182,11 +187,16 @@ pub fn create_ak<IKC: IntoKeyCustomization>(
182
187
. with_decrypt ( true )
183
188
. with_encrypt ( true )
184
189
. build ( ) ;
185
- context. tr_sess_set_attributes (
186
- policy_auth_session,
187
- session_attributes,
188
- session_attributes_mask,
189
- ) ?;
190
+ context
191
+ . tr_sess_set_attributes (
192
+ policy_auth_session,
193
+ session_attributes,
194
+ session_attributes_mask,
195
+ )
196
+ . or_else ( |e| {
197
+ ctx. flush_context ( SessionHandle :: from ( policy_auth_session) . into ( ) ) ?;
198
+ Err ( e)
199
+ } ) ?;
190
200
191
201
context. execute_with_temporary_object (
192
202
SessionHandle :: from ( policy_auth_session) . into ( ) ,
Original file line number Diff line number Diff line change @@ -305,7 +305,11 @@ impl Context {
305
305
. with_decrypt ( true )
306
306
. with_encrypt ( true )
307
307
. build ( ) ;
308
- self . tr_sess_set_attributes ( auth_session, session_attributes, session_attributes_mask) ?;
308
+ self . tr_sess_set_attributes ( auth_session, session_attributes, session_attributes_mask)
309
+ . or_else ( |e| {
310
+ ctx. flush_context ( SessionHandle :: from ( auth_session) . into ( ) ) ?;
311
+ Err ( e)
312
+ } ) ?;
309
313
310
314
let res = self . execute_with_session ( Some ( auth_session) , f) ;
311
315
You can’t perform that action at this time.
0 commit comments