aboutsummaryrefslogtreecommitdiff
path: root/src/escrow/plugin_escrow_plaintext.c
diff options
context:
space:
mode:
authorjospaeth <spaethj@in.tum.de>2020-09-01 19:20:07 +0200
committerjospaeth <spaethj@in.tum.de>2020-09-01 19:20:07 +0200
commitdb199dd2280071adafc14ff66cfa1c21399f06c2 (patch)
tree4304101abda07cab1635936a7c7549b483411e2c /src/escrow/plugin_escrow_plaintext.c
parentb3d2c4c9fe8837ad962ed33189b0807c7d634923 (diff)
downloadgnunet-db199dd2280071adafc14ff66cfa1c21399f06c2.tar.gz
gnunet-db199dd2280071adafc14ff66cfa1c21399f06c2.zip
change structure of struct GNUNET_ESCROW_Anchor
encode method name and ego name in anchor string implement anchor_string_to_data and anchor_data_to_string in escrow_api.c (not plugin-specific)
Diffstat (limited to 'src/escrow/plugin_escrow_plaintext.c')
-rw-r--r--src/escrow/plugin_escrow_plaintext.c44
1 files changed, 4 insertions, 40 deletions
diff --git a/src/escrow/plugin_escrow_plaintext.c b/src/escrow/plugin_escrow_plaintext.c
index 215c8127e..b26653667 100644
--- a/src/escrow/plugin_escrow_plaintext.c
+++ b/src/escrow/plugin_escrow_plaintext.c
@@ -266,8 +266,9 @@ verify_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
266 } 266 }
267 pk = GNUNET_IDENTITY_ego_get_private_key (ego); 267 pk = GNUNET_IDENTITY_ego_get_private_key (ego);
268 pkString = GNUNET_CRYPTO_ecdsa_private_key_to_string (pk); 268 pkString = GNUNET_CRYPTO_ecdsa_private_key_to_string (pk);
269 verificationResult = strcmp (pkString, 269 verificationResult = strncmp (pkString,
270 (char *)&escrowAnchor[1]) == 0 ? 270 (char *)&escrowAnchor[1],
271 escrowAnchor->size) == 0 ?
271 GNUNET_ESCROW_VALID : GNUNET_ESCROW_INVALID; 272 GNUNET_ESCROW_VALID : GNUNET_ESCROW_INVALID;
272 273
273 w->verificationResult = verificationResult; 274 w->verificationResult = verificationResult;
@@ -408,7 +409,7 @@ restore_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
408 } 409 }
409 if (GNUNET_OK != 410 if (GNUNET_OK !=
410 GNUNET_CRYPTO_ecdsa_private_key_from_string ((char *)&anchor[1], 411 GNUNET_CRYPTO_ecdsa_private_key_from_string ((char *)&anchor[1],
411 strlen ((char *)&anchor[1]), 412 anchor->size,
412 &pk)) 413 &pk))
413 { 414 {
414 w->ego = NULL; 415 w->ego = NULL;
@@ -445,41 +446,6 @@ plaintext_get_status (struct GNUNET_ESCROW_Handle *h,
445 446
446 447
447/** 448/**
448 * Deserialize an escrow anchor string into a GNUNET_ESCROW_Anchor struct
449 *
450 * @param h the handle for the escrow component
451 * @param anchorString the encoded escrow anchor string
452 *
453 * @return the deserialized data packed into a GNUNET_ESCROW_Anchor struct,
454 * NULL if we failed to parse the string
455 */
456struct GNUNET_ESCROW_Anchor *
457plaintext_anchor_string_to_data (struct GNUNET_ESCROW_Handle *h,
458 char *anchorString)
459{
460 return ESCROW_anchor_string_to_data (anchorString,
461 GNUNET_ESCROW_KEY_PLAINTEXT);
462}
463
464
465/**
466 * Serialize an escrow anchor struct into a string
467 *
468 * @param h the handle for the escrow component
469 * @param escrowAnchor the escrow anchor struct
470 *
471 * @return the encoded escrow anchor string
472 */
473char *
474plaintext_anchor_data_to_string (struct GNUNET_ESCROW_Handle *h,
475 struct GNUNET_ESCROW_Anchor *escrowAnchor)
476{
477 return ESCROW_anchor_data_to_string (escrowAnchor,
478 GNUNET_ESCROW_KEY_PLAINTEXT);
479}
480
481
482/**
483 * Cancel a plaintext plugin operation. 449 * Cancel a plaintext plugin operation.
484 * 450 *
485 * @param plugin_op_wrap the plugin operation wrapper containing the operation 451 * @param plugin_op_wrap the plugin operation wrapper containing the operation
@@ -537,8 +503,6 @@ libgnunet_plugin_escrow_plaintext_init (void *cls)
537 api->verify_key_escrow = &verify_plaintext_key_escrow; 503 api->verify_key_escrow = &verify_plaintext_key_escrow;
538 api->restore_key = &restore_plaintext_key_escrow; 504 api->restore_key = &restore_plaintext_key_escrow;
539 api->get_status = &plaintext_get_status; 505 api->get_status = &plaintext_get_status;
540 api->anchor_string_to_data = &plaintext_anchor_string_to_data;
541 api->anchor_data_to_string = &plaintext_anchor_data_to_string;
542 api->cancel_plugin_operation = &cancel_plaintext_operation; 506 api->cancel_plugin_operation = &cancel_plaintext_operation;
543 507
544 ph.state = ESCROW_PLUGIN_STATE_INIT; 508 ph.state = ESCROW_PLUGIN_STATE_INIT;