diff --git a/src/security/openssl.hpp b/src/security/openssl.hpp
new file mode 100644
index 0000000..fdbf55a
--- /dev/null
+++ b/src/security/openssl.hpp
@@ -0,0 +1,47 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2014 Regents of the University of California.
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_SECURITY_OPENSSL_HPP
+#define NDN_SECURITY_OPENSSL_HPP
+
+// suppress deprecation warnings in OSX >= 10.7
+
+#if defined(__APPLE__)
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+#endif // __clang__
+
+#ifdef __GNUC__
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#pragma GCC diagnostic push
+#endif
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif // __GNUC__
+
+#endif
+
+
+#include <openssl/ssl.h>
+#include <openssl/sha.h>
+#include <openssl/rsa.h>
+
+
+#if defined(__APPLE__)
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif // __clang__
+
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#pragma GCC diagnostic pop
+#endif // __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+
+#endif
+
+
+#endif // NDN_SECURITY_OPENSSL_HPP
diff --git a/src/security/sec-tpm-memory.cpp b/src/security/sec-tpm-memory.cpp
index 6e4a371..3c77c15 100644
--- a/src/security/sec-tpm-memory.cpp
+++ b/src/security/sec-tpm-memory.cpp
@@ -10,9 +10,7 @@
 #include "sec-tpm-memory.hpp"
 #include "public-key.hpp"
 
-#include <openssl/ssl.h>
-#include <openssl/sha.h>
-#include <openssl/rsa.h>
+#include "openssl.hpp"
 #include "cryptopp.hpp"
 
 using namespace std;
@@ -24,29 +22,29 @@
  */
 class SecTpmMemory::RsaPrivateKey {
 public:
-  RsaPrivateKey(const uint8_t *keyDer, size_t keyDerLength)
+  RsaPrivateKey(const uint8_t* keyDer, size_t keyDerLength)
   {
     // Use a temporary pointer since d2i updates it.
-    const uint8_t *derPointer = keyDer;
+    const uint8_t* derPointer = keyDer;
     privateKey_ = d2i_RSAPrivateKey(NULL, &derPointer, keyDerLength);
     if (!privateKey_)
       throw Error("RsaPrivateKey constructor: Error decoding private key DER");
   }
-    
+
   ~RsaPrivateKey()
   {
     if (privateKey_)
       RSA_free(privateKey_);
   }
-    
-  rsa_st *
+
+  rsa_st*
   getPrivateKey()
   {
     return privateKey_;
   }
-    
+
 private:
-  rsa_st * privateKey_;
+  rsa_st*  privateKey_;
 };
 
 SecTpmMemory::~SecTpmMemory()
@@ -55,14 +53,14 @@
 
 void
 SecTpmMemory::setKeyPairForKeyName(const Name& keyName,
-                                   uint8_t *publicKeyDer, size_t publicKeyDerLength,
-                                   uint8_t *privateKeyDer, size_t privateKeyDerLength)
+                                   uint8_t* publicKeyDer, size_t publicKeyDerLength,
+                                   uint8_t* privateKeyDer, size_t privateKeyDerLength)
 {
   publicKeyStore_[keyName.toUri()]  = make_shared<PublicKey>(publicKeyDer, publicKeyDerLength);
   privateKeyStore_[keyName.toUri()] = make_shared<RsaPrivateKey>(privateKeyDer, privateKeyDerLength);
 }
 
-void 
+void
 SecTpmMemory::generateKeyPairInTpm(const Name& keyName, KeyType keyType, int keySize)
 {
 #if 1
@@ -71,7 +69,7 @@
 }
 
 void
-SecTpmMemory::deleteKeyPairInTpm(const Name &keyName)
+SecTpmMemory::deleteKeyPairInTpm(const Name& keyName)
 {
   throw Error("SecTpmMemory::deleteKeyPairInTpm not implemented");
 }
@@ -94,7 +92,7 @@
   return false;
 }
 
-shared_ptr<PublicKey> 
+shared_ptr<PublicKey>
 SecTpmMemory::getPublicKeyFromTpm(const Name& keyName)
 {
   PublicKeyStore::iterator publicKey = publicKeyStore_.find(keyName.toUri());
@@ -103,8 +101,8 @@
   return publicKey->second;
 }
 
