ECC (Elliptic Curve Cryptography) More...
Go to the source code of this file.
Data Structures | |
struct | EcPoint |
EC point. More... | |
struct | EcDomainParameters |
EC domain parameters. More... | |
struct | EcPublicKey |
EC public key. More... | |
struct | EcPrivateKey |
EC private key. More... | |
Macros | |
#define | EC_CHECK(f) if((error = f) != NO_ERROR) goto end |
Enumerations | |
enum | EcPointFormat { EC_POINT_FORMAT_COMPRESSED_EVEN = 0x02, EC_POINT_FORMAT_COMPRESSED_ODD = 0x03, EC_POINT_FORMAT_UNCOMPRESSED = 0x04 } |
EC point format. More... | |
Functions | |
void | ecInitDomainParameters (EcDomainParameters *params) |
Initialize EC domain parameters. More... | |
void | ecFreeDomainParameters (EcDomainParameters *params) |
Release EC domain parameters. More... | |
error_t | ecLoadDomainParameters (EcDomainParameters *params, const EcCurveInfo *curveInfo) |
Load EC domain parameters. More... | |
void | ecInitPublicKey (EcPublicKey *key) |
Initialize an EC public key. More... | |
void | ecFreePublicKey (EcPublicKey *key) |
Release an EC public key. More... | |
void | ecInitPrivateKey (EcPrivateKey *key) |
Initialize an EC private key. More... | |
void | ecFreePrivateKey (EcPrivateKey *key) |
Release an EdDSA private key. More... | |
error_t | ecGenerateKeyPair (const PrngAlgo *prngAlgo, void *prngContext, const EcDomainParameters *params, EcPrivateKey *privateKey, EcPublicKey *publicKey) |
EC key pair generation. More... | |
error_t | ecGeneratePrivateKey (const PrngAlgo *prngAlgo, void *prngContext, const EcDomainParameters *params, EcPrivateKey *privateKey) |
EC private key generation. More... | |
error_t | ecGeneratePublicKey (const EcDomainParameters *params, const EcPrivateKey *privateKey, EcPublicKey *publicKey) |
Derive the public key from an EC private key. More... | |
void | ecInit (EcPoint *r) |
Initialize elliptic curve point. More... | |
void | ecFree (EcPoint *r) |
Release an elliptic curve point. More... | |
error_t | ecCopy (EcPoint *r, const EcPoint *s) |
Copy EC point. More... | |
error_t | ecImport (const EcDomainParameters *params, EcPoint *r, const uint8_t *data, size_t length) |
Convert an octet string to an EC point. More... | |
error_t | ecExport (const EcDomainParameters *params, const EcPoint *a, uint8_t *data, size_t *length) |
Convert an EC point to an octet string. More... | |
error_t | ecProjectify (const EcDomainParameters *params, EcPoint *r, const EcPoint *s) |
Compute projective representation. More... | |
error_t | ecAffinify (const EcDomainParameters *params, EcPoint *r, const EcPoint *s) |
Recover affine representation. More... | |
bool_t | ecIsPointAffine (const EcDomainParameters *params, const EcPoint *s) |
Check whether the affine point S is on the curve. More... | |
error_t | ecDouble (const EcDomainParameters *params, EcPoint *r, const EcPoint *s) |
Point doubling. More... | |
error_t | ecAdd (const EcDomainParameters *params, EcPoint *r, const EcPoint *s, const EcPoint *t) |
Point addition (helper routine) More... | |
error_t | ecFullAdd (const EcDomainParameters *params, EcPoint *r, const EcPoint *s, const EcPoint *t) |
Point addition. More... | |
error_t | ecFullSub (const EcDomainParameters *params, EcPoint *r, const EcPoint *s, const EcPoint *t) |
Point subtraction. More... | |
error_t | ecMult (const EcDomainParameters *params, EcPoint *r, const Mpi *d, const EcPoint *s) |
Scalar multiplication. More... | |
error_t | ecTwinMult (const EcDomainParameters *params, EcPoint *r, const Mpi *d0, const EcPoint *s, const Mpi *d1, const EcPoint *t) |
Twin multiplication. More... | |
error_t | ecAddMod (const EcDomainParameters *params, Mpi *r, const Mpi *a, const Mpi *b) |
Fast modular addition. More... | |
error_t | ecSubMod (const EcDomainParameters *params, Mpi *r, const Mpi *a, const Mpi *b) |
Fast modular subtraction. More... | |
error_t | ecMulMod (const EcDomainParameters *params, Mpi *r, const Mpi *a, const Mpi *b) |
Fast modular multiplication. More... | |
error_t | ecSqrMod (const EcDomainParameters *params, Mpi *r, const Mpi *a) |
Fast modular squaring. More... | |
Variables | |
const uint8_t | EC_PUBLIC_KEY_OID [7] |
Detailed Description
ECC (Elliptic Curve Cryptography)
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 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.
- Version
- 2.4.4
Definition in file ec.h.
Macro Definition Documentation
◆ EC_CHECK
Enumeration Type Documentation
◆ EcPointFormat
enum EcPointFormat |
Function Documentation
◆ ecAdd()
error_t ecAdd | ( | const EcDomainParameters * | params, |
EcPoint * | r, | ||
const EcPoint * | s, | ||
const EcPoint * | t | ||
) |
◆ ecAddMod()
error_t ecAddMod | ( | const EcDomainParameters * | params, |
Mpi * | r, | ||
const Mpi * | a, | ||
const Mpi * | b | ||
) |
◆ ecAffinify()
error_t ecAffinify | ( | const EcDomainParameters * | ecParams, |
EcPoint * | r, | ||
const EcPoint * | s | ||
) |
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
- Parameters
-
[in] ecParams EC domain parameters [out] r Affine representation of the point [in] s Projective representation of the point
- Returns
- Error code
◆ ecCopy()
◆ ecDouble()
error_t ecDouble | ( | const EcDomainParameters * | params, |
EcPoint * | r, | ||
const EcPoint * | s | ||
) |
◆ ecExport()
error_t ecExport | ( | const EcDomainParameters * | params, |
const EcPoint * | a, | ||
uint8_t * | data, | ||
size_t * | length | ||
) |
◆ ecFree()
void ecFree | ( | EcPoint * | r | ) |
◆ ecFreeDomainParameters()
void ecFreeDomainParameters | ( | EcDomainParameters * | params | ) |
◆ ecFreePrivateKey()
void ecFreePrivateKey | ( | EcPrivateKey * | key | ) |
◆ ecFreePublicKey()
void ecFreePublicKey | ( | EcPublicKey * | key | ) |
◆ ecFullAdd()
error_t ecFullAdd | ( | const EcDomainParameters * | params, |
EcPoint * | r, | ||
const EcPoint * | s, | ||
const EcPoint * | t | ||
) |
◆ ecFullSub()
error_t ecFullSub | ( | const EcDomainParameters * | params, |
EcPoint * | r, | ||
const EcPoint * | s, | ||
const EcPoint * | t | ||
) |
◆ ecGenerateKeyPair()
error_t ecGenerateKeyPair | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const EcDomainParameters * | params, | ||
EcPrivateKey * | privateKey, | ||
EcPublicKey * | publicKey | ||
) |
◆ ecGeneratePrivateKey()
error_t ecGeneratePrivateKey | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const EcDomainParameters * | params, | ||
EcPrivateKey * | privateKey | ||
) |
◆ ecGeneratePublicKey()
error_t ecGeneratePublicKey | ( | const EcDomainParameters * | params, |
const EcPrivateKey * | privateKey, | ||
EcPublicKey * | publicKey | ||
) |
◆ ecImport()
error_t ecImport | ( | const EcDomainParameters * | params, |
EcPoint * | r, | ||
const uint8_t * | data, | ||
size_t | length | ||
) |
◆ ecInit()
void ecInit | ( | EcPoint * | r | ) |
◆ ecInitDomainParameters()
void ecInitDomainParameters | ( | EcDomainParameters * | params | ) |
◆ ecInitPrivateKey()
void ecInitPrivateKey | ( | EcPrivateKey * | key | ) |
◆ ecInitPublicKey()
void ecInitPublicKey | ( | EcPublicKey * | key | ) |
◆ ecIsPointAffine()
bool_t ecIsPointAffine | ( | const EcDomainParameters * | ecParams, |
const EcPoint * | s | ||
) |
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
- Parameters
-
[in] ecParams EC domain parameters [in] s Affine representation of the point
- Returns
- TRUE if the affine point S is on the curve, else FALSE
◆ ecLoadDomainParameters()
error_t ecLoadDomainParameters | ( | EcDomainParameters * | params, |
const EcCurveInfo * | curveInfo | ||
) |
◆ ecMulMod()
error_t ecMulMod | ( | const EcDomainParameters * | params, |
Mpi * | r, | ||
const Mpi * | a, | ||
const Mpi * | b | ||
) |
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
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
◆ ecMult()
error_t ecMult | ( | const EcDomainParameters * | params, |
EcPoint * | r, | ||
const Mpi * | d, | ||
const EcPoint * | s | ||
) |
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
- Parameters
-
[in] ecParams 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
◆ ecProjectify()
error_t ecProjectify | ( | const EcDomainParameters * | params, |
EcPoint * | r, | ||
const EcPoint * | s | ||
) |
◆ ecSqrMod()
error_t ecSqrMod | ( | const EcDomainParameters * | params, |
Mpi * | r, | ||
const Mpi * | a | ||
) |
◆ ecSubMod()
error_t ecSubMod | ( | const EcDomainParameters * | params, |
Mpi * | r, | ||
const Mpi * | a, | ||
const Mpi * | b | ||
) |