 ! Copyright (C) 2008, 2010, 2016 Slava Pestov, Alexander Ilin
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien.c-types alien.data checksums
-checksums.stream destructors io kernel openssl openssl.libcrypto
+checksums.stream destructors fry io kernel openssl openssl.libcrypto
 sequences ;
 IN: checksums.openssl
 

: set-digest ( name ctx -- )
    handle>> swap digest-named f EVP_DigestInit_ex ssl-error ;

PRIVATE>

M: openssl-checksum initialize-checksum-state ( checksum -- evp-md-context )

    memory>byte-array ;

M: openssl-checksum checksum-bytes ( bytes checksum -- value )
    [ add-checksum-bytes ] checksum-method ;

M: openssl-checksum checksum-stream ( stream checksum -- value )
    [ add-checksum-stream ] checksum-method ;
