encryption concept
authorVolker Birk <vb@pep-project.org>
Sat, 30 May 2015 03:11:38 +0200
changeset 305c5f423e79e6
parent 29 c4e98d9de729
child 31 83a083fb4810
encryption concept
CpEpEngine.cpp
CpEpEngine.h
pEpCOMServerAdapter.idl
pEpCOMServerAdapter_i.c
pEpCOMServerAdapter_i.h
     1.1 --- a/CpEpEngine.cpp	Sat May 30 01:30:02 2015 +0200
     1.2 +++ b/CpEpEngine.cpp	Sat May 30 03:11:38 2015 +0200
     1.3 @@ -713,27 +713,6 @@
     1.4      return S_OK;
     1.5  }
     1.6  
     1.7 -STDMETHODIMP CpEpEngine::examine_myself(pEp_identity_s * myself)
     1.8 -{
     1.9 -    assert(myself);
    1.10 -    if (myself == NULL)
    1.11 -        return E_INVALIDARG;
    1.12 -
    1.13 -    pEp_identity_cpp _ident(myself);
    1.14 -    _ident.me = true;
    1.15 -
    1.16 -    if (identity_queue.load()) {
    1.17 -        try {
    1.18 -            identity_queue.load()->push_front(_ident);
    1.19 -        }
    1.20 -        catch (bad_alloc) {
    1.21 -            return E_OUTOFMEMORY;
    1.22 -        }
    1.23 -    }
    1.24 -
    1.25 -    return S_OK;
    1.26 -}
    1.27 -
    1.28  STDMETHODIMP CpEpEngine::myself(struct pEp_identity_s *ident, struct pEp_identity_s *result)
    1.29  {
    1.30      assert(ident);
    1.31 @@ -915,26 +894,28 @@
    1.32      PEP_STATUS status = ::encrypt_message(get_session(), _src->msg, _extra, &msg_dst, PEP_enc_pieces);
    1.33      if (status != PEP_STATUS_OK)
    1.34          FAIL(L"cannot encrypt message");
    1.35 -    assert(msg_dst);
    1.36  
    1.37      ::free_stringlist(_extra);
    1.38  
    1.39 -    ITextMessage *i_dst;
    1.40 -    HRESULT hr = CTextMessage::CreateInstance(&i_dst);
    1.41 -    assert(hr == S_OK);
    1.42 -    
    1.43 -    if (hr != S_OK) {
    1.44 -        free_message(msg_dst);
    1.45 -        return hr;
    1.46 +    if (msg_dst) {
    1.47 +        ITextMessage *i_dst;
    1.48 +        HRESULT hr = CTextMessage::CreateInstance(&i_dst);
    1.49 +        assert(hr == S_OK);
    1.50 +
    1.51 +        if (hr != S_OK) {
    1.52 +            free_message(msg_dst);
    1.53 +            return hr;
    1.54 +        }
    1.55 +
    1.56 +        CTextMessage *_dst = dynamic_cast<CTextMessage *>(i_dst);
    1.57 +        assert(_dst);
    1.58 +
    1.59 +        ::free_message(_dst->msg);
    1.60 +        _dst->msg = msg_dst;
    1.61 +
    1.62 +        *dst = i_dst;
    1.63      }
    1.64  
    1.65 -    CTextMessage *_dst = dynamic_cast<CTextMessage *>(i_dst);
    1.66 -    assert(_dst);
    1.67 -
    1.68 -    ::free_message(_dst->msg);
    1.69 -    _dst->msg = msg_dst;
    1.70 -
    1.71 -    *dst = i_dst;
    1.72      return S_OK;
    1.73  }
    1.74  
     2.1 --- a/CpEpEngine.h	Sat May 30 01:30:02 2015 +0200
     2.2 +++ b/CpEpEngine.h	Sat May 30 03:11:38 2015 +0200
     2.3 @@ -140,7 +140,6 @@
     2.4      STDMETHOD(stop_keyserver_lookup)();
     2.5  
     2.6      STDMETHOD(examine_identity)(pEp_identity_s * ident);
     2.7 -    STDMETHOD(examine_myself)(pEp_identity_s * myself);
     2.8      STDMETHOD(verify)(BSTR text, BSTR signature, LPSAFEARRAY * key_list, pEp_STATUS * verify_status);
     2.9      STDMETHOD(myself)(struct pEp_identity_s *ident, struct pEp_identity_s *result);
    2.10      STDMETHOD(update_identity)(struct pEp_identity_s *ident, struct pEp_identity_s *result);
     3.1 --- a/pEpCOMServerAdapter.idl	Sat May 30 01:30:02 2015 +0200
     3.2 +++ b/pEpCOMServerAdapter.idl	Sat May 30 03:11:38 2015 +0200
     3.3 @@ -212,7 +212,6 @@
     3.4      HRESULT stop_keyserver_lookup();
     3.5  
     3.6      HRESULT examine_identity([in] struct pEp_identity_s * ident);
     3.7 -    HRESULT examine_myself([in] struct pEp_identity_s * myself);
     3.8      HRESULT myself([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
     3.9      HRESULT update_identity([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
    3.10      HRESULT key_compromized([in] BSTR fpr);
     4.1 --- a/pEpCOMServerAdapter_i.c	Sat May 30 01:30:02 2015 +0200
     4.2 +++ b/pEpCOMServerAdapter_i.c	Sat May 30 03:11:38 2015 +0200
     4.3 @@ -6,7 +6,7 @@
     4.4  
     4.5  
     4.6   /* File created by MIDL compiler version 8.00.0603 */
     4.7 -/* at Sat May 30 01:09:44 2015
     4.8 +/* at Sat May 30 01:53:09 2015
     4.9   */
    4.10  /* Compiler settings for pEpCOMServerAdapter.idl:
    4.11      Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0603 
     5.1 --- a/pEpCOMServerAdapter_i.h	Sat May 30 01:30:02 2015 +0200
     5.2 +++ b/pEpCOMServerAdapter_i.h	Sat May 30 03:11:38 2015 +0200
     5.3 @@ -4,7 +4,7 @@
     5.4  
     5.5  
     5.6   /* File created by MIDL compiler version 8.00.0603 */
     5.7 -/* at Sat May 30 01:09:44 2015
     5.8 +/* at Sat May 30 01:53:09 2015
     5.9   */
    5.10  /* Compiler settings for pEpCOMServerAdapter.idl:
    5.11      Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0603 
    5.12 @@ -775,9 +775,6 @@
    5.13          virtual HRESULT STDMETHODCALLTYPE examine_identity( 
    5.14              /* [in] */ struct pEp_identity_s *ident) = 0;
    5.15          
    5.16 -        virtual HRESULT STDMETHODCALLTYPE examine_myself( 
    5.17 -            /* [in] */ struct pEp_identity_s *myself) = 0;
    5.18 -        
    5.19          virtual HRESULT STDMETHODCALLTYPE myself( 
    5.20              /* [in] */ struct pEp_identity_s *ident,
    5.21              /* [retval][out] */ struct pEp_identity_s *result) = 0;
    5.22 @@ -938,10 +935,6 @@
    5.23              IpEpEngine * This,
    5.24              /* [in] */ struct pEp_identity_s *ident);
    5.25          
    5.26 -        HRESULT ( STDMETHODCALLTYPE *examine_myself )( 
    5.27 -            IpEpEngine * This,
    5.28 -            /* [in] */ struct pEp_identity_s *myself);
    5.29 -        
    5.30          HRESULT ( STDMETHODCALLTYPE *myself )( 
    5.31              IpEpEngine * This,
    5.32              /* [in] */ struct pEp_identity_s *ident,
    5.33 @@ -1065,9 +1058,6 @@
    5.34  #define IpEpEngine_examine_identity(This,ident)	\
    5.35      ( (This)->lpVtbl -> examine_identity(This,ident) ) 
    5.36  
    5.37 -#define IpEpEngine_examine_myself(This,myself)	\
    5.38 -    ( (This)->lpVtbl -> examine_myself(This,myself) ) 
    5.39 -
    5.40  #define IpEpEngine_myself(This,ident,result)	\
    5.41      ( (This)->lpVtbl -> myself(This,ident,result) ) 
    5.42