From 3f8ecd933a610c6f3b5d02e184c7faf205ad95d3 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 15 Jan 2017 14:16:51 +0100 Subject: tls: rearrange code, add/improve comments, fix whitespace, no real changes here Signed-off-by: Denys Vlasenko --- networking/tls_pstm.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'networking/tls_pstm.c') diff --git a/networking/tls_pstm.c b/networking/tls_pstm.c index 0d797f87f..f802baa15 100644 --- a/networking/tls_pstm.c +++ b/networking/tls_pstm.c @@ -5,6 +5,10 @@ */ #include "tls.h" +/* The file is taken almost verbatim from matrixssl-3-7-2b-open/crypto/math/. + * Changes are flagged with ///bbox + */ + /** * @file pstm.c * @version 33ef80f (HEAD, tag: MATRIXSSL-3-7-2-OPEN, tag: MATRIXSSL-3-7-2-COMM, origin/master, origin/HEAD, master) @@ -51,12 +55,13 @@ static int32 pstm_mul_2d(pstm_int *a, int16 b, pstm_int *c); */ int32 pstm_init_size(psPool_t *pool, pstm_int * a, uint32 size) { +///bbox // uint16 x; /* alloc mem */ - a->dp = xzalloc(sizeof (pstm_digit) * size); + a->dp = xzalloc(sizeof (pstm_digit) * size);///bbox a->pool = pool; a->used = 0; a->alloc = (int16)size; @@ -77,11 +82,12 @@ int32 pstm_init_size(psPool_t *pool, pstm_int * a, uint32 size) */ int32 pstm_init(psPool_t *pool, pstm_int * a) { +///bbox // int32 i; /* allocate memory required and clear it */ - a->dp = xzalloc(sizeof (pstm_digit) * PSTM_DEFAULT_INIT); + a->dp = xzalloc(sizeof (pstm_digit) * PSTM_DEFAULT_INIT);///bbox /* set the digits to zero */ @@ -120,7 +126,7 @@ int32 pstm_grow(pstm_int * a, int16 size) We store the return in a temporary variable in case the operation failed we don't want to overwrite the dp member of a. */ - tmp = xrealloc(a->dp, sizeof (pstm_digit) * size); + tmp = xrealloc(a->dp, sizeof (pstm_digit) * size);///bbox /* reallocation succeeded so set a->dp */ @@ -1616,7 +1622,7 @@ int32 pstm_exptmod(psPool_t *pool, pstm_int *G, pstm_int *X, pstm_int *P, Pre-allocated digit. Used for mul, sqr, AND reduce */ paDlen = ((M[1].used + 3) * 2) * sizeof(pstm_digit); - paD = xzalloc(paDlen); + paD = xzalloc(paDlen);///bbox /* compute the value at M[1<<(winsize-1)] by squaring M[1] (winsize-1) times */ -- cgit v1.2.3