From 7c95244ef68f0909954297f399ca1509b7dc63a1 Mon Sep 17 00:00:00 2001 From: aaron levin Date: Fri, 6 Feb 2015 10:27:59 -0500 Subject: [PATCH] Add methods to return values def'd at compile time This will support higher-level languages interfacing with `micro-ecc`. --- uECC.c | 10 ++++++++++ uECC.h | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/uECC.c b/uECC.c index aded242..3bf2c42 100644 --- a/uECC.c +++ b/uECC.c @@ -2333,3 +2333,13 @@ int uECC_verify(const uint8_t p_publicKey[uECC_BYTES*2], const uint8_t p_hash[uE /* Accept only if v == r. */ return (vli_cmp(rx, r) == 0); } + +int uECC_bytes() +{ + return uECC_BYTES; +} + +int uECC_curve() +{ + return uECC_CURVE; +} diff --git a/uECC.h b/uECC.h index 2c9927b..06c65e8 100644 --- a/uECC.h +++ b/uECC.h @@ -164,6 +164,26 @@ Returns 1 if the signature is valid, 0 if it is invalid. */ int uECC_verify(const uint8_t p_publicKey[uECC_BYTES*2], const uint8_t p_hash[uECC_BYTES], const uint8_t p_signature[uECC_BYTES*2]); +/* uECC_bytes() function. +Return the value of uECC_BYTES. Helpful for foreign-interfaces to higher-level languages. + +Inputs: + (none) + +Returns the value of uECC_BYTES +*/ +int uECC_bytes(); + +/* uECC_curve() function. +Return the value of uECC_CURVE. Helpful for foreign-interfaces to higher-level languages. + +Inputs: + (none) + +Returns the value of uECC_CURVE +*/ +int uECC_curve(); + #ifdef __cplusplus } /* end of extern "C" */ #endif