Bug Summary

File:lib/nettle/ecc_map.c
Location:line 48, column 8
Description:Although the value stored to 'err' is used in the enclosing expression, the value is never actually read from 'err'

Annotated Source Code

1/*
2 * Copyright (C) 2011-2012 Free Software Foundation, Inc.
3 *
4 * This file is part of GNUTLS.
5 *
6 * The GNUTLS library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either version 3 of
9 * the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>
18 *
19 */
20
21/* Based on public domain code of LibTomCrypt by Tom St Denis.
22 * Adapted to gmp and nettle by Nikos Mavrogiannopoulos.
23 */
24
25#include "ecc.h"
26
27/*
28 @file ecc_map.c
29 ECC Crypto, Tom St Denis
30*/
31
32/*
33 Map a projective jacobian point back to affine space
34 @param P [in/out] The point to map
35 @param modulus The modulus of the field the ECC curve is in
36 @param mp The "b" value from montgomery_setup()
37 @return 0 on success
38*/
39int
40ecc_map (ecc_point * P, mpz_t modulus)
41{
42 mpz_t t1, t2;
43 int err;
44
45 if (P == NULL((void*)0))
46 return -1;
47
48 if ((err = mp_init_multi (&t1, &t2, NULL((void*)0))) != 0)
Although the value stored to 'err' is used in the enclosing expression, the value is never actually read from 'err'
49 {
50 return -1;
51 }
52
53 mpz_mod__gmpz_mod (P->z, P->z, modulus);
54
55 /* get 1/z */
56 mpz_invert__gmpz_invert (t1, P->z, modulus);
57
58 /* get 1/z^2 and 1/z^3 */
59 mpz_mul__gmpz_mul (t2, t1, t1);
60 mpz_mod__gmpz_mod (t2, t2, modulus);
61 mpz_mul__gmpz_mul (t1, t1, t2);
62 mpz_mod__gmpz_mod (t1, t1, modulus);
63
64 /* multiply against x/y */
65 mpz_mul__gmpz_mul (P->x, P->x, t2);
66 mpz_mod__gmpz_mod (P->x, P->x, modulus);
67 mpz_mul__gmpz_mul (P->y, P->y, t1);
68 mpz_mod__gmpz_mod (P->y, P->y, modulus);
69 mpz_set_ui__gmpz_set_ui (P->z, 1);
70
71 err = 0;
72
73 mp_clear_multi (&t1, &t2, NULL((void*)0));
74 return err;
75}
76
77/* $Source: /webcvs/gnutls/gnutls/clang/report-4lXRsy.html,v $ */
78/* $Revision: 1.1 $ */
79/* $Date: 2012/01/20 14:01:22 $ */