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

Side by Side Diff: src/shared/platform/win/nacl_secure_random.c

Issue 2070533002: win: Add an explicit intrin.h include to work around a clang-cl bug. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client@master
Patch Set: Created 4 years, 6 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 /* 1 /*
2 * Copyright (c) 2008 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2008 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /* 7 /*
8 * NaCl Service Runtime. Secure RNG implementation. 8 * NaCl Service Runtime. Secure RNG implementation.
9 */ 9 */
10 #include <windows.h> 10 #include <windows.h>
11 11
12 /* Work around a clang-cl bug: SecureZeroMemory() below uses __stosb() but
13 * windows.h only declares that intrinsic and then uses `#pragma intrinsic` for
14 * it. clang-cl doesn't implement `#pragma intrinsic` yet; it instead defines
15 * the function as an always-inline symbol in its intrin.h.
16 * TODO(thakis): Remove this once http://llvm.org/PR19898 is fixed.
17 */
18 #include <intrin.h>
19
12 /* 20 /*
13 * #define needed to link in RtlGenRandom(), a.k.a. SystemFunction036. See 21 * #define needed to link in RtlGenRandom(), a.k.a. SystemFunction036. See
14 * the "Community Additions" comment on MSDN here: 22 * the "Community Additions" comment on MSDN here:
15 * http://msdn.microsoft.com/en-us/library/windows/desktop/aa387694.aspx 23 * http://msdn.microsoft.com/en-us/library/windows/desktop/aa387694.aspx
16 */ 24 */
17 #define SystemFunction036 NTAPI SystemFunction036 25 #define SystemFunction036 NTAPI SystemFunction036
18 #include <NTSecAPI.h> 26 #include <NTSecAPI.h>
19 #undef SystemFunction036 27 #undef SystemFunction036
20 28
21 #include "native_client/src/shared/platform/nacl_log.h" 29 #include "native_client/src/shared/platform/nacl_log.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 if (0 > self->nvalid) { 84 if (0 > self->nvalid) {
77 NaClLog(LOG_FATAL, 85 NaClLog(LOG_FATAL,
78 "NaClSecureRngGenByte: illegal buffer state, nvalid = %d\n", 86 "NaClSecureRngGenByte: illegal buffer state, nvalid = %d\n",
79 self->nvalid); 87 self->nvalid);
80 } 88 }
81 if (0 == self->nvalid) { 89 if (0 == self->nvalid) {
82 NaClSecureRngFilbuf(self); 90 NaClSecureRngFilbuf(self);
83 } 91 }
84 return self->buf[--self->nvalid]; 92 return self->buf[--self->nvalid];
85 } 93 }
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