Implement hash for sha1
This commit is contained in:
parent
06a662e63a
commit
858bf6fe98
2 changed files with 25 additions and 4 deletions
|
@ -1,5 +1,7 @@
|
|||
{-# LANGUAGE ForeignFunctionInterface #-}
|
||||
|
||||
#include <gnutls/crypto.h>
|
||||
|
||||
-- Copyright (C) 2010 John Millikin <jmillikin@gmail.com>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
|
@ -40,9 +42,6 @@ newtype CredentialsType = CredentialsType CInt
|
|||
newtype MACAlgorithm = MACAlgorithm CInt
|
||||
deriving (Show, Eq)
|
||||
|
||||
newtype DigestAlgorithm = DigestAlgorithm CInt
|
||||
deriving (Show, Eq)
|
||||
|
||||
newtype CompressionMethod = CompressionMethod CInt
|
||||
deriving (Show, Eq)
|
||||
|
||||
|
@ -88,12 +87,15 @@ newtype PKAlgorithm = PKAlgorithm CInt
|
|||
newtype SignAlgorithm = SignAlgorithm CInt
|
||||
deriving (Show, Eq)
|
||||
|
||||
{#enum define DigestAlgorithm {GNUTLS_DIG_SHA1 as SHA1} deriving (Eq, Ord) #}
|
||||
|
||||
newtype Credentials = Credentials (Ptr Credentials)
|
||||
newtype Transport = Transport (Ptr Transport)
|
||||
newtype Session = Session (Ptr Session)
|
||||
newtype DHParams = DHParams (Ptr DHParams)
|
||||
newtype RSAParams = RSAParams (Ptr RSAParams)
|
||||
newtype Priority = Priority (Ptr Priority)
|
||||
newtype Hash = Hash (Ptr Hash)
|
||||
|
||||
newtype Datum = Datum (Ptr Word8, CUInt)
|
||||
|
||||
|
@ -247,6 +249,14 @@ foreign import ccall "wrapper"
|
|||
|
||||
-- }}}
|
||||
|
||||
-- Crypto {{{
|
||||
|
||||
foreign import ccall safe "gnutls_hash_init" gnutls_hash_init :: Ptr (Ptr Hash) -> CInt -> IO ReturnCode
|
||||
foreign import ccall safe "gnutls_hash" gnutls_hash :: Ptr Hash -> CString -> CSize -> IO ReturnCode
|
||||
foreign import ccall safe "gnutls_hash_deinit" gnutls_hash_deinit :: Ptr Hash -> CString -> IO ()
|
||||
|
||||
-- }}}
|
||||
|
||||
-- Utility {{{
|
||||
|
||||
foreign import ccall safe "gnutls_global_set_mem_functions"
|
Loading…
Add table
Add a link
Reference in a new issue