ENGINE-204 Make private key in message containing both regular pubkey + privkey being recognized as importable ENGINE-204
authorEdouard Tisserant <edouard@pep-project.org>
Wed, 03 May 2017 09:34:54 +0200
branchENGINE-204
changeset 1745373a181d7185
parent 1744 4d42c179c6bb
child 1861 c8b6b3d58d40
child 1862 881f5a1d8a40
ENGINE-204 Make private key in message containing both regular pubkey + privkey being recognized as importable
src/message_api.c
     1.1 --- a/src/message_api.c	Tue May 02 09:32:38 2017 +0200
     1.2 +++ b/src/message_api.c	Wed May 03 09:34:54 2017 +0200
     1.3 @@ -991,8 +991,13 @@
     1.4          if (bl && bl->value && bl->size && bl->size < MAX_KEY_SIZE
     1.5                  && is_key(bl))
     1.6          {
     1.7 -            import_key(session, bl->value, bl->size, private_idents);
     1.8 +            identity_list *local_private_idents = NULL;
     1.9 +            import_key(session, bl->value, bl->size, &local_private_idents);
    1.10              remove = true;
    1.11 +            if (*private_idents == NULL && local_private_idents != NULL)
    1.12 +                *private_idents = local_private_idents;
    1.13 +            else
    1.14 +                free_identity_list(local_private_idents);
    1.15          }
    1.16      }
    1.17      return remove;