X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=engines%2Fe_4758_cca.c;h=b006ed876373b933f0eb0c0ad056cf24773cc9f7;hb=dc90f64d563f2c9709749d0731d6b26c6bce5325;hp=2e77f8c6471c0c6dd6e51247c512be704e08fef2;hpb=665dc3924d4f7771dbe17b7518ce3c6d3694a352;p=oweals%2Fopenssl.git diff --git a/engines/e_4758_cca.c b/engines/e_4758_cca.c index 2e77f8c647..b006ed8763 100644 --- a/engines/e_4758_cca.c +++ b/engines/e_4758_cca.c @@ -54,6 +54,7 @@ */ #include +#include #include /* #include */ #include @@ -75,7 +76,7 @@ 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 */ /*---------------*/ @@ -181,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 @@ -222,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(); @@ -243,6 +246,7 @@ void ENGINE_load_4758cca(void) ENGINE_free(e_4758); ERR_clear_error(); } +#endif static int ibm_4758_cca_destroy(ENGINE *e) { @@ -339,7 +343,7 @@ static int ibm_4758_cca_finish(ENGINE *e) 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) @@ -386,7 +390,7 @@ static EVP_PKEY *ibm_4758_load_privkey(ENGINE* e, const char* key_id, 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; @@ -478,7 +482,7 @@ static EVP_PKEY *ibm_4758_load_pubkey(ENGINE* e, const char* key_id, 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; @@ -714,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); } @@ -837,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); } @@ -918,7 +922,7 @@ static int cca_get_random_bytes(unsigned char* buf, int num) 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);