summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/cr50/tpm2/ecc.c2
-rw-r--r--include/extension.h2
-rw-r--r--test/tpm_test/ecc_test.py52
-rw-r--r--test/tpm_test/subcmd.py2
4 files changed, 29 insertions, 29 deletions
diff --git a/board/cr50/tpm2/ecc.c b/board/cr50/tpm2/ecc.c
index a35f974ce2..9f61ab86a9 100644
--- a/board/cr50/tpm2/ecc.c
+++ b/board/cr50/tpm2/ecc.c
@@ -580,6 +580,6 @@ static void ecc_command_handler(void *cmd_body, size_t cmd_size,
}
}
-DECLARE_EXTENSION_COMMAND(EXTENSION_EC, ecc_command_handler);
+DECLARE_EXTENSION_COMMAND(EXTENSION_ECC, ecc_command_handler);
#endif /* CRYPTO_TEST_SETUP */
diff --git a/include/extension.h b/include/extension.h
index 100a3032df..92a8c28ab7 100644
--- a/include/extension.h
+++ b/include/extension.h
@@ -49,7 +49,7 @@ enum {
EXTENSION_AES = 0,
EXTENSION_HASH = 1,
EXTENSION_RSA = 2,
- EXTENSION_EC = 3,
+ EXTENSION_ECC = 3,
EXTENSION_FW_UPGRADE = 4,
EXTENSION_HKDF = 5,
EXTENSION_ECIES = 6,
diff --git a/test/tpm_test/ecc_test.py b/test/tpm_test/ecc_test.py
index de7f7e2d64..65b0b5fdb7 100644
--- a/test/tpm_test/ecc_test.py
+++ b/test/tpm_test/ecc_test.py
@@ -12,14 +12,14 @@ import struct
import subcmd
import utils
-_EC_OPCODES = {
+_ECC_OPCODES = {
'SIGN': 0x00,
'VERIFY': 0x01,
'KEYGEN': 0x02,
'KEYDERIVE': 0x03,
}
-_EC_CURVES = {
+_ECC_CURVES = {
'NIST-P256': 0x03,
}
@@ -55,39 +55,39 @@ _HASH_FUNC = {
# 0x00 LSB DIGEST LEN
# .... DIGEST
#
-_EC_CMD_FORMAT = '{o:c}{c:c}{s:c}{h:c}{ml:s}{msg}{dl:s}{dig}'
+_ECC_CMD_FORMAT = '{o:c}{c:c}{s:c}{h:c}{ml:s}{msg}{dl:s}{dig}'
def _sign_cmd(curve_id, hash_func, sign_mode, msg):
- op = _EC_OPCODES['SIGN']
+ op = _ECC_OPCODES['SIGN']
digest = hash_func(msg).digest()
digest_len = len(digest)
- return _EC_CMD_FORMAT.format(o=op, c=curve_id, s=sign_mode, h=_HASH['NONE'],
+ return _ECC_CMD_FORMAT.format(o=op, c=curve_id, s=sign_mode, h=_HASH['NONE'],
ml=struct.pack('>H', 0), msg='',
dl=struct.pack('>H', digest_len), dig=digest)
def _verify_cmd(curve_id, hash_func, sign_mode, msg, sig):
- op = _EC_OPCODES['VERIFY']
+ op = _ECC_OPCODES['VERIFY']
sig_len = len(sig)
digest = hash_func(msg).digest()
digest_len = len(digest)
- return _EC_CMD_FORMAT.format(o=op, c=curve_id, s=sign_mode, h=_HASH['NONE'],
+ return _ECC_CMD_FORMAT.format(o=op, c=curve_id, s=sign_mode, h=_HASH['NONE'],
ml=struct.pack('>H', sig_len), msg=sig,
dl=struct.pack('>H', digest_len), dig=digest)
def _keygen_cmd(curve_id):
- op = _EC_OPCODES['KEYGEN']
- return _EC_CMD_FORMAT.format(o=op, c=curve_id, s=_SIGN_MODE['NONE'],
+ op = _ECC_OPCODES['KEYGEN']
+ return _ECC_CMD_FORMAT.format(o=op, c=curve_id, s=_SIGN_MODE['NONE'],
h=_HASH['NONE'], ml=struct.pack('>H', 0), msg='',
dl=struct.pack('>H', 0), dig='')
def _keyderive_cmd(curve_id, seed):
- op = _EC_OPCODES['KEYDERIVE']
+ op = _ECC_OPCODES['KEYDERIVE']
seed_len = len(seed)
- return _EC_CMD_FORMAT.format(o=op, c=curve_id, s=_SIGN_MODE['NONE'],
+ return _ECC_CMD_FORMAT.format(o=op, c=curve_id, s=_SIGN_MODE['NONE'],
h=_HASH['NONE'], ml=struct.pack('>H', seed_len),
msg=seed, dl=struct.pack('>H', 0), dig='')
@@ -113,16 +113,16 @@ def _sign_test(tpm):
for data in _SIGN_INPUTS:
curve_id, sign_mode = data
- test_name = 'EC-SIGN:%s:%s' % data
- cmd = _sign_cmd(_EC_CURVES[curve_id], _HASH_FUNC[curve_id],
+ test_name = 'ECC-SIGN:%s:%s' % data
+ cmd = _sign_cmd(_ECC_CURVES[curve_id], _HASH_FUNC[curve_id],
_SIGN_MODE[sign_mode], msg)
- wrapped_response = tpm.command(tpm.wrap_ext_command(subcmd.EC, cmd))
- signature = tpm.unwrap_ext_response(subcmd.EC, wrapped_response)
+ wrapped_response = tpm.command(tpm.wrap_ext_command(subcmd.ECC, cmd))
+ signature = tpm.unwrap_ext_response(subcmd.ECC, wrapped_response)
- cmd = _verify_cmd(_EC_CURVES[curve_id], _HASH_FUNC[curve_id],
+ cmd = _verify_cmd(_ECC_CURVES[curve_id], _HASH_FUNC[curve_id],
_SIGN_MODE[sign_mode], msg, signature)
- wrapped_response = tpm.command(tpm.wrap_ext_command(subcmd.EC, cmd))
- verified = tpm.unwrap_ext_response(subcmd.EC, wrapped_response)
+ wrapped_response = tpm.command(tpm.wrap_ext_command(subcmd.ECC, cmd))
+ verified = tpm.unwrap_ext_response(subcmd.ECC, wrapped_response)
expected = '\x01'
if verified != expected:
raise subcmd.TpmTestError('%s error:%s:%s' % (
@@ -133,10 +133,10 @@ def _sign_test(tpm):
def _keygen_test(tpm):
for data in _KEYGEN_INPUTS:
curve_id, = data
- test_name = 'EC-KEYGEN:%s' % data
- cmd = _keygen_cmd(_EC_CURVES[curve_id])
- wrapped_response = tpm.command(tpm.wrap_ext_command(subcmd.EC, cmd))
- valid = tpm.unwrap_ext_response(subcmd.EC, wrapped_response)
+ test_name = 'ECC-KEYGEN:%s' % data
+ cmd = _keygen_cmd(_ECC_CURVES[curve_id])
+ wrapped_response = tpm.command(tpm.wrap_ext_command(subcmd.ECC, cmd))
+ valid = tpm.unwrap_ext_response(subcmd.ECC, wrapped_response)
expected = '\x01'
if valid != expected:
raise subcmd.TpmTestError('%s error:%s:%s' % (
@@ -148,10 +148,10 @@ def _keyderive_test(tpm):
for data in _KEYDERIVE_INPUTS:
curve_id, seed_bytes = data
seed = os.urandom(seed_bytes)
- test_name = 'EC-KEYDERIVE:%s' % data[0]
- cmd = _keyderive_cmd(_EC_CURVES[curve_id], seed)
- wrapped_response = tpm.command(tpm.wrap_ext_command(subcmd.EC, cmd))
- valid = tpm.unwrap_ext_response(subcmd.EC, wrapped_response)
+ test_name = 'ECC-KEYDERIVE:%s' % data[0]
+ cmd = _keyderive_cmd(_ECC_CURVES[curve_id], seed)
+ wrapped_response = tpm.command(tpm.wrap_ext_command(subcmd.ECC, cmd))
+ valid = tpm.unwrap_ext_response(subcmd.ECC, wrapped_response)
expected = '\x01'
if valid != expected:
raise subcmd.TpmTestError('%s error:%s:%s' % (
diff --git a/test/tpm_test/subcmd.py b/test/tpm_test/subcmd.py
index 7cf10de66c..59c45d2516 100644
--- a/test/tpm_test/subcmd.py
+++ b/test/tpm_test/subcmd.py
@@ -9,7 +9,7 @@
AES = 0
HASH = 1
RSA = 2
-EC = 3
+ECC = 3
FW_UPGRADE = 4
HKDF = 5
ECIES = 6