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

Unified Diff: tpm/tpm_crypto.c

Issue 660204: Upgrade to tpm-emulator version 0.7. (Closed)
Patch Set: Created 10 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tpm/tpm_credentials.c ('k') | tpm/tpm_daa.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tpm/tpm_crypto.c
diff --git a/tpm/tpm_crypto.c b/tpm/tpm_crypto.c
index 84ad6b47496f7191f8f0de63a18aec5069603d38..2b9916526ecb4989b29d30e369c62ee5bc6e3d75 100644
--- a/tpm/tpm_crypto.c
+++ b/tpm/tpm_crypto.c
@@ -1,6 +1,5 @@
-/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
- * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
- * Swiss Federal Institute of Technology (ETH) Zurich
+/* Software-based Trusted Platform Module (TPM) Emulator
+ * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net>
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
@@ -12,7 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * $Id$
+ * $Id: tpm_crypto.c 368 2010-02-15 09:26:37Z mast $
*/
#include "tpm_emulator.h"
@@ -201,16 +200,16 @@ TPM_RESULT TPM_Sign(TPM_KEY_HANDLE keyHandle, UINT32 areaToSignSize,
void tpm_get_random_bytes(void *buf, size_t nbytes)
{
-#ifdef TPM_USE_INTERNAL_PRNG
- tpm_rc4_ctx_t ctx;
- tpm_rc4_init(&ctx, tpmData.permanent.data.rngState,
- sizeof(tpmData.permanent.data.rngState));
- tpm_rc4_crypt(&ctx, buf, buf, nbytes);
- tpm_rc4_crypt(&ctx, tpmData.permanent.data.rngState,
- tpmData.permanent.data.rngState, sizeof(tpmData.permanent.data.rngState));
-#else
- tpm_get_extern_random_bytes(buf, nbytes);
-#endif
+ if (tpmConf & TPM_CONF_USE_INTERNAL_PRNG) {
+ tpm_rc4_ctx_t ctx;
+ tpm_rc4_init(&ctx, tpmData.permanent.data.rngState,
+ sizeof(tpmData.permanent.data.rngState));
+ tpm_rc4_crypt(&ctx, buf, buf, nbytes);
+ tpm_rc4_crypt(&ctx, tpmData.permanent.data.rngState,
+ tpmData.permanent.data.rngState, sizeof(tpmData.permanent.data.rngState));
+ } else {
+ tpm_get_extern_random_bytes(buf, nbytes);
+ }
}
TPM_RESULT TPM_GetRandom(UINT32 bytesRequested, UINT32 *randomBytesSize,
« no previous file with comments | « tpm/tpm_credentials.c ('k') | tpm/tpm_daa.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698