OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef BASE_OPENSSL_UTIL_H_ | 5 #ifndef BASE_OPENSSL_UTIL_H_ |
6 #define BASE_OPENSSL_UTIL_H_ | 6 #define BASE_OPENSSL_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/tracked.h" | 10 #include "base/tracked.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // buffer is not of sufficient size. | 48 // buffer is not of sufficient size. |
49 unsigned char min_sized_buffer_[MIN_SIZE]; | 49 unsigned char min_sized_buffer_[MIN_SIZE]; |
50 | 50 |
51 DISALLOW_COPY_AND_ASSIGN(ScopedOpenSSLSafeSizeBuffer); | 51 DISALLOW_COPY_AND_ASSIGN(ScopedOpenSSLSafeSizeBuffer); |
52 }; | 52 }; |
53 | 53 |
54 // Drains the OpenSSL ERR_get_error stack. On a debug build the error codes | 54 // Drains the OpenSSL ERR_get_error stack. On a debug build the error codes |
55 // are send to VLOG(1), on a release build they are disregarded. | 55 // are send to VLOG(1), on a release build they are disregarded. |
56 void ClearOpenSSLERRStack(); | 56 void ClearOpenSSLERRStack(); |
57 | 57 |
58 // Put an instance of this class on the call stack to automatically clear the | |
59 // OpenSSL error stack on exit of your function. | |
60 class ScopedOpenSSLERRClearer { | |
61 public: | |
62 ScopedOpenSSLERRClearer() {} | |
63 ~ScopedOpenSSLERRClearer() { ClearOpenSSLERRStack(); } | |
64 | |
65 private: | |
66 DISALLOW_COPY_AND_ASSIGN(ScopedOpenSSLERRClearer); | |
67 }; | |
68 | |
69 } // namespace base | 58 } // namespace base |
70 | 59 |
71 #endif // BASE_OPENSSL_UTIL_H_ | 60 #endif // BASE_OPENSSL_UTIL_H_ |
OLD | NEW |