summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagendra modadugu <ngm@google.com>2017-01-13 12:36:27 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-01-28 04:11:08 -0800
commit25d3f259dbdde99d83b3fe7e14fd9e9c8af007ff (patch)
treed60e16e0cb408612573450d11fe4b984bfafae1c /test
parent39a41bd665e5abe758be36bd5b5bbf4fe8e43778 (diff)
downloadchrome-ec-25d3f259dbdde99d83b3fe7e14fd9e9c8af007ff.tar.gz
CR50: add support for 4k RSA verify
Add support for verifying messages signed with 4096-bit RSA keys. Such messages may be generated by host side applications. Also update tpmtest.py to test 4k verification. BRANCH=none BUG=none TEST=added new tests to tpmtest.py; TCG tests pass Change-Id: I7450bd710c154c68c030ce176bfe7becbfbcb729 Signed-off-by: nagendra modadugu <ngm@google.com> Reviewed-on: https://chromium-review.googlesource.com/428220 Commit-Ready: Nagendra Modadugu <ngm@google.com> Tested-by: Marius Schilder <mschilder@chromium.org> Tested-by: Nagendra Modadugu <ngm@google.com> Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/tpm_test/rsa1024.pem15
-rw-r--r--test/tpm_test/rsa2048.pem27
-rw-r--r--test/tpm_test/rsa4096.pem51
-rw-r--r--test/tpm_test/rsa768.pem12
-rw-r--r--test/tpm_test/rsa_test.py95
5 files changed, 183 insertions, 17 deletions
diff --git a/test/tpm_test/rsa1024.pem b/test/tpm_test/rsa1024.pem
new file mode 100644
index 0000000000..3a349130f0
--- /dev/null
+++ b/test/tpm_test/rsa1024.pem
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXAIBAAKBgQDfTq9zRZSYNDB+Jq1Ag/kXIbBOGw1qRM5OPi5yTJffiYo5ECWu
+IEzyOyCypRDdsmtiTqafkkrZhpfMcCA7ajJjyn9Z+1e2qZnp0C4PHNR9i6C9D9LV
+Ox8RtGqUz08KK0Tn+mskkbSCH/Z1tpHFoPYv1f8Qc5s09nqII6lCPKgkkQIDAQAB
+AoGBAJpthfQHqG1hmi+De8jj+3y9tXkuSCa3kpyVb/VndpgGO+qeehBjEhNqRICG
+mpVWb+C6V4x+1Ph9lbixyfiMxm7le6CvoE5OhNeXuVrdMuUr5YCzsr9W/wHc5qZs
+SoEdj+pL7SQI9GevDfL9Nz8xJfruNbDbZhH/SeHl/xvMww4JAkEA+V55ZUNwQINQ
+Crths4d7JI8qA1u1S5SUZ6qY1hRAkDykDW1YMcVC8S0VDufN5j7K2JQ3qkzW8yEu
+pP4deUTXswJBAOU+zUuXxZY5cJc6EKnDNQrWK/USjbLACxxfoAuGg6eQ6fgWkp/O
+E0wU6J5MJO//WCIG+c/9Gbcj+eOz43qbsKsCQFYw7Uyu7pGd0YCkG7Tt0wZj5WWb
+wSIKjPD36jO0dExmaV2quZ0aTXUG3Ax22pgGhB4vvL3EKVeH1JN6sb1EqjkCQC8X
+yqanxABLRnTaicfGASR7wMX0jMVWrDGk90TG2k7W9yluwaowdEhh1zOFouTmiJ1c
+3365mMnFizUapDVwvEcCQGqkxcod+m/s4Zq2a9DAyfN3FD2AtJ7QasveLXvR16Od
+MRa0hOWA8d3hh+eHU8DsJ+csEuKeDui3tV4kY0UTF0Y=
+-----END RSA PRIVATE KEY-----
diff --git a/test/tpm_test/rsa2048.pem b/test/tpm_test/rsa2048.pem
new file mode 100644
index 0000000000..8031296fbd
--- /dev/null
+++ b/test/tpm_test/rsa2048.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAnNdhLkOOFb7Nc5+39YZL45WQXIUZTB0uLO9uH+11Mg8KwXKf
+DHhQopmCU5C+ZCNJdXsM6y1ol9avsaoq3l6b4wYN8qzZ1x9Qbsld67TwwJgjBDBG
+ENzUa1fHMMMG3a9RbkBB+BDeSRhSsxjKSVCoOs22lHvb8S0FzlcLvjhIu8mxdja4
+qMziB1zIe8/P8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XNM2sGK9vmEJi/EwM8I8XffrDUN
+Kh0hajl+rqPdvSR86AIfBK7DXpupytPTkBeksUuCvwsOgh+klEnrNbWer3eaxag/
+CrT9QntUf7bzBuRtAxDCSGmteRQ0smsQYUVoujx56KuKK1sJJP4RZ9rhLvJjjfAQ
++6W9AoGBAL0hOd3kCVY8kxDQry9M30lPZcftJga2IxTErBex60rA9ifmHLm4iFXt
+/e52/1OZVE4Cf7QFEFeSLiBA+U8I0FdV4VMyrfTpjKNVBIDB7JmskdhQbIPXOZzY
+fC2yxCmVsD6PjMDDlT//ck5AQVrktdDpwBj3OX7JSc31KOMBb8FU
+-----END RSA PRIVATE KEY-----
diff --git a/test/tpm_test/rsa4096.pem b/test/tpm_test/rsa4096.pem
new file mode 100644
index 0000000000..c1f82a2d38
--- /dev/null
+++ b/test/tpm_test/rsa4096.pem
@@ -0,0 +1,51 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIJJwIBAAKCAgEAtNKrnPpCmjdwKuQth2d/FbYxBgbVWumOqdRta5K5Yzd9nPDK
+CkQZ8HGnTOCQnL5pSpxVGLNCQ9lsZf3RzyAMkjQnRkhYCxPN8WdwAn7nTKnY/UgX
+gPYBDmGwvu+HK3EOZYHBUM64ZdLX+nbEtxPZ7drWn54QslD0/fT57NgzVu/0ItPC
+uknVqQuwGKPZJs0ndmpyGzGsPULo2SbTkLs5ZLvqiQt6tIg56unKGYxC+2kiyo69
+bHO3iKChGaj6lFUgb4C612kSH3SC7K/uKK/N2q0bW1TkK+8MTdGr1wPEpJmgvH6d
+PC80O9Xdau2mGZODvuLUb5L/Vaf3Z+vjRtPnbcAplSu/3bSTu0UB/FMhzp+LkIAJ
+uhpuCIcVtHSj3LvbRfI4IIXDnkpFHnUYBUKGrUfmqu2Imp83o7jHmTXiqI6dLrzy
+ZEjDY08c0EXDQaG+5cKkXUXwA4PJgExo8NHa8VGB1f7E6IrWMpU42Dva94xcawH0
+bhK1tjbj0apJRGrz5nsZffg1yy24YlTPLWazf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AFNBMCo8ZwWlQBfeI7QKDQn/pe4J4Z/lC57d9futfyNLsu59fnG
+u1XmXbfUimloRf2Wssct7Tl2f0FGxBpdbaBzrMlyD9dhkSbX54phLRS6eyL6Xeqf
+k64Y1nRX74xnrNIJjNQF5/D9eoB5H5kCggEADkSUsvqv/hpMMNRIyXsIKIko4EW3
+L0ceh7Unl1vvekku7aLMrHqzu6tu6QoUXc9jMxhS9et41a7NqeLH4MFEqENoxQ6G
+tJTCuklNgKWiooQIN/Wm0t82a3M3kvcqIbCCG5EGDL/7Uh48DQGpSOGehEn6TYnG
+W42bU/Beq38LQzN4eQPhsiqmOwNJ4dYc4NqpOIkXi6UTCe9hDcpX2p7hG55zkpOA
+2rxpIOeOVSRHHOE8RsfIr8FzO/823P1mOQe5xMSCf1GSj6I+bopT0chL9JsiHLZa
+1VPn744OJjXt14LAt4byOVvgdSoQAgxWEC0LhmHYNXt8/YRMJiZ01bc1dA==
+-----END RSA PRIVATE KEY-----
diff --git a/test/tpm_test/rsa768.pem b/test/tpm_test/rsa768.pem
new file mode 100644
index 0000000000..5be0fdf5f7
--- /dev/null
+++ b/test/tpm_test/rsa768.pem
@@ -0,0 +1,12 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIBywIBAAJhALDb7UbZMvB81CAj0jVahhfbJHI2MzvCZIukSW50/vrSggzEEjpI
+Z+EVzJTfRBtOwBi6RhtRLOIPwDJ37V+L5aMA5jwtpxCJU6grM3Q49zYA/d1bvXvB
+fOF1kCt4LTmFaQIDAQABAmEArq25UCWMG1yfQtM+dnXfRUarW6bOuXJJTmbIJDGn
++WHbEvLBMhF7kCOwuUU/Bl2i1zUP3fwD342Ra4P5We5nHhognov49uKy9SlxTCJU
+z36XvHAk3W1S/hfZ1kF7dkABAjEA1glkyPNcAsfGR05/Q50xRnozhaCkFuoie81k
+m1Dspy9+z+tpKTSOt7Wzun+bAX1pAjEA04iSLdXGKfTwLmHwYK2pRhGpDGkUMQk2
+i3AbEZsmOTQ0/fGaiVFjCsZgC7oYjsgBAjA8oMSPt3+kufoMUMvz1x8SG6NkgrB4
+XTIPZ4rMBAxE/0sokkJjjaOvniSe+25o6aECMQCG3oedM7SSIbpVSFqTuYW4yB/J
+auHV1fLx+ns3wX0gcdnro3SNYtfMEelA8NkhiAECMGVIqAN9qpGW5qAyikDrmzod
+7+wMrWHefpWKsih4+MIvAo7WOOoM+1UasRwVGhMxFQ==
+-----END RSA PRIVATE KEY-----
diff --git a/test/tpm_test/rsa_test.py b/test/tpm_test/rsa_test.py
index a368adefd0..b98d3306c5 100644
--- a/test/tpm_test/rsa_test.py
+++ b/test/tpm_test/rsa_test.py
@@ -6,13 +6,23 @@
"""Module for testing rsa functions using extended commands."""
import binascii
+import Crypto
+import Crypto.Hash.SHA
+import Crypto.Hash.SHA256
+import Crypto.Hash.SHA384
+import Crypto.Hash.SHA512
+from Crypto.PublicKey import RSA
+import Crypto.Signature.PKCS1_PSS
+import Crypto.Signature.PKCS1_v1_5
import hashlib
+import os
import rsa
import struct
import subcmd
import utils
+_MODULE_DIR = os.path.dirname(os.path.abspath(__file__))
_RSA_OPCODES = {
'ENCRYPT': 0x00,
@@ -41,9 +51,29 @@ _RSA_PADDING = {
_HASH = {
'NONE': 0x00,
'SHA1': 0x04,
- 'SHA256': 0x0B
+ 'SHA256': 0x0B,
+ 'SHA384': 0x0C,
+ 'SHA512': 0x0D,
}
+_SIGNER = {
+ 'PKCS1-SSA': Crypto.Signature.PKCS1_v1_5,
+ 'PKCS1-PSS': Crypto.Signature.PKCS1_PSS,
+}
+
+_HASHER = {
+ 'SHA1': Crypto.Hash.SHA,
+ 'SHA256': Crypto.Hash.SHA256,
+ 'SHA384': Crypto.Hash.SHA384,
+ 'SHA512': Crypto.Hash.SHA512,
+}
+
+_KEYS = {
+ 768: RSA.importKey(open(os.path.join(_MODULE_DIR, 'rsa768.pem')).read()),
+ 1024: RSA.importKey(open(os.path.join(_MODULE_DIR, 'rsa1024.pem')).read()),
+ 2048: RSA.importKey(open(os.path.join(_MODULE_DIR, 'rsa2048.pem')).read()),
+ 4096: RSA.importKey(open(os.path.join(_MODULE_DIR, 'rsa4096.pem')).read()),
+}
# Command format.
#
@@ -80,13 +110,8 @@ def _encrypt_cmd(padding, hashing, key_len, msg):
dl='', dig='')
-def _sign_cmd(padding, hashing, key_len, msg):
+def _sign_cmd(padding, hashing, key_len, digest):
op = _RSA_OPCODES['SIGN']
- digest = ''
- if hashing == _HASH['SHA1']:
- digest = hashlib.sha1(msg).digest()
- elif hashing == _HASH['SHA256']:
- digest = hashlib.sha256(msg).digest()
digest_len = len(digest)
return _RSA_CMD_FORMAT.format(o=op, p=padding, h=hashing,
kl=struct.pack('>H', key_len),
@@ -94,14 +119,9 @@ def _sign_cmd(padding, hashing, key_len, msg):
dl='', dig='')
-def _verify_cmd(padding, hashing, key_len, sig, msg):
+def _verify_cmd(padding, hashing, key_len, sig, digest):
op = _RSA_OPCODES['VERIFY']
sig_len = len(sig)
- digest = ''
- if hashing == _HASH['SHA1']:
- digest = hashlib.sha1(msg).digest()
- elif hashing == _HASH['SHA256']:
- digest = hashlib.sha256(msg).digest()
digest_len = len(digest)
return _RSA_CMD_FORMAT.format(o=op, p=padding, h=hashing,
kl=struct.pack('>H', key_len),
@@ -585,9 +605,23 @@ _SIGN_INPUTS = (
('PKCS1-SSA', 'SHA1', 768),
('PKCS1-SSA', 'SHA256', 768),
('PKCS1-SSA', 'SHA256', 1024),
+ ('PKCS1-SSA', 'SHA384', 2048),
+ ('PKCS1-SSA', 'SHA512', 2048),
+ ('PKCS1-PSS', 'SHA1', 768),
+ ('PKCS1-PSS', 'SHA256', 768),
+ ('PKCS1-PSS', 'SHA256', 2048),
+)
+
+_VERIFY_INPUTS = (
+ ('PKCS1-SSA', 'SHA1', 768),
+ ('PKCS1-SSA', 'SHA256', 768),
+ ('PKCS1-SSA', 'SHA256', 1024),
+ ('PKCS1-SSA', 'SHA384', 2048),
+ ('PKCS1-SSA', 'SHA512', 4096),
('PKCS1-PSS', 'SHA1', 768),
('PKCS1-PSS', 'SHA256', 768),
('PKCS1-PSS', 'SHA256', 2048),
+ ('PKCS1-PSS', 'SHA256', 4096),
)
_KEYTEST_INPUTS = (
@@ -644,17 +678,43 @@ def _encrypt_tests(tpm):
def _sign_tests(tpm):
- msg = 'Hello CR50!'
-
for data in _SIGN_INPUTS:
+ msg = rsa.randnum.read_random_bits(256)
padding, hashing, key_len = data
test_name = 'RSA-SIGN:%s:%s:%d' % data
- cmd = _sign_cmd(_RSA_PADDING[padding], _HASH[hashing], key_len, msg)
+
+ key = _KEYS[key_len]
+ verifier = _SIGNER[padding].new(key)
+ h = _HASHER[hashing].new()
+ h.update(msg)
+
+ cmd = _sign_cmd(_RSA_PADDING[padding], _HASH[hashing], key_len, h.digest())
wrapped_response = tpm.command(tpm.wrap_ext_command(subcmd.RSA, cmd))
signature = tpm.unwrap_ext_response(subcmd.RSA, wrapped_response)
+ signer = _SIGNER[padding].new(key)
+ expected_signature = signer.sign(h)
+
+ if not verifier.verify(h, signature):
+ raise subcmd.TpmTestError('%s error' % (
+ test_name,))
+ print('%sSUCCESS: %s' % (utils.cursor_back(), test_name))
+
+
+def _verify_tests(tpm):
+ for data in _VERIFY_INPUTS:
+ msg = rsa.randnum.read_random_bits(256)
+ padding, hashing, key_len = data
+ test_name = 'RSA-VERIFY:%s:%s:%d' % data
+
+ key = _KEYS[key_len]
+ signer = _SIGNER[padding].new(key)
+ h = _HASHER[hashing].new()
+ h.update(msg)
+ signature = signer.sign(h)
+
cmd = _verify_cmd(_RSA_PADDING[padding], _HASH[hashing],
- key_len, signature, msg)
+ key_len, signature, h.digest())
wrapped_response = tpm.command(tpm.wrap_ext_command(subcmd.RSA, cmd))
verified = tpm.unwrap_ext_response(subcmd.RSA, wrapped_response)
expected = '\x01'
@@ -751,6 +811,7 @@ def _x509_verify_tests(tpm):
def rsa_test(tpm):
_encrypt_tests(tpm)
_sign_tests(tpm)
+ _verify_tests(tpm)
_keytest_tests(tpm)
_keygen_tests(tpm)
_primegen_tests(tpm)