mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-10-23 14:56:19 +00:00
[trac781] minor editorial cleanup (basically along with the style guideline)
and constify one thing
This commit is contained in:
@@ -39,7 +39,7 @@ namespace cryptolink {
|
||||
// For Botan, we use the CryptoLink class object in RAII style
|
||||
class CryptoLinkImpl {
|
||||
private:
|
||||
Botan::LibraryInitializer _botan_init;
|
||||
Botan::LibraryInitializer botan_init_;
|
||||
};
|
||||
|
||||
CryptoLink::~CryptoLink() {
|
||||
@@ -49,10 +49,10 @@ CryptoLink::~CryptoLink() {
|
||||
CryptoLink&
|
||||
CryptoLink::getCryptoLink() {
|
||||
CryptoLink& c = getCryptoLinkInternal();
|
||||
if (!c.impl_) {
|
||||
if (c.impl_ == NULL) {
|
||||
c.initialize();
|
||||
}
|
||||
return c;
|
||||
return (c);
|
||||
}
|
||||
|
||||
CryptoLink&
|
||||
@@ -64,7 +64,7 @@ CryptoLink::getCryptoLinkInternal() {
|
||||
void
|
||||
CryptoLink::initialize() {
|
||||
CryptoLink& c = getCryptoLinkInternal();
|
||||
if (!c.impl_) {
|
||||
if (c.impl_ == NULL) {
|
||||
try {
|
||||
c.impl_ = new CryptoLinkImpl();
|
||||
} catch (const Botan::Exception& ex) {
|
||||
@@ -75,7 +75,8 @@ CryptoLink::initialize() {
|
||||
|
||||
HMAC*
|
||||
CryptoLink::createHMAC(const void* secret, size_t secret_len,
|
||||
const HMAC::HashAlgorithm hash_algorithm) {
|
||||
const HMAC::HashAlgorithm hash_algorithm)
|
||||
{
|
||||
return (new HMAC(secret, secret_len, hash_algorithm));
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ private:
|
||||
|
||||
// To prevent people constructing their own, we make the constructor
|
||||
// private too.
|
||||
CryptoLink() : impl_(NULL) {};
|
||||
CryptoLink() : impl_(NULL) {}
|
||||
~CryptoLink();
|
||||
|
||||
CryptoLinkImpl* impl_;
|
||||
|
||||
@@ -428,7 +428,7 @@ namespace {
|
||||
CryptoLink::getCryptoLink().createHMAC("asdf", 4, alg));
|
||||
hmac_sign->update("asdf", 4);
|
||||
const std::vector<uint8_t> sig = hmac_sign->sign(len);
|
||||
return sig.size();
|
||||
return (sig.size());
|
||||
}
|
||||
|
||||
size_t
|
||||
@@ -438,12 +438,11 @@ namespace {
|
||||
hmac_sign->update("asdf", 4);
|
||||
OutputBuffer sig(0);
|
||||
hmac_sign->sign(sig, len);
|
||||
return sig.getLength();
|
||||
return (sig.getLength());
|
||||
}
|
||||
}
|
||||
|
||||
TEST(CryptoLinkTest, HMACSigLengthArgument)
|
||||
{
|
||||
TEST(CryptoLinkTest, HMACSigLengthArgument) {
|
||||
std::vector<uint8_t> sig;
|
||||
|
||||
EXPECT_EQ(16, sigVectorLength(HMAC::MD5, 0));
|
||||
@@ -507,7 +506,7 @@ TEST(CryptoLinkTest, BadKey) {
|
||||
}
|
||||
|
||||
TEST(CryptoLinkTest, Singleton) {
|
||||
CryptoLink& c1 = CryptoLink::getCryptoLink();
|
||||
CryptoLink& c2 = CryptoLink::getCryptoLink();
|
||||
const CryptoLink& c1 = CryptoLink::getCryptoLink();
|
||||
const CryptoLink& c2 = CryptoLink::getCryptoLink();
|
||||
ASSERT_EQ(&c1, &c2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user