#include <stdio.h>
#include <string.h>
#include <openssl/crypto.h>
-/* #include <openssl/pem.h> */
#include <openssl/dso.h>
#include <openssl/x509.h>
#include <openssl/objects.h>
#include <openssl/engine.h>
+#include <openssl/rand.h>
+#include <openssl/rsa.h>
+#include <openssl/bn.h>
#ifndef OPENSSL_NO_HW
#ifndef OPENSSL_NO_HW_4758_CCA
static int ibm_4758_cca_destroy(ENGINE *e);
static int ibm_4758_cca_init(ENGINE *e);
static int ibm_4758_cca_finish(ENGINE *e);
-static int ibm_4758_cca_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
+static int ibm_4758_cca_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void));
/* rsa functions */
/*---------------*/
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
return 1;
}
-static int ibm_4758_cca_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
+static int ibm_4758_cca_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void))
{
int initialised = ((dso == NULL) ? 0 : 1);
switch(cmd)
unsigned char exitData[8];
unsigned char ruleArray[8];
unsigned char keyLabel[64];
- long keyLabelLength = strlen(key_id);
+ unsigned long keyLabelLength = strlen(key_id);
unsigned char modulus[256];
long modulusFieldLength = sizeof(modulus);
long modulusLength = 0;
unsigned char exitData[8];
unsigned char ruleArray[8];
unsigned char keyLabel[64];
- long keyLabelLength = strlen(key_id);
+ unsigned long keyLabelLength = strlen(key_id);
unsigned char modulus[512];
long modulusFieldLength = sizeof(modulus);
long modulusLength = 0;
if (type == NID_sha1 || type == NID_md5)
{
- memset(hashBuffer, 0, keyLength+1);
+ OPENSSL_cleanse(hashBuffer, keyLength+1);
OPENSSL_free(hashBuffer);
}
if (type == NID_sha1 || type == NID_md5)
{
- memset(hashBuffer, 0, keyLength+1);
+ OPENSSL_cleanse(hashBuffer, keyLength+1);
OPENSSL_free(hashBuffer);
}
unsigned char form[] = "RANDOM ";
unsigned char rand_buf[8];
- while(num >= sizeof(rand_buf))
+ while(num >= (int)sizeof(rand_buf))
{
randomNumberGenerate(&ret_code, &reason_code, &exit_data_length,
exit_data, form, rand_buf);