diff options
-rw-r--r-- | test/tpm_test/crypto_test.py | 6 | ||||
-rw-r--r-- | test/tpm_test/hash_test.py | 5 | ||||
-rw-r--r-- | test/tpm_test/subcmd.py | 10 |
3 files changed, 14 insertions, 7 deletions
diff --git a/test/tpm_test/crypto_test.py b/test/tpm_test/crypto_test.py index 147b5f301b..7fa4ea6146 100644 --- a/test/tpm_test/crypto_test.py +++ b/test/tpm_test/crypto_test.py @@ -10,11 +10,9 @@ from __future__ import print_function import struct import xml.etree.ElementTree as ET +import subcmd import utils -# Extension 'cryptography' subcommand codes: -AES = 0 - # Basic crypto operations DECRYPT = 0 ENCRYPT = 1 @@ -99,7 +97,7 @@ class CryptoD(object): self.submodes = submodes SUPPORTED_MODES = { - 'AES': CryptoD(AES, { + 'AES': CryptoD(subcmd.AES, { 'ECB': 0, 'CTR': 1, 'CBC': 2, diff --git a/test/tpm_test/hash_test.py b/test/tpm_test/hash_test.py index c1cdddbbe5..fd8d0f4184 100644 --- a/test/tpm_test/hash_test.py +++ b/test/tpm_test/hash_test.py @@ -10,10 +10,9 @@ from __future__ import print_function import hashlib import struct +import subcmd import utils -HASH = 1 - # Hash command modes CMD_START = 0 CMD_CONT = 1 @@ -92,7 +91,7 @@ def hash_test(tpm): cmd += '%c' % handle # Ignored for single shots cmd += struct.pack('>H', len(text)) cmd += text - wrapped_response = tpm.command(tpm.wrap_ext_command(HASH, cmd)) + wrapped_response = tpm.command(tpm.wrap_ext_command(subcmd.HASH, cmd)) if hash_cmd in (CMD_START, CMD_CONT): if hash_cmd == CMD_START: contexts[handle] = hash_func() diff --git a/test/tpm_test/subcmd.py b/test/tpm_test/subcmd.py new file mode 100644 index 0000000000..dbfcadb1c5 --- /dev/null +++ b/test/tpm_test/subcmd.py @@ -0,0 +1,10 @@ +#!/usr/bin/python +# Copyright 2015 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Subcommand codes that specify the crypto module.""" + +# Keep these codes in sync with include/extension.h. +AES = 0 +HASH = 1 |