Make the shared library name and function symbol for the "nuron" ENGINE
[openssl.git] / crypto / engine / hw_ubsec.c
index 828ec0f10b15e920ea8e80c30e41b8c211c6cc7d..143efbdeea4e588d9414a964af3089d3e4cd1866 100644 (file)
@@ -65,8 +65,8 @@
 #include "engine_int.h"
 #include <openssl/engine.h>
 
-#ifndef NO_HW
-#ifndef NO_HW_UBSEC
+#ifndef OPENSSL_NO_HW
+#ifndef OPENSSL_NO_HW_UBSEC
 
 #ifdef FLAT_INC
 #include "hw_ubsec.h"
@@ -74,8 +74,8 @@
 #include "vendor_defns/hw_ubsec.h"
 #endif
 
-static int ubsec_init(void);
-static int ubsec_finish(void);
+static int ubsec_init(ENGINE *e);
+static int ubsec_finish(ENGINE *e);
 static int ubsec_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
                const BIGNUM *m, BN_CTX *ctx);
 static int ubsec_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
@@ -84,12 +84,14 @@ static int ubsec_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
 static int ubsec_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa);
 static int ubsec_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
                const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
+#if NOT_USED
 static int ubsec_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
                BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
                BN_CTX *ctx, BN_MONT_CTX *in_mont);
 static int ubsec_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,
                const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
                BN_MONT_CTX *m_ctx);
+#endif
 static DSA_SIG *ubsec_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa);
 static int ubsec_dsa_verify(const unsigned char *dgst, int dgst_len,
                                 DSA_SIG *sig, DSA *dsa);
@@ -98,8 +100,11 @@ static int ubsec_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a,
                BN_MONT_CTX *m_ctx);
 static int ubsec_dh_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh);
 static int ubsec_dh_generate_key(DH *dh);
+
+#if NOT_USED
 static int ubsec_rand_bytes(unsigned char *buf, int num);
 static int ubsec_rand_status(void);
+#endif
  
 /* Our internal RSA_METHOD that we provide pointers to */
 
@@ -226,8 +231,27 @@ static t_UBSEC_dsa_verify_ioctl *p_UBSEC_dsa_verify_ioctl = NULL;
 static t_UBSEC_math_accelerate_ioctl *p_UBSEC_math_accelerate_ioctl = NULL;
 static t_UBSEC_rng_ioctl *p_UBSEC_rng_ioctl = NULL;
 
+/* 
+ * These are the static string constants for the DSO file name and the function
+ * symbol names to bind to. 
+ */
+
+static const char *UBSEC_LIBNAME = "ubsec";
+static const char *UBSEC_F1 = "ubsec_bytes_to_bits";
+static const char *UBSEC_F2 = "ubsec_bits_to_bytes";
+static const char *UBSEC_F3 = "ubsec_open";
+static const char *UBSEC_F4 = "ubsec_close";
+static const char *UBSEC_F5 = "diffie_hellman_generate_ioctl";
+static const char *UBSEC_F6 = "diffie_hellman_agree_ioctl";
+static const char *UBSEC_F7 = "rsa_mod_exp_ioctl";
+static const char *UBSEC_F8 = "rsa_mod_exp_crt_ioctl";
+static const char *UBSEC_F9 = "dsa_sign_ioctl";
+static const char *UBSEC_F10 = "dsa_verify_ioctl";
+static const char *UBSEC_F11 = "math_accelerate_ioctl";
+static const char *UBSEC_F12 = "rng_ioctl";
+
 /* (de)initialisation functions. */
-static int ubsec_init()
+static int ubsec_init(ENGINE *e)
        {
        t_UBSEC_ubsec_bytes_to_bits *p1;
        t_UBSEC_ubsec_bits_to_bytes *p2;
@@ -323,7 +347,7 @@ err:
        return 0;
        }
 
-static int ubsec_finish()
+static int ubsec_finish(ENGINE *e)
        {
        if(ubsec_dso == NULL)
                {
@@ -473,6 +497,7 @@ static int ubsec_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
        return 1;
 }
 
+#if NOT_USED
 static int ubsec_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
                BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
                BN_CTX *ctx, BN_MONT_CTX *in_mont)
@@ -499,6 +524,7 @@ static int ubsec_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,
        {
        return ubsec_mod_exp(r, a, p, m, ctx);
        }
+#endif
 
 /*
  * This function is aliased to mod_exp (with the mont stuff dropped).
@@ -651,6 +677,7 @@ static int ubsec_dh_generate_key (DH *dh)
        return 0;
        }
 
+#ifdef NOT_USED
 static int ubsec_rand_bytes(unsigned char *buf, int num)
        {
        return 0;
@@ -660,6 +687,7 @@ static int ubsec_rand_status(void)
        {
        return 0;
        }
+#endif
 
-#endif /* !NO_HW_UBSEC */
-#endif /* !NO_HW */
+#endif /* !OPENSSL_NO_HW_UBSEC */
+#endif /* !OPENSSL_NO_HW */