build: Warnings correction for gcc 4.2
Also in this commit some code style corrections.
Change-Id: Idf2b5b96b328fb3dbea7440362c84d7759a10ec5
Refs: #1429
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];