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

Side by Side Diff: src/platform/vboot_reference/utils/dumpRSAPublicKey.c

Issue 874003: Vboot Reference: Initialize local pointers with NULL. (Closed)
Patch Set: Created 10 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 /* Copyright (c) 2010 The Chromium OS 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 5
6 /* C port of DumpPublicKey.java from the Android Open source project with 6 /* C port of DumpPublicKey.java from the Android Open source project with
7 * support for additional RSA key sizes. (platform/system/core,git/libmincrypt 7 * support for additional RSA key sizes. (platform/system/core,git/libmincrypt
8 * /tools/DumpPublicKey.java). Uses the OpenSSL X509 and BIGNUM library. 8 * /tools/DumpPublicKey.java). Uses the OpenSSL X509 and BIGNUM library.
9 */ 9 */
10 10
(...skipping 25 matching lines...) Expand all
36 return 0; 36 return 0;
37 } 37 }
38 return 1; 38 return 1;
39 } 39 }
40 40
41 /* Pre-processes and outputs RSA public key to standard out. 41 /* Pre-processes and outputs RSA public key to standard out.
42 */ 42 */
43 void output(RSA* key) { 43 void output(RSA* key) {
44 int i, nwords; 44 int i, nwords;
45 BIGNUM *N = key->n; 45 BIGNUM *N = key->n;
46 BIGNUM *Big1, *Big2, *Big32, *BigMinus1; 46 BIGNUM *Big1 = NULL, *Big2 = NULL, *Big32 = NULL, *BigMinus1 = NULL;
47 BIGNUM *B; 47 BIGNUM *B = NULL;
48 BIGNUM *N0inv, *R, *RR, *RRTemp, *NnumBits; 48 BIGNUM *N0inv= NULL, *R = NULL, *RR = NULL, *RRTemp = NULL, *NnumBits = NULL;
49 BIGNUM *n, *rr; 49 BIGNUM *n = NULL, *rr = NULL;
50 BN_CTX *bn_ctx = BN_CTX_new(); 50 BN_CTX *bn_ctx = BN_CTX_new();
51 uint32_t n0invout; 51 uint32_t n0invout;
52 52
53 N = key->n; 53 N = key->n;
54 /* Output size of RSA key in 32-bit words */ 54 /* Output size of RSA key in 32-bit words */
55 nwords = BN_num_bits(N) / 32; 55 nwords = BN_num_bits(N) / 32;
56 if (-1 == write(1, &nwords, sizeof(nwords))) 56 if (-1 == write(1, &nwords, sizeof(nwords)))
57 goto failure; 57 goto failure;
58 58
59 59
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 output (pubkey); 172 output (pubkey);
173 } 173 }
174 174
175 fail: 175 fail:
176 X509_free(cert); 176 X509_free(cert);
177 RSA_free(pubkey); 177 RSA_free(pubkey);
178 fclose(fp); 178 fclose(fp);
179 179
180 return 0; 180 return 0;
181 } 181 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698