OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/crx_file.h" | 5 #include "chrome/browser/extensions/crx_file.h" |
6 | 6 |
| 7 namespace extensions { |
| 8 |
7 namespace { | 9 namespace { |
8 | 10 |
9 // The current version of the crx format. | 11 // The current version of the crx format. |
10 static const uint32 kCurrentVersion = 2; | 12 static const uint32 kCurrentVersion = 2; |
11 | 13 |
12 // The maximum size the crx parser will tolerate for a public key. | 14 // The maximum size the crx parser will tolerate for a public key. |
13 static const uint32 kMaxPublicKeySize = 1 << 16; | 15 static const uint32 kMaxPublicKeySize = 1 << 16; |
14 | 16 |
15 // The maximum size the crx parser will tolerate for a signature. | 17 // The maximum size the crx parser will tolerate for a signature. |
16 static const uint32 kMaxSignatureSize = 1 << 16; | 18 static const uint32 kMaxSignatureSize = 1 << 16; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 else if (header.key_size == 0) | 57 else if (header.key_size == 0) |
56 *error = kInvalidKeyTooSmall; | 58 *error = kInvalidKeyTooSmall; |
57 else if (header.signature_size > kMaxSignatureSize) | 59 else if (header.signature_size > kMaxSignatureSize) |
58 *error = kInvalidSignatureTooLarge; | 60 *error = kInvalidSignatureTooLarge; |
59 else if (header.signature_size == 0) | 61 else if (header.signature_size == 0) |
60 *error = kInvalidSignatureTooSmall; | 62 *error = kInvalidSignatureTooSmall; |
61 else | 63 else |
62 valid = true; | 64 valid = true; |
63 return valid; | 65 return valid; |
64 } | 66 } |
| 67 |
| 68 } // namespace extensions |
OLD | NEW |