Donatien Garnier / MiniTLS-GPL

Dependents:   MiniTLS-HTTPS-Example

Committer:
MiniTLS
Date:
Fri Jun 06 10:49:02 2014 +0000
Revision:
0:35aa5be3b78d
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MiniTLS 0:35aa5be3b78d 1 /*
MiniTLS 0:35aa5be3b78d 2 MuTLS - A super trimmed down TLS/SSL Library for embedded devices
MiniTLS 0:35aa5be3b78d 3 Author: Donatien Garnier
MiniTLS 0:35aa5be3b78d 4 Copyright (C) 2013-2014 AppNearMe Ltd
MiniTLS 0:35aa5be3b78d 5
MiniTLS 0:35aa5be3b78d 6 This program is free software; you can redistribute it and/or
MiniTLS 0:35aa5be3b78d 7 modify it under the terms of the GNU General Public License
MiniTLS 0:35aa5be3b78d 8 as published by the Free Software Foundation; either version 2
MiniTLS 0:35aa5be3b78d 9 of the License, or (at your option) any later version.
MiniTLS 0:35aa5be3b78d 10
MiniTLS 0:35aa5be3b78d 11 This program is distributed in the hope that it will be useful,
MiniTLS 0:35aa5be3b78d 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
MiniTLS 0:35aa5be3b78d 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MiniTLS 0:35aa5be3b78d 14 GNU General Public License for more details.
MiniTLS 0:35aa5be3b78d 15
MiniTLS 0:35aa5be3b78d 16 You should have received a copy of the GNU General Public License
MiniTLS 0:35aa5be3b78d 17 along with this program; if not, write to the Free Software
MiniTLS 0:35aa5be3b78d 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
MiniTLS 0:35aa5be3b78d 19 *//* LibTomCrypt, modular cryptographic library -- Tom St Denis
MiniTLS 0:35aa5be3b78d 20 *
MiniTLS 0:35aa5be3b78d 21 * LibTomCrypt is a library that provides various cryptographic
MiniTLS 0:35aa5be3b78d 22 * algorithms in a highly modular and flexible manner.
MiniTLS 0:35aa5be3b78d 23 *
MiniTLS 0:35aa5be3b78d 24 * The library is free for all purposes without any express
MiniTLS 0:35aa5be3b78d 25 * guarantee it works.
MiniTLS 0:35aa5be3b78d 26 *
MiniTLS 0:35aa5be3b78d 27 * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
MiniTLS 0:35aa5be3b78d 28 */
MiniTLS 0:35aa5be3b78d 29
MiniTLS 0:35aa5be3b78d 30 /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b
MiniTLS 0:35aa5be3b78d 31 *
MiniTLS 0:35aa5be3b78d 32 * All curves taken from NIST recommendation paper of July 1999
MiniTLS 0:35aa5be3b78d 33 * Available at http://csrc.nist.gov/cryptval/dss.htm
MiniTLS 0:35aa5be3b78d 34 */
MiniTLS 0:35aa5be3b78d 35 #include "ltc.h"
MiniTLS 0:35aa5be3b78d 36
MiniTLS 0:35aa5be3b78d 37 /**
MiniTLS 0:35aa5be3b78d 38 @file ltc_ecc_points.c
MiniTLS 0:35aa5be3b78d 39 ECC Crypto, Tom St Denis
MiniTLS 0:35aa5be3b78d 40 */
MiniTLS 0:35aa5be3b78d 41
MiniTLS 0:35aa5be3b78d 42 //Nodynamic alloc
MiniTLS 0:35aa5be3b78d 43 #if 0 //ifdef LTC_MECC
MiniTLS 0:35aa5be3b78d 44
MiniTLS 0:35aa5be3b78d 45 /**
MiniTLS 0:35aa5be3b78d 46 Allocate a new ECC point
MiniTLS 0:35aa5be3b78d 47 @return A newly allocated point or NULL on error
MiniTLS 0:35aa5be3b78d 48 */
MiniTLS 0:35aa5be3b78d 49 ecc_point *ltc_ecc_new_point(void)
MiniTLS 0:35aa5be3b78d 50 {
MiniTLS 0:35aa5be3b78d 51 ecc_point *p;
MiniTLS 0:35aa5be3b78d 52 p = XCALLOC(1, sizeof(*p));
MiniTLS 0:35aa5be3b78d 53 if (p == NULL) {
MiniTLS 0:35aa5be3b78d 54 return NULL;
MiniTLS 0:35aa5be3b78d 55 }
MiniTLS 0:35aa5be3b78d 56 if (mp_init_multi(&p->x, &p->y, &p->z, NULL) != CRYPT_OK) {
MiniTLS 0:35aa5be3b78d 57 XFREE(p);
MiniTLS 0:35aa5be3b78d 58 return NULL;
MiniTLS 0:35aa5be3b78d 59 }
MiniTLS 0:35aa5be3b78d 60 return p;
MiniTLS 0:35aa5be3b78d 61 }
MiniTLS 0:35aa5be3b78d 62
MiniTLS 0:35aa5be3b78d 63 /** Free an ECC point from memory
MiniTLS 0:35aa5be3b78d 64 @param p The point to free
MiniTLS 0:35aa5be3b78d 65 */
MiniTLS 0:35aa5be3b78d 66 void ltc_ecc_del_point(ecc_point *p)
MiniTLS 0:35aa5be3b78d 67 {
MiniTLS 0:35aa5be3b78d 68 /* prevents free'ing null arguments */
MiniTLS 0:35aa5be3b78d 69 if (p != NULL) {
MiniTLS 0:35aa5be3b78d 70 mp_clear_multi(p->x, p->y, p->z, NULL); /* note: p->z may be NULL but that's ok with this function anyways */
MiniTLS 0:35aa5be3b78d 71 XFREE(p);
MiniTLS 0:35aa5be3b78d 72 }
MiniTLS 0:35aa5be3b78d 73 }
MiniTLS 0:35aa5be3b78d 74
MiniTLS 0:35aa5be3b78d 75 #endif
MiniTLS 0:35aa5be3b78d 76 /* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ltc_ecc_points.c,v $ */
MiniTLS 0:35aa5be3b78d 77 /* $Revision: 1.7 $ */
MiniTLS 0:35aa5be3b78d 78 /* $Date: 2007/05/12 14:32:35 $ */
MiniTLS 0:35aa5be3b78d 79