Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cleanup

darcs-hash:20070704233517-62b54-263154017c2b3339578527b31eb175ee468fb53d.gz
  • Loading branch information...
commit d145e51435a3d25bdbab9bbac9a55399ae75ae49 1 parent 2e1ce26
@phonohawk authored
View
18 HsOpenSSL.cabal
@@ -7,8 +7,8 @@ Description:
messages.
Version: 0.1
License: PublicDomain
-Author: PHO <phonohawk TA ps TOD sakura TOD ne TOD jp>
-Maintainer: PHO <phonohawk TA ps TOD sakura TOD ne TOD jp>
+Author: PHO <phonohawk AT ps DOT sakura DOT ne DOT jp>
+Maintainer: PHO <phonohawk AT ps DOT sakura DOT ne DOT jp>
Stability: experimental
Homepage: http://ccm.sherry.jp/hs-openssl/
Category: Cryptography
@@ -44,8 +44,18 @@ Exposed-Modules:
Extensions:
ForeignFunctionInterface
ghc-options:
- -fglasgow-exts
+ -fglasgow-exts -O2
C-Sources:
cbits/HsOpenSSL.c
Include-Dirs:
- cbits
+ cbits
+Install-Includes:
+ HsOpenSSL.h
+Extra-Source-Files:
+ HsOpenSSL.buildinfo.in
+ configure
+ configure.ac
+ examples/Makefile
+ examples/GenRSAKey.hs
+ examples/HelloWorld.hs
+ examples/PKCS7.hs
View
2  Makefile
@@ -9,7 +9,7 @@ run: build
$(MAKE) -C examples run
.setup-config: $(CABAL_FILE) configure Setup
- ./Setup configure
+ ./Setup configure -p
configure: aclocal.m4 configure.ac
autoconf
View
6 OpenSSL.hsc
@@ -22,7 +22,7 @@
-- [/Key generation of DSA and Diffie-Hellman algorithms/] Only RSA
-- keys can currently be generated.
--
--- [/X.509 v3 extension handling/] It shoule be supported in the
+-- [/X.509 v3 extension handling/] It should be supported in the
-- future.
--
-- [/HMAC message authentication/]
@@ -42,7 +42,7 @@
-- very well, don't they?
--
-- So if you find out some features you want aren't supported, you
--- must write your own patch (then please. Happy hacking.
+-- must write your own patch. Happy hacking.
#include "HsOpenSSL.h"
@@ -60,7 +60,7 @@ foreign import ccall "HsOpenSSL_setupMutex"
-- |Computation of @'withOpenSSL' action@ initializes the OpenSSL
-- library and computes @action@. Every applications that use OpenSSL
--- must wrap any other operations related to OpenSSL or they will
+-- must wrap any other operations related to OpenSSL or they might
-- crash.
--
-- > module Main where
View
8 OpenSSL/ASN1.hsc
@@ -38,7 +38,7 @@ import System.Locale
{- ASN1_OBJECT --------------------------------------------------------------- -}
-data ASN1_OBJECT = ASN1_OBJECT
+data ASN1_OBJECT
foreign import ccall unsafe "OBJ_obj2nid"
obj2nid :: Ptr ASN1_OBJECT -> IO Int
@@ -60,7 +60,7 @@ nid2ln nid = _nid2ln nid >>= peekCString
{- ASN1_STRING --------------------------------------------------------------- -}
-data ASN1_STRING = ASN1_STRING
+data ASN1_STRING
peekASN1String :: Ptr ASN1_STRING -> IO String
peekASN1String strPtr
@@ -71,7 +71,7 @@ peekASN1String strPtr
{- ASN1_INTEGER -------------------------------------------------------------- -}
-data ASN1_INTEGER = ASN1_INTEGER
+data ASN1_INTEGER
foreign import ccall unsafe "HsOpenSSL_M_ASN1_INTEGER_new"
_ASN1_INTEGER_new :: IO (Ptr ASN1_INTEGER)
@@ -110,7 +110,7 @@ withASN1Integer int m
{- ASN1_TIME ---------------------------------------------------------------- -}
-data ASN1_TIME = ASN1_TIME
+data ASN1_TIME
foreign import ccall unsafe "HsOpenSSL_M_ASN1_TIME_new"
_ASN1_TIME_new :: IO (Ptr ASN1_TIME)
View
2  OpenSSL/BIO.hsc
@@ -19,8 +19,6 @@
{- --------------------------------------------------------------------------- -}
-#include "HsOpenSSL.h"
-
-- |A BIO is an I\/O abstraction, it hides many of the underlying I\/O
-- details from an application, if you are writing a pure C
-- application...
View
2  OpenSSL/BN.hsc
@@ -1,7 +1,5 @@
{- -*- haskell -*- -}
-#include "HsOpenSSL.h"
-
-- #hide
module OpenSSL.BN
View
2  OpenSSL/ERR.hsc
@@ -2,8 +2,6 @@
-- #hide
-#include "HsOpenSSL.h"
-
module OpenSSL.ERR
( getError
, peekError
View
2  OpenSSL/EVP/Base64.hsc
@@ -2,8 +2,6 @@
-- |An interface to Base64 codec.
-#include "HsOpenSSL.h"
-
module OpenSSL.EVP.Base64
( -- * Encoding
encodeBase64
View
2  OpenSSL/EVP/Open.hsc
@@ -1,7 +1,5 @@
{- -*- haskell -*- -}
-#include "HsOpenSSL.h"
-
-- |Asymmetric cipher decryption using encrypted symmetric key. This
-- is an opposite of "OpenSSL.EVP.Seal".
View
2  OpenSSL/EVP/Seal.hsc
@@ -1,7 +1,5 @@
{- -*- haskell -*- -}
-#include "HsOpenSSL.h"
-
-- |Asymmetric cipher decryption using encrypted symmetric key. This
-- is an opposite of "OpenSSL.EVP.Open".
View
2  OpenSSL/EVP/Sign.hsc
@@ -1,7 +1,5 @@
{- -*- haskell -*- -}
-#include "HsOpenSSL.h"
-
-- |Message signing using asymmetric cipher and message digest
-- algorithm. This is an opposite of "OpenSSL.EVP.Verify".
View
2  OpenSSL/EVP/Verify.hsc
@@ -1,7 +1,5 @@
{- -*- haskell -*- -}
-#include "HsOpenSSL.h"
-
-- |Message verification using asymmetric cipher and message digest
-- algorithm. This is an opposite of "OpenSSL.EVP.Sign".
View
2  OpenSSL/Objects.hsc
@@ -16,7 +16,7 @@ import Foreign.C
type ObjName = Ptr OBJ_NAME
-data OBJ_NAME = OBJ_NAME
+data OBJ_NAME
type DoAllCallback = ObjName -> Ptr () -> IO ()
View
2  OpenSSL/PEM.hsc
@@ -2,8 +2,6 @@
-- |An interface to PEM routines.
-#include "HsOpenSSL.h"
-
module OpenSSL.PEM
( -- * Password supply
PemPasswordCallback
View
4 OpenSSL/RSA.hsc
@@ -1,11 +1,11 @@
{- -*- haskell -*- -}
-#include "HsOpenSSL.h"
-
-- #prune
-- |An interface to RSA public key generator.
+#include "HsOpenSSL.h"
+
module OpenSSL.RSA
( -- * Type
RSA
View
2  OpenSSL/SSL.hsc
@@ -8,8 +8,6 @@ module OpenSSL.SSL
)
where
-#include "HsOpenSSL.h"
-
foreign import ccall unsafe "SSL_load_error_strings"
loadErrorStrings :: IO ()
View
2  OpenSSL/Stack.hsc
@@ -2,8 +2,6 @@
-- #hide
-#include "HsOpenSSL.h"
-
module OpenSSL.Stack
( STACK
, mapStack
View
2  OpenSSL/X509.hsc
@@ -4,8 +4,6 @@
-- |An interface to X.509 certificate.
-#include "HsOpenSSL.h"
-
module OpenSSL.X509
( -- * Type
X509
View
4 OpenSSL/X509/Name.hsc
@@ -20,8 +20,8 @@ import OpenSSL.ASN1
import OpenSSL.Utils
-data X509_NAME = X509_NAME
-data X509_NAME_ENTRY = X509_NAME_ENTRY
+data X509_NAME
+data X509_NAME_ENTRY
foreign import ccall unsafe "X509_NAME_new"
_new :: IO (Ptr X509_NAME)
View
2  OpenSSL/X509/Request.hsc
@@ -4,8 +4,6 @@
-- |An interface to PKCS#10 certificate request.
-#include "HsOpenSSL.h"
-
module OpenSSL.X509.Request
( -- * Type
X509Req
View
2  OpenSSL/X509/Store.hsc
@@ -4,8 +4,6 @@
-- |An interface to X.509 certificate store.
-#include "HsOpenSSL.h"
-
module OpenSSL.X509.Store
( X509Store
, X509_STORE -- private
View
13 cbits/HsOpenSSL.h
@@ -1,10 +1,19 @@
#ifndef HSOPENSSL_H_INCLUDED
#define HSOPENSSL_H_INCLUDED
-#include <openssl/opensslconf.h>
+#include <openssl/asn1.h>
#include <openssl/bio.h>
-#include <openssl/evp.h>
+#include <openssl/bn.h>
#include <openssl/err.h>
+#include <openssl/evp.h>
+#include <openssl/objects.h>
+#include <openssl/opensslconf.h>
+#include <openssl/pem.h>
+#include <openssl/pkcs7.h>
#include <openssl/ssl.h>
+#include <openssl/stack.h>
+#include <openssl/x509.h>
+#include <openssl/x509_vfy.h>
+#include <openssl/x509v3.h>
/* OpenSSL ********************************************************************/
void HsOpenSSL_OpenSSL_add_all_algorithms();
View
2  examples/GenRSAKey.hs
@@ -43,6 +43,6 @@ main = withOpenSSL $
printf "dmq1 (d mod (q-1)) = %s\n" (show dmq1)
printf "iqmp (q^-1 mod p) = %s\n" (show iqmp)
- pkey <- newPKeyRSA rsa
+ let pkey = newPKeyRSA rsa
writePKCS8PrivateKey pkey Nothing >>= putStr
-- writePublicKey pkey >>= putStr
View
4 examples/HelloWorld.hs
@@ -17,7 +17,7 @@ main = withOpenSSL $
des <- liftM fromJust $ getCipherByName "DES-CBC"
putStrLn "generating RSA keypair..."
- pkey <- generateKey 512 65537 Nothing >>= newPKeyRSA
+ pkey <- liftM newPKeyRSA $ generateKey 512 65537 Nothing
let plainText = "Hello, world!"
putStrLn ("plain text to encrypt: " ++ plainText)
@@ -34,7 +34,7 @@ main = withOpenSSL $
putStrLn ""
putStrLn "decrypting..."
- decrypted <- open des encKey iv pkey encrypted
+ let decrypted = open des encKey iv pkey encrypted
putStrLn ("decrypted message: " ++ decrypted)
View
8 examples/Makefile
@@ -1,7 +1,9 @@
+GHCFLAGS = -O2 -fglasgow-exts
+
build:
- ghc --make GenRSAKey -fglasgow-exts
- ghc --make HelloWorld -fglasgow-exts
- ghc --make PKCS7 -fglasgow-exts
+ ghc $(GHCFLAGS) --make GenRSAKey
+ ghc $(GHCFLAGS) --make HelloWorld
+ ghc $(GHCFLAGS) --make PKCS7
run: build
./PKCS7
View
4 examples/PKCS7.hs
@@ -12,7 +12,7 @@ import OpenSSL.X509
import OpenSSL.X509.Store
main = withOpenSSL $
- do pkey <- generateKey 512 65537 Nothing >>= newPKeyRSA
+ do pkey <- liftM newPKeyRSA $ generateKey 512 65537 Nothing
cert <- genCert pkey
pkcs7 <- pkcs7Sign cert pkey [] "Hello, world!" [Pkcs7NoCerts]
@@ -24,7 +24,7 @@ main = withOpenSSL $
return ()
-genCert :: EvpPKey -> IO X509
+genCert :: PKey -> IO X509
genCert pkey
= do x509 <- newX509
setVersion x509 2
Please sign in to comment.
Something went wrong with that request. Please try again.