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: content/child/webcrypto/openssl/sha_openssl.cc

Issue 803173010: Implement HKDF for webcrypto (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add curlies and OpenSSLErrStackTracer Created 5 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <vector> 5 #include <vector>
6 #include <openssl/evp.h> 6 #include <openssl/evp.h>
7 #include <openssl/sha.h> 7 #include <openssl/sha.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return FinishInternal(hash_buffer, &hash_buffer_size); 66 return FinishInternal(hash_buffer, &hash_buffer_size);
67 } 67 }
68 68
69 private: 69 private:
70 Status Init() { 70 Status Init() {
71 if (initialized_) 71 if (initialized_)
72 return Status::Success(); 72 return Status::Success();
73 73
74 const EVP_MD* digest_algorithm = GetDigest(algorithm_id_); 74 const EVP_MD* digest_algorithm = GetDigest(algorithm_id_);
75 if (!digest_algorithm) 75 if (!digest_algorithm)
76 return Status::ErrorUnexpected(); 76 return Status::ErrorUnsupported();
77 77
78 if (!digest_context_.get()) 78 if (!digest_context_.get())
79 return Status::OperationError(); 79 return Status::OperationError();
80 80
81 if (!EVP_DigestInit_ex(digest_context_.get(), digest_algorithm, NULL)) 81 if (!EVP_DigestInit_ex(digest_context_.get(), digest_algorithm, NULL))
82 return Status::OperationError(); 82 return Status::OperationError();
83 83
84 initialized_ = true; 84 initialized_ = true;
85 return Status::Success(); 85 return Status::Success();
86 } 86 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 131 }
132 132
133 scoped_ptr<blink::WebCryptoDigestor> CreatePlatformDigestor( 133 scoped_ptr<blink::WebCryptoDigestor> CreatePlatformDigestor(
134 blink::WebCryptoAlgorithmId algorithm) { 134 blink::WebCryptoAlgorithmId algorithm) {
135 return scoped_ptr<blink::WebCryptoDigestor>(new DigestorOpenSsl(algorithm)); 135 return scoped_ptr<blink::WebCryptoDigestor>(new DigestorOpenSsl(algorithm));
136 } 136 }
137 137
138 } // namespace webcrypto 138 } // namespace webcrypto
139 139
140 } // namespace content 140 } // namespace content
OLDNEW
« no previous file with comments | « content/child/webcrypto/openssl/hkdf_openssl.cc ('k') | content/child/webcrypto/platform_crypto.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698