OLD | NEW |
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 * Host functions for verified boot. | 5 * Host functions for verified boot. |
6 */ | 6 */ |
7 | 7 |
8 /* TODO: change all 'return 0', 'return 1' into meaningful return codes */ | 8 /* TODO: change all 'return 0', 'return 1' into meaningful return codes */ |
9 | 9 |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 if (1 != fwrite(data, size, 1, f)) { | 60 if (1 != fwrite(data, size, 1, f)) { |
61 VBDEBUG(("Unable to write to file %s\n", filename)); | 61 VBDEBUG(("Unable to write to file %s\n", filename)); |
62 fclose(f); | 62 fclose(f); |
63 unlink(filename); /* Delete any partial file */ | 63 unlink(filename); /* Delete any partial file */ |
64 } | 64 } |
65 | 65 |
66 fclose(f); | 66 fclose(f); |
67 return 0; | 67 return 0; |
68 } | 68 } |
| 69 |
| 70 void PrintPubKeySha1Sum(VbPublicKey* key) { |
| 71 uint8_t* buf = ((uint8_t *)key) + key->key_offset; |
| 72 uint64_t buflen = key->key_size; |
| 73 uint8_t* digest = DigestBuf(buf, buflen, SHA1_DIGEST_ALGORITHM); |
| 74 int i; |
| 75 for (i=0; i<SHA1_DIGEST_SIZE; i++) |
| 76 printf("%02x", digest[i]); |
| 77 Free(digest); |
| 78 } |
OLD | NEW |