diff options
author | jospaeth <spaethj@in.tum.de> | 2020-08-17 09:53:02 +0200 |
---|---|---|
committer | jospaeth <spaethj@in.tum.de> | 2020-08-17 09:53:02 +0200 |
commit | d92ff2d49b468150e61d192fb0c490d5da1f0cb5 (patch) | |
tree | a7c6b9dffece51d7a55efb4c4562d9b2b170c134 /src | |
parent | 72a66ee46f2b2bcb3d2cc4376c6c7dc6b57c86aa (diff) | |
download | gnunet-d92ff2d49b468150e61d192fb0c490d5da1f0cb5.tar.gz gnunet-d92ff2d49b468150e61d192fb0c490d5da1f0cb5.zip |
fix some const issues
Diffstat (limited to 'src')
-rw-r--r-- | src/escrow/plugin_escrow_gns.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/escrow/plugin_escrow_gns.c b/src/escrow/plugin_escrow_gns.c index 4f9ce64a1..3f7f8a47c 100644 --- a/src/escrow/plugin_escrow_gns.c +++ b/src/escrow/plugin_escrow_gns.c | |||
@@ -70,12 +70,12 @@ struct IdentityOperationEntry | |||
70 | /** | 70 | /** |
71 | * Private key of the respective ego | 71 | * Private key of the respective ego |
72 | */ | 72 | */ |
73 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; | 73 | struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Name of the respective ego | 76 | * Name of the respective ego |
77 | */ | 77 | */ |
78 | const char *name; | 78 | char *name; |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Index of the respective share | 81 | * Index of the respective share |
@@ -104,7 +104,7 @@ struct PkEntry | |||
104 | /** | 104 | /** |
105 | * private key | 105 | * private key |
106 | */ | 106 | */ |
107 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; | 107 | struct GNUNET_CRYPTO_EcdsaPrivateKey pk; |
108 | 108 | ||
109 | /** | 109 | /** |
110 | * index of the respective share | 110 | * index of the respective share |
@@ -252,12 +252,12 @@ struct ESCROW_GnsPluginOperation | |||
252 | /** | 252 | /** |
253 | * The name of the ego | 253 | * The name of the ego |
254 | */ | 254 | */ |
255 | const char *egoName; | 255 | char *egoName; |
256 | 256 | ||
257 | /** | 257 | /** |
258 | * Private key of the ego | 258 | * Private key of the ego |
259 | */ | 259 | */ |
260 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; | 260 | struct GNUNET_CRYPTO_EcdsaPrivateKey pk; |
261 | 261 | ||
262 | /** | 262 | /** |
263 | * User secret string | 263 | * User secret string |
@@ -350,6 +350,8 @@ cleanup_plugin_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap) | |||
350 | p_op->id_ops_tail, | 350 | p_op->id_ops_tail, |
351 | curr_id_op); | 351 | curr_id_op); |
352 | GNUNET_IDENTITY_cancel (curr_id_op->id_op); | 352 | GNUNET_IDENTITY_cancel (curr_id_op->id_op); |
353 | GNUNET_free (curr_id_op->pk); | ||
354 | GNUNET_free (curr_id_op->name); | ||
353 | GNUNET_free (curr_id_op); | 355 | GNUNET_free (curr_id_op); |
354 | } | 356 | } |
355 | /* clean up escrow pk list */ | 357 | /* clean up escrow pk list */ |
@@ -397,6 +399,7 @@ cleanup_plugin_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap) | |||
397 | /* cancel identity operation */ | 399 | /* cancel identity operation */ |
398 | if (NULL != p_op->id_op) | 400 | if (NULL != p_op->id_op) |
399 | GNUNET_IDENTITY_cancel (p_op->id_op); | 401 | GNUNET_IDENTITY_cancel (p_op->id_op); |
402 | GNUNET_free (p_op->egoName); | ||
400 | GNUNET_free (p_op); | 403 | GNUNET_free (p_op); |
401 | GNUNET_free (plugin_op_wrap); | 404 | GNUNET_free (plugin_op_wrap); |
402 | } | 405 | } |
@@ -422,7 +425,7 @@ split_private_key (struct ESCROW_GnsPluginOperation *p_op) | |||
422 | 425 | ||
423 | keyshares = GNUNET_malloc (sizeof (sss_Keyshare) * p_op->shares); | 426 | keyshares = GNUNET_malloc (sizeof (sss_Keyshare) * p_op->shares); |
424 | sss_create_keyshares (keyshares, | 427 | sss_create_keyshares (keyshares, |
425 | p_op->pk->d, | 428 | p_op->pk.d, |
426 | p_op->shares, | 429 | p_op->shares, |
427 | p_op->share_threshold); | 430 | p_op->share_threshold); |
428 | 431 | ||
@@ -541,7 +544,7 @@ distribute_keyshares (struct ESCROW_PluginOperationWrapper *plugin_op_wrap, | |||
541 | 544 | ||
542 | curr_ns_qe->plugin_op_wrap = plugin_op_wrap; | 545 | curr_ns_qe->plugin_op_wrap = plugin_op_wrap; |
543 | curr_ns_qe->ns_qe = GNUNET_NAMESTORE_records_store (ns_h, | 546 | curr_ns_qe->ns_qe = GNUNET_NAMESTORE_records_store (ns_h, |
544 | curr_pk->pk, | 547 | &curr_pk->pk, |
545 | curr_label, | 548 | curr_label, |
546 | 1, | 549 | 1, |
547 | curr_rd, | 550 | curr_rd, |
@@ -631,7 +634,7 @@ escrow_id_created (void *cls, | |||
631 | 634 | ||
632 | /* insert pk into our list */ | 635 | /* insert pk into our list */ |
633 | pk_entry = GNUNET_new (struct PkEntry); | 636 | pk_entry = GNUNET_new (struct PkEntry); |
634 | pk_entry->pk = pk; | 637 | pk_entry->pk = *pk; |
635 | pk_entry->i = id_op->i; | 638 | pk_entry->i = id_op->i; |
636 | GNUNET_CONTAINER_DLL_insert_tail (p_op->escrow_pks_head, | 639 | GNUNET_CONTAINER_DLL_insert_tail (p_op->escrow_pks_head, |
637 | p_op->escrow_pks_tail, | 640 | p_op->escrow_pks_tail, |
@@ -819,7 +822,7 @@ create_escrow_identities (struct ESCROW_PluginOperationWrapper *plugin_op_wrap, | |||
819 | { | 822 | { |
820 | // the escrow id already exists, so insert the pk into our list | 823 | // the escrow id already exists, so insert the pk into our list |
821 | curr_pk_entry = GNUNET_new (struct PkEntry); | 824 | curr_pk_entry = GNUNET_new (struct PkEntry); |
822 | curr_pk_entry->pk = curr_pk; | 825 | curr_pk_entry->pk = *curr_pk; |
823 | curr_pk_entry->i = i; | 826 | curr_pk_entry->i = i; |
824 | GNUNET_CONTAINER_DLL_insert (p_op->escrow_pks_head, | 827 | GNUNET_CONTAINER_DLL_insert (p_op->escrow_pks_head, |
825 | p_op->escrow_pks_tail, | 828 | p_op->escrow_pks_tail, |
@@ -953,7 +956,7 @@ start_gns_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
953 | p_op->sched_task = GNUNET_SCHEDULER_add_now (&start_cont, plugin_op_wrap); | 956 | p_op->sched_task = GNUNET_SCHEDULER_add_now (&start_cont, plugin_op_wrap); |
954 | return plugin_op_wrap; | 957 | return plugin_op_wrap; |
955 | } | 958 | } |
956 | p_op->pk = GNUNET_IDENTITY_ego_get_private_key (ego); | 959 | p_op->pk = *GNUNET_IDENTITY_ego_get_private_key (ego); |
957 | p_op->userSecret = GNUNET_strdup (userSecret); | 960 | p_op->userSecret = GNUNET_strdup (userSecret); |
958 | 961 | ||
959 | if (ESCROW_PLUGIN_STATE_POST_INIT == ph.state) | 962 | if (ESCROW_PLUGIN_STATE_POST_INIT == ph.state) |
@@ -979,6 +982,7 @@ process_keyshares (struct ESCROW_PluginOperationWrapper *plugin_op_wrap) | |||
979 | p_op = (struct ESCROW_GnsPluginOperation*)plugin_op_wrap->plugin_op; | 982 | p_op = (struct ESCROW_GnsPluginOperation*)plugin_op_wrap->plugin_op; |
980 | 983 | ||
981 | // TODO: check if enough keyshares have been restored, combine them | 984 | // TODO: check if enough keyshares have been restored, combine them |
985 | pk = NULL; | ||
982 | 986 | ||
983 | p_op->restore_pk_cont (p_op->restore_pk_cont_cls, pk); | 987 | p_op->restore_pk_cont (p_op->restore_pk_cont_cls, pk); |
984 | } | 988 | } |
@@ -1014,7 +1018,7 @@ restore_private_key (struct ESCROW_PluginOperationWrapper *plugin_op_wrap, | |||
1014 | void *cont_cls) | 1018 | void *cont_cls) |
1015 | { | 1019 | { |
1016 | struct ESCROW_GnsPluginOperation *p_op; | 1020 | struct ESCROW_GnsPluginOperation *p_op; |
1017 | struct GNUNET_CRYPTO_EcdsaPrivateKey *curr_escrow_pk, *ego_pk; | 1021 | struct GNUNET_CRYPTO_EcdsaPrivateKey *curr_escrow_pk; |
1018 | struct GNUNET_CRYPTO_EcdsaPublicKey curr_escrow_pub; | 1022 | struct GNUNET_CRYPTO_EcdsaPublicKey curr_escrow_pub; |
1019 | char *curr_escrow_name; | 1023 | char *curr_escrow_name; |
1020 | struct GnsLookupRequestEntry *curr_gns_lr; | 1024 | struct GnsLookupRequestEntry *curr_gns_lr; |
@@ -1069,13 +1073,11 @@ verify_restored_pk (void *cls, | |||
1069 | struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls; | 1073 | struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls; |
1070 | struct ESCROW_GnsPluginOperation *p_op; | 1074 | struct ESCROW_GnsPluginOperation *p_op; |
1071 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *ego_pk; | 1075 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *ego_pk; |
1072 | char *ego_pk_string; | ||
1073 | int verificationResult; | 1076 | int verificationResult; |
1074 | 1077 | ||
1075 | p_op = (struct ESCROW_GnsPluginOperation *)plugin_op_wrap->plugin_op; | 1078 | p_op = (struct ESCROW_GnsPluginOperation *)plugin_op_wrap->plugin_op; |
1076 | 1079 | ||
1077 | ego_pk = GNUNET_IDENTITY_ego_get_private_key (p_op->ego); | 1080 | ego_pk = GNUNET_IDENTITY_ego_get_private_key (p_op->ego); |
1078 | ego_pk_string = GNUNET_CRYPTO_ecdsa_private_key_to_string (ego_pk); | ||
1079 | verificationResult = memcmp (pk, | 1081 | verificationResult = memcmp (pk, |
1080 | ego_pk, | 1082 | ego_pk, |
1081 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)) | 1083 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)) |
@@ -1155,7 +1157,7 @@ ego_created (const struct GNUNET_IDENTITY_Ego *ego) | |||
1155 | for (curr = ph.plugin_op_head; NULL != curr; curr = curr->next) | 1157 | for (curr = ph.plugin_op_head; NULL != curr; curr = curr->next) |
1156 | { | 1158 | { |
1157 | curr_p_op = (struct ESCROW_GnsPluginOperation *)curr->plugin_op; | 1159 | curr_p_op = (struct ESCROW_GnsPluginOperation *)curr->plugin_op; |
1158 | curr_pk_string = GNUNET_CRYPTO_ecdsa_private_key_to_string (curr_p_op->pk); | 1160 | curr_pk_string = GNUNET_CRYPTO_ecdsa_private_key_to_string (&curr_p_op->pk); |
1159 | // compare the strings of the private keys | 1161 | // compare the strings of the private keys |
1160 | if (0 == strcmp (ego_pk_string, curr_pk_string)) | 1162 | if (0 == strcmp (ego_pk_string, curr_pk_string)) |
1161 | { | 1163 | { |
@@ -1216,7 +1218,7 @@ id_create_finished (void *cls, | |||
1216 | 1218 | ||
1217 | /* no error occurred, p_op->restore_cont will be called in ego_created, which | 1219 | /* no error occurred, p_op->restore_cont will be called in ego_created, which |
1218 | is called from ESCROW_list_ego after adding the new ego to our list */ | 1220 | is called from ESCROW_list_ego after adding the new ego to our list */ |
1219 | p_op->pk = pk; | 1221 | p_op->pk = *pk; |
1220 | } | 1222 | } |
1221 | 1223 | ||
1222 | 1224 | ||
@@ -1270,7 +1272,7 @@ restore_gns_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
1270 | p_op->h = h; | 1272 | p_op->h = h; |
1271 | // set cont here (has to be scheduled from the IDENTITY service when it finished) | 1273 | // set cont here (has to be scheduled from the IDENTITY service when it finished) |
1272 | p_op->cont = cb; | 1274 | p_op->cont = cb; |
1273 | p_op->egoName = egoName; | 1275 | p_op->egoName = GNUNET_strdup (egoName); |
1274 | p_op->userSecret = gns_anchor_data_to_string (h, escrowAnchor); | 1276 | p_op->userSecret = gns_anchor_data_to_string (h, escrowAnchor); |
1275 | 1277 | ||
1276 | w = GNUNET_new (struct ESCROW_Plugin_EgoContinuationWrapper); | 1278 | w = GNUNET_new (struct ESCROW_Plugin_EgoContinuationWrapper); |