OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CRYPTO_OPENSSL_UTIL_H_ | 5 #ifndef CRYPTO_OPENSSL_UTIL_H_ |
6 #define CRYPTO_OPENSSL_UTIL_H_ | 6 #define CRYPTO_OPENSSL_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 memcpy(output_, min_sized_buffer_, output_len_); | 58 memcpy(output_, min_sized_buffer_, output_len_); |
59 } | 59 } |
60 // else... any writing already happened directly into |output_|. | 60 // else... any writing already happened directly into |output_|. |
61 } | 61 } |
62 | 62 |
63 unsigned char* safe_buffer() { | 63 unsigned char* safe_buffer() { |
64 return output_len_ < MIN_SIZE ? min_sized_buffer_ : output_; | 64 return output_len_ < MIN_SIZE ? min_sized_buffer_ : output_; |
65 } | 65 } |
66 | 66 |
67 private: | 67 private: |
68 // Pointer to the caller's data area and it's associated size, where data | 68 // Pointer to the caller's data area and its associated size, where data |
69 // written via safe_buffer() will [eventually] end up. | 69 // written via safe_buffer() will [eventually] end up. |
70 unsigned char* output_; | 70 unsigned char* output_; |
71 size_t output_len_; | 71 size_t output_len_; |
72 | 72 |
73 // Temporary buffer writen into in the case where the caller's | 73 // Temporary buffer writen into in the case where the caller's |
74 // buffer is not of sufficient size. | 74 // buffer is not of sufficient size. |
75 unsigned char min_sized_buffer_[MIN_SIZE]; | 75 unsigned char min_sized_buffer_[MIN_SIZE]; |
76 | 76 |
77 DISALLOW_COPY_AND_ASSIGN(ScopedOpenSSLSafeSizeBuffer); | 77 DISALLOW_COPY_AND_ASSIGN(ScopedOpenSSLSafeSizeBuffer); |
78 }; | 78 }; |
(...skipping 26 matching lines...) Expand all Loading... |
105 | 105 |
106 private: | 106 private: |
107 const tracked_objects::Location location_; | 107 const tracked_objects::Location location_; |
108 | 108 |
109 DISALLOW_IMPLICIT_CONSTRUCTORS(OpenSSLErrStackTracer); | 109 DISALLOW_IMPLICIT_CONSTRUCTORS(OpenSSLErrStackTracer); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace crypto | 112 } // namespace crypto |
113 | 113 |
114 #endif // CRYPTO_OPENSSL_UTIL_H_ | 114 #endif // CRYPTO_OPENSSL_UTIL_H_ |
OLD | NEW |