예제 #1
0
 def _digest(self, space):
     with lltype.scoped_alloc(ropenssl.EVP_MD_CTX.TO) as ctx:
         with self.lock:
             ropenssl.EVP_MD_CTX_copy(ctx, self.ctx)
         digest_size = self.digest_size
         with rffi.scoped_alloc_buffer(digest_size) as buf:
             ropenssl.EVP_DigestFinal(ctx, buf.raw, None)
             ropenssl.EVP_MD_CTX_cleanup(ctx)
             return buf.str(digest_size)
예제 #2
0
 def _digest(self, space):
     with lltype.scoped_alloc(ropenssl.EVP_MD_CTX.TO) as ctx:
         with self.lock:
             ropenssl.EVP_MD_CTX_copy(ctx, self.ctx)
         digest_size = self.digest_size
         with lltype.scoped_alloc(rffi.CCHARP.TO, digest_size) as digest:
             ropenssl.EVP_DigestFinal(ctx, digest, None)
             ropenssl.EVP_MD_CTX_cleanup(ctx)
             return rffi.charpsize2str(digest, digest_size)
예제 #3
0
 def __del__(self):
     if self.ctx:
         ropenssl.EVP_MD_CTX_cleanup(self.ctx)
         lltype.free(self.ctx, flavor='raw')