summaryrefslogtreecommitdiff
path: root/src/LibsslDHKeyExchange.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-11-20 09:36:14 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-11-20 09:36:14 +0000
commit694fb307aa7e582a55bce7e995bde3a4614b3b4f (patch)
tree42bf3e703ebd706c9ebdd62bca59396f2d67a790 /src/LibsslDHKeyExchange.cc
parent580098eb4929a3bdbf424af18da361259ef2efe5 (diff)
2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Replaced StringFormat with fmt
Diffstat (limited to 'src/LibsslDHKeyExchange.cc')
-rw-r--r--src/LibsslDHKeyExchange.cc37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/LibsslDHKeyExchange.cc b/src/LibsslDHKeyExchange.cc
index e90a9394..5137a197 100644
--- a/src/LibsslDHKeyExchange.cc
+++ b/src/LibsslDHKeyExchange.cc
@@ -40,7 +40,7 @@
#include <openssl/err.h>
#include "DlAbortEx.h"
-#include "StringFormat.h"
+#include "fmt.h"
namespace aria2 {
@@ -48,8 +48,8 @@ namespace {
void handleError(const std::string& funName)
{
throw DL_ABORT_EX
- (StringFormat("Exception in libssl routine %s(DHKeyExchange class): %s",
- funName.c_str(), ERR_error_string(ERR_get_error(), 0)).str());
+ (fmt("Exception in libssl routine %s(DHKeyExchange class): %s",
+ funName.c_str(), ERR_error_string(ERR_get_error(), 0)));
}
} // namespace
@@ -113,10 +113,9 @@ size_t DHKeyExchange::getPublicKey
{
if(outLength < keyLength_) {
throw DL_ABORT_EX
- (StringFormat
- ("Insufficient buffer for public key. expect:%lu, actual:%lu",
- static_cast<unsigned long>(keyLength_),
- static_cast<unsigned long>(outLength)).str());
+ (fmt("Insufficient buffer for public key. expect:%lu, actual:%lu",
+ static_cast<unsigned long>(keyLength_),
+ static_cast<unsigned long>(outLength)));
}
memset(out, 0, outLength);
size_t publicKeyBytes = BN_num_bytes(publicKey_);
@@ -124,11 +123,10 @@ size_t DHKeyExchange::getPublicKey
size_t nwritten = BN_bn2bin(publicKey_, out+offset);
if(nwritten != publicKeyBytes) {
throw DL_ABORT_EX
- (StringFormat
- ("BN_bn2bin in DHKeyExchange::getPublicKey, %lu bytes written,"
- " but %lu bytes expected.",
- static_cast<unsigned long>(nwritten),
- static_cast<unsigned long>(publicKeyBytes)).str());
+ (fmt("BN_bn2bin in DHKeyExchange::getPublicKey, %lu bytes written,"
+ " but %lu bytes expected.",
+ static_cast<unsigned long>(nwritten),
+ static_cast<unsigned long>(publicKeyBytes)));
}
return nwritten;
}
@@ -146,9 +144,9 @@ size_t DHKeyExchange::computeSecret(unsigned char* out, size_t outLength,
{
if(outLength < keyLength_) {
throw DL_ABORT_EX
- (StringFormat("Insufficient buffer for secret. expect:%lu, actual:%lu",
- static_cast<unsigned long>(keyLength_),
- static_cast<unsigned long>(outLength)).str());
+ (fmt("Insufficient buffer for secret. expect:%lu, actual:%lu",
+ static_cast<unsigned long>(keyLength_),
+ static_cast<unsigned long>(outLength)));
}
@@ -168,11 +166,10 @@ size_t DHKeyExchange::computeSecret(unsigned char* out, size_t outLength,
BN_free(secret);
if(nwritten != secretBytes) {
throw DL_ABORT_EX
- (StringFormat
- ("BN_bn2bin in DHKeyExchange::getPublicKey, %lu bytes written,"
- " but %lu bytes expected.",
- static_cast<unsigned long>(nwritten),
- static_cast<unsigned long>(secretBytes)).str());
+ (fmt("BN_bn2bin in DHKeyExchange::getPublicKey, %lu bytes written,"
+ " but %lu bytes expected.",
+ static_cast<unsigned long>(nwritten),
+ static_cast<unsigned long>(secretBytes)));
}
return nwritten;
}