Various build fixes

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@697 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
aet 2002-10-19 16:51:37 +00:00
parent 1d2c9e4c48
commit 148f4051f6
13 changed files with 40 additions and 12 deletions

View File

@ -119,7 +119,7 @@ static struct df_info_s *get_df_info (struct sc_card *card)
return dfi;
}
/* Not found, create it. */
dfi = calloc (1, sizeof *dfi);
dfi = (struct df_info_s *) calloc (1, sizeof *dfi);
if (!dfi) {
debug(ctx, "out of core while allocating df_info\n");
return NULL;
@ -179,7 +179,7 @@ static int mcrd_init(struct sc_card *card)
unsigned long flags;
struct mcrd_priv_data *priv;
priv = calloc (1, sizeof *priv);
priv = (struct mcrd_priv_data *) calloc (1, sizeof *priv);
if (!priv)
return SC_ERROR_OUT_OF_MEMORY;
card->drv_data = priv;
@ -261,7 +261,7 @@ static int load_special_files (struct sc_card *card)
||(apdu.sw1 == 0x62 && apdu.sw2 == 0x82)))
SC_FUNC_RETURN(ctx, 2,
sc_check_sw(card, apdu.sw1, apdu.sw2));
rule = malloc (sizeof*rule + apdu.resplen);
rule = (struct rule_record_s *) malloc (sizeof*rule + apdu.resplen);
if (!rule)
SC_FUNC_RETURN(ctx, 0, SC_ERROR_OUT_OF_MEMORY);
rule->recno = recno;
@ -298,7 +298,7 @@ static int load_special_files (struct sc_card *card)
||(apdu.sw1 == 0x62 && apdu.sw2 == 0x82)))
SC_FUNC_RETURN(ctx, 2,
sc_check_sw(card, apdu.sw1, apdu.sw2));
keyd = malloc (sizeof *keyd + apdu.resplen);
keyd = (struct keyd_record_s *) malloc (sizeof *keyd + apdu.resplen);
if (!keyd)
SC_FUNC_RETURN(ctx, 0, SC_ERROR_OUT_OF_MEMORY);
keyd->recno = recno;

View File

@ -72,7 +72,7 @@ sc_pkcs15_derive_key(struct sc_context *ctx,
{
struct sc_pbkdf2_params *info;
unsigned int key_len;
EVP_CIPHER *cipher;
const EVP_CIPHER *cipher;
u8 *iv = NULL, key[64];
int r;

View File

@ -7,6 +7,9 @@
* Slightly modified for pam_opensc-test by Antti Tapaninen <aet@cc.hut.fi>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@ -21,6 +24,7 @@
#include <security/pam_appl.h>
#include "pam_support.h"
#undef D
#define D(x)
#define INPUTSIZE PAM_MAX_MSG_SIZE /* maximum length of input+1 */

View File

@ -571,7 +571,7 @@ etoken_extract_pubkey(struct sc_card *card, int nr, u8 tag,
|| buf[2] != count + 1 || buf[3] != 0)
return SC_ERROR_INTERNAL;
bn->len = count;
bn->data = malloc(count);
bn->data = (u8 *) malloc(count);
memcpy(bn->data, buf + 4, count);
return 0;
}

View File

@ -43,7 +43,7 @@ err:
return r;
}
static int sc_private_decrypt(int flen, u_char *from, u_char *to, RSA *rsa,
static int sc_private_decrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa,
int padding)
{
int r;
@ -99,7 +99,7 @@ err:
}
static int
sc_private_encrypt(int flen, u_char *from, u_char *to, RSA *rsa, int padding)
sc_private_encrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding)
{
#if 0
error("unsupported function sc_private_encrypt() called");
@ -108,8 +108,8 @@ sc_private_encrypt(int flen, u_char *from, u_char *to, RSA *rsa, int padding)
}
static int
sc_sign(int type, u_char *m, unsigned int m_len,
unsigned char *sigret, unsigned int *siglen, RSA *rsa)
sc_sign(int type, const unsigned char *m, unsigned int m_len,
unsigned char *sigret, unsigned int *siglen, const RSA *rsa)
{
int r;
struct sc_priv_data *priv;
@ -202,7 +202,7 @@ static RSA_METHOD opensc_rsa =
RSA_METHOD * sc_get_method(void)
{
RSA_METHOD *def;
const RSA_METHOD *def;
def = RSA_get_default_method();
orig_finish = def->finish;

View File

@ -1,6 +1,6 @@
#include <stdio.h>
#include <string.h>
#include "npapi.h"
#include "npinclude/npapi.h"
#include "signer.h"
#include "opensc-support.h"

View File

@ -1,3 +1,6 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <opensc/opensc.h>
#include <opensc/asn1.h>

View File

@ -2,6 +2,9 @@
* All rights reserved.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H

View File

@ -4,6 +4,9 @@
* PKCS#15 objects test
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <opensc/opensc.h>

View File

@ -4,9 +4,15 @@
* PKCS#15 PIN code test
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <opensc/opensc.h>
#include <opensc/pkcs15.h>
#include "sc-test.h"

View File

@ -4,6 +4,9 @@
* PKCS#15 PIN code test
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <opensc/opensc.h>

View File

@ -4,6 +4,9 @@
* Pseudo-random number generator test program
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H

View File

@ -4,6 +4,9 @@
* Common functions for test programs
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <opensc/opensc.h>