Index: nss/lib/softoken/pkcs11c.c |
=================================================================== |
--- nss/lib/softoken/pkcs11c.c (revision 256695) |
+++ nss/lib/softoken/pkcs11c.c (working copy) |
@@ -62,7 +62,7 @@ |
return; |
} |
-#ifdef NSS_ENABLE_ECC |
+#ifndef NSS_DISABLE_ECC |
#ifdef EC_DEBUG |
#define SEC_PRINT(str1, str2, num, sitem) \ |
printf("pkcs11c.c:%s:%s (keytype=%d) [len=%d]\n", \ |
@@ -74,7 +74,7 @@ |
#else |
#define SEC_PRINT(a, b, c, d) |
#endif |
-#endif /* NSS_ENABLE_ECC */ |
+#endif /* NSS_DISABLE_ECC */ |
/* |
* free routines.... Free local type allocated data, and convert |
@@ -120,7 +120,7 @@ |
return CKR_KEY_SIZE_RANGE; /* the closest error code */ |
case SEC_ERROR_UNSUPPORTED_EC_POINT_FORM: |
return CKR_TEMPLATE_INCONSISTENT; |
- /* EC functions set this error if NSS_ENABLE_ECC is not defined */ |
+ /* EC functions set this error if NSS_DISABLE_ECC is defined */ |
case SEC_ERROR_UNSUPPORTED_KEYALG: |
return CKR_MECHANISM_INVALID; |
case SEC_ERROR_UNSUPPORTED_ELLIPTIC_CURVE: |
@@ -2362,7 +2362,7 @@ |
return rv; |
} |
-#ifdef NSS_ENABLE_ECC |
+#ifndef NSS_DISABLE_ECC |
static SECStatus |
nsc_ECDSAVerifyStub(void *ctx, void *sigBuf, unsigned int sigLen, |
void *dataBuf, unsigned int dataLen) |
@@ -2397,7 +2397,7 @@ |
*sigLen = signature.len; |
return rv; |
} |
-#endif /* NSS_ENABLE_ECC */ |
+#endif /* NSS_DISABLE_ECC */ |
/* NSC_SignInit setups up the signing operations. There are three basic |
* types of signing: |
@@ -2549,7 +2549,7 @@ |
break; |
-#ifdef NSS_ENABLE_ECC |
+#ifndef NSS_DISABLE_ECC |
case CKM_ECDSA_SHA1: |
context->multi = PR_TRUE; |
crv = sftk_doSubSHA1(context); |
@@ -2572,7 +2572,7 @@ |
context->maxLen = MAX_ECKEY_LEN * 2; |
break; |
-#endif /* NSS_ENABLE_ECC */ |
+#endif /* NSS_DISABLE_ECC */ |
#define INIT_HMAC_MECH(mmm) \ |
case CKM_ ## mmm ## _HMAC_GENERAL: \ |
@@ -3180,7 +3180,7 @@ |
context->verify = (SFTKVerify) nsc_DSA_Verify_Stub; |
context->destroy = sftk_Null; |
break; |
-#ifdef NSS_ENABLE_ECC |
+#ifndef NSS_DISABLE_ECC |
case CKM_ECDSA_SHA1: |
context->multi = PR_TRUE; |
crv = sftk_doSubSHA1(context); |
@@ -3200,7 +3200,7 @@ |
context->verify = (SFTKVerify) nsc_ECDSAVerifyStub; |
context->destroy = sftk_Null; |
break; |
-#endif /* NSS_ENABLE_ECC */ |
+#endif /* NSS_DISABLE_ECC */ |
INIT_HMAC_MECH(MD2) |
INIT_HMAC_MECH(MD5) |
@@ -4334,7 +4334,7 @@ |
pairwise_digest_length = subPrimeLen; |
mech.mechanism = CKM_DSA; |
break; |
-#ifdef NSS_ENABLE_ECC |
+#ifndef NSS_DISABLE_ECC |
case CKK_EC: |
signature_length = MAX_ECKEY_LEN * 2; |
mech.mechanism = CKM_ECDSA; |
@@ -4457,12 +4457,12 @@ |
int private_value_bits = 0; |
DHPrivateKey * dhPriv; |
-#ifdef NSS_ENABLE_ECC |
+#ifndef NSS_DISABLE_ECC |
/* Elliptic Curve Cryptography */ |
SECItem ecEncodedParams; /* DER Encoded parameters */ |
ECPrivateKey * ecPriv; |
ECParams * ecParams; |
-#endif /* NSS_ENABLE_ECC */ |
+#endif /* NSS_DISABLE_ECC */ |
CHECK_FORK(); |
@@ -4792,7 +4792,7 @@ |
PORT_FreeArena(dhPriv->arena, PR_TRUE); |
break; |
-#ifdef NSS_ENABLE_ECC |
+#ifndef NSS_DISABLE_ECC |
case CKM_EC_KEY_PAIR_GEN: |
sftk_DeleteAttributeType(privateKey,CKA_EC_PARAMS); |
sftk_DeleteAttributeType(privateKey,CKA_VALUE); |
@@ -4855,7 +4855,7 @@ |
/* should zeroize, since this function doesn't. */ |
PORT_FreeArena(ecPriv->ecParams.arena, PR_TRUE); |
break; |
-#endif /* NSS_ENABLE_ECC */ |
+#endif /* NSS_DISABLE_ECC */ |
default: |
crv = CKR_MECHANISM_INVALID; |
@@ -4975,7 +4975,7 @@ |
void *dummy, *param = NULL; |
SECStatus rv = SECSuccess; |
SECItem *encodedKey = NULL; |
-#ifdef NSS_ENABLE_ECC |
+#ifndef NSS_DISABLE_ECC |
SECItem *fordebug; |
int savelen; |
#endif |
@@ -5030,7 +5030,7 @@ |
nsslowkey_PQGParamsTemplate); |
algorithm = SEC_OID_ANSIX9_DSA_SIGNATURE; |
break; |
-#ifdef NSS_ENABLE_ECC |
+#ifndef NSS_DISABLE_ECC |
case NSSLOWKEYECKey: |
prepare_low_ec_priv_key_for_asn1(lk); |
/* Public value is encoded as a bit string so adjust length |
@@ -5057,7 +5057,7 @@ |
algorithm = SEC_OID_ANSIX962_EC_PUBLIC_KEY; |
break; |
-#endif /* NSS_ENABLE_ECC */ |
+#endif /* NSS_DISABLE_ECC */ |
case NSSLOWKEYDHKey: |
default: |
dummy = NULL; |
@@ -5090,7 +5090,7 @@ |
nsslowkey_PrivateKeyInfoTemplate); |
*crvp = encodedKey ? CKR_OK : CKR_DEVICE_ERROR; |
-#ifdef NSS_ENABLE_ECC |
+#ifndef NSS_DISABLE_ECC |
fordebug = encodedKey; |
SEC_PRINT("sftk_PackagePrivateKey()", "PrivateKeyInfo", lk->keyType, |
fordebug); |
@@ -5316,7 +5316,7 @@ |
prepare_low_pqg_params_for_asn1(&lpk->u.dsa.params); |
break; |
/* case NSSLOWKEYDHKey: */ |
-#ifdef NSS_ENABLE_ECC |
+#ifndef NSS_DISABLE_ECC |
case SEC_OID_ANSIX962_EC_PUBLIC_KEY: |
keyTemplate = nsslowkey_ECPrivateKeyTemplate; |
paramTemplate = NULL; |
@@ -5325,7 +5325,7 @@ |
prepare_low_ec_priv_key_for_asn1(lpk); |
prepare_low_ecparams_for_asn1(&lpk->u.ec.ecParams); |
break; |
-#endif /* NSS_ENABLE_ECC */ |
+#endif /* NSS_DISABLE_ECC */ |
default: |
keyTemplate = NULL; |
paramTemplate = NULL; |
@@ -5340,7 +5340,7 @@ |
/* decode the private key and any algorithm parameters */ |
rv = SEC_QuickDERDecodeItem(arena, lpk, keyTemplate, &pki->privateKey); |
-#ifdef NSS_ENABLE_ECC |
+#ifndef NSS_DISABLE_ECC |
if (lpk->keyType == NSSLOWKEYECKey) { |
/* convert length in bits to length in bytes */ |
lpk->u.ec.publicValue.len >>= 3; |
@@ -5351,7 +5351,7 @@ |
goto loser; |
} |
} |
-#endif /* NSS_ENABLE_ECC */ |
+#endif /* NSS_DISABLE_ECC */ |
if(rv != SECSuccess) { |
goto loser; |
@@ -5446,7 +5446,7 @@ |
break; |
#endif |
/* what about fortezza??? */ |
-#ifdef NSS_ENABLE_ECC |
+#ifndef NSS_DISABLE_ECC |
case NSSLOWKEYECKey: |
keyType = CKK_EC; |
crv = (sftk_hasAttribute(key, CKA_NETSCAPE_DB)) ? CKR_OK : |
@@ -5472,7 +5472,7 @@ |
if(crv != CKR_OK) break; |
/* XXX Do we need to decode the EC Params here ?? */ |
break; |
-#endif /* NSS_ENABLE_ECC */ |
+#endif /* NSS_DISABLE_ECC */ |
default: |
crv = CKR_KEY_TYPE_INCONSISTENT; |
break; |
@@ -5782,7 +5782,7 @@ |
return 0; |
} |
-#ifdef NSS_ENABLE_ECC |
+#ifndef NSS_DISABLE_ECC |
/* Inputs: |
* key_len: Length of derived key to be generated. |
* SharedSecret: a shared secret that is the output of a key agreement primitive. |
@@ -5893,7 +5893,7 @@ |
else |
return CKR_MECHANISM_INVALID; |
} |
-#endif |
+#endif /* NSS_DISABLE_ECC */ |
/* |
* SSL Key generation given pre master secret |
@@ -6839,7 +6839,7 @@ |
break; |
} |
-#ifdef NSS_ENABLE_ECC |
+#ifndef NSS_DISABLE_ECC |
case CKM_ECDH1_DERIVE: |
case CKM_ECDH1_COFACTOR_DERIVE: |
{ |
@@ -6997,7 +6997,7 @@ |
break; |
} |
-#endif /* NSS_ENABLE_ECC */ |
+#endif /* NSS_DISABLE_ECC */ |
/* See RFC 5869 and CK_NSS_HKDFParams for documentation. */ |
case CKM_NSS_HKDF_SHA1: hashType = HASH_AlgSHA1; goto hkdf; |