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

Side by Side Diff: chrome/utility/importer/nss_decryptor_system_nss.cc

Issue 1548153002: Switch to standard integer types in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 (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 #include "chrome/utility/importer/nss_decryptor_system_nss.h" 5 #include "chrome/utility/importer/nss_decryptor_system_nss.h"
6 6
7 #include <pk11pub.h> 7 #include <pk11pub.h>
8 #include <pk11sdr.h> 8 #include <pk11sdr.h>
9 #include <stdint.h>
10 #include <string.h>
9 11
10 #include "base/basictypes.h"
11 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
12 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
13 #include "base/strings/sys_string_conversions.h" 14 #include "base/strings/sys_string_conversions.h"
14 #include "crypto/nss_util.h" 15 #include "crypto/nss_util.h"
15 16
16 NSSDecryptor::NSSDecryptor() : is_nss_initialized_(false), db_slot_(NULL) {} 17 NSSDecryptor::NSSDecryptor() : is_nss_initialized_(false), db_slot_(NULL) {}
17 NSSDecryptor::~NSSDecryptor() { 18 NSSDecryptor::~NSSDecryptor() {
18 if (db_slot_) { 19 if (db_slot_) {
19 // Deliberately leave the user db open, just in case we need to open more 20 // Deliberately leave the user db open, just in case we need to open more
20 // than one, because there's an NSS bug with reopening user dbs. 21 // than one, because there's an NSS bug with reopening user dbs.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 /* Remove the padding from the end if the input data */ 115 /* Remove the padding from the end if the input data */
115 if (data->len == 0 || data->len % blockSize != 0) { 116 if (data->len == 0 || data->len % blockSize != 0) {
116 rv = SECFailure; 117 rv = SECFailure;
117 goto loser; 118 goto loser;
118 } 119 }
119 120
120 padLength = data->data[data->len-1]; 121 padLength = data->data[data->len-1];
121 if (padLength > blockSize) { rv = SECFailure; goto loser; } 122 if (padLength > blockSize) { rv = SECFailure; goto loser; }
122 123
123 /* verify padding */ 124 /* verify padding */
124 for (i=data->len - padLength; static_cast<uint32>(i) < data->len; i++) { 125 for (i = data->len - padLength; static_cast<uint32_t>(i) < data->len; i++) {
125 if (data->data[i] != padLength) { 126 if (data->data[i] != padLength) {
126 rv = SECFailure; 127 rv = SECFailure;
127 goto loser; 128 goto loser;
128 } 129 }
129 } 130 }
130 131
131 result->len = data->len - padLength; 132 result->len = data->len - padLength;
132 result->data = (unsigned char *)PORT_Alloc(result->len); 133 result->data = (unsigned char *)PORT_Alloc(result->len);
133 if (!result->data) { rv = SECFailure; goto loser; } 134 if (!result->data) { rv = SECFailure; goto loser; }
134 135
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 264 }
264 265
265 loser: 266 loser:
266 if (arena) PORT_FreeArena(arena, PR_TRUE); 267 if (arena) PORT_FreeArena(arena, PR_TRUE);
267 if (key) PK11_FreeSymKey(key); 268 if (key) PK11_FreeSymKey(key);
268 if (params) SECITEM_ZfreeItem(params, PR_TRUE); 269 if (params) SECITEM_ZfreeItem(params, PR_TRUE);
269 if (possibleResult.data) SECITEM_ZfreeItem(&possibleResult, PR_FALSE); 270 if (possibleResult.data) SECITEM_ZfreeItem(&possibleResult, PR_FALSE);
270 271
271 return rv; 272 return rv;
272 } 273 }
OLDNEW
« no previous file with comments | « chrome/utility/importer/nss_decryptor_system_nss.h ('k') | chrome/utility/importer/nss_decryptor_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698