-Block 
-SecTpmMemory::signInTpm(const uint8_t *data, size_t dataLength,
+Block
+SecTpmMemory::signInTpm(const uint8_t* data, size_t dataLength,
                         const Name& keyName,
                         DigestAlgorithm digestAlgorithm)
 {
@@ -115,17 +113,17 @@
   PrivateKeyStore::iterator privateKey = privateKeyStore_.find(keyName.toUri());
   if (privateKey == privateKeyStore_.end())
     throw Error(string("MemoryPrivateKeyStorage: Cannot find private key ") + keyName.toUri());
-  
+
   uint8_t digest[SHA256_DIGEST_LENGTH];
   SHA256_CTX sha256;
   SHA256_Init(&sha256);
   SHA256_Update(&sha256, data, dataLength);
-  SHA256_Final(digest, &sha256);
+  SHA256_Final(digest,& sha256);
 
   BufferPtr signatureBuffer = make_shared<Buffer>();
   signatureBuffer->resize(RSA_size(privateKey->second->getPrivateKey()));
-  
-  unsigned int signatureBitsLength;  
+
+  unsigned int signatureBitsLength;
   if (!RSA_sign(NID_sha256, digest, sizeof(digest),
                 signatureBuffer->buf(),
                 &signatureBitsLength,
@@ -153,7 +151,7 @@
 #endif
 }
 
-void 
+void
 SecTpmMemory::generateSymmetricKeyInTpm(const Name& keyName, KeyType keyType, int keySize)
 {
 #if 1
diff --git a/src/security/sec-tpm-memory.hpp b/src/security/sec-tpm-memory.hpp
index de48201..2c8cc2b 100644
--- a/src/security/sec-tpm-memory.hpp
+++ b/src/security/sec-tpm-memory.hpp
@@ -23,7 +23,7 @@
 public:
   struct Error : public SecTpm::Error { Error(const std::string &what) : SecTpm::Error(what) {} };
 
-  virtual 
+  virtual
   ~SecTpmMemory();
 
   /******************************
@@ -43,7 +43,7 @@
   {
     m_inTerminal = inTerminal;
   }
-  
+
   virtual bool
   getInTerminal()
   {
@@ -62,34 +62,34 @@
     return !locked();
   }
 
-  virtual void 
+  virtual void
   generateKeyPairInTpm(const Name& keyName, KeyType keyType, int keySize);
 
-  virtual shared_ptr<PublicKey> 
+  virtual shared_ptr<PublicKey>
   getPublicKeyFromTpm(const Name& keyName);
 
   virtual void
   deleteKeyPairInTpm(const Name &keyName);
 
-  virtual Block 
-  signInTpm(const uint8_t *data, size_t dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm);
-  
-  virtual ConstBufferPtr 
+  virtual Block
+  signInTpm(const uint8_t* data, size_t dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm);
+
+  virtual ConstBufferPtr
   decryptInTpm(const uint8_t* data, size_t dataLength, const Name& keyName, bool isSymmetric);
 
   virtual ConstBufferPtr
   encryptInTpm(const uint8_t* data, size_t dataLength, const Name& keyName, bool isSymmetric);
 
-  virtual void 
+  virtual void
   generateSymmetricKeyInTpm(const Name& keyName, KeyType keyType, int keySize);
 
   virtual bool
-  doesKeyExistInTpm(const Name& keyName, KeyClass keyClass); 
+  doesKeyExistInTpm(const Name& keyName, KeyClass keyClass);
 
   virtual bool
   generateRandomBlock(uint8_t* res, size_t size);
 
-  virtual void 
+  virtual void
   addAppToACL(const Name& keyName, KeyClass keyClass, const std::string& appPath, AclType acl)
   {}
 
@@ -107,8 +107,8 @@
    * @param privateKeyDerLength The length of privateKeyDer.
    */
   void setKeyPairForKeyName(const Name& keyName,
-                            uint8_t *publicKeyDer, size_t publicKeyDerLength,
-                            uint8_t *privateKeyDer, size_t privateKeyDerLength);
+                            uint8_t* publicKeyDer, size_t publicKeyDerLength,
+                            uint8_t* privateKeyDer, size_t privateKeyDerLength);
 
 protected:
   /******************************
@@ -119,17 +119,17 @@
 
   virtual bool
   importPrivateKeyPkcs1IntoTpm(const Name& keyName, const uint8_t* buf, size_t size);
-  
+
   virtual bool
   importPublicKeyPkcs1IntoTpm(const Name& keyName, const uint8_t* buf, size_t size);
-  
-  
+
+
 private:
   class RsaPrivateKey;
 
   typedef std::map<std::string, shared_ptr<PublicKey> >     PublicKeyStore;
   typedef std::map<std::string, shared_ptr<RsaPrivateKey> > PrivateKeyStore;
-  
+
   PublicKeyStore  publicKeyStore_;  /**< The map key is the keyName.toUri() */
   PrivateKeyStore privateKeyStore_; /**< The map key is the keyName.toUri() */
 
diff --git a/src/security/sec-tpm-osx.cpp b/src/security/sec-tpm-osx.cpp
index ada0b81..24d47ea 100644
--- a/src/security/sec-tpm-osx.cpp
+++ b/src/security/sec-tpm-osx.cpp
@@ -35,7 +35,7 @@
     : m_passwordSet(false)
     , m_inTerminal(false)
   {}
-  
+
   /**
    * @brief Convert NDN name of a key to internal name of the key.
    *
@@ -43,62 +43,62 @@
    * @param keyClass
    * @return the internal key name
    */
-  std::string 
+  std::string
   toInternalKeyName(const Name & keyName, KeyClass keyClass);
-  
+
   /**
    * @brief Get key.
    *
-   * @param keyName 
+   * @param keyName
    * @param keyClass
    * @returns pointer to the key
    */
-  SecKeychainItemRef 
+  SecKeychainItemRef
   getKey(const Name & keyName, KeyClass keyClass);
-  
+
   /**
    * @brief Convert keyType to MAC OS symmetric key key type
    *
    * @param keyType
    * @returns MAC OS key type
    */
-  const CFTypeRef 
+  const CFTypeRef
   getSymKeyType(KeyType keyType);
-  
+
   /**
    * @brief Convert keyType to MAC OS asymmetirc key type
    *
    * @param keyType
    * @returns MAC OS key type
    */
-  const CFTypeRef 
+  const CFTypeRef
   getAsymKeyType(KeyType keyType);
-  
+
   /**
    * @brief Convert keyClass to MAC OS key class
    *
    * @param keyClass
    * @returns MAC OS key class
    */
-  const CFTypeRef 
+  const CFTypeRef
   getKeyClass(KeyClass keyClass);
-  
+
   /**
    * @brief Convert digestAlgo to MAC OS algorithm id
    *
    * @param digestAlgo
    * @returns MAC OS algorithm id
    */
-  const CFStringRef 
+  const CFStringRef
   getDigestAlgorithm(DigestAlgorithm digestAlgo);
-  
+
   /**
    * @brief Get the digest size of the corresponding algorithm
    *
    * @param digestAlgo
    * @return digest size
    */
-  long 
+  long
   getDigestSize(DigestAlgorithm digestAlgo);
 
   ///////////////////////////////////////////////
@@ -121,7 +121,7 @@
     SecKeychainSetUserInteractionAllowed (true);
 
   OSStatus res = SecKeychainCopyDefault(&m_impl->m_keyChainRef);
- 
+
   if (res == errSecNoDefaultKeychain) //If no default key chain, create one.
     throw Error("No default keychain, create one first!");
 }
@@ -178,7 +178,7 @@
 bool
 SecTpmOsx::unlockTpm(const char* password, size_t passwordLength, bool usePassword)
 {
-  OSStatus res; 
+  OSStatus res;
 
   // If the default key chain is already unlocked, return immediately.
   if(!locked())
@@ -207,26 +207,26 @@
       bool locked = true;
       const char* fmt = "Password to unlock the default keychain: ";
       int count = 0;
-      
+
       while(locked)
         {
           if(count > 2)
             break;
-          
+
           char* getPassword = NULL;
           getPassword = getpass(fmt);
           count++;
-          
+
           if (!getPassword)
             continue;
-          
+
           res = SecKeychainUnlock(m_impl->m_keyChainRef,
                                   strlen(getPassword),
                                   getPassword,
                                   true);
-          
+
           memset(getPassword, 0, strlen(getPassword));
-          
+
           if(res == errSecSuccess)
             break;
         }
@@ -240,10 +240,10 @@
   return !locked();
 }
 
-void 
+void
 SecTpmOsx::generateKeyPairInTpmInternal(const Name & keyName, KeyType keyType, int keySize, bool retry)
-{ 
-    
+{
+
   if(doesKeyExistInTpm(keyName, KEY_CLASS_PUBLIC)){
     _LOG_DEBUG("keyName has existed");
     throw Error("keyName has existed");
@@ -253,10 +253,10 @@
 
   SecKeyRef publicKey, privateKey;
 
-  CFStringRef keyLabel = CFStringCreateWithCString(NULL, 
-                                                   keyNameUri.c_str(), 
+  CFStringRef keyLabel = CFStringCreateWithCString(NULL,
+                                                   keyNameUri.c_str(),
                                                    kCFStringEncodingUTF8);
-    
+
   CFMutableDictionaryRef attrDict = CFDictionaryCreateMutable(NULL,
                                                               3,
                                                               &kCFTypeDictionaryKeyCallBacks,
@@ -274,7 +274,7 @@
       CFRelease(privateKey);
       return;
     }
-  
+
   if (res == errSecAuthFailed && !retry)
     {
       if(unlockTpm(0, 0, false))
@@ -292,11 +292,11 @@
 void
 SecTpmOsx::deleteKeyPairInTpmInternal(const Name &keyName, bool retry)
 {
-  CFStringRef keyLabel = CFStringCreateWithCString(NULL, 
-                                                   keyName.toUri().c_str(), 
+  CFStringRef keyLabel = CFStringCreateWithCString(NULL,
+                                                   keyName.toUri().c_str(),
                                                    kCFStringEncodingUTF8);
 
-  CFMutableDictionaryRef searchDict = 
+  CFMutableDictionaryRef searchDict =
     CFDictionaryCreateMutable(NULL, 5, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
 
   CFDictionaryAddValue(searchDict, kSecClass, kSecClassKey);
@@ -306,7 +306,7 @@
 
   if (res == errSecSuccess)
     return;
-  
+
   if (res == errSecAuthFailed && !retry)
     {
       if(unlockTpm(0, 0, false))
@@ -314,7 +314,7 @@
     }
 }
 
-void 
+void
 SecTpmOsx::generateSymmetricKeyInTpm(const Name & keyName, KeyType keyType, int keySize)
 {
   throw Error("SecTpmOsx::generateSymmetricKeyInTpm is not supported");
@@ -328,8 +328,8 @@
   //                                                             &kCFTypeDictionaryKeyCallBacks,
   //                                                             &kCFTypeDictionaryValueCallBacks);
 
-  // CFStringRef keyLabel = CFStringCreateWithCString(NULL, 
-  //                                                  keyNameUri.c_str(), 
+  // CFStringRef keyLabel = CFStringCreateWithCString(NULL,
+  //                                                  keyNameUri.c_str(),
   //                                                  kCFStringEncodingUTF8);
 
   // CFDictionaryAddValue(attrDict, kSecAttrKeyType, m_impl->getSymKeyType(keyType));
@@ -341,7 +341,7 @@
 
   // SecKeyRef symmetricKey = SecKeyGenerateSymmetric(attrDict, &error);
 
-  // if (error) 
+  // if (error)
   //   throw Error("Fail to create a symmetric key");
 }
 
@@ -416,12 +416,19 @@
     privateKeyAlgorithm.MessageEnd();
     DEREncodeOctetString(privateKeyInfo, CFDataGetBytePtr(exportedKey), CFDataGetLength(exportedKey));
   }
-  privateKeyInfo.MessageEnd(); 
+  privateKeyInfo.MessageEnd();
 
   CFRelease(exportedKey);
   return pkcs1Os.buf();
 }
 
+#ifdef __GNUC__
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#pragma GCC diagnostic push
+#endif // __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif // __GNUC__
+
 bool
 SecTpmOsx::importPrivateKeyPkcs1IntoTpmInternal(const Name& keyName, const uint8_t* buf, size_t size, bool retry)
 {
@@ -445,7 +452,7 @@
     }
     BERDecodeOctetString(privateKeyInfo, rawKeyBits);
   }
-  privateKeyInfo.MessageEnd(); 
+  privateKeyInfo.MessageEnd();
 
   CFDataRef importedKey = CFDataCreateWithBytesNoCopy(NULL,
                                                       rawKeyBits.BytePtr(),
@@ -459,15 +466,18 @@
   keyParams.version = SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION;
   keyParams.keyAttributes = CSSM_KEYATTR_EXTRACTABLE | CSSM_KEYATTR_PERMANENT;
   SecAccessRef access;
-  CFStringRef keyLabel = CFStringCreateWithCString(NULL, 
-                                                   keyName.toUri().c_str(), 
+  CFStringRef keyLabel = CFStringCreateWithCString(NULL,
+                                                   keyName.toUri().c_str(),
                                                    kCFStringEncodingUTF8);
   SecAccessCreate(keyLabel, NULL, &access);
   keyParams.accessRef = access;
   CFArrayRef outItems;
 
+#ifdef __clang__
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
+#endif // __clang__
+
   OSStatus res = SecKeychainItemImport (importedKey,
                                         NULL,
                                         &externalFormat,
@@ -476,8 +486,11 @@
                                         &keyParams,
                                         m_impl->m_keyChainRef,
                                         &outItems);
+
+#ifdef __clang__
 #pragma clang diagnostic pop
-  
+#endif // __clang__
+
   if(res != errSecSuccess)
     {
       if(res == errSecAuthFailed && !retry)
@@ -502,20 +515,24 @@
     attrList.count++;
   }
 
-  res = SecKeychainItemModifyAttributesAndData(privateKey, 
+  res = SecKeychainItemModifyAttributesAndData(privateKey,
                                                &attrList,
                                                0,
                                                NULL);
-  
+
   if(res != errSecSuccess)
     {
       return false;
     }
- 
+
   CFRelease(importedKey);
   return true;
 }
 
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#pragma GCC diagnostic pop
+#endif // __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+
 bool
 SecTpmOsx::importPublicKeyPkcs1IntoTpm(const Name& keyName, const uint8_t* buf, size_t size)
 {
@@ -551,11 +568,11 @@
     attrList.count++;
   }
 
-  res = SecKeychainItemModifyAttributesAndData(publicKey, 
+  res = SecKeychainItemModifyAttributesAndData(publicKey,
                                                &attrList,
                                                0,
                                                NULL);
-  
+
   if(res != errSecSuccess)
     return false;
 
@@ -567,14 +584,14 @@
 SecTpmOsx::signInTpmInternal(const uint8_t *data, size_t dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm, bool retry)
 {
   _LOG_TRACE("OSXPrivateKeyStorage::Sign");
-    
+
   CFDataRef dataRef = CFDataCreateWithBytesNoCopy(NULL,
                                                   data,
                                                   dataLength,
                                                   kCFAllocatorNull);
 
   SecKeyRef privateKey = (SecKeyRef)m_impl->getKey(keyName, KEY_CLASS_PRIVATE);
-    
+
   CFErrorRef error;
   SecTransformRef signer = SecSignTransformCreate((SecKeyRef)privateKey, &error);
   if (error) throw Error("Fail to create signer");
@@ -612,7 +629,7 @@
   CFDataRef signature = (CFDataRef) SecTransformExecute(signer, &error);
   if (error)
     {
-      if(!retry) 
+      if(!retry)
         {
           if(unlockTpm(0, 0, false))
             return signInTpmInternal(data, dataLength, keyName, digestAlgorithm, true);
@@ -650,7 +667,7 @@
   //                                  );
 
   // // _LOG_DEBUG("CreateData");
-    
+
   // SecKeyRef decryptKey = (SecKeyRef)m_impl->getKey(keyName, keyClass);
 
   // // _LOG_DEBUG("GetKey");
@@ -675,22 +692,22 @@
 
   // return make_shared<Buffer>(CFDataGetBytePtr(output), CFDataGetLength(output));
 }
-  
+
 void
 SecTpmOsx::addAppToACL(const Name & keyName, KeyClass keyClass, const string & appPath, AclType acl)
 {
   if(keyClass == KEY_CLASS_PRIVATE && acl == ACL_TYPE_PRIVATE)
     {
       SecKeychainItemRef privateKey = m_impl->getKey(keyName, keyClass);
-      
+
       SecAccessRef accRef;
       OSStatus acc_res = SecKeychainItemCopyAccess(privateKey, &accRef);
-      
+
       CFArrayRef signACL = SecAccessCopyMatchingACLList(accRef,
                                                         kSecACLAuthorizationSign);
-      
+
       SecACLRef aclRef = (SecACLRef) CFArrayGetValueAtIndex(signACL, 0);
-      
+
       CFArrayRef appList;
       CFStringRef description;
       SecKeychainPromptSelector promptSelector;
@@ -698,22 +715,22 @@
                                             &appList,
                                             &description,
                                             &promptSelector);
-      
+
       CFMutableArrayRef newAppList = CFArrayCreateMutableCopy(NULL,
                                                               0,
                                                               appList);
-      
+
       SecTrustedApplicationRef trustedApp;
       acl_res = SecTrustedApplicationCreateFromPath(appPath.c_str(),
                                                     &trustedApp);
-      
+
       CFArrayAppendValue(newAppList, trustedApp);
-      
+
       acl_res = SecACLSetContents(aclRef,
                                   newAppList,
                                   description,
                                   promptSelector);
-      
+
       acc_res = SecKeychainItemSetAccess(privateKey, accRef);
     }
 }
@@ -729,12 +746,12 @@
   //   keyClass = KEY_CLASS_SYMMETRIC;
   // else
   //   keyClass = KEY_CLASS_PUBLIC;
-    
+
   // CFDataRef dataRef = CFDataCreate(NULL,
   //                                  reinterpret_cast<const unsigned char*>(data),
   //                                  dataLength
   //                                  );
-    
+
   // SecKeyRef encryptKey = (SecKeyRef)m_impl->getKey(keyName, keyClass);
 
   // CFErrorRef error;
@@ -762,10 +779,10 @@
 
   string keyNameUri = m_impl->toInternalKeyName(keyName, keyClass);
 
-  CFStringRef keyLabel = CFStringCreateWithCString(NULL, 
-                                                   keyNameUri.c_str(), 
+  CFStringRef keyLabel = CFStringCreateWithCString(NULL,
+                                                   keyNameUri.c_str(),
                                                    kCFStringEncodingUTF8);
-    
+
   CFMutableDictionaryRef attrDict = CFDictionaryCreateMutable(NULL,
                                                               4,
                                                               &kCFTypeDictionaryKeyCallBacks,
@@ -775,10 +792,10 @@
   // CFDictionaryAddValue(attrDict, kSecAttrKeyClass, m_impl->getKeyClass(keyClass));
   CFDictionaryAddValue(attrDict, kSecAttrLabel, keyLabel);
   CFDictionaryAddValue(attrDict, kSecReturnRef, kCFBooleanTrue);
-    
+
   SecKeychainItemRef itemRef;
   OSStatus res = SecItemCopyMatching((CFDictionaryRef)attrDict, (CFTypeRef*)&itemRef);
-    
+
   if(res == errSecSuccess)
     return true;
   else
@@ -801,10 +818,10 @@
 {
   string keyNameUri = toInternalKeyName(keyName, keyClass);
 
-  CFStringRef keyLabel = CFStringCreateWithCString(NULL, 
-                                                   keyNameUri.c_str(), 
+  CFStringRef keyLabel = CFStringCreateWithCString(NULL,
+                                                   keyNameUri.c_str(),
                                                    kCFStringEncodingUTF8);
-    
+
   CFMutableDictionaryRef attrDict = CFDictionaryCreateMutable(NULL,
                                                               5,
                                                               &kCFTypeDictionaryKeyCallBacks,
@@ -814,11 +831,11 @@
   CFDictionaryAddValue(attrDict, kSecAttrLabel, keyLabel);
   CFDictionaryAddValue(attrDict, kSecAttrKeyClass, getKeyClass(keyClass));
   CFDictionaryAddValue(attrDict, kSecReturnRef, kCFBooleanTrue);
-    
+
   SecKeychainItemRef keyItem;
 
   OSStatus res = SecItemCopyMatching((CFDictionaryRef) attrDict, (CFTypeRef*)&keyItem);
-    
+
   if(res != errSecSuccess){
     _LOG_DEBUG("Fail to find the key!");
     return NULL;
@@ -826,8 +843,8 @@
   else
     return keyItem;
 }
-  
-string 
+
+string
 SecTpmOsx::Impl::toInternalKeyName(const Name & keyName, KeyClass keyClass)
 {
   string keyUri = keyName.toUri();
@@ -838,7 +855,7 @@
     return keyUri;
 }
 
-const CFTypeRef 
+const CFTypeRef
 SecTpmOsx::Impl::getAsymKeyType(KeyType keyType)
 {
   switch(keyType){
@@ -850,7 +867,7 @@
   }
 }
 
-const CFTypeRef 
+const CFTypeRef
 SecTpmOsx::Impl::getSymKeyType(KeyType keyType)
 {
   switch(keyType){
@@ -862,7 +879,7 @@
   }
 }
 
-const CFTypeRef 
+const CFTypeRef
 SecTpmOsx::Impl::getKeyClass(KeyClass keyClass)
 {
   switch(keyClass){
@@ -878,7 +895,7 @@
   }
 }
 
-const CFStringRef 
+const CFStringRef
 SecTpmOsx::Impl::getDigestAlgorithm(DigestAlgorithm digestAlgo)
 {
   switch(digestAlgo){
@@ -896,7 +913,7 @@
   }
 }
 
-long 
+long
 SecTpmOsx::Impl::getDigestSize(DigestAlgorithm digestAlgo)
 {
   switch(digestAlgo){
@@ -911,5 +928,5 @@
     return -1;
   }
 }
-  
+
 } // namespace ndn
diff --git a/src/util/regex/regex-backref-manager.hpp b/src/util/regex/regex-backref-manager.hpp
index bebaedb..f11e431 100644
--- a/src/util/regex/regex-backref-manager.hpp
+++ b/src/util/regex/regex-backref-manager.hpp
@@ -18,21 +18,21 @@
 {
 public:
   RegexBackrefManager(){}
-    
+
   virtual ~RegexBackrefManager();
-    
-  int 
+
+  int
   pushRef(shared_ptr<RegexMatcher> matcher);
-    
-  void 
+
+  void
   popRef();
 
-  int 
+  size_t
   size();
-    
-  shared_ptr<RegexMatcher> 
+
+  shared_ptr<RegexMatcher>
   getBackRef(int i);
-    
+
 private:
   std::vector<shared_ptr<RegexMatcher> > m_backRefs;
 };
@@ -43,10 +43,10 @@
   m_backRefs.clear();
 }
 
-inline int 
+inline int
 RegexBackrefManager::pushRef(shared_ptr<RegexMatcher> matcher)
 {
-  int last = m_backRefs.size();
+  size_t last = m_backRefs.size();
   m_backRefs.push_back(matcher);
 
   return last;
@@ -58,13 +58,13 @@
   m_backRefs.pop_back();
 }
 
-inline int 
+inline size_t
 RegexBackrefManager::size()
 {
   return m_backRefs.size();
 }
-    
-inline shared_ptr<RegexMatcher> 
+
+inline shared_ptr<RegexMatcher>
 RegexBackrefManager::getBackRef(int i)
 {
   return m_backRefs[i];
