IOSAD-172 Convert decryptMessageDict (runWithPasswords) IOSAD-172
authorDirk Zimmermann <dz@pep.security>
Sat, 27 Jun 2020 12:43:50 +0200
branchIOSAD-172
changeset 1502e38cd3cd7fc9
parent 1501 391c6fd3ac7a
child 1503 69c4c29a5b8d
IOSAD-172 Convert decryptMessageDict (runWithPasswords)
pEpObjCAdapter/PEPInternalSession.m
     1.1 --- a/pEpObjCAdapter/PEPInternalSession.m	Sat Jun 27 12:47:39 2020 +0200
     1.2 +++ b/pEpObjCAdapter/PEPInternalSession.m	Sat Jun 27 12:43:50 2020 +0200
     1.3 @@ -28,6 +28,7 @@
     1.4  #import "PEPSync_Internal.h" // for [PEPSync createSession:]
     1.5  #import "PEPInternalConstants.h"
     1.6  #import "PEPPassphraseCache.h"
     1.7 +#import "PEPInternalSession+PassphraseCache.h"
     1.8  
     1.9  #import "key_reset.h"
    1.10  
    1.11 @@ -98,8 +99,8 @@
    1.12      }
    1.13  
    1.14      message *_src = PEP_messageDictToStruct(messageDict);
    1.15 -    message *_dst = NULL;
    1.16 -    stringlist_t *theKeys = NULL;
    1.17 +    __block message *_dst = NULL;
    1.18 +    __block stringlist_t * theKeys = NULL;
    1.19      PEPDecryptFlags theFlags = 0;
    1.20  
    1.21      if (flags) {
    1.22 @@ -112,12 +113,14 @@
    1.23  
    1.24      PEPRating internalRating = PEPRatingUndefined;
    1.25  
    1.26 -    PEPStatus theStatus = (PEPStatus) decrypt_message(_session,
    1.27 -                                                      _src,
    1.28 -                                                      &_dst,
    1.29 -                                                      &theKeys,
    1.30 -                                                      (PEP_rating *) &internalRating,
    1.31 -                                                      (PEP_decrypt_flags *) &theFlags);
    1.32 +    PEPStatus theStatus = (PEPStatus) [self runWithPasswords:^PEP_STATUS(PEP_SESSION  _Nonnull session) {
    1.33 +        return decrypt_message(session,
    1.34 +                               _src,
    1.35 +                               &_dst,
    1.36 +                               &theKeys,
    1.37 +                               (PEP_rating *) &internalRating,
    1.38 +                               (PEP_decrypt_flags *) &theFlags);
    1.39 +    }];
    1.40  
    1.41      if (status) {
    1.42          *status = theStatus;