add some comments to make darthmama happy sync
authorVolker Birk <vb@pep-project.org>
Thu, 12 Dec 2019 10:51:22 +0100
branchsync
changeset 4266b7012c29e885
parent 4265 441c82c3d526
child 4267 497383fe8e2f
add some comments to make darthmama happy
src/key_reset.c
     1.1 --- a/src/key_reset.c	Thu Dec 12 06:31:35 2019 +0100
     1.2 +++ b/src/key_reset.c	Thu Dec 12 10:51:22 2019 +0100
     1.3 @@ -720,6 +720,8 @@
     1.4      *cmds = NULL;
     1.5      *size = 0;
     1.6  
     1.7 +    // convert to ASN.1 struct
     1.8 +
     1.9      Distribution_t *dist = (Distribution_t *) calloc(1, sizeof(Distribution_t));
    1.10      assert(dist);
    1.11      if (!dist)
    1.12 @@ -728,8 +730,6 @@
    1.13      dist->present = Distribution_PR_keyreset;
    1.14      dist->choice.keyreset.present = KeyReset_PR_commands;
    1.15  
    1.16 -    // convert to ASN.1 struct
    1.17 -
    1.18      for (const keyreset_command_list *cl = command_list; cl && cl->command; cl = cl->next) {
    1.19          Command_t *c = (Command_t *) calloc(1, sizeof(Command_t));
    1.20          assert(c);
    1.21 @@ -760,6 +760,8 @@
    1.22      if (status)
    1.23          goto the_end;
    1.24  
    1.25 +    // return result
    1.26 +
    1.27      *cmds = _cmds;
    1.28      *size = _size;
    1.29      goto the_end;
    1.30 @@ -781,11 +783,15 @@
    1.31      *command_list = NULL;
    1.32      keyreset_command_list *result = NULL;
    1.33  
    1.34 +    // decode
    1.35 +
    1.36      Distribution_t *dist = NULL;
    1.37      PEP_STATUS status = decode_Distribution_message(cmds, size, &dist);
    1.38      if (status)
    1.39          goto the_end;
    1.40  
    1.41 +    // check if these are key reset commands or not
    1.42 +
    1.43      assert(dist && dist->present == Distribution_PR_keyreset
    1.44              && dist->choice.keyreset.present == KeyReset_PR_commands);
    1.45  
    1.46 @@ -795,6 +801,8 @@
    1.47          goto the_end;
    1.48      }
    1.49  
    1.50 +    // convert from ASN.1 struct
    1.51 +
    1.52      result = new_keyreset_command_list(NULL);
    1.53      if (!result)
    1.54          goto enomem;
    1.55 @@ -819,6 +827,8 @@
    1.56              goto enomem;
    1.57      }
    1.58  
    1.59 +    // return result
    1.60 +
    1.61      *command_list = result;
    1.62      goto the_end;
    1.63