#NEWLINE# def __init__( self , backend , key , algorithm , ctx = None ) : #NEWLINE# #INDENT# self . _algorithm = algorithm #NEWLINE# self . _backend = backend #NEWLINE# if ( ctx is None ) : #NEWLINE# #INDENT# ctx = self . _backend . _lib . Cryptography_HMAC_CTX_new ( ) #NEWLINE# self . _backend . openssl_assert ( ( ctx != self . _backend . _ffi . NULL ) ) #NEWLINE# ctx = self . _backend . _ffi . gc ( ctx , self . _backend . _lib . Cryptography_HMAC_CTX_free ) #NEWLINE# evp_md = self . _backend . _lib . EVP_get_digestbyname ( algorithm . name . encode ( 'ascii' ) ) #NEWLINE# if ( evp_md == self . _backend . _ffi . NULL ) : #NEWLINE# #INDENT# raise UnsupportedAlgorithm ( '{0} is not a supported hash on this backend.' . format ( algorithm . name ) , _Reasons . UNSUPPORTED_HASH ) #NEWLINE# #UNINDENT# res = self . _backend . _lib . Cryptography_HMAC_Init_ex ( ctx , key , len ( key ) , evp_md , self . _backend . _ffi . NULL ) #NEWLINE# self . _backend . openssl_assert ( ( res != 0 ) ) #NEWLINE# #UNINDENT# self . _ctx = ctx #NEWLINE# self . _key = key