A super trimmed down TLS stack, GPL licensed

Dependents:   MiniTLS-HTTPS-Example

MiniTLS - A super trimmed down TLS/SSL Library for embedded devices Author: Donatien Garnier Copyright (C) 2013-2014 AppNearMe Ltd

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Committer:
MiniTLS
Date:
Tue Jun 10 14:23:09 2014 +0000
Revision:
4:cbaf466d717d
Parent:
2:527a66d0a1a9
Fixes for mbed

Who changed what in which revision?

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