Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
4eda7bbc
Commit
4eda7bbc
authored
Apr 20, 2011
by
Jelte Jansen
Browse files
[trac781] rename 'crypto' to cryptolink
renamed the directory, libname, namespace and main class
parent
122d4778
Changes
11
Hide whitespace changes
Inline
Side-by-side
configure.ac
View file @
4eda7bbc
...
...
@@ -699,8 +699,8 @@ AC_CONFIG_FILES([Makefile
src/lib/config/Makefile
src/lib/config/tests/Makefile
src/lib/config/tests/testdata/Makefile
src/lib/crypto/Makefile
src/lib/crypto/tests/Makefile
src/lib/crypto
link
/Makefile
src/lib/crypto
link
/tests/Makefile
src/lib/dns/Makefile
src/lib/dns/tests/Makefile
src/lib/dns/tests/testdata/Makefile
...
...
src/lib/Makefile.am
View file @
4eda7bbc
SUBDIRS
=
exceptions dns crypto cc config python xfr bench log
\
SUBDIRS
=
exceptions dns crypto
link
cc config python xfr bench log
\
asiolink nsas cache resolve testutils datasrc server_common
src/lib/crypto/Makefile.am
→
src/lib/crypto
link
/Makefile.am
View file @
4eda7bbc
...
...
@@ -6,7 +6,7 @@ AM_CXXFLAGS = $(B10_CXXFLAGS)
CLEANFILES
=
*
.gcno
*
.gcda
lib_LTLIBRARIES
=
lib
b10
crypto.la
lib_LTLIBRARIES
=
libcrypto
link
.la
lib
b10
crypto_la_SOURCES
=
crypto.h crypto.cc
lib
b10
crypto_la_SOURCES
+=
crypto_hmac.h crypto_hmac.cc
libcrypto
link
_la_SOURCES
=
crypto.h crypto.cc
libcrypto
link
_la_SOURCES
+=
crypto_hmac.h crypto_hmac.cc
src/lib/crypto/crypto.cc
→
src/lib/crypto
link
/crypto.cc
View file @
4eda7bbc
...
...
@@ -34,45 +34,47 @@ using namespace isc::dns;
namespace
isc
{
namespace
crypto
{
namespace
crypto
link
{
// For Botan, we use the Crypto class object in RAII style
class
CryptoImpl
{
// For Botan, we use the Crypto
Link
class object in RAII style
class
Crypto
Link
Impl
{
private:
Botan
::
LibraryInitializer
_botan_init
;
};
Crypto
::~
Crypto
()
{
Crypto
Link
::~
Crypto
Link
()
{
delete
impl_
;
}
Crypto
&
Crypto
::
getCrypto
()
{
Crypto
&
c
=
getCryptoInternal
();
Crypto
Link
&
Crypto
Link
::
getCrypto
Link
()
{
Crypto
Link
&
c
=
getCrypto
Link
Internal
();
if
(
!
c
.
impl_
)
{
c
.
initialize
();
}
return
c
;
}
Crypto
&
Crypto
::
getCryptoInternal
()
{
static
Crypto
instance
;
Crypto
Link
&
Crypto
Link
::
getCrypto
Link
Internal
()
{
static
Crypto
Link
instance
;
return
(
instance
);
}
void
Crypto
::
initialize
()
{
Crypto
&
c
=
getCryptoInternal
();
try
{
c
.
impl_
=
new
CryptoImpl
();
}
catch
(
const
Botan
::
Exception
&
ex
)
{
isc_throw
(
InitializationError
,
ex
.
what
());
CryptoLink
::
initialize
()
{
CryptoLink
&
c
=
getCryptoLinkInternal
();
if
(
!
c
.
impl_
)
{
try
{
c
.
impl_
=
new
CryptoLinkImpl
();
}
catch
(
const
Botan
::
Exception
&
ex
)
{
isc_throw
(
InitializationError
,
ex
.
what
());
}
}
}
HMAC
*
Crypto
::
createHMAC
(
const
void
*
secret
,
size_t
secret_len
,
Crypto
Link
::
createHMAC
(
const
void
*
secret
,
size_t
secret_len
,
const
HMAC
::
HashAlgorithm
hash_algorithm
)
{
return
new
HMAC
(
secret
,
secret_len
,
hash_algorithm
);
}
...
...
@@ -82,7 +84,7 @@ signHMAC(const void* data, size_t data_len, const void* secret,
size_t
secret_len
,
const
HMAC
::
HashAlgorithm
hash_algorithm
,
isc
::
dns
::
OutputBuffer
&
result
,
size_t
len
)
{
boost
::
scoped_ptr
<
HMAC
>
hmac
(
Crypto
::
getCrypto
().
createHMAC
(
secret
,
secret_len
,
hash_algorithm
));
boost
::
scoped_ptr
<
HMAC
>
hmac
(
Crypto
Link
::
getCrypto
Link
().
createHMAC
(
secret
,
secret_len
,
hash_algorithm
));
hmac
->
update
(
data
,
data_len
);
hmac
->
sign
(
result
,
len
);
}
...
...
@@ -93,11 +95,11 @@ verifyHMAC(const void* data, const size_t data_len, const void* secret,
size_t
secret_len
,
const
HMAC
::
HashAlgorithm
hash_algorithm
,
const
void
*
sig
,
const
size_t
sig_len
)
{
boost
::
scoped_ptr
<
HMAC
>
hmac
(
Crypto
::
getCrypto
().
createHMAC
(
secret
,
secret_len
,
hash_algorithm
));
boost
::
scoped_ptr
<
HMAC
>
hmac
(
Crypto
Link
::
getCrypto
Link
().
createHMAC
(
secret
,
secret_len
,
hash_algorithm
));
hmac
->
update
(
data
,
data_len
);
return
(
hmac
->
verify
(
sig
,
sig_len
));
}
}
// namespace crypto
}
// namespace crypto
link
}
// namespace isc
src/lib/crypto/crypto.h
→
src/lib/crypto
link
/crypto.h
View file @
4eda7bbc
...
...
@@ -21,70 +21,100 @@
#include <boost/noncopyable.hpp>
#include <crypto/crypto_hmac.h>
#include <crypto
link
/crypto_hmac.h>
namespace
isc
{
namespace
crypto
{
namespace
crypto
link
{
/// General exception class that is the base for all crypto-related
/// exceptions
class
CryptoError
:
public
Exception
{
class
Crypto
Link
Error
:
public
Exception
{
public:
CryptoError
(
const
char
*
file
,
size_t
line
,
const
char
*
what
)
:
Crypto
Link
Error
(
const
char
*
file
,
size_t
line
,
const
char
*
what
)
:
isc
::
Exception
(
file
,
line
,
what
)
{}
};
/// This exception is thrown if there was a problem initializing the
/// crypto library
class
InitializationError
:
public
CryptoError
{
class
InitializationError
:
public
Crypto
Link
Error
{
public:
InitializationError
(
const
char
*
file
,
size_t
line
,
const
char
*
what
)
:
CryptoError
(
file
,
line
,
what
)
{}
Crypto
Link
Error
(
file
,
line
,
what
)
{}
};
/// This exception is thrown when a cryptographic action is requested
/// for an algorithm that is not supported by the underlying algorithm.
class
UnsupportedAlgorithm
:
public
CryptoError
{
class
UnsupportedAlgorithm
:
public
Crypto
Link
Error
{
public:
UnsupportedAlgorithm
(
const
char
*
file
,
size_t
line
,
const
char
*
what
)
:
CryptoError
(
file
,
line
,
what
)
{}
Crypto
Link
Error
(
file
,
line
,
what
)
{}
};
/// This exception is thrown when the underlying library could not
/// handle this key
class
BadKey
:
public
CryptoError
{
class
BadKey
:
public
Crypto
Link
Error
{
public:
BadKey
(
const
char
*
file
,
size_t
line
,
const
char
*
what
)
:
CryptoError
(
file
,
line
,
what
)
{}
Crypto
Link
Error
(
file
,
line
,
what
)
{}
};
class
CryptoImpl
;
class
Crypto
Link
Impl
;
/// \brief Initializer object
/// \brief
///
/// This is singleton class that serves as the entry point to
/// the underlying cryptography library, and as a factory for objects
/// within the cryptolink library.
///
/// There is only one way to access it, through getCryptoLink(), which
/// returns a reference to the initialized library. On the first call,
/// it will be initialized automatically. You can however initialize it
/// manually through a call to the initalize(). Any subsequent call to
/// initialize() will be a noop.
///
/// All other classes within cryptolink should have private
/// constructors, and should have a factory function from this class.
///
/// This object represents 'global' state for the backend crypto
/// library, and must be initialized before any cryptographic calls
/// are made. It may not be destroyed until all cryptographic objects
/// are.
/// Preferably, this object is created in the program's main() function
// Internal note: we can use this class later to initialize and manage
// dynamic (PKCS#11) libs
class
Crypto
:
private
boost
::
noncopyable
{
class
Crypto
Link
:
private
boost
::
noncopyable
{
public:
static
Crypto
&
getCrypto
();
/// \brief Returns a reference to the singleton instance
///
/// If the library has not been initialized yet, it will be
/// initialized with some default values.
static
CryptoLink
&
getCryptoLink
();
/// \brief Initialize the library manually
///
/// \note A call to initialize() is not strictly necessary with
/// the current implementation.
static
void
initialize
();
bool
initialized
()
{
return
(
impl_
!=
NULL
);
}
/// \brief Factory function for HMAC objects
///
/// CryptoLink objects cannot be constructed directly. This
/// function creates a new HMAC object usable for signing or
/// verification.
///
/// The caller is responsible for deleting the object later, and
/// it is therefore highly recommended to place the return value
/// of this function in a scoped_ptr or shared_ptr.
HMAC
*
createHMAC
(
const
void
*
secret
,
size_t
secret_len
,
const
HMAC
::
HashAlgorithm
hash_algorithm
);
private:
static
Crypto
&
getCryptoInternal
();
Crypto
()
:
impl_
(
NULL
)
{};
~
Crypto
();
// To enable us to use an optional explicit initialization call,
// the 'real' instance getter is private
static
CryptoLink
&
getCryptoLinkInternal
();
// To prevent people constructing their own, we make the constructor
// private too.
CryptoLink
()
:
impl_
(
NULL
)
{};
~
CryptoLink
();
CryptoImpl
*
impl_
;
Crypto
Link
Impl
*
impl_
;
};
/// Entry point for the API
...
...
@@ -155,7 +185,7 @@ bool verifyHMAC(const void* data,
const
void
*
sig
,
const
size_t
sig_len
);
}
// namespace crypto
}
// namespace crypto
link
}
// namespace isc
#endif // _ISC_CRYPTO_H
src/lib/crypto/crypto_hmac.cc
→
src/lib/crypto
link
/crypto_hmac.cc
View file @
4eda7bbc
#include <crypto.h>
#include <crypto/crypto_hmac.h>
#include <boost/scoped_ptr.hpp>
...
...
@@ -11,18 +10,18 @@
namespace
{
const
char
*
getBotanHashAlgorithmName
(
isc
::
crypto
::
HMAC
::
HashAlgorithm
algorithm
)
{
getBotanHashAlgorithmName
(
isc
::
crypto
link
::
HMAC
::
HashAlgorithm
algorithm
)
{
switch
(
algorithm
)
{
case
isc
::
crypto
::
HMAC
::
MD5
:
case
isc
::
crypto
link
::
HMAC
::
MD5
:
return
(
"MD5"
);
break
;
case
isc
::
crypto
::
HMAC
::
SHA1
:
case
isc
::
crypto
link
::
HMAC
::
SHA1
:
return
(
"SHA-1"
);
break
;
case
isc
::
crypto
::
HMAC
::
SHA256
:
case
isc
::
crypto
link
::
HMAC
::
SHA256
:
return
(
"SHA-256"
);
break
;
case
isc
::
crypto
::
HMAC
::
UNKNOWN
:
case
isc
::
crypto
link
::
HMAC
::
UNKNOWN
:
return
(
"Unknown"
);
break
;
}
...
...
@@ -35,7 +34,7 @@ getBotanHashAlgorithmName(isc::crypto::HMAC::HashAlgorithm algorithm) {
namespace
isc
{
namespace
crypto
{
namespace
crypto
link
{
class
HMACImpl
{
public:
...
...
@@ -46,7 +45,7 @@ public:
hash
=
Botan
::
get_hash
(
getBotanHashAlgorithmName
(
hash_algorithm
));
}
catch
(
const
Botan
::
Algorithm_Not_Found
&
)
{
isc_throw
(
isc
::
crypto
::
UnsupportedAlgorithm
,
isc_throw
(
isc
::
crypto
link
::
UnsupportedAlgorithm
,
"Unknown hash algorithm: "
+
hash_algorithm
);
}
...
...
@@ -164,5 +163,5 @@ HMAC::verify(const void* sig, const size_t len) {
return
(
impl_
->
verify
(
sig
,
len
));
}
}
// namespace crypto
}
// namespace crypto
link
}
// namespace isc
src/lib/crypto/crypto_hmac.h
→
src/lib/crypto
link
/crypto_hmac.h
View file @
4eda7bbc
...
...
@@ -18,13 +18,13 @@
#include <boost/noncopyable.hpp>
#include <crypto/crypto.h>
#include <crypto
link
/crypto.h>
#ifndef _ISC_CRYPTO_HMAC_H
#define _ISC_CRYPTO_HMAC_H
namespace
isc
{
namespace
crypto
{
namespace
crypto
link
{
/// Forward declaration, pimpl style
class
HMACImpl
;
...
...
@@ -48,7 +48,7 @@ public:
};
private:
friend
class
Crypto
;
friend
class
Crypto
Link
;
/// \brief Constructor from a secret and a hash algorithm
///
...
...
@@ -127,7 +127,7 @@ private:
HMACImpl
*
impl_
;
};
}
// namespace crypto
}
// namespace crypto
link
}
// namespace isc
#endif // __ISC_CRYPTO_HMAC
...
...
src/lib/crypto/tests/Makefile.am
→
src/lib/crypto
link
/tests/Makefile.am
View file @
4eda7bbc
...
...
@@ -18,7 +18,7 @@ run_unittests_SOURCES += crypto_unittests.cc
run_unittests_CPPFLAGS
=
$(AM_CPPFLAGS)
$(GTEST_INCLUDES)
run_unittests_LDFLAGS
=
$(AM_LDFLAGS)
$(GTEST_LDFLAGS)
run_unittests_LDADD
=
$(GTEST_LDADD)
run_unittests_LDADD
+=
$(top_builddir)
/src/lib/crypto/lib
b10
crypto.la
run_unittests_LDADD
+=
$(top_builddir)
/src/lib/crypto
link
/libcrypto
link
.la
run_unittests_LDADD
+=
$(top_builddir)
/src/lib/dns/libdns++.la
run_unittests_LDADD
+=
$(top_builddir)
/src/lib/exceptions/libexceptions.la
endif
...
...
src/lib/crypto/tests/crypto_unittests.cc
→
src/lib/crypto
link
/tests/crypto_unittests.cc
View file @
4eda7bbc
...
...
@@ -15,14 +15,14 @@
#include <config.h>
#include <gtest/gtest.h>
#include <crypto/crypto.h>
#include <crypto
link
/crypto.h>
#include <dns/buffer.h>
#include <exceptions/exceptions.h>
#include <boost/scoped_ptr.hpp>
using
namespace
isc
::
dns
;
using
namespace
isc
::
crypto
;
using
namespace
isc
::
crypto
link
;
namespace
{
void
checkData
(
const
uint8_t
*
data
,
const
uint8_t
*
expected
,
...
...
@@ -85,7 +85,7 @@ namespace {
OutputBuffer
hmac_sig
(
1
);
// Sign it
boost
::
scoped_ptr
<
HMAC
>
hmac_sign
(
Crypto
::
getCrypto
().
createHMAC
(
secret
,
secret_len
,
hash_algorithm
));
boost
::
scoped_ptr
<
HMAC
>
hmac_sign
(
Crypto
Link
::
getCrypto
Link
().
createHMAC
(
secret
,
secret_len
,
hash_algorithm
));
hmac_sign
->
update
(
data_buf
.
getData
(),
data_buf
.
getLength
());
hmac_sign
->
sign
(
hmac_sig
,
hmac_len
);
...
...
@@ -93,7 +93,7 @@ namespace {
checkBuffer
(
hmac_sig
,
expected_hmac
,
hmac_len
);
// Check whether we can verify it ourselves
boost
::
scoped_ptr
<
HMAC
>
hmac_verify
(
Crypto
::
getCrypto
().
createHMAC
(
secret
,
secret_len
,
hash_algorithm
));
boost
::
scoped_ptr
<
HMAC
>
hmac_verify
(
Crypto
Link
::
getCrypto
Link
().
createHMAC
(
secret
,
secret_len
,
hash_algorithm
));
hmac_verify
->
update
(
data_buf
.
getData
(),
data_buf
.
getLength
());
EXPECT_TRUE
(
hmac_verify
->
verify
(
hmac_sig
.
getData
(),
hmac_sig
.
getLength
()));
...
...
@@ -111,13 +111,13 @@ namespace {
const
HMAC
::
HashAlgorithm
hash_algorithm
,
const
uint8_t
*
expected_hmac
,
size_t
hmac_len
)
{
boost
::
scoped_ptr
<
HMAC
>
hmac_sign
(
Crypto
::
getCrypto
().
createHMAC
(
secret
,
secret_len
,
hash_algorithm
));
boost
::
scoped_ptr
<
HMAC
>
hmac_sign
(
Crypto
Link
::
getCrypto
Link
().
createHMAC
(
secret
,
secret_len
,
hash_algorithm
));
hmac_sign
->
update
(
data
.
c_str
(),
data
.
size
());
std
::
vector
<
uint8_t
>
sig
=
hmac_sign
->
sign
(
hmac_len
);
ASSERT_EQ
(
hmac_len
,
sig
.
size
());
checkData
(
&
sig
[
0
],
expected_hmac
,
hmac_len
);
boost
::
scoped_ptr
<
HMAC
>
hmac_verify
(
Crypto
::
getCrypto
().
createHMAC
(
secret
,
secret_len
,
hash_algorithm
));
boost
::
scoped_ptr
<
HMAC
>
hmac_verify
(
Crypto
Link
::
getCrypto
Link
().
createHMAC
(
secret
,
secret_len
,
hash_algorithm
));
hmac_verify
->
update
(
data
.
c_str
(),
data
.
size
());
EXPECT_TRUE
(
hmac_verify
->
verify
(
&
sig
[
0
],
sig
.
size
()));
...
...
@@ -131,7 +131,7 @@ namespace {
const
HMAC
::
HashAlgorithm
hash_algorithm
,
const
uint8_t
*
expected_hmac
,
size_t
hmac_len
)
{
boost
::
scoped_ptr
<
HMAC
>
hmac_sign
(
Crypto
::
getCrypto
().
createHMAC
(
secret
,
secret_len
,
hash_algorithm
));
boost
::
scoped_ptr
<
HMAC
>
hmac_sign
(
Crypto
Link
::
getCrypto
Link
().
createHMAC
(
secret
,
secret_len
,
hash_algorithm
));
hmac_sign
->
update
(
data
.
c_str
(),
data
.
size
());
// note: this is not exception-safe, and will leak, but
...
...
@@ -142,7 +142,7 @@ namespace {
hmac_sign
->
sign
(
sig
,
hmac_len
);
checkData
(
sig
,
expected_hmac
,
hmac_len
);
boost
::
scoped_ptr
<
HMAC
>
hmac_verify
(
Crypto
::
getCrypto
().
createHMAC
(
secret
,
secret_len
,
hash_algorithm
));
boost
::
scoped_ptr
<
HMAC
>
hmac_verify
(
Crypto
Link
::
getCrypto
Link
().
createHMAC
(
secret
,
secret_len
,
hash_algorithm
));
hmac_verify
->
update
(
data
.
c_str
(),
data
.
size
());
EXPECT_TRUE
(
hmac_verify
->
verify
(
sig
,
hmac_len
));
...
...
@@ -172,7 +172,7 @@ namespace {
//
// Test values taken from RFC 2202
//
TEST
(
CryptoTest
,
HMAC_MD5_RFC2202_SIGN
)
{
TEST
(
Crypto
Link
Test
,
HMAC_MD5_RFC2202_SIGN
)
{
const
uint8_t
secret
[]
=
{
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
};
...
...
@@ -244,7 +244,7 @@ TEST(CryptoTest, HMAC_MD5_RFC2202_SIGN) {
//
// Test values taken from RFC 2202
//
TEST
(
CryptoTest
,
HMAC_SHA1_RFC2202_SIGN
)
{
TEST
(
Crypto
Link
Test
,
HMAC_SHA1_RFC2202_SIGN
)
{
const
uint8_t
secret
[]
=
{
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
};
...
...
@@ -318,7 +318,7 @@ TEST(CryptoTest, HMAC_SHA1_RFC2202_SIGN) {
//
// Test values taken from RFC 4231
//
TEST
(
CryptoTest
,
HMAC_SHA256_RFC2202_SIGN
)
{
TEST
(
Crypto
Link
Test
,
HMAC_SHA256_RFC2202_SIGN
)
{
const
uint8_t
secret
[]
=
{
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
,
0x0b
};
...
...
@@ -409,14 +409,14 @@ TEST(CryptoTest, HMAC_SHA256_RFC2202_SIGN) {
namespace
{
size_t
sigVectorLength
(
HMAC
::
HashAlgorithm
alg
,
size_t
len
)
{
boost
::
scoped_ptr
<
HMAC
>
hmac_sign
(
Crypto
::
getCrypto
().
createHMAC
(
"asdf"
,
4
,
alg
));
boost
::
scoped_ptr
<
HMAC
>
hmac_sign
(
Crypto
Link
::
getCrypto
Link
().
createHMAC
(
"asdf"
,
4
,
alg
));
hmac_sign
->
update
(
"asdf"
,
4
);
const
std
::
vector
<
uint8_t
>
sig
=
hmac_sign
->
sign
(
len
);
return
sig
.
size
();
}
size_t
sigBufferLength
(
HMAC
::
HashAlgorithm
alg
,
size_t
len
)
{
boost
::
scoped_ptr
<
HMAC
>
hmac_sign
(
Crypto
::
getCrypto
().
createHMAC
(
"asdf"
,
4
,
alg
));
boost
::
scoped_ptr
<
HMAC
>
hmac_sign
(
Crypto
Link
::
getCrypto
Link
().
createHMAC
(
"asdf"
,
4
,
alg
));
hmac_sign
->
update
(
"asdf"
,
4
);
OutputBuffer
sig
(
0
);
hmac_sign
->
sign
(
sig
,
len
);
...
...
@@ -424,7 +424,7 @@ namespace {
}
}
TEST
(
CryptoTest
,
HMACSigLengthArgument
)
TEST
(
Crypto
Link
Test
,
HMACSigLengthArgument
)
{
std
::
vector
<
uint8_t
>
sig
;
...
...
@@ -465,12 +465,12 @@ TEST(CryptoTest, HMACSigLengthArgument)
EXPECT_EQ
(
32
,
sigBufferLength
(
HMAC
::
SHA256
,
3200
));
}
TEST
(
CryptoTest
,
BadKey
)
{
TEST
(
Crypto
Link
Test
,
BadKey
)
{
OutputBuffer
data_buf
(
0
);
OutputBuffer
hmac_sig
(
0
);
EXPECT_THROW
(
Crypto
::
getCrypto
().
createHMAC
(
NULL
,
0
,
HMAC
::
MD5
),
BadKey
);
EXPECT_THROW
(
Crypto
::
getCrypto
().
createHMAC
(
NULL
,
0
,
HMAC
::
UNKNOWN
),
UnsupportedAlgorithm
);
EXPECT_THROW
(
Crypto
Link
::
getCrypto
Link
().
createHMAC
(
NULL
,
0
,
HMAC
::
MD5
),
BadKey
);
EXPECT_THROW
(
Crypto
Link
::
getCrypto
Link
().
createHMAC
(
NULL
,
0
,
HMAC
::
UNKNOWN
),
UnsupportedAlgorithm
);
EXPECT_THROW
(
signHMAC
(
data_buf
.
getData
(),
data_buf
.
getLength
(),
NULL
,
0
,
HMAC
::
MD5
,
hmac_sig
),
BadKey
);
...
...
@@ -487,10 +487,10 @@ TEST(CryptoTest, BadKey) {
UnsupportedAlgorithm
);
}
TEST
(
CryptoTest
,
Singleton
)
{
TEST
(
Crypto
Link
Test
,
Singleton
)
{
/*
Crypto& c1 = Crypto::getCrypto();
Crypto& c2 = Crypto::getCrypto();
Crypto
Link
& c1 = Crypto
Link
::getCrypto
Link
();
Crypto
Link
& c2 = Crypto
Link
::getCrypto
Link
();
ASSERT_EQ(&c1, &c2);
*/
}
src/lib/crypto/tests/run_unittests.cc
→
src/lib/crypto
link
/tests/run_unittests.cc
View file @
4eda7bbc
...
...
@@ -15,7 +15,7 @@
#include <gtest/gtest.h>
#include <dns/tests/unittest_util.h>
#include <crypto/crypto.h>
#include <crypto
link
/crypto.h>
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
src/lib/dns/tsigkey.cc
View file @
4eda7bbc
...
...
@@ -18,7 +18,7 @@
#include <exceptions/exceptions.h>
#include <crypto/crypto.h>
#include <crypto
link
/crypto.h>
#include <dns/name.h>
#include <dns/util/base64.h>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment