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

Side by Side Diff: crypto/auto_cbb.h

Issue 2408063002: Switch remaining scoped_openssl_types uses to BoringSSL scopers. (Closed)
Patch Set: Created 4 years, 2 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CRYPTO_AUTO_CBB_H_
6 #define CRYPTO_AUTO_CBB_H_
7
8 #include <openssl/bytestring.h>
9
10 #include "base/macros.h"
11
12 namespace crypto {
13
14 // AutoCBB is a wrapper over OpenSSL's CBB type that automatically releases
15 // resources when going out of scope.
16 class AutoCBB {
17 public:
18 AutoCBB() { CBB_zero(&cbb_); }
19 ~AutoCBB() { CBB_cleanup(&cbb_); }
20
21 CBB* get() { return &cbb_; }
22
23 void Reset() {
24 CBB_cleanup(&cbb_);
25 CBB_zero(&cbb_);
26 }
27
28 private:
29 CBB cbb_;
30 DISALLOW_COPY_AND_ASSIGN(AutoCBB);
31 };
32
33 } // namespace crypto
34
35 #endif // CRYPTO_AUTO_CBB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698