Bug 832942: work around an ARMv6 code generation bug in gcc 4.6. r=wtc NSS_3_14_4_RELEASE_BRANCH
authorCamilo Viecco <cviecco@mozilla.com>
Tue, 22 Oct 2013 20:57:20 +0200
branchNSS_3_14_4_RELEASE_BRANCH
changeset 10880 a3deb9fc0d34798b22fda284809fdccff44c2f66
parent 10879 a54284d96781e06f598f7c33e73ad8d548817503
child 10881 c22f83676278a392d9096f0e6b042f7f73a9196a
push id180
push userkaie@kuix.de
push dateTue, 22 Oct 2013 19:00:18 +0000
reviewerswtc
bugs832942
Bug 832942: work around an ARMv6 code generation bug in gcc 4.6. r=wtc
security/nss/lib/softoken/pkcs11.c
--- a/security/nss/lib/softoken/pkcs11.c
+++ b/security/nss/lib/softoken/pkcs11.c
@@ -1889,17 +1889,28 @@ sftk_mkPrivKey(SFTKObject *object, CK_KE
 	    crv = sftk_Attribute2SSecItem(arena, &privKey->u.ec.publicValue,
  				object, CKA_NETSCAPE_DB);
 	    if (crv != CKR_OK) break;
 	    /* privKey was zero'd so public value is already set to NULL, 0
 	     * if we don't set it explicitly */
 	}
         rv = DER_SetUInteger(privKey->arena, &privKey->u.ec.version,
                           NSSLOWKEY_EC_PRIVATE_KEY_VERSION);
-	if (rv != SECSuccess) crv = CKR_HOST_MEMORY;
+	if (rv != SECSuccess) {
+	    crv = CKR_HOST_MEMORY;
+	    /* The following ifdef is needed for Linux arm distros and
+	     * Android as gcc 4.6 has a bug when targeting arm (but not
+	     * thumb). The bug has been fixed in gcc 4.7.
+	     * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56561
+	     */
+#if defined (__arm__) && !defined(__thumb__) && defined (__GNUC__)
+	    *crvp = CKR_HOST_MEMORY;
+	    break;
+#endif
+	}
 	break;
 #endif /* NSS_ENABLE_ECC */
 
     default:
 	crv = CKR_KEY_TYPE_INCONSISTENT;
 	break;
     }
     if (crv == CKR_OK && itemTemplateCount != 0) {