PIC32CX public-key hardware accelerator (PUKCC) More...
#include "pic32c.h"#include "pukcc/CryptoLib_typedef_pb.h"#include "pukcc/CryptoLib_Headers_pb.h"#include "core/crypto.h"#include "hardware/pic32cx/pic32cx_crypto.h"#include "hardware/pic32cx/pic32cx_crypto_pkc.h"#include "pkc/rsa.h"#include "ecc/ec.h"#include "ecc/ecdsa.h"#include "mpi/mpi.h"#include "debug.h"Go to the source code of this file.
Macros | |
| #define | TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Functions | |
| error_t | pukccInit (void) |
| Initialize PUKCC module. More... | |
| uint8_t * | pukccImportArray (uint8_t **dest, const uint8_t *array, size_t arrayLen, size_t totalLen) |
| Import byte array. More... | |
| uint8_t * | pukccImportMpi (uint8_t **dest, const Mpi *src, size_t totalLen) |
| Import multiple-precision integer. More... | |
| uint8_t * | pukccWorkspace (uint8_t **dest, size_t totalLen) |
| Initialize workspace area. More... | |
| error_t | mpiMul (Mpi *r, const Mpi *a, const Mpi *b) |
| Multiple precision multiplication. More... | |
| error_t | mpiMod2 (Mpi *r, const Mpi *a, const Mpi *p) |
| Modulo operation. More... | |
| error_t | mpiInvMod (Mpi *r, const Mpi *a, const Mpi *p) |
| Modular inverse. More... | |
| error_t | mpiExpMod (Mpi *r, const Mpi *a, const Mpi *e, const Mpi *p) |
| Modular exponentiation. More... | |
| error_t | mpiCheckProbablePrime (const Mpi *a) |
| Test whether a number is probable prime. More... | |
| error_t | rsadp (const RsaPrivateKey *key, const Mpi *c, Mpi *m) |
| RSA decryption primitive. More... | |
| bool_t | ecIsPointAffine (const EcDomainParameters *ecParams, const EcPoint *s) |
| Check whether the affine point S is on the curve. More... | |
| error_t | ecAffinify (const EcDomainParameters *ecParams, EcPoint *r, const EcPoint *s) |
| Recover affine representation. More... | |
| error_t | ecMult (const EcDomainParameters *ecParams, EcPoint *r, const Mpi *d, const EcPoint *s) |
| Scalar multiplication. More... | |
| error_t | ecdsaGenerateSignature (const PrngAlgo *prngAlgo, void *prngContext, const EcDomainParameters *ecParams, const EcPrivateKey *privateKey, const uint8_t *digest, size_t digestLen, EcdsaSignature *signature) |
| ECDSA signature generation. More... | |
| error_t | ecdsaVerifySignature (const EcDomainParameters *ecParams, const EcPublicKey *publicKey, const uint8_t *digest, size_t digestLen, const EcdsaSignature *signature) |
| ECDSA signature verification. More... | |
Variables | |
| PPUKCL_PARAM | pvPUKCLParam |
| PUKCL_PARAM | PUKCLParam |
Detailed Description
PIC32CX public-key hardware accelerator (PUKCC)
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2023 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.2.2
Definition in file pic32cx_crypto_pkc.c.
Macro Definition Documentation
◆ TRACE_LEVEL
| #define TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Definition at line 32 of file pic32cx_crypto_pkc.c.
Function Documentation
◆ ecAffinify()
| error_t ecAffinify | ( | const EcDomainParameters * | ecParams, |
| EcPoint * | r, | ||
| const EcPoint * | s | ||
| ) |
Recover affine representation.
- Parameters
-
[in] ecParams EC domain parameters [out] r Affine representation of the point [in] s Projective representation of the point
- Returns
- Error code
Definition at line 954 of file pic32cx_crypto_pkc.c.
◆ ecdsaGenerateSignature()
| error_t ecdsaGenerateSignature | ( | const PrngAlgo * | prngAlgo, |
| void * | prngContext, | ||
| const EcDomainParameters * | ecParams, | ||
| const EcPrivateKey * | privateKey, | ||
| const uint8_t * | digest, | ||
| size_t | digestLen, | ||
| EcdsaSignature * | signature | ||
| ) |
ECDSA signature generation.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] ecParams EC domain parameters [in] privateKey Signer's ECDSA private key [in] digest Digest of the message to be signed [in] digestLen Length in octets of the digest [out] signature (R, S) integer pair
- Returns
- Error code
Definition at line 1192 of file pic32cx_crypto_pkc.c.
◆ ecdsaVerifySignature()
| error_t ecdsaVerifySignature | ( | const EcDomainParameters * | ecParams, |
| const EcPublicKey * | publicKey, | ||
| const uint8_t * | digest, | ||
| size_t | digestLen, | ||
| const EcdsaSignature * | signature | ||
| ) |
ECDSA signature verification.
- Parameters
-
[in] ecParams EC domain parameters [in] publicKey Signer's ECDSA public key [in] digest Digest of the message whose signature is to be verified [in] digestLen Length in octets of the digest [in] signature (R, S) integer pair
- Returns
- Error code
Definition at line 1353 of file pic32cx_crypto_pkc.c.
◆ ecIsPointAffine()
| bool_t ecIsPointAffine | ( | const EcDomainParameters * | ecParams, |
| const EcPoint * | s | ||
| ) |
Check whether the affine point S is on the curve.
- 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
Definition at line 855 of file pic32cx_crypto_pkc.c.
◆ ecMult()
| error_t ecMult | ( | const EcDomainParameters * | ecParams, |
| EcPoint * | r, | ||
| const Mpi * | d, | ||
| const EcPoint * | s | ||
| ) |
Scalar multiplication.
- 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
Definition at line 1064 of file pic32cx_crypto_pkc.c.
◆ mpiCheckProbablePrime()
Test whether a number is probable prime.
- Parameters
-
[in] a Pointer to a multiple precision integer
- Returns
- Error code
Definition at line 581 of file pic32cx_crypto_pkc.c.
◆ mpiExpMod()
Modular exponentiation.
- Parameters
-
[out] r Resulting integer R = A ^ E mod P [in] a Pointer to a multiple precision integer [in] e Exponent [in] p Modulus
- Returns
- Error code
Definition at line 431 of file pic32cx_crypto_pkc.c.
◆ mpiInvMod()
Modular inverse.
- Parameters
-
[out] r Resulting integer R = A^-1 mod P [in] a The multiple precision integer A [in] p The modulus P
- Returns
- Error code
Definition at line 356 of file pic32cx_crypto_pkc.c.
◆ mpiMod2()
Modulo operation.
- Parameters
-
[out] r Resulting integer R = A mod P [in] a The multiple precision integer to be reduced [in] p The modulus P
- Returns
- Error code
Definition at line 281 of file pic32cx_crypto_pkc.c.
◆ mpiMul()
Multiple precision multiplication.
- Parameters
-
[out] r Resulting integer R = A * B [in] a First operand A [in] b Second operand B
- Returns
- Error code
Definition at line 193 of file pic32cx_crypto_pkc.c.
◆ pukccImportArray()
| uint8_t* pukccImportArray | ( | uint8_t ** | dest, |
| const uint8_t * | array, | ||
| size_t | arrayLen, | ||
| size_t | totalLen | ||
| ) |
Import byte array.
- Parameters
-
[in,out] dest Pointer to the crypto memory [in] array Pointer to the byte array [in] arrayLen Length of the array to be copied [in] totalLen Desired length of the area, in bytes
- Returns
- Pointer to the initialized area
Definition at line 101 of file pic32cx_crypto_pkc.c.
◆ pukccImportMpi()
| uint8_t* pukccImportMpi | ( | uint8_t ** | dest, |
| const Mpi * | src, | ||
| size_t | totalLen | ||
| ) |
Import multiple-precision integer.
- Parameters
-
[in,out] dest Pointer to the crypto memory [in] src Pointer to the multiple-precision integer [in] totalLen Desired length of the area, in bytes
- Returns
- Pointer to the initialized area
Definition at line 138 of file pic32cx_crypto_pkc.c.
◆ pukccInit()
| error_t pukccInit | ( | void | ) |
Initialize PUKCC module.
Definition at line 59 of file pic32cx_crypto_pkc.c.
◆ pukccWorkspace()
| uint8_t* pukccWorkspace | ( | uint8_t ** | dest, |
| size_t | totalLen | ||
| ) |
Initialize workspace area.
- Parameters
-
[in,out] dest Pointer to the crypto memory [in] totalLen Desired length of the area, in bytes
- Returns
- Pointer to the initialized area
Definition at line 163 of file pic32cx_crypto_pkc.c.
◆ rsadp()
| error_t rsadp | ( | const RsaPrivateKey * | key, |
| const Mpi * | c, | ||
| Mpi * | m | ||
| ) |
RSA decryption primitive.
- Parameters
-
[in] key RSA private key [in] c Ciphertext representative [out] m Message representative
- Returns
- Error code
Definition at line 725 of file pic32cx_crypto_pkc.c.
Variable Documentation
◆ PUKCLParam
| PUKCL_PARAM PUKCLParam |
Definition at line 52 of file pic32cx_crypto_pkc.c.
◆ pvPUKCLParam
| PPUKCL_PARAM pvPUKCLParam |
Definition at line 51 of file pic32cx_crypto_pkc.c.
