aboutsummaryrefslogtreecommitdiffstats
path: root/ossl.h
diff options
context:
space:
mode:
authorMichal Rokos <m.rokos@sh.cvut.cz>2002-06-04 06:44:42 +0000
committerMichal Rokos <m.rokos@sh.cvut.cz>2002-06-04 06:44:42 +0000
commita5180750f7ab485fba73dd6e9861536adf3b693b (patch)
treecd2cea7862bed69939cb64d20346a3f975b5a9cc /ossl.h
parentbc603852659675cd0c7420dd4d126780f7ba6ee2 (diff)
downloadruby-openssl-history-a5180750f7ab485fba73dd6e9861536adf3b693b.tar.gz
Initial revision
Diffstat (limited to 'ossl.h')
-rw-r--r--ossl.h173
1 files changed, 44 insertions, 129 deletions
diff --git a/ossl.h b/ossl.h
index 19b5c28..43416ab 100644
--- a/ossl.h
+++ b/ossl.h
@@ -8,10 +8,10 @@
* This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
-#ifndef _OSSL_H_
+#if !defined(_OSSL_H_)
#define _OSSL_H_
-#ifdef __cplusplus
+#if defined(__cplusplus)
extern "C" {
#endif
@@ -25,13 +25,11 @@ extern "C" {
#include <openssl/ssl.h>
#include <openssl/hmac.h>
#include <openssl/rand.h>
+#include <openssl/bn_lcl.h>
#if defined(NT)
# undef OpenFile
#endif
-#include "openssl_missing.h"
-#include "ossl_version.h"
-
/*
* OpenSSL has defined RFILE and Ruby has defined RFILE - so undef it!
*/
@@ -41,51 +39,41 @@ extern "C" {
#include <ruby.h>
/*
- * Modules
+ * Check the Ruby version and OpenSSL
+ * The only supported are:
+ * Ruby >= 1.7
+ * OpenSSL >= 0.9.7
+ */
+#include <version.h>
+#include <openssl/opensslv.h>
+
+#if (OPENSSL_VERSION_NUMBER < 0x00907000L) && (RUBY_VERSION_CODE < 172)
+# error ! OSSL2 needs Ruby >= 1.7.2 and OpenSSL >= 0.9.7 its run.
+#endif
+
+/*
+ * Common Module
*/
extern VALUE mOSSL;
-extern VALUE mX509;
-extern VALUE mDigest;
-extern VALUE mPKey;
-extern VALUE mNetscape;
-extern VALUE mCipher;
-extern VALUE mSSL;
-extern VALUE mPKCS7;
-extern VALUE mRandom;
+extern VALUE mNetscape;
+extern VALUE mPKCS7;
+extern VALUE mPKey;
+extern VALUE mRandom;
+extern VALUE mSSL;
+
+/*
+ * Common Error Class
+ */
+VALUE eOSSLError;
/*
* Classes
*/
-extern VALUE cX509Certificate;
-extern VALUE eX509CertificateError;
-extern VALUE cX509Attribute;
-extern VALUE eX509AttributeError;
-extern VALUE cX509CRL;
-extern VALUE eX509CRLError;
-extern VALUE cX509Extension;
-extern VALUE cX509ExtensionFactory;
-extern VALUE eX509ExtensionError;
-extern VALUE cX509Name;
-extern VALUE eX509NameError;
-extern VALUE cX509Request;
-extern VALUE eX509RequestError;
-extern VALUE cX509Revoked;
-extern VALUE eX509RevokedError;
-extern VALUE cX509Store;
-extern VALUE eX509StoreError;
extern VALUE cSPKI;
extern VALUE eSPKIError;
extern VALUE eRandomError;
extern VALUE cSSLSocket;
extern VALUE eSSLError;
-/* Cipher */
-extern VALUE cCipher;
-extern VALUE eCipherError;
-extern VALUE cDES, cRC4, cIdea, cRC2, cBlowFish, cCast5, cRC5, cAES;
-/* Digest */
-extern VALUE cDigest;
-extern VALUE eDigestError;
-extern VALUE cMD2, cMD4, cMD5, cMDC2, cRIPEMD160, cSHA, cSHA1, cDSS, cDSS1;
/* PKey */
extern ID id_private_q;
extern VALUE cPKey;
@@ -106,9 +94,6 @@ extern VALUE eHMACError;
/* Conf */
extern VALUE cConfig;
extern VALUE eConfigError;
-/* BN */
-extern VALUE cBN;
-extern VALUE eBNError;
/*
* CheckTypes
@@ -116,8 +101,8 @@ extern VALUE eBNError;
#define OSSL_Check_Kind(obj, klass) ossl_check_kind(obj, klass)
void ossl_check_kind(VALUE, VALUE);
#define OSSL_Check_Instance(obj, klass) ossl_check_instance(obj, klass)
+#define OSSL_Check_Type(obj, klass) OSSL_Check_Instance(obj, klass)
void ossl_check_instance(VALUE, VALUE);
-#define OSSL_Check_Type OSSL_Check_Kind /* COMPAT */
/*
* DATE conversion
@@ -141,14 +126,14 @@ time_t time_to_time_t(VALUE);
# define OSSL_Warning(text) \
rb_warning("%s%s [in '%s', ('%s':%d)]", \
text, OSSL_ErrMsg(), __func__, __FILE__, __LINE__)
-#else /*OSSL_DEBUG*/
+#else /* OSSL_DEBUG */
# define OSSL_Raise(klass,text) \
rb_raise(klass, "%s%s", text, OSSL_ErrMsg())
# define OSSL_Warn(text) \
rb_warn("%s%s", text, OSSL_ErrMsg())
# define OSSL_Warning(text) \
rb_warning("%s%s", text, OSSL_ErrMsg())
-#endif /*OSSL_DEBUG*/
+#endif /* OSSL_DEBUG */
/*
* Config
@@ -156,81 +141,11 @@ time_t time_to_time_t(VALUE);
void Init_ossl_config(VALUE);
/*
- * Digest
- */
-int ossl_digest_get_NID(VALUE);
-const EVP_MD *ossl_digest_get_EVP_MD(VALUE);
-void Init_ossl_digest(VALUE);
-
-/*
- * X509
- */
-VALUE ossl_x509_new(X509 *);
-VALUE ossl_x509_new_from_file(VALUE);
-X509 *ossl_x509_get_X509(VALUE);
-void Init_ossl_x509(VALUE);
-
-/*
- * X509CRL
- */
-X509_CRL *ossl_x509crl_get_X509_CRL(VALUE);
-void Init_ossl_x509crl(VALUE);
-
-/*
- * X509Name
- */
-VALUE ossl_x509name_new(X509_NAME *);
-X509_NAME *ossl_x509name_get_X509_NAME(VALUE);
-void Init_ossl_x509name(VALUE);
-
-/*
- * X509Request
- */
-VALUE ossl_x509req_new(X509_REQ *);
-X509_REQ *ossl_x509req_get_X509_REQ(VALUE);
-void Init_ossl_x509req(VALUE);
-
-/*
- * X509Revoked
- */
-VALUE ossl_x509revoked_new(X509_REVOKED *);
-X509_REVOKED *ossl_x509revoked_get_X509_REVOKED(VALUE);
-void Init_ossl_x509revoked(VALUE);
-
-/*
- * X509Store
- */
-VALUE ossl_x509store_new(X509_STORE_CTX *);
-X509_STORE *ossl_x509store_get_X509_STORE(VALUE);
-void Init_ossl_x509store(VALUE);
-
-/*
- * X509Extension
- */
-VALUE ossl_x509ext_new(X509_EXTENSION *);
-X509_EXTENSION *ossl_x509ext_get_X509_EXTENSION(VALUE);
-void Init_ossl_x509ext(VALUE);
-
-/*
- * X509Attribute
- */
-VALUE ossl_x509attr_new(X509_ATTRIBUTE *);
-X509_ATTRIBUTE *ossl_x509attr_get_X509_ATTRIBUTE(VALUE);
-void Init_ossl_x509attr(VALUE);
-
-/*
* Netscape SPKI
*/
void Init_ossl_spki(VALUE);
/*
- * Ciphers
- */
-int ossl_cipher_get_NID(VALUE);
-const EVP_CIPHER *ossl_cipher_get_EVP_CIPHER(VALUE);
-void Init_ossl_cipher(VALUE);
-
-/*
* RAND - module methods only
*/
void Init_ossl_rand(VALUE);
@@ -246,7 +161,7 @@ void Init_ossl_pkey(VALUE);
/*
* RSA
*/
-#if !defined(NO_RSA) && !defined(OPENSSL_NO_RSA)
+#if !defined(OPENSSL_NO_RSA)
VALUE ossl_rsa_new(RSA *);
RSA *ossl_rsa_get_RSA(VALUE);
EVP_PKEY *ossl_rsa_get_EVP_PKEY(VALUE);
@@ -256,7 +171,7 @@ void Init_ossl_rsa(VALUE, VALUE, VALUE);
/*
* DSA
*/
-#if !defined(NO_DSA) && !defined(OPENSSL_NO_DSA)
+#if !defined(OPENSSL_NO_DSA)
VALUE ossl_dsa_new(DSA *);
DSA *ossl_dsa_get_DSA(VALUE);
EVP_PKEY *ossl_dsa_get_EVP_PKEY(VALUE);
@@ -266,7 +181,7 @@ void Init_ossl_dsa(VALUE, VALUE, VALUE);
/*
* DH
*/
-#if !defined(NO_DH) && !defined(OPENSSL_NO_DH)
+#if !defined(OPENSSL_NO_DH)
VALUE ossl_dh_new(DH *);
DH *ossl_dh_get_DH(VALUE);
EVP_PKEY *ossl_dh_get_EVP_PKEY(VALUE);
@@ -276,30 +191,30 @@ void Init_ossl_dh(VALUE, VALUE, VALUE);
/*
* SSL
*/
-void Init_ssl(VALUE);
+void Init_ossl_ssl(VALUE);
/*
* PKCS7
*/
VALUE ossl_pkcs7si_new(PKCS7_SIGNER_INFO *);
PKCS7_SIGNER_INFO *ossl_pkcs7si_get_PKCS7_SIGNER_INFO(VALUE);
-void Init_pkcs7(VALUE);
+void Init_ossl_pkcs7(VALUE);
/*
* HMAC
*/
-void Init_hmac(VALUE);
+void Init_ossl_hmac(VALUE);
-/*
- * BN
- */
-VALUE ossl_bn_new(BIGNUM *);
-BIGNUM *ossl_bn_get_BIGNUM(VALUE);
-void Init_bn(VALUE);
+#include "openssl_missing.h"
+#include "ossl_bn.h"
+#include "ossl_cipher.h"
+#include "ossl_digest.h"
+#include "ossl_version.h"
+#include "ossl_x509.h"
-#ifdef __cplusplus
+#if defined(__cplusplus)
}
#endif
-#endif /*_OSSL_H_*/
+#endif /* _OSSL_H_ */