security+util: mark all pimpl unique_ptrs const
Change-Id: I3966c4988dceb49c204e23967ba90729877bddf1
diff --git a/src/security/tpm/back-end-file.hpp b/src/security/tpm/back-end-file.hpp
index db58907..5609cba 100644
--- a/src/security/tpm/back-end-file.hpp
+++ b/src/security/tpm/back-end-file.hpp
@@ -134,7 +134,7 @@
private:
class Impl;
- unique_ptr<Impl> m_impl;
+ const unique_ptr<Impl> m_impl;
};
} // namespace tpm
diff --git a/src/security/tpm/back-end-mem.hpp b/src/security/tpm/back-end-mem.hpp
index 4bfa212..469b466 100644
--- a/src/security/tpm/back-end-mem.hpp
+++ b/src/security/tpm/back-end-mem.hpp
@@ -114,7 +114,7 @@
private:
class Impl;
- unique_ptr<Impl> m_impl;
+ const unique_ptr<Impl> m_impl;
};
} // namespace tpm
diff --git a/src/security/tpm/back-end-osx.hpp b/src/security/tpm/back-end-osx.hpp
index 29465c8..8310984 100644
--- a/src/security/tpm/back-end-osx.hpp
+++ b/src/security/tpm/back-end-osx.hpp
@@ -143,7 +143,7 @@
private:
class Impl;
- unique_ptr<Impl> m_impl;
+ const unique_ptr<Impl> m_impl;
};
} // namespace tpm
diff --git a/src/security/tpm/tpm.cpp b/src/security/tpm/tpm.cpp
index fad73b9..0ed1062 100644
--- a/src/security/tpm/tpm.cpp
+++ b/src/security/tpm/tpm.cpp
@@ -133,13 +133,14 @@
}
ConstBufferPtr
-Tpm::exportPrivateKey(const Name& keyName, const char* pw, size_t pwLen)
+Tpm::exportPrivateKey(const Name& keyName, const char* pw, size_t pwLen) const
{
return m_backEnd->exportKey(keyName, pw, pwLen);
}
bool
-Tpm::importPrivateKey(const Name& keyName, const uint8_t* pkcs8, size_t pkcs8Len, const char* pw, size_t pwLen)
+Tpm::importPrivateKey(const Name& keyName, const uint8_t* pkcs8, size_t pkcs8Len,
+ const char* pw, size_t pwLen)
{
try {
m_backEnd->importKey(keyName, pkcs8, pkcs8Len, pw, pwLen);
diff --git a/src/security/tpm/tpm.hpp b/src/security/tpm/tpm.hpp
index 82ea656..dde9d14 100644
--- a/src/security/tpm/tpm.hpp
+++ b/src/security/tpm/tpm.hpp
@@ -22,11 +22,11 @@
#ifndef NDN_SECURITY_TPM_TPM_HPP
#define NDN_SECURITY_TPM_TPM_HPP
-#include "../../common.hpp"
#include "../security-common.hpp"
#include "../../name.hpp"
#include "../key-params.hpp"
#include "key-handle.hpp"
+
#include <unordered_map>
namespace ndn {
@@ -154,12 +154,6 @@
*/
Tpm(const std::string& scheme, const std::string& location, unique_ptr<BackEnd> impl);
- BackEnd*
- getBackEnd()
- {
- return m_backEnd.get();
- }
-
/**
* @brief Create key for @p identityName according to @p params.
*
@@ -189,7 +183,7 @@
* @throw BackEnd::Error the key does not exist or it cannot be exported.
*/
ConstBufferPtr
- exportPrivateKey(const Name& keyName, const char* pw, size_t pwLen);
+ exportPrivateKey(const Name& keyName, const char* pw, size_t pwLen) const;
/**
* @brief Import a private key.
@@ -231,7 +225,7 @@
mutable std::unordered_map<Name, unique_ptr<KeyHandle>> m_keys;
- unique_ptr<BackEnd> m_backEnd;
+ const unique_ptr<BackEnd> m_backEnd;
friend class v2::KeyChain;
};
diff --git a/src/security/transform/base64-decode.hpp b/src/security/transform/base64-decode.hpp
index 0ef0a46..ea69b8d 100644
--- a/src/security/transform/base64-decode.hpp
+++ b/src/security/transform/base64-decode.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -76,7 +76,7 @@
private:
class Impl;
- unique_ptr<Impl> m_impl;
+ const unique_ptr<Impl> m_impl;
};
unique_ptr<Transform>
diff --git a/src/security/transform/base64-encode.hpp b/src/security/transform/base64-encode.hpp
index 7e9d99d..d62b5d8 100644
--- a/src/security/transform/base64-encode.hpp
+++ b/src/security/transform/base64-encode.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -78,7 +78,7 @@
private:
class Impl;
- unique_ptr<Impl> m_impl;
+ const unique_ptr<Impl> m_impl;
};
unique_ptr<Transform>
diff --git a/src/security/transform/block-cipher.hpp b/src/security/transform/block-cipher.hpp
index 885bd43..320e184 100644
--- a/src/security/transform/block-cipher.hpp
+++ b/src/security/transform/block-cipher.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -86,7 +86,6 @@
isConverterEmpty() const;
private:
-
void
initializeAesCbc(const uint8_t* key, size_t keyLen,
const uint8_t* iv, size_t ivLen,
@@ -94,7 +93,7 @@
private:
class Impl;
- unique_ptr<Impl> m_impl;
+ const unique_ptr<Impl> m_impl;
};
unique_ptr<Transform>
diff --git a/src/security/transform/digest-filter.hpp b/src/security/transform/digest-filter.hpp
index 952c4a7..0ccc81b 100644
--- a/src/security/transform/digest-filter.hpp
+++ b/src/security/transform/digest-filter.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -58,7 +58,7 @@
private:
class Impl;
- unique_ptr<Impl> m_impl;
+ const unique_ptr<Impl> m_impl;
};
unique_ptr<Transform>
diff --git a/src/security/transform/hmac-filter.hpp b/src/security/transform/hmac-filter.hpp
index 0cec1fd..002fda8 100644
--- a/src/security/transform/hmac-filter.hpp
+++ b/src/security/transform/hmac-filter.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -59,7 +59,7 @@
private:
class Impl;
- unique_ptr<Impl> m_impl;
+ const unique_ptr<Impl> m_impl;
};
unique_ptr<Transform>
diff --git a/src/security/transform/private-key.hpp b/src/security/transform/private-key.hpp
index eae0787..3eb1d7a 100644
--- a/src/security/transform/private-key.hpp
+++ b/src/security/transform/private-key.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -243,7 +243,7 @@
private:
class Impl;
- unique_ptr<Impl> m_impl;
+ const unique_ptr<Impl> m_impl;
};
/**
diff --git a/src/security/transform/public-key.hpp b/src/security/transform/public-key.hpp
index 169b9e0..db08cad 100644
--- a/src/security/transform/public-key.hpp
+++ b/src/security/transform/public-key.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -127,7 +127,7 @@
private:
class Impl;
- unique_ptr<Impl> m_impl;
+ const unique_ptr<Impl> m_impl;
};
} // namespace transform
diff --git a/src/security/transform/signer-filter.hpp b/src/security/transform/signer-filter.hpp
index dc4ffff..a6d06c5 100644
--- a/src/security/transform/signer-filter.hpp
+++ b/src/security/transform/signer-filter.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -58,7 +58,7 @@
private:
class Impl;
- unique_ptr<Impl> m_impl;
+ const unique_ptr<Impl> m_impl;
};
unique_ptr<Transform>
diff --git a/src/security/transform/verifier-filter.hpp b/src/security/transform/verifier-filter.hpp
index 7fed9fc..4bc63e3 100644
--- a/src/security/transform/verifier-filter.hpp
+++ b/src/security/transform/verifier-filter.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -60,7 +60,7 @@
private:
class Impl;
- unique_ptr<Impl> m_impl;
+ const unique_ptr<Impl> m_impl;
};
unique_ptr<Transform>
diff --git a/src/util/network-monitor.hpp b/src/util/network-monitor.hpp
index b48d5e9..a9cf60b 100644
--- a/src/util/network-monitor.hpp
+++ b/src/util/network-monitor.hpp
@@ -108,7 +108,7 @@
Signal<NetworkMonitor> onNetworkStateChanged;
private:
- std::unique_ptr<Impl> m_impl;
+ const unique_ptr<Impl> m_impl;
};
} // namespace util
diff --git a/tests/unit-tests/security/tpm/back-end-wrapper-file.hpp b/tests/unit-tests/security/tpm/back-end-wrapper-file.hpp
index 3e403ce..64f5a0a 100644
--- a/tests/unit-tests/security/tpm/back-end-wrapper-file.hpp
+++ b/tests/unit-tests/security/tpm/back-end-wrapper-file.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -38,7 +38,7 @@
public:
BackEndWrapperFile()
: m_tmpPath(boost::filesystem::path(UNIT_TEST_CONFIG_PATH) / "TpmFileTest")
- , m_impl(new BackEndFile(m_tmpPath.string()))
+ , m_impl(make_unique<BackEndFile>(m_tmpPath.string()))
{
}
@@ -60,8 +60,8 @@
}
private:
- boost::filesystem::path m_tmpPath;
- unique_ptr<BackEnd> m_impl;
+ const boost::filesystem::path m_tmpPath;
+ const unique_ptr<BackEnd> m_impl;
};
} // namespace tests
diff --git a/tests/unit-tests/security/tpm/back-end-wrapper-mem.hpp b/tests/unit-tests/security/tpm/back-end-wrapper-mem.hpp
index ea10295..692ba65 100644
--- a/tests/unit-tests/security/tpm/back-end-wrapper-mem.hpp
+++ b/tests/unit-tests/security/tpm/back-end-wrapper-mem.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -36,8 +36,8 @@
{
public:
BackEndWrapperMem()
+ : m_impl(make_unique<BackEndMem>())
{
- m_impl = unique_ptr<BackEnd>(new BackEndMem);
}
BackEnd&
@@ -53,7 +53,7 @@
}
private:
- unique_ptr<BackEnd> m_impl;
+ const unique_ptr<BackEnd> m_impl;
};
} // namespace tests