more warning fixes

This commit is contained in:
Todd A Ouska 2011-04-28 15:40:31 -07:00
parent 1e51c4f434
commit 2f4cd9104d
8 changed files with 24 additions and 19 deletions

View File

@ -302,8 +302,10 @@ int mp_add_d (mp_int* a, mp_digit b, mp_int* c);
int mp_init_multi(mp_int* a, mp_int* b, mp_int* c, mp_int* d, mp_int* e, int mp_init_multi(mp_int* a, mp_int* b, mp_int* c, mp_int* d, mp_int* e,
mp_int* f); mp_int* f);
#ifdef HAVE_ECC #if defined(HAVE_ECC) || defined(CYASSL_KEY_GEN)
int mp_sqrmod(mp_int* a, mp_int* b, mp_int* c); int mp_sqrmod(mp_int* a, mp_int* b, mp_int* c);
#endif
#ifdef HAVE_ECC
int mp_read_radix(mp_int* a, const char* str, int radix); int mp_read_radix(mp_int* a, const char* str, int radix);
#endif #endif

View File

@ -427,7 +427,7 @@ void fp_mul_d(fp_int *a, fp_digit b, fp_int *c);
int fp_mulmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d); int fp_mulmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d);
/* c = a * a (mod b) */ /* c = a * a (mod b) */
/*int fp_sqrmod(fp_int *a, fp_int *b, fp_int *c);*/ int fp_sqrmod(fp_int *a, fp_int *b, fp_int *c);
/* c = 1/a (mod b) */ /* c = 1/a (mod b) */
int fp_invmod(fp_int *a, fp_int *b, fp_int *c); int fp_invmod(fp_int *a, fp_int *b, fp_int *c);

View File

