SAME53 public-key hardware accelerator (PUKCC) More...
#include "sam.h"
#include "pukcc/CryptoLib_typedef_pb.h"
#include "pukcc/CryptoLib_Headers_pb.h"
#include "core/crypto.h"
#include "hardware/same53/same53_crypto.h"
#include "hardware/same53/same53_crypto_pkc.h"
#include "pkc/rsa.h"
#include "ecc/ec.h"
#include "ecc/ec_misc.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 *src, size_t srcLen, size_t totalLen) |
Import byte array. More... | |
uint8_t * | pukccImportScalar (uint8_t **dest, const uint32_t *src, size_t totalLen) |
Import scalar. 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 EcCurve *curve, const EcPoint *s) |
Check whether the affine point S is on the curve. More... | |
error_t | ecAffinify (const EcCurve *curve, EcPoint3 *r, const EcPoint3 *s) |
Recover affine representation. More... | |
error_t | ecMulFast (const EcCurve *curve, EcPoint3 *r, const uint32_t *d, const EcPoint3 *s) |
Scalar multiplication (fast calculation) More... | |
error_t | ecMulRegular (const EcCurve *curve, EcPoint3 *r, const uint32_t *d, const EcPoint3 *s) |
Scalar multiplication (regular calculation) More... | |
error_t | ecdsaGenerateSignature (const PrngAlgo *prngAlgo, void *prngContext, const EcPrivateKey *privateKey, const uint8_t *digest, size_t digestLen, EcdsaSignature *signature) |
ECDSA signature generation. More... | |
error_t | ecdsaVerifySignature (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
SAME53 public-key hardware accelerator (PUKCC)
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2025 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.5.0
Definition in file same53_crypto_pkc.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Definition at line 32 of file same53_crypto_pkc.c.
Function Documentation
◆ ecAffinify()
Recover affine representation.
- Parameters
-
[in] curve Elliptic curve parameters [out] r Affine representation of the point [in] s Projective representation of the point
- Returns
- Error code
Definition at line 987 of file same53_crypto_pkc.c.
◆ ecdsaGenerateSignature()
error_t ecdsaGenerateSignature | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
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] privateKey Signer's EC 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 1242 of file same53_crypto_pkc.c.
◆ ecdsaVerifySignature()
error_t ecdsaVerifySignature | ( | const EcPublicKey * | publicKey, |
const uint8_t * | digest, | ||
size_t | digestLen, | ||
const EcdsaSignature * | signature | ||
) |
ECDSA signature verification.
- Parameters
-
[in] publicKey Signer's EC 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 1397 of file same53_crypto_pkc.c.
◆ ecIsPointAffine()
Check whether the affine point S is on the curve.
- Parameters
-
[in] curve Elliptic curve parameters [in] s Affine representation of the point
- Returns
- TRUE if the affine point S is on the curve, else FALSE
Definition at line 888 of file same53_crypto_pkc.c.
◆ ecMulFast()
Scalar multiplication (fast calculation)
- Parameters
-
[in] curve Elliptic curve 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 1096 of file same53_crypto_pkc.c.
◆ ecMulRegular()
error_t ecMulRegular | ( | const EcCurve * | curve, |
EcPoint3 * | r, | ||
const uint32_t * | d, | ||
const EcPoint3 * | s | ||
) |
Scalar multiplication (regular calculation)
- Parameters
-
[in] curve Elliptic curve parameters [out] r Resulting point R = d.S [in] d An integer d such as 0 <= d < q [in] s EC point
- Returns
- Error code
Definition at line 1113 of file same53_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 610 of file same53_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 460 of file same53_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 385 of file same53_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 310 of file same53_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 222 of file same53_crypto_pkc.c.
◆ pukccImportArray()
uint8_t* pukccImportArray | ( | uint8_t ** | dest, |
const uint8_t * | src, | ||
size_t | srcLen, | ||
size_t | totalLen | ||
) |
Import byte array.
- Parameters
-
[in,out] dest Pointer to the crypto memory [in] src Pointer to the byte array [in] srcLen 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 102 of file same53_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 165 of file same53_crypto_pkc.c.
◆ pukccImportScalar()
uint8_t* pukccImportScalar | ( | uint8_t ** | dest, |
const uint32_t * | src, | ||
size_t | totalLen | ||
) |
Import scalar.
- Parameters
-
[in,out] dest Pointer to the crypto memory [in] src Pointer to the scalar [in] totalLen Desired length of the area, in bytes
- Returns
- Pointer to the initialized area
Definition at line 139 of file same53_crypto_pkc.c.
◆ pukccInit()
error_t pukccInit | ( | void | ) |
Initialize PUKCC module.
Definition at line 60 of file same53_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 190 of file same53_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 756 of file same53_crypto_pkc.c.
Variable Documentation
◆ PUKCLParam
PUKCL_PARAM PUKCLParam |
Definition at line 53 of file same53_crypto_pkc.c.
◆ pvPUKCLParam
PPUKCL_PARAM pvPUKCLParam |
Definition at line 52 of file same53_crypto_pkc.c.