6989705: ECC security code native code compiler warnings
Reviewed-by: alanb, ohair
--- a/jdk/src/share/native/sun/security/ec/ECC_JNI.cpp Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/ECC_JNI.cpp Fri Feb 04 00:33:30 2011 +0000
@@ -38,7 +38,7 @@
/*
* Throws an arbitrary Java exception.
*/
-void ThrowException(JNIEnv *env, char *exceptionName)
+void ThrowException(JNIEnv *env, const char *exceptionName)
{
jclass exceptionClazz = env->FindClass(exceptionName);
env->ThrowNew(exceptionClazz, NULL);
@@ -89,7 +89,7 @@
// Fill a new ECParams using the supplied OID
if (EC_DecodeParams(¶ms_item, &ecparams, 0) != SECSuccess) {
/* bad curve OID */
- ThrowException(env, (char *) INVALID_ALGORITHM_PARAMETER_EXCEPTION);
+ ThrowException(env, INVALID_ALGORITHM_PARAMETER_EXCEPTION);
goto cleanup;
}
@@ -101,7 +101,7 @@
// Generate the new keypair (using the supplied seed)
if (EC_NewKey(ecparams, &privKey, (unsigned char *) pSeedBuffer,
jSeedLength, 0) != SECSuccess) {
- ThrowException(env, (char *) KEY_EXCEPTION);
+ ThrowException(env, KEY_EXCEPTION);
goto cleanup;
}
--- a/jdk/src/share/native/sun/security/ec/impl/ec.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ec.c Fri Feb 04 00:33:30 2011 +0000
@@ -51,12 +51,10 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "mplogic.h"
#include "ec.h"
#include "ecl.h"
@@ -67,6 +65,7 @@
#include <string.h>
#ifndef _WIN32
+#include <stdio.h>
#include <strings.h>
#endif /* _WIN32 */
@@ -116,7 +115,7 @@
ECGroup *group = NULL;
SECStatus rv = SECFailure;
mp_err err = MP_OKAY;
- int len;
+ unsigned int len;
#if EC_DEBUG
int i;
@@ -278,10 +277,6 @@
printf("ec_NewKey called\n");
#endif
-#ifndef _WIN32
-int printf();
-#endif /* _WIN32 */
-
if (!ecParams || !privKey || !privKeyBytes || (privKeyLen < 0)) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
@@ -361,8 +356,9 @@
cleanup:
mp_clear(&k);
- if (rv)
+ if (rv) {
PORT_FreeArena(arena, PR_TRUE);
+ }
#if EC_DEBUG
printf("ec_NewKey returning %s\n",
@@ -504,7 +500,7 @@
ECGroup *group = NULL;
SECStatus rv = SECFailure;
mp_err err = MP_OKAY;
- int len;
+ unsigned int len;
if (!ecParams || !publicValue) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
@@ -778,7 +774,7 @@
/* In the definition of EC signing, digests are truncated
* to the length of n in bits.
* (see SEC 1 "Elliptic Curve Digit Signature Algorithm" section 4.1.*/
- if (digest->len*8 > ecParams->fieldID.size) {
+ if (digest->len*8 > (unsigned int)ecParams->fieldID.size) {
mpl_rsh(&s,&s,digest->len*8 - ecParams->fieldID.size);
}
@@ -993,7 +989,8 @@
/* In the definition of EC signing, digests are truncated
* to the length of n in bits.
* (see SEC 1 "Elliptic Curve Digit Signature Algorithm" section 4.1.*/
- if (digest->len*8 > ecParams->fieldID.size) { /* u1 = HASH(M') */
+ /* u1 = HASH(M') */
+ if (digest->len*8 > (unsigned int)ecParams->fieldID.size) {
mpl_rsh(&u1,&u1,digest->len*8- ecParams->fieldID.size);
}
--- a/jdk/src/share/native/sun/security/ec/impl/ec.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ec.h Fri Feb 04 00:33:30 2011 +0000
@@ -57,8 +57,6 @@
#ifndef __ec_h_
#define __ec_h_
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#define EC_DEBUG 0
#define EC_POINT_FORM_COMPRESSED_Y0 0x02
#define EC_POINT_FORM_COMPRESSED_Y1 0x03
--- a/jdk/src/share/native/sun/security/ec/impl/ec2.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ec2.h Fri Feb 04 00:33:30 2011 +0000
@@ -57,8 +57,6 @@
#ifndef _EC2_H
#define _EC2_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ecl-priv.h"
/* Checks if point P(px, py) is at infinity. Uses affine coordinates. */
--- a/jdk/src/share/native/sun/security/ec/impl/ec2_163.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ec2_163.c Fri Feb 04 00:33:30 2011 +0000
@@ -56,8 +56,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ec2.h"
#include "mp_gf2m.h"
#include "mp_gf2m-priv.h"
--- a/jdk/src/share/native/sun/security/ec/impl/ec2_193.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ec2_193.c Fri Feb 04 00:33:30 2011 +0000
@@ -56,8 +56,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ec2.h"
#include "mp_gf2m.h"
#include "mp_gf2m-priv.h"
--- a/jdk/src/share/native/sun/security/ec/impl/ec2_233.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ec2_233.c Fri Feb 04 00:33:30 2011 +0000
@@ -56,8 +56,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ec2.h"
#include "mp_gf2m.h"
#include "mp_gf2m-priv.h"
--- a/jdk/src/share/native/sun/security/ec/impl/ec2_aff.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ec2_aff.c Fri Feb 04 00:33:30 2011 +0000
@@ -54,8 +54,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ec2.h"
#include "mplogic.h"
#include "mp_gf2m.h"
--- a/jdk/src/share/native/sun/security/ec/impl/ec2_mont.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ec2_mont.c Fri Feb 04 00:33:30 2011 +0000
@@ -56,8 +56,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ec2.h"
#include "mplogic.h"
#include "mp_gf2m.h"
--- a/jdk/src/share/native/sun/security/ec/impl/ec_naf.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ec_naf.c Fri Feb 04 00:33:30 2011 +0000
@@ -54,8 +54,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ecl-priv.h"
/* Returns 2^e as an integer. This is meant to be used for small powers of
--- a/jdk/src/share/native/sun/security/ec/impl/ecc_impl.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecc_impl.h Fri Feb 04 00:33:30 2011 +0000
@@ -51,15 +51,13 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _ECC_IMPL_H
#define _ECC_IMPL_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -82,6 +80,7 @@
typedef unsigned char uint8_t;
typedef unsigned long ulong_t;
typedef enum boolean { B_FALSE, B_TRUE } boolean_t;
+#define strdup _strdup /* Replace POSIX name with ISO C++ name */
#endif /* _WIN32 */
#ifndef _KERNEL
--- a/jdk/src/share/native/sun/security/ec/impl/ecdecode.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecdecode.c Fri Feb 04 00:33:30 2011 +0000
@@ -55,8 +55,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#ifndef _WIN32
@@ -90,7 +88,7 @@
{
int i = 0;
int byteval = 0;
- int tmp = strlen(str);
+ int tmp = (int)strlen(str);
if ((tmp % 2) != 0) return NULL;
@@ -134,7 +132,8 @@
/* 2 ['0'+'4'] + MAX_ECKEY_LEN * 2 [x,y] * 2 [hex string] + 1 ['\0'] */
char genenc[3 + 2 * 2 * MAX_ECKEY_LEN];
- if ((name < ECCurve_noName) || (name > ECCurve_pastLastCurve)) goto cleanup;
+ if (((int)name < ECCurve_noName) || (name > ECCurve_pastLastCurve))
+ goto cleanup;
params->name = name;
curveParams = ecCurve_map[params->name];
CHECK_OK(curveParams);
--- a/jdk/src/share/native/sun/security/ec/impl/ecl-curve.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecl-curve.h Fri Feb 04 00:33:30 2011 +0000
@@ -57,8 +57,6 @@
#ifndef _ECL_CURVE_H
#define _ECL_CURVE_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ecl-exp.h"
#ifndef _KERNEL
#include <stdlib.h>
--- a/jdk/src/share/native/sun/security/ec/impl/ecl-exp.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecl-exp.h Fri Feb 04 00:33:30 2011 +0000
@@ -57,8 +57,6 @@
#ifndef _ECL_EXP_H
#define _ECL_EXP_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/* Curve field type */
typedef enum {
ECField_GFp,
--- a/jdk/src/share/native/sun/security/ec/impl/ecl-priv.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecl-priv.h Fri Feb 04 00:33:30 2011 +0000
@@ -58,8 +58,6 @@
#ifndef _ECL_PRIV_H
#define _ECL_PRIV_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ecl.h"
#include "mpi.h"
#include "mplogic.h"
@@ -90,6 +88,10 @@
s = ACCUM(w); \
cout = CARRYOUT(w); }
+/* Handle case when carry-in value is zero */
+#define MP_ADD_CARRY_ZERO(a1, a2, s, cout) \
+ MP_ADD_CARRY(a1, a2, s, 0, cout);
+
#define MP_SUB_BORROW(a1, a2, s, bin, bout) \
{ mp_word w; \
w = ((mp_word)(a1)) - (a2) - (bin); \
@@ -111,6 +113,15 @@
s = sum += (cin); \
cout = tmp + (sum < (cin)); }
+/* Handle case when carry-in value is zero */
+#define MP_ADD_CARRY_ZERO(a1, a2, s, cout) \
+ { mp_digit tmp,sum; \
+ tmp = (a1); \
+ sum = tmp + (a2); \
+ tmp = (sum < tmp); /* detect overflow */ \
+ s = sum; \
+ cout = tmp; }
+
#define MP_SUB_BORROW(a1, a2, s, bin, bout) \
{ mp_digit tmp; \
tmp = (a1); \
--- a/jdk/src/share/native/sun/security/ec/impl/ecl.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecl.c Fri Feb 04 00:33:30 2011 +0000
@@ -54,8 +54,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "mpi.h"
#include "mplogic.h"
#include "ecl.h"
--- a/jdk/src/share/native/sun/security/ec/impl/ecl.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecl.h Fri Feb 04 00:33:30 2011 +0000
@@ -57,8 +57,6 @@
#ifndef _ECL_H
#define _ECL_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/* Although this is not an exported header file, code which uses elliptic
* curve point operations will need to include it. */
--- a/jdk/src/share/native/sun/security/ec/impl/ecl_curve.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecl_curve.c Fri Feb 04 00:33:30 2011 +0000
@@ -54,8 +54,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ecl.h"
#include "ecl-curve.h"
#include "ecl-priv.h"
--- a/jdk/src/share/native/sun/security/ec/impl/ecl_gf.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecl_gf.c Fri Feb 04 00:33:30 2011 +0000
@@ -55,8 +55,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "mpi.h"
#include "mp_gf2m.h"
#include "ecl-priv.h"
@@ -307,7 +305,7 @@
}
#ifndef MPI_AMD64_ADD
- MP_ADD_CARRY(a0, r0, r0, 0, carry);
+ MP_ADD_CARRY_ZERO(a0, r0, r0, carry);
MP_ADD_CARRY(a1, r1, r1, carry, carry);
MP_ADD_CARRY(a2, r2, r2, carry, carry);
#else
@@ -394,7 +392,7 @@
}
#ifndef MPI_AMD64_ADD
- MP_ADD_CARRY(a0, r0, r0, 0, carry);
+ MP_ADD_CARRY_ZERO(a0, r0, r0, carry);
MP_ADD_CARRY(a1, r1, r1, carry, carry);
MP_ADD_CARRY(a2, r2, r2, carry, carry);
MP_ADD_CARRY(a3, r3, r3, carry, carry);
@@ -491,7 +489,7 @@
r0 = MP_DIGIT(b,0);
}
- MP_ADD_CARRY(a0, r0, r0, 0, carry);
+ MP_ADD_CARRY_ZERO(a0, r0, r0, carry);
MP_ADD_CARRY(a1, r1, r1, carry, carry);
MP_ADD_CARRY(a2, r2, r2, carry, carry);
MP_ADD_CARRY(a3, r3, r3, carry, carry);
@@ -572,7 +570,7 @@
r0 = MP_DIGIT(b,0);
}
- MP_ADD_CARRY(a0, r0, r0, 0, carry);
+ MP_ADD_CARRY_ZERO(a0, r0, r0, carry);
MP_ADD_CARRY(a1, r1, r1, carry, carry);
MP_ADD_CARRY(a2, r2, r2, carry, carry);
MP_ADD_CARRY(a3, r3, r3, carry, carry);
@@ -675,7 +673,7 @@
b1 = MP_DIGIT(&meth->irr,1);
b0 = MP_DIGIT(&meth->irr,0);
#ifndef MPI_AMD64_ADD
- MP_ADD_CARRY(b0, r0, r0, 0, borrow);
+ MP_ADD_CARRY_ZERO(b0, r0, r0, borrow);
MP_ADD_CARRY(b1, r1, r1, borrow, borrow);
MP_ADD_CARRY(b2, r2, r2, borrow, borrow);
#else
@@ -766,7 +764,7 @@
b1 = MP_DIGIT(&meth->irr,1);
b0 = MP_DIGIT(&meth->irr,0);
#ifndef MPI_AMD64_ADD
- MP_ADD_CARRY(b0, r0, r0, 0, borrow);
+ MP_ADD_CARRY_ZERO(b0, r0, r0, borrow);
MP_ADD_CARRY(b1, r1, r1, borrow, borrow);
MP_ADD_CARRY(b2, r2, r2, borrow, borrow);
MP_ADD_CARRY(b3, r3, r3, borrow, borrow);
@@ -850,7 +848,7 @@
b2 = MP_DIGIT(&meth->irr,2);
b1 = MP_DIGIT(&meth->irr,1);
b0 = MP_DIGIT(&meth->irr,0);
- MP_ADD_CARRY(b0, r0, r0, 0, borrow);
+ MP_ADD_CARRY_ZERO(b0, r0, r0, borrow);
MP_ADD_CARRY(b1, r1, r1, borrow, borrow);
MP_ADD_CARRY(b2, r2, r2, borrow, borrow);
MP_ADD_CARRY(b3, r3, r3, borrow, borrow);
@@ -924,7 +922,7 @@
b2 = MP_DIGIT(&meth->irr,2);
b1 = MP_DIGIT(&meth->irr,1);
b0 = MP_DIGIT(&meth->irr,0);
- MP_ADD_CARRY(b0, r0, r0, 0, borrow);
+ MP_ADD_CARRY_ZERO(b0, r0, r0, borrow);
MP_ADD_CARRY(b1, r1, r1, borrow, borrow);
MP_ADD_CARRY(b2, r2, r2, borrow, borrow);
MP_ADD_CARRY(b3, r3, r3, borrow, borrow);
--- a/jdk/src/share/native/sun/security/ec/impl/ecl_mult.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecl_mult.c Fri Feb 04 00:33:30 2011 +0000
@@ -54,8 +54,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "mpi.h"
#include "mplogic.h"
#include "ecl.h"
--- a/jdk/src/share/native/sun/security/ec/impl/ecp.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp.h Fri Feb 04 00:33:30 2011 +0000
@@ -57,8 +57,6 @@
#ifndef _ECP_H
#define _ECP_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ecl-priv.h"
/* Checks if point P(px, py) is at infinity. Uses affine coordinates. */
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_192.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_192.c Fri Feb 04 00:33:30 2011 +0000
@@ -54,8 +54,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ecp.h"
#include "mpi.h"
#include "mplogic.h"
@@ -210,15 +208,15 @@
/* implement r = (a2,a1,a0)+(a5,a5,a5)+(a4,a4,0)+(0,a3,a3) */
#ifndef MPI_AMD64_ADD
- MP_ADD_CARRY(r0, a3, r0, 0, carry);
+ MP_ADD_CARRY_ZERO(r0, a3, r0, carry);
MP_ADD_CARRY(r1, a3, r1, carry, carry);
MP_ADD_CARRY(r2, a4, r2, carry, carry);
r3 = carry;
- MP_ADD_CARRY(r0, a5, r0, 0, carry);
+ MP_ADD_CARRY_ZERO(r0, a5, r0, carry);
MP_ADD_CARRY(r1, a5, r1, carry, carry);
MP_ADD_CARRY(r2, a5, r2, carry, carry);
r3 += carry;
- MP_ADD_CARRY(r1, a4, r1, 0, carry);
+ MP_ADD_CARRY_ZERO(r1, a4, r1, carry);
MP_ADD_CARRY(r2, 0, r2, carry, carry);
r3 += carry;
@@ -251,7 +249,7 @@
/* reduce out the carry */
while (r3) {
#ifndef MPI_AMD64_ADD
- MP_ADD_CARRY(r0, r3, r0, 0, carry);
+ MP_ADD_CARRY_ZERO(r0, r3, r0, carry);
MP_ADD_CARRY(r1, r3, r1, carry, carry);
MP_ADD_CARRY(r2, 0, r2, carry, carry);
r3 = carry;
@@ -335,7 +333,7 @@
}
#ifndef MPI_AMD64_ADD
- MP_ADD_CARRY(a0, r0, r0, 0, carry);
+ MP_ADD_CARRY_ZERO(a0, r0, r0, carry);
MP_ADD_CARRY(a1, r1, r1, carry, carry);
MP_ADD_CARRY(a2, r2, r2, carry, carry);
#else
@@ -357,7 +355,7 @@
((r1 == MP_DIGIT_MAX) ||
((r1 == (MP_DIGIT_MAX-1)) && (r0 == MP_DIGIT_MAX))))) {
#ifndef MPI_AMD64_ADD
- MP_ADD_CARRY(r0, 1, r0, 0, carry);
+ MP_ADD_CARRY_ZERO(r0, 1, r0, carry);
MP_ADD_CARRY(r1, 1, r1, carry, carry);
MP_ADD_CARRY(r2, 0, r2, carry, carry);
#else
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_224.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_224.c Fri Feb 04 00:33:30 2011 +0000
@@ -54,8 +54,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ecp.h"
#include "mpi.h"
#include "mplogic.h"
@@ -251,10 +249,10 @@
+( 0, a6,a5b, 0)
-( 0 0, 0|a6b, a6a|a5b )
-( a6b, a6a|a5b, a5a|a4b, a4a|a3b ) */
- MP_ADD_CARRY (r1, a3b, r1, 0, carry);
+ MP_ADD_CARRY_ZERO (r1, a3b, r1, carry);
MP_ADD_CARRY (r2, a4 , r2, carry, carry);
MP_ADD_CARRY (r3, a5a, r3, carry, carry);
- MP_ADD_CARRY (r1, a5b, r1, 0, carry);
+ MP_ADD_CARRY_ZERO (r1, a5b, r1, carry);
MP_ADD_CARRY (r2, a6 , r2, carry, carry);
MP_ADD_CARRY (r3, 0, r3, carry, carry);
@@ -275,7 +273,7 @@
r3b = (int)(r3 >>32);
while (r3b > 0) {
r3 &= 0xffffffff;
- MP_ADD_CARRY(r1,((mp_digit)r3b) << 32, r1, 0, carry);
+ MP_ADD_CARRY_ZERO(r1,((mp_digit)r3b) << 32, r1, carry);
if (carry) {
MP_ADD_CARRY(r2, 0, r2, carry, carry);
MP_ADD_CARRY(r3, 0, r3, carry, carry);
@@ -290,7 +288,7 @@
}
while (r3b < 0) {
- MP_ADD_CARRY (r0, 1, r0, 0, carry);
+ MP_ADD_CARRY_ZERO (r0, 1, r0, carry);
MP_ADD_CARRY (r1, MP_DIGIT_MAX <<32, r1, carry, carry);
MP_ADD_CARRY (r2, MP_DIGIT_MAX, r2, carry, carry);
MP_ADD_CARRY (r3, MP_DIGIT_MAX >> 32, r3, carry, carry);
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_256.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_256.c Fri Feb 04 00:33:30 2011 +0000
@@ -54,8 +54,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ecp.h"
#include "mpi.h"
#include "mplogic.h"
@@ -303,32 +301,32 @@
r0 = MP_DIGIT(a,0);
/* sum 1 */
- MP_ADD_CARRY(r1, a5h << 32, r1, 0, carry);
+ MP_ADD_CARRY_ZERO(r1, a5h << 32, r1, carry);
MP_ADD_CARRY(r2, a6, r2, carry, carry);
MP_ADD_CARRY(r3, a7, r3, carry, carry);
r4 = carry;
- MP_ADD_CARRY(r1, a5h << 32, r1, 0, carry);
+ MP_ADD_CARRY_ZERO(r1, a5h << 32, r1, carry);
MP_ADD_CARRY(r2, a6, r2, carry, carry);
MP_ADD_CARRY(r3, a7, r3, carry, carry);
r4 += carry;
/* sum 2 */
- MP_ADD_CARRY(r1, a6l, r1, 0, carry);
+ MP_ADD_CARRY_ZERO(r1, a6l, r1, carry);
MP_ADD_CARRY(r2, a6h | a7l, r2, carry, carry);
MP_ADD_CARRY(r3, a7h, r3, carry, carry);
r4 += carry;
- MP_ADD_CARRY(r1, a6l, r1, 0, carry);
+ MP_ADD_CARRY_ZERO(r1, a6l, r1, carry);
MP_ADD_CARRY(r2, a6h | a7l, r2, carry, carry);
MP_ADD_CARRY(r3, a7h, r3, carry, carry);
r4 += carry;
/* sum 3 */
- MP_ADD_CARRY(r0, a4, r0, 0, carry);
+ MP_ADD_CARRY_ZERO(r0, a4, r0, carry);
MP_ADD_CARRY(r1, a5l >> 32, r1, carry, carry);
MP_ADD_CARRY(r2, 0, r2, carry, carry);
MP_ADD_CARRY(r3, a7, r3, carry, carry);
r4 += carry;
/* sum 4 */
- MP_ADD_CARRY(r0, a4h | a5l, r0, 0, carry);
+ MP_ADD_CARRY_ZERO(r0, a4h | a5l, r0, carry);
MP_ADD_CARRY(r1, a5h|(a6h<<32), r1, carry, carry);
MP_ADD_CARRY(r2, a7, r2, carry, carry);
MP_ADD_CARRY(r3, a6h | a4l, r3, carry, carry);
@@ -362,7 +360,7 @@
while (r4 > 0) {
mp_digit r4_long = r4;
mp_digit r4l = (r4_long << 32);
- MP_ADD_CARRY(r0, r4_long, r0, 0, carry);
+ MP_ADD_CARRY_ZERO(r0, r4_long, r0, carry);
MP_ADD_CARRY(r1, -r4l, r1, carry, carry);
MP_ADD_CARRY(r2, MP_DIGIT_MAX, r2, carry, carry);
MP_ADD_CARRY(r3, r4l-r4_long-1,r3, carry, carry);
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_384.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_384.c Fri Feb 04 00:33:30 2011 +0000
@@ -54,8 +54,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ecp.h"
#include "mpi.h"
#include "mplogic.h"
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_521.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_521.c Fri Feb 04 00:33:30 2011 +0000
@@ -50,12 +50,10 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ecp.h"
#include "mpi.h"
#include "mplogic.h"
@@ -74,7 +72,7 @@
{
mp_err res = MP_OKAY;
int a_bits = mpl_significant_bits(a);
- int i;
+ unsigned int i;
/* m1, m2 are statically-allocated mp_int of exactly the size we need */
mp_int m1;
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_aff.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_aff.c Fri Feb 04 00:33:30 2011 +0000
@@ -59,8 +59,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ecp.h"
#include "mplogic.h"
#ifndef _KERNEL
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_jac.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_jac.c Fri Feb 04 00:33:30 2011 +0000
@@ -59,8 +59,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ecp.h"
#include "mplogic.h"
#ifndef _KERNEL
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_jm.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_jm.c Fri Feb 04 00:33:30 2011 +0000
@@ -54,8 +54,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ecp.h"
#include "ecl-priv.h"
#include "mplogic.h"
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_mont.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_mont.c Fri Feb 04 00:33:30 2011 +0000
@@ -54,8 +54,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/* Uses Montgomery reduction for field arithmetic. See mpi/mpmontg.c for
* code implementation. */
--- a/jdk/src/share/native/sun/security/ec/impl/logtab.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/logtab.h Fri Feb 04 00:33:30 2011 +0000
@@ -57,8 +57,6 @@
#ifndef _LOGTAB_H
#define _LOGTAB_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
const float s_logv_2[] = {
0.000000000f, 0.000000000f, 1.000000000f, 0.630929754f, /* 0 1 2 3 */
0.500000000f, 0.430676558f, 0.386852807f, 0.356207187f, /* 4 5 6 7 */
--- a/jdk/src/share/native/sun/security/ec/impl/mp_gf2m-priv.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/mp_gf2m-priv.h Fri Feb 04 00:33:30 2011 +0000
@@ -58,8 +58,6 @@
#ifndef _MP_GF2M_PRIV_H_
#define _MP_GF2M_PRIV_H_
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "mpi-priv.h"
extern const mp_digit mp_gf2m_sqr_tb[16];
--- a/jdk/src/share/native/sun/security/ec/impl/mp_gf2m.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/mp_gf2m.c Fri Feb 04 00:33:30 2011 +0000
@@ -55,8 +55,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "mp_gf2m.h"
#include "mp_gf2m-priv.h"
#include "mplogic.h"
--- a/jdk/src/share/native/sun/security/ec/impl/mp_gf2m.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/mp_gf2m.h Fri Feb 04 00:33:30 2011 +0000
@@ -58,8 +58,6 @@
#ifndef _MP_GF2M_H_
#define _MP_GF2M_H_
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "mpi.h"
mp_err mp_badd(const mp_int *a, const mp_int *b, mp_int *c);
--- a/jdk/src/share/native/sun/security/ec/impl/mpi-config.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/mpi-config.h Fri Feb 04 00:33:30 2011 +0000
@@ -57,8 +57,6 @@
#ifndef _MPI_CONFIG_H
#define _MPI_CONFIG_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/* $Id: mpi-config.h,v 1.5 2004/04/25 15:03:10 gerv%gerv.net Exp $ */
/*
--- a/jdk/src/share/native/sun/security/ec/impl/mpi-priv.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/mpi-priv.h Fri Feb 04 00:33:30 2011 +0000
@@ -63,8 +63,6 @@
#ifndef _MPI_PRIV_H
#define _MPI_PRIV_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/* $Id: mpi-priv.h,v 1.20 2005/11/22 07:16:43 relyea%netscape.com Exp $ */
#include "mpi.h"
--- a/jdk/src/share/native/sun/security/ec/impl/mpi.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/mpi.c Fri Feb 04 00:33:30 2011 +0000
@@ -54,12 +54,10 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/* $Id: mpi.c,v 1.45 2006/09/29 20:12:21 alexei.volkov.bugs%sun.com Exp $ */
#include "mpi-priv.h"
@@ -1148,7 +1146,7 @@
mp_int s, x;
mp_err res;
mp_digit d;
- int dig, bit;
+ unsigned int dig, bit;
ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG);
@@ -1523,7 +1521,7 @@
mp_int s, x, mu;
mp_err res;
mp_digit d;
- int dig, bit;
+ unsigned int dig, bit;
ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG);
@@ -2057,7 +2055,7 @@
{
mp_digit d;
mp_size n = 0;
- int ix;
+ unsigned int ix;
if (!mp || !MP_DIGITS(mp) || !mp_cmp_z(mp))
return n;
@@ -2900,9 +2898,9 @@
/* Allocate ni records of nb bytes each, and return a pointer to that */
void *s_mp_alloc(size_t nb, size_t ni, int kmflag)
{
- mp_int *mp;
++mp_allocs;
#ifdef _KERNEL
+ mp_int *mp;
mp = kmem_zalloc(nb * ni, kmflag);
if (mp != NULL)
FLAG(mp) = kmflag;
@@ -3112,7 +3110,7 @@
mp_err s_mp_mul_2(mp_int *mp)
{
mp_digit *pd;
- int ix, used;
+ unsigned int ix, used;
mp_digit kin = 0;
/* Shift digits leftward by 1 bit */
@@ -4663,7 +4661,7 @@
{
char ch;
- if(val >= r)
+ if(val >= (unsigned int)r)
return 0;
ch = s_dmap_1[val];
@@ -4778,7 +4776,7 @@
mp_to_unsigned_octets(const mp_int *mp, unsigned char *str, mp_size maxlen)
{
int ix, pos = 0;
- int bytes;
+ unsigned int bytes;
ARGCHK(mp != NULL && str != NULL && !SIGN(mp), MP_BADARG);
@@ -4810,7 +4808,7 @@
mp_to_signed_octets(const mp_int *mp, unsigned char *str, mp_size maxlen)
{
int ix, pos = 0;
- int bytes;
+ unsigned int bytes;
ARGCHK(mp != NULL && str != NULL && !SIGN(mp), MP_BADARG);
@@ -4850,7 +4848,7 @@
mp_to_fixlen_octets(const mp_int *mp, unsigned char *str, mp_size length)
{
int ix, pos = 0;
- int bytes;
+ unsigned int bytes;
ARGCHK(mp != NULL && str != NULL && !SIGN(mp), MP_BADARG);
--- a/jdk/src/share/native/sun/security/ec/impl/mpi.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/mpi.h Fri Feb 04 00:33:30 2011 +0000
@@ -60,8 +60,6 @@
#ifndef _MPI_H
#define _MPI_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/* $Id: mpi.h,v 1.22 2004/04/27 23:04:36 gerv%gerv.net Exp $ */
#include "mpi-config.h"
--- a/jdk/src/share/native/sun/security/ec/impl/mplogic.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/mplogic.c Fri Feb 04 00:33:30 2011 +0000
@@ -56,8 +56,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/* $Id: mplogic.c,v 1.15 2004/04/27 23:04:36 gerv%gerv.net Exp $ */
#include "mpi-priv.h"
--- a/jdk/src/share/native/sun/security/ec/impl/mplogic.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/mplogic.h Fri Feb 04 00:33:30 2011 +0000
@@ -59,8 +59,6 @@
#ifndef _MPLOGIC_H
#define _MPLOGIC_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/* $Id: mplogic.h,v 1.7 2004/04/27 23:04:36 gerv%gerv.net Exp $ */
#include "mpi.h"
--- a/jdk/src/share/native/sun/security/ec/impl/mpmontg.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/mpmontg.c Fri Feb 04 00:33:30 2011 +0000
@@ -56,8 +56,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/* $Id: mpmontg.c,v 1.20 2006/08/29 02:41:38 nelson%bolyard.com Exp $ */
/* This file implements moduluar exponentiation using Montgomery's
--- a/jdk/src/share/native/sun/security/ec/impl/mpprime.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/mpprime.h Fri Feb 04 00:33:30 2011 +0000
@@ -60,8 +60,6 @@
#ifndef _MP_PRIME_H
#define _MP_PRIME_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "mpi.h"
extern const int prime_tab_size; /* number of primes available */
--- a/jdk/src/share/native/sun/security/ec/impl/oid.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/oid.c Fri Feb 04 00:33:30 2011 +0000
@@ -50,12 +50,10 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#ifndef _WIN32
@@ -433,8 +431,7 @@
SECOID_FindOID(const SECItem *oid)
{
SECOidData *po;
- SECOidData *ret;
- int i;
+ SECOidData *ret = NULL;
if (oid->len == 8) {
if (oid->data[6] == 0x00) {
@@ -454,8 +451,6 @@
po = &SECG_oids[oid->data[4]];
if (memcmp(oid->data, po->oid.data, 5) == 0)
ret = po;
- } else {
- ret = NULL;
}
return(ret);
}
--- a/jdk/src/share/native/sun/security/ec/impl/secitem.c Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/secitem.c Fri Feb 04 00:33:30 2011 +0000
@@ -53,8 +53,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Support routines for SECItem data structure.
*
--- a/jdk/src/share/native/sun/security/ec/impl/secoidt.h Tue Feb 01 14:20:01 2011 -0800
+++ b/jdk/src/share/native/sun/security/ec/impl/secoidt.h Fri Feb 04 00:33:30 2011 +0000
@@ -57,8 +57,6 @@
#ifndef _SECOIDT_H_
#define _SECOIDT_H_
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* secoidt.h - public data structures for ASN.1 OID functions
*