Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Issue 7033035: Change HMAC::Sign() to take base::StringPiece instead of string. (Closed)

Created:
9 years, 7 months ago by Alpha Left Google
Modified:
9 years, 6 months ago
Reviewers:
wtc
CC:
chromium-reviews, darin-cc_chromium.org, cbentzel+watch_chromium.org, pam+watch_chromium.org, Paweł Hajdan Jr.
Visibility:
Public.

Description

Change HMAC::Sign() to take base::StringPiece instead of string. Do this to avoid memory copying when signning data in char*. base::StringPiece nicely handles both cases. BUG=None TEST=crypto_unittests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=88049

Patch Set 1 #

Patch Set 2 : done #

Patch Set 3 : fix it #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -6 lines) Patch
M crypto/hmac.h View 1 2 2 chunks +2 lines, -2 lines 1 comment Download
M crypto/hmac_mac.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M crypto/hmac_nss.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M crypto/hmac_openssl.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M crypto/hmac_win.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 2 (0 generated)
Alpha Left Google
9 years, 6 months ago (2011-06-01 01:02:21 UTC) #1
wtc
9 years, 6 months ago (2011-06-02 19:56:48 UTC) #2
LGTM.

I assume that there is cheap, automatic conversion from
std::string to base::StringPiece?

I suggest a change below to finish the job.

http://codereview.chromium.org/7033035/diff/4001/crypto/hmac.h
File crypto/hmac.h (right):

http://codereview.chromium.org/7033035/diff/4001/crypto/hmac.h#newcode46
crypto/hmac.h:46: bool Init(const std::string& key) {
Can you also change 'key' to a StringPiece, and remove
the <string> header inclusion on line 12 above?

Powered by Google App Engine
This is Rietveld 408576698