fix smartos warnings

This commit is contained in:
toddouska 2013-11-20 17:03:19 -08:00
parent 864b25843e
commit 8bf18d31c9
2 changed files with 19 additions and 17 deletions

View File

@ -221,13 +221,13 @@ int benchmark_test(void *args)
#ifdef BENCH_EMBEDDED
const int numBlocks = 25; /* how many kB/megs to test (en/de)cryption */
const char blockType[] = "kB"; /* used in printf output */
const int times = 1; /* public key iterations */
const int ntimes = 1; /* public key iterations */
const int genTimes = 5;
const int agreeTimes = 5;
#else
const int numBlocks = 5;
const char blockType[] = "megs";
const int times = 100;
const int ntimes = 100;
const int genTimes = 100;
const int agreeTimes = 100;
#endif
@ -742,15 +742,15 @@ void bench_rsa(void)
start = current_time(1);
for (i = 0; i < times; i++)
for (i = 0; i < ntimes; i++)
ret = RsaPublicEncrypt(message,len,enc,sizeof(enc), &rsaKey, &rng);
total = current_time(0) - start;
each = total / times; /* per second */
each = total / ntimes; /* per second */
milliEach = each * 1000; /* milliseconds */
printf("RSA %d encryption took %6.2f milliseconds, avg over %d"
" iterations\n", rsaKeySz, milliEach, times);
" iterations\n", rsaKeySz, milliEach, ntimes);
if (ret < 0) {
printf("Rsa Public Encrypt failed\n");
@ -759,17 +759,17 @@ void bench_rsa(void)
start = current_time(1);
for (i = 0; i < times; i++) {
for (i = 0; i < ntimes; i++) {
byte out[512]; /* for up to 4096 bit */
RsaPrivateDecrypt(enc, (word32)ret, out, sizeof(out), &rsaKey);
}
total = current_time(0) - start;
each = total / times; /* per second */
each = total / ntimes; /* per second */
milliEach = each * 1000; /* milliseconds */
printf("RSA %d decryption took %6.2f milliseconds, avg over %d"
" iterations\n", rsaKeySz, milliEach, times);
" iterations\n", rsaKeySz, milliEach, ntimes);
FreeRsaKey(&rsaKey);
#ifdef HAVE_CAVIUM
@ -847,28 +847,28 @@ void bench_dh(void)
start = current_time(1);
for (i = 0; i < times; i++)
for (i = 0; i < ntimes; i++)
DhGenerateKeyPair(&dhKey, &rng, priv, &privSz, pub, &pubSz);
total = current_time(0) - start;
each = total / times; /* per second */
each = total / ntimes; /* per second */
milliEach = each * 1000; /* milliseconds */
printf("DH %d key generation %6.2f milliseconds, avg over %d"
" iterations\n", dhKeySz, milliEach, times);
" iterations\n", dhKeySz, milliEach, ntimes);
DhGenerateKeyPair(&dhKey, &rng, priv2, &privSz2, pub2, &pubSz2);
start = current_time(1);
for (i = 0; i < times; i++)
for (i = 0; i < ntimes; i++)
DhAgree(&dhKey, agree, &agreeSz, priv, privSz, pub2, pubSz2);
total = current_time(0) - start;
each = total / times; /* per second */
each = total / ntimes; /* per second */
milliEach = each * 1000; /* milliseconds */
printf("DH %d key agreement %6.2f milliseconds, avg over %d"
" iterations\n", dhKeySz, milliEach, times);
" iterations\n", dhKeySz, milliEach, ntimes);
#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
fclose(file);

View File

@ -3226,6 +3226,8 @@ static void DecodeCertExtensions(DecodedCert* cert)
word32 oid;
byte critical;
(void)critical;
CYASSL_ENTER("DecodeCertExtensions");
if (input == NULL || sz == 0) return;
@ -4601,7 +4603,7 @@ int MakeNtruCert(Cert* cert, byte* derBuffer, word32 derSz,
#endif /* HAVE_NTRU */
int SignCert(int requestSz, int sigType, byte* buffer, word32 buffSz,
int SignCert(int requestSz, int sType, byte* buffer, word32 buffSz,
RsaKey* rsaKey, ecc_key* eccKey, RNG* rng)
{
byte sig[MAX_ENCODED_SIG_SZ];
@ -4611,14 +4613,14 @@ int SignCert(int requestSz, int sigType, byte* buffer, word32 buffSz,
return requestSz;
sigSz = MakeSignature(buffer, requestSz, sig, sizeof(sig), rsaKey, eccKey,
rng, sigType);
rng, sType);
if (sigSz < 0)
return sigSz;
if (requestSz + MAX_SEQ_SZ * 2 + sigSz > (int)buffSz)
return BUFFER_E;
return AddSignature(buffer, requestSz, sig, sigSz, sigType);
return AddSignature(buffer, requestSz, sig, sigSz, sType);
}