From ffcb5e99cc9e0e9268e536ca85618877f23be74b Mon Sep 17 00:00:00 2001 From: matejcik Date: Fri, 17 May 2019 14:26:02 +0200 Subject: [PATCH] mocks: fix shamir package --- .../modtrezorcrypto/modtrezorcrypto-shamir.h | 6 ++++-- core/mocks/generated/trezorcrypto/shamir.py | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 core/mocks/generated/trezorcrypto/shamir.py diff --git a/core/embed/extmod/modtrezorcrypto/modtrezorcrypto-shamir.h b/core/embed/extmod/modtrezorcrypto/modtrezorcrypto-shamir.h index a1589af271..2b889bc1dc 100644 --- a/core/embed/extmod/modtrezorcrypto/modtrezorcrypto-shamir.h +++ b/core/embed/extmod/modtrezorcrypto/modtrezorcrypto-shamir.h @@ -25,8 +25,10 @@ #define SHAMIR_MAX_SHARE_COUNT 16 +/// package: trezorcrypto.shamir + /// def interpolate(shares, x) -> bytes: -/// ''' +/// """ /// Returns f(x) given the Shamir shares (x_1, f(x_1)), ... , (x_k, f(x_k)). /// :param shares: The Shamir shares. /// :type shares: A list of pairs (x_i, y_i), where x_i is an integer and @@ -35,7 +37,7 @@ /// :param int x: The x coordinate of the result. /// :return: Evaluations of the polynomials in x. /// :rtype: Array of bytes. -/// ''' +/// """ mp_obj_t mod_trezorcrypto_shamir_interpolate(mp_obj_t shares, mp_obj_t x) { size_t share_count; mp_obj_t *share_items; diff --git a/core/mocks/generated/trezorcrypto/shamir.py b/core/mocks/generated/trezorcrypto/shamir.py new file mode 100644 index 0000000000..e7da75110a --- /dev/null +++ b/core/mocks/generated/trezorcrypto/shamir.py @@ -0,0 +1,15 @@ +from typing import * # noqa: F401 + + +# extmod/modtrezorcrypto/modtrezorcrypto-shamir.h +def interpolate(shares, x) -> bytes: + """ + Returns f(x) given the Shamir shares (x_1, f(x_1)), ... , (x_k, f(x_k)). + :param shares: The Shamir shares. + :type shares: A list of pairs (x_i, y_i), where x_i is an integer and + y_i is an array of bytes representing the evaluations of the + polynomials in x_i. + :param int x: The x coordinate of the result. + :return: Evaluations of the polynomials in x. + :rtype: Array of bytes. + """