summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'crypto')
-rw-r--r--crypto/hmac.h8
-rw-r--r--crypto/hmac_mac.cc2
-rw-r--r--crypto/hmac_nss.cc2
-rw-r--r--crypto/hmac_openssl.cc2
-rw-r--r--crypto/hmac_win.cc2
5 files changed, 7 insertions, 9 deletions
diff --git a/crypto/hmac.h b/crypto/hmac.h
index c0706d8..d31373a 100644
--- a/crypto/hmac.h
+++ b/crypto/hmac.h
@@ -9,10 +9,9 @@
#define CRYPTO_HMAC_H_
#pragma once
-#include <string>
-
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "base/string_piece.h"
namespace crypto {
@@ -42,7 +41,7 @@ class HMAC {
// Initializes this instance using |key|. Call Init only once. It returns
// false on the second or later calls.
- bool Init(const std::string& key) {
+ bool Init(const base::StringPiece& key) {
return Init(reinterpret_cast<const unsigned char*>(key.data()),
static_cast<int>(key.size()));
}
@@ -51,8 +50,7 @@ class HMAC {
// to the constructor and the key supplied to the Init method. The HMAC is
// returned in |digest|, which has |digest_length| bytes of storage available.
// TODO(abarth): digest_length should be a size_t.
- bool Sign(const std::string& data,
- unsigned char* digest,
+ bool Sign(const base::StringPiece& data, unsigned char* digest,
int digest_length) const;
// TODO(albertb): Add a Verify method.
diff --git a/crypto/hmac_mac.cc b/crypto/hmac_mac.cc
index fefd6e7..f9a00cd 100644
--- a/crypto/hmac_mac.cc
+++ b/crypto/hmac_mac.cc
@@ -39,7 +39,7 @@ HMAC::~HMAC() {
plat_->key_.reserve(0);
}
-bool HMAC::Sign(const std::string& data,
+bool HMAC::Sign(const base::StringPiece& data,
unsigned char* digest,
int digest_length) const {
CCHmacAlgorithm algorithm;
diff --git a/crypto/hmac_nss.cc b/crypto/hmac_nss.cc
index 722fcf1..81b2e39 100644
--- a/crypto/hmac_nss.cc
+++ b/crypto/hmac_nss.cc
@@ -73,7 +73,7 @@ bool HMAC::Init(const unsigned char *key, int key_length) {
return true;
}
-bool HMAC::Sign(const std::string& data,
+bool HMAC::Sign(const base::StringPiece& data,
unsigned char* digest,
int digest_length) const {
if (!plat_->sym_key_.get()) {
diff --git a/crypto/hmac_openssl.cc b/crypto/hmac_openssl.cc
index 8b7b96d..74645c7 100644
--- a/crypto/hmac_openssl.cc
+++ b/crypto/hmac_openssl.cc
@@ -40,7 +40,7 @@ HMAC::~HMAC() {
STLClearObject(&plat_->key);
}
-bool HMAC::Sign(const std::string& data,
+bool HMAC::Sign(const base::StringPiece& data,
unsigned char* digest,
int digest_length) const {
DCHECK_GE(digest_length, 0);
diff --git a/crypto/hmac_win.cc b/crypto/hmac_win.cc
index 1e6954a..34facc5 100644
--- a/crypto/hmac_win.cc
+++ b/crypto/hmac_win.cc
@@ -154,7 +154,7 @@ bool HMAC::Init(const unsigned char* key, int key_length) {
HMAC::~HMAC() {
}
-bool HMAC::Sign(const std::string& data,
+bool HMAC::Sign(const base::StringPiece& data,
unsigned char* digest,
int digest_length) const {
if (hash_alg_ == SHA256) {