summaryrefslogtreecommitdiff
path: root/chip/g/dcrypto/dcrypto.h
diff options
context:
space:
mode:
authornagendra modadugu <ngm@google.com>2016-01-22 11:37:48 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-02-08 15:24:29 -0800
commit7ac69e594b9a092dfeb76a4969396f7ddde4fbee (patch)
treec8c9eb1d45a74fbc9b9892e28a0c75b46818cb2a /chip/g/dcrypto/dcrypto.h
parent89424bfbedba6c06f4a4ef9e444a2c4d0575883a (diff)
downloadchrome-ec-7ac69e594b9a092dfeb76a4969396f7ddde4fbee.tar.gz
CR50: Add initial elliptic curve crypto implementation.
This change adds support for NIST-P256 curve operations. BRANCH=none BUG=chrome-os-partner:43025,chrome-os-partner:47524 TEST=new tests under test/tpm2/ pass. Change-Id: I03a35ff3ab8af3c52282d882937880bfa2bdcd32 Signed-off-by: nagendra modadugu <ngm@google.com> Reviewed-on: https://chromium-review.googlesource.com/324540 Commit-Ready: Nagendra Modadugu <ngm@google.com> Tested-by: Nagendra Modadugu <ngm@google.com> Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'chip/g/dcrypto/dcrypto.h')
-rw-r--r--chip/g/dcrypto/dcrypto.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/chip/g/dcrypto/dcrypto.h b/chip/g/dcrypto/dcrypto.h
index 3d8e78ab96..c0422208ae 100644
--- a/chip/g/dcrypto/dcrypto.h
+++ b/chip/g/dcrypto/dcrypto.h
@@ -119,4 +119,22 @@ int DCRYPTO_rsa_verify(struct RSA *rsa, const uint8_t *digest,
const uint32_t sig_len, enum padding_mode padding,
enum hashing_mode hashing);
+/*
+ * EC.
+ */
+int DCRYPTO_p256_valid_point(const p256_int *x, const p256_int *y);
+int DCRYPTO_p256_base_point_mul(p256_int *out_x, p256_int *out_y,
+ const p256_int *n);
+int DCRYPTO_p256_points_mul(p256_int *out_x, p256_int *out_y,
+ const p256_int *n1, const p256_int *n2,
+ const p256_int *in_x, const p256_int *in_y);
+int DCRYPTO_p256_key_from_bytes(p256_int *x, p256_int *y, p256_int *d,
+ const uint8_t key_bytes[P256_NBYTES]);
+
+void DCRYPTO_p256_ecdsa_sign(const p256_int *d, const p256_int *digest,
+ p256_int *r, p256_int *s);
+int DCRYPTO_p256_ecdsa_verify(const p256_int *key_x, const p256_int *key_y,
+ const p256_int *digest, const p256_int *r,
+ const p256_int *s);
+
#endif /* ! __EC_CHIP_G_DCRYPTO_DCRYPTO_H */