Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MiniTLS-HTTPS-Example
ltc_ecc_points.c
00001 /* 00002 MiniTLS - A super trimmed down TLS/SSL Library for embedded devices 00003 Author: Donatien Garnier 00004 Copyright (C) 2013-2014 AppNearMe Ltd 00005 00006 This program is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU General Public License 00008 as published by the Free Software Foundation; either version 2 00009 of the License, or (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 *//* LibTomCrypt, modular cryptographic library -- Tom St Denis 00020 * 00021 * LibTomCrypt is a library that provides various cryptographic 00022 * algorithms in a highly modular and flexible manner. 00023 * 00024 * The library is free for all purposes without any express 00025 * guarantee it works. 00026 * 00027 * Tom St Denis, tomstdenis@gmail.com, http://libtom.org 00028 */ 00029 00030 /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b 00031 * 00032 * All curves taken from NIST recommendation paper of July 1999 00033 * Available at http://csrc.nist.gov/cryptval/dss.htm 00034 */ 00035 #include "ltc.h" 00036 00037 /** 00038 @file ltc_ecc_points.c 00039 ECC Crypto, Tom St Denis 00040 */ 00041 00042 //Nodynamic alloc 00043 #if 0 //ifdef LTC_MECC 00044 00045 /** 00046 Allocate a new ECC point 00047 @return A newly allocated point or NULL on error 00048 */ 00049 ecc_point *ltc_ecc_new_point(void) 00050 { 00051 ecc_point *p; 00052 p = XCALLOC(1, sizeof(*p)); 00053 if (p == NULL) { 00054 return NULL; 00055 } 00056 if (mp_init_multi(&p->x, &p->y, &p->z, NULL) != CRYPT_OK) { 00057 XFREE(p); 00058 return NULL; 00059 } 00060 return p; 00061 } 00062 00063 /** Free an ECC point from memory 00064 @param p The point to free 00065 */ 00066 void ltc_ecc_del_point(ecc_point *p) 00067 { 00068 /* prevents free'ing null arguments */ 00069 if (p != NULL) { 00070 mp_clear_multi(p->x, p->y, p->z, NULL); /* note: p->z may be NULL but that's ok with this function anyways */ 00071 XFREE(p); 00072 } 00073 } 00074 00075 #endif 00076 /* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ltc_ecc_points.c,v $ */ 00077 /* $Revision: 1.7 $ */ 00078 /* $Date: 2007/05/12 14:32:35 $ */ 00079
Generated on Wed Jul 13 2022 00:22:54 by
1.7.2