Project

General

Profile

Task #4075

Updated by Davide Pesavento over 6 years ago

Just an observation. The implementations of `BackEndOsx::sign`, `decrypt` BackEndOsx::sign, decrypt and `derivePublicKey` derivePublicKey don't use `m_impl`, m_impl, so they can be static.<br>  
 https://github.com/named-data/ndn-cxx/blob/fe4733a1608712e389fe10b329a9fd61575ad075/src/security/tpm/back-end-osx.hpp#L83 

 This means that `KeyHandleOsx::doSign`, `doDecrypt` KeyHandleOsx::doSign, doDecrypt and `doDerivePublicKey` doDerivePublicKey can call the static methods `BackEndOsx::sign`, BackEndOsx::sign, etc. and don't need the `m_impl` m_impl in `KeyHandleOsx`. KeyHandleOsx. For example, 

 ```cpp 
   

   return BackEndOsx::sign(m_key, digestAlgorithm, buf, size); 
 ``` 

 https://github.com/named-data/ndn-cxx/blob/0b60e7a9aaecc0e769d430c9484e4c8f3c778716/src/security/tpm/key-handle-osx.cpp#L40 

 Finally, you could remove `m_impl` m_impl from `KeyHandleOsx`, KeyHandleOsx, and the constructor can be simplified to omit the `impl` impl parameter. 
 https://github.com/named-data/ndn-cxx/blob/0b60e7a9aaecc0e769d430c9484e4c8f3c778716/src/security/tpm/key-handle-osx.hpp#L55 

 It's up to you. If you don't want this simplification, feel free to abandon this issue. 

Back