Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
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
4f1d8d0f
Commit
4f1d8d0f
authored
Apr 12, 2011
by
JINMEI Tatuya
Browse files
[trac781] trivial editorial cleanups:
- removed redundant white spaces - added () around 'return'
parent
400d3b61
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/lib/crypto/tests/crypto_unittests.cc
View file @
4f1d8d0f
...
...
@@ -31,15 +31,15 @@ namespace {
ASSERT_EQ
(
buf_d
[
i
],
data
[
i
]);
}
}
void
doHMACTest
(
std
::
string
data
,
std
::
string
key_str
,
uint8_t
*
expected_hmac
,
size_t
hmac_len
)
{
OutputBuffer
data_buf
(
data
.
size
());
data_buf
.
writeData
(
data
.
c_str
(),
data
.
size
());
OutputBuffer
hmac_sig
(
1
);
TSIGKey
key
(
key_str
);
signHMAC
(
data_buf
,
key
,
hmac_sig
);
checkBuffer
(
hmac_sig
,
expected_hmac
,
hmac_len
);
EXPECT_TRUE
(
verifyHMAC
(
data_buf
,
key
,
hmac_sig
));
...
...
@@ -91,7 +91,7 @@ TEST(CryptoTest, HMAC_MD5_RFC2202_SIGN) {
doHMACTest
(
"Test With Truncation"
,
"test.example:DAwMDAwMDAwMDAwMDAwMDA==:hmac-md5.sig-alg.reg.int"
,
hmac_expected5
,
16
);
uint8_t
hmac_expected6
[]
=
{
0x6b
,
0x1a
,
0xb7
,
0xfe
,
0x4b
,
0xd7
,
0xbf
,
0x8f
,
0x0b
,
0x62
,
0xe6
,
0xce
,
0x61
,
0xb9
,
0xd0
,
0xcd
};
...
...
@@ -164,7 +164,7 @@ TEST(CryptoTest, HMAC_SHA1_RFC2202_SIGN) {
doHMACTest
(
"Test With Truncation"
,
"test.example:DAwMDAwMDAwMDAwMDAwMDAwMDAw=:hmac-sha1"
,
hmac_expected5
,
20
);
uint8_t
hmac_expected6
[]
=
{
0xaa
,
0x4a
,
0xe5
,
0xe1
,
0x52
,
0x72
,
0xd0
,
0x0e
,
0x95
,
0x70
,
0x56
,
0x37
,
0xce
,
0x8a
,
0x3b
,
0x55
,
0xed
,
0x40
,
...
...
@@ -278,7 +278,7 @@ TEST(CryptoTest, BadKey) {
OutputBuffer
data_buf
(
0
);
OutputBuffer
hmac_sig
(
1
);
EXPECT_THROW
(
signHMAC
(
data_buf
,
bad_key
,
hmac_sig
),
BadKey
);
EXPECT_THROW
(
verifyHMAC
(
data_buf
,
bad_key
,
hmac_sig
),
BadKey
);
}
src/lib/dns/tests/tsigkey_unittest.cc
View file @
4f1d8d0f
...
...
@@ -232,7 +232,7 @@ TEST(TSIGTest, TSIGKeyFromToString) {
TSIGKey
k2
=
TSIGKey
(
"test.example.:MSG6Ng==:hmac-md5.sig-alg.reg.int."
);
TSIGKey
k3
=
TSIGKey
(
"test.example:MSG6Ng=="
);
TSIGKey
k4
=
TSIGKey
(
Name
(
"test.example."
),
Name
(
"hmac-sha1."
),
NULL
,
0
);
EXPECT_EQ
(
"test.example.:MSG6Ng==:hmac-md5.sig-alg.reg.int."
,
k1
.
toText
());
EXPECT_EQ
(
"test.example.:MSG6Ng==:hmac-md5.sig-alg.reg.int."
,
...
...
src/lib/dns/tsigkey.cc
View file @
4f1d8d0f
...
...
@@ -82,7 +82,7 @@ TSIGKey::TSIGKey(const std::string& str) : impl_(NULL) {
}
std
::
string
secret_str
=
str
.
substr
(
pos
+
1
,
pos2
-
pos
-
1
);
vector
<
uint8_t
>
secret
;
decodeBase64
(
secret_str
,
secret
);
unsigned
char
secret_b
[
secret
.
size
()];
...
...
@@ -155,9 +155,9 @@ TSIGKey::toText() const {
secret_v
.
push_back
(
secret_b
[
i
]);
}
std
::
string
secret_str
=
encodeBase64
(
secret_v
);
return
getKeyName
().
toText
()
+
":"
+
secret_str
+
":"
+
getAlgorithmName
().
toText
();
return
(
getKeyName
().
toText
()
+
":"
+
secret_str
+
":"
+
getAlgorithmName
().
toText
()
)
;
}
const
...
...
Write
Preview
Markdown
is supported
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