]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Declare all read only data structures as const
authorMikael Kanstrup <mikael.kanstrup@sonymobile.com>
Fri, 24 Apr 2015 07:19:53 +0000 (09:19 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 25 Apr 2015 14:33:06 +0000 (17:33 +0300)
By analysing objdump output some read only structures were found in
.data section. To help compiler further optimize code declare these
as const.

Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sonymobile.com>
32 files changed:
hostapd/hostapd_cli.c
src/common/ieee802_11_common.c
src/crypto/crypto_module_tests.c
src/crypto/dh_groups.c
src/drivers/driver.h
src/drivers/driver_privsep.c
src/drivers/drivers.c
src/eap_common/ikev2_common.c
src/eap_peer/eap.c
src/eap_peer/eap.h
src/eap_peer/eap_i.h
src/eap_server/eap.h
src/eap_server/eap_i.h
src/eap_server/eap_server.c
src/eapol_auth/eapol_auth_sm.c
src/eapol_supp/eapol_supp_sm.c
src/radius/radius.c
src/radius/radius_server.c
src/wps/ndef.c
src/wps/wps_module_tests.c
tests/ap-mgmt-fuzzer/ap-mgmt-fuzzer.c
wlantest/gcmp.c
wlantest/test_vectors.c
wlantest/wlantest.h
wpa_supplicant/ctrl_iface.c
wpa_supplicant/eapol_test.c
wpa_supplicant/p2p_supplicant.c
wpa_supplicant/preauth_test.c
wpa_supplicant/wpa_cli.c
wpa_supplicant/wpa_priv.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index 719d021cca807cf5e3ffda8002bd02f021bf588b..e29918360bfc7909e9c29ea02706f64159f25f4e 100644 (file)
 #include "common/version.h"
 
 
-static const char *hostapd_cli_version =
+static const char *const hostapd_cli_version =
 "hostapd_cli v" VERSION_STR "\n"
 "Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi> and contributors";
 
 
-static const char *hostapd_cli_license =
+static const char *const hostapd_cli_license =
 "This software may be distributed under the terms of the BSD license.\n"
 "See README for more details.\n";
 
-static const char *hostapd_cli_full_license =
+static const char *const hostapd_cli_full_license =
 "This software may be distributed under the terms of the BSD license.\n"
 "\n"
 "Redistribution and use in source and binary forms, with or without\n"
@@ -57,7 +57,7 @@ static const char *hostapd_cli_full_license =
 "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
 "\n";
 
-static const char *commands_help =
+static const char *const commands_help =
 "Commands:\n"
 "   mib                  get MIB variables (dot1x, dot11, radius)\n"
 "   sta <addr>           get MIB variables for one station\n"
@@ -1015,7 +1015,7 @@ struct hostapd_cli_cmd {
        int (*handler)(struct wpa_ctrl *ctrl, int argc, char *argv[]);
 };
 
-static struct hostapd_cli_cmd hostapd_cli_commands[] = {
+static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
        { "ping", hostapd_cli_cmd_ping },
        { "mib", hostapd_cli_cmd_mib },
        { "relog", hostapd_cli_cmd_relog },
@@ -1070,7 +1070,7 @@ static struct hostapd_cli_cmd hostapd_cli_commands[] = {
 
 static void wpa_request(struct wpa_ctrl *ctrl, int argc, char *argv[])
 {
-       struct hostapd_cli_cmd *cmd, *match = NULL;
+       const struct hostapd_cli_cmd *cmd, *match = NULL;
        int count;
 
        count = 0;
index 7843e6fea3fb253a5606bb834f137e879c1529c0..e23007a86c54d8d6d098e9fa5264a1ddc861288b 100644 (file)
@@ -564,27 +564,27 @@ enum hostapd_hw_mode ieee80211_freq_to_chan(int freq, u8 *channel)
 }
 
 
-static const char *us_op_class_cc[] = {
+static const char *const us_op_class_cc[] = {
        "US", "CA", NULL
 };
 
-static const char *eu_op_class_cc[] = {
+static const char *const eu_op_class_cc[] = {
        "AL", "AM", "AT", "AZ", "BA", "BE", "BG", "BY", "CH", "CY", "CZ", "DE",
        "DK", "EE", "EL", "ES", "FI", "FR", "GE", "HR", "HU", "IE", "IS", "IT",
        "LI", "LT", "LU", "LV", "MD", "ME", "MK", "MT", "NL", "NO", "PL", "PT",
        "RO", "RS", "RU", "SE", "SI", "SK", "TR", "UA", "UK", NULL
 };
 
-static const char *jp_op_class_cc[] = {
+static const char *const jp_op_class_cc[] = {
        "JP", NULL
 };
 
-static const char *cn_op_class_cc[] = {
+static const char *const cn_op_class_cc[] = {
        "CN", "CA", NULL
 };
 
 
-static int country_match(const char *cc[], const char *country)
+static int country_match(const char *const cc[], const char *const country)
 {
        int i;
 
index 7137c27d0e8c516168a87147f049c4afac94b138..1d613c93525c8c47a8b4c3a1c2711af85decd7aa 100644 (file)
@@ -161,7 +161,7 @@ struct omac1_test_vector {
        u8 tag[16];
 };
 
-static struct omac1_test_vector omac1_test_vectors[] =
+static const struct omac1_test_vector omac1_test_vectors[] =
 {
        {
                { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
@@ -210,7 +210,8 @@ static struct omac1_test_vector omac1_test_vectors[] =
 };
 
 
-static int test_omac1_vector(struct omac1_test_vector *tv, unsigned int i)
+static int test_omac1_vector(const struct omac1_test_vector *tv,
+                            unsigned int i)
 {
        u8 key[] = {
                0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
@@ -983,14 +984,14 @@ static int test_eap_fast(void)
 }
 
 
-static u8 key0[] =
+static const u8 key0[] =
 {
        0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
        0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
        0x0b, 0x0b, 0x0b, 0x0b
 };
-static u8 data0[] = "Hi There";
-static u8 prf0[] =
+static const u8 data0[] = "Hi There";
+static const u8 prf0[] =
 {
        0xbc, 0xd4, 0xc6, 0x50, 0xb3, 0x0b, 0x96, 0x84,
        0x95, 0x18, 0x29, 0xe0, 0xd7, 0x5f, 0x9d, 0x54,
@@ -1002,9 +1003,9 @@ static u8 prf0[] =
        0xdb, 0x83, 0x73, 0x69, 0x83, 0x56, 0xcf, 0x5a
 };
 
-static u8 key1[] = "Jefe";
-static u8 data1[] = "what do ya want for nothing?";
-static u8 prf1[] =
+static const u8 key1[] = "Jefe";
+static const u8 data1[] = "what do ya want for nothing?";
+static const u8 prf1[] =
 {
        0x51, 0xf4, 0xde, 0x5b, 0x33, 0xf2, 0x49, 0xad,
        0xf8, 0x1a, 0xeb, 0x71, 0x3a, 0x3c, 0x20, 0xf4,
@@ -1017,13 +1018,13 @@ static u8 prf1[] =
 };
 
 
-static u8 key2[] =
+static const u8 key2[] =
 {
        0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
        0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
        0xaa, 0xaa, 0xaa, 0xaa
 };
-static u8 data2[] =
+static const u8 data2[] =
 {
        0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
        0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
@@ -1033,7 +1034,7 @@ static u8 data2[] =
        0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
        0xdd, 0xdd
 };
-static u8 prf2[] =
+static const u8 prf2[] =
 {
        0xe1, 0xac, 0x54, 0x6e, 0xc4, 0xcb, 0x63, 0x6f,
        0x99, 0x76, 0x48, 0x7b, 0xe5, 0xc8, 0x6b, 0xe1,
@@ -1052,7 +1053,7 @@ struct passphrase_test {
        char psk[32];
 };
 
-static struct passphrase_test passphrase_tests[] =
+static const struct passphrase_test passphrase_tests[] =
 {
        {
                "password",
@@ -1097,7 +1098,7 @@ struct rfc6070_test {
        size_t dk_len;
 };
 
-static struct rfc6070_test rfc6070_tests[] =
+static const struct rfc6070_test rfc6070_tests[] =
 {
        {
                "password",
@@ -1214,7 +1215,7 @@ static int test_sha1(void)
        wpa_printf(MSG_INFO, "PBKDF2-SHA1 Passphrase test cases:");
        for (i = 0; i < NUM_PASSPHRASE_TESTS; i++) {
                u8 psk[32];
-               struct passphrase_test *test = &passphrase_tests[i];
+               const struct passphrase_test *test = &passphrase_tests[i];
 
                if (pbkdf2_sha1(test->passphrase,
                                (const u8 *) test->ssid, strlen(test->ssid),
@@ -1230,7 +1231,7 @@ static int test_sha1(void)
        wpa_printf(MSG_INFO, "PBKDF2-SHA1 test cases (RFC 6070):");
        for (i = 0; i < NUM_RFC6070_TESTS; i++) {
                u8 dk[25];
-               struct rfc6070_test *test = &rfc6070_tests[i];
+               const struct rfc6070_test *test = &rfc6070_tests[i];
 
                if (pbkdf2_sha1(test->p, (const u8 *) test->s, strlen(test->s),
                                test->c, dk, test->dk_len) == 0 &&
@@ -1248,7 +1249,7 @@ static int test_sha1(void)
 }
 
 
-struct {
+const struct {
        char *data;
        u8 hash[32];
 } tests[] = {
@@ -1272,7 +1273,7 @@ struct {
        }
 };
 
-struct hmac_test {
+const struct hmac_test {
        u8 key[80];
        size_t key_len;
        u8 data[128];
@@ -1513,7 +1514,7 @@ static int test_sha256(void)
        }
 
        for (i = 0; i < ARRAY_SIZE(hmac_tests); i++) {
-               struct hmac_test *t = &hmac_tests[i];
+               const struct hmac_test *t = &hmac_tests[i];
 
                wpa_printf(MSG_INFO, "HMAC-SHA256 test case %d:", i + 1);
 
index d3b263196e2d1cfcc38c4c4a1636f6f380318fd7..3aeb2bbc60af3f5b405f861c55e0076b00a00404 100644 (file)
@@ -1153,7 +1153,7 @@ dh_group ## id ## _prime, sizeof(dh_group ## id ## _prime), \
 dh_group ## id ## _order, sizeof(dh_group ## id ## _order), safe }
                
 
-static struct dh_group dh_groups[] = {
+static const struct dh_group dh_groups[] = {
        DH_GROUP(5, 1),
 #ifdef ALL_DH_GROUPS
        DH_GROUP(1, 1),
index e4d0412a93bff76f48364803031c4b95f8aedf17..f7da63669c9d32f2458fe9568bd15bd5928832b7 100644 (file)
@@ -4640,6 +4640,6 @@ wpa_get_wowlan_triggers(const char *wowlan_triggers,
                        const struct wpa_driver_capa *capa);
 
 /* NULL terminated array of linked in driver wrappers */
-extern struct wpa_driver_ops *wpa_drivers[];
+extern const struct wpa_driver_ops *const wpa_drivers[];
 
 #endif /* DRIVER_H */
index 26d2bab040541e05f46e1c9ebcc77529df9bd791..1cfc15dceb614c20d36c1d6a895cf26eca61b373 100644 (file)
@@ -743,7 +743,7 @@ struct wpa_driver_ops wpa_driver_privsep_ops = {
 };
 
 
-struct wpa_driver_ops *wpa_drivers[] =
+const struct wpa_driver_ops *const wpa_drivers[] =
 {
        &wpa_driver_privsep_ops,
        NULL
index f0c3bb3c63ba002cf5dc25c2b706fbafd9652ece..a98af9ac7d711a33e1c5904dfb76d938dc673993 100644 (file)
@@ -47,7 +47,7 @@ extern struct wpa_driver_ops wpa_driver_none_ops; /* driver_none.c */
 #endif /* CONFIG_DRIVER_NONE */
 
 
-struct wpa_driver_ops *wpa_drivers[] =
+const struct wpa_driver_ops *const wpa_drivers[] =
 {
 #ifdef CONFIG_DRIVER_NL80211
        &wpa_driver_nl80211_ops,
index 4f9e64eced08a83dcb9855589e98a1f6eebc256a..d60358c733f0b3d853414ad32b9802aca51379f1 100644 (file)
@@ -16,7 +16,7 @@
 #include "ikev2_common.h"
 
 
-static struct ikev2_integ_alg ikev2_integ_algs[] = {
+static const struct ikev2_integ_alg ikev2_integ_algs[] = {
        { AUTH_HMAC_SHA1_96, 20, 12 },
        { AUTH_HMAC_MD5_96, 16, 12 }
 };
@@ -24,7 +24,7 @@ static struct ikev2_integ_alg ikev2_integ_algs[] = {
 #define NUM_INTEG_ALGS ARRAY_SIZE(ikev2_integ_algs)
 
 
-static struct ikev2_prf_alg ikev2_prf_algs[] = {
+static const struct ikev2_prf_alg ikev2_prf_algs[] = {
        { PRF_HMAC_SHA1, 20, 20 },
        { PRF_HMAC_MD5, 16, 16 }
 };
@@ -32,7 +32,7 @@ static struct ikev2_prf_alg ikev2_prf_algs[] = {
 #define NUM_PRF_ALGS ARRAY_SIZE(ikev2_prf_algs)
 
 
-static struct ikev2_encr_alg ikev2_encr_algs[] = {
+static const struct ikev2_encr_alg ikev2_encr_algs[] = {
        { ENCR_AES_CBC, 16, 16 }, /* only 128-bit keys supported for now */
        { ENCR_3DES, 24, 8 }
 };
index fc4af95310a8dfd2cf0745451571f41e1002514a..1dbe003e82563d65aefb9d4bc69884323a03ac88 100644 (file)
@@ -1911,7 +1911,7 @@ static void eap_peer_sm_tls_event(void *ctx, enum tls_event ev,
  * structure remains alive while the EAP state machine is active.
  */
 struct eap_sm * eap_peer_sm_init(void *eapol_ctx,
-                                struct eapol_callbacks *eapol_cb,
+                                const struct eapol_callbacks *eapol_cb,
                                 void *msg_ctx, struct eap_config *conf)
 {
        struct eap_sm *sm;
index 702463b9d5146ea1e99548f95bdc0eb1258d6abe..1a645af8b20034196b765acc389ed4621aa3a2a0 100644 (file)
@@ -307,7 +307,7 @@ struct eap_config {
 };
 
 struct eap_sm * eap_peer_sm_init(void *eapol_ctx,
-                                struct eapol_callbacks *eapol_cb,
+                                const struct eapol_callbacks *eapol_cb,
                                 void *msg_ctx, struct eap_config *conf);
 void eap_peer_sm_deinit(struct eap_sm *sm);
 int eap_peer_sm_step(struct eap_sm *sm);
index 2d7fdea227747ed135648de0fcfcff86314eb698..5f8b5fa78b1fc2fac58662ec13027e29b4e29366 100644 (file)
@@ -328,7 +328,7 @@ struct eap_sm {
        /* not defined in RFC 4137 */
        Boolean changed;
        void *eapol_ctx;
-       struct eapol_callbacks *eapol_cb;
+       const struct eapol_callbacks *eapol_cb;
        void *eap_method_priv;
        int init_phase2;
        int fast_reauth;
index b825e18f2dcefaa60cb78613aab1683760701a07..09be5818b71872139cb40b6e5ec1d2879c33cacb 100644 (file)
@@ -139,7 +139,7 @@ struct eap_config {
 
 
 struct eap_sm * eap_server_sm_init(void *eapol_ctx,
-                                  struct eapol_callbacks *eapol_cb,
+                                  const struct eapol_callbacks *eapol_cb,
                                   struct eap_config *eap_conf);
 void eap_server_sm_deinit(struct eap_sm *sm);
 int eap_server_sm_step(struct eap_sm *sm);
index 7d723091ffb5c51518e7b8c9c820eceb8c6e593d..978c879455f6a53ea1130f33a772115d0127b163 100644 (file)
@@ -155,7 +155,7 @@ struct eap_sm {
        /* not defined in RFC 4137 */
        Boolean changed;
        void *eapol_ctx, *msg_ctx;
-       struct eapol_callbacks *eapol_cb;
+       const struct eapol_callbacks *eapol_cb;
        void *eap_method_priv;
        u8 *identity;
        size_t identity_len;
index 693debe8e1b9e94ce2c611ae3ce27820b4d5fd63..1f38d78b25db3d0f3740203ee7f19a31a729735a 100644 (file)
@@ -1802,7 +1802,7 @@ static void eap_user_free(struct eap_user *user)
  * This function allocates and initializes an EAP state machine.
  */
 struct eap_sm * eap_server_sm_init(void *eapol_ctx,
-                                  struct eapol_callbacks *eapol_cb,
+                                  const struct eapol_callbacks *eapol_cb,
                                   struct eap_config *conf)
 {
        struct eap_sm *sm;
index 0df6eb56416b64a8e6528a3fdbb54a75cd07fbd8..3b0c2e4df4d55f8a3d01d5dd839dfbfbced730ee 100644 (file)
@@ -22,7 +22,7 @@
 #define STATE_MACHINE_DEBUG_PREFIX "IEEE 802.1X"
 #define STATE_MACHINE_ADDR sm->addr
 
-static struct eapol_callbacks eapol_cb;
+static const struct eapol_callbacks eapol_cb;
 
 /* EAPOL state machines are described in IEEE Std 802.1X-2004, Chap. 8.2 */
 
@@ -1056,7 +1056,7 @@ static int eapol_sm_erp_add_key(void *ctx, struct eap_server_erp_key *erp)
 }
 
 
-static struct eapol_callbacks eapol_cb =
+static const struct eapol_callbacks eapol_cb =
 {
        eapol_sm_get_eap_user,
        eapol_sm_get_eap_req_id_text,
index 9cc234a82b09e2fb4c0333f791aac7836bd8cbd6..eb8c5bb4a5e74fd253be24635242d1f7cba30e1d 100644 (file)
@@ -1997,7 +1997,7 @@ static void eapol_sm_set_anon_id(void *ctx, const u8 *id, size_t len)
 }
 
 
-static struct eapol_callbacks eapol_cb =
+static const struct eapol_callbacks eapol_cb =
 {
        eapol_sm_get_config,
        eapol_sm_get_bool,
index 2c01b3f9d79c6b633968ba4a08aecd929915cdb5..906d8c81d68bb2745c1ac62d2bf47e96362fd640 100644 (file)
@@ -167,7 +167,7 @@ struct radius_attr_type {
        } data_type;
 };
 
-static struct radius_attr_type radius_attrs[] =
+static const struct radius_attr_type radius_attrs[] =
 {
        { RADIUS_ATTR_USER_NAME, "User-Name", RADIUS_ATTR_TEXT },
        { RADIUS_ATTR_USER_PASSWORD, "User-Password", RADIUS_ATTR_UNDIST },
@@ -259,7 +259,7 @@ static struct radius_attr_type radius_attrs[] =
 #define RADIUS_ATTRS ARRAY_SIZE(radius_attrs)
 
 
-static struct radius_attr_type *radius_get_attr_type(u8 type)
+static const struct radius_attr_type *radius_get_attr_type(u8 type)
 {
        size_t i;
 
@@ -274,7 +274,7 @@ static struct radius_attr_type *radius_get_attr_type(u8 type)
 
 static void radius_msg_dump_attr(struct radius_attr_hdr *hdr)
 {
-       struct radius_attr_type *attr;
+       const struct radius_attr_type *attr;
        int len;
        unsigned char *pos;
        char buf[1000];
index 3f881cf3e74bee2f3e79a6ff2546842493a65b86..1c699555e0aea958e66f6cc6cd85bc9d43816024 100644 (file)
@@ -35,7 +35,7 @@
  */
 #define RADIUS_MAX_MSG_LEN 3000
 
-static struct eapol_callbacks radius_server_eapol_cb;
+static const struct eapol_callbacks radius_server_eapol_cb;
 
 struct radius_client;
 struct radius_server_data;
@@ -2101,7 +2101,7 @@ static int radius_server_erp_add_key(void *ctx, struct eap_server_erp_key *erp)
 #endif /* CONFIG_ERP */
 
 
-static struct eapol_callbacks radius_server_eapol_cb =
+static const struct eapol_callbacks radius_server_eapol_cb =
 {
        .get_eap_user = radius_server_get_eap_user,
        .get_eap_req_id_text = radius_server_get_eap_req_id_text,
index d45dfc8efee645de1fc217656b1ffb4923ac56f0..8d1ce1eacc34a1bfe52cdd4240c0c95c7ce3c21b 100644 (file)
@@ -29,8 +29,8 @@ struct ndef_record {
        u32 total_length;
 };
 
-static char wifi_handover_type[] = "application/vnd.wfa.wsc";
-static char p2p_handover_type[] = "application/vnd.wfa.p2p";
+static const char wifi_handover_type[] = "application/vnd.wfa.wsc";
+static const char p2p_handover_type[] = "application/vnd.wfa.p2p";
 
 static int ndef_parse_record(const u8 *data, u32 size,
                             struct ndef_record *record)
@@ -97,7 +97,7 @@ static struct wpabuf * ndef_parse_records(const struct wpabuf *buf,
 }
 
 
-static struct wpabuf * ndef_build_record(u8 flags, void *type,
+static struct wpabuf * ndef_build_record(u8 flags, const void *type,
                                         u8 type_length, void *id,
                                         u8 id_length,
                                         const struct wpabuf *payload)
index 6800e86db91195983497e6b8549cabd40dad96f4..350630768be4b07f801cf10e2032b340e61e6bac 100644 (file)
@@ -17,7 +17,7 @@ struct wps_attr_parse_test {
        int extra;
 };
 
-struct wps_attr_parse_test wps_attr_parse_test_cases[] = {
+const struct wps_attr_parse_test wps_attr_parse_test_cases[] = {
        /* Empty message */
        { "", 0, 0 },
        /* Truncated attribute header */
@@ -271,7 +271,7 @@ static int wps_attr_parse_tests(void)
        for (i = 0; i < ARRAY_SIZE(wps_attr_parse_test_cases); i++) {
                struct wpabuf *buf;
                size_t len;
-               struct wps_attr_parse_test *test =
+               const struct wps_attr_parse_test *test =
                        &wps_attr_parse_test_cases[i];
 
                len = os_strlen(test->data) / 2;
index 7d65af7a0d29bb3cf16922d741c08fc2b566c511..a9e197541449b4cfdb843e2d7475aa44d4a48f62 100644 (file)
@@ -14,7 +14,7 @@
 #include "ap/ieee802_11.h"
 
 
-struct wpa_driver_ops *wpa_drivers[] =
+const struct wpa_driver_ops *const wpa_drivers[] =
 {
        NULL
 };
index 161b8a7e38d742987de94663be5d192e1c5b7950..d92f4edae6e76a7db998abe55607646a6a73eee4 100644 (file)
@@ -112,9 +112,9 @@ u8 * gcmp_decrypt(const u8 *tk, size_t tk_len, const struct ieee80211_hdr *hdr,
 }
 
 
-u8 * gcmp_encrypt(const u8 *tk, size_t tk_len, u8 *frame, size_t len,
-                 size_t hdrlen, u8 *qos,
-                 u8 *pn, int keyid, size_t *encrypted_len)
+u8 * gcmp_encrypt(const u8 *tk, size_t tk_len, const u8 *frame, size_t len,
+                 size_t hdrlen, const u8 *qos,
+                 const u8 *pn, int keyid, size_t *encrypted_len)
 {
        u8 aad[30], nonce[12], *crypt, *pos;
        size_t aad_len, plen;
index 321d930aeea1f64e888db99e8bcefd2536394c04..36f2f5dbba8aba228c8998c1126c853659fd4d84 100644 (file)
@@ -232,7 +232,7 @@ struct gcmp_test {
        u8 encr[300];
 };
 
-static struct gcmp_test gcmp_vectors[] =
+static const struct gcmp_test gcmp_vectors[] =
 {
        {
                .tk = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
@@ -348,7 +348,7 @@ static struct gcmp_test gcmp_vectors[] =
 };
 
 
-static int run_gcmp(int idx, struct gcmp_test *vector)
+static int run_gcmp(int idx, const struct gcmp_test *vector)
 {
        u8 *enc, *plain;
        size_t enc_len, plain_len;
index 1d8088fa6d5d7fa7c45561a7ab992f493fda644a..29bcab501b88f9611eda198abfa28656544ba1dc 100644 (file)
@@ -291,9 +291,9 @@ u8 * bip_gmac_protect(const u8 *igtk, size_t igtk_len, u8 *frame, size_t len,
 
 u8 * gcmp_decrypt(const u8 *tk, size_t tk_len, const struct ieee80211_hdr *hdr,
                  const u8 *data, size_t data_len, size_t *decrypted_len);
-u8 * gcmp_encrypt(const u8 *tk, size_t tk_len, u8 *frame, size_t len,
-                 size_t hdrlen, u8 *qos,
-                 u8 *pn, int keyid, size_t *encrypted_len);
+u8 * gcmp_encrypt(const u8 *tk, size_t tk_len, const u8 *frame, size_t len,
+                 size_t hdrlen, const u8 *qos,
+                 const u8 *pn, int keyid, size_t *encrypted_len);
 
 int ctrl_init(struct wlantest *wt);
 void ctrl_deinit(struct wlantest *wt);
index a6aafee0b0dda327404cded457aae858ea381680..91617fb21536374b95b292f2ff3ac54a91e2bebe 100644 (file)
@@ -8686,7 +8686,7 @@ static int wpa_supplicant_global_iface_list(struct wpa_global *global,
        char *pos, *end;
 
        for (i = 0; wpa_drivers[i]; i++) {
-               struct wpa_driver_ops *drv = wpa_drivers[i];
+               const struct wpa_driver_ops *drv = wpa_drivers[i];
                if (drv->get_interfaces == NULL)
                        continue;
                tmp = drv->get_interfaces(global->drv_priv[i]);
index 9b7af30550bd4ecbcb0d327d9bdc07528c3c551b..983bbcdccb96dd56d961847413988352edcaff9e 100644 (file)
@@ -30,7 +30,7 @@
 #include "wpas_glue.h"
 
 
-struct wpa_driver_ops *wpa_drivers[] = { NULL };
+const struct wpa_driver_ops *const wpa_drivers[] = { NULL };
 
 
 struct extra_radius_attr {
index 4c71ef4cfde081887a5ff892e469d95245730ef5..b8592d32197b693b58b97b915ba3f9f274171f8c 100644 (file)
@@ -3099,7 +3099,7 @@ struct p2p_oper_class_map {
        enum { BW20, BW40PLUS, BW40MINUS, BW80, BW2160 } bw;
 };
 
-static struct p2p_oper_class_map op_class[] = {
+static const struct p2p_oper_class_map op_class[] = {
        { HOSTAPD_MODE_IEEE80211G, 81, 1, 13, 1, BW20 },
 #if 0 /* Do not enable HT40 on 2 GHz for now */
        { HOSTAPD_MODE_IEEE80211G, 83, 1, 9, 1, BW40PLUS },
@@ -3232,7 +3232,7 @@ static int wpas_p2p_setup_channels(struct wpa_supplicant *wpa_s,
        cla = cli_cla = 0;
 
        for (op = 0; op_class[op].op_class; op++) {
-               struct p2p_oper_class_map *o = &op_class[op];
+               const struct p2p_oper_class_map *o = &op_class[op];
                u8 ch;
                struct p2p_reg_class *reg = NULL, *cli_reg = NULL;
 
@@ -3291,7 +3291,7 @@ int wpas_p2p_get_ht40_mode(struct wpa_supplicant *wpa_s,
        enum chan_allowed ret;
 
        for (op = 0; op_class[op].op_class; op++) {
-               struct p2p_oper_class_map *o = &op_class[op];
+               const struct p2p_oper_class_map *o = &op_class[op];
                u8 ch;
 
                for (ch = o->min_chan; ch <= o->max_chan; ch += o->inc) {
index ed5708585be1d740b341f6ed147766b64eb2499c..f4bba98e2a8254259df0716ed7a58b252ef055b9 100644 (file)
@@ -27,7 +27,7 @@
 #include "drivers/driver.h"
 
 
-struct wpa_driver_ops *wpa_drivers[] = { NULL };
+const struct wpa_driver_ops *const wpa_drivers[] = { NULL };
 
 
 struct preauth_test_data {
index 9fbc53286f5b86d20f5bc4a866f84b236b3f516d..bf0a03f234007d27ff26fa68e5998f33c5edb1bf 100644 (file)
 #endif /* ANDROID */
 
 
-static const char *wpa_cli_version =
+static const char *const wpa_cli_version =
 "wpa_cli v" VERSION_STR "\n"
 "Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi> and contributors";
 
 
-static const char *wpa_cli_license =
+static const char *const wpa_cli_license =
 "This software may be distributed under the terms of the BSD license.\n"
 "See README for more details.\n";
 
-static const char *wpa_cli_full_license =
+static const char *const wpa_cli_full_license =
 "This software may be distributed under the terms of the BSD license.\n"
 "\n"
 "Redistribution and use in source and binary forms, with or without\n"
@@ -2805,7 +2805,7 @@ struct wpa_cli_cmd {
        const char *usage;
 };
 
-static struct wpa_cli_cmd wpa_cli_commands[] = {
+static const struct wpa_cli_cmd wpa_cli_commands[] = {
        { "status", wpa_cli_cmd_status, NULL,
          cli_cmd_flag_none,
          "[verbose] = get current WPA/EAPOL/EAP status" },
@@ -3350,7 +3350,7 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
 /*
  * Prints command usage, lines are padded with the specified string.
  */
-static void print_cmd_help(struct wpa_cli_cmd *cmd, const char *pad)
+static void print_cmd_help(const struct wpa_cli_cmd *cmd, const char *pad)
 {
        char c;
        size_t n;
@@ -3488,7 +3488,7 @@ static char ** wpa_cli_edit_completion_cb(void *ctx, const char *str, int pos)
 
 static int wpa_request(struct wpa_ctrl *ctrl, int argc, char *argv[])
 {
-       struct wpa_cli_cmd *cmd, *match = NULL;
+       const struct wpa_cli_cmd *cmd, *match = NULL;
        int count;
        int ret = 0;
 
index 6bd60b9e51c878b2cbe887aef4cf467c7dc1ef7b..4611a1d272948174fd34706ebe73b6dd025cc63e 100644 (file)
@@ -29,7 +29,7 @@ struct wpa_priv_interface {
        char *sock_name;
        int fd;
 
-       struct wpa_driver_ops *driver;
+       const struct wpa_driver_ops *driver;
        void *drv_priv;
        struct sockaddr_un drv_addr;
        int wpas_registered;
index 7b94242ee1c4b30c74e2dc776c6556e3f034d3ee..aa8078888ab79670009b9886ff09f7f06af1762a 100644 (file)
 #include "wpas_kay.h"
 #include "mesh.h"
 
-const char *wpa_supplicant_version =
+const char *const wpa_supplicant_version =
 "wpa_supplicant v" VERSION_STR "\n"
 "Copyright (c) 2003-2015, Jouni Malinen <j@w1.fi> and contributors";
 
-const char *wpa_supplicant_license =
+const char *const wpa_supplicant_license =
 "This software may be distributed under the terms of the BSD license.\n"
 "See README for more details.\n"
 #ifdef EAP_TLS_OPENSSL
@@ -70,16 +70,16 @@ const char *wpa_supplicant_license =
 
 #ifndef CONFIG_NO_STDOUT_DEBUG
 /* Long text divided into parts in order to fit in C89 strings size limits. */
-const char *wpa_supplicant_full_license1 =
+const char *const wpa_supplicant_full_license1 =
 "";
-const char *wpa_supplicant_full_license2 =
+const char *const wpa_supplicant_full_license2 =
 "This software may be distributed under the terms of the BSD license.\n"
 "\n"
 "Redistribution and use in source and binary forms, with or without\n"
 "modification, are permitted provided that the following conditions are\n"
 "met:\n"
 "\n";
-const char *wpa_supplicant_full_license3 =
+const char *const wpa_supplicant_full_license3 =
 "1. Redistributions of source code must retain the above copyright\n"
 "   notice, this list of conditions and the following disclaimer.\n"
 "\n"
@@ -87,7 +87,7 @@ const char *wpa_supplicant_full_license3 =
 "   notice, this list of conditions and the following disclaimer in the\n"
 "   documentation and/or other materials provided with the distribution.\n"
 "\n";
-const char *wpa_supplicant_full_license4 =
+const char *const wpa_supplicant_full_license4 =
 "3. Neither the name(s) of the above-listed copyright holder(s) nor the\n"
 "   names of its contributors may be used to endorse or promote products\n"
 "   derived from this software without specific prior written permission.\n"
@@ -96,7 +96,7 @@ const char *wpa_supplicant_full_license4 =
 "\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n"
 "LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n"
 "A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n";
-const char *wpa_supplicant_full_license5 =
+const char *const wpa_supplicant_full_license5 =
 "OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n"
 "SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n"
 "LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n"
index 0e36b4652c355052d55c4c558e59e50188339ab0..8ed8b7258c19d526d4b4c1f6a0ae37f3513f4a5a 100644 (file)
 #include "config_ssid.h"
 #include "wmm_ac.h"
 
-extern const char *wpa_supplicant_version;
-extern const char *wpa_supplicant_license;
+extern const char *const wpa_supplicant_version;
+extern const char *const wpa_supplicant_license;
 #ifndef CONFIG_NO_STDOUT_DEBUG
-extern const char *wpa_supplicant_full_license1;
-extern const char *wpa_supplicant_full_license2;
-extern const char *wpa_supplicant_full_license3;
-extern const char *wpa_supplicant_full_license4;
-extern const char *wpa_supplicant_full_license5;
+extern const char *const wpa_supplicant_full_license1;
+extern const char *const wpa_supplicant_full_license2;
+extern const char *const wpa_supplicant_full_license3;
+extern const char *const wpa_supplicant_full_license4;
+extern const char *const wpa_supplicant_full_license5;
 #endif /* CONFIG_NO_STDOUT_DEBUG */
 
 struct wpa_sm;
@@ -518,7 +518,7 @@ struct wpa_supplicant {
        unsigned int last_scan_res_size;
        struct os_reltime last_scan;
 
-       struct wpa_driver_ops *driver;
+       const struct wpa_driver_ops *driver;
        int interface_removed; /* whether the network interface has been
                                * removed */
        struct wpa_sm *wpa;