@@ -775,9 +775,8 @@ cdef class DigestOperation(OperationWithBinaryOutput):
775775 def _finalize (self , silent = False ):
776776 cdef Session session = self .session
777777 if self .active :
778- self .active = False
779- session .operation_lock .release ()
780778 self .execute_resizing_output (session .funclist .C_DigestFinal )
779+ super ()._finalize (silent = silent )
781780
782781
783782def merge_templates (default_template , * user_templates ):
@@ -1326,9 +1325,7 @@ class GenerateWithParametersMixin(types.DomainParameters):
13261325 raise ArgumentsBad ("No default capabilities for this key "
13271326 "type. Please specify `capabilities`." )
13281327
1329- mech = MechanismWithParam (
1330- self .key_type , DEFAULT_GENERATE_MECHANISMS ,
1331- mechanism , mechanism_param )
1328+ mech = MechanismWithParam (self .key_type , DEFAULT_GENERATE_MECHANISMS , mechanism , mechanism_param )
13321329
13331330 # Build attributes
13341331 public_template_ = session .attribute_mapper .public_key_template (
@@ -1418,9 +1415,8 @@ cdef class KeyOperation(OperationWithBinaryOutput):
14181415
14191416 def _finalize (self , silent = False ):
14201417 if self .active :
1421- self .active = False
1422- self .session .operation_lock .release ()
14231418 self ._cancel_operation (silent )
1419+ super ()._finalize (silent = silent )
14241420
14251421
14261422cdef class DataCryptOperation (KeyOperation ):
@@ -1487,9 +1483,7 @@ class EncryptMixin(types.EncryptMixin):
14871483
14881484 def __encrypt_operation (self , mechanism , mechanism_param , buffer_size ):
14891485
1490- mech = MechanismWithParam (
1491- self .key_type , DEFAULT_ENCRYPT_MECHANISMS ,
1492- mechanism , mechanism_param )
1486+ mech = MechanismWithParam (self .key_type , DEFAULT_ENCRYPT_MECHANISMS , mechanism , mechanism_param )
14931487
14941488 return DataCryptOperation .setup_encrypt (self .session , mech , self .handle , buffer_size )
14951489
@@ -1522,9 +1516,7 @@ class DecryptMixin(types.DecryptMixin):
15221516
15231517 def __decrypt_operation (self , mechanism , mechanism_param , buffer_size ):
15241518
1525- mech = MechanismWithParam (
1526- self .key_type , DEFAULT_ENCRYPT_MECHANISMS ,
1527- mechanism , mechanism_param )
1519+ mech = MechanismWithParam (self .key_type , DEFAULT_ENCRYPT_MECHANISMS , mechanism , mechanism_param )
15281520
15291521 return DataCryptOperation .setup_decrypt (self .session , mech , self .handle , buffer_size )
15301522
@@ -1606,9 +1598,7 @@ class SignMixin(types.SignMixin):
16061598 """Expand SignMixin with an implementation."""
16071599
16081600 def __sign_operation (self , mechanism , mechanism_param , buffer_size ):
1609- mech = MechanismWithParam (
1610- self .key_type , DEFAULT_SIGN_MECHANISMS ,
1611- mechanism , mechanism_param )
1601+ mech = MechanismWithParam (self .key_type , DEFAULT_SIGN_MECHANISMS , mechanism , mechanism_param )
16121602 return DataSignOperation .setup (self .session , mech , self .handle , buffer_size )
16131603
16141604 def _sign (self , data ,
@@ -1681,9 +1671,7 @@ class VerifyMixin(types.VerifyMixin):
16811671 """Expand VerifyMixin with an implementation."""
16821672
16831673 def __verify_operation (self , mechanism , mechanism_param ):
1684- mech = MechanismWithParam (
1685- self .key_type , DEFAULT_SIGN_MECHANISMS ,
1686- mechanism , mechanism_param )
1674+ mech = MechanismWithParam (self .key_type , DEFAULT_SIGN_MECHANISMS , mechanism , mechanism_param )
16871675 return DataVerifyOperation .setup (self .session , mech , self .handle )
16881676
16891677 def _verify (self , data , signature ,
@@ -1719,9 +1707,7 @@ class WrapMixin(types.WrapMixin):
17191707 if not isinstance (key , types .Key ):
17201708 raise ArgumentsBad ("`key` must be a Key." )
17211709
1722- mech = MechanismWithParam (
1723- self .key_type , DEFAULT_WRAP_MECHANISMS ,
1724- mechanism , mechanism_param )
1710+ mech = MechanismWithParam (self .key_type , DEFAULT_WRAP_MECHANISMS , mechanism , mechanism_param )
17251711
17261712 cdef Session session = self .session
17271713 cdef CK_MECHANISM * mech_data = mech .data
@@ -1766,9 +1752,7 @@ class UnwrapMixin(types.UnwrapMixin):
17661752 raise ArgumentsBad ("No default capabilities for this key "
17671753 "type. Please specify `capabilities`." )
17681754
1769- mech = MechanismWithParam (
1770- self .key_type , DEFAULT_WRAP_MECHANISMS ,
1771- mechanism , mechanism_param )
1755+ mech = MechanismWithParam (self .key_type , DEFAULT_WRAP_MECHANISMS , mechanism , mechanism_param )
17721756
17731757 cdef Session session = self .session
17741758
@@ -1822,9 +1806,7 @@ class DeriveMixin(types.DeriveMixin):
18221806 raise ArgumentsBad ("No default capabilities for this key "
18231807 "type. Please specify `capabilities`." )
18241808
1825- mech = MechanismWithParam (
1826- self .key_type , DEFAULT_DERIVE_MECHANISMS ,
1827- mechanism , mechanism_param )
1809+ mech = MechanismWithParam (self .key_type , DEFAULT_DERIVE_MECHANISMS , mechanism , mechanism_param )
18281810
18291811 cdef Session session = self .session
18301812
0 commit comments