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

Side by Side Diff: Source/modules/crypto/SubtleCrypto.cpp

Issue 23537027: WebCrypto: [refactor] Use "unsigned" rather than "size_t" for buffer sizes. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add an ifdef to coordinate with chromium side Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 69
70 WebKit::WebCryptoAlgorithm algorithm; 70 WebKit::WebCryptoAlgorithm algorithm;
71 if (!normalizeAlgorithm(rawAlgorithm, operationType, algorithm, es)) 71 if (!normalizeAlgorithm(rawAlgorithm, operationType, algorithm, es))
72 return ScriptPromise(); 72 return ScriptPromise();
73 73
74 if (requiresKey && !key->canBeUsedForAlgorithm(algorithm, operationType, es) ) 74 if (requiresKey && !key->canBeUsedForAlgorithm(algorithm, operationType, es) )
75 return ScriptPromise(); 75 return ScriptPromise();
76 76
77 const unsigned char* data = static_cast<const unsigned char*>(dataBuffer->ba seAddress()); 77 const unsigned char* data = static_cast<const unsigned char*>(dataBuffer->ba seAddress());
78 size_t dataSize = dataBuffer->byteLength(); 78 unsigned dataSize = dataBuffer->byteLength();
79 79
80 RefPtr<CryptoResult> result = CryptoResult::create(); 80 RefPtr<CryptoResult> result = CryptoResult::create();
81 81
82 switch (operationType) { 82 switch (operationType) {
83 case Encrypt: 83 case Encrypt:
84 WebKit::Platform::current()->crypto()->encrypt(algorithm, key->key(), da ta, dataSize, result->result()); 84 WebKit::Platform::current()->crypto()->encrypt(algorithm, key->key(), da ta, dataSize, result->result());
85 break; 85 break;
86 case Decrypt: 86 case Decrypt:
87 WebKit::Platform::current()->crypto()->decrypt(algorithm, key->key(), da ta, dataSize, result->result()); 87 WebKit::Platform::current()->crypto()->decrypt(algorithm, key->key(), da ta, dataSize, result->result());
88 break; 88 break;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 es.throwDOMException(NotSupportedError, "key is not extractable"); 191 es.throwDOMException(NotSupportedError, "key is not extractable");
192 return ScriptPromise(); 192 return ScriptPromise();
193 } 193 }
194 194
195 RefPtr<CryptoResult> result = CryptoResult::create(); 195 RefPtr<CryptoResult> result = CryptoResult::create();
196 WebKit::Platform::current()->crypto()->exportKey(format, key->key(), result- >result()); 196 WebKit::Platform::current()->crypto()->exportKey(format, key->key(), result- >result());
197 return result->promise(); 197 return result->promise();
198 } 198 }
199 199
200 } // namespace WebCore 200 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/chromium/support/WebCrypto.cpp ('k') | Source/testing/runner/MockWebCrypto.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698