Skip to content

Commit

Permalink
Merge pull request #165 from edtubbs/0.1.3-dev-test_tpm2
Browse files Browse the repository at this point in the history
seal: added TEST_PASSWD to tpm functions
  • Loading branch information
michilumin authored Nov 10, 2023
2 parents dc2998c + 18aff5a commit 2107d82
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ SET(WITH_WALLET TRUE CACHE BOOL "enable wallet")
SET(USE_SSE2 FALSE CACHE BOOL "enable scrypt sse2")
SET(USE_TPM2 TRUE CACHE BOOL "enable tpm2")
SET(USE_OPENENCLAVE FALSE CACHE BOOL "enable openenclave")
SET(TEST_PASSWD FALSE CACHE BOOL "enable test password")
SET(TEST_PASSWD TRUE CACHE BOOL "enable test password")
SET(RANDOM_DEVICE "/dev/urandom" CACHE STRING "set the device to read random data from")

# Set a default build type if none was specified
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ AC_ARG_ENABLE(tests,

AC_ARG_ENABLE([test-passwd],
[AS_HELP_STRING([--enable-test-passwd],
[enable test password for encrypt/decrypt])],
[enable test password for encrypt/decrypt (default is yes)])],
[test_passwd=$enableval],
[test_passwd=yes])

Expand Down
6 changes: 6 additions & 0 deletions src/seal.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ LIBDOGECOIN_API dogecoin_bool dogecoin_encrypt_seed_with_tpm(const SEED seed, co
return false;
}

#ifndef TEST_PASSWD
// Set the UI policy to force high protection (PIN dialog)
NCRYPT_UI_POLICY uiPolicy;
memset(&uiPolicy, 0, sizeof(NCRYPT_UI_POLICY));
Expand All @@ -225,6 +226,7 @@ LIBDOGECOIN_API dogecoin_bool dogecoin_encrypt_seed_with_tpm(const SEED seed, co
NCryptFreeObject(hProvider);
return false;
}
#endif

// Generate a new encryption key in the TPM storage provider
status = NCryptFinalizeKey(hEncryptionKey, 0);
Expand Down Expand Up @@ -705,6 +707,7 @@ LIBDOGECOIN_API dogecoin_bool dogecoin_generate_hdnode_encrypt_with_tpm(dogecoin
return false;
}

#ifndef TEST_PASSWD
// Set the UI policy to force high protection (PIN dialog)
NCRYPT_UI_POLICY uiPolicy;
memset(&uiPolicy, 0, sizeof(NCRYPT_UI_POLICY));
Expand All @@ -719,6 +722,7 @@ LIBDOGECOIN_API dogecoin_bool dogecoin_generate_hdnode_encrypt_with_tpm(dogecoin
NCryptFreeObject(hProvider);
return false;
}
#endif

// Generate a new encryption key in the TPM storage provider
status = NCryptFinalizeKey(hEncryptionKey, 0);
Expand Down Expand Up @@ -1344,6 +1348,7 @@ LIBDOGECOIN_API dogecoin_bool dogecoin_generate_mnemonic_encrypt_with_tpm(MNEMON
return false;
}

#ifndef TEST_PASSWD
// Set the UI policy to force high protection (PIN dialog)
NCRYPT_UI_POLICY uiPolicy;
memset(&uiPolicy, 0, sizeof(NCRYPT_UI_POLICY));
Expand All @@ -1358,6 +1363,7 @@ LIBDOGECOIN_API dogecoin_bool dogecoin_generate_mnemonic_encrypt_with_tpm(MNEMON
NCryptFreeObject(hProvider);
return false;
}
#endif

// Generate a new encryption key in the TPM storage provider
status = NCryptFinalizeKey(hEncryptionKey, 0);
Expand Down

0 comments on commit 2107d82

Please sign in to comment.