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

Side by Side Diff: src/platform/vboot_reference/common/utility_stub.c

Issue 661353: Vboot Reference: Refactor Code. (Closed)
Patch Set: Review Fixes. 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 | src/platform/vboot_reference/crypto/rsa.c » ('j') | 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 * Stub implementations of utility functions which call their linux-specific 5 * Stub implementations of utility functions which call their linux-specific
6 * equivalents. 6 * equivalents.
7 */ 7 */
8 8
9 #include "utility.h" 9 #include "utility.h"
10 10
(...skipping 30 matching lines...) Expand all
41 const unsigned char* us2 = s2; 41 const unsigned char* us2 = s2;
42 while (n--) { 42 while (n--) {
43 if (*us1++ != *us2++) 43 if (*us1++ != *us2++)
44 match = 1; 44 match = 1;
45 } 45 }
46 46
47 return match; 47 return match;
48 } 48 }
49 49
50 void* StatefulMemcpy(MemcpyState* state, void* dst, int len) { 50 void* StatefulMemcpy(MemcpyState* state, void* dst, int len) {
51 void* saved_ptr;
52 if (len > state->remaining_len) { 51 if (len > state->remaining_len) {
53 state->remaining_len = -1; 52 state->remaining_len = -1;
54 return NULL; 53 return NULL;
55 } 54 }
56 saved_ptr = state->remaining_buf; 55 Memcpy(dst, state->remaining_buf, len);
57 Memcpy(dst, saved_ptr, len);
58 state->remaining_buf += len; 56 state->remaining_buf += len;
59 state->remaining_len -= len; 57 state->remaining_len -= len;
60 return dst; 58 return dst;
61 } 59 }
60
61 const void* StatefulMemcpy_r(MemcpyState* state, const void* src, int len) {
62 if (len > state->remaining_len) {
63 state->remaining_len = -1;
64 return NULL;
65 }
66 Memcpy(state->remaining_buf, src, len);
67 state->remaining_buf += len;
68 state->remaining_len -= len;
69 return src;
70 }
OLDNEW
« no previous file with comments | « no previous file | src/platform/vboot_reference/crypto/rsa.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698