Unsigned vs. signed fixed.
[openssl.git] / engines / e_4758_cca.c
index 6d41b9ed2ad93b9211d1c4abc338d280e2bb67cd..68a628229d65b2a7a9c6f8ad3fad800ed68af51d 100644 (file)
@@ -54,9 +54,9 @@
  */
 
 #include <stdio.h>
+#include <string.h>
 #include <openssl/crypto.h>
 /* #include <openssl/pem.h> */
-#include "cryptlib.h"
 #include <openssl/dso.h>
 #include <openssl/x509.h>
 #include <openssl/objects.h>
@@ -71,7 +71,7 @@
 #include "vendor_defns/hw_4758_cca.h"
 #endif
 
-#include "hw_4758_cca_err.c"
+#include "e_4758_cca_err.c"
 
 static int ibm_4758_cca_destroy(ENGINE *e);
 static int ibm_4758_cca_init(ENGINE *e);
@@ -182,7 +182,8 @@ static RSA_METHOD ibm_4758_cca_rsa =
        RSA_FLAG_SIGN_VER,        /* flags */
        NULL, /* app_data */
        cca_rsa_sign, /* rsa_sign */
-       cca_rsa_verify  /* rsa_verify */
+       cca_rsa_verify, /* rsa_verify */
+       NULL /* rsa_keygen */
        };
 #endif
 
@@ -223,6 +224,7 @@ static int bind_helper(ENGINE *e)
        return 1;
        }
 
+#ifdef OPENSSL_NO_DYNAMIC_ENGINE
 static ENGINE *engine_4758_cca(void)
        {
        ENGINE *ret = ENGINE_new();
@@ -244,6 +246,7 @@ void ENGINE_load_4758cca(void)
        ENGINE_free(e_4758);
        ERR_clear_error();   
        }
+#endif
 
 static int ibm_4758_cca_destroy(ENGINE *e)
        {
@@ -715,7 +718,7 @@ static int cca_rsa_verify(int type, const unsigned char *m, unsigned int m_len,
 
        if (type == NID_sha1 || type == NID_md5)
                {
-               memset(hashBuffer, 0, keyLength+1);
+               OPENSSL_cleanse(hashBuffer, keyLength+1);
                OPENSSL_free(hashBuffer);
                }
 
@@ -838,7 +841,7 @@ static int cca_rsa_sign(int type, const unsigned char *m, unsigned int m_len,
 
        if (type == NID_sha1 || type == NID_md5)
                {
-               memset(hashBuffer, 0, keyLength+1);
+               OPENSSL_cleanse(hashBuffer, keyLength+1);
                OPENSSL_free(hashBuffer);
                }
 
@@ -950,7 +953,7 @@ static void cca_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad, int idx,
        }
 
 /* Goo to handle building as a dynamic engine */
-#ifdef ENGINE_DYNAMIC_SUPPORT 
+#ifndef OPENSSL_NO_DYNAMIC_ENGINE 
 static int bind_fn(ENGINE *e, const char *id)
        {
        if(id && (strcmp(id, engine_4758_cca_id) != 0))
@@ -961,7 +964,7 @@ static int bind_fn(ENGINE *e, const char *id)
        }       
 IMPLEMENT_DYNAMIC_CHECK_FN()
 IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)
-#endif /* ENGINE_DYNAMIC_SUPPORT */
+#endif /* OPENSSL_NO_DYNAMIC_ENGINE */
 
 #endif /* !OPENSSL_NO_HW_4758_CCA */
 #endif /* !OPENSSL_NO_HW */