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

Issue 2828019: Add a locked version of CryptAcquireContext (Closed)

Created:
10 years, 6 months ago by davidben
Modified:
9 years, 6 months ago
Reviewers:
wtc
CC:
chromium-reviews, cbentzel+watch_chromium.org, darin-cc_chromium.org, brettw-cc_chromium.org
Visibility:
Public.

Description

Add a locked version of CryptAcquireContext The function is not thread-safe when called with certain flags. This will be useful when we move keygen onto a worker thread. BUG=none TEST=KeygenHandlerTest.SmokeTest (existing) Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=50661

Patch Set 1 #

Total comments: 14

Patch Set 2 : Address Wan-Teh's comments #

Patch Set 3 : Forgot one reference... #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+93 lines, -4 lines) Patch
M base/base.gypi View 1 2 chunks +4 lines, -0 lines 1 comment Download
A base/crypto/capi_util.h View 1 chunk +31 lines, -0 lines 1 comment Download
A base/crypto/capi_util.cc View 1 chunk +51 lines, -0 lines 1 comment Download
M net/base/keygen_handler_win.cc View 1 2 3 chunks +7 lines, -4 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
davidben
10 years, 6 months ago (2010-06-22 02:47:11 UTC) #1
wtc
This looks good. Thanks. Please make the suggested changes below and upload a new Patch ...
10 years, 6 months ago (2010-06-23 00:52:23 UTC) #2
davidben
http://codereview.chromium.org/2828019/diff/1/3 File base/crypto/crypt_util_win.cc (right): http://codereview.chromium.org/2828019/diff/1/3#newcode7 base/crypto/crypt_util_win.cc:7: #include <objbase.h> On 2010/06/23 00:52:23, wtc wrote: > These ...
10 years, 6 months ago (2010-06-23 03:05:38 UTC) #3
wtc
10 years, 6 months ago (2010-06-23 16:44:15 UTC) #4
LGTM!  I have two nits and a suggestion for future work below.

After fixing the nits, you can check this in without getting
a new review from me.

http://codereview.chromium.org/2828019/diff/10001/11001
File base/base.gypi (right):

http://codereview.chromium.org/2828019/diff/10001/11001#newcode359
base/base.gypi:359: 'crypto/capi_util.h',
Nit: list .cc before .h (in the directory listing order).

Make the same change to lines 487-488 below.

http://codereview.chromium.org/2828019/diff/10001/11002
File base/crypto/capi_util.cc (right):

http://codereview.chromium.org/2828019/diff/10001/11002#newcode29
base/crypto/capi_util.cc:29: CAPIUtilSingleton() {
Nit: consider writing a method with an empty body like this:
  CAPIUtilSingleton() {}

Your style is fine, too.

http://codereview.chromium.org/2828019/diff/10001/11003
File base/crypto/capi_util.h (right):

http://codereview.chromium.org/2828019/diff/10001/11003#newcode23
base/crypto/capi_util.h:23: BOOL CryptAcquireContextLocked(HCRYPTPROV* prov,
Suggestion for future work: also add CryptoAcquireContextUnlocked.
Change all of our calls to CryptAcquireContext to either our Locked or
Unlocked versions.  In Locked and Unlocked, CHECK or DCHECK the 'flags'
argument has or doesn't has the expected flags.

Then, in the future we can easily search for all instances of
CryptoAcquireContext in our source tree and audit the proper use of the
Locked version.

Powered by Google App Engine
This is Rietveld 408576698