提交 4a0840e1 编写于 作者: V vinnie

6989705: ECC security code native code compiler warnings

Reviewed-by: alanb, ohair
上级 e3b58020
...@@ -38,7 +38,7 @@ extern "C" { ...@@ -38,7 +38,7 @@ extern "C" {
/* /*
* Throws an arbitrary Java exception. * Throws an arbitrary Java exception.
*/ */
void ThrowException(JNIEnv *env, char *exceptionName) void ThrowException(JNIEnv *env, const char *exceptionName)
{ {
jclass exceptionClazz = env->FindClass(exceptionName); jclass exceptionClazz = env->FindClass(exceptionName);
env->ThrowNew(exceptionClazz, NULL); env->ThrowNew(exceptionClazz, NULL);
...@@ -89,7 +89,7 @@ JNICALL Java_sun_security_ec_ECKeyPairGenerator_generateECKeyPair ...@@ -89,7 +89,7 @@ JNICALL Java_sun_security_ec_ECKeyPairGenerator_generateECKeyPair
// Fill a new ECParams using the supplied OID // Fill a new ECParams using the supplied OID
if (EC_DecodeParams(&params_item, &ecparams, 0) != SECSuccess) { if (EC_DecodeParams(&params_item, &ecparams, 0) != SECSuccess) {
/* bad curve OID */ /* bad curve OID */
ThrowException(env, (char *) INVALID_ALGORITHM_PARAMETER_EXCEPTION); ThrowException(env, INVALID_ALGORITHM_PARAMETER_EXCEPTION);
goto cleanup; goto cleanup;
} }
...@@ -101,7 +101,7 @@ JNICALL Java_sun_security_ec_ECKeyPairGenerator_generateECKeyPair ...@@ -101,7 +101,7 @@ JNICALL Java_sun_security_ec_ECKeyPairGenerator_generateECKeyPair
// Generate the new keypair (using the supplied seed) // Generate the new keypair (using the supplied seed)
if (EC_NewKey(ecparams, &privKey, (unsigned char *) pSeedBuffer, if (EC_NewKey(ecparams, &privKey, (unsigned char *) pSeedBuffer,
jSeedLength, 0) != SECSuccess) { jSeedLength, 0) != SECSuccess) {
ThrowException(env, (char *) KEY_EXCEPTION); ThrowException(env, KEY_EXCEPTION);
goto cleanup; goto cleanup;
} }
......
...@@ -51,12 +51,10 @@ ...@@ -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. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "mplogic.h" #include "mplogic.h"
#include "ec.h" #include "ec.h"
#include "ecl.h" #include "ecl.h"
...@@ -67,6 +65,7 @@ ...@@ -67,6 +65,7 @@
#include <string.h> #include <string.h>
#ifndef _WIN32 #ifndef _WIN32
#include <stdio.h>
#include <strings.h> #include <strings.h>
#endif /* _WIN32 */ #endif /* _WIN32 */
...@@ -116,7 +115,7 @@ ec_points_mul(const ECParams *params, const mp_int *k1, const mp_int *k2, ...@@ -116,7 +115,7 @@ ec_points_mul(const ECParams *params, const mp_int *k1, const mp_int *k2,
ECGroup *group = NULL; ECGroup *group = NULL;
SECStatus rv = SECFailure; SECStatus rv = SECFailure;
mp_err err = MP_OKAY; mp_err err = MP_OKAY;
int len; unsigned int len;
#if EC_DEBUG #if EC_DEBUG
int i; int i;
...@@ -278,10 +277,6 @@ ec_NewKey(ECParams *ecParams, ECPrivateKey **privKey, ...@@ -278,10 +277,6 @@ ec_NewKey(ECParams *ecParams, ECPrivateKey **privKey,
printf("ec_NewKey called\n"); printf("ec_NewKey called\n");
#endif #endif
#ifndef _WIN32
int printf();
#endif /* _WIN32 */
if (!ecParams || !privKey || !privKeyBytes || (privKeyLen < 0)) { if (!ecParams || !privKey || !privKeyBytes || (privKeyLen < 0)) {
PORT_SetError(SEC_ERROR_INVALID_ARGS); PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure; return SECFailure;
...@@ -361,8 +356,9 @@ int printf(); ...@@ -361,8 +356,9 @@ int printf();
cleanup: cleanup:
mp_clear(&k); mp_clear(&k);
if (rv) if (rv) {
PORT_FreeArena(arena, PR_TRUE); PORT_FreeArena(arena, PR_TRUE);
}
#if EC_DEBUG #if EC_DEBUG
printf("ec_NewKey returning %s\n", printf("ec_NewKey returning %s\n",
...@@ -504,7 +500,7 @@ EC_ValidatePublicKey(ECParams *ecParams, SECItem *publicValue, int kmflag) ...@@ -504,7 +500,7 @@ EC_ValidatePublicKey(ECParams *ecParams, SECItem *publicValue, int kmflag)
ECGroup *group = NULL; ECGroup *group = NULL;
SECStatus rv = SECFailure; SECStatus rv = SECFailure;
mp_err err = MP_OKAY; mp_err err = MP_OKAY;
int len; unsigned int len;
if (!ecParams || !publicValue) { if (!ecParams || !publicValue) {
PORT_SetError(SEC_ERROR_INVALID_ARGS); PORT_SetError(SEC_ERROR_INVALID_ARGS);
...@@ -778,7 +774,7 @@ ECDSA_SignDigestWithSeed(ECPrivateKey *key, SECItem *signature, ...@@ -778,7 +774,7 @@ ECDSA_SignDigestWithSeed(ECPrivateKey *key, SECItem *signature,
/* In the definition of EC signing, digests are truncated /* In the definition of EC signing, digests are truncated
* to the length of n in bits. * to the length of n in bits.
* (see SEC 1 "Elliptic Curve Digit Signature Algorithm" section 4.1.*/ * (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); mpl_rsh(&s,&s,digest->len*8 - ecParams->fieldID.size);
} }
...@@ -993,7 +989,8 @@ ECDSA_VerifyDigest(ECPublicKey *key, const SECItem *signature, ...@@ -993,7 +989,8 @@ ECDSA_VerifyDigest(ECPublicKey *key, const SECItem *signature,
/* In the definition of EC signing, digests are truncated /* In the definition of EC signing, digests are truncated
* to the length of n in bits. * to the length of n in bits.
* (see SEC 1 "Elliptic Curve Digit Signature Algorithm" section 4.1.*/ * (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); mpl_rsh(&u1,&u1,digest->len*8- ecParams->fieldID.size);
} }
......
...@@ -57,8 +57,6 @@ ...@@ -57,8 +57,6 @@
#ifndef __ec_h_ #ifndef __ec_h_
#define __ec_h_ #define __ec_h_
#pragma ident "%Z%%M% %I% %E% SMI"
#define EC_DEBUG 0 #define EC_DEBUG 0
#define EC_POINT_FORM_COMPRESSED_Y0 0x02 #define EC_POINT_FORM_COMPRESSED_Y0 0x02
#define EC_POINT_FORM_COMPRESSED_Y1 0x03 #define EC_POINT_FORM_COMPRESSED_Y1 0x03
......
...@@ -57,8 +57,6 @@ ...@@ -57,8 +57,6 @@
#ifndef _EC2_H #ifndef _EC2_H
#define _EC2_H #define _EC2_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ecl-priv.h" #include "ecl-priv.h"
/* Checks if point P(px, py) is at infinity. Uses affine coordinates. */ /* Checks if point P(px, py) is at infinity. Uses affine coordinates. */
......
...@@ -56,8 +56,6 @@ ...@@ -56,8 +56,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ec2.h" #include "ec2.h"
#include "mp_gf2m.h" #include "mp_gf2m.h"
#include "mp_gf2m-priv.h" #include "mp_gf2m-priv.h"
......
...@@ -56,8 +56,6 @@ ...@@ -56,8 +56,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ec2.h" #include "ec2.h"
#include "mp_gf2m.h" #include "mp_gf2m.h"
#include "mp_gf2m-priv.h" #include "mp_gf2m-priv.h"
......
...@@ -56,8 +56,6 @@ ...@@ -56,8 +56,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ec2.h" #include "ec2.h"
#include "mp_gf2m.h" #include "mp_gf2m.h"
#include "mp_gf2m-priv.h" #include "mp_gf2m-priv.h"
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ec2.h" #include "ec2.h"
#include "mplogic.h" #include "mplogic.h"
#include "mp_gf2m.h" #include "mp_gf2m.h"
......
...@@ -56,8 +56,6 @@ ...@@ -56,8 +56,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ec2.h" #include "ec2.h"
#include "mplogic.h" #include "mplogic.h"
#include "mp_gf2m.h" #include "mp_gf2m.h"
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ecl-priv.h" #include "ecl-priv.h"
/* Returns 2^e as an integer. This is meant to be used for small powers of /* Returns 2^e as an integer. This is meant to be used for small powers of
......
...@@ -51,15 +51,13 @@ ...@@ -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. * Use is subject to license terms.
*/ */
#ifndef _ECC_IMPL_H #ifndef _ECC_IMPL_H
#define _ECC_IMPL_H #define _ECC_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
...@@ -82,6 +80,7 @@ typedef enum { B_FALSE, B_TRUE } boolean_t; ...@@ -82,6 +80,7 @@ typedef enum { B_FALSE, B_TRUE } boolean_t;
typedef unsigned char uint8_t; typedef unsigned char uint8_t;
typedef unsigned long ulong_t; typedef unsigned long ulong_t;
typedef enum boolean { B_FALSE, B_TRUE } boolean_t; typedef enum boolean { B_FALSE, B_TRUE } boolean_t;
#define strdup _strdup /* Replace POSIX name with ISO C++ name */
#endif /* _WIN32 */ #endif /* _WIN32 */
#ifndef _KERNEL #ifndef _KERNEL
......
...@@ -55,8 +55,6 @@ ...@@ -55,8 +55,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h> #include <sys/types.h>
#ifndef _WIN32 #ifndef _WIN32
...@@ -90,7 +88,7 @@ hexString2SECItem(PRArenaPool *arena, SECItem *item, const char *str, ...@@ -90,7 +88,7 @@ hexString2SECItem(PRArenaPool *arena, SECItem *item, const char *str,
{ {
int i = 0; int i = 0;
int byteval = 0; int byteval = 0;
int tmp = strlen(str); int tmp = (int)strlen(str);
if ((tmp % 2) != 0) return NULL; if ((tmp % 2) != 0) return NULL;
...@@ -134,7 +132,8 @@ gf_populate_params(ECCurveName name, ECFieldType field_type, ECParams *params, ...@@ -134,7 +132,8 @@ gf_populate_params(ECCurveName name, ECFieldType field_type, ECParams *params,
/* 2 ['0'+'4'] + MAX_ECKEY_LEN * 2 [x,y] * 2 [hex string] + 1 ['\0'] */ /* 2 ['0'+'4'] + MAX_ECKEY_LEN * 2 [x,y] * 2 [hex string] + 1 ['\0'] */
char genenc[3 + 2 * 2 * MAX_ECKEY_LEN]; 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; params->name = name;
curveParams = ecCurve_map[params->name]; curveParams = ecCurve_map[params->name];
CHECK_OK(curveParams); CHECK_OK(curveParams);
......
...@@ -57,8 +57,6 @@ ...@@ -57,8 +57,6 @@
#ifndef _ECL_CURVE_H #ifndef _ECL_CURVE_H
#define _ECL_CURVE_H #define _ECL_CURVE_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ecl-exp.h" #include "ecl-exp.h"
#ifndef _KERNEL #ifndef _KERNEL
#include <stdlib.h> #include <stdlib.h>
......
...@@ -57,8 +57,6 @@ ...@@ -57,8 +57,6 @@
#ifndef _ECL_EXP_H #ifndef _ECL_EXP_H
#define _ECL_EXP_H #define _ECL_EXP_H
#pragma ident "%Z%%M% %I% %E% SMI"
/* Curve field type */ /* Curve field type */
typedef enum { typedef enum {
ECField_GFp, ECField_GFp,
......
...@@ -58,8 +58,6 @@ ...@@ -58,8 +58,6 @@
#ifndef _ECL_PRIV_H #ifndef _ECL_PRIV_H
#define _ECL_PRIV_H #define _ECL_PRIV_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ecl.h" #include "ecl.h"
#include "mpi.h" #include "mpi.h"
#include "mplogic.h" #include "mplogic.h"
...@@ -90,6 +88,10 @@ ...@@ -90,6 +88,10 @@
s = ACCUM(w); \ s = ACCUM(w); \
cout = CARRYOUT(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) \ #define MP_SUB_BORROW(a1, a2, s, bin, bout) \
{ mp_word w; \ { mp_word w; \
w = ((mp_word)(a1)) - (a2) - (bin); \ w = ((mp_word)(a1)) - (a2) - (bin); \
...@@ -111,6 +113,15 @@ ...@@ -111,6 +113,15 @@
s = sum += (cin); \ s = sum += (cin); \
cout = tmp + (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) \ #define MP_SUB_BORROW(a1, a2, s, bin, bout) \
{ mp_digit tmp; \ { mp_digit tmp; \
tmp = (a1); \ tmp = (a1); \
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "mpi.h" #include "mpi.h"
#include "mplogic.h" #include "mplogic.h"
#include "ecl.h" #include "ecl.h"
......
...@@ -57,8 +57,6 @@ ...@@ -57,8 +57,6 @@
#ifndef _ECL_H #ifndef _ECL_H
#define _ECL_H #define _ECL_H
#pragma ident "%Z%%M% %I% %E% SMI"
/* Although this is not an exported header file, code which uses elliptic /* Although this is not an exported header file, code which uses elliptic
* curve point operations will need to include it. */ * curve point operations will need to include it. */
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ecl.h" #include "ecl.h"
#include "ecl-curve.h" #include "ecl-curve.h"
#include "ecl-priv.h" #include "ecl-priv.h"
......
...@@ -55,8 +55,6 @@ ...@@ -55,8 +55,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "mpi.h" #include "mpi.h"
#include "mp_gf2m.h" #include "mp_gf2m.h"
#include "ecl-priv.h" #include "ecl-priv.h"
...@@ -307,7 +305,7 @@ ec_GFp_add_3(const mp_int *a, const mp_int *b, mp_int *r, ...@@ -307,7 +305,7 @@ ec_GFp_add_3(const mp_int *a, const mp_int *b, mp_int *r,
} }
#ifndef MPI_AMD64_ADD #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(a1, r1, r1, carry, carry);
MP_ADD_CARRY(a2, r2, r2, carry, carry); MP_ADD_CARRY(a2, r2, r2, carry, carry);
#else #else
...@@ -394,7 +392,7 @@ ec_GFp_add_4(const mp_int *a, const mp_int *b, mp_int *r, ...@@ -394,7 +392,7 @@ ec_GFp_add_4(const mp_int *a, const mp_int *b, mp_int *r,
} }
#ifndef MPI_AMD64_ADD #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(a1, r1, r1, carry, carry);
MP_ADD_CARRY(a2, r2, r2, carry, carry); MP_ADD_CARRY(a2, r2, r2, carry, carry);
MP_ADD_CARRY(a3, r3, r3, carry, carry); MP_ADD_CARRY(a3, r3, r3, carry, carry);
...@@ -491,7 +489,7 @@ ec_GFp_add_5(const mp_int *a, const mp_int *b, mp_int *r, ...@@ -491,7 +489,7 @@ ec_GFp_add_5(const mp_int *a, const mp_int *b, mp_int *r,
r0 = MP_DIGIT(b,0); 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(a1, r1, r1, carry, carry);
MP_ADD_CARRY(a2, r2, r2, carry, carry); MP_ADD_CARRY(a2, r2, r2, carry, carry);
MP_ADD_CARRY(a3, r3, r3, carry, carry); MP_ADD_CARRY(a3, r3, r3, carry, carry);
...@@ -572,7 +570,7 @@ ec_GFp_add_6(const mp_int *a, const mp_int *b, mp_int *r, ...@@ -572,7 +570,7 @@ ec_GFp_add_6(const mp_int *a, const mp_int *b, mp_int *r,
r0 = MP_DIGIT(b,0); 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(a1, r1, r1, carry, carry);
MP_ADD_CARRY(a2, r2, r2, carry, carry); MP_ADD_CARRY(a2, r2, r2, carry, carry);
MP_ADD_CARRY(a3, r3, r3, carry, carry); MP_ADD_CARRY(a3, r3, r3, carry, carry);
...@@ -675,7 +673,7 @@ ec_GFp_sub_3(const mp_int *a, const mp_int *b, mp_int *r, ...@@ -675,7 +673,7 @@ ec_GFp_sub_3(const mp_int *a, const mp_int *b, mp_int *r,
b1 = MP_DIGIT(&meth->irr,1); b1 = MP_DIGIT(&meth->irr,1);
b0 = MP_DIGIT(&meth->irr,0); b0 = MP_DIGIT(&meth->irr,0);
#ifndef MPI_AMD64_ADD #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(b1, r1, r1, borrow, borrow);
MP_ADD_CARRY(b2, r2, r2, borrow, borrow); MP_ADD_CARRY(b2, r2, r2, borrow, borrow);
#else #else
...@@ -766,7 +764,7 @@ ec_GFp_sub_4(const mp_int *a, const mp_int *b, mp_int *r, ...@@ -766,7 +764,7 @@ ec_GFp_sub_4(const mp_int *a, const mp_int *b, mp_int *r,
b1 = MP_DIGIT(&meth->irr,1); b1 = MP_DIGIT(&meth->irr,1);
b0 = MP_DIGIT(&meth->irr,0); b0 = MP_DIGIT(&meth->irr,0);
#ifndef MPI_AMD64_ADD #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(b1, r1, r1, borrow, borrow);
MP_ADD_CARRY(b2, r2, r2, borrow, borrow); MP_ADD_CARRY(b2, r2, r2, borrow, borrow);
MP_ADD_CARRY(b3, r3, r3, borrow, borrow); MP_ADD_CARRY(b3, r3, r3, borrow, borrow);
...@@ -850,7 +848,7 @@ ec_GFp_sub_5(const mp_int *a, const mp_int *b, mp_int *r, ...@@ -850,7 +848,7 @@ ec_GFp_sub_5(const mp_int *a, const mp_int *b, mp_int *r,
b2 = MP_DIGIT(&meth->irr,2); b2 = MP_DIGIT(&meth->irr,2);
b1 = MP_DIGIT(&meth->irr,1); b1 = MP_DIGIT(&meth->irr,1);
b0 = MP_DIGIT(&meth->irr,0); 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(b1, r1, r1, borrow, borrow);
MP_ADD_CARRY(b2, r2, r2, borrow, borrow); MP_ADD_CARRY(b2, r2, r2, borrow, borrow);
MP_ADD_CARRY(b3, r3, r3, borrow, borrow); MP_ADD_CARRY(b3, r3, r3, borrow, borrow);
...@@ -924,7 +922,7 @@ ec_GFp_sub_6(const mp_int *a, const mp_int *b, mp_int *r, ...@@ -924,7 +922,7 @@ ec_GFp_sub_6(const mp_int *a, const mp_int *b, mp_int *r,
b2 = MP_DIGIT(&meth->irr,2); b2 = MP_DIGIT(&meth->irr,2);
b1 = MP_DIGIT(&meth->irr,1); b1 = MP_DIGIT(&meth->irr,1);
b0 = MP_DIGIT(&meth->irr,0); 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(b1, r1, r1, borrow, borrow);
MP_ADD_CARRY(b2, r2, r2, borrow, borrow); MP_ADD_CARRY(b2, r2, r2, borrow, borrow);
MP_ADD_CARRY(b3, r3, r3, borrow, borrow); MP_ADD_CARRY(b3, r3, r3, borrow, borrow);
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "mpi.h" #include "mpi.h"
#include "mplogic.h" #include "mplogic.h"
#include "ecl.h" #include "ecl.h"
......
...@@ -57,8 +57,6 @@ ...@@ -57,8 +57,6 @@
#ifndef _ECP_H #ifndef _ECP_H
#define _ECP_H #define _ECP_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ecl-priv.h" #include "ecl-priv.h"
/* Checks if point P(px, py) is at infinity. Uses affine coordinates. */ /* Checks if point P(px, py) is at infinity. Uses affine coordinates. */
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ecp.h" #include "ecp.h"
#include "mpi.h" #include "mpi.h"
#include "mplogic.h" #include "mplogic.h"
...@@ -210,15 +208,15 @@ ec_GFp_nistp192_mod(const mp_int *a, mp_int *r, const GFMethod *meth) ...@@ -210,15 +208,15 @@ ec_GFp_nistp192_mod(const mp_int *a, mp_int *r, const GFMethod *meth)
/* implement r = (a2,a1,a0)+(a5,a5,a5)+(a4,a4,0)+(0,a3,a3) */ /* implement r = (a2,a1,a0)+(a5,a5,a5)+(a4,a4,0)+(0,a3,a3) */
#ifndef MPI_AMD64_ADD #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(r1, a3, r1, carry, carry);
MP_ADD_CARRY(r2, a4, r2, carry, carry); MP_ADD_CARRY(r2, a4, r2, carry, carry);
r3 = 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(r1, a5, r1, carry, carry);
MP_ADD_CARRY(r2, a5, r2, carry, carry); MP_ADD_CARRY(r2, a5, r2, carry, carry);
r3 += 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); MP_ADD_CARRY(r2, 0, r2, carry, carry);
r3 += carry; r3 += carry;
...@@ -251,7 +249,7 @@ ec_GFp_nistp192_mod(const mp_int *a, mp_int *r, const GFMethod *meth) ...@@ -251,7 +249,7 @@ ec_GFp_nistp192_mod(const mp_int *a, mp_int *r, const GFMethod *meth)
/* reduce out the carry */ /* reduce out the carry */
while (r3) { while (r3) {
#ifndef MPI_AMD64_ADD #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(r1, r3, r1, carry, carry);
MP_ADD_CARRY(r2, 0, r2, carry, carry); MP_ADD_CARRY(r2, 0, r2, carry, carry);
r3 = carry; r3 = carry;
...@@ -335,7 +333,7 @@ ec_GFp_nistp192_add(const mp_int *a, const mp_int *b, mp_int *r, ...@@ -335,7 +333,7 @@ ec_GFp_nistp192_add(const mp_int *a, const mp_int *b, mp_int *r,
} }
#ifndef MPI_AMD64_ADD #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(a1, r1, r1, carry, carry);
MP_ADD_CARRY(a2, r2, r2, carry, carry); MP_ADD_CARRY(a2, r2, r2, carry, carry);
#else #else
...@@ -357,7 +355,7 @@ ec_GFp_nistp192_add(const mp_int *a, const mp_int *b, mp_int *r, ...@@ -357,7 +355,7 @@ ec_GFp_nistp192_add(const mp_int *a, const mp_int *b, mp_int *r,
((r1 == MP_DIGIT_MAX) || ((r1 == MP_DIGIT_MAX) ||
((r1 == (MP_DIGIT_MAX-1)) && (r0 == MP_DIGIT_MAX))))) { ((r1 == (MP_DIGIT_MAX-1)) && (r0 == MP_DIGIT_MAX))))) {
#ifndef MPI_AMD64_ADD #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(r1, 1, r1, carry, carry);
MP_ADD_CARRY(r2, 0, r2, carry, carry); MP_ADD_CARRY(r2, 0, r2, carry, carry);
#else #else
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ecp.h" #include "ecp.h"
#include "mpi.h" #include "mpi.h"
#include "mplogic.h" #include "mplogic.h"
...@@ -251,10 +249,10 @@ ec_GFp_nistp224_mod(const mp_int *a, mp_int *r, const GFMethod *meth) ...@@ -251,10 +249,10 @@ ec_GFp_nistp224_mod(const mp_int *a, mp_int *r, const GFMethod *meth)
+( 0, a6,a5b, 0) +( 0, a6,a5b, 0)
-( 0 0, 0|a6b, a6a|a5b ) -( 0 0, 0|a6b, a6a|a5b )
-( a6b, a6a|a5b, a5a|a4b, a4a|a3b ) */ -( 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 (r2, a4 , r2, carry, carry);
MP_ADD_CARRY (r3, a5a, r3, 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 (r2, a6 , r2, carry, carry);
MP_ADD_CARRY (r3, 0, r3, carry, carry); MP_ADD_CARRY (r3, 0, r3, carry, carry);
...@@ -275,7 +273,7 @@ ec_GFp_nistp224_mod(const mp_int *a, mp_int *r, const GFMethod *meth) ...@@ -275,7 +273,7 @@ ec_GFp_nistp224_mod(const mp_int *a, mp_int *r, const GFMethod *meth)
r3b = (int)(r3 >>32); r3b = (int)(r3 >>32);
while (r3b > 0) { while (r3b > 0) {
r3 &= 0xffffffff; 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) { if (carry) {
MP_ADD_CARRY(r2, 0, r2, carry, carry); MP_ADD_CARRY(r2, 0, r2, carry, carry);
MP_ADD_CARRY(r3, 0, r3, carry, carry); MP_ADD_CARRY(r3, 0, r3, carry, carry);
...@@ -290,7 +288,7 @@ ec_GFp_nistp224_mod(const mp_int *a, mp_int *r, const GFMethod *meth) ...@@ -290,7 +288,7 @@ ec_GFp_nistp224_mod(const mp_int *a, mp_int *r, const GFMethod *meth)
} }
while (r3b < 0) { 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 (r1, MP_DIGIT_MAX <<32, r1, carry, carry);
MP_ADD_CARRY (r2, MP_DIGIT_MAX, r2, carry, carry); MP_ADD_CARRY (r2, MP_DIGIT_MAX, r2, carry, carry);
MP_ADD_CARRY (r3, MP_DIGIT_MAX >> 32, r3, carry, carry); MP_ADD_CARRY (r3, MP_DIGIT_MAX >> 32, r3, carry, carry);
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ecp.h" #include "ecp.h"
#include "mpi.h" #include "mpi.h"
#include "mplogic.h" #include "mplogic.h"
...@@ -303,32 +301,32 @@ ec_GFp_nistp256_mod(const mp_int *a, mp_int *r, const GFMethod *meth) ...@@ -303,32 +301,32 @@ ec_GFp_nistp256_mod(const mp_int *a, mp_int *r, const GFMethod *meth)
r0 = MP_DIGIT(a,0); r0 = MP_DIGIT(a,0);
/* sum 1 */ /* 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(r2, a6, r2, carry, carry);
MP_ADD_CARRY(r3, a7, r3, carry, carry); MP_ADD_CARRY(r3, a7, r3, carry, carry);
r4 = 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(r2, a6, r2, carry, carry);
MP_ADD_CARRY(r3, a7, r3, carry, carry); MP_ADD_CARRY(r3, a7, r3, carry, carry);
r4 += carry; r4 += carry;
/* sum 2 */ /* 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(r2, a6h | a7l, r2, carry, carry);
MP_ADD_CARRY(r3, a7h, r3, carry, carry); MP_ADD_CARRY(r3, a7h, r3, carry, carry);
r4 += 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(r2, a6h | a7l, r2, carry, carry);
MP_ADD_CARRY(r3, a7h, r3, carry, carry); MP_ADD_CARRY(r3, a7h, r3, carry, carry);
r4 += carry; r4 += carry;
/* sum 3 */ /* 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(r1, a5l >> 32, r1, carry, carry);
MP_ADD_CARRY(r2, 0, r2, carry, carry); MP_ADD_CARRY(r2, 0, r2, carry, carry);
MP_ADD_CARRY(r3, a7, r3, carry, carry); MP_ADD_CARRY(r3, a7, r3, carry, carry);
r4 += carry; r4 += carry;
/* sum 4 */ /* 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(r1, a5h|(a6h<<32), r1, carry, carry);
MP_ADD_CARRY(r2, a7, r2, carry, carry); MP_ADD_CARRY(r2, a7, r2, carry, carry);
MP_ADD_CARRY(r3, a6h | a4l, r3, carry, carry); MP_ADD_CARRY(r3, a6h | a4l, r3, carry, carry);
...@@ -362,7 +360,7 @@ ec_GFp_nistp256_mod(const mp_int *a, mp_int *r, const GFMethod *meth) ...@@ -362,7 +360,7 @@ ec_GFp_nistp256_mod(const mp_int *a, mp_int *r, const GFMethod *meth)
while (r4 > 0) { while (r4 > 0) {
mp_digit r4_long = r4; mp_digit r4_long = r4;
mp_digit r4l = (r4_long << 32); 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(r1, -r4l, r1, carry, carry);
MP_ADD_CARRY(r2, MP_DIGIT_MAX, r2, carry, carry); MP_ADD_CARRY(r2, MP_DIGIT_MAX, r2, carry, carry);
MP_ADD_CARRY(r3, r4l-r4_long-1,r3, carry, carry); MP_ADD_CARRY(r3, r4l-r4_long-1,r3, carry, carry);
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ecp.h" #include "ecp.h"
#include "mpi.h" #include "mpi.h"
#include "mplogic.h" #include "mplogic.h"
......
...@@ -50,12 +50,10 @@ ...@@ -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. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ecp.h" #include "ecp.h"
#include "mpi.h" #include "mpi.h"
#include "mplogic.h" #include "mplogic.h"
...@@ -74,7 +72,7 @@ ec_GFp_nistp521_mod(const mp_int *a, mp_int *r, const GFMethod *meth) ...@@ -74,7 +72,7 @@ ec_GFp_nistp521_mod(const mp_int *a, mp_int *r, const GFMethod *meth)
{ {
mp_err res = MP_OKAY; mp_err res = MP_OKAY;
int a_bits = mpl_significant_bits(a); 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 */ /* m1, m2 are statically-allocated mp_int of exactly the size we need */
mp_int m1; mp_int m1;
......
...@@ -59,8 +59,6 @@ ...@@ -59,8 +59,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ecp.h" #include "ecp.h"
#include "mplogic.h" #include "mplogic.h"
#ifndef _KERNEL #ifndef _KERNEL
......
...@@ -59,8 +59,6 @@ ...@@ -59,8 +59,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ecp.h" #include "ecp.h"
#include "mplogic.h" #include "mplogic.h"
#ifndef _KERNEL #ifndef _KERNEL
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ecp.h" #include "ecp.h"
#include "ecl-priv.h" #include "ecl-priv.h"
#include "mplogic.h" #include "mplogic.h"
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
/* Uses Montgomery reduction for field arithmetic. See mpi/mpmontg.c for /* Uses Montgomery reduction for field arithmetic. See mpi/mpmontg.c for
* code implementation. */ * code implementation. */
......
...@@ -57,8 +57,6 @@ ...@@ -57,8 +57,6 @@
#ifndef _LOGTAB_H #ifndef _LOGTAB_H
#define _LOGTAB_H #define _LOGTAB_H
#pragma ident "%Z%%M% %I% %E% SMI"
const float s_logv_2[] = { const float s_logv_2[] = {
0.000000000f, 0.000000000f, 1.000000000f, 0.630929754f, /* 0 1 2 3 */ 0.000000000f, 0.000000000f, 1.000000000f, 0.630929754f, /* 0 1 2 3 */
0.500000000f, 0.430676558f, 0.386852807f, 0.356207187f, /* 4 5 6 7 */ 0.500000000f, 0.430676558f, 0.386852807f, 0.356207187f, /* 4 5 6 7 */
......
...@@ -58,8 +58,6 @@ ...@@ -58,8 +58,6 @@
#ifndef _MP_GF2M_PRIV_H_ #ifndef _MP_GF2M_PRIV_H_
#define _MP_GF2M_PRIV_H_ #define _MP_GF2M_PRIV_H_
#pragma ident "%Z%%M% %I% %E% SMI"
#include "mpi-priv.h" #include "mpi-priv.h"
extern const mp_digit mp_gf2m_sqr_tb[16]; extern const mp_digit mp_gf2m_sqr_tb[16];
......
...@@ -55,8 +55,6 @@ ...@@ -55,8 +55,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "mp_gf2m.h" #include "mp_gf2m.h"
#include "mp_gf2m-priv.h" #include "mp_gf2m-priv.h"
#include "mplogic.h" #include "mplogic.h"
......
...@@ -58,8 +58,6 @@ ...@@ -58,8 +58,6 @@
#ifndef _MP_GF2M_H_ #ifndef _MP_GF2M_H_
#define _MP_GF2M_H_ #define _MP_GF2M_H_
#pragma ident "%Z%%M% %I% %E% SMI"
#include "mpi.h" #include "mpi.h"
mp_err mp_badd(const mp_int *a, const mp_int *b, mp_int *c); mp_err mp_badd(const mp_int *a, const mp_int *b, mp_int *c);
......
...@@ -57,8 +57,6 @@ ...@@ -57,8 +57,6 @@
#ifndef _MPI_CONFIG_H #ifndef _MPI_CONFIG_H
#define _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 $ */ /* $Id: mpi-config.h,v 1.5 2004/04/25 15:03:10 gerv%gerv.net Exp $ */
/* /*
......
...@@ -63,8 +63,6 @@ ...@@ -63,8 +63,6 @@
#ifndef _MPI_PRIV_H #ifndef _MPI_PRIV_H
#define _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 $ */ /* $Id: mpi-priv.h,v 1.20 2005/11/22 07:16:43 relyea%netscape.com Exp $ */
#include "mpi.h" #include "mpi.h"
......
...@@ -54,12 +54,10 @@ ...@@ -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. * 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 $ */ /* $Id: mpi.c,v 1.45 2006/09/29 20:12:21 alexei.volkov.bugs%sun.com Exp $ */
#include "mpi-priv.h" #include "mpi-priv.h"
...@@ -1148,7 +1146,7 @@ mp_err mp_expt(mp_int *a, mp_int *b, mp_int *c) ...@@ -1148,7 +1146,7 @@ mp_err mp_expt(mp_int *a, mp_int *b, mp_int *c)
mp_int s, x; mp_int s, x;
mp_err res; mp_err res;
mp_digit d; mp_digit d;
int dig, bit; unsigned int dig, bit;
ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG);
...@@ -1523,7 +1521,7 @@ mp_err s_mp_exptmod(const mp_int *a, const mp_int *b, const mp_int *m, mp_int *c ...@@ -1523,7 +1521,7 @@ mp_err s_mp_exptmod(const mp_int *a, const mp_int *b, const mp_int *m, mp_int *c
mp_int s, x, mu; mp_int s, x, mu;
mp_err res; mp_err res;
mp_digit d; mp_digit d;
int dig, bit; unsigned int dig, bit;
ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG);
...@@ -2057,7 +2055,7 @@ mp_size mp_trailing_zeros(const mp_int *mp) ...@@ -2057,7 +2055,7 @@ mp_size mp_trailing_zeros(const mp_int *mp)
{ {
mp_digit d; mp_digit d;
mp_size n = 0; mp_size n = 0;
int ix; unsigned int ix;
if (!mp || !MP_DIGITS(mp) || !mp_cmp_z(mp)) if (!mp || !MP_DIGITS(mp) || !mp_cmp_z(mp))
return n; return n;
...@@ -2900,9 +2898,9 @@ void s_mp_copy(const mp_digit *sp, mp_digit *dp, mp_size count) ...@@ -2900,9 +2898,9 @@ void s_mp_copy(const mp_digit *sp, mp_digit *dp, mp_size count)
/* Allocate ni records of nb bytes each, and return a pointer to that */ /* 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) void *s_mp_alloc(size_t nb, size_t ni, int kmflag)
{ {
mp_int *mp;
++mp_allocs; ++mp_allocs;
#ifdef _KERNEL #ifdef _KERNEL
mp_int *mp;
mp = kmem_zalloc(nb * ni, kmflag); mp = kmem_zalloc(nb * ni, kmflag);
if (mp != NULL) if (mp != NULL)
FLAG(mp) = kmflag; FLAG(mp) = kmflag;
...@@ -3112,7 +3110,7 @@ void s_mp_div_2(mp_int *mp) ...@@ -3112,7 +3110,7 @@ void s_mp_div_2(mp_int *mp)
mp_err s_mp_mul_2(mp_int *mp) mp_err s_mp_mul_2(mp_int *mp)
{ {
mp_digit *pd; mp_digit *pd;
int ix, used; unsigned int ix, used;
mp_digit kin = 0; mp_digit kin = 0;
/* Shift digits leftward by 1 bit */ /* Shift digits leftward by 1 bit */
...@@ -4663,7 +4661,7 @@ char s_mp_todigit(mp_digit val, int r, int low) ...@@ -4663,7 +4661,7 @@ char s_mp_todigit(mp_digit val, int r, int low)
{ {
char ch; char ch;
if(val >= r) if(val >= (unsigned int)r)
return 0; return 0;
ch = s_dmap_1[val]; ch = s_dmap_1[val];
...@@ -4778,7 +4776,7 @@ mp_err ...@@ -4778,7 +4776,7 @@ mp_err
mp_to_unsigned_octets(const mp_int *mp, unsigned char *str, mp_size maxlen) mp_to_unsigned_octets(const mp_int *mp, unsigned char *str, mp_size maxlen)
{ {
int ix, pos = 0; int ix, pos = 0;
int bytes; unsigned int bytes;
ARGCHK(mp != NULL && str != NULL && !SIGN(mp), MP_BADARG); ARGCHK(mp != NULL && str != NULL && !SIGN(mp), MP_BADARG);
...@@ -4810,7 +4808,7 @@ mp_err ...@@ -4810,7 +4808,7 @@ mp_err
mp_to_signed_octets(const mp_int *mp, unsigned char *str, mp_size maxlen) mp_to_signed_octets(const mp_int *mp, unsigned char *str, mp_size maxlen)
{ {
int ix, pos = 0; int ix, pos = 0;
int bytes; unsigned int bytes;
ARGCHK(mp != NULL && str != NULL && !SIGN(mp), MP_BADARG); ARGCHK(mp != NULL && str != NULL && !SIGN(mp), MP_BADARG);
...@@ -4850,7 +4848,7 @@ mp_err ...@@ -4850,7 +4848,7 @@ mp_err
mp_to_fixlen_octets(const mp_int *mp, unsigned char *str, mp_size length) mp_to_fixlen_octets(const mp_int *mp, unsigned char *str, mp_size length)
{ {
int ix, pos = 0; int ix, pos = 0;
int bytes; unsigned int bytes;
ARGCHK(mp != NULL && str != NULL && !SIGN(mp), MP_BADARG); ARGCHK(mp != NULL && str != NULL && !SIGN(mp), MP_BADARG);
......
...@@ -60,8 +60,6 @@ ...@@ -60,8 +60,6 @@
#ifndef _MPI_H #ifndef _MPI_H
#define _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 $ */ /* $Id: mpi.h,v 1.22 2004/04/27 23:04:36 gerv%gerv.net Exp $ */
#include "mpi-config.h" #include "mpi-config.h"
......
...@@ -56,8 +56,6 @@ ...@@ -56,8 +56,6 @@
* Use is subject to license terms. * 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 $ */ /* $Id: mplogic.c,v 1.15 2004/04/27 23:04:36 gerv%gerv.net Exp $ */
#include "mpi-priv.h" #include "mpi-priv.h"
......
...@@ -59,8 +59,6 @@ ...@@ -59,8 +59,6 @@
#ifndef _MPLOGIC_H #ifndef _MPLOGIC_H
#define _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 $ */ /* $Id: mplogic.h,v 1.7 2004/04/27 23:04:36 gerv%gerv.net Exp $ */
#include "mpi.h" #include "mpi.h"
......
...@@ -56,8 +56,6 @@ ...@@ -56,8 +56,6 @@
* Use is subject to license terms. * 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 $ */ /* $Id: mpmontg.c,v 1.20 2006/08/29 02:41:38 nelson%bolyard.com Exp $ */
/* This file implements moduluar exponentiation using Montgomery's /* This file implements moduluar exponentiation using Montgomery's
......
...@@ -60,8 +60,6 @@ ...@@ -60,8 +60,6 @@
#ifndef _MP_PRIME_H #ifndef _MP_PRIME_H
#define _MP_PRIME_H #define _MP_PRIME_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include "mpi.h" #include "mpi.h"
extern const int prime_tab_size; /* number of primes available */ extern const int prime_tab_size; /* number of primes available */
......
...@@ -50,12 +50,10 @@ ...@@ -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. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h> #include <sys/types.h>
#ifndef _WIN32 #ifndef _WIN32
...@@ -433,8 +431,7 @@ SECOidData * ...@@ -433,8 +431,7 @@ SECOidData *
SECOID_FindOID(const SECItem *oid) SECOID_FindOID(const SECItem *oid)
{ {
SECOidData *po; SECOidData *po;
SECOidData *ret; SECOidData *ret = NULL;
int i;
if (oid->len == 8) { if (oid->len == 8) {
if (oid->data[6] == 0x00) { if (oid->data[6] == 0x00) {
...@@ -454,8 +451,6 @@ SECOID_FindOID(const SECItem *oid) ...@@ -454,8 +451,6 @@ SECOID_FindOID(const SECItem *oid)
po = &SECG_oids[oid->data[4]]; po = &SECG_oids[oid->data[4]];
if (memcmp(oid->data, po->oid.data, 5) == 0) if (memcmp(oid->data, po->oid.data, 5) == 0)
ret = po; ret = po;
} else {
ret = NULL;
} }
return(ret); return(ret);
} }
......
...@@ -53,8 +53,6 @@ ...@@ -53,8 +53,6 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#pragma ident "%Z%%M% %I% %E% SMI"
/* /*
* Support routines for SECItem data structure. * Support routines for SECItem data structure.
* *
......
...@@ -57,8 +57,6 @@ ...@@ -57,8 +57,6 @@
#ifndef _SECOIDT_H_ #ifndef _SECOIDT_H_
#define _SECOIDT_H_ #define _SECOIDT_H_
#pragma ident "%Z%%M% %I% %E% SMI"
/* /*
* secoidt.h - public data structures for ASN.1 OID functions * secoidt.h - public data structures for ASN.1 OID functions
* *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册