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

Side by Side Diff: net/der/input.h

Issue 1218753002: Add DER parsing of AlgorithmId for signatures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove clang-format off and just accept its formatting Created 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 NET_DER_INPUT_H_ 5 #ifndef NET_DER_INPUT_H_
6 #define NET_DER_INPUT_H_ 6 #define NET_DER_INPUT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 // Creates an Input from the given |data| and |len|. 49 // Creates an Input from the given |data| and |len|.
50 Input(const uint8_t* data, size_t len); 50 Input(const uint8_t* data, size_t len);
51 51
52 // Returns the length in bytes of an Input's data. 52 // Returns the length in bytes of an Input's data.
53 size_t Length() const { return len_; } 53 size_t Length() const { return len_; }
54 54
55 // Return true if the Input's data and |other|'s data are byte-wise equal. 55 // Return true if the Input's data and |other|'s data are byte-wise equal.
56 bool Equals(const Input& other) const; 56 bool Equals(const Input& other) const;
57 57
58 // Return true if the Input's data and |data| are byte-wise equal.
59 template <size_t N>
60 bool Equals(const uint8_t(&data)[N]) const {
61 return Equals(Input(data));
Ryan Sleevi 2015/06/29 14:45:24 So, this isn't ideal because it double-instantiate
eroman 2015/06/29 15:19:00 Removed.
62 }
63
58 // Returns a pointer to the Input's data. This method is marked as "unsafe" 64 // Returns a pointer to the Input's data. This method is marked as "unsafe"
59 // because access to the Input's data should be done through ByteReader 65 // because access to the Input's data should be done through ByteReader
60 // instead. This method should only be used where using a ByteReader truly 66 // instead. This method should only be used where using a ByteReader truly
61 // is not an option. 67 // is not an option.
62 const uint8_t* UnsafeData() const { return data_; } 68 const uint8_t* UnsafeData() const { return data_; }
63 69
64 private: 70 private:
65 const uint8_t* data_; 71 const uint8_t* data_;
66 size_t len_; 72 size_t len_;
67 }; 73 };
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 explicit Mark(const uint8_t* ptr); 154 explicit Mark(const uint8_t* ptr);
149 Mark(); 155 Mark();
150 const uint8_t* ptr_; 156 const uint8_t* ptr_;
151 }; 157 };
152 158
153 } // namespace der 159 } // namespace der
154 160
155 } // namespace net 161 } // namespace net
156 162
157 #endif // NET_DER_INPUT_H_ 163 #endif // NET_DER_INPUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698