Manuel Pégourié-Gonnard | 39d2adb | 2012-10-31 09:26:55 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Elliptic curves over GF(p) |
| 3 | * |
| 4 | * Copyright (C) 2012, Brainspark B.V. |
| 5 | * |
| 6 | * This file is part of PolarSSL (http://www.polarssl.org) |
| 7 | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> |
| 8 | * |
| 9 | * All rights reserved. |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This program is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License along |
| 22 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 24 | */ |
| 25 | |
| 26 | /* |
| 27 | * References: |
| 28 | * |
| 29 | * SEC1-v2 (XXX: insert url) |
| 30 | * Guide to Elliptic Curve Cryptography - Hankerson, Menezes, Vanstone |
| 31 | */ |
| 32 | |
| 33 | #include "polarssl/config.h" |
| 34 | |
| 35 | #if defined(POLARSSL_ECP_C) |
| 36 | |
| 37 | #include "polarssl/ecp.h" |
| 38 | |
Manuel Pégourié-Gonnard | 1e8c8ec | 2012-10-31 19:24:21 +0100 | [diff] [blame^] | 39 | /* |
| 40 | * Unallocate (the components of) a point |
| 41 | */ |
| 42 | void ecp_point_free( ecp_point *pt ) |
| 43 | { |
| 44 | if( pt == NULL ) |
| 45 | return; |
| 46 | |
| 47 | mpi_free( &( pt->X ) ); |
| 48 | mpi_free( &( pt->Y ) ); |
| 49 | } |
| 50 | |
| 51 | /* |
| 52 | * Unallocate (the components of) a group |
| 53 | */ |
| 54 | void ecp_group_free( ecp_group *grp ) |
| 55 | { |
| 56 | if( grp == NULL ) |
| 57 | return; |
| 58 | |
| 59 | mpi_free( &( grp->P ) ); |
| 60 | mpi_free( &( grp->B ) ); |
| 61 | mpi_free( &( grp->N ) ); |
| 62 | ecp_point_free( &( grp->G ) ); |
| 63 | } |
Manuel Pégourié-Gonnard | 39d2adb | 2012-10-31 09:26:55 +0100 | [diff] [blame] | 64 | |
| 65 | #if defined(POLARSSL_SELF_TEST) |
| 66 | |
| 67 | /* |
| 68 | * Checkup routine |
| 69 | */ |
| 70 | int ecp_self_test( int verbose ) |
| 71 | { |
| 72 | return( verbose++ ); |
| 73 | } |
| 74 | |
| 75 | #endif |
| 76 | |
| 77 | #endif |