@ -2296,7 +2296,7 @@ int DerToPem(const byte* der, word32 derSz, byte* output, word32 outSz,
/* body */ /* body */
outLen = outSz; /* input to Base64Encode */ outLen = outSz; /* input to Base64Encode */
if ( (err = Base64Encode(der, derSz, output + i, (word32*)&outLen)) < 0) if ( (err = Base64Encode(der, derSz, output + i, (word32*)&outLen)) < 0)
return ret; return err;
i += outLen; i += outLen;
/* footer */ /* footer */
@ -2506,7 +2506,7 @@ static int SetPublicKey(byte* output, RsaKey* key)
n[0] = ASN_INTEGER; n[0] = ASN_INTEGER;
nSz = SetLength(rawLen, n + 1) + 1; /* int tag */ nSz = SetLength(rawLen, n + 1) + 1; /* int tag */
if ( (nSz + rawLen) < sizeof(n)) { if ( (nSz + rawLen) < (int)sizeof(n)) {
int err = mp_to_unsigned_bin(&key->n, n + nSz); int err = mp_to_unsigned_bin(&key->n, n + nSz);
if (err == MP_OKAY) if (err == MP_OKAY)
nSz += rawLen; nSz += rawLen;
@ -2521,7 +2521,7 @@ static int SetPublicKey(byte* output, RsaKey* key)
e[0] = ASN_INTEGER; e[0] = ASN_INTEGER;
eSz = SetLength(rawLen, e + 1) + 1; /* int tag */ eSz = SetLength(rawLen, e + 1) + 1; /* int tag */
if ( (eSz + rawLen) < sizeof(e)) { if ( (eSz + rawLen) < (int)sizeof(e)) {
int err = mp_to_unsigned_bin(&key->e, e + eSz); int err = mp_to_unsigned_bin(&key->e, e + eSz);
if (err == MP_OKAY) if (err == MP_OKAY)
eSz += rawLen; eSz += rawLen;
@ -2780,7 +2780,7 @@ static int SetName(byte* output, CertName* name)
setSz = SetSet(thisLen, set); setSz = SetSet(thisLen, set);
thisLen += setSz; thisLen += setSz;
if (thisLen > sizeof(names[i].encoded)) if (thisLen > (int)sizeof(names[i].encoded))
return BUFFER_E; return BUFFER_E;
/* store it */ /* store it */
@ -2847,6 +2847,8 @@ static int SetName(byte* output, CertName* name)
static int EncodeCert(Cert* cert, DerCert* der, RsaKey* rsaKey, RNG* rng, static int EncodeCert(Cert* cert, DerCert* der, RsaKey* rsaKey, RNG* rng,
const byte* ntruKey, word16 ntruSz) const byte* ntruKey, word16 ntruSz)
{ {
(void)ntruKey;
(void)ntruSz;
/* version */ /* version */
der->versionSz = SetMyVersion(cert->version, der->version, TRUE); der->versionSz = SetMyVersion(cert->version, der->version, TRUE);

View File

@ -47,6 +47,7 @@
void InitDhKey(DhKey* key) void InitDhKey(DhKey* key)
{ {
(void)key;
/* TomsFastMath doesn't use memory allocation */ /* TomsFastMath doesn't use memory allocation */
#ifndef USE_FAST_MATH #ifndef USE_FAST_MATH
key->p.dp = 0; key->p.dp = 0;
@ -57,6 +58,7 @@ void InitDhKey(DhKey* key)
void FreeDhKey(DhKey* key) void FreeDhKey(DhKey* key)
{ {
(void)key;
/* TomsFastMath doesn't use memory allocation */ /* TomsFastMath doesn't use memory allocation */
#ifndef USE_FAST_MATH #ifndef USE_FAST_MATH
mp_clear(&key->p); mp_clear(&key->p);

View File

@ -3591,7 +3591,7 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
} }
#if defined(HAVE_ECC) #if defined(CYASSL_KEY_GEN) || defined(HAVE_ECC)
/* c = a * a (mod b) */ /* c = a * a (mod b) */
int mp_sqrmod (mp_int * a, mp_int * b, mp_int * c) int mp_sqrmod (mp_int * a, mp_int * b, mp_int * c)
@ -3617,8 +3617,6 @@ int mp_sqrmod (mp_int * a, mp_int * b, mp_int * c)
#if defined(CYASSL_KEY_GEN) || defined(HAVE_ECC) || !defined(NO_PWDBASED) #if defined(CYASSL_KEY_GEN) || defined(HAVE_ECC) || !defined(NO_PWDBASED)
int mp_sub_d (mp_int* a, mp_digit b, mp_int* c);
/* single digit addition */ /* single digit addition */
int mp_add_d (mp_int* a, mp_digit b, mp_int* c) int mp_add_d (mp_int* a, mp_digit b, mp_int* c)
{ {
@ -3805,7 +3803,7 @@ static int s_is_power_of_two(mp_digit b, int *p)
} }
/* single digit division (based on routine from MPI) */ /* single digit division (based on routine from MPI) */
int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d) static int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d)
{ {
mp_int q; mp_int q;
mp_word w; mp_word w;
@ -3880,7 +3878,7 @@ int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d)
} }
int mp_mod_d (mp_int * a, mp_digit b, mp_digit * c) static int mp_mod_d (mp_int * a, mp_digit b, mp_digit * c)
{ {
return mp_div_d(a, b, NULL, c); return mp_div_d(a, b, NULL, c);
} }
@ -3935,7 +3933,7 @@ const mp_digit ltm_prime_tab[] = {
* Randomly the chance of error is no more than 1/4 and often * Randomly the chance of error is no more than 1/4 and often
* very much lower. * very much lower.
*/ */
int mp_prime_miller_rabin (mp_int * a, mp_int * b, int *result) static int mp_prime_miller_rabin (mp_int * a, mp_int * b, int *result)
{ {
mp_int n1, y, r; mp_int n1, y, r;
int s, j, err; int s, j, err;
@ -4016,7 +4014,7 @@ LBL_N1:mp_clear (&n1);
* *
* sets result to 0 if not, 1 if yes * sets result to 0 if not, 1 if yes
*/ */
int mp_prime_is_divisible (mp_int * a, int *result) static int mp_prime_is_divisible (mp_int * a, int *result)
{ {
int err, ix; int err, ix;
mp_digit res; mp_digit res;

View File

@ -65,6 +65,7 @@ void InitRsaKey(RsaKey* key, void* heap)
void FreeRsaKey(RsaKey* key) void FreeRsaKey(RsaKey* key)
{ {
(void)key;
/* TomsFastMath doesn't use memory allocation */ /* TomsFastMath doesn't use memory allocation */
#ifndef USE_FAST_MATH #ifndef USE_FAST_MATH
if (key->type == RSA_PRIVATE) { if (key->type == RSA_PRIVATE) {
@ -379,6 +380,7 @@ static int rand_prime(mp_int* N, int len, RNG* rng, void* heap)
int err, res, type; int err, res, type;
byte* buf; byte* buf;
(void)heap;
if (N == NULL || rng == NULL) if (N == NULL || rng == NULL)
return BAD_FUNC_ARG; return BAD_FUNC_ARG;

View File

@ -1972,6 +1972,7 @@ int mp_sub_d(fp_int *a, fp_digit b, fp_int *c)
int mp_prime_is_prime(mp_int* a, int t, int* result) int mp_prime_is_prime(mp_int* a, int t, int* result)
{ {
(void)t;
*result = fp_isprime(a); *result = fp_isprime(a);
return MP_OKAY; return MP_OKAY;
} }
@ -2006,7 +2007,7 @@ static int s_is_power_of_two(fp_digit b, int *p)
} }
/* a/b => cb + d == a */ /* a/b => cb + d == a */
int fp_div_d(fp_int *a, fp_digit b, fp_int *c, fp_digit *d) static int fp_div_d(fp_int *a, fp_digit b, fp_int *c, fp_digit *d)
{ {
fp_int q; fp_int q;
fp_word w; fp_word w;
@ -2072,7 +2073,7 @@ int fp_div_d(fp_int *a, fp_digit b, fp_int *c, fp_digit *d)
/* c = a mod b, 0 <= c < b */ /* c = a mod b, 0 <= c < b */
int fp_mod_d(fp_int *a, fp_digit b, fp_digit *c) static int fp_mod_d(fp_int *a, fp_digit b, fp_digit *c)
{ {
return fp_div_d(a, b, NULL, c); return fp_div_d(a, b, NULL, c);
} }
@ -2085,7 +2086,7 @@ int fp_mod_d(fp_int *a, fp_digit b, fp_digit *c)
* Randomly the chance of error is no more than 1/4 and often * Randomly the chance of error is no more than 1/4 and often
* very much lower. * very much lower.
*/ */
void fp_prime_miller_rabin (fp_int * a, fp_int * b, int *result) static void fp_prime_miller_rabin (fp_int * a, fp_int * b, int *result)
{ {
fp_int n1, y, r; fp_int n1, y, r;
int s, j; int s, j;
@ -2326,7 +2327,7 @@ int mp_add_d(fp_int *a, fp_digit b, fp_int *c)
/* chars used in radix conversions */ /* chars used in radix conversions */
const char *fp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; const char *fp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";
int fp_read_radix(fp_int *a, const char *str, int radix) static int fp_read_radix(fp_int *a, const char *str, int radix)
{ {
int y, neg; int y, neg;
char ch; char ch;

View File

@ -636,8 +636,6 @@ CYASSL_API int CyaSSL_negotiate(SSL* ssl);
/* turn on CyaSSL data compression */ /* turn on CyaSSL data compression */
CYASSL_API int CyaSSL_set_compression(SSL* ssl); CYASSL_API int CyaSSL_set_compression(SSL* ssl);
/* load NTRU private key blob */
CYASSL_API int CyaSSL_CTX_use_NTRUPrivateKey_file(SSL_CTX*, const char*);
/* get CyaSSL peer X509_CHAIN */ /* get CyaSSL peer X509_CHAIN */
CYASSL_API X509_CHAIN* CyaSSL_get_peer_chain(SSL* ssl); CYASSL_API X509_CHAIN* CyaSSL_get_peer_chain(SSL* ssl);
/* peer chain count */ /* peer chain count */