On systems that don't do too well including headers from a different
[openssl.git] / crypto / engine / hw_openbsd_dev_crypto.c
index e3c51d18d7aa5ae1af13f728f4f2dcdf8a4d5617..bf0b8ea16126ef25b767304b9fffd3240b5bd6b8 100644 (file)
  *
  */
 
+#include <openssl/engine.h>
+#include <openssl/evp.h>
+#include "eng_int.h"
+/* Maybe this is needed? ... */
+#ifdef FLAT_INC
+#include "evp_locl.h"
+#else
+#include "../evp/evp_locl.h"
+#endif
+
 #ifndef OPENSSL_OPENBSD_DEV_CRYPTO
 
-static void *dummy=&dummy;
+void ENGINE_load_openbsd_dev_crypto(void)
+       {
+       /* This is a NOP unless OPENSSL_OPENBSD_DEV_CRYPTO is defined */
+       return;
+       }
 
 #else /* OPENSSL_OPENBSD_DEV_CRYPTO */
 
 #include <fcntl.h>
 #include <stdio.h>
 #include <errno.h>
+#include <assert.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
+
 #include <crypto/cryptodev.h>
-#include <openssl/engine.h>
-#include <openssl/evp.h>
-#include "eng_int.h"
-/* Maybe this is needed? ... */
-#include "../evp/evp_locl.h"
 
 /****************************************************/
 /* Declare the normal generic ENGINE stuff here ... */
@@ -78,8 +90,8 @@ static int dev_crypto_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
 static int dev_crypto_digests(ENGINE *e, const EVP_MD **digest,
                                const int **nids, int nid);
 
-static const char *dev_crypto_id = "openbsd_dev_crypto";
-static const char *dev_crypto_name = "OpenBSD /dev/crypto";
+static const char dev_crypto_id[] = "openbsd_dev_crypto";
+static const char dev_crypto_name[] = "OpenBSD /dev/crypto";
 
 static ENGINE *engine_openbsd_dev_crypto(void)
        {
@@ -176,6 +188,7 @@ static int dev_crypto_init(session_op *ses)
 
 static int dev_crypto_cleanup(EVP_CIPHER_CTX *ctx)
     {
+    fprintf(stderr,"cleanup %d\n",CDATA(ctx)->ses);
     if(ioctl(fd,CIOCFSESSION,&CDATA(ctx)->ses) == -1)
        err("CIOCFSESSION failed");
 
@@ -325,11 +338,13 @@ static int dev_crypto_init_digest(MD_DATA *md_data,int mac)
        err("CIOCGSESSION failed");
        return 0;
        }
+    fprintf(stderr,"opened %d\n",md_data->sess.ses);
     return 1;
     }
 
 static int dev_crypto_cleanup_digest(MD_DATA *md_data)
     {
+    fprintf(stderr,"cleanup %d\n",md_data->sess.ses);
     if (ioctl(fd,CIOCFSESSION,&md_data->sess.ses) == -1)
        {
        err("CIOCFSESSION failed");