Webserver+3d print
Dependents:
Nucleo
« Back to documentation index
ec.c File Reference
ECC (Elliptic Curve Cryptography)
More...
Go to the source code of this file.
Functions
void ecInitDomainParameters (EcDomainParameters *params)
Initialize EC domain parameters.
void ecFreeDomainParameters (EcDomainParameters *params)
Release EC domain parameters.
error_t ecLoadDomainParameters (EcDomainParameters *params, const EcCurveInfo *curveInfo)
Load EC domain parameters.
void ecInit (EcPoint *r)
Initialize elliptic curve point.
void ecFree (EcPoint *r)
Release an elliptic curve point.
error_t ecCopy (EcPoint *r, const EcPoint *s)
Copy EC point.
error_t ecImport (const EcDomainParameters *params, EcPoint *r, const uint8_t *data, size_t length)
Convert an octet string to an EC point.
error_t ecExport (const EcDomainParameters *params, const EcPoint *a, uint8_t *data, size_t *length)
Convert an EC point to an octet string.
error_t ecProjectify (const EcDomainParameters *params, EcPoint *r, const EcPoint *s)
Compute projective representation.
error_t ecAffinify (const EcDomainParameters *params, EcPoint *r, const EcPoint *s)
Recover affine representation.
bool_t ecIsPointAffine (const EcDomainParameters *params, const EcPoint *s)
Check whether the affine point S is on the curve.
error_t ecDouble (const EcDomainParameters *params, EcPoint *r, const EcPoint *s)
Point doubling.
error_t ecAdd (const EcDomainParameters *params, EcPoint *r, const EcPoint *s, const EcPoint *t)
Point addition (helper routine)
error_t ecFullAdd (const EcDomainParameters *params, EcPoint *r, const EcPoint *s, const EcPoint *t)
Point addition.
error_t ecFullSub (const EcDomainParameters *params, EcPoint *r, const EcPoint *s, const EcPoint *t)
Point subtraction.
error_t ecMult (const EcDomainParameters *params, EcPoint *r, const Mpi *d, const EcPoint *s)
Scalar multiplication.
uint_t ecTwinMultF (uint_t t)
An auxiliary function for the twin multiplication.
error_t ecTwinMult (const EcDomainParameters *params, EcPoint *r, const Mpi *d0, const EcPoint *s, const Mpi *d1, const EcPoint *t)
Twin multiplication.
error_t ecAddMod (const EcDomainParameters *params, Mpi *r, const Mpi *a, const Mpi *b)
Fast modular addition.
error_t ecSubMod (const EcDomainParameters *params, Mpi *r, const Mpi *a, const Mpi *b)
Fast modular subtraction.
error_t ecMulMod (const EcDomainParameters *params, Mpi *r, const Mpi *a, const Mpi *b)
Fast modular multiplication.
error_t ecSqrMod (const EcDomainParameters *params, Mpi *r, const Mpi *a)
Fast modular squaring.
Detailed Description
ECC (Elliptic Curve Cryptography)
License
Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneCrypto Open.
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.
Author: Oryx Embedded SARL (www.oryx-embedded.com)
Version: 1.7.6
Definition in file ec.c .
Function Documentation
Point addition (helper routine)
Parameters:
[in] params EC domain parameters
[out] r Resulting point R = S + T
[in] s First operand
[in] t Second operand
Returns: Error code
Definition at line 523 of file ec.c .
Fast modular addition.
Parameters:
[in] params EC domain parameters
[out] r Resulting integer R = (A + B) mod p
[in] a An integer such as 0 <= A < p
[in] b An integer such as 0 <= B < p
Returns: Error code
Definition at line 1049 of file ec.c .
Recover affine representation.
Parameters:
[in] params EC domain parameters
[out] r Affine representation of the point
[in] s Projective representation of the point
Returns: Error code
Definition at line 305 of file ec.c .
Copy EC point.
Parameters:
[out] r Destination EC point
[in] s Source EC point
Returns: Error code
Definition at line 172 of file ec.c .
Point doubling.
Parameters:
[in] params EC domain parameters
[out] r Resulting point R = 2S
[in] s Point S
Returns: Error code
Definition at line 392 of file ec.c .
Convert an EC point to an octet string.
Parameters:
[in] params EC domain parameters
[in] a EC point to be converted
[out] data Pointer to the octet string
[out] length Length of the resulting octet string
Returns: Error code
Definition at line 243 of file ec.c .
Release an elliptic curve point.
Parameters:
[in,out] r Pointer to the EC point to initialize to free
Definition at line 156 of file ec.c .
Release EC domain parameters.
Parameters:
[in] params Pointer to the EC domain parameters to free
Definition at line 70 of file ec.c .
Point addition.
Parameters:
[in] params EC domain parameters
[out] r Resulting point R = S + T
[in] s First operand
[in] t Second operand
Returns: Error code
Definition at line 682 of file ec.c .
Point subtraction.
Parameters:
[in] params EC domain parameters
[out] r Resulting point R = S - T
[in] s First operand
[in] t Second operand
Returns: Error code
Definition at line 730 of file ec.c .
Convert an octet string to an EC point.
Parameters:
[in] params EC domain parameters
[out] r EC point resulting from the conversion
[in] data Pointer to the octet string
[in] length Length of the octet string
Returns: Error code
Definition at line 200 of file ec.c .
Initialize elliptic curve point.
Parameters:
[in,out] r Pointer to the EC point to be initialized
Definition at line 142 of file ec.c .
Initialize EC domain parameters.
Parameters:
[in] params Pointer to the EC domain parameters to be initialized
Definition at line 50 of file ec.c .
Check whether the affine point S is on the curve.
Parameters:
[in] params EC domain parameters
[in] s Affine representation of the point
Returns: TRUE if the affine point S is on the curve, else FALSE
Definition at line 350 of file ec.c .
Load EC domain parameters.
Parameters:
[out] params Pointer to the structure to be initialized
[in] curveInfo Elliptic curve parameters
Returns: Error code
Definition at line 88 of file ec.c .
Fast modular multiplication.
Parameters:
[in] params EC domain parameters
[out] r Resulting integer R = (A * B) mod p
[in] a An integer such as 0 <= A < p
[in] b An integer such as 0 <= B < p
Returns: Error code
Definition at line 1105 of file ec.c .
Scalar multiplication.
Parameters:
[in] params EC domain parameters
[out] r Resulting point R = d.S
[in] d An integer d such as 0 <= d < p
[in] s EC point
Returns: Error code
Definition at line 765 of file ec.c .
Compute projective representation.
Parameters:
[in] params EC domain parameters
[out] r Projective representation of the point
[in] s Affine representation of the point
Returns: Error code
Definition at line 282 of file ec.c .
Fast modular squaring.
Parameters:
[in] params EC domain parameters
[out] r Resulting integer R = (A ^ 2) mod p
[in] a An integer such as 0 <= A < p
Returns: Error code
Definition at line 1136 of file ec.c .
Fast modular subtraction.
Parameters:
[in] params EC domain parameters
[out] r Resulting integer R = (A - B) mod p
[in] a An integer such as 0 <= A < p
[in] b An integer such as 0 <= B < p
Returns: Error code
Definition at line 1077 of file ec.c .
Twin multiplication.
Parameters:
[in] params EC domain parameters
[out] r Resulting point R = d0.S + d1.T
[in] d0 An integer d such as 0 <= d0 < p
[in] s EC point
[in] d1 An integer d such as 0 <= d1 < p
[in] t EC point
Returns: Error code
Definition at line 897 of file ec.c .
uint_t ecTwinMultF
(
uint_t
t )
An auxiliary function for the twin multiplication.
Parameters:
[in] t An integer T such as 0 <= T <= 31
Returns: Output value
Definition at line 871 of file ec.c .