Address of an imported symbol is not always a constant
authorAsanka Herath <asanka@secure-endpoints.com>
Tue, 24 Aug 2010 08:29:37 +0000 (04:29 -0400)
committerAsanka C. Herath <asanka@secure-endpoints.com>
Tue, 14 Sep 2010 12:03:37 +0000 (08:03 -0400)
On Windows, the address of a symbol imported from a DLL is not
considered a constant.  Therefore, it can't be used to initialized
static data.

lib/krb5/test_pknistkdf.c

index 6e2da54fc40751d1c51506eece8b2b343cee6ed6..33eb45ba9ee157537b53a07814ca8de4c7bbaf2d 100644 (file)
@@ -52,7 +52,11 @@ struct testcase {
 } tests[] = {
     /* 0 */
     {
-       &asn1_oid_id_pkinit_kdf_ah_sha1, /* AlgorithmIdentifier */
+        NULL,                            /* AlgorithmIdentifier */
+       /* == &asn1_oid_id_pkinit_kdf_ah_sha1.  Addresses of exported
+         * symbols are not considered constant on all platforms
+         * (Windows).  So we set it in main() below. */
+
        { /* Z */
            256,
            "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -260,6 +264,8 @@ main(int argc, char **argv)
     if (ret)
        errx (1, "krb5_init_context failed: %d", ret);
 
+    tests[0].oid = &asn1_oid_id_pkinit_kdf_ah_sha1;
+
     for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
        test_dh2key(context, i, &tests[i]);