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

Side by Side Diff: third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp

Issue 2167943002: [webcrypto] Update a comment to indicate that HmacImportParams.hash is required. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert accidental upload (patchset2) Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 if (!getAlgorithmIdentifier(raw, "hash", rawHash, context, error)) 490 if (!getAlgorithmIdentifier(raw, "hash", rawHash, context, error))
491 return false; 491 return false;
492 492
493 context.add("hash"); 493 context.add("hash");
494 return parseAlgorithmIdentifier(rawHash, WebCryptoOperationDigest, hash, con text, error); 494 return parseAlgorithmIdentifier(rawHash, WebCryptoOperationDigest, hash, con text, error);
495 } 495 }
496 496
497 // Defined by the WebCrypto spec as: 497 // Defined by the WebCrypto spec as:
498 // 498 //
499 // dictionary HmacImportParams : Algorithm { 499 // dictionary HmacImportParams : Algorithm {
500 // HashAlgorithmIdentifier hash; 500 // required HashAlgorithmIdentifier hash;
501 // [EnforceRange] unsigned long length; 501 // [EnforceRange] unsigned long length;
502 // }; 502 // };
503 //
504 // FIXME: http://crbug.com/438475: The current implementation differs from the
505 // spec in that the "hash" parameter is required. This seems more sensible, and
506 // is being proposed as a change to the spec. (https://www.w3.org/Bugs/Public/sh ow_bug.cgi?id=27448).
507 bool parseHmacImportParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgor ithmParams>& params, const ErrorContext& context, AlgorithmError* error) 503 bool parseHmacImportParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgor ithmParams>& params, const ErrorContext& context, AlgorithmError* error)
508 { 504 {
509 WebCryptoAlgorithm hash; 505 WebCryptoAlgorithm hash;
510 if (!parseHash(raw, hash, context, error)) 506 if (!parseHash(raw, hash, context, error))
511 return false; 507 return false;
512 508
513 bool hasLength; 509 bool hasLength;
514 uint32_t length = 0; 510 uint32_t length = 0;
515 if (!getOptionalUint32(raw, "length", hasLength, length, context, error)) 511 if (!getOptionalUint32(raw, "length", hasLength, length, context, error))
516 return false; 512 return false;
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 } 971 }
976 972
977 } // namespace 973 } // namespace
978 974
979 bool normalizeAlgorithm(const AlgorithmIdentifier& raw, WebCryptoOperation op, W ebCryptoAlgorithm& algorithm, AlgorithmError* error) 975 bool normalizeAlgorithm(const AlgorithmIdentifier& raw, WebCryptoOperation op, W ebCryptoAlgorithm& algorithm, AlgorithmError* error)
980 { 976 {
981 return parseAlgorithmIdentifier(raw, op, algorithm, ErrorContext(), error); 977 return parseAlgorithmIdentifier(raw, op, algorithm, ErrorContext(), error);
982 } 978 }
983 979
984 } // namespace blink 980 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698